initial commit
This commit is contained in:
commit
186a860385
8199 changed files with 1159811 additions and 0 deletions
86
modules/faq/jcfilter.min.js
vendored
Normal file
86
modules/faq/jcfilter.min.js
vendored
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
function recursiveReplace(d, a, e, c) {
|
||||
jQuery(d).contents().each(function _repl( _, node ) {
|
||||
if( node.nodeType === 3 )
|
||||
$(this).replaceWith(function(){
|
||||
return this.nodeValue.replace(new RegExp(e, c), function(b) {
|
||||
return "<span class='hilight' style='background:" + a.highlightColor + ";color:" + a.textColorForHighlights + "'>" + b + "</span>"
|
||||
})
|
||||
});
|
||||
else recursiveReplace(node, a, e, c);
|
||||
});
|
||||
}
|
||||
|
||||
jQuery.fn.jcOnPageFilter = function(a) {
|
||||
a = jQuery.extend({
|
||||
animateHideNShow: false,
|
||||
focusOnLoad: false,
|
||||
highlightColor: "yellow",
|
||||
textColorForHighlights: "#000000",
|
||||
caseSensitive: false,
|
||||
hideNegatives: false,
|
||||
parentLookupClass: "jcorgFilterTextParent",
|
||||
childBlockClass: "jcorgFilterTextChild"
|
||||
}, a);
|
||||
jQuery.expr[":"].icontains = function(a, b, c) {
|
||||
return jQuery(a).text().toUpperCase().indexOf(c[3].toUpperCase()) >= 0
|
||||
};
|
||||
if (a.focusOnLoad) {
|
||||
jQuery(this).focus()
|
||||
}
|
||||
var b = /(<span.+?>)(.+?)(<\/span>)/g;
|
||||
var c = "g";
|
||||
if (!a.caseSensitive) {
|
||||
b = /(<span.+?>)(.+?)(<\/span>)/gi;
|
||||
c = "gi"
|
||||
}
|
||||
jQuery(this).parent().append(' <i id="count" >0</i>')
|
||||
return this.each(function() {
|
||||
jQuery(this).keyup(function(d) {
|
||||
if (d.which && d.which == 13 || d.keyCode && d.keyCode == 13) {
|
||||
return false
|
||||
} else {
|
||||
var e = jQuery(this).val();
|
||||
if (e.length > 0) {
|
||||
if (a.hideNegatives) {
|
||||
if (a.animateHideNShow) {
|
||||
jQuery("." + a.parentLookupClass).stop(true, true).fadeOut("slow")
|
||||
} else {
|
||||
jQuery("." + a.parentLookupClass).stop(true, true).hide()
|
||||
}
|
||||
}
|
||||
var f = "icontains";
|
||||
if (a.caseSensitive) {
|
||||
f = "contains"
|
||||
}
|
||||
jQuery.each(jQuery("." + a.childBlockClass), function(a, c) {
|
||||
jQuery(c).html(jQuery(c).html().replace(new RegExp(b), "$2"))
|
||||
});
|
||||
jQuery.each(jQuery("." + a.childBlockClass + ":" + f + "(" + e + ")"), function(b, d) {
|
||||
if (a.hideNegatives) {
|
||||
if (a.animateHideNShow) {
|
||||
jQuery(d).parent().stop(true, true).fadeIn("slow")
|
||||
} else {
|
||||
jQuery(d).parent().stop(true, true).show()
|
||||
}
|
||||
}
|
||||
|
||||
recursiveReplace(d, a, e, c)
|
||||
});
|
||||
} else {
|
||||
jQuery.each(jQuery("." + a.childBlockClass), function(a, c) {
|
||||
var d = jQuery(c).html().replace(new RegExp(b), "$2");
|
||||
jQuery(c).html(d)
|
||||
});
|
||||
if (a.hideNegatives) {
|
||||
if (a.animateHideNShow) {
|
||||
jQuery("." + a.parentLookupClass).stop(true, true).fadeOut("slow")
|
||||
} else {
|
||||
jQuery("." + a.parentLookupClass).stop(true, true).hide()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
jQuery('#count').text($('.hilight').length)
|
||||
})
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue