From f8971071053f5cab161a26bbe1cd2fd6069c331d Mon Sep 17 00:00:00 2001 From: Kerrick Long Date: Mon, 18 Jul 2011 15:41:36 -0500 Subject: [PATCH] fixed a few formatting errors --- .gitignore | 3 ++- js/common.js | 37 +++++++++++++++++++------------------ 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 2292512..e455d0f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ deploy/ -resources/ \ No newline at end of file +resources/ +.project \ No newline at end of file diff --git a/js/common.js b/js/common.js index ca4235a..61cc232 100644 --- a/js/common.js +++ b/js/common.js @@ -82,7 +82,7 @@ MHUtils.prototype.forEach = function (array, action) { action(array[i]); } return true; -} +}; /** * Parses a URL and returns a useful object. http://james.padolsey.com/javascript/parsing-urls-with-the-dom/ @@ -117,7 +117,7 @@ MHUtils.prototype.parseURL = function (url) { relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [,''])[1], segments: a.pathname.replace(/^\//,'').split('/') }; -} +}; /* * JavaScript Pretty Date @@ -128,22 +128,22 @@ MHUtils.prototype.parseURL = function (url) { // long ago the date represents. MHUtils.prototype.prettyDate = function (date_str) { var time_formats = [ - [60, 'just_now', 1], // 60 - [120, 'a_minute_ago', 'a_minute_from_now'], // 60*2 - [3600, 'minutes', 60], // 60*60, 60 - [7200, 'an_hour_ago', 'an_hour_from_now'], // 60*60*2 - [86400, 'hours', 3600], // 60*60*24, 60*60 - [172800, 'yesterday', 'tomorrow'], // 60*60*24*2 - [604800, 'days', 86400], // 60*60*24*7, 60*60*24 - [1209600, 'last_week', 'next_week'], // 60*60*24*7*4*2 - [2419200, 'weeks', 604800], // 60*60*24*7*4, 60*60*24*7 - [4838400, 'last_month', 'next_month'], // 60*60*24*7*4*2 - [29030400, 'months', 2419200], // 60*60*24*7*4*12, 60*60*24*7*4 - [58060800, 'last_year', 'next_year'], // 60*60*24*7*4*12*2 - [2903040000, 'years', 29030400], // 60*60*24*7*4*12*100, 60*60*24*7*4*12 - [5806080000, 'last_century', 'next_century'], // 60*60*24*7*4*12*100*2 - [58060800000, 'centuries', 2903040000] // 60*60*24*7*4*12*100*20, 60*60*24*7*4*12*100 -]; + [60, 'just_now', 1], // 60 + [120, 'a_minute_ago', 'a_minute_from_now'], // 60*2 + [3600, 'minutes', 60], // 60*60, 60 + [7200, 'an_hour_ago', 'an_hour_from_now'], // 60*60*2 + [86400, 'hours', 3600], // 60*60*24, 60*60 + [172800, 'yesterday', 'tomorrow'], // 60*60*24*2 + [604800, 'days', 86400], // 60*60*24*7, 60*60*24 + [1209600, 'last_week', 'next_week'], // 60*60*24*7*4*2 + [2419200, 'weeks', 604800], // 60*60*24*7*4, 60*60*24*7 + [4838400, 'last_month', 'next_month'], // 60*60*24*7*4*2 + [29030400, 'months', 2419200], // 60*60*24*7*4*12, 60*60*24*7*4 + [58060800, 'last_year', 'next_year'], // 60*60*24*7*4*12*2 + [2903040000, 'years', 29030400], // 60*60*24*7*4*12*100, 60*60*24*7*4*12 + [5806080000, 'last_century', 'next_century'], // 60*60*24*7*4*12*100*2 + [58060800000, 'centuries', 2903040000] // 60*60*24*7*4*12*100*20, 60*60*24*7*4*12*100 + ]; var time = ('' + date_str).replace(/-/g,"/").replace(/[TZ]/g," "); then = new Date(time); utcTime = Date.UTC(then.getFullYear(), then.getMonth(), then.getDate(), then.getHours(), then.getMinutes(), then.getSeconds(), then.getMilliseconds()) @@ -754,6 +754,7 @@ Background.prototype.prepareBrowserAction = function (tabId, info, tab) { if (info.status === 'loading') { if (cache.get(tab.url) === undefined || cache.get(tab.url).cacheDate - utils.epoch() < -60 * settings.get('cacheTime')) { console.log(chrome.i18n.getMessage('loading_api')); + console.log(utils.parseURL(tab.url)); reddit.getInfo(tab.url, tabId); } else { console.log(chrome.i18n.getMessage('loading_cache'));