var __INLINE_SCRIPT__ = (function () {
'use strict';
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i > 1;
count++;
range.setEndAfter(leaves[mid]);
setNewFrag(el, getFragmentHTML(range.cloneContents()));
return needTextOverflow() ? findLastNode(start, mid) : findLastNode(mid, end);
};
var findLastCharIndex = function findLastCharIndex(start, end) {
if (end - start > 1;
count++;
range.setEnd(lastNode, mid);
setNewFrag(el, getFragmentHTML(range.cloneContents()));
return needTextOverflow() ? findLastCharIndex(start, mid) : findLastCharIndex(mid, end);
};
var dom = document.createElement('div');
dom.innerHTML = text;
var leaves = getLeaf(dom);
var range = document.createRange();
range.setStartBefore(leaves[0]);
var lastNodeIndex = findLastNode(0, leaves.length - 1);
var lastNode = leaves[lastNodeIndex];
findLastCharIndex(0, lastNode.textContent.length);
((_b = binding.value) === null || _b === void 0 ? void 0 : _b.processExtraElement) && binding.value.processExtraElement(el.extraElement, el);
console.log(count);
} catch (error) {
console.error(error);
}
}
}
function computeLineNum(el) {
var computyStyle = getComputedStyle(el);
return Math.round(el.offsetHeight / parseFloat(computyStyle.lineHeight));
}
function removeAllChild(el) {
var childNodes = Array.from(el.childNodes);
childNodes.forEach(function (child) {
el.removeChild(child);
});
}
function setNewFrag(el, frag) {
removeAllChild(el);
el.appendChild(frag);
}
function getScaleByDom() {
var fontDom = document.createElement('div');
fontDom.style.fontSize = '16px';
document.body.appendChild(fontDom);
var originFontSize = parseFloat(fontDom.style.fontSize);
var realFontSize = parseFloat(window.getComputedStyle(fontDom, null).getPropertyValue('font-size'));
document.body.removeChild(fontDom);
var percent = realFontSize / originFontSize;
return percent;
}
var ltReplaceChar = "lt-".concat(Date.now(), "-").concat(Math.random());
var gtReplaceChar = "gt-".concat(Date.now(), "-").concat(Math.random());
var ltReplaceCharReg = new RegExp(ltReplaceChar, 'g');
var gtReplaceCharReg = new RegExp(gtReplaceChar, 'g');
function isAudioPage(itemShowType) {
return itemShowType * 1 === 7;
}
function replaceTagChar(str, enableTagReg) {
var strAfterReplace;
while (true) {
str = str.replace(enableTagReg, function (match, sub1, sub2, sub3) {
return "".concat(ltReplaceChar).concat(sub1).concat(gtReplaceChar).concat(sub2).concat(ltReplaceChar).concat(sub3).concat(gtReplaceChar);
});
if (str !== strAfterReplace) {
strAfterReplace = str;
continue;
}
break;
}
return strAfterReplace;
}
var __setDesc = function __setDesc(desc, isNoEncode, itemShowType) {
var extData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
function getAttr(s, a) {
var m = s.match(new RegExp(a + '\\s*=\\s*["\']?([^"\'\\s>]+)["\']?'));
return m && m[1];
}
function filterContentWithLinkNWeapp(str, enableTagReg) {
enableTagReg && (str = replaceTagChar(str, enableTagReg));
str = str.split(/(]*>)((?:.|\n)*?)()/);
var valid;
for (var i = 0; i ".concat(str[i + 1], "");
str[i + 2] = "";
i += 3;
continue;
} else if (getAttr(str[i], 'data-cardtype') === '3') {
var customstyle = getAttr(str[i], 'data-customstyle');
var customHeight = void 0;
if (customstyle) {
try {
var _JSON$parse = JSON.parse(customstyle.html(false)),
display = _JSON$parse.display,
height = _JSON$parse.height;
if (display !== 'none') {
customHeight = parseInt(height, 10);
} else {
customHeight = 0;
}
} catch (err) {
console.error(err);
}
} else {
var fontScale = getScaleByDom();
customHeight = 24 + 44 * fontScale;
}
str[i] = str[i].replace('";
i += 3;
continue;
}
} else if (valid) {
r += ' class="js_common_share_desc_link"';
var _itemShowType = getAttr(str[i], 'data-itemshowtype');
_itemShowType && (r += ' data-itemshowtype="' + _itemShowType + '"');
}
str[i] = valid ? r + '>' : '';
} else if (i % 4 === 3) {
!valid && (str[i] = '');
} else {
str[i] = str[i].replace(//g, '');
}
}
str = str.join('');
enableTagReg && (str = str.replace(ltReplaceCharReg, ''));
return str;
}
if (isNoEncode) {
if (itemShowType * 1 === 8) {
desc = desc.html(false);
}
desc = filterContentWithLinkNWeapp(desc, isAudioPage(itemShowType) ? /]+?textstyle[^>]+?)>([\s\S]+?)/g : undefined);
desc = window.__emojiFormat(desc.replace(/\r/g, '').replace(/\n/g, ''));
} else {
desc = desc.replace(/\r/g, '').replace(/\n/g, '').replace(/\s/g, ' ');
}
if (itemShowType * 1 === 8) {
var descDom = document.getElementById('js_image_desc');
descDom && (descDom.innerHTML = desc);
if (location.href.indexOf('immerse_style=1') > -1 && descDom) {
var r = window.innerHeight - descDom.getBoundingClientRect().y - document.getElementById('wx_expand_bottom').offsetHeight;
var l = window.getComputedStyle(descDom).lineHeight;
window.__immersiveFullDesc = desc;
window.__immersiveOmited = 1;
textOverflow(descDom, {
value: {
lineClamp: Math.floor(r / parseFloat(l)),
html: '... 展开'
}
});
}
} else if (itemShowType * 1 === 10) {
var dom = document.querySelector('.js_share_notice_dom');
var _descDom = document.getElementById('js_text_desc');
_descDom && (_descDom.innerHTML = desc);
if (extData.superVoteId) dom && dom.classList.add('no_min_height');
var titleDom = document.getElementById('js_text_title');
var titleRect = titleDom ? titleDom.getBoundingClientRect() : undefined;
var descRect = _descDom ? _descDom.getBoundingClientRect() : undefined;
if (titleRect && titleRect.height > 17 * 1.4 + 2 || descRect && descRect.height > 17 * 1.6 + 2 || extData.superVoteId) {
dom && dom.classList.add('text_align_left');
}
} else if (isAudioPage(itemShowType)) {
document.querySelector('#js_audio_desc') && (document.querySelector('#js_audio_desc').innerHTML = desc);
} else {
var _descDom2 = document.getElementById('js_common_share_desc');
var descDomWrap = document.getElementById('js_common_share_desc_wrap');
if (!_descDom2 || !descDomWrap) {
return;
}
_descDom2.innerHTML = desc;
if (itemShowType * 1 !== 5) {
setTimeout(function () {
var folderSwitcher = document.getElementById('js_folder_text_switch');
if (_descDom2.offsetHeight - descDomWrap.offsetHeight > 1) {
descDomWrap.className += ' weui-ellipsis_multi';
folderSwitcher.style.display = 'block';
} else {
folderSwitcher.style.display = 'none';
}
}, 300);
}
}
};
if (!window.__second_open__) {
var videoContentNoEncode = window.a_value_which_never_exists || '国家发展改革委介绍“系统落实一揽子增量政策 扎实推动经济向上结构向优、发展态势持续向好”新闻发布会即将召开';
var TextContentNoEncode = window.a_value_which_never_exists || '';
var ContentNoEncode = window.a_value_which_never_exists || '国家发展改革委介绍“系统落实一揽子增量政策 扎实推动经济向上结构向优、发展态势持续向好”新闻发布会即将召开';
var itemShowType = window.a_value_which_never_exists || '5';
var content = window.a_value_which_never_exists || '';
var desc = window.a_value_which_never_exists || '国家发展改革委介绍“系统落实一揽子增量政策 扎实推动经济向上结构向优、发展态势持续向好”新闻发布会即将召开';
var superVoteId = window.a_value_which_never_exists || '';
var extData = {
superVoteId: superVoteId
};
if (videoContentNoEncode) {
__setDesc(videoContentNoEncode, true, itemShowType, extData);
} else if (itemShowType * 1 === 10 && (ContentNoEncode || superVoteId) || isAudioPage(itemShowType) && ContentNoEncode) {
__setDesc(ContentNoEncode, true, itemShowType, extData);
} else if (TextContentNoEncode) {
__setDesc(TextContentNoEncode, true, itemShowType, extData);
} else if (itemShowType * 1 === 8) {
__setDesc(content || desc, true, itemShowType, extData);
} else {
__setDesc(desc, false, itemShowType, extData);
}
window.__setDesc = __setDesc;
}
return __setDesc;
})();