PageSourceSearch

https://www.royaldebit.com/wp-content/plugins/pricing-table-by-supsystic/modules/tables/js/modal.js?ver=1.8.4

js royaldebit.com collected 2026-10-09 21:58:35 UTC 4,182 bytes, 167 lines download raw bytes

1(function ($) {
2	'use strict';
3
4	$.fn.sModal = function(options) {
5		var self = this,
6			settings = $.extend({
7				width: 640,
8				height: 480,
9				buttons: [],
10			}, options),
11			$modalOverlay,
12			$modalContainer,
13			$closeModalButton,
14			$modalContent,
15			$modalButtons,
16			modalOverlayStyle = {
17				position: 'fixed',
18				top: 0,
19				left: 0,
20				background: 'rgba(0,0,0,.75)',
21				width: '100%',
22				height: '100%',
23				'z-index': '100000',
24				display: 'none',
25				'overflow-y': 'auto',
26			},
27			modalContainerStyle = {
28				width: settings.width,
29				position: 'absolute',
30				top: '50%',
31				left: '50%',
32				'max-width': 'calc(100% - 1.5em)',
33				'margin-right': '-50%',
34				'margin-bottom': '20px',
35				transform: 'translate(-50%, -50%)',
36				background: '#fff',
37				padding: '1em',
38			},
39			modalContentStyle = {
40				height: 'calc(100% - 3.6em)',
41				'overflow-y': 'auto',
42				'overflow-x': 'hidden',
43				padding: '1em',
44			},
45			closeButtonStyle = {
46				position: 'absolute',
47				right: '10px',
48				top: '10px',
49				'font-size': '35px',
50				color: '#fff',
51				cursor: 'pointer',
52			},
53			modalButtonsStyle = {
54				position: 'relative',
55				width: '100%',
56				'text-align': 'right',
57				'margin-top': '1em',
58			};
59
60
61		function closeModal() {
62			self.trigger('close.before');
63			if (jQuery('.sModal:visible').length < 2) {
64				jQuery('body').css('overflow', 'auto');
65			}
66			$modalOverlay.fadeOut();
67			self.trigger('close.after');
68		}
69
70		function openModal() {
71			jQuery('body').css('overflow', 'hidden');
72			$modalOverlay.show(0, function() {
73				resizeModal();
74				$modalOverlay.hide().fadeIn();
75			});
76			
77			if( parseInt(jQuery('.sc-modal-container').css('top')) > jQuery(window).height()){
78				var offset = jQuery(window).height() / 2 + 40;
79				jQuery('.sc-modal-container').css('top' , offset);
80			}
81			
82		}
83
84		function resizeModal() {
85			var offset = '50%';
86			if ($modalContainer.height() > jQuery(window).height()) {
87				offset = $modalContainer.height() / 2 + 40;
88			}
89			$modalContainer.css('top', offset);
90		}
91
92		function createInstance($modalTemplate) {
93
94			$modalOverlay = jQuery('<div class="sc-modal-overlay" tabindex="0">').css(modalOverlayStyle);
95			
96			$modalContainer = jQuery('<div class="sc-modal-container">').css(modalContainerStyle);
97			
98			$closeModalButton = jQuery('<div class="sc-modal-close-button">&times;</div>').css(closeButtonStyle);
99			$closeModalButton.appendTo($modalOverlay);
100
101			$modalContent = jQuery('<div class="sc-modal-content">').css(modalContentStyle);
102			$modalContent.appendTo($modalContainer);
103
104			$modalTemplate.appendTo($modalContent).show();
105
106			$modalContainer.appendTo($modalOverlay);
107
108			$modalOverlay.appendTo('body');
109			$modalOverlay.add($closeModalButton).on('click', function(event) {
110				if (jQuery(this).is(jQuery(event.target))) {
111					closeModal();
112				}
113			});
114
115			jQuery(document).on('keyup', function(event) {
116				if (event.which == 27 && $modalOverlay.is(':visible')) {
117					closeModal();
118				}
119			});
120
121			var resizeTimer;
122
123			jQuery(window).on('resize', function(event) {
124				clearTimeout(resizeTimer);
125				resizeTimer = setTimeout(function() {
126					resizeModal();
127				}, 250);
128			});
129
130			if (settings.buttons.length > 0) {
131				$modalButtons = jQuery('<div class="sc-modal-action-buttons">').css(modalButtonsStyle);
132
133				for (var i = 0; i < settings.buttons.length; i++) {
134					jQuery('<button>').attr('class', settings.buttons[i].class || null)
135					.html(settings.buttons[i].content || null)
136					.on('click', $.proxy(settings.buttons[i].event, $modalTemplate))
137					.appendTo($modalButtons);
138				}
139
140				self.$buttons = $modalButtons;
141
142				$modalButtons.appendTo($modalContainer);
143			}
144			
145		}
146
147		createInstance(this);
148
149		$.extend(this, {
150			open: function() {
151				this.trigger('open.before');
152				openModal();
153				this.trigger('open.after');
154				return this;
155			},
156			close: function() {
157				this.trigger('close.before');
158				closeModal();
159				this.trigger('close.after');
160				return this;
161			}
162		});
163
164		return this;
165	};
166
167})(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.