Skip to content

Commit

Permalink
apply localtime for ajax
Browse files Browse the repository at this point in the history
  • Loading branch information
fuktommy committed Dec 21, 2014
1 parent f37455e commit b1578fa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
7 changes: 6 additions & 1 deletion www/21resanchor.js
Expand Up @@ -113,7 +113,12 @@ shingetsu.initialize(function () {
if (! $container) {
$container = $(this.furtherPopup.container);
}
shingetsu.plugins.localtime.override($container);
if (
shingetsu.plugins.localtime
&& shingetsu.plugins.localtime.override
) {
shingetsu.plugins.localtime.override($container);
}
shingetsu.plugins.responce.addLink($container);
var that = this;
this.childResAnchors = [];
Expand Down
20 changes: 14 additions & 6 deletions www/extensions/20localtime.js
Expand Up @@ -30,10 +30,18 @@ shingetsu.initialize(function () {
return year + '-' + month + '-' + day + ' ' + tbl[date.getDay()] + ' ' + hours + ':' + minutes;
}

$('span.stamp[data-stamp]').each(function() {
var container = $(this);
var date = new Date();
date.setTime(container.attr('data-stamp') * 1000);
container.html(myLocaltime(date));
});
function overrideDatetime($container) {
$container.find('span.stamp[data-stamp]').each(function() {
var container = $(this);
var date = new Date();
date.setTime(container.attr('data-stamp') * 1000);
container.html(myLocaltime(date));
});
}

overrideDatetime($(document));

shingetsu.plugins.localtime = {
'override': overrideDatetime
};
});

0 comments on commit b1578fa

Please sign in to comment.