长亭百川云 - 文章详情

Cypherpunks Write Code 4

网安志异

59

2024-07-13

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 < len; i++) arr2[i] = arr[i]; return arr2; } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function textOverflow(el, binding) { var _a, _b; var text = el.innerHTML; if (!text || !text.length) return; var retainTail = []; if ((_a = binding.value) === null || _a === void 0 ? void 0 : _a.tailNum) { retainTail = _toConsumableArray(el.childNodes).slice(-binding.value.tailNum); } var count = 0; function needTextOverflow() { var _a; if ((_a = binding.value) === null || _a === void 0 ? void 0 : _a.lineClamp) { return binding.value.lineClamp < computeLineNum(el); } return el.offsetHeight < el.scrollHeight; } if (needTextOverflow()) { try { var getLeaf = function getLeaf(node) { var result = []; if (!node.childNodes || node.childNodes.length === 0) { return [node]; } node.childNodes.forEach(function (child) { result = [].concat(_toConsumableArray(result), _toConsumableArray(getLeaf(child))); }); return result; }; var getFragmentHTML = function getFragmentHTML(frag) { var _a, _b; var div = document.createDocumentFragment(); div.appendChild(frag); var span = document.createElement('span'); span.innerHTML = ((_a = binding.value) === null || _a === void 0 ? void 0 : _a.html) || '...'; if (div.lastElementChild) { div.lastElementChild.style.display = 'inline'; } div.appendChild(span); el.extraElement = span; if ((_b = binding.value) === null || _b === void 0 ? void 0 : _b.tailNum) { retainTail.forEach(function (tail) { div.appendChild(tail); }); } return div; }; var findLastNode = function findLastNode(start, end) { if (end - start <= 1) { range.setEndAfter(leaves[start]); setNewFrag(el, getFragmentHTML(range.cloneContents())); return needTextOverflow() ? start : end; } var mid = start + end >> 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) { if (start === 0) { range.setEndAfter(leaves[Math.max(lastNodeIndex - 1, 0)]); } else { range.setEnd(lastNode, start); } setNewFrag(el, getFragmentHTML(range.cloneContents())); return start; } var mid = start + end >> 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); } 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) { str = str.split(/(<a\s+\w[^>]*>)((?:.|\n)*?)(<\/a>)/); var valid; for (var i = 0; i < str.length; i++) { if (i % 4 === 1) { valid = false; var href = getAttr(str[i], 'href'); if (/^https?:\/\/mp\.weixin\.qq\.com/.test(href)) { valid = true; } var r = '<a target="_blank" data-href="' + (valid ? href : '') + '"'; var weappId = getAttr(str[i], 'data-miniprogram-appid'); var poiLongitude = getAttr(str[i], 'data-longitude'); var poiLatitude = getAttr(str[i], 'data-latitude'); var bizFakeId = getAttr(str[i], 'data-biz'); if (poiLongitude && poiLatitude) { r += ' class="js_poi_entry wx_poi_link"' + ' data-poiid="' + (getAttr(str[i], 'data-poiid') || '') + '"' + ' data-districtid="' + (getAttr(str[i], 'data-districtid') || '') + '"' + ' data-name="' + (getAttr(str[i], 'data-name') || '') + '"' + ' data-address="' + (getAttr(str[i], 'data-address') || '') + '"' + ' data-longitude="' + poiLongitude + '"' + ' data-latitude="' + poiLatitude + '"'; valid = true; } else if (weappId) { r += ' class="weapp_text_link"' + ' data-miniprogram-type="text"' + ' data-miniprogram-appid="' + weappId + '"' + ' data-miniprogram-path="' + (getAttr(str[i], 'data-miniprogram-path') || '') + '"' + ' data-miniprogram-nickname="' + (getAttr(str[i], 'data-miniprogram-nickname') || '') + '"' + ' data-miniprogram-servicetype="' + (getAttr(str[i], 'data-miniprogram-servicetype') || '0') + '"'; valid = true; } else if (bizFakeId) { r += " class=\"js_mention_entry wx_at_link\" data-username=\"".concat(getAttr(str[i], 'data-username'), "\" data-biz=\"").concat(bizFakeId, "\" "); valid = true; } 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, ''); } } return str.join(''); } if (isNoEncode) { if (itemShowType * 1 === 8) desc = desc.html(false); desc = window.__emojiFormat(filterContentWithLinkNWeapp(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 { 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 || '国界只是信息高速公路上的减速带。密码学真的真的很强。 我们可以用它做任何我们想做的事情。它可能提供相当于政府以去中心化的方式所做的事情。\x0a\x0a这是一个由科学家、数学家、哲学家和活动家组成的团体的故事,他们相信互联网与最近在密码学领域的突破相结合,将颠覆社会,迎来一个主权个人主义的新时代。\x0a\x0a这是Reason的Youtube频道2020年10月发布的关于密码朋克Cypherpunks的系列报道Cypherpunks Write Code之四,比特币和历史的终结。(https://www.youtube.com/watch?v=HDKQulqVCQg)\\x0a\\x0a本公众号做了硬编码的中文字幕。'; 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 || '国界只是信息高速公路上的减速带。密码学真的真的很强。 我们可以用它做任何我们想做的事情。它可能提供相当于政府以去中心化的方式所做的事情。\x0a\x0a这是一个由科学家、数学家、哲学家和活动家组成的团体的故事,他们相信互联网与最近在密码学领域的突破相结合,将颠覆社会,迎来一个主权个人主义的新时代。\x0a\x0a这是Reason的Youtube频道2020年10月发布的关于密码朋克Cypherpunks的系列报道Cypherpunks Write Code之四,比特币和历史的终结。(https://www.youtube.com/watch?v=HDKQulqVCQg)\\x0a\\x0a本公众号做了硬编码的中文字幕。'; 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)) { __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; })();

相关推荐
关注或联系我们
添加百川云公众号,移动管理云安全产品
咨询热线:
4000-327-707
百川公众号
百川公众号
百川云客服
百川云客服

Copyright ©2024 北京长亭科技有限公司
icon
京ICP备 2024055124号-2