Giter Club home page Giter Club logo

holmes's Introduction

Holmes.js

Fast and easy searching inside a page.

Build Status npm version Bower version Join the chat at https://gitter.im/Haroenv/holmes

Installation

You can install holmes with either npm or bower under the package name holmes.js. For npm that looks like this:

$ npm install --save holmes.js

After which you can add it in your page with i.e. browserify or loading the module in a different script tag.

You have to make sure that you have a css rule for the class .hidden that hides elements however you want. One option is to have this:

.hidden {
  display: none;
}

but this could be any css you want.

Usage

demo

Simple example

holmes({
  input: '.search input', // default: input[type=search]
  find: '.results div' // querySelectorAll that matches each of the results individually
})

All options

holmes({
  // queryselector for the input
  input: '.search input',
  // queryselector for element to search in
  find: '.results article',
  // (optional) text to show when no results
  placeholder: 'no results',
  class: {
    // (optional) class to add to matched elements
    visible: 'visible',
    // (optional) class to add to non-matched elements
    hidden: 'hidden'
  },
  // (optional) if true, this will refresh the content every search
  dynamic: false,
  // (optional) needs to be true if the input is a contenteditable field instead of a
  contenteditable: false,
  // (optional) in case you don't want to wait for DOMContentLoaded before starting Holmes:
  instant: true
});

full documentation

Showcase

What who image
bullg.it @haroenv screenshot of bullg.it
family.scss @lukyvj screenshot of family.scss

I'd love to find out how people use my project, let me know if you want to be featured!

Questions?

Compatible up to IE9.

Let me know on twitter: @haroenv.

Contributing

Contributions are always welcome! Here are some loose guidelines:

  • use feature branches
  • don't make it slower
  • explain why you want a feature
  • npm run doc to recreate the documentation

But I don't bite, if you have any questions or insecurities, hit me up for example on gitter.

License

Apache 2.0

holmes's People

Contributors

gitter-badger avatar haroenv avatar lukyvj avatar marcobiedermann avatar twin avatar

Watchers

 avatar

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.