JavaScript which automatically maintains lists with resource version identification.
The list ist formatted as JavaScript source code. By loading into some context the content is directly available then somewhere else.
Usage
editJust load the js file within your user script:
mw.loader.load("//en.wikipedia.org/w/index.php?title="
+ "User:PerfektesChaos/js/versionControl/r.js"
+ "&action=raw&ctype=text/javascript",
"text/javascript");
Standard execution will be performed automatically.
All articles (typically JavaScript or CSS) are checked whether the corresponding list entry is still up to date. If not, the list script will be modified automatically after all, within some 15 or 10 seconds.
In order to get permission for editing it is necessary to be logged in when executing the script.
Loading and execution may be linked to the situation of viewing some resources in the list. This happens immediately after saving the resource. Unfortunatey, there is no after-save-hook in the editing process.
The script is designed to be used across wiki domains. Within the same wiki a query for revision ID via API would be straight, which is denied for cross site security reasons.
Format
edit- Every entry is one array with three elements:
- Path to article (resource)
- Currently and by default it points to a sub page of the current user.
- Revision ID
revid
orcurid
of the latest resource version. - Time stamp (ISO 8601)
- Path to article (resource)
- The list of entries is stored as an array.
- The first entry of this array is an array with one element, a string. It is set to the most recent update of the list.
mw.libs.versionControl.proj.enwiki.PerfektesChaos.rv = [
["Fri, 11 Mar 2011 19:06:55 GMT"],
["js/versionControl/d.js",418336805,"2011-03-11T19:02:06Z"],
["js/versionControl/r.js",418337480,"2011-03-11T19:06:50Z"],
... ];
Example
editConfiguration
editAll variables have default values, but may be adjusted to particular requirements.
For user specification an application object ist to be defined (best before mw.loader.load) by:
mw.libs.versionControl = { opt: { store: "User:Usy/vc.js",
signer: "Usy",
symbol: "myVersions"
}
};
.opt.store
editLocation of the list script.
Default: User:
wgUserName/versionControl.js
.opt.signer
editNickname for the hosting user.
Default: wgUserName
.opt.symbol
editName of a particular global variable which has to be declared as an object (that includes Array) in advance.
Default: see VersionInfo
VersionInfo
editCurrent version information is available as object at
.proj[
DBNAME][
Nick].rv
- DBNAME –
wgDBname
, likeenwiki
- Nick –
.opt.signer
- DBNAME –
- …
.rv
is just the Array read from stored list page.
Codes
editResourceLoader
editModule ID:
user:PerfektesChaos/versionControl
Sources
edit
[ German page ]