Fancy Pics
This commit is contained in:
parent
2becc0b257
commit
09508c9c5a
22
ofu_app/apps/donar/migrations/0006_auto_20171204_1543.py
Normal file
22
ofu_app/apps/donar/migrations/0006_auto_20171204_1543.py
Normal file
@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.7 on 2017-12-04 14:43
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import datetime
|
||||
from django.db import migrations, models
|
||||
from django.utils.timezone import utc
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('donar', '0005_auto_20171204_0454'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='lecture_terms',
|
||||
name='starttime',
|
||||
field=models.TimeField(default=datetime.datetime(2017, 12, 4, 14, 42, 5, 347, tzinfo=utc)),
|
||||
),
|
||||
]
|
||||
22
ofu_app/apps/donar/migrations/0007_auto_20171204_1634.py
Normal file
22
ofu_app/apps/donar/migrations/0007_auto_20171204_1634.py
Normal file
@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.7 on 2017-12-04 15:34
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import datetime
|
||||
from django.db import migrations, models
|
||||
from django.utils.timezone import utc
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('donar', '0006_auto_20171204_1543'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='lecture_terms',
|
||||
name='starttime',
|
||||
field=models.TimeField(default=datetime.datetime(2017, 12, 4, 15, 34, 41, 765204, tzinfo=utc)),
|
||||
),
|
||||
]
|
||||
22
ofu_app/apps/donar/migrations/0008_auto_20171204_1645.py
Normal file
22
ofu_app/apps/donar/migrations/0008_auto_20171204_1645.py
Normal file
@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.7 on 2017-12-04 15:45
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import datetime
|
||||
from django.db import migrations, models
|
||||
from django.utils.timezone import utc
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('donar', '0007_auto_20171204_1634'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='lecture_terms',
|
||||
name='starttime',
|
||||
field=models.TimeField(default=datetime.datetime(2017, 12, 4, 15, 45, 46, 720753, tzinfo=utc)),
|
||||
),
|
||||
]
|
||||
22
ofu_app/apps/donar/migrations/0009_auto_20171204_1648.py
Normal file
22
ofu_app/apps/donar/migrations/0009_auto_20171204_1648.py
Normal file
@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.7 on 2017-12-04 15:48
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import datetime
|
||||
from django.db import migrations, models
|
||||
from django.utils.timezone import utc
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('donar', '0008_auto_20171204_1645'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='lecture_terms',
|
||||
name='starttime',
|
||||
field=models.TimeField(default=datetime.datetime(2017, 12, 4, 15, 48, 28, 229201, tzinfo=utc)),
|
||||
),
|
||||
]
|
||||
@ -4,10 +4,24 @@ from __future__ import unicode_literals
|
||||
from django.contrib import admin
|
||||
from apps.food.models import SingleFood, Menu, HappyHour, UserRating, UserFoodImage
|
||||
|
||||
|
||||
class SingleFoodInline(admin.TabularInline):
|
||||
model = Menu.menu.through
|
||||
extra = 1
|
||||
# fields = ['menu__image', ]
|
||||
|
||||
|
||||
class MenuAdmin(admin.ModelAdmin):
|
||||
list_filter = ('date',)
|
||||
inlines = [
|
||||
SingleFoodInline,
|
||||
]
|
||||
exclude = ('menu',)
|
||||
|
||||
|
||||
# Register your models here.
|
||||
admin.site.register(SingleFood)
|
||||
admin.site.register(Menu)
|
||||
admin.site.register(HappyHour)
|
||||
admin.site.register(UserRating)
|
||||
admin.site.register(UserFoodImage)
|
||||
|
||||
admin.site.register(Menu, MenuAdmin)
|
||||
|
||||
26
ofu_app/apps/food/migrations/0004_auto_20171204_1543.py
Normal file
26
ofu_app/apps/food/migrations/0004_auto_20171204_1543.py
Normal file
@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.7 on 2017-12-04 14:43
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('food', '0003_auto_20171204_0454'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='menu',
|
||||
name='menu',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='menu',
|
||||
name='menu',
|
||||
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='food.SingleFood'),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
||||
24
ofu_app/apps/food/migrations/0005_auto_20171204_1634.py
Normal file
24
ofu_app/apps/food/migrations/0005_auto_20171204_1634.py
Normal file
@ -0,0 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.7 on 2017-12-04 15:34
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('food', '0004_auto_20171204_1543'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='menu',
|
||||
name='menu',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='menu',
|
||||
name='menu',
|
||||
field=models.ManyToManyField(to='food.SingleFood'),
|
||||
),
|
||||
]
|
||||
@ -12,7 +12,7 @@ class Menu(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
date = models.DateField(default=timezone.now)
|
||||
location = models.CharField(max_length=MAX_LENGTH)
|
||||
menu = models.ManyToManyField("SingleFood")
|
||||
menu = models.ManyToManyField("SingleFood", related_name="foods")
|
||||
|
||||
class Meta:
|
||||
unique_together = ('date', 'location')
|
||||
|
||||
@ -39,4 +39,14 @@ footer {
|
||||
.image-wrapper img {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
|
||||
.lb-image, .lb-outerContainer, .lb-image {
|
||||
width: 56% !important;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.lb-image {
|
||||
width: 100% !important;
|
||||
height: auto !important;
|
||||
}
|
||||
21
ofu_app/static/libs/lightbox2-master/.editorconfig
Normal file
21
ofu_app/static/libs/lightbox2-master/.editorconfig
Normal file
@ -0,0 +1,21 @@
|
||||
# EditorConfig helps developers define and maintain consistent
|
||||
# coding styles between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
|
||||
[*]
|
||||
|
||||
# Change these settings to your own preference
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# We recommend you to keep these unchanged
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
27
ofu_app/static/libs/lightbox2-master/.github/ISSUE_TEMPLATE.md
vendored
Normal file
27
ofu_app/static/libs/lightbox2-master/.github/ISSUE_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
🐛 **Github issues is for bugs only.** No feature requests or support tickets please.
|
||||
|
||||
## Trouble using Lightbox?
|
||||
|
||||
1. Search [Stackoverflow](https://stackoverflow.com/questions/tagged/lightbox2) to see if other people have run into similar issues.
|
||||
3. If you don't find anything similar, then post a new question on [Stackoverflow](https://stackoverflow.com/questions/ask). Use the `lightbox2` tag.
|
||||
|
||||
## Have a Feature Request?
|
||||
|
||||
1. [Search through existing Github Issues and PRs](https://github.com/lokesh/lightbox2/issues) to see if the feature has been discussed or already created.
|
||||
2. If not, search [Stackoverflow](https://stackoverflow.com/questions/tagged/lightbox2) to see if other people have made similar requests.
|
||||
3. If your feature request is unique, then post a new question on [Stackoverflow](https://stackoverflow.com/questions/ask). Use the `lightbox2` tag.
|
||||
|
||||
View the project [Roadmap](https://github.com/lokesh/lightbox2/blob/master/ROADMAP.md).
|
||||
|
||||
|
||||
## Found a Bug?
|
||||
|
||||
[Search through existing Github Issues](https://github.com/lokesh/lightbox2/issues) that have been reported to avoid creating a duplicate issue. If your bug has not been reported, create a new issue with the following details:
|
||||
|
||||
**What version of Lightbox2 you are using?**
|
||||
|
||||
**Which browsers and operating systems have you seen the issue on?**
|
||||
|
||||
**What are the steps to reproduce the bug?**
|
||||
|
||||
**Do you have link to a live site where the bug is visible? or can you post relevant HTML, CSS, and Javascript?**
|
||||
4
ofu_app/static/libs/lightbox2-master/.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
4
ofu_app/static/libs/lightbox2-master/.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
> Pull Requests are welcome. But note that v2 of Lightbox is in Maintenance Mode and no new features
|
||||
> will be added. See the [Roadmap](https://github.com/lokesh/lightbox2/blob/master/ROADMAP.md).
|
||||
>
|
||||
> PRs submitted will still be reviewed and then kept open for other users to utilize.
|
||||
2
ofu_app/static/libs/lightbox2-master/.gitignore
vendored
Normal file
2
ofu_app/static/libs/lightbox2-master/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
bower_components
|
||||
node_modules
|
||||
75
ofu_app/static/libs/lightbox2-master/.jscsrc
Normal file
75
ofu_app/static/libs/lightbox2-master/.jscsrc
Normal file
@ -0,0 +1,75 @@
|
||||
{
|
||||
"requireSpaceAfterLineComment": true,
|
||||
"requireSpaceAfterKeywords": [
|
||||
"do",
|
||||
"for",
|
||||
"if",
|
||||
"else",
|
||||
"switch",
|
||||
"case",
|
||||
"try",
|
||||
"catch",
|
||||
"void",
|
||||
"while",
|
||||
"with",
|
||||
"return",
|
||||
"typeof"
|
||||
],
|
||||
"requireSpaceBeforeBlockStatements": true,
|
||||
"requireParenthesesAroundIIFE": true,
|
||||
"requireSpacesInConditionalExpression": true,
|
||||
"disallowMultipleVarDecl": true,
|
||||
"requireBlocksOnNewline": true,
|
||||
"disallowEmptyBlocks": true,
|
||||
"disallowSpacesInsideParentheses": true,
|
||||
"disallowSpaceAfterObjectKeys": true,
|
||||
"requireSpaceBeforeObjectValues": true,
|
||||
"requireCommaBeforeLineBreak": true,
|
||||
"requireOperatorBeforeLineBreak": [
|
||||
"?",
|
||||
"=",
|
||||
"+",
|
||||
"-",
|
||||
"/",
|
||||
"*",
|
||||
"==",
|
||||
"===",
|
||||
"!=",
|
||||
"!==",
|
||||
">",
|
||||
">=",
|
||||
"<",
|
||||
"<="
|
||||
],
|
||||
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
|
||||
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
|
||||
"requireSpaceBeforeBinaryOperators": [
|
||||
"=",
|
||||
"+",
|
||||
"-",
|
||||
"/",
|
||||
"*",
|
||||
"==",
|
||||
"===",
|
||||
"!=",
|
||||
"!=="
|
||||
],
|
||||
"requireSpaceAfterBinaryOperators": [
|
||||
"=",
|
||||
",",
|
||||
"+",
|
||||
"-",
|
||||
"/",
|
||||
"*",
|
||||
"==",
|
||||
"===",
|
||||
"!=",
|
||||
"!=="
|
||||
],
|
||||
"disallowMixedSpacesAndTabs" : true,
|
||||
"disallowTrailingWhitespace": true,
|
||||
"disallowTrailingComma": true,
|
||||
"requireLineFeedAtFileEnd": true,
|
||||
"requireCapitalizedConstructors": true
|
||||
}
|
||||
|
||||
35
ofu_app/static/libs/lightbox2-master/.jshintrc
Normal file
35
ofu_app/static/libs/lightbox2-master/.jshintrc
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"bitwise":true,
|
||||
"browser":true,
|
||||
"camelcase":true,
|
||||
"curly":true,
|
||||
"eqeqeq":true,
|
||||
"forin":true,
|
||||
"freeze":true,
|
||||
"indent":2,
|
||||
"latedef":true,
|
||||
"maxdepth": 6,
|
||||
"maxparams": 6,
|
||||
"maxstatements": 50,
|
||||
"newcap": true,
|
||||
"noarg":true,
|
||||
"noempty":true,
|
||||
"nonbsp":true,
|
||||
"nonew":true,
|
||||
"quotmark":"single",
|
||||
"trailing":true,
|
||||
"undef":true,
|
||||
"unused":"vars",
|
||||
"immed":true,
|
||||
"browser": true,
|
||||
"jquery":true,
|
||||
"predef": [
|
||||
"alert",
|
||||
"confirm",
|
||||
"console",
|
||||
"escape",
|
||||
"define",
|
||||
"module",
|
||||
"require"
|
||||
]
|
||||
}
|
||||
15
ofu_app/static/libs/lightbox2-master/DEPLOY.md
Normal file
15
ofu_app/static/libs/lightbox2-master/DEPLOY.md
Normal file
@ -0,0 +1,15 @@
|
||||
## How to Make a Release
|
||||
|
||||
### Build
|
||||
- **Checkout dev branch.** This will contain work queued up for the next release.
|
||||
- **Update version number.** Manually update version number in `src/lightbox.js` and `package.json`. Don't use `npm version`.
|
||||
- **`grunt build`.** Make sure you have run `bower install` ahead of this as it will pull down jQuery which is utilized in the build step.
|
||||
- **Merge to `master`.** Commit changes and push to new branch. Create PR from this branch to `master`. Merge.
|
||||
|
||||
### Release
|
||||
- **Create tagged release.** Go to [Github Releases page](https://github.com/lokesh/lightbox2/releases). Draft a new release. Naming convention is `v2.8.1`. Add notes that link to PRs.
|
||||
- **`npm publish`**. No need to do anything for Bower as it is entirely based on the Github repo.
|
||||
|
||||
### Maintenance and Docs
|
||||
- **GH clean-up.** Close out issues with `[status] pending release`.
|
||||
- **Lightbox Site.** If there are any changes to the options, don't forget to update the [Lightbox Site](http://localhost:8000/dist/#options). The code lives in a separate repo, [lightbox2-site](https://github.com/lokesh/lightbox2-site/).
|
||||
83
ofu_app/static/libs/lightbox2-master/Gruntfile.js
Normal file
83
ofu_app/static/libs/lightbox2-master/Gruntfile.js
Normal file
@ -0,0 +1,83 @@
|
||||
module.exports = function(grunt) {
|
||||
|
||||
grunt.initConfig({
|
||||
concat: {
|
||||
dist: {
|
||||
src: ['bower_components/jquery/dist/jquery.js', 'src/js/lightbox.js'],
|
||||
dest: 'dist/js/lightbox-plus-jquery.js',
|
||||
},
|
||||
},
|
||||
connect: {
|
||||
server: {
|
||||
options: {
|
||||
port: 8000
|
||||
}
|
||||
}
|
||||
},
|
||||
copy: {
|
||||
dist: {
|
||||
files: [
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'src/',
|
||||
src: ['**'],
|
||||
dest: 'dist/'
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
jshint: {
|
||||
all: [
|
||||
'src/js/lightbox.js'
|
||||
],
|
||||
options: {
|
||||
jshintrc: true
|
||||
}
|
||||
},
|
||||
jscs: {
|
||||
src: [
|
||||
'src/js/lightbox.js'
|
||||
],
|
||||
options: {
|
||||
config: ".jscsrc"
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
options: {
|
||||
preserveComments: 'some',
|
||||
sourceMap: true
|
||||
},
|
||||
dist: {
|
||||
files: {
|
||||
'dist/js/lightbox.min.js': ['src/js/lightbox.js'],
|
||||
'dist/js/lightbox-plus-jquery.min.js': ['dist/js/lightbox-plus-jquery.js']
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
jshint: {
|
||||
files: ['src/js/lightbox.js'],
|
||||
tasks: ['jshint', 'jscs']
|
||||
}
|
||||
},
|
||||
cssmin: {
|
||||
minify: {
|
||||
src: 'dist/css/lightbox.css',
|
||||
dest: 'dist/css/lightbox.min.css'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||
grunt.loadNpmTasks('grunt-contrib-connect');
|
||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
||||
grunt.loadNpmTasks("grunt-jscs");
|
||||
|
||||
grunt.registerTask('default', ['connect', 'watch']);
|
||||
grunt.registerTask('test', ['jshint', 'jscs']);
|
||||
grunt.registerTask('build', ['jshint', 'jscs', 'copy:dist', 'concat', 'uglify', 'cssmin:minify']);
|
||||
};
|
||||
21
ofu_app/static/libs/lightbox2-master/LICENSE
Normal file
21
ofu_app/static/libs/lightbox2-master/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Lokesh Dhakar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
19
ofu_app/static/libs/lightbox2-master/README.md
Normal file
19
ofu_app/static/libs/lightbox2-master/README.md
Normal file
@ -0,0 +1,19 @@
|
||||
# Lightbox2
|
||||
|
||||
The original lightbox script. Eight years later — still going strong!
|
||||
|
||||
Lightbox is small javascript library used to overlay images on top of the current page. It's a snap to setup and works on all modern browsers.
|
||||
|
||||
- **Demos and usage instructions.** Visit the [Lightbox homepage](http://lokeshdhakar.com/projects/lightbox2/) to see examples, info on getting started, script options, how to get help, and more.
|
||||
- **Releases and Changelog**. Viewable on the [Github Releases page](https://github.com/lokesh/lightbox2/releases)
|
||||
- **Roadmap.** View the [Roadmap](https://github.com/lokesh/lightbox2/blob/master/ROADMAP.md) for a peek at what is being planned for future releases.
|
||||
- **License.** Lightbox is licensed under the MIT License. [Learn more about the license.](http://lokeshdhakar.com/projects/lightbox2/#license)
|
||||
|
||||
by [Lokesh Dhakar](http://www.lokeshdhakar.com)
|
||||
|
||||
---
|
||||
|
||||
### Info for Maintainers
|
||||
|
||||
- **Release instructions.** See [DEPLOY.md](https://github.com/lokesh/lightbox2/blob/master/DEPLOY.md).
|
||||
- **Issues and PRs requiring review.** See items tagged with [\[status\] needs review](https://github.com/lokesh/lightbox2/labels/%5Bstatus%5D%20needs%20review)
|
||||
64
ofu_app/static/libs/lightbox2-master/ROADMAP.md
Normal file
64
ofu_app/static/libs/lightbox2-master/ROADMAP.md
Normal file
@ -0,0 +1,64 @@
|
||||
# Roadmap
|
||||
|
||||
## v2.x - Maintenance Mode
|
||||
|
||||
No new features are being worked on for v2.x.
|
||||
|
||||
## v3.0 - In Brainstorming Phase
|
||||
|
||||
**Not planned for v3.0**
|
||||
The goal of this script from it's beginnings till today is to to provide a better *image viewing experience*.
|
||||
|
||||
- **HTML or video content.** If you need to show html or video content, I recommend googling for an alternative script as there are many options.
|
||||
- **Social sharing buttons.**
|
||||
|
||||
**Image Support**
|
||||
- Investigate `srcset` and `<picture>`
|
||||
|
||||
**Interactions**
|
||||
- Add touch gesture support.
|
||||
- Exploring using tilt gesture on mobile devices with extra-wide images.
|
||||
- If user attempts to go forward when at end of image set, animation (shake?) indicating the end or option to close Lightbox.
|
||||
- Make sure right-click/long pressing works to access the image's context menu.
|
||||
|
||||
**Layout**
|
||||
- Allow vertical centering.
|
||||
- Update sizing on window resize.
|
||||
- Should the dev be able to choose the position of the caption, close button, and nav controls?
|
||||
- Optimize layout for mobile.
|
||||
- Optimize layout for screens of varying densities.
|
||||
- Should the close button still live in the bottom right corner?
|
||||
|
||||
**Animations**
|
||||
- Evaluate start, end, and transition animations.
|
||||
- Rewrite animations for performance and flexibility.
|
||||
|
||||
**Assets**
|
||||
- Use inline SVG for UI elements.
|
||||
|
||||
**Caching**
|
||||
- Review if and how images should be preloaded
|
||||
|
||||
**Error Handling**
|
||||
- What happens when an image url is incorrect?
|
||||
- What happens when an image takes too long to load?
|
||||
|
||||
**Accessibility**
|
||||
- Should opening lightbox update the url? and should this url be parsed on page load to show Lightbox automatically?
|
||||
- Review alt attributes.
|
||||
- Review ARIA roles.
|
||||
- Review constrast ratios.
|
||||
- Review keyboard input and tabbing.
|
||||
- Review click/touch target size.
|
||||
- Test with screen reader.
|
||||
|
||||
**API**
|
||||
- Do not initialize automatically and allow multiple instances.
|
||||
- Add event handlers.
|
||||
- Allow setting options on the fly.
|
||||
- Allow the setting of options from HTML?
|
||||
- Evaluate preloading and caching.
|
||||
- Allow placement inside of a specified element? Orig feature requester was dealing with iframe.
|
||||
|
||||
**Dependencies**
|
||||
- Drop jQuery requirement.
|
||||
29
ofu_app/static/libs/lightbox2-master/bower.json
Normal file
29
ofu_app/static/libs/lightbox2-master/bower.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "lightbox2",
|
||||
"homepage": "http://lokeshdhakar.com/projects/lightbox2/",
|
||||
"authors": [
|
||||
"Lokesh Dhakar <lokesh.dhakar@gmail.com>"
|
||||
],
|
||||
"description": "The original Lightbox script. Uses jQuery.",
|
||||
"main": [
|
||||
"./dist/js/lightbox.js",
|
||||
"./dist/css/lightbox.css"
|
||||
],
|
||||
"keywords": [
|
||||
"lightbox",
|
||||
"lightbox2",
|
||||
"overlay",
|
||||
"gallery",
|
||||
"slideshow",
|
||||
"images"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components"
|
||||
],
|
||||
"dependencies": {
|
||||
"jquery": ">2"
|
||||
}
|
||||
}
|
||||
37
ofu_app/static/libs/lightbox2-master/examples/index.html
Normal file
37
ofu_app/static/libs/lightbox2-master/examples/index.html
Normal file
@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Lightbox Example</title>
|
||||
<link rel="stylesheet" href="../dist/css/lightbox.min.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<section>
|
||||
<h3>Two Individual Images</h3>
|
||||
<div>
|
||||
<a class="example-image-link" href="http://lokeshdhakar.com/projects/lightbox2/images/image-1.jpg" data-lightbox="example-1"><img class="example-image" src="http://lokeshdhakar.com/projects/lightbox2/images/thumb-1.jpg" alt="image-1" /></a>
|
||||
<a class="example-image-link" href="http://lokeshdhakar.com/projects/lightbox2/images/image-2.jpg" data-lightbox="example-2" data-title="Optional caption."><img class="example-image" src="http://lokeshdhakar.com/projects/lightbox2/images/thumb-2.jpg" alt="image-1"/></a>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
<h3>A Four Image Set</h3>
|
||||
<div>
|
||||
<a class="example-image-link" href="http://lokeshdhakar.com/projects/lightbox2/images/image-3.jpg" data-lightbox="example-set" data-title="Click the right half of the image to move forward."><img class="example-image" src="http://lokeshdhakar.com/projects/lightbox2/images/thumb-3.jpg" alt=""/></a>
|
||||
<a class="example-image-link" href="http://lokeshdhakar.com/projects/lightbox2/images/image-4.jpg" data-lightbox="example-set" data-title="Or press the right arrow on your keyboard."><img class="example-image" src="http://lokeshdhakar.com/projects/lightbox2/images/thumb-4.jpg" alt="" /></a>
|
||||
<a class="example-image-link" href="http://lokeshdhakar.com/projects/lightbox2/images/image-5.jpg" data-lightbox="example-set" data-title="The next image in the set is preloaded as you're viewing."><img class="example-image" src="http://lokeshdhakar.com/projects/lightbox2/images/thumb-5.jpg" alt="" /></a>
|
||||
<a class="example-image-link" href="http://lokeshdhakar.com/projects/lightbox2/images/image-6.jpg" data-lightbox="example-set" data-title="Click anywhere outside the image or the X to the right to close."><img class="example-image" src="http://lokeshdhakar.com/projects/lightbox2/images/thumb-6.jpg" alt="" /></a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<p>
|
||||
For more information, visit <a href="http://lokeshdhakar.com/projects/lightbox2/">http://lokeshdhakar.com/projects/lightbox2/</a>
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<script src="../dist/js/lightbox-plus-jquery.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
40
ofu_app/static/libs/lightbox2-master/package.json
Normal file
40
ofu_app/static/libs/lightbox2-master/package.json
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "lightbox2",
|
||||
"version": "2.10.0",
|
||||
"author": "Lokesh Dhakar <lokesh.dhakar@gmail.com>",
|
||||
"description": "The original Lightbox script. Uses jQuery.",
|
||||
"keywords": [
|
||||
"lightbox",
|
||||
"lightbox2",
|
||||
"overlay",
|
||||
"gallery",
|
||||
"slideshow",
|
||||
"images"
|
||||
],
|
||||
"homepage": "http://lokeshdhakar.com/projects/lightbox2/",
|
||||
"main": "./dist/js/lightbox.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/lokesh/lightbox2.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/lokesh/lightbox2/issues"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://raw.githubusercontent.com/lokesh/lightbox2/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"devDependencies": {
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-contrib-concat": "^0.5.1",
|
||||
"grunt-contrib-connect": "^0.7.1",
|
||||
"grunt-contrib-copy": "^0.8.0",
|
||||
"grunt-contrib-cssmin": "^0.12.3",
|
||||
"grunt-contrib-jshint": "^0.11.2",
|
||||
"grunt-contrib-uglify": "~0.4.0",
|
||||
"grunt-contrib-watch": "^0.5.3",
|
||||
"grunt-jscs": "^1.8.0"
|
||||
}
|
||||
}
|
||||
207
ofu_app/static/libs/lightbox2-master/src/css/lightbox.css
Normal file
207
ofu_app/static/libs/lightbox2-master/src/css/lightbox.css
Normal file
@ -0,0 +1,207 @@
|
||||
html.lb-disable-scrolling {
|
||||
overflow: hidden;
|
||||
/* Position fixed required for iOS. Just putting overflow: hidden; on the body is not enough. */
|
||||
position: fixed;
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.lightboxOverlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 9999;
|
||||
background-color: black;
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80);
|
||||
opacity: 0.8;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.lightbox {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 10000;
|
||||
text-align: center;
|
||||
line-height: 0;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.lightbox .lb-image {
|
||||
display: block;
|
||||
height: auto;
|
||||
max-width: inherit;
|
||||
max-height: none;
|
||||
border-radius: 3px;
|
||||
|
||||
/* Image border */
|
||||
border: 4px solid white;
|
||||
}
|
||||
|
||||
.lightbox a img {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.lb-outerContainer {
|
||||
position: relative;
|
||||
*zoom: 1;
|
||||
width: 250px;
|
||||
height: 250px;
|
||||
margin: 0 auto;
|
||||
border-radius: 4px;
|
||||
|
||||
/* Background color behind image.
|
||||
This is visible during transitions. */
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.lb-outerContainer:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.lb-loader {
|
||||
position: absolute;
|
||||
top: 43%;
|
||||
left: 0;
|
||||
height: 25%;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
line-height: 0;
|
||||
}
|
||||
|
||||
.lb-cancel {
|
||||
display: block;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
margin: 0 auto;
|
||||
background: url(../images/loading.gif) no-repeat;
|
||||
}
|
||||
|
||||
.lb-nav {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.lb-container > .nav {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.lb-nav a {
|
||||
outline: none;
|
||||
background-image: url('data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
|
||||
}
|
||||
|
||||
.lb-prev, .lb-next {
|
||||
height: 100%;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.lb-nav a.lb-prev {
|
||||
width: 34%;
|
||||
left: 0;
|
||||
float: left;
|
||||
background: url(../images/prev.png) left 48% no-repeat;
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity 0.6s;
|
||||
-moz-transition: opacity 0.6s;
|
||||
-o-transition: opacity 0.6s;
|
||||
transition: opacity 0.6s;
|
||||
}
|
||||
|
||||
.lb-nav a.lb-prev:hover {
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.lb-nav a.lb-next {
|
||||
width: 64%;
|
||||
right: 0;
|
||||
float: right;
|
||||
background: url(../images/next.png) right 48% no-repeat;
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity 0.6s;
|
||||
-moz-transition: opacity 0.6s;
|
||||
-o-transition: opacity 0.6s;
|
||||
transition: opacity 0.6s;
|
||||
}
|
||||
|
||||
.lb-nav a.lb-next:hover {
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.lb-dataContainer {
|
||||
margin: 0 auto;
|
||||
padding-top: 5px;
|
||||
*zoom: 1;
|
||||
width: 100%;
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
|
||||
.lb-dataContainer:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.lb-data {
|
||||
padding: 0 4px;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.lb-data .lb-details {
|
||||
width: 85%;
|
||||
float: left;
|
||||
text-align: left;
|
||||
line-height: 1.1em;
|
||||
}
|
||||
|
||||
.lb-data .lb-caption {
|
||||
font-size: 13px;
|
||||
font-weight: bold;
|
||||
line-height: 1em;
|
||||
}
|
||||
|
||||
.lb-data .lb-caption a {
|
||||
color: #4ae;
|
||||
}
|
||||
|
||||
.lb-data .lb-number {
|
||||
display: block;
|
||||
clear: left;
|
||||
padding-bottom: 1em;
|
||||
font-size: 12px;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.lb-data .lb-close {
|
||||
display: block;
|
||||
float: right;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
background: url(../images/close.png) top right no-repeat;
|
||||
text-align: right;
|
||||
outline: none;
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=70);
|
||||
opacity: 0.7;
|
||||
-webkit-transition: opacity 0.2s;
|
||||
-moz-transition: opacity 0.2s;
|
||||
-o-transition: opacity 0.2s;
|
||||
transition: opacity 0.2s;
|
||||
}
|
||||
|
||||
.lb-data .lb-close:hover {
|
||||
cursor: pointer;
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
|
||||
opacity: 1;
|
||||
}
|
||||
BIN
ofu_app/static/libs/lightbox2-master/src/images/close.png
Normal file
BIN
ofu_app/static/libs/lightbox2-master/src/images/close.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 280 B |
BIN
ofu_app/static/libs/lightbox2-master/src/images/loading.gif
Normal file
BIN
ofu_app/static/libs/lightbox2-master/src/images/loading.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.3 KiB |
BIN
ofu_app/static/libs/lightbox2-master/src/images/next.png
Normal file
BIN
ofu_app/static/libs/lightbox2-master/src/images/next.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
ofu_app/static/libs/lightbox2-master/src/images/prev.png
Normal file
BIN
ofu_app/static/libs/lightbox2-master/src/images/prev.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
519
ofu_app/static/libs/lightbox2-master/src/js/lightbox.js
Normal file
519
ofu_app/static/libs/lightbox2-master/src/js/lightbox.js
Normal file
@ -0,0 +1,519 @@
|
||||
/*!
|
||||
* Lightbox v2.10.0
|
||||
* by Lokesh Dhakar
|
||||
*
|
||||
* More info:
|
||||
* http://lokeshdhakar.com/projects/lightbox2/
|
||||
*
|
||||
* Copyright 2007, 2018 Lokesh Dhakar
|
||||
* Released under the MIT license
|
||||
* https://github.com/lokesh/lightbox2/blob/master/LICENSE
|
||||
*
|
||||
* @preserve
|
||||
*/
|
||||
|
||||
// Uses Node, AMD or browser globals to create a module.
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node. Does not work with strict CommonJS, but
|
||||
// only CommonJS-like environments that support module.exports,
|
||||
// like Node.
|
||||
module.exports = factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
root.lightbox = factory(root.jQuery);
|
||||
}
|
||||
}(this, function ($) {
|
||||
|
||||
function Lightbox(options) {
|
||||
this.album = [];
|
||||
this.currentImageIndex = void 0;
|
||||
this.init();
|
||||
|
||||
// options
|
||||
this.options = $.extend({}, this.constructor.defaults);
|
||||
this.option(options);
|
||||
}
|
||||
|
||||
// Descriptions of all options available on the demo site:
|
||||
// http://lokeshdhakar.com/projects/lightbox2/index.html#options
|
||||
Lightbox.defaults = {
|
||||
albumLabel: 'Image %1 of %2',
|
||||
alwaysShowNavOnTouchDevices: false,
|
||||
fadeDuration: 600,
|
||||
fitImagesInViewport: true,
|
||||
imageFadeDuration: 600,
|
||||
// maxWidth: 800,
|
||||
// maxHeight: 600,
|
||||
positionFromTop: 50,
|
||||
resizeDuration: 700,
|
||||
showImageNumberLabel: true,
|
||||
wrapAround: false,
|
||||
disableScrolling: false,
|
||||
/*
|
||||
Sanitize Title
|
||||
If the caption data is trusted, for example you are hardcoding it in, then leave this to false.
|
||||
This will free you to add html tags, such as links, in the caption.
|
||||
|
||||
If the caption data is user submitted or from some other untrusted source, then set this to true
|
||||
to prevent xss and other injection attacks.
|
||||
*/
|
||||
sanitizeTitle: false
|
||||
};
|
||||
|
||||
Lightbox.prototype.option = function(options) {
|
||||
$.extend(this.options, options);
|
||||
};
|
||||
|
||||
Lightbox.prototype.imageCountLabel = function(currentImageNum, totalImages) {
|
||||
return this.options.albumLabel.replace(/%1/g, currentImageNum).replace(/%2/g, totalImages);
|
||||
};
|
||||
|
||||
Lightbox.prototype.init = function() {
|
||||
var self = this;
|
||||
// Both enable and build methods require the body tag to be in the DOM.
|
||||
$(document).ready(function() {
|
||||
self.enable();
|
||||
self.build();
|
||||
});
|
||||
};
|
||||
|
||||
// Loop through anchors and areamaps looking for either data-lightbox attributes or rel attributes
|
||||
// that contain 'lightbox'. When these are clicked, start lightbox.
|
||||
Lightbox.prototype.enable = function() {
|
||||
var self = this;
|
||||
$('body').on('click', 'a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]', function(event) {
|
||||
self.start($(event.currentTarget));
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
// Build html for the lightbox and the overlay.
|
||||
// Attach event handlers to the new DOM elements. click click click
|
||||
Lightbox.prototype.build = function() {
|
||||
if ($('#lightbox').length > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
$('<div id="lightboxOverlay" class="lightboxOverlay"></div><div id="lightbox" class="lightbox"><div class="lb-outerContainer"><div class="lb-container"><img class="lb-image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" /><div class="lb-nav"><a class="lb-prev" href="" ></a><a class="lb-next" href="" ></a></div><div class="lb-loader"><a class="lb-cancel"></a></div></div></div><div class="lb-dataContainer"><div class="lb-data"><div class="lb-details"><span class="lb-caption"></span><span class="lb-number"></span></div><div class="lb-closeContainer"><a class="lb-close"></a></div></div></div></div>').appendTo($('body'));
|
||||
|
||||
// Cache jQuery objects
|
||||
this.$lightbox = $('#lightbox');
|
||||
this.$overlay = $('#lightboxOverlay');
|
||||
this.$outerContainer = this.$lightbox.find('.lb-outerContainer');
|
||||
this.$container = this.$lightbox.find('.lb-container');
|
||||
this.$image = this.$lightbox.find('.lb-image');
|
||||
this.$nav = this.$lightbox.find('.lb-nav');
|
||||
|
||||
// Store css values for future lookup
|
||||
this.containerPadding = {
|
||||
top: parseInt(this.$container.css('padding-top'), 10),
|
||||
right: parseInt(this.$container.css('padding-right'), 10),
|
||||
bottom: parseInt(this.$container.css('padding-bottom'), 10),
|
||||
left: parseInt(this.$container.css('padding-left'), 10)
|
||||
};
|
||||
|
||||
this.imageBorderWidth = {
|
||||
top: parseInt(this.$image.css('border-top-width'), 10),
|
||||
right: parseInt(this.$image.css('border-right-width'), 10),
|
||||
bottom: parseInt(this.$image.css('border-bottom-width'), 10),
|
||||
left: parseInt(this.$image.css('border-left-width'), 10)
|
||||
};
|
||||
|
||||
// Attach event handlers to the newly minted DOM elements
|
||||
this.$overlay.hide().on('click', function() {
|
||||
self.end();
|
||||
return false;
|
||||
});
|
||||
|
||||
this.$lightbox.hide().on('click', function(event) {
|
||||
if ($(event.target).attr('id') === 'lightbox') {
|
||||
self.end();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
this.$outerContainer.on('click', function(event) {
|
||||
if ($(event.target).attr('id') === 'lightbox') {
|
||||
self.end();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
this.$lightbox.find('.lb-prev').on('click', function() {
|
||||
if (self.currentImageIndex === 0) {
|
||||
self.changeImage(self.album.length - 1);
|
||||
} else {
|
||||
self.changeImage(self.currentImageIndex - 1);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
this.$lightbox.find('.lb-next').on('click', function() {
|
||||
if (self.currentImageIndex === self.album.length - 1) {
|
||||
self.changeImage(0);
|
||||
} else {
|
||||
self.changeImage(self.currentImageIndex + 1);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
/*
|
||||
Show context menu for image on right-click
|
||||
|
||||
There is a div containing the navigation that spans the entire image and lives above of it. If
|
||||
you right-click, you are right clicking this div and not the image. This prevents users from
|
||||
saving the image or using other context menu actions with the image.
|
||||
|
||||
To fix this, when we detect the right mouse button is pressed down, but not yet clicked, we
|
||||
set pointer-events to none on the nav div. This is so that the upcoming right-click event on
|
||||
the next mouseup will bubble down to the image. Once the right-click/contextmenu event occurs
|
||||
we set the pointer events back to auto for the nav div so it can capture hover and left-click
|
||||
events as usual.
|
||||
*/
|
||||
this.$nav.on('mousedown', function(event) {
|
||||
if (event.which === 3) {
|
||||
self.$nav.css('pointer-events', 'none');
|
||||
|
||||
self.$lightbox.one('contextmenu', function() {
|
||||
setTimeout(function() {
|
||||
this.$nav.css('pointer-events', 'auto');
|
||||
}.bind(self), 0);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.$lightbox.find('.lb-loader, .lb-close').on('click', function() {
|
||||
self.end();
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
// Show overlay and lightbox. If the image is part of a set, add siblings to album array.
|
||||
Lightbox.prototype.start = function($link) {
|
||||
var self = this;
|
||||
var $window = $(window);
|
||||
|
||||
$window.on('resize', $.proxy(this.sizeOverlay, this));
|
||||
|
||||
$('select, object, embed').css({
|
||||
visibility: 'hidden'
|
||||
});
|
||||
|
||||
this.sizeOverlay();
|
||||
|
||||
this.album = [];
|
||||
var imageNumber = 0;
|
||||
|
||||
function addToAlbum($link) {
|
||||
self.album.push({
|
||||
alt: $link.attr('data-alt'),
|
||||
link: $link.attr('href'),
|
||||
title: $link.attr('data-title') || $link.attr('title')
|
||||
});
|
||||
}
|
||||
|
||||
// Support both data-lightbox attribute and rel attribute implementations
|
||||
var dataLightboxValue = $link.attr('data-lightbox');
|
||||
var $links;
|
||||
|
||||
if (dataLightboxValue) {
|
||||
$links = $($link.prop('tagName') + '[data-lightbox="' + dataLightboxValue + '"]');
|
||||
for (var i = 0; i < $links.length; i = ++i) {
|
||||
addToAlbum($($links[i]));
|
||||
if ($links[i] === $link[0]) {
|
||||
imageNumber = i;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($link.attr('rel') === 'lightbox') {
|
||||
// If image is not part of a set
|
||||
addToAlbum($link);
|
||||
} else {
|
||||
// If image is part of a set
|
||||
$links = $($link.prop('tagName') + '[rel="' + $link.attr('rel') + '"]');
|
||||
for (var j = 0; j < $links.length; j = ++j) {
|
||||
addToAlbum($($links[j]));
|
||||
if ($links[j] === $link[0]) {
|
||||
imageNumber = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Position Lightbox
|
||||
var top = $window.scrollTop() + this.options.positionFromTop;
|
||||
var left = $window.scrollLeft();
|
||||
this.$lightbox.css({
|
||||
top: top + 'px',
|
||||
left: left + 'px'
|
||||
}).fadeIn(this.options.fadeDuration);
|
||||
|
||||
// Disable scrolling of the page while open
|
||||
if (this.options.disableScrolling) {
|
||||
$('html').addClass('lb-disable-scrolling');
|
||||
}
|
||||
|
||||
this.changeImage(imageNumber);
|
||||
};
|
||||
|
||||
// Hide most UI elements in preparation for the animated resizing of the lightbox.
|
||||
Lightbox.prototype.changeImage = function(imageNumber) {
|
||||
var self = this;
|
||||
|
||||
this.disableKeyboardNav();
|
||||
var $image = this.$lightbox.find('.lb-image');
|
||||
|
||||
this.$overlay.fadeIn(this.options.fadeDuration);
|
||||
|
||||
$('.lb-loader').fadeIn('slow');
|
||||
this.$lightbox.find('.lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption').hide();
|
||||
|
||||
this.$outerContainer.addClass('animating');
|
||||
|
||||
// When image to show is preloaded, we send the width and height to sizeContainer()
|
||||
var preloader = new Image();
|
||||
preloader.onload = function() {
|
||||
var $preloader;
|
||||
var imageHeight;
|
||||
var imageWidth;
|
||||
var maxImageHeight;
|
||||
var maxImageWidth;
|
||||
var windowHeight;
|
||||
var windowWidth;
|
||||
|
||||
$image.attr({
|
||||
'alt': self.album[imageNumber].alt,
|
||||
'src': self.album[imageNumber].link
|
||||
});
|
||||
|
||||
$preloader = $(preloader);
|
||||
|
||||
$image.width(preloader.width);
|
||||
$image.height(preloader.height);
|
||||
|
||||
if (self.options.fitImagesInViewport) {
|
||||
// Fit image inside the viewport.
|
||||
// Take into account the border around the image and an additional 10px gutter on each side.
|
||||
|
||||
windowWidth = $(window).width();
|
||||
windowHeight = $(window).height();
|
||||
maxImageWidth = windowWidth - self.containerPadding.left - self.containerPadding.right - self.imageBorderWidth.left - self.imageBorderWidth.right - 20;
|
||||
maxImageHeight = windowHeight - self.containerPadding.top - self.containerPadding.bottom - self.imageBorderWidth.top - self.imageBorderWidth.bottom - 120;
|
||||
|
||||
// Check if image size is larger then maxWidth|maxHeight in settings
|
||||
if (self.options.maxWidth && self.options.maxWidth < maxImageWidth) {
|
||||
maxImageWidth = self.options.maxWidth;
|
||||
}
|
||||
if (self.options.maxHeight && self.options.maxHeight < maxImageWidth) {
|
||||
maxImageHeight = self.options.maxHeight;
|
||||
}
|
||||
|
||||
// Is the current image's width or height is greater than the maxImageWidth or maxImageHeight
|
||||
// option than we need to size down while maintaining the aspect ratio.
|
||||
if ((preloader.width > maxImageWidth) || (preloader.height > maxImageHeight)) {
|
||||
if ((preloader.width / maxImageWidth) > (preloader.height / maxImageHeight)) {
|
||||
imageWidth = maxImageWidth;
|
||||
imageHeight = parseInt(preloader.height / (preloader.width / imageWidth), 10);
|
||||
$image.width(imageWidth);
|
||||
$image.height(imageHeight);
|
||||
} else {
|
||||
imageHeight = maxImageHeight;
|
||||
imageWidth = parseInt(preloader.width / (preloader.height / imageHeight), 10);
|
||||
$image.width(imageWidth);
|
||||
$image.height(imageHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
self.sizeContainer($image.width(), $image.height());
|
||||
};
|
||||
|
||||
preloader.src = this.album[imageNumber].link;
|
||||
this.currentImageIndex = imageNumber;
|
||||
};
|
||||
|
||||
// Stretch overlay to fit the viewport
|
||||
Lightbox.prototype.sizeOverlay = function() {
|
||||
this.$overlay
|
||||
.width($(document).width())
|
||||
.height($(document).height());
|
||||
};
|
||||
|
||||
// Animate the size of the lightbox to fit the image we are showing
|
||||
Lightbox.prototype.sizeContainer = function(imageWidth, imageHeight) {
|
||||
var self = this;
|
||||
|
||||
var oldWidth = this.$outerContainer.outerWidth();
|
||||
var oldHeight = this.$outerContainer.outerHeight();
|
||||
var newWidth = imageWidth + this.containerPadding.left + this.containerPadding.right + this.imageBorderWidth.left + this.imageBorderWidth.right;
|
||||
var newHeight = imageHeight + this.containerPadding.top + this.containerPadding.bottom + this.imageBorderWidth.top + this.imageBorderWidth.bottom;
|
||||
|
||||
function postResize() {
|
||||
self.$lightbox.find('.lb-dataContainer').width(newWidth);
|
||||
self.$lightbox.find('.lb-prevLink').height(newHeight);
|
||||
self.$lightbox.find('.lb-nextLink').height(newHeight);
|
||||
self.showImage();
|
||||
}
|
||||
|
||||
if (oldWidth !== newWidth || oldHeight !== newHeight) {
|
||||
this.$outerContainer.animate({
|
||||
width: newWidth,
|
||||
height: newHeight
|
||||
}, this.options.resizeDuration, 'swing', function() {
|
||||
postResize();
|
||||
});
|
||||
} else {
|
||||
postResize();
|
||||
}
|
||||
};
|
||||
|
||||
// Display the image and its details and begin preload neighboring images.
|
||||
Lightbox.prototype.showImage = function() {
|
||||
this.$lightbox.find('.lb-loader').stop(true).hide();
|
||||
this.$lightbox.find('.lb-image').fadeIn(this.options.imageFadeDuration);
|
||||
|
||||
this.updateNav();
|
||||
this.updateDetails();
|
||||
this.preloadNeighboringImages();
|
||||
this.enableKeyboardNav();
|
||||
};
|
||||
|
||||
// Display previous and next navigation if appropriate.
|
||||
Lightbox.prototype.updateNav = function() {
|
||||
// Check to see if the browser supports touch events. If so, we take the conservative approach
|
||||
// and assume that mouse hover events are not supported and always show prev/next navigation
|
||||
// arrows in image sets.
|
||||
var alwaysShowNav = false;
|
||||
try {
|
||||
document.createEvent('TouchEvent');
|
||||
alwaysShowNav = (this.options.alwaysShowNavOnTouchDevices) ? true : false;
|
||||
} catch (e) {}
|
||||
|
||||
this.$lightbox.find('.lb-nav').show();
|
||||
|
||||
if (this.album.length > 1) {
|
||||
if (this.options.wrapAround) {
|
||||
if (alwaysShowNav) {
|
||||
this.$lightbox.find('.lb-prev, .lb-next').css('opacity', '1');
|
||||
}
|
||||
this.$lightbox.find('.lb-prev, .lb-next').show();
|
||||
} else {
|
||||
if (this.currentImageIndex > 0) {
|
||||
this.$lightbox.find('.lb-prev').show();
|
||||
if (alwaysShowNav) {
|
||||
this.$lightbox.find('.lb-prev').css('opacity', '1');
|
||||
}
|
||||
}
|
||||
if (this.currentImageIndex < this.album.length - 1) {
|
||||
this.$lightbox.find('.lb-next').show();
|
||||
if (alwaysShowNav) {
|
||||
this.$lightbox.find('.lb-next').css('opacity', '1');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Display caption, image number, and closing button.
|
||||
Lightbox.prototype.updateDetails = function() {
|
||||
var self = this;
|
||||
|
||||
// Enable anchor clicks in the injected caption html.
|
||||
// Thanks Nate Wright for the fix. @https://github.com/NateWr
|
||||
if (typeof this.album[this.currentImageIndex].title !== 'undefined' &&
|
||||
this.album[this.currentImageIndex].title !== '') {
|
||||
var $caption = this.$lightbox.find('.lb-caption');
|
||||
if (this.options.sanitizeTitle) {
|
||||
$caption.text(this.album[this.currentImageIndex].title);
|
||||
} else {
|
||||
$caption.html(this.album[this.currentImageIndex].title);
|
||||
}
|
||||
$caption.fadeIn('fast')
|
||||
.find('a').on('click', function(event) {
|
||||
if ($(this).attr('target') !== undefined) {
|
||||
window.open($(this).attr('href'), $(this).attr('target'));
|
||||
} else {
|
||||
location.href = $(this).attr('href');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (this.album.length > 1 && this.options.showImageNumberLabel) {
|
||||
var labelText = this.imageCountLabel(this.currentImageIndex + 1, this.album.length);
|
||||
this.$lightbox.find('.lb-number').text(labelText).fadeIn('fast');
|
||||
} else {
|
||||
this.$lightbox.find('.lb-number').hide();
|
||||
}
|
||||
|
||||
this.$outerContainer.removeClass('animating');
|
||||
|
||||
this.$lightbox.find('.lb-dataContainer').fadeIn(this.options.resizeDuration, function() {
|
||||
return self.sizeOverlay();
|
||||
});
|
||||
};
|
||||
|
||||
// Preload previous and next images in set.
|
||||
Lightbox.prototype.preloadNeighboringImages = function() {
|
||||
if (this.album.length > this.currentImageIndex + 1) {
|
||||
var preloadNext = new Image();
|
||||
preloadNext.src = this.album[this.currentImageIndex + 1].link;
|
||||
}
|
||||
if (this.currentImageIndex > 0) {
|
||||
var preloadPrev = new Image();
|
||||
preloadPrev.src = this.album[this.currentImageIndex - 1].link;
|
||||
}
|
||||
};
|
||||
|
||||
Lightbox.prototype.enableKeyboardNav = function() {
|
||||
$(document).on('keyup.keyboard', $.proxy(this.keyboardAction, this));
|
||||
};
|
||||
|
||||
Lightbox.prototype.disableKeyboardNav = function() {
|
||||
$(document).off('.keyboard');
|
||||
};
|
||||
|
||||
Lightbox.prototype.keyboardAction = function(event) {
|
||||
var KEYCODE_ESC = 27;
|
||||
var KEYCODE_LEFTARROW = 37;
|
||||
var KEYCODE_RIGHTARROW = 39;
|
||||
|
||||
var keycode = event.keyCode;
|
||||
var key = String.fromCharCode(keycode).toLowerCase();
|
||||
if (keycode === KEYCODE_ESC || key.match(/x|o|c/)) {
|
||||
this.end();
|
||||
} else if (key === 'p' || keycode === KEYCODE_LEFTARROW) {
|
||||
if (this.currentImageIndex !== 0) {
|
||||
this.changeImage(this.currentImageIndex - 1);
|
||||
} else if (this.options.wrapAround && this.album.length > 1) {
|
||||
this.changeImage(this.album.length - 1);
|
||||
}
|
||||
} else if (key === 'n' || keycode === KEYCODE_RIGHTARROW) {
|
||||
if (this.currentImageIndex !== this.album.length - 1) {
|
||||
this.changeImage(this.currentImageIndex + 1);
|
||||
} else if (this.options.wrapAround && this.album.length > 1) {
|
||||
this.changeImage(0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Closing time. :-(
|
||||
Lightbox.prototype.end = function() {
|
||||
this.disableKeyboardNav();
|
||||
$(window).off('resize', this.sizeOverlay);
|
||||
this.$lightbox.fadeOut(this.options.fadeDuration);
|
||||
this.$overlay.fadeOut(this.options.fadeDuration);
|
||||
$('select, object, embed').css({
|
||||
visibility: 'visible'
|
||||
});
|
||||
if (this.options.disableScrolling) {
|
||||
$('html').removeClass('lb-disable-scrolling');
|
||||
}
|
||||
};
|
||||
|
||||
return new Lightbox();
|
||||
}));
|
||||
@ -3,8 +3,10 @@
|
||||
<script src="{{ static('libs/jquery/jquery-3.2.1.min.js') }}"></script>
|
||||
<script src="{{ static('js/food/rating.js') }}"></script>
|
||||
{# <script src="{{ static('js/food/image_capturing.js') }}"></script>#}
|
||||
<script src="{{ static('libs/lightbox2-master/dist/js/lightbox-plus-jquery.js') }}"></script>
|
||||
{% endblock %}
|
||||
{% block css_extra %}
|
||||
<link href="{{ static('libs/lightbox2-master/dist/css/lightbox.css') }}" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{{ static('css/food/main.css') }}">
|
||||
{% endblock %}
|
||||
{% block bottom_nav %}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<h2>{{ title }} </h2>
|
||||
{% if location_menu %}
|
||||
<p>{{ location_menu.date.strftime('%d.%m.%Y') }}</p>
|
||||
{{ get_menu(location_menu.menu.all()) }}
|
||||
{{ get_menu(location_menu.menu.all(), title) }}
|
||||
{% else %}
|
||||
<p> {{ fail_text }}</p>
|
||||
{% endif %}
|
||||
@ -30,7 +30,7 @@
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro get_menu(menu) -%}
|
||||
{% macro get_menu(menu, title="") -%}
|
||||
<ul class="border media-list">
|
||||
{% for single_food in menu %}
|
||||
<li data-food="{{ single_food.id }}" data-rating="{{ single_food.rating }}" class="food-item media">
|
||||
@ -38,12 +38,14 @@
|
||||
{# TODO: without many to many #}
|
||||
{% if single_food.image.all() %}
|
||||
{% for image in single_food.image.all() %}
|
||||
<a href="{{ image.image.url }}">
|
||||
<a href="{{ image.image.url }}" data-lightbox="{{ title }}"
|
||||
data-title="{{ single_food.name }}">
|
||||
<img src="{{ image.image.url }}" class="media-object" alt="Bild" width="80px">
|
||||
</a>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<a href="/media/food/default/gorilla.jpg">
|
||||
<a href="/media/food/default/gorilla.jpg" data-lightbox="{{ title }}"
|
||||
data-title="{{ single_food.name }}">
|
||||
<img src="/media/food/default/gorilla.jpg" class="media-object" alt="Bild" width="80px">
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user