Skip to content

Instantly share code, notes, and snippets.

@palexander
Created September 7, 2011 23:55
Show Gist options
  • Save palexander/1202209 to your computer and use it in GitHub Desktop.
Save palexander/1202209 to your computer and use it in GitHub Desktop.
// This is broken
function refreshOntList() {
jQuery("#ontology_ontologyId").trigger("liszt:updated");
jQuery("#ontology_ontologyId").trigger("change");
}
var select_groups = {
init: function() {
jQuery("#select_groups").bind("click", function(e){bp_popup_init(e)});
jQuery(".select_group_link").bind("click", function(e){select_groups.selectGroup(e)});
this.cleanup();
},
cleanup: function() {
jQuery("html").click(bp_popup_cleanup);
jQuery(document).keyup(function(e) {
if (e.keyCode == 27) { bp_popup_cleanup(); } // esc
});
},
selectGroup: function(e) {
e.preventDefault();
e.stopPropagation();
bp_popup_cleanup();
}
}
// Filters ontology list
(function (jQuery) {
// custom css expression for a case-insensitive contains()
jQuery.expr[':'].Contains = function(a,i,m){
return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0;
};
function listFilter(input, list) { // header is any element, list is an unordered list
jQuery(input)
.change( function () {
var filter = jQuery(this).val();
if(filter) {
// this finds all links in a list that contain the input,
// and hide the ones not containing the input while showing the ones that do
jQuery(list).find("td:not(:Contains(" + filter + "))").closest("tr").hide();
jQuery(list).find("td:Contains(" + filter + ")").closest("tr").show();
jQuery("#select_all_filtered_row").show();
} else {
jQuery(list).find("tr").show();
}
return false;
})
.keyup( function () {
// fire the above change event after every letter
jQuery(this).change();
});
}
//ondomready
jQuery(function () {
listFilter(jQuery("#advanced_filter_input"), jQuery("#ont_list"));
});
}(jQuery));
// This works
var select_groups = {
init: function() {
jQuery("#select_groups").bind("click", function(e){bp_popup_init(e)});
jQuery(".select_group_link").bind("click", function(e){select_groups.selectGroup(e)});
this.cleanup();
},
cleanup: function() {
jQuery("html").click(bp_popup_cleanup);
jQuery(document).keyup(function(e) {
if (e.keyCode == 27) { bp_popup_cleanup(); } // esc
});
},
selectGroup: function(e) {
e.preventDefault();
e.stopPropagation();
bp_popup_cleanup();
}
}
function refreshOntList() {
jQuery("#ontology_ontologyId").trigger("liszt:updated");
jQuery("#ontology_ontologyId").trigger("change");
}
// Filters ontology list
(function (jQuery) {
// custom css expression for a case-insensitive contains()
jQuery.expr[':'].Contains = function(a,i,m){
return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0;
};
function listFilter(input, list) { // header is any element, list is an unordered list
jQuery(input)
.change( function () {
var filter = jQuery(this).val();
if(filter) {
// this finds all links in a list that contain the input,
// and hide the ones not containing the input while showing the ones that do
jQuery(list).find("td:not(:Contains(" + filter + "))").closest("tr").hide();
jQuery(list).find("td:Contains(" + filter + ")").closest("tr").show();
jQuery("#select_all_filtered_row").show();
} else {
jQuery(list).find("tr").show();
}
return false;
})
.keyup( function () {
// fire the above change event after every letter
jQuery(this).change();
});
}
//ondomready
jQuery(function () {
listFilter(jQuery("#advanced_filter_input"), jQuery("#ont_list"));
});
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment