Py学习  »  Python

手把手:一张图看清编程语言发展史,你也能用Python画出来!

大数据文摘 • 6 年前 • 584 次点击  

大数据文摘作品

作者:Peter Gleeson

编译:周佳玉、丁慧、叶一、小鱼、钱天培


今天文摘菌要教大家制作一张编程语言的关系网络图。如果不知道什么是关系网络图,可以点击下方链接先来看一下最终成果:

http://programming-languages.herokuapp.com/#,


我们可以在这里看到从过去到现在的250多种编程语言之间的“设计影响”的关系,下面是该演示的截图:



接下来,就让我们一起来学做这个关系网络图吧!


在当今的超连接世界,网络在现代生活中无处不在。举个栗子,文摘菌的周末这样开启——通过北京的交通网络进城,然后去最喜欢的咖啡店的一家分店,并将笔记本连上他们的Wi-Fi。接下来,登录各种常用的社交网站。


众所周知,在过去几十年来最有影响力的公司中,有一部分是因为网络的力量而获得成功。


Facebook、Twitter、Instagram、LinkedIn以及一些其他的社交媒体平台都依赖社交网络的小世界特性。这使他们能有效地将用户彼此(以及和广告商)之间连接起来。


谷歌目前的成功主要归因于他们早期在搜索引擎市场上的主导地位——部分原因是他们有能力通过他们的Page Rank网络算法来返回相关的结果。


亚马逊的高效配送网络使他们能够在一些主要城市提供当天发货。


网络算法在人工智能和机器学习等领域也是非常重要的。神经网络领域的研究非常热门。计算机视觉中许多必不可少的特征检测算法,在很大程度上也是依赖于使用网络来对图像的不同部分进行建模。


网络模型也可以解释大量的科学现象,包括有量子力学、生化途径以及生态和社会经济系统等。


那么,鉴于它们不可否认的重要性,我们应该如何更好地理解网络及其属性呢?


网络的数学研究被称为“图论”,是数学中较易理解的分支之一。 本文会介绍简单的网络知识,即便你没有相关背景知识也能轻松学会。


此外,我们将使用Python 3.x和一款非常棒的开源软件Gephi,通过关系网络将过去和现在的一系列编程语言的网络可视化联系起来。


首先,究竟什么是网络呢?


其实上面文摘菌举的栗子已经给了一些线索。交通网络由目的和路径的连接组成。社交网络通过个人和个人之间的关系进行连接。Google的搜索引擎算法通过查看有哪些页面链接到其他页面,来评估不同网页的“顺序”。


更一般地说,网络是可以用节点和边描述的任何系统,或者通俗来讲,就是我们所说的“点和线”。

边连接节点(语言)的例子(该网络表示了编程语言相互影响的关系)


有些系统以这种方式建立网络比较容易。社交网络也许是最明显的例子。计算机文件系统则是另一种方式——文件夹和文件通过其“父”和“子”关系创建连接。


但是,网络的真正威力其实在于,许多系统都可以从网络的角度来建模,即使这起初并不明显。


代表网络


我们应该如何将点和线的图片转换成我们可以压缩的数字信号呢?


其中有一个解决方案是绘制一个邻接矩阵来表示我们的网络。


如果你不熟悉矩阵这个概念,这听起来可能有点吓人,但不要害怕。 把它们想象成可以一次执行许多计算的数字网格就好。下面是一个简单的例子:



在这个矩阵中,每个行和列的交集都是0或1,这取决于各个语言是否被链接。你也可以根据上面的插图观察到!


对于要解决的大多数问题而言,矩阵是以数学方式表示网络的好方法。然而从计算的角度来看,它有时可能会有点麻烦。


例如,即使节点数量相对较少(比如说有1000个),矩阵中的元素数目也会大得多(例如,1000^2 = 1,000,000)。


许多现实世界的系统会产生稀疏网络,在这些网络中,大多数节点只能连接其他所有节点中的一小部分。


如果我们将计算机内存中1000个节点的稀疏网络表示为邻接矩阵,那么我们将在RAM中存储1,000,000个字节的数据。大多数将会是零。这里有一个更为有效的方法可以解决这个问题。


这种方法是使用边列表来代替邻接矩阵。这些正是他们所说的,它们只是一个节点对相互链接的列表。


表示网络的另一种手段是邻接表,它列出了每个节点后面与它进行链接的节点。例如:



收集数据,建立连接


任何网络模型以及可视化的表现都取决于构建网络本身所用的数据质量好坏。除了确保数据是准确和完整的同时,我们也需要一种推断节点之间边的合理方法。


这是相当关键的一步,随后对网络进行的任何分析和推断都取决于“关联标准”的合理性。


例如,在社交网络分析中,你可能会根据人们是否在社交媒体上相互关联来创建人与人之间的联系。在分子生物学中,你可能会基于基因的共同表达建立连接。


通常,我们还可以给边分配权重,从而体现关系的“强度”。


例如,对于网上零售的情况,可以根据产品被同时购买的频率来计算权重。用高权重的边连接经常被同时购买的产品,用低权重的边连接偶尔被同时购买的产品。和偶尔被同时购买的产品相比,那些不会被同时购买的产品根本就不会被网络连接。


正如你想的那样,将节点彼此连接的方法有可能很复杂。


但是对于本教程,我们将使用更简单的方式连接编程语言。我们要依靠维基百科。


维基百科所取得的的成功证明了它的可靠性。文章写作的开源合作方法也应该保证一定程度的客观性。


而且,它的页面结构相对一致,使其成为试用网页抓取技术的便利场所。


另一个便利工具是覆盖面广泛的、有据可查的维基百科API,这使得信息检索更容易。接下来让我们一起开始吧。


第一步:安装Gephi


Gephi可在Linux、Mac和Windows的环境下进行安装。


对于这个项目,我使用了Lubuntu。如果你使用的是Ubuntu / Debian,那么你可以按照下面的步骤来启动和运行Gephi。如果不是,那么安装过程也不会差太多。


下载最新版本的Gephi到你的系统(在撰写本文时是v.0.9.1)。准备就绪后,你需要提取文件。



你可能需要检查你的Java JRE版本。Gephi需要最新版本。在我刚刚安装的Lubuntu上,我只安装了default-jre,下面的一切将建立在此基础上。



在你准备好进行安装之前还有一步。为了将图表导出到Web,你可以使用Gephi的Sigma.js插件。


从Gephi的菜单栏中选择“工具”选项,然后选择“插件”。


点击“可用插件”标签并选择“SigmaExporter”(我也安装了JSON导出器,因为它是另一个有用的插件)。


点击“安装”按钮,你将完成整个安装过程。安装结束后,你需要重新启动Gephi。


第二步:编写Python脚本


本教程将使用python 3.x以及一些模块来进行简化。使用pip模块安装程序,需运行一下命令:



现在,在一个新的目录中,创建一个名为script.py的文件,并在你最喜欢的代码编辑器/ IDE中打开它。以下是主要逻辑的大纲:


首先,你需要有一个编程语言的列表。


接下来,通过该列表并检索维基百科相关文章的HTML。


从中提取出每种语言所影响的编程语言列表。这是我们连接节点的粗略标准。


同时,我们可以抓取一些关于每种语言的元数据。


最后,将收集的所有数据写入一个.csv文件。


完整的脚本在这里:

(https://gist.github.com/anonymous/2a6c841fe04ebc6d55acc259b4ac4f72)。


导入模块


在script.py中,首先导入一些模块。



准备好后——从创建一个节点的列表开始。这是Wikipedia模块派上用场的地方。它使得访问维基百科API非常容易。


添加下面的代码:



保存并运行上面的脚本,将看到打印出“List of programming languages”维基百科文章中的所有链接。


另外,还需要手动检查自动收集的数据。快速浏览后我们可以发现,除了许多实际的编程语言之外,该脚本还提供了一些额外的链接。


如:可能会看到“List of markup languages”,“Comparison of programming languages”等。


虽然Gephi允许你移除不想包含的节点,但为了节省时间,还是让我们先进行一轮数据清洗。



这些代码定义了要从数据中移除的子字符串列表。运行该脚本时遍历数据,移除所有包含不需要的子字符串的元素。


在Python语言中,完成这些只需要一行代码!


其他辅助函数


现在我们可以开始从wikipedia抓取数据并建立一个边列表(并收集所有元数据)。为了更简便,让我们首先定义一些函数。


抓取HTML


第一个函数使用BeautifulSoup模块来获取每种语言的Wikipedia页面的HTML。



这个函数使用urllib.request模块来获取“https://en.wikipedia.org/wiki/”+“编程语言”页面的HTML。


然后传给BeautifulSoup,它将读取HTML并解析为一个可以用来搜索信息的对象。


接下来,使用find_all()方法抓取感兴趣的HTML元素。


下面,是每种编程语言文章顶部的汇总表。该如何识别呢?


最简单的方法是访问其中一个编程语言页面。在这里,可以简单地使用浏览器的开发工具来检查感兴趣的元素。汇总表有HTML标记

和CSS类“infobox”和“vevent”,因此可以使用这些来标识HTML中的表格。


用参数指定它:


find_all()返回符合标准的所有元素列表。为了指定感兴趣的元素,需要添加索引[0]。如果函数执行成功,则返回table对象,否则,返回None。



在使用了自动数据收集程序的情况下,全面的异常处理是非常重要的。如果没有,那么在最好的情况下如果脚本崩溃了,数据抓取程序需要重新开始执行。


在最坏的情况下,你获得数据集将包含不一致性和错误,这将为你后续的工作买下隐患。


检索元数据


下一个函数使用table对象来查找一些元数据。下面给出在表格中搜索语言第一次出现的年份的代码。



这个简短的函数以table对象作为参数,并调用BeautifulSoup的get_text()函数生成一个字符串。


下一步是创建一个名为year的子字符串。该字符串存储了在“appear”这个词首次出现之后的30个字符。这个字符串应该包含语言第一次出现的年份。


为了仅提取年份,使用正则表达式(通过re模块)来匹配任何以1到3之间的数字开头、并紧邻三个数字的字符串。



如果执行成功,函数将返回一个整数的year。否则,我们会得到“Could not determine”。你可能还想进一步挖掘元数据,例如范例,设计者或打字规律。


收集链接


我们还需要一个函数–该函数读入给定语言的table对象,输出一个包含其他编程语言的列表。

    


仔细观察上面代码中嵌套部分,到底是怎么回事呢?


这个函数利用了table对象具有结构一致性的事实。表中的信息存储在行中(相关的HTML标签是

)。其中一行包含文字“\ nInfluenced \ n”。函数的第一部分查找这是哪一行。


一旦找到这一行,就可以确定下一行包含了被当前行影响的每种编程语言的链接。使用find_all(“a”)便可查找这些链接 - 其中参数“a”对应于HTML标签


对于每个链接j,将其[“title”]属性添加到名为out的列表。对[“title”]属性感兴趣的原因是因为它将完全匹配存储在节点中的语言名称。


例如,Java作为“Java(编程语言)”存储在节点中,因此需要在整个数据集中使用这个确切的名称。


如果执行成功,getLinks()将返回一组编程语言。该函数的其余部分进行了异常处理,以防程序在某一阶段出现问题。


收集数据


最后,在一切准备就绪后执行脚本,收集数据并将其存储在两个列表对象中。



现在编写一个循环,将先前定义的函数应用于nodes中的每个词条,并将输出存储在edgeList和meta中。



该函数使用节点中的每种语言,并尝试从维基百科页面检索汇总表。


然后,该函数将检索表中列出的与目标语言所关联的全部语言。


对于同时出现在节点列表中的每种语言,将一个元素以[“source,target”]的形式添加到edgeList。通过这种方式,建立一个边的列表传给Gephi。


出于调试的目的,打印添加到edgeList的每个元素——这样做仅仅为了确保一切都工作。如果想要更彻底地调试,也可以添加打印语句到except语句中。


接下来,获取语言的名称和年份,并将其添加到元列表中。


写进CSV文件


一旦循环运行,最后一步是将edgeList和meta的内容写入到CSV文件。通过使用前面导入的csv模块,完成上一步骤就容易多了。



完成了!保存脚本,并从终端运行:

$ python3 script.py


当构建边列表时,你可以看到脚本输出了source-target对。确保网络连接的稳定性后,你就可以坐等结果了,此时脚本将发挥其魔力。


第三步:用Gephi建立图形


希望你已经安装并运行了Gephi。现在你可以创建一个新项目,并使用你收集的数据来构建有向图。有向图将显示不同的编程语言是如何相互影响的!


首先在Gephi中创建一个新项目,然后切换到“数据实验室”窗口。Gephi中提供了一个扩展式的接口来处理数据。首先要导入列表。


点击“导入电子表格”。


选择由Python脚本生成的edge_list.csv文件。确保Gephi中使用逗号作为分隔符。


从列表类型中选择“边列表”


点击“下一步”,导入源和目标列作为字符串,并检查。


用一个节点列表来更新数据实验室。现在,导入 metadata.csv文件。这一次,从列表类型中选择“节点列表”。


切换到“Preview”选项卡,查看网络的外观。


这时的图形看起来颜色十分单一,而且杂乱无章,就像一盘意大利面。所以我们接下来要进行图像美化。


图像美化


我们可以通过各种方式来演示图像,也可以尽情发挥自己的创意。另外,关于网络可视化还要考虑以下三件事情:


节点定位:生成网络布局模式的算法有很多,比较流行的是fruchterman - reingold算法,而且Gephi支持该算法。


节点大小:图中节点的大小可以用来表示一些有趣的属性。通常,这是一个中心性度量。度量中心性的方法有很多,但它们都反映了给定节点的“重要性”,即它与网络的其他部分关联的紧密程度。


节点着色:我们还可以使用颜色来显示节点的某些属性。通常,颜色用来表示群落结构,广泛定义为“与图的其余部分相比关联更紧密的一组节点”。在社交网络中,群落结构可以揭示个人的友情、家庭或专业团体之间的关联。有几种算法可以检测群落结构,Gephi自带的检测算法是Louvain方法。


要执行上述步骤,还需要计算一些统计数据。切换到“Overview”窗口。在这里你可以看到右侧的一个面板。它包含一个“Statistics”选项卡。打开它,你将看到一系列选项。


Gephi具有许多内置的统计功能。对于每种功能,点击“Run”将生成一个报告,该报告揭示了关于网络的一些洞见。


如果要修改网络的外观,我们可以转向左边的面板。


在“Layout”选项卡中,可以选择要使用的布局算法。点击“运行”,实时观看图表的变化!看看你认为哪种布局算法效果最好。


在Layout选项卡之上是“Appearance”选项卡。在这里,你可以为节点和各条边的颜色、大小和标签进行设置,也可以根据数据的属性来配置(包括你要计算的数据)。


一个建议:


根据模块化属性将节点着色。着色的根据是节点的群落成员关系。


根据节点的平均程度来确定节点的大小。关联紧密的节点会比关联稀疏的节点显得大。


不过,也可以尝试设计一个最喜欢的布局。一旦对图形外观感到满意,就可以进入最后一个步骤——将图形导出至网页!


第四步:使用Sigma.js插件


既然已经构建了一个可以在Gephi中查看的网络可视化,接下来可以选择使用屏幕截图,或者以SVG、PDF或PNG格式保存图形。


如果已经安装了Sigma.js插件,也可以把图形导出到HTML,这将会创建一个交互式可视化,不仅可以在线上发布,也可以上传到GitHub,与他人分享。


可从Gephi的菜单栏选择“Export >Sigma.js模板…”。


按要求填写详细信息。确保选择导出项目所在的目录。你也可以更改图形的标题、图例、描述、悬停和许多其他细节。当你准备好了,点击“确定”。


现在,如果你打开导出项目所在的目录,你将看到一个文件夹,其中包含Sigma.js生成的所有文件。


在你最喜欢的浏览器打开index.html文件。哈!你的网络!如果你知道一些CSS和JavaScript,可以载入各种生成的文件到你的网络中,以便按照你的意愿调整输出的网络。


脑洞开一开,网络画起来


许多系统可以作为网络进行建模和可视化。图论是数学的一个分支,它提供了帮助理解网络结构和属性的工具。


使用Python从Wikipedia获取数据,构建编程语言影响图。关联标准是一种给定的语言是否能被列为对设计另一种语言的影响。


Gephi和Sigma.js是分析和可视化网络的开源工具。它们可以让你以图像、PDF或Web格式导出网络。


模仿本文的方法,你还可以为很多其他的关系建模并做出可视化。脑洞开一开,网络画起来。


原文链接:

https://medium.freecodecamp.org/how-to-visualize-the-programming-language-influence-graph-7f1b765b44d1


机器学习和人工智能岗位

求职福利

 

看书看视频?刷题?蹭项目经历?海投?

带你解锁机器学习高效求职新方式

AI时代,时间和机会是极具回报价值的投资!

 

扫描二维码,获取稀牛学院

求职资源大礼包


志愿者介绍

回复志愿者”加入我们

往期精彩文章

点击图片阅读

深度学习的硬件之争关键年:NVIDIA, AMD, Intel鹿死谁手?

0) break; outerWidth += parseFloat(parent_style.paddingLeft) + parseFloat(parent_style.paddingRight) + parseFloat(parent_style.marginLeft) + parseFloat(parent_style.marginRight) + parseFloat(parent_style.borderLeftWidth) + parseFloat(parent_style.borderRightWidth); parent = parent.parentNode; } return parent_width; } var getOuterW=function(dom){ var style=getComputedStyle(dom), w=0; if(!!style){ w = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight) + parseFloat(style.borderLeftWidth) + parseFloat(style.borderRightWidth); } return w; }; var getOuterH =function(dom){ var style=getComputedStyle(dom), h=0; if(!!style){ h = parseFloat(style.paddingTop) + parseFloat(style.paddingBottom) + parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); } return h; }; var insertAfter = function(dom,afterDom){ var _p = afterDom.parentNode; if(!_p){ return; } if(_p.lastChild === afterDom){ _p.appendChild(dom); }else{ _p.insertBefore(dom,afterDom.nextSibling); } }; var getQuery = function(name,url){ var u = arguments[1] || window.location.search, reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"), r = u.substr(u.indexOf("\?")+1).match(reg); return r!=null?r[2]:""; }; (function(){ var images = document.getElementsByTagName('img'); var length = images.length; var max_width = getMaxWith(); for (var i = 0; i < length; ++i) { var src_ = images[i].getAttribute('data-src'); var realSrc = images[i].getAttribute('src'); if (!src_ || realSrc) continue; var width_ = 1 * images[i].getAttribute('data-w') || max_width; var ratio_ = 1 * images[i].getAttribute('data-ratio'); var height = 100; if (ratio_ && ratio_ > 0) { var img_style = getComputedStyle(images[i]); var init_width = images[i].style.width; if (init_width) { images[i].setAttribute('_width', init_width); if (init_width != 'auto') width_ = parseFloat(img_style.width); } var parent_width = getParentWidth(images[i])||max_width; var width = width_ > parent_width ? parent_width : width_; var img_padding_border = getOuterW(images[i])||0; var img_padding_border_top_bottom = getOuterH(images[i])||0; height = (width - img_padding_border) * ratio_ + img_padding_border_top_bottom; images[i].style.cssText += ";width: " + width + "px !important;"; if (isIE) { var url = images[i].getAttribute('data-src'); images[i].src = url; } else { if(width > 40 && height > 40){ images[i].className += ' img_loading'; } images[i].src = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg=="; } } else { images[i].style.cssText += ";visibility: hidden !important;"; } images[i].style.cssText += ";height: " + height + "px !important;"; } })(); window.__videoDefaultRatio=16/9; window.__getVideoWh = function(dom){ var max_width = getMaxWith(), width = max_width, ratio_ = dom.getAttribute('data-ratio')*1||(4/3), arr = [4/3, 16/9], ret = arr[0], abs = Math.abs(ret - ratio_); for(var j=1,jl=arr.length;j parent_width ? parent_width : width, outerW = getOuterW(dom)||0, outerH = getOuterH(dom)||0, videoW = width - outerW, videoH = videoW/ratio_, height = videoH + outerH; return {w:width,h:height,vh:videoH,vw:videoW,ratio:ratio_}; }; (function(){ var iframe = document.getElementsByTagName('iframe'); for (var i=0,il=iframe.length;i=0 && child.getAttribute("data-vid")==vid){ child.style.cssText += "height: " + h + "px !important;"; child.style.display = ""; } } } } })(); })(); var not_in_mm_css = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/style/page/appmsg/not_in_mm36906d.css"; var windowwx_css = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/style/page/appmsg/page_mp_article_improve_winwx31619e.css"; var article_improve_combo_css = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/style/page/appmsg/page_mp_article_improve_combo3b1cff.css"; var tid = ""; var aid = ""; var clientversion = ""; var appuin = "MjM5MTQzNzU2NA=="||""; var source = "0"; var ascene = ""; var subscene = ""; var abtest_cookie = ""; var scene = 75; var itemidx = ""; var appmsg_token = ""; var _copyright_stat = "1"; var _ori_article_type = "科技互联网"; var nickname = "大数据文摘"; var appmsg_type = "9"; var ct = "1515732507"; var publish_time = "2018-01-12" || ""; var user_name = "gh_acb7ca9153bc"; var user_name_new = ""; var fakeid = ""; var version = ""; var is_limit_user = "0"; var round_head_img = "http://img2.jintiankansha.me/get?src=http://mmbiz.qpic.cn/mmbiz/wc7YNPm3YxWgq7whibV4y1aocicjquliaSp7s2gibvmibTXEQkcP0aZH35ib7q972eibB5GibRtDb5RhbNlz9fib44khBibA/0?wx_fmt=png"; var ori_head_img_url = "http://wx.qlogo.cn/mmhead/Q3auHgzwzM46WJlQ8GYRWPhThl25rSKJEYBm408fnEkYS9DUkiaSxGg/132"; var msg_title = "手把手:一张图看清编程语言发展史,你也能用Python画出来!"; var msg_desc = "今天文摘菌要教大家制作一张编程语言的关系网络图"; var msg_cdn_url = "http://img2.jintiankansha.me/get?src=http://mmbiz.qpic.cn/mmbiz_jpg/wc7YNPm3YxXKGDQwZD8IY2WJznofJG7tzbzvyXHkx4XhOIkFO8lQBiaFIrTeHHLf9bZL2QwRlIXYnibPH3zfvsBQ/0?wx_fmt=jpeg"; var msg_link = "http://mp.weixin.qq.com/s?__biz=MjM5MTQzNzU2NA==\x26amp;mid=2651656132\x26amp;idx=1\x26amp;sn=fb49549c7e7620128036226a8e2a1b53\x26amp;chksm=bd4c28578a3ba141b0c563056d3bc6116023912e99855f111d8b4f9002ce629ac2123137b155#rd"; var user_uin = "0"*1; var msg_source_url = ''; var img_format = 'jpeg'; var srcid = ''; var req_id = '1300QftM7dtpIfUbJ5GbmYcg'; var networkType; var appmsgid = '' || '2651656132'|| ""; var comment_id = "1750081133" || "1750081133" * 1; var comment_enabled = "" * 1; var is_need_reward = "0" * 1; var is_https_res = ("" * 1) && (location.protocol == "https:"); var msg_daily_idx = "1" || ""; var profileReportInfo = "" || ""; var devicetype = ""; var source_encode_biz = ""; var source_username = ""; var reprint_ticket = ""; var source_mid = ""; var source_idx = ""; var source_biz = ""; var show_comment = ""; var __appmsgCgiData = { wxa_product : ""*1, show_msg_voice: "0"*1, can_use_page : "0"*1, is_wxg_stuff_uin : "0"*1, card_pos : "", copyright_stat : "1", source_biz : "", hd_head_img : "http://wx.qlogo.cn/mmhead/Q3auHgzwzM46WJlQ8GYRWPhThl25rSKJEYBm408fnEkYS9DUkiaSxGg/0"||(window.location.protocol+"//"+window.location.host + "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/pic/appmsg/pic_rumor_link.2x264e76.jpg") }; var _empty_v = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/pic/pages/voice/empty26f1f1.mp3"; var copyright_stat = "1" * 1; var pay_fee = "" * 1; var pay_timestamp = ""; var need_pay = "" * 1; var need_report_cost = "0" * 1; var use_tx_video_player = "0" * 1; var appmsg_fe_filter = "contenteditable"; var friend_read_source = "" || ""; var friend_read_version = "" || ""; var friend_read_class_id = "" || ""; var is_only_read = "1" * 1; var read_num = "" * 1; var like_num = "" * 1; var liked = "" == 'true' ? true : false; var is_temp_url = "" ? 1 : 0; var send_time = ""; var icon_emotion_switch = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/appmsg/emotion/icon_emotion_switch.2x2f1273.png"; var icon_emotion_switch_active = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/appmsg/emotion/icon_emotion_switch_active.2x2f1273.png"; var icon_loading_white = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/common/icon_loading_white2805ea.gif"; var icon_audio_unread = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/appmsg/audio/icon_audio_unread26f1f1.png"; var icon_qqmusic_default = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/appmsg/qqmusic/icon_qqmusic_default.2x26f1f1.png"; var icon_qqmusic_source = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/appmsg/qqmusic/icon_qqmusic_source393e3a.png"; var icon_kugou_source = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/appmsg/kugou/icon_kugou_source393e3a.png"; var topic_default_img = '//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/appmsg/topic/pic_book_thumb.2x2e4987.png'; var comment_edit_icon = '//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/appmsg/icon_edit25ded2.png'; var comment_loading_img = '//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/common/icon_loading_white2805ea.gif'; var voice_in_appmsg = { "1":"1" }; var wxa_img_alert = "" != 'false'; var weapp_sn_arr_json = "" || ""; var ban_scene = "0" * 1; var svr_time = "1515772937" * 1; var is_transfer_msg = ""*1||0; var malicious_title_reason_id = "0" * 1; window.wxtoken = ""; window.is_login = '0' * 1; window.__moon_initcallback = function(){ if(!!window.__initCatch){ window.__initCatch({ idkey : 27611+2, startKey : 0, limit : 128, badjsId: 43, reportOpt : { uin : uin, biz : biz, mid : mid, idx : idx, sn : sn }, extInfo : { network_rate : 0.01, badjs_rate: 0.1 } }); } } window.__moon_host = 'res.wx.qq.com';window.__moon_mainjs = 'appmsg/index.js';window.moon_map = {"new_video/player.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/new_video/player.html39e24c.js","biz_wap/zepto/touch.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/zepto/touch34c264.js","biz_wap/zepto/event.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/zepto/event34c264.js","biz_wap/zepto/zepto.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/zepto/zepto34c264.js","page/pages/video.css":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/style/page/pages/video.css3767b8.js","a/appdialog_confirm.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/appdialog_confirm.html34f0d8.js","widget/wx_profile_dialog_primary.css":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/style/widget/wx_profile_dialog_primary.css34f0d8.js","appmsg/emotion/caret.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/emotion/caret278965.js","new_video/player.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/new_video/player39e24c.js","a/appdialog_confirm.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/appdialog_confirm34c32a.js","biz_wap/jsapi/cardticket.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/cardticket34c264.js","biz_common/utils/emoji_panel_data.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/emoji_panel_data3518c6.js","biz_common/utils/emoji_data.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/emoji_data3518c6.js","appmsg/emotion/textarea.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/emotion/textarea353f34.js","appmsg/emotion/nav.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/emotion/nav278965.js","appmsg/emotion/common.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/emotion/common3518c6.js","appmsg/emotion/slide.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/emotion/slide2a9cd9.js","pages/loadscript.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/loadscript39aac6.js","pages/music_report_conf.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/music_report_conf39aac6.js","pages/report.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/report3a9bef.js","pages/player_adaptor.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/player_adaptor39d6ee.js","pages/music_player.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/music_player3af14e.js","appmsg/emotion/dom.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/emotion/dom31ff31.js","appmsg/comment_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/comment_tpl.html36c376.js","biz_wap/utils/fakehash.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/fakehash38c7af.js","biz_common/utils/wxgspeedsdk.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/wxgspeedsdk3518c6.js","a/sponsor.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/sponsor39e101.js","a/app_card.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/app_card393ef4.js","a/ios.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/ios393966.js","a/android.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/android393966.js","a/profile.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/profile31ff31.js","a/cpc_a_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/cpc_a_tpl.html3a7ab9.js","a/sponsor_a_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/sponsor_a_tpl.html36c7cf.js","a/a_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/a_tpl.html393ef4.js","a/mpshop.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/mpshop311179.js","a/wxopen_card.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/wxopen_card3a95b8.js","a/card.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/card311179.js","biz_wap/utils/position.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/position34c264.js","a/a_report.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/a_report393966.js","appmsg/my_comment_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/my_comment_tpl.html36906d.js","appmsg/cmt_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/cmt_tpl.html369d00.js","sougou/a_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/sougou/a_tpl.html2c6e7c.js","appmsg/emotion/emotion.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/emotion/emotion353f34.js","biz_wap/utils/wapsdk.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/wapsdk34c264.js","biz_common/utils/report.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/report3518c6.js","appmsg/open_url_with_webview.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/open_url_with_webview3145f0.js","biz_common/utils/http.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/http3518c6.js","biz_common/utils/cookie.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/cookie3518c6.js","appmsg/topic_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/topic_tpl.html31ff31.js","pages/weapp_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/weapp_tpl.html36906d.js","biz_common/utils/monitor.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/monitor3518c6.js","appmsg/weapp_common.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/weapp_common3af55a.js","pages/voice_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/voice_tpl.html38518d.js","pages/kugoumusic_ctrl.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/kugoumusic_ctrl393e3a.js","pages/qqmusic_ctrl.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/qqmusic_ctrl39b68c.js","pages/voice_component.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/voice_component3af14e.js","pages/qqmusic_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/qqmusic_tpl.html393e3a.js","new_video/ctl.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/new_video/ctl2d441f.js","a/testdata.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/testdata3a6969.js","appmsg/reward_entry.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/reward_entry3b1cff.js","appmsg/comment.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/comment3944ad.js","appmsg/like.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/like375fea.js","pages/version4video.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/version4video3a9bef.js","a/a.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/a3b1088.js","rt/appmsg/getappmsgext.rt.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/rt/appmsg/getappmsgext.rt2c21f6.js","biz_wap/utils/storage.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/storage34c264.js","biz_common/tmpl.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/tmpl3518c6.js","appmsg/share_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/share_tpl.html36906d.js","appmsg/img_copyright_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/img_copyright_tpl.html2a2c13.js","pages/video_ctrl.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/video_ctrl36ebcf.js","biz_common/ui/imgonepx.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/ui/imgonepx3518c6.js","biz_common/utils/respTypes.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/respTypes3518c6.js","biz_wap/utils/log.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/log34c264.js","sougou/index.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/sougou/index36913b.js","biz_wap/safe/mutation_observer_report.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/safe/mutation_observer_report34c264.js","appmsg/fereport.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/fereport3b1088.js","appmsg/report.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/report3404b3.js","appmsg/report_and_source.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/report_and_source3a7477.js","appmsg/page_pos.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/page_pos3a95b8.js","appmsg/cdn_speed_report.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/cdn_speed_report3097b2.js","appmsg/wxtopic.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/wxtopic31a3be.js","appmsg/new_index.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/new_index36906d.js","appmsg/weapp.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/weapp3af55a.js","appmsg/weproduct.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/weproduct3af55a.js","appmsg/voicemsg.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/voicemsg3b1748.js","appmsg/autoread.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/autoread3af14e.js","appmsg/voice.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/voice38518d.js","appmsg/qqmusic.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/qqmusic39dc43.js","appmsg/iframe.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/iframe39ab71.js","appmsg/product.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/product393966.js","appmsg/review_image.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/review_image3af55a.js","appmsg/outer_link.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/outer_link275627.js","appmsg/copyright_report.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/copyright_report2ec4b2.js","appmsg/async.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/async3b1cff.js","biz_wap/ui/lazyload_img.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/ui/lazyload_img3af55a.js","biz_common/log/jserr.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/log/jserr3518c6.js","appmsg/share.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/share3af14e.js","appmsg/cdn_img_lib.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/cdn_img_lib38b7bb.js","biz_common/utils/url/parse.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/url/parse36ebcf.js","page/appmsg/not_in_mm.css":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/style/page/appmsg/not_in_mm.css36906d.js","page/appmsg/page_mp_article_improve_combo.css":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/style/page/appmsg/page_mp_article_improve_combo.css3b1cff.js","page/appmsg_new/not_in_mm.css":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/style/page/appmsg_new/not_in_mm.css36f05c.js","page/appmsg_new/combo.css":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/style/page/appmsg_new/combo.css3b1cff.js","biz_wap/jsapi/core.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/core3b0568.js","biz_common/dom/event.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/dom/event3a25e9.js","appmsg/test.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/test354009.js","biz_wap/utils/mmversion.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/mmversion34c264.js","appmsg/max_age.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/max_age2fdd28.js","biz_common/dom/attr.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/dom/attr3518c6.js","biz_wap/utils/ajax.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/ajax38c31a.js","appmsg/log.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/log300330.js","biz_common/dom/class.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/dom/class3518c6.js","biz_wap/utils/device.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/device34c264.js","biz_common/utils/string/html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/string/html3518c6.js","appmsg/index.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/index3b1748.js"}; window.__mooninline=1; window.setTimeout(function() { function __moonf__(){ if(!window.__moonhasinit){ window.__moonhasinit=!0,window.__moonclientlog=[],window.__wxgspeeds&&(window.__wxgspeeds.moonloadedtime=+new Date), "object"!=typeof JSON&&(window.JSON={ stringify:function(){ return""; }, parse:function(){ return{}; } }); var e=function(){ function e(e){ try{ var o; /(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)?o="writeLog":/(Android)/i.test(navigator.userAgent)&&(o="log"), o&&t(o,e); }catch(n){ throw console.error(n),n; } } function t(e,o){ e&&top.window.WeixinJSBridge&&top.window.WeixinJSBridge.invoke?top.window.WeixinJSBridge.invoke(e,{ level:"info", msg:"[WechatFe][moon]"+o }):setTimeout(function(){ top.window.document.addEventListener?top.window.document.addEventListener("WeixinJSBridgeReady",function(){ t(e,o); },!1):top.window.document.attachEvent&&(top.window.document.attachEvent("WeixinJSBridgeReady",function(){ t(e,o); }),top.window.document.attachEvent("onWeixinJSBridgeReady",function(){ t(e,o); })); },0); } var n; localStorage&&JSON.parse(localStorage.getItem("__WXLS__moonarg"))&&"fromls"==JSON.parse(localStorage.getItem("__WXLS__moonarg")).method&&(n=!0), e(" moon init, moon_inline:"+window.__mooninline+", moonls:"+n),function(){ var e={},o={},t={}; e.COMBO_UNLOAD=0,e.COMBO_LOADING=1,e.COMBO_LOADED=2; var n=function(e,t,n){ if(!o[e]){ o[e]=n; for(var r=3;r--;)try{ moon.setItem(moon.prefix+e,n.toString()),moon.setItem(moon.prefix+e+"_ver",moon_map[e]); break; }catch(i){ moon.clear(); } } },r=window.alert; window.__alertList=[],window.alert=function(e){ r(e),window.__alertList.push(e); }; var i=function(e){ if(!e||!o[e])return null; var n=o[e]; if("function"==typeof n&&!t[e]){ var a={},s={ exports:a },c=n(i,a,s,r); n=o[e]=c||s.exports,t[e]=!0; } if(".css"===e.substr(-4)){ var d=document.getElementById(e); if(!d){ d=document.createElement("style"),d.id=e; var _=/url\s*\(\s*\/(\"(?:[^\\\"\r\n\f]|\\[\s\S])*\"|'(?:[^\\'\n\r\f]|\\[\s\S])*'|[^)}]+)\s*\)/g,m=window.testenv_reshost||window.__moon_host||"res.wx.qq.com"; n=n.replace(_,"url(//"+m+"/$1)"),d.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(d); } } return n; }; e.combo_status=e.COMBO_UNLOAD,e.run=function(){ var o=e.run.info,t=o&&o[0],n=o&&o[1]; if(t&&e.combo_status==e.COMBO_LOADED){ var r=i(t); n&&n(r); } },e.use=function(o,t){ window.__wxgspeeds&&(window.__wxgspeeds.seajs_use_time=+new Date),e.run.info=[o,t], e.run(); },window.define=n,window.seajs=e; }(),function(){ if(window.__nonce_str){ var e=document.createElement; document.createElement=function(o){ var t=e.apply(this,arguments); return"object"==typeof o&&(o=o.toString()),"string"==typeof o&&"script"==o.toLowerCase()&&t.setAttribute("nonce",window.__nonce_str), t; }; } window.addEventListener&&window.__DEBUGINFO&&Math.random()<.01&&window.addEventListener("load",function(){ var e=document.createElement("script"); e.src=__DEBUGINFO.safe_js,e.type="text/javascript",e.async=!0; var o=document.head||document.getElementsByTagName("head")[0]; o.appendChild(e); }); }(),function(){ function t(e){ return"[object Array]"===Object.prototype.toString.call(e); } function n(e){ return"[object Object]"===Object.prototype.toString.call(e); } function r(e){ var t=e.stack+" "+e.toString()||""; try{ if(window.testenv_reshost){ var n="http(s)?://"+window.testenv_reshost,r=new RegExp(n,"g"); t=t.replace(r,""); }else t=t.replace(/http(s)?:\/\/res\.wx\.qq\.com/g,""); for(var r=/\/([^.]+)\/js\/(\S+?)\.js(\,|:)?/g;r.test(t);)t=t.replace(r,function(e,o,t,n){ return t+n; }); }catch(e){ t=e.stack?e.stack:""; } var i=[]; for(o in u)u.hasOwnProperty(o)&&i.push(o+":"+u[o]); return i.push("STK:"+t.replace(/\n/g,"")),i.join("|"); } function i(e){ if(!e){ var o=window.onerror; window.onerror=function(){},f=setTimeout(function(){ window.onerror=o,f=null; },50); } } function a(e,o,t){ if(!/^mp\.weixin\.qq\.com$/.test(location.hostname)){ var n=[]; t=t.replace(location.href,(location.origin||"")+(location.pathname||"")).replace("#wechat_redirect","").replace("#rd","").split("&"); for(var r=0,i=t.length;i>r;r++){ var a=t[r].split("="); a[0]&&a[1]&&n.push(a[0]+"="+encodeURIComponent(a[1])); } var s=new window.Image; return void(s.src=(o+n.join("&")).substr(0,1024)); } var c; if(window.ActiveXObject)try{ c=new ActiveXObject("Msxml2.XMLHTTP"); }catch(d){ try{ c=new ActiveXObject("Microsoft.XMLHTTP"); }catch(_){ c=!1; } }else window.XMLHttpRequest&&(c=new XMLHttpRequest); c&&(c.open(e,o,!0),c.setRequestHeader("cache-control","no-cache"),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"), c.setRequestHeader("X-Requested-With","XMLHttpRequest"),c.send(t)); } function s(e){ return function(o,t){ if("string"==typeof o)try{ o=new Function(o); }catch(n){ throw n; } var r=[].slice.call(arguments,2),a=o; return o=function(){ try{ return a.apply(this,r.length&&r||arguments); }catch(e){ throw e.stack&&console&&console.error&&console.error("[TryCatch]"+e.stack),_&&window.__moon_report&&(window.__moon_report([{ offset:O, log:"timeout_error;host:"+top.location.host, e:e }]),i(f)),e; } },e(o,t); }; } function c(e){ return function(o,t,n){ if("undefined"==typeof n)var n=!1; var r=this,a=t||function(){}; return t=function(){ try{ return a.apply(r,arguments); }catch(e){ throw e.stack&&console&&console.error&&console.error("[TryCatch]"+e.stack),_&&window.__moon_report&&(window.__moon_report([{ offset:y, log:"listener_error;type:"+o+";host:"+top.location.host, e:e }]),i(f)),e; } },a.moon_lid=b,D[b]=t,b++,e.call(r,o,t,n); }; } function d(e){ return function(o,t,n){ if("undefined"==typeof n)var n=!1; var r=this; return t=D[t.moon_lid],e.call(r,o,t,n); }; } var _,m,w,l,u,p,f,h=/MicroMessenger/i.test(navigator.userAgent),g=window.define,v=0,y=2,x=4,O=9,j=10; if(window.__initCatch=function(e){ _=e.idkey,m=e.startKey||0,w=e.limit,l=e.badjsId,u=e.reportOpt||"",p=e.extInfo||{}, p.rate=p.rate||.5; },window.__moon_report=function(e,o){ var i=.5; if(p&&p.rate&&(i=p.rate),o&&"number"==typeof o&&(i=o),!(!/mp\.weixin\.qq\.com/.test(location.href)&&!/payapp\.weixin\.qq\.com/.test(location.href)||Math.random()>i||!h||top!=window&&!/mp\.weixin\.qq\.com/.test(top.location.href))&&(n(e)&&(e=[e]), t(e)&&""!=_)){ var s="",c=[],d=[],u=[],f=[]; "number"!=typeof w&&(w=1/0); for(var g=0;gw||"number"!=typeof v.offset||v.offset==x&&p&&p.network_rate&&Math.random()>=p.network_rate)){ var y=1/0==w?m:m+v.offset; c[g]="[moon]"+_+"_"+y+";"+v.log+";"+r(v.e||{})||"",d[g]=y,u[g]=1; } } for(var O=0;O0){ a("POST",location.protocol+"//mp.weixin.qq.com/mp/jsmonitor?","idkey="+f.join(";")+"&r="+Math.random()+"&lc="+c.length+s); var i=1; if(p&&p.badjs_rate&&(i=p.badjs_rate),l&&Math.random()=10))try{ S.call(window.localStorage,e,o); }catch(t){ t.stack&&console&&console.error&&console.error("[TryCatch]"+t.stack),window.__moon_report([{ offset:j, log:"localstorage_error;"+t.toString(), e:t }]),I++,I>=3&&window.moon&&window.moon.clear&&moon.clear(); } }; } window.seajs&&g&&(window.define=function(){ for(var o,t=[],n=arguments&&arguments[0],a=0,s=arguments.length;s>a;a++){ var c=o=arguments[a]; "function"==typeof o&&(o=function(){ try{ return c.apply(this,arguments); }catch(o){ throw"string"==typeof n&&console.error("[TryCatch][DefineeErr]id:"+n),o.stack&&console&&console.error&&console.error("[TryCatch]"+o.stack), _&&window.__moon_report&&(window.__moon_report([{ offset:v, log:"define_error;id:"+n+";", e:o }]),i(f)),e(" [define_error]"+JSON.stringify(r(o))),o; } },o.toString=function(e){ return function(){ return e.toString(); }; }(arguments[a])),t.push(o); } return g.apply(this,t); }); }(),function(o){ function t(e,o,t){ return window.__DEBUGINFO?(window.__DEBUGINFO.res_list||(window.__DEBUGINFO.res_list=[]), window.__DEBUGINFO.res_list[e]?(window.__DEBUGINFO.res_list[e][o]=t,!0):!1):!1; } function n(e){ var o=new TextEncoder("utf-8").encode(e),t=crypto.subtle||crypto.webkitSubtle; return t.digest("SHA-256",o).then(function(e){ return r(e); }); } function r(e){ for(var o=[],t=new DataView(e),n=0;nr;++r)if(o.call(t,e[r],r,e)===!1)return; }else{ if("Object"!==n&&a!=e)throw"unsupport type"; if(a==e){ for(var r=e.length-1;r>=0;r--){ var s=a.key(r),c=a.getItem(s); if(o.call(t,c,s,e)===!1)return; } return; } for(var r in e)if(e.hasOwnProperty(r)&&o.call(t,e[r],r,e)===!1)return; } } } var a=o.localStorage,s=document.head||document.getElementsByTagName("head")[0],c=1,d=11,_=12,m=13,w=window.__allowLoadResFromMp?1:2,l=window.__allowLoadResFromMp?1:0,u=w+l,p=window.testenv_reshost||window.__moon_host||"res.wx.qq.com",f=new RegExp("^(http(s)?:)?//"+p); window.__loadAllResFromMp&&(p="mp.weixin.qq.com",w=0,u=w+l); var h=0,g={ prefix:"__MOON__", loaded:[], unload:[], clearSample:Math.random()=1296e6){ g.clear(); try{ !!a&&a.setItem(g.prefix+"clean_time",+new Date); }catch(m){} } } i(moon_map,function(i,s){ if(t=g.prefix+s,r=!!i&&i.replace(f,""),e=!!a&&a.getItem(t),version=!!a&&(a.getItem(t+"_ver")||"").replace(f,""), g.mod_num++,r&&-1!=r.indexOf(".css")?g.cacheData.css_mod_num++:r&&-1!=r.indexOf(".js")&&g.cacheData.js_mod_num++, g.clearSample||!e||r!=version)g.unload.push(r.replace(f,"")),r&&-1!=r.indexOf(".css")?e?r!=version&&g.cacheData.css_expired_num++:g.cacheData.css_not_hit_num++:r&&-1!=r.indexOf(".js")&&(e?r!=version&&g.cacheData.js_expired_num++:g.cacheData.js_not_hit_num++);else{ if("https:"==location.protocol&&window.moon_hash_map&&window.moon_hash_map[s]&&window.crypto)try{ n(e).then(function(e){ window.moon_hash_map[s]!=e&&console.log(s); }); }catch(c){} try{ var d="//# sourceURL="+s+"\n//@ sourceURL="+s; o.eval.call(o,'define("'+s+'",[],'+e+")"+d),g.hit_num++,r&&-1!=r.indexOf(".css")?g.cacheData.css_hit_num++:r&&-1!=r.indexOf(".js")&&g.cacheData.js_hit_num++; }catch(c){ g.unload.push(r.replace(f,"")); } } }),g.load(g.genUrl()); }, genUrl:function(){ var e=g.unload; if(!e||e.length<=0)return[]; var o,t,n="",r=[],i={},a=-1!=location.search.indexOf("no_moon2=1"),s="//"+p; -1!=location.href.indexOf("moon_debug2=1")&&(s="//mp.weixin.qq.com"); for(var c=0,d=e.length;d>c;++c){ /^\/(.*?)\//.test(e[c]); var _=/^\/(.*?)\//.exec(e[c]); _.length<2||!_[1]||(t=_[1],n=i[t],n?(o=n+","+e[c],o.length 1e3||a?(r.push(n+"?v="+g.version), n=location.protocol+s+e[c],i[t]=n):(n=o,i[t]=n)):(n=location.protocol+s+e[c],i[t]=n)); } for(var m in i)i.hasOwnProperty(m)&&r.push(i[m]); return r; }, load:function(e){ if(window.__wxgspeeds&&(window.__wxgspeeds.mod_num=g.mod_num,window.__wxgspeeds.hit_num=g.hit_num), !e||e.length<=0)return seajs.combo_status=seajs.COMBO_LOADED,seajs.run(),console.debug&&console.debug("[moon] load js complete, all in cache, cost time : 0ms, total count : "+g.mod_num+", hit num: "+g.hit_num), void window.__moonclientlog.push("[moon] load js complete, all in cache, cost time : 0ms, total count : "+g.mod_num+", hit num: "+g.hit_num); seajs.combo_status=seajs.COMBO_LOADING; var o=0,t=+new Date; window.__wxgspeeds&&(window.__wxgspeeds.combo_times=[],window.__wxgspeeds.combo_times.push(t)), i(e,function(n){ g.request(n,u,function(){ if(window.__wxgspeeds&&window.__wxgspeeds.combo_times.push(+new Date),o++,o==e.length){ var n=+new Date-t; window.__wxgspeeds&&(window.__wxgspeeds.mod_downloadtime=n),seajs.combo_status=seajs.COMBO_LOADED, seajs.run(),console.debug&&console.debug("[moon] load js complete, url num : "+e.length+", total mod count : "+g.mod_num+", hit num: "+g.hit_num+", use time : "+n+"ms"), window.__moonclientlog.push("[moon] load js complete, url num : "+e.length+", total mod count : "+g.mod_num+", hit num: "+g.hit_num+", use time : "+n+"ms"); } }); }); }, request:function(o,n,r){ if(o){ n=n||0,o.indexOf("mp.weixin.qq.com")>-1&&((new Image).src=location.protocol+"//mp.weixin.qq.com/mp/jsmonitor?idkey=27613_32_1&r="+Math.random(), window.__moon_report([{ offset:_, log:"load_script_from_mp: "+o }],1)); var i=-1; window.__DEBUGINFO&&(__DEBUGINFO.res_list||(__DEBUGINFO.res_list=[]),__DEBUGINFO.res_list.push({ type:"js", status:"pendding", start:+new Date, end:0, url:o }),i=__DEBUGINFO.res_list.length-1),-1!=location.search.indexOf("no_lshttps=1")&&(o=o.replace("http://","https://")); var a=document.createElement("script"); a.src=o,a.type="text/javascript",a.async=!0,a.down_time=+new Date,a.onerror=function(s){ t(i,"status","error"),t(i,"end",+new Date); var _=new Error(s); if(n>=0)if(l>n){ var w=o.replace("res.wx.qq.com","mp.weixin.qq.com"); g.request(w,n,r); }else g.request(o,n,r);else window.__moon_report&&window.__moon_report([{ offset:c, log:"load_script_error: "+o, e:_ }],1); if(n==l-1&&window.__moon_report([{ offset:d, log:"load_script_error: "+o, e:_ }],1),-1==n){ var u="ua: "+window.navigator.userAgent+", time="+(+new Date-a.down_time)+", load_script_error -1 : "+o; window.__moon_report([{ offset:m, log:u }],1); } window.__moonclientlog.push("moon load js error : "+o+", error -> "+_.toString()), e("moon_request_error url:"+o); },"undefined"!=typeof moon_crossorigin&&moon_crossorigin&&a.setAttribute("crossorigin",!0), a.onload=a.onreadystatechange=function(){ t(i,"status","loaded"),t(i,"end",+new Date),!a||a.readyState&&!/loaded|complete/.test(a.readyState)||(t(i,"status","200"), a.onload=a.onreadystatechange=null,"function"==typeof r&&r()); },n--,s.appendChild(a),e("moon_request url:"+o+" retry:"+n); } }, setItem:function(e,o){ !!a&&a.setItem(e,o); }, clear:function(){ a&&(i(a,function(e,o){ ~o.indexOf(g.prefix)&&a.removeItem(o); }),console.debug&&console.debug("[moon] clear")); }, idkeyReport:function(e,o,t){ t=t||1; var n=e+"_"+o+"_"+t; (new Image).src="/mp/jsmonitor?idkey="+n+"&r="+Math.random(); } }; seajs&&seajs.use&&"string"==typeof window.__moon_mainjs&&seajs.use(window.__moon_mainjs), window.moon=g; }(window),window.moon.init(); }; e(),!!window.__moon_initcallback&&window.__moon_initcallback(),window.__wxgspeeds&&(window.__wxgspeeds.moonendtime=+new Date); } } __moonf__(); }, 25);


今天看啥 - 高品质阅读平台
本文地址:http://www.jintiankansha.me/t/a8VOg6E5YD
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/5285
 
584 次点击