// এই স্ক্রিপটির অংশিক mw:Gadget-UTCLiveClock.js থেকে আনা হয়েছে ও বাংলায় ফলাফল দেয়ার উপযোগী করে ঠিক // করা হয়েছে। হালনাগাদের সময় করনীয় আলাপ পাতায় দেখুন। /*global mw, $ */ function convert(str) {     var mystr = str.toString();     var outj; // javascript escaped hex     var outj1;     var be = new Array();     be['1'] = "\u09E7";     be['2'] = "\u09E8";     be['3'] = "\u09E9";     be['4'] = "\u09EA";     be['5'] = "\u09EB";     be['6'] = "\u09EC";     be['7'] = "\u09ED";     be['8'] = "\u09EE";     be['9'] = "\u09EF";     be['0'] = "\u09E6";     be[' '] = ;     be['-'] = '-';     outj1 = "";     for (var i = 0; i < mystr.length; i++) {         var ch = mystr.substr(i, 1);         outj = be[ch];         outj1 += outj;     }     return outj1;  } mw.loader.using( ['mediawiki.util', 'mediawiki.api'] ).then( function () {  function padWithZeroes( num ) { 	// Pad a number with zeroes. The number must be an integer where 	// 0 <= num < 100. 	return num < 10 ? '0' + num.toString() : num.toString();  }  function showTime( $target ) { 	var now = new Date(); 	 	var timezone = window.LiveClockTimeZone || 'UTC';  	// Set the time. 	var hh, mm, ss; 	if ( timezone === "UTC" ) { 		hh = now.getUTCHours(); 		mm = now.getUTCMinutes(); 		ss = now.getUTCSeconds(); 	} else if ( timezone === "local" ) { 		hh = now.getHours(); 		mm = now.getMinutes(); 		ss = now.getSeconds(); 	} else { 		var newNow; 		try { 			newNow = new Date( 				now.toLocaleString( 					"en-US", 					{ timeZone: timezone } 				) 			); 			hh = newNow.getHours(); 			mm = newNow.getMinutes(); 			ss = newNow.getSeconds(); 		} catch ( err ) { 			console.log( "LiveClock - error creating Date object with timezone '" + timezone + "': " + err.name); 			timezone = "UTC"; 			newNow = now; 			hh = now.getUTCHours(); 			mm = now.getUTCMinutes(); 			ss = now.getUTCSeconds(); 		} 	} 	var time = convert(padWithZeroes( hh )) + ':' + convert(padWithZeroes( mm )) + ':' + convert(padWithZeroes( ss )); 	$target.text( time );  	// Schedule the next time change. 	//  	// We schedule the change for 100 ms _after_ the next clock tick. The delay 	// from setTimeout is not precise, and if we aim exactly for the tick, there 	// is a chance that the function will run slightly before it. If this 	// happens, we will display the same time for two seconds in a row - not 	// good. By scheduling 100 ms after the tick, we will always be about 100 ms 	// late, but we are also very likely to display a new time every second. 	var ms = now.getUTCMilliseconds(); 	setTimeout( function () { 		showTime( $target ); 	}, 1100 - ms ); }  function liveClock() { 	// Set CSS styles. We do this here instead of on the CSS page because some 	// wikis load this page directly, without loading the accompanying CSS. 	mw.util.addCSS( '#utcdate a { font-weight:bolder; font-size:120%; }' );  	// Reset whitespace that was set in the peer CSS gadget; this prevents the 	// effect of the p-personal menu jumping to the left when the JavaScript 	// loads. 	$( '.client-js > body.skin-vector #p-personal ul' ).css( 'margin-right', 'initial' ); 	$( '.client-js > body.skin-monobook #p-personal ul' ).css( 'margin-right', 'initial' );  	// Add the portlet link. 	var node = mw.util.addPortletLink( 		document.getElementById( 'p-personal-more' ) ? 'p-personal-more' : 'p-personal', 		mw.util.getUrl( null, { action: 'purge' } ), 		, 		'utcdate' 	); 	if ( !node ) { 		return; 	}  	// Purge the page when the clock is clicked. We have to do this through the 	// API, as purge URLs now make people click through a confirmation screen. 	$( node ).on( 'click', function ( e ) { 		new mw.Api().post( { action: 'purge', titles: mw.config.get( 'wgPageName' ) } ).then( function () { 			location.reload(); 		}, function () { 			mw.notify( 'শোধন ব্যর্থ হয়েছে', { type: 'error' } ); 		} ); 		e.preventDefault(); 	} );  	// Show the clock. 	showTime( $( node ).find( 'a:first' ) ); }  $( liveClock ); } );