User:CaptainOfTheTidesBreath/common.js

mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Joeytje50/JWB.js/load.js&action=raw&ctype=text/javascript');

/** * Show/hide for media timeline -- by Grunny on Wookieepedia **/ $( function {	if( !$( '.timeline-toggles' ).length ) {		return;	}	$( '.timeline-toggles' ).find( 'td > a' ).click( function  { var	hideBtnClass = $( this ).parent.attr( 'class' ), $hideContent = $( 'tr.' + hideBtnClass ); if( !$hideContent.length ) { return; }		$hideContent.toggle; if ( $( this ).text.indexOf( 'hide' ) >= 1 ) { $( this ).text( $( this ).text.replace( 'hide', 'show' ) ); } else { $( this ).text( $( this ).text.replace( 'show', 'hide' ) ); }	} ); } );

// Imported from User:Alex Smotrov/edittop.js, version as of: 21:57, January 25, 2021 if ((mw.config.get('wgAction') == 'view' || mw.config.get('wgAction') == 'purge') && mw.config.get('wgNamespaceNumber') >=0) addOnloadHook(function edittop_hook{ var h2s = document.getElementsByTagName('H2'); var h2 = h2s[0]; if (!h2) return; if (h2.parentNode.id == 'toctitle') h2 = h2s[1]; if (!h2) return; var span = h2.firstChild; if (!span || span.className != 'editsection') return; var zero = span.cloneNode(true); if (document.getElementById('featured-star')) zero.style.marginRight = '25px'; if (document.getElementById('spoken-icon')) zero.style.marginRight = '45px'; if (document.getElementById('protected-icon') && zero.style.marginRight) zero.style.marginRight = '70px'; var parent = document.getElementsByTagName('H1')[0]; parent.insertBefore(zero, parent.firstChild); var a = zero.getElementsByTagName('A')[0]; if (a.href.indexOf('&section=T') == -1){  a.title = a.title.replace(/:.*$/,': 0')   a.setAttribute('href', a.href.replace(/&section=\d+/,'&section=0')); }else{//transcluded   a.title = 'Edit section: 0' a.setAttribute('href', mw.config.get('wgScript')+'?title='+encodeURIComponent(mw.config.get('wgPageName'))+'&action=edit&section=0') } })