wsruletts.min.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. function browserRedirect() {
  2. var e = navigator.userAgent.toLowerCase()
  3. , t = "ipad" == e.match(/ipad/i)
  4. , n = "iphone os" == e.match(/iphone os/i)
  5. , i = "midp" == e.match(/midp/i)
  6. , r = "rv:1.2.3.4" == e.match(/rv:1.2.3.4/i)
  7. , s = "ucweb" == e.match(/ucweb/i)
  8. , a = "android" == e.match(/android/i)
  9. , o = "windows ce" == e.match(/windows ce/i)
  10. , c = "windows mobile" == e.match(/windows mobile/i);
  11. return t || n || i || r || s || a || o || c ? "phone" : "pc"
  12. }
  13. (function (t) {
  14. t.extend({
  15. _Rouslette: {
  16. init: function () {
  17. },
  18. _rotate_one: 0,
  19. pre_rotate: 0,
  20. pre_titlelen: 0,
  21. max_fontcount: 10,
  22. hymenuObj: {
  23. oneQ_ratote_max: "pc" == browserRedirect() ? 40 : 50,
  24. twoQ_ratote_max: "pc" == browserRedirect() ? 63 : 32,
  25. threeQ_ratote_max: "pc" == browserRedirect() ? 83 : 40
  26. },
  27. initArea: function (e, n, a, cb = () => { }, isIcon = false) {
  28. var r = document.querySelector(e)
  29. , o = 0
  30. , s = this
  31. , i = a.length
  32. , u = Math.ceil(i / 2);
  33. this._rotate_one = -12 * u,
  34. s.pre_titlelen = 0,
  35. s.pre_rotate = 0;
  36. for (let y = 0; y < a.length; y++) {
  37. var c = document.createElement("span"),
  38. h = document.createElement("a"),
  39. div = document.createElement("div");
  40. div.style.backgroundImage = `url(${a[y].icon})`
  41. "scene" == n && (a[y].scenename = "scene" + a[y].id);
  42. var d = a[y].name
  43. , g = d.length;
  44. g = g > this.max_fontcount ? this.max_fontcount : g,
  45. d = d.substring(0, this.max_fontcount),
  46. t(h).text(d),
  47. t(h).bind("click", function (t) {
  48. if (!window.firstClick) {
  49. s.areaClick(t)
  50. cb(t)
  51. window.firstClick = true
  52. }
  53. try {
  54. if (document.querySelector('#ifr')) {
  55. if (!document.querySelector('#ifr').contentWindow.player.flying) {
  56. // s.areaClick(t)
  57. // cb(t)
  58. cb(t,s)
  59. }
  60. }
  61. } catch (error) {
  62. error
  63. }
  64. }),
  65. isIcon && c.appendChild(div),
  66. isIcon && t(div).bind("click", function (t) {
  67. try {
  68. if (document.querySelector('#ifr')) {
  69. if (!document.querySelector('#ifr').contentWindow.player.flying) {
  70. // s.areaClick(t)
  71. // cb(t)
  72. cb(t,s)
  73. }
  74. }
  75. } catch (error) {
  76. error
  77. }
  78. }),
  79. c.appendChild(h),
  80. c.style.webkitTransformOrigin = "50% 100%";
  81. c.style.fontSize = '12px'
  82. var l = s._rotate_one
  83. , m = 3 * (s.max_fontcount - d.length) / 2;
  84. if (y > 0) {
  85. var _ = 3 * s.pre_titlelen + 3 * (s.max_fontcount - s.pre_titlelen) / 2;
  86. l = s.pre_rotate + _ + 3 - m + ("pc" == browserRedirect() ? (n == 'two' ? 2 : 8) : (isIcon ? 5 : (n == 'two' ? 3 : 8)))
  87. }
  88. ".hymenu_industry" == e ? l -= 3 : ".hymenu_sub" == e && (l -= 5),
  89. s.pre_rotate = l,
  90. c.style.webkitTransform = "rotate(" + l + "deg)",
  91. t(h).attr({
  92. datarotate: l,
  93. "data-typee": n,
  94. "data-gid": a[y].id,
  95. "data-isIcon": isIcon ? 1 : 0
  96. });
  97. isIcon && t(div).attr({
  98. datarotate: l,
  99. "data-typee": n,
  100. "data-gid": a[y].id,
  101. "data-isIcon": 1
  102. });
  103. g > 3 && t(h).addClass("acr" + g),
  104. r.appendChild(c),
  105. s.pre_titlelen = d.length,
  106. y == u - 1 && (o = l,
  107. s.hymenuObj[e.substr(1) + "_rotate_center"] = o),
  108. u - 1 == 0 ? s.hymenuObj[e.substr(1) + "_rotate_center_next"] = l : y == u && (s.hymenuObj[e.substr(1) + "_rotate_center_next"] = l),
  109. y == i - 3 && (s.hymenuObj[e.substr(1) + "_rotate_last_two"] = l)
  110. }
  111. switch ("function" == typeof t.fn.fitText ? (t(".acr4").show().arctext({
  112. dir: 1,
  113. radius: 220
  114. }),
  115. t(".acr5").show().arctext({
  116. dir: 1,
  117. radius: 200
  118. }),
  119. t(".acr6").show().arctext({
  120. dir: 1,
  121. radius: 200
  122. }),
  123. t(".acr7").show().arctext({
  124. dir: 1,
  125. radius: 220
  126. }),
  127. t(".acr8").show().arctext({
  128. dir: 1,
  129. radius: 240
  130. })) : '',
  131. e) {
  132. case ".hymenu":
  133. s.pre_rotate > s.hymenuObj.oneQ_ratote_max && "pc" != browserRedirect() && (s.hymenuObj[e.substr(1) + "_rotate_center"] += 8),
  134. this.rotateReset(e.substr(1), 0 - s.hymenuObj[e.substr(1) + "_rotate_center"]);
  135. break;
  136. case ".hymenu1":
  137. this.rotateReset(e.substr(1), 0)
  138. break;
  139. default:
  140. this.rotateReset(e.substr(1), 0 - o)
  141. }
  142. },
  143. initIndustry: function (e, n) {
  144. var a = document.querySelector(e);
  145. for (var r in n) {
  146. var o = document.createElement("span")
  147. , s = document.createElement("a");
  148. s.setAttribute("iid", n[r].iid),
  149. s.setAttribute("id", "indu_btn_" + n[r].iid),
  150. s.setAttribute("s", r),
  151. t(s).text(n[r].name),
  152. t(s).bind("click", function (t) {
  153. this.industryClick(t)
  154. }),
  155. o.appendChild(s),
  156. o.style.webkitTransform = "rotate(" + 12 * r + "deg)",
  157. a.appendChild(o)
  158. }
  159. },
  160. areaClick: function (e) {
  161. var n = t(e.target).attr("datarotate")
  162. , isIcon = t(e.target).attr("data-isIcon")
  163. , a = t(e.target).attr("class")
  164. , r = t(e.target).parent();
  165. if (isIcon == 1) {
  166. r = t(e.target).parent()
  167. r.addClass("on").siblings().removeClass("on")
  168. setTimeout(() => {
  169. r.removeClass("on")
  170. }, 1000);
  171. } else {
  172. "char1char2char3char4char5char6".indexOf(a) > -1 && (n = t(e.target).parent().attr("datarotate"),
  173. r = t(e.target).parent().parent()),
  174. this.rotateReset(r.parent().attr("class"), 0 - n),
  175. r.addClass("on").siblings().removeClass("on")
  176. }
  177. },
  178. industryClick: function (t) {
  179. showSub(t),
  180. rotate(t),
  181. changeArea(t),
  182. setGlobal("search", !0),
  183. selected(getGlobal("areaid"))
  184. },
  185. rotateReset: function (e, n) {
  186. console.log(e);
  187. t("." + e + "_bg").removeClass("height0");
  188. (t("#" + e).length > 0 ? t("#" + e) : t("." + e)).css({
  189. transform: "rotate(" + n + "deg)",
  190. "-webkit-transform": "rotate(" + n + "deg)"
  191. }).removeClass("height0")
  192. },
  193. getRotate: function (t) {
  194. var e = document.getElementById(t)
  195. , n = window.getComputedStyle(e, null)
  196. , a = n.getPropertyValue("-webkit-transform") || n.getPropertyValue("-moz-transform") || n.getPropertyValue("-ms-transform") || n.getPropertyValue("-o-transform") || n.getPropertyValue("transform") || "FAIL";
  197. try {
  198. var r = a.split("(")[1].split(")")[0].split(",")
  199. } catch (t) {
  200. return !1
  201. }
  202. var o = r[0]
  203. , s = r[1]
  204. , i = (r[2],
  205. r[3],
  206. Math.sqrt(o * o + s * s),
  207. Math.round(Math.atan2(s, o) * (180 / Math.PI)));
  208. return i
  209. },
  210. touchMovefunc: function () {
  211. var e = arguments[0]
  212. , a = this
  213. , r = {
  214. startX: 0,
  215. startY: 0,
  216. endX: 0,
  217. endY: 0,
  218. nowDeg: 0
  219. };
  220. t("#" + e).on({
  221. touchstart: function (t) {
  222. r.startX = t.originalEvent.changedTouches[0].pageX,
  223. r.startY = t.originalEvent.changedTouches[0].pageY,
  224. r.nowDeg = a.getRotate(e)
  225. },
  226. touchmove: function (a) {
  227. r.endX = a.originalEvent.changedTouches[0].pageX,
  228. r.endY = a.originalEvent.changedTouches[0].pageY;
  229. var o = r.endX - r.startX
  230. , s = r.endY - r.startY;
  231. if (1 == n)
  232. var i = o / 5;
  233. else
  234. i = -s / 5;
  235. t("#" + e).css({
  236. "-webkit-transform": "rotate(" + (r.nowDeg + i) + "deg)",
  237. transition: "none"
  238. })
  239. },
  240. touchend: function () {
  241. r.nowDeg = a.getRotate(e),
  242. 1 == n ? r.nowDeg > 50 ? (a.rotateReset(e, 50),
  243. r.nowDeg = 50) : r.nowDeg < -50 && (a.rotateReset(e, -50),
  244. r.nowDeg = -50) : r.nowDeg > 1 ? (a.rotateReset(e, -5),
  245. r.nowDeg = -5) : r.nowDeg < -180 && (a.rotateReset(e, -170),
  246. r.nowDeg = -170)
  247. }
  248. })
  249. },
  250. rotateArea: function (e) {
  251. var a = [55, 43, 31, 19, 7, -5, -17, -29, -41, -53, -65, -77, -89, -101, -113, -125, -137, -149, -161];
  252. 1 == n || t.each(a, function (t) {
  253. a[t] = a[t] - 90
  254. });
  255. var r = t("#hymenu_area a");
  256. t.each(r, function (n) {
  257. t(r[n]).html() == t(e.target).html() && t(".hymenu").css({
  258. "-webkit-transform": "rotate(" + a[n] + "deg)",
  259. transition: "all 0.5s ease-in-out"
  260. })
  261. })
  262. },
  263. bindingTouch: function () {
  264. t("#hycontrolBtn, .today_topic_banner").bind("touchmove", function (t) {
  265. t.preventDefault()
  266. });
  267. var e = {
  268. startX: 0,
  269. startY: 0,
  270. endX: 0,
  271. endY: 0,
  272. nowDeg: 0,
  273. ismove: 0
  274. };
  275. t(".hymenu").on({
  276. touchstart: function (n) {
  277. e.startX = n.originalEvent.changedTouches[0].pageX,
  278. e.startY = n.originalEvent.changedTouches[0].pageY,
  279. e.nowDeg = t._Rouslette.getRotate("hymenu_area"),
  280. e.transition = t("#hymenu_area").css("transition"),
  281. e.direction = ""
  282. },
  283. touchmove: function (a) {
  284. e.ismove = 1,
  285. e.endX = a.originalEvent.changedTouches[0].pageX,
  286. e.endY = a.originalEvent.changedTouches[0].pageY;
  287. var r = e.endX - e.startX
  288. , o = e.endY - e.startY;
  289. if (1 == n)
  290. var s = r / 5;
  291. else
  292. s = -o / 5;
  293. t(".hymenu").css({
  294. "-webkit-transform": "rotate(" + (e.nowDeg + s) + "deg)",
  295. transition: "none"
  296. })
  297. },
  298. touchend: function () {
  299. if (t("#toast").remove(),
  300. 0 == e.ismove)
  301. return;
  302. e.ismove = 0,
  303. t("#hymenu_area").css("transition", e.transition),
  304. e.nowDeg = t._Rouslette.getRotate("hymenu_area");
  305. let n = t(".hymenu>span:last a").attr("datarotate");
  306. let acvv = t(".hymenu>span[class='on'] a").attr("datarotate");
  307. n < t._Rouslette.hymenuObj.oneQ_ratote_max && t._Rouslette.rotateReset("hymenu_area", 0 - acvv)
  308. }
  309. }),
  310. t(".hymenu_industry").on({
  311. touchstart: function (n) {
  312. e.startX = n.originalEvent.changedTouches[0].pageX,
  313. e.startY = n.originalEvent.changedTouches[0].pageY,
  314. e.nowDeg = t._Rouslette.getRotate("hymenu_industry"),
  315. e.transition = t("#hymenu_industry").css("transition"),
  316. e.direction = ""
  317. },
  318. touchmove: function (a) {
  319. e.ismove = 1,
  320. e.endX = a.originalEvent.changedTouches[0].pageX,
  321. e.endY = a.originalEvent.changedTouches[0].pageY;
  322. var r = e.endX - e.startX
  323. , o = e.endY - e.startY;
  324. if (1 == n)
  325. var s = r / 5;
  326. else
  327. s = -o / 5;
  328. t(".hymenu_industry").css({
  329. "-webkit-transform": "rotate(" + (e.nowDeg + s) + "deg)",
  330. transition: "none"
  331. })
  332. },
  333. touchend: function () {
  334. if (0 == e.ismove)
  335. return;
  336. e.ismove = 0,
  337. t("#hymenu_industry").css("transition", e.transition),
  338. e.nowDeg = t._Rouslette.getRotate("hymenu_industry");
  339. let n = t(".hymenu_industry>span:last a").attr("datarotate");
  340. n < t._Rouslette.hymenuObj.twoQ_ratote_max && t._Rouslette.rotateReset("hymenu_industry", 0 - t._Rouslette.hymenuObj.hymenu_industry_rotate_center)
  341. }
  342. }),
  343. t(".hymenu_sub").on({
  344. touchstart: function (n) {
  345. e.startX = n.originalEvent.changedTouches[0].pageX,
  346. e.startY = n.originalEvent.changedTouches[0].pageY,
  347. e.nowDeg = t._Rouslette.getRotate("hymenu_sub"),
  348. e.transition = t("#hymenu_sub").css("transition"),
  349. e.direction = ""
  350. },
  351. touchmove: function (a) {
  352. e.ismove = 1,
  353. e.endX = a.originalEvent.changedTouches[0].pageX,
  354. e.endY = a.originalEvent.changedTouches[0].pageY;
  355. var r = e.endX - e.startX
  356. , o = e.endY - e.startY;
  357. if (1 == n)
  358. var s = r / 5;
  359. else
  360. s = -o / 5;
  361. t(".hymenu_sub").css({
  362. "-webkit-transform": "rotate(" + (e.nowDeg + s) + "deg)",
  363. transition: "none"
  364. })
  365. },
  366. touchend: function () {
  367. if (0 == e.ismove)
  368. return;
  369. e.ismove = 0,
  370. t("#hymenu_sub").css("transition", e.transition),
  371. e.nowDeg = t._Rouslette.getRotate("hymenu_sub");
  372. let n = t(".hymenu_sub>span:last a").attr("datarotate");
  373. n < t._Rouslette.hymenuObj.threeQ_ratote_max && t._Rouslette.rotateReset("hymenu_sub", 0 - t._Rouslette.hymenuObj.hymenu_sub_rotate_center)
  374. }
  375. });
  376. }
  377. }
  378. })
  379. var n = 1
  380. }
  381. )(jQuery);