Last active
August 29, 2015 13:56
-
-
Save craigtaub/8848080 to your computer and use it in GitHub Desktop.
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
define('iplayer/controllers/Preview', | |
function() { | |
glow.events.addListener("#preview-opt-in a", "click", function(event) { | |
event.stopPropagation(); | |
event.preventDefault(); | |
var date = new Date(), | |
expires; | |
date.setTime(date.getTime()+(182*24*60*60*1000)); //6 months in future | |
expires = date.toGMTString(); | |
document.cookie = | |
'ckps_tviplayer_kombat=1' + | |
'; expires=' + expires + | |
'; path=/; domain=.bbc.co.uk'; | |
document.cookie = | |
'sa_labels=' + encodeURIComponent('link_location=iplayer-preview-opt-in') + | |
'; max-age=' + 60 + | |
'; path=/; domain=bbc.co.uk'; | |
window.location.reload(true); | |
}); | |
return; | |
}); |
if this is a self executing anonymous function do you need to store it in a var? Can't you just execute it without calling init?
agree on last point mr hog, but I'm not that bothered here.
Yeah i guess so, put it inside variable so it kind maintains context. but not needed.
Matt ok will add comment L.12
yeah i dont care as its a 1 month stop gap, just in auto pilot mode :)
👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can't help but feel line 12 needs a comment