Chart.bundle.min.js
6 years ago
gutenberg_blocks.js
6 years ago
mce-button.js
6 years ago
tutor-admin.js
6 years ago
tutor-front.js
6 years ago
tutor.js
6 years ago
tutor.js
79 lines
| 1 | jQuery(document).ready(function($){ |
| 2 | 'use strict'; |
| 3 | |
| 4 | /** |
| 5 | * Video source tabs |
| 6 | */ |
| 7 | |
| 8 | if (jQuery().select2){ |
| 9 | $('.videosource_select2').select2({ |
| 10 | width: "100%", |
| 11 | templateSelection: iformat, |
| 12 | templateResult: iformat, |
| 13 | allowHtml: true |
| 14 | }); |
| 15 | } |
| 16 | //videosource_select2 |
| 17 | |
| 18 | function iformat(icon) { |
| 19 | var originalOption = icon.element; |
| 20 | return $('<span><i class="tutor-icon-' + $(originalOption).data('icon') + '"></i> ' + icon.text + '</span>'); |
| 21 | } |
| 22 | |
| 23 | $(document).on('change', '.tutor_lesson_video_source', function(e){ |
| 24 | var $that = $(this); |
| 25 | var selector = $(this).val(); |
| 26 | |
| 27 | if (selector){ |
| 28 | $('.video-metabox-source-input-wrap').show(); |
| 29 | }else{ |
| 30 | $('.video-metabox-source-input-wrap').hide(); |
| 31 | } |
| 32 | $that.closest('.tutor-option-field').find('.video-metabox-source-item').hide(); |
| 33 | $that.closest('.tutor-option-field').find('.video_source_wrap_'+selector).show(); |
| 34 | }); |
| 35 | |
| 36 | /** |
| 37 | * Course Builder |
| 38 | * |
| 39 | * @since v.1.3.4 |
| 40 | */ |
| 41 | |
| 42 | $(document).on( 'click', '.tutor-course-thumbnail-upload-btn', function( event ){ |
| 43 | event.preventDefault(); |
| 44 | var $that = $(this); |
| 45 | var frame; |
| 46 | if ( frame ) { |
| 47 | frame.open(); |
| 48 | return; |
| 49 | } |
| 50 | frame = wp.media({ |
| 51 | title: 'Select or Upload Media Of Your Chosen Persuasion', |
| 52 | button: { |
| 53 | text: 'Use this media' |
| 54 | }, |
| 55 | multiple: false |
| 56 | }); |
| 57 | frame.on( 'select', function() { |
| 58 | var attachment = frame.state().get('selection').first().toJSON(); |
| 59 | $that.closest('.tutor-thumbnail-wrap').find('.thumbnail-img').attr('src', attachment.url); |
| 60 | $that.closest('.tutor-thumbnail-wrap').find('input').val(attachment.id); |
| 61 | $('.tutor-course-thumbnail-delete-btn').show(); |
| 62 | }); |
| 63 | frame.open(); |
| 64 | }); |
| 65 | |
| 66 | //Delete Thumbnail |
| 67 | $(document).on( 'click', '.tutor-course-thumbnail-delete-btn', function( event ){ |
| 68 | event.preventDefault(); |
| 69 | var $that = $(this); |
| 70 | |
| 71 | var placeholder_src = $that.closest('.tutor-thumbnail-wrap').find('.thumbnail-img').attr('data-placeholder-src'); |
| 72 | $that.closest('.tutor-thumbnail-wrap').find('.thumbnail-img').attr('src', placeholder_src); |
| 73 | $that.closest('.tutor-thumbnail-wrap').find('input').val(''); |
| 74 | $('.tutor-course-thumbnail-delete-btn').hide(); |
| 75 | }); |
| 76 | |
| 77 | |
| 78 | |
| 79 | }); |