KissThumbnails

Adds Thumbnails to diverse Kiss sites lists and bookmarks

  1. // ==UserScript==
  2. // @name KissThumbnails
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.14
  5. // @description Adds Thumbnails to diverse Kiss sites lists and bookmarks
  6. // @author lolamtisch@gmail.com
  7. // @license Creative Commons; http://creativecommons.org/licenses/by/4.0/
  8.  
  9. // @run-at document-start
  10.  
  11. // @match *://kissanime.ru/BookmarkList*
  12. // @match *://kissanime.ru/AnimeList*
  13. // @match *://kissanime.ru/Genre*
  14. // @match *://kissanime.ru/Status*
  15. // @match *://kissanime.ru/Search*
  16.  
  17. // @match *://kissmanga.com/BookmarkList*
  18. // @match *://kissmanga.com/MangaList*
  19. // @match *://kissmanga.com/Genre*
  20. // @match *://kissmanga.com/Status*
  21. // @match *://kissmanga.com/Search*
  22.  
  23. // @match *://readcomiconline.to/BookmarkList*
  24. // @match *://readcomiconline.to/ComicList*
  25. // @match *://readcomiconline.to/Genre*
  26. // @match *://readcomiconline.to/Status*
  27. // @match *://readcomiconline.to/Search*
  28.  
  29. // @match *://kisscartoon.se/BookmarkList*
  30. // @match *://kisscartoon.se/CartoonList*
  31. // @match *://kisscartoon.se/Genre*
  32. // @match *://kisscartoon.se/Status*
  33. // @match *://kisscartoon.se/Search*
  34.  
  35. // @grant GM_addStyle
  36. // ==/UserScript==
  37.  
  38. (function(funcName, baseObj) {
  39. funcName = funcName || "docReady";
  40. baseObj = baseObj || window;
  41. var readyList = [];
  42. var readyFired = false;
  43. var readyEventHandlersInstalled = false;
  44.  
  45. function ready() {
  46. if (!readyFired) {
  47. readyFired = true;
  48. for (var i = 0; i < readyList.length; i++) {
  49. readyList[i].fn.call(window, readyList[i].ctx);
  50. }
  51. readyList = [];
  52. }
  53. }
  54.  
  55. function readyStateChange() {
  56. if ( document.readyState === "complete" ) {
  57. ready();
  58. }
  59. }
  60.  
  61. baseObj[funcName] = function(callback, context) {
  62. if (typeof callback !== "function") {
  63. throw new TypeError("callback for docReady(fn) must be a function");
  64. }
  65. if (readyFired) {
  66. setTimeout(function() {callback(context);}, 1);
  67. return;
  68. } else {
  69. readyList.push({fn: callback, ctx: context});
  70. }
  71. if (document.readyState === "complete") {
  72. setTimeout(ready, 1);
  73. } else if (!readyEventHandlersInstalled) {
  74. if (document.addEventListener) {
  75. document.addEventListener("DOMContentLoaded", ready, false);
  76. window.addEventListener("load", ready, false);
  77. } else {
  78. document.attachEvent("onreadystatechange", readyStateChange);
  79. window.attachEvent("onload", ready);
  80. }
  81. readyEventHandlersInstalled = true;
  82. }
  83. }
  84. })("docReady", window);
  85.  
  86. GM_addStyle(".listing tr td:nth-child(1){height: 150px;}");
  87.  
  88. docReady(function() {
  89. (function() {
  90. 'use strict';
  91. $( document ).ready(function() {
  92. if($('.listing tr td').css('vertical-align') != 'top'){
  93. $(".head").prepend("<th style='width:120px'></th>");
  94. $( ".listing tr td:nth-child(1)" ).css("height","150px");
  95. $( ".listing tr td:nth-child(1)" ).before("<td></td>");
  96. var i=0;
  97. $( ".listing tr td:nth-child(2)" ).bind('inview', function (event, visible) {
  98. if ($(this).parent("tr").css("display") != "none"){
  99. if (visible === true) {
  100. $(this).tooltip().show();
  101. $('.tooltip').css('cssText','opacity: 0 !important');
  102. var title = $(".tooltip").last().find("img")[0].outerHTML;
  103. $(this).prev().append(title);
  104. $(this).tooltip().hide();
  105. $(this).unbind('inview');
  106. i++;
  107. }
  108. }
  109. });
  110. $(window).scroll();
  111. }
  112. });
  113. })();
  114. /**
  115. * External Script
  116. * author Remy Sharp
  117. * url http://remysharp.com/2009/01/26/element-in-view-event-plugin/
  118. */
  119. (function ($) {
  120. function getViewportHeight() {
  121. var height = window.innerHeight; // Safari, Opera
  122. var mode = document.compatMode;
  123. if ( (mode || !$.support.boxModel) ) { // IE, Gecko
  124. height = (mode == 'CSS1Compat') ?
  125. document.documentElement.clientHeight : // Standards
  126. document.body.clientHeight; // Quirks
  127. }
  128. return height;
  129. }
  130. $(window).scroll(function () {
  131. var vpH = getViewportHeight() + 500,
  132. scrolltop = (document.documentElement.scrollTop ?
  133. document.documentElement.scrollTop :
  134. document.body.scrollTop),
  135. elems = [];
  136. // naughty, but this is how it knows which elements to check for
  137. $.each($.cache, function () {
  138. if (this.events && this.events.inview) {
  139. elems.push(this.handle.elem);
  140. }
  141. });
  142. if (elems.length) {
  143. $(elems).each(function () {
  144. var $el = $(this),
  145. top = $el.offset().top,
  146. height = $el.height(),
  147. inview = $el.data('inview') || false;
  148. if (scrolltop > (top + height) || scrolltop + vpH < top) {
  149. if (inview) {
  150. $el.data('inview', false);
  151. $el.trigger('inview', [ false ]);
  152. }
  153. } else if (scrolltop < (top + height)) {
  154. if (!inview) {
  155. $el.data('inview', true);
  156. $el.trigger('inview', [ true ]);
  157. }
  158. }
  159. });
  160. }
  161. });
  162. // kick the event to pick up any elements already in view.
  163. // note however, this only works if the plugin is included after the elements are bound to 'inview'
  164. $(function () {
  165. $(window).scroll();
  166. });
  167. })(jQuery);
  168. });