userscripts/DnDBeyond Full Game Log.user.js

35 lines
1.4 KiB
JavaScript

// ==UserScript==
// @name D&D Beyond Full Screen Roll Log
// @namespace https://bullercodeworks.com
// @version 0.1
// @description Make the Game Log in DnDBeyond Full Screen
// @author Brian Buller
// @match https://www.dndbeyond.com/campaigns/*
// @icon https://www.google.com/s2/favicons?domain=dndbeyond.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
function fullScreenLog() {
var sidebar = document.querySelector('.sidebar__pane-content');
document.body.prepend(sidebar);
}
function addFullScreenButton() {
var newButtonSpan = document.createElement('span');
newButtonSpan.classList.add('sidebar__control-group', 'sidebar__control-group--fullscreen');
var newButton = document.createElement('button');
newButton.id = 'fullscreen';
newButton.classList.add('sidebar__control');
newButton.innerHTML = '<svg class="" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="3 5 16 16" width="24px" fill="#999999"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg>';
newButtonSpan.appendChild(newButton);
document.querySelector('div.sidebar__controls').appendChild(newButtonSpan);
newButton.onclick = fullScreenLog;
}
document.querySelector('.sidebar__control-group--visibility').onclick = addFullScreenButton;
})();