Skip to content

Instantly share code, notes, and snippets.

@pklaus
Created March 2, 2010 14:10
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pklaus/319524 to your computer and use it in GitHub Desktop.
Save pklaus/319524 to your computer and use it in GitHub Desktop.
Greasemonkey User Script to download PDF files posted in a WebCT class folder
// Frankfurt University WebCT Downloader
// 17-05-2008
// Copyright (c) 2008, Marc Powell <marc DOT powell AT yahoo DOT com>
//
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
// --------------------------------------------------------------------
//
// Allows Iowa State University distance-education students to download
// PDF articles posted in WebCT class folder.
//
// This is a Greasemonkey user script. To install it, you need
// Greasemonkey 0.3 or later: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
//
// To uninstall, go to Tools/Manage User Scripts,
// select "WebCT Document Downloader", and click Uninstall.
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name WebCT Downloader
// @namespace http://www.caliparisien.com/dev/greasemonkey/
// @description For downloading PDFs and other stuff from WebCT
// @include https://webct.its.iastate.edu/webct/*
// @include https://webct.server.uni-frankfurt.de/webct/*
// ==/UserScript==
//
// Version 0.1:
// - Initial version!
//<a href="javascript:submitLoad('656544242031','PAGE_TYPE', false)"
var debug = false;
var links = document.getElementsByTagName( 'a' );
var element;
for ( var i = 0; i < links.length; i++ )
{
element = links[ i ];
var oldUrl = element.href;
if ( oldUrl.indexOf( "javascript:submitLoad" )==0 && oldUrl.indexOf("PAGE_TYPE")>0)
{
var newUrl = oldUrl.replace(/false/,"true");
element.href = newUrl;
if(debug) GM_log(i+": "+oldUrl+" -> "+newUrl);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment