CINXE.COM

OSCHINA - 找到您想要的开源项目,分享和交流

<!doctype html> <html lang="zh"> <head> <head> <style> .ie_dialog { position: fixed; z-index: 10000; left: 0; top: 0; width: 100%; height: 100%; background: #FAFAFA !important; display: none; } .ie_notice .logo_osc { display: block; margin: 0 auto; padding-bottom: 24px; } .ie_notice h2, .ie_notice h4 { margin: 0; text-align: center; } .ie_notice .title { font-size: 28px; color: #4A4A4A; } .ie_notice .subtitle { font-size: 20px; color: #9B9B9B; font-weight: normal; } .ie_notice .ie_box { width: 560px;; margin: 24px auto;; background: #FFFFFF; border: 1px solid #E6E6E6; box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.10); border-radius: 4px; display: table !important; } .ie_notice .ie_box .desc { font-size: 14px; color: #6D6D6D; line-height: 22px; padding: 20px; } .ie_notice .ie_box a { display: inline-block; width: 30%; text-align: center; } .ie_notice .ie_box .go { width: 100%; background: #F6F6F6; font-size: 16px; color: #9B9B9B; padding: 16px 0; text-align: center; border: none; margin-top: 20px; text-decoration: none; } .ie_notice .ie_box a img { border: none; } </style> <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> <center class="ie_dialog" id="incompatible_tip"> <div> <br> <table class="ie_notice" style="border:0"> <tr> <td> <img class="logo_osc" src="/img/ie/logo_osc.png"" alt="OSCHINA"/> </td> </tr> <tr> <td><h2 class="title">我们不支持 IE 10 及以下版本浏览器</h2></td> </tr> <tr> <td><h4 class="subtitle">It appears you’re using an unsupported browser</h4></td> </tr> <tr> <td> <div class="ie_box"> <div class="desc">为了获得更好的浏览体验,我们强烈建议您使用较新版本的 Chrome、 Firefox、 Safari 等,或者升级到最新版本的IE浏览器。 如果您使用的是 IE 11 或以上版本,请关闭“兼容性视图”。 </div> <div class="logos"> <a href="http://www.google.cn/chrome/browser/desktop/index.html" target="_blank" title="下载Chrome浏览器"> <img src="/img/ie/logo_chrome.png"/> </a> <a href="http://www.firefox.com.cn" target="_blank" title="下载Firefox浏览器"> <img src="/img/ie/logo_firefox.png"/> </a> <a href="http://windows.microsoft.com/zh-cn/internet-explorer/download-ie" target="_blank" title="升级IE浏览器"> <img src="/img/ie/logo_ie.png"/> </a> </div> <div> <a href="javascript:void(0);" onclick="document.getElementById('incompatible_tip').style.cssText = 'display:none;';" class="go">继续访问</a> </div> </div> </td> </tr> </table> </div> </center> <script> var isIE = (function () { var browser = {}; return function (ver, c) { var key = ver ? ( c ? "is" + c + "IE" + ver : "isIE" + ver ) : "isIE"; var v = browser[key]; if (typeof(v) != "undefined") { return v; } if (!ver) { v = (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0); } else { var match = navigator.userAgent.match(/(?:MSIE |Trident\/.*; rv:|Edge\/)(\d+)/); if (match) { var v1 = parseInt(match[1]); v = c ? ( c == 'lt' ? v1 < ver : ( c == 'gt' ? v1 > ver : undefined ) ) : v1 == ver; } else if (ver <= 9) { var b = document.createElement('b') var s = '<!--[if ' + (c ? c : '') + ' IE ' + ver + ']><i></i><![endif]-->'; b.innerHTML = s; v = b.getElementsByTagName('i').length === 1; } else { v = undefined; } } browser[key] = v; return v; }; }()); if (isIE(11, 'lt')) { console.log("fvck ie"); document.getElementById('incompatible_tip').style.cssText = 'display:block;'; } </script> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Language" content="zh-CN"> <meta name="robots" content="index, follow"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- 此meta用于腾讯验证我们网址的有效性 --> <meta property="qc:admins" content="2554550177673301616654" /> <!-- 此meta用于百度站长工具 --> <meta name="baidu-site-verification" content="yikf5IoT7Z" /> <meta name="referrer" content="always"/> <meta name="keywords" content="${Keywords}"> <meta name="description" itemprop="description" content=" OSCHINA 社区"> <link rel="shortcut icon" type="image/x-icon" href="/img/favicon.ico?t=1451964198000" /> <meta itemprop="image" content="https://www.oschina.net/img/logo_s2.png" /> <title>OSCHINA - 找到您想要的开源项目,分享和交流</title> <link rel="alternate" type="application/rss+xml" title="最新开源项目" href="https://www.oschina.net/project/rss" /> <link rel="alternate" type="application/rss+xml" title="最新开源资讯" href="https://www.oschina.net/news/rss" /> <link rel="alternate" type="application/rss+xml" title="最新问题列表" href="https://www.oschina.net/question/rss" /> <link rel="alternate" type="application/rss+xml" title="最新翻译列表" href="https://www.oschina.net/translate/rss" /> <link rel="alternate" type="application/rss+xml" title="最新博客列表" href="https://www.oschina.net/blog/rss" /> <link rel="alternate" type="application/rss+xml" title="推荐博客列表" href="https://www.oschina.net/blog/rss?show=more" /> <link rel="alternate" type="application/rss+xml" title="推荐软件列表" href="https://www.oschina.net/project/rss?show=recomms" /> <link rel="alternate" type="application/rss+xml" title="最新代码分享列表" href="https://www.oschina.net/code/rss" /> <link rel="alternate" type="application/rss+xml" title="OSCHINA - 源码列表" href="https://www.oschina.net/code/source_rss" /> <!-- 此script用于百度统计工具--> <link type="text/css" rel="stylesheet" href="/dist/oschina/community/stylesheets/community-main-8a840abb905398069fdade7ce776172739783b01.css"> </head> <style> .terms { width: 90%; margin: 0 auto; padding: 10px 0; } .terms h2 { text-align: center; font-size: 34px; padding: 20px 0 0; margin: 0 0 25px; } .terms h4 { font-size: 18px; margin-bottom: 1em; } .terms p, .terms ul { margin: 0 0 1.5em; font-size: 16px; line-height: 28px; } .terms p + ul { margin-top: -1.5em; } </style> </head> <body> <header class="header-navbar"> <div class="box top-banner"> <div class="box vertical box-aw"> <a href="https://www.oschina.net/" class="osc-logo"></a> <div class="menus"> <a class="menu-item" href="https://www.oschina.net/">首页</a> <div class="menu-item menu-drop"> <a href="https://www.oschina.net/project" class="project"> 开源项目 <i class="icon-svg icon-arr-down-white"></i> </a> <div class="menu-drop-down"> <ul class="drop-list"> <li><a href="https://www.oschina.net/project/zh">国产开源项目</a></li> <li><a href="https://www.oschina.net/project/tags">项目分类</a></li> <li><a href="https://www.oschina.net/project/list?sort=time">最新收录项目</a></li> <li class="split"></li> <li><a href="https://www.oschina.net/project/lang/19/java">Java 开源软件</a></li> <li><a href="https://www.oschina.net/project/lang/194/csharp">C# 开源软件</a></li> <li><a href="https://www.oschina.net/project/lang/22/php">PHP 开源软件</a></li> <li><a href="https://www.oschina.net/project/lang/21/c">C/C++ 开源软件</a></li> <li><a href="https://www.oschina.net/project/lang/26/ruby">Ruby 开源软件</a></li> <li><a href="https://www.oschina.net/project/lang/25/python">Python 开源软件</a></li> <li><a href="https://www.oschina.net/project/lang/358/go">Go开源软件</a></li> <li><a href="https://www.oschina.net/project/lang/28/javascript">JS开源软件</a></li> </ul> </div> </div> <div class="box menu-item menu-drop"> <a href="https://www.oschina.net/question" class="question"> 问答 <i class="icon-svg icon-arr-down-white"></i> </a> <div class="menu-drop-down"> <ul class="drop-list"> <li><a href="https://www.oschina.net/question?catalog=1"> 技术问答</a></li> <li><a href="https://www.oschina.net/question?catalog=2"> 技术分享</a></li> <li><a href="https://www.oschina.net/question?catalog=3"> IT大杂烩</a></li> <li><a href="https://www.oschina.net/question?catalog=100"> 职业生涯</a></li> <li><a href="https://www.oschina.net/question?catalog=4"> 站务/建议</a></li> <li><a href="https://www.oschina.net/alipay"> 支付宝专区</a></li> <li><a href="https://www.oschina.net/mopaas"> MoPaaS专区</a></li> <li><a href="https://www.oschina.net/hardware"> 开源硬件专区</a></li> </ul> </div> </div> <a href="https://www.oschina.net/blog" class="menu-item blog">博客</a> <a href="https://www.oschina.net/translate" class="menu-item tran">翻译</a> <a href="https://www.oschina.net/news" class="menu-item news">资讯</a> <div class="menu-item menu-drop"> <a href="https://www.oschina.net/android" class="mobile"> 专题 <i class="icon-svg icon-arr-down-white"></i> </a> <div class="menu-drop-down"> <ul class="drop-list drop-list-inline"> <li><a href="https://www.oschina.net/event/ych" class="font-red">源创会</a></li> <li><a href="https://www.oschina.net/question/tag/%E9%AB%98%E6%89%8B%E9%97%AE%E7%AD%94">高手问答</a> <a href="https://www.oschina.net/question/tag/%E5%BC%80%E6%BA%90%E8%AE%BF%E8%B0%88">访谈</a></li> <li><a href="https://my.oschina.net/editorial-story">周刊</a> <a href="https://my.oschina.net/xxiaobian">乱弹</a></li> <li><a href="https://www.oschina.net/company">公司开源导航页</a></li> </ul> <div class="split"></div> <ul class="drop-list mobile"> <li class="android"><a href="https://www.oschina.net/android">Android开发专区</a></li> <li class="ios"><a href="https://www.oschina.net/ios/home">iOS开发专区</a></li> <li class="ios"><a href="https://www.oschina.net/ios/codingList">iOS代码库</a></li> <li class="wp7"><a href="https://www.oschina.net/wp">Windows Phone</a></li> <li class="wp7"><a href="https://www.oschina.net/ibm">IBM开发专区</a></li> <!--<li class="wp7"><a href="http://hsbn.oschina.net/" target="_blank">高安全区块链社区</a></li>--> </ul> </div> </div> <a href="https://www.oschina.net/event" class="menu-item event">活动</a> <a href="https://zb.oschina.net/?from=osc" target="_blank" class="menu-item event">众包</a> <a href="https://gitee.com?from=osc-index" target="_blank" class="menu-item event mayun">码云</a> <!--<a href="https://www.csdn.net/?utm_source=oschina" target="_blank" class="menu-item event">CSDN</a>--> </div> </div> <div class="box-fr user-bar"> <div class="box user-info"> [ <a href='https://www.oschina.net/home/login?goto_page=https%3A%2F%2Fwww.oschina.net%2Fterms'>登录</a> | <a href='https://www.oschina.net/home/reg?goto_page=https%3A%2F%2Fwww.oschina.net%2Fterms'>注册</a> ] </div> </div> </div> </header> <!-- 此script用于百度统计工具--> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?a411c4d1664dd70048ee98afe7b28f0b"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> <section class="terms"> <h2>开源中国社区用户服务条款</h2> <p>欢迎您来到开源中国社区(以下简称“本网站”)。</p> <p>本网站由深圳市奥思网络科技有限公司(以下简称“奥思网络”)运行维护。</p> <p>请您仔细阅读以下条款,如果您对本协议的任何条款表示异议,您可以选择不进入开源中国社区。当您注册成功,无论是进入开源中国社区,还是在开源中国社区上发布任何内容(即「内容」),均意味着您(即「用户」)完全接受本协议项下的全部条款。</p> <h4>使用规则</h4> <p>1、用户注册成功后,本网站将给予每个用户一个用户帐号及相应的密码,该用户帐号和密码由用户负责保管,用户不应将账号或密码告知第三方,或者将其帐号、密码转让、出借予他人使用或与第三方共用。如用户发现其帐号遭他人非法使用,应立即通知本网站,因黑客行为或用户的保管疏忽等非本网站原因导致帐号、密码遭他人非法使用或无法正常使用的,本网站不承担任何责任;用户应当对以其用户帐号进行的所有活动和事件负法律责任。</p> <p>2、用户应提供及时、详尽及准确的个人资料,并不断更新注册资料,用户须对在本网站的注册信息的真实性、合法性、有效性承担全部责任,用户不得冒充他人;不得利用他人的名义发布任何信息;不得恶意使用注册帐号导致其他用户误认;否则开源中国社区有权立即停止提供服务,收回其帐号并由用户独自承担由此而产生的一切法律责任。</p> <p>3、用户直接或通过各类方式(如RSS源和站外API引用等)间接使用本网站服务和数据的行为,都将被视作已无条件接受本协议全部内容;若用户对本协议的任何条款存在异议,请停止使用开源中国社区所提供的全部服务。</p> <p>4、本网站是一个信息分享、传播及获取的平台,用户通过开源中国社区发表的信息为公开的信息,其他第三方均可以通过本网站获取用户发表的信息,用户对任何信息的发表即认可该信息为公开的信息,并单独对此行为承担法律责任;任何用户不愿被其他第三人获知的信息都不应该在本网站上进行发表。</p> <p>5、用户承诺不得以任何方式利用本网站直接或间接从事违反中国法律以及社会公德的行为,本网站有权对违反上述承诺的内容予以删除。</p> <p>6、用户不得利用开源中国社区服务制作、上载、复制、发布、传播或者转载如下内容:</p> <ul> <li>_反对宪法所确定的基本原则的;</li> <li>_危害国家安全,泄露国家秘密,颠覆国家政权,破坏国家统一的;</li> <li>_损害国家荣誉和利益的;</li> <li>_煽动民族仇恨、民族歧视,破坏民族团结的;</li> <li>_破坏国家宗教政策,宣扬邪教和封建迷信的;</li> <li>_散布谣言,扰乱社会秩序,破坏社会稳定的;</li> <li>_散布淫秽、色情、赌博、暴力、凶杀、恐怖或者教唆犯罪的;</li> <li>_侮辱或者诽谤他人,侵害他人合法权益的;</li> <li>_含有法律、行政法规禁止的其他内容的信息。</li> </ul> <p>7、本网站有权对用户使用本网站的情况进行审查和监督,如用户在使用本网站时违反任何上述规定,本网站或其授权的人有权要求用户改正或直接采取一切必要的措施(包括但不限于更改或删除用户张贴的内容、暂停或终止用户使用本网站的权利),因此产生的全部责任及损失由用户承担。</p> <h4>知识产权</h4> <p>本网站是一个信息获取、分享及传播的平台,我们尊重和鼓励本网站用户创作的内容,认识到保护知识产权对开源中国社区生存与发展的重要性,承诺将保护知识产权作为本网站运营的基本原则之一。</p> <p>1、用户在本网站发表的全部原创内容(包括但不仅限于回答、文章和评论),著作权均归用户本人所有。用户可授权第三方以任何方式使用,不需要得到开源中国社区的同意。</p> <p>2、本网站提供的网络服务中包含的标识、版面设计、排版方式、文本、图片、图形等均受著作权法、商标法及其它法律保护,未经相关权利人(含本网站及其他原始权利人)同意,上述内容均不得在任何平台被直接或间接发布、使用、出于发布或使用目的的改写或再发行,或以其他任何法律允许外的方式使用。</p> <p>3、为了促进知识的分享和传播,用户将其在本网站发表的全部内容,授予本网站免费的、不可撤销的、非独家、永久的、全球范围内的使用许可,本网站有权将该内容用于本网站各种形态的产品和服务上,包括但不限于网站以及发表的应用或其他互联网产品。</p> <p>4、除原作者另有说明或法律规定不得转载的情况外,若出于非商业目的,将用户在本网站发表的内容转载在本网站之外的地方,应当在作品的正文开头的显著位置注明原作者姓名(或原作者在本网站使用的帐号名称),给出原始链接,注明「发表于开源中国社区」,并不得对作品进行修改演绎。若需要对作品进行修改,或用于商业目的,应当联系用户获得单独授权,按照用户规定的方式使用该内容。</p> <p>5、在本网站上传或发表的内容,用户应保证其为相关权利所有人或已取得合法授权,并且该内容不会侵犯任何第三方的合法权益。如果第三方提出关于著作权等合法权益的异议,本网站有权删除相关内容,且有权追究用户的法律责任。给本网站或任何第三方造成损失的,用户应负责全额赔偿。</p> <p>6、如果任何第三方侵犯了本网站用户相关的权利,用户同意授权开源中国社区或其指定的代理人代表开源中国社区自身或用户对该第三方提出警告、投诉、发起行政执法、诉讼、进行上诉,或谈判和解,并且用户同意在开源中国社区认为必要的情况下参与共同维权。</p> <p>7、本网站有权但无义务对用户发布的内容进行审核,有权根据相关证据结合《侵权责任法》、《信息网络传播权保护条例》等法律法规及本网站社区指导原则对侵权信息进行处理。</p> <h4>个人信息</h4> <p>1、用户同意本网站出于以下目的,收集和使用用户的个人信息:</p> <ul> <li>(1)在用户注册开源中国社区账号时,本网站会收集用户的昵称、性别和手机号码;</li> <li>(2)本网站会收集用户在完善个人资料时填写的出生日期、居住地区、邮箱、QQ联系、工作职位等个人信息;</li> <li>(3)在用户使用开源中国社区时,本网站会收集用户的浏览器/移动设备类型、浏览器/移动设备语言、用户IP地址等信息;</li> <li>(4)若用户使用开源中国社区的“求职/招聘”服务,本网站会收集用户填写的简历信息(包括年龄、性别、手机号、邮箱、项目经历、工作经历、教育经历);</li> <li>(5)若用户使用第三方帐号(微信、QQ、GitHub、Stack Overflow、LinkedIn)登录,本网站会读取并获得用户在该第三方平台上登记、公布、记录的公开信息(包括昵称、头像);</li> <li>(6)开展内部审计、数据分析和研究,改善开源中国社区的产品或服务。</li> </ul> <p>2、开源中国社区尊重并保护访问本网站的任何个人的个人信息。对于您提供的非公开的个人信息,本网站不会将其提供给第三方,但下述情况除外:</p> <ul> <li>(1)事先获得您的明确授权;</li> <li>(2)为使用开源中国社区的服务所必须的(包括但不限于使用“求职/招聘”服务时本网站向用人单位提供您的简历信息);</li> <li>(3)司法机关、行政机关或其他有关部门要求披露的;</li> <li>(4)为维护本网站及奥思网络的合法权益、社会公众利益需要披露的;</li> <li>(5)本网站与第三方合作向用户提供相关网络服务需要向第三方披露的;</li> <li>(6)依照法律法规要求披露的。</li> </ul> <p>3、以下情形造成的任何个人信息的泄露、丢失、被盗用、被篡改等,本网站及奥思网络不承担任何责任:</p> <ul> <li>(1)由黑客攻击、计算机病毒侵入或发作、政府管制等本网站及奥斯网络不能控制的原因或不可抗力而造成的暂时性关闭等影响网站正常运营的事件所造成的;</li> <li>(2)用户将个人密码、账号告知他人或与他人共享注册帐号所造成的;</li> <li>(3)与本网站链接的任何其它网站造成的。</li> </ul> <h4>侵权处理</h4> <p>用户在开源中国社区发表的内容仅表明其个人的立场和观点,并不代表本网站的立场或观点。如果个人或企业发现本网站存在侵犯自身合法权益的内容,可以先尝试与作者取得联系,通过沟通协商解决问题。如您无法联系到作者,或无法通过与作者沟通解决问题,您可通过向开源中国社区平台进行投诉。本网站有权直接采取包括但不限于更改或删除用户张贴的内容、暂停或终止用户使用本网站的权利等一切措施,因此产生的全部责任及损失由用户承担。</p> <p>不论本侵权举报内容是否完全属实,用户将承担由此产生的一切法律责任,并承担和赔偿本网站因根据投诉人的通知书对相关帐号的处理而造成的任何损失,包括但不限于本网站因向被投诉方赔偿而产生的损失及开源中国社区名誉、商誉损害等。</p> <h4>免责申明</h4> <p>1、开源中国社区不能对用户发表的回答或评论的正确性进行保证。</p> <p>2、用户在本网站发表的内容仅表明其个人的立场和观点,并不代表本网站的立场或观点。作为内容的发表者,需自行对所发表内容负责,因所发表内容引发的一切纠纷,由该内容的发表者承担全部法律及连带责任。本网站不承担任何法律及连带责任。</p> <p>3、开源中国社区不保证网络服务一定能满足用户的要求,也不保证网络服务不会中断,对网络服务的及时性、安全性、准确性也都不作保证。</p> <p>4、对于因不可抗力或开源中国社区不能控制的原因造成的网络服务中断或其它缺陷,开源中国社区不承担任何责任,但将尽力减少因此而给用户造成的损失和影响。</p> <h4>协议修改</h4> <p>1、根据互联网的发展和有关法律、法规及规范性文件的变化,或者因业务发展需要,本网站有权对本协议的条款作出修改或变更,一旦本协议的内容发生变动,本网站将公布修改之后的协议内容,该公布行为视为开源中国社区已经通知用户修改内容。开源中国社区也可采用电子邮件或私信的传送方式,提示用户协议条款的修改、服务变更、或其它重要事项。</p> <p>2、如果不同意开源中国社区对本协议相关条款所做的修改,用户有权并应当停止使用本网站。如果用户继续使用本网站,则视为用户接受本网站对本协议相关条款所做的修改。</p> </section> <footer class="ant-layout-footer footer"> <div class="footer"> <div class="container"> <div class="logo"> <div class="box-center"> <img src="/img/images/LOGO.svg" alt="" style="width: 262px; height: 91px;" /> </div> </div> <div class="title"> <div class="overline"></div> <h4>OSCHINA社区</h4> <div class="list"> <a class="item" href="https://www.oschina.net/home/aboutosc" target="_blank"> 关于我们 </a> <a class="item" href="https://www.oschina.net/home/aboutosc" target="_blank"> 帮助中心 </a> <a class="item" href="https://www.oschina.net/home/aboutosc#partners" target="_blank"> 商务合作 </a> <a class="item" href="https://www.oschina.net/openapi" target="_blank"> Open API </a> </div> </div> <div class="title br"> <div class="overline"></div> <h4>在线工具</h4> <div class="list"> <a class="item" href="https://copycat.gitee.com/?utm_source=oschina&amp;utm_medium=link-bottom&amp;utm_campaign=copycat" target="_blank"> CopyCat-代码克隆检测 </a> <a class="item" href="https://tool.oschina.net" target="_blank"> 实用在线工具 </a> <a class="item">开源/AI软件库</a> <a class="item">Awesome 软件</a> </div> </div> <div class="title br"> <div class="overline"></div> <h4>攻略</h4> <div class="list"> <a class="item">造物发布</a> <a class="item">新闻投递</a> <a class="item">软件投递</a> <a class="item" href="https://www.oschina.net/question/2918182_2319406" target="_blank"> 项目运营 </a> </div> </div> <div class="title"> <h4>OSC开源社区APP</h4> <div class="scan-qr-code"> <div class="box"> <div class="ant-image css-quj94o"> <img alt="微信公众号" width="90" class="ant-image-img" src="/img/images/wechat_qrcode.webp"> </div> <span>Android / iOS</span> </div> </div> </div> </div> <div class="miit"> <div class="left"> <span>©OSCHINA(OSChina.NET)</span> <span>工信部</span> <span>开源软件推进联盟</span> <span>指定官方社区</span> <span>社区规范</span> </div> <div class="right"> <span><span class="right-none">深圳市奥思网络科技有限公司版权所有</span> 粤ICP备12009483</span> </div> </div> </div> </footer> <script type="text/javascript"> function escapeHtml(unsafe) { // 检查 unsafe 是否为 null 或 undefined if (unsafe == null) { return ''; } // 确保转换为字符串 unsafe = String(unsafe); return unsafe .replace(/&/g, "&amp;") .replace(/</g, "&lt;") .replace(/>/g, "&gt;") .replace(/"/g, "&quot;") .replace(/'/g, "&#039;"); } $('.media-matrix').hover(function(){ $('.media-matrix-mask').show() },function(){ $('.media-matrix-mask').hide() }) $('.osc-app').hover(function(){ $('.osc-app-mask').show() },function(){ $('.osc-app-mask').hide() }) $('.oper-user').hover(function(){ $('.oper-user-box').show() },function(){ $('.oper-user-box').hide() }) $(document).on('click','#userMess',function(e){ $("#user_box").show(); }) $(document).on('click','.ant-drawer-mask',function(e){ $("#user_box").hide(); }) $(document).on('click','.nav-bar-h5',function(e){ $("#navBarH5Menu").show(); e.stopPropagation(); }) $(document).on('click', function(e){ if($("#navBarH5Menu").is(":visible")){ $("#navBarH5Menu").hide(); } if($("#user_popover").is(":visible")){ $("#user_popover").hide(); } }) $(document).on('click','#user_popover .ant-tabs-tab',function(e){ if( $(this).hasClass('ant-tabs-tab-active')){ return false; }else{ $(this).siblings('.ant-tabs-tab').removeClass('ant-tabs-tab-active') $(this).addClass('ant-tabs-tab-active') let textValue = $(this).find('span').text(); $('.ant_tabs_content').hide(); if(textValue == '评论'){ getHandleComment(); $('#user_comment').show(); }else if(textValue == '点赞'){ getHandleLke(); $('#user_like').show(); }else if(textValue == '私信'){ //findAllMsgCount(); $('#user_content').show(); }else if(textValue == '@我'){ getMessageMe(); $('#user_my').show(); } } e.stopPropagation(); }) $(document).on('click','#message',function(e){ getHandleComment(); $("#user_popover").show(); e.stopPropagation(); }) $(function(){ getHnadleTopMenu(); getHandleMenu(); }); window.onload = function(){ getHandleToken(); getPrivateMsg(); } //获取token function getHandleToken(){ let time_data = Date.parse(new Date())/1000; let url_formal = "https://www.oschina.net/ApiSso/mobileToken" let queryParem = {timestamp:time_data}; $.ajax({ url: url_formal, method: "get", dataType: "json", data: queryParem, success: function (res) { } }) }; //获取web_v2_header_top菜单接口 function getHnadleTopMenu(){ let url_formal = "https://www.oschina.net/action/ajax/get_tool_ad?ident=web_v2_header_top" $.ajax({ url: url_formal, method: "get", dataType: "json", success: function (result) { let header_html = JSON.parse(result.html); let nav_BarTabs = header_html.navBarTabs; let nav_mediaMatrix = header_html.mediaMatrix; let nav_app = header_html.app; let nav_devOps = header_html.devOps; let html_navBarTabs = ''; let html_mediaMatrix = ''; let html_app = ''; let html_devOps = ''; //头部navBarTabs导航 for(let i=0; i<nav_BarTabs.length;i++){ if(nav_BarTabs[i].target){ html_navBarTabs += '<a href="'+nav_BarTabs[i].href+'" class="left-item" target="'+nav_BarTabs[i].target+'" style="'+nav_BarTabs[i].style+'">'+nav_BarTabs[i].text+'</a>' }else{ html_navBarTabs += '<a href="'+nav_BarTabs[i].href+'" class="left-item" target="_blank" style="'+nav_BarTabs[i].style+'">'+nav_BarTabs[i].text+'</a>' } } $('#nav_top_BarTabs').html(html_navBarTabs); //DevOps研发效能 for(let i=0; i<nav_devOps.length; i++){ html_devOps += '<a class="dev-ops-item" href="'+nav_devOps[i].href+'" target="_blank">'; html_devOps += ' <div class="dev-ops-img">'; html_devOps += '<img src="'+nav_devOps[i].imgUrl+'" alt="'+nav_devOps[i].text+'" />'; html_devOps += '</div>'; html_devOps += '<div class="dev-ops-title-des">'; html_devOps += '<div class="dev-ops-title">'+nav_devOps[i].text+'</div>'; html_devOps += '<div class="dev-ops-des">'+nav_devOps[i].description+'</div>'; html_devOps += '</div>'; html_devOps += '</a>'; } $('#devops_box').html(html_devOps); //头部媒体矩阵 for(let i=0; i<nav_mediaMatrix.length; i++){ html_mediaMatrix += '<div class="media-matrix-item">'; html_mediaMatrix += '<div class="item-img">'; html_mediaMatrix += '<img src="'+nav_mediaMatrix[i].imgUrl+'" alt="'+nav_mediaMatrix[i].title+'">'; html_mediaMatrix += '</div>'; html_mediaMatrix += '<div class="item-title">'+nav_mediaMatrix[i].title+'</div>'; html_mediaMatrix += '<div class="item-description">'+nav_mediaMatrix[i].description+'</div>'; html_mediaMatrix += '</div>'; } $('#media-box-mask').html(html_mediaMatrix); //头部开源中国APP html_app += '<div class="app-img">'; html_app += '开源中国社区APP,探索开源与AI的边界'; html_app += '</div>'; for(let i=0; i<nav_app.qrCode.length; i++){ html_app += '<div class="media-matrix-item">'; html_app += '<div class="item-img">'; html_app += '<img src="'+nav_app.qrCode[i].imgUrl+'" alt="'+nav_app.qrCode[i].title+'">'; html_app += '</div>'; html_app += '<div class="item-description">'+nav_app.qrCode[i].title+'</div>'; html_app += '</div>'; } $('#osc-app-box').html(html_app); } }); } //获取web_v2_header_bottom菜单接口 function getHandleMenu(){ let url_formal = "https://www.oschina.net/action/ajax/get_tool_ad?ident=web_v2_header_bottom" let html_menu_h5=""; $.ajax({ url: url_formal, method: "get", dataType: "json", success: function (result) { let html_menu=""; let header_menu = JSON.parse(result.html); let menu_html = header_menu.navBarTabs for(let i=0; i< menu_html.length; i++){ if(menu_html[i].showHotIcon){ html_menu += '<a href="'+menu_html[i].href+'" class="nav-bar-tag" target="'+menu_html[i].target+'" style="'+menu_html[i].style+'">'+menu_html[i].text+'🔥</a>' html_menu_h5 += '<div class="menu_h5_item"><a href="'+menu_html[i].href+'" class="nav-bar-tag" target="'+menu_html[i].target+'" style="'+menu_html[i].style+'">'+menu_html[i].text+'🔥</a></div>' }else{ html_menu += '<a href="'+menu_html[i].href+'" class="nav-bar-tag" target="'+menu_html[i].target+'" style="'+menu_html[i].style+'">'+menu_html[i].text+'</a>' html_menu_h5 += '<div class="menu_h5_item"><a href="'+menu_html[i].href+'" class="nav-bar-tag" target="'+menu_html[i].target+'" style="'+menu_html[i].style+'">'+menu_html[i].text+'</a></div>' } } $("#nav-bar-menu").html(html_menu); $("#navBarH5Menu .nav-bar-h5-item").html(html_menu_h5); } }); } //退出登录接口 function getHandleLogout(){ let url_formal = "https://www.oschina.net/user/logout" let user_code = {"session":""} $.ajax({ url: url_formal, method: "POST", dataType: "json", data: user_code, success: function (result) { $("#user_box").hide(); } }); } //拼接header头像连接赋值 function getAvatarUrl(){ let user_avatar = "$g_user.LargePortrait()"; let user_url; if(user_avatar){ if(user_avatar.indexOf("up")!== -1){ let url_formal = "https://www.oschina.net/oscnet/" user_url = url_formal + "$g_user.LargePortrait()" }else{ let url_formal = "https://www.oschina.net/uploads/user/" user_url = url_formal + "$g_user.LargePortrait()" } }else{ if("https://www.oschina.net/" == "http://www.oschina.com/"){ user_url = "http://www.oschina.com/new-osc/img/portrait.gif" }else if("https://www.oschina.net/" == "http://www.oschina.osc/"){ user_url = "http://www.oschina.osc/new-osc/img/portrait.gif" }else{ user_url = "https://www.oschina.net/new-osc/img/portrait.gif" } } let user_name = "${g_user.name}" // $("#userMess_avatarLogo").html('<img src="'+user_url+'" width="34" height="34" alt="'+user_name+'" title="'+user_name+'">') // $("#user_avatarLogo").html('<img src="'+user_url+'" width="40" height="40" alt="'+user_name+'" title="'+user_name+'">') } function getImgAvatarLoad(){ let user_name = "${g_user.name}" $("#userMess_avatarLogo img").on("load",function(){ }).on('error', function(){ let user_url; if("https://www.oschina.net/" == "http://www.oschina.com/"){ user_url = "http://www.oschina.com/new-osc/img/portrait.gif" }else if("https://www.oschina.net/" == "http://www.oschina.osc/"){ user_url = "http://www.oschina.osc/new-osc/img/portrait.gif" }else{ user_url = "https://www.oschina.net/new-osc/img/portrait.gif" } $("#userMess_avatarLogo").html('<img src="'+user_url+'" width="34" height="34" alt="'+user_name+'" title="'+user_name+'">') $("#user_avatarLogo").html('<img src="'+user_url+'" width="40" height="40" alt="'+user_name+'" title="'+user_name+'">') }) } //获取私信数量 function getPrivateMsg(){ let url_formal; if("https://www.oschina.net/" == "http://www.oschina.com/"){ url_formal = "http://apiv1.oschina.com/oschinapi/message/remind/all/count" url_user_id=" http://my.oschina.com/u_beta/" }else if("https://www.oschina.net/" == "http://www.oschina.osc/"){ url_formal = "http://apiv1.oschina.osc/oschinapi/message/remind/all/count" url_user_id=" http://my.oschina.osc/u_beta/" }else{ url_formal = "https://apiv1.oschina.net/oschinapi/message/remind/all/count" url_user_id=" https://my.oschina.net/u_beta/" } let user_id = ""; let user_code = ""; $.ajax({ url: url_formal, method: "post", dataType: "json", xhrFields: { withCredentials: true }, crossDomain: true, success: function (res) { if(res.code == '200'){ let messageTypeCount = getMessageCounts(res.result.messageTypes); if(messageTypeCount.allCount == 0){ $('#user_content').html("<div class='user_mess_nodata'></div>") }else{ $("#message .notice_count").html(messageTypeCount.allCount); $("#message .notice_count").show(); if(messageTypeCount.counts.mentionCount > 0){ $('#user_my_num').html(messageTypeCount.counts.mentionCount); $('#user_my_num').show(); } if(messageTypeCount.counts.commentCount > 0){ $('#user_comment_num').html(messageTypeCount.counts.commentCount); $('#user_comment_num').show(); } if(messageTypeCount.counts.likeCount > 0){ $('#user_like_num').html(messageTypeCount.counts.likeCount); $('#user_like_num').show(); } if(messageTypeCount.counts.privateMsgCount > 0){ let user_html = ''; user_html += "<div class='user_message'>有 <span>"+messageTypeCount.counts.privateMsgCount+"</span> 个用户私信了您!!</div>" user_html += "<div class='mess_btnbox'><a href='"+url_user_id+""+user_id+"?key=message' class='mess_btn_more'>查看更多</a></div>" $('#user_content').html(user_html) $('#user_content_num').html(messageTypeCount.counts.privateMsgCount); $('#user_content_num').show(); }else{ $('#user_content').html("<div class='user_mess_nodata'></div>") } } } } }) } function getMessageCounts(messageTypes) { const counts = { mentionCount: 0, commentCount: 0 }; let allCount = 0; messageTypes.forEach(item => { if (item.messageType === 2) { counts.likeCount = item.count; allCount += item.count; } else if (item.messageType === 8) { counts.commentCount = item.count; allCount += item.count; } else if (item.messageType === 1) { counts.atMeCount = item.count; allCount += item.count; } else if (item.messageType === 9) { counts.privateMsgCount = item.count; allCount += item.count; } }); return { counts, allCount }; } //@我 function getMessageMe(){ let url_formal; let url_user_formal; let url_user_id; let url_user_blog; if("https://www.oschina.net/" == "http://www.oschina.com/"){ url_formal = "http://apiv1.oschina.com/oschinapi/message/content/at" url_user_formal = "http://www.oschina.com/" url_user_id=" http://my.oschina.com/u_beta/" url_user_blog = "http://my.oschina.com/" }else if("https://www.oschina.net/" == "http://www.oschina.osc/"){ url_formal = "http://apiv1.oschina.osc/oschinapi/message/content/at" url_user_formal = "http://www.oschina.osc/" url_user_id=" http://my.oschina.osc/u_beta/" url_user_blog = "http://my.oschina.osc/" }else{ url_formal = "https://apiv1.oschina.net/oschinapi/message/content/at" url_user_formal = "https://www.oschina.net/" url_user_id=" https://my.oschina.net/u_beta/" url_user_blog = "http://my.oschina.net/" } let user_id = ""; let queryParem = {pageNum:1,pageSize:5} $.ajax({ url: url_formal, method: "post", dataType: "json", xhrFields: { withCredentials: true }, crossDomain: true, data:queryParem, success: function (res) { let html_me = ''; if(res.code == 200){ if(res.result.length > 0){ let json_array = res.result; for(let i=0; i<json_array.length; i++){ let url_comment; if(json_array[i].objType == 3){ url_comment = url_user_blog+"u/"+json_array[i].userVo.id+"/blog_beta/"+json_array[i].linkObjId }else if(json_array[i].objType == 18){ url_comment = url_user_blog+"u/"+json_array[i].userVo.id+"/blog_beta/"+json_array[i].linkObjId+"#comment" }else if(json_array[i].objType == 4){ if(json_array[i].ident){ url_comment = url_user_formal+"news_beta/"+json_array[i].linkObjId+'/'+json_array[i].ident }else{ url_comment = url_user_formal+"news_beta/"+json_array[i].linkObjId } }else if(json_array[i].objType == 16){ if(json_array[i].ident){ url_comment = url_user_formal+"news_beta/"+json_array[i].linkObjId+'/'+json_array[i].ident+"#comment" }else{ url_comment = url_user_formal+"news_beta/"+json_array[i].linkObjId+"#comment" } }else if(json_array[i].objType == 40){ url_comment = url_user_formal+"aiCreation/details/"+json_array[i].linkObjId }else if(json_array[i].objType == 100){ url_comment = url_user_formal+"oscTweet/"+json_array[i].linkObjId }else if(json_array[i].objType == 101){ url_comment = url_user_formal+"oscTweet/"+json_array[i].linkObjId }else{ console.warn("类型错误") } html_me += '<div class="message-item">'; if(json_array[i].state == 1){ html_me += '<div class="message-item-info">'; }else{ html_me += '<div class="message-item-info unread">'; } // Sanitize user input let safeUserName = escapeHtml(json_array[i].userVo.name); let safeContent = escapeHtml(json_array[i].content); html_me += '<a class="message-item-user" href="'+url_user_id+''+json_array[i].userVo.id+'" target="_blank"><span></span>'+safeUserName+'</a>'; html_me += ' &nbsp @我 &nbsp'; html_me += '<a class="message-item-content" href="'+url_comment+'" target="_blank">'+safeContent+'</a>'; html_me += '</div>'; html_me += '<div class="message-item-time">'+escapeHtml(json_array[i].createTime)+'</div>'; html_me += '</div>' } html_me += '<div class="mess_btnbox"><a href="'+url_user_id+''+user_id+'?key=tweet" class="mess_btn_more">查看更多</a></div>' $('#user_my').html(html_me) }else{ $('#user_my').html("<div class='user_mess_nodata'></div>") } }else{ console.log("出错了!!!") } } }) } //评论的消息 function getHandleComment(){ let url_formal; let url_user_formal; if("https://www.oschina.net/" == "http://www.oschina.com/"){ url_formal = "http://apiv1.oschina.com/oschinapi/message/content/comment" url_user_formal = "http://www.oschina.com/" url_user_id=" http://my.oschina.com/u_beta/" url_user_blog = "http://my.oschina.com/" }else if("https://www.oschina.net/" == "http://www.oschina.osc/"){ url_formal = "http://apiv1.oschina.osc/oschinapi/message/content/comment" url_user_formal = "http://www.oschina.osc/" url_user_id=" http://my.oschina.osc/u_beta/" url_user_blog = "http://my.oschina.osc/" }else{ url_formal = "https://apiv1.oschina.net/oschinapi/message/content/comment" url_user_formal = "https://www.oschina.net/" url_user_id=" https://my.oschina.net/u_beta/" url_user_blog = "http://my.oschina.net/" } let user_id = ""; let queryParem = {pageNum:1,pageSize:5} $.ajax({ url: url_formal, method: "post", dataType: "json", xhrFields: { withCredentials: true }, crossDomain: true, data:queryParem, success: function (res) { let html_comment = ''; if(res.code == 200){ if(res.result.length > 0){ let json_array = res.result; for(let i=0; i<json_array.length; i++){ let url_comment; if(json_array[i].objType == 3){ url_comment = url_user_blog+"u/"+json_array[i].userVo.id+"/blog_beta/"+json_array[i].linkObjId }else if(json_array[i].objType == 18){ url_comment = url_user_blog+"u/"+json_array[i].userVo.id+"/blog_beta/"+json_array[i].linkObjId+"#comment" }else if(json_array[i].objType == 4){ if(json_array[i].ident){ url_comment = url_user_formal+"news_beta/"+json_array[i].linkObjId+'/'+json_array[i].ident }else{ url_comment = url_user_formal+"news_beta/"+json_array[i].linkObjId } }else if(json_array[i].objType == 16){ if(json_array[i].ident){ url_comment = url_user_formal+"news_beta/"+json_array[i].linkObjId+'/'+json_array[i].ident+"#comment" }else{ url_comment = url_user_formal+"news_beta/"+json_array[i].linkObjId+"#comment" } }else if(json_array[i].objType == 40){ url_comment = url_user_formal+"aiCreation/details/"+json_array[i].linkObjId }else if(json_array[i].objType == 100){ url_comment = url_user_formal+"oscTweet/"+json_array[i].linkObjId }else if(json_array[i].objType == 101){ url_comment = url_user_formal+"oscTweet/"+json_array[i].linkObjId }else{ console.warn("类型错误") } html_comment += '<div class="message-item">'; if(json_array[i].state == 1){ html_comment += '<div class="message-item-info">'; }else{ html_comment += '<div class="message-item-info unread">'; } // Sanitize user input let safeUserName = escapeHtml(json_array[i].userVo.name); let safeContent = escapeHtml(json_array[i].content); html_comment += '<a class="message-item-user" href="'+url_user_id+''+json_array[i].userVo.id+'" target="_blank"><span></span>'+safeUserName+'</a>'; html_comment += ' &nbsp 评论了 &nbsp'; html_comment += '<a class="message-item-content" href="'+url_comment+'" target="_blank">'+safeContent+'</a>'; html_comment += '</div>'; html_comment += '<div class="message-item-time">'+escapeHtml(json_array[i].createTime)+'</div>'; html_comment += '</div>' } html_comment += '<div class="mess_btnbox"><a href="'+url_user_id+''+user_id+'?key=comment" class="mess_btn_more">查看更多</a></div>' $('#user_comment').html(html_comment) }else{ $('#user_comment').html("<div class='user_mess_nodata'></div>") } }else{ console.log("出错了!!!") } } }) } //点赞的消息 function getHandleLke(){ let url_formal; let url_user_formal; if("https://www.oschina.net/" == "http://www.oschina.com/"){ url_formal = "http://apiv1.oschina.com/oschinapi/message/content/like" url_user_formal = "http://www.oschina.com/" url_user_id=" http://my.oschina.com/u_beta/" url_user_blog = "http://my.oschina.com/" }else if("https://www.oschina.net/" == "http://www.oschina.osc/"){ url_formal = "http://apiv1.oschina.osc/oschinapi/message/content/like" url_user_formal = "http://www.oschina.osc/" url_user_id=" http://my.oschina.osc/u_beta/" url_user_blog = "http://my.oschina.osc/" }else{ url_formal = "https://apiv1.oschina.net/oschinapi/message/content/like" url_user_formal = "https://www.oschina.net/" url_user_id=" https://my.oschina.net/u_beta/" url_user_blog = "http://my.oschina.net/" } let queryParem = {pageNum:1,pageSize:5} $.ajax({ url: url_formal, method: "post", dataType: "json", xhrFields: { withCredentials: true }, crossDomain: true, data:queryParem, success: function (res) { let html_like = ''; if(res.code == 200){ if(res.result.length > 0){ let json_array = res.result; for(let i=0; i<json_array.length; i++){ let url_comment; if(json_array[i].objType == 3){ url_comment = url_user_blog+"u/"+json_array[i].userVo.id+"/blog_beta/"+json_array[i].linkObjId }else if(json_array[i].objType == 18){ url_comment = url_user_blog+"u/"+json_array[i].userVo.id+"/blog_beta/"+json_array[i].linkObjId+"#comment" }else if(json_array[i].objType == 4){ if(json_array[i].ident){ url_comment = url_user_formal+"news_beta/"+json_array[i].linkObjId+'/'+json_array[i].ident }else{ url_comment = url_user_formal+"news_beta/"+json_array[i].linkObjId } }else if(json_array[i].objType == 16){ if(json_array[i].ident){ url_comment = url_user_formal+"news_beta/"+json_array[i].linkObjId+'/'+json_array[i].ident+"#comment" }else{ url_comment = url_user_formal+"news_beta/"+json_array[i].linkObjId+"#comment" } }else if(json_array[i].objType == 40){ url_comment = url_user_formal+"aiCreation/details/"+json_array[i].linkObjId }else if(json_array[i].objType == 100){ url_comment = url_user_formal+"oscTweet/"+json_array[i].linkObjId }else if(json_array[i].objType == 101){ url_comment = url_user_formal+"oscTweet/"+json_array[i].linkObjId }else{ console.warn("类型错误") } html_like += '<div class="message-item">'; if(json_array[i].state == 1){ html_like += '<div class="message-item-info">'; }else{ html_like += '<div class="message-item-info unread">'; } // Sanitize user input let safeUserName = escapeHtml(json_array[i].userVo.name); let safeContent = escapeHtml(json_array[i].content); html_like += '<a class="message-item-user" href="'+url_user_id+''+json_array[i].userVo.id+'" target="_blank"><span></span>'+safeUserName+'</a>'; html_like += ' &nbsp 点赞了 &nbsp'; html_like += '<a class="message-item-content" href="'+url_comment+'" target="_blank">'+safeContent+'</a>'; html_like += '</div>'; html_like += '<div class="message-item-time">'+escapeHtml(json_array[i].createTime)+'</div>'; html_like += '</div>' } $('#user_like').html(html_like) }else{ $('#user_like').html("<div class='user_mess_nodata'></div>") } }else{ console.log("出错了!!!") } } }) } //获取未读数量接口 function findAllMsgCount(){ let url_formal = "https://www.oschina.net/msg/findAllMsgCount" let user_code = ""; let user_id = ""; let user_data = { "user_code":user_code, "userId":user_id } $.ajax({ url: url_formal, method: "post", dataType: "json", data: user_data, success: function (result) { //let html_msg = ''; if(result.message == "success"){ let msg_count = result.result.totalMsgCount; if(msg_count != 0){ //html_msg += '<div>'+msg_count+'</div>' //html_msg += '<div class="mess_btnbox"><a href="'+url_user_id+''+json_array[0].userVo.id+'?key=message" class="mess_btn_more">查看更多</a></div>' $("#message .notice_count").html(msg_count); $("#message .notice_count").css("display","block") }else{ $("#message .notice_count").css("display","none") } } } }); } // getAvatarUrl(); // getImgAvatarLoad(); //页面滚动时顶部动态显示隐藏 $(function(){ let winHeight = $(document).scrollTop(); $(window).scroll(function(){ if(scrollY > 70){ $(".top-prefix").hide(); }else{ $(".top-prefix").show(); } }) }) //创作基金弹窗 // 添加创作基金弹窗相关事件 $(function(){ // 点击创作基金显示弹窗 $('.ad-bjyh').on('click', function(){ $('.beijyh-modal-wrap').css('display', 'flex').fadeIn(300); }); // 点击蒙版关闭弹窗 $('.beijyh-modal-wrap').on('click', function(e){ if($(e.target).hasClass('beijyh-modal-wrap')) { $(this).fadeOut(300); } }); // 点击关闭按钮关闭弹窗 $('.beijyh-modal-box-close').on('click', function(){ $('.beijyh-modal-wrap').fadeOut(300); }); }); </script> </body> </html> <!-- Generated by OsChina.NET (init:0[ms],page:4[ms],ip:8.222.208.146) -->

Pages: 1 2 3 4 5 6 7 8 9 10