Изменения

Перейти к навигации Перейти к поиску
нет описания правки
Строка 61: Строка 61:  
buttons : {
 
buttons : {
 
Submit : function() {
 
Submit : function() {
 
+
instance.publish();
 
},
 
},
 
Cancel : function() {
 
Cancel : function() {
Строка 112: Строка 112:  
this.publishFormLink.val(link);
 
this.publishFormLink.val(link);
 
this.publishDialog.dialog('open');
 
this.publishDialog.dialog('open');
 +
 +
var lastDate;
 +
if (typeof localStorage['CommentsToVk_lastDate'] === 'undefined') {
 +
lastDate = new Date();
 +
} else {
 +
var lastDate = new Date(1 * localStorage['CommentsToVk_lastDate']);
 +
lastDate = new Date(Math.max(new Date().getTime(), lastDate
 +
.getTime()));
 +
}
 +
nextDate = new Date(
 +
(Math.floor(lastDate.getTime() / 1000.0 / 60 / 60) + 1) * 1000 * 60 * 60);
    
this.publishFormTime.datetimepicker({
 
this.publishFormTime.datetimepicker({
 
format : $.datetimepicker.ISO_8601,
 
format : $.datetimepicker.ISO_8601,
 
minDate : new Date().toISOString().split('T')[0],
 
minDate : new Date().toISOString().split('T')[0],
value : new Date().toISOString()
+
value : nextDate.toISOString().split('T')[0] + ' '
 +
+ nextDate.toISOString().split('T')[1].split('.')[0]
 +
});
 +
}
 +
 
 +
CommentToVk.prototype.publish = function() {
 +
var link = this.publishFormLink.val();
 +
var text = this.publishFormText.val();
 +
var date = this.publishFormTime.datetimepicker('getValue');
 +
var timestamp = Math.round(date.getTime() / 1000);
 +
 
 +
VK.Api.call('wall.post', {
 +
owner_id : -47630162,
 +
from_group : 1,
 +
message : text,
 +
signed : 0,
 +
publish_date : Math.floor(date.getTime() / 1000),
 +
}, function(r) {
 +
console.log(r);
 
});
 
});
 
}
 
}
Анонимный участник

Навигация