Last active
December 28, 2015 02:19
-
-
Save chaoren1641/7427652 to your computer and use it in GitHub Desktop.
Tengine合并后的URL转换成非合并引用的HTML 在线地址:http://jsfiddle.net/M864P/3/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
输入tengine合并的URL: | |
<br/><br/> | |
<textarea id="J_tengineUrl">http://g.assets.daily.taobao.net/??malitx/card/1.0.5/c/global/global.css.js,malitx/card/1.0.5/p/index/index.css.js,tbc/m-loading/1.0.1/index.js,malitx/card/1.0.5/c/loading/m-loading/loading.css.js,malitx/card/1.0.5/c/loading/m-loading/index.js,malitx/card/1.0.5/c/loading/loading.css.js,malitx/card/1.0.5/c/loading/index.js,malitx/card/1.0.5/p/index/index.jst.js,malitx/card/1.0.5/p/index/model.jst.js,malitx/card/1.0.5/p/index/prestores.jst.js,malitx/card/1.0.5/c/spa/view-base.js,mtb/lib-windvane/1.4.7/windvane.cmd.js,tbc/km-toast/1.0.2/index.js,malitx/card/1.0.5/c/util/index.js,malitx/card/1.0.5/p/index/init.js,malitx/card/1.0.5/p/index/index.js</textarea> | |
<br/><br/> | |
<input type="button" value="转换为非合并的script/style代码" id="J_button" /> | |
<br/><br/> | |
<textarea id="J_textarea"></textarea> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var button = document.getElementById('J_button'); | |
var textarea = document.getElementById('J_textarea'); | |
button.onclick = function() { | |
var tengineUrl = document.getElementById('J_tengineUrl').value; | |
var root = tengineUrl.slice( 0,tengineUrl.indexOf('??') ); | |
var comboUrl = tengineUrl.slice( tengineUrl.indexOf('??') + 2 ); | |
var urls = comboUrl.split(','); | |
var resultHtml = []; | |
for(var i = 0;i < urls.length; i++) { | |
if( urls[i].lastIndexOf('.css') === (urls[i].length - 4) ) { | |
resultHtml.push( '<link rel="stylesheet" type="text/css" href="' + root + urls[i] +'" />'); | |
}else { | |
resultHtml.push( '<script src="' + root + urls[i] +'"><\/script>'); | |
} | |
} | |
textarea.value = resultHtml.join('\n'); | |
textarea.select(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
font-family: Helvetica, arial, sans-serif; | |
font-size: 14px; | |
line-height: 1.6; | |
padding: 5px; | |
} | |
input, textarea { | |
padding: 9px; | |
border: solid 1px #E5E5E5; | |
outline: 0; | |
font: normal 13px/100% Arial; | |
width: 200px; | |
background: -webkit-gradient(linear, left top, left 25, from(#FFFFFF), color-stop(2%, #EEEEEE), to(#FFFFFF)); | |
background: -moz-linear-gradient(top, #FFFFFF, #EEEEEE 1px, #FFFFFF 25px); | |
box-shadow: rgba(0,0,0, 0.1) 0px 0px 8px; | |
-moz-box-shadow: rgba(0,0,0, 0.1) 0px 0px 8px; | |
-webkit-box-shadow: rgba(0,0,0, 0.1) 0px 0px 8px; | |
} | |
textarea { | |
width: 600px; | |
max-width: 600px; | |
height: 200px; | |
line-height: 150%; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment