lightbox2.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /* $Id: lightbox2.js,v 1.1.4.39 2010/06/07 15:24:24 snpower Exp $ */
  2. // start jQuery block
  3. (function ($) {
  4. function alt_layout_handler(event) {
  5. if ($("input[name=lightbox2_lite]:checked").val() != 1) {
  6. if ($("input[name=lightbox2_use_alt_layout]:checked").val() == 1) {
  7. $("input[name=lightbox2_force_show_nav]").attr("disabled", "disabled");
  8. }
  9. else {
  10. $("input[name=lightbox2_force_show_nav]").removeAttr("disabled");
  11. }
  12. }
  13. }
  14. function zoom_handler(event) {
  15. if ($("input[name=lightbox2_disable_resize]:checked").val() == 1) {
  16. $("input[name=lightbox2_disable_zoom]").attr("disabled", "disabled");
  17. }
  18. else {
  19. $("input[name=lightbox2_disable_zoom]").removeAttr("disabled");
  20. }
  21. }
  22. function lightbox2_lite_general_handler(event) {
  23. // Enable / disable the non-lightbox2-lite options.
  24. if ($("input[name=lightbox2_lite]:checked").val() == 1) {
  25. $("input[name=lightbox2_use_alt_layout]").attr("disabled", "disabled");
  26. $("input[name=lightbox2_force_show_nav]").attr("disabled", "disabled");
  27. $("input[name=lightbox2_loop_items]").attr("disabled", "disabled");
  28. $("input[name=lightbox2_disable_resize]").attr("disabled", "disabled");
  29. $("input[name=lightbox2_disable_zoom]").attr("disabled", "disabled");
  30. $("input[name=lightbox2_enable_video]").attr("disabled", "disabled");
  31. $("input[name=lightbox2_enable_login]").attr("disabled", "disabled");
  32. $("input[name=lightbox2_enable_contact]").attr("disabled", "disabled");
  33. $("input[name=lightbox2_node_link_text]").attr("disabled", "disabled");
  34. $("input[name=lightbox2_download_link_text]").attr("disabled", "disabled");
  35. $("input[name=lightbox2_node_link_target]").attr("disabled", "disabled");
  36. $("input[name=lightbox2_image_count_str]").attr("disabled", "disabled");
  37. $("input[name=lightbox2_video_count_str]").attr("disabled", "disabled");
  38. $("input[name=lightbox2_page_count_str]").attr("disabled", "disabled");
  39. $("select[name=lightbox2_display_image_size]").attr("disabled", "disabled");
  40. $("select[name='lightbox2_trigger_image_size[]']").attr("disabled", "disabled");
  41. $("select[name=lightbox2_image_ncck_group_node_id]").attr("disabled", "disabled");
  42. $("select[name=lightbox2_imagefield_group_node_id]").attr("disabled", "disabled");
  43. $("input[name=lightbox2_imagefield_use_node_title]").attr("disabled", "disabled");
  44. $("input[name=lightbox2_disable_close_click]").attr("disabled", "disabled");
  45. $("input[name=lightbox2_border_size]").attr("disabled", "disabled");
  46. $("input[name=lightbox2_box_color]").attr("disabled", "disabled");
  47. $("input[name=lightbox2_font_color]").attr("disabled", "disabled");
  48. $("input[name=lightbox2_top_position]").attr("disabled", "disabled");
  49. $("select[name=lightbox2_resize_sequence]").attr("disabled", "disabled");
  50. $("input[name=lightbox2_resize_speed]").attr("disabled", "disabled");
  51. $("input[name=lightbox2_fadein_speed]").attr("disabled", "disabled");
  52. $("input[name=lightbox2_slidedown_speed]").attr("disabled", "disabled");
  53. }
  54. else {
  55. $("input[name=lightbox2_use_alt_layout]").removeAttr("disabled");
  56. $("input[name=lightbox2_force_show_nav]").removeAttr("disabled");
  57. $("input[name=lightbox2_loop_items]").removeAttr("disabled");
  58. $("input[name=lightbox2_disable_resize]").removeAttr("disabled");
  59. $("input[name=lightbox2_disable_zoom]").removeAttr("disabled");
  60. $("input[name=lightbox2_node_link_text]").removeAttr("disabled");
  61. $("input[name=lightbox2_download_link_text]").removeAttr("disabled");
  62. $("input[name=lightbox2_node_link_target]").removeAttr("disabled");
  63. $("input[name=lightbox2_enable_video]").removeAttr("disabled");
  64. $("input[name=lightbox2_enable_login]").removeAttr("disabled");
  65. $("input[name=lightbox2_enable_contact]").removeAttr("disabled");
  66. $("input[name=lightbox2_image_count_str]").removeAttr("disabled");
  67. $("input[name=lightbox2_video_count_str]").removeAttr("disabled");
  68. $("input[name=lightbox2_page_count_str]").removeAttr("disabled");
  69. $("select[name=lightbox2_display_image_size]").removeAttr("disabled");
  70. $("select[name='lightbox2_trigger_image_size[]']").removeAttr("disabled");
  71. $("select[name=lightbox2_image_ncck_group_node_id]").removeAttr("disabled");
  72. $("select[name=lightbox2_imagefield_group_node_id]").removeAttr("disabled");
  73. $("input[name=lightbox2_imagefield_use_node_title]").removeAttr("disabled");
  74. $("input[name=lightbox2_disable_close_click]").removeAttr("disabled");
  75. $("input[name=lightbox2_border_size]").removeAttr("disabled");
  76. $("input[name=lightbox2_box_color]").removeAttr("disabled");
  77. $("input[name=lightbox2_font_color]").removeAttr("disabled");
  78. $("input[name=lightbox2_top_position]").removeAttr("disabled");
  79. $("select[name=lightbox2_resize_sequence]").removeAttr("disabled");
  80. $("input[name=lightbox2_resize_speed]").removeAttr("disabled");
  81. $("input[name=lightbox2_fadein_speed]").removeAttr("disabled");
  82. $("input[name=lightbox2_slidedown_speed]").removeAttr("disabled");
  83. alt_layout_handler();
  84. zoom_handler();
  85. }
  86. }
  87. function image_node_handler(event) {
  88. // Image node, flickr, gallery2, inline and custom images stuff.
  89. if ($("input[name=lightbox2_lite]").val() != 1) {
  90. // Image node only stuff.
  91. if ($("select[name=lightbox2_image_node]").val() !== 0) {
  92. $("input[name=lightbox2_disable_nested_galleries]").removeAttr("disabled");
  93. $("select[name=lightbox2_display_image_size]").removeAttr("disabled");
  94. $("select[name='lightbox2_trigger_image_size[]']").removeAttr("disabled");
  95. }
  96. else {
  97. $("input[name=lightbox2_disable_nested_galleries]").attr("disabled", "disabled");
  98. $("select[name=lightbox2_display_image_size]").attr("disabled", "disabled");
  99. $("select[name='lightbox2_trigger_image_size[]']").attr("disabled", "disabled");
  100. }
  101. }
  102. }
  103. function lightbox2_lite_auto_handler(event) {
  104. // Enable / disable the image node options.
  105. if ($("input[name=lightbox2_lite]").val() == 1) {
  106. // Disable iframe options.
  107. $("input[name=lightbox2_default_frame_width]").attr("disabled", "disabled");
  108. $("input[name=lightbox2_default_frame_height]").attr("disabled", "disabled");
  109. $("input[name=lightbox2_frame_border]").attr("disabled", "disabled");
  110. // Disable slideshow options.
  111. $("input[name=lightbox2_slideshow_interval]").attr("disabled", "disabled");
  112. $("input[name=lightbox2_slideshow_automatic_start]").attr("disabled", "disabled");
  113. $("input[name=lightbox2_slideshow_automatic_exit]").attr("disabled", "disabled");
  114. $("input[name=lightbox2_slideshow_show_play_pause]").attr("disabled", "disabled");
  115. $("input[name=lightbox2_slideshow_pause_on_next_click]").attr("disabled", "disabled");
  116. $("input[name=lightbox2_slideshow_pause_on_previous_click]").attr("disabled", "disabled");
  117. $("input[name=lightbox2_loop_slides]").attr("disabled", "disabled");
  118. // Disable automatic image handling options.
  119. $("select[name=lightbox2_image_node]").attr("disabled", "disabled");
  120. $("select[name=lightbox2_display_image_size]").attr("disabled", "disabled");
  121. $("select[name='lightbox2_trigger_image_size[]']").attr("disabled", "disabled");
  122. $("select[name=lightbox2_flickr]").attr("disabled", "disabled");
  123. $("select[name=lightbox2_gallery2_blocks]").attr("disabled", "disabled");
  124. $("select[name=lightbox2_image_assist_custom]").attr("disabled", "disabled");
  125. $("select[name=lightbox2_inline]").attr("disabled", "disabled");
  126. $("select[name=lightbox2_custom_class_handler]").attr("disabled", "disabled");
  127. $("textarea[name=lightbox2_custom_trigger_classes]").attr("disabled", "disabled");
  128. $("input[name=lightbox2_disable_nested_galleries]").attr("disabled", "disabled");
  129. $("input[name=lightbox2_disable_nested_acidfree_galleries]").attr("disabled", "disabled");
  130. $("input[name=lightbox2_enable_acidfree_videos]").attr("disabled", "disabled");
  131. }
  132. else {
  133. // Enable iframe options.
  134. $("input[name=lightbox2_default_frame_width]").removeAttr("disabled");
  135. $("input[name=lightbox2_default_frame_height]").removeAttr("disabled");
  136. $("input[name=lightbox2_frame_border]").removeAttr("disabled");
  137. // Enable slideshow options.
  138. $("input[name=lightbox2_slideshow_interval]").removeAttr("disabled");
  139. $("input[name=lightbox2_slideshow_automatic_start]").removeAttr("disabled");
  140. $("input[name=lightbox2_slideshow_automatic_exit]").removeAttr("disabled");
  141. $("input[name=lightbox2_slideshow_show_play_pause]").removeAttr("disabled");
  142. $("input[name=lightbox2_slideshow_pause_on_next_click]").removeAttr("disabled");
  143. $("input[name=lightbox2_slideshow_pause_on_previous_click]").removeAttr("disabled");
  144. $("input[name=lightbox2_loop_slides]").removeAttr("disabled");
  145. // Enable automatic image handling options.
  146. $("select[name=lightbox2_image_node]").removeAttr("disabled");
  147. $("select[name=lightbox2_flickr]").removeAttr("disabled");
  148. $("select[name=lightbox2_gallery2_blocks]").removeAttr("disabled");
  149. $("select[name=lightbox2_image_assist_custom]").removeAttr("disabled");
  150. $("select[name=lightbox2_inline]").removeAttr("disabled");
  151. $("select[name=lightbox2_custom_class_handler]").removeAttr("disabled");
  152. $("textarea[name=lightbox2_custom_trigger_classes]").removeAttr("disabled");
  153. $("select[name=lightbox2_display_image_size]").removeAttr("disabled");
  154. $("select[name='lightbox2_trigger_image_size[]']").removeAttr("disabled");
  155. $("input[name=lightbox2_disable_nested_galleries]").removeAttr("disabled");
  156. $("input[name=lightbox2_disable_nested_acidfree_galleries]").removeAttr("disabled");
  157. $("input[name=lightbox2_enable_acidfree_videos]").removeAttr("disabled");
  158. image_node_handler();
  159. }
  160. }
  161. $(document).ready(function () {
  162. // Handle lightbox2_settings_form.
  163. lightbox2_lite_general_handler();
  164. lightbox2_lite_auto_handler();
  165. image_node_handler();
  166. $("input[name=lightbox2_lite]").bind("click", lightbox2_lite_general_handler);
  167. $("input[name=lightbox2_use_alt_layout]").bind("click", alt_layout_handler);
  168. $("input[name=lightbox2_disable_resize]").bind("click", zoom_handler);
  169. $("select[name=lightbox2_image_node]").bind("click", image_node_handler);
  170. $("select[name=lightbox2_flickr]").bind("click", image_node_handler);
  171. $("select[name=lightbox2_gallery2_blocks]").bind("click", image_node_handler);
  172. $("select[name=lightbox2_image_assist_custom]").bind("click", image_node_handler);
  173. $("select[name=lightbox2_inline]").bind("click", image_node_handler);
  174. $("select[name=lightbox2_custom_class_handler]").bind("change", image_node_handler);
  175. $("textarea[name=lightbox2_custom_trigger_classes]").bind("change", image_node_handler);
  176. });
  177. //End jQuery block
  178. }(jQuery));