From b0977d5e9abe5b6dd6f1575385da90dac8afed53 Mon Sep 17 00:00:00 2001 From: Pin Lin Date: Tue, 12 Nov 2024 21:57:29 +0800 Subject: [PATCH] Remove useless stuff --- css/style.css | 20 -------------------- index.html | 34 ++++++---------------------------- js/main.js | 46 ---------------------------------------------- 3 files changed, 6 insertions(+), 94 deletions(-) delete mode 100644 js/main.js diff --git a/css/style.css b/css/style.css index b906c81..17f8f49 100644 --- a/css/style.css +++ b/css/style.css @@ -2,26 +2,6 @@ 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.75; diff --git a/index.html b/index.html index 4ee3153..22d5cb4 100644 --- a/index.html +++ b/index.html @@ -28,30 +28,8 @@
-

縮網址服務

-
-
-
-

- -

-

- -

- -

- -

-

- 縮起來! -

-

-
-
-
-
+ -
-

好用 Script

+
+
-
+

diff --git a/js/main.js b/js/main.js deleted file mode 100644 index 28f15a0..0000000 --- a/js/main.js +++ /dev/null @@ -1,46 +0,0 @@ -var backend = 'https://pinlin.me'; - -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 = '
'; - rowHtml += '

pinlin.me/' + data.shortCode + '

'; - rowHtml += '

' + data.url + '

'; - rowHtml += '
'; - - $('#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' - }) -}