From 8e519f17d144165b6de31bf3ebabdab5eb13bf0d Mon Sep 17 00:00:00 2001 From: Choom Date: Fri, 20 Jan 2023 00:36:43 -0300 Subject: Config para el usuario --- static/js/shobon.js | 84 ----------------------------------------------------- 1 file changed, 84 deletions(-) (limited to 'static/js/shobon.js') diff --git a/static/js/shobon.js b/static/js/shobon.js index 9eccf86..3a790a7 100644 --- a/static/js/shobon.js +++ b/static/js/shobon.js @@ -25,28 +25,6 @@ function shobon() { var newRepliesCounter = 0; - var shobon_time = localStorage.getItem("shobon_time"); - if (shobon_time != "false") { - if (boardName == "world") - week = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"]; - else if (boardName == "2d") - week = ["日", "月", "火", "水", "木", "金", "土"]; - else week = ["dom", "lun", "mar", "mie", "jue", "vie", "sab"]; - } - - if (where == "threads") { - if (shobon_time != "false") { - var dt = document.getElementsByClassName("date"); - for (var i = 0; i < dt.length; i++) { - dt[i].addEventListener("mouseover", function(e) { - this.title = "Hace " + timeAgo(this.dataset.unix); - }); - dt[i].textContent = localTime(dt[i].dataset.unix); - } - } - return; - } - if (localStorage.getItem("shobon_usefilters") != "false") { loadFilters(); } @@ -77,16 +55,6 @@ function shobon() { var message = reply.getElementsByClassName("msg")[0]; var id = 0; - if (shobon_time != "false") { - var date = reply.getElementsByClassName("date")[0]; - date.addEventListener("mouseover", function(e) { - this.title = "Hace " + timeAgo(this.dataset.unix); - }); - if (date.textContent.includes("ID:")) - id = date.textContent.split(" ")[1]; - date.textContent = localTime(date.dataset.unix, id); - } - if (localStorage.getItem("shobon_newposts") == "true") { var replyId = reply.attributes["data-n"].value; var isNewReply = parseInt(lastSeen) < parseInt(replyId); @@ -185,37 +153,6 @@ function createTh(label, w) { th.width = w; return th; } -function timeAgo(timestamp) { - var time = Math.round(Date.now() / 1000); - var el = time - timestamp; - if (el == 0) return "un instante"; - else if (el == 1) return "un segundo"; - else if (el < 60) return el + " segundos"; - else if (el < 120) return "un minuto"; - else if (el < 3600) return Math.round(el / 60) + " minutos"; - else if (el < 7200) return "una hora"; - else if (el < 86400) return Math.round(el / 3600) + " horas"; - else if (el < 172800) return "un día"; - else if (el < 2628000) return Math.round(el / 86400) + " días"; - else if (el < 5256000) return "un mes"; - else if (el < 31536000) return Math.round(el / 2628000) + " meses"; - else if (el > 31535999) return "más de un año"; -} - -function localTime(timestamp, id) { - id = id || 0; - var lcl = new Date(timestamp * 1000); - lcl = - ("0" + lcl.getDate()).slice(-2) + "/" + - ("0" + (lcl.getMonth() + 1)).slice(-2) + - "/" + lcl.getFullYear().toString().slice(-2) + - "(" + week[lcl.getDay()] + ")" + - ("0" + lcl.getHours()).slice(-2) + ":" + - ("0" + lcl.getMinutes()).slice(-2) + ":" + - ("0" + lcl.getSeconds()).slice(-2); - if (id) lcl = lcl + " " + id; - return lcl; -} function loadFilters() { var filters = JSON.parse(localStorage.getItem("shobon_filters")); @@ -315,7 +252,6 @@ function shobonSettings(e) { p.appendChild(createCheckbox("shobon_ids", "Colorear IDs", false)); p.appendChild(createCheckbox("shobon_embedimg", "Insertar imágenes miniatura", false)); p.appendChild(createCheckbox("shobon_newposts", "Destacar mensajes nuevos", false)); - p.appendChild(createCheckbox("shobon_time", "Convertir fechas a hora local", true)); p.appendChild(createCheckbox("shobon_backlink", "Mostrar quién ha citado un post", true)); p.appendChild(createCheckbox("shobon_preview", "Previsualizar citas", true)); p.appendChild(createCheckbox("shobon_usefilters", "Activar filtros", false)); @@ -443,26 +379,6 @@ function paintIds(reply) { ";padding:0 3px;border-radius:5px; font-size:0.9em;vertical-align:top;'>ID:" + userId + ""; - dateId.getElementsByClassName("uid")[0].addEventListener("click", markId, false); - } -} - -function markId(e) { - var uid = this.textContent.slice(0, -1).replace(":", "_"); - var sel = document.getElementsByClassName("sel"); - var len = sel.length; - for (i = 0; i < len; i++) { - var prev = String(sel[0].className); - sel[0].className = sel[0].className.toString().replace(/ sel/i, ""); - } - if (currentSel == uid) { - currentSel = null; - return; - } - currentSel = uid; - var tosel = document.getElementsByClassName(uid); - for (j = 0; j < tosel.length; j++) { - tosel[j].className = tosel[j].className + " sel"; } } -- cgit v1.2.1-18-gbd029