This commit is contained in:
2024-12-14 20:41:41 +03:00
parent 74cd10de8a
commit 0f779b7ebf
103 changed files with 3212 additions and 1387 deletions
+35
View File
@@ -0,0 +1,35 @@
# How to contribute
Community made patches, localisations, bug reports and contributions are always welcome and are crucial to ensure FlexSlider remains the #1 responsive jQuery slideshow solution. :)
When contributing, please ensure you follow the guidelines below so that we can keep on top of things.
__Note:__
GitHub is for *bug reports and contributions only* - if you have a setup question, please be mindful of this and keep your question clear and concise, if you must post it to this repository.
If you are a WooThemes customer, use [WooThemes Support](http://support.woothemes.com). Our ninjas are on hand to assist with your set up query.
## Getting Started
* Make sure you have a [GitHub account](https://github.com/signup/free)
* Submit a ticket for your issue, assuming one does not already exist (please look over the currently open issues before creating a new issue).
* Clearly describe the issue including steps to reproduce when it is a bug.
* Make sure you fill in the earliest version that you know has the issue.
## Making Changes
* Fork the repository on GitHub.
* Make the changes to your forked repository.
* Ensure you use LF line endings - no crazy windows line endings. :)
* When committing, reference your issue (#1234) and include a note about the fix.
* Push the changes to your fork and submit a pull request on the **master** branch of the FlexSlider repository. Existing maintenance branches will be maintained of by FlexSlider developers.
* Please don't modify the changelog, this will be maintained by FlexSlider developers.
At this point you're waiting on us to merge your pull request. We'll review all pull requests, and make suggestions and changes if necessary.
# Additional Resources
* [General GitHub documentation](http://help.github.com/)
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
* [WooThemes Support](http://support.woothemes.com)
+339
View File
@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{description}
Copyright (C) {year} {fullname}
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
+225
View File
@@ -0,0 +1,225 @@
[![Gitter chat](https://badges.gitter.im/woothemes/FlexSlider.png)](https://gitter.im/woothemes/FlexSlider)
# FlexSlider 2.7.2
http://www.woocommerce.com/flexslider/ - Copyright (c) 2015 WooThemes
## Releases
The `master` branch of this repository is always the latest development version of FlexSlider. Please view the [Releases](https://github.com/woocommerce/FlexSlider/releases) section for a list of official FlexSlider builds.
### Contributing
We encourage contributions to FlexSlider and will review all pull requests submitted.
Before contributing, please see our [Contributing Guide](https://github.com/woocommerce/FlexSlider/blob/master/CONTRIBUTING.md).
### Roadmap
To keep up to date with how FlexSlider's development roadmap looks, please see our [development roadmap](https://github.com/woocommerce/FlexSlider/wiki/Roadmap).
## Updates
** Version 2.7.2 **
** Refactor jQuery HTML output for img attributes.
** Version 2.7.1 **
** RTL fixes for Firefox browser.
** Version 2.7.0 **
** Fixes resize method call for orientationchange. Adds RTL feature - param "rtl" added. **
** Version 2.6.3 **
** Rollback fade fixes, due to harsh fade reports. **
** Version 2.6.2 **
** Minor update to fix issues with varying heights and overflow onto content below the slider. Fixes the visibility of the pagination and the navigation in the "fade" mode. **
** Version 2.6.1 **
** SmoothHeight now uses innerHeight() instead of height() to account for padding in calculation. Defining var altText to prevent error. bower.json add fonts folder on main field. Changed true to false in order to make sure whether or not to allow a slider comprised of a single slide. **
** Version 2.6.0 **
** Adds composer json file, scope fix for focused keyword, fixes bower demo folder exclusion, z-index fix for disabled nav arrow, play/pause accessibility fix, itemMargin fix for slider items, fixes accessibility for in focus elements and pagination controls, firefox fix for text selection on slider carousel, adds data-thumb-alt image alt attribute. **
** Version 2.5.0 **
** Bumped compatibility support starting with jQuery 1.7+. pausePlay icon fix. Firefox touch event fix. Adds customDirectionNav param. **
** Version 2.4.0 **
** Update for improved standards. Adds classes to li nav elements. Reset for li elements in stylesheet. **
** Version 2.3.0 **
** Fixes pauseInvisible attribute issue with Chrome and the Page Visibility API. **
** Version 2.2.2 **
** Fixes minified JavaScript file to remove merge conflicts. **
** Version 2.2.0 **
- Fixed event handler conflicts with devices that are both click and touch enabled. e.g., Windows 8.
- Made all slider variables public, stored in `slider.vars`. This allows manipulation of `slider.vars.minItems` and `slider.vars.maxItems` on the fly to create different fluid grids at certain breakpoints. [Check out this example demonstrating a basic technique](http://flexslider.woothemes.com/dynamic-carousel-min-max.html)
- Fixed calculations that were causing strange issues with paging and certain FlexSliders to move out of alignment.
*Be sure to test v2.2.0 with your current slider, before pushing live, to ensure everything is playing nicely.*
-----
## General Notes
FlexSlider is no longer licensed under the MIT license. FlexSlider now uses the license, GPLv2 and later.
In an effort to move the plugin forward, support for jQuery 1.4.2 has been dropped. The plugin now requires jQuery 1.7.0+. If you don't have access to the later versions of jQuery, [FlexSlider 1.8](https://github.com/woocommerce/FlexSlider/tree/flexslider1) should be a perfectly suitable substitute for your needs!
Your old styles and properties *might not work out of the box*. Some property names have been changed, noted below, as well as namespacing prefixes being applied to all elements. This means that `.flex-direction-nav .next` is now `.flex-direction-nav .flex-next` by default. The namespacing property is exposed, free for you to change.
No more overflow hidden woes! The plugin now generates a viewport element to handle the tedious task of working around overflow hidden. Yay!
The slider element is now accessible outside of the callback API via the jQuery .data() method. Example use: `$('#slider').data('flexslider')`
Helper strings have been added for performing actions quickly on FlexSlider elements. Example uses:
- `$('#slider').flexslider("play") //Play slideshow`
- `$('#slider').flexslider("pause") //Pause slideshow`
- `$('#slider').flexslider("stop") //Stop slideshow`
- `$('#slider').flexslider("next") //Go to next slide`
- `$('#slider').flexslider("prev") //Go to previous slide`
- `$('#slider').flexslider(3) //Go fourth slide`
Two new methods are available for adding/removing slides, `slider.addSlide()` and `slider.removeSlide()`. More details about this coming soon.
- `slider.addSlide(obj, pos)` accepts two parameters, a string/jQuery object and an index.
- `slider.removeSlide(obj)` accepts one parameter, either an object to be removed, or an index.
## Examples
- [Basic Slider](http://flexslider.woothemes.com/)
- [Basic Slider customDirectionNav](http://flexslider.woothemes.com/basic-slider-with-custom-direction-nav.html)
- [Basic Slider with Simple Caption](http://flexslider.woothemes.com/basic-slider-with-caption.html)
- [Slider w/thumbnail controlNav pattern](http://flexslider.woothemes.com/thumbnail-controlnav.html)
- [Slider w/thumbnail slider](http://flexslider.woothemes.com/thumbnail-slider.html)
- [Basic Carousel](http://flexslider.woothemes.com/basic-carousel.html)
- [Carousel with min and max ranges](http://flexslider.woothemes.com/carousel-min-max.html)
- [Carousel with min and max ranges](http://flexslider.woothemes.com/dynamic-carousel-min-max.html)
- [Video with Vimeo API](http://flexslider.woothemes.com/video.html)
- [Video with Wistia API](http://flexslider.woothemes.com/video-wistia.html)
## RTL Examples
- [Basic Slider](http://flexslider.woothemes.com/index-rtl.html)
- [Slider with Simple Caption w/thumbnail slider](http://flexslider.woothemes.com/asnavfor-rtl.html)
- [Basic Slider with Simple Caption](http://flexslider.woothemes.com/basic-carousel-rtl.html)
## Properties
### namespace: *{new}*
`namespace` controls the prefixes attached to elements created by the plugin. In previous releases, only certain elements were tagged with a prefix class, which was causing class generalization issues for some users. FlexSlider now prefixes all generated elements with the appropriate namespace.
*Hint: `namespace` can be an empty string.*
### selector: *{new}*
The markup structure for FlexSlider has been limited to a "ul.slide li" pattern in previous versions of FlexSlider; no longer. You can now take full control of the markup structure used for your FlexSlider. The `selector` pattern "{container} > {slide}" is mandatory, allowing the plugin to predictably interpret the selector property. Omitting the ">" from the selector is not suggested, but is possible if your markup doesn't follow the immediate descendant pattern.
*Examples: "section > article", ".slides > .slide", "#hero .slide"*
### easing: *{new}*
`easing` allows support for jQuery easing! Default options provided by jQuery are "swing" and "linear," but more can be used by included the jQuery Easing plugin. *If you chose a non-existent easing method, the slider will break.*
*Note: You need to set `useCSS: false` to force transitions in browsers that support translate3d.*
*Optional: [jQuery Easing Plugin](http://gsgd.co.uk/sandbox/jquery/easing/)*
### direction: *{changed}*
Previously called "slideDirection" in v1.8 and below.
### reverse: *{new}*
`reverse` will reverse the animation direction of the slider. Meaning, horizontal sliders can move from right to left, and vertical sliders can move bottom to top.
### smoothHeight: *{new}*
`smoothHeight` allows for smooth height transitions between slides. This property currently works for the fade and horizontal slide animation. The property has no effect on horizontal sliding carousels, however.
### startAt: *{changed}*
Previously called "slideToStart" in v1.8 and below.
### animationSpeed: *{changed}*
Previously called "animationDuration" in v1.8 and below.
### initDelay: *{new}*
`initDelay` will delay the initial slideshow of a slider, given in milliseconds. The slider will still initialize, generating controls and displaying the first image, but the slideshow will wait until the `initDelay` time has completed before starting the slideshow.
### useCSS: *{new}*
`useCSS` allow users to override using CSS3 for animation. Translate3d still has numerous bugs that can crop up and wreak havoc, so this is a great property to play with if you are experiencing unexplainable issues in Webkit browsers.
*Hint: Use conditionals to enable/disable the use of CSS3 on desktops and mobile devices. Mobile devices, in my experience, do not share many of the translate3d bugs seen on desktop browsers.*
### touch: *{new}*
`touch` allows users to exclude touch swipe functionality from their sliders.
### keyboard: *{changed}*
Previously called "keyboardNav" in v1.8 and below.
### multipleKeyboard *{new}*
`multipleKeyboard` allows users to override the default plugin keyboard behavior, enabling keyboard control of more than one slider on the page. This means that all visible sliders will animate, at the same time, via keyboard input.
*Hint: You can use `multipleKeyboard` to allow keyboard navigation on pages where multiple sliders are present, but only one is visible.*
### mousewheel: *{updated}*
`mousewheel` now requires the jQuery Mousewheel plugin. There are a few reasons for this, but primarily because there is no need for FlexSlider itself to reinvent the awkward complexity of mousewheel interactivity that is handled perfectly by the Mousewheel plugin.
*Required: [jQuery Mousewheel Plugin](https://github.com/brandonaaron/jquery-mousewheel)*
### controlsContainer: *{updated}*
`controlsContainer` is one of the more painstaking, potentially confusing properties within FlexSlider. First, the property is no longer required to workaround `overflow: hidden` on slide animation. Second, the property now accepts a **jQuery object**, giving you precise control over the object you want. The plugin no longer attempts to guess what element you are selecting.
### customDirectionNav: *{new}*
`customDirectionNav` allows the ability to add custom directional navigation elements. Can be used in conjunction with controlsContainer for pagination controls container.
*[Example of customDirectionNav being used](http://flexslider.woothemes.com/basic-slider-with-custom-direction-nav.html)*
### sync: *{new}*
`sync` is a new property that will allow other slider(s) to hook into the current slider via a given selector. The selector should describe an object that has already been initialized as a FlexSlider. Right now, `sync` will synchronize animation, play, and pause behaviors. More behaviors can be added in the future as the property matures.
*[Example of sync being used](http://flex.madebymufffin.com/examples/basic-carousel.html)*
### asNavFor: *{new}*
Description to be added.
### itemWidth: *{new}*
`itemWidth` is the primary property for the new carousel options. Without this property, your slider is not considered a carousel. To use `itemWidth`, give an integer value of the width of your individual slides. This should include borders and paddings applied to your slides; a total width measurement.
### itemMargin: *{new}*
`itemMargin` describes the gutter between the slide elements. If each slide has a margin-left of 10px, your itemMargin value would be 10. If elements have margin: 0 10px, your itemMargin would be 20.
### minItems: *{new}*
`minItems` describes the minimum number of slide elements that should be visible in the carousel. When the slider reaches the minimum item count, the slides will resize fluidly with the slider.
### maxItems: *{new}*
`maxItems` describes the maximum number of slide elements that should be visible in the carousel. When the slider reaches the maximum item count, the slides will resize fluidly with the sider.
### move: *{new}*
`move` determines how many slides should be animated within the carousel. When left at 0, the slider will animate the number of visible slides. If any value greater than 0 is given, the slider will animate that number of slides in the carousel on each animation interval.
*Hint: The move property will be ignored if the value is higher than the number of visible slides, which can be utilized in responsive design.*
### added: *{new}*
`added()` is a new callback event fired in the new slider.addSlide() function.
### removed: *{new}*
`removed()` is a new callback event fired in the new slider.removeSlide() function.
### allowOneSlide: *{new}*
Boolean. Whether or not you'd like FlexSlider to initialize as usual if only one slide is present.
### rtl: *{new}*
Boolean. False by default. Supports RTL functionality in the slider.
*Note: you must add `style="direction:rtl"` to your container div in order for this to work.*
### isFirefox: *{new}*
Boolean. False by default. Set to true if the Firefox browser is in use.
*Note: used for RTL compatibility logic.*
+32
View File
@@ -0,0 +1,32 @@
{
"name": "flexslider",
"version": "2.7.2",
"homepage": "https://github.com/woocommerce/FlexSlider",
"authors": [
"Automattic <jeff@woothemes.com>"
],
"description": "An awesome, fully responsive jQuery slider toolkit.",
"main": [
"jquery.flexslider.js",
"flexslider.css"
],
"keywords": [
"flexslider",
"jquery",
"slider",
"woothemes",
"automattic"
],
"license": "GPLv2 and later",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests",
"demo"
],
"dependencies": {
"jquery": ">=1.11.3"
}
}
+55
View File
@@ -0,0 +1,55 @@
FLEXSLIDER CHANGELOG
2013.02.15 - Version 2.0
* Added changelog.txt
2014.05.7 - Version 2.2.2
* Added flexslider.less
2015.02.11 - Version 2.3.0
* Fix for pauseInvisible attribute for Chrome and the Page Visibility API
2015.02.27 - Version 2.4.0
* Update for improved standards. Adds classes to li nav elements. Reset for li elements in stylesheet.
2015.05.19 - Version 2.5.0
* CSS fix for pausePlay play icon.
* Firefox touchstart event fix.
* Compatibility change for jQuery to 1.7.0+
* Adds customDirectionNav param for custom navigation controls
2015.11.16 - Version 2.6.0
* Adds composer json file keywords
* Scope fix for focused keyword
* Fixes bower demo folder exclusion
* z-index fix for disabled nav arrow
* play/pause accessibility fix
* itemMargin fix for slider items margins
* Fixes accessibility for in focus elements and pagination controls
* Firefox fix for text selection on slider carousel
* Adds data-thumb-alt image alt attribute
2016.05.12 - Version 2.6.1
* smoothHeight now uses innerHeight() instead of height() to account for padding in calculation.
* Defining var altText to prevent error.
* bower.json add fonts folder on main field.
* Changed `true` to `false` in order to make sure whether or not to allow a slider comprised of a single slide.
2016.08.18 - Version 2.6.2
* Fixes overflow issue with varying height images.
* Fixes the visibility of the pagination and the navigation in the "fade" mode.
2016.09.06 - Version 2.6.3
* Rollback fade fixes, due to harsh fade reports.
2018.02.01 - Version 2.7.0
* Fixes resize method call for orientationchange.
* Adds RTL feature - param "rtl" added.
* Adds RTL demo's.
2018.06.15 - Version 2.7.1
* Firefox RTL fixes.
* Adds "isFirefox" param.
2019.03.07 - Version 2.7.2
* Refactor jQuery HTML output for img attributes.
+6
View File
@@ -0,0 +1,6 @@
{
"name": "woocommerce/FlexSlider",
"description": "An awesome, fully responsive jQuery slider toolkit.",
"keywords": ["flexslider","slider","jquery","woocommerce","automattic"],
"homepage": "https://github.com/woocommerce/FlexSlider"
}
+77
View File
@@ -0,0 +1,77 @@
/* ====================================================================================================================
* BASE STYLES
* ====================================================================================================================*/
.flexslider {
margin: 0;
padding: 0;
.slides {
> li {
display: none;
-webkit-backface-visibility: hidden;
}
img{
width: 100%;
display: block;
}
//
// Clearfix for the .slides element
//
&:after{
content: "\0020";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
html[xmlns] &{
display: block;
}
* html &{
height: 1%;
}
//
// No JavaScript Fallback
// If you are not using another script, such as Modernizr, make sure you
// include js that eliminates this class on page load
//
.no-js &{
> li{
&:first-child{
display: block;
}
}
}
}
}
+17
View File
@@ -0,0 +1,17 @@
/* ====================================================================================================================
* FONT-FACE
* ====================================================================================================================*/
@font-face {
font-family: '@{font-name}';
src:url('@{font-path}/@{font-file-name}.eot');
src:url('@{font-path}/@{font-file-name}.eot?#iefix') format('embedded-opentype'),
url('@{font-path}/@{font-file-name}.woff') format('woff'),
url('@{font-path}/@{font-file-name}.ttf') format('truetype'),
url('@{font-path}/@{font-file-name}.svg#flexslider-icon') format('svg');
font-weight: normal;
font-style: normal;
}
+40
View File
@@ -0,0 +1,40 @@
//
// Transition
//
.transition( @duration: @default-duration, @easing: @default-easing ) {
-webkit-transition: all @duration @easing;
-moz-transition: all @duration @easing;
-ms-transition: all @duration @easing;
-o-transition: all @duration @easing;
transition: all @duration @easing;
}
//
// Border-radius
//
.border-radius( @radius: @default-border-radius ){
-webkit-border-radius: @arguments;
-moz-border-radius: @arguments;
border-radius: @arguments;
}
//
// Box-shadow
//
.box-shadow( @x-axis: @default-box-shadow-x-axis, @y-axis: @default-box-shadow-y-axis, @blur: @default-box-shadow-blur, @color: @default-box-shadow-color, @inset: @default-box-shadow-inset ) {
-webkit-box-shadow: @inset @x-axis @y-axis @blur @color;
-moz-box-shadow: @inset @x-axis @y-axis @blur @color;
-o-box-shadow: @inset @x-axis @y-axis @blur @color;
box-shadow: @inset @x-axis @y-axis @blur @color;
}
+32
View File
@@ -0,0 +1,32 @@
/* ====================================================================================================================
* RESETS
* ====================================================================================================================*/
.flex-container,
.flex-slider {
a:hover {
outline: none;
}
}
.slides,
.slides > li,
.flex-control-nav,
.flex-direction-nav {
margin: 0;
padding: 0;
list-style: none;
}
.flex-pauseplay span {
text-transform: capitalize;
}
@@ -0,0 +1,23 @@
/* ====================================================================================================================
* RESPONSIVE
* ====================================================================================================================*/
@media screen and ( max-width: 860px ) {
.flex-direction-nav {
.flex-prev {
opacity: 1;
left: 10px;
}
.flex-next {
opacity: 1;
right: 10px;
}
}
}
+317
View File
@@ -0,0 +1,317 @@
/* ====================================================================================================================
* DEFAULT THEME
* ====================================================================================================================*/
.flexslider {
margin: @flexslider-margin;
background: @flexslider-bg;
border: @flexslider-border;
position: relative;
zoom: 1;
.border-radius( @flexslider-border-radius );
.box-shadow( @flexslider-box-shadow-x-axis, @flexslider-box-shadow-y-axis, @flexslider-box-shadow-blur, @flexslider-box-shadow-color, @flexslider-box-shadow-inset);
.slides {
zoom: 1;
img {
height: auto;
-moz-user-select: none;
}
}
}
.flex-viewport {
max-height: @flex-viewport-max-height;
.transition();
.loading &{
max-height: @flex-viewport-loading-max-height;
}
}
@-moz-document url-prefix() {
.loading {
.flex-viewport {
max-height: none;
}
}
}
.carousel li {
margin-right: 5px;
}
//
// Direction Nav
//
.flex-direction-nav {
*height: 0;
//
// Global styles
//
a {
text-decoration: none;
display: block;
width: 40px;
height: 40px;
margin: -20px 0 0;
position: absolute;
top: 50%;
z-index: 10;
overflow: hidden;
opacity: 0;
cursor: pointer;
color: @flex-direction-nav-color;
text-shadow: @flex-direction-nav-text-shadow;
.transition( 0.3s, ease-in-out );
&:before {
font-family: "@{font-name}";
font-size: 40px;
display: inline-block;
content: @flex-direction-nav-icon-prev;
color: @flex-direction-nav-icon-color;
text-shadow: @flex-direction-nav-icon-text-shadow;
}
&.flex-next:before {
content: @flex-direction-nav-icon-next;
}
}
//
// Prev
//
.flex-prev {
left: -50px;
}
//
// Next
//
.flex-next {
right: -50px;
text-align: right;
}
//
// Hover states
//
.flexslider:hover &{
.flex-prev {
opacity: 0.7;
left: 10px;
&:hover{
opacity: 1;
}
}
.flex-next {
opacity: 0.7;
right: 10px;
&:hover{
opacity: 1;
}
}
}
//
// Disabled
//
.flex-disabled {
opacity: 0!important;
filter: alpha(opacity=0);
cursor: default;
z-index: -1;
}
}
//
// Pause/Play
//
.flex-pauseplay a {
display: block;
width: 20px;
height: 20px;
position: absolute;
bottom: 5px;
left: 10px;
opacity: 0.8;
z-index: 10;
overflow: hidden;
cursor: pointer;
color: #000;
&:before {
font-family: "@{font-name}";
font-size: 20px;
display: inline-block;
content: @flex-pauseplay-icon-pause;
}
&:hover {
opacity: 1;
}
&.flex-play:before {
content: @flex-pauseplay-icon-play;
}
}
//
// Control Nav
//
.flex-control-nav {
width: 100%;
position: absolute;
bottom: -40px;
text-align: center;
li {
margin: 0 6px;
display: inline-block;
zoom: 1;
*display: inline;
}
}
//
// Control paging
//
.flex-control-paging li {
a {
width: 11px;
height: 11px;
display: block;
background: #666;
background: rgba(0,0,0,0.5);
cursor: pointer;
text-indent: -9999px;
.box-shadow( 0, 0, 3px, rgba(0,0,0,0.3), inset );
.border-radius( 20px );
&:hover {
background: #333;
background: rgba(0,0,0,0.7);
}
&.flex-active {
background: #000;
background: rgba( 0, 0, 0, 0.9 );
cursor: default;
}
}
}
.flex-control-thumbs {
margin: @flex-control-thumbs;
position: static;
overflow: hidden;
li {
width: 25%;
float: left;
margin: 0;
}
img {
width: 100%;
height: auto;
display: block;
opacity: .7;
cursor: pointer;
-moz-user-select: none;
.transition();
&:hover {opacity: 1;}
}
.flex-active {
opacity: 1;
cursor: default;
}
}
@@ -0,0 +1,31 @@
@font-path: "fonts";
@font-name: "flexslider-icon";
@font-file-name: "flexslider-icon";
@default-duration: 1s;
@default-easing: ease;
@default-border-radius: 5px;
@default-box-shadow-x-axis: 0;
@default-box-shadow-y-axis: 1px;
@default-box-shadow-blur: 2px;
@default-box-shadow-color: rgba( 0, 0, 0, 0.2 );
@default-box-shadow-inset: '';
@flexslider-margin: 0 0 60px;
@flexslider-bg: #fff;
@flexslider-border: 4px solid #fff;
@flexslider-border-radius: 4px;
@flexslider-box-shadow-x-axis: 0;
@flexslider-box-shadow-y-axis: 1px;
@flexslider-box-shadow-blur: 4px;
@flexslider-box-shadow-color: rgba( 0, 0, 0, 0.2 );
@flexslider-box-shadow-inset: '';
@flex-viewport-max-height: 2000px;
@flex-viewport-loading-max-height: 300px;
@flex-control-thumbs: 5px 0 0;
@flex-direction-nav-color: rgba(0,0,0,0.8);
@flex-direction-nav-text-shadow: 1px 1px 0 rgba( 255, 255, 255, 0.3 );
@flex-direction-nav-icon-color: rgba(0,0,0,0.8);
@flex-direction-nav-icon-text-shadow: 1px 1px 0 rgba( 255, 255, 255, 0.3 );
@flex-direction-nav-icon-prev: '\f001';
@flex-direction-nav-icon-next: '\f002';
@flex-pauseplay-icon-play: '\f003';
@flex-pauseplay-icon-pause: '\f004';
+11
View File
@@ -0,0 +1,11 @@
/*
* jQuery FlexSlider v2.7.2
* https://www.woocommerce.com/flexslider/
*
* Copyright 2012 WooThemes
* Free to use under the GPLv2 and later license.
* http://www.gnu.org/licenses/gpl-2.0.html
*
* Contributing author: Tyler Smith (@mbmufffin)
*
*/.flexslider{direction:rtl}.carousel li{margin-right:5px}.flex-direction-nav{*height:0}.flex-direction-nav a:before{content:'\f002'}.flex-direction-nav a.flex-next:before{content:'\f001'}.flex-direction-nav .flex-prev{left:auto;right:-50px}.flex-direction-nav .flex-next{right:auto;left:-50px;text-align:left}.flexslider:hover .flex-direction-nav .flex-prev{opacity:0.7;left:auto;right:10px}.flexslider:hover .flex-direction-nav .flex-next{opacity:0.7;right:auto;left:10px}.flex-pauseplay a{left:auto;right:10px}@media screen and (max-width: 860px){.flex-direction-nav .flex-prev{left:auto;right:10px}.flex-direction-nav .flex-next{right:auto;left:10px}}
@@ -0,0 +1,75 @@
/*
* jQuery FlexSlider v2.7.2
* https://www.woocommerce.com/flexslider/
*
* Copyright 2012 WooThemes
* Free to use under the GPLv2 and later license.
* http://www.gnu.org/licenses/gpl-2.0.html
*
* Contributing author: Tyler Smith (@mbmufffin)
*
*/
/* ====================================================================================================================
* FONT-FACE
* ====================================================================================================================*/
/* ====================================================================================================================
* RESETS
* ====================================================================================================================*/
/* ====================================================================================================================
* BASE STYLES
* ====================================================================================================================*/
.flexslider {
direction:rtl;
}
/* ====================================================================================================================
* DEFAULT THEME
* ====================================================================================================================*/
.carousel li {
margin-right: 5px;
}
.flex-direction-nav {
*height: 0;
}
.flex-direction-nav a:before {
content: '\f002';
}
.flex-direction-nav a.flex-next:before {
content: '\f001';
}
.flex-direction-nav .flex-prev {
left: auto; right: -50px;
}
.flex-direction-nav .flex-next {
right: auto; left: -50px;
text-align: left;
}
.flexslider:hover .flex-direction-nav .flex-prev {
opacity: 0.7;
left: auto; right: 10px;
}
.flexslider:hover .flex-direction-nav .flex-next {
opacity: 0.7;
right: auto; left: 10px;
}
.flex-pauseplay a {
left: auto; right: 10px;
}
/* ====================================================================================================================
* RESPONSIVE
* ====================================================================================================================*/
@media screen and (max-width: 860px) {
.flex-direction-nav .flex-prev {
left: auto; right: 10px;
}
.flex-direction-nav .flex-next {
right: auto; left: 10px;
}
}
+280
View File
@@ -0,0 +1,280 @@
/*
* jQuery FlexSlider v2.7.2
* https://www.woocommerce.com/flexslider/
*
* Copyright 2012 WooThemes
* Free to use under the GPLv2 and later license.
* http://www.gnu.org/licenses/gpl-2.0.html
*
* Contributing author: Tyler Smith (@mbmufffin)
*
*/
/* ====================================================================================================================
* FONT-FACE
* ====================================================================================================================*/
@font-face {
font-family: 'flexslider-icon';
src: url('fonts/flexslider-icon.eot');
src: url('fonts/flexslider-icon.eot?#iefix') format('embedded-opentype'), url('fonts/flexslider-icon.woff') format('woff'), url('fonts/flexslider-icon.ttf') format('truetype'), url('fonts/flexslider-icon.svg#flexslider-icon') format('svg');
font-weight: normal;
font-style: normal;
}
/* ====================================================================================================================
* RESETS
* ====================================================================================================================*/
.flex-container a:hover,
.flex-slider a:hover {
outline: none;
}
.slides,
.slides > li,
.flex-control-nav,
.flex-direction-nav {
margin: 0;
padding: 0;
list-style: none;
}
.flex-pauseplay span {
text-transform: capitalize;
}
/* ====================================================================================================================
* BASE STYLES
* ====================================================================================================================*/
.flexslider {
margin: 0;
padding: 0;
}
.flexslider .slides > li {
display: none;
-webkit-backface-visibility: hidden;
}
.flexslider .slides img {
width: 100%;
display: block;
}
.flexslider .slides:after {
content: "\0020";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
html[xmlns] .flexslider .slides {
display: block;
}
* html .flexslider .slides {
height: 1%;
}
.no-js .flexslider .slides > li:first-child {
display: block;
}
/* ====================================================================================================================
* DEFAULT THEME
* ====================================================================================================================*/
.flexslider {
margin: 0 0 60px;
background: #fff;
border: 4px solid #fff;
position: relative;
zoom: 1;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: '' 0 1px 4px rgba(0, 0, 0, 0.2);
-moz-box-shadow: '' 0 1px 4px rgba(0, 0, 0, 0.2);
-o-box-shadow: '' 0 1px 4px rgba(0, 0, 0, 0.2);
box-shadow: '' 0 1px 4px rgba(0, 0, 0, 0.2);
}
.flexslider .slides {
zoom: 1;
}
.flexslider .slides img {
height: auto;
-moz-user-select: none;
}
.flex-viewport {
max-height: 2000px;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
.loading .flex-viewport {
max-height: 300px;
}
@-moz-document url-prefix() {
.loading .flex-viewport {
max-height: none;
}
}
.carousel li {
margin-right: 5px;
}
.flex-direction-nav {
*height: 0;
}
.flex-direction-nav a {
text-decoration: none;
display: block;
width: 40px;
height: 40px;
margin: -20px 0 0;
position: absolute;
top: 50%;
z-index: 10;
overflow: hidden;
opacity: 0;
cursor: pointer;
color: rgba(0, 0, 0, 0.8);
text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.3);
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
.flex-direction-nav a:before {
font-family: "flexslider-icon";
font-size: 40px;
display: inline-block;
content: '\f001';
color: rgba(0, 0, 0, 0.8);
text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.3);
}
.flex-direction-nav a.flex-next:before {
content: '\f002';
}
.flex-direction-nav .flex-prev {
left: -50px;
}
.flex-direction-nav .flex-next {
right: -50px;
text-align: right;
}
.flexslider:hover .flex-direction-nav .flex-prev {
opacity: 0.7;
left: 10px;
}
.flexslider:hover .flex-direction-nav .flex-prev:hover {
opacity: 1;
}
.flexslider:hover .flex-direction-nav .flex-next {
opacity: 0.7;
right: 10px;
}
.flexslider:hover .flex-direction-nav .flex-next:hover {
opacity: 1;
}
.flex-direction-nav .flex-disabled {
opacity: 0!important;
filter: alpha(opacity=0);
cursor: default;
z-index: -1;
}
.flex-pauseplay a {
display: block;
width: 20px;
height: 20px;
position: absolute;
bottom: 5px;
left: 10px;
opacity: 0.8;
z-index: 10;
overflow: hidden;
cursor: pointer;
color: #000;
}
.flex-pauseplay a:before {
font-family: "flexslider-icon";
font-size: 20px;
display: inline-block;
content: '\f004';
}
.flex-pauseplay a:hover {
opacity: 1;
}
.flex-pauseplay a.flex-play:before {
content: '\f003';
}
.flex-control-nav {
width: 100%;
position: absolute;
bottom: -40px;
text-align: center;
}
.flex-control-nav li {
margin: 0 6px;
display: inline-block;
zoom: 1;
*display: inline;
}
.flex-control-paging li a {
width: 11px;
height: 11px;
display: block;
background: #666;
background: rgba(0, 0, 0, 0.5);
cursor: pointer;
text-indent: -9999px;
-webkit-box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.3);
-moz-box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.3);
-o-box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.3);
box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.3);
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
}
.flex-control-paging li a:hover {
background: #333;
background: rgba(0, 0, 0, 0.7);
}
.flex-control-paging li a.flex-active {
background: #000;
background: rgba(0, 0, 0, 0.9);
cursor: default;
}
.flex-control-thumbs {
margin: 5px 0 0;
position: static;
overflow: hidden;
}
.flex-control-thumbs li {
width: 25%;
float: left;
margin: 0;
}
.flex-control-thumbs img {
width: 100%;
height: auto;
display: block;
opacity: .7;
cursor: pointer;
-moz-user-select: none;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
.flex-control-thumbs img:hover {
opacity: 1;
}
.flex-control-thumbs .flex-active {
opacity: 1;
cursor: default;
}
/* ====================================================================================================================
* RESPONSIVE
* ====================================================================================================================*/
@media screen and (max-width: 860px) {
.flex-direction-nav .flex-prev {
opacity: 1;
left: 10px;
}
.flex-direction-nav .flex-next {
opacity: 1;
right: 10px;
}
}
+18
View File
@@ -0,0 +1,18 @@
/*
* jQuery FlexSlider v2.7.2
* https://www.woocommerce.com/flexslider/
*
* Copyright 2012 WooThemes
* Free to use under the GPLv2 and later license.
* http://www.gnu.org/licenses/gpl-2.0.html
*
* Contributing author: Tyler Smith (@mbmufffin)
*
*/
@import "css/variables.less";
@import "css/mixins.less";
@import "css/font.less";
@import "css/resets.less";
@import "css/base.less";
@import "css/theme.less";
@import "css/responsive.less";
Binary file not shown.
@@ -0,0 +1,19 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>
This is a custom SVG font generated by IcoMoon.
<iconset grid="14"></iconset>
</metadata>
<defs>
<font id="flexslider-icon" horiz-adv-x="448" >
<font-face units-per-em="448" ascent="384" descent="-64" />
<missing-glyph horiz-adv-x="448" />
<glyph unicode="&#xf001;" d="M 185.50-9.25l-163.00,162.75q-9.25,9.25 -9.25,22.625t 9.25,22.625l 163.00,162.75q 9.25,9.25 22.625,9.25t 22.625-9.25l 18.75-18.75q 9.25-9.25 9.25-22.625t-9.25-22.625l-121.50-121.50l 121.50-121.25q 9.25-9.50 9.25-22.75t-9.25-22.50l-18.75-18.75q-9.25-9.25 -22.625-9.25t-22.625,9.25z" horiz-adv-x="288" />
<glyph unicode="&#xf002;" d="M 274.75,176.00q0.00-13.00 -9.25-22.75l-163.00-162.75q-9.25-9.25 -22.50-9.25t-22.50,9.25l-19.00,18.75q-9.25,9.75 -9.25,22.75q0.00,13.25 9.25,22.50l 121.50,121.50l-121.50,121.25q-9.25,9.75 -9.25,22.75q0.00,13.25 9.25,22.50l 19.00,18.75q 9.00,9.50 22.50,9.50t 22.50-9.50l 163.00-162.75q 9.25-9.25 9.25-22.50z" horiz-adv-x="288" />
<glyph unicode="&#xf003;" d="M 346.00,152.25l-332.00-184.50q-5.75-3.25 -9.875-0.75t-4.125,9.00l0.00,368.00 q0.00,6.50 4.125,9.00t 9.875-0.75l 332.00-184.50q 5.75-3.25 5.75-7.75t-5.75-7.75z" horiz-adv-x="352" />
<glyph unicode="&#xf004;" d="M 384.00,336.00l0.00-352.00 q0.00-6.50 -4.75-11.25t-11.25-4.75l-128.00,0.00 q-6.50,0.00 -11.25,4.75t-4.75,11.25l0.00,352.00 q0.00,6.50 4.75,11.25t 11.25,4.75l 128.00,0.00 q 6.50,0.00 11.25-4.75t 4.75-11.25zM 160.00,336.00l0.00-352.00 q0.00-6.50 -4.75-11.25t-11.25-4.75l-128.00,0.00 q-6.50,0.00 -11.25,4.75t-4.75,11.25l0.00,352.00 q0.00,6.50 4.75,11.25t 11.25,4.75l 128.00,0.00 q 6.50,0.00 11.25-4.75t 4.75-11.25z" horiz-adv-x="384" />
<glyph unicode="&#xf005;" d="M 402.75,208.00q0.00-13.25 -9.25-22.50l-162.75-162.75q-9.50-9.50 -22.75-9.50q-13.50,0.00 -22.50,9.50l-162.75,162.75q-9.50,9.00 -9.50,22.50q0.00,13.25 9.50,22.75l 18.50,18.75q 9.75,9.25 22.75,9.25q 13.25,0.00 22.50-9.25l 121.50-121.50l 121.50,121.50q 9.25,9.25 22.50,9.25q 13.00,0.00 22.75-9.25l 18.75-18.75q 9.25-9.75 9.25-22.75z" horiz-adv-x="416" />
<glyph unicode="&#x20;" horiz-adv-x="224" />
<glyph class="hidden" unicode="&#xf000;" d="M0,384L 448 -64L0 -64 z" horiz-adv-x="0" />
</font></defs></svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+29
View File
@@ -0,0 +1,29 @@
{
"name": "flexslider",
"version": "2.7.2",
"description": "An awesome, fully responsive jQuery slider toolkit.",
"main": "jquery.flexslider.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/woothemes/FlexSlider.git"
},
"keywords": [
"flexslider",
"jquery",
"slider",
"woocommerce",
"automattic"
],
"author": "Automattic <jeff@woothemes.com>",
"license": "GPL-2.0",
"bugs": {
"url": "https://github.com/woocommerce/FlexSlider/issues"
},
"homepage": "https://github.com/woocommerce/FlexSlider#readme",
"dependencies": {
"jquery": ">=1.11.3"
}
}
+375
View File
@@ -0,0 +1,375 @@
Lazy is dual-licensed under MIT and GPL-2.0 license. Please choose one of them, both are listed below.
---------------------------------
MIT License
Copyright (c) 2017 Daniel 'Eisbehr' Kern, eisbehr.de
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.
---------------------------------
GPL-2.0 License
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{description}
Copyright (C) {year} {fullname}
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
+264
View File
@@ -0,0 +1,264 @@
### jQuery & Zepto Lazy - Delayed Content, Image and Background Loader
[![GitHub version](https://badge.fury.io/gh/dkern%2Fjquery.lazy.svg)](http://github.com/dkern/jquery.lazy)
[![NPM version](https://badge.fury.io/js/jquery-lazy.svg)](http://www.npmjs.org/package/jquery-lazy)
[![Bower version](https://badge.fury.io/bo/jquery-lazy.svg)](http://bower.io/search/?q=jquery-lazy)
[![Dependencies Status](https://david-dm.org/dkern/jquery.lazy/status.svg)](https://david-dm.org/dkern/jquery.lazy)
[![devDependencies Status](https://david-dm.org/dkern/jquery.lazy/dev-status.svg)](https://david-dm.org/dkern/jquery.lazy?type=dev)
---
[![JetBrains & PhpStorm](http://jquery.eisbehr.de/lazy/images/git_logo_jb_ps.png)](https://jetbrains.com/phpstorm)
_This project is friendly supported by [JetBrains](https://jetbrains.com) & [PhpStorm](https://jetbrains.com/phpstorm)!_
---
### Table of Contents
* [About Lazy](#about-lazy)
* [Compatibility](#compatibility)
* [Documentation / Examples](#documentation--examples)
* [Installation](#installation)
* [CDN](#cdn)
* [Self-Hosted](#self-hosted)
* [Package Managers](#package-managers)
* [Basic Usage](#basic-usage)
* [Callbacks / Events](#callbacks--events)
* [Instances and public Functions](#instances-and-public-functions)
* [Custom Content Loaders](#custom-content-loaders)
* [Loader Plugins](#loader-plugins)
* [Configuration Parameters](#configuration-parameters)
* [Build and Validation](#build-and-validation)
* [Available gulp Tasks](#available-gulp-tasks)
* [Bugs / Feature request](#bugs--feature-request)
* [License](#license)
* [Donation](#donation)
---
## About Lazy
Lazy is a fast, feature-rich and lightweight delayed content loading plugin for jQuery and Zepto.
It's designed to speed up page loading times and decrease traffic to your users by only loading the content in view.
You can use Lazy in all vertical and horizontal scroll ways.
It supports images in `<img />` tags and backgrounds, supplied with css like `background-image`, by default.
On those elements Lazy can set an default image or a placeholder while loading and supports retina displays as well.
But Lazy is even able to load any other content you want by [plugins](#loader-plugins) and [custom loaders](#custom-content-loaders).
## Compatibility
Lazy will work with a wide range of browsers and support jQuery versions for years backwards and Zepto as alternative.
You can pick any version since jQuery 1.7.2 or Zepto 1.1.6 or greater.
There is no way to guarantee, that Lazy will work with all browsers, but all I've tested worked great so far.
If you find any problems in specific browsers, [please let me know](http://github.com/dkern/jquery.lazy/issues).
**Tested in:** IE, Chrome (+ mobile), Firefox (+ mobile), Safari (+ mobile) and Android Browser.
## Documentation / Examples
For [documentation](http://jquery.eisbehr.de/lazy/#parameter), [examples](http://jquery.eisbehr.de/lazy/#examples) and other information take a look on the [project page](http://jquery.eisbehr.de/lazy/).
## Installation
First of all, you will need a copy of [jQuery](http://jquery.com) or [Zepto](http://zeptojs.com) to use Lazy successfully on your project.
If you get this you can install Lazy by different ways.
Some examples below:
#### CDN
Lazy and all plugins are available over [cdnjs](http://cdnjs.com) and [jsDelivr](http://jsdelivr.com) CDN and can directly included to every page.
```HTML
<!-- jsDeliver -->
<script type="text/javascript" src="//cdn.jsdelivr.net/gh/dkern/jquery.lazy@1.7.10/jquery.lazy.min.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/gh/dkern/jquery.lazy@1.7.10/jquery.lazy.plugins.min.js"></script>
<!-- cdnjs -->
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.10/jquery.lazy.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.10/jquery.lazy.plugins.min.js"></script>
```
#### Self-Hosted
[Download](https://github.com/dkern/jquery.lazy/archive/master.zip) and save one of two available files to include Lazy to your page, either the [development](http://raw.githubusercontent.com/dkern/jquery.lazy/master/jquery.lazy.js) or the [minified](http://raw.githubusercontent.com/dkern/jquery.lazy/master/jquery.lazy.min.js) version.
```HTML
<script type="text/javascript" src="jquery.lazy.min.js"></script>
```
#### Package Managers
Lazy is even available through [NPM](http://npmjs.org) and [Bower](http://bower.io).
Just use one of the following commands below:
[![NPM](https://nodei.co/npm/jquery-lazy.png?compact=true)](https://nodei.co/npm/jquery-lazy/)
```sh
$ npm install jquery-lazy
$ bower install jquery-lazy
```
## Basic Usage
1.) The basic usage of Lazy is pretty easy.
First of all you need to prepare all elements you want to lazy load.
By default add a `data-src` attribute to images containing the loadable image and/or a `data-loader` attribute to elements witch shall use a [plugin](#loader-plugins) or [custom loaders](#custom-content-loaders).
```HTML
<img class="lazy" data-src="path/to/image_to_load.jpg" src="" />
```
2.) Start using Lazy by calling it after page load.
You don't have to specify your elements exactly, but for better performance, or different options, load your elements over unique classes or any other selector.
```JS
$(function($) {
$("img.lazy").Lazy();
});
```
Take a look at the [documentation](http://jquery.eisbehr.de/lazy/) to get an idea what Lazy is capable of.
## Callbacks / Events
Lazy comes with a bunch of [callbacks and events](http://jquery.eisbehr.de/lazy/index.php?c=callback) you can assign to.
Just add them by initialization settings:
* `beforeLoad` - before item is about to be loaded
* `afterLoad` - after the item was loaded successfully
* `onError` - whenever an item could not be loaded
* `onFinishedAll` - after all items in instance was loaded or returned an error
## Instances and public Functions
Lazy supports multiple parallel instances.
Just initialize them with different selectors.
To access an instances public functions you can initialize them in an object oriented manner or grab the instance bind to every element by default:
```JS
// object oriented way
var instance = $("img.lazy").Lazy({chainable: false});
// grab from elements (only works well if you use same selectors)
$("img.lazy").Lazy();
var instance = $("img.lazy").data("plugin_lazy");
```
Every instance has some public available functions to control it's behavior.
There are currently six available:
```JS
instance.config(entryName[, newValue]); // get or set an configuration entry
instance.addItems(items); // add new items to current instance
instance.getItems(); // get all unhandled items left of current instance
instance.update([useThrottle]); // loads all elements in current viewport
instance.force(items); // force loading specific items, ignoring the viewport
instance.loadAll(); // loads all remaining available elements from this instance
instance.destroy(); // unbinds all events and stop execution directly
```
## Custom Content Loaders
With the custom loaders option there is a powerful solution to load every contents the Lazy way.
Lazy will handle everything, you just create a loading method witch got triggered whenever the element hits the visibility threshold.
It is still possible to load images and custom loaders in the same Lazy instance.
To use this just define a loader function inside the Lazy initialisation and pass the loader name to the `data-loader` attribute of the elements witch should be lazy loaded.
```HTML
<div class="lazy" data-loader="customLoaderName"></div>
<img class="lazy" data-src="path/to/image_to_load.jpg" src="" />
<div class="lazy" data-loader="customLoaderName"></div>
<div class="lazy" data-loader="asyncLoader"></div>
```
```JS
$(".lazy").Lazy({
// callback
beforeLoad: function(element) {
console.log("start loading " + element.prop("tagName"));
},
// custom loaders
customLoaderName: function(element) {
element.html("element handled by custom loader");
element.load();
},
asyncLoader: function(element, response) {
setTimeout(function() {
element.html("element handled by async loader");
response(true);
}, 1000);
}
});
```
## Loader Plugins
The loader plugins can extend the functionality of Lazy, like loading other elements and data.
It is basically the same as the [custom content loaders](#custom-content-loaders), with the difference, that plugins can extend all further instances globally at once permanently and let them handle specific elements like `<video>` by default, without `data-loader` attribute set.
With custom content loaders you have to initialize each instance on setup with the loader.
With plugins you only load the plugin file and you're done for all instances from now on.
For more information and examples, take a look at the [existing plugins](https://github.com/dkern/jquery.lazy/tree/master/plugins) or the [readme.md](https://github.com/dkern/jquery.lazy/tree/master/plugins/README.md) in there.
## Configuration Parameters
The following configurations is available by default:
Name | Type | Default | Description
------------------ | ---------- | ------------------ | -----------
name | *string* | *'lazy'* | Internal name, used for namespaces and bindings.
chainable | *boolean* | *true* | By default Lazy is chainable and will return all elements. If set to `false` Lazy will return the created plugin instance itself for further use.
autoDestroy | *boolean* | *true* | Will automatically destroy the instance when no further elements are available to handle.
bind | *string* | *'load'* | If set to `load`' Lazy starts working directly after page load. If you want to use Lazy on own events set it to `event`'.
threshold | *integer* | *500* | Amount of pixels below the viewport, in which all images gets loaded before the user sees them.
visibleOnly | *boolean* | *false* | Determine if only visible elements should be load.
appendScroll | *integer* | *window* | An element to listen on for scroll events, useful when images are stored in a container.
scrollDirection | *string* | *'both'* | Determines the handles scroll direction. Possible values are `both`, `vertical` and `horizontal`.
imageBase | *string* | *null* | If defined this will be used as base path for all images loaded by this instance.
defaultImage | *string* | *blank image* | Base64 image string, set as default image source for every image without a predefined source attribute.
placeholder | *string* | *null* | Base64 image string, set a background on every element as loading placeholder.
delay | *integer* | *-1* | If you want to load all elements at once after page load, then you can specify a delay time in milliseconds.
combined | *boolean* | *false* | With this parameter, Lazy will combine the event driven and delayed element loading.
**attributes** | | |
attribute | *string* | *'data-src'* | Name of the image tag `src` attribute, where the image path is stored.
srcsetAttribute | *string* | *'data-srcset'* | Name of the image tag `srcset` attribute, where the source set is stored.
sizesAttribute | *string* | *'data-sizes'* | Name of the image tag `sizes` attribute, where the size definition for source set is stored.
retinaAttribute | *string* | *'data-retina'* | Name of the image tag attribute, where the path for optional retina image is stored.
loaderAttribute | *string* | *'data-loader'* | Name or the element attribute, where the identifier of the plugin or customer loader is sored.
imageBaseAttribute | *string* | *'data-imagebase'* | Name ot the image tag element, where the specific image base is stored. This will overwrite the global `imageBase` config.
removeAttribute | *boolean* | *true* | Determine if the attribute should be removed from the element after loading.
handledName | *string* | *'handled'* | Name of the element tag data attribute, to determine if element is already handled.
loadedName | *string* | *'loaded'* | Name of the element tag data attribute, to determine if element is already loaded.
**effect** | | |
effect | *string* | *'show'* | Function name of the effect you want to use to show the loaded images, like `show` or `fadeIn`.
effectTime | *integer* | *0* | Time in milliseconds the effect should use to view the image.
**throttle** | | |
enableThrottle | *boolean* | *true* | Throttle down the loading calls on scrolling event.
throttle | *integer* | *250* | Time in milliseconds the throttle will use to limit the loading calls.
**callbacks** | | |
beforeLoad | *function* | *undefined* | Callback function, which will be called before the element gets loaded. Has current element and response function as parameters. `this` is the current Lazy instance.
afterLoad | *function* | *undefined* | Callback function, which will be called after the element was loaded. Has current element and response function as parameters. `this` is the current Lazy instance.
onError | *function* | *undefined* | Callback function, which will be called if the element could not be loaded. Has current element and response function as parameters. `this` is the current Lazy instance.
onFinishedAll | *function* | *undefined* | Callback function, which will be called after all elements was loaded or returned an error. The callback has no parameters. `this` is the current Lazy instance.
## Build and Validation
This project includes an automated build script using `gulp`.
To build your own versions of Lazy you need to [install it](#package-managers) via [npm](https://www.npmjs.com/package/jquery-lazy) first.
Afterwards you can use the following command in your console to automatically generate all productive files.
While building these files everything will be checked with `jshint` for validity too.
```sh
$ gulp build
```
### Available `gulp` Tasks:
Name | Description
-------------- | -----------
build | check & build everything
build-main | check & build main project file
build-plugins | check & build single plugin files
concat-plugins | build concatenated plugins file
validate | check all files with `jshint`
watch | watches all files to check & build everything on change
## Bugs / Feature request
Please [report](http://github.com/dkern/jquery.lazy/issues) bugs and feel free to [ask](http://github.com/dkern/jquery.lazy/issues) for new features directly on GitHub.
## License
Lazy is dual-licensed under [MIT](http://www.opensource.org/licenses/mit-license.php) and [GPL-2.0](http://www.gnu.org/licenses/gpl-2.0.html) license.
## Donation
_You like to support me?_
_You appreciate my work?_
_You use it in commercial projects?_
Feel free to make a little [donation](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FFL6VQJCUZMXC)! :wink:
+48
View File
@@ -0,0 +1,48 @@
{
"name": "jquery-lazy",
"description": "Lazy is a fast, feature-rich and lightweight delayed content loading plugin for jQuery and Zepto. It's designed to speed up page loading times and decrease traffic to your users by only loading the content in view. You can use Lazy in all vertical and horizontal scroll ways. It supports images in 'img' tags and backgrounds, supplied with css like 'background-image', by default. On those elements Lazy can set an default image or a placeholder while loading and supports retina displays as well. But Lazy is even able to load any other content you want by plugins and custom loaders.",
"version": "1.7.11",
"main": "jquery.lazy.min.js",
"license": [
"MIT",
"GPL-2.0"
],
"ignore": [
"*.md",
"*.json"
],
"keywords": [
"lazy",
"lazyload",
"load",
"loader",
"image",
"images",
"background",
"content",
"speed",
"delay",
"delayed",
"pageload",
"performance",
"retina",
"placeholder",
"jquery",
"jquery-plugin",
"zepto",
"zepto-plugin"
],
"authors": [{
"name": "Daniel 'Eisbehr' Kern",
"email": "jquery@eisbehr.de",
"homepage": "http://www.eisbehr.de/"
}],
"homepage": "http://jquery.eisbehr.de/lazy/",
"repository": {
"type": "git",
"url": "git://github.com/dkern/jquery.lazy.git"
},
"dependencies": {
"jquery": ">=1.7.2"
}
}
+150
View File
@@ -0,0 +1,150 @@
"use strict";
var gulp = require("gulp");
var util = require("gulp-util");
var data = require("gulp-data");
var noop = require("gulp-noop");
var rename = require("gulp-rename");
var header = require("gulp-header");
var jshint = require("gulp-jshint");
var uglify = require("gulp-uglify");
var concat = require("gulp-concat-util");
var pkg = require("./package.json");
var nl = require("os").EOL;
/*
** CONFIG & PATHS
*/
var config = {
header : "/*! jQuery & Zepto Lazy <%= info %> - <%= pkg.homepage %> - MIT&GPL-2.0 license - Copyright 2012-<%= year %> <%= pkg.author.name %> */",
main : pkg.main,
plugins : [
"plugins/jquery.lazy.*.js",
"!plugins/jquery.lazy.*.min.js"
]
};
/*
** PIPES
*/
var pipes = {};
// check files with jshint
pipes.validateFiles = function(files) {
return gulp.src(files, {base: "./"})
.pipe(jshint())
.pipe(jshint.reporter("jshint-stylish"));
};
// check all files
pipes.validate = function() {
return pipes.validateFiles([config.main].concat(config.plugins));
};
// build main project file
pipes.buildMain = function() {
return pipes.validateFiles(config.main)
.pipe(uglify())
.pipe(header(config.header + nl, {
pkg : pkg,
info : "v" + pkg.version,
year : new Date().getFullYear()
}))
.pipe(rename(function(path) {
path.extname = ".min" + path.extname;
}))
.pipe(gulp.dest("./"));
};
// build plugin files
pipes.buildPlugins = function() {
return pipes.validateFiles(config.plugins)
.pipe(data(function(file) {
var string = String(file.contents).split("\n")[1];
var matches = string.match(/\s-\s([a-z ]+)\s-\sv([0-9.]+)/i);
return {
info: "- " + matches[1] + " v" + matches[2]
};
}))
.pipe(uglify())
.pipe(header(config.header + nl, {
pkg : pkg,
year : new Date().getFullYear()
}))
.pipe(rename(function(path) {
path.extname = ".min" + path.extname;
}))
.pipe(gulp.dest("./"));
};
// concat plugin files
pipes.concatPlugins = function() {
return gulp.src(config.plugins)
.pipe(concat(config.main.replace(".js", ".plugins.js"), {
sep: nl + nl
}))
.pipe(gulp.dest("./"))
.pipe(uglify())
.pipe(header(config.header + nl, {
pkg : pkg,
info : "- All Plugins v" + pkg.version,
year : new Date().getFullYear()
}))
.pipe(rename(function(path) {
path.extname = ".min" + path.extname;
}))
.pipe(gulp.dest("./"));
};
/*
** TASKS
*/
// check & build everything
gulp.task("build", ["build-main", "build-plugins", "concat-plugins"]);
// check & build main project file
gulp.task("build-main", pipes.buildMain);
// check & build single plugin files
gulp.task("build-plugins", pipes.buildPlugins);
// build concatenated plugins file
gulp.task("concat-plugins", pipes.concatPlugins);
// check all files
gulp.task("validate", pipes.validate);
// check, build & watch live changes
gulp.task("watch", ["build"], function() {
// watch main file
gulp.watch(config.main, function() {
var task = pipes.buildMain();
util.log("updated", "'" + util.colors.red("main file") + "'");
return task;
});
// watch plugins
gulp.watch(config.plugins, function() {
var task = pipes.buildPlugins();
util.log("updated", "'" + util.colors.red("plugins") + "'");
pipes.concatPlugins();
util.log("updated", "'" + util.colors.red("concatenated plugins file") + "'");
return task;
});
});
+884
View File
@@ -0,0 +1,884 @@
/*!
* jQuery & Zepto Lazy - v1.7.10
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*
* $("img.lazy").lazy();
*/
;(function(window, undefined) {
"use strict";
// noinspection JSUnresolvedVariable
/**
* library instance - here and not in construct to be shorter in minimization
* @return void
*/
var $ = window.jQuery || window.Zepto,
/**
* unique plugin instance id counter
* @type {number}
*/
lazyInstanceId = 0,
/**
* helper to register window load for jQuery 3
* @type {boolean}
*/
windowLoaded = false;
/**
* make lazy available to jquery - and make it a bit more case-insensitive :)
* @access public
* @type {function}
* @param {object} settings
* @return {LazyPlugin}
*/
$.fn.Lazy = $.fn.lazy = function(settings) {
return new LazyPlugin(this, settings);
};
/**
* helper to add plugins to lazy prototype configuration
* @access public
* @type {function}
* @param {string|Array} names
* @param {string|Array|function} [elements]
* @param {function} loader
* @return void
*/
$.Lazy = $.lazy = function(names, elements, loader) {
// make second parameter optional
if ($.isFunction(elements)) {
loader = elements;
elements = [];
}
// exit here if parameter is not a callable function
if (!$.isFunction(loader)) {
return;
}
// make parameters an array of names to be sure
names = $.isArray(names) ? names : [names];
elements = $.isArray(elements) ? elements : [elements];
var config = LazyPlugin.prototype.config,
forced = config._f || (config._f = {});
// add the loader plugin for every name
for (var i = 0, l = names.length; i < l; i++) {
if (config[names[i]] === undefined || $.isFunction(config[names[i]])) {
config[names[i]] = loader;
}
}
// add forced elements loader
for (var c = 0, a = elements.length; c < a; c++) {
forced[elements[c]] = names[0];
}
};
/**
* contains all logic and the whole element handling
* is packed in a private function outside class to reduce memory usage, because it will not be created on every plugin instance
* @access private
* @type {function}
* @param {LazyPlugin} instance
* @param {object} config
* @param {object|Array} items
* @param {object} events
* @param {string} namespace
* @return void
*/
function _executeLazy(instance, config, items, events, namespace) {
/**
* a helper to trigger the 'onFinishedAll' callback after all other events
* @access private
* @type {number}
*/
var _awaitingAfterLoad = 0,
/**
* visible content width
* @access private
* @type {number}
*/
_actualWidth = -1,
/**
* visible content height
* @access private
* @type {number}
*/
_actualHeight = -1,
/**
* determine possibly detected high pixel density
* @access private
* @type {boolean}
*/
_isRetinaDisplay = false,
/**
* dictionary entry for better minimization
* @access private
* @type {string}
*/
_afterLoad = 'afterLoad',
/**
* dictionary entry for better minimization
* @access private
* @type {string}
*/
_load = 'load',
/**
* dictionary entry for better minimization
* @access private
* @type {string}
*/
_error = 'error',
/**
* dictionary entry for better minimization
* @access private
* @type {string}
*/
_img = 'img',
/**
* dictionary entry for better minimization
* @access private
* @type {string}
*/
_src = 'src',
/**
* dictionary entry for better minimization
* @access private
* @type {string}
*/
_srcset = 'srcset',
/**
* dictionary entry for better minimization
* @access private
* @type {string}
*/
_sizes = 'sizes',
/**
* dictionary entry for better minimization
* @access private
* @type {string}
*/
_backgroundImage = 'background-image';
/**
* initialize plugin
* bind loading to events or set delay time to load all items at once
* @access private
* @return void
*/
function _initialize() {
// detect actual device pixel ratio
// noinspection JSUnresolvedVariable
_isRetinaDisplay = window.devicePixelRatio > 1;
// prepare all initial items
items = _prepareItems(items);
// if delay time is set load all items at once after delay time
if (config.delay >= 0) {
setTimeout(function() {
_lazyLoadItems(true);
}, config.delay);
}
// if no delay is set or combine usage is active bind events
if (config.delay < 0 || config.combined) {
// create unique event function
events.e = _throttle(config.throttle, function(event) {
// reset detected window size on resize event
if (event.type === 'resize') {
_actualWidth = _actualHeight = -1;
}
// execute 'lazy magic'
_lazyLoadItems(event.all);
});
// create function to add new items to instance
events.a = function(additionalItems) {
additionalItems = _prepareItems(additionalItems);
items.push.apply(items, additionalItems);
};
// create function to get all instance items left
events.g = function() {
// filter loaded items before return in case internal filter was not running until now
return (items = $(items).filter(function() {
return !$(this).data(config.loadedName);
}));
};
// create function to force loading elements
events.f = function(forcedItems) {
for (var i = 0; i < forcedItems.length; i++) {
// only handle item if available in current instance
// use a compare function, because Zepto can't handle object parameter for filter
// var item = items.filter(forcedItems[i]);
/* jshint loopfunc: true */
var item = items.filter(function() {
return this === forcedItems[i];
});
if (item.length) {
_lazyLoadItems(false, item);
}
}
};
// load initial items
_lazyLoadItems();
// bind lazy load functions to scroll and resize event
// noinspection JSUnresolvedVariable
$(config.appendScroll).on('scroll.' + namespace + ' resize.' + namespace, events.e);
}
}
/**
* prepare items before handle them
* @access private
* @param {Array|object|jQuery} items
* @return {Array|object|jQuery}
*/
function _prepareItems(items) {
// fetch used configurations before loops
var defaultImage = config.defaultImage,
placeholder = config.placeholder,
imageBase = config.imageBase,
srcsetAttribute = config.srcsetAttribute,
loaderAttribute = config.loaderAttribute,
forcedTags = config._f || {};
// filter items and only add those who not handled yet and got needed attributes available
items = $(items).filter(function() {
var element = $(this),
tag = _getElementTagName(this);
return !element.data(config.handledName) &&
(element.attr(config.attribute) || element.attr(srcsetAttribute) || element.attr(loaderAttribute) || forcedTags[tag] !== undefined);
})
// append plugin instance to all elements
.data('plugin_' + config.name, instance);
for (var i = 0, l = items.length; i < l; i++) {
var element = $(items[i]),
tag = _getElementTagName(items[i]),
elementImageBase = element.attr(config.imageBaseAttribute) || imageBase;
// generate and update source set if an image base is set
if (tag === _img && elementImageBase && element.attr(srcsetAttribute)) {
element.attr(srcsetAttribute, _getCorrectedSrcSet(element.attr(srcsetAttribute), elementImageBase));
}
// add loader to forced element types
if (forcedTags[tag] !== undefined && !element.attr(loaderAttribute)) {
element.attr(loaderAttribute, forcedTags[tag]);
}
// set default image on every element without source
if (tag === _img && defaultImage && !element.attr(_src)) {
element.attr(_src, defaultImage);
}
// set placeholder on every element without background image
else if (tag !== _img && placeholder && (!element.css(_backgroundImage) || element.css(_backgroundImage) === 'none')) {
element.css(_backgroundImage, "url('" + placeholder + "')");
}
}
return items;
}
/**
* the 'lazy magic' - check all items
* @access private
* @param {boolean} [allItems]
* @param {object} [forced]
* @return void
*/
function _lazyLoadItems(allItems, forced) {
// skip if no items where left
if (!items.length) {
// destroy instance if option is enabled
if (config.autoDestroy) {
// noinspection JSUnresolvedFunction
instance.destroy();
}
return;
}
var elements = forced || items,
loadTriggered = false,
imageBase = config.imageBase || '',
srcsetAttribute = config.srcsetAttribute,
handledName = config.handledName;
// loop all available items
for (var i = 0; i < elements.length; i++) {
// item is at least in loadable area
if (allItems || forced || _isInLoadableArea(elements[i])) {
var element = $(elements[i]),
tag = _getElementTagName(elements[i]),
attribute = element.attr(config.attribute),
elementImageBase = element.attr(config.imageBaseAttribute) || imageBase,
customLoader = element.attr(config.loaderAttribute);
// is not already handled
if (!element.data(handledName) &&
// and is visible or visibility doesn't matter
(!config.visibleOnly || element.is(':visible')) && (
// and image source or source set attribute is available
(attribute || element.attr(srcsetAttribute)) && (
// and is image tag where attribute is not equal source or source set
(tag === _img && (elementImageBase + attribute !== element.attr(_src) || element.attr(srcsetAttribute) !== element.attr(_srcset))) ||
// or is non image tag where attribute is not equal background
(tag !== _img && elementImageBase + attribute !== element.css(_backgroundImage))
) ||
// or custom loader is available
customLoader))
{
// mark element always as handled as this point to prevent double handling
loadTriggered = true;
element.data(handledName, true);
// load item
_handleItem(element, tag, elementImageBase, customLoader);
}
}
}
// when something was loaded remove them from remaining items
if (loadTriggered) {
items = $(items).filter(function() {
return !$(this).data(handledName);
});
}
}
/**
* load the given element the lazy way
* @access private
* @param {object} element
* @param {string} tag
* @param {string} imageBase
* @param {function} [customLoader]
* @return void
*/
function _handleItem(element, tag, imageBase, customLoader) {
// increment count of items waiting for after load
++_awaitingAfterLoad;
// extended error callback for correct 'onFinishedAll' handling
var errorCallback = function() {
_triggerCallback('onError', element);
_reduceAwaiting();
// prevent further callback calls
errorCallback = $.noop;
};
// trigger function before loading image
_triggerCallback('beforeLoad', element);
// fetch all double used data here for better code minimization
var srcAttribute = config.attribute,
srcsetAttribute = config.srcsetAttribute,
sizesAttribute = config.sizesAttribute,
retinaAttribute = config.retinaAttribute,
removeAttribute = config.removeAttribute,
loadedName = config.loadedName,
elementRetina = element.attr(retinaAttribute);
// handle custom loader
if (customLoader) {
// on load callback
var loadCallback = function() {
// remove attribute from element
if (removeAttribute) {
element.removeAttr(config.loaderAttribute);
}
// mark element as loaded
element.data(loadedName, true);
// call after load event
_triggerCallback(_afterLoad, element);
// remove item from waiting queue and possibly trigger finished event
// it's needed to be asynchronous to run after filter was in _lazyLoadItems
setTimeout(_reduceAwaiting, 1);
// prevent further callback calls
loadCallback = $.noop;
};
// bind error event to trigger callback and reduce waiting amount
element.off(_error).one(_error, errorCallback)
// bind after load callback to element
.one(_load, loadCallback);
// trigger custom loader and handle response
if (!_triggerCallback(customLoader, element, function(response) {
if(response) {
element.off(_load);
loadCallback();
}
else {
element.off(_error);
errorCallback();
}
})) {
element.trigger(_error);
}
}
// handle images
else {
// create image object
var imageObj = $(new Image());
// bind error event to trigger callback and reduce waiting amount
imageObj.one(_error, errorCallback)
// bind after load callback to image
.one(_load, function() {
// remove element from view
element.hide();
// set image back to element
// do it as single 'attr' calls, to be sure 'src' is set after 'srcset'
if (tag === _img) {
element.attr(_sizes, imageObj.attr(_sizes))
.attr(_srcset, imageObj.attr(_srcset))
.attr(_src, imageObj.attr(_src));
}
else {
element.css(_backgroundImage, "url('" + imageObj.attr(_src) + "')");
}
// bring it back with some effect!
element[config.effect](config.effectTime);
// remove attribute from element
if (removeAttribute) {
element.removeAttr(srcAttribute + ' ' + srcsetAttribute + ' ' + retinaAttribute + ' ' + config.imageBaseAttribute);
// only remove 'sizes' attribute, if it was a custom one
if (sizesAttribute !== _sizes) {
element.removeAttr(sizesAttribute);
}
}
// mark element as loaded
element.data(loadedName, true);
// call after load event
_triggerCallback(_afterLoad, element);
// cleanup image object
imageObj.remove();
// remove item from waiting queue and possibly trigger finished event
_reduceAwaiting();
});
// set sources
// do it as single 'attr' calls, to be sure 'src' is set after 'srcset'
var imageSrc = (_isRetinaDisplay && elementRetina ? elementRetina : element.attr(srcAttribute)) || '';
imageObj.attr(_sizes, element.attr(sizesAttribute))
.attr(_srcset, element.attr(srcsetAttribute))
.attr(_src, imageSrc ? imageBase + imageSrc : null);
// call after load even on cached image
imageObj.complete && imageObj.trigger(_load); // jshint ignore : line
}
}
/**
* check if the given element is inside the current viewport or threshold
* @access private
* @param {object} element
* @return {boolean}
*/
function _isInLoadableArea(element) {
var elementBound = element.getBoundingClientRect(),
direction = config.scrollDirection,
threshold = config.threshold,
vertical = // check if element is in loadable area from top
((_getActualHeight() + threshold) > elementBound.top) &&
// check if element is even in loadable are from bottom
(-threshold < elementBound.bottom),
horizontal = // check if element is in loadable area from left
((_getActualWidth() + threshold) > elementBound.left) &&
// check if element is even in loadable area from right
(-threshold < elementBound.right);
if (direction === 'vertical') {
return vertical;
}
else if (direction === 'horizontal') {
return horizontal;
}
return vertical && horizontal;
}
/**
* receive the current viewed width of the browser
* @access private
* @return {number}
*/
function _getActualWidth() {
return _actualWidth >= 0 ? _actualWidth : (_actualWidth = $(window).width());
}
/**
* receive the current viewed height of the browser
* @access private
* @return {number}
*/
function _getActualHeight() {
return _actualHeight >= 0 ? _actualHeight : (_actualHeight = $(window).height());
}
/**
* get lowercase tag name of an element
* @access private
* @param {object} element
* @returns {string}
*/
function _getElementTagName(element) {
return element.tagName.toLowerCase();
}
/**
* prepend image base to all srcset entries
* @access private
* @param {string} srcset
* @param {string} imageBase
* @returns {string}
*/
function _getCorrectedSrcSet(srcset, imageBase) {
if (imageBase) {
// trim, remove unnecessary spaces and split entries
var entries = srcset.split(',');
srcset = '';
for (var i = 0, l = entries.length; i < l; i++) {
srcset += imageBase + entries[i].trim() + (i !== l - 1 ? ',' : '');
}
}
return srcset;
}
/**
* helper function to throttle down event triggering
* @access private
* @param {number} delay
* @param {function} callback
* @return {function}
*/
function _throttle(delay, callback) {
var timeout,
lastExecute = 0;
return function(event, ignoreThrottle) {
var elapsed = +new Date() - lastExecute;
function run() {
lastExecute = +new Date();
// noinspection JSUnresolvedFunction
callback.call(instance, event);
}
timeout && clearTimeout(timeout); // jshint ignore : line
if (elapsed > delay || !config.enableThrottle || ignoreThrottle) {
run();
}
else {
timeout = setTimeout(run, delay - elapsed);
}
};
}
/**
* reduce count of awaiting elements to 'afterLoad' event and fire 'onFinishedAll' if reached zero
* @access private
* @return void
*/
function _reduceAwaiting() {
--_awaitingAfterLoad;
// if no items were left trigger finished event
if (!items.length && !_awaitingAfterLoad) {
_triggerCallback('onFinishedAll');
}
}
/**
* single implementation to handle callbacks, pass element and set 'this' to current instance
* @access private
* @param {string|function} callback
* @param {object} [element]
* @param {*} [args]
* @return {boolean}
*/
function _triggerCallback(callback, element, args) {
if ((callback = config[callback])) {
// jQuery's internal '$(arguments).slice(1)' are causing problems at least on old iPads
// below is shorthand of 'Array.prototype.slice.call(arguments, 1)'
callback.apply(instance, [].slice.call(arguments, 1));
return true;
}
return false;
}
// if event driven or window is already loaded don't wait for page loading
if (config.bind === 'event' || windowLoaded) {
_initialize();
}
// otherwise load initial items and start lazy after page load
else {
// noinspection JSUnresolvedVariable
$(window).on(_load + '.' + namespace, _initialize);
}
}
/**
* lazy plugin class constructor
* @constructor
* @access private
* @param {object} elements
* @param {object} settings
* @return {object|LazyPlugin}
*/
function LazyPlugin(elements, settings) {
/**
* this lazy plugin instance
* @access private
* @type {object|LazyPlugin|LazyPlugin.prototype}
*/
var _instance = this,
/**
* this lazy plugin instance configuration
* @access private
* @type {object}
*/
_config = $.extend({}, _instance.config, settings),
/**
* instance generated event executed on container scroll or resize
* packed in an object to be referenceable and short named because properties will not be minified
* @access private
* @type {object}
*/
_events = {},
/**
* unique namespace for instance related events
* @access private
* @type {string}
*/
_namespace = _config.name + '-' + (++lazyInstanceId);
// noinspection JSUndefinedPropertyAssignment
/**
* wrapper to get or set an entry from plugin instance configuration
* much smaller on minify as direct access
* @access public
* @type {function}
* @param {string} entryName
* @param {*} [value]
* @return {LazyPlugin|*}
*/
_instance.config = function(entryName, value) {
if (value === undefined) {
return _config[entryName];
}
_config[entryName] = value;
return _instance;
};
// noinspection JSUndefinedPropertyAssignment
/**
* add additional items to current instance
* @access public
* @param {Array|object|string} items
* @return {LazyPlugin}
*/
_instance.addItems = function(items) {
_events.a && _events.a($.type(items) === 'string' ? $(items) : items); // jshint ignore : line
return _instance;
};
// noinspection JSUndefinedPropertyAssignment
/**
* get all left items of this instance
* @access public
* @returns {object}
*/
_instance.getItems = function() {
return _events.g ? _events.g() : {};
};
// noinspection JSUndefinedPropertyAssignment
/**
* force lazy to load all items in loadable area right now
* by default without throttle
* @access public
* @type {function}
* @param {boolean} [useThrottle]
* @return {LazyPlugin}
*/
_instance.update = function(useThrottle) {
_events.e && _events.e({}, !useThrottle); // jshint ignore : line
return _instance;
};
// noinspection JSUndefinedPropertyAssignment
/**
* force element(s) to load directly, ignoring the viewport
* @access public
* @param {Array|object|string} items
* @return {LazyPlugin}
*/
_instance.force = function(items) {
_events.f && _events.f($.type(items) === 'string' ? $(items) : items); // jshint ignore : line
return _instance;
};
// noinspection JSUndefinedPropertyAssignment
/**
* force lazy to load all available items right now
* this call ignores throttling
* @access public
* @type {function}
* @return {LazyPlugin}
*/
_instance.loadAll = function() {
_events.e && _events.e({all: true}, true); // jshint ignore : line
return _instance;
};
// noinspection JSUndefinedPropertyAssignment
/**
* destroy this plugin instance
* @access public
* @type {function}
* @return undefined
*/
_instance.destroy = function() {
// unbind instance generated events
// noinspection JSUnresolvedFunction, JSUnresolvedVariable
$(_config.appendScroll).off('.' + _namespace, _events.e);
// noinspection JSUnresolvedVariable
$(window).off('.' + _namespace);
// clear events
_events = {};
return undefined;
};
// start using lazy and return all elements to be chainable or instance for further use
// noinspection JSUnresolvedVariable
_executeLazy(_instance, _config, elements, _events, _namespace);
return _config.chainable ? elements : _instance;
}
/**
* settings and configuration data
* @access public
* @type {object|*}
*/
LazyPlugin.prototype.config = {
// general
name : 'lazy',
chainable : true,
autoDestroy : true,
bind : 'load',
threshold : 500,
visibleOnly : false,
appendScroll : window,
scrollDirection : 'both',
imageBase : null,
defaultImage : 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==',
placeholder : null,
delay : -1,
combined : false,
// attributes
attribute : 'data-src',
srcsetAttribute : 'data-srcset',
sizesAttribute : 'data-sizes',
retinaAttribute : 'data-retina',
loaderAttribute : 'data-loader',
imageBaseAttribute : 'data-imagebase',
removeAttribute : true,
handledName : 'handled',
loadedName : 'loaded',
// effect
effect : 'show',
effectTime : 0,
// throttle
enableThrottle : true,
throttle : 250,
// callbacks
beforeLoad : undefined,
afterLoad : undefined,
onError : undefined,
onFinishedAll : undefined
};
// register window load event globally to prevent not loading elements
// since jQuery 3.X ready state is fully async and may be executed after 'load'
// $(window).on('load', function() {
// windowLoaded = true;
// });
var onloadHandler = function() {
windowLoaded = true;
}
if (/complete|interactive|loaded/.test(document.readyState)) {
onloadHandler();
} else {
if (window.attachEvent) {
window.attachEvent('onload', onloadHandler);
} else {
document.addEventListener("DOMContentLoaded", onloadHandler);
}
}
})(window);
+13
View File
@@ -0,0 +1,13 @@
/*!
* jQuery & Zepto Lazy - v1.7.10
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*
* $("img.lazy").lazy();
*/
!function(t,e){"use strict";var r=t.jQuery||t.Zepto,a=0,n=!1;function i(a,i,o,l,u){var c=0,f=-1,s=-1,d=!1,A="afterLoad",h="load",m="error",g="img",b="src",v="srcset",p="sizes",y="background-image";function z(){var e,n,c,A;d=t.devicePixelRatio>1,o=w(o),i.delay>=0&&setTimeout((function(){B(!0)}),i.delay),(i.delay<0||i.combined)&&(l.e=(e=i.throttle,n=function(t){"resize"===t.type&&(f=s=-1),B(t.all)},A=0,function(t,r){var o=+new Date-A;function l(){A=+new Date,n.call(a,t)}c&&clearTimeout(c),o>e||!i.enableThrottle||r?l():c=setTimeout(l,e-o)}),l.a=function(t){t=w(t),o.push.apply(o,t)},l.g=function(){return o=r(o).filter((function(){return!r(this).data(i.loadedName)}))},l.f=function(t){for(var e=0;e<t.length;e++){var r=o.filter((function(){return this===t[e]}));r.length&&B(!1,r)}},B(),r(i.appendScroll).on("scroll."+u+" resize."+u,l.e))}function w(t){var n=i.defaultImage,o=i.placeholder,l=i.imageBase,u=i.srcsetAttribute,c=i.loaderAttribute,f=i._f||{};t=r(t).filter((function(){var t=r(this),a=E(this);return!t.data(i.handledName)&&(t.attr(i.attribute)||t.attr(u)||t.attr(c)||f[a]!==e)})).data("plugin_"+i.name,a);for(var s=0,d=t.length;s<d;s++){var A=r(t[s]),h=E(t[s]),m=A.attr(i.imageBaseAttribute)||l;h===g&&m&&A.attr(u)&&A.attr(u,T(A.attr(u),m)),f[h]===e||A.attr(c)||A.attr(c,f[h]),h===g&&n&&!A.attr(b)?A.attr(b,n):h===g||!o||A.css(y)&&"none"!==A.css(y)||A.css(y,"url('"+o+"')")}return t}function B(t,e){if(o.length){for(var n=e||o,l=!1,u=i.imageBase||"",c=i.srcsetAttribute,f=i.handledName,s=0;s<n.length;s++)if(t||e||D(n[s])){var d=r(n[s]),A=E(n[s]),h=d.attr(i.attribute),m=d.attr(i.imageBaseAttribute)||u,p=d.attr(i.loaderAttribute);d.data(f)||i.visibleOnly&&!d.is(":visible")||!((h||d.attr(c))&&(A===g&&(m+h!==d.attr(b)||d.attr(c)!==d.attr(v))||A!==g&&m+h!==d.css(y))||p)||(l=!0,d.data(f,!0),L(d,A,m,p))}l&&(o=r(o).filter((function(){return!r(this).data(f)})))}else i.autoDestroy&&a.destroy()}function L(t,e,a,n){++c;var o=function(){N("onError",t),I(),o=r.noop};N("beforeLoad",t);var l=i.attribute,u=i.srcsetAttribute,f=i.sizesAttribute,s=i.retinaAttribute,z=i.removeAttribute,w=i.loadedName,B=t.attr(s);if(n){var L=function(){z&&t.removeAttr(i.loaderAttribute),t.data(w,!0),N(A,t),setTimeout(I,1),L=r.noop};t.off(m).one(m,o).one(h,L),N(n,t,(function(e){e?(t.off(h),L()):(t.off(m),o())}))||t.trigger(m)}else{var D=r(new Image);D.one(m,o).one(h,(function(){t.hide(),e===g?t.attr(p,D.attr(p)).attr(v,D.attr(v)).attr(b,D.attr(b)):t.css(y,"url('"+D.attr(b)+"')"),t[i.effect](i.effectTime),z&&(t.removeAttr(l+" "+u+" "+s+" "+i.imageBaseAttribute),f!==p&&t.removeAttr(f)),t.data(w,!0),N(A,t),D.remove(),I()}));var E=(d&&B?B:t.attr(l))||"";D.attr(p,t.attr(f)).attr(v,t.attr(u)).attr(b,E?a+E:null),D.complete&&D.trigger(h)}}function D(e){var a=e.getBoundingClientRect(),n=i.scrollDirection,o=i.threshold,l=(s>=0?s:s=r(t).height())+o>a.top&&-o<a.bottom,u=(f>=0?f:f=r(t).width())+o>a.left&&-o<a.right;return"vertical"===n?l:("horizontal"===n||l)&&u}function E(t){return t.tagName.toLowerCase()}function T(t,e){if(e){var r=t.split(",");t="";for(var a=0,n=r.length;a<n;a++)t+=e+r[a].trim()+(a!==n-1?",":"")}return t}function I(){--c,o.length||c||N("onFinishedAll")}function N(t,e,r){return!!(t=i[t])&&(t.apply(a,[].slice.call(arguments,1)),!0)}"event"===i.bind||n?z():r(t).on(h+"."+u,z)}function o(n,o){var l=this,u=r.extend({},l.config,o),c={},f=u.name+"-"+ ++a;return l.config=function(t,r){return r===e?u[t]:(u[t]=r,l)},l.addItems=function(t){return c.a&&c.a("string"===r.type(t)?r(t):t),l},l.getItems=function(){return c.g?c.g():{}},l.update=function(t){return c.e&&c.e({},!t),l},l.force=function(t){return c.f&&c.f("string"===r.type(t)?r(t):t),l},l.loadAll=function(){return c.e&&c.e({all:!0},!0),l},l.destroy=function(){return r(u.appendScroll).off("."+f,c.e),r(t).off("."+f),c={},e},i(l,u,n,c,f),u.chainable?n:l}r.fn.Lazy=r.fn.lazy=function(t){return new o(this,t)},r.Lazy=r.lazy=function(t,a,n){if(r.isFunction(a)&&(n=a,a=[]),r.isFunction(n)){t=r.isArray(t)?t:[t],a=r.isArray(a)?a:[a];for(var i=o.prototype.config,l=i._f||(i._f={}),u=0,c=t.length;u<c;u++)(i[t[u]]===e||r.isFunction(i[t[u]]))&&(i[t[u]]=n);for(var f=0,s=a.length;f<s;f++)l[a[f]]=t[0]}},o.prototype.config={name:"lazy",chainable:!0,autoDestroy:!0,bind:"load",threshold:500,visibleOnly:!1,appendScroll:t,scrollDirection:"both",imageBase:null,defaultImage:"data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",placeholder:null,delay:-1,combined:!1,attribute:"data-src",srcsetAttribute:"data-srcset",sizesAttribute:"data-sizes",retinaAttribute:"data-retina",loaderAttribute:"data-loader",imageBaseAttribute:"data-imagebase",removeAttribute:!0,handledName:"handled",loadedName:"loaded",effect:"show",effectTime:0,enableThrottle:!0,throttle:250,beforeLoad:e,afterLoad:e,onError:e,onFinishedAll:e};var l=function(){n=!0};/complete|interactive|loaded/.test(document.readyState)?l():t.attachEvent?t.attachEvent("onload",l):document.addEventListener("DOMContentLoaded",l)}(window);
+633
View File
@@ -0,0 +1,633 @@
/*!
* jQuery & Zepto Lazy - AJAX Plugin - v1.4
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// load data by ajax request and pass them to elements inner html, like:
// <div data-loader="ajax" data-src="url.html" data-method="post" data-type="html"></div>
$.lazy('ajax', function(element, response) {
ajaxRequest(this, element, response, element.attr('data-method'));
});
// load data by ajax get request and pass them to elements inner html, like:
// <div data-loader="get" data-src="url.html" data-type="html"></div>
$.lazy('get', function(element, response) {
ajaxRequest(this, element, response, 'GET');
});
// load data by ajax post request and pass them to elements inner html, like:
// <div data-loader="post" data-src="url.html" data-type="html"></div>
$.lazy('post', function(element, response) {
ajaxRequest(this, element, response, 'POST');
});
// load data by ajax put request and pass them to elements inner html, like:
// <div data-loader="put" data-src="url.html" data-type="html"></div>
$.lazy('put', function(element, response) {
ajaxRequest(this, element, response, 'PUT');
});
/**
* execute ajax request and handle response
* @param {object} instance
* @param {jQuery|object} element
* @param {function} response
* @param {string} [method]
*/
function ajaxRequest(instance, element, response, method) {
method = method ? method.toUpperCase() : 'GET';
var data;
if ((method === 'POST' || method === 'PUT') && instance.config('ajaxCreateData')) {
data = instance.config('ajaxCreateData').apply(instance, [element]);
}
$.ajax({
url: element.attr('data-src'),
type: method === 'POST' || method === 'PUT' ? method : 'GET',
data: data,
dataType: element.attr('data-type') || 'html',
/**
* success callback
* @access private
* @param {*} content
* @return {void}
*/
success: function(content) {
// set responded data to element's inner html
element.html(content);
// use response function for Zepto
response(true);
// remove attributes
if (instance.config('removeAttribute')) {
element.removeAttr('data-src data-method data-type');
}
},
/**
* error callback
* @access private
* @return {void}
*/
error: function() {
// pass error state to lazy
// use response function for Zepto
response(false);
}
});
}
})(window.jQuery || window.Zepto);
/*!
* jQuery & Zepto Lazy - AV Plugin - v1.4
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// loads audio and video tags including tracks by two ways, like:
// <audio>
// <data-src src="audio.ogg" type="video/ogg"></data-src>
// <data-src src="audio.mp3" type="video/mp3"></data-src>
// </audio>
// <video data-poster="poster.jpg">
// <data-src src="video.ogv" type="video/ogv"></data-src>
// <data-src src="video.webm" type="video/webm"></data-src>
// <data-src src="video.mp4" type="video/mp4"></data-src>
// <data-track kind="captions" src="captions.vtt" srclang="en"></data-track>
// <data-track kind="descriptions" src="descriptions.vtt" srclang="en"></data-track>
// <data-track kind="subtitles" src="subtitles.vtt" srclang="de"></data-track>
// </video>
//
// or:
// <audio data-src="audio.ogg|video/ogg,video.mp3|video/mp3"></video>
// <video data-poster="poster.jpg" data-src="video.ogv|video/ogv,video.webm|video/webm,video.mp4|video/mp4">
// <data-track kind="captions" src="captions.vtt" srclang="en"></data-track>
// <data-track kind="descriptions" src="descriptions.vtt" srclang="en"></data-track>
// <data-track kind="subtitles" src="subtitles.vtt" srclang="de"></data-track>
// </video>
$.lazy(['av', 'audio', 'video'], ['audio', 'video'], function(element, response) {
var elementTagName = element[0].tagName.toLowerCase();
if (elementTagName === 'audio' || elementTagName === 'video') {
var srcAttr = 'data-src',
sources = element.find(srcAttr),
tracks = element.find('data-track'),
sourcesInError = 0,
// create on error callback for sources
onError = function() {
if (++sourcesInError === sources.length) {
response(false);
}
},
// create callback to handle a source or track entry
handleSource = function() {
var source = $(this),
type = source[0].tagName.toLowerCase(),
attributes = source.prop('attributes'),
target = $(type === srcAttr ? '<source>' : '<track>');
if (type === srcAttr) {
target.one('error', onError);
}
$.each(attributes, function(index, attribute) {
target.attr(attribute.name, attribute.value);
});
source.replaceWith(target);
};
// create event for successfull load
element.one('loadedmetadata', function() {
response(true);
})
// remove default callbacks to ignore loading poster image
.off('load error')
// load poster image
.attr('poster', element.attr('data-poster'));
// load by child tags
if (sources.length) {
sources.each(handleSource);
}
// load by attribute
else if (element.attr(srcAttr)) {
// split for every entry by comma
$.each(element.attr(srcAttr).split(','), function(index, value) {
// split again for file and file type
var parts = value.split('|');
// create a source entry
element.append($('<source>')
.one('error', onError)
.attr({src: parts[0].trim(), type: parts[1].trim()}));
});
// remove now obsolete attribute
if (this.config('removeAttribute')) {
element.removeAttr(srcAttr);
}
}
else {
// pass error state
// use response function for Zepto
response(false);
}
// load optional tracks
if (tracks.length) {
tracks.each(handleSource);
}
}
else {
// pass error state
// use response function for Zepto
response(false);
}
});
})(window.jQuery || window.Zepto);
/*!
* jQuery & Zepto Lazy - iFrame Plugin - v1.5
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// load iframe content, like:
// <iframe data-src="iframe.html"></iframe>
//
// enable content error check with:
// <iframe data-src="iframe.html" data-error-detect="true"></iframe>
$.lazy(['frame', 'iframe'], 'iframe', function(element, response) {
var instance = this;
if (element[0].tagName.toLowerCase() === 'iframe') {
var srcAttr = 'data-src',
errorDetectAttr = 'data-error-detect',
errorDetect = element.attr(errorDetectAttr);
// default way, just replace the 'src' attribute
if (errorDetect !== 'true' && errorDetect !== '1') {
// set iframe source
element.attr('src', element.attr(srcAttr));
// remove attributes
if (instance.config('removeAttribute')) {
element.removeAttr(srcAttr + ' ' + errorDetectAttr);
}
}
// extended way, even check if the document is available
else {
$.ajax({
url: element.attr(srcAttr),
dataType: 'html',
crossDomain: true,
xhrFields: {withCredentials: true},
/**
* success callback
* @access private
* @param {*} content
* @return {void}
*/
success: function(content) {
// set responded data to element's inner html
element.html(content)
// change iframe src
.attr('src', element.attr(srcAttr));
// remove attributes
if (instance.config('removeAttribute')) {
element.removeAttr(srcAttr + ' ' + errorDetectAttr);
}
},
/**
* error callback
* @access private
* @return {void}
*/
error: function() {
// pass error state to lazy
// use response function for Zepto
response(false);
}
});
}
}
else {
// pass error state to lazy
// use response function for Zepto
response(false);
}
});
})(window.jQuery || window.Zepto);
/*!
* jQuery & Zepto Lazy - NOOP Plugin - v1.2
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// will do nothing, used to disable elements or for development
// use like:
// <div data-loader="noop"></div>
// does not do anything, just a 'no-operation' helper ;)
$.lazy('noop', function() {});
// does nothing, but response a successfull loading
$.lazy('noop-success', function(element, response) {
// use response function for Zepto
response(true);
});
// does nothing, but response a failed loading
$.lazy('noop-error', function(element, response) {
// use response function for Zepto
response(false);
});
})(window.jQuery || window.Zepto);
/*!
* jQuery & Zepto Lazy - Picture Plugin - v1.3
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
var srcAttr = 'data-src',
srcsetAttr = 'data-srcset',
mediaAttr = 'data-media',
sizesAttr = 'data-sizes',
typeAttr = 'data-type';
// loads picture elements like:
// <picture>
// <data-src srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" media="(min-width: 600px)" type="image/jpeg"></data-src>
// <data-src srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" media="(min-width: 400px)" type="image/jpeg"></data-src>
// <data-img src="default.jpg" >
// </picture>
//
// or:
// <picture data-src="default.jpg">
// <data-src srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" media="(min-width: 600px)" type="image/jpeg"></data-src>
// <data-src srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" media="(min-width: 400px)" type="image/jpeg"></data-src>
// </picture>
//
// or just with attributes in one line:
// <picture data-src="default.jpg" data-srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" data-media="(min-width: 600px)" data-sizes="" data-type="image/jpeg" />
$.lazy(['pic', 'picture'], ['picture'], function(element, response) {
var elementTagName = element[0].tagName.toLowerCase();
if (elementTagName === 'picture') {
var sources = element.find(srcAttr),
image = element.find('data-img'),
imageBase = this.config('imageBase') || '';
// handle as child elements
if (sources.length) {
sources.each(function() {
renameElementTag($(this), 'source', imageBase);
});
// create img tag from child
if (image.length === 1) {
image = renameElementTag(image, 'img', imageBase);
// bind event callbacks to new image tag
image.on('load', function() {
response(true);
}).on('error', function() {
response(false);
});
image.attr('src', image.attr(srcAttr));
if (this.config('removeAttribute')) {
image.removeAttr(srcAttr);
}
}
// create img tag from attribute
else if (element.attr(srcAttr)) {
// create image tag
createImageObject(element, imageBase + element.attr(srcAttr), response);
if (this.config('removeAttribute')) {
element.removeAttr(srcAttr);
}
}
// pass error state
else {
// use response function for Zepto
response(false);
}
}
// handle as attributes
else if( element.attr(srcsetAttr) ) {
// create source elements before img tag
$('<source>').attr({
media: element.attr(mediaAttr),
sizes: element.attr(sizesAttr),
type: element.attr(typeAttr),
srcset: getCorrectedSrcSet(element.attr(srcsetAttr), imageBase)
})
.appendTo(element);
// create image tag
createImageObject(element, imageBase + element.attr(srcAttr), response);
// remove attributes from parent picture element
if (this.config('removeAttribute')) {
element.removeAttr(srcAttr + ' ' + srcsetAttr + ' ' + mediaAttr + ' ' + sizesAttr + ' ' + typeAttr);
}
}
// pass error state
else {
// use response function for Zepto
response(false);
}
}
else {
// pass error state
// use response function for Zepto
response(false);
}
});
/**
* create a new child element and copy attributes
* @param {jQuery|object} element
* @param {string} toType
* @param {string} imageBase
* @return {jQuery|object}
*/
function renameElementTag(element, toType, imageBase) {
var attributes = element.prop('attributes'),
target = $('<' + toType + '>');
$.each(attributes, function(index, attribute) {
// build srcset with image base
if (attribute.name === 'srcset' || attribute.name === srcAttr) {
attribute.value = getCorrectedSrcSet(attribute.value, imageBase);
}
target.attr(attribute.name, attribute.value);
});
element.replaceWith(target);
return target;
}
/**
* create a new image element inside parent element
* @param {jQuery|object} parent
* @param {string} src
* @param {function} response
* @return void
*/
function createImageObject(parent, src, response) {
// create image tag
var imageObj = $('<img>')
// create image tag an bind callbacks for correct response
.one('load', function() {
response(true);
})
.one('error', function() {
response(false);
})
// set into picture element
.appendTo(parent)
// set src attribute at last to prevent early kick-in
.attr('src', src);
// call after load even on cached image
imageObj.complete && imageObj.load(); // jshint ignore : line
}
/**
* prepend image base to all srcset entries
* @param {string} srcset
* @param {string} imageBase
* @returns {string}
*/
function getCorrectedSrcSet(srcset, imageBase) {
if (imageBase) {
// trim, remove unnecessary spaces and split entries
var entries = srcset.split(',');
srcset = '';
for (var i = 0, l = entries.length; i < l; i++) {
srcset += imageBase + entries[i].trim() + (i !== l - 1 ? ',' : '');
}
}
return srcset;
}
})(window.jQuery || window.Zepto);
/*!
* jQuery & Zepto Lazy - Script Plugin - v1.2
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// loads javascript files for script tags, like:
// <script data-src="file.js" type="text/javascript"></script>
$.lazy(['js', 'javascript', 'script'], 'script', function(element, response) {
if (element[0].tagName.toLowerCase() === 'script') {
element.attr('src', element.attr('data-src'));
// remove attribute
if (this.config('removeAttribute')) {
element.removeAttr('data-src');
}
}
else {
// use response function for Zepto
response(false);
}
});
})(window.jQuery || window.Zepto);
/*!
* jQuery & Zepto Lazy - Vimeo Plugin - v1.1
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// load vimeo video iframe, like:
// <iframe data-loader="vimeo" data-src="176894130" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
$.lazy('vimeo', function(element, response) {
if (element[0].tagName.toLowerCase() === 'iframe') {
// pass source to iframe
element.attr('src', 'https://player.vimeo.com/video/' + element.attr('data-src'));
// remove attribute
if (this.config('removeAttribute')) {
element.removeAttr('data-src');
}
}
else {
// pass error state
// use response function for Zepto
response(false);
}
});
})(window.jQuery || window.Zepto);
/*!
* jQuery & Zepto Lazy - YouTube Plugin - v1.5
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// load youtube video iframe, like:
// <iframe data-loader="yt" data-src="1AYGnw6MwFM" data-nocookie="1" width="560" height="315" frameborder="0" allowfullscreen></iframe>
$.lazy(['yt', 'youtube'], function(element, response) {
if (element[0].tagName.toLowerCase() === 'iframe') {
// pass source to iframe
var noCookie = /1|true/.test(element.attr('data-nocookie'));
element.attr('src', 'https://www.youtube' + (noCookie ? '-nocookie' : '') + '.com/embed/' + element.attr('data-src') + '?rel=0&amp;showinfo=0');
// remove attribute
if (this.config('removeAttribute')) {
element.removeAttr('data-src');
}
}
else {
// pass error state
response(false);
}
});
})(window.jQuery || window.Zepto);
/*!
* jQuery & Zepto Lazy - YouTube Plugin - v1.5
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// load youtube video iframe, like:
// <iframe data-loader="do" data-callback="__callback" ></iframe>
$.lazy(['do'], function(element, response) {
var callback = element.attr('data-callback');
if (typeof window[callback] === 'function') {
window[callback](element, response);
// remove attribute
if (this.config('removeAttribute')) {
element.removeAttr('data-callback');
}
} else {
response(false);
}
});
})(window.jQuery || window.Zepto);
+11
View File
@@ -0,0 +1,11 @@
/*!
* jQuery & Zepto Lazy - AJAX Plugin - v1.4
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
!function(t){function e(e,a,r,o){var i;"POST"!==(o=o?o.toUpperCase():"GET")&&"PUT"!==o||!e.config("ajaxCreateData")||(i=e.config("ajaxCreateData").apply(e,[a])),t.ajax({url:a.attr("data-src"),type:"POST"===o||"PUT"===o?o:"GET",data:i,dataType:a.attr("data-type")||"html",success:function(t){a.html(t),r(!0),e.config("removeAttribute")&&a.removeAttr("data-src data-method data-type")},error:function(){r(!1)}})}t.lazy("ajax",(function(t,a){e(this,t,a,t.attr("data-method"))})),t.lazy("get",(function(t,a){e(this,t,a,"GET")})),t.lazy("post",(function(t,a){e(this,t,a,"POST")})),t.lazy("put",(function(t,a){e(this,t,a,"PUT")}))}(window.jQuery||window.Zepto),function(t){t.lazy(["av","audio","video"],["audio","video"],(function(e,a){var r=e[0].tagName.toLowerCase();if("audio"===r||"video"===r){var o="data-src",i=e.find(o),n=e.find("data-track"),c=0,s=function(){++c===i.length&&a(!1)},u=function(){var e=t(this),a=e[0].tagName.toLowerCase(),r=e.prop("attributes"),i=t(a===o?"<source>":"<track>");a===o&&i.one("error",s),t.each(r,(function(t,e){i.attr(e.name,e.value)})),e.replaceWith(i)};e.one("loadedmetadata",(function(){a(!0)})).off("load error").attr("poster",e.attr("data-poster")),i.length?i.each(u):e.attr(o)?(t.each(e.attr(o).split(","),(function(a,r){var o=r.split("|");e.append(t("<source>").one("error",s).attr({src:o[0].trim(),type:o[1].trim()}))})),this.config("removeAttribute")&&e.removeAttr(o)):a(!1),n.length&&n.each(u)}else a(!1)}))}(window.jQuery||window.Zepto),function(t){t.lazy(["frame","iframe"],"iframe",(function(e,a){var r=this;if("iframe"===e[0].tagName.toLowerCase()){var o="data-src",i="data-error-detect",n=e.attr(i);"true"!==n&&"1"!==n?(e.attr("src",e.attr(o)),r.config("removeAttribute")&&e.removeAttr(o+" "+i)):t.ajax({url:e.attr(o),dataType:"html",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(t){e.html(t).attr("src",e.attr(o)),r.config("removeAttribute")&&e.removeAttr(o+" "+i)},error:function(){a(!1)}})}else a(!1)}))}(window.jQuery||window.Zepto),function(t){t.lazy("noop",(function(){})),t.lazy("noop-success",(function(t,e){e(!0)})),t.lazy("noop-error",(function(t,e){e(!1)}))}(window.jQuery||window.Zepto),function(t){var e="data-src",a="data-srcset",r="data-media",o="data-sizes",i="data-type";function n(a,r,o){var i=a.prop("attributes"),n=t("<"+r+">");return t.each(i,(function(t,a){"srcset"!==a.name&&a.name!==e||(a.value=s(a.value,o)),n.attr(a.name,a.value)})),a.replaceWith(n),n}function c(e,a,r){var o=t("<img>").one("load",(function(){r(!0)})).one("error",(function(){r(!1)})).appendTo(e).attr("src",a);o.complete&&o.load()}function s(t,e){if(e){var a=t.split(",");t="";for(var r=0,o=a.length;r<o;r++)t+=e+a[r].trim()+(r!==o-1?",":"")}return t}t.lazy(["pic","picture"],["picture"],(function(u,d){if("picture"===u[0].tagName.toLowerCase()){var f=u.find(e),m=u.find("data-img"),p=this.config("imageBase")||"";f.length?(f.each((function(){n(t(this),"source",p)})),1===m.length?((m=n(m,"img",p)).on("load",(function(){d(!0)})).on("error",(function(){d(!1)})),m.attr("src",m.attr(e)),this.config("removeAttribute")&&m.removeAttr(e)):u.attr(e)?(c(u,p+u.attr(e),d),this.config("removeAttribute")&&u.removeAttr(e)):d(!1)):u.attr(a)?(t("<source>").attr({media:u.attr(r),sizes:u.attr(o),type:u.attr(i),srcset:s(u.attr(a),p)}).appendTo(u),c(u,p+u.attr(e),d),this.config("removeAttribute")&&u.removeAttr(e+" "+a+" "+r+" "+o+" "+i)):d(!1)}else d(!1)}))}(window.jQuery||window.Zepto),(window.jQuery||window.Zepto).lazy(["js","javascript","script"],"script",(function(t,e){"script"===t[0].tagName.toLowerCase()?(t.attr("src",t.attr("data-src")),this.config("removeAttribute")&&t.removeAttr("data-src")):e(!1)})),(window.jQuery||window.Zepto).lazy("vimeo",(function(t,e){"iframe"===t[0].tagName.toLowerCase()?(t.attr("src","https://player.vimeo.com/video/"+t.attr("data-src")),this.config("removeAttribute")&&t.removeAttr("data-src")):e(!1)})),(window.jQuery||window.Zepto).lazy(["yt","youtube"],(function(t,e){if("iframe"===t[0].tagName.toLowerCase()){var a=/1|true/.test(t.attr("data-nocookie"));t.attr("src","https://www.youtube"+(a?"-nocookie":"")+".com/embed/"+t.attr("data-src")+"?rel=0&amp;showinfo=0"),this.config("removeAttribute")&&t.removeAttr("data-src")}else e(!1)})),(window.jQuery||window.Zepto).lazy(["do"],(function(t,e){var a=t.attr("data-callback");"function"==typeof window[a]?(window[a](t,e),this.config("removeAttribute")&&t.removeAttr("data-callback")):e(!1)}));
File diff suppressed because it is too large Load Diff
+68
View File
@@ -0,0 +1,68 @@
{
"name": "jquery-lazy",
"title": "jQuery & Zepto Lazy - Delayed Content, Image and Background Loader",
"version": "1.7.11",
"description": "Lazy is a fast, feature-rich and lightweight delayed content loading plugin for jQuery and Zepto. It's designed to speed up page loading times and decrease traffic to your users by only loading the content in view.",
"main": "jquery.lazy.js",
"homepage": "http://jquery.eisbehr.de/lazy",
"bugs": "http://github.com/dkern/jquery.lazy/issues",
"author": {
"name": "Daniel 'Eisbehr' Kern",
"email": "jquery@eisbehr.de",
"url": "http://eisbehr.de/"
},
"repository": {
"type": "git",
"url": "git@github.com:dkern/jquery.lazy.git"
},
"keywords": [
"lazy",
"lazyload",
"load",
"loader",
"image",
"images",
"background",
"content",
"speed",
"delay",
"delayed",
"pageload",
"performance",
"retina",
"placeholder",
"jquery",
"jquery-plugin",
"zepto",
"zepto-plugin"
],
"licenses": [{
"type": "MIT",
"url": "http://www.opensource.org/licenses/mit-license.php"
},{
"type": "GPL-2.0",
"url": "http://www.gnu.org/licenses/gpl-2.0.html"
}],
"dependencies": {
"jquery": ">=1.7.2"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-concat-util": "^0.5.5",
"gulp-data": "^1.2.1",
"gulp-header": "^1.8.9",
"gulp-jshint": "^2.0.4",
"gulp-noop": "^1.0.0",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^2.1.2",
"gulp-util": "^3.0.8",
"jshint": "^2.9.5",
"jshint-stylish": "^2.2.1"
},
"scripts": {
"validate": "gulp validate",
"start": "gulp watch",
"watch": "gulp watch",
"build": "gulp build"
}
}
+324
View File
@@ -0,0 +1,324 @@
### jQuery Lazy - Loader Plugins
[![GitHub version](https://badge.fury.io/gh/dkern%2Fjquery.lazy.svg)](http://github.com/dkern/jquery.lazy)
[![NPM version](https://badge.fury.io/js/jquery-lazy.svg)](http://www.npmjs.org/package/jquery-lazy)
[![Bower version](https://badge.fury.io/bo/jquery-lazy.svg)](http://bower.io/search/?q=jquery-lazy)
[![Dependencies Status](https://david-dm.org/dkern/jquery.lazy/status.svg)](https://david-dm.org/dkern/jquery.lazy)
[![devDependencies Status](https://david-dm.org/dkern/jquery.lazy/dev-status.svg)](https://david-dm.org/dkern/jquery.lazy?type=dev)
---
### Table of Contents
* [Document Note](#document-note)
* [About Loader Plugins](#about-loader-plugins)
* [Create an own Loader Plugin](#create-an-own-loader-plugin)
* [AJAX Loader](#ajax-loader)
* [Audio / Video Loader](#audio--video-loader)
* [iFrame Loader](#iframe-loader)
* [NOOP Loader](#noop-loader)
* [Picture Loader](#picture-loader)
* [JS / Script Loader](#js--script-loader)
* [Vimeo Video Loader](#vimeo-video-loader)
* [YouTube Video Loader](#youtube-video-loader)
* [Bugs / Feature request](#bugs--feature-request)
* [License](#license)
* [Donation](#donation)
---
## Document Note
This is not the main readme file of this project.
Please go to the [project root](https://github.com/dkern/jquery.lazy) and take a look in the [README.md](https://github.com/dkern/jquery.lazy/blob/master/README.md) to learn more about the basics of Lazy.
## About Loader Plugins
The loader plugins for Lazy can be used whenever you want to extend the basic functionality by default or globally for many instances of Lazy.
Just add the plugins you want to use or a combined file, containing all plugins, to your page and all instances can use the plugins from now on.
```HTML
<!-- as single plugin files -->
<script type="text/javascript" src="jquery.lazy.min.js"></script>
<script type="text/javascript" src="plugins/jquery.lazy.ajax.min.js"></script>
<script type="text/javascript" src="plugins/jquery.lazy.av.min.js"></script>
<script type="text/javascript" src="plugins/jquery.lazy.iframe.min.js"></script>
<script type="text/javascript" src="plugins/jquery.lazy.noop.min.js"></script>
<script type="text/javascript" src="plugins/jquery.lazy.picture.min.js"></script>
<script type="text/javascript" src="plugins/jquery.lazy.script.min.js"></script>
<script type="text/javascript" src="plugins/jquery.lazy.vimeo.min.js"></script>
<script type="text/javascript" src="plugins/jquery.lazy.youtube.min.js"></script>
<!-- or combined in one file -->
<script type="text/javascript" src="jquery.lazy.min.js"></script>
<script type="text/javascript" src="jquery.lazy.plugins.min.js"></script>
```
## Create an own Loader Plugin
If you want to, you can easily create own loader plugins.
Just use jQuery or Zepto's public function `Lazy` to create and register them.
Best practice is to wrap everything by an [IIFE](https://en.wikipedia.org/wiki/Immediately-invoked_function_expression).
```JS
(function($) {
$.Lazy("pluginName", function(element, response) {
// add your logic here
// 'this' is the current instance of Lazy
// so it's possible to access all public functions, like:
var imageBase = this.config("imageBase");
});
})(window.jQuery || window.Zepto);
```
This loader can now be called on every element with the attribute `data-loader` (_by default_), like:
```HTML
<div data-loader="pluginName"></div>
```
It's possible to register a plugin with more than one name / alias.
```JS
(function($) {
$.Lazy(["pluginName", "anotherPluginName"], function(element, response) {
// the plugin is now available by 'data-loader="pluginLoaderName"'
// and 'data-loader="anotherLoaderName"'
});
})(window.jQuery || window.Zepto);
```
The optional second parameter gives you the ability to register a plugin by default to an element type.
When you do this, there is no need to set the `data-loader` attribute on each element you want to use this loader on.
But keep in mind, if you register an plugin on often used elements, like `<div>`, Lazy will try to handle each of them!
If you want to do so anyway, use a most specific selector for jQuery or Zepto.
```JS
(function($) {
$.Lazy("av", ["audio", "video"], function(element, response) {
// this plugin will automatically handle '<audio>' and '<video>' elements,
// even when no 'data-loader' attribute was set on the elements
});
})(window.jQuery || window.Zepto);
```
For more examples, take a look at the [existing plugins](https://github.com/dkern/jquery.lazy/tree/master/plugins).
## AJAX Loader
**Names:** `ajax`, `get`, `post`, `put`
**Parameters:** `data-src`, `data-method`, `data-type`
**Default for:** -
The AJAX loader can receive data from a given url and paste the response to the inner html of the element.
This is useful, when you want do load a bigger amount of content.
Use `ajax` as the loader name by default.
But there are even some shorthand names for specific request types `GET`, `POST` and `PUT` too.
```HTML
<!-- simple GET request -->
<div data-loader="ajax" data-src="ajax.html"></div>
<!-- simple post request with configurable response type -->
<div data-loader="ajax" data-src="ajax.html" data-method="post" data-type="html"></div>
<!-- GET request -->
<div data-loader="get" data-src="ajax.html"></div>
<!-- POST request-->
<div data-loader="post" data-src="ajax.html"></div>
<!-- PUT request-->
<div data-loader="put" data-src="ajax.html"></div>
```
On `POST` and `PUT` requests, the callback `ajaxCreateData` will be executed before every AJAX call.
If used, the callback function should return the value for the `data` parameter of jQuery's AJAX function.
```HTML
<div data-loader="post" data-src="ajax.html" data-value="post-data"></div>
```
```JS
$('div').Lazy({
ajaxCreateData: function(element) {
return {name: element.data('value')};
}
});
```
## Audio / Video Loader
**Names:** `av`, `audio`, `video`
**Parameters:** `data-src`, `data-poster`
**Default for:** `<audio>`, `<video>`
Loads `<audio>` and `<video>` elements and attach the sources and tracks in the right order.
There are two ways you can prepare your audio and/or video tags.
First way is to add all sources by `data-src` attribute, separated by comma and type by pipe on the element.
```HTML
<audio data-src="file.ogg|audio/ogg,file.mp3|audio/mp3,file.wav|audio/wav"></audio>
<video data-src="file.ogv|video/ogv,file.mp4|video/mp4,file.webm|video/webm" data-poster="poster.jpg"></video>
```
The other way is to add the sources and tracks like default, as child elements.
```HTML
<audio>
<data-src src="file.ogg" type="audio/ogg"></data-src>
<data-src src="file.mp3" type="audio/mp3"></data-src>
<data-src src="file.wav" type="audio/wav"></data-src>
</audio>
<video data-poster="poster.jpg">
<data-src src="file.ogv" type="video/ogv"></data-src>
<data-src src="file.mp4" type="video/mp4"></data-src>
<data-src src="file.webm" type="video/webm"></data-src>
<data-track kind="captions" src="captions.vtt" srclang="en"></data-track>
<data-track kind="descriptions" src="descriptions.vtt" srclang="en"></data-track>
<data-track kind="subtitles" src="subtitles.vtt" srclang="de"></data-track>
</video>
```
## iFrame Loader
**Names:** `frame`, `iframe`
**Parameters:** `data-src`, `data-error-detect`
**Default for:** `<iframe>`
Loads `<iframe>` contents.
The default will return a successfull load, even if the iframe url is not reachable (_like on 404 or wrong url_), because there is no way to check the loaded content in javascript.
It might be the fastest and safest way to do that.
If you know the requested path is reachable every time or don't care about error checks, you should use this way!
```HTML
<iframe data-src="iframe.html"></iframe>
```
The second way is more professional and support error checks.
It will load the content by AJAX and checks the response.
Afterwards pass the HTML content to iframe inner and set the correct url.
This is a very secure check, but could be a bit more tricky on some use cases.
You should only use this on the same domain origin.
To enable this feature, set the attribute `data-error-detect` to `true` or `1` on the iframe element.
```HTML
<iframe data-loader="iframe" data-src="iframe.html" data-error-detect="true"></iframe>
```
## NOOP Loader
**Names:** `noop`, `noop-success`, `noop-error`
**Parameters:** -
**Default for:** -
The NOOP (_or no-operations_) loader will, like the name said, do nothing.
There will even be no callbacks triggered, like `beforeLoad` or `onError`, when using a NOOP` loader.
It could be useful for developers or to simple, secure and fast disable some other loaders.
It can be used with all elements.
```HTML
<div data-loader="noop"></div>
```
There are two other NOOP loaders, helping to debug your code.
The `noop-success` and `noop-error` loaders will return the current state to Lazy and trigger the right callbacks.
```HTML
<!-- triggers the 'afterLoad' and 'onFinishedAll' callback -->
<div data-loader="noop-success"></div>
<!-- triggers the 'onError' and 'onFinishedAll' callback -->
<div data-loader="noop-error"></div>
```
## Picture Loader
**Names:** `pic`, `picture`
**Parameters:** `data-src`, `data-srcset`, `data-media`, `data-sizes`
**Default for:** `<picture>`
Loads `<picture>` elements and attach the sources.
There are two ways you can prepare your picture tags.
First way is to create all child elements from a single line:
```HTML
<picture data-src="default.jpg" data-srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" data-media="(min-width: 600px)" data-type="image/jpeg" />
```
The other way is to add the sources like default, as child elements.
```HTML
<picture>
<data-src srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" media="(min-width: 600px)" type="image/jpeg"></data-src>
<data-img src="default.jpg"></data-img>
</picture>
<picture data-src="default.jpg">
<data-src srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" media="(min-width: 600px)" type="image/jpeg"></data-src>
</picture>
```
## JS / Script Loader
**Names:** `js`, `javascript`, `script`
**Parameters:** `data-src`
**Default for:** `<script>`
Loads javascript files on `<script>` element.
Change the element like the example below, and the files will be loaded automatically after page load.
```HTML
<script data-src="script.js" type="text/javascript"></script>
```
**Note:**
The viewport detection is not correct in some browsers.
So it could happen, that all script files get loaded right after page load, and not when the user scrolls to them.
## Vimeo Video Loader
**Names:** `vimeo`
**Parameters:** `data-src`
**Default for:** -
Loads vimeo videos in an `<iframe>`.
This is the suggested way by vimeo itself.
You can prepare the `<iframe>` element as you would do without Lazy.
Only add the vimeo video id to the attribute `data-src` and add the loader name.
That's all.
```HTML
<iframe data-loader="vimeo" data-src="176894130" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
```
**Please keep in mind:**
Because this is an iframe and there is no feedback javascript could check on, this loader can only return success to Lazy.
There is no way to check if the video was loaded correctly or your provided video id is existing.
## YouTube Video Loader
**Names:** `yt`, `youtube`
**Parameters:** `data-src`, `data-nocookie`
**Default for:** -
Loads youtube videos in an `<iframe>`.
This is the suggested way by youtube itself.
You can prepare the `<iframe>` element as you would do without Lazy.
Only add the youtube video id to the attribute `data-src` and add the loader name.
That's all.
```HTML
<iframe data-loader="youtube" data-src="1AYGnw6MwFM" width="560" height="315" frameborder="0"></iframe>
```
If you want to, you can control the cookie behavior of the embedded video with `data-nocookie="1"`.
This would change the url to `youtube-nocookie.com` instead of `youtube.com`.
```HTML
<iframe data-loader="youtube" data-src="1AYGnw6MwFM" data-nocookie="1" width="560" height="315" frameborder="0"></iframe>
```
**Please keep in mind:**
Because this is an iframe and there is no feedback javascript could check on, this loader can only return success to Lazy.
There is no way to check if the video was loaded correctly or your provided video id is existing.
## Bugs / Feature request
Please [report](http://github.com/dkern/jquery.lazy/issues) bugs and feel free to [ask](http://github.com/dkern/jquery.lazy/issues) for new features and loaders directly on GitHub.
## License
Lazy plugins are dual-licensed under [MIT](http://www.opensource.org/licenses/mit-license.php) and [GPL-2.0](http://www.gnu.org/licenses/gpl-2.0.html) license.
## Donation
_You like to support me?_
_You appreciate my work?_
_You use it in commercial projects?_
Feel free to make a little [donation](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FFL6VQJCUZMXC)! :wink:
@@ -0,0 +1,88 @@
/*!
* jQuery & Zepto Lazy - AJAX Plugin - v1.4
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// load data by ajax request and pass them to elements inner html, like:
// <div data-loader="ajax" data-src="url.html" data-method="post" data-type="html"></div>
$.lazy('ajax', function(element, response) {
ajaxRequest(this, element, response, element.attr('data-method'));
});
// load data by ajax get request and pass them to elements inner html, like:
// <div data-loader="get" data-src="url.html" data-type="html"></div>
$.lazy('get', function(element, response) {
ajaxRequest(this, element, response, 'GET');
});
// load data by ajax post request and pass them to elements inner html, like:
// <div data-loader="post" data-src="url.html" data-type="html"></div>
$.lazy('post', function(element, response) {
ajaxRequest(this, element, response, 'POST');
});
// load data by ajax put request and pass them to elements inner html, like:
// <div data-loader="put" data-src="url.html" data-type="html"></div>
$.lazy('put', function(element, response) {
ajaxRequest(this, element, response, 'PUT');
});
/**
* execute ajax request and handle response
* @param {object} instance
* @param {jQuery|object} element
* @param {function} response
* @param {string} [method]
*/
function ajaxRequest(instance, element, response, method) {
method = method ? method.toUpperCase() : 'GET';
var data;
if ((method === 'POST' || method === 'PUT') && instance.config('ajaxCreateData')) {
data = instance.config('ajaxCreateData').apply(instance, [element]);
}
$.ajax({
url: element.attr('data-src'),
type: method === 'POST' || method === 'PUT' ? method : 'GET',
data: data,
dataType: element.attr('data-type') || 'html',
/**
* success callback
* @access private
* @param {*} content
* @return {void}
*/
success: function(content) {
// set responded data to element's inner html
element.html(content);
// use response function for Zepto
response(true);
// remove attributes
if (instance.config('removeAttribute')) {
element.removeAttr('data-src data-method data-type');
}
},
/**
* error callback
* @access private
* @return {void}
*/
error: function() {
// pass error state to lazy
// use response function for Zepto
response(false);
}
});
}
})(window.jQuery || window.Zepto);
+2
View File
@@ -0,0 +1,2 @@
/*! jQuery & Zepto Lazy - AJAX Plugin v1.4 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2018 Daniel 'Eisbehr' Kern */
!function(t){function a(a,e,n,o){o=o?o.toUpperCase():"GET";var i;"POST"!==o&&"PUT"!==o||!a.config("ajaxCreateData")||(i=a.config("ajaxCreateData").apply(a,[e])),t.ajax({url:e.attr("data-src"),type:"POST"===o||"PUT"===o?o:"GET",data:i,dataType:e.attr("data-type")||"html",success:function(t){e.html(t),n(!0),a.config("removeAttribute")&&e.removeAttr("data-src data-method data-type")},error:function(){n(!1)}})}t.lazy("ajax",function(t,e){a(this,t,e,t.attr("data-method"))}),t.lazy("get",function(t,e){a(this,t,e,"GET")}),t.lazy("post",function(t,e){a(this,t,e,"POST")}),t.lazy("put",function(t,e){a(this,t,e,"PUT")})}(window.jQuery||window.Zepto);
@@ -0,0 +1,120 @@
/*!
* jQuery & Zepto Lazy - AV Plugin - v1.4
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// loads audio and video tags including tracks by two ways, like:
// <audio>
// <data-src src="audio.ogg" type="video/ogg"></data-src>
// <data-src src="audio.mp3" type="video/mp3"></data-src>
// </audio>
// <video data-poster="poster.jpg">
// <data-src src="video.ogv" type="video/ogv"></data-src>
// <data-src src="video.webm" type="video/webm"></data-src>
// <data-src src="video.mp4" type="video/mp4"></data-src>
// <data-track kind="captions" src="captions.vtt" srclang="en"></data-track>
// <data-track kind="descriptions" src="descriptions.vtt" srclang="en"></data-track>
// <data-track kind="subtitles" src="subtitles.vtt" srclang="de"></data-track>
// </video>
//
// or:
// <audio data-src="audio.ogg|video/ogg,video.mp3|video/mp3"></video>
// <video data-poster="poster.jpg" data-src="video.ogv|video/ogv,video.webm|video/webm,video.mp4|video/mp4">
// <data-track kind="captions" src="captions.vtt" srclang="en"></data-track>
// <data-track kind="descriptions" src="descriptions.vtt" srclang="en"></data-track>
// <data-track kind="subtitles" src="subtitles.vtt" srclang="de"></data-track>
// </video>
$.lazy(['av', 'audio', 'video'], ['audio', 'video'], function(element, response) {
var elementTagName = element[0].tagName.toLowerCase();
if (elementTagName === 'audio' || elementTagName === 'video') {
var srcAttr = 'data-src',
sources = element.find(srcAttr),
tracks = element.find('data-track'),
sourcesInError = 0,
// create on error callback for sources
onError = function() {
if (++sourcesInError === sources.length) {
response(false);
}
},
// create callback to handle a source or track entry
handleSource = function() {
var source = $(this),
type = source[0].tagName.toLowerCase(),
attributes = source.prop('attributes'),
target = $(type === srcAttr ? '<source>' : '<track>');
if (type === srcAttr) {
target.one('error', onError);
}
$.each(attributes, function(index, attribute) {
target.attr(attribute.name, attribute.value);
});
source.replaceWith(target);
};
// create event for successfull load
element.one('loadedmetadata', function() {
response(true);
})
// remove default callbacks to ignore loading poster image
.off('load error')
// load poster image
.attr('poster', element.attr('data-poster'));
// load by child tags
if (sources.length) {
sources.each(handleSource);
}
// load by attribute
else if (element.attr(srcAttr)) {
// split for every entry by comma
$.each(element.attr(srcAttr).split(','), function(index, value) {
// split again for file and file type
var parts = value.split('|');
// create a source entry
element.append($('<source>')
.one('error', onError)
.attr({src: parts[0].trim(), type: parts[1].trim()}));
});
// remove now obsolete attribute
if (this.config('removeAttribute')) {
element.removeAttr(srcAttr);
}
}
else {
// pass error state
// use response function for Zepto
response(false);
}
// load optional tracks
if (tracks.length) {
tracks.each(handleSource);
}
}
else {
// pass error state
// use response function for Zepto
response(false);
}
});
})(window.jQuery || window.Zepto);
+2
View File
@@ -0,0 +1,2 @@
/*! jQuery & Zepto Lazy - AV Plugin v1.4 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2018 Daniel 'Eisbehr' Kern */
!function(t){t.lazy(["av","audio","video"],["audio","video"],function(a,e){var r=a[0].tagName.toLowerCase();if("audio"===r||"video"===r){var o=a.find("data-src"),i=a.find("data-track"),n=0,c=function(){++n===o.length&&e(!1)},d=function(){var a=t(this),e=a[0].tagName.toLowerCase(),r=a.prop("attributes"),o=t("data-src"===e?"<source>":"<track>");"data-src"===e&&o.one("error",c),t.each(r,function(t,a){o.attr(a.name,a.value)}),a.replaceWith(o)};a.one("loadedmetadata",function(){e(!0)}).off("load error").attr("poster",a.attr("data-poster")),o.length?o.each(d):a.attr("data-src")?(t.each(a.attr("data-src").split(","),function(e,r){var o=r.split("|");a.append(t("<source>").one("error",c).attr({src:o[0].trim(),type:o[1].trim()}))}),this.config("removeAttribute")&&a.removeAttr("data-src")):e(!1),i.length&&i.each(d)}else e(!1)})}(window.jQuery||window.Zepto);
@@ -0,0 +1,26 @@
/*!
* jQuery & Zepto Lazy - YouTube Plugin - v1.5
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// load youtube video iframe, like:
// <iframe data-loader="do" data-callback="__callback" ></iframe>
$.lazy(['do'], function(element, response) {
var callback = element.attr('data-callback');
if (typeof window[callback] === 'function') {
window[callback](element, response);
// remove attribute
if (this.config('removeAttribute')) {
element.removeAttr('data-callback');
}
} else {
response(false);
}
});
})(window.jQuery || window.Zepto);
@@ -0,0 +1,83 @@
/*!
* jQuery & Zepto Lazy - iFrame Plugin - v1.5
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// load iframe content, like:
// <iframe data-src="iframe.html"></iframe>
//
// enable content error check with:
// <iframe data-src="iframe.html" data-error-detect="true"></iframe>
$.lazy(['frame', 'iframe'], 'iframe', function(element, response) {
var instance = this;
if (element[0].tagName.toLowerCase() === 'iframe') {
var srcAttr = 'data-src',
errorDetectAttr = 'data-error-detect',
errorDetect = element.attr(errorDetectAttr);
// default way, just replace the 'src' attribute
if (errorDetect !== 'true' && errorDetect !== '1') {
// set iframe source
element.attr('src', element.attr(srcAttr));
// remove attributes
if (instance.config('removeAttribute')) {
element.removeAttr(srcAttr + ' ' + errorDetectAttr);
}
}
// extended way, even check if the document is available
else {
$.ajax({
url: element.attr(srcAttr),
dataType: 'html',
crossDomain: true,
xhrFields: {withCredentials: true},
/**
* success callback
* @access private
* @param {*} content
* @return {void}
*/
success: function(content) {
// set responded data to element's inner html
element.html(content)
// change iframe src
.attr('src', element.attr(srcAttr));
// remove attributes
if (instance.config('removeAttribute')) {
element.removeAttr(srcAttr + ' ' + errorDetectAttr);
}
},
/**
* error callback
* @access private
* @return {void}
*/
error: function() {
// pass error state to lazy
// use response function for Zepto
response(false);
}
});
}
}
else {
// pass error state to lazy
// use response function for Zepto
response(false);
}
});
})(window.jQuery || window.Zepto);
+2
View File
@@ -0,0 +1,2 @@
/*! jQuery & Zepto Lazy - iFrame Plugin v1.5 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2018 Daniel 'Eisbehr' Kern */
!function(t){t.lazy(["frame","iframe"],"iframe",function(r,a){var e=this;if("iframe"===r[0].tagName.toLowerCase()){var o=r.attr("data-error-detect");"true"!==o&&"1"!==o?(r.attr("src",r.attr("data-src")),e.config("removeAttribute")&&r.removeAttr("data-src data-error-detect")):t.ajax({url:r.attr("data-src"),dataType:"html",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(t){r.html(t).attr("src",r.attr("data-src")),e.config("removeAttribute")&&r.removeAttr("data-src data-error-detect")},error:function(){a(!1)}})}else a(!1)})}(window.jQuery||window.Zepto);
@@ -0,0 +1,30 @@
/*!
* jQuery & Zepto Lazy - NOOP Plugin - v1.2
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// will do nothing, used to disable elements or for development
// use like:
// <div data-loader="noop"></div>
// does not do anything, just a 'no-operation' helper ;)
$.lazy('noop', function() {});
// does nothing, but response a successfull loading
$.lazy('noop-success', function(element, response) {
// use response function for Zepto
response(true);
});
// does nothing, but response a failed loading
$.lazy('noop-error', function(element, response) {
// use response function for Zepto
response(false);
});
})(window.jQuery || window.Zepto);
+2
View File
@@ -0,0 +1,2 @@
/*! jQuery & Zepto Lazy - NOOP Plugin v1.2 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2018 Daniel 'Eisbehr' Kern */
!function(o){o.lazy("noop",function(){}),o.lazy("noop-success",function(o,n){n(!0)}),o.lazy("noop-error",function(o,n){n(!1)})}(window.jQuery||window.Zepto);
@@ -0,0 +1,188 @@
/*!
* jQuery & Zepto Lazy - Picture Plugin - v1.3
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
var srcAttr = 'data-src',
srcsetAttr = 'data-srcset',
mediaAttr = 'data-media',
sizesAttr = 'data-sizes',
typeAttr = 'data-type';
// loads picture elements like:
// <picture>
// <data-src srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" media="(min-width: 600px)" type="image/jpeg"></data-src>
// <data-src srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" media="(min-width: 400px)" type="image/jpeg"></data-src>
// <data-img src="default.jpg" >
// </picture>
//
// or:
// <picture data-src="default.jpg">
// <data-src srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" media="(min-width: 600px)" type="image/jpeg"></data-src>
// <data-src srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" media="(min-width: 400px)" type="image/jpeg"></data-src>
// </picture>
//
// or just with attributes in one line:
// <picture data-src="default.jpg" data-srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" data-media="(min-width: 600px)" data-sizes="" data-type="image/jpeg" />
$.lazy(['pic', 'picture'], ['picture'], function(element, response) {
var elementTagName = element[0].tagName.toLowerCase();
if (elementTagName === 'picture') {
var sources = element.find(srcAttr),
image = element.find('data-img'),
imageBase = this.config('imageBase') || '';
// handle as child elements
if (sources.length) {
sources.each(function() {
renameElementTag($(this), 'source', imageBase);
});
// create img tag from child
if (image.length === 1) {
image = renameElementTag(image, 'img', imageBase);
// bind event callbacks to new image tag
image.on('load', function() {
response(true);
}).on('error', function() {
response(false);
});
image.attr('src', image.attr(srcAttr));
if (this.config('removeAttribute')) {
image.removeAttr(srcAttr);
}
}
// create img tag from attribute
else if (element.attr(srcAttr)) {
// create image tag
createImageObject(element, imageBase + element.attr(srcAttr), response);
if (this.config('removeAttribute')) {
element.removeAttr(srcAttr);
}
}
// pass error state
else {
// use response function for Zepto
response(false);
}
}
// handle as attributes
else if( element.attr(srcsetAttr) ) {
// create source elements before img tag
$('<source>').attr({
media: element.attr(mediaAttr),
sizes: element.attr(sizesAttr),
type: element.attr(typeAttr),
srcset: getCorrectedSrcSet(element.attr(srcsetAttr), imageBase)
})
.appendTo(element);
// create image tag
createImageObject(element, imageBase + element.attr(srcAttr), response);
// remove attributes from parent picture element
if (this.config('removeAttribute')) {
element.removeAttr(srcAttr + ' ' + srcsetAttr + ' ' + mediaAttr + ' ' + sizesAttr + ' ' + typeAttr);
}
}
// pass error state
else {
// use response function for Zepto
response(false);
}
}
else {
// pass error state
// use response function for Zepto
response(false);
}
});
/**
* create a new child element and copy attributes
* @param {jQuery|object} element
* @param {string} toType
* @param {string} imageBase
* @return {jQuery|object}
*/
function renameElementTag(element, toType, imageBase) {
var attributes = element.prop('attributes'),
target = $('<' + toType + '>');
$.each(attributes, function(index, attribute) {
// build srcset with image base
if (attribute.name === 'srcset' || attribute.name === srcAttr) {
attribute.value = getCorrectedSrcSet(attribute.value, imageBase);
}
target.attr(attribute.name, attribute.value);
});
element.replaceWith(target);
return target;
}
/**
* create a new image element inside parent element
* @param {jQuery|object} parent
* @param {string} src
* @param {function} response
* @return void
*/
function createImageObject(parent, src, response) {
// create image tag
var imageObj = $('<img>')
// create image tag an bind callbacks for correct response
.one('load', function() {
response(true);
})
.one('error', function() {
response(false);
})
// set into picture element
.appendTo(parent)
// set src attribute at last to prevent early kick-in
.attr('src', src);
// call after load even on cached image
imageObj.complete && imageObj.load(); // jshint ignore : line
}
/**
* prepend image base to all srcset entries
* @param {string} srcset
* @param {string} imageBase
* @returns {string}
*/
function getCorrectedSrcSet(srcset, imageBase) {
if (imageBase) {
// trim, remove unnecessary spaces and split entries
var entries = srcset.split(',');
srcset = '';
for (var i = 0, l = entries.length; i < l; i++) {
srcset += imageBase + entries[i].trim() + (i !== l - 1 ? ',' : '');
}
}
return srcset;
}
})(window.jQuery || window.Zepto);
+2
View File
@@ -0,0 +1,2 @@
/*! jQuery & Zepto Lazy - Picture Plugin v1.3 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2018 Daniel 'Eisbehr' Kern */
!function(t){function e(e,a,n){var o=e.prop("attributes"),c=t("<"+a+">");return t.each(o,function(t,e){"srcset"!==e.name&&e.name!==i||(e.value=r(e.value,n)),c.attr(e.name,e.value)}),e.replaceWith(c),c}function a(e,a,r){var i=t("<img>").one("load",function(){r(!0)}).one("error",function(){r(!1)}).appendTo(e).attr("src",a);i.complete&&i.load()}function r(t,e){if(e){var a=t.split(",");t="";for(var r=0,i=a.length;r<i;r++)t+=e+a[r].trim()+(r!==i-1?",":"")}return t}var i="data-src";t.lazy(["pic","picture"],["picture"],function(n,o){if("picture"===n[0].tagName.toLowerCase()){var c=n.find(i),s=n.find("data-img"),u=this.config("imageBase")||"";c.length?(c.each(function(){e(t(this),"source",u)}),1===s.length?(s=e(s,"img",u),s.on("load",function(){o(!0)}).on("error",function(){o(!1)}),s.attr("src",s.attr(i)),this.config("removeAttribute")&&s.removeAttr(i)):n.attr(i)?(a(n,u+n.attr(i),o),this.config("removeAttribute")&&n.removeAttr(i)):o(!1)):n.attr("data-srcset")?(t("<source>").attr({media:n.attr("data-media"),sizes:n.attr("data-sizes"),type:n.attr("data-type"),srcset:r(n.attr("data-srcset"),u)}).appendTo(n),a(n,u+n.attr(i),o),this.config("removeAttribute")&&n.removeAttr(i+" data-srcset data-media data-sizes data-type")):o(!1)}else o(!1)})}(window.jQuery||window.Zepto);
@@ -0,0 +1,28 @@
/*!
* jQuery & Zepto Lazy - Script Plugin - v1.2
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// loads javascript files for script tags, like:
// <script data-src="file.js" type="text/javascript"></script>
$.lazy(['js', 'javascript', 'script'], 'script', function(element, response) {
if (element[0].tagName.toLowerCase() === 'script') {
element.attr('src', element.attr('data-src'));
// remove attribute
if (this.config('removeAttribute')) {
element.removeAttr('data-src');
}
}
else {
// use response function for Zepto
response(false);
}
});
})(window.jQuery || window.Zepto);
+2
View File
@@ -0,0 +1,2 @@
/*! jQuery & Zepto Lazy - Script Plugin v1.2 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2018 Daniel 'Eisbehr' Kern */
!function(t){t.lazy(["js","javascript","script"],"script",function(t,r){"script"===t[0].tagName.toLowerCase()?(t.attr("src",t.attr("data-src")),this.config("removeAttribute")&&t.removeAttr("data-src")):r(!1)})}(window.jQuery||window.Zepto);
@@ -0,0 +1,31 @@
/*!
* jQuery & Zepto Lazy - Vimeo Plugin - v1.1
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// load vimeo video iframe, like:
// <iframe data-loader="vimeo" data-src="176894130" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
$.lazy('vimeo', function(element, response) {
if (element[0].tagName.toLowerCase() === 'iframe') {
// pass source to iframe
element.attr('src', 'https://player.vimeo.com/video/' + element.attr('data-src'));
// remove attribute
if (this.config('removeAttribute')) {
element.removeAttr('data-src');
}
}
else {
// pass error state
// use response function for Zepto
response(false);
}
});
})(window.jQuery || window.Zepto);
+2
View File
@@ -0,0 +1,2 @@
/*! jQuery & Zepto Lazy - Vimeo Plugin v1.1 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2018 Daniel 'Eisbehr' Kern */
!function(t){t.lazy("vimeo",function(t,e){"iframe"===t[0].tagName.toLowerCase()?(t.attr("src","https://player.vimeo.com/video/"+t.attr("data-src")),this.config("removeAttribute")&&t.removeAttr("data-src")):e(!1)})}(window.jQuery||window.Zepto);
@@ -0,0 +1,31 @@
/*!
* jQuery & Zepto Lazy - YouTube Plugin - v1.5
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// load youtube video iframe, like:
// <iframe data-loader="yt" data-src="1AYGnw6MwFM" data-nocookie="1" width="560" height="315" frameborder="0" allowfullscreen></iframe>
$.lazy(['yt', 'youtube'], function(element, response) {
if (element[0].tagName.toLowerCase() === 'iframe') {
// pass source to iframe
var noCookie = /1|true/.test(element.attr('data-nocookie'));
element.attr('src', 'https://www.youtube' + (noCookie ? '-nocookie' : '') + '.com/embed/' + element.attr('data-src') + '?rel=0&amp;showinfo=0');
// remove attribute
if (this.config('removeAttribute')) {
element.removeAttr('data-src');
}
}
else {
// pass error state
response(false);
}
});
})(window.jQuery || window.Zepto);
+2
View File
@@ -0,0 +1,2 @@
/*! jQuery & Zepto Lazy - YouTube Plugin v1.5 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2018 Daniel 'Eisbehr' Kern */
!function(t){t.lazy(["yt","youtube"],function(t,e){if("iframe"===t[0].tagName.toLowerCase()){var o=/1|true/.test(t.attr("data-nocookie"));t.attr("src","https://www.youtube"+(o?"-nocookie":"")+".com/embed/"+t.attr("data-src")+"?rel=0&amp;showinfo=0"),this.config("removeAttribute")&&t.removeAttr("data-src")}else e(!1)})}(window.jQuery||window.Zepto);
@@ -0,0 +1,238 @@
/*!
* jQuery Mousewheel 3.1.13
* Copyright OpenJS Foundation and other contributors
*/
( function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery" ], factory );
} else if ( typeof exports === "object" ) {
// Node/CommonJS style for Browserify
module.exports = factory;
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
var toFix = [ "wheel", "mousewheel", "DOMMouseScroll", "MozMousePixelScroll" ],
toBind = ( "onwheel" in window.document || window.document.documentMode >= 9 ) ?
[ "wheel" ] : [ "mousewheel", "DomMouseScroll", "MozMousePixelScroll" ],
slice = Array.prototype.slice,
nullLowestDeltaTimeout, lowestDelta;
if ( $.event.fixHooks ) {
for ( var i = toFix.length; i; ) {
$.event.fixHooks[ toFix[ --i ] ] = $.event.mouseHooks;
}
}
var special = $.event.special.mousewheel = {
version: "3.1.12",
setup: function() {
if ( this.addEventListener ) {
for ( var i = toBind.length; i; ) {
this.addEventListener( toBind[ --i ], handler, false );
}
} else {
this.onmousewheel = handler;
}
// Store the line height and page height for this particular element
$.data( this, "mousewheel-line-height", special.getLineHeight( this ) );
$.data( this, "mousewheel-page-height", special.getPageHeight( this ) );
},
teardown: function() {
if ( this.removeEventListener ) {
for ( var i = toBind.length; i; ) {
this.removeEventListener( toBind[ --i ], handler, false );
}
} else {
this.onmousewheel = null;
}
// Clean up the data we added to the element
$.removeData( this, "mousewheel-line-height" );
$.removeData( this, "mousewheel-page-height" );
},
getLineHeight: function( elem ) {
var $elem = $( elem ),
$parent = $elem[ "offsetParent" in $.fn ? "offsetParent" : "parent" ]();
if ( !$parent.length ) {
$parent = $( "body" );
}
return parseInt( $parent.css( "fontSize" ), 10 ) ||
parseInt( $elem.css( "fontSize" ), 10 ) || 16;
},
getPageHeight: function( elem ) {
return $( elem ).height();
},
settings: {
adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
normalizeOffset: true // calls getBoundingClientRect for each event
}
};
$.fn.extend( {
mousewheel: function( fn ) {
return fn ? this.on( "mousewheel", fn ) : this.trigger( "mousewheel" );
},
unmousewheel: function( fn ) {
return this.off( "mousewheel", fn );
}
} );
function handler( event ) {
var orgEvent = event || window.event,
args = slice.call( arguments, 1 ),
delta = 0,
deltaX = 0,
deltaY = 0,
absDelta = 0;
event = $.event.fix( orgEvent );
event.type = "mousewheel";
// Old school scrollwheel delta
if ( "detail" in orgEvent ) {
deltaY = orgEvent.detail * -1;
}
if ( "wheelDelta" in orgEvent ) {
deltaY = orgEvent.wheelDelta;
}
if ( "wheelDeltaY" in orgEvent ) {
deltaY = orgEvent.wheelDeltaY;
}
if ( "wheelDeltaX" in orgEvent ) {
deltaX = orgEvent.wheelDeltaX * -1;
}
// Firefox < 17 horizontal scrolling related to DOMMouseScroll event
if ( "axis" in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
deltaX = deltaY * -1;
deltaY = 0;
}
// Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
delta = deltaY === 0 ? deltaX : deltaY;
// New school wheel delta (wheel event)
if ( "deltaY" in orgEvent ) {
deltaY = orgEvent.deltaY * -1;
delta = deltaY;
}
if ( "deltaX" in orgEvent ) {
deltaX = orgEvent.deltaX;
if ( deltaY === 0 ) {
delta = deltaX * -1;
}
}
// No change actually happened, no reason to go any further
if ( deltaY === 0 && deltaX === 0 ) {
return;
}
// Need to convert lines and pages to pixels if we aren't already in pixels
// There are three delta modes:
// * deltaMode 0 is by pixels, nothing to do
// * deltaMode 1 is by lines
// * deltaMode 2 is by pages
if ( orgEvent.deltaMode === 1 ) {
var lineHeight = $.data( this, "mousewheel-line-height" );
delta *= lineHeight;
deltaY *= lineHeight;
deltaX *= lineHeight;
} else if ( orgEvent.deltaMode === 2 ) {
var pageHeight = $.data( this, "mousewheel-page-height" );
delta *= pageHeight;
deltaY *= pageHeight;
deltaX *= pageHeight;
}
// Store lowest absolute delta to normalize the delta values
absDelta = Math.max( Math.abs( deltaY ), Math.abs( deltaX ) );
if ( !lowestDelta || absDelta < lowestDelta ) {
lowestDelta = absDelta;
// Adjust older deltas if necessary
if ( shouldAdjustOldDeltas( orgEvent, absDelta ) ) {
lowestDelta /= 40;
}
}
// Adjust older deltas if necessary
if ( shouldAdjustOldDeltas( orgEvent, absDelta ) ) {
// Divide all the things by 40!
delta /= 40;
deltaX /= 40;
deltaY /= 40;
}
// Get a whole, normalized value for the deltas
delta = Math[ delta >= 1 ? "floor" : "ceil" ]( delta / lowestDelta );
deltaX = Math[ deltaX >= 1 ? "floor" : "ceil" ]( deltaX / lowestDelta );
deltaY = Math[ deltaY >= 1 ? "floor" : "ceil" ]( deltaY / lowestDelta );
// Normalise offsetX and offsetY properties
if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
var boundingRect = this.getBoundingClientRect();
event.offsetX = event.clientX - boundingRect.left;
event.offsetY = event.clientY - boundingRect.top;
}
// Add information to the event object
event.deltaX = deltaX;
event.deltaY = deltaY;
event.deltaFactor = lowestDelta;
// Go ahead and set deltaMode to 0 since we converted to pixels
// Although this is a little odd since we overwrite the deltaX/Y
// properties with normalized deltas.
event.deltaMode = 0;
// Add event and delta to the front of the arguments
args.unshift( event, delta, deltaX, deltaY );
// Clearout lowestDelta after sometime to better
// handle multiple device types that give different
// a different lowestDelta
// Ex: trackpad = 3 and mouse wheel = 120
if ( nullLowestDeltaTimeout ) {
window.clearTimeout( nullLowestDeltaTimeout );
}
nullLowestDeltaTimeout = window.setTimeout( nullLowestDelta, 200 );
return ( $.event.dispatch || $.event.handle ).apply( this, args );
}
function nullLowestDelta() {
lowestDelta = null;
}
function shouldAdjustOldDeltas( orgEvent, absDelta ) {
// If this is an older event and the delta is divisable by 120,
// then we are assuming that the browser is treating this as an
// older mouse wheel event and that we should divide the deltas
// by 40 to try and get a more usable deltaFactor.
// Side note, this actually impacts the reported scroll distance
// in older browsers and can cause scrolling to be slower than native.
// Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
return special.settings.adjustOldDeltas && orgEvent.type === "mousewheel" &&
absDelta % 120 === 0;
}
} );
+1
View File
@@ -0,0 +1 @@
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(h){var a,u,e=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],t="onwheel"in window.document||9<=window.document.documentMode?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],r=Array.prototype.slice;if(h.event.fixHooks)for(var n=e.length;n;)h.event.fixHooks[e[--n]]=h.event.mouseHooks;var f=h.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var e=t.length;e;)this.addEventListener(t[--e],i,!1);else this.onmousewheel=i;h.data(this,"mousewheel-line-height",f.getLineHeight(this)),h.data(this,"mousewheel-page-height",f.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=t.length;e;)this.removeEventListener(t[--e],i,!1);else this.onmousewheel=null;h.removeData(this,"mousewheel-line-height"),h.removeData(this,"mousewheel-page-height")},getLineHeight:function(e){var e=h(e),t=e["offsetParent"in h.fn?"offsetParent":"parent"]();return t.length||(t=h("body")),parseInt(t.css("fontSize"),10)||parseInt(e.css("fontSize"),10)||16},getPageHeight:function(e){return h(e).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};function i(e){var t,n=e||window.event,i=r.call(arguments,1),o=0,l=0,s=0;if((e=h.event.fix(n)).type="mousewheel","detail"in n&&(s=-1*n.detail),"wheelDelta"in n&&(s=n.wheelDelta),"wheelDeltaY"in n&&(s=n.wheelDeltaY),"wheelDeltaX"in n&&(l=-1*n.wheelDeltaX),"axis"in n&&n.axis===n.HORIZONTAL_AXIS&&(l=-1*s,s=0),o=0===s?l:s,"deltaY"in n&&(o=s=-1*n.deltaY),"deltaX"in n&&(l=n.deltaX,0===s)&&(o=-1*l),0!==s||0!==l)return 1===n.deltaMode?(o*=t=h.data(this,"mousewheel-line-height"),s*=t,l*=t):2===n.deltaMode&&(o*=t=h.data(this,"mousewheel-page-height"),s*=t,l*=t),t=Math.max(Math.abs(s),Math.abs(l)),(!u||t<u)&&w(n,u=t)&&(u/=40),w(n,t)&&(o/=40,l/=40,s/=40),o=Math[1<=o?"floor":"ceil"](o/u),l=Math[1<=l?"floor":"ceil"](l/u),s=Math[1<=s?"floor":"ceil"](s/u),f.settings.normalizeOffset&&this.getBoundingClientRect&&(n=this.getBoundingClientRect(),e.offsetX=e.clientX-n.left,e.offsetY=e.clientY-n.top),e.deltaX=l,e.deltaY=s,e.deltaFactor=u,e.deltaMode=0,i.unshift(e,o,l,s),a&&window.clearTimeout(a),a=window.setTimeout(d,200),(h.event.dispatch||h.event.handle).apply(this,i)}function d(){u=null}function w(e,t){return f.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}h.fn.extend({mousewheel:function(e){return e?this.on("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.off("mousewheel",e)}})});
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+244
View File
@@ -0,0 +1,244 @@
/*======================================
Selectric v1.13.0
======================================*/
.selectric-wrapper {
position: relative;
cursor: pointer;
}
.selectric-responsive {
width: 100%;
}
.selectric {
border: 1px solid #DDD;
border-radius: 0px;
background: #F8F8F8;
position: relative;
overflow: hidden;
}
.selectric .label {
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin: 0 38px 0 10px;
font-size: 12px;
line-height: 38px;
color: #444;
height: 38px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.selectric .button {
display: block;
position: absolute;
right: 0;
top: 0;
width: 38px;
height: 38px;
line-height: 38px;
background-color: #F8f8f8;
color: #BBB;
text-align: center;
font: 0/0 a;
*font: 20px/38px Lucida Sans Unicode, Arial Unicode MS, Arial;
}
.selectric .button:after {
content: " ";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
width: 0;
height: 0;
border: 4px solid transparent;
border-top-color: #BBB;
border-bottom: none;
}
.selectric-focus .selectric {
border-color: #aaaaaa;
}
.selectric-hover .selectric {
border-color: #c4c4c4;
}
.selectric-hover .selectric .button {
color: #a2a2a2;
}
.selectric-hover .selectric .button:after {
border-top-color: #a2a2a2;
}
.selectric-open {
z-index: 9999;
}
.selectric-open .selectric {
border-color: #c4c4c4;
}
.selectric-open .selectric-items {
display: block;
}
.selectric-disabled {
filter: alpha(opacity=50);
opacity: 0.5;
cursor: default;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.selectric-hide-select {
position: relative;
overflow: hidden;
width: 0;
height: 0;
}
.selectric-hide-select select {
position: absolute;
left: -100%;
}
.selectric-hide-select.selectric-is-native {
position: absolute;
width: 100%;
height: 100%;
z-index: 10;
}
.selectric-hide-select.selectric-is-native select {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;
border: none;
z-index: 1;
box-sizing: border-box;
opacity: 0;
}
.selectric-input {
position: absolute !important;
top: 0 !important;
left: 0 !important;
overflow: hidden !important;
clip: rect(0, 0, 0, 0) !important;
margin: 0 !important;
padding: 0 !important;
width: 1px !important;
height: 1px !important;
outline: none !important;
border: none !important;
*font: 0/0 a !important;
background: none !important;
}
.selectric-temp-show {
position: absolute !important;
visibility: hidden !important;
display: block !important;
}
/* Items box */
.selectric-items {
display: none;
position: absolute;
top: 100%;
left: 0;
background: #F8F8F8;
border: 1px solid #c4c4c4;
z-index: -1;
box-shadow: 0 0 10px -6px;
}
.selectric-items .selectric-scroll {
height: 100%;
overflow: auto;
}
.selectric-above .selectric-items {
top: auto;
bottom: 100%;
}
.selectric-items ul, .selectric-items li {
list-style: none;
padding: 0;
margin: 0;
font-size: 12px;
line-height: 20px;
min-height: 20px;
}
.selectric-items li {
display: block;
padding: 10px;
color: #666;
cursor: pointer;
}
.selectric-items li.selected {
background: #E0E0E0;
color: #444;
}
.selectric-items li.highlighted {
background: #D0D0D0;
color: #444;
}
.selectric-items li:hover {
background: #D5D5D5;
color: #444;
}
.selectric-items .disabled {
filter: alpha(opacity=50);
opacity: 0.5;
cursor: default !important;
background: none !important;
color: #666 !important;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.selectric-items .selectric-group .selectric-group-label {
font-weight: bold;
padding-left: 10px;
cursor: default;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background: none;
color: #444;
}
.selectric-items .selectric-group.disabled li {
filter: alpha(opacity=100);
opacity: 1;
}
.selectric-items .selectric-group li {
padding-left: 25px;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+572
View File
@@ -0,0 +1,572 @@
.jBox-wrapper {
text-align: left;
box-sizing: border-box;
}
.jBox-title,
.jBox-content,
.jBox-container {
position: relative;
word-break: break-word;
box-sizing: border-box;
}
.jBox-container {
background: #fff;
}
.jBox-content {
padding: 8px 12px;
overflow-x: hidden;
overflow-y: auto;
transition: opacity .2s;
}
.jBox-footer {
box-sizing: border-box;
}
.jBox-Tooltip .jBox-container,
.jBox-Mouse .jBox-container {
border-radius: 4px;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.25);
}
.jBox-Tooltip .jBox-title,
.jBox-Mouse .jBox-title {
padding: 8px 10px 0;
font-weight: bold;
}
.jBox-Tooltip.jBox-hasTitle .jBox-content,
.jBox-Mouse.jBox-hasTitle .jBox-content {
padding-top: 5px;
}
.jBox-Mouse {
pointer-events: none;
}
.jBox-pointer {
position: absolute;
overflow: hidden;
box-sizing: border-box;
}
.jBox-pointer:after {
content: '';
width: 20px;
height: 20px;
position: absolute;
background: #fff;
transform: rotate(45deg);
box-sizing: border-box;
}
.jBox-pointer-top {
top: 0;
}
.jBox-pointer-top:after {
left: 5px;
top: 6px;
box-shadow: -1px -1px 2px rgba(0, 0, 0, 0.15);
}
.jBox-pointer-right {
right: 0;
}
.jBox-pointer-right:after {
top: 5px;
right: 6px;
box-shadow: 1px -1px 2px rgba(0, 0, 0, 0.15);
}
.jBox-pointer-left {
left: 0;
}
.jBox-pointer-left:after {
top: 5px;
left: 6px;
box-shadow: -1px 1px 2px rgba(0, 0, 0, 0.15);
}
.jBox-pointer-bottom {
bottom: 0;
}
.jBox-pointer-bottom:after {
left: 5px;
bottom: 6px;
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.15);
}
.jBox-pointer-top, .jBox-pointer-bottom {
width: 30px;
height: 12px;
}
.jBox-pointer-left, .jBox-pointer-right {
width: 12px;
height: 30px;
}
.jBox-Modal .jBox-container {
border-radius: 4px;
}
.jBox-Modal .jBox-container, .jBox-Modal.jBox-closeButton-box:before {
box-shadow: 0 3px 15px rgba(0, 0, 0, 0.4), 0 0 5px rgba(0, 0, 0, 0.4);
}
.jBox-Modal .jBox-content {
padding: 15px 20px;
}
.jBox-Modal .jBox-title {
border-radius: 4px 4px 0 0;
padding: 15px 20px;
background: #fafafa;
border-bottom: 1px solid #eee;
}
.jBox-Modal.jBox-closeButton-title .jBox-title {
padding-right: 65px;
}
.jBox-Modal .jBox-footer {
border-radius: 0 0 4px 4px;
}
.jBox-closeButton {
z-index: 1;
cursor: pointer;
position: absolute;
box-sizing: border-box;
}
.jBox-closeButton svg {
position: absolute;
top: 50%;
right: 50%;
}
.jBox-closeButton path {
fill: #aaa;
transition: fill .2s;
}
.jBox-closeButton:hover path {
fill: #888;
}
.jBox-overlay .jBox-closeButton {
top: 0;
right: 0;
width: 40px;
height: 40px;
}
.jBox-overlay .jBox-closeButton svg {
width: 20px;
height: 20px;
margin-top: -10px;
margin-right: -10px;
}
.jBox-overlay .jBox-closeButton path {
fill: #ddd;
}
.jBox-overlay .jBox-closeButton:hover path {
fill: #fff;
}
.jBox-closeButton-title .jBox-closeButton {
top: 0;
right: 0;
bottom: 0;
width: 50px;
}
.jBox-closeButton-title svg {
width: 12px;
height: 12px;
margin-top: -6px;
margin-right: -6px;
}
.jBox-closeButton-box {
box-sizing: border-box;
}
.jBox-closeButton-box .jBox-closeButton {
top: -8px;
right: -10px;
width: 24px;
height: 24px;
background: #fff;
border-radius: 50%;
}
.jBox-closeButton-box .jBox-closeButton svg {
width: 10px;
height: 10px;
margin-top: -5px;
margin-right: -5px;
}
.jBox-closeButton-box:before {
content: '';
position: absolute;
top: -8px;
right: -10px;
width: 24px;
height: 24px;
border-radius: 50%;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
.jBox-closeButton-box.jBox-pointerPosition-top:before {
top: 5px;
}
.jBox-closeButton-box.jBox-pointerPosition-right:before {
right: 2px;
}
.jBox-Modal.jBox-hasTitle.jBox-closeButton-box .jBox-closeButton {
background: #fafafa;
}
.jBox-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.82);
}
.jBox-footer {
background: #fafafa;
border-top: 1px solid #eee;
padding: 8px 10px;
border-radius: 0 0 3px 3px;
}
body[class^="jBox-blockScroll-"],
body[class*=" jBox-blockScroll-"] {
overflow: hidden;
}
.jBox-draggable {
cursor: move;
}
@keyframes jBoxLoading {
to {
transform: rotate(360deg);
}
}
.jBox-loading .jBox-content {
opacity: .2;
}
.jBox-loading-spinner .jBox-content {
min-height: 38px !important;
min-width: 38px !important;
opacity: 0;
}
.jBox-spinner {
box-sizing: border-box;
position: absolute;
top: 50%;
left: 50%;
width: 24px;
height: 24px;
margin-top: -12px;
margin-left: -12px;
}
.jBox-spinner:before {
display: block;
box-sizing: border-box;
content: '';
width: 24px;
height: 24px;
border-radius: 50%;
border: 2px solid rgba(0, 0, 0, 0.2);
border-top-color: rgba(0, 0, 0, 0.8);
animation: jBoxLoading .6s linear infinite;
}
.jBox-countdown {
border-radius: 4px 4px 0 0;
z-index: 0;
background: #000;
opacity: .2;
position: absolute;
top: 0;
left: 0;
right: 0;
height: 3px;
overflow: hidden;
}
.jBox-countdown-inner {
top: 0;
right: 0;
width: 100%;
height: 3px;
position: absolute;
background: #fff;
}
[class^="jBox-animated-"],
[class*=" jBox-animated-"] {
animation-fill-mode: both;
}
@keyframes jBox-tada {
0% {
transform: scale(1);
}
10%,
20% {
transform: scale(0.8) rotate(-4deg);
}
30%,
50%,
70%,
90% {
transform: scale(1.2) rotate(4deg);
}
40%,
60%,
80% {
transform: scale(1.2) rotate(-4deg);
}
100% {
transform: scale(1) rotate(0);
}
}
.jBox-animated-tada {
animation: jBox-tada 1s;
}
@keyframes jBox-tadaSmall {
0% {
transform: scale(1);
}
10%,
20% {
transform: scale(0.9) rotate(-2deg);
}
30%,
50%,
70%,
90% {
transform: scale(1.1) rotate(2deg);
}
40%,
60%,
80% {
transform: scale(1.1) rotate(-2deg);
}
100% {
transform: scale(1) rotate(0);
}
}
.jBox-animated-tadaSmall {
animation: jBox-tadaSmall 1s;
}
@keyframes jBox-flash {
0%,
50%,
100% {
opacity: 1;
}
25%,
75% {
opacity: 0;
}
}
.jBox-animated-flash {
animation: jBox-flash .5s;
}
@keyframes jBox-shake {
0%,
100% {
transform: translateX(0);
}
20%,
60% {
transform: translateX(-6px);
}
40%,
80% {
transform: translateX(6px);
}
}
.jBox-animated-shake {
animation: jBox-shake .4s;
}
@keyframes jBox-pulseUp {
0% {
transform: scale(1);
}
50% {
transform: scale(1.15);
}
100% {
transform: scale(1);
}
}
.jBox-animated-pulseUp {
animation: jBox-pulseUp .25s;
}
@keyframes jBox-pulseDown {
0% {
transform: scale(1);
}
50% {
transform: scale(0.85);
}
100% {
transform: scale(1);
}
}
.jBox-animated-pulseDown {
animation: jBox-pulseDown .25s;
}
@keyframes jBox-popIn {
0% {
transform: scale(0);
}
50% {
transform: scale(1.1);
}
100% {
transform: scale(1);
}
}
.jBox-animated-popIn {
animation: jBox-popIn .25s;
}
@keyframes jBox-popOut {
0% {
transform: scale(1);
}
50% {
transform: scale(1.1);
}
100% {
transform: scale(0);
}
}
.jBox-animated-popOut {
animation: jBox-popOut .25s;
}
@keyframes jBox-fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.jBox-animated-fadeIn {
animation: jBox-fadeIn .2s;
}
@keyframes jBox-fadeOut {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
.jBox-animated-fadeOut {
animation: jBox-fadeOut .2s;
}
@keyframes jBox-slideUp {
0% {
transform: translateY(0);
}
100% {
transform: translateY(-300px);
opacity: 0;
}
}
.jBox-animated-slideUp {
animation: jBox-slideUp .4s;
}
@keyframes jBox-slideRight {
0% {
transform: translateX(0);
}
100% {
transform: translateX(300px);
opacity: 0;
}
}
.jBox-animated-slideRight {
animation: jBox-slideRight .4s;
}
@keyframes jBox-slideDown {
0% {
transform: translateY(0);
}
100% {
transform: translateY(300px);
opacity: 0;
}
}
.jBox-animated-slideDown {
animation: jBox-slideDown .4s;
}
@keyframes jBox-slideLeft {
0% {
transform: translateX(0);
}
100% {
transform: translateX(-300px);
opacity: 0;
}
}
.jBox-animated-slideLeft {
animation: jBox-slideLeft .4s;
}
/*# sourceMappingURL=jBox.css.map */
+2330
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,58 @@
.jBox-Confirm .jBox-content {
text-align: center;
padding: 46px 35px;
}
@media (max-width: 500px) {
.jBox-Confirm .jBox-content {
padding: 32px 20px;
}
}
.jBox-Confirm-footer {
height: 46px;
}
.jBox-Confirm-button {
display: block;
float: left;
cursor: pointer;
text-align: center;
width: 50%;
line-height: 46px;
height: 46px;
overflow: hidden;
padding: 0 10px;
transition: color .2s, background-color .2s;
box-sizing: border-box;
}
.jBox-Confirm-button-cancel {
border-bottom-left-radius: 4px;
background: #ddd;
color: #666;
}
.jBox-Confirm-button-cancel:hover, .jBox-Confirm-button-cancel:active {
background: #ccc;
}
.jBox-Confirm-button-cancel:active {
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}
.jBox-Confirm-button-submit {
border-bottom-right-radius: 4px;
background: #7d0;
color: #fff;
}
.jBox-Confirm-button-submit:hover, .jBox-Confirm-button-submit:active {
background: #6c0;
}
.jBox-Confirm-button-submit:active {
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}
/*# sourceMappingURL=jBox.Confirm.css.map */
@@ -0,0 +1,97 @@
/**
* jBox Confirm plugin: Add a confirm dialog to links, buttons, etc.
*
* Author: Stephan Wagner <stephanwagner.me@gmail.com> (https://stephanwagner.me)
*
* License: MIT (https://opensource.org/licenses/MIT)
*
* Requires: jBox (https://cdn.jsdelivr.net/gh/StephanWagner/jBox@latest/dist/jBox.min.js)
*/
function jBoxConfirmWrapper(jBox, jQuery) {
new jBox.plugin('Confirm', {
// Options (https://stephanwagner.me/jBox/options#options-confirm)
confirmButton: 'Submit', // Text for the submit button
cancelButton: 'Cancel', // Text for the cancel button
confirm: null, // Function to execute when clicking the submit button. By default jBox will use the onclick or href attribute in that order if found
cancel: null, // Function to execute when clicking the cancel button
closeOnConfirm: true, // Close jBox when the user clicks the confirm button
target: window,
fixed: true,
attach: '[data-confirm]',
getContent: 'data-confirm',
content: 'Do you really want to do this?',
minWidth: 360,
maxWidth: 500,
blockScroll: true,
closeOnEsc: true,
closeOnClick: false,
closeButton: false,
overlay: true,
animation: 'zoomIn',
preventDefault: true,
// Triggered when jBox is attached to the element
_onAttach: function (el)
{
// Extract the href or the onclick event if no submit event is passed
if (!this.options.confirm) {
var submit = el.attr('onclick') ? el.attr('onclick') : (
el.attr('href') ? (
el.attr('target') ? 'window.open("' + el.attr('href') + '", "' + el.attr('target') + '");' : 'window.location.href = "' + el.attr('href') + '";'
) : '');
el.prop('onclick', null).data('jBox-Confirm-submit', submit);
}
},
// Triggered when jBox was created
_onCreated: function ()
{
// Add modal class to mimic jBox modal
this.wrapper.addClass('jBox-Modal');
// Add a footer to the jBox container
this.footer = jQuery('<div class="jBox-Confirm-footer"/>');
jQuery('<div class="jBox-Confirm-button jBox-Confirm-button-cancel"/>')
.html(this.options.cancelButton)
.on('click tap', function () {
this.options.cancel && this.options.cancel(this.source);
this.close();
}.bind(this))
.appendTo(this.footer);
this.submitButton = jQuery('<div class="jBox-Confirm-button jBox-Confirm-button-submit"/>')
.html(this.options.confirmButton)
.appendTo(this.footer);
this.footer.appendTo(this.container);
},
// Triggered when jBox is opened
_onOpen: function ()
{
// Set the new action for the submit button
this.submitButton
.off('click.jBox-Confirm' + this.id + ' tap.jBox-Confirm' + this.id)
.on('click.jBox-Confirm' + this.id + ' tap.jBox-Confirm' + this.id, function () {
this.options.confirm ? this.options.confirm(this.source) : eval(this.source.data('jBox-Confirm-submit'));
this.options.closeOnConfirm && this.close();
}.bind(this));
}
});
};
//# sourceMappingURL=jBox.Confirm.js.map
+1
View File
@@ -0,0 +1 @@
.jBox-Confirm .jBox-content{text-align:center;padding:46px 35px}@media (max-width:500px){.jBox-Confirm .jBox-content{padding:32px 20px}}.jBox-Confirm-footer{height:46px}.jBox-Confirm-button{display:block;float:left;cursor:pointer;text-align:center;width:50%;line-height:46px;height:46px;overflow:hidden;padding:0 10px;transition:color .2s,background-color .2s;box-sizing:border-box}.jBox-Confirm-button-cancel{border-bottom-left-radius:4px;background:#ddd;color:#666}.jBox-Confirm-button-cancel:active,.jBox-Confirm-button-cancel:hover{background:#ccc}.jBox-Confirm-button-cancel:active{box-shadow:inset 0 1px 3px rgba(0,0,0,.2)}.jBox-Confirm-button-submit{border-bottom-right-radius:4px;background:#7d0;color:#fff}.jBox-Confirm-button-submit:active,.jBox-Confirm-button-submit:hover{background:#6c0}.jBox-Confirm-button-submit:active{box-shadow:inset 0 1px 3px rgba(0,0,0,.2)}
+1
View File
@@ -0,0 +1 @@
function jBoxConfirmWrapper(jBox,jQuery){new jBox.plugin("Confirm",{confirmButton:"Submit",cancelButton:"Cancel",confirm:null,cancel:null,closeOnConfirm:!0,target:window,fixed:!0,attach:"[data-confirm]",getContent:"data-confirm",content:"Do you really want to do this?",minWidth:360,maxWidth:500,blockScroll:!0,closeOnEsc:!0,closeOnClick:!1,closeButton:!1,overlay:!0,animation:"zoomIn",preventDefault:!0,_onAttach:function(o){var t;this.options.confirm||(t=o.attr("onclick")?o.attr("onclick"):o.attr("href")?o.attr("target")?'window.open("'+o.attr("href")+'", "'+o.attr("target")+'");':'window.location.href = "'+o.attr("href")+'";':"",o.prop("onclick",null).data("jBox-Confirm-submit",t))},_onCreated:function(){this.wrapper.addClass("jBox-Modal"),this.footer=jQuery('<div class="jBox-Confirm-footer"/>'),jQuery('<div class="jBox-Confirm-button jBox-Confirm-button-cancel"/>').html(this.options.cancelButton).on("click tap",function(){this.options.cancel&&this.options.cancel(this.source),this.close()}.bind(this)).appendTo(this.footer),this.submitButton=jQuery('<div class="jBox-Confirm-button jBox-Confirm-button-submit"/>').html(this.options.confirmButton).appendTo(this.footer),this.footer.appendTo(this.container)},_onOpen:function(){this.submitButton.off("click.jBox-Confirm"+this.id+" tap.jBox-Confirm"+this.id).on("click.jBox-Confirm"+this.id+" tap.jBox-Confirm"+this.id,function(){this.options.confirm?this.options.confirm(this.source):eval(this.source.data("jBox-Confirm-submit")),this.options.closeOnConfirm&&this.close()}.bind(this))}})}
+201
View File
@@ -0,0 +1,201 @@
.jBox-Image .jBox-container {
background-color: transparent;
}
.jBox-Image .jBox-content {
padding: 0;
width: 100%;
height: 100%;
}
.jBox-image-container {
background: center center no-repeat;
position: absolute;
width: 100%;
height: 100%;
opacity: 0;
}
.jBox-image-label-wrapper {
position: absolute;
top: 100%;
left: 0;
right: 0;
height: 40px;
z-index: 100;
display: flex;
}
.jBox-image-label-container {
position: relative;
flex: 1;
}
.jBox-image-label {
box-sizing: border-box;
position: absolute;
left: 0;
bottom: 0;
width: 100%;
text-align: center;
color: #fff;
padding: 8px 12px;
font-size: 15px;
line-height: 24px;
transition: opacity .36s;
opacity: 0;
z-index: 0;
pointer-events: none;
}
.jBox-image-label.expanded {
background: #000;
}
.jBox-image-label:not(.expanded) {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.jBox-image-label.active {
opacity: 1;
pointer-events: all;
}
@media (max-width: 600px) {
.jBox-image-label {
font-size: 13px;
}
}
.jBox-image-pointer-next,
.jBox-image-pointer-prev {
flex-shrink: 0;
width: 40px;
height: 40px;
cursor: pointer;
opacity: .8;
transition: opacity .2s;
background: no-repeat center center url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9Ijc0LjcgMjI0IDE4LjcgMzIiPg0KPHBhdGggZmlsbD0iI2ZmZmZmZiIgZD0iTTkzLDIyNy40TDgwLjQsMjQwTDkzLDI1Mi42YzAuNCwwLjQsMC40LDEuMSwwLDEuNWwtMS42LDEuNmMtMC40LDAuNC0xLDAuNS0xLjUsMEw3NSwyNDAuN2MtMC40LTAuNC0wLjUtMSwwLTEuNWwxNC45LTE0LjljMC40LTAuNCwxLTAuNCwxLjUsMGwxLjYsMS42QzkzLjUsMjI2LjQsOTMuNCwyMjcsOTMsMjI3LjR6Ii8+DQo8L3N2Zz4=);
background-size: 11px auto;
user-select: none;
z-index: 1;
}
.jBox-image-pointer-next:hover,
.jBox-image-pointer-prev:hover {
opacity: 1;
}
.jBox-image-pointer-next {
transform: scaleX(-1);
}
.jBox-image-counter-container {
flex-shrink: 0;
white-space: nowrap;
height: 40px;
line-height: 40px;
font-size: 13px;
color: #fff;
text-align: right;
display: none;
}
.jBox-image-has-counter .jBox-image-counter-container {
display: block;
}
.jBox-overlay.jBox-overlay-Image {
background: #000;
}
.jBox-image-not-found {
background: #000;
}
.jBox-image-not-found:before {
content: '';
box-sizing: border-box;
display: block;
width: 80px;
height: 80px;
margin-top: -40px;
margin-left: -40px;
position: absolute;
top: 50%;
left: 50%;
border: 5px solid #222;
border-radius: 50%;
}
.jBox-image-not-found:after {
content: '';
display: block;
box-sizing: content-box;
z-index: auto;
width: 6px;
height: 74px;
margin-top: -37px;
margin-left: -3px;
position: absolute;
top: 50%;
left: 50%;
background: #222;
transform: rotateZ(45deg);
transform-origin: 50% 50% 0;
}
.jBox-image-download-button-wrapper {
position: absolute;
top: -40px;
right: 35px;
height: 40px;
display: flex;
cursor: pointer;
opacity: .8;
transition: opacity .2s;
}
.jBox-image-download-button-wrapper:hover {
opacity: 1;
}
.jBox-image-download-button-icon {
width: 40px;
height: 40px;
background: center center no-repeat url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NDAgNjQwIj48cGF0aCBmaWxsPSIjRkZGRkZGIiBkPSJNNDE2IDI1NnYtMTkyaC0xOTJ2MTkyaC0xNjBsMjU2IDI1NiAyNTYtMjU2aC0xNjB6TTAgNTc2aDY0MHY2NGgtNjQwdi02NHoiPjwvcGF0aD48L3N2Zz4=);
background-size: 60%;
}
.jBox-image-download-button-text {
white-space: nowrap;
line-height: 40px;
padding: 0 10px 0 0;
color: #fff;
font-size: 14px;
}
@keyframes jBoxImageLoading {
to {
transform: rotate(360deg);
}
}
.jBox-image-loading:before {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 32px;
height: 32px;
margin-top: -16px;
margin-left: -16px;
border: 4px solid #333;
border-bottom-color: #666;
animation: jBoxImageLoading 1.2s linear infinite;
border-radius: 50%;
}
/*# sourceMappingURL=jBox.Image.css.map */
+358
View File
@@ -0,0 +1,358 @@
/**
* jBox Image plugin: Adds a lightbox to your images
*
* Author: Stephan Wagner <stephanwagner.me@gmail.com> (https://stephanwagner.me)
*
* License: MIT (https://opensource.org/licenses/MIT)
*
* Requires: jBox (https://cdn.jsdelivr.net/gh/StephanWagner/jBox@latest/dist/jBox.min.js)
*/
function jBoxImageWrapper(jBox, jQuery) {
new jBox.plugin('Image', {
// Options (https://stephanwagner.me/jBox/options#options-image)
src: 'href', // The attribute where jBox gets the image source from, e.g. href="/path_to_image/image.jpg"
gallery: 'data-jbox-image', // The attribute to set the galleries, e.g. data-jbox-image="gallery1"
imageLabel: 'title', // The attribute where jBox gets the image label from, e.g. title="My label"
imageFade: 360, // The fade duration for images in ms
imageSize: 'contain', // How to display the images. Use CSS background-position values, e.g. 'cover', 'contain', 'auto', 'initial', '50% 50%'
imageCounter: false, // Set to true to add an image counter, e.g. 4/20
imageCounterSeparator: '/', // HTML to separate the current image number from all image numbers, e.g. '/' or ' of '
downloadButton: false, // Adds a download button
downloadButtonText: null, // Text for the download button
downloadButtonUrl: null, // The attribute at the source element where to find the image to download, e.g. data-download="/path_to_image/image.jpg". If none provided, the currently active image will be downloaded
mobileImageAttr: null, // The attribute to look for an mobile version of the image
mobileImageBreakpoint: null, // The upper breakpoint to load the mobile image
preloadFirstImage: false, // Preload the first image when page is loaded
target: window,
attach: '[data-jbox-image]',
fixed: true,
blockScroll: true,
closeOnEsc: true,
closeOnClick: 'button',
closeButton: true,
overlay: true,
animation: 'zoomIn',
preventDefault: true,
width: '100%',
height: '100%',
adjustDistance: {
top: 40,
right: 0,
bottom: 40,
left: 0
},
// Triggered when jBox is initialized
_onInit: function ()
{
// Initial images and z-index
this.images = this.currentImage = {};
this.imageZIndex = 1;
this.initImage = function (item) {
item = jQuery(item);
// Abort if the item was added to a gallery already
if (item.data('jBox-image-gallery')) {
return;
}
// Get the image src
var src = item.attr(this.options.src);
// Update responsive image src
if (this.options.mobileImageAttr && this.options.mobileImageBreakpoint && item.attr(this.options.mobileImageAttr)) {
if (jQuery(window).width() <= this.options.mobileImageBreakpoint) {
src = item.attr(this.options.mobileImageAttr);
}
}
// Add item to a gallery
var gallery = item.attr(this.options.gallery) || 'default';
!this.images[gallery] && (this.images[gallery] = []);
this.images[gallery].push({
src: src,
label: (item.attr(this.options.imageLabel) || ''),
downloadUrl: this.options.downloadButtonUrl && item.attr(this.options.downloadButtonUrl) ? item.attr(this.options.downloadButtonUrl) : null
});
// Remove the title attribute so it won't show the browsers tooltip
this.options.imageLabel == 'title' && item.removeAttr('title');
// Store data in source element for easy access
item.data('jBox-image-gallery', gallery);
item.data('jBox-image-id', (this.images[gallery].length - 1));
}.bind(this);
// Loop through images, sort and save in global variable
this.attachedElements && this.attachedElements.length && jQuery.each(this.attachedElements, function (index, item) {
this.initImage(item);
}.bind(this));
// Helper to inject the image into content area
var appendImage = function (gallery, id, show, instant) {
// Abort if image was appended already
if (jQuery('#jBox-image-' + gallery + '-' + id).length) {
return;
}
// Create image container
var image = jQuery('<div/>', {
id: 'jBox-image-' + gallery + '-' + id,
'class': 'jBox-image-container' + (show ? ' jBox-image-' + gallery + '-current' : '')
}).css({
backgroundSize: this.options.imageSize,
opacity: (instant ? 1 : 0),
zIndex: (show ? this.imageZIndex++ : 0)
}).appendTo(this.content);
// Add swipe events
this.swipeDetector(image)
.on("swipeLeft.sd swipeRight.sd", function (event) {
if (event.type === "swipeLeft") {
this.showImage('next');
} else if (event.type === "swipeRight") {
this.showImage('prev');
}
}.bind(this));
// Create labels
jQuery('<div/>', {
id: 'jBox-image-label-' + gallery + '-' + id,
'class': 'jBox-image-label' + (show ? ' active' : '')
})
.html(this.images[gallery][id].label)
.on('click tap', function () {
jQuery(this).toggleClass('expanded');
})
.appendTo(this.imageLabelContainer);
// Show image
show && image.animate({opacity: 1}, instant ? 0 : this.options.imageFade);
return image;
}.bind(this);
// Function to download an image
this.downloadImage = function (imageUrl) {
var link = document.createElement('a');
link.href = imageUrl;
link.setAttribute('download', imageUrl.substring(imageUrl.lastIndexOf('/')+1));
document.body.appendChild(link);
link.click();
};
// Helper to show new image label
var showLabel = function (gallery, id) {
jQuery('.jBox-image-label.active').removeClass('active expanded');
jQuery('#jBox-image-label-' + gallery + '-' + id).addClass('active');
};
// Helper to load image
var loadImage = function (gallery, id, show, instant) {
var imageContainer = appendImage(gallery, id, show, instant);
imageContainer.addClass('jBox-image-loading');
jQuery('<img src="' + this.images[gallery][id].src + '" />').each(function () {
var tmpImg = new Image();
tmpImg.onload = function () {
imageContainer.removeClass('jBox-image-loading');
imageContainer.css({backgroundImage: 'url("' + this.images[gallery][id].src + '")'});
}.bind(this);
tmpImg.onerror = function () {
imageContainer.removeClass('jBox-image-loading');
imageContainer.addClass('jBox-image-not-found');
}.bind(this);
tmpImg.src = this.images[gallery][id].src;
}.bind(this));
}.bind(this);
// Show images when they are loaded or load them if not
this.showImage = function (img) {
// Get the gallery and the image id from the next or the previous image
var gallery;
var id;
if (img != 'open') {
gallery = this.currentImage.gallery;
id = this.currentImage.id + (1 * (img == 'prev') ? -1 : 1);
id = id > (this.images[gallery].length - 1) ? 0 : (id < 0 ? (this.images[gallery].length - 1) : id);
// Or get image data from source element
} else {
// Get gallery and image id from source element
if (this.source) {
gallery = this.source.data('jBox-image-gallery');
id = this.source.data('jBox-image-id');
// Get gallery and image id attached elements
} else if (this.attachedElements && this.attachedElements.length) {
gallery = jQuery(this.attachedElements[0]).data('jBox-image-gallery');
id = jQuery(this.attachedElements[0]).data('jBox-image-id');
} else {
return;
}
// Remove or show the next and prev buttons
if (this.images && this.images[gallery]) {
jQuery('.jBox-image-pointer-prev, .jBox-image-pointer-next').css({display: (this.images[gallery].length > 1 ? 'block' : 'none')});
}
}
// If there is a current image already shown, hide it
if (jQuery('.jBox-image-' + gallery + '-current').length) {
jQuery('.jBox-image-' + gallery + '-current').removeClass('jBox-image-' + gallery + '-current').animate({opacity: 0}, (img == 'open') ? 0 : this.options.imageFade);
}
// Set new current image
this.currentImage = {gallery: gallery, id: id};
// Show image if it already exists
if (jQuery('#jBox-image-' + gallery + '-' + id).length) {
jQuery('#jBox-image-' + gallery + '-' + id).addClass('jBox-image-' + gallery + '-current').css({zIndex: this.imageZIndex++, opacity: 0}).animate({opacity: 1}, (img == 'open') ? 0 : this.options.imageFade);
// Load image
} else {
loadImage(gallery, id, true, (img === 'open'));
}
// Show label
showLabel(gallery, id);
// Update the image counter numbers
if (this.imageCounter) {
if (this.images[gallery] && this.images[gallery].length > 1) {
this.wrapper.addClass('jBox-image-has-counter');
this.imageCounter.find('.jBox-image-counter-all').html(this.images[gallery].length);
this.imageCounter.find('.jBox-image-counter-current').html(id + 1);
} else {
this.wrapper.removeClass('jBox-image-has-counter');
}
}
// Preload next image
if (this.images[gallery] && this.images[gallery].length - 1) {
var next_id = id + 1;
next_id = next_id > (this.images[gallery].length - 1) ? 0 : (next_id < 0 ? (this.images[gallery].length - 1) : next_id);
if (!jQuery('#jBox-image-' + gallery + '-' + next_id).length) {
loadImage(gallery, next_id, false, false);
}
}
};
// Preload image
if (this.options.preloadFirstImage) {
jQuery(window).on('load', function() {
this.showImage('open');
}.bind(this));
}
},
// Triggered when jBox attaches a new element
_onAttach: function (item) {
this.initImage && this.initImage(item);
},
// Triggered when jBox was created
_onCreated: function ()
{
// Create image label and navigation buttons
this.imageLabelWrapper = jQuery('<div class="jBox-image-label-wrapper"/>').appendTo(this.wrapper);
this.imagePrevButton = jQuery('<div class="jBox-image-pointer-prev"/>')
.on('click tap', function () {
this.showImage('prev');
}.bind(this));
this.imageNextButton = jQuery('<div class="jBox-image-pointer-next"/>')
.on('click tap', function () {
this.showImage('next');
}.bind(this));
this.imageLabelContainer = jQuery('<div class="jBox-image-label-container"/>');
this.imageLabelWrapper
.append(this.imagePrevButton)
.append(this.imageLabelContainer)
.append(this.imageNextButton);
// Append the download button
if (this.options.downloadButton) {
this.downloadButton = jQuery('<div/>', {'class': 'jBox-image-download-button-wrapper'})
.appendTo(this.wrapper)
.append(
this.options.downloadButtonText ? jQuery('<div/>', {'class': 'jBox-image-download-button-text'}).html(this.options.downloadButtonText) : null
)
.append(
jQuery('<div/>', {'class': 'jBox-image-download-button-icon'})
).on('click tap', function () {
if (this.images[this.currentImage.gallery][this.currentImage.id].downloadUrl) {
var currentImageUrl = this.images[this.currentImage.gallery][this.currentImage.id].downloadUrl;
} else {
var currentImage = this.wrapper.find('.jBox-image-' + this.currentImage.gallery + '-current');
var currentImageStyle = currentImage[0].style.backgroundImage;
var currentImageUrl = currentImageStyle.slice(4, -1).replace(/["']/g, '');
}
this.downloadImage(currentImageUrl);
}.bind(this));
}
// Creating the image counter containers
if (this.options.imageCounter) {
this.imageCounter = jQuery('<div/>', {'class': 'jBox-image-counter-container'}).insertAfter(this.imageLabelContainer);
this.imageCounter.append(jQuery('<span/>', {'class': 'jBox-image-counter-current'})).append(jQuery('<span/>').html(this.options.imageCounterSeparator)).append(jQuery('<span/>', {'class': 'jBox-image-counter-all'}));
}
},
// Triggered when jBox opens
_onOpen: function ()
{
// Add key events
jQuery(document).on('keyup.jBox-Image-' + this.id, function (ev) {
(ev.keyCode == 37) && this.showImage('prev');
(ev.keyCode == 39) && this.showImage('next');
}.bind(this));
// Load the image from the attached element
this.showImage('open');
},
// Triggered when jBox closes
_onClose: function ()
{
// Remove key events
jQuery(document).off('keyup.jBox-Image-' + this.id);
},
// Triggered when jBox finished closing
_onCloseComplete: function ()
{
// Hide all image containers
this.wrapper.find('.jBox-image-container').css('opacity', 0);
}
});
};
//# sourceMappingURL=jBox.Image.js.map
+1
View File
@@ -0,0 +1 @@
.jBox-Image .jBox-container{background-color:transparent}.jBox-Image .jBox-content{padding:0;width:100%;height:100%}.jBox-image-container{background:center center no-repeat;position:absolute;width:100%;height:100%;opacity:0}.jBox-image-label-wrapper{position:absolute;top:100%;left:0;right:0;height:40px;z-index:100;display:flex}.jBox-image-label-container{position:relative;flex:1}.jBox-image-label{box-sizing:border-box;position:absolute;left:0;bottom:0;width:100%;text-align:center;color:#fff;padding:8px 12px;font-size:15px;line-height:24px;transition:opacity .36s;opacity:0;z-index:0;pointer-events:none}.jBox-image-label.expanded{background:#000}.jBox-image-label:not(.expanded){text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.jBox-image-label.active{opacity:1;pointer-events:all}@media (max-width:600px){.jBox-image-label{font-size:13px}}.jBox-image-pointer-next,.jBox-image-pointer-prev{flex-shrink:0;width:40px;height:40px;cursor:pointer;opacity:.8;transition:opacity .2s;background:no-repeat center center url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9Ijc0LjcgMjI0IDE4LjcgMzIiPg0KPHBhdGggZmlsbD0iI2ZmZmZmZiIgZD0iTTkzLDIyNy40TDgwLjQsMjQwTDkzLDI1Mi42YzAuNCwwLjQsMC40LDEuMSwwLDEuNWwtMS42LDEuNmMtMC40LDAuNC0xLDAuNS0xLjUsMEw3NSwyNDAuN2MtMC40LTAuNC0wLjUtMSwwLTEuNWwxNC45LTE0LjljMC40LTAuNCwxLTAuNCwxLjUsMGwxLjYsMS42QzkzLjUsMjI2LjQsOTMuNCwyMjcsOTMsMjI3LjR6Ii8+DQo8L3N2Zz4=);background-size:11px auto;user-select:none;z-index:1}.jBox-image-pointer-next:hover,.jBox-image-pointer-prev:hover{opacity:1}.jBox-image-pointer-next{transform:scaleX(-1)}.jBox-image-counter-container{flex-shrink:0;white-space:nowrap;height:40px;line-height:40px;font-size:13px;color:#fff;text-align:right;display:none}.jBox-image-has-counter .jBox-image-counter-container{display:block}.jBox-overlay.jBox-overlay-Image{background:#000}.jBox-image-not-found{background:#000}.jBox-image-not-found:before{content:'';box-sizing:border-box;display:block;width:80px;height:80px;margin-top:-40px;margin-left:-40px;position:absolute;top:50%;left:50%;border:5px solid #222;border-radius:50%}.jBox-image-not-found:after{content:'';display:block;box-sizing:content-box;z-index:auto;width:6px;height:74px;margin-top:-37px;margin-left:-3px;position:absolute;top:50%;left:50%;background:#222;transform:rotateZ(45deg);transform-origin:50% 50% 0}.jBox-image-download-button-wrapper{position:absolute;top:-40px;right:35px;height:40px;display:flex;cursor:pointer;opacity:.8;transition:opacity .2s}.jBox-image-download-button-wrapper:hover{opacity:1}.jBox-image-download-button-icon{width:40px;height:40px;background:center center no-repeat url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NDAgNjQwIj48cGF0aCBmaWxsPSIjRkZGRkZGIiBkPSJNNDE2IDI1NnYtMTkyaC0xOTJ2MTkyaC0xNjBsMjU2IDI1NiAyNTYtMjU2aC0xNjB6TTAgNTc2aDY0MHY2NGgtNjQwdi02NHoiPjwvcGF0aD48L3N2Zz4=);background-size:60%}.jBox-image-download-button-text{white-space:nowrap;line-height:40px;padding:0 10px 0 0;color:#fff;font-size:14px}@keyframes jBoxImageLoading{to{transform:rotate(360deg)}}.jBox-image-loading:before{content:'';position:absolute;top:50%;left:50%;width:32px;height:32px;margin-top:-16px;margin-left:-16px;border:4px solid #333;border-bottom-color:#666;animation:jBoxImageLoading 1.2s linear infinite;border-radius:50%}
File diff suppressed because one or more lines are too long
+122
View File
@@ -0,0 +1,122 @@
.jBox-Notice {
transition: margin .2s;
}
.jBox-Notice .jBox-container {
border-radius: 4px;
box-shadow: inset 1px 1px 0 0 rgba(255, 255, 255, 0.25), inset -1px -1px 0 0 rgba(0, 0, 0, 0.1);
}
.jBox-Notice .jBox-content {
border-radius: 4px;
padding: 12px 20px;
}
@media (max-width: 768px) {
.jBox-Notice .jBox-content {
padding: 10px 15px;
}
}
@media (max-width: 500px) {
.jBox-Notice .jBox-content {
padding: 8px 10px;
}
}
.jBox-Notice.jBox-hasTitle .jBox-content {
padding-top: 5px;
}
@media (max-width: 500px) {
.jBox-Notice.jBox-hasTitle .jBox-content {
padding-top: 0;
}
}
.jBox-Notice.jBox-hasTitle .jBox-title {
padding: 12px 20px 0;
font-weight: bold;
}
@media (max-width: 768px) {
.jBox-Notice.jBox-hasTitle .jBox-title {
padding: 10px 15px 0;
}
}
@media (max-width: 500px) {
.jBox-Notice.jBox-hasTitle .jBox-title {
padding: 8px 10px 0;
}
}
.jBox-Notice.jBox-closeButton-title .jBox-title {
padding-right: 55px;
}
.jBox-Notice.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton {
width: 40px;
}
.jBox-Notice.jBox-Notice-black .jBox-container {
color: #fff;
background: #000;
}
.jBox-Notice.jBox-Notice-black.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton path,
.jBox-Notice.jBox-Notice-black.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton:hover path {
fill: #fff;
}
.jBox-Notice.jBox-Notice-gray .jBox-container {
color: #222;
background: #f6f6f6;
}
.jBox-Notice.jBox-Notice-gray.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton path,
.jBox-Notice.jBox-Notice-gray.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton:hover path {
fill: #222;
}
.jBox-Notice.jBox-Notice-red .jBox-container {
color: #fff;
background: #d00;
}
.jBox-Notice.jBox-Notice-red.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton path,
.jBox-Notice.jBox-Notice-red.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton:hover path {
fill: #fff;
}
.jBox-Notice.jBox-Notice-green .jBox-container {
color: #fff;
background: #5d0;
}
.jBox-Notice.jBox-Notice-green.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton path,
.jBox-Notice.jBox-Notice-green.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton:hover path {
fill: #fff;
}
.jBox-Notice.jBox-Notice-blue .jBox-container {
color: #fff;
background: #49d;
}
.jBox-Notice.jBox-Notice-blue.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton path,
.jBox-Notice.jBox-Notice-blue.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton:hover path {
fill: #fff;
}
.jBox-Notice.jBox-Notice-yellow .jBox-container {
color: #000;
background: #fd0;
}
.jBox-Notice.jBox-Notice-yellow.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton path,
.jBox-Notice.jBox-Notice-yellow.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton:hover path {
fill: #fff;
}
/*# sourceMappingURL=jBox.Notice.css.map */
+173
View File
@@ -0,0 +1,173 @@
/**
* jBox Notice plugin: Opens a popup notice
*
* Author: Stephan Wagner <stephanwagner.me@gmail.com> (https://stephanwagner.me)
*
* License: MIT (https://opensource.org/licenses/MIT)
*
* Requires: jBox (https://cdn.jsdelivr.net/gh/StephanWagner/jBox@latest/dist/jBox.min.js)
*/
function jBoxNoticeWrapper(jBox, jQuery) {
new jBox.plugin('Notice', {
// Options (https://stephanwagner.me/jBox/options#options-notice)
color: null, // Add a color to your notices, use 'gray' (default), 'black', 'red', 'green', 'blue' or 'yellow'
stack: true, // Set to false to disable notice-stacking
stackSpacing: 10, // Spacing between notices when they stack
autoClose: 6000, // Time in ms after which the notice will disappear
attributes: { // Defines where the notice will pop up
x: 'right', // 'left' or 'right'
y: 'top' // 'top' or 'bottom'
},
position: { // Defines the distance to the viewport boundary
x: 15,
y: 15
},
responsivePositions: { // Responsive positions
500: { // The key defines the maximum width of the viewport, the values will replace the default position options
x: 5, // Start with the lowest viewport
y: 5
},
768: {
x: 10,
y: 10
}
},
target: window,
fixed: true,
animation: 'zoomIn',
closeOnClick: 'box',
zIndex: 12000,
// Triggered when notice is initialized
_onInit: function ()
{
// Cache position values
this.defaultNoticePosition = jQuery.extend({}, this.options.position);
// Type Notice has its own adjust position function
this._adjustNoticePositon = function () {
var win = jQuery(window);
var windowDimensions = {
x: win.width(),
y: win.height()
};
// Reset default position
this.options.position = jQuery.extend({}, this.defaultNoticePosition);
// Adjust depending on viewport
jQuery.each(this.options.responsivePositions, function (viewport, position) {
if (windowDimensions.x <= viewport) {
this.options.position = position;
return false;
}
}.bind(this));
// Set new padding options
this.options.adjustDistance = {
top: this.options.position.y,
right: this.options.position.x,
bottom: this.options.position.y,
left: this.options.position.x
};
};
// If jBox grabs an element as content, crab a clone instead
this.options.content instanceof jQuery && (this.options.content = this.options.content.clone().attr('id', ''));
// Adjust paddings when window resizes
jQuery(window).on('resize.responsivejBoxNotice-' + this.id, function (ev) { if (this.isOpen) { this._adjustNoticePositon(); } }.bind(this));
this.open();
},
// Triggered when notice was created
_onCreated: function ()
{
// Add color class
this.wrapper.addClass('jBox-Notice-color jBox-Notice-' + (this.options.color || 'gray'));
// Store position in jBox wrapper
this.wrapper.data('jBox-Notice-position', this.options.attributes.x + '-' + this.options.attributes.y);
},
// Triggered when notice opens
_onOpen: function ()
{
// Bail if we're stacking
if (this.options.stack) {
return;
}
// Adjust position when opening
this._adjustNoticePositon();
// Loop through notices at same window corner destroy them
jQuery.each(jQuery('.jBox-Notice'), function (index, el)
{
el = jQuery(el);
// Abort if the element is this notice or when it's not at the same position
if (el.attr('id') == this.id || el.data('jBox-Notice-position') != this.options.attributes.x + '-' + this.options.attributes.y) {
return;
}
// Remove notice when we don't wont to stack them
if (!this.options.stack) {
el.data('jBox').close({ignoreDelay: true});
return;
}
}.bind(this));
},
// Triggered when resizing window etc.
_onPosition: function ()
{
var stacks = {};
jQuery.each(jQuery('.jBox-Notice'), function (index, el)
{
el = jQuery(el);
var pos = el.data('jBox-Notice-position');
if (!stacks[pos]) {
stacks[pos] = [];
}
stacks[pos].push(el);
});
for (var pos in stacks) {
var position = pos.split('-');
var direction = position[1];
stacks[pos].reverse();
var margin = 0;
for (var i in stacks[pos]) {
var el = jQuery(stacks[pos][i]);
el.css('margin-' + direction, margin);
margin += el.outerHeight() + this.options.stackSpacing;
}
}
},
// Remove notice from DOM and reposition other notices when closing finishes
_onCloseComplete: function ()
{
this.destroy();
this.options._onPosition.bind(this).call();
}
});
};
//# sourceMappingURL=jBox.Notice.js.map
+1
View File
@@ -0,0 +1 @@
.jBox-Notice{transition:margin .2s}.jBox-Notice .jBox-container{border-radius:4px;box-shadow:inset 1px 1px 0 0 rgba(255,255,255,.25),inset -1px -1px 0 0 rgba(0,0,0,.1)}.jBox-Notice .jBox-content{border-radius:4px;padding:12px 20px}@media (max-width:768px){.jBox-Notice .jBox-content{padding:10px 15px}}@media (max-width:500px){.jBox-Notice .jBox-content{padding:8px 10px}}.jBox-Notice.jBox-hasTitle .jBox-content{padding-top:5px}@media (max-width:500px){.jBox-Notice.jBox-hasTitle .jBox-content{padding-top:0}}.jBox-Notice.jBox-hasTitle .jBox-title{padding:12px 20px 0;font-weight:700}@media (max-width:768px){.jBox-Notice.jBox-hasTitle .jBox-title{padding:10px 15px 0}}@media (max-width:500px){.jBox-Notice.jBox-hasTitle .jBox-title{padding:8px 10px 0}}.jBox-Notice.jBox-closeButton-title .jBox-title{padding-right:55px}.jBox-Notice.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton{width:40px}.jBox-Notice.jBox-Notice-black .jBox-container{color:#fff;background:#000}.jBox-Notice.jBox-Notice-black.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton path,.jBox-Notice.jBox-Notice-black.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton:hover path{fill:#fff}.jBox-Notice.jBox-Notice-gray .jBox-container{color:#222;background:#f6f6f6}.jBox-Notice.jBox-Notice-gray.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton path,.jBox-Notice.jBox-Notice-gray.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton:hover path{fill:#222}.jBox-Notice.jBox-Notice-red .jBox-container{color:#fff;background:#d00}.jBox-Notice.jBox-Notice-red.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton path,.jBox-Notice.jBox-Notice-red.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton:hover path{fill:#fff}.jBox-Notice.jBox-Notice-green .jBox-container{color:#fff;background:#5d0}.jBox-Notice.jBox-Notice-green.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton path,.jBox-Notice.jBox-Notice-green.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton:hover path{fill:#fff}.jBox-Notice.jBox-Notice-blue .jBox-container{color:#fff;background:#49d}.jBox-Notice.jBox-Notice-blue.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton path,.jBox-Notice.jBox-Notice-blue.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton:hover path{fill:#fff}.jBox-Notice.jBox-Notice-yellow .jBox-container{color:#000;background:#fd0}.jBox-Notice.jBox-Notice-yellow.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton path,.jBox-Notice.jBox-Notice-yellow.jBox-closeButton-title.jBox-hasTitle .jBox-closeButton:hover path{fill:#fff}
+1
View File
@@ -0,0 +1 @@
function jBoxNoticeWrapper(t,a){new t.plugin("Notice",{color:null,stack:!0,stackSpacing:10,autoClose:6e3,attributes:{x:"right",y:"top"},position:{x:15,y:15},responsivePositions:{500:{x:5,y:5},768:{x:10,y:10}},target:window,fixed:!0,animation:"zoomIn",closeOnClick:"box",zIndex:12e3,_onInit:function(){this.defaultNoticePosition=a.extend({},this.options.position),this._adjustNoticePositon=function(){var t=a(window),o=t.width();t.height();this.options.position=a.extend({},this.defaultNoticePosition),a.each(this.options.responsivePositions,function(t,i){if(o<=t)return this.options.position=i,!1}.bind(this)),this.options.adjustDistance={top:this.options.position.y,right:this.options.position.x,bottom:this.options.position.y,left:this.options.position.x}},this.options.content instanceof a&&(this.options.content=this.options.content.clone().attr("id","")),a(window).on("resize.responsivejBoxNotice-"+this.id,function(t){this.isOpen&&this._adjustNoticePositon()}.bind(this)),this.open()},_onCreated:function(){this.wrapper.addClass("jBox-Notice-color jBox-Notice-"+(this.options.color||"gray")),this.wrapper.data("jBox-Notice-position",this.options.attributes.x+"-"+this.options.attributes.y)},_onOpen:function(){this.options.stack||(this._adjustNoticePositon(),a.each(a(".jBox-Notice"),function(t,i){(i=a(i)).attr("id")!=this.id&&i.data("jBox-Notice-position")==this.options.attributes.x+"-"+this.options.attributes.y&&(this.options.stack||i.data("jBox").close({ignoreDelay:!0}))}.bind(this)))},_onPosition:function(){var t,s={};for(t in a.each(a(".jBox-Notice"),function(t,i){var o=(i=a(i)).data("jBox-Notice-position");s[o]||(s[o]=[]),s[o].push(i)}),s){var i=t.split("-")[1];s[t].reverse();var o,n=0;for(o in s[t]){var e=a(s[t][o]);e.css("margin-"+i,n),n+=e.outerHeight()+this.options.stackSpacing}}},_onCloseComplete:function(){this.destroy(),this.options._onPosition.bind(this).call()}})}
@@ -0,0 +1,49 @@
.jBox-NoticeFancy .jBox-content,
.jBox-NoticeFancy .jBox-title {
padding-left: 25px;
}
.jBox-NoticeFancy.jBox-Notice-color .jBox-container {
color: #fff;
background: #000;
}
.jBox-NoticeFancy.jBox-Notice-color .jBox-container:after {
content: '';
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 8px;
border-radius: 4px 0 0 4px;
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.4) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.4) 50%, rgba(255, 255, 255, 0.4) 75%, transparent 75%, transparent);
background-size: 14px 14px;
}
.jBox-NoticeFancy.jBox-Notice-black .jBox-container:after,
.jBox-NoticeFancy.jBox-Notice-gray .jBox-container:after {
background-color: #888;
}
.jBox-NoticeFancy.jBox-Notice-red .jBox-container:after {
background-color: #e00;
}
.jBox-NoticeFancy.jBox-Notice-green .jBox-container:after {
background-color: #6c0;
}
.jBox-NoticeFancy.jBox-Notice-blue .jBox-container:after {
background-color: #49d;
}
.jBox-NoticeFancy.jBox-Notice-yellow .jBox-container:after {
background-color: #fb0;
}
.jBox-NoticeFancy .jBox-countdown {
left: 8px;
border-radius: 0 4px 0 0;
}
/*# sourceMappingURL=jBox.NoticeFancy.css.map */
+1
View File
@@ -0,0 +1 @@
.jBox-NoticeFancy .jBox-content,.jBox-NoticeFancy .jBox-title{padding-left:25px}.jBox-NoticeFancy.jBox-Notice-color .jBox-container{color:#fff;background:#000}.jBox-NoticeFancy.jBox-Notice-color .jBox-container:after{content:'';position:absolute;top:0;left:0;bottom:0;width:8px;border-radius:4px 0 0 4px;background-image:linear-gradient(45deg,rgba(255,255,255,.4) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.4) 50%,rgba(255,255,255,.4) 75%,transparent 75%,transparent);background-size:14px 14px}.jBox-NoticeFancy.jBox-Notice-black .jBox-container:after,.jBox-NoticeFancy.jBox-Notice-gray .jBox-container:after{background-color:#888}.jBox-NoticeFancy.jBox-Notice-red .jBox-container:after{background-color:#e00}.jBox-NoticeFancy.jBox-Notice-green .jBox-container:after{background-color:#6c0}.jBox-NoticeFancy.jBox-Notice-blue .jBox-container:after{background-color:#49d}.jBox-NoticeFancy.jBox-Notice-yellow .jBox-container:after{background-color:#fb0}.jBox-NoticeFancy .jBox-countdown{left:8px;border-radius:0 4px 0 0}
@@ -0,0 +1,39 @@
.jBox-TooltipBorder .jBox-container,
.jBox-TooltipBorder .jBox-pointer:after {
border: 2px solid #49d;
}
.jBox-TooltipBorder .jBox-pointer:after {
width: 22px;
height: 22px;
}
.jBox-TooltipBorder .jBox-pointer-top,
.jBox-TooltipBorder .jBox-pointer-bottom {
width: 34px;
height: 13px;
}
.jBox-TooltipBorder .jBox-pointer-top:after,
.jBox-TooltipBorder .jBox-pointer-bottom:after {
left: 6px;
}
.jBox-TooltipBorder .jBox-pointer-left,
.jBox-TooltipBorder .jBox-pointer-right {
width: 13px;
height: 34px;
}
.jBox-TooltipBorder .jBox-pointer-left:after,
.jBox-TooltipBorder .jBox-pointer-right:after {
top: 6px;
}
.jBox-TooltipBorder.jBox-closeButton-box:before {
width: 28px;
height: 28px;
background: #49d;
}
/*# sourceMappingURL=jBox.TooltipBorder.css.map */
+1
View File
@@ -0,0 +1 @@
.jBox-TooltipBorder .jBox-container,.jBox-TooltipBorder .jBox-pointer:after{border:2px solid #49d}.jBox-TooltipBorder .jBox-pointer:after{width:22px;height:22px}.jBox-TooltipBorder .jBox-pointer-bottom,.jBox-TooltipBorder .jBox-pointer-top{width:34px;height:13px}.jBox-TooltipBorder .jBox-pointer-bottom:after,.jBox-TooltipBorder .jBox-pointer-top:after{left:6px}.jBox-TooltipBorder .jBox-pointer-left,.jBox-TooltipBorder .jBox-pointer-right{width:13px;height:34px}.jBox-TooltipBorder .jBox-pointer-left:after,.jBox-TooltipBorder .jBox-pointer-right:after{top:6px}.jBox-TooltipBorder.jBox-closeButton-box:before{width:28px;height:28px;background:#49d}
@@ -0,0 +1,32 @@
.jBox-TooltipBorderThick .jBox-container {
box-shadow: none;
border-radius: 8px;
border: 4px solid #ccc;
}
.jBox-TooltipBorderThick .jBox-pointer:after {
box-shadow: none;
border: 4px solid #ccc;
width: 24px;
height: 24px;
}
.jBox-TooltipBorderThick .jBox-pointer-top,
.jBox-TooltipBorderThick .jBox-pointer-bottom {
width: 38px;
height: 13px;
}
.jBox-TooltipBorderThick .jBox-pointer-left,
.jBox-TooltipBorderThick .jBox-pointer-right {
width: 13px;
height: 38px;
}
.jBox-TooltipBorderThick.jBox-closeButton-box:before {
width: 32px;
height: 32px;
background: #ccc;
}
/*# sourceMappingURL=jBox.TooltipBorderThick.css.map */
@@ -0,0 +1 @@
.jBox-TooltipBorderThick .jBox-container{box-shadow:none;border-radius:8px;border:4px solid #ccc}.jBox-TooltipBorderThick .jBox-pointer:after{box-shadow:none;border:4px solid #ccc;width:24px;height:24px}.jBox-TooltipBorderThick .jBox-pointer-bottom,.jBox-TooltipBorderThick .jBox-pointer-top{width:38px;height:13px}.jBox-TooltipBorderThick .jBox-pointer-left,.jBox-TooltipBorderThick .jBox-pointer-right{width:13px;height:38px}.jBox-TooltipBorderThick.jBox-closeButton-box:before{width:32px;height:32px;background:#ccc}
@@ -0,0 +1,32 @@
.jBox-TooltipDark .jBox-container {
border-radius: 4px;
background: #000;
color: #fff;
box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}
.jBox-TooltipDark .jBox-pointer:after {
background: #000;
}
.jBox-TooltipDark .jBox-closeButton {
background: #000;
}
.jBox-TooltipDark.jBox-closeButton-box:before {
box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}
.jBox-TooltipDark.jBox-closeButton-box .jBox-closeButton path {
fill: #ddd;
}
.jBox-TooltipDark.jBox-closeButton-box .jBox-closeButton:hover path {
fill: #fff;
}
.jBox-TooltipDark.jBox-closeButton-box .jBox-closeButton:active path {
fill: #bbb;
}
/*# sourceMappingURL=jBox.TooltipDark.css.map */
+1
View File
@@ -0,0 +1 @@
.jBox-TooltipDark .jBox-container{border-radius:4px;background:#000;color:#fff;box-shadow:0 0 6px rgba(0,0,0,.4)}.jBox-TooltipDark .jBox-pointer:after{background:#000}.jBox-TooltipDark .jBox-closeButton{background:#000}.jBox-TooltipDark.jBox-closeButton-box:before{box-shadow:0 0 6px rgba(0,0,0,.4)}.jBox-TooltipDark.jBox-closeButton-box .jBox-closeButton path{fill:#ddd}.jBox-TooltipDark.jBox-closeButton-box .jBox-closeButton:hover path{fill:#fff}.jBox-TooltipDark.jBox-closeButton-box .jBox-closeButton:active path{fill:#bbb}
@@ -0,0 +1,54 @@
.jBox-TooltipError {
pointer-events: none;
}
.jBox-TooltipError .jBox-container {
border-radius: 2px;
background: #d00;
color: #fff;
font-weight: bold;
font-size: 13px;
}
.jBox-TooltipError .jBox-content {
padding: 0 10px;
line-height: 28px;
}
.jBox-TooltipError .jBox-pointer:after {
background: #d00;
width: 20px;
height: 20px;
}
.jBox-TooltipError .jBox-pointer-top, .jBox-TooltipError .jBox-pointer-bottom {
width: 22px;
height: 8px;
}
.jBox-TooltipError .jBox-pointer-right, .jBox-TooltipError .jBox-pointer-left {
width: 8px;
height: 22px;
}
.jBox-TooltipError .jBox-pointer-top:after {
left: 1px;
top: 6px;
}
.jBox-TooltipError .jBox-pointer-right:after {
top: 1px;
right: 6px;
}
.jBox-TooltipError .jBox-pointer-bottom:after {
left: 1px;
bottom: 6px;
}
.jBox-TooltipError .jBox-pointer-left:after {
top: 1px;
left: 6px;
}
/*# sourceMappingURL=jBox.TooltipError.css.map */
+1
View File
@@ -0,0 +1 @@
.jBox-TooltipError{pointer-events:none}.jBox-TooltipError .jBox-container{border-radius:2px;background:#d00;color:#fff;font-weight:700;font-size:13px}.jBox-TooltipError .jBox-content{padding:0 10px;line-height:28px}.jBox-TooltipError .jBox-pointer:after{background:#d00;width:20px;height:20px}.jBox-TooltipError .jBox-pointer-bottom,.jBox-TooltipError .jBox-pointer-top{width:22px;height:8px}.jBox-TooltipError .jBox-pointer-left,.jBox-TooltipError .jBox-pointer-right{width:8px;height:22px}.jBox-TooltipError .jBox-pointer-top:after{left:1px;top:6px}.jBox-TooltipError .jBox-pointer-right:after{top:1px;right:6px}.jBox-TooltipError .jBox-pointer-bottom:after{left:1px;bottom:6px}.jBox-TooltipError .jBox-pointer-left:after{top:1px;left:6px}
@@ -0,0 +1,49 @@
.jBox-TooltipSmall {
pointer-events: none;
}
.jBox-TooltipSmall .jBox-container {
border-radius: 2px;
}
.jBox-TooltipSmall .jBox-content {
padding: 0 10px;
line-height: 28px;
}
.jBox-TooltipSmall .jBox-pointer:after {
width: 20px;
height: 20px;
}
.jBox-TooltipSmall .jBox-pointer-top, .jBox-TooltipSmall .jBox-pointer-bottom {
width: 22px;
height: 8px;
}
.jBox-TooltipSmall .jBox-pointer-right, .jBox-TooltipSmall .jBox-pointer-left {
width: 8px;
height: 22px;
}
.jBox-TooltipSmall .jBox-pointer-top:after {
left: 1px;
top: 6px;
}
.jBox-TooltipSmall .jBox-pointer-right:after {
top: 1px;
right: 6px;
}
.jBox-TooltipSmall .jBox-pointer-bottom:after {
left: 1px;
bottom: 6px;
}
.jBox-TooltipSmall .jBox-pointer-left:after {
top: 1px;
left: 6px;
}
/*# sourceMappingURL=jBox.TooltipSmall.css.map */
+1
View File
@@ -0,0 +1 @@
.jBox-TooltipSmall{pointer-events:none}.jBox-TooltipSmall .jBox-container{border-radius:2px}.jBox-TooltipSmall .jBox-content{padding:0 10px;line-height:28px}.jBox-TooltipSmall .jBox-pointer:after{width:20px;height:20px}.jBox-TooltipSmall .jBox-pointer-bottom,.jBox-TooltipSmall .jBox-pointer-top{width:22px;height:8px}.jBox-TooltipSmall .jBox-pointer-left,.jBox-TooltipSmall .jBox-pointer-right{width:8px;height:22px}.jBox-TooltipSmall .jBox-pointer-top:after{left:1px;top:6px}.jBox-TooltipSmall .jBox-pointer-right:after{top:1px;right:6px}.jBox-TooltipSmall .jBox-pointer-bottom:after{left:1px;bottom:6px}.jBox-TooltipSmall .jBox-pointer-left:after{top:1px;left:6px}
@@ -0,0 +1,53 @@
.jBox-TooltipSmallGray {
pointer-events: none;
}
.jBox-TooltipSmallGray .jBox-container {
font-size: 13px;
line-height: 24px;
border-radius: 12px;
background-image: linear-gradient(to bottom, #fafafa, #f2f2f2);
}
.jBox-TooltipSmallGray .jBox-content {
padding: 0 10px;
}
.jBox-TooltipSmallGray .jBox-pointer:after {
width: 20px;
height: 20px;
}
.jBox-TooltipSmallGray .jBox-pointer-top, .jBox-TooltipSmallGray .jBox-pointer-bottom {
width: 22px;
height: 8px;
}
.jBox-TooltipSmallGray .jBox-pointer-left, .jBox-TooltipSmallGray .jBox-pointer-right {
width: 8px;
height: 22px;
}
.jBox-TooltipSmallGray .jBox-pointer-top:after {
background: #fafafa;
left: 1px;
top: 6px;
}
.jBox-TooltipSmallGray .jBox-pointer-right:after {
top: 1px;
right: 6px;
}
.jBox-TooltipSmallGray .jBox-pointer-bottom:after {
background: #f2f2f2;
left: 1px;
bottom: 6px;
}
.jBox-TooltipSmallGray .jBox-pointer-left:after {
top: 1px;
left: 6px;
}
/*# sourceMappingURL=jBox.TooltipSmallGray.css.map */
@@ -0,0 +1 @@
.jBox-TooltipSmallGray{pointer-events:none}.jBox-TooltipSmallGray .jBox-container{font-size:13px;line-height:24px;border-radius:12px;background-image:linear-gradient(to bottom,#fafafa,#f2f2f2)}.jBox-TooltipSmallGray .jBox-content{padding:0 10px}.jBox-TooltipSmallGray .jBox-pointer:after{width:20px;height:20px}.jBox-TooltipSmallGray .jBox-pointer-bottom,.jBox-TooltipSmallGray .jBox-pointer-top{width:22px;height:8px}.jBox-TooltipSmallGray .jBox-pointer-left,.jBox-TooltipSmallGray .jBox-pointer-right{width:8px;height:22px}.jBox-TooltipSmallGray .jBox-pointer-top:after{background:#fafafa;left:1px;top:6px}.jBox-TooltipSmallGray .jBox-pointer-right:after{top:1px;right:6px}.jBox-TooltipSmallGray .jBox-pointer-bottom:after{background:#f2f2f2;left:1px;bottom:6px}.jBox-TooltipSmallGray .jBox-pointer-left:after{top:1px;left:6px}