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