Skip to content

Commit a2cfd15

Browse files
committed
Code optimization, Documentation update (1.0 changelog)
1 parent 1de3855 commit a2cfd15

File tree

4 files changed

+46
-19
lines changed

4 files changed

+46
-19
lines changed

doc/english.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,18 @@ <h2>Introduction</h2>
4545
</ul>
4646
<p><em>jQuery SuperBox!</em> can display <a href="#mode-image">pictures</a>, <a href="#mode-gallery">pictures galleries</a>, <a href="#mode-iframe">external pages</a>, a <a href="#mode-ajax">page element</a> or even <a href="#mode-ajax">AJAX loaded content</a>.</p>
4747

48+
<h2>New ! One-Point-O version !</h2>
49+
<p>jQuery SuperBox! 1.0 provides new features and optimisations.</p>
50+
<p>Here is the changelog:</p>
51+
<ul>
52+
<li><em>API<span>:</span></em> SuperBox! can now be filled programmatically, with <code>$.superbox.wait()</code> and <code>$.superbox.open()</code>.</li>
53+
<li><em>API<span>:</span></em> <code>$.superbox()</code> can be called multiple times to reinitialize SuperBox!.</li>
54+
<li><em>Accessibility<span>:</span></em> In addition to the arrows and the escape keys, it is now possible to use [TAB] and [ENTER] key to navigate in SuperBox!.</li>
55+
<li><em>Accessibility<span>:</span></em> During the opening, SuperBox! takes the focus. On closing, the initially clicked link takes the focus again.</li>
56+
<li><em>Auto mode<span>:</span></em> In AJAX mode, it is now possible to select an element with its <code>id</code> attribute.</li>
57+
<li><em>API<span>:</span></em> It is now possible to close SuperBox! programmatically, with the <code>$.superbox.close()</code> function.</li>
58+
<li><em>Accessibility<span>:</span></em> In iframe mode, a title attribute is defined on the iframe element. It takes the clicked link label.</li>
59+
</ul>
4860
<h2>Download</h2>
4961
<p>The minified version of SuperBox! is <strong>2kb</strong> when using GZip compressing, <strong>5.4kb</strong> otherwise.</p>
5062
<p><strong><a href="http://www.pierrebertet.net/projects/jquery_superbox/jquery-superbox-0.9.1.zip">Donwload jQuery SuperBox! 0.9.1 (zip)</a>

doc/francais.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,20 @@ <h2>Introduction</h2>
4040
<li>La <strong>licence MIT</strong>. Cette licence vous permet d'utiliser, de dupliquer, de modifier, de publier, de diffuser, de fusionner, de vendre et même de changer la licence de ce script. Votre seule obligation est de conserver le nom de l'auteur de ce script.</li>
4141
<li>C'est <strong>amusant</strong>.</li>
4242
</ul>
43-
<p><em>jQuery SuperBox!</em> permet d'afficher des <a href="#mode-image">images</a>, des <a href="#mode-gallery">galeries d'images</a>, des <a href="#mode-iframe">pages externes</a>, un <a href="#mode-content">élément de la page</a> et même un <a href="#mode-ajax">contenu chargé en AJAX</a>.</p>
43+
<p><em>jQuery SuperBox!</em> permet d'afficher des <a href="#mode-image">images</a>, des <a href="#mode-gallery">galeries d'images</a>, des <a href="#mode-iframe">pages externes</a>, un <a href="#mode-content">élément de la page</a> et même un <a href="#mode-ajax">contenu chargé en AJAX</a>. En fait, il est même possible de générer une SuperBox! depuis une fonction personnalisée.</p>
44+
45+
<h2>Nouvelle version un-point-zéro !</h2>
46+
<p>La version 1.0 de jQuery SuperBox! apporte d'importantes améliorations et de nombreuses optimisations.</p>
47+
<p>En voici une liste non exhaustive :</p>
48+
<ul>
49+
<li><em>API<span>:</span></em> Il est maintenant possible d'appeler et de remplir SuperBox! directement depuis le code, avec <code>$.superbox.wait()</code> et <code>$.superbox.open()</code>.</li>
50+
<li><em>API<span>:</span></em> <code>$.superbox()</code> peut maintenant être appelé plusieurs fois pour réinitialiser SuperBox!.</li>
51+
<li><em>Accessibilité<span>:</span></em> En plus des touches fléchées et de la touche echap, il est maintenant possible d'utiliser les touches [TAB] et [ENTRÉE] pour utiliser SuperBox!.</li>
52+
<li><em>Accessibilité<span>:</span></em> Lors de l'ouverture, SuperBox! prend le focus. Lorsque SuperBox! se ferme, le focus se repositionne sur le lien initialement cliqué.</li>
53+
<li><em>Mode auto<span>:</span></em> En mode AJAX, il est maintenant possible de sélectionner un élément à l'aide de son attribut <code>id</code>.</li>
54+
<li><em>API<span>:</span></em> Il est maintenant possible de fermer SuperBox!, à l'aide de la fonction <code>$.superbox.close()</code>.</li>
55+
<li><em>Accessibilité<span>:</span></em> En mode iframe, un attribut title est ajouté sur l'élément iframe. Celui-ci reprend le contenu du lien cliqué.</li>
56+
</ul>
4457

4558
<h2>Téléchargement</h2>
4659
<p>Le poids de la version compressée de SuperBox! est de <strong>2ko</strong> si la compression GZip est utilisée, et <strong>5,4ko</strong> sans.</p>

doc/styles/demo.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
body{padding:0;margin:0;font:12px Arial, Helvetica, sans-serif;color:#333;background:#e0e4cc;}
1+
body{padding:0;margin:0;font:12px/1.5 Arial, Helvetica, sans-serif;color:#333;background:#e0e4cc;}
22
a{color:#fa6900;}
33
#container{position:relative;overflow:hidden;width:820px;margin:0 auto;padding:0 20px 10px;background:#fff;}
44
h1{float:left;margin:20px 0 10px;padding:0;line-height:30px;font-size:24px;}
@@ -14,6 +14,8 @@ blockquote{margin:50px 40px 0;font-size:30px;quotes:"\201C" "\201D";}
1414
blockquote p:before{content:open-quote;font-weight:bold;}
1515
blockquote p:after{content:close-quote;font-weight:bold;}
1616
cite{float:right;margin-right:40px;display:inline;}
17+
ul em{padding:2px;font-size:11px;font-style:normal;color:#fff;background:#fa6900;}
18+
ul em span{position:absolute;left:-9999px;}
1719
.translations{float:right;margin-right:20px;top:0;margin:0;padding:0;display:inline;}
1820
.translations dt{margin:0;padding:0;text-indent:-9999px;}
1921
.translations dd{margin:0;padding:0;height:19px;}

jquery.superbox.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@
109109

110110
/*-- Superbox Method --*/
111111
$.fn.superbox = function(type, curSettings) {
112-
curSettings = $.extend({}, settings, curSettings);
113-
$.superbox[type](this, curSettings);
112+
113+
$.superbox[type](this, $.extend({}, settings, curSettings));
114114

115115
this.click(function(e) {
116116
e.preventDefault();
@@ -227,8 +227,8 @@
227227
var boxHeight = $curImg.height();
228228
}
229229

230-
curSettings = $.extend({}, curSettings, {
231-
boxClasses: (galleryMode? "gallery " : "image ") + curSettings.boxClasses,
230+
var localSettings = $.extend({}, curSettings, {
231+
boxClasses: (galleryMode? "gallery " : "image ") + curSettings.boxClasses,
232232
boxWidth: boxWidth,
233233
boxHeight: boxHeight,
234234
beforeOpen: function() {
@@ -240,7 +240,7 @@
240240
});
241241

242242
// Open SuperBox!
243-
$.superbox.open($curImg, curSettings);
243+
$.superbox.open($curImg, localSettings);
244244
});
245245

246246
// Append image to SuperBox! (to trigger loading)
@@ -287,10 +287,10 @@
287287
dims = extraSettings[0].split("x");
288288
}
289289

290-
curSettings = $.extend({}, curSettings, {
290+
var localSettings = $.extend({}, curSettings, {
291+
boxClasses: "iframe " + curSettings.boxClasses,
291292
boxWidth: dims[0] || curSettings.boxWidth,
292-
boxHeight: dims[1] || curSettings.boxHeight,
293-
boxClasses: "iframe " + curSettings.boxClasses
293+
boxHeight: dims[1] || curSettings.boxHeight
294294
});
295295

296296
// iframe element
@@ -300,7 +300,7 @@
300300
$iframe.one("load", function() {
301301

302302
// Open SuperBox!
303-
$.superbox.open($iframe, curSettings);
303+
$.superbox.open($iframe, localSettings);
304304
});
305305

306306
// Append iframe to SuperBox! (to trigger loading)
@@ -328,14 +328,14 @@
328328
}
329329

330330
// Specific settings
331-
curSettings = $.extend({}, curSettings, {
331+
var localSettings = $.extend({}, curSettings, {
332+
boxClasses: "content " + curSettings.boxClasses,
332333
boxWidth: dims[0] || curSettings.boxWidth,
333-
boxHeight: dims[1] || curSettings.boxHeight,
334-
boxClasses: "content " + curSettings.boxClasses
334+
boxHeight: dims[1] || curSettings.boxHeight
335335
});
336336

337337
// Open SuperBox!
338-
$.superbox.open($($elt.attr('href')).clone(), curSettings);
338+
$.superbox.open($($elt.attr('href')).clone().show(), localSettings);
339339
});
340340

341341
});
@@ -359,10 +359,10 @@
359359
}
360360

361361
// Extend default dimension settings
362-
curSettings = $.extend({}, curSettings, {
362+
var localSettings = $.extend({}, curSettings, {
363+
boxClasses: "ajax " + curSettings.boxClasses,
363364
boxWidth: dims[0] || curSettings.boxWidth,
364-
boxHeight: dims[1] || curSettings.boxHeight,
365-
boxClasses: "ajax " + curSettings.boxClasses
365+
boxHeight: dims[1] || curSettings.boxHeight
366366
});
367367

368368
// Get Ajax URL + ID
@@ -378,7 +378,7 @@
378378
}
379379

380380
// Open SuperBox!
381-
$.superbox.open(data, curSettings);
381+
$.superbox.open(data, localSettings);
382382
});
383383
});
384384
});

0 commit comments

Comments
 (0)