NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name FurAffinity Thumbnail hax
// @namespace http://www.furaffinity.net/maloo
// @version 0.7
// @description Expands thumbnails when you mouseover them & restores the old gallery layout. USE WITH ADBLOCK FOR BETTER LOAD TIMES! Edit this script to change settings and see more.
// @include *://*furaffinity.net/browse*
// @include *://*furaffinity.net/gallery/*
// @include *://*furaffinity.net/scraps/*
// @include *://*furaffinity.net/favorites/*
// @include *://*furaffinity.net/msg/submissions*
// @include *://*furaffinity.net/search*
// @include *://*furaffinity.net/controls/*
// @run-at document-start
// ==/UserScript==
//USE WITH ADBLOCK FILTER TO PREVENT DOUBLE-HIT TO FA THUMBNAIL SERVERS. It also improves your load times, if you want a selfish reason.
//Manually add http://t.facdn.net/*@200*$~collapse and http://t.facdn.net/*@300*$~collapse to your filters.
(function() {
// size thumbnail is scaled down to while not hovered over
var size = 250;
// set desired delay until enlarged thumbnail is shown (in seconds)
var popupDelay = 0.25;
// set transition duration here (in seconds)
var transitionDuration = 0.25;
// size thumbnail is scaled to after hovering over
var currentSize = 400;
//Actual thumbnail image size. FA generates thumbnails at 50, 100, 150, 200, 300, and 400. Any other number will result in errors.
//Matching the size above means that, when hovered over, the thumbnail expands to it's full, unzoomed size.
var thumbSize = 400;
//
// Code starts here
// ========================================================================
function addGlobalStyle(css) {
var head, style;
head = document.documentElement;
if (!head) { console.log("I failed"); return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
// calculate margin for default sized thumbnail
var margin = Math.floor((currentSize - size) / -2);
addGlobalStyle( getGalleryCss(size) +
'section.gallery figure.t-image b u a[href^="/view/"]:hover {position:relative;z-index:10;margin:' + margin + 'px !important;-moz-transition: all ' + transitionDuration + 's ease-in-out ' + popupDelay + 's !important}' +
'section.gallery figure.t-image b u a[href^="/view/"]:hover img {max-width:' + currentSize + 'px !important;max-height:' + currentSize + 'px !important;-moz-transition: all ' + transitionDuration + 's ease-in-out ' + popupDelay + 's !important}' +
'section.gallery figure {overflow:visible !important;}' + // needed for hover effect
'section.gallery {overflow:visible !important;}' /* +
'center.flow.nodesc span, center.flow.nodesc small {display:none !important}'*/ // hack because we need to set overflow:visible*/
);
function getGalleryCss(size) {
return '' +
'section.gallery figure {width:' + (size + 10) + 'px !important;}' +
'section.gallery.s-200 figure {height:' + (size + 10) + 'px !important;}' +
'form.messages-form section.messagecenter.nodesc.s-200 figure {height:' + (size + 30) + 'px !important;}' +
'section.gallery u {height:' + (size + 10) + 'px !important;}' +
/*'center.flow.with-titles-usernames b {height:' + (size + 54) + 'px !important;}' +
'center.flow.with-titles b {height:' + (size + 40) + 'px !important;}' +*/
//'section.gallery.with-checkboxes figure {height:' + (size + 76) + 'px !important;}' + //76
'section.gallery img {width: auto !important;height: auto !important;max-width:' + size + 'px !important;max-height:' + size + 'px !important;}'; //Thumnail Size
}
//window.addEventListener('DOMContentLoaded', function(e) {
//while (document.getElementsByClassName('cat')[0] == null)
//{
//
//}
/*document.addEventListener("DOMContentLoaded", function(event)
{
console.log("Replacing Images");
for(var i=0; i<image_elements.length; i++) {
var image_element = image_elements[i];
if( image_element.src.search("/poetry/") == -1 && image_element.src.search("/music/") == -1 && image_element.src.search("/stories/") == -1 && image_element.src.search(".swf") == -1 ) {
image_element.src = image_element.src.replace("@200","@" + thumbSize);
image_element.src = image_element.src.replace("@300","@" + thumbSize);
}
}
}
});*/
document.addEventListener("DOMContentLoaded", ReplaceImages);
function ReplaceImages()
{
console.log("DOM Content Trigger");
image_elements = document.getElementsByTagName('img');
for(var i=0; i<image_elements.length; i++) {
var image_element = image_elements[i];
if( image_element.src.search("/poetry/") == -1 && image_element.src.search("/music/") == -1 && image_element.src.search("/stories/") == -1 && image_element.src.search(".swf") == -1 ) {
image_element.src = image_element.src.replace("@200","@" + thumbSize);
image_element.src = image_element.src.replace("@300","@" + thumbSize);
image_element.src = image_element.src.replace("@400","@" + thumbSize);
}
}
document.removeEventListener("DOMContentLoaded", ReplaceImages);
}
})();