From d2df3cf133d633157e08cc6e31f880ece7e9729d Mon Sep 17 00:00:00 2001 From: Manuel Cillero Date: Sat, 24 Feb 2018 18:50:22 +0100 Subject: [PATCH] =?UTF-8?q?Se=20fuerza=20a=20que=20los=20enlaces=20externo?= =?UTF-8?q?s=20abran=20siempre=20en=20una=20nueva=20p=C3=A1gina?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/images/external.png | Bin 136 -> 196 bytes public/themes/circlepro/javascripts/theme.js | 176 +++++++++--------- .../circlepro/stylesheets/application.css | 6 + 3 files changed, 95 insertions(+), 87 deletions(-) diff --git a/public/images/external.png b/public/images/external.png index 77c202895052508d3b97363b07dfb8035de5dba5..fb4f1f4364c4b09d77e005d27149ef4dadf456e1 100644 GIT binary patch literal 196 zcmeAS@N?(olHy`uVBq!ia0vp^AT}2VGmzZ%#=aj&v7|ftIx;X^yK%)o!U)KhEOCt} z3C>R|DNig)WpGT%PfAtr%uP&B4N6T+sVqF1Y6Dcn8Q>G*I&1@#VkvzAe-Et9=)!xF{)o|LMka>V^E{ mfGU=^mkX+dzpC}<9$*mXVaW8nP^|^j&EV3?#4ne^UZdJOMr-u0ZB*-tA!Qt7BG$2RI)5S4_ 1) { - var images = findImagesByRegexp('contacts_thumbnail', document); +if (window.jQuery) { + $(window).load(function(){ + if (window.devicePixelRatio > 1) { + var images = findImagesByRegexp('contacts_thumbnail', document); - for(var i = 0; i < images.length; i++) { - var lowres = images[i].src; - old_size = lowres.match(/\/(\d*)$/)[1] - var highres = lowres.replace(/\/(\d*)$/, "/" + String(old_size*2)); - images[i].src = highres; - } + for(var i = 0; i < images.length; i++) { + var lowres = images[i].src; + old_size = lowres.match(/\/(\d*)$/)[1] + var highres = lowres.replace(/\/(\d*)$/, "/" + String(old_size*2)); + images[i].src = highres; + } - var images = findImagesByRegexp(/gravatar.com\/avatar.*size=\d+/, document) + var images = findImagesByRegexp(/gravatar.com\/avatar.*size=\d+/, document) - for(var i = 0; i < images.length; i++) { - var lowres = images[i].src; - old_size = lowres.match(/size=(\d+)/)[1] - var highres = lowres.replace(/size=(\d+)/, "size=" + String(old_size*2)); - images[i].src = highres; - images[i].height = old_size; - images[i].width = old_size; - } + for(var i = 0; i < images.length; i++) { + var lowres = images[i].src; + old_size = lowres.match(/size=(\d+)/)[1] + var highres = lowres.replace(/size=(\d+)/, "size=" + String(old_size*2)); + images[i].src = highres; + images[i].height = old_size; + images[i].width = old_size; + } - var images = findImagesByRegexp(/\/attachments\/thumbnail\/\d+$/, document) + var images = findImagesByRegexp(/\/attachments\/thumbnail\/\d+$/, document) - for(var i = 0; i < images.length; i++) { - var lowres = images[i].src; - var height = images[i].height - var width = images[i].width - var highres = lowres + "?size=" + Math.max(height, width)*2; - if (Math.max(height, width) > 0) { - images[i].src = highres; - images[i].height = height; - images[i].width = width; - } - } + for(var i = 0; i < images.length; i++) { + var lowres = images[i].src; + var height = images[i].height + var width = images[i].width + var highres = lowres + "?size=" + Math.max(height, width)*2; + if (Math.max(height, width) > 0) { + images[i].src = highres; + images[i].height = height; + images[i].width = width; + } + } -// Sized thumbnails - var images = findImagesByRegexp(/\/attachments\/thumbnail\/\d+\/\d+$/, document) - for(var i = 0; i < images.length; i++) { - var lowres = images[i].src; - var height = images[i].height - var width = images[i].width - old_size = lowres.match(/\/(\d*)$/)[1] - var highres = lowres.replace(/\/(\d*)$/, "/" + String(old_size*2)); - images[i].src = highres; - if (Math.max(height, width) > 0) { - images[i].src = highres; - images[i].height = height; - images[i].width = width; - } - } + // Sized thumbnails + var images = findImagesByRegexp(/\/attachments\/thumbnail\/\d+\/\d+$/, document) + for(var i = 0; i < images.length; i++) { + var lowres = images[i].src; + var height = images[i].height + var width = images[i].width + old_size = lowres.match(/\/(\d*)$/)[1] + var highres = lowres.replace(/\/(\d*)$/, "/" + String(old_size*2)); + images[i].src = highres; + if (Math.max(height, width) > 0) { + images[i].src = highres; + images[i].height = height; + images[i].width = width; + } + } -// People avatars - var images = findImagesByRegexp(/people\/avatar.*size=\d+$/, document) + // People avatars + var images = findImagesByRegexp(/people\/avatar.*size=\d+$/, document) - for(var i = 0; i < images.length; i++) { - var lowres = images[i].src; - old_size = lowres.match(/size=(\d+)$/)[1] - var highres = lowres.replace(/size=(\d+)$/, "size=" + String(old_size*2)); - images[i].src = highres; - } + for(var i = 0; i < images.length; i++) { + var lowres = images[i].src; + old_size = lowres.match(/size=(\d+)$/)[1] + var highres = lowres.replace(/size=(\d+)$/, "size=" + String(old_size*2)); + images[i].src = highres; + } + } - - } - }); + // External links + $("a").filter(function() { + return this.hostname && this.hostname !== location.hostname; + }).addClass("external").attr("target", "_blank"); + }); } else { - document.observe("dom:loaded", function() { - if (window.devicePixelRatio > 1) { - var images = findImagesByRegexp('thumbnail', document); + document.observe("dom:loaded", function() { + if (window.devicePixelRatio > 1) { + var images = findImagesByRegexp('thumbnail', document); - for(var i = 0; i < images.length; i++) { - var lowres = images[i].src; - old_size = lowres.match(/size=(\d*)$/)[1] - var highres = lowres.replace(/size=(\d*)$/, "size=" + String(old_size*2)); - images[i].src = highres; - } + for(var i = 0; i < images.length; i++) { + var lowres = images[i].src; + old_size = lowres.match(/size=(\d*)$/)[1] + var highres = lowres.replace(/size=(\d*)$/, "size=" + String(old_size*2)); + images[i].src = highres; + } - var images = findImagesByRegexp(/gravatar.com\/avatar.*size=\d+/, document) + var images = findImagesByRegexp(/gravatar.com\/avatar.*size=\d+/, document) - for(var i = 0; i < images.length; i++) { - var lowres = images[i].src; - old_size = lowres.match(/size=(\d+)/)[1] - var highres = lowres.replace(/size=(\d+)/, "size=" + String(old_size*2)); - images[i].src = highres; - images[i].height = old_size; - images[i].width = old_size; - } - } - - }); + for(var i = 0; i < images.length; i++) { + var lowres = images[i].src; + old_size = lowres.match(/size=(\d+)/)[1] + var highres = lowres.replace(/size=(\d+)/, "size=" + String(old_size*2)); + images[i].src = highres; + images[i].height = old_size; + images[i].width = old_size; + } + } + }); } function findImagesByRegexp(regexp, parentNode) { - var images = Array.prototype.slice.call((parentNode || document).getElementsByTagName('img')); - var length = images.length; - var ret = []; - for(var i = 0; i < length; ++i) { - if(images[i].src.search(regexp) != -1) { - ret.push(images[i]); - } - } - return ret; + var images = Array.prototype.slice.call((parentNode || document).getElementsByTagName('img')); + var length = images.length; + var ret = []; + for(var i = 0; i < length; ++i) { + if(images[i].src.search(regexp) != -1) { + ret.push(images[i]); + } + } + return ret; }; diff --git a/public/themes/circlepro/stylesheets/application.css b/public/themes/circlepro/stylesheets/application.css index 0dd0945..a930ffd 100644 --- a/public/themes/circlepro/stylesheets/application.css +++ b/public/themes/circlepro/stylesheets/application.css @@ -172,6 +172,12 @@ div#activity dt.icon { word-wrap: break-word; } +div.wiki .external { + padding-left: 0; + padding-right: 12px; + background-position: right 60%; +} + /**********************************************************/ /* 2. FONT ICONS */ /**********************************************************/