Discuții » Dezvoltare

Cant make this script run with MutationObserver

§
Postat în: 20-03-2015

Cant make this script run with MutationObserver

The script work but when you go to next page mutation seens dont work proper.
exemple link: http://gameminer.ru/?q=&type=any&sortby=price&order=asc&filter_entered=on
The script:
http://paste2.org/b5tB4zO8

woxxomMod
§
Postat în: 20-03-2015
Editat în: 21-03-2015

Apparently that site doesn't use ajax page navigation, but a standard link.

§
Postat în: 20-03-2015

when you click on the next page the code stop work to the new div that load

woxxomMod
§
Postat în: 20-03-2015
Editat în: 20-03-2015

With my fixes the code doesn't stop. I've edited my previous message and put a complete script code with // @run-at document-end.

§
Postat în: 20-03-2015

seens work on chrome but not in the firefox can you confirm?
chrome work well here. =/

woxxomMod
§
Postat în: 20-03-2015

Works both in Chrome 43 with Tampermonkey beta and Firefox 37 with Greasemonkey 3.1 beta.

§
Postat în: 20-03-2015

^^
ok, thank you! you're very helpfull.
Im getting a but with this site could be affecting the script, the word coal simply disappears on loading of next page. I'll try fix this.

§
Postat în: 20-03-2015

Works both in Chrome 43 with Tampermonkey beta and Firefox 37 with Greasemonkey 3.1 beta.

I did some test and if you're logged you get this error (coal miss) that broke this script.

woxxomMod
§
Postat în: 20-03-2015
Editat în: 20-03-2015

I don't want to register on that site, so what about you copy the page source (Ctrl-U) to paste2.org and post the link here?

§
Postat în: 20-03-2015

here is it:
page loading and run script fine ->http://paste2.org/Z4IeKmA5
page after next loading script stop work ->http://paste2.org/UVWv9XAO

§
Postat în: 20-03-2015

back to the first page after next: http://paste2.org/wzes11Af

woxxomMod
§
Postat în: 20-03-2015

I've compared all three variants and there are no differences in their html structure. Only the numbers and links differ (which is expected, of course). The word 'coal' is present in every span.g-coal-icon, so the problem must be something else. Try updating Greasemonkey to v3. Also check the console (Ctrl-Shift-K) for the errors.

§
Postat în: 20-03-2015

the same on chrome with tampermonkey you get this bug if you log if not work fine.

woxxomMod
§
Postat în: 20-03-2015
Editat în: 20-03-2015

That's probably because the site address changes a little, for example https://gameminer.ru or my.gameminer.ru or something. In this case just add those as an additional @include.

§
Postat în: 20-03-2015

I tried this:
// @include /^https?://*gameminer*/
still the same.

I did a acc
you can acess
user: userscript000
pass: userscript123

woxxomMod
§
Postat în: 20-03-2015

I've updated the code above. The problem was caused by a slightly different class name of the container element and also because the script was executed too soon.

BTW the correct regexp is /^https?://.*gameminer\.ru\/.*/ although you don't need it, the address doesn't change for the logged in users.

§
Postat în: 20-03-2015

T.T
do not work when click next
i tried this too closest("div.giveaway__container>div")
but still the same.

woxxomMod
§
Postat în: 21-03-2015

Okay, this was easy.

In your original script simply replace var target = document.querySelector('.giveaways'); with var target = document.body; and div.giveaway.c-giveaway with div.giveaway

§
Postat în: 21-03-2015

xD
Thank you. You're the best!

Postează un raspuns

Autentifică-te pentru a posta un răspuns.