Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
b0977d5e9a | |||
d9b31d03da
|
|||
a1203de811
|
|||
e86aebdc5d
|
|||
f1e5411469
|
|||
ba6ebd33b9
|
|||
8c5062471f
|
@ -2,29 +2,9 @@ body {
|
||||
background: url(../image/background.jpg) fixed;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
#urlBox {
|
||||
padding: 10px 0 0 5px;
|
||||
border: 1px solid rgba(0,0,0,.125);
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#urlBox .url {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#urlBox .url input {
|
||||
width: 100%;
|
||||
font-size: 16px;
|
||||
line-height: 32px;
|
||||
color: #000;
|
||||
border: none;
|
||||
border-bottom: 1px solid rgba(0,0,0,.125);
|
||||
}
|
||||
|
||||
#content {
|
||||
background-color: white;
|
||||
opacity: 0.87;
|
||||
opacity: 0.75;
|
||||
box-shadow: 0 0 2vmin black;
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 985 KiB After Width: | Height: | Size: 310 KiB |
51
index.html
51
index.html
@ -28,56 +28,39 @@
|
||||
|
||||
<hr>
|
||||
|
||||
<h2 class="text-center"><code>縮網址服務</code></h2>
|
||||
<div id="urlBox" class="container">
|
||||
<div class="urls"></div>
|
||||
<div class="url row">
|
||||
<p class="col-md-4 col-6">
|
||||
<input class="text-center short-code" name="short-code" type="text" placeholder="別名,可留空">
|
||||
</p>
|
||||
<p class="col-md-8 col-6">
|
||||
<input class="text-center target-url" name="target-url" type="text"
|
||||
placeholder="網址,例如:https://www.ntut.edu.tw/">
|
||||
</p>
|
||||
|
||||
<p class="col-12"></p>
|
||||
|
||||
<p class="col-md-4 col-sm-2"></p>
|
||||
<p class="col-md-4 col-sm-8 col-12">
|
||||
<a class="btn btn-primary" style="width: 100%;" href="javascript:" onclick="shortenUrl()">縮起來!</a>
|
||||
</p>
|
||||
<p class="col-md-4 col-sm-2"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="websites col-lg-6">
|
||||
<!--<div class="websites col-lg-6">
|
||||
<h2 class="text-center"><code>好玩ㄉ網站</code></h2>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item list-group-item-action">
|
||||
<a href="https://git.ntut.com.tw" target="_blank">Gitea of NTUT.COM.TW</a>
|
||||
<a href="https://bus.pinlin.me" target="_blank">Bustw CLI</a>
|
||||
<br>
|
||||
<span>程式碼託管平台</span>
|
||||
<span>用終端機輕鬆查公車</span>
|
||||
</li>
|
||||
<li class="list-group-item list-group-item-action">
|
||||
<a href="https://yuren-tw.github.io/textRevealer/" target="_blank">Text Revealer</a>
|
||||
<a href="https://ccm.pinlin.me" target="_blank">China Cipher Messenger</a>
|
||||
<br>
|
||||
<span>網頁大字報</span>
|
||||
<span>瓷器信使 - 端對端加密通訊平台</span>
|
||||
</li>
|
||||
<li class="list-group-item list-group-item-action">
|
||||
<a href="https://www.ntut.com.tw/chipet" target="_blank">Chi Pet</a>
|
||||
<a href="https://yt.pinlin.me" target="_blank">YouTube Together</a>
|
||||
<br>
|
||||
<span>幫烏龜澆水</span>
|
||||
<span>和朋友同步播放 YouTube 影片</span>
|
||||
</li>
|
||||
<li class="list-group-item list-group-item-action">
|
||||
<a href="https://yuren-tw.github.io/textRevealer" target="_blank">textRevealer</a>
|
||||
<br>
|
||||
<span>網頁大字報 by @YuRen-tw</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>-->
|
||||
|
||||
<div class="gist col-lg-6">
|
||||
<h2 class="text-center"><code>好用 Script</code></h2>
|
||||
<div class="gist col-lg-12">
|
||||
<!--<h2 class="text-center"><code>好用 Script</code></h2>-->
|
||||
<script src="https://gist.github.com/PinLin/3f6c1885d3c22d9fbf6a726788778112.js"></script>
|
||||
</div>
|
||||
|
||||
<div class="video col-lg-12">
|
||||
<!--<div class="video col-lg-12">
|
||||
<div class="embed-responsive embed-responsive-16by9">
|
||||
<video src="https://myweb.ntut.edu.tw/TaipeiTech.mp4" controls preload="none"
|
||||
class="embed-responsive-item" type="video/mp4">
|
||||
@ -86,7 +69,7 @@
|
||||
  國立臺北科技大學 Taipei Tech
|
||||
創立於大正元年,為臺灣技職教育之濫觴,校史輝煌悠久。本校定位為「實務研究型大學」,設機電、電資、工程、管理、設計及人文與社會科學六學院。素有「企業家搖籃」之美名,校友遍佈產業各界,於產業界極有影響力,深厚的學術基礎、地利之便、多元課程、豐富資源與國際能見度,使本校發展成為以科技為強項的國際知名大學。
|
||||
</p>
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
46
js/main.js
46
js/main.js
@ -1,46 +0,0 @@
|
||||
var backend = 'https://ntut.com.tw';
|
||||
|
||||
function shortenUrl() {
|
||||
var shortCode = $('#urlBox .short-code').val() || null;
|
||||
var url = $('#urlBox .target-url').val();
|
||||
|
||||
if (!url) {
|
||||
alert("網址不能是空白的!");
|
||||
return;
|
||||
}
|
||||
|
||||
request(shortCode, url)
|
||||
.done(function (res) {
|
||||
console.log(res);
|
||||
addNewRow(res);
|
||||
})
|
||||
.fail(function (err) {
|
||||
console.log(err);
|
||||
if (err.status == 409) {
|
||||
alert("這個別名已經被使用了");
|
||||
}
|
||||
else {
|
||||
alert("無法建立連線,請稍後再試")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function addNewRow(data) {
|
||||
var rowHtml = '<div class="url row">';
|
||||
rowHtml += '<p class="text-center col-md-4 col-6">ntut.com.tw/' + data.shortCode + '</p>';
|
||||
rowHtml += '<p class="text-center col-md-8 col-6">' + data.url + '</p>';
|
||||
rowHtml += '</div>';
|
||||
|
||||
$('#urlBox .urls').append($(rowHtml));
|
||||
}
|
||||
|
||||
function request(shortCode, url) {
|
||||
return $.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
url: backend + '/api/shortUrl',
|
||||
data: JSON.stringify({ shortCode: shortCode, url: url }),
|
||||
processData: false,
|
||||
contentType: 'application/json; charset=UTF-8'
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user