Bug 957052 - Move remaining event handlers out of mobile/android/chrome/content/aboutFeedback.xhtml into its js file. r=mleibovic

This commit is contained in:
Neil Bleasdale 2014-01-14 10:14:10 -05:00
parent 66da82568d
commit 4bce855435
2 changed files with 28 additions and 8 deletions

View File

@ -9,6 +9,7 @@ let Ci = Components.interfaces;
let Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
document.addEventListener("DOMContentLoaded", init, false);
function dump(a) {
Services.console.logStringMessage(a);
@ -19,6 +20,25 @@ function sendMessageToJava(aMessage) {
}
function init() {
let anchors = document.querySelectorAll(".maybe-later");
for(let anchor of anchors) {
anchor.addEventListener("click", maybeLater, false);
}
document.getElementById("happy-link").addEventListener("click", function(evt) {
switchSection("happy");
}, false);
document.getElementById("sad-link").addEventListener("click", function(evt) {
switchSection("sad");
}, false);
window.addEventListener("unload", uninit, false);
document.getElementById("open-play-store").addEventListener("click", openPlayStore, false);
document.forms[0].addEventListener("submit", sendFeedback, false);
document.getElementById("no-thanks").addEventListener("click", function(evt) {
window.close();
}, false);
let sumoLink = Services.urlFormatter.formatURLPref("app.support.baseURL");
document.getElementById("sumo-link").href = sumoLink;

View File

@ -22,19 +22,19 @@
<link rel="icon" type="image/png" sizes="64x64" href="chrome://branding/content/favicon64.png" />
</head>
<body dir="&locale.dir;" onload="init();" onunload="uninit();">
<body dir="&locale.dir;">
<section id="intro" active="true">
<h1 class="header">&intro.header;</h1>
<div class="message">&intro.message;</div>
<div class="link-box" onclick="switchSection('happy');">
<div id="happy-link" class="link-box">
<a>&intro.happyLink;</a>
</div>
<div class="link-box-bottom" onclick="switchSection('sad');">
<div id="sad-link" class="link-box-bottom">
<a>&intro.sadLink;</a>
</div>
<div class="bottom-links">
<a onclick="maybeLater();">&intro.maybeLater;</a>
<a class="maybe-later">&intro.maybeLater;</a>
</div>
</section>
@ -44,18 +44,18 @@
<div class="message">&happy.message;</div>
<div class="fine-print">&happy.finePrint;</div>
</div>
<div class="link-box-bottom" onclick="openPlayStore();">
<div id="open-play-store" class="link-box-bottom">
<div class="stars"/>
<a>&happy.ratingLink;</a>
</div>
<div class="bottom-links">
<a onclick="maybeLater();">&happy.maybeLater2;</a>
<a onclick="window.close();">&happy.noThanks;</a>
<a class="maybe-later">&happy.maybeLater2;</a>
<a id="no-thanks">&happy.noThanks;</a>
</div>
</section>
<section id="sad">
<form onsubmit="sendFeedback(event);">
<form>
<div class="message">&sad.message;</div>
<textarea class="description" placeholder="&sad.placeholder;" rows="8" required="true"/>
<div class="message">&sad.lastSite;</div>