讨论 » 开发

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

woxxom管理员
§
发表于: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

woxxom管理员
§
发表于: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. =/

woxxom管理员
§
发表于: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.

woxxom管理员
§
发表于: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

woxxom管理员
§
发表于: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.

woxxom管理员
§
发表于: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

woxxom管理员
§
发表于: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.

woxxom管理员
§
发表于: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!

发表回复

登录(不可用)以发表回复。

长期地址
遇到问题?请前往 GitHub 提 Issues。