var memodrag = false; $(document).ready(function() { $("body").css("user-select","none"); $("body").on("mousedown", function(event) { if(!memodrag) { $("body").css("user-select","none"); //OnMouseDownScaleDiv(event); } else { //$("body").css("user-select","all"); document.ondragstart = new Function ("return true"); document.body.ondragstart= function(){return true;} } }); $("#the_notes").on("mouseover",'.PIApostit', function() { //$("body").css("user-select","all"); memodrag = true; document.ondragstart = new Function ("return true"); document.body.ondragstart= function(){return true;} }); $("#the_notes").on("mouseout",'.PIApostit', function() { $("body").css("user-select","none"); memodrag = false; //document.ondragstart = new Function ("return false"); //document.body.ondragstart= function(){return false;} //console.log(document.ondragstart,document.body.ondragstart); }); initMemo(); }); var mcnt = 0; var memoData = []; window.onbeforeunload = function () { var val = ""; $('.PIApostit').each(function() { val += JSON.stringify($(this).postitall('options'))+"\n"; }); memoData[xxx] = val; var mkey = albumCode+"_memo"; try{window.localStorage.setItem(mkey, JSON.stringify( memoData));}catch(e){} } function initMemo() { var mkey = albumCode+"_memo"; var getMemo = {}; try{ getMemo = window.localStorage.getItem(mkey); memoData = JSON.parse(getMemo); }catch(e){} if(!Array.isArray(memoData)) memoData = []; creatMemo(); } function creatMemo() { if(!Array.isArray(memoData)) return; if(memoData[xxx] !== undefined && memoData[xxx] !== null) { var lines = memoData[xxx].split('\n'); for(var i = 0;i < lines.length;i++) { if(lines[i]) { var o = JSON.parse(lines[i]+'\n'); mcnt++; $('
').postitall(o); } } } } function addMemo() { var pgtLeft = LLeft; var pgtTop = parseInt( $('#oBorderBottomBg').css('top') ) + outskin_sideways_height + 5; var mot = pgtTop - 200 - 50; var mol = (pgtLeft+pgtWidth+20+78+20) - 80; mcnt++; $('').postitall({ "id":"pt-"+mcnt, "content":"", "posX":mol+"px", "posY":mot+"px", "style":{ 'textcolor' : "#000000", 'backgroundcolor' : "#fffc91", 'textshadow':false }}); $("#pia_editable_pt-"+mcnt).focus(); } function saveMemo() { mcnt = 0; var val = ""; $('.PIApostit').each(function() { val += JSON.stringify($(this).postitall('options'))+"\n"; }); memoData[xxx] = val; $("#the_notes").html(""); }