qipa_app.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. if (void 0 == APP_API_URL)
  2. var APP_API_URL = /localhost/.test(location.host) ? "http://localhost:8000/" : "http://yx8.com/";
  3. if (void 0 == APP_LIST_URL)
  4. var APP_LIST_URL = "http://game.ikongzhong.cn/";
  5. if (void 0 == APP_FOLLOW_URL)
  6. var APP_FOLLOW_URL = "http://yx8.com/game/maomaoyujia/?from=maomaoyujia";
  7. if (void 0 == ENABLE_SHARE)
  8. var ENABLE_SHARE = !0;
  9. if (void 0 == ENABLE_LB)
  10. var ENABLE_LB = !0;
  11. var APP_DEPLOYMENT = "WX", IS_IOS = navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? !0 : !1, IS_ANDROID = -1 < navigator.userAgent.indexOf("Android");
  12. qipaShare = {
  13. title : GID,
  14. desc : GID,
  15. link : document.URL,
  16. imgUrl : "./img/maomaoyujia.png"
  17. };
  18. (function (a, g) {
  19. function f(b) {
  20. b > a.best && (a.best = b, a.storage.set(h, a.best))
  21. }
  22. var c = APP_API_URL + "social/",
  23. d = location.search ? location.search + "&callback=?" : "?callback=?",
  24. h = GID + ":best";
  25. a.storage = a.storage || {};
  26. a.storage.get = function (b) {
  27. try {
  28. b in localStorage && ($.cookie(b, localStorage[b], {
  29. expires : 60
  30. }), localStorage.removeItem(b))
  31. } catch (a) {}
  32. return $.cookie(b)
  33. };
  34. a.storage.set = function (b,
  35. a) {
  36. $.cookie(b, a, {
  37. expires : 60
  38. });
  39. return !0
  40. };
  41. a.score = 0;
  42. a.best = a.storage.get(h) || 0;
  43. a.newRecord = !1;
  44. a.startOAuth = function () {
  45. console.log(APP_API_URL + "wxoauth_start");
  46. window.open(APP_API_URL + "wxoauth_start")
  47. };
  48. a.leaderboard = function (b, a, c) {
  49. console.log(APP_API_URL + "leaderboard/" + a + "/" + c + "?callback=?");
  50. $.getJSON(APP_API_URL + "leaderboard/" + a + "/" + c + "?callback=?", b)
  51. };
  52. a.onGameInit = function () {};
  53. a.onGameStarted = function () {
  54. qipaStage.showFollowAnim(!1)
  55. };
  56. a.onGameOver = function () {
  57. qipaStage.showFollowAnim(!0)
  58. };
  59. a.social = a.social || {};
  60. a.social.chongzhi = function (b) {
  61. console.log(c + "chongzhi" +
  62. d);
  63. $.getJSON(c + "chongzhi" + d, b)
  64. };
  65. a.social.startOAuth = function (b) {
  66. b = encodeURIComponent(b);
  67. console.log(c + "wxoauth_start/?ret=" + b);
  68. window.open(c + "wxoauth_start/?ret=" + b)
  69. };
  70. a.social.viewMe = function (b) {
  71. console.log(c + "me" + d);
  72. $.getJSON(c + "me" + d, b)
  73. };
  74. a.social.viewPlayer = function (b, a) {
  75. console.log(c + "view" + d + "&pid=" + a);
  76. $.getJSON(c + "view" + d + "&pid=" + a, b)
  77. };
  78. a.social.searchPlayer = function (b, a) {
  79. console.log(c + "search" + d + "&qstr=" + encodeURIComponent(a));
  80. $.getJSON(c + "search" + d + "&qstr=" + encodeURIComponent(a), b)
  81. };
  82. a.social.friendList =
  83. function (a) {
  84. console.log(c + "frdlist" + d);
  85. $.getJSON(c + "frdlist" + d, a)
  86. };
  87. a.social.mywall = function (a) {
  88. console.log(c + "mywall" + d);
  89. $.getJSON(c + "mywall" + d, a)
  90. };
  91. a.social.peerwall = function (a, e) {
  92. console.log(c + "wall" + d + "&pid=" + e);
  93. $.getJSON(c + "wall" + d + "&pid=" + e, a)
  94. };
  95. a.social.conversation = function (a, e) {
  96. console.log(c + "conversation" + d + "&pid=" + e);
  97. $.getJSON(c + "conversation" + d + "&pid=" + e, a)
  98. };
  99. a.social.wallAdd = function (a, e, k) {
  100. console.log(c + "walladd" + d + "&pid=" + k);
  101. $.getJSON(c + "walladd" + d + "&pid=" + k + "&msg=" + encodeURIComponent(e),
  102. a)
  103. };
  104. a.social.friendDel = function (a, e) {
  105. console.log(c + "frddel" + d + "&pid=" + e);
  106. $.getJSON(c + "frddel" + d + "&pid=" + e, a)
  107. };
  108. a.social.friendAdd = function (a, e) {
  109. console.log(c + "frdadd" + d + "&pid=" + e);
  110. $.getJSON(c + "frdadd" + d + "&pid=" + e, a)
  111. };
  112. a.social.friendBlack = function (a, e) {
  113. console.log(c + "frdblack" + d + "&pid=" + e);
  114. $.getJSON(c + "frdblack" + d + "&pid=" + e, a)
  115. };
  116. a.leaderboard = function (a, c, d) {
  117. console.log(APP_API_URL + "leaderboard/" + c + "/" + d + "?callback=?");
  118. $.getJSON(APP_API_URL + "leaderboard/" + c + "/" + d + "?callback=?", a)
  119. }
  120. })(window.qipaApp = window.qipaApp || {});
  121. function qipaUi_showPopup(a) {
  122. console.log("showPopup url: " + a);
  123. window.scroll(0, 0);
  124. var g = document.body.scrollWidth,
  125. f = document.body.scrollHeight;
  126. void 0 == window.popup && (window.popup = $('<iframe id="popup" class="app-popup">'), $("body").append(window.popup));
  127. window.popup.attr("src", a);
  128. window.popup.css({
  129. width : g,
  130. height : f
  131. }).fadeIn()
  132. };