1/* 2 * Tempera Theme custom frontend scripting 3 * http://www.cryoutcreations.eu/ 4 * 5 * Copyright 2013-16, 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 15 if (tempera_settings['fitvids'] == 1) jQuery(".entry-content").fitVids(); 16 }; 17 18 /* Standard menu touch support for tablets */ 19 var custom_event = ('ontouchstart' in window) ? 'touchstart' : 'click'; // check touch support 20 var ios = /iPhone|iPad|iPod/i.test(navigator.userAgent); 21 jQuery('#access .menu > ul > li a').on('click', function(e){ 22 var $link_id = jQuery(this).attr('href'); 23 if (jQuery(this).parent().data('clicked') == $link_id) { // second touch 24 jQuery(this).parent().data('clicked', null); 25 } 26 else { // first touch 27 if (custom_event != 'click' && !ios && (jQuery(this).parent().children('ul').length >0)) {e.preventDefault();} 28 jQuery(this).parent().data('clicked', $link_id); 29 } 30 }); 31 32 /* Back to top button animation */ 33 var offset = 500; 34 var duration = 500; 35 jQuery(window).scroll(function() { 36 if (jQuery(this).scrollTop() > offset) { 37 jQuery('#toTop').css({'margin-left':''+cryout_toTop_offset+'px','opacity':1}); 38 jQuery('#toTop').css({'margin-right':''+cryout_toTop_offset+'px','opacity':1}); 39 } else { 40 jQuery('#toTop').css({'margin-left':''+(cryout_toTop_offset+150)+'px','opacity':0}); 41 jQuery('#toTop').css({'margin-right':''+(cryout_toTop_offset+150)+'px','opacity':0}); 42 } 43 }); 44 jQuery('#toTop').click(function(event) { 45 event.preventDefault(); 46 jQuery('html, body').animate({scrollTop: 0}, duration); 47 return false; 48 }); 49 50 51 /* Menu animation */ 52 jQuery("#access ul ul").css({display: "none"}); /* Opera Fix */ 53 jQuery("#access > .menu ul li > a:not(:only-child)").attr("aria-haspopup","true");/* IE10 mobile Fix */ 54 55 jQuery("#access li").hover( 56 function(){ 57 jQuery(this).find('ul:first').stop(); 58 jQuery(this).find('ul:first').css({opacity: "0",marginTop:"50px"}).css({visibility: "visible",display: "block",overflow:"visible"}).animate({"opacity":"1",marginTop:"-=50"},{queue:false}); 59 }, function(){ 60 jQuery(this).find('ul:first').css({visibility: "visible",display: "block",overflow:"visible"}).animate({marginTop:"+=50"}, {queue:false}).fadeOut(); 61 } 62 ); 63 64 /* Social Icons Animation */ 65 jQuery(".socialicons").append('<div class="socials-hover"></div>'); 66 67 /* Detect and apply custom class for Safari */ 68 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) { 69 jQuery('body').addClass('safari'); 70 } 71 72}); 73/* end document.ready */ 74 75/* Mobile Menu v2 */ 76function tempera_mobilemenu_init() { 77 var state = false; 78 jQuery("#nav-toggle").click(function(){ 79 jQuery("#access").slideToggle(function(){ if (state) {jQuery(this).removeAttr( 'style' )}; state = ! state; } ); 80 }); 81} 82 83/* FitVids 1.1*/ 84;(function( $ ){ 85 86 'use strict'; 87 88 $.fn.fitVids = function( options ) { 89 var settings = { 90 customSelector: null, 91 ignore: null 92 }; 93 94 if(!document.getElementById('fit-vids-style')) { 95 // appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js 96 var head = document.head || document.getElementsByTagName('head')[0]; 97 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%;}'; 98 var div = document.createElement("div"); 99 div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>'; 100 head.appendChild(div.childNodes[1]); 101 } 102 103 if ( options ) { 104 $.extend( settings, options ); 105 } 106 107 return this.each(function(){ 108 var selectors = [ 109 'iframe[src*="player.vimeo.com"]', 110 'iframe[src*="youtube.com"]', 111 'iframe[src*="youtube-nocookie.com"]', 112 'iframe[src*="kickstarter.com"][src*="video.html"]', 113 'object', 114 'embed' 115 ]; 116 117 if (settings.customSelector) { 118 selectors.push(settings.customSelector); 119 } 120 121 var ignoreList = '.fitvidsignore'; 122 123 if(settings.ignore) { 124 ignoreList = ignoreList + ', ' + settings.ignore; 125 } 126 127 var $allVideos = $(this).find(selectors.join(',')); 128 $allVideos = $allVideos.not('object object'); // SwfObj conflict patch 129 $allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video. 130 131 $allVideos.each(function(){ 132 var $this = $(this); 133 if($this.parents(ignoreList).length > 0) { 134 return; // Disable FitVids on this video. 135 } 136 if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; } 137 if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width')))) 138 { 139 $this.attr('height', 9); 140 $this.attr('width', 16); 141 } 142 var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(), 143 width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(), 144 aspectRatio = height / width; 145 if(!$this.attr('name')){ 146 var videoName = 'fitvid' + $.fn.fitVids._count; 147 $this.attr('name', videoName); 148 $.fn.fitVids._count++; 149 } 150 $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%'); 151 $this.removeAttr('height').removeAttr('width'); 152 }); 153 }); 154 }; 155
156 // Internal counter for unique video names. 157 $.fn.fitVids._count = 0; 158 159// Works with either jQuery or Zepto 160})( window.jQuery || window.Zepto ); 161 162 163/* Returns the version of Internet Explorer or a -1 164 (indicating the use of another browser). */ 165function getInternetExplorerVersion() 166{ 167 var rv = -1; /* assume not IE. */ 168 if (navigator.appName == 'Microsoft Internet Explorer') 169 { 170 var ua = navigator.userAgent; 171 var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); 172 if (re.exec(ua) != null) 173 rv = parseFloat( RegExp.$1 ); 174 } 175 return rv; 176}
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.