|
|
@@ -126,30 +126,29 @@ var removeHtmlFunc = function (htmlStr, TdWidthVal) {
|
|
|
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 != 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++) {
|
|
|
+ // 去除多标签
|
|
|
+ pattStr = new RegExp(/(<([a-z|A-Z]+){1}.*?>).*?(<\/\2>)/i);
|
|
|
var NewhtmlStr = matchesArr[i];
|
|
|
while (pattStr.test(NewhtmlStr)) {
|
|
|
- var TmatchesArr = NewhtmlStr.match(pattStr);
|
|
|
- if (TmatchesArr.length > 0) {
|
|
|
+ var tTmatchesArr = NewhtmlStr.match(pattStr);
|
|
|
+ if (tTmatchesArr.length > 0) {
|
|
|
// 存在P标签
|
|
|
- NewhtmlStr = NewhtmlStr.replace(TmatchesArr[1], "").replace(TmatchesArr[3], "");
|
|
|
+ NewhtmlStr = NewhtmlStr.replace(tTmatchesArr[1], "").replace(tTmatchesArr[3], "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 去除单标签
|
|
|
+ pattStr = new RegExp(/(<([a-z|A-Z]+){1}\\s*\/\\s*>)/i);
|
|
|
+ while (pattStr.test(NewhtmlStr)) {
|
|
|
+ var tTmatchesArr = NewhtmlStr.match(pattStr);
|
|
|
+ if (tTmatchesArr.length > 0) {
|
|
|
+ // 存在P标签
|
|
|
+ NewhtmlStr = NewhtmlStr.replace(tTmatchesArr[1], "");
|
|
|
}
|
|
|
}
|
|
|
if (i == 0 || (htmlStr.length < NewhtmlStr.length)) {
|
|
|
@@ -158,16 +157,67 @@ var removeHtmlFunc = function (htmlStr, TdWidthVal) {
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
- pattStr = new RegExp(/(<(b|span|u){1}.*?>).*?(<\/\2>)/i);
|
|
|
- if (pattStr.test(htmlStr)) {
|
|
|
- while (pattStr.test(htmlStr)) {
|
|
|
- var matchesArr = htmlStr.match(pattStr);
|
|
|
- if (matchesArr.length > 0) {
|
|
|
- htmlStr = htmlStr.replace(matchesArr[1], "").replace(matchesArr[3], "");
|
|
|
- }
|
|
|
+ pattStr = new RegExp(/(<([a-z|A-Z]+){1}.*?>).*?(<\/\2>)/i); // 去除多标签
|
|
|
+ while (pattStr.test(htmlStr)) {
|
|
|
+ var tTmatchesArr = htmlStr.match(pattStr);
|
|
|
+ if (tTmatchesArr.length > 0) {
|
|
|
+ // 存在P标签
|
|
|
+ htmlStr = htmlStr.replace(tTmatchesArr[1], "").replace(tTmatchesArr[3], "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 去除单标签
|
|
|
+ pattStr = new RegExp(/(<([a-z|A-Z]+){1}\\s*\/\\s*>)/i);
|
|
|
+ while (pattStr.test(htmlStr)) {
|
|
|
+ var tTmatchesArr = htmlStr.match(pattStr);
|
|
|
+ if (tTmatchesArr.length > 0) {
|
|
|
+ // 存在P标签
|
|
|
+ htmlStr = htmlStr.replace(tTmatchesArr[1], "");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ // 旧处理
|
|
|
+ //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 != 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];
|
|
|
+ // while (pattStr.test(NewhtmlStr)) {
|
|
|
+ // var TmatchesArr = NewhtmlStr.match(pattStr);
|
|
|
+ // if (TmatchesArr.length > 0) {
|
|
|
+ // // 存在P标签
|
|
|
+ // NewhtmlStr = NewhtmlStr.replace(TmatchesArr[1], "").replace(TmatchesArr[3], "");
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if (i == 0 || (htmlStr.length < NewhtmlStr.length)) {
|
|
|
+ // htmlStr = NewhtmlStr;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //else {
|
|
|
+ // pattStr = new RegExp(/(<(b|span|u){1}.*?>).*?(<\/\2>)/i);
|
|
|
+ // if (pattStr.test(htmlStr)) {
|
|
|
+ // while (pattStr.test(htmlStr)) {
|
|
|
+ // var matchesArr = htmlStr.match(pattStr);
|
|
|
+ // if (matchesArr.length > 0) {
|
|
|
+ // htmlStr = htmlStr.replace(matchesArr[1], "").replace(matchesArr[3], "");
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //}
|
|
|
ReArr.TextStr = htmlStr;
|
|
|
return ReArr;
|
|
|
};
|
|
|
@@ -232,7 +282,7 @@ var AdjustTableFunc = function (sWidthVal, isAStatus) {
|
|
|
var ScreenWidth = $(document.body).width();
|
|
|
ScreenWidth = ScreenWidth > sWidthVal ? ScreenWidth : sWidthVal;
|
|
|
var TempMinWidth = GetMinTableVal(ScreenWidth);
|
|
|
- $(document.body).css("width", "999999px");
|
|
|
+ //$(document.body).css("width", "999999px");
|
|
|
$(document.body).append('<span id="pContrainId"></span>');
|
|
|
$("table").find(".yaoshi").addClass("nextpic");
|
|
|
$.each($("table"), function (index, item) {
|
|
|
@@ -376,7 +426,7 @@ var AdjustTableFunc = function (sWidthVal, isAStatus) {
|
|
|
$(JqStr).append(ChildhtmlStr);
|
|
|
});
|
|
|
$(document.body).css("width", ScreenWidth + "px");
|
|
|
- var BodyWidth = isNaN(parseFloat($(document).width())) ? 0 : (parseFloat($(document).width()) - GetPadVal(document.body)); // 界面宽度
|
|
|
+ var BodyWidth = isNaN(parseFloat(ScreenWidth)) ? 0 : parseFloat(ScreenWidth); // 界面宽度
|
|
|
$.each($("table"), function (index, item) {
|
|
|
var TableWidth = isNaN(parseFloat($(item).width())) ? 0 : parseFloat($(item).width()); // 表格宽度
|
|
|
// 替换HTML
|