1 2 3// Adds a class 'js_on' to the <html> tag if JavaScript is enabled, 4// also helps remove flickering... 5document.documentElement.className += ' js_on '; 6 7// Quick script to detect some more popular mobile devices 8var detectedDeviceAgent = navigator.userAgent.toLowerCase(); 9var detectedAgentID = detectedDeviceAgent.match(/(android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini)/); 10if (detectedAgentID) { document.body.className += ' mobile-detected'; } 11 12// Signup Button 13jQuery(document).ready(function($){ 14 $('p.signup-button a') 15 .css({'backgroundPosition': '0 0'}) 16 .hover(function(){ 17 $(this).stop() 18 .animate({ 19 'opacity': 0 20 }, 650); 21 }, 22 function(){ 23 $(this).stop() 24 .animate({ 25 'opacity': 1 26 }, 650); 27 } 28 ); 29}); 30 31// Smooth scrolling related scripts 32jQuery(document).ready(function($) { 33 // "Back to Top" smooth scrolling 34 $('a[href=#top]').click(function(){ 35 $('html, body').animate({scrollTop:0}, 'slow'); 36 return false; // returning 'false' will prevent hashtag being added to URL 37 }); 38 39 // Smooth page scrolling to an anchor on the same page 40 if (udesign_script_vars.disable_smooth_scrolling_on_pages != 'yes') { 41 $('a[href*=#]:not([href=#], a.vc-carousel-control, a.vc_carousel-control, .wpb_tabs_nav a, a.acomment-reply.bp-primary-action)').click(function() { 42 if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { 43 // determine if the scroll-to target position should be offset (ex. if "Stay-on-Top" menu, "Admin Bar", etc.) 44 var offsetElement = 0; 45 if ($('body').hasClass('u-design-fixed-menu-on')) { offsetElement = 40; } 46 if ($('body').hasClass('admin-bar')) { offsetElement += 32; } 47 48 var target = $(this.hash); 49 target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); 50 if (target.length) { 51 $('html,body').animate({ 52 scrollTop: target.offset().top - offsetElement 53 }, 1000); 54 // if anchor is pointing to any "Tabs" then keep the hash "tab-..." else remove the hash 55 if ( this.hash.slice(1,5) === "tab-" ) { 56 return true; // add the hashtag to URL 57 } else { 58 return false; // remove hashtag from URL 59 } 60 } 61 } 62 }); 63 } 64}); 65 66// Menu Related Scripts 67jQuery(document).ready(function($){ 68 var showAutoArrows = ( $('body').hasClass('u-design-menu-auto-arrows-on') ) ? 1 : 0; 69 $("#navigation-menu ul.sf-menu").supersubs({ 70 minWidth: 12, // minimum width of sub-menus in em units 71 maxWidth: 15, // maximum width of sub-menus in em units 72 extraWidth: 1 // extra width can ensure lines don't sometimes turn over 73 // due to slight rounding differences and font-family 74 }).superfish({ 75 hoverClass: 'sfHover', // the class applied to hovered list items 76 delay: 700, // the delay in milliseconds that the mouse can remain outside a submenu without it closing 77 animation: {opacity:'show',height:'show'}, // fade-in and slide-down animation 78 speed: 'normal', 79 cssArrows: showAutoArrows 80 }); 81 82 // Fixed Menu 83 var allowFixedMenuOnMobile = true; 84 if ($("body").hasClass( "mobile-detected" ) && udesign_script_vars.remove_fixed_menu_on_mobile == 'yes') { 85 allowFixedMenuOnMobile = false; 86 } 87 if ($('body').hasClass('u-design-fixed-menu-on') && allowFixedMenuOnMobile) { 88 var distanceToMainMenu = $('#top-elements').height(); 89 var secondaryNavBarHeight = $("#secondary-navigation-bar-wrapper").height(); 90 $(window).scroll(function() { 91 if ($(this).scrollTop() > (distanceToMainMenu + secondaryNavBarHeight) ) { 92 $('#sticky-menu-alias').css({ 93 'display':'block', 94 'height': distanceToMainMenu + $('#main-menu').height() + secondaryNavBarHeight 95 }); 96 $('body').addClass('fixed-menu'); 97 } else { 98 $('body').removeClass('fixed-menu'); 99 $('#sticky-menu-alias').css('display', 'none'); 100 } 101 }); 102 $('#sticky-menu-logo').insertBefore("#navigation-menu .sf-menu"); 103 } 104}); 105 106/**
107 * CoolInput Plugin 108 * 109 * @version 1.5 (10/09/2009) 110 * @requires jQuery v1.2.6+ 111 * @author Alex Weber <alexweber.com.br> 112 * @author Evan Winslow <[email protected]> (v1.5) 113 * @copyright Copyright (c) 2008-2009, Alex Weber 114 * @see http://remysharp.com/2007/01/25/jquery-tutorial-text-box-hints/ 115 * 116 * Distributed under the terms of the GNU General Public License 117 * http://www.gnu.org/licenses/gpl-3.0.html 118 */ 119jQuery(document).ready(function($){ 120 $.fn.coolinput=function(b){ 121 var c={ 122 hint:null, 123 source:"value", 124 blurClass:"blur", 125 iconClass:false, 126 clearOnSubmit:true, 127 clearOnFocus:true, 128 persistent:true 129 };if(b&&typeof b=="object") 130 $.extend(c,b);else 131 c.hint=b;return this.each(function(){ 132 var d=$(this);var e=c.hint||d.attr(c.source);var f=c.blurClass;function g(){ 133 if(d.val()=="") 134 d.val(e).addClass(f) 135 } 136 function h(){ 137 if(d.val()==e&&d.hasClass(f)) 138 d.val("").removeClass(f) 139 } 140 if(e){ 141 if(c.persistent) 142 d.blur(g);if(c.clearOnFocus) 143 d.focus(h);if(c.clearOnSubmit) 144 d.parents("form:first").submit(h);if(c.iconClass) 145 d.addClass(c.iconClass);g() 146 } 147 }) 148 } 149}); 150jQuery(document).ready(function($){ 151 // first input box is a search box, notice passing of a custom class and an icon to the coolInput function 152 $('#search_field').coolinput({ 153 blurClass: 'blur' 154 }); 155 156 // add placeholder attribute to the default Search widget form 157 $(".widget_search input#s").attr("placeholder", udesign_script_vars.search_widget_placeholder); 158 $(".widget_search input#searchsubmit").val(''); // remove default value "Search" 159}); 160 161 162// ThumbCaption script 163jQuery(document).ready(function($){ 164 $(".portfolio-img-thumb-1-col, .portfolio-img-thumb-2-col, .portfolio-img-thumb-3-col, .portfolio-img-thumb-4-col").hover(function(){ 165 var info=$(this).find(".hover-opacity"); 166 info.stop().animate({opacity:0.4},600); 167 }, 168 function(){ 169 var info=$(this).find(".hover-opacity"); 170 info.stop().animate({opacity:1},800); 171 }); 172 173 $(".post-image").hover(function(){ 174 var info=$(this).find(".hover-opacity"); 175 info.stop().animate({opacity:0.6},400); 176 }, 177 function(){ 178 var info=$(this).find(".hover-opacity"); 179 info.stop().animate({opacity:1},600); 180 }); 181}); 182 183// jQuery Validate 184jQuery(document).ready(function($){ 185 if( $('body').hasClass('page-template-page-Contact-php') ) { 186 // load js translated strings only when Contact page template is loaded 187 $("#contactForm").validate({ 188 rules: { 189 contact_name: { 190 required: true, 191 minlength: 2 192 }, 193 contact_email: { 194 required: true, 195 email: true 196 }, 197 contact_message: $('input#rules_contact_message').val() 198 }, 199 messages: { 200 contact_name: { 201 required: $('input#contact_name_required').val(), 202 minlength: $('input#contact_name_min_length').val() 203 }, 204 contact_email: $('input#messages_contact_email').val(), 205 contact_message: $('input#messages_contact_message').val() 206 } 207 }); 208 // phone number + extension format validator 209 $("#contact_phone_NA_format").mask("(999) 999-9999"); 210 $("#contact_ext_NA_format").mask("? 99999"); 211 } 212}); 213 214 215// Content Toggle 216jQuery(function($){ 217 // Initial state of toggle (hide) 218 $(".slide_toggle_content").hide(); 219 // Process Toggle click (http://api.jquery.com/toggle/) 220 $("h4.slide_toggle").toggle(function(){ 221 $(this).addClass("clicked"); 222 }, function () { 223 $(this).removeClass("clicked"); 224 }); 225 // Toggle animation (http://api.jquery.com/slideToggle/) 226 $("h4.slide_toggle").click(function(){ 227 $(this).next(".slide_toggle_content").slideToggle(); 228 }); 229}); 230 231// Content Accordion 232jQuery(document).ready(function($){ 233 $('.accordion-container').hide(); 234 $('.accordion-toggle:first').addClass('active').next().show(); 235 $('.accordion-toggle').click(function(){ 236 if( $(this).next().is(':hidden') ) { 237 $('.accordion-toggle').removeClass('active').next().slideUp(); 238 $(this).toggleClass('active').next().slideDown(); 239 } 240 return false; // Prevent the browser jump to the link anchor 241 });
242}); 243 244//Page Peel 245jQuery(document).ready(function($){ 246 $("#page-peel").hover(function() { 247 $("#page-peel img, .msg_block").stop() 248 .animate({width: '307px', height: '319px'}, 500); 249 }, function() { 250 $("#page-peel img").stop() 251 .animate({width: '50px', height: '52px'}, 220); 252 $(".msg_block").stop() 253 .animate({width: '50px', height: '50px'}, 200); 254 }); 255}); 256 257// remove the title attributes from the main menu and Subpages Widget 258jQuery(document).ready(function($) { 259 // remove 'title' attribute from menu items 260 $("#navigation-menu a, .widget_subpages a").removeAttr("title"); 261 // Add the 'default' cursor when hover to menu link that have no links 262 $('#navigation-menu a').each(function() { 263 if ( !$(this).attr("href") ) { 264 $(this).addClass("default-cursor"); 265 } 266 }); 267}); 268 269// Tabs 270jQuery(document).ready(function($){ 271 $('.tabs a').click(function(){ 272 // Switch the tabs 273 switch_tabs($(this)); 274 // Add URL hash to clicked tab without page jump 275 if(history.pushState) { 276 history.pushState(null, null, '#'+$(this).attr('id')); 277 } else { // fall back for older browsers 278 window.location.hash = "tabs"; 279 } 280 }); 281 switch_tabs($('.defaulttab')); 282 function switch_tabs(obj) { 283 $('.tabs-wrapper .tab-content').hide(); 284 $('.tabs-wrapper .tabs a').removeClass("selected"); 285 var id = obj.attr("id"); 286 $('#'+id+'-content').show(); 287 obj.addClass("selected"); 288 } 289 // The following allows to link with hashtag to a specific tab when the hashtag has been changed 290 $(window).bind( 'hashchange', function(e) { 291 // Grabs the hash tag from the url 292 var hash = window.location.hash.substring(1); 293 294 // Checks whether a hash tag is set and if it matches any of the tab id's 295 if ( hash != "" && $('.tabs a[id$="'+hash+'"]' ).attr('id') ) { 296 // Removes all 'selected' classes from tabs 297 $('.tabs a').each(function() { 298 $(this).removeClass('selected'); 299 }); 300 // This will add the 'selected' class to the matched tab 301 var link = ""; 302 $('.tabs a').each(function() { 303 link = $(this).attr('id'); 304 if (link == hash) { 305 $(this).addClass('selected'); 306 } 307 }); 308 // Take care of the content part of each tab accordingly 309 $('.tabs-wrapper .tab-content').each(function() { 310 link = $(this).attr('id'); 311 if (link == hash+'-content') { 312 $(this).css({ 313 "display":"block" 314 }); 315 } else { 316 $(this).css({ 317 "display":"none" 318 }); 319 } 320 }); 321 } 322 }); 323 $(window).trigger( 'hashchange' ); 324}); 325 326// Takes care of multiple WP galleries with prettyPhoto in a single page/post 327jQuery(document).ready(function($) { 328 $('.gallery').each(function(g) { 329 $(".gallery-item a[rel*='wp-prettyPhoto[gallery]']", this).each(function() { 330 $(this).attr('rel', function() { 331 return this.rel.replace('wp-prettyPhoto[gallery]', 'wp-prettyPhoto[gallery-' + g + ']'); 332 }); 333 }); 334 }); 335}); 336
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.