mozilla/pdf.js — pull request #3850 by Snuffleupagus (2013-10-27 12:47:24+00:00)
Title: Implement default preferences

This PR implements a framework for default preferences in PDF.js, hence this supersedes #3255.
Compared to the previous patch, this one is written such that is should be completely browser/platform agnostic.

In this PR the functions for reading/writing the preferences are provided as empty stubs, which are then overridden by specific versions for the different builds.
@brendandahl Is that the approach you had in mind with [this comment](https://github.com/mozilla/pdf.js/pull/3255#issuecomment-26373931), or should it be done differently?

In this initial patch, the following default preferences are added (default values in bold):
* `showPreviousViewOnLoad`: __true__ | false.

Setting this to false will always load the document at the first page.
* `defaultZoomValue`: __[empty string]__.

Setting this to either one of the predefined zoom values (auto, page-actual, page-fit or page-width), or a numerical value, will load all documents with this zoom value *irrespective* of the saved zoom settings.
* `ifAvailableShowOutlineOnLoad`: __false__ | true.

Setting this to true will automatically display the outline when the document is loaded, but *only if* the document actually contains an outline.

As a follow-up to this PR, I've got a prototype UI for displaying/changing the preferences in the viewer.

Fixes #1624, #2568 and [bug 845946](https://bugzilla.mozilla.org/show_bug.cgi?id=845946); and contains an improved version of PR #2691.

PS. @brendandahl I really like your suggestion about the current `Settings`: https://github.com/mozilla/pdf.js/pull/3255#issuecomment-26374851, but I decided to implement that in a follow-up PR to keep this patch smaller and easier to test.