├── LICENSE ├── README ├── background.html ├── images ├── add.png ├── archive.png ├── chromed_default.png ├── chromed_error.png ├── chromed_saved.png ├── chromed_saving.png ├── default.png ├── donation_ribbon.png ├── error.png ├── forkme_ribbon.png ├── icon │ ├── 128.png │ ├── 16.png │ ├── 32.png │ └── 48.png ├── options.png ├── saved.png ├── saving.png ├── starred.png ├── text_view.png └── unread.png ├── javascripts ├── app.js ├── background.js ├── greader.js ├── instapaper.api.js ├── instapaper.auth.js ├── instapaper.js ├── keyboard.js ├── lib │ ├── ajaxRequest.js │ ├── elastic.js │ ├── oauth.js │ └── sha1.js ├── options.js └── popup.js ├── manifest.json ├── options.html ├── popup.html └── stylesheets ├── elastic.css ├── options.css └── popup.css /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2010-2012 Edgar J. Suarez 2 | 3 | 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: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | 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. 8 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Chrome extension for saving tab to instapaper. 2 | 3 | You can find it here: 4 | https://chrome.google.com/extensions/detail/fldildgghjoohccppflaohodcnmlacpb 5 | -------------------------------------------------------------------------------- /background.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Instachrome Popup 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /images/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/add.png -------------------------------------------------------------------------------- /images/archive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/archive.png -------------------------------------------------------------------------------- /images/chromed_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/chromed_default.png -------------------------------------------------------------------------------- /images/chromed_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/chromed_error.png -------------------------------------------------------------------------------- /images/chromed_saved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/chromed_saved.png -------------------------------------------------------------------------------- /images/chromed_saving.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/chromed_saving.png -------------------------------------------------------------------------------- /images/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/default.png -------------------------------------------------------------------------------- /images/donation_ribbon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/donation_ribbon.png -------------------------------------------------------------------------------- /images/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/error.png -------------------------------------------------------------------------------- /images/forkme_ribbon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/forkme_ribbon.png -------------------------------------------------------------------------------- /images/icon/128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/icon/128.png -------------------------------------------------------------------------------- /images/icon/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/icon/16.png -------------------------------------------------------------------------------- /images/icon/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/icon/32.png -------------------------------------------------------------------------------- /images/icon/48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/icon/48.png -------------------------------------------------------------------------------- /images/options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/options.png -------------------------------------------------------------------------------- /images/saved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/saved.png -------------------------------------------------------------------------------- /images/saving.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/saving.png -------------------------------------------------------------------------------- /images/starred.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/starred.png -------------------------------------------------------------------------------- /images/text_view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/text_view.png -------------------------------------------------------------------------------- /images/unread.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/images/unread.png -------------------------------------------------------------------------------- /javascripts/app.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | $.db = function(attr, val) { 3 | var isJSON = function(str) { 4 | return (typeof str === 'string' && /^\{.*\}$/.test(str)); 5 | }; 6 | if(typeof val === 'undefined') { 7 | return isJSON(localStorage[attr]) ? JSON.parse(localStorage[attr]) : localStorage[attr]; 8 | } else { 9 | if(val.constructor === Object) { 10 | localStorage[attr] = JSON.stringify(val); 11 | } else { 12 | localStorage[attr] = val; 13 | } 14 | return val; 15 | } 16 | }; 17 | })(jQuery); 18 | -------------------------------------------------------------------------------- /javascripts/background.js: -------------------------------------------------------------------------------- 1 | var last_tab_id, 2 | skip_auto_close; 3 | var badge_styles = { 4 | TEXT: 0, 5 | ICON: 1, 6 | CHROMED: 2, 7 | UNREAD: 3 8 | }; 9 | 10 | var badge = { 11 | idle: function(tabId) { 12 | var tabImg = 'images/default.png'; 13 | if (parseInt($.db('badge_style')) === badge_styles.CHROMED) { 14 | tabImg = 'images/chromed_default.png'; 15 | } 16 | function setIcon(id) { 17 | chrome.browserAction.setIcon({ 18 | path: tabImg, 19 | tabId: id 20 | }); 21 | var feed = $.db('rssfeed'); 22 | if(feed && $.db('badge_style') == badge_styles.UNREAD) { 23 | var xhr = new XMLHttpRequest(); 24 | xhr.onreadystatechange = function() { 25 | if(xhr.readyState == 4 && 26 | xhr.status == 200) { 27 | badgetext = xhr.responseText.match(//g).length; 28 | if (badgetext > 0) { 29 | chrome.browserAction.setBadgeText({ 30 | text: '' + badgetext 31 | }); 32 | } 33 | } 34 | }; 35 | xhr.open('GET', feed, true); 36 | xhr.send(); 37 | } else { 38 | chrome.browserAction.setBadgeText({ 39 | text: '', 40 | tabId: id 41 | }); 42 | } 43 | } 44 | if(!tabId) { 45 | chrome.tabs.getSelected(null, function(tab) { 46 | setIcon(tab.id); 47 | }); 48 | } else { 49 | setIcon(tabId); 50 | } 51 | }, 52 | saving: function () { 53 | switch (parseInt($.db('badge_style'))) { 54 | case badge_styles.TEXT: 55 | case badge_styles.UNREAD: 56 | // TODO Customize color 57 | chrome.browserAction.setBadgeBackgroundColor({ 58 | color: [82, 168, 207, 255], 59 | tabId: last_tab_id 60 | }); 61 | chrome.browserAction.setBadgeText({ 62 | text: '...', 63 | tabId: last_tab_id 64 | }); 65 | break; 66 | case badge_styles.ICON: 67 | chrome.browserAction.setIcon({ 68 | path: 'images/saving.png', 69 | tabId: last_tab_id 70 | }); 71 | break; 72 | case badge_styles.CHROMED: 73 | chrome.browserAction.setIcon({ 74 | path: 'images/chromed_saving.png', 75 | tabId: last_tab_id 76 | }); 77 | break; 78 | } 79 | }, 80 | saved: function () { 81 | switch (parseInt($.db('badge_style'))) { 82 | case badge_styles.TEXT: 83 | case badge_styles.UNREAD: 84 | chrome.browserAction.setBadgeBackgroundColor({ 85 | color: [53, 181, 49, 255], 86 | tabId: last_tab_id 87 | }); 88 | chrome.browserAction.setBadgeText({ 89 | text: 'ok', 90 | tabId: last_tab_id 91 | }); 92 | break; 93 | case badge_styles.ICON: 94 | chrome.browserAction.setIcon({ 95 | path: 'images/saved.png', 96 | tabId: last_tab_id 97 | }); 98 | break; 99 | case badge_styles.CHROMED: 100 | chrome.browserAction.setIcon({ 101 | path: 'images/chromed_saved.png', 102 | tabId: last_tab_id 103 | }); 104 | break; 105 | } 106 | }, 107 | error: function () { 108 | switch (parseInt($.db('badge_style'))) { 109 | case badge_styles.TEXT: 110 | case badge_styles.UNREAD: 111 | chrome.browserAction.setBadgeBackgroundColor({ 112 | color: [255, 0, 0, 255], 113 | tabId: last_tab_id 114 | }); 115 | chrome.browserAction.setBadgeText({ 116 | text: 'err!', 117 | tabId: last_tab_id 118 | }); 119 | break; 120 | case badge_styles.ICON: 121 | chrome.browserAction.setIcon({ 122 | path: 'images/error.png', 123 | tabId: last_tab_id 124 | }); 125 | break; 126 | case badge_styles.CHROMED: 127 | chrome.browserAction.setIcon({ 128 | path: 'images/chromed_error.png', 129 | tabId: last_tab_id 130 | }); 131 | break; 132 | } 133 | } 134 | }; 135 | 136 | function onComplete(xhr) { 137 | try { 138 | if (xhr.srcElement.status == 201) { 139 | if ($.db('auto_close') === '1' && !skip_auto_close) { 140 | chrome.tabs.remove(last_tab_id); 141 | } else { 142 | badge.saved(); 143 | } 144 | } else { 145 | badge.error(); 146 | } 147 | } catch(e) {} 148 | } 149 | 150 | // TODO: gmail support for mails. 151 | function sendRequest(url, selection, title) { 152 | var username = $.db('username'); 153 | var password = $.db('password') || ''; 154 | 155 | if (!username) { 156 | badge.idle(); 157 | chrome.tabs.create({ 158 | url: chrome.extension.getURL('options.html#setup') 159 | }); 160 | return; 161 | } 162 | 163 | 164 | chrome.tabs.get(last_tab_id, function(tab) { 165 | 166 | if(/^https?:\/\/www\.google\.com\/reader/.test(url)) { 167 | chrome.tabs.sendRequest(tab.id, {}, function(response) { 168 | if(response.title && response.url) { 169 | sendRequest(response.url, response.selection, response.title); 170 | } else { 171 | badge.idle(tab.id); 172 | } 173 | }); 174 | } else { 175 | var xhr = new XMLHttpRequest(); 176 | xhr.onreadystatechange = onComplete; 177 | title = encodeURIComponent(title || tab.title); 178 | var params = { 179 | url: url, 180 | username: username, 181 | password: password, 182 | selection: selection || url.match(/https?:\/\/([^\/]+)/)[1] 183 | }; 184 | title = title ? ("&title=" + title) : "&auto-title=1"; 185 | xhr.open("GET", 'https://www.instapaper.com/api/add?' + $.param(params) + title, true); 186 | xhr.send(); 187 | } 188 | }); 189 | } 190 | 191 | function readLater(tab, selection, source) { 192 | last_tab_id = tab.id; 193 | badge.saving(); 194 | skip_auto_close = (source === 'contextual'); 195 | sendRequest(tab.url, selection); 196 | } 197 | 198 | if($.db('cx_read_later') === '1') { 199 | chrome.contextMenus.create({ 200 | title: 'Read later (send to instapaper)', 201 | contexts: ['link'], 202 | onclick: function(data, tab) { 203 | readLater({id: tab.id, url: data.linkUrl}, null, 'contextual'); 204 | } 205 | }); 206 | } 207 | 208 | if($.db('cx_text_view') === '1') { 209 | chrome.contextMenus.create({ 210 | title: 'Text view', 211 | contexts: ['page', 'link'], 212 | onclick: function(data, tab) { 213 | chrome.tabs.update(tab.id, { 214 | url: "http://www.instapaper.com/text?u=" + encodeURIComponent(data.linkUrl || data.pageUrl) 215 | }); 216 | } 217 | }); 218 | } 219 | 220 | if($.db('cx_unread') === '1') { 221 | chrome.contextMenus.create({ 222 | title: 'Go to your unread items', 223 | contexts: ['all'], 224 | onclick: function(data, tab) { 225 | chrome.tabs.create({ 226 | url: "http://www.instapaper.com/u" 227 | }); 228 | } 229 | }); 230 | } 231 | 232 | if($.db('cx_starred') === '1') { 233 | chrome.contextMenus.create({ 234 | title: 'Go to your starred items', 235 | contexts: ['all'], 236 | onclick: function(data, tab) { 237 | chrome.tabs.create({ 238 | url: "http://www.instapaper.com/starred" 239 | }); 240 | } 241 | }); 242 | } 243 | 244 | if($.db('cx_archive') === '1') { 245 | chrome.contextMenus.create({ 246 | title: 'Go to your archived items', 247 | contexts: ['all'], 248 | onclick: function(data, tab) { 249 | chrome.tabs.create({ 250 | url: "http://www.instapaper.com/archive" 251 | }); 252 | } 253 | }); 254 | } 255 | 256 | chrome.tabs.onUpdated.addListener(function(tabId) { 257 | badge.idle(tabId); 258 | }); 259 | chrome.browserAction.onClicked.addListener(readLater); 260 | // from key shortcut 261 | chrome.extension.onRequest.addListener(function(request, sender, sendResponse) { 262 | if (sender.tab) { 263 | if (request.hasOwnProperty('keystroke')) { 264 | var shortcut = $.db('shortcut'); 265 | var ctrlKey = (shortcut.ctrlKey == request.keystroke.ctrlKey), 266 | altKey = (shortcut.altKey == request.keystroke.altKey), 267 | shiftKey = (shortcut.shiftKey == request.keystroke.shiftKey), 268 | keyCode = (shortcut.keyCode == request.keystroke.keyCode); 269 | sendResponse({ 270 | shortcutPressed: (ctrlKey && altKey && shiftKey & keyCode) 271 | }); 272 | } else if (request.hasOwnProperty('selection')) { 273 | readLater(sender.tab, request.selection); 274 | } 275 | } 276 | }); 277 | -------------------------------------------------------------------------------- /javascripts/greader.js: -------------------------------------------------------------------------------- 1 | chrome.extension.onRequest.addListener(function(req, sender, sendResponse) { 2 | var entry = document.getElementById('current-entry'); 3 | if(entry) { 4 | var entryTitle = entry.getElementsByClassName('entry-container')[0] 5 | .getElementsByClassName('entry-title')[0]; 6 | var entryUrl = entryTitle.getElementsByClassName('entry-title-link')[0]; 7 | sendResponse({ 8 | title: entryTitle.innerText, 9 | url: entryUrl.href, 10 | selection: getWindowSelection() 11 | }); 12 | } else { 13 | sendResponse({saved: false}); 14 | alert("You don't have any entry expanded. Once you have an entry expanded try saving it for later."); 15 | } 16 | }); 17 | -------------------------------------------------------------------------------- /javascripts/instapaper.api.js: -------------------------------------------------------------------------------- 1 | Instapaper.Api = new AjaxRequest('https://www.instapaper.com/api/1'); 2 | 3 | -------------------------------------------------------------------------------- /javascripts/instapaper.auth.js: -------------------------------------------------------------------------------- 1 | Instapaper.Auth = new function (){ 2 | var consumerKey = 'kNfh6BSVMURjOGrYN7a0jdIyPxOwqujdtJpvC5ub6Ov74YNcic', 3 | consumerSecret = 'KxjIrl2Lgo6yzo2WEqGqOkzttEsEf4tiido5eF85VGIwRVyuKo'; 4 | 5 | var getUserInfo = function (username, password) { 6 | var xhr = Instapaper.Api.get('/account/verify_credentials', { 7 | async: false, 8 | query: { 9 | username: username, 10 | password: password 11 | } 12 | }); 13 | return JSON.parse(xhr.responseText)[0]; 14 | }; 15 | 16 | var verifyCredentials = function (username, password) { 17 | return getUserInfo(username, password).type == 'user'; 18 | }; 19 | 20 | var getAccessToken = function (username, password) { 21 | var userInfo = getUserInfo(username, password); 22 | if(userInfo.type != 'user') { 23 | return userInfo.message; 24 | } 25 | 26 | var url = 'https://www.instapaper.com/api/1/oauth/access_token', 27 | accessor = { 28 | consumerKey: consumerKey, 29 | consumerSecret: consumerSecret 30 | }, 31 | parameters = { 32 | x_auth_username: username, 33 | x_auth_password: password, 34 | x_auth_mode: 'client_auth' 35 | }, 36 | message = { 37 | action: url, 38 | method: 'POST', 39 | parameters: $.extend({}, parameters) 40 | }; 41 | OAuth.completeRequest(message, accessor); 42 | 43 | var xhr = Instapaper.Api.post('/oauth/access_token', { 44 | async: false, 45 | body: OAuth.formEncode(parameters), 46 | headers: { 47 | 'Content-Type': 'application/x-www-form-urlencoded', 48 | 'Authorization': OAuth.getAuthorizationHeader(url, message.parameters) 49 | } 50 | }); 51 | if(xhr.status == 200) { 52 | var response = xhr.responseText.split('&'), 53 | data = {}; 54 | for (var i = 0; i < response.length; i++) { 55 | var param = response[i].split('='); 56 | data[param[0]] = param[1]; 57 | } 58 | data.user_id = userInfo.user_id; 59 | data.username = userInfo.username; 60 | data.subscription_is_active = userInfo.subscription_is_active == '1'; 61 | return data; 62 | } else { 63 | throw("Invalid response. Code: " + xhr.status); 64 | } 65 | }; 66 | 67 | return { 68 | verifyCredentials: verifyCredentials, 69 | getAccessToken: getAccessToken 70 | }; 71 | }; 72 | -------------------------------------------------------------------------------- /javascripts/instapaper.js: -------------------------------------------------------------------------------- 1 | var Instapaper = {}; 2 | 3 | -------------------------------------------------------------------------------- /javascripts/keyboard.js: -------------------------------------------------------------------------------- 1 | // keyboard shortcut 2 | function getWindowSelection() { 3 | var selection = ''; 4 | if (window && window.getSelection) { 5 | selection = window.getSelection().toString(); 6 | } else if (document && document.getSelection) { 7 | selection = document.getSelection().toString(); 8 | } 9 | return selection; 10 | } 11 | 12 | window.addEventListener('keydown', function(e) { 13 | chrome.extension.sendRequest({keystroke: { 14 | keyCode: e.keyCode, 15 | altKey: e.altKey, 16 | ctrlKey: e.ctrlKey, 17 | shiftKey: e.shiftKey 18 | }}, function(response) { 19 | if(response.shortcutPressed) { 20 | chrome.extension.sendRequest({selection: getWindowSelection()}, function(r) {}); 21 | } 22 | }); 23 | }, false); 24 | 25 | -------------------------------------------------------------------------------- /javascripts/lib/ajaxRequest.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a simple wrapper for XHR calls. 3 | * Nothing fancy, only for the needs of this chrome extension 4 | * and other uses it may serve. 5 | * 6 | * Author: Edgar J. Suarez 7 | * License: MIT 8 | */ 9 | var AjaxRequest = function (base_uri) { 10 | this.base_uri = base_uri; 11 | 12 | this.post = function (path, options, callback) { 13 | return this.request('POST', path, options, callback); 14 | }; 15 | 16 | this.get = function (path, options, callback) { 17 | return this.request('GET', path, options, callback); 18 | }; 19 | 20 | this.request = function (method, path, options, callback) { 21 | options = options || {}; 22 | options.async == undefined && (options.async = true); 23 | var xhr = new XMLHttpRequest(), 24 | url = this.base_uri + path; 25 | 26 | xhr.onreadystatechange = function () { 27 | if(xhr.readyState == 4 && xhr.status == 200 && typeof callback == 'function') { 28 | callback(xhr.responseText); 29 | } 30 | }; 31 | if(options.query) { 32 | url += '?' + this._parseQuery(options.query); 33 | } 34 | xhr.open(method, url, options.async); 35 | this._setHeaders(xhr, options.headers); 36 | xhr.send(options.body); 37 | return xhr; 38 | }; 39 | 40 | this._parseQuery = function (query) { 41 | return (query.constructor.name == 'Object' ? $.param(query) : query); 42 | }; 43 | 44 | this._setHeaders = function (xhr, headers) { 45 | if(headers && headers.constructor.name == 'Object') { 46 | for (var header in headers) { 47 | if(headers.hasOwnProperty(header)) { 48 | xhr.setRequestHeader(header, headers[header]); 49 | } 50 | } 51 | } 52 | }; 53 | }; 54 | -------------------------------------------------------------------------------- /javascripts/lib/elastic.js: -------------------------------------------------------------------------------- 1 | /* 2 | Elastic CSS Framework 3 | Released under the MIT, BSD, and GPL Licenses. 4 | More information http://elasticss.com 5 | 6 | Elastic Engine 7 | 8 | @author Fernando Trasviña (@azendal) 9 | @core team Sergio de la Garza (@sgarza), Javier Ayala (@javi_ayala) 10 | @copyright 2009 Elastic CSS framework 11 | @version 2.0.2 12 | */ 13 | (function($){var CStyle=function(element,pseudoElement){if(window.getComputedStyle){return window.getComputedStyle(element,pseudoElement)}else{return element.currentStyle}};var width=function(element){var width=CStyle(element).width;if(width=="auto"||width.indexOf("px")<0){return $(element).width()}else{return parseFloat(width)}};window.Elastic=function Elastic(context){var r,ra,i,j,k,l,il,jl,kl,ll,econs,econ,econw,econclass,ecols,ecol,ecolclass,eg,egml,egcl,egnl,ecrw,ecw,escol,rp,ig,efcs,efcsw,eecs,eecsw,eecw,eecrw,ecs,ecsw,ec,ecclass,eecfw,ecolminw,ecolmaxw,egreg=/(^|\s+)on\-(\d+)(\s+|$)/,esreg=/(^|\s+)span\-(\d+)(\s+|$)/,eareg=/(^|\s+)adaptive\-(\d+)\-(\d+)(\s+|$)/;eg=[];egcl=egnl=0;econs=$.find(".columns",context);for(i=0,il=econs.length;i-1&&egreg.test(econclass)){egml=Number(RegExp.$2)}else{egml=$.find("> .column, > .container > .column",econ).length}econ=$.find("> .container",econ)[0]||econ;econw=width(econ);ecrw=econw/egml;ecw=Math.round(ecrw);if(econclass.indexOf("adaptive-")>-1&&eareg.test(econclass)){ecolminw=Number(RegExp.$2);ecolmaxw=Number(RegExp.$3);if(ecw>ecolmaxw){while(ecw>ecolmaxw){egml=egml+1;ecrw=econw/egml;ecw=Math.round(ecrw)}}else{if(ecw .column",econ);for(j=0,jl=ecols.length;j-1&&esreg.test(ecolclass)){escol=Number(RegExp.$2)}ecol.escol=escol=((escol<=egml)?escol:egml);egnl+=escol;if(egnl==egml||j==(jl-1)||ecolclass.indexOf("final")>-1){eg.push(ecol);egcl=0;rp=1}else{if(egnlegml){egcl=escol;rp=1;ig=1}}}if(rp){for(k=0,kl=eg.length;k-1){efcs.push(ec);efcsw+=width(ec)}else{if(ecclass.indexOf("elastic")>-1){eecs.push(ec)}else{ecs.push(ec);if(ec==eg[kl-1]){ec.style.width=Math.round(ecrw*ec.escol)+"px"}else{ec.style.width=Math.round(ecw*ec.escol)+"px"}ecsw=ecsw+width(ec)}}}ll=eecs.length;if(ll>0){eecfw=econw-(ecsw+efcsw);if(eecfw<=0){continue}eecrw=eecfw/ll;eecw=Math.round(eecrw);eecsw=eecw*ll;for(l=0;leecfw){ra=eecsw-eecfw+1;for(r=1;r0&&efcs.length===0&&egnl==egml){if(ecsw>econw){ra=ecsw-econw+1;for(r=1;r-1){ecol.style["margin"+((econclass.indexOf("inverted")>-1)?"Left":"Right")]=(econw-ecsw-efcsw)+"px"}}}}eg=[];egnl=0}if(ig){eg=[ecol];egnl=escol}}}for(i in Elastic.helpers){if(Elastic.helpers.hasOwnProperty(i)){Elastic.helpers[i](context)}}};var Elastic=window.Elastic;Elastic.version="2.0.3";Elastic.reset=function Elastic_reset(context){var doc=$(document);doc.trigger("elastic:beforeReset");var i,w,wl,h,hl,p,pl,m,ml;h=$.find(".same-height > *, .full-height, .elastic-height",context);for(i=0,hl=h.length;i *",this);var maxHeight=0;columns.each(function(){var currentHeight=$(this).outerHeight(true);maxHeight=(maxHeight>currentHeight)?maxHeight:currentHeight}).each(function(){$(this).css("height",maxHeight)})})},"full-height":function Elastic_helper_fullHeight(context){$(".full-height",context).each(function(){var _this=$(this);_this.css("height",$(this.parentNode).height()-(_this.outerHeight(true)-_this.height()))})},"elastic-height":function Elastic_helper_elasticHeight(context){$(".elastic-height",context).each(function(){var _this=$(this);var h=0;$("> *:not(.elastic-height)",this.parentNode).each(function(){h+=$(this).outerHeight(true)});_this.css("height",Math.round(_this.parent().height()-h));Elastic.refresh(this)})},"center":function Elastic_helper_center(context){$(".vertical-center, .center",context).each(function(){var parentNode=$(this.parentNode);var paddingTop=Math.round((parentNode.height()-$(this).outerHeight(true))/2);parentNode.css({paddingTop:paddingTop+"px",height:(parentNode.css("height"))?(parentNode.outerHeight()-paddingTop):""})})},"bottom":function Elastic_helper_bottom(context){$(".bottom",context).each(function(){var parentNode=$(this.parentNode);var paddingTop=Math.round(parentNode.height()-$(this).outerHeight(true));parentNode.css({paddingTop:paddingTop+"px",height:(parentNode.css("height"))?(parentNode.outerHeight()-paddingTop):""})})}};$(document).bind("elastic:beforeInitialize",function(){var r=/(^|\s+)display\s+([\w\_\-\d]+)(\s+|$)/;$(".display").each(function Elastic_layout(){r.test(this.className);var c=".position-"+RegExp.$2;$(c).removeClass(c).appendTo(this)})})})(jQuery);jQuery(window).bind("load",function(){var doc=jQuery(document);var iw=document.body.clientWidth;doc.trigger("elastic:beforeInitialize");Elastic();if(iw!=document.body.clientWidth){Elastic.refresh()}jQuery(window).bind("resize",function Elastic_resizeHandler(){if(Elastic.configuration.refreshOnResize){Elastic.refresh()}});doc.bind("elastic",Elastic.refresh);doc.trigger("elastic:initialize")}); 14 | -------------------------------------------------------------------------------- /javascripts/lib/oauth.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* Here's some JavaScript software for implementing OAuth. 18 | 19 | This isn't as useful as you might hope. OAuth is based around 20 | allowing tools and websites to talk to each other. However, 21 | JavaScript running in web browsers is hampered by security 22 | restrictions that prevent code running on one website from 23 | accessing data stored or served on another. 24 | 25 | Before you start hacking, make sure you understand the limitations 26 | posed by cross-domain XMLHttpRequest. 27 | 28 | On the bright side, some platforms use JavaScript as their 29 | language, but enable the programmer to access other web sites. 30 | Examples include Google Gadgets, and Microsoft Vista Sidebar. 31 | For those platforms, this library should come in handy. 32 | */ 33 | 34 | // The HMAC-SHA1 signature method calls b64_hmac_sha1, defined by 35 | // http://pajhome.org.uk/crypt/md5/sha1.js 36 | 37 | /* An OAuth message is represented as an object like this: 38 | {method: "GET", action: "http://server.com/path", parameters: ...} 39 | 40 | The parameters may be either a map {name: value, name2: value2} 41 | or an Array of name-value pairs [[name, value], [name2, value2]]. 42 | The latter representation is more powerful: it supports parameters 43 | in a specific sequence, or several parameters with the same name; 44 | for example [["a", 1], ["b", 2], ["a", 3]]. 45 | 46 | Parameter names and values are NOT percent-encoded in an object. 47 | They must be encoded before transmission and decoded after reception. 48 | For example, this message object: 49 | {method: "GET", action: "http://server/path", parameters: {p: "x y"}} 50 | ... can be transmitted as an HTTP request that begins: 51 | GET /path?p=x%20y HTTP/1.0 52 | (This isn't a valid OAuth request, since it lacks a signature etc.) 53 | Note that the object "x y" is transmitted as x%20y. To encode 54 | parameters, you can call OAuth.addToURL, OAuth.formEncode or 55 | OAuth.getAuthorization. 56 | 57 | This message object model harmonizes with the browser object model for 58 | input elements of an form, whose value property isn't percent encoded. 59 | The browser encodes each value before transmitting it. For example, 60 | see consumer.setInputs in example/consumer.js. 61 | */ 62 | 63 | /* This script needs to know what time it is. By default, it uses the local 64 | clock (new Date), which is apt to be inaccurate in browsers. To do 65 | better, you can load this script from a URL whose query string contains 66 | an oauth_timestamp parameter, whose value is a current Unix timestamp. 67 | For example, when generating the enclosing document using PHP: 68 | 69 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

Instachrome Options

25 | 26 |
27 | 28 |
29 |
30 | Instapaper credentials 31 |
32 |
33 |
34 | 35 |
(Username is now your email address)
36 |
37 |
38 | 39 |
40 | 41 |
42 | 43 |
44 |
45 | 46 |
47 | 48 |
49 | Your username or password is incorrect. Please double check them. 50 |
51 |
52 |
53 |
54 | 55 |
56 | Extras 57 |
58 |
59 |
60 | 61 |
62 |
63 | 64 |
65 | 66 |
67 | 68 |
(Close tab after saved)
69 |
70 |
71 | 72 |
73 | 74 |
75 | 76 |
77 |
78 | 84 |
85 | 86 |
87 | 88 |
(Beta - Not all shortcuts may work)
89 |
90 |
91 | 92 |
93 | 94 |
95 |
96 |
97 | 98 |
99 | Context Menus 100 |
101 |
102 |
103 |
You'll need to restart the browser for context menus to take effect.

104 |
105 |
106 |
107 | 108 |
109 | 110 |
This item appears only when clicking on links
111 |
112 |
113 | 114 |
115 | 116 |
117 | 118 |
119 |
120 | 121 |
122 | 123 |
124 | 125 |
126 |
127 | 128 |
129 | 130 |
131 | 132 |
133 |
134 | 135 |
136 | 137 |
138 | 139 |
140 |
141 | 142 |
143 |
144 |
145 |
146 | 147 | or 148 | Close 149 |
150 | 151 | 165 |
166 | 167 | 168 | -------------------------------------------------------------------------------- /popup.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Instachrome Popup 7 | 8 | 9 | 10 | 11 | 12 | 13 | 21 | 22 | -------------------------------------------------------------------------------- /stylesheets/elastic.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgarjs/instachrome/29f10ce0c4cf1b87456911caf499be0c408c6177/stylesheets/elastic.css -------------------------------------------------------------------------------- /stylesheets/options.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: #DC8145; 3 | } 4 | 5 | a.ribbon { 6 | top: 0; 7 | position: absolute; 8 | border: 0; 9 | display: block; 10 | width: 149px; 11 | height: 149px; 12 | } 13 | a.ribbon.right { 14 | right: 0; 15 | background: url("../images/forkme_ribbon.png") 0 0 no-repeat; 16 | } 17 | a.ribbon.left { 18 | left: 0; 19 | background: url("../images/donation_ribbon.png") 0 0 no-repeat; 20 | } 21 | 22 | .wrapper { 23 | width: 500px; 24 | margin: 20px auto; 25 | } 26 | 27 | .flash { 28 | background: #FFFFCC; 29 | border: 1px solid #cccc00; 30 | padding: 5px 0; 31 | color: #666; 32 | text-align: center; 33 | margin: 10px 0; 34 | display: none; 35 | } 36 | 37 | .title { 38 | font-family: "Times New Roman"; 39 | font-size: 2em; 40 | } 41 | 42 | .set { 43 | border: 1px solid #C7E2EF; 44 | border-radius: 3px; 45 | background-color: #ededed; 46 | } 47 | 48 | .set > legend { 49 | margin-left: 12px; 50 | color: #52A8CF; 51 | text-shadow: 1px 1px 1px #ccc; 52 | cursor: default; 53 | } 54 | 55 | .set > .pad { 56 | padding: 6px; 57 | } 58 | 59 | .set .column.label { 60 | text-align: center; 61 | color: #888; 62 | } 63 | 64 | .set .column.label > .description { 65 | font-size: 0.8em; 66 | } 67 | 68 | .set .column > input.text { 69 | border: 1px solid #ccc; 70 | padding: 4px; 71 | margin: 3px 0; 72 | color: #52A8CF; 73 | border-radius: 3px; 74 | } 75 | 76 | .column.label.auth { 77 | line-height: 35px; 78 | display: none; 79 | font-size: 10px; 80 | } 81 | 82 | .column.label.auth.ok { 83 | color: green; 84 | } 85 | 86 | .column.label.auth.error { 87 | color: red; 88 | } 89 | 90 | .footer { 91 | font-size: 0.8em; 92 | color: #888; 93 | text-align: center; 94 | margin-top: 10em; 95 | } 96 | 97 | .footer a { 98 | color: #333; 99 | } 100 | -------------------------------------------------------------------------------- /stylesheets/popup.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | } 4 | 5 | ul.links { 6 | list-style: none; 7 | margin: 0; 8 | padding: 0; 9 | width: 130px; 10 | } 11 | 12 | ul.links li { 13 | margin: 0; 14 | font-size: 13px; 15 | } 16 | 17 | ul.links li > a { 18 | padding: 5px 0 5px 30px; 19 | display: block; 20 | height: 16px; 21 | text-decoration: none; 22 | color: #888; 23 | font-family: sans-serif; 24 | background: #eee 4px 5px no-repeat; 25 | } 26 | 27 | ul.links li > a.add { 28 | background-image: url("../images/add.png"); 29 | border-radius: 5px 5px 0 0; 30 | } 31 | 32 | ul.links li > a.text { 33 | background-image: url("../images/text_view.png"); 34 | } 35 | 36 | ul.links li > a.unread { 37 | background-image: url("../images/unread.png"); 38 | } 39 | 40 | ul.links li > a.starred { 41 | background-image: url("../images/starred.png"); 42 | } 43 | 44 | ul.links li > a.archive { 45 | background-image: url("../images/archive.png"); 46 | } 47 | 48 | ul.links li > a.options { 49 | background-image: url("../images/options.png"); 50 | border-radius: 0 0 5px 5px; 51 | } 52 | 53 | ul.links li > a:hover { 54 | color: #85C25A; 55 | } 56 | --------------------------------------------------------------------------------