footer.js.tpl 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <script>
  2. $("form").on("click", ' .advanced_parameters', function() {
  3. /*var id = $(this).attr('id') + '_options';
  4. console.log(id);
  5. $("#"+id).toggleClass('active');
  6. var button = $(this);
  7. $("#"+id).toggle(function() {
  8. $("#"+id).toggleClass('active');
  9. });*/
  10. });
  11. /* Makes row highlighting possible */
  12. $(document).ready( function() {
  13. // Date time settings.
  14. moment.locale('{{ locale }}');
  15. $.datepicker.setDefaults($.datepicker.regional["{{ locale }}"]);
  16. $.datepicker.regional["local"] = $.datepicker.regional["{{ locale }}"];
  17. // Chosen select
  18. $(".chzn-select").chosen({
  19. disable_search_threshold: 10,
  20. no_results_text: '{{ 'SearchNoResultsFound' | get_lang }}',
  21. placeholder_text_multiple: '{{ 'SelectSomeOptions' | get_lang }}',
  22. placeholder_text_single: '{{ 'SelectAnOption' | get_lang }}',
  23. width: "100%"
  24. });
  25. // Bootstrap tabs.
  26. $('.tab-wrapper a').click(function (e) {
  27. e.preventDefault();
  28. $(this).tab('show');
  29. //$('#tabs a:first').tab('show') // Select first tab
  30. });
  31. // Fixes bug when loading links inside a tab.
  32. $('.tab-wrapper .tab-pane a').unbind();
  33. /**
  34. * Advanced options
  35. * Usage
  36. * <a id="link" href="url">Advanced</a>
  37. * <div id="link_options">
  38. * hidden content :)
  39. * </div>
  40. * */
  41. $(".advanced_options").on("click", function (event) {
  42. event.preventDefault();
  43. var id = $(this).attr('id') + '_options';
  44. var button = $(this);
  45. button.toggleClass('active');
  46. $("#" + id).toggle();
  47. });
  48. /**
  49. * <a class="advanced_options_open" href="http://" rel="div_id">Open</a>
  50. * <a class="advanced_options_close" href="http://" rel="div_id">Close</a>
  51. * <div id="div_id">Div content</div>
  52. * */
  53. $(".advanced_options_open").on("click", function (event) {
  54. event.preventDefault();
  55. var id = $(this).attr('rel');
  56. $("#" + id).show();
  57. });
  58. $(".advanced_options_close").on("click", function (event) {
  59. event.preventDefault();
  60. var id = $(this).attr('rel');
  61. $("#" + id).hide();
  62. });
  63. // Adv multi-select search input.
  64. $('.select_class_filter').on('focus', function () {
  65. var inputId = $(this).attr('id');
  66. inputId = inputId.replace('-filter', '');
  67. $("#" + inputId).filterByText($("#" + inputId + "-filter"));
  68. });
  69. $(".jp-jplayer audio").addClass('skip');
  70. // Mediaelement
  71. jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer(/* Options */);
  72. // Table highlight.
  73. $("form .data_table input:checkbox").click(function () {
  74. if ($(this).is(":checked")) {
  75. $(this).parentsUntil("tr").parent().addClass("row_selected");
  76. } else {
  77. $(this).parentsUntil("tr").parent().removeClass("row_selected");
  78. }
  79. });
  80. /* For non HTML5 browsers */
  81. if ($("#formLogin".length > 1)) {
  82. $("input[name=login]").focus();
  83. }
  84. /* For IOS users */
  85. $('.autocapitalize_off').attr('autocapitalize', 'off');
  86. // Tool tip (in exercises)
  87. var tip_options = {
  88. placement: 'right'
  89. };
  90. $('.boot-tooltip').tooltip(tip_options);
  91. });
  92. </script>