PageSourceSearch

http://www.aisleone.net/wp-content/themes/blask/js/blask.js?ver=20150625

js aisleone.net collected 2026-10-02 03:57:17 UTC 3,909 bytes, 138 lines download raw bytes

1( function( $ ) {
2	var $body = $( 'body' );
3	var $window = $( window );
4
5	// Add dropdown toggle that display child menu items.
6	$( '.main-navigation .menu-item-has-children > a' ).after( '<button class="dropdown-toggle" aria-expanded="false">' + screenReaderText.expand + '</button>' );
7
8	// Toggle buttons and submenu items with active children menu items.
9	$( '.main-navigation .current-menu-ancestor > a' ).addClass( 'toggled' );
10	$( '.main-navigation .current-menu-ancestor > button' ).addClass( 'toggled' );
11	$( '.main-navigation .current-menu-ancestor > .sub-menu' ).addClass( 'toggled' );
12
13	// Click on dropdown toggle.
14	$( '.dropdown-toggle' ).click( function( e ) {
15		var _this = $( this );
16		e.preventDefault();
17		_this.toggleClass( 'toggled' );
18		_this.prev( 'a' ).toggleClass( 'toggled' );
19		_this.next( '.children, .sub-menu' ).toggleClass( 'toggled' );
20		_this.attr( 'aria-expanded', _this.attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' );
21		_this.html( _this.html() === screenReaderText.expand ? screenReaderText.collapse : screenReaderText.expand );
22	} );
23
24	// Calculate the position of main content
25	function contentPosition() {
26
27		if( $( window ).width() >= 748 ) {
28
29			var toolbarHeight = $body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0;
30
31			$( '.site-main' ).css( {
32				'margin-top'  : ( 72 - toolbarHeight ) + 'px',
33			} );
34
35		} else {
36
37			$( '.site-main' ).css( { 'margin-top'  : 'auto' } );
38
39		}
40
41	}
42
43	// Adjust website title font-size to fit its container
44	function resizeTitle( el ) {
45
46		var $el = $( el ),
47			$parent = $( el ).parent(),
48			$parentWidth = $el.parent().width(),
49			fontSize = parseInt( $( el ).css( 'font-size' ), 10 );
50
51		if ( $el.width() > $parentWidth ) {
52
53			while ( $el.width() > $parentWidth && fontSize > 18 ) {
54				$el.css( 'font-size', --fontSize + 'px' );
55				$parent.css( 'line-height', fontSize * 1.5 + 'px' );
56			}
57
58		} else {
59
60			while ( $el.width() < $parentWidth && fontSize < 42 ) {
61				$el.css( 'font-size', ++fontSize + 'px');
62				$parent.css( 'line-height', fontSize * 1.3 + 'px' );
63			}
64
65		}
66	}
67
68	// Add extra class to large images in single project view. Props to Intergalactic theme
69	function outdentImages() {
70		$( '.jetpack-portfolio.hentry .entry-content img' ).each( function() {
71			var img 	= $( this ),
72				caption = $( this ).closest( 'figure' ),
73				imgPos  = $( this ).offset().top,
74				metaPos = $( '.entry-meta' ).offset().top + $( '.entry-meta' ).height() + 21,
75				new_img = new Image();
76
77				new_img.src = img.attr( 'src' );
78
79				$( new_img ).load( function() {
80
81					var img_width = new_img.width;
82
83					if ( imgPos > metaPos ) {
84						if ( img_width >= 880 ) {
85							$( img ).addClass( 'size-big' );
86						}
87
88						if ( caption.hasClass( 'wp-caption' ) && img_width >= 880 ) {
89							caption.addClass( 'caption-big' );
90						}
91					} else {
92						return;
93					}
94
95			} );
96		} );
97	}
98
99	// Initialize functions
100	$( function() {
101		resizeTitle( '.site-title a' );
102		$( '.site-title a' ).animate( {
103			'opacity': 1
104		}, 500 );
105
106		outdentImages();
107
108		contentPosition();
109		$( '#primary' ).animate( {
110			'opacity': 1
111		}, 500 );
112
113		$('.entry-content a img, .entry-summary a img, .page-content a img').parent().css('border','none');
114	});
115
116	$( window ).on( 'resize', function() {
117		resizeTitle( '.site-title a' );
118		contentPosition();
119	} );
120
121	// Attach resizeTitle function to window, to be able to use it in Customizer
122	window.blaskResizeTitle = resizeTitle;
123
124	$( window ).on( 'load', function() {
125
126		// Triggers resize event to make sure video widgets in the footer maintain the correct aspect ratio
127		setTimeout( function(){
128			if ( typeof( Event ) === 'function' ) {
129				window.dispatchEvent( new Event( 'resize' ) );
130			} else {
131				var event = window.document.createEvent( 'UIEvents' );
132				event.initUIEvent( 'resize', true, false, window, 0 );
133				window.dispatchEvent( event );
134			}
135		} );
136	});
137
138} )( 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.