Last active
October 16, 2024 10:19
-
-
Save ClayRabbit/7a26aab63b082e65d53c847ce66a4715 to your computer and use it in GitHub Desktop.
Revisions
-
ClayRabbit revised this gist
Oct 16, 2024 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,6 +17,9 @@ function setCookie(name, value, params = {}) { // params.expires can be specifie if (params.hasOwnProperty('expires') && !isNaN(parseInt(params.expires))) { params.expires = new Date(Date.now() + params.expires * 1000).toGMTString(); } if (!params.hasOwnProperty('path')) { params.path = '/'; } for (const p in params) { cookie += "; " + p + (params[p] !== true ? "=" + params[p] : ""); } -
ClayRabbit revised this gist
Mar 18, 2023 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,8 +17,8 @@ function setCookie(name, value, params = {}) { // params.expires can be specifie if (params.hasOwnProperty('expires') && !isNaN(parseInt(params.expires))) { params.expires = new Date(Date.now() + params.expires * 1000).toGMTString(); } for (const p in params) { cookie += "; " + p + (params[p] !== true ? "=" + params[p] : ""); } return document.cookie = cookie; } -
ClayRabbit revised this gist
Mar 18, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ function getCookie(name) { function setCookie(name, value, params = {}) { // params.expires can be specified in seconds let cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value); if (params.hasOwnProperty('expires') && !isNaN(parseInt(params.expires))) { params.expires = new Date(Date.now() + params.expires * 1000).toGMTString(); } for (const param in params) { cookie += "; " + param + (params[param] !== true ? "=" + params[param] : ""); -
ClayRabbit revised this gist
Mar 18, 2023 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,7 @@ function getCookie(name) { let result = null; name = encodeURIComponent(name); document.cookie.split(';').every(function (c) { const [n, v] = c.split('=', 2); if (n.trim() === name) { result = decodeURIComponent(v); return false; -
ClayRabbit revised this gist
Mar 18, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ function getCookie(name) { return result; } function setCookie(name, value, params = {}) { // params.expires can be specified in seconds let cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value); if (params.hasOwnProperty('expires') && !isNaN(parseInt(params.expires))) { params.expires = new Date(new Date().getTime() + params.expires * 1000).toGMTString(); -
ClayRabbit revised this gist
Mar 18, 2023 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,4 +20,8 @@ function setCookie(name, value, params = {}) { cookie += "; " + param + (params[param] !== true ? "=" + params[param] : ""); } return document.cookie = cookie; } function deleteCookie(name) { return setCookie(name, "", {expires: -1}); } -
ClayRabbit revised this gist
Mar 18, 2023 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,10 +14,10 @@ function getCookie(name) { function setCookie(name, value, params = {}) { let cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value); if (params.hasOwnProperty('expires') && !isNaN(parseInt(params.expires))) { params.expires = new Date(new Date().getTime() + params.expires * 1000).toGMTString(); } for (const param in params) { cookie += "; " + param + (params[param] !== true ? "=" + params[param] : ""); } return document.cookie = cookie; } -
ClayRabbit revised this gist
Mar 18, 2023 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,6 @@ function getCookie(name) { let result = null; name = encodeURIComponent(name); document.cookie.split(';').every(function (c) { if (n.trim() === name) { result = decodeURIComponent(v); return false; -
ClayRabbit created this gist
Mar 18, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ function getCookie(name) { let result = null; name = encodeURIComponent(name); document.cookie.split(';').every(function (c) { console.log(n.trim(), name); if (n.trim() === name) { result = decodeURIComponent(v); return false; } return true; }); return result; } function setCookie(name, value, params = {}) { let cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value); if (params.hasOwnProperty('expires') && !isNaN(parseInt(params.expires))) { params.expires = new Date(new Date().getTime() + params.expires * 1000); } for (const param in params) { cookie += "; " + param + (params[param] !== true ? "=" + params[param] : ""); } document.cookie = cookie; }