Legacy Tools

Gdoc Converter Script


gdoc_toprint_v3.js

This Javascript is for turning a Google Doc saved as html into a print.php file. However, in order to convert a Google doc to a useful print.php file, the Google doc must be prepared with proper pseudo-tags and elements to be able to convert it.

1. Pre-conversion setup

2. Conversion process

  • Google Doc: Download file as Web Page (.html, zipped)

  • File Explorer: Move html file to lesson directory in Deved

  • File Explorer: Rename html file to construct.html

  • HTML Editor: Open construct.html in a text/html editor and add the following scripts before the first <style> tag:

<script src="jquery/jquery.min.js"></script>
<script src="https://deved.meted.ucar.edu/latest_core/~components/gdoc_toprint/gdoc_toprint_v3.js"></script>
  • HTML Editor: Save the construct.html file

  • Mozilla Firefox: Open the file from its Deved URL

deved.meted.ucar.edu/CATEGORY/LESSON/construct.html

  • Mozilla Firefox: If no browser alerts with errors occur, select everything in the browser window by pressing (⌘ + a), then right click on the selected content and select View Selection Source.

    • Make sure there are no critical errors before proceeding from this step. Check browser console for potential errors.

  • Mozilla Firefox: A new window/tab with the source code will open. From this new window/tab, select all the source code and copy to the clipboard by pressing (⌘ + c).

  • HTML Editor: Open print.php from the Deved directory and paste the contents from the clipboard to replace everything starting from line 4 by pressing (⌘ + v).

  • HTML Editor: Save the print.php file and open it from its Deved URL to check that everything converted properly.

deved.meted.ucar.edu/CATEGORY/LESSON/print.php

3. Post-conversion adjustments

All of the following should be done from the HTML Editor on the print.php file.

  • Remove all classes from the <html> tag, and add the attribute lang="en"

  • Remove all attributes from the <body> tag

  • Remove class .active from the last item(s) in the table of contents menu

  • Remove fancybox in-head <style> tag and its contents

  • Correct the php calls for images

    • Find and replace &lt;?php for <?php

    • Find and replace mm-&gt; for mm->

    • Find and replace ?&gt; for ?>

  • Adjust HTML comments at bottom of script

    • If the lesson view is not working and indicating an error on line 64, check the directory for ._print.php files (Mac turd files) and remove them.

Simple Print Converter


Simple Print Converter Tool ↗ (coming soon)

This tool offers an option to downloading the Gdoc file as a Web Page, by instead simply copying all the content from the Gdoc and pasting it into the text editor window.

To create a print, you'll need to follow the same steps as the Gdoc Converter Script, but you'll have to create a construct.html file from scratch to paste the source code.


You can use the blank print.php file(s) generated with the MetEd Lesson Generator to use this tool, or create a print.php file(s) from scratch.

Print Skelleton Builder Tool (Legacy Print Maker) ↗ (coming soon)

Version 1 to Version 2 Converter Script


v1_to_v2.js

This Javascript file converts legacy print.htm or print.php files into a current Latest Core working file. This script will convert Meted Lessons with dot based 1.0.0 navigation syntax (Latest Core v1) to a dash based 1-0-0 navigation syntax (Latest Core v2+).

Follow these steps to convert a legacy print.php to the be usable within the latest framework.

  • File Explorer: Create a directory for your project and copy the latest core framework.

  • File Explorer: Copy print.php or print.htm from the original legacy directory to the new target directory and rename it "construct". (Leave file extension intact)

  • HTML Editor: Add necessary scripts to the construct file -

Add this snippet to the head of document:

<script type="text/javascript" src="jquery/jquery.min.js"></script>

Add this snippet at the end of the document (before the closing html tag):

<script type="text/javascript" src="https://deved.meted.ucar.edu/latest_core/~components/v1_converter/v1_to_v2.js"></script>
  • Mozilla Firefox: Open the file from its Deved URL

deved.meted.ucar.edu/CATEGORY/LESSON/construct.html

  • Mozilla Firefox: In the browser window press (⌘ + a), then right click on the selected content and select View Selection Source.

    • Make sure there are no critical errors before proceeding from this step. Check browser console for potential errors.

  • Mozilla Firefox: From this data source, copy the content from line ~53 (starting with "<script type="text/javascript">var printVersion...") to the end of the source.

  • HTML Editor: Open the new print.php file and paste the content from step 6 in this document to replace the pre-existing text starting on line ~49 to the end of the document.

  • HTML Editor:

    • Add the correct lesson name to the <title> tag

    • In the menu click Tools > Commands > Apply Source Formatting

    • Remove lines ~52-55 in-head fancybox styles

    • Remove any classes or additional attributes from the <body> tag

    • Remove empty <li> tags from the navigation menu

    • Remove class .active from the last item in the table of contents (if present)

    • Remove any IE conditionals that appear right before the <body> tag, only one conditional should appear inside of the <head> tag

    • At the bottom of the document uncomment the following scripts if necessary:

      • Back to top button

      • Quiz and Survey prompts

Last updated