Forráskód Böngészése

关于表格宽度处理

namejr 4 éve
szülő
commit
76c7c85582
1 módosított fájl, 26 hozzáadás és 24 törlés
  1. 26 24
      EBook.Web/Common/tasklib_book.js

+ 26 - 24
EBook.Web/Common/tasklib_book.js

@@ -80,32 +80,34 @@ var removeHtmlFunc = function (htmlStr, TdWidthVal) {
     var matchesArr = htmlStr.match(pattStr);
     if (matchesArr != null && (matchesArr != undefined && matchesArr.length > 0)) {
         for (var i = 0; i < matchesArr.length; i++) {
-            var TempWidthVal = 0;
-            var pattWStr = new RegExp(/width\s?:\s?[0-9|p|x|%]+;/ig);
-            var matchesWArr = matchesArr[i].match(pattWStr);
-            if (matchesWArr != null && matchesWArr.length > 0) {
-                if (matchesWArr[0].indexOf("%") > -1) {
-                    var TWidthVal = parseFloat(matchesWArr[0].replace(/\s/g, "").replace("width:", ""));
-                    TempWidthVal += TdWidthVal * TWidthVal;
+            if (matchesArr[i].indexOf("nextpic") == -1) {
+                var TempWidthVal = 0;
+                var pattWStr = new RegExp(/width\s?:\s?[0-9|p|x|%]+;/ig);
+                var matchesWArr = matchesArr[i].match(pattWStr);
+                if (matchesWArr != null && matchesWArr.length > 0) {
+                    if (matchesWArr[0].indexOf("%") > -1) {
+                        var TWidthVal = parseFloat(matchesWArr[0].replace(/\s/g, "").replace("width:", ""));
+                        TempWidthVal += TdWidthVal * TWidthVal;
+                    }
+                    else {
+                        TempWidthVal += parseFloat(matchesWArr[0].replace(/\s/g, "").replace("width:", "").replace("px", ""));
+                    }
                 }
-                else {
-                    TempWidthVal += parseFloat(matchesWArr[0].replace(/\s/g, "").replace("width:", "").replace("px", ""));
+                pattWStr = new RegExp(/width\s?=\s?["|'|0-9|p|x|%]+/ig);
+                matchesWArr = matchesArr[i].match(pattWStr);
+                if (matchesWArr != null && matchesWArr.length > 0) {
+                    if (matchesWArr[0].indexOf("%") > -1) {
+                        var TWidthVal = parseFloat(matchesWArr[0].replace(/\s/g, "").replace("width=", ""));
+                        TempWidthVal += TdWidthVal * TWidthVal;
+                    } else {
+                        TempWidthVal += parseFloat(matchesWArr[0].replace(/\s/g, "").replace("width=", "").replace("px", ""));
+                    }
                 }
-            }
-            pattWStr = new RegExp(/width\s?=\s?["|'|0-9|p|x|%]+/ig);
-            matchesWArr = matchesArr[i].match(pattWStr);
-            if (matchesWArr != null && matchesWArr.length > 0) {
-                if (matchesWArr[0].indexOf("%") > -1) {
-                    var TWidthVal = parseFloat(matchesWArr[0].replace(/\s/g, "").replace("width=", ""));
-                    TempWidthVal += TdWidthVal * TWidthVal;
-                } else {
-                    TempWidthVal += parseFloat(matchesWArr[0].replace(/\s/g, "").replace("width=", "").replace("px", ""));
+                ReArr.WidthVal = TempWidthVal > ReArr.WidthVal ? TempWidthVal : ReArr.WidthVal;
+                if (ReArr.WidthVal != 0) {
+                    ReArr.ImgFlag = true;
                 }
             }
-            ReArr.WidthVal = TempWidthVal > ReArr.WidthVal ? TempWidthVal : ReArr.WidthVal;
-            if (ReArr.WidthVal != 0) {
-                ReArr.ImgFlag = true;
-            }
             htmlStr = htmlStr.replace(matchesArr[i], "");
         }
     }
@@ -176,7 +178,7 @@ var dealTdTextFunc = function (htmlStr) {
     }
     return ReStr;
 };
-// 动态获取表格最小宽度设置
+// 动态获取表格最小宽度设置(最小宽度165px)
 var GetMinTableVal = function (TSWidth) {
     return 165 + (TSWidth - 320) * 0.09;
 };
@@ -1676,7 +1678,7 @@ function backupAllAnswer(answerJson, statusType) {
                     else {
                         $(item).children(".answer-text").show();
                         $(item).children(".answer-text").text(mytext);
-                        if (mytext=="") { }
+                        if (mytext == "") { }
                         $(item).attr("data-errstatus", "0");
                     }
                     $(item).children(".answer-point-range").hide();