JavaScript Snippet - Realtek Driver-Download Pages - Direct Download Link Without Redirection

Posted at

Fix Realteck Driver-Download Pages (http://www.realtek.com.tw/)
To have direct-download links, which you may copy and use in download-managers.



Before


(function(window,document,tmp){
"use strict";
document.querySelectorAll('a[href*="void("][onclick*="FTPPath"]').forEach(function(element){
tmp = element.getAttribute("onclick");
if(null === tmp) return;

tmp = tmp.match(/FTPPath\\=([^\\']+)\\'/i);
if(null === tmp || "undefined" == typeof tmp[1]) return;
tmp = tmp[1];
tmp = decodeURIComponent(tmp);
setTimeout(function(){
element.setAttribute("href", tmp); /* fix link */
element.removeAttribute("onclick"); /* cleanup */
element.removeAttribute("onmouseover"); /* cleanup */
});
});
}(
top
, top.document
, null
));


-or bookmarklet:
javascript:(function(window,document,tmp){document.querySelectorAll('a[href*="void("][onclick*="FTPPath"]').forEach(function(element){tmp=element.getAttribute("onclick");if(null===tmp)return;tmp=tmp.match(/FTPPath\\=([^\\']+)\\'/i);if(null===tmp||"undefined"==typeof tmp[1])return;tmp=tmp[1];tmp=decodeURIComponent(tmp);setTimeout(function(){element.setAttribute("href",tmp);element.removeAttribute("onclick");element.removeAttribute("onmouseover")})})})(top,top.document,null);


After