mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
1 line
806 B
JavaScript
1 line
806 B
JavaScript
define(["core/config"],function(a){var b=!1,c="",d="",e=null,f=function(){if(a.jsrev==-1)return!1;if("undefined"==typeof window.localStorage)return!1;var b="test";try{return e=window.localStorage,null!==e&&(e.setItem(b,"1"),e.removeItem(b),!0)}catch(c){return!1}},g=function(a){return c+a},h=function(){var b=e.getItem(d);if(null===b)return void e.setItem(d,a.jsrev);var c=a.jsrev;c!=b&&(e.clear(),e.setItem(d,a.jsrev))},i=function(a){var b,c,d,e=0;if(0===a.length)return e;for(b=0,d=a.length;b<d;b++)c=a.charCodeAt(b),e=(e<<5)-e+c,e|=0;return e},j=function(){b=f();var e=a.wwwroot+"/"+a.jsrev,g=i(e);c=g+"/",e=a.wwwroot+"/",g=i(e),d=g+"/jsrev"};return j(),{get:function(a){return!!b&&(h(),a=g(a),e.getItem(a))},set:function(a,c){if(!b)return!1;h(),a=g(a);try{e.setItem(a,c)}catch(d){return!1}return!0}}}); |