Zeile 1 | Zeile 1 |
---|
/** * Peeker controls the visibility of an element based on the value of an input *
|
/** * Peeker controls the visibility of an element based on the value of an input *
|
* @example * * var peeker = new Peeker($('#myController'), $('#myDomain'), /1/, false); * var peeker = new Peeker($('.myControllerNode'), $('#myDomain'), /1/, true);
| * Examples: * new Peeker($('#myController'), $('#myDomain'), 1, false); * new Peeker($('.myControllerNode'), $('#myDomain, #myDomain2'), 1, true); * new Peeker($('#myController'), $('#nestedPeeker'), /works/, false); * new Peeker($('#nestedPeeker'), $('#nestedPeekerChild'), /\d+/, false);
|
*/
var Peeker = (function() {
| */
var Peeker = (function() {
|
Zeile 37 | Zeile 38 |
---|
// attach event handlers to the inputs in the node list this.controller.each(function(i, el) { el = $(el);
|
// attach event handlers to the inputs in the node list this.controller.each(function(i, el) { el = $(el);
|
if (el.attr('id') == null) { return; }
| |
el.on('change', fn); el.click(fn);
|
el.on('change', fn); el.click(fn);
|
});
| });
|
} else { this.controller.on('change', fn); }
| } else { this.controller.on('change', fn); }
|
Zeile 59 | Zeile 57 |
---|
if (this.isNodelist) { this.controller.each(function(i, el) {
|
if (this.isNodelist) { this.controller.each(function(i, el) {
|
if (el.checked &&
| if ($(el).is(':visible') && el.checked &&
|
el.value.match(regex)) { show = true; return false;
| el.value.match(regex)) { show = true; return false;
|
Zeile 68 | Zeile 66 |
---|
this.domain[show ? 'show' : 'hide'](); } else { type = this.controller.val() || '';
|
this.domain[show ? 'show' : 'hide'](); } else { type = this.controller.val() || '';
|
this.domain[(type.match(regex)) ? 'show' : 'hide']();
| this.domain[(type.match(regex) && this.controller.is(':visible')) ? 'show' : 'hide']();
|
}
|
}
|
| $(this.domain).each(function() { $(this).find('input, textarea, select').each(function() { $(this).trigger('change'); }); });
|
}
Peeker.prototype = {
| }
Peeker.prototype = {
|
Zeile 88 | Zeile 92 |
---|
* @param string ID of the row */ function add_star(id) {
|
* @param string ID of the row */ function add_star(id) {
|
if (!$('#' + id)) {
| if (!$('#' + id).length) {
|
return; }
| return; }
|