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

  1. // ==UserScript==
  2. // @name flickr - open an amount of next pages at once
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.4
  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. var indirizzoPhotos = window.location.href;
  11. if (indirizzoPhotos.indexOf('photos') > -1 || indirizzoPhotos.indexOf('groups') > -1) {
  12. var divmio = document.createElement("div");
  13. divmio.style.cssText = 'position:static;width:100%;height:120px;opacity:0;z-index:100;';
  14. var button = document.createElement("button");
  15. button.innerHTML = "open the next ... pages";
  16. button.style.position = "relative";
  17. button.style.left = "10%";
  18. var buttonClose = document.createElement("button");
  19. buttonClose.innerHTML = "Close this page";
  20. buttonClose.style.backgroundColor = "#ffffff";
  21. buttonClose.style.color = "#008ddf";
  22. buttonClose.style.border = "2px solid";
  23. buttonClose.style.width = "45%"; //change this value for the width of the "Close this page" button
  24. buttonClose.style.height = "200px"; //change this value for the height of the "Close this page" button
  25. buttonClose.style.position = "relative";
  26. buttonClose.style.left = "40%";
  27. document.body.appendChild(divmio);
  28. document.body.insertBefore(button, divmio);
  29. document.body.insertBefore(buttonClose, divmio);
  30. button.addEventListener("click", function() {
  31. var indirizzo = window.location.href;
  32. var indirizzoDiviso = indirizzo.split('page');
  33. var numCorrente = indirizzoDiviso[indirizzoDiviso.length -1];
  34. var numNew = numCorrente;
  35. var indirizzoSenzaNum = indirizzoDiviso.splice(0, (indirizzoDiviso.length -1));
  36. if (indirizzo.indexOf('page') > -1) {
  37. var numPages = prompt("how many pages to open?");
  38. var numStart = 1;
  39. while (numStart <= numPages) {
  40. window.open(indirizzoSenzaNum +'page'+(parseInt(numCorrente, 10)+numStart), "_blank");
  41. numStart = numStart + 1;
  42. }
  43. button.innerHTML = "...opened";
  44. }
  45. });
  46. buttonClose.addEventListener("click", function() {
  47. window.close();
  48. });
  49. }