"मेडियाविकि:Gadget-switcher.js" के अवतरणसभमे अन्तर
Content deleted Content added
Biplab Anand (वार्ता | योगदान) अनुवाद |
Biplab Anand (वार्ता | योगदान) अ Update per enwiki |
||
पङ्क्त्ति १:
$( function (
▲ 'use strict';
$.each( document.querySelectorAll( '.switcher-container' ), function ( i ) {
switchers = [], container = this, radioName = 'switcher-' + i;
var
▲ $( this ).children().each( function () {
▲ var $labelContainer = $( this ).find( '.switcher-label' );
▲ var $labelText = $labelContainer.contents();
▲ if ( !$labelText.length ) {
switchers.push( switcher );
▲ return;
▲ }
▲ $showRadio = $( '<input type="radio" />' ).attr( 'name', radioName ).click( function () {
▲ $( self ).show();
activeElement = self;▼
} );▼
$( '<label style="display:block"></label>' ).append( $showRadio ).append( $labelText ).appendTo( container );▼
▲ if ( !activeElement ) {
activeElement = this;▼
$showRadio.prop( 'checked', true );▼
} else if ( $labelContainer.is( '[data-switcher-default]' ) ) { ▼
$showRadio.click();▼
} else {▼
$( this ).hide();▼
}▼
$labelContainer.remove();▼
} );
if (
// Mark the first one as selected
$showAllRadio = $( '<input type="radio" />' ).attr( 'name', radioName ).click( function () {▼
$( elements ).show();▼
// Custom default
$( '<label style="display:block">सभ देखी</label>' ).prepend( $showAllRadio ).appendTo( container );▼
} else if ( elements.length === 1 ) {▼
$showRadio.remove();▼
// Hide non-default
}
▲
} );
if ( switchers.length > 1 ) {
▲
).appendTo( container );
}
} );
}
|