User:Whiteknight/Gadgetscore

User:Whiteknight
User talk:Whiteknight
User:Whiteknight/Book Foundry
User:Whiteknight/All Books
User:Whiteknight/New Book Guide
User:Whiteknight/Book Creator
User:Whiteknight/Images
User:Andrew Whitworth
R
L
P
Whiteknight Discussion Book Foundry All Books New Book Guide Book Creator Images About Me
Due to a severe shortage of time, I am no longer able to be an active member of the Wikibooks project. Please see my page for more details about my absense. I will continue to monitor my talk page for correspondence and will try to reply quickly when possible.

About

edit

This page is going to be some basic documentation about User:Whiteknight/gadgetscore.js. This script is a series of functions to make some of my common javascripting tasks easier. All functions have a "wk." prefix, to help reduce namespace pollution. Functions that start with an underscore are private functions, and will not be documented here. Don't try to use them, because they will likely be changed in future versions.

Versions

edit

The current version of the script can be gotten with wk.versionstring(). This will return a string of text such as Version 2.2 BETA. To test for particular functionality, try wk.testVersion(2.2). This will return true if the current script version is greater then or equal to the version you specify.

All functions will be listed with the version number required in parenthesis.

Functions

edit

Display Functions

edit
(2.1) displayConLine(String)
Turns the Wikibooks logo area in the upper-right of the screen into a display console, and posts the specified line of text to it.
(2.1) toggleDebug
toggles the debug state. Default value is false. returns the current debug state.
(2.1) debug(String)
If debug is true, posts the specified text to the console.

AJAX Methods

edit
(2.0) httpClient
Returns an XMLHttpRequest object
(2.0) loadPage(url, callback, type)
GET request for page at url. Passes result text to callback function. If type is specified, overrides the MIME type of the request to type. Default MIME type is "text/xml".
(2.0) loadWikiPage(page, callback)
(2.0) loadEditPage(page, callback)
(2.0) loadWikiText(page, callback)
Loads the raw wikitext from the specified page. Passes text to callback. Text has MIME type "text/x-wiki".
(2.3) postEdit(page, text, summary, filter)
Posts text to the page with the specified edit summary. filter is a function that can be used in place of a raw text post. If filter is provided, the text posted to the page is given by filter(pagetext, text), where pagetext is the current text of the page. Two predefined filters are wk.filter.append, and wk.filter.prepend.
(2.4) showEditWindow(page, parent)
Takes a loaded edit page, either XML formatted or as plain text, isolates the edit form, and appends that form to the parent. Returns an associative array with the entries "form", "text", and "summary", which are the editform, wpTextbox1, and wpSummary elements of the form, respectively.

Element Methods

edit
(2.0) makeElement()
(2.0) elementBuilder()
(2.0) makeButton()
(2.0) makeInput()
(2.2) appendChildren()
(2.0) spanText()
(2.0) spanEditor()
(2.2) appendSpanText()
(2.0) toggleDisplay()
(2.0) toggleDisable()
edit
(2.0) wikiLink()
(2.0) wikiLinkText()

Revision History

edit
  • 2.64 Improve handling of showEditWindow in Chrome and Safari