mirror of
https://bitbucket.org/bellord13/kit.git
synced 2026-11-13 19:06:11 +03:00
fix
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
.DS_Store
|
||||
|
||||
#### LANG
|
||||
/.lein-repl-history
|
||||
/repl
|
||||
/node_modules
|
||||
|
||||
#### IDE
|
||||
/.project
|
||||
/.classpath
|
||||
/.buildpath
|
||||
/.settings/
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
language: node_js
|
||||
@@ -0,0 +1,134 @@
|
||||
jqModal Changes By Release
|
||||
==========================
|
||||
|
||||
## 1.4.2 (2016.04.16 +r27)
|
||||
|
||||
* restore parsing and assigning closeClass behavior in ajax loaded content
|
||||
* update examples/ajax.php to include a closeClass element
|
||||
* linting love
|
||||
|
||||
|
||||
## 1.4.1 (2015.09.07 +r26)
|
||||
|
||||
* remove legacy jquery.plugin.json
|
||||
* release on npm
|
||||
|
||||
## 1.4.0 (2015.08.16 +r25)
|
||||
|
||||
* new convention: use 'e' for event, 'm' for modal element, 80 cols max.
|
||||
* preventDefault to cancel click behavior in trigger functions, thanks @ayyash
|
||||
* strict javascript linting, thanks @paladox
|
||||
* add travis-ci integration
|
||||
|
||||
## 1.3.0 (2015.04.15 +r24)
|
||||
|
||||
* immediately show ajax modals
|
||||
|
||||
## 1.2.1 (2015.04.01 +r23)
|
||||
|
||||
* fix: allow focus in active modals
|
||||
* improve example, include modal:true demo
|
||||
|
||||
## 1.2.0 (2015.02.26 +r22)
|
||||
|
||||
* new: pass event to $.jqm.focusFunc
|
||||
* fix: pass active modal DOM object to $.jqm.focusFunc
|
||||
|
||||
## 1.1.0 (2014.07.03 +r21)
|
||||
|
||||
* allow modification of a signle option with subsequent $.jqm() calls -- do not extend with default $.jqm.params.
|
||||
* simplify addTrigger method and ensure subsequent calls don't append additional click events to triggers.
|
||||
|
||||
## 1.0.3 (2014.07.02 +r20)
|
||||
|
||||
* subsequent calls to $.jqm() extend options as expected - thanks @earbash
|
||||
* added ajax and option overriding to examples
|
||||
|
||||
## 1.0.2 (2014.04.10 +r19)
|
||||
|
||||
* fixed registration / jQuery NoConflict - thanks @mitja-p
|
||||
|
||||
## 1.0.1 (2014.03.27 +r18)
|
||||
|
||||
* strict mode fix - thanks @Piokaz
|
||||
|
||||
## 1.0.0 (2014.01.30 +r17)
|
||||
|
||||
* focus function is now overridable via $.jqm.focusFunc
|
||||
* re-implement r14, r13 changes [fork rewrite was of previous version]
|
||||
|
||||
|
||||
## r16 2014.01.28
|
||||
|
||||
* entirely rewritten; now human readable and compatible with latest jQuery versions (1.11.0, 2.1.0)
|
||||
* bumped minimum jQuery version requirement to 1.2.3 (for jQuery.data())
|
||||
* removed automatic IE6 activeX/iframe bleed-through fixes
|
||||
* onShow callback is now responsible for displaying modal as well as overlay
|
||||
* onHide callback is now responsible for removing the overlay as well as modal
|
||||
* returning false in callbacks now halts behavior (e.g. stop the showing of a modal by returning false in onShow)
|
||||
* moved to github to improve maintenance and community development
|
||||
|
||||
|
||||
## r15 2013.08.04
|
||||
|
||||
* jQuery 1.9+ compatibility fix by [Yoosuf Muhammad](https://github.com/eyoosuf)
|
||||
|
||||
|
||||
## r14 2009.03.01
|
||||
|
||||
|
||||
* smart detection of the triggering element. The event context is now always passed to $.jqmShow() and $.jqmHide(). Makes "live querying" modal triggers easier for some.
|
||||
|
||||
|
||||
## r13 2008.07.06
|
||||
|
||||
* Minor code optimizations
|
||||
* Fixed potential exception in modal focus routine
|
||||
* Overlays of modal dialogs are no longer automatically styled with a "wait" cursor. Use CSS to control
|
||||
* Exposed overiding of default parameter values via the $.jqm.params global
|
||||
|
||||
## r12 2008.06.22
|
||||
|
||||
* Now dual licensed under the MIT and GPL licenses
|
||||
* Compatibility with jQuery 1.2.6
|
||||
* Removed zIndex parameter
|
||||
* Subsequent $.jqm calls now update configuration
|
||||
* AJAX target is now cleared before load
|
||||
* Added ajaxText parameter
|
||||
|
||||
## r11 2007.08.17
|
||||
|
||||
* added toTop argument to break z-Index container restraints (<a href="toTop.html">demo</a>)
|
||||
* improved focus method tolerance
|
||||
* overlay now takes z-Index stacking order precedence
|
||||
|
||||
|
||||
## r10 2007.07.30
|
||||
|
||||
* focus element re-calculated every modal click to prevent IE error
|
||||
* ie6 sets body width to 100%
|
||||
* Require fixed pushStack,$.browser.version -- jQuery 1.1.3.1 MINIMUM!
|
||||
* compressible with a javascript packer
|
||||
* HTTPS/SSL served iFrame content will not throw warnings in IE
|
||||
|
||||
|
||||
## r9 2007.02.25, r8 2007.02.24
|
||||
|
||||
* Updated CSS, Sync up.
|
||||
* Fixed IE crash when ajax loaded elements used as trigger(s)
|
||||
* IE6 - overlay now covers dialog only, allowing page interaction when overlay: 0
|
||||
|
||||
|
||||
## r7 2007.02.23
|
||||
|
||||
* Added $.jqmShow, $.jqmHide to manually hide/show dialogs
|
||||
* Added $.jqmAddTrigger and $.jqmAddClose to bind show/hide to elements
|
||||
* Added onLoad callback (called after ajax return)
|
||||
* Added support for handling multiple dialogs @ once across ALL functions
|
||||
* Removed auto-fire parameter, replaced via $(e).jqm().jqmShow()
|
||||
* Removed $.jqmClose()
|
||||
* Removed "wrapClass" parameter, updated base CSS
|
||||
* CSS z-index value takes priority over "zIndex" parameter
|
||||
* Triggers can hide, show, or hide AND show jqModals
|
||||
* Overlays+IE6 iframe are now fixed positioned - support for ie6 quirks + standards mode
|
||||
* Internal Improvements, no event data
|
||||
@@ -0,0 +1,278 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
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.
|
||||
@@ -0,0 +1,20 @@
|
||||
Copyright (c) 2014 Brice Burgess, http://jquery.iceburg.net/jqmodal
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,127 @@
|
||||
jqModal
|
||||
=======
|
||||
|
||||
jqModal is a plugin for jQuery to help you display modals, popups, and notices. It is flexible and tiny, akin to a "Swiss Army Knife", and provides a great base for your windowing needs.
|
||||
|
||||
|
||||
Features
|
||||
========
|
||||
|
||||
* Designer Frieldly - Use *your* HTML+CSS for Layout and Styling
|
||||
* Translator/i18n friendly - No hardcoded English strings
|
||||
* Developer friendly - Extensible through callbacks to make anything possible (gallery slideshows, video-conferencing, &c)
|
||||
* Simple support for remotely loaded content (aka "ajax")
|
||||
* Multiple Modals per page (including nested Modal-in-Modal)
|
||||
* Supported by all browsers capable of running jQuery 1.2.3+
|
||||
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
markup
|
||||
```html
|
||||
<a
|
||||
class="button"
|
||||
data-modal="{{ video_id }}" href="$//www.youtube.com/embed/{{ video_id }}">
|
||||
Watch</a>
|
||||
|
||||
<div class="modal-dialog modal-video" data-modal="{{ video_id }}">
|
||||
<iframe
|
||||
width="560"
|
||||
height="315"
|
||||
src="//www.youtube.com/embed/{{ video_id }}"
|
||||
frameborder="0"
|
||||
allowfullscreen></iframe>
|
||||
</div>
|
||||
|
||||
```
|
||||
|
||||
script
|
||||
|
||||
```js
|
||||
$('div.modal-dialog').each(function(){
|
||||
|
||||
var modal_id = this.id || $(this).data('modal');
|
||||
var trigger = $('a.modal-trigger[data-modal="' + modal_id + '"]');
|
||||
|
||||
$(this).jqm({
|
||||
toTop: true,
|
||||
trigger: trigger
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
styling
|
||||
```css
|
||||
div.modal-dialog {
|
||||
display: none;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
margin-left: -288px;
|
||||
padding: 6px 0;
|
||||
position: fixed;
|
||||
text-align: center;
|
||||
top: 17%;
|
||||
width: 576px;
|
||||
background: #FFF;
|
||||
}
|
||||
|
||||
div.modal-dialog.modal-video {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
div.jqmOverlay {
|
||||
/* background-color: #FFF; */ /* lighten background */
|
||||
background-color: #000; /* darken background */
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
Read the documenttion and more at http://jquery.iceburg.net/jqModal
|
||||
|
||||
See [Examples / Demonstration](http://jquery.iceburg.net/jqModal/#examples)
|
||||
|
||||
|
||||
Development
|
||||
=============
|
||||
|
||||
Development of jqModal occurs in the -master branch on [jqModal.js](https://github.com/briceburg/jqModal/blob/master/jqModal.js).
|
||||
The [CHANGELOG.md](https://github.com/briceburg/jqModal/blob/master/CHANGELOG.md) is to be kept up to date with changes.
|
||||
|
||||
|
||||
## Release Process
|
||||
|
||||
* Version jqModal.js header `<semver> (YYYY.MM.DD +r<revision>)`
|
||||
* Update package.json, bumping <semver> version
|
||||
* Ensure changelog is up to date
|
||||
* Tag with <semver> : `git tag <semver> && git push origin --tags` to publish.
|
||||
* add release notes via github interface
|
||||
* `npm publish ./`
|
||||
|
||||
Get Involved
|
||||
============
|
||||
|
||||
Report issues to the github issue tracker.
|
||||
|
||||
* https://github.com/briceburg/jqModal/issues
|
||||
|
||||
|
||||
For *support*, please post to stackoverflow using the jqmodal tag:
|
||||
|
||||
* http://stackoverflow.com/questions/ask?tags=jqmodal
|
||||
|
||||
|
||||
The jqModal website code is available on github -- please do contribute improvements.
|
||||
|
||||
* https://github.com/iceburg-net/jquery.iceburg.net/tree/master/www-1/jqModal
|
||||
|
||||
|
||||
Author
|
||||
======
|
||||
|
||||
Brice Burgess [@iceburgBrice](https://twitter.com/IceburgBrice)
|
||||
|
||||
Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
this message was loaded from server.
|
||||
|
||||
<br /><br />
|
||||
|
||||
<strong>Note</strong> the `closeOnEsc` parameter was passed as true,
|
||||
allowing you to close this modal by pressing the <em>`Esc`</em> key.
|
||||
<br /><br />
|
||||
|
||||
Loaded content also respects the <em>closeClass</em>, and will automatically
|
||||
add classing behahvior to elements like this one: <button class="jqmClose">close me</button>
|
||||
<br /><br />
|
||||
|
||||
<?php
|
||||
|
||||
echo (isset($_GET['timestamp'])) ?
|
||||
'timestamp value <strong>' . (int) $_GET['timestamp'] . '</strong>' :
|
||||
'no timestampe value received';
|
||||
|
||||
if(isset($_GET['sleep'])) {
|
||||
sleep(3);
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>simple jqModal example</title>
|
||||
|
||||
<!-- example page styling -->
|
||||
<style>
|
||||
div.middle {
|
||||
width: 600px;
|
||||
margin: 2em auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- jqModal Dependencies -->
|
||||
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
|
||||
<script type="text/javascript" src="../jqModal.js"></script>
|
||||
|
||||
<!-- jqModal Styling -->
|
||||
<link type="text/css" rel="stylesheet" media="all" href="jqModal.css" />
|
||||
|
||||
<!-- example page Styling -->
|
||||
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"
|
||||
type="text/css" rel="stylesheet" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- TRIGGER ELEMENTS -->
|
||||
|
||||
<div class="middle">
|
||||
1. <em>Defaults</em> -- <a href="#" class="jqModal">show dialog</a> <br /> Out-of-box behavior. The window and its
|
||||
content is taken "inline" from the element with an ID of 'dialog'. The dialog is "triggered" (shown) when element(s)
|
||||
with class <i>jqModal</i> are clicked. No parameters are passed, no fancy window decorations used.
|
||||
</div>
|
||||
|
||||
<div class="middle">
|
||||
2. <em>Ajax</em> -- <a href="#" class="jqm-trigger-ajax">show dialog</a> <br /> Will open a modal that loads
|
||||
content from a remote server. This page must be served through a webserver to work. <br /> (e.g.
|
||||
http:// and not file://).
|
||||
</div>
|
||||
|
||||
<div class="middle">
|
||||
3. <em>Manual trigger, extend options</em> -- <a href="#" id="trigger-ajax-with-timestamp">show dialog</a> <br />
|
||||
Demonstrates a manual trigger of `jqmShow` as well as updating the options object.
|
||||
</div>
|
||||
|
||||
<div class="middle">
|
||||
4. <em>Manual trigger, modal:true dialog</em> -- <a href="#" id="trigger-modal-dialog">show modal:true dialog</a> <br />
|
||||
Demonstrates a manual trigger of `jqmShow` as well as updating the options object.
|
||||
</div>
|
||||
|
||||
<div class="middle">
|
||||
5. <em>Ajax Text</em> -- <a href="#" id="trigger-ajax-text">show dialog</a> <br /> Will open a modal whose contents
|
||||
are immediately replaced with predefined text (e.g. a loading indicator). Predefined text is replaced when the server responds
|
||||
with content. This page must be served through a webserver with php support to work. <br /> (e.g.
|
||||
http:// and not file://).
|
||||
</div>
|
||||
|
||||
<!-- MODAL MARKUP (styled via jqModal.css) -->
|
||||
|
||||
<div class="jqmWindow" id="dialog">
|
||||
<a href="#" class="jqmClose">Close</a>
|
||||
<hr>
|
||||
<em>READ ME</em> --> This is a "vanilla plain" jqModal window. Behavior and appeareance extend far beyond this. <br />
|
||||
<br /> Please see the <a href="http://jquery.iceburg.net/jqModal/">jqModal website</a> for more! <br /> <br /> <em>NOTE</em>;
|
||||
You can close windows by clicking the tinted background known as the "overlay". Clicking the overlay will have no
|
||||
effect if the "modal" parameter is passed, or if the overlay is disabled.
|
||||
</div>
|
||||
|
||||
|
||||
<div class="jqmWindow" id="ajax-dialog">
|
||||
<a href="#" class="jqmClose">Close</a>
|
||||
<hr />
|
||||
<div class="ajax-content"><marquee>loading...</marquee></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="jqmWindow" id="modal-dialog">
|
||||
<a href="#" class="jqmClose">Close</a>
|
||||
<hr />
|
||||
<p>modal: true demonstration</p>
|
||||
<p>Pressing `Esc` or clicking the overlay will NOT close this form</p>
|
||||
|
||||
<input type="text" placeholder="I get focus..." />
|
||||
<br />
|
||||
<select>
|
||||
<option>Option 1</option>
|
||||
<option>Option 2</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="jqmWindow" id="ajax-text-dialog">
|
||||
<a href="#" class="jqmClose">Close</a>
|
||||
<hr />
|
||||
<div class="ajax-content">I get replaced...</div>
|
||||
</div>
|
||||
|
||||
<!-- MODAL SCRIPT -->
|
||||
|
||||
<script type="text/javascript">
|
||||
$().ready(function() {
|
||||
|
||||
/* Example #1 */
|
||||
$('#dialog').jqm();
|
||||
|
||||
/* Example #2 */
|
||||
$('#ajax-dialog').jqm({
|
||||
trigger: 'a.jqm-trigger-ajax',
|
||||
ajax: 'ajax.php',
|
||||
target: 'div.ajax-content',
|
||||
closeOnEsc: true
|
||||
});
|
||||
|
||||
/* Example #3 */
|
||||
$('#trigger-ajax-with-timestamp').click(function() {
|
||||
var timestamp = new Date().getTime();
|
||||
$('#ajax-dialog').jqm({
|
||||
// update an option
|
||||
ajax: 'ajax.php?timestamp=' + timestamp
|
||||
}).jqmShow(); // show modal
|
||||
return false;
|
||||
});
|
||||
|
||||
/* Example #4 */
|
||||
$('#modal-dialog').jqm({
|
||||
trigger: '#trigger-modal-dialog',
|
||||
modal: true
|
||||
});
|
||||
|
||||
/* Example #5 */
|
||||
$('#ajax-text-dialog').jqm({
|
||||
trigger: '#trigger-ajax-text',
|
||||
ajax: 'ajax.php?sleep=true',
|
||||
ajaxText: 'Loading ...<span class="glyphicon glyphicon-refresh glyphicon-spin"></span>',
|
||||
target: 'div.ajax-content',
|
||||
closeOnEsc: true
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.glyphicon-spin {
|
||||
-webkit-animation: spin 1000ms infinite linear;
|
||||
animation: spin 1000ms infinite linear;
|
||||
}
|
||||
@-webkit-keyframes spin {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: rotate(359deg);
|
||||
transform: rotate(359deg);
|
||||
}
|
||||
}
|
||||
@keyframes spin {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: rotate(359deg);
|
||||
transform: rotate(359deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,37 @@
|
||||
/* jqModal base Styling courtesy of;
|
||||
Brice Burgess <bhb@iceburg.net> */
|
||||
|
||||
/* The Window's CSS z-index value is respected (takes priority). If none is supplied,
|
||||
the Window's z-index value will be set to 3000 by default (via jqModal.js). */
|
||||
|
||||
.jqmWindow {
|
||||
display: none;
|
||||
|
||||
position: fixed;
|
||||
top: 17%;
|
||||
left: 50%;
|
||||
|
||||
margin-left: -300px;
|
||||
width: 600px;
|
||||
|
||||
background-color: #EEE;
|
||||
color: #333;
|
||||
border: 1px solid black;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.jqmOverlay { background-color: #000; }
|
||||
|
||||
/* Background iframe styling for IE6. Prevents ActiveX bleed-through (<select> form elements, etc.) */
|
||||
* iframe.jqm {position:absolute;top:0;left:0;z-index:-1;
|
||||
width: expression(this.parentNode.offsetWidth+'px');
|
||||
height: expression(this.parentNode.offsetHeight+'px');
|
||||
}
|
||||
|
||||
/* Fixed posistioning emulation for IE6
|
||||
Star selector used to hide definition from browsers other than IE6
|
||||
For valid CSS, use a conditional include instead */
|
||||
* html .jqmWindow {
|
||||
position: absolute;
|
||||
top: expression((document.documentElement.scrollTop || document.body.scrollTop) + Math.round(17 * (document.documentElement.offsetHeight || document.body.clientHeight) / 100) + 'px');
|
||||
}
|
||||
Vendored
+89
@@ -0,0 +1,89 @@
|
||||
// Generated by typings
|
||||
// Source: typings/globals/jqModal/index.d.ts
|
||||
interface JQueryModalSettings {
|
||||
/**
|
||||
* [0-100] Translucency percentage (opacity) of the body covering overlay. Set to 0 for NO overlay, and up to 100 for a 100% opaque overlay.
|
||||
* @default 50 */
|
||||
overlay?: number;
|
||||
/**
|
||||
* (String) overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS.
|
||||
* @default 'jqmOverlay'*/
|
||||
overlayClass?: string;
|
||||
/**
|
||||
* (String) closeClass - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal).
|
||||
* @default 'jqmClose' */
|
||||
closeClass?: string;
|
||||
/**
|
||||
* (Mixed) trigger - Matching elements will fire the onShow event (to display the modal). Trigger can be a selector String, a jQuery collection of elements, a DOM element, or a False boolean.
|
||||
* @default '.jqModal' */
|
||||
trigger?: any;
|
||||
/**
|
||||
* (String) ajax - URL to load content from via an AJAX request. False to disable ajax. If ajax begins with a "@", the URL is extracted from the attribute of the triggering element (e.g. use '@data-url' for; <a href="#" class="jqModal" data-url="modal.html">...)
|
||||
* @default false */
|
||||
ajax?: string;
|
||||
/**
|
||||
* (Mixed) target - Children of the modal element to load the ajax response into. If false, modal content will be overwritten by ajax response. Useful for retaining modal design.
|
||||
* @default false */
|
||||
target?: any;
|
||||
/** Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element. */
|
||||
/** (String) ajaxText - Text shown while waiting for ajax return. Replaces HTML content of `target` element.
|
||||
* @default '' */
|
||||
ajaxText?: string;
|
||||
/**
|
||||
* (Boolean) modal - If true, user interactivity will be locked to the modal window until closed.
|
||||
* @default false*/
|
||||
modal?: boolean;
|
||||
/**
|
||||
* (Boolean) toTop - If true, modal will be posistioned as a first child of the BODY element when opened, and its DOM posistion restored when closed. Useful for overcoming z-Index container issues.
|
||||
* @default false */
|
||||
toTop?: boolean;
|
||||
/**
|
||||
* (Function) onShow - User defined callback function fired when modal opened.
|
||||
* @default onShow */
|
||||
onShow?: any;
|
||||
/**
|
||||
* (Function) onHide - User defined callback function fired when modal closed.
|
||||
* @default onHide */
|
||||
onHide?: any;
|
||||
/**
|
||||
* (Function) onLoad - User defined callback function fired when ajax content loads.
|
||||
* @default false */
|
||||
onLoad?: any;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
/**
|
||||
* Initialize a set of elements as "modals". Modals typically are popup dialogs,
|
||||
* notices, modal windows, &c.
|
||||
*
|
||||
* @name jqm
|
||||
* @param options user defined options, augments defaults.
|
||||
* @type jQuery
|
||||
* @cat Plugins/jqModal
|
||||
*/
|
||||
jqm(config: JQueryModalSettings): JQuery;
|
||||
/**
|
||||
* Matching modals will have their jqmShow() method fired by attaching a
|
||||
* onClick event to elements matching `trigger`.
|
||||
*
|
||||
* @name jqmAddTrigger
|
||||
* @param trigger a selector String, jQuery collection of elements, or a DOM element.
|
||||
*/
|
||||
jqmAddTrigger(trigger: any);
|
||||
/**
|
||||
* Matching modals will have their jqmHide() method fired by attaching an
|
||||
* onClick event to elements matching `trigger`.
|
||||
*
|
||||
* @name jqmAddClose
|
||||
* @param trigger a selector String, jQuery collection of elements, or a DOM element.
|
||||
*/
|
||||
jqmAddClose(trigger: any);
|
||||
/**
|
||||
* Open matching modals (if not shown)
|
||||
*/
|
||||
jqmShow(trigger?: any): JQuery;
|
||||
/**
|
||||
* Close matching modals
|
||||
*/
|
||||
jqmHide(trigger?: any): JQuery;
|
||||
}
|
||||
Vendored
+400
@@ -0,0 +1,400 @@
|
||||
/*
|
||||
* jqModal - Minimalist Modaling with jQuery
|
||||
*
|
||||
* Copyright (c) 2007-2016 Brice Burgess @IceburgBrice
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* $Version: 1.4.2 (2016.04.16 +r27)
|
||||
* Requires: jQuery 1.2.3+
|
||||
*/
|
||||
|
||||
(function (factory) {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
// Node/CommonJS
|
||||
module.exports = factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
|
||||
/**
|
||||
* Initialize elements as "modals". Modals typically are popup dialogs,
|
||||
* notices, modal windows, &c.
|
||||
*
|
||||
* @name jqm
|
||||
* @param options user defined options, augments defaults.
|
||||
* @type jQuery
|
||||
* @cat Plugins/jqModal
|
||||
*/
|
||||
|
||||
$.fn.jqm=function(options){
|
||||
return this.each(function(){
|
||||
var jqm = $(this).data('jqm') || $.extend({ID: I++}, $.jqm.params),
|
||||
o = $.extend(jqm,options);
|
||||
|
||||
// add/extend options to modal and mark as initialized
|
||||
$(this).data('jqm',o).addClass('jqm-init')[0]._jqmID = o.ID;
|
||||
|
||||
// ... Attach events to trigger showing of this modal
|
||||
$(this).jqmAddTrigger(o.trigger);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Matching modals will have their jqmShow() method fired by attaching a
|
||||
* onClick event to elements matching `trigger`.
|
||||
*
|
||||
* @name jqmAddTrigger
|
||||
* @param trigger a a string selector, jQuery collection, or DOM element.
|
||||
*/
|
||||
$.fn.jqmAddTrigger=function(trigger){
|
||||
if(trigger){
|
||||
return this.each(function(){
|
||||
if (!addTrigger($(this), 'jqmShow', trigger)) {
|
||||
err("jqmAddTrigger must be called on initialized modals");
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Matching modals will have their jqmHide() method fired by attaching an
|
||||
* onClick event to elements matching `trigger`.
|
||||
*
|
||||
* @name jqmAddClose
|
||||
* @param trigger a string selector, jQuery collection, or DOM element.
|
||||
*/
|
||||
$.fn.jqmAddClose=function(trigger){
|
||||
if(trigger){
|
||||
return this.each(function(){
|
||||
if(!addTrigger($(this), 'jqmHide', trigger)) {
|
||||
err ("jqmAddClose must be called on initialized modals");
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Open matching modals (if not shown)
|
||||
*/
|
||||
$.fn.jqmShow=function(trigger){
|
||||
return this.each(function(){
|
||||
if(!this._jqmShown) { show($(this), trigger); }
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Close matching modals
|
||||
*/
|
||||
$.fn.jqmHide=function(trigger){
|
||||
return this.each(function(){
|
||||
if(this._jqmShown) { hide($(this), trigger); }
|
||||
});
|
||||
};
|
||||
|
||||
// utility functions
|
||||
|
||||
var
|
||||
err = function(msg){
|
||||
if(window.console && window.console.error) { window.console.error(msg); }
|
||||
|
||||
}, show = function(m, t){
|
||||
|
||||
/**
|
||||
* m = modal element (as jQuery object)
|
||||
* t = triggering element
|
||||
*
|
||||
* o = options
|
||||
* z = z-index of modal
|
||||
* v = overlay element (as jQuery object)
|
||||
* h = hash (for jqModal <= r15 compatibility)
|
||||
*/
|
||||
|
||||
t = t || window.event;
|
||||
|
||||
var o = m.data('jqm'),
|
||||
z = (parseInt(m.css('z-index'),10)) || 3000,
|
||||
v = $('<div></div>').addClass(o.overlayClass).css({
|
||||
height:'100%',
|
||||
width:'100%',
|
||||
position:'fixed',
|
||||
left:0,
|
||||
top:0,
|
||||
'z-index':z-1,
|
||||
opacity:o.overlay/100
|
||||
}),
|
||||
|
||||
// maintain legacy "hash" construct
|
||||
h = {w: m, c: o, o: v, t: t};
|
||||
|
||||
m.css('z-index',z);
|
||||
|
||||
if(o.ajax){
|
||||
var target = o.target || m,
|
||||
url = o.ajax;
|
||||
|
||||
target = (typeof target === 'string') ? $(target,m) : $(target);
|
||||
if(url.substr(0,1) === '@') {
|
||||
url = $(t).attr(url.substring(1));
|
||||
}
|
||||
|
||||
// load remote contents
|
||||
target.load(url,function(){
|
||||
if(o.onLoad) {
|
||||
o.onLoad.call(this,h);
|
||||
}
|
||||
parseModalContents.call(m,o,target);
|
||||
});
|
||||
|
||||
// show modal
|
||||
if(o.ajaxText) {
|
||||
target.html(o.ajaxText);
|
||||
}
|
||||
open(h);
|
||||
}
|
||||
else { open(h); }
|
||||
|
||||
}, hide = function(m, t){
|
||||
/**
|
||||
* m = modal element (as jQuery object)
|
||||
* t = triggering element
|
||||
*
|
||||
* o = options
|
||||
* h = hash (for jqModal <= r15 compatibility)
|
||||
*/
|
||||
|
||||
t = t || window.event;
|
||||
var o = m.data('jqm'),
|
||||
// maintain legacy "hash" construct
|
||||
h = {w: m, c: o, o: m.data('jqmv'), t: t};
|
||||
|
||||
close(h);
|
||||
|
||||
}, onShow = function(hash){
|
||||
// onShow callback. Responsible for showing a modal and overlay.
|
||||
// return false to stop opening modal.
|
||||
|
||||
// hash object;
|
||||
// w: (jQuery object) The modal element
|
||||
// c: (object) The modal's options object
|
||||
// o: (jQuery object) The overlay element
|
||||
// t: (DOM object) The triggering element
|
||||
|
||||
// if overlay not disabled, prepend to body
|
||||
if(hash.c.overlay > 0) {
|
||||
hash.o.prependTo('body');
|
||||
}
|
||||
|
||||
// make modal visible
|
||||
hash.w.show();
|
||||
|
||||
// call focusFunc (attempts to focus on first input in modal)
|
||||
$.jqm.focusFunc(hash.w,true);
|
||||
|
||||
return true;
|
||||
|
||||
}, onHide = function(hash){
|
||||
// onHide callback. Responsible for hiding a modal and overlay.
|
||||
// return false to stop closing modal.
|
||||
|
||||
// hash object;
|
||||
// w: (jQuery object) The modal element
|
||||
// c: (object) The modal's options object
|
||||
// o: (jQuery object) The overlay element
|
||||
// t: (DOM object) The triggering element
|
||||
|
||||
// hide modal and if overlay, remove overlay.
|
||||
if(hash.w.hide() && hash.o) {
|
||||
hash.o.remove();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}, addTrigger = function(m, key, trigger){
|
||||
// addTrigger: Adds a jqmShow/jqmHide (key) event click on modal (m)
|
||||
// to all elements that match trigger string (trigger)
|
||||
|
||||
var jqm = m.data('jqm');
|
||||
if(jqm) {
|
||||
return $(trigger).each(function(){
|
||||
this[key] = this[key] || [];
|
||||
// register this modal with this trigger only once
|
||||
if($.inArray(jqm.ID,this[key]) < 0) {
|
||||
this[key].push(jqm.ID);
|
||||
|
||||
// register trigger click event for this modal
|
||||
// allows cancellation of show/hide event from
|
||||
$(this).click(function(e){
|
||||
if(!e.isDefaultPrevented()) { m[key](this); }
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}, open = function(h){
|
||||
// open: executes the onOpen callback + performs common tasks if successful
|
||||
|
||||
// transform legacy hash into new var shortcuts
|
||||
var m = h.w,
|
||||
v = h.o,
|
||||
o = h.c;
|
||||
|
||||
// execute onShow callback
|
||||
if(o.onShow(h) !== false){
|
||||
// mark modal as shown
|
||||
m[0]._jqmShown = true;
|
||||
|
||||
// if modal:true dialog
|
||||
// Bind the Keep Focus Function [F] if no other Modals are active
|
||||
// else,
|
||||
// trigger closing of dialog when overlay is clicked
|
||||
if(o.modal){
|
||||
if(!ActiveModals[0]){ F('bind'); }
|
||||
ActiveModals.push(m[0]);
|
||||
}
|
||||
else {
|
||||
m.jqmAddClose(v);
|
||||
}
|
||||
|
||||
// parse modal contents and add behavior
|
||||
parseModalContents.call(m,o);
|
||||
|
||||
// if toTop is true and overlay exists;
|
||||
// remember modal DOM position with <span> placeholder element, and move
|
||||
// the modal to a direct child of the body tag (after overlyay)
|
||||
if(o.toTop && v) {
|
||||
m.before('<span id="jqmP'+o.ID+'"></span>').insertAfter(v);
|
||||
}
|
||||
|
||||
// remember overlay (for closing function)
|
||||
m.data('jqmv',v);
|
||||
|
||||
// close modal if the esc key is pressed and closeOnEsc is set to true
|
||||
m.unbind("keydown",$.jqm.closeOnEscFunc);
|
||||
if(o.closeOnEsc) {
|
||||
m.attr("tabindex", 0).bind("keydown",$.jqm.closeOnEscFunc).focus();
|
||||
}
|
||||
}
|
||||
|
||||
}, close = function(h){
|
||||
// close: executes the onHide callback + performs common tasks if successful
|
||||
|
||||
// transform legacy hash into new var shortcuts
|
||||
var m = h.w,
|
||||
v = h.o,
|
||||
o = h.c;
|
||||
|
||||
// execute onHide callback
|
||||
if(o.onHide(h) !== false){
|
||||
// mark modal as !shown
|
||||
m[0]._jqmShown = false;
|
||||
|
||||
// If modal, remove from modal stack.
|
||||
// If no modals in modal stack, unbind the Keep Focus Function
|
||||
if(o.modal){
|
||||
ActiveModals.pop();
|
||||
if(!ActiveModals[0]) {
|
||||
F('unbind');
|
||||
}
|
||||
}
|
||||
|
||||
// IF toTop was passed and an overlay exists;
|
||||
// Move modal back to its "remembered" position.
|
||||
if(o.toTop && v) {
|
||||
$('#jqmP'+o.ID).after(m).remove();
|
||||
}
|
||||
}
|
||||
|
||||
}, F = function(t){
|
||||
// F: The Keep Focus Function (for modal: true dialos)
|
||||
// Binds or Unbinds (t) the Focus Examination Function (X)
|
||||
|
||||
$(document)[t]("keypress keydown mousedown",X);
|
||||
|
||||
}, X = function(e){
|
||||
// X: The Focus Examination Function (for modal: true dialogs)
|
||||
|
||||
var targetModal = $(e.target).data('jqm') ||
|
||||
$(e.target).parents('.jqm-init:first').data('jqm');
|
||||
var activeModal = ActiveModals[ActiveModals.length-1];
|
||||
|
||||
// allow bubbling if event target is within active modal dialog
|
||||
return (targetModal && targetModal.ID === activeModal._jqmID) ?
|
||||
true : $.jqm.focusFunc(activeModal,e);
|
||||
|
||||
}, parseModalContents = function(o, context){
|
||||
context = context || this;
|
||||
|
||||
// Attach events to elements inside the modal matching closingClass
|
||||
if(o.closeClass) {
|
||||
this.jqmAddClose($('.' + o.closeClass,context));
|
||||
}
|
||||
|
||||
},
|
||||
I = 0, // modal ID increment (for nested modals)
|
||||
ActiveModals = []; // array of active modals
|
||||
|
||||
// $.jqm, overridable defaults
|
||||
$.jqm = {
|
||||
/**
|
||||
* default options
|
||||
*
|
||||
* (Integer) overlay - [0-100] Translucency percentage (opacity) of the body covering overlay. Set to 0 for NO overlay, and up to 100 for a 100% opaque overlay.
|
||||
* (String) overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS.
|
||||
* (String) closeClass - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal).
|
||||
* (Mixed) trigger - Matching elements will fire the onShow event (to display the modal). Trigger can be a selector String, a jQuery collection of elements, a DOM element, or a False boolean.
|
||||
* (String) ajax - URL to load content from via an AJAX request. False to disable ajax. If ajax begins with a "@", the URL is extracted from the attribute of the triggering element (e.g. use '@data-url' for; <a href="#" class="jqModal" data-url="modal.html">...)
|
||||
* (Mixed) target - Children of the modal element to load the ajax response into. If false, modal content will be overwritten by ajax response. Useful for retaining modal design.
|
||||
* Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element.
|
||||
* (String) ajaxText - Text shown while waiting for ajax return. Replaces HTML content of `target` element.
|
||||
* (Boolean) modal - If true, user interactivity will be locked to the modal window until closed.
|
||||
* (Boolean) toTop - If true, modal will be posistioned as a first child of the BODY element when opened, and its DOM posistion restored when closed. Useful for overcoming z-Index container issues.
|
||||
* (Function) onShow - User defined callback function fired when modal opened.
|
||||
* (Function) onHide - User defined callback function fired when modal closed.
|
||||
* (Function) onLoad - User defined callback function fired when ajax content loads.
|
||||
*/
|
||||
params: {
|
||||
overlay: 50,
|
||||
overlayClass: 'jqmOverlay',
|
||||
closeClass: 'jqmClose',
|
||||
closeOnEsc: false,
|
||||
trigger: '.jqModal',
|
||||
ajax: false,
|
||||
target: false,
|
||||
ajaxText: '',
|
||||
modal: false,
|
||||
toTop: false,
|
||||
onShow: onShow,
|
||||
onHide: onHide,
|
||||
onLoad: false
|
||||
},
|
||||
|
||||
// focusFunc is fired:
|
||||
// a) when a modal:true dialog is shown,
|
||||
// b) when an event occurs outside an active modal:true dialog
|
||||
// It is passed the active modal:true dialog as well as event
|
||||
focusFunc: function(activeModal, e) {
|
||||
|
||||
// if the event occurs outside the activeModal, focus on first element
|
||||
if(e) { $(':input:visible:first',activeModal).focus(); }
|
||||
|
||||
// lock interactions to the activeModal
|
||||
return false;
|
||||
},
|
||||
|
||||
// closeOnEscFunc is attached to modals where closeOnEsc param true.
|
||||
closeOnEscFunc: function(e){
|
||||
if (e.keyCode === 27) {
|
||||
$(this).jqmHide();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return $.jqm;
|
||||
|
||||
}));
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* jqModal - Minimalist Modaling with jQuery
|
||||
*
|
||||
* Copyright (c) 2007-2016 Brice Burgess @IceburgBrice
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* $Version: 1.4.2 (2016.04.16 +r27)
|
||||
* Requires: jQuery 1.2.3+
|
||||
*/
|
||||
|
||||
!function(n){"object"==typeof module&&"object"==typeof module.exports?module.exports=n(require("jquery")):n(jQuery)}(function(n){n.fn.jqm=function(o){return this.each(function(){var t=n(this).data("jqm")||n.extend({ID:m++},n.jqm.params),e=n.extend(t,o);n(this).data("jqm",e).addClass("jqm-init")[0]._jqmID=e.ID,n(this).jqmAddTrigger(e.trigger)})},n.fn.jqmAddTrigger=function(t){return t?this.each(function(){a(n(this),"jqmShow",t)||o("jqmAddTrigger must be called on initialized modals")}):void 0},n.fn.jqmAddClose=function(t){return t?this.each(function(){a(n(this),"jqmHide",t)||o("jqmAddClose must be called on initialized modals")}):void 0},n.fn.jqmShow=function(o){return this.each(function(){this._jqmShown||t(n(this),o)})},n.fn.jqmHide=function(o){return this.each(function(){this._jqmShown&&e(n(this),o)})};var o=function(n){window.console&&window.console.error&&window.console.error(n)},t=function(o,t){t=t||window.event;var e=o.data("jqm"),i=parseInt(o.css("z-index"),10)||3e3,s=n("<div></div>").addClass(e.overlayClass).css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":i-1,opacity:e.overlay/100}),a={w:o,c:e,o:s,t:t};if(o.css("z-index",i),e.ajax){var d=e.target||o,c=e.ajax;d="string"==typeof d?n(d,o):n(d),"@"===c.substr(0,1)&&(c=n(t).attr(c.substring(1))),d.load(c,function(){e.onLoad&&e.onLoad.call(this,a),l.call(o,e,d)}),e.ajaxText&&d.html(e.ajaxText),r(a)}else r(a)},e=function(n,o){o=o||window.event;var t=n.data("jqm"),e={w:n,c:t,o:n.data("jqmv"),t:o};d(e)},i=function(o){return o.c.overlay>0&&o.o.prependTo("body"),o.w.show(),n.jqm.focusFunc(o.w,!0),!0},s=function(n){return n.w.hide()&&n.o&&n.o.remove(),!0},a=function(o,t,e){var i=o.data("jqm");return i?n(e).each(function(){this[t]=this[t]||[],n.inArray(i.ID,this[t])<0&&(this[t].push(i.ID),n(this).click(function(n){return n.isDefaultPrevented()||o[t](this),!1}))}):void 0},r=function(o){var t=o.w,e=o.o,i=o.c;i.onShow(o)!==!1&&(t[0]._jqmShown=!0,i.modal?(j[0]||c("bind"),j.push(t[0])):t.jqmAddClose(e),l.call(t,i),i.toTop&&e&&t.before('<span id="jqmP'+i.ID+'"></span>').insertAfter(e),t.data("jqmv",e),t.unbind("keydown",n.jqm.closeOnEscFunc),i.closeOnEsc&&t.attr("tabindex",0).bind("keydown",n.jqm.closeOnEscFunc).focus())},d=function(o){var t=o.w,e=o.o,i=o.c;i.onHide(o)!==!1&&(t[0]._jqmShown=!1,i.modal&&(j.pop(),j[0]||c("unbind")),i.toTop&&e&&n("#jqmP"+i.ID).after(t).remove())},c=function(o){n(document)[o]("keypress keydown mousedown",u)},u=function(o){var t=n(o.target).data("jqm")||n(o.target).parents(".jqm-init:first").data("jqm"),e=j[j.length-1];return t&&t.ID===e._jqmID?!0:n.jqm.focusFunc(e,o)},l=function(o,t){t=t||this,o.closeClass&&this.jqmAddClose(n("."+o.closeClass,t))},m=0,j=[];return n.jqm={params:{overlay:50,overlayClass:"jqmOverlay",closeClass:"jqmClose",closeOnEsc:!1,trigger:".jqModal",ajax:!1,target:!1,ajaxText:"",modal:!1,toTop:!1,onShow:i,onHide:s,onLoad:!1},focusFunc:function(o,t){return t&&n(":input:visible:first",o).focus(),!1},closeOnEscFunc:function(o){return 27===o.keyCode?(n(this).jqmHide(),!1):void 0}},n.jqm});
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "jqmodal",
|
||||
"version": "1.4.2",
|
||||
"description": "jqModal helps you display modals, popups, and notices. It is flexible and tiny, and provides a general-purpose base for all your windowing needs.",
|
||||
"keywords": [
|
||||
"jquery-plugin",
|
||||
"modal",
|
||||
"window",
|
||||
"popup",
|
||||
"dialog",
|
||||
"notice",
|
||||
"popout",
|
||||
"video",
|
||||
"page cover"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "jshint jqModal.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/briceburg/jqModal.git"
|
||||
},
|
||||
"author": {
|
||||
"name": "Brice Burgess"
|
||||
},
|
||||
"license": "(MIT OR GPL-2.0)",
|
||||
"bugs": "https://github.com/briceburg/jqModal/issues",
|
||||
"homepage": "http://jquery.iceburg.net/jqModal/",
|
||||
"main": "jqModal.js",
|
||||
"dependencies": {
|
||||
"jquery": ">=1.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jshint": "latest"
|
||||
},
|
||||
"typescript": {
|
||||
"definition": "jqModal.d.ts"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user