From: Michael McMahon Date: Tue, 26 Nov 2019 21:18:07 +0000 (-0500) Subject: Modal window changes - validation and frequency X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=622db55aa64365135432395949335f8151edf62a;p=enc-live.git Modal window changes - validation and frequency --- diff --git a/en/index.html b/en/index.html index 39897b9..89df644 100644 --- a/en/index.html +++ b/en/index.html @@ -249,7 +249,7 @@ href="//static.fsf.org/nosvn/enc-dev0/img/favicon.ico" />
- +

Join us and make an impact!

@@ -273,18 +273,13 @@ Our associate members are the heart of the FSF's commitment to a society where s
- Renew +  Renew
- Donate +  Donate
- @@ -314,9 +309,9 @@ function fsfModalWindowElemMaybeSwitchText () { // switch dbd text document.getElementById("fsf-modal-window-elem-text").innerHTML =' \ \ -

Our associate members are the heart of the FSF\'s commitment to a society where software respects our freedom and dignity. Every individual that takes a stand will help us reach our goal to welcome 600 new free software advocates by December 31st.

\ +

Our associate members are the heart of the FSF\'s commitment to a society where software respects our freedom and dignity. Every individual that takes a stand will help us reach our goal to welcome 600 new free software advocates by December 31st.<\/p> \ \ -

READ MORE | JOIN

'; +

READ MORE<\/a> | JOIN<\/a><\/span><\/p>'; } // show fsf-modal-window-elem if it hasn't been previously closed by @@ -326,11 +321,6 @@ function fsfModalWindowElemMaybeShow () { var pattern, noShowFsfModalWindowElementP, now; -// now = new Date(); -// if (now.getTime() < startTime.getTime() || now.getTime() > endTime.getTime()) { -// return; // don't show the fsf-modal-window-elem -// } - // see if cookie says not to show element pattern = /showFsfFall2019FundraiserModalWindowElementP\s*=\s*false/; noShowFsfModalWindowElementP = pattern.test(document.cookie); @@ -364,6 +354,7 @@ function daysInFuture (plusDays) { function fsfModalWindowElemHide () { document.getElementById("fsf-modal-window-elem-container").style.display="none"; } + // optionally hide elem and set a cookie to keep the fsf-modal-window-elem hidden for the next `forDays`. function fsfModalWindowElemDontShowForDays (forDays, hideNow) { if (hideNow === true) { @@ -375,16 +366,9 @@ function fsfModalWindowElemDontShowForDays (forDays, hideNow) { // hide the element from now to two weeks after closing it function fsfModalWindowElemDontShowForAWhile () { - fsfModalWindowElemDontShowForDays(14, true); + fsfModalWindowElemDontShowForDays(7, true); } -// hide the element from now to past the date of the campaign -//function fsfModalWindowElemDontShowAgain () { -// fsfModalWindowElemDontShowForDays(120, true); -//} -// don't show the element for a while -//function fsfModalWindowElemMaybeLater () { -// fsfModalWindowElemDontShowForDays(1, true); -//} + // keep the element visible for now, but don't show it for a while function fsfModalWindowElemFollowedLink () { fsfModalWindowElemDontShowForDays(14, false); @@ -394,26 +378,27 @@ function fsfModalWindowElemFollowedLink () { document.getElementById("fsf-modal-window-elem-container").addEventListener("click", function(event){ fsfModalWindowElemDontShowForAWhile(); }); + // don't close popup if clicking non-trasparent part (with the text and buttons) document.getElementById("fsf-modal-window-elem").addEventListener("click", function(event){ event.stopPropagation(); }); + // close popup if user clicks X icon document.getElementById("fsf-modal-window-elem-close-button").addEventListener("click", function(event){ fsfModalWindowElemDontShowForAWhile(); }); -//// close popup if user clicks maybe-later div -//document.getElementById("fsf-modal-window-elem-maybe-later").addEventListener("click", function(event){ -// fsfModalWindowElemMaybeLater(); -//}); + // disable popup if user clicks one of the main buttons document.getElementById("fsf-modal-window-elem-buttons").addEventListener("click", function(event){ fsfModalWindowElemFollowedLink(); }); + // disable popup if user clicks one of the "Read more" link document.getElementById("fsf-modal-window-text-link").addEventListener("click", function(event){ fsfModalWindowElemFollowedLink(); }); + // close popup if user presses escape key window.addEventListener("keydown", function (event) { switch (event.key) {