PageSourceSearch

https://bib.hs-duesseldorf.de/_layouts/15/FHD.Internet/js/SlideShow.js

js hs-duesseldorf.de collected 2026-10-02 02:34:58 UTC 23,870 bytes, 701 lines download raw bytes

1
2//global vars
3//arraw of images
4var hsd_images = new Array();
5
6// index of selected image
7var currentIndex = -1;
8
9// stop automatic rotation
10var stopRotation = false;
11
12//is loading
13var loading = false;
14
15//this page is popup
16var isPopup = false;
17
18//is master page
19var isMatser = false;
20// is webpart
21var isWebpart = false;
22
23//container that contain the image
24var container;
25//classe names
26var ss_arrows;
27var ss_caption;
28var ss_date;
29var ss_links;
30var ss_play;
31var ss_pause;
32
33//class to save the images
34function hsd_image(title, date, sequence, url, height, width, video, poster, copyright) {
35    this.title = title;
36    this.date = date;
37    this.sequence = sequence;
38    this.url = url;
39    this.height = height;
40    this.width = width;
41    this.video = video;
42    this.poster = poster;
43    this.copyright = copyright;
44};
45
46
47jQuery(document).ready(function () {
48
49    if (isWebpart)
50        return;
51    //get container
52
53    if (FHD_IsSlideMaster) {
54        //slide show in the master page
55
56        if (FHD_IsFullSlideMaster) {
57            container = jQuery('body');
58        }
59        else {
60            container = jQuery('#s4-contentBox');
61        }
62        ss_arrows = '#ssm_arrows';
63        ss_caption = '#ssm_caption';
64        ss_date = '#ssm_date';
65        ss_links = '#ssm_links';
66        ss_play = '#play';
67        ss_pause = '#pause';
68        $(ss_links).css('max-width', '1096px');
69        //adjust the arrows
70        adjustDesignMaster();
71        adjustButtonPlayPause();
72        jQuery(window).resize(function () {
73            if (FHD_IsFullSlideMaster) { // shift if full backgournd
74                // shift if full backgournd
75                //jQuery(ss_arrows).css('width', jQuery('#MegaMenu').width() + 100);
76                //jQuery(ss_arrows).css('left', -50);
77                //height / 2 : to have a middle
78                //30 : the height of the control
79                //(jQuery('#s4-contentBox').offset().top): the top offset of the container
80                var top = (jQuery(container).height() / 2) - 30 - (jQuery('#s4-contentBox').offset().top);
81                //jQuery(ss_arrows).css('top', top);
82                jQuery(ss_links).css('top', jQuery(window).height() - 100);
83            }
84            else {
85                //background content
86                // jQuery(ss_arrows).css('width', jQuery('#MegaMenu').width());
87                var top = (jQuery(container).height() / 2) - 30;
88                jQuery(ss_arrows).css('top', top);
89                jQuery(ss_links).css('top', jQuery(container).height() - 50);
90            }
91            hsd_LoadDocument();
92        });
93
94    }
95    if (jQuery('.ss_Container').length > 0) {
96        container = jQuery('.ss_Container')[0];
97        ss_arrows = '#ss_arrows';
98        ss_caption = '#ss_caption';
99        ss_date = '#ss_date';
100        ss_links = '#ss_links';
101        ss_play = '#ss_play';
102        ss_pause = '#ss_pause';
103        AdjustArrows();
104    }
105    if (container == null) {
106        //no slide show
107        return;
108    }
109    //load images
110    if (!isPopup) {
111        jQuery('#ss_closePopup').hide();
112        for (var i = 0; i < hsd_images.length; i++) {
113            var hsd_img = hsd_images[i];
114            var link;
115            if (hsd_img.title != '') {
116                link = "<a class='ss_Num' tabindex='0' href='javascript:hsd_ShowById(" + hsd_img.sequence + ")' title='" + hsd_img.title + "'>" + hsd_img.sequence + "</a>";
117            }
118            else {
119                link = "<a class='ss_Num' tabindex='0' href='javascript:hsd_ShowById(" + hsd_img.sequence + ")'>" + hsd_img.sequence + "</a>";
120            }
121            jQuery(ss_links).html(jQuery(ss_links).html() + link);
122
123            //change color if master page
124            if (FHD_IsMaineStyle) {
125                jQuery('.ss_Num').css('color', FHD_Principal);
126            }
127        }
128
129    }
130    //load the first image
131
132    if (hsd_images.length > 0) {
133        hsd_next();
134
135    }
136    hsd_resetTime();
137
138    jQuery('.ss_arrow-left, .ss_arrow-right').hover(function () {
139
140        jQuery(this).css('height', '80px');
141        jQuery(this).css('width', '40px');
142    }, function () {
143        jQuery(this).css('height', '60px');
144        jQuery(this).css('width', '30px');
145    });
146    jQuery(ss_arrows).find('a').click(function () {
147        stopRotation = true;
148        window.clearInterval(hsd_timer);
149    });
150    jQuery(ss_links).find('a').click(function () {
151        stopRotation = true;
152        window.clearInterval(hsd_timer);
153    });
154});
155
156
157//adjust the arrows
158function AdjustArrows() {
159    //adjust the arrows
160
161    // jQuery(ss_arrows).css('width', jQuery(container).width());
162    var top = (jQuery(container).height() / 2);
163    jQuery(ss_arrows).css('top', top - 30);
164    jQuery('#ss_loading').css('top', top - 16);
165    jQuery('#ss_loading').css('left', jQuery(container).width() / 2 - 42);
166}
167
168
169//pass to next image
170function hsd_next() {
171    currentIndex++;
172    IsPlaying = false;
173    if (currentIndex == hsd_images.length)
174        currentIndex = 0;
175
176    hsd_LoadDocument();
177}
178
179//pass to previous image
180function hsd_previous() {
181    IsPlaying = false;
182    currentIndex--;
183
184    if (currentIndex == -1)
185        currentIndex = hsd_images.length - 1;
186
187    hsd_LoadDocument();
188
189}
190//pass to index image
191function hsd_ShowById(sequence) {
192    currentIndex = sequence - 1;
193    hsd_LoadDocument();
194}
195
196//load image from server
197function hsd_LoadDocument() {
198    if (hsd_images.length == 0)
199        return;
200
201    hsd_resetTime();
202    var hsd_img = hsd_images[currentIndex];
203    jQuery(ss_caption).text(hsd_img.title); // hide caption & dates
204    jQuery(ss_date).text(hsd_img.copyright);//change date by copy right
205    //jQuery('#ss_loading').show();
206
207    //change the background of the container
208    if (isWebpart) {
209
210        jQuery(container).css('width', '100%');
211        jQuery(container).css('max-width', '100%');
212        var h = (jQuery(container).width() / 3) * 2;
213        var w = jQuery(container).width();
214        if (jQuery(container).css('height') == "0px")
215            jQuery(container).css('height', h);
216
217
218        if (hsd_img.video == true) {
219            jQuery(container).css('background-color', 'transparent');
220            jQuery('#ss_loading').hide();
221            jQuery('#ss_title').hide();
222            jQuery(container).attr('data-video', hsd_img.url);
223            jQuery.getScript("../_layouts/15/FHD.Internet/js/bigvideo.js", function () {
224                if (!jQuery(container).find("#big-video-wrap").length) {
225                    BV = new jQuery.BigVideo({ useFlashForFirefox: false, controls: false, container: jQuery(container) });
226                    try {
227                        BV.init();
228                    }
229                    catch (err) {
230                        ;
231                    }
232                    jQuery('.vjs-control-bar').hide();
233                    jQuery("#big-video-vid").find('div').hide();
234                    jQuery('#ss_img').hide();
235                }
236                jQuery('#big-video-vid_html5_api').attr('poster', hsd_img.poster);
237                jQuery('#big-video-wrap').show();
238                jQuery('#ss_img').hide();
239
240                jQuery('#big-video-wrap').css('position', 'relative');
241                jQuery('#big-video-wrap').css('width', jQuery(container).width());
242                jQuery('#big-video-wrap').css('max-width', jQuery(container).width());
243                jQuery('#big-video-vid').css('width', jQuery(container).width() - 50);
244                jQuery('#big-video-vid').css('height', h);
245                BV.show(hsd_img.url, { ambient: true });
246                ShowPlaySlideShow();
247                jQuery('.ss_Num').css('border', 'none');
248                var currentlink = jQuery(ss_links + ' a')[currentIndex];
249                jQuery(currentlink).css('border', '1px solid ');
250                jQuery('#ss_links').css('width', jQuery(container).width());
251                jQuery('#ss_links').css('margin-top', -jQuery('#ss_links').height());
252                jQuery('#ss_title').hide();
253            });
254            jQuery("#big-video-vid_html5_api").bind("ended", function () {
255                IsPlaying = false;
256                hsd_next();
257            });
258
259
260        }
261        else {
262
263            jQuery('#ss_title').show();
264            //jQuery('#ss_loading').show();
265            jQuery(ss_pause).hide();
266            jQuery(ss_play).hide();
267            try {
268                BV.getPlayer().pause();
269            }
270            catch (err) {
271                ;
272            }
273
274            jQuery('#big-video-wrap').hide();
275            jQuery('#ss_img').show();
276            jQuery("video").find('div').hide();
277
278
279            // in this case poster will be the alternative text for the image
280            var i = jQuery('<img />').attr('src', hsd_img.url).load(function () {
281                jQuery('#ss_img').css('width', '');
282                jQuery('#ss_img').attr('src', i.attr('src'));
283                jQuery('#ss_img').attr('alt', hsd_img.poster);
284                jQuery('#ss_img').css('z-index', '1');
285                if (jQuery('#ss_img').width() > h)
286                    jQuery('#ss_img').css('width', '100%');
287                else
288                    jQuery('#ss_img').css('width', '');
289                jQuery('#ss_img').css('height', h);
290                jQuery(ss_arrows).css('z-index', '2');
291                jQuery(ss_links).css('z-index', '3');
292                var top = (jQuery('#ss_img').height() / 2);
293
294
295            });
296
297
298
299            jQuery('#ss_title').css('position', 'relative');
300            jQuery('#ss_title').css('z-index', '20');
301            jQuery(container).css('background-color', 'black');
302            jQuery('#ss_loading').css('top', -top - 15);
303            jQuery(ss_links).css('position', 'absolute');
304            jQuery(ss_links).css('margin-top', '-32px');
305            jQuery('.ss_Num').css('border', 'none');
306            var currentlink = jQuery(ss_links + ' a')[currentIndex];
307            jQuery(currentlink).css('border', '1px solid ');
308            jQuery('#ss_links').css('width', jQuery('.ss_Container').width());
309            jQuery('#ss_links').css('margin-top', -jQuery('#ss_links').height());
310
311
312
313
314
315
316        }
317        var top = (jQuery(container).height() / 2);
318        jQuery(ss_arrows).css('top', -top - 30);
319        adjustButtonPlayPause();
320        // jQuery(ss_arrows).css('width', '100%');
321        jQuery('#ss_title').css('top', -jQuery(container).height());
322        jQuery('.ss_Num').css('color', 'white');
323    }
324    else {
325        if (hsd_img.video == true) {
326            jQuery(container).css('background-image', '');
327
328            jQuery('#ss_loading').hide();
329            jQuery(container).attr('data-video', hsd_img.url);
330            jQuery.getScript("../_layouts/15/FHD.Internet/js/bigvideo.js", function () {
331                if (!jQuery(container).find("#big-video-wrap").length) {
332                    BV = new jQuery.BigVideo({ useFlashForFirefox: false, controls: false, container: jQuery(container) });
333                    try {
334                        BV.init();
335                    }
336                    catch (err) {
337                        ;
338                    }
339                    jQuery("#big-video-vid").find('div').hide();
340                }
341                jQuery('#big-video-vid_html5_api').attr('poster', hsd_img.poster);
342                jQuery('.vjs-control-bar').hide();
343                jQuery('#big-video-wrap').show();
344                jQuery("#big-video-vid").css('top', '0px');
345                jQuery("#big-video-vid").find('div').hide();
346                jQuery('#big-video-wrap').css('height', jQuery(container).height());
347                jQuery('#big-video-wrap').css('max-width', jQuery(container).width());
348                BV.show(hsd_img.url, { ambient: true });
349                showPlay();
350                IsPlaying = false;
351
352            });
353            jQuery("#big-video-vid_html5_api").bind("ended", function () {
354                IsPlaying = false;
355                hsd_next();
356            });
357            if (!FHD_IsFullSlideMaster) {
358                jQuery(ss_links).css('top', jQuery('#big-video-wrap').height() - jQuery(ss_links).height());
359            }
360        }
361        else {
362            try {
363                BV.getPlayer().pause();
364            }
365            catch (err) {
366                ;
367            }
368
369            jQuery('#big-video-wrap').hide();
370            jQuery('#pause').hide();
371            jQuery('#play').hide();
372
373            var i = jQuery('<img />').attr('src', hsd_img.url).load(function () {
374                jQuery(container).css('background-image', "url('" + i.attr('src') + "')");
375                jQuery('#ss_loading').hide();
376            });
377
378        }
379        if (FHD_IsFullSlideMaster) {
380            jQuery(ss_links).css('height', 'auto');
381            if (jQuery(ss_links).height() > 50) {
382                jQuery(ss_links).css('top', jQuery(window).height() - 125);
383            }
384            else {
385                jQuery(ss_links).css('top', jQuery(window).height() - 100);
386            }
387
388        }
389        else
390            jQuery(ss_links).css('top', jQuery(container).height() - 50);
391        jQuery('.ss_Num').css('border', 'none');
392        jQuery('.ss_Num').attr('tabindex', '0');
393        var currentlink = jQuery('#ssm_links' + ' a')[currentIndex];
394        jQuery(currentlink).css('border', '1px solid ');
395    }
396
397}
398
399//change the color if the image is  smaller of the container & and the selected  image border
400function adjustDesign() {
401    jQuery(ss_links).css('width', jQuery(container).width());
402    //adjust to the popup images
403    if (isPopup) {
404
405
406        //set the top of the arrowd
407
408        var hsd_img = hsd_images[currentIndex];
409
410        var rapport = jQuery(container).width() / jQuery(container).height();
411        var rapport_img = hsd_img.width / hsd_img.height;
412
413        var new_width_img = rapport_img * jQuery(container).height();
414
415        var pp_content = jQuery(window.parent.document).find('.ms-dlgContent')[0];
416        var pp_frame = jQuery(pp_content).prev();
417        var pp_frame2 = jQuery(pp_content).find('iframe')[0];
418
419
420        var width = hsd_img.width;
421        var height = hsd_img.height;
422        var marge = 100;
423
424        if (width > jQuery(window.parent).width() - marge) {
425            width = jQuery(window.parent).width() - marge;
426            height = width / rapport_img;
427        }
428        if (height > jQuery(window.parent).height() - marge) {
429            height = jQuery(window.parent).height() - marge;
430            width = height * rapport_img;
431        }
432
433
434        jQuery(container).css('margin', '0px');
435
436        if (rapport_img > 1) {
437
438            height = jQuery(window.parent).height() - marge;
439            width = height * rapport_img;
440
441            //landscape
442            jQuery(container).css('width', width);
443            jQuery(pp_content).css('width', width);
444            jQuery(pp_frame).css('width', width);
445            jQuery(pp_frame2).css('width', width);
446
447
448            jQuery(container).css('height', height);
449            jQuery(pp_content).css('height', height + marge);
450            jQuery(pp_frame).css('height', height + marge);
451            jQuery(pp_frame2).css('height', height + marge);
452            jQuery(container).css('margin-top', marge / 2 + 'px');
453
454            jQuery('.ss_arrow-left').css({ "background-image": "url('/_layouts/15/FHD.Internet/images/arrow_slideShow.png')", "transform": "rotate(180deg)"});
455            jQuery('.ss_arrow-right').css("background-image", "url('/_layouts/15/FHD.Internet/images/arrow_slideShow.png')");
456
457            //adjust arrows
458            // jQuery(ss_arrows).css('width', width);
459            //jQuery(ss_arrows).css('left', 0);
460            jQuery('#ss_closePopup').css('margin-right', 0);
461            jQuery('#ss_closePopup').css('margin-top', -marge / 2);
462
463        }
464        else {
465            //portrait
466            height = jQuery(window.parent).height() - 5;
467            width = height * rapport_img;
468            marge = 300;
469
470            jQuery(container).css('width', width);
471            jQuery(pp_content).css('width', width + marge);
472            jQuery(pp_frame).css('width', width + marge);
473            jQuery(pp_frame2).css('width', width + marge);
474
475            jQuery(container).css('height', height);
476            jQuery(pp_content).css('height', height);
477            jQuery(pp_frame).css('height', height);
478            jQuery(pp_frame2).css('height', height);
479
480            jQuery(container).css('margin-left', marge / 2);
481
482            jQuery('.ss_arrow-left').css({ "background-image": "url('/_layouts/15/FHD.Internet/images/arrow_slideShow.png')", "transform": "rotate(180deg)" });
483            jQuery('.ss_arrow-right').css("background-image", "url('/_layouts/15/FHD.Internet/images/arrow_slideShow.png')");
484
485            //adjust arrows
486            //jQuery(ss_arrows).css('width', width + marge);
487            //jQuery(ss_arrows).css('left', -marge / 2);
488
489            jQuery('#ss_closePopup').css('margin-right', -marge / 2);
490            jQuery('#ss_closePopup').css('margin-top', 0);
491
492            alert(jQuery('#s4-workspace').height());
493            //jQuery('#s4-workspace').height(jQuery('#s4-workspace').height() + 10);
494            //alert(jQuery('#s4-workspace').height());
495        }
496
497        jQuery(pp_frame).css('left', (jQuery(window.parent).width() - jQuery(pp_frame).width()) / 2);
498        jQuery(pp_content).css('left', (jQuery(window.parent).width() - jQuery(pp_content).width()) / 2);
499
500        jQuery(pp_frame).css('top', (jQuery(window.parent).height() - jQuery(pp_frame).height()) / 2);
501        jQuery(pp_content).css('top', (jQuery(window.parent).height() - jQuery(pp_content).height()) / 2);
502
503
504
505        var top = (jQuery(container).height() / 2);
506        jQuery(ss_arrows).css('top', top - 30);
507        jQuery('#ss_loading').css('top', top - 16);
508        jQuery('#ss_loading').css('left', jQuery(pp_content).width() / 2 - 42);
509
510    }
511
512
513
514
515    //set border to selected image
516    jQuery('.ss_Num').css('border', 'none');
517
518    var currentlink = jQuery(ss_links + ' a')[currentIndex];
519    if (FHD_IsMaineStyle) {
520        jQuery(currentlink).css('border', '1px solid ' + FHD_Principal);
521    }
522    else {
523        jQuery(currentlink).css('border', '1px solid white');
524    }
525
526}
527
528
529//adjust the postion of the controls designed in the master page home
530function adjustDesignMaster() {
531    if (FHD_IsFullSlideMaster) { // shift if full backgournd
532
533        // shift if full backgournd
534        //jQuery(ss_arrows).css('width', jQuery('#MegaMenu').width() + 100);
535        //jQuery(ss_arrows).css('left', -50);
536
537        //height / 2 : to have a middle
538        //30 : the height of the control
539        //(jQuery('#s4-contentBox').offset().top): the top offset of the container
540        var top = (jQuery(container).height() / 2) - 30 - (jQuery('#s4-contentBox').offset().top);
541        jQuery(ss_arrows).css('top', top);
542        jQuery(ss_links).css('position', 'fixed');
543        jQuery('#s6-slideShow').css('margin-top', 0);
544
545        jQuery(ss_links).css('top', jQuery(window).height() - 100);
546
547
548    }
549    else {
550        //background content
551
552        // jQuery(ss_arrows).css('width', jQuery('#MegaMenu').width());
553
554        var top = (jQuery(container).height() / 2) - 30;
555        jQuery(ss_arrows).css('top', top);
556
557        jQuery(ss_links).css('top', jQuery(container).height() - 50);
558
559
560
561    }
562
563
564}
565
566//timer
567var hsd_timer;
568//reset timer
569function hsd_resetTime() {
570    if (isPopup || hsd_time == 0)
571        return;
572    if (IsPlaying)
573        return;
574    if (stopRotation)
575        return;
576    window.clearInterval(hsd_timer);
577
578    hsd_timer = setInterval(function () { hsd_next() }, hsd_time);
579
580}
581
582function openConfigPage(Id, pageUrl, siteId, link) {
583
584
585    var libraryName = jQuery(link).parent().find('input')[0].value;
586    var options = {
587        url: L_Menu_BaseUrl + '/_layouts/15/FHD.Internet/ConfigureSlideShowPage.aspx?ID=' + Id + '&Library=' + libraryName + '&Page=' + pageUrl + '&SiteID=' + siteId,
588        showClose: false,
589        title: '',
590        showClose: true,
591        height: jQuery(window).height(),
592        width: jQuery(window).width()
593
594    };
595    SP.UI.ModalDialog.showModalDialog(options);
596}
597function ShowPauseSlideShow() {
598    jQuery("#big-video-vid_html5_api").show();
599    BV.getPlayer().play();
600    jQuery('#ss_play').hide();
601    jQuery('#ss_pause').show();
602    IsPlaying = true;
603    window.clearInterval(hsd_timer);
604}
605function ShowPlaySlideShow() {
606    jQuery("#big-video-vid_html5_api").show();
607    BV.getPlayer().pause();
608    jQuery('#ss_pause').hide();
609    jQuery('#ss_play').show();
610}
611
612function adjustButtonPlayPause() {
613    if (isWebpart) {
614
615        var windowW = (jQuery(container).width() / 2);
616        jQuery(ss_pause).css('position', 'absolute');
617        jQuery(ss_pause).css('z-index', '5');
618        jQuery(ss_pause).css('top', jQuery(ss_arrows).position().top);
619        jQuery(ss_pause).css('left', (windowW) - 30);
620        jQuery(ss_play).css('position', 'absolute');
621        jQuery(ss_play).css('top', jQuery(ss_arrows).position().top);
622        jQuery(ss_play).css('left', (windowW) - 30);
623        jQuery(ss_play).css('z-index', '5');
624    }
625    else {
626
627        if (FHD_IsSlideMaster) {
628            var windowW = (jQuery(window).width() / 2);
629            jQuery(ss_pause).css('position', 'absolute');
630            jQuery(ss_pause).css('z-index', '5');
631            jQuery(ss_pause).css('top', jQuery(ss_arrows).offset().top);
632            jQuery(ss_pause).css('left', '50%');
633            jQuery(ss_play).css('position', 'absolute');
634            jQuery(ss_play).css('top', jQuery(ss_arrows).offset().top);
635            jQuery(ss_play).css('left', '50%');
636            jQuery(ss_play).css('z-index', '5');
637        }
638        else {
639            adjustButton();
640        }
641
642    }
643
644
645}
646
647//hide the play button when we open the mega menu
648function hideSlideShowButtons() {
649    if (!isWebpart) {
650        jQuery('#play').hide();
651        jQuery('#pause').hide();
652        try {
653            BV.getPlayer().pause();
654        }
655        catch (err) {
656
657        }
658        jQuery('#ssm_arrows').hide();
659        jQuery('#ssm_links').hide();
660        jQuery('#ssm_caption').hide();
661        jQuery('#ssm_date').hide();
662        if (!FHD_IsFullSlideMaster)
663            jQuery('#ssm_links').next().css('margin-top', '0px');
664
665    }
666
667
668}
669
670//show the play button when we close the mega menu
671function showSlideShowButtons() {
672
673    if (FHD_IsHome_Page) {
674        if (FHD_IsSlideMaster) {
675            if (hsd_images.length == 0)
676                return;
677            if (hsd_images[currentIndex].video) {
678                if (jQuery('#pause').css('display') == 'none')
679                    jQuery('#play').show();
680            }
681
682
683            jQuery('#ssm_arrows').show();
684            jQuery('#ssm_links').show();
685            jQuery('#ssm_caption').show();
686            jQuery('#ssm_date').show();
687            if (!FHD_IsFullSlideMaster)
688                jQuery('#ssm_links').next().css('margin-top', '-50px');
689
690        }
691        else {
692            if (FHD_IsVideoBackground) {
693                if (jQuery('#pause').css('display') == 'none')
694                    jQuery('#play').show();
695                adjustButton();
696            }
697
698        }
699    }
700}
701

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.