Last active
January 6, 2016 10:19
-
-
Save jamosaur/d9b147d661fe341ca3d3 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 Images to Links | |
// @namespace http://www.github.com/jaaaaaaaaaam | |
// @description Changes images to links of themselves if they do not have a parent <a> tag | |
// @include http://* | |
// @include https://* | |
// @require https://code.jquery.com/jquery-1.11.3.min.js | |
// @grant none | |
// ==/UserScript== | |
$('img').each(function () { | |
if(!$(this).parent().is('a')){ | |
$(this).wrap(function () { | |
return "<a href='"+$(this).attr('src')+"' target='_blank'></a>"; | |
}) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment