[Scummvm-git-logs] scummvm-web master -> 5cdbebd4750afb83ebab5293cce0bee09f381ece

lotharsm serra at scummvm.org
Mon Aug 27 19:43:23 CEST 2018


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm-web' repo located at https://github.com/scummvm/scummvm-web .

Summary:
3a49bb0001 TEMPLATES: Add cookie consent notice templates
ece60acf55 WEB: Add a cookie consent form to the bottom of the page
5cdbebd475 WEB: Extract the cookie consent text into the translation files


Commit: 3a49bb0001a732315ca910d68e7ffe1c53c6f26f
    https://github.com/scummvm/scummvm-web/commit/3a49bb0001a732315ca910d68e7ffe1c53c6f26f
Author: Matan Bareket (mataniko at gmail.com)
Date: 2018-08-27T19:43:18+02:00

Commit Message:
TEMPLATES: Add cookie consent notice templates

Changed paths:
  A scss/components/_cookie.scss
    scss/main.scss
    templates/pages/index.tpl


diff --git a/scss/components/_cookie.scss b/scss/components/_cookie.scss
new file mode 100644
index 0000000..0f91002
--- /dev/null
+++ b/scss/components/_cookie.scss
@@ -0,0 +1,50 @@
+.cookie-consent {	
+	position: fixed;
+	bottom: 0;
+	left: 0;
+	width: 100%;
+	background: black;
+	color: white;
+	min-height: 40px;
+	vertical-align: middle;
+	padding: 20px 20px;
+
+	.buttons {
+		float: right;
+		width: 10%;
+	}
+
+	.text {
+		min-width: 90%;
+		max-width: 100%;
+		float: left;		
+	}
+
+	@include respond-to(small) {
+		.buttons {
+			float: left;
+			width: 100%;
+			text-align: center;
+			margin-top: 5px;
+		}
+	}
+
+	a {
+		color: white;
+		font-size: 0.8em;
+		margin-right: 5px;
+		cursor: pointer;	
+		white-space: nowrap;
+
+		&.accept {
+			background-color: $totem-pole;
+			border: 1px solid $totem-pole;
+			border-radius: 4px;
+			padding: 4px;
+		}
+
+		&:hover {
+			text-decoration: underline;
+		}
+	}
+}
diff --git a/scss/main.scss b/scss/main.scss
index 9a991df..09703c9 100644
--- a/scss/main.scss
+++ b/scss/main.scss
@@ -16,6 +16,7 @@
 @import 'components/box';
 @import 'components/roundbox';
 @import 'components/toc';
+ at import 'components/cookie';
 
 @import 'pages/chart';
 @import 'pages/compatibility';
diff --git a/templates/pages/index.tpl b/templates/pages/index.tpl
index 26196bd..e27ed32 100644
--- a/templates/pages/index.tpl
+++ b/templates/pages/index.tpl
@@ -91,7 +91,10 @@
 	<script type="text/javascript">
 		_uacct = "UA-1455743-1";
 		_udn = "scummvm.org";
-		urchinTracker();
+
+		if (window.localStorage.getItem('COOKIE_CONSENT') == 'true') {
+			urchinTracker();
+		}		
 	</script>
 {* End Google analytics javascript. *}
 	<script>
@@ -102,5 +105,8 @@
 				document.body.classList.remove('no-scroll');
 		});
 	</script>
+
+
+{include file='components/cookie.tpl'}
 </body>
 </html>


Commit: ece60acf55f8662820da9a7594dce6d3e72e316f
    https://github.com/scummvm/scummvm-web/commit/ece60acf55f8662820da9a7594dce6d3e72e316f
Author: Matan Bareket (mataniko at gmail.com)
Date: 2018-08-27T19:43:18+02:00

Commit Message:
WEB: Add a cookie consent form to the bottom of the page

Changed paths:
    scss/components/_cookie.scss
    templates/components/cookie.tpl
    templates/pages/index.tpl


diff --git a/scss/components/_cookie.scss b/scss/components/_cookie.scss
index 0f91002..dc631d5 100644
--- a/scss/components/_cookie.scss
+++ b/scss/components/_cookie.scss
@@ -9,30 +9,15 @@
 	vertical-align: middle;
 	padding: 20px 20px;
 
-	.buttons {
-		float: right;
-		width: 10%;
-	}
-
-	.text {
-		min-width: 90%;
-		max-width: 100%;
-		float: left;		
-	}
-
-	@include respond-to(small) {
-		.buttons {
-			float: left;
-			width: 100%;
-			text-align: center;
-			margin-top: 5px;
-		}
+	.middle {
+		text-align: center;
+		width: 100%;		
 	}
 
 	a {
 		color: white;
 		font-size: 0.8em;
-		margin-right: 5px;
+		margin: 5px;
 		cursor: pointer;	
 		white-space: nowrap;
 
diff --git a/templates/components/cookie.tpl b/templates/components/cookie.tpl
index e7f69fe..6f8a207 100644
--- a/templates/components/cookie.tpl
+++ b/templates/components/cookie.tpl
@@ -1,15 +1,13 @@
 <div class="cookie-consent">
-   <div class="text">This website uses third-party cookies to collect traffic information. By continuing to use the site you are providing consent to do so.</div>
-   <div class="buttons"><a onclick="cookie_consent(false)">Decline</a><a class="accept" onclick="cookie_consent(true)">Got it!</a></div>   
+	<div class="middle">
+	 <span class="text">We use cookies to enhance content and analyze information on site performance and usage.</span>
+	 <span class="buttons"><a class="accept" onclick="cookie_consent(true)">Allow Cookies</a><a onclick="cookie_consent(false)">Refuse Cookies</a></span>
+	</div>
 </div>
 
 <script>
-	if (window.localStorage.getItem('COOKIE_CONSENT')) {
-			document.querySelector('.cookie-consent').hidden = true;
-		}
-
 	function cookie_consent(allowCookies) {
-		window.localStorage.setItem('COOKIE_CONSENT', allowCookies)
-		document.querySelector('.cookie-consent').hidden = true;
+		document.cookie = "cookie_consent=" + allowCookies + "; expires=Fri, 31 Dec 9999 23:59:59 GMT";
+		document.querySelector('.cookie-consent').style.display = "none";
 	}
 </script>
diff --git a/templates/pages/index.tpl b/templates/pages/index.tpl
index e27ed32..680896d 100644
--- a/templates/pages/index.tpl
+++ b/templates/pages/index.tpl
@@ -86,17 +86,7 @@
 {foreach from=$js_files item=script}
 	<script src="/javascripts/{$script}"></script>
 {/foreach}
-{* Google analytics javascript. *}
-	<script src="https://www.google-analytics.com/urchin.js" type="text/javascript"></script>
-	<script type="text/javascript">
-		_uacct = "UA-1455743-1";
-		_udn = "scummvm.org";
 
-		if (window.localStorage.getItem('COOKIE_CONSENT') == 'true') {
-			urchinTracker();
-		}		
-	</script>
-{* End Google analytics javascript. *}
 	<script>
 		document.querySelector('.nav-trigger').addEventListener('change', function() {
 			if (this.checked)
@@ -105,8 +95,19 @@
 				document.body.classList.remove('no-scroll');
 		});
 	</script>
-
-
-{include file='components/cookie.tpl'}
-</body>
+	{if $smarty.cookies.cookie_consent == "true"}
+		{* Google analytics javascript. *}
+			<script src="https://www.google-analytics.com/urchin.js" type="text/javascript"></script>
+			<script type="text/javascript">
+				_uacct = "UA-1455743-1";
+				_udn = "scummvm.org";		
+				urchinTracker();				
+			</script>
+		{* End Google analytics javascript. *}
+	{else if $smarty.cookies.cookie_consent == "false"}
+		{* Do nothing *}
+	{else}
+		{include file='components/cookie.tpl'}	
+	{/if}
+	</body>
 </html>


Commit: 5cdbebd4750afb83ebab5293cce0bee09f381ece
    https://github.com/scummvm/scummvm-web/commit/5cdbebd4750afb83ebab5293cce0bee09f381ece
Author: Matan Bareket (mataniko at gmail.com)
Date: 2018-08-27T19:43:18+02:00

Commit Message:
WEB: Extract the cookie consent text into the translation files

Changed paths:
    lang/lang.ini
    templates/components/cookie.tpl


diff --git a/lang/lang.ini b/lang/lang.ini
index de5aeed..c73937b 100644
--- a/lang/lang.ini
+++ b/lang/lang.ini
@@ -416,3 +416,8 @@ Currently both subprojects are still in a state only suitable for
 developers... so if you can't compile the code yourself, then these are
 not really ready for you.
 """
+
+# cookie.tpl
+cookieText = "We use cookies to enhance content and analyze information on site performance and usage."
+cookieAccept = "Allow Cookies"
+cookieDecline = "Refuse Cookies"
diff --git a/templates/components/cookie.tpl b/templates/components/cookie.tpl
index 6f8a207..6725261 100644
--- a/templates/components/cookie.tpl
+++ b/templates/components/cookie.tpl
@@ -1,7 +1,7 @@
 <div class="cookie-consent">
 	<div class="middle">
-	 <span class="text">We use cookies to enhance content and analyze information on site performance and usage.</span>
-	 <span class="buttons"><a class="accept" onclick="cookie_consent(true)">Allow Cookies</a><a onclick="cookie_consent(false)">Refuse Cookies</a></span>
+	 <span class="text">{#cookieText#}</span>
+	 <span class="buttons"><a class="accept" onclick="cookie_consent(true)">{#cookieAccept#}</a><a onclick="cookie_consent(false)">{#cookieDecline#}</a></span>
 	</div>
 </div>
 





More information about the Scummvm-git-logs mailing list