Sleazy Fork is available in English.

DoubleList Enhancer

Add Image Thumbnail Previews, throttled per link @1200ms

  1. // ==UserScript==
  2. // @name DoubleList Enhancer
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Add Image Thumbnail Previews, throttled per link @1200ms
  6. // @author Technoid
  7. // @match https://doublelist.com/city/*
  8. // @icon https://www.google.com/s2/favicons?domain=doublelist.com
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. /* eslint-env jquery */
  13. (function() {
  14. 'use strict';
  15.  
  16. setTimeout(function() {
  17. let matchnum = 0
  18.  
  19. $("a.item").each(function( index ) {
  20. let a = $( this )
  21. //console.log( index + ": " + a.text() );
  22. a.parent().css("flex-wrap", "wrap")
  23. let url = a.attr("href")
  24.  
  25. //console.log("a.item " + index)
  26. //console.log(url)
  27. if (url.match(/posts/) && a.find(".orn").length > 0) {
  28. setTimeout(function() {
  29.  
  30. $.ajax({
  31. url: url,
  32. cache: true,
  33. success: function(response) {
  34. //console.log("Ajax Success")
  35. let thumbs = $(response).find(".gallery-thumbs .swiper-slide");
  36. //let result = $(response).find("#mainpic");
  37. //console.log(response); // works as expected (returns all html)
  38.  
  39. if (thumbs.length === 0) {
  40. //console.log("No Pic Found")
  41. return
  42. }
  43.  
  44. let imgdiv = $("<div style='flex-basis: 100%;'></div>")
  45. a.append(imgdiv)
  46.  
  47. thumbs.each(function(index2) {
  48. let img = $(this)
  49. let ohtml = img.prop("outerHTML")
  50.  
  51. if (!ohtml.match(/background-image/)) {
  52. //console.log("No Image Element found.")
  53. //console.log(ohtml)
  54. return;
  55. }
  56.  
  57. console.log("Pic Found - appending html : " + ohtml); // returns [object Object]
  58. let thumb = $(ohtml)
  59. thumb.css("background-size", "cover");
  60. thumb.css("background-position", "center")
  61. thumb.css("height", "60px")
  62. thumb.css("width", "60px")
  63. thumb.css("display", "inline-block")
  64. thumb.css("margin", "10px")
  65. imgdiv.append(thumb)
  66. })
  67.  
  68. },
  69. error: function(error) {
  70. console.log("Ajax Error")
  71. console.log(error)
  72. }
  73. });
  74. }, 1200 * matchnum++);
  75. } else {
  76. //console.log("Not matched posts")
  77. return
  78. }
  79.  
  80. //if (index > 3) return false;
  81.  
  82.  
  83. });
  84.  
  85. }, 1500)
  86. })();