/* 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"); 	

    $( 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');
// 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" ).hide();
$( ".mw-headline " ).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 " ).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" ).hide();    hides all items in Bib
//  $("cite" ).hide();   this also hides all items in Bib



$( 'a').hide();
$( 'a').hide();


//  $( 'a' ).show();  shows all items in Bib

//  $( 'a' ).show();  check syntax  does not contain

//  $( 'a' ).alert('TESTING' );

//  $('a' ).hide();


// $( "" ).show();  this showed all items and went to PDF


//  $( "" ).show();


//   $(')”]' ).alert("found");




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



$( "" ).hide();   //  this hides all journal id numbers

$( 'a' ).hide();  // this hides all id labels


/*

$( 'a').hide();
$( 'a').hide();
$( 'a').hide();
$( 'a').hide();   
$( 'a').hide();
$( 'a').hide();
$( 'a').hide();
$( 'a').hide();
$( 'a').hide();
$( 'a').hide();
$( 'a').hide();
$( 'a').hide();

*/

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

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