mdd 0.0.1 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/helpers/mdd_helper.rb +16 -0
- data/app/views/template/mdwa/_autocomplete_tag.html.erb +18 -0
- data/app/views/template/mdwa/_login_text.html.erb +3 -0
- data/app/views/template/mdwa/_notice.html.erb +17 -0
- data/lib/generators/mdd/sandbox/sandbox_generator.rb +171 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/images/.DS_Store +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/images/mdwa/ajax-loader.gif +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/images/mdwa/backend_bg.png +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/images/mdwa/barra-16.gif +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/images/mdwa/bg_ip.png +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/images/mdwa/bg_left.jpg +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/images/mdwa/bg_window_header.png +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/images/mdwa/bt_g.png +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/images/mdwa/button_submit.gif +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/images/mdwa/fancybox_loading.gif +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/images/mdwa/fancybox_sprite.png +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/images/mdwa/headerbg.png +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/images/mdwa/icons/add.png +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/images/mdwa/icons/delete.png +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/images/mdwa/icons/dropdown.png +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/images/mdwa/icons/edit.png +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/images/mdwa/icons/lupa.png +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/images/mdwa/icons/remove-icon.png +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/images/mdwa/notice_close.png +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/.DS_Store +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/jquery/jquery-ui.js +356 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/jquery/jquery.bgiframe.js +10 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/jquery/jquery.easing.js +72 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/jquery/jquery.fancybox.js +31 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/jquery/jquery.hover_intent.js +84 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/jquery/jquery.mousewheel.js +13 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/jquery/jquery.popup_window.js +62 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/jquery/jquery.validate.js +51 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/mdwa/.DS_Store +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/mdwa/login_manifest.js +4 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/mdwa/public_manifest.js +4 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/mdwa/system_manifest.js +8 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/mdwa/template/ajaxloader.js +21 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/mdwa/template/all_pages.js +41 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/mdwa/template/clicable_title.js +19 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/mdwa/template/nested_form.js +46 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/mdwa/template/pagination.js +6 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/stylesheets/.DS_Store +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/stylesheets/jquery/.DS_Store +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/stylesheets/jquery/jquery-ui-theme1.css +573 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/stylesheets/jquery/jquery.fancybox.css +226 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/stylesheets/mdwa/.DS_Store +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/stylesheets/mdwa/login/login.css +124 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/stylesheets/mdwa/login_manifest.css +8 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/stylesheets/mdwa/public_manifest.css +8 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/stylesheets/mdwa/system_manifest.css +14 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/stylesheets/mdwa/template/backend.css.erb +165 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/stylesheets/mdwa/template/backend_base.css.erb +50 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/stylesheets/mdwa/template/cssbase.css +79 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/stylesheets/mdwa/template/grid.css +159 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/stylesheets/mdwa/template/leftbar.css.erb +0 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/stylesheets/mdwa/template/reset.css +124 -0
- data/lib/generators/mdd/sandbox/templates/app/assets/stylesheets/mdwa/template/template.css.erb +269 -0
- data/lib/generators/mdd/sandbox/templates/app/controllers/a/administrators_controller.rb +82 -0
- data/lib/generators/mdd/sandbox/templates/app/controllers/a/backend_controller.rb +16 -0
- data/lib/generators/mdd/sandbox/templates/app/controllers/a/home_controller.rb +10 -0
- data/lib/generators/mdd/sandbox/templates/app/controllers/a/users/passwords_controller.rb +20 -0
- data/lib/generators/mdd/sandbox/templates/app/controllers/a/users/sessions_controller.rb +3 -0
- data/lib/generators/mdd/sandbox/templates/app/controllers/public_controller.rb +4 -0
- data/lib/generators/mdd/sandbox/templates/app/models/ability.rb +13 -0
- data/lib/generators/mdd/sandbox/templates/app/models/administrator.rb +9 -0
- data/lib/generators/mdd/sandbox/templates/app/models/permission.rb +8 -0
- data/lib/generators/mdd/sandbox/templates/app/models/user.rb +15 -0
- data/lib/generators/mdd/sandbox/templates/app/views/a/administrators/_administrators.html.erb +18 -0
- data/lib/generators/mdd/sandbox/templates/app/views/a/administrators/_form.html.erb +50 -0
- data/lib/generators/mdd/sandbox/templates/app/views/a/administrators/edit.html.erb +7 -0
- data/lib/generators/mdd/sandbox/templates/app/views/a/administrators/index.html.erb +9 -0
- data/lib/generators/mdd/sandbox/templates/app/views/a/administrators/new.html.erb +7 -0
- data/lib/generators/mdd/sandbox/templates/app/views/a/home/index.html.erb +7 -0
- data/lib/generators/mdd/sandbox/templates/app/views/a/users/_welcome.html.erb +9 -0
- data/lib/generators/mdd/sandbox/templates/app/views/a/users/confirmations/new.html.erb +12 -0
- data/lib/generators/mdd/sandbox/templates/app/views/a/users/mailer/confirmation_instructions.html.erb +5 -0
- data/lib/generators/mdd/sandbox/templates/app/views/a/users/mailer/reset_password_instructions.html.erb +8 -0
- data/lib/generators/mdd/sandbox/templates/app/views/a/users/mailer/unlock_instructions.html.erb +7 -0
- data/lib/generators/mdd/sandbox/templates/app/views/a/users/passwords/edit.html.erb +35 -0
- data/lib/generators/mdd/sandbox/templates/app/views/a/users/passwords/new.html.erb +12 -0
- data/lib/generators/mdd/sandbox/templates/app/views/a/users/registrations/edit.html.erb +25 -0
- data/lib/generators/mdd/sandbox/templates/app/views/a/users/registrations/new.html.erb +18 -0
- data/lib/generators/mdd/sandbox/templates/app/views/a/users/sessions/new.html.erb +19 -0
- data/lib/generators/mdd/sandbox/templates/app/views/a/users/shared/_links.erb +25 -0
- data/lib/generators/mdd/sandbox/templates/app/views/a/users/unlocks/new.html.erb +12 -0
- data/lib/generators/mdd/sandbox/templates/app/views/layouts/login.html.erb +19 -0
- data/lib/generators/mdd/sandbox/templates/app/views/layouts/public.html.erb +12 -0
- data/lib/generators/mdd/sandbox/templates/app/views/layouts/system.html.erb +37 -0
- data/lib/generators/mdd/sandbox/templates/app/views/public/index.html.erb +5 -0
- data/lib/generators/mdd/sandbox/templates/app/views/template/_leftbar.html.erb +11 -0
- data/lib/generators/mdd/sandbox/templates/config/initializers/devise.rb +223 -0
- data/lib/generators/mdd/sandbox/templates/config/initializers/mdd_inflections.rb +5 -0
- data/lib/generators/mdd/sandbox/templates/config/initializers/mdd_layout.rb +7 -0
- data/lib/generators/mdd/sandbox/templates/config/initializers/will_paginate.rb +2 -0
- data/lib/generators/mdd/sandbox/templates/config/locales/devise.en.yml +57 -0
- data/lib/generators/mdd/sandbox/templates/config/locales/mdwa.en.yml +39 -0
- data/lib/generators/mdd/sandbox/templates/db/migrate/create_permissions.rb +8 -0
- data/lib/generators/mdd/sandbox/templates/db/migrate/create_user_permissions.rb +8 -0
- data/lib/generators/mdd/sandbox/templates/db/migrate/devise_create_users.rb +38 -0
- data/lib/generators/mdd/sandbox/templates/db/seeds.rb +2 -0
- data/lib/generators/mdd/sandbox/templates/db/seeds/.DS_Store +0 -0
- data/lib/generators/mdd/sandbox/templates/db/seeds/site.rb +3 -0
- data/lib/mdd.rb +8 -1
- data/lib/mdd/.DS_Store +0 -0
- data/lib/mdd/layout/base.rb +97 -0
- data/lib/mdd/layout/helper.rb +20 -0
- data/lib/mdd/version.rb +1 -1
- data/mdd.gemspec +2 -3
- metadata +150 -28
- data/app/helpers/pagination_helper.rb +0 -12
- data/app/models/layout_base.rb +0 -89
- data/app/models/settings.rb +0 -3
@@ -0,0 +1,10 @@
|
|
1
|
+
/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
|
2
|
+
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
3
|
+
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
4
|
+
*
|
5
|
+
* $LastChangedDate: 2007-06-19 20:25:28 -0500 (Tue, 19 Jun 2007) $
|
6
|
+
* $Rev: 2111 $
|
7
|
+
*
|
8
|
+
* Version 2.1
|
9
|
+
*/
|
10
|
+
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&parseInt($.browser.version)<=6){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};if(!$.browser.version)$.browser.version=navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)[1];})(jQuery);
|
@@ -0,0 +1,72 @@
|
|
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
|
+
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('h.i[\'1a\']=h.i[\'z\'];h.O(h.i,{y:\'D\',z:9(x,t,b,c,d){6 h.i[h.i.y](x,t,b,c,d)},17:9(x,t,b,c,d){6 c*(t/=d)*t+b},D:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},13:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},X:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},U:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},R:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},N:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},M:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},L:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},K:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},J:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},I:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},G:9(x,t,b,c,d){6-c*8.C(t/d*(8.g/2))+c+b},15:9(x,t,b,c,d){6 c*8.n(t/d*(8.g/2))+b},12:9(x,t,b,c,d){6-c/2*(8.C(8.g*t/d)-1)+b},Z:9(x,t,b,c,d){6(t==0)?b:c*8.j(2,10*(t/d-1))+b},Y:9(x,t,b,c,d){6(t==d)?b+c:c*(-8.j(2,-10*t/d)+1)+b},W:9(x,t,b,c,d){e(t==0)6 b;e(t==d)6 b+c;e((t/=d/2)<1)6 c/2*8.j(2,10*(t-1))+b;6 c/2*(-8.j(2,-10*--t)+2)+b},V:9(x,t,b,c,d){6-c*(8.o(1-(t/=d)*t)-1)+b},S:9(x,t,b,c,d){6 c*8.o(1-(t=t/d-1)*t)+b},Q:9(x,t,b,c,d){e((t/=d/2)<1)6-c/2*(8.o(1-t*t)-1)+b;6 c/2*(8.o(1-(t-=2)*t)+1)+b},P:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6-(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b},H:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6 a*8.j(2,-10*t)*8.n((t*d-s)*(2*8.g)/p)+c+b},T:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d/2)==2)6 b+c;e(!p)p=d*(.3*1.5);e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);e(t<1)6-.5*(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b;6 a*8.j(2,-10*(t-=1))*8.n((t*d-s)*(2*8.g)/p)*.5+c+b},F:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*(t/=d)*t*((s+1)*t-s)+b},E:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},16:9(x,t,b,c,d,s){e(s==u)s=1.l;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.B))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.B))+1)*t+s)+2)+b},A:9(x,t,b,c,d){6 c-h.i.v(x,d-t,0,c,d)+b},v:9(x,t,b,c,d){e((t/=d)<(1/2.k)){6 c*(7.q*t*t)+b}m e(t<(2/2.k)){6 c*(7.q*(t-=(1.5/2.k))*t+.k)+b}m e(t<(2.5/2.k)){6 c*(7.q*(t-=(2.14/2.k))*t+.11)+b}m{6 c*(7.q*(t-=(2.18/2.k))*t+.19)+b}},1b:9(x,t,b,c,d){e(t<d/2)6 h.i.A(x,t*2,0,c,d)*.5+b;6 h.i.v(x,t*2-d,0,c,d)*.5+c*.5+b}});',62,74,'||||||return||Math|function|||||if|var|PI|jQuery|easing|pow|75|70158|else|sin|sqrt||5625|asin|||undefined|easeOutBounce|abs||def|swing|easeInBounce|525|cos|easeOutQuad|easeOutBack|easeInBack|easeInSine|easeOutElastic|easeInOutQuint|easeOutQuint|easeInQuint|easeInOutQuart|easeOutQuart|easeInQuart|extend|easeInElastic|easeInOutCirc|easeInOutCubic|easeOutCirc|easeInOutElastic|easeOutCubic|easeInCirc|easeInOutExpo|easeInCubic|easeOutExpo|easeInExpo||9375|easeInOutSine|easeInOutQuad|25|easeOutSine|easeInOutBack|easeInQuad|625|984375|jswing|easeInOutBounce'.split('|'),0,{}))
|
40
|
+
|
41
|
+
/*
|
42
|
+
*
|
43
|
+
* TERMS OF USE - EASING EQUATIONS
|
44
|
+
*
|
45
|
+
* Open source under the BSD License.
|
46
|
+
*
|
47
|
+
* Copyright © 2001 Robert Penner
|
48
|
+
* All rights reserved.
|
49
|
+
*
|
50
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
51
|
+
* are permitted provided that the following conditions are met:
|
52
|
+
*
|
53
|
+
* Redistributions of source code must retain the above copyright notice, this list of
|
54
|
+
* conditions and the following disclaimer.
|
55
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list
|
56
|
+
* of conditions and the following disclaimer in the documentation and/or other materials
|
57
|
+
* provided with the distribution.
|
58
|
+
*
|
59
|
+
* Neither the name of the author nor the names of contributors may be used to endorse
|
60
|
+
* or promote products derived from this software without specific prior written permission.
|
61
|
+
*
|
62
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
63
|
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
64
|
+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
65
|
+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
66
|
+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
67
|
+
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
68
|
+
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
69
|
+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
70
|
+
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
71
|
+
*
|
72
|
+
*/
|
@@ -0,0 +1,31 @@
|
|
1
|
+
/*! fancyBox v2.0.1 fancyapps.com | fancyapps.com/fancybox/#license */
|
2
|
+
(function(p,m,e){var h=e(p),i=e(m),a=e.fancybox=function(){a.open.apply(this,arguments)},n=!1,o=null;e.extend(a,{version:"2.0.1",defaults:{padding:15,margin:20,width:800,height:600,minWidth:200,minHeight:200,maxWidth:9999,maxHeight:9999,autoSize:!0,fitToView:!0,aspectRatio:!1,topRatio:0.5,fixed:!e.browser.msie||6<e.browser.version,scrolling:"auto",wrapCSS:"fancybox-default",arrows:!0,closeBtn:!0,closeClick:!0,mouseWheel:!0,autoPlay:!1,playSpeed:3E3,loop:!0,ajax:{},keys:{next:[13,32,34,39,40],prev:[8,
|
3
|
+
33,37,38],close:[27]},index:0,type:null,href:null,content:null,title:null,tpl:{wrap:'<div class="fancybox-wrap"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div>',image:'<img class="fancybox-image" src="{href}" alt="" />',iframe:'<iframe class="fancybox-iframe" name="fancybox-frame{rnd}" frameborder="0" hspace="0" '+(e.browser.msie?'allowtransparency="true""':"")+' scrolling="{scrolling}" src="{href}"></iframe>',swf:'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="wmode" value="transparent" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{href}" /><embed src="{href}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="100%" height="100%" wmode="transparent"></embed></object>',
|
4
|
+
error:'<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',closeBtn:'<div title="Close" class="fancybox-item fancybox-close"></div>',next:'<a title="Next" class="fancybox-item fancybox-next"><span></span></a>',prev:'<a title="Previous" class="fancybox-item fancybox-prev"><span></span></a>'},openEffect:"fade",openSpeed:500,openEasing:"swing",openOpacity:!0,openMethod:"zoomIn",closeEffect:"fade",closeSpeed:500,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",
|
5
|
+
nextEffect:"elastic",nextSpeed:300,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:300,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:{speedIn:0,speedOut:0,opacity:0.85,css:{cursor:"pointer","background-color":"rgba(0, 0, 0, 0.85)"},closeClick:!0},title:{type:"float"}}},group:{},opts:{},coming:null,current:null,isOpen:!1,isOpened:!1,wrap:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(b,
|
6
|
+
c){e.isArray(b)||(b=[b]);if(b.length)a.close(!0),a.opts=e.extend(!0,{},a.defaults,c),a.group=b,a._start(a.opts.index||0)},cancel:function(){if(!(a.coming&&!1===a.trigger("onCancel"))&&(a.coming=null,a.hideLoading(),a.ajaxLoad&&a.ajaxLoad.abort(),a.ajaxLoad=null,a.imgPreload))a.imgPreload.onload=a.imgPreload.onabort=a.imgPreload.onerror=null},close:function(b){a.cancel();if(a.current&&!1!==a.trigger("beforeClose"))!a.isOpen||b&&!0===b[0]?(e(".fancybox-wrap").stop().trigger("onReset").remove(),a._afterZoomOut()):
|
7
|
+
(a.isOpen=a.isOpened=!1,e(".fancybox-item").remove(),a.wrap.stop(!0).removeClass("fancybox-opened"),a.inner.css("overflow","hidden"),a.transitions[a.current.closeMethod]())},play:function(b){var c=function(){clearTimeout(a.player.timer)},d=function(){c();if(a.current&&a.player.isActive)a.player.timer=setTimeout(a.next,a.current.playSpeed)},f=function(){c();i.unbind(".player");a.player.isActive=!1;a.trigger("onPlayEnd")};if(a.player.isActive||b&&!1===b[0])f();else if(a.current&&(a.current.loop||a.current.index<
|
8
|
+
a.group.length-1))a.player.isActive=!0,d(),i.bind({"onCancel.player onComplete.player onUpdate.player":d,"onClose.player":f,"onStart.player":c}),a.trigger("onPlayStart")},next:function(){a.current&&a.jumpto(a.current.index+1)},prev:function(){a.current&&a.jumpto(a.current.index-1)},jumpto:function(b){a.current&&(b=parseInt(b,10),1<a.group.length&&a.current.loop&&(b>=a.group.length?b=0:0>b&&(b=a.group.length-1)),"undefined"!==typeof a.group[b]&&(a.cancel(),a._start(b)))},reposition:function(b){a.isOpen&&
|
9
|
+
a.wrap.css(a._getPosition(b))},update:function(){a.isOpen&&(n||(o=setInterval(function(){if(n&&(n=!1,clearTimeout(o),a.current)){if(a.current.autoSize)a.inner.height("auto"),a.current.height=a.inner.height();a._setDimension();a.current.canGrow&&a.inner.height("auto");a.reposition();a.trigger("onUpdate")}},100)),n=!0)},toggle:function(){if(a.isOpen)a.current.fitToView=!a.current.fitToView,a.update()},hideLoading:function(){e("#fancybox-loading").remove()},showLoading:function(){a.hideLoading();e('<div id="fancybox-loading"></div>').click(a.cancel).appendTo("body")},
|
10
|
+
getViewport:function(){return{x:h.scrollLeft(),y:h.scrollTop(),w:h.width(),h:h.height()}},unbindEvents:function(){i.unbind(".fb");h.unbind(".fb")},bindEvents:function(){var b=a.current,c=b.keys;b&&(h.bind("resize.fb, orientationchange.fb",a.update),c&&i.bind("keydown.fb",function(b){-1<e.inArray(b.target.tagName.toLowerCase(),["input","textarea","select","button"])||(-1<e.inArray(b.keyCode,c.close)?(a.close(),b.preventDefault()):-1<e.inArray(b.keyCode,c.next)?(a.next(),b.preventDefault()):-1<e.inArray(b.keyCode,
|
11
|
+
c.prev)&&(a.prev(),b.preventDefault()))}),e.fn.mousewheel&&b.mouseWheel&&1<a.group.length&&a.wrap.bind("mousewheel.fb",function(b,c){if(0===e(b.target).get(0).clientHeight||e(b.target).get(0).scrollHeight===e(b.target).get(0).clientHeight)b.preventDefault(),a[0<c?"prev":"next"]()}))},trigger:function(b){var c,d=-1<e.inArray(b,["onCancel","beforeLoad","afterLoad"])?"coming":"current";if(a[d]){e.isFunction(a[d][b])&&(c=a[d][b].apply(a[d],Array.prototype.slice.call(arguments,1)));if(!1===c)return!1;
|
12
|
+
a[d].helpers&&e.each(a[d].helpers,function(c,d){if(d&&"undefined"!==typeof a.helpers[c]&&e.isFunction(a.helpers[c][b]))a.helpers[c][b](d)});e.event.trigger(b+".fb")}},isImage:function(a){return a&&a.match(/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i)},isSWF:function(a){return a&&a.match(/\.(swf)(.*)?$/i)},_start:function(b){var c=a.group[b]||null,d,f,g;coming=e.extend(!0,{},a.opts,e.isPlainObject(c)?c:{},{index:b,element:c});if("number"===typeof coming.margin)coming.margin=[coming.margin,coming.margin,coming.margin,
|
13
|
+
coming.margin];a.coming=coming;if(!1===a.trigger("beforeLoad"))a.coming=null;else{if(coming.content)c=coming.content;if("object"==typeof c&&(c.nodeType||c instanceof e))d=!0,coming.href=e(c).attr("href")||coming.href,coming.title=e(c).attr("title")||coming.title;f=coming.type;b=coming.href;c=coming.element;if(!f){if(b)d&&(g=e(c).data("fancybox-type"),!g&&c.className&&(g=(g=c.className.match(/fancybox\.(\w+)/))?g[1]:!1)),g?f=g:a.isImage(b)?f="image":a.isSWF(b)?f="swf":b.match(/^#/)?f="inline":coming.content=
|
14
|
+
b;f||(f=d?"inline":"html");coming.type=f}if(!coming.content)coming.content="inline"===f&&b?e(b):c;a.coming=coming;"image"===f?a._loadImage():"ajax"===f?a._loadAjax():!f||"inline"===f&&!coming.content.length?a._error():a._afterLoad()}},_error:function(){a.coming.type="html";a.coming.minHeight=0;a.coming.autoSize=!0;a.coming.content=a.coming.tpl.error;a._afterLoad()},_loadImage:function(){a.imgPreload=new Image;a.imgPreload.onload=function(){this.onload=this.onerror=null;a.coming.width=this.width;a.coming.height=
|
15
|
+
this.height;a._afterLoad()};a.imgPreload.onerror=function(){this.onload=this.onerror=null;a._error()};a.imgPreload.src=a.coming.href;a.imgPreload.complete||a.showLoading()},_loadAjax:function(){a.showLoading();a.ajaxLoad=e.ajax(e.extend({},a.coming.ajax,{url:a.coming.href,error:function(b,c,d){"abort"!==c&&0<b.status?(a.coming.content=d,a._error()):a.hideLoading()},success:function(b,c){if("success"===c)a.coming.content=b,a._afterLoad()}}))},_afterLoad:function(){a.hideLoading();if(!a.coming||!1===
|
16
|
+
a.trigger("afterLoad",a.current))a.coming=!1;else if(a.isOpened?(e(".fancybox-item").remove(),a.wrap.stop(!0).removeClass("fancybox-opened"),a.transitions[a.current.prevMethod]()):e(".fancybox-wrap").stop().trigger("onReset").remove(),a.isOpen=!1,a.current=a.coming,a.coming=!1,a.wrap=e(a.current.tpl.wrap).addClass(a.current.wrapCSS).appendTo("body"),a.outer=e(".fancybox-outer",a.wrap).css("padding",a.current.padding+"px"),a.inner=e(".fancybox-inner",a.wrap),a._setContent(),a.unbindEvents(),a.bindEvents(),
|
17
|
+
a.trigger("beforeShow"),a._setDimension(),a.isOpened)a.transitions[a.current.nextMethod]();else a.transitions[a.current.openMethod]()},_setContent:function(){var b,c,d=a.current,f=d.type;switch(f){case "inline":case "ajax":case "html":"inline"===f?(b=d.content.show().detach(),b.parent().hasClass("fancybox-inner")&&b.parents(".fancybox-wrap").trigger("onReset").remove(),e(a.wrap).bind("onReset",function(){b.appendTo("body").hide()})):b=d.content;if(d.autoSize)c=e('<div class="fancybox-tmp"></div>').appendTo(e("body")).append(b),
|
18
|
+
d.width=c.outerWidth(),d.height=c.outerHeight(!0),b=c.children().detach(),c.remove();break;case "image":b=d.tpl.image.replace("{href}",d.href);d.aspectRatio=!0;break;case "swf":b=d.tpl.swf.replace(/\{width\}/g,d.width).replace(/\{height\}/g,d.height).replace(/\{href\}/g,d.href);break;case "iframe":b=d.tpl.iframe.replace("{href}",d.href).replace("{scrolling}",d.scrolling).replace("{rnd}",(new Date).getTime())}if(-1<e.inArray(f,["image","swf","iframe"]))d.autoSize=!1,d.scrolling=!1;a.current=d;a.inner.append(b)},
|
19
|
+
_setDimension:function(){var b=a.getViewport(),c=a.current.margin,d=2*a.current.padding,f=a.current.width+d,g=a.current.height+d,j=a.current.width/a.current.height,l=a.current.maxWidth,k=a.current.maxHeight,h=a.current.minWidth,i=a.current.minHeight;b.w-=c[1]+c[3];b.h-=c[0]+c[2];-1<f.toString().indexOf("%")&&(f=b.w*parseFloat(f)/100);-1<g.toString().indexOf("%")&&(g=b.h*parseFloat(g)/100);a.current.fitToView&&(l=Math.min(b.w,l),k=Math.min(b.h,k));l=Math.max(h,l);k=Math.max(i,k);a.current.aspectRatio?
|
20
|
+
(f>l&&(f=l,g=(f-d)/j+d),g>k&&(g=k,f=(g-d)*j+d),f<h&&(f=h,g=(f-d)/j+d),g<i&&(g=i,f=(g-d)*j+d)):(f=Math.max(h,Math.min(f,l)),g=Math.max(i,Math.min(g,k)));f=Math.round(f);g=Math.round(g);e(a.wrap.add(a.outer).add(a.inner)).width("auto").height("auto");a.inner.width(f-d).height(g-d);a.wrap.width(f);c=a.wrap.height();if(f>l||c>k)for(;(f>l||c>k)&&f>h&&c>i;)g-=10,a.current.aspectRatio?(f=Math.round((g-d)*j+d),f<h&&(f=h,g=(f-d)/j+d)):f-=10,a.inner.width(f-d).height(g-d),a.wrap.width(f),c=a.wrap.height();
|
21
|
+
a.current.dim={width:f,height:c};a.current.canGrow=a.current.autoSize&&g>i&&g<k;a.current.canShrink=!1;a.current.canExpand=!1;if(f-d<a.current.width||g-d<a.current.height)a.current.canExpand=!0;else if((f>b.w||c>b.h)&&f>h&&g>i)a.current.canShrink=!0},_getPosition:function(b){var c=a.getViewport(),d=a.current.margin,f=a.wrap.width()+d[1]+d[3],e=a.wrap.height()+d[0]+d[2],j={position:"absolute",top:d[0]+c.y,left:d[3]+c.x};if(a.current.fixed&&(!b||!1===b[0])&&e<=c.h&&f<=c.w)j={position:"fixed",top:d[0],
|
22
|
+
left:d[3]};j.top=Math.ceil(Math.max(j.top,j.top+(c.h-e)*a.current.topRatio))+"px";j.left=Math.ceil(Math.max(j.left,j.left+0.5*(c.w-f)))+"px";return j},_afterZoomIn:function(){var b=a.current;a.isOpen=a.isOpened=!0;a.wrap.addClass("fancybox-opened").css("overflow","visible");a.update();a.inner.css("overflow","auto"===b.scrolling?"auto":"yes"===b.scrolling?"scroll":"hidden");b.closeClick&&a.inner.bind("click.fb",a.close);b.closeBtn&&e(a.current.tpl.closeBtn).appendTo(a.wrap).bind("click.fb",a.close);
|
23
|
+
b.arrows&&1<a.group.length&&((b.loop||0<b.index)&&e(b.tpl.prev).appendTo(a.wrap).bind("click.fb",a.prev),(b.loop||b.index<a.group.length-1)&&e(b.tpl.next).appendTo(a.wrap).bind("click.fb",a.next));a.trigger("afterShow");if(a.opts.autoPlay&&!a.player.isActive)a.opts.autoPlay=!1,a.play()},_afterZoomOut:function(){a.unbindEvents();a.trigger("afterClose");a.wrap.trigger("onReset").remove();e.extend(a,{group:{},opts:{},current:null,isOpened:!1,isOpen:!1,wrap:null,outer:null,inner:null})}});a.transitions=
|
24
|
+
{getOrigPosition:function(){var b=a.current.element,c={},d=50,f=50,g;b&&b.nodeName&&e(b).is(":visible")?(g=e(b).find("img:first"),g.length?(c=g.offset(),d=g.outerWidth(),f=g.outerHeight()):c=e(b).offset()):(b=a.getViewport(),c.top=b.y+0.5*(b.h-f),c.left=b.x+0.5*(b.w-d));return c={top:Math.ceil(c.top)+"px",left:Math.ceil(c.left)+"px",width:Math.ceil(d)+"px",height:Math.ceil(f)+"px"}},step:function(b,c){var d,f,e;if("width"===c.prop||"height"===c.prop)f=e=Math.ceil(b-2*a.current.padding),"height"===
|
25
|
+
c.prop&&(d=(b-c.start)/(c.end-c.start),c.start>c.end&&(d=1-d),f-=a.innerSpace*d,e-=a.outerSpace*d),a.inner[c.prop](f),a.outer[c.prop](e)},zoomIn:function(){var b,c;b=a.current.dim;c=b.height-2*a.current.padding;a.innerSpace=c-a.inner.height();a.outerSpace=c-a.outer.height();if("elastic"===a.current.openEffect){c=e.extend({},b,a._getPosition(!0));delete c.position;b=this.getOrigPosition();if(a.current.openOpacity)b.opacity=0,c.opacity=1;a.wrap.css(b).animate(c,{duration:a.current.openSpeed,easing:a.current.openEasing,
|
26
|
+
step:this.step,complete:a._afterZoomIn})}else a.wrap.css(e.extend({},a.current.dim,a._getPosition())),"fade"===a.current.openEffect?a.wrap.hide().fadeIn(a.current.openSpeed,a._afterZoomIn):a._afterZoomIn()},zoomOut:function(){var b;b=a.wrap.height()-2*a.current.padding;if("elastic"===a.current.closeEffect){"fixed"===a.wrap.css("position")&&a.wrap.css(a._getPosition(!0));a.innerSpace=b-a.inner.height();a.outerSpace=b-a.outer.height();b=this.getOrigPosition();if(a.current.closeOpacity)b.opacity=0;a.wrap.animate(b,
|
27
|
+
{duration:a.current.closeSpeed,easing:a.current.closeEasing,step:this.step,complete:a._afterZoomOut})}else a.wrap.fadeOut("fade"===a.current.closeEffect?a.current.Speed:0,a._afterZoomOut)},changeIn:function(){var b;"elastic"===a.current.nextEffect?(b=a._getPosition(!0),b.opacity=0,b.top=parseInt(b.top,10)-200+"px",a.wrap.css(b).animate({opacity:1,top:"+=200px"},{duration:a.current.nextSpeed,complete:a._afterZoomIn})):(a.wrap.css(a._getPosition()),"fade"===a.current.nextEffect?a.wrap.hide().fadeIn(a.current.nextSpeed,
|
28
|
+
a._afterZoomIn):a._afterZoomIn())},changeOut:function(){function b(){e(this).trigger("onReset").remove()}a.wrap.removeClass("fancybox-opened");"elastic"===a.current.prevEffect?a.wrap.animate({opacity:0,top:"+=200px"},{duration:a.current.prevSpeed,complete:b}):a.wrap.fadeOut("fade"===a.current.prevEffect?a.current.prevSpeed:0,b)}};a.helpers.overlay={overlay:null,update:function(){var a,c;this.overlay.width(0).height(0);e.browser.msie?(a=Math.max(m.documentElement.scrollWidth,m.body.scrollWidth),c=
|
29
|
+
Math.max(m.documentElement.offsetWidth,m.body.offsetWidth),a=a<c?h.width():a):a=i.width();this.overlay.width(a).height(i.height())},beforeShow:function(b){if(!this.overlay)this.overlay=e('<div id="fancybox-overlay"></div>').css(b.css||{background:"black"}).appendTo("body"),b.closeClick&&this.overlay.bind("click.fb",a.close),h.bind("resize.fb",e.proxy(this.update,this)),this.update(),this.overlay.fadeTo(b.speedIn||"fast",b.opacity||1)},onUpdate:function(){this.update()},afterClose:function(a){this.overlay&&
|
30
|
+
this.overlay.fadeOut(a.speedOut||"fast",function(){e(this).remove()});this.overlay=null}};a.helpers.title={beforeShow:function(b){var c;if(c=a.current.title||a.current.element.title||"")c=e('<div class="fancybox-title fancybox-title-'+b.type+'-wrap">'+c+"</div>").appendTo("body"),"float"===b.type&&(c.width(c.width()),c.wrapInner('<span class="child"></span>'),a.current.margin[2]+=Math.abs(parseInt(c.css("margin-bottom"),10))),c.appendTo("over"===b.type?a.inner:"outside"===b.type?a.wrap:a.outer)}};
|
31
|
+
e.fn.fancybox=function(b){function c(b){var c=[];b.preventDefault();this.rel&&""!==this.rel&&"nofollow"!==this.rel&&(c=f.length?e(f).filter('[rel="'+this.rel+'"]'):e('[rel="'+this.rel+'"]'));c.length?(d.index=c.index(this),a(c.get(),d)):a(this,d);return!1}var d=b||{},f=this.selector||"";f?i.undelegate(f,"click.fb-start").delegate(f,"click.fb-start",c):e(this).unbind("click.fb-start").bind("click.fb-start",c)}})(window,document,jQuery);
|
data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/jquery/jquery.hover_intent.js
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
(function($){
|
2
|
+
/* hoverIntent by Brian Cherne */
|
3
|
+
$.fn.hoverIntent = function(f,g) {
|
4
|
+
// default configuration options
|
5
|
+
var cfg = {
|
6
|
+
sensitivity: 7,
|
7
|
+
interval: 100,
|
8
|
+
timeout: 0
|
9
|
+
};
|
10
|
+
// override configuration options with user supplied object
|
11
|
+
cfg = $.extend(cfg, g ? { over: f, out: g } : f );
|
12
|
+
|
13
|
+
// instantiate variables
|
14
|
+
// cX, cY = current X and Y position of mouse, updated by mousemove event
|
15
|
+
// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
|
16
|
+
var cX, cY, pX, pY;
|
17
|
+
|
18
|
+
// A private function for getting mouse position
|
19
|
+
var track = function(ev) {
|
20
|
+
cX = ev.pageX;
|
21
|
+
cY = ev.pageY;
|
22
|
+
};
|
23
|
+
|
24
|
+
// A private function for comparing current and previous mouse position
|
25
|
+
var compare = function(ev,ob) {
|
26
|
+
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
|
27
|
+
// compare mouse positions to see if they've crossed the threshold
|
28
|
+
if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
|
29
|
+
$(ob).unbind("mousemove",track);
|
30
|
+
// set hoverIntent state to true (so mouseOut can be called)
|
31
|
+
ob.hoverIntent_s = 1;
|
32
|
+
return cfg.over.apply(ob,[ev]);
|
33
|
+
} else {
|
34
|
+
// set previous coordinates for next time
|
35
|
+
pX = cX; pY = cY;
|
36
|
+
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
|
37
|
+
ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
|
38
|
+
}
|
39
|
+
};
|
40
|
+
|
41
|
+
// A private function for delaying the mouseOut function
|
42
|
+
var delay = function(ev,ob) {
|
43
|
+
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
|
44
|
+
ob.hoverIntent_s = 0;
|
45
|
+
return cfg.out.apply(ob,[ev]);
|
46
|
+
};
|
47
|
+
|
48
|
+
// A private function for handling mouse 'hovering'
|
49
|
+
var handleHover = function(e) {
|
50
|
+
// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
|
51
|
+
var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
|
52
|
+
while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
|
53
|
+
if ( p == this ) { return false; }
|
54
|
+
|
55
|
+
// copy objects to be passed into t (required for event object to be passed in IE)
|
56
|
+
var ev = jQuery.extend({},e);
|
57
|
+
var ob = this;
|
58
|
+
|
59
|
+
// cancel hoverIntent timer if it exists
|
60
|
+
if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
|
61
|
+
|
62
|
+
// else e.type == "onmouseover"
|
63
|
+
if (e.type == "mouseover") {
|
64
|
+
// set "previous" X and Y position based on initial entry point
|
65
|
+
pX = ev.pageX; pY = ev.pageY;
|
66
|
+
// update "current" X and Y position based on mousemove
|
67
|
+
$(ob).bind("mousemove",track);
|
68
|
+
// start polling interval (self-calling timeout) to compare mouse coordinates over time
|
69
|
+
if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
|
70
|
+
|
71
|
+
// else e.type == "onmouseout"
|
72
|
+
} else {
|
73
|
+
// unbind expensive mousemove event
|
74
|
+
$(ob).unbind("mousemove",track);
|
75
|
+
// if hoverIntent state is true, then call the mouseOut function after the specified delay
|
76
|
+
if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
|
77
|
+
}
|
78
|
+
};
|
79
|
+
|
80
|
+
// bind the function to the two event listeners
|
81
|
+
return this.mouseover(handleHover).mouseout(handleHover);
|
82
|
+
};
|
83
|
+
|
84
|
+
})(jQuery);
|
@@ -0,0 +1,13 @@
|
|
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
|
+
(function(d){function e(a){var b=a||window.event,c=[].slice.call(arguments,1),f=0,e=0,g=0,a=d.event.fix(b);a.type="mousewheel";b.wheelDelta&&(f=b.wheelDelta/120);b.detail&&(f=-b.detail/3);g=f;b.axis!==void 0&&b.axis===b.HORIZONTAL_AXIS&&(g=0,e=-1*f);b.wheelDeltaY!==void 0&&(g=b.wheelDeltaY/120);b.wheelDeltaX!==void 0&&(e=-1*b.wheelDeltaX/120);c.unshift(a,f,e,g);return(d.event.dispatch||d.event.handle).apply(this,c)}var c=["DOMMouseScroll","mousewheel"];if(d.event.fixHooks)for(var h=c.length;h;)d.event.fixHooks[c[--h]]=
|
13
|
+
d.event.mouseHooks;d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=c.length;a;)this.addEventListener(c[--a],e,false);else this.onmousewheel=e},teardown:function(){if(this.removeEventListener)for(var a=c.length;a;)this.removeEventListener(c[--a],e,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);
|
data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/jquery/jquery.popup_window.js
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
(function($){
|
2
|
+
$.fn.popupWindow = function(instanceSettings){
|
3
|
+
|
4
|
+
return this.each(function(){
|
5
|
+
|
6
|
+
$(this).click(function(){
|
7
|
+
|
8
|
+
$.fn.popupWindow.defaultSettings = {
|
9
|
+
centerBrowser:0, // center window over browser window? {1 (YES) or 0 (NO)}. overrides top and left
|
10
|
+
centerScreen:0, // center window over entire screen? {1 (YES) or 0 (NO)}. overrides top and left
|
11
|
+
height:500, // sets the height in pixels of the window.
|
12
|
+
left:0, // left position when the window appears.
|
13
|
+
location:0, // determines whether the address bar is displayed {1 (YES) or 0 (NO)}.
|
14
|
+
menubar:0, // determines whether the menu bar is displayed {1 (YES) or 0 (NO)}.
|
15
|
+
resizable:0, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable.
|
16
|
+
scrollbars:0, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}.
|
17
|
+
status:0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}.
|
18
|
+
width:500, // sets the width in pixels of the window.
|
19
|
+
windowName:null, // name of window set from the name attribute of the element that invokes the click
|
20
|
+
windowURL:null, // url used for the popup
|
21
|
+
top:0, // top position when the window appears.
|
22
|
+
toolbar:0 // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}.
|
23
|
+
};
|
24
|
+
|
25
|
+
settings = $.extend({}, $.fn.popupWindow.defaultSettings, instanceSettings || {});
|
26
|
+
|
27
|
+
var windowFeatures = 'height=' + settings.height +
|
28
|
+
',width=' + settings.width +
|
29
|
+
',toolbar=' + settings.toolbar +
|
30
|
+
',scrollbars=' + settings.scrollbars +
|
31
|
+
',status=' + settings.status +
|
32
|
+
',resizable=' + settings.resizable +
|
33
|
+
',location=' + settings.location +
|
34
|
+
',menuBar=' + settings.menubar;
|
35
|
+
|
36
|
+
settings.windowName = this.name || settings.windowName;
|
37
|
+
settings.windowURL = this.href || settings.windowURL;
|
38
|
+
var centeredY,centeredX;
|
39
|
+
|
40
|
+
if(settings.centerBrowser){
|
41
|
+
|
42
|
+
if ($.browser.msie) {//hacked together for IE browsers
|
43
|
+
centeredY = (window.screenTop - 120) + ((((document.documentElement.clientHeight + 120)/2) - (settings.height/2)));
|
44
|
+
centeredX = window.screenLeft + ((((document.body.offsetWidth + 20)/2) - (settings.width/2)));
|
45
|
+
}else{
|
46
|
+
centeredY = window.screenY + (((window.outerHeight/2) - (settings.height/2)));
|
47
|
+
centeredX = window.screenX + (((window.outerWidth/2) - (settings.width/2)));
|
48
|
+
}
|
49
|
+
window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();
|
50
|
+
}else if(settings.centerScreen){
|
51
|
+
centeredY = (screen.height - settings.height)/2;
|
52
|
+
centeredX = (screen.width - settings.width)/2;
|
53
|
+
window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();
|
54
|
+
}else{
|
55
|
+
window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + settings.left +',top=' + settings.top).focus();
|
56
|
+
}
|
57
|
+
return false;
|
58
|
+
});
|
59
|
+
|
60
|
+
});
|
61
|
+
};
|
62
|
+
})(jQuery);
|
@@ -0,0 +1,51 @@
|
|
1
|
+
/**
|
2
|
+
* jQuery Validation Plugin 1.9.0
|
3
|
+
*
|
4
|
+
* http://bassistance.de/jquery-plugins/jquery-plugin-validation/
|
5
|
+
* http://docs.jquery.com/Plugins/Validation
|
6
|
+
*
|
7
|
+
* Copyright (c) 2006 - 2011 Jörn Zaefferer
|
8
|
+
*
|
9
|
+
* Dual licensed under the MIT and GPL licenses:
|
10
|
+
* http://www.opensource.org/licenses/mit-license.php
|
11
|
+
* http://www.gnu.org/licenses/gpl.html
|
12
|
+
*/
|
13
|
+
(function(c){c.extend(c.fn,{validate:function(a){if(this.length){var b=c.data(this[0],"validator");if(b)return b;this.attr("novalidate","novalidate");b=new c.validator(a,this[0]);c.data(this[0],"validator",b);if(b.settings.onsubmit){a=this.find("input, button");a.filter(".cancel").click(function(){b.cancelSubmit=true});b.settings.submitHandler&&a.filter(":submit").click(function(){b.submitButton=this});this.submit(function(d){function e(){if(b.settings.submitHandler){if(b.submitButton)var f=c("<input type='hidden'/>").attr("name",
|
14
|
+
b.submitButton.name).val(b.submitButton.value).appendTo(b.currentForm);b.settings.submitHandler.call(b,b.currentForm);b.submitButton&&f.remove();return false}return true}b.settings.debug&&d.preventDefault();if(b.cancelSubmit){b.cancelSubmit=false;return e()}if(b.form()){if(b.pendingRequest){b.formSubmitted=true;return false}return e()}else{b.focusInvalid();return false}})}return b}else a&&a.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing")},valid:function(){if(c(this[0]).is("form"))return this.validate().form();
|
15
|
+
else{var a=true,b=c(this[0].form).validate();this.each(function(){a&=b.element(this)});return a}},removeAttrs:function(a){var b={},d=this;c.each(a.split(/\s/),function(e,f){b[f]=d.attr(f);d.removeAttr(f)});return b},rules:function(a,b){var d=this[0];if(a){var e=c.data(d.form,"validator").settings,f=e.rules,g=c.validator.staticRules(d);switch(a){case "add":c.extend(g,c.validator.normalizeRule(b));f[d.name]=g;if(b.messages)e.messages[d.name]=c.extend(e.messages[d.name],b.messages);break;case "remove":if(!b){delete f[d.name];
|
16
|
+
return g}var h={};c.each(b.split(/\s/),function(j,i){h[i]=g[i];delete g[i]});return h}}d=c.validator.normalizeRules(c.extend({},c.validator.metadataRules(d),c.validator.classRules(d),c.validator.attributeRules(d),c.validator.staticRules(d)),d);if(d.required){e=d.required;delete d.required;d=c.extend({required:e},d)}return d}});c.extend(c.expr[":"],{blank:function(a){return!c.trim(""+a.value)},filled:function(a){return!!c.trim(""+a.value)},unchecked:function(a){return!a.checked}});c.validator=function(a,
|
17
|
+
b){this.settings=c.extend(true,{},c.validator.defaults,a);this.currentForm=b;this.init()};c.validator.format=function(a,b){if(arguments.length==1)return function(){var d=c.makeArray(arguments);d.unshift(a);return c.validator.format.apply(this,d)};if(arguments.length>2&&b.constructor!=Array)b=c.makeArray(arguments).slice(1);if(b.constructor!=Array)b=[b];c.each(b,function(d,e){a=a.replace(RegExp("\\{"+d+"\\}","g"),e)});return a};c.extend(c.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",
|
18
|
+
validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:c([]),errorLabelContainer:c([]),onsubmit:true,ignore:":hidden",ignoreTitle:false,onfocusin:function(a){this.lastActive=a;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass);this.addWrapper(this.errorsFor(a)).hide()}},onfocusout:function(a){if(!this.checkable(a)&&(a.name in this.submitted||!this.optional(a)))this.element(a)},
|
19
|
+
onkeyup:function(a){if(a.name in this.submitted||a==this.lastElement)this.element(a)},onclick:function(a){if(a.name in this.submitted)this.element(a);else a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(a,b,d){a.type==="radio"?this.findByName(a.name).addClass(b).removeClass(d):c(a).addClass(b).removeClass(d)},unhighlight:function(a,b,d){a.type==="radio"?this.findByName(a.name).removeClass(b).addClass(d):c(a).removeClass(b).addClass(d)}},setDefaults:function(a){c.extend(c.validator.defaults,
|
20
|
+
a)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:c.validator.format("Please enter no more than {0} characters."),
|
21
|
+
minlength:c.validator.format("Please enter at least {0} characters."),rangelength:c.validator.format("Please enter a value between {0} and {1} characters long."),range:c.validator.format("Please enter a value between {0} and {1}."),max:c.validator.format("Please enter a value less than or equal to {0}."),min:c.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){function a(e){var f=c.data(this[0].form,"validator"),g="on"+e.type.replace(/^validate/,
|
22
|
+
"");f.settings[g]&&f.settings[g].call(f,this[0],e)}this.labelContainer=c(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||c(this.currentForm);this.containers=c(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var b=this.groups={};c.each(this.settings.groups,function(e,f){c.each(f.split(/\s/),function(g,h){b[h]=e})});var d=
|
23
|
+
this.settings.rules;c.each(d,function(e,f){d[e]=c.validator.normalizeRule(f)});c(this.currentForm).validateDelegate("[type='text'], [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",a).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",
|
24
|
+
a);this.settings.invalidHandler&&c(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){this.checkForm();c.extend(this.submitted,this.errorMap);this.invalid=c.extend({},this.errorMap);this.valid()||c(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(a){this.lastElement=
|
25
|
+
a=this.validationTargetFor(this.clean(a));this.prepareElement(a);this.currentElements=c(a);var b=this.check(a);if(b)delete this.invalid[a.name];else this.invalid[a.name]=true;if(!this.numberOfInvalids())this.toHide=this.toHide.add(this.containers);this.showErrors();return b},showErrors:function(a){if(a){c.extend(this.errorMap,a);this.errorList=[];for(var b in a)this.errorList.push({message:a[b],element:this.findByName(b)[0]});this.successList=c.grep(this.successList,function(d){return!(d.name in a)})}this.settings.showErrors?
|
26
|
+
this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){c.fn.resetForm&&c(this.currentForm).resetForm();this.submitted={};this.lastElement=null;this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b=0,d;for(d in a)b++;return b},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return this.size()==
|
27
|
+
0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{c(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(a){}},findLastActive:function(){var a=this.lastActive;return a&&c.grep(this.errorList,function(b){return b.element.name==a.name}).length==1&&a},elements:function(){var a=this,b={};return c(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&
|
28
|
+
a.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in b||!a.objectLength(c(this).rules()))return false;return b[this.name]=true})},clean:function(a){return c(a)[0]},errors:function(){return c(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext)},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=c([]);this.toHide=c([]);this.currentElements=c([])},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers)},
|
29
|
+
prepareElement:function(a){this.reset();this.toHide=this.errorsFor(a)},check:function(a){a=this.validationTargetFor(this.clean(a));var b=c(a).rules(),d=false,e;for(e in b){var f={method:e,parameters:b[e]};try{var g=c.validator.methods[e].call(this,a.value.replace(/\r/g,""),a,f.parameters);if(g=="dependency-mismatch")d=true;else{d=false;if(g=="pending"){this.toHide=this.toHide.not(this.errorsFor(a));return}if(!g){this.formatAndAdd(a,f);return false}}}catch(h){this.settings.debug&&window.console&&console.log("exception occured when checking element "+
|
30
|
+
a.id+", check the '"+f.method+"' method",h);throw h;}}if(!d){this.objectLength(b)&&this.successList.push(a);return true}},customMetaMessage:function(a,b){if(c.metadata){var d=this.settings.meta?c(a).metadata()[this.settings.meta]:c(a).metadata();return d&&d.messages&&d.messages[b]}},customMessage:function(a,b){var d=this.settings.messages[a];return d&&(d.constructor==String?d:d[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(arguments[a]!==undefined)return arguments[a]},defaultMessage:function(a,
|
31
|
+
b){return this.findDefined(this.customMessage(a.name,b),this.customMetaMessage(a,b),!this.settings.ignoreTitle&&a.title||undefined,c.validator.messages[b],"<strong>Warning: No message defined for "+a.name+"</strong>")},formatAndAdd:function(a,b){var d=this.defaultMessage(a,b.method),e=/\$?\{(\d+)\}/g;if(typeof d=="function")d=d.call(this,b.parameters,a);else if(e.test(d))d=jQuery.format(d.replace(e,"{$1}"),b.parameters);this.errorList.push({message:d,element:a});this.errorMap[a.name]=d;this.submitted[a.name]=
|
32
|
+
d},addWrapper:function(a){if(this.settings.wrapper)a=a.add(a.parent(this.settings.wrapper));return a},defaultShowErrors:function(){for(var a=0;this.errorList[a];a++){var b=this.errorList[a];this.settings.highlight&&this.settings.highlight.call(this,b.element,this.settings.errorClass,this.settings.validClass);this.showLabel(b.element,b.message)}if(this.errorList.length)this.toShow=this.toShow.add(this.containers);if(this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);
|
33
|
+
if(this.settings.unhighlight){a=0;for(b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass)}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return c(this.errorList).map(function(){return this.element})},showLabel:function(a,b){var d=this.errorsFor(a);if(d.length){d.removeClass(this.settings.validClass).addClass(this.settings.errorClass);
|
34
|
+
d.attr("generated")&&d.html(b)}else{d=c("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(a),generated:true}).addClass(this.settings.errorClass).html(b||"");if(this.settings.wrapper)d=d.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();this.labelContainer.append(d).length||(this.settings.errorPlacement?this.settings.errorPlacement(d,c(a)):d.insertAfter(a))}if(!b&&this.settings.success){d.text("");typeof this.settings.success=="string"?d.addClass(this.settings.success):this.settings.success(d)}this.toShow=
|
35
|
+
this.toShow.add(d)},errorsFor:function(a){var b=this.idOrName(a);return this.errors().filter(function(){return c(this).attr("for")==b})},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(a){if(this.checkable(a))a=this.findByName(a.name).not(this.settings.ignore)[0];return a},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(a){var b=this.currentForm;return c(document.getElementsByName(a)).map(function(d,
|
36
|
+
e){return e.form==b&&e.name==a&&e||null})},getLength:function(a,b){switch(b.nodeName.toLowerCase()){case "select":return c("option:selected",b).length;case "input":if(this.checkable(b))return this.findByName(b.name).filter(":checked").length}return a.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):true},dependTypes:{"boolean":function(a){return a},string:function(a,b){return!!c(a,b.form).length},"function":function(a,b){return a(b)}},optional:function(a){return!c.validator.methods.required.call(this,
|
37
|
+
c.trim(a.value),a)&&"dependency-mismatch"},startRequest:function(a){if(!this.pending[a.name]){this.pendingRequest++;this.pending[a.name]=true}},stopRequest:function(a,b){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[a.name];if(b&&this.pendingRequest==0&&this.formSubmitted&&this.form()){c(this.currentForm).submit();this.formSubmitted=false}else if(!b&&this.pendingRequest==0&&this.formSubmitted){c(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=
|
38
|
+
false}},previousValue:function(a){return c.data(a,"previousValue")||c.data(a,"previousValue",{old:null,valid:true,message:this.defaultMessage(a,"remote")})}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(a,b){a.constructor==String?this.classRuleSettings[a]=b:c.extend(this.classRuleSettings,
|
39
|
+
a)},classRules:function(a){var b={};(a=c(a).attr("class"))&&c.each(a.split(" "),function(){this in c.validator.classRuleSettings&&c.extend(b,c.validator.classRuleSettings[this])});return b},attributeRules:function(a){var b={};a=c(a);for(var d in c.validator.methods){var e;if(e=d==="required"&&typeof c.fn.prop==="function"?a.prop(d):a.attr(d))b[d]=e;else if(a[0].getAttribute("type")===d)b[d]=true}b.maxlength&&/-1|2147483647|524288/.test(b.maxlength)&&delete b.maxlength;return b},metadataRules:function(a){if(!c.metadata)return{};
|
40
|
+
var b=c.data(a.form,"validator").settings.meta;return b?c(a).metadata()[b]:c(a).metadata()},staticRules:function(a){var b={},d=c.data(a.form,"validator");if(d.settings.rules)b=c.validator.normalizeRule(d.settings.rules[a.name])||{};return b},normalizeRules:function(a,b){c.each(a,function(d,e){if(e===false)delete a[d];else if(e.param||e.depends){var f=true;switch(typeof e.depends){case "string":f=!!c(e.depends,b.form).length;break;case "function":f=e.depends.call(b,b)}if(f)a[d]=e.param!==undefined?
|
41
|
+
e.param:true;else delete a[d]}});c.each(a,function(d,e){a[d]=c.isFunction(e)?e(b):e});c.each(["minlength","maxlength","min","max"],function(){if(a[this])a[this]=Number(a[this])});c.each(["rangelength","range"],function(){if(a[this])a[this]=[Number(a[this][0]),Number(a[this][1])]});if(c.validator.autoCreateRanges){if(a.min&&a.max){a.range=[a.min,a.max];delete a.min;delete a.max}if(a.minlength&&a.maxlength){a.rangelength=[a.minlength,a.maxlength];delete a.minlength;delete a.maxlength}}a.messages&&delete a.messages;
|
42
|
+
return a},normalizeRule:function(a){if(typeof a=="string"){var b={};c.each(a.split(/\s/),function(){b[this]=true});a=b}return a},addMethod:function(a,b,d){c.validator.methods[a]=b;c.validator.messages[a]=d!=undefined?d:c.validator.messages[a];b.length<3&&c.validator.addClassRules(a,c.validator.normalizeRule(a))},methods:{required:function(a,b,d){if(!this.depend(d,b))return"dependency-mismatch";switch(b.nodeName.toLowerCase()){case "select":return(a=c(b).val())&&a.length>0;case "input":if(this.checkable(b))return this.getLength(a,
|
43
|
+
b)>0;default:return c.trim(a).length>0}},remote:function(a,b,d){if(this.optional(b))return"dependency-mismatch";var e=this.previousValue(b);this.settings.messages[b.name]||(this.settings.messages[b.name]={});e.originalMessage=this.settings.messages[b.name].remote;this.settings.messages[b.name].remote=e.message;d=typeof d=="string"&&{url:d}||d;if(this.pending[b.name])return"pending";if(e.old===a)return e.valid;e.old=a;var f=this;this.startRequest(b);var g={};g[b.name]=a;c.ajax(c.extend(true,{url:d,
|
44
|
+
mode:"abort",port:"validate"+b.name,dataType:"json",data:g,success:function(h){f.settings.messages[b.name].remote=e.originalMessage;var j=h===true;if(j){var i=f.formSubmitted;f.prepareElement(b);f.formSubmitted=i;f.successList.push(b);f.showErrors()}else{i={};h=h||f.defaultMessage(b,"remote");i[b.name]=e.message=c.isFunction(h)?h(a):h;f.showErrors(i)}e.valid=j;f.stopRequest(b,j)}},d));return"pending"},minlength:function(a,b,d){return this.optional(b)||this.getLength(c.trim(a),b)>=d},maxlength:function(a,
|
45
|
+
b,d){return this.optional(b)||this.getLength(c.trim(a),b)<=d},rangelength:function(a,b,d){a=this.getLength(c.trim(a),b);return this.optional(b)||a>=d[0]&&a<=d[1]},min:function(a,b,d){return this.optional(b)||a>=d},max:function(a,b,d){return this.optional(b)||a<=d},range:function(a,b,d){return this.optional(b)||a>=d[0]&&a<=d[1]},email:function(a,b){return this.optional(b)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(a)},
|
46
|
+
url:function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},
|
47
|
+
date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a))},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 -]+/.test(a))return false;var d=0,e=0,f=false;a=a.replace(/\D/g,"");for(var g=a.length-1;g>=
|
48
|
+
0;g--){e=a.charAt(g);e=parseInt(e,10);if(f)if((e*=2)>9)e-=9;d+=e;f=!f}return d%10==0},accept:function(a,b,d){d=typeof d=="string"?d.replace(/,/g,"|"):"png|jpe?g|gif";return this.optional(b)||a.match(RegExp(".("+d+")$","i"))},equalTo:function(a,b,d){d=c(d).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){c(b).valid()});return a==d.val()}}});c.format=c.validator.format})(jQuery);
|
49
|
+
(function(c){var a={};if(c.ajaxPrefilter)c.ajaxPrefilter(function(d,e,f){e=d.port;if(d.mode=="abort"){a[e]&&a[e].abort();a[e]=f}});else{var b=c.ajax;c.ajax=function(d){var e=("port"in d?d:c.ajaxSettings).port;if(("mode"in d?d:c.ajaxSettings).mode=="abort"){a[e]&&a[e].abort();return a[e]=b.apply(this,arguments)}return b.apply(this,arguments)}}})(jQuery);
|
50
|
+
(function(c){!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.handle.call(this,e)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)},handler:function(e){arguments[0]=c.event.fix(e);arguments[0].type=b;return c.event.handle.apply(this,arguments)}}});c.extend(c.fn,{validateDelegate:function(a,
|
51
|
+
b,d){return this.bind(b,function(e){var f=c(e.target);if(f.is(a))return d.apply(f,arguments)})}})})(jQuery);
|
@@ -0,0 +1,21 @@
|
|
1
|
+
$(function() {
|
2
|
+
|
3
|
+
$('body').append("<div id='ajax-loader'></div>");
|
4
|
+
$('#ajax-loader').css( {
|
5
|
+
'background': 'url(mdwa/ajax-loader.gif) no-repeat scroll 0 0 transparent',
|
6
|
+
'display': 'none',
|
7
|
+
'height': '42px',
|
8
|
+
'left': '50%',
|
9
|
+
'position': 'fixed',
|
10
|
+
'text-align': 'center',
|
11
|
+
'top': '50%',
|
12
|
+
'width': '42px',
|
13
|
+
'z-index': '10001'
|
14
|
+
});
|
15
|
+
|
16
|
+
$(document).bind("ajaxSend", function() {
|
17
|
+
$('#ajax-loader').show();
|
18
|
+
}).bind("ajaxComplete", function() {
|
19
|
+
$('#ajax-loader').hide();
|
20
|
+
});
|
21
|
+
});
|
@@ -0,0 +1,41 @@
|
|
1
|
+
$(function() {
|
2
|
+
|
3
|
+
// todo link toggle tem um atributo rel que identifica o elemento que vai ser feito display
|
4
|
+
$('a.toggle').live('click', function() {
|
5
|
+
$($(this).attr('rel')).toggle();
|
6
|
+
});
|
7
|
+
|
8
|
+
// tudo com a classe lightbox, abre o modalbox
|
9
|
+
$('.lightbox').fancybox({
|
10
|
+
closeClick: false,
|
11
|
+
autoSize: true
|
12
|
+
});
|
13
|
+
|
14
|
+
$('a#system_notice_close, #system_notice').live('click', function() {
|
15
|
+
$('#system_notice').fadeOut();
|
16
|
+
});
|
17
|
+
|
18
|
+
});
|
19
|
+
|
20
|
+
function checkOrUncheckAll( to_be_checked ){
|
21
|
+
var to_be_checked = to_be_checked || false;
|
22
|
+
$( ".cid" ).attr( "checked", to_be_checked );
|
23
|
+
}
|
24
|
+
|
25
|
+
function defineAction( form, action, confirmation ) {
|
26
|
+
var response = true;
|
27
|
+
if( confirmation ) {
|
28
|
+
response = confirm("Are you sure?");
|
29
|
+
}
|
30
|
+
if( response ) {
|
31
|
+
$( "#" + form ).attr( "action", action);
|
32
|
+
$( "#" + form ).submit();
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
function defineOrder( form, action, id ) {
|
37
|
+
$( "#" + form ).attr( "action", action);
|
38
|
+
$( "#cb" + id ).attr( "checked", true);
|
39
|
+
$( "#" + form ).submit();
|
40
|
+
}
|
41
|
+
|
data/lib/generators/mdd/sandbox/templates/app/assets/javascripts/mdwa/template/clicable_title.js
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
$(function() {
|
2
|
+
$.each($('.titulo_clicavel'), function(index, value) {
|
3
|
+
if($(this).val() == '')
|
4
|
+
$(this).val($(this).attr('title'));
|
5
|
+
});
|
6
|
+
$('.titulo_clicavel').live({
|
7
|
+
blur: function() {
|
8
|
+
if($(this).val() == '') $(this).val($(this).attr('title'));
|
9
|
+
},
|
10
|
+
click: function() {
|
11
|
+
$(this).select();
|
12
|
+
if($(this).val() == $(this).attr('title')) $(this).val('');
|
13
|
+
},
|
14
|
+
focus: function() {
|
15
|
+
$(this).select();
|
16
|
+
if($(this).val() == $(this).attr('title')) $(this).val('');
|
17
|
+
}
|
18
|
+
});
|
19
|
+
});
|
@@ -0,0 +1,46 @@
|
|
1
|
+
$(function() {
|
2
|
+
$('form a.add_nested_fields').live('click', function() {
|
3
|
+
// Setup
|
4
|
+
var assoc = $(this).attr('data-association'); // Name of child
|
5
|
+
var content = $('#' + assoc + '_fields_blueprint').html(); // Fields template
|
6
|
+
|
7
|
+
// Make the context correct by replacing new_<parents> with the generated ID
|
8
|
+
// of each of the parent objects
|
9
|
+
var context = ($(this).closest('.fields').find('input:first').attr('name') || '').replace(new RegExp('\[[a-z]+\]$'), '');
|
10
|
+
|
11
|
+
// context will be something like this for a brand new form:
|
12
|
+
// project[tasks_attributes][1255929127459][assignments_attributes][1255929128105]
|
13
|
+
// or for an edit form:
|
14
|
+
// project[tasks_attributes][0][assignments_attributes][1]
|
15
|
+
if(context) {
|
16
|
+
var parent_names = context.match(/[a-z_]+_attributes/g) || [];
|
17
|
+
var parent_ids = context.match(/[0-9]+/g);
|
18
|
+
|
19
|
+
for(i = 0; i < parent_names.length; i++) {
|
20
|
+
if(parent_ids[i]) {
|
21
|
+
content = content.replace(
|
22
|
+
new RegExp('(\\[' + parent_names[i] + '\\])\\[.+?\\]', 'g'),
|
23
|
+
'$1[' + parent_ids[i] + ']'
|
24
|
+
)
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
// Make a unique ID for the new child
|
30
|
+
var regexp = new RegExp('new_' + assoc, 'g');
|
31
|
+
var new_id = new Date().getTime();
|
32
|
+
content = content.replace(regexp, new_id);
|
33
|
+
|
34
|
+
$(this).before(content);
|
35
|
+
return false;
|
36
|
+
});
|
37
|
+
|
38
|
+
$('form a.remove_nested_fields').live('click', function() {
|
39
|
+
var hidden_field = $(this).prev('input[type=hidden]')[0];
|
40
|
+
if(hidden_field) {
|
41
|
+
hidden_field.value = '1';
|
42
|
+
}
|
43
|
+
$(this).closest('.fields').hide();
|
44
|
+
return false;
|
45
|
+
});
|
46
|
+
});
|