PageSourceSearch

https://www.ronanhardiman.com/wp-content/themes/ronan-hardiman/jav…/helpers/jquery.fancybox-buttons.js?v=1.0.3

js ronanhardiman.com collected 2026-10-02 13:43:08 UTC 2,944 bytes, 120 lines download raw bytes

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