// ==UserScript== // @name 联合阅读辅助插件 // @namespace http://xrzww.com/ // @version 1.3 // @license Anti 996 License // @description 优化联合阅读一些程序方面体验 // @author qidian55 // @match http*://*.xrzww.com/* // @grant GM_notification // @require https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js // @downloadURL https://update.greasyfork.icu/scripts/403902/%E8%81%94%E5%90%88%E9%98%85%E8%AF%BB%E8%BE%85%E5%8A%A9%E6%8F%92%E4%BB%B6.user.js // @updateURL https://update.greasyfork.icu/scripts/403902/%E8%81%94%E5%90%88%E9%98%85%E8%AF%BB%E8%BE%85%E5%8A%A9%E6%8F%92%E4%BB%B6.meta.js // ==/UserScript== (function() { //添加签到功能 var right = $('#app .nan_page .main .right')[0]; if (right === undefined) return; var signin_button = $(` 签到▶ `)[0]; right.appendChild(signin_button); var signin = function() { $.ajax({ url: "https://pre-api.xrzww.com/api/userSignIn", headers: { "Authorization": "Bearer " + localStorage['token'] }, success: function(result) { GM_notification('签到成功!\n+' + result.data.gold2 + '书币\n本周连续签到' + result.data.week_sign_count + '天\n累计连续签到' + result.data.sign_con + '天', '联合阅读辅助插件', 'https://oss.xrzww.com/mini/mine_qian.png'); $(signin_button).find('uni-text').children('span').html('已签'); $(signin_button).children('uni-view')[0].style.cursor = ''; $(signin_button).find('.btn')[0].onclick = undefined; } }); } $.ajax({ url: "https://pre-api.xrzww.com/api/getUserInfo", headers: { "Authorization": "Bearer " + localStorage['token'] }, success: function(result) { if (result.data.signstatus) $(signin_button).find('uni-text').children('span').html('已签'); else { $(signin_button).children('uni-view')[0].style.cursor = 'pointer'; $(signin_button).find('.btn')[0].onclick = signin; } } }); })(); (function() { //添加朗读功能 var novel_left = $('.novel_left')[0]; if (novel_left === undefined) return; var speak_service = $(`
朗读
`)[0]; novel_left.appendChild(speak_service); var utterThis = new SpeechSynthesisUtterance(); speak_service.utterThis = utterThis; var read_next_paragraph = function(e) { speak_service.current_paragraph[0].style.background = ''; speak_service.current_paragraph = speak_service.current_paragraph.next(); if (speak_service.current_paragraph.attr('class') === 'others') return; speak_service.utterThis.text = speak_service.current_paragraph.text().trim(); window.speechSynthesis.speak(speak_service.utterThis); } var start_speak_service = function() { if (!$('.novel_dl').length) return; speak_service.current_paragraph = $($('.novel_dl')[0]); speak_service.utterThis.text = speak_service.current_paragraph.text().trim() speak_service.utterThis.onstart = function(e) { speak_service.current_paragraph[0].style.background = 'rgba(102,204,255,0.3)'; speak_service.current_paragraph[0].scrollIntoView({ behavior: 'smooth' }); }; speak_service.utterThis.onend = read_next_paragraph; window.speechSynthesis.speak(utterThis); $(this).find('i').attr('class', 'el-icon-loading'); $(this).find('span').text('朗读中'); this.onclick = stop_speak_service; speak_service.onmouseenter = function() { speak_service.firstElementChild.style.visibility = ''; } speak_service.firstElementChild.style.visibility = ''; } var stop_speak_service = function() { speak_service.current_paragraph[0].style.background = ''; speak_service.utterThis.onend = undefined; window.speechSynthesis.cancel(); $(this).find('i').attr('class', 'el-icon-service'); $(this).find('span').text('朗读'); this.onclick = start_speak_service; speak_service.onmouseenter = undefined; speak_service.firstElementChild.style.visibility = 'hidden'; } speak_service.lastElementChild.onclick = start_speak_service; speak_service.onmouseleave = function() { speak_service.firstElementChild.style.visibility = 'hidden'; } var pause_speak_service = function() { window.speechSynthesis.pause(); $(speak_service.lastElementChild).find('i')[0].style.animationPlayState = 'paused'; $(speak_service.lastElementChild).find('i')[0].style.WebkitAnimationPlayState = 'paused'; $(this).find('i').attr('class', 'el-icon-video-play'); $(this).find('span').text('继续'); this.onclick = resume_speak_service; } var resume_speak_service = function() { window.speechSynthesis.resume(); $(speak_service.lastElementChild).find('i')[0].style.animationPlayState = 'running'; $(speak_service.lastElementChild).find('i')[0].style.WebkitAnimationPlayState = 'running'; $(this).find('i').attr('class', 'el-icon-video-pause'); $(this).find('span').text('暂停'); this.onclick = pause_speak_service; } speak_service.firstElementChild.children[0].onclick = pause_speak_service; $(speak_service).find('.el-icon-caret-left').parent()[0].onclick = function() { speak_service.utterThis.rate -= 0.3; $(speak_service).find('span')[1].textContent = '语速:' + speak_service.utterThis.rate.toFixed(1); }; $(speak_service).find('.el-icon-caret-right').parent()[0].onclick = function() { speak_service.utterThis.rate += 0.3; $(speak_service).find('span')[1].textContent = '语速:' + speak_service.utterThis.rate.toFixed(1); }; $(speak_service).find('.el-icon-caret-bottom').parent()[0].onclick = function() { speak_service.utterThis.volume -= 0.1; $(speak_service).find('span')[2].textContent = '音量:' + speak_service.utterThis.volume.toFixed(1); }; $(speak_service).find('.el-icon-caret-top').parent()[0].onclick = function() { speak_service.utterThis.volume += 0.1; $(speak_service).find('span')[2].textContent = '音量:' + speak_service.utterThis.volume.toFixed(1); }; })(); (function() { //个人主页添加浏览记录 if (!$('.left_view').length) return; var footpoint_svg = $(` `); var record_button = $(`
浏览记录
`); $($('.left_view')[0]).after(record_button); record_button[0].onclick = function() { location.href = 'https://h5.xrzww.com/#/pages/mine/record'; } })();