From 758a235d19fc668d4fd5fe041b0550db204013db Mon Sep 17 00:00:00 2001 From: Adam Shaw Date: Fri, 31 Jan 2014 00:02:26 -0800 Subject: [PATCH] code quality improvements (for jshint) --- src/EventManager.js | 9 ++++--- src/agenda/AgendaEventRenderer.js | 4 +-- src/agenda/AgendaView.js | 35 +++++++++++++-------------- src/basic/BasicView.js | 13 +++++----- src/common/DayEventRenderer.js | 16 ++++++------ src/common/HorizontalPositionCache.js | 6 ++--- src/common/HoverListener.js | 5 +++- src/common/OverlayManager.js | 2 +- src/common/SelectionManager.js | 1 - src/common/View.js | 17 ++++++------- src/date_util.js | 21 ++++++++-------- src/gcal/gcal.js | 12 ++++----- src/lang.js | 2 +- src/main.js | 24 ++++++++++-------- tests/automated/aspectRatio.js | 20 +++++++-------- tests/automated/header.js | 2 +- tests/automated/weekends.js | 2 +- 17 files changed, 97 insertions(+), 94 deletions(-) diff --git a/src/EventManager.js b/src/EventManager.js index 500da23..2bdf01d 100644 --- a/src/EventManager.js +++ b/src/EventManager.js @@ -315,10 +315,11 @@ function EventManager(options) { // assumed to be a calendar function removeEvents(filter) { + var i; if (!filter) { // remove all cache = []; // clear all array sources - for (var i=0; i date @@ -563,11 +562,11 @@ function View(element, calendar, viewName) { function dayOffsetToCellOffset(dayOffset) { var day0 = t.start.day(); // first date's day of week dayOffset += day0; // normalize dayOffset to beginning-of-week - return Math.floor(dayOffset / 7) * cellsPerWeek // # of cells from full weeks - + dayToCellMap[ // # of cells from partial last week + return Math.floor(dayOffset / 7) * cellsPerWeek + // # of cells from full weeks + dayToCellMap[ // # of cells from partial last week (dayOffset % 7 + 7) % 7 // crazy math to handle negative dayOffsets - ] - - dayToCellMap[day0]; // adjustment for beginning-of-week normalization + ] - + dayToCellMap[day0]; // adjustment for beginning-of-week normalization } // cell offset -> cell (object with row & col keys) diff --git a/src/date_util.js b/src/date_util.js index e75a77d..b9c566b 100644 --- a/src/date_util.js +++ b/src/date_util.js @@ -216,7 +216,7 @@ moment.fn.format = function() { else { return momentFormatMethod.apply(this, arguments); // pass along all arguments } -} +}; moment.fn.toISOString = function() { if (this._ambigTime) { @@ -254,24 +254,25 @@ $.each([ moment.fn[methodName] = function() { var newThis; + var args = Array.prototype.slice.call(arguments); var i; if (this._ambigZone) { for (i=0; i div').css('min-height', '').css('background', 'red'); var naturalHeight = $('.fc-content').height(); - expect(actualHeight).toEqual(naturalHeight) + expect(actualHeight).toEqual(naturalHeight); }); }); }); diff --git a/tests/automated/header.js b/tests/automated/header.js index b88388a..36bf534 100644 --- a/tests/automated/header.js +++ b/tests/automated/header.js @@ -70,7 +70,7 @@ describe('header testing', function() { header: false }; $('#calendar').fullCalendar(options); - }) + }); it('should not have header table', function() { var headerTableCount = $('table.fc-header').length; expect(headerTableCount).toEqual(0); diff --git a/tests/automated/weekends.js b/tests/automated/weekends.js index 91f9522..a732c3e 100644 --- a/tests/automated/weekends.js +++ b/tests/automated/weekends.js @@ -4,7 +4,7 @@ describe('when weekends option is set', function() { beforeEach(function() { affix('#calendar'); var cal = $('#calendar'); - }) + }); it('should show sat and sun if true', function() { var options = {