UNPKG

dashen-tool

Version:

无法超越的大神代码

2 lines 4.19 kB
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}("undefined"!=typeof self?self:this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);n.d(t,"default",function(){return o.a})},function(e,t,n){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i={parseUA:function(){var e=navigator.userAgent,t=navigator.userAgent.toLowerCase(),n="micromessenger"==t.match(/MicroMessenger/i),o=n||!!e.match(/(iPhone|iPod|Android|ios|Mobile)/i);return{mobile:o,pc:!o,ios:!!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),android:e.indexOf("Android")>-1,weixin:n,newsapp:e.indexOf("NewsApp")>-1,yixin:e.indexOf("YiXin")>-1,weibo:e.indexOf("weibo")>-1,yunyuedu:e.indexOf("PRIS")>-1,cloudmusic:t.indexOf("neteasemusic")>-1}},pc_code:function(){if(i.parseUA().pc){if("no"==document.body.getAttribute("code"))return;var e=document.createElement("div");e.style.cssText="width:100%;height:100%;position:fixed;left:0px;top:0px;z-index:9999999;background:#fff;";var t=document.createElement("img");t.style.cssText="width:300px;height:300px;position:fixed;top:50%;left:50%;margin-left:-150px;margin-top:-220px;",t.setAttribute("src","http://tool.oschina.net/action/qrcode/generate?data="+encodeURIComponent(location.href)+"&output=image%2Fgif&error=L&type=0&margin=4&size=4"),e.appendChild(t);var n=document.createElement("p");n.style.cssText="width:300px;height:300px;position:fixed;top:50%;left:50%;margin-left:-150px;margin-top:80px;text-align:center;font-size:19px;font-weight:bold;",e.appendChild(n),document.body.appendChild(e)}console.group&&console.group(location.href),console.log("%c ","opacity:.6;display:block;padding:50px;background:url('http://tool.oschina.net/action/qrcode/generate?data="+encodeURIComponent(location.href)+"&output=image%2Fgif&error=L&type=0&margin=4&size=4') no-repeat;background-size:contain;"),console.group&&console.groupEnd()},landscape:function(){function e(){"no"!=document.body.getAttribute("landscape")&&(180!==window.orientation&&0!==window.orientation||setTimeout(function(){t.style.display="none"},250),90!==window.orientation&&-90!==window.orientation||setTimeout(function(){t.style.display="block"},250))}var t=document.createElement("div");t.className="landscape",t.style.cssText="width:100%;height:100%;position:fixed;left:0px;top:0px;z-index:999999999;background:#000 url(//go.163.com/2015/public/common/image/tip2.png) no-repeat center center;display:none;",setTimeout(function(){document.body.appendChild(t)},200),e(),window.addEventListener("onorientationchange"in window?"orientationchange":"resize",e,!1)},autoPlay:function(e){function t(n){switch(document.removeEventListener("WeixinJSBridgeReady",t,!1),document.removeEventListener("YixinJSBridgeReady",t,!1),document.removeEventListener("touchstart",t,!1),void 0===e?"undefined":o(e)){case"string":console.log("string"),document.getElementById(e).play();break;case"object":console.log("object"),e.play();break;case"function":e(n)}}document.addEventListener("WeixinJSBridgeReady",t,!1),document.addEventListener("YixinJSBridgeReady",t,!1),document.addEventListener("touchstart",t,!1),window.netease_ds.ua.ios&&window.netease_ds.ua.newsapp&&t()},init:function(){window.netease_ds=i,window.netease_ds.ua=i.parseUA(),console.log(window.netease_ds.ua),console.log(i.parseUA()),i.landscape(),i.pc_code()}};t.a=i}])}); //# sourceMappingURL=index.js.map