Last active
November 15, 2021 07:35
-
-
Save debloper/a5a7999ddbc594a882a4 to your computer and use it in GitHub Desktop.
Unlock NSFW without logging in
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
// Remap $ to jQuery object | |
var $ = jQuery; | |
// The real fun begins... first catch all the post-anchors & loop on them | |
$(document).on("scroll", function () { | |
// Let's declare some reusable globals for the next iterations | |
var urlBase = "http://img-9gag-lol.9cache.com/photo/"; | |
$(".badge-evt.badge-nsfw-entry-cover").each(function () { | |
// Remove the NSFW class, to avoid redundant processing | |
$(this).removeClass("badge-nsfw-entry-cover"); | |
// Find out the ID of the post | |
var id = $(this).parent().parent().data("entryId"); | |
// Hence the best-guess image URL is: | |
var imgUrl = urlBase + id + "_460s.jpg"; | |
// Time to inject an image element with source as the formed URL | |
$(this).html("<img src=" + imgUrl + " />"); | |
// On click, open the image as GIF in a new tab | |
// Do so blindly, as there's no definitive way to be sure | |
$(this).attr("href", imgUrl.split("460s").join("460sa").split(".jpg")[0] + ".gif"); | |
$(this).attr("target", "_blank"); | |
}); | |
}); | |
// TODO: find a way to handle image versions |
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
// Read the video ID: | |
var query = location.search // Read query param(s) | |
, vid = query.split("v=")[1] // Get the video ID | |
, id = query.split("&")[0]; // If multiple query params are present, chuck them | |
// Whip the browser to haul its ass over to this location | |
location.assign("http://youtube.com/v/" + id); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
howto use this JS file?