Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name 9gag NSFW SWEDISH VERSION
- // @namespace 9gag.com
- // @include http://9gag.com/gag/*
- // @exclude http://9gag.com/hot
- // @exclude http://9gag.com/gif
- // @include http://9gag.com/*
- // @version 2
- // @run-at document-end
- // @grant none
- // ==/UserScript==
- function gagNsfw(gagDiv){
- gagDiv.children().remove();
- var href = gagDiv.parent().attr('href');
- href = href.substr(href.lastIndexOf('/') + 1);
- var img = $('<img class="badge-item-img" src="http://img-9gag-lol.9cache.com/photo/'+ href +'_460sa.jpg">');
- img.load(function(){
- $(this).attr('style',"height:"+$(this).height()+"px;"+"width:"+$(this).width()+"px;");
- $(this).parent().attr('style',"min-height:"+$(this).height()+"px;"+"width:"+$(this).width()+"px;");
- });
- img.click(function() {return false;});
- img.appendTo(gagDiv);
- }
- this.$=this.jQuery=jQuery.noConflict(true);
- var allNsfw = $($('.nsfw-post'));
- for (i = 0; i < allNsfw.length; i++) {
- gagNsfw($(allNsfw[i]));
- }
- $(".badge-entry-collection").bind('DOMNodeInserted', function(e) {
- var element = e.target;
- if(e.type == "DOMNodeInserted"){
- gagNsfw($($(element).find(".nsfw-post")[0]));
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement