Cookie dialog with standard dialog style.
This commit is contained in:
parent
1fd57bcbc2
commit
93f0658e40
@ -73,6 +73,7 @@
|
||||
"website/o3dv/sharingdialog.js",
|
||||
"website/o3dv/settingsdialog.js",
|
||||
"website/o3dv/quantitiesdialog.js",
|
||||
"website/o3dv/cookiedialog.js",
|
||||
"website/o3dv/modeldata.js",
|
||||
"website/o3dv/info.js",
|
||||
"website/o3dv/navigator.js",
|
||||
|
||||
@ -87,6 +87,7 @@
|
||||
<script type="text/javascript" src="o3dv/sharingdialog.js"></script>
|
||||
<script type="text/javascript" src="o3dv/settingsdialog.js"></script>
|
||||
<script type="text/javascript" src="o3dv/quantitiesdialog.js"></script>
|
||||
<script type="text/javascript" src="o3dv/cookiedialog.js"></script>
|
||||
<script type="text/javascript" src="o3dv/modeldata.js"></script>
|
||||
<script type="text/javascript" src="o3dv/info.js"></script>
|
||||
<script type="text/javascript" src="o3dv/navigator.js"></script>
|
||||
|
||||
@ -87,6 +87,7 @@
|
||||
<script type="text/javascript" src="o3dv/sharingdialog.js"></script>
|
||||
<script type="text/javascript" src="o3dv/settingsdialog.js"></script>
|
||||
<script type="text/javascript" src="o3dv/quantitiesdialog.js"></script>
|
||||
<script type="text/javascript" src="o3dv/cookiedialog.js"></script>
|
||||
<script type="text/javascript" src="o3dv/modeldata.js"></script>
|
||||
<script type="text/javascript" src="o3dv/info.js"></script>
|
||||
<script type="text/javascript" src="o3dv/navigator.js"></script>
|
||||
|
||||
26
website/o3dv/cookiedialog.js
Normal file
26
website/o3dv/cookiedialog.js
Normal file
@ -0,0 +1,26 @@
|
||||
OV.ShowCookieDialog = function (onOk)
|
||||
{
|
||||
let dialog = new OV.ButtonDialog ();
|
||||
let contentDiv = dialog.Init ('Cookie Consent', [
|
||||
{
|
||||
name : 'Cancel',
|
||||
subClass : 'outline',
|
||||
onClick () {
|
||||
dialog.Hide ();
|
||||
}
|
||||
},
|
||||
{
|
||||
name : 'OK',
|
||||
onClick () {
|
||||
dialog.Hide ();
|
||||
onOk ();
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
let text = 'This website uses cookies to offer you better user experience. See the details at the <a target="_blank" href="info/cookies.html">Cookies Policy</a> page.';
|
||||
$('<div>').html (text).addClass ('ov_dialog_section').appendTo (contentDiv);
|
||||
dialog.SetCloseable (false);
|
||||
dialog.Show ();
|
||||
return dialog;
|
||||
};
|
||||
@ -2,7 +2,7 @@ OV.CookieHandler = class
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
this.expirationDays = 30;
|
||||
this.expirationDays = 365;
|
||||
}
|
||||
|
||||
ClearVal (key)
|
||||
|
||||
@ -165,6 +165,11 @@ OV.ButtonDialog = class
|
||||
return dialogContentDiv;
|
||||
}
|
||||
|
||||
SetCloseable (closeable)
|
||||
{
|
||||
this.modal.SetCloseable (closeable);
|
||||
}
|
||||
|
||||
SetCloseHandler (closeHandler)
|
||||
{
|
||||
this.modal.SetCloseHandler (closeHandler);
|
||||
|
||||
@ -714,34 +714,6 @@ div.ov_thin_scrollbar::-webkit-scrollbar-thumb
|
||||
background: #cccccc;
|
||||
}
|
||||
|
||||
div.ov_message_popup
|
||||
{
|
||||
padding: 4px 10px;
|
||||
position: absolute;
|
||||
bottom: 15px;
|
||||
right: 10px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
div.ov_message_popup div.ov_message_popup_text
|
||||
{
|
||||
padding: 3px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
div.ov_message_popup div.ov_message_popup_button
|
||||
{
|
||||
color: #ffffff;
|
||||
background: #3393bd;
|
||||
text-align: center;
|
||||
margin-left: 10px;
|
||||
padding: 3px;
|
||||
width: 60px;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
}
|
||||
|
||||
@media (hover)
|
||||
{
|
||||
|
||||
|
||||
@ -29,7 +29,8 @@ OV.Website = class
|
||||
this.InitDragAndDrop ();
|
||||
this.InitModelLoader ();
|
||||
this.InitNavigator ();
|
||||
//this.InitCookieConsent ();
|
||||
// TODO
|
||||
// this.InitCookieConsent ();
|
||||
|
||||
this.viewer.SetClickHandler (this.OnModelClicked.bind (this));
|
||||
this.Resize ();
|
||||
@ -508,6 +509,7 @@ OV.Website = class
|
||||
InitCookieConsent ()
|
||||
{
|
||||
let cookieConsentKey = 'ov_cookie_consent';
|
||||
// TODO: remove
|
||||
this.cookieHandler.ClearVal (cookieConsentKey);
|
||||
let accepted = this.cookieHandler.GetBoolVal (cookieConsentKey, false);
|
||||
if (accepted) {
|
||||
@ -515,13 +517,8 @@ OV.Website = class
|
||||
}
|
||||
|
||||
let obj = this;
|
||||
let consentPopup = $('<div>').addClass ('ov_message_popup').appendTo (document.body);
|
||||
let consentText = $('<div>').addClass ('ov_message_popup_text').appendTo (consentPopup);
|
||||
consentText.html ('This website uses cookies. See the details at the <a href="info/cookies.html">Cookies Policy</a> page.');
|
||||
let consentButton = $('<div>').html ('Accept').addClass ('ov_message_popup_button').appendTo (consentPopup);
|
||||
consentButton.click (function () {
|
||||
OV.ShowCookieDialog (function () {
|
||||
obj.cookieHandler.SetBoolVal (cookieConsentKey, true);
|
||||
consentPopup.remove ();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user