mirror of
https://github.com/wassname/Mostly-Harmless.git
synced 2026-07-21 12:20:05 +08:00
fixed a few formatting errors
This commit is contained in:
+2
-1
@@ -1,2 +1,3 @@
|
||||
deploy/
|
||||
resources/
|
||||
resources/
|
||||
.project
|
||||
+19
-18
@@ -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'));
|
||||
|
||||
Reference in New Issue
Block a user