var visibility2018 = 0;var lastposition = ""; var activeManifest = ''; var click2close = false; $(function (){ $("#i").draggable({ axis: "x", containment: "parent", stop: function(event, ui) { var leftPosition = ui.position.left; var x = 115; if (leftPosition != x) { $(this).effect("shake", {distance:5, times:2}, 300); $(this).animate({"left" : x + "px"}, 1000); } } }); }); $(function (){ $("#radiodial").draggable({ axis: "x", containment: "parent", drag: function(event, ui) { var leftPosition = ui.position.left; var halfdialw = ($('#radiodial').width())/2; var bgpos = $("#radiobackground").position(); var xmin = (bgpos.left) - halfdialw + 7; var xmax = (bgpos.left) + $('#radiobackground').width() - halfdialw - 2; if (leftPosition < xmin) { ui.position.left = xmin; } if (leftPosition > xmax) { ui.position.left = xmax; } realblockleft = Math.round($("#box2018").position().left) + 14; realblockright = realblockleft + 39 - 24; if (leftPosition+20 > realblockleft && leftPosition+20 < realblockright) { if (!visibility2018){ showPreview ("2018"); visibility2018 = 1; // console.log ("l: "+realblockleft+" - 417"); } }else{ if (visibility2018){ hidePreview ("2018"); visibility2018 = 0; } } } }); }); $(function (){ $("#owndial").draggable({ axis: "x", containment: "parent", drag: function(event, ui) { var leftPosition = ui.position.left; var halfdialw = ($('#owndial').width())/2; var bgpos = $("#radiobackground").position(); var xmin = (bgpos.left) - halfdialw + 7; var xmax = (bgpos.left) + $('#radiobackground').width() - halfdialw - 2; if (leftPosition < xmin) { ui.position.left = xmin; } if (leftPosition > xmax) { ui.position.left = xmax; } $("#save"+activeManifest).position({ my: "top", at: "top", of: "#owndial" }); } }); }); function showPreview (manifest) { console.log ("showPreview "+manifest); $("#box"+manifest).css('opacity', '1'); $("#text"+manifest).css('opacity', '1'); $("#preview"+manifest).fadeTo(500, 0.8); $("#preview"+manifest).css('z-index', '35'); $("#preview"+manifest).css('cursor', 'pointer'); // $("#info"+manifest).fadeTo(500, 1); // $("#info"+manifest).css('z-index', '39'); $("#edit"+manifest).fadeTo(500, 1); $("#edit"+manifest).css('z-index', '39'); // $("#info"+manifest).css('cursor', 'pointer'); activeManifest = manifest; } function hidePreview (manifest) { // console.log ("hidePreview "+manifest); $("#preview"+manifest).fadeTo(500, 0); // $("#info"+manifest).fadeTo(500, 0); $("#preview"+manifest).css('z-index', '10'); $("#preview"+manifest).css('cursor', 'auto'); // $("#info"+manifest).css('z-index', '10'); $("#edit"+manifest).fadeTo(500, 0); $("#edit"+manifest).css('z-index', '10'); $("#save"+manifest).fadeTo(500, 0); $("#save"+manifest).css('z-index', '10'); $("#box"+manifest).css('opacity', '.6'); $("#text"+manifest).css('opacity', '.6'); $("#infocontent"+manifest).css('opacity','0'); $("#infocontent"+manifest).css('z-index','0'); $("#infocontent"+manifest).css('cursor','auto'); click2close = false; $("#newcontent"+manifest).css('opacity','0'); $("#newcontent"+manifest).css('z-index','0'); $("#newcontent"+manifest).css('cursor','auto'); } function hidePreviews (manifest) { if ("2018" != manifest){ // console.log ("hide '2018'"); hidePreview ("2018"); } } function showPreviews (manifest) { if ("2018" != manifest){ showPreview ("2018"); } } var own = false; /* $(function(){ $('#info2018').click(function(){ $('#infocontent2018').css('opacity', '1'); $('#infocontent2018').css('z-index', '40'); $('#infocontent2018').css('cursor', 'pointer'); $('#infocontent2018').load('/content.php?id=122&opinionator_id=1'); click2close = true; }); }); */ $(function(){ $('#edit2018').click(function(){ if (own){ $("#owndial").css("visibility","hidden"); $("#radiodial").css("visibility","visible"); $("#radiodial").draggable("enable"); $("#radiodial").css("cursor","ew-resize"); $("#radiodial").attr('src', 'img/radio-dial-365.png'); // showPreviews (2018); $('#edit2018').html("") $("#save2018").fadeTo(500, 0); $("#save2018").css('z-index', '10'); own = false; activeManifest = ''; }else{ $("#owndial").css("left",$("#radiodial").css("left")); $("#owndial").css("visibility","visible"); $("#radiodial").draggable("disable"); $("#radiodial").css("cursor","auto"); $("#radiodial").attr('src', 'img/radio-line-365.png'); $("#radiodial").css("visibility","hidden"); hidePreviews ("2018"); $("#edit2018").html("") $("#save2018").fadeTo(500, 1); $("#save2018").css('z-index', '40'); $("#save2018").position({ my: "top", at: "top", of: "#owndial" }); activeManifest = '2018'; console.log ("activeManifest edit click "+activeManifest); // setTimeout (function(){own = true;}, 5000); own = true; } }); }); $(function(){ $('#save2018').click(function(){ if (own){ console.log ("save 2018"); } }); }); $(function(){ $('#preview2018').click(function(){ $('#infocontent2018').css('opacity', '1'); $('#infocontent2018').css('z-index', '40'); $('#infocontent2018').css('cursor', 'pointer'); $('#infocontent2018').load('/content.php?id=122&opinionator_id=1'); activeManifest = '2018'; console.log ("activeManifest preview click "+activeManifest); click2close = true; }); }); $(function(){ $('#save2018').click(function(){ var position = $("#radiodial").position(); console.log ("position org: "+position.left); var position = $("#owndial").position(); console.log ("position own: "+position.left); var cip = (position.left - 39) * 100 / 728; newcontentleft = position.left + 30; $('#newcontent2018').css('opacity', '1'); $('#newcontent2018').css('z-index', '40'); $('#newcontent2018').css('cursor', 'pointer'); $('#newcontent2018').css('left', newcontentleft+"px"); console.log ("session id: '"++"'"); $('#newcontent2018').load('/newopinion.php?mid=122&jsid=2018&uid=&wid=18&oid=1&cip='+cip); // $('#newcontent2018').load('/newopinion.php?id=122'); // $("#radiodial").draggable("enable"); // wiel: geknoei // own = false; // wiel: geknoei }); }); $(function (){ $('#text2018').click(function(){ var position = $(this).position(); $("#radiodial").animate({"left" : position.left + "px"}, 500, "easeOutBounce", function(){ showPreview ("2018"); visibility2018 = 1; }); // $("#radiodial").effect("shake", {distance:1.5, times:2}, 150); $("#owndial").css("visibility","hidden"); }); }); $(function (){ $("#timearrow").draggable({ axis: "y", drag: function(event, ui) { var topPosition = ui.position.top; var halfdialh = ($('#timearrow').height())/2; var position = topPosition - halfdialh; var bgpos = $("#timedial").position(); var ymin = (bgpos.top) - halfdialh + 7; var ymax = (bgpos.top) + $('#timedial').height() - halfdialh - 12; if (topPosition < ymin) { ui.position.top = ymin; } if (topPosition > ymax) { ui.position.top = ymax; } msg=""; if (lastposition.length){ //console.log (lastposition); if (lastposition!="Sanneke Stigter" && position > 317.2 && position < 327.2) { msg = "Sanneke Stigter"; newleft = $("#box2018").position().left + Math.floor(Math.random()*(150)) - 75; $("#box2018").animate({"left" : newleft+"px"}, 100); $("#text2018").animate({"left" : newleft+"px"}, 100); $("#preview2018").animate({"left" : newleft+"px"}, 100); $("#info2018").animate({"left" : newleft+"px"}, 100); $("#infocontent2018").animate({"left" : newleft+"px"}, 100); $("#newcontent2018").animate({"left" : newleft+"px"}, 100); msg += ", 2018"; lastposition = "Sanneke Stigter"; } }else{ //console.log ("empty"); lastposition = "Sanneke Stigter"; } // $("#debug").html(position+" "+msg); } }); }); $(document).mouseup (function(){ console.log ("mouseup "+activeManifest); if (click2close){ $("#infocontent"+activeManifest).css('opacity','0'); $("#infocontent"+activeManifest).css('z-index','0'); $("#infocontent"+activeManifest).css('cursor','auto'); click2close = false; } $('#containedinfocontent').css("visibility","hidden"); $('#installedinfocontent').css("visibility","hidden"); $('#performedinfocontent').css("visibility","hidden"); }); $(function(){ $('#containedinfo').click(function(){ $('#containedinfocontent').css("visibility","visible"); }); }); $(function(){ $('#installedinfo').click(function(){ $('#installedinfocontent').css("visibility","visible"); }); }); $(function(){ $('#performedinfo').click(function(){ $('#performedinfocontent').css("visibility","visible"); }); });