|
|
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! |
|
|
The one at http://arantius.com/misc/greasemonkey/script-co... definitely works with Firefox 1.5 and 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) {
...can't see why that would cause a problem. It works fine under the regular greasemonkey extension. |
|
|
Greasemonkey scripts are wrapped in a function call. Perhaps you've unbalanced {}s somewhere else in your code? Do you normally see error messages from GM scripts? |
|
|
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==
function highlightElement(el, insertEmptyTag) {
var scripts = document.getElementsByTagName( "script" );
for ( var i = 0; i < scripts.length; ++i ) {
if ( codeTest.search( /(^xxx|yyy|zzz)/i ) != -1 ) {
if (vendor != null) {
for ( var i = 0; i < testZones.length; ++i ) {
if (testZone.id.search(/^(xxx|yyy|zzz)/i) != -1) {
var messageDiv = document.createElement("div");
' +
';
' ' + messageText + ' ' + ' window.status=messageText; document.body.insertBefore( messageDiv, document.body.firstChild ); } //alert('done'); |
|
|
I've not looked at your code for more than 10 seconds to glance down it, and I have a quick question -- why is 'messageDiv.innerHTML' (towards the end) spread over so many lines? Is this the way the forum's formatted it, because I'm not sure but that might cause problems if that's how it is in your script. |
|
|
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>'; |
|
|
Interesting problem. I discovered that the compiled version of your original MVT Vendor Detector script would work if a trailing newline was added to the source code, otherwise the error message you listed occurred on all sites. In other words, if you add a line after '//alert('done');', then the XPI will work properly on the Google test site listed in your script comment, highlighting several matches. |
|
|
Aha! Ok, that did the trick. Thanks! Z |