From 1b7aeb5619638661f09ecaa6aba4b94e02b616ab Mon Sep 17 00:00:00 2001 From: Joakim Reinert Date: Fri, 1 May 2015 23:53:55 +0200 Subject: Move lazyloading js code to application.js --- data/js/application.js | 12 +++++++++++- data/js/script.js | 7 ------- 2 files changed, 11 insertions(+), 8 deletions(-) delete mode 100644 data/js/script.js (limited to 'data/js') diff --git a/data/js/application.js b/data/js/application.js index dedefbc3b..c503da4f1 100644 --- a/data/js/application.js +++ b/data/js/application.js @@ -20,7 +20,10 @@ define( Uploader, TableSorter ) { - require(['script']); + var ui = { + lazyLoadingImages: 'img.lazyload' + }; + var App = { // Gets called for every request (before page load) initialize: function () { @@ -42,6 +45,7 @@ define( this.configureTooltips(); this.setupToggleSelectAllEvent(); this.setupLineWrapToggle(); + this.setupLazyLoadingImages(); }, setupLineHighlight: function () { @@ -71,6 +75,12 @@ define( Util.setLineWrap(linesWrapped === 'true'); $('.linewrap-toggle').on('click', _.bind(Util.toggleLineWrap, Util)); + }, + + setupLazyLoadingImages: function () { + if ($(ui.lazyLoadingImages).length > 0) { + $(ui.lazyLoadingImages).show().lazyload({treshold: 200}); + } } }; diff --git a/data/js/script.js b/data/js/script.js deleted file mode 100644 index 7b103699a..000000000 --- a/data/js/script.js +++ /dev/null @@ -1,7 +0,0 @@ -(function($) { - $(function() { - if ($("img.lazyload").length) { - $("img.lazyload").show().lazyload({treshold: 200}); - } - }); -})(jQuery); -- cgit v1.2.3-24-g4f1b