summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Reinert <mail@jreinert.com>2015-05-01 23:53:55 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-05-05 12:21:27 +0200
commit1b7aeb5619638661f09ecaa6aba4b94e02b616ab (patch)
tree9773e798cf8ebde18587bf75047e0fc3c14af9cf
parenta5cde5f11ba4d773bd7b369596f5bb00a0e1666e (diff)
Move lazyloading js code to application.js
-rw-r--r--data/js/application.js12
-rw-r--r--data/js/script.js7
2 files changed, 11 insertions, 8 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});
+ }
}
};
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);