|
1 | | -/* picoSlides v1.0.0 |
| 1 | +/* picoSlides v1.0.1 |
2 | 2 | * Copyright (c) 2014 Hector Quintero Casanova |
3 | 3 | * Released under the MIT license |
4 | 4 | */ |
|
52 | 52 | vBarCommonStyle, //CSS properties for vertical bar in FF and RW buttons |
53 | 53 | countElem, //Outermost native span element wrapping bottom slide counter |
54 | 54 | countChild, //First immediate descendant of countElem |
55 | | - loadElem, //Native image element for loading indicator |
56 | 55 | firstElem, //Native image element for the first slide |
57 | 56 | slideElem, //Native image element for slides other than the first (added in bulk) |
58 | 57 | noSelect = { //CSS for non-selectable items |
|
74 | 73 | container.style.textAlign = 'center'; |
75 | 74 | container.style.lineHeight = 0; //Solves issue in HTML5 about a gap between container and the bottom of slide images |
76 | 75 | container.style.color = elementDefs.cssFgColor; |
77 | | - container.style.background = elementDefs.cssBgColor; |
| 76 | + container.style.background = 'url("' + elementDefs.loadingImg + '") center center no-repeat ' + elementDefs.cssBgColor; |
78 | 77 | container.style.borderRadius = elementDefs.cssRadius; |
79 | 78 | $(container).css(noSelect); |
80 | 79 | return; |
|
123 | 122 | 'vertical-align': 'middle' |
124 | 123 | }; |
125 | 124 |
|
126 | | - loadElem = document.createElement('img'); |
127 | | - loadElem.className = 'loadingSlide'; |
128 | | - loadElem.src = elementDefs.loadingImg; |
129 | | - loadElem.style.padding = elementDefs.cssPadding; |
130 | | - loadElem.style.backgroundColor = elementDefs.cssBgColor; |
131 | | - loadElem.style.opacity = elementDefs.cssOpacity; |
132 | | - loadElem.style.borderRadius = elementDefs.cssRadius; |
133 | | - loadElem.style.top = '50%'; |
134 | | - loadElem.style.left = '50%'; |
135 | | - |
136 | 125 | firstElem = document.createElement('img'); |
137 | 126 | firstElem.alt = elementDefs.altAttr; |
138 | 127 | firstElem.style.width = '100%'; |
|
142 | 131 | firstElem.className = 'firstSlide'; |
143 | 132 |
|
144 | 133 | slideElem.style.position = 'absolute'; |
145 | | - slideElem.style.top = '0'; |
146 | | - slideElem.style.left = '0'; |
| 134 | + slideElem.style.top = 0; |
| 135 | + slideElem.style.left = 0; |
147 | 136 | slideElem.style.visibility = 'hidden'; |
148 | | - slideElem.style.opacity = '0'; |
| 137 | + slideElem.style.opacity = 0; |
149 | 138 |
|
150 | 139 | countElem = document.createElement('span'); |
151 | 140 | countElem.className = 'countSlide'; |
152 | 141 | countElem.style.display = 'none'; //in case the presentation is just 1 slide long |
153 | 142 | countElem.style.position = 'absolute'; |
154 | | - countElem.style.bottom = '0'; |
| 143 | + countElem.style.bottom = 0; |
155 | 144 | countElem.style.left = '25%'; |
156 | 145 | countElem.style.right = '25%'; |
157 | 146 | countElem.style.backgroundColor = 'transparent'; |
|
251 | 240 | //Slide counter |
252 | 241 | count: countElem, |
253 | 242 |
|
254 | | - //Loading indicator image |
255 | | - load: loadElem, |
256 | | - |
257 | 243 | //First slide |
258 | 244 | first: firstElem, |
259 | 245 |
|
|
276 | 262 | this.sourceUrl = this.$elem.data('src'); //URL of the presentation on Slideshare |
277 | 263 | this.toLoad = -1; //number of slides left to load |
278 | 264 | this.counter = null; //Native span element for the slide counter |
279 | | - this.loadingImg = null; //Native img element for the loading indicator |
280 | 265 | this.currentSlide = null; //Native img element for slide currently being displayed |
281 | 266 | }; |
282 | 267 |
|
|
315 | 300 | init: function () { |
316 | 301 | this.settings = $.extend({}, this.defaults, this.options, this.metadata); |
317 | 302 | elementLibrary(this.elem); |
318 | | - this.loadingImg = this.elem.appendChild(elementLib.load.cloneNode(false)); |
319 | 303 | this.getCover(); |
320 | 304 | this.elem.thisRef = this; |
321 | 305 | //The thisRef is for later use within onload event handlers (see 'onLoadHandler' function) |
|
329 | 313 | */ |
330 | 314 | loading: function (wait) { |
331 | 315 | if (wait) { |
332 | | - this.elem.style.cursor = 'wait'; |
333 | | - this.loadingImg.style.display = 'block'; |
| 316 | + //this.elem.style.cursor = 'wait'; |
| 317 | + this.elem.style.backgroundImage = 'url("' + elementDefs.loadingImg + '")'; |
334 | 318 | } else { |
335 | | - this.elem.style.cursor = 'default'; |
336 | | - this.loadingImg.style.display = 'none'; |
| 319 | + //this.elem.style.cursor = 'default'; |
| 320 | + this.elem.style.backgroundImage = 'none'; |
337 | 321 | } |
338 | 322 | }, |
339 | 323 |
|
|
446 | 430 | _this = this; |
447 | 431 |
|
448 | 432 | //Feedback: show loading indicator (centered on image) and wait cursor |
449 | | - this.loadingImg.style.position = 'absolute'; |
450 | | - this.loadingImg.style.marginLeft = '-' + ($(this.loadingImg).width() / 2 + parseInt(elementDefs.cssPadding, 10)) + 'px'; |
451 | | - this.loadingImg.style.marginTop = '-' + ($(this.loadingImg).height() / 2 + parseInt(elementDefs.cssPadding, 10)) + 'px'; |
452 | 433 | this.loading(true); |
453 | 434 |
|
454 | 435 | //Builds and prepares first slide, next button and counter for DOM insertion |
|
0 commit comments