diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..749f333 --- /dev/null +++ b/LICENSE @@ -0,0 +1,8 @@ +The MIT License (MIT) +Copyright (c) 2013-2015 Asana + +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. diff --git a/README b/README index 169be64..a979e29 100644 --- a/README +++ b/README @@ -4,11 +4,10 @@ integrates Asana into your web experience in the following ways: * Creates a button in your button-bar which, when clicked, pops up a QuickAdd window to create a new task associated with the current web page. - It will populate the task name with the page title by default, and - put the URL in the notes, along with any text you may have selected - when you pressed the button. + You can click a button to populate the task name with the page title and + the URL and current selected text in the notes. - * Installs the special Asana TAB+Q keyboard shortcut. When this key combo + * Installs the special Asana ALT+A keyboard shortcut. When this key combo is pressed from any web page, it brings up the same popup. This functionality will operate on any window opened after the extension is loaded. diff --git a/api_bridge.js b/api_bridge.js index 38b2286..1e9da67 100644 --- a/api_bridge.js +++ b/api_bridge.js @@ -1,14 +1,13 @@ /** * Functionality to communicate with the Asana API. This should get loaded * in the "server" portion of the chrome extension because it will make - * HTTP requests and needs cross-domain priveleges. + * HTTP requests and needs cross-domain privileges. * * The bridge does not need to use an auth token to connect to - * the API, because since it is a browser extension it can access - * the user's cookies, and can use them to authenticate to the API. - * This capability is specific to browser extensions, and other - * types of applications would have to obtain an auth token to communicate - * with the API. + * the API. Since it is a browser extension it can access the user's cookies + * and can use them to authenticate to the API. This capability is specific + * to browser extensions, and other types of applications would have to obtain + * an auth token to communicate with the API. */ Asana.ApiBridge = { @@ -17,6 +16,26 @@ Asana.ApiBridge = { */ API_VERSION: "1.0", + /** + * @type {Integer} How long an entry stays in the cache. + */ + CACHE_TTL_MS: 15 * 60 * 1000, + + /** + * @type {Boolean} Set to true on the server (background page), which will + * actually make the API requests. Clients will just talk to the API + * through the ExtensionServer. + * + */ + is_server: false, + + /** + * @type {dict} Map from API path to cache entry for recent GET requests. + * date {Date} When cache entry was last refreshed + * response {*} Cached request. + */ + _cache: {}, + /** * @param opt_options {dict} Options to use; if unspecified will be loaded. * @return {String} The base URL to use for API requests. @@ -37,9 +56,64 @@ Asana.ApiBridge = { * data {dict} Object representing response of API call, depends on * method. Only available if response was a 200. * error {String?} Error message, if there was a problem. + * @param options {dict?} + * miss_cache {Boolean} Do not check cache before requesting */ - request: function(http_method, path, params, callback) { - var url = this.baseApiUrl() + path; + request: function(http_method, path, params, callback, options) { + var me = this; + http_method = http_method.toUpperCase(); + + // If we're not the server page, send a message to it to make the + // API request. + if (!me.is_server) { + console.info("Client API Request", http_method, path, params); + chrome.runtime.sendMessage({ + type: "api", + method: http_method, + path: path, + params: params, + options: options || {} + }, callback); + return; + } + + console.info("Server API Request", http_method, path, params); + + // Serve from cache first. + if (!options.miss_cache && http_method === "GET") { + var data = me._readCache(path, new Date()); + if (data) { + console.log("Serving request from cache", path); + callback(data); + return; + } + } + + // Be polite to Asana API and tell them who we are. + var manifest = chrome.runtime.getManifest(); + var client_name = [ + "chrome-extension", + chrome.i18n.getMessage("@@extension_id"), + manifest.version, + manifest.name + ].join(":"); + + var url = me.baseApiUrl() + path; + var body_data; + if (http_method === "PUT" || http_method === "POST") { + // POST/PUT request, put params in body + body_data = { + data: params, + options: { client_name: client_name } + }; + } else { + // GET/DELETE request, add params as URL parameters. + var url_params = Asana.update({ opt_client_name: client_name }, params); + url += "?" + $.param(url_params); + } + + console.log("Making request to API", http_method, url); + chrome.cookies.get({ url: url, name: 'ticket' @@ -59,10 +133,14 @@ Asana.ApiBridge = { url: url, timeout: 30000, // 30 second timeout headers: { - "X-Requested-With": "XMLHttpRequest" + "X-Requested-With": "XMLHttpRequest", + "X-Allow-Asana-Client": "1" }, accept: "application/json", success: function(data, status, xhr) { + if (http_method === "GET") { + me._writeCache(path, data, new Date()); + } callback(data); }, error: function(xhr, status, error) { @@ -80,7 +158,7 @@ Asana.ApiBridge = { } callback(response); } else { - callback({ error: error || status }); + callback({ errors: [{message: error || status }]}); } }, xhrFields: { @@ -88,12 +166,27 @@ Asana.ApiBridge = { } }; if (http_method === "POST" || http_method === "PUT") { - attrs.data = JSON.stringify({data: params}); + attrs.data = JSON.stringify(body_data); attrs.dataType = "json"; attrs.processData = false; attrs.contentType = "application/json"; } $.ajax(attrs); }); + }, + + _readCache: function(path, date) { + var entry = this._cache[path]; + if (entry && entry.date >= date - this.CACHE_TTL_MS) { + return entry.response; + } + return null; + }, + + _writeCache: function(path, response, date) { + this._cache[path] = { + response: response, + date: date + }; } }; diff --git a/asana.js b/asana.js index 719d6b7..a4d1d41 100644 --- a/asana.js +++ b/asana.js @@ -1,4 +1,68 @@ /** * Define the top-level Asana namespace. */ -Asana = {}; \ No newline at end of file +Asana = { + + // When popping up a window, the size given is for the content. + // When resizing the same window, the size must include the chrome. Sigh. + CHROME_TITLEBAR_HEIGHT: 24, + // Natural dimensions of popup window. The Chrome popup window adds 10px + // bottom padding, so we must add that as well when considering how tall + // our popup window should be. + POPUP_UI_HEIGHT: 310 + 10, + POPUP_UI_WIDTH: 410, + // Size of popup when expanded to include assignee list. + POPUP_EXPANDED_UI_HEIGHT: 310 + 10 + 129, + + // If the modifier key is TAB, amount of time user has from pressing it + // until they can press Q and still get the popup to show up. + QUICK_ADD_WINDOW_MS: 5000 + + +}; + +/** + * Things borrowed from asana library. + */ + + +Asana.update = function(to, from) { + for (var k in from) { + to[k] = from[k]; + } + return to; +}; + +Asana.Node = { + + /** + * Ensures that the bottom of the element is visible. If it is not then it + * will be scrolled up enough to be visible. + * + * Note: this does not take account of the size of the window. That's ok for + * now because the scrolling element is not the top-level element. + */ + ensureBottomVisible: function(node) { + var el = $(node); + var pos = el.position(); + var element_from_point = document.elementFromPoint( + pos.left, pos.top + el.height()); + if (element_from_point === null || + $(element_from_point).closest(node).size() === 0) { + node.scrollIntoView(/*alignWithTop=*/ false); + } + } + +}; + +if (!RegExp.escape) { + // Taken from http://simonwillison.net/2006/Jan/20/escape/ + RegExp.escape = function(text, opt_do_not_escape_spaces) { + if (opt_do_not_escape_spaces !== true) { + return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); // nolint + } else { + // only difference is lack of escaping \s + return text.replace(/[-[\]{}()*+?.,\\^$|#]/g, "\\$&"); // nolint + } + }; +} diff --git a/background.html b/background.html deleted file mode 100644 index ea54961..0000000 --- a/background.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/background.js b/background.js new file mode 100644 index 0000000..fb62544 --- /dev/null +++ b/background.js @@ -0,0 +1,26 @@ +Asana.ExtensionServer.listen(); +Asana.ServerModel.startPrimingCache(); + +// Modify referer header sent to typekit, to allow it to serve to us. +// See http://stackoverflow.com/questions/12631853/google-chrome-extensions-with-typekit-fonts +chrome.webRequest.onBeforeSendHeaders.addListener(function(details) { + var requestHeaders = details.requestHeaders; + for (var i = 0; i < requestHeaders.length; ++i) { + if (requestHeaders[i].name.toLowerCase() === 'referer') { + // The request was certainly not initiated by a Chrome extension... + return; + } + } + // Set Referer + requestHeaders.push({ + name: 'referer', + // Host must match the domain in our Typekit kit settings + value: 'https://abkfopjdddhbjkiamjhkmogkcfedcnml' + }); + return { + requestHeaders: requestHeaders + }; +}, { + urls: ['*://use.typekit.net/*'], + types: ['stylesheet', 'script'] +}, ['requestHeaders','blocking']); diff --git a/extension_server.js b/extension_server.js index eaeb190..5d74ce3 100644 --- a/extension_server.js +++ b/extension_server.js @@ -9,22 +9,19 @@ Asana.ExtensionServer = { * requests from page clients, which can't make cross-domain requests. */ listen: function() { - var self = this; - chrome.extension.onRequest.addListener(function(request, sender, sendResponse) { + var me = this; + + // Mark our Api Bridge as the server side (the one that actually makes + // API requests to Asana vs. just forwarding them to the server window). + Asana.ApiBridge.is_server = true; + + chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { if (request.type === "api") { // Request to the API. Pass it on to the bridge. - Asana.ApiBridge.api( - request.method, request.path, request.data || {}, sendResponse); - - } else if (request.type === "quick_add") { - // QuickAdd request, made from a content window. - // Open up a new popup, and set the request information on its window - // (see popup.html for how it's used) - var popup = window.open( - chrome.extension.getURL('popup.html') + '?external=true', - "asana_quick_add", - "dependent=1,resizable=0,location=0,menubar=0,status=0,toolbar=0,width=410,height=310"); - popup.quick_add_request = request; + Asana.ApiBridge.request( + request.method, request.path, request.params, sendResponse, + request.options || {}); + return true; // will call sendResponse asynchronously } }); } diff --git a/icon128.png b/icon128.png index f08c0e3..b7c3889 100644 Binary files a/icon128.png and b/icon128.png differ diff --git a/icon16.png b/icon16.png new file mode 100644 index 0000000..8378423 Binary files /dev/null and b/icon16.png differ diff --git a/icon19.png b/icon19.png deleted file mode 100644 index b85547a..0000000 Binary files a/icon19.png and /dev/null differ diff --git a/icon48.png b/icon48.png new file mode 100644 index 0000000..00ed2f0 Binary files /dev/null and b/icon48.png differ diff --git a/manifest.json b/manifest.json index e67fc44..49e8e72 100644 --- a/manifest.json +++ b/manifest.json @@ -1,43 +1,34 @@ { - "manifest_version": 2, - "name": "Asana Extension for Chrome", - "version": "0.9.1", - "description": "Integrates Asana with your browsing experience.", - "icons": { - "128": "icon128.png" - }, - "minimum_chrome_version": "16", - - "browser_action": { - "default_icon": "icon19.png", - "default_title": "Asana", - "default_popup": "popup.html" - }, - "background": { - "page": "background.html" - }, - "options_page": "options.html", - "permissions": [ - "tabs", - "*://*/*", - "cookies", - "*://*.asana.com/*", - "*://localhost.org/*" - ], - - "content_scripts": [{ - "matches": [ - "" - ], - "exclude_matches": [ - "*://*.asana.com/*" - ], - "js": [ - "asana.js", - "selection_client.js", - "quick_add_client.js" - ], - "run_at": "document_start", - "all_frames": false - }] + "background": { + "persistent": true, + "scripts": [ "jquery-1.7.1.min.js", "asana.js", "api_bridge.js", "extension_server.js", "server_model.js", "options.js", "background.js" ] + }, + "browser_action": { + "default_icon": "icon48.png", + "default_popup": "popup.html", + "default_title": "Asana" + }, + "commands": { + "_execute_browser_action": { + "suggested_key": { + "default": "Alt+Shift+A" + } + } + }, + "content_security_policy": "script-src 'self'; object-src 'self'", + "description": "Quickly add tasks to Asana from any web page.", + "icons": { + "128": "icon128.png", + "16": "icon16.png", + "48": "icon48.png" + }, + "incognito": "split", + "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4sI7XDofuEsAUZM1sM8mT0DSprcta07RgHfxG1PDJm5WJv5WmF6STIyE4xkSZY42UI+Ogei/YZeG4F7VWiB5k5pMLbktMoKE8GZRzD5/Jpyx9W7F7auYct1Pqf35wdC1atN7bVwxnsAK/KNXQvSI7kW3JUqGGg4wSGW4ADbJaYwIDAQAB", + "manifest_version": 2, + "minimum_chrome_version": "25", + "name": "Asana Extension for Chrome", + "offline_enabled": false, + "permissions": [ "activeTab", "cookies", "webRequest", "webRequestBlocking", "*://*.asana.com/*" ], + "update_url": "https://clients2.google.com/service/update2/crx", + "version": "1.2.0" } diff --git a/nopicture.png b/nopicture.png new file mode 100644 index 0000000..be98f2a Binary files /dev/null and b/nopicture.png differ diff --git a/common.css b/options.css similarity index 71% rename from common.css rename to options.css index 7c816a7..337d8b7 100644 --- a/common.css +++ b/options.css @@ -1,3 +1,4 @@ +/* Common styles? */ body, td, div { font-size: 14px; font-family: "Helvetica Neue", Arial, sans-serif; @@ -5,8 +6,8 @@ body, td, div { } .close-x { + display: block; cursor: pointer; - float: right; width: 14px; height: 14px; background-image: url(sprite.png); @@ -75,4 +76,60 @@ a:link, a:visited { } a:hover { text-decoration: underline; +} + + + +/* Styles for options.html */ +body { + padding: 0; + margin: 0; + background-color: #DDE4EA; +} +body, td, div { + font-size: 13px; +} + +#layout { + width: 100%; +} +#options { + width: 600px; + min-width: 600px; + max-width: 600px; +} + +#status { + height: 30px; +} + +.v-spacer { + height: 100px; +} +.form { + border: 0; + margin: 0; + padding: 0; +} +td.field-name { + width: 150px; + padding: 2px 2px 2px 0; + vertical-align: top; +} +td.field-value { + padding: 2px 0 2px 2px; + vertical-align: top; +} +td.field-notes { + font-size: 11px; + margin-top: 12px; + padding: 2px 0 2px 2px; + vertical-align: top; +} +td.field-spacer { + height: 12px; +} + +#reset_button { + margin-left: 10px; } \ No newline at end of file diff --git a/options.html b/options.html index e44be0a..fdede4a 100644 --- a/options.html +++ b/options.html @@ -1,4 +1,13 @@ + Asana Options @@ -6,8 +15,7 @@ - - + @@ -19,22 +27,6 @@ - - - - - - - - - - -
Default Workspace: -
Loading...
-
- The default workspace where new tasks are added. You can always select - a different workspace when you're creating a task. -
Asana Host: diff --git a/options.js b/options.js index 3ad9b54..e2f10c7 100644 --- a/options.js +++ b/options.js @@ -23,6 +23,14 @@ Asana.Options = { return 'https://' + options.asana_host_port + '/'; }, + /** + * @param opt_options {dict} Options to use; if unspecified will be loaded. + * @return {String} The URL for the signup page. + */ + signupUrl: function(opt_options) { + return 'http://asana.com/?utm_source=chrome&utm_medium=ext&utm_campaign=ext'; + }, + /** * @return {dict} Default options. */ diff --git a/options_style.css b/options_style.css deleted file mode 100644 index fe382ed..0000000 --- a/options_style.css +++ /dev/null @@ -1,53 +0,0 @@ -/* Styles for options.html */ -body { - padding: 0; - margin: 0; - background-color: #DDE4EA; -} -body, td, div { - font-size: 13px; -} - -#layout { - width: 100%; -} -#options { - width: 600px; - min-width: 600px; - max-width: 600px; -} - -#status { - height: 30px; -} - -.v-spacer { - height: 100px; -} -.form { - border: 0; - margin: 0; - padding: 0; -} -td.field-name { - width: 150px; - padding: 2px 2px 2px 0; - vertical-align: top; -} -td.field-value { - padding: 2px 0 2px 2px; - vertical-align: top; -} -td.field-notes { - font-size: 11px; - margin-top: 12px; - padding: 2px 0 2px 2px; - vertical-align: top; -} -td.field-spacer { - height: 12px; -} - -#reset_button { - margin-left: 10px; -} \ No newline at end of file diff --git a/popup.css b/popup.css new file mode 100644 index 0000000..8538bd8 --- /dev/null +++ b/popup.css @@ -0,0 +1,644 @@ +/* Styles for popup.html */ + +/* Fonts */ + +@font-face { + font-family: 'proxima-nova'; + src: url("https://app.asana.com/-/static/apps/asana/media/fonts/proxima-nova/ProximaNova-ThinWeb.woff") format('woff'); + font-weight: 200; +} + +@font-face { + font-family: 'proxima-nova'; + src: url("https://app.asana.com/-/static/apps/asana/media/fonts/proxima-nova/ProximaNova-RegWeb.woff") format('woff'); + font-weight: 400; +} + +@font-face { + font-family: 'proxima-nova'; + src: url("https://app.asana.com/-/static/apps/asana/media/fonts/proxima-nova/ProximaNova-SboldWeb.woff") format('woff'); + font-weight: 600; +} + +@font-face { + font-family: 'proxima-nova'; + src: url("https://app.asana.com/-/static/apps/asana/media/fonts/proxima-nova/ProximaNova-BoldWeb.woff") format('woff'); + font-weight: 700; +} + + +/* Common widgets, from Asana app */ + +.buttonView { + -webkit-box-align: center; + -webkit-box-pack: center; + -webkit-box-sizing: border-box; + align-items: center; + border-radius: 3px; + border-style: solid; + border-width: 1px; + cursor: pointer; + display: inline-flex; + flex-shrink: 0; + font-size: 14px; + min-width: 60px; + transition: background 200ms,border 200ms,box-shadow 200ms,color 200ms; +} + +.buttonView:focus, .buttonView:hover { + outline: none; +} + +.buttonView.buttonView--primary { + background: #1AAFD0; + border-color: #1AAFD0; + color: #fff; +} + +.buttonView.buttonView--primary.is-disabled { + -webkit-box-shadow: inset 0 0 transparent,0 0 0 0 transparent; + background: #EFF0F1; + border: 1px solid #E1E2E4; + color: #898E95; + fill: #898E95; + cursor: default; +} + +.buttonView.buttonView--primary:focus:not(.is-disabled), +.buttonView.buttonView--primary:hover:not(.is-disabled) { + background: #02ceff; + border-color: #02ceff; + -webkit-box-shadow: inset 0 0 transparent,0 0 0 3px #80E6FF; +} + +.buttonView.buttonView--primary:active:not(.is-disabled) { + -webkit-box-shadow: inset 0 1px rgba(0,0,0,0.2),0 0 0 0 transparent; +} + +.buttonView.buttonView--large { + height: 40px; + padding: 0 15px; +} + +.Avatar { + -webkit-box-align: center; + -webkit-box-pack: center; + align-items: center; + background: center/cover #cdcfd2; + border-radius: 50%; + box-shadow: inset 0 0 0 1px rgba(0,0,0,0.2); + box-sizing: border-box; + color: #fff; + display: inline-flex; + justify-content: center; + position: relative; + vertical-align: top; +} + +.Avatar--small { + font-size: 12px; + height: 24px; + width: 24px; +} + +.Avatar--inbox { + font-size: 12px; + height: 30px; + width: 30px; +} + +.generic-input { + -webkit-border-radius: 3px 3px 3px 3px; + -webkit-box-sizing: border-box; + border: 1px solid #CDCFD2; + color: #1B2432; + display: inline-block; +} +.generic-input:hover { + border-color: #A1A4AA; + transition: border-color 150ms; +} +.generic-input:focus { + -webkit-box-shadow: inset 0 1px #E1E2E4; + animation: input-outline-glow 0.5s ease-out 75ms; + outline: none; + border-color: #A1A4AA; +} + +.tokenAreaView { + background: #fff; + cursor: text; + padding: 5px 0 0 5px; + min-width: 100px; +} + +.tokenView { + background: #E8F7FB; + border-color: #80E6FF; + color: #1AAFD0; + + -webkit-box-align: center; + align-items: center; + -ms-flex-align: center; + border: 1px solid; + border-radius: 15px; + box-sizing: border-box; + cursor: pointer; + display: inline-flex; + height: 30px; + padding-left: 15px; + position: relative; +} +.tokenView:hover { + background: #E8F7FB; + border-color: #02ceff; + color: #02ceff; + transition: background .15s,border .15s,color .15s,fill .15s; +} +.tokenView:focus { + background: #02ceff; + border-color: #02ceff; + color: #fff; + fill: #fff; + outline:none; +} +.tokenAreaView .tokenView { + margin: 0 5px 5px 0; +} + +.tokenView-label { + -webkit-box-align: center; + align-items: center; + display: flex; + max-width: 180px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.tokenView-label .tokenView-labelText { + text-overflow: ellipsis; + overflow: hidden; +} + +.tokenView-remove { + -webkit-box-align: center; + -webkit-box-sizing: border-box; + align-items: center; + border-radius: 50%; + display: inline-flex; + fill: #B9BCC0; + height: 16px; + -webkit-box-pack: center; + justify-content: center; + margin: 0 5px; + padding: 3px; + width: 16px; +} +.tokenView .tokenView-remove { + fill: #80E6FF; +} +.tokenView:focus .tokenView-remove { + fill: #fff; +} +.tokenView .tokenView-remove:hover { + fill: #fff; + background: #80E6FF; +} + +.photo-view { + -webkit-box-sizing: border-box; + display: inline-block; +} +.photo-view.small { + height: 24px; + width: 24px; +} +.photo-view.inbox { + height: 30px; + width: 30px; +} + +.tokenView-photo { + margin-left: -13px; + margin-right: 5px; +} + +.tokenAreaView .token-input { + -webkit-box-sizing: border-box; + -webkit-box-shadow: none; + border: none; + color: #1B2432; + height: 30px; + line-height: 30px; + margin-bottom: 5px; + overflow: hidden; + padding-left: 2px; + resize: none; + vertical-align: top; +} + +.svgIcon { + height: 16px; + width: 16px; +} + + +.close-x { + display: block; + cursor: pointer; + width: 16px; + height: 16px; + margin: 8px 0px 0px -4px; + background-position: -175px 0px; +} +.close-x:hover { + background-position: -175px -25px; +} + +.svgIcon-dropdownarrow { + width: 16px; + height: 16px; + fill: #898E95; +} +.svgIcon-dropdownarrow:hover { + fill: #80E6FF; +} + + +a:link, a:visited { + color: #1AAFD0; + cursor: pointer; + text-decoration: none; +} +a:hover { + text-decoration: underline; +} + +::-webkit-scrollbar{ + width: 14px; +} +::-webkit-scrollbar-thumb { + background: rgba(0,0,0,.05); + box-shadow: inset 0px -1px rgba(0,0,0,.12); +} + +::-webkit-scrollbar-thumb:hover { + background: rgba(0,0,0, .08); +} + +::-webkit-scrollbar-track { + background-color: rgba(0,0,0, .05); +} + +textarea::-webkit-scrollbar { + width: 7px; + background: #E5F1FF; +} +textarea::-webkit-scrollbar-thumb { + background: rgba(116, 193, 237, 0.3); +} +textarea::-webkit-scrollbar-thumb:hover { + background: rgba(116, 193, 237, 0.5); +} + + +/* Popup-specific layout */ + +body { + overflow: hidden; + /* Also affects Asana.POPUP_UI_WIDTH and Asana.POPUP_UI_HEIGHT */ + width: 410px; + height: 310px; /* keep this correct for the window-based (non-button) version */ + padding: 0px; + margin: 0px; + background-color: #fff; + font-size: 14px; + font-family: proxima-nova, "Helvetica Neue", Arial, sans-serif; +} + +a, input, textarea { + outline: none; +} + +.sprite { + background-image: url('./sprite.png'); + background-repeat: no-repeat; + display: inline-block; +} + +@media only screen and (-webkit-min-device-pixel-ratio: 2) { + .sprite { + background-image: url('./sprite-retina.png'); + background-size: 250px 75px; + } +} + +.left-column { + display: inline-block; + margin-left: 12px; + width: 24px; + height: 24px; + vertical-align: middle; +} +.middle-column { + display: inline-block; + width: 304px; + padding: 0 8px 0 8px; + vertical-align: middle; +} +.right-column { + display: inline-block; + margin-right: 8px; + margin-left: 4px; + width: 30px; + height: 30px; + vertical-align: middle; + text-align: center; +} + +.left-column .sprite { + margin-top: 3px; + height: 18px; + width: 24px; +} + +/* Popup areas */ + +.banner { + font-size: 19px; + font-weight: 600; + background-color:#f2f2f2; + color: #596573; + text-shadow: 0px 1px #fff; + border-bottom: 1px solid #c0ccd7; + -webkit-border-radius: 1px 1px 0px 0px; + background: -webkit-gradient(linear, left top, left bottom, from(white), color-stop(100%, #edf1f4)); +} + +.notes-row .left-column, .notes-row .middle-column, .notes-row .right-column, +.assignee-row .left-column, .assignee-row .middle-column, .assignee-row .right-column { + vertical-align: top; +} + +.banner .middle-column { + line-height: 46px; + padding-top: 2px; +} + +.banner .button { + height: 26px; + width: 26px; + border: 1px solid #c0ccd7; + box-shadow: 0px 1px 0px 0px white; + padding: 0; +} + +.banner-add { + position: relative; +} + +.banner-add #workspace { + font-weight: 200; +} + +.icon-checkbox { + background-position: -25px 0px; +} + +.sprite.icon-notes { + margin-top: 5px; + background-position: -50px 0px; +} + +.sprite.icon-assignee { + margin-top: 12px; + background-position: -75px 0px; +} + +#workspace_select_container { + display: inline-block; + vertical-align: middle; + line-height: 100%; +} + +#workspace_select { + opacity: 0; + position: absolute; + right: 0px; + top: -4px; + padding: 8px 0px; + -webkit-appearance: none; + margin: 0; +} + +.name-row { + padding-top: 11px; + padding-bottom: 12px; +} + +.name-row .left-column .sprite { margin-top: 2px; } + +#name_input, #notes_input, #assignee { + width: 100%; +} + +.name-row #name_input { + font-size: 20px; +} + +.notes-row { + border-bottom: 1px solid #e5e5e5; + padding-bottom: 8px; +} + +.assignee-row { + padding-top: 12px; +} + +.notes-row #notes_input { + resize: none; + height: 96px; +} + +#use_page_details { + width: 20px; + height: 20px; + position: relative; + border: 1px solid transparent; + border-radius: 3px; + padding: 5px 2px 3px 6px; + cursor: pointer; +} + +#use_page_details:not(.disabled):hover { + border: 1px solid #e5e5e5; +} + +#use_page_details.disabled { + opacity: .25; + cursor: default; +} + +#use_page_details:not(.disabled):hover .icon-use-link-arrow { + background-position: -225px -25px; +} + +.icon-use-link { + height: 16px; + width: 16px; + background-size: 16px 16px; +} + +.icon-use-link.no-favicon { + height: 18px; + width: 18px; + background-position: -200px 0px; + background-size: auto auto; +} + +#use_page_details:not(.disabled):hover .icon-use-link.no-favicon { + background-position: -200px -25px; +} + +.icon-use-link-arrow { + height: 18px; + width: 18px; + background-position: -225px 0px; + position: absolute; + top: 7px; + left: 3px; +} + +#assignee { + font-weight: 600; +} + +#assignee .unassigned { + color: #a9a9a9; + font-weight: normal; +} + +.user { + height: 32px; + font-size: 14px; + padding: 8px 0 8px 54px; + cursor: pointer; +} + +.user.selected { + background-color: #1AAFD0; + color: white; +} + +.user .Avatar { + vertical-align: middle; + margin-right: 10px; +} + +.user-name { + display: inline-block; + overflow: hidden; + text-overflow: ellipsis; + margin-left: 3px; +} + +#assignee_list_container { + /* Also affects Asana.POPUP_EXPANDED_UI_HEIGHT */ + height: 121px; + overflow-x: hidden; + overflow-y: scroll; + border-bottom: 1px solid #e5e5e5; + margin-top: 8px; +} + +.buttons { + padding: 14px 0 0 0; +} + +.footer { + padding: 14px 0 0 0; +} + +.footer-status { + width: 100%; + color: #1B2432; + display: inline-block; + vertical-align: middle; + padding: 12px 16px; + font-size: 14px; + line-height: 17px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.footer-status a { + font-weight: 600; + text-decoration: none; + color: #5998c0; +} + +#success { + background-color: #fff; +} + +#error { + background-color: #FD9A00; + color: #fff; +} + +#login_view { + width: 100%; + height: 100%; + background-color: #edf1f4; +} + +#login_view .content { + padding-top: 65px; + width: 250px; + margin: 0 auto; + text-align: center; + font-size: 19px; + font-weight: 400; + color: #596573; +} + +#login_view .buttonView { + margin-top: 24px; +} + +#login_view #signup_button { + margin-right: 8px; +} + +.icon-success, .icon-error { + width: 16px; + height: 16px; + display: inline-block; + vertical-align: top; + margin-right: 3px; +} + +.icon-success { background-position: -100px 0px; } +.icon-error { background-position: -125px 0px; margin-right: 7px; } + +input, textarea, #assignee { + color: #212F40; + padding: 6px 5px; + border: 1px solid transparent; + -webkit-border-radius: 3px; + font-size: 14px; + font-family: proxima-nova, "Helvetica Neue", Arial, sans-serif; + margin: 0; +} + +input:hover, textarea:hover, #assignee:hover { + border: 1px solid #cccccc; + -webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.1); +} + +input:focus, textarea:focus { + border: 1px solid #74C1ED; + box-shadow: 0px 0px 5px 1px rgba(31, 141, 214, 0.3); +} diff --git a/popup.html b/popup.html index 5d3aecf..8e91c44 100644 --- a/popup.html +++ b/popup.html @@ -1,3 +1,10 @@ + + + @@ -6,74 +13,120 @@ - - + + + Asana Quick Add + - +