User:P999/Toggle VF.js

/* Toggle VF */

// timestamp 24 May 2022 1800 | 22 May 2022 1535 1358 0821 | 21 May 2022 0723 | 20 May 2022 1642 | ... | 05 May 2022 2139 | 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){

}

}

// Printable VF Button

mw.loader.using( 'mediawiki.util', function () {

$( document ).ready( function() {

var prntVF = mw.util.addPortletLink ( 'p-coll-print_export', 'https://en.wikipedia.org/w/index.php?title=' + encodeURIComponent(currpgName) + '&printable=yes', "Printable VF", "p-VF", "Voice-friendly version for printing [v]","v");

$( prntVF ).click( function() {

setFlag();

});

});

});

// Toggle VF Button

var next="center";

mw.loader.using( 'mediawiki.util', function () {

$( document ).ready( function() {

var ToggVF = mw.util.addPortletLink( "p-tb", "#", "Toggle VF", "t-Toggle VF","Convert to Voice-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( '' );

$( ".wgCoordinates" ).hide();

$( ".mw-headline[id='References'] " ).hide();

$( ".mw-jump-link" ).hide();

$( ".mw-message-box-warning" ).hide();

$( ".reference" ).hide();

$( "ol.references" ).hide();

$( ".toc" ).hide();

$( ".template" ).hide();

$( ".Template-Fact" ).hide();

$( ".collapsible" ).hide();

$( ".navbox" ).hide();

$( ".navbar" ).hide();

$( ".thumb" ).hide();

$( ".wikitable" ).hide();

$( ".toccolours" ).hide();

$( ".hatnote" ).hide();

$( ".hlist" ).hide();

$( ".mw-headline[id='External_Links'] " ).hide();

$( "#External_links" ).hide();

//

$( ".ambox" ).hide();

$( ".mbox" ).hide();

$( ".ombox" ).hide();

$( ".dmbox" ).hide();

$( ".fmbox" ).hide();

$( ".geobox" ).hide();

$( ".messagebox" ).hide();

$( ".warningbox" ).hide();

$( ".sidebar" ).hide();

$( ".infobox" ).hide();

$( ".infobox.sisterproject" ).hide();

$( ".infobox.subdivision" ).hide();

$( ".dablink" ).hide();

$( ".metadata" ).hide();

$( ".editlink" ).hide();

//

$( "#siteSub" ).hide();

$( ".printfooter" ).hide();

$( "#catlinks, .catlinks" ).hide();

$( "#footer" ).hide();

$( "#header" ).hide();

$( ".image" ).hide();

$( ".metadata" ).hide();

$( ".protected" ).hide();

$( ".boilerplate" ).hide();

$( ".mw-editsection-bracket" ).hide();

$( ".mw-editsection" ).hide();

$( ".noprint" ).hide();

$( ".vector-menu-content-list" ).hide();

$( ".vector-menu-heading-label" ).hide();

$( ".wb-langlinks-edit" ).hide();

$( ".mw-portlet" ).hide();

$( ".portlet" ).hide();

$( ".compact-ambox" ).hide();

$( ".image" ).hide();

$( ".thumbimage" ).hide();

$( "table" ).hide();

// $("cite[class*='citation']" ).hide(); hides all items in Bib

// $("cite[id*='CITEREF']" ).hide(); this also hides all items in Bib

$( 'a[href*="/wiki/ISBN_(identifier)"]').hide();

$( 'a[href*="Special:BookSources"]').hide();

// $( 'a[rel*=”nofollow”][title*=”(identifier)”]' ).show(); shows all items in Bib

// $( 'a[rel*=”nofollow”][class*!="mw-redirect"]' ).show(); check syntax does not contain

// $( 'a[rel*=”nofollow”][class:not(:contains(”mw-redirect”))]' ).alert('TESTING' );

// $('a[rel*=”nofollow”][title*=”(_identifier)”)]' ).hide();

// $( "[rel*=’nofollow’][class*='external text']" ).show(); this showed all items and went to PDF

// $( "[rel*=’nofollow’][class!=’mw-redirect’]" ).show();

// $('[rel*=”nofollow”][class$=”dentifier])”]' ).alert("found");

// alert('test in progress'); successfully displayed alert

$( "[title$='dentifier)']" ).hide(); // this hides all journal id numbers

$( 'a[rel*="nofollow"]' ).hide(); // this hides all id labels

/*

$( 'a[href*="/wiki/ASIN_(identifier)"]').hide();

$( 'a[href*="/wiki/Bibcode_(identifier)"]').hide();

$( 'a[href*="/wiki/CiteSeerX_(identifier)"]').hide();

$( 'a[href*="/wiki/Doi_(identifier)"]').hide();

$( 'a[href*="/wiki/ISSN_(identifier)"]').hide();

$( 'a[href*="/wiki/JSTOR_(identifier)"]').hide();

$( 'a[href*="/wiki/LCCN_(identifier)"]').hide();

$( 'a[href*="/wiki/OCLC_(identifier)"]').hide();

$( 'a[href*="/wiki/PMC_(identifier)"]').hide();

$( 'a[href*="/wiki/PMID_(identifier)"]').hide();

$( 'a[href*="/wiki/ProQuest_(identifier)"]').hide();

$( 'a[href*="/wiki/S2CID_(identifier)"]').hide();

  • /

// +++ rem -- still some identifiers I need to remove +++

}

// ----------------------------------