diff --git a/script-min.js b/script-min.js index 29a3292..35e51e2 100644 --- a/script-min.js +++ b/script-min.js @@ -1 +1 @@ -async function copyToClipboard(t){text=document.getElementById(t).textContent;try{await navigator.clipboard.writeText(text),showTooltip("Copied",document.getElementById(t))}catch(t){}}function getAdvice(){document.getElementById("bet-result").classList.remove("hidden")}function getNumbers(){let t=range(1,37),e=range(1,7),n=[];for(let o=0;o<6;o++){const o=randInt(0,t.length),s=t.splice(o,1)[0];n.push(s),ot+o*n))}function randInt(t,e){return diff=e-t,diff<=0?t:t+Math.floor(Math.random()*diff)}function showTooltip(t,e){const n=parseFloat(getComputedStyle(document.documentElement).fontSize),o=document.getElementById("tooltip");o.textContent=t,o.style.opacity="1",o.style.pointerEvents="auto";const s=e.getBoundingClientRect(),c=window.scrollX+s.right-o.getBoundingClientRect().width,l=s.bottom+window.scrollY+n;o.style.top=`${l}px`,o.style.left=`${c}px`,setTimeout((()=>{o.style.opacity="0",o.style.pointerEvents="none"}),1e3)}function translate(t,e){const n="zxcvbnm,./asdfghjkl;'qwertyuiop[]",o="זסבהנמצתץ.שדגכעיחלךף,/'קראטוןםפ][";let s=n,c=o;"en"===e&&(s=o,c=n);let l="";for(const e in t){const n=s.search(t[e].toLowerCase());l=-1===n?l.concat(t[e]):l.concat(c[n])}return l}function getTranslation(){const t=document.querySelectorAll("#lang-choices input");let e="";for(const n of t)n.checked&&(e=n.value);const n=document.getElementById("input-message").value,o=document.getElementById("output-message");""===e&&(e=findTargetLang(n)),o.textContent=translate(n,e),copyToClipboard("output-message")}function findTargetLang(t){const e="zxcvbnm,./asdfghjkl;'qwertyuiop[]",n="זסבהנמצתץ.שדגכעיחלךף,/'קראטוןםפ][";let o=0,s=0;for(const c in t){let l=e.search(t[c].toLowerCase());-1!=l&&s++,l=n.search(t[c].toLowerCase()),-1!=l&&o++}return o{"Enter"===t.key&&getTranslation()})); \ No newline at end of file +async function copyToClipboard(t){text=document.getElementById(t).textContent;try{await navigator.clipboard.writeText(text),showTooltip("Copied",document.getElementById(t))}catch(t){}}function getAdvice(){document.getElementById("bet-result").classList.remove("hidden")}function compareNums(t,e){return t-e}function getNumbers(){let t=range(1,37),e=range(1,7),n=[];for(let o=0;o<6;o++){const o=randInt(0,t.length),s=t.splice(o,1)[0];n.push(s),ot+o*n))}function randInt(t,e){return diff=e-t,diff<=0?t:t+Math.floor(Math.random()*diff)}function showTooltip(t,e){const n=parseFloat(getComputedStyle(document.documentElement).fontSize),o=document.getElementById("tooltip");o.textContent=t,o.style.opacity="1",o.style.pointerEvents="auto";const s=e.getBoundingClientRect(),c=window.scrollX+s.right-o.getBoundingClientRect().width,r=s.bottom+window.scrollY+n;o.style.top=`${r}px`,o.style.left=`${c}px`,setTimeout((()=>{o.style.opacity="0",o.style.pointerEvents="none"}),1e3)}function translate(t,e){const n="zxcvbnm,./asdfghjkl;'qwertyuiop[]",o="זסבהנמצתץ.שדגכעיחלךף,/'קראטוןםפ][";let s=n,c=o;"en"===e&&(s=o,c=n);let r="";for(const e in t){const n=s.search(t[e].toLowerCase());r=-1===n?r.concat(t[e]):r.concat(c[n])}return r}function getTranslation(){const t=document.querySelectorAll("#lang-choices input");let e="";for(const n of t)n.checked&&(e=n.value);const n=document.getElementById("input-message").value,o=document.getElementById("output-message");""===e&&(e=findTargetLang(n)),o.textContent=translate(n,e),copyToClipboard("output-message")}function findTargetLang(t){const e="zxcvbnm,./asdfghjkl;'qwertyuiop[]",n="זסבהנמצתץ.שדגכעיחלךף,/'קראטוןםפ][";let o=0,s=0;for(const c in t){let r=e.search(t[c].toLowerCase());-1!=r&&s++,r=n.search(t[c].toLowerCase()),-1!=r&&o++}return o{"Enter"===t.key&&getTranslation()})); \ No newline at end of file diff --git a/script.js b/script.js index 6000224..7120c98 100644 --- a/script.js +++ b/script.js @@ -21,6 +21,10 @@ function getAdvice() { advice.classList.remove('hidden'); } +function compareNums(a, b) { + return a - b; +} + function getNumbers() { let options = range(1, 37); let strongOptions = range(1, 7); @@ -33,6 +37,7 @@ function getNumbers() { strongOptions.splice(index, 1); } } + choice.sort(compareNums); const index = randInt(0, strongOptions.length); const strong = strongOptions.splice(index, 1)[0];