text: var app;var deps=["ionic","app.controllers","app.routes","app.services","app.directives","LocalStorageModule"];try{app=angular.module("app",deps)}catch(e){alert("failed")}app.run(function($ionicPlatform){$ionicPlatform.ready(function(){if(window.cordova&&window.cordova.plugins.Keyboard){cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true)}if(window.StatusBar){StatusBar.styleDefault()}})});function searchInText(text,searchTerm,snippetPad,res,page){if(text&&_.isString(text)){var index=text.toLowerCase().search(searchTerm.toLowerCase());if(index>=0){var snippet=".."+text.substring(index-snippetPad,index+searchTerm.length+snippetPad)+"..";res.push({page:page.title,snippet:snippet,index:index})}}}function handleSection(section,searchTerm,snippetPad,res,page){switch(section.type){case"paragraph":case"html":searchInText(section.content,searchTerm,snippetPad,res,page);break;case"bullet list":case"ordered list":if(section.content){_.forEach(section.content,function(item){searchInText(item,searchTerm,snippetPad,res,page)})}break;case"list":if(section.content){_.forEach(section.content,function(item){searchInText(item.text,searchTerm,snippetPad,res,page)})}break;case"card":if(section.content){_.forEach(section.content.sections,function(cardSection){handleSection(cardSection,searchTerm,snippetPad,res,page)})}}}angular.module("app.controllers",[]).controller("tableOfContentsCtrl",function($scope,pagesData){$scope.init=function(){$scope.data=pagesData.data;$scope.tocPages=function(){return _.filter($scope.data.pages,function(page){return page.showInToc!=false&&!page.type})}}}).controller("pageCtrl",function($scope,pagesData,$stateParams,$state){$scope.page=_.find(pagesData.data.pages,function(pages){ga("send","pageview",$stateParams.title);return pages.title==window.decodeURIComponent($stateParams.title)});if($stateParams.searchText){$scope.searchText=$stateParams.searchText}$scope.goHome=function(){$state.go("intro")}}).controller("searchCtrl",function($scope,pagesData,$state){ga("send","pageview","Search");$scope.data=pagesData.data.pages;$scope.searchResults=[];$scope.searchData={searchText:""};$scope.search=function(){var res=[];var searchTerm=$scope.searchData.searchText;var snippetPad=20;_.forEach($scope.data,function(page){_.forEach(page.content.sections,function(section){handleSection(section,searchTerm,snippetPad,res,page)})});$scope.searchResults=res;return false};$scope.goHome=function(){$state.go("intro")}}).controller("introCtrl",function($scope){});angular.module("app.directives",[]).directive("frcParagraph",[function(){return{restrict:"E",scope:{section:"=",highlight:"="},templateUrl:"templates/paragraph.html"}}]).directive("frcCard",[function(){return{restrict:"E",scope:{section:"=",highlight:"="},templateUrl:"templates/card.html"}}]).directive("frcBullets",[function(){return{restrict:"E",scope:{section:"=",highlight:"="},templateUrl:"templates/bulletList.html"}}]).directive("frcNumbers",[function(){return{restrict:"E",scope:{section:"=",highlight:"="},templateUrl:"templates/orderedList.html"}}]).directive("frcList",[function(){return{restrict:"E",scope:{section:"=",highlight:"="},templateUrl:"templates/list.html"}}]).directive("frcImage",[function(){return{restrict:"E",scope:{section:"="},templateUrl:"templates/image.html"}}]).directive("frcChecklist",[function(){return{restrict:"E",scope:{section:"="},controller:["$scope","localStorageService",function($scope,localStorageService){$scope.getRadios=function(section){return _.filter(section.itemOptions,function(item){return item.type=="radio"})};$scope.getTextInputs=function(section){return _.filter(section.itemOptions,function(item){return item.type=="text"})};$scope.initChecklist=function(){$scope.question={text:[],choice:[]}};$scope.questionTextChange=function(questionKey){localStorageService.set("text"+questionKey,$scope.question.text[questionKey])};$scope.radioChange=function(radioKey){localStorageService.set("radio"+radioKey,$scope.question.choice[radioKey])};$scope.initQuestionText=function(questionKey){$scope.question.text[questionKey]=localStorageService.get("text"+questionKey)};$scope.initRadio=function(radioKey){$scope.question.choice[radioKey]=localStorageService.get("radio"+radioKey)}}],templateUrl:"templates/checklist.html"}}]).directive("frcHtml",function(){return{restrict:"E",scope:{section:"=",highlight:"="},templateUrl:"templates/htmlSection.html"}});function getData(DataService,$rootScope){if($rootScope.data)return{data:$rootScope.data};else{return DataService.getData().success(function(data){$rootScope.data=data}).error(function(){alert("failed reading data")})}}angular.module("app.routes",[]).config(function($stateProvider,$urlRouterProvider){$stateProvider.state("intro",{url:"/intro",templateUrl:"templates/intro.html",controller:"introCtrl"}).state("page",{url:"/page/{title}",templateUrl:"templates/page.html",controller:"pageCtrl",resolve:{pagesData:getData}}).state("pageSearch",{url:"/page/{title}/{searchText}",templateUrl:"templates/page.html",controller:"pageCtrl",resolve:{pagesData:getData}}).state("search",{url:"/search",templateUrl:"templates/search.html",controller:"searchCtrl",resolve:{pagesData:getData}}).state("tableOfContents",{url:"/toc",templateUrl:"templates/tableOfContents.html",controller:"tableOfContentsCtrl",resolve:{pagesData:getData}});$urlRouterProvider.otherwise("/intro")});angular.module("app.services",[]).factory("DataService",["$http","$q",function DataService($http){var service={data:{},getData:getData};return service;function getData(){return $http.get("/data.json").success(function(data){service.data=data})}}]).filter("escape",function(){return window.encodeURIComponent}).filter("highlight",function($sce){return function(input,searchText){if(searchText){return $sce.trustAsHtml(input.replace(new RegExp(searchText,"gi"),'<span class="highlightedText">$&</span>'))}else{return input}}});
  