aboutsummaryrefslogtreecommitdiff
path: root/static/js
diff options
context:
space:
mode:
authorLibravatar TOW 2019-04-01 19:24:42 -0300
committerLibravatar TOW 2019-04-01 19:24:42 -0300
commit4c1a0a18644a40dd58477685ec9b904216aaa163 (patch)
treea1f72523bf6fc41b5435e51330aee8b96c83ff64 /static/js
parent770acfd68a6c4cbf2e62bb9b129b8ccc446f01ab (diff)
downloadweabot-4c1a0a18644a40dd58477685ec9b904216aaa163.tar.gz
weabot-4c1a0a18644a40dd58477685ec9b904216aaa163.tar.xz
weabot-4c1a0a18644a40dd58477685ec9b904216aaa163.zip
Shobon: Agregada función para incluir imgur
Diffstat (limited to 'static/js')
-rw-r--r--static/js/shobon.js22
1 files changed, 21 insertions, 1 deletions
diff --git a/static/js/shobon.js b/static/js/shobon.js
index b4e48f6..522dbe1 100644
--- a/static/js/shobon.js
+++ b/static/js/shobon.js
@@ -82,6 +82,11 @@ function shobon() {
if(localStorage.getItem("shobon_navbar") == "true") {
fixedNav();
}
+ // incluye imgur
+ if(localStorage.getItem("shobon_embedimg") == "true") {
+ embedImg(reply);
+ }
+
}
if (newRepliesInThread > 0 && !inThread) {
thread.getElementsByClassName("threadlinks")[0].innerHTML += "<span onClick='localStorage.setItem(\"" + boardName + "_" + threadId + "\" , " + lastReplyN + "); this.hidden = true;' style='font-weight: bold; background: #81a2be; padding: 5px; border-radius: 5px; float: right; margin-bottom: 10px;'>Marcar como leido</span>";
@@ -239,6 +244,7 @@ function shobonSettings(e) {
p.appendChild(createCheckbox("shobon_on", "<b>Activar extensión</b>", true));
p.appendChild(createCheckbox("shobon_navbar", "Fijar barra superior", false));
p.appendChild(createCheckbox("shobon_ids", "Colorear IDs", true));
+ p.appendChild(createCheckbox("shobon_embedimg", "Incluir imágenes de imgur", false));
p.appendChild(createCheckbox("shobon_newposts", "Destacar mensajes nuevos", false));
p.appendChild(createCheckbox("shobon_country", "Reemplazar códigos de país por nombres", false));
p.appendChild(createCheckbox("shobon_time", "Convertir fechas a hora local", true));
@@ -364,6 +370,20 @@ function paintIds(reply) {
}
}
+function embedImg(reply) {
+ var links = reply.getElementsByTagName("a");
+ for(i=0;i<links.length;i++) {
+ if(links[i].href.startsWith("https://i.imgur.com")) {
+ var url = links[i].href;
+ var ext = url.lastIndexOf('.');
+ var thumb = document.createElement("img");
+ thumb.src = url.slice(0, ext) + 's' + url.slice(ext);
+ links[i].appendChild(document.createElement("br"));
+ links[i].appendChild(thumb);
+ }
+ }
+}
+
function toHex(str) {
var hex = '';
for (var i = 0; i < str.length; i++) {
@@ -405,4 +425,4 @@ function fixedNav() {
}
}
-document.addEventListener('DOMContentLoaded', shobon, false); \ No newline at end of file
+document.addEventListener('DOMContentLoaded', shobon, false);