油猴脚本开发入门

最近火起来的12306.cn,顺带着火起来一些刷票的脚本。

一个很好玩的东西油猴脚本映入眼帘!

瞬间觉得自己会点JS,挺好。本着爱学习的态度,用晚上的时间做了个小的DEMO:http://www.dachie.com/userscript/

// ==UserScript==
// @name          Hello World
// @namespace     http://diveintogreasemonkey.org/download/
// @description   example script to alert "Hello world!" on every page
// @include       *
// @exclude       http://diveintogreasemonkey.org/*
// @exclude       http://www.diveintogreasemonkey.org/*
// ==/UserScript==

整体结构基本上是这样。

还可以// @require http://code.jquery.com/jquery-1.8.2.js 一些你需要的类库到油猴脚本中使用

学习地址:http://sebug.net/paper/books/greasemonkey/

作者:达奇
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
原文地址:https://www.cnblogs.com/dachie/p/2706508.html