wsruletts.min.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  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. t("." + e + "_bg").removeClass("height0"),
  187. (t("#" + e).length > 0 ? t("#" + e) : t("." + e)).css({
  188. transform: "rotate(" + n + "deg)",
  189. "-webkit-transform": "rotate(" + n + "deg)"
  190. }).removeClass("height0")
  191. },
  192. getRotate: function (t) {
  193. var e = document.getElementById(t)
  194. , n = window.getComputedStyle(e, null)
  195. , a = n.getPropertyValue("-webkit-transform") || n.getPropertyValue("-moz-transform") || n.getPropertyValue("-ms-transform") || n.getPropertyValue("-o-transform") || n.getPropertyValue("transform") || "FAIL";
  196. try {
  197. var r = a.split("(")[1].split(")")[0].split(",")
  198. } catch (t) {
  199. return !1
  200. }
  201. var o = r[0]
  202. , s = r[1]
  203. , i = (r[2],
  204. r[3],
  205. Math.sqrt(o * o + s * s),
  206. Math.round(Math.atan2(s, o) * (180 / Math.PI)));
  207. return i
  208. },
  209. touchMovefunc: function () {
  210. var e = arguments[0]
  211. , a = this
  212. , r = {
  213. startX: 0,
  214. startY: 0,
  215. endX: 0,
  216. endY: 0,
  217. nowDeg: 0
  218. };
  219. t("#" + e).on({
  220. touchstart: function (t) {
  221. r.startX = t.originalEvent.changedTouches[0].pageX,
  222. r.startY = t.originalEvent.changedTouches[0].pageY,
  223. r.nowDeg = a.getRotate(e)
  224. },
  225. touchmove: function (a) {
  226. r.endX = a.originalEvent.changedTouches[0].pageX,
  227. r.endY = a.originalEvent.changedTouches[0].pageY;
  228. var o = r.endX - r.startX
  229. , s = r.endY - r.startY;
  230. if (1 == n)
  231. var i = o / 5;
  232. else
  233. i = -s / 5;
  234. t("#" + e).css({
  235. "-webkit-transform": "rotate(" + (r.nowDeg + i) + "deg)",
  236. transition: "none"
  237. })
  238. },
  239. touchend: function () {
  240. r.nowDeg = a.getRotate(e),
  241. 1 == n ? r.nowDeg > 50 ? (a.rotateReset(e, 50),
  242. r.nowDeg = 50) : r.nowDeg < -50 && (a.rotateReset(e, -50),
  243. r.nowDeg = -50) : r.nowDeg > 1 ? (a.rotateReset(e, -5),
  244. r.nowDeg = -5) : r.nowDeg < -180 && (a.rotateReset(e, -170),
  245. r.nowDeg = -170)
  246. }
  247. })
  248. },
  249. rotateArea: function (e) {
  250. var a = [55, 43, 31, 19, 7, -5, -17, -29, -41, -53, -65, -77, -89, -101, -113, -125, -137, -149, -161];
  251. 1 == n || t.each(a, function (t) {
  252. a[t] = a[t] - 90
  253. });
  254. var r = t("#hymenu_area a");
  255. t.each(r, function (n) {
  256. t(r[n]).html() == t(e.target).html() && t(".hymenu").css({
  257. "-webkit-transform": "rotate(" + a[n] + "deg)",
  258. transition: "all 0.5s ease-in-out"
  259. })
  260. })
  261. },
  262. bindingTouch: function () {
  263. t("#hycontrolBtn, .today_topic_banner").bind("touchmove", function (t) {
  264. t.preventDefault()
  265. });
  266. var e = {
  267. startX: 0,
  268. startY: 0,
  269. endX: 0,
  270. endY: 0,
  271. nowDeg: 0,
  272. ismove: 0
  273. };
  274. t(".hymenu").on({
  275. touchstart: function (n) {
  276. e.startX = n.originalEvent.changedTouches[0].pageX,
  277. e.startY = n.originalEvent.changedTouches[0].pageY,
  278. e.nowDeg = t._Rouslette.getRotate("hymenu_area"),
  279. e.transition = t("#hymenu_area").css("transition"),
  280. e.direction = ""
  281. },
  282. touchmove: function (a) {
  283. e.ismove = 1,
  284. e.endX = a.originalEvent.changedTouches[0].pageX,
  285. e.endY = a.originalEvent.changedTouches[0].pageY;
  286. var r = e.endX - e.startX
  287. , o = e.endY - e.startY;
  288. if (1 == n)
  289. var s = r / 5;
  290. else
  291. s = -o / 5;
  292. t(".hymenu").css({
  293. "-webkit-transform": "rotate(" + (e.nowDeg + s) + "deg)",
  294. transition: "none"
  295. })
  296. },
  297. touchend: function () {
  298. if (t("#toast").remove(),
  299. 0 == e.ismove)
  300. return;
  301. e.ismove = 0,
  302. t("#hymenu_area").css("transition", e.transition),
  303. e.nowDeg = t._Rouslette.getRotate("hymenu_area");
  304. let n = t(".hymenu>span:last a").attr("datarotate");
  305. n < t._Rouslette.hymenuObj.oneQ_ratote_max && t._Rouslette.rotateReset("hymenu_area", 0 - t._Rouslette.hymenuObj.hymenu_rotate_center)
  306. }
  307. }),
  308. t(".hymenu_industry").on({
  309. touchstart: function (n) {
  310. e.startX = n.originalEvent.changedTouches[0].pageX,
  311. e.startY = n.originalEvent.changedTouches[0].pageY,
  312. e.nowDeg = t._Rouslette.getRotate("hymenu_industry"),
  313. e.transition = t("#hymenu_industry").css("transition"),
  314. e.direction = ""
  315. },
  316. touchmove: function (a) {
  317. e.ismove = 1,
  318. e.endX = a.originalEvent.changedTouches[0].pageX,
  319. e.endY = a.originalEvent.changedTouches[0].pageY;
  320. var r = e.endX - e.startX
  321. , o = e.endY - e.startY;
  322. if (1 == n)
  323. var s = r / 5;
  324. else
  325. s = -o / 5;
  326. t(".hymenu_industry").css({
  327. "-webkit-transform": "rotate(" + (e.nowDeg + s) + "deg)",
  328. transition: "none"
  329. })
  330. },
  331. touchend: function () {
  332. if (0 == e.ismove)
  333. return;
  334. e.ismove = 0,
  335. t("#hymenu_industry").css("transition", e.transition),
  336. e.nowDeg = t._Rouslette.getRotate("hymenu_industry");
  337. let n = t(".hymenu_industry>span:last a").attr("datarotate");
  338. n < t._Rouslette.hymenuObj.twoQ_ratote_max && t._Rouslette.rotateReset("hymenu_industry", 0 - t._Rouslette.hymenuObj.hymenu_industry_rotate_center)
  339. }
  340. }),
  341. t(".hymenu_sub").on({
  342. touchstart: function (n) {
  343. e.startX = n.originalEvent.changedTouches[0].pageX,
  344. e.startY = n.originalEvent.changedTouches[0].pageY,
  345. e.nowDeg = t._Rouslette.getRotate("hymenu_sub"),
  346. e.transition = t("#hymenu_sub").css("transition"),
  347. e.direction = ""
  348. },
  349. touchmove: function (a) {
  350. e.ismove = 1,
  351. e.endX = a.originalEvent.changedTouches[0].pageX,
  352. e.endY = a.originalEvent.changedTouches[0].pageY;
  353. var r = e.endX - e.startX
  354. , o = e.endY - e.startY;
  355. if (1 == n)
  356. var s = r / 5;
  357. else
  358. s = -o / 5;
  359. t(".hymenu_sub").css({
  360. "-webkit-transform": "rotate(" + (e.nowDeg + s) + "deg)",
  361. transition: "none"
  362. })
  363. },
  364. touchend: function () {
  365. if (0 == e.ismove)
  366. return;
  367. e.ismove = 0,
  368. t("#hymenu_sub").css("transition", e.transition),
  369. e.nowDeg = t._Rouslette.getRotate("hymenu_sub");
  370. let n = t(".hymenu_sub>span:last a").attr("datarotate");
  371. n < t._Rouslette.hymenuObj.threeQ_ratote_max && t._Rouslette.rotateReset("hymenu_sub", 0 - t._Rouslette.hymenuObj.hymenu_sub_rotate_center)
  372. }
  373. });
  374. }
  375. }
  376. })
  377. var n = 1
  378. }
  379. )(jQuery);