Skip to content

Instantly share code, notes, and snippets.

@craigtaub
Last active August 29, 2015 13:56
Show Gist options
  • Save craigtaub/8848080 to your computer and use it in GitHub Desktop.
Save craigtaub/8848080 to your computer and use it in GitHub Desktop.
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;
});
@mrwillihog
Copy link

Can't help but feel line 12 needs a comment

@mrwillihog
Copy link

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?

@middric
Copy link

middric commented Feb 6, 2014

agree on last point mr hog, but I'm not that bothered here.

@craigtaub
Copy link
Author

Yeah i guess so, put it inside variable so it kind maintains context. but not needed.

@craigtaub
Copy link
Author

Matt ok will add comment L.12

@mrwillihog
Copy link

yeah i dont care as its a 1 month stop gap, just in auto pilot mode :)

@middric
Copy link

middric commented Feb 6, 2014

👍

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