Giter Site home page Giter Site logo

context-search's Introduction

context-search

Highlights search terms.

Descends to the text nodes and highlight the found words there. Can be used to hide not matching elements as well, filtering the table by setting appropiate css.

Exports only one interface to instantiate it:

function (list, term)

  • list is the element which has sub items to be filtered and highlighted.
  • term is the search term, based on which the list will be filtered

The only other requirement is that the sub elements to be filtered have the class context-search--item. Only elements below these will be filtered/highlighted.

Uses the following classes:

  • .context-search--filtered: is set on the main list element when there at least one match
  • .context-search--item: is expected on the items which will be searched
  • .context-search--match: is set on those .context-search--item which have a match.
  • .context-search--highlight: is the class used for the span-Elements which surround found elements.

Example css:

.context-search--filtered .context-search--item {
	display: none;
}
.context-search--item.context-search--match {
	display: table-row; // in this example a table is filtered
}
.context-search--highlight {
	background-color: yellow;
	box-shadow: 0 0 1px 1px yellow;
}

context-search's People

Contributors

d0b1010r avatar

Watchers

 avatar

Forkers

kallko

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.