微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用 Greasemonkey 覆盖匿名功能

如何解决使用 Greasemonkey 覆盖匿名功能

我正在尝试使用 Greasemonkey 更改此代码以不使用“world”,而是使用 window.location.href 以便在选择下拉选项时,它保持在同一页面上,但只更改 suid。

页面代码

$folderPath = 'M:\abc\WORKFORCE\Media\Attachments' 
 
Write-Host "Executing Script..." 
 
foreach ($file in Get-ChildItem $folderPath -file)
{
       # execute code 
}

我的尝试:

<script type="text/javascript">
$('#charselectdropdown').on('select2:select',function (e) {
  var data = e.params.data;
  if(data.id > 0) {
    window.location = '/world?suid=' + data.id + '&serverid=2';
  }
  else {
    window.location = '/myaccount';
  }
});
</script>

我也试过用这个:

功能

// ==UserScript==
// @name           The OW Helper
// @include        *.outwar.com/*
// @exclude        *.outwar.com/myaccount*
// @require        https://gist.github.com/raw/2620135/checkForBadJavascripts.js
// @require        http://code.jquery.com/jquery-latest.js
// @grant          GM.setClipboard
// @grant          GM_openInTab
// @grant          GM_registerMenuCommand
// @grant          GM_addStyle
// @run-at         document-start

// ==/UserScript==
(function (w) {
    function pre_script_execute_handler (e) {
        var target = e.target;
        if (target.innerHTML.indexOf("$('#charselectdropdown').on(") != -1) {
            console.log('Removed');
            e.preventDefault();
            e.stopPropagation();
            addBack();
        }
    }
  
    w.addEventListener('beforescriptexecute',pre_script_execute_handler);

    function addBack () {
      console.log('Adding new');
      
      w.$('#charselectdropdown').on('select2:select',function (e) {
        var data = e.params.data;

        if(data.id > 0) {
          window.location = '/' + window.location.href + '?suid=' + data.id + '&serverid=2';
        }
        else {
          window.location = '/myaccount';
        }
      });
    }


}) (unsafeWindow);

这些似乎都不适合我。谁能告诉我这是什么问题?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。