1 2app.controller('DiscussionInterviewController', function($scope, $http) { 3 4 $scope.pools = []; 5 6}); 7 8app.controller( 9 'DiscussionInterviewController', 10 function(dataFactory, $scope, $routeParams, $http, $rootScope, 11 $window, $sce) { 12 $scope.data = []; 13 var idParam = $routeParams.id; 14 $scope.idParam = idParam; 15 16 $scope.loadingAlbum = true; 17 $scope.loadingComments = true; 18 $scope.trustAsHtml = $sce.trustAsHtml; 19 20 $scope.viewby = 5; 21 $scope.totalItems = $scope.data.length; 22 $scope.currentPage = 1; 23 $scope.itemsPerPage = $scope.viewby; 24 $scope.maxSize = 5; // Number of pager buttons to show 25 26 $scope.loadingEvents = true; 27 $scope.showToplistYears = false; 28 $scope.loadingUpcomingReleases = true; 29 $scope.showTicketBtn = true; 30 $scope.mainCommentId = ""; 31 $scope.subCommentId = ""; 32 $scope.lastMainCommentId = ""; 33 $scope.lastSubCommentId = ""; 34 35 document.title = "Melodic Net - Interview Discussion"; 36 37 fetchInterviewInfo(idParam); 38 fetchTopCommentMember(); 39 fetchUserData(); 40 fetchUpcomingReleases(); 41 42 /* 43 * fetchUpcomingEvents(idParam); fetchPastEvents(idParam); 44 * fetchUpcomingReleases(); fetchUserData(); 45 */ 46 47 function fetchUserData() { 48 49 $http( 50 { 51 method : 'post', 52 url : '?page=Auth&action=isUserLoggedIn', 53 data : JSON.stringify({}), // forms user 54 // object 55 headers : { 56 'Content-Type' : 'application/x-www-form-urlencoded' 57 } 58 }).then(function(data) { 59 $rootScope.adminLoggedIn = data.data.adminLoggedIn; 60 $rootScope.userLoggedIn = data.data.memberLoggedIn; 61 $rootScope.userType = data.data.userType; 62 63 }); 64 } 65 66 this.comment = { 67 mainId : '', 68 replyId : '' 69 } 70 71 72 function fetchTopCommentMember() { 73 $http({ 74 method : 'post', 75 url : '?page=Discussion&action=fetchTopCommentMember', 76 data : JSON.stringify({ 77 }), // forms user object 78 headers : { 79 'Content-Type' : 'application/x-www-form-urlencoded' 80 } 81 }).then(function(data) { 82 83 $scope.loadingTopCommentMember = false; 84 $scope.topCommentMember = data.data; 85 86 87 88 str = JSON.stringify($scope.genreName, null, 4); 89 //alert(str); 90 }); 91 92 } 93 94 function fetchInterviewInfo(aIdParam) { 95 $http( 96 { 97 method : 'post', 98 url : '?page=Interview', 99 data : JSON.stringify({ 100 id : aIdParam 101 }), // forms user object 102 headers : { 103 'Content-Type' : 'application/x-www-form-urlencoded' 104 } 105 }) 106 .then( 107 function(data) { 108 109 $scope.loadingAlbum = false; 110 $scope.artistName = data.data[0].artistName; 111 $scope.friendlyId = data.data[0].friendlyId; 112 $scope.title = data.data[0].header; 113 $scope.img = data.data[0].artistImg; 114 $scope.relYear = data.data[0].year; 115 $scope.genreName = data.data[0].genreName; 116 $scope.newsDate = data.data[0].date; 117 $scope.newsText = data.data[0].intro150; 118 $scope.crewName = data.data[0].fullname; 119 $scope.newsDate = data.data[0].date; 120 $scope.interviewDate = data.data[0].datum; 121 fetchComments(aIdParam); 122 123 str = JSON.stringify( 124 data.data[0].friendlyId, 125 null, 4); 126 // alert(str); 127 }); 128 129 } 130 131 function fetchComments(id) { 132 133 var commentGroup = "interview"; 134 135 $http( 136 { 137 method : 'post', 138 url : '?page=Comment&action=fetchCommentsMain', 139 data : JSON.stringify({ 140 id : id, 141 commentGroup: commentGroup 142 }), // forms user object 143 headers : { 144 'Content-Type' : 'application/x-www-form-urlencoded' 145 } 146 }) 147 .then( 148 function(data) { 149 150 $scope.loadingComments = false; 151 $scope.comments = data.data; 152 $scope.totalComments = data.data.length; 153 $scope.mainCommentId = ""; 154 $scope.subCommentId = ""; 155 $scope.lastMainCommentId = ""; 156 $scope.lastSubCommentId = ""; 157 158 if ($scope.totalItemsUpcoming > 0) { 159 $scope.lastItem = $scope.comments[0].comment_id; 160 } 161 162 str = JSON.stringify(data, null, 4); 163 164 }); 165 166 } 167 168 $scope.setPageNr = function() { 169 $scope.currentPage = 1; 170 }; 171 172 173 174 function fetchUpcomingReleases() { 175 176 $http( 177 { 178 method : 'post', 179 url : '?page=Album&action=fetchUpcomingReleases', 180 data : JSON.stringify({}), // forms user 181 // object 182 headers : { 183 'Content-Type' : 'application/x-www-form-urlencoded' 184 } 185 }).then(function(data) { 186 187 $scope.upcomingReleasesList = data.data; 188 $scope.loadingUpcomingReleases = false;
189 // str = JSON.stringify($scope.restNewsList, null, 190 // 4); 191 // alert(str); 192 }); 193 194 } 195 196 $scope.handleCommentReply = function(name, main, lastmain, lastsub) { 197 198 $scope.mainCommentId = main; 199 $scope.lastMainCommentId = lastmain; 200 $scope.lastSubCommentId = lastsub; 201 202 203 $("#replyToSectionText").html( 204 "Reply to <b>" + name + "</b>"); 205 $("#replyToSection").hide(0).fadeIn(500); 206 scrollToSection('commentSection'); 207 } 208 209 $scope.handleReplyReply = function(name, main, sub, last) { 210 $scope.mainCommentId = main; 211 $scope.subCommentId = sub; 212 $scope.lastSubCommentId = last; 213 214 $("#replyToSectionText").html( 215 "Reply to <b>" + name + "</b>"); 216 $("#replyToSection").hide(0).fadeIn(500); 217 scrollToSection('commentSection'); 218 } 219 220 221 $scope.removeReplyTo = function(id) { 222 $scope.mainCommentId = ""; 223 $scope.subCommentId = ""; 224 $("#replyToSectionText").html("Reply to "); 225 $("#replyToSection").fadeOut(300); 226 } 227 228 229 $scope.handleLike = function(id) { 230 231 var sectionClass = $("#likeSection_" + id).attr('class'); 232 var nrVotes = $("#like_" + id).html(); 233 234 // If adding like 235 if (sectionClass == "pull-right btnLike") { 236 nrVotes = parseInt(nrVotes) + 1; 237 $("#like_" + id).html(nrVotes); 238 $("#likeSection_" + id).attr('class', 239 'pull-right btnLikeSelected'); 240 addLike(id) 241 } 242 // If removing like 243 else if (sectionClass == "pull-right btnLikeSelected") { 244 nrVotes = parseInt(nrVotes) - 1; 245 $("#like_" + id).html(nrVotes); 246 $("#likeSection_" + id).attr('class', 247 'pull-right btnLike'); 248 removeLike(id) 249 } 250 251 } 252 253 254 $scope.handleCommentReplyLike = function(mainCommentId, id) { 255 256 var sectionClass = $("#replyLikeSection_" + id).attr('class'); 257 var nrVotes = $("#replyLike_" + id).html(); 258 259 // If adding like 260 if (sectionClass == "pull-right btnLike") { 261 nrVotes = parseInt(nrVotes) + 1; 262 $("#replyLike_" + id).html(nrVotes); 263 $("#replyLikeSection_" + id).attr('class', 264 'pull-right btnLikeSelected'); 265 addReplyLike(mainCommentId, id) 266 } 267 // If removing like 268 else if (sectionClass == "pull-right btnLikeSelected") { 269 nrVotes = parseInt(nrVotes) - 1; 270 $("#replyLike_" + id).html(nrVotes); 271 $("#replyLikeSection_" + id).attr('class', 272 'pull-right btnLike'); 273 removeReplyLike(id) 274 } 275 276 } 277 278 $scope.handleAddComment = function() { 279 280 event.preventDefault(); 281 282 grecaptcha.ready(function() { 283 grecaptcha.execute('6LeFowwiAAAAAOJVRQT08JaylyNEAul-U4UK7fu1', {action: 'subscribe_newsletter'}).then(function(token) { 284 285 if ("" != $scope.mainCommentId) { 286 addReplyComment(token) 287 } 288 // Add reply comment 289 else { 290 addComment(token) 291 } 292 }); 293 }); 294 295 } 296 297 function addLike(id) { 298 299 var commentGroup = "interview"; 300 301 $http( 302 { 303 method : 'post', 304 url : '?page=Comment&action=addCommentLikeMain', 305 data : JSON.stringify({ 306 fid: $scope.idParam, 307 id : id, 308 commentGroup: commentGroup 309 }), // forms user object 310 headers : { 311 'Content-Type' : 'application/x-www-form-urlencoded' 312 } 313 }).then(function(data) { 314 315 }); 316 } 317 318 function removeLike(id) { 319 $http( 320 { 321 method : 'post', 322 url : '?page=Comment&action=removeCommentLike', 323 data : JSON.stringify({ 324 id : id 325 }), // forms user object 326 headers : { 327 'Content-Type' : 'application/x-www-form-urlencoded' 328 } 329 }).then(function(data) { 330 331 }); 332 } 333 334 function addReplyLike(mainCommentId, id) { 335 336 var commentGroup = "interview"; 337 338 $http( 339 { 340 method : 'post', 341 url : '?page=Comment&action=addCommentReplyLikeMain', 342 data : JSON.stringify({ 343 fId : $scope.idParam, 344 mainCommentId: mainCommentId, 345 id : id, 346 commentGroup: commentGroup 347 }), // forms user object 348 headers : { 349 'Content-Type' : 'application/x-www-form-urlencoded' 350 } 351 }).then(function(data) { 352 353 }); 354 } 355 356 function removeReplyLike(id) { 357 $http( 358 { 359 method : 'post', 360 url : '?page=Comment&action=removeCommentReplyLike', 361 data : JSON.stringify({ 362 id : id 363 }), // forms user object 364 headers : { 365 'Content-Type' : 'application/x-www-form-urlencoded' 366 } 367 }).then(function(data) { 368 369 }); 370 } 371 372 function addReplyComment(token) { 373 374 var tName = $scope.selectedName; 375 var tEmail = $scope.selectedEmail; 376 var tComment = $scope.selectedComment;
377 var idParam = $routeParams.id; 378 var commentGroup = "interview"; 379 380 $http( 381 { 382 method : 'post', 383 url : '?page=Comment&action=addReplyCommentMain', 384 data : JSON.stringify({ 385 id : idParam, 386 name : tName, 387 email : tEmail, 388 comment : tComment, 389 responseCode : token, 390 commentGroup : commentGroup, 391 mainCommentId : $scope.mainCommentId, 392 subCommentId : $scope.subCommentId 393 }), // forms user object 394 headers : { 395 'Content-Type' : 'application/x-www-form-urlencoded' 396 } 397 }).then(function(data) { 398 str = JSON.stringify(data, null, 4); 399 $scope.selectedName = ""; 400 $scope.selectedEmail = ""; 401 $scope.selectedComment = ""; 402 fetchComments(idParam); 403 stateChange(true); 404 405 var goToSection = "#commentStart"; 406 407 408 if("" != $scope.lastSubCommentId){ 409 var goToSection = "#linkReplyReply_"+$scope.lastSubCommentId; 410 } else if("" != $scope.lastMainCommentId){ 411 var goToSection = "#linkCommentReply_"+$scope.lastMainCommentId; 412 } 413 414 $scope.mainCommentId = ""; 415 $scope.subCommentId = ""; 416 $scope.lastMainCommentId = ""; 417 $scope.lastSubCommentId = ""; 418 $("#replyToSectionText").html("Reply to "); 419 $("#replyToSection").fadeOut(300); 420 document.querySelector(goToSection).scrollIntoView({behavior: 'smooth'}); 421 422 }); 423 424 } 425 426 function scrollToSection(aSection) { 427 document.querySelector('#'+aSection).scrollIntoView({behavior: 'smooth'}); 428 } 429 430 function addComment(token) { 431 432 var tName = $scope.selectedName; 433 var tEmail = $scope.selectedEmail; 434 var tComment = $scope.selectedComment; 435 var tResponseCode = token; 436 var idParam = $routeParams.id; 437 var commentGroup = "interview"; 438 439 $http( 440 { 441 method : 'post', 442 url : '?page=Comment&action=addCommentMain', 443 data : JSON.stringify({ 444 id : idParam, 445 name : tName, 446 email : tEmail, 447 comment : tComment, 448 responseCode : tResponseCode, 449 commentGroup: commentGroup 450 }), // forms user object 451 headers : { 452 'Content-Type' : 'application/x-www-form-urlencoded' 453 } 454 }).then(function(data) { 455 str = JSON.stringify(data, null, 4); 456 $scope.selectedName = ""; 457 $scope.selectedEmail = ""; 458 $scope.selectedComment = ""; 459 $scope.mainCommentId = ""; 460 $scope.subCommentId = ""; 461 $scope.lastMainCommentId = ""; 462 $scope.lastSubCommentId = ""; 463 fetchComments(idParam); 464 stateChange(true); 465 466 467 var goToSection = "#endCommentSection"; 468 document.querySelector(goToSection).scrollIntoView({behavior: 'smooth'}); 469 470 471 472 }); 473 474 } 475 476 function stateChange(newState) { 477 setTimeout(function() { 478 if (newState) { 479 $("#comment_" + $scope.lastItem).fadeOut(0) 480 .fadeIn(1500); 481 } 482 }, 500); 483 } 484 485 });
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.