Skip to content

Commit eea7718

Browse files
committed
Reformat JavaScript files
Reformat JavaScript files to match code generated by TypeScript, in preparation for the introduction of TypeScript files.
1 parent 41c3d06 commit eea7718

File tree

2 files changed

+24
-31
lines changed

2 files changed

+24
-31
lines changed

javascripts/examples.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
var Examples = {
2-
names: ['cities', 'greeter', 'i_love_ruby', 'hello_world'],
3-
4-
random: function() {
5-
return Examples.names[Math.floor(Math.random() * Examples.names.length)];
6-
},
7-
8-
choose: function() {
9-
var lang = document.location.pathname.split('/')[1];
10-
var name = Examples.random();
11-
12-
$("#code").load('/' + lang + '/examples/' + name + '/');
13-
}
2+
names: ['cities', 'greeter', 'i_love_ruby', 'hello_world'],
3+
random: function () {
4+
return Examples.names[Math.floor(Math.random() * Examples.names.length)];
5+
},
6+
choose: function () {
7+
var lang = document.location.pathname.split('/')[1];
8+
var name = Examples.random();
9+
$("#code").load('/' + lang + '/examples/' + name + '/');
10+
}
1411
};
15-
1612
$(document).ready(Examples.choose);

javascripts/page.js

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
var Page = {
2-
SiteLinks: {
3-
highlight: function() {
4-
var current_page = location.pathname;
5-
$("#header div.site-links a:not(.home)").each(function(i) {
6-
if (current_page.indexOf($(this).attr('href')) == 0) {
7-
$(this).addClass('selected');
2+
SiteLinks: {
3+
highlight: function () {
4+
var current_page = location.pathname;
5+
$("#header div.site-links a:not(.home)").each(function (i) {
6+
if (current_page.indexOf($(this).attr('href')) == 0) {
7+
$(this).addClass('selected');
8+
}
9+
});
10+
$("#home-page-layout #header div.site-links a.home").addClass('selected');
11+
},
12+
menu: function () {
13+
$("#header div.site-links a.menu").on('click touchstart', function (event) {
14+
$(this).closest("div.site-links").toggleClass("open");
15+
event.preventDefault();
16+
});
817
}
9-
});
10-
11-
$("#home-page-layout #header div.site-links a.home").addClass('selected');
12-
},
13-
14-
menu: function() {
15-
$("#header div.site-links a.menu").on('click touchstart', function(event) {
16-
$(this).closest("div.site-links").toggleClass("open");
17-
event.preventDefault();
18-
});
1918
}
20-
}
2119
};
22-
2320
$(Page.SiteLinks.highlight);
2421
$(Page.SiteLinks.menu);

0 commit comments

Comments
 (0)