Created
April 27, 2009 22:27
-
-
Save lackac/102783 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Piacter improvements | |
// @namespace http://lackac.hu | |
// @description Normalisabb kepkezeles piacteren | |
// @include http://piacter.bikemag.hu/showproduct.php* | |
// ==/UserScript== | |
var GM_jQuery = document.createElement('script'); | |
GM_jQuery.src = 'http://jquery.com/src/jquery-latest.js'; | |
GM_jQuery.type = 'text/javascript'; | |
document.getElementsByTagName('head')[0].appendChild(GM_jQuery); | |
var GM_lightBox_js = document.createElement('script'); | |
GM_lightBox_js.src = 'http://sehol.se/lightbox/lightbox.js'; | |
GM_lightBox_js.type = 'text/javascript'; | |
document.getElementsByTagName('head')[0].appendChild(GM_lightBox_js); | |
var GM_lightBox_css = document.createElement('link'); | |
GM_lightBox_css.rel = "stylesheet" | |
GM_lightBox_css.href = 'http://sehol.se/lightbox/lightbox.css'; | |
GM_lightBox_css.type = 'text/css'; | |
document.getElementsByTagName('head')[0].appendChild(GM_lightBox_css); | |
(function() { | |
if (unsafeWindow.jQuery === undefined || unsafeWindow.jQuery.fn.lightBox === undefined) { | |
window.setTimeout(arguments.callee, 100); | |
} else { | |
init(unsafeWindow.jQuery) | |
} | |
})(); | |
function init($) { | |
$('td.small').find('a:first img').each(function() { | |
var src = $(this).attr('src'); | |
var newLink = $('<a href="'+src.replace('/thumbs', '/large')+'" class="bike-image"><img src="'+src.replace('/thumbs', '')+'"/></a>'); | |
$(this).parents('td.small:first').html('').append(newLink); | |
}); | |
$('a.bike-image').lightBox(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment