Greasy Fork is available in English.
在阴阳师藏宝阁页面左侧自动显示鉴宝屋结果页
当前为
// ==UserScript==
// @name 阴阳师鉴宝屋油猴脚本
// @namespace https://github.com/JellyL/jbwGreasyfork
// @icon https://yys.jellyl.com/img/wu.8dccb370.svg
// @version 1.0
// @description 在阴阳师藏宝阁页面左侧自动显示鉴宝屋结果页
// @author Jelly L
// @match https://yys.cbg.163.com/*
// @grant window.onurlchange
// @grant GM_addStyle
// @run-at document-end
// ==/UserScript==
//全局藏宝阁宽度变量,如果你想藏宝阁宽度更窄,只需要更改以下变量值即可
//maxWidth取值范围为0~750,越小界面宽度越小
//zoomSize取值范围为0~1,越小界面整体缩放越小
var maxWidth = 450;
var zoomSize = 1;
//变小藏宝阁最大宽度
var cssCompile = `
body{max-width: ${maxWidth}px;}
.page-app{zoom:${zoomSize};}
.site-navbar-fixed{max-width: ${maxWidth}px;}
.site-footbar{max-width: ${maxWidth}px;}
.page-prod-role-list .role-list-tabs{max-width: ${maxWidth}px;}
.page-role-detail .preview{max-width: ${maxWidth}px;}
.c-popup{max-width: ${maxWidth}px;}
.page-tabs .tabs{max-width: 500px;}
.page-search .search-header{max-width: ${maxWidth}px;}
.c-popup-open{max-width: ${maxWidth}px;}
.index-popup-ad{max-width: ${maxWidth}px;}
`
GM_addStyle(cssCompile)
//初始化变量
var pageHeight = window.innerHeight
var pageWidth = (window.innerWidth - maxWidth - 30) / 2
var pagePath = location.pathname
//初始化iframe
var pageFrame = document.createElement('iframe')
pageFrame.src = 'https://yys.jellyl.com' + pagePath
pageFrame.frameBorder = 0
pageFrame.width = pageWidth + 'px'
pageFrame.height = pageHeight + 'px'
//初始化div容器
var containerDiv = document.createElement('div')
containerDiv.setAttribute('style', 'position:fixed;top:0%;left:0%;')
//载入iframe
document.body.appendChild(containerDiv)
containerDiv.appendChild(pageFrame)
//更换页面时同步更新
var initial = function () {
'use strict'
var pageFrameNew = document.createElement('iframe')
var pagePathNew = location.pathname
pageFrameNew.src = 'https://yys.jellyl.com' + pagePathNew
pageFrameNew.frameBorder = 0
pageFrameNew.width = pageWidth + 'px'
pageFrameNew.height = pageHeight + 'px'
var theFrame = document.getElementsByTagName('iframe')
containerDiv.replaceChild(pageFrameNew, theFrame[0])
}
//根据浏览器大小变化响应
var iframeObj = containerDiv.childNodes
window.onresize = function () {
iframeObj[0].setAttribute("style",`width:${(window.innerWidth - maxWidth - 30) / 2}px;height:${window.innerHeight}px`);
}
//油猴单页应用onurlchange检测
if (window.onurlchange === null) {
window.addEventListener('urlchange', (info) => initial())
}