summaryrefslogtreecommitdiff
path: root/yaksh/static
diff options
context:
space:
mode:
authoradityacp2020-09-15 13:50:24 +0530
committeradityacp2020-09-15 13:50:24 +0530
commita9a8f286767468a55709215fbe584157f32a7300 (patch)
tree7411a6b6da257a3eb692c55e0f099c093c374cc4 /yaksh/static
parent98908b86a94da4a2552564e057457c48b46d4ac3 (diff)
downloadonline_test-a9a8f286767468a55709215fbe584157f32a7300.tar.gz
online_test-a9a8f286767468a55709215fbe584157f32a7300.tar.bz2
online_test-a9a8f286767468a55709215fbe584157f32a7300.zip
Change multiple sections
- Show lesson topic description as per the video time - Fix description preview for module and lesson - Order table of contents by time
Diffstat (limited to 'yaksh/static')
-rw-r--r--yaksh/static/yaksh/css/custom.css13
-rw-r--r--yaksh/static/yaksh/js/lesson.js12
-rw-r--r--yaksh/static/yaksh/js/show_toc.js21
3 files changed, 30 insertions, 16 deletions
diff --git a/yaksh/static/yaksh/css/custom.css b/yaksh/static/yaksh/css/custom.css
index 9f29349..26efbed 100644
--- a/yaksh/static/yaksh/css/custom.css
+++ b/yaksh/static/yaksh/css/custom.css
@@ -132,19 +132,6 @@ body, .dropdown-menu {
border: none;
}
-/* Simple MDE editor style */
-.editor-toolbar.fullscreen, .editor-preview-side {
- z-index: 2000 !important;
-}
-.CodeMirror, .CodeMirror-scroll {
- max-height: 400px !important;
-}
-.CodeMirror-fullscreen.CodeMirror {
- max-height: none !important;
-}
-.CodeMirror-fullscreen .CodeMirror-scroll {
- max-height: none !important;
-}
::-webkit-scrollbar {
width: 10px;
diff --git a/yaksh/static/yaksh/js/lesson.js b/yaksh/static/yaksh/js/lesson.js
index 60eff78..2cc2e62 100644
--- a/yaksh/static/yaksh/js/lesson.js
+++ b/yaksh/static/yaksh/js/lesson.js
@@ -1,7 +1,13 @@
$(document).ready(function() {
+ MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
var simplemde = new SimpleMDE({
element: document.getElementById("id_description"),
forceSync: true,
+ hideIcons: ["preview", "side-by-side", "fullscreen"]
+ });
+ simplemde.codemirror.on("change", function() {
+ MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
+ $("#description_body").html(simplemde.markdown(simplemde.value()));
});
const player = new Plyr('#player');
var timer = $("#vtimer");
@@ -34,6 +40,12 @@ $(document).ready(function() {
$("#id_type").hide();
$("#id_type").attr("required", false);
} else {
+ if(valueSelected == "4") {
+ $('#id_type option[value="mcq"]').prop("selected", true);
+ $('#id_type').attr("disabled", true);
+ } else {
+ $('#id_type').attr("disabled", false);
+ }
$("#id_type").show();
$("#id_type").attr("required", true);
}
diff --git a/yaksh/static/yaksh/js/show_toc.js b/yaksh/static/yaksh/js/show_toc.js
index 5fef923..b628eaa 100644
--- a/yaksh/static/yaksh/js/show_toc.js
+++ b/yaksh/static/yaksh/js/show_toc.js
@@ -10,9 +10,12 @@ $(document).ready(function() {
if (time_arr_length > 0 && player.currentTime >= video_time[loc]) {
var content = contents_by_time[loc];
loc += 1;
- if(content.content != 1) {
+ if(content.content == 1) {
+ show_topic($("#toc_desc_"+content.id).val(), false);
+ }
+ else {
player.pause();
- player.fullscreen.exit();
+ if(player.fullscreen.active) player.fullscreen.exit();
url = $("#toc_"+content.id).val();
ajax_call(url, "GET");
}
@@ -20,6 +23,15 @@ $(document).ready(function() {
});
});
+function show_topic(description, override) {
+ var topic_div = $("#topic-description");
+ if(override) {
+ topic_div.html(description);
+ } else {
+ topic_div.append("<br>" + description);
+ }
+}
+
function store_video_time(contents) {
for (var j = 0; j < contents.length; j++)
video_time.push(get_time_in_seconds(contents[j].time));
@@ -66,7 +78,10 @@ function select_toc(element) {
var content_type = element.getAttribute("data-toc-type");
var toc_time = $("#toc_time_"+toc_id).val();
player.currentTime = get_time_in_seconds(toc_time);
- if (content_type != 1) {
+ if (content_type == 1) {
+ show_topic($("#toc_desc_"+toc_id).val(), true);
+ }
+ else {
url = $("#toc_"+toc_id).val();
ajax_call(url, "GET");
}