Файловый менеджер - Редактировать - /var/www/html/mediawiki-1.43.1/extensions/OOJSPlus/resources/ui/data/tree/Item.js
Ðазад
( function( mw, $ ) { OOJSPlus.ui.data.tree.Item = function ( cfg ) { OOJSPlus.ui.data.tree.Item.parent.call( this, cfg ); this.name = cfg.name; this.label = cfg.label; this.tree = cfg.tree; this.icon = cfg.icon || ''; this.buttonCfg = cfg; this.level = cfg.level; this.type = cfg.type; this.leaf = cfg.leaf || false; this.style = cfg.style || {} if ( !this.style.hasOwnProperty( 'IconExpand' ) ) { this.style.IconExpand = 'add'; } if ( !this.style.hasOwnProperty( 'IconCollapse' ) ) { this.style.IconCollapse = 'subtract'; } this.allowAdditions = typeof cfg.allowAdditions !== 'undefined' ? cfg.allowAdditions : this.tree.allowAdditions; this.labelAdd = typeof cfg.labelAdd !== 'undefined' ? cfg.labelAdd : this.tree.labelAdd; this.allowDeletions = typeof cfg.allowDeletions !== 'undefined' ? cfg.allowDeletions : this.tree.allowDeletions; this.labelDelete = typeof cfg.labelDelete !== 'undefined' ? cfg.labelDelete : this.tree.labelDelete; this.expanded = true; if ( cfg.hasOwnProperty( 'expanded' ) ) { this.expanded = cfg.expanded } if ( this.buttonCfg.hasOwnProperty( 'classes' ) ) { this.buttonCfg.classes.push( 'oojsplus-data-tree-label' ); } else { this.buttonCfg.classes = [ 'oojsplus-data-tree-label' ]; } if ( this.buttonCfg.hasOwnProperty( 'labelledby' ) ) { this.buttonCfg.id = this.buttonCfg.labelledby; delete this.buttonCfg.labelledby; } this.init(); }; OO.inheritClass( OOJSPlus.ui.data.tree.Item, OO.ui.Widget ); OOJSPlus.ui.data.tree.Item.static.tagName = 'li'; OOJSPlus.ui.data.tree.Item.prototype.init = function() { this.$element.children().remove(); this.$wrapper = $( '<div>' ); this.addLabel(); this.possiblyAddOptions(); this.$element.addClass( 'oojs-ui-data-tree-item' ); this.$element.attr( 'data-name', this.getName() ); this.$element.attr( 'role', 'treeitem' ); this.$element.append( this.$wrapper ); }; OOJSPlus.ui.data.tree.Item.prototype.setLevel = function( level ) { this.level = level; this.$element.attr( 'data-level', this.level ); }; OOJSPlus.ui.data.tree.Item.prototype.getLevel = function() { return this.level; }; OOJSPlus.ui.data.tree.Item.prototype.getName = function() { return this.name; }; OOJSPlus.ui.data.tree.Item.prototype.getLabel = function() { return this.label; }; OOJSPlus.ui.data.tree.Item.prototype.getIcon = function() { return this.icon; }; OOJSPlus.ui.data.tree.Item.prototype.getChildren = function() { var $ul = this.$element.find( '> ul.tree-node-list' ), $children = $ul.find( '> li.oojs-ui-data-tree-item' ), res = []; for ( var i = 0; i < $children.length; i++ ) { var name = $( $children[0] ).data( 'name' ); if ( this.tree.flat.hasOwnProperty( name ) ) { res.push( this.tree.flat[name] ); } } return res; }; OOJSPlus.ui.data.tree.Item.prototype.possiblyAddExpander = function() { var childrenCount = this.getChildren().length; if ( ( !this.leaf || childrenCount > 0 ) && !this.expander ) { this.expander = new OOJSPlus.ui.widget.ButtonWidget( { framed: false, icon: this.expanded ? this.style.IconCollapse : this.style.IconExpand, classes: [ 'oojsplus-data-tree-expander' ] } ); this.expander.$button.attr( 'aria-expanded', this.expanded ); this.expander.connect( this, { click: 'onExpanderClick' } ); this.$element.prepend( this.expander.$element ); } else if ( this.expander && childrenCount === 0 ) { this.expander.$element.remove(); this.expander = null; } }; OOJSPlus.ui.data.tree.Item.prototype.addLabel = function() { this.labelWidget = new OOJSPlus.ui.widget.LinkWidget( $.extend( {}, { framed: false, icon: this.getIcon(), }, this.buttonCfg ) ); // Do not use OOJS event handler here - blocks propagation this.labelWidget.$element.on( 'click', function( e ) { this.select(); this.emit( 'selected', this ); }.bind( this ) ); this.labelWidget.$element.on( 'keyup', function( e ) { if(( e.keyCode == 13 ) || ( e.keyCode == 32 )) { this.select(); this.emit( 'selected', this ); } }.bind( this ) ); this.$wrapper.append( this.labelWidget.$element ); }; OOJSPlus.ui.data.tree.Item.prototype.deselect = function() { this.$element.removeClass( 'item-selected' ); }; OOJSPlus.ui.data.tree.Item.prototype.select = function() { this.$element.addClass( 'item-selected' ); }; OOJSPlus.ui.data.tree.Item.prototype.possiblyAddOptions = function() { var options = []; if ( this.allowDeletions ) { this.removeNodeBtn = new OO.ui.ButtonWidget( { framed: false, label: this.labelDelete || mw.message( "oojsplus-data-tree-item-remove-label" ).text(), icon: 'close' } ); this.removeNodeBtn.connect( this, { click: 'onRemoveClick' } ); options.push( this.removeNodeBtn ); } if ( this.allowAdditions ) { this.addSubnodeBtn = new OO.ui.ButtonWidget( { framed: false, label: this.labelAdd || mw.message( "oojsplus-data-tree-item-add-label" ).text(), icon: 'add' } ); this.addSubnodeBtn.connect( this, { click: 'onAddSubnodeClick' } ); options.push( this.addSubnodeBtn.$element ); } if ( options.length === 0 ) { return; } this.optionsPanel = new OO.ui.PanelLayout( { expanded: false, padded: true, scrollable: false, framed: false, content: options } ); this.optionsPopup = new OO.ui.PopupButtonWidget( { icon: 'menu', framed: false, classes: [ 'tree-item-options-btn' ], popup: { $content: this.optionsPanel.$element, width: 'auto', align: 'forwards', classes: [ 'tree-item-options-popup' ] } } ); this.$wrapper.append( this.optionsPopup.$element ); }; OOJSPlus.ui.data.tree.Item.prototype.onExpanderClick = function() { if ( this.expanded ) { this.tree.collapseNode( this.getName() ); this.expander.setIcon( this.style.IconExpand ); this.expander.$button.attr( 'aria-expanded', 'false' ); this.expanded = false; } else { this.tree.assertNodeLoaded( this.name ).done( function() { this.tree.expandNode( this.getName() ); this.expander.setIcon( this.style.IconCollapse ); this.expander.$button.attr( 'aria-expanded', 'true' ); this.expanded = true; }.bind( this ) ); } }; OOJSPlus.ui.data.tree.Item.prototype.onRemoveClick = function() { var me = this; OO.ui.confirm( mw.message( 'oojsplus-data-tree-item-remove-confirm-label', me.getLabel() ).plain() ).done( function ( confirmed ) { if ( !confirmed ) { return; } me.optionsPopup.popup.toggle( false ); me.tree.removeNode( me.getName() ); } ); }; OOJSPlus.ui.data.tree.Item.prototype.onAddSubnodeClick = function() { this.optionsPopup.popup.toggle( false ); this.tree.addSubnode( this.getName() ); }; OOJSPlus.ui.data.tree.Item.prototype.onChildrenChanged = function() { this.possiblyAddExpander(); }; } )( mediaWiki, jQuery );
| ver. 1.1 | |
.
| PHP 8.4.18 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка