GithubHelp home page GithubHelp logo

risatrix / cyoa Goto Github PK

View Code? Open in Web Editor NEW

This project forked from motherjones/cyoa

0.0 1.0 0.0 235 KB

A "Choose Your Own Adventure" plugin for storytelling

License: GNU General Public License v2.0

JavaScript 100.00%

cyoa's Introduction

MJ CYOA

A responsive fork of the "Choose Your Own Adventure" plugin for interactive storytelling, from the apps team at Mother Jones.

See it in action!

The internets loved our first implementation of this container (trigger warning: cute kittens within).

Here's an implementation where the user walks through what it would take to overturn the landmark Citizen United campaign finance decision.

Mother Jones' reporters made this implementation all by themselves, with almost zero help from our interactives team: it's a little game showing Mitt Romney's stance on immigration over time.

Getting Started

Download the production version or the development version.

In your web page:

<script src="jquery.js"></script>
<script src="dist/cyoa.min.js"></script>
<link href="../css/cyoa.css" rel="stylesheet" />
<script>
jQuery(function($) {
        $.cyoa({
            start : {  // default start page, if you want to call it something different, you have to set it in the options
                img: 'http://www.url/img.png',
                connects: [ 
                    { 'link' : 'page_2',
                      'html' : 'Some text here'
                    }, {
                      'link' : 'death_by_water',
                      'html' : 'The hanged man'
                    }, {
                      'link' : 'foobarbaz',
                      'html' : 'variables'
                    }
                ]
            },
            page_2 : {
                html: '<h1>Arbitrary html goes here !!! WhoooO!!!',
                connects: [
                    { 'link' : 'death_by_water',
                      'html' : 'I hate fortune tellers'
                    }
                ]
            },
            death_by_water : {
                img: 'http://wasteland.org/fear.jpg',
                select_img: 'http://placekitten.com/100/100' //optional
            }
        },
        {
            container: 'id of html element which holds the story',
            start_page : 'optional, the key of the story page you start on, defaults to "start"'
        }
); // makes a wasteland story
        });
</script>

Alternately, you can use tabletop to connect to google spreadsheet and automatically write the JSON needed to power the CYOA.

<script src="jquery.js"></script>
<script src="dist/cyoa.min.js"></script>
<script src="tabletop.js"></script>
<script>
    jQuery(function($) {
        $.cyoa(
            'the key to your published google spreadsheet',
            { separator: '|' }
        );
    });
</script>

Column headers for your google spreadsheet must be slug, text, connects to, connects text, title, background image, The connects to should be a | separated list of slugs which you want the page to connect to. The connets text should be a | separated list of what you want the connectors to read. If you like, you can designate a different character as the separator. Note that the order of the connects to and connects text must match.

Release History

This is the first release!

License

Copyright (c) 2012 Ben Breedlove
Licensed under the MIT, GPL licenses.

Contributing (this is all totally optional)

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

Important notes

Please don't edit files in the dist subdirectory as they are generated via grunt. You'll find source code in the src subdirectory!

While grunt can run the included unit tests via PhantomJS, this shouldn't be considered a substitute for the real thing. Please be sure to test the test/*.html unit test file(s) in actual browsers.

Installing grunt

This assumes you have node.js and npm installed already.

  1. Test that grunt is installed globally by running grunt --version at the command-line.
  2. If grunt isn't installed globally, run npm install -g grunt to install the latest version. You may need to run sudo npm install -g grunt.
  3. From the root directory of this project, run npm install to install the project's dependencies.

Installing PhantomJS

In order for the qunit task to work properly, PhantomJS must be installed and in the system PATH (if you can run "phantomjs" at the command line, this task should work).

Unfortunately, PhantomJS cannot be installed automatically via npm or grunt, so you need to install it yourself. There are a number of ways to install PhantomJS.

Note that the phantomjs executable needs to be in the system PATH for grunt to see it.

cyoa's People

Contributors

benbreedlove avatar jaeahlee 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.