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