Add a "reset UI" menu option.

Addresses #217
dev/git-series/gccdum
Matt Godbolt 7 years ago
parent 538b4e86f8
commit 7135ec2d77

@ -208,7 +208,7 @@ define(function (require) {
this.pendingRequestSentAt = Date.now();
// After a short delay, give the user some indication that we're working on their
// compilation.
var progress = setTimeout(_.bind(function() {
var progress = setTimeout(_.bind(function () {
this.setAssembly(fakeAsm("<Compiling...>"));
}, this), 500);
$.ajax({
@ -291,7 +291,8 @@ define(function (require) {
Compiler.prototype.onCompileResponse = function (request, result, cached) {
this.lastResult = result;
var timeTaken = Date.now() - this.pendingRequestSentAt;
var timeTaken = Math.max(0, Date.now() - this.pendingRequestSentAt);
var wasRealReply = this.pendingRequestSentAt > 0;
this.pendingRequestSentAt = 0;
if (this.nextRequest) {
var next = this.nextRequest;
@ -328,10 +329,13 @@ define(function (require) {
status.toggleClass('error', failed);
status.toggleClass('warning', warns);
status.parent().attr('title', allText);
var compileTime = this.domRoot.find('.compile-time');
if (cached) {
this.domRoot.find('.compile-time').text("- cached");
compileTime.text("- cached");
} else if (wasRealReply) {
compileTime.text("- " + timeTaken + "ms");
} else {
this.domRoot.find('.compile-time').text("- " + timeTaken + "ms");
compileTime.text("");
}
this.eventHub.emit('compileResult', this.id, this.compiler, result);
};

@ -36,8 +36,11 @@
<ul class="dropdown-menu">
<li><a href="https://github.com/mattgodbolt/compiler-explorer/wiki">Wiki</a></li>
<li><a href="https://github.com/mattgodbolt/compiler-explorer/issues">Report an issue</a></li>
<li><a href="mailto:matt@godbolt.org">Contact the author</a></li>
<li class="divider"></li>
<li><a href="#" id="ui-reset">Reset UI layout</a></li>
<li class="divider"></li>
<li><a href="http://xania.org/201609/how-compiler-explorer-runs-on-amazon">How it works</a></li>
<li><a href="mailto:matt@godbolt.org">Contact the author</a></li>
<li><a href="http://xania.org/MattGodbolt" rel="author">About the author</a></li>
</ul>
</li>

@ -152,6 +152,10 @@ define(function (require) {
new clipboard('.btn.clippy');
sharing.initShareButton($('#share'), layout);
$('#ui-reset').click(function () {
window.localStorage.removeItem('gl');
window.location.reload();
});
}
$(start);

Loading…
Cancel
Save