2018-06-04 00:06:17 +08:00
|
|
|
(function (global, document) {
|
2018-06-24 10:01:21 +08:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
(document);
|
2018-06-04 00:06:17 +08:00
|
|
|
|
|
|
|
// Sets a vue.js field. Short for "vue set".
|
|
|
|
function vs(field, value) {
|
|
|
|
Vue.set(global.dashboard, field, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
global.vs = vs;
|
|
|
|
|
|
|
|
|
|
|
|
// Sets the owner's name in the navbar.
|
|
|
|
global.navbarFill = function() {
|
|
|
|
$("#owner-name").text(global.owner.name);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Constructs the vue.js object
|
|
|
|
global.vueConstruct = function(callback) {
|
|
|
|
var settings = [
|
|
|
|
{
|
|
|
|
"id": "installation",
|
2019-01-31 12:47:29 +08:00
|
|
|
"text": "Installation Guide",
|
2018-06-04 00:06:17 +08:00
|
|
|
"meaning": "Install Commento with HTML",
|
|
|
|
"selected": false,
|
2018-12-20 13:48:43 +08:00
|
|
|
"open": global.installationOpen,
|
2018-06-04 00:06:17 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "general",
|
2019-01-31 15:06:11 +08:00
|
|
|
"text": "General",
|
2019-04-20 07:03:34 +08:00
|
|
|
"meaning": "Names, authentication, and export",
|
2018-06-04 00:06:17 +08:00
|
|
|
"selected": false,
|
2018-12-20 13:48:43 +08:00
|
|
|
"open": global.generalOpen,
|
2018-06-04 00:06:17 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "moderation",
|
|
|
|
"text": "Moderation Settings",
|
2019-01-31 12:47:29 +08:00
|
|
|
"meaning": "Manage moderators, spam filtering",
|
2018-06-04 00:06:17 +08:00
|
|
|
"selected": false,
|
2018-12-20 13:48:43 +08:00
|
|
|
"open": global.moderationOpen,
|
2018-06-04 00:06:17 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "statistics",
|
2019-01-31 12:47:29 +08:00
|
|
|
"text": "Analytics",
|
|
|
|
"meaning": "Anonymous statistics and graphs",
|
2018-06-04 00:06:17 +08:00
|
|
|
"selected": false,
|
2018-12-20 13:48:43 +08:00
|
|
|
"open": global.statisticsOpen,
|
2018-06-04 00:06:17 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "import",
|
|
|
|
"text": "Import Comments",
|
|
|
|
"meaning": "Import from a different service",
|
|
|
|
"selected": false,
|
2018-12-20 13:48:43 +08:00
|
|
|
"open": global.importOpen,
|
2018-06-04 00:06:17 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "danger",
|
|
|
|
"text": "Danger Zone",
|
2019-04-13 08:21:46 +08:00
|
|
|
"meaning": "Here be dragons",
|
2018-06-04 00:06:17 +08:00
|
|
|
"selected": false,
|
2018-12-20 13:48:43 +08:00
|
|
|
"open": global.dangerOpen,
|
2018-06-04 00:06:17 +08:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
var reactiveData = {
|
|
|
|
// list of panes; mutable because selection information is stored within
|
|
|
|
settings: settings,
|
|
|
|
|
|
|
|
// list of domains dynamically loaded; obviously mutable
|
|
|
|
domains: [{show: false, viewsLast30Days: global.numberify(0), commentsLast30Days: global.numberify(0), moderators: []}],
|
|
|
|
|
2019-04-20 07:03:34 +08:00
|
|
|
// configured oauth providers that will be filled in after a backend request
|
|
|
|
configuredOauths: {},
|
|
|
|
|
2018-06-04 00:06:17 +08:00
|
|
|
// whether or not to show the settings column; mutable because we do not
|
|
|
|
// show the column until a domain has been selected
|
|
|
|
showSettings: false,
|
|
|
|
|
|
|
|
// currently selected domain index; obviously mutable
|
|
|
|
cd: 0, // stands for "current domain"
|
|
|
|
};
|
|
|
|
|
|
|
|
global.dashboard = new Vue({
|
|
|
|
el: "#dashboard",
|
|
|
|
data: reactiveData,
|
|
|
|
});
|
|
|
|
|
2018-06-24 10:01:21 +08:00
|
|
|
if (callback !== undefined) {
|
2018-06-04 00:06:17 +08:00
|
|
|
callback();
|
2018-06-24 10:01:21 +08:00
|
|
|
}
|
2018-06-04 00:06:17 +08:00
|
|
|
};
|
|
|
|
|
2018-12-20 13:48:43 +08:00
|
|
|
} (window.commento, document));
|