I have a web page that generates imacros scripts and runs them as bookmarklets.
Today after iMacros got updated to 5.2.1 the generated bookmarklets no longer work, here's an example:
Code: Select all
javascript:(function() {var m = "VERSION BUILD=7401110 RECORDER=FX\nTAB T=1\nURL GOTO=http://ready.arl.noaa.gov/READYcmet.php\nWAIT SECONDS=0.3\nTAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/ready2-bin/main.pl ATTR=ID:Lat CONTENT=42.69\nTAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/ready2-bin/main.pl ATTR=NAME:Lon CONTENT=24.75\nTAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:/ready2-bin/main.pl ATTR=VALUE:Continue\nWAIT SECONDS=0.25\nTAG POS=4 TYPE=SELECT FORM=NAME:NoFormName ATTR=NAME:m CONTENT=2\nTAG POS=4 TYPE=INPUT:SUBMIT FORM=NAME:NoFormName ATTR=VALUE:Go\nTAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:/ready2-bin/profile1.pl ATTR=VALUE:Next>>\nTAG POS=1 TYPE=SELECT FORM=ACTION:/ready2-bin/profile2.pl ATTR=NAME:metdate CONTENT=$October<SP>11,<SP>2012<SP>at<SP>12<SP>UTC*\nTAG POS=1 TYPE=INPUT:RADIO FORM=ACTION:/ready2-bin/profile2.pl ATTR=NAME:hgt&&VALUE:1\n", n = "Forecast";if (!/^(?:http|file)/.test(document.location)) {}var div = document.getElementById("imacros-bookmark-div");if (!div)alert("iMacros plugin not detected");var ta = document.getElementById("imacros-macro-container");ta.value = m;div.setAttribute("name", n);var evt = document.createEvent("Event");evt.initEvent("iMacrosRunMacro", true, true);div.dispatchEvent(evt);}) ();
I think the new version no longer inserts "imacros-macro-container" div into the document.
I tried replacing the related code with
Code: Select all
try
{
var macro={};
macro.name="Forecast";
macro.source=m;
console.log(m);
var evt = document.createEvent("CustomEvent");
evt.initEvent("iMacrosRunMacro", true, true, macro);
window.dispatchEvent(evt);
}
catch(evt)
{
alert("iMacros error: "+evt.toString());
}