{"size": 7808, "ext": "js", "max_stars_repo_path": "leaf-drop/js/min/leaf-drop.view.min.js", "max_stars_repo_name": "encorelab/hampshire-apps", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "leaf-drop/js/min/leaf-drop.view.min.js", "max_issues_repo_name": "encorelab/hampshire-apps", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "leaf-drop/js/min/leaf-drop.view.min.js", "max_forks_repo_name": "encorelab/hampshire-apps", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 7808.0, "max_line_length": 7808, "alphanum_fraction": 0.7484631148}
(function(){"use strict";var e=this.Skeletor||{};this.Skeletor.Mobile=this.Skeletor.Mobile||{};var t=this.Skeletor.Mobile,a=this.Skeletor.Model;e.Model=a,t.View={},t.View.CollectView=Backbone.View.extend({view:this,initialize:function(){var e=this;console.log("Initializing CollectView...",e.el)},events:{"click #new-observation":"startNewObservation","click .next-btn":"moveForward","click .back-btn":"moveBack","click .wiki-link":"openModal","click .leaf-fallen-btn":"buttonSelected"},onModelSaved:function(){t.currentObservation.set("modified_at",new Date)},buttonSelected:function(e){jQuery(".btn-select").removeClass("btn-select"),jQuery(e.target).addClass("btn-select")},startNewObservation:function(){var e=this;t.currentObservation=new a.LeafDropObservation,t.currentObservation.wake(t.config.wakeful.url),t.currentObservation.save(),e.collection.add(t.currentObservation),jQuery("#title-page").addClass("hidden"),jQuery("#variable-content-container").removeClass("hidden"),jQuery(".back-btn").removeClass("hidden"),jQuery(".next-btn").removeClass("hidden"),e.populatePage(1)},moveForward:function(){var e=this;e.determineTargetPage("next")},moveBack:function(){var e=this;e.determineTargetPage("prev")},determineTargetPage:function(e){var t=this,a=Number(t.getPageNum());"next"===e?(a+=1,t.handleSpecialPagesNext(a)):"prev"===e?(a-=1,t.handleSpecialPagesBack(a)):console.error("ERROR: unexpected direction")},handleSpecialPagesBack:function(e){var t=this;2===e?0===t.getNumCompletedLeaves()?t.populatePage(2):(t.popLastLeaf(),t.populatePage(3)):3===e?(t.popLastLeaf(),t.populatePage(3)):5===e?(t.popLastLeaf(),t.populatePage(3)):t.populatePage(e)},handleSpecialPagesNext:function(e){var a=this,r=a.getNumCompletedLeaves()+1,n=t.currentObservation.get("leaves"),i=jQuery('.current-page [type="radio"]:checked');4===e?jQuery(i).is("#id-leaf-fallen-yes")?(n[r-1]={leaf_num:r,fallen:"yes"},t.currentObservation.set("leaves",n),t.currentObservation.save(),6===a.getNumCompletedLeaves()?a.populatePage(6):a.populatePage(3)):jQuery(i).is("#id-leaf-fallen-no")?(t.currentObservation.get("leaves")[r-1]={leaf_num:r,fallen:"no"},a.populatePage(e)):jQuery().toastmessage("showErrorToast","Please select whether this leaf has fallen"):6===e?5===a.getNumCompletedLeaves()?a.populatePage(6):a.populatePage(3):8===e?(jQuery("#title-page").removeClass("hidden"),jQuery("#variable-content-container").addClass("hidden"),jQuery(".back-btn").addClass("hidden"),jQuery(".next-btn").addClass("hidden")):jQuery('.current-page [type="radio"]').length>0?i.length>0?a.populatePage(e):jQuery().toastmessage("showErrorToast","Please make a selection"):a.populatePage(e)},updateJSONObject:function(){_.each(jQuery(".current-page .input-field"),function(e){("text"===e.type||"textarea"===e.type||"number"===e.type)&&(jQuery(".current-page").hasClass("leaf-cycle")&&t.currentObservation.get("leaves")[t.currentObservation.get("leaves").length-1]?t.currentObservation.get("leaves")[t.currentObservation.get("leaves").length-1][jQuery(e).data().fieldName]=jQuery(e).val():t.currentObservation.set(jQuery(e).data().fieldName,jQuery(e).val()))});var e=jQuery('.current-page [type="radio"]:checked');e.length>0&&(jQuery(".current-page").hasClass("leaf-cycle")?t.currentObservation.get("leaves")[t.currentObservation.get("leaves").length-1][e.data().fieldName]=jQuery(e).val():t.currentObservation.set(e.data().fieldName,jQuery(e).val())),t.currentObservation.save()},updateProgressBar:function(){var e=this;jQuery(".current-page .leaf-progress-img").addClass("unfinished-leaf-progress"),jQuery(".current-page .leaf-progress-img").each(function(t,a){t<e.getNumCompletedLeaves()+1&&jQuery(a).removeClass("unfinished-leaf-progress")})},getNumCompletedLeaves:function(){var e=0;return _.each(t.currentObservation.get("leaves"),function(t){("yes"===t.fallen||null!==t.percent_colored)&&e++}),e},popLastLeaf:function(){var e=t.currentObservation.get("leaves");e=_.without(e,_.last(e)),t.currentObservation.set("leaves",e),t.currentObservation.save()},removePageClasses:function(){jQuery(".leaf-page").addClass("hidden"),jQuery(".leaf-page").removeClass("current-page")},clearPageContent:function(){jQuery(".current-page .input-field").text(""),jQuery(".current-page .input-field").prop("checked",!1),jQuery(".leaf-measurement-input").val(""),jQuery(".current-page .btn-select").removeClass("btn-select")},populatePage:function(e){var a=this;a.updateJSONObject(),a.removePageClasses(),1===e?jQuery(".back-btn").addClass("hidden"):jQuery(".back-btn").removeClass("hidden"),7===e?(jQuery(".page-title").text("Review Data"),jQuery(".next-btn").text("Finish"),t.reviewDataView.render()):(jQuery(".page-title").text("New Observation"),jQuery(".next-btn").text("Next"));var r="leaf-";r+=e,jQuery("#"+r).removeClass("hidden"),jQuery("#"+r).addClass("current-page"),a.clearPageContent(),a.updateProgressBar()},getPageNum:function(){var e=jQuery(".current-page").attr("id"),t=0;return e&&(t=e.substr(5,e.length-5)),t},openModal:function(e){e.preventDefault();var t=jQuery(e.target).parent().attr("href");jQuery(".modal-body").html('<iframe width="100%" height="500px" frameborder="0" scrolling="yes" allowtransparency="true" src="'+t+'"></iframe>')},render:function(){console.log("Rendering CollectView...")}}),t.View.TreeSpeciesView=Backbone.View.extend({template:"#tree-species-list-template",initialize:function(){var e=this;console.log("Initializing TreeSpeciesView...",e.el),e.render()},events:{},render:function(){var e=this;console.log("Rendering TreeSpeciesView...");var t=jQuery("#tree-species-list");_.each(e.collection,function(a){var r=_.template(jQuery(e.template).text(),{common_name:a.common_name,latin_name:a.latin_name,wikipedia_url:a.wikipedia_url});t.append(r)})}}),t.View.ReviewDataView=Backbone.View.extend({template:"#review-data-list-template",initialize:function(){var e=this;console.log("Initializing ReviewDataView...",e.el)},events:{},render:function(){var e=this;jQuery("#review-data-list").html(""),console.log("Rendering ReviewDataView..."),jQuery(".tree-number-field").text(t.currentObservation.get("tree_number")),jQuery(".branch-letter-field").text(t.currentObservation.get("branch_letter")),jQuery(".tree-species-field").text(t.currentObservation.get("tree_species")),jQuery(".percent-colored-tree-field").text(t.currentObservation.get("percent_colored_tree")),jQuery(".field-notes-field").text(t.currentObservation.get("additional_notes"));var a=jQuery("#review-data-list");_.each(t.currentObservation.get("leaves"),function(t){var r=null;r="yes"===t.fallen?_.template(jQuery(e.template).text(),{leaf_num:t.leaf_num,leaf_length:"fallen",leaf_width:"fallen",percent_colored:"fallen"}):_.template(jQuery(e.template).text(),{leaf_num:t.leaf_num,leaf_length:t.leaf_length+" cm",leaf_width:t.leaf_width+" cm",percent_colored:t.percent_colored}),null!==r?a.append(r):console.error("KABOOM! review-data-view issue")})}}),t.View.WeatherView=Backbone.View.extend({view:this,initialize:function(){var e=this;console.log("Initializing WeatherView...",e.el),e.render()},events:{},render:function(){console.log("Rendering WeatherView..."),jQuery(".weather-image").attr("src",t.weatherConditions.icon_url),jQuery(".temp-f").text(t.weatherConditions.temp_f),jQuery(".weather-string").text(t.weatherConditions.weather),jQuery(".wind-mph").text(t.weatherConditions.wind_mph),jQuery(".wind-dir").text(t.weatherConditions.wind_dir),jQuery(".humidity").text(t.weatherConditions.relative_humidity),jQuery(".precipitation").text(t.weatherConditions.precip_today_string),jQuery(".uv").text(t.weatherConditions.UV)}}),t.View.MapView=Backbone.View.extend({view:this,initialize:function(){var e=this;console.log("Initializing MapView...",e.el)},events:{},render:function(){console.log("Rendering MapView...")}}),this.Skeletor=e}).call(this);