Archive.org Wayback Machine - First Archive Version

Adds menu button that returns the earliest capture record of the current webpage, preventing error 404, empty or false captures.

目前为 2015-11-07 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Archive.org Wayback Machine - First Archive Version
  3. // @namespace https://greasyfork.org/en/users/10118-drhouse
  4. // @version 1.0
  5. // @description Adds menu button that returns the earliest capture record of the current webpage, preventing error 404, empty or false captures.
  6. // @include *
  7. // @grant GM_getValue
  8. // @grant GM_setValue
  9. // @grant GM_registerMenuCommand
  10. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
  11. // @author drhouse
  12. // @icon https://archive.org/images/glogo.jpg
  13. // ==/UserScript==
  14.  
  15. $(document).ready(function () {
  16. GM_registerMenuCommand("Archive First Capture", function() {
  17. if (location.href.toString().indexOf("https://web.archive.org/") == -1){
  18. window.location.href = 'https://web.archive.org/web/*/' + location;
  19. GM_setValue("run", true);
  20. }
  21. });
  22.  
  23. var to_run = GM_getValue("run"); //prevents endless loop
  24. if (location.href.toString().indexOf("web.archive.org") != -1 && to_run === true){
  25. var earliest = $('#wbMeta > p:nth-child(2) > a:nth-child(2)').attr('href');
  26. window.location.href = 'https://web.archive.org' + earliest;
  27. GM_setValue("run", false);
  28. }
  29. });
  30.