wsruletts.min.js 17 KB

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