1/* 2 * Tempera Theme custom frontend scripting 3 * http://www.cryoutcreations.eu/ 4 * 5 * Copyright 2013-22, Cryout Creations 6 * Free to use and abuse under the GPL v3 license. 7 */ 8 9jQuery(document).ready(function() { 10 11 // responsiveness check 12 if (tempera_settings['mobile'] == 1) { 13 tempera_mobilemenu_init(); 14 if (tempera_settings['fitvids'] == 1) jQuery(".entry-content").fitVids(); 15 }; 16 17 /* Standard menu touch support for tablets */ 18 var custom_event = ('ontouchstart' in window) ? 'touchstart' : 'click'; // check touch support 19 var ios = /iPhone|iPad|iPod/i.test(navigator.userAgent); 20 jQuery('#access .menu > ul > li a').on('click focus', function(e){ 21 var $link_id = jQuery(this).attr('href'); 22 if (jQuery(this).parent().data('clicked') == $link_id) { // second touch 23 jQuery(this).parent().data('clicked', null); 24 } 25 else { // first touch 26 if (custom_event != 'click' && !ios && (jQuery(this).parent().children('ul').length >0)) { e.preventDefault(); } 27 jQuery(this).parent().data('clicked', $link_id); 28 if (e.type == 'focus') jQuery(this).trigger('click'); // emulate click on focus 29 } 30 }); 31 32 /* First and last elements in the loop */ 33 var firstTab = jQuery( '#nav-toggle' ), 34 lastTab = jQuery( '#access ul.menu > li:last-child a' ); 35 36 /* Redirect last tab to first input */ 37 lastTab.on( 'keydown', function ( e ) { 38 if ( firstTab.is(':visible') ) 39 if ( ( e.which === 9 && ( ! e.shiftKey ) ) ) { 40 e.preventDefault(); 41 firstTab.trigger( 'focus' ); 42 } 43 } ); 44 45 /* Redirect first shift+tab to last input*/ 46 firstTab.on( 'keydown', function ( e ) { 47 if ( firstTab.is(':visible') ) 48 if ( ( e.which === 9 && e.shiftKey ) ) { 49 e.preventDefault(); 50 lastTab.trigger( 'focus' ); 51 } 52 } ); 53 54 // Main navigation submenus 55 jQuery( '#access li' ).on( 'mouseenter', function() { 56 jQuery( this ).addClass( 'menu-hover' ); 57 } ).on( 'mouseleave', function() { 58 jQuery( this ).removeClass( 'menu-hover' ); 59 } ); 60 61 jQuery( '#access ul' ).find( 'a' ).on( 'focus', function() { 62 jQuery( this ).parents( '.menu-item, .page_item' ).addClass( 'menu-hover' ); 63 } ); 64 65 jQuery( '#access ul' ).find( 'a' ).on( 'blur', function() { 66 jQuery( this ).parents( '.menu-item, .page_item' ).removeClass( 'menu-hover' ); 67 } ); 68 69 /* Back to top button animation */ 70 var offset = 500; 71 var duration = 500; 72 jQuery(window).on('scroll', function() { 73 if (jQuery(this).scrollTop() > offset) { 74 jQuery('#toTop').css({'margin-left':''+cryout_toTop_offset+'px','opacity':1}); 75 jQuery('#toTop').css({'margin-right':''+cryout_toTop_offset+'px','opacity':1}); 76 } else { 77 jQuery('#toTop').css({'margin-left':''+(cryout_toTop_offset+150)+'px','opacity':0}); 78 jQuery('#toTop').css({'margin-right':''+(cryout_toTop_offset+150)+'px','opacity':0}); 79 } 80 }); 81 jQuery('#toTop').on('click', function(event) { 82 event.preventDefault(); 83 jQuery('html, body').animate({scrollTop: 0}, duration); 84 return false; 85 }); 86 87 /* Social Icons Animation */ 88 jQuery(".socialicons").append('<div class="socials-hover"></div>'); 89 90 /* Detect and apply custom class for Safari */ 91 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) { 92 jQuery('body').addClass('safari'); 93 } 94 95}); 96/* end document.ready */ 97 98/* Mobile Menu v2 */ 99function tempera_mobilemenu_init() { 100 var state = false; 101 jQuery("#nav-toggle").on( 'click', function(){ 102 jQuery(this).toggleClass('active'); 103 jQuery("#access").slideToggle(function(){ if (state) {jQuery(this).removeAttr( 'style' )}; state = ! state; } ); 104 }); 105} 106 107/*! 108* FitVids 1.1 - slightly customized for Tempera 109* 110* Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com 111* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/ 112* Released under the WTFPL license - http://sam.zoy.org/wtfpl/ 113* 114* Date: Thu Sept 01 18:00:00 2011 -0500 115*/ 116 117;(function( $ ){ 118 119 'use strict'; 120 $.fn.fitVids = function( options ) { 121 var settings = { 122 customSelector: null, 123 ignore: null 124 }; 125 126 if(!document.getElementById('fit-vids-style')) { 127 /* appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js */ 128 var head = document.head || document.getElementsByTagName('head')[0]; 129 var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}'; 130 var div = document.createElement("div"); 131 div.innerHTML = '<p>
131x</p><style id="fit-vids-style">' + css + '</style>'; 132 head.appendChild(div.childNodes[1]); 133 } 134 135 if ( options ) { 136 $.extend( settings, options ); 137 } 138 139 return this.each(function(){ 140 var selectors = [ 141 'iframe[src*="player.vimeo.com"]', 142 'iframe[src*="youtube.com"]', 143 'iframe[src*="youtube-nocookie.com"]', 144 'iframe[src*="kickstarter.com"][src*="video.html"]', 145 'object', 146 'embed' 147 ]; 148 149 if (settings.customSelector) { 150 selectors.push(settings.customSelector); 151 } 152 153 var ignoreList = '.fitvidsignore'; 154 155 if(settings.ignore) { 156 ignoreList = ignoreList + ', ' + settings.ignore; 157 } 158 159 var $allVideos = $(this).find(selectors.join(',')); 160 $allVideos = $allVideos.not('object object'); /* SwfObj conflict patch */ 161 $allVideos = $allVideos.not(ignoreList); /* Disable FitVids on this video */ 162 163 $allVideos.each(function(){ 164 var $this = $(this); 165 if($this.parents(ignoreList).length > 0) { 166 return; /* Disable FitVids on this video. */ 167 } 168 if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; } 169 if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width')))) 170 { 171 $this.attr('height', 9); 172 $this.attr('width', 16); 173 } 174 var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(), 175 width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(), 176 aspectRatio = height / width; 177 178 if ( width<tempera_settings['contentwidth'] ) { return; } /* hack to not resize small objects */ 179 if(!$this.attr('name')){ 180 var videoName = 'fitvid' + $.fn.fitVids._count; 181 $this.attr('name', videoName); 182 $.fn.fitVids._count++; 183 } 184 $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%'); 185 $this.removeAttr('height').removeAttr('width'); 186 }); 187 }); 188 }; 189 190 /* Internal counter for unique video names. */ 191 $.fn.fitVids._count = 0; 192 193/* Works with either jQuery or Zepto */ 194})( window.jQuery || window.Zepto ); 195 196 197/* Returns the version of Internet Explorer or a -1 198 (indicating the use of another browser). */ 199function getInternetExplorerVersion() 200{ 201 var rv = -1; /* assume not IE. */ 202 if (navigator.appName == 'Microsoft Internet Explorer') 203 { 204 var ua = navigator.userAgent; 205 var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); 206 if (re.exec(ua) != null) 207 rv = parseFloat( RegExp.$1 ); 208 } 209 return rv; 210} 211
212/* FIN */
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.