MDL-40759 icons: Fix when icon map comes from cache
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
define(["core/icon_system","jquery","core/ajax","core/mustache","core/localstorage"],function(a,b,c,d,e){var f=null,g=null,h=function(){a.apply(this,arguments)};return h.prototype=Object.create(a.prototype),h.prototype.init=function(){if(f)return b.when();var a=e.get("core/iconmap-fontawesome");return a?(f=a,b.when()):(null===g&&(g=c.call([{methodname:"core_output_load_icon_map",args:{system:"fontawesome"}}],!0,!1)[0]),g.then(function(a){f={},b.each(a,function(a,b){f[b.component+"/"+b.pix]=b.to}.bind(this)),e.set("core/iconmap-fontawesome",f)}.bind(this)))},h.prototype.renderIcon=function(a,b,c,e){var g=f[b+"/"+a];"undefined"==typeof g&&(g=b+"/"+a);var h={key:g,title:c};return d.render(e,h)},h});
|
||||
define(["core/icon_system","jquery","core/ajax","core/mustache","core/localstorage"],function(a,b,c,d,e){var f=null,g=null,h=function(){a.apply(this,arguments)};return h.prototype=Object.create(a.prototype),h.prototype.init=function(){if(f)return b.when();var a=e.get("core/iconmap-fontawesome");return a&&(a=JSON.parse(a)),a?(f=a,b.when()):(null===g&&(g=c.call([{methodname:"core_output_load_icon_map",args:{system:"fontawesome"}}],!0,!1)[0]),g.then(function(a){f={},b.each(a,function(a,b){f[b.component+"/"+b.pix]=b.to}.bind(this)),e.set("core/iconmap-fontawesome",JSON.stringify(f))}.bind(this)))},h.prototype.renderIcon=function(a,b,c,e){var g=f[b+"/"+a];"undefined"==typeof g&&(g=b+"/"+a);var h={key:g,title:c};return d.render(e,h)},h});
|
||||
@@ -41,6 +41,9 @@ define(['core/icon_system', 'jquery', 'core/ajax', 'core/mustache', 'core/locals
|
||||
}
|
||||
|
||||
var map = LocalStorage.get('core/iconmap-fontawesome');
|
||||
if (map) {
|
||||
map = JSON.parse(map);
|
||||
}
|
||||
|
||||
if (map) {
|
||||
staticMap = map;
|
||||
@@ -59,7 +62,7 @@ define(['core/icon_system', 'jquery', 'core/ajax', 'core/mustache', 'core/locals
|
||||
$.each(map, function(index, value) {
|
||||
staticMap[value.component + '/' + value.pix] = value.to;
|
||||
}.bind(this));
|
||||
LocalStorage.set('core/iconmap-fontawesome', staticMap);
|
||||
LocalStorage.set('core/iconmap-fontawesome', JSON.stringify(staticMap));
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user