fixed a few formatting errors

This commit is contained in:
Kerrick Long
2011-07-18 15:41:36 -05:00
parent e41b038c14
commit f897107105
2 changed files with 21 additions and 19 deletions
+2 -1
View File
@@ -1,2 +1,3 @@
deploy/
resources/
resources/
.project
+19 -18
View File
@@ -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'));