User:Isochrone/Spoken.js
Appearance
(Redirected from User:Berrely/Spoken.js)
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | Documentation for this user script can be added at User:Isochrone/Spoken. |
/* Toggle VF, blatantly stolen from [[User:P999]], all credits go to him. I simply removed some code for usage at [[WP:SPOKEN]] */
// timestamp 05 Aug 2020 1421
var currpgName = mw.config.get( 'wgPageName' );
var currURL = document.location.href;
var prntable = currURL.endsWith("&printable=yes");
var torf = prntable.toString();
var myFlag; // must be defined here
var currFlag;
function chkmyFlag() {
try{
currFlag=window.localStorage.getItem("myFlag");
} catch (e) {
}
if (currFlag=="VF" && torf=="true")
{
nullFlag();
dotogg();
}
}
chkmyFlag();
function nullFlag() {
try {
window.localStorage.setItem("myFlag", "null");
} catch(e) {
}
}
function setFlag() {
try {
window.localStorage.setItem("myFlag", "VF");
} catch (e) {
}
}
function clrFlag() {
try {
window.localStorage.clear();
} catch(e){
}
}
// Toggle VF Button
var next="center";
mw.loader.using( 'mediawiki.util', function () {
$( document ).ready( function() {
var ToggVF = mw.util.addPortletLink( "p-tb", "#", "Toggle Spoken", "t-Toggle VF","Convert to Spoken Article friendly format[4]",'4');
// alert('next is: ' + next);
$( ToggVF ).click( function() {
dotogg();
if (next=="center") {firstHeading.style.textAlign = "center";
$( ".Template-Fact" ).hide(); next="left"; }
else
{firstHeading.style.textAlign = "left";
$( ".Template-Fact" ).show(); next="center";}
} );
} );
} );
// = = = = = = = = = = = = = = = = = = = =
function dotogg() {
$( 'head' ).append( '<style type="text/css" media="screen, print">' + ' ul { list-style: none; }' + '</style>' );
$( "wgCoordinates" ).toggle();
$( ".mw-headline[id='References'] " ).toggle();
$( ".mw-jump-link" ).toggle();
$( ".reference" ).toggle();
$( "ol.references" ).toggle();
//$( ".toc" ).toggle();
$( ".template" ).toggle();
$( ".Template-Fact" ).hide();
$( ".collapsible" ).hide();
$( ".navbox" ).toggle();
$( ".navbar" ).toggle();
//$( ".thumb" ).toggle();
//$( ".wikitable" ).toggle();
//$( ".toccolours" ).toggle();
$( ".hatnote" ).toggle();
//$( ".hlist" ).toggle();
$( ".mw-headline[id='External_Links'] " ).toggle();
$( ".external" ).toggle();
// $( ".external text").toggle();
// $( ".external.text" ).show(); // showing only Ext Links
//
$( ".ambox" ).toggle();
$( ".mbox" ).toggle();
$( ".ombox" ).toggle();
$( ".dmbox" ).toggle();
$( ".fmbox" ).toggle();
$( ".geobox" ).toggle();
$( ".messagebox" ).toggle();
$( ".warningbox" ).toggle();
$( ".sidebar" ).toggle();
//$( ".infobox" ).toggle();
//$( ".infobox.sisterproject" ).toggle();
//$( ".infobox.subdivision" ).toggle();
$( ".dablink" ).toggle();
$( ".metadata" ).toggle();
$( ".editlink" ).toggle();
//
//$( "#siteSub" ).toggle();
$( ".printfooter" ).toggle();
$( "#catlinks, .catlinks" ).toggle();
//$( "#footer" ).toggle();
//$( "#header" ).toggle();
//$( ".image" ).toggle();
//$( ".metadata" ).toggle();
//$( ".protected" ).toggle();
$( ".boilerplate" ).toggle();
$( ".mw-editsection-bracket" ).toggle();
$( ".mw-editsection" ).toggle();
$( ".ipa" ).toggle();
}
// ----------------------------------