diff options
Diffstat (limited to 'SemanticMediaWiki/resources/smw')
20 files changed, 0 insertions, 3011 deletions
diff --git a/SemanticMediaWiki/resources/smw/api/ext.smw.api.js b/SemanticMediaWiki/resources/smw/api/ext.smw.api.js deleted file mode 100644 index e5a902c0..00000000 --- a/SemanticMediaWiki/resources/smw/api/ext.smw.api.js +++ /dev/null @@ -1,154 +0,0 @@ -/** - * This file is part of the Semantic MediaWiki Extension - * @see https://semantic-mediawiki.org/ - * - * @section LICENSE - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - * - * @file - * @ignore - * - * @since 1.9 - * @ingroup SMW - * - * @licence GNU GPL v2+ - * @author mwjames - */ -( function( $, mw, smw ) { - 'use strict'; - - /*global md5 */ - - /** - * Constructor to create an object to interact with the Semantic - * MediaWiki Api - * - * @since 1.9 - * - * @class - * @alias smw.api - * @constructor - */ - smw.Api = function() {}; - - /* Public methods */ - - smw.Api.prototype = { - - /** - * Convenience method to parse and map a JSON string - * - * Emulates partly $.parseJSON (jquery.js)(see http://www.json.org/js.html) - * - * @since 1.9 - * - * @param {string} data - * - * @return {object|null} - */ - parse: function( data ) { - - // Use smw.Api JSON custom parser to resolve raw data and add - // type hinting - var smwData = new smw.Data(); - - if ( !data || typeof data !== 'string' ) { - return null; - } - - // Remove leading/trailing whitespace - data = $.trim(data); - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return JSON.parse( data, function ( key, value ) { return smwData.factory( key, value ); } ); - } - - // If the above fails, use jquery to do the rest - return $.parseJSON( data ); - }, - - /** - * Returns results from the SMWApi - * - * On the topic of converters (see http://bugs.jquery.com/ticket/9095) - * - * Example: - * var smwApi = new smw.Api(); - * smwApi.fetch( query ) - * .done( function ( data ) { } ) - * .fail( function ( error ) { } ); - * - * @since 1.9 - * - * @param {string} queryString - * @param {boolean|number} useCache - * - * @return {jQuery.Promise} - */ - fetch: function( queryString, useCache ){ - var self = this, - apiDeferred = $.Deferred(); - - if ( !queryString || typeof queryString !== 'string' ) { - throw new Error( 'Invalid query string: ' + queryString ); - } - - // Look for a cache object otherwise do an Ajax call - if ( useCache ) { - - // Use a hash key to compare queries and use it as identifier for - // stored resultObjects, each change in the queryString will result - // in another hash key which will ensure only objects are stored - // with this key can be reused - var hash = md5( queryString ); - - var resultObject = $.jStorage.get( hash ); - if ( resultObject !== null ) { - var results = self.parse( resultObject ); - results.isCached = true; - apiDeferred.resolve( results ); - return apiDeferred.promise(); - } - } - - return $.ajax( { - url: mw.util.wikiScript( 'api' ), - dataType: 'json', - data: { - 'action': 'ask', - 'format': 'json', - 'query' : queryString - }, - converters: { 'text json': function ( data ) { - // Store only the string as we want to return a typed object - // If useCache is not a number use 15 min as default ttl - if ( useCache ){ - $.jStorage.set( hash, data, { - TTL: $.type( useCache ) === 'number' ? useCache : 900000 - } ); - } - var results = self.parse( data ); - results.isCached = false; - return results; - } } - } ); - } - }; - - //Alias - smw.api = smw.Api; - -} )( jQuery, mediaWiki, semanticMediaWiki );
\ No newline at end of file diff --git a/SemanticMediaWiki/resources/smw/data/ext.smw.data.js b/SemanticMediaWiki/resources/smw/data/ext.smw.data.js deleted file mode 100644 index fe42cd80..00000000 --- a/SemanticMediaWiki/resources/smw/data/ext.smw.data.js +++ /dev/null @@ -1,171 +0,0 @@ -/** - * This file is part of the Semantic MediaWiki JavaScript DataItem module - * @see https://semantic-mediawiki.org/ - * - * @section LICENSE - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - * - * @file - * @ignore - * - * @since 1.9 - * @ingroup SMW - * - * @licence GNU GPL v2+ - * @author mwjames - */ -( function( $, mw, smw ) { - 'use strict'; - - /** - * Constructor to create an object to interact with data objects and Api - * - * @since 1.9 - * - * @class - * @alias smw.data - * @constructor - */ - smw.Data = function() {}; - - /* Public methods */ - - smw.Data.prototype = { - - /** - * List of properties used - * - * @property - * @static - */ - properties: null, - - /** - * Factory methods that maps an JSON.parse key/value to an dataItem object - * This function is normally only called during smw.Api.parse/fetch() - * - * Structure will be similar to - * - * Subject (if exists is of type smw.dataItem.wikiPage otherwise a simple object) - * |--> property -> smw.dataItem.property - * |--> smw.dataItem.wikiPage - * |--> ... - * |--> property -> smw.dataItem.property - * |--> smw.dataItem.uri - * |--> ... - * |--> property -> smw.dataItem.property - * |--> smw.dataItem.time - * |--> ... - * - * @since 1.9 - * - * @param {string} key - * @param {mixed} value - * - * @return {object} - */ - factory: function( key, value ) { - var self = this; - - // Map printrequests in order to be used as key accessible reference object - // which enables type hinting for all items that exists within in this list - if ( key === 'printrequests' && value !== undefined ){ - var list = {}; - $.map( value, function( key, index ) { - list[key.label] = { typeid: key.typeid, position: index }; - } ); - self.properties = list; - } - - // Map the entire result object, for objects that have a subject as - // full fledged head item and rebuild the entire object to ensure - // that wikiPage is invoked at the top as well - if ( key === 'results' ){ - var nResults = {}; - - $.each( value, function( subjectName, subject ) { - if( subject.hasOwnProperty( 'fulltext' ) ){ - var nSubject = new smw.dataItem.wikiPage( subject.fulltext, subject.fullurl, subject.namespace, subject.exists ); - nSubject.printouts = subject.printouts; - nResults[subjectName] = nSubject; - } else { - // Headless entry without a subject - nResults = value; - } - } ); - - return nResults; - } - - // Map individual properties according to its type - if ( typeof value === 'object' && self.properties !== null ){ - if ( key !== '' && value.length > 0 && self.properties.hasOwnProperty( key ) ){ - var property = new smw.dataItem.property( key ), - typeid = self.properties[key].typeid, - factoredValue = []; - - // Assignment of individual classes - switch ( typeid ) { - case '_wpg': - $.map( value, function( w ) { - factoredValue.push( new smw.dataItem.wikiPage( w.fulltext, w.fullurl, w.namespace, w.exists ) ); - } ); - break; - case '_uri': - $.map( value, function( u ) { - factoredValue.push( new smw.dataItem.uri( u ) ); - } ); - break; - case '_dat': - $.map( value, function( t ) { - factoredValue.push( new smw.dataItem.time( t ) ); - } ); - break; - case '_num': - $.map( value, function( n ) { - factoredValue.push( new smw.dataItem.number( n ) ); - } ); - break; - case '_qty': - $.map( value, function( q ) { - factoredValue.push( new smw.dataValue.quantity( q.value, q.unit ) ); - } ); - break; - case '_str': - case '_txt': - $.map( value, function( s ) { - factoredValue.push( new smw.dataItem.text( s, typeid ) ); - } ); - break; - default: - // Register all non identifiable types as unknown - $.map( value, function( v ) { - factoredValue.push( new smw.dataItem.unknown( v, typeid ) ); - } ); - } - - return $.extend( property, factoredValue ); - } - } - - // Return all other values - return value; - } - }; - - // Alias - smw.data = smw.Data; - -} )( jQuery, mediaWiki, semanticMediaWiki );
\ No newline at end of file diff --git a/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.number.js b/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.number.js deleted file mode 100644 index 484e6877..00000000 --- a/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.number.js +++ /dev/null @@ -1,100 +0,0 @@ -/** - * SMW Number DataItem JavaScript representation - * - * @see SMW\DINumber - * - * @since 1.9 - * - * @file - * @ingroup SMW - * - * @licence GNU GPL v2 or later - * @author mwjames - */ -( function( $, mw, smw ) { - 'use strict'; - - /** - * Inheritance class for the smw.dataItem constructor - * - * @since 1.9 - * - * @class - * @abstract - */ - smw.dataItem = smw.dataItem || {}; - - /** - * Number constructor - * - * @since 1.9 - * - * @param {number} - * @return {this} - */ - var number = function ( number ) { - this.number = number !== '' ? number : null; - - return this; - }; - - /** - * Class constructor - * - * @since 1.9 - * - * @class - * @constructor - * @extends smw.dataItem - */ - smw.dataItem.number = function( value ) { - if ( $.type( value ) === 'number' ) { - this.constructor( value ); - } else { - throw new Error( 'smw.dataItem.number: invoked value must be a number but is of type ' + $.type( value ) ); - } - }; - - /* Public methods */ - - smw.dataItem.number.prototype = { - - constructor: number, - - /** - * Returns type - * - * @since 1.9 - * - * @return {string} - */ - getDIType: function() { - return '_num'; - }, - - /** - * Returns a number together with the number constructor functions - * - * @since 1.9 - * - * @return {number} - */ - getNumber: function() { - return Number( this.number ); - }, - - /** - * Returns a plain value representation - * - * @since 1.9 - * - * @return {string} - */ - getValue: function() { - return this.number; - } - }; - - // Alias - -} )( jQuery, mediaWiki, semanticMediaWiki );
\ No newline at end of file diff --git a/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.property.js b/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.property.js deleted file mode 100644 index 7aa67387..00000000 --- a/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.property.js +++ /dev/null @@ -1,117 +0,0 @@ -/** - * SMW Property DataItem JavaScript representation - * - * @see SMW\DITime - * - * @since 1.9 - * - * @file - * @ingroup SMW - * - * @licence GNU GPL v2 or later - * @author mwjames - */ -( function( $, mw, smw ) { - 'use strict'; - - var html = mw.html; - - /** - * Inheritance class - * - * @type Object - */ - smw.dataItem = smw.dataItem || {}; - - /** - * Property constructor - * - * @since 1.9 - * - * @param {string} - * - * @return {this} - */ - var property = function ( property ) { - this.property = property !== '' && property !== undefined ? property : null; - return this; - }; - - /** - * Constructor - * - * @var Object - */ - smw.dataItem.property = function( property ) { - if ( $.type( property ) === 'string' ) { - this.constructor( property ); - } else { - throw new Error( 'smw.dataItem.property: invoked property must be a string but is of type ' + $.type( property ) ); - } - }; - - /* Public methods */ - - smw.dataItem.property.prototype = { - - constructor: property, - namespace: 102, // SMW_NS_PROPERTY needs a better way to fill this value - - /** - * Returns type - * - * @see SMW\DIProperty::getDIType() - * - * @since 1.9 - * - * @return {string} - */ - getDIType: function() { - return '_IDONTKNOW'; // what is the type here - }, - - /** - * Returns a label - * - * @see SMW\DIProperty::getLabel() - * - * @since 1.9 - * - * @return {string} - */ - getLabel: function() { - return this.property; - }, - - /** - * Returns wikiPage representation - * - * @see SMW\DIProperty::getDiWikiPage() - * - * @since 1.9 - * - * @return {smw.dataItem.wikiPage} - */ - getDiWikiPage: function() { - return null; //new smw.dataItem.wikiPage( this.property ); - }, - - /** - * Returns html representation - * - * @since 1.9 - * - * @param {boolean} - * @return {string} - */ - getHtml: function( linker ) { - if( linker ){ - return html.element( 'a', { href: mw.util.wikiGetlink( 'Property:' + this.property ) }, this.property ); - } - return this.property; - } - }; - - // Alias - -} )( jQuery, mediaWiki, semanticMediaWiki );
\ No newline at end of file diff --git a/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.text.js b/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.text.js deleted file mode 100644 index 51c92eb4..00000000 --- a/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.text.js +++ /dev/null @@ -1,104 +0,0 @@ -/** - * SMW Text DataItem JavaScript representation - * - * @see SMW\DIString, SMW\DIBlob - * - * A string is a text representation only limited by its length. - * - * @since 1.9 - * - * @file - * @ingroup SMW - * - * @licence GNU GPL v2 or later - * @author mwjames - */ -( function( $, mw, smw ) { - 'use strict'; - - /** - * Inheritance class for the smw.dataItem constructor - * - * @since 1.9 - * - * @class - * @abstract - */ - smw.dataItem = smw.dataItem || {}; - - /** - * Number constructor - * - * @since 1.9 - * - * @param {string} - * @param {string} - * @return {this} - */ - var text = function ( text, type ) { - this.text = text !== '' ? text : null; - - // If the type is not specified we assume it has to be '_txt' - this.type = type !== '' && type !== undefined ? type : '_txt'; - - return this; - }; - - /** - * Class constructor - * - * @since 1.9 - * - * @class - * @constructor - * @extends smw.dataItem - */ - smw.dataItem.text = function( text, type ) { - if ( $.type( text ) === 'string' ) { - this.constructor( text, type ); - } else { - throw new Error( 'smw.dataItem.text: invoked text must be a string but is of type ' + $.type( text ) ); - } - }; - - /* Public methods */ - - var fn = { - - constructor: text, - - /** - * Returns type - * - * Flexible in what to return as type as it could be either '_str' or - * '_txt' but the methods are the same therefore there is no need for - * an extra dataItem representing a string - * - * @since 1.9 - * - * @return {string} - */ - getDIType: function() { - return this.type; - }, - - /** - * Returns a plain text representation - * - * @since 1.9 - * - * @return {string} - */ - getText: function() { - return this.text; - } - }; - - // Alias - fn.getValue = fn.getText; - fn.getString = fn.getText; - - // Assign methods - smw.dataItem.text.prototype = fn; - -} )( jQuery, mediaWiki, semanticMediaWiki );
\ No newline at end of file diff --git a/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.time.js b/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.time.js deleted file mode 100644 index bcc156a7..00000000 --- a/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.time.js +++ /dev/null @@ -1,169 +0,0 @@ -/** - * SMW Time DataItem JavaScript representation - * - * @see SMW\DITime - * - * @since 1.9 - * - * @file - * @ingroup SMW - * - * @licence GNU GPL v2 or later - * @author mwjames - */ -( function( $, mw, smw ) { - 'use strict'; - - /** - * Inheritance class - * - * @type Object - */ - smw.dataItem = smw.dataItem || {}; - - /** - * Date constructor - * - * @since 1.9 - * - * @param {string|number} - * - * @return {this} - */ - var time = function ( timestamp ) { - this.timestamp = timestamp !== '' && timestamp !== undefined ? timestamp : null; - - // Returns a normalized timestamp as JS date object - if ( typeof this.timestamp === 'number' ) { - this.date = new Date( this.timestamp * 1000 ); - } - if ( typeof this.timestamp === 'string' ) { - if ( this.timestamp.match(/^\d+(\.\d+)?$/) ) { - this.date = new Date( parseFloat( this.timestamp ) * 1000 ); - } - } - - return this; - }; - - /** - * Map wgMonthNames and create an indexed array - * - */ - var monthNames = []; - $.map ( mw.config.get( 'wgMonthNames' ), function( index ) { - if( index !== '' ){ - monthNames.push( index ); - } - } ); - - /** - * Constructor - * - * @type object - */ - smw.dataItem.time = function( timestamp ) { - if ( $.type( timestamp ) === 'string' || 'number' ) { - this.constructor( timestamp ); - } else { - throw new Error( 'smw.dataItem.time: timestamp must be a string or number' ); - } - }; - - /* Public methods */ - - var fn = { - - constructor: time, - - /** - * Returns type - * - * @see SMW\DITime::getDIType() - * - * @since 1.9 - * - * @return {string} - */ - getDIType: function() { - return '_dat'; - }, - - /** - * Returns a MW timestamp representation of the value - * - * @see SMW\DITime::getMwTimestamp() - * - * @since 1.9 - * - * @return {string} - */ - getMwTimestamp: function() { - return this.timestamp; - }, - - /** - * Returns Date object - * - * @since 1.9 - * - * @return {Date} - */ - getDate: function() { - return this.date; - }, - - /** - * Returns an ISO string - * - * @see SMWTimeValue::getISO8601Date() - * - * @since 1.9 - * - * @return {string} - */ - getISO8601Date: function() { - return this.date.toISOString(); - }, - - /** - * Returns a formatted time (HH:MM:SS) - * - * In case of no time '00:00:00' is returned - * - * @since 1.9 - * - * @return {string} - */ - getTimeString: function() { - var d = this.date; - if ( d.getUTCHours() + d.getUTCMinutes() + d.getUTCSeconds() === 0 ){ - return '00:00:00'; - } - return ( d.getUTCHours() < 10 ? '0' + d.getUTCHours() : d.getUTCHours() ) + - ':' + ( d.getUTCMinutes() < 10 ? '0' + d.getUTCMinutes() : d.getUTCMinutes() ) + - ':' + ( d.getUTCSeconds() < 10 ? '0' + d.getUTCSeconds() : d.getUTCSeconds() ); - }, - - /** - * Returns MediaWiki's date and time formatting - * - * @since 1.9 - * - * @return {string} - */ - getMediaWikiDate: function() { - return this.date.getDate() + ' ' + - monthNames[this.date.getMonth()] + ' ' + - this.date.getFullYear() + - ( this.getTimeString() !== '00:00:00' ? ' ' + this.getTimeString() : '' ); - } - }; - - // Alias - fn.getValue = fn.getMwTimestamp; - - // Assign methods - smw.dataItem.time.prototype = fn; - -} )( jQuery, mediaWiki, semanticMediaWiki );
\ No newline at end of file diff --git a/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.unknown.js b/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.unknown.js deleted file mode 100644 index 86ac21fb..00000000 --- a/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.unknown.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * SMW Unlisted/Unknown DataItem JavaScript representation - * - * A representation for types we do not know or are unlisted - * - * @since 1.9 - * - * @file - * @ingroup SMW - * - * @licence GNU GPL v2 or later - * @author mwjames - */ -( function( $, mw, smw ) { - 'use strict'; - - /** - * Inheritance class for the smw.dataItem constructor - * - * @since 1.9 - * - * @class - * @abstract - */ - smw.dataItem = smw.dataItem || {}; - - /** - * Unknown constructor - * - * @since 1.9 - * - * @param {string} - * @param {mixed} - * @return {this} - */ - var unknown = function ( value, type ) { - this.value = value !== '' ? value : null; - this.type = type !== '' ? type : null; - - return this; - }; - - /** - * Class constructor - * - * @since 1.9 - * - * @class - * @constructor - * @extends smw.dataItem - */ - smw.dataItem.unknown = function( value, type ) { - this.constructor( value, type ); - }; - - /* Public methods */ - - var fn = { - - constructor: unknown, - - /** - * Returns type - * - * @since 1.9 - * - * @return {string} - */ - getDIType: function() { - return this.type; - }, - - /** - * Returns value - * - * @since 1.9 - * - * @return {mixed} - */ - getValue: function() { - return this.value; - } - }; - - // Alias - fn.getHtml = fn.getValue; - - // Assign methods - smw.dataItem.unknown.prototype = fn; - -} )( jQuery, mediaWiki, semanticMediaWiki );
\ No newline at end of file diff --git a/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.uri.js b/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.uri.js deleted file mode 100644 index c6448902..00000000 --- a/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.uri.js +++ /dev/null @@ -1,106 +0,0 @@ -/** - * SMW Uri DataItem JavaScript representation - * - * @see SMW\DIUri - * - * @since 1.9 - * - * @file - * @ingroup SMW - * - * @licence GNU GPL v2 or later - * @author mwjames - */ -( function( $, mw, smw ) { - 'use strict'; - - var html = mw.html; - - /** - * Inheritance class - * - * @type object - */ - smw.dataItem = smw.dataItem || {}; - - /** - * Uri constructor - * - * @since 1.9 - * - * @param {string} - * - * @return {this} - */ - var uri = function ( fullurl ) { - this.fullurl = fullurl !== '' && fullurl !== undefined ? fullurl : null; - - // Get mw.Uri inheritance - if ( this.fullurl !== null ) { - this.uri = new mw.Uri( this.fullurl ); - } - - return this; - }; - - /** - * Constructor - * - * @var object - */ - smw.dataItem.uri = function( fullurl ) { - if ( $.type( fullurl ) === 'string' ) { - this.constructor( fullurl ); - } else { - throw new Error( 'smw.dataItem.uri: invoked fullurl must be a string but is of type ' + $.type( fullurl ) ); - } - }; - - /* Public methods */ - - smw.dataItem.uri.prototype = { - - constructor: uri, - - /** - * Returns type - * - * @since 1.9 - * - * @return {string} - */ - getDIType: function() { - return '_uri'; - }, - - /** - * Returns uri - * - * @since 1.9 - * - * @return {string} - */ - getUri: function() { - return this.fullurl; - }, - - /** - * Returns html representation - * - * @since 1.9 - * - * @param {boolean} - * - * @return {string} - */ - getHtml: function( linker ) { - if ( linker && this.fullurl !== null ){ - return html.element( 'a', { 'href': this.fullurl }, this.fullurl ); - } - return this.fullurl; - } - }; - - // Alias - -} )( jQuery, mediaWiki, semanticMediaWiki );
\ No newline at end of file diff --git a/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.wikiPage.js b/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.wikiPage.js deleted file mode 100644 index a425fd81..00000000 --- a/SemanticMediaWiki/resources/smw/data/ext.smw.dataItem.wikiPage.js +++ /dev/null @@ -1,203 +0,0 @@ -/*! - * This file is part of the Semantic MediaWiki Extension - * @see https://semantic-mediawiki.org/ - * - * @section LICENSE - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - * - * @since 1.9 - * - * @file - * - * @ingroup SMW - * - * @license GNU GPL v2+ - * @author mwjames - */ -( function( $, mw, smw ) { - 'use strict'; - - /** - * Helper method - * @ignore - */ - var html = mw.html; - - /** - * Inheritance class for the smw.dataItem constructor - * - * @since 1.9 - * - * @class smw.dataItem - * @abstract - */ - smw.dataItem = smw.dataItem || {}; - - /** - * Initializes the constructor - * - * @param {string} fulltext - * @param {string} fullurl - * @param {number} ns - * @param {boolean} exists - * - * @return {smw.dataItem.wikiPage} this - */ - var wikiPage = function ( fulltext, fullurl, ns, exists ) { - this.fulltext = fulltext !== ''&& fulltext !== undefined ? fulltext : null; - this.fullurl = fullurl !== '' && fullurl !== undefined ? fullurl : null; - this.ns = ns !== undefined ? ns : 0; - this.exists = exists !== undefined ? exists : true; - - // Get mw.Title inheritance - if ( this.fulltext !== null ){ - this.title = new mw.Title( this.fulltext ); - } - - return this; - }; - - /** - * A class that includes methods to create a wikiPage dataItem representation - * in JavaScript that resembles the SMW\DIWikiPage object in PHP - * - * @since 1.9 - * - * @class - * @constructor - */ - smw.dataItem.wikiPage = function( fulltext, fullurl, ns, exists ) { - if ( $.type( fulltext ) === 'string' && $.type( fullurl ) === 'string' ) { - this.constructor( fulltext, fullurl, ns, exists ); - } else { - throw new Error( 'smw.dataItem.wikiPage: fulltext, fullurl must be a string' ); - } - }; - - /* Public methods */ - - var fn = { - - constructor: wikiPage, - - /** - * Returns type - * - * @since 1.9 - * - * @return {string} - */ - getDIType: function() { - return '_wpg'; - }, - - /** - * Returns wikiPage text title as full name like "File:Foo bar.jpg" - * due to fact that the name is serialized in fulltext - * - * @since 1.9 - * - * @return {string} - */ - getFullText: function() { - return this.fulltext; - }, - - /** - * Returns main part of the title without any fragment - * - * @since 1.9 - * - * @return {string} - */ - getText: function() { - return this.fulltext && this.fulltext.split( '#' )[0]; - }, - - /** - * Returns wikiPage uri - * - * @since 1.9 - * - * @return {string} - */ - getUri: function() { - return this.fullurl; - }, - - /** - * Returns mw.Title object - * - * @since 1.9 - * - * @return {mw.Title} - */ - getTitle: function() { - return this.title; - }, - - /** - * Returns if the wikiPage is a known entity or not - * - * @since 1.9 - * - * @return {boolean} - */ - isKnown: function(){ - return this.exists; - }, - - /** - * Returns namespace id - * - * @since 1.9 - * - * @return {number} - */ - getNamespaceId: function() { - return this.ns; - }, - - /** - * Returns html representation - * - * @since 1.9 - * - * @param {boolean} - * - * @return {string} - */ - getHtml: function( linker ) { - if ( linker && this.fullurl !== null ){ - var attributes = this.exists ? { 'href': this.fullurl } : { 'href': this.fullurl, 'class': 'new' }; - return html.element( 'a', attributes , this.getText() ); - } - return this.getText(); - } - }; - - // Alias - fn.exists = fn.isKnown; - fn.getPrefixedText = fn.getFullText; - fn.getName = fn.getFullText; - fn.getValue = fn.getFullText; - - // Assign methods - smw.dataItem.wikiPage.prototype = fn; - - // For additional methods use - // $.extend( smw.dataItem.wikiPage.prototype, { method: function (){ ... } } ); - -} )( jQuery, mediaWiki, semanticMediaWiki );
\ No newline at end of file diff --git a/SemanticMediaWiki/resources/smw/data/ext.smw.dataValue.quantity.js b/SemanticMediaWiki/resources/smw/data/ext.smw.dataValue.quantity.js deleted file mode 100644 index 36ca8034..00000000 --- a/SemanticMediaWiki/resources/smw/data/ext.smw.dataValue.quantity.js +++ /dev/null @@ -1,116 +0,0 @@ -/** - * SMW Quantity DataValue JavaScript representation - * - * @see SMW\DINumber - * - * @since 1.9 - * - * @file - * @ingroup SMW - * - * @licence GNU GPL v2 or later - * @author mwjames - */ -( function( $, mw, smw ) { - 'use strict'; - - /** - * Inheritance class for the smw.dataValue constructor - * - * @since 1.9 - * - * @class - * @abstract - */ - smw.dataValue = smw.dataValue || {}; - - /** - * Number constructor - * - * @since 1.9 - * - * @param {number} - * @param {string} - * @param {number} - * @return {this} - */ - var quantity = function ( value, unit, accuracy ) { - this.value = value !== '' ? value : null; - this.unit = unit !== '' ? unit : null; - this.accuracy = accuracy !== '' ? accuracy : null; - - return this; - }; - - /** - * Class constructor - * - * @since 1.9 - * - * @class - * @constructor - * @extends smw.dataValue - */ - smw.dataValue.quantity = function( value, unit, accuracy ) { - if ( $.type( value ) === 'number' ) { - this.constructor( value, unit, accuracy ); - } else { - throw new Error( 'smw.dataValue.quantity: invoked value must be a number but is of type ' + $.type( value ) ); - } - }; - - /* Public methods */ - - smw.dataValue.quantity.prototype = { - - constructor: quantity, - - /** - * Returns type - * - * @since 1.9 - * - * @return {string} - */ - getDIType: function() { - return '_qty'; - }, - - /** - * Returns value - * - * @since 1.9 - * - * @return {number} - */ - getValue: function() { - return this.value; - }, - - /** - * Returns unit - * - * @since 1.9 - * - * @return {string} - */ - getUnit: function() { - return this.unit; - }, - - /** - * Returns accuracy - * - * @since 1.9 - * - * @return {number} - */ - getAccuracy: function() { - return this.accuracy; - } - - }; - - // Alias - -} )( jQuery, mediaWiki, semanticMediaWiki );
\ No newline at end of file diff --git a/SemanticMediaWiki/resources/smw/ext.smw.css b/SemanticMediaWiki/resources/smw/ext.smw.css deleted file mode 100644 index 8747a1e3..00000000 --- a/SemanticMediaWiki/resources/smw/ext.smw.css +++ /dev/null @@ -1,341 +0,0 @@ -/*! - * This file is part of the Semantic MediaWiki Extension - * @see https://semantic-mediawiki.org/ - * - * @section LICENSE - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - * - * @since 1.8 - * - * @file - * @ingroup SMW - * - * @licence GNU GPL v2+ - * @author Jeroen De Dauw <jeroendedauw at gmail dot com> - * @author mwjames - */ - -/* highlighting for builtin elements */ -span.smwbuiltin, span.smwttactiveinline span.smwbuiltin { - font-style: italic; -} - -/* make divs look like <pre> */ -div.smwpre { - white-space: pre; - font-family: monospace; - padding: 1em; - border: 1px dashed #2f6fab; - color: black; - background-color: #f9f9f9; - line-height: 1.1em; - margin-bottom: 0.5em; - margin-top: 0.5em; -} - -/* terminate page contents when inserting stuff below a page, typically used in <br> */ -#smwfootbr { - clear: both; -} - -/* hide keys for sorting table entries */ -span.smwsortkey { - display: none; -} - -/* buttons for sort-arrows */ -a.sortheader:hover { - text-decoration: none; -} - -/* "semantic" span classes for Timeline */ -div.smwtimeline { - border: 1px solid #AAAAAA; - background-color: #F9F9F9; - /*text-align: center;*/ - /* After hours of debugging and frustration I now can safely say: IE sucks. (mak) - You can support Semantic MediaWiki development by not using Internet Explorer. Thanks. - (IE centers the Timeline *elements*, which messes up the whole layout) */ -} - -span.smwtlevent, span.smwtlband, span.smwtlsize, span.smwtlposition { - display: none; - speak: none; -} - -span.smwtlcomment { - font-style: italic; - padding: 5px; -} - -/* Factbox */ -div.smwfact { - clear: both; - background-color: #F9F9F9; - padding: 5px; - margin-top: 1em; - border: 1px solid #AAAAAA; - font-size: 95%; -} - -div.smwfact td, div.smwfact tr, div.smwfact table { - background-color: #F9F9F9; -} - -span.smwfactboxhead { - font-size: 110%; - font-weight: bold; - float: left; -} - -table.smwfacttable { - border-top: 1px dotted #AAAAAA; - width: 100%; - clear: both; -} - -td.smwpropname, th.smwpropname, td.smwspecname { - text-align: right; - vertical-align: top; - padding-right: 1em; -} - -td.smwprops, td.smwspecs { - vertical-align: top; - width: 75%; -} - -div.smwhr hr { - background-color: #DDDDDD; - color: #DDDDDD; -} - -/* warning messages */ -span.smwwarning { - color: #888888; - font-style: italic; - font-size: 90%; -} - - -/* Search, browse, RDF icons/ FIXME: this was only used for Factbox docu, should be removed from code */ -span.smwsearchicon { - padding-right: 16px; - margin-right: 2px; - color: #888888; - /* @embed */ background: url(../images/searchgray_iconsmall.png) center right no-repeat; -} - -#bodyContent span.smwsearch a { - padding-right: 16px; - margin-right: 2px; - color: #888888; - /* @embed */ background: url(../images/searchgray_iconsmall.png) center right no-repeat; -} - -#bodyContent span.smwsearch a:hover { - text-decoration: none; - color: #0000FF; - padding-right: 18px; - margin-right: 0px; - /* @embed */ background: url(../images/search_icon.png) center right no-repeat; -} - -#bodyContent span.swmfactboxheadbrowse a { - padding-right: 16px; - margin-right: 2px; - color: #000000; - /* @embed */ background: url(../images/browse_iconsmall.png) center right no-repeat; -} - -#bodyContent span.swmfactboxheadbrowse a:hover { - text-decoration: none; - color: #0000FF; - padding-right: 18px; - margin-right: 0px; - /* @embed */ background: url(../images/browse_icon.png) center right no-repeat; -} - -#bodyContent span.smwbrowse a { - padding-right: 16px; - margin-right: 2px; - color: #888888; - /* @embed */ background: url(../images/browse_iconsmall.png) center right no-repeat; -} - -#bodyContent span.smwbrowse a:hover { - text-decoration: none; - color: #0000FF; - padding-right: 18px; - margin-right: 0px; - /* @embed */ background: url(../images/browse_icon.png) center right no-repeat; -} - -#bodyContent span.smwmap a { - padding-right: 20px; - color: #888888; - /* @embed */ background: url(../images/world.png) center right no-repeat; -} - -#bodyContent span.smwmap a:hover { - padding-right: 20px; - color: #0000FF; - /* @embed */ background: url(../images/world.png) center right no-repeat; -} - -#bodyContent span.rdflink { - float: right; -} - -#bodyContent span.rdflink a { - padding-right: 20px; - color: #888888; - /* @embed */ background: url(../images/rdf_flyer.18.gif) center right no-repeat; -} - -#bodyContent span.rdflink a:hover { - text-decoration: none; - color: #0000FF; - padding-right: 20px; - margin-right: 0px; - /* @embed */ background: url(../images/rdf_flyer.18.gif) center right no-repeat; -} - -/* @TODO Browse and Factbox should be split into seperated CSS file, CSS style file for Semantic MediaWiki Special Browse. */ -table.smwb-factbox { - border-left: 8px solid #DDDDDD; - width: 100% -} - -tr.smwb-title { - font-size: 200%; - background-color: #DDDDDD; - line-height: 1.5; -} - -tr.smwb-title td { - padding-left: 5px; - border-bottom: 2px solid white; -} - -tr.smwb-propvalue { - width: 100%; - background-color: #EEEEEE; -} - -tr.smwb-propvalue th { - text-align: right; - vertical-align: top; - font-weight: bold; - font-size: 120%; - background-color: #DDDDDD; - padding: 0.2em 0.6em; - border-bottom: 2px solid white; - border-top: 2px solid white; -} - -tr.smwb-propvalue td { - padding-left:0.4em; - background-color: #EEEEEE; - border: 0px solid white; - border-bottom: 2px solid white; - border-top: 2px solid white; - width: 90%; -} - -tr.smwb-center { - background-color: #DDDDDD; -} - -span.smwb-value { -} - -/** - * Inverse factbox - * @ignore - */ -table.smwb-ifactbox { - border-right: 8px solid #DDDDDD; - width: 100% -} - -tr.smwb-ititle { - font-size: 200%; - background-color: #DDDDDD; - line-height: 1.5; -} - -tr.smwb-ititle td { - padding-left: 5px; - border-bottom: 2px solid white; -} - -tr.smwb-ipropvalue { - width: 100%; - background-color: #EEEEEE; - text-align: right; -} - -tr.smwb-ipropvalue th { - text-align: left; - font-weight: bold; - font-size: 120%; - background-color: #DDDDDD; - padding: 0.2em 0.6em; - border-bottom: 3px solid white; - border-top: 3px solid white; -} - -tr.smwb-ipropvalue td { - background-color: #EEEEEE; - border-bottom: 3px solid white; - border-top: 3px solid white; - padding-right: 1em; - width: 90%; -} - -span.smwb-ivalue { -} - -/* @since 1.9; Spinner */ -.smw-spinner .text { - padding-left: 2.1em; - font-size: 12px; - vertical-align: middle; -} - -/* @since 1.9; Spinner for left side in-text */ -.smw-spinner.left.mw-small-spinner { - background-position:left; - vertical-align: middle; - display:inline-block; - padding: 0px !important; -} - -/* @since 1.9; Sppinner for image center */ -.smw-spinner.center.mw-small-spinner { - vertical-align: middle; - display:inline-block; - padding: 0px !important; -} - -/* @since 1.9.1 */ -table.smw-ask-query .smw-ask-query-condition { - width: 100%; -} - -table.smw-ask-query .smw-ask-query-printout { - width: 100%; -} diff --git a/SemanticMediaWiki/resources/smw/ext.smw.js b/SemanticMediaWiki/resources/smw/ext.smw.js deleted file mode 100644 index b26c5883..00000000 --- a/SemanticMediaWiki/resources/smw/ext.smw.js +++ /dev/null @@ -1,349 +0,0 @@ -/*! - * This file is part of the Semantic MediaWiki Extension - * @see https://semantic-mediawiki.org/ - * - * @section LICENSE - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @since 1.8 - * - * @file - * - * @ingroup SMW - * - * @licence GNU GPL v2+ - * @author Jeroen De Dauw <jeroendedauw at gmail dot com> - * @author mwjames - */ -var smw = ( function ( $, undefined ) { - 'use strict'; - - /*global console:true message:true */ - - /** - * - * Declares methods and properties that are available through the smw namespace - * - * @since 1.8 - * @class smw - * @alternateClassName semanticMediaWiki - * @singleton - */ - return { - - /* Public Members */ - - /** - * Outputs a debug log - * - * @since 1.8 - * - * @return {string} - */ - log: function( message ) { - if ( typeof mediaWiki === 'undefined' ) { - if ( typeof console !== 'undefined' ) { - console.log( 'SMW: ', message ); - } - } else { - return mediaWiki.log.call( mediaWiki.log, 'SMW: ', message ); - } - }, - - /** - * Outputs a message - * - * @since 1.8 - * - * @return {string} - */ - msg: function() { - if ( typeof mediaWiki === 'undefined' ) { - message = window.wgSMWMessages[arguments[0]]; - - for ( var i = arguments.length - 1; i > 0; i-- ) { - message = message.replace( '$' + i, arguments[i] ); - } - return message; - } else { - return mediaWiki.msg.apply( mediaWiki.msg, arguments ); - } - }, - - /** - * Returns current debug status - * - * @since 1.9 - * - * @return {boolean} - */ - debug: function() { - return mediaWiki.config.get( 'debug' ); - }, - - /** - * Returns Semantic MediaWiki version - * - * @since 1.9 - * - * @return {string} - */ - version: function() { - return mediaWiki.config.get( 'smw-config' ).version; - }, - - /** - * Declares methods to access utility functions - * - * @since 1.9 - * - * @static - * @class smw.util - * @alias smw.Util - */ - util: { - - /** - * Strip some illegal chars: control chars, colon, less than, greater than, - * brackets, braces, pipe, whitespace and normal spaces. This still leaves some insanity - * intact, like unicode bidi chars, but it's a good start.. - * - * Borrowed from mw.Title - * - * @ignore - * @param {string} s - * @return {string} - */ - clean: function ( s ) { - if ( s !== undefined ) { - return s.trim().replace( /[\x00-\x1f\x23\x3c\x3e\x5b\x5d\x7b\x7c\x7d\x7f\s]+/g, '_' ); - } - }, - - /** - * Capitalizes the first letter of a string - * - * @ignore - * @param {string} s - * @return {string} - */ - ucFirst: function( s ) { - return s.charAt(0).toUpperCase() + s.slice(1); - }, - - /** - * Declares methods to access information about namespace settings - - * Example to find localised name: - * smw.util.namespace.getName( 'property' ); - * smw.util.namespace.getName( 'file' ); - * - * @since 1.9 - * - * @static - * @class smw.util.namespace - */ - namespace: { - - /** - * Returns list of available namespaces - * - * @since 1.9 - * - * @return {Object} - */ - getList: function() { - return smw.settings.get( 'namespace' ); - }, - - /** - * Returns namespace Id - * - * @since 1.9 - * - * @param {string} key - * - * @return {number} - */ - getId: function( key ) { - if( typeof key === 'string' ) { - return this.getList()[ smw.util.ucFirst( smw.util.clean( key ) ) ]; - } - return undefined; - }, - - /** - * Returns formatted localized name for a selected namespace - * - * @since 1.9 - * - * @param {string} key - * - * @return {string} - */ - getName: function( key ) { - if( typeof key === 'string' ) { - var id = this.getId( key ); - return id && mediaWiki.config.get( 'wgFormattedNamespaces' )[id.toString()]; - } - return undefined; - } - } - }, - - /** - * Declares methods to improve browser responsiveness by loading - * invoked methods asynchronously using the jQuery.eachAsync plug-in - * - * Example: - * var fn = function( options ) {}; - * smw.async.load( $( this ), fn, {} ); - * - * @since 1.9 - * - * @singleton - * @class smw.async - */ - async: { - - /** - * Returns if eachAsync is available for asynchronous loading - * - * @return {boolean} - */ - isEnabled: function() { - return $.isFunction( $.fn.eachAsync ); - }, - - /** - * Negotiates and executes asynchronous loading - * - * @since 1.9 - * - * @param {object} context - * @param {function} method - * @param {object|string} args - * - * @return {boolean} - * @throws {Error} Missing callback - */ - load: function( context, method ) { - if ( typeof method !== 'function' ) { - throw new Error( 'Invoked parameter was not a function' ); - } - - // Filter arguments that are attached to the caller - var args = Array.prototype.slice.call( arguments, 2 ); - - if ( this.isEnabled() ) { - context.eachAsync( { - delay: 100, - bulk: 0, - loop: function() { - method.apply( $( this ), args ); - } - } ); - } else { - context.each( function() { - method.apply( $( this ), args ); - } ); - } - } - }, - - /** - * Declares methods to access information about available formats - * - * @since 1.9 - * - * @class smw.formats - * @alias smw.Formats - */ - formats: { - - /** - * Returns list of available formats - * - * @since 1.9 - * @extends smw.formats - * - * @return {Object} - */ - getList: function() { - return mediaWiki.config.get( 'smw-config' ).formats; - }, - - /** - * Returns localized name for a select format - * - * @since 1.9 - * - * @param {string} format - * - * @return {string} - */ - getName: function( format ) { - if( typeof format === 'string' ){ - return this.getList()[ smw.util.clean( format ).toLowerCase() ]; - } - return undefined; - } - }, - - /** - * Declares methods to access information about invoked settings (see also - * SMWHooks::onResourceLoaderGetConfigVars) - * - * @since 1.9 - * - * @class smw.settings - * @singleton - */ - settings: { - - /** - * Returns list of available settings - * - * @since 1.9 - * - * @return {Object} - */ - getList: function() { - return mediaWiki.config.get( 'smw-config' ).settings; - }, - - /** - * Returns a specific settings value (see SMW\Settings::get) - * - * @since 1.9 - * - * @param {string} key to be selected - * - * @return {mixed} - */ - get: function( key ) { - if( typeof key === 'string' ) { - return this.getList()[key]; - } - return undefined; - } - } - }; - -} )( jQuery ); - -// Assign namespace -window.smw = window.semanticMediaWiki = smw;
\ No newline at end of file diff --git a/SemanticMediaWiki/resources/smw/query/ext.smw.query.js b/SemanticMediaWiki/resources/smw/query/ext.smw.query.js deleted file mode 100644 index b61e077c..00000000 --- a/SemanticMediaWiki/resources/smw/query/ext.smw.query.js +++ /dev/null @@ -1,166 +0,0 @@ -/** - * This file is part of the Semantic MediaWiki JavaScript Query module - * @see https://semantic-mediawiki.org/ - * - * @section LICENSE - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - * - * @file - * @ignore - * - * @since 1.9 - * @ingroup SMW - * - * @licence GNU GPL v2+ - * @author mwjames - */ -( function( $, mw, smw ) { - 'use strict'; - - /** - * Private object and methods - * @ignore - */ - var html = mw.html; - - /** - * Query constructor - * - * @since 1.9 - * - * @param {object} printouts - * @param {object} parameters - * @param {object|string} conditions - * - * @return {this} - */ - var query = function ( printouts, parameters, conditions ) { - this.printouts = printouts !== '' && printouts !== undefined ? printouts : []; - this.parameters = parameters !== '' && parameters !== undefined ? parameters : {}; - this.conditions = conditions !== '' && conditions !== undefined ? conditions :[]; - return this; - }; - - /** - * Constructor to create an object to interact with the Query - * - * @since 1.9 - * - * @class - * @alias smw.Query - * @constructor - */ - smw.Query = function( printouts, parameters, conditions ) { - - // You need to have some conditions otherwise jump the right light - // because a query one can survive without printouts or parameters - if ( conditions !== '' || $.type( this.conditions ) === 'array' ) { - this.constructor( printouts, parameters, conditions ); - } else { - throw new Error( 'smw.dataItem.query: conditions are empty' ); - } - }; - - /* Public methods */ - - var fn = { - - constructor: query, - - /** - * Returns query limit parameter (see SMW\Query::getLimit()) - * - * @since 1.9 - * - * @return {number} - */ - getLimit: function() { - return this.parameters.limit; - }, - - /** - * Returns query link (see SMW\QueryResult::getLink()) - * - * Caption text is set either by using parameters.searchlabel or by - * .getLink( 'myCaption' ) - * - * @since 1.9 - * - * @param {string} - * @return {string} - */ - getLink: function( caption ) { - var c = caption ? caption : this.parameters.searchlabel !== undefined ? this.parameters.searchlabel : '...' ; - return html.element( 'a', { - 'class': 'query-link', - 'href' : mw.config.get( 'wgScript' ) + '?' + $.param( { - title: 'Special:Ask', - 'q': $.type( this.conditions ) === 'string' ? this.conditions : this.conditions.join( '' ), - 'po': this.printouts.join( '\n' ), - 'p': this.parameters - } ) - }, c ); - }, - - /** - * Returns query string (see SMW\Query::getQueryString()) - * - * @since 1.9 - * - * @return {string} - */ - toString: function() { - - var printouts = ''; - if ( $.type( this.printouts ) === 'array' ){ - $.each( this.printouts, function( key, value ) { - printouts += '|' + value; - } ); - } else { - // @see ext.smw.query.test why we are failing here and not earlier - throw new Error( 'smw.Api.query: printouts is not an array, it is a + ' + $.type( this.printouts ) ); - } - - var parameters = ''; - if ( $.type( this.parameters ) === 'object' ){ - $.each( this.parameters, function( key, value ) { - parameters += '|' + key + '=' + value; - } ); - } else { - // @see ext.smw.query.test why we are failing here and not earlier - throw new Error( 'smw.Api.query: parameters is not an object, it is a + ' + $.type( this.parameters ) ); - } - - var conditions = ''; - if ( $.type( this.conditions ) === 'array' || $.type( this.conditions ) === 'object' ){ - $.each( this.conditions, function( key, value ) { - conditions += value; - } ); - } else if ( $.type( this.conditions ) === 'string' ) { - conditions += this.conditions; - } - - return conditions + printouts + parameters; - } - }; - - // Alias - fn.getQueryString = fn.toString; - - // Assign methods - smw.Query.prototype = fn; - smw.query = smw.Query; - -} )( jQuery, mediaWiki, semanticMediaWiki );
\ No newline at end of file diff --git a/SemanticMediaWiki/resources/smw/special/ext.smw.special.ask.css b/SemanticMediaWiki/resources/smw/special/ext.smw.special.ask.css deleted file mode 100644 index e2d18ad7..00000000 --- a/SemanticMediaWiki/resources/smw/special/ext.smw.special.ask.css +++ /dev/null @@ -1,46 +0,0 @@ -/** - * This file is part of the Semantic MediaWiki Special:Ask module - * @see https://semantic-mediawiki.org/ - * - * @section LICENSE - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - * - * @since 1.8 - * - * @file - * @ignore - * - * @ingroup SMW - * - * @licence GNU GPL v2+ - * @author mwjames - */ -.smw-ask-format-selection-help { - vertical-align: middle; - margin-left: 10px; -} - -.smw-ask-options legend { - cursor: pointer; - padding-left: 20px; -} - -.smwCollapsedFieldset legend { - /* @embed */ background: transparent url(../../images/collapse-plus.png) no-repeat center left; -} - -.smwExpandedFieldset legend { - /* @embed */ background: transparent url(../../images/collapse-minus.png) no-repeat center left; -} diff --git a/SemanticMediaWiki/resources/smw/special/ext.smw.special.ask.js b/SemanticMediaWiki/resources/smw/special/ext.smw.special.ask.js deleted file mode 100644 index a3ce8f9c..00000000 --- a/SemanticMediaWiki/resources/smw/special/ext.smw.special.ask.js +++ /dev/null @@ -1,249 +0,0 @@ -/** - * This file is part of the Semantic MediaWiki Special:Ask module - * @see https://semantic-mediawiki.org/ - * - * @section LICENSE - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - * - * @file - * @ignore - * - * @since 1.9 - * @ingroup SMW - * - * @licence GNU GPL v2+ - * @author: Jeroen De Dauw <jeroendedauw at gmail dot com> - * @author mwjames - */ -( function( $, mw, smw ) { - 'use strict'; - - /** - * Support and helper methods - * @ignore - */ - var tooltip = new smw.util.tooltip(); - - var _init = { - - // Autocomplete - autocomplete: { - textarea: function(){ - // Textarea property autocomplete - // @see ext.smw.autocomplete - $( '#add_property' ).smwAutocomplete( { separator: '\n' } ); - }, - parameter: function(){ - // Property autocomplete for the single sort field - $( '.smw-ask-input-sort' ).smwAutocomplete(); - } - }, - - // Tooltip - tooltip: function(){ - $( '.smw-ask-info' ).each( function(){ - tooltip.show( { - context: $( this ), - content: $( this ).data( 'info' ), - title : mw.msg( 'smw-ui-tooltip-title-parameter' ), - button : false - } ); - } ); - }, - - // Format help link - formatHelp: function( options ){ - // Make sure we don't have a pre existing element, using id as selector - // as it is faster compared to the class selector - $( '#formatHelp' ).remove(); - $( options.selector ).after( '<span id="formatHelp" class="smw-ask-format-selection-help">' + mw.msg( 'smw-ask-format-selection-help', addFormatHelpLink( options ) ) + '</span>' ); - } - }; - - /** - * Add format help link - * - * We do not try to be smart here but using a pragmatic approach to generate - * the URL by assuming Help:<format> format - * - * @return object - */ - function addFormatHelpLink ( options ){ - var h = mw.html, - link = h.element( 'a', { - href: 'http://semantic-mediawiki.org/wiki/Help:' + options.format + ' format', - title: options.name - }, options.name - ); - return link; - } - - /** - * Multiple sorting - * Code for handling adding and removing the "sort" inputs - * - * @TODO Something don't quite work here but it is broken from the beginning therefore ... - */ - var num_elements = $( '#sorting_main > div' ).length; - - function addInstance(starter_div_id, main_div_id) { - num_elements++; - - var starter_div = $( '#' + starter_div_id), - main_div = $( '#' + main_div_id), - new_div = starter_div.clone(); - - new_div.attr( { - 'class': 'multipleTemplate', - 'id': 'sort_div_' + num_elements - } ); - - new_div.css( 'display', 'block' ); - - //Create 'delete' link - var button = $( '<a>').attr( { - 'href': '#', - 'class': 'smw-ask-delete' - } ).text( mw.msg( 'smw-ask-delete' ) ); - - button.click( function() { - removeInstance( 'sort_div_' + num_elements ); - } ); - - new_div.append( - $( '<span>' ).html( button ) - ); - - //Add the new instance - main_div.append( new_div ); - } - - function removeInstance(div_id) { - $( '#' + div_id ).remove(); - } - - /** - * Collapsible fieldsets - * Based on the 'coolfieldset' jQuery plugin: - * http://w3shaman.com/article/jquery-plugin-collapsible-fieldset - * - */ - function smwHideFieldsetContent(obj, options){ - obj.find( 'div' ).slideUp(options.speed); - obj.find( '.collapsed-info' ).slideDown(options.speed); - obj.removeClass( "smwExpandedFieldset" ); - obj.addClass( "smwCollapsedFieldset" ); - } - - function smwShowFieldsetContent(obj, options){ - obj.find( 'div' ).slideDown(options.speed); - obj.find( '.collapsed-info' ).slideUp(options.speed); - obj.removeClass( "smwCollapsedFieldset" ); - obj.addClass( "smwExpandedFieldset" ); - } - - ////////////////////////// PUBLIC METHODS //////////////////////// - - $.fn.smwMakeCollapsible = function(options){ - var setting = { collapsed: options.collapsed, speed: 'medium' }; - $.extend(setting, options); - - this.each(function(){ - var fieldset = $(this); - var legend = fieldset.children('legend'); - if ( setting.collapsed ) { - legend.toggle( - function(){ - smwShowFieldsetContent(fieldset, setting); - }, - function(){ - smwHideFieldsetContent(fieldset, setting); - } - ); - - smwHideFieldsetContent(fieldset, {animation:false}); - } else { - legend.toggle( - function(){ - smwHideFieldsetContent(fieldset, setting); - }, - function(){ - smwShowFieldsetContent(fieldset, setting); - } - ); - } - }); - }; - - /** - * Implementation of an Special:Ask instance - * @since 1.8 - * @ignore - */ - $( document ).ready( function() { - - // Get initial format and language settings - var selected = $( '#formatSelector option:selected' ), - options = { - selector : '#formatSelector', - format : selected.val(), - name : selected.text() - }; - - // Init - _init.autocomplete.textarea(); - _init.autocomplete.parameter(); - _init.tooltip(); - _init.formatHelp( options ); - - // Fieldset collapsible - $( '.smw-ask-options' ).smwMakeCollapsible( { - 'collapsed' : mw.user.options.get( 'smw-prefs-ask-options-collapsed-default' ) - } ); - - // Multiple sorting - $( '.smw-ask-delete').click( function() { - removeInstance( $( this).attr( 'data-target' ) ); - } ); - - $( '.smw-ask-add').click( function() { - addInstance( 'sorting_starter', 'sorting_main' ); - } ); - - // Change format parameter form via ajax - $( '#formatSelector' ).change( function() { - var $this = $( this ); - - $.ajax( { - // Evil hack to get more evil Spcial:Ask stuff to work with less evil JS. - 'url': $this.data( 'url' ).replace( 'this.value', $this.val() ), - 'context': document.body, - 'success': function( data ) { - $( '#other_options' ).html( data ); - - // Reinitialize functions after each ajax request - _init.autocomplete.parameter(); - _init.tooltip(); - - // Update format created by the ajax instance - _init.formatHelp( $.extend( {}, options, { - format: $this.val(), - name: $this.find( 'option:selected' ).text() - } ) ); - } - } ); - } ); - } ); -} )( jQuery, mediaWiki, semanticMediaWiki );
\ No newline at end of file diff --git a/SemanticMediaWiki/resources/smw/special/ext.smw.special.browse.js b/SemanticMediaWiki/resources/smw/special/ext.smw.special.browse.js deleted file mode 100644 index 4adbe626..00000000 --- a/SemanticMediaWiki/resources/smw/special/ext.smw.special.browse.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * JavaScript for Special:Browse related functions - * - * @see https://www.mediawiki.org/wiki/Extension:Semantic_MediaWiki - * @licence: GNU GPL v2 or later - * - * @since: 1.7 - * @release: 0.2 - * - * @author Jeroen De Dauw <jeroendedauw at gmail dot com> - * @author Devayon Das - * @author mwjames - */ -( function( $, mw ) { - - $( document ).ready( function() { - - // Used in Special:Browse - // Function is specified in ext.smw.autocomplete - $( '#page_input_box' ).smwAutocomplete( { search: 'page', namespace: 0 } ); - - } ); - -} )( jQuery, mediaWiki );
\ No newline at end of file diff --git a/SemanticMediaWiki/resources/smw/special/ext.smw.special.property.js b/SemanticMediaWiki/resources/smw/special/ext.smw.special.property.js deleted file mode 100644 index 87ba6d30..00000000 --- a/SemanticMediaWiki/resources/smw/special/ext.smw.special.property.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * JavaScript for property related functions - * - * @see https://www.mediawiki.org/wiki/Extension:Semantic_MediaWiki - * - * @since 1.8 - * @release 0.1 - * - * @file - * @ingroup SMW - * - * @licence GNU GPL v2 or later - * @author mwjames - */ - -( function( $, mw ) { - - $( document ).ready( function() { - - // Used in SMW_SpecialSearchByProperty.php - // Function is specified in ext.smw.autocomplete - $( '#property_box' ).smwAutocomplete(); - - } ); -} )( jQuery, mediaWiki );
\ No newline at end of file diff --git a/SemanticMediaWiki/resources/smw/util/ext.smw.util.autocomplete.js b/SemanticMediaWiki/resources/smw/util/ext.smw.util.autocomplete.js deleted file mode 100644 index a1accc83..00000000 --- a/SemanticMediaWiki/resources/smw/util/ext.smw.util.autocomplete.js +++ /dev/null @@ -1,137 +0,0 @@ -/** - * JavaScript for SMW autocomplete functionality - * - * @see https://www.mediawiki.org/wiki/Extension:Semantic_MediaWiki - * - * @since 1.8 - * @release 0.1 - * - * @file - * @ingroup SMW - * - * @licence GNU GPL v2 or later - * @author mwjames - */ -/*global mediaWiki:true*/ -( function( $, mw ) { - 'use strict'; - - /** - * Default options - * - */ - var defaults = { - limit: 10, - separator: null, - search: 'property', - namespace: mw.config.get( 'wgNamespaceIds' ).property - }; - - /** - * Handle autocomplete function for various instances - * - * @var options - * - * @since: 1.8 - */ - $.fn.smwAutocomplete = function( settings ){ - - // Merge defaults and options - var options = $.extend( {}, defaults, settings ); - - // Specify regular expression - var regex = new RegExp( options.separator , 'mi' ); - - // Helper functions - function split( val ) { - return val.split( regex ); - } - - function extractLast( term ) { - return split( term ).pop(); - } - - function escapeQuestion(term){ - if ( term.substring(0, 1) === "?" ) { - return term.substring(1); - } else { - return term; - } - } - - // Extending jQuery functions for custom highligting - $.ui.autocomplete.prototype._renderItem = function( ul, item ) { - var term_without_q = escapeQuestion(extractLast( this.term )); - var re = new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term_without_q.replace("/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi", "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"); - var loc = item.label.search(re), - t = ''; - if (loc >= 0) { - t = item.label.substr(0, loc) + '<strong>' + item.label.substr(loc, term_without_q.length) + '</strong>' + item.label.substr(loc + term_without_q.length); - } else { - t = item.label; - } - $( "<li></li>" ) - .data( "item.autocomplete", item ) - .append( " <a>" + t + "</a>" ) - .appendTo( ul ); - }; - - // Extending jquery functions for custom autocomplete matching - $.extend( $.ui.autocomplete, { - filter: function(array, term) { - var matcher = new RegExp( "\\\b" + $.ui.autocomplete.escapeRegex(term), "i" ); - return $.grep( array, function(value) { - return matcher.test( value.label || value.value || value ); - }); - } - } ); - - // Autocomplete core - this.autocomplete( { - minLength: 2, - source: function(request, response) { - $.getJSON( - mw.config.get( 'wgScriptPath' ) + '/api.php', - { - 'action': 'opensearch', - 'format': 'json', - 'limit': options.limit, - 'namespace': options.namespace , - 'search': extractLast( request.term ) - }, - function( data ){ - - if ( data.error === undefined ) { - //remove the word 'Property:' from returned data - if ( options.search === 'property' ){ - for( var i=0; i < data[1].length; i++ ) { - data[1][i]= data[1][i].substr( data[1][i].indexOf( ':' ) + 1 ); - } - } - response( data[1] ); - } else { - response ( false ); - } - } - ); - }, - focus: function() { - // prevent value inserted on focus - return false; - }, - select: function( event, ui ) { - var terms = this.value; - terms = split( terms ); - // remove the current input - terms.pop(); - // add the selected item - terms.push( ui.item.value ); - // add placeholder to get the comma-and-space at the end - terms.push(""); - this.value = terms.join( options.separator !== null ? options.separator : '' ); - return false; - } - } ); - }; - -} )( jQuery, mediaWiki );
\ No newline at end of file diff --git a/SemanticMediaWiki/resources/smw/util/ext.smw.util.tooltip.css b/SemanticMediaWiki/resources/smw/util/ext.smw.util.tooltip.css deleted file mode 100644 index dcec9554..00000000 --- a/SemanticMediaWiki/resources/smw/util/ext.smw.util.tooltip.css +++ /dev/null @@ -1,102 +0,0 @@ -/*! - * This file is part of the Semantic MediaWiki Tooltip/Highlighter module - * @see https://semantic-mediawiki.org/ - * - * @section LICENSE - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @since 1.8 - * - * @file - * @ingroup SMW - * - * @licence GNU GPL v2+ - * @author mwjames - */ - -/* Tooltips, style for content of the bubble */ -div.smwtt { - color: #000000; -} - -/* Tooltips, show persistent tooltips for non-JavaScript clients */ -span.smwttpersist span.smwttcontent { - color: #888888; - font-style: italic; - font-size: 90%; -} - -/* Tooltips, hide inline tooltips for non-JavaScript clients */ -span.smwttinline span.smwttcontent { - display: none; - speak: none; -} - -/* Tooltips, style for image anchor for persistent tooltips */ -span.smwtticon { - display: none; -} - -/* Tooltips, colored anchors? */ -span.smwttactivepersist { - cursor: help; - color: #0000C8; -} - -/* Tooltips, colored anchors */ -span.smwttactiveinline { - color: #BB7700; - text-decoration: none; -} - -/* Tooltips, images for tooltip icons */ -img.smwttimg { - padding-right: 5px; - padding-left: 4px; -} - -/* New tooltip content is always hidden */ -.smwttcontent { - display:none; -} - -/* New tooltip icon defaults */ -.smwtticon { - padding:14px 12px 0 0; - white-space:nowrap; - margin-bottom: -1px; -} - -/* New tooltip, Individual assigned icons ( inline-block is important because the icon <span> is empty) */ -.smwtticon.info { - display:inline-block; - /* @embed */ background: url(../../images/info.png) no-repeat left bottom; -} - -.smwtticon.service { - display:inline-block; - /* @embed */ background: url(../../images/info.png) no-repeat left bottom; -} - -.smwtticon.warning { - display:inline-block; - /* @embed */ background: url(../../images/warning.png) no-repeat left bottom; -} - -.smwtticon.note { - display:inline-block; - /* @embed */ background: url(../../images/note.png) no-repeat left bottom; -}
\ No newline at end of file diff --git a/SemanticMediaWiki/resources/smw/util/ext.smw.util.tooltip.js b/SemanticMediaWiki/resources/smw/util/ext.smw.util.tooltip.js deleted file mode 100644 index 4261607e..00000000 --- a/SemanticMediaWiki/resources/smw/util/ext.smw.util.tooltip.js +++ /dev/null @@ -1,241 +0,0 @@ -/*! - * This file is part of the Semantic MediaWiki Tooltip/Highlighter module - * @see https://semantic-mediawiki.org/wiki/Help:Tooltip - * - * @section LICENSE - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @since 1.8 - * @revision 0.3.4 - * - * @file - * @ingroup SMW - * - * @licence GNU GPL v2+ - * @author mwjames - */ -( function( $, mw, smw ) { - 'use strict'; - - /** - * Support variable - * @ignore - */ - var h = mw.html; - - /** - * Inheritance class for the smw.util constructor - * - * @since 1.9 - * @class - */ - smw.util = smw.util || {}; - - /** - * Class constructor - * - * @since 1.8 - * - * @class - * @constructor - */ - smw.util.tooltip = function( settings ) { - $.extend( this, this.defaults, settings ); - }; - - /* Public methods */ - - smw.util.tooltip.prototype = { - - /** - * Default options - * - * viewport => $(window) keeps the tooltip on-screen at all times - * 'top center' + 'bottom center' => Position the tooltip above the link - * solo => true shows only one tooltip at a time - * - * @since 1.8 - * - * @property - */ - defaults: { - qtip: { - position: { - viewport: $( window ), - at: 'top center', - my: 'bottom center' - }, - show: { - solo: true - }, - content: { - title: { - button: false - } - }, - style: { - classes: 'qtip-shadow qtip-bootstrap' - } - }, - classes: { - targetClass: 'smwtticon', - contentClass: 'smwttcontent', - contextClass: 'smwttpersist' - } - }, - - /** - * Get title message - * - * @since 1.8 - * - * @param {string} key - * - * @return string - */ - getTitleMsg: function( key ){ - switch( key ){ - case 'quantity': return 'smw-ui-tooltip-title-quantity'; - case 'property': return 'smw-ui-tooltip-title-property'; - case 'service' : return 'smw-ui-tooltip-title-service'; - case 'warning' : return 'smw-ui-tooltip-title-warning'; - default: return 'smw-ui-tooltip-title-info'; - } - }, - - /** - * Initializes the qtip2 instance - * - * Example: - * tooltip = new smw.util.tooltip(); - * tooltip.show ( { - * title: ..., - * type: ..., - * content: ..., - * button: ..., - * event: ... - * } ); - * - * @since 1.8 - * - * @param {Object} options - */ - show: function( options ) { - var self = this; - - // Check context - if ( options.context === undefined ){ - return $.error( 'smw.util.tooltip.show() is missing a context object' ); - } - - return options.context.each( function() { - $( this ).qtip( $.extend( {}, self.defaults.qtip, { - hide: options.button ? 'unfocus' : undefined, - show: { event: options.event, solo: true }, - content: { - text: options.content, - title: { - text: options.title, - button: options.button - } - } - } ) ); - } ); - }, - - /** - * The add method is a convenience method allowing to create a tooltip element - * with immediate instantiation - * - * @since 1.8 - * - * @param {Object} options - */ - add: function( options ) { - var self = this; - - // Defaults - var option = $.extend( true, self.defaults.classes, options ); - - // Check context - if ( option.context === undefined ){ - return $.error( 'smw.util.tooltip.add() is missing a context object' ); - } - - // Build a html element - function buildHtml( options ){ - return h.element( 'span', { 'class' : options.contextClass, 'data-type': options.type }, - new h.Raw( - h.element( 'span', { 'class' : options.targetClass }, null ) + - h.element( 'span', { 'class' : options.contentClass }, new h.Raw( options.content ) ) ) - ); - } - - // Assign context - var $this = option.context; - - // Append element - $this.prepend( buildHtml( option ) ); - - // Ensure that the right context is used as hoover/click element - // The class [] selector is not the fastest but the safest otherwise if - // spaces are used in the class definition it will break the selection - self.show.call( this, - $.extend( true, options, { - context: $this.find( "[class='" + option.targetClass + "']" ), - content: $this.find( "[class='" + option.contentClass + "']" ) - } ) - ); - } - }; - - /** - * Implementation of a tooltip instance - * @since 1.8 - * @ignore - */ - $( document ).ready( function() { - - $( '.smw-highlighter' ).each( function() { - - // Class reference - var tooltip = new smw.util.tooltip(); - - // Get configuration - var $this = $( this ), - eventPrefs = mw.user.options.get( 'smw-prefs-tooltip-option-click' ) ? 'click' : undefined, - state = $this.data( 'state' ), - title = $this.data( 'title' ), - type = $this.data( 'type' ); - - // Assign sub-class - // Inline mostly used for special properties and quantity conversions - // Persistent extends interactions for service links, info, and error messages - $this.addClass( state === 'inline' ? 'smwttinline' : 'smwttpersist' ); - - // Call instance - tooltip.show( { - context: $this, - content: $this.find( '.smwttcontent' ), - title : title !== undefined ? title : mw.msg( tooltip.getTitleMsg( type ) ), - event : eventPrefs, - button : type === 'warning' || state === 'inline' ? false /* false = no close button */ : true - } ); - - } ); - } ); - -} )( jQuery, mediaWiki, semanticMediaWiki ); |