Skip to content

Instantly share code, notes, and snippets.

@tekkub
Created May 8, 2009 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tekkub/108914 to your computer and use it in GitHub Desktop.
Save tekkub/108914 to your computer and use it in GitHub Desktop.
// ==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