import $ from "jquery"; $(window).ready( () => { $("#member-count").on( "keypress", event => { if (event.key === "Enter") { $("#calculate").click(); } } ) $("#calculate").on( "click", event => { const memberCount = Number($("#member-count").val()); if (isNaN(memberCount) || memberCount === 0) { alert("Prosím, zadej skutečný počet členů."); return; } const hundredth = Math.ceil(memberCount / 100); const fifth = Math.ceil(memberCount / 5); const twoSquareRoots = Math.ceil(2 * Math.sqrt(memberCount)); $("#hundredth").html(hundredth); $("#tenth").html(Math.ceil(memberCount / 10)); $("#fifth").html(fifth); $("#two-square-roots").html(twoSquareRoots); const motionStart = Math.max( Math.min(fifth, twoSquareRoots), hundredth ); const motion = Math.ceil(motionStart / 2); $("#member-motion,#ongoing-motion").html(motion); $("#motion-start").html(motionStart); } ); } )