commento/frontend/js/dashboard-setting.js

47 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

2018-06-04 00:06:17 +08:00
(function (global, document) {
"use strict";
(document);
2018-06-04 00:06:17 +08:00
// 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++) {
settings[i].selected = settings[i].id === id;
2018-06-04 00:06:17 +08:00
}
}
// 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) {
2018-06-04 00:06:17 +08:00
settings[i].open();
}
2018-06-04 00:06:17 +08:00
}
};
// Deselects all settings.
global.settingDeselectAll = function() {
var data = global.dashboard.$data;
var settings = data.settings;
for (var i = 0; i < settings.length; i++) {
2018-06-04 00:06:17 +08:00
settings[i].selected = false;
}
2018-06-04 00:06:17 +08:00
}
} (window.commento, document));