Instructables AllSteps Single Page View V2

Automatically redirect to the ALL Steps page on Instructables, if not already there.

目前为 2016-05-30 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Instructables AllSteps Single Page View V2
  3. // @namespace https://greasyfork.org/users/2329-killerbadger
  4. // @version 2
  5. // @description Automatically redirect to the ALL Steps page on Instructables, if not already there.
  6. // @include http://*instructables.com/id/*
  7. // @include https://*instructables.com/id/*
  8. // ==/UserScript==
  9. //Based upon New York Times Single Page View by Fat Knowledge - http://userscripts.org/scripts/show/15601
  10. //Based upon original script: https://greasyfork.org/de/scripts/1848-instructables-allsteps-single-page-view
  11. //Based upon hint for correction https://greasyfork.org/en/forum/discussion/5349/wasnt-working-until-i-changed-line-7-8-to-include-instead-of-match/p1
  12.  
  13. // Get the current window location
  14. var curLoc = window.location.href;
  15. // Get the html text
  16. //var bodyText = document.body.textContent;
  17. //Not needed for this application
  18.  
  19. // ------------------------------------------------------------------------
  20. // Redirect to single page view if option inot already selected
  21. // ------------------------------------------------------------------------
  22. if (curLoc.indexOf("id") != -1 && curLoc.indexOf("ALLSTEPS") == -1) {
  23. if (curLoc.indexOf("?")!=-1){
  24. var newLoc = curLoc+'&ALLSTEPS';
  25. } else {
  26. var newLoc = curLoc+'?ALLSTEPS';
  27. }
  28. window.location.replace(newLoc);
  29. } else {
  30. }