Split up customJS into customHTML and customJS for better organisation (#5981)

* WIP

* fixed customJS not actually working in footer

* Moving scripts to footer, #5980

* Added upgrade scripts for #5980
This commit is contained in:
Julian Lam
2017-10-12 13:38:27 -04:00
committed by GitHub
parent a1a87c7ca1
commit cd6dcff38b
6 changed files with 95 additions and 18 deletions

View File

@@ -6,9 +6,11 @@ define('admin/appearance/customise', ['admin/settings', 'ace/ace'], function (Se
Customise.init = function () {
Settings.prepare(function () {
$('#customCSS').text($('#customCSS-holder').val());
$('#customJS').text($('#customJS-holder').val());
$('#customHTML').text($('#customHTML-holder').val());
var customCSS = ace.edit('customCSS');
var customJS = ace.edit('customJS');
var customHTML = ace.edit('customHTML');
customCSS.setTheme('ace/theme/twilight');
@@ -20,6 +22,15 @@ define('admin/appearance/customise', ['admin/settings', 'ace/ace'], function (Se
$('#customCSS-holder').val(customCSS.getValue());
});
customJS.setTheme('ace/theme/twilight');
customJS.getSession().setMode('ace/mode/js');
customJS.on('change', function () {
app.flags = app.flags || {};
app.flags._unsaved = true;
$('#customJS-holder').val(customJS.getValue());
});
customHTML.setTheme('ace/theme/twilight');
customHTML.getSession().setMode('ace/mode/html');