NGAL_MutationDetective

Detects DOM changes of Neverwinter Gateway, and triggers appropriate functions

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.gf.qytechs.cn/scripts/10349/56139/NGAL_MutationDetective.js

  1. /*** Mutation Detective ***/
  2. var ngaMDTarget = document.querySelector('body');
  3. var ngaPage = [
  4. ['Login', '.login-page div#form input', ngaLoginPage], //#content_login - causes errors!!!
  5. ['Dungeons', '#content_dungeons'],
  6. ['Hero', '#content_charactersheet'],
  7. ['Inventory', '#content_inventory'],
  8. ['Professions', '#content_professions'],
  9. ['AH', '#content_auction'],
  10. ['ZEX', '#content_exchange'],
  11. ['Guild', '#content_guild'],
  12. ['Mail', '#content_mail']
  13. ];
  14. ngaMDoptions = {'childList': true, 'subtree': true};
  15. var ngaMD = new MutationObserver(function(allmutations) {
  16. allmutations.map(function(mr) {
  17. ngaPage.forEach(function testPage(pagedata) {
  18. var node2check = document.querySelector(pagedata[1]);
  19. // var attr2check = node2check.getAttribute('ngAdvanced');
  20. if (node2check){
  21. // console.log(pagedata[0] + ' page detected.');
  22. if(pagedata[2]){pagedata[2]();}
  23. // else {console.log('No defined function for ' + pagedata[0]);}
  24. }
  25. });
  26. });
  27. });
  28. function ngaMDGo() {ngaMD.observe(ngaMDTarget, ngaMDoptions);console.log ('Mutation observer ngaMD initiated');}
  29. function ngaMDStop() {ngaMD.disconnect();console.log ('Mutation observer ngaMD stopped');}
  30. /** EndOf Mutation Observer**/

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址