diff options
author | Joakim Reinert <mail@jreinert.com> | 2015-05-01 23:53:55 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2015-05-05 12:21:27 +0200 |
commit | 1b7aeb5619638661f09ecaa6aba4b94e02b616ab (patch) | |
tree | 9773e798cf8ebde18587bf75047e0fc3c14af9cf /data/js/application.js | |
parent | a5cde5f11ba4d773bd7b369596f5bb00a0e1666e (diff) |
Move lazyloading js code to application.js
Diffstat (limited to 'data/js/application.js')
-rw-r--r-- | data/js/application.js | 12 |
1 files changed, 11 insertions, 1 deletions
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}); + } } }; |