Skip to content

Commit

Permalink
updated lazyload images script #148 #196
Browse files Browse the repository at this point in the history
  • Loading branch information
psolom committed Jul 15, 2017
1 parent 892a921 commit ab44a13
Show file tree
Hide file tree
Showing 25 changed files with 1,170 additions and 24 deletions.
2 changes: 1 addition & 1 deletion config/filemanager.config.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"viewer": {
"absolutePath": true,
"previewUrl": false,
"lazyLoad": false,
"lazyLoad": true,
"image": {
"enabled": true,
"showThumbs": true,
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ <h1 data-bind="text: rdo().attributes.name, attr: {title: rdo().id}"></h1>
<script type="text/javascript" src="scripts/toast/lib/toast.min.js"></script>
<script type="text/javascript" src="scripts/purl/purl.min.js"></script>
<!-- Load filemanager script -->
<script type="text/javascript" src="scripts/filemanager.js"></script>
<script type="text/javascript" src="scripts/filemanager.min.js"></script>
<script type="text/javascript" src="config/filemanager.init.js"></script>

<!-- Start RichFilemanager plugin -->
Expand Down
2 changes: 1 addition & 1 deletion scripts/filemanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ $.richFilemanagerPlugin = function(element, pluginOptions)
primary.push('/themes/' + config.options.theme + '/styles/theme.css');

if(config.viewer.lazyLoad) {
primary.push('/scripts/lazyload/lazyload.transpiled.min.js');
primary.push('/scripts/lazyload/dist/lazyload.min.js');
}
if(config.customScrollbar.enabled) {
primary.push('/scripts/custom-scrollbar-plugin/jquery.mCustomScrollbar.min.css');
Expand Down
4 changes: 2 additions & 2 deletions scripts/filemanager.min.js

Large diffs are not rendered by default.

81 changes: 81 additions & 0 deletions scripts/lazyload/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"env": {
"browser": true,
"jest": true
},
"rules": {
"quotes": [2, "double"],
"block-scoped-var": 1,
"class-methods-use-this": 1,
"complexity": 1,
"consistent-return": 1,
"curly": 2,
"default-case": 1,
"dot-location": 1,
"dot-notation": 1,
"eqeqeq": 2,
"guard-for-in": 1,
"no-alert": 1,
"no-caller": 1,
"no-case-declarations": 1,
"no-div-regex": 1,
"no-else-return": 1,
"no-empty-function": 1,
"no-empty-pattern": 1,
"no-eq-null": 1,
"no-eval": 1,
"no-extend-native": 1,
"no-extra-bind": 1,
"no-extra-label": 1,
"no-fallthrough": 1,
"no-floating-decimal": 1,
"no-global-assign": 1,
"no-implicit-coercion": 1,
"no-implicit-globals": 1,
"no-implied-eval": 1,
"no-invalid-this": 1,
"no-iterator": 1,
"no-labels": 1,
"no-lone-blocks": 1,
"no-loop-func": 1,
"no-magic-numbers": 1,
"no-multi-spaces": 1,
"no-multi-str": 1,
"no-new": 1,
"no-new-func": 1,
"no-new-wrappers": 1,
"no-octal": 1,
"no-octal-escape": 1,
"no-param-reassign": 1,
"no-proto": 1,
"no-redeclare": 1,
"no-restricted-properties": 1,
"no-return-assign": 1,
"no-return-await": 1,
"no-script-url": 1,
"no-self-assign": 1,
"no-self-compare": 1,
"no-sequences": 1,
"no-throw-literal": 1,
"no-unmodified-loop-condition": 1,
"no-unused-expressions": 1,
"no-unused-labels": 1,
"no-useless-call": 1,
"no-useless-concat": 1,
"no-useless-escape": 1,
"no-useless-return": 1,
"no-void": 1,
"no-warning-comments": 1,
"no-with": 1,
"prefer-promise-reject-errors": 1,
"radix": 1,
"require-await": 1,
"vars-on-top": 1,
"wrap-iife": 1,
"yoda": 1
}
}
22 changes: 22 additions & 0 deletions scripts/lazyload/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
50 changes: 50 additions & 0 deletions scripts/lazyload/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Editor files
.idea

# Node modules
node_modules
58 changes: 58 additions & 0 deletions scripts/lazyload/Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
eslint: {
options: {
configFile: ".eslintrc.json"
},
src: ["src/lazyload.*.js"]
},
rollup: {
options: {
"format": "umd",
"moduleName": "LazyLoad"
},
files: {
src: "src/lazyload.core.js",
dest: "dist/lazyload.es2015.js"
}
},
babel: {
options: {
sourceMap: false,
presets: [["es2015", { "modules": false }]],
plugins: ["transform-object-assign"]
},
dist: {
files: {
"dist/lazyload.js": "dist/lazyload.es2015.js"
}
}
},
uglify: {
options: {
banner: "",
sourceMap: false
},
dist: {
files: {
"dist/lazyload.min.js": "dist/lazyload.js",
}
}
},
watch: {
files: ["<%= eslint.src %>"],
tasks: ["eslint", "babel", "uglify"]
}
});

grunt.loadNpmTasks("gruntify-eslint");
grunt.loadNpmTasks("grunt-babel");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-rollup");
grunt.loadNpmTasks("grunt-contrib-watch");

grunt.registerTask("default", ["eslint", "rollup", "babel", "uglify"]);
grunt.registerTask("w", ["eslint", "rollup", "babel", "uglify", "watch"]);

};
Loading

0 comments on commit ab44a13

Please sign in to comment.