orange-sparkles 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.rdoc +21 -0
- data/lib/orange-sparkles.rb +4 -0
- data/lib/orange-sparkles/assets/css/960_24_col.css +1 -0
- data/lib/orange-sparkles/assets/css/border-radius.htc +143 -0
- data/lib/orange-sparkles/assets/css/colorbox.css +62 -0
- data/lib/orange-sparkles/assets/css/main.css +0 -0
- data/lib/orange-sparkles/assets/css/reset.css +1 -0
- data/lib/orange-sparkles/assets/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/lib/orange-sparkles/assets/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/lib/orange-sparkles/assets/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/lib/orange-sparkles/assets/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/lib/orange-sparkles/assets/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/lib/orange-sparkles/assets/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/lib/orange-sparkles/assets/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/lib/orange-sparkles/assets/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/lib/orange-sparkles/assets/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/lib/orange-sparkles/assets/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/lib/orange-sparkles/assets/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/lib/orange-sparkles/assets/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/lib/orange-sparkles/assets/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/lib/orange-sparkles/assets/css/smoothness/jquery-ui-1.7.2.custom.css +406 -0
- data/lib/orange-sparkles/assets/css/sparkles-admin.css +732 -0
- data/lib/orange-sparkles/assets/css/text.css +1 -0
- data/lib/orange-sparkles/assets/images/Untitled-28.png +0 -0
- data/lib/orange-sparkles/assets/images/add-blog.png +0 -0
- data/lib/orange-sparkles/assets/images/add-event.png +0 -0
- data/lib/orange-sparkles/assets/images/add-page.png +0 -0
- data/lib/orange-sparkles/assets/images/border.png +0 -0
- data/lib/orange-sparkles/assets/images/collapse-left.png +0 -0
- data/lib/orange-sparkles/assets/images/collapse-up.png +0 -0
- data/lib/orange-sparkles/assets/images/controls.png +0 -0
- data/lib/orange-sparkles/assets/images/edit-blog.png +0 -0
- data/lib/orange-sparkles/assets/images/edit-events.png +0 -0
- data/lib/orange-sparkles/assets/images/edit-pages.png +0 -0
- data/lib/orange-sparkles/assets/images/edit.png +0 -0
- data/lib/orange-sparkles/assets/images/emo-ticon.png +0 -0
- data/lib/orange-sparkles/assets/images/events.png +0 -0
- data/lib/orange-sparkles/assets/images/expand-down.png +0 -0
- data/lib/orange-sparkles/assets/images/expand.png +0 -0
- data/lib/orange-sparkles/assets/images/facebook_sticker.png +0 -0
- data/lib/orange-sparkles/assets/images/facebook_sticker_small.png +0 -0
- data/lib/orange-sparkles/assets/images/google-small.png +0 -0
- data/lib/orange-sparkles/assets/images/green-button.png +0 -0
- data/lib/orange-sparkles/assets/images/grey-button.png +0 -0
- data/lib/orange-sparkles/assets/images/header_bg.png +0 -0
- data/lib/orange-sparkles/assets/images/header_underline.png +0 -0
- data/lib/orange-sparkles/assets/images/home.png +0 -0
- data/lib/orange-sparkles/assets/images/internet_explorer/borderBottomCenter.png +0 -0
- data/lib/orange-sparkles/assets/images/internet_explorer/borderBottomLeft.png +0 -0
- data/lib/orange-sparkles/assets/images/internet_explorer/borderBottomRight.png +0 -0
- data/lib/orange-sparkles/assets/images/internet_explorer/borderMiddleLeft.png +0 -0
- data/lib/orange-sparkles/assets/images/internet_explorer/borderMiddleRight.png +0 -0
- data/lib/orange-sparkles/assets/images/internet_explorer/borderTopCenter.png +0 -0
- data/lib/orange-sparkles/assets/images/internet_explorer/borderTopLeft.png +0 -0
- data/lib/orange-sparkles/assets/images/internet_explorer/borderTopRight.png +0 -0
- data/lib/orange-sparkles/assets/images/linkedin_sticker.png +0 -0
- data/lib/orange-sparkles/assets/images/linkedin_sticker_small.png +0 -0
- data/lib/orange-sparkles/assets/images/loading.gif +0 -0
- data/lib/orange-sparkles/assets/images/loading_background.png +0 -0
- data/lib/orange-sparkles/assets/images/lock.png +0 -0
- data/lib/orange-sparkles/assets/images/move-higher-disabled.png +0 -0
- data/lib/orange-sparkles/assets/images/move-higher.png +0 -0
- data/lib/orange-sparkles/assets/images/move-indent-disabled.png +0 -0
- data/lib/orange-sparkles/assets/images/move-indent.png +0 -0
- data/lib/orange-sparkles/assets/images/move-lower-disabled.png +0 -0
- data/lib/orange-sparkles/assets/images/move-lower.png +0 -0
- data/lib/orange-sparkles/assets/images/move-outdent-disabled.png +0 -0
- data/lib/orange-sparkles/assets/images/move-outdent.png +0 -0
- data/lib/orange-sparkles/assets/images/move-up-disabled.png +0 -0
- data/lib/orange-sparkles/assets/images/orange-button.png +0 -0
- data/lib/orange-sparkles/assets/images/overlay.png +0 -0
- data/lib/orange-sparkles/assets/images/page-list-last-child.png +0 -0
- data/lib/orange-sparkles/assets/images/page-listing-blog.png +0 -0
- data/lib/orange-sparkles/assets/images/page-listing-event.png +0 -0
- data/lib/orange-sparkles/assets/images/page-listing-expand.png +0 -0
- data/lib/orange-sparkles/assets/images/page-listing-hide.png +0 -0
- data/lib/orange-sparkles/assets/images/page-listing-home.png +0 -0
- data/lib/orange-sparkles/assets/images/page-listing-link.png +0 -0
- data/lib/orange-sparkles/assets/images/page-listing-page.png +0 -0
- data/lib/orange-sparkles/assets/images/page-listing-subsite.png +0 -0
- data/lib/orange-sparkles/assets/images/payment/amex.png +0 -0
- data/lib/orange-sparkles/assets/images/payment/check.png +0 -0
- data/lib/orange-sparkles/assets/images/payment/discover.png +0 -0
- data/lib/orange-sparkles/assets/images/payment/mastercard.png +0 -0
- data/lib/orange-sparkles/assets/images/payment/paypal.png +0 -0
- data/lib/orange-sparkles/assets/images/payment/visa.png +0 -0
- data/lib/orange-sparkles/assets/images/popout-shadow.png +0 -0
- data/lib/orange-sparkles/assets/images/slider-background.png +0 -0
- data/lib/orange-sparkles/assets/images/slider-bg-enabled-disabled.png +0 -0
- data/lib/orange-sparkles/assets/images/slider-bg-gen-cust.png +0 -0
- data/lib/orange-sparkles/assets/images/slider-bg-now-later.png +0 -0
- data/lib/orange-sparkles/assets/images/slider-bg-pub-priv.png +0 -0
- data/lib/orange-sparkles/assets/images/slider-bg-yes-no.png +0 -0
- data/lib/orange-sparkles/assets/images/tablesorter/asc.gif +0 -0
- data/lib/orange-sparkles/assets/images/tablesorter/asc.png +0 -0
- data/lib/orange-sparkles/assets/images/tablesorter/bg.gif +0 -0
- data/lib/orange-sparkles/assets/images/tablesorter/bg.png +0 -0
- data/lib/orange-sparkles/assets/images/tablesorter/desc.gif +0 -0
- data/lib/orange-sparkles/assets/images/tablesorter/desc.png +0 -0
- data/lib/orange-sparkles/assets/images/tablesorter/first.png +0 -0
- data/lib/orange-sparkles/assets/images/tablesorter/last.png +0 -0
- data/lib/orange-sparkles/assets/images/tablesorter/next.png +0 -0
- data/lib/orange-sparkles/assets/images/tablesorter/prev.png +0 -0
- data/lib/orange-sparkles/assets/images/twitter_sticker.png +0 -0
- data/lib/orange-sparkles/assets/images/twitter_sticker_small.png +0 -0
- data/lib/orange-sparkles/assets/images/vimeo_sticker.png +0 -0
- data/lib/orange-sparkles/assets/images/vimeo_sticker_small.png +0 -0
- data/lib/orange-sparkles/assets/images/youtube_sticker.png +0 -0
- data/lib/orange-sparkles/assets/images/youtube_sticker_small.png +0 -0
- data/lib/orange-sparkles/assets/js/admin.js +11 -0
- data/lib/orange-sparkles/assets/js/autoresize.jquery.min.js +7 -0
- data/lib/orange-sparkles/assets/js/images/body.png +0 -0
- data/lib/orange-sparkles/assets/js/images/jaysalvat.png +0 -0
- data/lib/orange-sparkles/assets/js/images/markitup.png +0 -0
- data/lib/orange-sparkles/assets/js/images/style.css +27 -0
- data/lib/orange-sparkles/assets/js/jquery-1.4.1.min.js +152 -0
- data/lib/orange-sparkles/assets/js/jquery-ui-1.7.2.custom.min.js +298 -0
- data/lib/orange-sparkles/assets/js/jquery.colorbox.js +2 -0
- data/lib/orange-sparkles/assets/js/jquery.form.js +675 -0
- data/lib/orange-sparkles/assets/js/jquery.tablesorter.js +852 -0
- data/lib/orange-sparkles/assets/js/jquery.tablesorter.pager.js +184 -0
- data/lib/orange-sparkles/assets/js/jquery.tools.min.js +16 -0
- data/lib/orange-sparkles/assets/js/markitup/jquery.markitup.js +559 -0
- data/lib/orange-sparkles/assets/js/markitup/jquery.markitup.pack.js +9 -0
- data/lib/orange-sparkles/assets/js/markitup/readme.txt +67 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/default/images/bold.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/default/images/clean.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/default/images/image.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/default/images/italic.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/default/images/link.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/default/images/picture.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/default/images/preview.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/default/images/stroke.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/default/set.js +27 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/default/style.css +27 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/markdown/images/bold.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/markdown/images/code.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/markdown/images/h1.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/markdown/images/h2.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/markdown/images/h3.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/markdown/images/h4.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/markdown/images/h5.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/markdown/images/h6.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/markdown/images/italic.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/markdown/images/link.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/markdown/images/list-bullet.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/markdown/images/list-numeric.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/markdown/images/picture.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/markdown/images/preview.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/markdown/images/quotes.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/markdown/readme.txt +11 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/markdown/set.js +52 -0
- data/lib/orange-sparkles/assets/js/markitup/sets/markdown/style.css +45 -0
- data/lib/orange-sparkles/assets/js/markitup/skins/markitup/images/bg-container.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/skins/markitup/images/bg-editor-bbcode.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/skins/markitup/images/bg-editor-dotclear.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/skins/markitup/images/bg-editor-html.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/skins/markitup/images/bg-editor-json.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/skins/markitup/images/bg-editor-markdown.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/skins/markitup/images/bg-editor-textile.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/skins/markitup/images/bg-editor-wiki.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/skins/markitup/images/bg-editor-xml.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/skins/markitup/images/bg-editor.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/skins/markitup/images/handle.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/skins/markitup/images/menu.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/skins/markitup/images/submenu.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/skins/markitup/style.css +148 -0
- data/lib/orange-sparkles/assets/js/markitup/skins/simple/images/handle.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/skins/simple/images/menu.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/skins/simple/images/submenu.png +0 -0
- data/lib/orange-sparkles/assets/js/markitup/skins/simple/style.css +118 -0
- data/lib/orange-sparkles/assets/js/markitup/templates/preview.css +5 -0
- data/lib/orange-sparkles/assets/js/markitup/templates/preview.html +11 -0
- data/lib/orange-sparkles/assets/js/page-list-effects.js +79 -0
- data/lib/orange-sparkles/assets/js/popout-effects-event-edit.js +21 -0
- data/lib/orange-sparkles/assets/js/popout-effects-generic.js +180 -0
- data/lib/orange-sparkles/assets/js/popout-effects-page-edit.js +12 -0
- data/lib/orange-sparkles/plugin.rb +10 -0
- data/lib/orange-sparkles/sparkles_app.rb +133 -0
- data/lib/orange-sparkles/templates/admin.haml +24 -0
- data/lib/orange-sparkles/templates/home.haml +20 -0
- data/lib/orange-sparkles/templates/sparkles-admin.haml +37 -0
- data/lib/orange-sparkles/templates/subpage.haml +20 -0
- data/lib/orange-sparkles/views/assets/change.haml +28 -0
- data/lib/orange-sparkles/views/assets/create.haml +25 -0
- data/lib/orange-sparkles/views/assets/create_markitup.haml +19 -0
- data/lib/orange-sparkles/views/assets/insert.haml +25 -0
- data/lib/orange-sparkles/views/assets/list.haml +19 -0
- data/lib/orange-sparkles/views/assets/list_markitup.haml +13 -0
- data/lib/orange-sparkles/views/assets/markitup_insert.haml +25 -0
- data/lib/orange-sparkles/views/blog/blog_offset_list_view.haml +21 -0
- data/lib/orange-sparkles/views/blog/blog_post_view.haml +9 -0
- data/lib/orange-sparkles/views/blog/sitemap_row.haml +46 -0
- data/lib/orange-sparkles/views/blog_posts/create.haml +77 -0
- data/lib/orange-sparkles/views/blog_posts/edit.haml +86 -0
- data/lib/orange-sparkles/views/blog_posts/list.haml +40 -0
- data/lib/orange-sparkles/views/blog_posts/show.haml +21 -0
- data/lib/orange-sparkles/views/blog_posts/table_row.haml +27 -0
- data/lib/orange-sparkles/views/contactforms/contactform.haml +26 -0
- data/lib/orange-sparkles/views/contactforms/list.haml +32 -0
- data/lib/orange-sparkles/views/default_resource/create.haml +6 -0
- data/lib/orange-sparkles/views/default_resource/edit.haml +11 -0
- data/lib/orange-sparkles/views/default_resource/list.haml +31 -0
- data/lib/orange-sparkles/views/default_resource/show.haml +4 -0
- data/lib/orange-sparkles/views/default_resource/sitemap_row.haml +46 -0
- data/lib/orange-sparkles/views/default_resource/table_row.haml +10 -0
- data/lib/orange-sparkles/views/disqus/comment_thread.haml +14 -0
- data/lib/orange-sparkles/views/news/archive.haml +21 -0
- data/lib/orange-sparkles/views/news/edit.haml +23 -0
- data/lib/orange-sparkles/views/news/latest.haml +11 -0
- data/lib/orange-sparkles/views/news/list.haml +37 -0
- data/lib/orange-sparkles/views/news/sitemap_row.haml +46 -0
- data/lib/orange-sparkles/views/news/table_row.haml +17 -0
- data/lib/orange-sparkles/views/openid_login.haml +28 -0
- data/lib/orange-sparkles/views/orange_sites/edit.haml +13 -0
- data/lib/orange-sparkles/views/orange_sites/lister.haml +1 -0
- data/lib/orange-sparkles/views/pages/admin.show.haml +1 -0
- data/lib/orange-sparkles/views/pages/create.haml +2 -0
- data/lib/orange-sparkles/views/pages/edit.haml +74 -0
- data/lib/orange-sparkles/views/pages/list.haml +1 -0
- data/lib/orange-sparkles/views/pages/live.show.haml +2 -0
- data/lib/orange-sparkles/views/pages/orange.list.haml +25 -0
- data/lib/orange-sparkles/views/pages/preview.show.haml +2 -0
- data/lib/orange-sparkles/views/pages/sitemap_row.haml +55 -0
- data/lib/orange-sparkles/views/pages/table_row.haml +24 -0
- data/lib/orange-sparkles/views/sitemap/breadcrumb.haml +31 -0
- data/lib/orange-sparkles/views/sitemap/create.haml +10 -0
- data/lib/orange-sparkles/views/sitemap/edit.haml +15 -0
- data/lib/orange-sparkles/views/sitemap/list.haml +26 -0
- data/lib/orange-sparkles/views/sitemap/one_level.haml +7 -0
- data/lib/orange-sparkles/views/sitemap/route_actions.haml +5 -0
- data/lib/orange-sparkles/views/sitemap/table_row.haml +44 -0
- data/lib/orange-sparkles/views/slices/footer.haml +17 -0
- data/lib/orange-sparkles/views/slices/header.haml +17 -0
- data/lib/orange-sparkles/views/slices/lorem.haml +1 -0
- data/lib/orange-sparkles/views/slices/slice_helper.haml +37 -0
- data/lib/orange-sparkles/views/users/create.haml +12 -0
- data/lib/orange-sparkles/views/users/edit.haml +17 -0
- metadata +365 -0
@@ -0,0 +1,2 @@
|
|
1
|
+
/* ColorBox v1.3.6 - a full featured, light-weight, customizable lightbox based on jQuery 1.3 */
|
2
|
+
(function(c){function r(b,d){d=d==="x"?m.width():m.height();return typeof b==="string"?Math.round(b.match(/%/)?d/100*parseInt(b,10):parseInt(b,10)):b}function M(b){b=c.isFunction(b)?b.call(i):b;return a.photo||b.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i)}function Y(){for(var b in a)if(c.isFunction(a[b])&&b.substring(0,2)!=="on")a[b]=a[b].call(i);a.rel=a.rel||i.rel;a.href=a.href||i.href;a.title=a.title||i.title}function Z(b){i=b;a=c.extend({},c(i).data(q));Y();if(a.rel&&a.rel!=="nofollow"){g= c(".cboxElement").filter(function(){return(c(this).data(q).rel||this.rel)===a.rel});j=g.index(i);if(j<0){g=g.add(i);j=g.length-1}}else{g=c(i);j=0}if(!B){C=B=n;N=i;N.blur();c(document).bind("keydown.cbox_close",function(d){if(d.keyCode===27){d.preventDefault();e.close()}}).bind("keydown.cbox_arrows",function(d){if(g.length>1)if(d.keyCode===37){d.preventDefault();D.click()}else if(d.keyCode===39){d.preventDefault();E.click()}});a.overlayClose&&s.css({cursor:"pointer"}).one("click",e.close);c.event.trigger(aa); a.onOpen&&a.onOpen.call(i);s.css({opacity:a.opacity}).show();a.w=r(a.initialWidth,"x");a.h=r(a.initialHeight,"y");e.position(0);O&&m.bind("resize.cboxie6 scroll.cboxie6",function(){s.css({width:m.width(),height:m.height(),top:m.scrollTop(),left:m.scrollLeft()})}).trigger("scroll.cboxie6")}P.add(D).add(E).add(t).add(Q).hide();R.html(a.close).show();e.slideshow();e.load()}var q="colorbox",F="hover",n=true,e,x=c.browser.msie&&!c.support.opacity,O=x&&c.browser.version<7,aa="cbox_open",H="cbox_load",S= "cbox_complete",T="resize.cbox_resize",s,k,u,p,U,V,W,X,g,m,l,I,J,K,Q,P,t,E,D,R,y,z,v,w,i,N,j,a,B,C,$={transition:"elastic",speed:350,width:false,height:false,innerWidth:false,innerHeight:false,initialWidth:"400",initialHeight:"400",maxWidth:false,maxHeight:false,scalePhotos:n,scrolling:n,inline:false,html:false,iframe:false,photo:false,href:false,title:false,rel:false,opacity:0.9,preloading:n,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:false,overlayClose:n, slideshow:false,slideshowAuto:n,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false};e=c.fn.colorbox=function(b,d){var h=this;if(!h.length)if(h.selector===""){h=c("<a/>");b.open=n}else return this;h.each(function(){var f=c.extend({},c(this).data(q)?c(this).data(q):$,b);c(this).data(q,f).addClass("cboxElement");if(d)c(this).data(q).onComplete=d});b&&b.open&&Z(h);return this};e.init=function(){function b(d){return c('<div id="cbox'+ d+'"/>')}m=c(window);k=c('<div id="colorbox"/>');s=b("Overlay").hide();u=b("Wrapper");p=b("Content").append(l=b("LoadedContent").css({width:0,height:0}),J=b("LoadingOverlay"),K=b("LoadingGraphic"),Q=b("Title"),P=b("Current"),t=b("Slideshow"),E=b("Next"),D=b("Previous"),R=b("Close"));u.append(c("<div/>").append(b("TopLeft"),U=b("TopCenter"),b("TopRight")),c("<div/>").append(V=b("MiddleLeft"),p,W=b("MiddleRight")),c("<div/>").append(b("BottomLeft"),X=b("BottomCenter"),b("BottomRight"))).children().children().css({"float":"left"}); I=c("<div style='position:absolute; top:0; left:0; width:9999px; height:0;'/>");c("body").prepend(s,k.append(u,I));if(x){k.addClass("cboxIE");O&&s.css("position","absolute")}p.children().bind("mouseover mouseout",function(){c(this).toggleClass(F)}).addClass(F);y=U.height()+X.height()+p.outerHeight(n)-p.height();z=V.width()+W.width()+p.outerWidth(n)-p.width();v=l.outerHeight(n);w=l.outerWidth(n);k.css({"padding-bottom":y,"padding-right":z}).hide();E.click(e.next);D.click(e.prev);R.click(e.close);p.children().removeClass(F); c(".cboxElement").live("click",function(d){if(d.button!==0&&typeof d.button!=="undefined")return n;else{Z(this);return false}})};e.position=function(b,d){function h(A){U[0].style.width=X[0].style.width=p[0].style.width=A.style.width;K[0].style.height=J[0].style.height=p[0].style.height=V[0].style.height=W[0].style.height=A.style.height}var f=m.height();f=Math.max(f-a.h-v-y,0)/2+m.scrollTop();var o=Math.max(document.documentElement.clientWidth-a.w-w-z,0)/2+m.scrollLeft();b=k.width()===a.w+w&&k.height()=== a.h+v?0:b;u[0].style.width=u[0].style.height="9999px";k.dequeue().animate({width:a.w+w,height:a.h+v,top:f,left:o},{duration:b,complete:function(){h(this);C=false;u[0].style.width=a.w+w+z+"px";u[0].style.height=a.h+v+y+"px";d&&d()},step:function(){h(this)}})};e.resize=function(b){function d(){a.w=a.w||l.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}function h(){a.h=a.h||l.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}function f(G){e.position(G,function(){if(B){if(x){A&&l.fadeIn(100);k[0].style.removeAttribute("filter")}if(a.iframe)l.append("<iframe id='cboxIframe'"+ (a.scrolling?" ":"scrolling='no'")+" name='iframe_"+(new Date).getTime()+"' frameborder=0 src='"+a.href+"' "+(x?"allowtransparency='true'":"")+" />");l.show();Q.show().html(a.title);if(g.length>1){P.html(a.current.replace(/\{current\}/,j+1).replace(/\{total\}/,g.length)).show();E.html(a.next).show();D.html(a.previous).show();a.slideshow&&t.show()}J.hide();K.hide();c.event.trigger(S);a.onComplete&&a.onComplete.call(i);a.transition==="fade"&&k.fadeTo(L,1,function(){x&&k[0].style.removeAttribute("filter")}); m.bind(T,function(){e.position(0)})}})}if(B){var o,A,L=a.transition==="none"?0:a.speed;m.unbind(T);if(b){l.remove();l=c('<div id="cboxLoadedContent"/>').html(b);l.hide().appendTo(I).css({width:d(),overflow:a.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(p);c("#cboxPhoto").css({cssFloat:"none"});O&&c("select:not(#colorbox select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("cbox_cleanup",function(){this.style.visibility="inherit"});a.transition=== "fade"&&k.fadeTo(L,0,function(){f(0)})||f(L);if(a.preloading&&g.length>1){b=j>0?g[j-1]:g[g.length-1];o=j<g.length-1?g[j+1]:g[0];o=c(o).data(q).href||o.href;b=c(b).data(q).href||b.href;M(o)&&c("<img />").attr("src",o);M(b)&&c("<img />").attr("src",b)}}else setTimeout(function(){var G=l.wrapInner("<div style='overflow:auto'></div>").children();a.h=G.height();l.css({height:a.h});G.replaceWith(G.children());e.position(L)},1)}};e.load=function(){var b,d,h,f=e.resize;C=n;i=g[j];a=c.extend({},c(i).data(q)); Y();c.event.trigger(H);a.onLoad&&a.onLoad.call(i);a.h=a.height?r(a.height,"y")-v-y:a.innerHeight?r(a.innerHeight,"y"):false;a.w=a.width?r(a.width,"x")-w-z:a.innerWidth?r(a.innerWidth,"x"):false;a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=r(a.maxWidth,"x")-w-z;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=r(a.maxHeight,"y")-v-y;a.mh=a.h&&a.h<a.mh?a.h:a.mh}b=a.href;J.show();K.show();if(a.inline){c('<div id="cboxInlineTemp" />').hide().insertBefore(c(b)[0]).bind(H+" cbox_cleanup",function(){c(this).replaceWith(l.children())}); f(c(b))}else if(a.iframe)f(" ");else if(a.html)f(a.html);else if(M(b)){d=new Image;d.onload=function(){var o;d.onload=null;d.id="cboxPhoto";c(d).css({margin:"auto",border:"none",display:"block",cssFloat:"left"});if(a.scalePhotos){h=function(){d.height-=d.height*o;d.width-=d.width*o};if(a.mw&&d.width>a.mw){o=(d.width-a.mw)/d.width;h()}if(a.mh&&d.height>a.mh){o=(d.height-a.mh)/d.height;h()}}if(a.h)d.style.marginTop=Math.max(a.h-d.height,0)/2+"px";f(d);g.length>1&&c(d).css({cursor:"pointer"}).click(e.next); if(x)d.style.msInterpolationMode="bicubic"};d.src=b}else c("<div />").appendTo(I).load(b,function(o,A){A==="success"?f(this):f(c("<p>Request unsuccessful.</p>"))})};e.next=function(){if(!C){j=j<g.length-1?j+1:0;e.load()}};e.prev=function(){if(!C){j=j>0?j-1:g.length-1;e.load()}};e.slideshow=function(){function b(){t.text(a.slideshowStop).bind(S,function(){h=setTimeout(e.next,a.slideshowSpeed)}).bind(H,function(){clearTimeout(h)}).one("click",function(){d();c(this).removeClass(F)});k.removeClass(f+ "off").addClass(f+"on")}var d,h,f="cboxSlideshow_";t.bind("cbox_closed",function(){t.unbind();clearTimeout(h);k.removeClass(f+"off "+f+"on")});d=function(){clearTimeout(h);t.text(a.slideshowStart).unbind(S+" "+H).one("click",function(){b();h=setTimeout(e.next,a.slideshowSpeed);c(this).removeClass(F)});k.removeClass(f+"on").addClass(f+"off")};if(a.slideshow&&g.length>1)a.slideshowAuto?b():d()};e.close=function(){c.event.trigger("cbox_cleanup");a.onCleanup&&a.onCleanup.call(i);B=false;c(document).unbind("keydown.cbox_close keydown.cbox_arrows"); m.unbind(T+" resize.cboxie6 scroll.cboxie6");s.css({cursor:"auto"}).fadeOut("fast");k.stop(n,false).fadeOut("fast",function(){c("#colorbox iframe").attr("src","about:blank");l.remove();k.css({opacity:1});try{N.focus()}catch(b){}c.event.trigger("cbox_closed");a.onClosed&&a.onClosed.call(i)})};e.element=function(){return c(i)};e.settings=$;c(e.init)})(jQuery);
|
@@ -0,0 +1,675 @@
|
|
1
|
+
/*!
|
2
|
+
* jQuery Form Plugin
|
3
|
+
* version: 2.43 (12-MAR-2010)
|
4
|
+
* @requires jQuery v1.3.2 or later
|
5
|
+
*
|
6
|
+
* Examples and documentation at: http://malsup.com/jquery/form/
|
7
|
+
* Dual licensed under the MIT and GPL licenses:
|
8
|
+
* http://www.opensource.org/licenses/mit-license.php
|
9
|
+
* http://www.gnu.org/licenses/gpl.html
|
10
|
+
*/
|
11
|
+
;(function($) {
|
12
|
+
|
13
|
+
/*
|
14
|
+
Usage Note:
|
15
|
+
-----------
|
16
|
+
Do not use both ajaxSubmit and ajaxForm on the same form. These
|
17
|
+
functions are intended to be exclusive. Use ajaxSubmit if you want
|
18
|
+
to bind your own submit handler to the form. For example,
|
19
|
+
|
20
|
+
$(document).ready(function() {
|
21
|
+
$('#myForm').bind('submit', function() {
|
22
|
+
$(this).ajaxSubmit({
|
23
|
+
target: '#output'
|
24
|
+
});
|
25
|
+
return false; // <-- important!
|
26
|
+
});
|
27
|
+
});
|
28
|
+
|
29
|
+
Use ajaxForm when you want the plugin to manage all the event binding
|
30
|
+
for you. For example,
|
31
|
+
|
32
|
+
$(document).ready(function() {
|
33
|
+
$('#myForm').ajaxForm({
|
34
|
+
target: '#output'
|
35
|
+
});
|
36
|
+
});
|
37
|
+
|
38
|
+
When using ajaxForm, the ajaxSubmit function will be invoked for you
|
39
|
+
at the appropriate time.
|
40
|
+
*/
|
41
|
+
|
42
|
+
/**
|
43
|
+
* ajaxSubmit() provides a mechanism for immediately submitting
|
44
|
+
* an HTML form using AJAX.
|
45
|
+
*/
|
46
|
+
$.fn.ajaxSubmit = function(options) {
|
47
|
+
// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
|
48
|
+
if (!this.length) {
|
49
|
+
log('ajaxSubmit: skipping submit process - no element selected');
|
50
|
+
return this;
|
51
|
+
}
|
52
|
+
|
53
|
+
if (typeof options == 'function')
|
54
|
+
options = { success: options };
|
55
|
+
|
56
|
+
var url = $.trim(this.attr('action'));
|
57
|
+
if (url) {
|
58
|
+
// clean url (don't include hash vaue)
|
59
|
+
url = (url.match(/^([^#]+)/)||[])[1];
|
60
|
+
}
|
61
|
+
url = url || window.location.href || '';
|
62
|
+
|
63
|
+
options = $.extend({
|
64
|
+
url: url,
|
65
|
+
type: this.attr('method') || 'GET',
|
66
|
+
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
|
67
|
+
}, options || {});
|
68
|
+
|
69
|
+
// hook for manipulating the form data before it is extracted;
|
70
|
+
// convenient for use with rich editors like tinyMCE or FCKEditor
|
71
|
+
var veto = {};
|
72
|
+
this.trigger('form-pre-serialize', [this, options, veto]);
|
73
|
+
if (veto.veto) {
|
74
|
+
log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
|
75
|
+
return this;
|
76
|
+
}
|
77
|
+
|
78
|
+
// provide opportunity to alter form data before it is serialized
|
79
|
+
if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
|
80
|
+
log('ajaxSubmit: submit aborted via beforeSerialize callback');
|
81
|
+
return this;
|
82
|
+
}
|
83
|
+
|
84
|
+
var a = this.formToArray(options.semantic);
|
85
|
+
if (options.data) {
|
86
|
+
options.extraData = options.data;
|
87
|
+
for (var n in options.data) {
|
88
|
+
if(options.data[n] instanceof Array) {
|
89
|
+
for (var k in options.data[n])
|
90
|
+
a.push( { name: n, value: options.data[n][k] } );
|
91
|
+
}
|
92
|
+
else
|
93
|
+
a.push( { name: n, value: options.data[n] } );
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
// give pre-submit callback an opportunity to abort the submit
|
98
|
+
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
|
99
|
+
log('ajaxSubmit: submit aborted via beforeSubmit callback');
|
100
|
+
return this;
|
101
|
+
}
|
102
|
+
|
103
|
+
// fire vetoable 'validate' event
|
104
|
+
this.trigger('form-submit-validate', [a, this, options, veto]);
|
105
|
+
if (veto.veto) {
|
106
|
+
log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
|
107
|
+
return this;
|
108
|
+
}
|
109
|
+
|
110
|
+
var q = $.param(a);
|
111
|
+
|
112
|
+
if (options.type.toUpperCase() == 'GET') {
|
113
|
+
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
|
114
|
+
options.data = null; // data is null for 'get'
|
115
|
+
}
|
116
|
+
else
|
117
|
+
options.data = q; // data is the query string for 'post'
|
118
|
+
|
119
|
+
var $form = this, callbacks = [];
|
120
|
+
if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
|
121
|
+
if (options.clearForm) callbacks.push(function() { $form.clearForm(); });
|
122
|
+
|
123
|
+
// perform a load on the target only if dataType is not provided
|
124
|
+
if (!options.dataType && options.target) {
|
125
|
+
var oldSuccess = options.success || function(){};
|
126
|
+
callbacks.push(function(data) {
|
127
|
+
var fn = options.replaceTarget ? 'replaceWith' : 'html';
|
128
|
+
$(options.target)[fn](data).each(oldSuccess, arguments);
|
129
|
+
});
|
130
|
+
}
|
131
|
+
else if (options.success)
|
132
|
+
callbacks.push(options.success);
|
133
|
+
|
134
|
+
options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
|
135
|
+
for (var i=0, max=callbacks.length; i < max; i++)
|
136
|
+
callbacks[i].apply(options, [data, status, xhr || $form, $form]);
|
137
|
+
};
|
138
|
+
|
139
|
+
// are there files to upload?
|
140
|
+
var files = $('input:file', this).fieldValue();
|
141
|
+
var found = false;
|
142
|
+
for (var j=0; j < files.length; j++)
|
143
|
+
if (files[j])
|
144
|
+
found = true;
|
145
|
+
|
146
|
+
var multipart = false;
|
147
|
+
// var mp = 'multipart/form-data';
|
148
|
+
// multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
|
149
|
+
|
150
|
+
// options.iframe allows user to force iframe mode
|
151
|
+
// 06-NOV-09: now defaulting to iframe mode if file input is detected
|
152
|
+
if ((files.length && options.iframe !== false) || options.iframe || found || multipart) {
|
153
|
+
// hack to fix Safari hang (thanks to Tim Molendijk for this)
|
154
|
+
// see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
|
155
|
+
if (options.closeKeepAlive)
|
156
|
+
$.get(options.closeKeepAlive, fileUpload);
|
157
|
+
else
|
158
|
+
fileUpload();
|
159
|
+
}
|
160
|
+
else
|
161
|
+
$.ajax(options);
|
162
|
+
|
163
|
+
// fire 'notify' event
|
164
|
+
this.trigger('form-submit-notify', [this, options]);
|
165
|
+
return this;
|
166
|
+
|
167
|
+
|
168
|
+
// private function for handling file uploads (hat tip to YAHOO!)
|
169
|
+
function fileUpload() {
|
170
|
+
var form = $form[0];
|
171
|
+
|
172
|
+
if ($(':input[name=submit]', form).length) {
|
173
|
+
alert('Error: Form elements must not be named "submit".');
|
174
|
+
return;
|
175
|
+
}
|
176
|
+
|
177
|
+
var opts = $.extend({}, $.ajaxSettings, options);
|
178
|
+
var s = $.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts);
|
179
|
+
|
180
|
+
var id = 'jqFormIO' + (new Date().getTime());
|
181
|
+
var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ opts.iframeSrc +'" onload="var f = (jQuery(this).data(\'form-plugin-onload\')); if (f) f()" />');
|
182
|
+
var io = $io[0];
|
183
|
+
|
184
|
+
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
|
185
|
+
|
186
|
+
var xhr = { // mock object
|
187
|
+
aborted: 0,
|
188
|
+
responseText: null,
|
189
|
+
responseXML: null,
|
190
|
+
status: 0,
|
191
|
+
statusText: 'n/a',
|
192
|
+
getAllResponseHeaders: function() {},
|
193
|
+
getResponseHeader: function() {},
|
194
|
+
setRequestHeader: function() {},
|
195
|
+
abort: function() {
|
196
|
+
this.aborted = 1;
|
197
|
+
$io.attr('src', opts.iframeSrc); // abort op in progress
|
198
|
+
}
|
199
|
+
};
|
200
|
+
|
201
|
+
var g = opts.global;
|
202
|
+
// trigger ajax global events so that activity/block indicators work like normal
|
203
|
+
if (g && ! $.active++) $.event.trigger("ajaxStart");
|
204
|
+
if (g) $.event.trigger("ajaxSend", [xhr, opts]);
|
205
|
+
|
206
|
+
if (s.beforeSend && s.beforeSend(xhr, s) === false) {
|
207
|
+
s.global && $.active--;
|
208
|
+
return;
|
209
|
+
}
|
210
|
+
if (xhr.aborted)
|
211
|
+
return;
|
212
|
+
|
213
|
+
var cbInvoked = false;
|
214
|
+
var timedOut = 0;
|
215
|
+
|
216
|
+
// add submitting element to data if we know it
|
217
|
+
var sub = form.clk;
|
218
|
+
if (sub) {
|
219
|
+
var n = sub.name;
|
220
|
+
if (n && !sub.disabled) {
|
221
|
+
opts.extraData = opts.extraData || {};
|
222
|
+
opts.extraData[n] = sub.value;
|
223
|
+
if (sub.type == "image") {
|
224
|
+
opts.extraData[n+'.x'] = form.clk_x;
|
225
|
+
opts.extraData[n+'.y'] = form.clk_y;
|
226
|
+
}
|
227
|
+
}
|
228
|
+
}
|
229
|
+
|
230
|
+
// take a breath so that pending repaints get some cpu time before the upload starts
|
231
|
+
function doSubmit() {
|
232
|
+
// make sure form attrs are set
|
233
|
+
var t = $form.attr('target'), a = $form.attr('action');
|
234
|
+
|
235
|
+
// update form attrs in IE friendly way
|
236
|
+
form.setAttribute('target',id);
|
237
|
+
if (form.getAttribute('method') != 'POST')
|
238
|
+
form.setAttribute('method', 'POST');
|
239
|
+
if (form.getAttribute('action') != opts.url)
|
240
|
+
form.setAttribute('action', opts.url);
|
241
|
+
|
242
|
+
// ie borks in some cases when setting encoding
|
243
|
+
if (! opts.skipEncodingOverride) {
|
244
|
+
$form.attr({
|
245
|
+
encoding: 'multipart/form-data',
|
246
|
+
enctype: 'multipart/form-data'
|
247
|
+
});
|
248
|
+
}
|
249
|
+
|
250
|
+
// support timout
|
251
|
+
if (opts.timeout)
|
252
|
+
setTimeout(function() { timedOut = true; cb(); }, opts.timeout);
|
253
|
+
|
254
|
+
// add "extra" data to form if provided in options
|
255
|
+
var extraInputs = [];
|
256
|
+
try {
|
257
|
+
if (opts.extraData)
|
258
|
+
for (var n in opts.extraData)
|
259
|
+
extraInputs.push(
|
260
|
+
$('<input type="hidden" name="'+n+'" value="'+opts.extraData[n]+'" />')
|
261
|
+
.appendTo(form)[0]);
|
262
|
+
|
263
|
+
// add iframe to doc and submit the form
|
264
|
+
$io.appendTo('body');
|
265
|
+
$io.data('form-plugin-onload', cb);
|
266
|
+
form.submit();
|
267
|
+
}
|
268
|
+
finally {
|
269
|
+
// reset attrs and remove "extra" input elements
|
270
|
+
form.setAttribute('action',a);
|
271
|
+
t ? form.setAttribute('target', t) : $form.removeAttr('target');
|
272
|
+
$(extraInputs).remove();
|
273
|
+
}
|
274
|
+
};
|
275
|
+
|
276
|
+
if (opts.forceSync)
|
277
|
+
doSubmit();
|
278
|
+
else
|
279
|
+
setTimeout(doSubmit, 10); // this lets dom updates render
|
280
|
+
|
281
|
+
var domCheckCount = 100;
|
282
|
+
|
283
|
+
function cb() {
|
284
|
+
if (cbInvoked)
|
285
|
+
return;
|
286
|
+
|
287
|
+
var ok = true;
|
288
|
+
try {
|
289
|
+
if (timedOut) throw 'timeout';
|
290
|
+
// extract the server response from the iframe
|
291
|
+
var data, doc;
|
292
|
+
|
293
|
+
doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
|
294
|
+
|
295
|
+
var isXml = opts.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
|
296
|
+
log('isXml='+isXml);
|
297
|
+
if (!isXml && (doc.body == null || doc.body.innerHTML == '')) {
|
298
|
+
if (--domCheckCount) {
|
299
|
+
// in some browsers (Opera) the iframe DOM is not always traversable when
|
300
|
+
// the onload callback fires, so we loop a bit to accommodate
|
301
|
+
log('requeing onLoad callback, DOM not available');
|
302
|
+
setTimeout(cb, 250);
|
303
|
+
return;
|
304
|
+
}
|
305
|
+
log('Could not access iframe DOM after 100 tries.');
|
306
|
+
return;
|
307
|
+
}
|
308
|
+
|
309
|
+
log('response detected');
|
310
|
+
cbInvoked = true;
|
311
|
+
xhr.responseText = doc.body ? doc.body.innerHTML : null;
|
312
|
+
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
|
313
|
+
xhr.getResponseHeader = function(header){
|
314
|
+
var headers = {'content-type': opts.dataType};
|
315
|
+
return headers[header];
|
316
|
+
};
|
317
|
+
|
318
|
+
if (opts.dataType == 'json' || opts.dataType == 'script') {
|
319
|
+
// see if user embedded response in textarea
|
320
|
+
var ta = doc.getElementsByTagName('textarea')[0];
|
321
|
+
if (ta)
|
322
|
+
xhr.responseText = ta.value;
|
323
|
+
else {
|
324
|
+
// account for browsers injecting pre around json response
|
325
|
+
var pre = doc.getElementsByTagName('pre')[0];
|
326
|
+
if (pre)
|
327
|
+
xhr.responseText = pre.innerHTML;
|
328
|
+
}
|
329
|
+
}
|
330
|
+
else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
|
331
|
+
xhr.responseXML = toXml(xhr.responseText);
|
332
|
+
}
|
333
|
+
data = $.httpData(xhr, opts.dataType);
|
334
|
+
}
|
335
|
+
catch(e){
|
336
|
+
log('error caught:',e);
|
337
|
+
ok = false;
|
338
|
+
xhr.error = e;
|
339
|
+
$.handleError(opts, xhr, 'error', e);
|
340
|
+
}
|
341
|
+
|
342
|
+
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
|
343
|
+
if (ok) {
|
344
|
+
opts.success(data, 'success');
|
345
|
+
if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
|
346
|
+
}
|
347
|
+
if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
|
348
|
+
if (g && ! --$.active) $.event.trigger("ajaxStop");
|
349
|
+
if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');
|
350
|
+
|
351
|
+
// clean up
|
352
|
+
setTimeout(function() {
|
353
|
+
$io.removeData('form-plugin-onload');
|
354
|
+
$io.remove();
|
355
|
+
xhr.responseXML = null;
|
356
|
+
}, 100);
|
357
|
+
};
|
358
|
+
|
359
|
+
function toXml(s, doc) {
|
360
|
+
if (window.ActiveXObject) {
|
361
|
+
doc = new ActiveXObject('Microsoft.XMLDOM');
|
362
|
+
doc.async = 'false';
|
363
|
+
doc.loadXML(s);
|
364
|
+
}
|
365
|
+
else
|
366
|
+
doc = (new DOMParser()).parseFromString(s, 'text/xml');
|
367
|
+
return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
|
368
|
+
};
|
369
|
+
};
|
370
|
+
};
|
371
|
+
|
372
|
+
/**
|
373
|
+
* ajaxForm() provides a mechanism for fully automating form submission.
|
374
|
+
*
|
375
|
+
* The advantages of using this method instead of ajaxSubmit() are:
|
376
|
+
*
|
377
|
+
* 1: This method will include coordinates for <input type="image" /> elements (if the element
|
378
|
+
* is used to submit the form).
|
379
|
+
* 2. This method will include the submit element's name/value data (for the element that was
|
380
|
+
* used to submit the form).
|
381
|
+
* 3. This method binds the submit() method to the form for you.
|
382
|
+
*
|
383
|
+
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
|
384
|
+
* passes the options argument along after properly binding events for submit elements and
|
385
|
+
* the form itself.
|
386
|
+
*/
|
387
|
+
$.fn.ajaxForm = function(options) {
|
388
|
+
return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
|
389
|
+
e.preventDefault();
|
390
|
+
$(this).ajaxSubmit(options);
|
391
|
+
}).bind('click.form-plugin', function(e) {
|
392
|
+
var target = e.target;
|
393
|
+
var $el = $(target);
|
394
|
+
if (!($el.is(":submit,input:image"))) {
|
395
|
+
// is this a child element of the submit el? (ex: a span within a button)
|
396
|
+
var t = $el.closest(':submit');
|
397
|
+
if (t.length == 0)
|
398
|
+
return;
|
399
|
+
target = t[0];
|
400
|
+
}
|
401
|
+
var form = this;
|
402
|
+
form.clk = target;
|
403
|
+
if (target.type == 'image') {
|
404
|
+
if (e.offsetX != undefined) {
|
405
|
+
form.clk_x = e.offsetX;
|
406
|
+
form.clk_y = e.offsetY;
|
407
|
+
} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
|
408
|
+
var offset = $el.offset();
|
409
|
+
form.clk_x = e.pageX - offset.left;
|
410
|
+
form.clk_y = e.pageY - offset.top;
|
411
|
+
} else {
|
412
|
+
form.clk_x = e.pageX - target.offsetLeft;
|
413
|
+
form.clk_y = e.pageY - target.offsetTop;
|
414
|
+
}
|
415
|
+
}
|
416
|
+
// clear form vars
|
417
|
+
setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
|
418
|
+
});
|
419
|
+
};
|
420
|
+
|
421
|
+
// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
|
422
|
+
$.fn.ajaxFormUnbind = function() {
|
423
|
+
return this.unbind('submit.form-plugin click.form-plugin');
|
424
|
+
};
|
425
|
+
|
426
|
+
/**
|
427
|
+
* formToArray() gathers form element data into an array of objects that can
|
428
|
+
* be passed to any of the following ajax functions: $.get, $.post, or load.
|
429
|
+
* Each object in the array has both a 'name' and 'value' property. An example of
|
430
|
+
* an array for a simple login form might be:
|
431
|
+
*
|
432
|
+
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
|
433
|
+
*
|
434
|
+
* It is this array that is passed to pre-submit callback functions provided to the
|
435
|
+
* ajaxSubmit() and ajaxForm() methods.
|
436
|
+
*/
|
437
|
+
$.fn.formToArray = function(semantic) {
|
438
|
+
var a = [];
|
439
|
+
if (this.length == 0) return a;
|
440
|
+
|
441
|
+
var form = this[0];
|
442
|
+
var els = semantic ? form.getElementsByTagName('*') : form.elements;
|
443
|
+
if (!els) return a;
|
444
|
+
for(var i=0, max=els.length; i < max; i++) {
|
445
|
+
var el = els[i];
|
446
|
+
var n = el.name;
|
447
|
+
if (!n) continue;
|
448
|
+
|
449
|
+
if (semantic && form.clk && el.type == "image") {
|
450
|
+
// handle image inputs on the fly when semantic == true
|
451
|
+
if(!el.disabled && form.clk == el) {
|
452
|
+
a.push({name: n, value: $(el).val()});
|
453
|
+
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
454
|
+
}
|
455
|
+
continue;
|
456
|
+
}
|
457
|
+
|
458
|
+
var v = $.fieldValue(el, true);
|
459
|
+
if (v && v.constructor == Array) {
|
460
|
+
for(var j=0, jmax=v.length; j < jmax; j++)
|
461
|
+
a.push({name: n, value: v[j]});
|
462
|
+
}
|
463
|
+
else if (v !== null && typeof v != 'undefined')
|
464
|
+
a.push({name: n, value: v});
|
465
|
+
}
|
466
|
+
|
467
|
+
if (!semantic && form.clk) {
|
468
|
+
// input type=='image' are not found in elements array! handle it here
|
469
|
+
var $input = $(form.clk), input = $input[0], n = input.name;
|
470
|
+
if (n && !input.disabled && input.type == 'image') {
|
471
|
+
a.push({name: n, value: $input.val()});
|
472
|
+
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
473
|
+
}
|
474
|
+
}
|
475
|
+
return a;
|
476
|
+
};
|
477
|
+
|
478
|
+
/**
|
479
|
+
* Serializes form data into a 'submittable' string. This method will return a string
|
480
|
+
* in the format: name1=value1&name2=value2
|
481
|
+
*/
|
482
|
+
$.fn.formSerialize = function(semantic) {
|
483
|
+
//hand off to jQuery.param for proper encoding
|
484
|
+
return $.param(this.formToArray(semantic));
|
485
|
+
};
|
486
|
+
|
487
|
+
/**
|
488
|
+
* Serializes all field elements in the jQuery object into a query string.
|
489
|
+
* This method will return a string in the format: name1=value1&name2=value2
|
490
|
+
*/
|
491
|
+
$.fn.fieldSerialize = function(successful) {
|
492
|
+
var a = [];
|
493
|
+
this.each(function() {
|
494
|
+
var n = this.name;
|
495
|
+
if (!n) return;
|
496
|
+
var v = $.fieldValue(this, successful);
|
497
|
+
if (v && v.constructor == Array) {
|
498
|
+
for (var i=0,max=v.length; i < max; i++)
|
499
|
+
a.push({name: n, value: v[i]});
|
500
|
+
}
|
501
|
+
else if (v !== null && typeof v != 'undefined')
|
502
|
+
a.push({name: this.name, value: v});
|
503
|
+
});
|
504
|
+
//hand off to jQuery.param for proper encoding
|
505
|
+
return $.param(a);
|
506
|
+
};
|
507
|
+
|
508
|
+
/**
|
509
|
+
* Returns the value(s) of the element in the matched set. For example, consider the following form:
|
510
|
+
*
|
511
|
+
* <form><fieldset>
|
512
|
+
* <input name="A" type="text" />
|
513
|
+
* <input name="A" type="text" />
|
514
|
+
* <input name="B" type="checkbox" value="B1" />
|
515
|
+
* <input name="B" type="checkbox" value="B2"/>
|
516
|
+
* <input name="C" type="radio" value="C1" />
|
517
|
+
* <input name="C" type="radio" value="C2" />
|
518
|
+
* </fieldset></form>
|
519
|
+
*
|
520
|
+
* var v = $(':text').fieldValue();
|
521
|
+
* // if no values are entered into the text inputs
|
522
|
+
* v == ['','']
|
523
|
+
* // if values entered into the text inputs are 'foo' and 'bar'
|
524
|
+
* v == ['foo','bar']
|
525
|
+
*
|
526
|
+
* var v = $(':checkbox').fieldValue();
|
527
|
+
* // if neither checkbox is checked
|
528
|
+
* v === undefined
|
529
|
+
* // if both checkboxes are checked
|
530
|
+
* v == ['B1', 'B2']
|
531
|
+
*
|
532
|
+
* var v = $(':radio').fieldValue();
|
533
|
+
* // if neither radio is checked
|
534
|
+
* v === undefined
|
535
|
+
* // if first radio is checked
|
536
|
+
* v == ['C1']
|
537
|
+
*
|
538
|
+
* The successful argument controls whether or not the field element must be 'successful'
|
539
|
+
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
|
540
|
+
* The default value of the successful argument is true. If this value is false the value(s)
|
541
|
+
* for each element is returned.
|
542
|
+
*
|
543
|
+
* Note: This method *always* returns an array. If no valid value can be determined the
|
544
|
+
* array will be empty, otherwise it will contain one or more values.
|
545
|
+
*/
|
546
|
+
$.fn.fieldValue = function(successful) {
|
547
|
+
for (var val=[], i=0, max=this.length; i < max; i++) {
|
548
|
+
var el = this[i];
|
549
|
+
var v = $.fieldValue(el, successful);
|
550
|
+
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
|
551
|
+
continue;
|
552
|
+
v.constructor == Array ? $.merge(val, v) : val.push(v);
|
553
|
+
}
|
554
|
+
return val;
|
555
|
+
};
|
556
|
+
|
557
|
+
/**
|
558
|
+
* Returns the value of the field element.
|
559
|
+
*/
|
560
|
+
$.fieldValue = function(el, successful) {
|
561
|
+
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
|
562
|
+
if (typeof successful == 'undefined') successful = true;
|
563
|
+
|
564
|
+
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
|
565
|
+
(t == 'checkbox' || t == 'radio') && !el.checked ||
|
566
|
+
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
|
567
|
+
tag == 'select' && el.selectedIndex == -1))
|
568
|
+
return null;
|
569
|
+
|
570
|
+
if (tag == 'select') {
|
571
|
+
var index = el.selectedIndex;
|
572
|
+
if (index < 0) return null;
|
573
|
+
var a = [], ops = el.options;
|
574
|
+
var one = (t == 'select-one');
|
575
|
+
var max = (one ? index+1 : ops.length);
|
576
|
+
for(var i=(one ? index : 0); i < max; i++) {
|
577
|
+
var op = ops[i];
|
578
|
+
if (op.selected) {
|
579
|
+
var v = op.value;
|
580
|
+
if (!v) // extra pain for IE...
|
581
|
+
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
|
582
|
+
if (one) return v;
|
583
|
+
a.push(v);
|
584
|
+
}
|
585
|
+
}
|
586
|
+
return a;
|
587
|
+
}
|
588
|
+
return el.value;
|
589
|
+
};
|
590
|
+
|
591
|
+
/**
|
592
|
+
* Clears the form data. Takes the following actions on the form's input fields:
|
593
|
+
* - input text fields will have their 'value' property set to the empty string
|
594
|
+
* - select elements will have their 'selectedIndex' property set to -1
|
595
|
+
* - checkbox and radio inputs will have their 'checked' property set to false
|
596
|
+
* - inputs of type submit, button, reset, and hidden will *not* be effected
|
597
|
+
* - button elements will *not* be effected
|
598
|
+
*/
|
599
|
+
$.fn.clearForm = function() {
|
600
|
+
return this.each(function() {
|
601
|
+
$('input,select,textarea', this).clearFields();
|
602
|
+
});
|
603
|
+
};
|
604
|
+
|
605
|
+
/**
|
606
|
+
* Clears the selected form elements.
|
607
|
+
*/
|
608
|
+
$.fn.clearFields = $.fn.clearInputs = function() {
|
609
|
+
return this.each(function() {
|
610
|
+
var t = this.type, tag = this.tagName.toLowerCase();
|
611
|
+
if (t == 'text' || t == 'password' || tag == 'textarea')
|
612
|
+
this.value = '';
|
613
|
+
else if (t == 'checkbox' || t == 'radio')
|
614
|
+
this.checked = false;
|
615
|
+
else if (tag == 'select')
|
616
|
+
this.selectedIndex = -1;
|
617
|
+
});
|
618
|
+
};
|
619
|
+
|
620
|
+
/**
|
621
|
+
* Resets the form data. Causes all form elements to be reset to their original value.
|
622
|
+
*/
|
623
|
+
$.fn.resetForm = function() {
|
624
|
+
return this.each(function() {
|
625
|
+
// guard against an input with the name of 'reset'
|
626
|
+
// note that IE reports the reset function as an 'object'
|
627
|
+
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
|
628
|
+
this.reset();
|
629
|
+
});
|
630
|
+
};
|
631
|
+
|
632
|
+
/**
|
633
|
+
* Enables or disables any matching elements.
|
634
|
+
*/
|
635
|
+
$.fn.enable = function(b) {
|
636
|
+
if (b == undefined) b = true;
|
637
|
+
return this.each(function() {
|
638
|
+
this.disabled = !b;
|
639
|
+
});
|
640
|
+
};
|
641
|
+
|
642
|
+
/**
|
643
|
+
* Checks/unchecks any matching checkboxes or radio buttons and
|
644
|
+
* selects/deselects and matching option elements.
|
645
|
+
*/
|
646
|
+
$.fn.selected = function(select) {
|
647
|
+
if (select == undefined) select = true;
|
648
|
+
return this.each(function() {
|
649
|
+
var t = this.type;
|
650
|
+
if (t == 'checkbox' || t == 'radio')
|
651
|
+
this.checked = select;
|
652
|
+
else if (this.tagName.toLowerCase() == 'option') {
|
653
|
+
var $sel = $(this).parent('select');
|
654
|
+
if (select && $sel[0] && $sel[0].type == 'select-one') {
|
655
|
+
// deselect all other options
|
656
|
+
$sel.find('option').selected(false);
|
657
|
+
}
|
658
|
+
this.selected = select;
|
659
|
+
}
|
660
|
+
});
|
661
|
+
};
|
662
|
+
|
663
|
+
// helper fn for console logging
|
664
|
+
// set $.fn.ajaxSubmit.debug to true to enable debug logging
|
665
|
+
function log() {
|
666
|
+
if ($.fn.ajaxSubmit.debug) {
|
667
|
+
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
|
668
|
+
if (window.console && window.console.log)
|
669
|
+
window.console.log(msg);
|
670
|
+
else if (window.opera && window.opera.postError)
|
671
|
+
window.opera.postError(msg);
|
672
|
+
}
|
673
|
+
};
|
674
|
+
|
675
|
+
})(jQuery);
|