PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / trunk
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses vtrunk
4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 4.2.1 All 138 releases
learnpress / assets / src / js / utils / cookie.js

cookie.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses trunk, at assets/src/js/utils/cookie.js

33 lines 742 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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
33