Complete overhaul of code structure and relevant files (#639)

This commit is contained in:
Daniël van Noord
2021-03-14 00:41:14 +01:00
committed by GitHub
parent bb34bce9a5
commit 1bffb58782
163 changed files with 7369 additions and 10882 deletions

1
dist/Cache.js vendored

File diff suppressed because one or more lines are too long

1
dist/Config.js vendored
View File

@@ -1 +0,0 @@
CM.Config.SaveConfig=function(){const o=b64_to_utf8(unescape(localStorage.getItem("CookieClickerGame")).split("!END!")[0]),i=o.match(/CookieMonster.*(;|$)/);if(null!==i){const n=o.replace(i[0],`CookieMonster:${CM.save()}`);localStorage.setItem("CookieClickerGame",escape(`${utf8_to_b64(n)}!END!`))}},CM.Config.LoadConfig=function(o){if(void 0!==localStorage.CMConfig&&delete localStorage.CMConfig,void 0!==o){CM.Options=o;let i=!1;for(const o in CM.Data.ConfigDefault)if(void 0===CM.Options[o])i=!0,CM.Options[o]=CM.Data.ConfigDefault[o];else if("Header"!==o&&"Colors"!==o)-1===o.indexOf("SoundURL")?CM.Options[o]>-1&&CM.Options[o]<CM.Data.Config[o].label.length||(i=!0,CM.Options[o]=CM.Data.ConfigDefault[o]):"string"!=typeof CM.Options[o]&&(i=!0,CM.Options[o]=CM.Data.ConfigDefault[o]);else if("Header"===o)for(const n in CM.Data.ConfigDefault.Header)void 0!==CM.Options[o][n]&&CM.Options[o][n]>-1&&CM.Options[o][n]<2||(i=!0,CM.Options[o][n]=CM.Data.ConfigDefault[o][n]);else for(const n in CM.Data.ConfigDefault.Colors)void 0!==CM.Options[o][n]&&"string"==typeof CM.Options[o][n]||(i=!0,CM.Options[o][n]=CM.Data.ConfigDefault[o][n]);i&&CM.Config.SaveConfig(),CM.Main.Loop();for(const o in CM.Data.ConfigDefault)"Header"!==o&&void 0!==CM.Data.Config[o].func&&CM.Data.Config[o].func()}else CM.Config.RestoreDefault()},CM.Config.RestoreDefault=function(){CM.Config.LoadConfig(CM.Data.ConfigDefault),CM.Config.SaveConfig(),Game.UpdateMenu()},CM.Config.ToggleConfig=function(o){CM.Options[o]++,CM.Options[o]===CM.Data.Config[o].label.length?(CM.Options[o]=0,CM.Data.Config[o].toggle&&(l(CM.Config.ConfigPrefix+o).className="option off")):l(CM.Config.ConfigPrefix+o).className="option",void 0!==CM.Data.Config[o].func&&CM.Data.Config[o].func(),l(CM.Config.ConfigPrefix+o).innerHTML=CM.Data.Config[o].label[CM.Options[o]],CM.Config.SaveConfig()},CM.Config.ToggleConfigVolume=function(o){null!==l(`slider${o}`)&&(l(`slider${o}right`).innerHTML=`${l(`slider${o}`).value}%`,CM.Options[o]=Math.round(l(`slider${o}`).value)),CM.Config.SaveConfig()},CM.Config.ToggleHeader=function(o){CM.Options.Header[o]++,CM.Options.Header[o]>1&&(CM.Options.Header[o]=0),CM.Config.SaveConfig()},CM.Config.CheckNotificationPermissions=function(o){if(1===o){const o=function(){try{Notification.requestPermission().then()}catch(o){return!1}return!0};"Notification"in window?o()?Notification.requestPermission().then():Notification.requestPermission():console.log("This browser does not support notifications.")}},CM.Config.ConfigPrefix="CMConfig";

3
dist/CookieMonster.js vendored Normal file

File diff suppressed because one or more lines are too long

10
dist/CookieMonster.js.LICENSE.txt vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* jscolor - JavaScript Color Picker
*
* @link http://jscolor.com
* @license For open source use: GPLv3
* For commercial use: JSColor Commercial License
* @author Jan Odvarko - East Desire
*
* See usage examples at http://jscolor.com/examples/
*/

1
dist/CookieMonster.js.map vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/Data.js vendored

File diff suppressed because one or more lines are too long

1
dist/Disp.js vendored

File diff suppressed because one or more lines are too long

1
dist/Footer.js vendored
View File

@@ -1 +0,0 @@
(()=>{if(CM.init=function(){CM.Footer.isInitzializing=!0;let o=!0;Game.version!==Number(CM.VersionMajor)&&(o=confirm(`Cookie Monster version ${CM.VersionMajor}.${CM.VersionMinor} is meant for Game version ${CM.VersionMajor}. Loading a different version may cause errors. Do you still want to load Cookie Monster?`)),o&&(CM.Main.DelayInit(),Game.registerHook("draw",CM.Disp.Draw),Game.registerHook("logic",CM.Main.Loop),CM.Footer.isInitzializing=!1)},CM.save=function(){return JSON.stringify({settings:CM.Options,version:`${CM.VersionMajor}.${CM.VersionMinor}`})},CM.load=function(o){const e=JSON.parse(o);CM.Sim.InitData(),CM.Config.LoadConfig(e.settings),e.version!==`${CM.VersionMajor}.${CM.VersionMinor}`&&(Game.prefs.popups?Game.Popup("A new version of Cookie Monster has been loaded, check out the release notes in the info tab!"):Game.Notify("A new version of Cookie Monster has been loaded, check out the release notes in the info tab!","","",0,1))},CM.Footer.AddJscolor=function(){CM.Footer.Jscolor=document.createElement("script"),CM.Footer.Jscolor.type="text/javascript",CM.Footer.Jscolor.setAttribute("src","https://aktanusa.github.io/CookieMonster/jscolor/jscolor.js"),document.head.appendChild(CM.Footer.Jscolor)},void 0===CM.Footer.isInitzializing){CM.Footer.AddJscolor();const o=setInterval((function(){"undefined"!=typeof jscolor&&(jscolor.init(),Game.registerMod("CookieMonster",CM),clearInterval(o))}),500)}})();

1
dist/Header.js vendored
View File

@@ -1 +0,0 @@
CM={Backup:{},Cache:{},Config:{},Data:{Config:{}},Disp:{},Footer:{},Main:{},Options:{},Sim:{},VersionMajor:"2.031",VersionMinor:"5"};

1
dist/Main.js vendored

File diff suppressed because one or more lines are too long

1
dist/Sim.js vendored

File diff suppressed because one or more lines are too long