MediaWiki:Common.js: Difference between revisions
From Realera Wiki
No edit summary |
No edit summary |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
function submit_form() { | function submit_form() { | ||
level = document.getElementById("level").value | level = document.getElementById("level").value | ||
content = document.getElementById("expresults") | content = document.getElementById("expresults") | ||
content.innerHTML = ""; | content.innerHTML = ""; | ||
lower_range = Math. | lower_range = Math.ceil(level/1.5) | ||
upper_range = Math. | upper_range = Math.ceil(level*1.5) | ||
content.innerHTML = content.innerHTML + "A character with level <b>" + level +"</b> can share experience with levels <b>" + lower_range + "</b> to <b>" + upper_range +"</b><br>" | content.innerHTML = content.innerHTML + "A character with level <b>" + level +"</b> can share experience with levels <b>" + lower_range + "</b> to <b>" + upper_range +"</b><br>" | ||
} | } | ||
function submit_pr_form() { | function submit_pr_form() { | ||
victim_level = | victim_level = document.getElementById("victim_level").value | ||
killer_level = | killer_level = document.getElementById("killer_level").value | ||
percentage_diff = Math.round(((killer_level - victim_level) / killer_level) * 100) | percentage_diff = Math.round(((killer_level - victim_level) / killer_level) * 100) | ||
content = document.getElementById("lowlvlprotection") | content = document.getElementById("lowlvlprotection") | ||
content.innerHTML = "Percentage diff: " + percentage_diff | content.innerHTML = "Percentage diff: " + percentage_diff + "%" | ||
if (percentage_diff >= 60) { | |||
content.innerHTML = content.innerHTML + " (victim will be protected and killer will not get frag)" | |||
} else if (killer_level < 100 || victim_level > 60) { | |||
content.innerHTML = content.innerHTML + " (victim will die and killer will get frag)" | |||
} else { | |||
content.innerHTML = content.innerHTML + " (victim will be protected and killer will not get frag)" | |||
} | |||
} | } |
Latest revision as of 11:55, 10 April 2024
/* Any JavaScript here will be loaded for all users on every page load. */ function submit_form() { level = document.getElementById("level").value content = document.getElementById("expresults") content.innerHTML = ""; lower_range = Math.ceil(level/1.5) upper_range = Math.ceil(level*1.5) content.innerHTML = content.innerHTML + "A character with level <b>" + level +"</b> can share experience with levels <b>" + lower_range + "</b> to <b>" + upper_range +"</b><br>" } function submit_pr_form() { victim_level = document.getElementById("victim_level").value killer_level = document.getElementById("killer_level").value percentage_diff = Math.round(((killer_level - victim_level) / killer_level) * 100) content = document.getElementById("lowlvlprotection") content.innerHTML = "Percentage diff: " + percentage_diff + "%" if (percentage_diff >= 60) { content.innerHTML = content.innerHTML + " (victim will be protected and killer will not get frag)" } else if (killer_level < 100 || victim_level > 60) { content.innerHTML = content.innerHTML + " (victim will die and killer will get frag)" } else { content.innerHTML = content.innerHTML + " (victim will be protected and killer will not get frag)" } }