我试图让这个代码在打包的应用中呈现,但是如果我进入沙盒模式,Chrome本地存储无法正常工作,所以我在考虑如何重写这个使用eval的一段javascript。
if (eval(conditions.join(' && '))) {
created = $.DOMCached.get("created", namespace);
started[namespace] = $.DOMCached.get("started", namespace);
jTask.timer[namespace] = $.DOMCached.get("timer", namespace);
p += '<p class="jtrack-item' + (archived ? ' jtrack-archived' : '') + (completed ? ' jtrack-completed' : '') + '">' + created + '<label>' + namespace + '</label><a href="#" class="jtrack-update entypo-cog" rel="' + namespace + '"></a> | <a href="#" class="jtrack-remove entypo-trash" rel="' + namespace + '"></a><span class="jtrack-timer">' + this.hms(jTask.timer[namespace]) + '</span><a href="#" class="jtrack-power entypo-back-in-time' + (started[namespace] ? ' jtrack-power-on' : '') + '" title="Timer on/off" rel="' + namespace + '"></a></p>';
if (started[namespace]) {
this.timerScheduler(namespace);
}
}
答案 0 :(得分:1)
我把它改写成这样......
if (conditions && conditions.join(' && ')) {
通过这里的文档阅读..
https://developer.chrome.com/extensions/contentSecurityPolicy