summaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-12-03 09:20:55 +0100
committerPierre Schmitz <pierre@archlinux.de>2011-12-03 09:20:55 +0100
commita22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (patch)
tree31882fdc36540fecfd62e5011fc38515e504a3db /resources
parent6ca0c5e0a943b64b4e3d0a11a80c5679f7252e64 (diff)
Update to MediaWiki 1.17.1
Diffstat (limited to 'resources')
-rw-r--r--resources/jquery/jquery.highlightText.js10
-rw-r--r--resources/mediawiki.util/mediawiki.util.js4
-rw-r--r--resources/mediawiki/mediawiki.js2
3 files changed, 10 insertions, 6 deletions
diff --git a/resources/jquery/jquery.highlightText.js b/resources/jquery/jquery.highlightText.js
index 7ca29efd..44ac56e1 100644
--- a/resources/jquery/jquery.highlightText.js
+++ b/resources/jquery/jquery.highlightText.js
@@ -21,10 +21,12 @@ $.highlightText = {
// if this is a text node
if ( node.nodeType == 3 ) {
// TODO - need to be smarter about the character matching here.
- // non latin characters can make regex think a new word has begun.
- // look for an occurence of our pattern and store the starting position
- var pos = node.data.search( new RegExp( "\\b" + $.escapeRE( pat ), "i" ) );
- if ( pos >= 0 ) {
+ // non latin characters can make regex think a new word has begun: do not use \b
+ // http://stackoverflow.com/questions/3787072/regex-wordwrap-with-utf8-characters-in-js
+ // look for an occurence of our pattern and store the starting position
+ var match = node.data.match( new RegExp( "(^|\\s)" + $.escapeRE( pat ), "i" ) );
+ if ( match ) {
+ var pos = match.index + match[1].length; // include length of any matched spaces
// create the span wrapper for the matched text
var spannode = document.createElement( 'span' );
spannode.className = 'highlight';
diff --git a/resources/mediawiki.util/mediawiki.util.js b/resources/mediawiki.util/mediawiki.util.js
index 5e6afc01..4258cb0c 100644
--- a/resources/mediawiki.util/mediawiki.util.js
+++ b/resources/mediawiki.util/mediawiki.util.js
@@ -139,7 +139,9 @@
var re = new RegExp( '[^#]*[&?]' + $.escapeRE( param ) + '=([^&#]*)' );
var m = re.exec( url );
if ( m && m.length > 1 ) {
- return decodeURIComponent( m[1] );
+ // Beware that decodeURIComponent is not required to understand '+'
+ // by spec, as encodeURIComponent does not produce it.
+ return decodeURIComponent( m[1].replace( /\+/g, '%20' ) );
}
return null;
},
diff --git a/resources/mediawiki/mediawiki.js b/resources/mediawiki/mediawiki.js
index 6518479a..03f92844 100644
--- a/resources/mediawiki/mediawiki.js
+++ b/resources/mediawiki/mediawiki.js
@@ -134,7 +134,7 @@ window.mediaWiki = new ( function( $ ) {
* @return boolean Existence of key(s)
*/
Map.prototype.exists = function( selection ) {
- if ( typeof keys === 'object' ) {
+ if ( typeof selection === 'object' ) {
for ( var s = 0; s < selection.length; s++ ) {
if ( !( selection[s] in this.values ) ) {
return false;