Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*-- PUBLIC DOMAIN RELEASE - VERSION 2.0.0 - https://pastebin.com/rzSXKPna */
- var G_PagePath = window.location.pathname.toLowerCase ( ); G_PagePath = G_PagePath.replace( 'index.html', '' );
- if ( G_PagePath.length > 1 ) { if ( G_PagePath.substring ( G_PagePath.length - 1, G_PagePath.length ) == '/' ) { G_PagePath = G_PagePath.substring ( 0, G_PagePath.length - 1 ); } }
- // Cookie Array And Index
- var G_CookieString = [];
- var G_CookieBoolean = [];
- var G_CookieNumber = [];
- var G_CI_Name = 0;
- var G_CI_Default = 1;
- var G_CI_Value = 2;
- // Assignment Operator
- var CurrentIndex = -1;
- // String Variable Index
- var G_C_ExampleString = -1;
- // Boolean Variable Index
- var G_C_ExampleBoolean = -1;
- // Integer Variable Index
- var G_C_ExampleNumber = -1;
- // String Assignments
- G_C_ExampleString = G_CookieString.length; CurrentIndex = G_CookieString.length; G_CookieString[CurrentIndex] = []; G_CookieString[CurrentIndex][G_CI_Name] = 'Example String'; G_CookieString[CurrentIndex][G_CI_Default] = 'This string can be for a lot of things.';
- // Boolean Assignments
- G_C_ExampleBoolean = G_CookieBoolean.length; CurrentIndex = G_CookieBoolean.length; G_CookieBoolean[CurrentIndex] = []; G_CookieBoolean[CurrentIndex][G_CI_Name] = 'Example Boolean'; G_CookieBoolean[CurrentIndex][G_CI_Default] = true;
- // Integer Assignments
- G_C_ExampleNumber = G_CookieNumber.length; CurrentIndex = G_CookieNumber.length; G_CookieNumber[CurrentIndex] = []; G_CookieNumber[CurrentIndex][G_CI_Name] = 'Example Integer'; G_CookieNumber[CurrentIndex][G_CI_Default] = 1;
- var Globals = new function () {
- this.AddAsset = function ( TypeIn, PathIn, AsyncIn ) {
- if ( TypeIn == 'style' ) {
- document.write ( '<link rel="stylesheet" href="' + PathIn + '" />' );
- } else if ( TypeIn == 'script' ) {
- if ( AsyncIn == false ) {
- document.write( '<script src="' + PathIn + '"></script>' );
- } else {
- document.write( '<script src="' + PathIn + '" async></script>' );
- }
- }
- }
- this.Initialize = function () {
- // Load cookie string array
- for ( Count = 0; Count < G_CookieString.length; Count++ ) {
- G_CookieString[Count][G_CI_Value] = Private.VoidToString ( Cookies.GetCookieAndSetDaily ( G_CookieString[Count][G_CI_Name], G_CookieString[Count][G_CI_Default] ) );
- }
- // Load cookie boolean array
- for ( Count = 0; Count < G_CookieBoolean.length; Count++ ) {
- G_CookieBoolean[Count][G_CI_Value] = Private.VoidToBoolean ( Cookies.GetCookieAndSetDaily ( G_CookieBoolean[Count][G_CI_Name], G_CookieBoolean[Count][G_CI_Default] ) );
- }
- // Load cookie number array
- for ( Count = 0; Count < G_CookieNumber.length; Count++ ) {
- G_CookieNumber[Count][G_CI_Value] = Private.VoidToNumber ( Cookies.GetCookieAndSetDaily ( G_CookieNumber[Count][G_CI_Name], G_CookieNumber[Count][G_CI_Default] ) );
- }
- }
- var Private = {
- VoidToString: function ( ValueIn, DefaultIn ) {
- var RetVal = '';
- var IsInvalid = false;
- IsInvalid = this.IsInvalidValue ( ValueIn );
- try {
- if ( IsInvalid == true ) { RetVal = DefaultIn; }
- else { RetVal = ValueIn; }
- } catch ( error ) { }
- return RetVal;
- },
- VoidToBoolean: function ( ValueIn, DefaultIn ) {
- var RetVal = ValueIn;
- var IsInvalid = false;
- if ( typeof ( ValueIn ) == 'string' ) {
- if ( ValueIn == 'true' || ValueIn == '1' ) { RetVal = true; }
- else if ( ValueIn == 'false' || ValueIn == '0' ) { RetVal = false; }
- }
- IsInvalid = this.IsInvalidValue ( ValueIn );
- if ( IsInvalid == true ) { RetVal = DefaultIn; }
- return RetVal;
- },
- VoidToNumber: function ( ValueIn, DefaultIn ) {
- var RetVal = null;
- var IsInvalid = false;
- IsInvalid = this.IsInvalidValue ( ValueIn );
- try {
- if ( IsInvalid == true ) { RetVal = Number ( DefaultIn ); }
- else { RetVal = Number ( ValueIn ); }
- } catch ( error ) { }
- return RetVal;
- },
- IsInvalidValue: function ( ValueIn ) {
- var RetVal = false;
- if ( ValueIn == null ) { RetVal = true; }
- else if ( ValueIn == undefined ) { RetVal = true; }
- return RetVal;
- }
- };
- }
- Globals.Initialize ( );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement