Skip to content

Commit 27f364f

Browse files
committed
Merge pull request #5 from tuchong/bugfix
Bugfix
2 parents 17a2a55 + 664f9a3 commit 27f364f

File tree

7 files changed

+24
-16
lines changed

7 files changed

+24
-16
lines changed

src/javascript/controllers/home.js

+13-9
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898

9999
// Load cover image
100100
loadCover(targetIndex, {
101+
showLoading: true,
101102
setupChildrenSwiper: true,
102103
loadFirstChild: true
103104
});
@@ -120,10 +121,10 @@
120121
slides = new Swiper('.swiper-container-collection', {
121122
onSlideChangeStart: function() {
122123
loadCover(slides.activeIndex, {
124+
showLoading: true,
123125
setupChildrenSwiper: true,
124126
loadFirstChild: true
125127
});
126-
loadCover(slides.activeIndex + 1);
127128
}
128129
});
129130
}, 10);
@@ -136,13 +137,13 @@
136137

137138
// If this collection have on one picture
138139
if (scope.collections[index].images.length === 1)
139-
return loadImage(index);
140+
return loadImage(index, opts);
140141

141-
loadChildImage(index, 0);
142+
loadChildImage(index, 0, opts);
142143

143144
// Load its first child if required
144145
if (opts && opts.loadFirstChild)
145-
loadChildImage(index, 1);
146+
loadChildImage(index, 1, opts);
146147

147148
if (!opts || !opts.setupChildrenSwiper)
148149
return;
@@ -169,13 +170,13 @@
169170
childrenSlides[index] = new Swiper('#children-' + index, {
170171
direction: 'vertical',
171172
onSlideChangeStart: function() {
172-
loadChildImage(index, childrenSlides[index].activeIndex + 1);
173+
loadChildImage(index, childrenSlides[index].activeIndex);
173174
}
174175
});
175176
}
176177

177178
// Update slides async
178-
function loadImage(index) {
179+
function loadImage(index, opts) {
179180
if (backgrounds[index])
180181
return scope.$apply();
181182

@@ -184,11 +185,12 @@
184185
function(localImage) {
185186
backgrounds[index] = localImage;
186187
scope.$apply();
187-
}
188+
},
189+
(opts && opts.showLoading) || true
188190
);
189191
}
190192

191-
function loadChildImage(parentIndex, index) {
193+
function loadChildImage(parentIndex, index, opts) {
192194
if (Array.isArray(childrens[parentIndex]) && childrens[parentIndex][index])
193195
return scope.$apply();
194196

@@ -206,7 +208,9 @@
206208
function(localImage) {
207209
childrens[parentIndex][index] = localImage;
208210
scope.$apply();
209-
}
211+
},
212+
// ALWAYS show loading
213+
(opts && opts.showLoading) || true
210214
);
211215
}
212216

src/javascript/services/imageloader.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
function imageLoader($ionicLoading, $timeout) {
1717
this.load = load;
1818

19-
function load(uri, callback) {
20-
$ionicLoading.show();
19+
function load(uri, callback, showloading) {
20+
if (showloading)
21+
$ionicLoading.show();
2122

2223
var img = new BlobImage(ismobile ? uri : proxy(uri));
2324
img.element.onload = success;

src/less/app.less

+5
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@
6262
font-size: 16px;
6363
font-weight: bold;
6464
margin-bottom: 13px;
65+
66+
a {
67+
text-decoration: none;
68+
color: #fff;
69+
}
6570
}
6671

6772
.excerpt {

www/dist/css/app.min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)