Project

General

Profile

1
/* Copyright (C) YOOtheme GmbH, YOOtheme Proprietary Use License (http://www.yootheme.com/license) */
2

    
3
(function($){
4

    
5
	$(document).ready(function() {
6

    
7
		var config = $('body').data('config') || {};
8
		
9
		// Accordion menu
10
		$('.menu-sidebar').accordionMenu({ mode:'slide' });
11

    
12
		// Smoothscroller
13
		$('a[href="#page"]').smoothScroller({ duration: 500 });
14

    
15
		// Social buttons
16
		$('article[data-permalink]').socialButtons(config);
17

    
18
		$(window).on("load", function(){
19
			// Dropdown menu
20
			$('#menu').dropdownMenu({ mode: 'slide', dropdownSelector: 'div.dropdown'});
21
		});
22

    
23
	});
24

    
25
	$.onMediaQuery('(min-width: 960px)', {
26
		init: function() {
27
			if (!this.supported) this.matches = true;
28
		},
29
		valid: function() {
30
			$.matchWidth('grid-block', '.grid-block', '.grid-h').match();
31
			$.matchHeight('main', '#maininner, #sidebar-a, #sidebar-b').match();
32
			$.matchHeight('top-a', '#top-a .grid-h', '.deepest').match();
33
			$.matchHeight('top-b', '#top-b .grid-h', '.deepest').match();
34
			$.matchHeight('bottom-a', '#bottom-a .grid-h', '.deepest').match();
35
			$.matchHeight('bottom-b', '#bottom-b .grid-h', '.deepest').match();
36
			$.matchHeight('innertop', '#innertop .grid-h', '.deepest').match();
37
			$.matchHeight('innerbottom', '#innerbottom .grid-h', '.deepest').match();
38

    
39
			// Match height if grid-a-licious is activated 
40
			if(window.GRIDALICIOUS_IN_USE) {
41

    
42
				$.onMediaQuery.spyclockside = true;
43

    
44
				setInterval((function(){
45

    
46
					var ret = function() {
47
						if(!$.onMediaQuery.spyclockside) return;
48

    
49
						$('#maininner, #sidebar-a, #sidebar-b').css("min-height", "");
50
						$.matchHeight('main', '#maininner, #sidebar-a, #sidebar-b').match();
51

    
52
					}
53

    
54
					ret();
55

    
56
					return ret;
57

    
58
				})(), 1000);
59
			}
60

    
61
		},
62
		invalid: function() {
63
			$.matchWidth('grid-block').remove();
64
			$.matchHeight('main').remove();
65
			$.matchHeight('top-a').remove();
66
			$.matchHeight('top-b').remove();
67
			$.matchHeight('bottom-a').remove();
68
			$.matchHeight('bottom-b').remove();
69
			$.matchHeight('innertop').remove();
70
			$.matchHeight('innerbottom').remove();
71

    
72
			$.onMediaQuery.spyclockside = false;
73
		}
74
	});
75

    
76
	var pairs = [];
77

    
78
	$.onMediaQuery('(min-width: 480px) and (max-width: 959px)', {
79
		valid: function() {
80
			$.matchHeight('sidebars', '.sidebars-2 #sidebar-a, .sidebars-2 #sidebar-b').match();
81
			pairs = [];
82
			$.each(['.sidebars-1 #sidebar-a > .grid-box', '.sidebars-1 #sidebar-b > .grid-box', '#top-a .grid-h', '#top-b .grid-h', '#bottom-a .grid-h', '#bottom-b .grid-h', '#innertop .grid-h', '#innerbottom .grid-h'], function(i, selector) {
83
				for (var i = 0, elms = $(selector), len = parseInt(elms.length / 2); i < len; i++) {
84
					var id = 'pair-' + pairs.length;
85
					$.matchHeight(id, [elms.get(i * 2), elms.get(i * 2 + 1)], '.deepest').match();
86
					pairs.push(id);
87
				}
88
			});
89
		},
90
		invalid: function() {
91
			$.matchHeight('sidebars').remove();
92
			$.each(pairs, function() { $.matchHeight(this).remove(); });
93
		}
94
	});
95

    
96
	$.onMediaQuery('(max-width: 767px)', {
97
		valid: function() {
98
			var header = $('#header-responsive');
99
			if (!header.length) {
100
				header = $('<div id="header-responsive"/>').prependTo('#header');
101
				$('#logo').clone().removeAttr('id').addClass('logo').appendTo(header);
102
				$('.searchbox').first().clone().removeAttr('id').appendTo(header);
103
				$('#menu').responsiveMenu().next().addClass('menu-responsive').appendTo(header);
104
			}
105
		}
106
	});
107

    
108
	
109
})(jQuery);
(2-2/2)