flickr - open an amount of next pages at once

flickr - open a specific amount of next pages at once - big button to close the page with a click

当前为 2023-09-10 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name flickr - open an amount of next pages at once
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description flickr - open a specific amount of next pages at once - big button to close the page with a click
  6. // @author ClaoDD
  7. // @match https://www.flickr.com/*
  8. // @grant window.close
  9. // ==/UserScript==
  10.  
  11. var indirizzoPhotos = window.location.href;
  12.  
  13. if (!(indirizzoPhotos.includes('search'))){
  14.  
  15. if (indirizzoPhotos.includes('photos') || indirizzoPhotos.includes('group')){
  16. var divmio = document.createElement("div");
  17. divmio.style.cssText = 'position:static;width:100%;height:120px;opacity:0;z-index:100;';
  18.  
  19. var button1 = document.createElement("button");
  20. button1.innerHTML = "open the next ... pages";
  21. button1.style.position = "relative";
  22. button1.style.left = "10%";
  23.  
  24. var buttonO = document.createElement("button");
  25. buttonO.innerHTML = "Open next page";
  26. buttonO.style.backgroundColor = "#ffffff";
  27. buttonO.style.color = "#008ddf";
  28. buttonO.style.border = "2px solid";
  29. buttonO.style.width = "9%";
  30. buttonO.style.height = "330px"; // Altezza ridotta per evitare la sovrapposizione
  31. buttonO.style.position = "fixed"; // Imposta il posizionamento fisso
  32. buttonO.style.right = "10px"; // Posiziona il bottone a destra
  33. buttonO.style.bottom = "120px"; // Imposta la posizione sopra "Close this page"
  34.  
  35. var buttonClose = document.createElement("button");
  36. buttonClose.innerHTML = "Close this page";
  37. buttonClose.style.backgroundColor = "#ffffff";
  38. buttonClose.style.color = "#a18160";
  39. buttonClose.style.border = "2px solid";
  40. buttonClose.style.width = "9%";
  41. buttonClose.style.height = "330px"; // Altezza ridotta per evitare la sovrapposizione
  42. buttonClose.style.position = "fixed"; // Imposta il posizionamento fisso
  43. buttonClose.style.right = "10px"; // Posiziona il bottone a destra
  44. buttonClose.style.bottom = "460px"; // Imposta la posizione in basso
  45.  
  46. var buttonO2 = document.createElement("button");
  47. buttonO2.innerHTML = "open the next page";
  48. buttonO2.style.position = "relative";
  49. buttonO2.style.left = "20%";
  50. buttonO2.style.backgroundColor = "#ffffff";
  51. buttonO2.style.color = "#008ddf";
  52. buttonO2.style.border = "2px solid";
  53. buttonO2.style.width = "10%";
  54. buttonO2.style.height = "200px";
  55.  
  56. var buttonClose2 = document.createElement("button");
  57. buttonClose2.innerHTML = "Close this page";
  58. buttonClose2.style.backgroundColor = "#ffffff";
  59. buttonClose2.style.color = "#a18160";
  60. buttonClose2.style.border = "2px solid";
  61. buttonClose2.style.width = "36%"; //change this value for the width of the "Close this page" button
  62. buttonClose2.style.height = "200px"; //change this value for the height of the "Close this page" button
  63. buttonClose2.style.position = "relative";
  64. buttonClose2.style.left = "21%";
  65.  
  66.  
  67. var button10 = document.createElement("button");
  68. button10.innerHTML = "10";
  69. button10.style.position = "relative";
  70. button10.style.left = "11%";
  71.  
  72. document.body.appendChild(divmio);
  73. document.body.insertBefore(button1, divmio);
  74. document.body.insertBefore(button10, divmio);
  75. document.body.insertBefore(buttonO2, divmio);
  76. document.body.insertBefore(buttonClose2, divmio);
  77. document.body.insertBefore(buttonO, divmio);
  78. document.body.insertBefore(buttonClose, divmio);
  79.  
  80.  
  81.  
  82. buttonO.addEventListener("click", function() {
  83. var indirizzoPhotosB = window.location.href;
  84. if (indirizzoPhotosB.includes('page')){
  85. var indirizzo2 = window.location.href;
  86. var indirizzoDiviso2 = indirizzo2.split('page');
  87. var numCorrente2 = indirizzoDiviso2[indirizzoDiviso2.length -1];
  88. var indirizzoSenzaNum2 = indirizzoDiviso2.splice(0, (indirizzoDiviso2.length -1));
  89. window.open(indirizzoSenzaNum2 +'page'+(parseInt(numCorrente2, 10)+ 1), "_self");
  90. };
  91. if (!(indirizzoPhotosB.includes('page'))){
  92. window.open(window.location.href + 'page2', "_self");
  93. }
  94. });
  95.  
  96. buttonO2.addEventListener("click", function() {
  97. var indirizzoPhotosB = window.location.href;
  98. if (indirizzoPhotosB.includes('page')){
  99. var indirizzo2 = window.location.href;
  100. var indirizzoDiviso2 = indirizzo2.split('page');
  101. var numCorrente2 = indirizzoDiviso2[indirizzoDiviso2.length -1];
  102. var indirizzoSenzaNum2 = indirizzoDiviso2.splice(0, (indirizzoDiviso2.length -1));
  103. window.open(indirizzoSenzaNum2 +'page'+(parseInt(numCorrente2, 10)+ 1), "_self");
  104. };
  105. if (!(indirizzoPhotosB.includes('page'))){
  106. window.open(window.location.href + 'page2', "_self");
  107. }
  108. });
  109.  
  110. button1.addEventListener("click", function() {
  111. if (indirizzoPhotos.includes('page')){
  112. var indirizzo = window.location.href;
  113. var indirizzoDiviso = indirizzo.split('page');
  114. var numCorrente = indirizzoDiviso[indirizzoDiviso.length -1];
  115. var numNew = numCorrente;
  116. var indirizzoSenzaNum = indirizzoDiviso.splice(0, (indirizzoDiviso.length -1));
  117.  
  118. if (indirizzo.indexOf('page') > -1) {
  119. var numPages = prompt("how many pages to open?");
  120. var numStart = 1;
  121. while (numStart <= numPages) {
  122. window.open(indirizzoSenzaNum +'page'+(parseInt(numCorrente, 10)+numStart), "_blank");
  123. numStart = numStart + 1;
  124. }
  125. button1.innerHTML = "...opened";
  126. }
  127. }
  128. if (!(indirizzoPhotos.includes('page'))){
  129. var indirizzo = window.location.href + 'page1';
  130. var indirizzoDiviso = indirizzo.split('page');
  131. var numCorrente = indirizzoDiviso[indirizzoDiviso.length -1];
  132. var numNew = numCorrente;
  133. var indirizzoSenzaNum = indirizzoDiviso.splice(0, (indirizzoDiviso.length -1));
  134.  
  135. if (indirizzo.indexOf('page') > -1) {
  136. var numPages = prompt("how many pages to open?");
  137. var numStart = 1;
  138. while (numStart <= numPages) {
  139. window.open(indirizzoSenzaNum +'page'+(parseInt(numCorrente, 10)+numStart), "_blank");
  140. numStart = numStart + 1;
  141. }
  142. button.innerHTML = "...opened";
  143. }
  144. }
  145.  
  146. });
  147.  
  148. button10.addEventListener("click", function() {
  149. if (indirizzoPhotos.includes('page')){
  150. var indirizzo = window.location.href;
  151. var indirizzoDiviso = indirizzo.split('page');
  152. var numCorrente = indirizzoDiviso[indirizzoDiviso.length -1];
  153. var numNew = numCorrente;
  154. var indirizzoSenzaNum = indirizzoDiviso.splice(0, (indirizzoDiviso.length -1));
  155.  
  156. if (indirizzo.indexOf('page') > -1) {
  157. var numPages = 10;
  158. var numStart = 1;
  159. while (numStart <= numPages) {
  160. window.open(indirizzoSenzaNum +'page'+(parseInt(numCorrente, 10)+numStart), "_blank");
  161. numStart = numStart + 1;
  162. }
  163. button10.innerHTML = "__";
  164. }
  165. }
  166. if (!(indirizzoPhotos.includes('page'))){
  167. var indirizzoB = window.location.href + 'page1';
  168. var indirizzoDivisoB = indirizzoB.split('page');
  169. var numCorrenteB = indirizzoDivisoB[indirizzoDivisoB.length -1];
  170. var numNewB = numCorrenteB;
  171. var indirizzoSenzaNumB = indirizzoDivisoB.splice(0, (indirizzoDivisoB.length -1));
  172.  
  173. if (indirizzo.indexOf('page') > -1) {
  174. var numPagesB = 10;
  175. var numStartB = 1;
  176. while (numStartB <= numPagesB) {
  177. window.open(indirizzoSenzaNumB +'page'+(parseInt(numCorrenteB, 10)+numStartB), "_blank");
  178. numStartB = numStartB + 1;
  179. }
  180. button10.innerHTML = "__";
  181. }
  182. }
  183. });
  184.  
  185.  
  186.  
  187. }
  188.  
  189. buttonClose.addEventListener("click", function() {
  190. window.close();
  191. });
  192. buttonClose2.addEventListener("click", function() {
  193. window.close();
  194. });
  195.  
  196. //AGGIUNTA DUPLICA BARRA
  197.  
  198. // Trova l'elemento della barra delle pagine esistente
  199. var existingPager = document.querySelector('.pagination-view'); // Sostituisci con il selettore CSS corretto
  200.  
  201. // Verifica se l'elemento è stato trovato
  202. if (existingPager) {
  203. // Clona l'elemento della barra delle pagine
  204. var duplicatedPager = existingPager.cloneNode(true);
  205.  
  206. var magicToolbar = document.querySelector('.fluid-magic-toolbar');
  207.  
  208. // Assicurati che l'elemento sia stato trovato prima di procedere
  209. if (magicToolbar) {
  210. // Inserisci duplicatedPager prima di magicToolbar
  211. //magicToolbar.parentNode.insertBefore(duplicatedPager, magicToolbar);
  212. //magicToolbar.parentNode.insertBefore(duplicatedPager, magicToolbar.nextSibling);
  213. magicToolbar.parentNode.insertAdjacentElement('beforebegin', duplicatedPager);
  214. } else {
  215. // L'elemento con la classe .fluid-magic-toolbar non è stato trovato
  216. // Puoi gestire questo caso a tua discrezione.
  217. }
  218. }
  219.  
  220. //FINE AGGIUNTA DUPLICA BARRA
  221.  
  222.  
  223. }