scriptish(scriptish的使用示例)

发布时间:2025-12-11 01:58:27 浏览次数:1

  首先,是学校的教务网页使用了innerText属性,所以我想自己写一个UserScript脚本来实现innerText属性。

  如何使用Scriptish

  其实,只要执行如下脚本后,就有了innerText属性了:

if(!!document.getBoxObjectFor||window.mozInnerScreenX!=null){  HTMLElement.prototype.__defineGetter__("innerText",function(){  returnthis.textContent;  });  HTMLElement.prototype.__defineSetter__("innerText",function(value){  this.textContent=value;  });  }

  但是,我自己写了脚本之后,仍然无法设置innerText属性,提示TypeError:HTMLElement.prototype.__defineGetter__isnotafunction

  请问如何解决?

  另外,innerText属性在onload代码中就使用了。

  我觉得Scriptish的权限控制也是需要考虑的。

  Scriptish权限

  附上我写的测试脚本:

//==UserScript==  //@nameTest  //@namespacewww.example.com  //@include*  //@version1  //==/UserScript==  if(!!document.getBoxObjectFor||window.mozInnerScreenX!=null){  HTMLElement.prototype.__defineGetter__("innerText",function(){  returnthis.textContent;  });  HTMLElement.prototype.__defineSetter__("innerText",function(value){  this.textContent=value;  });  }

感谢各位的阅读!关于“scriptish的使用示例”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

scriptish
需要做网站?需要网络推广?欢迎咨询客户经理 13272073477