This commit is contained in:
Rubén Rincón
2019-10-12 22:38:23 +02:00
5 changed files with 79 additions and 8 deletions
+12 -4
View File
@@ -386,11 +386,19 @@ function start() {
// Skip some steps if using embedded mode
if (!options.embedded) {
// Don't fetch the motd
motd.initialise(options.motdUrl, $('#motd'), subLangId, settings.enableCommunityAds, function () {
hub.layout.eventHub.emit('modifySettings', {
enableCommunityAds: false
motd.initialise(options.motdUrl, $('#motd'), subLangId, settings.enableCommunityAds,
function (data) {
var sendMotd = function () {
hub.layout.eventHub.emit('motd', data);
};
hub.layout.eventHub.on('requestMotd', sendMotd);
sendMotd();
},
function () {
hub.layout.eventHub.emit('modifySettings', {
enableCommunityAds: false
});
});
});
// Don't try to update Version tree link
var release = window.compilerExplorerOptions.release;
+2 -1
View File
@@ -67,10 +67,11 @@ function handleMotd(motd, motdNode, subLang, adsEnabled, onHide) {
}
}
function initialise(url, motdNode, defaultLanguage, adsEnabled, onHide) {
function initialise(url, motdNode, defaultLanguage, adsEnabled, onMotd, onHide) {
if (!url) return;
$.getJSON(url)
.then(function (res) {
onMotd(res);
handleMotd(res, motdNode, defaultLanguage, adsEnabled, onHide);
})
.catch(function (jqXHR, textStatus, errorThrown) {
+31 -1
View File
@@ -73,6 +73,7 @@ function Editor(hub, state, container) {
this.decorations = {};
this.prevDecorations = [];
this.extraDecorations = [];
this.fadeTimeoutId = -1;
@@ -174,10 +175,35 @@ function Editor(hub, state, container) {
});
}
Editor.prototype.onMotd = function (motd) {
this.extraDecorations = motd.decorations;
this.updateExtraDecorations();
};
Editor.prototype.updateExtraDecorations = function () {
var decorationsDirty = false;
_.each(this.extraDecorations, _.bind(function (decoration) {
if (decoration.filter && decoration.filter.indexOf(this.currentLanguage.name.toLowerCase()) < 0) return;
var match = this.editor.getModel().findNextMatch(decoration.regex, {
column: 1,
lineNumber: 1
}, true, true, null, false);
if (match !== this.decorations[decoration.name]) {
decorationsDirty = true;
this.decorations[decoration.name] = match ? [{range: match.range, options: decoration.decoration}] : null;
}
}, this));
if (decorationsDirty)
this.updateDecorations();
};
// If compilerId is undefined, every compiler will be pinged
Editor.prototype.maybeEmitChange = function (force, compilerId) {
var source = this.getSource();
if (!force && source === this.lastChangeEmitted) return;
this.updateExtraDecorations();
this.lastChangeEmitted = source;
this.eventHub.emit('editorChange', this.id, this.lastChangeEmitted, this.currentLanguage.id, compilerId);
};
@@ -249,6 +275,8 @@ Editor.prototype.initCallbacks = function () {
this.eventHub.on('conformanceViewClose', this.onConformanceViewClose, this);
this.eventHub.on('resize', this.resize, this);
this.eventHub.on('newSource', this.onNewSource, this);
this.eventHub.on('motd', this.onMotd, this);
this.eventHub.emit('requestMotd');
this.editor.getModel().onDidChangeContent(_.bind(function () {
this.debouncedEmitChange();
@@ -830,7 +858,9 @@ Editor.prototype.onEditorSetDecoration = function (id, lineNum, reveal) {
};
Editor.prototype.updateDecorations = function () {
this.prevDecorations = this.editor.deltaDecorations(this.prevDecorations, _.flatten(_.values(this.decorations)));
this.prevDecorations = this.editor.deltaDecorations(
this.prevDecorations,
_.compact(_.flatten(_.values(this.decorations))));
};
Editor.prototype.onConformanceViewOpen = function (editorId) {
+17 -1
View File
@@ -8,14 +8,17 @@
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9'%3E%3Cpath fill='%23fff' d='M.45713 8.5429l-.44426-.44438 3.5955-3.5956L.00697.90152l.8944-.89463 3.6016 3.6015 3.6014-3.6015.88867.88867-3.6014 3.6015 3.6014 3.6015-.89449.89449-3.6015-3.6014-3.5957 3.5956z'/%3E%3C/svg%3E") !important;
background-size: 9px !important;
}
.lm_controls .lm_maximise {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9'%3E%3Cpath fill='%23fff' d='M0 4.5V0h9v9H0zM8 5V2H1v6h7z'/%3E%3C/svg%3E") !important;
background-size: 9px !important;
}
.lm_controls .lm_close {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9'%3E%3Cpath fill='%23fff' d='M.45713 8.5429l-.44426-.44438 3.5955-3.5956L.00697.90152l.8944-.89463 3.6016 3.6015 3.6014-3.6015.88867.88867-3.6014 3.6015 3.6014 3.6015-.89449.89449-3.6015-3.6014-3.5957 3.5956z'/%3E%3C/svg%3E") !important;
background-size: 9px !important;
}
.lm_maximised .lm_controls .lm_maximise {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9'%3E%3Cpath fill='%23fff' d='M1.0096 8.0019v-.99809h6.9807v1.9962H1.0096z'/%3E%3C/svg%3E") !important;
background-size: 9px !important;
@@ -44,7 +47,7 @@ body {
}
.navbar-light a.nav-link {
border: rgb(140,140,140) 1px solid;
border: rgb(140, 140, 140) 1px solid;
}
a.navbar-brand img.logo.inverse {
@@ -116,6 +119,19 @@ a.navbar-brand img.logo.normal {
background: #555657 !important;
}
.rainbow-decoration {
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-image: -webkit-gradient(linear, left top, right bottom,
color-stop(0.00, red),
color-stop(16%, orange),
color-stop(32%, yellow),
color-stop(48%, green),
color-stop(60%, blue),
color-stop(76%, indigo),
color-stop(1.00, violet));
}
.selectize-control.single .selectize-input {
color: #f2f2f2 !important;
background: #666 linear-gradient(to bottom, #555, #222) !important;
+17 -1
View File
@@ -8,14 +8,17 @@
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9'%3E%3Cpath fill='%23000' d='M.45713 8.5429l-.44426-.44438 3.5955-3.5956L.00697.90152l.8944-.89463 3.6016 3.6015 3.6014-3.6015.88867.88867-3.6014 3.6015 3.6014 3.6015-.89449.89449-3.6015-3.6014-3.5957 3.5956z'/%3E%3C/svg%3E") !important;
background-size: 9px !important;
}
.lm_controls .lm_maximise {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9'%3E%3Cpath fill='%23000' d='M0 4.5V0h9v9H0zM8 5V2H1v6h7z'/%3E%3C/svg%3E") !important;
background-size: 9px !important;
}
.lm_controls .lm_close {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9'%3E%3Cpath fill='%23000' d='M.45713 8.5429l-.44426-.44438 3.5955-3.5956L.00697.90152l.8944-.89463 3.6016 3.6015 3.6014-3.6015.88867.88867-3.6014 3.6015 3.6014 3.6015-.89449.89449-3.6015-3.6014-3.5957 3.5956z'/%3E%3C/svg%3E") !important;
background-size: 9px !important;
}
.lm_maximised .lm_controls .lm_maximise {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9'%3E%3Cpath fill='%23000' d='M1.0096 8.0019v-.99809h6.9807v1.9962H1.0096z'/%3E%3C/svg%3E") !important;
background-size: 9px !important;
@@ -42,7 +45,7 @@ body {
}
.navbar-nav a.nav-link {
border: rgb(140,140,140) 1px solid;
border: rgb(140, 140, 140) 1px solid;
}
.float-link {
@@ -94,6 +97,19 @@ a.navbar-brand img.logo.normal {
background: lightblue !important;
}
.rainbow-decoration {
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-image: -webkit-gradient(linear, left top, right bottom,
color-stop(0.00, red),
color-stop(16%, orange),
color-stop(32%, yellow),
color-stop(48%, green),
color-stop(60%, blue),
color-stop(76%, indigo),
color-stop(1.00, violet));
}
.font-option {
background: white;
}