Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 12 additions & 29 deletions jquery.facets.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,35 +54,18 @@
plugin.data("settings",settings);

//bind each input to the appropriate bind type
plugin.find(":input").each(function(){

//find out if we should not bind to this input
var excludeBindTypes = plugin.data('settings').excludeBindTypes;
var shouldBind = true;
for(var k = 0; k < excludeBindTypes.length; k++) {
if($(this).is(excludeBindTypes[k])) {
shouldBind = false;
break;
}
}

if(!shouldBind)
return true;

//use default bindType
var bindType = plugin.data('settings').bindType;

//see if this input has a special bindType
var bindTypes = plugin.data('settings').bindTypes;
for(var k = 0; k < bindTypes.length; k++) {
if($(this).is(bindTypes[k]['selector'])) {
bindType = bindTypes[k]['bindType'];
break; //will get first bindType of selector it matches
}
}

$(this).bind(bindType, {'plugin': plugin}, methods.ajaxReq);
});
var excludeBindTypes = plugin.data('settings').excludeBindTypes;
var bindTypes = plugin.data('settings').bindTypes;
var excludedBindTypesList = excludeBindTypes;
for(var k=0; k < bindTypes.length; k++) {
// add this selector to the default's exclude
excludedBindTypesList.push(bindTypes[k]['selector']);

// Also bind to the selector on the particular type
plugin.on(bindTypes[k]['bindType'], bindTypes[k]['selector'], {'plugin' : plugin}, methods.ajaxReq);
}
var bindTypeList = ':input:not(' + excludedBindTypesList.join(', ') + ')';
plugin.on(plugin.data('settings').bindType, bindTypeList, {'plugin': plugin}, methods.ajaxReq);

if(plugin.data('settings').hash)
methods.hashInit.apply(plugin);
Expand Down