Bug 1336070 - Fix no-undef issues in the pocket code. r?mixedpuppy
MozReview-Commit-ID: F5brmleBkca
--- a/browser/extensions/pocket/bootstrap.js
+++ b/browser/extensions/pocket/bootstrap.js
@@ -1,13 +1,15 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+/* global ADDON_ENABLE:false, ADDON_DISABLE:false, APP_SHUTDOWN: false */
+
const {classes: Cc, interfaces: Ci, utils: Cu, manager: Cm} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://services-common/utils.js");
Cu.import("resource://gre/modules/Preferences.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow",
--- a/browser/extensions/pocket/content/panels/js/saved.js
+++ b/browser/extensions/pocket/content/panels/js/saved.js
@@ -1,8 +1,11 @@
+/* global $:false, Handlebars:false */
+/* import-globals-from messages.js */
+
/*
PKT_SAVED_OVERLAY is the view itself and contains all of the methods to manipute the overlay and messaging.
It does not contain any logic for saving or communication with the extension or server.
*/
var PKT_SAVED_OVERLAY = function(options) {
var myself = this;
this.inited = false;
this.active = false;
@@ -166,17 +169,17 @@ var PKT_SAVED_OVERLAY = function(options
inputwrapper.append($(".token-input-dropdown-tag"));
}
cb(returnlist);
},
textToData(text) {
if ($.trim(text).length > 25 || !$.trim(text).length) {
if (text.length > 25) {
myself.showTagsError(myself.dictJSON.maxtaglength);
- changestamp = Date.now();
+ this.changestamp = Date.now();
setTimeout(function() {
$(".token-input-input-token input").val(text).focus();
}, 10);
}
return null;
}
myself.hideTagsError();
return {name:myself.sanitizeText(text.toLowerCase())};
@@ -198,35 +201,35 @@ var PKT_SAVED_OVERLAY = function(options
});
}
$(".token-input-list").on("keydown", "input", function(e) {
if (e.which == 37) {
myself.updateSlidingTagList();
}
}).on("keypress", "input", function(e) {
if (e.which == 13) {
- if (typeof changestamp == "undefined" || (Date.now() - changestamp > 250)) {
+ if (typeof this.changestamp == "undefined" || (Date.now() - this.changestamp > 250)) {
e.preventDefault();
myself.wrapper.find(".pkt_ext_btn").trigger("click");
}
}
}).on("keyup", "input", function(e) {
myself.checkValidTagSubmit();
});
myself.checkPlaceholderStatus();
},
onAdd() {
myself.checkValidTagSubmit();
- changestamp = Date.now();
+ this.changestamp = Date.now();
myself.hideInactiveTags();
myself.checkPlaceholderStatus();
},
onDelete() {
myself.checkValidTagSubmit();
- changestamp = Date.now();
+ this.changestamp = Date.now();
myself.showActiveTags();
myself.checkPlaceholderStatus();
},
onShowDropdown() {
thePKT_SAVED.sendMessage("expandSavePanel");
},
onHideDropdown() {
thePKT_SAVED.sendMessage("collapseSavePanel");
@@ -528,16 +531,17 @@ PKT_SAVED.prototype = {
});
}
}
$(function() {
if (!window.thePKT_SAVED) {
var thePKT_SAVED = new PKT_SAVED();
+ /* global thePKT_SAVED */
window.thePKT_SAVED = thePKT_SAVED;
thePKT_SAVED.init();
}
var pocketHost = thePKT_SAVED.overlay.pockethost;
// send an async message to get string data
thePKT_SAVED.sendMessage("initL10N", {
tos: [
--- a/browser/extensions/pocket/content/panels/js/signup.js
+++ b/browser/extensions/pocket/content/panels/js/signup.js
@@ -1,8 +1,11 @@
+/* global $:false, Handlebars:false */
+/* import-globals-from messages.js */
+
/*
PKT_SIGNUP_OVERLAY is the view itself and contains all of the methods to manipute the overlay and messaging.
It does not contain any logic for saving or communication with the extension or server.
*/
var PKT_SIGNUP_OVERLAY = function(options) {
var myself = this;
this.inited = false;
this.active = false;
@@ -152,16 +155,17 @@ PKT_SIGNUP.prototype = {
// tell back end we're ready
thePKT_SIGNUP.sendMessage("show");
}
}
$(function() {
if (!window.thePKT_SIGNUP) {
var thePKT_SIGNUP = new PKT_SIGNUP();
+ /* global thePKT_SIGNUP */
window.thePKT_SIGNUP = thePKT_SIGNUP;
thePKT_SIGNUP.init();
}
var pocketHost = thePKT_SIGNUP.overlay.pockethost;
// send an async message to get string data
thePKT_SIGNUP.sendMessage("initL10N", {
tos: [