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

  1. // ==UserScript==
  2. // @name flickr - open an amount of next pages at once
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.2
  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. // @grant window.focus
  10. // ==/UserScript==
  11.  
  12.  
  13. // DEFINIZIONE URL _________________________________________________________________
  14.  
  15. var indirizzoPhotos;
  16.  
  17. setInterval(() => {
  18. if((window.location.href.includes("photos") && !window.location.href.includes("with"))||(window.location.href.includes("groups") && !window.location.href.includes("with")) ) {
  19. indirizzoPhotos = window.location.href;
  20. }
  21. }, 100);
  22.  
  23.  
  24. // BOTTONI _________________________________________________________________
  25.  
  26. var divmio = document.createElement("div");
  27. divmio.style.cssText = 'position:static;width:100%;height:120px;opacity:0;z-index:100;';
  28.  
  29. var button1 = document.createElement("button");
  30. button1.innerHTML = "open the next ... pages";
  31. button1.style.position = "relative";
  32. button1.style.left = "10%";
  33.  
  34. var buttonO = document.createElement("button");
  35. buttonO.innerHTML = "Open next page";
  36. buttonO.style.backgroundColor = "#ffffff";
  37. buttonO.style.color = "#008ddf";
  38. buttonO.style.border = "2px solid";
  39. buttonO.style.width = "9%";
  40. buttonO.style.height = "330px"; // Altezza ridotta per evitare la sovrapposizione
  41. buttonO.style.position = "fixed"; // Imposta il posizionamento fisso
  42. buttonO.style.right = "10px"; // Posiziona il bottone a destra
  43. buttonO.style.bottom = "120px"; // Imposta la posizione sopra "Close this page"
  44.  
  45. var buttonO3 = document.createElement("button");
  46. buttonO3.innerHTML = "Open in background";
  47. buttonO3.style.backgroundColor = "#ffffff";
  48. buttonO3.style.color = "#008ddf";
  49. buttonO3.style.border = "2px solid";
  50. buttonO3.style.width = "9%";
  51. buttonO3.style.height = "80px"; // Altezza ridotta per evitare la sovrapposizione
  52. buttonO3.style.position = "fixed"; // Imposta il posizionamento fisso
  53. buttonO3.style.right = "10px"; // Posiziona il bottone a destra
  54. buttonO3.style.bottom = "810px"; // Imposta la posizione sopra "Close this page"
  55.  
  56. var buttonSW = document.createElement("button");
  57. buttonSW.innerHTML = "1 Open in background<br>2 close this page";
  58. buttonSW.style.backgroundColor = "#ffffff";
  59. buttonSW.style.color = "#800080";
  60. buttonSW.style.border = "2px solid";
  61. buttonSW.style.width = "9%";
  62. buttonSW.style.height = "120px"; // Altezza ridotta per evitare la sovrapposizione
  63. buttonSW.style.position = "fixed"; // Imposta il posizionamento fisso
  64. buttonSW.style.right = "10px";
  65. buttonSW.style.bottom = "960px"; // Imposta la posizione sopra "Close this page"
  66.  
  67. var buttonClose = document.createElement("button");
  68. buttonClose.innerHTML = "Close this page";
  69. buttonClose.style.backgroundColor = "#ffffff";
  70. buttonClose.style.color = "#a18160";
  71. buttonClose.style.border = "2px solid";
  72. buttonClose.style.width = "9%";
  73. buttonClose.style.height = "330px"; // Altezza ridotta per evitare la sovrapposizione
  74. buttonClose.style.position = "fixed"; // Imposta il posizionamento fisso
  75. buttonClose.style.right = "10px"; // Posiziona il bottone a destra
  76. buttonClose.style.bottom = "460px"; // Imposta la posizione in basso
  77.  
  78. var buttonO2 = document.createElement("button");
  79. buttonO2.innerHTML = "open the next page";
  80. buttonO2.style.position = "relative";
  81. buttonO2.style.left = "20%";
  82. buttonO2.style.backgroundColor = "#ffffff";
  83. buttonO2.style.color = "#008ddf";
  84. buttonO2.style.border = "2px solid";
  85. buttonO2.style.width = "10%";
  86. buttonO2.style.height = "200px";
  87.  
  88. var buttonClose2 = document.createElement("button");
  89. buttonClose2.innerHTML = "Close this page";
  90. buttonClose2.style.backgroundColor = "#ffffff";
  91. buttonClose2.style.color = "#a18160";
  92. buttonClose2.style.border = "2px solid";
  93. buttonClose2.style.width = "36%"; //change this value for the width of the "Close this page" button
  94. buttonClose2.style.height = "200px"; //change this value for the height of the "Close this page" button
  95. buttonClose2.style.position = "relative";
  96. buttonClose2.style.left = "21%";
  97.  
  98. var button10 = document.createElement("button");
  99. button10.innerHTML = "10";
  100. button10.style.position = "relative";
  101. button10.style.left = "11%";
  102.  
  103. var buttonHide = document.createElement("button");
  104. buttonHide.innerHTML = "hide";
  105. buttonHide.style.backgroundColor = "#ffffff";
  106. buttonHide.style.color = "#008ddf";
  107. buttonHide.style.border = "1px solid";
  108. buttonHide.style.width = "1%";
  109. buttonHide.style.fontSize = "8px";
  110. //buttonHide.style.opacity = '0.5';
  111. buttonHide.style.height = "30px"; // Altezza ridotta per evitare la sovrapposizione
  112. buttonHide.style.position = "fixed"; // Imposta il posizionamento fisso
  113. buttonHide.style.right = "10px"; // Posiziona il bottone a destra
  114. buttonHide.style.bottom = "3%"; // Imposta la posizione sopra "Close this page
  115.  
  116. buttonO.style.zIndex = "999";
  117. buttonO3.style.zIndex = "999";
  118. buttonClose.style.zIndex = "999";
  119. buttonHide.style.zIndex = "999";
  120.  
  121.  
  122. document.body.appendChild(divmio);
  123. document.body.insertBefore(button1, divmio);
  124. document.body.insertBefore(button10, divmio);
  125. document.body.insertBefore(buttonO2, divmio);
  126. document.body.insertBefore(buttonHide, divmio);
  127. document.body.insertBefore(buttonSW, divmio);
  128. document.body.insertBefore(buttonO3, divmio);
  129. document.body.insertBefore(buttonClose2, divmio);
  130. document.body.insertBefore(buttonO, divmio);
  131. document.body.insertBefore(buttonClose, divmio);
  132.  
  133.  
  134. // CODICE FUNZIONALE _________________________________________________________________
  135.  
  136. // funzione hide other buttons
  137. buttonHide.addEventListener("click", function(){
  138. if (buttonO.style.display != "none"){
  139. buttonO.style.display = "none";
  140. buttonO3.style.display = "none";
  141. buttonSW.style.display = "none";
  142. buttonClose.style.display = "none";
  143. //buttonHide.style.display = "none";
  144. buttonHide.innerHTML = "show";
  145. } else { buttonO.style.display = "inline-block";
  146. buttonO3.style.display = "inline-block";
  147. buttonSW.style.display = "inline-block";
  148. buttonClose.style.display = "inline-block";
  149. buttonHide.innerHTML = "hide";}
  150. });
  151.  
  152. // funzione apertura NEXT page
  153. function handlePageClick() {
  154. if (indirizzoPhotos.includes('page')){
  155. var indirizzoDiviso2 = indirizzoPhotos.split('page');
  156. var numCorrente2 = indirizzoDiviso2[indirizzoDiviso2.length -1];
  157. var indirizzoSenzaNum2 = indirizzoDiviso2.splice(0, (indirizzoDiviso2.length -1));
  158. window.open(indirizzoSenzaNum2 +'page'+(parseInt(numCorrente2, 10)+ 1), "_self");
  159. }
  160. if (!(indirizzoPhotos.includes('page'))){
  161. window.open(window.location.href + 'page2', "_self");
  162. }
  163. }
  164. buttonO.addEventListener("click", handlePageClick);
  165. buttonO2.addEventListener("click", handlePageClick);
  166.  
  167. // funzione apertura NEXT in background
  168. buttonO3.addEventListener("click", function() {
  169. if (indirizzoPhotos.includes('page')){
  170. var indirizzoDiviso2 = indirizzoPhotos.split('page');
  171. var numCorrente2 = indirizzoDiviso2[indirizzoDiviso2.length -1];
  172. var indirizzoSenzaNum2 = indirizzoDiviso2.splice(0, (indirizzoDiviso2.length -1));
  173. var newTab = window.open(indirizzoSenzaNum2 + 'page' + (parseInt(numCorrente2, 10) + 1), "_blank");
  174. newTab.blur(); // Mette in background la nuova scheda
  175. window.focus(); // Riporta il focus sulla scheda corrente
  176. }
  177. if (!(indirizzoPhotos.includes('page'))){
  178. window.open(window.location.href + 'page2', "_blank");
  179. }
  180. });
  181.  
  182. // funzione chiusura pagina
  183.  
  184. buttonClose.addEventListener("click", function() {
  185. window.close();
  186. });
  187. buttonClose2.addEventListener("click", function() {
  188. window.close();
  189. });
  190.  
  191. // funzione NEXT 10 PAGES
  192.  
  193. button10.addEventListener("click", function() {
  194. if (indirizzoPhotos.includes('page')){
  195. var indirizzoDiviso = indirizzoPhotos.split('page');
  196. var numCorrente = indirizzoDiviso[indirizzoDiviso.length -1];
  197. var numNew = numCorrente;
  198. var indirizzoSenzaNum = indirizzoDiviso.splice(0, (indirizzoDiviso.length -1));
  199.  
  200. if (indirizzoPhotos.indexOf('page') > -1) {
  201. var numPages = 10;
  202. var numStart = 1;
  203. while (numStart <= numPages) {
  204. var newTab = window.open(indirizzoSenzaNum + 'page' + (parseInt(numCorrente, 10) + (numPages - numStart + 1)), "_blank");
  205. newTab.blur();
  206. window.focus();
  207. numStart = numStart + 1;
  208. }
  209.  
  210. button10.innerHTML = "__";
  211. }
  212. }
  213. if (!(indirizzoPhotos.includes('page'))){
  214. var indirizzoB = indirizzoPhotos + 'page1';
  215. var indirizzoDivisoB = indirizzoB.split('page');
  216. var numCorrenteB = indirizzoDivisoB[indirizzoDivisoB.length -1];
  217. var numNewB = numCorrenteB;
  218. var indirizzoSenzaNumB = indirizzoDivisoB.splice(0, (indirizzoDivisoB.length -1));
  219.  
  220. if (indirizzoPhotos.indexOf('page') > -1) {
  221. var numPagesB = 10;
  222. var numStartB = 1;
  223. while (numStartB <= numPagesB) {
  224. var newTabB = window.open(indirizzoSenzaNumB +'page'+(parseInt(numCorrenteB, 10)+(numPagesB - numStartB + 1)), "_blank");
  225. newTabB.blur();
  226. window.focus();
  227. numStartB = numStartB + 1;
  228. }
  229. button10.innerHTML = "__";
  230. }
  231. }
  232. });
  233.  
  234. // funzione NEXT PAGES prompt
  235.  
  236. button1.addEventListener("click", function() {
  237. if (indirizzoPhotos.includes('page')){
  238. var indirizzoDiviso = indirizzoPhotos.split('page');
  239. var numCorrente = indirizzoDiviso[indirizzoDiviso.length -1];
  240. var numNew = numCorrente;
  241. var indirizzoSenzaNum = indirizzoDiviso.splice(0, (indirizzoDiviso.length -1));
  242.  
  243.  
  244. if (indirizzoPhotos.indexOf('page') > -1) {
  245. var numPages = prompt("how many pages to open?");
  246. var numStart = 1;
  247. while (numStart <= numPages) {
  248. var newTab = window.open(indirizzoSenzaNum +'page'+(parseInt(numCorrente, 10)+ (numPages - numStart + 1)), "_blank");
  249. newTab.blur();
  250. window.focus();
  251. numStart = numStart + 1;
  252. }
  253.  
  254. button1.innerHTML = "...opened";
  255. }
  256.  
  257. }
  258. if (!(indirizzoPhotos.includes('page'))){
  259. var indirizzo = indirizzoPhotos + 'page1';
  260. var indirizzoDiviso = indirizzo.split('page');
  261. var numCorrente = indirizzoDiviso[indirizzoDiviso.length -1];
  262. var numNew = numCorrente;
  263. var indirizzoSenzaNum = indirizzoDiviso.splice(0, (indirizzoDiviso.length -1));
  264.  
  265. if (indirizzo.indexOf('page') > -1) {
  266. var numPages = prompt("how many pages to open?");
  267. var numStart = 1;
  268. while (numStart <= numPages) {
  269. var newTab = window.open(indirizzoSenzaNum +'page'+(parseInt(numCorrente, 10)+(numPages - numStart + 1)), "_blank");
  270. newTab.blur();
  271. window.focus();
  272. numStart = numStart + 1;
  273. }
  274. button1.innerHTML = "...opened";
  275. }
  276. }
  277.  
  278. });
  279.  
  280.  
  281. // funzione apri in background al primo click e chiudi la pagina al secondo click
  282.  
  283. var numeroClick = 0;
  284.  
  285. function gestoreClick() {
  286. // Incrementa il contatore di click
  287. numeroClick++;
  288.  
  289. // Determina quale funzione eseguire in base al numero di click
  290. if (numeroClick === 1) {
  291.  
  292. buttonSW.innerHTML = "1 OPENED<br>2 close this page";
  293.  
  294. if (indirizzoPhotos.includes('page')){
  295. var indirizzoDiviso2 = indirizzoPhotos.split('page');
  296. var numCorrente2 = indirizzoDiviso2[indirizzoDiviso2.length -1];
  297. var indirizzoSenzaNum2 = indirizzoDiviso2.splice(0, (indirizzoDiviso2.length -1));
  298. var newTab = window.open(indirizzoSenzaNum2 + 'page' + (parseInt(numCorrente2, 10) + 1), "_blank");
  299. newTab.blur(); // Mette in background la nuova scheda
  300. window.focus(); // Riporta il focus sulla scheda corrente
  301. }
  302. if (!(indirizzoPhotos.includes('page'))){
  303. window.open(window.location.href + 'page2', "_blank");
  304. }
  305.  
  306. } else if (numeroClick === 2) {
  307.  
  308. window.close();
  309.  
  310. // Resettare il contatore dopo il secondo click
  311. numeroClick = 0;
  312. }
  313.  
  314. }
  315.  
  316. buttonSW.addEventListener('click', gestoreClick);
  317.  
  318.  
  319. // BARRA _________________________________________________________________
  320.  
  321. //AGGIUNTA DUPLICA BARRA
  322.  
  323. // Trova l'elemento della barra delle pagine esistente
  324. var existingPager = document.querySelector('.pagination-view'); // Sostituisci con il selettore CSS corretto
  325.  
  326. // Verifica se l'elemento è stato trovato
  327. if (existingPager) {
  328. // Clona l'elemento della barra delle pagine
  329. var duplicatedPager = existingPager.cloneNode(true);
  330.  
  331. var magicToolbar = document.querySelector('.fluid-magic-toolbar');
  332.  
  333. // Assicurati che l'elemento sia stato trovato prima di procedere
  334. if (magicToolbar) {
  335. // Inserisci duplicatedPager prima di magicToolbar
  336. magicToolbar.parentNode.insertAdjacentElement('beforebegin', duplicatedPager);
  337. } else {
  338. // L'elemento con la classe .fluid-magic-toolbar non è stato trovato
  339. // Puoi gestire questo caso a tua discrezione.
  340. }
  341. }
  342.  
  343. //FINE AGGIUNTA DUPLICA BARRA

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址