diff options
author | TOW | 2019-04-01 19:45:18 -0300 |
---|---|---|
committer | TOW | 2019-04-01 19:45:18 -0300 |
commit | 209168adab63a3cf2d879b92d198a5d3485bfb97 (patch) | |
tree | 9ca229987ac45a6e88a9a20477b301e6f4405561 /static/js | |
parent | 4c1a0a18644a40dd58477685ec9b904216aaa163 (diff) | |
download | weabot-209168adab63a3cf2d879b92d198a5d3485bfb97.tar.gz weabot-209168adab63a3cf2d879b92d198a5d3485bfb97.tar.xz weabot-209168adab63a3cf2d879b92d198a5d3485bfb97.zip |
Shobon: Agregadas imagenes de Twitter
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); } } |