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

当前为 2021-11-07 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name flickr - open an amount of next pages at once
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.5
  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. // @include https://www.flickr.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. var indirizzoPhotos = window.location.href;
  12. if (indirizzoPhotos.indexOf('photos') > -1 || indirizzoPhotos.indexOf('groups') > -1) {
  13.  
  14. var divmio = document.createElement("div");
  15. divmio.style.cssText = 'position:static;width:100%;height:120px;opacity:0;z-index:100;';
  16. var button = document.createElement("button");
  17. button.innerHTML = "open the next ... pages";
  18. button.style.position = "relative";
  19. button.style.left = "10%";
  20.  
  21.  
  22. var buttonO = document.createElement("button");
  23. buttonO.innerHTML = "open the next page";
  24. buttonO.style.position = "relative";
  25. buttonO.style.left = "54%";
  26. buttonO.style.backgroundColor = "#ffffff";
  27. buttonO.style.color = "#008ddf";
  28. buttonO.style.border = "2px solid";
  29. buttonO.style.width = "10%";
  30. buttonO.style.height = "500px";
  31.  
  32.  
  33.  
  34. var buttonClose = document.createElement("button");
  35. buttonClose.innerHTML = "Close this page";
  36. buttonClose.style.backgroundColor = "#ffffff";
  37. buttonClose.style.color = "#008ddf";
  38. buttonClose.style.border = "2px solid";
  39. buttonClose.style.width = "26%"; //change this value for the width of the "Close this page" button
  40. buttonClose.style.height = "500px"; //change this value for the height of the "Close this page" button
  41. buttonClose.style.position = "relative";
  42. buttonClose.style.left = "55%";
  43.  
  44. document.body.appendChild(divmio);
  45. document.body.insertBefore(button, divmio);
  46. document.body.insertBefore(buttonO, divmio);
  47. document.body.insertBefore(buttonClose, divmio);
  48.  
  49.  
  50. buttonO.addEventListener("click", function() {
  51. var indirizzo2 = window.location.href;
  52. var indirizzoDiviso2 = indirizzo2.split('page');
  53. var numCorrente2 = indirizzoDiviso2[indirizzoDiviso2.length -1];
  54. var indirizzoSenzaNum2 = indirizzoDiviso2.splice(0, (indirizzoDiviso2.length -1));
  55. window.open(indirizzoSenzaNum2 +'page'+(parseInt(numCorrente2, 10)+ 1), "_self");
  56. });
  57.  
  58.  
  59. button.addEventListener("click", function() {
  60. var indirizzo = window.location.href;
  61. var indirizzoDiviso = indirizzo.split('page');
  62. var numCorrente = indirizzoDiviso[indirizzoDiviso.length -1];
  63. var numNew = numCorrente;
  64. var indirizzoSenzaNum = indirizzoDiviso.splice(0, (indirizzoDiviso.length -1));
  65.  
  66. if (indirizzo.indexOf('page') > -1) {
  67. var numPages = prompt("how many pages to open?");
  68. var numStart = 1;
  69. while (numStart <= numPages) {
  70. window.open(indirizzoSenzaNum +'page'+(parseInt(numCorrente, 10)+numStart), "_blank");
  71. numStart = numStart + 1;
  72. }
  73. button.innerHTML = "...opened";
  74. }
  75. });
  76.  
  77.  
  78. buttonClose.addEventListener("click", function() {
  79. window.close();
  80. });
  81.  
  82. }