This is a book search application that uses the CampusBooks API for searching and price comparison.
It is designed in such a way that you should be able to just drop it in to your existing site without much configuration.
The build script runs using Node.js.
- Install Node.js and NPM.
- From the command line
cd build
- Install the required dependencies
npm install
- Build it
node build.js
There will now be a dist
directory in the root of the project. There are full and minimized versions of both the CSS and JS files.
To use in your page simply include the relevant CSS and JS files, as well as the jQuery library, and run:
BookSearch.init({container:'#bookSearchJS', apiKey:'#######'});
where container can be a CSS selector or a DOMNode object.
The only other requirement is the container must be positioned. So if you are only using width
and height
to define its size, just add position:relative
to its CSS style, otherwise the app will fill the entire browser window.
You can use the index.html
file in the dist
directory as an example.
There aren't many configuration options, but I intend to add more in the future.
All options are set as properties to the object that is passed in to the init method.
container
CSS selector or DOMNodeapiKey
your campus books api key
bookImageSmall
int value of small book image max width and heightbookImageLarge
int value of large book image max width and height
In the future I'll try and make the CSS file easier to modify things like colors and sizes. Most colors are defined at the top as variables, but if you want to make further modifications you'll have to dig deeper.