diff options
Diffstat (limited to 'static/js')
-rw-r--r-- | static/js/shobon.js | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/static/js/shobon.js b/static/js/shobon.js index 522dbe1..69b789a 100644 --- a/static/js/shobon.js +++ b/static/js/shobon.js @@ -82,7 +82,7 @@ function shobon() { if(localStorage.getItem("shobon_navbar") == "true") { fixedNav(); } - // incluye imgur + // incluye imagenes if(localStorage.getItem("shobon_embedimg") == "true") { embedImg(reply); } @@ -244,7 +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_embedimg", "Incluir imágenes miniatura", 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)); @@ -372,15 +372,18 @@ 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; + for(i=0;i<links.length&&i<5;i++) { + var url = links[i].href; + if(url.startsWith("https://i.imgur.com")) { 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); - } + var thumburl = url.slice(0, ext) + 's' + url.slice(ext); + } else if(links[i].href.startsWith("https://pbs.twimg.com")) { + var thumburl = links[i].href + ":thumb"; + } else continue; + var thumb = document.createElement("img"); + thumb.src = thumburl; + links[i].appendChild(document.createElement("br")); + links[i].appendChild(thumb); } } |