By Ricardo Pinto
—
Last update
Jun 29, 2008
—
Installed
3,271 times.
// ==UserScript==
// @name Hi5 Cleaner
// @description Limpa a interface do Hi5 / Cleans Hi5's interface
// @author Ricardo Pinto aka OpenMind
// @version 1.1
// @include http://*.hi5.com/*
// ==/UserScript==
// Variaveis que controlam o script
// Altere a seu gosto
//
// 1 = YES / 0 = NO
var remover_tema = 1;
var remover_header = 0;
var link_foto_album = 1;
var procurar_mail = 1;
var remover_videos_hi5 = 1;
var remover_widgets_hi5 = 0;
var remover_comentarios = 1;
var popup_fotos = 1;
// ---------------------------------------------
// ------------- NAO ALTERAR!!!!! -------------
// ---------------------------------------------
// Remover videos do Hi5
if (remover_videos_hi5) if (document.getElementById("videos") != null) document.getElementById("videos").style.display="none";
// Remover Widgets do Hi5
if (remover_widgets_hi5) if (document.getElementById("widgets") != null) document.getElementById("widgets").style.display="none";
// Remove o header
if (remover_header) if (document.getElementById("top_header") != null) document.getElementById("top_header").style.display="none";
// Remove imagem de fundo
if (remover_tema) {
for (i=0; i < document.getElementsByTagName("style").length; i++) {
if (document.getElementsByTagName("style")[i].innerHTML.match("background-image:"))
document.getElementsByTagName("style")[i].innerHTML=" ";
}
}
for (i=0; i < document.getElementsByTagName("a").length; i++) {
// Procurar por email
if (document.getElementsByTagName("a")[i].href.match("displaySearch.do") && !location.href.match("displaySearch")) document.getElementsByTagName("a")[i].href = document.getElementsByTagName("a")[i].href + "?searchType=email";
// Substitui link da foto para o album e não para a foto
if ( document.getElementsByTagName("a")[i].href.match("displayPhotoUser.do") && !location.href.match("displayUserAlbum") && !location.href.match("displayPhotoUser")) document.getElementsByTagName("a")[i].href = document.getElementsByTagName("a")[i].href.replace("displayPhotoUser.do", "displayUserAlbum.do");
}
for (i=0; i < document.getElementsByTagName("div").length; i++) {
// Remove imagens e videos dos comentários
if (remover_comentarios){
if (document.getElementsByTagName("div")[i].className.match("comment-text") ) {
if(document.getElementsByTagName("div")[i].innerHTML.match("embed")) {
var embedsrc = document.getElementsByTagName("div")[i].getElementsByTagName("embed")[0].src;
if(embedsrc.match("youtube.com")) embedsrc = embedsrc.replace("v/","watch?v=");
document.getElementsByTagName("div")[i].innerHTML = "<a href='"+embedsrc+"' target='_blank\'>Vídeo Bloqueado. Para o ver clique aqui</a>";
}
if(document.getElementsByTagName("div")[i].innerHTML.match("img")) {
var imgsrc = document.getElementsByTagName("div")[i].getElementsByTagName("img")[0].src;
document.getElementsByTagName("div")[i].innerHTML = "<a href='"+imgsrc+"' target='_blank\'>Imagem Bloqueada. Para a ver clique aqui</a>";
}
}
}
}
// Popup das imagens
// Original script by: Justin Rosenthal (justin.rosenthal at gmail) http://userscripts.org/scripts/show/8129
// Modified by znerp.
if (popup_fotos) {
GM_addStyle('.tip {visibility:hidden;position:fixed;');
var globalTimer;
var allImages = document.evaluate('//img[contains(@src, "photos")]|//img[contains(@src, "userpics")]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i=allImages.snapshotLength-1; i>=0; i--){
var thisImage = allImages.snapshotItem(i);
var src = thisImage.src;
fullsize = src.replace("-01","-02");
fullsize = fullsize.replace("small.","");
if (thisImage.src!=fullsize) {
thisImage.wrappedJSObject.divID='iyft'+i;
thisImage.addEventListener(
'mouseover',
function(event) {
thisID = this.divID;
globalTimer = window.setTimeout(function () { GM_addStyle('.tip {padding:10px;visibility:hidden;position:fixed;color:white;top:20px;left:20px;background-color:black;.tip img {border:10px solid white;}');
document.getElementById(thisID).style.visibility = "visible";},500);},
true);
thisImage.addEventListener(
'mouseout',
function(event) {window.clearTimeout(globalTimer); document.getElementById(this.divID).style.visibility = "hidden"; },
true);
thisImage.addEventListener(
'click',
function(event) {window.clearTimeout(globalTimer); document.getElementById(this.divID).style.visibility = "hidden";},
true);
var newDiv = document.createElement('div');
newDiv.innerHTML = "<div id='iyft" + i + "' class='tip' onmousemove=\"this.style.visibility='hidden'\" onmouseout=\"this.style.visibility='hidden'\" onmouseover=\"this.style.visibility='visible'\"><img src='" + fullsize + "'></div>";
document.body.appendChild(newDiv);
}
}
}
// ==UserScript==
// @name BlockFlash2
// @namespace http://userscripts.org/scripts/show/12617
// @description Hides Flash animations until you click on individual [Play Flash] buttonS.
// @include *
// ==/UserScript==
//
// embed tags
xpath("//embed").forEach(function(embed) { // put all embed objects in array and check each
if (embed.parentNode.nodeName != "OBJECT"){ // handle embeds within objects as objects
if(checkforflash(embed)){add_play_flash_div(embed)};
};
});
// object tags
xpath("//object").forEach(function(object) {
if(checkforflash(object)){add_play_flash_div(object)};
});
function checkforflash(potl_item){ // checks the element passed to it for Flash content
if (potl_item.innerHTML.match(/.swf|shockwave|flash|eyewonder/)) {
return true
};
if (potl_item.hasAttribute('type') && potl_item.getAttribute('type').match(/flash/)){
return true
};
if (potl_item.hasAttribute('src') && potl_item.getAttribute('src').match(/.swf|shockwave|flash|eyewonder/)){
return true
};
return false;
};
function add_play_flash_div(flash){ // places the button-like div before the flash node
var placeholder=document.createElement("div");
placeholder.setAttribute("class", "BlockFlash2");
flash.parentNode.insertBefore(placeholder, flash);
flash.style.display='none'; // hides the Flash node
flash.on=false;
placeholder.style.cursor='pointer';
placeholder.style.background='orange'; // don't like orange buttons? Change color here.
placeholder.style.textAlign='center';
placeholder.style.color='black';
placeholder.innerHTML="[Play Flash]";
placeholder.addEventListener( 'click', // the on/off switch
function() {
placeholder=this;
flash=this.nextSibling; // acts on the Flash-containing node following the div
if (flash.on) {
flash.style.display='none';
placeholder.innerHTML="[Play Flash]";
flash.on=false;
} else {
flash.style.display=''; // reveals the Flash node
placeholder.innerHTML="[Stop Flash]";
flash.on=true;
}
},
true
);
return true;
}
function xpath (p, context) {
if (!context) context = document;
var i, arr = [], xpr = document.evaluate(p, context, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (i = 0; item = xpr.snapshotItem(i); i++) arr.push(item);
return arr;
};
/*
Revised by v - varanasi
Revised by AP - Andrew Pennebaker (andrew.pennebaker@gmail.com)
Author: JvdO = Jos van den Oever (jos@vandenoever.info)
Version history:
0.3 - 2007-10-07 - v - eliminated anonymous function, condensed code
0.2 - 2007-10-06 - v - substituted xpath function for getElement and forEach for for loop
0.1 - 2007-09-26 - v - added code to find flash in embed tags (not just object tags), revised structure, included code by pix to improve on and off.
BlockFlash_Revisited - 2006-11-28 - AP - http://userscripts.org/scripts/show/6532
BlockFlash - 2006-02-12 - JvdO - http://userscripts.org/scripts/show/3204
Inspiration for this script comes from the removeFlash script and the FlashBlock firefox extension.
*/