This commit is contained in:
parent
1cf399bdd5
commit
ae2f6476be
|
@ -77,7 +77,7 @@ func IndexHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
model := map[string]interface{}{"conf": conf.Wide, "i18n": i18n.GetAll(locale), "locale": locale,
|
model := map[string]interface{}{"conf": conf.Wide, "i18n": i18n.GetAll(locale), "locale": locale,
|
||||||
"session": wideSession, "pathSeparator": conf.PathSeparator, "codeMirrorVer": conf.CodeMirrorVer,
|
"session": wideSession, "pathSeparator": conf.PathSeparator, "codeMirrorVer": conf.CodeMirrorVer,
|
||||||
"code": template.HTML(code)}
|
"code": template.HTML(code), "ver": conf.WideVersion, "year": time.Now().Year()}
|
||||||
|
|
||||||
wideSessions := session.WideSessions.GetByUsername(username)
|
wideSessions := session.WideSessions.GetByUsername(username)
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,31 @@ var playground = {
|
||||||
cursorHeight: 1,
|
cursorHeight: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var hovered = false;
|
||||||
|
$(".menu .ico-share").hover(function () {
|
||||||
|
$(".menu .share-panel").show();
|
||||||
|
hovered = true;
|
||||||
|
}, function () {
|
||||||
|
if (!hovered) {
|
||||||
|
$(".menu .share-panel").hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
hovered = false;
|
||||||
|
setTimeout(function () {
|
||||||
|
if (!hovered) {
|
||||||
|
$(".menu .share-panel").hide();
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".menu .share-panel").hover(function () {
|
||||||
|
$(".menu .share-panel").show();
|
||||||
|
hovered = true;
|
||||||
|
}, function () {
|
||||||
|
$(".menu .share-panel").hide();
|
||||||
|
hovered = false;
|
||||||
|
});
|
||||||
|
|
||||||
playground.editor.on('changes', function (cm) {
|
playground.editor.on('changes', function (cm) {
|
||||||
$("#url").html("");
|
$("#url").html("");
|
||||||
});
|
});
|
||||||
|
@ -195,6 +220,26 @@ var playground = {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
format: function () {
|
||||||
|
if (!playground.editor) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var code = playground.editor.getValue();
|
||||||
|
|
||||||
|
var request = newWideRequest();
|
||||||
|
request.code = code;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: config.context + '/playground/save',
|
||||||
|
data: JSON.stringify(request),
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
playground.editor.setValue(data.code);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,13 +22,16 @@
|
||||||
<div class="header menu fn-clear">
|
<div class="header menu fn-clear">
|
||||||
<ul class="fn-left">
|
<ul class="fn-left">
|
||||||
<li>
|
<li>
|
||||||
<a href="/login" rel="login">
|
<a href="/" target="_blank">
|
||||||
<img title="Wide, a Web-based IDE for Teams using Golang." src="{{.conf.StaticServer}}/static/images/wide-logo.png"
|
<img title="Wide, a Web-based IDE for Teams using Golang." src="{{.conf.StaticServer}}/static/images/wide-logo.png"
|
||||||
class="logo"/></a>
|
class="logo"/></a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<button class="btn" id="run" onclick="playground.run();">Run</button>
|
<button class="btn" id="run" onclick="playground.run();">Run</button>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<button class="btn btn-red" id="Format" onclick="playground.format();">Format</button>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<button class="btn btn-red" id="stop" onclick="playground.stop();">Stop</button>
|
<button class="btn btn-red" id="stop" onclick="playground.stop();">Stop</button>
|
||||||
</li>
|
</li>
|
||||||
|
@ -42,7 +45,7 @@
|
||||||
<span class="font-ico ico-share"></span>
|
<span class="font-ico ico-share"></span>
|
||||||
<span onclick="window.open('https://github.com/b3log/wide')"
|
<span onclick="window.open('https://github.com/b3log/wide')"
|
||||||
class="font-ico ico-github"></span>
|
class="font-ico ico-github"></span>
|
||||||
<div class="share-panel frame">
|
<div class="share-panel frame" style="display: none;">
|
||||||
<span title="Email" class="font-ico ico-email"></span>
|
<span title="Email" class="font-ico ico-email"></span>
|
||||||
<span title="Twitter" class="font-ico ico-twitter"></span>
|
<span title="Twitter" class="font-ico ico-twitter"></span>
|
||||||
<span title="Facebook" class="font-ico ico-facebook"></span>
|
<span title="Facebook" class="font-ico ico-facebook"></span>
|
||||||
|
|
Loading…
Reference in New Issue