diff --git a/app/assets/javascripts/controllers.js b/app/assets/javascripts/controllers.js index b6e0fb15..bdd04e2d 100644 --- a/app/assets/javascripts/controllers.js +++ b/app/assets/javascripts/controllers.js @@ -25,6 +25,8 @@ angular.module('birdwatch.controllers', ['birdwatch.services', 'charts.barchart' /** Last update timestamp for WordCLoud */ $scope.lastCloudUpdate = new Date().getTime() - 10000; + + var wordCloudDiv = $("#wordCloud"); /** Return paginated selection of Tweets array */ $scope.tweetPage = function () { @@ -79,20 +81,20 @@ angular.module('birdwatch.controllers', ['birdwatch.services', 'charts.barchart' /** charts */ $scope.barchart = barchart.BarChart($scope.addSearchString, $("#wordBars").width() - 150); - $scope.wordCloud = wordcloud.WordCloud($("#wordCloud").width() * 1.1, $("#wordCloud").width() * 0.75, 250, + $scope.wordCloud = wordcloud.WordCloud(wordCloudDiv.width() * 1.1, wordCloudDiv.width() * 0.75, 250, $scope.addSearchString); /** resize charts on window resize (currently only working for wordcloud) */ function resizeCharts() { $("#wordCloud").empty(); - $scope.wordCloud = wordcloud.WordCloud($("#wordCloud").width() * 1.1, $("#wordCloud").width() * 0.75, + $scope.wordCloud = wordcloud.WordCloud(wordCloudDiv.width() * 1.1, wordCloudDiv.width() * 0.75, 250, $scope.addSearchString); } var TO = false; $(window).resize(function(){ if(TO !== false) clearTimeout(TO); - TO = setTimeout(resizeCharts, 2000); //200 is time in miliseconds + TO = setTimeout(resizeCharts, 2000); //200 is time in milliseconds }); /** Load previous Tweets, paginated. Recursive function, calls itself with the next chunk to load until diff --git a/app/assets/javascripts/services.js b/app/assets/javascripts/services.js index 075d2e75..7582f59f 100644 --- a/app/assets/javascripts/services.js +++ b/app/assets/javascripts/services.js @@ -76,7 +76,7 @@ angular.module('birdwatch.services', []).service('utils', function () { var legalStuff = function () { alert("Simple. Project is delivered as is. Use it in whichever way you see fit. The author, Matthias Nehlsen, does not make claims of any kind and cannot be held responsible for anything.\n\nHere in more legal terms, adapted from \nhttps://github.com/mbostock/d3/blob/master/LICENSE. Thanks, Michael Bostock!\n\nTHIS SOFTWARE AND ITS ONLINE DEMO IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS NEHLSEN BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."); - } + }; return { formatTweet: formatTweet, wordCount: wordCount, buildQuery: buildQuery, legalStuff: legalStuff }; }); \ No newline at end of file diff --git a/app/assets/javascripts/ui-bootstrap-custom.js b/app/assets/javascripts/ui-bootstrap-custom.js index 645ad295..1800e2fb 100644 --- a/app/assets/javascripts/ui-bootstrap-custom.js +++ b/app/assets/javascripts/ui-bootstrap-custom.js @@ -22,7 +22,7 @@ angular.module('ui.bootstrap.dropdownToggle', []).directive('dropdownToggle', [' closeMenu = angular.noop; return { restrict: 'CA', - link: function(scope, element, attrs) { + link: function(scope, element) { scope.$watch('$location.path', function() { closeMenu(); }); element.parent().bind('click', function() { closeMenu(); }); element.bind('click', function (event) { @@ -161,7 +161,7 @@ angular.module('ui.bootstrap.pagination', []) startPage = ((Math.ceil(paginationCtrl.currentPage / scope.maxSize) - 1) * scope.maxSize) + 1; // Adjust last page if limit is exceeded - endPage = Math.min(startPage + scope.maxSize - 1, scope.numPages); + endPage = Math.min(startPage + scope.maxSize - 1, +scope.numPages); } }