MediaWiki:Gadget-common-special-watchlist.js

ХӀара гӀирс Википеди чуьра бу — маьрша энциклопеди

Билгалдаккхар: Ӏалашйинчул тӀаьхьа хийцамаш га браузеран кэш цӀанйан йезаш хила мега.

  • Firefox / Safari: Shift тӀетаӀийна йитина, гӀирсийн панелан тӀера тӀетаӀайе Карлайаккха йа Ctrl+F5 йа Ctrl+R (⌘+R Mac тӀехь)
  • Google Chrome: тӀетаӀайе Ctrl+Shift+R (⌘+Shift+R Mac тӀехь)
  • Internet Explorer / Edge: тӀетаӀийна йитина Ctrl, тӀетаӀайе Карлайаккха йа тӀетаӀайе Ctrl+F5
  • Opera: тӀетаӀайе Ctrl+F5.
/* Не удаляйте проверку на название спецстраницы */
mw.loader.using( 'mediawiki.storage', () => {
	if ( mw.config.get( 'wgCanonicalSpecialPageName' ) !== 'Watchlist' ) {
		return;
	}
	
	$( '.watchlist-msg' ).each( function() {
		if ( !this.id ) return;
		var hideId = 'ruwiki-wlhide-' + this.id;

		if ( mw.storage.get( hideId ) ) {
			this.classList.add( 'watchlist-msg-hidden' );
		} else {
			var toggle = document.createElement( 'a' );
			toggle.className = 'watchlist-msg-close';
			toggle.setAttribute( 'href', '#' );
			toggle.setAttribute( 'role', 'button' );
			toggle.setAttribute( 'aria-label', 'Къайлабаккха кӀиранна' );
			toggle.setAttribute( 'title', 'Къайлабаккха кӀиранна йа керла хилламаш хилалца' );
			
			$( toggle )
				.on( 'click', function ( e ) {
					e.preventDefault();
					// 7 * 24 * 60 * 60 (7 дней)
					mw.storage.set( hideId, 1, 604800 );
					var $parent = $( this ).parent();
					$parent.addClass( 'watchlist-msg-hidden' );
					$parent.parent().focus();
				} )
				.on( 'keydown', function ( e ) {
					if ( [ 'Space', 'Enter' ].includes( e.code ) ) {
						e.preventDefault();
						$( this ).click();
					}
				} );
			
			this.insertBefore( toggle, this.firstChild );
			this.classList.add( 'watchlist-msg-hideable' );
			$( this ).parent().attr( 'tabindex', '-1' );
		}
	} );
	
	mw.hook( 'structuredChangeFilters.ui.initialized' ).add(function () {
		$( '.watchlist-wrapper' ).prependTo( $( '.mw-rcfilters-ui-watchlistTopSectionWidget-editWatchlistButton' ) );
		$( '.mw-rcfilters-ui-watchlistTopSectionWidget-editWatchlistButton' )
			.removeClass( 'mw-rcfilters-ui-watchlistTopSectionWidget-editWatchlistButton' )
			.find( '.oo-ui-buttonWidget' )
			.wrap( '<div>' )
			.parent()
			.addClass( 'mw-rcfilters-ui-watchlistTopSectionWidget-editWatchlistButton' )
			.appendTo( '.mw-rcfilters-ui-watchlistTopSectionWidget-watchlistDetails' );
	} );
} );