typus 3.1.0.rc18 → 3.1.0.rc19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. data/.gitignore +14 -11
  2. data/.travis.yml +12 -0
  3. data/CHANGELOG +253 -0
  4. data/Gemfile +69 -0
  5. data/Guardfile +11 -0
  6. data/README.md +14 -26
  7. data/Rakefile +24 -100
  8. data/app/assets/javascripts/typus/application.js +8 -2
  9. data/app/assets/javascripts/typus/custom.js +2 -0
  10. data/app/assets/javascripts/typus/jquery.application.js +14 -0
  11. data/app/assets/stylesheets/typus/application.css +18 -10
  12. data/app/assets/stylesheets/typus/content.css +0 -1
  13. data/app/assets/stylesheets/typus/custom.css +11 -0
  14. data/app/assets/stylesheets/typus/errors.css +1 -1
  15. data/app/assets/stylesheets/typus/forms.css +17 -5
  16. data/app/assets/stylesheets/typus/hacks.css +4 -0
  17. data/app/assets/stylesheets/typus/header.css +8 -2
  18. data/app/assets/stylesheets/typus/pagination.css +3 -3
  19. data/app/assets/stylesheets/typus/sidebar.css +4 -0
  20. data/app/assets/stylesheets/typus/tables.css +0 -1
  21. data/app/controllers/admin/account_controller.rb +1 -2
  22. data/app/controllers/admin/base_controller.rb +5 -2
  23. data/app/controllers/admin/dashboard_controller.rb +5 -0
  24. data/app/controllers/admin/resource_controller.rb +1 -2
  25. data/app/controllers/admin/resources_controller.rb +36 -51
  26. data/app/controllers/admin/session_controller.rb +2 -3
  27. data/app/helpers/admin/base_helper.rb +2 -5
  28. data/app/helpers/admin/resources/data_types/belongs_to_helper.rb +35 -27
  29. data/app/helpers/admin/resources/data_types/dragonfly_helper.rb +16 -3
  30. data/app/helpers/admin/resources/data_types/has_and_belongs_to_many_helper.rb +45 -13
  31. data/app/helpers/admin/resources/data_types/has_many_helper.rb +27 -19
  32. data/app/helpers/admin/resources/data_types/has_one_helper.rb +24 -11
  33. data/app/helpers/admin/resources/data_types/paperclip_helper.rb +1 -1
  34. data/app/helpers/admin/resources/data_types/string_helper.rb +1 -1
  35. data/app/helpers/admin/resources/data_types/text_helper.rb +1 -1
  36. data/app/helpers/admin/resources/data_types/transversal_helper.rb +1 -1
  37. data/app/helpers/admin/resources/data_types/tree_helper.rb +1 -1
  38. data/app/helpers/admin/resources/display_helper.rb +10 -9
  39. data/app/helpers/admin/resources/filters_helper.rb +3 -10
  40. data/app/helpers/admin/resources/form_helper.rb +12 -2
  41. data/app/helpers/admin/resources/list_helper.rb +13 -5
  42. data/app/helpers/admin/resources/relationships_helper.rb +0 -21
  43. data/app/helpers/admin/resources_helper.rb +3 -3
  44. data/app/mailers/admin/mailer.rb +9 -4
  45. data/app/views/admin/base/user_guide.html.erb +1 -1
  46. data/app/views/admin/dashboard/{show.html.erb → index.html.erb} +0 -0
  47. data/app/views/admin/dashboard/widgets/_applications.html.erb +32 -10
  48. data/app/views/admin/mailer/reset_password_instructions.html.erb +9 -0
  49. data/app/views/admin/mailer/reset_password_instructions.text.erb +9 -0
  50. data/app/views/admin/resources/edit.html.erb +3 -13
  51. data/app/views/admin/resources/index.html.erb +11 -4
  52. data/app/views/admin/resources/new.html.erb +2 -2
  53. data/app/views/admin/resources/show.html.erb +1 -1
  54. data/app/views/admin/shared/_head.html.erb +2 -2
  55. data/app/views/admin/templates/_belongs_to.html.erb +6 -9
  56. data/app/views/admin/templates/_dragonfly.html.erb +1 -1
  57. data/app/views/admin/templates/_dragonfly_form_preview.html.erb +21 -0
  58. data/app/views/admin/templates/_dragonfly_preview.html.erb +1 -1
  59. data/app/views/admin/templates/_has_and_belongs_to_many.html.erb +15 -0
  60. data/app/views/admin/templates/{_has_n.html.erb → _has_many.html.erb} +0 -0
  61. data/app/views/admin/templates/_password.html.erb +1 -1
  62. data/app/views/admin/templates/_selector.html.erb +1 -11
  63. data/app/views/admin/templates/_string.html.erb +2 -20
  64. data/app/views/admin/templates/_string_with_preview.html.erb +2 -3
  65. data/app/views/admin/templates/_text.html.erb +1 -8
  66. data/app/views/admin/templates/_text_with_ckeditor.html.erb +1 -1
  67. data/app/views/admin/templates/_text_with_ckeditor_and_assets.html.erb +12 -9
  68. data/app/views/helpers/admin/base/_apps.html.erb +12 -4
  69. data/app/views/helpers/admin/base/_login_info.html.erb +1 -1
  70. data/app/views/helpers/admin/resources/_filters.html.erb +2 -1
  71. data/app/views/helpers/admin/resources/_sidebar.html.erb +25 -41
  72. data/app/views/layouts/admin/base.html.erb +1 -1
  73. data/config/locales/typus.ca.yml +1 -1
  74. data/config/locales/typus.de.yml +40 -35
  75. data/config/locales/typus.el.yml +1 -1
  76. data/config/locales/typus.es.yml +1 -1
  77. data/config/locales/typus.fr.yml +1 -1
  78. data/config/locales/typus.hu.yml +1 -1
  79. data/config/locales/typus.it.yml +1 -1
  80. data/config/locales/typus.locale.models.yml.template +17 -0
  81. data/config/locales/typus.locale.yml.template +80 -0
  82. data/config/locales/typus.pt-BR.yml +1 -1
  83. data/config/locales/typus.pt-PT.yml +2 -2
  84. data/config/locales/typus.ru.yml +1 -1
  85. data/config/locales/typus.zh-CN.yml +1 -1
  86. data/config/routes.rb +5 -1
  87. data/lib/generators/templates/config/initializers/typus.rb +9 -0
  88. data/lib/generators/templates/config/typus/README +0 -6
  89. data/lib/support/active_record.rb +2 -10
  90. data/lib/support/string.rb +6 -1
  91. data/lib/typus.rb +49 -10
  92. data/lib/typus/authentication/base.rb +0 -4
  93. data/lib/typus/authentication/none_with_role.rb +15 -0
  94. data/lib/typus/configuration.rb +3 -7
  95. data/lib/typus/controller/ancestry.rb +1 -1
  96. data/lib/typus/controller/bulk.rb +6 -2
  97. data/lib/typus/controller/format.rb +38 -25
  98. data/lib/typus/orm/active_record/class_methods.rb +0 -1
  99. data/lib/typus/orm/active_record/search.rb +6 -2
  100. data/lib/typus/orm/base.rb +4 -3
  101. data/lib/typus/orm/mongoid.rb +4 -0
  102. data/lib/typus/orm/{mongo → mongoid}/class_methods.rb +4 -3
  103. data/lib/typus/resources.rb +9 -0
  104. data/lib/typus/version.rb +1 -1
  105. data/typus.gemspec +13 -13
  106. data/vendor/assets/chosen/chosen-sprite.png +0 -0
  107. data/vendor/assets/chosen/chosen.css +334 -0
  108. data/vendor/assets/chosen/chosen.jquery.min.js +10 -0
  109. data/vendor/assets/fancybox/jquery.fancybox-1.3.4.css +17 -17
  110. metadata +57 -131
  111. data/.gitmodules +0 -6
  112. data/app/assets/javascripts/typus.js +0 -8
  113. data/app/assets/stylesheets/typus.css +0 -20
  114. data/app/assets/stylesheets/typus/actions.css +0 -11
  115. data/app/views/admin/mailer/reset_password_link.text.erb +0 -9
  116. data/app/views/admin/templates/_belongs_to_with_autocomplete.html.erb +0 -26
  117. data/lib/typus/controller/associations.rb +0 -146
  118. data/lib/typus/controller/autocomplete.rb +0 -16
  119. data/vendor/assets/fancybox/jquery.easing-1.3.pack.js +0 -72
  120. data/vendor/assets/fancybox/jquery.fancybox-1.3.4.js +0 -1156
  121. data/vendor/assets/fancybox/jquery.mousewheel-3.0.4.pack.js +0 -14
  122. data/vendor/assets/formalize/css/_formalize.sass +0 -332
  123. data/vendor/assets/formalize/css/demo.css +0 -47
  124. data/vendor/assets/formalize/css/reset.css +0 -202
  125. data/vendor/assets/formalize/css/text.css +0 -81
  126. data/vendor/assets/formalize/js/dojo.formalize.js +0 -166
  127. data/vendor/assets/formalize/js/dojo.formalize.min.js +0 -1
  128. data/vendor/assets/formalize/js/extjs.formalize.js +0 -163
  129. data/vendor/assets/formalize/js/extjs.formalize.min.js +0 -1
  130. data/vendor/assets/formalize/js/jquery.formalize.js +0 -150
  131. data/vendor/assets/formalize/js/mootools.formalize.js +0 -155
  132. data/vendor/assets/formalize/js/mootools.formalize.min.js +0 -1
  133. data/vendor/assets/formalize/js/prototype.formalize.js +0 -163
  134. data/vendor/assets/formalize/js/prototype.formalize.min.js +0 -1
  135. data/vendor/assets/formalize/js/yui.formalize.js +0 -152
  136. data/vendor/assets/formalize/js/yui.formalize.min.js +0 -1
  137. data/vendor/assets/jquery-tokeninput/jquery.tokeninput.js +0 -736
  138. data/vendor/assets/jquery-tokeninput/token-input.css +0 -120
@@ -1,6 +0,0 @@
1
- [submodule "test/fixtures/rails_app"]
2
- path = test/fixtures/rails_app
3
- url = git@github.com:typus/demo.git
4
- [submodule "config/locales"]
5
- path = config/locales
6
- url = git@github.com:typus/locales.git
@@ -1,8 +0,0 @@
1
- //= require jquery
2
- //= require jquery_ujs
3
- //= require jquery.fancybox-1.3.4.pack
4
- //= require jquery.searchField
5
- //= require jquery.tokeninput
6
- //= require js/jquery.formalize.min
7
- //= require typus/jquery.application
8
- //= require typus/application
@@ -1,20 +0,0 @@
1
- /*
2
- *= require jquery.fancybox-1.3.4
3
- *= require css/formalize
4
- *= require css/fluid
5
- *= require token-input
6
- *= require typus/reset
7
- *= require typus/layout
8
- *= require typus/defaults
9
- *= require typus/errors
10
- *= require typus/account
11
- *= require typus/header
12
- *= require typus/content
13
- *= require typus/sidebar
14
- *= require typus/footer
15
- *= require typus/tables
16
- *= require typus/pagination
17
- *= require typus/forms
18
- *= require typus/hacks
19
- *= require typus/application
20
- */
@@ -1,11 +0,0 @@
1
-
2
- #content_wrapper ul.predefined_filters {
3
- border-bottom: 1px solid #D3D3D3;
4
- margin: -0.5em 0 0 0;
5
- padding: 1em 0;
6
- }
7
-
8
- #content_wrapper ul.predefined_filters li {
9
- display: inline;
10
- margin: 0 0.5em 0 0;
11
- }
@@ -1,9 +0,0 @@
1
-
2
- <%= Typus::I18n.t("You can update your password at") %>:
3
-
4
- <%= @url %>
5
-
6
- <%= Typus::I18n.t("If you didn't request a password update, you can ignore this message") %>
7
-
8
- --
9
- <%= Typus.admin_title %>
@@ -1,26 +0,0 @@
1
- <% content_for :javascripts do %>
2
- <% label = "#{@item.class.model_name.underscore.gsub("/","_")}_#{related_fk}" %>
3
- <script type="text/javascript">
4
- $(document).ready(function () {
5
- $("#tokenInput_for_<%= related_fk %>").tokenInput("/admin/<%= association.class_name.tableize %>/autocomplete", {
6
- hintText: "",
7
- queryParam: 'term',
8
- tokenLimit: 1,
9
- <% if (item = @item.send(attribute)) %>
10
- prePopulate: [ { id: <%= item.id %>, name: "<%= item.to_label %>" } ],
11
- <% end %>
12
- onAdd: function(item) { $("#<%= label %>").val(item.id); },
13
- onDelete: function (item) { $("#<%= label %>").val(""); }
14
- });
15
- });
16
- </script>
17
- <% end %>
18
-
19
- <li id="<%= attribute_id %>">
20
- <%= form.label related_fk, "#{label_text} <small>#{message}</small>".html_safe %>
21
- <%= form.hidden_field related_fk %>
22
- <input id="tokenInput_for_<%= related_fk %>"
23
- size="30"
24
- type="text"
25
- value="<%= @item.send(attribute).try(:to_label) %>" />
26
- </li>
@@ -1,146 +0,0 @@
1
- module Typus
2
- module Controller
3
- module Associations
4
-
5
- ##
6
- # Action to relate models which respond to:
7
- #
8
- # - has_and_belongs_to_many
9
- # - has_many
10
- #
11
- # For example:
12
- #
13
- # class Item < ActiveRecord::Base
14
- # has_many :line_items
15
- # end
16
- #
17
- # class LineItem < ActiveRecord::Base
18
- # belongs_to :item
19
- # end
20
- #
21
- # >> related_item = LineItem.find(params[:related][:id])
22
- # => ...
23
- # >> item = Item.find(params[:id])
24
- # => ...
25
- # >> item.line_items << related_item
26
- # => ...
27
- #
28
- def relate
29
- resource_class = params[:resource].constantize
30
- association_name = resource_class.table_name
31
-
32
- item = resource_class.find(params[:resource_id])
33
- @item.send(association_name) << item
34
-
35
- notice = Typus::I18n.t("%{model} successfully updated.", :model => @resource.model_name.human)
36
-
37
- redirect_to params[:return_to], :notice => notice
38
- end
39
-
40
- ##
41
- # Action to unrelate models which respond to:
42
- #
43
- # - has_and_belongs_to_many
44
- # - has_many
45
- # - has_one
46
- #
47
- def unrelate
48
- item_class = params[:resource].constantize
49
- item = item_class.find(params[:resource_id])
50
-
51
- case item_class.relationship_with(@resource)
52
- when :has_one
53
- association_name = @resource.model_name.underscore.to_sym
54
- worked = item.send(association_name).delete
55
- else
56
- association_name = params[:association_name] ? params[:association_name].to_sym : @resource.model_name.tableize.split("/").last.to_sym
57
- worked = item.send(association_name).delete(@item)
58
- end
59
-
60
- if worked
61
- notice = Typus::I18n.t("%{model} successfully updated.", :model => item_class.model_name.human)
62
- else
63
- alert = item.errors.full_messages
64
- end
65
-
66
- redirect_to :back, :notice => notice, :alert => alert
67
- end
68
-
69
- protected
70
-
71
- ##
72
- # >> Order.relationship_with(Invoice)
73
- # => :has_one
74
- #
75
- def set_has_one_association(item_class, options)
76
- association_name = item_class.model_name.underscore.to_sym
77
- options.merge!(:action => 'edit', :id => @item.send(association_name).id)
78
- notice = Typus::I18n.t("%{model} successfully updated.", :model => item_class.model_name.human)
79
-
80
- [options, notice, nil]
81
- end
82
-
83
- ##
84
- # >> Entry.relationship_with(Comment)
85
- # => :has_many
86
- #
87
- def set_has_many_association(item_class, options)
88
- item = item_class.find(params[:resource_id])
89
- association_name = @resource.model_name.tableize.to_sym
90
-
91
- if item.send(association_name).push(@item)
92
- notice = Typus::I18n.t("%{model} successfully updated.", :model => item_class.model_name.human)
93
- else
94
- alert = @item.errors.full_messages
95
- end
96
-
97
- options.merge!(:action => 'edit', :id => item.id)
98
-
99
- [options, notice, alert]
100
- end
101
-
102
- ##
103
- # >> Entry.relationship_with(Category)
104
- # => :has_and_belongs_to_many
105
- #
106
- def set_has_and_belongs_to_many_association(item_class, options)
107
- # In this case we DO need to get the remote item to make to association.
108
- item = item_class.find(params[:resource_id])
109
- association_name = @resource.model_name.tableize.to_sym
110
- options.merge!(:action => 'edit', :id => item.id)
111
-
112
- if item.send(association_name).push(@item)
113
- notice = Typus::I18n.t("%{model} successfully updated.", :model => item_class.model_name.human)
114
- else
115
- alert = @item.errors.full_messages
116
- end
117
-
118
- [options, notice, alert]
119
- end
120
-
121
- ##
122
- # >> Invoice.relationship_with(Order)
123
- # => :belongs_to
124
- #
125
- def set_belongs_to_association(item_class, options)
126
- association_name = item_class.model_name.tableize.to_sym
127
- foreign_key = @resource.reflect_on_association(association_name).foreign_key
128
-
129
- if params[:resource_id]
130
- item = item_class.find(params[:resource_id])
131
- options.merge!(:action => 'edit', :id => item.id)
132
- if @item.send(association_name).push(item)
133
- notice = Typus::I18n.t("%{model} successfully updated.", :model => item_class.model_name.human)
134
- else
135
- alert = @item.errors.full_messages
136
- end
137
- else
138
- options.merge!(:action => 'new', foreign_key => @item.id)
139
- end
140
-
141
- [options, notice, alert]
142
- end
143
-
144
- end
145
- end
146
- end
@@ -1,16 +0,0 @@
1
- module Typus
2
- module Controller
3
- module Autocomplete
4
-
5
- def autocomplete
6
- if params[:term]
7
- params.merge!(:search => params[:term])
8
- get_objects
9
- @items = @resource.limit(20)
10
- render :json => @items.map { |i| { "id" => i.id, "name" => i.to_label } }
11
- end
12
- end
13
-
14
- end
15
- end
16
- end
@@ -1,72 +0,0 @@
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
- */
@@ -1,1156 +0,0 @@
1
- /*
2
- * FancyBox - jQuery Plugin
3
- * Simple and fancy lightbox alternative
4
- *
5
- * Examples and documentation at: http://fancybox.net
6
- *
7
- * Copyright (c) 2008 - 2010 Janis Skarnelis
8
- * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
9
- *
10
- * Version: 1.3.4 (11/11/2010)
11
- * Requires: jQuery v1.3+
12
- *
13
- * Dual licensed under the MIT and GPL licenses:
14
- * http://www.opensource.org/licenses/mit-license.php
15
- * http://www.gnu.org/licenses/gpl.html
16
- */
17
-
18
- ;(function($) {
19
- var tmp, loading, overlay, wrap, outer, content, close, title, nav_left, nav_right,
20
-
21
- selectedIndex = 0, selectedOpts = {}, selectedArray = [], currentIndex = 0, currentOpts = {}, currentArray = [],
22
-
23
- ajaxLoader = null, imgPreloader = new Image(), imgRegExp = /\.(jpg|gif|png|bmp|jpeg)(.*)?$/i, swfRegExp = /[^\.]\.(swf)\s*$/i,
24
-
25
- loadingTimer, loadingFrame = 1,
26
-
27
- titleHeight = 0, titleStr = '', start_pos, final_pos, busy = false, fx = $.extend($('<div/>')[0], { prop: 0 }),
28
-
29
- isIE6 = $.browser.msie && $.browser.version < 7 && !window.XMLHttpRequest,
30
-
31
- /*
32
- * Private methods
33
- */
34
-
35
- _abort = function() {
36
- loading.hide();
37
-
38
- imgPreloader.onerror = imgPreloader.onload = null;
39
-
40
- if (ajaxLoader) {
41
- ajaxLoader.abort();
42
- }
43
-
44
- tmp.empty();
45
- },
46
-
47
- _error = function() {
48
- if (false === selectedOpts.onError(selectedArray, selectedIndex, selectedOpts)) {
49
- loading.hide();
50
- busy = false;
51
- return;
52
- }
53
-
54
- selectedOpts.titleShow = false;
55
-
56
- selectedOpts.width = 'auto';
57
- selectedOpts.height = 'auto';
58
-
59
- tmp.html( '<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>' );
60
-
61
- _process_inline();
62
- },
63
-
64
- _start = function() {
65
- var obj = selectedArray[ selectedIndex ],
66
- href,
67
- type,
68
- title,
69
- str,
70
- emb,
71
- ret;
72
-
73
- _abort();
74
-
75
- selectedOpts = $.extend({}, $.fn.fancybox.defaults, (typeof $(obj).data('fancybox') == 'undefined' ? selectedOpts : $(obj).data('fancybox')));
76
-
77
- ret = selectedOpts.onStart(selectedArray, selectedIndex, selectedOpts);
78
-
79
- if (ret === false) {
80
- busy = false;
81
- return;
82
- } else if (typeof ret == 'object') {
83
- selectedOpts = $.extend(selectedOpts, ret);
84
- }
85
-
86
- title = selectedOpts.title || (obj.nodeName ? $(obj).attr('title') : obj.title) || '';
87
-
88
- if (obj.nodeName && !selectedOpts.orig) {
89
- selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj);
90
- }
91
-
92
- if (title === '' && selectedOpts.orig && selectedOpts.titleFromAlt) {
93
- title = selectedOpts.orig.attr('alt');
94
- }
95
-
96
- href = selectedOpts.href || (obj.nodeName ? $(obj).attr('href') : obj.href) || null;
97
-
98
- if ((/^(?:javascript)/i).test(href) || href == '#') {
99
- href = null;
100
- }
101
-
102
- if (selectedOpts.type) {
103
- type = selectedOpts.type;
104
-
105
- if (!href) {
106
- href = selectedOpts.content;
107
- }
108
-
109
- } else if (selectedOpts.content) {
110
- type = 'html';
111
-
112
- } else if (href) {
113
- if (href.match(imgRegExp)) {
114
- type = 'image';
115
-
116
- } else if (href.match(swfRegExp)) {
117
- type = 'swf';
118
-
119
- } else if ($(obj).hasClass("iframe")) {
120
- type = 'iframe';
121
-
122
- } else if (href.indexOf("#") === 0) {
123
- type = 'inline';
124
-
125
- } else {
126
- type = 'ajax';
127
- }
128
- }
129
-
130
- if (!type) {
131
- _error();
132
- return;
133
- }
134
-
135
- if (type == 'inline') {
136
- obj = href.substr(href.indexOf("#"));
137
- type = $(obj).length > 0 ? 'inline' : 'ajax';
138
- }
139
-
140
- selectedOpts.type = type;
141
- selectedOpts.href = href;
142
- selectedOpts.title = title;
143
-
144
- if (selectedOpts.autoDimensions) {
145
- if (selectedOpts.type == 'html' || selectedOpts.type == 'inline' || selectedOpts.type == 'ajax') {
146
- selectedOpts.width = 'auto';
147
- selectedOpts.height = 'auto';
148
- } else {
149
- selectedOpts.autoDimensions = false;
150
- }
151
- }
152
-
153
- if (selectedOpts.modal) {
154
- selectedOpts.overlayShow = true;
155
- selectedOpts.hideOnOverlayClick = false;
156
- selectedOpts.hideOnContentClick = false;
157
- selectedOpts.enableEscapeButton = false;
158
- selectedOpts.showCloseButton = false;
159
- }
160
-
161
- selectedOpts.padding = parseInt(selectedOpts.padding, 10);
162
- selectedOpts.margin = parseInt(selectedOpts.margin, 10);
163
-
164
- tmp.css('padding', (selectedOpts.padding + selectedOpts.margin));
165
-
166
- $('.fancybox-inline-tmp').unbind('fancybox-cancel').bind('fancybox-change', function() {
167
- $(this).replaceWith(content.children());
168
- });
169
-
170
- switch (type) {
171
- case 'html' :
172
- tmp.html( selectedOpts.content );
173
- _process_inline();
174
- break;
175
-
176
- case 'inline' :
177
- if ( $(obj).parent().is('#fancybox-content') === true) {
178
- busy = false;
179
- return;
180
- }
181
-
182
- $('<div class="fancybox-inline-tmp" />')
183
- .hide()
184
- .insertBefore( $(obj) )
185
- .bind('fancybox-cleanup', function() {
186
- $(this).replaceWith(content.children());
187
- }).bind('fancybox-cancel', function() {
188
- $(this).replaceWith(tmp.children());
189
- });
190
-
191
- $(obj).appendTo(tmp);
192
-
193
- _process_inline();
194
- break;
195
-
196
- case 'image':
197
- busy = false;
198
-
199
- $.fancybox.showActivity();
200
-
201
- imgPreloader = new Image();
202
-
203
- imgPreloader.onerror = function() {
204
- _error();
205
- };
206
-
207
- imgPreloader.onload = function() {
208
- busy = true;
209
-
210
- imgPreloader.onerror = imgPreloader.onload = null;
211
-
212
- _process_image();
213
- };
214
-
215
- imgPreloader.src = href;
216
- break;
217
-
218
- case 'swf':
219
- selectedOpts.scrolling = 'no';
220
-
221
- str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"><param name="movie" value="' + href + '"></param>';
222
- emb = '';
223
-
224
- $.each(selectedOpts.swf, function(name, val) {
225
- str += '<param name="' + name + '" value="' + val + '"></param>';
226
- emb += ' ' + name + '="' + val + '"';
227
- });
228
-
229
- str += '<embed src="' + href + '" type="application/x-shockwave-flash" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"' + emb + '></embed></object>';
230
-
231
- tmp.html(str);
232
-
233
- _process_inline();
234
- break;
235
-
236
- case 'ajax':
237
- busy = false;
238
-
239
- $.fancybox.showActivity();
240
-
241
- selectedOpts.ajax.win = selectedOpts.ajax.success;
242
-
243
- ajaxLoader = $.ajax($.extend({}, selectedOpts.ajax, {
244
- url : href,
245
- data : selectedOpts.ajax.data || {},
246
- error : function(XMLHttpRequest, textStatus, errorThrown) {
247
- if ( XMLHttpRequest.status > 0 ) {
248
- _error();
249
- }
250
- },
251
- success : function(data, textStatus, XMLHttpRequest) {
252
- var o = typeof XMLHttpRequest == 'object' ? XMLHttpRequest : ajaxLoader;
253
- if (o.status == 200) {
254
- if ( typeof selectedOpts.ajax.win == 'function' ) {
255
- ret = selectedOpts.ajax.win(href, data, textStatus, XMLHttpRequest);
256
-
257
- if (ret === false) {
258
- loading.hide();
259
- return;
260
- } else if (typeof ret == 'string' || typeof ret == 'object') {
261
- data = ret;
262
- }
263
- }
264
-
265
- tmp.html( data );
266
- _process_inline();
267
- }
268
- }
269
- }));
270
-
271
- break;
272
-
273
- case 'iframe':
274
- _show();
275
- break;
276
- }
277
- },
278
-
279
- _process_inline = function() {
280
- var
281
- w = selectedOpts.width,
282
- h = selectedOpts.height;
283
-
284
- if (w.toString().indexOf('%') > -1) {
285
- w = parseInt( ($(window).width() - (selectedOpts.margin * 2)) * parseFloat(w) / 100, 10) + 'px';
286
-
287
- } else {
288
- w = w == 'auto' ? 'auto' : w + 'px';
289
- }
290
-
291
- if (h.toString().indexOf('%') > -1) {
292
- h = parseInt( ($(window).height() - (selectedOpts.margin * 2)) * parseFloat(h) / 100, 10) + 'px';
293
-
294
- } else {
295
- h = h == 'auto' ? 'auto' : h + 'px';
296
- }
297
-
298
- tmp.wrapInner('<div style="width:' + w + ';height:' + h + ';overflow: ' + (selectedOpts.scrolling == 'auto' ? 'auto' : (selectedOpts.scrolling == 'yes' ? 'scroll' : 'hidden')) + ';position:relative;"></div>');
299
-
300
- selectedOpts.width = tmp.width();
301
- selectedOpts.height = tmp.height();
302
-
303
- _show();
304
- },
305
-
306
- _process_image = function() {
307
- selectedOpts.width = imgPreloader.width;
308
- selectedOpts.height = imgPreloader.height;
309
-
310
- $("<img />").attr({
311
- 'id' : 'fancybox-img',
312
- 'src' : imgPreloader.src,
313
- 'alt' : selectedOpts.title
314
- }).appendTo( tmp );
315
-
316
- _show();
317
- },
318
-
319
- _show = function() {
320
- var pos, equal;
321
-
322
- loading.hide();
323
-
324
- if (wrap.is(":visible") && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
325
- $.event.trigger('fancybox-cancel');
326
-
327
- busy = false;
328
- return;
329
- }
330
-
331
- busy = true;
332
-
333
- $(content.add( overlay )).unbind();
334
-
335
- $(window).unbind("resize.fb scroll.fb");
336
- $(document).unbind('keydown.fb');
337
-
338
- if (wrap.is(":visible") && currentOpts.titlePosition !== 'outside') {
339
- wrap.css('height', wrap.height());
340
- }
341
-
342
- currentArray = selectedArray;
343
- currentIndex = selectedIndex;
344
- currentOpts = selectedOpts;
345
-
346
- if (currentOpts.overlayShow) {
347
- overlay.css({
348
- 'background-color' : currentOpts.overlayColor,
349
- 'opacity' : currentOpts.overlayOpacity,
350
- 'cursor' : currentOpts.hideOnOverlayClick ? 'pointer' : 'auto',
351
- 'height' : $(document).height()
352
- });
353
-
354
- if (!overlay.is(':visible')) {
355
- if (isIE6) {
356
- $('select:not(#fancybox-tmp select)').filter(function() {
357
- return this.style.visibility !== 'hidden';
358
- }).css({'visibility' : 'hidden'}).one('fancybox-cleanup', function() {
359
- this.style.visibility = 'inherit';
360
- });
361
- }
362
-
363
- overlay.show();
364
- }
365
- } else {
366
- overlay.hide();
367
- }
368
-
369
- final_pos = _get_zoom_to();
370
-
371
- _process_title();
372
-
373
- if (wrap.is(":visible")) {
374
- $( close.add( nav_left ).add( nav_right ) ).hide();
375
-
376
- pos = wrap.position(),
377
-
378
- start_pos = {
379
- top : pos.top,
380
- left : pos.left,
381
- width : wrap.width(),
382
- height : wrap.height()
383
- };
384
-
385
- equal = (start_pos.width == final_pos.width && start_pos.height == final_pos.height);
386
-
387
- content.fadeTo(currentOpts.changeFade, 0.3, function() {
388
- var finish_resizing = function() {
389
- content.html( tmp.contents() ).fadeTo(currentOpts.changeFade, 1, _finish);
390
- };
391
-
392
- $.event.trigger('fancybox-change');
393
-
394
- content
395
- .empty()
396
- .removeAttr('filter')
397
- .css({
398
- 'border-width' : currentOpts.padding,
399
- 'width' : final_pos.width - currentOpts.padding * 2,
400
- 'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
401
- });
402
-
403
- if (equal) {
404
- finish_resizing();
405
-
406
- } else {
407
- fx.prop = 0;
408
-
409
- $(fx).animate({prop: 1}, {
410
- duration : currentOpts.changeSpeed,
411
- easing : currentOpts.easingChange,
412
- step : _draw,
413
- complete : finish_resizing
414
- });
415
- }
416
- });
417
-
418
- return;
419
- }
420
-
421
- wrap.removeAttr("style");
422
-
423
- content.css('border-width', currentOpts.padding);
424
-
425
- if (currentOpts.transitionIn == 'elastic') {
426
- start_pos = _get_zoom_from();
427
-
428
- content.html( tmp.contents() );
429
-
430
- wrap.show();
431
-
432
- if (currentOpts.opacity) {
433
- final_pos.opacity = 0;
434
- }
435
-
436
- fx.prop = 0;
437
-
438
- $(fx).animate({prop: 1}, {
439
- duration : currentOpts.speedIn,
440
- easing : currentOpts.easingIn,
441
- step : _draw,
442
- complete : _finish
443
- });
444
-
445
- return;
446
- }
447
-
448
- if (currentOpts.titlePosition == 'inside' && titleHeight > 0) {
449
- title.show();
450
- }
451
-
452
- content
453
- .css({
454
- 'width' : final_pos.width - currentOpts.padding * 2,
455
- 'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
456
- })
457
- .html( tmp.contents() );
458
-
459
- wrap
460
- .css(final_pos)
461
- .fadeIn( currentOpts.transitionIn == 'none' ? 0 : currentOpts.speedIn, _finish );
462
- },
463
-
464
- _format_title = function(title) {
465
- if (title && title.length) {
466
- if (currentOpts.titlePosition == 'float') {
467
- return '<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">' + title + '</td><td id="fancybox-title-float-right"></td></tr></table>';
468
- }
469
-
470
- return '<div id="fancybox-title-' + currentOpts.titlePosition + '">' + title + '</div>';
471
- }
472
-
473
- return false;
474
- },
475
-
476
- _process_title = function() {
477
- titleStr = currentOpts.title || '';
478
- titleHeight = 0;
479
-
480
- title
481
- .empty()
482
- .removeAttr('style')
483
- .removeClass();
484
-
485
- if (currentOpts.titleShow === false) {
486
- title.hide();
487
- return;
488
- }
489
-
490
- titleStr = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(titleStr, currentArray, currentIndex, currentOpts) : _format_title(titleStr);
491
-
492
- if (!titleStr || titleStr === '') {
493
- title.hide();
494
- return;
495
- }
496
-
497
- title
498
- .addClass('fancybox-title-' + currentOpts.titlePosition)
499
- .html( titleStr )
500
- .appendTo( 'body' )
501
- .show();
502
-
503
- switch (currentOpts.titlePosition) {
504
- case 'inside':
505
- title
506
- .css({
507
- 'width' : final_pos.width - (currentOpts.padding * 2),
508
- 'marginLeft' : currentOpts.padding,
509
- 'marginRight' : currentOpts.padding
510
- });
511
-
512
- titleHeight = title.outerHeight(true);
513
-
514
- title.appendTo( outer );
515
-
516
- final_pos.height += titleHeight;
517
- break;
518
-
519
- case 'over':
520
- title
521
- .css({
522
- 'marginLeft' : currentOpts.padding,
523
- 'width' : final_pos.width - (currentOpts.padding * 2),
524
- 'bottom' : currentOpts.padding
525
- })
526
- .appendTo( outer );
527
- break;
528
-
529
- case 'float':
530
- title
531
- .css('left', parseInt((title.width() - final_pos.width - 40)/ 2, 10) * -1)
532
- .appendTo( wrap );
533
- break;
534
-
535
- default:
536
- title
537
- .css({
538
- 'width' : final_pos.width - (currentOpts.padding * 2),
539
- 'paddingLeft' : currentOpts.padding,
540
- 'paddingRight' : currentOpts.padding
541
- })
542
- .appendTo( wrap );
543
- break;
544
- }
545
-
546
- title.hide();
547
- },
548
-
549
- _set_navigation = function() {
550
- if (currentOpts.enableEscapeButton || currentOpts.enableKeyboardNav) {
551
- $(document).bind('keydown.fb', function(e) {
552
- if (e.keyCode == 27 && currentOpts.enableEscapeButton) {
553
- e.preventDefault();
554
- $.fancybox.close();
555
-
556
- } else if ((e.keyCode == 37 || e.keyCode == 39) && currentOpts.enableKeyboardNav && e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') {
557
- e.preventDefault();
558
- $.fancybox[ e.keyCode == 37 ? 'prev' : 'next']();
559
- }
560
- });
561
- }
562
-
563
- if (!currentOpts.showNavArrows) {
564
- nav_left.hide();
565
- nav_right.hide();
566
- return;
567
- }
568
-
569
- if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex !== 0) {
570
- nav_left.show();
571
- }
572
-
573
- if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex != (currentArray.length -1)) {
574
- nav_right.show();
575
- }
576
- },
577
-
578
- _finish = function () {
579
- if (!$.support.opacity) {
580
- content.get(0).style.removeAttribute('filter');
581
- wrap.get(0).style.removeAttribute('filter');
582
- }
583
-
584
- if (selectedOpts.autoDimensions) {
585
- content.css('height', 'auto');
586
- }
587
-
588
- wrap.css('height', 'auto');
589
-
590
- if (titleStr && titleStr.length) {
591
- title.show();
592
- }
593
-
594
- if (currentOpts.showCloseButton) {
595
- close.show();
596
- }
597
-
598
- _set_navigation();
599
-
600
- if (currentOpts.hideOnContentClick) {
601
- content.bind('click', $.fancybox.close);
602
- }
603
-
604
- if (currentOpts.hideOnOverlayClick) {
605
- overlay.bind('click', $.fancybox.close);
606
- }
607
-
608
- $(window).bind("resize.fb", $.fancybox.resize);
609
-
610
- if (currentOpts.centerOnScroll) {
611
- $(window).bind("scroll.fb", $.fancybox.center);
612
- }
613
-
614
- if (currentOpts.type == 'iframe') {
615
- $('<iframe id="fancybox-frame" name="fancybox-frame' + new Date().getTime() + '" frameborder="0" hspace="0" ' + ($.browser.msie ? 'allowtransparency="true""' : '') + ' scrolling="' + selectedOpts.scrolling + '" src="' + currentOpts.href + '"></iframe>').appendTo(content);
616
- }
617
-
618
- wrap.show();
619
-
620
- busy = false;
621
-
622
- $.fancybox.center();
623
-
624
- currentOpts.onComplete(currentArray, currentIndex, currentOpts);
625
-
626
- _preload_images();
627
- },
628
-
629
- _preload_images = function() {
630
- var href,
631
- objNext;
632
-
633
- if ((currentArray.length -1) > currentIndex) {
634
- href = currentArray[ currentIndex + 1 ].href;
635
-
636
- if (typeof href !== 'undefined' && href.match(imgRegExp)) {
637
- objNext = new Image();
638
- objNext.src = href;
639
- }
640
- }
641
-
642
- if (currentIndex > 0) {
643
- href = currentArray[ currentIndex - 1 ].href;
644
-
645
- if (typeof href !== 'undefined' && href.match(imgRegExp)) {
646
- objNext = new Image();
647
- objNext.src = href;
648
- }
649
- }
650
- },
651
-
652
- _draw = function(pos) {
653
- var dim = {
654
- width : parseInt(start_pos.width + (final_pos.width - start_pos.width) * pos, 10),
655
- height : parseInt(start_pos.height + (final_pos.height - start_pos.height) * pos, 10),
656
-
657
- top : parseInt(start_pos.top + (final_pos.top - start_pos.top) * pos, 10),
658
- left : parseInt(start_pos.left + (final_pos.left - start_pos.left) * pos, 10)
659
- };
660
-
661
- if (typeof final_pos.opacity !== 'undefined') {
662
- dim.opacity = pos < 0.5 ? 0.5 : pos;
663
- }
664
-
665
- wrap.css(dim);
666
-
667
- content.css({
668
- 'width' : dim.width - currentOpts.padding * 2,
669
- 'height' : dim.height - (titleHeight * pos) - currentOpts.padding * 2
670
- });
671
- },
672
-
673
- _get_viewport = function() {
674
- return [
675
- $(window).width() - (currentOpts.margin * 2),
676
- $(window).height() - (currentOpts.margin * 2),
677
- $(document).scrollLeft() + currentOpts.margin,
678
- $(document).scrollTop() + currentOpts.margin
679
- ];
680
- },
681
-
682
- _get_zoom_to = function () {
683
- var view = _get_viewport(),
684
- to = {},
685
- resize = currentOpts.autoScale,
686
- double_padding = currentOpts.padding * 2,
687
- ratio;
688
-
689
- if (currentOpts.width.toString().indexOf('%') > -1) {
690
- to.width = parseInt((view[0] * parseFloat(currentOpts.width)) / 100, 10);
691
- } else {
692
- to.width = currentOpts.width + double_padding;
693
- }
694
-
695
- if (currentOpts.height.toString().indexOf('%') > -1) {
696
- to.height = parseInt((view[1] * parseFloat(currentOpts.height)) / 100, 10);
697
- } else {
698
- to.height = currentOpts.height + double_padding;
699
- }
700
-
701
- if (resize && (to.width > view[0] || to.height > view[1])) {
702
- if (selectedOpts.type == 'image' || selectedOpts.type == 'swf') {
703
- ratio = (currentOpts.width ) / (currentOpts.height );
704
-
705
- if ((to.width ) > view[0]) {
706
- to.width = view[0];
707
- to.height = parseInt(((to.width - double_padding) / ratio) + double_padding, 10);
708
- }
709
-
710
- if ((to.height) > view[1]) {
711
- to.height = view[1];
712
- to.width = parseInt(((to.height - double_padding) * ratio) + double_padding, 10);
713
- }
714
-
715
- } else {
716
- to.width = Math.min(to.width, view[0]);
717
- to.height = Math.min(to.height, view[1]);
718
- }
719
- }
720
-
721
- to.top = parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - to.height - 40) * 0.5)), 10);
722
- to.left = parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - to.width - 40) * 0.5)), 10);
723
-
724
- return to;
725
- },
726
-
727
- _get_obj_pos = function(obj) {
728
- var pos = obj.offset();
729
-
730
- pos.top += parseInt( obj.css('paddingTop'), 10 ) || 0;
731
- pos.left += parseInt( obj.css('paddingLeft'), 10 ) || 0;
732
-
733
- pos.top += parseInt( obj.css('border-top-width'), 10 ) || 0;
734
- pos.left += parseInt( obj.css('border-left-width'), 10 ) || 0;
735
-
736
- pos.width = obj.width();
737
- pos.height = obj.height();
738
-
739
- return pos;
740
- },
741
-
742
- _get_zoom_from = function() {
743
- var orig = selectedOpts.orig ? $(selectedOpts.orig) : false,
744
- from = {},
745
- pos,
746
- view;
747
-
748
- if (orig && orig.length) {
749
- pos = _get_obj_pos(orig);
750
-
751
- from = {
752
- width : pos.width + (currentOpts.padding * 2),
753
- height : pos.height + (currentOpts.padding * 2),
754
- top : pos.top - currentOpts.padding - 20,
755
- left : pos.left - currentOpts.padding - 20
756
- };
757
-
758
- } else {
759
- view = _get_viewport();
760
-
761
- from = {
762
- width : currentOpts.padding * 2,
763
- height : currentOpts.padding * 2,
764
- top : parseInt(view[3] + view[1] * 0.5, 10),
765
- left : parseInt(view[2] + view[0] * 0.5, 10)
766
- };
767
- }
768
-
769
- return from;
770
- },
771
-
772
- _animate_loading = function() {
773
- if (!loading.is(':visible')){
774
- clearInterval(loadingTimer);
775
- return;
776
- }
777
-
778
- $('div', loading).css('top', (loadingFrame * -40) + 'px');
779
-
780
- loadingFrame = (loadingFrame + 1) % 12;
781
- };
782
-
783
- /*
784
- * Public methods
785
- */
786
-
787
- $.fn.fancybox = function(options) {
788
- if (!$(this).length) {
789
- return this;
790
- }
791
-
792
- $(this)
793
- .data('fancybox', $.extend({}, options, ($.metadata ? $(this).metadata() : {})))
794
- .unbind('click.fb')
795
- .bind('click.fb', function(e) {
796
- e.preventDefault();
797
-
798
- if (busy) {
799
- return;
800
- }
801
-
802
- busy = true;
803
-
804
- $(this).blur();
805
-
806
- selectedArray = [];
807
- selectedIndex = 0;
808
-
809
- var rel = $(this).attr('rel') || '';
810
-
811
- if (!rel || rel == '' || rel === 'nofollow') {
812
- selectedArray.push(this);
813
-
814
- } else {
815
- selectedArray = $("a[rel=" + rel + "], area[rel=" + rel + "]");
816
- selectedIndex = selectedArray.index( this );
817
- }
818
-
819
- _start();
820
-
821
- return;
822
- });
823
-
824
- return this;
825
- };
826
-
827
- $.fancybox = function(obj) {
828
- var opts;
829
-
830
- if (busy) {
831
- return;
832
- }
833
-
834
- busy = true;
835
- opts = typeof arguments[1] !== 'undefined' ? arguments[1] : {};
836
-
837
- selectedArray = [];
838
- selectedIndex = parseInt(opts.index, 10) || 0;
839
-
840
- if ($.isArray(obj)) {
841
- for (var i = 0, j = obj.length; i < j; i++) {
842
- if (typeof obj[i] == 'object') {
843
- $(obj[i]).data('fancybox', $.extend({}, opts, obj[i]));
844
- } else {
845
- obj[i] = $({}).data('fancybox', $.extend({content : obj[i]}, opts));
846
- }
847
- }
848
-
849
- selectedArray = jQuery.merge(selectedArray, obj);
850
-
851
- } else {
852
- if (typeof obj == 'object') {
853
- $(obj).data('fancybox', $.extend({}, opts, obj));
854
- } else {
855
- obj = $({}).data('fancybox', $.extend({content : obj}, opts));
856
- }
857
-
858
- selectedArray.push(obj);
859
- }
860
-
861
- if (selectedIndex > selectedArray.length || selectedIndex < 0) {
862
- selectedIndex = 0;
863
- }
864
-
865
- _start();
866
- };
867
-
868
- $.fancybox.showActivity = function() {
869
- clearInterval(loadingTimer);
870
-
871
- loading.show();
872
- loadingTimer = setInterval(_animate_loading, 66);
873
- };
874
-
875
- $.fancybox.hideActivity = function() {
876
- loading.hide();
877
- };
878
-
879
- $.fancybox.next = function() {
880
- return $.fancybox.pos( currentIndex + 1);
881
- };
882
-
883
- $.fancybox.prev = function() {
884
- return $.fancybox.pos( currentIndex - 1);
885
- };
886
-
887
- $.fancybox.pos = function(pos) {
888
- if (busy) {
889
- return;
890
- }
891
-
892
- pos = parseInt(pos);
893
-
894
- selectedArray = currentArray;
895
-
896
- if (pos > -1 && pos < currentArray.length) {
897
- selectedIndex = pos;
898
- _start();
899
-
900
- } else if (currentOpts.cyclic && currentArray.length > 1) {
901
- selectedIndex = pos >= currentArray.length ? 0 : currentArray.length - 1;
902
- _start();
903
- }
904
-
905
- return;
906
- };
907
-
908
- $.fancybox.cancel = function() {
909
- if (busy) {
910
- return;
911
- }
912
-
913
- busy = true;
914
-
915
- $.event.trigger('fancybox-cancel');
916
-
917
- _abort();
918
-
919
- selectedOpts.onCancel(selectedArray, selectedIndex, selectedOpts);
920
-
921
- busy = false;
922
- };
923
-
924
- // Note: within an iframe use - parent.$.fancybox.close();
925
- $.fancybox.close = function() {
926
- if (busy || wrap.is(':hidden')) {
927
- return;
928
- }
929
-
930
- busy = true;
931
-
932
- if (currentOpts && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
933
- busy = false;
934
- return;
935
- }
936
-
937
- _abort();
938
-
939
- $(close.add( nav_left ).add( nav_right )).hide();
940
-
941
- $(content.add( overlay )).unbind();
942
-
943
- $(window).unbind("resize.fb scroll.fb");
944
- $(document).unbind('keydown.fb');
945
-
946
- content.find('iframe').attr('src', isIE6 && /^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank');
947
-
948
- if (currentOpts.titlePosition !== 'inside') {
949
- title.empty();
950
- }
951
-
952
- wrap.stop();
953
-
954
- function _cleanup() {
955
- overlay.fadeOut('fast');
956
-
957
- title.empty().hide();
958
- wrap.hide();
959
-
960
- $.event.trigger('fancybox-cleanup');
961
-
962
- content.empty();
963
-
964
- currentOpts.onClosed(currentArray, currentIndex, currentOpts);
965
-
966
- currentArray = selectedOpts = [];
967
- currentIndex = selectedIndex = 0;
968
- currentOpts = selectedOpts = {};
969
-
970
- busy = false;
971
- }
972
-
973
- if (currentOpts.transitionOut == 'elastic') {
974
- start_pos = _get_zoom_from();
975
-
976
- var pos = wrap.position();
977
-
978
- final_pos = {
979
- top : pos.top ,
980
- left : pos.left,
981
- width : wrap.width(),
982
- height : wrap.height()
983
- };
984
-
985
- if (currentOpts.opacity) {
986
- final_pos.opacity = 1;
987
- }
988
-
989
- title.empty().hide();
990
-
991
- fx.prop = 1;
992
-
993
- $(fx).animate({ prop: 0 }, {
994
- duration : currentOpts.speedOut,
995
- easing : currentOpts.easingOut,
996
- step : _draw,
997
- complete : _cleanup
998
- });
999
-
1000
- } else {
1001
- wrap.fadeOut( currentOpts.transitionOut == 'none' ? 0 : currentOpts.speedOut, _cleanup);
1002
- }
1003
- };
1004
-
1005
- $.fancybox.resize = function() {
1006
- if (overlay.is(':visible')) {
1007
- overlay.css('height', $(document).height());
1008
- }
1009
-
1010
- $.fancybox.center(true);
1011
- };
1012
-
1013
- $.fancybox.center = function() {
1014
- var view, align;
1015
-
1016
- if (busy) {
1017
- return;
1018
- }
1019
-
1020
- align = arguments[0] === true ? 1 : 0;
1021
- view = _get_viewport();
1022
-
1023
- if (!align && (wrap.width() > view[0] || wrap.height() > view[1])) {
1024
- return;
1025
- }
1026
-
1027
- wrap
1028
- .stop()
1029
- .animate({
1030
- 'top' : parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - content.height() - 40) * 0.5) - currentOpts.padding)),
1031
- 'left' : parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - content.width() - 40) * 0.5) - currentOpts.padding))
1032
- }, typeof arguments[0] == 'number' ? arguments[0] : 200);
1033
- };
1034
-
1035
- $.fancybox.init = function() {
1036
- if ($("#fancybox-wrap").length) {
1037
- return;
1038
- }
1039
-
1040
- $('body').append(
1041
- tmp = $('<div id="fancybox-tmp"></div>'),
1042
- loading = $('<div id="fancybox-loading"><div></div></div>'),
1043
- overlay = $('<div id="fancybox-overlay"></div>'),
1044
- wrap = $('<div id="fancybox-wrap"></div>')
1045
- );
1046
-
1047
- outer = $('<div id="fancybox-outer"></div>')
1048
- .append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>')
1049
- .appendTo( wrap );
1050
-
1051
- outer.append(
1052
- content = $('<div id="fancybox-content"></div>'),
1053
- close = $('<a id="fancybox-close"></a>'),
1054
- title = $('<div id="fancybox-title"></div>'),
1055
-
1056
- nav_left = $('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),
1057
- nav_right = $('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>')
1058
- );
1059
-
1060
- close.click($.fancybox.close);
1061
- loading.click($.fancybox.cancel);
1062
-
1063
- nav_left.click(function(e) {
1064
- e.preventDefault();
1065
- $.fancybox.prev();
1066
- });
1067
-
1068
- nav_right.click(function(e) {
1069
- e.preventDefault();
1070
- $.fancybox.next();
1071
- });
1072
-
1073
- if ($.fn.mousewheel) {
1074
- wrap.bind('mousewheel.fb', function(e, delta) {
1075
- if (busy) {
1076
- e.preventDefault();
1077
-
1078
- } else if ($(e.target).get(0).clientHeight == 0 || $(e.target).get(0).scrollHeight === $(e.target).get(0).clientHeight) {
1079
- e.preventDefault();
1080
- $.fancybox[ delta > 0 ? 'prev' : 'next']();
1081
- }
1082
- });
1083
- }
1084
-
1085
- if (!$.support.opacity) {
1086
- wrap.addClass('fancybox-ie');
1087
- }
1088
-
1089
- if (isIE6) {
1090
- loading.addClass('fancybox-ie6');
1091
- wrap.addClass('fancybox-ie6');
1092
-
1093
- $('<iframe id="fancybox-hide-sel-frame" src="' + (/^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank' ) + '" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(outer);
1094
- }
1095
- };
1096
-
1097
- $.fn.fancybox.defaults = {
1098
- padding : 10,
1099
- margin : 40,
1100
- opacity : false,
1101
- modal : false,
1102
- cyclic : false,
1103
- scrolling : 'auto', // 'auto', 'yes' or 'no'
1104
-
1105
- width : 560,
1106
- height : 340,
1107
-
1108
- autoScale : true,
1109
- autoDimensions : true,
1110
- centerOnScroll : false,
1111
-
1112
- ajax : {},
1113
- swf : { wmode: 'transparent' },
1114
-
1115
- hideOnOverlayClick : true,
1116
- hideOnContentClick : false,
1117
-
1118
- overlayShow : true,
1119
- overlayOpacity : 0.7,
1120
- overlayColor : '#777',
1121
-
1122
- titleShow : true,
1123
- titlePosition : 'float', // 'float', 'outside', 'inside' or 'over'
1124
- titleFormat : null,
1125
- titleFromAlt : false,
1126
-
1127
- transitionIn : 'fade', // 'elastic', 'fade' or 'none'
1128
- transitionOut : 'fade', // 'elastic', 'fade' or 'none'
1129
-
1130
- speedIn : 300,
1131
- speedOut : 300,
1132
-
1133
- changeSpeed : 300,
1134
- changeFade : 'fast',
1135
-
1136
- easingIn : 'swing',
1137
- easingOut : 'swing',
1138
-
1139
- showCloseButton : true,
1140
- showNavArrows : true,
1141
- enableEscapeButton : true,
1142
- enableKeyboardNav : true,
1143
-
1144
- onStart : function(){},
1145
- onCancel : function(){},
1146
- onComplete : function(){},
1147
- onCleanup : function(){},
1148
- onClosed : function(){},
1149
- onError : function(){}
1150
- };
1151
-
1152
- $(document).ready(function() {
1153
- $.fancybox.init();
1154
- });
1155
-
1156
- })(jQuery);