Skip to content

Commit

Permalink
Bug 957052 - Move remaining event handlers out of mobile/android/chro…
Browse files Browse the repository at this point in the history
…me/content/aboutFeedback.xhtml into its js file. r=mleibovic
  • Loading branch information
Neil Bleasdale committed Jan 14, 2014
1 parent 10d53b9 commit e1c7261
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
20 changes: 20 additions & 0 deletions mobile/android/chrome/content/aboutFeedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;

Expand Down
16 changes: 8 additions & 8 deletions mobile/android/chrome/content/aboutFeedback.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand All @@ -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>
Expand Down

0 comments on commit e1c7261

Please sign in to comment.