123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389 |
- function browserRedirect() {
- var e = navigator.userAgent.toLowerCase()
- , t = "ipad" == e.match(/ipad/i)
- , n = "iphone os" == e.match(/iphone os/i)
- , i = "midp" == e.match(/midp/i)
- , r = "rv:1.2.3.4" == e.match(/rv:1.2.3.4/i)
- , s = "ucweb" == e.match(/ucweb/i)
- , a = "android" == e.match(/android/i)
- , o = "windows ce" == e.match(/windows ce/i)
- , c = "windows mobile" == e.match(/windows mobile/i);
- return t || n || i || r || s || a || o || c ? "phone" : "pc"
- }
- (function (t) {
- t.extend({
- _Rouslette: {
- init: function () {
- },
- _rotate_one: 0,
- pre_rotate: 0,
- pre_titlelen: 0,
- max_fontcount: 10,
- hymenuObj: {
- oneQ_ratote_max: "pc" == browserRedirect() ? 40 : 50,
- twoQ_ratote_max: "pc" == browserRedirect() ? 63 : 32,
- threeQ_ratote_max: "pc" == browserRedirect() ? 83 : 40
- },
- initArea: function (e, n, a, cb = () => { }, isIcon = false) {
- var r = document.querySelector(e)
- , o = 0
- , s = this
- , i = a.length
- , u = Math.ceil(i / 2);
- this._rotate_one = -12 * u,
- s.pre_titlelen = 0,
- s.pre_rotate = 0;
- for (let y = 0; y < a.length; y++) {
- var c = document.createElement("span"),
- h = document.createElement("a"),
- div = document.createElement("div");
- div.style.backgroundImage = `url(${a[y].icon})`
- "scene" == n && (a[y].scenename = "scene" + a[y].id);
- var d = a[y].name
- , g = d.length;
- g = g > this.max_fontcount ? this.max_fontcount : g,
- d = d.substring(0, this.max_fontcount),
- t(h).text(d),
- t(h).bind("click", function (t) {
- if (!window.firstClick) {
- s.areaClick(t)
- cb(t)
- window.firstClick = true
- }
- try {
- if (document.querySelector('#ifr')) {
- if (!document.querySelector('#ifr').contentWindow.player.flying) {
- // s.areaClick(t)
- // cb(t)
- cb(t,s)
- }
- }
- } catch (error) {
- error
- }
- }),
- isIcon && c.appendChild(div),
- isIcon && t(div).bind("click", function (t) {
- try {
- if (document.querySelector('#ifr')) {
- if (!document.querySelector('#ifr').contentWindow.player.flying) {
- // s.areaClick(t)
- // cb(t)
- cb(t,s)
- }
- }
- } catch (error) {
- error
- }
- }),
- c.appendChild(h),
- c.style.webkitTransformOrigin = "50% 100%";
- c.style.fontSize = '12px'
- var l = s._rotate_one
- , m = 3 * (s.max_fontcount - d.length) / 2;
- if (y > 0) {
- var _ = 3 * s.pre_titlelen + 3 * (s.max_fontcount - s.pre_titlelen) / 2;
- l = s.pre_rotate + _ + 3 - m + ("pc" == browserRedirect() ? (n == 'two' ? 2 : 8) : (isIcon ? 5 : (n == 'two' ? 3 : 8)))
- }
- ".hymenu_industry" == e ? l -= 3 : ".hymenu_sub" == e && (l -= 5),
- s.pre_rotate = l,
- c.style.webkitTransform = "rotate(" + l + "deg)",
- t(h).attr({
- datarotate: l,
- "data-typee": n,
- "data-gid": a[y].id,
- "data-isIcon": isIcon ? 1 : 0
- });
- isIcon && t(div).attr({
- datarotate: l,
- "data-typee": n,
- "data-gid": a[y].id,
- "data-isIcon": 1
- });
- g > 3 && t(h).addClass("acr" + g),
- r.appendChild(c),
- s.pre_titlelen = d.length,
- y == u - 1 && (o = l,
- s.hymenuObj[e.substr(1) + "_rotate_center"] = o),
- u - 1 == 0 ? s.hymenuObj[e.substr(1) + "_rotate_center_next"] = l : y == u && (s.hymenuObj[e.substr(1) + "_rotate_center_next"] = l),
- y == i - 3 && (s.hymenuObj[e.substr(1) + "_rotate_last_two"] = l)
- }
- switch ("function" == typeof t.fn.fitText ? (t(".acr4").show().arctext({
- dir: 1,
- radius: 220
- }),
- t(".acr5").show().arctext({
- dir: 1,
- radius: 200
- }),
- t(".acr6").show().arctext({
- dir: 1,
- radius: 200
- }),
- t(".acr7").show().arctext({
- dir: 1,
- radius: 220
- }),
- t(".acr8").show().arctext({
- dir: 1,
- radius: 240
- })) : '',
- e) {
- case ".hymenu":
- s.pre_rotate > s.hymenuObj.oneQ_ratote_max && "pc" != browserRedirect() && (s.hymenuObj[e.substr(1) + "_rotate_center"] += 8),
- this.rotateReset(e.substr(1), 0 - s.hymenuObj[e.substr(1) + "_rotate_center"]);
- break;
- case ".hymenu1":
- this.rotateReset(e.substr(1), 0)
- break;
- default:
- this.rotateReset(e.substr(1), 0 - o)
- }
- },
- initIndustry: function (e, n) {
- var a = document.querySelector(e);
- for (var r in n) {
- var o = document.createElement("span")
- , s = document.createElement("a");
- s.setAttribute("iid", n[r].iid),
- s.setAttribute("id", "indu_btn_" + n[r].iid),
- s.setAttribute("s", r),
- t(s).text(n[r].name),
- t(s).bind("click", function (t) {
- this.industryClick(t)
- }),
- o.appendChild(s),
- o.style.webkitTransform = "rotate(" + 12 * r + "deg)",
- a.appendChild(o)
- }
- },
- areaClick: function (e) {
- var n = t(e.target).attr("datarotate")
- , isIcon = t(e.target).attr("data-isIcon")
- , a = t(e.target).attr("class")
- , r = t(e.target).parent();
- if (isIcon == 1) {
- r = t(e.target).parent()
- r.addClass("on").siblings().removeClass("on")
- setTimeout(() => {
- r.removeClass("on")
- }, 1000);
- } else {
- "char1char2char3char4char5char6".indexOf(a) > -1 && (n = t(e.target).parent().attr("datarotate"),
- r = t(e.target).parent().parent()),
- this.rotateReset(r.parent().attr("class"), 0 - n),
- r.addClass("on").siblings().removeClass("on")
- }
- },
- industryClick: function (t) {
- showSub(t),
- rotate(t),
- changeArea(t),
- setGlobal("search", !0),
- selected(getGlobal("areaid"))
- },
- rotateReset: function (e, n) {
- t("." + e + "_bg").removeClass("height0"),
- (t("#" + e).length > 0 ? t("#" + e) : t("." + e)).css({
- transform: "rotate(" + n + "deg)",
- "-webkit-transform": "rotate(" + n + "deg)"
- }).removeClass("height0")
- },
- getRotate: function (t) {
- var e = document.getElementById(t)
- , n = window.getComputedStyle(e, null)
- , a = n.getPropertyValue("-webkit-transform") || n.getPropertyValue("-moz-transform") || n.getPropertyValue("-ms-transform") || n.getPropertyValue("-o-transform") || n.getPropertyValue("transform") || "FAIL";
- try {
- var r = a.split("(")[1].split(")")[0].split(",")
- } catch (t) {
- return !1
- }
- var o = r[0]
- , s = r[1]
- , i = (r[2],
- r[3],
- Math.sqrt(o * o + s * s),
- Math.round(Math.atan2(s, o) * (180 / Math.PI)));
- return i
- },
- touchMovefunc: function () {
- var e = arguments[0]
- , a = this
- , r = {
- startX: 0,
- startY: 0,
- endX: 0,
- endY: 0,
- nowDeg: 0
- };
- t("#" + e).on({
- touchstart: function (t) {
- r.startX = t.originalEvent.changedTouches[0].pageX,
- r.startY = t.originalEvent.changedTouches[0].pageY,
- r.nowDeg = a.getRotate(e)
- },
- touchmove: function (a) {
- r.endX = a.originalEvent.changedTouches[0].pageX,
- r.endY = a.originalEvent.changedTouches[0].pageY;
- var o = r.endX - r.startX
- , s = r.endY - r.startY;
- if (1 == n)
- var i = o / 5;
- else
- i = -s / 5;
- t("#" + e).css({
- "-webkit-transform": "rotate(" + (r.nowDeg + i) + "deg)",
- transition: "none"
- })
- },
- touchend: function () {
- r.nowDeg = a.getRotate(e),
- 1 == n ? r.nowDeg > 50 ? (a.rotateReset(e, 50),
- r.nowDeg = 50) : r.nowDeg < -50 && (a.rotateReset(e, -50),
- r.nowDeg = -50) : r.nowDeg > 1 ? (a.rotateReset(e, -5),
- r.nowDeg = -5) : r.nowDeg < -180 && (a.rotateReset(e, -170),
- r.nowDeg = -170)
- }
- })
- },
- rotateArea: function (e) {
- var a = [55, 43, 31, 19, 7, -5, -17, -29, -41, -53, -65, -77, -89, -101, -113, -125, -137, -149, -161];
- 1 == n || t.each(a, function (t) {
- a[t] = a[t] - 90
- });
- var r = t("#hymenu_area a");
- t.each(r, function (n) {
- t(r[n]).html() == t(e.target).html() && t(".hymenu").css({
- "-webkit-transform": "rotate(" + a[n] + "deg)",
- transition: "all 0.5s ease-in-out"
- })
- })
- },
- bindingTouch: function () {
- t("#hycontrolBtn, .today_topic_banner").bind("touchmove", function (t) {
- t.preventDefault()
- });
- var e = {
- startX: 0,
- startY: 0,
- endX: 0,
- endY: 0,
- nowDeg: 0,
- ismove: 0
- };
- t(".hymenu").on({
- touchstart: function (n) {
- e.startX = n.originalEvent.changedTouches[0].pageX,
- e.startY = n.originalEvent.changedTouches[0].pageY,
- e.nowDeg = t._Rouslette.getRotate("hymenu_area"),
- e.transition = t("#hymenu_area").css("transition"),
- e.direction = ""
- },
- touchmove: function (a) {
- e.ismove = 1,
- e.endX = a.originalEvent.changedTouches[0].pageX,
- e.endY = a.originalEvent.changedTouches[0].pageY;
- var r = e.endX - e.startX
- , o = e.endY - e.startY;
- if (1 == n)
- var s = r / 5;
- else
- s = -o / 5;
- t(".hymenu").css({
- "-webkit-transform": "rotate(" + (e.nowDeg + s) + "deg)",
- transition: "none"
- })
- },
- touchend: function () {
- if (t("#toast").remove(),
- 0 == e.ismove)
- return;
- e.ismove = 0,
- t("#hymenu_area").css("transition", e.transition),
- e.nowDeg = t._Rouslette.getRotate("hymenu_area");
- let n = t(".hymenu>span:last a").attr("datarotate");
- n < t._Rouslette.hymenuObj.oneQ_ratote_max && t._Rouslette.rotateReset("hymenu_area", 0 - t._Rouslette.hymenuObj.hymenu_rotate_center)
- }
- }),
- t(".hymenu_industry").on({
- touchstart: function (n) {
- e.startX = n.originalEvent.changedTouches[0].pageX,
- e.startY = n.originalEvent.changedTouches[0].pageY,
- e.nowDeg = t._Rouslette.getRotate("hymenu_industry"),
- e.transition = t("#hymenu_industry").css("transition"),
- e.direction = ""
- },
- touchmove: function (a) {
- e.ismove = 1,
- e.endX = a.originalEvent.changedTouches[0].pageX,
- e.endY = a.originalEvent.changedTouches[0].pageY;
- var r = e.endX - e.startX
- , o = e.endY - e.startY;
- if (1 == n)
- var s = r / 5;
- else
- s = -o / 5;
- t(".hymenu_industry").css({
- "-webkit-transform": "rotate(" + (e.nowDeg + s) + "deg)",
- transition: "none"
- })
- },
- touchend: function () {
- if (0 == e.ismove)
- return;
- e.ismove = 0,
- t("#hymenu_industry").css("transition", e.transition),
- e.nowDeg = t._Rouslette.getRotate("hymenu_industry");
- let n = t(".hymenu_industry>span:last a").attr("datarotate");
- n < t._Rouslette.hymenuObj.twoQ_ratote_max && t._Rouslette.rotateReset("hymenu_industry", 0 - t._Rouslette.hymenuObj.hymenu_industry_rotate_center)
- }
- }),
- t(".hymenu_sub").on({
- touchstart: function (n) {
- e.startX = n.originalEvent.changedTouches[0].pageX,
- e.startY = n.originalEvent.changedTouches[0].pageY,
- e.nowDeg = t._Rouslette.getRotate("hymenu_sub"),
- e.transition = t("#hymenu_sub").css("transition"),
- e.direction = ""
- },
- touchmove: function (a) {
- e.ismove = 1,
- e.endX = a.originalEvent.changedTouches[0].pageX,
- e.endY = a.originalEvent.changedTouches[0].pageY;
- var r = e.endX - e.startX
- , o = e.endY - e.startY;
- if (1 == n)
- var s = r / 5;
- else
- s = -o / 5;
- t(".hymenu_sub").css({
- "-webkit-transform": "rotate(" + (e.nowDeg + s) + "deg)",
- transition: "none"
- })
- },
- touchend: function () {
- if (0 == e.ismove)
- return;
- e.ismove = 0,
- t("#hymenu_sub").css("transition", e.transition),
- e.nowDeg = t._Rouslette.getRotate("hymenu_sub");
- let n = t(".hymenu_sub>span:last a").attr("datarotate");
- n < t._Rouslette.hymenuObj.threeQ_ratote_max && t._Rouslette.rotateReset("hymenu_sub", 0 - t._Rouslette.hymenuObj.hymenu_sub_rotate_center)
- }
- });
- }
- }
- })
- var n = 1
- }
- )(jQuery);
|