Se fuerza a que los enlaces externos abran siempre en una nueva página
This commit is contained in:
parent
d5080bf236
commit
d2df3cf133
3 changed files with 95 additions and 87 deletions
Binary file not shown.
Before Width: | Height: | Size: 136 B After Width: | Height: | Size: 196 B |
|
@ -1,104 +1,106 @@
|
||||||
if (window.jQuery) {
|
if (window.jQuery) {
|
||||||
$(window).load(function(){
|
$(window).load(function(){
|
||||||
if (window.devicePixelRatio > 1) {
|
if (window.devicePixelRatio > 1) {
|
||||||
var images = findImagesByRegexp('contacts_thumbnail', document);
|
var images = findImagesByRegexp('contacts_thumbnail', document);
|
||||||
|
|
||||||
for(var i = 0; i < images.length; i++) {
|
for(var i = 0; i < images.length; i++) {
|
||||||
var lowres = images[i].src;
|
var lowres = images[i].src;
|
||||||
old_size = lowres.match(/\/(\d*)$/)[1]
|
old_size = lowres.match(/\/(\d*)$/)[1]
|
||||||
var highres = lowres.replace(/\/(\d*)$/, "/" + String(old_size*2));
|
var highres = lowres.replace(/\/(\d*)$/, "/" + String(old_size*2));
|
||||||
images[i].src = highres;
|
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++) {
|
for(var i = 0; i < images.length; i++) {
|
||||||
var lowres = images[i].src;
|
var lowres = images[i].src;
|
||||||
old_size = lowres.match(/size=(\d+)/)[1]
|
old_size = lowres.match(/size=(\d+)/)[1]
|
||||||
var highres = lowres.replace(/size=(\d+)/, "size=" + String(old_size*2));
|
var highres = lowres.replace(/size=(\d+)/, "size=" + String(old_size*2));
|
||||||
images[i].src = highres;
|
images[i].src = highres;
|
||||||
images[i].height = old_size;
|
images[i].height = old_size;
|
||||||
images[i].width = 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++) {
|
for(var i = 0; i < images.length; i++) {
|
||||||
var lowres = images[i].src;
|
var lowres = images[i].src;
|
||||||
var height = images[i].height
|
var height = images[i].height
|
||||||
var width = images[i].width
|
var width = images[i].width
|
||||||
var highres = lowres + "?size=" + Math.max(height, width)*2;
|
var highres = lowres + "?size=" + Math.max(height, width)*2;
|
||||||
if (Math.max(height, width) > 0) {
|
if (Math.max(height, width) > 0) {
|
||||||
images[i].src = highres;
|
images[i].src = highres;
|
||||||
images[i].height = height;
|
images[i].height = height;
|
||||||
images[i].width = width;
|
images[i].width = width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sized thumbnails
|
// Sized thumbnails
|
||||||
var images = findImagesByRegexp(/\/attachments\/thumbnail\/\d+\/\d+$/, document)
|
var images = findImagesByRegexp(/\/attachments\/thumbnail\/\d+\/\d+$/, document)
|
||||||
for(var i = 0; i < images.length; i++) {
|
for(var i = 0; i < images.length; i++) {
|
||||||
var lowres = images[i].src;
|
var lowres = images[i].src;
|
||||||
var height = images[i].height
|
var height = images[i].height
|
||||||
var width = images[i].width
|
var width = images[i].width
|
||||||
old_size = lowres.match(/\/(\d*)$/)[1]
|
old_size = lowres.match(/\/(\d*)$/)[1]
|
||||||
var highres = lowres.replace(/\/(\d*)$/, "/" + String(old_size*2));
|
var highres = lowres.replace(/\/(\d*)$/, "/" + String(old_size*2));
|
||||||
images[i].src = highres;
|
images[i].src = highres;
|
||||||
if (Math.max(height, width) > 0) {
|
if (Math.max(height, width) > 0) {
|
||||||
images[i].src = highres;
|
images[i].src = highres;
|
||||||
images[i].height = height;
|
images[i].height = height;
|
||||||
images[i].width = width;
|
images[i].width = width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// People avatars
|
// People avatars
|
||||||
var images = findImagesByRegexp(/people\/avatar.*size=\d+$/, document)
|
var images = findImagesByRegexp(/people\/avatar.*size=\d+$/, document)
|
||||||
|
|
||||||
for(var i = 0; i < images.length; i++) {
|
for(var i = 0; i < images.length; i++) {
|
||||||
var lowres = images[i].src;
|
var lowres = images[i].src;
|
||||||
old_size = lowres.match(/size=(\d+)$/)[1]
|
old_size = lowres.match(/size=(\d+)$/)[1]
|
||||||
var highres = lowres.replace(/size=(\d+)$/, "size=" + String(old_size*2));
|
var highres = lowres.replace(/size=(\d+)$/, "size=" + String(old_size*2));
|
||||||
images[i].src = highres;
|
images[i].src = highres;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// External links
|
||||||
}
|
$("a").filter(function() {
|
||||||
});
|
return this.hostname && this.hostname !== location.hostname;
|
||||||
|
}).addClass("external").attr("target", "_blank");
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
document.observe("dom:loaded", function() {
|
document.observe("dom:loaded", function() {
|
||||||
if (window.devicePixelRatio > 1) {
|
if (window.devicePixelRatio > 1) {
|
||||||
var images = findImagesByRegexp('thumbnail', document);
|
var images = findImagesByRegexp('thumbnail', document);
|
||||||
|
|
||||||
for(var i = 0; i < images.length; i++) {
|
for(var i = 0; i < images.length; i++) {
|
||||||
var lowres = images[i].src;
|
var lowres = images[i].src;
|
||||||
old_size = lowres.match(/size=(\d*)$/)[1]
|
old_size = lowres.match(/size=(\d*)$/)[1]
|
||||||
var highres = lowres.replace(/size=(\d*)$/, "size=" + String(old_size*2));
|
var highres = lowres.replace(/size=(\d*)$/, "size=" + String(old_size*2));
|
||||||
images[i].src = highres;
|
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++) {
|
for(var i = 0; i < images.length; i++) {
|
||||||
var lowres = images[i].src;
|
var lowres = images[i].src;
|
||||||
old_size = lowres.match(/size=(\d+)/)[1]
|
old_size = lowres.match(/size=(\d+)/)[1]
|
||||||
var highres = lowres.replace(/size=(\d+)/, "size=" + String(old_size*2));
|
var highres = lowres.replace(/size=(\d+)/, "size=" + String(old_size*2));
|
||||||
images[i].src = highres;
|
images[i].src = highres;
|
||||||
images[i].height = old_size;
|
images[i].height = old_size;
|
||||||
images[i].width = old_size;
|
images[i].width = old_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function findImagesByRegexp(regexp, parentNode) {
|
function findImagesByRegexp(regexp, parentNode) {
|
||||||
var images = Array.prototype.slice.call((parentNode || document).getElementsByTagName('img'));
|
var images = Array.prototype.slice.call((parentNode || document).getElementsByTagName('img'));
|
||||||
var length = images.length;
|
var length = images.length;
|
||||||
var ret = [];
|
var ret = [];
|
||||||
for(var i = 0; i < length; ++i) {
|
for(var i = 0; i < length; ++i) {
|
||||||
if(images[i].src.search(regexp) != -1) {
|
if(images[i].src.search(regexp) != -1) {
|
||||||
ret.push(images[i]);
|
ret.push(images[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
|
@ -172,6 +172,12 @@ div#activity dt.icon {
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.wiki .external {
|
||||||
|
padding-left: 0;
|
||||||
|
padding-right: 12px;
|
||||||
|
background-position: right 60%;
|
||||||
|
}
|
||||||
|
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
/* 2. FONT ICONS */
|
/* 2. FONT ICONS */
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue