Sleazy Fork is available in English.

Erome.com Improved

Infinite scroll. Filter photo albums. Show/hide photos in albums.

ของเมื่อวันที่ 30-04-2024 ดู เวอร์ชันล่าสุด

  1. // ==UserScript==
  2. // @name Erome.com Improved
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.7
  5. // @license MIT
  6. // @description Infinite scroll. Filter photo albums. Show/hide photos in albums.
  7. // @author smartacephale
  8. // @match *://*.erome.com/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=erome.com
  10. // @run-at document-end
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. setTimeout(() => {
  15. const annoyingGarbage = document.querySelector('.enter');
  16. if (annoyingGarbage) annoyingGarbage.click();
  17. }, 500);
  18.  
  19. const LOGO = `
  20. ⡝⣝⢝⢝⢝⢝⢝⢝⢍⠭⡩⢍⠭⡩⡍⡭⢍⠭⡍⡭⡙⡍⢏⢝⠩⡩⡋⡍⡏⡝⡝⡽⡹⡹⡹⡙⡝⡙⡝⢍⠭⡩⢍⠭⡩⡩⡩⡩⡩⡍⡭⡩⡍⣍⢫⡩⡹⡩⡹⡩
  21. ⡱⡱⡕⡇⣏⢎⢮⣪⢪⡪⣪⢪⡪⣪⢪⡪⣪⡪⡪⡢⡣⢪⢢⡣⡑⢌⠆⡪⡪⡪⡚⡜⢜⢸⠨⡊⡎⢎⢮⢣⠯⢮⠳⡝⡼⡪⢮⢣⠳⡕⠵⡕⠧⡳⢕⠧⡫⠮⡳⡹
  22. ⢕⢝⡜⡎⣎⢧⢓⢎⠇⠕⢅⠣⡩⡘⡌⡎⡆⢇⠕⡕⢅⢇⢷⢱⢘⢔⢅⢇⢕⢅⠇⡪⢨⢂⠣⡱⡘⢜⢌⢎⢎⠢⡃⠕⡌⢌⢢⠡⡱⢘⠌⡢⢃⢊⢢⢑⢌⢊⢆⠪
  23. ⢳⢱⢕⢝⢜⢜⢎⢇⢇⠣⡡⢱⢐⢅⢇⠎⢜⠰⡑⡜⢜⠜⡜⡜⡌⡺⡵⡣⢣⢑⢌⠢⡑⡐⡑⠔⢅⠣⡊⡆⢇⡳⡘⢌⠌⢆⠆⡃⡊⡢⡑⢌⠢⡑⢅⠆⡕⢌⢢⠱
  24. ⡱⡣⡳⡹⡸⡱⡕⣕⢅⠕⢌⢆⢇⠣⢅⠣⡑⢅⢊⠌⡢⡑⡕⡕⡧⡣⣏⠎⢜⠰⡐⡡⠂⢌⠢⢑⠅⢕⢑⠜⡌⡎⢎⢇⢕⢑⢌⠪⡐⡌⢌⠆⡣⢡⠱⡨⡂⡣⠪⡘
  25. ⡝⣜⢕⢝⡜⣕⢕⢕⢢⢑⢕⠜⡌⢎⠪⡨⠨⢂⠢⠨⡐⢌⠆⡇⡯⣺⠸⡈⢎⢪⢐⢐⠡⠡⡈⠢⠡⡑⢌⢪⢘⢌⢎⢎⢎⢆⠥⡑⡌⡌⠆⢕⢌⠢⡑⢔⢌⢪⢘⢌
  26. ⢪⢎⢮⢣⡣⡇⡗⡝⢔⢅⢇⢕⢑⢅⠕⠌⢌⠢⠨⢂⠪⡐⢕⢕⢝⢜⠅⡊⢜⢔⢕⢐⢅⢑⠨⡈⡊⢌⢢⢑⢅⢣⠪⡢⡣⡳⡹⡸⡲⣘⢌⠢⡂⡣⢊⠢⡱⢨⠢⡱
  27. ⡣⡳⣱⢣⡣⡳⣱⢹⠸⡰⡑⡌⣊⠢⡡⠃⠅⠌⢌⢂⠕⢌⢪⢢⢣⡓⡨⠨⡸⡸⡐⢅⠢⡂⠕⡐⢌⠢⡑⢌⢆⢣⠱⡑⡕⡕⡵⡱⡱⡱⡕⣕⡑⢌⠢⡱⡘⠔⡅⢕
  28. ⢎⢧⢳⡱⡕⣝⢜⢜⢜⢔⠱⡨⠢⡑⢌⠌⡊⢌⢂⠢⡡⡑⡱⢸⢸⡐⠌⠌⢜⠔⢅⠅⢕⠨⠨⡂⢅⢊⢌⠢⡱⡘⢜⢸⢸⢸⢸⡪⡪⡎⣎⢎⢮⢐⠡⢂⠪⡨⠢⡡
  29. ⢫⡪⣣⢣⡫⡪⡎⡇⡇⢎⢪⠨⡊⡌⡢⢑⠨⡐⡐⡡⢂⠪⠨⡊⡆⡇⠌⠌⡆⡣⢡⠡⡑⢌⢊⠔⠡⡂⢆⠣⡪⢸⢘⠬⡒⡕⡵⡱⣣⢣⢇⢗⡕⢔⠡⡡⡑⢌⠪⡰
  30. ⣕⢝⡜⣎⢞⢜⢎⢎⢎⠪⡢⢱⠨⡂⡪⢐⠡⢂⢊⠄⢕⠨⢊⠢⡑⢮⢨⢨⢢⢑⠅⡊⢔⠡⢂⠪⡨⢌⠢⡃⢎⢪⠸⡸⡸⡸⡸⣕⢕⢧⡫⡇⡇⢕⠨⣂⢪⢂⢇⢎
  31. ⡎⡧⡳⡱⣕⢝⢎⢇⢇⢣⠪⡢⡃⡪⢂⠕⢌⠢⠡⡊⢔⠡⡡⡑⢕⢕⢵⡱⣑⢢⠱⠨⡂⢅⢅⠕⡐⢅⠕⡜⡸⡨⡪⡪⡪⡪⡳⣕⢝⡵⣝⢜⢬⢲⢹⢸⢜⣞⢜⢕
  32. ⡮⣚⢎⢧⡣⣫⢺⢸⢸⠰⡱⡨⢢⢑⢅⠪⡂⢕⢑⠌⡢⢑⠰⡘⢔⢱⢱⡣⡪⢢⢃⢇⠪⠢⡑⢌⢊⢆⠣⡊⡆⢇⢎⢆⢇⢗⢽⢜⡵⡝⣜⢜⡜⡜⡜⡜⣝⢜⢜⢌
  33. ⣞⢜⡕⣇⢏⢮⢺⢸⢸⢸⠰⡡⢣⢑⢌⢪⠨⡢⠢⡑⡌⡢⠣⡑⢕⢱⠱⡕⡕⢕⠱⡐⢕⢑⢅⠕⢅⠆⡇⡣⡱⡱⡱⡱⡱⣝⢕⢧⡳⡱⢕⢗⢕⢵⡱⡣⡣⣣⢣⢃
  34. ⡪⣇⢯⢪⢎⡗⡵⡱⡑⡕⡕⢕⢅⢕⢜⠰⡑⡌⢎⢢⠱⡘⢜⠸⡘⡜⡜⡵⡱⡱⡱⡑⢕⠱⡨⡊⡪⡸⡨⡪⡪⡊⡎⣎⢞⣎⢗⡵⣳⢕⡝⡜⡕⡕⡜⡜⡵⣳⢣⡳
  35. ⢽⡸⣪⢳⢕⢽⢜⢜⢌⢎⢎⢎⢆⢣⢊⢎⠜⡌⢆⢕⢱⠸⡘⡜⡜⡜⡜⡵⡣⡣⡪⡪⢪⠪⡢⢣⢱⢸⢘⢌⢎⢎⢎⢮⡳⡵⣝⡾⣵⢝⣮⣺⡸⡜⡜⣎⢞⡵⡫⣫
  36. ⡞⡮⡮⡳⣝⢮⢳⠱⡑⢕⢱⢱⢱⢑⢅⢇⢕⠕⡕⡅⡇⡇⡇⡇⡇⡇⡗⣝⡎⡎⡎⡎⡎⡎⢎⢎⢪⢪⢪⢪⡪⣪⢳⢝⡽⣝⣗⢿⣕⡝⣞⣞⢾⢽⣺⢺⢽⡪⡣⡣
  37. ⢏⢇⢏⢎⢎⠪⡂⢇⢃⢣⠱⡸⡸⡸⡸⡸⡸⡸⡸⡸⡸⡸⡸⡸⡸⡜⡎⣞⢎⢮⢪⢪⢪⢪⢪⢪⢪⡪⡪⡣⣣⢣⢏⣗⢽⢜⣮⡳⣕⢝⢎⢮⢪⢳⢸⢪⡳⣝⣞⣮
  38. ⠔⡅⢕⢅⢣⠱⡸⢨⢪⠢⡣⢢⢪⢪⢪⠪⡪⠸⡘⢜⢜⢜⡜⡎⡮⡪⡺⡸⡕⡇⡗⡕⣕⢵⢱⢣⡣⡇⡯⡺⡸⣪⡳⢕⢝⢜⢔⢕⢕⢣⢳⢱⢱⢱⢱⠱⣹⡪⡎⡎
  39. ⡑⢌⠢⠢⡑⢌⢌⡢⡡⣃⠪⠪⡘⡜⢌⠪⡨⢊⠜⡨⡊⡧⡳⣝⢼⣪⡳⡭⣳⡹⡸⡜⡜⣜⢜⢕⡕⣝⢜⢎⢧⢳⡱⡱⡑⡕⢕⠕⡕⢕⢕⢕⢕⢕⢅⢇⢇⢯⢪⠨
  40. ⡪⡢⠣⢣⢡⡑⡔⡑⢍⢆⠇⡏⢎⠌⠆⢕⠨⡐⠌⡢⢱⢹⢝⡾⣽⣺⢮⡫⣞⠎⡎⡪⢪⠢⡣⡳⣹⢜⡵⣹⣪⢳⡑⢅⠕⡜⡰⢑⠜⢌⢊⠢⡑⢅⠣⡑⢅⠣⡑⠕
  41. ⢕⠬⡩⠪⡒⡜⡬⡪⡜⡔⡥⡣⡣⣑⢅⢅⢂⢂⠑⢌⠪⡪⡯⣞⣞⢮⡻⣾⢑⠕⢅⠣⡑⢕⢱⢱⢱⣻⣺⡵⣳⣇⢧⢣⠣⣊⢢⠱⡘⡔⢕⠱⡘⣌⢎⢌⠆⡇⡣⠣
  42. ⣷⣵⣮⣧⣧⣷⣾⣾⣾⣯⣯⣯⣯⣷⣿⣾⣷⣷⣵⣶⣵⣵⣿⣾⣾⣷⣯⣿⣼⣼⣼⣼⣼⣼⣶⣷⣿⣽⣾⣿⣷⣷⣷⣯⣷⣾⣾⣾⣾⣾⣾⣾⣾⣮⣾⣶⣵⣵⣮⣷`;
  43. console.log(LOGO);
  44.  
  45. function togglePhotoElements(){
  46. Array.from(document.querySelectorAll('.media-group')).forEach(a => {
  47. if (!a.querySelector('.video')) {
  48. $(a.parentElement).toggle(config.showPhotos);
  49. }
  50. });
  51. $('#togglePhotos').css('backgroundColor', !config.showPhotos ? '#eb6395' : '#a09f9d');
  52. }
  53.  
  54. function hidePhotoOnlyAlbums() {
  55. const albumsContainers = document.querySelectorAll('#albums');
  56. albumsContainers.forEach(a => {
  57. Array.from(a.children).forEach(a => {
  58. if (!a.querySelector('.album-videos')) {
  59. $(a).toggle(config.showPhotoAlbums);
  60. }
  61. });
  62. });
  63. $('#togglePhotoAlbums').css('color', !config.showPhotoAlbums ? '#eb6395' : '#a09f9d');
  64. }
  65.  
  66. function infiniteScrollAndLazyLoading() {
  67. // taken from index.html of erome mobile version
  68. const url = new URL(window.location.href);
  69. let next_page = parseInt(url.searchParams.get('page')) || 2;
  70. const limit = parseInt($('.pagination li:last-child()').prev().text()) || 50;
  71.  
  72. var infinite = $('#page').infiniteScroll({
  73. path: function() {
  74. url.searchParams.set('page', next_page);
  75. console.log(url.href);
  76. return url.href;
  77. },
  78. append: '.page-content',
  79. scrollThreshold: 800
  80. });
  81.  
  82. $('#page').on('append.infiniteScroll', function(event, body, path, items, response) {
  83. hidePhotoOnlyAlbums();
  84. new LazyLoad();
  85. scrollFix();
  86. next_page++;
  87. if(next_page > limit){
  88. infinite.destroy();
  89. }
  90. });
  91. }
  92.  
  93. function scrollFix() {
  94. setTimeout(() => window.dispatchEvent(new Event('scroll')), 1000);
  95. }
  96.  
  97. const DEFAULT_CONFIG = {
  98. showPhotos: false,
  99. showPhotoAlbums: false
  100. };
  101.  
  102. let config = DEFAULT_CONFIG;
  103.  
  104. const IS_ALBUM_PAGE = /^\/a\//.test(window.location.pathname);
  105.  
  106. function sync() {
  107. const stored = localStorage.getItem("config");
  108. config = JSON.parse(stored) || DEFAULT_CONFIG;
  109. }
  110.  
  111. function save() {
  112. localStorage.setItem("config", JSON.stringify(config));
  113. }
  114.  
  115. function pageAction() {
  116. sync();
  117. if (IS_ALBUM_PAGE) {
  118. togglePhotoElements();
  119. } else {
  120. hidePhotoOnlyAlbums();
  121. }
  122. }
  123.  
  124. window.addEventListener('focus', pageAction);
  125.  
  126. (function() {
  127. 'use strict';
  128.  
  129. if (IS_ALBUM_PAGE) {
  130. $('#user_name').parent().append('<button id="togglePhotos" class="btn btn-pink">show/hide photos</button>');
  131. $('#togglePhotos').on('click', () => {
  132. config.showPhotos = !config.showPhotos;
  133. togglePhotoElements();
  134. save();
  135. });
  136. } else {
  137. infiniteScrollAndLazyLoading();
  138. $('.navbar-nav').append('<li><a href="#" id="togglePhotoAlbums">video only</span></a></li>');
  139. $('#togglePhotoAlbums').on('click', () => {
  140. config.showPhotoAlbums = !config.showPhotoAlbums;
  141. hidePhotoOnlyAlbums();
  142. save();
  143. });
  144. }
  145.  
  146. pageAction();
  147. scrollFix();
  148. })();