170 likes | 241 Views
Greasemonkey. Angela Kille 20 March 2006 INF385T Semantic Web. Overview. What is Greasemonkey? User scripts Examples Semantic web connection Related tools. What is Greasemonkey?. Firefox extension Download from: greasemonkey.mozdev.org
E N D
Greasemonkey Angela Kille 20 March 2006 INF385T Semantic Web
Overview • What is Greasemonkey? • User scripts • Examples • Semantic web connection • Related tools
What is Greasemonkey? • Firefox extension • Download from: greasemonkey.mozdev.org • Change the behavior of web pages by installing user scripts • Download • Write your own • Alter existing scripts
User Scripts • Single file written in JavaScript • Filename must end in: .user.js • Customizes one or more web pages • Can do anything JavaScript can do – and more because Greasemonkey provides special API functions
User Scripts: Install • User scripts • userscripts.org – repository of user scripts • Greasemonkey Hacks by Mark Pilgrim (2006) • Install • Tools | Install this user script… • Code new user script • Tools | New user script…
User Scripts: Manage • Firefox Tools menu | Manage user scripts… • See list of installed user scripts • Change configurations (included/excluded pages) • Disable scripts temporarily • Uninstall scripts • Edit user scripts “live” (Tools | Manage user scripts… | select script, then click Edit)
User Scripts: Metadata Hello World User Script // ==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== alert('Hello world!');
User Scripts: Metadata (directives) // @include * // @exclude http://diveintogreasemonkey.org/* // @exclude http://www.diveintogreasemonkey.org/* // @exclude http://*.google.com/* // @exclude http://www.amazon.tld/* • Wildcards
Examples: Links • Linkifier user script • Turns plain text URLs and email addresses into clickable links • See it in action at: • http://www.mnot.net/blog/2005/05/18/WADL
Examples: Forms • Textarea Resize user script • Make textareas larger by pressing Ctrl-Enter or Ctrl-Spacebar in a textarea • Textareas can be shrunk by pressing Shift-Ctrl-Enter and Shift-Ctrl-Spacebar • Test at: • http://www.htmlcodetutorial.com/forms/_TEXTAREA.html
Examples: Search • Search Onsite user script • Search current website’s content with Google • Results displayed floating on the page you are currently viewing • Test at: • http://www.ischool.utexas.edu/
Examples: Libraries • Amazon SPL Linky user script • Search the Seattle Public Library catalog from Amazon book listings • Google Books AADL Linky user script • Search the Ann Arbor District Library holdings from Google Books
Examples: Magic Line • Magic Line user script • Collects all the metadata it can find as you browse the web: • URL, page title, people’s names, article descriptions, tags & keywords, referrer URLs, RSS & Atom feeds, FOAF files
Semantic Web • Site integration with Greasemonkey API function • Allows user scripts to get and post data to any site at any time • APIs – Amazon, Google, etc.
Related Tools • Platypus extension for Firefox • http://platypus.mozdev.org/ • Modify a web page from your browser (WYSIWYG) and save those changes as a Greasemonkey script • Greasemonkey compiler • http://www.letitblog.com/greasemonkey-compiler/ • Form that converts Greasemonkey user scripts into Firefox extensions (XPI file)
References Brooks, T. A. (2005, July). Watch this: Greasemonkey the Web. Information Research, 10(4). Retrieved March 14, 2005, from http://informationr.net/ir/10-4/TB0507.html Filman, R.E. (2006, Jan.-Feb.). Taking back the Web. IEEE Internet Computing, 10(1), 3-5. Retrieved March 14, 2005, from IEEE. Pilgrim, M. (2005, Nov. 11). Avoid common pitfalls in greasemonkey: How the history of greasemonkey security affects you now. Retrieved March 14, 2005, from O'Reilly Network Web site: http://www.oreillynet.com/pub/a/network/2005/11/01/avoid-common-greasemonkey-pitfalls.html Pilgrim, M. (2005). Dive into greasemonkey. Retrieved March 14, 2005, from http://diveintogreasemonkey.org/ Pilgrim, M. (2006). Greasemonkey hacks: Tips & tools for remixing the Web with Firefox. Sebastopol, CA: O'Reilly. Pilgrim, M. (2005, Sept. 1). What is greasemonkey. Retrieved March 14, 2005, from O'Reilly Network Web site: http://www.oreillynet.com/pub/a/network/2005/09/01/what-is-greasemonkey.html Other Resources: mozdev.org - greasemonkey … http://greasemonkey.mozdev.org/ download greasemonkey for Firefox userscripts.org … http://userscripts.org/ repository for greasemonkey user scripts