1(function ($) { $.fn.conditionize = function (options) { var settings = $.extend({ hideJS: true }, options); $.fn.showOrHide = function (is_met, $section) { if (is_met) { $section.slideDown(100); $section.find("select, input").removeClass("disabled") } else { $section.slideUp(100, function () { $section.find("select, input").addClass("disabled") }) } }; return this.each(function () { var $section = $(this); var cond = $(this).data("condition"); var re = /(#?\w+)/ig; var match = re.exec(cond); var inputs = {}, e = "", name = ""; while (match !== null) { name = match[1]; e = (name.substring(0, 1) == "#" ? name : "[name=" + name + "]"); if ($(e).length && !(name in inputs)) { inputs[name] = e } match = re.exec(cond) } for (name in inputs) { e = inputs[name]; tmp_re = new RegExp("(" + name + ")\\b", "g"); if ($(e).attr("type") == "radio" || $(e).attr("type") == "checkbox") { cond = cond.replace(tmp_re, "$('" + e + ":checked').val()") } else { cond = cond.replace(tmp_re, "$('" + e + "').val()") } } for (name in inputs) { $(inputs[name]).on("change", function () { try { $.fn.showOrHide(eval(cond), $section) } catch (e) { console.log(e + ":" + cond) } }) } if (settings.hideJS) { $(this).hide() } try { $.fn.showOrHide(eval(cond), $section) } catch (e) { console.log(e + ":" + cond) } }) } }(jQuery)); 2 3$(document).ready(function () { 4 $('.conditional').conditionize(); 5});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.