Created
August 28, 2012 19:45
-
-
Save vojtech-dobes/3503333 to your computer and use it in GitHub Desktop.
mcdonalds-piss-off-script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var timeout = 60; | |
var pause = 5; | |
var active = false; | |
function getLastLogin() { | |
var cookies = document.cookie.split(";"); | |
for (i in cookies){ | |
var cookie = cookies[i].split("="); | |
if ($.trim(cookie[0]) == 'lastLogin') return cookie[1]; | |
} | |
return 0; | |
} | |
function setLastLogin(timeout, pause) { | |
var date = new Date(); | |
var cookie = 'lastLogin=' + encodeURIComponent(date.getTime()); | |
cookie += '; path=/'; | |
date.setTime(date.getTime() + ((timeout + pause) * 60 * 1000)); | |
cookie += '; expires=' + date.toGMTString(); | |
document.cookie = cookie; | |
} | |
function doLogin() { | |
if(active == false) return false; | |
setLastLogin(timeout, pause); | |
$('#username').val('user'); | |
$('#password').val(hexMD5(chap_id + 'user' + chap_challenge)); | |
$('#sendin').submit(); | |
//document.sendin.username.value = 'user'; | |
//document.sendin.password.value = hexMD5('$(chap-id)' + 'user' + '$(chap-challenge)'); | |
//document.sendin.submit(); | |
return false; | |
} | |
function promo(url) { | |
if(active == false) return false; | |
$('#dst').val(url); | |
//document.sendin.dst.value = url; | |
return doLogin(); | |
} | |
$(document).ready(function() { | |
$('td.login a').bind('click', function() { | |
return doLogin(); | |
}); | |
$('td.mcd a, td.facebook a').bind('click', function() { | |
$('#dst').val($(this).attr('href')); | |
return doLogin(); | |
}); | |
var now = new Date().getTime(); | |
var cookie = getLastLogin(); | |
var diff = Math.round((now - cookie)/1000); | |
if(diff > (timeout*60) && diff < ((timeout+pause)*60)) { | |
var remaining = ((timeout+pause)*60) - diff; | |
function aktualizuj() { | |
if(remaining > 0) { | |
$('#remaining').html(remaining); | |
remaining--; | |
} else { | |
$('#message').fadeOut('fast'); | |
$('#test').removeAttr('disabled'); | |
active = true | |
return; | |
} | |
window.setTimeout(arguments.callee, 1000); | |
} | |
$('#test').attr('disabled', 'disabled'); | |
$('#message').show(); | |
active = false; | |
aktualizuj(); | |
} else { | |
active = true; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment