diff --git a/application/app.js b/application/app.js index 7601c1d..541bca7 100644 --- a/application/app.js +++ b/application/app.js @@ -221,8 +221,10 @@ $.extend({ getQueryVar: function (variable) { var query = window.location.search.substring(1); var vars = query.split("&"); + console.log(vars) for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); + console.log(pair) if (pair[0] == variable) { return pair[1]; } } return (false); diff --git a/application/dydetail/index.js b/application/dydetail/index.js index 93c9f89..5084708 100644 --- a/application/dydetail/index.js +++ b/application/dydetail/index.js @@ -1,3 +1,15 @@ $(function(){ + document.activeElement.addEventListener('keydown', handleKeydown); +}); -}); \ No newline at end of file +function handleKeydown(e) { + $.clearEvent(e); + switch (e.key) { + case 'E': + case 'Backspace': + case 'SoftRight': + //window.location.href = '../dynamic/index.html'; + window.history.back(); + break; + } +} diff --git a/application/live/index.js b/application/live/index.js index 7d36029..d627998 100644 --- a/application/live/index.js +++ b/application/live/index.js @@ -200,12 +200,12 @@ function nav(move) { } function getLiveRoomNumer(uid) { - var id, link = 'https://api.bilibili.com/x/space/acc/info?mid=' + uid; + var id, link ='https://api.live.bilibili.com/xlive/web-room/v1/index/getRoomBaseInfo?uids='+uid+'&req_biz=video';//'https://api.bilibili.com/x/space/acc/info?mid=' + uid; $.ajax({ url: link, async: false, success: function (result) { - id = result.data.live_room.roomid.toString(); + id = result.data.by_uids[uid].room_id.toString(); var name = result.data.name; var sign = result.data.sign; var title = result.data.live_room.title; diff --git a/application/manifest.webapp b/application/manifest.webapp index 25b8497..ecfec6a 100644 --- a/application/manifest.webapp +++ b/application/manifest.webapp @@ -1,7 +1,7 @@ { "name": "哔哩哔哩", "description": "哔哩哔哩KaiOS版", - "version": "1.8.7", + "version": "1.8.8", "launch_path": "/index.html", "type": "privileged", "origin": "app://kai.baiyang.bilibili", diff --git a/application/user/index.html b/application/user/index.html index d503bc4..81ec9be 100644 --- a/application/user/index.html +++ b/application/user/index.html @@ -44,6 +44,7 @@ + diff --git a/application/user/index.js b/application/user/index.js index 652908e..db1dd0e 100644 --- a/application/user/index.js +++ b/application/user/index.js @@ -1,5 +1,5 @@ let userId = 0; -let isOpen = false, self = false; +let isOpen = false, selfvalue = false; let urlQrCode = "https://passport.bilibili.com/x/passport-login/web/qrcode/generate?source=main-fe-header" //urlQrCode = "http://passport.bilibili.com/qrcode/getLoginUrl" @@ -39,7 +39,7 @@ function loadLoginQrCode() var dataPoll = $.postApi(urlPoll,'local_id=0&auth_code='+qrcode_key,tv); //var dataPoll = $.postApi(urlPoll,"oauthKey="+qrcode_key); - console.log(dataPoll) + //console.log(dataPoll) var code = dataPoll.code if (code == 0) { clearInterval(intervalCheck) @@ -73,14 +73,14 @@ function loadLoginQrCode() } },1000) } - -$(function () { +function refresh_self() { var mid = $.getQueryVar('mid'); - if (mid === false) { - self = true; + if (!mid) { + selfvalue = true; var id = $.getData('mid'); if (typeof id != 'undefined' && id != null && id != '') { userId = parseInt(id); + $('#softkey-left').text('刷新'); setUserInfo(); } else { @@ -91,16 +91,19 @@ $(function () { } } else { + $('#softkey-left').text('刷新'); var id = $.getData('mid'); if (id == mid) { - self = true; - softkey("", "", "选项"); + selfvalue = true; + softkey("刷新", "", "选项"); } userId = mid; setUserInfo(); } document.activeElement.addEventListener('keydown', handleKeydown); -}); +} + +$(refresh_self); function handleKeydown(e) { $.clearEvent(e); @@ -115,10 +118,16 @@ function handleKeydown(e) { case 'SoftLeft': if (!isOpen) { if (userId == 0) + { loadLoginQrCode(); //login(); - else - logout(); + } + else{ + //logout(); + selfvalue=false; + setUserInfo(); + refresh_self(); + } } else { navigate(); @@ -152,6 +161,11 @@ function navigate() { case 'at': window.location.href = '../attention/index.html'; break; + case 'logout': + logout(); + showhideMenu(); + break; + } } @@ -162,14 +176,20 @@ function showhideMenu() { isOpen = false; } else { - if (!self) { + if (!selfvalue) { $('*[data-tag="at"]').hide(); $('*[data-tag="ct"]').hide(); } + menuIndex=0; $("#menu").show(); var items = document.querySelectorAll('.menuitem'); + items.forEach(function (item, index) { + $(item).removeClass('select'); + }); + var items = document.querySelectorAll('.menuitem:not([style*="display:none"]):not([style*="display: none"]'); items[0].focus(); - softkey("选择", "", "返回"); + $(items[0]).addClass('select'); + softkey("选择", "主页", "返回"); isOpen = true; } } @@ -213,7 +233,8 @@ function nav(move) { } else { var next = menuIndex + move; - var items = document.querySelectorAll('.menuitem'); + var items = document.querySelectorAll('.menuitem:not([style*="display:none"]):not([style*="display: none"]'); + //console.log(items) if (next >= items.length) { next = items.length - 1; } @@ -260,7 +281,7 @@ function login() { function setUserInfo() { var userInfo = null; - if (self) + if (selfvalue) userInfo = $.getData('userInfo'); if (typeof userInfo == 'undefined' || userInfo == null || userInfo == '') { var url = 'https://app.bilibili.com/x/v2/space?ps=10&vmid=' + userId; @@ -278,9 +299,9 @@ function setUserInfo() { $('#fans').text(' 粉丝 ' + info.data.card.fans); $('#sign').text(info.data.card.sign); } - if (self) { + if (selfvalue) { localStorage.setItem('userInfo', userInfo); - $('#softkey-left').text('注销'); + //$('#softkey-left').text('注销'); } $(".login").hide(); $(".info").show();