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

View File

@@ -0,0 +1,25 @@
import { CacheSpawnedGoldenShimmer } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
import { LastGoldenCookieState } from '../../Main/VariablesAndData';
/**
* This function creates the Favicon, it is called by CM.Main.DelayInit()
*/
export function CreateFavicon() {
const Favicon = document.createElement('link');
Favicon.id = 'CMFavicon';
Favicon.rel = 'shortcut icon';
Favicon.href = 'https://orteil.dashnet.org/cookieclicker/favicon.ico';
document.getElementsByTagName('head')[0].appendChild(Favicon);
}
/**
* This function updates the Favicon depending on whether a Golden Cookie has spawned
* By relying on CM.Cache.spawnedGoldenShimmer it only changes for non-user spawned cookie
*/
export function UpdateFavicon() {
if (CMOptions.Favicon === 1 && LastGoldenCookieState > 0) {
if (CacheSpawnedGoldenShimmer.wrath) l('CMFavicon').href = 'https://aktanusa.github.io/CookieMonster/favicon/wrathCookie.ico';
else l('CMFavicon').href = 'https://aktanusa.github.io/CookieMonster/favicon/goldenCookie.ico';
} else l('CMFavicon').href = 'https://orteil.dashnet.org/cookieclicker/favicon.ico';
}