Zostało jeszcze {{custom.textlength}} % artykułu
Wiosenny powiew inspiracji
Czytaj, słuchaj i oglądaj już od 9,90 zł miesięcznie
Oferta dla Nowych Klientów.
Najniższa cena z ostatnich 30 dni: 4,90 zł
Możesz zrezygnować z odnawiania subskrypcji w dowolnym momencie
Masz już subskrypcję? Zaloguj się
Jesteś zalogowany jako: {{user.email}}
(() => {
const MAIN_CONTAINER_SELECTOR = '#offer-teaser';
function initTemplate(data) {
const tpcc = data && data.custom && data.custom.teaserTpcc || (() => {
console.warn('Paywall: missing tpcc in custom variables. Falling back to custom field.');
return 'hard_linkedinBI_xmass_promoInline';
})();
if (!tpcc) {
throw new Error('Tpcc is not defined');
}
// TEMPLATE INITIALIZATION
var linkElements = document.querySelectorAll('.call-2-action a');
linkElements.forEach(element => {
element.addEventListener('click', function () {
window.parent.postMessage(
{
type: 'promoInline_event_template',
tpcc: tpcc,
piano_action: 'click_button',
event_label: 'promoInline_' + tpcc
},
'*'
);
const link = element.dataset.href;
setTimeout(() => {
window.parent.postMessage({
id: 'location_href',
event: 'detail_metric_cta_link',
link
}, '*');
}, 100);
});
});
window.parent.postMessage(
{
type: 'promoInline_event_template',
tpcc: tpcc,
piano_action: 'render_show',
event_label: 'promoInline_' + tpcc
},
'*'
);
}
const onScopeReady = ((selector) => new Promise((resolve, reject) => {
const element = document.querySelector(selector);
const $scope = element && angular.element(element).scope();
if (!$scope) return reject(new Promise('Scope not found'));
const done = () => queueMicrotask(() => resolve({ params: $scope.params, custom: $scope.custom }));
if ($scope.initiated) return done();
const waitTimeout = setTimeout(() => {
reject(new Promise('Scope not initiated within 5 seconds'));
unwatch();
}, 5000);
const unwatch = $scope.$watch('initiated', (initiated) => {
if (!initiated) return;
clearTimeout(waitTimeout);
unwatch();
done();
});
}))(MAIN_CONTAINER_SELECTOR);
onScopeReady
.then(initTemplate)
.catch((err) => {
console.error('Paywall: an error occurred in custom script', err);
parent.postMessage({
type: 'paywallRpc',
payload: {
method: 'helpers.reportError',
params: ['CUSTOM_SCRIPT_ERROR', err.message || String(err)],
id: String(Math.random())
},
}, '*');
});
})();
var countDownDate = new Date('').getTime();
var timerInterval = setInterval(fillTimer, 1000);
function fillTimer () {
var now = new Date().getTime();
var distance = countDownDate - now;
var days = Math.floor((distance % (1000 * 60 * 60 * 24 * 365)) / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000).toString().padStart(2, '0');
if (distance < 1000) {
document.getElementById('countdownTimer').innerHTML = 'Ostatnie chwile promocji';
} else if (distance < 60000) {
document.getElementById('countdownTimer').innerHTML = 'Do końca promocji zostało tylko:' + seconds + ' ' + pluralizePl(seconds, 'sekunda', 'sekundy', 'sekund') + '';
} else if (distance < 3600000) {
document.getElementById('countdownTimer').innerHTML = 'Ostatnia szansa! Do końca promocji zostało:' + minutes + ' ' + pluralizePl(minutes, 'minutę', 'minuty', 'minut') + ' i ' + seconds + ' sek.' + '';
} else if (distance < 86400000) {
document.getElementById('countdownTimer').innerHTML = 'Wielkie odliczanie! Oferta ważna jeszcze przez:' + hours + ' ' + pluralizePl(hours, 'godzinę', 'godziny', 'godzin') + ' i ' + minutes + ' min. ' + seconds + ' sek.' + '';
} else if (distance < 172800000) {
document.getElementById('countdownTimer').innerHTML = 'Nie zwlekaj. Oferta kończy się za:' + hours + ' ' + pluralizePl(hours, 'godzinę', 'godziny', 'godzin') + ' i ' + minutes + ' min. ' + seconds + ' sek.' + '';
} else if (distance < 259200000) {
document.getElementById('countdownTimer').innerHTML = 'Czas upływa! Promocja ważna jeszcze przez:' + days + ' ' + pluralizePl(days, 'dzień', 'dni', 'dni') + ' ' + hours + ' ' + pluralizePl(hours, 'godzinę', 'godziny', 'godzin') + ' i ' + minutes + ' min. ' + seconds + ' sek.' + '';
} else {
document.getElementById('countdownTimer').innerHTML = 'Oferta nie do przegapienia!';
}
}
function pluralizePl(count, v1, v2, v3) {
return count === 1
? v1
: count % 10 <= 1 || count % 10 >= 5 || (count % 100 >= 11 && count % 100 <= 19)
? v3
: v2;
}