Skip to content

Commit dca46cf

Browse files
author
hqcasanova
committed
New build: simplified loading indicator infrastructure (just a
background image now). -Modified README to reflect changes in loading indicator. -New json files for bower and npm.
1 parent 5b93d50 commit dca46cf

File tree

5 files changed

+29
-43
lines changed

5 files changed

+29
-43
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,15 @@ There are two kinds of settings: those having to do with the slides and those mo
118118

119119
- `altAttr` *''*: alt attribute for all img elements.
120120
- `lazyAttr` *'data-original'*: lazy Load plugin's name for src attribute.
121-
- `loadingImg` *base-64 gif*: animated image displayed while loading in progress.
121+
- `loadingImg` *base-64 gif*: animated image displayed while loading is in progress. It's the main container's background.
122122
- `cssButtonSize` *'45px'*: size of all controls.
123-
- `cssPadding` *'15px'*: default padding for secondary containers (loading indicator and slide counter).
123+
- `cssPadding` *'15px'*: default padding for secondary containers (slide counter).
124124
- `cssFontSize` *'.9em'*: default font size for all text elements.
125125
- `cssLineHeight` *'1.5em'*: default line height for all text elements.
126126
- `cssFontFamily` *'sans-serif'*: default font family for all text elements.
127127
- `cssBgColor` *'gray'*: background colour for controls and main container.
128128
- `cssFgColor` *'white'*: foreground colour for text and control symbols.
129-
- `cssSeparation` *'1.5%'*: default separation between edge of slides container and controls.
129+
- `cssSeparation` *'1.5%'*: default separation between the edge of the main container and the various controls.
130130
- `cssRadius` *'0px'*: border radius of all elements.
131131
- `cssOpacity` *0.65*: opacity of all interface elements.
132132

@@ -177,15 +177,14 @@ Plugin Architecture
177177
<span class="controlSlide hideFirstSlide skipBSlide"></span> <!-- 'Skip backward' button -->
178178
<span class="controlSlide hideLastSlide nextSlide"></span> <!-- 'Next' button -->
179179
<span class="countSlide"></span> <!-- Slide counter -->
180-
<span class="loadingSlide"></span> <!-- Loading indicator -->
181180
</div>
182181
```
183182
- The plugin tries to make **minimal use of jQuery**. Future implementations will ultimately be library-agnostic.
184183

185184
License
186185
-------
187186

188-
All code is licensed under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). In essence, use and modify at your own peril and leave the copyright header intact.
187+
All code is licensed under the [MIT License](http://opensource.org/licenses/MIT). In essence, use and modify at your own peril and leave the copyright header intact.
189188

190189
Feedback
191190
--------

bower.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{
22
"name": "picoSlides",
33
"main": "picoSlides.js",
4-
"version": "1.0.0",
5-
"homepage": "https://github.com/hqcasanova/picoSlides",
4+
"version": "1.0.1",
5+
"homepage": "http://hqcasanova.github.io/picoSlides/",
6+
"repository": {
7+
"type": "git",
8+
"url": "git://github.com/hqcasanova/picoSlides.git"
9+
},
610
"authors": [
711
"hqcasanova <[email protected]>"
812
],
@@ -24,7 +28,7 @@
2428
],
2529
"dependencies": {
2630
"jquery": ">=1.6.0"
27-
},
31+
},
2832
"license": "MIT",
2933
"ignore": [
3034
"**/.*",

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "picoslides",
3-
"version": "1.0.0",
4-
"summary": "A responsive jQuery plugin for IFRAME-free embedding and simple navigation of SlideShare presentations",
5-
"description": "Leverages SlideShare's oEmbed API to offer two key features for bandwidth-conscious embedding: adaptive slide images for responsive interfaces and lazy slide loading a la YouTube",
3+
"version": "1.0.1",
4+
"description": "A responsive jQuery plugin for IFRAME-free embedding and simple navigation of SlideShare presentations.",
65
"main": "picoSlides.js",
76
"scripts": {
87
"test": "echo \"Error: no test specified\" && exit 1"
@@ -35,7 +34,10 @@
3534
"bugs": {
3635
"url": "https://github.com/hqcasanova/picoSlides/issues"
3736
},
38-
"homepage": "https://github.com/hqcasanova/picoSlides",
37+
"homepage": "http://hqcasanova.github.io/picoSlides/",
38+
"dependencies": {
39+
"jquery": ">=1.6.0"
40+
},
3941
"devDependencies": {
4042
"grunt": "^0.4.4",
4143
"grunt-contrib-jshint": "^0.10.0",

picoSlides.js

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* picoSlides v1.0.0
1+
/* picoSlides v1.0.1
22
* Copyright (c) 2014 Hector Quintero Casanova
33
* Released under the MIT license
44
*/
@@ -52,7 +52,6 @@
5252
vBarCommonStyle, //CSS properties for vertical bar in FF and RW buttons
5353
countElem, //Outermost native span element wrapping bottom slide counter
5454
countChild, //First immediate descendant of countElem
55-
loadElem, //Native image element for loading indicator
5655
firstElem, //Native image element for the first slide
5756
slideElem, //Native image element for slides other than the first (added in bulk)
5857
noSelect = { //CSS for non-selectable items
@@ -74,7 +73,7 @@
7473
container.style.textAlign = 'center';
7574
container.style.lineHeight = 0; //Solves issue in HTML5 about a gap between container and the bottom of slide images
7675
container.style.color = elementDefs.cssFgColor;
77-
container.style.background = elementDefs.cssBgColor;
76+
container.style.background = 'url("' + elementDefs.loadingImg + '") center center no-repeat ' + elementDefs.cssBgColor;
7877
container.style.borderRadius = elementDefs.cssRadius;
7978
$(container).css(noSelect);
8079
return;
@@ -123,16 +122,6 @@
123122
'vertical-align': 'middle'
124123
};
125124

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-
136125
firstElem = document.createElement('img');
137126
firstElem.alt = elementDefs.altAttr;
138127
firstElem.style.width = '100%';
@@ -142,16 +131,16 @@
142131
firstElem.className = 'firstSlide';
143132

144133
slideElem.style.position = 'absolute';
145-
slideElem.style.top = '0';
146-
slideElem.style.left = '0';
134+
slideElem.style.top = 0;
135+
slideElem.style.left = 0;
147136
slideElem.style.visibility = 'hidden';
148-
slideElem.style.opacity = '0';
137+
slideElem.style.opacity = 0;
149138

150139
countElem = document.createElement('span');
151140
countElem.className = 'countSlide';
152141
countElem.style.display = 'none'; //in case the presentation is just 1 slide long
153142
countElem.style.position = 'absolute';
154-
countElem.style.bottom = '0';
143+
countElem.style.bottom = 0;
155144
countElem.style.left = '25%';
156145
countElem.style.right = '25%';
157146
countElem.style.backgroundColor = 'transparent';
@@ -251,9 +240,6 @@
251240
//Slide counter
252241
count: countElem,
253242

254-
//Loading indicator image
255-
load: loadElem,
256-
257243
//First slide
258244
first: firstElem,
259245

@@ -276,7 +262,6 @@
276262
this.sourceUrl = this.$elem.data('src'); //URL of the presentation on Slideshare
277263
this.toLoad = -1; //number of slides left to load
278264
this.counter = null; //Native span element for the slide counter
279-
this.loadingImg = null; //Native img element for the loading indicator
280265
this.currentSlide = null; //Native img element for slide currently being displayed
281266
};
282267

@@ -315,7 +300,6 @@
315300
init: function () {
316301
this.settings = $.extend({}, this.defaults, this.options, this.metadata);
317302
elementLibrary(this.elem);
318-
this.loadingImg = this.elem.appendChild(elementLib.load.cloneNode(false));
319303
this.getCover();
320304
this.elem.thisRef = this;
321305
//The thisRef is for later use within onload event handlers (see 'onLoadHandler' function)
@@ -329,11 +313,11 @@
329313
*/
330314
loading: function (wait) {
331315
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 + '")';
334318
} 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';
337321
}
338322
},
339323

@@ -446,9 +430,6 @@
446430
_this = this;
447431

448432
//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';
452433
this.loading(true);
453434

454435
//Builds and prepares first slide, next button and counter for DOM insertion

0 commit comments

Comments
 (0)