* Previously $(document).ready(mw.util.init) was in module 'mediawiki.page.ready' (position: bottom). I've now moved this to 'mediawiki.page.startup' so that it'll be enqueued sooner.
* This making it more likely that if someone also enqueues in document-ready that mw.util.init ran before than and thus mw.util.$content populated
* Fixes bug 33711
* All this is still depends on the order in which the event handler queue is executed, which is risky. Bug 30713 will bring the solid "watertight" solution
* Use mw.Api and new it's new .watch() as of r107350
* No longer get title from url, use wgPageName instead
* No longer simple queryParam check for action in url,
now supports wgActionPaths as well.
* Simplification and speed up (less back and forth between
functions and jQuery-ism). Previously it had $(..) with several
.add() calls. Now doing one call.
* Uses mw.util.tooltipAccessKeyRegexp instead of local regex
* Uses jQuery.fn.text instead of jQuery.fn.html for link text message
* Should fix bug 27146 (previously a failed attempt in r82498)
* Previousy worked on in r88527, r88511, r78150, r78147
* minor whitespace/comment fix in mediawiki.util.js/mediawiki.page.startup.js
Browser sniffing is bad, and having these here encourages unpleasantness.
Keeping the js/nojs ones as those are useful and non-evil (they're an example of feature detection, exposed via CSS here rather than through JS.)
* Move js/css/images from core into extension dir (kept svn history in tact)
* Removed from core:
** Messages
** Resource definition
** Default settings
* Recreated in extension:
** Messages with 'inlinecategorizer' prefix (instead of generic 'ajax' prefix).
** wgResourceModule definition
** Hooks for adding module to the page
** Setting wgAJAXCategoriesNamespaces kept (renamed to $wgInlineCategorizerNamespaces)
* Made minor adjustments to the messages:
** Fixed references to other messages (in /qqq) with the new message key
* Made minor adjustments to the javascript:
** Usage of mw.msg fixed to the new message keys
** Removed "@since 1.19"
** Removed "Relies on mw.user.getId" (because it didn't', and still doesn't)
** Object 'mw.ajaxCategories' -> 'mw.InlineCategorizer' (capitalized, since it's a constructor, per our conventions)
** Removed 'disableAJAXCategories' config, not needed.
Summary of justification for move out of core (again):
* Too many issues with the parsing logic (many cases still don't work yet)
* Almost untested and untestable because of mixing UI with logic code. Needs separation.
* See http://www.mediawiki.org/wiki/User:Krinkle/Extension_review/InlineCategorizer#Prequel
One day we might move it in, or if the "new parser" is ready and the "visual editor" we might not need it all together and it'd simply be a 10-20 line module in the visual editor (that, or it'd be part of the visual editor by default).
Anyway, I'm not against this module. if we can get this to an acceptable state soonish before any of the new parser / visual editor is ready, then I see no problem in bundling it with core and/or merging it into core.
* When changing the name of a category and saving it, this error is thrown from $.ucFirst. Although the script does check for it to be a string, what happens between that and ucFirst is broken. It should always set 'category' of splitresult[0], not just if there is a [1] (=sortkey). Otherwise, if there is no sortkey, 'category' is undefined.
* Also updated outdated comment saying that variable sortkey contains wikitext between "[[Category:Foo" and "]]" (which implies it includes the pipe, which is no longer true)
Follows-up r93351.
* Mostly whitespace in callers: $('foo').bar(baz,quux) => $( 'foo' ).bar( baz, quux )
* Also several occurrences of mixes spaces and tabs in the indention in front of a line, converted to tabs.
* And double spaces -> single spaces at random.
* Html-escaping unescaped message in summaryHolder
* Check for errors in the API response
* Pass true for existence of redirect origin and value of 'exists' for target (instead of backwards)
* Comment fixes
* Using typeof check in clean()
* Use mw.Title to get page title from fullpagename instead of split(':')
* replaceNowikis() and restoreNowikis()
- Improve documentation
- Moved dash in the UNIQUEKEY to between the id and the incrementing integer, and made it start with an empty string (so that all following concatenations are toString'ed).
* makeCaseInsensitive(): Moved the wgCaseSensitiveNamespaces-check out and wrapped it around the caller instead. Also cached the outcome of "Is category namespace sensitive ?".
* createButton(): text-argument is indeed text, not html. Applying html-escaping.
* resolveRedirects():
- Replace access to private property _name of mw.Title with function getMainText().
* handleCategoryAdd() and handleEditLink():
- Restructure title-handling (no local replace() calls and clean(), let mw.Title handle it)
- Renaming arguments and documenting them better
- Renaming local variables and removing redundant parts
- Preserving sortkey as sortkey as long as possible without the pipe
- Calling the combination of sortkey and leading pipe 'suffix' instead of, also, sortkey.
* createCatLink():
- Remove the sanitizing here, the string passed is already clean as it comes from mw.Title now
- Using .text() instead of .append( which is .html-like), category names can contain special characters.
* containsCat():
- Using $.each instead of [].filter. Stopping after first match.
* buildRegex(): Allow whitespace before namespace colon, and allow whitespace after category name (but before ]] and |..]])
Additional changes not for any function in particular:
* Literally return null in $.map callbacks.
* Using the existence-system of mw.Title instead of passing around booleans everywhere
** Removed 'exists' argument from the resolveRedirects() and handleCategoryAdd() functions, instead checking .exists() of the mw.Title object.
* Passing and using mw.Title objects where possible instead of converting back and forth between strings and objects etc.
* Using "TitleObj.getUrl()" instead of "catUrl( titleString )". Removed now unused catUrl() function.
* To improve readability, renamed local uses of 'var that = this' to 'var ajaxcat = this'.
* Syntax error fixes (.parent -> .parent())
* Merging var statements
* Renamed generic members of 'stash' from 'stash.summaries' to 'stash.dialogDescriptions' and 'stash.shortSum' to 'stash.editSummaries'. dialogDescription is always HTML (input should be escaped before hand)
Solving syntax problems, performance improvements and applying code conventions:
* Replaced sprite image with separate images and letting ResourceLoader embed them with @embed (@embed means 0 http requests, less maintenance, none of the known limitations with sprites, and more readable code (named files rather than pixel offsets)
* Many functions were floating in the global namespace (like window.makeCaseInsensitive). A statement ends after a semi-colon(;). All functions declared after "catUrl" were assigned to the window object. I've instead turned the semi-colons back into comma's, merged some other var statements and moved them to the top of the closure. Changed local function declarations into function expressions for clarity.
* fetchSuggestions is called by $.fn.suggestions like ".call( $textbox, $textbox.val() )". So the context (this) isn't the raw element but the jQuery object, no need to re-construct with "$(this)" or "$(that)" which is slow and shouldn't even work. jQuery methods can be called on it directly. I've also replaced "$(this).val()" with the value-argument passed to fetchSuggestions which has this exact value already.
* Adding more function documentation. And changing @since to 1.19 as this was merged from js2-branch into 1.19-trunk and new features aren't backported to 1.18.
* Optimizing options/default construction to just "options = $.extend( {}, options )". Caching defaultOptions is cool, but doesn't really work if it's in a context/instance local variable. Moved it up to the module closure var statements, now it's static across all instances.
* In makeSuggestionBox(): Fixing invalid html fragments passed to jQuery that fail in IE. Shortcuts (like '<foo>' and '<foo/>') are only allowed for createElement triggers, not when creating longer fragments with content and/or attributes which are created through innerHTML, in the latter case the HTML must be completely valid and is not auto-corrected by IE.
* Using more jQuery chaining where possible.
* In buildRegex(): Using $.map with join( '|' ), (rather than $.each with += '|'; and substr).
* Storing the init instance of mw.ajaxCategories in mw.page for reference (rather than local/anonymous).
* Applied some best practices and "write testable code"
** Moved some of the functions created on the fly and assigned to 'this' into prototype (reference is cheaper)
** Making sure at least all 'do', 'set' and/or 'prototype' functions have a return value. Even if it's just a simple boolean true or context/this for chain-ability.
** Rewrote confirmEdit( .., .., .., ) as a prototyped method named "doConfirmEdit" which takes a single props-object with named valuas as argument, instead of list with 8 arguments.
* Removed trailing whitespace and other minor fixes to comply with the code conventions.
** Removed space between function name and caller: "foo ()" => foo())
** Changing "someArray.indexOf() + 1" into "someArr.indexOf() !== -1". We want a Boolean here, not a Number.
** Renamed all underscore-variables to non-underscore variants.
== Bug fixes ==
* When adding a category that is not already on the page as-is but of which the clean() version is already on the page, the script would fail. Fixed it by moving the checks up in handleCategoryAdd() and making sure that createCatLink() actually returned something.
* confirmEdit() wasn't working properly and had unused code (such as submitButton), removed hidden prepending to #catlinks, no need to, it can be dialog'ed directly from the jQuery object without being somewhere in the document.
* in doConfirmEdit() in submitFunction() and multiEdit: Clearing the input field after adding a category, so that when another category is being added it doesn't start with the previous value which is not allowed to be added again...
* More natural messages
* Respect wgCaseSensitiveNamespaces
* Regex: Add possible whitespace between "[[Category:" and the category name. ( [[Category: Foo]] )
* Make nearly all functions publicly accessible
* Add "cancel all" button
* Submit on enter keypress
* Check for redirects
* Color links correctly based on existance of category page
* Add a summary of the changes done into the edit summary ('+Category:foo, -Category:Bar: Foo is not correct...')
* Add more error handlers
* Add more hooks ( afterChange/Delete/add ).
* Pass category names to the hooks
* Allow hooks to abort by returning false
* Handle sortkey correctly in all operations
* Move addCategory form below categories.
* Fix any known IE6 and IE7 bugs.
* Add more documentation
* Partial revert of r92264. mw.ajaxCategories has nothing to do with mediawiki.util.init, moved into separate initiation module, only loaded when ajax categories is enabled.
* Removing instantiation from the script. mw.ajaxCategories is now a public accessible constructor
* Fix Uncaught ReferenceError: wgUserGroups is not defined
($wgLegacyJavaScriptGlobals = false;)
* Renamimng stripIllegals() to clean(), adding '#' to the regex as those are not allowed either.
* Combining var statements by separating them with comma's ( var foo, bar, baz; ) instead of "var foo; var bar; var baz;"svn up
* Using dot.notation for objects instead of array-like['string'] keys
* Whitespace conventions
* Using inArray utility instead of indexOf (cross-browser support, mostly IE6)
** $.inArray uses Array.prototype.indexOf if available, otherwise fallback to a loop. mw.util.inArray is a wrapper around $.inArray to return a boolean value (since inArray/indexOf may return 0)
* Don't use $( '#bodyContent' ) (skin specific) but mw.util.$content
* Using mw.Title
* Re-using helper functions from the outer-closure instead of re-declaring them privately for every instance again (performance!)
Follows-up: r92112, r92151, r92264
* Restructuring to allow both private and public functions/objects.
* Add an error when category alread present, instead of quitting silently.
* Add documentation to most functions.
* Remove hardcoded api.php (Thanks Krinkle)
Ping r92062
Follows-up:
* r75275: Introduced the updateTooltipAccessKeys function in the new library but didn't call it on document ready and left the deprecated one in the onloadhook-run in wikibits.js untouched
* r75287: Introduced jquery.checkboxShiftClick and called on-load but left the load call for the legacy version untouched. Depending on the load order at any given time it may not have been used.
Also reordering the if-else case in mw.util.updateTooltipAccessKeys to allow a call without arguments ("undefined instanceof Foo" throws exception)
First step towards cleaning up mw.util.init and removing bugus dependancies on mediawiki.util which are just added there in order to load them on every page and do something on-load.
Introducing mediawiki.page.startup (in the head) and mediawiki.page.ready (on the bottom)
Moved the following to them:
* document.ready from jquery.cient
-- Shouldn't have been in the plugin itself in the first place
* jquery.placeholder
* jquery.makeCollapsible
* mediawiki.action.view.tablesorting
* jquery.checkboxShiftClick
(This also solves part of bug 26799)