Compare commits
9 Commits
abf136a849
...
pinlin-me
Author | SHA1 | Date | |
---|---|---|---|
b0977d5e9a | |||
d9b31d03da
|
|||
a1203de811
|
|||
e86aebdc5d
|
|||
f1e5411469
|
|||
ba6ebd33b9
|
|||
8c5062471f
|
|||
b384eb00ac
|
|||
9eae3e42e5
|
@ -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 |
56
index.html
56
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>
|
||||
@ -95,9 +78,8 @@
|
||||
<p class="text-center">(ˊ・ω・ˋ)(ˊ・ω・ˋ)(ˊ・ω・ˋ)(ˊ・ω・ˋ)(ˊ・ω・ˋ)(ˊ・ω・ˋ)</p>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
|
||||
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"
|
||||
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns"
|
||||
crossorigin="anonymous"></script>
|
||||
|
54
js/main.js
54
js/main.js
@ -1,54 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
let backend = 'https://ntut.com.tw'
|
||||
|
||||
const shortenUrl = async () => {
|
||||
let shortCode = $('#urlBox .short-code')[0].value || null
|
||||
let url = $('#urlBox .target-url')[0].value
|
||||
|
||||
if (!url) {
|
||||
alert("URL is empty!")
|
||||
return
|
||||
}
|
||||
|
||||
request({ shortCode, url })
|
||||
.done((res) => {
|
||||
console.log(res)
|
||||
|
||||
addNewRow(res)
|
||||
})
|
||||
.fail((err) => {
|
||||
console.log(err)
|
||||
|
||||
if (err.status == 409) {
|
||||
alert("This code has been used.")
|
||||
}
|
||||
else {
|
||||
alert("Failed to establish connection.")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const addNewRow = (data) => {
|
||||
let view = $('#urlBox .urls')
|
||||
|
||||
view.append($(`
|
||||
<div class="url row">
|
||||
<p class="text-center col-md-4 col-6">ntut.com.tw/${data.shortCode}</p>
|
||||
<p class="text-center col-md-8 col-6">${data.url}</p>
|
||||
</div>
|
||||
`))
|
||||
}
|
||||
|
||||
const request = ({ shortCode, url }) => {
|
||||
return $.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
url: `${backend}/api/shortUrl`,
|
||||
data: JSON.stringify({
|
||||
shortCode, url
|
||||
}),
|
||||
processData: false,
|
||||
contentType: 'application/json; charset=UTF-8'
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user