/* Pi-hole: A black hole for Internet advertisements * (c) 2017 Pi-hole, LLC (https://pi-hole.net) * Network-wide ad blocking via your own hardware. * * This file is copyright under the latest version of the EUPL. * Please see LICENSE file for your rights under this license. */ /* global utils:false, groups:false, getGroups:false, updateFtlInfo:false, apiFailure:false, processGroupResult:false, delGroupItems:false */ /* exported initTable */ var table; var GETDict = {}; $(function () { GETDict = utils.parseQueryString(); // Tabs: Domain/Regex handling // sync description fields, reset inactive inputs on tab change $('a[data-toggle="tab"]').on("shown.bs.tab", function () { var tabHref = $(this).attr("href"); var val; if (tabHref === "#tab_domain") { val = $("#new_regex_comment").val(); $("#new_domain_comment").val(val); $("#new_regex").val(""); } else if (tabHref === "#tab_regex") { val = $("#new_domain_comment").val(); $("#new_regex_comment").val(val); $("#new_domain").val(""); $("#wildcard_checkbox").prop("checked", false); } clearTimeout(suggestTimeout); $("#suggest_domains").hide(); }); $("#add_deny, #add_allow").on("click", addDomain); // Domain suggestion handling var suggestTimeout; $("#new_domain").on("input", function (e) { hideSuggestDomains(); clearTimeout(suggestTimeout); suggestTimeout = setTimeout(showSuggestDomains, 1000, e.target.value); }); utils.setBsSelectDefaults(); getGroups(); }); // Show a list of suggested domains based on the user's input function showSuggestDomains(value) { function createButton(hostname) { // Purposefully omit 'btn' class to save space on padding return $('