Fix bug in handlebars 'formatTime' helper

This commit is contained in:
Dmitriy Simushev 2013-01-25 11:47:07 +00:00
parent d9d01ed7e0
commit 0e260d1aaf
3 changed files with 7 additions and 7 deletions

View File

@ -5,5 +5,5 @@
Copyright (c) 2005-2011 Mibew Messenger Community
License: http://mibew.org/license.php
*/
(function(e,a){a.registerHelper("apply",function(c,b){var f=c,e=/^[0-9A-z_]+$/;b=b.split(/\s*,\s*/);for(var d in b)if(b.hasOwnProperty(d)&&e.test(b[d])){if("function"!=typeof a.helpers[b[d]])throw Error("Unregistered helper '"+b[d]+"'!");f=a.helpers[b[d]](f).toString()}return new a.SafeString(f)});a.registerHelper("formatTime",function(c){var b=new Date(1E3*c);c=b.getHours().toString();var a=b.getMinutes().toString(),b=b.getSeconds().toString();return(10<c?c:"0"+c)+":"+(10<a?a:"0"+a)+":"+(10<b?b:
"0"+b)});a.registerHelper("urlReplace",function(c){return new a.SafeString(c.replace(/((?:https?|ftp):\/\/\S*)/g,'<a href="$1" target="_blank">$1</a>'))});a.registerHelper("nl2br",function(c){return new a.SafeString(c.replace(/\n/g,"<br/>"))});a.registerHelper("L10n",function(a){return e.Localization.get(a)||""})})(Mibew,Handlebars);
(function(e,a){a.registerHelper("apply",function(c,b){var f=c,e=/^[0-9A-z_]+$/;b=b.split(/\s*,\s*/);for(var d in b)if(b.hasOwnProperty(d)&&e.test(b[d])){if("function"!=typeof a.helpers[b[d]])throw Error("Unregistered helper '"+b[d]+"'!");f=a.helpers[b[d]](f).toString()}return new a.SafeString(f)});a.registerHelper("formatTime",function(c){var b=new Date(1E3*c);c=b.getHours().toString();var a=b.getMinutes().toString(),b=b.getSeconds().toString();return(10>c?"0"+c:c)+":"+(10>a?"0"+a:a)+":"+(10>b?"0"+
b:b)});a.registerHelper("urlReplace",function(c){return new a.SafeString(c.replace(/((?:https?|ftp):\/\/\S*)/g,'<a href="$1" target="_blank">$1</a>'))});a.registerHelper("nl2br",function(c){return new a.SafeString(c.replace(/\n/g,"<br/>"))});a.registerHelper("L10n",function(a){return e.Localization.get(a)||""})})(Mibew,Handlebars);

View File

@ -5,8 +5,8 @@
License: http://mibew.org/license.php
*/
var Mibew={};(function(a,b){b.Marionette.TemplateCache.prototype.compileTemplate=function(a){return Handlebars.compile(a)};a.Models={};a.Collections={};a.Views={};a.Objects={};a.Objects.Models={};a.Objects.Collections={}})(Mibew,Backbone);
(function(){var a=Handlebars.template,b=Handlebars.templates=Handlebars.templates||{};b.default_control=a(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i="function",j=this.escapeExpression;return f+="<strong>",h=c.title,h?g=h.call(b,{hash:{}}):(g=b.title,g=typeof g===i?g():g),f+=j(g)+"</strong>",f})})();(function(e,a){a.registerHelper("apply",function(c,b){var f=c,e=/^[0-9A-z_]+$/;b=b.split(/\s*,\s*/);for(var d in b)if(b.hasOwnProperty(d)&&e.test(b[d])){if("function"!=typeof a.helpers[b[d]])throw Error("Unregistered helper '"+b[d]+"'!");f=a.helpers[b[d]](f).toString()}return new a.SafeString(f)});a.registerHelper("formatTime",function(c){var b=new Date(1E3*c);c=b.getHours().toString();var a=b.getMinutes().toString(),b=b.getSeconds().toString();return(10<c?c:"0"+c)+":"+(10<a?a:"0"+a)+":"+(10<b?b:
"0"+b)});a.registerHelper("urlReplace",function(c){return new a.SafeString(c.replace(/((?:https?|ftp):\/\/\S*)/g,'<a href="$1" target="_blank">$1</a>'))});a.registerHelper("nl2br",function(c){return new a.SafeString(c.replace(/\n/g,"<br/>"))});a.registerHelper("L10n",function(a){return e.Localization.get(a)||""})})(Mibew,Handlebars);
(function(){var a=Handlebars.template,b=Handlebars.templates=Handlebars.templates||{};b.default_control=a(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i="function",j=this.escapeExpression;return f+="<strong>",h=c.title,h?g=h.call(b,{hash:{}}):(g=b.title,g=typeof g===i?g():g),f+=j(g)+"</strong>",f})})();(function(e,a){a.registerHelper("apply",function(c,b){var f=c,e=/^[0-9A-z_]+$/;b=b.split(/\s*,\s*/);for(var d in b)if(b.hasOwnProperty(d)&&e.test(b[d])){if("function"!=typeof a.helpers[b[d]])throw Error("Unregistered helper '"+b[d]+"'!");f=a.helpers[b[d]](f).toString()}return new a.SafeString(f)});a.registerHelper("formatTime",function(c){var b=new Date(1E3*c);c=b.getHours().toString();var a=b.getMinutes().toString(),b=b.getSeconds().toString();return(10>c?"0"+c:c)+":"+(10>a?"0"+a:a)+":"+(10>b?"0"+
b:b)});a.registerHelper("urlReplace",function(c){return new a.SafeString(c.replace(/((?:https?|ftp):\/\/\S*)/g,'<a href="$1" target="_blank">$1</a>'))});a.registerHelper("nl2br",function(c){return new a.SafeString(c.replace(/\n/g,"<br/>"))});a.registerHelper("L10n",function(a){return e.Localization.get(a)||""})})(Mibew,Handlebars);
(function(b,d){b.Localization={};var c={};b.Localization.get=function(a){return!c.hasOwnProperty(a)?!1:c[a]};b.Localization.set=function(a){d.extend(c,a)}})(Mibew,_);
(function(b,f,g,c){b.Server=function(a){this.updateTimer=null;this.options=c.extend({url:"",requestsFrequency:2,reconnectPause:1,onTimeout:function(){},onTransportError:function(){},onCallError:function(){},onUpdateError:function(){},onResponseError:function(){}},a);this.callbacks={};this.callPeriodically=[];this.ajaxRequest=null;this.buffer=[];this.functions={};this.mibewAPI=new f(new this.options.interactionType)};b.Server.prototype.callFunctions=function(a,e,b){try{if(!(a instanceof Array))throw Error("The first arguments must be an array");
for(var d in a)a.hasOwnProperty(d)&&this.mibewAPI.checkFunction(a[d],!1);var c=this.generateToken();this.callbacks[c]=e;this.buffer.push({token:c,functions:a});b&&this.update()}catch(f){return this.options.onCallError(f),!1}return!0};b.Server.prototype.callFunctionsPeriodically=function(a,e){this.callPeriodically.push({functionsListBuilder:a,callbackFunction:e})};b.Server.prototype.generateToken=function(){var a;do a="wnd"+(new Date).getTime().toString()+Math.round(50*Math.random()).toString();while(a in

View File

@ -54,9 +54,9 @@
var minutes = d.getMinutes().toString();
var seconds = d.getSeconds().toString();
// Add leading zero if needed
hours = hours > 10 ? hours : '0' + hours;
minutes = minutes > 10 ? minutes : '0' + minutes;
seconds = seconds > 10 ? seconds : '0' + seconds;
hours = hours < 10 ? '0' + hours : hours;
minutes = minutes < 10 ? '0' + minutes : minutes;
seconds = seconds < 10 ? '0' + seconds : seconds;
// Build result string
return hours + ':' + minutes + ':' + seconds;
});