1/// <reference path="../../shared/ts/jquery.d.ts" /> 2/// <reference path="../../shared/ts/knockout.d.ts" /> 3/// <reference path="../../shared/ts/ko.validation.d.ts" /> 4/// <reference path="../../shared/ts/ko.mapping.2.0.d.ts" /> 5var KnockoutControls; 6(function (KnockoutControls) { 7 var NewsArticleDto = /** @class */ (function () { 8 function NewsArticleDto() { 9 this.NewsArticleId = ko.observable(); 10 this.BannerImageSource = ko.observable(); 11 this.Title = ko.observable(); 12 this.SummaryHtml = ko.observable(); 13 this.ContentHtml = ko.observable(); 14 this.CreateDate = ko.observable(); 15 this.PublishDate = ko.observable(); 16 this.TotalNewsArticles = ko.observable(); 17 this.Tags = ko.observable(); 18 } 19 return NewsArticleDto; 20 }()); 21 var Tag = /** @class */ (function () { 22 function Tag() { 23 this.CWTagId = ko.observable(); 24 this.TagName = ko.observable(); 25 } 26 return Tag; 27 }()); 28 var GolfNzNewsList = /** @class */ (function () { 29 function GolfNzNewsList() { 30 this.isEditMode = ko.observable(false); 31 this.isInitialLoad = true; 32 this.memberId = ko.observable(); 33 this.memberUid = ko.observable(); 34 this.memberFirstName = ko.observable(); 35 this.memberFullName = ko.observable(); 36 this.pageControlId = ko.observable(); 37 this.pageId = ko.observable(); 38 this.clubFolderPath = ko.observable(); 39 this.clubWebsiteId = ko.observable(); 40 this.headerText = ko.observable(''); 41 this.listSize = ko.observable(); 42 this.displayPagingControls = ko.observable(); 43 this.displayFilters = ko.observable(); 44 this.tileSwiperEffect = ko.observable(); 45 this.horizontalLayout = ko.observable(); 46 this.timelineLayout = ko.observable(); 47 this.newsDetailPage = ko.observable(); 48 this.newsListingPage = ko.observable(); 49 this.newsGroupId = ko.observable(); 50 this.interclubTournamentsOnly = ko.observable(); 51 this.newsArticles = ko.observableArray(); 52 this.pageNumber = ko.observable(1); 53 this.totalPages = ko.observable(); 54 this.tags = ko.observable(); 55 this.sortByColumn = ko.observable("PublishDate"); 56 this.sortDirection = ko.observable("DESC"); 57 this.excludeNewsArticleId = ko.observable(); 58 this.defaultTags = ko.observable(); 59 this.tournamentId = ko.observable(); 60 this.competitionId = ko.observable(); 61 this.interclubAssociationId = ko.observable(); 62 this.dateFrom = ko.observable(); 63 this.dateFromText = ko.observable(); 64 this.dateTo = ko.observable(); 65 this.dateToText = ko.observable(); 66 this.sortText = ko.observable("New <i class='fal fa-arrow-right pr-2'></i>Old"); 67 this.tagList = ko.observableArray(); 68 this.selectedTag = ko.observable(); 69 this.isMediaCenter = ko.observable(false); 70 this.newsSectionCode = ko.observable(); 71 this.defaultThumbnailName = ko.observable("news-thumbnail"); 72 var self = this; 73 $(document).ready(function () { 74 var mode = GetParameterValues('mode'); 75 var isEditMode = ($('#pnlAdmin').length && mode == 'edit'); 76 if (isEditMode) { 77 self.isEditMode(true); 78 } 79 if (window.location.pathname === '/media-centre') 80 self.isMediaCenter(true); 81 var tags = GetParameterValues('tags'); 82 if (!!tags) { 83 self.tags(decodeURI(tags)); 84 } 85 else { 86 self.tags(self.defaultTags()); 87 } 88 if (self.newsGroupId() > 0) { 89 self.defaultThumbnailName("".concat(self.defaultThumbnailName(), "_newsgroup-").concat(self.newsGroupId())); 90 } 91 var currentArticleId = GetParameterValues('newsarticleid'); 92 if (currentArticleId) { 93 self.excludeNewsArticleId(currentArticleId); 94 } 95 var competitionId = GetParameterValues('competitionid');
96 if (competitionId) { 97 self.competitionId(competitionId); 98 } 99 var tournamentId = GetParameterValues('tournamentId'); 100 if (tournamentId) { 101 self.tournamentId(tournamentId); 102 } 103 var interclubAssociationId = GetParameterValues('interclubAssociationId'); 104 if (interclubAssociationId) { 105 self.interclubAssociationId(interclubAssociationId); 106 } 107 self.getNewsArticles(); 108 self.getMainNewsTags(); 109 self.selectedTag(''); 110 self.selectedTag.subscribe(function (newValue) { 111 if (!self.isInitialLoad && newValue) { 112 self.filterByTagId(newValue); 113 } 114 else { 115 self.isInitialLoad = false; 116 } 117 }); 118 PubSub.subscribe('news-tournament-filter', function (msg, data) { 119 console.log('received:', data); 120 self.tournamentId(data); 121 self.getNewsArticles(); 122 }); 123 PubSub.subscribe('news-interclub-filter', function (msg, data) { 124 console.log('received:', data); 125 self.tournamentId(null); 126 self.interclubAssociationId(data); 127 self.getNewsArticles(); 128 }); 129 }); 130 } 131 GolfNzNewsList.prototype.applyFilters = function () { 132 var self = this; 133 self.getNewsArticles(); 134 }; 135 GolfNzNewsList.prototype.getNewsArticles = function (nextOrPrevClick) { 136 if (nextOrPrevClick === void 0) { nextOrPrevClick = false; } 137 var self = this; 138 var loadPublishOnly = self.isEditMode() === false; 139 $.ajax({ 140 type: "POST", 141 dataType: "json", 142 contentType: "application/json", 143 url: '/api/news/GetNewsArticles', 144 data: JSON.stringify({ 145 clubWebsiteId: self.clubWebsiteId(), 146 pageSize: self.listSize(), 147 pageNumber: self.pageNumber(), 148 keywordSearch: null, 149 tags: self.tags() ? self.tags() : null, 150 sorting: [{ 151 orderBy: self.sortByColumn() ? self.sortByColumn() : null, 152 order: self.sortDirection() ? self.sortDirection() : null 153 }], 154 excludeNewsArticleId: self.excludeNewsArticleId() ? self.excludeNewsArticleId() : null, 155 dateFrom: self.dateFromText() ? self.parseDate(self.dateFromText()).toDateString() : null, 156 dateTo: self.dateToText() ? self.parseDate(self.dateToText()).toDateString() : null, 157 competitionId: self.competitionId() ? self.competitionId() : null, 158 tournamentId: self.tournamentId() ? self.tournamentId() : null, 159 isPublishedOnly: loadPublishOnly, 160 newsGroupId: self.newsGroupId(), 161 isMediaCentre: self.isMediaCenter(), 162 interclubTournamentsOnly: self.interclubTournamentsOnly(), 163 interclubAssociationId: self.interclubAssociationId() ? self.interclubAssociationId() : null, 164 newsSectionCode: !!self.newsSectionCode() ? self.newsSectionCode() : null 165 }) 166 }).done(function (response) { 167 ko.mapping.fromJS(response, {}, self.newsArticles); 168 setTimeout(function () { 169 if (typeof revealArticles === 'function') { 170 revealArticles(); 171 } 172 if (typeof tilesCarousel === 'function') { 173 tilesCarousel(); 174 } 175 }, 20); 176 if (nextOrPrevClick) { 177 setTimeout(function () { 178 $(window).scrollTop(500); 179 }); 180 } 181 self.totalPages(self.newsArticles() && self.newsArticles().length > 0 ? 182 Math.ceil(self.newsArticles()[0].TotalNewsArticles() / self.listSize()) : 0); 183 }).fail(function (request, status, error) { 184 console.log('fail'); 185 console.log(request); 186 console.log(status); 187 console.log(error); 188 }); 189 }; 190 GolfNzNewsList.prototype.reOrder = function (sortByColumn, sortDirection, sortText) { 191 var self = this; 192 self.sortByColumn(sortByColumn); 193 self.sortDirection(sortDirection); 194 self.sortText(sortText); 195 self.pageNumber(1); 196 self.getNewsArticles(); 197 }; 198 GolfNzNewsList.prototype.nextPage = function () { 199 var self = this; 200 self.pageNumber(self.pageNumber() + 1); 201 self.getNewsArticles(true); 202 }; 203 GolfNzNewsList.prototype.previousPage = function () { 204 var self = this; 205 self.pageNumber(self.pageNumber() - 1); 206 self.getNewsArticles(true); 207 }; 208 GolfNzNewsList.prototype.filterByTagId = function (tagName) { 209 var self = this; 210 if (tagName === 'All News') 211 tagName = ''; 212 self.tags(tagName); 213 self.getNewsArticles(); 214 }; 215 GolfNzNewsList.prototype.parseDate = function (dateToParse) { 216 var dateToText = dateToParse.split('/'); 217 return new Date(Number(dateToText[2]), Number(dateToText[1]) - 1, Number(dateToText[0])); 218 }; 219 GolfNzNewsList.prototype.getMainNewsTags = function () { 220 var self = this; 221 $.ajax({ 222 type: "GET", 223 dataType: "json", 224 contentType: "application/json", 225 url: "/api/news/GetNewsTags?clubWebsiteId=".concat(self.clubWebsiteId(), "&isNewsFilter=true") 226 }).done(function (response) { 227 var allNewsTag = { CWTagId: 0, TagName: "All News" }; 228 response.unshift(allNewsTag); 229 response.forEach(function (item) { 230 item.IsActive = false;
231 }); 232 var sortedMenu = self.sortTagsIntoCorrectOrder(response); 233 ko.mapping.fromJS(sortedMenu, {}, self.tagList); 234 }).fail(function (request, status, error) { 235 console.log('fail'); 236 console.log(request); 237 console.log(status); 238 console.log(error); 239 }); 240 }; 241 ; 242 GolfNzNewsList.prototype.sortTagsIntoCorrectOrder = function (tagsArray) { 243 var sortedArray = tagsArray.slice(); 244 tagsArray.forEach(function (item) { 245 switch (item.TagName) { 246 case 'All News': 247 sortedArray.splice(0, 1, item); 248 break; 249 case 'Tournaments': 250 sortedArray.splice(1, 1, item); 251 break; 252 case 'NZ Players': 253 sortedArray.splice(2, 1, item); 254 break; 255 case 'LOVE Golf': 256 sortedArray.splice(3, 1, item); 257 break; 258 case 'Industry': 259 sortedArray.splice(4, 1, item); 260 break; 261 case 'Clubs': 262 sortedArray.splice(5, 1, item); 263 break; 264 } 265 }); 266 return sortedArray; 267 }; 268 GolfNzNewsList.prototype.getNewsDetailPage = function () { 269 var self = this; 270 return (self.newsDetailPage() ? self.newsDetailPage() : "news-detail").replace(/\s+/g, '-').toLowerCase(); 271 }; 272 GolfNzNewsList.prototype.getNewsListingPage = function () { 273 var self = this; 274 return (self.newsListingPage() ? self.newsListingPage() : "news").replace(/\s+/g, '-').toLowerCase(); 275 }; 276 return GolfNzNewsList; 277 }()); 278 KnockoutControls.GolfNzNewsList = GolfNzNewsList; 279})(KnockoutControls || (KnockoutControls = {})); 280var dg_clientside_controls = dg_clientside_controls || {}; 281dg_clientside_controls["golfnz-news-list"] = KnockoutControls.GolfNzNewsList;
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.