From 8341881400602fbe730ded57e21fa7a67f2bc53a Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Fri, 17 May 2019 13:18:33 +0800 Subject: [PATCH] =?UTF-8?q?:fire:=20=E5=88=A0=E6=8E=89=E7=9F=AD=E7=BD=91?= =?UTF-8?q?=E5=9D=80=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/en_US.json | 1 - i18n/ja_JP.json | 1 - i18n/ko_KR.json | 1 - i18n/zh_CN.json | 1 - i18n/zh_TW.json | 1 - main.go | 1 - playground/file.go | 42 ----------------------------------------- static/js/playground.js | 33 +++++++++----------------------- 8 files changed, 9 insertions(+), 72 deletions(-) diff --git a/i18n/en_US.json b/i18n/en_US.json index 4d14856..7ae9788 100644 --- a/i18n/en_US.json +++ b/i18n/en_US.json @@ -165,7 +165,6 @@ "restore_outline": "Restore Outline", "share": "Share", "url": "URL", - "short_url": "Short URL", "embeded": "Embeded", "terms": "Terms", "download": "Download", diff --git a/i18n/ja_JP.json b/i18n/ja_JP.json index 6900939..00a02ed 100644 --- a/i18n/ja_JP.json +++ b/i18n/ja_JP.json @@ -165,7 +165,6 @@ "restore_outline": "アウトラインを復元", "share": "シェア", "url": "リンク", - "short_url": "ショートリンク", "embeded": "埋め込む", "terms": "利用規約", "download": "ダウンロード", diff --git a/i18n/ko_KR.json b/i18n/ko_KR.json index 8664074..9ea88a2 100644 --- a/i18n/ko_KR.json +++ b/i18n/ko_KR.json @@ -165,7 +165,6 @@ "restore_outline": "주제복구", "share": "공유", "url": "하이퍼링크", - "short_url": "짧은 링크", "embeded": "삽입", "terms": "사용계약", "download": "다운로드", diff --git a/i18n/zh_CN.json b/i18n/zh_CN.json index 5a89ae3..5652f18 100644 --- a/i18n/zh_CN.json +++ b/i18n/zh_CN.json @@ -165,7 +165,6 @@ "restore_outline": "恢复大纲", "share": "分享", "url": "链接", - "short_url": "短链接", "embeded": "嵌入", "terms": "使用条款", "download": "下载", diff --git a/i18n/zh_TW.json b/i18n/zh_TW.json index 7d24c28..df058e7 100644 --- a/i18n/zh_TW.json +++ b/i18n/zh_TW.json @@ -165,7 +165,6 @@ "restore_outline": "恢復大綱", "share": "分享", "url": "連結", - "short_url": "短網址", "embeded": "嵌入", "terms": "使用條款", "download": "下載", diff --git a/main.go b/main.go index 08d2555..6707a13 100644 --- a/main.go +++ b/main.go @@ -154,7 +154,6 @@ func main() { http.HandleFunc("/playground/", handlerWrapper(playground.IndexHandler)) http.HandleFunc("/playground/ws", handlerWrapper(playground.WSHandler)) http.HandleFunc("/playground/save", handlerWrapper(playground.SaveHandler)) - http.HandleFunc("/playground/short-url", handlerWrapper(playground.ShortURLHandler)) http.HandleFunc("/playground/build", handlerWrapper(playground.BuildHandler)) http.HandleFunc("/playground/run", handlerWrapper(playground.RunHandler)) http.HandleFunc("/playground/stop", handlerWrapper(playground.StopHandler)) diff --git a/playground/file.go b/playground/file.go index 2fcf8e7..c807749 100644 --- a/playground/file.go +++ b/playground/file.go @@ -94,45 +94,3 @@ func SaveHandler(w http.ResponseWriter, r *http.Request) { return } } - -// ShortURLHandler handles request of short URL. -func ShortURLHandler(w http.ResponseWriter, r *http.Request) { - result := util.NewResult() - defer util.RetResult(w, r, result) - - session, _ := session.HTTPSession.Get(r, session.CookieName) - if session.IsNew { - http.Error(w, "Forbidden", http.StatusForbidden) - - return - } - - var args map[string]interface{} - if err := json.NewDecoder(r.Body).Decode(&args); err != nil { - logger.Error(err) - result.Succ = false - - return - } - - result.Data = args["url"].(string) - - // 百度短网址服务需要认证才可以使用 - //resp, _ := http.Post("http://dwz.cn/create.php", "application/x-www-form-urlencoded", - // strings.NewReader("url="+url)) - // - //var response map[string]interface{} - //if err := json.NewDecoder(resp.Body).Decode(&response); err != nil { - // logger.Error(err) - // result.Succ = false - // - // return - //} - // - //shortURL := url - //if 0 == response["status"].(float64) { - // shortURL = response["tinyurl"].(string) - //} - // - //result.Data = shortURL -} diff --git a/static/js/playground.js b/static/js/playground.js index 87f3c07..7e5000a 100644 --- a/static/js/playground.js +++ b/static/js/playground.js @@ -373,31 +373,16 @@ var playground = { var request = newWideRequest(); request.url = url; - $.ajax({ - type: 'POST', - url: '/playground/short-url', - data: JSON.stringify(request), - dataType: "json", - success: function (result) { - if (!result.succ) { - console.log(result); - return; - } + var html = '
' + url + "
"; + html += '
'; + html += '
'; - var html = '
' + url + "
"; - html += '' - + result.data + '
'; - html += '
'; - html += '
'; - - $("#dialogShare").html(html); - $("#dialogShare").dialog("open"); - }}); + $("#dialogShare").html(html); + $("#dialogShare").dialog("open"); } }); },