Skip to content

Commit 4285255

Browse files
committed
Cleaned up code slightly with $.extend
1 parent 7deae41 commit 4285255

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

site/javascript/garden.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Sections.prototype = {
2222
return {
2323
id: this.id.replace('.intro', ''),
2424
offset: $(this).offset().top - 20,
25-
title: $(this).find(':header:first').text()
25+
title: $(this).find(':header:first').html()
2626
};
2727

2828
}).get();
@@ -121,19 +121,22 @@ Sections.prototype = {
121121

122122
setLink: function(ele, data) {
123123
ele.slideDown(100).attr('href', '#' + data.id)
124-
.find('.nav_section_name').text(data.title);
124+
.find('.nav_section_name').html(data.title);
125125
}
126126
};
127127

128128

129129
// This more or less controls the page ------------------------------------------
130130
// ------------------------------------------------------------------------------
131131
function Page() {
132-
this.window = $(window);
133-
this.nav = $('nav > ul > li');
132+
$.extend(true, this, {
133+
window: $(window),
134+
nav: $('nav > ul > li'),
135+
section: null,
136+
articule: null
137+
});
138+
134139
this.sections = new Sections(this);
135-
this.section = null;
136-
this.article = null;
137140
this.init();
138141
}
139142

@@ -142,12 +145,15 @@ Page.prototype = {
142145
var that = this,
143146
mainNav = $('#nav_main');
144147

145-
this.scrollLast = 0;
148+
$.extend(this, {
149+
scrollLast: 0,
150+
resizeTimeout: null
151+
});
152+
146153
this.window.scroll(function() {
147154
that.onScroll();
148155
});
149-
150-
this.resizeTimeout = null;
156+
151157
this.window.resize(function() {
152158
that.onResize();
153159
});

0 commit comments

Comments
 (0)