Your IP : 216.73.216.131


Current Path : /home/lejardintz/www/components/com_kunena/template/crypsis/media/js/
Upload File :
Current File : /home/lejardintz/www/components/com_kunena/template/crypsis/media/js/sisyphus-min.js

(function(b){b.fn.sisyphus=function(e){var d=b.map(this,function(g,f){return b(g).attr("id")+b(g).attr("name");}).join();var c=Sisyphus.getInstance(d);c.protect(this,e);return c;};var a={};a.isAvailable=function(){if(typeof b.jStorage==="object"){return true;}try{return localStorage.getItem;}catch(c){return false;}};a.set=function(c,d){if(typeof b.jStorage==="object"){b.jStorage.set(c,d+"");}else{try{localStorage.setItem(c,d+"");}catch(f){}}};a.get=function(d){if(typeof b.jStorage==="object"){var c=b.jStorage.get(d);return c?c.toString():c;}else{return localStorage.getItem(d);}};a.remove=function(c){if(typeof b.jStorage==="object"){b.jStorage.deleteKey(c);}else{localStorage.removeItem(c);}};Sisyphus=(function(){var d={instantiated:[],started:[]};function c(){return{setInstanceIdentifier:function(e){this.identifier=e;},getInstanceIdentifier:function(){return this.identifier;},setInitialOptions:function(e){var f={excludeFields:[],customKeySuffix:"",locationBased:false,timeout:0,autoRelease:true,onSave:function(){},onBeforeRestore:function(){},onRestore:function(){},onRelease:function(){}};this.options=this.options||b.extend(f,e);this.browserStorage=a;},setOptions:function(e){this.options=this.options||this.setInitialOptions(e);this.options=b.extend(this.options,e);},protect:function(e,g){this.setOptions(g);e=e||{};var f=this;this.targets=this.targets||[];if(f.options.name){this.href=f.options.name;}else{this.href=location.hostname+location.pathname+location.search+location.hash;}this.targets=b.merge(this.targets,e);this.targets=b.unique(this.targets);this.targets=b(this.targets);if(!this.browserStorage.isAvailable()){return false;}var h=f.options.onBeforeRestore.call(f);if(h===undefined||h){f.restoreAllData();}if(this.options.autoRelease){f.bindReleaseData();}if(!d.started[this.getInstanceIdentifier()]){if(f.isCKEditorPresent()){var i=setInterval(function(){if(CKEDITOR.isLoaded){clearInterval(i);f.bindSaveData();d.started[f.getInstanceIdentifier()]=true;}},100);}else{f.bindSaveData();d.started[f.getInstanceIdentifier()]=true;}}},isCKEditorPresent:function(){if(this.isCKEditorExists()){CKEDITOR.isLoaded=false;CKEDITOR.on("instanceReady",function(){CKEDITOR.isLoaded=true;});return true;}else{return false;}},isCKEditorExists:function(){return typeof CKEDITOR!="undefined";},findFieldsToProtect:function(e){return e.find(":input").not(":submit").not(":reset").not(":button").not(":file").not(":password").not(":disabled").not("[readonly]");},bindSaveData:function(){var e=this;if(e.options.timeout){e.saveDataByTimeout();}e.targets.each(function(){var f=b(this).attr("id")+b(this).attr("name");e.findFieldsToProtect(b(this)).each(function(){if(b.inArray(this,e.options.excludeFields)!==-1){return true;}var h=b(this);var g=(e.options.locationBased?e.href:"")+f+h.attr("name")+e.options.customKeySuffix;if(h.is(":text")||h.is("textarea")){if(!e.options.timeout){e.bindSaveDataImmediately(h,g);}}e.bindSaveDataOnChange(h);});});},saveAllData:function(){var e=this;e.targets.each(function(){var f=b(this).attr("id")+b(this).attr("name");var g={};e.findFieldsToProtect(b(this)).each(function(){var k=b(this);if(b.inArray(this,e.options.excludeFields)!==-1||k.attr("name")===undefined){return true;}var j=(e.options.locationBased?e.href:"")+f+k.attr("name")+e.options.customKeySuffix;var i=k.val();if(k.is(":checkbox")){if(k.attr("name").indexOf("[")!==-1){if(g[k.attr("name")]===true){return;}i=[];b("[name='"+k.attr("name")+"']:checked").each(function(){i.push(b(this).val());});g[k.attr("name")]=true;}else{i=k.is(":checked");}e.saveToBrowserStorage(j,i,false);}else{if(k.is(":radio")){if(k.is(":checked")){i=k.val();e.saveToBrowserStorage(j,i,false);}}else{if(e.isCKEditorExists()){var h;if(h=CKEDITOR.instances[k.attr("name")]||CKEDITOR.instances[k.attr("id")]){h.updateElement();e.saveToBrowserStorage(j,k.val(),false);}else{e.saveToBrowserStorage(j,i,false);}}else{e.saveToBrowserStorage(j,i,false);}}}});});e.options.onSave.call(e);},restoreAllData:function(){var e=this;var f=false;e.targets.each(function(){var h=b(this);var g=b(this).attr("id")+b(this).attr("name");e.findFieldsToProtect(h).each(function(){if(b.inArray(this,e.options.excludeFields)!==-1){return true;}var k=b(this);var j=(e.options.locationBased?e.href:"")+g+k.attr("name")+e.options.customKeySuffix;var i=e.browserStorage.get(j);if(i!==null){e.restoreFieldsData(k,i);f=true;}});});if(f){e.options.onRestore.call(e);}},restoreFieldsData:function(f,e){if(f.attr("name")===undefined){return false;}if(f.is(":checkbox")&&e!=="false"&&f.attr("name").indexOf("[")===-1){f.attr("checked","checked");}else{if(f.is(":checkbox")&&e==="false"&&f.attr("name").indexOf("[")===-1){f.removeAttr("checked");}else{if(f.is(":radio")){if(f.val()===e){f.attr("checked","checked");}}else{if(f.attr("name").indexOf("[")===-1){f.val(e);}else{e=e.split(",");f.val(e);}}}}},bindSaveDataImmediately:function(h,g){var e=this;if("onpropertychange" in h){h.get(0).onpropertychange=function(){e.saveToBrowserStorage(g,h.val());};}else{h.get(0).oninput=function(){e.saveToBrowserStorage(g,h.val());};}if(this.isCKEditorExists()){var f;if(f=CKEDITOR.instances[h.attr("name")]||CKEDITOR.instances[h.attr("id")]){f.document.on("keyup",function(){f.updateElement();e.saveToBrowserStorage(g,h.val());});}}},saveToBrowserStorage:function(f,g,e){e=e===undefined?true:e;this.browserStorage.set(f,g);if(e&&g!==""){this.options.onSave.call(this);}},bindSaveDataOnChange:function(f){var e=this;f.change(function(){e.saveAllData();});},saveDataByTimeout:function(){var f=this;var e=f.targets;setTimeout((function(){function g(){f.saveAllData();setTimeout(g,f.options.timeout*1000);}return g;})(e),f.options.timeout*1000);},bindReleaseData:function(){var e=this;e.targets.each(function(){var g=b(this);var f=g.attr("id")+g.attr("name");b(this).bind("submit reset",function(){e.releaseData(f,e.findFieldsToProtect(g));});});},manuallyReleaseData:function(){var e=this;e.targets.each(function(){var g=b(this);var f=g.attr("id")+g.attr("name");e.releaseData(f,e.findFieldsToProtect(g));});},releaseData:function(h,e){var g=false;var f=this;d.started[f.getInstanceIdentifier()]=false;e.each(function(){if(b.inArray(this,f.options.excludeFields)!==-1){return true;}var j=b(this);var i=(f.options.locationBased?f.href:"")+h+j.attr("name")+f.options.customKeySuffix;f.browserStorage.remove(i);g=true;});if(g){f.options.onRelease.call(f);}}};}return{getInstance:function(e){if(!d.instantiated[e]){d.instantiated[e]=c();d.instantiated[e].setInstanceIdentifier(e);d.instantiated[e].setInitialOptions();}if(e){return d.instantiated[e];}return d.instantiated[e];},free:function(){d={instantiated:[],started:[]};return null;},version:"1.1.2"};})();})(jQuery);