Sleazy Fork is available in English.

motherless-gallery

View search results, favorites, groups and more in a gallery

  1. // ==UserScript==
  2. // @name motherless-gallery
  3. // @version 1.0.1.9u
  4. // @description View search results, favorites, groups and more in a gallery
  5. // @author Madagambada
  6. // @namespace https://github.com/Madagambada
  7. // @require https://code.jquery.com/jquery-3.5.1.min.js
  8. // @require https://unpkg.com/nanogallery2/dist/jquery.nanogallery2.min.js
  9. // @resource css https://unpkg.com/nanogallery2/dist/css/nanogallery2.min.css
  10. // @resource font https://raw.githubusercontent.com/nanostudio-org/nanogallery2/master/src/css/nanogallery2.woff.css
  11. // @match https://motherless.com/term/images/*
  12. // @match https://motherless.com/images/*
  13. // @match https://motherless.com/live/images
  14. // @match https://motherless.com/gi/*
  15. // @match https://motherless.com/GI*
  16. // @match https://motherless.com/porn/*/images*
  17. // @match https://motherless.com/f/*/images*
  18. // @match https://motherless.com/u/*t=i
  19. // @match https://motherless.com/term/videos/*
  20. // @match https://motherless.com/videos/*
  21. // @match https://motherless.com/live/videos
  22. // @match https://motherless.com/gv/*
  23. // @match https://motherless.com/GV*
  24. // @match https://motherless.com/porn/*/videos*
  25. // @match https://motherless.com/f/*/videos*
  26. // @match https://motherless.com/u/*t=v
  27. // @match https://motherless.com/GM*
  28. // @match https://motherless.com/u/*t=a
  29. // @grant GM_addStyle
  30. // @grant GM_getResourceText
  31. // ==/UserScript==
  32.  
  33. // pre init
  34. var final = [];
  35. var tumb = [];
  36. var data_url = [];
  37. var title = [];
  38. var galleryload = 0;
  39. var NP = $("a[rel*='next']").attr('href');
  40. var PP = $("a[rel*='prev']").attr('href');
  41. // set hock on the page
  42. $("div[class*='content-inner']").prepend('<div id="gallery_hook"></div>');
  43.  
  44. (function() {
  45. document.addEventListener('keydown', function(e) {
  46. if (e.keyCode == 96 && galleryload == 0) {
  47. //init
  48. GM_addStyle(GM_getResourceText("css"));
  49. GM_addStyle(GM_getResourceText("font"));
  50. galleryload = 1;
  51. //https://forums.digitalpoint.com/threads/how-to-store-all-img-tags-in-one-array-using-jquery.2547757/
  52. var imagesArray = $("img[class*='static']").map(function() {
  53. return $(this).attr('data-strip-src');
  54. }).get();
  55. //filter
  56. imagesArray = jQuery.grep(imagesArray, function(item) {
  57. return item.match(/cdn5-thumbs.motherlessmedia.com\/thumbs\//g) != null;
  58. });
  59. for (var i = 0; i < imagesArray.length; i++) {
  60. tumb[i] = imagesArray[i];
  61. imagesArray[i] = imagesArray[i].replace('?from_helper', '');
  62. for (var u = 0; u < 2; u++) {
  63. imagesArray[i] = imagesArray[i].replace('thumbs', 'images');
  64. }
  65. title[i] = imagesArray[i];
  66. if (imagesArray[i].includes("strip", 31)) {
  67. tumb[i] = tumb[i].replace('strip', 'small');
  68. imagesArray[i] = imagesArray[i].replace('-strip.jpg', '.mp4');
  69. for (var o = 0; o < 2; o++) {
  70. imagesArray[i] = imagesArray[i].replace('images', 'videos');
  71. //console.log(imagesArray[i]);
  72. }
  73. }
  74. data_url[i] = imagesArray[i];
  75. var tamplate1 = "<a rel='noopener noreferrer' target='_blank' href='";
  76. var tamplate2 = "'>open site in new tab</a>";
  77.  
  78. title[i] = title[i].replace('cdn5-images.motherlessmedia.com/images', 'motherless.com');
  79. title[i] = tamplate1 + title[i].substring(0, title[i].length - 4) + tamplate2;
  80. }
  81. for (var p = 0; p < imagesArray.length; p++) {
  82. final.push({
  83. src: data_url[p],
  84. srct: tumb[p],
  85. title: title[p]
  86. });
  87. }
  88.  
  89. //https://nanogallery2.nanostudio.org/
  90. jQuery("#gallery_hook").nanogallery2({
  91. // ### gallery settings ###
  92. thumbnailHeight: 150,
  93. thumbnailWidth: 150,
  94. allowHTMLinData: true,
  95. viewerGallery: "none",
  96. viewerTools: {
  97. topRight: 'label, rotateLeft, rotateRight, fullscreenButton, closeButton'
  98. },
  99. thumbnailLabel: {
  100. "display": false
  101. },
  102. // ### gallery content ###
  103. items: final
  104. });
  105. }
  106. }, false);
  107. })();
  108.  
  109. (function() {
  110. document.addEventListener('keydown', function(e) {
  111. if (e.keyCode == 99) {
  112. if (window.location.href.indexOf("/live/") != -1) {
  113. location.reload();
  114. }
  115. if ($("a[rel*='next']").length) {
  116. window.location = NP;
  117. }
  118. } else if (e.keyCode == 97) {
  119. if (window.location.href.indexOf("/live/") != -1) {
  120. location.reload();
  121. }
  122. if ($("a[rel*='prev']").length) {
  123. window.location = PP;
  124. }
  125. } else if (e.keyCode == 98 && galleryload == 1) {
  126. if (window.location.href.search("#nanogallery/gallery_hook/0/") > 1) {
  127. $('#gallery_hook').nanogallery2('closeViewer');
  128. }
  129. $('#gallery_hook').nanogallery2('displayItem', '0/1');
  130. }
  131. }, false);
  132. })();