1angular 2 .module("akuNewsLandingDataFetch", []) 3 .controller("ngNewsController", function($scope, $http, $compile) { 4 typeof angular == "undefined" 5 ? console.log("angular not loaded") 6 : console.log("angular loaded successfully"); 7 typeof jQuery == "undefined" 8 ? $.getScript("/Style%20Library/jquery.min.js", function() { 9 console.log( 10 "JQuery loaded successfully but not necessarily executed." 11 ); 12 }) 13 : console.log("jQuery loaded successfully"); 14 $scope.myHeader = "la hola wala quwata illa Billah!"; 15 $scope.featuredURL = 16 "/news/_api/web/lists/getbytitle('FeaturedNews')/items"; 17 $scope.quickNewsURL = 18 "/news/_api/web/lists/getbytitle('News')/items?$select=SequenceNumber,Title,NewsContent,NewsSummary,CategoryId,Tags,Dateline,FieldValuesAsHtml&$filter=IsPulished eq 'Published'&$orderby=Created desc&$top=100"; 19 $scope.akuInTheMedia = 20 "/news/_api/web/lists/getbytitle('AKU%20In%20The%20Media')/items?&$filter=PublishedStatus eq 'Published'&$top=2&$orderby=PublicationDate desc"; 21 $scope.allNewsURL = 22 "/news/_api/web/lists/getbytitle('News')/items?$filter=((IsPulished eq 'Published') and (GlobalNews eq 1) and (IsGloballyApproved eq 1))&$top=2000&$select=SequenceNumber,Title,NewsContent,NewsSummary,CategoryId,Tags,Dateline,FieldValuesAsHtml&$orderby=Dateline desc"; 23 $scope.newsCategories = 24 "/news/_api/web/lists/getbytitle('News%20Categories')/items?$select=id,Title"; 25 $scope.featuredNews = "";
26 $scope.numberOfItemsPerView = 12; 27 $scope.newsGrid = !0; 28 $scope.newsList = !1; 29 $scope.initialFetchDone = !1; 30 $scope.allNewsItems = []; 31 $scope.allAKUMediaItems = []; 32 $scope.newsCategoryItems = []; 33 $scope.totalSearchCount = 0; 34 $scope.parameterterm = ""; 35 //blockUI.start(); 36 37 $http({ 38 method: "GET", 39 url: $scope.newsCategories, 40 headers: { accept: "application/json;odata=verbose" } 41 }).then( 42 function onSuccess(response) { 43 try { 44 for (var nC = 0; nC < response.data.d.results.length; nC++) { 45 $scope.newsCategoryItems.push({ 46 categoryId: response.data.d.results[nC].Id, 47 categoryTitle: response.data.d.results[nC].Title 48 }); 49 } 50 } catch (err) { 51 console.log(err); 52 } 53 }, 54 function onError(response) { 55 console.log(response); 56 } 57 ); 58 $scope.adminAreaVisibile = false; 59 $http({ 60 method: "GET", 61 url: "/_api/web/currentuser", 62 headers: { accept: "application/json;odata=verbose" } 63 }).then( 64 function onSuccess(response) { 65 /*console.log(response);*/ console.log(response.data.d.Id); 66 if ( 67 response.data.d.Id != null && 68 response.data.d.Id > 0 && 69 response.data.d.Id != "undefined" 70 ) { 71 /*console.log(response.data.d.Currentuser + " is logged in !!");*/ $scope.adminAreaVisibile = true; 72 } 73 }, 74 function onError(response) { 75 console.log(response); 76 } 77 ); 78 $http({ 79 method: "GET", 80 url: $scope.featuredURL, 81 headers: { accept: "application/json;odata=verbose" } 82 }).then( 83 function onSuccess(response) { 84 $scope.featuredNews = response.data.d.results[0].Title; 85 if ($scope.featuredNews) { 86 console.log("Featured News will be:" + $scope.featuredNews); 87 } else { 88 console.log( 89 "No featured News found, we will take the latest news as Top News now" 90 ); 91 } 92 }, 93 function onError(response) { 94 console.log(response); 95 } 96 ); 97 $http({ 98 method: "GET", 99 url: $scope.akuInTheMedia, 100 headers: { accept: "application/json;odata=verbose" } 101 }).then( 102 function onSuccess(response) { 103 for (var aIM = 0; aIM < response.data.d.results.length; aIM++) { 104 $scope.allAKUMediaItems.push({ 105 aimTitle: response.data.d.results[aIM].Title, 106 aimSummary: response.data.d.results[aIM].NewsSummary, 107 aimSource: response.data.d.results[aIM].MediaName, 108 aimLink: response.data.d.results[aIM].MediaLink.Url 109 }); 110 } 111 }, 112 function onError(response) { 113 console.log(response); 114 } 115 ); 116 $scope.isentityfilter = function() { 117 isentity = false; 118 var urlParam = window.location + ""; 119 urlParam = urlParam.toLowerCase(); 120 if (urlParam.search("entity") > 0) { 121 isentity = true; 122 } else { 123 isentity = false; 124 } 125 return isentity; 126 }; 127 $scope.istagfilter = function() { 128 istag = false; 129 var urlParam = window.location + ""; 130 urlParam = urlParam.toLowerCase(); 131 if (urlParam.search("tags") > 0) { 132 istag = true; 133 } else { 134 istag = false; 135 } 136 return istag; 137 }; 138 $scope.isbothfilter = function() { 139 isboth = false; 140 var urlParam = window.location + ""; 141 urlParam = urlParam.toLowerCase(); 142 if (urlParam.search("tags") > 0 && urlParam.search("entity") > 0 ) { 143 isboth = true; 144 } else { 145 isboth = false; 146 } 147 return isboth; 148 }; 149 $scope.emptyenity = ""; 150 $scope.getnewsbyurl = function(url) { 151 var method = "GET"; 152 var headers = { accept: "application/json;odata=verbose" }; 153 var urlParam = window.location + ""; 154 data = ""; 155 urlParam = urlParam.toLowerCase(); 156 var cmlurlnews = 157 "/news/_api/web/Lists/GetByTitle('News')/GetItems"; 158 if ($scope.isbothfilter() == true) { 159 var entity=urlParamtest('entity'); 160 var tag=urlParamtest('tags'); 161 162 //var caml = "<View><Query><Where><And><Eq>
162<FieldRef Name='IsPulished' /><Value Type='Choice'>Published</Value></Eq><Or><Eq><FieldRef Name='Entity' /><Value Type='Lookup'>institute for the study of muslim civilisations</Value></Eq><Eq><FieldRef Name='AdditionalEntity' /><Value Type='LookupMulti'>institute for the study of muslim civilisations</Value></Eq></Or><Eq><FieldRef Name='Tags' /><Value Type='TaxonomyFieldTypeMulti'>research</Value></Eq></And></Where><OrderBy><FieldRef Name='Dateline' Ascending='False' /></OrderBy></Query><ViewFields><FieldRef Name='Title' /><FieldRef Name='NewsSummary' /><FieldRef Name='NewsContent' /><FieldRef Name='SequenceNumber' /><FieldRef Name='Category' /><FieldRef Name='Tags' /><FieldRef Name='Entity' /><FieldRef Name='ID' /><FieldRef Name='MediumImageCaption' /><FieldRef Name='MediumImage' /><FieldRef Name='Dateline' /></ViewFields><QueryOptions /></View>"; 163 var caml= "<View><Query><Where><And> <And> <Eq><FieldRef Name='IsPulished' /><Value Type='Choice'>Published</Value></Eq><Eq><FieldRef Name='Tags' /><Value Type='TaxonomyFieldTypeMulti'>"+tag+"</Value></Eq></And><Or><Eq><FieldRef Name='Entity' /><Value Type='Lookup'>"+entity+"</Value></Eq><Eq><FieldRef Name='AdditionalEntity' /><Value Type='LookupMulti'>institute for the study of muslim civilisations</Value></Eq></Or></And></Where><OrderBy><FieldRef Name='Dateline' Ascending='False' /></OrderBy></Query><ViewFields><FieldRef Name='Title' /> <FieldRef Name='NewsSummary' /> <FieldRef Name='NewsContent' /> <FieldRef Name='SequenceNumber' /> <FieldRef Name='Category' /> <FieldRef Name='Tags' /> <FieldRef Name='Entity' /> <FieldRef Name='ID' /> <FieldRef Name='MediumImageCaption' /> <FieldRef Name='MediumImage' /> <FieldRef Name='Dateline' /> </ViewFields> <QueryOptions /></View>"; 164 var requestData = { 165 query: { __metadata: { type: "SP.CamlQuery" }, ViewXml: caml } 166 }; 167 //$scope.allNewsURL=cmlurlnews+'(query=@v1)?@v1={"ViewXml":"'+caml+'"}'; 168 // $scope.allNewsURL ="/news/_api/web/lists/getbytitle('News')/items?$expand=Entity,AdditionalEntity&$filter=((IsPulished eq 'Published') and (tags eq '"+tag+"') and (Entity/Title eq '"+entity+"') or (AdditionalEntity eq '"+entity+"') )&$top=2000&$select=Entity/Title,AdditionalEntity/Title,SequenceNumber,Title,NewsContent,NewsSummary,CategoryId,Tags,Dateline,FieldValuesAsHtml&$orderby=Dateline desc"; 169 $scope.allNewsURL = cmlurlnews; 170 $scope.parameterterm = decodeURIComponent(entity); 171 $scope.parameterterm2 = decodeURIComponent(tag); 172 method = "POST"; 173 data = requestData; 174 headers = { 175 "X-RequestDigest": $("#__REQUESTDIGEST").val(), 176 Accept: "application/json; odata=verbose", 177 "Content-Type": "application/json; odata=verbose" 178 }; 179 } 180 else if ($scope.isentityfilter() == true) { 181 var entity = getEntityFromURL(); 182 entity = decodeURIComponent(entity); 183 var caml = "<View><Query><Where><And><Eq><FieldRef Name='IsPulished' /><Value Type='Choice'>Published</Value></Eq><Or><Eq><FieldRef Name='Entity' /><Value Type='Lookup'>"+entity+"</Value></Eq><Eq><FieldRef Name='AdditionalEntity' /><Value Type='LookupMulti'>"+entity+"</Value></Eq></Or></And></Where><OrderBy><FieldRef Name='Dateline' Ascending='False' /></OrderBy></Query><ViewFields><FieldRef Name='Title' /><FieldRef Name='NewsSummary' /><FieldRef Name='NewsContent' /><FieldRef Name='SequenceNumber' /><FieldRef Name='Category' /><FieldRef Name='Tags' /><FieldRef Name='Entity' /><FieldRef Name='ID' /><FieldRef Name='MediumImageCaption' /><FieldRef Name='MediumImage' /><FieldRef Name='Dateline' /></ViewFields><QueryOptions /></View>"; 184 var requestData = { 185 query: { __metadata: { type: "SP.CamlQuery" }, ViewXml: caml } 186 }; 187 //$scope.allNewsURL ="/news/_api/web/lists/getbytitle('News')/items?$expand=Entity,AdditionalEntity&$filter=((IsPulished eq 'Published') and (Entity/Title eq '"+entity+"') or (AdditionalEntity eq '"+entity+"') )&$top=2000&$select=Entity/Title,AdditionalEntity/Title,SequenceNumber,Title,NewsContent,NewsSummary,CategoryId,Tags,Dateline,FieldValuesAsHtml&$orderby=Dateline desc"; 188 $scope.allNewsURL = cmlurlnews; 189 $scope.parameterterm = decodeURIComponent(entity); 190 method = "POST"; 191 data = requestData; 192 headers = { 193 "X-RequestDigest": $("#__REQUESTDIGEST").val(), 194 Accept: "application/json; odata=verbose", 195 "Content-Type": "application/json; odata=verbose" 196 }; 197 } 198 else if ($scope.istagfilter() == true) { 199 var tag = getTagFromURL(); 200 $scope.parameterterm2 = decodeURIComponent(tag); 201 //var caml = "<View><Query><Where><And><Eq>
201<FieldRef Name='IsPulished' /><Value Type='Choice'>Published</Value></Eq><Eq><FieldRef Name='Tags' /><Value Type='TaxonomyFieldTypeMulti'>"+tag+"</Value></Eq></And></Where><OrderBy><FieldRef Name='Dateline' Ascending='False' /></OrderBy></Query></View>"; 202 var caml = 203 "<View><Query><Where><And><Eq><FieldRef Name='IsPulished' /><Value Type='Choice'>Published</Value></Eq><Eq><FieldRef Name='Tags' /><Value Type='TaxonomyFieldTypeMulti'>" + 204 tag + 205 "</Value></Eq></And></Where><OrderBy><FieldRef Name='Dateline' Ascending='False' /></OrderBy></Query><ViewFields><FieldRef Name='Title' /><FieldRef Name='NewsSummary' /><FieldRef Name='NewsContent' /><FieldRef Name='SequenceNumber' /><FieldRef Name='Category' /><FieldRef Name='Tags' /><FieldRef Name='Entity' /><FieldRef Name='ID' /><FieldRef Name='MediumImageCaption' /><FieldRef Name='MediumImage' /><FieldRef Name='Dateline' /><FieldRef Name='CategoryId' /></ViewFields><QueryOptions /></View>"; 206 var requestData = { 207 query: { __metadata: { type: "SP.CamlQuery" }, ViewXml: caml } 208 }; 209 $scope.allNewsURL = cmlurlnews; 210 //$scope.allNewsURL=testurl+'(query=@v1)?@v1={"ViewXml":"'+caml+'"}'; 211 method = "POST"; 212 data = requestData; 213 headers = { 214 "X-RequestDigest": $("#__REQUESTDIGEST").val(), 215 Accept: "application/json; odata=verbose", 216 "Content-Type": "application/json; odata=verbose" 217 }; 218 } 219 else { 220 $scope.allNewsURL = 221 "/news/_api/web/lists/getbytitle('News')/items?$filter=((IsPulished eq 'Published') and (GlobalNews eq 1) and (IsGloballyApproved eq 1))&$top=2000&$select=SequenceNumber,Title,NewsContent,NewsSummary,CategoryId,Tags,Dateline,FieldValuesAsHtml&$orderby=Dateline desc"; 222 } 223 url = $scope.allNewsURL; 224 $http({ 225 method: method, 226 url: url, 227 data: JSON.stringify(data), 228 headers: headers 229 }).then( 230 function onSuccess(response) { 231 $scope.initialFetchDone = !0; 232 var serialNumber = -1; 233 for (var aNU = 0; aNU < response.data.d.results.length; aNU++) { 234 var element = response.data.d.results[aNU]; 235 serialNumber = serialNumber + 1; 236 var newsTags = ""; 237 if (!$scope.featuredNews) { 238 $scope.featuredNews = element.SequenceNumber; 239 console.log( 240 "there was no Featured News specified, so we will just insert the first news: " + 241 element.SequenceNumber + 242 " as the featured news." 243 ); 244 } 245 for (var j = 0; j < element.Tags.results.length; j++) { 246 if (element.Tags.results[j].Label) { 247 newsTags = newsTags + ", " + element.Tags.results[j].Label; 248 } 249 } 250 var newsCategoryDescription = ""; 251 for (var i = 0; i < $scope.newsCategoryItems.length; i++) { 252 if ( 253 $scope.newsCategoryItems[i].categoryId == element.CategoryId 254 ) { 255 newsCategoryDescription = 256 $scope.newsCategoryItems[i].categoryTitle; 257 break; 258 } 259 } 260 var newsURL = 261 "/news/Pages/News_Details.aspx?nid=" + element.SequenceNumber; 262 $scope.allNewsItems.push({ 263 SNo: serialNumber, 264 Title: element.SequenceNumber, 265 NewsTitle: element.Title, 266 Content: element.NewsContent, 267 Summary: element.NewsSummary, 268 Category: newsCategoryDescription, 269 Tags: newsTags, 270 LinkUrl: newsURL, 271 Dateline: element.Dateline, 272 BannerImageListUrl: element.FieldValuesAsHtml.__deferred.uri, 273 actualBannerImage: null, 274 FetchRequest: !1, 275 SearchIndex: serialNumber, 276 includedInSearchResults: !1 277 }); 278 }
279 $scope.getNewsImages($scope.numberOfItemsPerView); 280 //getURL(); 281 }, 282 function onError(response) { 283 console.log(response); 284 } 285 ); 286 }; 287 function getfromcml(url) { 288 var caml = 289 "<View><Query><Where><Eq><FieldRef Name='Entity' /><Value Type='Lookup'>Medical College, Pakistan</Value></Eq></Where></Query></View>"; 290 var requestData = { 291 query: { __metadata: { type: "SP.CamlQuery" }, ViewXml: caml } 292 }; 293 $scope.allNewsURL = testurl; 294 method = "POST"; 295 data = requestData; 296 headers = { 297 "X-RequestDigest": $("#__REQUESTDIGEST").val(), 298 Accept: "application/json; odata=verbose", 299 "Content-Type": "application/json; odata=verbose" 300 }; 301 } 302 $scope.getnewsbyurl($scope.allNewsURL); 303 $scope.getSearchCount = function() { 304 $scope.totalSearchCount = 0; 305 var localVar = 0; 306 for (var gSC = 0; gSC < $scope.allNewsItems.length; gSC++) { 307 if ($scope.allNewsItems[gSC].includedInSearchResults == !0) { 308 localVar++; 309 $scope.totalSearchCount = $scope.totalSearchCount + 1; 310 } 311 } 312 return localVar; 313 }; 314 $scope.increaseShowCount = function() { 315 $scope.showCount = $scope.showCount + $scope.numberOfItemsPerVie
315w; 316 $scope.getNewsImages($scope.numberOfItemsPerView); 317 }; 318 $scope.setExactImageUrl = function(arrayIndex) { 319 $http({ 320 method: "GET", 321 url: $scope.allNewsItems[arrayIndex].BannerImageListUrl, 322 headers: { accept: "application/json;odata=verbose" } 323 }).then( 324 function onSuccess(responseBanner) { 325 var finalValue = ""; 326 var newBannerCodeHTML = responseBanner.data.d.BannerImage; 327 var el = $("<div></div>"); 328 el.html(newBannerCodeHTML); 329 var extractedObj = $("a", el); 330 if (extractedObj.length == 0) { 331 finalValue = extractedObj.prevObject[0].firstElementChild.src; 332 } 333 if (extractedObj.length > 0) { 334 finalValue = extractedObj[0].firstElementChild.src; 335 } 336 $scope.allNewsItems[arrayIndex].actualBannerImage = finalValue; 337 }, 338 function onError(responseBanner) { 339 console.log("error caught"); 340 console.log(responseBanner); 341 $scope.allNewsItems[arrayIndex].actualBannerImage = null; 342 } 343 ); 344 }; 345 $scope.getNewsImages = function(numberOfRows) { 346 var featuredNewsIncluded = !1; 347 for (var gNI = 0; gNI < $scope.allNewsItems.length; gNI++) { 348 newsItem = $scope.allNewsItems[gNI]; 349 if ($scope.allNewsItems[gNI].actualBannerImage == null) { 350 if (numberOfRows > 0) { 351 $scope.setExactImageUrl(gNI); 352 numberOfRows--; 353 if (newsItem.Title == $scope.featuredNews) { 354 console.log( 355 "found featured in the requested:" + 356 numberOfRows + 357 " rows." + 358 newsItem.Title + 359 " == " + 360 $scope.featuredNews 361 ); 362 featuredNewsIncluded = !0; 363 } 364 } 365 if (!featuredNewsIncluded) { 366 if (newsItem.Title == $scope.featuredNews) { 367 console.log( 368 "didnt find featured in the requested:" + 369 numberOfRows + 370 " rows, But found it here: " + 371 newsItem.Title + 372 " == " + 373 $scope.featuredNews 374 ); 375 $scope.setExactImageUrl(gNI); 376 } 377 } 378 } 379 } 380 }; 381 $scope.getIndividualNewsImage = function(SerialNumber) { 382 var featuredNewsIncluded = !1; 383 if ($scope.allNewsItems[SerialNumber].actualBannerImage == null) { 384 $http({ 385 method: "GET", 386 url: $scope.allNewsItems[SerialNumber].BannerImageListUrl, 387 headers: { accept: "application/json;odata=verbose" } 388 }).then( 389 function onSuccess(responseBanner) { 390 var newBannerCodeHTML = responseBanner.data.d.BannerImage; 391 var el = $("<div></div>"); 392 el.html(newBannerCodeHTML); 393 var extractedObj = $("a", el); 394 if (extractedObj.length == 0) { 395 $scope.allNewsItems[SerialNumber].actualBannerImage = 396 extractedObj.prevObject[0].firstElementChild.src; 397 } 398 if (extractedObj.length > 0) { 399 $scope.allNewsItems[SerialNumber].actualBannerImage = 400 extractedObj[0].firstElementChild.src; 401 } 402 }, 403 function onError(responseBanner) { 404 console.log("error caught"); 405 console.log(responseBanner); 406 } 407 ); 408 } 409 }; 410 $scope.avoidFeaturedNews = function(newsItem) { 411 if ($scope.featuredNews == newsItem.Title) { 412 return !1; 413 } else { 414 return !0; 415 } 416 }; 417 $scope.featuredNewsFilter = function(newsItem) { 418 if ($scope.featuredNews == newsItem.Title) { 419 return !0; 420 } else { 421 return !1; 422 } 423 }; 424 $scope.resetfilter = function() { 425 location.replace(_spPageContextInfo.webAbsoluteUrl + "/pages/home.aspx"); 426 }; 427 $scope.updateFilterBySearchTerm = function() {
428 $scope.showCount = $scope.numberOfItemsPerView; 429 $scope.searchedTerm = function(newsItem) { 430 if (newsItem.SNo == $scope.allNewsItems.length - 1) { 431 $scope.setSearchIndexes(); 432 } 433 if ($scope.SearchTerm) { 434 if ( 435 newsItem.NewsTitle.toLowerCase().search( 436 $scope.SearchTerm.toLowerCase() 437 ) > -1 || 438 newsItem.Summary.toLowerCase().search( 439 $scope.SearchTerm.toLowerCase() 440 ) > -1 || 441 newsItem.Content.toLowerCase().search( 442 $scope.SearchTerm.toLowerCase() 443 ) > -1 || 444 newsItem.Tags.toLowerCase().search( 445 $scope.SearchTerm.toLowerCase() 446 ) > -1 || 447 newsItem.Category.toLowerCase().search( 448 $scope.SearchTerm.toLowerCase() 449 ) > -1 450 ) { 451 $scope.allNewsItems[newsItem.SNo].includedInSearchResults = !0; 452 if (!newsItem.FetchRequest & !newsItem.actualBannerImage) { 453 } 454 return !0; 455 } else { 456 $scope.allNewsItems[newsItem.SNo].includedInSearchResults = !1; 457 return !1; 458 } 459 } else { 460 return !0; 461 } 462 }; 463 }; 464 $scope.setSearchIndexes = function() { 465 var tempCounter = 0; 466 for (var sSI = 0; sSI < $scope.allNewsItems.length; sSI++) { 467 newsItem = $scope.allNewsItems[sSI]; 468 if (newsItem.includedInSearchResults) { 469 $scope.allNewsItems[newsItem.SNo].SearchIndex = tempCounter; 470 tempCounter = tempCounter + 1; 471 } 472 } 473 }; 474 $scope.columnerController = function(colIndex, Sno, SIndex) { 475 if (colIndex == 1) { 476 if ($scope.SearchTerm) { 477 if (SIndex % 3 == 0) { 478 return !0; 479 } else { 480 return !1; 481 } 482 } else if (Sno % 3 == 0) { 483 return !0; 484 } 485 } 486 if (colIndex == 2) { 487 if ($scope.SearchTerm) { 488 if (SIndex % 3 == 1) { 489 return !0; 490 } else { 491 return !1; 492 } 493 } else if (Sno % 3 == 1) { 494 return !0; 495 } 496 } 497 if (colIndex == 3) { 498 if ($scope.SearchTerm) { 499 if (SIndex % 3 == 2) { 500 return !0; 501 } else { 502 return !1; 503 } 504 } else if (Sno % 3 == 2) { 505 return !0; 506 } 507 } 508 return !1; 509 }; 510 $scope.bannerImageAbsent = function(SerialNumber) { 511 if ($scope.allNewsItems[SerialNumber].actualBannerImage == null) { 512 if ($scope.allNewsItems[SerialNumber].FetchRequest == !1) { 513 $scope.allNewsItems[SerialNumber].FetchRequest = !0; 514 $scope.getIndividualNewsImage(SerialNumber); 515 } 516 return !0; 517 } else { 518 return !1; 519 } 520 }; 521 522 $scope.setNewsView = function(typeOfView) { 523 if (typeOfView == "Grid") { 524 $scope.newsGrid = !0; 525 $scope.newsList = !1; 526 } 527 if (typeOfView == "List") { 528 $scope.newsGrid = !1; 529 $scope.newsList = !0; 530 } 531 }; 532 /* October 1, 2018 - query string for tags -- Start */ 533 534 $scope.searchedTagFromQuery = ""; 535 function getURL() { 536 var urlParam = window.location + ""; 537 urlParam = urlParam.toLowerCase(); 538 if (urlParam.search("tags") > 0) { 539 var urlParamTag = urlParam.search("tags"); 540 var searchedQueryTag = urlParam.substring(urlParamTag + 5); 541 console.log( 542 "you searched for: " + decodeURIComponent(searchedQueryTag) 543 ); 544 $scope.searchedTagFromQuery = decodeURIComponent(searchedQueryTag); 545 $scope.SearchTerm = $scope.searchedTagFromQuery; 546 $scope.parameterterm2 = $scope.searchedTagFromQuery; 547 setTimeout(function() { 548 $("#newButton").trigger("click", function() { 549 console.log("button clicked"); 550 }); 551 }, 500); 552 } else { 553 console.log("unable to get a tag from the url."); 554 } 555 } /* October 1, 2018 - query string for tags -- End */ 556 557 function getTagFromURL() { 558 var urlParam = window.location + ""; 559 urlParam = urlParam.toLowerCase(); 560 if (urlParam.search("tags") > 0) { 561 var urlParamTag = urlParam.search("tags"); 562 var searchedQueryTag = urlParam.substring(urlParamTag + 5); 563 console.log( 564 "you searched for: " + decodeURIComponent(searchedQueryTag) 565 ); 566 //$scope.searchedTagFromQuery = decodeURIComponent(searchedQueryTag); 567 // $scope.SearchTerm = $scope.searchedTagFromQuery; 568 } else { 569 console.log("unable to get a tag from the url."); 570 } 571 return decodeURIComponent(searchedQueryTag); 572 } 573 function urlParamtest(name){ 574 var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); 575 if (results==null) { 576 return null; 577 } 578 return decodeURI(results[1]) || 0; 579} 580 function getEntityFromURL() { 581 var urlParam = window.location + ""; 582 urlParam = urlParam.toLowerCase(); 583 if (urlParam.search("entity") > 0) { 584 var urlParamTag = urlParam.search("entity"); 585 var searchedQueryEntity = urlParam.substring(urlParamTag + 7); 586 console.log( 587 "you searched for: " + decodeURIComponent(searchedQueryEntity) 588 ); 589 //$scope.searchedTagFromQuery = decodeURIComponent(searchedQueryTag); 590 // $scope.SearchTerm = $scope.searchedTagFromQuery; 591 } else { 592 console.log("unable to get a entity from the url."); 593 } 594 return searchedQueryEntity; 595 } 596 });
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.