/*! * @license kjokmjnoi API * Website: https://api.kjokmjnoi.hu * Ver: 1.0.4 */ /* Link funkciók */ function get_information(link, callback) { var xhr = new XMLHttpRequest(); xhr.open("GET", link, true); xhr.onreadystatechange = function() { if (xhr.status == 200) { if (xhr.responseText.startsWith('|$6b4ea69e17243db95f7b46c384d40370$|!')[0]; window.location= url; } else { callback(xhr.responseText); } } else { errorCallback(); } }; xhr.send(null); } function get_POST_information(link, jsonBody, callback, errorCallback) { var xhr = new XMLHttpRequest(); xhr.open("POST", link); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { if (xhr.status == 200) { if (xhr.responseText.startsWith('|$6b4ea69e17243db95f7b46c384d40370$|!')[0]; window.location= url; } else { callback(xhr.responseText); } } else { errorCallback(); } } }; xhr.send(jsonBody); } /* Kódolók */ function htmlspecialchar(text) { return text.replace(/&/g, "&").replace(/>/g, ">").replace(/>>amount) | (value<<(32 - amount)); }; var mathPow = Math.pow; var maxWord = mathPow(2, 32); var lengthProperty = 'length' var i, j; var result = '' var words = []; var asciiBitLength = ascii[lengthProperty]*8; var hash = sha256.h = sha256.h || []; var k = sha256.k = sha256.k || []; var primeCounter = k[lengthProperty]; var isComposite = {}; for (var candidate = 2; primeCounter < 64; candidate++) { if (!isComposite[candidate]) { for (i = 0; i < 313; i += candidate) { isComposite[i] = candidate; } hash[primeCounter] = (mathPow(candidate, .5)*maxWord)|0; k[primeCounter++] = (mathPow(candidate, 1/3)*maxWord)|0; } } ascii += '\x80' while (ascii[lengthProperty]%64 - 56) ascii += '\x00' for (i = 0; i < ascii[lengthProperty]; i++) { j = ascii.charCodeAt(i); if (j>>8) return; words[i>>2] |= j << ((3 - i)%4)*8; } words[words[lengthProperty]] = ((asciiBitLength/maxWord)|0); words[words[lengthProperty]] = (asciiBitLength) for (j = 0; j < words[lengthProperty];) { var w = words.slice(j, j += 16); var oldHash = hash; hash = hash.slice(0, 8); for (i = 0; i < 64; i++) { var i2 = i + j; var w15 = w[i - 15], w2 = w[i - 2]; var a = hash[0], e = hash[4]; var temp1 = hash[7] + (rightRotate(e, 6) ^ rightRotate(e, 11) ^ rightRotate(e, 25)) + ((e&hash[5])^((~e)&hash[6])) + k[i] + (w[i] = (i < 16) ? w[i] : ( w[i - 16] + (rightRotate(w15, 7) ^ rightRotate(w15, 18) ^ (w15>>>3)) + w[i - 7] + (rightRotate(w2, 17) ^ rightRotate(w2, 19) ^ (w2>>>10)) )|0 ); var temp2 = (rightRotate(a, 2) ^ rightRotate(a, 13) ^ rightRotate(a, 22)) + ((a&hash[1])^(a&hash[2])^(hash[1]&hash[2])); hash = [(temp1 + temp2)|0].concat(hash); hash[4] = (hash[4] + temp1)|0; } for (i = 0; i < 8; i++) { hash[i] = (hash[i] + oldHash[i])|0; } } for (i = 0; i < 8; i++) { for (j = 3; j + 1; j--) { var b = (hash[i]>>(j*8))&255; result += ((b < 16) ? 0 : '') + b.toString(16); } } return result; }; var MD5 = function (string) { function RotateLeft(lValue, iShiftBits) { return (lValue<>>(32-iShiftBits)); } function AddUnsigned(lX,lY) { var lX4,lY4,lX8,lY8,lResult; lX8 = (lX & 0x80000000); lY8 = (lY & 0x80000000); lX4 = (lX & 0x40000000); lY4 = (lY & 0x40000000); lResult = (lX & 0x3FFFFFFF)+(lY & 0x3FFFFFFF); if (lX4 & lY4) { return (lResult ^ 0x80000000 ^ lX8 ^ lY8); } if (lX4 | lY4) { if (lResult & 0x40000000) { return (lResult ^ 0xC0000000 ^ lX8 ^ lY8); } else { return (lResult ^ 0x40000000 ^ lX8 ^ lY8); } } else { return (lResult ^ lX8 ^ lY8); } } function F(x,y,z) { return (x & y) | ((~x) & z); } function G(x,y,z) { return (x & z) | (y & (~z)); } function H(x,y,z) { return (x ^ y ^ z); } function I(x,y,z) { return (y ^ (x | (~z))); } function FF(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; function GG(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; function HH(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; function II(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; function ConvertToWordArray(string) { var lWordCount; var lMessageLength = string.length; var lNumberOfWords_temp1=lMessageLength + 8; var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1 % 64))/64; var lNumberOfWords = (lNumberOfWords_temp2+1)*16; var lWordArray=Array(lNumberOfWords-1); var lBytePosition = 0; var lByteCount = 0; while ( lByteCount < lMessageLength ) { lWordCount = (lByteCount-(lByteCount % 4))/4; lBytePosition = (lByteCount % 4)*8; lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount)<>>29; return lWordArray; }; function WordToHex(lValue) { var WordToHexValue="",WordToHexValue_temp="",lByte,lCount; for (lCount = 0;lCount<=3;lCount++) { lByte = (lValue>>>(lCount*8)) & 255; WordToHexValue_temp = "0" + lByte.toString(16); WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2); } return WordToHexValue; }; function Utf8Encode(string) { string = string.replace(/\r\n/g,"\n"); var utftext = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { utftext += String.fromCharCode(c); } else if((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; }; var x=Array(); var k,AA,BB,CC,DD,a,b,c,d; var S11=7, S12=12, S13=17, S14=22; var S21=5, S22=9 , S23=14, S24=20; var S31=4, S32=11, S33=16, S34=23; var S41=6, S42=10, S43=15, S44=21; string = Utf8Encode(string); x = ConvertToWordArray(string); a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476; for (k=0;k 26) return null; return abc.charAt(num - 1); } if (typeof n !== 'number' || n < 1 || n > 26) return null; return abc.charAt(n - 1); } function padWithZero(str) { if (str.length === 2) return str; return str.toString().padStart(2, '0'); } /* Sütikezelés */ function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = "expires="+ d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; } function getCookie(cname) { var name = cname + "="; var decodedCookie = decodeURIComponent(document.cookie); var ca = decodedCookie.split(';'); for(var i = 0; i 0) && window.matchMedia("(max-width: 768px)").matches ); } var iscookie = getCookie("iscookie"); if (iscookie != "") { } else { var elementExists = document.getElementById("kjokmjnoi"); if (elementExists != null) { document.getElementById('kjokmjnoi').style.visibility='visible'; style = "font-family: sans-serif; background-color: #2196F3; padding: 20px; color: white; opacity: 1; transition: opacity 0.6s; margin-bottom: 15px;"; stylebtn = "font-family: sans-serif; margin-left: 15px; color: white; font-weight: bold; float: right; font-size: 22px; line-height: 20px; cursor: pointer; transition: 0.3s;"; alert = "
×Info! Az oldal mĹąkĂśdĂŠsĂŠhez szĂźksĂŠgesek a cookie-k! Az oldal hasznĂĄlatĂĄval elfogadja ezt!
"; var posts_div=document.getElementById('kjokmjnoi'); posts_div.innerHTML = alert; setCookie("iscookie", "true", 365); setTimeout(() => { window.scrollTo(0, 0); }, 10); } } var close = document.getElementsByClassName("closebtn"); var i; for (i = 0; i < close.length; i++) { close[i].onclick = function(){ var div = this.parentElement; div.style.opacity = "0"; setTimeout(function(){ div.style.display = "none"; }, 600); } } /* Window Funkció */ const win = document.getElementById("win"); const wintitle = document.getElementById("wintitle"); const winapp = document.getElementById("winapp"); const winloading = document.getElementById("winloading"); function openwin() { win.classList.remove("closed"); } function closewin() { win.classList.add("closed"); } function fullscrn(isfull = null) { if (isfull == null) { if(document.getElementById("fullscrnbtn").classList.contains("close")) { win.classList.remove("fullscrn"); document.getElementById("fullscrnbtn").classList.remove("close"); } else { win.classList.add("fullscrn"); document.getElementById("fullscrnbtn").classList.add("close"); } } else if (isfull) { win.classList.add("fullscrn"); document.getElementById("fullscrnbtn").classList.add("close"); } else { win.classList.remove("fullscrn"); document.getElementById("fullscrnbtn").classList.remove("close"); } } function Loading(isloading = true) { if (isloading) { document.getElementById("winloading").classList.remove("hidden"); document.getElementById("loadingBG").classList.add("active") } else { document.getElementById("winloading").classList.add("hidden") document.getElementById("loadingBG").classList.remove("active") } } /* Alert funkciók */ function GenerateID(length = 8) { const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; let randomId = ''; for (let i = 0; i < length; i++) { const randomIndex = Math.floor(Math.random() * characters.length); randomId += characters[randomIndex]; } return randomId; } function GenerateAlerts(type, message, disappearing = true) { const errorElements = document.querySelectorAll('#errorDIV'); let spanstyle = "'none'"; errorElements.forEach(function(element) { const randomId = type + GenerateID(16); let alertHtml = ''; if (type == "error") { alertHtml = '
×Hiba! '+message+'
'; } else if (type == "success") { alertHtml = '
×Siker! '+message+'
'; } else if (type == "info") { alertHtml = '
×Info! '+message+'
'; } else if (type == "warning") { alertHtml = '
×Figyelem! '+message+'
'; } element.innerHTML += alertHtml; if (disappearing) { setTimeout(() => { const alertElement = document.getElementById(randomId); if (alertElement) { alertElement.remove(); } }, 10000); } }); } /* Név korrektálás */ function adjustFontSize() { const container = document.getElementById("userNameDiv"); const text = document.getElementById("userNameP"); let fontSize = 16; text.style.fontSize = "16px"; while (text.scrollHeight > container.clientHeight || text.scrollWidth > container.clientWidth) { fontSize--; text.style.fontSize = fontSize + "px"; if (fontSize <= 8) { break; } } } if (document.getElementById("userNameP") !== null && document.getElementById("userNameDiv") !== null) { window.onload = adjustFontSize; window.onresize = adjustFontSize; } /* LogOut timer és vissza LogIn */ let reLogInPopup; function ReLogIn() { reLogInPopup = window.open(window.location.origin + '?noredirect=1', 'Belépés', 'width=860,height=860'); } function ReLogInClose() { try { reLogInPopup.location.href = window.location.origin + '/managers/template/loggedin.html'; reLogInPopup.close(); } catch (e) { console.error('Close error:', e.message); } reLogInPopup = null; } if (document.getElementById("TimeBeforeLogOutSpan") !== null) { const timerSpan = document.getElementById('TimeBeforeLogOutSpan'); var theAlertedSessionEnd = null; const update = () => { const authTimer = getCookie('auth_timer'); if (!authTimer || isNaN(authTimer)) { return; } const expiry = parseInt(authTimer) * 1000; const now = Date.now(); const remaining = Math.max(0, Math.floor((expiry - now) / 1000)); if (remaining <= 0) { timerSpan.textContent = 'Lejárt munkamenet'; timerSpan.style.opacity = '1'; timerSpan.style.right = '210px'; timerSpan.style.color = 'red'; if (theAlertedSessionEnd == null) { const html = `

Az ön munkamenete lejárt!
Kérjük, jelentkezzen be újra!


`; theAlertedSessionEnd = CreateAlertBox('Lejárt munkamenet', html, false); } return; } if (theAlertedSessionEnd != null) { CloseAlertBox(theAlertedSessionEnd); theAlertedSessionEnd = null; } if (reLogInPopup != null && !reLogInPopup.closed) { ReLogInClose(); } const minutes = Math.floor(remaining / 60); const seconds = remaining % 60; timerSpan.textContent = `${minutes}:${seconds.toString().padStart(2, '0')}`; timerSpan.style.opacity = '0.4'; timerSpan.style.right = '10px'; timerSpan.style.color = 'var(--panelcolor)'; }; update(); setInterval(update, 1000); } /* Feedback Státusz */ function FeedbackButtonStatus(status = "loading", id) { var FeedbackButton = document.getElementById(id); if (status == "loading") { FeedbackButton.disabled = true; FeedbackButton.classList.add('loading'); } else if (status == "complete") { FeedbackButton.classList.add('complete'); setTimeout(() => { FeedbackButton.classList.remove("loading"); FeedbackButton.classList.remove("complete"); FeedbackButton.disabled = false; }, 6000); } else { FeedbackButton.classList.add('failed'); setTimeout(() => { FeedbackButton.classList.remove("loading"); FeedbackButton.classList.remove("failed"); FeedbackButton.disabled = false; }, 6000); } } /* Typing szimuláció */ var TypingMax = 0; var isSimulateTyping = false; function getRandomNumber(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min;} function SimulateTypingProtector(text, elementId) { if (isSimulateTyping) { setTimeout(function() { SimulateTyping(text, elementId); }, TypingMax); } else { SimulateTyping(text, elementId); } } function SimulateTyping(text, elementId) { var element = document.getElementById(elementId); var delaymin = 20; var delaymax = 40; var index = 0; TypingMax = text.length * delaymax; isSimulateTyping = true; var timer = setInterval(function() { if (index < text.length) { var char = text.charAt(index); element.innerHTML += char; index++; } else { clearInterval(timer); isSimulateTyping = false; } }, getRandomNumber(delaymin, delaymax)); } /* Kanban board */ if (document.querySelector('.kanban-board') !== null) { document.addEventListener('DOMContentLoaded', () => { const board = document.querySelector('.kanban-board'); let isDown = false; let startX; let scrollLeft; board.addEventListener('mousedown', (e) => { isDown = true; board.classList.add('active'); startX = e.pageX - board.offsetLeft; scrollLeft = board.scrollLeft; }); board.addEventListener('mouseleave', () => { isDown = false; board.classList.remove('active'); }); board.addEventListener('mouseup', () => { isDown = false; board.classList.remove('active'); }); board.addEventListener('mousemove', (e) => { if (!isDown) return; e.preventDefault(); const x = e.pageX - board.offsetLeft; const walk = (x - startX) * 1.5; board.scrollLeft = scrollLeft - walk; }); }); } /* AlertBox */ function CreateAlertBox(title, html, closeable = true) { // Overlay létrehozása const overlay = document.createElement('div'); overlay.className = 'alert-overlay'; overlay.style.cssText = ` position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(3px); display: flex; justify-content: center; align-items: center; z-index: ${1000 + document.querySelectorAll('.alert-overlay').length}; `; // AlertBox div létrehozása const alertBox = document.createElement('div'); alertBox.className = 'alert-box'; alertBox.style.cssText = ` width: 25%; min-width: 300px; max-width: 600px; max-height: 600px; background: var(--toppanel); border-radius: 4px; box-shadow: 1 5px 10px #aaaaaa; position: relative; overflow: hidden; display: flex; flex-direction: column; `; // Header létrehozása const header = document.createElement('div'); header.style.cssText = ` padding: 8px 20px; border-bottom: 1px solid #bdc3c7; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; background-color: var(--panelcolor); `; // Title h2 elem const titleElement = document.createElement('h2'); titleElement.textContent = title; titleElement.style.cssText = ` margin: 0; font-size: 18px; color: #f5f5f5; `; header.appendChild(titleElement); // Close gomb ha closeable if (closeable) { const closeButton = document.createElement('button'); closeButton.innerHTML = '×'; closeButton.style.cssText = ` background: none; border: none; font-size: 24px; color: #f5f5f5; cursor: pointer; padding: 0; margin: 0; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: background-color 0.2s; `; closeButton.onmouseover = () => closeButton.style.backgroundColor = '#f0f0f0'; closeButton.onmouseout = () => closeButton.style.backgroundColor = 'transparent'; closeButton.onclick = () => CloseAlertBox(overlay); header.appendChild(closeButton); } // Content terület const content = document.createElement('div'); content.innerHTML = html; content.style.cssText = ` padding: 0px 20px 20px 20px; overflow-y: auto; flex-grow: 1; text-align: justify; `; // Összeállítás alertBox.appendChild(header); alertBox.appendChild(content); overlay.appendChild(alertBox); // DOM-hoz hozzáadás document.body.appendChild(overlay); // Animáció overlay.style.opacity = '0'; alertBox.style.transform = 'scale(0.8)'; requestAnimationFrame(() => { overlay.style.transition = 'opacity 0.3s ease'; alertBox.style.transition = 'transform 0.3s ease'; overlay.style.opacity = '1'; alertBox.style.transform = 'scale(1)'; }); return overlay; } function CloseAlertBox(overlay) { if (!overlay) return; overlay.style.transition = 'opacity 0.3s ease'; overlay.querySelector('.alert-box').style.transition = 'transform 0.3s ease'; overlay.style.opacity = '0'; overlay.querySelector('.alert-box').style.transform = 'scale(0.8)'; setTimeout(() => { if (overlay.parentNode) { overlay.parentNode.removeChild(overlay); } }, 300); }