GithubHelp home page GithubHelp logo

bostonglobe / 2016_primaries_smt Goto Github PK

View Code? Open in Web Editor NEW
1.0 4.0 0.0 277 KB

Boston Globe state-wide primary results table

License: MIT License

Makefile 0.18% JavaScript 53.56% HTML 21.97% CSS 24.29%

2016_primaries_smt's Introduction

2016-primaries-smt

This is a graphic that displays live state-wide primary results table on election night. It works at various widths starting at 171px:

tables

Producers

How to create a new table

We're going to create a table for the Iowa Democratic caucuses. Create a new .jpt with the following content, and modify accordingly.

<div class='story election-results-wrapper'>

	<!-- MODIFY: the id field in the following line-->
    <div id='bg-primaries-smt-caucuses-democratic-iowa' style='margin: 0;'></div>

    <!-- MODIFY: the url in the link-->
    <div class='see-all-election-results'><a href='https://apps.bostonglobe.com/election-results/2016/caucuses/democratic/iowa/'>See all results</a></div>

</div>

<style>
    .story.election-results-wrapper { position: relative; }
    .see-all-election-results { position: absolute; bottom: 0.5em; right: 0; font-family: Helvetica, Arial, sans-serif; font-size: 13px; }
    .see-all-election-results a { text-decoration: underline; }
</style>

<script src='https://apps.bostonglobe.com/common/js/pym/pym-0.4.5.min.js'></script>
<script>

    // MODIFY: these three variables
    var raceType  = 'caucuses';   // e.g. caucuses, primary
    var party     = 'democratic'; // e.g. democratic, republican
    var state     = 'iowa';       // e.g. new hampshire, alaska

    // MODIFY: make sure this is the same as the id field in the first line
    var uniqueId  = 'bg-primaries-smt-caucuses-democratic-iowa';

    var baseurl   = 'https://apps.bostonglobe.com/graphics/2016/02/state-results-small-table';
    var url       = [baseurl, '?raceType=', raceType, '&party=', party, '&state=', state].join('');
    var pymParent = new pym.Parent(uniqueId, url, {});
</script>

Note: make sure that the id field is unique in the page. In other words, make sure there are no other elements with that id or the graphic won't work.

Slot the .jpt in your article or section front and you're done.

Developers

Setup

  • npm i
  • `npm run prod'

2016_primaries_smt's People

Contributors

gabrielflorit avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

2016_primaries_smt's Issues

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.