MediaWiki:Gadget-calc-cooking.js

From Idle Clans wiki
Revision as of 19:20, 10 June 2024 by Uraxys (talk | contribs)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
$(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();
	}