Archive.ph Resave

Resave the web page again on archive.ph

  1. // ==UserScript==
  2. // @name Archive.ph Resave
  3. // @namespace http://tampermonkey.net/
  4. // @version 2025-073-27-14-01
  5. // @description Resave the web page again on archive.ph
  6. // @author hangjeff
  7. // @match https://archive.is/*
  8. // @match https://archive.ph/*
  9. // @match https://archive.md/*
  10. // @require https://code.jquery.com/jquery-3.7.1.slim.min.js
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. // Your code here...
  18.  
  19. let savedPage = $('input[name="q"]').val();
  20. if($('center').find('#HEADER').length){
  21. if(savedPage.includes('?')){
  22. if(savedPage.includes('archiveParameter')){
  23. let archiveParameter = new URLSearchParams(
  24. new URL(savedPage).search).get('archiveParameter');
  25. archiveParameter = parseInt(archiveParameter) + 1;
  26.  
  27. let params = new URLSearchParams(new URL(savedPage).search);
  28. params.set('archiveParameter', archiveParameter);
  29. savedPage = savedPage.substring(0, savedPage.lastIndexOf('?') + 1) + params.toString();
  30. Form_Create(savedPage);
  31. }
  32. else{
  33. Form_Create(savedPage + '&archiveParameter=1');
  34. }
  35. }
  36. else{
  37. Form_Create(savedPage + '?archiveParameter=1');
  38. }
  39. }
  40.  
  41.  
  42.  
  43. function Form_Create(myUrl){
  44. let Bootstrap = $('<link>', {
  45. href: 'https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css',
  46. rel: 'stylesheet'
  47. }).appendTo('head');
  48.  
  49. let form = $('<form>', {
  50. id: 'submiturl',
  51. action: 'https://archive.is/submit/',
  52. method: 'GET',
  53. class: 'col-2'
  54. });
  55.  
  56. form.append(
  57. $('<input>', {
  58. id: 'url',
  59. type: 'hidden',
  60. name: 'url',
  61. value: myUrl
  62. })
  63. );
  64. form.append(
  65. $('<input>', {
  66. type: 'submit',
  67. value: 'Save to archive.is again',
  68. tabindex: '1',
  69. class: 'btn btn-primary'
  70. })
  71. );
  72.  
  73. let btn_Back = $('<button class = "col-2 col-sm-2 btn btn-secondary">Go Back to the Page</button>');
  74. btn_Back.on('click', function(){
  75. window.open($('input[name="q"]').val());
  76. })
  77.  
  78. let myDiv = $('<div>', {
  79. class: 'row justify-content-center'
  80. });
  81. myDiv.append(form);
  82. myDiv.append(btn_Back);
  83. $('#HEADER').prepend(myDiv);
  84.  
  85. $('form[action="https://archive.is/search/"]').css('padding', '15px').css('height', '30px');
  86. $('#search').css('height', '75px');
  87. }
  88. })();