Skip to content

Commit

Permalink
Cookie Management, Z-Index string for migrate warning
Browse files Browse the repository at this point in the history
  • Loading branch information
GedMarc committed Jun 18, 2020
1 parent 842b9bf commit 8b43559
Show file tree
Hide file tree
Showing 8 changed files with 916 additions and 1,193 deletions.
2 changes: 0 additions & 2 deletions demos/js/jquery-3.5.0.min.min.js

This file was deleted.

520 changes: 262 additions & 258 deletions demos/js/jquery.layout.state.js

Large diffs are not rendered by default.

777 changes: 317 additions & 460 deletions demos/js/jquery.layout_and_plugins.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demos/js/jquery.layout_and_plugins.min.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion demos/js/jquery.layout_and_plugins.min.min.js

This file was deleted.

10 changes: 7 additions & 3 deletions demos/saved_state.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<title>Save Layout State Demo</title>

<link type="text/css" rel="stylesheet" href="/lib/css/layout-default-latest.css" />
<link type="text/css" rel="stylesheet" href="../dist/layout-default.css" />

<style type="text/css">
p.button {
Expand All @@ -24,8 +24,7 @@
<script type="text/javascript" src="js/jquery-3.5.1.js"></script><script type="text/javascript" src="js/jquery-migrate.js"></script>
<script type="text/javascript" src="js/jquery-ui.js"></script>
<script type="text/javascript" src="js/debug.js"></script>
<script type="text/javascript" src="../source/stable/jquery.layout.js"></script>
<script type="text/javascript" src="../source/stable/plugins/jquery.layout.state.js"></script>
<script type="text/javascript" src="js/jquery.layout_and_plugins.min.js"></script>

<script type="text/javascript">

Expand Down Expand Up @@ -91,6 +90,11 @@
, onload: customLoadState // run custom state-code when Layout loads
, onunload: customSaveState // ditto when page unloads OR Layout is 'destroyed'
*/

,stateManagement: {
enabled: true
, cookie:{ secure:true}
}
});
//debugData( myLayout.options.stateManagement, 'options.stateManagement' );
//debugData( myLayout.options.west.fxSpeed, 'options.west.fxSpeed' );
Expand Down
777 changes: 317 additions & 460 deletions dist/jquery.layout_and_plugins.js

Large diffs are not rendered by default.

20 changes: 12 additions & 8 deletions dist/plugins/jquery.layout.state.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ $.ui.cookie = {
clear = true;
}
}
if (date) params += ';expires='+ date.toUTCString();
if (o.path) params += ';path='+ o.path;
if (o.domain) params += ';domain='+ o.domain;
if (o.secure) params += ';secure';
if (date) params += '; expires='+ date.toUTCString();
if (o.path) params += '; path='+ o.path;
if (o.domain) params += '; domain='+ o.domain;
if (o.secure) params += '; Secure; SameSite=' + o.sameSite;
if (o.httpOnly) params += '; HttpOnly';
document.cookie = name +'='+ (clear ? "" : encodeURIComponent( val )) + params; // write or clear cookie
}

Expand Down Expand Up @@ -125,6 +126,9 @@ $.layout.defaults.stateManagement = {
, path: "" // blank = current page, '/' = entire website
, expires: "" // 'days' to keep cookie - leave blank for 'session cookie'
, secure: false
, sameSite: "Strict" //Default to strict but allow override to non
, httpOnly: false //careful, JS - for now - does need to access the cookie
, hostOnly: true
}
};
// Set stateManagement as a layout-option, NOT a pane-option
Expand Down Expand Up @@ -281,10 +285,10 @@ $.layout.state = {
* Convert stringified JSON back to a hash object
* @see $.parseJSON(), adding in jQuery 1.4.1
*/
, decodeJSON: function (str) {
try { return $.parseJSON ? $.parseJSON(str) : window["eval"]("("+ str +")") || {}; }
catch (e) { return {}; }
}
, decodeJSON: function (str) {
try { return JSON ? JSON.parse(str) : window["eval"]("("+ str +")") || {}; }
catch (e) { return {}; }
}


, _create: function (inst) {
Expand Down

0 comments on commit 8b43559

Please sign in to comment.