Show counters after 10 sec even if they aren’t ready.

master
Artem Sapegin 2015-03-10 11:12:36 +03:00
parent 4337bab741
commit c2e2df35c6
1 changed files with 13 additions and 3 deletions

View File

@ -212,7 +212,8 @@
title: document.title,
counters: true,
zeroes: false,
wait: 500,
wait: 500, // Show buttons only after counters are ready or after this amount of time
timeout: 10000, // Show counters after this amount of time even if they arent ready
popupCheckInterval: 500,
singleTitle: 'Share'
};
@ -249,6 +250,7 @@
if (this.options.counters) {
this.timer = setTimeout($.proxy(this.appear, this), this.options.wait);
this.timeout = setTimeout($.proxy(this.ready, this, true), this.options.timeout);
}
else {
this.appear();
@ -330,13 +332,21 @@
this.countersLeft--;
if (this.countersLeft === 0) {
this.appear();
this.container.addClass(prefix + '_ready');
this.container.trigger('ready.' + prefix, this.number);
this.ready();
}
},
appear: function() {
this.container.addClass(prefix + '_visible');
},
ready: function(silent) {
if (this.timeout) {
clearTimeout(this.timeout);
}
this.container.addClass(prefix + '_ready');
if (!silent) {
this.container.trigger('ready.' + prefix, this.number);
}
},
getCounterElem: function() {
var counterElem = this.widget.find('.' + classPrefix + 'counter_single');
if (!counterElem.length) {