/* ---------------------------- */ /* XMLHTTPRequest Enable */ /* ---------------------------- */ function createObject() { var request_type; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ request_type = new ActiveXObject("Microsoft.XMLHTTP"); }else{ request_type = new XMLHttpRequest(); } return request_type; } var http = createObject(); /* -------------------------- */ /* INSERT */ /* -------------------------- */ /* Required: var nocache is a random number to add to request. This value solve an Internet Explorer cache issue */ var nocache = 0; function insert() { // Optional: Show a waiting message in the layer with ID login_response // Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding. var note= encodeURI(document.getElementById('note').value); var newnote= document.getElementById('note').value.replace(/(<([^>]+)>)/ig,""); var nid= encodeURI(document.getElementById('nid').value); var vid= encodeURI(document.getElementById('vid').value); var classe= encodeURI(document.getElementById('classe').value); if (note) { coloramatita(); } else { puliscimatita(); } // Update the new note cookie variable $.cookie(classe, newnote); // Pass the login variables like URL variable http.open('get', 'http://' + document.location.host + Drupal.settings.basePath + 'mynotes/insert?note=' + note + '&nid=' + nid + '&vid=' + vid + '&classe=' + classe); //http.onreadystatechange = insertReply; http.send(null); } function coloramatita(){ $("li.triggernote a").addClass('note-on'); } // end coloramatita function puliscimatita(){ $("li.triggernote a").removeClass('note-on'); } // end puliscimatita $(document).ready(function(){ var linkclasse = $('li.triggernote span', '#block-jquery_utils-0').html(); $('#block-jquery_utils-0').append('
'); $('#block-multiblock-1').append(''); //$('#content-area').addClass('note-stripe'); DECOMMENTARE PER OTTENERE VECCHIA FUNZIONALITA loadnote(); /*if (Drupal.settings.mynotes.mod == '1') { switchover(); }*/ var label = $('li.triggernote').children().attr('title'); $('li.triggernote').children().wrap(''); $("li.triggernote").click(function () { $(".mynote").trigger('click'); }); function switchover() { // popup mode: $("p").mouseover(function(){ $(this).children(".note").removeClass("hide"); }); $("p").mouseout(function(){ $(this).children(".note").addClass("hide"); }); } function loadnote(){ /* * 25 Agosto 2011 - 16.42 * * Bug - Traduzione dei bottoni da client e non da server. * * Scoperto - 25 Agosto 2011 - In occasione della traduzione del sito GPW in polacco. * * I bottoni venivano inviati dal server via json. non venivano tradotti in quanto la richiesta non era effettuata tramite lingua. * ( nella url non era presente) * Aggiunta al lingua nella url. Se la lingua non è definita, uso come fallback il vecchio sistema. * * Adesso le traduzioni di SALVA CHIUDI CANCELLA si possono effettuare tramite il sistema di translate interface * * Fabrizio Rapelli * */ var lll = $('html').attr('lang'); if(!!lll){ lll = lll+"/"; }else{ lll=''; } //get mynotes variables $.ajax({ url: "http://"+document.location.host+Drupal.settings.basePath+lll+"mynotes/select", dataType: 'json', async: false, success: function(json){ //success code: var marginleft = 0; //var marginleft = Drupal.settings.mynotes.marginleft; DECOMMENTA PER RISPRISTINARE CONTROLLO DA INTERFACCIA // get strings variables save = json.strings[1]; clos = json.strings[2]; cancel = json.strings[3]; var lingua = $('html').attr('lang'); if (lingua == 'it') { save = 'salva'; clos = 'chiudi'; cancel = 'elimina'; } else { /*save = 'save'; clos = 'close'; cancel = 'delete';*/ } width = 200; sidewidth = 200; count = 1; nid = Drupal.settings.mynotes.nid; vid = json.vid; jQuery.each($("#notes-wrapper"), function() { $(this).addClass('paragraph paragraph-'+nid+'-'+count); var testonota = json.notes['paragraph-'+nid+'-'+count]; //create cookie to save the note $.cookie('paragraph-'+nid+'-'+count, json.notes['paragraph-'+count]); var classiparagrafo = $('div#notes-wrapper').attr('class').split(" "); var classeparagrafo = classiparagrafo[2]; if ($.cookie(classeparagrafo)) { $('body').addClass('note-on'); } $(Drupal.settings.mynotes.blacklist).addClass('blacklisted'); if ($(this).hasClass("blacklisted")) {} else { if (testonota) { switch(Drupal.settings.mynotes.mod) { // Se utilizziamo la modalità "Barra laterale" estraggo le note e le visualizzo di fianco ai paragrafi ---- 'mod = 0' case '0': //RIMUOVERE CLASS HIDE PER OTTENERE LE NOTE VICINO AL PARAGRAFO $(this).prepend(' '); $('.note').click(editnote); $('.mynote-true').click(editnote); break; // Se utilizziamo la modalità "Pop Up" estraggo le note e le visualizzo onmouseover ---- 'mod = 1' case '1': //RIMUOVERE CLASS HIDE PER OTTENERE LE NOTE VICINO AL PARAGRAFO $(this).prepend(''+save+'
-'+cancel+'
-'+clos+'