1 // Inside the function "this" will be "document" when called by ready()
2 // and "the ajaxed element" when called because of onAjaxLoad
3 var mediaboxInit = function() {
4 //console.log(box_settings);
6 transition
:box_settings
.trans
,
7 speed
:box_settings
.speed
,
8 maxWidth
:box_settings
.maxW
,
9 maxHeight
:box_settings
.maxH
,
10 minWidth
:box_settings
.minW
,
11 minHeight
:box_settings
.minH
,
12 opacity
:box_settings
.opa
,
13 slideshowSpeed
:box_settings
.ssSpeed
,
14 slideshowStart
:box_settings
.str_ssStart
,
15 slideshowStop
:box_settings
.str_ssStop
,
16 current
:box_settings
.str_cur
,
17 previous
:box_settings
.str_prev
,
18 next
:box_settings
.str_next
,
19 close
:box_settings
.str_close
,
20 splash_url
:box_settings
.splash_url
23 // passer le portfolio de la dist en mode galerie
24 if (box_settings
.sel_g
){
25 jQuery(box_settings
.sel_g
, this).not('.hasbox,#colorbox')
26 .attr("onclick","") // se debarrasser du onclick de SPIP
27 .colorbox(jQuery
.extend({}, options
, {rel
:'galerieauto',slideshow
:true,slideshowAuto
:false}))
31 if (box_settings
.tt_img
) {
32 // selectionner tous les liens vers des images
33 jQuery("a[type=\'image/jpeg\'],a[type=\'image/png\'],a[type=\'image/gif\']", this).not('.hasbox')
34 .attr("onclick","") // se debarrasser du onclick de SPIP
35 .colorbox(options
) // activer la box
36 .addClass("hasbox") // noter qu\'on l\'a vue
40 // charger la box sur autre chose
41 if (box_settings
.sel_c
){
42 jQuery(box_settings
.sel_c
).not('.hasbox')
43 .colorbox(jQuery
.extend({}, options
, {slideshow
:true,slideshowAuto
:false}))
44 .addClass("hasbox") // noter qu\'on l\'a vue
49 /* initialiser maintenant si box_settings est deja la
50 * nb en cas de defer sur le chargement du scipt javascript principal
52 if (typeof(box_settings
)!='undefined')
53 (function($){ if(typeof onAjaxLoad
== "function") onAjaxLoad(mediaboxInit
); $(mediaboxInit
); })(jQuery
);
57 * overlayClose: (Boolean:false) Allow click on overlay to close the dialog?
58 * iframe: (Boolean:false) Open box in iframe
59 * minHeight: (Number:200) The minimum height for the container
60 * minWidth: (Number:200) The minimum width for the container
61 * maxHeight: (Number:null) The maximum height for the container. If not specified, the window height is used.
62 * maxWidth: (Number:null) The maximum width for the container. If not specified, the window width is used.
63 * autoResize: (Boolean:false) Resize container on window resize? Use with caution - this may have undesirable side-effects.
64 * onOpen: (Function:null) The callback function used in place of SimpleModal's open
65 * onShow: (Function:null) The callback function used after the modal dialog has opened
66 * onClose: (Function:null) The callback function used in place of SimpleModal's close
68 $.fn
.mediabox = function (options
) {
72 transition
:box_settings
.trans
,
73 speed
:box_settings
.speed
,
74 maxWidth
:box_settings
.maxW
,
75 maxHeight
:box_settings
.maxH
,
76 minWidth
:box_settings
.minW
,
77 minHeight
:box_settings
.minH
,
78 opacity
:box_settings
.opa
,
79 slideshowStart
:box_settings
.str_ssStart
,
80 slideshowStop
:box_settings
.str_ssStop
,
81 current
:box_settings
.str_cur
,
82 previous
:box_settings
.str_prev
,
83 next
:box_settings
.str_next
,
84 close
:box_settings
.str_close
,
85 onOpen
: (options
&& options
.onOpen
) || null,
86 onComplete
: (options
&& options
.onShow
) || null,
87 onClosed
: (options
&& options
.onClose
) || null
90 if (this === jQuery
.fn
)
91 return $.colorbox($.extend(cbox_options
,options
));
93 return this.colorbox($.extend(cbox_options
,options
));
95 $.mediaboxClose = function () {$.fn
.colorbox
.close();};
98 $.mediabox = function(options
) { return jQuery
.fn
.mediabox(options
);}
99 $.modalbox = function (href
, options
) {$.fn
.mediabox($.extend({href
:href
,inline
:href
.match(/^#/)?true:false,overlayClose
:true},options
));};
100 $.modalboxload = function (url
, options
) { $.modalbox(url
,options
); };
101 $.modalboxclose
= $.mediaboxClose
;