PageSourceSearch

http://www.blogonlinemarketing.com/wp-content/themes/toommorel-lite/js/zoombox.js?ver=3.2.1

js blogonlinemarketing.com collected 2026-10-05 03:14:00 UTC 19,901 bytes, 556 lines download raw bytes

1var scr=document.getElementsByTagName('script');
2var zoombox_path = scr[scr.length-1].getAttribute("src").replace('zoombox.js','');
3
4(function($){
5
6var options = {
7    theme       : 'zoombox',      //available themes : zoombox,lightbox, prettyphoto, darkprettyphoto, simple
8    opacity     : 0.8,                  // Black overlay opacity
9    duration    : 800,                // Animation duration
10    animation   : true,             // Do we have to animate the box ?
11    width       : 500,                  // Default width
12    height      : 350,                  // Default height
13    gallery     : true,                 // Allow gallery thumb view
14    autoplay : false,                // Autoplay for video
15    overflow  : false               // Allow images bigger than screen ?
16}
17var images = new Array();         // Gallery Array [gallery name][link]
18var elem;           // HTML element currently used to display box
19var isOpen = false; // Zoombox already opened ?
20var link;           // Shortcut for the link
21var width;
22var height;
23var timer;          // Timing for img loading
24var i = 0;          // iteration variable
25var content;        // The content of the box
26var type = 'multimedia'; // Content type
27var position = false;
28var imageset = false;
29var state = 'closed';
30
31/**
32* You can edit the html code generated by zoombox for specific reasons.
33* */
34var html = '<div id="zoombox"> \
35            <div class="mask"></div>\
36            <div class="container">\
37                <div class="content"></div>\
38                <div class="title"></div>\
39                <div class="next"></div>\
40                <div class="prev"></div>\
41                <div class="close"></div>\
42                <div class="gallery"></div>\
43            </div>\
44        </div>';
45// Regular expressions needed for the content
46var filtreImg=                  /(\.jpg)|(\.jpeg)|(\.bmp)|(\.gif)|(\.png)/i;
47var filtreMP3=			/(\.mp3)/i;
48var filtreFLV=			/(\.flv)/i;
49var filtreSWF=			/(\.swf)/i;
50var filtreQuicktime=	/(\.mov)|(\.mp4)/i;
51var filtreWMV=			/(\.wmv)|(\.avi)/i;
52var filtreDailymotion=	/(http:\/\/www.dailymotion)|(http:\/\/dailymotion)/i;
53var filtreVimeo=		/(http:\/\/www.vimeo)|(http:\/\/vimeo)/i;
54var filtreYoutube=		/(youtube\.)/i;
55var filtreKoreus=		/(http:\/\/www\.koreus)|(http:\/\/koreus)/i;
56
57
58$.zoombox = function(el,options) {
59
60}
61$.zoombox.options = options;
62$.zoombox.close = function() {
63    close();
64}
65$.zoombox.open = function(tmplink,opts){
66    elem = null;
67    link = tmplink;
68    options = $.extend({},$.zoombox.options,opts);
69    load();
70}
71$.zoombox.html = function(cont,opts){
72    content = cont;
73    options = $.extend({},$.zoombox.options,opts);
74    width = options.width;
75    height = options.height;
76    elem = null;
77    open();
78}
79$.fn.zoombox = function(opts){    
80    /**
81     * Bind the behaviour on every Elements
82     */
83    return this.each(function(){
84        // No zoombox for IE6
85        if($.browser.msie && $.browser.version < 7 && !window.XMLHttpRequest){
86            return false;
87        }
88        var obj = this;
89        var galleryRegExp =  /zgallery([0-9]+)/;
90        var gallery = galleryRegExp.exec($(this).attr("class"));
91        var tmpimageset = false;
92        if(gallery != null){
93            if(!images[gallery[1]]){
94                images[gallery[1]]=new Array();
95            }
96            images[gallery[1]].push($(this));
97            var pos = images[gallery[1]].length-1;
98            tmpimageset = images[gallery[1]];
99        }
100        $(this).unbind('click');
101        $(this).click(function(){
102            options = $.extend({},$.zoombox.options,opts);
103            if(state!='closed') return false;
104            elem = $(obj);
105            link = elem.attr('href');
106            imageset = tmpimageset;
107            position = pos;
108            load();
109            return false;
110        });
111    });
112}
113
114/**
115 * Load the content (with or without loader) and call open()
116 * */
117function load(){
118    if(state=='closed') isOpen = false;
119    state = 'load';
120    setDim();
121    if(filtreImg.test(link)){
122        img=new Image();
123        img.src=link;
124        $("body").append('<div id="zoombox_loader"></div>');
125        $("#zoombox_loader").css("marginTop",scrollY());
126        timer = window.setInterval(function(){loadImg(img);},100);
127    }else{
128        setContent();
129        open();
130    }
131}
132
133/**
134 * Build the HTML Structure of the box
135 * */
136function build(){
137    // We add the HTML Code on our page
138    $('body').append(html);
139    $(window).keydown(function(event){
140        shortcut(event.which);
141    });
142    $(window).resize(function(){
143        resize();
144    });
145    $('#zoombox .mask').hide();
146    $('#zoombox .gallery').hide();
147    // We add a specific class to define the box theme
148    $('#zoombox').addClass(options.theme);
149    // We bind the close behaviour (click on the mask / click on the close button)
150    $('#zoombox .close,#zoombox .mask,.zoombox_close').click(function(){
151        close();
152        return false;
153    });
154    $('#zoombox .mask').mouseover(function(){
155        $('#zoombox .gallery').stop().fadeTo(500,0);
156    });
157    $('#zoombox .mask').mouseout(function(){
158        $('#zoombox .gallery').stop().fadeTo(500,0.9);
159    });
160    // Next/Prev button
161    if(imageset == false){
162        $('#zoombox .next,#zoombox .prev').remove();
163    }else{
164        $('#zoombox .next').click(function(){
165            next();
166        });
167        $('#zoombox .prev').click(function(){
168            prev();
169        });
170        if(options.gallery){
171            for(var i in imageset){
172                var img = $('<img src="'+zoombox_path+'img/blank.png'+'" class="video gallery'+(i*1)+'"/>');
173                if(filtreImg.test(imageset[i].attr('href'))){
174                   img = $('<img src="'+imageset[i].attr('href')+'" class="gallery'+(i*1)+'"/>');
175                }
176                img.appendTo('#zoombox .gallery');
177                img.click(function(){
178                   gotoSlide($(this).attr('class').replace('gallery',''));
179                   $('#zoombox .gallery img').removeClass('current');
180                   $(this).addClass('current');
181                });
182                if(i==position){ img.addClass('current'); }
183            }
184        }
185    }
186}
187/**
188 * Open the box
189 **/
190function open(){
191    if(isOpen == false){
192        build();
193    }else{
194        $('#zoombox .title').empty();
195    }
196    $('#zoombox .close').hide();
197    $('#zoombox .container').removeClass('multimedia').removeClass('img');
198    $('#zoombox .container').addClass(type);
199
200    // We add a title if we find one on the link
201    if(elem != null && elem.attr('title')){
202        $('#zoombox .title').append(elem.attr('title'));
203    }
204
205
206
207    // And after... Animation or not depending of preferences
208    // We empty the content
209    $('#zoombox .content').empty();
210    // If it's an image we load the content now (to get a good animation)
211    if(type=='img' && isOpen == false && options.animation == true){
212        $('#zoombox .content').append(content);
213    }
214    // Default position/size of the box to make the "zoom effect"
215    if(elem != null && elem.find('img').length != 0 && isOpen == false){
216        var min = elem.find('img');
217        $('#zoombox .container').css({
218            width : min.width(),
219            height: min.height(),
220            top : min.offset().top,
221            left : min.offset().left,
222            opacity:0,
223            marginTop : min.css('marginTop')
224        });
225    }else if(elem != null && isOpen == false){
226        $('#zoombox .container').css({
227           width:   elem.width(),
228           height:  elem.height(),
229           top:elem.offset().top,
230           left:elem.offset().left
231        });
232    }else if(isOpen == false){
233        $('#zoombox .container').css({
234            width: 100,
235            height: 100,
236            top:windowH()/2-50,
237            left:windowW()/2-50
238        })
239    }
240    // Final position/size of the box after the animation
241    var css = {
242        width : width,
243        height: height,
244        left  : (windowW() - width) / 2,
245        top   : (windowH() - height) / 2,
246        marginTop : scrollY(),
247        opacity:1
248    };
249    // Do we animate or not ?
250    if(options.animation == true){
251        $('#zoombox .title').hide();
252        $('#zoombox .container').animate(css,options.duration,function(){
253            if(type == 'multimedia' || isOpen == true){
254                $('#zoombox .content').append(content);
255            }
256            if(type == 'image' || isOpen == true){
257                $('#zoombox .content img').css('opacity',0).fadeTo(300,1);
258            }
259            $('#zoombox .close').fadeIn();
260            $('#zoombox .gallery').fadeIn();
261            $('#zoombox .title').fadeIn(300);
262            state = 'opened';
263            isOpen = true;
264        });
265        $('#zoombox .mask').fadeTo(200,options.opacity);
266    }else{
267        $('#zoombox .content').append(content);
268        $('#zoombox .close').show();
269        $('#zoombox .gallery').show();
270        $('#zoombox .container').css(css);
271        $('#zoombox .mask').show();
272        $('#zoombox .mask').css('opacity',options.opacity);
273        isOpen = true;
274        state = 'opened';
275    }
276}
277/**
278 * Close the box
279 * **/
280function close(){
281    state = 'closing';
282    window.clearInterval(timer);
283    $(window).unbind('keydown');
284    $(window).unbind('resize'); 
285    if(type == 'multimedia'){
286        $('#zoombox .container').empty();
287    }
288    var css = {};
289    if(elem != null && elem.find('img').length != 0){
290        var min = elem.find('img');
291        css ={
292            width : min.width(),
293            height: min.height(),
294            top : min.offset().top,
295            left : min.offset().left,
296            opacity:0,
297            marginTop : min.css('marginTop')
298        };
299    }else if(elem!=null){
300        css = {
301           width:   elem.width(),
302           height:  elem.height(),
303           top:elem.offset().top,
304           left:elem.offset().left,
305           opacity:0
306        };
307    }else{
308        css = {
309            width: 100,
310            height: 100,
311            top:windowH()/2-50,
312            left:windowW()/2-50,
313            opacity : 0
314        };
315    }
316    if(options.animation == true){
317        $('#zoombox .mask').fadeOut(200);
318        $('#zoombox .container').animate(css,options.duration,function(){
319            $('#zoombox').remove();
320            state = 'closed';
321			isOpen = false; 
322        });
323    }else{
324        $('#zoombox').remove();
325        state = 'closed';
326		isOpen = false; 
327    }
328}
329
330/**
331 * Set the HTML Content of the box
332 * */
333function setContent(){
334    // Overtflow
335    if(options.overflow == false){
336        if(width*1 + 50 > windowW()){
337            height = (windowW() - 50) * height / width;
338            width = windowW() - 50;
339        }
340        if(height*1 + 50 > windowH()){
341            width = (windowH()-50) * width / height; 
342            height = windowH() - 50;
343        }
344    }
345    var url = link;
346    type = 'multimedia';
347    if(filtreImg.test(url)){
348        type = 'img';
349        content='<img src="'+link+'" width="'+width+'" height="'+height+'"/>';
350    }else if(filtreMP3.test(url)){
351        width=300;
352        height=40;
353        content ='<object type="application/x-shockwave-flash" data="'+MP3Player+'?son='+url+'" width="'+width+'" height="'+height+'">';
354        content+='<param name="movie" value="'+MP3Player+'?son='+url+'" /></object>';
355    }else if(filtreFLV.test(url)){
356        var autostart = 0;
357        if(options.autoplay==true){ autostart = 1; } 
358        content='<object type="application/x-shockwave-flash" data="'+zoombox_path+'FLVPlayer.swf" width="'+width+'" height="'+height+'">\
359<param name="allowFullScreen" value="true">\
360<param name="scale" value="noscale">\
361<param name="wmode" value="transparent">\
362<param name="flashvars" value="flv='+url+'&autoplay='+autostart+'">\
363<embed src="'+zoombox_path+'FLVPlayer.swf" width="'+width+'" height="'+height+'" allowscriptaccess="always" allowfullscreen="true" flashvars="flv='+url+'" wmode="transparent" />\
364</object>';
365    }else if(filtreSWF.test(url)){
366        content='<object width="'+width+'" height="'+height+'"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="'+url+'" /><embed src="'+url+'" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+width+'" height="'+height+'" wmode="transparent"></embed></object>';
367    }else if(filtreQuicktime.test(url)){
368        content='<embed src="'+url+'" width="'+width+'" height="'+height+'" controller="true" cache="true" autoplay="true"/>';
369        // HTML5 Code
370        //content='<video controls src="'+url+'" width="'+width+'" height="'+height+'">Your browser does not support this format</video>'
371    }else if(filtreWMV.test(url)){
372        content='<embed src="'+url+'" width="'+width+'" height="'+height+'" controller="true" cache="true" autoplay="true" wmode="transparent" />';
373    }else if(filtreDailymotion.test(url)){
374        var id=url.split('_');
375        id=id[0].split('/');
376        id=id[id.length-1];
377        if(options.autoplay==true){
378            id = id + '&autostart=1';
379        }
380        content='<object width="'+width+'" height="'+height+'"><param name="movie" value="http://www.dailymotion.com/swf/'+id+'&colors=background:000000;glow:000000;foreground:FFFFFF;special:000000;&related=0"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.dailymotion.com/swf/'+id+'&colors=background:000000;glow:000000;foreground:FFFFFF;special:000000;&related=0" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" allowFullScreen="true" allowScriptAccess="always" wmode="transparent" ></embed></object>';
381    }else if(filtreVimeo.test(url)){
382        var id=url.split('/');
383        id=id[3];
384        if(options.autoplay==true){
385            id = id + '&autoplay=1';
386        }
387        content='<object width="'+width+'" height="'+height+'"><param name="allowfullscreen" value="true" />	<param name="allowscriptaccess" value="always" /><param name="wmode" value="transparent" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id='+id+'&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00AAEB&amp;fullscreen=1" />	<embed src="http://www.vimeo.com/moogaloop.swf?clip_id='+id+'&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00AAEB&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+width+'" height="'+height+'" wmode="transparent" ></embed></object>';
388    }else if(filtreYoutube.test(url)){
389        var id=url.split('watch?v=');
390        id=id[1].split('&');
391        id=id[0];
392        if(options.autoplay==true){
393            id = id + '&autoplay=1';
394        }
395        content='<object width="'+width+'" height="'+height+'">
395<param name="movie" value="http://www.youtube.com/v/'+id+'&hl=fr&rel=0&color1=0xFFFFFF&color2=0xFFFFFF&hd=1"></param><embed src="http://www.youtube.com/v/'+id+'&hl=fr&rel=0&color1=0xFFFFFF&color2=0xFFFFFF&hd=1" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" wmode="transparent"></embed></object>';
396    }else if(filtreKoreus.test(url)){
397        url=url.split('.html');
398        url=url[0];
399        content='<object type="application/x-shockwave-flash" data="'+url+'" width="'+width+'" height="'+height+'"><param name="movie" value="'+url+'"><embed src="'+url+'" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"  wmode="transparent"></embed></object>';
400    }else{
401        content='<iframe src="'+url+'" width="'+width+'" height="'+height+'" border="0"></iframe>';
402    }
403    return content;
404}
405/**
406 *  Handle Image loading
407 **/
408function loadImg(img){
409    if(img.complete){
410            i=0;
411            window.clearInterval(timer);
412            width=img.width;
413            height=img.height;
414            $('#zoombox_loader').remove();
415            setContent();
416            open();
417    }
418    // On anim le loader
419    $('#zoombox_loader').css({'background-position': "0px "+i+"px"});
420    i=i-40;
421    if(i<(-440)){i=0;}
422}
423
424function gotoSlide(i){
425    if(state != 'opened'){ return false; }
426    position = i;
427    elem = imageset[position];
428    link = elem.attr('href');
429    if($('#zoombox .gallery img').length > 0){
430        $('#zoombox .gallery img').removeClass('current');
431        $('#zoombox .gallery img:eq('+i+')').addClass('current');
432    }
433    load();
434    return false;
435}
436
437function next(){
438    i = position+1;
439    if(i  > imageset.length-1){
440        i = 0;
441    }
442    gotoSlide(i);
443}
444
445function prev(){
446    i = position-1;
447    if(i < 0){
448        i = imageset.length-1;
449    }
450    gotoSlide(i);
451}
452
453/**
454 * GENERAL FUNCTIONS
455 * */
456/**
457 * Resize
458 **/
459function resize(){
460    $('#zoombox .container').css({
461        top : (windowH() - $('#zoombox .container').height()) / 2,
462        left : (windowW() - $('#zoombox .container').width()) / 2
463    });
464}
465/**
466 * Keyboard Shortcut
467 **/
468function shortcut(key){
469    if(key == 37){
470        prev();
471    }
472    if(key == 39){
473        next();
474    }
475    if(key == 27){
476        close();
477    }
478
479}
480/**
481 * Parse Width/Height of a link and insert it in the width and height variables
482 * */
483function setDim(){
484    width = options.width;
485    height = options.height;
486    if(elem!=null){
487        var widthReg = /w([0-9]+)/;
488        var w = widthReg.exec(elem.attr("class"));
489        if(w != null){
490            if(w[1]){
491                width = w[1];
492            }
493        }
494        var heightReg = /h([0-9]+)/;
495        var h = heightReg.exec(elem.attr("class"));
496        if(h != null){
497            if(h[1]){
498                height = h[1];
499            }
500        }
501    }
502    return false;
503}
504/**
505* Return the window height
506* */
507function windowH(){
508        if (window.innerHeight) return window.innerHeight  ;
509        else{return $(window).height();}
510}
511
512/**
513 * Return the window width
514 * */
515function windowW(){
516        if (window.innerWidth) return window.innerWidth  ;
517        else{return $(window).width();}
518}
519
520/**
521 *  Return the position of the top
522 *  */
523function scrollY() {
524        scrOfY = 0;
525        if( typeof( window.pageYOffset ) == 'number' ) {
526                //Netscape compliant
527                scrOfY = window.pageYOffset;
528        } else if( document.body && ( document.body.scrollTop ) ) {
529                //DOM compliant
530                scrOfY = document.body.scrollTop;
531        } else if( document.documentElement && ( document.documentElement.scrollTop ) ) {
532                //IE6 standards compliant mode
533                scrOfY = document.documentElement.scrollTop;
534        }
535        return scrOfY;
536}
537
538/**
539 *  Return the position of the left scroll
540 *  */
541function scrollX(){
542        scrOfX = 0;
543        if( typeof( window.pageXOffset ) == 'number' ) {
544                //Netscape compliant
545                scrOfX = window.pageXOffset;
546        } else if( document.body && ( document.body.scrollLeft ) ) {
547                //DOM compliant
548                scrOfX = document.body.scrollLeft;
549        } else if( document.documentElement && ( document.documentElement.scrollLeft ) ) {
550                //IE6 standards compliant mode
551                scrOfX = document.documentElement.scrollLeft;
552        }
553         return scrOfX;
554}
555
556})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.