我有这个小书签,它遵循本主题中的建议:
javascript: (function () {
var jsCode = document.createElement('script');
jsCode.setAttribute('src', 'http://path/to/external/file.js');
document.body.appendChild(jsCode);
}());
Run Code Online (Sandbox Code Playgroud)
我的问题是,如何为服务器脚本提供一些参数(例如页面标题)?服务器脚本如下(到目前为止只是一些 PoC):
(function(message){
alert(message + " " + Math.random()*100);
})();
Run Code Online (Sandbox Code Playgroud) 我想要一个javascript书签,它将在我的网站上的"喜欢"按钮上"点击".它用于自动程序,因此它可以自动使该用户像我的程序的主页.
这可能吗?
我正在尝试.click()数组中的所有项目,我该怎么做?
无法使用JQuery。
var information = document.getElementsByClassName("menu-list-element menu-list-element-basic clickable with-icon-left with-icon-right ");
for (i = 10; i < information.length; i++) {
//.click() all items in the information array
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试制作一些书签来浏览网络应用程序.
对于某些链接和操作,它们就像拥有bookmarklet一样简单javascript: tabClick('func');,对于其他人来说,如果我检查元素它们的href值是无效的,我只能得到这些长链接.
<a id="id_value" eventvalue="Do Action">Do Action</a>
Run Code Online (Sandbox Code Playgroud)
有没有办法有一个模拟点击的书签Do Action?
我不太确定如何将此代码从小书签转换为用户脚本,因为它使用URL编码的字符:
javascript:var%20multiURL="";%20$('div.titlebox').find('ul.subreddits').find('a').each(function()%20{%20multiURL%20+=%20$(this).text().substr(3)%20+%20"+";%20});%20multiURL%20=%20multiURL.substr(0,multiURL.length-1);%20window.open('http://www.reddit.com/r/'+multiURL);void(0);
Run Code Online (Sandbox Code Playgroud)
有想法吗?