วันอังคารที่ 25 พฤษภาคม พ.ศ. 2553

Greasemonkey and JQuery

I try to @require http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.js
but it fail

so after search found if use full version (min version will get another error.)
we must change some in jquery code in line by used try catch to avoid error

isSupported = (eventName in el);
if ( !isSupported ) {
el.setAttribute(eventName, "return;");
isSupported = typeof el[eventName] === "function";
}
el = null;

to

try {
isSupported = (eventName in el);
if ( !isSupported ) {
el.setAttribute(eventName, "return;");
isSupported = typeof el[eventName] === "function";
}
el = null;
} catch(e) {}

now it work.

and another notice require will load only once when install user script to grease monkey so if you edit it it will need to uninstall and install again

to install new script is easy drag and drop your script to browser.

and you got lasted script by

http://www.asp.net/ajaxlibrary/cdn.ashx

ไม่มีความคิดเห็น: