မီဒီယာဝီကီ:Gadget-switcher.js

ဝီကီပီးဒီးယား မှ

မှတ်ချက်။ လွှင့်တင်လိုက်ပြီးသည့်နောက် ပြောင်းလဲမှုများ မြင်ရနိုင်ရန် သင့်အနေဖြင့် ဘရောက်ဇာ၏ cache အား ဖြတ်ကျော်နိုင်ရန် လိုအပ်ပါသည်။

  • Firefox / Safari: Reload ကို နှိပ်နေစဉ်အတွင်း Shift ကို ဖိထားပါ၊ သို့မဟုတ် Ctrl-F5 သို့ Ctrl-R (Mac တွင် ⌘-R) ကို နှိပ်ပါ။
  • Google Chrome: Ctrl-Shift-R (Mac တွင် ⌘-Shift-R) ကို နှိပ်ပါ။
  • Internet Explorer / Edge: Refresh ကို နှိပ်နေစဉ်အတွင်း Ctrl ကို ဖိထားပါ၊ သို့မဟုတ် Ctrl-F5 ကို နှိပ်ပါ။
  • Opera: Menu → Settings (Mac တွင် Opera → Preferences) သို့ သွားပြီး Privacy & security → Clear browsing data → Cached images and files ကို ပြုလုပ်ပါ။
'use strict';
$( function () {
	$.each( document.querySelectorAll( '.switcher-container' ), function ( i ) {
		var activeElement,
			switchers = [], container = this, radioName = 'switcher-' + i;
		$.each( this.children, function () {
			var $radio, switcher = this,
				$labelContainer = $( switcher.querySelector('.switcher-label') ),
				$labelText = $labelContainer.contents();
			if ( !$labelText.length ) {
				return;
			}
			switchers.push( switcher );
			$radio = $( '<input type="radio">' ).attr( 'name', radioName ).click( function () {
				$( activeElement ).hide();
				$( switcher ).show();
				activeElement = switcher;
			} );
			if ( !activeElement ) {
				// Mark the first one as selected
				activeElement = switcher;
				$radio.prop( 'checked', true );
			} else if ( $labelContainer.attr( 'data-switcher-default' ) !== undefined ) {
				// Custom default
				$radio.click();
			} else {
				// Hide non-default
				$( switcher ).hide();
			}
			$( '<label style="display:block"></label>' ).append( $radio, $labelText ).appendTo( container );
			$labelContainer.remove();
		} );
		if ( switchers.length > 1 ) {
			$( '<label style="display:block">အားလုံး ပြသရန်</label>' ).prepend(
				$( '<input type="radio">' ).attr( 'name', radioName ).click( function () {
					$( switchers ).show();
					activeElement = switchers;
				} )
			).appendTo( container );
		}
		if ( switchers.length === 1 ) {
			$radio.remove();
		}
	} );
} );