footer.js.tpl 3.6 KB

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