| 1 |
const $ = jQuery; |
| 2 |
import { Component } from '@wordpress/element'; |
| 3 |
import { searchCourseContent } from './components/search'; |
| 4 |
import { Sidebar } from './components/sidebar'; |
| 5 |
import { progressBar } from './components/progress'; |
| 6 |
import { commentForm } from './components/comment'; |
| 7 |
import { itemsProgress } from './components/items-progress'; |
| 8 |
|
| 9 |
import './components/compatible'; |
| 10 |
|
| 11 |
class SingleCurriculums extends Component { |
| 12 |
checkCourseDurationExpire() { |
| 13 |
const elCourseItemIsBlockeds = document.getElementsByName( 'lp-course-timestamp-remaining' ); |
| 14 |
|
| 15 |
if ( elCourseItemIsBlockeds.length ) { |
| 16 |
const elCourseItemIsBlocked = elCourseItemIsBlockeds[ 0 ]; |
| 17 |
const timeDuration = elCourseItemIsBlocked.value; // value is second |
| 18 |
|
| 19 |
if ( timeDuration < ( 60 * 60 * 24 ) ) { // compare with 1 day |
| 20 |
setTimeout( |
| 21 |
function() { |
| 22 |
window.location.reload( true ); |
| 23 |
}, |
| 24 |
timeDuration * 1000 |
| 25 |
); |
| 26 |
} |
| 27 |
} |
| 28 |
} |
| 29 |
render() { |
| 30 |
return ( |
| 31 |
<div></div> |
| 32 |
); |
| 33 |
} |
| 34 |
} |
| 35 |
|
| 36 |
export default SingleCurriculums; |
| 37 |
|
| 38 |
document.addEventListener( 'DOMContentLoaded', () => { |
| 39 |
LP.Hook.doAction( 'lp-compatible-builder' ); |
| 40 |
|
| 41 |
searchCourseContent(); |
| 42 |
Sidebar(); |
| 43 |
progressBar(); |
| 44 |
//commentForm(); |
| 45 |
itemsProgress(); |
| 46 |
|
| 47 |
// Check duration expire of course |
| 48 |
const singleCurriculums = new SingleCurriculums(); |
| 49 |
singleCurriculums.checkCourseDurationExpire(); |
| 50 |
} ); |
| 51 |
|