PluginProbe ʕ •ᴥ•ʔ
Tutor LMS – eLearning and online course solution / 1.8.2
Tutor LMS – eLearning and online course solution v1.8.2
3.9.15 3.9.14 3.9.13 3.9.12 3.9.11 trunk 1.0.0 1.0.0-alpha 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.11 1.2.12 1.2.13 1.2.20 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.15 1.9.16 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.10 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.10 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 2.4.0 2.5.0 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.1.0 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 3.9.1 3.9.10 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9
tutor / assets / js / tutor-admin.js
tutor / assets / js Last commit date
Chart.bundle.min.js 5 years ago gutenberg_blocks.js 5 years ago mce-button.js 5 years ago tutor-admin.js 5 years ago tutor-front.js 5 years ago tutor-setup.js 5 years ago tutor.js 5 years ago
tutor-admin.js
733 lines
1 jQuery(document).ready(function($){
2 'use strict';
3
4 /**
5 * Color Picker
6 * @since v.1.2.21
7 */
8 if (jQuery().wpColorPicker) {
9 $('.tutor_colorpicker').wpColorPicker();
10 }
11
12 if (jQuery().select2){
13 $('.tutor_select2').select2();
14 }
15
16 /**
17 * Option Settings Nav Tab
18 */
19 $('.tutor-option-nav-tabs li a').click(function(e){
20 e.preventDefault();
21 var tab_page_id = $(this).attr('data-tab');
22 $('.option-nav-item').removeClass('current');
23 $(this).closest('li').addClass('current');
24 $('.tutor-option-nav-page').hide();
25 $(tab_page_id).addClass('current-page').show();
26 window.history.pushState('obj', '', $(this).attr('href'));
27 });
28
29 $('#save_tutor_option').click(function (e) {
30 e.preventDefault();
31 $(this).closest('form').submit();
32 });
33 $('#tutor-option-form').submit(function(e){
34 e.preventDefault();
35
36 var $form = $(this);
37 var data = $form.serializeObject();
38
39 $.ajax({
40 url : ajaxurl,
41 type : 'POST',
42 data : data,
43 beforeSend: function () {
44 $form.find('.button').addClass('tutor-updating-message');
45 },
46 success: function (data) {
47 data.success ?
48 tutor_toast($form.data('toast_success'), $form.data('toast_success_message'), 'success') :
49 tutor_toast($form.data('toast_error'), $form.data('toast_error_message'), 'error');
50 },
51 error: function() {
52 tutor_toast($form.data('toast_error'), $form.data('toast_error_message'), 'error');
53 },
54 complete: function () {
55 $form.find('.button').removeClass('tutor-updating-message');
56 }
57 });
58 });
59
60 /**
61 * Withdraw nav tabs
62 * @since v.1.1.2
63 */
64 $(document).on('click', '.withdraw-method-nav li a', function(e){
65 e.preventDefault();
66 var tab_page_id = $(this).attr('data-target-id');
67 $('.withdraw-method-form-wrap').hide();
68 $('#'+tab_page_id).show();
69 });
70
71 /**
72 * End Withdraw nav tabs
73 */
74
75 /**
76 * Don't move it to anywhere?
77 */
78 function enable_sorting_topic_lesson(){
79 if (jQuery().sortable) {
80 $(".course-contents").sortable({
81 handle: ".course-move-handle",
82 start: function (e, ui) {
83 ui.placeholder.css('visibility', 'visible');
84 },
85 stop: function (e, ui) {
86 tutor_sorting_topics_and_lesson();
87 },
88 });
89 $(".tutor-lessons:not(.drop-lessons)").sortable({
90 connectWith: ".tutor-lessons",
91 items: "div.course-content-item",
92 start: function (e, ui) {
93 ui.placeholder.css('visibility', 'visible');
94 },
95 stop: function (e, ui) {
96 tutor_sorting_topics_and_lesson();
97 },
98 });
99 }
100 }
101 enable_sorting_topic_lesson();
102 function tutor_sorting_topics_and_lesson(){
103 var topics = {};
104 $('.tutor-topics-wrap').each(function(index, item){
105 var $topic = $(this);
106 var topics_id = parseInt($topic.attr('id').match(/\d+/)[0], 10);
107 var lessons = {};
108
109 $topic.find('.course-content-item').each(function(lessonIndex, lessonItem){
110 var $lesson = $(this);
111 var lesson_id = parseInt($lesson.attr('id').match(/\d+/)[0], 10);
112
113 lessons[lessonIndex] = lesson_id;
114 });
115 topics[index] = { 'topic_id' : topics_id, 'lesson_ids' : lessons };
116 });
117 $('#tutor_topics_lessons_sorting').val(JSON.stringify(topics));
118 }
119
120 /**
121 * Lesson Update or Create Modal
122 */
123 $(document).on( 'click', '.update_lesson_modal_btn', function( event ){
124 event.preventDefault();
125
126 var $that = $(this);
127 var content;
128 var inputid = 'tutor_lesson_modal_editor';
129 var editor = tinyMCE.get(inputid);
130 if (editor) {
131 content = editor.getContent();
132 } else {
133 content = $('#'+inputid).val();
134 }
135
136 var form_data = $(this).closest('form').serializeObject();
137 form_data.lesson_content = content;
138
139 $.ajax({
140 url : ajaxurl,
141 type : 'POST',
142 data : form_data,
143 beforeSend: function () {
144 $that.addClass('tutor-updating-message');
145 },
146 success: function (data) {
147 if (data.success){
148 $('#tutor-course-content-wrap').html(data.data.course_contents);
149 enable_sorting_topic_lesson();
150
151 //Close the modal
152 $('.tutor-lesson-modal-wrap').removeClass('show');
153
154 tutor_toast($that.data('toast_success'), $that.data('toast_success_message'), 'success');
155 }
156 else {
157 tutor_toast($that.data('toast_error'), $that.data('toast_error_message'), 'error');
158 }
159 },
160 error: function () {
161 tutor_toast($that.data('toast_error'), $that.data('toast_error_message'), 'error');
162 },
163 complete: function () {
164 $that.removeClass('tutor-updating-message');
165 }
166 });
167 });
168
169 /**
170 * Lesson Video
171 */
172 $(document).on('change', '.tutor_lesson_video_source', function(e){
173 var selector = $(this).val();
174 $('[class^="video_source_wrap"]').hide();
175 $('.video_source_wrap_'+selector).show();
176
177 if (selector === 'html5'){
178 $('.tutor-video-poster-field').show();
179 } else{
180 $('.tutor-video-poster-field').hide();
181 }
182 });
183
184 $(document).on( 'click', '.video_source_wrap_html5 .video_upload_btn', function( event ){
185 event.preventDefault();
186
187 var $that = $(this);
188 var frame;
189 // If the media frame already exists, reopen it.
190 if ( frame ) {
191 frame.open();
192 return;
193 }
194
195 // Create a new media frame
196 frame = wp.media({
197 title: 'Select or Upload Media Of Your Chosen Persuasion',
198 button: {
199 text: 'Use this media'
200 },
201 library: { type: 'video' },
202 multiple: false // Set to true to allow multiple files to be selected
203 });
204
205 // When an image is selected in the media frame...
206 frame.on( 'select', function() {
207 // Get media attachment details from the frame state
208 var attachment = frame.state().get('selection').first().toJSON();
209 $that.closest('.video_source_wrap_html5').find('span.video_media_id').text(attachment.id).closest('p').show();
210 $that.closest('.video_source_wrap_html5').find('input.input_source_video_id').val(attachment.id);
211 });
212 // Finally, open the modal on click
213 frame.open();
214 });
215
216 $(document).on('click', 'a.tutor-delete-attachment', function(e){
217 e.preventDefault();
218 $(this).closest('.tutor-added-attachment').remove();
219 });
220
221 $(document).on('click', '.tutorUploadAttachmentBtn', function(e){
222 e.preventDefault();
223
224 var $that = $(this);
225 var frame;
226 // If the media frame already exists, reopen it.
227 if ( frame ) {
228 frame.open();
229 return;
230 }
231 // Create a new media frame
232 frame = wp.media({
233 title: 'Select or Upload Media Of Your Chosen Persuasion',
234 button: {
235 text: 'Use this media'
236 },
237 multiple: true // Set to true to allow multiple files to be selected
238 });
239 // When an image is selected in the media frame...
240 frame.on( 'select', function() {
241 // Get media attachment details from the frame state
242 var attachments = frame.state().get('selection').toJSON();
243 if (attachments.length){
244 for (var i=0; i < attachments.length; i++){
245 var attachment = attachments[i];
246
247 var inputHtml = '<div class="tutor-added-attachment"><i class="tutor-icon-archive"></i> <a href="javascript:;" class="tutor-delete-attachment tutor-icon-line-cross"></a> <span> <a href="'+attachment.url+'">'+attachment.filename+'</a> </span><input type="hidden" name="tutor_attachments[]" value="'+attachment.id+'"></div>';
248 $that.closest('.tutor-lesson-attachments-metabox').find('.tutor-added-attachments-wrap').append(inputHtml);
249 }
250 }
251 });
252 // Finally, open the modal on click
253 frame.open();
254 });
255
256 /**
257 * Open Sidebar Menu
258 */
259 if (tutor_data.open_tutor_admin_menu){
260 var $adminMenu = $('#adminmenu');
261 $adminMenu.find('[href="admin.php?page=tutor"]').closest('li.wp-has-submenu').addClass('wp-has-current-submenu');
262 $adminMenu.find('[href="admin.php?page=tutor"]').closest('li.wp-has-submenu').find('a.wp-has-submenu').removeClass('wp-has-current-submenu').addClass('wp-has-current-submenu');
263 }
264
265 $(document).on('click', '.tutor-option-media-upload-btn', function(e){
266 e.preventDefault();
267
268 var $that = $(this);
269 var frame;
270 if ( frame ) {
271 frame.open();
272 return;
273 }
274 frame = wp.media({
275 title: 'Select or Upload Media Of Your Chosen Persuasion',
276 button: {
277 text: 'Use this media'
278 },
279 multiple: false
280 });
281 frame.on( 'select', function() {
282 var attachment = frame.state().get('selection').first().toJSON();
283 $that.closest('.option-media-wrap').find('.option-media-preview').html('<img src="'+attachment.url+'" alt="" />');
284 $that.closest('.option-media-wrap').find('input').val(attachment.id);
285 $that.closest('.option-media-wrap').find('.tutor-media-option-trash-btn').show();
286 });
287 frame.open();
288 });
289
290 /**
291 * Remove option media
292 * @since v.1.4.3
293 */
294 $(document).on('click', '.tutor-media-option-trash-btn', function(e){
295 e.preventDefault();
296
297 var $that = $(this);
298 $that.closest('.option-media-wrap').find('img').remove();
299 $that.closest('.option-media-wrap').find('input').val('');
300 $that.closest('.option-media-wrap').find('.tutor-media-option-trash-btn').hide();
301 });
302
303
304 $(document).on('change', '.tutor_addons_list_item', function(e) {
305 var $that = $(this);
306
307 var isEnable = $that.prop('checked') ? 1 : 0;
308 var addonFieldName = $that.attr('name');
309
310 $.ajax({
311 url : ajaxurl,
312 type : 'POST',
313 data : {isEnable:isEnable, addonFieldName:addonFieldName, action : 'addon_enable_disable'},
314 success: function (data) {
315 if (data.success){
316 //Success
317 }
318 }
319 });
320 });
321
322 /**
323 * Add instructor
324 * @since v.1.0.3
325 */
326 $(document).on('submit', '#new-instructor-form', function(e){
327 e.preventDefault();
328
329 var $that = $(this);
330 var formData = $that.serializeObject();
331 formData.action = 'tutor_add_instructor';
332
333 $.ajax({
334 url : ajaxurl,
335 type : 'POST',
336 data : formData,
337 success: function (data) {
338 if (data.success){
339 $that.trigger("reset");
340 $('#form-response').html('<p class="tutor-status-approved-context">'+data.data.msg+'</p>');
341 }else{
342 var errorMsg = '';
343
344 var errors = data.data.errors;
345 if (errors && Object.keys(errors).length){
346 $.each(data.data.errors, function( index, value ) {
347 if (isObject(value)){
348 $.each(value, function( key, value1 ) {
349 errorMsg += '<p class="tutor-required-fields">'+value1[0]+'</p>';
350 });
351 } else{
352 errorMsg += '<p class="tutor-required-fields">'+value+'</p>';
353 }
354 });
355 $('#form-response').html(errorMsg);
356 }
357
358 }
359 }
360 });
361 });
362
363
364 /**
365 * Instructor block unblock action
366 * @since v.1.5.3
367 */
368
369 $(document).on('click', 'a.instructor-action', function(e){
370 e.preventDefault();
371
372 var $that = $(this);
373 var action = $that.attr('data-action');
374 var instructor_id = $that.attr('data-instructor-id');
375
376 var prompt_message = $that.attr('data-prompt-message');
377 if(prompt_message && !confirm(prompt_message)){
378 // Avoid Accidental CLick
379 return;
380 }
381
382 var nonce_key = tutor_data.nonce_key;
383 var json_data = { instructor_id : instructor_id, action_name : action, action: 'instructor_approval_action'};
384 json_data[nonce_key] = tutor_data[nonce_key];
385
386 $.ajax({
387 url : ajaxurl,
388 type : 'POST',
389 data : json_data,
390 beforeSend: function () {
391 $that.addClass('tutor-updating-message');
392 },
393 success: function (data) {
394 location.reload(true);
395 },
396 complete: function () {
397 $that.removeClass('tutor-updating-message');
398 }
399 });
400 });
401
402 function isObject (value) {
403 return value && typeof value === 'object' && value.constructor === Object;
404 }
405
406 /**
407 * Tutor Assignments JS
408 * @since v.1.3.3
409 */
410 $(document).on('click', '.tutor-create-assignments-btn', function(e){
411 e.preventDefault();
412
413 var $that = $(this);
414 var topic_id = $(this).attr('data-topic-id');
415 var course_id = $('#post_ID').val();
416
417 $.ajax({
418 url : ajaxurl,
419 type : 'POST',
420 data : {topic_id : topic_id, course_id : course_id, action: 'tutor_load_assignments_builder_modal'},
421 beforeSend: function () {
422 $that.addClass('tutor-updating-message');
423 },
424 success: function (data) {
425 $('.tutor-lesson-modal-wrap .modal-container').html(data.data.output);
426 $('.tutor-lesson-modal-wrap').attr('data-topic-id', topic_id).addClass('show');
427
428 $(document).trigger('assignment_modal_loaded', {topic_id : topic_id, course_id : course_id});
429
430 tinymce.init(tinyMCEPreInit.mceInit.tutor_editor_config);
431 tinymce.execCommand( 'mceRemoveEditor', false, 'tutor_assignments_modal_editor' );
432 tinyMCE.execCommand('mceAddEditor', false, "tutor_assignments_modal_editor");
433 },
434 complete: function () {
435 quicktags({id : "tutor_assignments_modal_editor"});
436 $that.removeClass('tutor-updating-message');
437 }
438 });
439 });
440
441 $(document).on('click', '.open-tutor-assignment-modal', function(e){
442 e.preventDefault();
443
444 var $that = $(this);
445 var assignment_id = $that.attr('data-assignment-id');
446 var topic_id = $that.attr('data-topic-id');
447 var course_id = $('#post_ID').val();
448
449 $.ajax({
450 url : ajaxurl,
451 type : 'POST',
452 data : {assignment_id : assignment_id, topic_id : topic_id, course_id : course_id, action: 'tutor_load_assignments_builder_modal'},
453 beforeSend: function () {
454 $that.addClass('tutor-updating-message');
455 },
456 success: function (data) {
457 $('.tutor-lesson-modal-wrap .modal-container').html(data.data.output);
458 $('.tutor-lesson-modal-wrap').attr({'data-assignment-id' : assignment_id, 'data-topic-id':topic_id}).addClass('show');
459
460 $(document).trigger('assignment_modal_loaded', {assignment_id : assignment_id, topic_id : topic_id, course_id : course_id});
461
462 tinymce.init(tinyMCEPreInit.mceInit.tutor_editor_config);
463 tinymce.execCommand( 'mceRemoveEditor', false, 'tutor_assignments_modal_editor' );
464 tinyMCE.execCommand('mceAddEditor', false, "tutor_assignments_modal_editor");
465 },
466 complete: function () {
467 quicktags({id : "tutor_assignments_modal_editor"});
468 $that.removeClass('tutor-updating-message');
469 }
470 });
471 });
472
473 /**
474 * Update Assignment Data
475 */
476 $(document).on( 'click', '.update_assignment_modal_btn', function( event ){
477 event.preventDefault();
478
479 var $that = $(this);
480 var content;
481 var inputid = 'tutor_assignments_modal_editor';
482 var editor = tinyMCE.get(inputid);
483 if (editor) {
484 content = editor.getContent();
485 } else {
486 content = $('#'+inputid).val();
487 }
488
489 var form_data = $(this).closest('form').serializeObject();
490 form_data.assignment_content = content;
491
492 $.ajax({
493 url : ajaxurl,
494 type : 'POST',
495 data : form_data,
496 beforeSend: function () {
497 $that.addClass('tutor-updating-message');
498 },
499 success: function (data) {
500 if (data.success){
501 $('#tutor-course-content-wrap').html(data.data.course_contents);
502 enable_sorting_topic_lesson();
503
504 //Close the modal
505 $('.tutor-lesson-modal-wrap').removeClass('show');
506
507 tutor_toast($that.data('toast_success'), $that.data('toast_success_message'), 'success');
508 }
509 else {
510 tutor_toast($that.data('toast_error'), $that.data('toast_error_message'), 'error');
511 }
512 },
513 error: function() {
514 tutor_toast($that.data('toast_error'), $that.data('toast_error_message'), 'error');
515 },
516 complete: function () {
517 $that.removeClass('tutor-updating-message');
518 }
519 });
520 });
521
522 /**
523 * Add Assignment
524 */
525 $(document).on( 'click', '.add-assignment-attachments', function( event ){
526 event.preventDefault();
527
528 var $that = $(this);
529 var frame;
530 // If the media frame already exists, reopen it.
531 if ( frame ) {
532 frame.open();
533 return;
534 }
535
536 // Create a new media frame
537 frame = wp.media({
538 title: 'Select or Upload Media Of Your Chosen Persuasion',
539 button: {
540 text: 'Use this media'
541 },
542 multiple: false // Set to true to allow multiple files to be selected
543 });
544
545 // When an image is selected in the media frame...
546 frame.on( 'select', function() {
547 // Get media attachment details from the frame state
548 var attachment = frame.state().get('selection').first().toJSON();
549
550 var field_markup = '<div class="tutor-individual-attachment-file"><p class="attachment-file-name">'+attachment.filename+'</p><input type="hidden" name="tutor_assignment_attachments[]" value="'+attachment.id+'"><a href="javascript:;" class="remove-assignment-attachment-a text-muted"> &times; Remove</a></div>';
551
552 $('#assignment-attached-file').append(field_markup);
553 $that.closest('.video_source_wrap_html5').find('input').val(attachment.id);
554 });
555 // Finally, open the modal on click
556 frame.open();
557 });
558
559 $(document).on( 'click', '.remove-assignment-attachment-a', function( event ){
560 event.preventDefault();
561 $(this).closest('.tutor-individual-attachment-file').remove();
562 });
563
564 /**
565 * Used for backend profile photo upload.
566 */
567
568 //tutor_video_poster_upload_btn
569 $(document).on( 'click', '.tutor_video_poster_upload_btn', function( event ){
570 event.preventDefault();
571
572 var $that = $(this);
573 var frame;
574 // If the media frame already exists, reopen it.
575 if ( frame ) {
576 frame.open();
577 return;
578 }
579
580 // Create a new media frame
581 frame = wp.media({
582 title: 'Select or Upload Media Of Your Chosen Persuasion',
583 button: {
584 text: 'Use this media'
585 },
586 multiple: false // Set to true to allow multiple files to be selected
587 });
588
589 // When an image is selected in the media frame...
590 frame.on( 'select', function() {
591 // Get media attachment details from the frame state
592 var attachment = frame.state().get('selection').first().toJSON();
593 $that.closest('.tutor-video-poster-wrap').find('.video-poster-img').html('<img src="'+attachment.url+'" alt="" />');
594 $that.closest('.tutor-video-poster-wrap').find('input').val(attachment.id);
595 });
596 // Finally, open the modal on click
597 frame.open();
598 });
599
600
601 /**
602 * Tutor Memberships toggle in Paid Membership Pro panel
603 * @since v.1.3.6
604 */
605
606 $(document).on( 'change', '#tutor_pmpro_membership_model_select', function( e ){
607 e.preventDefault();
608
609 var $that = $(this);
610
611 if ($that.val() === 'category_wise_membership'){
612 $('.membership_course_categories').show();
613 } else{
614 $('.membership_course_categories').hide();
615 }
616 });
617
618 $(document).on( 'change', '#tutor_pmpro_membership_model_select', function( e ){
619 e.preventDefault();
620
621 var $that = $(this);
622
623 if ($that.val() === 'category_wise_membership'){
624 $('.membership_course_categories').show();
625 } else{
626 $('.membership_course_categories').hide();
627 }
628 });
629
630 /**
631 * Find user/student from select2
632 * @since v.1.4.0
633 */
634
635 $('#select2_search_user_ajax').select2({
636 allowClear: true,
637 placeholder: "Search students",
638 minimumInputLength: '1',
639 escapeMarkup: function( m ) {
640 return m;
641 },
642 ajax: {
643 url : ajaxurl,
644 type : 'POST',
645 dataType: 'json',
646 delay: 1000,
647 data: function( params ) {
648 return {
649 term: params.term,
650 action: 'tutor_json_search_students'
651 };
652 },
653 processResults: function( data ) {
654 var terms = [];
655 if ( data ) {
656 $.each( data, function( id, text ) {
657 terms.push({
658 id: id,
659 text: text
660 });
661 });
662 }
663 return {
664 results: terms
665 };
666
667 },
668 cache: true
669 }
670 });
671
672 /**
673 * Confirm Alert for deleting enrollments data
674 *
675 * @since v.1.4.0
676 */
677 $(document).on( 'click', 'table.enrolments .delete a', function( e ){
678 if (! confirm(tutor_data.delete_confirm_text)) {
679 e.preventDefault();
680 }
681 });
682
683
684 /**
685 * Show hide is course public checkbox (backend dashboard editor)
686 *
687 * @since v.1.7.2
688 */
689 var price_type = $('#tutor-attach-product [name="tutor_course_price_type"]');
690 if(price_type.length==0){
691 $('#_tutor_is_course_public_meta_checkbox').show();
692 }
693 else{
694 price_type.change(function(){
695 if($(this).prop('checked')){
696 var method = $(this).val()=='paid' ? 'hide' : 'show';
697 $('#_tutor_is_course_public_meta_checkbox')[method]();
698 }
699 }).trigger('change');
700 }
701
702
703 /**
704 * Focus selected instructor layout in setting page
705 *
706 * @since v.1.7.5
707 */
708 $(document).on('click', '.instructor-layout-template', function(){
709 $('.instructor-layout-template').removeClass('selected-template');
710 $(this).addClass('selected-template');
711 });
712
713
714
715 /**
716 * Programmatically open preview link. For some reason it's not working normally.
717 *
718 * @since v.1.7.9
719 */
720 $('#preview-action a.preview').click(function(e) {
721 var href = $(this).attr('href');
722
723 if(href) {
724 e.preventDefault();
725 window.open(href, '_blank');
726 }
727 });
728
729
730
731 });
732
733