Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
|
|
@ -0,0 +1,19 @@
|
|||
<element name="fxa-coppa" extends="section">
|
||||
<template>
|
||||
<section class="vertical">
|
||||
<h3 data-l10n-id="fxa-age-verification">
|
||||
Age verification
|
||||
</h3>
|
||||
<ul class="fxa-verification-wrapper">
|
||||
<li>
|
||||
<span class="button icon icon-dialog">
|
||||
<select id="fxa-age-select">
|
||||
<option value="0" data-l10n-id="fxa-year-of-birth">Year of birth</option>
|
||||
</select>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<script src='js/screens/fxam_coppa.js'></script>
|
||||
</template>
|
||||
</element>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<element name="fxa-email" extends="section">
|
||||
<template>
|
||||
<section class="vertical">
|
||||
<div id="fxa-logo" class="fxa-logo"></div>
|
||||
<p class="fxa-intro" data-l10n-id="fxa-use-email-to-sign-in">
|
||||
</p>
|
||||
<input id="fxa-email-input" data-l10n-id="fxa-enter-email-input" type="email" placeholder="Enter your email" required="" x-inputmode="verbatim">
|
||||
|
||||
<p id="fxa-notice" class="fine-print" data-l10n-id="fxa-notice2">
|
||||
<a id="fxa-terms" href="https://accounts.firefox.com/legal/terms"></a>
|
||||
<a id="fxa-privacy" href="https://accounts.firefox.com/legal/privacy"></a>
|
||||
</p>
|
||||
</section>
|
||||
<script src='js/screens/fxam_enter_email.js'></script>
|
||||
</template>
|
||||
</element>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<element name="fxa-enter-password" extends="section">
|
||||
<template>
|
||||
<section class="vertical">
|
||||
<h3 data-l10n-id="fxa-enter-password-title">Enter Your Password</h3>
|
||||
<p id="fxa-hello-known-user">Hello, <a id="fxa-known-user-email">holaENTER@email.com</a></p>
|
||||
<input id="fxa-pw-input" type="password" placeholder="Password" required pattern=".{8,}" data-l10n-id="fxa-password" x-inputmode="verbatim">
|
||||
<p class="fine-print"><a id="fxa-forgot-password" data-l10n-id="fxa-forgot-your-password">Forgot your password?</a></p>
|
||||
<div id="show-pw-wrapper">
|
||||
<label class="pack-checkbox" for="fxa-show-pw">
|
||||
<input id="fxa-show-pw" type="checkbox">
|
||||
<span></span>
|
||||
</label>
|
||||
<p data-l10n-id="fxa-show-password">Show password</p>
|
||||
</div>
|
||||
<script src='js/screens/fxam_enter_password.js'></script>
|
||||
</section>
|
||||
</template>
|
||||
</element>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<element name="fxa-error-overlay" extends="form">
|
||||
<template>
|
||||
<section>
|
||||
<h1 id="fxa-error-title"></h1>
|
||||
<p>
|
||||
<small id="fxa-error-msg"></small>
|
||||
<small id="fxa-error-msg-coppa">
|
||||
<a id="coppa-link" href="#"></a>
|
||||
</small>
|
||||
</p>
|
||||
<menu>
|
||||
<button class="full" data-l10n-id="fxa-ok" id="fxa-error-ok"></button>
|
||||
</menu>
|
||||
</section>
|
||||
</template>
|
||||
</element>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<element name="fxa-pp" extends="section">
|
||||
<template>
|
||||
<section role="region">
|
||||
<h3 data-l10n-id="fxa-pp-header">Privacy Policy</h3>
|
||||
<p data-l10n-id="fxa-pp1">
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eius mod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequ at. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
</p>
|
||||
<p data-l10n-id="fxa-pp2">
|
||||
Excepteur sint occaecat qui of fi cia deserunt mollit anim id est lab orum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. D uis aute irure dolor in.
|
||||
</p>
|
||||
</section>
|
||||
</template>
|
||||
</element>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<element name="fxa-refresh-auth" extends="section">
|
||||
<template>
|
||||
<section class="vertical">
|
||||
<p id="fxa-password-refresh" data-l10n-id="fxa-password-refresh">Please enter your Firefox Account password to continue.</p>
|
||||
<input id="fxa-pw-input-refresh" type="password" placeholder="Password" required="" pattern=".{8,}" data-l10n-id="fxa-password">
|
||||
<p class="fine-print"><a id="fxa-forgot-password-refresh" data-l10n-id="fxa-forgot-your-password">Forgot your password?</a></p>
|
||||
<div id="show-pw-wrapper">
|
||||
<label class="pack-checkbox" for="fxa-show-pw-refresh">
|
||||
<input id="fxa-show-pw-refresh" type="checkbox">
|
||||
<span></span>
|
||||
</label>
|
||||
<p data-l10n-id="fxa-show-password">Show password</p>
|
||||
</div>
|
||||
<script src='js/screens/fxam_refresh_auth.js'></script>
|
||||
</section>
|
||||
</template>
|
||||
</element>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<element name="fxa-set-password" extends="section">
|
||||
<template>
|
||||
<section class="vertical">
|
||||
<h3 data-l10n-id="fxa-create-password-title"></h3>
|
||||
<p id="fxa-hello-user"><a id="fxa-user-set-email"></a></p>
|
||||
<input id="fxa-pw-set-input" type="password" placeholder="Password" required="" pattern=".{8,}" data-l10n-id="fxa-password" x-inputmode="verbatim">
|
||||
<p class="fine-print" data-l10n-id="fxa-password-length-requirement">
|
||||
</p>
|
||||
<div id="show-pw-wrapper">
|
||||
<label class="pack-checkbox" for="fxa-show-pw-set">
|
||||
<input id="fxa-show-pw-set" type="checkbox">
|
||||
<span></span>
|
||||
</label>
|
||||
<p data-l10n-id="fxa-show-password"></p>
|
||||
</div>
|
||||
<script src='js/screens/fxam_set_password.js'></script>
|
||||
</section>
|
||||
</template>
|
||||
</element>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<element name="fxa-signin-success" extends="section">
|
||||
<template>
|
||||
<section class="vertical">
|
||||
<h3 data-l10n-id="fxa-success">
|
||||
Success!
|
||||
</h3>
|
||||
<p data-l10n-id="fxa-ready-to-go">
|
||||
Your Firefox Account is ready to go!
|
||||
</p>
|
||||
<p data-l10n-id="fxa-use-features">
|
||||
Now you can use features like Find My Device and apps like the Firefox Marketplace.
|
||||
</p>
|
||||
<p data-l10n-id="fxa-access-manage-account-settings">
|
||||
In the future, you can access and manage your account from Settings.
|
||||
</p>
|
||||
<script src='js/screens/fxam_signin_success.js'></script>
|
||||
</section>
|
||||
</template>
|
||||
</element>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<element name="fxa-signup-success" extends="section">
|
||||
<template>
|
||||
<section class="vertical">
|
||||
<h3 data-l10n-id="fxa-confirm-account">
|
||||
Confirm Your Account
|
||||
</h3>
|
||||
<p id="fxa-will-send-email" class="fxa-envelope">
|
||||
We will send an email to: <strong id="fxa-summary-email">email</strong>
|
||||
</p>
|
||||
<p data-l10n-id="fxa-signup-click-verification-link-in-email">
|
||||
Next time you check your email, click the verification link to confirm your Firefox Account.
|
||||
</p>
|
||||
<p data-l10n-id="fxa-access-manage-account-settings">
|
||||
In the future, you can access and manage your account from Settings.
|
||||
</p>
|
||||
<script src='js/screens/fxam_signup_success.js'></script>
|
||||
</section>
|
||||
</template>
|
||||
</element>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<element name="fxa-tos" extends="section">
|
||||
<template>
|
||||
<section role="region">
|
||||
<h3 data-l10n-id="fxa-tos-header">Terms of Service</h3>
|
||||
<p data-l10n-id="fxa-tos1">
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eius mod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequ at. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
</p>
|
||||
<p data-l10n-id="fxa-tos2">
|
||||
Excepteur sint occaecat qui of fi cia deserunt mollit anim id est lab orum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. D uis aute irure dolor in.
|
||||
</p>
|
||||
</section>
|
||||
</template>
|
||||
</element>
|
||||
225
assets/webapps/system.gaiamobile.org/fxa/fxa_module.html
Normal file
225
assets/webapps/system.gaiamobile.org/fxa/fxa_module.html
Normal file
|
|
@ -0,0 +1,225 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en-US" dir="ltr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link href="../shared/style/switches.css" rel="stylesheet" type="text/css">
|
||||
<link href="../shared/style/buttons.css" rel="stylesheet" type="text/css">
|
||||
<link href="../shared/style/confirm.css" rel="stylesheet" type="text/css">
|
||||
<link href="../shared/style/input_areas.css" rel="stylesheet" type="text/css">
|
||||
<link href="../shared/style/progress_activity.css" rel="stylesheet" type="text/css">
|
||||
<link href="style/fxa.css" rel="stylesheet" type="text/css">
|
||||
|
||||
<!-- Gaia Components -->
|
||||
<link href="app://theme.gaiamobile.org/shared/elements/gaia-theme/gaia-theme.css" rel="stylesheet" type="text/css">
|
||||
<link href="../shared/elements/gaia-icons/gaia-icons.css" rel="stylesheet" type="text/css">
|
||||
|
||||
<meta name="defaultLanguage" content="en-US">
|
||||
<meta name="availableLanguages" content="ar:201601260729, bg:201601260729, bn-BD:201601260729, ca:201601260729, cs:201601260729, da:201601260729, de:201601260729, el:201601260729, en-US:201601260729, es:201601260729, eu:201601260729, fr:201601260729, gl:201601260729, hr:201601260729, hu:201601260729, it:201601260729, ja:201601260729, km:201601260729, ko:201601260729, lt:201601260729, mk:201601260729, ms:201601260729, ne-NP:201601260729, nl:201601260729, pa:201601260729, pl:201601260729, pt-BR:201601260729, ro:201601260729, ru:201601260729, sk:201601260729, sq:201601260729, sr-Cyrl:201601260729, sr-Latn:201601260729, sv-SE:201601260729, tr:201601260729, zh-CN:201601260729, zh-TW:201601260729">
|
||||
<link rel="localization" href="/locales-obj/fxa.fxa_module.{locale}.json">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <script defer="" src="../js/service.js"></script> -->
|
||||
<!-- <script defer="" src="../js/browser_frame.js"></script> -->
|
||||
<!-- <script defer="" src="../js/entry_sheet.js"></script> -->
|
||||
<!-- <script defer="" src="../shared/js/lazy_loader.js"></script> -->
|
||||
<!-- <script defer="" src="../shared/js/l10n.js"></script> -->
|
||||
<!-- <script defer="" src="../shared/js/settings_helper.js"></script> -->
|
||||
<!-- <script defer="" src="../shared/js/utilities.js"></script> -->
|
||||
|
||||
<!-- Gaia Components -->
|
||||
<!-- <script defer="" src="../shared/elements/config.js"></script> -->
|
||||
<!-- <script defer="" src="../shared/elements/gaia-header/dist/gaia-header.js"></script> -->
|
||||
|
||||
<!-- <script defer="" src="js/fxam_server_request.js"></script> -->
|
||||
<!-- <script defer="" src="js/fxam_overlay.js"></script> -->
|
||||
<!-- <script defer="" src="js/fxam_error_overlay.js"></script> -->
|
||||
<!-- <script defer="" src="js/fxam_navigation.js"></script> -->
|
||||
<!-- <script defer="" src="js/fxam_ui.js"></script> -->
|
||||
<!-- <script defer="" src="js/fxam_manager.js"></script> -->
|
||||
<!-- <script defer="" src="js/fxam_states.js"></script> -->
|
||||
<!-- <script defer="" src="js/fxam_module.js"></script> --><script src="./gaia_build_defer_fxa_module.js" defer="" type="text/javascript"></script>
|
||||
|
||||
<meta content="2.5" name="appVersion"></head>
|
||||
<body class="theme-settings">
|
||||
<section role="region">
|
||||
<gaia-header id="fxa-module-header" action="close">
|
||||
<h1 data-l10n-id="firefox-accounts-title">Firefox Accounts</h1>
|
||||
</gaia-header>
|
||||
<div class="bb-steps">
|
||||
<progress id="fxa-progress" value="" max="100"></progress>
|
||||
</div>
|
||||
<article id="step-container">
|
||||
<section id="fxa-email" class="screen"><!--
|
||||
<section class="vertical">
|
||||
<div id="fxa-logo" class="fxa-logo"></div>
|
||||
<p class="fxa-intro" data-l10n-id="fxa-use-email-to-sign-in">
|
||||
</p>
|
||||
<input id="fxa-email-input" data-l10n-id="fxa-enter-email-input" placeholder="Enter your email" required="" x-inputmode="verbatim" type="email">
|
||||
|
||||
<p id="fxa-notice" class="fine-print" data-l10n-id="fxa-notice2">
|
||||
<a id="fxa-terms" href="https://accounts.firefox.com/legal/terms"></a>
|
||||
<a id="fxa-privacy" href="https://accounts.firefox.com/legal/privacy"></a>
|
||||
</p>
|
||||
</section>
|
||||
<script src="js/screens/fxam_enter_email.js"></script>
|
||||
--></section>
|
||||
<section id="fxa-set-password" class="screen fxa-password"><!--
|
||||
<section class="vertical">
|
||||
<h3 data-l10n-id="fxa-create-password-title"></h3>
|
||||
<p id="fxa-hello-user"><a id="fxa-user-set-email"></a></p>
|
||||
<input id="fxa-pw-set-input" placeholder="Password" required="" pattern=".{8,}" data-l10n-id="fxa-password" x-inputmode="verbatim" type="password">
|
||||
<p class="fine-print" data-l10n-id="fxa-password-length-requirement">
|
||||
</p>
|
||||
<div id="show-pw-wrapper">
|
||||
<label class="pack-checkbox" for="fxa-show-pw-set">
|
||||
<input id="fxa-show-pw-set" type="checkbox">
|
||||
<span></span>
|
||||
</label>
|
||||
<p data-l10n-id="fxa-show-password"></p>
|
||||
</div>
|
||||
<script src="js/screens/fxam_set_password.js"></script>
|
||||
</section>
|
||||
--></section>
|
||||
<section id="fxa-enter-password" class="screen fxa-password"><!--
|
||||
<section class="vertical">
|
||||
<h3 data-l10n-id="fxa-enter-password-title">Enter Your Password</h3>
|
||||
<p id="fxa-hello-known-user">Hello, <a id="fxa-known-user-email">holaENTER@email.com</a></p>
|
||||
<input id="fxa-pw-input" placeholder="Password" required="" pattern=".{8,}" data-l10n-id="fxa-password" x-inputmode="verbatim" type="password">
|
||||
<p class="fine-print"><a id="fxa-forgot-password" data-l10n-id="fxa-forgot-your-password">Forgot your password?</a></p>
|
||||
<div id="show-pw-wrapper">
|
||||
<label class="pack-checkbox" for="fxa-show-pw">
|
||||
<input id="fxa-show-pw" type="checkbox">
|
||||
<span></span>
|
||||
</label>
|
||||
<p data-l10n-id="fxa-show-password">Show password</p>
|
||||
</div>
|
||||
<script src="js/screens/fxam_enter_password.js"></script>
|
||||
</section>
|
||||
--></section>
|
||||
<section id="fxa-signup-success" class="screen"><!--
|
||||
<section class="vertical">
|
||||
<h3 data-l10n-id="fxa-confirm-account">
|
||||
Confirm Your Account
|
||||
</h3>
|
||||
<p id="fxa-will-send-email" class="fxa-envelope">
|
||||
We will send an email to: <strong id="fxa-summary-email">email</strong>
|
||||
</p>
|
||||
<p data-l10n-id="fxa-signup-click-verification-link-in-email">
|
||||
Next time you check your email, click the verification link to confirm your Firefox Account.
|
||||
</p>
|
||||
<p data-l10n-id="fxa-access-manage-account-settings">
|
||||
In the future, you can access and manage your account from Settings.
|
||||
</p>
|
||||
<script src="js/screens/fxam_signup_success.js"></script>
|
||||
</section>
|
||||
--></section>
|
||||
<section id="fxa-signin-success" class="screen"><!--
|
||||
<section class="vertical">
|
||||
<h3 data-l10n-id="fxa-success">
|
||||
Success!
|
||||
</h3>
|
||||
<p data-l10n-id="fxa-ready-to-go">
|
||||
Your Firefox Account is ready to go!
|
||||
</p>
|
||||
<p data-l10n-id="fxa-use-features">
|
||||
Now you can use features like Find My Device and apps like the Firefox Marketplace.
|
||||
</p>
|
||||
<p data-l10n-id="fxa-access-manage-account-settings">
|
||||
In the future, you can access and manage your account from Settings.
|
||||
</p>
|
||||
<script src="js/screens/fxam_signin_success.js"></script>
|
||||
</section>
|
||||
--></section>
|
||||
<section id="fxa-tos" class="screen" data-navigation="back"><!--
|
||||
<section role="region">
|
||||
<h3 data-l10n-id="fxa-tos-header">Terms of Service</h3>
|
||||
<p data-l10n-id="fxa-tos1">
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eius mod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequ at. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
</p>
|
||||
<p data-l10n-id="fxa-tos2">
|
||||
Excepteur sint occaecat qui of fi cia deserunt mollit anim id est lab orum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. D uis aute irure dolor in.
|
||||
</p>
|
||||
</section>
|
||||
--></section>
|
||||
<section id="fxa-pp" class="screen" data-navigation="back"><!--
|
||||
<section role="region">
|
||||
<h3 data-l10n-id="fxa-pp-header">Privacy Policy</h3>
|
||||
<p data-l10n-id="fxa-pp1">
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eius mod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequ at. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
</p>
|
||||
<p data-l10n-id="fxa-pp2">
|
||||
Excepteur sint occaecat qui of fi cia deserunt mollit anim id est lab orum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. D uis aute irure dolor in.
|
||||
</p>
|
||||
</section>
|
||||
--></section>
|
||||
<section id="fxa-refresh-auth" class="screen fxa-password"><!--
|
||||
<section class="vertical">
|
||||
<p id="fxa-password-refresh" data-l10n-id="fxa-password-refresh">Please enter your Firefox Account password to continue.</p>
|
||||
<input id="fxa-pw-input-refresh" placeholder="Password" required="" pattern=".{8,}" data-l10n-id="fxa-password" type="password">
|
||||
<p class="fine-print"><a id="fxa-forgot-password-refresh" data-l10n-id="fxa-forgot-your-password">Forgot your password?</a></p>
|
||||
<div id="show-pw-wrapper">
|
||||
<label class="pack-checkbox" for="fxa-show-pw-refresh">
|
||||
<input id="fxa-show-pw-refresh" type="checkbox">
|
||||
<span></span>
|
||||
</label>
|
||||
<p data-l10n-id="fxa-show-password">Show password</p>
|
||||
</div>
|
||||
<script src="js/screens/fxam_refresh_auth.js"></script>
|
||||
</section>
|
||||
--></section>
|
||||
<section id="fxa-coppa" class="screen fxa-coppa"><!--
|
||||
<section class="vertical">
|
||||
<h3 data-l10n-id="fxa-age-verification">
|
||||
Age verification
|
||||
</h3>
|
||||
<ul class="fxa-verification-wrapper">
|
||||
<li>
|
||||
<span class="button icon icon-dialog">
|
||||
<select id="fxa-age-select">
|
||||
<option value="0" data-l10n-id="fxa-year-of-birth">Year of birth</option>
|
||||
</select>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<script src="js/screens/fxam_coppa.js"></script>
|
||||
--></section>
|
||||
</article>
|
||||
<nav role="navigation" class="horizontal navigation navigation-single-button" id="fxa-module-navigation">
|
||||
<button id="fxa-module-back" class="start" data-l10n-id="fxa-back">Back</button>
|
||||
<button id="fxa-module-next" class="recommend end" data-l10n-id="fxa-next">Next</button>
|
||||
<button id="fxa-module-done" class="recommend end" data-l10n-id="fxa-done">Done</button>
|
||||
</nav>
|
||||
</section>
|
||||
<!-- Progress overlay -->
|
||||
<section id="fxa-overlay" role="dialog">
|
||||
<progress></progress>
|
||||
<p id="fxa-overlay-msg" data-l10n-id="fxa-connecting">Connecting</p>
|
||||
</section>
|
||||
<!-- Error message overlay -->
|
||||
<form role="dialog" data-type="confirm" id="fxa-error-overlay" class="fade-in">
|
||||
<section>
|
||||
<h1 id="fxa-error-title"></h1>
|
||||
<p>
|
||||
<small id="fxa-error-msg"></small>
|
||||
<small id="fxa-error-msg-coppa">
|
||||
<a id="coppa-link" href="#"></a>
|
||||
</small>
|
||||
</p>
|
||||
</section>
|
||||
<menu>
|
||||
<button class="full" data-l10n-id="fxa-ok" id="fxa-error-ok">OK</button>
|
||||
</menu>
|
||||
</form>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,694 @@
|
|||
;'use strict';(function(exports){var DEBUG=false;exports.Service={_providers:new Map(),_services:new Map(),_requestsByService:new Map(),_requestsByProvider:new Map(),request:function(service){var requestItems=service.split(':');var args=Array.prototype.slice.call(arguments,1);var self=this;this.debug(requestItems);if(requestItems.length>1){var serverName=requestItems[0];var serviceName=requestItems[1];if(this._providers.get(serverName)){this.debug('service: '+serviceName+' is online, perform the request with '+args.concat());return Promise.resolve(this._providers.get(serverName)[serviceName].apply(self._providers.get(serverName),args));}else{return new Promise(function(resolve,reject){self.debug('service: '+service+' is offline, queue the task.');if(!self._requestsByProvider.has(serverName)){self._requestsByProvider.set(serverName,[]);}
|
||||
self._requestsByProvider.get(serverName).push({service:serviceName,resolve:resolve,args:args});});}
|
||||
return;}
|
||||
if(this._services.has(service)){var server=this._services.get(service);this.debug('service ['+service+'] provider ['+server.name+'] is online, perform the task.');return Promise.resolve(server[service].apply(server,args));}else{this.debug('service: '+service+' is offline, queue the task.');var promise=new Promise(function(resolve,reject){self.debug('storing the requests...');if(!self._requestsByService.has(service)){self._requestsByService.set(service,[]);}
|
||||
self._requestsByService.get(service).push({service:service,resolve:resolve,args:args});});return promise;}},register:function(service,server){var self=this;if(!this._providers.has(server.name)){this._providers.set(server.name,server);}
|
||||
this.debug((server.name||'(Anonymous)')+' is registering service: ['+service+']');this.debug('checking awaiting requests by server..');if(this._requestsByProvider.has(server.name)){this._requestsByProvider.get(server.name).forEach(function(request){self.debug('resolving..',server,server.name,request.service,request.args);var returnValue=(typeof(server[request.service])==='function')?server[request.service].apply(server,request.args):server[request.service];request.resolve(returnValue);});this._requestsByProvider.delete(server.name);}
|
||||
if(!this._services.has(service)){this._services.set(service,server);}else{this.debug('the service ['+service+'] has already been '+'registered by other server:',this._services.get(service).name);return;}
|
||||
this.debug('checking awaiting requests by service..');if(this._requestsByService.has(service)){this._requestsByService.get(service).forEach(function(request){self.debug('resolving..',server,request.service);var returnValue=server[request.service].apply(server,request.args);request.resolve(returnValue);});this._requestsByService.delete(service);}},unregister:function(service,server){this._providers.delete(server.name);var se=this._services.get(service);if(se&&server===se){this._services.delete(service);}},_states:new Map(),_statesByState:new Map(),registerState:function(state,provider){this._states.set(provider.name,provider);if(!provider.name){console.warn('Service.registerState: Provider should have a name.',provider);}
|
||||
this._statesByState.set(state,provider);},unregisterState:function(state,provider){this._states.delete(provider.name);var machine=this._statesByState.get(state);if(machine===provider){this._statesByState.delete(state);}},query:function(stateString){this.debug(stateString);var args=stateString.split('.');var state,provider;if(args.length>1){provider=this._states.get(args[0]);state=args[1];}else{state=args[0];provider=this._statesByState.get(state);}
|
||||
if(!provider){this.debug('Provider not ready, return undefined state.');return undefined;}
|
||||
if(typeof(provider[state])==='function'){var functionArgs=Array.prototype.slice.call(arguments,1);return provider[state].apply(provider,functionArgs);}else{return provider[state];}},_start:new Date().getTime()/1000,currentTime:function(){return(new Date().getTime()/1000-this._start).toFixed(3);},debug:function sys_debug(){if(DEBUG){console.log('[System]'+'['+window.Service.currentTime()+']'+
|
||||
Array.slice(arguments).concat());}},get manifestURL(){return window.location.href.replace('index.html','manifest.webapp');}};})(window);;'use strict';(function(exports){var nextId=0;var BrowserFrame=function BrowserFrame(){this.element=null;this._id=nextId++;createFrame.apply(this,arguments);return this;};BrowserFrame.prototype.CLASS_NAME='browser';function createFrame(config,frame){var browser=frame||document.createElement('iframe');browser.setAttribute('mozbrowser','true');browser.name=config.window_name||'main';if(config.oop){browser.setAttribute('remote','true');}
|
||||
if(config.isPrivate&&!config.isMockPrivate){browser.setAttribute('mozprivatebrowsing','true');}
|
||||
if(config.manifestURL){browser.setAttribute('mozapp',config.manifestURL);if(config.isSystemMessage){browser.setAttribute('expecting-system-message','expecting-system-message');}}
|
||||
if(config.parentApp){browser.setAttribute('parentapp',config.parentApp);}
|
||||
if(config.isInputMethod){browser.setAttribute('mozpasspointerevents','true');browser.setAttribute('ignoreuserfocus','true');}else{browser.setAttribute('mozallowfullscreen','true');}
|
||||
setMozAppType(browser,config);if(config.url){browser.src=config.url;browser.dataset.url=config.url;}
|
||||
browser.id=this.CLASS_NAME+this._id;browser.classList.add(this.CLASS_NAME);this.config=config;this.element=browser;}
|
||||
function setMozAppType(iframe,config){if(config.url.startsWith(window.location.protocol+'//callscreen.gaiamobile.org')||config.url.startsWith(window.location.protocol+'//clock.gaiamobile.org')){iframe.setAttribute('mozapptype','critical');}else if(config.isHomescreen){iframe.setAttribute('mozapptype','homescreen');}else if(config.isSearch){iframe.setAttribute('mozapptype','search');}else if(config.isInputMethod){iframe.setAttribute('mozapptype','inputmethod');}}
|
||||
exports.BrowserFrame=BrowserFrame;}(window));;'use strict';var EntrySheet=(function invocation(){function EntrySheet(){render.apply(this,arguments);}
|
||||
EntrySheet.className='entrySheet';EntrySheet.prototype.setTitle=function(title){this.titleElement.textContent=title;};EntrySheet.prototype.open=function(){setTimeout(function(){this.element.classList.add('active');}.bind(this));};EntrySheet.prototype.close=function(){this.element.addEventListener('transitionend',function onTransitionend(){this.element.removeEventListener('transitionend',onTransitionend);this.element.classList.remove('disappearing');this.element.classList.remove('active');this.container.removeChild(this.element);}.bind(this));this.element.classList.add('disappearing');};function view(){return`<div class="${EntrySheet.className}">
|
||||
<section role="region" class="skin-organic header">
|
||||
<gaia-header action="close">
|
||||
<h1 class="title">
|
||||
<bdi class="${EntrySheet.className}-title"></bdi>
|
||||
</h1>
|
||||
</gaia-header>
|
||||
<div class="throbber"></div>
|
||||
</section>
|
||||
<div class="content">
|
||||
</div>
|
||||
</div>`;}
|
||||
function render(container,title,content){this.container=container;this.title=title;this.container.insertAdjacentHTML('beforeend',view.apply(this));this.header=this.container.querySelector('.'+EntrySheet.className+' gaia-header');this.titleElement=this.container.querySelector('.'+EntrySheet.className+'-title');this.throbberElement=this.container.querySelector('.'+EntrySheet.className+' .throbber');this.content=this.container.querySelector('.'+EntrySheet.className+' .content');this.element=this.container.querySelector('.'+EntrySheet.className);this.element.dataset.zIndexLevel='dialog-overlay';var self=this;if(typeof(BrowserFrame)!='undefined'&&content instanceof BrowserFrame){content.element.addEventListener('mozbrowserloadstart',function onLoadStart(){self.throbberElement.dataset.loading=true;});content.element.addEventListener('mozbrowserloadend',function onLoadEnd(){delete self.throbberElement.dataset.loading;});this.content.appendChild(content.element);}else if(content&&content.nodeType==1){this.content.appendChild(content);}
|
||||
this.setTitle(this.title);this.header.addEventListener('action',function(){self.close();});}
|
||||
return EntrySheet;}());;;'use strict';var LazyLoader=(function(){function LazyLoader(){this._loaded={};this._isLoading={};}
|
||||
LazyLoader.prototype={_js:function(file,callback){var script=document.createElement('script');script.src=file;script.async=false;script.addEventListener('load',callback);document.head.appendChild(script);this._isLoading[file]=script;},_css:function(file,callback){var style=document.createElement('link');style.type='text/css';style.rel='stylesheet';style.href=file;document.head.appendChild(style);callback();},_html:function(domNode,callback){if(domNode.getAttribute('is')){this.load(['/shared/js/html_imports.js'],function(){HtmlImports.populate(callback);}.bind(this));return;}
|
||||
for(var i=0;i<domNode.childNodes.length;i++){if(domNode.childNodes[i].nodeType==document.COMMENT_NODE){domNode.innerHTML=domNode.childNodes[i].nodeValue;break;}}
|
||||
window.dispatchEvent(new CustomEvent('lazyload',{detail:domNode}));callback();},getJSON:function(file,mozSystem){return new Promise(function(resolve,reject){var xhr;if(mozSystem){xhr=new XMLHttpRequest({mozSystem:true});}else{xhr=new XMLHttpRequest();}
|
||||
xhr.open('GET',file,true);xhr.responseType='json';xhr.onerror=function(error){reject(error);};xhr.onload=function(){if(xhr.response!==null){resolve(xhr.response);}else{reject(new Error('No valid JSON object was found ('+
|
||||
xhr.status+' '+xhr.statusText+')'));}};xhr.send();});},load:function(files,callback){var deferred={};deferred.promise=new Promise(resolve=>{deferred.resolve=resolve;});if(!Array.isArray(files)){files=[files];}
|
||||
var loadsRemaining=files.length,self=this;function perFileCallback(file){if(self._isLoading[file]){delete self._isLoading[file];}
|
||||
self._loaded[file]=true;if(--loadsRemaining===0){deferred.resolve();if(callback){callback();}}}
|
||||
for(var i=0;i<files.length;i++){var file=files[i];if(this._loaded[file.id||file]){perFileCallback(file);}else if(this._isLoading[file]){this._isLoading[file].addEventListener('load',perFileCallback.bind(null,file));}else{var method,idx;if(typeof file==='string'){method=file.match(/\.([^.]+)$/)[1];idx=file;}else{method='html';idx=file.id;}
|
||||
this['_'+method](file,perFileCallback.bind(null,idx));}}
|
||||
return deferred.promise;}};return new LazyLoader();}());;;;;;(function(window,undefined){'use strict';function L10nError(message,id,loc){this.name='L10nError';this.message=message;this.id=id;this.loc=loc;}
|
||||
L10nError.prototype=Object.create(Error.prototype);L10nError.prototype.constructor=L10nError;var io={_load:function(type,url,callback,sync){var xhr=new XMLHttpRequest();var needParse;if(xhr.overrideMimeType){xhr.overrideMimeType(type);}
|
||||
xhr.open('GET',url,!sync);if(type==='application/json'){if(sync){needParse=true;}else{xhr.responseType='json';}}
|
||||
xhr.addEventListener('load',function io_onload(e){if(e.target.status===200||e.target.status===0){var res=e.target.response||e.target.responseText;callback(null,needParse?JSON.parse(res):res);}else{callback(new L10nError('Not found: '+url));}});xhr.addEventListener('error',callback);xhr.addEventListener('timeout',callback);try{xhr.send(null);}catch(e){if(e.name==='NS_ERROR_FILE_NOT_FOUND'){callback(new L10nError('Not found: '+url));}else{throw e;}}},load:function(url,callback,sync){return io._load('text/plain',url,callback,sync);},loadJSON:function(url,callback,sync){return io._load('application/json',url,callback,sync);}};function EventEmitter(){}
|
||||
EventEmitter.prototype.emit=function ee_emit(){if(!this._listeners){return;}
|
||||
var args=Array.prototype.slice.call(arguments);var type=args.shift();if(!this._listeners[type]){return;}
|
||||
var typeListeners=this._listeners[type].slice();for(var i=0;i<typeListeners.length;i++){typeListeners[i].apply(this,args);}};EventEmitter.prototype.addEventListener=function ee_add(type,listener){if(!this._listeners){this._listeners={};}
|
||||
if(!(type in this._listeners)){this._listeners[type]=[];}
|
||||
this._listeners[type].push(listener);};EventEmitter.prototype.removeEventListener=function ee_rm(type,listener){if(!this._listeners){return;}
|
||||
var typeListeners=this._listeners[type];var pos=typeListeners.indexOf(listener);if(pos===-1){return;}
|
||||
typeListeners.splice(pos,1);};function getPluralRule(lang){var locales2rules={'af':3,'ak':4,'am':4,'ar':1,'asa':3,'az':0,'be':11,'bem':3,'bez':3,'bg':3,'bh':4,'bm':0,'bn':3,'bo':0,'br':20,'brx':3,'bs':11,'ca':3,'cgg':3,'chr':3,'cs':12,'cy':17,'da':3,'de':3,'dv':3,'dz':0,'ee':3,'el':3,'en':3,'eo':3,'es':3,'et':3,'eu':3,'fa':0,'ff':5,'fi':3,'fil':4,'fo':3,'fr':5,'fur':3,'fy':3,'ga':8,'gd':24,'gl':3,'gsw':3,'gu':3,'guw':4,'gv':23,'ha':3,'haw':3,'he':2,'hi':4,'hr':11,'hu':0,'id':0,'ig':0,'ii':0,'is':3,'it':3,'iu':7,'ja':0,'jmc':3,'jv':0,'ka':0,'kab':5,'kaj':3,'kcg':3,'kde':0,'kea':0,'kk':3,'kl':3,'km':0,'kn':0,'ko':0,'ksb':3,'ksh':21,'ku':3,'kw':7,'lag':18,'lb':3,'lg':3,'ln':4,'lo':0,'lt':10,'lv':6,'mas':3,'mg':4,'mk':16,'ml':3,'mn':3,'mo':9,'mr':3,'ms':0,'mt':15,'my':0,'nah':3,'naq':7,'nb':3,'nd':3,'ne':3,'nl':3,'nn':3,'no':3,'nr':3,'nso':4,'ny':3,'nyn':3,'om':3,'or':3,'pa':3,'pap':3,'pl':13,'ps':3,'pt':3,'rm':3,'ro':9,'rof':3,'ru':11,'rwk':3,'sah':0,'saq':3,'se':7,'seh':3,'ses':0,'sg':0,'sh':11,'shi':19,'sk':12,'sl':14,'sma':7,'smi':7,'smj':7,'smn':7,'sms':7,'sn':3,'so':3,'sq':3,'sr':11,'ss':3,'ssy':3,'st':3,'sv':3,'sw':3,'syr':3,'ta':3,'te':3,'teo':3,'th':0,'ti':4,'tig':3,'tk':3,'tl':4,'tn':3,'to':0,'tr':0,'ts':3,'tzm':22,'uk':11,'ur':3,'ve':3,'vi':0,'vun':3,'wa':4,'wae':3,'wo':0,'xh':3,'xog':3,'yo':0,'zh':0,'zu':3};function isIn(n,list){return list.indexOf(n)!==-1;}
|
||||
function isBetween(n,start,end){return typeof n===typeof start&&start<=n&&n<=end;}
|
||||
var pluralRules={'0':function(){return'other';},'1':function(n){if((isBetween((n%100),3,10))){return'few';}
|
||||
if(n===0){return'zero';}
|
||||
if((isBetween((n%100),11,99))){return'many';}
|
||||
if(n===2){return'two';}
|
||||
if(n===1){return'one';}
|
||||
return'other';},'2':function(n){if(n!==0&&(n%10)===0){return'many';}
|
||||
if(n===2){return'two';}
|
||||
if(n===1){return'one';}
|
||||
return'other';},'3':function(n){if(n===1){return'one';}
|
||||
return'other';},'4':function(n){if((isBetween(n,0,1))){return'one';}
|
||||
return'other';},'5':function(n){if((isBetween(n,0,2))&&n!==2){return'one';}
|
||||
return'other';},'6':function(n){if(n===0){return'zero';}
|
||||
if((n%10)===1&&(n%100)!==11){return'one';}
|
||||
return'other';},'7':function(n){if(n===2){return'two';}
|
||||
if(n===1){return'one';}
|
||||
return'other';},'8':function(n){if((isBetween(n,3,6))){return'few';}
|
||||
if((isBetween(n,7,10))){return'many';}
|
||||
if(n===2){return'two';}
|
||||
if(n===1){return'one';}
|
||||
return'other';},'9':function(n){if(n===0||n!==1&&(isBetween((n%100),1,19))){return'few';}
|
||||
if(n===1){return'one';}
|
||||
return'other';},'10':function(n){if((isBetween((n%10),2,9))&&!(isBetween((n%100),11,19))){return'few';}
|
||||
if((n%10)===1&&!(isBetween((n%100),11,19))){return'one';}
|
||||
return'other';},'11':function(n){if((isBetween((n%10),2,4))&&!(isBetween((n%100),12,14))){return'few';}
|
||||
if((n%10)===0||(isBetween((n%10),5,9))||(isBetween((n%100),11,14))){return'many';}
|
||||
if((n%10)===1&&(n%100)!==11){return'one';}
|
||||
return'other';},'12':function(n){if((isBetween(n,2,4))){return'few';}
|
||||
if(n===1){return'one';}
|
||||
return'other';},'13':function(n){if((isBetween((n%10),2,4))&&!(isBetween((n%100),12,14))){return'few';}
|
||||
if(n!==1&&(isBetween((n%10),0,1))||(isBetween((n%10),5,9))||(isBetween((n%100),12,14))){return'many';}
|
||||
if(n===1){return'one';}
|
||||
return'other';},'14':function(n){if((isBetween((n%100),3,4))){return'few';}
|
||||
if((n%100)===2){return'two';}
|
||||
if((n%100)===1){return'one';}
|
||||
return'other';},'15':function(n){if(n===0||(isBetween((n%100),2,10))){return'few';}
|
||||
if((isBetween((n%100),11,19))){return'many';}
|
||||
if(n===1){return'one';}
|
||||
return'other';},'16':function(n){if((n%10)===1&&n!==11){return'one';}
|
||||
return'other';},'17':function(n){if(n===3){return'few';}
|
||||
if(n===0){return'zero';}
|
||||
if(n===6){return'many';}
|
||||
if(n===2){return'two';}
|
||||
if(n===1){return'one';}
|
||||
return'other';},'18':function(n){if(n===0){return'zero';}
|
||||
if((isBetween(n,0,2))&&n!==0&&n!==2){return'one';}
|
||||
return'other';},'19':function(n){if((isBetween(n,2,10))){return'few';}
|
||||
if((isBetween(n,0,1))){return'one';}
|
||||
return'other';},'20':function(n){if((isBetween((n%10),3,4)||((n%10)===9))&&!(isBetween((n%100),10,19)||isBetween((n%100),70,79)||isBetween((n%100),90,99))){return'few';}
|
||||
if((n%1000000)===0&&n!==0){return'many';}
|
||||
if((n%10)===2&&!isIn((n%100),[12,72,92])){return'two';}
|
||||
if((n%10)===1&&!isIn((n%100),[11,71,91])){return'one';}
|
||||
return'other';},'21':function(n){if(n===0){return'zero';}
|
||||
if(n===1){return'one';}
|
||||
return'other';},'22':function(n){if((isBetween(n,0,1))||(isBetween(n,11,99))){return'one';}
|
||||
return'other';},'23':function(n){if((isBetween((n%10),1,2))||(n%20)===0){return'one';}
|
||||
return'other';},'24':function(n){if((isBetween(n,3,10)||isBetween(n,13,19))){return'few';}
|
||||
if(isIn(n,[2,12])){return'two';}
|
||||
if(isIn(n,[1,11])){return'one';}
|
||||
return'other';}};var index=locales2rules[lang.replace(/-.*$/,'')];if(!(index in pluralRules)){return function(){return'other';};}
|
||||
return pluralRules[index];}
|
||||
var MAX_PLACEABLES=100;var PropertiesParser={patterns:null,entryIds:null,init:function(){this.patterns={comment:/^\s*#|^\s*$/,entity:/^([^=\s]+)\s*=\s*(.*)$/,multiline:/[^\\]\\$/,index:/\{\[\s*(\w+)(?:\(([^\)]*)\))?\s*\]\}/i,unicode:/\\u([0-9a-fA-F]{1,4})/g,entries:/[^\r\n]+/g,controlChars:/\\([\\\n\r\t\b\f\{\}\"\'])/g,placeables:/\{\{\s*([^\s]*?)\s*\}\}/,};},parse:function(ctx,source){if(!this.patterns){this.init();}
|
||||
var ast=[];this.entryIds=Object.create(null);var entries=source.match(this.patterns.entries);if(!entries){return ast;}
|
||||
for(var i=0;i<entries.length;i++){var line=entries[i];if(this.patterns.comment.test(line)){continue;}
|
||||
while(this.patterns.multiline.test(line)&&i<entries.length){line=line.slice(0,-1)+entries[++i].trim();}
|
||||
var entityMatch=line.match(this.patterns.entity);if(entityMatch){try{this.parseEntity(entityMatch[1],entityMatch[2],ast);}catch(e){if(ctx){ctx._emitter.emit('parseerror',e);}else{throw e;}}}}
|
||||
return ast;},parseEntity:function(id,value,ast){var name,key;var pos=id.indexOf('[');if(pos!==-1){name=id.substr(0,pos);key=id.substring(pos+1,id.length-1);}else{name=id;key=null;}
|
||||
var nameElements=name.split('.');if(nameElements.length>2){throw new L10nError('Error in ID: "'+name+'".'+' Nested attributes are not supported.');}
|
||||
var attr;if(nameElements.length>1){name=nameElements[0];attr=nameElements[1];if(attr[0]==='$'){throw new L10nError('Attribute can\'t start with "$"',id);}}else{attr=null;}
|
||||
this.setEntityValue(name,attr,key,this.unescapeString(value),ast);},setEntityValue:function(id,attr,key,rawValue,ast){var pos,v;var value=rawValue.indexOf('{{')>-1?this.parseString(rawValue):rawValue;if(attr){pos=this.entryIds[id];if(pos===undefined){v={$i:id};if(key){v[attr]={};v[attr][key]=value;}else{v[attr]=value;}
|
||||
ast.push(v);this.entryIds[id]=ast.length-1;return;}
|
||||
if(key){if(typeof(ast[pos][attr])==='string'){ast[pos][attr]={$x:this.parseIndex(ast[pos][attr]),$v:{}};}
|
||||
ast[pos][attr].$v[key]=value;return;}
|
||||
ast[pos][attr]=value;return;}
|
||||
if(key){pos=this.entryIds[id];if(pos===undefined){v={};v[key]=value;ast.push({$i:id,$v:v});this.entryIds[id]=ast.length-1;return;}
|
||||
if(typeof(ast[pos].$v)==='string'){ast[pos].$x=this.parseIndex(ast[pos].$v);ast[pos].$v={};}
|
||||
ast[pos].$v[key]=value;return;}
|
||||
ast.push({$i:id,$v:value});this.entryIds[id]=ast.length-1;},parseString:function(str){var chunks=str.split(this.patterns.placeables);var complexStr=[];var len=chunks.length;var placeablesCount=(len-1)/2;if(placeablesCount>=MAX_PLACEABLES){throw new L10nError('Too many placeables ('+placeablesCount+', max allowed is '+MAX_PLACEABLES+')');}
|
||||
for(var i=0;i<chunks.length;i++){if(chunks[i].length===0){continue;}
|
||||
if(i%2===1){complexStr.push({t:'idOrVar',v:chunks[i]});}else{complexStr.push(chunks[i]);}}
|
||||
return complexStr;},unescapeString:function(str){if(str.lastIndexOf('\\')!==-1){str=str.replace(this.patterns.controlChars,'$1');}
|
||||
return str.replace(this.patterns.unicode,function(match,token){return unescape('%u'+'0000'.slice(token.length)+token);});},parseIndex:function(str){var match=str.match(this.patterns.index);if(!match){throw new L10nError('Malformed index');}
|
||||
if(match[2]){return[{t:'idOrVar',v:match[1]},match[2]];}else{return[{t:'idOrVar',v:match[1]}];}}};var KNOWN_MACROS=['plural'];var MAX_PLACEABLE_LENGTH=2500;var rePlaceables=/\{\{\s*(.+?)\s*\}\}/g;var nonLatin1=/[^\x01-\xFF]/;var FSI='\u2068';var PDI='\u2069';function createEntry(node,env){var keys=Object.keys(node);if(typeof node.$v==='string'&&keys.length===2){return node.$v;}
|
||||
var attrs;for(var i=0,key;key=keys[i];i++){if(key[0]==='$'){continue;}
|
||||
if(!attrs){attrs=Object.create(null);}
|
||||
attrs[key]=createAttribute(node[key],env,node.$i+'.'+key);}
|
||||
return{id:node.$i,value:node.$v!==undefined?node.$v:null,index:node.$x||null,attrs:attrs||null,env:env,dirty:false};}
|
||||
function createAttribute(node,env,id){if(typeof node==='string'){return node;}
|
||||
return{id:id,value:node.$v||(node!==undefined?node:null),index:node.$x||null,env:env,dirty:false};}
|
||||
function format(args,entity){if(typeof entity==='string'){return[{},entity];}
|
||||
if(entity.dirty){throw new L10nError('Cyclic reference detected: '+entity.id);}
|
||||
entity.dirty=true;var rv;try{rv=resolveValue({},args,entity.env,entity.value,entity.index);}finally{entity.dirty=false;}
|
||||
return rv;}
|
||||
function resolveIdentifier(args,env,id){if(KNOWN_MACROS.indexOf(id)>-1){return[{},env['__'+id]];}
|
||||
if(args&&args.hasOwnProperty(id)){if(typeof args[id]==='string'||(typeof args[id]==='number'&&!isNaN(args[id]))){return[{},args[id]];}else{throw new L10nError('Arg must be a string or a number: '+id);}}
|
||||
if(id in env&&id!=='__proto__'){return format(args,env[id]);}
|
||||
throw new L10nError('Unknown reference: '+id);}
|
||||
function subPlaceable(locals,args,env,id){var res;try{res=resolveIdentifier(args,env,id);}catch(err){return[{error:err},'{{ '+id+' }}'];}
|
||||
var value=res[1];if(typeof value==='number'){return res;}
|
||||
if(typeof value==='string'){if(value.length>=MAX_PLACEABLE_LENGTH){throw new L10nError('Too many characters in placeable ('+
|
||||
value.length+', max allowed is '+
|
||||
MAX_PLACEABLE_LENGTH+')');}
|
||||
if(locals.contextIsNonLatin1||value.match(nonLatin1)){res[1]=FSI+value+PDI;}
|
||||
return res;}
|
||||
return[{},'{{ '+id+' }}'];}
|
||||
function interpolate(locals,args,env,arr){return arr.reduce(function(prev,cur){if(typeof cur==='string'){return[prev[0],prev[1]+cur];}else if(cur.t==='idOrVar'){var placeable=subPlaceable(locals,args,env,cur.v);return[prev[0],prev[1]+placeable[1]];}},[locals,'']);}
|
||||
function resolveSelector(args,env,expr,index){var selectorName=index[0].v;var selector=resolveIdentifier(args,env,selectorName)[1];if(typeof selector!=='function'){return selector;}
|
||||
var argValue=index[1]?resolveIdentifier(args,env,index[1])[1]:undefined;if(selector===env.__plural){if(argValue===0&&'zero'in expr){return'zero';}
|
||||
if(argValue===1&&'one'in expr){return'one';}
|
||||
if(argValue===2&&'two'in expr){return'two';}}
|
||||
return selector(argValue);}
|
||||
function resolveValue(locals,args,env,expr,index){if(!expr){return[locals,expr];}
|
||||
if(typeof expr==='string'||typeof expr==='boolean'||typeof expr==='number'){return[locals,expr];}
|
||||
if(Array.isArray(expr)){locals.contextIsNonLatin1=expr.some(function($_){return typeof($_)==='string'&&$_.match(nonLatin1);});return interpolate(locals,args,env,expr);}
|
||||
if(index){var selector=resolveSelector(args,env,expr,index);if(expr.hasOwnProperty(selector)){return resolveValue(locals,args,env,expr[selector]);}}
|
||||
if('other'in expr){return resolveValue(locals,args,env,expr.other);}
|
||||
throw new L10nError('Unresolvable value');}
|
||||
var Resolver={createEntry:createEntry,format:format,rePlaceables:rePlaceables};function walkContent(node,fn){if(typeof node==='string'){return fn(node);}
|
||||
if(node.t==='idOrVar'){return node;}
|
||||
var rv=Array.isArray(node)?[]:{};var keys=Object.keys(node);for(var i=0,key;(key=keys[i]);i++){if(key==='$i'||key==='$x'){rv[key]=node[key];}else{rv[key]=walkContent(node[key],fn);}}
|
||||
return rv;}
|
||||
var reAlphas=/[a-zA-Z]/g;var reVowels=/[aeiouAEIOU]/g;var ACCENTED_MAP='\u0226\u0181\u0187\u1E12\u1E16\u0191\u0193\u0126\u012A'+'\u0134\u0136\u013F\u1E3E\u0220\u01FE\u01A4\u024A\u0158'+'\u015E\u0166\u016C\u1E7C\u1E86\u1E8A\u1E8E\u1E90'+'[\\]^_`'+'\u0227\u0180\u0188\u1E13\u1E17\u0192\u0260\u0127\u012B'+'\u0135\u0137\u0140\u1E3F\u019E\u01FF\u01A5\u024B\u0159'+'\u015F\u0167\u016D\u1E7D\u1E87\u1E8B\u1E8F\u1E91';var FLIPPED_MAP='\u2200\u0510\u2183p\u018E\u025F\u05E4HI\u017F'+'\u04FC\u02E5WNO\u0500\xD2\u1D1AS\u22A5\u2229\u0245'+'\uFF2DX\u028EZ'+'[\\]\u1D65_,'+'\u0250q\u0254p\u01DD\u025F\u0183\u0265\u0131\u027E'+'\u029E\u0285\u026Fuodb\u0279s\u0287n\u028C\u028Dx\u028Ez';function makeLonger(val){return val.replace(reVowels,function(match){return match+match.toLowerCase();});}
|
||||
function replaceChars(map,val){return val.replace(reAlphas,function(match){return map.charAt(match.charCodeAt(0)-65);});}
|
||||
var reWords=/[^\W0-9_]+/g;function makeRTL(val){return val.replace(reWords,function(match){return'\u202e'+match+'\u202c';});}
|
||||
var reExcluded=/(%[EO]?\w|\{\s*.+?\s*\}|&[#\w]+;|<\s*.+?\s*>)/;function mapContent(fn,val){if(!val){return val;}
|
||||
var parts=val.split(reExcluded);var modified=parts.map(function(part){if(reExcluded.test(part)){return part;}
|
||||
return fn(part);});return modified.join('');}
|
||||
function Pseudo(id,name,charMap,modFn){this.id=id;this.translate=mapContent.bind(null,function(val){return replaceChars(charMap,modFn(val));});this.name=this.translate(name);}
|
||||
var PSEUDO={'fr-x-psaccent':new Pseudo('fr-x-psaccent','Runtime Accented',ACCENTED_MAP,makeLonger),'ar-x-psbidi':new Pseudo('ar-x-psbidi','Runtime Bidi',FLIPPED_MAP,makeRTL)};function Locale(id,ctx){this.id=id;this.ctx=ctx;this.isReady=false;this.entries=Object.create(null);this.entries.__plural=getPluralRule(this.isPseudo()?this.ctx.defaultLocale:id);}
|
||||
Locale.prototype.isPseudo=function(){return this.ctx.qps.indexOf(this.id)!==-1;};var bindingsIO={extra:function(id,ver,path,type,callback,errback){if(type==='properties'){type='text';}
|
||||
navigator.mozApps.getLocalizationResource(id,ver,path,type).then(callback.bind(null,null),errback);},app:function(id,ver,path,type,callback,errback,sync){switch(type){case'properties':io.load(path,callback,sync);break;case'json':io.loadJSON(path,callback,sync);break;}},};Locale.prototype.build=function L_build(callback){var sync=!callback;var ctx=this.ctx;var self=this;var l10nLoads=ctx.resLinks.length;function onL10nLoaded(err){if(err){ctx._emitter.emit('fetcherror',err);}
|
||||
if(--l10nLoads<=0){self.isReady=true;if(callback){callback();}}}
|
||||
if(l10nLoads===0){onL10nLoaded();return;}
|
||||
function onJSONLoaded(err,json){if(!err&&json){self.addAST(json);}
|
||||
onL10nLoaded(err);}
|
||||
function onPropLoaded(err,source){if(!err&&source){var ast=PropertiesParser.parse(ctx,source);self.addAST(ast);}
|
||||
onL10nLoaded(err);}
|
||||
var idToFetch=this.isPseudo()?ctx.defaultLocale:this.id;var appVersion=null;var source='app';if(typeof(navigator)!=='undefined'){source=navigator.mozL10n._config.localeSources[this.id]||'app';appVersion=navigator.mozL10n._config.appVersion;}
|
||||
for(var i=0;i<ctx.resLinks.length;i++){var resLink=decodeURI(ctx.resLinks[i]);var path=resLink.replace('{locale}',idToFetch);var type=path.substr(path.lastIndexOf('.')+1);var cb;switch(type){case'json':cb=onJSONLoaded;break;case'properties':cb=onPropLoaded;break;}
|
||||
bindingsIO[source](this.id,appVersion,path,type,cb,onL10nLoaded,sync);}};function createPseudoEntry(node,entries){return Resolver.createEntry(walkContent(node,PSEUDO[this.id].translate),entries);}
|
||||
Locale.prototype.addAST=function(ast){var createEntry=this.isPseudo()?createPseudoEntry.bind(this):Resolver.createEntry;for(var i=0;i<ast.length;i++){this.entries[ast[i].$i]=createEntry(ast[i],this.entries);}};function Context(id){this.id=id;this.isReady=false;this.isLoading=false;this.defaultLocale='en-US';this.availableLocales=[];this.supportedLocales=[];this.qps=[];this.resLinks=[];this.locales={};this._emitter=new EventEmitter();this._ready=new Promise(this.once.bind(this));}
|
||||
function reportMissing(id,err){this._emitter.emit('notfounderror',err);return id;}
|
||||
function getWithFallback(id){var cur=0;var loc;var locale;while(loc=this.supportedLocales[cur]){locale=this.getLocale(loc);if(!locale.isReady){locale.build(null);}
|
||||
var entry=locale.entries[id];if(entry===undefined){cur++;reportMissing.call(this,id,new L10nError('"'+id+'"'+' not found in '+loc+' in '+this.id,id,loc));continue;}
|
||||
return entry;}
|
||||
throw new L10nError('"'+id+'"'+' missing from all supported locales in '+this.id,id);}
|
||||
function formatTuple(args,entity){try{return Resolver.format(args,entity);}catch(err){this._emitter.emit('resolveerror',err);var locals={error:err};return[locals,entity.id];}}
|
||||
function formatValue(args,entity){if(typeof entity==='string'){return entity;}
|
||||
return formatTuple.call(this,args,entity)[1];}
|
||||
function formatEntity(args,entity){var entityTuple=formatTuple.call(this,args,entity);var value=entityTuple[1];var formatted={value:value,attrs:null,};if(entity.attrs){formatted.attrs=Object.create(null);}
|
||||
for(var key in entity.attrs){var attrTuple=formatTuple.call(this,args,entity.attrs[key]);formatted.attrs[key]=attrTuple[1];}
|
||||
return formatted;}
|
||||
function formatAsync(fn,id,args){return this._ready.then(getWithFallback.bind(this,id)).then(fn.bind(this,args),reportMissing.bind(this,id));}
|
||||
Context.prototype.formatValue=function(id,args){return formatAsync.call(this,formatValue,id,args);};Context.prototype.formatEntity=function(id,args){return formatAsync.call(this,formatEntity,id,args);};function legacyGet(fn,id,args){if(!this.isReady){throw new L10nError('Context not ready');}
|
||||
var entry;try{entry=getWithFallback.call(this,id);}catch(err){if(err.loc){throw err;}
|
||||
reportMissing.call(this,id,err);return'';}
|
||||
return fn.call(this,args,entry);}
|
||||
Context.prototype.get=function(id,args){return legacyGet.call(this,formatValue,id,args);};Context.prototype.getEntity=function(id,args){return legacyGet.call(this,formatEntity,id,args);};Context.prototype.getLocale=function getLocale(code){var locales=this.locales;if(locales[code]){return locales[code];}
|
||||
return locales[code]=new Locale(code,this);};function negotiate(available,requested,defaultLocale){var supportedLocale;for(var i=0;i<requested.length;i++){var locale=requested[i];if(available.indexOf(locale)!==-1){supportedLocale=locale;break;}}
|
||||
if(!supportedLocale||supportedLocale===defaultLocale){return[defaultLocale];}
|
||||
return[supportedLocale,defaultLocale];}
|
||||
function freeze(supported){var locale=this.getLocale(supported[0]);if(locale.isReady){setReady.call(this,supported);}else{locale.build(setReady.bind(this,supported));}}
|
||||
function setReady(supported){this.supportedLocales=supported;this.isReady=true;this._emitter.emit('ready');}
|
||||
Context.prototype.registerLocales=function(defLocale,available){if(defLocale){this.defaultLocale=defLocale;}
|
||||
this.availableLocales=[this.defaultLocale];this.qps=Object.keys(PSEUDO);if(available){for(var i=0,loc;loc=available[i];i++){if(this.availableLocales.indexOf(loc)===-1){this.availableLocales.push(loc);var pos=this.qps.indexOf(loc);if(pos!==-1){this.qps.splice(pos,1);}}}}};Context.prototype.requestLocales=function requestLocales(){if(this.isLoading&&!this.isReady){throw new L10nError('Context not ready');}
|
||||
this.isLoading=true;var requested=Array.prototype.slice.call(arguments);if(requested.length===0){throw new L10nError('No locales requested');}
|
||||
var supported=negotiate(this.availableLocales.concat(this.qps),requested,this.defaultLocale);if(this.supportedLocales[0]!==supported[0]){freeze.call(this,supported);}};Context.prototype.addEventListener=function(type,listener){this._emitter.addEventListener(type,listener);};Context.prototype.removeEventListener=function(type,listener){this._emitter.removeEventListener(type,listener);};Context.prototype.ready=function(callback){if(this.isReady){setTimeout(callback);}
|
||||
this.addEventListener('ready',callback);};Context.prototype.once=function(callback){if(this.isReady){setTimeout(callback);return;}
|
||||
var callAndRemove=(function(){this.removeEventListener('ready',callAndRemove);callback();}).bind(this);this.addEventListener('ready',callAndRemove);};var allowed={elements:['a','em','strong','small','s','cite','q','dfn','abbr','data','time','code','var','samp','kbd','sub','sup','i','b','u','mark','ruby','rt','rp','bdi','bdo','span','br','wbr'],attributes:{global:['title','aria-label','aria-valuetext','aria-moz-hint'],a:['download'],area:['download','alt'],input:['alt','placeholder'],menuitem:['label'],menu:['label'],optgroup:['label'],option:['label'],track:['label'],img:['alt'],textarea:['placeholder'],th:['abbr']}};var rtlList=['ar','he','fa','ps','ar-x-psbidi','ur'];var nodeObserver=null;var pendingElements=null;var moConfig={attributes:true,characterData:false,childList:true,subtree:true,attributeFilter:['data-l10n-id','data-l10n-args']};navigator.mozL10n={ctx:null,get:function get(id,ctxdata){return navigator.mozL10n.ctx.get(id,ctxdata);},formatValue:function(id,ctxdata){return navigator.mozL10n.ctx.formatValue(id,ctxdata);},formatEntity:function(id,ctxdata){return navigator.mozL10n.ctx.formatEntity(id,ctxdata);},translateFragment:function(fragment){return translateFragment.call(navigator.mozL10n,fragment);},setAttributes:setL10nAttributes,getAttributes:getL10nAttributes,ready:function ready(callback){return navigator.mozL10n.ctx.ready(callback);},once:function once(callback){return navigator.mozL10n.ctx.once(callback);},get readyState(){return navigator.mozL10n.ctx.isReady?'complete':'loading';},language:{set code(lang){navigator.mozL10n.ctx.requestLocales(lang);},get code(){return navigator.mozL10n.ctx.supportedLocales[0];},get direction(){return getDirection(navigator.mozL10n.ctx.supportedLocales[0]);}},qps:PSEUDO,_config:{appVersion:null,localeSources:Object.create(null),isPretranslated:false,},_getInternalAPI:function(){return{Error:L10nError,Context:Context,Locale:Locale,Resolver:Resolver,getPluralRule:getPluralRule,rePlaceables:rePlaceables,translateDocument:translateDocument,onMetaInjected:onMetaInjected,PropertiesParser:PropertiesParser,walkContent:walkContent,buildLocaleList:buildLocaleList};}};function getDirection(lang){return(rtlList.indexOf(lang)>=0)?'rtl':'ltr';}
|
||||
var readyStates={loading:0,interactive:1,complete:2};function whenInteractive(callback){if(readyStates[document.readyState]>=readyStates.interactive){callback();return;}
|
||||
document.addEventListener('readystatechange',function l10n_onrsc(){if(readyStates[document.readyState]>=readyStates.interactive){document.removeEventListener('readystatechange',l10n_onrsc);callback();}});}
|
||||
function initObserver(){nodeObserver=new MutationObserver(onMutations.bind(navigator.mozL10n));nodeObserver.observe(document,moConfig);}
|
||||
function init(pretranslate){if(!pretranslate){initObserver();}
|
||||
initResources.call(navigator.mozL10n);}
|
||||
function initResources(){var meta={};var nodes=document.head.querySelectorAll('link[rel="localization"],'+'meta[name="availableLanguages"],'+'meta[name="defaultLanguage"],'+'meta[name="appVersion"],'+'script[type="application/l10n"]');for(var i=0,node;node=nodes[i];i++){var type=node.getAttribute('rel')||node.nodeName.toLowerCase();switch(type){case'localization':this.ctx.resLinks.push(node.getAttribute('href'));break;case'meta':onMetaInjected.call(this,node,meta);break;case'script':onScriptInjected.call(this,node);break;}}
|
||||
var additionalLanguagesPromise;if(navigator.mozApps&&navigator.mozApps.getAdditionalLanguages){additionalLanguagesPromise=navigator.mozApps.getAdditionalLanguages().catch(function(e){console.error('Error while loading getAdditionalLanguages',e);});document.addEventListener('additionallanguageschange',function(evt){registerLocales.call(this,meta,evt.detail);this.ctx.requestLocales.apply(this.ctx,navigator.languages||[navigator.language]);}.bind(this));}else{additionalLanguagesPromise=Promise.resolve();}
|
||||
additionalLanguagesPromise.then(function(extraLangs){registerLocales.call(this,meta,extraLangs);initLocale.call(this);}.bind(this));}
|
||||
function registerLocales(meta,extraLangs){var locales=buildLocaleList.call(this,meta,extraLangs);navigator.mozL10n._config.localeSources=locales[1];this.ctx.registerLocales(locales[0],Object.keys(locales[1]));}
|
||||
function getMatchingLangpack(appVersion,langpacks){for(var i=0,langpack;(langpack=langpacks[i]);i++){if(langpack.target===appVersion){return langpack;}}
|
||||
return null;}
|
||||
function buildLocaleList(meta,extraLangs){var loc,lp;var localeSources=Object.create(null);var defaultLocale=meta.defaultLanguage||this.ctx.defaultLocale;if(meta.availableLanguages){for(loc in meta.availableLanguages){localeSources[loc]='app';}}
|
||||
if(extraLangs){for(loc in extraLangs){lp=getMatchingLangpack(this._config.appVersion,extraLangs[loc]);if(!lp){continue;}
|
||||
if(!(loc in localeSources)||!meta.availableLanguages[loc]||parseInt(lp.revision)>meta.availableLanguages[loc]){localeSources[loc]='extra';}}}
|
||||
if(!(defaultLocale in localeSources)){localeSources[defaultLocale]='app';}
|
||||
return[defaultLocale,localeSources];}
|
||||
function splitAvailableLanguagesString(str){var langs={};str.split(',').forEach(function(lang){lang=lang.trim().split(':');langs[lang[0]]=parseInt(lang[1]);});return langs;}
|
||||
function onMetaInjected(node,meta){switch(node.getAttribute('name')){case'availableLanguages':meta.availableLanguages=splitAvailableLanguagesString(node.getAttribute('content'));break;case'defaultLanguage':meta.defaultLanguage=node.getAttribute('content');break;case'appVersion':navigator.mozL10n._config.appVersion=node.getAttribute('content');break;}}
|
||||
function onScriptInjected(node){var lang=node.getAttribute('lang');var locale=this.ctx.getLocale(lang);locale.addAST(JSON.parse(node.textContent));}
|
||||
function initLocale(){this.ctx.requestLocales.apply(this.ctx,navigator.languages||[navigator.language]);window.addEventListener('languagechange',function l10n_langchange(){this.ctx.requestLocales.apply(this.ctx,navigator.languages||[navigator.language]);}.bind(this));}
|
||||
function localizeMutations(mutations){var mutation;var targets=new Set();for(var i=0;i<mutations.length;i++){mutation=mutations[i];if(mutation.type==='childList'){var addedNode;for(var j=0;j<mutation.addedNodes.length;j++){addedNode=mutation.addedNodes[j];if(addedNode.nodeType!==Node.ELEMENT_NODE){continue;}
|
||||
targets.add(addedNode);}}
|
||||
if(mutation.type==='attributes'){targets.add(mutation.target);}}
|
||||
targets.forEach(function(target){if(target.childElementCount){translateFragment.call(this,target);}else if(target.hasAttribute('data-l10n-id')){translateElement.call(this,target);}},this);}
|
||||
function onMutations(mutations,self){self.disconnect();localizeMutations.call(this,mutations);self.observe(document,moConfig);}
|
||||
function onReady(){if(!navigator.mozL10n._config.isPretranslated){translateDocument.call(this);}
|
||||
navigator.mozL10n._config.isPretranslated=false;if(pendingElements){for(var i=0,element;element=pendingElements[i];i++){translateElement.call(this,element);}
|
||||
pendingElements=null;}
|
||||
if(!nodeObserver){initObserver();}
|
||||
fireLocalizedEvent.call(this);}
|
||||
function fireLocalizedEvent(){var event=new CustomEvent('localized',{'bubbles':false,'cancelable':false,'detail':{'language':this.ctx.supportedLocales[0]}});window.dispatchEvent(event);}
|
||||
var reOverlay=/<|&#?\w+;/;var reHtml=/[&<>]/g;var htmlEntities={'&':'&','<':'<','>':'>',};function translateDocument(){document.documentElement.lang=this.language.code;document.documentElement.dir=this.language.direction;translateFragment.call(this,document.documentElement);}
|
||||
function translateFragment(element){if(typeof element.hasAttribute==='function'&&element.hasAttribute('data-l10n-id')){translateElement.call(this,element);}
|
||||
var nodes=getTranslatableChildren(element);for(var i=0;i<nodes.length;i++){translateElement.call(this,nodes[i]);}}
|
||||
function setL10nAttributes(element,id,args){element.setAttribute('data-l10n-id',id);if(args){element.setAttribute('data-l10n-args',JSON.stringify(args));}}
|
||||
function getL10nAttributes(element){return{id:element.getAttribute('data-l10n-id'),args:JSON.parse(element.getAttribute('data-l10n-args'))};}
|
||||
function getTranslatableChildren(element){return element?element.querySelectorAll('*[data-l10n-id]'):[];}
|
||||
function camelCaseToDashed(string){if(string==='ariaValueText'){return'aria-valuetext';}
|
||||
return string.replace(/[A-Z]/g,function(match){return'-'+match.toLowerCase();}).replace(/^-/,'');}
|
||||
function escapeL10nArgs(match){return htmlEntities[match];}
|
||||
function translateElement(element){if(!this.ctx.isReady){if(!pendingElements){pendingElements=[];}
|
||||
pendingElements.push(element);return;}
|
||||
var l10nId=element.getAttribute('data-l10n-id');if(!l10nId){return false;}
|
||||
var l10nArgs=element.getAttribute('data-l10n-args');var entity=this.ctx.getEntity(l10nId,l10nArgs?JSON.parse(l10nArgs.replace(reHtml,escapeL10nArgs)):undefined);var value=entity.value;if(typeof value==='string'){if(!reOverlay.test(value)){element.textContent=value;}else{var translation=element.ownerDocument.createElement('template');translation.innerHTML=value;overlayElement(element,translation.content);}}
|
||||
for(var key in entity.attrs){var attrName=camelCaseToDashed(key);if(isAttrAllowed({name:attrName},element)){element.setAttribute(attrName,entity.attrs[key]);}}}
|
||||
function overlayElement(sourceElement,translationElement){var result=translationElement.ownerDocument.createDocumentFragment();var k,attr;var childElement;while((childElement=translationElement.childNodes[0])){translationElement.removeChild(childElement);if(childElement.nodeType===Node.TEXT_NODE){result.appendChild(childElement);continue;}
|
||||
var index=getIndexOfType(childElement);var sourceChild=getNthElementOfType(sourceElement,childElement,index);if(sourceChild){overlayElement(sourceChild,childElement);result.appendChild(sourceChild);continue;}
|
||||
if(isElementAllowed(childElement)){var sanitizedChild=childElement.ownerDocument.createElement(childElement.nodeName);overlayElement(sanitizedChild,childElement);result.appendChild(sanitizedChild);continue;}
|
||||
result.appendChild(document.createTextNode(childElement.textContent));}
|
||||
sourceElement.textContent='';sourceElement.appendChild(result);if(translationElement.attributes){for(k=0,attr;(attr=translationElement.attributes[k]);k++){if(isAttrAllowed(attr,sourceElement)){sourceElement.setAttribute(attr.name,attr.value);}}}}
|
||||
function isElementAllowed(element){return allowed.elements.indexOf(element.tagName.toLowerCase())!==-1;}
|
||||
function isAttrAllowed(attr,element){var attrName=attr.name.toLowerCase();var tagName=element.tagName.toLowerCase();if(allowed.attributes.global.indexOf(attrName)!==-1){return true;}
|
||||
if(!allowed.attributes[tagName]){return false;}
|
||||
if(allowed.attributes[tagName].indexOf(attrName)!==-1){return true;}
|
||||
if(tagName==='input'&&attrName==='value'){var type=element.type.toLowerCase();if(type==='submit'||type==='button'||type==='reset'){return true;}}
|
||||
return false;}
|
||||
function getNthElementOfType(context,element,index){var nthOfType=0;for(var i=0,child;child=context.children[i];i++){if(child.nodeType===Node.ELEMENT_NODE&&child.tagName===element.tagName){if(nthOfType===index){return child;}
|
||||
nthOfType++;}}
|
||||
return null;}
|
||||
function getIndexOfType(element){var index=0;var child;while((child=element.previousElementSibling)){if(child.tagName===element.tagName){index++;}}
|
||||
return index;}
|
||||
var DEBUG=false;navigator.mozL10n.ctx=new Context(window.document?document.URL:null);navigator.mozL10n.ctx.ready(onReady.bind(navigator.mozL10n));navigator.mozL10n.ctx.addEventListener('notfounderror',function reportMissingEntity(e){if(DEBUG||e.loc==='en-US'){console.warn(e.toString());}});if(DEBUG){navigator.mozL10n.ctx.addEventListener('fetcherror',console.error.bind(console));navigator.mozL10n.ctx.addEventListener('parseerror',console.error.bind(console));navigator.mozL10n.ctx.addEventListener('resolveerror',console.error.bind(console));}
|
||||
if(window.document){navigator.mozL10n._config.isPretranslated=document.documentElement.lang===navigator.language;var forcePretranslate=!navigator.mozL10n._config.isPretranslated;whenInteractive(init.bind(navigator.mozL10n,forcePretranslate));}
|
||||
document.l10n={setAttributes:navigator.mozL10n.setAttributes,getAttributes:navigator.mozL10n.getAttributes,formatValue:function(id,args){return navigator.mozL10n.formatValue(id,args);},translateFragment:function(frag){return Promise.resolve(navigator.mozL10n.translateFragment(frag));},ready:new Promise(function(resolve){navigator.mozL10n.once(resolve);}),formatValues:function(){var keys=arguments;var resp=keys.map(function(key){if(Array.isArray(key)){return navigator.mozL10n.formatValue(key[0],key[1]);}
|
||||
return navigator.mozL10n.formatValue(key);});return Promise.all(resp);},requestLanguages:function(langs){navigator.mozL10n.ctx.requestLocales.apply(navigator.mozL10n.ctx,langs);},pseudo:{'fr-x-psaccent':{getName:function(){return Promise.resolve(navigator.mozL10n.qps['fr-x-psaccent'].name);},processString:function(s){return Promise.resolve(navigator.mozL10n.qps['fr-x-psaccent'].translate(s));}},'ar-x-psbidi':{getName:function(){return Promise.resolve(navigator.mozL10n.qps['ar-x-psbidi'].name);},processString:function(s){return Promise.resolve(navigator.mozL10n.qps['ar-x-psbidi'].translate(s));}}},};navigator.mozL10n.ready(function(){document.documentElement.setAttribute('langs',navigator.mozL10n.ctx.supportedLocales.join(' '));});navigator.mozL10n.once(function(){window.addEventListener('localized',function(){document.dispatchEvent(new CustomEvent('DOMRetranslated',{bubbles:false,cancelable:false}));});});})(this);;(function(exports){'use strict';var SettingsHelper=function(key,defaultValue){var SETTINGS_KEY=key;var _settings=navigator.mozSettings;var _value=null;var _defaultValue=defaultValue;var _isReady=false;var _callbacks=[];var _return=function sh_return(callback){if(!callback){return;}
|
||||
callback.apply(null,Array.prototype.slice.call(arguments,1));};var _ready=function sh_ready(callback){if(!callback){return;}
|
||||
if(_isReady){callback();}else{_callbacks.push(callback);}};var _getValue=function sh_getValue(callback){var req=_settings.createLock().get(SETTINGS_KEY);req.onsuccess=function(){_return(callback,req.result[SETTINGS_KEY]);};req.onerror=function(){console.error('Error getting '+SETTINGS_KEY+'.');_return(callback,null);};};var _setValue=function sh_setValue(value,callback){var obj={};obj[SETTINGS_KEY]=value;var req=_settings.createLock().set(obj);req.onsuccess=function(){_return(callback);};req.onerror=function(){console.error('Error setting '+SETTINGS_KEY+'.');_return(callback);};};var _valuechanged=function sh_valuehanged(e){_value=e.settingValue;};var _init=function sh_init(callback){_getValue(function(value){_value=value?value:_defaultValue;_return(callback);});_settings.addObserver(SETTINGS_KEY,_valuechanged);};_init(function(){_isReady=true;_callbacks.forEach(function(callback){callback();});});return{get:function(callback){_ready(function(){_return(callback,_value?_value:_defaultValue);});},set:function(value,callback){_ready(function(){_setValue(value,_return.bind(null,callback));});},uninit:function(){_settings.removeObserver(SETTINGS_KEY,_valuechanged);}};};exports.SettingsHelper=SettingsHelper;})(this);;;'use strict';var DateHelper={todayStarted:function dh_todayStarted(){var now=(new Date()).valueOf();return this.getMidnight(now);},yesterdayStarted:function dh_yesterdayStarted(){var now=(new Date()).valueOf();var dayAgo=now-86400000;return this.getMidnight(dayAgo);},thisWeekStarted:function dh_thisWeekStarted(){var now=new Date();var dayOfTheWeek=now.getDay();var firstDay=new Date(now.getFullYear(),now.getMonth(),now.getDate()-dayOfTheWeek);return this.getMidnight(firstDay);},thisMonthStarted:function dh_thisMonthStarted(){var now=new Date();var firstDay=(new Date(now.getFullYear(),now.getMonth(),1).valueOf());return firstDay;},lastSixMonthsStarted:function dh_lastSixMonthsStarted(){var now=new Date().valueOf();var sixMonthsAgo=now-2629743830*6;return sixMonthsAgo;},thisYearStarted:function dh_thisYearStarted(){var now=new Date();var firstDay=(new Date(now.getFullYear(),0).valueOf());return firstDay;},getMidnight:function dh_getMidnight(timestamp){var day=new Date(timestamp);var midnight=(new Date(day.getFullYear(),day.getMonth(),day.getDate(),0).valueOf());return midnight;}};var NumberHelper={zfill:function nh_zfill(string,len){var s=string;while(s.length<len){s='0'+s;}
|
||||
return s;}};var StringHelper={fromUTF8:function ut_fromUTF8(str){var buf=new Uint8Array(str.length);for(var i=0;i<str.length;i++){buf[i]=str.charCodeAt(i);}
|
||||
return buf;},camelCase:function ut_camelCase(str){var rdashes=/-(.)/g;return str.replace(rdashes,function replacer(str,p1){return p1.toUpperCase();});}};var HtmlHelper={createHighlightHTML:function ut_createHighlightHTML(text,terms){var toHighlight=[];var normalizedText=Normalizer.toAscii(text).toLowerCase();terms.forEach(function(term){term=Normalizer.toAscii(term).toLowerCase();var index=normalizedText.indexOf(term);while(index>=0){for(var i=0,length=term.length;i<length;i++){toHighlight[index+i]=true;}
|
||||
index=normalizedText.indexOf(term,index+term.length);}});var fragment=document.createDocumentFragment();for(var i=0;i<text.length;i++){if(!toHighlight[i]){fragment.appendChild(document.createTextNode(text[i]));}else{var term='';while(toHighlight[i]){term+=text[i];i++;}
|
||||
i--;var mark=document.createElement('mark');mark.textContent=term;fragment.appendChild(mark);}}
|
||||
return fragment;},escapeHTML:function ut_escapeHTML(str,escapeQuotes){var span=document.createElement('span');span.textContent=str;span.innerHTML=span.innerHTML.replace(/\s/g,' ');if(escapeQuotes){return span.innerHTML.replace(/"/g,'"').replace(/'/g,''');}
|
||||
return span.innerHTML;},importElements:function importElements(context){var ids=[].slice.call(arguments,1);ids.forEach(function(id){context[StringHelper.camelCase(id)]=document.getElementById(id);});}};;;;window.COMPONENTS_BASE_URL='/shared/elements/';;;;(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.GaiaHeader=f()}})(function(){var define,module,exports;return(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){;(function(define){define(function(require,exports,module){'use strict';var debug=0?console.log.bind(console):function(){};var cache={};var MIN=16;var MAX=24;var BUFFER=3;module.exports=function(config){debug('font fit',config);var space=config.space-BUFFER;var min=config.min||MIN;var max=config.max||MAX;var text=trim(config.text);var fontSize=max;var textWidth;var font;do{font=config.font.replace(/\d+px/,fontSize+'px');textWidth=getTextWidth(text,font);}while(textWidth>space&&fontSize!==min&&fontSize--);return{textWidth:textWidth,fontSize:fontSize,overflowing:textWidth>space};};function getTextWidth(text,font){var ctx=getCanvasContext(font);var width=ctx.measureText(text).width;debug('got text width',width);return width;}
|
||||
function getCanvasContext(font){debug('get canvas context',font);var cached=cache[font];if(cached){return cached;}
|
||||
var canvas=document.createElement('canvas');canvas.setAttribute('moz-opaque','true');canvas.setAttribute('width','1px');canvas.setAttribute('height','1px');debug('created canvas',canvas);var ctx=canvas.getContext('2d',{willReadFrequently:true});ctx.font=font;return cache[font]=ctx;}
|
||||
function trim(text){return text.replace(/\s+/g,' ').trim();}});})(typeof define=='function'&&define.amd?define:(function(n,w){'use strict';return typeof module=='object'?function(c){c(require,exports,module);}:function(c){var m={exports:{}};c(function(n){return w[n];},m.exports,m);w[n]=m.exports;};})('font-fit',this));},{}],2:[function(require,module,exports){;(function(define){'use strict';define(function(require,exports,module){var textContent=Object.getOwnPropertyDescriptor(Node.prototype,'textContent');var innerHTML=Object.getOwnPropertyDescriptor(Element.prototype,'innerHTML');var removeAttribute=Element.prototype.removeAttribute;var setAttribute=Element.prototype.setAttribute;var noop=function(){};exports.register=function(name,props){var baseProto=getBaseProto(props.extends);var template=props.template||baseProto.templateString;var extensible=props.extensible=props.hasOwnProperty('extensible')?props.extensible:true;delete props.extends;if(template){if(extensible&&props.template){props.templateString=props.template;}
|
||||
var output=processCss(template,name);props.template=document.createElement('template');props.template.innerHTML=output.template;props.lightCss=output.lightCss;props.globalCss=props.globalCss||'';props.globalCss+=output.globalCss;}
|
||||
injectGlobalCss(props.globalCss);delete props.globalCss;var descriptors=mixin(props.attrs||{},base.descriptors);props._attrs=props.attrs;delete props.attrs;var proto=createProto(baseProto,props);Object.defineProperties(proto,descriptors);try{return document.registerElement(name,{prototype:proto});}catch(e){if(e.name!=='NotSupportedError'){throw e;}}};var base={properties:{GaiaComponent:true,attributeChanged:noop,attached:noop,detached:noop,created:noop,createdCallback:function(){if(this.dirObserver){addDirObserver();}
|
||||
injectLightCss(this);this.created();},attributeChangedCallback:function(name,from,to){var prop=toCamelCase(name);if(this._attrs&&this._attrs[prop]){this[prop]=to;}
|
||||
this.attributeChanged(name,from,to);},attachedCallback:function(){if(this.dirObserver){this.setInnerDirAttributes=setInnerDirAttributes.bind(null,this);document.addEventListener('dirchanged',this.setInnerDirAttributes);}
|
||||
this.attached();},detachedCallback:function(){if(this.dirObserver){document.removeEventListener('dirchanged',this.setInnerDirAttributes);}
|
||||
this.detached();},setupShadowRoot:function(){if(!this.template){return;}
|
||||
var node=document.importNode(this.template.content,true);this.createShadowRoot().appendChild(node);if(this.dirObserver){setInnerDirAttributes(this);}
|
||||
return this.shadowRoot;},setAttr:function(name,value){var internal=this.shadowRoot.firstElementChild;setAttribute.call(internal,name,value);setAttribute.call(this,name,value);},removeAttr:function(name){var internal=this.shadowRoot.firstElementChild;removeAttribute.call(internal,name);removeAttribute.call(this,name);}},descriptors:{textContent:{set:function(value){textContent.set.call(this,value);if(this.lightStyle){this.appendChild(this.lightStyle);}},get:function(){return textContent.get();}},innerHTML:{set:function(value){innerHTML.set.call(this,value);if(this.lightStyle){this.appendChild(this.lightStyle);}},get:innerHTML.get}}};var defaultPrototype=createProto(HTMLElement.prototype,base.properties);function getBaseProto(proto){if(!proto){return defaultPrototype;}
|
||||
proto=proto.prototype||proto;return!proto.GaiaComponent?createProto(proto,base.properties):proto;}
|
||||
function createProto(proto,props){return mixin(Object.create(proto),props);}
|
||||
var hasShadowCSS=(function(){var div=document.createElement('div');try{div.querySelector(':host');div.querySelector('::content');return true;}
|
||||
catch(e){return false;}})();var regex={shadowCss:/(?:\:host|\:\:content)[^{]*\{[^}]*\}/g,':host':/(?:\:host)/g,':host()':/\:host\((.+)\)(?: \:\:content)?/g,':host-context':/\:host-context\((.+)\)([^{,]+)?/g,'::content':/(?:\:\:content)/g};function processCss(template,name){var globalCss='';var lightCss='';if(!hasShadowCSS){template=template.replace(regex.shadowCss,function(match){var hostContext=regex[':host-context'].exec(match);if(hostContext){globalCss+=match.replace(regex['::content'],'').replace(regex[':host-context'],'$1 '+name+'$2').replace(/ +/g,' ');}else{lightCss+=match.replace(regex[':host()'],name+'$1').replace(regex[':host'],name).replace(regex['::content'],name);}
|
||||
return'';});}
|
||||
return{template:template,lightCss:lightCss,globalCss:globalCss};}
|
||||
function injectGlobalCss(css){if(!css){return;}
|
||||
var style=document.createElement('style');style.innerHTML=css.trim();headReady().then(function(){document.head.appendChild(style);});}
|
||||
function headReady(){return new Promise(function(resolve){if(document.head){return resolve();}
|
||||
window.addEventListener('load',function fn(){window.removeEventListener('load',fn);resolve();});});}
|
||||
function injectLightCss(el){if(hasShadowCSS){return;}
|
||||
var stylesheet=el.querySelector('style');if(!stylesheet){stylesheet=document.createElement('style');stylesheet.setAttribute('scoped','');stylesheet.appendChild(document.createTextNode(el.lightCss));el.appendChild(stylesheet);}
|
||||
el.lightStyle=stylesheet;}
|
||||
function toCamelCase(string){return string.replace(/-(.)/g,function replacer(string,p1){return p1.toUpperCase();});}
|
||||
var dirObserver;function setInnerDirAttributes(component){var dir=component.dir||document.dir;Array.from(component.shadowRoot.children).forEach(element=>{if(element.nodeName!=='STYLE'){element.dir=dir;}});}
|
||||
function addDirObserver(){if(dirObserver){return;}
|
||||
dirObserver=new MutationObserver(onChanged);dirObserver.observe(document.documentElement,{attributeFilter:['dir'],attributes:true});function onChanged(mutations){document.dispatchEvent(new Event('dirchanged'));}}
|
||||
function mixin(target,source){for(var key in source){target[key]=source[key];}
|
||||
return target;}});})(typeof define=='function'&&define.amd?define:(function(n,w){'use strict';return typeof module=='object'?function(c){c(require,exports,module);}:function(c){var m={exports:{}};c(function(n){return w[n];},m.exports,m);w[n]=m.exports;};})('gaia-component',this));},{}],3:[function(require,module,exports){(function(define){'use strict';define(function(require,exports,module){var base=window.GAIA_ICONS_BASE_URL||window.COMPONENTS_BASE_URL||'bower_components/';if(!document.documentElement){window.addEventListener('load',load);}else{load();}
|
||||
function load(){if(isLoaded()){return;}
|
||||
var link=document.createElement('link');link.rel='stylesheet';link.type='text/css';link.href=base+'gaia-icons/gaia-icons.css';document.head.appendChild(link);exports.loaded=true;}
|
||||
function isLoaded(){return exports.loaded||document.querySelector('link[href*=gaia-icons]')||document.documentElement.classList.contains('gaia-icons-loaded');}});})(typeof define=='function'&&define.amd?define:(function(n,w){'use strict';return typeof module=='object'?function(c){c(require,exports,module);}:function(c){var m={exports:{}};c(function(n){return w[n];},m.exports,m);w[n]=m.exports;};})('gaia-icons',this));},{}],4:[function(require,module,exports){;(function(define){'use strict';define(function(require,exports,module){var component=require('gaia-component');var fontFit=require('font-fit');require('gaia-icons');var debug=0?console.log.bind(console):function(){};const KNOWN_ACTIONS={menu:'menu',back:'back',close:'close'};const TITLE_FONT='italic 300 24px FiraSans';const TITLE_PADDING=10;const MINIMUM_FONT_SIZE_CENTERED=20;const MINIMUM_FONT_SIZE_UNCENTERED=16;const MAXIMUM_FONT_SIZE=23;module.exports=component.register('gaia-header',{extensible:false,dirObserver:true,created:function(){debug('created');this.setupShadowRoot();this.els={actionButton:this.shadowRoot.querySelector('.action-button'),titles:this.getElementsByTagName('h1')};this.els.actionButton.addEventListener('click',e=>this.onActionButtonClick(e));this.observer=new MutationObserver(this.onMutation.bind(this));this.ignoreDir=this.hasAttribute('ignore-dir');this.titleEnd=this.getAttribute('title-end');this.titleStart=this.getAttribute('title-start');this.noFontFit=this.getAttribute('no-font-fit');this.notFlush=this.hasAttribute('not-flush');this.action=this.getAttribute('action');this.unresolved={};this.pending={};this._resizeThrottlingId=null;this.onResize=this.onResize.bind(this);},attached:function(){debug('attached');this.runFontFitSoon();this.observerStart();window.addEventListener('resize',this.onResize);},detached:function(){debug('detached');window.removeEventListener('resize',this.onResize);this.observerStop();this.clearPending();},clearPending:function(){for(var key in this.pending){this.pending[key].clear();delete this.pending[key];}
|
||||
window.cancelAnimationFrame(this._resizeThrottlingId);this._resizeThrottlingId=null;},runFontFit:function(){debug('run font-fit');if(this.noFontFit){return Promise.resolve();}
|
||||
var titles=this.els.titles;var space=this.getTitleSpace();var styles=[].map.call(titles,el=>this.getTitleStyle(el,space));return this.setTitleStylesSoon(styles);},runFontFitSoon:function(){debug('run font-fit soon');if(this.pending.runFontFitSoon){return;}
|
||||
this.pending.runFontFitSoon=this.nextTick(()=>{delete this.pending.runFontFitSoon;this.runFontFit();});},getTitleStyle:function(el,space){debug('get el style',el,space);var text=el.textContent;var styleId=space.start+text+space.end+'#'+space.value;if(!text||!text.trim()){return debug('exit: no text');}
|
||||
if(getStyleId(el)===styleId){return debug('exit: no change');}
|
||||
var marginStart=this.getTitleMarginStart();var textSpace=space.value-Math.abs(marginStart);var fontFitResult=this.fontFit(text,textSpace,{min:MINIMUM_FONT_SIZE_CENTERED});var overflowing=fontFitResult.overflowing;var padding={start:0,end:0};if(overflowing){debug('title overflowing');padding.start=!space.start?TITLE_PADDING:0;padding.end=!space.end?TITLE_PADDING:0;textSpace=space.value-padding.start-padding.end;fontFitResult=this.fontFit(text,textSpace);marginStart=0;}
|
||||
return{id:styleId,fontSize:fontFitResult.fontSize,marginStart:marginStart,overflowing:overflowing,padding:padding};},setTitleStylesSoon:function(styles){debug('set title styles soon',styles);var key='setStyleTitlesSoon';this._titleStyles=styles;if(this.unresolved[key]){return this.unresolved[key];}
|
||||
this.unresolved[key]=new Promise((resolve)=>{this.pending[key]=this.nextTick(()=>{var styles=this._titleStyles;var els=this.els.titles;[].forEach.call(els,(el,i)=>{if(!styles[i]){return debug('exit');}
|
||||
this.setTitleStyle(el,styles[i]);});delete this._titleStyles;delete this.unresolved[key];delete this.pending[key];resolve();});});},setTitleStyle:function(el,style){debug('set title style',style);this.observerStop();if(this.ignoreDir){el.style.marginLeft=style.marginStart+'px';el.style.paddingLeft=style.padding.start+'px';el.style.paddingRight=style.padding.end+'px';}else{el.style.marginInlineStart=style.marginStart+'px';el.style.paddingInlineStart=style.padding.start+'px';el.style.paddingInlineEnd=style.padding.end+'px';}
|
||||
el.style.fontSize=style.fontSize+'px';setStyleId(el,style.id);this.observerStart();},fontFit:function(text,space,opts={}){debug('font fit:',text,space,opts);var fontFitArgs={font:TITLE_FONT,min:opts.min||MINIMUM_FONT_SIZE_UNCENTERED,max:MAXIMUM_FONT_SIZE,text:text,space:space};return fontFit(fontFitArgs);},observerStart:function(){if(this.observing){return;}
|
||||
this.observer.observe(this,{childList:true,attributes:true,subtree:true});this.observing=true;debug('observer started');},observerStop:function(){if(!this.observing){return;}
|
||||
this.observer.disconnect();this.observing=false;debug('observer stopped');},onResize:function(e){debug('onResize',this._resizeThrottlingId);if(this._resizeThrottlingId!==null){return;}
|
||||
this._resizeThrottlingId=window.requestAnimationFrame(()=>{this._resizeThrottlingId=null;this.runFontFitSoon();});},onMutation:function(mutations){debug('on mutation',mutations);if(!this.pending.runFontFitSoon){this.runFontFit();}},getTitleSpace:function(){var start=this.titleStart;var end=this.titleEnd;var space=this.getWidth()-start-end;var result={value:space,start:start,end:end};debug('get title space',result);return result;},getWidth:function(){var value=this.notFlush?this.clientWidth:window.innerWidth;debug('get width',value);return value;},triggerAction:function(){if(this.action){this.els.actionButton.click();}},onActionButtonClick:function(){debug('action button click');var config={detail:{type:this.action}};var e=new CustomEvent('action',config);setTimeout(()=>this.dispatchEvent(e));},getTitleMarginStart:function(){var start=this.titleStart;var end=this.titleEnd;var marginStart=end-start;debug('get title margin start',marginStart);return marginStart;},getButtonsBeforeTitle:function(){var children=this.children;var l=children.length;var els=[];for(var i=0;i<l;i++){var el=children[i];if(el.tagName==='H1'){break;}
|
||||
if(!contributesToLayout(el)){continue;}
|
||||
els.push(el);}
|
||||
if(this.action){els.push(this.els.actionButton);}
|
||||
return els;},getButtonsAfterTitle:function(){var children=this.children;var els=[];for(var i=children.length-1;i>=0;i--){var el=children[i];if(el.tagName==='H1'){break;}
|
||||
if(!contributesToLayout(el)){continue;}
|
||||
els.push(el);}
|
||||
return els;},sumButtonWidths:function(buttons){var defaultWidth=50;var sum=buttons.reduce((prev,button)=>{var isStandardButton=button===this.els.actionButton;var width=isStandardButton?defaultWidth:button.clientWidth;return prev+width;},0);debug('sum button widths',buttons,sum);return sum;},attrs:{action:{get:function(){return this._action;},set:function(value){var action=KNOWN_ACTIONS[value];if(action===this._action){return;}
|
||||
this.setAttr('action',action);this._action=action;}},titleStart:{get:function(){debug('get title-start');if('_titleStart'in this){return this._titleStart;}
|
||||
var buttons=this.getButtonsBeforeTitle();var value=this.sumButtonWidths(buttons);debug('get title-start',buttons,value);return value;},set:function(value){debug('set title-start',value);value=parseInt(value,10);if(value===this._titleStart||isNaN(value)){return;}
|
||||
this.setAttr('title-start',value);this._titleStart=value;debug('set');}},titleEnd:{get:function(){debug('get title-end');if('_titleEnd'in this){return this._titleEnd;}
|
||||
var buttons=this.getButtonsAfterTitle();return this.sumButtonWidths(buttons);},set:function(value){debug('set title-end',value);value=parseInt(value,10);if(value===this._titleEnd||isNaN(value)){return;}
|
||||
this.setAttr('title-end',value);this._titleEnd=value;}},noFontFit:{get:function(){return this._noFontFit||false;},set:function(value){debug('set no-font-fit',value);value=!!(value||value==='');if(value===this.noFontFit){return;}
|
||||
this._noFontFit=value;if(value){this.setAttr('no-font-fit','');}
|
||||
else{this.removeAttr('no-font-fit');}}},ignoreDir:{get:function(){return this._ignoreDir||false;},set:function(value){debug('set ignore-dir',value);value=!!(value||value==='');if(value===this.ignoreDir){return;}
|
||||
this._ignoreDir=value;this.dirObserver=!value;if(value){this.setAttr('ignore-dir','');}
|
||||
else{this.removeAttr('ignore-dir');}}}},template:`<div class="inner">
|
||||
<button class="action-button">
|
||||
<content select="[l10n-action]"></content>
|
||||
</button>
|
||||
<content></content>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
|
||||
:host {
|
||||
display: block;
|
||||
-moz-user-select: none;
|
||||
|
||||
--gaia-header-button-color:
|
||||
var(--header-button-color,
|
||||
var(--header-color,
|
||||
var(--link-color,
|
||||
inherit)));
|
||||
}
|
||||
|
||||
/**
|
||||
* [hidden]
|
||||
*/
|
||||
|
||||
:host[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/** Reset
|
||||
---------------------------------------------------------*/
|
||||
|
||||
::-moz-focus-inner { border: 0; }
|
||||
|
||||
/** Inner
|
||||
---------------------------------------------------------*/
|
||||
|
||||
.inner {
|
||||
display: flex;
|
||||
min-height: 50px;
|
||||
-moz-user-select: none;
|
||||
|
||||
background:
|
||||
var(--header-background,
|
||||
var(--background,
|
||||
#fff));
|
||||
}
|
||||
|
||||
/** Action Button
|
||||
---------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* 1. Hidden by default
|
||||
*/
|
||||
|
||||
.action-button {
|
||||
position: relative;
|
||||
|
||||
display: none; /* 1 */
|
||||
width: 50px;
|
||||
font-size: 30px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
outline: 0;
|
||||
|
||||
align-items: center;
|
||||
background: none;
|
||||
cursor: pointer;
|
||||
transition: opacity 200ms 280ms;
|
||||
color:
|
||||
var(--header-action-button-color,
|
||||
var(--header-icon-color,
|
||||
var(--gaia-header-button-color)));
|
||||
}
|
||||
|
||||
/**
|
||||
* [action=back]
|
||||
* [action=menu]
|
||||
* [action=close]
|
||||
*
|
||||
* 1. For icon vertical-alignment
|
||||
*/
|
||||
|
||||
[action=back] .action-button,
|
||||
[action=menu] .action-button,
|
||||
[action=close] .action-button {
|
||||
display: flex; /* 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* :active
|
||||
*/
|
||||
|
||||
.action-button:active {
|
||||
transition: none;
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
/** Action Button Icon
|
||||
---------------------------------------------------------*/
|
||||
|
||||
.action-button:before {
|
||||
font-family: 'gaia-icons';
|
||||
font-style: normal;
|
||||
text-rendering: optimizeLegibility;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
[action=close] .action-button:before { content: 'close' }
|
||||
[action=menu] .action-button:before { content: 'menu' }
|
||||
|
||||
[action=back]:-moz-dir(ltr) .action-button:before { content: 'left' }
|
||||
[action=back]:-moz-dir(rtl) .action-button:before { content: 'right' }
|
||||
|
||||
/** Action Button Icon
|
||||
---------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* 1. To enable vertical alignment.
|
||||
*/
|
||||
|
||||
.action-button:before {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/** Action Button Text
|
||||
---------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* To provide custom localized content for
|
||||
* the action-button, we allow the user
|
||||
* to provide an element with the class
|
||||
* .l10n-action. This node is then
|
||||
* pulled inside the real action-button.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* <gaia-header action="back">
|
||||
* <span l10n-action aria-label="Back">Localized text</span>
|
||||
* <h1>title</h1>
|
||||
* </gaia-header>
|
||||
*/
|
||||
|
||||
::content [l10n-action] {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
/** Title
|
||||
---------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* 1. Vertically center text. We can't use flexbox
|
||||
* here as it breaks text-overflow ellipsis
|
||||
* without an inner div.
|
||||
*/
|
||||
|
||||
::content h1 {
|
||||
flex: 1;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
text-align: center;
|
||||
line-height: 50px; /* 1 */
|
||||
font-weight: 300;
|
||||
font-style: italic;
|
||||
font-size: 24px;
|
||||
|
||||
color:
|
||||
var(--header-title-color,
|
||||
var(--header-color,
|
||||
var(--title-color,
|
||||
var(--text-color,
|
||||
inherit))));
|
||||
}
|
||||
|
||||
/**
|
||||
* [ignore-dir]
|
||||
*
|
||||
* When the <gaia-header> component has an [ignore-dir] attribute, header
|
||||
* direction is forced to LTR but we still want the <h1> text to be reversed
|
||||
* so that strings like '1 selected' become 'selected 1'.
|
||||
*
|
||||
* When we're happy for <gaia-header> to be fully RTL responsive we won't need
|
||||
* these rules anymore, but this depends on all Gaia apps being ready.
|
||||
*
|
||||
* This should be safe to remove when bug 1179459 lands.
|
||||
*/
|
||||
|
||||
:host[ignore-dir] {
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
:host[ignore-dir]:-moz-dir(rtl) h1 {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
/** Buttons
|
||||
---------------------------------------------------------*/
|
||||
|
||||
::content a,
|
||||
::content button {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
width: auto;
|
||||
height: auto;
|
||||
min-width: 50px;
|
||||
margin: 0;
|
||||
padding: 0 10px;
|
||||
outline: 0;
|
||||
border: 0;
|
||||
|
||||
font-size: 14px;
|
||||
line-height: 1;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
background: none;
|
||||
border-radius: 0;
|
||||
font-style: italic;
|
||||
cursor: pointer;
|
||||
transition: opacity 200ms 280ms;
|
||||
color: var(--gaia-header-button-color);
|
||||
}
|
||||
|
||||
/**
|
||||
* :active
|
||||
*/
|
||||
|
||||
::content a:active,
|
||||
::content button:active {
|
||||
transition: none;
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
/**
|
||||
* [hidden]
|
||||
*/
|
||||
|
||||
::content a[hidden],
|
||||
::content button[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* [disabled]
|
||||
*/
|
||||
|
||||
::content a[disabled],
|
||||
::content button[disabled] {
|
||||
pointer-events: none;
|
||||
color: var(--header-disabled-button-color);
|
||||
}
|
||||
|
||||
/** Icon Buttons
|
||||
---------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Icons are a different color to text
|
||||
*/
|
||||
|
||||
::content .icon,
|
||||
::content [data-icon] {
|
||||
color:
|
||||
var(--header-icon-color,
|
||||
var(--gaia-header-button-color));
|
||||
}
|
||||
|
||||
/**
|
||||
* If users want their action button
|
||||
* to be in the component's light-dom
|
||||
* they can add an .action class
|
||||
* to make it look like the
|
||||
* shadow action button.
|
||||
*/
|
||||
|
||||
::content .action {
|
||||
color:
|
||||
var(--header-action-button-color,
|
||||
var(--header-icon-color,
|
||||
var(--gaia-header-button-color)));
|
||||
}
|
||||
|
||||
/**
|
||||
* [data-icon]:empty
|
||||
*
|
||||
* Icon buttons with no textContent,
|
||||
* should always be 50px.
|
||||
*
|
||||
* This is to prevent buttons being
|
||||
* larger than they should be before
|
||||
* icon-font has loaded.
|
||||
*/
|
||||
|
||||
::content [data-icon]:empty {
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
</style>`,nextTick:nextTick});function contributesToLayout(el){return el.localName!=='style'&&!el.hasAttribute('l10n-action');}
|
||||
function setStyleId(el,id){el._styleId=id;}
|
||||
function getStyleId(el){return el._styleId;}
|
||||
function nextTick(fn){var cleared;Promise.resolve().then(()=>{if(!cleared){fn();}});return{clear:function(){cleared=true;}};}});})(typeof define=='function'&&define.amd?define:(function(n,w){'use strict';return typeof module=='object'?function(c){c(require,exports,module);}:function(c){var m={exports:{}};c(function(n){return w[n];},m.exports,m);w[n]=m.exports;};})('gaia-header',this));},{"font-fit":1,"gaia-component":2,"gaia-icons":3}]},{},[4])(4)});;'use strict';(function(exports){var pref='identity.fxaccounts.reset-password.url';var fxaSettingsHelper=SettingsHelper(pref);var fxaURL;fxaSettingsHelper.get(function on_fxa_get_settings(url){fxaURL=url;});function _setAccountDetails(response){if(response&&response.user&&response.user.email){FxaModuleManager.setParam('done',true);FxaModuleManager.setParam('verified',response.user.verified);}}
|
||||
function _ensureFxaClient(callback){window.parent.LazyLoader.load('../js/fx_accounts_client.js',function(){callback&&callback();});}
|
||||
var FxModuleServerRequest={checkEmail:function fxmsr_checkEmail(email,onsuccess,onerror){_ensureFxaClient(function(){window.parent.FxAccountsClient.queryAccount(email,onsuccess,onerror);});},signIn:function fxmsr_signIn(email,password,onsuccess,onerror){function successHandler(response){_setAccountDetails(response);var authenticated=(response&&response.user&&response.user.verified)||false;onsuccess&&onsuccess({authenticated:authenticated});}
|
||||
function errorHandler(response){onerror&&onerror(response);}
|
||||
_ensureFxaClient(function signIn(){window.parent.FxAccountsClient.signIn(email,password,successHandler,errorHandler);});},signUp:function fxmsr_signUp(email,password,onsuccess,onerror){function successHandler(response){_setAccountDetails(response);onsuccess&&onsuccess(response);}
|
||||
_ensureFxaClient(function signUp(){window.parent.FxAccountsClient.signUp(email,password,successHandler,onerror);});},requestPasswordReset:function fxmsr_requestPasswordReset(email,onsuccess,onerror){var url=email?fxaURL+'?email='+email:fxaURL;var activity=new MozActivity({name:'view',data:{type:'url',url:url}});activity.onsuccess=function on_reset_success(){onsuccess&&onsuccess();FxaModuleManager.close('DIALOG_CLOSED_BY_USER');};activity.onerror=function on_reset_error(err){console.error(err);onerror&&onerror(err);};}};exports.FxModuleServerRequest=FxModuleServerRequest;}(window));;'use strict';var FxaModuleOverlay={init:function fxam_overlay_init(){if(this.initialized){return;}
|
||||
HtmlHelper.importElements(this,'fxa-overlay','fxa-overlay-msg');this.initialized=true;},show:function fxam_overlay_show(l10nId){this.init();this.fxaOverlayMsg.setAttribute('data-l10n-id',l10nId);this.fxaOverlay.classList.add('show');},hide:function fxam_overlay_hide(){this.init();this.fxaOverlay.classList.remove('show');}};;'use strict';var FxaModuleErrorOverlay={init:function fxam_error_overlay_init(){if(this.initialized){return;}
|
||||
HtmlHelper.importElements(this,'fxa-error-overlay','fxa-error-title','fxa-error-msg','fxa-error-msg-coppa','fxa-error-ok');this.fxaErrorOk.addEventListener('click',this.hide.bind(this));this.fxaErrorOverlay.addEventListener('submit',this.prevent);this.initialized=true;},show:function fxam_error_overlay_show(titleL10n,messageL10n,resp){this.init();this.fxaErrorTitle.setAttribute('data-l10n-id',titleL10n);if(resp&&resp.error==='COPPA_ERROR'){this.fxaErrorMsg.style.display='none';this.fxaErrorMsgCoppa.style.display='inline';this.fxaErrorMsgCoppa.setAttribute('data-l10n-id',messageL10n);}else{this.fxaErrorMsg.style.display='inline';this.fxaErrorMsgCoppa.style.display='none';this.fxaErrorMsg.setAttribute('data-l10n-id',messageL10n);}
|
||||
this.fxaErrorOverlay.classList.add('show');},hide:function fxam_overlay_hide(){this.init();this.fxaErrorOverlay.classList.remove('show');},prevent:function fxam_prevent(event){event.preventDefault();event.stopPropagation();}};;'use strict';var FxaModuleNavigation={stepCount:0,currentModule:null,init:function fxam_nav_init(flow){window.addEventListener('hashchange',this.hashchangeHandler.bind(this),false);LazyLoader.load('view/view_'+flow+'.js',function loaded(){FxaModuleUI.setMaxSteps(View.length);window.location.hash=View.start.id;}.bind(this));},hashchangeHandler:function fxam_nav_hashchangeHandler(){if(!location.hash){return;}
|
||||
var panel=document.querySelector(location.hash);if(!panel||!panel.classList.contains('screen')){return;}
|
||||
if(this.backAnim){this.stepCount--;this.loadStep(panel,true);}else{this.stepCount++;this.loadStep(panel);}},loadStep:function fxam_nav_loadStep(panel,back){if(!panel){return;}
|
||||
FxaModuleUI.loadScreen({panel:panel,count:this.stepCount,back:this.backAnim,onload:function(){this.currentModule=window[this.moduleById(panel.id)];this.currentModule.init&&this.currentModule.init(FxaModuleManager.paramsRetrieved);}.bind(this),onanimate:function(){this.backAnim=false;this.updatingStep=false;}.bind(this)});},back:function fxam_nav_back(){if(this.updatingStep){return;}
|
||||
this.updatingStep=true;this.currentModule.onBack&&this.currentModule.onBack();this.backAnim=true;window.history.back();},loadNextStep:function fxam_loadNextStep(nextStep){if(!nextStep||!nextStep.id){return;}
|
||||
location.hash=nextStep.id;},next:function fxam_nav_next(){this.currentModule.onNext(this.loadNextStep.bind(this));},moduleById:function fxam_nav_moduleById(id){var moduleKey=Object.keys(FxaModuleStates).filter(function(module){return FxaModuleStates[module]&&FxaModuleStates[module].id&&FxaModuleStates[module].id===id;}).pop();if(moduleKey){return FxaModuleStates[moduleKey].module;}},done:function fxam_nav_done(){this.currentModule.onDone(FxaModuleManager.done);}};;'use strict';const OFFLINE_TIMEOUT=30*1000;var FxaModuleUI={maxSteps:null,init:function(flow){HtmlHelper.importElements(this,'fxa-module-header','fxa-module-back','fxa-module-next','fxa-module-navigation','fxa-module-done','fxa-progress');this.fxaModuleHeader.addEventListener('action',function(){FxaModuleManager.close('DIALOG_CLOSED_BY_USER');});this.fxaModuleBack.addEventListener('mousedown',function(){FxaModuleNavigation.back();});this.fxaModuleNext.addEventListener('mousedown',function(){FxaModuleNavigation.next();});this.fxaModuleDone.addEventListener('click',function(){FxaModuleNavigation.done();});var offlineTimer;window.addEventListener('online',function onOnline(evt){clearTimeout(offlineTimer);FxaModule.hideErrorResponse();});window.addEventListener('offline',function onOffline(evt){if(offlineTimer){return;}
|
||||
offlineTimer=setTimeout(function onOfflineTimeout(){return FxaModule.showErrorResponse({error:'OFFLINE'});},OFFLINE_TIMEOUT);});FxaModuleNavigation.init(flow);},setMaxSteps:function(num){this.maxSteps=num;},increaseMaxStepsBy:function(inc){this.maxSteps=this.maxSteps+inc;},decreaseMaxStepsBy:function(dec){this.maxSteps=this.maxSteps-dec;},loadScreen:function(params){var currentScreen=document.querySelector('.current');var nextScreen=params.panel;this.fxaProgress.style.width=(100/this.maxSteps)+'%';LazyLoader.load(nextScreen,function(){var scripts=[].slice.call(nextScreen.querySelectorAll('script')).map(function(script){return script.getAttribute('src');});LazyLoader.load(scripts,function(){if(params.count>1&¶ms.count<this.maxSteps){this.fxaModuleNavigation.classList.remove('navigation-single-button');this.fxaModuleNavigation.classList.remove('navigation-back-only');if(nextScreen.getAttribute('data-navigation')==='back'){this.fxaModuleNavigation.classList.add('navigation-back-only');}}else{this.fxaModuleNavigation.classList.add('navigation-single-button');if(params.count===this.maxSteps){this.fxaModuleNavigation.classList.add('navigation-done');}}
|
||||
this.setProgressBar(params.count);navigator.mozL10n.once(function(){params.onload&¶ms.onload();if(nextScreen){this._animate(currentScreen,nextScreen,params.back,params.onanimate);}}.bind(this));}.bind(this));}.bind(this));},_animate:function(from,to,back,callback){if(!to){return;}
|
||||
if(!from){to.classList.add('current');return;}
|
||||
if(this._inTransition(from)||this._inTransition(to)){return;}
|
||||
from.addEventListener('animationend',function fromAnimEnd(){from.removeEventListener('animationend',fromAnimEnd,false);from.classList.remove(back?'currentToNext':'currentToPrev');from.classList.remove('current');from.classList.remove('back');},false);to.addEventListener('animationend',function toAnimEnd(){to.removeEventListener('animationend',toAnimEnd,false);to.classList.remove(back?'prevToCurrent':'nextToCurrent');to.classList.add('current');callback&&callback();},false);from.classList.add(back?'currentToNext':'currentToPrev');to.classList.add(back?'prevToCurrent':'nextToCurrent');},_inTransition:function(elem){return elem.classList.contains('currentToNext')||elem.classList.contains('currentToPrev')||elem.classList.contains('nextToCurrent')||elem.classList.contains('prevToCurrent')||false;},setProgressBar:function(value){this.fxaProgress.value=100*value/this.maxSteps;this.fxaProgress.style.transform='translateX('+100*(value-1)+'%)';},setNextText:function(l10n){this.fxaModuleNext.textContent=l10n;},disableNextButton:function(){this.fxaModuleNext.setAttribute('disabled','disabled');},enableNextButton:function(){this.fxaModuleNext.removeAttribute('disabled');},disableDoneButton:function(){this.fxaModuleDone.setAttribute('disabled','disabled');},enableDoneButton:function(){this.fxaModuleDone.removeAttribute('disabled');}};;'use strict';var FxaModuleManager={paramsRetrieved:null,init:function fxamm_init(){var hash=window.location.hash.split('?');var flow=hash[0].replace('#','');if(hash.length>1){var queryParams=hash[1].split('&');for(var i=0;i<queryParams.length;i++){var param=queryParams[i].split('=');if(param.length!=2){console.warning('Wrong query parameter');continue;}
|
||||
this.setParam(param[0],param[1]);}}
|
||||
FxaModuleUI.init(flow);},setParam:function fxamm_setParam(key,value){if(!this.paramsRetrieved){this.paramsRetrieved={};}
|
||||
this.paramsRetrieved[key]=value;},done:function fxamm_done(){window.parent.FxAccountsUI.done(FxaModuleManager.paramsRetrieved);},close:function fxamm_close(error){if(!this.paramsRetrieved||!this.paramsRetrieved.done){window.parent.FxAccountsUI.error(error);return;}
|
||||
window.parent.FxAccountsUI.done(this.paramsRetrieved);}};window.addEventListener('load',function managerLoaded(){window.removeEventListener('load',managerLoaded);FxaModuleManager.init();});;'use strict';var FxaModuleStates=(function(){return{ENTER_EMAIL:{id:'fxa-email',module:'FxaModuleEnterEmail'},SET_PASSWORD:{id:'fxa-set-password',module:'FxaModuleSetPassword'},ENTER_PASSWORD:{id:'fxa-enter-password',module:'FxaModuleEnterPassword'},SIGNUP_SUCCESS:{id:'fxa-signup-success',module:'FxaModuleSignupSuccess'},SIGNIN_SUCCESS:{id:'fxa-signin-success',module:'FxaModuleSigninSuccess'},REFRESH_AUTH:{id:'fxa-refresh-auth',module:'FxaModuleRefreshAuth'},COPPA:{id:'fxa-coppa',module:'FxaModuleCoppa'},TOS:{id:'fxa-tos'},PP:{id:'fxa-pp'},DONE:null,back:function(){FxaModuleNavigation.back();},setState:function setState(state){if(!(state in this)||typeof state==='function'){return;}
|
||||
document.location.hash=state.id;}};}());;'use strict';var FxaModule=(function(){var Module={initialized:false,init:function fxam_init(){},onNext:function fxam_onNext(gotoNextStepCallback){},onBack:function fxam_onBack(){},onDone:function fxam_onDone(doneCallback){doneCallback();},importElements:function fxam_importElements(){var args=[].slice.call(arguments);args.unshift(this);HtmlHelper.importElements.apply(null,args);},showErrorResponse:function fxam_showErrorResponse(response){var resp=response;if(window.location.search.indexOf('isftu')!=-1&&resp=='OFFLINE_ERROR'){resp='CONNECTION_ERROR';}
|
||||
FxaModuleOverlay.hide();LazyLoader.load('js/fxam_errors.js',()=>{var config=FxaModuleErrors.responseToParams(resp);FxaModuleErrorOverlay.show(config.title,config.message,resp);if(resp&&resp.error==='COPPA_ERROR'){var link=FxaModuleErrorOverlay.fxaErrorMsgCoppa.querySelector('#coppa-link');link.addEventListener('click',this.onCopaLinkClick);}});},onCopaLinkClick:function(e){e.preventDefault();if(this.entrySheet){this.entrySheet.close();this.entrySheet=null;}
|
||||
var coppaUrl='http://www.ftc.gov/news-events/media-resources/'+'protecting-consumer-privacy/kids-privacy-coppa';this.entrySheet=new EntrySheet(window.top.document.getElementById('screen'),'URL:'+coppaUrl,new BrowserFrame({url:coppaUrl,oop:true}));this.entrySheet.open();},hideErrorResponse:function fxam_hideErrorResponse(){var link=FxaModuleErrorOverlay.fxaErrorMsgCoppa.querySelector('#coppa-link');link.removeEventListener('click',this.onCopaLinkClick);FxaModuleErrorOverlay.hide();FxaModuleOverlay.hide();}};return Module;}());
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
;'use strict';var FxaModuleErrorOverlay={init:function fxam_error_overlay_init(){if(this.initialized){return;}
|
||||
HtmlHelper.importElements(this,'fxa-error-overlay','fxa-error-title','fxa-error-msg','fxa-error-msg-coppa','fxa-error-ok');this.fxaErrorOk.addEventListener('click',this.hide.bind(this));this.fxaErrorOverlay.addEventListener('submit',this.prevent);this.initialized=true;},show:function fxam_error_overlay_show(titleL10n,messageL10n,resp){this.init();this.fxaErrorTitle.setAttribute('data-l10n-id',titleL10n);if(resp&&resp.error==='COPPA_ERROR'){this.fxaErrorMsg.style.display='none';this.fxaErrorMsgCoppa.style.display='inline';this.fxaErrorMsgCoppa.setAttribute('data-l10n-id',messageL10n);}else{this.fxaErrorMsg.style.display='inline';this.fxaErrorMsgCoppa.style.display='none';this.fxaErrorMsg.setAttribute('data-l10n-id',messageL10n);}
|
||||
this.fxaErrorOverlay.classList.add('show');},hide:function fxam_overlay_hide(){this.init();this.fxaErrorOverlay.classList.remove('show');},prevent:function fxam_prevent(event){event.preventDefault();event.stopPropagation();}};
|
||||
58
assets/webapps/system.gaiamobile.org/fxa/js/fxam_errors.js
Normal file
58
assets/webapps/system.gaiamobile.org/fxa/js/fxam_errors.js
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
|
||||
'use strict';
|
||||
|
||||
(function(exports) {
|
||||
var Errors = {
|
||||
CONNECTION_ERROR: {
|
||||
title: 'fxa-connection-error-title',
|
||||
message: 'fxa-connection-error-message'
|
||||
},
|
||||
RESET_PASSWORD_ERROR: {
|
||||
title: 'fxa-reset-password-error-title',
|
||||
message: 'fxa-reset-password-error-message'
|
||||
},
|
||||
INVALID_EMAIL: {
|
||||
title: 'fxa-invalid-email-title',
|
||||
message: 'fxa-invalid-email-message'
|
||||
},
|
||||
INVALID_PASSWORD: {
|
||||
title: 'fxa-invalid-password-title',
|
||||
message: 'fxa-invalid-password-message'
|
||||
},
|
||||
COPPA_ERROR: {
|
||||
title: 'fxa-coppa-failure-error-title',
|
||||
message: 'fxa-coppa-failure-error-message3'
|
||||
},
|
||||
COPPA_FTU_ERROR: {
|
||||
title: 'fxa-coppa-failure-error-title',
|
||||
message: 'fxa-coppa-ftu-error-message'
|
||||
},
|
||||
OFFLINE: {
|
||||
title: 'fxa-offline-error-title',
|
||||
message: 'fxa-offline-error-message'
|
||||
},
|
||||
UNKNOWN: {
|
||||
title: 'fxa-unknown-error-title',
|
||||
message: 'fxa-unknown-error-message'
|
||||
}
|
||||
};
|
||||
|
||||
function _getError(error) {
|
||||
var l10nKeys = Errors[error] || Errors.UNKNOWN;
|
||||
return {
|
||||
title: l10nKeys.title,
|
||||
message: l10nKeys.message
|
||||
};
|
||||
}
|
||||
|
||||
var FxaModuleErrors = {
|
||||
responseToParams: function fxame_responseToParams(response) {
|
||||
return response && response.error ?
|
||||
_getError(response.error) : _getError('GENERIC_ERROR');
|
||||
}
|
||||
};
|
||||
|
||||
exports.FxaModuleErrors = FxaModuleErrors;
|
||||
}(window));
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
;'use strict';var FxaModuleManager={paramsRetrieved:null,init:function fxamm_init(){var hash=window.location.hash.split('?');var flow=hash[0].replace('#','');if(hash.length>1){var queryParams=hash[1].split('&');for(var i=0;i<queryParams.length;i++){var param=queryParams[i].split('=');if(param.length!=2){console.warning('Wrong query parameter');continue;}
|
||||
this.setParam(param[0],param[1]);}}
|
||||
FxaModuleUI.init(flow);},setParam:function fxamm_setParam(key,value){if(!this.paramsRetrieved){this.paramsRetrieved={};}
|
||||
this.paramsRetrieved[key]=value;},done:function fxamm_done(){window.parent.FxAccountsUI.done(FxaModuleManager.paramsRetrieved);},close:function fxamm_close(error){if(!this.paramsRetrieved||!this.paramsRetrieved.done){window.parent.FxAccountsUI.error(error);return;}
|
||||
window.parent.FxAccountsUI.done(this.paramsRetrieved);}};window.addEventListener('load',function managerLoaded(){window.removeEventListener('load',managerLoaded);FxaModuleManager.init();});
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
;'use strict';var FxaModule=(function(){var Module={initialized:false,init:function fxam_init(){},onNext:function fxam_onNext(gotoNextStepCallback){},onBack:function fxam_onBack(){},onDone:function fxam_onDone(doneCallback){doneCallback();},importElements:function fxam_importElements(){var args=[].slice.call(arguments);args.unshift(this);HtmlHelper.importElements.apply(null,args);},showErrorResponse:function fxam_showErrorResponse(response){var resp=response;if(window.location.search.indexOf('isftu')!=-1&&resp=='OFFLINE_ERROR'){resp='CONNECTION_ERROR';}
|
||||
FxaModuleOverlay.hide();LazyLoader.load('js/fxam_errors.js',()=>{var config=FxaModuleErrors.responseToParams(resp);FxaModuleErrorOverlay.show(config.title,config.message,resp);if(resp&&resp.error==='COPPA_ERROR'){var link=FxaModuleErrorOverlay.fxaErrorMsgCoppa.querySelector('#coppa-link');link.addEventListener('click',this.onCopaLinkClick);}});},onCopaLinkClick:function(e){e.preventDefault();if(this.entrySheet){this.entrySheet.close();this.entrySheet=null;}
|
||||
var coppaUrl='http://www.ftc.gov/news-events/media-resources/'+'protecting-consumer-privacy/kids-privacy-coppa';this.entrySheet=new EntrySheet(window.top.document.getElementById('screen'),'URL:'+coppaUrl,new BrowserFrame({url:coppaUrl,oop:true}));this.entrySheet.open();},hideErrorResponse:function fxam_hideErrorResponse(){var link=FxaModuleErrorOverlay.fxaErrorMsgCoppa.querySelector('#coppa-link');link.removeEventListener('click',this.onCopaLinkClick);FxaModuleErrorOverlay.hide();FxaModuleOverlay.hide();}};return Module;}());
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
;'use strict';var FxaModuleNavigation={stepCount:0,currentModule:null,init:function fxam_nav_init(flow){window.addEventListener('hashchange',this.hashchangeHandler.bind(this),false);LazyLoader.load('view/view_'+flow+'.js',function loaded(){FxaModuleUI.setMaxSteps(View.length);window.location.hash=View.start.id;}.bind(this));},hashchangeHandler:function fxam_nav_hashchangeHandler(){if(!location.hash){return;}
|
||||
var panel=document.querySelector(location.hash);if(!panel||!panel.classList.contains('screen')){return;}
|
||||
if(this.backAnim){this.stepCount--;this.loadStep(panel,true);}else{this.stepCount++;this.loadStep(panel);}},loadStep:function fxam_nav_loadStep(panel,back){if(!panel){return;}
|
||||
FxaModuleUI.loadScreen({panel:panel,count:this.stepCount,back:this.backAnim,onload:function(){this.currentModule=window[this.moduleById(panel.id)];this.currentModule.init&&this.currentModule.init(FxaModuleManager.paramsRetrieved);}.bind(this),onanimate:function(){this.backAnim=false;this.updatingStep=false;}.bind(this)});},back:function fxam_nav_back(){if(this.updatingStep){return;}
|
||||
this.updatingStep=true;this.currentModule.onBack&&this.currentModule.onBack();this.backAnim=true;window.history.back();},loadNextStep:function fxam_loadNextStep(nextStep){if(!nextStep||!nextStep.id){return;}
|
||||
location.hash=nextStep.id;},next:function fxam_nav_next(){this.currentModule.onNext(this.loadNextStep.bind(this));},moduleById:function fxam_nav_moduleById(id){var moduleKey=Object.keys(FxaModuleStates).filter(function(module){return FxaModuleStates[module]&&FxaModuleStates[module].id&&FxaModuleStates[module].id===id;}).pop();if(moduleKey){return FxaModuleStates[moduleKey].module;}},done:function fxam_nav_done(){this.currentModule.onDone(FxaModuleManager.done);}};
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
;'use strict';var FxaModuleOverlay={init:function fxam_overlay_init(){if(this.initialized){return;}
|
||||
HtmlHelper.importElements(this,'fxa-overlay','fxa-overlay-msg');this.initialized=true;},show:function fxam_overlay_show(l10nId){this.init();this.fxaOverlayMsg.setAttribute('data-l10n-id',l10nId);this.fxaOverlay.classList.add('show');},hide:function fxam_overlay_hide(){this.init();this.fxaOverlay.classList.remove('show');}};
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
;'use strict';(function(exports){var pref='identity.fxaccounts.reset-password.url';var fxaSettingsHelper=SettingsHelper(pref);var fxaURL;fxaSettingsHelper.get(function on_fxa_get_settings(url){fxaURL=url;});function _setAccountDetails(response){if(response&&response.user&&response.user.email){FxaModuleManager.setParam('done',true);FxaModuleManager.setParam('verified',response.user.verified);}}
|
||||
function _ensureFxaClient(callback){window.parent.LazyLoader.load('../js/fx_accounts_client.js',function(){callback&&callback();});}
|
||||
var FxModuleServerRequest={checkEmail:function fxmsr_checkEmail(email,onsuccess,onerror){_ensureFxaClient(function(){window.parent.FxAccountsClient.queryAccount(email,onsuccess,onerror);});},signIn:function fxmsr_signIn(email,password,onsuccess,onerror){function successHandler(response){_setAccountDetails(response);var authenticated=(response&&response.user&&response.user.verified)||false;onsuccess&&onsuccess({authenticated:authenticated});}
|
||||
function errorHandler(response){onerror&&onerror(response);}
|
||||
_ensureFxaClient(function signIn(){window.parent.FxAccountsClient.signIn(email,password,successHandler,errorHandler);});},signUp:function fxmsr_signUp(email,password,onsuccess,onerror){function successHandler(response){_setAccountDetails(response);onsuccess&&onsuccess(response);}
|
||||
_ensureFxaClient(function signUp(){window.parent.FxAccountsClient.signUp(email,password,successHandler,onerror);});},requestPasswordReset:function fxmsr_requestPasswordReset(email,onsuccess,onerror){var url=email?fxaURL+'?email='+email:fxaURL;var activity=new MozActivity({name:'view',data:{type:'url',url:url}});activity.onsuccess=function on_reset_success(){onsuccess&&onsuccess();FxaModuleManager.close('DIALOG_CLOSED_BY_USER');};activity.onerror=function on_reset_error(err){console.error(err);onerror&&onerror(err);};}};exports.FxModuleServerRequest=FxModuleServerRequest;}(window));
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
;'use strict';var FxaModuleStates=(function(){return{ENTER_EMAIL:{id:'fxa-email',module:'FxaModuleEnterEmail'},SET_PASSWORD:{id:'fxa-set-password',module:'FxaModuleSetPassword'},ENTER_PASSWORD:{id:'fxa-enter-password',module:'FxaModuleEnterPassword'},SIGNUP_SUCCESS:{id:'fxa-signup-success',module:'FxaModuleSignupSuccess'},SIGNIN_SUCCESS:{id:'fxa-signin-success',module:'FxaModuleSigninSuccess'},REFRESH_AUTH:{id:'fxa-refresh-auth',module:'FxaModuleRefreshAuth'},COPPA:{id:'fxa-coppa',module:'FxaModuleCoppa'},TOS:{id:'fxa-tos'},PP:{id:'fxa-pp'},DONE:null,back:function(){FxaModuleNavigation.back();},setState:function setState(state){if(!(state in this)||typeof state==='function'){return;}
|
||||
document.location.hash=state.id;}};}());
|
||||
6
assets/webapps/system.gaiamobile.org/fxa/js/fxam_ui.js
Normal file
6
assets/webapps/system.gaiamobile.org/fxa/js/fxam_ui.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
;'use strict';const OFFLINE_TIMEOUT=30*1000;var FxaModuleUI={maxSteps:null,init:function(flow){HtmlHelper.importElements(this,'fxa-module-header','fxa-module-back','fxa-module-next','fxa-module-navigation','fxa-module-done','fxa-progress');this.fxaModuleHeader.addEventListener('action',function(){FxaModuleManager.close('DIALOG_CLOSED_BY_USER');});this.fxaModuleBack.addEventListener('mousedown',function(){FxaModuleNavigation.back();});this.fxaModuleNext.addEventListener('mousedown',function(){FxaModuleNavigation.next();});this.fxaModuleDone.addEventListener('click',function(){FxaModuleNavigation.done();});var offlineTimer;window.addEventListener('online',function onOnline(evt){clearTimeout(offlineTimer);FxaModule.hideErrorResponse();});window.addEventListener('offline',function onOffline(evt){if(offlineTimer){return;}
|
||||
offlineTimer=setTimeout(function onOfflineTimeout(){return FxaModule.showErrorResponse({error:'OFFLINE'});},OFFLINE_TIMEOUT);});FxaModuleNavigation.init(flow);},setMaxSteps:function(num){this.maxSteps=num;},increaseMaxStepsBy:function(inc){this.maxSteps=this.maxSteps+inc;},decreaseMaxStepsBy:function(dec){this.maxSteps=this.maxSteps-dec;},loadScreen:function(params){var currentScreen=document.querySelector('.current');var nextScreen=params.panel;this.fxaProgress.style.width=(100/this.maxSteps)+'%';LazyLoader.load(nextScreen,function(){var scripts=[].slice.call(nextScreen.querySelectorAll('script')).map(function(script){return script.getAttribute('src');});LazyLoader.load(scripts,function(){if(params.count>1&¶ms.count<this.maxSteps){this.fxaModuleNavigation.classList.remove('navigation-single-button');this.fxaModuleNavigation.classList.remove('navigation-back-only');if(nextScreen.getAttribute('data-navigation')==='back'){this.fxaModuleNavigation.classList.add('navigation-back-only');}}else{this.fxaModuleNavigation.classList.add('navigation-single-button');if(params.count===this.maxSteps){this.fxaModuleNavigation.classList.add('navigation-done');}}
|
||||
this.setProgressBar(params.count);navigator.mozL10n.once(function(){params.onload&¶ms.onload();if(nextScreen){this._animate(currentScreen,nextScreen,params.back,params.onanimate);}}.bind(this));}.bind(this));}.bind(this));},_animate:function(from,to,back,callback){if(!to){return;}
|
||||
if(!from){to.classList.add('current');return;}
|
||||
if(this._inTransition(from)||this._inTransition(to)){return;}
|
||||
from.addEventListener('animationend',function fromAnimEnd(){from.removeEventListener('animationend',fromAnimEnd,false);from.classList.remove(back?'currentToNext':'currentToPrev');from.classList.remove('current');from.classList.remove('back');},false);to.addEventListener('animationend',function toAnimEnd(){to.removeEventListener('animationend',toAnimEnd,false);to.classList.remove(back?'prevToCurrent':'nextToCurrent');to.classList.add('current');callback&&callback();},false);from.classList.add(back?'currentToNext':'currentToPrev');to.classList.add(back?'prevToCurrent':'nextToCurrent');},_inTransition:function(elem){return elem.classList.contains('currentToNext')||elem.classList.contains('currentToPrev')||elem.classList.contains('nextToCurrent')||elem.classList.contains('prevToCurrent')||false;},setProgressBar:function(value){this.fxaProgress.value=100*value/this.maxSteps;this.fxaProgress.style.transform='translateX('+100*(value-1)+'%)';},setNextText:function(l10n){this.fxaModuleNext.textContent=l10n;},disableNextButton:function(){this.fxaModuleNext.setAttribute('disabled','disabled');},enableNextButton:function(){this.fxaModuleNext.removeAttribute('disabled');},disableDoneButton:function(){this.fxaModuleDone.setAttribute('disabled','disabled');},enableDoneButton:function(){this.fxaModuleDone.removeAttribute('disabled');}};
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* This module allow the user to select her age from a date picker and checks
|
||||
* that she is old enough to create a Firefox account. Otherwise, it shows an
|
||||
* error.
|
||||
*/
|
||||
|
||||
/* global FxaModuleUI, FxaModule, FxaModuleStates, FxaModuleNavigation */
|
||||
/* exported FxaModuleCoppa */
|
||||
|
||||
var FxaModuleCoppa = (function() {
|
||||
|
||||
var MINIMUM_AGE = 13;
|
||||
|
||||
function _populateSelect(select) {
|
||||
var currentYear = new Date().getFullYear();
|
||||
var start = currentYear - MINIMUM_AGE;
|
||||
for (var year = start; year <= currentYear; year++) {
|
||||
var option = document.createElement('option');
|
||||
option.value= year;
|
||||
if (year == start) {
|
||||
option.setAttribute('data-l10n-id', 'fxa-age-earlier');
|
||||
option.setAttribute('data-l10n-args', '{ "year": "' + year + '" }');
|
||||
} else {
|
||||
option.textContent = year;
|
||||
}
|
||||
select.appendChild(option);
|
||||
}
|
||||
}
|
||||
|
||||
function _enableNext(age) {
|
||||
if (age === '0') {
|
||||
FxaModuleUI.disableNextButton();
|
||||
return;
|
||||
}
|
||||
FxaModuleUI.enableNextButton();
|
||||
}
|
||||
|
||||
var Module = Object.create(FxaModule);
|
||||
Module.init = function init(options) {
|
||||
this.importElements('fxa-age-select');
|
||||
|
||||
this.isFTU = !!(options && options.isftu);
|
||||
|
||||
// Initially we only have one value ("Year of birth") in the age
|
||||
// selection element.
|
||||
if (this.fxaAgeSelect.length == 1) {
|
||||
_populateSelect(this.fxaAgeSelect);
|
||||
}
|
||||
|
||||
_enableNext(this.fxaAgeSelect.value);
|
||||
|
||||
// If COPPA is part of the sign up flow, then we need to add a step to the
|
||||
// progress bar. Don't increment if the user is moving backwards, though.
|
||||
if (!FxaModuleNavigation.backAnim) {
|
||||
FxaModuleUI.increaseMaxStepsBy(1);
|
||||
}
|
||||
|
||||
if (this.initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.fxaAgeSelect.addEventListener('change', () => {
|
||||
_enableNext(this.fxaAgeSelect.value);
|
||||
});
|
||||
|
||||
this.initialized = true;
|
||||
};
|
||||
|
||||
Module.onNext = function onNext(gotoNextStepCallback) {
|
||||
if (new Date().getFullYear() - this.fxaAgeSelect.value < MINIMUM_AGE) {
|
||||
this.showErrorResponse({
|
||||
error: this.isFTU ? 'COPPA_FTU_ERROR' : 'COPPA_ERROR'
|
||||
});
|
||||
return;
|
||||
}
|
||||
gotoNextStepCallback(FxaModuleStates.SET_PASSWORD);
|
||||
};
|
||||
|
||||
Module.onBack = function onBack() {
|
||||
FxaModuleUI.decreaseMaxStepsBy(1);
|
||||
};
|
||||
|
||||
return Module;
|
||||
})();
|
||||
|
|
@ -0,0 +1,193 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
|
||||
/* global FxaModuleStates, FxaModuleUI, FxaModule, FxaModuleNavigation,
|
||||
FxModuleServerRequest, FxaModuleOverlay, FxaModuleManager, EntrySheet,
|
||||
BrowserFrame */
|
||||
/* exported FxaModuleEnterEmail */
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* This module checks the validity of an email address, and if valid,
|
||||
* determines which screen to go next.
|
||||
*/
|
||||
|
||||
var FxaModuleEnterEmail = (function() {
|
||||
|
||||
function _isEmailValid(emailEl) {
|
||||
return emailEl && emailEl.value && emailEl.validity.valid;
|
||||
}
|
||||
|
||||
function _loadSignIn(done) {
|
||||
done(FxaModuleStates.ENTER_PASSWORD);
|
||||
}
|
||||
|
||||
function _loadSignUp(done) {
|
||||
done(FxaModuleStates.SET_PASSWORD);
|
||||
}
|
||||
|
||||
function _loadCoppa(done) {
|
||||
done(FxaModuleStates.COPPA);
|
||||
}
|
||||
|
||||
function _enableNext(emailEl) {
|
||||
if (_isEmailValid(emailEl)) {
|
||||
FxaModuleUI.enableNextButton();
|
||||
} else {
|
||||
FxaModuleUI.disableNextButton();
|
||||
}
|
||||
}
|
||||
|
||||
var Module = Object.create(FxaModule);
|
||||
Module.init = function init(options) {
|
||||
// Cache static HTML elements
|
||||
this.importElements(
|
||||
'fxa-email-input',
|
||||
'fxa-logo',
|
||||
'fxa-notice'
|
||||
);
|
||||
|
||||
// Blocks the navigation until check the condition
|
||||
_enableNext(this.fxaEmailInput);
|
||||
|
||||
if (this.initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.fxaPrivacy = document.getElementById('fxa-privacy');
|
||||
this.fxaPrivacy.setAttribute('data-l10n-id', 'fxa-pn');
|
||||
this.fxaTerms = document.getElementById('fxa-terms');
|
||||
this.fxaTerms.setAttribute('data-l10n-id', 'fxa-tos');
|
||||
|
||||
this.isFTU = !!(options && options.isftu);
|
||||
|
||||
// Add listeners
|
||||
this.fxaEmailInput.addEventListener(
|
||||
'input',
|
||||
function onInput(event) {
|
||||
_enableNext(event.target);
|
||||
}
|
||||
);
|
||||
this.fxaEmailInput.addEventListener(
|
||||
'focus',
|
||||
function onFocus() {
|
||||
this.fxaLogo.setAttribute('hidden', true);
|
||||
}.bind(this)
|
||||
);
|
||||
this.fxaEmailInput.addEventListener(
|
||||
'blur',
|
||||
function onBlur() {
|
||||
this.fxaLogo.removeAttribute('hidden');
|
||||
}.bind(this)
|
||||
);
|
||||
|
||||
this.fxaTerms.addEventListener('click', onExternalLinkClick.bind(this));
|
||||
this.fxaPrivacy.addEventListener('click', onExternalLinkClick.bind(this));
|
||||
|
||||
function onExternalLinkClick(e) {
|
||||
/*jshint validthis:true */
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
if (!navigator.onLine) {
|
||||
return this.showErrorResponse({error: 'OFFLINE'});
|
||||
}
|
||||
var url = e.target.href;
|
||||
if (this.entrySheet) {
|
||||
this.entrySheet.close();
|
||||
this.entrySheet = null;
|
||||
}
|
||||
this.entrySheet = new EntrySheet(
|
||||
window.top.document.getElementById('screen'),
|
||||
// Prefix url with LRM character
|
||||
// This ensures truncation occurs correctly in an RTL document
|
||||
// We can remove this when bug 1154438 is fixed.
|
||||
'\u200E' + url,
|
||||
new BrowserFrame({
|
||||
url: url,
|
||||
oop: true
|
||||
})
|
||||
);
|
||||
this.entrySheet.open();
|
||||
}
|
||||
|
||||
document.addEventListener(
|
||||
'visibilitychange',
|
||||
onVisibilityChange.bind(this)
|
||||
);
|
||||
|
||||
function onVisibilityChange() {
|
||||
/*jshint validthis:true */
|
||||
if (document.hidden) {
|
||||
document.removeEventListener('visibilitychange', onVisibilityChange);
|
||||
if (this.entrySheet) {
|
||||
this.entrySheet.close();
|
||||
this.entrySheet = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('holdhome', hideEntrySheet.bind(this));
|
||||
window.addEventListener('home', hideEntrySheet.bind(this));
|
||||
window.addEventListener('activityrequesting', hideEntrySheet.bind(this));
|
||||
|
||||
function hideEntrySheet() {
|
||||
/*jshint validthis:true */
|
||||
if (this.entrySheet) {
|
||||
this.entrySheet.close();
|
||||
this.entrySheet = null;
|
||||
}
|
||||
window.removeEventListener('holdhome', hideEntrySheet);
|
||||
window.removeEventListener('home', hideEntrySheet);
|
||||
window.removeEventListener('activityrequesting', hideEntrySheet);
|
||||
}
|
||||
|
||||
// Ensure that pressing 'ENTER' (keycode 13) we send the form
|
||||
// as expected
|
||||
this.fxaEmailInput.addEventListener(
|
||||
'keypress',
|
||||
function onKeypress(event) {
|
||||
if (_isEmailValid(this.fxaEmailInput) && event.keyCode === 13) {
|
||||
document.activeElement.blur();
|
||||
FxaModuleNavigation.next();
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
|
||||
// Avoid to add listener twice
|
||||
this.initialized = true;
|
||||
};
|
||||
|
||||
Module.onNext = function onNext(gotoNextStepCallback) {
|
||||
FxaModuleOverlay.show('fxa-connecting');
|
||||
|
||||
var email = this.fxaEmailInput.value;
|
||||
|
||||
FxModuleServerRequest.checkEmail(
|
||||
email,
|
||||
function onSuccess(response) {
|
||||
FxaModuleOverlay.hide();
|
||||
FxaModuleManager.setParam('email', email);
|
||||
if (response && response.registered) {
|
||||
_loadSignIn(gotoNextStepCallback);
|
||||
} else if (this.isFTU) {
|
||||
// XXX Skip COPPA verification during FTU: if a child has a mobile
|
||||
// device, we assume a parent/guardian has given it to them, which
|
||||
// implies parental consent. So, we skip to the next step in the
|
||||
// signup flow, the set-password screen. See also bug 1010598.
|
||||
_loadSignUp(gotoNextStepCallback);
|
||||
} else {
|
||||
_loadCoppa(gotoNextStepCallback);
|
||||
}
|
||||
}.bind(this),
|
||||
this.showErrorResponse);
|
||||
};
|
||||
|
||||
Module.onBack = function onBack() {
|
||||
FxaModuleUI.enableNextButton();
|
||||
};
|
||||
|
||||
return Module;
|
||||
|
||||
}());
|
||||
|
||||
|
|
@ -0,0 +1,166 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
|
||||
/* global FxaModuleStates, FxaModuleUI, FxaModule, FxaModuleNavigation,
|
||||
FxModuleServerRequest, FxaModuleOverlay, FxaModuleManager */
|
||||
/* exported FxaModuleEnterPassword */
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* This module checks the validity of password given email address, and if
|
||||
* valid, determine which screen to go next.
|
||||
*/
|
||||
|
||||
var FxaModuleEnterPassword = (function() {
|
||||
|
||||
function _isPasswordValid(passwordEl) {
|
||||
var passwordValue = passwordEl.value;
|
||||
return passwordValue && passwordEl.validity.valid;
|
||||
}
|
||||
|
||||
function _enableNext(passwordEl) {
|
||||
if (_isPasswordValid(passwordEl)) {
|
||||
FxaModuleUI.enableNextButton();
|
||||
} else {
|
||||
FxaModuleUI.disableNextButton();
|
||||
}
|
||||
}
|
||||
|
||||
function _cleanForm(passwordEl, passwordCheck) {
|
||||
passwordEl.value = '';
|
||||
passwordCheck.checked = false;
|
||||
passwordEl.setAttribute('type', 'password');
|
||||
}
|
||||
|
||||
function _loadSigninSuccess(done) {
|
||||
done(FxaModuleStates.SIGNIN_SUCCESS);
|
||||
}
|
||||
|
||||
function _notVerifiedUser(done) {
|
||||
done(FxaModuleStates.SIGNUP_SUCCESS);
|
||||
}
|
||||
|
||||
function _togglePasswordVisibility() {
|
||||
/*jshint validthis:true*/
|
||||
var passwordFieldType = !!this.fxaShowPw.checked ? 'text' : 'password';
|
||||
this.fxaPwInput.setAttribute('type', passwordFieldType);
|
||||
}
|
||||
|
||||
function _forgotPassword() {
|
||||
/*jshint validthis:true*/
|
||||
var self = this;
|
||||
if (this.isFTU) {
|
||||
return this.showErrorResponse({
|
||||
error: 'RESET_PASSWORD_ERROR'
|
||||
});
|
||||
}
|
||||
// Note: we don't need to pass a success callback, but we do need an errback
|
||||
FxModuleServerRequest.requestPasswordReset(
|
||||
this.email,
|
||||
null,
|
||||
function on_reset_error() {
|
||||
self.showErrorResponse({
|
||||
error: 'UNKNOWN_ERROR'
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
var Module = Object.create(FxaModule);
|
||||
Module.init = function init(options) {
|
||||
|
||||
if (!this.initialized) {
|
||||
// Cache DOM elements
|
||||
this.importElements(
|
||||
'fxa-hello-known-user',
|
||||
'fxa-pw-input',
|
||||
'fxa-show-pw',
|
||||
'fxa-forgot-password'
|
||||
);
|
||||
// Add listeners
|
||||
this.fxaPwInput.addEventListener(
|
||||
'input',
|
||||
function onInput(event) {
|
||||
_enableNext(event.target);
|
||||
}
|
||||
);
|
||||
// Ensure that pressing 'ENTER' (keycode 13) we send the form
|
||||
// as expected
|
||||
this.fxaPwInput.addEventListener(
|
||||
'keypress',
|
||||
function onKeypress(event) {
|
||||
if (_isPasswordValid(this.fxaPwInput) && event.keyCode === 13) {
|
||||
document.activeElement.blur();
|
||||
FxaModuleNavigation.next();
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
|
||||
this.fxaShowPw.addEventListener(
|
||||
'change',
|
||||
_togglePasswordVisibility.bind(this),
|
||||
false
|
||||
);
|
||||
|
||||
this.fxaForgotPassword.addEventListener(
|
||||
'click',
|
||||
_forgotPassword.bind(this),
|
||||
false
|
||||
);
|
||||
// Avoid repeated initialization
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
if (!options || !options.email) {
|
||||
console.error('Options are not sent properly. Email not available');
|
||||
return;
|
||||
}
|
||||
|
||||
this.isFTU = !!(options && options.isftu);
|
||||
this.email = options.email;
|
||||
|
||||
navigator.mozL10n.setAttributes(this.fxaHelloKnownUser, 'fxa-hello-user2', {
|
||||
email: this.email
|
||||
});
|
||||
|
||||
_cleanForm(
|
||||
this.fxaPwInput,
|
||||
this.fxaShowPw
|
||||
);
|
||||
|
||||
_enableNext(this.fxaPwInput);
|
||||
|
||||
};
|
||||
|
||||
Module.onNext = function onNext(gotoNextStepCallback) {
|
||||
FxaModuleOverlay.show('fxa-connecting');
|
||||
|
||||
FxaModuleManager.setParam('success', true);
|
||||
FxModuleServerRequest.signIn(
|
||||
this.email,
|
||||
this.fxaPwInput.value,
|
||||
function onServerResponse(response) {
|
||||
FxaModuleOverlay.hide();
|
||||
|
||||
if (!response.authenticated) {
|
||||
_notVerifiedUser(gotoNextStepCallback);
|
||||
return;
|
||||
}
|
||||
|
||||
_loadSigninSuccess(gotoNextStepCallback);
|
||||
}.bind(this),
|
||||
function onError(response) {
|
||||
_cleanForm(
|
||||
this.fxaPwInput,
|
||||
this.fxaShowPw
|
||||
);
|
||||
this.showErrorResponse(response);
|
||||
}.bind(this)
|
||||
);
|
||||
};
|
||||
|
||||
return Module;
|
||||
|
||||
}());
|
||||
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
|
||||
/* global FxaModuleStates, FxaModuleUI, FxaModule, FxModuleServerRequest,
|
||||
FxaModuleOverlay */
|
||||
/* exported FxaModuleRefreshAuth */
|
||||
/* jshint unused:false */
|
||||
|
||||
'use strict';
|
||||
|
||||
var FxaModuleRefreshAuth = (function() {
|
||||
|
||||
function _isPasswordValid(passwordEl) {
|
||||
var passwordValue = passwordEl.value;
|
||||
return passwordValue && passwordEl.validity.valid;
|
||||
}
|
||||
|
||||
function _enableDone(passwordEl) {
|
||||
if (_isPasswordValid(passwordEl)) {
|
||||
FxaModuleUI.enableDoneButton();
|
||||
} else {
|
||||
FxaModuleUI.disableDoneButton();
|
||||
}
|
||||
}
|
||||
|
||||
function _cleanForm(passwordEl, passwordCheck) {
|
||||
passwordEl.value = '';
|
||||
passwordCheck.checked = false;
|
||||
passwordEl.setAttribute('type', 'password');
|
||||
FxaModuleUI.disableDoneButton();
|
||||
}
|
||||
|
||||
function _requestPasswordReset(email, done) {
|
||||
/*jshint validthis:true */
|
||||
FxModuleServerRequest.requestPasswordReset(
|
||||
email,
|
||||
function onSuccess(response) {
|
||||
done();
|
||||
},
|
||||
function onError(response) {
|
||||
this._showCouldNotResetPassword();
|
||||
}.bind(this)
|
||||
);
|
||||
}
|
||||
|
||||
function _showCouldNotResetPassword() {
|
||||
/*jshint validthis:true */
|
||||
this.showErrorResponse({
|
||||
error: 'RESET_PASSWORD_ERROR'
|
||||
});
|
||||
}
|
||||
|
||||
function _forgotPassword() {
|
||||
/*jshint validthis:true */
|
||||
FxaModuleOverlay.show('fxa-requesting-password-reset');
|
||||
_requestPasswordReset.call(
|
||||
this,
|
||||
this.email,
|
||||
function() {
|
||||
FxaModuleOverlay.hide();
|
||||
FxaModuleStates.setState(FxaModuleStates.PASSWORD_RESET_SUCCESS);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
var Module = Object.create(FxaModule);
|
||||
Module.init = function init(options) {
|
||||
if (!this.initialized) {
|
||||
// Cache DOM elements.
|
||||
this.importElements(
|
||||
'fxa-pw-input-refresh',
|
||||
'fxa-show-pw-refresh',
|
||||
'fxa-forgot-password-refresh'
|
||||
);
|
||||
|
||||
this.fxaPwInputRefresh.addEventListener('input', (function(event) {
|
||||
_enableDone(event.target);
|
||||
}).bind(this));
|
||||
|
||||
this.fxaShowPwRefresh.addEventListener('change', (function() {
|
||||
var passwordFieldType = !!this.fxaShowPwRefresh.checked ? 'text' :
|
||||
'password';
|
||||
}).bind(this), false);
|
||||
|
||||
this.fxaForgotPasswordRefresh.addEventListener('click',
|
||||
_forgotPassword.bind(this),
|
||||
false);
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
if (!options || !options.email) {
|
||||
console.error('Options are not sent properly. Email not available');
|
||||
return;
|
||||
}
|
||||
|
||||
this.email = options.email;
|
||||
|
||||
_cleanForm(this.fxaPwInputRefresh, this.fxaShowPwRefresh);
|
||||
_enableDone(this.fxaPwInputRefresh);
|
||||
};
|
||||
|
||||
Module.onDone = function onDone(callback) {
|
||||
FxaModuleOverlay.show('fxa-connecting');
|
||||
|
||||
FxModuleServerRequest.signIn(
|
||||
this.email,
|
||||
this.fxaPwInputRefresh.value,
|
||||
function onServerResponse(response) {
|
||||
FxaModuleOverlay.hide();
|
||||
callback();
|
||||
}, function onError(response) {
|
||||
_cleanForm(this.fxaPwInputRefresh,
|
||||
this.fxaShowPwRefresh);
|
||||
this.showErrorResponse(response);
|
||||
}.bind(this)
|
||||
);
|
||||
};
|
||||
|
||||
return Module;
|
||||
})();
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
|
||||
/* global FxaModuleUI, FxaModuleOverlay, FxaModule, FxModuleServerRequest,
|
||||
FxaModuleManager, FxaModuleStates */
|
||||
/* exported FxaModuleSetPassword */
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Takes care of a new user's set password screen. If password is valid,
|
||||
* attempt to stage the user.
|
||||
*/
|
||||
var FxaModuleSetPassword = (function() {
|
||||
|
||||
function _isPasswordValid(passwordEl) {
|
||||
var passwordValue = passwordEl.value;
|
||||
return passwordValue && passwordEl.validity.valid;
|
||||
}
|
||||
|
||||
function _enableNext(passwordEl) {
|
||||
if (_isPasswordValid(passwordEl)) {
|
||||
FxaModuleUI.enableNextButton();
|
||||
} else {
|
||||
FxaModuleUI.disableNextButton();
|
||||
}
|
||||
}
|
||||
|
||||
function _cleanForm(passwordEl, passwordCheck) {
|
||||
passwordEl.value = '';
|
||||
passwordCheck.checked = false;
|
||||
passwordEl.setAttribute('type', 'password');
|
||||
}
|
||||
|
||||
function _showRegistering() {
|
||||
FxaModuleOverlay.show('fxa-connecting');
|
||||
}
|
||||
|
||||
function _hideRegistering() {
|
||||
FxaModuleOverlay.hide();
|
||||
}
|
||||
|
||||
function _showUserNotCreated() {
|
||||
/*jshint validthis:true */
|
||||
this.showErrorResponse({
|
||||
error: 'CANNOT_CREATE_ACCOUNT'
|
||||
});
|
||||
}
|
||||
|
||||
function _togglePasswordVisibility() {
|
||||
/*jshint validthis:true */
|
||||
var passwordFieldType = !!this.fxaShowPwSet.checked ? 'text' : 'password';
|
||||
this.fxaPwSetInput.setAttribute('type', passwordFieldType);
|
||||
}
|
||||
|
||||
var Module = Object.create(FxaModule);
|
||||
Module.init = function init(options) {
|
||||
|
||||
if (!this.initialized) {
|
||||
// Cache DOM elements
|
||||
this.importElements(
|
||||
'fxa-pw-set-input',
|
||||
'fxa-show-pw-set',
|
||||
'fxa-hello-user'
|
||||
);
|
||||
// Add Listeners
|
||||
this.fxaPwSetInput.addEventListener(
|
||||
'input',
|
||||
function onInput(event) {
|
||||
_enableNext(event.target);
|
||||
}
|
||||
);
|
||||
|
||||
this.fxaShowPwSet.addEventListener(
|
||||
'change',
|
||||
_togglePasswordVisibility.bind(this),
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
options = options || {};
|
||||
|
||||
this.email = options.email;
|
||||
|
||||
navigator.mozL10n.setAttributes(this.fxaHelloUser, 'fxa-hello-user2', {
|
||||
email: this.email
|
||||
});
|
||||
|
||||
_cleanForm(
|
||||
this.fxaPwSetInput,
|
||||
this.fxaShowPwSet
|
||||
);
|
||||
|
||||
_enableNext(this.fxaPwSetInput);
|
||||
};
|
||||
|
||||
Module.onNext = function onNext(gotoNextStepCallback) {
|
||||
_showRegistering();
|
||||
FxModuleServerRequest.signUp(
|
||||
this.email,
|
||||
this.fxaPwSetInput.value,
|
||||
function(response) {
|
||||
_hideRegistering();
|
||||
|
||||
FxaModuleManager.setParam('success', true);
|
||||
|
||||
var isAccountCreated = response.accountCreated;
|
||||
|
||||
if (!isAccountCreated) {
|
||||
_showUserNotCreated.call(this);
|
||||
return;
|
||||
}
|
||||
|
||||
gotoNextStepCallback(FxaModuleStates.SIGNUP_SUCCESS);
|
||||
}.bind(this),
|
||||
this.showErrorResponse
|
||||
);
|
||||
};
|
||||
|
||||
return Module;
|
||||
|
||||
}());
|
||||
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
|
||||
/* global FxaModule, FxaModuleStates */
|
||||
/* exported FxaModuleSigninSuccess */
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Display the signup success message to the user.
|
||||
*/
|
||||
var FxaModuleSigninSuccess = (function() {
|
||||
|
||||
var Module = Object.create(FxaModule);
|
||||
|
||||
Module.onNext = function onNext(done) {
|
||||
done(FxaModuleStates.DONE);
|
||||
};
|
||||
|
||||
return Module;
|
||||
|
||||
}());
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
|
||||
/* global FxaModule, FxaModuleStates */
|
||||
/* exported FxaModuleSignupSuccess */
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Display the signup success message to the user.
|
||||
*/
|
||||
var FxaModuleSignupSuccess = (function() {
|
||||
|
||||
var Module = Object.create(FxaModule);
|
||||
Module.init = function init(options) {
|
||||
options = options || {};
|
||||
this.importElements(
|
||||
'fxa-will-send-email'
|
||||
);
|
||||
|
||||
navigator.mozL10n.setAttributes(this.fxaWillSendEmail,
|
||||
'fxa-will-send-email2', {
|
||||
email: options.email
|
||||
});
|
||||
};
|
||||
|
||||
Module.onNext = function onNext(done) {
|
||||
done(FxaModuleStates.DONE);
|
||||
};
|
||||
|
||||
return Module;
|
||||
|
||||
}());
|
||||
|
||||
374
assets/webapps/system.gaiamobile.org/fxa/style/fxa.css
Normal file
374
assets/webapps/system.gaiamobile.org/fxa/style/fxa.css
Normal file
|
|
@ -0,0 +1,374 @@
|
|||
/*
|
||||
* Basic and shared styles of the structure
|
||||
* */
|
||||
html, body {
|
||||
font-size: 62.5%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
background: #f4f4f4;
|
||||
}
|
||||
|
||||
html, body * {
|
||||
-moz-user-select: none;
|
||||
}
|
||||
|
||||
input {
|
||||
-moz-user-select: text;
|
||||
}
|
||||
|
||||
.vertical {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
section[role="region"] {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
body {
|
||||
background: url(bg_light.png);
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.7rem;
|
||||
font-weight: 400;
|
||||
line-height: 2.3rem;
|
||||
margin: 0 0 1rem;
|
||||
text-align: start;
|
||||
}
|
||||
h3:-moz-dir(rtl) {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
label {
|
||||
width:100%;
|
||||
display:block;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Navigation bar based on a flex model
|
||||
* * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
.navigation {
|
||||
position: absolute;
|
||||
background: #f4f4f4;
|
||||
border-top: 0.1rem solid #a6a6a6;
|
||||
padding: .75rem 1.5rem;
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
left: 0;
|
||||
right:0;
|
||||
bottom: 0;
|
||||
overflow: hidden;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Overwrite this property from Building Blocks */
|
||||
html[dir="ltr"] .navigation button { margin-left: 0.5rem; }
|
||||
html[dir="rtl"] .navigation button { margin-right: 0.5rem; }
|
||||
|
||||
html[dir="ltr"] .navigation button.start { margin-left: 0.5rem; }
|
||||
html[dir="rtl"] .navigation button.start { margin-right: 0.5rem; }
|
||||
|
||||
.navigation button.start,
|
||||
.navigation button.end {
|
||||
width: calc((100% / 2) - 0.5rem);
|
||||
position: relative;
|
||||
}
|
||||
html[dir="ltr"] .navigation button.start,
|
||||
html[dir="ltr"] .navigation button.end { float: left; }
|
||||
html[dir="rtl"] .navigation button.start,
|
||||
html[dir="rtl"] .navigation button.end { float: right; }
|
||||
|
||||
/* When there is only one option, we remove the margin */
|
||||
|
||||
.navigation-single-button button.start {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.navigation.navigation-single-button button.end {
|
||||
margin: 0;
|
||||
width: 100%
|
||||
}
|
||||
|
||||
.navigation-back-only button {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.navigation-back-only button.end {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.navigation-done #fxa-module-back,
|
||||
.navigation-done #fxa-module-next {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#fxa-module-done {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.navigation-done #fxa-module-done {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Steps & Container
|
||||
* All steps are contained in several views inside
|
||||
* 'step-container'. We will use HTML 'import' polyfill
|
||||
* and lazy load of the views. A view is a set of steps.
|
||||
* * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
.bb-steps {
|
||||
margin: 0.5rem 1.5rem;
|
||||
}
|
||||
|
||||
#step-container {
|
||||
height: calc(100% - 6.3rem - 5rem);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ff_account,
|
||||
.screen {
|
||||
font-family: sans-serif;
|
||||
font-size: 1.7rem;
|
||||
line-height:2.3rem;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
overflow: scroll;
|
||||
display: none;
|
||||
padding: 1.5rem 2.5rem;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.screen p.fxa-intro {
|
||||
text-align: start;
|
||||
line-height: 2.3rem;
|
||||
font-size: 1.7rem;
|
||||
}
|
||||
.screen p {
|
||||
text-align: start;
|
||||
line-height: 1.9rem;
|
||||
font-size: 1.5rem;
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
|
||||
.current {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/*
|
||||
* Intro screen styles
|
||||
*/
|
||||
|
||||
#fxa-hello-user {
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
#fxa-user-email,
|
||||
#fxa-user-set-email {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
p.fine-print {
|
||||
font-size: 1.2rem;
|
||||
line-height: 1.6rem;
|
||||
}
|
||||
|
||||
/*
|
||||
* Verification Screen Styles
|
||||
*/
|
||||
|
||||
ul.fxa-verification-wrapper {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul.fxa-verification-wrapper li {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Password screen styles
|
||||
*/
|
||||
|
||||
#show-pw-wrapper {
|
||||
width: 100%;
|
||||
display: block;
|
||||
margin: 0 -1.5rem;
|
||||
}
|
||||
|
||||
#show-pw-wrapper p {
|
||||
display: block;
|
||||
margin: 1.5rem 0;
|
||||
}
|
||||
html[dir="ltr"] #show-pw-wrapper p { float: left; }
|
||||
html[dir="rtl"] #show-pw-wrapper p { float: right; }
|
||||
|
||||
html[dir="ltr"] #show-pw-wrapper > label { float: left; }
|
||||
html[dir="rtl"] #show-pw-wrapper > label { float: right; }
|
||||
|
||||
/* Animate next screen */
|
||||
.currentToPrev {
|
||||
display:block;
|
||||
}
|
||||
html[dir="ltr"] .currentToPrev {
|
||||
animation: currentToLeft var(--transition-duration) forwards;
|
||||
}
|
||||
html[dir="rtl"] .currentToPrev {
|
||||
animation: currentToRight var(--transition-duration) forwards;
|
||||
}
|
||||
|
||||
.nextToCurrent {
|
||||
display:block;
|
||||
}
|
||||
html[dir="ltr"] .nextToCurrent {
|
||||
animation: rightToCurrent var(--transition-duration) forwards;
|
||||
}
|
||||
html[dir="rtl"] .nextToCurrent {
|
||||
animation: leftToCurrent var(--transition-duration) forwards;
|
||||
}
|
||||
|
||||
/* Animate prev screen */
|
||||
.prevToCurrent {
|
||||
display: block;
|
||||
}
|
||||
html[dir="ltr"] .prevToCurrent {
|
||||
animation: leftToCurrent var(--transition-duration) forwards;
|
||||
}
|
||||
html[dir="rtl"] .prevToCurrent {
|
||||
animation: rightToCurrent var(--transition-duration) forwards;
|
||||
}
|
||||
|
||||
.currentToNext {
|
||||
display: block;
|
||||
}
|
||||
html[dir="ltr"] .currentToNext {
|
||||
animation: currentToRight var(--transition-duration) forwards;
|
||||
}
|
||||
html[dir="rtl"] .currentToNext {
|
||||
animation: currentToLeft var(--transition-duration) forwards;
|
||||
}
|
||||
|
||||
@keyframes currentToLeft {
|
||||
0% { transform: translateX(0); }
|
||||
100% { transform: translateX(-100%); }
|
||||
}
|
||||
@keyframes rightToCurrent {
|
||||
0% { transform: translateX(100%); }
|
||||
100% { transform: translateX(0); }
|
||||
}
|
||||
@keyframes leftToCurrent {
|
||||
0% { transform: translateX(-100%); }
|
||||
100% { transform: translateX(0); }
|
||||
}
|
||||
@keyframes currentToRight {
|
||||
0% { transform: translateX(0); }
|
||||
100% { transform: translateX(100%); }
|
||||
}
|
||||
|
||||
.current {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.screen a {
|
||||
text-decoration: underline;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.fxa-logo {
|
||||
background-image: url('fxa_logo.png');
|
||||
background-size: 14rem auto;
|
||||
background-repeat: no-repeat;
|
||||
margin: 0 auto;
|
||||
width: 14rem;
|
||||
height: 15rem;
|
||||
}
|
||||
|
||||
p.fxa-envelope {
|
||||
background-image: url('fxa_envelope.png');
|
||||
background-repeat: no-repeat;
|
||||
background-size: 7rem;
|
||||
padding-inline-start: 8rem;
|
||||
padding-top: 1rem;
|
||||
line-height: 2rem;
|
||||
min-height: 6.4rem;
|
||||
max-width:100%;
|
||||
overflow: hidden; /* short email addresses will only take up one line*/
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
html[dir="ltr"] p.fxa-envelope { background-position: left top; }
|
||||
html[dir="rtl"] p.fxa-envelope { background-position: right top; }
|
||||
|
||||
#fxa-error-overlay {
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Overlay:
|
||||
* IMPORTANT: Avoid to use 'visibility' or 'opacity' due
|
||||
* to performance issues. For hiding, use 'display:none;''
|
||||
* * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#fxa-overlay {
|
||||
display: none;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 2;
|
||||
font-size: 2rem;
|
||||
background-color: rgba(200,200,200,0.9);
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#fxa-overlay.show {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
form[role=dialog] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
form[role=dialog].show {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/*
|
||||
* Classes to ensure functionality
|
||||
*/
|
||||
|
||||
a.disabled {
|
||||
opacity: 0.3;
|
||||
pointer-events: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.button.icon-dialog select {
|
||||
border: none;
|
||||
background: transparent;
|
||||
font-size: 1.7rem;
|
||||
}
|
||||
BIN
assets/webapps/system.gaiamobile.org/fxa/style/fxa_envelope.png
Normal file
BIN
assets/webapps/system.gaiamobile.org/fxa/style/fxa_envelope.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
BIN
assets/webapps/system.gaiamobile.org/fxa/style/fxa_logo.png
Normal file
BIN
assets/webapps/system.gaiamobile.org/fxa/style/fxa_logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
19
assets/webapps/system.gaiamobile.org/fxa/view/view_login.js
Normal file
19
assets/webapps/system.gaiamobile.org/fxa/view/view_login.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/* global FxaModuleStates */
|
||||
/* exported View */
|
||||
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
*
|
||||
* "View" object defines the number of steps to follow and the
|
||||
* first step of the flow. Then entire flow is self-contained, so
|
||||
* once the first step is loaded the next ones are loaded taking into
|
||||
* consideration the decision taken by the user.
|
||||
* Number of steps is needed for showing to the user the progress bar.
|
||||
*
|
||||
*/
|
||||
|
||||
var View = {
|
||||
length: 3,
|
||||
start: FxaModuleStates.ENTER_EMAIL
|
||||
};
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
/* global FxaModuleStates */
|
||||
/* exported View */
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
*
|
||||
* "View" object defines the number of steps to follow and the
|
||||
* first step of the flow. Then entire flow is self-contained, so
|
||||
* once the first step is loaded the next ones are loaded taking into
|
||||
* consideration the decision taken by the user.
|
||||
* Number of steps is needed for showing to the user the progress bar.
|
||||
*
|
||||
*/
|
||||
|
||||
var View = {
|
||||
length: 1,
|
||||
start: FxaModuleStates.REFRESH_AUTH
|
||||
};
|
||||
Loading…
Reference in a new issue