1/* 2 Phantom by Pixelarity 3 pixelarity.com | [email protected] 4 License: pixelarity.com/license 5*/ 6 7(function($) { 8 9 skel.breakpoints({ 10 xlarge: '(max-width: 1680px)', 11 large: '(max-width: 1280px)', 12 medium: '(max-width: 980px)', 13 small: '(max-width: 736px)', 14 xsmall: '(max-width: 480px)' 15 }); 16 17 $(function() { 18 19 var $window = $(window), 20 $body = $('body'); 21 22 // Disable animations/transitions until the page has loaded. 23 $body.addClass('is-loading'); 24 25 $window.on('load', function() { 26 window.setTimeout(function() { 27 $body.removeClass('is-loading'); 28 }, 100); 29 }); 30 31 // Touch? 32 if (skel.vars.mobile) 33 $body.addClass('is-touch'); 34 35 // Forms. 36 var $form = $('form'); 37 38 // Auto-resizing textareas. 39 $form.find('textarea').each(function() { 40 41 var $this = $(this), 42 $wrapper = $('<div class="textarea-wrapper"></div>'), 43 $submits = $this.find('input[type="submit"]'); 44 45 $this 46 .wrap($wrapper) 47 .attr('rows', 1) 48 .css('overflow', 'hidden') 49 .css('resize', 'none') 50 .on('keydown', function(event) { 51 52 if (event.keyCode == 13 53 && event.ctrlKey) { 54 55 event.preventDefault(); 56 event.stopPropagation(); 57 58 $(this).blur(); 59 60 } 61 62 }) 63 .on('blur focus', function() { 64 $this.val($.trim($this.val())); 65 }) 66 .on('input blur focus --init', function() { 67 68 $wrapper 69 .css('height', $this.height()); 70 71 $this 72 .css('height', 'auto') 73 .css('height', $this.prop('scrollHeight') + 'px'); 74 75 }) 76 .on('keyup', function(event) { 77 78 if (event.keyCode == 9) 79 $this 80 .select(); 81 82 }) 83 .triggerHandler('--init'); 84 85 // Fix. 86 if (skel.vars.browser == 'ie' 87 || skel.vars.mobile) 88 $this 89 .css('max-height', '10em') 90 .css('overflow-y', 'auto'); 91 92 }); 93 94 // Fix: Placeholder polyfill. 95 $form.placeholder(); 96 97 // Prioritize "important" elements on medium. 98 skel.on('+medium -medium', function() { 99 $.prioritize( 100 '.important\\28 medium\\29', 101 skel.breakpoint('medium').active 102 ); 103 }); 104 105 // Menu. 106 var $menu = $('#menu'); 107 108 $menu.wrapInner('<div class="inner"></div>'); 109 110 $menu._locked = false; 111 112 $menu._lock = function() { 113 114 if ($menu._locked) 115 return false; 116 117 $menu._locked = true; 118 119 window.setTimeout(function() { 120 $menu._locked = false; 121 }, 350); 122 123 return true; 124 125 }; 126 127 $menu._show = function() { 128 129 if ($menu._lock()) 130 $body.addClass('is-menu-visible'); 131 132 }; 133 134 $menu._hide = function() { 135 136 if ($menu._lock()) 137 $body.removeClass('is-menu-visible'); 138 139 }; 140 141 $menu._toggle = function() { 142 143 if ($menu._lock()) 144 $body.toggleClass('is-menu-visible'); 145 146 }; 147 148 $menu 149 .appendTo($body) 150 .on('click', function(event) { 151 event.stopPropagation(); 152 }) 153 .on('click', 'a', function(event) { 154 155 var href = $(this).attr('href'); 156 157 event.preventDefault(); 158 event.stopPropagation(); 159 160 // Hide. 161 $menu._hide(); 162 163 // Redirect. 164 if (href == '#menu') 165 return; 166 167 window.setTimeout(function() { 168 window.location.href = href; 169 }, 350); 170 171 }) 172 .append('<a class="close" href="#menu">Close</a>'); 173 174 $body 175 .on('click', 'a[href="#menu"]', function(event) { 176 177 event.stopPropagation(); 178 event.preventDefault(); 179 180 // Toggle. 181 $menu._toggle(); 182 183 }) 184 .on('click', function(event) { 185 186 // Hide. 187 $menu._hide(); 188 189 }) 190 .on('keydown', function(event) { 191 192 // Hide on escape. 193 if (event.keyCode == 27) 194 $menu._hide(); 195 196 }); 197 198 }); 199 200})(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.