1var eddata; 2(function (eddata) { 3 var election; 4 (function (election) { 5 class Data extends eddata.packery.Section { 6 constructor(config) { 7 super(config); 8 this.containerDivs = []; 9 this.idsByDate = []; 10 this.idsByType = []; 11 this.idsByResults = []; 12 switch (config.sectionType) { 13 case eddata.SectionType.ELECTION_CARDS: 14 this.loadCards(); 15 break; 16 case eddata.SectionType.ELECTION: 17 this.loadSummary(config.packeryContainerId); 18 break; 19 } 20 } 21 loadCards() { 22 $.ajax({ 23 url: '/ElectionData/Cards/' + eddata_entityCds + '/1980/2099', 24 cache: true, 25 type: 'GET', 26 contentType: 'application/html; charset=utf-8', 27 dataType: "html", 28 timeout: 15000, 29 success: (data) => { 30 if ($(data).find(".no-data-message").length > 0) { 31 $("#election-data-tab").empty().append($(data).find(".no-data-message").show()); 32 } 33 else { 34 $(data).find(".card-container").each((idx, el) => { 35 this.containerDivs.push($(el)); 36 }); 37 this.idsByDate = this.orderedItemIdNumbers = $.parseJSON($(data).attr("data-date")); 38 this.idsByType = $.parseJSON($(data).attr("data-type")); 39 this.idsByResults = $.parseJSON($(data).attr("data-result")); 40 eddata.election.Data.shareDescriptionImage = $(data).attr("data-share-description-image"); 41 eddata.election.Data.shareDescription = $(data).attr("data-share-description"); 42 this.containerDivs.forEach((card) => { 43 card.find('.entity-name').html(eddata_entityName); 44 card.find("[data-toggle='tooltip']").tooltip(); 45 }); 46 this.displayCards(this.idsByDate); 47 var sectionNbr = eddata.SectionType.ELECTION_CARDS; 48 $(".elections-sort-btns input").click((ev) => { 49 $(".elections-sort-btns input").removeClass("selected"); 50 $(ev.target).addClass("selected"); 51 var header = $(".accordion-header[data-section-nbr='" + sectionNbr + "']"); 52 header.toggleClass('active-header').toggleClass('active-header'); 53 header.next().slideDown(); 54 switch ($(ev.target).val()) { 55 case "Date": 56 this.displayCards(this.idsByDate); 57 break; 58 case "Result": 59 this.displayCards(this.idsByResults); 60 break; 61 case "Type": 62 this.displayCards(this.idsByType); 63 break; 64 } 65 }); 66 } 67 if (this.config.complete && typeof this.config.complete === 'function') 68 this.config.complete(this); 69 }, 70 error: (xhr, status, error) => { 71 if (this.config.error && typeof this.config.error === 'function') 72 this.config.error(eddata.chartErrorType.NETWORK, status); 73 eddata.errorManager.notifyAndLog({ eventOrMessage: xhr.status + " " + error, source: "election.js", location: "load()" }); 74 $.notify("Sorry, there was a problem!"); 75 } 76 }); 77 } 78 loadSummary(packeryContainerId) { 79 this.initializeEddataChartEvents(); 80 for (var idx = 0; idx < this.orderedItemIdNumbers.length; idx++) { 81 new eddata.chart({ 82 type: this.orderedItemIdNumbers[idx], 83 yearStart: "0", 84 yearEnd: "0", 85 orderNbr: idx, 86 packeryContainerId: packeryContainerId, 87 sectionNbr: this.config.sectionType, 88 created: (chartObj) => { 89 if (chartObj.doesContainStateInfo()) 90 $_pac_f.setScrollToItem(chartObj.getDiv()); 91 } 92 }); 93 } 94 } 95 displayCards(ids) { 96 this.reinitializePackerySection(); 97 this.orderedItemIdNumbers = ids;
98 this.containerDivs.forEach((el) => { 99 $(this.getPackeryContainerId()).trigger('addedItem', [el[0]]); 100 setTimeout(() => { 101 new Card(el); 102 el.find(".bptpurpose p").readmore({ 103 maxHeight: 80, 104 bindToResizeEvent: false, 105 afterToggle: (trigger, el, exp) => { 106 this.adjustSize(el.parents(".card-container")); 107 } 108 }); 109 }, 50); 110 }); 111 } 112 packeryComplete() { 113 $(".card-container").matchHeight(false); 114 $(".card-container").each((idx, el) => { 115 if ($(el).is(":visible")) { 116 this.adjustSize($(el)); 117 } 118 }); 119 setTimeout(() => { 120 super.packeryComplete(); 121 }, 500); 122 } 123 adjustSize(el) { 124 el.find(".bptpurpose").css("height", "");
125 var cardHeight = el.innerHeight(); 126 var purposeHeight = el.find(".bptpurpose").innerHeight(); 127 var contentHeight = el.find(".bptcontent").innerHeight(); 128 var handleHeight = el.find(".chartHeader").innerHeight(); 129 var finalHeight = purposeHeight + cardHeight - contentHeight - handleHeight; 130 el.find(".bptpurpose").height(finalHeight); 131 } 132 } 133 election.Data = Data; 134 class Card { 135 constructor(containerDiv) { 136 this.containerDiv = containerDiv; 137 this.sharingSnapshotSelector = "#temp-sharing-holding-card"; 138 new eddata.share(this); 139 } 140 getDiv() { 141 return this.containerDiv; 142 } 143 getDataAsCSV() { 144 var sep = "|"; 145 return { 146 separator: sep, 147 worksheets: [{ 148 data: "Election Type" + sep + "Election Date" + sep + "Description" + sep + "District Id" + sep + "District Name" + sep + "Purpose" + sep + 149 "% Vote in Favor" + sep + "% Vote Required" + sep + "Average Daily Attendance" + sep + " Result\r\n" + 150 this.containerDiv.find("header h1").text() + sep + 151 this.containerDiv.find(".card-date").text() + sep + 152 this.containerDiv.find("h2.parcel").text() + sep + 153 this.containerDiv.find("header p").text() + sep + 154 this.containerDiv.find(".entity-name").text() + sep + 155 this.containerDiv.find(".bptpurpose p").text() + sep + 156 this.containerDiv.find(".card-yes-pct").text() + sep + 157 this.containerDiv.find(".card-req-pct").text() + sep + 158 this.containerDiv.find(".card-ada-nbr").text() + sep + 159 this.containerDiv.find(".bptfail,.bptpass").text() 160 }] 161 }; 162 } 163 getItemName() { 164 return this.containerDiv.find("header h1").text(); 165 } 166 getEntityName() { 167 return this.containerDiv.find(".entity-name").text(); 168 } 169 getShareDescriptionImage() { 170 return eddata.election.Data.shareDescriptionImage; 171 } 172 getShareDescription() { 173 return eddata.election.Data.shareDescription; 174 } 175 getShareText() { 176 return eddata.election.Data.shareDescription; 177 } 178 getItemLegendAsJquery() { 179 return this.containerDiv.find(".card-data").clone(); 180 } 181 getStateConfig() { 182 return { 183 SectionNbr: eddata.SectionType.ELECTION_CARDS, 184 CardId: parseInt(this.containerDiv.attr("id").split("-")[this.containerDiv.attr("id").split("-").length - 1]) 185 }; 186 } 187 preSharingProcessing() { 188 $(this.sharingSnapshotSelector).find(".date").html(this.containerDiv.find(".card-date").html()); 189 $(this.sharingSnapshotSelector).find(".bptmain").append(this.containerDiv.find(".bptmain h2").clone()); 190 $(this.sharingSnapshotSelector).find(".bptpurpose").css("height", ""); 191 $(this.sharingSnapshotSelector).find(".bptpurpose p").css("height", ""); 192 $(this.sharingSnapshotSelector).find(".bptpurpose a").remove(); 193 $(this.sharingSnapshotSelector).outerWidth($(this.sharingSnapshotSelector).outerHeight() * 1.91); 194 } 195 getTypeForChart() { return "Not Implemented"; } 196 } 197 election.Card = Card; 198 })(election = eddata.election || (eddata.election = {})); 199})(eddata || (eddata = {})); 200//# sourceMappingURL=election-data.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.