Created
May 8, 2009 18:28
-
-
Save tekkub/108914 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Bear411 Thumbnails | |
// @description Replaces thumbnails with full-size images | |
// @include http://www.bear411.com/profile.php* | |
// ==/UserScript== | |
var excluded = false; | |
var locre1 = new RegExp("http://www.bear411.com/(.*).php"); | |
var res1 = locre1.exec(location); | |
if (res1) { | |
if (res1[1] != "profile") {excluded = true;} | |
} | |
var locre2 = new RegExp("http://www.bear411.com/messenger/.*"); | |
var res2 = locre2.exec(location); | |
if (res2) {excluded = true;} | |
// @exclude http://www.bear411.com/messenger/* | |
// @exclude http://www.bear411.com/ | |
// @exclude http://www.bear411.com/*.php | |
if (!excluded) { | |
var locre = new RegExp("http://www.bear411.com/profile.php.name=(.*)"); | |
var res = locre.exec(location); | |
var profilename; | |
if (res) {profilename = res[1];} | |
else { | |
locre = new RegExp("http://www.bear411.com/(.*)"); | |
res = locre.exec(location); | |
if (res) {profilename = res[1];} | |
} | |
var allImages, thisImage, mainpic; | |
var hasthumbs = false; | |
var re = new RegExp("^(.*/bears/./)th_(.*)$") // http://www.bear411.com/bears/f/th_furdude_2.jpg | |
allImages = document.getElementsByTagName('img'); | |
for (var i = 0; i < allImages.length; i++) { | |
thisImage = allImages[i]; | |
if (thisImage.id == "secThumb0") {mainpic = thisImage;} | |
var result = re.exec(thisImage.src); | |
if (result) { | |
var path = result[1]; | |
var imagename = result[2]; | |
if (imagename.match(profilename)) {hasthumbs = true;} | |
thisImage.setAttribute('src', path + imagename); | |
thisImage.setAttribute('width', null); | |
thisImage.setAttribute('height', null); | |
} | |
} | |
if (hasthumbs) {mainpic.setAttribute('style', 'display: none;');} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment