Handle timezones

This commit is contained in:
Mattias Erming 2014-07-23 17:16:00 -07:00
parent 019a643f94
commit b7338eeab7
8 changed files with 2636 additions and 13 deletions

View file

@ -1,17 +1,23 @@
module.exports = function(grunt) { module.exports = function(grunt) {
var libs = "client/js/libs/**/*.js";
grunt.initConfig({ grunt.initConfig({
watch: {
files: libs,
tasks: ["uglify"]
},
uglify: { uglify: {
options: { options: {
compress: false compress: false
}, },
js: { js: {
files: { files: {
"client/js/libs.min.js": "client/js/libs/**/*.js" "client/js/libs.min.js": libs
} }
} }
} }
}); });
grunt.loadNpmTasks("grunt-contrib-uglify"); grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.registerTask( grunt.registerTask(
"default", "default",
["uglify"] ["uglify"]

View file

@ -236,7 +236,7 @@
{{#each messages}} {{#each messages}}
<div class="msg {{type}}"> <div class="msg {{type}}">
<span class="time"> <span class="time">
{{time}} {{tz time}}
</span> </span>
<span class="from"> <span class="from">
{{#if from}} {{#if from}}

15
client/js/libs.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,6 @@
Handlebars.registerHelper(
"tz", function(time) {
var utc = moment.utc(time, "HH:mm:ss").toDate();
return moment(utc).format("HH:mm");
}
);

View file

@ -13,7 +13,7 @@ Handlebars.registerHelper(
var urls = []; var urls = [];
text = URI.withinString(text, function(url) { text = URI.withinString(text, function(url) {
urls.push(url); urls.push(url);
return "$(" + (urls.length - 1) + ")"; return "$(" + (urls.length - 1) + ")";
}); });
text = escape(text); text = escape(text);
for (var i in urls) { for (var i in urls) {

2610
client/js/libs/moment.js Normal file

File diff suppressed because it is too large Load diff

View file

@ -23,7 +23,7 @@ function Msg(attr) {
_.merge(this, _.extend({ _.merge(this, _.extend({
from: "", from: "",
text: "", text: "",
time: moment().format("HH:mm"), time: moment().utc().format("HH:mm:ss"),
type: Msg.Type.MESSAGE type: Msg.Type.MESSAGE
}, attr)); }, attr));
} }

View file

@ -20,7 +20,7 @@
"single-instance": false, "single-instance": false,
"window": { "window": {
"title": "Shout", "title": "Shout",
"icon": "client/img/favicon.png", "icon": "client/img/favicon.png",
"toolbar": false, "toolbar": false,
"width": 1024, "width": 1024,
"height": 640 "height": 640
@ -42,6 +42,6 @@
"devDependencies": { "devDependencies": {
"grunt": "~0.4.5", "grunt": "~0.4.5",
"grunt-contrib-uglify": "~0.5.0", "grunt-contrib-uglify": "~0.5.0",
"grunt-node-webkit-builder": "~0.1.21" "grunt-contrib-watch": "^0.6.1"
} }
} }