Commit 6d0c0a57ee8420b8cd229be1e97f013e53850da0
1 parent
c19f61ba
bug fxing
Showing
1 changed file
with
77 additions
and
24 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js
... | ... | @@ -16,31 +16,83 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
16 | 16 | SearchText: '', |
17 | 17 | SearchTextByAlphabet: '', |
18 | 18 | }; |
19 | + $(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'); | |
30 | + }); | |
31 | + | |
32 | + | |
33 | + $(document).ready(function () { | |
34 | + var Count = 200; | |
35 | + localStorage.setItem("ImageCount", Count); | |
36 | + var searchByText = $rootScope.getLocalStorageValue("SearchText"); | |
37 | + var searchTextByAlphabet = $rootScope.getLocalStorageValue("SearchByAlphabet"); | |
38 | + $(window).scroll(function () { | |
39 | + if ($(window).scrollTop() == $(document).height() - $(window).height()) { | |
40 | + Count += 100; | |
41 | + var ImageCount = $rootScope.getLocalStorageValue("ImageCount"); | |
42 | + if (typeof (searchByText) !== "undefined" && searchByText !== null && searchByText !== '') { | |
43 | + $scope.query.SearchText = searchByText; | |
44 | + } | |
45 | + else if (typeof (searchTextByAlphabet) !== "undefined" && searchTextByAlphabet !== null && searchTextByAlphabet !== '') { | |
46 | + $scope.query.SearchTextByAlphabet = searchTextByAlphabet; | |
47 | + } | |
48 | + else { | |
49 | + $scope.query.SearchTextByAlphabet = ""; | |
50 | + } | |
51 | + | |
52 | + if ($scope.query.SearchText == "" && $scope.query.SearchTextByAlphabet == "") { | |
53 | + | |
54 | + $scope.LoadAIJsonData(Count); | |
55 | + $scope.loadAllAI(Count); | |
56 | + } | |
57 | + else if ($scope.query.SearchTextByAlphabet != "" || $scope.query.SearchText == "") { | |
58 | + $scope.ApplySearchByAlphabet($scope.query.SearchTextByAlphabet); | |
59 | + } | |
60 | + else { | |
61 | + $scope.ApplySearch($scope.query); | |
62 | + } | |
63 | + } | |
64 | + }); | |
65 | + | |
66 | + }); | |
19 | 67 | |
20 | 68 | $scope.setActiveTab = function (tabToSet) { |
21 | 69 | $scope.activeTab = tabToSet; |
22 | 70 | localStorage.setItem("currentAITabView", $scope.activeTab); |
71 | + var ImageCount = $rootScope.getLocalStorageValue("ImageCount"); | |
23 | 72 | if (tabToSet == 2) { |
24 | 73 | var curSelectedRowId = $rootScope.getLocalStorageValue("AISelectedRowId"); |
25 | 74 | $('#' + $rootScope.getLocalStorageValue("currentAIImageId")).addClass("selected"); |
26 | 75 | $scope.idSelected = $rootScope.getLocalStorageValue("currentAIImageId"); |
27 | 76 | var selectedImageId = $rootScope.getLocalStorageValue("currentAIImageId"); |
28 | - $scope.LoadAIJsonData(); | |
29 | - $scope.ReloadListViewImageDiv(selectedImageId); | |
77 | + $scope.LoadAIJsonData(ImageCount); | |
78 | + $scope.ReloadListViewImageDiv(selectedImageId, ImageCount); | |
30 | 79 | $scope.showItem(selectedImageId); |
31 | 80 | } |
32 | 81 | else { |
33 | 82 | $('#' + $rootScope.getLocalStorageValue("currentAIImageId")).find('.thumbnail').addClass('HightLightThumbnail'); |
34 | 83 | $('#' + $rootScope.getLocalStorageValue("currentAIImageId")).removeClass('selected'); |
35 | - $scope.loadAllAI(); | |
84 | + $scope.loadAllAI(ImageCount); | |
36 | 85 | } |
37 | 86 | }; |
38 | 87 | |
39 | 88 | $scope.$on('$viewContentLoaded', function (event) { |
40 | 89 | |
90 | + var ImageCount = $rootScope.getLocalStorageValue("ImageCount"); | |
91 | + | |
41 | 92 | if ($rootScope.refreshcheck == null) { |
42 | 93 | $location.path('/'); |
43 | 94 | } |
95 | + | |
44 | 96 | // code that will be executed ... |
45 | 97 | // every time this view is loaded |
46 | 98 | |
... | ... | @@ -55,7 +107,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
55 | 107 | $rootScope.currentActiveModuleTitle = selectedModuleName; |
56 | 108 | }) |
57 | 109 | |
58 | - $scope.LoadAIJsonData(); | |
110 | + $scope.LoadAIJsonData(ImageCount); | |
59 | 111 | $scope.scroll(); |
60 | 112 | //push the details of open module in array $rootScope.openModules |
61 | 113 | $rootScope.openModules.push({ "ModuleId": 13 }); |
... | ... | @@ -69,7 +121,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
69 | 121 | if (typeof (curSelectedRowId) !== "undefined" && curSelectedRowId !== null && curSelectedRowId !== '') { |
70 | 122 | $scope.reRunSearchOnLoad(); |
71 | 123 | $scope.idSelected = curSelectedRowId; |
72 | - $scope.ReloadListViewImageDiv($scope.idSelected); | |
124 | + $scope.ReloadListViewImageDiv($scope.idSelected, ImageCount); | |
73 | 125 | } |
74 | 126 | else { |
75 | 127 | $scope.reRunSearchOnLoad() |
... | ... | @@ -87,6 +139,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
87 | 139 | |
88 | 140 | var searchByText = $rootScope.getLocalStorageValue("SearchText"); |
89 | 141 | var searchTextByAlphabet = $rootScope.getLocalStorageValue("SearchByAlphabet"); |
142 | + var ImageCount = $rootScope.getLocalStorageValue("ImageCount"); | |
90 | 143 | |
91 | 144 | if (typeof (searchByText) !== "undefined" && searchByText !== null && searchByText !== '') { |
92 | 145 | $scope.query.SearchText = searchByText; |
... | ... | @@ -101,7 +154,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
101 | 154 | |
102 | 155 | if ($scope.query.SearchText == "" && $scope.query.SearchTextByAlphabet == "") { |
103 | 156 | |
104 | - $scope.loadAllAI(); | |
157 | + $scope.loadAllAI(ImageCount); | |
105 | 158 | } |
106 | 159 | else if ($scope.query.SearchTextByAlphabet != "" || $scope.query.SearchText == "") |
107 | 160 | { |
... | ... | @@ -113,7 +166,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
113 | 166 | |
114 | 167 | } |
115 | 168 | |
116 | - $scope.LoadAIJsonData = function () { | |
169 | + $scope.LoadAIJsonData = function (ImageCount) { | |
117 | 170 | $('ul li a').removeAttr("style"); |
118 | 171 | var promise = DataService.getJson('~/../content/data/json/ai/ai_dat_contentlist.json') |
119 | 172 | promise.then( |
... | ... | @@ -122,7 +175,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
122 | 175 | $scope.selectedAIListViewData = new jinqJs() |
123 | 176 | .from($scope.IllustrationData.root.AIData) |
124 | 177 | .orderBy([{ field: '_Title', sort: 'asc' }]) |
125 | - .select(); | |
178 | + .select().slice(0, ImageCount); | |
126 | 179 | |
127 | 180 | }, |
128 | 181 | function (error) { |
... | ... | @@ -134,7 +187,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
134 | 187 | |
135 | 188 | }; |
136 | 189 | |
137 | - $scope.loadAllAI = function () { | |
190 | + $scope.loadAllAI = function (ImageCount) { | |
138 | 191 | $rootScope.isLoading = true; |
139 | 192 | localStorage.setItem("SearchText", ''); |
140 | 193 | localStorage.setItem("SearchByAlphabet", ''); |
... | ... | @@ -149,7 +202,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
149 | 202 | $scope.selectedAIListViewData = new jinqJs() |
150 | 203 | .from($scope.IllustrationData.root.AIData) |
151 | 204 | .orderBy([{ field: '_Title', sort: 'asc' }]) |
152 | - .select(); | |
205 | + .select().slice(0,ImageCount); | |
153 | 206 | |
154 | 207 | //console.log($scope.selectedAIListViewData); |
155 | 208 | |
... | ... | @@ -165,7 +218,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
165 | 218 | $timeout(function () { |
166 | 219 | $('#' + $rootScope.getLocalStorageValue("currentAIImageId")).find('.thumbnail').addClass('HightLightThumbnail'); |
167 | 220 | if ($rootScope.getLocalStorageValue('AIGridViewScroll') !== null && $location.url() == "/ADAM-images") { |
168 | - $('html, body').animate({ scrollTop: $rootScope.getLocalStorageValue('AIGridViewScroll') }); | |
221 | + //$('html, body').animate({ scrollTop: $rootScope.getLocalStorageValue('AIGridViewScroll') }); | |
169 | 222 | } |
170 | 223 | }, 100); |
171 | 224 | |
... | ... | @@ -232,7 +285,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
232 | 285 | localStorage.setItem("SearchText", ''); |
233 | 286 | localStorage.setItem("SearchByAlphabet", ''); |
234 | 287 | localStorage.setItem("AIListViewScroll", ''); |
235 | - | |
288 | + var ImageCount = $rootScope.getLocalStorageValue("ImageCount"); | |
236 | 289 | if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); } |
237 | 290 | |
238 | 291 | $('#ListViewDiv').scrollTop(0); |
... | ... | @@ -243,7 +296,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
243 | 296 | while ($scope.searchAIListViewData.length) { |
244 | 297 | $scope.searchAIListViewData.pop(); |
245 | 298 | } |
246 | - $scope.loadAllAI(); | |
299 | + $scope.loadAllAI(ImageCount); | |
247 | 300 | } |
248 | 301 | |
249 | 302 | $scope.ApplySearch = function (query) { |
... | ... | @@ -316,10 +369,10 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
316 | 369 | $compile($el)($scope); |
317 | 370 | |
318 | 371 | |
319 | - $(".sidebar").mCustomScrollbar({ | |
320 | - autoHideScrollbar: true, | |
321 | - //theme:"rounded" | |
322 | - }); | |
372 | + //$(".sidebar").mCustomScrollbar({ | |
373 | + // autoHideScrollbar: true, | |
374 | + // //theme:"rounded" | |
375 | + //}); | |
323 | 376 | $scope.searchAIListViewData.push( |
324 | 377 | { |
325 | 378 | "_id": value._id, |
... | ... | @@ -411,10 +464,10 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
411 | 464 | |
412 | 465 | $compile($el)($scope); |
413 | 466 | |
414 | - $(".sidebar").mCustomScrollbar({ | |
415 | - autoHideScrollbar: true, | |
416 | - //theme:"rounded" | |
417 | - }); | |
467 | + //$(".sidebar").mCustomScrollbar({ | |
468 | + // autoHideScrollbar: true, | |
469 | + // //theme:"rounded" | |
470 | + //}); | |
418 | 471 | $scope.searchAIListViewData.push( |
419 | 472 | { |
420 | 473 | "_id": value._id, |
... | ... | @@ -446,7 +499,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
446 | 499 | |
447 | 500 | |
448 | 501 | $scope.scroll = function () { |
449 | - $("html,body").scrollTop(0); | |
502 | + //$("html,body").scrollTop(0); | |
450 | 503 | } |
451 | 504 | |
452 | 505 | |
... | ... | @@ -582,7 +635,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
582 | 635 | $rootScope.FreeStylePaint(); |
583 | 636 | }); |
584 | 637 | |
585 | - $scope.ReloadListViewImageDiv = function (id) { | |
638 | + $scope.ReloadListViewImageDiv = function (id,imgCount) { | |
586 | 639 | //console.log(id); |
587 | 640 | $scope.idSelected = id; |
588 | 641 | $scope.hiderow = true; |
... | ... | @@ -599,7 +652,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
599 | 652 | SelectedAIthumbImage = new jinqJs() |
600 | 653 | .from($scope.IllustrationData.root.AIData) |
601 | 654 | .where('_id = ' + id) |
602 | - .select('_ThumbnailImage', '_id', '_Title'); | |
655 | + .select('_ThumbnailImage', '_id', '_Title').slice(0, imgCount); | |
603 | 656 | |
604 | 657 | $scope.SelectedAIthumbImage = "~/../content/images/ai/thumbnails/" + SelectedAIthumbImage[0]._ThumbnailImage; |
605 | 658 | $scope.SelectedAIId = SelectedAIthumbImage[0]._id; | ... | ... |