Skip to content

Commit b816afc

Browse files
committed
Doc update : AJAX support.
1 parent 98fa995 commit b816afc

File tree

6 files changed

+56
-9
lines changed

6 files changed

+56
-9
lines changed

doc/crockford-ajax.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<blockquote cite="http://scripting.wordpress.com/2006/12/20/scripting-news-for-12202006/#comment-26383"><p>The good thing about reinventing the wheel is that you can get a round one.</p></blockquote>
2+
<p><cite><a href="http://en.wikipedia.org/wiki/Douglas_Crockford">Douglas Crockford</a></cite></p>

doc/crockford.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4+
<head>
5+
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
6+
<title>jQuery SuperBox! AJAX demo</title>
7+
<link rel="stylesheet" href="styles/demo.css" type="text/css" media="all" />
8+
</head>
9+
<body>
10+
<div id="container">
11+
<blockquote cite="http://scripting.wordpress.com/2006/12/20/scripting-news-for-12202006/#comment-26383"><p>The good thing about reinventing the wheel is that you can get a round one.</p></blockquote>
12+
<p><cite><a href="http://en.wikipedia.org/wiki/Douglas_Crockford">Douglas Crockford</a></cite></p>
13+
</div>
14+
</body>
15+
</html>

doc/english.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ <h2>Contribute</h2>
6565
<h2>Getting started</h2>
6666
<p>To install this script, you must include on your page <a href="http://jquery.com/">jQuery</a>, as well as the files <strong>jquery.superbox-min.js</strong> (minified version) and <strong>jquery.superbox.css</strong>:</p>
6767
<pre><code>&lt;link rel=&quot;stylesheet&quot; href=&quot;jquery.superbox.css&quot; type=&quot;text/css&quot; media=&quot;all&quot; /&gt;
68-
&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;&gt;&lt;/script&gt;
68+
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery-min.js&quot;&gt;&lt;/script&gt;
6969
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.superbox-min.js&quot;&gt;&lt;/script&gt;</code></pre>
7070

7171
<p>By default, the superbox is generated from the <code>rel</code> attribute of a link. It must contain the word <code>superbox</code>, followed by the display mode in square brackets: <code>rel="superbox[<strong>display_mode</strong>]"</code>.</p>
@@ -165,6 +165,18 @@ <h3>Demo</h3>
165165
<h3>Use</h3>
166166
<pre><code>&lt;a href="#box-content" rel="superbox[content]"&gt;SuperBox&lt;/a&gt;</code></pre>
167167
</div>
168+
169+
<div id="mode-ajax">
170+
<h2>AJAX mode</h2>
171+
<p>Generates a box containing an HTML fragment loaded with AJAX.</p>
172+
<p>The link point to a complete HTML document (non-intrusive version), while the AJAX URL takes place in second parameter.</p>
173+
<h3>Démonstration</h3>
174+
<p><a href="crockford.html" rel="superbox[ajax][crockford-ajax.html]">AJAX SuperBox</a></p>
175+
<p><a href="crockford.html" rel="superbox[ajax][crockford-ajax.html][500x400]">AJAX SuperBox (dimensions)</a></p>
176+
<h3>Utilisation</h3>
177+
<pre><code>&lt;a href="#box-content" rel="superbox[content]"&gt;SuperBox&lt;/a&gt;</code></pre>
178+
</div>
179+
168180
</div>
169181
</body>
170182
</html>

doc/francais.html

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ <h2>Introduction</h2>
4949
<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>
5050
<li>C'est <strong>amusant</strong>.</li>
5151
</ul>
52-
<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>, ou même <a href="#mode-content">un élément de la page</a>.</p>
52+
<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-content">contenu chargé en AJAX</a>.</p>
5353

5454
<h2>Téléchargement</h2>
5555
<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>
@@ -62,7 +62,7 @@ <h2>Contribuer</h2>
6262
<h2>Mise en route</h2>
6363
<p>Pour installer ce script, vous devez inclure sur votre page <a href="http://jquery.com/">jQuery</a>, ainsi que les fichiers <strong>jquery.superbox-min.js</strong> (version compressée) et <strong>jquery.superbox.css</strong> :</p>
6464
<pre><code>&lt;link rel=&quot;stylesheet&quot; href=&quot;jquery.superbox.css&quot; type=&quot;text/css&quot; media=&quot;all&quot; /&gt;
65-
&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;&gt;&lt;/script&gt;
65+
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery-min.js&quot;&gt;&lt;/script&gt;
6666
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.superbox-min.js&quot;&gt;&lt;/script&gt;</code></pre>
6767

6868
<p>Par défaut, la superbox est générée d'après l'attribut <code>rel</code> d'un lien. Il doit contenir le mot <code>superbox</code>, suivi du mode d'affichage entre crochets : <code>rel="superbox[<strong>mode_affichage</strong>]"</code>.</p>
@@ -150,14 +150,26 @@ <h3>Utilisation</h3>
150150
<div id="mode-content">
151151
<h2>Mode contenu</h2>
152152
<p>Générer une box contenant un élément de la page.</p>
153-
<p>Le lien sera interne, et pointera vers un élément de la page à l'aide de son attribut <strong>id</strong>.</p>
153+
<p>Le lien sera interne, et pointera vers un élément de la page à l'aide de son attribut <code>id</code>.</p>
154154
<p>Cet élément sera copié pour apparaître dans Superbox.</p>
155155
<h3>Démonstration</h3>
156156
<p><a href="#mode-content" rel="superbox[content]">Élément SuperBox</a></p>
157157
<p><a href="#mode-content" rel="superbox[content][500x400]">Élément SuperBox (dimensions)</a></p>
158158
<h3>Utilisation</h3>
159159
<pre><code>&lt;a href="#box-content" rel="superbox[content]"&gt;SuperBox&lt;/a&gt;</code></pre>
160160
</div>
161+
162+
<div id="mode-ajax">
163+
<h2>Mode AJAX</h2>
164+
<p>Générer une box contenant un fragment HTML chargé en AJAX.</p>
165+
<p>Le lien pointe vers un document HTML complet (version non intrusive), tandis que l'URL de l'appel AJAX se trouve dans le second paramètre.</p>
166+
<h3>Démonstration</h3>
167+
<p><a href="crockford.html" rel="superbox[ajax][crockford-ajax.html]">AJAX SuperBox</a></p>
168+
<p><a href="crockford.html" rel="superbox[ajax][crockford-ajax.html][500x400]">AJAX SuperBox (dimensions)</a></p>
169+
<h3>Utilisation</h3>
170+
<pre><code>&lt;a href="#box-content" rel="superbox[content]"&gt;SuperBox&lt;/a&gt;</code></pre>
171+
</div>
172+
161173
</div>
162174
</body>
163175
</html>

doc/styles/demo.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ code{background:#a7dbd8;}
1010
pre code{font:12px monospace;}
1111
ul{list-style-type:square;}
1212
img{border:0}
13+
blockquote{margin:50px 40px 0;font-size:30px;quotes:"\201C" "\201D";}
14+
blockquote p:before{content:open-quote;font-weight:bold;}
15+
blockquote p:after{content:close-quote;font-weight:bold;}
16+
cite{float:right;margin-right:40px;display:inline;}
1317
.translations{float:right;margin-right:20px;top:0;margin:0;padding:0;display:inline;}
1418
.translations dt{margin:0;padding:0;text-indent:-9999px;}
1519
.translations dd{margin:0;padding:0;height:19px;}

jquery.superbox.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
/*
2-
* jQuery SuperBox! 0.9.0
2+
* jQuery SuperBox! 0.9.1
33
* Copyright (c) 2009 Pierre Bertet (pierrebertet.net)
44
* Licensed under the MIT (MIT-LICENSE.txt)
55
*
66
* TODO :
7-
* - Ajax
87
* - Document.load if init is before </body> against IE crash.
98
* - Animations
109
* - Image / Gallery mode : display a legend
@@ -24,7 +23,8 @@
2423
loadTxt: "Loading...",
2524
closeTxt: "Close",
2625
prevTxt: "Previous",
27-
nextTxt: "Next"
26+
nextTxt: "Next",
27+
beforeShow: function(){}
2828
},
2929

3030
galleryGroups = {},
@@ -420,7 +420,7 @@
420420
};
421421

422422
// Display box
423-
function showBox(){
423+
function showBox(curSettings, $elt){
424424
// Stop "Loading..."
425425
$loading.hide();
426426

@@ -452,14 +452,16 @@
452452
$wrapper.css({position: "absolute", top: ($wrapper.offset().top + 10) + "px"});
453453
}
454454

455+
settings.beforeShow();
456+
455457
$superbox.fadeTo(300,1);
456458

457459
};
458460

459461
// Create base elements (overlay, wrapper, box, loading)
460462
function createElements(){
461463
if (!$.superbox.elementsReady){
462-
464+
463465
// Overlay (background)
464466
$overlay = $('<div id="superbox-overlay"></div>').appendTo("body").hide();
465467

0 commit comments

Comments
 (0)