Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

libai / fsActive

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Switch branch/tag
  • fsActive
  • ftIcon
  • liveData2
  • lib
  • default.js
Find file
BlameHistoryPermalink
  • libai's avatar
    ft活动上线 · 7639cfa4
    libai committed 8 months ago
    7639cfa4
default.js 5.76 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
/**
 * Created by webshow on 2019/11/22.
 */
var bbb = location.href;
if (bbb.indexOf("https://fsactive.fusi.club/") > -1) {
    $ip = "https://webserver.yabolive.net";
    $url= 'https://fsactive.fusi.club/'
    _url3 = 'https://webserver.yabolive.net';
}
else{
    $ip = 'http://ceshi.yabolive.tv/web';
    $url='http://testfsactive.fusi.club/'
    _url3 = 'http://ceshi.yabolive.tv';
}
var bbb = location.href;
var data = url_get_params(bbb)
sessionStorage.token = data.token; //t
sessionStorage.uid = data.uid; //u
sessionStorage.version = data.appversion;
sessionStorage.pkg=data.pkg;
sessionStorage.lang=data.lang;
sessionStorage.roomId = data.roomid;
sessionStorage.cid='web_gw'
sessionStorage.os='WEB'
if(sessionStorage.roomId=='undefined'&&data.roomId!=undefined)sessionStorage.roomId=data.roomId;

sessionStorage.jump=data.jump
sessionStorage.isShowHalf=data.isShowHalf
function url_get_params(url_path) {
    var url = url_path;
    var theRequest = new Object();
    if (url.indexOf("?") != -1) {
        var str = url.substr(url.indexOf("?") + 1);
        strs = str.split("&");
        for (var i = 0; i < strs.length; i++) {
            theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
        }
    }
    return theRequest;
}
if (bbb.indexOf("http://localhost:63342") > -1) {
    sessionStorage.uid = 23871190;
    sessionStorage.token = 'debug'
    sessionStorage.roomId=23864554
}
if (bbb.indexOf("file:///") > -1) {
    sessionStorage.lang=1
    sessionStorage.uid =  210102;
    sessionStorage.token = 'debug'
    sessionStorage.roomId=210102;
    sessionStorage.version=8890
    sessionStorage.cid='web'
    sessionStorage.pkg='h5'
    sessionStorage.os='h5'
}
//ajax设置默认参数
$.ajaxSetup({
    global: false,
    type: 'get',
    data: {
        uid: sessionStorage.uid,
        token: sessionStorage.token,
        roomId:sessionStorage.roomId,
        cid:sessionStorage.cid,
        lang:sessionStorage.lang,
        pkg:sessionStorage.pkg,
        version:sessionStorage.version,
        os:sessionStorage.os
    },
    dataType: "JSON"
})
//点击刷新
$(".ref").on("click", function () {
    window.location.reload()
})
//与客户端交互
function appCollaboration(msg) {
    var ua = window.navigator.userAgent.toLowerCase();
    try {
        if (/iphone|ipad|ipod/.test(ua)) {
            window.webkit.messageHandlers.appCollaboration.postMessage(msg);
        } else if (/android/.test(ua)) {
            window.yazhai.appCollaboration(msg);
        }
    } catch (e) {
    }
}
//处理时间倒计时的函数
function timeDeal(e){
    var endTime=e;
    var newTime=new Date().getTime();
    var Remain=Math.floor((endTime-newTime)/1000);
    if(Remain<=0)window.location.reload();
    var day=Math.floor(Remain/86400);
    var hour=add0(Math.floor(Remain%86400/3600));
    if(hour>99)hour=99;
    var min=add0(Math.floor(Remain%3600/60));
    var sceond=add0(Math.floor(Remain%60));
    var timeArr=[day,hour,min,sceond];
    return timeArr;
}
//时间戳转具体 年月日时分秒
function timeGet(e){
    var time = new Date(Number(e));
    var y = time.getFullYear();
    var m = time.getMonth()+1;
    var d = time.getDate();
    var h = time.getHours();
    var mm = time.getMinutes();
    var s = time.getSeconds();
    var timeArr=[y,m,d,add0(h),add0(mm),s]
    return timeArr
}

//一位数前面加0
function add0(m) {
    return m < 10 ? '0' + m : m
}
function add00(m){
    if(m<10){
        return '00'+m
    }else if(m>10&&m<100){
        return '0'+m
    }else{
        return m
    }
}
function imgAdd(m){
    if(String(m).length > 5) return m;
    return (Array(5).join(0) + m).slice(-5);
}
//一万以上省略
function addw(e){
    if(e>=100000000){
        return Math.floor((e/100000000).toFixed(2)*10)/10+'亿';
    }
    else if(e>=10000){
        return Math.floor((e/10000).toFixed(2)*10)/10+'万';
    }else{
        return Math.ceil(e);
    }
}
function addDoc(e){
    if(e%1==0){
        return e+'.0';
    }else return e
}
function loadImageGo(name,sNum,eNum,num) {
    var imgList = [];
    var num = sNum;
    loadImage()
    function loadImage() {
        var img = new Image();
        img.addEventListener("load", loadHandler);
        img.src = "images/" + name + "/"+num+"_" + imgAdd(num) + ".png";
    }
    function loadHandler() {
        imgList.push(this.cloneNode());
        num++;
        if (num > eNum) { return; }
        this.src = "images/" + name + "/"+num+"_" + imgAdd(num)  + ".png";
    }
}  
//跳转充值页面
function goReg(){
    if(sessionStorage.pkg=='qingliang'){
        var ua = window.navigator.userAgent.toLowerCase();
        if (/iphone|ipad|ipod/.test(ua)) {
            window.location.href='yazhai://_recharge';
        }else{
            window.location.href='http://web.yazhai.co/milkRecharge/index.html?uid='+sessionStorage.uid+'&token='+sessionStorage.token+'&pkg=qingliang';
        }
    } else if(sessionStorage.pkg=='qiezi'){
		var ua = window.navigator.userAgent.toLowerCase();
        if (/iphone|ipad|ipod/.test(ua)) {
            window.location.href='yazhai://_recharge';
        }else{
            window.location.href='http://web.yazhai.co/guodongRecharge/index.html?uid='+sessionStorage.uid+'&token='+sessionStorage.token+'&pkg=qingliang';
        }
    }
    else{
        window.location.href='http://web.yazhai.co/recharge/index.html?uid='+sessionStorage.uid+'&token='+sessionStorage.token+'&pkg=yabo';
    }
}
function scrollTo(element,speed) {
    if(!speed){
        speed = 300;
    }
    if(!element){
        $("html,body").animate({scrollTop:0},speed);
    }else{
        if(element.length>0){
            $("html,body").animate({scrollTop:$(element).offset().top-200},speed);
        }
    }
}

//var betEnd = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate(), new Date().getHours(), 59, 59).getTime();