PageSourceSearch

https://www.watsonlittle.com/wp-content/themes/watson-little/js/scripts.js

js watsonlittle.com collected 2026-10-04 00:21:39 UTC 4,249 bytes, 144 lines download raw bytes

1/*
2 * Get Viewport Dimensions
3 * returns object with viewport dimensions to match css in width and height properties
4 * ( source: http://andylangton.co.uk/blog/development/get-viewport-size-width-and-height-javascript )
5*/
6function updateViewportDimensions() {
7	var w=window,d=document,e=d.documentElement,g=d.getElementsByTagName('body')[0],x=w.innerWidth||e.clientWidth||g.clientWidth,y=w.innerHeight||e.clientHeight||g.clientHeight;
8	return { width:x,height:y }
9}
10// setting the viewport width
11var viewport = updateViewportDimensions();
12
13/*
14 * Throttle Resize-triggered Events
15 * Wrap your actions in this function to throttle the frequency of firing them off, for better performance, esp. on mobile.
16 * ( source: http://stackoverflow.com/questions/2854407/javascript-jquery-window-resize-how-to-fire-after-the-resize-is-completed )
17*/
18var waitForFinalEvent = (function () {
19	var timers = {};
20	return function (callback, ms, uniqueId) {
21		if (!uniqueId) { uniqueId = "Don't call this twice without a uniqueId"; }
22		if (timers[uniqueId]) { clearTimeout (timers[uniqueId]); }
23		timers[uniqueId] = setTimeout(callback, ms);
24	};
25})();
26
27// how long to wait before deciding the resize has stopped, in ms. Around 50-100 should work ok.
28var timeToWaitForLast = 100;
29
30$(document).foundation();
31
32jQuery(document).ready(function($) {
33
34
35/**************************************
36IN PAGE SCROLLING
37****************************************/
38var hashTagActive = "";
39    $(".scroll").click(function (event) {
40        if(hashTagActive != this.hash) { //this will prevent if the user click several times the same link to freeze the scroll.
41            event.preventDefault();
42            //calculate destination place
43            var dest = 0;
44            if ($(this.hash).offset().top > $(document).height() - $(window).height()) {
45                dest = $(document).height() - $(window).height();
46            } else {
47                dest = $(this.hash).offset().top;
48            }
49            //go to destination
50            $('html,body').animate({
51                scrollTop: dest
52            }, 200, 'swing');
53            hashTagActive = this.hash;
54        }
55    });
56
57/**************************************
58RESPONSIVE NAVIGATION
59****************************************/	
60$('#menu-main').slicknav();
61
62
63/* end of as page load scripts */
64});
65
66/**************************************
67EQUALIZER
68****************************************/	
69$(document).foundation({
70  equalizer : {
71    // Specify if Equalizer should make elements equal height once they become stacked.
72    equalize_on_stack: false
73  }
74});
75
76/**************************************
77FEATURED BOOKS SLIDER
78****************************************/	
79 $(document).ready(function() {
80
81      var owl = $("#owl-demo");
82
83      owl.owlCarousel({
84		  
85		  responsive:{
86        0:{
87            items:2
88        },
89        600:{
90            items:4
91        },
92        1000:{
93            items:5
94        }
95    },
96
97      items : 5, //10 items above 1000px browser width
98      slideBy: 'page',
99	  
100	  loop: true,
101	  
102	  autoplay: 7000,
103	  autoplayHoverPause: true,
104	  
105	  
106	  onInitialized: function(){
107        $("#siteslides").css("visibility", "visible");
108      }
109      
110      });
111
112      // Custom Navigation Events
113      $(".next").click(function(){
114        owl.trigger('owl.next');
115      })
116      $(".prev").click(function(){
117        owl.trigger('owl.prev');
118      })
119      $(".play").click(function(){
120        owl.trigger('owl.play',1000);
121      })
122      $(".stop").click(function(){
123        owl.trigger('owl.stop');
124      })
125
126
127    });
128
129/**************************************
130AGENT FILTER FOR CLIENTS
131****************************************/	
132$("#archive-menu ul li a").click(function(){
133    var currentCategory = $(this).attr('id');
134    $.ajax({
135        type: 'post',
136        url: '../page-clients.php', //sometimes I'm using bloginfo to get current path: url: '<?php bloginfo('template_url'); ?>/ajax.php',
137        data: {
138            currentCategory: currentCategory
139        },
140        success: function(data) {
141            console.log(data);
142        }
143    });
144});

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.