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
1127 lines
| 1 | jQuery(document).ready(function($){ |
| 2 | 'use strict'; |
| 3 | |
| 4 | /** |
| 5 | * Slider bar |
| 6 | */ |
| 7 | function tutor_slider_init(){ |
| 8 | $('.tutor-field-slider').each(function(){ |
| 9 | var $slider = $(this); |
| 10 | var $input = $slider.closest('.tutor-field-type-slider').find('input[type="hidden"]'); |
| 11 | var $showVal = $slider.closest('.tutor-field-type-slider').find('.tutor-field-type-slider-value'); |
| 12 | var min = parseFloat($slider.closest('.tutor-field-type-slider').attr('data-min')); |
| 13 | var max = parseFloat($slider.closest('.tutor-field-type-slider').attr('data-max')); |
| 14 | |
| 15 | $slider.slider({ |
| 16 | range: "max", |
| 17 | min: min, |
| 18 | max: max, |
| 19 | value: $input.val(), |
| 20 | slide: function( event, ui ) { |
| 21 | $showVal.text(ui.value); |
| 22 | $input.val(ui.value); |
| 23 | } |
| 24 | }); |
| 25 | }); |
| 26 | } |
| 27 | tutor_slider_init(); |
| 28 | |
| 29 | |
| 30 | /** |
| 31 | * Video source tabs |
| 32 | */ |
| 33 | |
| 34 | if (jQuery().select2){ |
| 35 | $('.videosource_select2').select2({ |
| 36 | width: "100%", |
| 37 | templateSelection: iformat, |
| 38 | templateResult: iformat, |
| 39 | allowHtml: true |
| 40 | }); |
| 41 | } |
| 42 | //videosource_select2 |
| 43 | |
| 44 | function iformat(icon) { |
| 45 | var originalOption = icon.element; |
| 46 | return $('<span><i class="tutor-icon-' + $(originalOption).data('icon') + '"></i> ' + icon.text + '</span>'); |
| 47 | } |
| 48 | |
| 49 | $(document).on('change', '.tutor_lesson_video_source', function(e){ |
| 50 | var $that = $(this); |
| 51 | var selector = $(this).val(); |
| 52 | |
| 53 | if (selector){ |
| 54 | $('.video-metabox-source-input-wrap').show(); |
| 55 | }else{ |
| 56 | $('.video-metabox-source-input-wrap').hide(); |
| 57 | } |
| 58 | $that.closest('.tutor-option-field').find('.video-metabox-source-item').hide(); |
| 59 | $that.closest('.tutor-option-field').find('.video_source_wrap_'+selector).show(); |
| 60 | }); |
| 61 | |
| 62 | /** |
| 63 | * Course Builder |
| 64 | * |
| 65 | * @since v.1.3.4 |
| 66 | */ |
| 67 | |
| 68 | $(document).on( 'click', '.tutor-course-thumbnail-upload-btn', function( event ){ |
| 69 | event.preventDefault(); |
| 70 | var $that = $(this); |
| 71 | var frame; |
| 72 | if ( frame ) { |
| 73 | frame.open(); |
| 74 | return; |
| 75 | } |
| 76 | frame = wp.media({ |
| 77 | title: 'Select or Upload Media Of Your Chosen Persuasion', |
| 78 | button: { |
| 79 | text: 'Use this media' |
| 80 | }, |
| 81 | multiple: false |
| 82 | }); |
| 83 | frame.on( 'select', function() { |
| 84 | var attachment = frame.state().get('selection').first().toJSON(); |
| 85 | $that.closest('.tutor-thumbnail-wrap').find('.thumbnail-img').attr('src', attachment.url); |
| 86 | $that.closest('.tutor-thumbnail-wrap').find('input').val(attachment.id); |
| 87 | $('.tutor-course-thumbnail-delete-btn').show(); |
| 88 | }); |
| 89 | frame.open(); |
| 90 | }); |
| 91 | |
| 92 | //Delete Thumbnail |
| 93 | $(document).on( 'click', '.tutor-course-thumbnail-delete-btn', function( event ){ |
| 94 | event.preventDefault(); |
| 95 | var $that = $(this); |
| 96 | |
| 97 | var placeholder_src = $that.closest('.tutor-thumbnail-wrap').find('.thumbnail-img').attr('data-placeholder-src'); |
| 98 | $that.closest('.tutor-thumbnail-wrap').find('.thumbnail-img').attr('src', placeholder_src); |
| 99 | $that.closest('.tutor-thumbnail-wrap').find('input').val(''); |
| 100 | $('.tutor-course-thumbnail-delete-btn').hide(); |
| 101 | }); |
| 102 | |
| 103 | /** |
| 104 | * Quiz Builder |
| 105 | */ |
| 106 | |
| 107 | $(document).on('click', '.create_new_topic_btn', function (e) { |
| 108 | e.preventDefault(); |
| 109 | $('.tutor-metabox-add-topics').slideToggle(); |
| 110 | }); |
| 111 | |
| 112 | $(document).on('click', '#tutor-add-topic-btn', function (e) { |
| 113 | e.preventDefault(); |
| 114 | var $that = $(this); |
| 115 | var form_data = $that.closest('.tutor-metabox-add-topics').find('input, textarea').serialize()+'&action=tutor_add_course_topic'; |
| 116 | |
| 117 | $.ajax({ |
| 118 | url : ajaxurl, |
| 119 | type : 'POST', |
| 120 | data : form_data, |
| 121 | beforeSend: function () { |
| 122 | $that.addClass('tutor-updating-message'); |
| 123 | }, |
| 124 | success: function (data) { |
| 125 | if (data.success){ |
| 126 | $('#tutor-course-content-wrap').html(data.data.course_contents); |
| 127 | $that.closest('.tutor-metabox-add-topics').find('input[type!="hidden"], textarea').each(function () { |
| 128 | $(this).val(''); |
| 129 | }); |
| 130 | $that.closest('.tutor-metabox-add-topics').slideUp(); |
| 131 | enable_sorting_topic_lesson(); |
| 132 | } |
| 133 | }, |
| 134 | complete: function () { |
| 135 | $that.removeClass('tutor-updating-message'); |
| 136 | } |
| 137 | }); |
| 138 | }); |
| 139 | |
| 140 | $(document).on('change keyup', '.course-edit-topic-title-input', function (e) { |
| 141 | e.preventDefault(); |
| 142 | $(this).closest('.tutor-topics-top').find('.topic-inner-title').html($(this).val()); |
| 143 | }); |
| 144 | |
| 145 | $(document).on('click', '.topic-edit-icon', function (e) { |
| 146 | e.preventDefault(); |
| 147 | $(this).closest('.tutor-topics-top').find('.tutor-topics-edit-form').slideToggle(); |
| 148 | }); |
| 149 | |
| 150 | $(document).on('click', '.tutor-topics-edit-button', function(e){ |
| 151 | e.preventDefault(); |
| 152 | var $button = $(this); |
| 153 | var $topic = $button.closest('.tutor-topics-wrap'); |
| 154 | var topics_id = parseInt($topic.attr('id').match(/\d+/)[0], 10); |
| 155 | var topic_title = $button.closest('.tutor-topics-wrap').find('[name="topic_title"]').val(); |
| 156 | var topic_summery = $button.closest('.tutor-topics-wrap').find('[name="topic_summery"]').val(); |
| 157 | |
| 158 | var data = {topic_title: topic_title, topic_summery : topic_summery, topic_id : topics_id, action: 'tutor_update_topic'}; |
| 159 | $.ajax({ |
| 160 | url : ajaxurl, |
| 161 | type : 'POST', |
| 162 | data : data, |
| 163 | beforeSend: function () { |
| 164 | $button.addClass('tutor-updating-message'); |
| 165 | }, |
| 166 | success: function (data) { |
| 167 | if (data.success){ |
| 168 | $button.closest('.tutor-topics-wrap').find('span.topic-inner-title').text(topic_title); |
| 169 | $button.closest('.tutor-topics-wrap').find('.tutor-topics-edit-form').slideUp(); |
| 170 | } |
| 171 | }, |
| 172 | complete: function () { |
| 173 | $button.removeClass('tutor-updating-message'); |
| 174 | } |
| 175 | }); |
| 176 | }); |
| 177 | |
| 178 | /** |
| 179 | * Update Lesson Modal |
| 180 | */ |
| 181 | $(document).on('click', '.open-tutor-lesson-modal', function(e){ |
| 182 | e.preventDefault(); |
| 183 | |
| 184 | var $that = $(this); |
| 185 | var lesson_id = $that.attr('data-lesson-id'); |
| 186 | var topic_id = $that.attr('data-topic-id'); |
| 187 | var course_id = $('#post_ID').val(); |
| 188 | |
| 189 | $.ajax({ |
| 190 | url : ajaxurl, |
| 191 | type : 'POST', |
| 192 | data : {lesson_id : lesson_id, topic_id : topic_id, course_id : course_id, action: 'tutor_load_edit_lesson_modal'}, |
| 193 | beforeSend: function () { |
| 194 | $that.addClass('tutor-updating-message'); |
| 195 | }, |
| 196 | success: function (data) { |
| 197 | $('.tutor-lesson-modal-wrap .modal-container').html(data.data.output); |
| 198 | $('.tutor-lesson-modal-wrap').attr({'data-lesson-id' : lesson_id, 'data-topic-id':topic_id}).addClass('show'); |
| 199 | |
| 200 | var tinymceConfig = tinyMCEPreInit.mceInit.tutor_editor_config; |
| 201 | if ( ! tinymceConfig){ |
| 202 | tinymceConfig = tinyMCEPreInit.mceInit.course_description; |
| 203 | } |
| 204 | tinymce.init(tinymceConfig); |
| 205 | tinymce.execCommand( 'mceRemoveEditor', false, 'tutor_lesson_modal_editor' ); |
| 206 | tinyMCE.execCommand('mceAddEditor', false, "tutor_lesson_modal_editor"); |
| 207 | |
| 208 | $(document).trigger('lesson_modal_loaded', {lesson_id : lesson_id, topic_id : topic_id, course_id : course_id}); |
| 209 | }, |
| 210 | complete: function () { |
| 211 | quicktags({id : "tutor_lesson_modal_editor"}); |
| 212 | $that.removeClass('tutor-updating-message'); |
| 213 | } |
| 214 | }); |
| 215 | }); |
| 216 | |
| 217 | /** |
| 218 | * Lesson upload thumbnail |
| 219 | */ |
| 220 | $(document).on( 'click', '.lesson_thumbnail_upload_btn', function( event ){ |
| 221 | event.preventDefault(); |
| 222 | var $that = $(this); |
| 223 | var frame; |
| 224 | if ( frame ) { |
| 225 | frame.open(); |
| 226 | return; |
| 227 | } |
| 228 | frame = wp.media({ |
| 229 | title: 'Select or Upload Media Of Your Chosen Persuasion', |
| 230 | button: { |
| 231 | text: 'Use this media' |
| 232 | }, |
| 233 | multiple: false |
| 234 | }); |
| 235 | frame.on( 'select', function() { |
| 236 | var attachment = frame.state().get('selection').first().toJSON(); |
| 237 | $that.closest('.tutor-thumbnail-wrap').find('.thumbnail-img').html('<img src="'+attachment.url+'" alt="" />'); |
| 238 | $that.closest('.tutor-thumbnail-wrap').find('input').val(attachment.id); |
| 239 | }); |
| 240 | frame.open(); |
| 241 | }); |
| 242 | |
| 243 | /** |
| 244 | * Delete Lesson from course builder |
| 245 | */ |
| 246 | $(document).on('click', '.tutor-delete-lesson-btn', function(e){ |
| 247 | e.preventDefault(); |
| 248 | |
| 249 | if( ! confirm('Are you sure?')){ |
| 250 | return; |
| 251 | } |
| 252 | |
| 253 | var $that = $(this); |
| 254 | var lesson_id = $that.attr('data-lesson-id'); |
| 255 | |
| 256 | $.ajax({ |
| 257 | url : ajaxurl, |
| 258 | type : 'POST', |
| 259 | data : {lesson_id : lesson_id, action: 'tutor_delete_lesson_by_id'}, |
| 260 | beforeSend: function () { |
| 261 | $that.addClass('tutor-updating-message'); |
| 262 | }, |
| 263 | success: function (data) { |
| 264 | if (data.success){ |
| 265 | $that.closest('.course-content-item').remove(); |
| 266 | } |
| 267 | }, |
| 268 | complete: function () { |
| 269 | $that.removeClass('tutor-updating-message'); |
| 270 | } |
| 271 | }); |
| 272 | }); |
| 273 | |
| 274 | /** |
| 275 | * Confirmation for deleting Topic |
| 276 | */ |
| 277 | $(document).on('click', '.topic-delete-btn a', function(e){ |
| 278 | var topic_id = $(this).attr('data-topic-id'); |
| 279 | |
| 280 | if ( ! confirm('Are you sure to delete?')){ |
| 281 | e.preventDefault(); |
| 282 | } |
| 283 | }); |
| 284 | |
| 285 | $(document).on('click', '.tutor-expand-all-topic', function (e) { |
| 286 | e.preventDefault(); |
| 287 | $('.tutor-topics-body').slideDown(); |
| 288 | $('.expand-collapse-wrap i').removeClass('tutor-icon-light-down').addClass('tutor-icon-light-up'); |
| 289 | }); |
| 290 | $(document).on('click', '.tutor-collapse-all-topic', function (e) { |
| 291 | e.preventDefault(); |
| 292 | $('.tutor-topics-body').slideUp(); |
| 293 | $('.expand-collapse-wrap i').removeClass('tutor-icon-light-up').addClass('tutor-icon-light-down'); |
| 294 | }); |
| 295 | $(document).on('click', '.topic-inner-title, .expand-collapse-wrap', function (e) { |
| 296 | e.preventDefault(); |
| 297 | var $that = $(this); |
| 298 | $that.closest('.tutor-topics-wrap').find('.tutor-topics-body').slideToggle(); |
| 299 | $that.closest('.tutor-topics-wrap').find('.expand-collapse-wrap i').toggleClass('tutor-icon-light-down tutor-icon-light-up'); |
| 300 | }); |
| 301 | |
| 302 | /** |
| 303 | * Create new quiz |
| 304 | */ |
| 305 | |
| 306 | $(document).on('click', '.quiz-modal-btn-first-step', function(e){ |
| 307 | e.preventDefault(); |
| 308 | |
| 309 | var $that = $(this); |
| 310 | var $quizTitle = $('[name="quiz_title"]'); |
| 311 | var quiz_title = $quizTitle.val(); |
| 312 | var quiz_description = $('[name="quiz_description"]').val(); |
| 313 | |
| 314 | if ( ! quiz_title){ |
| 315 | $quizTitle.closest('.tutor-quiz-builder-group').find('.quiz_form_msg').html('Please enter quiz title'); |
| 316 | return; |
| 317 | }else{ |
| 318 | $quizTitle.closest('.tutor-quiz-builder-group').find('.quiz_form_msg').html(''); |
| 319 | } |
| 320 | |
| 321 | var course_id = $('#post_ID').val(); |
| 322 | var topic_id = $that.closest('.tutor-modal-wrap').attr('quiz-for-post-id'); |
| 323 | |
| 324 | if ($('#tutor_quiz_builder_quiz_id').length) { |
| 325 | /** |
| 326 | * |
| 327 | * @type {jQuery} |
| 328 | * |
| 329 | * if quiz id exists, we are sending it to update quiz |
| 330 | */ |
| 331 | |
| 332 | var quiz_id = $('#tutor_quiz_builder_quiz_id').val(); |
| 333 | $.ajax({ |
| 334 | url : ajaxurl, |
| 335 | type : 'POST', |
| 336 | data : {quiz_title:quiz_title, quiz_description: quiz_description, quiz_id : quiz_id, topic_id : topic_id, action: 'tutor_quiz_builder_quiz_update'}, |
| 337 | beforeSend: function () { |
| 338 | $that.addClass('tutor-updating-message'); |
| 339 | }, |
| 340 | success: function (data) { |
| 341 | $('#tutor-quiz-'+quiz_id).html(data.data.output_quiz_row); |
| 342 | $('#tutor-quiz-modal-tab-items-wrap a[href="#quiz-builder-tab-questions"]').trigger('click'); |
| 343 | |
| 344 | tutor_slider_init(); |
| 345 | }, |
| 346 | complete: function () { |
| 347 | $that.removeClass('tutor-updating-message'); |
| 348 | } |
| 349 | }); |
| 350 | |
| 351 | return; |
| 352 | } |
| 353 | |
| 354 | $.ajax({ |
| 355 | url : ajaxurl, |
| 356 | type : 'POST', |
| 357 | data : {quiz_title:quiz_title, quiz_description: quiz_description, course_id : course_id, topic_id : topic_id, action: 'tutor_create_quiz_and_load_modal'}, |
| 358 | beforeSend: function () { |
| 359 | $that.addClass('tutor-updating-message'); |
| 360 | }, |
| 361 | success: function (data) { |
| 362 | $('.tutor-quiz-builder-modal-wrap .modal-container').html(data.data.output); |
| 363 | $('#tutor-topics-'+topic_id+' .tutor-lessons').append(data.data.output_quiz_row); |
| 364 | $('#tutor-quiz-modal-tab-items-wrap a[href="#quiz-builder-tab-questions"]').trigger('click'); |
| 365 | |
| 366 | tutor_slider_init(); |
| 367 | |
| 368 | $(document).trigger('quiz_modal_loaded', {topic_id : topic_id, course_id : course_id}); |
| 369 | }, |
| 370 | complete: function () { |
| 371 | $that.removeClass('tutor-updating-message'); |
| 372 | } |
| 373 | }); |
| 374 | |
| 375 | }); |
| 376 | |
| 377 | |
| 378 | /** |
| 379 | * Ope modal for edit quiz |
| 380 | */ |
| 381 | $(document).on('click', '.open-tutor-quiz-modal', function(e){ |
| 382 | e.preventDefault(); |
| 383 | |
| 384 | var $that = $(this); |
| 385 | var quiz_id = $that.attr('data-quiz-id'); |
| 386 | var topic_id = $that.attr('data-topic-id'); |
| 387 | var course_id = $('#post_ID').val(); |
| 388 | |
| 389 | $.ajax({ |
| 390 | url : ajaxurl, |
| 391 | type : 'POST', |
| 392 | data : {quiz_id : quiz_id, topic_id : topic_id, course_id : course_id, action: 'tutor_load_edit_quiz_modal'}, |
| 393 | beforeSend: function () { |
| 394 | $that.addClass('tutor-updating-message'); |
| 395 | }, |
| 396 | success: function (data) { |
| 397 | $('.tutor-quiz-builder-modal-wrap .modal-container').html(data.data.output); |
| 398 | $('.tutor-quiz-builder-modal-wrap').attr('data-quiz-id', quiz_id).addClass('show'); |
| 399 | |
| 400 | //Back to question Tab if exists |
| 401 | if ($that.attr('data-back-to-tab')){ |
| 402 | var tabSelector = $that.attr('data-back-to-tab'); |
| 403 | $('#tutor-quiz-modal-tab-items-wrap a[href="'+tabSelector+'"]').trigger('click'); |
| 404 | } |
| 405 | |
| 406 | $(document).trigger('quiz_modal_loaded', {quiz_id : quiz_id, topic_id : topic_id, course_id : course_id}); |
| 407 | |
| 408 | tutor_slider_init(); |
| 409 | enable_quiz_questions_sorting(); |
| 410 | }, |
| 411 | complete: function () { |
| 412 | $that.removeClass('tutor-updating-message'); |
| 413 | } |
| 414 | }); |
| 415 | }); |
| 416 | |
| 417 | $(document).on('click', '.quiz-modal-settings-save-btn', function(e){ |
| 418 | e.preventDefault(); |
| 419 | |
| 420 | var $that = $(this); |
| 421 | var quiz_id = $('.tutor-quiz-builder-modal-wrap').attr('data-quiz-id'); |
| 422 | |
| 423 | var $formInput = $('#quiz-builder-tab-settings :input, #quiz-builder-tab-advanced-options :input').serialize()+'&quiz_id='+quiz_id+'&action=tutor_quiz_modal_update_settings'; |
| 424 | |
| 425 | $.ajax({ |
| 426 | url : ajaxurl, |
| 427 | type : 'POST', |
| 428 | data : $formInput, |
| 429 | beforeSend: function () { |
| 430 | $that.addClass('tutor-updating-message'); |
| 431 | }, |
| 432 | success: function (data) { |
| 433 | // |
| 434 | }, |
| 435 | complete: function () { |
| 436 | $that.removeClass('tutor-updating-message'); |
| 437 | if ($that.attr('data-action') === 'modal_close'){ |
| 438 | $('.tutor-modal-wrap').removeClass('show'); |
| 439 | } |
| 440 | } |
| 441 | }); |
| 442 | }); |
| 443 | |
| 444 | |
| 445 | /** |
| 446 | * Quiz Question edit save and continue |
| 447 | */ |
| 448 | $(document).on('click', '.quiz-modal-question-save-btn', function(e){ |
| 449 | e.preventDefault(); |
| 450 | |
| 451 | var $that = $(this); |
| 452 | var $formInput = $('.quiz_question_form :input').serialize()+'&action=tutor_quiz_modal_update_question'; |
| 453 | $.ajax({ |
| 454 | url : ajaxurl, |
| 455 | type : 'POST', |
| 456 | data : $formInput, |
| 457 | beforeSend: function () { |
| 458 | $that.addClass('tutor-updating-message'); |
| 459 | }, |
| 460 | success: function (data) { |
| 461 | if (data.success){ |
| 462 | //ReOpen questions |
| 463 | $that.closest('.tutor-quiz-builder-modal-contents').find('.open-tutor-quiz-modal').trigger('click'); |
| 464 | }else{ |
| 465 | if (typeof data.data !== 'undefined') { |
| 466 | $('#quiz_validation_msg_wrap').html(data.data.validation_msg); |
| 467 | } |
| 468 | } |
| 469 | }, |
| 470 | complete: function () { |
| 471 | $that.removeClass('tutor-updating-message'); |
| 472 | } |
| 473 | }); |
| 474 | }); |
| 475 | |
| 476 | /** |
| 477 | * Sort quiz questions |
| 478 | */ |
| 479 | function enable_quiz_questions_sorting(){ |
| 480 | if (jQuery().sortable) { |
| 481 | $(".quiz-builder-questions-wrap").sortable({ |
| 482 | handle: ".question-sorting", |
| 483 | start: function (e, ui) { |
| 484 | ui.placeholder.css('visibility', 'visible'); |
| 485 | }, |
| 486 | stop: function (e, ui) { |
| 487 | tutor_save_sorting_quiz_questions_order(); |
| 488 | }, |
| 489 | }); |
| 490 | } |
| 491 | } |
| 492 | |
| 493 | function tutor_save_sorting_quiz_questions_order(){ |
| 494 | var questions = {}; |
| 495 | $('.quiz-builder-question-wrap').each(function(index, item){ |
| 496 | var $question = $(this); |
| 497 | var question_id = parseInt($question.attr('data-question-id'), 10); |
| 498 | questions[index] = question_id; |
| 499 | }); |
| 500 | |
| 501 | $.ajax({url : ajaxurl, type : 'POST', |
| 502 | data : {sorted_question_ids : questions, action: 'tutor_quiz_question_sorting'}, |
| 503 | }); |
| 504 | } |
| 505 | |
| 506 | /** |
| 507 | * Quiz Modal |
| 508 | */ |
| 509 | |
| 510 | $(document).on('click', '.modal-close-btn', function(e){ |
| 511 | e.preventDefault(); |
| 512 | $('.tutor-modal-wrap').removeClass('show'); |
| 513 | }); |
| 514 | $(document).on('keyup', function(e){ |
| 515 | if (e.keyCode === 27){ |
| 516 | $('.tutor-modal-wrap').removeClass('show'); |
| 517 | } |
| 518 | }); |
| 519 | |
| 520 | $(document).on('click', '.tutor-add-quiz-btn', function(e){ |
| 521 | e.preventDefault(); |
| 522 | |
| 523 | var $that = $(this); |
| 524 | var quiz_for_post_id = $(this).closest('.tutor_add_quiz_wrap').attr('data-add-quiz-under'); |
| 525 | $.ajax({ |
| 526 | url : ajaxurl, |
| 527 | type : 'POST', |
| 528 | data : {quiz_for_post_id : quiz_for_post_id, action: 'tutor_load_quiz_builder_modal'}, |
| 529 | beforeSend: function () { |
| 530 | $that.addClass('tutor-updating-message'); |
| 531 | }, |
| 532 | success: function (data) { |
| 533 | $('.tutor-quiz-builder-modal-wrap .modal-container').html(data.data.output); |
| 534 | $('.tutor-quiz-builder-modal-wrap').attr('quiz-for-post-id', quiz_for_post_id).addClass('show'); |
| 535 | }, |
| 536 | complete: function () { |
| 537 | $that.removeClass('tutor-updating-message'); |
| 538 | } |
| 539 | }); |
| 540 | }); |
| 541 | |
| 542 | |
| 543 | /** |
| 544 | * Quiz Builder Modal Tabs |
| 545 | */ |
| 546 | $(document).on('click', '.tutor-quiz-modal-tab-item', function(e){ |
| 547 | e.preventDefault(); |
| 548 | |
| 549 | var $that = $(this); |
| 550 | |
| 551 | var $quizTitle = $('[name="quiz_title"]'); |
| 552 | var quiz_title = $quizTitle.val(); |
| 553 | if ( ! quiz_title){ |
| 554 | $quizTitle.closest('.tutor-quiz-builder-form-row').find('.quiz_form_msg').html('<p class="quiz-form-warning">Please save the quiz' + |
| 555 | ' first</p>'); |
| 556 | return; |
| 557 | }else{ |
| 558 | $quizTitle.closest('.tutor-quiz-builder-form-row').find('.quiz_form_msg').html(''); |
| 559 | } |
| 560 | |
| 561 | var tabSelector = $that.attr('href'); |
| 562 | $('.quiz-builder-tab-container').hide(); |
| 563 | $(tabSelector).show(); |
| 564 | |
| 565 | $('a.tutor-quiz-modal-tab-item').removeClass('active'); |
| 566 | $that.addClass('active'); |
| 567 | }); |
| 568 | |
| 569 | //Next Prev Tab |
| 570 | $(document).on('click', '.quiz-modal-btn-next, .quiz-modal-btn-back', function(e){ |
| 571 | e.preventDefault(); |
| 572 | |
| 573 | var tabSelector = $(this).attr('href'); |
| 574 | $('#tutor-quiz-modal-tab-items-wrap a[href="'+tabSelector+'"]').trigger('click'); |
| 575 | }); |
| 576 | |
| 577 | $(document).on('click', '.quiz-modal-tab-navigation-btn.quiz-modal-btn-cancel', function(e){ |
| 578 | e.preventDefault(); |
| 579 | $('.tutor-modal-wrap').removeClass('show'); |
| 580 | }); |
| 581 | |
| 582 | /** |
| 583 | * Add Question to quiz modal |
| 584 | */ |
| 585 | $(document).on('click', '.tutor-quiz-open-question-form', function(e){ |
| 586 | e.preventDefault(); |
| 587 | |
| 588 | var $that = $(this); |
| 589 | |
| 590 | var quiz_id = $('#tutor_quiz_builder_quiz_id').val(); |
| 591 | var course_id = $('#post_ID').val(); |
| 592 | var question_id = $that.attr('data-question-id'); |
| 593 | |
| 594 | |
| 595 | var params = {quiz_id : quiz_id, course_id : course_id, action: 'tutor_quiz_builder_get_question_form'}; |
| 596 | |
| 597 | if (question_id) { |
| 598 | params.question_id = question_id; |
| 599 | } |
| 600 | |
| 601 | $.ajax({ |
| 602 | url : ajaxurl, |
| 603 | type : 'POST', |
| 604 | data : params, |
| 605 | beforeSend: function () { |
| 606 | $that.addClass('tutor-updating-message'); |
| 607 | }, |
| 608 | success: function (data) { |
| 609 | $('.tutor-quiz-builder-modal-contents').html(data.data.output); |
| 610 | |
| 611 | //Initializing Tutor Select |
| 612 | tutor_select().reInit(); |
| 613 | enable_quiz_answer_sorting(); |
| 614 | }, |
| 615 | complete: function () { |
| 616 | $that.removeClass('tutor-updating-message'); |
| 617 | } |
| 618 | }); |
| 619 | |
| 620 | }); |
| 621 | |
| 622 | $(document).on('click', '.tutor-quiz-question-trash', function(e){ |
| 623 | e.preventDefault(); |
| 624 | |
| 625 | var $that = $(this); |
| 626 | var question_id = $that.attr('data-question-id'); |
| 627 | |
| 628 | $.ajax({ |
| 629 | url : ajaxurl, |
| 630 | type : 'POST', |
| 631 | data : {question_id : question_id, action: 'tutor_quiz_builder_question_delete'}, |
| 632 | beforeSend: function () { |
| 633 | $that.closest('.quiz-builder-question-wrap').remove(); |
| 634 | }, |
| 635 | }); |
| 636 | }); |
| 637 | |
| 638 | /** |
| 639 | * Get question answers option form to save multiple/single/true-false options |
| 640 | * |
| 641 | * @since v.1.0.0 |
| 642 | */ |
| 643 | |
| 644 | $(document).on('click', '.add_question_answers_option', function(e){ |
| 645 | e.preventDefault(); |
| 646 | |
| 647 | var $that = $(this); |
| 648 | var question_id = $that.attr('data-question-id'); |
| 649 | var $formInput = $('.quiz_question_form :input').serialize()+'&question_id='+question_id+'&action=tutor_quiz_add_question_answers'; |
| 650 | |
| 651 | $.ajax({ |
| 652 | url : ajaxurl, |
| 653 | type : 'POST', |
| 654 | data : $formInput, |
| 655 | beforeSend: function () { |
| 656 | $that.addClass('tutor-updating-message'); |
| 657 | }, |
| 658 | success: function (data) { |
| 659 | $('#tutor_quiz_question_answer_form').html(data.data.output); |
| 660 | }, |
| 661 | complete: function () { |
| 662 | $that.removeClass('tutor-updating-message'); |
| 663 | } |
| 664 | }); |
| 665 | }); |
| 666 | |
| 667 | /** |
| 668 | * Get question answers option edit form |
| 669 | * |
| 670 | * @since v.1.0.0 |
| 671 | */ |
| 672 | $(document).on('click', '.tutor-quiz-answer-edit a', function(e){ |
| 673 | e.preventDefault(); |
| 674 | |
| 675 | var $that = $(this); |
| 676 | var answer_id = $that.closest('.tutor-quiz-answer-wrap').attr('data-answer-id'); |
| 677 | |
| 678 | $.ajax({ |
| 679 | url : ajaxurl, |
| 680 | type : 'POST', |
| 681 | data : {answer_id : answer_id, action : 'tutor_quiz_edit_question_answer'}, |
| 682 | beforeSend: function () { |
| 683 | $that.addClass('tutor-updating-message'); |
| 684 | }, |
| 685 | success: function (data) { |
| 686 | $('#tutor_quiz_question_answer_form').html(data.data.output); |
| 687 | }, |
| 688 | complete: function () { |
| 689 | $that.removeClass('tutor-updating-message'); |
| 690 | } |
| 691 | }); |
| 692 | }); |
| 693 | |
| 694 | /** |
| 695 | * Saving question answers options |
| 696 | * Student should select the right answer at quiz attempts |
| 697 | * |
| 698 | * @since v.1.0.0 |
| 699 | */ |
| 700 | |
| 701 | $(document).on('click', '#quiz-answer-save-btn', function(e){ |
| 702 | e.preventDefault(); |
| 703 | |
| 704 | var $that = $(this); |
| 705 | var $formInput = $('.quiz_question_form :input').serialize()+'&action=tutor_save_quiz_answer_options'; |
| 706 | |
| 707 | $.ajax({ |
| 708 | url : ajaxurl, |
| 709 | type : 'POST', |
| 710 | data : $formInput, |
| 711 | beforeSend: function () { |
| 712 | $('#quiz_validation_msg_wrap').html(""); |
| 713 | $that.addClass('tutor-updating-message'); |
| 714 | }, |
| 715 | success: function (data) { |
| 716 | $('#tutor_quiz_question_answers').trigger('refresh'); |
| 717 | }, |
| 718 | complete: function () { |
| 719 | $that.removeClass('tutor-updating-message'); |
| 720 | } |
| 721 | }); |
| 722 | }); |
| 723 | |
| 724 | /** |
| 725 | * Updating Answer |
| 726 | * |
| 727 | * @since v.1.0.0 |
| 728 | */ |
| 729 | $(document).on('click', '#quiz-answer-edit-btn', function(e){ |
| 730 | e.preventDefault(); |
| 731 | |
| 732 | var $that = $(this); |
| 733 | var $formInput = $('.quiz_question_form :input').serialize()+'&action=tutor_update_quiz_answer_options'; |
| 734 | |
| 735 | $.ajax({ |
| 736 | url : ajaxurl, |
| 737 | type : 'POST', |
| 738 | data : $formInput, |
| 739 | beforeSend: function () { |
| 740 | $that.addClass('tutor-updating-message'); |
| 741 | }, |
| 742 | success: function (data) { |
| 743 | $('#tutor_quiz_question_answers').trigger('refresh'); |
| 744 | }, |
| 745 | complete: function () { |
| 746 | $that.removeClass('tutor-updating-message'); |
| 747 | } |
| 748 | }); |
| 749 | }); |
| 750 | |
| 751 | $(document).on('change', '.tutor-quiz-answers-mark-correct-wrap input', function(e){ |
| 752 | e.preventDefault(); |
| 753 | |
| 754 | var $that = $(this); |
| 755 | |
| 756 | var answer_id = $that.val(); |
| 757 | var inputValue = 1; |
| 758 | if ( ! $that.prop('checked')) { |
| 759 | inputValue = 0; |
| 760 | } |
| 761 | |
| 762 | $.ajax({ |
| 763 | url : ajaxurl, |
| 764 | type : 'POST', |
| 765 | data : {answer_id:answer_id, inputValue : inputValue, action : 'tutor_mark_answer_as_correct'}, |
| 766 | }); |
| 767 | }); |
| 768 | |
| 769 | |
| 770 | $(document).on('refresh', '#tutor_quiz_question_answers', function(e){ |
| 771 | e.preventDefault(); |
| 772 | |
| 773 | var $that = $(this); |
| 774 | var question_id = $that.attr('data-question-id'); |
| 775 | var question_type = $('.tutor_select_value_holder').val(); |
| 776 | |
| 777 | $.ajax({ |
| 778 | url : ajaxurl, |
| 779 | type : 'POST', |
| 780 | data : {question_id : question_id, question_type : question_type, action: 'tutor_quiz_builder_get_answers_by_question'}, |
| 781 | beforeSend: function () { |
| 782 | $that.addClass('tutor-updating-message'); |
| 783 | $('#tutor_quiz_question_answer_form').html(''); |
| 784 | }, |
| 785 | success: function (data) { |
| 786 | if (data.success){ |
| 787 | $that.html(data.data.output); |
| 788 | } |
| 789 | }, |
| 790 | complete: function () { |
| 791 | $that.removeClass('tutor-updating-message'); |
| 792 | } |
| 793 | }); |
| 794 | }); |
| 795 | |
| 796 | |
| 797 | |
| 798 | /** |
| 799 | * Delete answer for a question in quiz builder |
| 800 | * |
| 801 | * @since v.1.0.0 |
| 802 | */ |
| 803 | |
| 804 | $(document).on('click', '.tutor-quiz-answer-trash-wrap a.answer-trash-btn', function(e){ |
| 805 | e.preventDefault(); |
| 806 | |
| 807 | var $that = $(this); |
| 808 | var answer_id = $that.attr('data-answer-id'); |
| 809 | |
| 810 | $.ajax({ |
| 811 | url : ajaxurl, |
| 812 | type : 'POST', |
| 813 | data : {answer_id : answer_id, action: 'tutor_quiz_builder_delete_answer'}, |
| 814 | beforeSend: function () { |
| 815 | $that.closest('.tutor-quiz-answer-wrap').remove(); |
| 816 | }, |
| 817 | }); |
| 818 | }); |
| 819 | |
| 820 | |
| 821 | /** |
| 822 | * Delete Quiz |
| 823 | * @since v.1.0.0 |
| 824 | */ |
| 825 | |
| 826 | $(document).on('click', '.tutor-delete-quiz-btn', function(e){ |
| 827 | e.preventDefault(); |
| 828 | |
| 829 | if( ! confirm('Are you sure?')){ |
| 830 | return; |
| 831 | } |
| 832 | |
| 833 | var $that = $(this); |
| 834 | var quiz_id = $that.attr('data-quiz-id'); |
| 835 | |
| 836 | $.ajax({ |
| 837 | url : ajaxurl, |
| 838 | type : 'POST', |
| 839 | data : {quiz_id : quiz_id, action: 'tutor_delete_quiz_by_id'}, |
| 840 | beforeSend: function () { |
| 841 | $that.closest('.course-content-item').remove(); |
| 842 | } |
| 843 | }); |
| 844 | }); |
| 845 | |
| 846 | /** |
| 847 | * Save answer sorting placement |
| 848 | * |
| 849 | * @since v.1.0.0 |
| 850 | */ |
| 851 | function enable_quiz_answer_sorting(){ |
| 852 | if (jQuery().sortable) { |
| 853 | $("#tutor_quiz_question_answers").sortable({ |
| 854 | handle: ".tutor-quiz-answer-sort-icon", |
| 855 | start: function (e, ui) { |
| 856 | ui.placeholder.css('visibility', 'visible'); |
| 857 | }, |
| 858 | stop: function (e, ui) { |
| 859 | tutor_save_sorting_quiz_answer_order(); |
| 860 | }, |
| 861 | }); |
| 862 | } |
| 863 | } |
| 864 | function tutor_save_sorting_quiz_answer_order(){ |
| 865 | var answers = {}; |
| 866 | $('.tutor-quiz-answer-wrap').each(function(index, item){ |
| 867 | var $answer = $(this); |
| 868 | var answer_id = parseInt($answer.attr('data-answer-id'), 10); |
| 869 | answers[index] = answer_id; |
| 870 | }); |
| 871 | |
| 872 | $.ajax({url : ajaxurl, type : 'POST', |
| 873 | data : {sorted_answer_ids : answers, action: 'tutor_quiz_answer_sorting'}, |
| 874 | }); |
| 875 | } |
| 876 | |
| 877 | |
| 878 | /** |
| 879 | * Tutor Custom Select |
| 880 | */ |
| 881 | |
| 882 | function tutor_select(){ |
| 883 | var obj = { |
| 884 | init : function(){ |
| 885 | $(document).on('click', '.tutor-select .tutor-select-option', function(e){ |
| 886 | e.preventDefault(); |
| 887 | |
| 888 | var $that = $(this); |
| 889 | if ($that.attr('data-is-pro') !== 'true') { |
| 890 | var $html = $that.html().trim(); |
| 891 | $that.closest('.tutor-select').find('.select-header .lead-option').html($html); |
| 892 | $that.closest('.tutor-select').find('.select-header input.tutor_select_value_holder').val($that.attr('data-value')).trigger('change'); |
| 893 | $that.closest('.tutor-select-options').hide(); |
| 894 | }else{ |
| 895 | alert('Tutor Pro version required'); |
| 896 | } |
| 897 | }); |
| 898 | $(document).on('click', '.tutor-select .select-header', function(e){ |
| 899 | e.preventDefault(); |
| 900 | |
| 901 | var $that = $(this); |
| 902 | $that.closest('.tutor-select').find('.tutor-select-options').slideToggle(); |
| 903 | }); |
| 904 | |
| 905 | this.setValue(); |
| 906 | this.hideOnOutSideClick(); |
| 907 | }, |
| 908 | setValue : function(){ |
| 909 | $('.tutor-select').each(function(){ |
| 910 | var $that = $(this); |
| 911 | var $option = $that.find('.tutor-select-option'); |
| 912 | |
| 913 | if ($option.length){ |
| 914 | $option.each(function(){ |
| 915 | var $thisOption = $(this); |
| 916 | |
| 917 | if ($thisOption.attr('data-selected') === 'selected'){ |
| 918 | var $html = $thisOption.html().trim(); |
| 919 | $thisOption.closest('.tutor-select').find('.select-header .lead-option').html($html); |
| 920 | $thisOption.closest('.tutor-select').find('.select-header input.tutor_select_value_holder').val($thisOption.attr('data-value')); |
| 921 | } |
| 922 | }); |
| 923 | } |
| 924 | }); |
| 925 | }, |
| 926 | hideOnOutSideClick : function(){ |
| 927 | $(document).mouseup(function(e) { |
| 928 | var $option_wrap = $(".tutor-select-options"); |
| 929 | if ( ! $(e.target).closest('.select-header').length && !$option_wrap.is(e.target) && $option_wrap.has(e.target).length === 0) { |
| 930 | $option_wrap.hide(); |
| 931 | } |
| 932 | }); |
| 933 | }, |
| 934 | reInit : function(){ |
| 935 | this.setValue(); |
| 936 | } |
| 937 | }; |
| 938 | |
| 939 | return obj; |
| 940 | } |
| 941 | tutor_select().init(); |
| 942 | |
| 943 | |
| 944 | /** |
| 945 | * If change question type from quiz builder question |
| 946 | * |
| 947 | * @since v.1.0.0 |
| 948 | */ |
| 949 | $(document).on('change', 'input.tutor_select_value_holder', function(e) { |
| 950 | var $that = $(this); |
| 951 | //$('#tutor_quiz_question_answer_form').html(''); |
| 952 | $('.add_question_answers_option').trigger('click'); |
| 953 | $('#tutor_quiz_question_answers').trigger('refresh'); |
| 954 | }); |
| 955 | |
| 956 | $(document).on('click', '.tutor-media-upload-btn', function(e){ |
| 957 | e.preventDefault(); |
| 958 | |
| 959 | var $that = $(this); |
| 960 | var frame; |
| 961 | if ( frame ) { |
| 962 | frame.open(); |
| 963 | return; |
| 964 | } |
| 965 | frame = wp.media({ |
| 966 | title: 'Select or Upload Media Of Your Chosen Persuasion', |
| 967 | button: { |
| 968 | text: 'Use this media' |
| 969 | }, |
| 970 | multiple: false |
| 971 | }); |
| 972 | frame.on( 'select', function() { |
| 973 | var attachment = frame.state().get('selection').first().toJSON(); |
| 974 | $that.html('<img src="'+attachment.url+'" alt="" />'); |
| 975 | $that.closest('.tutor-media-upload-wrap').find('input').val(attachment.id); |
| 976 | }); |
| 977 | frame.open(); |
| 978 | }); |
| 979 | $(document).on('click', '.tutor-media-upload-trash', function(e){ |
| 980 | e.preventDefault(); |
| 981 | |
| 982 | var $that = $(this); |
| 983 | $that.closest('.tutor-media-upload-wrap').find('.tutor-media-upload-btn').html('<i class="tutor-icon-image1"></i>'); |
| 984 | $that.closest('.tutor-media-upload-wrap').find('input').val(''); |
| 985 | }); |
| 986 | |
| 987 | |
| 988 | /** |
| 989 | * Add instructor modal |
| 990 | */ |
| 991 | $(document).on('click', '.tutor-add-instructor-btn', function(e){ |
| 992 | e.preventDefault(); |
| 993 | |
| 994 | var $that = $(this); |
| 995 | var course_id = $('#post_ID').val(); |
| 996 | |
| 997 | $.ajax({ |
| 998 | url : ajaxurl, |
| 999 | type : 'POST', |
| 1000 | data : {course_id : course_id, action: 'tutor_load_instructors_modal'}, |
| 1001 | beforeSend: function () { |
| 1002 | $that.addClass('tutor-updating-message'); |
| 1003 | }, |
| 1004 | success: function (data) { |
| 1005 | if (data.success){ |
| 1006 | $('.tutor-instructors-modal-wrap .modal-container').html(data.data.output); |
| 1007 | $('.tutor-instructors-modal-wrap').addClass('show'); |
| 1008 | } |
| 1009 | }, |
| 1010 | complete: function () { |
| 1011 | $that.removeClass('tutor-updating-message'); |
| 1012 | } |
| 1013 | }); |
| 1014 | }); |
| 1015 | |
| 1016 | $(document).on('change keyup', '.tutor-instructors-modal-wrap .tutor-modal-search-input', function(e){ |
| 1017 | e.preventDefault(); |
| 1018 | |
| 1019 | var $that = $(this); |
| 1020 | var $modal = $('.tutor-modal-wrap'); |
| 1021 | |
| 1022 | tutor_delay(function(){ |
| 1023 | var search_terms = $that.val(); |
| 1024 | var course_id = $('#post_ID').val(); |
| 1025 | |
| 1026 | $.ajax({ |
| 1027 | url : ajaxurl, |
| 1028 | type : 'POST', |
| 1029 | data : {course_id : course_id, search_terms : search_terms, action: 'tutor_load_instructors_modal'}, |
| 1030 | beforeSend: function () { |
| 1031 | $modal.addClass('loading'); |
| 1032 | }, |
| 1033 | success: function (data) { |
| 1034 | if (data.success){ |
| 1035 | $('.tutor-instructors-modal-wrap .modal-container').html(data.data.output); |
| 1036 | $('.tutor-instructors-modal-wrap').addClass('show'); |
| 1037 | } |
| 1038 | }, |
| 1039 | complete: function () { |
| 1040 | $modal.removeClass('loading'); |
| 1041 | } |
| 1042 | }); |
| 1043 | |
| 1044 | }, 1000) |
| 1045 | }); |
| 1046 | $(document).on('click', '.add_instructor_to_course_btn', function(e){ |
| 1047 | e.preventDefault(); |
| 1048 | |
| 1049 | var $that = $(this); |
| 1050 | var $modal = $('.tutor-modal-wrap'); |
| 1051 | var course_id = $('#post_ID').val(); |
| 1052 | var data = $modal.find('input').serialize()+'&course_id='+course_id+'&action=tutor_add_instructors_to_course'; |
| 1053 | |
| 1054 | $.ajax({ |
| 1055 | url : ajaxurl, |
| 1056 | type : 'POST', |
| 1057 | data : data, |
| 1058 | beforeSend: function () { |
| 1059 | $that.addClass('tutor-updating-message'); |
| 1060 | }, |
| 1061 | success: function (data) { |
| 1062 | if (data.success){ |
| 1063 | $('.tutor-course-available-instructors').html(data.data.output); |
| 1064 | $('.tutor-modal-wrap').removeClass('show'); |
| 1065 | } |
| 1066 | }, |
| 1067 | complete: function () { |
| 1068 | $that.removeClass('tutor-updating-message'); |
| 1069 | } |
| 1070 | }); |
| 1071 | }); |
| 1072 | |
| 1073 | $(document).on('click', '.tutor-instructor-delete-btn', function(e){ |
| 1074 | e.preventDefault(); |
| 1075 | |
| 1076 | var $that = $(this); |
| 1077 | var course_id = $('#post_ID').val(); |
| 1078 | var instructor_id = $that.closest('.added-instructor-item').attr('data-instructor-id'); |
| 1079 | |
| 1080 | $.ajax({ |
| 1081 | url : ajaxurl, |
| 1082 | type : 'POST', |
| 1083 | data : {course_id:course_id, instructor_id:instructor_id, action : 'detach_instructor_from_course'}, |
| 1084 | success: function (data) { |
| 1085 | if (data.success){ |
| 1086 | $that.closest('.added-instructor-item').remove(); |
| 1087 | } |
| 1088 | } |
| 1089 | }); |
| 1090 | }); |
| 1091 | |
| 1092 | $(document).on('click', '.settings-tabs-navs li', function(e){ |
| 1093 | e.preventDefault(); |
| 1094 | |
| 1095 | var $that = $(this); |
| 1096 | var data_target = $that.find('a').attr('data-target'); |
| 1097 | var url = $that.find('a').attr('href'); |
| 1098 | |
| 1099 | $that.addClass('active').siblings('li.active').removeClass('active'); |
| 1100 | $('.settings-tab-wrap').removeClass('active').hide().siblings(data_target).addClass('active').show(); |
| 1101 | |
| 1102 | window.history.pushState({}, '', url); |
| 1103 | }); |
| 1104 | |
| 1105 | /** |
| 1106 | * Re init required |
| 1107 | * Modal Loaded... |
| 1108 | */ |
| 1109 | |
| 1110 | $(document).on('lesson_modal_loaded quiz_modal_loaded assignment_modal_loaded', function(e, obj){ |
| 1111 | if (jQuery().select2){ |
| 1112 | $('.select2_multiselect').select2({ |
| 1113 | dropdownCssClass:'increasezindex' |
| 1114 | }); |
| 1115 | } |
| 1116 | if (jQuery.datepicker){ |
| 1117 | $( ".tutor_date_picker" ).datepicker({"dateFormat" : 'yy-mm-dd'}); |
| 1118 | } |
| 1119 | }); |
| 1120 | $(document).on('lesson_modal_loaded', function(e, obj){ |
| 1121 | $('.tutor-lesson-modal-wrap .modal-title h1').html('Lesson'); |
| 1122 | }); |
| 1123 | $(document).on('assignment_modal_loaded', function(e, obj){ |
| 1124 | $('.tutor-lesson-modal-wrap .modal-title h1').html('Assignment'); |
| 1125 | }); |
| 1126 | |
| 1127 | }); |