Created
November 16, 2011 07:37
-
-
Save elleryq/1369512 to your computer and use it in GitHub Desktop.
新增教材下載連結
This file contains hidden or 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
| // ==UserScript== | |
| // @name 新增教材下載連結 | |
| // @namespace stdinfosys.meterial.download | |
| // @description 新增教材下載連結 | |
| // @include http://192.192.78.86/stdinfosys/StudyMeterialDownload_V2.aspx* | |
| // ==/UserScript== | |
| (function(){ | |
| var elements = document.getElementsByTagName("div"); | |
| for(var start=0,end=elements.length;start!=end;start++) | |
| { | |
| var onclick=elements[start].getAttribute("onclick"); | |
| var style=elements[start].getAttribute("style"); | |
| if (style && style=="CURSOR: hand" ){ | |
| var parent = elements[start].parentNode; | |
| var s = 24; | |
| var e = onclick.indexOf( "'", s+1 ); | |
| var href = onclick.substring( s, e ); | |
| // Create anchor | |
| var a = document.createElement("a"); | |
| a.setAttribute("href", href ); | |
| a.setAttribute("title", href ); | |
| a.innerHTML="download"; | |
| parent.appendChild( a ); | |
| } | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment