Site Notice

hello, world

Difference between revisions of "Short url"

From Project-EPB Commons
([InPageEdit] 没有编辑摘要)
([InPageEdit] 没有编辑摘要)
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
== 腾讯 ==
 
* url.cn
 
 
<html>
 
<html>
<div id="tencent">
+
 
<pre class="urlFinal">https://url.cn/</pre>
+
<pre id="url"></pre>
<input placeholder="https://wjghj.cn" value="https://wjghj.cn" class="urlRequest"/> <button onclick="getTencent()">生成</button>
+
<input placeholder="https://wjghj.cn" value="https://wjghj.cn" id="request" style="width:20em"></input> <button onclick="start()">生成短网址</button>
</div>
+
 
 
<script>
 
<script>
function getTencent() {
+
function start() {
   if ($('#tc-s-url').length>0) {
+
   $.ajax({
     console.info('请求频次太快!');
+
     url: 'https://common.wjghj.cn/api.php',
  }
+
    type: 'post',
  $('body').append('<iframe id="tc-s-url" src="https://blog.wjghj.cn/surl?url='+$('#tencent .urlRequest').val()+'"/>');
+
    dataType: 'json',
  $('#tc-s-url').load(function(){
+
    data: {
    var url = $('#tc-s-url').contents().find('body').text();
+
      action: 'shortenurl',
     $('#tencent .urlFinal').html(url);
+
      url: $('#request').val(),
     setTimeout(function(){
+
      format: 'json'
       $('#tc-s-url').remove();
+
     },
     },5000);
+
     success: function(data) {
 +
       $('#url').html(data.shortenurl.shorturl);
 +
     }
 
   });
 
   });
 
 
 
}
 
}
 
</script>
 
</script>
 
</html>
 
</html>

Latest revision as of 01:32, 3 March 2020

<html>

<pre id="url"></pre> <input placeholder="https://wjghj.cn" value="https://wjghj.cn" id="request" style="width:20em"></input> <button onclick="start()">生成短网址</button>

<script> function start() {

 $.ajax({
   url: 'https://common.wjghj.cn/api.php',
   type: 'post',
   dataType: 'json',
   data: {
     action: 'shortenurl',
     url: $('#request').val(),
     format: 'json'
   },
   success: function(data) {
     $('#url').html(data.shortenurl.shorturl);
   }
 });

} </script> </html>