Sha256: 1d0dd76ca106ed836ee1c2af7cd246751523dc8233cb155351aff34633800b86

Contents?: true

Size: 834 Bytes

Versions: 4

Compression:

Stored size: 834 Bytes

Contents

function hasWordInElement(word, element) {       
    if(element.nodeType == Node.TEXT_NODE)                   
        return element.nodeValue.match(word) != null;
    else 
        return $A(element.childNodes).any(
            function (child) { 
                return hasWordInElement(word, child); 
            });
}
var searchingOn = ""
function observeTagSearch(element, value) {
	if(value.length < 3 && searchingOn != "")
	{
		searchingOn = "";
		divs = $$("div.tag-description");
		$A(divs).each(function(div){ Element.show(div); });
	}
	else if(value.length >= 3 && searchingOn != value)
	{
		searchingOn = value
    	divs = $$("div.tag-description");
		$A(divs).each(function (div){
			if(hasWordInElement(value, div))
				Element.show(div);						
			else
				Element.hide(div);
		});
	}
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
radiant-0.6.0 public/javascripts/tag_reference_search.js
radiant-0.6.1 public/javascripts/tag_reference_search.js
radiant-0.6.2 public/javascripts/tag_reference_search.js
radiant-0.6.3 public/javascripts/tag_reference_search.js