Hello,
You are trying to see if the title node of the page gets mutated. My guess is
that the title node is always there and that only it's content gets mutated.
if (addedNodes[i].parentNode.nodeName == 'TITLE') {alert("Yes,
script is active! Hurray! title is "+addedNodes[i].textContent);}
works for me.
All the best,
Stéphane.
> Hello all,
>
> the following script is not active on http://www.example.com/ (alert is not
> shown):
>
> // ==UserScript==
> // @name rtzgrgd
> // @namespace fhdf
> // @description fdhdrfhdrfg
> // @version 1
> // @include http*
> // @grant none
> // @run-at document-start
> // ==/UserScript==
>
> MutationObserver = window.MutationObserver;
> var observer = new MutationObserver(function(mutations) {
> mutations.forEach(function(mutation) {
>
> var addedNodes = mutation.addedNodes;
> for (var i = 0; i < addedNodes.length; i++) {
> if (addedNodes[i].nodeName == 'TITLE') {alert("Yes, script is active!
> Hurray!");}
> }
>
> });
> });
>
> // pass in the target node, as well as the observer options
> observer.observe(document, {childList: true, subtree: true, attributes:
> true});
>
> However, if the source of http://www.example.com/ is saved locally and the
> script is added there (as <script..</script>), everything works and alert is
> shown:
> - see the attached example.com.htm
>
> The user.js script is even working in Chrom (added in settings>extensions),
> so I guess it's not a problem in FF or the code. I have this problem with
> several userscripts (on some sites they're simply not active). This drives me
> crazy, if anyone has an idea about the problem or workaround please help ;)
>
> Greetz
>
> --
> You received this message because you are subscribed to the Google Groups
> "greasemonkey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/greasemonkey-users.
> For more options, visit https://groups.google.com/groups/opt_out.
> <example.com.htm>
--
Stéphane Roux
[email protected]
http://habett.net
--
You received this message because you are subscribed to the Google Groups
"greasemonkey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/greasemonkey-users.
For more options, visit https://groups.google.com/groups/opt_out.