(function($){MaterioPersonalNotes=function(){function init(){trace('MaterioPersonalNotes :: init');$(document).bind('resultscompleted resultschanged previewloaded',onResultsUpdated);};function onResultsUpdated(event){trace('MaterioPersonalNotes :: onResultsUpdated',event);ajaxifyLinks(event.container);};function ajaxifyLinks(container){trace('MaterioPersonalNotes :: ajaxifyLinks',container);container=((container!=null)?container:'body');$('a.personal-note-link:not(.ajax-processed), ',container).bind('click',onClickLink).addClass('ajax-processed');};function onClickLink(event){event.preventDefault();var $link=$(event.currentTarget);var note_nid=$link.attr('note_nid');var action=note_nid?'edit':'create';var src_nid=$link.attr('src_nid');trace('MaterioPersonalNotes :: src_nid',src_nid);trace('MaterioPersonalNotes :: note_nid',note_nid);var url=Drupal.settings.basePath +Drupal.settings.pathPrefix +'materio_personalnotes/form/'+action +'/'+src_nid;if(action=='edit'){url+='/'+note_nid;} $.getJSON(url,function(json){trace('MaterioPersonalNotes :: '+action+' : json',json);if(json.new_note_nid){updateNoteLink($link,json.new_note_nid);} showNoteForm($link,json);});return false;};function updateNoteLink($link,new_note_nid){trace('MaterioPersonalNotes :: updateNoteLink : new_note_nid',new_note_nid);$link.attr('note_nid',new_note_nid);$link.attr('href',Drupal.settings.pathPrefix+'node/'+new_note_nid+'/edit');};function showNoteForm($link,json){trace('MaterioPersonalNotes :: showNoteForm');$.event.trigger({type:"record-stat",categorie:"PersonalNotes",action:'show create form'});var $card=$link.parents('.node-materiau');if($card.is('.vm-cardmedium')||$card.is('.vm-cardbig')||$card.is('.vm-cardfull')){var $note=$('
').append($('