Browse Source

Prevent use of undocumented URL configuration parameters.

pull/101/head
Matthew Petroff 9 years ago
parent
commit
8947ba5946
3 changed files with 12 additions and 6 deletions
  1. +3
    -3
      doc/url-config-parameters.md
  2. +1
    -1
      examples/example-tour.htm
  3. +8
    -2
      src/standalone/standalone.js

+ 3
- 3
doc/url-config-parameters.md View File

@@ -14,6 +14,6 @@ Specifies the URL of a JSON configuration file.
## Other parameters

A subset of the JSON configuration file options can be used as URL parameters.
These include `author`, `title`, `hfov`, `pitch`, `yaw`, `haov`, `vaov`,
`vOffset`, `autoLoad`, `autoRotate`, `firstScene`, `ignoreGPanoXMP`, and
`fallback`.
These include `panorama`, `config`, `author`, `title`, `hfov`, `pitch`, `yaw`,
`haov`, `vaov`, `vOffset`, `autoLoad`, `autoRotate`, `firstScene`,
`ignoreGPanoXMP`, `preview`, and `fallback`.

+ 1
- 1
examples/example-tour.htm View File

@@ -5,6 +5,6 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<iframe width="480" height="390" allowfullscreen style="border-style:none;" src="../src/standalone/pannellum.htm?tour=../../examples/example-tour.json"></iframe>
<iframe width="480" height="390" allowfullscreen style="border-style:none;" src="../src/standalone/pannellum.htm?config=../../examples/example-tour.json"></iframe>
</body>
</html>

+ 8
- 2
src/standalone/standalone.js View File

@@ -21,14 +21,20 @@ function parseURLParameters() {
json += '"' + option + '":';
switch(option) {
case 'hfov': case 'pitch': case 'yaw': case 'haov': case 'vaov':
case 'vOffset':
case 'vOffset': case 'autoRotate':
json += value;
break;
case 'autoLoad': case 'ignoreGPanoXMP':
json += JSON.parse(value);
break;
default:
case 'tour':
console.log('The `tour` parameter is deprecated and will be removed. Use the `config` parameter instead.')
case 'author': case 'title': case 'firstScene': case 'fallback':
case 'preview': case 'panorama': case 'config':
json += '"' + decodeURIComponent(value) + '"';
break;
default:
anError('An invalid configuration parameter was specified: ' + option);
}
if (i < URL.length - 1) {
json += ',';


Loading…
Cancel
Save