This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Template.movie.events({ | |
'click .seen': function (e, t) { | |
// User has set status to "seen", but not exited poster | |
Session.set('seen-movie', true); | |
}, | |
'click .not-seen': function (e, t) { | |
// User has set status to "not seen", but not exited poster | |
Session.set('seen-movie', false); | |
} | |
'mouseout .poster': function (e, t) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Meteor.isClient) { | |
function updateHTML(elmId, value) { | |
document.getElementById(elmId).innerHTML = value; | |
} | |
// This function is called when an error is thrown by the player | |
function onPlayerError(errorCode) { | |
alert("An error occured of type:" + errorCode); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template name="css"> | |
{{#if currentUser}} | |
<style type="text/css"> | |
/* I'm for logged-in users */ | |
</style> | |
{{else}} | |
<style type="text/css"> | |
/* I'm for anonymous users */ | |
</style> | |
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var defaultLocations = { | |
widgetA: 'location-21', | |
widgetB: 'location-4', | |
// ... | |
} | |
Template.List.widgets = function () { | |
var userLocations = Meter.user().profile.widgetLocations; // { widgetB: 'location-5' } | |
var widgetLocations = _.extend(defaultLocations, userLocations); // Override the defaults where the user has changed them | |
var something = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Template.myTemplate.foobar.events({ | |
'click #whatever': function (e, t) { | |
this.toggle = true; | |
}, | |
'mouseout #whatever': function (e, t) { | |
if (this.toggle === true) { | |
// The user toggled this | |
// Do some toggling stuff here. | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Server | |
Meteor.publish('views', function () { | |
return Views.find({ userId: this.userId }); | |
}); | |
Meteor.publish('movies', function () { | |
return Movies.find(); | |
}); | |
// Client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Attempt to log in as a new user. | |
Accounts.createUser = function (options, callback) { | |
options = _.clone(options); // we'll be modifying options | |
if (!options.password) | |
throw new Error("Must set options.password"); | |
var verifier = Meteor._srp.generateVerifier(options.password); | |
// strip old password, replacing with the verifier object | |
delete options.password; | |
options.srp = verifier; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Template.rightSidebar.events({ | |
'change #search-input, paste #search-input, keyup #search-input': function (event, template) { | |
var q = template.find('#search-input').value; | |
var url ="http://gdata.youtube.com/feeds/api/videos?q="+q+"&start-index=6&max-results=5&v=2&alt=json"; | |
Meteor.http.get(url, function (error, result) { | |
if (result.statusCode === 200) { | |
var youtube = result.data.feed.entry; | |
var vidId = []; | |
for (var i=0; i < youtube.length; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template name="myTemplate"> | |
{{#with profile}} | |
{{foobar}} | |
{{/with}} | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Template.timelinePublic.helpers({ | |
timelineItems: function() { | |
return timelineItems.find({ timeline: Session.get("currentTimeline") }); | |
} | |
}); |