i am trying to do something that it's still out of my league. I have used before script on website to show Button after 1 minute from video time. So when Video player comes to 01:00 the button is shown and after that it saves that to cookie so the next time you visit page it's shown right away and you don't have to wait another 1 minute so button can be shown.
But now i am trying to connect this timer to the website time, not the video time, and i am pretty lost.
Function calling in Index page:
<script type="text/javascript">
var minuten = 0;
var sekunden = 5;
//==========================
cartt(minuten, sekunden);
</script>
This is the original code of the video time:
$("#video").fitVids();
var video = new Vimeo.Player($('#video iframe'));
function cart(minuten, sekunden) {
var button = $('.cart');
var seconds = (minuten * 60) + sekunden;
var url = window.location.pathname;
url = url.split("/");
var seite = url[url.length -1];
var cookie_string = "cartbutton_" + seite + "=show";
var cookieIsSet = function() { return document.cookie.indexOf(cookie_string) != -1; };
if(!cookieIsSet()) {
button.hide();
video.on('timeupdate', function(data) {
if (data.seconds >= seconds && !cookieIsSet()) {
button.show();
document.cookie = cookie_string + "; max-age=259200";
}
});
}
}
And this is how i am trying to get website time:
window.onload=function(){
var start=Date.now();
}
function cartt(minuten, sekunden) {
var button = $('.cartt');
var seconds = (minuten * 60) + sekunden;
document.write(seconds);
var url = window.location.pathname;
url = url.split("/");
var seite = url[url.length -1];
var cookie_string = "cartbutton_" + seite + "=show";
var cookieIsSet = function() {
return document.cookie.indexOf(cookie_string) != -1;
};
if(!cookieIsSet()) {
start.on(function(data) {
if (data.seconds >= seconds && !cookieIsSet()) {
button.show();
document.cookie = cookie_string + "; max-age=259200";
}
});
button.hide();
}
}