議論 » 開発

Cant make this script run with MutationObserver

§
投稿日: 2015/03/20

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
§
投稿日: 2015/03/20
編集日: 2015/03/21

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

§
投稿日: 2015/03/20

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

woxxomMod
§
投稿日: 2015/03/20
編集日: 2015/03/20

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.

§
投稿日: 2015/03/20

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

woxxomMod
§
投稿日: 2015/03/20

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

§
投稿日: 2015/03/20

^^
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.

§
投稿日: 2015/03/20

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
§
投稿日: 2015/03/20
編集日: 2015/03/20

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?

§
投稿日: 2015/03/20

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

§
投稿日: 2015/03/20

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

woxxomMod
§
投稿日: 2015/03/20

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.

§
投稿日: 2015/03/20

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

woxxomMod
§
投稿日: 2015/03/20
編集日: 2015/03/20

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.

§
投稿日: 2015/03/20

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

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

woxxomMod
§
投稿日: 2015/03/20

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.

§
投稿日: 2015/03/20

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

woxxomMod
§
投稿日: 2015/03/21

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

§
投稿日: 2015/03/21

xD
Thank you. You're the best!

返信を投稿

返信を投稿するにはログインしてください。