Every line of 'js change url' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
1 function js(jsURL) { 2 let bundleUrl = weex.config.bundleUrl 3 let baseURL = bundleUrl.substring(0, bundleUrl.lastIndexOf("/")) 4 //是否在同级目录,若不在,则需要以下处理 5 let flag = jsURL.indexOf('../') !== -1 6 if (flag) { 7 let arr = jsURL.split('../') 8 for (let index = 0; index < arr.length - 1; index++) { 9 baseURL = baseURL.substring(0, baseURL.lastIndexOf('/')) 10 } 11 jsURL = arr[arr.length - 1] 12 } 13 return baseURL + '/' + jsURL 14 }
64 function getJsCode(url) { 65 return unescape(url.substr(11)); 66 }
7 function chgUrl(url) { 8 var timestamp = (new Date()).valueOf(); 9 return 'public/captcha?code=' + timestamp; 10 }
1 function loadJS(url, isExternal) 2 { 3 if( isExternal ) 4 url = document.location.protocol == 'file:' ? 'http:' + url : url; 5 else 6 url += '?v=' + app.version + (!app.isProduction ? '&_=' + new Date().getTime() : ''); 7 8 var ref = window.document.getElementsByTagName('script')[0]; 9 var script = window.document.createElement('script'); 10 script.src = url; 11 script.async = false; 12 ref.parentNode.insertBefore(script, ref); 13 }