Here's a variant, making use of the location hack 
(http://wiki.greasespot.net/Location_hack) instead of <script> 
injection. Still has the problem with GM_functions being disallowed (is 
this a deliberate security choice?), but doesn't have the insane problem 
the <script> injection does with GM_setValue setting the calling 
context's source instead of its parameter.

function listener(e) {
  GM_setValue("type", e.target.textContent);
}

function trigger(type) {  var n = document.createElement("span");
  n.style.display = "none";
  n.textContent = type.toString();
  document.body.appendChild(n);
}

function showType() {
  alert("Type: " + GM_getValue("type"));
}

document.body.addEventListener("DOMNodeInserted", listener, true);

trigger('in GM script context');
showType();
location.href = "javascript:" + trigger + "\n\ntrigger('in location hack 
context');"
showType();



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to