PageSourceSearch

https://ultrazvuk-tarle.hr/js/fancybox/jquery.fancybox-buttons.js

js ultrazvuk-tarle.hr collected 2026-10-06 22:11:26 UTC 2,879 bytes, 115 lines download raw bytes

1 /*!
2 * Buttons helper for fancyBox
3 * version: 1.0.2
4 * @requires fancyBox v2.0 or later
5 *
6 * Usage: 
7 *     $(".fancybox").fancybox({
8 *         buttons: {
9 *             position : 'top'
10 *         }
11 *     });
12 * 
13 * Options:
14 *     tpl - HTML template
15 *     position - 'top' or 'bottom'
16 * 
17 */
18(function ($) {
19	//Shortcut for fancyBox object
20	var F = $.fancybox;
21
22	//Add helper object
23	F.helpers.buttons = {
24		tpl: '<div id="fancybox-buttons"><ul><li><a class="btnPrev" title="Prethodno" href="javascript:;"></a></li><li><a class="btnPlay" title="Pokreni slideshow" href="javascript:;"></a></li><li><a class="btnNext" title="Slijedeće" href="javascript:;"></a></li><li><a class="btnToggle" title="Promijeni veličinu" href="javascript:;"></a></li><li><a class="btnClose" title="Zatvori" href="javascript:jQuery.fancybox.close();"></a></li></ul></div>',
25		list: null,
26		buttons: {},
27
28		update: function () {
29			var toggle = this.buttons.toggle.removeClass('btnDisabled btnToggleOn');
30
31			//Size toggle button
32			if (F.current.canShrink) {
33				toggle.addClass('btnToggleOn');
34
35			} else if (!F.current.canExpand) {
36				toggle.addClass('btnDisabled');
37			}
38		},
39
40		beforeLoad: function (opts) {
41			//Remove self if gallery do not have at least two items
42			if (F.group.length < 2) {
43				F.coming.helpers.buttons = false;
44				F.coming.closeBtn = true;
45
46				return;
47			}
48
49			//Increase top margin to give space for buttons
50			F.coming.margin[ opts.position === 'bottom' ? 2 : 0 ] += 30;
51		},
52
53		onPlayStart: function () {
54			if (this.list) {
55				this.buttons.play.attr('title', 'Pause slideshow').addClass('btnPlayOn');
56			}
57		},
58
59		onPlayEnd: function () {
60			if (this.list) {
61				this.buttons.play.attr('title', 'Start slideshow').removeClass('btnPlayOn');
62			}
63		},
64
65		afterShow: function (opts) {
66			var buttons;
67
68			if (!this.list) {
69				this.list = $(opts.tpl || this.tpl).addClass(opts.position || 'top').appendTo('body');
70
71				this.buttons = {
72					prev : this.list.find('.btnPrev').click( F.prev ),
73					next : this.list.find('.btnNext').click( F.next ),
74					play : this.list.find('.btnPlay').click( F.play ),
75					toggle : this.list.find('.btnToggle').click( F.toggle )
76				}
77			}
78
79			buttons = this.buttons;
80
81			//Prev
82			if (F.current.index > 0 || F.current.loop) {
83				buttons.prev.removeClass('btnDisabled');
84			} else {
85				buttons.prev.addClass('btnDisabled');
86			}
87
88			//Next / Play
89			if (F.current.loop || F.current.index < F.group.length - 1) {
90				buttons.next.removeClass('btnDisabled');
91				buttons.play.removeClass('btnDisabled');
92
93			} else {
94				buttons.next.addClass('btnDisabled');
95				buttons.play.addClass('btnDisabled');
96			}
97
98			this.update();
99		},
100
101		onUpdate: function () {
102			this.update();
103		},
104
105		beforeClose: function () {
106			if (this.list) {
107				this.list.remove();
108			}
109
110			this.list = null;
111			this.buttons = {};
112		}
113	};
114
115}(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.