អ្នកប្រើប្រាស់:វ័ណថារិទ្ធ/Gadget-switcher.js
សម្គាល់: បន្ទាប់ពីបានរក្សាទុករួចហើយ លោកអ្នកគួរតែសំអាត browser's cache របស់លោកអ្នកដើម្បីមើលការផ្លាស់ប្តូរ។ ខាងក្រោមនេះជាវិធីសំអាត browser's cache ចំពោះកម្មវិធីរុករក(Browser)មួយចំនួន។
- Firefox / Safari: សង្កត់ [Shift] ឱ្យជាប់រួចចុចប៊ូតុង Reload ឬក៏ចុច Ctrl-F5 ឬ Ctrl-R ( ⌘-R សំរាប់ Mac)
- Google Chrome: ចុច Ctrl-Shift-R (⌘-Shift-R សំរាប់ Mac)
- IE(Internet Explorer): សង្កត់ [Ctrl] ឱ្យជាប់ រួចចុច Refreshប៊ូតុង ឬក៏ចុច Ctrl-F5។
- Konqueror: ចុចប៊ូតុង Reload ឬក៏ចុច F5
- Opera: សូមសំអាតcacheនៅក្នុង [Tools]→[Preferences]
'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">Show all</label>' ).prepend(
$( '<input type="radio">' ).attr( 'name', radioName ).click( function () {
$( switchers ).show();
activeElement = switchers;
} )
).appendTo( container );
}
if ( switchers.length === 1 ) {
$radio.remove();
}
} );
} );