Дискусии » Разработка

Cant make this script run with MutationObserver

§
Публикуван на: 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

woxxomМод
§
Публикуван на: 20.03.2015
Редактиран на: 21.03.2015

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

§
Публикуван на: 20.03.2015

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

woxxomМод
§
Публикуван на: 20.03.2015
Редактиран на: 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.

§
Публикуван на: 20.03.2015

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

woxxomМод
§
Публикуван на: 20.03.2015

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

§
Публикуван на: 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.

§
Публикуван на: 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.

woxxomМод
§
Публикуван на: 20.03.2015
Редактиран на: 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?

§
Публикуван на: 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

§
Публикуван на: 20.03.2015

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

woxxomМод
§
Публикуван на: 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.

§
Публикуван на: 20.03.2015

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

woxxomМод
§
Публикуван на: 20.03.2015
Редактиран на: 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.

§
Публикуван на: 20.03.2015

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

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

woxxomМод
§
Публикуван на: 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.

§
Публикуван на: 20.03.2015

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

woxxomМод
§
Публикуван на: 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

§
Публикуван на: 21.03.2015

xD
Thank you. You're the best!

Публикувайте отговор

Влезте, за да публикувате отговор.