Recent posts by Zorg

Subscribe to Recent posts by Zorg 8 posts found

Apr 7, 2007
Zorg 8 posts

Topic: Userscripts.org discussion / what is this forum software?

What is the underlying forum software for this place (userscripts.org)? Is it an opensource app?

Doesn't seem like phpBB or YaBB ... :)

Z

 
Apr 7, 2007
Zorg 8 posts

Topic: Script development / semi-off-topic: how to publish a Firefix extension?

I'm interested in publishing an XPI (compiled) version of a greasemonkey script so that it's available as a Firefox add-on at https://addons.mozilla.org/. I've looked around, and I can't find any place to "submit" add ons. Any ideas? What is the process for publishing add ons (extensions)?

Z

 
Apr 5, 2007
Zorg 8 posts

Topic: Script development / how to compile a greasemonkey script into .XPI for Firefox 2.0+

Aha! Ok, that did the trick. Thanks!

Z

 
Apr 4, 2007
Zorg 8 posts

Topic: Script development / how to compile a greasemonkey script into .XPI for Firefox 2.0+

The webboard reformatted it ... here it is again, this time HTML-escaped:

messageDiv.innerHTML = '<div style="position: absolute; left: 0px; top: 0px;' +
		'border: 2px dotted #F00; ' +
		'font-size: 14px; font-family: arial; background-color: #FCC; z-index: 1000;' +
		'color: #000; margin:0px; padding:3px; font-weight:bold;"%gt;' +
		' ' + messageText + ' ' +
		'</div>';

 
Apr 4, 2007
Zorg 8 posts

Topic: Script development / how to compile a greasemonkey script into .XPI for Firefox 2.0+

I don't think there are any unbalanaced { }'s. I'm running this just fine in Greasmonkey (no js errors).

Here's the source ... it's not too long. Please see if you can spot any problems:

// ==UserScript==
// @name XXX Detector
// @namespace http://www.xxx.com
// @description Detects if a page is using xxx code
// @include *
// ==/UserScript==

function highlightElement(el, insertEmptyTag) {
var setHighlight = 0;
// stylize the element
try {
el.style.border='2px #f00 dotted';
el.style.background='#FCC';
setHighlight = 1;
if (insertEmptyTag && el.innerHTML.search(/^[ \n]*$/) != -1) {
// insert marker for empty divs
el.innerHTML = '<center><font>(empty)</font></center>';
}
}
catch (err)
{
;
}
return(setHighlight);
}

var scripts = document.getElementsByTagName( "script" );
var vendor = null;
var parseDivs = false;
var testAreas = 0;

for ( var i = 0; i < scripts.length; ++i ) {
var scriptEl = scripts[ i ];
// check both inline contents of a script block as well as its source (include file)
var codeTest = scriptEl.innerHTML + ';' + scriptEl.src;

if ( codeTest.search( /(^xxx|yyy|zzz)/i ) != -1 ) {
if (codeTest.search(/xxx/i) != -1) {
vendor = 'xxx';
parseDivs = true;
break;
} else if (codeTest.search(/yyy/i) != -1) {
vendor = 'yyy';
parseDivs = true;
break;
} else if (codeTest.search(/zzz/i) != -1) {
vendor = 'zzz';
parseDivs = true;
break;
}
}
}

if (vendor != null) {
if (parseDivs) {
// walk through the DOM and highlight xxx div's
var testZones = document.getElementsByTagName( "div" );

for ( var i = 0; i < testZones.length; ++i ) {
var testZone = testZones[ i ];

if (testZone.id.search(/^(xxx|yyy|zzz)/i) != -1) {
// count test areas, but only if they're not hidden
if (testZone.style.visibility != 'hidden' && testZone.style.display != 'none' && highlightElement(testZone, true)) {
testAreas++;
}
}
}
}

var messageDiv = document.createElement("div");
var messageText = vendor + ' code detected (' + testAreas + ' areas)';
messageDiv.id = "logo";
messageDiv.innerHTML = '

' +
' ' + messageText + ' ' +
'
';
window.status=messageText;
document.body.insertBefore( messageDiv, document.body.firstChild );
}

//alert('done');

 
Apr 3, 2007
Zorg 8 posts

Topic: Script development / how to compile a greasemonkey script into .XPI for Firefox 2.0+

I tried that one, too... but after I install the XPI and restart, I keep getting a javascript alert saying "Error: missing } after function body".

Any ideas?

I have one simple function in my script:

function highlightElement(el) {
var setHighlight = 0;
// stylize the element
try {
el.style.border='2px #f00 dotted';
el.style.background='#FCC';
setHighlight = 1;
}
catch (err)
{
;
}
return(setHighlight);
}

...can't see why that would cause a problem. It works fine under the regular greasemonkey extension.

 
Apr 2, 2007
Zorg 8 posts

Topic: Script development / how to compile a greasemonkey script into .XPI for Firefox 2.0+

I'm trying to compile a greasemonkey script... found some compiler sites (i.e. http://www.letitblog.com/greasemonkey-compiler/) but they don't appear to work with Firefox v2.0.x. Any ideas for 2.0 compatible compilers?

thanks!

 
Mar 31, 2007
Zorg 8 posts

Topic: Script development / how to show a message in the status bar (chrome, not window.status)?

I've written a little script that shows a message in the browser's status bar every time a certain piece of HTML appears on a page. It uses window.status javascript, but the problem is sometimes the HTML page's own javascript overwrites my window.status value....

So I'm wondering how one can write a message to the *chrome* part of the window - either at the top (menu/toolbar) or at the bottom of the browser (i.e. botton/right, where FF extensions often put information).

Is such a thing possible in Greasmonkey?

thanks!