Commit baff5d7a authored by Eriksson Monteiro's avatar Eriksson Monteiro

update ad rotation in millix bar. fix random ad pick

parent 615d8891
......@@ -14,6 +14,7 @@ cr.define('millix_bar', function () {
let reloadTimeout = undefined;
let fetchAdvertisementTimeout = undefined;
const ADVERTISEMENT_ROTATION_TIME = 30000;
const ADVERTISEMENT_ROTATION_TIME_EMPTY = 15000;
let walletLocked = true;
let unlockFromBar = false;
const audioDeposit = new Audio('/deposit.mp3');
......@@ -76,6 +77,10 @@ cr.define('millix_bar', function () {
$headline.off('click');
$targetPhrase.off('click');
clearTimeout(fetchAdvertisementTimeout);
fetchAdvertisementTimeout = setTimeout(() => fetchAdvertisement(), ADVERTISEMENT_ROTATION_TIME_EMPTY);
} else {
if ($(".arrow-icon").hasClass('open')) { //ads container not visible
......@@ -130,11 +135,16 @@ cr.define('millix_bar', function () {
}
function fetchAdvertisement() {
clearTimeout(fetchAdvertisementTimeout);
if ($(".arrow-icon").hasClass('open')) { //ads container not visible
fetchAdvertisementTimeout = setTimeout(() => fetchAdvertisement(), ADVERTISEMENT_ROTATION_TIME_EMPTY);
return;
}
millixAPIFrame.contentWindow.postMessage({
type: 'get_next_tangled_advertisement'
}, 'chrome-untrusted://millix-ws/');
clearTimeout(fetchAdvertisementTimeout);
fetchAdvertisementTimeout = setTimeout(() => fetchAdvertisement(), ADVERTISEMENT_ROTATION_TIME);
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment