Advertisement
Guest User

Untitled

a guest
Sep 17th, 2014
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        Srunkoscript
  3. // @namespace   1chan
  4. // @include     http://*1chan.ru/*
  5. // @include     http://1chan.inach.org/*
  6. // @include     http://*1chan.ca/*
  7. // @version     1.1
  8. // ==/UserScript==
  9.  
  10.  
  11. //Подключение
  12. var $ = unsafeWindow.jQuery;
  13.  
  14. var hiddens = localStorage['hiddens'];
  15. if (hiddens) {
  16.     var toHideArr = hiddens.split(',');
  17. }
  18. else {
  19.     var toHideArr = [];
  20. }
  21.  
  22. var going;
  23. var fadetimer;
  24.  
  25.  
  26. //Кнопки скрытия
  27. var images = $("img[src*='rghost.ru']");
  28. $(images).parent().after("<span class='shithide' style='position: absolute; opacity: 0; cursor: pointer; vertical-align: top; text-decoration: none; color: #777; margin-left: 4px;'><img src='http://1chan.ru/ico/delete.gif' title='Скрыть говно'/></span>");
  29. $(images).on({
  30.     "mouseenter" : function(){
  31.         if (fadetimer) window.clearTimeout(fadetimer);
  32.         $(this).parent().next().css("opacity", "1");
  33.     },
  34.     "mouseleave" : function(){
  35.         var thisImg = $(this);
  36.         fadetimer = window.setTimeout(function(){
  37.             $(thisImg).parent().next().css("opacity", "0");
  38.         }, 500);
  39.     }
  40. });
  41.  
  42. $(".shithide").on({
  43.     "mouseenter" : function(){
  44.         if (fadetimer) window.clearTimeout(fadetimer);
  45.         $(this).css("opacity", "1");
  46.     },
  47.     "mouseleave" : function(){
  48.         $(this).css("opacity", "0");
  49.     },
  50.     "click" : function(){
  51.         var imgID = ($(this).prev().children().attr('src')).split('/');
  52.         toHideArr.push(imgID[3]);
  53.         localStorage['hiddens'] = toHideArr;
  54.     }
  55. });
  56.  
  57. //Кнопка сброса, глаз Хуечичи
  58. var reset = $(document.createElement("div"))
  59.     .attr("id", "Eye")
  60.     .css({"position" : "absolute", "left" : "344px", "top" : "60px", "width" : "20px", "height" : "20px"})
  61.     .append($("<div id='subEye' style='display: none; background: #FFFFFF; border-radius: 50%; width: 100%; height: 100%;'></div>"))
  62.     .appendTo(".b-header-block")
  63.     .click(function(){
  64.         $("#subEye").fadeIn(100).fadeOut(500);
  65.         hideShit(1);
  66.         toHideArr = [];
  67.         localStorage.removeItem('hiddens');
  68. });
  69.  
  70. //Glistooh death
  71. function hideShit(mode) { //0 - Скрыть, 1 - Показать
  72.     for (var i = 0; i < toHideArr.length; ++i) {
  73.         var shit = $("img[src*='"+toHideArr[i]+"']").parent().parent().parent().parent();
  74.         var display = $(shit).css("display");
  75.         if (mode == 1) {
  76.             $(shit).slideDown(400);
  77.         } else {
  78.             $(shit).slideUp(200);
  79.         }
  80.     }
  81. }
  82.  
  83. //Автообновление страницы при новых постах
  84. function pageRefresh() {
  85.     if (($("#post_notify").css('display') == "block") && (going != true)) {
  86.         going = true;
  87.         document.location.href = window.location;
  88.     }
  89. }
  90.  
  91. //Повторяющаяся функция
  92. setInterval(function() {
  93.     hideShit(0);
  94.     pageRefresh();
  95. }, 500); //Интервал скрытия
  96.  
  97. //Святой жопы калчок, аминь!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement