Recent posts by engtech
|
May 8, 2008
|
Topic: Script development / Using jQuery library with Greasemonkey I've written a blog post about how I use the jQuery library with Greasemonkey: http://internetducttape.com/2008/05/08/greasemo... I thought some of you might find it interesting, as it's a really excellent way of increasing your productivity when writing Greasemonkey scripts (don't have to worry about DOM/XPath traversal anymore). |
|
Dec 6, 2007
|
Topic: Script development / How to Test? Has anyone come up with a good way of automated testing for Greasemonkey userscripts? I really hate it when users have to report a bug to me and I haven't seen it myself. |
|
Sep 13, 2007
|
Topic: Script development / gm_xmlhttprequest to submit form Good approach -- rip out the body and put it in the iframe. I gave up on iframes and went back to using GM_openInTab with unique parameters to trigger my greasemonkey script. I kept on getting the same stupid denied access errors. |
|
Sep 8, 2007
|
Topic: Script development / gm_xmlhttprequest to submit form Ok, I'm an idiot. Turns out that using an iframe is the easiest way to do this. - do a gm_xmlhttprequest
I built a helper class to make dealing with the iframe easier.
var FrameObj = function () {
// from: http://wiki.greasespot.net/HTML_injection_tips
// Margin, top, left, width and height center the iframe horizontally and vertically:
var css = 'position:fixed; z-index:9999; border: none; ' +
'top:50%; left:50%; width:30em; margin:-15em; 0 0 -10em; height:20em;';
var iframe = document.createElement('iframe');
iframe.setAttribute('style', css);
// The about:blank page becomes a blank(!) canvas to modify
iframe.src = 'about:blank';
document.body.appendChild(iframe);
// Make sure Firefox initializes the DOM before we try to use it.
iframe.addEventListener("load", function() {
var doc = iframe.contentDocument;
doc.body.style.background = 'white';
doc.body.innerHTML = '...';
}, false);
iframe.style.display = 'none';
this.iframe = iframe;
};
FrameObj.prototype = {
display: function(text) {
this.iframe.contentDocument.body.innerHTML = text;
this.iframe.style.display = 'block';
},
displayOn: function() { this.iframe.style.display = 'block'; },
displayOff: function() { this.iframe.style.display = 'none'; },
store: function(text) {
this.iframe.style.display = 'none';
this.iframe.contentDocument.body.innerHTML = text;
},
get: function() {
return(this.iframe.contentDocument.body);
}
};
|
|
Sep 8, 2007
|
Topic: Script development / gm_xmlhttprequest to submit form I'd like to have a code pattern that does something like this - gm_xmlhttprequest GET on a URL
What's killing me is the complete pain in the butt it is to modify the responseText from the first GET to get the default form information for the POST. I've seen hacks where people add the post to the DOM of the current page by innerHTML but that seems way too hacky. Does anyone have better solutions? |
|
Jul 31, 2007
|
Topic: Script development / User settings I've been struggling a while with how to do very simple inline user settings for my scripts using forms. Ideally I just want to use a well tested / documented existing library someone else wrote so that I can present them with a nice form/hover that has radio/checkboxes/text inputs for them to modify scripts. I've seen other greasemonkey scripts that do settings like that, but what I haven't found is a consistent library that anyone can use. |
|
Mar 24, 2007
|
Topic: Script development / Your most popular script? This is a great idea. I really like the "popular this week" aspect because it would change pretty often and make a lot of different scripts featured. |
