this.id = id;
this.r = r;
this.query = query;
-}
+};
/** Property class for single search box */
window.os_Results = function( name, formname ) {
this.containerTotal = 0; // total height of the container will all results
this.visible = false; // if container is visible
this.stayHidden = false; // don't try to show if lost focus
-}
+};
/** Timer user to animate expansion/contraction of container width */
window.os_AnimationTimer = function( r, target ) {
this.inc = -os_animation_min_step;
}
this.target = target;
-}
+};
/******************
* Initialization
os_initHandlers( id, form, element );
}
}
-}
+};
/** Init Result objects and event handlers */
window.os_initHandlers = function( name, formname, element ) {
} */
}
-}
+};
window.os_hookEvent = function( element, hookName, hookFunct ) {
if ( element.addEventListener ) {
} else if ( window.attachEvent ) {
element.attachEvent( 'on' + hookName, hookFunct );
}
-}
+};
/********************
* Keyboard events
}
var query = targ.value;
os_fetchResults( r, query, os_search_timeout );
-}
+};
/** catch arrows up/down and escape to hide the suggestions */
window.os_processKey = function( r, keypressed, targ ) {
} else if( r.query != document.getElementById( r.searchbox ).value ) {
// os_hideResults( r ); // don't show old suggestions
}
-}
+};
/** When keys is held down use a timer to output regular events */
window.os_eventKeypress = function( e ) {
os_keypressed_count++;
os_processKey( r, keypressed, targ );
-}
+};
/** Catch the key code (Firefox bug) */
window.os_eventKeydown = function( e ) {
os_cur_keypressed = ( e.keyCode == undefined ) ? e.which : e.keyCode;
os_keypressed_count = 0;
-}
+};
/** When the form is submitted hide everything, cancel updates... */
}
}
return true;
-}
+};
}
r.visible = false;
r.selected = -1;
-}
+};
window.os_decodeValue = function( value ) {
if ( decodeURIComponent ) {
return unescape( value );
}
return null;
-}
+};
window.os_encodeQuery = function( value ) {
if ( encodeURIComponent ) {
return escape( value );
}
return null;
-}
+};
/** Handles data from XMLHttpRequest, and updates the suggest results */
window.os_updateResults = function( r, query, text, cacheKey ) {
os_cache[cacheKey] = null;
}
}
-}
+};
/**
* Create and populate a <datalist>.
r.results[i] = title;
c.appendChild( opt );
}
-}
+};
/** Fetch namespaces from checkboxes or hidden fields in the search form,
if none defined use wgSearchNamespaces global */
namespaces = wgSearchNamespaces.join('|');
}
return namespaces;
-}
+};
/** Update results if user hasn't already typed something else */
window.os_updateIfRelevant = function( r, query, text, cacheKey ) {
os_updateResults( r, query, text, cacheKey );
}
r.query = query;
-}
+};
/** Fetch results after some timeout */
window.os_delayedFetch = function() {
}
}
}
-}
+};
/** Init timed update via os_delayedUpdate() */
window.os_fetchResults = function( r, query, timeout ) {
os_timer = new os_Timer( null, r, query );
os_delayedFetch(); // do it now!
}
-}
+};
/** Find event target */
window.os_getTarget = function( e ) {
} else {
return null;
}
-}
+};
/** Check if x is a valid integer */
window.os_isNumber = function( x ) {
}
}
return true;
-}
+};
/** Call this to enable suggestions on input (id=inputId), on a form (name=formName) */
window.os_enableSuggestionsOn = function( inputId, formName ) {
os_initHandlers( inputId, formName, document.getElementById( inputId ) );
-}
+};
/** Call this to disable suggestios on input box (id=inputId) */
window.os_disableSuggestionsOn = function( inputId ) {
if ( index >= 0 ) {
os_autoload_inputs[index] = os_autoload_forms[index] = '';
}
-}
+};
/************************************************
* Div-only functions (irrelevant for datalist)
}
os_timer = null;
}
-}
+};
/** Event: focus (catch only when stopped) */
window.os_eventFocus = function( e ) {
return; // not our event
}
r.stayHidden = false;
-}
+};
/**
* Create and populate a <div>, for non-<datalist>-supporting browsers.
os_fitContainer( r );
os_trimResultText( r );
os_showResults( r );
-}
+};
/** Create the result table to be placed in the container div */
window.os_createResultTable = function( r, results ) {
}
html += '</table>';
return html;
-}
+};
/** Show results div */
window.os_showResults = function( r ) {
c.style.visibility = 'visible';
r.visible = true;
}
-}
+};
window.os_operaWidthFix = function( x ) {
// For browsers that don't understand overflow-x, estimate scrollbar width
return 30;
}
return 0;
-}
+};
/** Brower-dependent functions to find window inner size, and scroll status */
window.f_clientWidth = function() {
document.documentElement ? document.documentElement.clientWidth : 0,
document.body ? document.body.clientWidth : 0
);
-}
+};
window.f_clientHeight = function() {
return f_filterResults(
document.documentElement ? document.documentElement.clientHeight : 0,
document.body ? document.body.clientHeight : 0
);
-}
+};
window.f_scrollLeft = function() {
return f_filterResults(
document.documentElement ? document.documentElement.scrollLeft : 0,
document.body ? document.body.scrollLeft : 0
);
-}
+};
window.f_scrollTop = function() {
return f_filterResults(
document.documentElement ? document.documentElement.scrollTop : 0,
document.body ? document.body.scrollTop : 0
);
-}
+};
window.f_filterResults = function( n_win, n_docel, n_body ) {
var n_result = n_win ? n_win : 0;
n_result = n_docel;
}
return n_body && ( !n_result || ( n_result > n_body ) ) ? n_body : n_result;
-}
+};
/** Get the height available for the results container */
window.os_availableHeight = function( r ) {
absTop = absTop.substring( 0, px );
}
return f_clientHeight() - ( absTop - f_scrollTop() );
-}
+};
/** Get element absolute position {left,top} */
window.os_getElementPosition = function( elemID ) {
offsetTop += document.body.topMargin;
}
return { left:offsetLeft, top:offsetTop };
-}
+};
/** Create the container div that will hold the suggested titles */
-window.os_createContainer = function( r ) {
- var c = document.createElement( 'div' );
- var s = document.getElementById( r.searchbox );
- var pos = os_getElementPosition( r.searchbox );
+window.os_createContainer = function(r) {
+ var c = document.createElement('div');
+ var s = document.getElementById(r.searchbox);
+ var pos = os_getElementPosition(r.searchbox);
var left = pos.left;
var top = pos.top + s.offsetHeight;
c.className = 'os-suggest';
- c.setAttribute( 'id', r.container );
- document.body.appendChild( c );
+ c.setAttribute('id', r.container);
+ document.body.appendChild(c);
// dynamically generated style params
// IE workaround, cannot explicitely set "style" attribute
- c = document.getElementById( r.container );
+ c = document.getElementById(r.container);
c.style.top = top + 'px';
c.style.left = left + 'px';
c.style.width = s.offsetWidth + 'px';
// mouse event handlers
- c.onmouseover = function( event ) { os_eventMouseover( r.searchbox, event ); };
- c.onmousemove = function( event ) { os_eventMousemove( r.searchbox, event ); };
- c.onmousedown = function( event ) { return os_eventMousedown( r.searchbox, event ); };
- c.onmouseup = function( event ) { os_eventMouseup( r.searchbox, event ); };
+ c.onmouseover = function(event) {
+ os_eventMouseover(r.searchbox, event);
+ };
+ c.onmousemove = function(event) {
+ os_eventMousemove(r.searchbox, event);
+ };
+ c.onmousedown = function(event) {
+ return os_eventMousedown(r.searchbox, event);
+ };
+ c.onmouseup = function(event) {
+ os_eventMouseup(r.searchbox, event);
+ };
return c;
-}
+};
/** change container height to fit to screen */
window.os_fitContainer = function( r ) {
c.style.height = r.containerTotal + 'px';
r.containerCount = r.resultCount;
}
-}
+};
/** If some entries are longer than the box, replace text with "..." */
window.os_trimResultText = function( r ) {
document.getElementById( r.resultTable + i ).setAttribute( 'title', r.results[i] );
}
}
-}
+};
/** Invoked on timer to animate change in container width */
window.os_animateChangeWidth = function() {
c.style.left = ( normL + normW + ( target - nw ) - os_animation_timer.target - 1 ) + 'px';
}
}
-}
+};
/** Change the highlighted row (i.e. suggestion), from position cur to next */
window.os_changeHighlight = function( r, cur, next, updateSearchBox ) {
if( updateSearchBox ) {
os_updateSearchQuery( r, newText );
}
-}
+};
window.os_HighlightClass = function() {
var match = navigator.userAgent.match(/AppleWebKit\/(\d+)/);
}
}
return 'os-suggest-result-hl';
-}
+};
window.os_updateSearchQuery = function( r, newText ) {
document.getElementById( r.searchbox ).value = newText;
r.query = newText;
-}
+};
/********************
if( num >= 0 ) {
os_changeHighlight( r, r.selected, num, false );
}
-}
+};
/* Get row where the event occured (from its id) */
window.os_getNumberSuffix = function( id ) {
} else {
return -1;
}
-}
+};
/** Save mouse move as last action */
window.os_eventMousemove = function( srcId, e ) {
os_mouse_moved = true;
-}
+};
/** Mouse button held down, register possible click */
window.os_eventMousedown = function( srcId, e ) {
document.getElementById( r.searchbox ).focus();
return false; // prevents selection
-}
+};
/** Mouse button released, check for click on some row */
window.os_eventMouseup = function( srcId, e ) {
os_mouse_pressed = false;
// keep the focus on the search field
document.getElementById( r.searchbox ).focus();
-}
+};
/** Toggle stuff seems to be dead code? */
link.appendChild( msg );
t.appendChild( link );
return t;
-}
+};
/** Call when user clicks on some of the toggle links */
window.os_toggle = function( inputId, formName ) {
// change message
var link = document.getElementById( r.toggle ).firstChild;
link.replaceChild( document.createTextNode( msg ), link.firstChild );
-}
+};
hookEvent( 'load', os_MWSuggestInit );
} else {
hookFunct(); // bug in MSIE script loading
}
-}
+};
window.importScript = function( page ) {
// TODO: might want to introduce a utility function to match wfUrlencode() in PHP
encodeURIComponent(page.replace(/ /g,'_')).replace(/%2F/ig,'/').replace(/%3A/ig,':') +
'&action=raw&ctype=text/javascript';
return importScriptURI( uri );
-}
+};
window.loadedScripts = {}; // included-scripts tracker
window.importScriptURI = function( url ) {
s.setAttribute( 'type', 'text/javascript' );
document.getElementsByTagName('head')[0].appendChild( s );
return s;
-}
+};
window.importStylesheet = function( page ) {
return importStylesheetURI( wgScript + '?action=raw&ctype=text/css&title=' + encodeURIComponent( page.replace(/ /g,'_') ) );
-}
+};
window.importStylesheetURI = function( url, media ) {
var l = document.createElement( 'link' );
}
document.getElementsByTagName('head')[0].appendChild( l );
return l;
-}
+};
window.appendCSS = function( text ) {
var s = document.createElement( 'style' );
}
document.getElementsByTagName('head')[0].appendChild( s );
return s;
-}
+};
// Special stylesheet links for Monobook only (see bug 14717)
if ( typeof stylepath != 'undefined' && skin == 'monobook' ) {
toggleToc();
}
}
-}
+};
window.changeText = function( el, newText ) {
// Safari work around
} else if ( el.firstChild && el.firstChild.nodeValue ) {
el.firstChild.nodeValue = newText;
}
-}
+};
window.killEvt = function( evt ) {
evt = evt || window.event || window.Event; // W3C, IE, Netscape
evt.cancelBubble = true; // IE
}
return false; // Don't follow the link (IE)
-}
+};
window.toggleToc = function() {
var tocmain = document.getElementById( 'toc' );
tocmain.className = 'toc tochidden';
}
return false;
-}
+};
window.mwEditButtons = [];
window.mwCustomEditButtons = []; // eg to add in MediaWiki:Common.js
re = new RegExp( "\\n", "g" );
text = text.replace( re, "\\n" );
return escapeQuotesHTML( text );
-}
+};
window.escapeQuotesHTML = function( text ) {
var re = new RegExp( '&', "g" );
re = new RegExp( '>', "g" );
text = text.replace( re, ">" );
return text;
-}
+};
/**
* Set the accesskey prefix based on browser detection.
element.setAttribute( 'title', tip );
}
}
-}
+};
/**
* Add a link to one of the portlet menus on the page, including:
}
return item;
-}
+};
window.getInnerText = function( el ) {
if ( el.getAttribute( 'data-sort-value' ) !== null ) {
}
}
return str;
-}
+};
/* Dummy for deprecated function */
window.ta = [];
window.akeytt = function( doId ) {
-}
+};
window.checkboxes = undefined;
window.lastCheckbox = undefined;
lastCheckbox = null;
var inputs = document.getElementsByTagName( 'input' );
addCheckboxClickHandlers( inputs );
-}
+};
window.addCheckboxClickHandlers = function( inputs, start ) {
if ( !start ) {
addCheckboxClickHandlers( inputs, finish );
}, 200 );
}
-}
+};
window.checkboxClickHandler = function( e ) {
if ( typeof e == 'undefined' ) {
}
lastCheckbox = this.index;
return true;
-}
+};
/*
}
}
return ( arrReturnElements );
-}
+};
window.redirectToFragment = function( fragment ) {
var match = navigator.userAgent.match(/AppleWebKit\/(\d+)/);
});
}
}
-}
+};
/*
* Table sorting script based on one (c) 1997-2006 Stuart Langridge and Joost
}
ts_makeSortable( tables[ti] );
}
-}
+};
window.ts_makeSortable = function( table ) {
var firstRow;
if ( ts_alternate_row_colors ) {
ts_alternate( table );
}
-}
+};
window.ts_getInnerText = function( el ) {
return getInnerText( el );
-}
+};
window.ts_resortTable = function( lnk ) {
// get the span