1
mirror of https://gitlab.com/commento/commento.git synced 2025-06-29 22:56:37 -04:00

frontend: use gulp, eslint, code refactor

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
This commit is contained in:
Anton Linevych
2018-06-24 04:01:21 +02:00
committed by Adhityaa Chandrasekar
parent e4f71fe402
commit 9e3935b3b2
30 changed files with 5059 additions and 395 deletions

View File

@ -1,4 +1,7 @@
(function (global, document) {
"use strict";
(document);
// Opens the moderatiosn settings window.
global.moderationOpen = function() {
@ -20,13 +23,13 @@
var idx = -1;
for (var i = 0; i < data.domains[data.cd].moderators.length; i++) {
if (data.domains[data.cd].moderators[i].email == email) {
if (data.domains[data.cd].moderators[i].email === email) {
idx = i;
break;
}
}
if (idx == -1) {
if (idx === -1) {
data.domains[data.cd].moderators.push({"email": email, "timeAgo": "just now"});
global.buttonDisable("#new-mod-button");
global.post(global.origin + "/api/domain/moderator/new", json, function(resp) {
@ -41,8 +44,7 @@
$("#new-mod").val("");
$("#new-mod").focus();
});
}
else {
} else {
global.globalErrorShow("Already a moderator.");
}
}
@ -60,13 +62,13 @@
var idx = -1;
for (var i = 0; i < data.domains[data.cd].moderators.length; i++) {
if (data.domains[data.cd].moderators[i].email == email) {
if (data.domains[data.cd].moderators[i].email === email) {
idx = i;
break;
}
}
if (idx != -1) {
if (idx !== -1) {
data.domains[data.cd].moderators.splice(idx, 1);
global.post(global.origin + "/api/domain/moderator/delete", json, function(resp) {
if (!resp.success) {