PageRenderTime 52ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/template/js/demo/demo.ui.js

https://bitbucket.org/dudesl/turecuerdo
JavaScript | 178 lines | 178 code | 0 blank | 0 comment | 2 complexity | 1175798495812108841afcb6a21b85d7 MD5 | raw file
  1. (function(a){
  2. a(document).ready(function(c){
  3. a("#da-ex-accordion, #da-ex-accordion-plain").accordion();
  4. a("#da-ex-tabs, #da-ex-tabs-plain").tabs();
  5. a("#da-ex-datepicker, #da-ex-datepicker-inline").datepicker({
  6. showOtherMonths:true
  7. });
  8. a("#da-ex-datepicker-week").datepicker({
  9. showOtherMonths:true,
  10. showWeek:true
  11. });
  12. a("#da-ex-datepicker-months").datepicker({
  13. showOtherMonths:true,
  14. numberOfMonths:3
  15. });
  16. a("#da-ex-datetimepicker").datetimepicker();
  17. a("#da-ex-timepicker").timepicker({});
  18. a(".da-ex-buttons").button();
  19. a("#da-ex-buttons-radio, #da-ex-buttons-checkbox").buttonset();
  20. a("#da-ex-buttons-icon button:first").button({
  21. icons:{
  22. primary:"ui-icon-locked"
  23. },
  24. text:false
  25. }).next().button({
  26. icons:{
  27. primary:"ui-icon-locked"
  28. }
  29. }).next().button({
  30. icons:{
  31. primary:"ui-icon-gear",
  32. secondary:"ui-icon-triangle-1-s"
  33. }
  34. }).next().button({
  35. icons:{
  36. primary:"ui-icon-gear",
  37. secondary:"ui-icon-triangle-1-s"
  38. },
  39. text:false
  40. });
  41. var b=["ActionScript","AppleScript","Asp","BASIC","C","C++","Clojure","COBOL","ColdFusion","Erlang","Fortran","Groovy","Haskell","Java","JavaScript","Lisp","Perl","PHP","Python","Ruby","Scala","Scheme"];
  42. a("#da-ex-autocomplete").autocomplete({
  43. source:b
  44. });
  45. a("#da-ex-slider").slider();
  46. a("#da-ex-slider-range").slider({
  47. range:true,
  48. min:0,
  49. max:500,
  50. values:[75,300],
  51. slide:function(d,e){
  52. a("#da-ex-slider-range-info .da-highlight").html("$"+e.values[0]+" - $"+e.values[1])
  53. }
  54. });
  55. a(".da-ex-color-slider").slider({
  56. range:"min",
  57. value:45,
  58. min:1,
  59. max:100
  60. });
  61. a("#da-ex-slider-range-fixed").slider({
  62. range:"min",
  63. value:37,
  64. min:1,
  65. max:700,
  66. slide:function(d,e){
  67. a("#da-ex-slider-range-fixed-info .da-highlight").html("$"+e.value)
  68. }
  69. });
  70. a("#da-slider-equalizer > span").each(function(){
  71. var d=parseInt(a(this).text(),10);
  72. a(this).empty().slider({
  73. value:d,
  74. range:"min",
  75. animate:true,
  76. orientation:"vertical"
  77. })
  78. });
  79. a(".da-ex-color-pb, #da-ex-pb, #da-ex-pba").each(function(){
  80. a(this).progressbar({
  81. value:25+Math.floor(Math.random()*50)
  82. })
  83. });
  84. a("#da-ex-pba-trigger").bind("click",function(d){
  85. a(this).parent().next("#da-ex-pba").progressbar("value",20+Math.floor(Math.random()*80));
  86. d.preventDefault()
  87. });
  88. a("#da-ex-dialog-div").dialog({
  89. autoOpen:false,
  90. title:"Default UI Dialog",
  91. modal:true,
  92. width:"640",
  93. buttons:[{
  94. text:"Close Dialog",
  95. click:function(){
  96. a(this).dialog("close")
  97. }
  98. }]
  99. });
  100. a("#da-ex-dialog-form-div").dialog({
  101. autoOpen:false,
  102. title:"UI Dialog Modal Form",
  103. modal:true,
  104. width:"640",
  105. buttons:[{
  106. text:"Submit",
  107. click:function(){
  108. a(this).find("form#da-ex-dialog-form-val").submit()
  109. }
  110. }]
  111. }).find("#da-ex-dialog-dp").datepicker({
  112. dateFormat:"yy-mm-dd"
  113. }).end().find("form").validate({
  114. rules:{
  115. reqField:{
  116. required:true
  117. },
  118. picture:{
  119. required:true,
  120. accept:["jpeg","jpg","png","gif"]
  121. },
  122. dateField:{
  123. required:true,
  124. date:true
  125. },
  126. gender:{
  127. required:true
  128. }
  129. },
  130. invalidHandler:function(f,d){
  131. var g=d.numberOfInvalids();
  132. if(g){
  133. var e=g==1?"You missed 1 field. It has been highlighted":"You missed "+g+" fields. They have been highlighted";
  134. a("#da-validate-error").html(e).show()
  135. }else{
  136. a("#da-validate-error").hide()
  137. }
  138. }
  139. });
  140. a("#da-ex-dialog").bind("click",function(d){
  141. a("#da-ex-dialog-div").dialog("option",{
  142. modal:false
  143. }).dialog("open");
  144. d.preventDefault()
  145. });
  146. a("#da-ex-dialog-modal").bind("click",function(d){
  147. a("#da-ex-dialog-div").dialog("option",{
  148. modal:true
  149. }).dialog("open");
  150. d.preventDefault()
  151. });
  152. a("#da-ex-dialog-form").bind("click",function(d){
  153. a("#da-ex-dialog-form-div").dialog("option",{
  154. modal:true
  155. }).dialog("open");
  156. d.preventDefault()
  157. });
  158. if(a.jGrowl){
  159. a("#da-ex-growl").bind("click",function(d){
  160. a.jGrowl("Hello World!",{
  161. position:"bottom-right"
  162. })
  163. });
  164. a("#da-ex-growl-1").bind("click",function(d){
  165. a.jGrowl("A sticky message",{
  166. sticky:true,
  167. position:"bottom-right"
  168. })
  169. });
  170. a("#da-ex-growl-2").bind("click",function(d){
  171. a.jGrowl("Message with Header",{
  172. header:"Important!",
  173. position:"bottom-right"
  174. })
  175. })
  176. }
  177. })
  178. })(jQuery);