Files
tubestation/browser/components/loop/standalone/content/index.html

239 lines
9.1 KiB
HTML

<!DOCTYPE html>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<html>
<head>
<meta charset="utf-8">
<meta name="locales" content="en-US" />
<meta name="default_locale" content="en-US" />
<meta name="referrer" content="origin" />
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" type="text/css" href="shared/css/reset.css">
<link rel="stylesheet" type="text/css" href="shared/css/common.css">
<link rel="stylesheet" type="text/css" href="shared/css/conversation.css">
<link rel="stylesheet" type="text/css" href="css/webapp.css">
<link rel="localization" href="l10n/{locale}/loop.properties">
<script>
function insertScript(url, sync) {
var node = document.createElement("script");
var sibling = document.getElementsByTagName("script")[0];
node.async = !sync;
node.src = url;
sibling.parentNode.insertBefore(node, sibling);
}
/**
* Synchronously load the supplied script into the DOM (using <script>).
* Eventually, we probably want to do a full build step even for
* development, after which this can go away.
*
* Instead of having to specify the scripts we need here, and in
* some webpack config file for bundling, we specify them in
* webappEntryPoint.js, which require()s them. Webpack handles that
* during bundling, but for the current dev-server setup, where we don't
* (yet) have a full build step, we need to provide a require() function.
*
* @param webpackUrl - a URL, possibly preceded by webpack loader syntax.
* webpack loader syntax is stripped off
*
*/
function require(url) {
// strip off everything up to and including the last !, as those are
// all directives to webpack
var devTimeUrl = url.replace(/^.*!/, '');
insertScript(devTimeUrl, true);
}
// Various browsers use different mechanisms to indicate whether
// the user has opted-in to the "Do Not Track" mechanism. We check for
// each of them and disable the use of Google Analytics if any are
// present. Note that Internet Explorer versions 10 and 11 did not
// have an opt-in "Do not Track" mechanism, so we specifically
// ignore their indications.
(function() {
function enableTracking() {
// This is an unfolded, readable version of the official GA inclusion
// script.
window.GoogleAnalyticsObject = "ga";
window.ga = window.ga || function() {
(window.ga.q = window.ga.q || []).push(arguments);
};
window.ga.l = 1 * new Date();
insertScript("//www.google-analytics.com/analytics.js");
window.ga("create", "UA-36116321-15", "auto");
/* Don't send conversation ids to GA, by specifying our own location. */
window.ga("set", {
"location": document.location.origin + "/conversation/",
"anonymizeIp": true,
"title": "Link Clicker"
});
window.ga("send", "pageview");
}
insertScript("//cdn.optimizely.com/js/2768540301.js");
// See also
// https://developer.mozilla.org/en-US/docs/Web/API/Navigator/doNotTrack#Browser_compatibility
var trackEnable = true;
// window.navigator.doNotTrack "yes" is for old versions of FF
// window.navigator.doNotTrack "1" is for current versions of FF + Chrome + Opera
if (window.navigator.doNotTrack === "yes" || String(window.navigator.doNotTrack) === "1") {
trackEnable = false;
}
// window.doNotTrack is "1" for Safari, IE11, and IE12
// Ignore IE11 DNT setting
if (String(window.doNotTrack) === "1") {
// Honour if Safari or IE12
if (navigator.userAgent.indexOf("Safari") !== -1) {
trackEnable = false;
} else {
// Is MS IE11 or IE12
// Disable tracking for IE12 only
if (!/rv[ :]11/g.test(window.navigator.userAgent)) {
trackEnable = false;
}
}
}
// window.navigator.msDoNotTrack is "1" for IE9 and IE10
// Honor MS-specific "Do Not Track" for IE 9 only
if (String(window.navigator.msDoNotTrack) === "1" &&
window.navigator.userAgent.search("IE 9") !== -1) {
trackEnable = false;
}
if (trackEnable) {
enableTracking();
}
})();
</script>
</head>
<body class="standalone">
<div id="main"></div>
<!-- libs -->
<script>
// IE9, 10, and 11 lack the window.CustomEvent constructor. IE11 has the
// window.CustomEvent object, but it throws when new CustomEvent(...) is
// called, with the exception of "Object doesn't support this action". IE9
// introduced document.createEvent. Nothing we can do for IE8 here.
var customEventCtorWorks;
try {
if (window.CustomEvent) {
customEventCtorWorks = new CustomEvent("test", {"detail":{"sampleProperty":true}});
}
} catch (ex) {}
var basicCustomEvent = document.createEvent("CustomEvent");
if (!customEventCtorWorks && basicCustomEvent && basicCustomEvent.initCustomEvent) {
function myCustomEvent(event, params) {
params = params || {bubbles: false, cancelable: false, detail: undefined};
var evt = document.createEvent("CustomEvent");
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
return evt;
}
myCustomEvent.prototype = window.Event.prototype;
window.CustomEvent = myCustomEvent;
}
// To support IE for the l10n-gaia library on IE <= 10.
if (!("language" in navigator)) {
navigator.language = navigator.browserLanguage;
}
// To support IE <= 10.
if (!window.MutationObserver) {
// Define a dummy MutationObserver object if one doesn't exist
// This could later be extended to use Mutation events but for
// now this will simply result in no-ops.
function myMutationObserver() {}
myMutationObserver.prototype = {
disconnect: function() {},
observe: function () {},
takeRecords: function() {}
};
window.MutationObserver = myMutationObserver;
}
window.OTProperties = {
cdnURL: "shared/libs/"
};
window.OTProperties.assetURL = window.OTProperties.cdnURL + "sdk-content/";
window.OTProperties.configURL = window.OTProperties.assetURL + "js/dynamic_config.min.js";
// We don't use the SDK's CSS. This will prevent spurious 404 errors.
window.OTProperties.cssURL = "about:blank";
</script>
<script>
// Explicitly create this here so that it's deterministic and easier to
// understand, rather than having it created as a side-effect of loading
// one of our faux-modules.
var loop = {};
</script>
<script type="text/javascript" src="config.js"></script>
<script>
// Wait for both "localized" to fire and webapp.js to finish executing.
// This needs to be available ahead of either of those things happening,
// so we declare it here.
//
// The localized event fires asynchronously after l10n.js loads,
// so it could happen before or after loop.webapp.init has been
// defined.
//
// This means at least in the (current) dev setup where our
// require shim injects script tags dynamically. The race could conceivably
// happen in production as well, after l10n.js loads and before webpack.js
// is loaded.
//
// Fortunately, that dev setup nastiness will go away once we get to a
// single build setup using real modules and obsolete build-jsx.
var localizedHasFired = false;
function initIfReady() {
if (localizedHasFired && "webapp" in loop) {
loop.webapp.init();
}
}
</script>
<!-- We'd like to bundle/minify this at some point, but we need to work
out how to configure webpack to run this in a module container
rather than directly in the global scope. -->
<!-- Note that as long as the various closures in the files loaded by
webppEntryPoint.js take navigator.mozL10n as an argument, this
JS must run to completion before that file loads, so this one must be
loaded synchronously first -->
<script type="text/javascript" src="libs/l10n-gaia-02ca67948fe8.js">
</script>
<!-- Note that for 'make dist', webappEntryPoint.js is replaced by
the standalone.js bundle -->
<script type="text/javascript" src="webappEntryPoint.js"></script>
<script>
window.addEventListener("localized", function() {
// see the initIfReady() comments in this file for details
localizedHasFired = true;
initIfReady();
}, false);
</script>
<noscript>
<img src="img/logo.png" border="0" alt="Logo"/>
</noscript>
</body>
</html>