fixed #285
This commit is contained in:
parent
817c556df4
commit
79984ab9ac
|
@ -9,11 +9,11 @@
|
||||||
"GoFormat": "gofmt",
|
"GoFormat": "gofmt",
|
||||||
"FontFamily": "Helvetica",
|
"FontFamily": "Helvetica",
|
||||||
"FontSize": "13px",
|
"FontSize": "13px",
|
||||||
"Theme": "dark",
|
"Theme": "default",
|
||||||
"Keymap": "wide",
|
"Keymap": "wide",
|
||||||
"Created": 1414080000000000000,
|
"Created": 1414080000000000000,
|
||||||
"Updated": 1414080000000000000,
|
"Updated": 1477750918395543731,
|
||||||
"Lived": 1414080000000000000,
|
"Lived": 1477751527252541554,
|
||||||
"Editor": {
|
"Editor": {
|
||||||
"FontFamily": "Consolas, 'Courier New', monospace",
|
"FontFamily": "Consolas, 'Courier New', monospace",
|
||||||
"FontSize": "13px",
|
"FontSize": "13px",
|
||||||
|
@ -23,10 +23,15 @@
|
||||||
},
|
},
|
||||||
"LatestSessionContent": {
|
"LatestSessionContent": {
|
||||||
"fileTree": [
|
"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": [
|
"files": [
|
||||||
|
"/Users/Vanessa/Work/GoGoGo/src/github.com/b3log/wide/.gitignore"
|
||||||
],
|
],
|
||||||
"currentFile": "",
|
"currentFile": "/Users/Vanessa/Work/GoGoGo/src/github.com/b3log/wide/.gitignore",
|
||||||
"layout": {
|
"layout": {
|
||||||
"side": {
|
"side": {
|
||||||
"state": "normal",
|
"state": "normal",
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
@@ -1,100 +0,0 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014-2016, b3log.org & hacpai.com
|
* Copyright (c) 2014-2016, b3log.org & hacpai.com
|
||||||
*
|
*
|
||||||
|
@ -14,17 +15,18 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
body {
|
body{
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 10px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.font-ico {
|
.header li {
|
||||||
font-size: 26px;
|
margin-left: 0;
|
||||||
|
margin-right: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header .gravatar {
|
.header .gravatar {
|
||||||
|
@ -32,23 +34,25 @@ body {
|
||||||
border-radius: 13px;
|
border-radius: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header > .fn-right {
|
.header .logo {
|
||||||
margin-top: 10px;
|
height: 28px;
|
||||||
|
margin-top: -6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header .logo {
|
.font-ico {
|
||||||
height: 36px;
|
font-size: 18px;
|
||||||
margin-top: -4px;
|
line-height: 28px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.share-panel {
|
.share-panel {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 20;
|
z-index: 20;
|
||||||
width: 258px;
|
width: 226px;
|
||||||
padding: 10px 10px;
|
padding: 5px 0px;
|
||||||
right: 0px;
|
right: 0px;
|
||||||
line-height: normal;
|
line-height: normal;
|
||||||
top: 57px;
|
top: 38px;
|
||||||
|
border-color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.share-panel .font-ico {
|
.share-panel .font-ico {
|
||||||
|
@ -67,18 +71,17 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
#editorDiv {
|
#editorDiv {
|
||||||
width: 60%;
|
width: 100%;
|
||||||
float: left;
|
height: 70%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#output {
|
#output {
|
||||||
width: 40%;
|
height: 30%;
|
||||||
float: right;
|
width: 100%;
|
||||||
border-width: 0;
|
border-width: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 2px 5px;
|
||||||
border-left: 1px solid #919191;
|
border-top: 1px solid #919191;
|
||||||
font-family: Consolas, 'Courier New', monospace;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#dialogShare {
|
#dialogShare {
|
||||||
|
@ -91,7 +94,44 @@ body {
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
#disqus_thread {
|
.wrapper {
|
||||||
border-top: 1px solid #919191;
|
width: auto;
|
||||||
padding: 0 30px;
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
}
|
}
|
|
@ -26,16 +26,8 @@ var playground = {
|
||||||
editor: undefined,
|
editor: undefined,
|
||||||
pid: undefined,
|
pid: undefined,
|
||||||
_resize: function () {
|
_resize: function () {
|
||||||
if (config.disqus) {
|
$('#goNews, #editorDivWrap').height($(window).height() - 40 - $(".footer").height());
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (config.embed) {
|
|
||||||
$("#editorDiv").parent().height($(window).height() - 33 - $(".footer").height());
|
|
||||||
playground.editor.setSize("auto", ($("#editorDiv").parent().height() * 0.7) + "px");
|
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");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
_initShare: function () {
|
_initShare: function () {
|
||||||
$("#dialogShare").dialog({
|
$("#dialogShare").dialog({
|
||||||
|
@ -210,11 +202,8 @@ var playground = {
|
||||||
playground._resize();
|
playground._resize();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (config.embed) {
|
|
||||||
playground.editor.setSize("auto", ($("#editorDiv").parent().height() * 0.7) + "px");
|
playground.editor.setSize("auto", ($("#editorDiv").parent().height() * 0.7) + "px");
|
||||||
} else {
|
|
||||||
playground.editor.setSize("auto", $("#editor").height() + "px");
|
|
||||||
}
|
|
||||||
|
|
||||||
var hovered = false;
|
var hovered = false;
|
||||||
$(".menu .ico-share").hover(function () {
|
$(".menu .ico-share").hover(function () {
|
||||||
|
@ -280,6 +269,7 @@ var playground = {
|
||||||
this._initWideShare();
|
this._initWideShare();
|
||||||
this._initShare();
|
this._initShare();
|
||||||
menu._initAbout();
|
menu._initAbout();
|
||||||
|
this._initGoNews();
|
||||||
},
|
},
|
||||||
_initWS: function () {
|
_initWS: function () {
|
||||||
// Used for session retention, server will release all resources of the session if this channel closed
|
// 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));
|
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 = "<ul><li class='title'>" + config.label.community + "</li>";
|
||||||
|
for (var i = 0; i < length; i++) {
|
||||||
|
var article = articles[i];
|
||||||
|
listHTML += "<li>"
|
||||||
|
+ "<a target='_blank' href='"
|
||||||
|
+ article.articlePermalink + "'>"
|
||||||
|
+ article.articleTitle + "</a>"
|
||||||
|
+"</span></li>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#goNews").html(listHTML + "</ul>");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
share: function () {
|
share: function () {
|
||||||
if (!playground.editor) {
|
if (!playground.editor) {
|
||||||
return;
|
return;
|
||||||
|
@ -374,7 +392,7 @@ var playground = {
|
||||||
+ result.data + '</a><br/>';
|
+ result.data + '</a><br/>';
|
||||||
html += '<label>' + config.label.embeded + config.label.colon
|
html += '<label>' + config.label.embeded + config.label.colon
|
||||||
+ '</label><br/><textarea rows="5" style="width:100%" readonly><iframe style="border:1px solid" src="'
|
+ '</label><br/><textarea rows="5" style="width:100%" readonly><iframe style="border:1px solid" src="'
|
||||||
+ url + '?embed=true" width="99%" height="600"></iframe></textarea>';
|
+ url + '" width="99%" height="600"></iframe></textarea>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
$("#dialogShare").html(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 () {
|
stop: function () {
|
||||||
if (!playground.editor) {
|
if (!playground.editor) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/themes/default.css?{{.conf.StaticResourceVersion}}">
|
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/themes/default.css?{{.conf.StaticResourceVersion}}">
|
||||||
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/sign.css?{{.conf.StaticResourceVersion}}">
|
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/sign.css?{{.conf.StaticResourceVersion}}">
|
||||||
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/side.css?{{.conf.StaticResourceVersion}}">
|
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/side.css?{{.conf.StaticResourceVersion}}">
|
||||||
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/playground{{if .embed}}-embed{{end}}.css?{{.conf.StaticResourceVersion}}">
|
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/playground.css?{{.conf.StaticResourceVersion}}">
|
||||||
|
|
||||||
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
</head>
|
</head>
|
||||||
|
@ -42,9 +42,6 @@
|
||||||
<li>
|
<li>
|
||||||
<button class="btn btn-red" id="stop" onclick="playground.stop();">{{.i18n.stop}}</button>
|
<button class="btn btn-red" id="stop" onclick="playground.stop();">{{.i18n.stop}}</button>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<button class="btn-white btn" id="disqus" onclick="playground.disqus();">Disqus</button>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<button class="btn-white btn" id="share" onclick="playground.share();">{{.i18n.share}}</button>
|
<button class="btn-white btn" id="share" onclick="playground.share();">{{.i18n.share}}</button>
|
||||||
</li>
|
</li>
|
||||||
|
@ -65,24 +62,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="fn-clear">
|
<div class="fn-clear">
|
||||||
|
<div class="fn-left" id="editorDivWrap">
|
||||||
<div id="editorDiv">
|
<div id="editorDiv">
|
||||||
<textarea rows="20" id='editor' class="fn-none">{{.code}}</textarea>
|
<textarea rows="20" id='editor' class="fn-none">{{.code}}</textarea>
|
||||||
</div>
|
</div>
|
||||||
<textarea id="output" rows="20" readonly="readonly" ></textarea>
|
<textarea id="output" rows="20" readonly="readonly" ></textarea>
|
||||||
</div>
|
</div>
|
||||||
{{if .disqus}}
|
<div class="fn-right" id="goNews"></div>
|
||||||
<div id="disqus_thread"></div>
|
</div>
|
||||||
<script type="text/javascript">
|
|
||||||
var disqus_shortname = 'wide-playground';
|
|
||||||
var disqus_identifier = {{.fileName}};
|
|
||||||
var disqus_url = window.location.protocol + "//" + window.location.host + {{.conf.Context}} + "/playground/" + {{.fileName}};
|
|
||||||
(function() {
|
|
||||||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
|
||||||
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
|
|
||||||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
|
||||||
})();</script>
|
|
||||||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
|
||||||
{{end}}
|
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<span class="wrapper">
|
<span class="wrapper">
|
||||||
Ver {{.ver}}, © {{.year}} <a rel="copyright" href="http://b3log.org" target="_blank">B3LOG.ORG</a>, <a href="https://github.com/b3log/wide/blob/master/TERMS.md" target="_blank">{{.i18n.terms}}</a>
|
Ver {{.ver}}, © {{.year}} <a rel="copyright" href="http://b3log.org" target="_blank">B3LOG.ORG</a>, <a href="https://github.com/b3log/wide/blob/master/TERMS.md" target="_blank">{{.i18n.terms}}</a>
|
||||||
|
@ -101,9 +88,7 @@
|
||||||
"channel": "{{.conf.Channel}}",
|
"channel": "{{.conf.Channel}}",
|
||||||
"wideSessionId": "{{.sid}}",
|
"wideSessionId": "{{.sid}}",
|
||||||
"label": {{.i18n}},
|
"label": {{.i18n}},
|
||||||
"autocomplete": {{.conf.Autocomplete}},
|
"autocomplete": {{.conf.Autocomplete}}
|
||||||
"embed": {{.embed}},
|
|
||||||
"disqus": {{.disqus}}
|
|
||||||
};
|
};
|
||||||
function newWideRequest() {
|
function newWideRequest() {
|
||||||
var ret = {
|
var ret = {
|
||||||
|
|
Loading…
Reference in New Issue