|
|
@@ -155,49 +155,9 @@ function showHideAnswerEx(isShowYX, isShowAS) {
|
|
|
//页面加载完,原文 绑定事件
|
|
|
function bindEventTeaOrignalYS() {
|
|
|
var bodyWidth = $(document.body).width();
|
|
|
- //显示/隐藏习题答案
|
|
|
- $(".yaoshi").on("click", function () {
|
|
|
- var curDisplay = $(this).nextUntil(".yaoshi").find(".underlineContent").eq(0).css("display");
|
|
|
- if (curDisplay == "undefined" || curDisplay == undefined) return;
|
|
|
-
|
|
|
- if (curDisplay == "none" || $(this).attr("data-status") == "0") {
|
|
|
- $(this).attr("data-status", "1");
|
|
|
- $(this).attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
- //$(this).nextUntil(".yaoshi").find(".underlineContent").show();
|
|
|
- //$(this).nextUntil(".yaoshi").find(".underlineContent").css("color", "#92D050");
|
|
|
- $.each($(this).nextUntil(".yaoshi").find(".underlineContent"), function (index, item) {
|
|
|
- if (!$(item).hasClass("no-answer")) {
|
|
|
- $(item).css("color", "#92D050");
|
|
|
- }
|
|
|
- else {
|
|
|
- $(item).css("color", "#989898");
|
|
|
- }
|
|
|
-
|
|
|
- $(item).find(".wordStyle").css("color", "#db5d00");
|
|
|
- $(item).find(".phraseStyle").css("background-color", "#f2db8b");
|
|
|
- });
|
|
|
- //不再存在已隐藏的钥匙,移动端回调
|
|
|
- if ($(".yaoshi[data-status='0']").length == 0) {
|
|
|
- //添加回调
|
|
|
- console.log("全部显示了");
|
|
|
- }
|
|
|
- } else {
|
|
|
- $(this).attr("data-status", "0");
|
|
|
- $(this).attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
- //$(this).nextUntil(".yaoshi").find(".underlineContent").hide();
|
|
|
- //$(this).nextUntil(".yaoshi").find(".underlineContent").css("color", "#ffffff");
|
|
|
- $.each($(this).nextUntil(".yaoshi").filter(".underlineContent"), function (index, item) {
|
|
|
- $(item).css("color", "#ffffff");
|
|
|
- $(item).find(".wordStyle").css("color", "#ffffff");
|
|
|
- $(item).find(".phraseStyle").css("background-color", "#ffffff");
|
|
|
- });
|
|
|
- //添加回调
|
|
|
- onClickKeyHide();
|
|
|
- }
|
|
|
- });
|
|
|
//处理答题点
|
|
|
- $.each($(".underlineContent"), function (index, item) {
|
|
|
- $(item).attr("data-text", $(item).html());
|
|
|
+ $.each($(".yaoshi"), function (index, item) {
|
|
|
+ $(item).attr('answer-id', index);
|
|
|
});
|
|
|
//给音频绑定一个ID
|
|
|
$.each($(".audioImg"), function (index, item) {
|
|
|
@@ -212,6 +172,10 @@ function bindEventTeaOrignalYS() {
|
|
|
$.each($(".oralLanguageImg"), function (index, item) {
|
|
|
$(item).attr("audiourl", "");
|
|
|
});
|
|
|
+ //处理参考答案
|
|
|
+ $.each($(".underlineContent"), function (index, item) {
|
|
|
+ $(item).attr("data-text", $(item).html());
|
|
|
+ });
|
|
|
//去除多余的U空标签
|
|
|
$.each($("u"), function (index, item) {
|
|
|
var text = $(item).text();
|
|
|
@@ -222,6 +186,7 @@ function bindEventTeaOrignalYS() {
|
|
|
});
|
|
|
//处理暂无参考答案
|
|
|
$.each($(".yaoshi"), function (index, item) {
|
|
|
+ var parent = $(item).parent();
|
|
|
var prev = $(item).nextUntil(".yaoshi").find(".underlineContent");
|
|
|
if (prev.length == 0) {
|
|
|
var spanHtml = document.createElement("span");
|
|
|
@@ -229,6 +194,11 @@ function bindEventTeaOrignalYS() {
|
|
|
var uHtml = document.createElement("u");
|
|
|
uHtml.className = "underlineContent no-answer";
|
|
|
uHtml.innerText = "暂无参考答案";
|
|
|
+ if ($(parent)[0].tagName == 'P') {
|
|
|
+ if ($(parent).hasClass('correntQue') || $(parent).hasClass('boxQue')) {
|
|
|
+ uHtml.innerHTML = " ";
|
|
|
+ }
|
|
|
+ }
|
|
|
uHtml.setAttribute("data-text", uHtml.innerText);
|
|
|
$(spanHtml).html(uHtml.outerHTML);
|
|
|
$(item).after(spanHtml);
|
|
|
@@ -238,7 +208,63 @@ function bindEventTeaOrignalYS() {
|
|
|
$.each($(".container-table"), function (index, item) {
|
|
|
$(item).css("width", bodyWidth + "px");
|
|
|
});
|
|
|
+ //一题多空的答题点标注
|
|
|
+ var checkId = 0;
|
|
|
+ var headid = -1;
|
|
|
+ var groupId = -1;
|
|
|
+ $(".multipleStart").each(function (i, item) {
|
|
|
+ var $startNode = $(item);
|
|
|
+ $.merge($(item).nextUntil(".multipleEnd").filter("[class*='group']"), $(item).nextUntil(".multipleEnd").find("[class*='group']")).each(function (index, item) {
|
|
|
+ checkId = $(item).find('.yaoshi').attr("answer-id");
|
|
|
+ var gid = $(item).attr('class').replace(/.*group(\d+).*/g, "$1");
|
|
|
+ if (index == 0 || groupId != gid) {
|
|
|
+ groupId = gid;
|
|
|
+ headid = checkId;
|
|
|
+ }
|
|
|
+ $(item).find('.yaoshi').attr('parent-anid', headid);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ //显示/隐藏习题答案
|
|
|
+ $(".yaoshi").on("click", function () {
|
|
|
+ var curDisplay = $(this).nextUntil(".yaoshi").find(".underlineContent").eq(0).css("display");
|
|
|
+ if (curDisplay == "undefined" || curDisplay == undefined) return;
|
|
|
+
|
|
|
+ if (curDisplay == "none" || $(this).attr("data-status") == "0") {
|
|
|
+ $(this).attr("data-status", "1");
|
|
|
+ $(this).attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
+ //$(this).nextUntil(".yaoshi").find(".underlineContent").show();
|
|
|
+ //$(this).nextUntil(".yaoshi").find(".underlineContent").css("color", "#92D050");
|
|
|
+ $.each($(this).nextUntil(".yaoshi").find(".underlineContent"), function (index, item) {
|
|
|
+ if (!$(item).hasClass("no-answer")) {
|
|
|
+ $(item).css("color", "#92D050");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(item).css("color", "#989898");
|
|
|
+ }
|
|
|
|
|
|
+ $(item).find(".wordStyle").css("color", "#db5d00");
|
|
|
+ $(item).find(".phraseStyle").css("background-color", "#f2db8b");
|
|
|
+ });
|
|
|
+ //不再存在已隐藏的钥匙,移动端回调
|
|
|
+ if ($(".yaoshi[data-status='0']").length == 0) {
|
|
|
+ //添加回调
|
|
|
+ console.log("全部显示了");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $(this).attr("data-status", "0");
|
|
|
+ $(this).attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
+ //$(this).nextUntil(".yaoshi").find(".underlineContent").hide();
|
|
|
+ //$(this).nextUntil(".yaoshi").find(".underlineContent").css("color", "#ffffff");
|
|
|
+ $.each($(this).nextUntil(".yaoshi").filter(".underlineContent"), function (index, item) {
|
|
|
+ $(item).css("color", "#ffffff");
|
|
|
+ $(item).find(".wordStyle").css("color", "#ffffff");
|
|
|
+ $(item).find(".phraseStyle").css("background-color", "#ffffff");
|
|
|
+ });
|
|
|
+ //添加回调
|
|
|
+ onClickKeyHide();
|
|
|
+ }
|
|
|
+ });
|
|
|
//点击喇叭事件,音频播放
|
|
|
$(".audioImg").on("click", function () {
|
|
|
audioPlayClick(this);
|
|
|
@@ -303,7 +329,7 @@ function bindEventYS() {
|
|
|
$.each($(".container-table"), function (index, item) {
|
|
|
$(item).css("width", bodyWidth + "px");
|
|
|
});
|
|
|
- //获取两个之间的答题点
|
|
|
+ //一题多空的答题点标注
|
|
|
var checkId = 0;
|
|
|
var headid = -1;
|
|
|
var groupId = -1;
|
|
|
@@ -1173,9 +1199,9 @@ function scrollAnswer(answerid) {
|
|
|
//console.log(answerid);
|
|
|
$(".checkbox").removeClass("select-answer");
|
|
|
$(".answer-body").removeClass("select-answer");
|
|
|
- var ansDom = $(".answer-body[answer-id='" + answerid + "']");
|
|
|
+ var ansDom = $(".answer-body[parent-anid='" + answerid + "']");
|
|
|
if (ansDom.length == 0) {
|
|
|
- ansDom = $(".checkbox[answer-id='" + answerid + "']");
|
|
|
+ ansDom = $(".checkbox[parent-anid='" + answerid + "']");
|
|
|
}
|
|
|
$(ansDom).addClass("select-answer");
|
|
|
var scroll_offset = $(ansDom).offset(); //得到box这个div层的offset,包含两个值,top和left
|