richarddawkins.net redirect

Automatic redirect for richarddawkins.net articles to full stories

  1. /******************************************************************************
  2.  
  3. * richarddawkins.net News "Complete Story" Redirect by Jan Karjalainen (jan at biffstek dot se)
  4. * Based on the linuxtoday.com News "Complete Story" Redirect by Peter Butkovic (puk007 at gmail dot com),
  5. * which in turn was based on the Linux.org news "Read full article" redirect by Jaap Haitsma (jaap at haitsma dot org) see: http://userscripts.org/scripts/show/5350
  6. *
  7.  
  8. * version 0.2
  9.  
  10. * 2013-04-05
  11.  
  12. * Copyright (c) 2013, Jan Karjalainen
  13.  
  14. * Released under the GPL license, version 4
  15.  
  16. * http://www.gnu.org/copyleft/gpl.html
  17.  
  18. ******************************************************************************
  19.  
  20. * On load of richarddawkins.net news story is done, there are links whose inner html is 'continue to source article at' then:
  21.  
  22. * - redirect to reffered link in the actual window is done
  23.  
  24. *
  25.  
  26. * This script asumes richarddawkins.net stories contains the text "continue to source article at"
  27.  
  28. * in the link to the article.
  29. *
  30.  
  31. * It works (is tested) with:
  32.  
  33. * - Firefox 18.0.1 - Linux - Greasemonkey 1.6
  34. * - Firefox 18.0.1 - Windows 8 - Greasemonkey 1.6
  35.  
  36. *
  37.  
  38. * To Install:
  39.  
  40. * - like any greasemonkey script: install greasemonkey, restart FF, open
  41.  
  42. * this script in a browser window, go to Tools/Install User Script
  43.  
  44. *
  45.  
  46. * To Uninstall:
  47.  
  48. * - like any greasemonkey script: Tools/Manage User Scripts, select
  49. * 'richarddawkins.net_redirect', click the Uninstall button
  50.  
  51. *
  52.  
  53. * Changelog:
  54. * ver 0.1
  55.  
  56. * 2013-01-22
  57. * Jan Karjalainen
  58. * - 1.st ver
  59. * ver 0.2
  60. * Jan Karjalainen
  61. * 2013-04-05
  62. * Added 'http://rdfrs.com/news_articles/*' to @includes
  63.  
  64. */
  65. // ==UserScript==
  66. // @name richarddawkins.net redirect
  67. // @namespace http://userscript.org/
  68. // @description Automatic redirect for richarddawkins.net articles to full stories
  69. // @include http*://www.richarddawkins.net/news_articles/*
  70. // @include http*://rdfrs.com/news_articles/*
  71. // @version 1.1
  72. // @grant none
  73. // ==/UserScript==
  74.  
  75. (function() {
  76.  
  77. try {
  78.  
  79. textLink="continue to source article at";
  80.  
  81. nPage=-1;
  82. // opens 1.st such a link in tab
  83.  
  84. for( i=0; i < document.links.length; i++ )
  85.  
  86. if( document.links[ i ].innerHTML.match( textLink ))
  87.  
  88. window.location.href=document.links[i].href
  89. }
  90.  
  91. catch (e) {
  92.  
  93. GM_log( 'richarddawkins.net News "Complete Story" Redirect - script exception: ' + e );
  94.  
  95. alert ( 'richarddawkins.net News "Complete Story" Redirect - script exception: ' + e );
  96.  
  97. }
  98.  
  99. }
  100.  
  101. )();
  102.  
  103.