eg.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. (function(){
  2. var eg = window.endgame = {};
  3. eg.env = {};
  4. eg.env.ee = true;
  5. if ('WeixinJSBridge' in window) {
  6. eg.env.weixin = true;
  7. }
  8. // loading
  9. (function(){
  10. endgame = endgame || {};
  11. if (window.endgame_loading !== false) {
  12. endgame.loading = {
  13. init: function() {
  14. var me = this;
  15. var timer = setTimeout(function() {
  16. clearTimeout(timer);
  17. if (!document.body || !document.body.appendChild) {
  18. this.init();
  19. }
  20. else {
  21. var div = me.el = document.createElement('div');
  22. div.style.cssText =
  23. 'position:absolute;top:0;right:0;bottom:0;left:0;' +
  24. 'background:rgba(0,0,0,0.95) url('+_config['isSite']+'vapp/49/loading.jpg) no-repeat center 35%;' +
  25. 'background-size: 60%;' +
  26. '-webkit-transition: opacity .8s linear;' +
  27. 'text-align: center;' +
  28. 'z-index: 999999;'
  29. ;
  30. document.body.appendChild(div);
  31. if ( !('endgame_loading_auto' in window) ||
  32. window.endgame_loading_auto !== false ) {
  33. me.delayHide();
  34. }
  35. }
  36. }, 16);
  37. },
  38. hide: function() {
  39. me.el.style.opacity = 0;
  40. },
  41. delayHide: function() {
  42. var me = this;
  43. setTimeout(function(){
  44. me.el.style.opacity = 0;
  45. setTimeout(function(){
  46. me.el.parentNode.removeChild(me.el);
  47. }, 800);
  48. }, 1000);
  49. }
  50. };
  51. endgame.loading.init();
  52. }
  53. })();
  54. })();