PageSourceSearch

http://www.waveloch.com/w/wp-content/themes/u-design/scripts/script.js?ver=1.0

js waveloch.com collected 2026-10-02 12:58:28 UTC 13,694 bytes, 369 lines download raw bytes

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_pagination-trigger, .wc-tabs li a, .vc_tta-tab a, .vc_tta-panel-title a, 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
184// jQuery Validate
185jQuery(document).ready(function($){
186    
187    if( $('body').hasClass('page-template-page-Contact-php') ) {
188        
189        var form = $( "#contactForm" );
190        
191	form.validate({
192	    rules: {
193		    contact_name: {
194			    required: true,
195			    minlength: 2
196		    },
197		    contact_email: {
198			    required: true,
199			    email: true
200		    },
201                    contact_consent: {
202                            required: true
203                    },
204                    // Pull the string from a hidden input field in the form (we are doing this so the string be translated).
205		    contact_message: $('input#rules_contact_message').val()
206	    },
207	    messages: {
208		    contact_name: {
209			    required: $('input#contact_name_required').val(),
210			    minlength: $('input#contact_name_min_length').val()
211		    },
212		    contact_email: $('input#messages_contact_email').val(),
213		    contact_message: $('input#messages_contact_message').val(),
214		    contact_consent: $('input#contact_consent_required_message').val()
215	    },
216            errorPlacement: function(error, element) {
217                    if (element.is(":checkbox")) {
218                            error.appendTo(element.parent().after());
219                    }
220                    else {
221                        // the default
222			error.appendTo(element.parent());
223                    }
224            }
225	});
226        
227        
228	// Phone number + extension format validator
229	$("#contact_phone_NA_format").mask("(999) 999-9999");
230	$("#contact_ext_NA_format").mask("? 99999");
231        
232        // Add spinner to submit button
233        $("#contact-page-submit-form .submit").on("click", function(){
234            if( form.valid() ) {
235                $( this ).next( ".contact-page-spinner" ).addClass("is-active");
236            }
237        });
238    }
239    
240});
241
242
243// Content Toggle
244jQuery(function($){
245    // Initial state of toggle (hide)
246    $(".slide_toggle_content").hide();
247    // Process Toggle click (http://api.jquery.com/toggle/)
248    $("h4.slide_toggle").toggle(function(){
249	    $(this).addClass("clicked");
250	}, function () {
251	    $(this).removeClass("clicked");
252    });
253    // Toggle animation (http://api.jquery.com/slideToggle/)
254    $("h4.slide_toggle").click(function(){
255	$(this).next(".slide_toggle_content").slideToggle();
256    });
257});
258
259// Content Accordion
260jQuery(document).ready(function($){
261    var $accordionHeader = $('.accordion-toggle'),
262        $accordionHeaderOpenDefault = $('.accordion-toggle:first'),
263        $accordionContent = $('.accordion-container');
264        
265    $accordionContent.hide();
266    $accordionHeaderOpenDefault.addClass('active').next().show();
267    $accordionHeader.click(function(){
268        var $this = $(this);
269        if( $this.next().is(':hidden') ) {
270            $accordionHeader.removeClass('active').next().slideUp();
271            $this.toggleClass('active').next().slideDown();
272        }
273        return false; // Prevent the browser jump to the link anchor
274    });
275});
276
277//Page Peel
278jQuery(document).ready(function($){
279    $("#page-peel").hover(function() {
280	$("#page-peel img, .msg_block").stop()
281	.animate({width: '307px', height: '319px'}, 500);
282    }, function() {
283	$("#page-peel img").stop()
284	.animate({width: '50px', height: '52px'}, 220);
285	$(".msg_block").stop()
286	.animate({width: '50px', height: '50px'}, 200);
287    });
288});
289
290// remove the title attributes from the main menu and Subpages Widget
291jQuery(document).ready(function($) {
292        // remove 'title' attribute from menu items
293        $("#navigation-menu a, .widget_subpages a").removeAttr("title");
294        // Add the 'default' cursor when hover to menu link that have no links
295        $('#navigation-menu a').each(function() {
296            if ( !$(this).attr("href") ) {
297                $(this).addClass("default-cursor");
298            }
299        });
300});
301
302// Tabs
303jQuery(document).ready(function($){
304    $('.tabs-wrapper .tabs a').click(function(){
305        // Switch the tabs
306        switch_tabs($(this));
307        // Add URL hash to clicked tab without page jump
308        if(history.pushState) {
309            history.pushState(null, null, '#'+$(this).attr('id'));
310        } else { // fall back for older browsers
311            window.location.hash = "tabs";
312        }
313    });
314    switch_tabs($('.defaulttab'));
315    function switch_tabs(obj) {
316        $('.tabs-wrapper .tab-content').hide();
317        $('.tabs-wrapper .tabs a').removeClass("selected");
318        var id = obj.attr("id");
319        $('#'+id+'-content').show();
320        obj.addClass("selected");
321    }
322    // The following allows to link with hashtag to a specific tab when the hashtag has been changed
323    $(window).bind( 'hashchange', function(e) {
324        // Grabs the hash tag from the url
325        var hash = encodeURI(window.location.hash.substring(1));
326            
327        // Checks whether a hash tag is set and if it matches any of the tab id's
328        if ( hash != "" && $('.tabs-wrapper .tabs a[id$="'+hash+'"]' ).attr('id') ) {
329            // Removes all 'selected' classes from tabs
330            $('.tabs-wrapper .tabs a').each(function() {
331                $(this).removeClass('selected');
332            });
333            // This will add the 'selected' class to the matched tab
334            var link = "";
335            $('.tabs-wrapper .tabs a').each(function() {
336                link = $(this).attr('id');
337                if (link == hash) {
338                    $(this).addClass('selected');
339                }
340            });
341            // Take care of the content part of each tab accordingly
342            $('.tabs-wrapper .tab-content').each(function() {
343                link = $(this).attr('id');
344                if (link == hash+'-content') {
345                    $(this).css({
346                        "display":"block"
347                    }); 
348                } else {
349                    $(this).css({
350                        "display":"none"
351                    }); 
352                }
353            });
354        }
355    });
356    $(window).trigger( 'hashchange' );
357});
358
359// Takes care of multiple WP galleries with prettyPhoto in a single page/post 
360jQuery(document).ready(function($) {
361    $('.gallery').each(function(g) {
362        $(".gallery-item a[rel*='wp-prettyPhoto[gallery]']", this).each(function() {
363            $(this).attr('rel', function() {
364                return this.rel.replace('wp-prettyPhoto[gallery]', 'wp-prettyPhoto[gallery-' + g + ']');
365            });
366        });
367    });
368});
369

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.