Adds a button to the top bar to move the chat position. Click to rotate through the four corners and full screen.
当前为
// ==UserScript==
// @name MoveChat · Bonk.io
// @namespace https://greasyfork.org/en/users/962705
// @version 1.1.0
// @license GPL-3.0
// @description Adds a button to the top bar to move the chat position. Click to rotate through the four corners and full screen.
// @author rrreddd
// @match https://bonk.io/*
// @run-at document-start
// @grant GM_addStyle
// ==/UserScript==
GM_addStyle (`
#ingamechatbox {
position: absolute !important;
bottom: 10px !important;
top: unset !important;
left: 10px !important;
right: unset !important;
margin: 0px !important;
width: 422px !important;
height: 250px !important;
}
#ingamechatcontent {
bottom: 27px !important;
top: unset !important;
left: 5px !important;
right: unset !important;
margin: 0px !important;
max-height: 250px !important;
height: auto !important;
width: auto !important;
}
`);
var chatBtn = document.createElement ('div');
var topBar = document.getElementById ('pretty_top_bar');
var chatBox = document.getElementById ('ingamechatbox');
var chatCont = document.getElementById ('ingamechatcontent');
var chatPos = 'TL';
chatBtn.setAttribute ('id', 'pretty_top_movechat');
chatBtn.setAttribute ('class', 'pretty_top_button niceborderleft');
topBar.appendChild (chatBtn);
chatBtn.style.cssText = (`
position: absolute;
top: 0;
right: 290px;
height: 34px;
width: 58px;
background-image: url(https://i.imgur.com/gXPdjBE.png);
background-repeat: no-repeat;
background-position: center;
`);
document.getElementById ("pretty_top_movechat").addEventListener ("click", chatBtnClick, false);
document.getElementById ("pretty_top_movechat").addEventListener ("mouseenter", (`
function () {
J4z.M7Z();
var d1o = [arguments];
d1o[4] = L$Fvm;
if (!V5F[25][d1o[4][400]]) {
if (V5F[25][d1o[4][1077]]) {
V5F[39][d1o[4][1095]]();
V5F[39][d1o[4][406]]();
} else {
;
}
}
};
`), false);
function chatBtnClick () {
switch (chatPos) {
case 'BL':
GM_addStyle (`
#ingamechatbox {
bottom: 10px !important;
top: unset !important;
left: 10px !important;
right: unset !important;
width: 422px !important;
height: 250px !important;
}
#ingamechatcontent {
top: unset !important;
max-height: 250px;
}
`);
chatPos = 'TL';
break;
case 'TL':
GM_addStyle (`
#ingamechatbox {
bottom: unset !important;
top: 10px !important;
left: 10px !important;
right: unset !important;
width: 422px !important;
height: 250px !important;
}
#ingamechatcontent {
top: 0px !important;
}
`);
chatPos = 'TR';
break;
case 'TR':
GM_addStyle (`
#ingamechatbox {
bottom: unset !important;
top: 10px !important;
left: unset !important;
right: 10px !important;
width: 422px !important;
height: 250px !important;
}
#ingamechatcontent {
top: 0px !important;
}
`);
chatPos = 'BR';
break;
case 'BR':
GM_addStyle (`
#ingamechatbox {
bottom: 10px !important;
top: unset !important;
left: unset !important;
right: 10px !important;
width: 422px !important;
height: 128px !important;
}
#ingamechatcontent {
top: unset !important;
}
`);
chatPos = 'FS';
break;
case 'FS':
GM_addStyle (`
#ingamechatbox {
bottom: unset !important;
top: 0px !important;
left: 0px !important;
right: unset !important;
width: 100% !important;
height: 100% !important;
}
#ingamechatcontent {
top: 0px !important;
max-height: 100% !important;
margin: 5px !important;
}
`);
chatPos = 'BL';
break;
};
};