* @class jQuery.plugin.suggestions
*/
- // jscs:disable checkParamNames
/**
* @method suggestions
* @chainable
* @param {boolean} [options.highlightInput=false] Whether to highlight matched portions of the
* input or not.
*/
- // jscs:enable checkParamNames
-( function ( $ ) {
+( function ( $, mw ) {
var hasOwn = Object.hasOwnProperty;
context.data.prevText = val;
// Try cache first
if ( context.config.cache && hasOwn.call( cache, val ) ) {
- if ( +new Date() - cache[ val ].timestamp < context.config.cacheMaxAge ) {
+ if ( mw.now() - cache[ val ].timestamp < context.config.cacheMaxAge ) {
context.data.$textbox.suggestions( 'suggestions', cache[ val ].suggestions );
if ( typeof context.config.update.after === 'function' ) {
context.config.update.after.call( context.data.$textbox, cache[ val ].metadata );
cache[ val ] = {
suggestions: suggestions,
metadata: metadata,
- timestamp: +new Date()
+ timestamp: mw.now()
};
}
},
// Don't interfere with special clicks (e.g. to open in new tab)
if ( !( e.which !== 1 || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey ) ) {
// This will hide the link we're just clicking on, which causes problems
- // when done synchronously in at least Firefox 3.6 (bug 62858).
+ // when done synchronously in at least Firefox 3.6 (T64858).
setTimeout( function () {
$.suggestions.hide( context );
}, 0 );
// Don't interfere with special clicks (e.g. to open in new tab)
if ( !( e.which !== 1 || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey ) ) {
// This will hide the link we're just clicking on, which causes problems
- // when done synchronously in at least Firefox 3.6 (bug 62858).
+ // when done synchronously in at least Firefox 3.6 (T64858).
setTimeout( function () {
$.suggestions.hide( context );
}, 0 );
27, // escape
13, // enter
46, // delete
- 8 // backspace
+ 8 // backspace
];
if ( context.data.keypressedCount === 0 &&
e.which === context.data.keypressed &&
* @mixins jQuery.plugin.suggestions
*/
-}( jQuery ) );
+}( jQuery, mediaWiki ) );