MediaWiki:Gadget-DraftReview-Draggable.js

Questa pagina definisce alcuni parametri di aspetto e comportamento generale di tutte le pagine. Per personalizzarli vedi Aiuto:Stile utente.


Nota: dopo aver salvato è necessario pulire la cache del proprio browser per vedere i cambiamenti (per le pagine globali è comunque necessario attendere qualche minuto). Per Mozilla / Firefox / Safari: fare clic su Ricarica tenendo premuto il tasto delle maiuscole, oppure premere Ctrl-F5 o Ctrl-R (Command-R su Mac); per Chrome: premere Ctrl-Shift-R (Command-Shift-R su un Mac); per Konqueror: premere il pulsante Ricarica o il tasto F5; per Opera può essere necessario svuotare completamente la cache dal menù Strumenti → Preferenze; per Internet Explorer: mantenere premuto il tasto Ctrl mentre si preme il pulsante Aggiorna o premere Ctrl-F5.

function DraggableGroupWidget( config ) {
	DraggableGroupWidget.super.call( this, config );

	OO.ui.mixin.DraggableGroupElement.call( this, $.extend( {
		$group: this.$element
	}, config ) );
}

OO.inheritClass( DraggableGroupWidget, OO.ui.Widget );
OO.mixinClass( DraggableGroupWidget, OO.ui.mixin.DraggableGroupElement );

DraggableGroupWidget.prototype.addItem = function ( comment ) {
	var item = Object.assign( { icon: 'draggable' }, comment );
	var newDraggableItem = new DraggableItemWidget( item );
	this.addItems( [ newDraggableItem ] );
};

DraggableGroupWidget.prototype.updateIndexesAfterNewItemsAdded = function () {
	this.itemsOrder = this.items.slice();

	var i, len;

	for ( i = 0, len = this.itemsOrder.length; i < len; i++ ) {
		this.itemsOrder[ i ].setIndex( i );
	}
};

function DraggableItemWidget( config ) {

	DraggableItemWidget.super.call( this, config );

	OO.ui.mixin.IconElement.call( this, config );
	OO.ui.mixin.LabelElement.call( this, config );

	this.$icon
		.css( 'position', 'absolute' )
		.css( 'left', '0.9375em' );
	this.$element
		.css( 'display' , 'block' )
		.css( 'padding', '0.203125em 0.9375em 0.125em 2.96875em' )
		.css( 'position', 'relative' )
		.append( this.$icon, this.$label );

	OO.ui.mixin.DraggableElement.call( this, config );
}

OO.inheritClass( DraggableItemWidget, OO.ui.Widget );
OO.mixinClass( DraggableItemWidget, OO.ui.mixin.IconElement );
OO.mixinClass( DraggableItemWidget, OO.ui.mixin.LabelElement );
OO.mixinClass( DraggableItemWidget, OO.ui.mixin.DraggableElement );

module.exports = DraggableGroupWidget;