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-03-01 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name flickr - open an amount of next pages at once
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.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. // @include https://www.flickr.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. var indirizzoPhotos = window.location.href;
  12. if (indirizzoPhotos.indexOf('photos') > -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. var buttonClose = document.createElement("button");
  22. buttonClose.innerHTML = "Close this page";
  23. buttonClose.style.backgroundColor = "#ffffff";
  24. buttonClose.style.color = "#008ddf";
  25. buttonClose.style.border = "2px solid";
  26. buttonClose.style.width = "45%"; //change this value for the width of the "Close this page" button
  27. buttonClose.style.height = "200px"; //change this value for the height of the "Close this page" button
  28. buttonClose.style.position = "relative";
  29. buttonClose.style.left = "40%";
  30.  
  31. document.body.appendChild(divmio);
  32. document.body.insertBefore(button, divmio);
  33. document.body.insertBefore(buttonClose, divmio);
  34.  
  35. button.addEventListener("click", function() {
  36.  
  37. var indirizzo = window.location.href;
  38. var indirizzoDiviso = indirizzo.split('page');
  39. var numCorrente = indirizzoDiviso[indirizzoDiviso.length -1];
  40. var numNew = numCorrente;
  41. var indirizzoSenzaNum = indirizzoDiviso.splice(0, (indirizzoDiviso.length -1));
  42.  
  43. if (indirizzo.indexOf('page') > -1) {
  44.  
  45.  
  46. var numPages = prompt("how many pages to open?");
  47. var numStart = 1;
  48. while (numStart <= numPages) {
  49. window.open(indirizzoSenzaNum +'page'+(parseInt(numCorrente, 10)+numStart), "_blank");
  50. numStart = numStart + 1;
  51. }
  52. button.innerHTML = "...opened";
  53. }
  54. });
  55.  
  56.  
  57. buttonClose.addEventListener("click", function() {
  58. window.close();
  59. });
  60.  
  61. }