Skip to content

Instantly share code, notes, and snippets.

@jhaus
Created January 4, 2012 22:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhaus/1562466 to your computer and use it in GitHub Desktop.
Save jhaus/1562466 to your computer and use it in GitHub Desktop.
Google Docs Audio Player. Prefix with "javascript:" when adding to bookmarks. Bookmarklet broken as of 2010.01.04.
function gup( name ){
var cre_getDocIdelement = document.getElementById( 'gbmpm_0_l' );
name = name.replace( /[\[]/,"\\\[" ).replace( /[\]]/,"\\\]" );
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( cre_getDocIdelement );
if( results == null ) return "";
else return results[1];
}
var cre_id = gup( 'id' );
var cre_redirecturl = 'https://docs.google.com/uc?export=player&id=' + cre_id;
top.location = cre_redirecturl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment