Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- PUBLIC DOMAIN RELEASE - VERSION 2.0.0 - https://pastebin.com/aAUa8140 -->
- <!doctype html>
- <html>
- <head>
- <title>Deferment Project</title>
- <meta name="description" content="...">
- <meta name="keywords" content="...">
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link rel="icon" href="/favicon.ico">
- <link rel="stylesheet" href="/style/library/deferment/deferment.min.css">
- <script src="/script/anchor.min.js"></script>
- <script> var Deferred = Deferment.WasDeferred ( ); </script>
- </head>
- <body>
- <noscript><div class="deferment"><div><div><span class="deferment-message"></span></div></div></div></noscript>
- <div class="curtain"></div>
- <script> if ( Deferred == false ) { Layout.Top ( ); } </script>
- <h1>Deferment Project</h1>
- <script>
- if ( Deferred == false ) {
- var Output = '';
- Output += '<h2>Cookie examples</h2>';
- Output += '<p>NOTE: Refresh the page to see that the cookies were also updated.</p>';
- Output += '<h3>String example</h3>';
- Output += '<p><span style="color:green">Current value: \'</span><span id="string-value">' + G_CookieString[G_C_ExampleString][G_CI_Value] + '</span><span style="color:green">\'</span></p>';
- Output += '<p><input type="text" id="StringExample"> <input type="submit" value="Update" onclick=" ButtonWork ( \'String\' );"></p>';
- Output += '<h3>Boolean example</h3>';
- Output += '<p><span style="color:green">Current value:</span> <span id="boolean-value">' + G_CookieBoolean[G_C_ExampleBoolean][G_CI_Value] + '</span></p>';
- var IsChecked = null;
- if ( G_CookieBoolean[G_C_ExampleBoolean][G_CI_Value] == true ) { IsChecked = ' checked'; } else { IsChecked = false; }
- Output += '<input type="radio" name="BooleanExample" id="true"' + IsChecked + '><label for="true">True</label>';
- if ( G_CookieBoolean[G_C_ExampleBoolean][G_CI_Value] == false ) { IsChecked = ' checked'; } else { IsChecked = false; }
- Output += '<input type="radio" name="BooleanExample" id="false"' + IsChecked + '><label for="false">False</label>';
- Output += ' <input type="submit" value="Update" onclick=" ButtonWork ( \'Boolean\' );"></p>';
- Output += '<h3>Number example</h3>';
- Output += '<p><span style="color:green">Current value:</span> <span id="number-value">' + G_CookieNumber[G_C_ExampleNumber][G_CI_Value] + '</span></p>';
- Output += '<p><input type="text" id="NumberExample"> <input type="submit" value="Update" onclick=" ButtonWork ( \'Number\' );"></p>';
- document.write ( Output );
- }
- function ButtonWork ( TypeUpdateIn ) {
- if ( TypeUpdateIn == 'String' ) {
- var NewValue = document.getElementById ( 'StringExample' ).value;
- if ( NewValue != G_CookieString[G_C_ExampleString][G_CI_Value] ) {
- G_CookieString[G_C_ExampleString][G_CI_Value] = NewValue;
- // Cookies.SetCookie( Name, Value, DaysExpires );
- Cookies.SetCookie( G_CookieString[G_C_ExampleString][G_CI_Name], G_CookieString[G_C_ExampleString][G_CI_Value], 365 );
- document.getElementById ( 'string-value' ).innerHTML = G_CookieString[G_C_ExampleString][G_CI_Value];
- }
- } else if ( TypeUpdateIn == 'Boolean' ) {
- var NewValue = null;
- if ( document.getElementById ( 'true' ).checked == true ) { NewValue = true; }
- else { NewValue = false; }
- if ( NewValue != G_CookieBoolean[G_C_ExampleBoolean][G_CI_Value] ) {
- G_CookieBoolean[G_C_ExampleBoolean][G_CI_Value] = NewValue;
- // Cookies.SetCookie( Name, Value, DaysExpires );
- Cookies.SetCookie( G_CookieBoolean[G_C_ExampleBoolean][G_CI_Name], G_CookieBoolean[G_C_ExampleBoolean][G_CI_Value], 365 );
- document.getElementById ( 'boolean-value' ).innerHTML = G_CookieBoolean[G_C_ExampleBoolean][G_CI_Value];
- }
- } else if ( TypeUpdateIn == 'Number' ) {
- var NewValue = null;
- var CheckNumber = Number ( document.getElementById ( 'NumberExample' ).value );
- var Pattern = /^-?\d+\.?\d*$/
- if ( Pattern.test ( CheckNumber ) == true && CheckNumber.toString ( ) == document.getElementById ( 'NumberExample' ).value ) { NewValue = CheckNumber; }
- if ( NewValue != null && NewValue != G_CookieNumber[G_C_ExampleNumber][G_CI_Value] ) {
- G_CookieNumber[G_C_ExampleNumber][G_CI_Value] = NewValue;
- // Cookies.SetCookie( Name, Value, DaysExpires );
- Cookies.SetCookie( G_CookieNumber[G_C_ExampleNumber][G_CI_Name], G_CookieNumber[G_C_ExampleNumber][G_CI_Value], 365 );
- document.getElementById ( 'number-value' ).innerHTML = G_CookieNumber[G_C_ExampleNumber][G_CI_Value];
- }
- }
- }
- </script>
- <script> if ( Deferred == false ) { Layout.Bottom ( ); } </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment