1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
- <title>短链生成 Long To Short</title>
- <link rel="stylesheet" href="/static/css/style.css" />
- </head>
- <body>
- <div class="content">
- <h2>Long To Short</h2>
- <h3>-= 短链接生成 =-</h3>
- <div class="generate">
- <div class="get clear">
- <input class="long_link" type="text" placeholder="(~o ̄3 ̄)~~快把链接放进来嘛" />
- <div class="btn">快! ~ 点我!</div>
- </div>
- <div class="result">
- <div class="tag">失败</div>
- <div class="short">(*゚Д゚*) 链接~链接~我要吃链接~~~</div>
- </div>
- </div>
- </div>
- <script src="/static/js/common.js"></script>
- <script src="/static/js/jquery.min.js"></script>
- <script>
- $(function(){
- $('.get .btn').click(function(){
- $('.tag').hide();
- $('.short').text('─=≡Σ(((つ•̀ω•́)つ 加速获取短链接中...');
- if($('.long_link').val() && $('.long_link').val().match(/^http(s)?:\/\/(\w+|\.|\/)+/g)){
- var link = 'http://api.l2s.ch/getlink?key=e5e945ff9502096636bc1e903cea3325&url=' + b64EncodeUnicode($('.long_link').val());
- // var link = 'http://127.0.0.1:3231/getlink?key=e5e945ff9502096636bc1e903cea3325&url=' + b64EncodeUnicode($('.long_link').val());
- $.ajax({
- url:link,
- dataType:'json',
- success:function(result){
- if(result.success==1){
- $('.tag').text('成功').removeClass('fail').show();
- $('.short').text(result.short);
- }else{
- $('.tag').text('失败').addClass('fail').show();
- $('.short').text('(o´゚□゚`o) ~啊~咧!好像获取失败了呢~ ERROR:'+result.msg);
- }
- },
- error:function(){
- $('.tag').text('失败').addClass('fail').show();
- $('.short').text('(o´゚□゚`o) ~啊~咧!好像获取失败了呢~');
- }
- })
- }else{
- $('.tag').text('失败').addClass('fail').show();
- $('.short').text('(〃>皿<) 根本就不是一个正常的链接啊~~魂~淡!~');
- }
- });
- });
- </script>
- </body>
- </html>
|