Merge "Removed code for and links to unused libraries"

This commit is contained in:
jenkins-bot 2013-01-12 05:20:10 +00:00 committed by Gerrit Code Review
commit 72c121684c
7 changed files with 1 additions and 580 deletions

View file

@ -64,11 +64,6 @@ $wgResourceModules += array(
'rangy/rangy-position.js',
),
),
'jquery.multiSuggest' => $wgVisualEditorResourceTemplate + array(
'scripts' => array(
'jquery/jquery.multiSuggest.js'
),
),
'jquery.visibleText' => $wgVisualEditorResourceTemplate + array(
'scripts' => array(
'jquery/jquery.visibleText.js'
@ -193,7 +188,6 @@ $wgResourceModules += array(
// ve
've/ve.Registry.js',
've/ve.Factory.js',
've/ve.Position.js',
've/ve.Command.js',
've/ve.CommandRegistry.js',
've/ve.Range.js',
@ -344,7 +338,6 @@ $wgResourceModules += array(
'ext.visualEditor.base',
'mediawiki.Title',
'jquery.autoEllipsis',
'jquery.multiSuggest'
),
'messages' => array(
'visualeditor',

View file

@ -63,8 +63,6 @@ $html = '<div>' . file_get_contents( $page ) . '</div>';
<!-- Generated by maintenance/makeStaticLoader.php -->
<!-- Dependencies -->
<script src="../../modules/jquery/jquery.js"></script>
<script src="../../modules/jquery/jquery.json.js"></script>
<script src="../../modules/jquery/jquery.multiSuggest.js"></script>
<script src="../../modules/rangy/rangy-core.js"></script>
<script src="../../modules/rangy/rangy-position.js"></script>
<!-- ext.visualEditor.base -->
@ -86,7 +84,6 @@ $html = '<div>' . file_get_contents( $page ) . '</div>';
<!-- ext.visualEditor.core -->
<script src="../../modules/ve/ve.Registry.js"></script>
<script src="../../modules/ve/ve.Factory.js"></script>
<script src="../../modules/ve/ve.Position.js"></script>
<script src="../../modules/ve/ve.Command.js"></script>
<script src="../../modules/ve/ve.CommandRegistry.js"></script>
<script src="../../modules/ve/ve.Range.js"></script>

View file

@ -41,7 +41,6 @@ class MakeStaticLoader extends Maintenance {
$wgResourceModules['Dependencies'] = array(
'scripts' => array(
'jquery/jquery.js',
'jquery/jquery.multiSuggest.js',
'rangy/rangy-core.js',
'rangy/rangy-position.js',
),

View file

@ -1,341 +0,0 @@
/*
* jQuery multiSuggeset Plugin v.01
*
* Copyright 2012, Rob Moen
* http://sane.ly
* This document is licensed as free software under the terms of the
* MIT License: http://www.opensource.org/licenses/mit-license.php
*
* Example:
*
// Input element.
var $input = $( '#exampleInput' );
// Multi Suggest configuration.
var options = {
'parent': $input.parent(),
'prefix': 'example-multi',
// Build suggestion groups in order.
'suggestions': function ( params ) {
// Generic params object.
var example = params.example,
example2 = params.example2,
query = params.query;
groups = {
// Set 1
'query': {
'label': 'Query',
'items': [query],
'itemClass': 'query-class'
},
// Set 2
'exampleGroup': {
'label': 'Example 1',
'items': example,
'itemClass': 'example-class'
},
// Set 3
'exampleGroup2': {
'label': 'Example 2',
'items': example2,
'itemClass': 'example-class'
}
};
// Return the groups object.
return groups;
},
// Called on succesfull input.
'input': function ( callback ) {
var query = $input.val();
// Example params object.
var params = {
'query': query,
'example': ['example item 1', 'example item 2', 'example item 3', 'example item 4'],
'example2': ['example item 5', 'example item 6']
};
// Build with params.
callback( params );
}
};
// Setup
$input.multiSuggest( options );
*/
( function ( $ ) {
$.fn.multiSuggest = function ( options ) {
return this.each( function () {
// Private members.
var inputTimer = null,
visible = false,
focused = false,
$input = $( this ),
currentInput = '',
$multiSuggest;
// Merge options with default configuration.
$.extend( {
'doc': document,
'prefix': 'multi',
'cssEllipsis': true
}, options );
// DOM Setup.
$multiSuggest = $( '<div>', options.doc )
.addClass( options.prefix + '-suggest-select' )
.hide();
$( options.parent ).append( $multiSuggest );
/* Methods */
// Hides & Show MultiSuggest.
function toggle() {
if ( visible ) {
close();
} else {
open();
}
}
// Call configured input method and supply the private build method as callback.
function onInput( immediate ) {
var delay = immediate ? 0 : 250;
// Throttle
clearTimeout( inputTimer );
inputTimer = setTimeout( function () {
var txt = $input.val();
if ( txt !== '' ) {
// Be sure that input has changed.
if (
txt !== currentInput &&
typeof options.input === 'function'
) {
options.input.call( $input, function ( params, callback ) {
build( params );
} );
} else if ( !visible && txt === currentInput ) {
open();
}
} else {
// No Text, close.
if ( visible ) {
close();
}
}
// Set current input.
currentInput = txt;
}, delay );
}
// Opens the MultiSuggest dropdown.
function open() {
if ( !visible ) {
$multiSuggest.show();
visible = true;
}
}
// Closes the dropdown.
function close() {
if ( visible ) {
setTimeout( function () {
visible = false;
$multiSuggest.hide();
}, 100 );
}
}
// When an item is selected in the dropdown.
function select( text ) {
// Cache input.
currentInput = text;
$input.val( text );
close();
if ( typeof options.select === 'function' ) {
options.select.call( this );
}
}
// When an item is "clicked".
// Use of mousedown to prevent blur.
function onItemMousedown( e ) {
e.preventDefault();
$multiSuggest
.find( '.' + options.prefix + '-suggest-item' )
.removeClass( 'selected' );
$( this ).addClass( 'selected' );
select.call( this, $( this ).data( 'text' ) );
}
function onItemMouseenter() {
$( this ).addClass( 'hover' );
}
function onItemMouseleave() {
$( this ).removeClass( 'hover' );
}
// Adds a group to the dropdown.
function addGroup( name, group ) {
var $groupWrap,
$group,
$item,
i;
// Add a container with a label for this group.
$group = $( '<div>', options.doc )
.addClass( options.prefix + '-suggest-container' )
.append(
$( '<div>', options.doc )
.addClass( options.prefix + '-suggest-label' )
.text( group.label )
)
.append(
$( '<div>', options.doc ).addClass( options.prefix + '-suggest-wrap' )
)
// Add a clear break.
.append( $( '<div style="clear: both;">', options.doc ) );
// Add group
$multiSuggest.append( $group );
// Find the group wrapper element.
$groupWrap = $group.find( '.' + options.prefix + '-suggest-wrap' );
// If no items, add a dummy element to take up space.
if ( group.items.length === 0 ) {
$groupWrap.append(
$( '<div>&nbsp;</div>', options.doc )
.addClass( options.prefix + '-suggest-dummy-item' )
);
}
// Add each item.
for( i = 0; i < group.items.length; i++ ) {
$item = $( '<div>', options.doc )
.addClass( options.prefix + '-suggest-item' )
.data( 'text', group.items[i] )
.on( {
'mousedown': onItemMousedown,
'mouseenter': onItemMouseenter,
'mouseleave': onItemMouseleave
} );
if ( 'itemClass' in group ) {
$item.addClass( group.itemClass );
}
$groupWrap.append( $item );
// Wrap in span
$item.append( $( '<span>' )
.css( 'whiteSpace', 'nowrap' )
.text( group.items[i] )
);
// Select the first item by default
if (
$multiSuggest.find( '.selected' ).length === 0 &&
group.items[i].toLowerCase() === $input.val().toLowerCase() )
{
$item.addClass( 'selected' );
}
// CSS Ellipsis
if ( options.cssEllipsis ) {
$item.css( {
'white-space': 'nowrap',
'overflow': 'hidden',
'-o-text-overflow': 'ellipsis',
'text-overflow': 'ellipsis'
} );
}
}
}
// Build the dropdown.
// Fired as callback in configured input event.
function build( params ) {
var suggestions = options.suggestions( params ),
group;
// Setup groups
$multiSuggest.empty();
if ( suggestions !== undefined ) {
for ( group in suggestions ) {
if ( $.isPlainObject( suggestions[group] ) ) {
addGroup( group, suggestions[group] );
}
}
// Open dropdown.
open();
// Run update method supplied in configuration.
if ( typeof options.update === 'function' ) {
options.update();
}
}
}
// Bind target input events
$input.on( {
// Handle any change to the input.
'keydown cut paste': function ( e ) {
var $item,
$items = $multiSuggest
.find( '.' + options.prefix + '-suggest-item' ),
selected = 0;
// Find the selected index.
$.each( $items, function ( i, e ) {
if( $( this ).hasClass( 'selected' ) ) {
selected = i;
}
});
// Down arrow
if ( e.which === 40 ) {
e.preventDefault();
// If not visible, open and do nothing.
if ( !visible ) {
open();
return;
}
selected = ( selected + 1 ) % $items.length;
$items.removeClass( 'selected' );
$( $items[selected] ).addClass( 'selected' );
// Up Arrow
} else if ( e.which === 38 ) {
e.preventDefault();
// If not visible, open and do nothing.
if ( !visible ) {
open();
return;
}
selected = ( selected + $items.length - 1 ) % $items.length;
$items.removeClass( 'selected' );
$( $items[selected] ).addClass( 'selected' );
// Enter key.
} else if ( e.which === 13 ) {
// Only if the dropdown is open.
if ( visible ) {
e.preventDefault();
$item = $multiSuggest
.find( '.' + options.prefix + '-suggest-item.selected' );
if ( $item.length > 0 ) {
select.call( this, $item.data( 'text' ) );
} else {
close();
}
return;
}
// Escape
} else if ( e.which === 27 ) {
close();
return;
// Normal input.
} else {
onInput();
}
},
'focus': function () {
focused = true;
onInput( true );
},
'blur': function () {
focused = false;
close();
},
'mousedown': function () {
if ( focused ) {
toggle();
}
}
} );
return this;
} );
};
}( jQuery ) );

View file

@ -11,7 +11,6 @@
<!-- Generated by maintenance/makeStaticLoader.php -->
<!-- Dependencies -->
<script src="../../jquery/jquery.js"></script>
<script src="../../jquery/jquery.multiSuggest.js"></script>
<script src="../../rangy/rangy-core.js"></script>
<script src="../../rangy/rangy-position.js"></script>
<!-- ext.visualEditor.base -->
@ -33,7 +32,6 @@
<!-- ext.visualEditor.core -->
<script src="../../ve/ve.Registry.js"></script>
<script src="../../ve/ve.Factory.js"></script>
<script src="../../ve/ve.Position.js"></script>
<script src="../../ve/ve.Command.js"></script>
<script src="../../ve/ve.CommandRegistry.js"></script>
<script src="../../ve/ve.Range.js"></script>

View file

@ -227,7 +227,7 @@ ve.ui.Context.prototype.update = function () {
ve.ui.Context.prototype.show = function () {
var selectionRect = this.surface.getView().getSelectionRect();
this.position = new ve.Position( selectionRect.end.x, selectionRect.end.y );
this.position = { 'left': selectionRect.end.x, 'top': selectionRect.end.y };
this.$.css( this.position );
// Show context

View file

@ -1,225 +0,0 @@
/*!
* VisualEditor Position class.
*
* @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* Pixel position.
*
* This can also support an optional bottom field, to represent a vertical line, such as a cursor.
*
* @class
* @constructor
* @param {number} left Horizontal position
* @param {number} top Vertical top position
* @param {number} bottom Vertical bottom position of bottom (optional, default: top)
* @property {number} left Horizontal position
* @property {number} top Vertical top position
* @property {number} bottom Vertical bottom position of bottom
*/
ve.Position = function VePosition( left, top, bottom ) {
this.left = left || 0;
this.top = top || 0;
this.bottom = bottom || this.top;
};
/* Static Methods */
/**
* Creates position object from the page position of an element.
*
* @static
* @method
* @param {jQuery} $element Element to get offset from
* @returns {ve.Position} Position with element data applied
*/
ve.Position.newFromElementPagePosition = function ( $element ) {
var offset = $element.offset();
return new ve.Position( offset.left, offset.top );
};
/**
* Creates position object from the layer position of an element.
*
* @static
* @method
* @param {jQuery} $element Element to get position from
* @returns {ve.Position} Position with element data applied
*/
ve.Position.newFromElementLayerPosition = function ( $element ) {
var position = $element.position();
return new ve.Position( position.left, position.top );
};
/**
* Creates position object from the screen position data in an Event object.
*
* @static
* @method
* @param {Event} event Event to get position data from
* @returns {ve.Position} Position with event data applied
*/
ve.Position.newFromEventScreenPosition = function ( event ) {
return new ve.Position( event.screenX, event.screenY );
};
/**
* Creates position object from the page position data in an Event object.
*
* @static
* @method
* @param {Event} event Event to get position data from
* @returns {ve.Position} Position with event data applied
*/
ve.Position.newFromEventPagePosition = function ( event ) {
return new ve.Position( event.pageX, event.pageY );
};
/**
* Creates position object from the layer position data in an Event object.
*
* @static
* @method
* @param {Event} event Event to get position data from
* @returns {ve.Position} Position with event data applied
*/
ve.Position.newFromEventLayerPosition = function ( event ) {
return new ve.Position( event.layerX, event.layerY );
};
/* Methods */
/**
* Adds the values of a given position to this one.
*
* @method
* @param {ve.Position} position Position to add values from
*/
ve.Position.prototype.add = function ( position ) {
this.top += position.top;
this.bottom += position.bottom;
this.left += position.left;
};
/**
* Subtracts the values of a given position to this one.
*
* @method
* @param {ve.Position} position Position to subtract values from
*/
ve.Position.prototype.subtract = function ( position ) {
this.top -= position.top;
this.bottom -= position.bottom;
this.left -= position.left;
};
/**
* Checks if this position is the same as another one.
*
* @method
* @param {ve.Position} position Position to compare with
* @returns {boolean} If positions have the same left and top values
*/
ve.Position.prototype.at = function ( position ) {
return this.left === position.left && this.top === position.top;
};
/**
* Checks if this position perpendicular with another one, sharing either a top or left value.
*
* @method
* @param {ve.Position} position Position to compare with
* @returns {boolean} If positions share a top or a left value
*/
ve.Position.prototype.perpendicularWith = function ( position ) {
return this.left === position.left || this.top === position.top;
};
/**
* Checks if this position is level with another one, having the same top value.
*
* @method
* @param {ve.Position} position Position to compare with
* @returns {boolean} If positions have the same top value
*/
ve.Position.prototype.levelWith = function ( position ) {
return this.top === position.top;
};
/**
* Checks if this position is plumb with another one, having the same left value.
*
* @method
* @param {ve.Position} position Position to compare with
* @returns {boolean} If positions have the same left value
*/
ve.Position.prototype.plumbWith = function ( position ) {
return this.left === position.left;
};
/**
* Checks if this position is nearby another one.
*
* Distance is measured radially.
*
* @method
* @param {ve.Position} position Position to compare with
* @param {number} radius Pixel distance from this position to consider "near-by"
* @returns {boolean} If positions are near-by each other
*/
ve.Position.prototype.near = function ( position, radius ) {
return Math.sqrt(
Math.pow( this.left - position.left, 2 ),
Math.pow( this.top - position.top )
) <= radius;
};
/**
* Checks if this position is above another one.
*
* This method utilizes the bottom property.
*
* @method
* @param {ve.Position} position Position to compare with
* @returns {boolean} If this position is above the other
*/
ve.Position.prototype.above = function ( position ) {
return this.bottom < position.top;
};
/**
* Checks if this position is below another one.
*
* This method utilizes the bottom property.
*
* @method
* @param {ve.Position} position Position to compare with
* @returns {boolean} If this position is below the other
*/
ve.Position.prototype.below = function ( position ) {
return this.top > position.bottom;
};
/**
* Checks if this position is to the left of another one.
*
* @method
* @param {ve.Position} position Position to compare with
* @returns {boolean} If this position is the left the other
*/
ve.Position.prototype.leftOf = function ( left ) {
return this.left < left;
};
/**
* Checks if this position is to the right of another one.
*
* @method
* @param {ve.Position} position Position to compare with
* @returns {boolean} If this position is the right the other
*/
ve.Position.prototype.rightOf = function ( left ) {
return this.left > left;
};