olelo 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +10 -0
- data/.gitmodules +3 -0
- data/Gemfile +3 -0
- data/README.markdown +104 -0
- data/Rakefile +92 -0
- data/bin/olelo +5 -0
- data/config.ru +86 -0
- data/config/aspects.rb +256 -0
- data/config/config.yml.default +154 -0
- data/config/initializers/00-mime_types.rb +29 -0
- data/config/initializers/01-slim.rb +2 -0
- data/config/interwiki.yml +11 -0
- data/doc/AUTHORS +7 -0
- data/doc/LICENSE +22 -0
- data/lib/olelo.rb +39 -0
- data/lib/olelo/application.rb +294 -0
- data/lib/olelo/attributes.rb +285 -0
- data/lib/olelo/config.rb +88 -0
- data/lib/olelo/extensions.rb +252 -0
- data/lib/olelo/helper.rb +290 -0
- data/lib/olelo/hooks.rb +142 -0
- data/lib/olelo/html_safe.rb +29 -0
- data/lib/olelo/initializer.rb +76 -0
- data/lib/olelo/locale.rb +63 -0
- data/lib/olelo/locale.yml +284 -0
- data/lib/olelo/menu.rb +101 -0
- data/lib/olelo/middleware/blacklist.rb +25 -0
- data/lib/olelo/middleware/degrade_mime_type.rb +19 -0
- data/lib/olelo/middleware/flash.rb +97 -0
- data/lib/olelo/middleware/force_encoding.rb +41 -0
- data/lib/olelo/page.rb +266 -0
- data/lib/olelo/patch.rb +311 -0
- data/lib/olelo/plugin.rb +188 -0
- data/lib/olelo/repository.rb +225 -0
- data/lib/olelo/routing.rb +223 -0
- data/lib/olelo/templates.rb +30 -0
- data/lib/olelo/user.rb +132 -0
- data/lib/olelo/util.rb +233 -0
- data/lib/olelo/version.rb +3 -0
- data/lib/olelo/virtualfs.rb +161 -0
- data/lib/rack/olelo_patches.rb +33 -0
- data/lib/rack/relative_redirect.rb +44 -0
- data/lib/rack/static_cache.rb +93 -0
- data/lib/yard/addons.rb +1 -0
- data/lib/yard/addons/hook_handler.rb +25 -0
- data/lib/yard/addons/override_tag.rb +14 -0
- data/lib/yard/addons/route_handler.rb +33 -0
- data/lib/yard/addons/sanitize_anchor.rb +16 -0
- data/olelo.gemspec +31 -0
- data/plugins/aspects/changelog.rb +45 -0
- data/plugins/aspects/documentbrowser.rb +57 -0
- data/plugins/aspects/download.rb +11 -0
- data/plugins/aspects/highlight.rb +8 -0
- data/plugins/aspects/image.rb +41 -0
- data/plugins/aspects/imageinfo.rb +64 -0
- data/plugins/aspects/locale.yml +60 -0
- data/plugins/aspects/main.rb +199 -0
- data/plugins/aspects/pageinfo.rb +37 -0
- data/plugins/aspects/source.rb +6 -0
- data/plugins/aspects/subpages.rb +44 -0
- data/plugins/aspects/text.rb +9 -0
- data/plugins/blog/blog.css +1 -0
- data/plugins/blog/blog.scss +37 -0
- data/plugins/blog/locale.yml +12 -0
- data/plugins/blog/main.rb +85 -0
- data/plugins/editor/locale.yml +18 -0
- data/plugins/editor/markup/main.rb +3 -0
- data/plugins/editor/markup/script.js +10 -0
- data/plugins/editor/markup/script/00-jquery.textselection.js +267 -0
- data/plugins/editor/markup/script/01-olelo.markupeditor.js +116 -0
- data/plugins/editor/markup/script/init.js +10 -0
- data/plugins/editor/preview.rb +52 -0
- data/plugins/editor/recaptcha.rb +56 -0
- data/plugins/filters/creole.rb +37 -0
- data/plugins/filters/disposition.rb +9 -0
- data/plugins/filters/editsection.rb +67 -0
- data/plugins/filters/fix_img_tag.rb +16 -0
- data/plugins/filters/html_wrapper.rb +12 -0
- data/plugins/filters/interwiki.rb +19 -0
- data/plugins/filters/link_classifier.rb +26 -0
- data/plugins/filters/locale.yml +15 -0
- data/plugins/filters/main.rb +202 -0
- data/plugins/filters/markdown_nowiki.rb +15 -0
- data/plugins/filters/numbering.xsl +93 -0
- data/plugins/filters/orgmode.rb +6 -0
- data/plugins/filters/rubypants.rb +6 -0
- data/plugins/filters/s5/main.rb +32 -0
- data/plugins/filters/s5/s5.xsl +118 -0
- data/plugins/filters/tilt.rb +17 -0
- data/plugins/filters/toc.rb +50 -0
- data/plugins/filters/xhtml2latex.xsl +232 -0
- data/plugins/filters/xslt.rb +22 -0
- data/plugins/gallery/gallery.css +1 -0
- data/plugins/gallery/gallery.scss +28 -0
- data/plugins/gallery/main.rb +34 -0
- data/plugins/misc/fancybox/images/blank.gif +0 -0
- data/plugins/misc/fancybox/images/fancy_close.png +0 -0
- data/plugins/misc/fancybox/images/fancy_loading.png +0 -0
- data/plugins/misc/fancybox/images/fancy_nav_left.png +0 -0
- data/plugins/misc/fancybox/images/fancy_nav_right.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_e.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_n.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_ne.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_nw.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_s.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_se.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_sw.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_w.png +0 -0
- data/plugins/misc/fancybox/images/fancy_title_left.png +0 -0
- data/plugins/misc/fancybox/images/fancy_title_main.png +0 -0
- data/plugins/misc/fancybox/images/fancy_title_over.png +0 -0
- data/plugins/misc/fancybox/images/fancy_title_right.png +0 -0
- data/plugins/misc/fancybox/images/fancybox-x.png +0 -0
- data/plugins/misc/fancybox/images/fancybox-y.png +0 -0
- data/plugins/misc/fancybox/images/fancybox.png +0 -0
- data/plugins/misc/fancybox/jquery.fancybox.css +1 -0
- data/plugins/misc/fancybox/jquery.fancybox.scss +323 -0
- data/plugins/misc/fancybox/main.rb +4 -0
- data/plugins/misc/fancybox/script.js +37 -0
- data/plugins/misc/fancybox/script/00-jquery.mousewheel.js +84 -0
- data/plugins/misc/fancybox/script/01-jquery.easing.js +205 -0
- data/plugins/misc/fancybox/script/02-jquery.fancybox.js +1156 -0
- data/plugins/misc/fancybox/script/init.js +18 -0
- data/plugins/misc/system.rb +192 -0
- data/plugins/misc/variables.rb +29 -0
- data/plugins/misc/webdav.rb +45 -0
- data/plugins/repositories/git_grep.rb +69 -0
- data/plugins/repositories/gitrb_repository.rb +204 -0
- data/plugins/repositories/locale.yml +12 -0
- data/plugins/repositories/rugged_repository.rb +454 -0
- data/plugins/security/acl.rb +57 -0
- data/plugins/security/basic_auth.rb +21 -0
- data/plugins/security/locale.yml +21 -0
- data/plugins/security/persistent_login.rb +32 -0
- data/plugins/security/portal.rb +28 -0
- data/plugins/security/private_wiki.rb +24 -0
- data/plugins/security/readonly_wiki.rb +25 -0
- data/plugins/security/stack.rb +20 -0
- data/plugins/security/yamlfile.rb +66 -0
- data/plugins/tags/code.rb +6 -0
- data/plugins/tags/footnotes.rb +35 -0
- data/plugins/tags/gist-embed.css +123 -0
- data/plugins/tags/gist.rb +13 -0
- data/plugins/tags/html.rb +57 -0
- data/plugins/tags/include.rb +20 -0
- data/plugins/tags/main.rb +353 -0
- data/plugins/tags/math.rb +117 -0
- data/plugins/tags/scripting.rb +64 -0
- data/plugins/tags/sort.rb +7 -0
- data/plugins/tags/tabs.rb +20 -0
- data/plugins/treeview/images/collapsed.png +0 -0
- data/plugins/treeview/images/expanded.png +0 -0
- data/plugins/treeview/images/menu.png +0 -0
- data/plugins/treeview/images/tree.png +0 -0
- data/plugins/treeview/images/wait.gif +0 -0
- data/plugins/treeview/main.rb +16 -0
- data/plugins/treeview/script.js +5 -0
- data/plugins/treeview/script/00-jquery.treeview.js +164 -0
- data/plugins/treeview/script/init.js +25 -0
- data/plugins/treeview/treeview.css +1 -0
- data/plugins/treeview/treeview.scss +113 -0
- data/plugins/utils/assets.rb +74 -0
- data/plugins/utils/cache.rb +53 -0
- data/plugins/utils/image_magick.rb +34 -0
- data/plugins/utils/pygments.css +1 -0
- data/plugins/utils/pygments.rb +50 -0
- data/plugins/utils/pygments.scss +83 -0
- data/plugins/utils/semaphore.rb +50 -0
- data/plugins/utils/shell.rb +45 -0
- data/plugins/utils/store.rb +315 -0
- data/plugins/utils/worker.rb +36 -0
- data/plugins/utils/xml.rb +29 -0
- data/static/images/favicon.png +0 -0
- data/static/script.js +267 -0
- data/static/script/00-json2.js +486 -0
- data/static/script/01-jstorage.js +217 -0
- data/static/script/02-jquery.js +9440 -0
- data/static/script/03-jquery.ui.core.js +337 -0
- data/static/script/04-jquery.ui.widget.js +502 -0
- data/static/script/05-jquery.ui.position.js +517 -0
- data/static/script/06-jquery.ui.menu.js +609 -0
- data/static/script/07-jquery.ui.autocomplete.js +601 -0
- data/static/script/08-olelo.i18n.js +37 -0
- data/static/script/09-olelo.unsaved.js +68 -0
- data/static/script/10-olelo.historytable.js +40 -0
- data/static/script/11-olelo.pagination.js +18 -0
- data/static/script/13-olelo.tabwidget.js +57 -0
- data/static/script/14-olelo.timeago.js +70 -0
- data/static/script/15-olelo.underliner.js +31 -0
- data/static/script/16-olelo.ui.combobox.js +32 -0
- data/static/script/init.js +48 -0
- data/static/themes/atlantis/constants.scss +15 -0
- data/static/themes/atlantis/iehacks.scss +38 -0
- data/static/themes/atlantis/images/actions/delete.png +0 -0
- data/static/themes/atlantis/images/actions/edit.png +0 -0
- data/static/themes/atlantis/images/actions/history.png +0 -0
- data/static/themes/atlantis/images/actions/home.png +0 -0
- data/static/themes/atlantis/images/actions/move.png +0 -0
- data/static/themes/atlantis/images/actions/new.png +0 -0
- data/static/themes/atlantis/images/actions/page.png +0 -0
- data/static/themes/atlantis/images/bg/button.png +0 -0
- data/static/themes/atlantis/images/bg/container.png +0 -0
- data/static/themes/atlantis/images/bg/content.png +0 -0
- data/static/themes/atlantis/images/bg/footer.png +0 -0
- data/static/themes/atlantis/images/bg/header.jpg +0 -0
- data/static/themes/atlantis/images/bg/header.orig.jpg +0 -0
- data/static/themes/atlantis/images/bg/header_gray.jpg +0 -0
- data/static/themes/atlantis/images/bug.png +0 -0
- data/static/themes/atlantis/images/filetypes/7z.png +0 -0
- data/static/themes/atlantis/images/filetypes/_archive.png +0 -0
- data/static/themes/atlantis/images/filetypes/_audio.png +0 -0
- data/static/themes/atlantis/images/filetypes/_code.png +0 -0
- data/static/themes/atlantis/images/filetypes/_linux.png +0 -0
- data/static/themes/atlantis/images/filetypes/_picture.png +0 -0
- data/static/themes/atlantis/images/filetypes/_video.png +0 -0
- data/static/themes/atlantis/images/filetypes/bz2.png +0 -0
- data/static/themes/atlantis/images/filetypes/doc.png +0 -0
- data/static/themes/atlantis/images/filetypes/flac.png +0 -0
- data/static/themes/atlantis/images/filetypes/gz.png +0 -0
- data/static/themes/atlantis/images/filetypes/html.png +0 -0
- data/static/themes/atlantis/images/filetypes/java.png +0 -0
- data/static/themes/atlantis/images/filetypes/jpg.png +0 -0
- data/static/themes/atlantis/images/filetypes/midi.png +0 -0
- data/static/themes/atlantis/images/filetypes/mp3.png +0 -0
- data/static/themes/atlantis/images/filetypes/ogg.png +0 -0
- data/static/themes/atlantis/images/filetypes/pdf.png +0 -0
- data/static/themes/atlantis/images/filetypes/php.png +0 -0
- data/static/themes/atlantis/images/filetypes/png.png +0 -0
- data/static/themes/atlantis/images/filetypes/ppt.png +0 -0
- data/static/themes/atlantis/images/filetypes/psd.png +0 -0
- data/static/themes/atlantis/images/filetypes/rar.png +0 -0
- data/static/themes/atlantis/images/filetypes/rb.png +0 -0
- data/static/themes/atlantis/images/filetypes/sh.png +0 -0
- data/static/themes/atlantis/images/filetypes/tar.png +0 -0
- data/static/themes/atlantis/images/filetypes/txt.png +0 -0
- data/static/themes/atlantis/images/filetypes/wma.png +0 -0
- data/static/themes/atlantis/images/filetypes/xls.png +0 -0
- data/static/themes/atlantis/images/filetypes/zip.png +0 -0
- data/static/themes/atlantis/images/folder.png +0 -0
- data/static/themes/atlantis/images/folder_open.png +0 -0
- data/static/themes/atlantis/images/loading.gif +0 -0
- data/static/themes/atlantis/images/loading.xcf +0 -0
- data/static/themes/atlantis/images/not_found.png +0 -0
- data/static/themes/atlantis/images/page.png +0 -0
- data/static/themes/atlantis/images/search.png +0 -0
- data/static/themes/atlantis/layout.scss +115 -0
- data/static/themes/atlantis/menu.scss +99 -0
- data/static/themes/atlantis/print.scss +129 -0
- data/static/themes/atlantis/screen.scss +495 -0
- data/static/themes/atlantis/style.css +3 -0
- data/static/themes/lib/autocomplete.scss +39 -0
- data/static/themes/lib/headlines.scss +10 -0
- data/static/themes/lib/horizontal-list.scss +31 -0
- data/static/themes/lib/patch.scss +88 -0
- data/static/themes/lib/reset.scss +114 -0
- data/static/themes/lib/rounded.scss +46 -0
- data/static/themes/lib/shadow.scss +14 -0
- data/test/config_test.rb +28 -0
- data/test/factory_test.rb +29 -0
- data/test/hash_extensions_test.rb +16 -0
- data/test/helper.rb +38 -0
- data/test/hooks_test.rb +85 -0
- data/test/object_extensions_test.rb +20 -0
- data/test/page_test.rb +168 -0
- data/test/request_test.rb +166 -0
- data/test/string_extensions_test.rb +32 -0
- data/test/templates_test.rb +39 -0
- data/test/util_test.rb +71 -0
- data/views/changes.slim +22 -0
- data/views/compare.slim +8 -0
- data/views/delete.slim +9 -0
- data/views/deleted.slim +2 -0
- data/views/edit.slim +65 -0
- data/views/error.slim +6 -0
- data/views/history.slim +20 -0
- data/views/layout.slim +38 -0
- data/views/login.slim +37 -0
- data/views/move.slim +10 -0
- data/views/not_found.slim +6 -0
- data/views/profile.slim +26 -0
- data/views/show.slim +9 -0
- metadata +488 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
(function(a){function b(d){var j=d||window.event,k=[].slice.call(arguments,1),w=0,o=0,x=0;d=a.event.fix(j);d.type="mousewheel";if(j.wheelDelta)w=j.wheelDelta/120;if(j.detail)w=-j.detail/3;x=w;if(j.axis!==undefined&&j.axis===j.HORIZONTAL_AXIS){x=0;o=-1*w}if(j.wheelDeltaY!==undefined)x=j.wheelDeltaY/120;if(j.wheelDeltaX!==undefined)o=-1*j.wheelDeltaX/120;k.unshift(d,w,o,x);return(a.event.dispatch||a.event.handle).apply(this,k)}var f=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var e=f.length;e;)a.event.fixHooks[f[--e]]=
|
|
2
|
+
a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var d=f.length;d;)this.addEventListener(f[--d],b,false);else this.onmousewheel=b},teardown:function(){if(this.removeEventListener)for(var d=f.length;d;)this.removeEventListener(f[--d],b,false);else this.onmousewheel=null}};a.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}})})(jQuery);jQuery.easing.jswing=jQuery.easing.swing;
|
|
3
|
+
jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(a,b,f,e,d){return jQuery.easing[jQuery.easing.def](a,b,f,e,d)},easeInQuad:function(a,b,f,e,d){return e*(b/=d)*b+f},easeOutQuad:function(a,b,f,e,d){return-e*(b/=d)*(b-2)+f},easeInOutQuad:function(a,b,f,e,d){if((b/=d/2)<1)return e/2*b*b+f;return-e/2*(--b*(b-2)-1)+f},easeInCubic:function(a,b,f,e,d){return e*(b/=d)*b*b+f},easeOutCubic:function(a,b,f,e,d){return e*((b=b/d-1)*b*b+1)+f},easeInOutCubic:function(a,b,f,e,d){if((b/=d/2)<1)return e/
|
|
4
|
+
2*b*b*b+f;return e/2*((b-=2)*b*b+2)+f},easeInQuart:function(a,b,f,e,d){return e*(b/=d)*b*b*b+f},easeOutQuart:function(a,b,f,e,d){return-e*((b=b/d-1)*b*b*b-1)+f},easeInOutQuart:function(a,b,f,e,d){if((b/=d/2)<1)return e/2*b*b*b*b+f;return-e/2*((b-=2)*b*b*b-2)+f},easeInQuint:function(a,b,f,e,d){return e*(b/=d)*b*b*b*b+f},easeOutQuint:function(a,b,f,e,d){return e*((b=b/d-1)*b*b*b*b+1)+f},easeInOutQuint:function(a,b,f,e,d){if((b/=d/2)<1)return e/2*b*b*b*b*b+f;return e/2*((b-=2)*b*b*b*b+2)+f},easeInSine:function(a,
|
|
5
|
+
b,f,e,d){return-e*Math.cos(b/d*(Math.PI/2))+e+f},easeOutSine:function(a,b,f,e,d){return e*Math.sin(b/d*(Math.PI/2))+f},easeInOutSine:function(a,b,f,e,d){return-e/2*(Math.cos(Math.PI*b/d)-1)+f},easeInExpo:function(a,b,f,e,d){return b==0?f:e*Math.pow(2,10*(b/d-1))+f},easeOutExpo:function(a,b,f,e,d){return b==d?f+e:e*(-Math.pow(2,-10*b/d)+1)+f},easeInOutExpo:function(a,b,f,e,d){if(b==0)return f;if(b==d)return f+e;if((b/=d/2)<1)return e/2*Math.pow(2,10*(b-1))+f;return e/2*(-Math.pow(2,-10*--b)+2)+f},
|
|
6
|
+
easeInCirc:function(a,b,f,e,d){return-e*(Math.sqrt(1-(b/=d)*b)-1)+f},easeOutCirc:function(a,b,f,e,d){return e*Math.sqrt(1-(b=b/d-1)*b)+f},easeInOutCirc:function(a,b,f,e,d){if((b/=d/2)<1)return-e/2*(Math.sqrt(1-b*b)-1)+f;return e/2*(Math.sqrt(1-(b-=2)*b)+1)+f},easeInElastic:function(a,b,f,e,d){a=1.70158;var j=0,k=e;if(b==0)return f;if((b/=d)==1)return f+e;j||(j=d*0.3);if(k<Math.abs(e)){k=e;a=j/4}else a=j/(2*Math.PI)*Math.asin(e/k);return-(k*Math.pow(2,10*(b-=1))*Math.sin((b*d-a)*2*Math.PI/j))+f},easeOutElastic:function(a,
|
|
7
|
+
b,f,e,d){a=1.70158;var j=0,k=e;if(b==0)return f;if((b/=d)==1)return f+e;j||(j=d*0.3);if(k<Math.abs(e)){k=e;a=j/4}else a=j/(2*Math.PI)*Math.asin(e/k);return k*Math.pow(2,-10*b)*Math.sin((b*d-a)*2*Math.PI/j)+e+f},easeInOutElastic:function(a,b,f,e,d){a=1.70158;var j=0,k=e;if(b==0)return f;if((b/=d/2)==2)return f+e;j||(j=d*0.3*1.5);if(k<Math.abs(e)){k=e;a=j/4}else a=j/(2*Math.PI)*Math.asin(e/k);if(b<1)return-0.5*k*Math.pow(2,10*(b-=1))*Math.sin((b*d-a)*2*Math.PI/j)+f;return k*Math.pow(2,-10*(b-=1))*Math.sin((b*
|
|
8
|
+
d-a)*2*Math.PI/j)*0.5+e+f},easeInBack:function(a,b,f,e,d,j){if(j==undefined)j=1.70158;return e*(b/=d)*b*((j+1)*b-j)+f},easeOutBack:function(a,b,f,e,d,j){if(j==undefined)j=1.70158;return e*((b=b/d-1)*b*((j+1)*b+j)+1)+f},easeInOutBack:function(a,b,f,e,d,j){if(j==undefined)j=1.70158;if((b/=d/2)<1)return e/2*b*b*(((j*=1.525)+1)*b-j)+f;return e/2*((b-=2)*b*(((j*=1.525)+1)*b+j)+2)+f},easeInBounce:function(a,b,f,e,d){return e-jQuery.easing.easeOutBounce(a,d-b,0,e,d)+f},easeOutBounce:function(a,b,f,e,d){return(b/=
|
|
9
|
+
d)<1/2.75?e*7.5625*b*b+f:b<2/2.75?e*(7.5625*(b-=1.5/2.75)*b+0.75)+f:b<2.5/2.75?e*(7.5625*(b-=2.25/2.75)*b+0.9375)+f:e*(7.5625*(b-=2.625/2.75)*b+0.984375)+f},easeInOutBounce:function(a,b,f,e,d){if(b<d/2)return jQuery.easing.easeInBounce(a,b*2,0,e,d)*0.5+f;return jQuery.easing.easeOutBounce(a,b*2-d,0,e,d)*0.5+e*0.5+f}});(function(a){var b,f,e,d,j,k,w,o,x,C,t=0,i={},r=[],s=0,h={},q=[],G=null,y=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,B=0,v="",u,n,m=false,D=a.extend(a("<div/>")[0],{prop:0}),M=a.browser.msie&&a.browser.version<7&&!window.XMLHttpRequest,N=function(){f.hide();y.onerror=y.onload=null;G&&G.abort();b.empty()},O=function(){if(false===i.onError(r,t,i)){f.hide();m=false}else{i.titleShow=false;i.width="auto";i.height="auto";b.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
|
|
10
|
+
F()}},I=function(){var c=r[t],g,l,p,E,P,z;N();i=a.extend({},a.fn.fancybox.defaults,typeof a(c).data("fancybox")=="undefined"?i:a(c).data("fancybox"));z=i.onStart(r,t,i);if(z===false)m=false;else{if(typeof z=="object")i=a.extend(i,z);p=i.title||(c.nodeName?a(c).attr("title"):c.title)||"";if(c.nodeName&&!i.orig)i.orig=a(c).children("img:first").length?a(c).children("img:first"):a(c);if(p===""&&i.orig&&i.titleFromAlt)p=i.orig.attr("alt");g=i.href||(c.nodeName?a(c).attr("href"):c.href)||null;if(/^(?:javascript)/i.test(g)||
|
|
11
|
+
g=="#")g=null;if(i.type){l=i.type;if(!g)g=i.content}else if(i.content)l="html";else if(g)l=g.match(J)?"image":g.match(W)?"swf":a(c).hasClass("iframe")?"iframe":g.indexOf("#")===0?"inline":"ajax";if(l){if(l=="inline"){c=g.substr(g.indexOf("#"));l=a(c).length>0?"inline":"ajax"}i.type=l;i.href=g;i.title=p;if(i.autoDimensions)if(i.type=="html"||i.type=="inline"||i.type=="ajax"){i.width="auto";i.height="auto"}else i.autoDimensions=false;if(i.modal){i.overlayShow=true;i.hideOnOverlayClick=false;i.hideOnContentClick=
|
|
12
|
+
false;i.enableEscapeButton=false;i.showCloseButton=false}i.padding=parseInt(i.padding,10);i.margin=parseInt(i.margin,10);b.css("padding",i.padding+i.margin);a(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){a(this).replaceWith(k.children())});switch(l){case "html":b.html(i.content);F();break;case "inline":if(a(c).parent().is("#fancybox-content")===true){m=false;return}a('<div class="fancybox-inline-tmp" />').hide().insertBefore(a(c)).bind("fancybox-cleanup",function(){a(this).replaceWith(k.children())}).bind("fancybox-cancel",
|
|
13
|
+
function(){a(this).replaceWith(b.children())});a(c).appendTo(b);F();break;case "image":m=false;a.fancybox.showActivity();y=new Image;y.onerror=function(){O()};y.onload=function(){m=true;y.onerror=y.onload=null;i.width=y.width;i.height=y.height;a("<img />").attr({id:"fancybox-img",src:y.src,alt:i.title}).appendTo(b);Q()};y.src=g;break;case "swf":i.scrolling="no";E='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+i.width+'" height="'+i.height+'"><param name="movie" value="'+g+
|
|
14
|
+
'"></param>';P="";a.each(i.swf,function(A,H){E+='<param name="'+A+'" value="'+H+'"></param>';P+=" "+A+'="'+H+'"'});E+='<embed src="'+g+'" type="application/x-shockwave-flash" width="'+i.width+'" height="'+i.height+'"'+P+"></embed></object>";b.html(E);F();break;case "ajax":m=false;a.fancybox.showActivity();i.ajax.win=i.ajax.success;G=a.ajax(a.extend({},i.ajax,{url:g,data:i.ajax.data||{},error:function(A){A.status>0&&O()},success:function(A,H,R){if((typeof R=="object"?R:G).status==200){if(typeof i.ajax.win==
|
|
15
|
+
"function"){z=i.ajax.win(g,A,H,R);if(z===false){f.hide();return}else if(typeof z=="string"||typeof z=="object")A=z}b.html(A);F()}}}));break;case "iframe":Q();break}}else O()}},F=function(){var c=i.width,g=i.height;c=c.toString().indexOf("%")>-1?parseInt((a(window).width()-i.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";g=g.toString().indexOf("%")>-1?parseInt((a(window).height()-i.margin*2)*parseFloat(g)/100,10)+"px":g=="auto"?"auto":g+"px";b.wrapInner('<div style="width:'+c+";height:"+
|
|
16
|
+
g+";overflow: "+(i.scrolling=="auto"?"auto":i.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');i.width=b.width();i.height=b.height();Q()},Q=function(){var c,g;f.hide();if(d.is(":visible")&&false===h.onCleanup(q,s,h)){a.event.trigger("fancybox-cancel");m=false}else{m=true;a(k.add(e)).unbind();a(window).unbind("resize.fb scroll.fb");a(document).unbind("keydown.fb");d.is(":visible")&&h.titlePosition!=="outside"&&d.css("height",d.height());q=r;s=t;h=i;if(h.overlayShow){e.css({"background-color":h.overlayColor,
|
|
17
|
+
opacity:h.overlayOpacity,cursor:h.hideOnOverlayClick?"pointer":"auto",height:a(document).height()});if(!e.is(":visible")){M&&a("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});e.show()}}else e.hide();n=X();v=h.title||"";B=0;o.empty().removeAttr("style").removeClass();if(h.titleShow!==false){if(a.isFunction(h.titleFormat))c=h.titleFormat(v,q,s,h);else c=v&&v.length?
|
|
18
|
+
h.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+v+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+h.titlePosition+'">'+v+"</div>":false;v=c;if(!(!v||v==="")){o.addClass("fancybox-title-"+h.titlePosition).html(v).appendTo("body").show();switch(h.titlePosition){case "inside":o.css({width:n.width-h.padding*2,marginLeft:h.padding,marginRight:h.padding});
|
|
19
|
+
B=o.outerHeight(true);o.appendTo(j);n.height+=B;break;case "over":o.css({marginLeft:h.padding,width:n.width-h.padding*2,bottom:h.padding}).appendTo(j);break;case "float":o.css("left",parseInt((o.width()-n.width-40)/2,10)*-1).appendTo(d);break;default:o.css({width:n.width-h.padding*2,paddingLeft:h.padding,paddingRight:h.padding}).appendTo(d);break}}}o.hide();if(d.is(":visible")){a(w.add(x).add(C)).hide();c=d.position();u={top:c.top,left:c.left,width:d.width(),height:d.height()};g=u.width==n.width&&
|
|
20
|
+
u.height==n.height;k.fadeTo(h.changeFade,0.3,function(){var l=function(){k.html(b.contents()).fadeTo(h.changeFade,1,S)};a.event.trigger("fancybox-change");k.empty().removeAttr("filter").css({"border-width":h.padding,width:n.width-h.padding*2,height:i.autoDimensions?"auto":n.height-B-h.padding*2});if(g)l();else{D.prop=0;a(D).animate({prop:1},{duration:h.changeSpeed,easing:h.easingChange,step:T,complete:l})}})}else{d.removeAttr("style");k.css("border-width",h.padding);if(h.transitionIn=="elastic"){u=
|
|
21
|
+
V();k.html(b.contents());d.show();if(h.opacity)n.opacity=0;D.prop=0;a(D).animate({prop:1},{duration:h.speedIn,easing:h.easingIn,step:T,complete:S})}else{h.titlePosition=="inside"&&B>0&&o.show();k.css({width:n.width-h.padding*2,height:i.autoDimensions?"auto":n.height-B-h.padding*2}).html(b.contents());d.css(n).fadeIn(h.transitionIn=="none"?0:h.speedIn,S)}}}},Y=function(){if(h.enableEscapeButton||h.enableKeyboardNav)a(document).bind("keydown.fb",function(c){if(c.keyCode==27&&h.enableEscapeButton){c.preventDefault();
|
|
22
|
+
a.fancybox.close()}else if((c.keyCode==37||c.keyCode==39)&&h.enableKeyboardNav&&c.target.tagName!=="INPUT"&&c.target.tagName!=="TEXTAREA"&&c.target.tagName!=="SELECT"){c.preventDefault();a.fancybox[c.keyCode==37?"prev":"next"]()}});if(h.showNavArrows){if(h.cyclic&&q.length>1||s!==0)x.show();if(h.cyclic&&q.length>1||s!=q.length-1)C.show()}else{x.hide();C.hide()}},S=function(){if(!a.support.opacity){k.get(0).style.removeAttribute("filter");d.get(0).style.removeAttribute("filter")}i.autoDimensions&&
|
|
23
|
+
k.css("height","auto");d.css("height","auto");v&&v.length&&o.show();h.showCloseButton&&w.show();Y();h.hideOnContentClick&&k.bind("click",a.fancybox.close);h.hideOnOverlayClick&&e.bind("click",a.fancybox.close);a(window).bind("resize.fb",a.fancybox.resize);h.centerOnScroll&&a(window).bind("scroll.fb",a.fancybox.center);if(h.type=="iframe")a('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(a.browser.msie?'allowtransparency="true""':"")+' scrolling="'+
|
|
24
|
+
i.scrolling+'" src="'+h.href+'"></iframe>').appendTo(k);d.show();m=false;a.fancybox.center();h.onComplete(q,s,h);var c,g;if(q.length-1>s){c=q[s+1].href;if(typeof c!=="undefined"&&c.match(J)){g=new Image;g.src=c}}if(s>0){c=q[s-1].href;if(typeof c!=="undefined"&&c.match(J)){g=new Image;g.src=c}}},T=function(c){var g={width:parseInt(u.width+(n.width-u.width)*c,10),height:parseInt(u.height+(n.height-u.height)*c,10),top:parseInt(u.top+(n.top-u.top)*c,10),left:parseInt(u.left+(n.left-u.left)*c,10)};if(typeof n.opacity!==
|
|
25
|
+
"undefined")g.opacity=c<0.5?0.5:c;d.css(g);k.css({width:g.width-h.padding*2,height:g.height-B*c-h.padding*2})},U=function(){return[a(window).width()-h.margin*2,a(window).height()-h.margin*2,a(document).scrollLeft()+h.margin,a(document).scrollTop()+h.margin]},X=function(){var c=U(),g={},l=h.autoScale,p=h.padding*2;g.width=h.width.toString().indexOf("%")>-1?parseInt(c[0]*parseFloat(h.width)/100,10):h.width+p;g.height=h.height.toString().indexOf("%")>-1?parseInt(c[1]*parseFloat(h.height)/100,10):h.height+
|
|
26
|
+
p;if(l&&(g.width>c[0]||g.height>c[1]))if(i.type=="image"||i.type=="swf"){l=h.width/h.height;if(g.width>c[0]){g.width=c[0];g.height=parseInt((g.width-p)/l+p,10)}if(g.height>c[1]){g.height=c[1];g.width=parseInt((g.height-p)*l+p,10)}}else{g.width=Math.min(g.width,c[0]);g.height=Math.min(g.height,c[1])}g.top=parseInt(Math.max(c[3]-20,c[3]+(c[1]-g.height-40)*0.5),10);g.left=parseInt(Math.max(c[2]-20,c[2]+(c[0]-g.width-40)*0.5),10);return g},V=function(){var c=i.orig?a(i.orig):false,g={};if(c&&c.length){g=
|
|
27
|
+
c.offset();g.top+=parseInt(c.css("paddingTop"),10)||0;g.left+=parseInt(c.css("paddingLeft"),10)||0;g.top+=parseInt(c.css("border-top-width"),10)||0;g.left+=parseInt(c.css("border-left-width"),10)||0;g.width=c.width();g.height=c.height();g={width:g.width+h.padding*2,height:g.height+h.padding*2,top:g.top-h.padding-20,left:g.left-h.padding-20}}else{c=U();g={width:h.padding*2,height:h.padding*2,top:parseInt(c[3]+c[1]*0.5,10),left:parseInt(c[2]+c[0]*0.5,10)}}return g},Z=function(){if(f.is(":visible")){a("div",
|
|
28
|
+
f).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};a.fn.fancybox=function(c){if(!a(this).length)return this;a(this).data("fancybox",a.extend({},c,a.metadata?a(this).metadata():{})).unbind("click.fb").bind("click.fb",function(g){g.preventDefault();if(!m){m=true;a(this).blur();r=[];t=0;g=a(this).attr("rel")||"";if(!g||g==""||g==="nofollow")r.push(this);else{r=a("a[rel="+g+"], area[rel="+g+"]");t=r.index(this)}I()}});return this};a.fancybox=function(c,g){var l;if(!m){m=true;l=typeof g!=="undefined"?
|
|
29
|
+
g:{};r=[];t=parseInt(l.index,10)||0;if(a.isArray(c)){for(var p=0,E=c.length;p<E;p++)if(typeof c[p]=="object")a(c[p]).data("fancybox",a.extend({},l,c[p]));else c[p]=a({}).data("fancybox",a.extend({content:c[p]},l));r=jQuery.merge(r,c)}else{if(typeof c=="object")a(c).data("fancybox",a.extend({},l,c));else c=a({}).data("fancybox",a.extend({content:c},l));r.push(c)}if(t>r.length||t<0)t=0;I()}};a.fancybox.showActivity=function(){clearInterval(K);f.show();K=setInterval(Z,66)};a.fancybox.hideActivity=function(){f.hide()};
|
|
30
|
+
a.fancybox.next=function(){return a.fancybox.pos(s+1)};a.fancybox.prev=function(){return a.fancybox.pos(s-1)};a.fancybox.pos=function(c){if(!m){c=parseInt(c);r=q;if(c>-1&&c<q.length){t=c;I()}else if(h.cyclic&&q.length>1){t=c>=q.length?0:q.length-1;I()}}};a.fancybox.cancel=function(){if(!m){m=true;a.event.trigger("fancybox-cancel");N();i.onCancel(r,t,i);m=false}};a.fancybox.close=function(){function c(){e.fadeOut("fast");o.empty().hide();d.hide();a.event.trigger("fancybox-cleanup");k.empty();h.onClosed(q,
|
|
31
|
+
s,h);q=i=[];s=t=0;h=i={};m=false}if(!(m||d.is(":hidden"))){m=true;if(h&&false===h.onCleanup(q,s,h))m=false;else{N();a(w.add(x).add(C)).hide();a(k.add(e)).unbind();a(window).unbind("resize.fb scroll.fb");a(document).unbind("keydown.fb");k.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");h.titlePosition!=="inside"&&o.empty();d.stop();if(h.transitionOut=="elastic"){u=V();var g=d.position();n={top:g.top,left:g.left,width:d.width(),height:d.height()};
|
|
32
|
+
if(h.opacity)n.opacity=1;o.empty().hide();D.prop=1;a(D).animate({prop:0},{duration:h.speedOut,easing:h.easingOut,step:T,complete:c})}else d.fadeOut(h.transitionOut=="none"?0:h.speedOut,c)}}};a.fancybox.resize=function(){e.is(":visible")&&e.css("height",a(document).height());a.fancybox.center(true)};a.fancybox.center=function(c){var g,l;if(!m){l=c===true?1:0;g=U();!l&&(d.width()>g[0]||d.height()>g[1])||d.stop().animate({top:parseInt(Math.max(g[3]-20,g[3]+(g[1]-k.height()-40)*0.5-h.padding)),left:parseInt(Math.max(g[2]-
|
|
33
|
+
20,g[2]+(g[0]-k.width()-40)*0.5-h.padding))},typeof c=="number"?c:200)}};a.fancybox.init=function(){if(!a("#fancybox-wrap").length){a("body").append(b=a('<div id="fancybox-tmp"></div>'),f=a('<div id="fancybox-loading"><div></div></div>'),e=a('<div id="fancybox-overlay"></div>'),d=a('<div id="fancybox-wrap"></div>'));j=a('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(d);
|
|
34
|
+
j.append(k=a('<div id="fancybox-content"></div>'),w=a('<a id="fancybox-close"></a>'),o=a('<div id="fancybox-title"></div>'),x=a('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),C=a('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));w.click(a.fancybox.close);f.click(a.fancybox.cancel);x.click(function(c){c.preventDefault();a.fancybox.prev()});C.click(function(c){c.preventDefault();a.fancybox.next()});
|
|
35
|
+
a.fn.mousewheel&&d.bind("mousewheel.fb",function(c,g){if(m)c.preventDefault();else if(a(c.target).get(0).clientHeight==0||a(c.target).get(0).scrollHeight===a(c.target).get(0).clientHeight){c.preventDefault();a.fancybox[g>0?"prev":"next"]()}});a.support.opacity||d.addClass("fancybox-ie");if(M){f.addClass("fancybox-ie6");d.addClass("fancybox-ie6");a('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(j)}}};
|
|
36
|
+
a.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",
|
|
37
|
+
easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};a(document).ready(function(){a.fancybox.init()})})(jQuery);(function(){function a(){$("a.fancybox").each(function(){var b=this.href.replace(/aspect=\w+/g,"");this.href=b+(b.indexOf("?")<0?"?":"&")+"aspect=image&geometry=800x800>"});$("a.fancybox").fancybox({transitionIn:"none",transitionOut:"none",titlePosition:"over",titleFormat:function(b,f,e){return'<span id="fancybox-title-over">'+(e+1)+" / "+f.length+" "+(b?b:"")+"</span>"}})}$("#content").bind("pageLoaded",a);a()})();
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
|
|
2
|
+
* Licensed under the MIT License (LICENSE.txt).
|
|
3
|
+
*
|
|
4
|
+
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
|
|
5
|
+
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
|
|
6
|
+
* Thanks to: Seamus Leahy for adding deltaX and deltaY
|
|
7
|
+
*
|
|
8
|
+
* Version: 3.0.6
|
|
9
|
+
*
|
|
10
|
+
* Requires: 1.2.2+
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
(function($) {
|
|
14
|
+
|
|
15
|
+
var types = ['DOMMouseScroll', 'mousewheel'];
|
|
16
|
+
|
|
17
|
+
if ($.event.fixHooks) {
|
|
18
|
+
for ( var i=types.length; i; ) {
|
|
19
|
+
$.event.fixHooks[ types[--i] ] = $.event.mouseHooks;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
$.event.special.mousewheel = {
|
|
24
|
+
setup: function() {
|
|
25
|
+
if ( this.addEventListener ) {
|
|
26
|
+
for ( var i=types.length; i; ) {
|
|
27
|
+
this.addEventListener( types[--i], handler, false );
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
this.onmousewheel = handler;
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
teardown: function() {
|
|
35
|
+
if ( this.removeEventListener ) {
|
|
36
|
+
for ( var i=types.length; i; ) {
|
|
37
|
+
this.removeEventListener( types[--i], handler, false );
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
this.onmousewheel = null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
$.fn.extend({
|
|
46
|
+
mousewheel: function(fn) {
|
|
47
|
+
return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
unmousewheel: function(fn) {
|
|
51
|
+
return this.unbind("mousewheel", fn);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
function handler(event) {
|
|
57
|
+
var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
|
|
58
|
+
event = $.event.fix(orgEvent);
|
|
59
|
+
event.type = "mousewheel";
|
|
60
|
+
|
|
61
|
+
// Old school scrollwheel delta
|
|
62
|
+
if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta/120; }
|
|
63
|
+
if ( orgEvent.detail ) { delta = -orgEvent.detail/3; }
|
|
64
|
+
|
|
65
|
+
// New school multidimensional scroll (touchpads) deltas
|
|
66
|
+
deltaY = delta;
|
|
67
|
+
|
|
68
|
+
// Gecko
|
|
69
|
+
if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
|
|
70
|
+
deltaY = 0;
|
|
71
|
+
deltaX = -1*delta;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Webkit
|
|
75
|
+
if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; }
|
|
76
|
+
if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; }
|
|
77
|
+
|
|
78
|
+
// Add event and delta to the front of the arguments
|
|
79
|
+
args.unshift(event, delta, deltaX, deltaY);
|
|
80
|
+
|
|
81
|
+
return ($.event.dispatch || $.event.handle).apply(this, args);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
})(jQuery);
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
|
|
3
|
+
*
|
|
4
|
+
* Uses the built in easing capabilities added In jQuery 1.1
|
|
5
|
+
* to offer multiple easing options
|
|
6
|
+
*
|
|
7
|
+
* TERMS OF USE - jQuery Easing
|
|
8
|
+
*
|
|
9
|
+
* Open source under the BSD License.
|
|
10
|
+
*
|
|
11
|
+
* Copyright © 2008 George McGinley Smith
|
|
12
|
+
* All rights reserved.
|
|
13
|
+
*
|
|
14
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
|
15
|
+
* are permitted provided that the following conditions are met:
|
|
16
|
+
*
|
|
17
|
+
* Redistributions of source code must retain the above copyright notice, this list of
|
|
18
|
+
* conditions and the following disclaimer.
|
|
19
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list
|
|
20
|
+
* of conditions and the following disclaimer in the documentation and/or other materials
|
|
21
|
+
* provided with the distribution.
|
|
22
|
+
*
|
|
23
|
+
* Neither the name of the author nor the names of contributors may be used to endorse
|
|
24
|
+
* or promote products derived from this software without specific prior written permission.
|
|
25
|
+
*
|
|
26
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
27
|
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
28
|
+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
29
|
+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
30
|
+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
31
|
+
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
32
|
+
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
33
|
+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
34
|
+
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
// t: current time, b: begInnIng value, c: change In value, d: duration
|
|
39
|
+
jQuery.easing['jswing'] = jQuery.easing['swing'];
|
|
40
|
+
|
|
41
|
+
jQuery.extend( jQuery.easing,
|
|
42
|
+
{
|
|
43
|
+
def: 'easeOutQuad',
|
|
44
|
+
swing: function (x, t, b, c, d) {
|
|
45
|
+
//alert(jQuery.easing.default);
|
|
46
|
+
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
|
|
47
|
+
},
|
|
48
|
+
easeInQuad: function (x, t, b, c, d) {
|
|
49
|
+
return c*(t/=d)*t + b;
|
|
50
|
+
},
|
|
51
|
+
easeOutQuad: function (x, t, b, c, d) {
|
|
52
|
+
return -c *(t/=d)*(t-2) + b;
|
|
53
|
+
},
|
|
54
|
+
easeInOutQuad: function (x, t, b, c, d) {
|
|
55
|
+
if ((t/=d/2) < 1) return c/2*t*t + b;
|
|
56
|
+
return -c/2 * ((--t)*(t-2) - 1) + b;
|
|
57
|
+
},
|
|
58
|
+
easeInCubic: function (x, t, b, c, d) {
|
|
59
|
+
return c*(t/=d)*t*t + b;
|
|
60
|
+
},
|
|
61
|
+
easeOutCubic: function (x, t, b, c, d) {
|
|
62
|
+
return c*((t=t/d-1)*t*t + 1) + b;
|
|
63
|
+
},
|
|
64
|
+
easeInOutCubic: function (x, t, b, c, d) {
|
|
65
|
+
if ((t/=d/2) < 1) return c/2*t*t*t + b;
|
|
66
|
+
return c/2*((t-=2)*t*t + 2) + b;
|
|
67
|
+
},
|
|
68
|
+
easeInQuart: function (x, t, b, c, d) {
|
|
69
|
+
return c*(t/=d)*t*t*t + b;
|
|
70
|
+
},
|
|
71
|
+
easeOutQuart: function (x, t, b, c, d) {
|
|
72
|
+
return -c * ((t=t/d-1)*t*t*t - 1) + b;
|
|
73
|
+
},
|
|
74
|
+
easeInOutQuart: function (x, t, b, c, d) {
|
|
75
|
+
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
|
|
76
|
+
return -c/2 * ((t-=2)*t*t*t - 2) + b;
|
|
77
|
+
},
|
|
78
|
+
easeInQuint: function (x, t, b, c, d) {
|
|
79
|
+
return c*(t/=d)*t*t*t*t + b;
|
|
80
|
+
},
|
|
81
|
+
easeOutQuint: function (x, t, b, c, d) {
|
|
82
|
+
return c*((t=t/d-1)*t*t*t*t + 1) + b;
|
|
83
|
+
},
|
|
84
|
+
easeInOutQuint: function (x, t, b, c, d) {
|
|
85
|
+
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
|
|
86
|
+
return c/2*((t-=2)*t*t*t*t + 2) + b;
|
|
87
|
+
},
|
|
88
|
+
easeInSine: function (x, t, b, c, d) {
|
|
89
|
+
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
|
|
90
|
+
},
|
|
91
|
+
easeOutSine: function (x, t, b, c, d) {
|
|
92
|
+
return c * Math.sin(t/d * (Math.PI/2)) + b;
|
|
93
|
+
},
|
|
94
|
+
easeInOutSine: function (x, t, b, c, d) {
|
|
95
|
+
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
|
|
96
|
+
},
|
|
97
|
+
easeInExpo: function (x, t, b, c, d) {
|
|
98
|
+
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
|
|
99
|
+
},
|
|
100
|
+
easeOutExpo: function (x, t, b, c, d) {
|
|
101
|
+
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
|
|
102
|
+
},
|
|
103
|
+
easeInOutExpo: function (x, t, b, c, d) {
|
|
104
|
+
if (t==0) return b;
|
|
105
|
+
if (t==d) return b+c;
|
|
106
|
+
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
|
|
107
|
+
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
|
108
|
+
},
|
|
109
|
+
easeInCirc: function (x, t, b, c, d) {
|
|
110
|
+
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
|
|
111
|
+
},
|
|
112
|
+
easeOutCirc: function (x, t, b, c, d) {
|
|
113
|
+
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
|
|
114
|
+
},
|
|
115
|
+
easeInOutCirc: function (x, t, b, c, d) {
|
|
116
|
+
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
|
|
117
|
+
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
|
|
118
|
+
},
|
|
119
|
+
easeInElastic: function (x, t, b, c, d) {
|
|
120
|
+
var s=1.70158;var p=0;var a=c;
|
|
121
|
+
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
|
122
|
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
|
123
|
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
|
124
|
+
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
|
125
|
+
},
|
|
126
|
+
easeOutElastic: function (x, t, b, c, d) {
|
|
127
|
+
var s=1.70158;var p=0;var a=c;
|
|
128
|
+
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
|
129
|
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
|
130
|
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
|
131
|
+
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
|
|
132
|
+
},
|
|
133
|
+
easeInOutElastic: function (x, t, b, c, d) {
|
|
134
|
+
var s=1.70158;var p=0;var a=c;
|
|
135
|
+
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
|
|
136
|
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
|
137
|
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
|
138
|
+
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
|
139
|
+
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
|
|
140
|
+
},
|
|
141
|
+
easeInBack: function (x, t, b, c, d, s) {
|
|
142
|
+
if (s == undefined) s = 1.70158;
|
|
143
|
+
return c*(t/=d)*t*((s+1)*t - s) + b;
|
|
144
|
+
},
|
|
145
|
+
easeOutBack: function (x, t, b, c, d, s) {
|
|
146
|
+
if (s == undefined) s = 1.70158;
|
|
147
|
+
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
|
|
148
|
+
},
|
|
149
|
+
easeInOutBack: function (x, t, b, c, d, s) {
|
|
150
|
+
if (s == undefined) s = 1.70158;
|
|
151
|
+
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
|
|
152
|
+
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
|
|
153
|
+
},
|
|
154
|
+
easeInBounce: function (x, t, b, c, d) {
|
|
155
|
+
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
|
|
156
|
+
},
|
|
157
|
+
easeOutBounce: function (x, t, b, c, d) {
|
|
158
|
+
if ((t/=d) < (1/2.75)) {
|
|
159
|
+
return c*(7.5625*t*t) + b;
|
|
160
|
+
} else if (t < (2/2.75)) {
|
|
161
|
+
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
|
|
162
|
+
} else if (t < (2.5/2.75)) {
|
|
163
|
+
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
|
|
164
|
+
} else {
|
|
165
|
+
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
easeInOutBounce: function (x, t, b, c, d) {
|
|
169
|
+
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
|
|
170
|
+
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
/*
|
|
175
|
+
*
|
|
176
|
+
* TERMS OF USE - EASING EQUATIONS
|
|
177
|
+
*
|
|
178
|
+
* Open source under the BSD License.
|
|
179
|
+
*
|
|
180
|
+
* Copyright © 2001 Robert Penner
|
|
181
|
+
* All rights reserved.
|
|
182
|
+
*
|
|
183
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
|
184
|
+
* are permitted provided that the following conditions are met:
|
|
185
|
+
*
|
|
186
|
+
* Redistributions of source code must retain the above copyright notice, this list of
|
|
187
|
+
* conditions and the following disclaimer.
|
|
188
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list
|
|
189
|
+
* of conditions and the following disclaimer in the documentation and/or other materials
|
|
190
|
+
* provided with the distribution.
|
|
191
|
+
*
|
|
192
|
+
* Neither the name of the author nor the names of contributors may be used to endorse
|
|
193
|
+
* or promote products derived from this software without specific prior written permission.
|
|
194
|
+
*
|
|
195
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
196
|
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
197
|
+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
198
|
+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
199
|
+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
200
|
+
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
201
|
+
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
202
|
+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
203
|
+
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
204
|
+
*
|
|
205
|
+
*/
|
|
@@ -0,0 +1,1156 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* FancyBox - jQuery Plugin
|
|
3
|
+
* Simple and fancy lightbox alternative
|
|
4
|
+
*
|
|
5
|
+
* Examples and documentation at: http://fancybox.net
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2008 - 2010 Janis Skarnelis
|
|
8
|
+
* That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
|
|
9
|
+
*
|
|
10
|
+
* Version: 1.3.4 (11/11/2010)
|
|
11
|
+
* Requires: jQuery v1.3+
|
|
12
|
+
*
|
|
13
|
+
* Dual licensed under the MIT and GPL licenses:
|
|
14
|
+
* http://www.opensource.org/licenses/mit-license.php
|
|
15
|
+
* http://www.gnu.org/licenses/gpl.html
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
;(function($) {
|
|
19
|
+
var tmp, loading, overlay, wrap, outer, content, close, title, nav_left, nav_right,
|
|
20
|
+
|
|
21
|
+
selectedIndex = 0, selectedOpts = {}, selectedArray = [], currentIndex = 0, currentOpts = {}, currentArray = [],
|
|
22
|
+
|
|
23
|
+
ajaxLoader = null, imgPreloader = new Image(), imgRegExp = /\.(jpg|gif|png|bmp|jpeg)(.*)?$/i, swfRegExp = /[^\.]\.(swf)\s*$/i,
|
|
24
|
+
|
|
25
|
+
loadingTimer, loadingFrame = 1,
|
|
26
|
+
|
|
27
|
+
titleHeight = 0, titleStr = '', start_pos, final_pos, busy = false, fx = $.extend($('<div/>')[0], { prop: 0 }),
|
|
28
|
+
|
|
29
|
+
isIE6 = $.browser.msie && $.browser.version < 7 && !window.XMLHttpRequest,
|
|
30
|
+
|
|
31
|
+
/*
|
|
32
|
+
* Private methods
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
_abort = function() {
|
|
36
|
+
loading.hide();
|
|
37
|
+
|
|
38
|
+
imgPreloader.onerror = imgPreloader.onload = null;
|
|
39
|
+
|
|
40
|
+
if (ajaxLoader) {
|
|
41
|
+
ajaxLoader.abort();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
tmp.empty();
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
_error = function() {
|
|
48
|
+
if (false === selectedOpts.onError(selectedArray, selectedIndex, selectedOpts)) {
|
|
49
|
+
loading.hide();
|
|
50
|
+
busy = false;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
selectedOpts.titleShow = false;
|
|
55
|
+
|
|
56
|
+
selectedOpts.width = 'auto';
|
|
57
|
+
selectedOpts.height = 'auto';
|
|
58
|
+
|
|
59
|
+
tmp.html( '<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>' );
|
|
60
|
+
|
|
61
|
+
_process_inline();
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
_start = function() {
|
|
65
|
+
var obj = selectedArray[ selectedIndex ],
|
|
66
|
+
href,
|
|
67
|
+
type,
|
|
68
|
+
title,
|
|
69
|
+
str,
|
|
70
|
+
emb,
|
|
71
|
+
ret;
|
|
72
|
+
|
|
73
|
+
_abort();
|
|
74
|
+
|
|
75
|
+
selectedOpts = $.extend({}, $.fn.fancybox.defaults, (typeof $(obj).data('fancybox') == 'undefined' ? selectedOpts : $(obj).data('fancybox')));
|
|
76
|
+
|
|
77
|
+
ret = selectedOpts.onStart(selectedArray, selectedIndex, selectedOpts);
|
|
78
|
+
|
|
79
|
+
if (ret === false) {
|
|
80
|
+
busy = false;
|
|
81
|
+
return;
|
|
82
|
+
} else if (typeof ret == 'object') {
|
|
83
|
+
selectedOpts = $.extend(selectedOpts, ret);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
title = selectedOpts.title || (obj.nodeName ? $(obj).attr('title') : obj.title) || '';
|
|
87
|
+
|
|
88
|
+
if (obj.nodeName && !selectedOpts.orig) {
|
|
89
|
+
selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (title === '' && selectedOpts.orig && selectedOpts.titleFromAlt) {
|
|
93
|
+
title = selectedOpts.orig.attr('alt');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
href = selectedOpts.href || (obj.nodeName ? $(obj).attr('href') : obj.href) || null;
|
|
97
|
+
|
|
98
|
+
if ((/^(?:javascript)/i).test(href) || href == '#') {
|
|
99
|
+
href = null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (selectedOpts.type) {
|
|
103
|
+
type = selectedOpts.type;
|
|
104
|
+
|
|
105
|
+
if (!href) {
|
|
106
|
+
href = selectedOpts.content;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
} else if (selectedOpts.content) {
|
|
110
|
+
type = 'html';
|
|
111
|
+
|
|
112
|
+
} else if (href) {
|
|
113
|
+
if (href.match(imgRegExp)) {
|
|
114
|
+
type = 'image';
|
|
115
|
+
|
|
116
|
+
} else if (href.match(swfRegExp)) {
|
|
117
|
+
type = 'swf';
|
|
118
|
+
|
|
119
|
+
} else if ($(obj).hasClass("iframe")) {
|
|
120
|
+
type = 'iframe';
|
|
121
|
+
|
|
122
|
+
} else if (href.indexOf("#") === 0) {
|
|
123
|
+
type = 'inline';
|
|
124
|
+
|
|
125
|
+
} else {
|
|
126
|
+
type = 'ajax';
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (!type) {
|
|
131
|
+
_error();
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (type == 'inline') {
|
|
136
|
+
obj = href.substr(href.indexOf("#"));
|
|
137
|
+
type = $(obj).length > 0 ? 'inline' : 'ajax';
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
selectedOpts.type = type;
|
|
141
|
+
selectedOpts.href = href;
|
|
142
|
+
selectedOpts.title = title;
|
|
143
|
+
|
|
144
|
+
if (selectedOpts.autoDimensions) {
|
|
145
|
+
if (selectedOpts.type == 'html' || selectedOpts.type == 'inline' || selectedOpts.type == 'ajax') {
|
|
146
|
+
selectedOpts.width = 'auto';
|
|
147
|
+
selectedOpts.height = 'auto';
|
|
148
|
+
} else {
|
|
149
|
+
selectedOpts.autoDimensions = false;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (selectedOpts.modal) {
|
|
154
|
+
selectedOpts.overlayShow = true;
|
|
155
|
+
selectedOpts.hideOnOverlayClick = false;
|
|
156
|
+
selectedOpts.hideOnContentClick = false;
|
|
157
|
+
selectedOpts.enableEscapeButton = false;
|
|
158
|
+
selectedOpts.showCloseButton = false;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
selectedOpts.padding = parseInt(selectedOpts.padding, 10);
|
|
162
|
+
selectedOpts.margin = parseInt(selectedOpts.margin, 10);
|
|
163
|
+
|
|
164
|
+
tmp.css('padding', (selectedOpts.padding + selectedOpts.margin));
|
|
165
|
+
|
|
166
|
+
$('.fancybox-inline-tmp').unbind('fancybox-cancel').bind('fancybox-change', function() {
|
|
167
|
+
$(this).replaceWith(content.children());
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
switch (type) {
|
|
171
|
+
case 'html' :
|
|
172
|
+
tmp.html( selectedOpts.content );
|
|
173
|
+
_process_inline();
|
|
174
|
+
break;
|
|
175
|
+
|
|
176
|
+
case 'inline' :
|
|
177
|
+
if ( $(obj).parent().is('#fancybox-content') === true) {
|
|
178
|
+
busy = false;
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
$('<div class="fancybox-inline-tmp" />')
|
|
183
|
+
.hide()
|
|
184
|
+
.insertBefore( $(obj) )
|
|
185
|
+
.bind('fancybox-cleanup', function() {
|
|
186
|
+
$(this).replaceWith(content.children());
|
|
187
|
+
}).bind('fancybox-cancel', function() {
|
|
188
|
+
$(this).replaceWith(tmp.children());
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
$(obj).appendTo(tmp);
|
|
192
|
+
|
|
193
|
+
_process_inline();
|
|
194
|
+
break;
|
|
195
|
+
|
|
196
|
+
case 'image':
|
|
197
|
+
busy = false;
|
|
198
|
+
|
|
199
|
+
$.fancybox.showActivity();
|
|
200
|
+
|
|
201
|
+
imgPreloader = new Image();
|
|
202
|
+
|
|
203
|
+
imgPreloader.onerror = function() {
|
|
204
|
+
_error();
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
imgPreloader.onload = function() {
|
|
208
|
+
busy = true;
|
|
209
|
+
|
|
210
|
+
imgPreloader.onerror = imgPreloader.onload = null;
|
|
211
|
+
|
|
212
|
+
_process_image();
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
imgPreloader.src = href;
|
|
216
|
+
break;
|
|
217
|
+
|
|
218
|
+
case 'swf':
|
|
219
|
+
selectedOpts.scrolling = 'no';
|
|
220
|
+
|
|
221
|
+
str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"><param name="movie" value="' + href + '"></param>';
|
|
222
|
+
emb = '';
|
|
223
|
+
|
|
224
|
+
$.each(selectedOpts.swf, function(name, val) {
|
|
225
|
+
str += '<param name="' + name + '" value="' + val + '"></param>';
|
|
226
|
+
emb += ' ' + name + '="' + val + '"';
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
str += '<embed src="' + href + '" type="application/x-shockwave-flash" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"' + emb + '></embed></object>';
|
|
230
|
+
|
|
231
|
+
tmp.html(str);
|
|
232
|
+
|
|
233
|
+
_process_inline();
|
|
234
|
+
break;
|
|
235
|
+
|
|
236
|
+
case 'ajax':
|
|
237
|
+
busy = false;
|
|
238
|
+
|
|
239
|
+
$.fancybox.showActivity();
|
|
240
|
+
|
|
241
|
+
selectedOpts.ajax.win = selectedOpts.ajax.success;
|
|
242
|
+
|
|
243
|
+
ajaxLoader = $.ajax($.extend({}, selectedOpts.ajax, {
|
|
244
|
+
url : href,
|
|
245
|
+
data : selectedOpts.ajax.data || {},
|
|
246
|
+
error : function(XMLHttpRequest, textStatus, errorThrown) {
|
|
247
|
+
if ( XMLHttpRequest.status > 0 ) {
|
|
248
|
+
_error();
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
success : function(data, textStatus, XMLHttpRequest) {
|
|
252
|
+
var o = typeof XMLHttpRequest == 'object' ? XMLHttpRequest : ajaxLoader;
|
|
253
|
+
if (o.status == 200) {
|
|
254
|
+
if ( typeof selectedOpts.ajax.win == 'function' ) {
|
|
255
|
+
ret = selectedOpts.ajax.win(href, data, textStatus, XMLHttpRequest);
|
|
256
|
+
|
|
257
|
+
if (ret === false) {
|
|
258
|
+
loading.hide();
|
|
259
|
+
return;
|
|
260
|
+
} else if (typeof ret == 'string' || typeof ret == 'object') {
|
|
261
|
+
data = ret;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
tmp.html( data );
|
|
266
|
+
_process_inline();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}));
|
|
270
|
+
|
|
271
|
+
break;
|
|
272
|
+
|
|
273
|
+
case 'iframe':
|
|
274
|
+
_show();
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
_process_inline = function() {
|
|
280
|
+
var
|
|
281
|
+
w = selectedOpts.width,
|
|
282
|
+
h = selectedOpts.height;
|
|
283
|
+
|
|
284
|
+
if (w.toString().indexOf('%') > -1) {
|
|
285
|
+
w = parseInt( ($(window).width() - (selectedOpts.margin * 2)) * parseFloat(w) / 100, 10) + 'px';
|
|
286
|
+
|
|
287
|
+
} else {
|
|
288
|
+
w = w == 'auto' ? 'auto' : w + 'px';
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if (h.toString().indexOf('%') > -1) {
|
|
292
|
+
h = parseInt( ($(window).height() - (selectedOpts.margin * 2)) * parseFloat(h) / 100, 10) + 'px';
|
|
293
|
+
|
|
294
|
+
} else {
|
|
295
|
+
h = h == 'auto' ? 'auto' : h + 'px';
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
tmp.wrapInner('<div style="width:' + w + ';height:' + h + ';overflow: ' + (selectedOpts.scrolling == 'auto' ? 'auto' : (selectedOpts.scrolling == 'yes' ? 'scroll' : 'hidden')) + ';position:relative;"></div>');
|
|
299
|
+
|
|
300
|
+
selectedOpts.width = tmp.width();
|
|
301
|
+
selectedOpts.height = tmp.height();
|
|
302
|
+
|
|
303
|
+
_show();
|
|
304
|
+
},
|
|
305
|
+
|
|
306
|
+
_process_image = function() {
|
|
307
|
+
selectedOpts.width = imgPreloader.width;
|
|
308
|
+
selectedOpts.height = imgPreloader.height;
|
|
309
|
+
|
|
310
|
+
$("<img />").attr({
|
|
311
|
+
'id' : 'fancybox-img',
|
|
312
|
+
'src' : imgPreloader.src,
|
|
313
|
+
'alt' : selectedOpts.title
|
|
314
|
+
}).appendTo( tmp );
|
|
315
|
+
|
|
316
|
+
_show();
|
|
317
|
+
},
|
|
318
|
+
|
|
319
|
+
_show = function() {
|
|
320
|
+
var pos, equal;
|
|
321
|
+
|
|
322
|
+
loading.hide();
|
|
323
|
+
|
|
324
|
+
if (wrap.is(":visible") && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
|
|
325
|
+
$.event.trigger('fancybox-cancel');
|
|
326
|
+
|
|
327
|
+
busy = false;
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
busy = true;
|
|
332
|
+
|
|
333
|
+
$(content.add( overlay )).unbind();
|
|
334
|
+
|
|
335
|
+
$(window).unbind("resize.fb scroll.fb");
|
|
336
|
+
$(document).unbind('keydown.fb');
|
|
337
|
+
|
|
338
|
+
if (wrap.is(":visible") && currentOpts.titlePosition !== 'outside') {
|
|
339
|
+
wrap.css('height', wrap.height());
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
currentArray = selectedArray;
|
|
343
|
+
currentIndex = selectedIndex;
|
|
344
|
+
currentOpts = selectedOpts;
|
|
345
|
+
|
|
346
|
+
if (currentOpts.overlayShow) {
|
|
347
|
+
overlay.css({
|
|
348
|
+
'background-color' : currentOpts.overlayColor,
|
|
349
|
+
'opacity' : currentOpts.overlayOpacity,
|
|
350
|
+
'cursor' : currentOpts.hideOnOverlayClick ? 'pointer' : 'auto',
|
|
351
|
+
'height' : $(document).height()
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
if (!overlay.is(':visible')) {
|
|
355
|
+
if (isIE6) {
|
|
356
|
+
$('select:not(#fancybox-tmp select)').filter(function() {
|
|
357
|
+
return this.style.visibility !== 'hidden';
|
|
358
|
+
}).css({'visibility' : 'hidden'}).one('fancybox-cleanup', function() {
|
|
359
|
+
this.style.visibility = 'inherit';
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
overlay.show();
|
|
364
|
+
}
|
|
365
|
+
} else {
|
|
366
|
+
overlay.hide();
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
final_pos = _get_zoom_to();
|
|
370
|
+
|
|
371
|
+
_process_title();
|
|
372
|
+
|
|
373
|
+
if (wrap.is(":visible")) {
|
|
374
|
+
$( close.add( nav_left ).add( nav_right ) ).hide();
|
|
375
|
+
|
|
376
|
+
pos = wrap.position(),
|
|
377
|
+
|
|
378
|
+
start_pos = {
|
|
379
|
+
top : pos.top,
|
|
380
|
+
left : pos.left,
|
|
381
|
+
width : wrap.width(),
|
|
382
|
+
height : wrap.height()
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
equal = (start_pos.width == final_pos.width && start_pos.height == final_pos.height);
|
|
386
|
+
|
|
387
|
+
content.fadeTo(currentOpts.changeFade, 0.3, function() {
|
|
388
|
+
var finish_resizing = function() {
|
|
389
|
+
content.html( tmp.contents() ).fadeTo(currentOpts.changeFade, 1, _finish);
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
$.event.trigger('fancybox-change');
|
|
393
|
+
|
|
394
|
+
content
|
|
395
|
+
.empty()
|
|
396
|
+
.removeAttr('filter')
|
|
397
|
+
.css({
|
|
398
|
+
'border-width' : currentOpts.padding,
|
|
399
|
+
'width' : final_pos.width - currentOpts.padding * 2,
|
|
400
|
+
'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
if (equal) {
|
|
404
|
+
finish_resizing();
|
|
405
|
+
|
|
406
|
+
} else {
|
|
407
|
+
fx.prop = 0;
|
|
408
|
+
|
|
409
|
+
$(fx).animate({prop: 1}, {
|
|
410
|
+
duration : currentOpts.changeSpeed,
|
|
411
|
+
easing : currentOpts.easingChange,
|
|
412
|
+
step : _draw,
|
|
413
|
+
complete : finish_resizing
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
wrap.removeAttr("style");
|
|
422
|
+
|
|
423
|
+
content.css('border-width', currentOpts.padding);
|
|
424
|
+
|
|
425
|
+
if (currentOpts.transitionIn == 'elastic') {
|
|
426
|
+
start_pos = _get_zoom_from();
|
|
427
|
+
|
|
428
|
+
content.html( tmp.contents() );
|
|
429
|
+
|
|
430
|
+
wrap.show();
|
|
431
|
+
|
|
432
|
+
if (currentOpts.opacity) {
|
|
433
|
+
final_pos.opacity = 0;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
fx.prop = 0;
|
|
437
|
+
|
|
438
|
+
$(fx).animate({prop: 1}, {
|
|
439
|
+
duration : currentOpts.speedIn,
|
|
440
|
+
easing : currentOpts.easingIn,
|
|
441
|
+
step : _draw,
|
|
442
|
+
complete : _finish
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
if (currentOpts.titlePosition == 'inside' && titleHeight > 0) {
|
|
449
|
+
title.show();
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
content
|
|
453
|
+
.css({
|
|
454
|
+
'width' : final_pos.width - currentOpts.padding * 2,
|
|
455
|
+
'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
|
|
456
|
+
})
|
|
457
|
+
.html( tmp.contents() );
|
|
458
|
+
|
|
459
|
+
wrap
|
|
460
|
+
.css(final_pos)
|
|
461
|
+
.fadeIn( currentOpts.transitionIn == 'none' ? 0 : currentOpts.speedIn, _finish );
|
|
462
|
+
},
|
|
463
|
+
|
|
464
|
+
_format_title = function(title) {
|
|
465
|
+
if (title && title.length) {
|
|
466
|
+
if (currentOpts.titlePosition == 'float') {
|
|
467
|
+
return '<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">' + title + '</td><td id="fancybox-title-float-right"></td></tr></table>';
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
return '<div id="fancybox-title-' + currentOpts.titlePosition + '">' + title + '</div>';
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
return false;
|
|
474
|
+
},
|
|
475
|
+
|
|
476
|
+
_process_title = function() {
|
|
477
|
+
titleStr = currentOpts.title || '';
|
|
478
|
+
titleHeight = 0;
|
|
479
|
+
|
|
480
|
+
title
|
|
481
|
+
.empty()
|
|
482
|
+
.removeAttr('style')
|
|
483
|
+
.removeClass();
|
|
484
|
+
|
|
485
|
+
if (currentOpts.titleShow === false) {
|
|
486
|
+
title.hide();
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
titleStr = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(titleStr, currentArray, currentIndex, currentOpts) : _format_title(titleStr);
|
|
491
|
+
|
|
492
|
+
if (!titleStr || titleStr === '') {
|
|
493
|
+
title.hide();
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
title
|
|
498
|
+
.addClass('fancybox-title-' + currentOpts.titlePosition)
|
|
499
|
+
.html( titleStr )
|
|
500
|
+
.appendTo( 'body' )
|
|
501
|
+
.show();
|
|
502
|
+
|
|
503
|
+
switch (currentOpts.titlePosition) {
|
|
504
|
+
case 'inside':
|
|
505
|
+
title
|
|
506
|
+
.css({
|
|
507
|
+
'width' : final_pos.width - (currentOpts.padding * 2),
|
|
508
|
+
'marginLeft' : currentOpts.padding,
|
|
509
|
+
'marginRight' : currentOpts.padding
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
titleHeight = title.outerHeight(true);
|
|
513
|
+
|
|
514
|
+
title.appendTo( outer );
|
|
515
|
+
|
|
516
|
+
final_pos.height += titleHeight;
|
|
517
|
+
break;
|
|
518
|
+
|
|
519
|
+
case 'over':
|
|
520
|
+
title
|
|
521
|
+
.css({
|
|
522
|
+
'marginLeft' : currentOpts.padding,
|
|
523
|
+
'width' : final_pos.width - (currentOpts.padding * 2),
|
|
524
|
+
'bottom' : currentOpts.padding
|
|
525
|
+
})
|
|
526
|
+
.appendTo( outer );
|
|
527
|
+
break;
|
|
528
|
+
|
|
529
|
+
case 'float':
|
|
530
|
+
title
|
|
531
|
+
.css('left', parseInt((title.width() - final_pos.width - 40)/ 2, 10) * -1)
|
|
532
|
+
.appendTo( wrap );
|
|
533
|
+
break;
|
|
534
|
+
|
|
535
|
+
default:
|
|
536
|
+
title
|
|
537
|
+
.css({
|
|
538
|
+
'width' : final_pos.width - (currentOpts.padding * 2),
|
|
539
|
+
'paddingLeft' : currentOpts.padding,
|
|
540
|
+
'paddingRight' : currentOpts.padding
|
|
541
|
+
})
|
|
542
|
+
.appendTo( wrap );
|
|
543
|
+
break;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
title.hide();
|
|
547
|
+
},
|
|
548
|
+
|
|
549
|
+
_set_navigation = function() {
|
|
550
|
+
if (currentOpts.enableEscapeButton || currentOpts.enableKeyboardNav) {
|
|
551
|
+
$(document).bind('keydown.fb', function(e) {
|
|
552
|
+
if (e.keyCode == 27 && currentOpts.enableEscapeButton) {
|
|
553
|
+
e.preventDefault();
|
|
554
|
+
$.fancybox.close();
|
|
555
|
+
|
|
556
|
+
} else if ((e.keyCode == 37 || e.keyCode == 39) && currentOpts.enableKeyboardNav && e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') {
|
|
557
|
+
e.preventDefault();
|
|
558
|
+
$.fancybox[ e.keyCode == 37 ? 'prev' : 'next']();
|
|
559
|
+
}
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
if (!currentOpts.showNavArrows) {
|
|
564
|
+
nav_left.hide();
|
|
565
|
+
nav_right.hide();
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex !== 0) {
|
|
570
|
+
nav_left.show();
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex != (currentArray.length -1)) {
|
|
574
|
+
nav_right.show();
|
|
575
|
+
}
|
|
576
|
+
},
|
|
577
|
+
|
|
578
|
+
_finish = function () {
|
|
579
|
+
if (!$.support.opacity) {
|
|
580
|
+
content.get(0).style.removeAttribute('filter');
|
|
581
|
+
wrap.get(0).style.removeAttribute('filter');
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
if (selectedOpts.autoDimensions) {
|
|
585
|
+
content.css('height', 'auto');
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
wrap.css('height', 'auto');
|
|
589
|
+
|
|
590
|
+
if (titleStr && titleStr.length) {
|
|
591
|
+
title.show();
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
if (currentOpts.showCloseButton) {
|
|
595
|
+
close.show();
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
_set_navigation();
|
|
599
|
+
|
|
600
|
+
if (currentOpts.hideOnContentClick) {
|
|
601
|
+
content.bind('click', $.fancybox.close);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
if (currentOpts.hideOnOverlayClick) {
|
|
605
|
+
overlay.bind('click', $.fancybox.close);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
$(window).bind("resize.fb", $.fancybox.resize);
|
|
609
|
+
|
|
610
|
+
if (currentOpts.centerOnScroll) {
|
|
611
|
+
$(window).bind("scroll.fb", $.fancybox.center);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
if (currentOpts.type == 'iframe') {
|
|
615
|
+
$('<iframe id="fancybox-frame" name="fancybox-frame' + new Date().getTime() + '" frameborder="0" hspace="0" ' + ($.browser.msie ? 'allowtransparency="true""' : '') + ' scrolling="' + selectedOpts.scrolling + '" src="' + currentOpts.href + '"></iframe>').appendTo(content);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
wrap.show();
|
|
619
|
+
|
|
620
|
+
busy = false;
|
|
621
|
+
|
|
622
|
+
$.fancybox.center();
|
|
623
|
+
|
|
624
|
+
currentOpts.onComplete(currentArray, currentIndex, currentOpts);
|
|
625
|
+
|
|
626
|
+
_preload_images();
|
|
627
|
+
},
|
|
628
|
+
|
|
629
|
+
_preload_images = function() {
|
|
630
|
+
var href,
|
|
631
|
+
objNext;
|
|
632
|
+
|
|
633
|
+
if ((currentArray.length -1) > currentIndex) {
|
|
634
|
+
href = currentArray[ currentIndex + 1 ].href;
|
|
635
|
+
|
|
636
|
+
if (typeof href !== 'undefined' && href.match(imgRegExp)) {
|
|
637
|
+
objNext = new Image();
|
|
638
|
+
objNext.src = href;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
if (currentIndex > 0) {
|
|
643
|
+
href = currentArray[ currentIndex - 1 ].href;
|
|
644
|
+
|
|
645
|
+
if (typeof href !== 'undefined' && href.match(imgRegExp)) {
|
|
646
|
+
objNext = new Image();
|
|
647
|
+
objNext.src = href;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
},
|
|
651
|
+
|
|
652
|
+
_draw = function(pos) {
|
|
653
|
+
var dim = {
|
|
654
|
+
width : parseInt(start_pos.width + (final_pos.width - start_pos.width) * pos, 10),
|
|
655
|
+
height : parseInt(start_pos.height + (final_pos.height - start_pos.height) * pos, 10),
|
|
656
|
+
|
|
657
|
+
top : parseInt(start_pos.top + (final_pos.top - start_pos.top) * pos, 10),
|
|
658
|
+
left : parseInt(start_pos.left + (final_pos.left - start_pos.left) * pos, 10)
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
if (typeof final_pos.opacity !== 'undefined') {
|
|
662
|
+
dim.opacity = pos < 0.5 ? 0.5 : pos;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
wrap.css(dim);
|
|
666
|
+
|
|
667
|
+
content.css({
|
|
668
|
+
'width' : dim.width - currentOpts.padding * 2,
|
|
669
|
+
'height' : dim.height - (titleHeight * pos) - currentOpts.padding * 2
|
|
670
|
+
});
|
|
671
|
+
},
|
|
672
|
+
|
|
673
|
+
_get_viewport = function() {
|
|
674
|
+
return [
|
|
675
|
+
$(window).width() - (currentOpts.margin * 2),
|
|
676
|
+
$(window).height() - (currentOpts.margin * 2),
|
|
677
|
+
$(document).scrollLeft() + currentOpts.margin,
|
|
678
|
+
$(document).scrollTop() + currentOpts.margin
|
|
679
|
+
];
|
|
680
|
+
},
|
|
681
|
+
|
|
682
|
+
_get_zoom_to = function () {
|
|
683
|
+
var view = _get_viewport(),
|
|
684
|
+
to = {},
|
|
685
|
+
resize = currentOpts.autoScale,
|
|
686
|
+
double_padding = currentOpts.padding * 2,
|
|
687
|
+
ratio;
|
|
688
|
+
|
|
689
|
+
if (currentOpts.width.toString().indexOf('%') > -1) {
|
|
690
|
+
to.width = parseInt((view[0] * parseFloat(currentOpts.width)) / 100, 10);
|
|
691
|
+
} else {
|
|
692
|
+
to.width = currentOpts.width + double_padding;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
if (currentOpts.height.toString().indexOf('%') > -1) {
|
|
696
|
+
to.height = parseInt((view[1] * parseFloat(currentOpts.height)) / 100, 10);
|
|
697
|
+
} else {
|
|
698
|
+
to.height = currentOpts.height + double_padding;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
if (resize && (to.width > view[0] || to.height > view[1])) {
|
|
702
|
+
if (selectedOpts.type == 'image' || selectedOpts.type == 'swf') {
|
|
703
|
+
ratio = (currentOpts.width ) / (currentOpts.height );
|
|
704
|
+
|
|
705
|
+
if ((to.width ) > view[0]) {
|
|
706
|
+
to.width = view[0];
|
|
707
|
+
to.height = parseInt(((to.width - double_padding) / ratio) + double_padding, 10);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
if ((to.height) > view[1]) {
|
|
711
|
+
to.height = view[1];
|
|
712
|
+
to.width = parseInt(((to.height - double_padding) * ratio) + double_padding, 10);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
} else {
|
|
716
|
+
to.width = Math.min(to.width, view[0]);
|
|
717
|
+
to.height = Math.min(to.height, view[1]);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
to.top = parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - to.height - 40) * 0.5)), 10);
|
|
722
|
+
to.left = parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - to.width - 40) * 0.5)), 10);
|
|
723
|
+
|
|
724
|
+
return to;
|
|
725
|
+
},
|
|
726
|
+
|
|
727
|
+
_get_obj_pos = function(obj) {
|
|
728
|
+
var pos = obj.offset();
|
|
729
|
+
|
|
730
|
+
pos.top += parseInt( obj.css('paddingTop'), 10 ) || 0;
|
|
731
|
+
pos.left += parseInt( obj.css('paddingLeft'), 10 ) || 0;
|
|
732
|
+
|
|
733
|
+
pos.top += parseInt( obj.css('border-top-width'), 10 ) || 0;
|
|
734
|
+
pos.left += parseInt( obj.css('border-left-width'), 10 ) || 0;
|
|
735
|
+
|
|
736
|
+
pos.width = obj.width();
|
|
737
|
+
pos.height = obj.height();
|
|
738
|
+
|
|
739
|
+
return pos;
|
|
740
|
+
},
|
|
741
|
+
|
|
742
|
+
_get_zoom_from = function() {
|
|
743
|
+
var orig = selectedOpts.orig ? $(selectedOpts.orig) : false,
|
|
744
|
+
from = {},
|
|
745
|
+
pos,
|
|
746
|
+
view;
|
|
747
|
+
|
|
748
|
+
if (orig && orig.length) {
|
|
749
|
+
pos = _get_obj_pos(orig);
|
|
750
|
+
|
|
751
|
+
from = {
|
|
752
|
+
width : pos.width + (currentOpts.padding * 2),
|
|
753
|
+
height : pos.height + (currentOpts.padding * 2),
|
|
754
|
+
top : pos.top - currentOpts.padding - 20,
|
|
755
|
+
left : pos.left - currentOpts.padding - 20
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
} else {
|
|
759
|
+
view = _get_viewport();
|
|
760
|
+
|
|
761
|
+
from = {
|
|
762
|
+
width : currentOpts.padding * 2,
|
|
763
|
+
height : currentOpts.padding * 2,
|
|
764
|
+
top : parseInt(view[3] + view[1] * 0.5, 10),
|
|
765
|
+
left : parseInt(view[2] + view[0] * 0.5, 10)
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
return from;
|
|
770
|
+
},
|
|
771
|
+
|
|
772
|
+
_animate_loading = function() {
|
|
773
|
+
if (!loading.is(':visible')){
|
|
774
|
+
clearInterval(loadingTimer);
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
$('div', loading).css('top', (loadingFrame * -40) + 'px');
|
|
779
|
+
|
|
780
|
+
loadingFrame = (loadingFrame + 1) % 12;
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
/*
|
|
784
|
+
* Public methods
|
|
785
|
+
*/
|
|
786
|
+
|
|
787
|
+
$.fn.fancybox = function(options) {
|
|
788
|
+
if (!$(this).length) {
|
|
789
|
+
return this;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
$(this)
|
|
793
|
+
.data('fancybox', $.extend({}, options, ($.metadata ? $(this).metadata() : {})))
|
|
794
|
+
.unbind('click.fb')
|
|
795
|
+
.bind('click.fb', function(e) {
|
|
796
|
+
e.preventDefault();
|
|
797
|
+
|
|
798
|
+
if (busy) {
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
busy = true;
|
|
803
|
+
|
|
804
|
+
$(this).blur();
|
|
805
|
+
|
|
806
|
+
selectedArray = [];
|
|
807
|
+
selectedIndex = 0;
|
|
808
|
+
|
|
809
|
+
var rel = $(this).attr('rel') || '';
|
|
810
|
+
|
|
811
|
+
if (!rel || rel == '' || rel === 'nofollow') {
|
|
812
|
+
selectedArray.push(this);
|
|
813
|
+
|
|
814
|
+
} else {
|
|
815
|
+
selectedArray = $("a[rel=" + rel + "], area[rel=" + rel + "]");
|
|
816
|
+
selectedIndex = selectedArray.index( this );
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
_start();
|
|
820
|
+
|
|
821
|
+
return;
|
|
822
|
+
});
|
|
823
|
+
|
|
824
|
+
return this;
|
|
825
|
+
};
|
|
826
|
+
|
|
827
|
+
$.fancybox = function(obj) {
|
|
828
|
+
var opts;
|
|
829
|
+
|
|
830
|
+
if (busy) {
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
busy = true;
|
|
835
|
+
opts = typeof arguments[1] !== 'undefined' ? arguments[1] : {};
|
|
836
|
+
|
|
837
|
+
selectedArray = [];
|
|
838
|
+
selectedIndex = parseInt(opts.index, 10) || 0;
|
|
839
|
+
|
|
840
|
+
if ($.isArray(obj)) {
|
|
841
|
+
for (var i = 0, j = obj.length; i < j; i++) {
|
|
842
|
+
if (typeof obj[i] == 'object') {
|
|
843
|
+
$(obj[i]).data('fancybox', $.extend({}, opts, obj[i]));
|
|
844
|
+
} else {
|
|
845
|
+
obj[i] = $({}).data('fancybox', $.extend({content : obj[i]}, opts));
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
selectedArray = jQuery.merge(selectedArray, obj);
|
|
850
|
+
|
|
851
|
+
} else {
|
|
852
|
+
if (typeof obj == 'object') {
|
|
853
|
+
$(obj).data('fancybox', $.extend({}, opts, obj));
|
|
854
|
+
} else {
|
|
855
|
+
obj = $({}).data('fancybox', $.extend({content : obj}, opts));
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
selectedArray.push(obj);
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
if (selectedIndex > selectedArray.length || selectedIndex < 0) {
|
|
862
|
+
selectedIndex = 0;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
_start();
|
|
866
|
+
};
|
|
867
|
+
|
|
868
|
+
$.fancybox.showActivity = function() {
|
|
869
|
+
clearInterval(loadingTimer);
|
|
870
|
+
|
|
871
|
+
loading.show();
|
|
872
|
+
loadingTimer = setInterval(_animate_loading, 66);
|
|
873
|
+
};
|
|
874
|
+
|
|
875
|
+
$.fancybox.hideActivity = function() {
|
|
876
|
+
loading.hide();
|
|
877
|
+
};
|
|
878
|
+
|
|
879
|
+
$.fancybox.next = function() {
|
|
880
|
+
return $.fancybox.pos( currentIndex + 1);
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
$.fancybox.prev = function() {
|
|
884
|
+
return $.fancybox.pos( currentIndex - 1);
|
|
885
|
+
};
|
|
886
|
+
|
|
887
|
+
$.fancybox.pos = function(pos) {
|
|
888
|
+
if (busy) {
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
pos = parseInt(pos);
|
|
893
|
+
|
|
894
|
+
selectedArray = currentArray;
|
|
895
|
+
|
|
896
|
+
if (pos > -1 && pos < currentArray.length) {
|
|
897
|
+
selectedIndex = pos;
|
|
898
|
+
_start();
|
|
899
|
+
|
|
900
|
+
} else if (currentOpts.cyclic && currentArray.length > 1) {
|
|
901
|
+
selectedIndex = pos >= currentArray.length ? 0 : currentArray.length - 1;
|
|
902
|
+
_start();
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
return;
|
|
906
|
+
};
|
|
907
|
+
|
|
908
|
+
$.fancybox.cancel = function() {
|
|
909
|
+
if (busy) {
|
|
910
|
+
return;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
busy = true;
|
|
914
|
+
|
|
915
|
+
$.event.trigger('fancybox-cancel');
|
|
916
|
+
|
|
917
|
+
_abort();
|
|
918
|
+
|
|
919
|
+
selectedOpts.onCancel(selectedArray, selectedIndex, selectedOpts);
|
|
920
|
+
|
|
921
|
+
busy = false;
|
|
922
|
+
};
|
|
923
|
+
|
|
924
|
+
// Note: within an iframe use - parent.$.fancybox.close();
|
|
925
|
+
$.fancybox.close = function() {
|
|
926
|
+
if (busy || wrap.is(':hidden')) {
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
busy = true;
|
|
931
|
+
|
|
932
|
+
if (currentOpts && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
|
|
933
|
+
busy = false;
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
_abort();
|
|
938
|
+
|
|
939
|
+
$(close.add( nav_left ).add( nav_right )).hide();
|
|
940
|
+
|
|
941
|
+
$(content.add( overlay )).unbind();
|
|
942
|
+
|
|
943
|
+
$(window).unbind("resize.fb scroll.fb");
|
|
944
|
+
$(document).unbind('keydown.fb');
|
|
945
|
+
|
|
946
|
+
content.find('iframe').attr('src', isIE6 && /^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank');
|
|
947
|
+
|
|
948
|
+
if (currentOpts.titlePosition !== 'inside') {
|
|
949
|
+
title.empty();
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
wrap.stop();
|
|
953
|
+
|
|
954
|
+
function _cleanup() {
|
|
955
|
+
overlay.fadeOut('fast');
|
|
956
|
+
|
|
957
|
+
title.empty().hide();
|
|
958
|
+
wrap.hide();
|
|
959
|
+
|
|
960
|
+
$.event.trigger('fancybox-cleanup');
|
|
961
|
+
|
|
962
|
+
content.empty();
|
|
963
|
+
|
|
964
|
+
currentOpts.onClosed(currentArray, currentIndex, currentOpts);
|
|
965
|
+
|
|
966
|
+
currentArray = selectedOpts = [];
|
|
967
|
+
currentIndex = selectedIndex = 0;
|
|
968
|
+
currentOpts = selectedOpts = {};
|
|
969
|
+
|
|
970
|
+
busy = false;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
if (currentOpts.transitionOut == 'elastic') {
|
|
974
|
+
start_pos = _get_zoom_from();
|
|
975
|
+
|
|
976
|
+
var pos = wrap.position();
|
|
977
|
+
|
|
978
|
+
final_pos = {
|
|
979
|
+
top : pos.top ,
|
|
980
|
+
left : pos.left,
|
|
981
|
+
width : wrap.width(),
|
|
982
|
+
height : wrap.height()
|
|
983
|
+
};
|
|
984
|
+
|
|
985
|
+
if (currentOpts.opacity) {
|
|
986
|
+
final_pos.opacity = 1;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
title.empty().hide();
|
|
990
|
+
|
|
991
|
+
fx.prop = 1;
|
|
992
|
+
|
|
993
|
+
$(fx).animate({ prop: 0 }, {
|
|
994
|
+
duration : currentOpts.speedOut,
|
|
995
|
+
easing : currentOpts.easingOut,
|
|
996
|
+
step : _draw,
|
|
997
|
+
complete : _cleanup
|
|
998
|
+
});
|
|
999
|
+
|
|
1000
|
+
} else {
|
|
1001
|
+
wrap.fadeOut( currentOpts.transitionOut == 'none' ? 0 : currentOpts.speedOut, _cleanup);
|
|
1002
|
+
}
|
|
1003
|
+
};
|
|
1004
|
+
|
|
1005
|
+
$.fancybox.resize = function() {
|
|
1006
|
+
if (overlay.is(':visible')) {
|
|
1007
|
+
overlay.css('height', $(document).height());
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
$.fancybox.center(true);
|
|
1011
|
+
};
|
|
1012
|
+
|
|
1013
|
+
$.fancybox.center = function() {
|
|
1014
|
+
var view, align;
|
|
1015
|
+
|
|
1016
|
+
if (busy) {
|
|
1017
|
+
return;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
align = arguments[0] === true ? 1 : 0;
|
|
1021
|
+
view = _get_viewport();
|
|
1022
|
+
|
|
1023
|
+
if (!align && (wrap.width() > view[0] || wrap.height() > view[1])) {
|
|
1024
|
+
return;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
wrap
|
|
1028
|
+
.stop()
|
|
1029
|
+
.animate({
|
|
1030
|
+
'top' : parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - content.height() - 40) * 0.5) - currentOpts.padding)),
|
|
1031
|
+
'left' : parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - content.width() - 40) * 0.5) - currentOpts.padding))
|
|
1032
|
+
}, typeof arguments[0] == 'number' ? arguments[0] : 200);
|
|
1033
|
+
};
|
|
1034
|
+
|
|
1035
|
+
$.fancybox.init = function() {
|
|
1036
|
+
if ($("#fancybox-wrap").length) {
|
|
1037
|
+
return;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
$('body').append(
|
|
1041
|
+
tmp = $('<div id="fancybox-tmp"></div>'),
|
|
1042
|
+
loading = $('<div id="fancybox-loading"><div></div></div>'),
|
|
1043
|
+
overlay = $('<div id="fancybox-overlay"></div>'),
|
|
1044
|
+
wrap = $('<div id="fancybox-wrap"></div>')
|
|
1045
|
+
);
|
|
1046
|
+
|
|
1047
|
+
outer = $('<div id="fancybox-outer"></div>')
|
|
1048
|
+
.append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>')
|
|
1049
|
+
.appendTo( wrap );
|
|
1050
|
+
|
|
1051
|
+
outer.append(
|
|
1052
|
+
content = $('<div id="fancybox-content"></div>'),
|
|
1053
|
+
close = $('<a id="fancybox-close"></a>'),
|
|
1054
|
+
title = $('<div id="fancybox-title"></div>'),
|
|
1055
|
+
|
|
1056
|
+
nav_left = $('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),
|
|
1057
|
+
nav_right = $('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>')
|
|
1058
|
+
);
|
|
1059
|
+
|
|
1060
|
+
close.click($.fancybox.close);
|
|
1061
|
+
loading.click($.fancybox.cancel);
|
|
1062
|
+
|
|
1063
|
+
nav_left.click(function(e) {
|
|
1064
|
+
e.preventDefault();
|
|
1065
|
+
$.fancybox.prev();
|
|
1066
|
+
});
|
|
1067
|
+
|
|
1068
|
+
nav_right.click(function(e) {
|
|
1069
|
+
e.preventDefault();
|
|
1070
|
+
$.fancybox.next();
|
|
1071
|
+
});
|
|
1072
|
+
|
|
1073
|
+
if ($.fn.mousewheel) {
|
|
1074
|
+
wrap.bind('mousewheel.fb', function(e, delta) {
|
|
1075
|
+
if (busy) {
|
|
1076
|
+
e.preventDefault();
|
|
1077
|
+
|
|
1078
|
+
} else if ($(e.target).get(0).clientHeight == 0 || $(e.target).get(0).scrollHeight === $(e.target).get(0).clientHeight) {
|
|
1079
|
+
e.preventDefault();
|
|
1080
|
+
$.fancybox[ delta > 0 ? 'prev' : 'next']();
|
|
1081
|
+
}
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
if (!$.support.opacity) {
|
|
1086
|
+
wrap.addClass('fancybox-ie');
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
if (isIE6) {
|
|
1090
|
+
loading.addClass('fancybox-ie6');
|
|
1091
|
+
wrap.addClass('fancybox-ie6');
|
|
1092
|
+
|
|
1093
|
+
$('<iframe id="fancybox-hide-sel-frame" src="' + (/^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank' ) + '" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(outer);
|
|
1094
|
+
}
|
|
1095
|
+
};
|
|
1096
|
+
|
|
1097
|
+
$.fn.fancybox.defaults = {
|
|
1098
|
+
padding : 10,
|
|
1099
|
+
margin : 40,
|
|
1100
|
+
opacity : false,
|
|
1101
|
+
modal : false,
|
|
1102
|
+
cyclic : false,
|
|
1103
|
+
scrolling : 'auto', // 'auto', 'yes' or 'no'
|
|
1104
|
+
|
|
1105
|
+
width : 560,
|
|
1106
|
+
height : 340,
|
|
1107
|
+
|
|
1108
|
+
autoScale : true,
|
|
1109
|
+
autoDimensions : true,
|
|
1110
|
+
centerOnScroll : false,
|
|
1111
|
+
|
|
1112
|
+
ajax : {},
|
|
1113
|
+
swf : { wmode: 'transparent' },
|
|
1114
|
+
|
|
1115
|
+
hideOnOverlayClick : true,
|
|
1116
|
+
hideOnContentClick : false,
|
|
1117
|
+
|
|
1118
|
+
overlayShow : true,
|
|
1119
|
+
overlayOpacity : 0.7,
|
|
1120
|
+
overlayColor : '#777',
|
|
1121
|
+
|
|
1122
|
+
titleShow : true,
|
|
1123
|
+
titlePosition : 'float', // 'float', 'outside', 'inside' or 'over'
|
|
1124
|
+
titleFormat : null,
|
|
1125
|
+
titleFromAlt : false,
|
|
1126
|
+
|
|
1127
|
+
transitionIn : 'fade', // 'elastic', 'fade' or 'none'
|
|
1128
|
+
transitionOut : 'fade', // 'elastic', 'fade' or 'none'
|
|
1129
|
+
|
|
1130
|
+
speedIn : 300,
|
|
1131
|
+
speedOut : 300,
|
|
1132
|
+
|
|
1133
|
+
changeSpeed : 300,
|
|
1134
|
+
changeFade : 'fast',
|
|
1135
|
+
|
|
1136
|
+
easingIn : 'swing',
|
|
1137
|
+
easingOut : 'swing',
|
|
1138
|
+
|
|
1139
|
+
showCloseButton : true,
|
|
1140
|
+
showNavArrows : true,
|
|
1141
|
+
enableEscapeButton : true,
|
|
1142
|
+
enableKeyboardNav : true,
|
|
1143
|
+
|
|
1144
|
+
onStart : function(){},
|
|
1145
|
+
onCancel : function(){},
|
|
1146
|
+
onComplete : function(){},
|
|
1147
|
+
onCleanup : function(){},
|
|
1148
|
+
onClosed : function(){},
|
|
1149
|
+
onError : function(){}
|
|
1150
|
+
};
|
|
1151
|
+
|
|
1152
|
+
$(document).ready(function() {
|
|
1153
|
+
$.fancybox.init();
|
|
1154
|
+
});
|
|
1155
|
+
|
|
1156
|
+
})(jQuery);
|