Commit 39b462be68587eab62e4d85aecf7ac5bd29e8bfb

Authored by mangaldeep patel
1 parent 6d0c0a57

disablling background event.

400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js
... ... @@ -16,20 +16,43 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
16 16 SearchText: '',
17 17 SearchTextByAlphabet: '',
18 18 };
  19 +
19 20 $(document).ready(function () {
20   - $(window).on('scroll', '#ListViewDiv', function () {
21   - console.log('scroll happened');
22   - alert("scroll fired");
23   - });
24   - $("#ListViewDiv").on('scroll', function () {
25   - alert('Event worked');
26   - });
27   - });
28   - $("#ListViewDiv").on('scroll', function () {
29   - alert('Event worked');
  21 + $timeout(function () {
  22 + var Count = 200;
  23 + localStorage.setItem("ImageCount", Count);
  24 + var searchByText = $rootScope.getLocalStorageValue("SearchText");
  25 + var searchTextByAlphabet = $rootScope.getLocalStorageValue("SearchByAlphabet");
  26 + $("#ListViewDiv").on('scroll', function () {
  27 + if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight - 10) {
  28 + Count += 100;
  29 + var ImageCount = $rootScope.getLocalStorageValue("ImageCount");
  30 + if (typeof (searchByText) !== "undefined" && searchByText !== null && searchByText !== '') {
  31 + $scope.query.SearchText = searchByText;
  32 + }
  33 + else if (typeof (searchTextByAlphabet) !== "undefined" && searchTextByAlphabet !== null && searchTextByAlphabet !== '') {
  34 + $scope.query.SearchTextByAlphabet = searchTextByAlphabet;
  35 + }
  36 + else {
  37 + $scope.query.SearchTextByAlphabet = "";
  38 + }
  39 +
  40 + if ($scope.query.SearchText == "" && $scope.query.SearchTextByAlphabet == "") {
  41 +
  42 + $scope.LoadAIJsonData(Count);
  43 + $scope.loadAllAI(Count);
  44 + }
  45 + else if ($scope.query.SearchTextByAlphabet != "" || $scope.query.SearchText == "") {
  46 + $scope.ApplySearchByAlphabet($scope.query.SearchTextByAlphabet);
  47 + }
  48 + else {
  49 + $scope.ApplySearch($scope.query);
  50 + }
  51 + }
  52 + });
  53 + }, 10);
30 54 });
31 55  
32   -
33 56 $(document).ready(function () {
34 57 var Count = 200;
35 58 localStorage.setItem("ImageCount", Count);
... ... @@ -55,11 +78,11 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
55 78 $scope.loadAllAI(Count);
56 79 }
57 80 else if ($scope.query.SearchTextByAlphabet != "" || $scope.query.SearchText == "") {
58   - $scope.ApplySearchByAlphabet($scope.query.SearchTextByAlphabet);
  81 + $scope.ApplySearchByAlphabet($scope.query.SearchTextByAlphabet );
59 82 }
60 83 else {
61 84 $scope.ApplySearch($scope.query);
62   - }
  85 + }
63 86 }
64 87 });
65 88  
... ... @@ -74,9 +97,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
74 97 $('#' + $rootScope.getLocalStorageValue("currentAIImageId")).addClass("selected");
75 98 $scope.idSelected = $rootScope.getLocalStorageValue("currentAIImageId");
76 99 var selectedImageId = $rootScope.getLocalStorageValue("currentAIImageId");
77   - $scope.LoadAIJsonData(ImageCount);
78 100 $scope.ReloadListViewImageDiv(selectedImageId, ImageCount);
79   - $scope.showItem(selectedImageId);
80 101 }
81 102 else {
82 103 $('#' + $rootScope.getLocalStorageValue("currentAIImageId")).find('.thumbnail').addClass('HightLightThumbnail');
... ... @@ -167,7 +188,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
167 188 }
168 189  
169 190 $scope.LoadAIJsonData = function (ImageCount) {
170   - $('ul li a').removeAttr("style");
  191 + $('ul li span').removeAttr("style");
171 192 var promise = DataService.getJson('~/../content/data/json/ai/ai_dat_contentlist.json')
172 193 promise.then(
173 194 function (result) {
... ... @@ -191,9 +212,13 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
191 212 $rootScope.isLoading = true;
192 213 localStorage.setItem("SearchText", '');
193 214 localStorage.setItem("SearchByAlphabet", '');
194   - $('ul li a').removeAttr("style");
  215 + $('ul li span').removeAttr("style");
195 216 $('#aiSpinner').css('visibility', 'visible');
196 217 $('#aiSpinner').css('zIndex', '20000');
  218 + if ($location.url() == "/ADAM-images")
  219 + {
  220 + $scope.DisableUI();
  221 + }
197 222 var promise = DataService.getJson('~/../content/data/json/ai/ai_dat_contentlist.json')
198 223 promise.then(
199 224 function (result) {
... ... @@ -224,6 +249,12 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
224 249  
225 250 $rootScope.isLoading = false;
226 251 $('#aiSpinner').css('visibility', 'hidden');
  252 + if ($location.url() == "/ADAM-images") {
  253 + setTimeout(function () {
  254 + $scope.EnableUI();
  255 + }, 10);
  256 + }
  257 +
227 258  
228 259 },
229 260 function (error) {
... ... @@ -246,7 +277,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
246 277 //Set the vertical scroll value of the table.
247 278 var y = $('#ListViewDiv').scrollTop();
248 279 localStorage.setItem("AIListViewScroll", y);
249   -
  280 + //$('#' + id).find('.thumbnail').addClass('HightLightThumbnail');
  281 + localStorage.setItem("currentAIImageId", id);
250 282 $scope.hiderow = true;
251 283 if ($scope.filterstring == false) {
252 284  
... ... @@ -275,11 +307,12 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
275 307 $scope.SelectedAITitle = SelectedAIthumbImage[0]._Title;
276 308  
277 309 }
  310 +
278 311 }
279 312 };
280 313  
281 314 $scope.Reset = function (query) {
282   - $('ul li a').removeAttr("style");
  315 + $('ul li span').removeAttr("style");
283 316 query.SearchText = "";
284 317 //set localstorage values
285 318 localStorage.setItem("SearchText", '');
... ... @@ -300,7 +333,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
300 333 }
301 334  
302 335 $scope.ApplySearch = function (query) {
303   - $('ul li a').removeAttr("style");
  336 + $('ul li span').removeAttr("style");
304 337 var currentSearchtext = $rootScope.getLocalStorageValue("SearchText");
305 338 localStorage.setItem("SearchText", '');
306 339 if (currentSearchtext == "undefined" || (currentSearchtext == null || currentSearchtext == ""))
... ... @@ -315,12 +348,13 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
315 348 }
316 349  
317 350 $rootScope.isLoading = true;
318   - $('#spinner').css('visibility', 'visible');
  351 + $('#aiSpinner').css('visibility', 'visible');
  352 + $scope.DisableUI();
319 353 $scope.filterstring = true;
320 354  
321   - while ($scope.searchAIListViewData.length) {
322   - $scope.searchAIListViewData.pop();
323   - }
  355 + //while ($scope.searchAIListViewData.length) {
  356 + // $scope.searchAIListViewData.pop();
  357 + //}
324 358  
325 359 if (typeof (query.SearchText) !== "undefined" && (query.SearchText !== null && query.SearchText !== "")) {
326 360 localStorage.setItem("SearchText", query.SearchText);
... ... @@ -394,7 +428,10 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
394 428 localStorage.setItem("SearchText", '');
395 429 }
396 430 $rootScope.isLoading = false;
397   - $('#spinner').css('visibility', 'hidden');
  431 + $('#aiSpinner').css('visibility', 'hidden');
  432 + setTimeout(function () {
  433 + $scope.EnableUI();
  434 + }, 10);
398 435  
399 436 },
400 437 function (error) {
... ... @@ -403,25 +440,27 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
403 440 }
404 441 );
405 442 }
  443 + $scope.DisableUI = function () {
  444 +
  445 + $('#imgParent').css('z-index', '1');
  446 + document.getElementById("imgParent").style.pointerEvents = "none";
  447 + document.getElementById("imgParent").style.opacity = "0.5";
  448 + }
406 449  
  450 + $scope.EnableUI = function () {
  451 + document.getElementById("imgParent").style.pointerEvents = "auto";
  452 + document.getElementById("imgParent").style.opacity = "1.0";
  453 + }
407 454  
408   -
  455 + $scope.counter = 1;
409 456 $scope.ApplySearchByAlphabet = function (SearchTextByAlphabet) {
410   -
411   - $rootScope.SearchTextByAlphabet = SearchTextByAlphabet
412   - $rootScope.isLoading = true;
413   - $('ul li a').removeAttr("style");
414   - $('#spinner').css('visibility', 'visible');
  457 + $rootScope.SearchTextByAlphabet = SearchTextByAlphabet
  458 + $rootScope.isLoading = true;
  459 + $('#aiSpinner').css('visibility', 'visible');
  460 + $scope.DisableUI();
  461 + $('ul li span').removeAttr("style");
415 462 $('#' + $rootScope.SearchTextByAlphabet ).css({ "color": "white", "background-color": "#1B92D0" });
416   -
417   - //color: #0095da;
418   - //background-color: #ffffff;
419   -
420 463 $scope.filterstring = true;
421   -
422   - while ($scope.searchAIListViewData.length) {
423   - $scope.searchAIListViewData.pop();
424   - }
425 464 if (typeof (SearchTextByAlphabet) !== "undefined" && (SearchTextByAlphabet !== null && SearchTextByAlphabet !== "")) {
426 465 localStorage.setItem("SearchByAlphabet", SearchTextByAlphabet);
427 466 }
... ... @@ -436,8 +475,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
436 475  
437 476 $scope.selectedAIListViewData = new jinqJs()
438 477 .from($scope.IllustrationData.root.AIData)
439   - .orderBy([{ field: '_Title', sort: 'asc' }])
440   - .select();
  478 + .orderBy([{ field: '_Title', sort: 'asc' }]).select();
441 479  
442 480 $('#grid-view').empty();
443 481  
... ... @@ -457,17 +495,12 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
457 495 if (selectimg === true) {
458 496 $scope.imagePath = "~/../content/images/ai/thumbnails/" + value._ThumbnailImage;
459 497  
460   - var $el = $('<div id="' + value._id + '" class="col-sm-3 col-md-2" title = "' + value._Title + '" data-ng-click="OpenAdamImage($event)">'
  498 + var $el = $('<div id="' + value._id + '" ng-disabled="' + $scope.IsDisable + '" class="col-sm-3 col-md-2" title = "' + value._Title + '" data-ng-click="OpenAdamImage($event)">'
461 499 + '<div style="width:auto;height:auto;" class="thumbnail" >'
462 500 + '<img style="height:150px" id="' + value._Title + '"ng-src="' + $scope.imagePath + '" alt="" title="" >'
463 501 + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view');
464 502  
465 503 $compile($el)($scope);
466   -
467   - //$(".sidebar").mCustomScrollbar({
468   - // autoHideScrollbar: true,
469   - // //theme:"rounded"
470   - //});
471 504 $scope.searchAIListViewData.push(
472 505 {
473 506 "_id": value._id,
... ... @@ -477,6 +510,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
477 510 "_ThumbnailImage": value._ThumbnailImage,
478 511 });
479 512 }
  513 +
480 514 });
481 515 $('table > #ListViewDiv > #searchItem').remove();
482 516 //Show Error Message in case of gridview if no data is found
... ... @@ -488,13 +522,18 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
488 522 $('#ListViewDiv').append('<tr id="searchItem"><td colspan="6"><strong style="color:black;">No illustration found for the selected search criteria!</strong></td></tr>');
489 523 }
490 524 $rootScope.isLoading = false;
491   - $('#spinner').css('visibility', 'hidden');
492 525  
  526 + setTimeout(function () {
  527 + $scope.EnableUI();
  528 + }, 10);
493 529 },
494 530 function (error) {
495 531 console.log(' $scope.IllustrationData = ' + error.statusText);
496 532 }
  533 +
497 534 );
  535 +
  536 +
498 537 }
499 538  
500 539  
... ... @@ -538,7 +577,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
538 577 $location.path('/');
539 578 }
540 579 $rootScope.isLoading = true;
541   - $('#spinner').css('visibility', 'visible');
  580 + $('#aiSpinner').css('visibility', 'visible');
  581 + //$scope.DisableUI();
542 582 $scope.voId = $rootScope.getLocalStorageValue("currentAIImageId");
543 583  
544 584 var counter = 1;
... ... @@ -588,7 +628,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
588 628 $('#canvasDiv img').load(function () {
589 629  
590 630 $rootScope.isLoading = false;
591   - $('#spinner').css('visibility', 'hidden');
  631 + $('#aiSpinner').css('visibility', 'hidden');
592 632 var canvas = document.getElementById("canvas");
593 633 var canvasPaint = document.getElementById("canvasPaint");
594 634 canvas.height = $(".img-thumbnail").height();
... ... @@ -642,6 +682,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
642 682 $rootScope.isLoading = true;
643 683 $('#aiSpinner').css('visibility', 'visible');
644 684 $('#aiSpinner').css('zIndex', '20000');
  685 + //$scope.DisableUI();
645 686  
646 687 var promise = DataService.getJson('~/../content/data/json/ai/ai_dat_contentlist.json')
647 688 promise.then(
... ... @@ -672,6 +713,9 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
672 713 }
673 714 $rootScope.isLoading = false;
674 715 $('#aiSpinner').css('visibility', 'hidden');
  716 + //setTimeout(function () {
  717 + // $scope.EnableUI();
  718 + //}, 10);
675 719 },
676 720 function (error) {
677 721 // handle errors here
... ...
400-SOURCECODE/AIAHTML5.Web/app/views/ai/ai-view.html
1 1 ๏ปฟ<div class="bodyWrap row no-scroll">
2   - <div ng-include=" 'app/widget/MainMenu.html' " />
3   - <div class="main">
  2 + <div ng-include="'app/widget/MainMenu.html'" />
  3 + <div class="main" id="imgParent" style="">
4 4 <div class="row">
5 5 <div class="col-sm-12 stickey-area" style="padding-left:25px; width:99%">
6 6 <div class="breadcrumb" style="padding-bottom:5px;">
... ... @@ -8,44 +8,47 @@
8 8 <form class="form-inline padd5">
9 9 <div class="form-group">
10 10 <label for="exampleInputName2" class="text-primary">Search</label>
11   - <input type="text" ng-model="query.SearchText" class="form-control input-sm col-sm" id="txtSerachInput" placeholder="">
  11 + <input type="text" ng-change="hideListViewDiv()" ng-model="query.SearchText" class="form-control input-sm col-sm" id="txtSerachInput" placeholder="">
12 12 </div>
13 13 <button type="button" class="btn btn-primary btn-sm" ng-click="ApplySearch(query)" style="margin-right:2px;">
14 14 <i class="fa fa-search"></i>
15 15 </button>
16 16 </form>
17   - <nav>
18   - <ul class="pagination pagination-sm no-margin">
19   - <li><a id="A" href="#" ng-click="ApplySearchByAlphabet('A')">A</a></li>
20   - <li><a id="B" href="#" ng-click="ApplySearchByAlphabet('B')">B</a></li>
21   - <li><a id="C" href="#" ng-click="ApplySearchByAlphabet('C')">C</a></li>
22   - <li><a id="D" href="#" ng-click="ApplySearchByAlphabet('D')">D</a></li>
23   - <li><a id="E" href="#" ng-click="ApplySearchByAlphabet('E')">E</a></li>
24   - <li><a id="F" href="#" ng-click="ApplySearchByAlphabet('F')">F</a></li>
25   - <li><a id="G" href="#" ng-click="ApplySearchByAlphabet('G')">G</a></li>
26   - <li><a id="H" href="#" ng-click="ApplySearchByAlphabet('H')">H</a></li>
27   - <li><a id="I" href="#" ng-click="ApplySearchByAlphabet('I')">I</a></li>
28   - <li><a id="J" href="#" ng-click="ApplySearchByAlphabet('J')">J</a></li>
29   - <li><a id="K" href="#" ng-click="ApplySearchByAlphabet('K')">K</a></li>
30   - <li><a id="L" href="#" ng-click="ApplySearchByAlphabet('L')">L</a></li>
31   - <li><a id="M" href="#" ng-click="ApplySearchByAlphabet('M')">M</a></li>
32   - <li><a id="N" href="#" ng-click="ApplySearchByAlphabet('N')">N</a></li>
33   - <li><a id="O" href="#" ng-click="ApplySearchByAlphabet('O')">O</a></li>
34   - <li><a id="P" href="#" ng-click="ApplySearchByAlphabet('P')">P</a></li>
35   - <li><a id="Q" href="#" ng-click="ApplySearchByAlphabet('Q')">Q</a></li>
36   - <li><a id="R" href="#" ng-click="ApplySearchByAlphabet('R')">R</a></li>
37   - <li><a id="S" href="#" ng-click="ApplySearchByAlphabet('S')">S</a></li>
38   - <li><a id="T" href="#" ng-click="ApplySearchByAlphabet('T')">T</a></li>
39   - <li><a id="U" href="#" ng-click="ApplySearchByAlphabet('U')">U</a></li>
40   - <li><a id="V" href="#" ng-click="ApplySearchByAlphabet('V')">V</a></li>
41   - <li><a id="W" href="#" ng-click="ApplySearchByAlphabet('W')">W</a></li>
42   - <li><a id="X" href="#" ng-click="ApplySearchByAlphabet('X')">X</a></li>
43   - <li><a id="Y" href="#" ng-click="ApplySearchByAlphabet('Y')">Y</a></li>
44   - <li><a id="Z" href="#" ng-click="ApplySearchByAlphabet('Z')">Z</a></li>
45   - </ul>
46   - <button type="button" class="btn btn-primary btn-sm" ng-click="Reset(query)" style = "margin-bottom:23px"><i class="fa fa-eye"></i>Show All</button>
47   - </nav>
  17 + <nav>
  18 + <ul class="pagination pagination-sm no-margin" style="cursor: pointer;">
  19 + <li><span id="A" ng-click="ApplySearchByAlphabet('A')"> A</span></li>
  20 + <li><span id="B" ng-click="ApplySearchByAlphabet('B')"> B</span></li>
  21 + <li><span id="C" ng-click="ApplySearchByAlphabet('C')"> C</span></li>
  22 + <li><span id="D" ng-click="ApplySearchByAlphabet('D')"> D</span></li>
  23 + <li><span id="E" ng-click="ApplySearchByAlphabet('E')"> E</span></li>
  24 + <li><span id="F" ng-click="ApplySearchByAlphabet('F')"> F</span></li>
  25 + <li><span id="G" ng-click="ApplySearchByAlphabet('G')"> G</span></li>
  26 + <li><span id="H" ng-click="ApplySearchByAlphabet('H')"> H</span></li>
  27 + <li><span id="I" ng-click="ApplySearchByAlphabet('I')"> I</span></li>
  28 + <li><span id="J" ng-click="ApplySearchByAlphabet('J')"> J</span></li>
  29 + <li><span id="K" ng-click="ApplySearchByAlphabet('K')"> K</span></li>
  30 + <li><span id="L" ng-click="ApplySearchByAlphabet('L')"> L</span></li>
  31 + <li><span id="M" ng-click="ApplySearchByAlphabet('M')"> M</span></li>
  32 + <li><span id="N" ng-click="ApplySearchByAlphabet('N')"> N</span></li>
  33 + <li><span id="O" ng-click="ApplySearchByAlphabet('O')"> O</span></li>
  34 + <li><span id="P" ng-click="ApplySearchByAlphabet('P')"> P</span></li>
  35 + <li><span id="Q" ng-click="ApplySearchByAlphabet('Q')"> Q</span></li>
  36 + <li><span id="R" ng-click="ApplySearchByAlphabet('R')"> R</span></li>
  37 + <li><span id="S" ng-click="ApplySearchByAlphabet('S')"> S</span></li>
  38 + <li><span id="T" ng-click="ApplySearchByAlphabet('T')"> T</span></li>
  39 + <li><span id="U" ng-click="ApplySearchByAlphabet('U')"> U</span></li>
  40 + <li><span id="V" ng-click="ApplySearchByAlphabet('V')"> V</span></li>
  41 + <li><span id="W" ng-click="ApplySearchByAlphabet('W')"> W</span></li>
  42 + <li><span id="X" ng-click="ApplySearchByAlphabet('X')"> X</span></li>
  43 + <li><span id="Y" ng-click="ApplySearchByAlphabet('Y')"> Y</span></li>
  44 + <li><span id="Z" ng-click="ApplySearchByAlphabet('Z')"> Z</span></li>
  45 +
  46 + </ul>
  47 + <button type="button" class="btn btn-primary btn-sm" ng-click="Reset(query)" style="margin-bottom:23px"><i class="fa fa-eye"></i>Show All</button>
  48 + </nav>
  49 +
48 50 </div>
  51 +
49 52 </div>
50 53 </div>
51 54 </div>
... ... @@ -73,7 +76,7 @@
73 76 {{item._Title}}
74 77 </td>
75 78 </tr>
76   -
  79 +
77 80 </tbody>
78 81 </table>
79 82 </div>
... ... @@ -94,8 +97,8 @@
94 97 </div>
95 98 </div>
96 99 </div>
97   - <div id="aiSpinner" class="spinner" ng-show="isLoading" style="visibility:hidden">
98   - <img id="img-spinner" src="content/images/common/loading.gif" alt="Loading" />
  100 + <div id="aiSpinner" class="spinner" ng-show="isLoading" style="visibility: hidden; opacity: 1; width: 100%; height: 100%; top: 0; bottom: 0%; left: 0; right: 0%; margin-left: 0px;">
  101 + <img id="img-spinner" class="spinner" src="content/images/common/loading.gif" alt="Loading" />
99 102 </div>
100 103 </div>
101 104  
... ...