text: /*! minnpost-gettysburg-address - v0.0.0 - 2013-11-18
  * https://github.com/minnpost/minnpost-gettysburg-address
  * Copyright (c) 2013 MinnPost; Licensed  */
  
  define("helpers",["jquery","underscore","Backbone"],function(a,b,c){return{formatNumber:function(a,c){c=b.isUndefined(c)?2:c;var d=/(\d+)(\d{3})/;for(split=a.toFixed(c).toString().split(".");d.test(split[0]);)split[0]=split[0].replace(d,"$1,$2");return c?split[0]+"."+split[1]:split[0]},formatCurrency:function(a){return"$"+b.formatNumber(a,2)},formatPercent:function(a){return b.formatNumber(100*a,1)+"%"},formatPercentChange:function(a){return(a>0?"+":"")+b.formatPercent(a)},hash:function(a){return Math.abs(b.reduce(a.split(""),function(a,b){return a=(a<<5)-a+b.charCodeAt(0),a&a},0))},isMSIE:function(){var a=/(msie) ([\w.]+)/i.exec(navigator.userAgent);return a?parseInt(a[2],10):!1},BackboneAJAX:function(){var a=arguments;return a[0].dataTypeForce!==!0&&(a[0].dataType="jsonp",a[0].jsonpCallback="mpServerSideCachingHelper"+b.hash(a[0].url)),c.$.ajax.apply(c.$,a)},jsonpRequest:function(){var c=arguments[0];return c.dataType="jsonp",c.jsonpCallback="mpServerSideCachingHelper"+b.hash(c.url),a.ajax.apply(a,[c])},getLocalData:function(c){var d=this,e=this.options.jsonpProxy,f=!1,g=[];return this.data=this.data||{},c=b.isArray(c)?c:[c],this.options&&0===this.options.dataPath.indexOf("http")&&(f=!0),b.each(c,function(c){var h;b.isUndefined(d.data[c])&&(h=f?this.jsonpRequest({url:e+encodeURI(d.options.dataPath+c+".json")}):a.getJSON(d.options.dataPath+c+".json"),a.when(h).done(function(a){d.data[c]=a}),g.push(h))}),a.when.apply(a,g)},getRemoteData:function(b){return b.dataType="jsonp",this.options.remoteProxy&&(b.url=b.url+"&callback=proxied_jqjsp",b.url=app.options.remoteProxy+encodeURIComponent(b.url),b.callback="proxied_jqjsp",b.cache=!0),a.ajax(b)}}}),define("models",["underscore","Backbone","helpers"],function(a,b,c){var d={};return b.ajax=c.BackboneAJAX,d.Base=b.Model.extend({initialize:function(a,b){this.options=b||{},this.app=b.app}}),d.Word=b.Model.extend({initialize:function(b){d.Word.__super__.initialize.apply(this,arguments),b.options.push(b.word),b.options=a.sample(b.options,b.options.length),this.set("options",b.options),this.grade(),this.on("change:answer",this.grade)},grade:function(){this.set("correct",!1),this.get("answer")===this.get("word")&&this.set("correct",!0)}}),d}),define("collections",["underscore","Backbone","helpers","models"],function(a,b,c,d){var e={};return b.ajax=c.BackboneAJAX,e.Base=b.Collection.extend({initialize:function(a,b){this.options=b||{},this.app=b.app}}),e.Words=e.Base.extend({model:d.Word,initialize:function(){e.Words.__super__.initialize.apply(this,arguments)}}),e}),define("views",["jquery","underscore","Ractive","easydropdown","helpers"],function(a,b,c){var d={};return d.Base=c.extend({baseInit:function(a){this.router=a.router,this.app=this.router.app,this.on("clearStorage",function(a){a.original.preventDefault(),this.app.clearStorage()})}}),d.Application=d.Base.extend({init:function(){var c=this;this.baseInit.apply(this,arguments),this.observe("words",function(){var a=this.get("words"),c={};this.set("wordCount",b.size(a)),this.set("correctCount",b.reduce(a,function(a,b){return a+(b.get("correct")?1:0)},0)),b.each(a,function(a){c[a.id]=a.get("answer")}),this.app.setStorage(c)}),a(this.el).find("select").easyDropDown({onChange:function(b){c.set("words."+a(this).data("wordId")+".answer",b.value)}}),a(this.el).find("select option").each(function(){$option=a(this),$option.parent().parent().parent().find("ul li").each(function(){$li=a(this),$li.html()===$option.html()&&$li.addClass($option.attr("class"))})}),this.on("showCorrect",function(c){c.original.preventDefault(),a(this.el).find(".correctness-action").slideUp(),a(this.el).find(".correctness-score").slideDown(),b.each(this.data.words,function(a){a.set("graded",!0)})})}}),d}),define("text!templates/application.mustache",[],function(){return'<div class="message-container"></div>\n\n<div class="content-container">\n\n  <div class="address-text">\n    <p>Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in <span class="word" id="liberty">{{#words.liberty}}{{>word}}{{/words.liberty}}</span>, and dedicated to the <span class="word" id="proposition">{{#words.proposition}}{{>word}}{{/words.proposition}}</span> that all men are created equal.</p>\n\n    <p>Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great <span class="word" id="battlefield">{{#words.battlefield}}{{>word}}{{/words.battlefield}}</span> of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that <span class="word" id="nation">{{#words.nation}}{{>word}}{{/words.nation}}</span> might live. It is altogether fitting and <span class="word" id="proper">{{#words.proper}}{{>word}}{{/words.proper}}</span> that we should do this.</p>\n\n    <p>But, in a larger sense, we can not dedicate &mdash; we can not <span class="word" id="consecrate">{{#words.consecrate}}{{>word}}{{/words.consecrate}}</span> &mdash; we can not hallow &mdash; this <span class="word" id="ground">{{#words.ground}}{{>word}}{{/words.ground}}</span>. The brave men, living and dead, who <span class="word" id="struggled">{{#words.struggled}}{{>word}}{{/words.struggled}}</span> here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the <span class="word" id="unfinished">{{#words.unfinished}}{{>word}}{{/words.unfinished}}</span> work which they who fought here have thus far so nobly <span class="word" id="advanced">{{#words.advanced}}{{>word}}{{/words.advanced}}</span>.</p>\n\n    <p>It is rather for us to be here dedicated to the great <span class="word" id="task">{{#words.task}}{{>word}}{{/words.task}}</span> remaining before us &mdash; that from these honored dead we take increased <span class="word" id="devotion">{{#words.devotion}}{{>word}}{{/words.devotion}}</span> to that cause for which they gave the last full measure of devotion &mdash; that we here highly resolve that these dead shall not have died in vain &mdash; that this nation, under God, shall have a new birth of <span class="word" id="freedom">{{#words.freedom}}{{>word}}{{/words.freedom}}</span> &mdash; and that <span class="word" id="government">{{#words.government}}{{>word}}{{/words.government}}</span> of the people, by the people, for the people, shall not <span class="word" id="perish">{{#words.perish}}{{>word}}{{/words.perish}}</span> from the earth.</p>\n  </div>\n\n  <div class="correctness correctness-action">\n    <a href="#" on-tap="showCorrect">Show score</a>.\n  </div>\n\n  <div class="correctness correctness-score">\n    {{ correctCount }} of {{ wordCount }} correct.\n  </div>\n\n</div>\n\n<div class="footnote-container">\n  <div class="footnote">\n    <p>The text of the speech is from the "Collected Works of Abraham Lincoln", edited by Roy P. Basler, republished via  <a href="http://www.abrahamlincolnonline.org/lincoln/speeches/gettysburg.htm" target="_blank">abrahamlincolnonline.org</a>.  Some code, techniques, and data on <a href="https://github.com/zzolo/minnpost-elections-dashboard" target="_blank">Github</a>.</p>\n\n    {{#storage}}\n      <p>Some data is stored locally on your computer\'s web browser for this application.  For privacy or other reasons, you can <a on-tap="clearStorage" href="#" class="storage-clear">clear the locally stored data</a>.</p>\n    {{/storage}}\n  </div>\n</div>\n'}),define("text!templates/loading.mustache",[],function(){return'<div class="loading-container">\n  <div class="loading"><span>Loading...</span></div>\n</div>'}),define("text!templates/word.mustache",[],function(){return'<span class="{{#graded}}graded{{/graded}} {{#(typeof correct != \'undefined\' && correct)}}correct{{/()}}{{#(typeof correct != \'undefined\' && !correct)}}incorrect{{/()}}">\n  <select value="{{ .answer }}" data-word-id="{{ id }}" class="dropdown">\n    <option class="label" selected disabled>&nbsp;</option>\n    {{#options:i}}\n      <option class="{{#(. == word)}}correct-answer{{/()}}" value="{{.}}">{{.}}</option>\n    {{/options}}\n  </select>\n</span>\n'}),define("routers",["underscore","Backbone","Ractive","Ractive-Backbone","helpers","models","collections","views","text!templates/application.mustache","text!templates/loading.mustache","text!templates/word.mustache"],function(a,b,c,d,e,f,g,h,i,j,k){var l={};return l.Router=b.Router.extend({views:{},collections:{},models:{},data:{},initialize:function(b){var c=this;this.options=b,this.app=b.app,this.data.words={},a.each(b.words,function(a){c.data.words[a.id]=new f.Word(a)}),this.views.application=new h.Application({el:this.app.$el,template:i,data:{words:this.data.words,storage:this.app.store.enabled},router:this,partials:{loading:j,word:k},adaptors:["Backbone"]})},routes:{addressQuiz:"routeAddressQuiz","*default":"routeDefault"},start:function(){b.history.start()},routeDefault:function(){this.navigate("/addressQuiz",{trigger:!0,replace:!0})},routeAddressQuiz:function(){}}),l}),define("minnpost-gettysburg-address",["underscore","store","helpers","routers"],function(a,b,c,d){var e=[{id:"liberty",word:"Liberty",options:["Truth","Freedom","Equality"]},{id:"proposition",word:"proposition",options:["mission","fact","ideal"]},{id:"battlefield",word:"battlefield",options:["landscape","trial","challenge"]},{id:"nation",word:"nation",options:["country","notion","truth"]},{id:"proper",word:"proper",options:["necessary","good","essential"]},{id:"consecrate",word:"consecrate",options:["preserve","commemorate","anoint"]},{id:"ground",word:"ground",options:["battlefield","sacrifice","war"]},{id:"struggled",word:"struggled",options:["fought","sacrificed","triumphed"]},{id:"unfinished",word:"unfinished",options:["tireless","unending","monumental"]},{id:"advanced",word:"advanced",options:["proceeded","strengthened","aided"]},{id:"task",word:"task",options:["battle","work","trial"]},{id:"devotion",word:"devotion",options:["fervor","commitment","ardor"]},{id:"freedom",word:"freedom",options:["liberty","equality","sovereignity"]},{id:"government",word:"government",options:["hopes","institution","nation"]},{id:"perish",word:"perish",options:["vanish","fade","wither"]}],f=function(a){this.options=a,this.el=this.options.el,this.el&&(this.$el=$(this.el))};return a.extend(f.prototype,c),a.extend(f.prototype,{store:b,setStorage:function(a){return b.set("minnpost-gettysburg-address",a)},getStorage:function(){return b.get("minnpost-gettysburg-address")},clearStorage:function(){b.remove("minnpost-gettysburg-address")}}),f.prototype.start=function(){var b;this.store.enabled=!1,this.store.enabled&&(b=this.getStorage(),e=a.map(e,function(a){return b&&b[a.id]&&(a.answer=b[a.id]),a})),this.router=new d.Router({app:this,words:e}),this.router.start()},f});