Cleaning up whitespace.
This commit is contained in:
parent
0da15ef102
commit
7ae584bec9
38
www/js/ts.js
38
www/js/ts.js
@ -80,7 +80,7 @@ $(document).ready(function(){
|
||||
|
||||
TS.EntryList = Backbone.Collection.extend({
|
||||
model: TS.EntryModel,
|
||||
|
||||
|
||||
comparator: function(entry) { return entry.get('timestamp'); },
|
||||
|
||||
initialize: function(model, options) {
|
||||
@ -220,7 +220,7 @@ $(document).ready(function(){
|
||||
/** Save and close editable fields. */
|
||||
save: function() {
|
||||
this.model.save({
|
||||
mark: this.$('.mark-input').val(),
|
||||
mark: this.$('.mark-input').val(),
|
||||
timestamp: new Date(this.$('.timestamp-input').val()),
|
||||
notes: this.$('.notes-input').val()});
|
||||
|
||||
@ -260,7 +260,7 @@ $(document).ready(function(){
|
||||
*
|
||||
* @param model EntryModel representing this entry.
|
||||
* @param nextModel EntryModel representing the next entry.
|
||||
* @return the duration between model and nextModel, formatted for
|
||||
* @return the duration between model and nextModel, formatted for
|
||||
* display: `Xd Yhr Zm`. */
|
||||
formatDuration: function(model, nextModel) {
|
||||
var d1 = model.get('timestamp');
|
||||
@ -274,7 +274,7 @@ $(document).ready(function(){
|
||||
diff= d2.getTime() - d1.getTime();
|
||||
day = Math.floor(diff / 86400000); // milliseconds in a day
|
||||
diff %= 86400000;
|
||||
|
||||
|
||||
hr = Math.floor(diff / 3600000); // millis in an hour
|
||||
diff %= 3600000;
|
||||
|
||||
@ -297,7 +297,7 @@ $(document).ready(function(){
|
||||
$(this.el).removeClass('show-notes'); } });
|
||||
|
||||
TS.EntryListView = Backbone.View.extend({
|
||||
|
||||
|
||||
el: $("#entry-list")[0],
|
||||
|
||||
events: { "keypress #new-entry-input" : "createNewEntryOnEnter" },
|
||||
@ -372,7 +372,7 @@ $(document).ready(function(){
|
||||
var userExclusions = TS.app.user.model.get("entry_exclusions") || [];
|
||||
|
||||
// get the current timeline exclusions
|
||||
var timelineExclusions =
|
||||
var timelineExclusions =
|
||||
this.collection.timelineModel.get("entry_exclusions") || [];
|
||||
|
||||
// turn them into RegExps and store them
|
||||
@ -416,7 +416,7 @@ $(document).ready(function(){
|
||||
", " + labelDay.getFullYear(); }
|
||||
|
||||
// same calendar year, more than a week ago: Weekday, Month Date
|
||||
else if (monthDiff > 0 || dayDiff > 7) {
|
||||
else if (monthDiff > 0 || dayDiff > 7) {
|
||||
|
||||
return days[labelDay.getDay()] + ", " +
|
||||
months[labelDay.getMonth()] + " " + labelDay.getDate(); }
|
||||
@ -490,7 +490,7 @@ $(document).ready(function(){
|
||||
saveOnEnter: function(e) { if (e.keyCode == 13) { this.save(); } } });
|
||||
|
||||
TS.UserView = Backbone.View.extend({
|
||||
|
||||
|
||||
el: $("#user")[0],
|
||||
|
||||
model: TS.UserModel,
|
||||
@ -527,7 +527,7 @@ $(document).ready(function(){
|
||||
events: { 'click #timeline .drop-menu-items a': 'selectTimeline' },
|
||||
|
||||
initialize: function() {
|
||||
|
||||
|
||||
_.bindAll(this, 'initializeViews', 'loadInitialData',
|
||||
'periodicRefresh', 'selectTimeline');
|
||||
|
||||
@ -543,7 +543,7 @@ $(document).ready(function(){
|
||||
// this is async (waiting for user input)
|
||||
this.loginDialog.authenticate(function() {
|
||||
TS.app.initializeData(TS.app.loadInitialData())}); }
|
||||
|
||||
|
||||
// Schedule our update function.
|
||||
setInterval(this.periodicRefresh, 60000); },
|
||||
|
||||
@ -585,7 +585,7 @@ $(document).ready(function(){
|
||||
this.user.view.render();
|
||||
this.timelines.view.render();
|
||||
this.entries.view.render();
|
||||
|
||||
|
||||
// create our WebSocket for receiving push notifications of changed
|
||||
// content.
|
||||
if (false) { // (Modernizr.websockets)
|
||||
@ -611,14 +611,14 @@ $(document).ready(function(){
|
||||
data.user.last_timeline || data.timelines[0].id
|
||||
|
||||
data.entries = jQuery.parseJSON($.ajax({
|
||||
url: '/ts_api/entries/' + username + '/' +
|
||||
url: '/ts_api/entries/' + username + '/' +
|
||||
data.initialTimelineId,
|
||||
async: false}).responseText);
|
||||
|
||||
return data; },
|
||||
|
||||
periodicRefresh: function() {
|
||||
|
||||
|
||||
var now = new Date();
|
||||
var models = this.entries.collection.models;
|
||||
|
||||
@ -644,7 +644,7 @@ $(document).ready(function(){
|
||||
$(currentModel.view.el).hasClass('edit-notes')) { return }
|
||||
|
||||
// Refresh our latest entry view so the duration is up to date.
|
||||
else { currentModel.view.render(); } } },
|
||||
else { currentModel.view.update(); } } },
|
||||
|
||||
selectTimeline: function(e) {
|
||||
if (e) {
|
||||
@ -666,15 +666,15 @@ $(document).ready(function(){
|
||||
|
||||
// fetch the new EntryList records
|
||||
this.entries.collection.fetch() } },
|
||||
|
||||
|
||||
syncConnected: function() { },
|
||||
|
||||
|
||||
syncDisconnected: function() {err) {
|
||||
// TODO: reconnect. Possibly display a button for the user to
|
||||
// manually reconnect if we've already tried and failed too many
|
||||
// times.
|
||||
},
|
||||
|
||||
|
||||
syncUpdate: function(message) {
|
||||
if (!message.data) return;
|
||||
|
||||
@ -684,7 +684,7 @@ $(document).ready(function(){
|
||||
// Check to see if the record is for the same timeline we are
|
||||
// currently using.
|
||||
|
||||
//
|
||||
//
|
||||
}
|
||||
|
||||
if (data.record_type == "ts_timeline") {
|
||||
@ -761,7 +761,7 @@ $(document).ready(function(){
|
||||
var timelineId = this.$("#new-timeline-id").val();
|
||||
var timelineDesc = this.$("#new-timeline-desc").val();
|
||||
this.timelineCollection.create(
|
||||
{id: timelineId, description: timelineDesc,
|
||||
{id: timelineId, description: timelineDesc,
|
||||
created: dateToJSON(new Date())});
|
||||
this.hide(); },
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user