This commit is contained in:
Van 2016-10-29 23:30:09 +08:00
parent 817c556df4
commit 79984ab9ac
5 changed files with 116 additions and 183 deletions

View File

@ -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",

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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());
$('#goNews, #editorDivWrap').height($(window).height() - 40 - $(".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");
}
},
_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");
}
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 = "<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 () {
if (!playground.editor) {
return;
@ -374,7 +392,7 @@ var playground = {
+ result.data + '</a><br/>';
html += '<label>' + config.label.embeded + config.label.colon
+ '</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>';
$("#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;

View File

@ -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/sign.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" />
</head>
@ -42,9 +42,6 @@
<li>
<button class="btn btn-red" id="stop" onclick="playground.stop();">{{.i18n.stop}}</button>
</li>
<li>
<button class="btn-white btn" id="disqus" onclick="playground.disqus();">Disqus</button>
</li>
<li>
<button class="btn-white btn" id="share" onclick="playground.share();">{{.i18n.share}}</button>
</li>
@ -65,24 +62,14 @@
</div>
</div>
<div class="fn-clear">
<div class="fn-left" id="editorDivWrap">
<div id="editorDiv">
<textarea rows="20" id='editor' class="fn-none">{{.code}}</textarea>
</div>
<textarea id="output" rows="20" readonly="readonly" ></textarea>
</div>
{{if .disqus}}
<div id="disqus_thread"></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="fn-right" id="goNews"></div>
</div>
<div class="footer">
<span class="wrapper">
Ver {{.ver}}, &copy; {{.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}}",
"wideSessionId": "{{.sid}}",
"label": {{.i18n}},
"autocomplete": {{.conf.Autocomplete}},
"embed": {{.embed}},
"disqus": {{.disqus}}
"autocomplete": {{.conf.Autocomplete}}
};
function newWideRequest() {
var ret = {