Site Notice

hello, world

Github CDN

From Project-EPB Commons
Revision as of 01:10, 15 August 2020 by 机智的小鱼君 (talk | contribs) ([InPageEdit] →‎调用: 没有编辑摘要)

jsDeliver

用法

https://cdn.jsdelivr.net/gh/用户/仓库@分支/文件名

调用

<html> <input id="show" readonly onclick="this.selected = true" style="width:96%">https://cdn.jsdelivr.net/gh/dragon-fish/inpageedit-v2@master/script.js</input> <form class="in-page-edit" id="myForm" onkeyup="getlink()"> <label>用户:<br/><input name="user" value="dragon-fish"/></label><br/> <label>仓库:<br/><input name="repo" value="inpageedit-v2"/></label><br/> <label>分支:<br/><input name="version" value="master"/></label><br/> <label>文件:<br/><input name="file" value="script.js"/></label> </form> <script> function getlink() {

 var formData = '?' + $('#myForm').serialize();
 var para = function (i) { return mw.util.getParamValue(i, formData) };
 var url = 'https://cdn.jsdelivr.net/gh';
 url += '/' + para('user');
 url += '/' + para('repo');
 if (para('version') !== '') url += '/' + para('version');
 url += '/' + file;
 $('#show').val(url);

} </script> </html>