-
-
Save nrkn/bbf0ead51c2389a84ab411e4b924d3b4 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
$(document).ready(function () { | |
var galleryCheck = $("div.gallery_sef").length; | |
if( !galleryCheck ) return; | |
var extensions = ["_pico.", "_icon.", "_thumb.", "_small.", "_compact.", "_medium.", "_large.", "_grande.", "_1024x1024.", "_2048x2048." ]; | |
$("div.gallery_sef img").each(function(){ | |
var $img = $(this); | |
var src = $img.attr('src'); | |
var title = $img.attr('title'); | |
var newSRC; | |
for ( var i = 0; i < extensions.length; i++ ){ | |
newSRC = src.replace( extensions[i] ,'.'); | |
if (newSRC.length<src.length) break; | |
} | |
$(this).wrap( '<a href="' + newSRC + '" data-lightbox="gallery" data-title="' + title + '" rel="nofollow"></a>'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment