Complete overhaul of code structure and relevant files (#639)
This commit is contained in:
32
src/Disp/GoldenCookieTimers/GoldenCookieTimers.js
Normal file
32
src/Disp/GoldenCookieTimers/GoldenCookieTimers.js
Normal file
@@ -0,0 +1,32 @@
|
||||
/** Section: Functions related to the Golden Cookie Timers */
|
||||
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { GCTimers } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function creates a new Golden Cookie Timer and appends it CM.Disp.GCTimers based on the id of the cookie
|
||||
* @param {object} cookie A Golden Cookie object
|
||||
*/
|
||||
export default function CreateGCTimer(cookie) {
|
||||
const GCTimer = document.createElement('div');
|
||||
GCTimer.id = `GCTimer${cookie.id}`;
|
||||
GCTimer.style.width = '96px';
|
||||
GCTimer.style.height = '96px';
|
||||
GCTimer.style.position = 'absolute';
|
||||
GCTimer.style.zIndex = '10000000001';
|
||||
GCTimer.style.textAlign = 'center';
|
||||
GCTimer.style.lineHeight = '96px';
|
||||
GCTimer.style.fontFamily = '"Kavoon", Georgia, serif';
|
||||
GCTimer.style.fontSize = '35px';
|
||||
GCTimer.style.cursor = 'pointer';
|
||||
GCTimer.style.display = 'block';
|
||||
if (CMOptions.GCTimer === 0) GCTimer.style.display = 'none';
|
||||
GCTimer.style.left = cookie.l.style.left;
|
||||
GCTimer.style.top = cookie.l.style.top;
|
||||
GCTimer.onclick = function () { cookie.pop(); };
|
||||
GCTimer.onmouseover = function () { cookie.l.style.filter = 'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))'; cookie.l.style.webkitFilter = 'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))'; };
|
||||
GCTimer.onmouseout = function () { cookie.l.style.filter = ''; cookie.l.style.webkitFilter = ''; };
|
||||
|
||||
GCTimers[cookie.id] = GCTimer;
|
||||
l('shimmers').appendChild(GCTimer);
|
||||
}
|
||||
Reference in New Issue
Block a user