问题描述
我一直在搜索互联网,试图了解如何编写我自己的脚本,这比Hello World脚本复杂得多。
I大部分了解如何使用萤火虫(我有火狐)找到特定的元素。我理解的元数据,以及如何做到这一点。
我不知道我应该如何得到任何我想要的页面。无论是Facebook或其他网站的链接或标签。
任何人都可以帮助我得到一个完整的教程/指南,是最新的和容易理解的全部脚本初学者?
从您所描述的内容中,我怀疑符合您的标准的任何东西实际上只是一个Javascript教程额外的Greasemonkey特定部分/焦点
没有链接到许多指南和教程(可能在以后添加),但我真的认为你需要的是一个初学者的指南Javascript,例如。 Greasemonkey相关的主题,你需要阅读与DOM,改变DOM节点的风格和Greasemonkey API相关。所有其他你需要的将是通用的JavaScript,将特定于您正在创建的脚本。
-
DOM操作:
插入/编辑/删除节点(在HTML代码中) - 例如
< a>
nchors,< div>
< img> s
这就是额外的链接和标签等进入页面。
$ b具体来说,看看
appendChild()
,createNode()
和insertNodeBefore()
。 -
- 移动DOM(HMTL文档)并选择插入新节点的位置/选择将哪个节点删除到编辑器。
具体来说,查看XPATH,
getElement(s)由_____
,parentNode
querySelectorAll()
。
CSS使用Javascript
更改节点的CSS的基础是使用
.setAttribute()
设置'style'属性,或者使用nodeReference.style.cssAttribute ='value'
来改变特定的CSS属性。
再一次,这个东西将特定于你想在scrip中使用的东西你创建的,但基本包括
GM_getValue()
,GM_setValue()
,GM_log()
- 移动DOM(HMTL文档)并选择插入新节点的位置/选择将哪个节点删除到编辑器。
I have been searching the internet for days now trying to find out how to write my own script, one more complicated than the "Hello World" script.
I understand for the most part how to find specific elements using firebug (I have Firefox). I understand the metadata and how to do all that.
I do not however understand how I am supposed to get whatever I want into the page. Be it links or tabs for Facebook or other sites.
Can anyone help me get a full tutorial/guide that is up to date and easy to understand for total scriptwriting beginners?
From what you have described in the, I suspect that anything that meets your criteria will actually just be a Javascript tutorial with some extra Greasemonkey-specific sections / focus
There's not links to many guides and tutorials (might add them in later) but I really think that what you need is a beginner's guide to Javascript such as sections 1-8 (except 5) of the one provided at the Mozilla Developer Network.
Greasemonkey stuff:
Specifically, the Greasemonkey-related topics that you will need to read up on are related to the DOM, altering styles of DOM nodes, and the Greasemonkey API. All else that you need will be generic Javascript that will be specific to the script you are creating.
DOM Manipulation:
Inserting / editing / deleting "nodes" ( in the HTML code) - for example,
<a>
nchors,<div>
s,<img>
sThis is how the extra links and tabs etc are added into the page.
Specifically, look into
appendChild()
,createNode()
andinsertNodeBefore()
.DOM Traversal
Moving around the DOM (HMTL Document) and selecting where to insert the new nodes / selecting which nodes to editor delete.
Specifically, look into XPATH,
getElement(s)By_____
,parentNode
,querySelectorAll()
- https://developer.mozilla.org/en/Introduction_to_using_XPath_in_JavaScript
- https://developer.mozilla.org/en/docs/Web/API/Node/parentNode
.
CSS Using Javascript
The basics of changing the CSS of a node are to either use
.setAttribute()
to set the 'style' attribute, or to alter specific CSS properties usingnodeReference.style.cssAttribute = 'value'
.Greasemonkey API
Again, this stuff will be specific to what you want to use within the script you create but the basics include
GM_getValue()
,GM_setValue()
,GM_log()
这篇关于寻找Greasemonkey Scriptwriting的基础知识/教程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!