MCPcopy Create free account
hub / github.com/caike/jQuery-Simple-Timer / getUrlConfigHtml

Function getUrlConfigHtml

tests/qunit-2.9.2.js:4669–4719  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4667 }
4668
4669 function getUrlConfigHtml() {
4670 var i,
4671 j,
4672 val,
4673 escaped,
4674 escapedTooltip,
4675 selection = false,
4676 urlConfig = config.urlConfig,
4677 urlConfigHtml = "";
4678
4679 for (i = 0; i < urlConfig.length; i++) {
4680
4681 // Options can be either strings or objects with nonempty "id" properties
4682 val = config.urlConfig[i];
4683 if (typeof val === "string") {
4684 val = {
4685 id: val,
4686 label: val
4687 };
4688 }
4689
4690 escaped = escapeText(val.id);
4691 escapedTooltip = escapeText(val.tooltip);
4692
4693 if (!val.value || typeof val.value === "string") {
4694 urlConfigHtml += "<label for='qunit-urlconfig-" + escaped + "' title='" + escapedTooltip + "'><input id='qunit-urlconfig-" + escaped + "' name='" + escaped + "' type='checkbox'" + (val.value ? " value='" + escapeText(val.value) + "'" : "") + (config[val.id] ? " checked='checked'" : "") + " title='" + escapedTooltip + "' />" + escapeText(val.label) + "</label>";
4695 } else {
4696 urlConfigHtml += "<label for='qunit-urlconfig-" + escaped + "' title='" + escapedTooltip + "'>" + val.label + ": </label><select id='qunit-urlconfig-" + escaped + "' name='" + escaped + "' title='" + escapedTooltip + "'><option></option>";
4697
4698 if (QUnit.is("array", val.value)) {
4699 for (j = 0; j < val.value.length; j++) {
4700 escaped = escapeText(val.value[j]);
4701 urlConfigHtml += "<option value='" + escaped + "'" + (config[val.id] === val.value[j] ? (selection = true) && " selected='selected'" : "") + ">" + escaped + "</option>";
4702 }
4703 } else {
4704 for (j in val.value) {
4705 if (hasOwn.call(val.value, j)) {
4706 urlConfigHtml += "<option value='" + escapeText(j) + "'" + (config[val.id] === j ? (selection = true) && " selected='selected'" : "") + ">" + escapeText(val.value[j]) + "</option>";
4707 }
4708 }
4709 }
4710 if (config[val.id] && !selection) {
4711 escaped = escapeText(config[val.id]);
4712 urlConfigHtml += "<option value='" + escaped + "' selected='selected' disabled='disabled'>" + escaped + "</option>";
4713 }
4714 urlConfigHtml += "</select>";
4715 }
4716 }
4717
4718 return urlConfigHtml;
4719 }
4720
4721 // Handle "click" events on toolbar checkboxes and "change" for select menus.
4722 // Updates the URL with the new state of `config.urlConfig` values.

Callers 1

Calls 1

escapeTextFunction · 0.85

Tested by

no test coverage detected