-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmariomakely.js
30 lines (29 loc) · 906 Bytes
/
mariomakely.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Router.configure({
layoutTemplate: 'main',
notFoundTemplate: '404'
});
if (Meteor.isClient) {
Meteor.startup(() => {
Session.set('tags', "");
});
Template.main.events({
'click #search': function() {
var text = $('input').val().toLowerCase();
var tags = Session.get('tags');
tags = tags ? tags + '&' + text : text;
Session.set('tags', tags);
Router.go('/' + tags);
$('input').val('');
},
'keypress input': function(evt, template) {
if (evt.which === 13) {
let text = $('input').val().toLowerCase();
let tags = Session.get('tags');
tags = tags ? tags + '&' + text : text;
Session.set('tags', tags);
Router.go('/' + tags);
$('input').val('');
}
}
});
}