0 Members and 1 Guest are viewing this topic.

*

Olaf Klausen

  • **
  • 62
  • osDate Version: osDate v2.7
The EU cookie hint without plugin
« on: September 27, 2017, 06:41:37 AM »
For all those who have their dating site in the EU.
The cookie hint without plugin, without external Javascript

Even the color is customizable.


This code is for your Index. tpl - for example, just before the concluding </body> tag:
Code: [Select]
<div id="cookiedingsbums"><div>
  <span>Yes, this website also uses cookies. </span>
  <a href="http://www.your-domain.com/privacy">Click here to find out everything about privacy</a></div>
 <span id="cookiedingsbumsCloser" onclick="document.cookie = 'hidecookiedingsbums=1;path=/';jQuery('#cookiedingsbums').slideUp()">&#10006;</span>
</div>

<script>
 if(document.cookie.indexOf('hidecookiedingsbums=1') != -1){
 jQuery('#cookiedingsbums').hide();
 }
 else{
 jQuery('#cookiedingsbums').prependTo('body');
 jQuery('#cookiedingsbumsCloser').show();
 }
</script>

Your CSS specs for your style. css:
Code: [Select]
#cookiedingsbums a {color:#000; text-decoration:none;}

#cookiedingsbums a:hover {text-decoration:underline;}

#cookiedingsbums div {padding:10px; padding-right:40px;}

#cookiedingsbums {
   outline: 1px solid #7b92a9;
   text-align:right;
   border-top:1px solid #fff;
   background: #d6e0eb;
   background: -moz-linear-gradient(top, #d6e0eb 0%, #f2f6f9 100%);
   background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#d6e0eb), color-stop(100%,#f2f6f9));
   background: -webkit-linear-gradient(top, #d6e0eb 0%,#f2f6f9 100%);
   background: -o-linear-gradient(top, #d6e0eb 0%,#f2f6f9 100%);
   background: -ms-linear-gradient(top, #d6e0eb 0%,#f2f6f9 100%);
   background: linear-gradient(to bottom, #d6e0eb 0%,#f2f6f9 100%);
   filter: progid:DXImageTransform.Microsoft.gradient(   startColorstr='#d6e0eb', endColorstr='#f2f6f9',GradientType=0 );
   position:fixed;
   bottom:0px;
   z-index:10000;
   width:100%;
   font-size:12px;
   line-height:16px;}

#cookiedingsbumsCloser {
   color: #777;
   font: 14px/100% arial, sans-serif;
   position: absolute;
   right: 5px;
   text-decoration: none;
   text-shadow: 0 1px 0 #fff;
   top: 5px;
   cursor:pointer;
   border-top:1px solid white;
   border-left:1px solid white;
   border-bottom:1px solid #7b92a9;
   border-right:1px solid #7b92a9;
   padding:4px;
   background: #ced6df; /* Old browsers */
   background: -moz-linear-gradient(top, #ced6df0%, #f2f6f9 100%);
   background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ced6df), color-stop(100%,#f2f6f9));
   background: -webkit-linear-gradient(top, #ced6df0%,#f2f6f9 100%);
   background: -o-linear-gradient(top, #ced6df0%,#f2f6f9 100%);
   background: -ms-linear-gradient(top, #ced6df0%,#f2f6f9 100%);
   background: linear-gradient(to bottom, #ced6df0%,#f2f6f9 100%);
   filter: progid:DXImageTransform.Microsoft.gradient(    startColorstr='#ced6df', endColorstr='#f2f6f9',GradientType=0 );
 }

#cookiedingsbumsCloser:hover {border-bottom:1px solid white; border-right:1px solid white; border-top:1px solid #7b92a9; border-left:1px solid #7b92a9;}

I'm using it and it works perfectly.
« Last Edit: December 07, 2018, 10:25:10 PM by Pharg »

*

Olaf Klausen

  • **
  • 62
  • osDate Version: osDate v2.7
Re: The EU cookie hint without plugin
« Reply #1 on: September 27, 2017, 07:12:05 AM »
There's a little mistake in there.
The code does not come into the Footer. php, but into the Index. tpl.
« Last Edit: December 07, 2018, 10:24:33 PM by Pharg »

Re: The EU cookie hint without plugin
« Reply #2 on: December 07, 2018, 12:22:53 PM »
Hi,
does the code work for evo1.3?
The div-tag works, but if the <script> copy and paste in Index. tpl, then I get a blank page in the frontend.

*

Pharg

  • *****
  • 3,272
    • OsDateFourm
  • osDate Version: osDateEvo v1.3
Re: The EU cookie hint without plugin
« Reply #3 on: December 07, 2018, 10:21:32 PM »
Hi her8ert,

It should work, try putting the CSS code into desktop.css and the mobile.css
or
tell the CSS code where the style.css is by using a link
example: <link href="{$css_path}css/style.css" rel="stylesheet">

With <script> in the TPL files, you have to use the {literal} tags or your will get a whitepage.
Must be like this:
Code: [Select]
{literal}<script>
 if(document.cookie.indexOf('hidecookiedingsbums=1') != -1){
 jQuery('#cookiedingsbums').hide();
 }
 else{
 jQuery('#cookiedingsbums').prependTo('body');
 jQuery('#cookiedingsbumsCloser').show();
 }
</script>{/literal}
« Last Edit: December 07, 2018, 10:34:04 PM by Pharg »
Regards,
Pharg ( Phill )

Don't Personal Message me unless it's about a sensitive matter!!

REMEMBER TO ALWAYS BACKUP BEFORE MAKING ANY CHANGES!!

osDateEvo v1.3 | PHP: 5.3.42 & PHP: 7.2 | MySQL: 5.5.35

Re: The EU cookie hint without plugin
« Reply #4 on: December 08, 2018, 12:31:27 PM »
Hi, Pharg,
{literal} that's it.
Thank you! Now it works for me and evo 1.3.
Best regards!