PageSourceSearch

https://www.badiassad.com.br/wp-content/plugins/stkit/components/shortcodes/assets/js/jquery.shortcodes.js

js badiassad.com.br collected 2026-10-02 14:03:58 UTC 10,004 bytes, 506 lines download raw bytes

1/*
2
3	01. - Dynamic styles holder
4	02. - Toggle
5	03. - Tabs
6	04. - Alert messages
7	05. - Skill bar
8	06. - Icons for Lists
9	07. - Tooltips
10	08. - Mediaelement fix
11*/
12
13/* jshint -W099 */
14/* global jQuery:false, stData:false */
15
16var sh = jQuery.noConflict();
17
18sh(function(){
19
20	'use strict';
21
22/*==01.==========================================
23
24 	D I N A M I C   S T Y L E S
25	Holder for dynamic styles
26
27===============================================*/
28
29	if ( !sh('#st-dynamic-css').length ) {
30
31		sh('head').append('<style id="st-dynamic-css" type="text/css"></style>');
32
33	}
34
35
36/*==02.==========================================
37
38	T O G G L E
39	Toggle & Accordion
40
41===============================================*/
42
43/*
44
45	1 - TOGGLE
46
47		1.1 - Activation
48		1.2 - Opening
49		1.3 - Closing
50		1.4 - Accordion
51		1.5 - Click on
52
53*/
54
55	/*-------------------------------------------
56		1.1 - Activation
57	-------------------------------------------*/
58
59	sh('.toggle-opened').each(function(){
60
61		toggleOpen ( sh(this) );
62
63	});
64
65
66	/*-------------------------------------------
67		1.2 - Opening
68	-------------------------------------------*/
69
70	function toggleOpen( toggle ) {
71
72		var
73			holder = toggle.find( '.toggle-holder' ),
74			height = toggle.find( '.toggle-box' ).outerHeight( true );
75
76			// Opening
77			holder.stop( true, false ).animate({ height: height }, 300, function(){ holder.css( 'height', 'auto' ) });
78
79			// Change class-status for toggle
80			toggle.removeClass( 'toggle-closed' ).addClass( 'toggle-opened' );
81
82	}
83
84
85	/*-------------------------------------------
86		1.3 - Closing
87	-------------------------------------------*/
88
89	function toggleClose( toggle ) {
90
91		var
92			holder = toggle.find( '.toggle-holder' );
93
94			// Closing
95			holder.stop( true, false ).animate({ height: 0 }, 300);
96
97			// Change class-status for toggle
98			toggle.removeClass( 'toggle-opened' ).addClass( 'toggle-closed' );
99
100	}
101
102
103	/*-------------------------------------------
104		1.4 - Accordion
105	-------------------------------------------*/
106
107	function toggleAccordion( toggle ) {
108
109		// Close all holders
110		toggle.parent().find( '.toggle-holder' ).each(function(){
111
112			sh(this).stop( true, false ).animate({ height: 0 }, 300);
113
114			// Change class-status for toggle
115			sh(this).parent().removeClass( 'toggle-opened' ).addClass( 'toggle-closed' );
116
117		});
118
119		// Open required holder
120		toggleOpen( toggle );
121
122	}
123
124
125	/*-------------------------------------------
126		1.5 - Click on
127	-------------------------------------------*/
128
129	sh('.toggle-title').click(function(){
130
131		var
132			toggle		= sh(this).parent(),
133			accordion	= toggle.parent().hasClass( 'accordion' ) ? 1 : '',
134			status		= toggle.hasClass( 'toggle-opened' ) ? 'opened' : 'closed';
135
136			// If accordion
137			if ( accordion ) {
138
139				toggleAccordion( toggle );
140
141				return;
142
143			}
144
145			// If closed
146			if ( status === 'closed' ) {
147				toggleOpen( toggle ); }
148
149			// If opened
150			if ( status === 'opened' ) {
151				toggleClose( toggle ); }
152
153	});
154
155
156/*==03.==========================================
157
158 	T A B S
159	Simple tabs
160
161===============================================*/
162
163/*
164
165	1 - TABS
166
167		1.1 - Functions
168		1.2 - Activation
169
170*/
171
172	/*-------------------------------------------
173		1.1 - Functions
174	-------------------------------------------*/
175
176	sh('.st-ul li').each(function(){
177		
178		sh(this).click(function(){
179
180			var
181				li = sh(this);
182
183				li.parent().children( '.st-current' ).removeClass( 'st-current' );
184				li.addClass( 'st-current' );
185
186			var
187				liIndex = li.prevAll().length,
188				st_tabs = li.parent().next( '.st-tabs' );
189
190				st_tabs.children( '.block' ).removeClass( 'block' );
191				st_tabs.children().eq( liIndex ).css({ opacity: 0 }).addClass( 'block' ).animate({ opacity: 1 }, 300);
192
193		});
194
195	});
196
197
198	/*-------------------------------------------
199		1.2 - Activation
200	-------------------------------------------*/
201
202	sh( '.st-ul li:first-child' ).addClass( 'st-current' );
203	sh( '.st-tabs > div:first-child' ).addClass( 'block' );
204
205
206/*==04.==========================================
207
208 	A L E R T   M E S S A G E S
209	Remove alert by click
210
211===============================================*/
212
213	sh('.alert-close').click(function(){
214
215		sh(this).parent().animate({ opacity: 0 }, 300, function(){
216
217			sh(this).animate({ height: 0, padding: 0, margin: 0 }, 300, function(){
218
219				sh(this).remove();
220
221			});
222
223		});
224
225	});
226
227
228/*==05.==========================================
229
230 	S K I L L   B A R
231	Animated bar for [skill] shortcode
232
233===============================================*/
234
235/*
236
237	1 - SKILL
238
239		1.1 - by scroll
240		1.2 - by loading
241
242*/
243
244	/*-------------------------------------------
245		1.1 - by scroll
246	-------------------------------------------*/
247
248	if ( sh('.skill-scroll').length ) {
249
250		setInterval( function(){
251	
252			sh('.skill-scroll').not('.skill-animated').each(function(){
253	
254				var
255					windowHeight = sh(window).height(),
256					windowPosition = sh(window).scrollTop(),
257					elementPosition = sh(this).offset().top,
258					currentPosition = elementPosition - windowPosition;
259			
260					if ( currentPosition < windowHeight - 100 ) {
261	
262						var progress = sh(this).attr('data-progress');
263	
264						sh(this).addClass('skill-animated').animate({ width: progress + '%' }, 2000);
265		
266	
267					}
268	
269			});
270	
271		}, 310 );
272
273	}
274
275
276	/*-------------------------------------------
277		1.2 - by loading
278	-------------------------------------------*/
279
280	sh('.skill-auto').each(function(){
281
282		var progress = sh(this).attr('data-progress');
283
284		sh(this).animate({ width: progress + '%' }, 2000);
285
286	});
287
288
289/*==06.==========================================
290
291 	L I S T S
292	Apply icon for styles lists
293
294===============================================*/
295
296	// is StrictThemes font based
297	if ( sh('body').hasClass('font-st') ) {
298
299		sh('ul.list').each(function(){
300
301			var
302				str = sh(this).attr('class'),
303				icon = str.split('list-');
304
305				sh(this).find('> li').each(function(){
306
307					sh(this).addClass('ico-st ico-' + icon[1]);
308
309				});
310
311		});
312
313	}
314
315	// else icon based list
316	else {
317
318		sh('ul.list').each(function(){
319	
320			var
321				str = sh(this).attr('class'),
322				icon = str.split('list-'),
323				size = sh('body').hasClass('hidpi') ? 32 : 16,
324				style = '.list-' + icon[1] + ' > li:before { background: url("' + stData[3] + '/wp-content/plugins/stkit/assets/images/icons/' + size + '/glyphs/gray/' + icon[1] + '.png") left center no-repeat; }',
325				dynamic = sh('#st-dynamic-css').html(),
326				check = dynamic.split(style);
327	
328				if ( !check[1] ) {
329					sh('#st-dynamic-css').append( style + "\n" ); }
330	
331		});
332
333	}
334
335
336/*==04.==========================================
337
338	T O O L T I P S
339	Simple tooltips
340
341===============================================*/
342
343/*
344
345	1 - TOOLTIPS
346
347		1.1 - Calendar tooltips
348		1.2 - Flickr tooltips
349		1.3 - Function
350
351*/
352
353	/*-------------------------------------------
354		1.1 - Calendar tooltips
355	-------------------------------------------*/
356
357	sh('.widget_calendar tbody a, #prev a, #next a').addClass('tooltip');
358
359
360	/*-------------------------------------------
361		1.2 - Flickr tooltips
362	-------------------------------------------*/
363
364	sh('#flickr img').addClass('tooltip');
365
366
367	// Removing & setting back
368	// titles by mouse hover
369
370	sh('#flickr .flickr_badge_image a')
371
372		.hover(
373
374			function(){
375
376				var
377					title = sh(this).attr('title');
378
379					sh(this)
380						.removeAttr('title')
381						.attr( 'data-title', title );
382
383
384			},
385
386			function(){
387
388				var
389					title = sh(this).attr('data-title');
390
391					sh(this)
392						.removeAttr('data-title')
393						.attr( 'title', title );
394
395			}
396
397		)
398
399		.mousedown(
400
401			function(){
402
403				var
404					title = sh(this).attr('data-title');
405
406					sh(this)
407						.removeAttr('data-title')
408						.attr( 'title', title );
409
410			}
411
412		);
413
414
415	/*-------------------------------------------
416		1.3 - Function
417	-------------------------------------------*/
418
419	sh('.tooltip').each(function(){
420
421		sh(this)
422
423			.hover(
424	
425				function(){
426	
427					var
428						tt_title = sh(this).attr('title');
429	
430						if ( tt_title ) {
431		
432							sh(this).attr('title','');
433	
434							sh('#layout').append('<div id="tooltip-holder" style="opacity: 0;"></div>');
435		
436							sh('#tooltip-holder').html('<div class="tooltip-holder">' + tt_title + '</div>');
437				
438							sh('body').mousemove(function(ev) {
439
440								sh('#tooltip-holder').delay(800).animate({ opacity: 1 }, 300 )
441									.css({
442										'left': ev.pageX + 10 + 'px',
443										'top': ev.pageY + 30 + 'px'
444									});
445
446							});
447				
448						}
449
450				},
451	
452				function(){
453
454					var
455						tt_title = sh('#tooltip-holder > div').html();
456
457						sh(this).attr( 'title', tt_title );
458	
459						sh('#tooltip-holder').remove();
460	
461				}
462	
463			);
464
465	});
466
467
468	/*-------------------------------------------
469		1.4 - CSS Tooltip
470	-------------------------------------------*/
471
472	sh('.tooltip-css').each(function(){
473
474		sh(this).append('<span class="tooltip-css-holder">' + sh(this).attr('data-title') + '</span>');
475
476	});
477
478
479
480/*==08.==========================================
481
482	M E D I A E L E M E N T
483	Fix dimensions of sefl-hosted videos
484
485===============================================*/
486
487	sh('video').each(function() {
488
489		var
490			factor = 9 / 16,
491			wp_video = sh(this).parents('.wp-video'),
492			wp_video_W = wp_video.width(),
493			wp_video_H = Math.round( wp_video.width() * factor );
494
495			sh(this).attr( 'data-width', wp_video_W + 'px' ).attr( 'data-height', wp_video_H + 'px' );
496
497	});
498
499	sh('.wp-video').css({ 'width': '100%', 'height': '100%' });
500
501	sh('video').width('100%').height( sh(this).attr('data-height') ).css({ 'width': '100%', 'height': sh(this).attr('data-height') });
502
503
504});
505
506

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.