我使用的是Metronic Admin模板(AngularJS版) http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469
我正在使用此模板开发Chrome应用
我在此Chrome应用中有一个页面/视图,您可以在其中查看我们网站的禁令列表。
禁令列表第一次加载,但不是第二次单击侧栏中的“禁止列表”。当你转到另一个视图(例如仪表板)时,第二次点击就意味着你回到禁令列表。
文件摘要:
app.js:
// All Bans
.state('allbans', {
url: "/all_bans.html",
templateUrl: "views/all_bans.html",
data: {pageTitle: 'User Ban List'},
controller: "GeneralPageController",
resolve: {
deps: ['$ocLazyLoad', function($ocLazyLoad) {
return $ocLazyLoad.load([{
name: 'MetronicApp',
insertBefore: '#ng_load_plugins_before', // load the above css files before '#ng_load_plugins_before'
files: [
'/assets/global/plugins/select2/select2.css',
'/assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css',
'/assets/global/plugins/datatables/extensions/Scroller/css/dataTables.scroller.min.css',
'/assets/global/plugins/datatables/extensions/ColReorder/css/dataTables.colReorder.min.css',
'/assets/global/plugins/select2/select2.min.js',
'/assets/global/plugins/datatables/all.min.js',
'js/scripts/table-advanced.js',
'/js_custom/all_bans.js',
'js/controllers/GeneralPageController.js'
]
}]);
}]
}
})
all_bans.js:
chrome.storage.local.get('userkey', function (result) {
var userkey = "";
userkey = result.userkey;
console.debug('userkey :', userkey);
chrome.storage.local.get('username', function (resultt) {
var username = "";
username = resultt.username;
jQuery.ajax({
type: "POST",
url: "URL HIDDEN/api/allbans.php?userkey=" + userkey + "&username=" + username,
success: function(msg){
$('.ajaxscriptsimm').html(msg);
//document.getElementsByClassName("banknop").addEventListener("click", LoadPagebanpage);
}
});
});
});
all_bans.html:
<!-- BEGIN PAGE CONTENT-->
<div class="row" ng-controller="GeneralPageController">
<div class="col-md-12">
<div class="ajaxscriptsimm">
</div>
</div>
</div>
<!-- END PAGE CONTENT -->
首先点击:
第二次点击:
Chrome中存在这些错误(但似乎在打开信息中心时出现,而不是禁令列表):
Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "default-src 'self' chrome-extension-resource:". Note that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
angular.min.js:92 EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "default-src 'self' chrome-extension-resource:".
at eval (native)
at chrome-extension://mlpdcfkafmhfaancdijopanidfkagbod/assets/global/plugins/jquery.min.js:2:2620
at Function.m.extend.globalEval (chrome-extension://mlpdcfkafmhfaancdijopanidfkagbod/assets/global/plugins/jquery.min.js:2:2631)
at m.fn.extend.domManip (chrome-extension://mlpdcfkafmhfaancdijopanidfkagbod/assets/global/plugins/jquery.min.js:3:23046)
at m.fn.extend.append (chrome-extension://mlpdcfkafmhfaancdijopanidfkagbod/assets/global/plugins/jquery.min.js:3:20507)
at null.<anonymous> (chrome-extension://mlpdcfkafmhfaancdijopanidfkagbod/assets/global/plugins/jquery.min.js:3:22038)
at m.access (chrome-extension://mlpdcfkafmhfaancdijopanidfkagbod/assets/global/plugins/jquery.min.js:3:3286)
at m.fn.extend.html (chrome-extension://mlpdcfkafmhfaancdijopanidfkagbod/assets/global/plugins/jquery.min.js:3:21623)
at e [as html] (chrome-extension://mlpdcfkafmhfaancdijopanidfkagbod/assets/global/plugins/angularjs/angular.min.js:25:207)
at chrome-extension://mlpdcfkafmhfaancdijopanidfkagbod/assets/global/plugins/angularjs/plugins/angular-ui-router.min.js:7:21866 <div ui-view="" class="fade-in-up ng-scope">