Quotes from popular movies and TV shows.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore add quotes and build file May 22, 2017
LICENSE Initial commit May 22, 2017
README.md fix tab character in README Jul 5, 2017
build.js add standalone flag to quotes Jul 7, 2017
package.json v2.0.0 Jul 9, 2017
quotes.txt add more standalone quotes Jul 9, 2017

README.md

quote-roulette

npm-package

yarn install quote-roulette
npm install quote-roulette

A whole npm package dedicated to Hollywood quotes?

Surely you can't be serious.
I am serious... and don't call me Shirley.

How to Contribute

Fork this repo. Add a line to the end of quotes.txt and make a pull request.

Each line in quotes.txt should contain the IMDb title ID, a tab character, and the quote:

tt0304141	I solemnly swear that I am up to no good.

Browse imdb.com for quote transcripts and title IDs.

Format

quotes.json has the following structure:

{
    "quotes": []
}

Where quotes is an array of objects:

{
    "imdbID": "tt0304141",
    "quote": "I solemnly swear that I am up to no good.",
    "scooptvURL": "https://scooptv.io/title/tt0304141/",
    "imdbURL": "http://www.imdb.com/title/tt0304141/"
}

How to Use

jQuery

Put quotes.json somewhere on your server.

<div id="quote-roulette"></div
var quoteRoulette = $('#quote-roulette');
var allQuotes = null;

$.getJSON('/quotes.json', function(data) {
  allQuotes = data.quotes;
  updateQuote();
});

quoteRoulette.click(function(e) {
  e.preventDefault();

  updateQuote();
});

function updateQuote(obj) {
  var index = getRandomInt(0, allQuotes.length);

  quoteRoulette.text(allQuotes[index].quote);
}

// returns an integer, min <= integer < max
function getRandomInt(min, max) {
  min = Math.ceil(min);
  max = Math.floor(max);

  return Math.floor(Math.random() * (max - min)) + min;
}