From 53016b93ce5a216607768f9fa5d47e07062cc14a Mon Sep 17 00:00:00 2001 From: Adhityaa Date: Sat, 16 Jun 2018 18:58:17 +0530 Subject: [PATCH] commento.js: double newline between functions --- frontend/js/commento.js | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/frontend/js/commento.js b/frontend/js/commento.js index 93959f2..998fc75 100644 --- a/frontend/js/commento.js +++ b/frontend/js/commento.js @@ -190,6 +190,7 @@ document.cookie = name + "=" + value + expires + "; path=/"; } + function sessionGet() { var session = cookieGet("session"); if (session === undefined) @@ -198,11 +199,13 @@ return session; } + global.logout = function() { cookieSet("session", "anonymous"); refreshAll(); } + function selfGet(callback) { var session = sessionGet(); if (session == "anonymous") { @@ -270,6 +273,7 @@ }); } + function cssLoad(file, onload) { var link = create("link"); var head = document.getElementsByTagName('head')[0]; @@ -282,6 +286,7 @@ append(head, link); } + function jsLoad(file, ready) { var script = document.createElement("script"); var loaded = false; @@ -305,6 +310,7 @@ append(document.body, script); } + function footerLoad() { var footer = create("div"); var aContainer = create("div"); @@ -334,6 +340,7 @@ append(root, footer); } + function commentsGet(callback) { var json = { session: sessionGet(), @@ -364,6 +371,7 @@ }); } + function errorShow(text) { var el = $(ID_ERROR); @@ -372,6 +380,7 @@ attrSet(el, "style", "display: block;"); } + function errorElementCreate() { var el = create("div"); @@ -383,6 +392,7 @@ append(root, el); } + function autoExpander(el) { return function() { el.style.height = ""; @@ -390,6 +400,7 @@ } }; + function isMobile() { var mobile = false; if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) @@ -399,6 +410,7 @@ return mobile; } + function textareaCreate(id) { var textareaSuperContainer = create("div"); var textareaContainer = create("div"); @@ -440,6 +452,7 @@ return textareaSuperContainer; } + function rootCreate(callback) { var mainArea = $(ID_MAIN_AREA); var commentsArea = create("div"); @@ -457,6 +470,7 @@ call(callback); } + function messageCreate(text) { var msg = create("div"); @@ -467,6 +481,7 @@ return msg; } + global.postComment = function(id) { var textarea = $(ID_TEXTAREA + id); @@ -513,6 +528,7 @@ }); } + function colorGet(name) { var colors = [ // some visually distincy @@ -532,6 +548,7 @@ return color; } + function timeDifference(current, previous) { // thanks stackoverflow var msJustNow = 5000; var msPerMinute = 60000; @@ -565,6 +582,7 @@ } } + function scorify(score) { if (score != 1) return score + " points"; @@ -572,6 +590,7 @@ return score + " point"; } + function commentsRecurse(parentMap, parentHex) { var cur = parentMap[parentHex]; if (!cur || !cur.length) { @@ -846,6 +865,7 @@ post(origin + "/api/comment/vote", json, function(resp) {}); } + global.replyShow = function(id) { if (id in shownReply && shownReply[id]) return; @@ -864,6 +884,7 @@ attrSet(replyButton, "onclick", "replyCollapse('" + id + "')") }; + global.replyCollapse = function(id) { var replyButton = $(ID_REPLY + id); var el = $(ID_SUPER_CONTAINER + id); @@ -880,6 +901,7 @@ attrSet(replyButton, "onclick", "replyShow('" + id + "')") } + global.commentCollapse = function(id) { var contents = $(ID_CONTENTS + id); var button = $(ID_COLLAPSE + id); @@ -894,6 +916,7 @@ attrSet(button, "onclick", "commentUncollapse('" + id + "')"); } + global.commentUncollapse = function(id) { var contents = $(ID_CONTENTS + id); var button = $(ID_COLLAPSE + id); @@ -908,6 +931,7 @@ attrSet(button, "onclick", "commentCollapse('" + id + "')"); } + function commentsRender() { var parentMap = {}; var parentHex; @@ -928,6 +952,7 @@ } } + global.showSubmitButton = function(id) { if (id in shownSubmitButton && shownSubmitButton[id]) return; @@ -951,6 +976,7 @@ append(el, submit); } + global.commentoAuth = function(provider) { if (provider == "anonymous") { cookieSet("session", "anonymous"); @@ -980,6 +1006,7 @@ }); } + function refreshAll(callback) { $(ID_ROOT).innerHTML = ""; shownSubmitButton = {"root": false}; @@ -987,6 +1014,7 @@ main(callback); } + function loginBoxCreate() { var loginBoxContainer = create("div"); @@ -995,6 +1023,7 @@ append(root, loginBoxContainer); } + global.signupRender = function() { var loginBoxContainer = $(ID_LOGIN_BOX_CONTAINER); var loginBox = create("div"); @@ -1091,6 +1120,7 @@ append(loginBoxContainer, loginBox); } + global.loginSwitch = function() { var header = $(ID_LOGIN_BOX_HEADER); var subtitle = $(ID_LOGIN_BOX_SUBTITLE); @@ -1114,11 +1144,13 @@ } } + global.signupSwitch = function() { loginBoxClose(); loginBoxShow(); } + function loginUP(username, password) { var json = { email: username, @@ -1137,6 +1169,7 @@ }); } + global.login = function() { var email = $(ID_LOGIN_BOX_EMAIL_INPUT); var password = $(ID_LOGIN_BOX_PASSWORD_INPUT); @@ -1144,6 +1177,7 @@ loginUP(email.value, password.value); } + global.signup = function() { var email = $(ID_LOGIN_BOX_EMAIL_INPUT); var name = $(ID_LOGIN_BOX_NAME_INPUT); @@ -1168,6 +1202,7 @@ }); } + global.passwordAsk = function() { var loginBox = $(ID_LOGIN_BOX); var subtitle = $(ID_LOGIN_BOX_SUBTITLE); @@ -1240,6 +1275,7 @@ } } + function mainAreaCreate() { var mainArea = create("div"); @@ -1252,6 +1288,7 @@ append(root, mainArea); } + global.loadCssOverride = function() { if (cssOverride === undefined) global.allShow(); @@ -1259,6 +1296,7 @@ cssLoad(cssOverride, "window.allShow()"); } + global.allShow = function() { var mainArea = $(ID_MAIN_AREA); var loggedContainer = $(ID_LOGGED_CONTAINER); @@ -1272,6 +1310,7 @@ nameWidthFix(); } + global.loginBoxClose = function() { var mainArea = $(ID_MAIN_AREA); var loginBoxContainer = $(ID_LOGIN_BOX_CONTAINER); @@ -1281,6 +1320,7 @@ attrSet(loginBoxContainer, "style", "display: none"); } + global.loginBoxShow = function() { var mainArea = $(ID_MAIN_AREA); var loginBoxContainer = $(ID_LOGIN_BOX_CONTAINER); @@ -1296,6 +1336,7 @@ $(ID_LOGIN_BOX_EMAIL_INPUT).focus(); } + function dataTagsLoad() { var scripts = tags("script") for (var i = 0; i < scripts.length; i++) { @@ -1311,6 +1352,7 @@ } } + global.main = function(callback) { root = $(ID_ROOT); classAdd(root, "root"); @@ -1333,6 +1375,7 @@ }); } + var autoInitted = false; function autoInit() { if (autoInitted) @@ -1347,6 +1390,7 @@ console.log("[commento] error: invalid value for data-auto-init; allowed values: true, false"); } + if (document.readyState != "complete" && document.readyState != "interactive") document.addEventListener("load", autoInit); else