| @@ -1,32 +1,32 @@ | ||
| 1 | -/** | |
| 2 | - * Cookie | |
| 3 | - * | |
| 4 | - * @since 4.2.3.4 | |
| 5 | - * @version 1.0.0 | |
| 6 | - */ | |
| 7 | -const Cookie = { | |
| 8 | - set: ( cname, cvalue, exdays ) => { | |
| 9 | - const d = new Date(); | |
| 10 | - d.setTime( d.getTime() + ( exdays * 24 * 60 * 60 * 1000 ) ); | |
| 11 | - const expires = 'expires=' + d.toUTCString(); | |
| 12 | - document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/'; | |
| 13 | - }, | |
| 14 | - get: ( cname ) => { | |
| 15 | - const name = cname + '='; | |
| 16 | - const decodedCookie = decodeURIComponent( document.cookie ); | |
| 17 | - const ca = decodedCookie.split( ';' ); | |
| 18 | - for ( let i = 0; i < ca.length; i++ ) { | |
| 19 | - let c = ca[ i ]; | |
| 20 | - while ( c.charAt( 0 ) === ' ' ) { | |
| 21 | - c = c.substring( 1 ); | |
| 22 | - } | |
| 23 | - if ( c.indexOf( name ) === 0 ) { | |
| 24 | - return c.substring( name.length, c.length ); | |
| 25 | - } | |
| 26 | - } | |
| 27 | - return ''; | |
| 28 | - }, | |
| 29 | -}; | |
| 30 | - | |
| 31 | -export default Cookie; | |
| 32 | - | |
| 1 | +/** | |
| 2 | + * Cookie | |
| 3 | + * | |
| 4 | + * @since 4.2.3.4 | |
| 5 | + * @version 1.0.0 | |
| 6 | + */ | |
| 7 | +const Cookie = { | |
| 8 | + set: ( cname, cvalue, exdays ) => { | |
| 9 | + const d = new Date(); | |
| 10 | + d.setTime( d.getTime() + ( exdays * 24 * 60 * 60 * 1000 ) ); | |
| 11 | + const expires = 'expires=' + d.toUTCString(); | |
| 12 | + document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/'; | |
| 13 | + }, | |
| 14 | + get: ( cname ) => { | |
| 15 | + const name = cname + '='; | |
| 16 | + const decodedCookie = decodeURIComponent( document.cookie ); | |
| 17 | + const ca = decodedCookie.split( ';' ); | |
| 18 | + for ( let i = 0; i < ca.length; i++ ) { | |
| 19 | + let c = ca[ i ]; | |
| 20 | + while ( c.charAt( 0 ) === ' ' ) { | |
| 21 | + c = c.substring( 1 ); | |
| 22 | + } | |
| 23 | + if ( c.indexOf( name ) === 0 ) { | |
| 24 | + return c.substring( name.length, c.length ); | |
| 25 | + } | |
| 26 | + } | |
| 27 | + return ''; | |
| 28 | + }, | |
| 29 | +}; | |
| 30 | + | |
| 31 | +export default Cookie; | |
| 32 | + | |