Site Notice

hello, world

Difference between revisions of "Github CDN"

From Project-EPB Commons
([InPageEdit] 没有编辑摘要)
([InPageEdit] 没有编辑摘要)
Line 1: Line 1:
https://raw.githack.com/
+
[https://cdn.jsdelivr.net jsDeliver]
  
基本的用法是:
+
== 用法 ==
<html>
+
<code><nowiki>https://cdn.jsdelivr.net/</nowiki>'''gh'''/''用户''/''仓库''@''分支''/''文件名''</code>
<pre p>https://raw.githack.com/用户名/仓库/master/路径/文件名.扩展名<span id="show"></span></pre>
+
 
<span id="apath">https://raw.hithack.com/<input style="width:280px" id="path" value="dragon-fish/wjghj-wiki/master/" /></span>
+
== 调用 ==
 +
<html><pre id="show">https://cdn.jsdelivr.net/gh/<span id="user">dragon-fish</span>/<span id="repo">inpageedit-v2</span>/<span id="version">master</span>/<span id="file">script.js</span></pre>
 +
<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>
 
<script>
addEventListener('load',function(){
+
function getlink(){
   $('#path').keyup(function(){
+
   var formData = '?' + $('#myForm').serialize();
    var path = $(this).val();
+
  var para = function(a){return mw.util.getParamValue(a,formData)};
    if (path === '') {
+
  $('#show > span').text(function(){
      $('#show').html('<br/>?');
+
     var $this = $(this),
     } else {
+
       id = $this.attr('id');
       $('#show').html('<br/>https://raw.hithack.com/'+path);
+
     return para(id);
     }
 
 
   });
 
   });
});
+
};
 
</script>
 
</script>
 
</html>
 
</html>

Revision as of 13:49, 9 April 2020

jsDeliver

用法

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

调用

<html><pre id="show">https://cdn.jsdelivr.net/gh/<span id="user">dragon-fish</span>/<span id="repo">inpageedit-v2</span>/<span id="version">master</span>/<span id="file">script.js</span></pre> <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(a){return mw.util.getParamValue(a,formData)};
 $('#show > span').text(function(){
   var $this = $(this),
     id = $this.attr('id');
   return para(id);
 });

}; </script> </html>