footer.js.tpl 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. $("#" + id).toggle();
  46. });
  47. /**
  48. * <a class="advanced_options_open" href="http://" rel="div_id">Open</a>
  49. * <a class="advanced_options_close" href="http://" rel="div_id">Close</a>
  50. * <div id="div_id">Div content</div>
  51. * */
  52. $(".advanced_options_open").on("click", function (event) {
  53. event.preventDefault();
  54. var id = $(this).attr('rel');
  55. $("#" + id).show();
  56. });
  57. $(".advanced_options_close").on("click", function (event) {
  58. event.preventDefault();
  59. var id = $(this).attr('rel');
  60. $("#" + id).hide();
  61. });
  62. // Adv multi-select search input.
  63. $('.select_class_filter').on('focus', function () {
  64. var inputId = $(this).attr('id');
  65. inputId = inputId.replace('-filter', '');
  66. $("#" + inputId).filterByText($("#" + inputId + "-filter"));
  67. });
  68. $(".jp-jplayer audio").addClass('skip');
  69. // Mediaelement
  70. if ( {{ show_media_element }} == 1) {
  71. jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer(/* Options */);
  72. }
  73. // Table highlight.
  74. $("form .data_table input:checkbox").click(function () {
  75. if ($(this).is(":checked")) {
  76. $(this).parentsUntil("tr").parent().addClass("row_selected");
  77. } else {
  78. $(this).parentsUntil("tr").parent().removeClass("row_selected");
  79. }
  80. });
  81. /* For non HTML5 browsers */
  82. if ($("#formLogin".length > 1)) {
  83. $("input[name=login]").focus();
  84. }
  85. /* For IOS users */
  86. $('.autocapitalize_off').attr('autocapitalize', 'off');
  87. // Tool tip (in exercises)
  88. var tip_options = {
  89. placement: 'right'
  90. };
  91. $('.boot-tooltip').tooltip(tip_options);
  92. });
  93. </script>