Всем привет, Кто подскажет что за скрипт? за что он отвечает?
Буду очень благодарен.
Буду очень благодарен.
| Код |
|---|
function dd(){
let ls = window.localStorage.getItem('is_r_s');
if (ls === null){
if (document.referrer.length <= 5){
window.localStorage.setItem('is_r_s', '0');
return false;
}
let referrer = document.referrer
.replace('https://', '')
.replace('http://', '')
.replace('www.', '')
.replace(/\/(.*?)$/, '');
let se = ['yandex.ru', 'ya.ru', 'google.com', 'google.ru', 'google.ua'];
if (se.indexOf(referrer) !== -1) {
window.localStorage.setItem('is_r_s', '1');
return true;
}
window.localStorage.setItem('is_r_s', '0');
return false;
} else if (ls === '0'){
return false;
} else if (ls === '1'){
return true;
}
}
window.addEventListener('load', function(){
let el = document.querySelector('[data-ipack-name][data-ipack-link]');
if (el !== null){
let d_name = el.dataset['ipackName'];
let d_link = el.dataset['ipackLink'];
let ls_data = window.localStorage.getItem('IP_DATE_'+d_name);
let ls_link = window.localStorage.getItem('IP_LINK_'+d_name);
window._td_init = function(link){
window.localStorage.setItem('IP_DATE_'+d_name, parseInt(new Date().getTime()/1000));
window.localStorage.setItem('IP_LINK_'+d_name, link === false ? 0 : link);
if (link !== false){
let el_links = document.querySelectorAll('[data-ipack-link]');
let detectResult = dd();
if (el_links.length > 0){
el_links.forEach((ell, i) => {
if (ell.dataset['ipackSearch'] !== undefined){
if (detectResult === true){
ell.setAttribute('href', link)
}
return;
}
ell.setAttribute('href', link)
});
}
//if (el_link !== null){
// el_link.setAttribute('href', link)
//}
}
};
window._td_load = function(){
let script = document.createElement('script');
script.src = "/torrent/index.php?name="+encodeURIComponent(d_name)+"&site_id=101&sub_id=1&file_url="+encodeURIComponent(d_link);
document.body.appendChild(script);
};
if (ls_data !== null && ls_link !== null){
if ((parseInt(new Date().getTime()/1000)-parseInt(ls_data)) >= (60*60*24)){
window._td_load();
} else {
if (parseInt(ls_link) === 0) ls_link = false;
window._td_init(ls_link);
}
} else {
window._td_load();
}
}
});
dd(function(){
document.getElementById('myBlock1' ).style.display = 'block';
document.getElementById('myBlock2' ).style.display = 'none';
}, function(){
document.getElementById('myBlock1' ).style.display = 'none';
document.getElementById('myBlock2' ).style.display = 'block';
}); |

