|
|
@@ -47,15 +47,27 @@ var removeHtmlFunc = function (HtmlStr) {
|
|
|
// 清除非长度标签
|
|
|
var pattStr = new RegExp(/<(img){1}.*?>/ig);
|
|
|
var matchesArr = HtmlStr.match(pattStr);
|
|
|
- if (matchesArr != null && matchesArr.length > 0) {
|
|
|
+ if (matchesArr != null && (matchesArr != undefined && matchesArr.length > 0)) {
|
|
|
for (var i = 0; i < matchesArr.length; i++) {
|
|
|
HtmlStr = HtmlStr.replace(matchesArr[i], "");
|
|
|
}
|
|
|
}
|
|
|
pattStr = new RegExp(/(<(p){1}.*?>).*?(<\/\2>)/ig);
|
|
|
matchesArr = HtmlStr.match(pattStr);
|
|
|
+ if (matchesArr != undefined && matchesArr.length > 0) {
|
|
|
+ // 清除匹配的P标签
|
|
|
+ for (var i = 0; i < matchesArr.length; i++) {
|
|
|
+ HtmlStr = HtmlStr.replace(matchesArr[i], "");
|
|
|
+ }
|
|
|
+ }
|
|
|
// 判断是否存在p标签
|
|
|
- if (matchesArr != null || matchesArr.length > 0) {
|
|
|
+ if (matchesArr != null || (matchesArr != undefined && matchesArr.length > 0)) {
|
|
|
+ if (HtmlStr != null && HtmlStr != "") {
|
|
|
+ // p标签混排
|
|
|
+ HtmlStr = "<p>" + HtmlStr + "</p>";
|
|
|
+ matchesArr.push(HtmlStr);
|
|
|
+ HtmlStr = null;
|
|
|
+ }
|
|
|
pattStr = new RegExp(/(<(p|b|span|u){1}.*?>).*?(<\/\2>)/i);
|
|
|
for (var i = 0; i < matchesArr.length; i++) {
|
|
|
var NewHtmlStr = matchesArr[i];
|
|
|
@@ -155,14 +167,24 @@ var AdjustTableFunc = function () {
|
|
|
TableWidth += ArrMaxLen[i];
|
|
|
}
|
|
|
else if (ArrMaxLen[i] != undefined && $(item).find("tr").eq(0).find("td").length > 1 && !RuleFlag) {
|
|
|
- TableWidth += ArrMaxLen[i];
|
|
|
- var NotRuleWidth = 0;
|
|
|
if (i == ArrMaxLen.length - 1) {
|
|
|
- NotRuleWidth = TableWidth / $(item).find("tr").eq(0).find("td").length;
|
|
|
+ var FLenVal = $(item).find("tr").eq(0).find("td").length;
|
|
|
+ var AllLenArr = [];
|
|
|
+ for (var j = 0; j < FLenVal; j++) {
|
|
|
+ AllLenArr.push(parseInt($(item).find("tr").eq(0).find("td").eq(j).attr("colspan")));
|
|
|
+ }
|
|
|
+ var AIndex = 0;
|
|
|
+ for (var j = 0; j < AllLenArr.length; j++) {
|
|
|
+ var AWidthVal = 0;
|
|
|
+ for (var k = 0; k < parseInt(AllLenArr[j]) ; k++) {
|
|
|
+ AWidthVal += ArrMaxLen[AIndex];
|
|
|
+ AIndex += 1;
|
|
|
+ }
|
|
|
+ AWidthVal += 100;
|
|
|
+ TableWidth += AWidthVal;
|
|
|
+ $(item).find("tr").eq(0).find("td").eq(j).css("width", AWidthVal + "px");
|
|
|
+ }
|
|
|
}
|
|
|
- $.each($(item).find("tr").eq(0).find("td"), function (tdIndex, tdItem) {
|
|
|
- $(tdItem).css("width", NotRuleWidth + "px");
|
|
|
- });
|
|
|
}
|
|
|
else if (ArrMaxLen[i] != undefined && $(item).find("tr").eq(0).find("td").length == 1) {
|
|
|
OneFlag = true;
|
|
|
@@ -254,53 +276,147 @@ var isGCFunc = function (NodeHandle) {
|
|
|
}
|
|
|
return isFlag;
|
|
|
};
|
|
|
-
|
|
|
-// 处理高亮
|
|
|
-var dealGLShowFunc = function (NodeHandle) {
|
|
|
- if (styleWPSContrl.wordFlag) {
|
|
|
- $(NodeHandle).find(".wordStyle").css("color", "#db5d00");
|
|
|
- }
|
|
|
- else {
|
|
|
- $.each($(NodeHandle).find(".wordStyle"), function (index, element) {
|
|
|
- if (isGCFunc(element)) {
|
|
|
- $(element).css("color", "#92D050");
|
|
|
+//(shcode是否可点击1可点击;ulflag判断是否存在横线内1表示在;showflag是否显示1显示)
|
|
|
+// 处理显示或隐藏答案
|
|
|
+var dealAnswerFunc = function (NodeHandle, OCFlag, ThProFlag) {
|
|
|
+ if (OCFlag) {
|
|
|
+ var showflagS = $(NodeHandle).attr("showflag");
|
|
|
+ if ($(NodeHandle).attr("ulflag") == 1) {
|
|
|
+ if (!ThProFlag || (ThProFlag && showflagS == 1)) {
|
|
|
+ if ($(NodeHandle).text() == "暂无参考答案") {
|
|
|
+ $(NodeHandle).css("color", "#989898").attr("shcode", 1).attr("showflag", "1");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(NodeHandle).css("color", "#92D050").attr("shcode", 1).attr("showflag", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(NodeHandle).css("color", "#000000").attr("shcode", 1).attr("showflag", "1");
|
|
|
+ }
|
|
|
+ if ($(NodeHandle).attr("hitstyle") == "wordStyle") {
|
|
|
+ if (styleWPSContrl.wordFlag) {
|
|
|
+ if (!ThProFlag || (ThProFlag && showflagS == 1)) {
|
|
|
+ $(NodeHandle).css("color", "#db5d00").attr("shcode", 1).attr("showflag", "1");
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
- $(element).css("color", "#000000");
|
|
|
+ var ulflag = $(NodeHandle).attr("ulflag");
|
|
|
+ if (ulflag == "1") {
|
|
|
+ if (!ThProFlag || (ThProFlag && showflagS == 1)) {
|
|
|
+ $(NodeHandle).css("color", "#92D050").attr("shcode", 0).attr("showflag", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(NodeHandle).css("color", "#000000").attr("shcode", 0).attr("showflag", "1");
|
|
|
+ }
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
- if (styleWPSContrl.phraseFlag) {
|
|
|
- $(NodeHandle).find(".phraseStyle").css("background-color", "#f2db8b");
|
|
|
- }
|
|
|
- else {
|
|
|
- $(NodeHandle).find(".phraseStyle").css("background-color", "#fff");
|
|
|
- }
|
|
|
- if (styleWPSContrl.sentenceFlag) {
|
|
|
- $(NodeHandle).find(".sentenceStyle").css("border-bottom", "2px solid #78ae43");
|
|
|
- }
|
|
|
- else {
|
|
|
- $(NodeHandle).find(".sentenceStyle").css("border-bottom", "2px solid #fff");
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-// 处理显示或隐藏答案
|
|
|
-var dealAnswerFunc = function (NodeHandle, OCFlag) {
|
|
|
- if (OCFlag) {
|
|
|
- $(NodeHandle).css("color", "#92D050").css("border-bottom", "1px solid #979797").css("background-color", "transparent").attr("shcode", "0");
|
|
|
- $(NodeHandle).children().css("color", "#92D050").css("border-bottom", "1px solid #979797").css("background-color", "transparent").attr("shcode", "0");
|
|
|
- // 处理高亮
|
|
|
- dealGLShowFunc(NodeHandle);
|
|
|
+ }
|
|
|
+ else if ($(NodeHandle).attr("hitstyle") == "phraseStyle") {
|
|
|
+ if (styleWPSContrl.phraseFlag && showflagS == "1") {
|
|
|
+ $(NodeHandle).css("background-color", "#f2db8b").attr("shcode", 1).attr("showflag", "1");
|
|
|
+ }
|
|
|
+ else if (showflagS == "1") {
|
|
|
+ $(NodeHandle).css("background-color", "#ffffff").attr("shcode", 0).attr("showflag", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if ($(NodeHandle).attr("hitstyle") == "sentenceStyle") {
|
|
|
+ if (styleWPSContrl.sentenceFlag && showflagS == "1") {
|
|
|
+ $(NodeHandle).css("border-bottom", "2px solid #78ae43").attr("shcode", 1).attr("showflag", "1");
|
|
|
+ }
|
|
|
+ else if (showflagS == "1") {
|
|
|
+ $(NodeHandle).css("border-bottom", "2px solid #ffffff").attr("shcode", 1).attr("showflag", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!ThProFlag) {
|
|
|
+ $.each($(NodeHandle).find("u,span,p"), function (index, element) {
|
|
|
+ showflagS = $(element).attr("showflag");
|
|
|
+ // 处理普通文本
|
|
|
+ if ($(element).attr("ulflag") == 1) {
|
|
|
+ if (!ThProFlag || (ThProFlag && showflagS == 1)) {
|
|
|
+ if ($(element).text() == "暂无参考答案") {
|
|
|
+ $(element).css("color", "#989898").attr("shcode", 1).attr("showflag", "1");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(element).css("color", "#92D050").attr("shcode", 1).attr("showflag", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(element).css("color", "#000000").attr("shcode", 1).attr("showflag", "1");
|
|
|
+ }
|
|
|
+ // 处理高亮
|
|
|
+ if ($(element).attr("hitstyle") == "wordStyle") {
|
|
|
+ if (styleWPSContrl.wordFlag) {
|
|
|
+ if (!ThProFlag || (ThProFlag && showflagS == 1)) {
|
|
|
+ $(element).css("color", "#db5d00").attr("shcode", 1).attr("showflag", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (!ThProFlag || (ThProFlag && showflagS == 1)) {
|
|
|
+ var ulflag = $(element).attr("ulflag");
|
|
|
+ if (ulflag == "1") {
|
|
|
+ if (!ThProFlag || (ThProFlag && showflagS == 1)) {
|
|
|
+ $(element).css("color", "#92D050").attr("shcode", 0).attr("showflag", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(element).css("color", "#000000").attr("shcode", 0).attr("showflag", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if ($(element).attr("hitstyle") == "phraseStyle") {
|
|
|
+ if (styleWPSContrl.phraseFlag) {
|
|
|
+ if (!ThProFlag || (ThProFlag && showflagS == 1)) {
|
|
|
+ $(element).css("background-color", "#f2db8b").attr("shcode", 1).attr("showflag", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(element).css("background-color", "#ffffff").attr("shcode", 0).attr("showflag", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if ($(element).attr("hitstyle") == "sentenceStyle") {
|
|
|
+ if (styleWPSContrl.sentenceFlag) {
|
|
|
+ if (!ThProFlag || (ThProFlag && showflagS == 1)) {
|
|
|
+ $(element).css("border-bottom", "2px solid #78ae43").attr("shcode", 1).attr("showflag", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(element).css("border-bottom", "2px solid #ffffff").attr("shcode", 0).attr("showflag", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
- $(NodeHandle).css("color", "#fff").css("border-bottom", "1px solid #979797").css("background-color", "#fff").attr("shcode", "1");
|
|
|
- $(NodeHandle).children().css("color", "#fff").css("border-bottom", "1px solid #979797").css("background-color", "#fff").attr("shcode", "1");
|
|
|
- $(NodeHandle).find(".wordStyle").css("color", "#fff").css("border-bottom", "1px solid #979797").css("background-color", "#fff").attr("shcode", "1");
|
|
|
- $(NodeHandle).find(".sentenceStyle").css("color", "#fff").css("border-bottom", "1px solid #979797").css("background-color", "#fff").attr("shcode", "1");
|
|
|
- $(NodeHandle).find(".phraseStyle").css("color", "#fff").css("border-bottom", "1px solid #979797").css("background-color", "#fff").attr("shcode", "1");
|
|
|
+ $(NodeHandle).css("color", "#ffffff").attr("shcode", 1).attr("showflag", "0");
|
|
|
+ if ($(NodeHandle).attr("hitstyle") == "wordStyle") {
|
|
|
+ $(NodeHandle).attr("shcode", 0).attr("showflag", "0");
|
|
|
+ }
|
|
|
+ else if ($(NodeHandle).attr("hitstyle") == "phraseStyle") {
|
|
|
+ $(NodeHandle).css("background-color", "#ffffff").attr("shcode", 0).attr("showflag", "0");
|
|
|
+ }
|
|
|
+ else if ($(NodeHandle).attr("hitstyle") == "sentenceStyle") {
|
|
|
+ $(NodeHandle).css("border-bottom", "2px solid #ffffff").attr("shcode", 0).attr("showflag", "0");
|
|
|
+ }
|
|
|
+ $.each($(NodeHandle).find("u,span,p"), function (index,element) {
|
|
|
+ // 处理普通文本
|
|
|
+ $(element).css("color", "#ffffff").attr("shcode", 1).attr("showflag", "0"); // 合并处理
|
|
|
+ // 处理高亮
|
|
|
+ if ($(element).attr("hitstyle") == "wordStyle") {
|
|
|
+ $(element).attr("shcode", 0).attr("showflag", "0");
|
|
|
+ }
|
|
|
+ else if ($(element).attr("hitstyle") == "phraseStyle") {
|
|
|
+ $(element).css("background-color", "#ffffff").attr("shcode", 0).attr("showflag", "0");
|
|
|
+ }
|
|
|
+ else if ($(element).attr("hitstyle") == "sentenceStyle") {
|
|
|
+ $(element).css("border-bottom", "2px solid #ffffff").attr("shcode", 0).attr("showflag", "0");
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
var underlineContentText = $(NodeHandle).text(); // 获取文本内容
|
|
|
- if (underlineContentText.indexOf("√") > -1) {
|
|
|
+ if (underlineContentText != undefined && underlineContentText.indexOf("√") > -1) {
|
|
|
if (OCFlag) {
|
|
|
$(NodeHandle).parent().find(".checkbox").find("input").prop('checked', true);
|
|
|
}
|
|
|
@@ -315,13 +431,13 @@ function showHideAnswer(flag) {
|
|
|
if (flag) {
|
|
|
$(".yaoshi").attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
$.each($(".underlineContent"), function (index, item) {
|
|
|
- dealAnswerFunc(item, true);
|
|
|
+ dealAnswerFunc(item, true, false);
|
|
|
});
|
|
|
}
|
|
|
else {
|
|
|
$(".yaoshi").attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
$.each($(".underlineContent,.underlineContent.no-answer"), function (index, item) {
|
|
|
- dealAnswerFunc(item, false);
|
|
|
+ dealAnswerFunc(item, false, false);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
@@ -336,14 +452,14 @@ function showHideAnswerEx(isShowYX, isShowAS) {
|
|
|
}
|
|
|
if (isShowAS) {
|
|
|
$.each($(".underlineContent"), function (index, item) {
|
|
|
- dealAnswerFunc(item, true);
|
|
|
+ dealAnswerFunc(item, true, false);
|
|
|
});
|
|
|
$(".yaoshi").attr("data-status", "1");
|
|
|
$(".yaoshi").attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
}
|
|
|
else {
|
|
|
$.each($(".underlineContent,.underlineContent.no-answer"), function (index, item) {
|
|
|
- dealAnswerFunc(item, false);
|
|
|
+ dealAnswerFunc(item, false, false);
|
|
|
});
|
|
|
$(".yaoshi").attr("data-status", "0");
|
|
|
$(".yaoshi").attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
@@ -440,7 +556,7 @@ function bindEventTeaOrignalYS() {
|
|
|
$(item).attr("data-status", "1");
|
|
|
$(item).attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
$.each($(item).parent().find(".underlineContent"), function (cIndex, cItem) {
|
|
|
- dealAnswerFunc(cItem, true);
|
|
|
+ dealAnswerFunc(cItem, true, false);
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
@@ -448,7 +564,7 @@ function bindEventTeaOrignalYS() {
|
|
|
$(this).attr("data-status", "1");
|
|
|
$(this).attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
$.each($(this).nextUntil(".yaoshi").find(".underlineContent"), function (index, item) {
|
|
|
- dealAnswerFunc(item, true);
|
|
|
+ dealAnswerFunc(item, true, false);
|
|
|
});
|
|
|
}
|
|
|
//不再存在已隐藏的钥匙,移动端回调
|
|
|
@@ -464,7 +580,7 @@ function bindEventTeaOrignalYS() {
|
|
|
$(item).attr("data-status", "0");
|
|
|
$(item).attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
$.each($(item).parent().find(".underlineContent"), function (cIndex, cItem) {
|
|
|
- dealAnswerFunc(cItem, false);
|
|
|
+ dealAnswerFunc(cItem, false, false);
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
@@ -472,7 +588,7 @@ function bindEventTeaOrignalYS() {
|
|
|
$(this).attr("data-status", "0");
|
|
|
$(this).attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
$.each($(this).nextUntil(".yaoshi").find(".underlineContent"), function (index, item) {
|
|
|
- dealAnswerFunc(item, false);
|
|
|
+ dealAnswerFunc(item, false, false);
|
|
|
});
|
|
|
}
|
|
|
//添加回调
|
|
|
@@ -567,7 +683,7 @@ function bindEventYS() {
|
|
|
$(fItem).attr("data-status", "1");
|
|
|
$(fItem).attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
$.each($(fItem).parent().find(".underlineContent"), function (index, item) {
|
|
|
- dealAnswerFunc(item, true);
|
|
|
+ dealAnswerFunc(item, true, false);
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
@@ -576,7 +692,7 @@ function bindEventYS() {
|
|
|
$(this).attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
//$(this).nextUntil(".yaoshi").filter(".underlineContent").css("color", "#92D050");
|
|
|
$.each($(this).nextUntil(".yaoshi").filter(".underlineContent"), function (index, item) {
|
|
|
- dealAnswerFunc(item, true);
|
|
|
+ dealAnswerFunc(item, true, false);
|
|
|
});
|
|
|
}
|
|
|
//不再存在已隐藏的钥匙,移动端回调
|
|
|
@@ -592,7 +708,7 @@ function bindEventYS() {
|
|
|
$(fItem).attr("data-status", "0");
|
|
|
$(fItem).attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
$.each($(fItem).parent().find(".underlineContent"), function (index, item) {
|
|
|
- dealAnswerFunc(item, false);
|
|
|
+ dealAnswerFunc(item, false, false);
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
@@ -601,7 +717,7 @@ function bindEventYS() {
|
|
|
$(this).attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
//$(this).nextUntil(".yaoshi").filter(".underlineContent").css("color", "#ffffff");
|
|
|
$.each($(this).nextUntil(".yaoshi").filter(".underlineContent"), function (index, item) {
|
|
|
- dealAnswerFunc(item, false);
|
|
|
+ dealAnswerFunc(item, false, false);
|
|
|
});
|
|
|
}
|
|
|
//添加回调
|
|
|
@@ -1509,14 +1625,15 @@ function randomNum(minNum, maxNum) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// 传递显示单词wordFlag/句子phraseFlag/句型sentenceFlag,true表示高亮,false表示不高亮
|
|
|
+// 传递显示单词wordFlag/短语phraseFlag/句型sentenceFlag,true表示高亮,false表示不高亮
|
|
|
function showGLWorld(wordFlag, phraseFlag, sentenceFlag) {
|
|
|
styleWPSContrl.wordFlag = wordFlag;
|
|
|
styleWPSContrl.phraseFlag = phraseFlag;
|
|
|
styleWPSContrl.sentenceFlag = sentenceFlag;
|
|
|
- dealGLShowFunc(document);
|
|
|
+ $.each($(document.body).find("u[hitstyle='wordStyle'],span[hitstyle='wordStyle'],p[hitstyle='wordStyle'],u[hitstyle='phraseStyle'],span[hitstyle='phraseStyle'],p[hitstyle='phraseStyle'],u[hitstyle='sentenceStyle'],span[hitstyle='sentenceStyle'],p[hitstyle='sentenceStyle']"), function (index, element) {
|
|
|
+ dealAnswerFunc(element, true, true);
|
|
|
+ });
|
|
|
}
|
|
|
-
|
|
|
function playVisiableAudioCallBack(type, url) {
|
|
|
//console.log(url);
|
|
|
cancelBubble();
|