Created
October 15, 2010 05:22
-
-
Save addyosmani/627670 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* View documents with Google Docs ... | |
* because my laptop can't handle Word and Chrome at the same time. */ | |
$(document).ready(function(){ | |
// I'm sure there's a more efficient selector for this. | |
$('a[href$=doc], a[href$=docx], a[href$=pdf], a[href$=rtf]').attr( | |
'href', | |
function(){ | |
return 'http://docs.google.com/viewer?url=' + this.href; | |
} | |
) | |
.attr( | |
'target', | |
'_blank' | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment