Formulaic Analysis - warwickfoster/qurantools GitHub Wiki

File: app/dictionary/lane.php

Purpose

The code appears to be part of a web application that displays a PDF dictionary. It handles user input through arrow keys and provides an option to open the PDF in a new window.

Page and Volume Parameters

  • The code extracts the PAGE and VOLUME parameters from the URL query string.
  • It validates these parameters and sets default values of 1 for PAGE and 1 for VOLUME if they are not present.

Lightview Mode

  • The LIGHTVIEW flag is set based on a LIGHTVIEW parameter in the URL query string.
  • If LIGHTVIEW is set to "YES", the code indicates that the page is running in Lightview mode.

PDF Display

  • The GotoPage() function is called when the page loads, passing the PAGE and VOLUME parameters.
  • Based on the device type, the code either redirects the user to a PDF file or loads it dynamically using AJAX.

Key Handling

  • The code attaches a keydown event listener to the document.
  • When the escape key is pressed, the Lightview window is closed.
  • When the left or right arrow keys are pressed, the currentPage is updated, and the GotoPage() function is called again.

Additional Features

  • A link is displayed to open the PDF in a new window.
  • A footer is included when the page is not running in Lightview mode.