From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- browser/extensions/pocket/content/AboutPocket.jsm | 93 ++ browser/extensions/pocket/content/Pocket.jsm | 93 ++ browser/extensions/pocket/content/main.js | 737 ++++++++++++++++ .../pocket/content/panels/css/firasans.css | 6 + .../pocket/content/panels/css/normalize.css | 424 +++++++++ .../extensions/pocket/content/panels/css/saved.css | 825 ++++++++++++++++++ .../pocket/content/panels/css/signup.css | 424 +++++++++ .../content/panels/fonts/FiraSans-Regular.woff | Bin 0 -> 179188 bytes .../pocket/content/panels/img/pocket.svg | 22 + .../pocket/content/panels/img/pocketerror@1x.png | Bin 0 -> 1479 bytes .../pocket/content/panels/img/pocketerror@2x.png | Bin 0 -> 3131 bytes .../pocket/content/panels/img/pocketlogo@1x.png | Bin 0 -> 3539 bytes .../pocket/content/panels/img/pocketlogo@2x.png | Bin 0 -> 7378 bytes .../content/panels/img/pocketlogosolo@1x.png | Bin 0 -> 1256 bytes .../content/panels/img/pocketlogosolo@2x.png | Bin 0 -> 2566 bytes .../pocket/content/panels/img/pocketmenuitem16.png | Bin 0 -> 264 bytes .../content/panels/img/pocketmenuitem16@2x.png | Bin 0 -> 641 bytes .../content/panels/img/pocketsignup_button@1x.png | Bin 0 -> 7315 bytes .../content/panels/img/pocketsignup_button@2x.png | Bin 0 -> 13480 bytes .../content/panels/img/pocketsignup_devices@1x.png | Bin 0 -> 22496 bytes .../content/panels/img/pocketsignup_devices@2x.png | Bin 0 -> 73925 bytes .../content/panels/img/pocketsignup_hero@1x.png | Bin 0 -> 44964 bytes .../content/panels/img/pocketsignup_hero@2x.png | Bin 0 -> 148877 bytes .../content/panels/img/signup_firefoxlogo@1x.png | Bin 0 -> 635 bytes .../content/panels/img/signup_firefoxlogo@2x.png | Bin 0 -> 1375 bytes .../pocket/content/panels/img/signup_help@1x.png | Bin 0 -> 659 bytes .../pocket/content/panels/img/signup_help@2x.png | Bin 0 -> 1420 bytes .../pocket/content/panels/img/signup_or@1x.png | Bin 0 -> 1843 bytes .../pocket/content/panels/img/signup_or@2x.png | Bin 0 -> 2925 bytes .../pocket/content/panels/img/tag_close@1x.png | Bin 0 -> 287 bytes .../pocket/content/panels/img/tag_close@2x.png | Bin 0 -> 508 bytes .../content/panels/img/tag_closeactive@1x.png | Bin 0 -> 208 bytes .../content/panels/img/tag_closeactive@2x.png | Bin 0 -> 354 bytes .../pocket/content/panels/js/messages.js | 78 ++ .../extensions/pocket/content/panels/js/saved.js | 608 +++++++++++++ .../extensions/pocket/content/panels/js/signup.js | 193 +++++ .../extensions/pocket/content/panels/js/tmpl.js | 242 ++++++ .../content/panels/js/vendor/handlebars.runtime.js | 660 ++++++++++++++ .../content/panels/js/vendor/jquery-2.1.1.min.js | 4 + .../panels/js/vendor/jquery.tokeninput.min.js | 954 +++++++++++++++++++++ .../extensions/pocket/content/panels/license.txt | 35 + .../extensions/pocket/content/panels/saved.html | 19 + .../extensions/pocket/content/panels/signup.html | 18 + .../panels/tmpl/saved_premiumextras.handlebars | 2 + .../panels/tmpl/saved_premiumshell.handlebars | 6 + .../content/panels/tmpl/saved_shell.handlebars | 29 + .../content/panels/tmpl/signup_shell.handlebars | 32 + .../panels/tmpl/signupstoryboard_shell.handlebars | 43 + browser/extensions/pocket/content/pktApi.jsm | 657 ++++++++++++++ .../pocket/content/pocket-content-process.js | 54 ++ 50 files changed, 6258 insertions(+) create mode 100644 browser/extensions/pocket/content/AboutPocket.jsm create mode 100644 browser/extensions/pocket/content/Pocket.jsm create mode 100644 browser/extensions/pocket/content/main.js create mode 100644 browser/extensions/pocket/content/panels/css/firasans.css create mode 100644 browser/extensions/pocket/content/panels/css/normalize.css create mode 100644 browser/extensions/pocket/content/panels/css/saved.css create mode 100644 browser/extensions/pocket/content/panels/css/signup.css create mode 100644 browser/extensions/pocket/content/panels/fonts/FiraSans-Regular.woff create mode 100644 browser/extensions/pocket/content/panels/img/pocket.svg create mode 100644 browser/extensions/pocket/content/panels/img/pocketerror@1x.png create mode 100644 browser/extensions/pocket/content/panels/img/pocketerror@2x.png create mode 100644 browser/extensions/pocket/content/panels/img/pocketlogo@1x.png create mode 100644 browser/extensions/pocket/content/panels/img/pocketlogo@2x.png create mode 100644 browser/extensions/pocket/content/panels/img/pocketlogosolo@1x.png create mode 100644 browser/extensions/pocket/content/panels/img/pocketlogosolo@2x.png create mode 100644 browser/extensions/pocket/content/panels/img/pocketmenuitem16.png create mode 100644 browser/extensions/pocket/content/panels/img/pocketmenuitem16@2x.png create mode 100644 browser/extensions/pocket/content/panels/img/pocketsignup_button@1x.png create mode 100644 browser/extensions/pocket/content/panels/img/pocketsignup_button@2x.png create mode 100644 browser/extensions/pocket/content/panels/img/pocketsignup_devices@1x.png create mode 100644 browser/extensions/pocket/content/panels/img/pocketsignup_devices@2x.png create mode 100644 browser/extensions/pocket/content/panels/img/pocketsignup_hero@1x.png create mode 100644 browser/extensions/pocket/content/panels/img/pocketsignup_hero@2x.png create mode 100644 browser/extensions/pocket/content/panels/img/signup_firefoxlogo@1x.png create mode 100644 browser/extensions/pocket/content/panels/img/signup_firefoxlogo@2x.png create mode 100644 browser/extensions/pocket/content/panels/img/signup_help@1x.png create mode 100644 browser/extensions/pocket/content/panels/img/signup_help@2x.png create mode 100644 browser/extensions/pocket/content/panels/img/signup_or@1x.png create mode 100644 browser/extensions/pocket/content/panels/img/signup_or@2x.png create mode 100644 browser/extensions/pocket/content/panels/img/tag_close@1x.png create mode 100644 browser/extensions/pocket/content/panels/img/tag_close@2x.png create mode 100644 browser/extensions/pocket/content/panels/img/tag_closeactive@1x.png create mode 100644 browser/extensions/pocket/content/panels/img/tag_closeactive@2x.png create mode 100644 browser/extensions/pocket/content/panels/js/messages.js create mode 100644 browser/extensions/pocket/content/panels/js/saved.js create mode 100644 browser/extensions/pocket/content/panels/js/signup.js create mode 100644 browser/extensions/pocket/content/panels/js/tmpl.js create mode 100644 browser/extensions/pocket/content/panels/js/vendor/handlebars.runtime.js create mode 100644 browser/extensions/pocket/content/panels/js/vendor/jquery-2.1.1.min.js create mode 100644 browser/extensions/pocket/content/panels/js/vendor/jquery.tokeninput.min.js create mode 100644 browser/extensions/pocket/content/panels/license.txt create mode 100644 browser/extensions/pocket/content/panels/saved.html create mode 100644 browser/extensions/pocket/content/panels/signup.html create mode 100644 browser/extensions/pocket/content/panels/tmpl/saved_premiumextras.handlebars create mode 100644 browser/extensions/pocket/content/panels/tmpl/saved_premiumshell.handlebars create mode 100644 browser/extensions/pocket/content/panels/tmpl/saved_shell.handlebars create mode 100644 browser/extensions/pocket/content/panels/tmpl/signup_shell.handlebars create mode 100644 browser/extensions/pocket/content/panels/tmpl/signupstoryboard_shell.handlebars create mode 100644 browser/extensions/pocket/content/pktApi.jsm create mode 100644 browser/extensions/pocket/content/pocket-content-process.js (limited to 'browser/extensions/pocket/content') diff --git a/browser/extensions/pocket/content/AboutPocket.jsm b/browser/extensions/pocket/content/AboutPocket.jsm new file mode 100644 index 000000000..c7f57aa87 --- /dev/null +++ b/browser/extensions/pocket/content/AboutPocket.jsm @@ -0,0 +1,93 @@ +/* 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/. */ +"use strict"; + +const { interfaces: Ci, results: Cr, manager: Cm, utils: Cu } = Components; + +Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); + +// See LOG_LEVELS in Console.jsm. Common examples: "All", "Info", "Warn", & "Error". +const PREF_LOG_LEVEL = "loop.debug.loglevel"; + +XPCOMUtils.defineLazyGetter(this, "log", () => { + let ConsoleAPI = Cu.import("resource://gre/modules/Console.jsm", {}).ConsoleAPI; + let consoleOptions = { + maxLogLevelPref: PREF_LOG_LEVEL, + prefix: "Loop" + }; + return new ConsoleAPI(consoleOptions); +}); + + +function AboutPage(chromeURL, aboutHost, classID, description, uriFlags) { + this.chromeURL = chromeURL; + this.aboutHost = aboutHost; + this.classID = Components.ID(classID); + this.description = description; + this.uriFlags = uriFlags; +} + +AboutPage.prototype = { + QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]), + getURIFlags: function(aURI) { // eslint-disable-line no-unused-vars + return this.uriFlags; + }, + + newChannel: function(aURI, aLoadInfo) { + let newURI = Services.io.newURI(this.chromeURL, null, null); + let channel = Services.io.newChannelFromURIWithLoadInfo(newURI, + aLoadInfo); + channel.originalURI = aURI; + + if (this.uriFlags & Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT) { + let principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(aURI); + channel.owner = principal; + } + return channel; + }, + + createInstance: function(outer, iid) { + if (outer !== null) { + throw Cr.NS_ERROR_NO_AGGREGATION; + } + return this.QueryInterface(iid); + }, + + register: function() { + Cm.QueryInterface(Ci.nsIComponentRegistrar).registerFactory( + this.classID, this.description, + "@mozilla.org/network/protocol/about;1?what=" + this.aboutHost, this); + }, + + unregister: function() { + Cm.QueryInterface(Ci.nsIComponentRegistrar).unregisterFactory( + this.classID, this); + } +}; + +/* exported AboutPocket */ +var AboutPocket = {}; + +XPCOMUtils.defineLazyGetter(AboutPocket, "aboutSaved", () => + new AboutPage("chrome://pocket/content/panels/saved.html", + "pocket-saved", + "{3e759f54-37af-7843-9824-f71b5993ceed}", + "About Pocket Saved", + Ci.nsIAboutModule.ALLOW_SCRIPT | + Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT | + Ci.nsIAboutModule.HIDE_FROM_ABOUTABOUT) +); + +XPCOMUtils.defineLazyGetter(AboutPocket, "aboutSignup", () => + new AboutPage("chrome://pocket/content/panels/signup.html", + "pocket-signup", + "{8548329d-00c4-234e-8f17-75026db3b56e}", + "About Pocket Signup", + Ci.nsIAboutModule.ALLOW_SCRIPT | + Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT | + Ci.nsIAboutModule.HIDE_FROM_ABOUTABOUT) +); + +this.EXPORTED_SYMBOLS = ["AboutPocket"]; diff --git a/browser/extensions/pocket/content/Pocket.jsm b/browser/extensions/pocket/content/Pocket.jsm new file mode 100644 index 000000000..54f9cdf11 --- /dev/null +++ b/browser/extensions/pocket/content/Pocket.jsm @@ -0,0 +1,93 @@ +/* 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/. */ + +"use strict"; +const {classes: Cc, interfaces: Ci, utils: Cu} = Components; + +this.EXPORTED_SYMBOLS = ["Pocket"]; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); + +XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI", + "resource:///modules/CustomizableUI.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode", + "resource://gre/modules/ReaderMode.jsm"); + +var Pocket = { + get site() { return Services.prefs.getCharPref("extensions.pocket.site"); }, + get listURL() { return "https://" + Pocket.site + "/?src=ff_ext"; }, + + /** + * Functions related to the Pocket panel UI. + */ + onPanelViewShowing(event) { + let document = event.target.ownerDocument; + let window = document.defaultView; + let iframe = window.pktUI.getPanelFrame(); + + let urlToSave = Pocket._urlToSave; + let titleToSave = Pocket._titleToSave; + Pocket._urlToSave = null; + Pocket._titleToSave = null; + // ViewShowing fires immediately before it creates the contents, + // in lieu of an AfterViewShowing event, just spin the event loop. + window.setTimeout(function() { + if (urlToSave) { + window.pktUI.tryToSaveUrl(urlToSave, titleToSave); + } else { + window.pktUI.tryToSaveCurrentPage(); + } + + // pocketPanelDidHide in main.js set iframe to about:blank when it was + // hidden, make sure we're loading the save panel. + if (iframe.contentDocument && + iframe.contentDocument.readyState == "complete" && + iframe.contentDocument.documentURI != "about:blank") { + window.pktUI.pocketPanelDidShow(); + } else { + // iframe didn't load yet. This seems to always be the case when in + // the toolbar panel, but never the case for a subview. + // XXX this only being fired when it's a _capturing_ listener! + iframe.addEventListener("load", Pocket.onFrameLoaded, true); + } + }, 0); + }, + + onFrameLoaded(event) { + let document = event.currentTarget.ownerDocument; + let window = document.defaultView; + let iframe = window.pktUI.getPanelFrame(); + + iframe.removeEventListener("load", Pocket.onFrameLoaded, true); + window.pktUI.pocketPanelDidShow(); + }, + + onPanelViewHiding(event) { + let window = event.target.ownerGlobal; + window.pktUI.pocketPanelDidHide(event); + }, + + _urlToSave: null, + _titleToSave: null, + savePage(browser, url, title) { + let document = browser.ownerDocument; + let pocketWidget = document.getElementById("pocket-button"); + let placement = CustomizableUI.getPlacementOfWidget("pocket-button"); + if (!placement) + return; + + this._urlToSave = url; + this._titleToSave = title; + if (placement.area == CustomizableUI.AREA_PANEL) { + let win = document.defaultView; + win.PanelUI.show().then(function() { + pocketWidget = document.getElementById("pocket-button"); + pocketWidget.doCommand(); + }); + } else { + pocketWidget.doCommand(); + } + }, +}; diff --git a/browser/extensions/pocket/content/main.js b/browser/extensions/pocket/content/main.js new file mode 100644 index 000000000..3c1c5785e --- /dev/null +++ b/browser/extensions/pocket/content/main.js @@ -0,0 +1,737 @@ +/* + * LICENSE + * + * POCKET MARKS + * + * Notwithstanding the permitted uses of the Software (as defined below) pursuant to the license set forth below, "Pocket," "Read It Later" and the Pocket icon and logos (collectively, the “Pocket Marks”) are registered and common law trademarks of Read It Later, Inc. This means that, while you have considerable freedom to redistribute and modify the Software, there are tight restrictions on your ability to use the Pocket Marks. This license does not grant you any rights to use the Pocket Marks except as they are embodied in the Software. + * + * --- + * + * SOFTWARE + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/* + * Pocket UI module + * + * Handles interactions with Pocket buttons, panels and menus. + * + */ + +// TODO : Get the toolbar icons from Firefox's build (Nikki needs to give us a red saved icon) +// TODO : [needs clarificaiton from Fx] Firefox's plan was to hide Pocket from context menus until the user logs in. Now that it's an extension I'm wondering if we still need to do this. +// TODO : [needs clarificaiton from Fx] Reader mode (might be a something they need to do since it's in html, need to investigate their code) +// TODO : [needs clarificaiton from Fx] Move prefs within pktApi.s to sqlite or a local file so it's not editable (and is safer) +// TODO : [nice to have] - Immediately save, buffer the actions in a local queue and send (so it works offline, works like our native extensions) + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils", + "resource://gre/modules/PrivateBrowsingUtils.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode", + "resource://gre/modules/ReaderMode.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "pktApi", + "chrome://pocket/content/pktApi.jsm"); + +var pktUI = (function() { + + // -- Initialization (on startup and new windows) -- // + var _currentPanelDidShow; + var _currentPanelDidHide; + + // Init panel id at 0. The first actual panel id will have the number 1 so + // in case at some point any panel has the id 0 we know there is something + // wrong + var _panelId = 0; + + var overflowMenuWidth = 230; + var overflowMenuHeight = 475; + var savePanelWidth = 350; + var savePanelHeights = {collapsed: 153, expanded: 272}; + + // -- Event Handling -- // + + /** + * Event handler when Pocket toolbar button is pressed + */ + + function pocketPanelDidShow(event) { + if (_currentPanelDidShow) { + _currentPanelDidShow(event); + } + + } + + function pocketPanelDidHide(event) { + if (_currentPanelDidHide) { + _currentPanelDidHide(event); + } + + // clear the panel + getPanelFrame().setAttribute('src', 'about:blank'); + } + + + // -- Communication to API -- // + + /** + * Either save or attempt to log the user in + */ + function tryToSaveCurrentPage() { + tryToSaveUrl(getCurrentUrl(), getCurrentTitle()); + } + + function tryToSaveUrl(url, title) { + + // If the user is logged in, go ahead and save the current page + if (pktApi.isUserLoggedIn()) { + saveAndShowConfirmation(url, title); + return; + } + + // If the user is not logged in, show the logged-out state to prompt them to authenticate + showSignUp(); + } + + + // -- Panel UI -- // + + /** + * Show the sign-up panel + */ + function showSignUp() { + // AB test: Direct logged-out users to tab vs panel + if (pktApi.getSignupPanelTabTestVariant() == 'v2') + { + let site = Services.prefs.getCharPref("extensions.pocket.site"); + openTabWithUrl('https://' + site + '/firefox_learnmore?s=ffi&t=autoredirect&tv=page_learnmore&src=ff_ext', true); + + // force the panel closed before it opens + getPanel().hidePopup(); + + return; + } + + // Control: Show panel as normal + getFirefoxAccountSignedInUser(function(userdata) + { + var fxasignedin = (typeof userdata == 'object' && userdata !== null) ? '1' : '0'; + var startheight = 490; + var inOverflowMenu = isInOverflowMenu(); + var controlvariant = pktApi.getSignupPanelTabTestVariant() == 'control'; + + if (inOverflowMenu) + { + startheight = overflowMenuHeight; + } + else + { + startheight = 460; + if (fxasignedin == '1') + { + startheight = 406; + } + } + if (!controlvariant) { + startheight = 427; + } + var variant; + if (inOverflowMenu) + { + variant = 'overflow'; + } + else + { + variant = 'storyboard_lm'; + } + + showPanel("about:pocket-signup?pockethost=" + + Services.prefs.getCharPref("extensions.pocket.site") + + "&fxasignedin=" + + fxasignedin + + "&variant=" + + variant + + '&controlvariant=' + + controlvariant + + '&inoverflowmenu=' + + inOverflowMenu + + "&locale=" + + getUILocale(), { + onShow: function() { + }, + onHide: panelDidHide, + width: inOverflowMenu ? overflowMenuWidth : 300, + height: startheight + }); + }); + } + + /** + * Show the logged-out state / sign-up panel + */ + function saveAndShowConfirmation(url, title) { + + // Validate input parameter + if (typeof url !== 'undefined' && url.startsWith("about:reader?url=")) { + url = ReaderMode.getOriginalUrl(url); + } + + var isValidURL = (typeof url !== 'undefined' && (url.startsWith("http") || url.startsWith('https'))); + + var inOverflowMenu = isInOverflowMenu(); + var startheight = pktApi.isPremiumUser() && isValidURL ? savePanelHeights.expanded : savePanelHeights.collapsed; + if (inOverflowMenu) { + startheight = overflowMenuHeight; + } + + var panelId = showPanel("about:pocket-saved?pockethost=" + Services.prefs.getCharPref("extensions.pocket.site") + "&premiumStatus=" + (pktApi.isPremiumUser() ? '1' : '0') + '&inoverflowmenu='+inOverflowMenu + "&locale=" + getUILocale(), { + onShow: function() { + var saveLinkMessageId = 'saveLink'; + + // Send error message for invalid url + if (!isValidURL) { + // TODO: Pass key for localized error in error object + let error = { + message: 'Only links can be saved', + localizedKey: "onlylinkssaved" + }; + pktUIMessaging.sendErrorMessageToPanel(panelId, saveLinkMessageId, error); + return; + } + + // Check online state + if (!navigator.onLine) { + // TODO: Pass key for localized error in error object + let error = { + message: 'You must be connected to the Internet in order to save to Pocket. Please connect to the Internet and try again.' + }; + pktUIMessaging.sendErrorMessageToPanel(panelId, saveLinkMessageId, error); + return; + } + + // Add url + var options = { + success: function(data, request) { + var item = data.item; + var successResponse = { + status: "success", + item: item + }; + pktUIMessaging.sendMessageToPanel(panelId, saveLinkMessageId, successResponse); + }, + error: function(error, request) { + // If user is not authorized show singup page + if (request.status === 401) { + showSignUp(); + return; + } + + // If there is no error message in the error use a + // complete catch-all + var errorMessage = error.message || "There was an error when trying to save to Pocket."; + var panelError = { message: errorMessage} + + // Send error message to panel + pktUIMessaging.sendErrorMessageToPanel(panelId, saveLinkMessageId, panelError); + } + } + + // Add title if given + if (typeof title !== "undefined") { + options.title = title; + } + + // Send the link + pktApi.addLink(url, options); + }, + onHide: panelDidHide, + width: inOverflowMenu ? overflowMenuWidth : savePanelWidth, + height: startheight + }); + } + + /** + * Open a generic panel + */ + function showPanel(url, options) { + + // Add new panel id + _panelId += 1; + url += ("&panelId=" + _panelId); + + // We don't have to hide and show the panel again if it's already shown + // as if the user tries to click again on the toolbar button the overlay + // will close instead of the button will be clicked + var iframe = getPanelFrame(); + + // Register event handlers + registerEventMessages(); + + // Load the iframe + iframe.setAttribute('src', url); + + // Uncomment to leave panel open -- for debugging + // panel.setAttribute('noautohide', true); + // panel.setAttribute('consumeoutsideclicks', false); + // + + // For some reason setting onpopupshown and onpopuphidden on the panel directly didn't work, so + // do it this hacky way for now + _currentPanelDidShow = options.onShow; + _currentPanelDidHide = options.onHide; + + resizePanel({ + width: options.width, + height: options.height + }); + return _panelId; + } + + /** + * Resize the panel + * options = { + * width: , + * height: , + * animate [default false] + * } + */ + function resizePanel(options) { + var iframe = getPanelFrame(); + var subview = getSubview(); + + if (subview) { + // Use the subview's size + iframe.style.width = "100%"; + iframe.style.height = subview.parentNode.clientHeight + "px"; + } else { + // Set an explicit size, panel will adapt. + iframe.style.width = options.width + "px"; + iframe.style.height = options.height + "px"; + } + } + + /** + * Called when the signup and saved panel was hidden + */ + function panelDidHide() { + // clear the onShow and onHide values + _currentPanelDidShow = null; + _currentPanelDidHide = null; + } + + /** + * Register all of the messages needed for the panels + */ + function registerEventMessages() { + var iframe = getPanelFrame(); + + // Only register the messages once + var didInitAttributeKey = 'did_init'; + var didInitMessageListener = iframe.getAttribute(didInitAttributeKey); + if (typeof didInitMessageListener !== "undefined" && didInitMessageListener == 1) { + return; + } + iframe.setAttribute(didInitAttributeKey, 1); + + // When the panel is displayed it generated an event called + // "show": we will listen for that event and when it happens, + // send our own "show" event to the panel's script, so the + // script can prepare the panel for display. + var _showMessageId = "show"; + pktUIMessaging.addMessageListener(iframe, _showMessageId, function(panelId, data) { + // Let panel know that it is ready + pktUIMessaging.sendMessageToPanel(panelId, _showMessageId); + }); + + // Open a new tab with a given url and activate if + var _openTabWithUrlMessageId = "openTabWithUrl"; + pktUIMessaging.addMessageListener(iframe, _openTabWithUrlMessageId, function(panelId, data, contentPrincipal) { + try { + urlSecurityCheck(data.url, contentPrincipal, Services.scriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL); + } catch (ex) { + return; + } + + // Check if the tab should become active after opening + var activate = true; + if (typeof data.activate !== "undefined") { + activate = data.activate; + } + + var url = data.url; + openTabWithUrl(url, activate); + pktUIMessaging.sendResponseMessageToPanel(panelId, _openTabWithUrlMessageId, url); + }); + + // Close the panel + var _closeMessageId = "close"; + pktUIMessaging.addMessageListener(iframe, _closeMessageId, function(panelId, data) { + getPanel().hidePopup(); + }); + + // Send the current url to the panel + var _getCurrentURLMessageId = "getCurrentURL"; + pktUIMessaging.addMessageListener(iframe, _getCurrentURLMessageId, function(panelId, data) { + pktUIMessaging.sendResponseMessageToPanel(panelId, _getCurrentURLMessageId, getCurrentUrl()); + }); + + var _resizePanelMessageId = "resizePanel"; + pktUIMessaging.addMessageListener(iframe, _resizePanelMessageId, function(panelId, data) { + resizePanel(data); + }); + + // Callback post initialization to tell background script that panel is "ready" for communication. + pktUIMessaging.addMessageListener(iframe, "listenerReady", function(panelId, data) { + + }); + + pktUIMessaging.addMessageListener(iframe, "collapseSavePanel", function(panelId, data) { + if (!pktApi.isPremiumUser() && !isInOverflowMenu()) + resizePanel({width:savePanelWidth, height:savePanelHeights.collapsed}); + }); + + pktUIMessaging.addMessageListener(iframe, "expandSavePanel", function(panelId, data) { + if (!isInOverflowMenu()) + resizePanel({width:savePanelWidth, height:savePanelHeights.expanded}); + }); + + // Ask for recently accessed/used tags for auto complete + var _getTagsMessageId = "getTags"; + pktUIMessaging.addMessageListener(iframe, _getTagsMessageId, function(panelId, data) { + pktApi.getTags(function(tags, usedTags) { + pktUIMessaging.sendResponseMessageToPanel(panelId, _getTagsMessageId, { + tags: tags, + usedTags: usedTags + }); + }); + }); + + // Ask for suggested tags based on passed url + var _getSuggestedTagsMessageId = "getSuggestedTags"; + pktUIMessaging.addMessageListener(iframe, _getSuggestedTagsMessageId, function(panelId, data) { + pktApi.getSuggestedTagsForURL(data.url, { + success: function(data, response) { + var suggestedTags = data.suggested_tags; + var successResponse = { + status: "success", + value: { + suggestedTags: suggestedTags + } + } + pktUIMessaging.sendResponseMessageToPanel(panelId, _getSuggestedTagsMessageId, successResponse); + }, + error: function(error, response) { + pktUIMessaging.sendErrorResponseMessageToPanel(panelId, _getSuggestedTagsMessageId, error); + } + }) + }); + + // Pass url and array list of tags, add to existing save item accordingly + var _addTagsMessageId = "addTags"; + pktUIMessaging.addMessageListener(iframe, _addTagsMessageId, function(panelId, data) { + pktApi.addTagsToURL(data.url, data.tags, { + success: function(data, response) { + var successResponse = {status: "success"}; + pktUIMessaging.sendResponseMessageToPanel(panelId, _addTagsMessageId, successResponse); + }, + error: function(error, response) { + pktUIMessaging.sendErrorResponseMessageToPanel(panelId, _addTagsMessageId, error); + } + }); + }); + + // Based on clicking "remove page" CTA, and passed unique item id, remove the item + var _deleteItemMessageId = "deleteItem"; + pktUIMessaging.addMessageListener(iframe, _deleteItemMessageId, function(panelId, data) { + pktApi.deleteItem(data.itemId, { + success: function(data, response) { + var successResponse = {status: "success"}; + pktUIMessaging.sendResponseMessageToPanel(panelId, _deleteItemMessageId, successResponse); + }, + error: function(error, response) { + pktUIMessaging.sendErrorResponseMessageToPanel(panelId, _deleteItemMessageId, error); + } + }) + }); + + var _initL10NMessageId = "initL10N"; + pktUIMessaging.addMessageListener(iframe, _initL10NMessageId, function(panelId, data) { + var strings = {}; + var bundle = Services.strings.createBundle("chrome://pocket/locale/pocket.properties"); + var e = bundle.getSimpleEnumeration(); + while (e.hasMoreElements()) { + var str = e.getNext().QueryInterface(Components.interfaces.nsIPropertyElement); + if (str.key in data) { + strings[str.key] = bundle.formatStringFromName(str.key, data[str.key], data[str.key].length); + } else { + strings[str.key] = str.value; + } + } + pktUIMessaging.sendResponseMessageToPanel(panelId, _initL10NMessageId, { strings: strings }); + }); + + } + + // -- Browser Navigation -- // + + /** + * Open a new tab with a given url and notify the iframe panel that it was opened + */ + + function openTabWithUrl(url) { + let recentWindow = Services.wm.getMostRecentWindow("navigator:browser"); + if (!recentWindow) { + Cu.reportError("Pocket: No open browser windows to openTabWithUrl"); + return; + } + + // If the user is in permanent private browsing than this is not an issue, + // since the current window will always share the same cookie jar as the other + // windows. + if (!PrivateBrowsingUtils.isWindowPrivate(recentWindow) || + PrivateBrowsingUtils.permanentPrivateBrowsing) { + recentWindow.openUILinkIn(url, "tab"); + return; + } + + let windows = Services.wm.getEnumerator("navigator:browser"); + while (windows.hasMoreElements()) { + let win = windows.getNext(); + if (!PrivateBrowsingUtils.isWindowPrivate(win)) { + win.openUILinkIn(url, "tab"); + return; + } + } + + // If there were no non-private windows opened already. + recentWindow.openUILinkIn(url, "window"); + } + + + // -- Helper Functions -- // + + function getCurrentUrl() { + return getBrowser().currentURI.spec; + } + + function getCurrentTitle() { + return getBrowser().contentTitle; + } + + function getPanel() { + var frame = getPanelFrame(); + var panel = frame; + while (panel && panel.localName != "panel") { + panel = panel.parentNode; + } + return panel; + } + + function getPanelFrame() { + var frame = document.getElementById('pocket-panel-iframe'); + if (!frame) { + var frameParent = document.getElementById("PanelUI-pocketView").firstChild; + frame = document.createElement("iframe"); + frame.id = 'pocket-panel-iframe'; + frame.setAttribute("type", "content"); + frameParent.appendChild(frame); + } + return frame; + } + + function getSubview() { + var view = document.getElementById("PanelUI-pocketView"); + if (view && view.getAttribute("current") == "true") + return view; + return null; + } + + function isInOverflowMenu() { + var subview = getSubview(); + return !!subview; + } + + function getFirefoxAccountSignedInUser(callback) { + fxAccounts.getSignedInUser().then(userData => { + callback(userData); + }).then(null, error => { + callback(); + }); + } + + function getUILocale() { + var locale = Cc["@mozilla.org/chrome/chrome-registry;1"]. + getService(Ci.nsIXULChromeRegistry). + getSelectedLocale("browser"); + return locale; + } + + /** + * Public functions + */ + return { + getPanelFrame: getPanelFrame, + + openTabWithUrl: openTabWithUrl, + + pocketPanelDidShow: pocketPanelDidShow, + pocketPanelDidHide: pocketPanelDidHide, + + tryToSaveUrl: tryToSaveUrl, + tryToSaveCurrentPage: tryToSaveCurrentPage + }; +}()); + +// -- Communication to Background -- // +// https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Interaction_between_privileged_and_non-privileged_pages +var pktUIMessaging = (function() { + + /** + * Prefix message id for message listening + */ + function prefixedMessageId(messageId) { + return 'PKT_' + messageId; + } + + /** + * Register a listener and callback for a specific messageId + */ + function addMessageListener(iframe, messageId, callback) { + iframe.addEventListener(prefixedMessageId(messageId), function(e) { + var nodePrincipal = e.target.nodePrincipal; + // ignore to ensure we do not pick up other events in the browser + if (!nodePrincipal || !nodePrincipal.URI || !nodePrincipal.URI.spec.startsWith("about:pocket")) { + return; + } + + // Pass in information to callback + var payload = JSON.parse(e.target.getAttribute("payload"))[0]; + var panelId = payload.panelId; + var data = payload.data; + callback(panelId, data, nodePrincipal); + + // Cleanup the element + e.target.parentNode.removeChild(e.target); + + }, false, true); + } + + /** + * Send a message to the panel's iframe + */ + function sendMessageToPanel(panelId, messageId, payload) { + + if (!isPanelIdValid(panelId)) { return; } + + var panelFrame = pktUI.getPanelFrame(); + if (!isPocketPanelFrameValid(panelFrame)) { return; } + + var doc = panelFrame.contentWindow.document; + var documentElement = doc.documentElement; + + // Send message to panel + var panelMessageId = prefixedMessageId(panelId + '_' + messageId); + + var AnswerEvt = doc.createElement("PKTMessage"); + AnswerEvt.setAttribute("payload", JSON.stringify([payload])); + documentElement.appendChild(AnswerEvt); + + var event = doc.createEvent("HTMLEvents"); + event.initEvent(panelMessageId, true, false); + AnswerEvt.dispatchEvent(event); + } + + function sendResponseMessageToPanel(panelId, messageId, payload) { + var responseMessageId = messageId + "Response"; + sendMessageToPanel(panelId, responseMessageId, payload); + } + + /** + * Helper function to package an error object and send it to the panel + * iframe as a message response + */ + function sendErrorMessageToPanel(panelId, messageId, error) { + var errorResponse = {status: "error", error: error}; + sendMessageToPanel(panelId, messageId, errorResponse); + } + + function sendErrorResponseMessageToPanel(panelId, messageId, error) { + var errorResponse = {status: "error", error: error}; + sendResponseMessageToPanel(panelId, messageId, errorResponse); + } + + /** + * Validation + */ + + function isPanelIdValid(panelId) { + // First check if panelId has a valid value > 0. We set the panelId to + // 0 to start. But if for some reason the message is attempted to be + // sent before the panel has a panelId, then it's going to send out + // a message with panelId 0, which is never going to be heard. If this + // happens, it means some race condition occurred where the panel was + // trying to communicate before it should. + if (panelId === 0) { + console.warn("Tried to send message to panel with id 0.") + return false; + } + + return true + } + + function isPocketPanelFrameValid(panelFrame) { + // Check if panel is available if not throw a warning and bailout. + // We likely try to send to a panel that is not visible anymore + if (typeof panelFrame === "undefined") { + console.warn("Pocket panel frame is undefined"); + return false; + } + + var contentWindow = panelFrame.contentWindow; + if (typeof contentWindow == "undefined") { + console.warn("Pocket panel frame content window is undefined"); + return false; + } + + var doc = contentWindow.document; + if (typeof doc === "undefined") { + console.warn("Pocket panel frame content window document is undefined"); + return false; + } + + var documentElement = doc.documentElement; + if (typeof documentElement === "undefined") { + console.warn("Pocket panel frame content window document document element is undefined"); + return false; + } + + return true; + } + + /** + * Public + */ + return { + addMessageListener: addMessageListener, + sendMessageToPanel: sendMessageToPanel, + sendResponseMessageToPanel: sendResponseMessageToPanel, + sendErrorMessageToPanel: sendErrorMessageToPanel, + sendErrorResponseMessageToPanel: sendErrorResponseMessageToPanel + } +}()); diff --git a/browser/extensions/pocket/content/panels/css/firasans.css b/browser/extensions/pocket/content/panels/css/firasans.css new file mode 100644 index 000000000..5915345d6 --- /dev/null +++ b/browser/extensions/pocket/content/panels/css/firasans.css @@ -0,0 +1,6 @@ +@font-face { + font-family: 'FiraSans'; + src: url('../fonts/FiraSans-Regular.woff') format('woff'); + font-weight: normal; + font-style: normal; +} \ No newline at end of file diff --git a/browser/extensions/pocket/content/panels/css/normalize.css b/browser/extensions/pocket/content/panels/css/normalize.css new file mode 100644 index 000000000..b7b4b746e --- /dev/null +++ b/browser/extensions/pocket/content/panels/css/normalize.css @@ -0,0 +1,424 @@ +/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ + +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-family: sans-serif; /* 1 */ +} + +/** + * Remove default margin. + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; +} + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ + +audio, +canvas, +progress, +video { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. + */ + +[hidden], +template { + display: none; +} + +/* Links + ========================================================================== */ + +/** + * Remove the gray background color from active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +/** + * Address styling not present in Safari and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** + * Address styling not present in IE 8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove border when inside `a` element in IE 8/9/10. + */ + +img { + border: 0; +} + +/** + * Correct overflow not hidden in IE 9/10/11. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * Address margin not present in IE 8/9 and Safari. + */ + +figure { + margin: 1em 40px; +} + +/** + * Address differences between Firefox and other browsers. + */ + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +/** + * Contain overflow in all browsers. + */ + +pre { + overflow: auto; +} + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} + +/* Forms + ========================================================================== */ + +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ + +button, +input, +optgroup, +select, +textarea { + color: inherit; /* 1 */ + font: inherit; /* 2 */ + margin: 0; /* 3 */ +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ + +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + cursor: pointer; /* 3 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * Remove inner padding and border in Firefox 4+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +input { + line-height: normal; +} + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome + * (include `-moz` to future-proof). + */ + +input[type="search"] { + box-sizing: content-box; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ + +legend { + border: 0; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ + +textarea { + overflow: auto; +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ + +optgroup { + font-weight: bold; +} + +/* Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +td, +th { + padding: 0; +} + +/* Normalization for FF panel defauts + ========================================================================== */ +html { + outline: none; + padding: 0; +} + +a { + color: #0095dd; + margin: 0; + outline: none; + padding: 0; + text-decoration: none; +} + +a:hover, +a:active { + color: #008acb; + text-decoration: underline; +} + +a:active { + color: #006b9d; +} diff --git a/browser/extensions/pocket/content/panels/css/saved.css b/browser/extensions/pocket/content/panels/css/saved.css new file mode 100644 index 000000000..d3f88d04c --- /dev/null +++ b/browser/extensions/pocket/content/panels/css/saved.css @@ -0,0 +1,825 @@ +/* saved.css + * + * Description: + * With base elements out of the way, this sets all custom styling for the page saved dialog. + * + * Contents: + * Global + * Loading spinner + * Core detail + * Tag entry + * Recent/suggested tags + * Premium upsell + * Token input/autocomplete + * Overflow mode + * Language overrides + */ + +/*=Global +--------------------------------------------------------------------------------------- */ +.pkt_ext_containersaved { + background-color: #fbfbfb; + border-radius: 4px; + display: block; + font-size: 16px; + font-family: "FiraSans", "Helvetica Neue", Helvetica, Arial, sans-serif; + padding: 0; + position: relative; + text-align: center; +} +.pkt_ext_cf:after { + content: " "; + display:table; + clear:both; +} +.pkt_ext_containersaved .pkt_ext_tag_detail, +.pkt_ext_containersaved .pkt_ext_recenttag_detail, +.pkt_ext_containersaved .pkt_ext_suggestedtag_detail { + margin: 0 auto; + padding: 0.25em 1em; + position: relative; + width: auto; +} + +/*=Loading spinner +--------------------------------------------------------------------------------------- */ +@keyframes pkt_ext_spin { + to { + transform: rotate(1turn); + } +} +.pkt_ext_containersaved { + font-size: 16px; +} +.pkt_ext_containersaved .pkt_ext_loadingspinner { + position: relative; + display: inline-block; + height: 2.5em; + left: 50%; + margin: 2em 0 0 -1.25em; + font-size: 10px; + text-indent: 999em; + position: absolute; + top: 4em; + overflow: hidden; + width: 2.5em; + animation: pkt_ext_spin 0.7s infinite steps(8); +} +.pkt_ext_containersaved .pkt_ext_loadingspinner:before, +.pkt_ext_containersaved .pkt_ext_loadingspinner:after, +.pkt_ext_containersaved .pkt_ext_loadingspinner > div:before, +.pkt_ext_containersaved .pkt_ext_loadingspinner > div:after { + content: ''; + position: absolute; + top: 0; + left: 1.125em; + width: 0.25em; + height: 0.75em; + border-radius: .2em; + background: #eee; + box-shadow: 0 1.75em #eee; + transform-origin: 50% 1.25em; +} +.pkt_ext_containersaved .pkt_ext_loadingspinner:before { + background: #555; +} +.pkt_ext_containersaved .pkt_ext_loadingspinner:after { + transform: rotate(-45deg); + background: #777; +} +.pkt_ext_containersaved .pkt_ext_loadingspinner > div:before { + transform: rotate(-90deg); + background: #999; +} +.pkt_ext_containersaved .pkt_ext_loadingspinner > div:after { + transform: rotate(-135deg); + background: #bbb; +} + +/*=Core detail +--------------------------------------------------------------------------------------- */ +.pkt_ext_containersaved .pkt_ext_initload { + left: 0; + position: absolute; + top: 0; + width: 100%; +} +.pkt_ext_containersaved .pkt_ext_detail { + max-height: 0; + opacity: 0; + position: relative; + z-index: 10; +} +.pkt_ext_container_detailactive .pkt_ext_initload { + opacity: 0; +} +.pkt_ext_container_detailactive .pkt_ext_initload .pkt_ext_loadingspinner, +.pkt_ext_container_finalstate .pkt_ext_initload .pkt_ext_loadingspinner { + animation: none; +} +.pkt_ext_container_detailactive .pkt_ext_detail { + max-height: 20em; + opacity: 1; +} +.pkt_ext_container_finalstate .pkt_ext_edit_msg, +.pkt_ext_container_finalstate .pkt_ext_tag_detail, +.pkt_ext_container_finalstate .pkt_ext_suggestedtag_detail, +.pkt_ext_container_finalstate .pkt_ext_item_actions { + opacity: 0; + transition: opacity 0.2s ease-out; +} +.pkt_ext_container_finalerrorstate .pkt_ext_edit_msg, +.pkt_ext_container_finalerrorstate .pkt_ext_tag_detail, +.pkt_ext_container_finalerrorstate .pkt_ext_suggestedtag_detail, +.pkt_ext_container_finalerrorstate .pkt_ext_item_actions { + display: none; + transition: none; +} +.pkt_ext_containersaved h2 { + background: transparent; + border: none; + color: #333; + display: block; + float: none; + font-size: 18px; + font-weight: normal; + letter-spacing: normal; + line-height: 1; + margin: 19px 0 4px; + padding: 0; + position: relative; + text-align: left; + text-transform: none; +} +@keyframes fade_in_out { + 0% { + opacity: 1; + } + 50% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +.pkt_ext_container_finalstate h2 { + animation: fade_in_out 0.4s ease-out; +} +.pkt_ext_container_finalerrorstate h2 { + animation: none; + color: #d74345; +} +.pkt_ext_containersaved .pkt_ext_errordetail { + display: none; + font-size: 12px; + font-weight: normal; + left: 6.4em; + max-width: 21em; + opacity: 0; + position: absolute; + top: 2.7em; + text-align: left; + visibility: hidden; +} +.pkt_ext_container_finalerrorstate .pkt_ext_errordetail { + display: block; + opacity: 1; + visibility: visible; +} +.pkt_ext_containersaved .pkt_ext_logo { + background: url(../img/pocketlogosolo@1x.png) center center no-repeat; + display: block; + float: left; + height: 40px; + padding: 1.25em 1em; + position: relative; + width: 44px; +} +@media (min-resolution: 1.1dppx) { + .pkt_ext_containersaved .pkt_ext_logo { + background-image: url(../img/pocketlogosolo@2x.png); + background-size: 44px 40px; + } +} +.pkt_ext_container_finalerrorstate .pkt_ext_logo { + background-image: url(../img/pocketerror@1x.png); + height: 44px; + width: 44px; +} +@media (min-resolution: 1.1dppx) { + .pkt_ext_container_finalerrorstate .pkt_ext_logo { + background-image: url(../img/pocketerror@2x.png); + background-size: 44px 44px; + } +} +.pkt_ext_containersaved .pkt_ext_topdetail { + float: left; +} +.pkt_ext_containersaved .pkt_ext_edit_msg { + box-sizing: border-box; + display: none; + font-size: 0.75em; + left: auto; + padding: 0 1.4em; + position: absolute; + text-align: left; + top: 8.7em; + width: 100%; +} +.pkt_ext_containersaved .pkt_ext_edit_msg_error { + color: #d74345; +} +.pkt_ext_containersaved .pkt_ext_edit_msg_active { + display: block; +} +.pkt_ext_containersaved .pkt_ext_item_actions { + background: transparent; + float: none; + height: auto; + margin-bottom: 1em; + margin-top: 0; + width: auto; +} +.pkt_ext_containersaved .pkt_ext_item_actions_disabled { + opacity: 0.5; +} +.pkt_ext_container_finalstate .pkt_ext_item_actions_disabled { + opacity: 0; +} +.pkt_ext_containersaved .pkt_ext_item_actions ul { + background: none; + display: block; + float: none; + font-size: 16px; + height: auto; + margin: 0; + padding: 0; + width: 100%; +} +.pkt_ext_containersaved .pkt_ext_item_actions li { + box-sizing: border-box; + background: none; + border: 0; + float: left; + list-style: none; + line-height: 0.8; + height: auto; + padding-right: 0.4em; + width: auto; +} +.pkt_ext_containersaved .pkt_ext_item_actions li:before { + content: none; +} +.pkt_ext_containersaved .pkt_ext_item_actions .pkt_ext_actions_separator { + border-left: 2px solid #777; + height: 0.75em; + margin-top: 0.3em; + padding: 0; + width: 10px; +} +.pkt_ext_containersaved .pkt_ext_item_actions a { + background: transparent; + color: #0095dd; + display: block; + font-feature-settings: normal; + font-size: 12px; + font-weight: normal; + letter-spacing: normal; + line-height: inherit; + height: auto; + margin: 0; + padding: 0.5em; + float: left; + text-align: left; + text-decoration: none; + text-transform: none; +} +.pkt_ext_containersaved .pkt_ext_item_actions a:hover { + color: #008acb; + text-decoration: underline; +} +.pkt_ext_containersaved .pkt_ext_item_actions a:before, +.pkt_ext_containersaved .pkt_ext_item_actions a:after { + background: transparent; + display: none; +} +.pkt_ext_containersaved .pkt_ext_item_actions_disabled a { + cursor: default; +} +.pkt_ext_containersaved .pkt_ext_item_actions .pkt_ext_openpocket { + float: right; + padding-right: 0.7em; + text-align: right; +} +.pkt_ext_containersaved .pkt_ext_item_actions .pkt_ext_removeitem { + padding-left: 0; +} +.pkt_ext_containersaved .pkt_ext_close { + background: url(../img/tag_close@1x.png) center center no-repeat; + color: #333; + display: block; + font-size: 0.8em; + height: 10px; + right: 0.5em; + overflow: hidden; + position: absolute; + text-align: center; + text-indent: -9999px; + top: -1em; + width: 10px; +} +@media (min-resolution: 1.1dppx) { + .pkt_ext_containersaved .pkt_ext_close { + background-image: url(../img/tag_close@2x.png); + background-size: 8px 8px; + } +} +.pkt_ext_containersaved .pkt_ext_close:hover { + color: #000; + text-decoration: none; +} + +/*=Tag entry +--------------------------------------------------------------------------------------- */ +.pkt_ext_containersaved .pkt_ext_tag_detail { + border: 1px solid #c1c1c1; + border-radius: 2px; + font-size: 16px; + clear: both; + margin: 1.25em 1em; + padding: 0; + display: flex; +} +.pkt_ext_containersaved .pkt_ext_tag_error { + border: none; +} +.pkt_ext_containersaved .pkt_ext_tag_input_wrapper { + box-sizing: border-box; + flex: 1; + background-color: #fff; + border-right: 1px solid #c3c3c3; + color: #333; + display: block; + float: none; + font-size: 0.875em; + list-style: none; + margin: 0; + overflow: hidden; + padding: 0.25em 0.5em; + width: 14em; + padding-left: 0.5em; + padding-right: 0.5em; +} +.pkt_ext_containersaved .pkt_ext_tag_error .pkt_ext_tag_input_wrapper { + border: 1px solid #d74345; +} +.pkt_ext_containersaved .pkt_ext_tag_input_wrapper .token-input-list { + display: block; + left: 0; + height: 1.7em; + overflow: hidden; + position: relative; + width: 60em; +} +.pkt_ext_containersaved .pkt_ext_tag_input_wrapper .token-input-list, +.pkt_ext_containersaved .pkt_ext_tag_input_wrapper li { + font-size: 14px; +} +.pkt_ext_containersaved .pkt_ext_tag_input_wrapper li { + height: auto; + width: auto; +} +.pkt_ext_containersaved .pkt_ext_tag_input_wrapper li:before { + content: none; +} +.pkt_ext_containersaved .pkt_ext_tag_input_wrapper input { + border: 0; + box-shadow: none; + background-color: #fff; + color: #333; + font-size: 14px; + float: left; + line-height: normal; + height: auto; + min-height: 0; + min-width: 5em; + padding: 3px 2px 1px; + text-transform: none; +} +.pkt_ext_containersaved .pkt_ext_tag_input_wrapper input::placeholder { + color: #a9a9a9; + letter-spacing: normal; + text-transform: none; +} +.pkt_ext_containersaved .input_disabled { + cursor: default; + opacity: 0.5; +} +.pkt_ext_containersaved .pkt_ext_btn { + box-sizing: border-box; + color: #333; + float: none; + font-size: 0.875em; + font-size: 14px; + letter-spacing: normal; + height: 2.2em; + min-width: 4em; + padding: 0.5em 0; + text-decoration: none; + text-transform: none; + width: auto; +} +.pkt_ext_containersaved .pkt_ext_btn:hover { + background-color: #ebebeb; +} +.pkt_ext_containersaved .pkt_ext_btn:active { + background-color: #dadada; +} +.pkt_ext_containersaved .pkt_ext_btn_disabled, +.pkt_ext_containersaved .pkt_ext_btn_disabled:hover, +.pkt_ext_containersaved .pkt_ext_btn_disabled:active { + background-color: transparent; + cursor: default; + opacity: 0.4; +} +.pkt_ext_containersaved .pkt_ext_tag_error .pkt_ext_btn { + border: 1px solid #c3c3c3; + border-width: 1px 1px 1px 0; + height: 2.35em; +} +.pkt_ext_containersaved .autocomplete-suggestions { + margin-top: 2.2em; +} + +/*=Recent/suggested tags +--------------------------------------------------------------------------------------- */ +.pkt_ext_containersaved .pkt_ext_suggestedtag_detail, +.pkt_ext_containersaved .pkt_ext_suggestedtag_detailshown { + border-top: 1px solid #c1c1c1; + bottom: 0; + box-sizing: border-box; + background: #ebebeb; + clear: both; + left: 0; + opacity: 0; + min-height: 110px; + position: fixed; + visibility: hidden; + width: 100%; +} +.pkt_ext_container_detailactive .pkt_ext_suggestedtag_detail, +.pkt_ext_containersaved .pkt_ext_suggestedtag_detailshown { + opacity: 1; + visibility: visible; +} +.pkt_ext_containersaved .pkt_ext_suggestedtag_detailshown { + padding: 4px 0; +} +.pkt_ext_container_finalstate .pkt_ext_suggestedtag_detail { + opacity: 0; + visibility: hidden; +} +.pkt_ext_containersaved +.pkt_ext_containersaved .pkt_ext_recenttag_detail h4, +.pkt_ext_containersaved .pkt_ext_suggestedtag_detail h4 { + color: #333; + font-size: 0.8125em; + font-size: 13px; + font-weight: normal; + font-style: normal; + letter-spacing: normal; + margin: 0.5em 0; + text-align: left; + text-transform: none; +} +.pkt_ext_containersaved .pkt_ext_recenttag_detail .pkt_ext_loadingspinner, +.pkt_ext_containersaved .pkt_ext_suggestedtag_detail .pkt_ext_loadingspinner { + display: none; + position: absolute; +} +.pkt_ext_containersaved .pkt_ext_recenttag_detail_loading .pkt_ext_loadingspinner, +.pkt_ext_containersaved .pkt_ext_suggestedtag_detail_loading .pkt_ext_loadingspinner { + display: block; + font-size: 6px; + left: 48%; +} +.pkt_ext_containersaved .pkt_ext_recenttag_detail ul, +.pkt_ext_containersaved .pkt_ext_suggestedtag_detail ul { + display: block; + margin: 0; + height: 2em; + overflow: hidden; + padding: 2px 0 0 0; +} +.pkt_ext_containersaved .pkt_ext_suggestedtag_detail ul { + height: auto; + margin: 0; + max-height: 4em; + padding-top: 6px; +} +.pkt_ext_containersaved .pkt_ext_recenttag_detail li, +.pkt_ext_containersaved .pkt_ext_suggestedtag_detail li { + background: none; + float: left; + height: inherit; + line-height: 1.5; + list-style: none; + margin-bottom: 0.5em; + width: inherit; +} +.pkt_ext_containersaved .pkt_ext_recenttag_detail li:before, +.pkt_ext_containersaved .pkt_ext_suggestedtag_detail li:before { + content: none; +} +.pkt_ext_containersaved .pkt_ext_recenttag_detail .recenttag_msg, +.pkt_ext_containersaved .pkt_ext_suggestedtag_detail .suggestedtag_msg { + color: #333; + font-size: 0.8125em; + line-height: 1.2; + left: auto; + position: absolute; + text-align: left; + top: 2em; +} +.pkt_ext_containersaved .pkt_ext_suggestedtag_detail .suggestedtag_msg { + margin-right: 1.3em; +} +.pkt_ext_containersaved .token_tag { + border-radius: 4px; + background: #f7f7f7; + border: 1px solid #c3c3c3; + color: #333; + font-size: 0.875em; + font-size: 14px; + font-weight: normal; + letter-spacing: normal; + margin-right: 0.5em; + padding: 0.125em 0.625em; + text-decoration: none; + text-transform: none; +} +.pkt_ext_containersaved .token_tag:hover { + background-color: #008acb; + border-color: #008acb; + color: #fff; + text-decoration: none; +} +.pkt_ext_containersaved .token_tag:before, +.pkt_ext_containersaved .token_tag:after { + content: none; +} +.pkt_ext_containersaved .token_tag:hover span { + background-image: url(../img/tag_closeactive@1x.png); +} +@media (min-resolution: 1.1dppx) { + .pkt_ext_containersaved .token_tag:hover span { + background-image: url(../img/tag_closeactive@2x.png); + background-size: 8px 8px; + } +} +.pkt_ext_containersaved .pkt_ext_recenttag_detail_disabled .token_tag, +.pkt_ext_containersaved .pkt_ext_recenttag_detail_disabled .token_tag:hover, +.pkt_ext_containersaved .pkt_ext_suggestedtag_detail_disabled .token_tag, +.pkt_ext_containersaved .pkt_ext_suggestedtag_detail_disabled .token_tag:hover { + background-color: #f7f7f7; + cursor: default; + opacity: 0.5; +} +.pkt_ext_containersaved .token_tag_inactive { + display: none; +} + +/*=Premium upsell +--------------------------------------------------------------------------------------- */ +.pkt_ext_detail .pkt_ext_premupsell { + background-color: #50bbb6; + display: block; + padding: 1.5em 0; + text-align: center; +} +.pkt_ext_premupsell h4 { + color: #fff; + font-size: 1em; + margin-bottom: 1em; +} +.pkt_ext_premupsell a { + color: #28605d; + border-bottom: 1px solid #47a7a3; + font-weight: normal; +} +.pkt_ext_premupsell a:hover { + color: #14302f; +} + +/*=Token input/autocomplete +--------------------------------------------------------------------------------------- */ +.token-input-dropdown-tag { + border-radius: 4px; + box-sizing: border-box; + background: #fff; + border: 1px solid #cdcdcd; + margin-top: 0.5em; + left: 0 !important; + overflow-y: auto; + top: 1.9em !important; + z-index: 9000; +} +.token-input-dropdown-tag ul { + height: inherit; + max-height: 115px; + margin: 0; + overflow: auto; + padding: 0.5em 0; +} +.token-input-dropdown-tag ul li { + background: none; + color: #333; + font-weight: normal; + font-size: 1em; + float: none; + height: inherit; + letter-spacing: normal; + list-style: none; + padding: 0.75em; + text-align: left; + text-transform: none; + width: inherit; +} +.token-input-dropdown-tag ul li:before { + content: none; +} +.token-input-dropdown ul li.token-input-selected-dropdown-item { + background-color: #008acb; + color: #fff; +} +.token-input-list { + list-style: none; + margin: 0; + padding: 0; +} +.token-input-list li { + text-align: left; + list-style: none; +} +.token-input-list li input { + border: 0; + background-color: white; +} +.pkt_ext_containersaved .token-input-token { + background: none; + border-radius: 4px; + border: 1px solid #c3c3c3; + overflow: hidden; + margin: 0; + padding: 0 8px; + background-color: #f7f7f7; + color: #000; + font-weight: normal; + cursor: default; + line-height: 1.5; + display: block; + width: auto; + margin: 0 0.2em; + float: left; +} +.pkt_ext_containersaved .pkt_ext_tag_input_wrapper_disabled { + position: relative; +} +.pkt_ext_containersaved .pkt_ext_tag_input_wrapper_disabled input { + opacity: 0.5; +} +.pkt_ext_containersaved .pkt_ext_tag_input_wrapper_disabled .token-input-list { + opacity: 0.5; +} +.pkt_ext_containersaved .pkt_ext_tag_input_wrapper_disabled .pkt_ext_tag_input_blocker { + height: 100%; + left: 0; + position: absolute; + top: 0; + width: 100%; + z-index: 5; +} +.pkt_ext_containersaved .token-input-token p { + display: inline-block; + font-size: 14px; + font-weight: normal; + line-height: inherit; + letter-spacing: normal; + padding: 0; + margin: 0; + text-transform: none; + vertical-align: top; + width: auto; +} +.pkt_ext_containersaved .token-input-token p:before { + content: none; + width: 0; +} +.pkt_ext_containersaved .token-input-token span { + background: url(../img/tag_close@1x.png) center center no-repeat; + cursor: pointer; + display: inline-block; + height: 8px; + margin: 0 0 0 8px; + overflow: hidden; + width: 8px; + text-indent: -99px; +} +@media (min-resolution: 1.1dppx) { + .pkt_ext_containersaved .token-input-token span { + background-image: url(../img/tag_close@2x.png); + background-size: 8px 8px; + } +} +.pkt_ext_containersaved .token-input-selected-token { + background-color: #008acb; + border-color: #008acb; + color: #fff; +} +.pkt_ext_containersaved .token-input-selected-token span { + background-image: url(../img/tag_closeactive@1x.png); +} +@media (min-resolution: 1.1dppx) { + .pkt_ext_containersaved .token-input-selected-token span { + background-image: url(../img/tag_closeactive@2x.png); + background-size: 8px 8px; + } +} +.pkt_ext_containersaved .pkt_ext_tag_input_wrapper_disabled .token-input-selected-token { + background-color: #f7f7f7; +} +.pkt_ext_containersaved .pkt_ext_tag_input_wrapper_disabled .token-input-selected-token span { + color: #bbb; +} + +/*=Overflow mode +--------------------------------------------------------------------------------------- */ +.pkt_ext_saved_overflow .pkt_ext_logo { + float: none; + margin: 0.5em auto 0; +} +.pkt_ext_saved_overflow .pkt_ext_initload { + top: -8px; +} +.pkt_ext_saved_overflow .pkt_ext_loadingspinner { + top: 10em; +} +.pkt_ext_saved_overflow .pkt_ext_topdetail { + float: none; + margin: 0 auto; + padding: 0 1em; +} +.pkt_ext_saved_overflow h2 { + margin-bottom: 0.5em; + margin-top: 0; + text-align: center; +} +.pkt_ext_saved_overflow .pkt_ext_item_actions ul { + display: inline-block; + width: auto; +} +.pkt_ext_saved_overflow .pkt_ext_item_actions li { + float: none; + padding-left: 1em; + padding-right: 1em; + text-align: center; +} +.pkt_ext_saved_overflow .pkt_ext_item_actions .pkt_ext_removeitem, +.pkt_ext_saved_overflow .pkt_ext_item_actions .pkt_ext_openpocket { + float: none; + text-align: center; + padding-left: 0; + padding-right: 0; +} +.pkt_ext_saved_overflow .pkt_ext_item_actions .pkt_ext_actions_separator { + display: none; +} +.pkt_ext_saved_overflow .pkt_ext_tag_detail { + margin-top: 0; +} +.pkt_ext_saved_overflow .pkt_ext_suggestedtag_detail, +.pkt_ext_saved_overflow .pkt_ext_suggestedtag_detailshown { + top: 14.75em; +} +.pkt_ext_saved_overflow .pkt_ext_edit_msg { + top: 16em; +} +.pkt_ext_container_finalerrorstate.pkt_ext_saved_overflow .pkt_ext_errordetail { + box-sizing: border-box; + left: 0; + padding-left: 1em; + padding-right: 1em; + text-align: center; + top: 8.3em; + width: 100%; +} + +/*=Language overrides +--------------------------------------------------------------------------------------- */ +.pkt_ext_saved_es .pkt_ext_btn { + min-width: 5em; +} +.pkt_ext_saved_de .pkt_ext_btn, +.pkt_ext_saved_ru .pkt_ext_btn { + min-width: 6em; +} diff --git a/browser/extensions/pocket/content/panels/css/signup.css b/browser/extensions/pocket/content/panels/css/signup.css new file mode 100644 index 000000000..5c428a29b --- /dev/null +++ b/browser/extensions/pocket/content/panels/css/signup.css @@ -0,0 +1,424 @@ +/* signup.css + * + * Description: + * With base elements out of the way, this sets all custom styling for the extension. + * + * Contents: + * Global + * Core detail + * Core detail - storyboard + * Buttons + * Overflow mode + * Language overrides + */ + +/*=Global +--------------------------------------------------------------------------------------- */ +.pkt_ext_containersignup { + background-color: #ebebeb; + color: #333; + display: block; + font-size: 16px; + font-family: "FiraSans", "Helvetica Neue", Helvetica, Arial, sans-serif; + margin: 0; + padding: 0; + position: relative; + text-align: center; +} +.pkt_ext_containersignup_inactive { + animation: pkt_ext_hide 0.3s ease-out; + opacity: 0; + visibility: hidden; +} +.pkt_ext_cf:after { + content: " "; + display: table; + clear: both; +} +@keyframes pkt_ext_hide { + 0% { + opacity: 1; + visibility: visible; + } + 99% { + opacity: 0; + visibility: visible; + } + 100% { + opacity: 0; + visibility: hidden; + } +} + +/*=Core detail +--------------------------------------------------------------------------------------- */ +.pkt_ext_containersignup p { + font-size: 14px; + color: #333; + font-family: "FiraSans", "Helvetica Neue", Helvetica, Arial, sans-serif; + line-height: 1.3; + margin: 0 auto 1.5em; + max-width: 260px; +} +.pkt_ext_containersignup a { + color: #4c8fd0; +} +.pkt_ext_containersignup a:hover { + color: #3076b9; +} +.pkt_ext_containersignup .pkt_ext_introdetail { + background-color: #fbfbfb; + border: 1px solid #c1c1c1; + border-width: 0 0 1px; +} +.pkt_ext_containersignup .pkt_ext_logo { + background: url(../img/pocketlogo@1x.png) center bottom no-repeat; + display: block; + height: 32px; + margin: 0 auto 15px; + padding-top: 25px; + position: relative; + text-indent: -9999px; + width: 123px; +} +@media (min-resolution: 1.1dppx) { + .pkt_ext_containersignup .pkt_ext_logo { + background-image: url(../img/pocketlogo@2x.png); + background-size: 123px 32px; + } +} +.pkt_ext_containersignup .pkt_ext_introimg { + background: url(../img/pocketsignup_hero@1x.png) center center no-repeat; + display: block; + height: 125px; + margin: 0 auto; + position: relative; + text-indent: -9999px; + width: 255px; +} +@media (min-resolution: 1.1dppx) { + .pkt_ext_containersignup .pkt_ext_introimg { + background-image: url(../img/pocketsignup_hero@2x.png); + background-size: 255px 125px; + } +} +.pkt_ext_containersignup .pkt_ext_tagline { + margin-bottom: 0.5em; +} +.pkt_ext_containersignup .pkt_ext_learnmore { + font-size: 12px; +} +.pkt_ext_containersignup .pkt_ext_learnmoreinactive { + visibility: hidden; +} +.pkt_ext_signupdetail h4 { + font-size: 12px; + font-weight: normal; +} +.pkt_ext_signupdetail .btn-container { + position: relative; + margin-bottom: 0.8em; +} +.pkt_ext_containersignup .ff_signuphelp { + background: url(../img/signup_help@1x.png) center center no-repeat; + display: block; + height: 18px; + margin-top: -9px; + right: -15px; + position: absolute; + text-indent: -9999px; + width: 18px; + top: 50%; +} +@media (min-resolution: 1.1dppx) { + .pkt_ext_containersignup .ff_signuphelp { + background-image: url(../img/signup_help@2x.png); + background-size: 18px 18px; + } +} +.pkt_ext_containersignup .alreadyhave { + font-size: 12px; + max-width: 320px; + margin-top: 15px; +} +.pkt_ext_containersignup .tryitnowspace { + margin-top: 22px; +} +.pkt_ext_signupdetail p.pkt_ext_tos { + color: #777; + font-size: 10px; + line-height: 1.5; + margin-top: 17px; + padding-top: 0; + max-width: 190px; +} + +/*=Core detail - storyboard +--------------------------------------------------------------------------------------- */ +.pkt_ext_introstory { + align-items: center; + display: flex; + padding: 20px; +} +.pkt_ext_introstory:after { + clear: both; + content: ""; + display: table; +} +.pkt_ext_introstory p { + margin-bottom: 0; + text-align: left; +} +.pkt_ext_introstoryone { + padding: 20px 18px 15px 20px; +} +.pkt_ext_introstorytwo { + padding: 3px 0 0 20px; +} +.pkt_ext_introstorytwo .pkt_ext_tagline { + margin-bottom: 1.5em; +} +.pkt_ext_introstory_text { + flex: 1; +} +.pkt_ext_introstoryone_img, +.pkt_ext_introstorytwo_img { + display: block; + overflow: hidden; + position: relative; + text-indent: -999px; +} +.pkt_ext_introstoryone_img { + background: url(../img/pocketsignup_button@1x.png) center right no-repeat; + height: 82px; + padding: 0 0 0 0.7em; + width: 82px; +} +@media (min-resolution: 1.1dppx) { + .pkt_ext_introstoryone_img { + background-image: url(../img/pocketsignup_button@2x.png); + background-size: 82px 82px; + } +} +.pkt_ext_introstorytwo_img { + background: url(../img/pocketsignup_devices@1x.png) bottom right no-repeat; + height: 110px; + padding: 1em 0 0 0.7em; + width: 124px; +} +@media (min-resolution: 1.1dppx) { + .pkt_ext_introstorytwo_img { + background-image: url(../img/pocketsignup_devices@2x.png); + background-size: 124px 110px; + } +} +.pkt_ext_introstorydivider { + border-top: 1px solid #c1c1c1; + height: 1px; + margin: 0 auto; + width: 125px; +} + +/*=Buttons +--------------------------------------------------------------------------------------- */ +.pkt_ext_containersignup .btn { + background-color: #0096dd; + border: 1px solid #0095dd; + border-radius: 2px; + color: #fff; + display: inline-block; + font-family: "FiraSans", "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 16px; + font-weight: normal; + line-height: 1; + margin: 0; + padding: 11px 45px; + text-align: center; + text-decoration: none; + text-shadow: 0 -1px 0 rgba(142,4,17,0.5); + transition: background-color 0.1s linear; + width: auto; +} +.pkt_ext_containersignup .btn-secondary { + background-color: #fbfbfb; + border-color: #c1c1c1; + color: #444; + text-shadow: 0 1px 0 rgba(255,255,255,0.5); +} +.pkt_ext_containersignup .btn-small { + padding: 6px 20px; +} +.pkt_ext_containersignup .btn-mini { + font-size: 14px; + padding: 5px 15px 4px; +} +.pkt_ext_containersignup .btn:hover { + background-color: #008acb; + color: #fff; + text-decoration: none; +} +.pkt_ext_containersignup .btn-secondary:hover, +.pkt_ext_containersignup .btn-important:hover { + background-color: #f6f6f6; + color: #222; +} +.pkt_ext_containersignup .btn-disabled { + background-image: none; + color: #ccc; + color: rgba(255,255,255,0.6); + cursor: default; + opacity: 0.9; +} +.pkt_ext_containersignup .signup-btn-firefox, +.pkt_ext_containersignup .signup-btn-tryitnow, +.pkt_ext_containersignup .signup-btn-email, +.pkt_ext_containersignup .signupinterim-btn-login, +.pkt_ext_containersignup .signupinterim-btn-signup, +.pkt_ext_containersignup .forgot-btn-submit, +.pkt_ext_containersignup .forgotreset-btn-change { + min-width: 12.125em; + padding: 0.8em 1.1875em; + box-sizing: content-box; +} +.pkt_ext_containersignup .signup-btn-email { + position: relative; + z-index: 10; +} +.pkt_ext_containersignup .signup-btn-tryitnow, +.pkt_ext_containersignup .signup-btn-firefox { + min-width: 14.5em; + position: relative; + padding: 0; +} +.pkt_ext_containersignup .signup-btn-tryitnow{ + margin-top: 25px; +} +.pkt_ext_containersignup .signup-btn-firefox .logo { + background: url(../img/signup_firefoxlogo@1x.png) center center no-repeat; + height: 2.6em; + left: 10px; + margin: 0; + padding: 0; + width: 22px; + position: absolute; +} +@media (min-resolution: 1.1dppx) { + .pkt_ext_containersignup .signup-btn-firefox .logo { + background-image: url(../img/signup_firefoxlogo@2x.png); + background-size: 22px 22px; + } +} +.pkt_ext_containersignup .forgotreset-btn-change { + margin-bottom: 2em; +} +.pkt_ext_containersignup .signup-btn-tryitnow .text, +.pkt_ext_containersignup .signup-btn-firefox .text { + display: inline-block; + padding: 0.8em 1.625em; + position: relative; + text-shadow: none; + white-space: nowrap; +} +.pkt_ext_containersignup .signup-btn-tryitnow .text, +.pkt_ext_containersignup .signup-btn-firefox .text { + color: #fff; +} +.pkt_ext_containersignup .btn-disabled .text { + color: #ccc; + color: rgba(255,255,255,0.6); +} + +/*=Overflow mode +--------------------------------------------------------------------------------------- */ +.pkt_ext_signup_overflow .pkt_ext_tagline { + margin-bottom: 1em; + padding: 0 1em; +} +.pkt_ext_signup_overflow .pkt_ext_introimg { + background-size: 200px 98px; + height: 98px; + width: 200px; +} +.pkt_ext_signup_overflow .signup-btn-firefox, +.pkt_ext_containersignup .signup-btn-tryitnow, +.pkt_ext_signup_overflow .signup-btn-email { + font-size: 14px; + min-width: 12.6em; + padding-left: 0.75em; + padding-right: 0.75em; +} +.pkt_ext_signup_overflow .signup-btn-tryitnow .text, +.pkt_ext_signup_overflow .signup-btn-firefox .text { + padding-left: 0; + padding-right: 0; +} + +/*=Language overrides +--------------------------------------------------------------------------------------- */ +.pkt_ext_signup_de .pkt_ext_introstoryone_img { + margin-right: -5px; + padding-left: 0; +} +.pkt_ext_signup_de .pkt_ext_introstorytwo .pkt_ext_tagline, +.pkt_ext_signup_es .pkt_ext_introstorytwo .pkt_ext_tagline, +.pkt_ext_signup_ja .pkt_ext_introstorytwo .pkt_ext_tagline, +.pkt_ext_signup_ru .pkt_ext_introstorytwo .pkt_ext_tagline { + margin-bottom: 0.5em; +} +.pkt_ext_signup_de .signup-btn-firefox .text, +.pkt_ext_signup_de .signup-btn-tryitnow .text, +.pkt_ext_signup_de .signup-btn-email, +.pkt_ext_signup_es .pkt_ext_signupdetail_hero .signup-btn-firefox .text, +.pkt_ext_signup_es .pkt_ext_signupdetail_hero .signup-btn-email, +.pkt_ext_signup_ja .signup-btn-firefox .text, +.pkt_ext_signup_ja .signup-btn-tryitnow .text, +.pkt_ext_signup_ja .signup-btn-email, +.pkt_ext_signup_ru .signup-btn-firefox .text, +.pkt_ext_signup_ru .signup-btn-tryitnow .text, +.pkt_ext_signup_ru .signup-btn-email { + font-size: 15px; +} +.pkt_ext_signup_ja .signup-btn-firefox .text, +.pkt_ext_signup_ja .signup-btn-tryitnow .text, +.pkt_ext_signup_ru .signup-btn-firefox .text, +.pkt_ext_signup_ru .signup-btn-tryitnow .text { + left: 15px; +} +.pkt_ext_signup_de .signup-btn-firefox .logo, +.pkt_ext_signup_es .pkt_ext_signupdetail_hero .signup-btn-firefox .logo, +.pkt_ext_signup_ja .signup-btn-firefox .logo, +.pkt_ext_signup_ru .signup-btn-firefox .logo { + height: 2.4em; +} +@media (min-resolution: 1.1dppx) { + .pkt_ext_signup_de .signup-btn-firefox .logo, + .pkt_ext_signup_es .pkt_ext_signupdetail_hero .signup-btn-firefox .logo, + .pkt_ext_signup_ja .signup-btn-firefox .logo, + .pkt_ext_signup_ru .signup-btn-firefox .logo { + height: 2.5em; + } +} +.pkt_ext_signup_de .signup-btn-email, +.pkt_ext_signup_es .pkt_ext_signupdetail_hero .signup-btn-email, +.pkt_ext_signup_ja .signup-btn-email, +.pkt_ext_signup_ru .signup-btn-email { + min-width: 13em; + padding: 0.8533em 1.2667em; +} +.pkt_ext_signup_de .pkt_ext_logo, +.pkt_ext_signup_es .pkt_ext_logo, +.pkt_ext_signup_ru .pkt_ext_logo { + padding-top: 15px; +} +.pkt_ext_signup_de .pkt_ext_introdetailhero .pkt_ext_tagline, +.pkt_ext_signup_es .pkt_ext_introdetailhero .pkt_ext_tagline, +.pkt_ext_signup_ja .pkt_ext_introdetailhero .pkt_ext_tagline, +.pkt_ext_signup_ru .pkt_ext_introdetailhero .pkt_ext_tagline { + font-size: 13px; +} +.pkt_ext_signup_overflow.pkt_ext_signup_de .signup-btn-firefox .logo, +.pkt_ext_signup_overflow.pkt_ext_signup_es .signup-btn-firefox .logo, +.pkt_ext_signup_overflow.pkt_ext_signup_ja .signup-btn-firefox .logo, +.pkt_ext_signup_overflow.pkt_ext_signup_ru .signup-btn-firefox .logo { + display: none; +} diff --git a/browser/extensions/pocket/content/panels/fonts/FiraSans-Regular.woff b/browser/extensions/pocket/content/panels/fonts/FiraSans-Regular.woff new file mode 100644 index 000000000..f466cdda9 Binary files /dev/null and b/browser/extensions/pocket/content/panels/fonts/FiraSans-Regular.woff differ diff --git a/browser/extensions/pocket/content/panels/img/pocket.svg b/browser/extensions/pocket/content/panels/img/pocket.svg new file mode 100644 index 000000000..d93fd6a15 --- /dev/null +++ b/browser/extensions/pocket/content/panels/img/pocket.svg @@ -0,0 +1,22 @@ + + + + + + + + + + diff --git a/browser/extensions/pocket/content/panels/img/pocketerror@1x.png b/browser/extensions/pocket/content/panels/img/pocketerror@1x.png new file mode 100644 index 000000000..e2b4d04de Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/pocketerror@1x.png differ diff --git a/browser/extensions/pocket/content/panels/img/pocketerror@2x.png b/browser/extensions/pocket/content/panels/img/pocketerror@2x.png new file mode 100644 index 000000000..d501503b0 Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/pocketerror@2x.png differ diff --git a/browser/extensions/pocket/content/panels/img/pocketlogo@1x.png b/browser/extensions/pocket/content/panels/img/pocketlogo@1x.png new file mode 100644 index 000000000..62b3db310 Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/pocketlogo@1x.png differ diff --git a/browser/extensions/pocket/content/panels/img/pocketlogo@2x.png b/browser/extensions/pocket/content/panels/img/pocketlogo@2x.png new file mode 100644 index 000000000..b0e80bff3 Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/pocketlogo@2x.png differ diff --git a/browser/extensions/pocket/content/panels/img/pocketlogosolo@1x.png b/browser/extensions/pocket/content/panels/img/pocketlogosolo@1x.png new file mode 100644 index 000000000..77dc16f8c Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/pocketlogosolo@1x.png differ diff --git a/browser/extensions/pocket/content/panels/img/pocketlogosolo@2x.png b/browser/extensions/pocket/content/panels/img/pocketlogosolo@2x.png new file mode 100644 index 000000000..c467c5a29 Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/pocketlogosolo@2x.png differ diff --git a/browser/extensions/pocket/content/panels/img/pocketmenuitem16.png b/browser/extensions/pocket/content/panels/img/pocketmenuitem16.png new file mode 100644 index 000000000..b52db6abf Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/pocketmenuitem16.png differ diff --git a/browser/extensions/pocket/content/panels/img/pocketmenuitem16@2x.png b/browser/extensions/pocket/content/panels/img/pocketmenuitem16@2x.png new file mode 100644 index 000000000..69aa55b03 Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/pocketmenuitem16@2x.png differ diff --git a/browser/extensions/pocket/content/panels/img/pocketsignup_button@1x.png b/browser/extensions/pocket/content/panels/img/pocketsignup_button@1x.png new file mode 100644 index 000000000..12326fae3 Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/pocketsignup_button@1x.png differ diff --git a/browser/extensions/pocket/content/panels/img/pocketsignup_button@2x.png b/browser/extensions/pocket/content/panels/img/pocketsignup_button@2x.png new file mode 100644 index 000000000..5bdebc5e9 Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/pocketsignup_button@2x.png differ diff --git a/browser/extensions/pocket/content/panels/img/pocketsignup_devices@1x.png b/browser/extensions/pocket/content/panels/img/pocketsignup_devices@1x.png new file mode 100644 index 000000000..c4a7ad677 Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/pocketsignup_devices@1x.png differ diff --git a/browser/extensions/pocket/content/panels/img/pocketsignup_devices@2x.png b/browser/extensions/pocket/content/panels/img/pocketsignup_devices@2x.png new file mode 100644 index 000000000..157304c3e Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/pocketsignup_devices@2x.png differ diff --git a/browser/extensions/pocket/content/panels/img/pocketsignup_hero@1x.png b/browser/extensions/pocket/content/panels/img/pocketsignup_hero@1x.png new file mode 100644 index 000000000..80c5bd486 Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/pocketsignup_hero@1x.png differ diff --git a/browser/extensions/pocket/content/panels/img/pocketsignup_hero@2x.png b/browser/extensions/pocket/content/panels/img/pocketsignup_hero@2x.png new file mode 100644 index 000000000..36d0add61 Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/pocketsignup_hero@2x.png differ diff --git a/browser/extensions/pocket/content/panels/img/signup_firefoxlogo@1x.png b/browser/extensions/pocket/content/panels/img/signup_firefoxlogo@1x.png new file mode 100644 index 000000000..52cbe052c Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/signup_firefoxlogo@1x.png differ diff --git a/browser/extensions/pocket/content/panels/img/signup_firefoxlogo@2x.png b/browser/extensions/pocket/content/panels/img/signup_firefoxlogo@2x.png new file mode 100644 index 000000000..cd218805e Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/signup_firefoxlogo@2x.png differ diff --git a/browser/extensions/pocket/content/panels/img/signup_help@1x.png b/browser/extensions/pocket/content/panels/img/signup_help@1x.png new file mode 100644 index 000000000..5019025c0 Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/signup_help@1x.png differ diff --git a/browser/extensions/pocket/content/panels/img/signup_help@2x.png b/browser/extensions/pocket/content/panels/img/signup_help@2x.png new file mode 100644 index 000000000..6714bb3bc Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/signup_help@2x.png differ diff --git a/browser/extensions/pocket/content/panels/img/signup_or@1x.png b/browser/extensions/pocket/content/panels/img/signup_or@1x.png new file mode 100644 index 000000000..318cea0f6 Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/signup_or@1x.png differ diff --git a/browser/extensions/pocket/content/panels/img/signup_or@2x.png b/browser/extensions/pocket/content/panels/img/signup_or@2x.png new file mode 100644 index 000000000..837f1814a Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/signup_or@2x.png differ diff --git a/browser/extensions/pocket/content/panels/img/tag_close@1x.png b/browser/extensions/pocket/content/panels/img/tag_close@1x.png new file mode 100644 index 000000000..2dd02ba02 Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/tag_close@1x.png differ diff --git a/browser/extensions/pocket/content/panels/img/tag_close@2x.png b/browser/extensions/pocket/content/panels/img/tag_close@2x.png new file mode 100644 index 000000000..8bd0eec57 Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/tag_close@2x.png differ diff --git a/browser/extensions/pocket/content/panels/img/tag_closeactive@1x.png b/browser/extensions/pocket/content/panels/img/tag_closeactive@1x.png new file mode 100644 index 000000000..ad4239232 Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/tag_closeactive@1x.png differ diff --git a/browser/extensions/pocket/content/panels/img/tag_closeactive@2x.png b/browser/extensions/pocket/content/panels/img/tag_closeactive@2x.png new file mode 100644 index 000000000..80c35e3aa Binary files /dev/null and b/browser/extensions/pocket/content/panels/img/tag_closeactive@2x.png differ diff --git a/browser/extensions/pocket/content/panels/js/messages.js b/browser/extensions/pocket/content/panels/js/messages.js new file mode 100644 index 000000000..ae08c3e73 --- /dev/null +++ b/browser/extensions/pocket/content/panels/js/messages.js @@ -0,0 +1,78 @@ +// Documentation of methods used here are at: +// https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Interaction_between_privileged_and_non-privileged_pages + +var pktPanelMessaging = (function() { + + function panelIdFromURL(url) { + var panelId = url.match(/panelId=([\w|\d|\.]*)&?/); + if (panelId && panelId.length > 1) { + return panelId[1]; + } + + return 0; + } + + function prefixedMessageId(messageId) { + return 'PKT_' + messageId; + } + + function panelPrefixedMessageId(panelId, messageId) { + return prefixedMessageId(panelId + '_' + messageId); + } + + function addMessageListener(panelId, messageId, callback) { + document.addEventListener(panelPrefixedMessageId(panelId, messageId), function(e) { + + callback(JSON.parse(e.target.getAttribute("payload"))[0]); + + // TODO: Figure out why e.target.parentNode is null + // e.target.parentNode.removeChild(e.target); + + }, false); + + } + + function removeMessageListener(panelId, messageId, callback) { + document.removeEventListener(panelPrefixedMessageId(panelId, messageId), callback); + } + + function sendMessage(panelId, messageId, payload, callback) { + // Payload needs to be an object in format: + // { panelId: panelId, data: {} } + var messagePayload = { + panelId: panelId, + data: (payload || {}) + }; + + // Create a callback to listen for a response + if (callback) { + var messageResponseId = messageId + "Response"; + var responseListener = function(responsePayload) { + callback(responsePayload); + removeMessageListener(panelId, messageResponseId, responseListener); + } + + addMessageListener(panelId, messageResponseId, responseListener); + } + + // Send message + var element = document.createElement("PKTMessageFromPanelElement"); + element.setAttribute("payload", JSON.stringify([messagePayload])); + document.documentElement.appendChild(element); + + var evt = document.createEvent("Events"); + evt.initEvent(prefixedMessageId(messageId), true, false); + element.dispatchEvent(evt); + } + + + /** + * Public functions + */ + return { + panelIdFromURL: panelIdFromURL, + addMessageListener : addMessageListener, + removeMessageListener : removeMessageListener, + sendMessage: sendMessage + }; +}()); diff --git a/browser/extensions/pocket/content/panels/js/saved.js b/browser/extensions/pocket/content/panels/js/saved.js new file mode 100644 index 000000000..3abc8889a --- /dev/null +++ b/browser/extensions/pocket/content/panels/js/saved.js @@ -0,0 +1,608 @@ +/* +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; + this.wrapper = null; + this.pockethost = "getpocket.com"; + this.savedItemId = 0; + this.savedUrl = ''; + this.premiumStatus = false; + this.preventCloseTimerCancel = false; + this.closeValid = true; + this.mouseInside = false; + this.autocloseTimer = null; + this.inoverflowmenu = false; + this.dictJSON = {}; + this.autocloseTiming = 3500; + this.autocloseTimingFinalState = 2000; + this.mouseInside = false; + this.userTags = []; + this.cxt_suggested_available = 0; + this.cxt_entered = 0; + this.cxt_suggested = 0; + this.cxt_removed = 0; + this.justaddedsuggested = false; + this.fillTagContainer = function(tags, container, tagclass) { + container.children().remove(); + for (var i = 0; i < tags.length; i++) { + var newtag = $('
  • '); + newtag.find('a').text(tags[i]); + newtag.addClass(tagclass); + container.append(newtag); + this.cxt_suggested_available++; + } + }; + this.fillUserTags = function() { + thePKT_SAVED.sendMessage("getTags", {}, function(resp) + { + if (typeof resp == 'object' && typeof resp.tags == 'object') + { + myself.userTags = resp.tags; + } + }); + }; + this.fillSuggestedTags = function() + { + if (!$('.pkt_ext_suggestedtag_detail').length) + { + myself.suggestedTagsLoaded = true; + myself.startCloseTimer(); + return; + } + + thePKT_SAVED.sendMessage("getSuggestedTags", + { + url: myself.savedUrl + }, function(resp) + { + $('.pkt_ext_suggestedtag_detail').removeClass('pkt_ext_suggestedtag_detail_loading'); + if (resp.status == 'success') + { + var newtags = []; + for (var i = 0; i < resp.value.suggestedTags.length; i++) + { + newtags.push(resp.value.suggestedTags[i].tag); + } + myself.suggestedTagsLoaded = true; + if (!myself.mouseInside) { + myself.startCloseTimer(); + } + myself.fillTagContainer(newtags, $('.pkt_ext_suggestedtag_detail ul'), 'token_suggestedtag'); + } + else if (resp.status == 'error') { + var msg = $('

    '); + msg.text(resp.error.message); + $('.pkt_ext_suggestedtag_detail').append(msg); + this.suggestedTagsLoaded = true; + if (!myself.mouseInside) { + myself.startCloseTimer(); + } + } + }); + } + this.initAutoCloseEvents = function() { + this.wrapper.on('mouseenter', function() { + myself.mouseInside = true; + myself.stopCloseTimer(); + }); + this.wrapper.on('mouseleave', function() { + myself.mouseInside = false; + myself.startCloseTimer(); + }); + this.wrapper.on('click', function(e) { + myself.closeValid = false; + }); + }; + this.startCloseTimer = function(manualtime) + { + var settime = manualtime ? manualtime : myself.autocloseTiming; + if (typeof myself.autocloseTimer == 'number') + { + clearTimeout(myself.autocloseTimer); + } + myself.autocloseTimer = setTimeout(function() + { + if (myself.closeValid || myself.preventCloseTimerCancel) + { + myself.preventCloseTimerCancel = false; + myself.closePopup(); + } + }, settime); + }; + this.stopCloseTimer = function() + { + if (myself.preventCloseTimerCancel) + { + return; + } + clearTimeout(myself.autocloseTimer); + }; + this.closePopup = function() { + myself.stopCloseTimer(); + thePKT_SAVED.sendMessage("close"); + }; + this.checkValidTagSubmit = function() { + var inputlength = $.trim($('.pkt_ext_tag_input_wrapper').find('.token-input-input-token').children('input').val()).length; + if ($('.pkt_ext_containersaved').find('.token-input-token').length || (inputlength > 0 && inputlength < 26)) + { + $('.pkt_ext_containersaved').find('.pkt_ext_btn').removeClass('pkt_ext_btn_disabled'); + } + else + { + $('.pkt_ext_containersaved').find('.pkt_ext_btn').addClass('pkt_ext_btn_disabled'); + } + myself.updateSlidingTagList(); + }; + this.updateSlidingTagList = function() { + var inputleft = $('.token-input-input-token input').position().left; + var listleft = $('.token-input-list').position().left; + var listleftmanual = parseInt($('.token-input-list').css('left')); + var listleftnatural = listleft - listleftmanual; + var leftwidth = $('.pkt_ext_tag_input_wrapper').outerWidth(); + + if ((inputleft + listleft + 20) > leftwidth) + { + $('.token-input-list').css('left', Math.min(((inputleft + listleftnatural - leftwidth + 20)*-1), 0) + 'px'); + } + else + { + $('.token-input-list').css('left', '0'); + } + }; + this.checkPlaceholderStatus = function() { + if (this.wrapper.find('.pkt_ext_tag_input_wrapper').find('.token-input-token').length) + { + this.wrapper.find('.token-input-input-token input').attr('placeholder', ''); + } + else + { + this.wrapper.find('.token-input-input-token input').attr('placeholder', $('.pkt_ext_tag_input').attr('placeholder')).css('width', '200px'); + } + }; + this.initTagInput = function() { + var inputwrapper = $('.pkt_ext_tag_input_wrapper'); + inputwrapper.find('.pkt_ext_tag_input').tokenInput([], { + searchDelay: 200, + minChars: 1, + animateDropdown: false, + noResultsHideDropdown: true, + scrollKeyboard: true, + emptyInputLength: 200, + search_function: function(term, cb) { + var returnlist = []; + if (term.length) { + var limit = 15; + var r = new RegExp('^' + term); + for (var i = 0; i < myself.userTags.length; i++) { + if (r.test(myself.userTags[i]) && limit > 0) { + returnlist.push({name:myself.userTags[i]}); + limit--; + } + } + } + if (!$('.token-input-dropdown-tag').data('init')) { + $('.token-input-dropdown-tag').css('width', inputwrapper.outerWidth()).data('init'); + inputwrapper.append($('.token-input-dropdown-tag')); + } + cb(returnlist); + }, + textToData: function(text) { + if ($.trim(text).length > 25 || !$.trim(text).length) { + if (text.length > 25) { + myself.showTagsError(myself.dictJSON.maxtaglength); + changestamp = Date.now(); + setTimeout(function() { + $('.token-input-input-token input').val(text).focus(); + }, 10); + } + return null; + } + myself.hideTagsError(); + return {name:myself.sanitizeText(text.toLowerCase())}; + }, + onReady: function() { + $('.token-input-dropdown').addClass('token-input-dropdown-tag'); + inputwrapper.find('.token-input-input-token input').attr('placeholder', $('.tag-input').attr('placeholder')).css('width', '200px'); + if ($('.pkt_ext_suggestedtag_detail').length) { + myself.wrapper.find('.pkt_ext_suggestedtag_detail').on('click', '.token_tag', function(e) { + e.preventDefault(); + var tag = $(e.target); + if ($(this).parents('.pkt_ext_suggestedtag_detail_disabled').length) { + return; + } + myself.justaddedsuggested = true; + inputwrapper.find('.pkt_ext_tag_input').tokenInput('add', {id:inputwrapper.find('.token-input-token').length, name:tag.text()}); + tag.addClass('token-suggestedtag-inactive'); + $('.token-input-input-token input').focus(); + }); + } + $('.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)) { + e.preventDefault(); + myself.wrapper.find('.pkt_ext_btn').trigger('click'); + } + } + }).on('keyup', 'input', function(e) { + myself.checkValidTagSubmit(); + }); + myself.checkPlaceholderStatus(); + }, + onAdd: function() { + myself.checkValidTagSubmit(); + changestamp = Date.now(); + myself.hideInactiveTags(); + myself.checkPlaceholderStatus(); + }, + onDelete: function() { + myself.checkValidTagSubmit(); + changestamp = Date.now(); + myself.showActiveTags(); + myself.checkPlaceholderStatus(); + }, + onShowDropdown: function() { + thePKT_SAVED.sendMessage("expandSavePanel"); + }, + onHideDropdown: function() { + thePKT_SAVED.sendMessage("collapseSavePanel"); + } + }); + $('body').on('keydown', function(e) { + var key = e.keyCode || e.which; + if (key == 8) { + var selected = $('.token-input-selected-token'); + if (selected.length) { + e.preventDefault(); + e.stopImmediatePropagation(); + inputwrapper.find('.pkt_ext_tag_input').tokenInput('remove', {name:selected.find('p').text()}); + } + } + else if ($(e.target).parent().hasClass('token-input-input-token')) { + e.stopImmediatePropagation(); + } + }); + }; + this.disableInput = function() { + this.wrapper.find('.pkt_ext_item_actions').addClass('pkt_ext_item_actions_disabled'); + this.wrapper.find('.pkt_ext_btn').addClass('pkt_ext_btn_disabled'); + this.wrapper.find('.pkt_ext_tag_input_wrapper').addClass('pkt_ext_tag_input_wrapper_disabled'); + if (this.wrapper.find('.pkt_ext_suggestedtag_detail').length) { + this.wrapper.find('.pkt_ext_suggestedtag_detail').addClass('pkt_ext_suggestedtag_detail_disabled'); + } + }; + this.enableInput = function() { + this.wrapper.find('.pkt_ext_item_actions').removeClass('pkt_ext_item_actions_disabled'); + this.checkValidTagSubmit(); + this.wrapper.find('.pkt_ext_tag_input_wrapper').removeClass('pkt_ext_tag_input_wrapper_disabled'); + if (this.wrapper.find('.pkt_ext_suggestedtag_detail').length) { + this.wrapper.find('.pkt_ext_suggestedtag_detail').removeClass('pkt_ext_suggestedtag_detail_disabled'); + } + }; + this.initAddTagInput = function() { + $('.pkt_ext_btn').click(function(e) { + e.preventDefault(); + if ($(this).hasClass('pkt_ext_btn_disabled') || $('.pkt_ext_edit_msg_active').filter('.pkt_ext_edit_msg_error').length) + { + return; + } + myself.disableInput(); + $('.pkt_ext_containersaved').find('.pkt_ext_detail h2').text(myself.dictJSON.processingtags); + var originaltags = []; + $('.token-input-token').each(function() + { + var text = $.trim($(this).find('p').text()); + if (text.length) + { + originaltags.push(text); + } + }); + + thePKT_SAVED.sendMessage("addTags", + { + url: myself.savedUrl, + tags: originaltags + }, function(resp) + { + if (resp.status == 'success') + { + myself.showStateFinalMsg(myself.dictJSON.tagssaved); + } + else if (resp.status == 'error') + { + $('.pkt_ext_edit_msg').addClass('pkt_ext_edit_msg_error pkt_ext_edit_msg_active').text(resp.error.message); + } + }); + }); + }; + this.initRemovePageInput = function() { + $('.pkt_ext_removeitem').click(function(e) { + if ($(this).parents('.pkt_ext_item_actions_disabled').length) { + e.preventDefault(); + return; + } + if ($(this).hasClass('pkt_ext_removeitem')) { + e.preventDefault(); + myself.disableInput(); + $('.pkt_ext_containersaved').find('.pkt_ext_detail h2').text(myself.dictJSON.processingremove); + + thePKT_SAVED.sendMessage("deleteItem", + { + itemId: myself.savedItemId + }, function(resp) { + if (resp.status == 'success') { + myself.showStateFinalMsg(myself.dictJSON.pageremoved); + } + else if (resp.status == 'error') { + $('.pkt_ext_edit_msg').addClass('pkt_ext_edit_msg_error pkt_ext_edit_msg_active').text(resp.error.message); + } + }); + } + }); + }; + this.initOpenListInput = function() { + $('.pkt_ext_openpocket').click(function(e) + { + e.preventDefault(); + thePKT_SAVED.sendMessage("openTabWithUrl", + { + url: $(this).attr('href'), + activate: true + }); + myself.closePopup(); + }); + }; + this.showTagsError = function(msg) { + $('.pkt_ext_edit_msg').addClass('pkt_ext_edit_msg_error pkt_ext_edit_msg_active').text(msg); + $('.pkt_ext_tag_detail').addClass('pkt_ext_tag_error'); + }; + this.hideTagsError = function(msg) { + $('.pkt_ext_edit_msg').removeClass('pkt_ext_edit_msg_error pkt_ext_edit_msg_active').text(''); + $('.pkt_ext_tag_detail').removeClass('pkt_ext_tag_error'); + }; + this.showActiveTags = function() { + if (!$('.pkt_ext_suggestedtag_detail').length) { + return; + } + var activetokenstext = '|'; + $('.token-input-token').each(function(index, element) { + activetokenstext += $(element).find('p').text() + '|'; + }); + + var inactivetags = $('.pkt_ext_suggestedtag_detail').find('.token_tag_inactive'); + inactivetags.each(function(index, element) { + if (activetokenstext.indexOf('|' + $(element).text() + '|') == -1) { + $(element).removeClass('token_tag_inactive'); + } + }); + }; + this.hideInactiveTags = function() { + if (!$('.pkt_ext_suggestedtag_detail').length) { + return; + } + var activetokenstext = '|'; + $('.token-input-token').each(function(index, element) { + activetokenstext += $(element).find('p').text() + '|'; + }); + var activesuggestedtags = $('.token_tag').not('.token_tag_inactive'); + activesuggestedtags.each(function(index, element) { + if (activetokenstext.indexOf('|' + $(element).text() + '|') > -1) { + $(element).addClass('token_tag_inactive'); + } + }); + }; + this.showStateSaved = function(initobj) { + this.wrapper.find('.pkt_ext_detail h2').text(this.dictJSON.pagesaved); + this.wrapper.find('.pkt_ext_btn').addClass('pkt_ext_btn_disabled'); + if (typeof initobj.item == 'object') + { + this.savedItemId = initobj.item.item_id; + this.savedUrl = initobj.item.given_url; + } + $('.pkt_ext_containersaved').addClass('pkt_ext_container_detailactive').removeClass('pkt_ext_container_finalstate'); + + myself.fillUserTags(); + if (myself.suggestedTagsLoaded) { + myself.startCloseTimer(); + } + else { + myself.fillSuggestedTags(); + } + }; + this.sanitizeText = function(s) { + var sanitizeMap = { + "&": "&", + "<": "<", + ">": ">", + '"': '"', + "'": ''' + }; + if (typeof s !== 'string') + { + return ''; + } + return String(s).replace(/[&<>"']/g, function (str) { + return sanitizeMap[str]; + }); + }; + this.showStateFinalMsg = function(msg) { + this.wrapper.find('.pkt_ext_tag_detail').one('webkitTransitionEnd transitionend msTransitionEnd oTransitionEnd', function(e) + { + $(this).off('webkitTransitionEnd transitionend msTransitionEnd oTransitionEnd'); + myself.preventCloseTimerCancel = true; + myself.startCloseTimer(myself.autocloseTimingFinalState); + myself.wrapper.find('.pkt_ext_detail h2').text(msg); + }); + this.wrapper.addClass('pkt_ext_container_finalstate'); + }; + this.showStateError = function(headline, detail) { + this.wrapper.find('.pkt_ext_detail h2').text(headline); + this.wrapper.find('.pkt_ext_detail h3').text(detail); + this.wrapper.addClass('pkt_ext_container_detailactive pkt_ext_container_finalstate pkt_ext_container_finalerrorstate'); + this.preventCloseTimerCancel = true; + this.startCloseTimer(myself.autocloseTimingFinalState); + } + this.getTranslations = function() + { + this.dictJSON = window.pocketStrings; + }; +}; + +PKT_SAVED_OVERLAY.prototype = { + create : function() + { + if (this.active) + { + return; + } + this.active = true; + + // set translations + this.getTranslations(); + + // set host + this.dictJSON.pockethost = this.pockethost; + + // extra modifier class for collapsed state + if (this.inoverflowmenu) + { + $('body').addClass('pkt_ext_saved_overflow'); + } + + // extra modifier class for language + if (this.locale) + { + $('body').addClass('pkt_ext_saved_' + this.locale); + } + + // Create actual content + $('body').append(Handlebars.templates.saved_shell(this.dictJSON)); + + // Add in premium content (if applicable based on premium status) + this.createPremiumFunctionality(); + + // Initialize functionality for overlay + this.wrapper = $('.pkt_ext_containersaved'); + this.initTagInput(); + this.initAddTagInput(); + this.initRemovePageInput(); + this.initOpenListInput(); + this.initAutoCloseEvents(); + }, + createPremiumFunctionality: function() + { + if (this.premiumStatus && !$('.pkt_ext_suggestedtag_detail').length) + { + $('body').append(Handlebars.templates.saved_premiumshell(this.dictJSON)); + $('.pkt_ext_initload').append(Handlebars.templates.saved_premiumextras(this.dictJSON)); + } + } +}; + + +// Layer between Bookmarklet and Extensions +var PKT_SAVED = function () {}; + +PKT_SAVED.prototype = { + init: function () { + if (this.inited) { + return; + } + this.panelId = pktPanelMessaging.panelIdFromURL(window.location.href); + this.overlay = new PKT_SAVED_OVERLAY(); + + this.inited = true; + }, + + addMessageListener: function(messageId, callback) { + pktPanelMessaging.addMessageListener(this.panelId, messageId, callback); + }, + + sendMessage: function(messageId, payload, callback) { + pktPanelMessaging.sendMessage(this.panelId, messageId, payload, callback); + }, + + create: function() { + var myself = this; + var url = window.location.href.match(/premiumStatus=([\w|\d|\.]*)&?/); + if (url && url.length > 1) + { + myself.overlay.premiumStatus = (url[1] == '1'); + } + var host = window.location.href.match(/pockethost=([\w|\.]*)&?/); + if (host && host.length > 1) + { + myself.overlay.pockethost = host[1]; + } + var inoverflowmenu = window.location.href.match(/inoverflowmenu=([\w|\.]*)&?/); + if (inoverflowmenu && inoverflowmenu.length > 1) + { + myself.overlay.inoverflowmenu = (inoverflowmenu[1] == 'true'); + } + var locale = window.location.href.match(/locale=([\w|\.]*)&?/); + if (locale && locale.length > 1) + { + myself.overlay.locale = locale[1].toLowerCase(); + } + + myself.overlay.create(); + + // tell back end we're ready + thePKT_SAVED.sendMessage("show"); + + // wait confirmation of save before flipping to final saved state + thePKT_SAVED.addMessageListener("saveLink", function(resp) + { + if (resp.status == 'error') { + if (typeof resp.error == 'object') + { + if (resp.error.localizedKey) + { + myself.overlay.showStateError(myself.overlay.dictJSON.pagenotsaved, myself.overlay.dictJSON[resp.error.localizedKey]); + } + else + { + myself.overlay.showStateError(myself.overlay.dictJSON.pagenotsaved, resp.error.message); + } + } + else + { + myself.overlay.showStateError(myself.overlay.dictJSON.pagenotsaved, myself.overlay.dictJSON.errorgeneric); + } + return; + } + + myself.overlay.showStateSaved(resp); + }); + + } +} + +$(function() +{ + if (!window.thePKT_SAVED) { + var thePKT_SAVED = new PKT_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: [ + 'https://'+ pocketHost +'/tos?s=ffi&t=tos&tv=panel_tryit', + 'https://'+ pocketHost +'/privacy?s=ffi&t=privacypolicy&tv=panel_tryit' + ] + }, function(resp) { + window.pocketStrings = resp.strings; + window.thePKT_SAVED.create(); + }); +}); diff --git a/browser/extensions/pocket/content/panels/js/signup.js b/browser/extensions/pocket/content/panels/js/signup.js new file mode 100644 index 000000000..af55cc2a7 --- /dev/null +++ b/browser/extensions/pocket/content/panels/js/signup.js @@ -0,0 +1,193 @@ +/* +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; + this.delayedStateSaved = false; + this.wrapper = null; + this.variant = window.___PKT__SIGNUP_VARIANT; + this.tagline = window.___PKT__SIGNUP_TAGLINE || ''; + this.preventCloseTimerCancel = false; + this.translations = {}; + this.closeValid = true; + this.mouseInside = false; + this.autocloseTimer = null; + this.variant = ""; + this.inoverflowmenu = false; + this.controlvariant; + this.pockethost = "getpocket.com"; + this.fxasignedin = false; + this.dictJSON = {}; + this.initCloseTabEvents = function() { + $('.btn,.pkt_ext_learnmore,.alreadyhave > a').click(function(e) + { + e.preventDefault(); + thePKT_SIGNUP.sendMessage("openTabWithUrl", + { + url: $(this).attr('href'), + activate: true + }); + myself.closePopup(); + }); + }; + this.closePopup = function() { + thePKT_SIGNUP.sendMessage("close"); + }; + this.sanitizeText = function(s) { + var sanitizeMap = { + "&": "&", + "<": "<", + ">": ">", + '"': '"', + "'": ''' + }; + if (typeof s !== 'string') + { + return ''; + } + return String(s).replace(/[&<>"']/g, function (str) { + return sanitizeMap[str]; + }); + }; + this.getTranslations = function() + { + this.dictJSON = window.pocketStrings; + }; + +}; + +PKT_SIGNUP_OVERLAY.prototype = { + create : function() + { + var controlvariant = window.location.href.match(/controlvariant=([\w|\.]*)&?/); + if (controlvariant && controlvariant.length > 1) + { + this.controlvariant = controlvariant[1]; + } + var variant = window.location.href.match(/variant=([\w|\.]*)&?/); + if (variant && variant.length > 1) + { + this.variant = variant[1]; + } + var fxasignedin = window.location.href.match(/fxasignedin=([\w|\d|\.]*)&?/); + if (fxasignedin && fxasignedin.length > 1) + { + this.fxasignedin = (fxasignedin[1] == '1'); + } + var host = window.location.href.match(/pockethost=([\w|\.]*)&?/); + if (host && host.length > 1) + { + this.pockethost = host[1]; + } + var inoverflowmenu = window.location.href.match(/inoverflowmenu=([\w|\.]*)&?/); + if (inoverflowmenu && inoverflowmenu.length > 1) + { + this.inoverflowmenu = (inoverflowmenu[1] == 'true'); + } + var locale = window.location.href.match(/locale=([\w|\.]*)&?/); + if (locale && locale.length > 1) + { + this.locale = locale[1].toLowerCase(); + } + + if (this.active) + { + return; + } + this.active = true; + + // set translations + this.getTranslations(); + this.dictJSON.fxasignedin = this.fxasignedin ? 1 : 0; + this.dictJSON.controlvariant = this.controlvariant == 'true' ? 1 : 0; + this.dictJSON.variant = (this.variant ? this.variant : 'undefined'); + this.dictJSON.variant += this.fxasignedin ? '_fxa' : '_nonfxa'; + this.dictJSON.pockethost = this.pockethost; + this.dictJSON.showlearnmore = true; + + // extra modifier class for collapsed state + if (this.inoverflowmenu) + { + $('body').addClass('pkt_ext_signup_overflow'); + } + + // extra modifier class for language + if (this.locale) + { + $('body').addClass('pkt_ext_signup_' + this.locale); + } + + // Create actual content + if (this.variant == 'overflow') + { + $('body').append(Handlebars.templates.signup_shell(this.dictJSON)); + } + else + { + $('body').append(Handlebars.templates.signupstoryboard_shell(this.dictJSON)); + } + + + // tell background we're ready + thePKT_SIGNUP.sendMessage("show"); + + // close events + this.initCloseTabEvents(); + } +}; + + +// Layer between Bookmarklet and Extensions +var PKT_SIGNUP = function () {}; + +PKT_SIGNUP.prototype = { + init: function () { + if (this.inited) { + return; + } + this.panelId = pktPanelMessaging.panelIdFromURL(window.location.href); + this.overlay = new PKT_SIGNUP_OVERLAY(); + + this.inited = true; + }, + + addMessageListener: function(messageId, callback) { + pktPanelMessaging.addMessageListener(this.panelId, messageId, callback); + }, + + sendMessage: function(messageId, payload, callback) { + pktPanelMessaging.sendMessage(this.panelId, messageId, payload, callback); + }, + + create: function() { + this.overlay.create(); + + // tell back end we're ready + thePKT_SIGNUP.sendMessage("show"); + } +} + +$(function() +{ + if (!window.thePKT_SIGNUP) { + var thePKT_SIGNUP = new PKT_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: [ + 'https://'+ pocketHost +'/tos?s=ffi&t=tos&tv=panel_tryit', + 'https://'+ pocketHost +'/privacy?s=ffi&t=privacypolicy&tv=panel_tryit' + ] + }, function(resp) { + window.pocketStrings = resp.strings; + window.thePKT_SIGNUP.create(); + }); +}); diff --git a/browser/extensions/pocket/content/panels/js/tmpl.js b/browser/extensions/pocket/content/panels/js/tmpl.js new file mode 100644 index 000000000..a03ffda70 --- /dev/null +++ b/browser/extensions/pocket/content/panels/js/tmpl.js @@ -0,0 +1,242 @@ +(function() { + var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; +templates['saved_premiumextras'] = template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) { + return "

    \r\n
    "; + },"useData":true}); +templates['saved_premiumshell'] = template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) { + var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression; + return "
    \n

    " + + escapeExpression(((helper = (helper = helpers.suggestedtags || (depth0 != null ? depth0.suggestedtags : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"suggestedtags","hash":{},"data":data}) : helper))) + + "

    \n
    \n \n
    "; +},"useData":true}); +templates['saved_shell'] = template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) { + var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression; + return "
    \n
    \n
    \n

    " + + escapeExpression(((helper = (helper = helpers.saving || (depth0 != null ? depth0.saving : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"saving","hash":{},"data":data}) : helper))) + + "

    \n
    \n
    \n
    \n
    \n
    \n \n \n

    \n
    "; +},"useData":true}); +templates['signup_shell'] = template({"1":function(depth0,helpers,partials,data) { + var stack1, buffer = ""; + stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.controlvariant : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data}); + if (stack1 != null) { buffer += stack1; } + return buffer; +},"2":function(depth0,helpers,partials,data) { + var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression; + return "

    " + + escapeExpression(((helper = (helper = helpers.learnmore || (depth0 != null ? depth0.learnmore : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"learnmore","hash":{},"data":data}) : helper))) + + "

    \n"; +},"4":function(depth0,helpers,partials,data) { + var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression; + return "

    " + + escapeExpression(((helper = (helper = helpers.learnmore || (depth0 != null ? depth0.learnmore : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"learnmore","hash":{},"data":data}) : helper))) + + "

    \n"; +},"6":function(depth0,helpers,partials,data) { + var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression; + return "

    " + + escapeExpression(((helper = (helper = helpers.learnmore || (depth0 != null ? depth0.learnmore : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"learnmore","hash":{},"data":data}) : helper))) + + "

    \n"; +},"8":function(depth0,helpers,partials,data) { + var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression; + return "

    " + + escapeExpression(((helper = (helper = helpers.signuptosave || (depth0 != null ? depth0.signuptosave : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signuptosave","hash":{},"data":data}) : helper))) + + "

    \n

    " + + escapeExpression(((helper = (helper = helpers.signinfirefox || (depth0 != null ? depth0.signinfirefox : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signinfirefox","hash":{},"data":data}) : helper))) + + "

    \n

    " + + escapeExpression(((helper = (helper = helpers.alreadyhaveacct || (depth0 != null ? depth0.alreadyhaveacct : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"alreadyhaveacct","hash":{},"data":data}) : helper))) + + " " + + escapeExpression(((helper = (helper = helpers.loginnow || (depth0 != null ? depth0.loginnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"loginnow","hash":{},"data":data}) : helper))) + + ".

    \n"; +},"10":function(depth0,helpers,partials,data) { + var stack1, buffer = ""; + stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.controlvariant : depth0), {"name":"if","hash":{},"fn":this.program(11, data),"inverse":this.program(13, data),"data":data}); + if (stack1 != null) { buffer += stack1; } + return buffer; +},"11":function(depth0,helpers,partials,data) { + var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression; + return "

    " + + escapeExpression(((helper = (helper = helpers.signuptosave || (depth0 != null ? depth0.signuptosave : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signuptosave","hash":{},"data":data}) : helper))) + + "

    \n

    " + + escapeExpression(((helper = (helper = helpers.signupfirefox || (depth0 != null ? depth0.signupfirefox : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signupfirefox","hash":{},"data":data}) : helper))) + + "

    \n

    " + + escapeExpression(((helper = (helper = helpers.signupemail || (depth0 != null ? depth0.signupemail : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signupemail","hash":{},"data":data}) : helper))) + + "

    \n

    " + + escapeExpression(((helper = (helper = helpers.alreadyhaveacct || (depth0 != null ? depth0.alreadyhaveacct : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"alreadyhaveacct","hash":{},"data":data}) : helper))) + + " " + + escapeExpression(((helper = (helper = helpers.loginnow || (depth0 != null ? depth0.loginnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"loginnow","hash":{},"data":data}) : helper))) + + ".

    \n"; +},"13":function(depth0,helpers,partials,data) { + var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "

    " + + escapeExpression(((helper = (helper = helpers.tryitnow || (depth0 != null ? depth0.tryitnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"tryitnow","hash":{},"data":data}) : helper))) + + "

    \n

    " + + escapeExpression(((helper = (helper = helpers.alreadyhaveacct || (depth0 != null ? depth0.alreadyhaveacct : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"alreadyhaveacct","hash":{},"data":data}) : helper))) + + " " + + escapeExpression(((helper = (helper = helpers.loginnow || (depth0 != null ? depth0.loginnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"loginnow","hash":{},"data":data}) : helper))) + + ".

    \n

    "; + stack1 = ((helper = (helper = helpers.tos || (depth0 != null ? depth0.tos : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"tos","hash":{},"data":data}) : helper)); + if (stack1 != null) { buffer += stack1; } + return buffer + "

    \n"; +},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) { + var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "
    \n

    Pocket

    \n

    " + + escapeExpression(((helper = (helper = helpers.tagline || (depth0 != null ? depth0.tagline : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"tagline","hash":{},"data":data}) : helper))) + + "

    \n"; + stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.showlearnmore : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(6, data),"data":data}); + if (stack1 != null) { buffer += stack1; } + buffer += "
    \n
    \n
    \n"; + stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.fxasignedin : depth0), {"name":"if","hash":{},"fn":this.program(8, data),"inverse":this.program(10, data),"data":data}); + if (stack1 != null) { buffer += stack1; } + return buffer + "
    \n"; +},"useData":true}); +templates['signupstoryboard_shell'] = template({"1":function(depth0,helpers,partials,data) { + var stack1, buffer = ""; + stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.controlvariant : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data}); + if (stack1 != null) { buffer += stack1; } + return buffer; +},"2":function(depth0,helpers,partials,data) { + var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression; + return "

    " + + escapeExpression(((helper = (helper = helpers.learnmore || (depth0 != null ? depth0.learnmore : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"learnmore","hash":{},"data":data}) : helper))) + + "

    \n"; +},"4":function(depth0,helpers,partials,data) { + var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression; + return "

    " + + escapeExpression(((helper = (helper = helpers.learnmore || (depth0 != null ? depth0.learnmore : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"learnmore","hash":{},"data":data}) : helper))) + + "

    \n"; +},"6":function(depth0,helpers,partials,data) { + var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression; + return "

    " + + escapeExpression(((helper = (helper = helpers.learnmore || (depth0 != null ? depth0.learnmore : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"learnmore","hash":{},"data":data}) : helper))) + + "

    \n"; +},"8":function(depth0,helpers,partials,data) { + var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression; + return "

    " + + escapeExpression(((helper = (helper = helpers.signuptosave || (depth0 != null ? depth0.signuptosave : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signuptosave","hash":{},"data":data}) : helper))) + + "

    \n

    " + + escapeExpression(((helper = (helper = helpers.signinfirefox || (depth0 != null ? depth0.signinfirefox : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signinfirefox","hash":{},"data":data}) : helper))) + + "

    \n

    " + + escapeExpression(((helper = (helper = helpers.alreadyhaveacct || (depth0 != null ? depth0.alreadyhaveacct : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"alreadyhaveacct","hash":{},"data":data}) : helper))) + + " " + + escapeExpression(((helper = (helper = helpers.loginnow || (depth0 != null ? depth0.loginnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"loginnow","hash":{},"data":data}) : helper))) + + ".

    \n"; +},"10":function(depth0,helpers,partials,data) { + var stack1, buffer = ""; + stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.controlvariant : depth0), {"name":"if","hash":{},"fn":this.program(11, data),"inverse":this.program(13, data),"data":data}); + if (stack1 != null) { buffer += stack1; } + return buffer; +},"11":function(depth0,helpers,partials,data) { + var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression; + return "

    " + + escapeExpression(((helper = (helper = helpers.signuptosave || (depth0 != null ? depth0.signuptosave : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signuptosave","hash":{},"data":data}) : helper))) + + "

    \n

    " + + escapeExpression(((helper = (helper = helpers.signupfirefox || (depth0 != null ? depth0.signupfirefox : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signupfirefox","hash":{},"data":data}) : helper))) + + "

    \n

    " + + escapeExpression(((helper = (helper = helpers.signupemail || (depth0 != null ? depth0.signupemail : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signupemail","hash":{},"data":data}) : helper))) + + "

    \n

    " + + escapeExpression(((helper = (helper = helpers.alreadyhaveacct || (depth0 != null ? depth0.alreadyhaveacct : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"alreadyhaveacct","hash":{},"data":data}) : helper))) + + " " + + escapeExpression(((helper = (helper = helpers.loginnow || (depth0 != null ? depth0.loginnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"loginnow","hash":{},"data":data}) : helper))) + + ".

    \n"; +},"13":function(depth0,helpers,partials,data) { + var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "

    " + + escapeExpression(((helper = (helper = helpers.tryitnow || (depth0 != null ? depth0.tryitnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"tryitnow","hash":{},"data":data}) : helper))) + + "

    \n

    " + + escapeExpression(((helper = (helper = helpers.alreadyhaveacct || (depth0 != null ? depth0.alreadyhaveacct : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"alreadyhaveacct","hash":{},"data":data}) : helper))) + + " " + + escapeExpression(((helper = (helper = helpers.loginnow || (depth0 != null ? depth0.loginnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"loginnow","hash":{},"data":data}) : helper))) + + ".

    \n

    "; + stack1 = ((helper = (helper = helpers.tos || (depth0 != null ? depth0.tos : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"tos","hash":{},"data":data}) : helper)); + if (stack1 != null) { buffer += stack1; } + return buffer + "

    \n"; +},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) { + var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "
    \n
    \n
    \n

    " + + escapeExpression(((helper = (helper = helpers.taglinestory_one || (depth0 != null ? depth0.taglinestory_one : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"taglinestory_one","hash":{},"data":data}) : helper))) + + "

    \n
    \n
    \n
    \n
    \n
    \n
    \n

    " + + escapeExpression(((helper = (helper = helpers.taglinestory_two || (depth0 != null ? depth0.taglinestory_two : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"taglinestory_two","hash":{},"data":data}) : helper))) + + "

    \n"; + stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.showlearnmore : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(6, data),"data":data}); + if (stack1 != null) { buffer += stack1; } + buffer += "
    \n
    \n
    \n
    \n
    \n"; + stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.fxasignedin : depth0), {"name":"if","hash":{},"fn":this.program(8, data),"inverse":this.program(10, data),"data":data}); + if (stack1 != null) { buffer += stack1; } + return buffer + "\n
    \n"; +},"useData":true}); +})(); diff --git a/browser/extensions/pocket/content/panels/js/vendor/handlebars.runtime.js b/browser/extensions/pocket/content/panels/js/vendor/handlebars.runtime.js new file mode 100644 index 000000000..c8bb1c452 --- /dev/null +++ b/browser/extensions/pocket/content/panels/js/vendor/handlebars.runtime.js @@ -0,0 +1,660 @@ +/* + + handlebars v2.0.0 + +Copyright (C) 2011-2014 by Yehuda Katz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +@license +*/ +/* exported Handlebars */ +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + define([], factory); + } else if (typeof exports === 'object') { + module.exports = factory(); + } else { + root.Handlebars = root.Handlebars || factory(); + } +}(this, function () { +// handlebars/safe-string.js +var __module3__ = (function() { + "use strict"; + var __exports__; + // Build out our basic SafeString type + function SafeString(string) { + this.string = string; + } + + SafeString.prototype.toString = function() { + return "" + this.string; + }; + + __exports__ = SafeString; + return __exports__; +})(); + +// handlebars/utils.js +var __module2__ = (function(__dependency1__) { + "use strict"; + var __exports__ = {}; + /*jshint -W004 */ + var SafeString = __dependency1__; + + var escape = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'", + "`": "`" + }; + + var badChars = /[&<>"'`]/g; + var possible = /[&<>"'`]/; + + function escapeChar(chr) { + return escape[chr]; + } + + function extend(obj /* , ...source */) { + for (var i = 1; i < arguments.length; i++) { + for (var key in arguments[i]) { + if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { + obj[key] = arguments[i][key]; + } + } + } + + return obj; + } + + __exports__.extend = extend;var toString = Object.prototype.toString; + __exports__.toString = toString; + // Sourced from lodash + // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt + var isFunction = function(value) { + return typeof value === 'function'; + }; + // fallback for older versions of Chrome and Safari + /* istanbul ignore next */ + if (isFunction(/x/)) { + isFunction = function(value) { + return typeof value === 'function' && toString.call(value) === '[object Function]'; + }; + } + var isFunction; + __exports__.isFunction = isFunction; + /* istanbul ignore next */ + var isArray = Array.isArray || function(value) { + return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false; + }; + __exports__.isArray = isArray; + + function escapeExpression(string) { + // don't escape SafeStrings, since they're already safe + if (string instanceof SafeString) { + return string.toString(); + } else if (string == null) { + return ""; + } else if (!string) { + return string + ''; + } + + // Force a string conversion as this will be done by the append regardless and + // the regex test will do this transparently behind the scenes, causing issues if + // an object's to string has escaped characters in it. + string = "" + string; + + if(!possible.test(string)) { return string; } + return string.replace(badChars, escapeChar); + } + + __exports__.escapeExpression = escapeExpression;function isEmpty(value) { + if (!value && value !== 0) { + return true; + } else if (isArray(value) && value.length === 0) { + return true; + } else { + return false; + } + } + + __exports__.isEmpty = isEmpty;function appendContextPath(contextPath, id) { + return (contextPath ? contextPath + '.' : '') + id; + } + + __exports__.appendContextPath = appendContextPath; + return __exports__; +})(__module3__); + +// handlebars/exception.js +var __module4__ = (function() { + "use strict"; + var __exports__; + + var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; + + function Exception(message, node) { + var line; + if (node && node.firstLine) { + line = node.firstLine; + + message += ' - ' + line + ':' + node.firstColumn; + } + + var tmp = Error.prototype.constructor.call(this, message); + + // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. + for (var idx = 0; idx < errorProps.length; idx++) { + this[errorProps[idx]] = tmp[errorProps[idx]]; + } + + if (line) { + this.lineNumber = line; + this.column = node.firstColumn; + } + } + + Exception.prototype = new Error(); + + __exports__ = Exception; + return __exports__; +})(); + +// handlebars/base.js +var __module1__ = (function(__dependency1__, __dependency2__) { + "use strict"; + var __exports__ = {}; + var Utils = __dependency1__; + var Exception = __dependency2__; + + var VERSION = "2.0.0"; + __exports__.VERSION = VERSION;var COMPILER_REVISION = 6; + __exports__.COMPILER_REVISION = COMPILER_REVISION; + var REVISION_CHANGES = { + 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it + 2: '== 1.0.0-rc.3', + 3: '== 1.0.0-rc.4', + 4: '== 1.x.x', + 5: '== 2.0.0-alpha.x', + 6: '>= 2.0.0-beta.1' + }; + __exports__.REVISION_CHANGES = REVISION_CHANGES; + var isArray = Utils.isArray, + isFunction = Utils.isFunction, + toString = Utils.toString, + objectType = '[object Object]'; + + function HandlebarsEnvironment(helpers, partials) { + this.helpers = helpers || {}; + this.partials = partials || {}; + + registerDefaultHelpers(this); + } + + __exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = { + constructor: HandlebarsEnvironment, + + logger: logger, + log: log, + + registerHelper: function(name, fn) { + if (toString.call(name) === objectType) { + if (fn) { throw new Exception('Arg not supported with multiple helpers'); } + Utils.extend(this.helpers, name); + } else { + this.helpers[name] = fn; + } + }, + unregisterHelper: function(name) { + delete this.helpers[name]; + }, + + registerPartial: function(name, partial) { + if (toString.call(name) === objectType) { + Utils.extend(this.partials, name); + } else { + this.partials[name] = partial; + } + }, + unregisterPartial: function(name) { + delete this.partials[name]; + } + }; + + function registerDefaultHelpers(instance) { + instance.registerHelper('helperMissing', function(/* [args, ]options */) { + if(arguments.length === 1) { + // A missing field in a {{foo}} constuct. + return undefined; + } else { + // Someone is actually trying to call something, blow up. + throw new Exception("Missing helper: '" + arguments[arguments.length-1].name + "'"); + } + }); + + instance.registerHelper('blockHelperMissing', function(context, options) { + var inverse = options.inverse, + fn = options.fn; + + if(context === true) { + return fn(this); + } else if(context === false || context == null) { + return inverse(this); + } else if (isArray(context)) { + if(context.length > 0) { + if (options.ids) { + options.ids = [options.name]; + } + + return instance.helpers.each(context, options); + } else { + return inverse(this); + } + } else { + if (options.data && options.ids) { + var data = createFrame(options.data); + data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name); + options = {data: data}; + } + + return fn(context, options); + } + }); + + instance.registerHelper('each', function(context, options) { + if (!options) { + throw new Exception('Must pass iterator to #each'); + } + + var fn = options.fn, inverse = options.inverse; + var i = 0, ret = "", data; + + var contextPath; + if (options.data && options.ids) { + contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; + } + + if (isFunction(context)) { context = context.call(this); } + + if (options.data) { + data = createFrame(options.data); + } + + if(context && typeof context === 'object') { + if (isArray(context)) { + for(var j = context.length; ia?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="
    ",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+Math.random()}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b) +},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthx",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*\s*$/g,ib={option:[1,""],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("