9e3935b3b2
Apologies in advance for the insanely huge commit. This commit is primarily based on Anton Linevych's amazing work found here [1]. While he had gone through the pains of making small, atomic changes to each file, I had put off reviewing the PR for a long time. By the time I finally got around to it, the project had changed so much that it didn't make sense to keep the commits the same way. So I've cherry-picked most of his commits, with some changes here and there, and I've squashed them into one commit. [1] https://gitlab.com/linevych/commento-ce/tree/feature/frontend_building_improvements
51 lines
1.1 KiB
JavaScript
51 lines
1.1 KiB
JavaScript
(function (global, document) {
|
|
"use strict";
|
|
|
|
(document);
|
|
|
|
// Sets the vue.js toggle to select and deselect panes visually.
|
|
function settingSelectCSS(id) {
|
|
var data = global.dashboard.$data;
|
|
var settings = data.settings;
|
|
|
|
for (var i = 0; i < settings.length; i++) {
|
|
if (settings[i].id === id) {
|
|
settings[i].selected = true;
|
|
} else {
|
|
settings[i].selected = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// Selects a setting.
|
|
global.settingSelect = function(id) {
|
|
var data = global.dashboard.$data;
|
|
var settings = data.settings;
|
|
|
|
settingSelectCSS(id);
|
|
|
|
$("ul.tabs li").removeClass("current");
|
|
$(".content").removeClass("current");
|
|
$(".original").addClass("current");
|
|
|
|
for (var i = 0; i < settings.length; i++) {
|
|
if (id === settings[i].id) {
|
|
settings[i].open();
|
|
}
|
|
}
|
|
};
|
|
|
|
|
|
// Deselects all settings.
|
|
global.settingDeselectAll = function() {
|
|
var data = global.dashboard.$data;
|
|
var settings = data.settings;
|
|
|
|
for (var i = 0; i < settings.length; i++) {
|
|
settings[i].selected = false;
|
|
}
|
|
}
|
|
|
|
} (window.commento, document));
|