From 7b1e954f7fe90d4e2adf30ac81f039f10c68538a Mon Sep 17 00:00:00 2001 From: bach Date: Tue, 11 May 2021 10:01:05 +0200 Subject: [PATCH] re staged lightbox2 to git tree --- sites/all/modules/lightbox2/LICENSE.txt | 339 ++ sites/all/modules/lightbox2/README.txt | 259 + sites/all/modules/lightbox2/TODO.txt | 22 + .../modules/lightbox2/css/lightbox-rtl.css | 62 + sites/all/modules/lightbox2/css/lightbox.css | 284 ++ .../modules/lightbox2/css/lightbox_alt.css | 230 + .../lightbox2/css/lightbox_lite-rtl.css | 60 + .../modules/lightbox2/css/lightbox_lite.css | 60 + sites/all/modules/lightbox2/images/blank.gif | Bin 0 -> 43 bytes .../modules/lightbox2/images/brokenimage.jpg | Bin 0 -> 7033 bytes sites/all/modules/lightbox2/images/close.gif | Bin 0 -> 388 bytes .../modules/lightbox2/images/close_hover.gif | Bin 0 -> 308 bytes .../modules/lightbox2/images/close_lite.gif | Bin 0 -> 109 bytes .../modules/lightbox2/images/closelabel.gif | Bin 0 -> 979 bytes .../all/modules/lightbox2/images/contract.gif | Bin 0 -> 213 bytes sites/all/modules/lightbox2/images/expand.gif | Bin 0 -> 209 bytes .../all/modules/lightbox2/images/loading.gif | Bin 0 -> 2767 bytes .../modules/lightbox2/images/loading_lite.gif | Bin 0 -> 2364 bytes sites/all/modules/lightbox2/images/next.gif | Bin 0 -> 305 bytes .../all/modules/lightbox2/images/next_alt.gif | Bin 0 -> 297 bytes .../modules/lightbox2/images/next_hover.gif | Bin 0 -> 322 bytes .../modules/lightbox2/images/nextlabel.gif | Bin 0 -> 354 bytes .../all/modules/lightbox2/images/overlay.png | Bin 0 -> 279 bytes sites/all/modules/lightbox2/images/pause.png | Bin 0 -> 364 bytes sites/all/modules/lightbox2/images/play.png | Bin 0 -> 645 bytes sites/all/modules/lightbox2/images/prev.gif | Bin 0 -> 307 bytes .../all/modules/lightbox2/images/prev_alt.gif | Bin 0 -> 265 bytes .../modules/lightbox2/images/prev_hover.gif | Bin 0 -> 277 bytes .../modules/lightbox2/images/prevlabel.gif | Bin 0 -> 371 bytes .../lightbox2/js/auto_image_handling.js | 226 + sites/all/modules/lightbox2/js/builder.js | 136 + sites/all/modules/lightbox2/js/effects.js | 1122 +++++ sites/all/modules/lightbox2/js/lightbox.js | 1195 +++++ sites/all/modules/lightbox2/js/lightbox2.js | 192 + .../all/modules/lightbox2/js/lightbox_lite.js | 394 ++ .../modules/lightbox2/js/lightbox_modal.js | 37 + .../modules/lightbox2/js/lightbox_video.js | 213 + sites/all/modules/lightbox2/js/prototype.js | 4221 +++++++++++++++++ .../all/modules/lightbox2/js/scriptaculous.js | 58 + .../lightbox2/lightbox2-insert-image.tpl.php | 27 + .../all/modules/lightbox2/lightbox2.admin.inc | 943 ++++ .../modules/lightbox2/lightbox2.formatter.inc | 632 +++ sites/all/modules/lightbox2/lightbox2.info | 26 + .../modules/lightbox2/lightbox2.insert.inc | 68 + sites/all/modules/lightbox2/lightbox2.install | 202 + sites/all/modules/lightbox2/lightbox2.module | 1561 ++++++ .../all/modules/lightbox2/lightbox2.views.inc | 47 + .../lightbox2_handler_field_lightbox2.inc | 152 + .../lightbox2/page--node--lightbox2.tpl.php | 57 + 49 files changed, 12825 insertions(+) create mode 100644 sites/all/modules/lightbox2/LICENSE.txt create mode 100644 sites/all/modules/lightbox2/README.txt create mode 100644 sites/all/modules/lightbox2/TODO.txt create mode 100644 sites/all/modules/lightbox2/css/lightbox-rtl.css create mode 100644 sites/all/modules/lightbox2/css/lightbox.css create mode 100644 sites/all/modules/lightbox2/css/lightbox_alt.css create mode 100644 sites/all/modules/lightbox2/css/lightbox_lite-rtl.css create mode 100644 sites/all/modules/lightbox2/css/lightbox_lite.css create mode 100644 sites/all/modules/lightbox2/images/blank.gif create mode 100644 sites/all/modules/lightbox2/images/brokenimage.jpg create mode 100644 sites/all/modules/lightbox2/images/close.gif create mode 100644 sites/all/modules/lightbox2/images/close_hover.gif create mode 100644 sites/all/modules/lightbox2/images/close_lite.gif create mode 100644 sites/all/modules/lightbox2/images/closelabel.gif create mode 100644 sites/all/modules/lightbox2/images/contract.gif create mode 100644 sites/all/modules/lightbox2/images/expand.gif create mode 100644 sites/all/modules/lightbox2/images/loading.gif create mode 100644 sites/all/modules/lightbox2/images/loading_lite.gif create mode 100644 sites/all/modules/lightbox2/images/next.gif create mode 100644 sites/all/modules/lightbox2/images/next_alt.gif create mode 100644 sites/all/modules/lightbox2/images/next_hover.gif create mode 100644 sites/all/modules/lightbox2/images/nextlabel.gif create mode 100644 sites/all/modules/lightbox2/images/overlay.png create mode 100644 sites/all/modules/lightbox2/images/pause.png create mode 100644 sites/all/modules/lightbox2/images/play.png create mode 100644 sites/all/modules/lightbox2/images/prev.gif create mode 100644 sites/all/modules/lightbox2/images/prev_alt.gif create mode 100644 sites/all/modules/lightbox2/images/prev_hover.gif create mode 100644 sites/all/modules/lightbox2/images/prevlabel.gif create mode 100644 sites/all/modules/lightbox2/js/auto_image_handling.js create mode 100644 sites/all/modules/lightbox2/js/builder.js create mode 100644 sites/all/modules/lightbox2/js/effects.js create mode 100644 sites/all/modules/lightbox2/js/lightbox.js create mode 100644 sites/all/modules/lightbox2/js/lightbox2.js create mode 100644 sites/all/modules/lightbox2/js/lightbox_lite.js create mode 100644 sites/all/modules/lightbox2/js/lightbox_modal.js create mode 100644 sites/all/modules/lightbox2/js/lightbox_video.js create mode 100644 sites/all/modules/lightbox2/js/prototype.js create mode 100644 sites/all/modules/lightbox2/js/scriptaculous.js create mode 100644 sites/all/modules/lightbox2/lightbox2-insert-image.tpl.php create mode 100644 sites/all/modules/lightbox2/lightbox2.admin.inc create mode 100644 sites/all/modules/lightbox2/lightbox2.formatter.inc create mode 100644 sites/all/modules/lightbox2/lightbox2.info create mode 100644 sites/all/modules/lightbox2/lightbox2.insert.inc create mode 100644 sites/all/modules/lightbox2/lightbox2.install create mode 100644 sites/all/modules/lightbox2/lightbox2.module create mode 100644 sites/all/modules/lightbox2/lightbox2.views.inc create mode 100644 sites/all/modules/lightbox2/lightbox2_handler_field_lightbox2.inc create mode 100644 sites/all/modules/lightbox2/page--node--lightbox2.tpl.php diff --git a/sites/all/modules/lightbox2/LICENSE.txt b/sites/all/modules/lightbox2/LICENSE.txt new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/sites/all/modules/lightbox2/LICENSE.txt @@ -0,0 +1,339 @@ + 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. + + 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. + + + Copyright (C) + + 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. + + , 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. diff --git a/sites/all/modules/lightbox2/README.txt b/sites/all/modules/lightbox2/README.txt new file mode 100644 index 0000000..3c5df53 --- /dev/null +++ b/sites/all/modules/lightbox2/README.txt @@ -0,0 +1,259 @@ +CONTENTS OF THIS FILE +---------------------- + + * Introduction + * Installation + * Adding Lightbox Functionality to your Images + - No Grouping + - With Grouping + - Slideshow + - Video + - HTML Content Support + - Inline Content Support + - Turning the Image Caption into a Link + * Keyboard Shortcuts + * Translation of Configured Strings + * Known Issues + - Keyboard Shortcuts in Opera + + +INTRODUCTION +------------ +Maintainers: + Stella Power (http://drupal.org/user/66894) + Daniel F. Kudwien (http://drupal.org/user/54136) + Mark Ashmead (http://drupal.org/user/52392) + Fernando Correa da Conceição (http://drupal.org/user/889254) + +Documentation: http://drupal.org/node/144469 + +Licensed under the GNU/GPL License +Based on Lightbox v2.03.3 by Lokesh Dhakar + + +Originally written to make use of the Prototype framework, and Script.acalo.us, +now altered to use jQuery. + +Permission has been granted to Mark Ashmead & other Drupal Lightbox2 module +maintainers to distribute the original lightbox.js via Drupal.org under this +license scheme. This file has been subsequently modified to make use of jQuery +instead of prototype / script.acalo.us. + +This module enables the use of lightbox2 which places images above your +current page, not within. This frees you from the constraints of the layout, +particularly column widths. + +This module will include the lightbox CSS and JS files in your Drupal +Installation without the need to edit the theme. The module comes with a +Lightbox2 Lite option which does not use the jQuery libraries; it is therefore +less likely to conflict with anything else. + + +INSTALLATION +------------ +1. Copy lightbox2 folder to modules directory. +2. At admin/build/modules enable the lightbox2 module. +3. Enable permissions at admin/user/permissions. +4. Configure the module at admin/settings/lightbox2. +5. Modify your image links to open in a lightbox where necessary, see "Adding + Lightbox Functionality to your Images' section below. +6. If you need to play flv files, then you may need to install a FLV player. + There are a number of freely available ones on the Internet, including + http://www.jeroenwijering.com/ + + +ADDING LIGHTBOX FUNCTIONALITY TO YOUR IMAGES +-------------------------------------------- +No Grouping +=========== +Add rel="lightbox" attribute to any link tag to activate the lightbox. +For example: +image #1 +image #1 + +Optional: To show a caption either use the title attribute or put in the second +set of [] of the rel attribute. + +With Grouping +============== +If you have a set of related images that you would like to group, follow step +one but additionally include a group name between square brackets in the rel +attribute. For example: + +image #1 +image #2 +image #3 + +No limits to the number of image sets per page or how many images are allowed +in each set. Go nuts! + +If you have a set of images that you would like to group together in a +lightbox, but only wish for one of these images to be visible on your page, you +can assign the "lightbox_hide_image" class to hide the additional images. For +example: + +image #1 +image #2 +image #3 + +Slideshow +========= +This is very similar to the grouping functionality described above. The only +difference is that "rel" attribute should be set to "lightshow" instead of +"lightbox". Using the same example as above, we could launch the images in a +slideshow by doing: + +image #1 +image #2 +image #3 + +Video +===== +It's possible to show video content in the lightbox. In this case the "rel" +attribute should be set to "lightvideo". It's possible to group videos and +to control the size of the lightbox by setting the 'width' and 'height +properties. The properties can be configured like +"lightvideo[group|width:300px; height: 200px;]" and +"lightvideo[|width:300px; height: 200px;][my caption]". The properties should +all be of the format "property: value;" - note the closing semi-colon. If no +properties are set, then the default width and height of 400px will be used. +See below for more detailed examples. + +Basic example: +Google video example - default size + +Basic example with caption: +Google video example - default size + +Grouped example: +Grouped example 1 +Grouped example 2 + +Controlling lightbox size example: +Google video example - +custom size + +Supported Video Formats +asx, wmv, mov and swf videos should all be supported. A number of video +providers are also supported, for example YouTube and Google Video. For full +details on how to integrate these with lightbox, please see the online +documentation. + +HTML Content Support +==================== +It's possible to show webpage content in the lightbox, using iframes. In this +case the "rel" attribute should be set to "lightframe". Again it's possible to +group the content, (e.g. "lightframe[search]") but in addition to that, it's +possible to control some of the iframe properties. It's possible to set the +'width', 'height' and 'scrolling' properties of the iframe. The properties are +separated from the group name by a '|', for example +"lightframe[search|width:100px;]" and +"lightframe[search|width:100px;][my caption]". If no grouping is being used, +then the '|' is still used and the format would be "lightframe[|width:100px;]". +The properties should all be of the format "property: value;" - note the closing +semi-colon. If no iframe properties are set, then the default width and height +of 400px will be used. See below for more detailed examples. + +Basic example: +Search google + +Basic example with caption: +Search google + +Grouped example: +Search google +Search yahoo + +Controlling iframe property example: +Search google + +Controlling iframe property when grouped example: +Search google +Search yahoo +Search yahoo + +Inline Content Support +======================= +It's possible to show HTML snippets in the lightbox, that is on the same domain. +In this case the "rel" attribute should be set to "lightmodal". Again it's +possible to group the content, (e.g. "lightmodal[search]") but in addition to +that, it's possible to control some of the inline / modal properties. It's +possible to set the 'width', 'height' and 'scrolling' properties of the inline +content. The properties are separated from the group name by a '|', for example +"lightmodal[search|width:100px;]" and +"lightmodal[search|width:100px;][my caption]". If no grouping is being used, +then the '|' is still used and the format would be "lightmodal[|width:100px;]". +The properties should all be of the format "property: value;" - note the closing +semi-colon. If no properties are set, then the default width and height of +400px will be used. See below for more detailed examples. + +Basic example: +Search + +Basic example with caption: +Search + +Grouped example: +Search +Search published content + +Controlling modal property example: +Search + +Controlling modal property when grouped example: +Search +Search published content +Search unpublished content + + + +Turning the Image Caption into a Link +===================================== +If you wish to turn the caption into a link, format your caption in the +following way: + +image #1 + +Note, the < and > characters have been changed to their HTML entities, and the " +have been escaped. + + +KEYBOARD SHORTCUTS +------------------ +Not all of the default keyboard shortcuts work in the Opera browser, for example +'z' for toggling the zoom and 'spacebar' for toggling play / pause in +slideshows. This can be overcome by updating your shortcut settings in the +Opera preferences editor. + +The default keyboard shortcuts are listed below. You can override these on +admin/settings/lightbox2. + +Close : x, o, c, ESC +Previous Image : p, Left Arrow +Next Image : n, Right Arrow +Toggle Zoom : z (not available in slideshow) +Toggle Play / Pause : Spacebar (slideshow only) + + +TRANSLATION OF CONFIGURED STRINGS +---------------------------------- +In order to translate the lightbox2 configuration strings, such as the text for +the "View Image Details" link and the image count, please install the i18n: +internationalization module and follow the instructions at +http://drupal.org/node/134002. + + +KNOWN ISSUES +------------ + +Keyboard Shortcuts in Opera +--------------------------- +Not all of the default keyboard shortcuts work in the Opera browser, for example +'z' for toggling the zoom and 'spacebar' for toggling play / pause in +slideshows. This can be overcome by updating your shortcut settings in the +Opera preferences editor. diff --git a/sites/all/modules/lightbox2/TODO.txt b/sites/all/modules/lightbox2/TODO.txt new file mode 100644 index 0000000..5c5bd37 --- /dev/null +++ b/sites/all/modules/lightbox2/TODO.txt @@ -0,0 +1,22 @@ +Drupal 7 port + +Works + * Add a image with rel="lightbox" + * Add a image group with rel="lightbox[group]" + * Slideshow using rel="lightshow[group]" + * HTML content using rel="lightframe" + * Modal with rel="lightmodal", and with settings, show a blank screen if + the url address is invalid(404 error) + +Integration with external modules + * acidvideo - There is not a drupal 7 version + +Not tested + * Video using rel=lightshow + +To do + * Add a description in hook_permission + * This is many filters without any action, look if this is really necessaary, + if not, remove the ones without action + + \ No newline at end of file diff --git a/sites/all/modules/lightbox2/css/lightbox-rtl.css b/sites/all/modules/lightbox2/css/lightbox-rtl.css new file mode 100644 index 0000000..46cf2d0 --- /dev/null +++ b/sites/all/modules/lightbox2/css/lightbox-rtl.css @@ -0,0 +1,62 @@ +/* $Id: lightbox-rtl.css,v 1.1.2.18 2010/06/07 14:43:02 snpower Exp $ */ + +#imageData #imageDetails { + float: right; + text-align: right; +} + +/* Image location mod */ +#bottomNavClose { + float: left; +} + +#bottomNavZoom, +#bottomNavZoomOut { + left: -30px; + float: left; +} + +#lightshowPlay, +#lightshowPause { + float: left; + margin-right: 0px; + margin-left: 5px; +} + +#prevLink, #nextLink { + width: 49%; + height: 100%; + background: transparent url(../images/blank.gif) no-repeat; /* Trick IE into showing hover */ + display: block; +} + +#prevLink, #framePrevLink { + left: auto; + right: 0; + float: right; +} + +#nextLink, #frameNextLink { + right: auto; + left: 0; + float: left; +} + +#prevLink:hover, #prevLink:visited:hover, #prevLink.force_show_nav, #framePrevLink { + background: url(../images/next.gif) right 15% no-repeat; +} + +#nextLink:hover, #nextLink:visited:hover, #nextLink.force_show_nav, #frameNextLink { + background: url(../images/prev.gif) left 15% no-repeat; +} + +#prevLink:hover.force_show_nav, #prevLink:visited:hover.force_show_nav, +#framePrevLink:hover, #framePrevLink:visited:hover { + background: url(../images/next_hover.gif) right 15% no-repeat; +} + +#nextLink:hover.force_show_nav, #nextLink:visited:hover.force_show_nav, +#frameNextLink:hover, #frameNextLink:visited:hover { + background: url(../images/prev_hover.gif) left 15% no-repeat; +} + diff --git a/sites/all/modules/lightbox2/css/lightbox.css b/sites/all/modules/lightbox2/css/lightbox.css new file mode 100644 index 0000000..5243fad --- /dev/null +++ b/sites/all/modules/lightbox2/css/lightbox.css @@ -0,0 +1,284 @@ +/* $Id: lightbox.css,v 1.1.4.28 2010/09/22 10:47:15 snpower Exp $ */ +#lightbox { + position: absolute; + top: 40px; + left: 0; + width: 100%; + z-index: 100; + text-align: center; + line-height: 0; +} + +#lightbox a img { + border: none; +} + +#outerImageContainer { + position: relative; + background-color: #fff; + width: 250px; + height: 250px; + margin: 0 auto; + min-width: 240px; + overflow: hidden; +} + +#imageContainer, #frameContainer, #modalContainer { + padding: 10px; +} + +#modalContainer { + line-height: 1em; + overflow: auto; +} + +#loading { + height: 25%; + width: 100%; + text-align: center; + line-height: 0; + position: absolute; + top: 40%; + left: 45%; + /* left: 0%; */ +} + +#hoverNav { + position: absolute; + top: 0; + left: 0; + height: 100%; + width: 100%; + z-index: 10; +} + +#imageContainer>#hoverNav { + left: 0; +} + +#frameHoverNav { + z-index: 10; + margin-left: auto; + margin-right: auto; + width: 20%; + position: absolute; + bottom: 0px; + height: 45px; +} + +#imageData>#frameHoverNav { + left: 0; +} + +#hoverNav a, #frameHoverNav a { + outline: none; +} + +#prevLink, #nextLink { + width: 49%; + height: 100%; + background: transparent url(../images/blank.gif) no-repeat; /* Trick IE into showing hover */ + display: block; +} + +#prevLink, #framePrevLink { + left: 0; + float: left; +} + +#nextLink, #frameNextLink { + right: 0; + float: right; +} + +#prevLink:hover, #prevLink:visited:hover, #prevLink.force_show_nav, #framePrevLink { + background: url(../images/prev.gif) left 15% no-repeat; +} + +#nextLink:hover, #nextLink:visited:hover, #nextLink.force_show_nav, #frameNextLink { + background: url(../images/next.gif) right 15% no-repeat; +} + +#prevLink:hover.force_show_nav, #prevLink:visited:hover.force_show_nav, +#framePrevLink:hover, #framePrevLink:visited:hover { + background: url(../images/prev_hover.gif) left 15% no-repeat; +} + +#nextLink:hover.force_show_nav, #nextLink:visited:hover.force_show_nav, +#frameNextLink:hover, #frameNextLink:visited:hover { + background: url(../images/next_hover.gif) right 15% no-repeat; +} + +#framePrevLink, #frameNextLink { + width: 45px; + height: 45px; + display: block; + position: absolute; + bottom: 0px; +} + +#imageDataContainer { + font: 10px Verdana, Helvetica, sans-serif; + background-color: #fff; + margin: 0 auto; + line-height: 1.4em; + min-width: 240px; +} + +#imageData { + padding: 0 10px; +} + +#imageData #imageDetails { + width: 70%; + float: left; + text-align: left; +} + +#imageData #caption { + font-weight: bold; +} + +#imageData #numberDisplay { + display: block; + clear: left; + padding-bottom: 1.0em; +} + +#imageData #lightbox2-node-link-text { + display: block; + padding-bottom: 1.0em; +} + +#imageData #bottomNav { + height: 66px; +} +.lightbox2-alt-layout #imageData #bottomNav, +.lightbox2-alt-layout-data #bottomNav { + margin-bottom: 60px; +} + +#lightbox2-overlay { + position: absolute; + top: 0; + left: 0; + z-index: 90; + width: 100%; + height: 500px; + background-color: #000; +} + +#overlay_default { + opacity: 0.6; +} + +#overlay_macff2 { + background: transparent url(../images/overlay.png) repeat; +} + +.clearfix:after { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; +} + +* html>body .clearfix { + display: inline; + width: 100%; +} + +* html .clearfix { + /* Hides from IE-mac \*/ + height: 1%; + /* End hide from IE-mac */ +} + + +/* Image location mod */ +#bottomNavClose { + display: block; + background: url(../images/close.gif) left no-repeat; + margin-top: 33px; + float: right; + padding-top: 0.7em; + height: 26px; + width: 26px; +} + +#bottomNavClose:hover { + background-position: right; +} + +#loadingLink { + display: block; + background: url(../images/loading.gif) no-repeat; + width: 32px; + height: 32px; +} + +#bottomNavZoom { + display: none; + background: url(../images/expand.gif) no-repeat; + width: 34px; + height: 34px; + position: relative; + left: 30px; + float: right; +} + +#bottomNavZoomOut { + display: none; + background: url(../images/contract.gif) no-repeat; + width: 34px; + height: 34px; + position: relative; + left: 30px; + float: right; +} + +#lightshowPlay { + margin-top: 42px; + float: right; + margin-right: 5px; + margin-bottom: 1px; + height: 20px; + width: 20px; + background: url(../images/play.png) no-repeat; +} + +#lightshowPause { + margin-top: 42px; + float: right; + margin-right: 5px; + margin-bottom: 1px; + height: 20px; + width: 20px; + background: url(../images/pause.png) no-repeat; +} + +.lightbox2-alt-layout-data #bottomNavClose, +.lightbox2-alt-layout #bottomNavClose { + margin-top: 93px; +} +.lightbox2-alt-layout-data #bottomNavZoom, +.lightbox2-alt-layout-data #bottomNavZoomOut, +.lightbox2-alt-layout #bottomNavZoom, +.lightbox2-alt-layout #bottomNavZoomOut { + margin-top: 93px; +} +.lightbox2-alt-layout-data #lightshowPlay, +.lightbox2-alt-layout-data #lightshowPause, +.lightbox2-alt-layout #lightshowPlay, +.lightbox2-alt-layout #lightshowPause { + margin-top: 102px; +} + +.lightbox_hide_image { + display: none; +} + +#lightboxImage { + -ms-interpolation-mode: bicubic; +} diff --git a/sites/all/modules/lightbox2/css/lightbox_alt.css b/sites/all/modules/lightbox2/css/lightbox_alt.css new file mode 100644 index 0000000..dc0cb58 --- /dev/null +++ b/sites/all/modules/lightbox2/css/lightbox_alt.css @@ -0,0 +1,230 @@ +/* $Id: lightbox_alt.css,v 1.1.4.22 2010/09/22 10:47:15 snpower Exp $ */ +/** + * Based on a design created by Nicolas Borda: + * http://www.ipwa.net/assets/myslimbox/ + */ + +#lightbox { + position: absolute; + top: 40px; + left: 0; + width: 100%; + z-index: 100; + text-align: center; + line-height: 0; +} + +#lightbox a img { + border: none; +} + +#outerImageContainer { + position: relative; + background-color: #fff; + width: 250px; + height: 250px; + margin: 0 auto; + min-width: 240px; + overflow: hidden; +} + +#imageContainer, #frameContainer, #modalContainer { + padding: 10px; +} + +#modalContainer { + line-height: 1em; + overflow: auto; +} + +#loading { + height: 25%; + width: 100%; + text-align: center; + line-height: 0; + position: absolute; + top: 40%; + left: 45%; + *left: 0%; +} + +#hoverNav { + z-index: 10; +} + +#imageData>#hoverNav { + left: 0; +} + +#hoverNav a { + outline: none; +} + +#prevLink, #nextLink { + width: 45px; + height: 45px; + display: block; +} + +#prevLink { + left: 0; + float: left; + background: url(../images/prev_alt.gif) left 15% no-repeat; +} + +#nextLink { + right: 0; + float: right; + background: url(../images/next_alt.gif) right 15% no-repeat; +} + +#prevLink:hover, #prevLink:visited:hover { + background-position: right 15%; +} + +#nextLink:hover, #nextLink:visited:hover { + background-position: left 15%; +} + +#imageDataContainer { + font: 10px Verdana, Helvetica, sans-serif; + background-color: #fff; + margin: 0 auto; + line-height: 1.4em; + min-width: 240px; +} + +#imageData { + padding: 0 10px; +} + +#imageData #imageDetails { + width: 70%; + margin-right: auto; + margin-left: auto; + text-align: center; +} + +#imageData #caption { + font-weight: bold; +} + +#imageData #numberDisplay { + display: block; + padding-bottom: 1.0em; +} + +#imageData #lightbox2-node-link-text { + display: block; + padding-bottom: 1.0em; +} + +#lightbox2-overlay { + position: absolute; + top: 0; + left: 0; + z-index: 90; + width: 100%; + height: 500px; + background-color: #000; +} + +#overlay_default { + opacity: 0.6; +} + +#overlay_macff2 { + background: transparent url(../images/overlay.png) repeat; +} + + +.clearfix:after { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; +} + +* html>body .clearfix { + display: inline; + width: 100%; +} + +* html .clearfix { + /* Hides from IE-mac \*/ + height: 1%; + /* End hide from IE-mac */ +} + + +/* Image location mod */ +#bottomNavClose { + display: block; + z-index: 200; + background: url(../images/close.gif) left no-repeat; + position: absolute; + top: 0px; + right: 0px; + height: 26px; + width: 26px; +} + +#bottomNavClose:hover { + background-position: right; +} + +#loadingLink { + display: block; + background: url(../images/loading.gif) no-repeat; + width: 32px; + height: 32px; +} + +#bottomNavZoom { + display: block; + background: url(../images/expand.gif) no-repeat; + width: 34px; + height: 34px; + position: absolute; + bottom: 25px; + right: 5px; +} + +#bottomNavZoomOut { + display: block; + background: url(../images/contract.gif) no-repeat; + width: 34px; + height: 34px; + position: absolute; + bottom: 25px; + right: 5px; +} + +#lightshowPlay { + background: url(../images/play.png) no-repeat; + display: block; + margin-right: auto; + margin-left: auto; + margin-bottom: 5px; + height: 20px; + width: 20px; +} + +#lightshowPause { + background: url(../images/pause.png) no-repeat; + display: block; + margin-right: auto; + margin-left: auto; + margin-bottom: 5px; + height: 20px; + width: 20px; +} + +.lightbox_hide_image { + display: none; +} + +#lightboxImage { + -ms-interpolation-mode: bicubic; +} diff --git a/sites/all/modules/lightbox2/css/lightbox_lite-rtl.css b/sites/all/modules/lightbox2/css/lightbox_lite-rtl.css new file mode 100644 index 0000000..9978dd8 --- /dev/null +++ b/sites/all/modules/lightbox2/css/lightbox_lite-rtl.css @@ -0,0 +1,60 @@ +/* $Id: lightbox_lite-rtl.css,v 1.1.2.6 2010/06/07 14:54:30 snpower Exp $ */ +#lightbox { + background-color: #eee; + padding: 10px; + border-bottom: 2px solid #666; + border-right: 2px solid #666; + min-width: 240px; +} + +#lightboxDetails { + font-size: 1.2em; + padding-top: 0.6em; + min-width: 240px; +} + +#lightboxCaption { + float: right; + font: 0.9em black; +} + +#keyboardMsg { + float: left; + font: 0.9em black; +} + +#closeButton { + top: 5px; + right: 5px; + width: 20px; + height: 20px; + position: absolute; + z-index: 200; + background: url(../images/close_lite.gif) no-repeat; +} + +#loadingImage { + position: absolute; + top: 30%; + left: 45%; + height: 25%; + width: 100%; + text-align: center; + line-height: 0; + background: url(../images/loading_lite.gif) no-repeat; + width: 126px; + height: 22px; + z-index: 150; +} + +#lightbox img { + border: none; + clear: both; +} + +#lightbox2-overlay { + background-color: #333; + opacity: 0.6; + filter:alpha(opacity=60); +} + diff --git a/sites/all/modules/lightbox2/css/lightbox_lite.css b/sites/all/modules/lightbox2/css/lightbox_lite.css new file mode 100644 index 0000000..7689032 --- /dev/null +++ b/sites/all/modules/lightbox2/css/lightbox_lite.css @@ -0,0 +1,60 @@ +/* $Id: lightbox_lite.css,v 1.1.4.11 2010/06/07 14:54:30 snpower Exp $ */ +#lightbox { + background-color: #eee; + padding: 10px; + border-bottom: 2px solid #666; + border-right: 2px solid #666; + min-width: 240px; +} + +#lightboxDetails { + font-size: 1.2em; + padding-top: 0.6em; + min-width: 240px; +} + +#lightboxCaption { + float: left; + font: 0.9em black; +} + +#keyboardMsg { + float: right; + font: 0.9em black; +} + +#closeButton { + top: 5px; + right: 5px; + width: 20px; + height: 20px; + position: absolute; + z-index: 200; + background: url(../images/close_lite.gif) no-repeat; +} + +#loadingImage { + position: absolute; + top: 30%; + left: 45%; + height: 25%; + width: 100%; + text-align: center; + line-height: 0; + background: url(../images/loading_lite.gif) no-repeat; + width: 126px; + height: 22px; + z-index: 150; +} + +#lightbox img { + border: none; + clear: both; +} + +#lightbox2-overlay { + background-color: #333; + opacity: 0.6; + filter:alpha(opacity=60); +} + diff --git a/sites/all/modules/lightbox2/images/blank.gif b/sites/all/modules/lightbox2/images/blank.gif new file mode 100644 index 0000000000000000000000000000000000000000..1d11fa9ada9e93505b3d736acb204083f45d5fbf GIT binary patch literal 43 scmZ?wbhEHbWMp7uX!y@?;J^U}1_s5SEQ~;kK?g*DWEhy3To@Uw0n;G|I{*Lx literal 0 HcmV?d00001 diff --git a/sites/all/modules/lightbox2/images/brokenimage.jpg b/sites/all/modules/lightbox2/images/brokenimage.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1cd4dca3debff0a7b52179dc50548c7f84e2e31e GIT binary patch literal 7033 zcmbVQbyyVdx1U`WmPS%)sRfrtkP@Us8l(gi2`L4Hl}_oBkfl)&=`KN}1!)zP&LtOV z=~~IVeB&4Q{{Fc4zH`p=%rkT5edlw|ne(2{T#R4L0aw(O)sz7c2n0OB9l*srnURv0 z-D3dI(gJt^03gIE0FVP_sLSj-HGEx!}QU)q&3K|$AD+`Q~nVF4K5W&X54`*iPmf+#PE-Wf4%8IxtBPnuA z@P??! zq5m~NU_1yu0hEx4m;`6=;R*l-;o*THc=-4b9CVN$?mhsa#HV5xRv@6(wSaOs(})Dc zXA{D2SGCdV4QzAXuyhF~BBr}a&%nra4Z+RBD=H=~A$e0u@s5(RimIBr{yhUjqx%nx zt*mVxKe4s5cXf03@bvQb2?-4gk9ZLom5`W}oRa$Lby`ktUVcGgQE^H2`tGb9vK}QpO~D-Ec{$tT3%UQ+u7aQKR7(X{yx6M1p@H?g!K<({|y%< z4i^{#!Gl0Aae=^|IK`uc;Ij)8P$}p_Eu5)2M1lxuZpUX=wGqK@=xx(lx(pE0af;4! z?Oa0p1KIx$Sn&S~**}2&6W1g_iU-04504U%1CEZla{`I~R$iv2dVWWn#>QlhU@jrf zSSMN)J+0>(3qmoB1-TeP^NzhQc7+ofjk4E~6k0#z8kL<|BbT$F1N%l?b8@h8uQByK zOEh^lA$V!{?Y#@Y%cuC@l+3*b&{d-OA9_#1)9F51&DE7x38HSM#yo$IJTFbKBD=aa zVQJ}J6k$?xg0zLf<@#eg2#iusbOl;-h*5Rlc6QP1rAtTd_5FQT+~Rot@Ke?L9lwbo zw;@iSThDeYl^c-XI)(-UsQd2v_bR@0Oy5uxsqcnv`^l_nA=K$guD!w&UXg3M0LIF1 ze{yHjfl5E|F7Z+^2|sW5i1LcHigR<{%=3iSR~9rAEi_Ruu9`VKv}k<+a<$jy_ERaz zG;ePvUYg{q*VKzCUhxfC<0JlhbZ+9n=!o>u4Z?+e~)MS(Qo^)15-oVzb)_fGmL#e#P_K>-J+U^YS?Dt2EgJij$t7UeL zITqNxymUq&fuhMfIq!(VtW#|n$?>;jh$VNb8OkHq&H!^C71RkYErMWIq37&|`A$XR zCx0Nb%ay6O+smyUO}en9K0OjpoJDSTZN%Ldb!|cr5w{;TO(YjrZhH>HHoDD-+6BtZ zy6OL>PCLG;F|dC|H{j^Du3C0vo3{06pyWCI7^%mXXpq49#3Yh1~6GD>Jl)RJ5lt*O-*m`aUsjE zOqb<3RchKH$d-+?zE(RV@RNr_l6SB1ZJAUch0>|^J4gUk3zs&gH)XJ<)@$Dj&FnPB zPcZ{OX$jepo!U&!Co!P@0nLaB^kKUI7?CdvIEBlxt} zBKL3q@r(+aGV=o-(e#Q)vm55oB!-?GLL4X%(VvJkb?wN*MM5R7t$qD2&&&Ve5A_AD!798 z`DYcZjaAo7As|4qv0>P9&#L*vx@>Us(T<=35a)E0)1Q{&FmKh4Mgy)K%9?bO_ohsw zZ1=mu1PyfVv&STS&bvF!zaFp#2gNW&P-(pzXCf{lw9(F-{ryxO4;B(Y28~*p=Tiv+A@V2|fzwtxVCLT>` zoDa*~aa8+|yOv73)Ulb}k+dMYj0*2sKv;y6A2;4FAHKKS=209w0TJvYR&@ykmU^mF z%utv|CWhq#7;R((_`aPZo{L0x(QTC2*~YI6SHiOzbWagym5NxFP9GZ@&`x>suVaIu zNz?8X%BW`K^?`S{cFy>+-jGD|K&-DPh|t9Trd@BPKBw=(*fJRm#=}S9=C6H7l3}P5 zvxse(syRc6p;aSoJCE3?Sc3(N@Rvc$s3mT^EUbZlt*rD1BWc4Wi4eqa3~EHaVh=OV zF6u%^F9AiIja0HUQQ1wVnHqoAU!qpvV2QX%f6Tb{Tm!SAfq@)*B->a8gEIw`A1w0i zF(2yo&3`!rej){p=gM?LYCO)5I7f5jYZ;BbAJwFCHTU#v7myG9(!jd_K(y=UOjy%g zJ0G`zNuB84!zGoOHry8CE)Ne{pDDve%+I73tzu+ExXY06FEJ&jc_$Y@rnWk;D^aH} z(^VN)O4f2Vc;HaPM&qq&Y2*)yN| zLhxEFnfjq*IW+?xkL#x%yu#f|gP}5knhYsEX`2ZMUr^%j1Y5jBY^8sSKcpcvzGd_N zyzT`6o(fPBTVP>ErAJCT<({4!)a^)gMPg*!9m{6@!cz3aVVtf2ctnd7z`!3j+l5 z^XSB@j3+ze+NeTfMd^v57W%qM01ZxQmsqJ==zB1>tcHW}R+ovO0$xkErLdHd zjRLS`si7ZVVs7~|2QxSgNY3q?c9{&gXQ;F{wwphwj+AdBmEe5ggUar)KSD)b0Hjts z{6eLx!eu_4PxlHHT%dnVB^wZK{{HKsRH#4|eJMPc<=WP!Oc&rA8?^IKekAu!OX7*t z%C;d=C-cebZ%iZhgP*w9QAd%nYU|8{B-FCGm_`;ISmVLSKm(|?(?CCa7Vo@RyJcRU zRoUKOe0wR8N$f|t!+nYaXSr8B+a_ZP*gj0yOe;;A|0~p!M^n<&Ctp;ud!|`BDl6@O z=JX3roi0iCG<-SZ855pdgX~Ji?h?s4!(~!3Zl1NMYlBkvoSg1N;bmF^1K=QwMeYms0QU9XNO_+!d!c#Sp zwc|VXX^lcZLW2Hu;a2}4eAqUN;-%Z!ZBvo?a%B97K~&>)_FUv?fUv1Zbz`_5aeSPL z&w)@BD=B=3S*Xl*r^J4x!K(-Sle}l(jKV*niUpq_+p{3D`~h)wLOv(GaIN>ku?|6Z zX-Rp`s~ol;Drb9_eNRAyIeA6%6TidtEfE0@#M#e}j2`D}7l1x`U2S`Peq{Eg&^g+7 zNh$Bn1@JL7S95mCe9hNrNZe3-(mhGsBQ8&TyGV6GAuvk^WMku4_@K+qj#%*-@t=8T zU-cily~_^J2!z=RW0Z?JC^gl}D7PV(9a|JSea`mFk11<<6>Air1Q=CS)ebpiSHBNq zuMNAc!bpk_F8eEqFBADv11=^m&Vj3nE;bf!Hr8yOc5b$8_iSz0RMfO|{@_XYco1Ae zj%&vu`1m*mLVC%VpcEt|M5L4yR8*7{l$6wT%vY&t7-=af>DlQSVK7!!R_d!9oE$8i z%q*-dfAA#Sqfi1UIUylA3k@X=%l~=&XPyMZkvT9JM=AbhNdQ1V2!Vp|iNJU`x^e3Y z@E1uUz{kVCG`eIP06rxFJCsUTfsk64LqyLah=vw^+d19^$0!DFRL^r-S_LO;DWB~xeJ3tUB2@Y+H%?-59L4JbiP24C;4 zh*#XOXU0?7X-ctm)3g!zH&iXHm?B&G@R0%}Fl7AaR;*5QP5HA=vHTNW*@dzLtO;C8 zBJ!C)>7>J{9X4GCg^ci-pdr>v`ZwunoMNBc*qRcgVth#@ZSTCCp`*^E%D|b}ZzQ3% zBam{mN&Qodk<(*%p-<{vl6auVJ+&3y7ufg(hZ&Bk1-kHUW3mlm+96lzBm&w{QuT}!sOVu<8f@*7?N zE`a>w=j%sjC>n}19|siWMK?!e|%{oq3B>(m69 z2;FI7SQ`^f=C=Kb6JIo)8Mj^4HQ_rCJFSCcK}I!`EuyEYe_$>+lGNR#q-D8%JFX(s zUG0EX>cs@oCpto^QDCiC*g5}Q#bZ4JEep7m)>MBJnHbuu#+66y9N{E_qI~g?e4gi6nKtt#9Tc`sNe)1rW8Ts(Z{MKQc0S zjO-~8D5|^f7@wuAIxT>3&otmGL48a6b=rN}$M;S9bhH$AKM$yaPtU6cDWHQtb6$`d1x zZM8!68CPMr)Zlrb&x?&HA;-!oesqw+=TXPEntI$-ciYEdc@o7CKD_XwJ}W7k&AKSD zAM}7$>6ZS^+vPGLz5TF!k@8VOp_Ez2&XnntHF6?ngj*hEHATT)EFecg)%@&rCtvXX zO!{Sx2wFMhyN;6g>a0<27p{4Jx{|^7NRyy*B9cIj0ob< zeU_J-X=)nm_3(~Xo95?7oohkFyBt%?5B8-sZD<-?Qc~i|p7cIztXfG5_D^;bgRKp8 zz{G6pIs!H65{xypGVKJ!-xT}j?awwQi70!AA-6-wicQQZBtgOgl`XSh?qs*F%$Jv9 zzJW9NiS@F-U!RNFWOC@&tYkL)aD7T?(ouq`KA}b4n8=RjCL7pL#jVK4+OkyUeB-*w z6LTxS{ODJWYQ{gkqcy7HXcFSo4FX;A!FPQgF&lEXY9J>&AJ00c3={E?bJtRcggfOp zj}I$99TfDWRrnBGBgAtk6Su;Y%r^jMn6-#WBdVmvmivz#uA5~j=<6(qPg+xbT#_Xq zDU}2e#duj?5Ym?3^JWI`wbt$EpbG_B?Z5g-zo|}C3h)`niQM>_MX*q;dThUPm@Y~J zr-IKAHe4kUi7V*4Hg`oYdqgI7R`|^@I?$ncjEP^Xu`2+vcJ9 zMKvdaob!T+nV-5xLn|sPo{)QkLB>}*m%$59Ki{>N5g*dD_h33qtk#vm+vVOT>HcEW zzY#1k!hNf`+Vq;;Nl0yPx{zqflt6QDB)bDYGc0xiT2!1j_qsN9@N4kk9xox!O(@*H z+8^O{mDNE$$`Oy~&OT_f^qmt~LS;4@qMr^MwF#cvs9x&*&Q(Y9Oa!C) zkOT^~s&8A9`v~c6FQ0BQqMsArZJ>0r826SfVgABuzz$!37}C|I_h5)uJ=oho3|EN> z`n7kz8)`I~zqco-5FZ;J!(6+kf|gx{vW4uzj}6-~=9KPGdYke6k%GRjSywa&RrO{P zbi+#JlB<%f7B^Vqo<59OzE&*!ig>qs9Q#A9Z?Bj{n5kxU^fbbOrvpLyJO3hr5Tg6Uk;ho*Ht^PZXP(A8>Ofo2Re~Qz3Zg{UF zxf*i;TyZc05v%8R-l-HmS6s}_nH-EW7~<*@Lbj^^Dtk^kM$L5tSGhec#Xhu{*>I@8 z)&2Bo@vd;(jhF?7V}ln%qtX6vtCVZd=-uqjXUVs|emUUPmFd&773+ywe{VQLt{s&R zY_n~HTe~9iTBwr*(K+l2sNrM zJNdi}R{2allOt$CkWnr1%!#H$y+T;$+$-pZTe z^=vNhoO4>~@HiE>*TH%#62rdVm#z(2-QlZKXw}XnXQr)p=3PHp{3XY#+2bj6OO52! zJ5NXG5XJ}@;-A_*fDE&%?WslQyr*M++~H6?=&ctT8%Rvvm8|{~)z$05M z$rJ-CnZv%F(_qBhNXyj}K})?(^5?T6(%cWK)_yd{gzvfHOR1SH%dYCt=l5dHu8s!% zvOXcz3iqWn#<1iBPuj9xkwWOaLrX+_51#YTce(ojaXtog%SETunrNvME>^QdKd-$t zar(XYcEl!`E{~6bhN=%*jJ&ogDMCh0ceHVF_339rh&A65Gp>>}Gp0sKk!XwLPl?HV z)KKk9g!S)5EPjp2oTYtO-`5lUwj%Zbb+`JU+{`>@>#tJBg=%=bEN3ZBHnrbw3Kp6anamX_Dwp*o*Wnv##GWQUcF9Z;?V>MSiG z>kprHq~cfH(rEHK@TKS;5}xkuqq@Ds4?`>LW0TRfXR^<4ZksK1_V&z5RLY8{#cnOM zsF9@L;`;u4(PQJIxwKd{+1oLeF^8ycs=Dc9)xB!%m(f%B{uWIz;DBnRAMalYEW28r5j2(z_hD&b*{5 zD)7^A4tx6I4~M<$P+L@|k^=ZdlCt#vT@2GP%MsIjon#O2bS3vvzVNvDEg!m394`fq zvxfOWfOy=AmCpGNQygulZ#Oc9$KJ(sA{j$mVLntmL{tLH% B#A5&e literal 0 HcmV?d00001 diff --git a/sites/all/modules/lightbox2/images/close.gif b/sites/all/modules/lightbox2/images/close.gif new file mode 100644 index 0000000000000000000000000000000000000000..1a98c048653db82102bfd3f76f70b78a12a1ea68 GIT binary patch literal 388 zcmZ?wbhEHbG+~fpIKlt||NsAAvu4ebB}-<^n9<$c-O|!hTwI)=pP!kTnVg&)7Z(>D z9UT=F6%i2;5)u*^7zk7k)<+bf_>+Z^fkBW#2c#NgCj;yM1eLy&%y}8B*5$n3S1?EI z%|S7pjam~Ht4(NMm0-Zry_x;-Lu*D!zK5L=CVs2Kf){SjnIzQj_PEi3bHh!+tt*@* zt9Xw;l1_6twUTkx7PBqE`8!CSCywjJ9oj*{4>B;$)`H>3FT{51VmYkfd<^&86YXG!_hFMt7 z?)3EZ`1ttz{QQfHi(VJQm6l;!3q GApkq#UySVl literal 0 HcmV?d00001 diff --git a/sites/all/modules/lightbox2/images/close_lite.gif b/sites/all/modules/lightbox2/images/close_lite.gif new file mode 100644 index 0000000000000000000000000000000000000000..773013bbe3e05afb8c44830003f8b590a6240415 GIT binary patch literal 109 zcmZ?wbhEHb6k!lyn8?g9efo3<2Zwj>-u?RZRq-baBLf37gAM}_faDpN?B?{ZJpGnG zS$NB>+3U9LY${-7xEgpca_)kFSu3Kp>d7ce$I8#@dgk`y)y5o6#kF5Kd)s!Mb$h1b NIJaAaJ&=LH8US}zDir_# literal 0 HcmV?d00001 diff --git a/sites/all/modules/lightbox2/images/closelabel.gif b/sites/all/modules/lightbox2/images/closelabel.gif new file mode 100644 index 0000000000000000000000000000000000000000..87b4f8bd699386e3a6fcc2e50d7c61bfc4aabb8d GIT binary patch literal 979 zcmZ?wbhEHbbYc)=c*ekR;J|@{2M^AjJ2x^i^3tVC&CSj0*RTKj_3M)-PXYo0cI?>E z)6+9$%9N0hkg%|@J9q8`1qGcvc``6CFd`x%G&JWG1!QZ}p`}_Crt5>gn{ra_R z*|PBP@I{Lj`S|$w`}?P*rG5YY{qEhnXU?2SNJyxzu3ors;h#T$K79Ca@7}$foSdy& zxBmY9d+OAwXV0EJb?Q__MaApauf4s!A3S&vA0NMS=g#~0?{C?%rLC>4pr9Z*Ir-_+ zr;{d4>gecLxpHM*Uf%TS)ARH5uU@^{*Vp&5E2E;KQc_ZUeSM3Ii__E7r%jvI-roNB@nb(fzs$_c+qZ95RaO1} z|Nq~=e++a1ia%Mv_UM2}P@FKZ|8IzCYHn$5Ywzgn>h9_7>+gx3Gn5iiIZY<+?`^k#V9jLtyr*r!J=422f09{b+Ju)CUT+TQ$(XUHpFrqp3WW>wX1uv zuMxADYt*_`D!j~cc9U4RqaSdy#4<#mnaaTWAexn73fF5^{TRmAubUT3M$0pEhL|XZa-W~L|(gBwDDiyC{R^)5V?SdhX{^V3U3;)26b z9`PG&9vg+2LK~Ub)t*kN@Dpm%WzyoDVKHUWf+~JK$+ZDZ@~kR1)Kp$5Zt9+<`%Y)- z>yw)=g|fzKY2BzS@eXpHy5ookQ(^-%AM<|&o|T%JuT^(X?uuf%wX|uMuC&0ET*U<& zn5MV|N-Q);aBAjTtM<^<-0=N0@0#5*3?I(E@i^2b=>KSu3P#TbT%XyyED9)8M!}zkkRC?kPTh mHXNSne@Ka2Tq>lLlg+!}=2PuWCXYMo(tpiJ>u+RWum%8KFq1q0 literal 0 HcmV?d00001 diff --git a/sites/all/modules/lightbox2/images/contract.gif b/sites/all/modules/lightbox2/images/contract.gif new file mode 100644 index 0000000000000000000000000000000000000000..b7a0a6409909f7ea2d27553914c12d83dbf908f1 GIT binary patch literal 213 zcmZ?wbhEHbRANwKn8*ME|Ns9tHZ}&5ia%Kx85o!ubU>mYc?PCsb5d8H?$J7wz2&H6 z^BS9{e={!|SWReCdgwN-`@~iKD>R~qTBaMq9d z4E44tU%sY3`S#_8OJk;(>CVj1=c$@MIlVZhZQ)>9JoVJ&BI6T_J&THsem)fY!MyEs NMahBfGXoeHtN}_eUCRIf literal 0 HcmV?d00001 diff --git a/sites/all/modules/lightbox2/images/expand.gif b/sites/all/modules/lightbox2/images/expand.gif new file mode 100644 index 0000000000000000000000000000000000000000..26d9ed02ba5245846bb424bb02d3a31a334f112a GIT binary patch literal 209 zcmV;?051PWNk%w1VIlw`0FeLyGcz;)|Ns9000000A^8La6aWGMEC2ui03rY)0007_ zgny#TEeJuFGysQ}tkc+-Ws&4v;VFLBGn!6&k>taz;a0_}o}+XxTj4ssq3~n)^=`FT zQd6_NqOL}8$uO2gCT*6}t!BSVug0gqRn_Q}nD%a;F>$&5j?dTY@|jhN#|A}&wg#4V zIQP<(h*-9#f;C97MMss=l$B%zICY3{B#B80H)D3<6~rU@_qoF|!WFBU$5aB+7ZKT5 LNCjgDQvd)v!q;7m literal 0 HcmV?d00001 diff --git a/sites/all/modules/lightbox2/images/loading.gif b/sites/all/modules/lightbox2/images/loading.gif new file mode 100644 index 0000000000000000000000000000000000000000..f864d5fd38b7466c76b5a36dc0e3e9455c0126e2 GIT binary patch literal 2767 zcmeH``%_bA0*1eHPVNawNVtR;Fkp-nQj8edfS`v<5L7TgR6wi;WfgH-0}4fE+c_uU zB6tf6auF}FAcDdgg|bMU&H)LR5jARM!8$tuwd$nHqS?K-=JNZ+yGvz=Iegxp{+qWGZ9j{-%9vvN>n3$NJp6==CAqYaF(LfM1Z{EEA{{Gt9 z+Ba|B7z_sR+xabl|E~mm-*OXmhLq??y)HONjX>1ze1D?RIn=G1`RR-%fb}zgSh6^a z(}Zw20U1L^Cs9UcyJfc+al#}J2xVlYUoR{`gd&QDxAb1w4>I~5gc?ccq(G+T!I;H};U_uyHR0@hr>Qk1P1=6fvUBhR zb|&^^cEQtu&W}=-=YR7o5UI)AD*~%J7bkVd5`xrdw{bHm;|Bf^_|FG$9l}`ruhnVF zO%=6X*I#yro*pmfB;-A0cVjz73Qy)`oa=df_3Bx6!M3TNALf9BwI*di`jhdovR(I= zFT31zui1Xw??+Ym-lWNq=V6~8tt012$@*hy3So0QNJ#eIJ4Yh{qJ+aTY>ng8W1p4BrwB_>i7AY-xmGrA}hAeq`aX(yx~=c&|=$w&*&PpKd;G@@0oXK@D0x=;tyY&Eb|HKPsM z71v`PO)na3pfO*xUD8Z|CQju)c+RSAH=5V^4vb9Q2JwHwt|-INt|!nD?AlRxF5ZT8 zaA9~hGb$~rMhQh_0+31$tkzyLi>X3c7>F!|Jyn`+5{LG=E`sIQbHA8!=`uday6D6Y zNtVL?j^`6A%UuwO!`}j#s~H?w=P<5}Z2)*PPx|5q$MM+1K6_d_cie9JVArbrB2sRy zOl**1Mc+|zLM>munG#O|##RApuODr^1+pL-?SHX+D6Dz_@%-Oo(fM&hHYZ-jWU5jf z&nBYG;>F6&Y`veoLdZ@0WyrDsuXOP)9g*C`A(+R`Ryc2+9w_DJNaf@Dzg?~N{uI_} zjV(!yygvrGv#KF*Mt{6H^v1Ve=hQyF2^E~bd#&iZg;(%dS^nM;oGSF1Y^&rY}Ian zFrp%SBGPyN{Z?t%Mo#!qgLQ2)k{>KAv?=zezKN*qPRf>^4QjcWgyxiC}7Vb6vGrBLR(1J&B%*gb{`!Jljb^2%jB$ zFBNUHANC6Q?0~M}cVtgk_;_DAB-BE?2dP z(C9OIXza3Ao-@UyqX%`5cjg#cHl!uHq;&?~JO{eE+A2KSSD)s8v&CiV$kV$A=DG@i z;6JY7z*8oPdj@bbJQoTAENW#ls(ucbGA#yhN>zbWqBTbLl>rGqOAY+` z=psSt8VQE=9+X8^$l@oeDzRvja79ry3nvLcOR7+)bIFyJVoz4}URM-47_u>V zY*^e(o`?|l++*Y0uQ#&dKapW1o?J{jx+*_gKV^cW+W87KI7hZ5viXv$$=1IR^Z~yA XWBrHU7iSEP8X8hQyAJO{V6g1pwSv80 literal 0 HcmV?d00001 diff --git a/sites/all/modules/lightbox2/images/loading_lite.gif b/sites/all/modules/lightbox2/images/loading_lite.gif new file mode 100644 index 0000000000000000000000000000000000000000..fbe57be3c2cd761a999fcf91698963b723916e28 GIT binary patch literal 2364 zcmZ?wbhEHbtYZ*kxT?eu6cnVVr)OYb;OXfZ5D?(+@9*Q|gwj^791R$m6fiquVZa(9u*a3Yik=E?C0cUXJ}|>WMpJ!W@cewVPaxpX=$04 zmuF>V<>26;tE+2lZ2bTKe+JqB#sA!Xt|7tBjsdPldIrplKwA`lvam8RC^6`OYy^3e zf$jf+2?ZWHQvD~E6rIemnt!~n#A|KT`WtJ?PQR_%f4P0bXU*B?Uu>y5o45P^haGop z{xt|xOsG5m{`dce#-`?$*0%Zz4uzCb4iR2nKK996Ra}#2uuoNxaFeK->pFkVyah{_ zELyg5h0EfFYgcVpBOxx%!_lLd!ZBeI^L}PV#sfzVGD@E~dE(HiQ)kYeK7K*^{DrG$ zub;bg?e>kkid)2Y$oEcUXXbv%#>B+-?)|$rlAphP{`B?B_aBnKe*FFV{}bnp^n8Vb z4Xnm05jz;??1)Km_z{(`py6ngm~q;gr3)7y?~}2w;?WFZ_ME70zf7ibp~{JAdg1%N ztl02Sy`xMmP{(0`I@^C9+h(@ECl{``xX7hn%6HWi=HR9N{cf>c3pFpT3R@m$y2^3k z1lK1ePhF00R%cLTxU|Yw`$+Tc?RmEk)oPcoYu{D;@z7Oo^On0i>i&OXebboT)RyqN z!D9OYo!bK0*ZKBI-+1@r^wiI3_jd1mAAf58Q?aWB7A{E}yHC!t<+l9v_`+OH?mpfs zvp2W575D4SwP0f5Tq(_-`u108-svrdkKOjge9k@GQSa`scJrfv1y1XuOS`tN410Hb zfA@R7se3{`hwQ8}?G09X+$FA`aYf^@%9%-DKi_xX8J}7|P4A|-f~RR?@h!b)3l{TP ze>l)AV9)mU^Me+_U%`qF;#@8QEz+kpmjq;P=?V60I=~U^(|I?;nAcQOZE|n7uG{8E z-9~=S%H5|dz63<^fvz@N(z;TS%+V=^6lGCYoS^qqJTSeRiYI(vo5sx@6~ zH+0Mnzb#tp)m))-ZN~Yuf=vhVHd}tMi0M_i@xH9TZvAq3#)ig*nwmPLrlywawvNWG z+PdC`qN28nij0i5yu7%$wv?3M;I^nJCl_b8Iv+n@WZNYM)OMu-wOwaGZ8sZG+Z_hf zcCP`oJ!C*_kAvG@gOcB+cu%Ey&DC1JsIjb|!p!J_fy8PPopX1Vr=5+PJh^p;<=K_D zU+1eN#v7R10`q&NJ3}=KD|ZYq&nq#sb#$@!H1otgV*AR780Vs(hyWFUszG%C7S4T zLnrN*1y6VLhXr1Gv(I1dty(+JZ_k6)I}Ph@zrWa1x4vBd5gTh$MN4a`6tFa`bK`Dg znb0C<|cxmhQ$Ficsv$Ww0VvZb@;Okh~BcwO7_8x3^_Uzfy z-`{`y`0>ih%JA^;|6ssC3Q+vX!pOiNz@P)t1hSKXb)5o>ZA#|6j8)4XzuH%zbG{_^ ze#N@?HShl)xWpjPqbSpNWWf$5g^5iJ#;z51ye%s;6Sk^#+;U&|yQhtj`_twE4q>S* z6($>Ajz?_AECtI&rbV$QXQd@_u@!PB@-r|NMs_n7#0DiY*Q87>El*)8ab)Renc&FW zoK@`FTbtv42tx5E z3nK#q7lRH+2xJBW%e8=$o~!p-ygs}8e}YC|O6I(bRqJwI?<>$bUy^&jVqLM@Ms?2E zg%^|`G&r#IdFb4laH2W)MzT~^K!$HZDqm*gl1bOTa-}6c*_NJQeDI~h%v+|X1PWj7 z$#OfsJtU8<%&0Kgn585q+?c)IG}SgD(~K!J$2>7O&&7XMM{I73VMSuQe&-xNqrS}L zx-m`pbyEyWV$)mu4YudHEY@GT%rIu6-In=#e8bq7PefK3u*`8jUcSy`6Wh-74#6b{ kb_JSWo@BAM$okdmH*ep)|M2nC=PzHsegE({Ser%s)kGG)rag9m^9{5g5@O5wO7c7e8FI3`xo11APcDk} z=UJ8G&9>HKS5Wf4c$QVg+tXu2YNv^=EWM@5y5QcU$4{ODG5v(jwV}*VpRx<8<0-`pa5zlY#M)-oIr#d z2c`s`grTFXW2l%ts~e55DhLY)as;+YRV14WP@TyqTUm|6s>QTRW@y&52ql|}m&B;a zQeOnyC4;BkN$Kk86A=aP@b4HG>n#=(2KoB=5)bwN00RmfNU-3Gf-poNgb@M&I}o6s A+yDRo literal 0 HcmV?d00001 diff --git a/sites/all/modules/lightbox2/images/overlay.png b/sites/all/modules/lightbox2/images/overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..7cee2984496bc1d3e1b441d6da7b7079fe24ee43 GIT binary patch literal 279 zcmeAS@N?(olHy`uVBq!ia0vp^sUXb31|&mjbk74RmUKs7M+S!VC(K#9UIO`&C9V-A z!TD(=<%vb942~)JNvR5+xryniL8*x;m4zo$ZGehadb&7l zNOhbQZHeI!aERbdNls?YRyux~fwASPL(M&^N^E zz`&ufs#;Q^!J{wLiH(Ux;ACQles2?l1H;5OsZJ-^6dF$SrN-#7a44){TNk;RE&bz` x%*$$fj*0`FAGEuH6{uT$1JD_z%#2Jt3~QE2P1aZ^8vyhzgQu&X%Q~loCIB#JZ_oe$ literal 0 HcmV?d00001 diff --git a/sites/all/modules/lightbox2/images/play.png b/sites/all/modules/lightbox2/images/play.png new file mode 100644 index 0000000000000000000000000000000000000000..fdf99bf24023747c9921b2efa01acf3f90055541 GIT binary patch literal 645 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc#=yY%t50_}ki%Kv5n0T@z%2yAjF;}#{Q(NH zq&xaLGB9lHtN9%`8OT>i_6YK2V5m}MU}$J&VEFkTNWWxYC^cYUc$L7wU^Rn*K|Fs_ z{82ZcxxYPK978H@CH?vT-=3L=fki;LmC{wuGuWFf@iX@wkYwa42k0;OFOec5`EkVNz%~(3F#t z!?Qi_ZqsUz)PfBg3=Z$B{VkE$1k`p_DThI!Va5bYKR>_!hYug#_zI{-MELIAyZ@yn zBpPmhe}6wcVr!P@oh+bjj@OQ!J9n<&%ZtD^W%oXVMYA~s99(t_Dl~M20a-pgE=&y! zP1-s-I)CyL6B{pAfOsisX=xX(T}#`rY15%q5(*6uxMt3nA+ck}4vC)LUP&7p8v_w$ z7J;r#g;s?%ix(eGNK0#51XLE_^W@pHv>$(en;)KQT`u7_*Q!-$8ZZ!=avr_CysJvFs03bt*D^Dz^3X; z$HP-owHM4e=iwv4#3JA)zOVlOyoWb7Ci6sZ&r4NN4Ps#Gc=b{M80Hcyco>*?7#7)2 WUd>dxULTlb7(8A5T-G@yGywo|_U$$R literal 0 HcmV?d00001 diff --git a/sites/all/modules/lightbox2/images/prev.gif b/sites/all/modules/lightbox2/images/prev.gif new file mode 100644 index 0000000000000000000000000000000000000000..aefa804ab4417b3c3e27733ffd8f07603fa41f99 GIT binary patch literal 307 zcmZ?wbhEHb)Me0RI3mEXapT6Mq@*ujzU1cSUb=MY?%lgBEiEr!zC3>X_^es8mM&dd zSy{Pf&z}DN{_ybd|6ssC3Q+vX!pOiNz@P)t1hSKXb;ASYzLd;)FE|}DU++`mK3|f1 zzhd3{n)m+?D6Cbe;bdSuzG#LMk4yl2Q>2x|qCkeymLqPG(T6T`^K#5+VzJz%Ah!E8 z!;Xj@>twq&2Q1iO&6DTkSI!*l!%)u1Q026EfN*V=QJuUx%$ P{l?8({6^Qb6&b7n50-It literal 0 HcmV?d00001 diff --git a/sites/all/modules/lightbox2/images/prev_alt.gif b/sites/all/modules/lightbox2/images/prev_alt.gif new file mode 100644 index 0000000000000000000000000000000000000000..5114838c8ab944549b68450f0eceff350e9a1fb1 GIT binary patch literal 265 zcmZ?wbhEHbjAGDb*vtR||NsB*@9%GEX{oHN%+1YBN=gb34+jc@CD94RpDc_F3>*wP zAPJBe3@qCOPI|81Yw`N*?*9oIeJPpqGFGk2dA+Yd=X^=-{fc$Vk8R{{j(OF$tS+=p+@a;B($?@s= zS=p&f#u+|g#U`0%@!rv9EPZCBwK-Fgnhfd!T7&Xyn!CEEE}9&f?`Am1b6(qml*J88 xXP28+g_x{iUblH?XMKON=^V=p%eB_0PMal6t_8mKS?cTG)Xdj;C!!W_T0UDx3aSG%a<=tpFZ8ad-ttdxBmV6w{6?D-@kvKIddjFJpBLv|Hj6~ z45&cyCkrD3gA{`fNEl=%1M7zbwZ4?hc^Ru_&DyrF;Lon2-1`;l-q*bUe_%m@hmKVL zi6?vwnMraS6F2WHNMX6W%%L%Jf|P{Agp~{i91_lK!3;AvTeQ_4lu66@2PxPd<8a|f z%w|;Psf$Qb<*$)sli+spsh4a_Dpuys>`+VS^a-p@O|Ow)VPs^T9>KbNxsm`2s}k#` ziGIr#EM?4K5GY!+Ryl@ms`DhZ=_yLH)hc*mvbIfDnJ&39>x>%z$_dBnPP7!YM3j_X zPLNn|>A{Tl$forhy*_{Wsw61P{_FQI=5N~KS}GDA28}G-|3d;K4s1v~+#;atHOFJ) OBLOL~;4K`C4Auad8=cVr literal 0 HcmV?d00001 diff --git a/sites/all/modules/lightbox2/js/auto_image_handling.js b/sites/all/modules/lightbox2/js/auto_image_handling.js new file mode 100644 index 0000000..f5c4f97 --- /dev/null +++ b/sites/all/modules/lightbox2/js/auto_image_handling.js @@ -0,0 +1,226 @@ +// Image Node Auto-Format with Auto Image Grouping. +// Original version by Steve McKenzie. +// Altered by Stella Power for jQuery version. + +(function ($) { + +function parse_url(url, param) { + param = param.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); + url = url.replace(/&/, "&"); + var regexS = "[\\?&]"+param+"=([^&#]*)"; + var regex = new RegExp(regexS); + var results = regex.exec(url); + if (results === null) { + return ""; + } + else { + return results[1]; + } +} + + +function lightbox2_init_triggers(classes, rel_type, custom_class) { + if (classes == '' || rel_type == 0) { + return; + } + var settings = Drupal.settings.lightbox2; + + var link_target = ""; + if (settings.node_link_target !== 0) { + link_target = 'target="'+ settings.node_link_target +'"'; + } + + $("a:has("+classes+")").each(function(i) { + if ((!settings.disable_for_gallery_lists && !settings.disable_for_acidfree_gallery_lists) || (!$(this).parents("td.giAlbumCell").attr("class") && !$(this).parents(".galleries").length && !$(this).parents(".acidfree-folder").length && !$(this).parents(".acidfree-list").length) || ($(this).parents(".galleries").length && !settings.disable_for_gallery_lists) || (($(this).parents(".acidfree-folder").length || $(this).parents(".acidfree-list").length) && !settings.disable_for_acidfree_gallery_lists)) { + var child = $(this).find(classes); + // Ensure the child has a class attribute we can work with. + if ($(child).attr("class")) { + // Set the alt text. + var alt = $(child).attr("alt"); + if (!alt) { + alt = ""; + } + + // Set the image node link text. + var link_text = settings.node_link_text; + var download_link_text = settings.download_link_text; + var rewrite = 1; + + // Set the rel attribute. + var rel = "lightbox"; + var lightframe = false; + if (rel_type == "lightframe_ungrouped") { + rel = "lightframe[]"; + lightframe = true; + } + else if (rel_type == "lightframe") { + lightframe = true; + } + else if (rel_type == "lightbox_ungrouped") { + rel = "lightbox[]"; + } + if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") { + rel = rel_type + "[" + $(child).attr("class") + "]"; + } + + // Set the basic href attribute - need to ensure there's no language + // string (e.g. /en) prepended to the URL. + var id = null; + var href = $(child).attr("src"); + var download = null; + var orig_href = $(this).attr("href"); + var pattern = new RegExp(settings.file_path); + if (orig_href.match(pattern)) { + var lang_pattern = new RegExp(Drupal.settings.basePath + "\\w\\w\\/"); + orig_href = orig_href.replace(lang_pattern, Drupal.settings.basePath); + } + var frame_href = orig_href; + // Handle flickr images. + if ($(child).attr("class").match("flickr-photo-img") || + $(child).attr("class").match("flickr-photoset-img")) { + href = $(child).attr("src").replace("_s.", ".").replace("_t.", ".").replace("_m.", ".").replace("_b.", "."); + if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") { + rel = rel_type + "[flickr]"; + if ($(child).parents("div.block-flickr").attr("class")) { + id = $(child).parents("div.block-flickr").attr("id"); + rel = rel_type + "["+ id +"]"; + } + } + download = href; + } + + // Handle "image-img_assist_custom" images. + else if ($(child).filter("img[class*=img_assist_custom]").size()) { + // Image assist uses "+" signs for spaces which doesn't work for + // normal links. + if (settings.display_image_size != "original") { + orig_href = orig_href.replace(/\+/, " "); + href = $(child).attr("src").replace(new RegExp("\\.img_assist_custom-[0-9]+x[0-9]+"), ((settings.display_image_size === "")?settings.display_image_size:"."+ settings.display_image_size)); + if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") { + rel = rel_type + "[node_images]"; + } + if (lightframe) { + frame_href = orig_href + "/lightbox2"; + } + } + else { + rewrite = 0; + } + } + + // Handle "inline" images. + else if ($(child).attr("class").match("inline")) { + href = orig_href; + } + + // Handle gallery2 block images. + else if ($(child).attr("class").match("ImageFrame_image") || $(child).attr("class").match("ImageFrame_none")) { + var thumb_id = parse_url(href, "g2_itemId"); + var new_id = parse_url(orig_href, "g2_itemId"); + if (new_id && thumb_id) { + var g2pattern = new RegExp("g2_itemId="+thumb_id); + var replacement = "g2_itemId="+ new_id; + href = href.replace(g2pattern, replacement); + } + rel = rel_type + "[gallery2]"; + if ($(child).parents("div.block-gallery").attr("class")) { + id = $(child).parents("div.block-gallery").attr("id"); + rel = rel_type + "["+ id +"]"; + } + download = href; + } + + + // Set the href attribute. + else if (settings.image_node_sizes != '()' && !custom_class) { + if (settings.display_image_size != "original") { + href = $(child).attr("src").replace(new RegExp(settings.image_node_sizes), ((settings.display_image_size === "")?settings.display_image_size:"."+ settings.display_image_size)).replace(/(image\/view\/\d+)(\/[\w\-]*)/, ((settings.display_image_size === "")?"$1/_original":"$1/"+ settings.display_image_size)); + if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") { + rel = rel_type + "[node_images]"; + if ($(child).parents("div.block-multiblock,div.block-image").attr("class")) { + id = $(child).parents("div.block-multiblock,div.block-image").attr("id"); + rel = rel_type + "["+ id +"]"; + } + } + download = $(child).attr("src").replace(new RegExp(settings.image_node_sizes), "").replace(/(image\/view\/\d+)(\/[\w\-]*)/, "$1/_original"); + if (lightframe) { + frame_href = orig_href + "/lightbox2"; + } + } + else { + rewrite = 0; + } + } + // Modify the image url. + var img_title = $(child).attr("title"); + if (!img_title) { + img_title = $(this).attr("title"); + if (!img_title) { + img_title = $(child).attr("alt"); + } + $(child).attr({title: img_title}); + } + if (lightframe) { + href = frame_href; + } + if (rewrite) { + if (!custom_class) { + var title_link = ""; + if (link_text.length) { + title_link = "

"+ link_text + ""; + } + if (download_link_text.length && download) { + title_link = title_link + " - " + download_link_text + ""; + } + rel = rel + "[" + img_title + title_link + "]"; + $(this).attr({ + rel: rel, + href: href + }); + } + else { + if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") { + rel = rel_type + "[" + $(child).attr("class") + "]"; + if ($(child).parents("div.block-image").attr("class")) { + id = $(child).parents("div.block-image").attr("id"); + rel = rel_type + "["+ id +"]"; + } + } + rel = rel + "[" + img_title + "]"; + $(this).attr({ + rel: rel, + href: orig_href + }); + } + } + } + } + + }); +} + +function lightbox2_image_nodes() { + var settings = Drupal.settings.lightbox2; + + // Don't do it on the image assist popup selection screen. + var img_assist = document.getElementById("img_assist_thumbs"); + if (!img_assist) { + + // Select the enabled image types. + lightbox2_init_triggers(settings.trigger_lightbox_classes, "lightbox_ungrouped"); + lightbox2_init_triggers(settings.custom_trigger_classes, settings.custom_class_handler, true); + lightbox2_init_triggers(settings.trigger_lightbox_group_classes, "lightbox"); + lightbox2_init_triggers(settings.trigger_slideshow_classes, "lightshow"); + lightbox2_init_triggers(settings.trigger_lightframe_classes, "lightframe_ungrouped"); + lightbox2_init_triggers(settings.trigger_lightframe_group_classes, "lightframe"); + } +} + +Drupal.behaviors.initAutoLightbox = { + attach: function(context, settings) { + lightbox2_image_nodes(); + } +}; + +//End jQuery block +}(jQuery)); diff --git a/sites/all/modules/lightbox2/js/builder.js b/sites/all/modules/lightbox2/js/builder.js new file mode 100644 index 0000000..8301999 --- /dev/null +++ b/sites/all/modules/lightbox2/js/builder.js @@ -0,0 +1,136 @@ +// script.aculo.us builder.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008 + +// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +var Builder = { + NODEMAP: { + AREA: 'map', + CAPTION: 'table', + COL: 'table', + COLGROUP: 'table', + LEGEND: 'fieldset', + OPTGROUP: 'select', + OPTION: 'select', + PARAM: 'object', + TBODY: 'table', + TD: 'table', + TFOOT: 'table', + TH: 'table', + THEAD: 'table', + TR: 'table' + }, + // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken, + // due to a Firefox bug + node: function(elementName) { + elementName = elementName.toUpperCase(); + + // try innerHTML approach + var parentTag = this.NODEMAP[elementName] || 'div'; + var parentElement = document.createElement(parentTag); + try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 + parentElement.innerHTML = "<" + elementName + ">"; + } catch(e) {} + var element = parentElement.firstChild || null; + + // see if browser added wrapping tags + if(element && (element.tagName.toUpperCase() != elementName)) + element = element.getElementsByTagName(elementName)[0]; + + // fallback to createElement approach + if(!element) element = document.createElement(elementName); + + // abort if nothing could be created + if(!element) return; + + // attributes (or text) + if(arguments[1]) + if(this._isStringOrNumber(arguments[1]) || + (arguments[1] instanceof Array) || + arguments[1].tagName) { + this._children(element, arguments[1]); + } else { + var attrs = this._attributes(arguments[1]); + if(attrs.length) { + try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 + parentElement.innerHTML = "<" +elementName + " " + + attrs + ">"; + } catch(e) {} + element = parentElement.firstChild || null; + // workaround firefox 1.0.X bug + if(!element) { + element = document.createElement(elementName); + for(attr in arguments[1]) + element[attr == 'class' ? 'className' : attr] = arguments[1][attr]; + } + if(element.tagName.toUpperCase() != elementName) + element = parentElement.getElementsByTagName(elementName)[0]; + } + } + + // text, or array of children + if(arguments[2]) + this._children(element, arguments[2]); + + return element; + }, + _text: function(text) { + return document.createTextNode(text); + }, + + ATTR_MAP: { + 'className': 'class', + 'htmlFor': 'for' + }, + + _attributes: function(attributes) { + var attrs = []; + for(attribute in attributes) + attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) + + '="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'"') + '"'); + return attrs.join(" "); + }, + _children: function(element, children) { + if(children.tagName) { + element.appendChild(children); + return; + } + if(typeof children=='object') { // array can hold nodes and text + children.flatten().each( function(e) { + if(typeof e=='object') + element.appendChild(e) + else + if(Builder._isStringOrNumber(e)) + element.appendChild(Builder._text(e)); + }); + } else + if(Builder._isStringOrNumber(children)) + element.appendChild(Builder._text(children)); + }, + _isStringOrNumber: function(param) { + return(typeof param=='string' || typeof param=='number'); + }, + build: function(html) { + var element = this.node('div'); + $(element).update(html.strip()); + return element.down(); + }, + dump: function(scope) { + if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope + + var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " + + "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " + + "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+ + "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+ + "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+ + "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/); + + tags.each( function(tag){ + scope[tag] = function() { + return Builder.node.apply(Builder, [tag].concat($A(arguments))); + } + }); + } +} diff --git a/sites/all/modules/lightbox2/js/effects.js b/sites/all/modules/lightbox2/js/effects.js new file mode 100644 index 0000000..b8c0259 --- /dev/null +++ b/sites/all/modules/lightbox2/js/effects.js @@ -0,0 +1,1122 @@ +// script.aculo.us effects.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008 + +// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// Contributors: +// Justin Palmer (http://encytemedia.com/) +// Mark Pilgrim (http://diveintomark.org/) +// Martin Bialasinki +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +// converts rgb() and #xxx to #xxxxxx format, +// returns self (or first argument) if not convertable +String.prototype.parseColor = function() { + var color = '#'; + if (this.slice(0,4) == 'rgb(') { + var cols = this.slice(4,this.length-1).split(','); + var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3); + } else { + if (this.slice(0,1) == '#') { + if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); + if (this.length==7) color = this.toLowerCase(); + } + } + return (color.length==7 ? color : (arguments[0] || this)); +}; + +/*--------------------------------------------------------------------------*/ + +Element.collectTextNodes = function(element) { + return $A($(element).childNodes).collect( function(node) { + return (node.nodeType==3 ? node.nodeValue : + (node.hasChildNodes() ? Element.collectTextNodes(node) : '')); + }).flatten().join(''); +}; + +Element.collectTextNodesIgnoreClass = function(element, className) { + return $A($(element).childNodes).collect( function(node) { + return (node.nodeType==3 ? node.nodeValue : + ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? + Element.collectTextNodesIgnoreClass(node, className) : '')); + }).flatten().join(''); +}; + +Element.setContentZoom = function(element, percent) { + element = $(element); + element.setStyle({fontSize: (percent/100) + 'em'}); + if (Prototype.Browser.WebKit) window.scrollBy(0,0); + return element; +}; + +Element.getInlineOpacity = function(element){ + return $(element).style.opacity || ''; +}; + +Element.forceRerendering = function(element) { + try { + element = $(element); + var n = document.createTextNode(' '); + element.appendChild(n); + element.removeChild(n); + } catch(e) { } +}; + +/*--------------------------------------------------------------------------*/ + +var Effect = { + _elementDoesNotExistError: { + name: 'ElementDoesNotExistError', + message: 'The specified DOM element does not exist, but is required for this effect to operate' + }, + Transitions: { + linear: Prototype.K, + sinoidal: function(pos) { + return (-Math.cos(pos*Math.PI)/2) + 0.5; + }, + reverse: function(pos) { + return 1-pos; + }, + flicker: function(pos) { + var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4; + return pos > 1 ? 1 : pos; + }, + wobble: function(pos) { + return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5; + }, + pulse: function(pos, pulses) { + pulses = pulses || 5; + return ( + ((pos % (1/pulses)) * pulses).round() == 0 ? + ((pos * pulses * 2) - (pos * pulses * 2).floor()) : + 1 - ((pos * pulses * 2) - (pos * pulses * 2).floor()) + ); + }, + spring: function(pos) { + return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); + }, + none: function(pos) { + return 0; + }, + full: function(pos) { + return 1; + } + }, + DefaultOptions: { + duration: 1.0, // seconds + fps: 100, // 100= assume 66fps max. + sync: false, // true for combining + from: 0.0, + to: 1.0, + delay: 0.0, + queue: 'parallel' + }, + tagifyText: function(element) { + var tagifyStyle = 'position:relative'; + if (Prototype.Browser.IE) tagifyStyle += ';zoom:1'; + + element = $(element); + $A(element.childNodes).each( function(child) { + if (child.nodeType==3) { + child.nodeValue.toArray().each( function(character) { + element.insertBefore( + new Element('span', {style: tagifyStyle}).update( + character == ' ' ? String.fromCharCode(160) : character), + child); + }); + Element.remove(child); + } + }); + }, + multiple: function(element, effect) { + var elements; + if (((typeof element == 'object') || + Object.isFunction(element)) && + (element.length)) + elements = element; + else + elements = $(element).childNodes; + + var options = Object.extend({ + speed: 0.1, + delay: 0.0 + }, arguments[2] || { }); + var masterDelay = options.delay; + + $A(elements).each( function(element, index) { + new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay })); + }); + }, + PAIRS: { + 'slide': ['SlideDown','SlideUp'], + 'blind': ['BlindDown','BlindUp'], + 'appear': ['Appear','Fade'] + }, + toggle: function(element, effect) { + element = $(element); + effect = (effect || 'appear').toLowerCase(); + var options = Object.extend({ + queue: { position:'end', scope:(element.id || 'global'), limit: 1 } + }, arguments[2] || { }); + Effect[element.visible() ? + Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options); + } +}; + +Effect.DefaultOptions.transition = Effect.Transitions.sinoidal; + +/* ------------- core effects ------------- */ + +Effect.ScopedQueue = Class.create(Enumerable, { + initialize: function() { + this.effects = []; + this.interval = null; + }, + _each: function(iterator) { + this.effects._each(iterator); + }, + add: function(effect) { + var timestamp = new Date().getTime(); + + var position = Object.isString(effect.options.queue) ? + effect.options.queue : effect.options.queue.position; + + switch(position) { + case 'front': + // move unstarted effects after this effect + this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) { + e.startOn += effect.finishOn; + e.finishOn += effect.finishOn; + }); + break; + case 'with-last': + timestamp = this.effects.pluck('startOn').max() || timestamp; + break; + case 'end': + // start effect after last queued effect has finished + timestamp = this.effects.pluck('finishOn').max() || timestamp; + break; + } + + effect.startOn += timestamp; + effect.finishOn += timestamp; + + if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit)) + this.effects.push(effect); + + if (!this.interval) + this.interval = setInterval(this.loop.bind(this), 15); + }, + remove: function(effect) { + this.effects = this.effects.reject(function(e) { return e==effect }); + if (this.effects.length == 0) { + clearInterval(this.interval); + this.interval = null; + } + }, + loop: function() { + var timePos = new Date().getTime(); + for(var i=0, len=this.effects.length;i= this.startOn) { + if (timePos >= this.finishOn) { + this.render(1.0); + this.cancel(); + this.event('beforeFinish'); + if (this.finish) this.finish(); + this.event('afterFinish'); + return; + } + var pos = (timePos - this.startOn) / this.totalTime, + frame = (pos * this.totalFrames).round(); + if (frame > this.currentFrame) { + this.render(pos); + this.currentFrame = frame; + } + } + }, + cancel: function() { + if (!this.options.sync) + Effect.Queues.get(Object.isString(this.options.queue) ? + 'global' : this.options.queue.scope).remove(this); + this.state = 'finished'; + }, + event: function(eventName) { + if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this); + if (this.options[eventName]) this.options[eventName](this); + }, + inspect: function() { + var data = $H(); + for(property in this) + if (!Object.isFunction(this[property])) data.set(property, this[property]); + return '#'; + } +}); + +Effect.Parallel = Class.create(Effect.Base, { + initialize: function(effects) { + this.effects = effects || []; + this.start(arguments[1]); + }, + update: function(position) { + this.effects.invoke('render', position); + }, + finish: function(position) { + this.effects.each( function(effect) { + effect.render(1.0); + effect.cancel(); + effect.event('beforeFinish'); + if (effect.finish) effect.finish(position); + effect.event('afterFinish'); + }); + } +}); + +Effect.Tween = Class.create(Effect.Base, { + initialize: function(object, from, to) { + object = Object.isString(object) ? $(object) : object; + var args = $A(arguments), method = args.last(), + options = args.length == 5 ? args[3] : null; + this.method = Object.isFunction(method) ? method.bind(object) : + Object.isFunction(object[method]) ? object[method].bind(object) : + function(value) { object[method] = value }; + this.start(Object.extend({ from: from, to: to }, options || { })); + }, + update: function(position) { + this.method(position); + } +}); + +Effect.Event = Class.create(Effect.Base, { + initialize: function() { + this.start(Object.extend({ duration: 0 }, arguments[0] || { })); + }, + update: Prototype.emptyFunction +}); + +Effect.Opacity = Class.create(Effect.Base, { + initialize: function(element) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + // make this work on IE on elements without 'layout' + if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) + this.element.setStyle({zoom: 1}); + var options = Object.extend({ + from: this.element.getOpacity() || 0.0, + to: 1.0 + }, arguments[1] || { }); + this.start(options); + }, + update: function(position) { + this.element.setOpacity(position); + } +}); + +Effect.Move = Class.create(Effect.Base, { + initialize: function(element) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ + x: 0, + y: 0, + mode: 'relative' + }, arguments[1] || { }); + this.start(options); + }, + setup: function() { + this.element.makePositioned(); + this.originalLeft = parseFloat(this.element.getStyle('left') || '0'); + this.originalTop = parseFloat(this.element.getStyle('top') || '0'); + if (this.options.mode == 'absolute') { + this.options.x = this.options.x - this.originalLeft; + this.options.y = this.options.y - this.originalTop; + } + }, + update: function(position) { + this.element.setStyle({ + left: (this.options.x * position + this.originalLeft).round() + 'px', + top: (this.options.y * position + this.originalTop).round() + 'px' + }); + } +}); + +// for backwards compatibility +Effect.MoveBy = function(element, toTop, toLeft) { + return new Effect.Move(element, + Object.extend({ x: toLeft, y: toTop }, arguments[3] || { })); +}; + +Effect.Scale = Class.create(Effect.Base, { + initialize: function(element, percent) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ + scaleX: true, + scaleY: true, + scaleContent: true, + scaleFromCenter: false, + scaleMode: 'box', // 'box' or 'contents' or { } with provided values + scaleFrom: 100.0, + scaleTo: percent + }, arguments[2] || { }); + this.start(options); + }, + setup: function() { + this.restoreAfterFinish = this.options.restoreAfterFinish || false; + this.elementPositioning = this.element.getStyle('position'); + + this.originalStyle = { }; + ['top','left','width','height','fontSize'].each( function(k) { + this.originalStyle[k] = this.element.style[k]; + }.bind(this)); + + this.originalTop = this.element.offsetTop; + this.originalLeft = this.element.offsetLeft; + + var fontSize = this.element.getStyle('font-size') || '100%'; + ['em','px','%','pt'].each( function(fontSizeType) { + if (fontSize.indexOf(fontSizeType)>0) { + this.fontSize = parseFloat(fontSize); + this.fontSizeType = fontSizeType; + } + }.bind(this)); + + this.factor = (this.options.scaleTo - this.options.scaleFrom)/100; + + this.dims = null; + if (this.options.scaleMode=='box') + this.dims = [this.element.offsetHeight, this.element.offsetWidth]; + if (/^content/.test(this.options.scaleMode)) + this.dims = [this.element.scrollHeight, this.element.scrollWidth]; + if (!this.dims) + this.dims = [this.options.scaleMode.originalHeight, + this.options.scaleMode.originalWidth]; + }, + update: function(position) { + var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position); + if (this.options.scaleContent && this.fontSize) + this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType }); + this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale); + }, + finish: function(position) { + if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle); + }, + setDimensions: function(height, width) { + var d = { }; + if (this.options.scaleX) d.width = width.round() + 'px'; + if (this.options.scaleY) d.height = height.round() + 'px'; + if (this.options.scaleFromCenter) { + var topd = (height - this.dims[0])/2; + var leftd = (width - this.dims[1])/2; + if (this.elementPositioning == 'absolute') { + if (this.options.scaleY) d.top = this.originalTop-topd + 'px'; + if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px'; + } else { + if (this.options.scaleY) d.top = -topd + 'px'; + if (this.options.scaleX) d.left = -leftd + 'px'; + } + } + this.element.setStyle(d); + } +}); + +Effect.Highlight = Class.create(Effect.Base, { + initialize: function(element) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { }); + this.start(options); + }, + setup: function() { + // Prevent executing on elements not in the layout flow + if (this.element.getStyle('display')=='none') { this.cancel(); return; } + // Disable background image during the effect + this.oldStyle = { }; + if (!this.options.keepBackgroundImage) { + this.oldStyle.backgroundImage = this.element.getStyle('background-image'); + this.element.setStyle({backgroundImage: 'none'}); + } + if (!this.options.endcolor) + this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff'); + if (!this.options.restorecolor) + this.options.restorecolor = this.element.getStyle('background-color'); + // init color calculations + this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this)); + this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this)); + }, + update: function(position) { + this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){ + return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) }); + }, + finish: function() { + this.element.setStyle(Object.extend(this.oldStyle, { + backgroundColor: this.options.restorecolor + })); + } +}); + +Effect.ScrollTo = function(element) { + var options = arguments[1] || { }, + scrollOffsets = document.viewport.getScrollOffsets(), + elementOffsets = $(element).cumulativeOffset(), + max = (window.height || document.body.scrollHeight) - document.viewport.getHeight(); + + if (options.offset) elementOffsets[1] += options.offset; + + return new Effect.Tween(null, + scrollOffsets.top, + elementOffsets[1] > max ? max : elementOffsets[1], + options, + function(p){ scrollTo(scrollOffsets.left, p.round()) } + ); +}; + +/* ------------- combination effects ------------- */ + +Effect.Fade = function(element) { + element = $(element); + var oldOpacity = element.getInlineOpacity(); + var options = Object.extend({ + from: element.getOpacity() || 1.0, + to: 0.0, + afterFinishInternal: function(effect) { + if (effect.options.to!=0) return; + effect.element.hide().setStyle({opacity: oldOpacity}); + } + }, arguments[1] || { }); + return new Effect.Opacity(element,options); +}; + +Effect.Appear = function(element) { + element = $(element); + var options = Object.extend({ + from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0), + to: 1.0, + // force Safari to render floated elements properly + afterFinishInternal: function(effect) { + effect.element.forceRerendering(); + }, + beforeSetup: function(effect) { + effect.element.setOpacity(effect.options.from).show(); + }}, arguments[1] || { }); + return new Effect.Opacity(element,options); +}; + +Effect.Puff = function(element) { + element = $(element); + var oldStyle = { + opacity: element.getInlineOpacity(), + position: element.getStyle('position'), + top: element.style.top, + left: element.style.left, + width: element.style.width, + height: element.style.height + }; + return new Effect.Parallel( + [ new Effect.Scale(element, 200, + { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), + new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], + Object.extend({ duration: 1.0, + beforeSetupInternal: function(effect) { + Position.absolutize(effect.effects[0].element) + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.hide().setStyle(oldStyle); } + }, arguments[1] || { }) + ); +}; + +Effect.BlindUp = function(element) { + element = $(element); + element.makeClipping(); + return new Effect.Scale(element, 0, + Object.extend({ scaleContent: false, + scaleX: false, + restoreAfterFinish: true, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping(); + } + }, arguments[1] || { }) + ); +}; + +Effect.BlindDown = function(element) { + element = $(element); + var elementDimensions = element.getDimensions(); + return new Effect.Scale(element, 100, Object.extend({ + scaleContent: false, + scaleX: false, + scaleFrom: 0, + scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, + restoreAfterFinish: true, + afterSetup: function(effect) { + effect.element.makeClipping().setStyle({height: '0px'}).show(); + }, + afterFinishInternal: function(effect) { + effect.element.undoClipping(); + } + }, arguments[1] || { })); +}; + +Effect.SwitchOff = function(element) { + element = $(element); + var oldOpacity = element.getInlineOpacity(); + return new Effect.Appear(element, Object.extend({ + duration: 0.4, + from: 0, + transition: Effect.Transitions.flicker, + afterFinishInternal: function(effect) { + new Effect.Scale(effect.element, 1, { + duration: 0.3, scaleFromCenter: true, + scaleX: false, scaleContent: false, restoreAfterFinish: true, + beforeSetup: function(effect) { + effect.element.makePositioned().makeClipping(); + }, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity}); + } + }) + } + }, arguments[1] || { })); +}; + +Effect.DropOut = function(element) { + element = $(element); + var oldStyle = { + top: element.getStyle('top'), + left: element.getStyle('left'), + opacity: element.getInlineOpacity() }; + return new Effect.Parallel( + [ new Effect.Move(element, {x: 0, y: 100, sync: true }), + new Effect.Opacity(element, { sync: true, to: 0.0 }) ], + Object.extend( + { duration: 0.5, + beforeSetup: function(effect) { + effect.effects[0].element.makePositioned(); + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle); + } + }, arguments[1] || { })); +}; + +Effect.Shake = function(element) { + element = $(element); + var options = Object.extend({ + distance: 20, + duration: 0.5 + }, arguments[1] || {}); + var distance = parseFloat(options.distance); + var split = parseFloat(options.duration) / 10.0; + var oldStyle = { + top: element.getStyle('top'), + left: element.getStyle('left') }; + return new Effect.Move(element, + { x: distance, y: 0, duration: split, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) { + effect.element.undoPositioned().setStyle(oldStyle); + }}) }}) }}) }}) }}) }}); +}; + +Effect.SlideDown = function(element) { + element = $(element).cleanWhitespace(); + // SlideDown need to have the content of the element wrapped in a container element with fixed height! + var oldInnerBottom = element.down().getStyle('bottom'); + var elementDimensions = element.getDimensions(); + return new Effect.Scale(element, 100, Object.extend({ + scaleContent: false, + scaleX: false, + scaleFrom: window.opera ? 0 : 1, + scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, + restoreAfterFinish: true, + afterSetup: function(effect) { + effect.element.makePositioned(); + effect.element.down().makePositioned(); + if (window.opera) effect.element.setStyle({top: ''}); + effect.element.makeClipping().setStyle({height: '0px'}).show(); + }, + afterUpdateInternal: function(effect) { + effect.element.down().setStyle({bottom: + (effect.dims[0] - effect.element.clientHeight) + 'px' }); + }, + afterFinishInternal: function(effect) { + effect.element.undoClipping().undoPositioned(); + effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); } + }, arguments[1] || { }) + ); +}; + +Effect.SlideUp = function(element) { + element = $(element).cleanWhitespace(); + var oldInnerBottom = element.down().getStyle('bottom'); + var elementDimensions = element.getDimensions(); + return new Effect.Scale(element, window.opera ? 0 : 1, + Object.extend({ scaleContent: false, + scaleX: false, + scaleMode: 'box', + scaleFrom: 100, + scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, + restoreAfterFinish: true, + afterSetup: function(effect) { + effect.element.makePositioned(); + effect.element.down().makePositioned(); + if (window.opera) effect.element.setStyle({top: ''}); + effect.element.makeClipping().show(); + }, + afterUpdateInternal: function(effect) { + effect.element.down().setStyle({bottom: + (effect.dims[0] - effect.element.clientHeight) + 'px' }); + }, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping().undoPositioned(); + effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); + } + }, arguments[1] || { }) + ); +}; + +// Bug in opera makes the TD containing this element expand for a instance after finish +Effect.Squish = function(element) { + return new Effect.Scale(element, window.opera ? 1 : 0, { + restoreAfterFinish: true, + beforeSetup: function(effect) { + effect.element.makeClipping(); + }, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping(); + } + }); +}; + +Effect.Grow = function(element) { + element = $(element); + var options = Object.extend({ + direction: 'center', + moveTransition: Effect.Transitions.sinoidal, + scaleTransition: Effect.Transitions.sinoidal, + opacityTransition: Effect.Transitions.full + }, arguments[1] || { }); + var oldStyle = { + top: element.style.top, + left: element.style.left, + height: element.style.height, + width: element.style.width, + opacity: element.getInlineOpacity() }; + + var dims = element.getDimensions(); + var initialMoveX, initialMoveY; + var moveX, moveY; + + switch (options.direction) { + case 'top-left': + initialMoveX = initialMoveY = moveX = moveY = 0; + break; + case 'top-right': + initialMoveX = dims.width; + initialMoveY = moveY = 0; + moveX = -dims.width; + break; + case 'bottom-left': + initialMoveX = moveX = 0; + initialMoveY = dims.height; + moveY = -dims.height; + break; + case 'bottom-right': + initialMoveX = dims.width; + initialMoveY = dims.height; + moveX = -dims.width; + moveY = -dims.height; + break; + case 'center': + initialMoveX = dims.width / 2; + initialMoveY = dims.height / 2; + moveX = -dims.width / 2; + moveY = -dims.height / 2; + break; + } + + return new Effect.Move(element, { + x: initialMoveX, + y: initialMoveY, + duration: 0.01, + beforeSetup: function(effect) { + effect.element.hide().makeClipping().makePositioned(); + }, + afterFinishInternal: function(effect) { + new Effect.Parallel( + [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }), + new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }), + new Effect.Scale(effect.element, 100, { + scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, + sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true}) + ], Object.extend({ + beforeSetup: function(effect) { + effect.effects[0].element.setStyle({height: '0px'}).show(); + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); + } + }, options) + ) + } + }); +}; + +Effect.Shrink = function(element) { + element = $(element); + var options = Object.extend({ + direction: 'center', + moveTransition: Effect.Transitions.sinoidal, + scaleTransition: Effect.Transitions.sinoidal, + opacityTransition: Effect.Transitions.none + }, arguments[1] || { }); + var oldStyle = { + top: element.style.top, + left: element.style.left, + height: element.style.height, + width: element.style.width, + opacity: element.getInlineOpacity() }; + + var dims = element.getDimensions(); + var moveX, moveY; + + switch (options.direction) { + case 'top-left': + moveX = moveY = 0; + break; + case 'top-right': + moveX = dims.width; + moveY = 0; + break; + case 'bottom-left': + moveX = 0; + moveY = dims.height; + break; + case 'bottom-right': + moveX = dims.width; + moveY = dims.height; + break; + case 'center': + moveX = dims.width / 2; + moveY = dims.height / 2; + break; + } + + return new Effect.Parallel( + [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }), + new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}), + new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }) + ], Object.extend({ + beforeStartInternal: function(effect) { + effect.effects[0].element.makePositioned().makeClipping(); + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); } + }, options) + ); +}; + +Effect.Pulsate = function(element) { + element = $(element); + var options = arguments[1] || { }; + var oldOpacity = element.getInlineOpacity(); + var transition = options.transition || Effect.Transitions.sinoidal; + var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) }; + reverser.bind(transition); + return new Effect.Opacity(element, + Object.extend(Object.extend({ duration: 2.0, from: 0, + afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); } + }, options), {transition: reverser})); +}; + +Effect.Fold = function(element) { + element = $(element); + var oldStyle = { + top: element.style.top, + left: element.style.left, + width: element.style.width, + height: element.style.height }; + element.makeClipping(); + return new Effect.Scale(element, 5, Object.extend({ + scaleContent: false, + scaleX: false, + afterFinishInternal: function(effect) { + new Effect.Scale(element, 1, { + scaleContent: false, + scaleY: false, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping().setStyle(oldStyle); + } }); + }}, arguments[1] || { })); +}; + +Effect.Morph = Class.create(Effect.Base, { + initialize: function(element) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ + style: { } + }, arguments[1] || { }); + + if (!Object.isString(options.style)) this.style = $H(options.style); + else { + if (options.style.include(':')) + this.style = options.style.parseStyle(); + else { + this.element.addClassName(options.style); + this.style = $H(this.element.getStyles()); + this.element.removeClassName(options.style); + var css = this.element.getStyles(); + this.style = this.style.reject(function(style) { + return style.value == css[style.key]; + }); + options.afterFinishInternal = function(effect) { + effect.element.addClassName(effect.options.style); + effect.transforms.each(function(transform) { + effect.element.style[transform.style] = ''; + }); + } + } + } + this.start(options); + }, + + setup: function(){ + function parseColor(color){ + if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff'; + color = color.parseColor(); + return $R(0,2).map(function(i){ + return parseInt( color.slice(i*2+1,i*2+3), 16 ) + }); + } + this.transforms = this.style.map(function(pair){ + var property = pair[0], value = pair[1], unit = null; + + if (value.parseColor('#zzzzzz') != '#zzzzzz') { + value = value.parseColor(); + unit = 'color'; + } else if (property == 'opacity') { + value = parseFloat(value); + if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) + this.element.setStyle({zoom: 1}); + } else if (Element.CSS_LENGTH.test(value)) { + var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/); + value = parseFloat(components[1]); + unit = (components.length == 3) ? components[2] : null; + } + + var originalValue = this.element.getStyle(property); + return { + style: property.camelize(), + originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), + targetValue: unit=='color' ? parseColor(value) : value, + unit: unit + }; + }.bind(this)).reject(function(transform){ + return ( + (transform.originalValue == transform.targetValue) || + ( + transform.unit != 'color' && + (isNaN(transform.originalValue) || isNaN(transform.targetValue)) + ) + ) + }); + }, + update: function(position) { + var style = { }, transform, i = this.transforms.length; + while(i--) + style[(transform = this.transforms[i]).style] = + transform.unit=='color' ? '#'+ + (Math.round(transform.originalValue[0]+ + (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() + + (Math.round(transform.originalValue[1]+ + (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() + + (Math.round(transform.originalValue[2]+ + (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() : + (transform.originalValue + + (transform.targetValue - transform.originalValue) * position).toFixed(3) + + (transform.unit === null ? '' : transform.unit); + this.element.setStyle(style, true); + } +}); + +Effect.Transform = Class.create({ + initialize: function(tracks){ + this.tracks = []; + this.options = arguments[1] || { }; + this.addTracks(tracks); + }, + addTracks: function(tracks){ + tracks.each(function(track){ + track = $H(track); + var data = track.values().first(); + this.tracks.push($H({ + ids: track.keys().first(), + effect: Effect.Morph, + options: { style: data } + })); + }.bind(this)); + return this; + }, + play: function(){ + return new Effect.Parallel( + this.tracks.map(function(track){ + var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options'); + var elements = [$(ids) || $$(ids)].flatten(); + return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) }); + }).flatten(), + this.options + ); + } +}); + +Element.CSS_PROPERTIES = $w( + 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + + 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' + + 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' + + 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' + + 'fontSize fontWeight height left letterSpacing lineHeight ' + + 'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+ + 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' + + 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' + + 'right textIndent top width wordSpacing zIndex'); + +Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; + +String.__parseStyleElement = document.createElement('div'); +String.prototype.parseStyle = function(){ + var style, styleRules = $H(); + if (Prototype.Browser.WebKit) + style = new Element('div',{style:this}).style; + else { + String.__parseStyleElement.innerHTML = '
'; + style = String.__parseStyleElement.childNodes[0].style; + } + + Element.CSS_PROPERTIES.each(function(property){ + if (style[property]) styleRules.set(property, style[property]); + }); + + if (Prototype.Browser.IE && this.include('opacity')) + styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]); + + return styleRules; +}; + +if (document.defaultView && document.defaultView.getComputedStyle) { + Element.getStyles = function(element) { + var css = document.defaultView.getComputedStyle($(element), null); + return Element.CSS_PROPERTIES.inject({ }, function(styles, property) { + styles[property] = css[property]; + return styles; + }); + }; +} else { + Element.getStyles = function(element) { + element = $(element); + var css = element.currentStyle, styles; + styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) { + results[property] = css[property]; + return results; + }); + if (!styles.opacity) styles.opacity = element.getOpacity(); + return styles; + }; +}; + +Effect.Methods = { + morph: function(element, style) { + element = $(element); + new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { })); + return element; + }, + visualEffect: function(element, effect, options) { + element = $(element) + var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1); + new Effect[klass](element, options); + return element; + }, + highlight: function(element, options) { + element = $(element); + new Effect.Highlight(element, options); + return element; + } +}; + +$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+ + 'pulsate shake puff squish switchOff dropOut').each( + function(effect) { + Effect.Methods[effect] = function(element, options){ + element = $(element); + Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options); + return element; + } + } +); + +$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( + function(f) { Effect.Methods[f] = Element[f]; } +); + +Element.addMethods(Effect.Methods); diff --git a/sites/all/modules/lightbox2/js/lightbox.js b/sites/all/modules/lightbox2/js/lightbox.js new file mode 100644 index 0000000..b5af5bb --- /dev/null +++ b/sites/all/modules/lightbox2/js/lightbox.js @@ -0,0 +1,1195 @@ +/* $Id: lightbox.js,v 1.5.2.6.2.136 2010/09/24 08:39:40 snpower Exp $ */ + +/** + * jQuery Lightbox + * @author + * Stella Power, + * + * Based on Lightbox v2.03.3 by Lokesh Dhakar + * + * Also partially based on the jQuery Lightbox by Warren Krewenki + * + * + * Permission has been granted to Mark Ashmead & other Drupal Lightbox2 module + * maintainers to distribute this file via Drupal.org + * Under GPL license. + * + * Slideshow, iframe and video functionality added by Stella Power. + */ + +var Lightbox; +(function($) { +Lightbox = { + auto_modal : false, + overlayOpacity : 0.8, // Controls transparency of shadow overlay. + overlayColor : '000', // Controls colour of shadow overlay. + disableCloseClick : true, + // Controls the order of the lightbox resizing animation sequence. + resizeSequence: 0, // 0: simultaneous, 1: width then height, 2: height then width. + resizeSpeed: 'normal', // Controls the speed of the lightbox resizing animation. + fadeInSpeed: 'normal', // Controls the speed of the image appearance. + slideDownSpeed: 'slow', // Controls the speed of the image details appearance. + minWidth: 240, + borderSize : 10, + boxColor : 'fff', + fontColor : '000', + topPosition : '', + infoHeight: 20, + alternative_layout : false, + imageArray : [], + imageNum : null, + total : 0, + activeImage : null, + inprogress : false, + disableResize : false, + disableZoom : false, + isZoomedIn : false, + rtl : false, + loopItems : false, + keysClose : ['c', 'x', 27], + keysPrevious : ['p', 37], + keysNext : ['n', 39], + keysZoom : ['z'], + keysPlayPause : [32], + + // Slideshow options. + slideInterval : 5000, // In milliseconds. + showPlayPause : true, + autoStart : true, + autoExit : true, + pauseOnNextClick : false, // True to pause the slideshow when the "Next" button is clicked. + pauseOnPrevClick : true, // True to pause the slideshow when the "Prev" button is clicked. + slideIdArray : [], + slideIdCount : 0, + isSlideshow : false, + isPaused : false, + loopSlides : false, + + // Iframe options. + isLightframe : false, + iframe_width : 600, + iframe_height : 400, + iframe_border : 1, + + // Video and modal options. + enableVideo : false, + flvPlayer : '/flvplayer.swf', + flvFlashvars : '', + isModal : false, + isVideo : false, + videoId : false, + modalWidth : 400, + modalHeight : 400, + modalHTML : null, + + + // initialize() + // Constructor runs on completion of the DOM loading. + // The function inserts html at the bottom of the page which is used + // to display the shadow overlay and the image container. + initialize: function() { + + var s = Drupal.settings.lightbox2; + Lightbox.overlayOpacity = s.overlay_opacity; + Lightbox.overlayColor = s.overlay_color; + Lightbox.disableCloseClick = s.disable_close_click; + Lightbox.resizeSequence = s.resize_sequence; + Lightbox.resizeSpeed = s.resize_speed; + Lightbox.fadeInSpeed = s.fade_in_speed; + Lightbox.slideDownSpeed = s.slide_down_speed; + Lightbox.borderSize = s.border_size; + Lightbox.boxColor = s.box_color; + Lightbox.fontColor = s.font_color; + Lightbox.topPosition = s.top_position; + Lightbox.rtl = s.rtl; + Lightbox.loopItems = s.loop_items; + Lightbox.keysClose = s.keys_close.split(" "); + Lightbox.keysPrevious = s.keys_previous.split(" "); + Lightbox.keysNext = s.keys_next.split(" "); + Lightbox.keysZoom = s.keys_zoom.split(" "); + Lightbox.keysPlayPause = s.keys_play_pause.split(" "); + Lightbox.disableResize = s.disable_resize; + Lightbox.disableZoom = s.disable_zoom; + Lightbox.slideInterval = s.slideshow_interval; + Lightbox.showPlayPause = s.show_play_pause; + Lightbox.showCaption = s.show_caption; + Lightbox.autoStart = s.slideshow_automatic_start; + Lightbox.autoExit = s.slideshow_automatic_exit; + Lightbox.pauseOnNextClick = s.pause_on_next_click; + Lightbox.pauseOnPrevClick = s.pause_on_previous_click; + Lightbox.loopSlides = s.loop_slides; + Lightbox.alternative_layout = s.use_alt_layout; + Lightbox.iframe_width = s.iframe_width; + Lightbox.iframe_height = s.iframe_height; + Lightbox.iframe_border = s.iframe_border; + Lightbox.enableVideo = s.enable_video; + if (s.enable_video) { + Lightbox.flvPlayer = s.flvPlayer; + Lightbox.flvFlashvars = s.flvFlashvars; + } + + // Make the lightbox divs. + var layout_class = (s.use_alt_layout ? 'lightbox2-alt-layout' : 'lightbox2-orig-layout'); + var output = '\ + '; + var loading = '
'; + var modal = ''; + var frame = ''; + var imageContainer = ''; + var details = '
'; + var bottomNav = '
'; + var image = ''; + var hoverNav = '
'; + var frameNav = '
'; + var hoverNav = '
'; + var frameNav = '
'; + var caption = ''; + var numberDisplay = ''; + var close = ''; + var zoom = ''; + var zoomOut = ''; + var pause = ''; + var play = ''; + + $("body").append(output); + $('#outerImageContainer').append(modal + frame + imageContainer + loading); + if (!s.use_alt_layout) { + $('#imageContainer').append(image + hoverNav); + $('#imageData').append(details + bottomNav); + $('#imageDetails').append(caption + numberDisplay); + $('#bottomNav').append(frameNav + close + zoom + zoomOut + pause + play); + } + else { + $('#outerImageContainer').append(bottomNav); + $('#imageContainer').append(image); + $('#bottomNav').append(close + zoom + zoomOut); + $('#imageData').append(hoverNav + details); + $('#imageDetails').append(caption + numberDisplay + pause + play); + } + + // Setup onclick handlers. + if (Lightbox.disableCloseClick) { + $('#lightbox2-overlay').click(function() { Lightbox.end(); return false; } ).hide(); + } + $('#loadingLink, #bottomNavClose').click(function() { Lightbox.end('forceClose'); return false; } ); + $('#prevLink, #framePrevLink').click(function() { Lightbox.changeData(Lightbox.activeImage - 1); return false; } ); + $('#nextLink, #frameNextLink').click(function() { Lightbox.changeData(Lightbox.activeImage + 1); return false; } ); + $('#bottomNavZoom').click(function() { Lightbox.changeData(Lightbox.activeImage, true); return false; } ); + $('#bottomNavZoomOut').click(function() { Lightbox.changeData(Lightbox.activeImage, false); return false; } ); + $('#lightshowPause').click(function() { Lightbox.togglePlayPause("lightshowPause", "lightshowPlay"); return false; } ); + $('#lightshowPlay').click(function() { Lightbox.togglePlayPause("lightshowPlay", "lightshowPause"); return false; } ); + + // Fix positioning. + $('#prevLink, #nextLink, #framePrevLink, #frameNextLink').css({ 'paddingTop': Lightbox.borderSize + 'px'}); + $('#imageContainer, #frameContainer, #modalContainer').css({ 'padding': Lightbox.borderSize + 'px'}); + $('#outerImageContainer, #imageDataContainer, #bottomNavClose').css({'backgroundColor': '#' + Lightbox.boxColor, 'color': '#'+Lightbox.fontColor}); + if (Lightbox.alternative_layout) { + $('#bottomNavZoom, #bottomNavZoomOut').css({'bottom': Lightbox.borderSize + 'px', 'right': Lightbox.borderSize + 'px'}); + } + else if (Lightbox.rtl == 1 && $.browser.msie) { + $('#bottomNavZoom, #bottomNavZoomOut').css({'left': '0px'}); + } + + // Force navigation links to always be displayed + if (s.force_show_nav) { + $('#prevLink, #nextLink').addClass("force_show_nav"); + } + + }, + + // initList() + // Loops through anchor tags looking for 'lightbox', 'lightshow' and + // 'lightframe', etc, references and applies onclick events to appropriate + // links. You can rerun after dynamically adding images w/ajax. + initList : function(context) { + + if (context == undefined || context == null) { + context = document; + } + + // Attach lightbox to any links with rel 'lightbox', 'lightshow' or + // 'lightframe', etc. + $("a[rel^='lightbox']:not(.lightbox-processed), area[rel^='lightbox']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) { + if (Lightbox.disableCloseClick) { + $('#lightbox').unbind('click'); + $('#lightbox').click(function() { Lightbox.end('forceClose'); } ); + } + Lightbox.start(this, false, false, false, false); + if (e.preventDefault) { e.preventDefault(); } + return false; + }); + $("a[rel^='lightshow']:not(.lightbox-processed), area[rel^='lightshow']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) { + if (Lightbox.disableCloseClick) { + $('#lightbox').unbind('click'); + $('#lightbox').click(function() { Lightbox.end('forceClose'); } ); + } + Lightbox.start(this, true, false, false, false); + if (e.preventDefault) { e.preventDefault(); } + return false; + }); + $("a[rel^='lightframe']:not(.lightbox-processed), area[rel^='lightframe']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) { + if (Lightbox.disableCloseClick) { + $('#lightbox').unbind('click'); + $('#lightbox').click(function() { Lightbox.end('forceClose'); } ); + } + Lightbox.start(this, false, true, false, false); + if (e.preventDefault) { e.preventDefault(); } + return false; + }); + if (Lightbox.enableVideo) { + $("a[rel^='lightvideo']:not(.lightbox-processed), area[rel^='lightvideo']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) { + if (Lightbox.disableCloseClick) { + $('#lightbox').unbind('click'); + $('#lightbox').click(function() { Lightbox.end('forceClose'); } ); + } + Lightbox.start(this, false, false, true, false); + if (e.preventDefault) { e.preventDefault(); } + return false; + }); + } + $("a[rel^='lightmodal']:not(.lightbox-processed), area[rel^='lightmodal']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) { + $('#lightbox').unbind('click'); + // Add classes from the link to the lightbox div - don't include lightbox-processed + $('#lightbox').addClass($(this).attr('class')); + $('#lightbox').removeClass('lightbox-processed'); + Lightbox.start(this, false, false, false, true); + if (e.preventDefault) { e.preventDefault(); } + return false; + }); + $("#lightboxAutoModal:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) { + Lightbox.auto_modal = true; + $('#lightbox').unbind('click'); + Lightbox.start(this, false, false, false, true); + if (e.preventDefault) { e.preventDefault(); } + return false; + }); + }, + + // start() + // Display overlay and lightbox. If image is part of a set, add siblings to + // imageArray. + start: function(imageLink, slideshow, lightframe, lightvideo, lightmodal) { + + Lightbox.isPaused = !Lightbox.autoStart; + + // Replaces hideSelectBoxes() and hideFlash() calls in original lightbox2. + Lightbox.toggleSelectsFlash('hide'); + + // Stretch overlay to fill page and fade in. + var arrayPageSize = Lightbox.getPageSize(); + $("#lightbox2-overlay").hide().css({ + 'width': '100%', + 'zIndex': '10090', + 'height': arrayPageSize[1] + 'px', + 'backgroundColor' : '#' + Lightbox.overlayColor + }); + // Detect OS X FF2 opacity + flash issue. + if (lightvideo && this.detectMacFF2()) { + $("#lightbox2-overlay").removeClass("overlay_default"); + $("#lightbox2-overlay").addClass("overlay_macff2"); + $("#lightbox2-overlay").css({'opacity' : null}); + } + else { + $("#lightbox2-overlay").removeClass("overlay_macff2"); + $("#lightbox2-overlay").addClass("overlay_default"); + $("#lightbox2-overlay").css({'opacity' : Lightbox.overlayOpacity}); + } + $("#lightbox2-overlay").fadeIn(Lightbox.fadeInSpeed); + + + Lightbox.isSlideshow = slideshow; + Lightbox.isLightframe = lightframe; + Lightbox.isVideo = lightvideo; + Lightbox.isModal = lightmodal; + Lightbox.imageArray = []; + Lightbox.imageNum = 0; + + var anchors = $(imageLink.tagName); + var anchor = null; + var rel_parts = Lightbox.parseRel(imageLink); + var rel = rel_parts["rel"]; + var rel_group = rel_parts["group"]; + var title = (rel_parts["title"] ? rel_parts["title"] : imageLink.title); + var rel_style = null; + var i = 0; + + if (rel_parts["flashvars"]) { + Lightbox.flvFlashvars = Lightbox.flvFlashvars + '&' + rel_parts["flashvars"]; + } + + // Set the title for image alternative text. + var alt = imageLink.title; + if (!alt) { + var img = $(imageLink).find("img"); + if (img && $(img).attr("alt")) { + alt = $(img).attr("alt"); + } + else { + alt = title; + } + } + + if ($(imageLink).attr('id') == 'lightboxAutoModal') { + rel_style = rel_parts["style"]; + Lightbox.imageArray.push(['#lightboxAutoModal > *', title, alt, rel_style, 1]); + } + else { + // Handle lightbox images with no grouping. + if ((rel == 'lightbox' || rel == 'lightshow') && !rel_group) { + Lightbox.imageArray.push([imageLink.href, title, alt]); + } + + // Handle other items with no grouping. + else if (!rel_group) { + rel_style = rel_parts["style"]; + Lightbox.imageArray.push([imageLink.href, title, alt, rel_style]); + } + + // Handle grouped items. + else { + + // Loop through anchors and add them to imageArray. + for (i = 0; i < anchors.length; i++) { + anchor = anchors[i]; + if (anchor.href && typeof(anchor.href) == "string" && $(anchor).attr('rel')) { + var rel_data = Lightbox.parseRel(anchor); + var anchor_title = (rel_data["title"] ? rel_data["title"] : anchor.title); + img_alt = anchor.title; + if (!img_alt) { + var anchor_img = $(anchor).find("img"); + if (anchor_img && $(anchor_img).attr("alt")) { + img_alt = $(anchor_img).attr("alt"); + } + else { + img_alt = title; + } + } + if (rel_data["rel"] == rel) { + if (rel_data["group"] == rel_group) { + if (Lightbox.isLightframe || Lightbox.isModal || Lightbox.isVideo) { + rel_style = rel_data["style"]; + } + Lightbox.imageArray.push([anchor.href, anchor_title, img_alt, rel_style]); + } + } + } + } + + // Remove duplicates. + for (i = 0; i < Lightbox.imageArray.length; i++) { + for (j = Lightbox.imageArray.length-1; j > i; j--) { + if (Lightbox.imageArray[i][0] == Lightbox.imageArray[j][0]) { + Lightbox.imageArray.splice(j,1); + } + } + } + while (Lightbox.imageArray[Lightbox.imageNum][0] != imageLink.href) { + Lightbox.imageNum++; + } + } + } + + if (Lightbox.isSlideshow && Lightbox.showPlayPause && Lightbox.isPaused) { + $('#lightshowPlay').show(); + $('#lightshowPause').hide(); + } + + // Calculate top and left offset for the lightbox. + var arrayPageScroll = Lightbox.getPageScroll(); + var lightboxTop = arrayPageScroll[1] + (Lightbox.topPosition == '' ? (arrayPageSize[3] / 10) : Lightbox.topPosition) * 1; + var lightboxLeft = arrayPageScroll[0]; + $('#frameContainer, #modalContainer, #lightboxImage').hide(); + $('#hoverNav, #prevLink, #nextLink, #frameHoverNav, #framePrevLink, #frameNextLink').hide(); + $('#imageDataContainer, #numberDisplay, #bottomNavZoom, #bottomNavZoomOut').hide(); + $('#outerImageContainer').css({'width': '250px', 'height': '250px'}); + $('#lightbox').css({ + 'zIndex': '10500', + 'top': lightboxTop + 'px', + 'left': lightboxLeft + 'px' + }).show(); + + Lightbox.total = Lightbox.imageArray.length; + Lightbox.changeData(Lightbox.imageNum); + }, + + // changeData() + // Hide most elements and preload image in preparation for resizing image + // container. + changeData: function(imageNum, zoomIn) { + + if (Lightbox.inprogress === false) { + if (Lightbox.total > 1 && ((Lightbox.isSlideshow && Lightbox.loopSlides) || (!Lightbox.isSlideshow && Lightbox.loopItems))) { + if (imageNum >= Lightbox.total) imageNum = 0; + if (imageNum < 0) imageNum = Lightbox.total - 1; + } + + if (Lightbox.isSlideshow) { + for (var i = 0; i < Lightbox.slideIdCount; i++) { + window.clearTimeout(Lightbox.slideIdArray[i]); + } + } + Lightbox.inprogress = true; + Lightbox.activeImage = imageNum; + + if (Lightbox.disableResize && !Lightbox.isSlideshow) { + zoomIn = true; + } + Lightbox.isZoomedIn = zoomIn; + + + // Hide elements during transition. + $('#loading').css({'zIndex': '10500'}).show(); + if (!Lightbox.alternative_layout) { + $('#imageContainer').hide(); + } + $('#frameContainer, #modalContainer, #lightboxImage').hide(); + $('#hoverNav, #prevLink, #nextLink, #frameHoverNav, #framePrevLink, #frameNextLink').hide(); + $('#imageDataContainer, #numberDisplay, #bottomNavZoom, #bottomNavZoomOut').hide(); + + // Preload image content, but not iframe pages. + if (!Lightbox.isLightframe && !Lightbox.isVideo && !Lightbox.isModal) { + $("#lightbox #imageDataContainer").removeClass('lightbox2-alt-layout-data'); + imgPreloader = new Image(); + imgPreloader.onerror = function() { Lightbox.imgNodeLoadingError(this); }; + + imgPreloader.onload = function() { + var photo = document.getElementById('lightboxImage'); + photo.src = Lightbox.imageArray[Lightbox.activeImage][0]; + photo.alt = Lightbox.imageArray[Lightbox.activeImage][2]; + + var imageWidth = imgPreloader.width; + var imageHeight = imgPreloader.height; + + // Resize code. + var arrayPageSize = Lightbox.getPageSize(); + var targ = { w:arrayPageSize[2] - (Lightbox.borderSize * 2), h:arrayPageSize[3] - (Lightbox.borderSize * 6) - (Lightbox.infoHeight * 4) - (arrayPageSize[3] / 10) }; + var orig = { w:imgPreloader.width, h:imgPreloader.height }; + + // Image is very large, so show a smaller version of the larger image + // with zoom button. + if (zoomIn !== true) { + var ratio = 1.0; // Shrink image with the same aspect. + $('#bottomNavZoomOut, #bottomNavZoom').hide(); + if ((orig.w >= targ.w || orig.h >= targ.h) && orig.h && orig.w) { + ratio = ((targ.w / orig.w) < (targ.h / orig.h)) ? targ.w / orig.w : targ.h / orig.h; + if (!Lightbox.disableZoom && !Lightbox.isSlideshow) { + $('#bottomNavZoom').css({'zIndex': '10500'}).show(); + } + } + + imageWidth = Math.floor(orig.w * ratio); + imageHeight = Math.floor(orig.h * ratio); + } + + else { + $('#bottomNavZoom').hide(); + // Only display zoom out button if the image is zoomed in already. + if ((orig.w >= targ.w || orig.h >= targ.h) && orig.h && orig.w) { + // Only display zoom out button if not a slideshow and if the + // buttons aren't disabled. + if (!Lightbox.disableResize && Lightbox.isSlideshow === false && !Lightbox.disableZoom) { + $('#bottomNavZoomOut').css({'zIndex': '10500'}).show(); + } + } + } + + photo.style.width = (imageWidth) + 'px'; + photo.style.height = (imageHeight) + 'px'; + Lightbox.resizeContainer(imageWidth, imageHeight); + + // Clear onLoad, IE behaves irratically with animated gifs otherwise. + imgPreloader.onload = function() {}; + }; + + imgPreloader.src = Lightbox.imageArray[Lightbox.activeImage][0]; + imgPreloader.alt = Lightbox.imageArray[Lightbox.activeImage][2]; + } + + // Set up frame size, etc. + else if (Lightbox.isLightframe) { + $("#lightbox #imageDataContainer").addClass('lightbox2-alt-layout-data'); + var src = Lightbox.imageArray[Lightbox.activeImage][0]; + $('#frameContainer').html(''); + + // Enable swf support in Gecko browsers. + if ($.browser.mozilla && src.indexOf('.swf') != -1) { + setTimeout(function () { + document.getElementById("lightboxFrame").src = Lightbox.imageArray[Lightbox.activeImage][0]; + }, 1000); + } + + if (!Lightbox.iframe_border) { + $('#lightboxFrame').css({'border': 'none'}); + $('#lightboxFrame').attr('frameborder', '0'); + } + var iframe = document.getElementById('lightboxFrame'); + var iframeStyles = Lightbox.imageArray[Lightbox.activeImage][3]; + iframe = Lightbox.setStyles(iframe, iframeStyles); + Lightbox.resizeContainer(parseInt(iframe.width, 10), parseInt(iframe.height, 10)); + } + else if (Lightbox.isVideo || Lightbox.isModal) { + $("#lightbox #imageDataContainer").addClass('lightbox2-alt-layout-data'); + var container = document.getElementById('modalContainer'); + var modalStyles = Lightbox.imageArray[Lightbox.activeImage][3]; + container = Lightbox.setStyles(container, modalStyles); + if (Lightbox.isVideo) { + Lightbox.modalHeight = parseInt(container.height, 10) - 10; + Lightbox.modalWidth = parseInt(container.width, 10) - 10; + Lightvideo.startVideo(Lightbox.imageArray[Lightbox.activeImage][0]); + } + Lightbox.resizeContainer(parseInt(container.width, 10), parseInt(container.height, 10)); + } + } + }, + + // imgNodeLoadingError() + imgNodeLoadingError: function(image) { + var s = Drupal.settings.lightbox2; + var original_image = Lightbox.imageArray[Lightbox.activeImage][0]; + if (s.display_image_size !== "") { + original_image = original_image.replace(new RegExp("."+s.display_image_size), ""); + } + Lightbox.imageArray[Lightbox.activeImage][0] = original_image; + image.onerror = function() { Lightbox.imgLoadingError(image); }; + image.src = original_image; + }, + + // imgLoadingError() + imgLoadingError: function(image) { + var s = Drupal.settings.lightbox2; + Lightbox.imageArray[Lightbox.activeImage][0] = s.default_image; + image.src = s.default_image; + }, + + // resizeContainer() + resizeContainer: function(imgWidth, imgHeight) { + + imgWidth = (imgWidth < Lightbox.minWidth ? Lightbox.minWidth : imgWidth); + + this.widthCurrent = $('#outerImageContainer').width(); + this.heightCurrent = $('#outerImageContainer').height(); + + var widthNew = (imgWidth + (Lightbox.borderSize * 2)); + var heightNew = (imgHeight + (Lightbox.borderSize * 2)); + + // Scalars based on change from old to new. + this.xScale = ( widthNew / this.widthCurrent) * 100; + this.yScale = ( heightNew / this.heightCurrent) * 100; + + // Calculate size difference between new and old image, and resize if + // necessary. + wDiff = this.widthCurrent - widthNew; + hDiff = this.heightCurrent - heightNew; + + $('#modalContainer').css({'width': imgWidth, 'height': imgHeight}); + // Detect animation sequence. + if (Lightbox.resizeSequence) { + var animate1 = {width: widthNew}; + var animate2 = {height: heightNew}; + if (Lightbox.resizeSequence == 2) { + animate1 = {height: heightNew}; + animate2 = {width: widthNew}; + } + $('#outerImageContainer').animate(animate1, Lightbox.resizeSpeed).animate(animate2, Lightbox.resizeSpeed, 'linear', function() { Lightbox.showData(); }); + } + // Simultaneous. + else { + $('#outerImageContainer').animate({'width': widthNew, 'height': heightNew}, Lightbox.resizeSpeed, 'linear', function() { Lightbox.showData(); }); + } + + // If new and old image are same size and no scaling transition is necessary + // do a quick pause to prevent image flicker. + if ((hDiff === 0) && (wDiff === 0)) { + if ($.browser.msie) { + Lightbox.pause(250); + } + else { + Lightbox.pause(100); + } + } + + var s = Drupal.settings.lightbox2; + if (!s.use_alt_layout) { + $('#prevLink, #nextLink').css({'height': imgHeight + 'px'}); + } + $('#imageDataContainer').css({'width': widthNew + 'px'}); + }, + + // showData() + // Display image and begin preloading neighbors. + showData: function() { + $('#loading').hide(); + + if (Lightbox.isLightframe || Lightbox.isVideo || Lightbox.isModal) { + Lightbox.updateDetails(); + if (Lightbox.isLightframe) { + $('#frameContainer').show(); + if ($.browser.safari || Lightbox.fadeInSpeed === 0) { + $('#lightboxFrame').css({'zIndex': '10500'}).show(); + } + else { + $('#lightboxFrame').css({'zIndex': '10500'}).fadeIn(Lightbox.fadeInSpeed); + } + } + else { + if (Lightbox.isVideo) { + $("#modalContainer").html(Lightbox.modalHTML).click(function(){return false;}).css('zIndex', '10500').show(); + } + else { + var src = unescape(Lightbox.imageArray[Lightbox.activeImage][0]); + if (Lightbox.imageArray[Lightbox.activeImage][4]) { + $(src).appendTo("#modalContainer"); + $('#modalContainer').css({'zIndex': '10500'}).show(); + } + else { + // Use a callback to show the new image, otherwise you get flicker. + $("#modalContainer").hide().load(src, function () {$('#modalContainer').css({'zIndex': '10500'}).show();}); + } + $('#modalContainer').unbind('click'); + } + // This might be needed in the Lightframe section above. + //$('#modalContainer').css({'zIndex': '10500'}).show(); + } + } + + // Handle display of image content. + else { + $('#imageContainer').show(); + if ($.browser.safari || Lightbox.fadeInSpeed === 0) { + $('#lightboxImage').css({'zIndex': '10500'}).show(); + } + else { + $('#lightboxImage').css({'zIndex': '10500'}).fadeIn(Lightbox.fadeInSpeed); + } + Lightbox.updateDetails(); + this.preloadNeighborImages(); + } + Lightbox.inprogress = false; + + // Slideshow specific stuff. + if (Lightbox.isSlideshow) { + if (!Lightbox.loopSlides && Lightbox.activeImage == (Lightbox.total - 1)) { + if (Lightbox.autoExit) { + Lightbox.slideIdArray[Lightbox.slideIdCount++] = setTimeout(function () {Lightbox.end('slideshow');}, Lightbox.slideInterval); + } + } + else { + if (!Lightbox.isPaused && Lightbox.total > 1) { + Lightbox.slideIdArray[Lightbox.slideIdCount++] = setTimeout(function () {Lightbox.changeData(Lightbox.activeImage + 1);}, Lightbox.slideInterval); + } + } + if (Lightbox.showPlayPause && Lightbox.total > 1 && !Lightbox.isPaused) { + $('#lightshowPause').show(); + $('#lightshowPlay').hide(); + } + else if (Lightbox.showPlayPause && Lightbox.total > 1) { + $('#lightshowPause').hide(); + $('#lightshowPlay').show(); + } + } + + // Adjust the page overlay size. + var arrayPageSize = Lightbox.getPageSize(); + var arrayPageScroll = Lightbox.getPageScroll(); + var pageHeight = arrayPageSize[1]; + if (Lightbox.isZoomedIn && arrayPageSize[1] > arrayPageSize[3]) { + var lightboxTop = (Lightbox.topPosition == '' ? (arrayPageSize[3] / 10) : Lightbox.topPosition) * 1; + pageHeight = pageHeight + arrayPageScroll[1] + lightboxTop; + } + $('#lightbox2-overlay').css({'height': pageHeight + 'px', 'width': arrayPageSize[0] + 'px'}); + + // Gecko browsers (e.g. Firefox, SeaMonkey, etc) don't handle pdfs as + // expected. + if ($.browser.mozilla) { + if (Lightbox.imageArray[Lightbox.activeImage][0].indexOf(".pdf") != -1) { + setTimeout(function () { + document.getElementById("lightboxFrame").src = Lightbox.imageArray[Lightbox.activeImage][0]; + }, 1000); + } + } + }, + + // updateDetails() + // Display caption, image number, and bottom nav. + updateDetails: function() { + + $("#imageDataContainer").hide(); + + var s = Drupal.settings.lightbox2; + + if (s.show_caption) { + var caption = Lightbox.filterXSS(Lightbox.imageArray[Lightbox.activeImage][1]); + if (!caption) caption = ''; + $('#caption').html(caption).css({'zIndex': '10500'}).show(); + } + + // If image is part of set display 'Image x of x'. + var numberDisplay = null; + if (s.image_count && Lightbox.total > 1) { + var currentImage = Lightbox.activeImage + 1; + if (!Lightbox.isLightframe && !Lightbox.isModal && !Lightbox.isVideo) { + numberDisplay = s.image_count.replace(/\!current/, currentImage).replace(/\!total/, Lightbox.total); + } + else if (Lightbox.isVideo) { + numberDisplay = s.video_count.replace(/\!current/, currentImage).replace(/\!total/, Lightbox.total); + } + else { + numberDisplay = s.page_count.replace(/\!current/, currentImage).replace(/\!total/, Lightbox.total); + } + $('#numberDisplay').html(numberDisplay).css({'zIndex': '10500'}).show(); + } + else { + $('#numberDisplay').hide(); + } + + $("#imageDataContainer").hide().slideDown(Lightbox.slideDownSpeed, function() { + $("#bottomNav").show(); + }); + if (Lightbox.rtl == 1) { + $("#bottomNav").css({'float': 'left'}); + } + Lightbox.updateNav(); + }, + + // updateNav() + // Display appropriate previous and next hover navigation. + updateNav: function() { + + $('#hoverNav').css({'zIndex': '10500'}).show(); + var prevLink = '#prevLink'; + var nextLink = '#nextLink'; + + // Slideshow is separated as we need to show play / pause button. + if (Lightbox.isSlideshow) { + if ((Lightbox.total > 1 && Lightbox.loopSlides) || Lightbox.activeImage !== 0) { + $(prevLink).css({'zIndex': '10500'}).show().click(function() { + if (Lightbox.pauseOnPrevClick) { + Lightbox.togglePlayPause("lightshowPause", "lightshowPlay"); + } + Lightbox.changeData(Lightbox.activeImage - 1); return false; + }); + } + else { + $(prevLink).hide(); + } + + // If not last image in set, display next image button. + if ((Lightbox.total > 1 && Lightbox.loopSlides) || Lightbox.activeImage != (Lightbox.total - 1)) { + $(nextLink).css({'zIndex': '10500'}).show().click(function() { + if (Lightbox.pauseOnNextClick) { + Lightbox.togglePlayPause("lightshowPause", "lightshowPlay"); + } + Lightbox.changeData(Lightbox.activeImage + 1); return false; + }); + } + // Safari browsers need to have hide() called again. + else { + $(nextLink).hide(); + } + } + + // All other types of content. + else { + + if ((Lightbox.isLightframe || Lightbox.isModal || Lightbox.isVideo) && !Lightbox.alternative_layout) { + $('#frameHoverNav').css({'zIndex': '10500'}).show(); + $('#hoverNav').css({'zIndex': '10500'}).hide(); + prevLink = '#framePrevLink'; + nextLink = '#frameNextLink'; + } + + // If not first image in set, display prev image button. + if ((Lightbox.total > 1 && Lightbox.loopItems) || Lightbox.activeImage !== 0) { + // Unbind any other click handlers, otherwise this adds a new click handler + // each time the arrow is clicked. + $(prevLink).css({'zIndex': '10500'}).show().unbind().click(function() { + Lightbox.changeData(Lightbox.activeImage - 1); return false; + }); + } + // Safari browsers need to have hide() called again. + else { + $(prevLink).hide(); + } + + // If not last image in set, display next image button. + if ((Lightbox.total > 1 && Lightbox.loopItems) || Lightbox.activeImage != (Lightbox.total - 1)) { + // Unbind any other click handlers, otherwise this adds a new click handler + // each time the arrow is clicked. + $(nextLink).css({'zIndex': '10500'}).show().unbind().click(function() { + Lightbox.changeData(Lightbox.activeImage + 1); return false; + }); + } + // Safari browsers need to have hide() called again. + else { + $(nextLink).hide(); + } + } + + // Don't enable keyboard shortcuts so forms will work. + if (!Lightbox.isModal) { + this.enableKeyboardNav(); + } + }, + + + // enableKeyboardNav() + enableKeyboardNav: function() { + $(document).bind("keydown", this.keyboardAction); + }, + + // disableKeyboardNav() + disableKeyboardNav: function() { + $(document).unbind("keydown", this.keyboardAction); + }, + + // keyboardAction() + keyboardAction: function(e) { + if (e === null) { // IE. + keycode = event.keyCode; + escapeKey = 27; + } + else { // Mozilla. + keycode = e.keyCode; + escapeKey = e.DOM_VK_ESCAPE; + } + + key = String.fromCharCode(keycode).toLowerCase(); + + // Close lightbox. + if (Lightbox.checkKey(Lightbox.keysClose, key, keycode)) { + Lightbox.end('forceClose'); + } + // Display previous image (p, <-). + else if (Lightbox.checkKey(Lightbox.keysPrevious, key, keycode)) { + if ((Lightbox.total > 1 && ((Lightbox.isSlideshow && Lightbox.loopSlides) || (!Lightbox.isSlideshow && Lightbox.loopItems))) || Lightbox.activeImage !== 0) { + Lightbox.changeData(Lightbox.activeImage - 1); + } + + } + // Display next image (n, ->). + else if (Lightbox.checkKey(Lightbox.keysNext, key, keycode)) { + if ((Lightbox.total > 1 && ((Lightbox.isSlideshow && Lightbox.loopSlides) || (!Lightbox.isSlideshow && Lightbox.loopItems))) || Lightbox.activeImage != (Lightbox.total - 1)) { + Lightbox.changeData(Lightbox.activeImage + 1); + } + } + // Zoom in. + else if (Lightbox.checkKey(Lightbox.keysZoom, key, keycode) && !Lightbox.disableResize && !Lightbox.disableZoom && !Lightbox.isSlideshow && !Lightbox.isLightframe) { + if (Lightbox.isZoomedIn) { + Lightbox.changeData(Lightbox.activeImage, false); + } + else if (!Lightbox.isZoomedIn) { + Lightbox.changeData(Lightbox.activeImage, true); + } + return false; + } + // Toggle play / pause (space). + else if (Lightbox.checkKey(Lightbox.keysPlayPause, key, keycode) && Lightbox.isSlideshow) { + + if (Lightbox.isPaused) { + Lightbox.togglePlayPause("lightshowPlay", "lightshowPause"); + } + else { + Lightbox.togglePlayPause("lightshowPause", "lightshowPlay"); + } + return false; + } + }, + + preloadNeighborImages: function() { + + if ((Lightbox.total - 1) > Lightbox.activeImage) { + preloadNextImage = new Image(); + preloadNextImage.src = Lightbox.imageArray[Lightbox.activeImage + 1][0]; + } + if (Lightbox.activeImage > 0) { + preloadPrevImage = new Image(); + preloadPrevImage.src = Lightbox.imageArray[Lightbox.activeImage - 1][0]; + } + + }, + + end: function(caller) { + var closeClick = (caller == 'slideshow' ? false : true); + if (Lightbox.isSlideshow && Lightbox.isPaused && !closeClick) { + return; + } + // To prevent double clicks on navigation links. + if (Lightbox.inprogress === true && caller != 'forceClose') { + return; + } + Lightbox.disableKeyboardNav(); + $('#lightbox').hide(); + $("#lightbox2-overlay").fadeOut(); + Lightbox.isPaused = true; + Lightbox.inprogress = false; + // Replaces calls to showSelectBoxes() and showFlash() in original + // lightbox2. + Lightbox.toggleSelectsFlash('visible'); + if (Lightbox.isSlideshow) { + for (var i = 0; i < Lightbox.slideIdCount; i++) { + window.clearTimeout(Lightbox.slideIdArray[i]); + } + $('#lightshowPause, #lightshowPlay').hide(); + } + else if (Lightbox.isLightframe) { + $('#frameContainer').empty().hide(); + } + else if (Lightbox.isVideo || Lightbox.isModal) { + if (!Lightbox.auto_modal) { + $('#modalContainer').hide().html(""); + } + Lightbox.auto_modal = false; + } + }, + + + // getPageScroll() + // Returns array with x,y page scroll values. + // Core code from - quirksmode.com. + getPageScroll : function() { + + var xScroll, yScroll; + + if (self.pageYOffset || self.pageXOffset) { + yScroll = self.pageYOffset; + xScroll = self.pageXOffset; + } + else if (document.documentElement && (document.documentElement.scrollTop || document.documentElement.scrollLeft)) { // Explorer 6 Strict. + yScroll = document.documentElement.scrollTop; + xScroll = document.documentElement.scrollLeft; + } + else if (document.body) {// All other Explorers. + yScroll = document.body.scrollTop; + xScroll = document.body.scrollLeft; + } + + arrayPageScroll = [xScroll,yScroll]; + return arrayPageScroll; + }, + + // getPageSize() + // Returns array with page width, height and window width, height. + // Core code from - quirksmode.com. + // Edit for Firefox by pHaez. + + getPageSize : function() { + + var xScroll, yScroll; + + if (window.innerHeight && window.scrollMaxY) { + xScroll = window.innerWidth + window.scrollMaxX; + yScroll = window.innerHeight + window.scrollMaxY; + } + else if (document.body.scrollHeight > document.body.offsetHeight) { // All but Explorer Mac. + xScroll = document.body.scrollWidth; + yScroll = document.body.scrollHeight; + } + else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari. + xScroll = document.body.offsetWidth; + yScroll = document.body.offsetHeight; + } + + var windowWidth, windowHeight; + + if (self.innerHeight) { // All except Explorer. + if (document.documentElement.clientWidth) { + windowWidth = document.documentElement.clientWidth; + } + else { + windowWidth = self.innerWidth; + } + windowHeight = self.innerHeight; + } + else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode. + windowWidth = document.documentElement.clientWidth; + windowHeight = document.documentElement.clientHeight; + } + else if (document.body) { // Other Explorers. + windowWidth = document.body.clientWidth; + windowHeight = document.body.clientHeight; + } + // For small pages with total height less than height of the viewport. + if (yScroll < windowHeight) { + pageHeight = windowHeight; + } + else { + pageHeight = yScroll; + } + // For small pages with total width less than width of the viewport. + if (xScroll < windowWidth) { + pageWidth = xScroll; + } + else { + pageWidth = windowWidth; + } + arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight); + return arrayPageSize; + }, + + + // pause(numberMillis) + pause : function(ms) { + var date = new Date(); + var curDate = null; + do { curDate = new Date(); } + while (curDate - date < ms); + }, + + + // toggleSelectsFlash() + // Hide / unhide select lists and flash objects as they appear above the + // lightbox in some browsers. + toggleSelectsFlash: function (state) { + if (state == 'visible') { + $("select.lightbox_hidden, embed.lightbox_hidden, object.lightbox_hidden").show(); + } + else if (state == 'hide') { + $("select:visible, embed:visible, object:visible").not('#lightboxAutoModal select, #lightboxAutoModal embed, #lightboxAutoModal object').addClass("lightbox_hidden"); + $("select.lightbox_hidden, embed.lightbox_hidden, object.lightbox_hidden").hide(); + } + }, + + + // parseRel() + parseRel: function (link) { + var parts = []; + parts["rel"] = parts["title"] = parts["group"] = parts["style"] = parts["flashvars"] = null; + if (!$(link).attr('rel')) return parts; + parts["rel"] = $(link).attr('rel').match(/\w+/)[0]; + + if ($(link).attr('rel').match(/\[(.*)\]/)) { + var info = $(link).attr('rel').match(/\[(.*?)\]/)[1].split('|'); + parts["group"] = info[0]; + parts["style"] = info[1]; + if (parts["style"] != undefined && parts["style"].match(/flashvars:\s?(.*?);/)) { + parts["flashvars"] = parts["style"].match(/flashvars:\s?(.*?);/)[1]; + } + } + if ($(link).attr('rel').match(/\[.*\]\[(.*)\]/)) { + parts["title"] = $(link).attr('rel').match(/\[.*\]\[(.*)\]/)[1]; + } + return parts; + }, + + // setStyles() + setStyles: function(item, styles) { + item.width = Lightbox.iframe_width; + item.height = Lightbox.iframe_height; + item.scrolling = "auto"; + + if (!styles) return item; + var stylesArray = styles.split(';'); + for (var i = 0; i< stylesArray.length; i++) { + if (stylesArray[i].indexOf('width:') >= 0) { + var w = stylesArray[i].replace('width:', ''); + item.width = jQuery.trim(w); + } + else if (stylesArray[i].indexOf('height:') >= 0) { + var h = stylesArray[i].replace('height:', ''); + item.height = jQuery.trim(h); + } + else if (stylesArray[i].indexOf('scrolling:') >= 0) { + var scrolling = stylesArray[i].replace('scrolling:', ''); + item.scrolling = jQuery.trim(scrolling); + } + else if (stylesArray[i].indexOf('overflow:') >= 0) { + var overflow = stylesArray[i].replace('overflow:', ''); + item.overflow = jQuery.trim(overflow); + } + } + return item; + }, + + + // togglePlayPause() + // Hide the pause / play button as appropriate. If pausing the slideshow also + // clear the timers, otherwise move onto the next image. + togglePlayPause: function(hideId, showId) { + if (Lightbox.isSlideshow && hideId == "lightshowPause") { + for (var i = 0; i < Lightbox.slideIdCount; i++) { + window.clearTimeout(Lightbox.slideIdArray[i]); + } + } + $('#' + hideId).hide(); + $('#' + showId).show(); + + if (hideId == "lightshowPlay") { + Lightbox.isPaused = false; + if (!Lightbox.loopSlides && Lightbox.activeImage == (Lightbox.total - 1)) { + Lightbox.end(); + } + else if (Lightbox.total > 1) { + Lightbox.changeData(Lightbox.activeImage + 1); + } + } + else { + Lightbox.isPaused = true; + } + }, + + triggerLightbox: function (rel_type, rel_group) { + if (rel_type.length) { + if (rel_group && rel_group.length) { + $("a[rel^='" + rel_type +"\[" + rel_group + "\]'], area[rel^='" + rel_type +"\[" + rel_group + "\]']").eq(0).trigger("click"); + } + else { + $("a[rel^='" + rel_type +"'], area[rel^='" + rel_type +"']").eq(0).trigger("click"); + } + } + }, + + detectMacFF2: function() { + var ua = navigator.userAgent.toLowerCase(); + if (/firefox[\/\s](\d+\.\d+)/.test(ua)) { + var ffversion = new Number(RegExp.$1); + if (ffversion < 3 && ua.indexOf('mac') != -1) { + return true; + } + } + return false; + }, + + checkKey: function(keys, key, code) { + return (jQuery.inArray(key, keys) != -1 || jQuery.inArray(String(code), keys) != -1); + }, + + filterXSS: function(str, allowed_tags) { + var output = ""; + $.ajax({ + url: Drupal.settings.basePath + 'system/lightbox2/filter-xss', + data: { + 'string' : str, + 'allowed_tags' : allowed_tags + }, + type: "POST", + async: false, + dataType: "json", + success: function(data) { + output = data; + } + }); + return output; + } + +}; + +// Initialize the lightbox. +Drupal.behaviors.initLightbox = { + attach: function(context) { + + $('body:not(.lightbox-processed)', context).addClass('lightbox-processed').each(function() { + Lightbox.initialize(); + return false; // Break the each loop. + }); + + // Attach lightbox to any links with lightbox rels. + Lightbox.initList(context); + $('#lightboxAutoModal', context).triggerHandler('click'); + } +}; +})(jQuery); diff --git a/sites/all/modules/lightbox2/js/lightbox2.js b/sites/all/modules/lightbox2/js/lightbox2.js new file mode 100644 index 0000000..2e23b58 --- /dev/null +++ b/sites/all/modules/lightbox2/js/lightbox2.js @@ -0,0 +1,192 @@ +/* $Id: lightbox2.js,v 1.1.4.39 2010/06/07 15:24:24 snpower Exp $ */ + +// start jQuery block +(function ($) { + +function alt_layout_handler(event) { + if ($("input[name=lightbox2_lite]:checked").val() != 1) { + if ($("input[name=lightbox2_use_alt_layout]:checked").val() == 1) { + $("input[name=lightbox2_force_show_nav]").attr("disabled", "disabled"); + } + else { + $("input[name=lightbox2_force_show_nav]").removeAttr("disabled"); + } + } +} + +function zoom_handler(event) { + if ($("input[name=lightbox2_disable_resize]:checked").val() == 1) { + $("input[name=lightbox2_disable_zoom]").attr("disabled", "disabled"); + } + else { + $("input[name=lightbox2_disable_zoom]").removeAttr("disabled"); + } +} + +function lightbox2_lite_general_handler(event) { + // Enable / disable the non-lightbox2-lite options. + if ($("input[name=lightbox2_lite]:checked").val() == 1) { + $("input[name=lightbox2_use_alt_layout]").attr("disabled", "disabled"); + $("input[name=lightbox2_force_show_nav]").attr("disabled", "disabled"); + $("input[name=lightbox2_loop_items]").attr("disabled", "disabled"); + $("input[name=lightbox2_disable_resize]").attr("disabled", "disabled"); + $("input[name=lightbox2_disable_zoom]").attr("disabled", "disabled"); + $("input[name=lightbox2_enable_video]").attr("disabled", "disabled"); + $("input[name=lightbox2_enable_login]").attr("disabled", "disabled"); + $("input[name=lightbox2_enable_contact]").attr("disabled", "disabled"); + $("input[name=lightbox2_node_link_text]").attr("disabled", "disabled"); + $("input[name=lightbox2_download_link_text]").attr("disabled", "disabled"); + $("input[name=lightbox2_node_link_target]").attr("disabled", "disabled"); + $("input[name=lightbox2_image_count_str]").attr("disabled", "disabled"); + $("input[name=lightbox2_video_count_str]").attr("disabled", "disabled"); + $("input[name=lightbox2_page_count_str]").attr("disabled", "disabled"); + $("select[name=lightbox2_display_image_size]").attr("disabled", "disabled"); + $("select[name='lightbox2_trigger_image_size[]']").attr("disabled", "disabled"); + $("select[name=lightbox2_image_ncck_group_node_id]").attr("disabled", "disabled"); + $("select[name=lightbox2_imagefield_group_node_id]").attr("disabled", "disabled"); + $("input[name=lightbox2_imagefield_use_node_title]").attr("disabled", "disabled"); + $("input[name=lightbox2_disable_close_click]").attr("disabled", "disabled"); + $("input[name=lightbox2_border_size]").attr("disabled", "disabled"); + $("input[name=lightbox2_box_color]").attr("disabled", "disabled"); + $("input[name=lightbox2_font_color]").attr("disabled", "disabled"); + $("input[name=lightbox2_top_position]").attr("disabled", "disabled"); + $("select[name=lightbox2_resize_sequence]").attr("disabled", "disabled"); + $("input[name=lightbox2_resize_speed]").attr("disabled", "disabled"); + $("input[name=lightbox2_fadein_speed]").attr("disabled", "disabled"); + $("input[name=lightbox2_slidedown_speed]").attr("disabled", "disabled"); + } + else { + $("input[name=lightbox2_use_alt_layout]").removeAttr("disabled"); + $("input[name=lightbox2_force_show_nav]").removeAttr("disabled"); + $("input[name=lightbox2_loop_items]").removeAttr("disabled"); + $("input[name=lightbox2_disable_resize]").removeAttr("disabled"); + $("input[name=lightbox2_disable_zoom]").removeAttr("disabled"); + $("input[name=lightbox2_node_link_text]").removeAttr("disabled"); + $("input[name=lightbox2_download_link_text]").removeAttr("disabled"); + $("input[name=lightbox2_node_link_target]").removeAttr("disabled"); + $("input[name=lightbox2_enable_video]").removeAttr("disabled"); + $("input[name=lightbox2_enable_login]").removeAttr("disabled"); + $("input[name=lightbox2_enable_contact]").removeAttr("disabled"); + $("input[name=lightbox2_image_count_str]").removeAttr("disabled"); + $("input[name=lightbox2_video_count_str]").removeAttr("disabled"); + $("input[name=lightbox2_page_count_str]").removeAttr("disabled"); + $("select[name=lightbox2_display_image_size]").removeAttr("disabled"); + $("select[name='lightbox2_trigger_image_size[]']").removeAttr("disabled"); + $("select[name=lightbox2_image_ncck_group_node_id]").removeAttr("disabled"); + $("select[name=lightbox2_imagefield_group_node_id]").removeAttr("disabled"); + $("input[name=lightbox2_imagefield_use_node_title]").removeAttr("disabled"); + $("input[name=lightbox2_disable_close_click]").removeAttr("disabled"); + $("input[name=lightbox2_border_size]").removeAttr("disabled"); + $("input[name=lightbox2_box_color]").removeAttr("disabled"); + $("input[name=lightbox2_font_color]").removeAttr("disabled"); + $("input[name=lightbox2_top_position]").removeAttr("disabled"); + $("select[name=lightbox2_resize_sequence]").removeAttr("disabled"); + $("input[name=lightbox2_resize_speed]").removeAttr("disabled"); + $("input[name=lightbox2_fadein_speed]").removeAttr("disabled"); + $("input[name=lightbox2_slidedown_speed]").removeAttr("disabled"); + alt_layout_handler(); + zoom_handler(); + } +} + +function image_node_handler(event) { + // Image node, flickr, gallery2, inline and custom images stuff. + if ($("input[name=lightbox2_lite]").val() != 1) { + // Image node only stuff. + if ($("select[name=lightbox2_image_node]").val() !== 0) { + $("input[name=lightbox2_disable_nested_galleries]").removeAttr("disabled"); + $("select[name=lightbox2_display_image_size]").removeAttr("disabled"); + $("select[name='lightbox2_trigger_image_size[]']").removeAttr("disabled"); + } + else { + $("input[name=lightbox2_disable_nested_galleries]").attr("disabled", "disabled"); + $("select[name=lightbox2_display_image_size]").attr("disabled", "disabled"); + $("select[name='lightbox2_trigger_image_size[]']").attr("disabled", "disabled"); + } + } +} + +function lightbox2_lite_auto_handler(event) { + // Enable / disable the image node options. + if ($("input[name=lightbox2_lite]").val() == 1) { + // Disable iframe options. + $("input[name=lightbox2_default_frame_width]").attr("disabled", "disabled"); + $("input[name=lightbox2_default_frame_height]").attr("disabled", "disabled"); + $("input[name=lightbox2_frame_border]").attr("disabled", "disabled"); + + // Disable slideshow options. + $("input[name=lightbox2_slideshow_interval]").attr("disabled", "disabled"); + $("input[name=lightbox2_slideshow_automatic_start]").attr("disabled", "disabled"); + $("input[name=lightbox2_slideshow_automatic_exit]").attr("disabled", "disabled"); + $("input[name=lightbox2_slideshow_show_play_pause]").attr("disabled", "disabled"); + $("input[name=lightbox2_slideshow_pause_on_next_click]").attr("disabled", "disabled"); + $("input[name=lightbox2_slideshow_pause_on_previous_click]").attr("disabled", "disabled"); + $("input[name=lightbox2_loop_slides]").attr("disabled", "disabled"); + + // Disable automatic image handling options. + $("select[name=lightbox2_image_node]").attr("disabled", "disabled"); + $("select[name=lightbox2_display_image_size]").attr("disabled", "disabled"); + $("select[name='lightbox2_trigger_image_size[]']").attr("disabled", "disabled"); + $("select[name=lightbox2_flickr]").attr("disabled", "disabled"); + $("select[name=lightbox2_gallery2_blocks]").attr("disabled", "disabled"); + $("select[name=lightbox2_image_assist_custom]").attr("disabled", "disabled"); + $("select[name=lightbox2_inline]").attr("disabled", "disabled"); + $("select[name=lightbox2_custom_class_handler]").attr("disabled", "disabled"); + $("textarea[name=lightbox2_custom_trigger_classes]").attr("disabled", "disabled"); + $("input[name=lightbox2_disable_nested_galleries]").attr("disabled", "disabled"); + $("input[name=lightbox2_disable_nested_acidfree_galleries]").attr("disabled", "disabled"); + $("input[name=lightbox2_enable_acidfree_videos]").attr("disabled", "disabled"); + } + else { + // Enable iframe options. + $("input[name=lightbox2_default_frame_width]").removeAttr("disabled"); + $("input[name=lightbox2_default_frame_height]").removeAttr("disabled"); + $("input[name=lightbox2_frame_border]").removeAttr("disabled"); + + // Enable slideshow options. + $("input[name=lightbox2_slideshow_interval]").removeAttr("disabled"); + $("input[name=lightbox2_slideshow_automatic_start]").removeAttr("disabled"); + $("input[name=lightbox2_slideshow_automatic_exit]").removeAttr("disabled"); + $("input[name=lightbox2_slideshow_show_play_pause]").removeAttr("disabled"); + $("input[name=lightbox2_slideshow_pause_on_next_click]").removeAttr("disabled"); + $("input[name=lightbox2_slideshow_pause_on_previous_click]").removeAttr("disabled"); + $("input[name=lightbox2_loop_slides]").removeAttr("disabled"); + + // Enable automatic image handling options. + $("select[name=lightbox2_image_node]").removeAttr("disabled"); + $("select[name=lightbox2_flickr]").removeAttr("disabled"); + $("select[name=lightbox2_gallery2_blocks]").removeAttr("disabled"); + $("select[name=lightbox2_image_assist_custom]").removeAttr("disabled"); + $("select[name=lightbox2_inline]").removeAttr("disabled"); + $("select[name=lightbox2_custom_class_handler]").removeAttr("disabled"); + $("textarea[name=lightbox2_custom_trigger_classes]").removeAttr("disabled"); + $("select[name=lightbox2_display_image_size]").removeAttr("disabled"); + $("select[name='lightbox2_trigger_image_size[]']").removeAttr("disabled"); + $("input[name=lightbox2_disable_nested_galleries]").removeAttr("disabled"); + $("input[name=lightbox2_disable_nested_acidfree_galleries]").removeAttr("disabled"); + $("input[name=lightbox2_enable_acidfree_videos]").removeAttr("disabled"); + image_node_handler(); + } +} + +$(document).ready(function () { + // Handle lightbox2_settings_form. + lightbox2_lite_general_handler(); + lightbox2_lite_auto_handler(); + image_node_handler(); + $("input[name=lightbox2_lite]").bind("click", lightbox2_lite_general_handler); + $("input[name=lightbox2_use_alt_layout]").bind("click", alt_layout_handler); + $("input[name=lightbox2_disable_resize]").bind("click", zoom_handler); + $("select[name=lightbox2_image_node]").bind("click", image_node_handler); + $("select[name=lightbox2_flickr]").bind("click", image_node_handler); + $("select[name=lightbox2_gallery2_blocks]").bind("click", image_node_handler); + $("select[name=lightbox2_image_assist_custom]").bind("click", image_node_handler); + $("select[name=lightbox2_inline]").bind("click", image_node_handler); + $("select[name=lightbox2_custom_class_handler]").bind("change", image_node_handler); + $("textarea[name=lightbox2_custom_trigger_classes]").bind("change", image_node_handler); + }); + +//End jQuery block +}(jQuery)); + + diff --git a/sites/all/modules/lightbox2/js/lightbox_lite.js b/sites/all/modules/lightbox2/js/lightbox_lite.js new file mode 100644 index 0000000..b1fc244 --- /dev/null +++ b/sites/all/modules/lightbox2/js/lightbox_lite.js @@ -0,0 +1,394 @@ +/* $Id: lightbox_lite.js,v 1.1.2.2.2.19 2010/06/07 14:54:30 snpower Exp $ */ + +/** + * Lightbox JS: Fullsize Image Overlays + * by Lokesh Dhakar - http://www.huddletogether.com + * + * For more information on this script, visit: + * http://huddletogether.com/projects/lightbox/ + * + * This script is distributed via Drupal.org with permission from Lokesh Dhakar. + * Under GPL license. + * Mailto: bugzie@gmail.com + */ + +// start jQuery block +(function ($) { +// +// getPageScroll() +// Returns array with x,y page scroll values. +// Core code from - quirksmode.org +// +function getPageScroll() { + + var xScroll, yScroll; + + if (self.pageYOffset) { + yScroll = self.pageYOffset; + xScroll = self.pageXOffset; + + // Explorer 6 Strict + } + else if (document.documentElement && document.documentElement.scrollTop) { + yScroll = document.documentElement.scrollTop; + xScroll = document.documentElement.scrollLeft; + } + else if (document.body) {// all other Explorers + yScroll = document.body.scrollTop; + xScroll = document.body.scrollLeft; + } + + arrayPageScroll = [xScroll, yScroll]; + return arrayPageScroll; +} + + + +// getPageSize() +// Returns array with page width, height and window width, height +// Core code from - quirksmode.org +// Edit for Firefox by pHaez +function getPageSize() { + + var xScroll, yScroll; + + if (window.innerHeight && window.scrollMaxY) { + xScroll = window.innerWidth + window.scrollMaxX; + yScroll = window.innerHeight + window.scrollMaxY; + // all but Explorer Mac + } + else if (document.body.scrollHeight > document.body.offsetHeight) { + xScroll = document.body.scrollWidth; + yScroll = document.body.scrollHeight; + // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari + } + else { + xScroll = document.body.offsetWidth; + yScroll = document.body.offsetHeight; + } + + var windowWidth, windowHeight; + if (self.innerHeight) { // all except Explorer + if (document.documentElement.clientHeight) { + windowWidth = document.documentElement.clientWidth; + } + else { + windowWidth = self.innerWidth; + } + windowHeight = self.innerHeight; + } + else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode + windowWidth = document.documentElement.clientWidth; + windowHeight = document.documentElement.clientHeight; + } + else if (document.body) { // other Explorers + windowWidth = document.body.clientWidth; + windowHeight = document.body.clientHeight; + } + + // for small pages with total height less then height of the viewport + if (yScroll < windowHeight) { + pageHeight = windowHeight; + } + else { + pageHeight = yScroll; + } + + // for small pages with total width less then width of the viewport + if (xScroll < windowWidth) { + pageWidth = xScroll; + } + else { + pageWidth = windowWidth; + } + + + arrayPageSize = [pageWidth, pageHeight, windowWidth, windowHeight]; + return arrayPageSize; +} + + +// pause(numberMillis) +function pause(ms) { + var date = new Date(); + var curDate = null; + do { curDate = new Date(); } + while (curDate - date < ms); +} + +// hideLightbox() +function hideLightbox() { + // get objects + objOverlay = document.getElementById('lightbox2-overlay'); + objLightbox = document.getElementById('lightbox'); + + // hide lightbox and overlay + objOverlay.style.display = 'none'; + objLightbox.style.display = 'none'; + + // make select boxes visible + selects = document.getElementsByTagName("select"); + for (i = 0; i != selects.length; i++) { + if (selects[i].style.display != "none") { + selects[i].style.visibility = "visible"; + } + } + + // make flash objects visible + embed = document.getElementsByTagName("embed"); + for (i = 0; i != embed.length; i++) { + if (embed[i].style.display != "none") { + embed[i].style.visibility = "visible"; + } + } + objects = document.getElementsByTagName("object"); + for (i = 0; i != objects.length; i++) { + if (objects[i].style.display != "none") { + objects[i].style.visibility = "visible"; + } + } + + // disable keydown listener + document.onkeydown = ''; +} + + +// getKey(key) +// Gets keycode. If 'x' is pressed then it hides the lightbox. +function getKey(e) { + if (e === null) { // ie + keycode = event.keyCode; + escapeKey = 27; + } + else { // mozilla + keycode = e.keyCode; + escapeKey = e.DOM_VK_ESCAPE; + } + key = String.fromCharCode(keycode).toLowerCase(); + + if (key == 'x' || key == 'c' || keycode == escapeKey) { hideLightbox(); } +} + + +// listenKey() +function listenKey () { document.onkeydown = getKey; } + + +function imgLoadingError(image, objImage, objLink) { + var settings = Drupal.settings.lightbox2; + image.src = settings.default_image; + objImage.src = settings.default_image; + objLink.href = settings.default_image; +} + + +// showLightbox() +// Preloads images. Pleaces new image in lightbox then centers and displays. +function showLightbox(objLink) { + var settings = Drupal.settings.lightbox2; + // prep objects + var objOverlay = document.getElementById('lightbox2-overlay'); + var objLightbox = document.getElementById('lightbox'); + var objCaption = document.getElementById('lightboxCaption'); + var objImage = document.getElementById('lightboxImage'); + var objLoadingImage = document.getElementById('loadingImage'); + var objLightboxDetails = document.getElementById('lightboxDetails'); + + var arrayPageSize = getPageSize(); + var arrayPageScroll = getPageScroll(); + + // set height of Overlay to take up whole page and show + objOverlay.style.height = (arrayPageSize[1] + 'px'); + objOverlay.style.display = 'block'; + objOverlay.style.opacity = settings.overlay_opacity; + objOverlay.style.backgroundColor = '#' + settings.overlay_color; + + // preload image + imgPreload = new Image(); + imgPreload.onerror = function() { imgLoadingError(this, objImage, objLink); }; + + imgPreload.onload = function() { + objImage.src = objLink.href; + + // center lightbox and make sure that the top and left values are not + // negative and the image placed outside the viewport + var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - imgPreload.height) / 2); + var lightboxLeft = ((arrayPageSize[0] - 20 - imgPreload.width) / 2); + + objLightbox.style.top = (lightboxTop < 0) ? "0px" : lightboxTop + "px"; + objLightbox.style.left = (lightboxLeft < 0) ? "0px" : lightboxLeft + "px"; + + + //objLightboxDetails.style.width = imgPreload.width + 'px'; + objLightbox.style.width = imgPreload.width + 'px'; + + if (objLink.getAttribute('title')) { + objCaption.style.display = 'block'; + //objCaption.style.width = imgPreload.width + 'px'; + objCaption.innerHTML = objLink.getAttribute('title'); + } + else { + objCaption.style.display = 'none'; + } + + // A small pause between the image loading and displaying is required with + // IE, this prevents the previous image displaying for a short burst + // causing flicker. + if (navigator.appVersion.indexOf("MSIE") != -1) { + pause(250); + } + + if (objLoadingImage) { objLoadingImage.style.display = 'none'; } + + // Hide select boxes as they will 'peek' through the image in IE + selects = document.getElementsByTagName("select"); + for (i = 0; i != selects.length; i++) { + if (selects[i].style.display != "none") { + selects[i].style.visibility = "hidden"; + } + } + + // Hide flash objects as they will 'peek' through the image in IE + embed = document.getElementsByTagName("embed"); + for (i = 0; i != embed.length; i++) { + if (embed[i].style.display != "none") { + embed[i].style.visibility = "hidden"; + } + } + objects = document.getElementsByTagName("object"); + for (i = 0; i != objects.length; i++) { + if (objects[i].style.display != "none") { + objects[i].style.visibility = "hidden"; + } + } + + objLightbox.style.display = 'block'; + + // After image is loaded, update the overlay height as the new image might + // have increased the overall page height. + arrayPageSize = getPageSize(); + objOverlay.style.height = (arrayPageSize[1] + 'px'); + + // Check for 'x' keydown + listenKey(); + + return false; + }; + + imgPreload.src = objLink.href; + +} + + + +// initLightbox() +// Function runs on window load, going through link tags looking for +// rel="lightbox". These links receive onclick events that enable the lightbox +// display for their targets. The function also inserts html markup at the top +// of the page which will be used as a container for the overlay pattern and +// the inline image. +function initLightbox() { + + if (!document.getElementsByTagName) { return; } + var anchors = document.getElementsByTagName("a"); + + // loop through all anchor tags + for (var i = 0; i < anchors.length; i++) { + var anchor = anchors[i]; + var relAttribute = String(anchor.getAttribute("rel")); + + if (anchor.getAttribute("href") && relAttribute.toLowerCase().match("lightbox")) { + $(anchor).click(function(e) { showLightbox(this); if (e.preventDefault) { e.preventDefault(); } return false; }); + } + } + + // the rest of this code inserts html at the top of the page that looks like + // this: + //
+ // + //
+ // + + var objBody = document.getElementsByTagName("body").item(0); + + // create overlay div and hardcode some functional styles (aesthetic styles are in CSS file) + var objOverlay = document.createElement("div"); + objOverlay.setAttribute('id', 'lightbox2-overlay'); + objOverlay.onclick = function () { hideLightbox(); return false; }; + objOverlay.style.display = 'none'; + objOverlay.style.position = 'absolute'; + objOverlay.style.top = '0'; + objOverlay.style.left = '0'; + objOverlay.style.zIndex = '90'; + objOverlay.style.width = '100%'; + objBody.insertBefore(objOverlay, objBody.firstChild); + + var arrayPageSize = getPageSize(); + var arrayPageScroll = getPageScroll(); + + // create loader image + var objLoadingImage = document.createElement("span"); + objLoadingImage.setAttribute('id', 'loadingImage'); + objOverlay.appendChild(objLoadingImage); + + // create lightbox div, same note about styles as above + var objLightbox = document.createElement("div"); + objLightbox.setAttribute('id', 'lightbox'); + objLightbox.style.display = 'none'; + objLightbox.style.position = 'absolute'; + objLightbox.style.zIndex = '100'; + objBody.insertBefore(objLightbox, objOverlay.nextSibling); + + // create link + var objLink = document.createElement("a"); + objLink.setAttribute('href', '#'); + objLink.setAttribute('title', 'Click to close'); + objLink.onclick = function () { hideLightbox(); return false; }; + objLightbox.appendChild(objLink); + + // create close button image + var objCloseButton = document.createElement("span"); + objCloseButton.setAttribute('id', 'closeButton'); + objLink.appendChild(objCloseButton); + + // create image + var objImage = document.createElement("img"); + objImage.setAttribute('id', 'lightboxImage'); + objLink.appendChild(objImage); + + // create details div, a container for the caption and keyboard message + var objLightboxDetails = document.createElement("div"); + objLightboxDetails.setAttribute('id', 'lightboxDetails'); + objLightbox.appendChild(objLightboxDetails); + + // create caption + var objCaption = document.createElement("div"); + objCaption.setAttribute('id', 'lightboxCaption'); + objCaption.style.display = 'none'; + objLightboxDetails.appendChild(objCaption); + + // create keyboard message + var settings = Drupal.settings.lightbox2; + var objKeyboardMsg = document.createElement("div"); + objKeyboardMsg.setAttribute('id', 'keyboardMsg'); + objKeyboardMsg.innerHTML = settings.lite_press_x_close; + objLightboxDetails.appendChild(objKeyboardMsg); +} + +Drupal.behaviors.initLightbox2 = { + attach: function(context) { + initLightbox(); + } +}; + +//End jQuery block +}(jQuery)); diff --git a/sites/all/modules/lightbox2/js/lightbox_modal.js b/sites/all/modules/lightbox2/js/lightbox_modal.js new file mode 100644 index 0000000..5010a43 --- /dev/null +++ b/sites/all/modules/lightbox2/js/lightbox_modal.js @@ -0,0 +1,37 @@ +(function ($) { + +function lightbox2_login() { + + $("a[href*='/user/login'], a[href*='?q=user/login']").each(function() { + $(this).attr({ + href: this.href.replace(/user\/login?/,"user/login/lightbox2"), + rel: 'lightmodal[|width:250px; height:210px;]' + }); + $(this).addClass('lightmodal-login'); + }); +} + +function lightbox2_contact() { + $("a[href$='/contact'], a[href$='?q=contact']").each(function() { + if (!this.href.match('admin/build/contact')) { + $(this).attr({ + href: this.href.replace(/contact?/,"contact/lightbox2"), + rel: 'lightmodal[|width:450px; height:450px;]' + }); + $(this).addClass('lightmodal-contact'); + } + }); +} + +Drupal.behaviors.initLightboxModal = { + attach: function(context, settings) { + if (settings.lightbox2.enable_login) { + lightbox2_login(); + } + if (settings.lightbox2.enable_contact) { + lightbox2_contact(); + } + } +}; +//End jQuery block +}(jQuery)); diff --git a/sites/all/modules/lightbox2/js/lightbox_video.js b/sites/all/modules/lightbox2/js/lightbox_video.js new file mode 100644 index 0000000..8397f7b --- /dev/null +++ b/sites/all/modules/lightbox2/js/lightbox_video.js @@ -0,0 +1,213 @@ +/* $Id: lightbox_video.js,v 1.1.4.20 2010/09/21 17:57:22 snpower Exp $ */ + +/** + * Lightbox video + * @author + * Stella Power, + */ +var Lightvideo; + +// start jQuery block +(function ($) { + +Lightvideo = { + + // startVideo() + startVideo: function (href) { + if (Lightvideo.checkKnownVideos(href)) { + return; + } + else if (href.match(/\.mov$/i)) { + if (navigator.plugins && navigator.plugins.length) { + Lightbox.modalHTML =''; + } else { + Lightbox.modalHTML = ''; + } + } + else if (href.match(/\.wmv$/i) || href.match(/\.asx$/i)) { + Lightbox.modalHTML = ''; + } + else { + Lightbox.videoId = href; + variables = ''; + if (!href.match(/\.swf$/i)) { + href = Lightbox.flvPlayer + '?file=' + href; + if (Lightbox.flvFlashvars.length) { + variables = Lightbox.flvFlashvars; + } + } + + Lightvideo.createEmbed(href, "flvplayer", "#ffffff", variables); + } + }, + + // createEmbed() + createEmbed: function(href, id, color, variables) { + var bgcolor = 'bgcolor="' + color + '"'; + var flashvars = ''; + if (variables) { + flashvars = 'flashvars="' + variables + '"'; + + } + Lightbox.modalHTML = ''; + }, + + + // checkKnownVideos() + checkKnownVideos: function(href) { + if (Lightvideo.checkYouTubeVideo(href) || Lightvideo.checkGoogleVideo(href) || + Lightvideo.checkMySpaceVideo(href) || Lightvideo.checkLiveVideo(href) || + Lightvideo.checkMetacafeVideo(href) || + Lightvideo.checkIFilmSpikeVideo(href) + ) { + return true; + } + return false; + }, + + + // checkYouTubeVideo() + checkYouTubeVideo: function(href) { + var patterns = [ + 'youtube.com/v/([^"&]+)', + 'youtube.com/watch\\?v=([^"&]+)', + 'youtube.com/\\?v=([^"&]+)' + ]; + + for (var i = 0; i < patterns.length; i++) { + var pattern = new RegExp(patterns[i], "i"); + var results = pattern.exec(href); + if (results !== null) { + Lightbox.videoId = results[1]; + var href = "http://www.youtube.com/v/"+Lightbox.videoId; + var variables = 'fs=1'; + if (Lightbox.flvFlashvars.length) { + variables = variables + '&' + Lightbox.flvFlashvars; + href = href + '&' + variables; + } + Lightvideo.createEmbed(href, "flvvideo", "#ffffff", variables); + return true; + } + } + return false; + }, + + // checkGoogleVideo() + checkGoogleVideo: function(href) { + var patterns = [ + 'http://video.google.[a-z]{2,4}/googleplayer.swf\\?docId=(-?\\d*)', + 'http://video.google.[a-z]{2,4}/videoplay\\?docid=([^&]*)&', + 'http://video.google.[a-z]{2,4}/videoplay\\?docid=(.*)' + ]; + + for (var i = 0; i < patterns.length; i++) { + var pattern = new RegExp(patterns[i], "i"); + var results = pattern.exec(href); + if (results !== null) { + Lightbox.videoId = results[1]; + var href = "http://video.google.com/googleplayer.swf?docId="+Lightbox.videoId+"&hl=en"; + var variables = 'fs=true'; + if (Lightbox.flvFlashvars.length) { + variables = variables + '&' + Lightbox.flvFlashvars; + href = href + '&' + variables; + } + Lightvideo.createEmbed(href, "flvvideo", "#ffffff", variables); + return true; + } + } + return false; + }, + + // checkMetacafeVideo() + checkMetacafeVideo: function(href) { + var patterns = [ + 'metacafe.com/watch/(\.[^/]*)/(\.[^/]*)/', + 'metacafe.com/watch/(\.[^/]*)/(\.*)', + 'metacafe.com/fplayer/(\.[^/]*)/(\.[^.]*).' + ]; + + for (var i = 0; i < patterns.length; i++) { + var pattern = new RegExp(patterns[i], "i"); + var results = pattern.exec(href); + if (results !== null) { + Lightbox.videoId = results[1]; + Lightvideo.createEmbed("http://www.metacafe.com/fplayer/"+Lightbox.videoId+"/.swf", "flvvideo", "#ffffff"); + return true; + } + } + return false; + }, + + // checkIFilmSpikeVideo() + checkIFilmSpikeVideo: function(href) { + var patterns = [ + 'spike.com/video/[^/&"]*?/(\\d+)', + 'ifilm.com/video/[^/&"]*?/(\\d+)', + 'spike.com/video/([^/&"]*)', + 'ifilm.com/video/([^/&"]*)' + ]; + + for (var i = 0; i < patterns.length; i++) { + var pattern = new RegExp(patterns[i], "i"); + var results = pattern.exec(href); + if (results !== null) { + Lightbox.videoId = results[1]; + Lightvideo.createEmbed("http://www.spike.com/efp", "flvvideo", "#000", "flvbaseclip="+Lightbox.videoId+"&"); + return true; + } + } + return false; + }, + + // checkMySpaceVideo() + checkMySpaceVideo: function(href) { + var patterns = [ + 'src="myspace.com/index.cfm\\?fuseaction=vids.individual&videoid=([^&"]+)', + 'myspace.com/index.cfm\\?fuseaction=vids.individual&videoid=([^&"]+)', + 'src="myspacetv.com/index.cfm\\?fuseaction=vids.individual&videoid=([^&"]+)"', + 'myspacetv.com/index.cfm\\?fuseaction=vids.individual&videoid=([^&"]+)' + ]; + + for (var i = 0; i < patterns.length; i++) { + var pattern = new RegExp(patterns[i], "i"); + var results = pattern.exec(href); + if (results !== null) { + Lightbox.videoId = results[1]; + Lightvideo.createEmbed("http://lads.myspace.com/videos/vplayer.swf", "flvvideo", "#ffffff", "m="+Lightbox.videoId); + return true; + } + } + return false; + }, + + // checkLiveVideo() + checkLiveVideo: function(href) { + var patterns = [ + 'livevideo.com/flvplayer/embed/([^"]*)"', + 'livevideo.com/video/[^/]*?/([^/]*)/', + 'livevideo.com/video/([^/]*)/' + ]; + + for (var i = 0; i < patterns.length; i++) { + var pattern = new RegExp(patterns[i], "i"); + var results = pattern.exec(href); + if (results !== null) { + Lightbox.videoId = results[1]; + Lightvideo.createEmbed("http://www.livevideo.com/flvplayer/embed/"+Lightbox.videoId, "flvvideo", "#ffffff"); + return true; + } + } + return false; + } + +}; + +//End jQuery block +}(jQuery)); \ No newline at end of file diff --git a/sites/all/modules/lightbox2/js/prototype.js b/sites/all/modules/lightbox2/js/prototype.js new file mode 100644 index 0000000..2c70b8a --- /dev/null +++ b/sites/all/modules/lightbox2/js/prototype.js @@ -0,0 +1,4221 @@ +/* Prototype JavaScript framework, version 1.6.0.2 + * (c) 2005-2008 Sam Stephenson + * + * Prototype is freely distributable under the terms of an MIT-style license. + * For details, see the Prototype web site: http://www.prototypejs.org/ + * + *--------------------------------------------------------------------------*/ + +var Prototype = { + Version: '1.6.0.2', + + Browser: { + IE: !!(window.attachEvent && !window.opera), + Opera: !!window.opera, + WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1, + Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1, + MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/) + }, + + BrowserFeatures: { + XPath: !!document.evaluate, + ElementExtensions: !!window.HTMLElement, + SpecificElementExtensions: + document.createElement('div').__proto__ && + document.createElement('div').__proto__ !== + document.createElement('form').__proto__ + }, + + ScriptFragment: ']*>([\\S\\s]*?)<\/script>', + JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/, + + emptyFunction: function() { }, + K: function(x) { return x } +}; + +if (Prototype.Browser.MobileSafari) + Prototype.BrowserFeatures.SpecificElementExtensions = false; + + +/* Based on Alex Arnell's inheritance implementation. */ +var Class = { + create: function() { + var parent = null, properties = $A(arguments); + if (Object.isFunction(properties[0])) + parent = properties.shift(); + + function klass() { + this.initialize.apply(this, arguments); + } + + Object.extend(klass, Class.Methods); + klass.superclass = parent; + klass.subclasses = []; + + if (parent) { + var subclass = function() { }; + subclass.prototype = parent.prototype; + klass.prototype = new subclass; + parent.subclasses.push(klass); + } + + for (var i = 0; i < properties.length; i++) + klass.addMethods(properties[i]); + + if (!klass.prototype.initialize) + klass.prototype.initialize = Prototype.emptyFunction; + + klass.prototype.constructor = klass; + + return klass; + } +}; + +Class.Methods = { + addMethods: function(source) { + var ancestor = this.superclass && this.superclass.prototype; + var properties = Object.keys(source); + + if (!Object.keys({ toString: true }).length) + properties.push("toString", "valueOf"); + + for (var i = 0, length = properties.length; i < length; i++) { + var property = properties[i], value = source[property]; + if (ancestor && Object.isFunction(value) && + value.argumentNames().first() == "$super") { + var method = value, value = Object.extend((function(m) { + return function() { return ancestor[m].apply(this, arguments) }; + })(property).wrap(method), { + valueOf: function() { return method }, + toString: function() { return method.toString() } + }); + } + this.prototype[property] = value; + } + + return this; + } +}; + +var Abstract = { }; + +Object.extend = function(destination, source) { + for (var property in source) + destination[property] = source[property]; + return destination; +}; + +Object.extend(Object, { + inspect: function(object) { + try { + if (Object.isUndefined(object)) return 'undefined'; + if (object === null) return 'null'; + return object.inspect ? object.inspect() : String(object); + } catch (e) { + if (e instanceof RangeError) return '...'; + throw e; + } + }, + + toJSON: function(object) { + var type = typeof object; + switch (type) { + case 'undefined': + case 'function': + case 'unknown': return; + case 'boolean': return object.toString(); + } + + if (object === null) return 'null'; + if (object.toJSON) return object.toJSON(); + if (Object.isElement(object)) return; + + var results = []; + for (var property in object) { + var value = Object.toJSON(object[property]); + if (!Object.isUndefined(value)) + results.push(property.toJSON() + ': ' + value); + } + + return '{' + results.join(', ') + '}'; + }, + + toQueryString: function(object) { + return $H(object).toQueryString(); + }, + + toHTML: function(object) { + return object && object.toHTML ? object.toHTML() : String.interpret(object); + }, + + keys: function(object) { + var keys = []; + for (var property in object) + keys.push(property); + return keys; + }, + + values: function(object) { + var values = []; + for (var property in object) + values.push(object[property]); + return values; + }, + + clone: function(object) { + return Object.extend({ }, object); + }, + + isElement: function(object) { + return object && object.nodeType == 1; + }, + + isArray: function(object) { + return object != null && typeof object == "object" && + 'splice' in object && 'join' in object; + }, + + isHash: function(object) { + return object instanceof Hash; + }, + + isFunction: function(object) { + return typeof object == "function"; + }, + + isString: function(object) { + return typeof object == "string"; + }, + + isNumber: function(object) { + return typeof object == "number"; + }, + + isUndefined: function(object) { + return typeof object == "undefined"; + } +}); + +Object.extend(Function.prototype, { + argumentNames: function() { + var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip"); + return names.length == 1 && !names[0] ? [] : names; + }, + + bind: function() { + if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this; + var __method = this, args = $A(arguments), object = args.shift(); + return function() { + return __method.apply(object, args.concat($A(arguments))); + } + }, + + bindAsEventListener: function() { + var __method = this, args = $A(arguments), object = args.shift(); + return function(event) { + return __method.apply(object, [event || window.event].concat(args)); + } + }, + + curry: function() { + if (!arguments.length) return this; + var __method = this, args = $A(arguments); + return function() { + return __method.apply(this, args.concat($A(arguments))); + } + }, + + delay: function() { + var __method = this, args = $A(arguments), timeout = args.shift() * 1000; + return window.setTimeout(function() { + return __method.apply(__method, args); + }, timeout); + }, + + wrap: function(wrapper) { + var __method = this; + return function() { + return wrapper.apply(this, [__method.bind(this)].concat($A(arguments))); + } + }, + + methodize: function() { + if (this._methodized) return this._methodized; + var __method = this; + return this._methodized = function() { + return __method.apply(null, [this].concat($A(arguments))); + }; + } +}); + +Function.prototype.defer = Function.prototype.delay.curry(0.01); + +Date.prototype.toJSON = function() { + return '"' + this.getUTCFullYear() + '-' + + (this.getUTCMonth() + 1).toPaddedString(2) + '-' + + this.getUTCDate().toPaddedString(2) + 'T' + + this.getUTCHours().toPaddedString(2) + ':' + + this.getUTCMinutes().toPaddedString(2) + ':' + + this.getUTCSeconds().toPaddedString(2) + 'Z"'; +}; + +var Try = { + these: function() { + var returnValue; + + for (var i = 0, length = arguments.length; i < length; i++) { + var lambda = arguments[i]; + try { + returnValue = lambda(); + break; + } catch (e) { } + } + + return returnValue; + } +}; + +RegExp.prototype.match = RegExp.prototype.test; + +RegExp.escape = function(str) { + return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); +}; + +/*--------------------------------------------------------------------------*/ + +var PeriodicalExecuter = Class.create({ + initialize: function(callback, frequency) { + this.callback = callback; + this.frequency = frequency; + this.currentlyExecuting = false; + + this.registerCallback(); + }, + + registerCallback: function() { + this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); + }, + + execute: function() { + this.callback(this); + }, + + stop: function() { + if (!this.timer) return; + clearInterval(this.timer); + this.timer = null; + }, + + onTimerEvent: function() { + if (!this.currentlyExecuting) { + try { + this.currentlyExecuting = true; + this.execute(); + } finally { + this.currentlyExecuting = false; + } + } + } +}); +Object.extend(String, { + interpret: function(value) { + return value == null ? '' : String(value); + }, + specialChar: { + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '\\': '\\\\' + } +}); + +Object.extend(String.prototype, { + gsub: function(pattern, replacement) { + var result = '', source = this, match; + replacement = arguments.callee.prepareReplacement(replacement); + + while (source.length > 0) { + if (match = source.match(pattern)) { + result += source.slice(0, match.index); + result += String.interpret(replacement(match)); + source = source.slice(match.index + match[0].length); + } else { + result += source, source = ''; + } + } + return result; + }, + + sub: function(pattern, replacement, count) { + replacement = this.gsub.prepareReplacement(replacement); + count = Object.isUndefined(count) ? 1 : count; + + return this.gsub(pattern, function(match) { + if (--count < 0) return match[0]; + return replacement(match); + }); + }, + + scan: function(pattern, iterator) { + this.gsub(pattern, iterator); + return String(this); + }, + + truncate: function(length, truncation) { + length = length || 30; + truncation = Object.isUndefined(truncation) ? '...' : truncation; + return this.length > length ? + this.slice(0, length - truncation.length) + truncation : String(this); + }, + + strip: function() { + return this.replace(/^\s+/, '').replace(/\s+$/, ''); + }, + + stripTags: function() { + return this.replace(/<\/?[^>]+>/gi, ''); + }, + + stripScripts: function() { + return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); + }, + + extractScripts: function() { + var matchAll = new RegExp(Prototype.ScriptFragment, 'img'); + var matchOne = new RegExp(Prototype.ScriptFragment, 'im'); + return (this.match(matchAll) || []).map(function(scriptTag) { + return (scriptTag.match(matchOne) || ['', ''])[1]; + }); + }, + + evalScripts: function() { + return this.extractScripts().map(function(script) { return eval(script) }); + }, + + escapeHTML: function() { + var self = arguments.callee; + self.text.data = this; + return self.div.innerHTML; + }, + + unescapeHTML: function() { + var div = new Element('div'); + div.innerHTML = this.stripTags(); + return div.childNodes[0] ? (div.childNodes.length > 1 ? + $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) : + div.childNodes[0].nodeValue) : ''; + }, + + toQueryParams: function(separator) { + var match = this.strip().match(/([^?#]*)(#.*)?$/); + if (!match) return { }; + + return match[1].split(separator || '&').inject({ }, function(hash, pair) { + if ((pair = pair.split('='))[0]) { + var key = decodeURIComponent(pair.shift()); + var value = pair.length > 1 ? pair.join('=') : pair[0]; + if (value != undefined) value = decodeURIComponent(value); + + if (key in hash) { + if (!Object.isArray(hash[key])) hash[key] = [hash[key]]; + hash[key].push(value); + } + else hash[key] = value; + } + return hash; + }); + }, + + toArray: function() { + return this.split(''); + }, + + succ: function() { + return this.slice(0, this.length - 1) + + String.fromCharCode(this.charCodeAt(this.length - 1) + 1); + }, + + times: function(count) { + return count < 1 ? '' : new Array(count + 1).join(this); + }, + + camelize: function() { + var parts = this.split('-'), len = parts.length; + if (len == 1) return parts[0]; + + var camelized = this.charAt(0) == '-' + ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1) + : parts[0]; + + for (var i = 1; i < len; i++) + camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1); + + return camelized; + }, + + capitalize: function() { + return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); + }, + + underscore: function() { + return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase(); + }, + + dasherize: function() { + return this.gsub(/_/,'-'); + }, + + inspect: function(useDoubleQuotes) { + var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) { + var character = String.specialChar[match[0]]; + return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16); + }); + if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; + return "'" + escapedString.replace(/'/g, '\\\'') + "'"; + }, + + toJSON: function() { + return this.inspect(true); + }, + + unfilterJSON: function(filter) { + return this.sub(filter || Prototype.JSONFilter, '#{1}'); + }, + + isJSON: function() { + var str = this; + if (str.blank()) return false; + str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''); + return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str); + }, + + evalJSON: function(sanitize) { + var json = this.unfilterJSON(); + try { + if (!sanitize || json.isJSON()) return eval('(' + json + ')'); + } catch (e) { } + throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); + }, + + include: function(pattern) { + return this.indexOf(pattern) > -1; + }, + + startsWith: function(pattern) { + return this.indexOf(pattern) === 0; + }, + + endsWith: function(pattern) { + var d = this.length - pattern.length; + return d >= 0 && this.lastIndexOf(pattern) === d; + }, + + empty: function() { + return this == ''; + }, + + blank: function() { + return /^\s*$/.test(this); + }, + + interpolate: function(object, pattern) { + return new Template(this, pattern).evaluate(object); + } +}); + +if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, { + escapeHTML: function() { + return this.replace(/&/g,'&').replace(//g,'>'); + }, + unescapeHTML: function() { + return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); + } +}); + +String.prototype.gsub.prepareReplacement = function(replacement) { + if (Object.isFunction(replacement)) return replacement; + var template = new Template(replacement); + return function(match) { return template.evaluate(match) }; +}; + +String.prototype.parseQuery = String.prototype.toQueryParams; + +Object.extend(String.prototype.escapeHTML, { + div: document.createElement('div'), + text: document.createTextNode('') +}); + +with (String.prototype.escapeHTML) div.appendChild(text); + +var Template = Class.create({ + initialize: function(template, pattern) { + this.template = template.toString(); + this.pattern = pattern || Template.Pattern; + }, + + evaluate: function(object) { + if (Object.isFunction(object.toTemplateReplacements)) + object = object.toTemplateReplacements(); + + return this.template.gsub(this.pattern, function(match) { + if (object == null) return ''; + + var before = match[1] || ''; + if (before == '\\') return match[2]; + + var ctx = object, expr = match[3]; + var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/; + match = pattern.exec(expr); + if (match == null) return before; + + while (match != null) { + var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1]; + ctx = ctx[comp]; + if (null == ctx || '' == match[3]) break; + expr = expr.substring('[' == match[3] ? match[1].length : match[0].length); + match = pattern.exec(expr); + } + + return before + String.interpret(ctx); + }); + } +}); +Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; + +var $break = { }; + +var Enumerable = { + each: function(iterator, context) { + var index = 0; + iterator = iterator.bind(context); + try { + this._each(function(value) { + iterator(value, index++); + }); + } catch (e) { + if (e != $break) throw e; + } + return this; + }, + + eachSlice: function(number, iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var index = -number, slices = [], array = this.toArray(); + while ((index += number) < array.length) + slices.push(array.slice(index, index+number)); + return slices.collect(iterator, context); + }, + + all: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var result = true; + this.each(function(value, index) { + result = result && !!iterator(value, index); + if (!result) throw $break; + }); + return result; + }, + + any: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var result = false; + this.each(function(value, index) { + if (result = !!iterator(value, index)) + throw $break; + }); + return result; + }, + + collect: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var results = []; + this.each(function(value, index) { + results.push(iterator(value, index)); + }); + return results; + }, + + detect: function(iterator, context) { + iterator = iterator.bind(context); + var result; + this.each(function(value, index) { + if (iterator(value, index)) { + result = value; + throw $break; + } + }); + return result; + }, + + findAll: function(iterator, context) { + iterator = iterator.bind(context); + var results = []; + this.each(function(value, index) { + if (iterator(value, index)) + results.push(value); + }); + return results; + }, + + grep: function(filter, iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var results = []; + + if (Object.isString(filter)) + filter = new RegExp(filter); + + this.each(function(value, index) { + if (filter.match(value)) + results.push(iterator(value, index)); + }); + return results; + }, + + include: function(object) { + if (Object.isFunction(this.indexOf)) + if (this.indexOf(object) != -1) return true; + + var found = false; + this.each(function(value) { + if (value == object) { + found = true; + throw $break; + } + }); + return found; + }, + + inGroupsOf: function(number, fillWith) { + fillWith = Object.isUndefined(fillWith) ? null : fillWith; + return this.eachSlice(number, function(slice) { + while(slice.length < number) slice.push(fillWith); + return slice; + }); + }, + + inject: function(memo, iterator, context) { + iterator = iterator.bind(context); + this.each(function(value, index) { + memo = iterator(memo, value, index); + }); + return memo; + }, + + invoke: function(method) { + var args = $A(arguments).slice(1); + return this.map(function(value) { + return value[method].apply(value, args); + }); + }, + + max: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var result; + this.each(function(value, index) { + value = iterator(value, index); + if (result == null || value >= result) + result = value; + }); + return result; + }, + + min: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var result; + this.each(function(value, index) { + value = iterator(value, index); + if (result == null || value < result) + result = value; + }); + return result; + }, + + partition: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var trues = [], falses = []; + this.each(function(value, index) { + (iterator(value, index) ? + trues : falses).push(value); + }); + return [trues, falses]; + }, + + pluck: function(property) { + var results = []; + this.each(function(value) { + results.push(value[property]); + }); + return results; + }, + + reject: function(iterator, context) { + iterator = iterator.bind(context); + var results = []; + this.each(function(value, index) { + if (!iterator(value, index)) + results.push(value); + }); + return results; + }, + + sortBy: function(iterator, context) { + iterator = iterator.bind(context); + return this.map(function(value, index) { + return {value: value, criteria: iterator(value, index)}; + }).sort(function(left, right) { + var a = left.criteria, b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + }).pluck('value'); + }, + + toArray: function() { + return this.map(); + }, + + zip: function() { + var iterator = Prototype.K, args = $A(arguments); + if (Object.isFunction(args.last())) + iterator = args.pop(); + + var collections = [this].concat(args).map($A); + return this.map(function(value, index) { + return iterator(collections.pluck(index)); + }); + }, + + size: function() { + return this.toArray().length; + }, + + inspect: function() { + return '#'; + } +}; + +Object.extend(Enumerable, { + map: Enumerable.collect, + find: Enumerable.detect, + select: Enumerable.findAll, + filter: Enumerable.findAll, + member: Enumerable.include, + entries: Enumerable.toArray, + every: Enumerable.all, + some: Enumerable.any +}); +function $A(iterable) { + if (!iterable) return []; + if (iterable.toArray) return iterable.toArray(); + var length = iterable.length || 0, results = new Array(length); + while (length--) results[length] = iterable[length]; + return results; +} + +if (Prototype.Browser.WebKit) { + $A = function(iterable) { + if (!iterable) return []; + if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') && + iterable.toArray) return iterable.toArray(); + var length = iterable.length || 0, results = new Array(length); + while (length--) results[length] = iterable[length]; + return results; + }; +} + +Array.from = $A; + +Object.extend(Array.prototype, Enumerable); + +if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse; + +Object.extend(Array.prototype, { + _each: function(iterator) { + for (var i = 0, length = this.length; i < length; i++) + iterator(this[i]); + }, + + clear: function() { + this.length = 0; + return this; + }, + + first: function() { + return this[0]; + }, + + last: function() { + return this[this.length - 1]; + }, + + compact: function() { + return this.select(function(value) { + return value != null; + }); + }, + + flatten: function() { + return this.inject([], function(array, value) { + return array.concat(Object.isArray(value) ? + value.flatten() : [value]); + }); + }, + + without: function() { + var values = $A(arguments); + return this.select(function(value) { + return !values.include(value); + }); + }, + + reverse: function(inline) { + return (inline !== false ? this : this.toArray())._reverse(); + }, + + reduce: function() { + return this.length > 1 ? this : this[0]; + }, + + uniq: function(sorted) { + return this.inject([], function(array, value, index) { + if (0 == index || (sorted ? array.last() != value : !array.include(value))) + array.push(value); + return array; + }); + }, + + intersect: function(array) { + return this.uniq().findAll(function(item) { + return array.detect(function(value) { return item === value }); + }); + }, + + clone: function() { + return [].concat(this); + }, + + size: function() { + return this.length; + }, + + inspect: function() { + return '[' + this.map(Object.inspect).join(', ') + ']'; + }, + + toJSON: function() { + var results = []; + this.each(function(object) { + var value = Object.toJSON(object); + if (!Object.isUndefined(value)) results.push(value); + }); + return '[' + results.join(', ') + ']'; + } +}); + +// use native browser JS 1.6 implementation if available +if (Object.isFunction(Array.prototype.forEach)) + Array.prototype._each = Array.prototype.forEach; + +if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) { + i || (i = 0); + var length = this.length; + if (i < 0) i = length + i; + for (; i < length; i++) + if (this[i] === item) return i; + return -1; +}; + +if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) { + i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1; + var n = this.slice(0, i).reverse().indexOf(item); + return (n < 0) ? n : i - n - 1; +}; + +Array.prototype.toArray = Array.prototype.clone; + +function $w(string) { + if (!Object.isString(string)) return []; + string = string.strip(); + return string ? string.split(/\s+/) : []; +} + +if (Prototype.Browser.Opera){ + Array.prototype.concat = function() { + var array = []; + for (var i = 0, length = this.length; i < length; i++) array.push(this[i]); + for (var i = 0, length = arguments.length; i < length; i++) { + if (Object.isArray(arguments[i])) { + for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++) + array.push(arguments[i][j]); + } else { + array.push(arguments[i]); + } + } + return array; + }; +} +Object.extend(Number.prototype, { + toColorPart: function() { + return this.toPaddedString(2, 16); + }, + + succ: function() { + return this + 1; + }, + + times: function(iterator) { + $R(0, this, true).each(iterator); + return this; + }, + + toPaddedString: function(length, radix) { + var string = this.toString(radix || 10); + return '0'.times(length - string.length) + string; + }, + + toJSON: function() { + return isFinite(this) ? this.toString() : 'null'; + } +}); + +$w('abs round ceil floor').each(function(method){ + Number.prototype[method] = Math[method].methodize(); +}); +function $H(object) { + return new Hash(object); +}; + +var Hash = Class.create(Enumerable, (function() { + + function toQueryPair(key, value) { + if (Object.isUndefined(value)) return key; + return key + '=' + encodeURIComponent(String.interpret(value)); + } + + return { + initialize: function(object) { + this._object = Object.isHash(object) ? object.toObject() : Object.clone(object); + }, + + _each: function(iterator) { + for (var key in this._object) { + var value = this._object[key], pair = [key, value]; + pair.key = key; + pair.value = value; + iterator(pair); + } + }, + + set: function(key, value) { + return this._object[key] = value; + }, + + get: function(key) { + return this._object[key]; + }, + + unset: function(key) { + var value = this._object[key]; + delete this._object[key]; + return value; + }, + + toObject: function() { + return Object.clone(this._object); + }, + + keys: function() { + return this.pluck('key'); + }, + + values: function() { + return this.pluck('value'); + }, + + index: function(value) { + var match = this.detect(function(pair) { + return pair.value === value; + }); + return match && match.key; + }, + + merge: function(object) { + return this.clone().update(object); + }, + + update: function(object) { + return new Hash(object).inject(this, function(result, pair) { + result.set(pair.key, pair.value); + return result; + }); + }, + + toQueryString: function() { + return this.map(function(pair) { + var key = encodeURIComponent(pair.key), values = pair.value; + + if (values && typeof values == 'object') { + if (Object.isArray(values)) + return values.map(toQueryPair.curry(key)).join('&'); + } + return toQueryPair(key, values); + }).join('&'); + }, + + inspect: function() { + return '#'; + }, + + toJSON: function() { + return Object.toJSON(this.toObject()); + }, + + clone: function() { + return new Hash(this); + } + } +})()); + +Hash.prototype.toTemplateReplacements = Hash.prototype.toObject; +Hash.from = $H; +var ObjectRange = Class.create(Enumerable, { + initialize: function(start, end, exclusive) { + this.start = start; + this.end = end; + this.exclusive = exclusive; + }, + + _each: function(iterator) { + var value = this.start; + while (this.include(value)) { + iterator(value); + value = value.succ(); + } + }, + + include: function(value) { + if (value < this.start) + return false; + if (this.exclusive) + return value < this.end; + return value <= this.end; + } +}); + +var $R = function(start, end, exclusive) { + return new ObjectRange(start, end, exclusive); +}; + +var Ajax = { + getTransport: function() { + return Try.these( + function() {return new XMLHttpRequest()}, + function() {return new ActiveXObject('Msxml2.XMLHTTP')}, + function() {return new ActiveXObject('Microsoft.XMLHTTP')} + ) || false; + }, + + activeRequestCount: 0 +}; + +Ajax.Responders = { + responders: [], + + _each: function(iterator) { + this.responders._each(iterator); + }, + + register: function(responder) { + if (!this.include(responder)) + this.responders.push(responder); + }, + + unregister: function(responder) { + this.responders = this.responders.without(responder); + }, + + dispatch: function(callback, request, transport, json) { + this.each(function(responder) { + if (Object.isFunction(responder[callback])) { + try { + responder[callback].apply(responder, [request, transport, json]); + } catch (e) { } + } + }); + } +}; + +Object.extend(Ajax.Responders, Enumerable); + +Ajax.Responders.register({ + onCreate: function() { Ajax.activeRequestCount++ }, + onComplete: function() { Ajax.activeRequestCount-- } +}); + +Ajax.Base = Class.create({ + initialize: function(options) { + this.options = { + method: 'post', + asynchronous: true, + contentType: 'application/x-www-form-urlencoded', + encoding: 'UTF-8', + parameters: '', + evalJSON: true, + evalJS: true + }; + Object.extend(this.options, options || { }); + + this.options.method = this.options.method.toLowerCase(); + + if (Object.isString(this.options.parameters)) + this.options.parameters = this.options.parameters.toQueryParams(); + else if (Object.isHash(this.options.parameters)) + this.options.parameters = this.options.parameters.toObject(); + } +}); + +Ajax.Request = Class.create(Ajax.Base, { + _complete: false, + + initialize: function($super, url, options) { + $super(options); + this.transport = Ajax.getTransport(); + this.request(url); + }, + + request: function(url) { + this.url = url; + this.method = this.options.method; + var params = Object.clone(this.options.parameters); + + if (!['get', 'post'].include(this.method)) { + // simulate other verbs over post + params['_method'] = this.method; + this.method = 'post'; + } + + this.parameters = params; + + if (params = Object.toQueryString(params)) { + // when GET, append parameters to URL + if (this.method == 'get') + this.url += (this.url.include('?') ? '&' : '?') + params; + else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) + params += '&_='; + } + + try { + var response = new Ajax.Response(this); + if (this.options.onCreate) this.options.onCreate(response); + Ajax.Responders.dispatch('onCreate', this, response); + + this.transport.open(this.method.toUpperCase(), this.url, + this.options.asynchronous); + + if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1); + + this.transport.onreadystatechange = this.onStateChange.bind(this); + this.setRequestHeaders(); + + this.body = this.method == 'post' ? (this.options.postBody || params) : null; + this.transport.send(this.body); + + /* Force Firefox to handle ready state 4 for synchronous requests */ + if (!this.options.asynchronous && this.transport.overrideMimeType) + this.onStateChange(); + + } + catch (e) { + this.dispatchException(e); + } + }, + + onStateChange: function() { + var readyState = this.transport.readyState; + if (readyState > 1 && !((readyState == 4) && this._complete)) + this.respondToReadyState(this.transport.readyState); + }, + + setRequestHeaders: function() { + var headers = { + 'X-Requested-With': 'XMLHttpRequest', + 'X-Prototype-Version': Prototype.Version, + 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' + }; + + if (this.method == 'post') { + headers['Content-type'] = this.options.contentType + + (this.options.encoding ? '; charset=' + this.options.encoding : ''); + + /* Force "Connection: close" for older Mozilla browsers to work + * around a bug where XMLHttpRequest sends an incorrect + * Content-length header. See Mozilla Bugzilla #246651. + */ + if (this.transport.overrideMimeType && + (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) + headers['Connection'] = 'close'; + } + + // user-defined headers + if (typeof this.options.requestHeaders == 'object') { + var extras = this.options.requestHeaders; + + if (Object.isFunction(extras.push)) + for (var i = 0, length = extras.length; i < length; i += 2) + headers[extras[i]] = extras[i+1]; + else + $H(extras).each(function(pair) { headers[pair.key] = pair.value }); + } + + for (var name in headers) + this.transport.setRequestHeader(name, headers[name]); + }, + + success: function() { + var status = this.getStatus(); + return !status || (status >= 200 && status < 300); + }, + + getStatus: function() { + try { + return this.transport.status || 0; + } catch (e) { return 0 } + }, + + respondToReadyState: function(readyState) { + var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this); + + if (state == 'Complete') { + try { + this._complete = true; + (this.options['on' + response.status] + || this.options['on' + (this.success() ? 'Success' : 'Failure')] + || Prototype.emptyFunction)(response, response.headerJSON); + } catch (e) { + this.dispatchException(e); + } + + var contentType = response.getHeader('Content-type'); + if (this.options.evalJS == 'force' + || (this.options.evalJS && this.isSameOrigin() && contentType + && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))) + this.evalResponse(); + } + + try { + (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON); + Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON); + } catch (e) { + this.dispatchException(e); + } + + if (state == 'Complete') { + // avoid memory leak in MSIE: clean up + this.transport.onreadystatechange = Prototype.emptyFunction; + } + }, + + isSameOrigin: function() { + var m = this.url.match(/^\s*https?:\/\/[^\/]*/); + return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({ + protocol: location.protocol, + domain: document.domain, + port: location.port ? ':' + location.port : '' + })); + }, + + getHeader: function(name) { + try { + return this.transport.getResponseHeader(name) || null; + } catch (e) { return null } + }, + + evalResponse: function() { + try { + return eval((this.transport.responseText || '').unfilterJSON()); + } catch (e) { + this.dispatchException(e); + } + }, + + dispatchException: function(exception) { + (this.options.onException || Prototype.emptyFunction)(this, exception); + Ajax.Responders.dispatch('onException', this, exception); + } +}); + +Ajax.Request.Events = + ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; + +Ajax.Response = Class.create({ + initialize: function(request){ + this.request = request; + var transport = this.transport = request.transport, + readyState = this.readyState = transport.readyState; + + if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) { + this.status = this.getStatus(); + this.statusText = this.getStatusText(); + this.responseText = String.interpret(transport.responseText); + this.headerJSON = this._getHeaderJSON(); + } + + if(readyState == 4) { + var xml = transport.responseXML; + this.responseXML = Object.isUndefined(xml) ? null : xml; + this.responseJSON = this._getResponseJSON(); + } + }, + + status: 0, + statusText: '', + + getStatus: Ajax.Request.prototype.getStatus, + + getStatusText: function() { + try { + return this.transport.statusText || ''; + } catch (e) { return '' } + }, + + getHeader: Ajax.Request.prototype.getHeader, + + getAllHeaders: function() { + try { + return this.getAllResponseHeaders(); + } catch (e) { return null } + }, + + getResponseHeader: function(name) { + return this.transport.getResponseHeader(name); + }, + + getAllResponseHeaders: function() { + return this.transport.getAllResponseHeaders(); + }, + + _getHeaderJSON: function() { + var json = this.getHeader('X-JSON'); + if (!json) return null; + json = decodeURIComponent(escape(json)); + try { + return json.evalJSON(this.request.options.sanitizeJSON || + !this.request.isSameOrigin()); + } catch (e) { + this.request.dispatchException(e); + } + }, + + _getResponseJSON: function() { + var options = this.request.options; + if (!options.evalJSON || (options.evalJSON != 'force' && + !(this.getHeader('Content-type') || '').include('application/json')) || + this.responseText.blank()) + return null; + try { + return this.responseText.evalJSON(options.sanitizeJSON || + !this.request.isSameOrigin()); + } catch (e) { + this.request.dispatchException(e); + } + } +}); + +Ajax.Updater = Class.create(Ajax.Request, { + initialize: function($super, container, url, options) { + this.container = { + success: (container.success || container), + failure: (container.failure || (container.success ? null : container)) + }; + + options = Object.clone(options); + var onComplete = options.onComplete; + options.onComplete = (function(response, json) { + this.updateContent(response.responseText); + if (Object.isFunction(onComplete)) onComplete(response, json); + }).bind(this); + + $super(url, options); + }, + + updateContent: function(responseText) { + var receiver = this.container[this.success() ? 'success' : 'failure'], + options = this.options; + + if (!options.evalScripts) responseText = responseText.stripScripts(); + + if (receiver = $(receiver)) { + if (options.insertion) { + if (Object.isString(options.insertion)) { + var insertion = { }; insertion[options.insertion] = responseText; + receiver.insert(insertion); + } + else options.insertion(receiver, responseText); + } + else receiver.update(responseText); + } + } +}); + +Ajax.PeriodicalUpdater = Class.create(Ajax.Base, { + initialize: function($super, container, url, options) { + $super(options); + this.onComplete = this.options.onComplete; + + this.frequency = (this.options.frequency || 2); + this.decay = (this.options.decay || 1); + + this.updater = { }; + this.container = container; + this.url = url; + + this.start(); + }, + + start: function() { + this.options.onComplete = this.updateComplete.bind(this); + this.onTimerEvent(); + }, + + stop: function() { + this.updater.options.onComplete = undefined; + clearTimeout(this.timer); + (this.onComplete || Prototype.emptyFunction).apply(this, arguments); + }, + + updateComplete: function(response) { + if (this.options.decay) { + this.decay = (response.responseText == this.lastText ? + this.decay * this.options.decay : 1); + + this.lastText = response.responseText; + } + this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency); + }, + + onTimerEvent: function() { + this.updater = new Ajax.Updater(this.container, this.url, this.options); + } +}); +function $(element) { + if (arguments.length > 1) { + for (var i = 0, elements = [], length = arguments.length; i < length; i++) + elements.push($(arguments[i])); + return elements; + } + if (Object.isString(element)) + element = document.getElementById(element); + return Element.extend(element); +} + +if (Prototype.BrowserFeatures.XPath) { + document._getElementsByXPath = function(expression, parentElement) { + var results = []; + var query = document.evaluate(expression, $(parentElement) || document, + null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); + for (var i = 0, length = query.snapshotLength; i < length; i++) + results.push(Element.extend(query.snapshotItem(i))); + return results; + }; +} + +/*--------------------------------------------------------------------------*/ + +if (!window.Node) var Node = { }; + +if (!Node.ELEMENT_NODE) { + // DOM level 2 ECMAScript Language Binding + Object.extend(Node, { + ELEMENT_NODE: 1, + ATTRIBUTE_NODE: 2, + TEXT_NODE: 3, + CDATA_SECTION_NODE: 4, + ENTITY_REFERENCE_NODE: 5, + ENTITY_NODE: 6, + PROCESSING_INSTRUCTION_NODE: 7, + COMMENT_NODE: 8, + DOCUMENT_NODE: 9, + DOCUMENT_TYPE_NODE: 10, + DOCUMENT_FRAGMENT_NODE: 11, + NOTATION_NODE: 12 + }); +} + +(function() { + var element = this.Element; + this.Element = function(tagName, attributes) { + attributes = attributes || { }; + tagName = tagName.toLowerCase(); + var cache = Element.cache; + if (Prototype.Browser.IE && attributes.name) { + tagName = '<' + tagName + ' name="' + attributes.name + '">'; + delete attributes.name; + return Element.writeAttribute(document.createElement(tagName), attributes); + } + if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName)); + return Element.writeAttribute(cache[tagName].cloneNode(false), attributes); + }; + Object.extend(this.Element, element || { }); +}).call(window); + +Element.cache = { }; + +Element.Methods = { + visible: function(element) { + return $(element).style.display != 'none'; + }, + + toggle: function(element) { + element = $(element); + Element[Element.visible(element) ? 'hide' : 'show'](element); + return element; + }, + + hide: function(element) { + $(element).style.display = 'none'; + return element; + }, + + show: function(element) { + $(element).style.display = ''; + return element; + }, + + remove: function(element) { + element = $(element); + element.parentNode.removeChild(element); + return element; + }, + + update: function(element, content) { + element = $(element); + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) return element.update().insert(content); + content = Object.toHTML(content); + element.innerHTML = content.stripScripts(); + content.evalScripts.bind(content).defer(); + return element; + }, + + replace: function(element, content) { + element = $(element); + if (content && content.toElement) content = content.toElement(); + else if (!Object.isElement(content)) { + content = Object.toHTML(content); + var range = element.ownerDocument.createRange(); + range.selectNode(element); + content.evalScripts.bind(content).defer(); + content = range.createContextualFragment(content.stripScripts()); + } + element.parentNode.replaceChild(content, element); + return element; + }, + + insert: function(element, insertions) { + element = $(element); + + if (Object.isString(insertions) || Object.isNumber(insertions) || + Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML))) + insertions = {bottom:insertions}; + + var content, insert, tagName, childNodes; + + for (var position in insertions) { + content = insertions[position]; + position = position.toLowerCase(); + insert = Element._insertionTranslations[position]; + + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) { + insert(element, content); + continue; + } + + content = Object.toHTML(content); + + tagName = ((position == 'before' || position == 'after') + ? element.parentNode : element).tagName.toUpperCase(); + + childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); + + if (position == 'top' || position == 'after') childNodes.reverse(); + childNodes.each(insert.curry(element)); + + content.evalScripts.bind(content).defer(); + } + + return element; + }, + + wrap: function(element, wrapper, attributes) { + element = $(element); + if (Object.isElement(wrapper)) + $(wrapper).writeAttribute(attributes || { }); + else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes); + else wrapper = new Element('div', wrapper); + if (element.parentNode) + element.parentNode.replaceChild(wrapper, element); + wrapper.appendChild(element); + return wrapper; + }, + + inspect: function(element) { + element = $(element); + var result = '<' + element.tagName.toLowerCase(); + $H({'id': 'id', 'className': 'class'}).each(function(pair) { + var property = pair.first(), attribute = pair.last(); + var value = (element[property] || '').toString(); + if (value) result += ' ' + attribute + '=' + value.inspect(true); + }); + return result + '>'; + }, + + recursivelyCollect: function(element, property) { + element = $(element); + var elements = []; + while (element = element[property]) + if (element.nodeType == 1) + elements.push(Element.extend(element)); + return elements; + }, + + ancestors: function(element) { + return $(element).recursivelyCollect('parentNode'); + }, + + descendants: function(element) { + return $(element).select("*"); + }, + + firstDescendant: function(element) { + element = $(element).firstChild; + while (element && element.nodeType != 1) element = element.nextSibling; + return $(element); + }, + + immediateDescendants: function(element) { + if (!(element = $(element).firstChild)) return []; + while (element && element.nodeType != 1) element = element.nextSibling; + if (element) return [element].concat($(element).nextSiblings()); + return []; + }, + + previousSiblings: function(element) { + return $(element).recursivelyCollect('previousSibling'); + }, + + nextSiblings: function(element) { + return $(element).recursivelyCollect('nextSibling'); + }, + + siblings: function(element) { + element = $(element); + return element.previousSiblings().reverse().concat(element.nextSiblings()); + }, + + match: function(element, selector) { + if (Object.isString(selector)) + selector = new Selector(selector); + return selector.match($(element)); + }, + + up: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return $(element.parentNode); + var ancestors = element.ancestors(); + return Object.isNumber(expression) ? ancestors[expression] : + Selector.findElement(ancestors, expression, index); + }, + + down: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return element.firstDescendant(); + return Object.isNumber(expression) ? element.descendants()[expression] : + element.select(expression)[index || 0]; + }, + + previous: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element)); + var previousSiblings = element.previousSiblings(); + return Object.isNumber(expression) ? previousSiblings[expression] : + Selector.findElement(previousSiblings, expression, index); + }, + + next: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element)); + var nextSiblings = element.nextSiblings(); + return Object.isNumber(expression) ? nextSiblings[expression] : + Selector.findElement(nextSiblings, expression, index); + }, + + select: function() { + var args = $A(arguments), element = $(args.shift()); + return Selector.findChildElements(element, args); + }, + + adjacent: function() { + var args = $A(arguments), element = $(args.shift()); + return Selector.findChildElements(element.parentNode, args).without(element); + }, + + identify: function(element) { + element = $(element); + var id = element.readAttribute('id'), self = arguments.callee; + if (id) return id; + do { id = 'anonymous_element_' + self.counter++ } while ($(id)); + element.writeAttribute('id', id); + return id; + }, + + readAttribute: function(element, name) { + element = $(element); + if (Prototype.Browser.IE) { + var t = Element._attributeTranslations.read; + if (t.values[name]) return t.values[name](element, name); + if (t.names[name]) name = t.names[name]; + if (name.include(':')) { + return (!element.attributes || !element.attributes[name]) ? null : + element.attributes[name].value; + } + } + return element.getAttribute(name); + }, + + writeAttribute: function(element, name, value) { + element = $(element); + var attributes = { }, t = Element._attributeTranslations.write; + + if (typeof name == 'object') attributes = name; + else attributes[name] = Object.isUndefined(value) ? true : value; + + for (var attr in attributes) { + name = t.names[attr] || attr; + value = attributes[attr]; + if (t.values[attr]) name = t.values[attr](element, value); + if (value === false || value === null) + element.removeAttribute(name); + else if (value === true) + element.setAttribute(name, name); + else element.setAttribute(name, value); + } + return element; + }, + + getHeight: function(element) { + return $(element).getDimensions().height; + }, + + getWidth: function(element) { + return $(element).getDimensions().width; + }, + + classNames: function(element) { + return new Element.ClassNames(element); + }, + + hasClassName: function(element, className) { + if (!(element = $(element))) return; + var elementClassName = element.className; + return (elementClassName.length > 0 && (elementClassName == className || + new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); + }, + + addClassName: function(element, className) { + if (!(element = $(element))) return; + if (!element.hasClassName(className)) + element.className += (element.className ? ' ' : '') + className; + return element; + }, + + removeClassName: function(element, className) { + if (!(element = $(element))) return; + element.className = element.className.replace( + new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip(); + return element; + }, + + toggleClassName: function(element, className) { + if (!(element = $(element))) return; + return element[element.hasClassName(className) ? + 'removeClassName' : 'addClassName'](className); + }, + + // removes whitespace-only text node children + cleanWhitespace: function(element) { + element = $(element); + var node = element.firstChild; + while (node) { + var nextNode = node.nextSibling; + if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) + element.removeChild(node); + node = nextNode; + } + return element; + }, + + empty: function(element) { + return $(element).innerHTML.blank(); + }, + + descendantOf: function(element, ancestor) { + element = $(element), ancestor = $(ancestor); + var originalAncestor = ancestor; + + if (element.compareDocumentPosition) + return (element.compareDocumentPosition(ancestor) & 8) === 8; + + if (element.sourceIndex && !Prototype.Browser.Opera) { + var e = element.sourceIndex, a = ancestor.sourceIndex, + nextAncestor = ancestor.nextSibling; + if (!nextAncestor) { + do { ancestor = ancestor.parentNode; } + while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode); + } + if (nextAncestor && nextAncestor.sourceIndex) + return (e > a && e < nextAncestor.sourceIndex); + } + + while (element = element.parentNode) + if (element == originalAncestor) return true; + return false; + }, + + scrollTo: function(element) { + element = $(element); + var pos = element.cumulativeOffset(); + window.scrollTo(pos[0], pos[1]); + return element; + }, + + getStyle: function(element, style) { + element = $(element); + style = style == 'float' ? 'cssFloat' : style.camelize(); + var value = element.style[style]; + if (!value) { + var css = document.defaultView.getComputedStyle(element, null); + value = css ? css[style] : null; + } + if (style == 'opacity') return value ? parseFloat(value) : 1.0; + return value == 'auto' ? null : value; + }, + + getOpacity: function(element) { + return $(element).getStyle('opacity'); + }, + + setStyle: function(element, styles) { + element = $(element); + var elementStyle = element.style, match; + if (Object.isString(styles)) { + element.style.cssText += ';' + styles; + return styles.include('opacity') ? + element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element; + } + for (var property in styles) + if (property == 'opacity') element.setOpacity(styles[property]); + else + elementStyle[(property == 'float' || property == 'cssFloat') ? + (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') : + property] = styles[property]; + + return element; + }, + + setOpacity: function(element, value) { + element = $(element); + element.style.opacity = (value == 1 || value === '') ? '' : + (value < 0.00001) ? 0 : value; + return element; + }, + + getDimensions: function(element) { + element = $(element); + var display = $(element).getStyle('display'); + if (display != 'none' && display != null) // Safari bug + return {width: element.offsetWidth, height: element.offsetHeight}; + + // All *Width and *Height properties give 0 on elements with display none, + // so enable the element temporarily + var els = element.style; + var originalVisibility = els.visibility; + var originalPosition = els.position; + var originalDisplay = els.display; + els.visibility = 'hidden'; + els.position = 'absolute'; + els.display = 'block'; + var originalWidth = element.clientWidth; + var originalHeight = element.clientHeight; + els.display = originalDisplay; + els.position = originalPosition; + els.visibility = originalVisibility; + return {width: originalWidth, height: originalHeight}; + }, + + makePositioned: function(element) { + element = $(element); + var pos = Element.getStyle(element, 'position'); + if (pos == 'static' || !pos) { + element._madePositioned = true; + element.style.position = 'relative'; + // Opera returns the offset relative to the positioning context, when an + // element is position relative but top and left have not been defined + if (window.opera) { + element.style.top = 0; + element.style.left = 0; + } + } + return element; + }, + + undoPositioned: function(element) { + element = $(element); + if (element._madePositioned) { + element._madePositioned = undefined; + element.style.position = + element.style.top = + element.style.left = + element.style.bottom = + element.style.right = ''; + } + return element; + }, + + makeClipping: function(element) { + element = $(element); + if (element._overflow) return element; + element._overflow = Element.getStyle(element, 'overflow') || 'auto'; + if (element._overflow !== 'hidden') + element.style.overflow = 'hidden'; + return element; + }, + + undoClipping: function(element) { + element = $(element); + if (!element._overflow) return element; + element.style.overflow = element._overflow == 'auto' ? '' : element._overflow; + element._overflow = null; + return element; + }, + + cumulativeOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + } while (element); + return Element._returnOffset(valueL, valueT); + }, + + positionedOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + if (element) { + if (element.tagName == 'BODY') break; + var p = Element.getStyle(element, 'position'); + if (p !== 'static') break; + } + } while (element); + return Element._returnOffset(valueL, valueT); + }, + + absolutize: function(element) { + element = $(element); + if (element.getStyle('position') == 'absolute') return; + // Position.prepare(); // To be done manually by Scripty when it needs it. + + var offsets = element.positionedOffset(); + var top = offsets[1]; + var left = offsets[0]; + var width = element.clientWidth; + var height = element.clientHeight; + + element._originalLeft = left - parseFloat(element.style.left || 0); + element._originalTop = top - parseFloat(element.style.top || 0); + element._originalWidth = element.style.width; + element._originalHeight = element.style.height; + + element.style.position = 'absolute'; + element.style.top = top + 'px'; + element.style.left = left + 'px'; + element.style.width = width + 'px'; + element.style.height = height + 'px'; + return element; + }, + + relativize: function(element) { + element = $(element); + if (element.getStyle('position') == 'relative') return; + // Position.prepare(); // To be done manually by Scripty when it needs it. + + element.style.position = 'relative'; + var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); + var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); + + element.style.top = top + 'px'; + element.style.left = left + 'px'; + element.style.height = element._originalHeight; + element.style.width = element._originalWidth; + return element; + }, + + cumulativeScrollOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.scrollTop || 0; + valueL += element.scrollLeft || 0; + element = element.parentNode; + } while (element); + return Element._returnOffset(valueL, valueT); + }, + + getOffsetParent: function(element) { + if (element.offsetParent) return $(element.offsetParent); + if (element == document.body) return $(element); + + while ((element = element.parentNode) && element != document.body) + if (Element.getStyle(element, 'position') != 'static') + return $(element); + + return $(document.body); + }, + + viewportOffset: function(forElement) { + var valueT = 0, valueL = 0; + + var element = forElement; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + + // Safari fix + if (element.offsetParent == document.body && + Element.getStyle(element, 'position') == 'absolute') break; + + } while (element = element.offsetParent); + + element = forElement; + do { + if (!Prototype.Browser.Opera || element.tagName == 'BODY') { + valueT -= element.scrollTop || 0; + valueL -= element.scrollLeft || 0; + } + } while (element = element.parentNode); + + return Element._returnOffset(valueL, valueT); + }, + + clonePosition: function(element, source) { + var options = Object.extend({ + setLeft: true, + setTop: true, + setWidth: true, + setHeight: true, + offsetTop: 0, + offsetLeft: 0 + }, arguments[2] || { }); + + // find page position of source + source = $(source); + var p = source.viewportOffset(); + + // find coordinate system to use + element = $(element); + var delta = [0, 0]; + var parent = null; + // delta [0,0] will do fine with position: fixed elements, + // position:absolute needs offsetParent deltas + if (Element.getStyle(element, 'position') == 'absolute') { + parent = element.getOffsetParent(); + delta = parent.viewportOffset(); + } + + // correct by body offsets (fixes Safari) + if (parent == document.body) { + delta[0] -= document.body.offsetLeft; + delta[1] -= document.body.offsetTop; + } + + // set position + if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; + if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; + if (options.setWidth) element.style.width = source.offsetWidth + 'px'; + if (options.setHeight) element.style.height = source.offsetHeight + 'px'; + return element; + } +}; + +Element.Methods.identify.counter = 1; + +Object.extend(Element.Methods, { + getElementsBySelector: Element.Methods.select, + childElements: Element.Methods.immediateDescendants +}); + +Element._attributeTranslations = { + write: { + names: { + className: 'class', + htmlFor: 'for' + }, + values: { } + } +}; + +if (Prototype.Browser.Opera) { + Element.Methods.getStyle = Element.Methods.getStyle.wrap( + function(proceed, element, style) { + switch (style) { + case 'left': case 'top': case 'right': case 'bottom': + if (proceed(element, 'position') === 'static') return null; + case 'height': case 'width': + // returns '0px' for hidden elements; we want it to return null + if (!Element.visible(element)) return null; + + // returns the border-box dimensions rather than the content-box + // dimensions, so we subtract padding and borders from the value + var dim = parseInt(proceed(element, style), 10); + + if (dim !== element['offset' + style.capitalize()]) + return dim + 'px'; + + var properties; + if (style === 'height') { + properties = ['border-top-width', 'padding-top', + 'padding-bottom', 'border-bottom-width']; + } + else { + properties = ['border-left-width', 'padding-left', + 'padding-right', 'border-right-width']; + } + return properties.inject(dim, function(memo, property) { + var val = proceed(element, property); + return val === null ? memo : memo - parseInt(val, 10); + }) + 'px'; + default: return proceed(element, style); + } + } + ); + + Element.Methods.readAttribute = Element.Methods.readAttribute.wrap( + function(proceed, element, attribute) { + if (attribute === 'title') return element.title; + return proceed(element, attribute); + } + ); +} + +else if (Prototype.Browser.IE) { + // IE doesn't report offsets correctly for static elements, so we change them + // to "relative" to get the values, then change them back. + Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap( + function(proceed, element) { + element = $(element); + var position = element.getStyle('position'); + if (position !== 'static') return proceed(element); + element.setStyle({ position: 'relative' }); + var value = proceed(element); + element.setStyle({ position: position }); + return value; + } + ); + + $w('positionedOffset viewportOffset').each(function(method) { + Element.Methods[method] = Element.Methods[method].wrap( + function(proceed, element) { + element = $(element); + var position = element.getStyle('position'); + if (position !== 'static') return proceed(element); + // Trigger hasLayout on the offset parent so that IE6 reports + // accurate offsetTop and offsetLeft values for position: fixed. + var offsetParent = element.getOffsetParent(); + if (offsetParent && offsetParent.getStyle('position') === 'fixed') + offsetParent.setStyle({ zoom: 1 }); + element.setStyle({ position: 'relative' }); + var value = proceed(element); + element.setStyle({ position: position }); + return value; + } + ); + }); + + Element.Methods.getStyle = function(element, style) { + element = $(element); + style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize(); + var value = element.style[style]; + if (!value && element.currentStyle) value = element.currentStyle[style]; + + if (style == 'opacity') { + if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) + if (value[1]) return parseFloat(value[1]) / 100; + return 1.0; + } + + if (value == 'auto') { + if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none')) + return element['offset' + style.capitalize()] + 'px'; + return null; + } + return value; + }; + + Element.Methods.setOpacity = function(element, value) { + function stripAlpha(filter){ + return filter.replace(/alpha\([^\)]*\)/gi,''); + } + element = $(element); + var currentStyle = element.currentStyle; + if ((currentStyle && !currentStyle.hasLayout) || + (!currentStyle && element.style.zoom == 'normal')) + element.style.zoom = 1; + + var filter = element.getStyle('filter'), style = element.style; + if (value == 1 || value === '') { + (filter = stripAlpha(filter)) ? + style.filter = filter : style.removeAttribute('filter'); + return element; + } else if (value < 0.00001) value = 0; + style.filter = stripAlpha(filter) + + 'alpha(opacity=' + (value * 100) + ')'; + return element; + }; + + Element._attributeTranslations = { + read: { + names: { + 'class': 'className', + 'for': 'htmlFor' + }, + values: { + _getAttr: function(element, attribute) { + return element.getAttribute(attribute, 2); + }, + _getAttrNode: function(element, attribute) { + var node = element.getAttributeNode(attribute); + return node ? node.value : ""; + }, + _getEv: function(element, attribute) { + attribute = element.getAttribute(attribute); + return attribute ? attribute.toString().slice(23, -2) : null; + }, + _flag: function(element, attribute) { + return $(element).hasAttribute(attribute) ? attribute : null; + }, + style: function(element) { + return element.style.cssText.toLowerCase(); + }, + title: function(element) { + return element.title; + } + } + } + }; + + Element._attributeTranslations.write = { + names: Object.extend({ + cellpadding: 'cellPadding', + cellspacing: 'cellSpacing' + }, Element._attributeTranslations.read.names), + values: { + checked: function(element, value) { + element.checked = !!value; + }, + + style: function(element, value) { + element.style.cssText = value ? value : ''; + } + } + }; + + Element._attributeTranslations.has = {}; + + $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' + + 'encType maxLength readOnly longDesc').each(function(attr) { + Element._attributeTranslations.write.names[attr.toLowerCase()] = attr; + Element._attributeTranslations.has[attr.toLowerCase()] = attr; + }); + + (function(v) { + Object.extend(v, { + href: v._getAttr, + src: v._getAttr, + type: v._getAttr, + action: v._getAttrNode, + disabled: v._flag, + checked: v._flag, + readonly: v._flag, + multiple: v._flag, + onload: v._getEv, + onunload: v._getEv, + onclick: v._getEv, + ondblclick: v._getEv, + onmousedown: v._getEv, + onmouseup: v._getEv, + onmouseover: v._getEv, + onmousemove: v._getEv, + onmouseout: v._getEv, + onfocus: v._getEv, + onblur: v._getEv, + onkeypress: v._getEv, + onkeydown: v._getEv, + onkeyup: v._getEv, + onsubmit: v._getEv, + onreset: v._getEv, + onselect: v._getEv, + onchange: v._getEv + }); + })(Element._attributeTranslations.read.values); +} + +else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) { + Element.Methods.setOpacity = function(element, value) { + element = $(element); + element.style.opacity = (value == 1) ? 0.999999 : + (value === '') ? '' : (value < 0.00001) ? 0 : value; + return element; + }; +} + +else if (Prototype.Browser.WebKit) { + Element.Methods.setOpacity = function(element, value) { + element = $(element); + element.style.opacity = (value == 1 || value === '') ? '' : + (value < 0.00001) ? 0 : value; + + if (value == 1) + if(element.tagName == 'IMG' && element.width) { + element.width++; element.width--; + } else try { + var n = document.createTextNode(' '); + element.appendChild(n); + element.removeChild(n); + } catch (e) { } + + return element; + }; + + // Safari returns margins on body which is incorrect if the child is absolutely + // positioned. For performance reasons, redefine Element#cumulativeOffset for + // KHTML/WebKit only. + Element.Methods.cumulativeOffset = function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + if (element.offsetParent == document.body) + if (Element.getStyle(element, 'position') == 'absolute') break; + + element = element.offsetParent; + } while (element); + + return Element._returnOffset(valueL, valueT); + }; +} + +if (Prototype.Browser.IE || Prototype.Browser.Opera) { + // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements + Element.Methods.update = function(element, content) { + element = $(element); + + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) return element.update().insert(content); + + content = Object.toHTML(content); + var tagName = element.tagName.toUpperCase(); + + if (tagName in Element._insertionTranslations.tags) { + $A(element.childNodes).each(function(node) { element.removeChild(node) }); + Element._getContentFromAnonymousElement(tagName, content.stripScripts()) + .each(function(node) { element.appendChild(node) }); + } + else element.innerHTML = content.stripScripts(); + + content.evalScripts.bind(content).defer(); + return element; + }; +} + +if ('outerHTML' in document.createElement('div')) { + Element.Methods.replace = function(element, content) { + element = $(element); + + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) { + element.parentNode.replaceChild(content, element); + return element; + } + + content = Object.toHTML(content); + var parent = element.parentNode, tagName = parent.tagName.toUpperCase(); + + if (Element._insertionTranslations.tags[tagName]) { + var nextSibling = element.next(); + var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); + parent.removeChild(element); + if (nextSibling) + fragments.each(function(node) { parent.insertBefore(node, nextSibling) }); + else + fragments.each(function(node) { parent.appendChild(node) }); + } + else element.outerHTML = content.stripScripts(); + + content.evalScripts.bind(content).defer(); + return element; + }; +} + +Element._returnOffset = function(l, t) { + var result = [l, t]; + result.left = l; + result.top = t; + return result; +}; + +Element._getContentFromAnonymousElement = function(tagName, html) { + var div = new Element('div'), t = Element._insertionTranslations.tags[tagName]; + if (t) { + div.innerHTML = t[0] + html + t[1]; + t[2].times(function() { div = div.firstChild }); + } else div.innerHTML = html; + return $A(div.childNodes); +}; + +Element._insertionTranslations = { + before: function(element, node) { + element.parentNode.insertBefore(node, element); + }, + top: function(element, node) { + element.insertBefore(node, element.firstChild); + }, + bottom: function(element, node) { + element.appendChild(node); + }, + after: function(element, node) { + element.parentNode.insertBefore(node, element.nextSibling); + }, + tags: { + TABLE: ['', '
', 1], + TBODY: ['', '
', 2], + TR: ['', '
', 3], + TD: ['
', '
', 4], + SELECT: ['', 1] + } +}; + +(function() { + Object.extend(this.tags, { + THEAD: this.tags.TBODY, + TFOOT: this.tags.TBODY, + TH: this.tags.TD + }); +}).call(Element._insertionTranslations); + +Element.Methods.Simulated = { + hasAttribute: function(element, attribute) { + attribute = Element._attributeTranslations.has[attribute] || attribute; + var node = $(element).getAttributeNode(attribute); + return node && node.specified; + } +}; + +Element.Methods.ByTag = { }; + +Object.extend(Element, Element.Methods); + +if (!Prototype.BrowserFeatures.ElementExtensions && + document.createElement('div').__proto__) { + window.HTMLElement = { }; + window.HTMLElement.prototype = document.createElement('div').__proto__; + Prototype.BrowserFeatures.ElementExtensions = true; +} + +Element.extend = (function() { + if (Prototype.BrowserFeatures.SpecificElementExtensions) + return Prototype.K; + + var Methods = { }, ByTag = Element.Methods.ByTag; + + var extend = Object.extend(function(element) { + if (!element || element._extendedByPrototype || + element.nodeType != 1 || element == window) return element; + + var methods = Object.clone(Methods), + tagName = element.tagName, property, value; + + // extend methods for specific tags + if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]); + + for (property in methods) { + value = methods[property]; + if (Object.isFunction(value) && !(property in element)) + element[property] = value.methodize(); + } + + element._extendedByPrototype = Prototype.emptyFunction; + return element; + + }, { + refresh: function() { + // extend methods for all tags (Safari doesn't need this) + if (!Prototype.BrowserFeatures.ElementExtensions) { + Object.extend(Methods, Element.Methods); + Object.extend(Methods, Element.Methods.Simulated); + } + } + }); + + extend.refresh(); + return extend; +})(); + +Element.hasAttribute = function(element, attribute) { + if (element.hasAttribute) return element.hasAttribute(attribute); + return Element.Methods.Simulated.hasAttribute(element, attribute); +}; + +Element.addMethods = function(methods) { + var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag; + + if (!methods) { + Object.extend(Form, Form.Methods); + Object.extend(Form.Element, Form.Element.Methods); + Object.extend(Element.Methods.ByTag, { + "FORM": Object.clone(Form.Methods), + "INPUT": Object.clone(Form.Element.Methods), + "SELECT": Object.clone(Form.Element.Methods), + "TEXTAREA": Object.clone(Form.Element.Methods) + }); + } + + if (arguments.length == 2) { + var tagName = methods; + methods = arguments[1]; + } + + if (!tagName) Object.extend(Element.Methods, methods || { }); + else { + if (Object.isArray(tagName)) tagName.each(extend); + else extend(tagName); + } + + function extend(tagName) { + tagName = tagName.toUpperCase(); + if (!Element.Methods.ByTag[tagName]) + Element.Methods.ByTag[tagName] = { }; + Object.extend(Element.Methods.ByTag[tagName], methods); + } + + function copy(methods, destination, onlyIfAbsent) { + onlyIfAbsent = onlyIfAbsent || false; + for (var property in methods) { + var value = methods[property]; + if (!Object.isFunction(value)) continue; + if (!onlyIfAbsent || !(property in destination)) + destination[property] = value.methodize(); + } + } + + function findDOMClass(tagName) { + var klass; + var trans = { + "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph", + "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList", + "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading", + "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote", + "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION": + "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD": + "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR": + "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET": + "FrameSet", "IFRAME": "IFrame" + }; + if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element'; + if (window[klass]) return window[klass]; + klass = 'HTML' + tagName + 'Element'; + if (window[klass]) return window[klass]; + klass = 'HTML' + tagName.capitalize() + 'Element'; + if (window[klass]) return window[klass]; + + window[klass] = { }; + window[klass].prototype = document.createElement(tagName).__proto__; + return window[klass]; + } + + if (F.ElementExtensions) { + copy(Element.Methods, HTMLElement.prototype); + copy(Element.Methods.Simulated, HTMLElement.prototype, true); + } + + if (F.SpecificElementExtensions) { + for (var tag in Element.Methods.ByTag) { + var klass = findDOMClass(tag); + if (Object.isUndefined(klass)) continue; + copy(T[tag], klass.prototype); + } + } + + Object.extend(Element, Element.Methods); + delete Element.ByTag; + + if (Element.extend.refresh) Element.extend.refresh(); + Element.cache = { }; +}; + +document.viewport = { + getDimensions: function() { + var dimensions = { }; + var B = Prototype.Browser; + $w('width height').each(function(d) { + var D = d.capitalize(); + dimensions[d] = (B.WebKit && !document.evaluate) ? self['inner' + D] : + (B.Opera) ? document.body['client' + D] : document.documentElement['client' + D]; + }); + return dimensions; + }, + + getWidth: function() { + return this.getDimensions().width; + }, + + getHeight: function() { + return this.getDimensions().height; + }, + + getScrollOffsets: function() { + return Element._returnOffset( + window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft, + window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop); + } +}; +/* Portions of the Selector class are derived from Jack Slocum’s DomQuery, + * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style + * license. Please see http://www.yui-ext.com/ for more information. */ + +var Selector = Class.create({ + initialize: function(expression) { + this.expression = expression.strip(); + this.compileMatcher(); + }, + + shouldUseXPath: function() { + if (!Prototype.BrowserFeatures.XPath) return false; + + var e = this.expression; + + // Safari 3 chokes on :*-of-type and :empty + if (Prototype.Browser.WebKit && + (e.include("-of-type") || e.include(":empty"))) + return false; + + // XPath can't do namespaced attributes, nor can it read + // the "checked" property from DOM nodes + if ((/(\[[\w-]*?:|:checked)/).test(this.expression)) + return false; + + return true; + }, + + compileMatcher: function() { + if (this.shouldUseXPath()) + return this.compileXPathMatcher(); + + var e = this.expression, ps = Selector.patterns, h = Selector.handlers, + c = Selector.criteria, le, p, m; + + if (Selector._cache[e]) { + this.matcher = Selector._cache[e]; + return; + } + + this.matcher = ["this.matcher = function(root) {", + "var r = root, h = Selector.handlers, c = false, n;"]; + + while (e && le != e && (/\S/).test(e)) { + le = e; + for (var i in ps) { + p = ps[i]; + if (m = e.match(p)) { + this.matcher.push(Object.isFunction(c[i]) ? c[i](m) : + new Template(c[i]).evaluate(m)); + e = e.replace(m[0], ''); + break; + } + } + } + + this.matcher.push("return h.unique(n);\n}"); + eval(this.matcher.join('\n')); + Selector._cache[this.expression] = this.matcher; + }, + + compileXPathMatcher: function() { + var e = this.expression, ps = Selector.patterns, + x = Selector.xpath, le, m; + + if (Selector._cache[e]) { + this.xpath = Selector._cache[e]; return; + } + + this.matcher = ['.//*']; + while (e && le != e && (/\S/).test(e)) { + le = e; + for (var i in ps) { + if (m = e.match(ps[i])) { + this.matcher.push(Object.isFunction(x[i]) ? x[i](m) : + new Template(x[i]).evaluate(m)); + e = e.replace(m[0], ''); + break; + } + } + } + + this.xpath = this.matcher.join(''); + Selector._cache[this.expression] = this.xpath; + }, + + findElements: function(root) { + root = root || document; + if (this.xpath) return document._getElementsByXPath(this.xpath, root); + return this.matcher(root); + }, + + match: function(element) { + this.tokens = []; + + var e = this.expression, ps = Selector.patterns, as = Selector.assertions; + var le, p, m; + + while (e && le !== e && (/\S/).test(e)) { + le = e; + for (var i in ps) { + p = ps[i]; + if (m = e.match(p)) { + // use the Selector.assertions methods unless the selector + // is too complex. + if (as[i]) { + this.tokens.push([i, Object.clone(m)]); + e = e.replace(m[0], ''); + } else { + // reluctantly do a document-wide search + // and look for a match in the array + return this.findElements(document).include(element); + } + } + } + } + + var match = true, name, matches; + for (var i = 0, token; token = this.tokens[i]; i++) { + name = token[0], matches = token[1]; + if (!Selector.assertions[name](element, matches)) { + match = false; break; + } + } + + return match; + }, + + toString: function() { + return this.expression; + }, + + inspect: function() { + return "#"; + } +}); + +Object.extend(Selector, { + _cache: { }, + + xpath: { + descendant: "//*", + child: "/*", + adjacent: "/following-sibling::*[1]", + laterSibling: '/following-sibling::*', + tagName: function(m) { + if (m[1] == '*') return ''; + return "[local-name()='" + m[1].toLowerCase() + + "' or local-name()='" + m[1].toUpperCase() + "']"; + }, + className: "[contains(concat(' ', @class, ' '), ' #{1} ')]", + id: "[@id='#{1}']", + attrPresence: function(m) { + m[1] = m[1].toLowerCase(); + return new Template("[@#{1}]").evaluate(m); + }, + attr: function(m) { + m[1] = m[1].toLowerCase(); + m[3] = m[5] || m[6]; + return new Template(Selector.xpath.operators[m[2]]).evaluate(m); + }, + pseudo: function(m) { + var h = Selector.xpath.pseudos[m[1]]; + if (!h) return ''; + if (Object.isFunction(h)) return h(m); + return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m); + }, + operators: { + '=': "[@#{1}='#{3}']", + '!=': "[@#{1}!='#{3}']", + '^=': "[starts-with(@#{1}, '#{3}')]", + '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']", + '*=': "[contains(@#{1}, '#{3}')]", + '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]", + '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]" + }, + pseudos: { + 'first-child': '[not(preceding-sibling::*)]', + 'last-child': '[not(following-sibling::*)]', + 'only-child': '[not(preceding-sibling::* or following-sibling::*)]', + 'empty': "[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]", + 'checked': "[@checked]", + 'disabled': "[@disabled]", + 'enabled': "[not(@disabled)]", + 'not': function(m) { + var e = m[6], p = Selector.patterns, + x = Selector.xpath, le, v; + + var exclusion = []; + while (e && le != e && (/\S/).test(e)) { + le = e; + for (var i in p) { + if (m = e.match(p[i])) { + v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m); + exclusion.push("(" + v.substring(1, v.length - 1) + ")"); + e = e.replace(m[0], ''); + break; + } + } + } + return "[not(" + exclusion.join(" and ") + ")]"; + }, + 'nth-child': function(m) { + return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m); + }, + 'nth-last-child': function(m) { + return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m); + }, + 'nth-of-type': function(m) { + return Selector.xpath.pseudos.nth("position() ", m); + }, + 'nth-last-of-type': function(m) { + return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m); + }, + 'first-of-type': function(m) { + m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m); + }, + 'last-of-type': function(m) { + m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m); + }, + 'only-of-type': function(m) { + var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m); + }, + nth: function(fragment, m) { + var mm, formula = m[6], predicate; + if (formula == 'even') formula = '2n+0'; + if (formula == 'odd') formula = '2n+1'; + if (mm = formula.match(/^(\d+)$/)) // digit only + return '[' + fragment + "= " + mm[1] + ']'; + if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b + if (mm[1] == "-") mm[1] = -1; + var a = mm[1] ? Number(mm[1]) : 1; + var b = mm[2] ? Number(mm[2]) : 0; + predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " + + "((#{fragment} - #{b}) div #{a} >= 0)]"; + return new Template(predicate).evaluate({ + fragment: fragment, a: a, b: b }); + } + } + } + }, + + criteria: { + tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;', + className: 'n = h.className(n, r, "#{1}", c); c = false;', + id: 'n = h.id(n, r, "#{1}", c); c = false;', + attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;', + attr: function(m) { + m[3] = (m[5] || m[6]); + return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m); + }, + pseudo: function(m) { + if (m[6]) m[6] = m[6].replace(/"/g, '\\"'); + return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m); + }, + descendant: 'c = "descendant";', + child: 'c = "child";', + adjacent: 'c = "adjacent";', + laterSibling: 'c = "laterSibling";' + }, + + patterns: { + // combinators must be listed first + // (and descendant needs to be last combinator) + laterSibling: /^\s*~\s*/, + child: /^\s*>\s*/, + adjacent: /^\s*\+\s*/, + descendant: /^\s/, + + // selectors follow + tagName: /^\s*(\*|[\w\-]+)(\b|$)?/, + id: /^#([\w\-\*]+)(\b|$)/, + className: /^\.([\w\-\*]+)(\b|$)/, + pseudo: +/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/, + attrPresence: /^\[([\w]+)\]/, + attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/ + }, + + // for Selector.match and Element#match + assertions: { + tagName: function(element, matches) { + return matches[1].toUpperCase() == element.tagName.toUpperCase(); + }, + + className: function(element, matches) { + return Element.hasClassName(element, matches[1]); + }, + + id: function(element, matches) { + return element.id === matches[1]; + }, + + attrPresence: function(element, matches) { + return Element.hasAttribute(element, matches[1]); + }, + + attr: function(element, matches) { + var nodeValue = Element.readAttribute(element, matches[1]); + return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]); + } + }, + + handlers: { + // UTILITY FUNCTIONS + // joins two collections + concat: function(a, b) { + for (var i = 0, node; node = b[i]; i++) + a.push(node); + return a; + }, + + // marks an array of nodes for counting + mark: function(nodes) { + var _true = Prototype.emptyFunction; + for (var i = 0, node; node = nodes[i]; i++) + node._countedByPrototype = _true; + return nodes; + }, + + unmark: function(nodes) { + for (var i = 0, node; node = nodes[i]; i++) + node._countedByPrototype = undefined; + return nodes; + }, + + // mark each child node with its position (for nth calls) + // "ofType" flag indicates whether we're indexing for nth-of-type + // rather than nth-child + index: function(parentNode, reverse, ofType) { + parentNode._countedByPrototype = Prototype.emptyFunction; + if (reverse) { + for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) { + var node = nodes[i]; + if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++; + } + } else { + for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++) + if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++; + } + }, + + // filters out duplicates and extends all nodes + unique: function(nodes) { + if (nodes.length == 0) return nodes; + var results = [], n; + for (var i = 0, l = nodes.length; i < l; i++) + if (!(n = nodes[i])._countedByPrototype) { + n._countedByPrototype = Prototype.emptyFunction; + results.push(Element.extend(n)); + } + return Selector.handlers.unmark(results); + }, + + // COMBINATOR FUNCTIONS + descendant: function(nodes) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) + h.concat(results, node.getElementsByTagName('*')); + return results; + }, + + child: function(nodes) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) { + for (var j = 0, child; child = node.childNodes[j]; j++) + if (child.nodeType == 1 && child.tagName != '!') results.push(child); + } + return results; + }, + + adjacent: function(nodes) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + var next = this.nextElementSibling(node); + if (next) results.push(next); + } + return results; + }, + + laterSibling: function(nodes) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) + h.concat(results, Element.nextSiblings(node)); + return results; + }, + + nextElementSibling: function(node) { + while (node = node.nextSibling) + if (node.nodeType == 1) return node; + return null; + }, + + previousElementSibling: function(node) { + while (node = node.previousSibling) + if (node.nodeType == 1) return node; + return null; + }, + + // TOKEN FUNCTIONS + tagName: function(nodes, root, tagName, combinator) { + var uTagName = tagName.toUpperCase(); + var results = [], h = Selector.handlers; + if (nodes) { + if (combinator) { + // fastlane for ordinary descendant combinators + if (combinator == "descendant") { + for (var i = 0, node; node = nodes[i]; i++) + h.concat(results, node.getElementsByTagName(tagName)); + return results; + } else nodes = this[combinator](nodes); + if (tagName == "*") return nodes; + } + for (var i = 0, node; node = nodes[i]; i++) + if (node.tagName.toUpperCase() === uTagName) results.push(node); + return results; + } else return root.getElementsByTagName(tagName); + }, + + id: function(nodes, root, id, combinator) { + var targetNode = $(id), h = Selector.handlers; + if (!targetNode) return []; + if (!nodes && root == document) return [targetNode]; + if (nodes) { + if (combinator) { + if (combinator == 'child') { + for (var i = 0, node; node = nodes[i]; i++) + if (targetNode.parentNode == node) return [targetNode]; + } else if (combinator == 'descendant') { + for (var i = 0, node; node = nodes[i]; i++) + if (Element.descendantOf(targetNode, node)) return [targetNode]; + } else if (combinator == 'adjacent') { + for (var i = 0, node; node = nodes[i]; i++) + if (Selector.handlers.previousElementSibling(targetNode) == node) + return [targetNode]; + } else nodes = h[combinator](nodes); + } + for (var i = 0, node; node = nodes[i]; i++) + if (node == targetNode) return [targetNode]; + return []; + } + return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : []; + }, + + className: function(nodes, root, className, combinator) { + if (nodes && combinator) nodes = this[combinator](nodes); + return Selector.handlers.byClassName(nodes, root, className); + }, + + byClassName: function(nodes, root, className) { + if (!nodes) nodes = Selector.handlers.descendant([root]); + var needle = ' ' + className + ' '; + for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) { + nodeClassName = node.className; + if (nodeClassName.length == 0) continue; + if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle)) + results.push(node); + } + return results; + }, + + attrPresence: function(nodes, root, attr, combinator) { + if (!nodes) nodes = root.getElementsByTagName("*"); + if (nodes && combinator) nodes = this[combinator](nodes); + var results = []; + for (var i = 0, node; node = nodes[i]; i++) + if (Element.hasAttribute(node, attr)) results.push(node); + return results; + }, + + attr: function(nodes, root, attr, value, operator, combinator) { + if (!nodes) nodes = root.getElementsByTagName("*"); + if (nodes && combinator) nodes = this[combinator](nodes); + var handler = Selector.operators[operator], results = []; + for (var i = 0, node; node = nodes[i]; i++) { + var nodeValue = Element.readAttribute(node, attr); + if (nodeValue === null) continue; + if (handler(nodeValue, value)) results.push(node); + } + return results; + }, + + pseudo: function(nodes, name, value, root, combinator) { + if (nodes && combinator) nodes = this[combinator](nodes); + if (!nodes) nodes = root.getElementsByTagName("*"); + return Selector.pseudos[name](nodes, value, root); + } + }, + + pseudos: { + 'first-child': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + if (Selector.handlers.previousElementSibling(node)) continue; + results.push(node); + } + return results; + }, + 'last-child': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + if (Selector.handlers.nextElementSibling(node)) continue; + results.push(node); + } + return results; + }, + 'only-child': function(nodes, value, root) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (!h.previousElementSibling(node) && !h.nextElementSibling(node)) + results.push(node); + return results; + }, + 'nth-child': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root); + }, + 'nth-last-child': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root, true); + }, + 'nth-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root, false, true); + }, + 'nth-last-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root, true, true); + }, + 'first-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, "1", root, false, true); + }, + 'last-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, "1", root, true, true); + }, + 'only-of-type': function(nodes, formula, root) { + var p = Selector.pseudos; + return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root); + }, + + // handles the an+b logic + getIndices: function(a, b, total) { + if (a == 0) return b > 0 ? [b] : []; + return $R(1, total).inject([], function(memo, i) { + if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i); + return memo; + }); + }, + + // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type + nth: function(nodes, formula, root, reverse, ofType) { + if (nodes.length == 0) return []; + if (formula == 'even') formula = '2n+0'; + if (formula == 'odd') formula = '2n+1'; + var h = Selector.handlers, results = [], indexed = [], m; + h.mark(nodes); + for (var i = 0, node; node = nodes[i]; i++) { + if (!node.parentNode._countedByPrototype) { + h.index(node.parentNode, reverse, ofType); + indexed.push(node.parentNode); + } + } + if (formula.match(/^\d+$/)) { // just a number + formula = Number(formula); + for (var i = 0, node; node = nodes[i]; i++) + if (node.nodeIndex == formula) results.push(node); + } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b + if (m[1] == "-") m[1] = -1; + var a = m[1] ? Number(m[1]) : 1; + var b = m[2] ? Number(m[2]) : 0; + var indices = Selector.pseudos.getIndices(a, b, nodes.length); + for (var i = 0, node, l = indices.length; node = nodes[i]; i++) { + for (var j = 0; j < l; j++) + if (node.nodeIndex == indices[j]) results.push(node); + } + } + h.unmark(nodes); + h.unmark(indexed); + return results; + }, + + 'empty': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + // IE treats comments as element nodes + if (node.tagName == '!' || (node.firstChild && !node.innerHTML.match(/^\s*$/))) continue; + results.push(node); + } + return results; + }, + + 'not': function(nodes, selector, root) { + var h = Selector.handlers, selectorType, m; + var exclusions = new Selector(selector).findElements(root); + h.mark(exclusions); + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (!node._countedByPrototype) results.push(node); + h.unmark(exclusions); + return results; + }, + + 'enabled': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (!node.disabled) results.push(node); + return results; + }, + + 'disabled': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (node.disabled) results.push(node); + return results; + }, + + 'checked': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (node.checked) results.push(node); + return results; + } + }, + + operators: { + '=': function(nv, v) { return nv == v; }, + '!=': function(nv, v) { return nv != v; }, + '^=': function(nv, v) { return nv.startsWith(v); }, + '$=': function(nv, v) { return nv.endsWith(v); }, + '*=': function(nv, v) { return nv.include(v); }, + '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); }, + '|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); } + }, + + split: function(expression) { + var expressions = []; + expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) { + expressions.push(m[1].strip()); + }); + return expressions; + }, + + matchElements: function(elements, expression) { + var matches = $$(expression), h = Selector.handlers; + h.mark(matches); + for (var i = 0, results = [], element; element = elements[i]; i++) + if (element._countedByPrototype) results.push(element); + h.unmark(matches); + return results; + }, + + findElement: function(elements, expression, index) { + if (Object.isNumber(expression)) { + index = expression; expression = false; + } + return Selector.matchElements(elements, expression || '*')[index || 0]; + }, + + findChildElements: function(element, expressions) { + expressions = Selector.split(expressions.join(',')); + var results = [], h = Selector.handlers; + for (var i = 0, l = expressions.length, selector; i < l; i++) { + selector = new Selector(expressions[i].strip()); + h.concat(results, selector.findElements(element)); + } + return (l > 1) ? h.unique(results) : results; + } +}); + +if (Prototype.Browser.IE) { + Object.extend(Selector.handlers, { + // IE returns comment nodes on getElementsByTagName("*"). + // Filter them out. + concat: function(a, b) { + for (var i = 0, node; node = b[i]; i++) + if (node.tagName !== "!") a.push(node); + return a; + }, + + // IE improperly serializes _countedByPrototype in (inner|outer)HTML. + unmark: function(nodes) { + for (var i = 0, node; node = nodes[i]; i++) + node.removeAttribute('_countedByPrototype'); + return nodes; + } + }); +} + +function $$() { + return Selector.findChildElements(document, $A(arguments)); +} +var Form = { + reset: function(form) { + $(form).reset(); + return form; + }, + + serializeElements: function(elements, options) { + if (typeof options != 'object') options = { hash: !!options }; + else if (Object.isUndefined(options.hash)) options.hash = true; + var key, value, submitted = false, submit = options.submit; + + var data = elements.inject({ }, function(result, element) { + if (!element.disabled && element.name) { + key = element.name; value = $(element).getValue(); + if (value != null && (element.type != 'submit' || (!submitted && + submit !== false && (!submit || key == submit) && (submitted = true)))) { + if (key in result) { + // a key is already present; construct an array of values + if (!Object.isArray(result[key])) result[key] = [result[key]]; + result[key].push(value); + } + else result[key] = value; + } + } + return result; + }); + + return options.hash ? data : Object.toQueryString(data); + } +}; + +Form.Methods = { + serialize: function(form, options) { + return Form.serializeElements(Form.getElements(form), options); + }, + + getElements: function(form) { + return $A($(form).getElementsByTagName('*')).inject([], + function(elements, child) { + if (Form.Element.Serializers[child.tagName.toLowerCase()]) + elements.push(Element.extend(child)); + return elements; + } + ); + }, + + getInputs: function(form, typeName, name) { + form = $(form); + var inputs = form.getElementsByTagName('input'); + + if (!typeName && !name) return $A(inputs).map(Element.extend); + + for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) { + var input = inputs[i]; + if ((typeName && input.type != typeName) || (name && input.name != name)) + continue; + matchingInputs.push(Element.extend(input)); + } + + return matchingInputs; + }, + + disable: function(form) { + form = $(form); + Form.getElements(form).invoke('disable'); + return form; + }, + + enable: function(form) { + form = $(form); + Form.getElements(form).invoke('enable'); + return form; + }, + + findFirstElement: function(form) { + var elements = $(form).getElements().findAll(function(element) { + return 'hidden' != element.type && !element.disabled; + }); + var firstByIndex = elements.findAll(function(element) { + return element.hasAttribute('tabIndex') && element.tabIndex >= 0; + }).sortBy(function(element) { return element.tabIndex }).first(); + + return firstByIndex ? firstByIndex : elements.find(function(element) { + return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase()); + }); + }, + + focusFirstElement: function(form) { + form = $(form); + form.findFirstElement().activate(); + return form; + }, + + request: function(form, options) { + form = $(form), options = Object.clone(options || { }); + + var params = options.parameters, action = form.readAttribute('action') || ''; + if (action.blank()) action = window.location.href; + options.parameters = form.serialize(true); + + if (params) { + if (Object.isString(params)) params = params.toQueryParams(); + Object.extend(options.parameters, params); + } + + if (form.hasAttribute('method') && !options.method) + options.method = form.method; + + return new Ajax.Request(action, options); + } +}; + +/*--------------------------------------------------------------------------*/ + +Form.Element = { + focus: function(element) { + $(element).focus(); + return element; + }, + + select: function(element) { + $(element).select(); + return element; + } +}; + +Form.Element.Methods = { + serialize: function(element) { + element = $(element); + if (!element.disabled && element.name) { + var value = element.getValue(); + if (value != undefined) { + var pair = { }; + pair[element.name] = value; + return Object.toQueryString(pair); + } + } + return ''; + }, + + getValue: function(element) { + element = $(element); + var method = element.tagName.toLowerCase(); + return Form.Element.Serializers[method](element); + }, + + setValue: function(element, value) { + element = $(element); + var method = element.tagName.toLowerCase(); + Form.Element.Serializers[method](element, value); + return element; + }, + + clear: function(element) { + $(element).value = ''; + return element; + }, + + present: function(element) { + return $(element).value != ''; + }, + + activate: function(element) { + element = $(element); + try { + element.focus(); + if (element.select && (element.tagName.toLowerCase() != 'input' || + !['button', 'reset', 'submit'].include(element.type))) + element.select(); + } catch (e) { } + return element; + }, + + disable: function(element) { + element = $(element); + element.blur(); + element.disabled = true; + return element; + }, + + enable: function(element) { + element = $(element); + element.disabled = false; + return element; + } +}; + +/*--------------------------------------------------------------------------*/ + +var Field = Form.Element; +var $F = Form.Element.Methods.getValue; + +/*--------------------------------------------------------------------------*/ + +Form.Element.Serializers = { + input: function(element, value) { + switch (element.type.toLowerCase()) { + case 'checkbox': + case 'radio': + return Form.Element.Serializers.inputSelector(element, value); + default: + return Form.Element.Serializers.textarea(element, value); + } + }, + + inputSelector: function(element, value) { + if (Object.isUndefined(value)) return element.checked ? element.value : null; + else element.checked = !!value; + }, + + textarea: function(element, value) { + if (Object.isUndefined(value)) return element.value; + else element.value = value; + }, + + select: function(element, index) { + if (Object.isUndefined(index)) + return this[element.type == 'select-one' ? + 'selectOne' : 'selectMany'](element); + else { + var opt, value, single = !Object.isArray(index); + for (var i = 0, length = element.length; i < length; i++) { + opt = element.options[i]; + value = this.optionValue(opt); + if (single) { + if (value == index) { + opt.selected = true; + return; + } + } + else opt.selected = index.include(value); + } + } + }, + + selectOne: function(element) { + var index = element.selectedIndex; + return index >= 0 ? this.optionValue(element.options[index]) : null; + }, + + selectMany: function(element) { + var values, length = element.length; + if (!length) return null; + + for (var i = 0, values = []; i < length; i++) { + var opt = element.options[i]; + if (opt.selected) values.push(this.optionValue(opt)); + } + return values; + }, + + optionValue: function(opt) { + // extend element because hasAttribute may not be native + return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text; + } +}; + +/*--------------------------------------------------------------------------*/ + +Abstract.TimedObserver = Class.create(PeriodicalExecuter, { + initialize: function($super, element, frequency, callback) { + $super(callback, frequency); + this.element = $(element); + this.lastValue = this.getValue(); + }, + + execute: function() { + var value = this.getValue(); + if (Object.isString(this.lastValue) && Object.isString(value) ? + this.lastValue != value : String(this.lastValue) != String(value)) { + this.callback(this.element, value); + this.lastValue = value; + } + } +}); + +Form.Element.Observer = Class.create(Abstract.TimedObserver, { + getValue: function() { + return Form.Element.getValue(this.element); + } +}); + +Form.Observer = Class.create(Abstract.TimedObserver, { + getValue: function() { + return Form.serialize(this.element); + } +}); + +/*--------------------------------------------------------------------------*/ + +Abstract.EventObserver = Class.create({ + initialize: function(element, callback) { + this.element = $(element); + this.callback = callback; + + this.lastValue = this.getValue(); + if (this.element.tagName.toLowerCase() == 'form') + this.registerFormCallbacks(); + else + this.registerCallback(this.element); + }, + + onElementEvent: function() { + var value = this.getValue(); + if (this.lastValue != value) { + this.callback(this.element, value); + this.lastValue = value; + } + }, + + registerFormCallbacks: function() { + Form.getElements(this.element).each(this.registerCallback, this); + }, + + registerCallback: function(element) { + if (element.type) { + switch (element.type.toLowerCase()) { + case 'checkbox': + case 'radio': + Event.observe(element, 'click', this.onElementEvent.bind(this)); + break; + default: + Event.observe(element, 'change', this.onElementEvent.bind(this)); + break; + } + } + } +}); + +Form.Element.EventObserver = Class.create(Abstract.EventObserver, { + getValue: function() { + return Form.Element.getValue(this.element); + } +}); + +Form.EventObserver = Class.create(Abstract.EventObserver, { + getValue: function() { + return Form.serialize(this.element); + } +}); +if (!window.Event) var Event = { }; + +Object.extend(Event, { + KEY_BACKSPACE: 8, + KEY_TAB: 9, + KEY_RETURN: 13, + KEY_ESC: 27, + KEY_LEFT: 37, + KEY_UP: 38, + KEY_RIGHT: 39, + KEY_DOWN: 40, + KEY_DELETE: 46, + KEY_HOME: 36, + KEY_END: 35, + KEY_PAGEUP: 33, + KEY_PAGEDOWN: 34, + KEY_INSERT: 45, + + cache: { }, + + relatedTarget: function(event) { + var element; + switch(event.type) { + case 'mouseover': element = event.fromElement; break; + case 'mouseout': element = event.toElement; break; + default: return null; + } + return Element.extend(element); + } +}); + +Event.Methods = (function() { + var isButton; + + if (Prototype.Browser.IE) { + var buttonMap = { 0: 1, 1: 4, 2: 2 }; + isButton = function(event, code) { + return event.button == buttonMap[code]; + }; + + } else if (Prototype.Browser.WebKit) { + isButton = function(event, code) { + switch (code) { + case 0: return event.which == 1 && !event.metaKey; + case 1: return event.which == 1 && event.metaKey; + default: return false; + } + }; + + } else { + isButton = function(event, code) { + return event.which ? (event.which === code + 1) : (event.button === code); + }; + } + + return { + isLeftClick: function(event) { return isButton(event, 0) }, + isMiddleClick: function(event) { return isButton(event, 1) }, + isRightClick: function(event) { return isButton(event, 2) }, + + element: function(event) { + var node = Event.extend(event).target; + return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node); + }, + + findElement: function(event, expression) { + var element = Event.element(event); + if (!expression) return element; + var elements = [element].concat(element.ancestors()); + return Selector.findElement(elements, expression, 0); + }, + + pointer: function(event) { + return { + x: event.pageX || (event.clientX + + (document.documentElement.scrollLeft || document.body.scrollLeft)), + y: event.pageY || (event.clientY + + (document.documentElement.scrollTop || document.body.scrollTop)) + }; + }, + + pointerX: function(event) { return Event.pointer(event).x }, + pointerY: function(event) { return Event.pointer(event).y }, + + stop: function(event) { + Event.extend(event); + event.preventDefault(); + event.stopPropagation(); + event.stopped = true; + } + }; +})(); + +Event.extend = (function() { + var methods = Object.keys(Event.Methods).inject({ }, function(m, name) { + m[name] = Event.Methods[name].methodize(); + return m; + }); + + if (Prototype.Browser.IE) { + Object.extend(methods, { + stopPropagation: function() { this.cancelBubble = true }, + preventDefault: function() { this.returnValue = false }, + inspect: function() { return "[object Event]" } + }); + + return function(event) { + if (!event) return false; + if (event._extendedByPrototype) return event; + + event._extendedByPrototype = Prototype.emptyFunction; + var pointer = Event.pointer(event); + Object.extend(event, { + target: event.srcElement, + relatedTarget: Event.relatedTarget(event), + pageX: pointer.x, + pageY: pointer.y + }); + return Object.extend(event, methods); + }; + + } else { + Event.prototype = Event.prototype || document.createEvent("HTMLEvents").__proto__; + Object.extend(Event.prototype, methods); + return Prototype.K; + } +})(); + +Object.extend(Event, (function() { + var cache = Event.cache; + + function getEventID(element) { + if (element._prototypeEventID) return element._prototypeEventID[0]; + arguments.callee.id = arguments.callee.id || 1; + return element._prototypeEventID = [++arguments.callee.id]; + } + + function getDOMEventName(eventName) { + if (eventName && eventName.include(':')) return "dataavailable"; + return eventName; + } + + function getCacheForID(id) { + return cache[id] = cache[id] || { }; + } + + function getWrappersForEventName(id, eventName) { + var c = getCacheForID(id); + return c[eventName] = c[eventName] || []; + } + + function createWrapper(element, eventName, handler) { + var id = getEventID(element); + var c = getWrappersForEventName(id, eventName); + if (c.pluck("handler").include(handler)) return false; + + var wrapper = function(event) { + if (!Event || !Event.extend || + (event.eventName && event.eventName != eventName)) + return false; + + Event.extend(event); + handler.call(element, event); + }; + + wrapper.handler = handler; + c.push(wrapper); + return wrapper; + } + + function findWrapper(id, eventName, handler) { + var c = getWrappersForEventName(id, eventName); + return c.find(function(wrapper) { return wrapper.handler == handler }); + } + + function destroyWrapper(id, eventName, handler) { + var c = getCacheForID(id); + if (!c[eventName]) return false; + c[eventName] = c[eventName].without(findWrapper(id, eventName, handler)); + } + + function destroyCache() { + for (var id in cache) + for (var eventName in cache[id]) + cache[id][eventName] = null; + } + + if (window.attachEvent) { + window.attachEvent("onunload", destroyCache); + } + + return { + observe: function(element, eventName, handler) { + element = $(element); + var name = getDOMEventName(eventName); + + var wrapper = createWrapper(element, eventName, handler); + if (!wrapper) return element; + + if (element.addEventListener) { + element.addEventListener(name, wrapper, false); + } else { + element.attachEvent("on" + name, wrapper); + } + + return element; + }, + + stopObserving: function(element, eventName, handler) { + element = $(element); + var id = getEventID(element), name = getDOMEventName(eventName); + + if (!handler && eventName) { + getWrappersForEventName(id, eventName).each(function(wrapper) { + element.stopObserving(eventName, wrapper.handler); + }); + return element; + + } else if (!eventName) { + Object.keys(getCacheForID(id)).each(function(eventName) { + element.stopObserving(eventName); + }); + return element; + } + + var wrapper = findWrapper(id, eventName, handler); + if (!wrapper) return element; + + if (element.removeEventListener) { + element.removeEventListener(name, wrapper, false); + } else { + element.detachEvent("on" + name, wrapper); + } + + destroyWrapper(id, eventName, handler); + + return element; + }, + + fire: function(element, eventName, memo) { + element = $(element); + if (element == document && document.createEvent && !element.dispatchEvent) + element = document.documentElement; + + var event; + if (document.createEvent) { + event = document.createEvent("HTMLEvents"); + event.initEvent("dataavailable", true, true); + } else { + event = document.createEventObject(); + event.eventType = "ondataavailable"; + } + + event.eventName = eventName; + event.memo = memo || { }; + + if (document.createEvent) { + element.dispatchEvent(event); + } else { + element.fireEvent(event.eventType, event); + } + + return Event.extend(event); + } + }; +})()); + +Object.extend(Event, Event.Methods); + +Element.addMethods({ + fire: Event.fire, + observe: Event.observe, + stopObserving: Event.stopObserving +}); + +Object.extend(document, { + fire: Element.Methods.fire.methodize(), + observe: Element.Methods.observe.methodize(), + stopObserving: Element.Methods.stopObserving.methodize(), + loaded: false +}); + +(function() { + /* Support for the DOMContentLoaded event is based on work by Dan Webb, + Matthias Miller, Dean Edwards and John Resig. */ + + var timer; + + function fireContentLoadedEvent() { + if (document.loaded) return; + if (timer) window.clearInterval(timer); + document.fire("dom:loaded"); + document.loaded = true; + } + + if (document.addEventListener) { + if (Prototype.Browser.WebKit) { + timer = window.setInterval(function() { + if (/loaded|complete/.test(document.readyState)) + fireContentLoadedEvent(); + }, 0); + + Event.observe(window, "load", fireContentLoadedEvent); + + } else { + document.addEventListener("DOMContentLoaded", + fireContentLoadedEvent, false); + } + + } else { + document.write("'; + + // Load the css file dynamically. + print ''; + } + + // drupal_add_js() with 'inline' didn't seem to work, possibly because this is + // AJAX loaded content. + print ''; + } + exit; +} + +/** + * Get the contact form. + */ +function lightbox2_contact() { + if (module_exists('contact') && variable_get('lightbox2_enable_contact', FALSE) && user_access('access site-wide contact form')) { + $path = drupal_get_path('module', 'contact'); + include_once($path . '/contact.pages.inc'); + print drupal_render(drupal_get_form('contact_site_form')); + // drupal_add_js() with 'inline' didn't seem to work, possibly because this is + // AJAX loaded content. + print ''; + exit; + } +} + +/** + * Implementation of hook_form_alter(). + * + * Update the page action and input size. + * + * @param &$form + * General reference used in drupal, defining the structure & the fields of + * a form. + * @param $form_state + * General variable, used to control the processing of the form. + * @param $form_id + * The default is "user_login_block"; hold the page where the function is being + * used. + * @return + * Return the structure of the form. + */ +function lightbox2_form_user_login_block_alter(&$form, $form_state, $form_id = "user_login_block") { + if ($form_id == 'user_login_block' && arg(0) == 'user' && arg(1) == 'login' && arg(2) == 'lightbox2') { + $form['#action'] = url('user/login/lightbox2', array('query' => array('destination' => $_GET['destination']))); + } +} + +function lightbox2_form_contact_site_form_alter(&$form, $form_state, $form_id = "contact_site_form") { + if ($form_id == 'contact_site_form' && arg(0) == 'contact' && arg(1) == 'lightbox2') { + $form['#action'] = url('contact', array('query' => array('destination' => $_GET['destination']))); + } +} + +/** + * Implementation of hook_link_alter(). + * + * Add a lightbox2 rel attribute to the image link sizes on the image node. + */ +function lightbox2_link_alter(&$links, $node) { + $image_node_handler = variable_get('lightbox2_image_node', 0); + + // Only operate on image nodes and if automatic handling for image nodes is + // enabled. Also ensure $links is an array (bug in contemplate module). + if (!$image_node_handler || ($node->type != 'image' && $image_node_handler) || !is_array($links)) { + return; + } + $trigger_sizes = variable_get('lightbox2_trigger_image_size', array('thumbnail')); + + // Change original ('original') to '_original'. + if (isset($trigger_sizes['original'])) { + unset($trigger_sizes['original']); + $trigger_sizes['_original'] = '_original'; + } + + $rel = ''; + switch ($image_node_handler) { + case 1: // Lightbox. + case 2: // Lightbox grouped. + case 3: // Slideshow. + $rel = 'lightbox'; + break; + case 4: // Lightframe. + case 5: // Lightframe grouped. + $rel = 'lightframe'; + break; + } + $rel = $rel . '[][' . $node->title . ']'; + foreach ($trigger_sizes as $size) { + if (isset($links['image_size_' . $size])) { + $links['image_size_' . $size]['attributes']['rel'] = $rel; + $links['image_size_' . $size]['href'] = $node->images[$size]; + unset($links['image_size_' . $size]['query']); + } + } +} + +/** + * Implementation of hook_views_api(). + */ +function lightbox2_views_api() { + return array( + 'api' => '3.0', + ); +} + +function lightbox2_filter_xss() { + $allowed_tags = trim(variable_get('lightbox2_filter_xss_allowed_tags', 'p, br, a, em, strong, cite, code, ul, ol, li, dl, dt, dd, ')); + $allowed_tags = (empty($allowed_tags) ? array() : preg_split('/[,\s]+/', $allowed_tags)); + if (!empty($_POST['allowed_tags']) && $_POST['allowed_tags'] != 'undefined') { + $allowed_tags = explode(',', $_POST['allowed_tags']); + $output = filter_xss($_POST['string'], $allowed_tags); + } + else { + $output = filter_xss($_POST['string'], $allowed_tags); + } + drupal_json_output($output); +} + diff --git a/sites/all/modules/lightbox2/lightbox2.views.inc b/sites/all/modules/lightbox2/lightbox2.views.inc new file mode 100644 index 0000000..f784ad6 --- /dev/null +++ b/sites/all/modules/lightbox2/lightbox2.views.inc @@ -0,0 +1,47 @@ + array(), + ); + + $data['lightbox2']['lightbox2'] = array( + 'group' => t('Lightbox'), + 'field' => array( + 'title' => t('Lightbox trigger'), + 'help' => t('Provide custom text or link.'), + 'handler' => 'lightbox2_handler_field_lightbox2', + ), + ); + + return $data; +} + +/** + * Implementation of hook_views_handlers() to register all of the basic handlers + * views uses. + */ +function lightbox2_views_handlers() { + return array( + 'info' => array( + 'path' => drupal_get_path('module', 'lightbox2'), + ), + 'handlers' => array( + 'lightbox2_handler_field_lightbox2' => array( + 'parent' => 'views_handler_field', + ), + ), + ); +} diff --git a/sites/all/modules/lightbox2/lightbox2_handler_field_lightbox2.inc b/sites/all/modules/lightbox2/lightbox2_handler_field_lightbox2.inc new file mode 100644 index 0000000..3612788 --- /dev/null +++ b/sites/all/modules/lightbox2/lightbox2_handler_field_lightbox2.inc @@ -0,0 +1,152 @@ + ''); + $options['popup'] = array('default' => ''); + $options['caption'] = array('default' => ''); + $options['rel_group'] = array('default' => TRUE); + $options['custom_group'] = array('default' => ''); + $options['height'] = array('default' => '400px'); + $options['width'] = array('default' => '600px'); + + return $options; + } + + function options_form(&$form, &$form_state) { + parent::options_form($form, $form_state); + + $fields = array('trigger_field' => t('')); + foreach ($this->view->display_handler->get_handlers('field') as $field => $handler) { + // We only use fields up to this one. Obviously we can't use this handler + // as the trigger handler. + if ($field == $this->options['id']) { + break; + } + + $fields[$field] = $handler->definition['title']; + } + + $form['trigger_field'] = array( + '#type' => 'select', + '#title' => t('Trigger field'), + '#description' => t('Select the field that should be turned into the trigger for the lightbox. Only fields that appear before this one in the field list may be used.'), + '#options' => $fields, + '#default_value' => $this->options['trigger_field'], + '#weight' => -12, + ); + + $form['popup'] = array( + '#type' => 'textarea', + '#title' => t('Popup'), + '#description' => t('Combine tokens from the "Replacement patterns" below and html to create what the lightbox popup will become.'), + '#default_value' => $this->options['popup'], + '#weight' => -11, + ); + + $form['caption'] = array( + '#type' => 'textfield', + '#title' => t('Caption'), + '#description' => t('Combine tokens from the "Replacement patterns" below and html to create the caption shown under the lightbox. Leave empty for no caption.'), + '#default_value' => $this->options['caption'], + '#weight' => -10, + ); + + $form['rel_group'] = array( + '#type' => 'checkbox', + '#title' => t('Automatic generated Lightbox group'), + '#description' => t('Enable Lightbox grouping using a generated group name for this view.'), + '#default_value' => $this->options['rel_group'], + '#weight' => -9, + ); + + $form['custom_group'] = array( + '#type' => 'textfield', + '#title' => t('Custom Lightbox group'), + '#description' => t('Enable Lightbox grouping with a given string as group. Overrides the automatically generated group name above.'), + '#default_value' => $this->options['custom_group'], + '#weight' => -8, + ); + + $form['height'] = array( + '#type' => 'textfield', + '#title' => t('Height'), + '#description' => t('Specify the height of the lightbox2 popup window. Because the content is dynamic, we cannot detect this value automatically.'), + '#default_value' => $this->options['height'], + '#weight' => -7, + ); + + $form['width'] = array( + '#type' => 'textfield', + '#title' => t('Width'), + '#description' => t('Specify the width of the lightbox2 popup window. Because the content is dynamic, we cannot detect this value automatically.'), + '#default_value' => $this->options['width'], + '#weight' => -6, + ); + + + + // Remove the checkboxs and other irrelevant controls. + unset($form['alter']['alter_text']); + unset($form['alter']['make_link']); + unset($form['alter']['text']); + unset($form['alter']['path']); + unset($form['alter']['alt']); + unset($form['alter']['prefix']); + unset($form['alter']['suffix']); + unset($form['alter']['text']['#dependency']); + unset($form['alter']['text']['#process']); + } + + /** + * Render the trigger field and its linked popup information. + */ + function render($values) { + // We need to have multiple unique IDs, one for each record. + static $i = 0; + + static $link; + + if (!empty($this->options['trigger_field'])) { + + // We don't actually use the link, but we need it there for lightbox to function. + if (empty($link)) { + // Get the path name. + $path = isset($_GET['q']) ? $_GET['q'] : ''; + $link = url($path, array('absolute' => TRUE)); + } + + // Get the token information and generate the value for the popup and the + // caption. + $tokens = $this->get_render_tokens($this->options['alter']); + $popup = filter_xss_admin($this->options['popup']); + $caption = filter_xss_admin($this->options['caption']); + $popup = strtr($popup, $tokens); + $caption = strtr($caption, $tokens); + + $i++; + + // The outside div is there to hide all of the divs because if the specific lightbox + // div is hidden it won't show up as a lightbox. We also specify a group + // in the rel attribute in order to link the whole View together for paging. + $group_name = !empty($this->options['custom_group']) ? $this->options['custom_group'] : ($this->options['rel_group'] ? 'lightbox-popup-' . $this->view->name . '-' . implode('/', $this->view->args) : ''); + return "options['width'] : '600px') . ';height:' . ($this->options['height'] ? $this->options['height'] : '600px') . "][" . $caption . "]'>" . $tokens["[{$this->options['trigger_field']}]"] . " +
"; + } + else { + return; + } + } +} diff --git a/sites/all/modules/lightbox2/page--node--lightbox2.tpl.php b/sites/all/modules/lightbox2/page--node--lightbox2.tpl.php new file mode 100644 index 0000000..4d238cf --- /dev/null +++ b/sites/all/modules/lightbox2/page--node--lightbox2.tpl.php @@ -0,0 +1,57 @@ + + + + <?php print $head_title ?> + + + + + + + + + +
+
+ + +
+type); ?> + + +

+ + + + +
+
+ +
+ +
+ + + + +
+ +
+
+
+
+
+
+ +