MediaWiki:Gadget-calc-cooking.js: Difference between revisions
From Idle Clans wiki
(Created page with "$(function () { var CLAN_HOUSES = ["Tent", "Barn", "Windmill", "House", "Manor", "Castle"]; var PERSONAL_HOUSES = ["Cardboard box", "Tent", "Van Down by the River", "Small cabin", "House"]; var SKILL_CAPE = ["None", "Tier 1", "Tier 2", "Tier 3", "Tier 4"]; var ENCHANTMENTS = ["None", "Common", "Rare", "Exceptional"]; var utils = idleClans.util; var data = idleClans.data; function addDropdown($element, $dropdown, title, alignment) { alignment = alignment || "le...") |
No edit summary |
||
Line 17: | Line 17: | ||
function addHeader($element, title) { | function addHeader($element, title) { | ||
$element.append("<div class='calc-header'>" + title + "</div>"); | $element.append("<div class='calc-header'>" + title + "</div>"); | ||
} | |||
function addResultEntry($element, label, $result) { | |||
var $entry = $("<div class='calc-result-entry'></div>"); | |||
$entry.append($("<div class='label'><span>" + label + "</span></div>"), $result); | |||
var $value = $("<div class='value'></div>"); | |||
$value.append($result); | |||
$entry.append($value); | |||
$element.append($entry); | |||
} | |||
function addResultSpacer($element) { | |||
$element.append("<div class='calc-result-spacer'></div>"); | |||
} | |||
function getDropdownValue($dropdown) { | |||
return $dropdown.getMenu().findSelectedItem().getData(); | |||
} | } |
Revision as of 19:20, 10 June 2024
$(function () { var CLAN_HOUSES = ["Tent", "Barn", "Windmill", "House", "Manor", "Castle"]; var PERSONAL_HOUSES = ["Cardboard box", "Tent", "Van Down by the River", "Small cabin", "House"]; var SKILL_CAPE = ["None", "Tier 1", "Tier 2", "Tier 3", "Tier 4"]; var ENCHANTMENTS = ["None", "Common", "Rare", "Exceptional"]; var utils = idleClans.util; var data = idleClans.data; function addDropdown($element, $dropdown, title, alignment) { alignment = alignment || "left"; $element.append("<div class='calc-label-" + alignment + "'>" + title + "</div>"); $element.append($dropdown.$element); } function addHeader($element, title) { $element.append("<div class='calc-header'>" + title + "</div>"); } function addResultEntry($element, label, $result) { var $entry = $("<div class='calc-result-entry'></div>"); $entry.append($("<div class='label'><span>" + label + "</span></div>"), $result); var $value = $("<div class='value'></div>"); $value.append($result); $entry.append($value); $element.append($entry); } function addResultSpacer($element) { $element.append("<div class='calc-result-spacer'></div>"); } function getDropdownValue($dropdown) { return $dropdown.getMenu().findSelectedItem().getData(); }