0
我希望使用兩個項目,但我的第一優先級是從CDN網絡加載它們,所以在我的配置路徑I需要加載bowser,jquery和html5shiv和facebook。如何在require.config中的一個CDN鏈接上使用urlArgs,其中包含來自CDN的兩個或更多路徑
我的配置路徑中的urlArgs的值專門用於jquery提供的子資源完整性(SRI)。
但urlArgs被追加到所有的鏈接和jquery意外工作。
有沒有辦法在其他路徑存在時使用路徑特定的urlArgs?
我的配置如下。
require.config({
enforceDefine:true,
urlArgs: 'integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="&crossorigin="anonymous"',
shim: {
facebook : {
exports: 'FB'
}
},
paths: {
facebook: 'http://connect.facebook.net/en_US/sdk',
jquery: [
'https://code.jquery.com/jquery-2.2.4.min'
// 'jquery',
],
bowser:[
'https://cdnjs.cloudflare.com/ajax/libs/bowser/1.0.0/bowser.min',
'bowser-min'
],
html5shiv:[
'https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min',
'html5shiv'
]
}
});
require(['loginsignupslider','featuredslider','arrangehomepage','bowser'],function(a,b,c,bowser){
if (bowser.msie && bowser.version < 9) {
require(['html5shiv']);
}
});
define(['facebook','jquery'],function(FB,$){
FB.init({
appId : '1693650154217810',
status : true,
cookie : true,
xfbml : true,
oauth : true,
version : 'v2.5' // use graph api version 2.5
});
FB.Event.subscribe('auth.statusChange', function(response) {
if (response.authResponse&&response.status==='connected'){
window.location.href = "http://localhost/influenza/scripts/loginset.php";
}
});
$("#influencer-login-social >:first-child a").on("click",function(){
FB.getLoginStatus(function(response) {
if (response.status !== 'connected') {
FB.login(function(response) {},{scope:'public_profile,email,user_friends'});
}
}, true)
});
});