Tweichart has uploaded a new change for review.
https://gerrit.wikimedia.org/r/172251
Change subject: removed strict due to extjs crashes
......................................................................
removed strict due to extjs crashes
Change-Id: I729653edaaf6d19047e350618019a85562ba87a4
---
M resources/bluespice.extjs/bluespice.extjs.js
M resources/bluespice/bluespice.extensionManager.js
M resources/bluespice/bluespice.js
M resources/bluespice/bluespice.util.js
M resources/bluespice/bluespice.wikiText.js
5 files changed, 61 insertions(+), 66 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceFoundation
refs/changes/51/172251/1
diff --git a/resources/bluespice.extjs/bluespice.extjs.js
b/resources/bluespice.extjs/bluespice.extjs.js
index b147d6c..0eb3f2e 100644
--- a/resources/bluespice.extjs/bluespice.extjs.js
+++ b/resources/bluespice.extjs/bluespice.extjs.js
@@ -1,5 +1,4 @@
( function ( mw, bs, $, d,undefined ) {
- "use strict";
//This allows us to place anchortags with special data attributes
Ext.QuickTips.init();
diff --git a/resources/bluespice/bluespice.extensionManager.js
b/resources/bluespice/bluespice.extensionManager.js
index 0ee856a..d47bdc3 100644
--- a/resources/bluespice/bluespice.extensionManager.js
+++ b/resources/bluespice/bluespice.extensionManager.js
@@ -3,7 +3,6 @@
*/
( function ( mw, bs, $, undefined ) {
- "use strict";
/**
* ExtensionManager object
diff --git a/resources/bluespice/bluespice.js b/resources/bluespice/bluespice.js
index 8d008ec..d5c4fc1 100644
--- a/resources/bluespice/bluespice.js
+++ b/resources/bluespice/bluespice.js
@@ -3,8 +3,7 @@
*/
var bs = ( function ( mw, $, undefined ) {
- "use strict";
-
+
var bs = {
//TODO: maybe own file "bluespice.ns.js"?
ns: {
@@ -17,30 +16,30 @@
};
var namespaceIds = mw.config.get('wgNamespaceIds');
for( var lcNamespaceName in namespaceIds ) {
-
+
var namespaceId = namespaceIds[lcNamespaceName];
var ucNamespaceName = lcNamespaceName.toUpperCase();
if( namespaceId == 0 ) {
ucNamespaceName = 'MAIN';
}
bs.ns['NS_'+ucNamespaceName] = namespaceId;
-
+
//TODO: Known issue: Some NSIDs are duplicates: i.e. NS_FILE ad
NS_IMAGE
if( namespaceId < 0 ) {
bs.ns.filter.ONLY_CONTENT_NS.push( namespaceId );
}
-
+
if( namespaceId > 0 && namespaceId % 2 != 0 ) {
bs.ns.filter.NO_TALK.push( namespaceId );
}
-
+
if( namespaceId < 100 ) {
bs.ns.filter.ONLY_CUSTOM_NS.push( namespaceId );
}
}
-
+
return bs;
-
+
}( mediaWiki, jQuery ) );
// Attach to window and globally alias
diff --git a/resources/bluespice/bluespice.util.js
b/resources/bluespice/bluespice.util.js
index b16f99f..2d28893 100644
--- a/resources/bluespice/bluespice.util.js
+++ b/resources/bluespice/bluespice.util.js
@@ -1,5 +1,4 @@
(function(mw, bs, $, undefined) {
- "use strict";
/*N-glton-pattern*/
var alerts = {};
@@ -37,7 +36,7 @@
function _alert(idPrefix, windowCfg, callbackCfg) {
if (alerts[idPrefix])
return alerts[idPrefix];
-
+
if(!windowCfg.title && !windowCfg.titleMsg ) {
windowCfg.titleMsg = 'bs-extjs-hint';
}
@@ -59,7 +58,7 @@
function _confirm(idPrefix, windowCfg, callbackCfg) {
if (confirms[idPrefix])
return confirms[idPrefix];
-
+
if(!windowCfg.title && !windowCfg.titleMsg ) {
windowCfg.titleMsg = 'bs-extjs-confirm';
}
@@ -190,7 +189,7 @@
_startPos;
this.autoSelection = '';
-
+
this.reset = function() {
_selectedText = false;
_startPos = 0;
@@ -274,15 +273,15 @@
this.autoSelection = '';
};
}
-
-
+
+
function _timestampToAgeString( unixTimestamp ) {
//This is a js version of
"adapter/Utility/FormatConverter.class.php" -> timestampToAgeString
//TODO: use PLURAL (probably wont work in mw 1.17)
var start = (new Date(unixTimestamp));
var now = (new Date());
var diff = now - start;
-
+
var sDateTimeOut = '';
var sYears = '';
var sMonths = '';
@@ -320,10 +319,10 @@
else if (iMins > 0) sDateTimeOut = sSecs ? mw.message(
'bs-two-units-ago', sMins, sSecs).text() : mw.message( 'bs-one-unit-ago',
sMins).text();
else if (iSecs > 0) sDateTimeOut = mw.message(
'bs-one-unit-ago', sSecs).text();
else if (iSecs == 0) sDateTimeOut = mw.message( 'bs-now'
).text();
-
+
return sDateTimeOut;
}
-
+
/**
* Shows a message window
* @param {String} url The url providing the content for the window
@@ -343,11 +342,11 @@
win.show();
return win;
}
-
+
/**
- * Creates a new value object with all the properties of "obj" but
prefixed
+ * Creates a new value object with all the properties of "obj" but
prefixed
* "data-bs-" to allow easy embedding in HTML elements
- * @param {Object} obj
+ * @param {Object} obj
* @return {Object}
*/
function _makeDataAttributeObject( obj ) {
@@ -357,10 +356,10 @@
}
return data;
}
-
+
/**
- * Creates a new value object with all the properties of "obj" but
without
- * "data-bs-" prefixes. Leaves unprefixed properties untouched. May
+ * Creates a new value object with all the properties of "obj" but
without
+ * "data-bs-" prefixes. Leaves unprefixed properties untouched. May
* override unprefixed doublets.
* @param {Object} obj
* @return {Object}
@@ -376,7 +375,7 @@
}
return data;
}
-
+
/**
* Creates a new value object from a DOMNode object.
* @param {Object} node
@@ -390,7 +389,7 @@
}
return data;
}
-
+
var _tempAnchor = null;
/**
* Gets all GET parameters from an url.
@@ -398,7 +397,7 @@
* @return {Object}
*/
function _getUrlParams( param ) {
- // Handle getUrlParams(), getUrlParams(""), getUrlParams(null)
+ // Handle getUrlParams(), getUrlParams(""), getUrlParams(null)
// or getUrlParams(undefined) calls
if ( !param ) {
return _getUrlParams( window.location );
@@ -491,12 +490,12 @@
}
}
};
-
+
function _wikiGetlink( params, str ) {
var pageName = str || mw.config.get( 'wgPageName' );
var params = params || {};
params.title = pageName;
-
+
var url = mw.util.wikiScript() + '?' + $.param(params);
return url;
};
@@ -524,7 +523,7 @@
wikiGetlink: _wikiGetlink
};
- //This allows us to have a confirm dialog be displayed
+ //This allows us to have a confirm dialog be displayed
//by just adding a class to a link
$(document).on('click', 'a.bs-confirm-nav', function(e) {
e.preventDefault();
@@ -539,8 +538,8 @@
util.selection.autoSelection =
document.selection.createRange();
})
.on( 'keyup', '#wpTextbox1', function() {
- // IE also creates a selection if you are typing ...
- // and you will get it as description in InsertLink ->
not wanted
+ // IE also creates a selection if you are typing ...
+ // and you will get it as description in InsertLink ->
not wanted
util.selection.autoSelection = '';
});
}
diff --git a/resources/bluespice/bluespice.wikiText.js
b/resources/bluespice/bluespice.wikiText.js
index 25aa756..774fbce 100644
--- a/resources/bluespice/bluespice.wikiText.js
+++ b/resources/bluespice/bluespice.wikiText.js
@@ -1,5 +1,4 @@
( function ( mw, bs, $, undefined ) {
- "use strict";
bs.wikiText = {};
@@ -44,7 +43,7 @@
for( var i = 0; i < protocols.length; i++) {
if( me.properties.target.indexOf(protocols[i])
=== 0 ) {
me.properties.protocol = protocols[i];
- me.properties.target =
me.properties.target.substring(
+ me.properties.target =
me.properties.target.substring(
protocols[i].length
);
break;
@@ -55,9 +54,9 @@
this.toString = function() {
//Build wikitext
return '[' +
- this.properties.protocol +
- this.properties.target +
- ( this.properties.displayText !== '' ? ' ' +
this.properties.displayText : '') +
+ this.properties.protocol +
+ this.properties.target +
+ ( this.properties.displayText !== '' ? ' ' +
this.properties.displayText : '') +
']'
;
}
@@ -79,7 +78,7 @@
//HINT: http://ejohn.org/blog/simple-javascript-inheritance/
bs.wikiText.Link = function( cfg ) {
var me = this;
-
+
//HINT: http://www.mediawiki.org/wiki/Help:Images#Syntax
//Format: border|frameless|frame|thumb
//Resizing: {width}px|x{height}px|{width}x{height}px|upright
@@ -88,7 +87,7 @@
//Link: link={target}|link='' - {target} = URL/WikiPage
//Other specific options: alt={alternative text} &
page={number} & class={html class}
//Caption: only if thumb|frame
-
+
var wikiLinkFlags = [
'border', 'frameless', 'frame', 'thumb', //Format
'upright', //Resizing
@@ -98,13 +97,13 @@
var wikiLinkProperties = [
'alt', 'link'
]
-
+
var additionalProperties = [
'escaped', 'title', 'prefixedTitle', 'nsText', 'nsId',
'thumbsize',
/*'align',*/ 'displayText'/*, 'caption', 'sizewidth',
'sizeheight'*/
//'displayText' and 'caption' are somehow the same.
]
-
+
//TODO: make private?
this.properties = {
escaped: false,
@@ -129,7 +128,7 @@
sizewidth: false,
sizeheight: false
}
-
+
if( typeof(cfg) === 'object' ) {
this.properties = $.extend( this.properties, cfg );
if( this.properties.title === '' &&
this.properties.prefixedTitle !== '' ) {
@@ -139,25 +138,25 @@
else{
parsePropertiesFromString(cfg);
}
-
+
function parseTitle( title ) {
if( title.charAt( 0 ) === ':' ) {
me.properties.escaped = true;
title = title.substring( 1, title.length );
//remove leading ":""
}
-
+
me.properties.title = title;
-
+
var titleParts = title.split( ':' );
if( titleParts.length > 1 ) {
me.properties.nsText = titleParts.shift();
me.properties.title = titleParts.join(':');
-
+
var namespaceIds =
mw.config.get('wgNamespaceIds');
me.properties.nsId =
namespaceIds[me.properties.nsText.toLocaleLowerCase()];
}
}
-
+
function parsePropertiesFromString( wikiText ) {
//Trim left and right everything (including linebreaks)
that is not a starting or ending link code
wikiText =
wikiText.replace(/(^.*?\[\[|\]\].*?$|\r\n|\r|\n)/gm,'');
@@ -169,7 +168,7 @@
for( var i = 1; i < parts.length; i++ ) {
var part = parts[i];
if(part === '') continue;
-
+
if( part.endsWith('px') ) { //Dependency
bluespice.string.js
var unsuffixedValue = part.substr( 0,
part.length - 2 ); //"100x100px" --> "100x100"
me.properties.sizewidth=
unsuffixedValue;
@@ -222,7 +221,7 @@
var kvpair = part.split('=');
if( kvpair.length === 1 ) {
- me.properties.displayText = part;
+ me.properties.displayText = part;
me.properties.caption = part;
//hopefully
continue;
}
@@ -263,16 +262,16 @@
if( $.inArray(property, ['left','right',
'center']) !== -1 ) continue; //Not yet used. Instead 'align' is set.
var value = this.properties[property];
- //"link" may be intentionally empty. Therefore
we have to
+ //"link" may be intentionally empty. Therefore
we have to
//check it _before_ "value is empty?"
- if (property === 'link' && ( value !== null
- && value !== 'false' && value !== false
+ if (property === 'link' && ( value !== null
+ && value !== 'false' && value !== false
&& typeof value !== "undefined") ) {
wikiText.push(property + '=' + value);
continue;
}
- if( value === null ||value === false
+ if( value === null ||value === false
|| value === "" || typeof value ===
"undefined" ) continue;
if( property === 'sizewidth' || property ===
'sizeheight' ) {
@@ -300,13 +299,13 @@
wikiText.push( property ); //frame,
border, thumb, left, right...
continue;
}
-
+
wikiText.push( value ); //i.e. displayText
}
return '[[' + wikiText.join('|') + ']]';
}
-
+
this.isEscaped = function( newValue ){
if( newValue === undefined ) { //Getter
return this.properties.escaped;
@@ -425,7 +424,7 @@
this.setSize = function(){
return this.properties.title;
}
-
+
this.getRawProperties = function() {
return this.properties;
}
@@ -433,7 +432,7 @@
bs.wikiText.Template = function( cfg, title ) {
var me = this;
-
+
this.params = {};
this.title = '';
@@ -444,7 +443,7 @@
else{ //WikiText "{{Some Template|with=param}}"
parseParamsFromString(cfg);
}
-
+
function parseParamsFromString( wikiText ) {
//Trim left and right everything that is not a starting
or ending template code
wikiText = wikiText.replace(/(^.*?\{\{|\}\}.*?$)/gm,'');
@@ -453,21 +452,21 @@
//TODO: What about linebreaks?
var parts = wikiText.split("|");
this.title = parts[0];
-
+
for( var i = 1; i < parts.length; i++ ) {
//TODO: implement
}
}
-
+
this.toString = function() {
//Build wikitext
var wikiText = [];
wikiText.push( this.title );
for( var param in this.params ) {
-
+
var keyValuePair = param + "=";
-
+
//TODO: handle nested "bs.wikiText.Template"
objects
keyValuePair += this.params[param];
}
@@ -478,9 +477,9 @@
//TODO: implement
}
}
-
+
bs.wikiText.Tag = function( cfg, title ) {
-
+
}
-
+
}( mediaWiki, blueSpice, jQuery ) );
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/172251
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I729653edaaf6d19047e350618019a85562ba87a4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: REL1_22
Gerrit-Owner: Tweichart <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits