Giter VIP home page Giter VIP logo

webidx's Introduction

webidx

webidx is a client-side search engine for static websites.

It works by using a simple Perl script (webidx.pl) to generate an SQLite database containing an index of static HTML files. The SQLite database is then published alongside the static content.

The search functionality is implemented in webidx.js which uses sql.js to provide an interface to the SQLite file.

You can see a live demo of it here.

How to use it

  1. use webidx.pl to generate the index:
$ /path/to/webidx.pl -x index.html -x archives.html --xP secret_files -o https://example.com -z . ./index.db

You can run webidx.pl --help to see all the available command-line options.

  1. Include sql.js, pako and webidx.js in your web page:
<script src="https://cdnjs.cloudflare.com/ajax/libs/sql.js/1.10.1/sql-wasm.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pako/2.1.0/pako.min.js"></script>
<script src="/path/to/webidx.js"></script>
  1. Create a search form:
<form onsubmit="window.webidx.search({dbfile:'/webidx.db.gz',query:document.getElementById('q').value});return false;">
  <input id="q" type="search">
</form>

When the user hits the return key in the search box, a modal dialog will pop up containing search results!

The object that's passed to window.webidx.search() can have the following properties:

  • dbfile: URL of the SQLite database file
  • query: search query
  • resultCallback: a callback which is passed an array of search results. Each result is an object with the title and url properties. If not defined, a modal dialog will be displayed.
  • errorCallback: a callback which is passed any error string as an argument.
  • titleSuffix: a string to be removed from the end of page titles.
  • titlePrefix: a string to be removed from the beginning of page titles.

webidx's People

Contributors

gbxyz avatar gdog2u avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

gdog2u

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.