User:P999/Toggle VF

The primary purpose of the script Toggle VF is to create a voice-friendly (VF) version of any Wikipedia article that will be suitable for seamless reading aloud by text-to-speech applications such as "Voice Dream", "Text Aloud", Microsoft's "Narrator", Apple's "VoiceOver", etc. This voice-friendly version is produced by suppressing those parts of a Wikipedia article that cannot be correctly or meaningfully rendered by a text-to-speech application; depending on the article in question, these non-renderable items may include images, tables, in-line references, various templates and user interface elements, as well as metadata. The Toggle VF display of an article may also be of interest to those users who prefer to read an uncluttered version of Wikipedia articles on the screen. Toggle VF has been designed so as not to interfere with the normal reading and printing operations of Wikipedia. It will reside 'silently' on your computer and only be activated when you click on either the "Toggle VF" button or the "Printable VF" button.

Usage
You must have the "Adobe PDF" virtual printer, "Microsoft Print to PDF" , or some other virtual PDF printer installed as a printer on your computer or mobile device in order to follow the instructions that will be provided in this documentation. Additionally, it is very convenient, although by no means necessary, to store the PDF files created by Toggle VF on a cloud drive, ideally in a folder/directory labeled 'WPVF' since doing this will make your voice-friendly Wikipedia files easy to locate when you want your text-to-speech application to read them aloud. (Note: "Google Drive" has been found to work best if you are going to be transferring multiple files.) Follow the instructions for installation in the section below. After you have done so, check to make certain that the option "Toggle VF" appears in the "Tools" section of the Navigation Bar. If you do not see this option it means that the script Toggle VF is not active, so please check your installation. Once Toggle VF has been successfully installed, by clicking on the button labeled Toggle VF when in screen display mode, the user can toggle between viewing the voice-friendly format and the normal Wikipedia format. In the Mozilla browser, and possibly some other browsers, you can also use the access key SHIFT+ALT+4 for the same purpose. Navigate to a Wikipedia article that you want to convert to VF format. If you are viewing it in normal Wikipedia format, click on the Toggle VF button in the Navigation Bar (or use the SHIFT+ALT+4 access key) if you wish to preview it in VF format. (Depending on the length of the article, there may be a delay of a few seconds for processing before it re-appears in VF format.) To indicate that the VF format is being displayed, the main title of the article will have been shifted from its normal left-aligned position to a center-aligned position. Next, select the "Printable VF" option in the "Print/export" section (or use the SHIFT+ALT+v access key). After a few seconds, the voice-friendly printable version of the article you have chosen should be displayed. Note: Instructions from here on will be provided for the Mozilla browser, but Toggle VF has also been found to work successfully in Internet Explorer, Opera, Chrome, Safari and SeaMonkey. In Mozilla's "File" dropdown menu, click on the "Print" option, then select "Adobe PDF" as your printer. (Note: It is critically important that you choose the "Print" option here rather than the "Save as PDF" option since only the "Print" option will save the VF version.) When the next window opens, you must decide whether to save the voice-friendly PDF to a cloud drive or to a local one. Having chosen which drive to use, accept the name suggested for the PDF file, or type in a different one; then, click "Save". Within a few seconds, your PDF file should have been saved to the drive of your choice. The voice-friendly PDF file you have just saved can now be read aloud by your text-to-speech application. Simply open the folder (directory) where you have saved it, locate your new PDF file and hover over its name. If you are running Windows, you can click on your right mouse button and look at the dropdown menu that appears. If you see your text-to-speech application listed, click on it and it should immediately begin reading your voice-friendly PDF. If you don't see your text-to-speech application listed, you can choose "Open with" and navigate to it. It is also the case that you can open your voice-friendly PDF with "Adobe Acrobat Reader" and then use the Adobe text-to-speech function that is available under the "View | Read Out Loud" option to have it read aloud. Please note that the normal printable version of a Wikipedia article (including the Table of Contents, images, infoboxes, inline references, etc) can be generated at any time by clicking on the "Printable version" button or by using the the access key SHIFT+ALT+p. Also, it is not necessary to view an article in VF format prior to printing it in VF format. You can move directly from the normal view of an article to the Printable VF format simply by clicking on the "Printable VF" button or by using the the access key SHIFT+ALT+v.

Alternative method for iOS devices using Safari and Voice Dream
These instructions are for Safari and Voice Dream only. You must have the Voice Dream app installed on your iOS device in order for this method to work.

First, use Toggle VF to make a Printable VF version of the Wikipedia article that you want Voice Dream to read aloud.

Next, with the Printable VF page on your display, click on 'Share Page With'.

When 'Share Page With' opens, select Voice Dream in the dropdown menu and click on it. (Note that, for unknown reasons, it may take a few seconds for Voice Dream to appear in the list of this dropdown. You may even have to click on the 'Share Page With' icon a second time to get it to appear.)

When the Printable VF article has been successfully sent to (ie, 'Shared With') Voice Dream, the Printable VF article will be displayed on a Voice Dream screen. You should now be looking at the beginning of your Printable VF Wikipedia article. At the bottom of this screen, choose the option 'PDF'. Next, click on the option 'Save' in the top right corner. The Printable VF Wikipedia article should now have been saved into the active folder of your Voice Dream Library and it is ready to be read aloud. At this point, Safari will automatically return you to the Printable VF article on the Wikipedia website.

In order to have Voice Dream read the VF article you have just saved, switch to the Voice Dream app on your device and locate the newly-saved article in your active folder. Click on its title to begin listening to Voice Dream's audio rendition of it. The article will remain in your Voice Dream Library permanently, unless you choose to delete it.

Please note: The method described above was tested with satisfactory results using iPadiOS 14.2 and Voice Dream 4.9.4

Installation
First, make sure you are registered and logged in. Only logged-in users can install scripts. To install Toggle VF, add the code shown below to your common.js file or to the .js file associated with any skin you may prefer: . After you have copied the necessary code to the common.js file (or the .js file of the skin you have selected), save the page and then bypass your cache (by holding down the Shift key while clicking Reload in Mozilla) to make sure the changes take effect. A link titled Toggle VF will appear in the Tools sidebar.

De-Activation
If a user wishes to de-activate Toggle VF, he can do this by editing the .js file where he originally saved it. To suspend it temporarily, he can 'comment out' the line that he had added when installing it by enclosing it between /* and */ symbols. If he wishes to de-activate it permanently, he can delete the line of code that was added when it was installed. After either suspending or deleting the script, he should bypass his browser's cache (by holding down the Shift key while clicking Reload in Mozilla).

Source code
The source code is available at User:P999/Toggle VF.js.

User feedback
Please post any comments, suggestions, bug reports etc about Toggle VF on its Talk page.