Greasemonkey Hacks/Getting Started

< Greasemonkey Hacks

Greasemonkey Hacks

Foreword

Credits

Preface

Chapter 1: Getting Started

Chapter 2: Linkmania!

Chapter 3: Beautifying the Web

Chapter 4: Web Forms

Chapter 5: Developer Tools

Chapter 6: Search

Chapter 7: Web Mail

Chapter 8: Accessibility

Chapter 9: Taking Back the Browser

Chapter 10: Syndication

Chapter 11: Site Integration

Chapter 12: Those Not Included in This Classification

Colophon

Contents [hide]

1 Hacks 1–12: Introduction

2 Install a User Script

2.1 Installing from the Context Menu

2.2 Installing from the Tools Menu

2.3 Editing Greasemonkey's Configuration Files

3 Provide a Default Configuration

3.1 The Code

3.2 Wrapper

3.3 Name

3.4 Namespace

3.5 Description

3.6 URL Directives

4 Master the @include and @exclude Directives

4.1 Matching with or Without the www. Prefix

4.2 Matching All Subdomains of a Site

4.3 Matching Different Top-Level Domains of a Site

4.4 Deciding Between * and http://*

5 Prevent a User Script from Executing

5.1 Disabling a User Script Without Uninstalling It

5.2 Disabling All User Scripts

5.3 Disabling a User Script by Removing All Included Pages

5.4 Disabling a User Script by Excluding All Pages

5.5 Disabling a User Script by Editing config.xml

5.6 Uninstalling a User Script

6 Configure a User Script

6.1 Inline

6.2 During Installation

6.3 After Installation

6.4 Editing Configuration Files

7 Add or Remove Content on a Page

7.1 Adding an Element

7.2 Removing an Element

7.3 Inserting an Element

7.4 Replacing an Element

7.5 Modifying an Element's Attributes

8 Alter a Page's Style

8.1 Adding a Global Style

8.2 Inserting or Removing a Single Style

8.3 Modifying an Element's Style

9 Master XPath Expressions

9.1 Basic Syntax

9.2 Examples

10 Develop a User Script "Live"

10.1 Setting Up File Associations

10.1.1 On Mac OS X.

10.1.2 On Windows.

10.2 The "Live Editing" Development Cycle

11 Debug a User Script

11.1 Check Error Messages

11.2 Log Errors

11.3 Find Page Elements

11.4 Test JavaScript Code Interactively

12 Embed Graphics in a User Script

12.1 The Code

12.2 Running the Hack

13 Avoid Common Pitfalls

13.1 Security Hole #1: Source Code Leakage

13.2 Security Hole #2: API Leakage

13.3 Security Hole #3: Local File Access

13.4 Redesigning from the Ground Up

13.5 Going Deeper

13.6 Pitfall #1: Auto-eval Strings

13.7 Pitfall #2: Event Handlers

13.8 Pitfall #3: Named Forms and Form Elements

13.9 Pitfall #4: Custom Properties

13.10 Pitfall #5: Iterating Collections

13.11 Pitfall #6: scrollIntoView

13.12 Pitfall #7: location

13.13 Pitfall #8: Calling Remote Page Scripts

13.14 Pitfall #9: watch

13.15 Pitfall #10: style

13.16 Conclusion

Hacks 1–12: Introduction

The first thing you need to do to get started with Greasemonkey is install it. Open Firefox and go to http://greasemonkey.mozdev.org. Click the Install Greasemonkey link. Firefox will warn you that it prevented this site from installing software, as shown in Figure 1-1.

Figure 1-1. Firefox, requiring you to whitelist sites to install extensions

Click the Edit Options button to bring up the Allowed Sites dialog, as shown in Figure 1-2.

Figure 1-2. Allowed Sites dialog

Click the Allow button to add the Greasemonkey site to your list of allowed sites; then click OK to dismiss the dialog. Now, click the Install Greasemonkey link again, and Firefox will pop up the Software Installation dialog, as shown in Figure 1-3.

Figure 1-3. Software Installation dialog

Click Install Now to begin the installation process. After it downloads, quit Firefox and relaunch it to finish installing Greasemonkey.

Now that that's out of the way, let's get right to it.

Install a User Script

Greasemonkey won't do anything until you start installing user scripts to customize specific web pages.

A Greasemonkey user script is a single file, written in JavaScript, that customizes one or more web pages. So, before Greasemonkey can start working for you, you need to install a user script.

Tip

Many user scripts are available at the Greasemo

最新文章

  1. 代码片段添加智能提示,打造一款人见人爱的ORM框架
  2. Excel 回归分析
  3. 点燃圣火! Ember.js 的初学者指南
  4. #8.12.16总结#background transition、animation、transform
  5. 全信号高清DVI编码器|上海视涛科技
  6. 如何配置和使用Spring框架的bean
  7. C#常用扩展方法
  8. Java——网络编程
  9. Beaglebone Back学习三(开发环境搭建)
  10. HW3.24
  11. JVM 学习笔记
  12. 被忽视的eMMC——A1 SD Bench闪存测试
  13. xfire找不到services.xml
  14. 简析MFC中CString用作C字符串
  15. Collection类学习笔记
  16. Centos下安装 .net Core运行程序
  17. Linux内核调试方法
  18. array_filter、array_walk、array_map的区别
  19. 定制kickstart重建CentOS7.5镜像用于U盘引导安装
  20. day25 面向对象继承,多态,

热门文章

  1. Bootstrap3适配IE8浏览器的方法
  2. laravel5.5任务调度
  3. shell判断文件是否存在[转]
  4. QBASIC教程
  5. Pascal ASCII和文本的转换
  6. 自己搭建php服务器(可接受表单提交,并返回页面)
  7. An internal error occurred during: &quot;Launching on Tomcat 7.x&quot;
  8. win10 64位 C# 连接oracle 32位, 遇到的问题及解决
  9. ThreadLocal 学习
  10. git使用及一些配置、问题