From 79984ab9ace0dcf3c49bbed58a77695202bb1ec7 Mon Sep 17 00:00:00 2001 From: Van Date: Sat, 29 Oct 2016 23:30:09 +0800 Subject: [PATCH] fixed #285 --- conf/users/admin.json | 13 +++-- static/css/playground-embed.css | 100 -------------------------------- static/css/playground.css | 84 ++++++++++++++++++++------- static/js/playground.js | 65 +++++++++++---------- views/playground/index.html | 37 ++++-------- 5 files changed, 116 insertions(+), 183 deletions(-) delete mode 100644 static/css/playground-embed.css diff --git a/conf/users/admin.json b/conf/users/admin.json index b4c7063..eacbcbd 100644 --- a/conf/users/admin.json +++ b/conf/users/admin.json @@ -9,11 +9,11 @@ "GoFormat": "gofmt", "FontFamily": "Helvetica", "FontSize": "13px", - "Theme": "dark", + "Theme": "default", "Keymap": "wide", "Created": 1414080000000000000, - "Updated": 1414080000000000000, - "Lived": 1414080000000000000, + "Updated": 1477750918395543731, + "Lived": 1477751527252541554, "Editor": { "FontFamily": "Consolas, 'Courier New', monospace", "FontSize": "13px", @@ -23,10 +23,15 @@ }, "LatestSessionContent": { "fileTree": [ + "/Users/Vanessa/Work/GoGoGo/src", + "/Users/Vanessa/Work/GoGoGo/src/github.com", + "/Users/Vanessa/Work/GoGoGo/src/github.com/b3log", + "/Users/Vanessa/Work/GoGoGo/src/github.com/b3log/wide" ], "files": [ + "/Users/Vanessa/Work/GoGoGo/src/github.com/b3log/wide/.gitignore" ], - "currentFile": "", + "currentFile": "/Users/Vanessa/Work/GoGoGo/src/github.com/b3log/wide/.gitignore", "layout": { "side": { "state": "normal", diff --git a/static/css/playground-embed.css b/static/css/playground-embed.css deleted file mode 100644 index 4dc67ab..0000000 --- a/static/css/playground-embed.css +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2014-2016, b3log.org & hacpai.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -body{ - overflow: auto; -} - -.header { - margin: 0; - padding: 5px; -} - -.header li { - margin-left: 10px; -} - -.header .gravatar { - width: 26px; - border-radius: 13px; -} - -.header .logo { - height: 21px; - margin-top: -6px; -} - -.share-panel { - position: absolute; - z-index: 20; - width: 226px; - padding: 5px 0px; - right: 0px; - line-height: normal; - top: 34px; -} - -.share-panel .font-ico { - transition: all .2s ease-out 0s; - margin: 0 5px; - width: 24px; -} - -.share-panel .font-ico:hover { - transform:rotate(360deg); -} - -.footer { - height: 30px; - text-shadow: 0 0 0; -} - -#editorDiv { - width: 100%; - height: 70%; -} - -#output { - height: 30%; - width: 100%; - border-width: 0; - margin: 0; - padding: 0; - border-top: 1px solid #919191; -} - -#dialogShare { - margin: 10px 15px 0; - line-height: 28px; -} - -#dialogShare a { - white-space: pre-wrap; - word-wrap: break-word; -} - -.wrapper { - width: auto; -} - -.btn { - padding: 1px 5px; -} - -#disqus_thread { - border-top: 1px solid #919191; - padding: 0 30px; -} \ No newline at end of file diff --git a/static/css/playground.css b/static/css/playground.css index 73f075c..3bb3fd2 100644 --- a/static/css/playground.css +++ b/static/css/playground.css @@ -1,3 +1,4 @@ +@@ -1,100 +0,0 @@ /* * Copyright (c) 2014-2016, b3log.org & hacpai.com * @@ -14,17 +15,18 @@ * limitations under the License. */ -body { +body{ overflow: auto; } .header { margin: 0; - padding: 10px; + padding: 5px; } -.font-ico { - font-size: 26px; +.header li { + margin-left: 0; + margin-right: 20px; } .header .gravatar { @@ -32,23 +34,25 @@ body { border-radius: 13px; } -.header > .fn-right { - margin-top: 10px; +.header .logo { + height: 28px; + margin-top: -6px; } -.header .logo { - height: 36px; - margin-top: -4px; +.font-ico { + font-size: 18px; + line-height: 28px; } .share-panel { position: absolute; z-index: 20; - width: 258px; - padding: 10px 10px; + width: 226px; + padding: 5px 0px; right: 0px; line-height: normal; - top: 57px; + top: 38px; + border-color: #999; } .share-panel .font-ico { @@ -67,18 +71,17 @@ body { } #editorDiv { - width: 60%; - float: left; + width: 100%; + height: 70%; } #output { - width: 40%; - float: right; + height: 30%; + width: 100%; border-width: 0; margin: 0; - padding: 0; - border-left: 1px solid #919191; - font-family: Consolas, 'Courier New', monospace; + padding: 2px 5px; + border-top: 1px solid #919191; } #dialogShare { @@ -91,7 +94,44 @@ body { word-wrap: break-word; } -#disqus_thread { - border-top: 1px solid #919191; - padding: 0 30px; +.wrapper { + width: auto; +} + +.btn { + padding: 3px 8px; + font-size: 13px; + line-height: 20px; + height: 28px; +} + +#editorDivWrap { + width: 70%; +} + +#goNews { + width: 30%; + overflow: auto; + border-left: 1px solid #919191; +} + +#goNews li a { + display: block; + padding: 8px 10px; + text-shadow: 0 1px 0 #fff; + border-bottom: 1px solid #eee; + color: #666; +} + +#goNews li a:hover { + text-decoration: none; + background-color: #f9f9f9; +} + +#goNews li.title { + border-bottom: 1px solid #e5e5e5; + padding: 10px; + font-size: 14px; + line-height: 18px; + background-color: #f9fafb; } \ No newline at end of file diff --git a/static/js/playground.js b/static/js/playground.js index b3b1201..cb4d1a6 100644 --- a/static/js/playground.js +++ b/static/js/playground.js @@ -26,16 +26,8 @@ var playground = { editor: undefined, pid: undefined, _resize: function () { - if (config.disqus) { - return false; - } - if (config.embed) { - $("#editorDiv").parent().height($(window).height() - 33 - $(".footer").height()); - playground.editor.setSize("auto", ($("#editorDiv").parent().height() * 0.7) + "px"); - } else { - $("#editor, #output").height($(window).height() - 60 - $(".footer").height()); - playground.editor.setSize("auto", $("#editor").height() + "px"); - } + $('#goNews, #editorDivWrap').height($(window).height() - 40 - $(".footer").height()); + playground.editor.setSize("auto", ($("#editorDiv").parent().height() * 0.7) + "px"); }, _initShare: function () { $("#dialogShare").dialog({ @@ -210,11 +202,8 @@ var playground = { playground._resize(); }); - if (config.embed) { - playground.editor.setSize("auto", ($("#editorDiv").parent().height() * 0.7) + "px"); - } else { - playground.editor.setSize("auto", $("#editor").height() + "px"); - } + playground.editor.setSize("auto", ($("#editorDiv").parent().height() * 0.7) + "px"); + var hovered = false; $(".menu .ico-share").hover(function () { @@ -280,6 +269,7 @@ var playground = { this._initWideShare(); this._initShare(); menu._initAbout(); + this._initGoNews(); }, _initWS: function () { // Used for session retention, server will release all resources of the session if this channel closed @@ -326,6 +316,34 @@ var playground = { console.log('[playground onerror] ' + JSON.parse(e)); }; }, + _initGoNews: function () { + $.ajax({ + url: "https://hacpai.com/apis/articles?tags=wide,golang&p=1&size=20", + type: "GET", + dataType: "jsonp", + jsonp: "callback", + success: function (data, textStatus) { + var articles = data.articles; + if (0 === articles.length) { + return; + } + + var length = articles.length; + + var listHTML = ""); + } + }); + }, share: function () { if (!playground.editor) { return; @@ -374,7 +392,7 @@ var playground = { + result.data + '
'; html += '
'; + + url + '" width="99%" height="600">'; html += ''; $("#dialogShare").html(html); @@ -383,21 +401,6 @@ var playground = { } }); }, - disqus: function () { - var url = window.location.href; - if (url.indexOf("?") >= 0) { - if (url.indexOf("disqus=") >= 0) { - url = url.replace("disqus=false", "disqus=true"); - console.log(url); - } else { - url += "&disqus=true"; - } - } else { - url += "?disqus=true"; - } - - window.location.href = url; - }, stop: function () { if (!playground.editor) { return; diff --git a/views/playground/index.html b/views/playground/index.html index f891793..ddd7e9c 100644 --- a/views/playground/index.html +++ b/views/playground/index.html @@ -21,7 +21,7 @@ - + @@ -42,9 +42,6 @@
  • -
  • - -
  • @@ -65,24 +62,14 @@
    -
    - +
    +
    + +
    +
    - +
    - {{if .disqus}} -
    - - - {{end}}