/webdesigner/community?hl=en
This content is likely not relevant anymore. Try searching or browse recent questions.
Safari isn't reading Custom JS in GWD 0 Recommended Answers 0 Replies 1 Me Too
1 Recommended Answer
$0 Recommended Answers
Last edited 8/10/18
I am adding some custom js code in the custom event on the timeline in order to display element according to a date. For some reason it does not work when viewing the banner on Safari, but Firefox, Chrome and Opera work fine. Has anybody have the same issue? Where you able to solved? how?
This is the code that I am adding:
function savingTime() {
sTime = new Date();
sYear = sTime.getFullYear();
sMonth = sTime.getMonth() + 1;
sDay = sTime.getDate();
return [sYear, sMonth, sDay];
}
/*Time Saving Change:*/
var stYear = savingTime()[0],
stMonth = savingTime()[1],
stDay = savingTime()[2],
a;
if (stYear == 2018) {
if (stMonth <= 11) {
if (stDay <= 3) {
a = -4;
} else if (stDay >= 4) {
a = -5;
}
} else {
a = -5;
}
}
/*Time to Eastern Time Only:*/
function calcTime(city, offset) {
d = new Date();
utc = d.getTime() + (d.getTimezoneOffset() * 60000);
nd = new Date(utc + (3600000 * offset));
return [nd.getFullYear(), nd.getMonth(), nd.getDate(), nd.getHours(), nd.getMinutes()];
}
var thisYear = calcTime('Eastern', a)[0];
var thisMonth = calcTime('Eastern', a)[1] + 1;
var thisDay = calcTime('Eastern', a)[2];
var thisHour = calcTime('Eastern', a)[3];
var thisMinute = calcTime('Eastern', a)[4];
/* ============ DRIVER VS DRIVER Tune In */
var tunein1 = document.getElementById('tunein1'); /* Coming in October */
var tunein2 = document.getElementById('tunein2'); /* Premiers Oct 2 9PM ET */
var tunein3 = document.getElementById('tunein3'); /* Premiers Tuesday 9PM ET */
var tunein4 = document.getElementById('tunein4'); /* Premiers Tomorrow 9PM ET */
var tunein5 = document.getElementById('tunein5'); /* Premiers Tonight 9PM ET */
if (thisMonth == 8) {
tunein1.style.display = 'visible';
tunein2.style.top = "250px";
tunein3.style.top = "250px";
tunein4.style.top = "250px";
tunein5.style.top = "250px";
}
if (thisMonth == 9) {
if (thisDay <= 4) {
tunein1.style.display = 'visible';
tunein2.style.top = "250px";
tunein3.style.top = "250px";
tunein4.style.top = "250px";
tunein5.style.top = "250px";
}
if (thisDay >= 5 && thisDay <= 25) {
tunein1.style.top = "250px";
tunein2.style.display = 'visible';
tunein3.style.top = "250px";
tunein4.style.top = "250px";
tunein5.style.top = "250px";
}
if (thisDay >= 23 && thisDay <= 30) {
tunein1.style.top = "250px";
tunein2.style.top = "250px";
tunein3.style.display = 'visible';
tunein4.style.top = "250px";
tunein5.style.top = "250px";
}
}
if (thisMonth == 10) {
if (thisDay == 1) {
tunein1.style.top = "250px";
tunein2.style.top = "250px";
tunein3.style.top = "250px";
tunein4.style.display = 'visible';
tunein5.style.top = "250px";
}
if (thisDay == 2) {
tunein1.style.top = "250px";
tunein2.style.top = "250px";
tunein3.style.top = "250px";
tunein4.style.top = "250px";
tunein5.style.display = 'visible';
}
}
Community content may not be verified or up-to-date.
Recommended Answer Recommended Answers (0)
No replies yet.
This question is locked and replying has been disabled.
Discard post? You will lose what you have written so far.
false
false
Notifications are currently off and you won't receive updates. To turn them on, go to Notifications preferences on your Profile page.
Please follow our content policy when creating your post.
Discard post?
You will lose what you have written so far.
Personal information found
We found the following personal information in your message:
This information will be visible to anyone who visits or subscribes to notifications for this post. Are you sure you want to continue?
A problem occurred. Please try again.
Create Reply
Edit Reply
Link to post
Delete post?
This will remove the reply from the Answers section.
Notifications are off
Your notifications are currently off and you won't receive subscription updates. To turn them on, go to Notifications preferences on your Profile page.
Report abuse
Google takes abuse of its services very seriously. We're committed to dealing with such abuse according to the laws in your country of residence. When you submit a report, we'll investigate it and take the appropriate action. We'll get back to you only if we require additional details or have more information to share.
Go to the Legal Help page to request content changes for legal reasons.
Reported post for abuse
Unable to send report.
Google user
This reply is no longer available.
Badges
Some community members might have badges that indicate their identity or level of participation in a community.
Google Employee — Googler guides and community managers
Community Specialist — Google partners who share their expertise
Platinum Product Expert — Seasoned members who contribute beyond providing help through mentoring, creating content, and more
Gold Product Expert — Trusted members who are knowledgeable and active contributors
Silver Product Expert — New members who are developing their product knowledge
Community content may not be verified or up-to-date.
/webdesigner/threads
false
//accounts.google.com/ServiceLogin
You'll receive email notifications for new posts at
Unable to delete question.
Unable to update me-too.
Unable to update subscription.
You have been unsubscribed
Deleted
Unable to delete reply.
Removed from Answers
Marked as Recommended Answer
Removed recommendation
Undo
Unable to update reply.
Unable to update vote.
Thank you. Your response was recorded.
Unable to undo vote.
Thank you. This reply will now display in the answers section.
Link copied
Locked
Unlocked
Unable to lock
Unable to unlock
Pinned
Unpinned
Unable to pin
Unable to unpin
Marked
Unmarked
Unable to mark
Reported as off topic
/webdesigner/profile/0?hl=en-GB