Skip to content

Instantly share code, notes, and snippets.

@whiteball
Last active August 28, 2023 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whiteball/45315af64ccc21ea0bbf83a9d38b6062 to your computer and use it in GitHub Desktop.
Save whiteball/45315af64ccc21ea0bbf83a9d38b6062 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name AIのべりすと 編集ページ下のメニューを強制サイドメニュー化
// @namespace https://ai-novelist-share.geo.jp/
// @version 0.4.2
// @description 編集ページの下にあるオプションメニューを、サイドメニューに押し込めます。ページ右上に追加した「≪」ボタンをクリックすることで、サイドメニューを開閉します。無理矢理押し込めているだけなので、ボタンや入力欄の位置がずれる可能性があります。
// @author しらたま
// @match https://ai-novel.com/novel.php
// @icon https://www.google.com/s2/favicons?sz=64&domain=ai-novel.com
// @updateURL https://gist.github.com/whiteball/45315af64ccc21ea0bbf83a9d38b6062/raw/ai_novelist_force_side_menu.user.js
// @downloadURL https://gist.github.com/whiteball/45315af64ccc21ea0bbf83a9d38b6062/raw/ai_novelist_force_side_menu.user.js
// @supportURL https://gist.github.com/whiteball/45315af64ccc21ea0bbf83a9d38b6062
// @grant none
// ==/UserScript==
/*
更新履歴
*2023/08/28
チャットモードの入力欄が、「メニュー展開時に本文欄に被らないようにする」をチェックしていてもメニューの下に入ってしまうのを修正。
*2023/06/26
ページを表示した直後のAI/言語モデルのプルダウンメニューで、現在利用しているモデルが選択されていなかったのを修正。
*2023/06/10
ハイパーロングタームメモリが有効にならない不具合を修正。
メニューが左にあるとき、メニュー開閉ボタンの印の向きを逆向きになるようにした。
*2023/04/30
iアイコンにポインタを当てたときに出るヒントの横幅を、メニューの幅に合わせて変動するようにした。
ヒントをアイコンの上に出すと見切れるので、下側に出すようにした。
ついでにヒントの枠がグレーで描画されるようにした。
条件によっては、テキスト入力欄の幅が狭く表示されるようにした。
スクリプトのIN/OUTはメニュー幅いっぱいに表示されるようにした。
本文欄がメニューの下に入らない設定にしたとき、拙作のAIのべりすとユーティリティを使用して*いない*場合に表示が崩れる不具合を修正。
本文欄がメニューの下に入らない設定にしたとき、タイトルも隠れないようにした。
*2023/04/16
メニューの位置を調整できるようにした。
・開閉ボタンの表示位置を上下左右から選択できるようにした。メニュー自体もその位置を基準に表示する。
・メニューの幅を設定できるようにした。
・開閉ボタンの上または下からの高さを設定できるようにした。
・メニューを開いたときに、本文欄がメニューの下に入り込まないようにした。
メニューの幅に収まっていなかった要素の横幅を制限するようにした。
面積の節約のため、プリセット選択をプルダウンで表示するようにした。
*/
(function() {
'use strict';
let pref = JSON.parse(localStorage.mod_side_menu ? localStorage.mod_side_menu : '{}')
if ( ! pref.hasOwnProperty('enabled')) {
pref.enabled = true
}
if ( ! pref.hasOwnProperty('button_position')) {
pref.button_position = 1
}
if ( ! pref.hasOwnProperty('side_menu_width')) {
pref.side_menu_width = 650
}
if ( ! pref.hasOwnProperty('side_menu_width_max')) {
pref.side_menu_width_max = 50
}
if ( ! pref.hasOwnProperty('side_menu_offset_height')) {
pref.side_menu_offset_height = 5
}
if ( ! pref.hasOwnProperty('offset')) {
pref.offset = false
}
/*const loadPref = function () {
const pref_temp = JSON.parse(localStorage.mod_side_menu ? localStorage.mod_side_menu : '{}')
}*/
const savePref = function () {
if (pref) {
localStorage.mod_side_menu = JSON.stringify(pref)
}
}
document.head.insertAdjacentHTML('beforeend',`<style>
#mod-side-menu-toggle {
position: fixed;
height: 2rem;
width: 2rem;
border: #777777 3px solid;
background-color: #cd2b5a;
text-align: center;
color: white;
}
#mod-side-menu-toggle.top-left {
left: 0;
border-left-style: none;
border-top-right-radius: 0.5rem;
border-bottom-right-radius: 0.5rem;
}
#mod-side-menu-toggle.top-right {
right: 0;
border-right-style: none;
border-top-left-radius: 0.5rem;
border-bottom-left-radius: 0.5rem;
}
#mod-side-menu-toggle.bottom-left {
left: 0;
border-left-style: none;
border-top-right-radius: 0.5rem;
border-bottom-right-radius: 0.5rem;
}
#mod-side-menu-toggle.bottom-right {
right: 0;
border-right-style: none;
border-top-left-radius: 0.5rem;
border-bottom-left-radius: 0.5rem;
}
#mod-side-menu-toggle-button {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
border: none;
background-color: transparent;
}
#mod-side-menu {
position: fixed;
width: 650px;
max-width: 50%;
right: 0;
bottom: 2rem;
border: #777777 1px solid;
background-color: inherit;
}
#mod-side-menu.top-left {
left: 0;
bottom: 2rem;
border-left-style: none;
border-top-right-radius: 0.5rem;
border-bottom-right-radius: 0.5rem;
}
#mod-side-menu.top-right {
right: 0;
bottom: 2rem;
border-right-style: none;
border-top-left-radius: 0.5rem;
border-bottom-left-radius: 0.5rem;
}
#mod-side-menu.bottom-left {
top: 2rem;
left: 0;
border-left-style: none;
border-top-right-radius: 0.5rem;
border-bottom-right-radius: 0.5rem;
}
#mod-side-menu.bottom-right {
top: 2rem;
right: 0;
border-right-style: none;
border-top-left-radius: 0.5rem;
border-bottom-left-radius: 0.5rem;
}
#mod-side-menu-toggle-button {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
border: none;
background-color: transparent;
}
#mod-side-menu-inner {
margin: 0;
padding: 0 10px 0 5px;
overflow-y: scroll;
overscroll-behavior-y: contain;
height: calc(100% - 5px);
}
#mod-side-menu-inner textarea {
width: 100%
}
#mod-side-menu-inner input[type="text"] {
width: min(250px, 50%)
}
#mod-side-menu-inner input[type="text"].scripts {
width: 100%
}
#mod-side-menu-inner input[type="range"] {
width: 80%
}
#mod-side-menu-inner p.fontselector {
width: 40%;
}
#mod-side-menu-inner .dd-margin {
margin: 10px 0 0 10px;
}
#mod-side-menu-inner #genpreset {
display:none;
}
:root {
--side-menu-tooltips-width: 500px
}
#mod-side-menu-inner .tooltips_body {
width: var(--side-menu-tooltips-width, 500px);
bottom: initial;
border: #999999 1px solid;
}
#mod-side-menu-inner #send-ban-word-confirm,
#mod-side-menu-inner #send-bias-confirm {
width: 100%
}
#data_edit {
width: 95%;
}
#data_title {
width: 93%;
}
#mod_side_menu_genpreset {
display: none;
}
#mod-side-menu-inner #mod_side_menu_genpreset {
display: initial;
}
</style>`)
const mainbody = document.getElementById('mainbody')
if (mainbody) {
mainbody.insertAdjacentHTML('beforeend',`
<div id="mod-side-menu-toggle" class="top-right">
<button id="mod-side-menu-toggle-button" type="button">≪</button>
</div>
<div id="mod-side-menu" style="display: none;" class="top-right">
<div id="mod-side-menu-inner"></div>
</div>
`)
mainbody.style['background-color'] = 'inherit'
}
const menu = document.getElementById('mod-side-menu')
document.getElementById('mod-side-menu-toggle-button').addEventListener('click', function () {
if (menu.style.display === '') {
resetMenuOffset()
if (pref.button_position % 2 === 0) {
this.innerText = '≫'
} else {
this.innerText = '≪'
}
window.jQuery(menu).fadeOut(200)
//menu.style.display = 'none'
} else {
for (const dd of document.querySelectorAll('dd[class="dd-margin"]')) {
// console.log( dd.style['margin-left'] )
dd.style['margin-left'] = ''
}
setMenuOffset()
if (pref.button_position % 2 === 0) {
this.innerText = '≪'
} else {
this.innerText = '≫'
}
window.jQuery(menu).fadeIn(200)
//menu.style.display = ''
}
})
const menu_inner = document.getElementById('mod-side-menu-inner'),
postdata_form = document.getElementById('postdata'),
form = postdata_form ? postdata_form.cloneNode(false) : menu_inner
form.append(document.getElementById('balloon_options_option').parentElement)
for (const option of ['modelinfo','options_option', 'options_pin', 'options_wi']) {
const elem = document.getElementById(option)
if (elem) {
form.append(elem)
}
}
const hidden_div = document.createElement('div')
hidden_div.style.display = 'none'
form.append(hidden_div)
for (const option of ['aimodel','autosum', 'localsaveindex', 'data', 'writingMode_data', 'checkdigit', 'data_ltm']) {
const elem = document.getElementById(option)
if (elem) {
hidden_div.append(elem)
}
}
if (postdata_form) {
menu_inner.append(form)
}
for (const option of ['options_goodies', 'options_usermod_text', 'options_usermod_history', 'options_usermod_info']) {
const elem = document.getElementById(option)
if (elem) {
menu_inner.append(elem)
}
}
if (postdata_form) {
form.style['background-color'] = 'inherit'
form.setAttribute('onsubmit', 'return false')
//form.addEventListener('submit', function () { return false })
postdata_form.id = ''
}
// 幅の最低値が決められているところを削除する
const widthBackup = new Map()
const wiarea0 = document.getElementById('wiarea0')
if (wiarea0) {
widthBackup.set(wiarea0.id, wiarea0.parentElement.style.width)
wiarea0.parentElement.style.width = ''
}
for (const input of document.querySelectorAll('#mod-side-menu-inner textarea, #mod-side-menu-inner select, #mod-side-menu-inner input[type="text"], #modart_bg, #wi_find_text, #data_title')) {
if (! input.style.width) {
continue
}
if (! input.id) {
console.log(input)
}
widthBackup.set(input.id, input.style.width)
input.style.width = ''
}
const mod_voicevox_param_area_title = document.getElementById('mod_voicevox_param_area_title')
if (mod_voicevox_param_area_title) {
// width: 30vw
mod_voicevox_param_area_title.style.width = '100%'
// min-width: 20rem;
mod_voicevox_param_area_title.style['min-width'] = ''
}
for (const input of document.querySelectorAll('#file_save, #mod_copy_clipboard, #mod_copy_clipboard_paste')) {
// width: 50vw
input.style.width = '100%'
}
for (const input of document.querySelectorAll('#retry, #undo, #redo')) {
input.style.width = input.style.width.replace('vw', '%')
}
for (const input of document.getElementsByClassName('flex-chat_field')) {
// width: 85vw
input.style.width = '85%'
}
// プリセットをセレクトボックスに変更
document.getElementById('genpreset').insertAdjacentHTML('afterend', `<div><select id="mod_side_menu_genpreset" style="margin-left: 10px; font-size: 18px;"></select></div>`)
const buildPresetSelect = function () {
const mod_side_menu_genpreset = document.getElementById('mod_side_menu_genpreset')
if (mod_side_menu_genpreset) {
mod_side_menu_genpreset.innerHTML = '<option>--プリセット選択--</option>'
for (const preset of document.querySelectorAll('#genpreset label')) {
const text = preset.innerHTML.split('<br>')
const option = document.createElement('option')
option.innerText = text[0].trim() + ' (' + text[1].replace(/<[^>]+>/g, '') + ')'
option.value = preset.htmlFor
if (preset.style.display === 'none') {
option.disabled = 'disabled'
}
mod_side_menu_genpreset.append(option)
}
}
}
const originalDoneLoading = window.DoneLoading
window.DoneLoading = async function () {
await originalDoneLoading()
buildPresetSelect()
}
buildPresetSelect()
document.getElementById('mod_side_menu_genpreset').addEventListener('change', function () {
if (this.value) {
const target = document.getElementById(this.value)
if (target) {
target.dispatchEvent(new Event('click'))
}
}
})
const originalSavePreset = window.SavePreset
window.SavePreset = function (num) {
originalSavePreset(num)
buildPresetSelect()
}
const model_options = document.getElementById('model-options')
if (model_options) {
const clone = model_options.cloneNode(true)
clone.id = 'mod-side-menu-model-options'
clone.addEventListener('input', function () {
model_options.value = this.value
model_options.dispatchEvent(new Event('input'))
buildPresetSelect()
}, false)
model_options.style.display = 'none'
model_options.parentNode.append(clone)
clone.value = window.jQuery.cookie("current_model")
}
// オプションメニューの挿入位置を決める
let last_menu = document.getElementById('mod_voicevox_menu')
if (last_menu) {
last_menu = last_menu.parentElement
} else {
last_menu = document.querySelector('#options_goodies > .prefencesMenu')
}
if ( ! last_menu) {
return
}
// 外に出したコンテントフィルターをform内に戻す
const badfilter = document.getElementById('badfilter')
if (badfilter) {
const badfiler_hidden = badfilter.cloneNode()
badfiler_hidden.style.display = 'hidden'
badfiler_hidden.id = 'badfiler_hidden'
hidden_div.append(badfiler_hidden)
const originalCopyContent = window.CopyContent
window.CopyContent = function () {
originalCopyContent()
badfiler_hidden.checked = badfilter.checked
}
}
last_menu.insertAdjacentHTML('afterend', `
<dl>
<dt id="mod_side_menu_setting" style="cursor: pointer">
<div class="header3" style="padding:0px;">
<h3 style="padding-left:15px;" id="options_head">▼ メニュー表示設定(ユーザースクリプト)</h3>
</div>
</dt>
<dd class="dd-margin" style="margin: 0px 0px 0px 40px; display: none;">
<h3>メニュー表示設定
<span id="tooltips">
<span id="help_mod_side_menu_setting" data-text="サイドメニューを表示する際の設定です。位置やサイズを調整することができます。">
<img src="images/icon_popup.png" width="20" height="20" id="help_mod_side_menu_setting_icon" class="help_popup" style="margin-left: 10px; margin-top: -5px; vertical-align:middle;" aria-describedby="tooltip_mod_side_menu_setting" onclick="return false;"></span>
</span>
</h3>
<div style="margin-bottom: 1rem;line-height: 2rem;">
<!--<label><input type="checkbox" style="font-size: 18px; transform:scale(1.5);" id="mod_voicevox_hotkey" ` + (pref.enabled ? 'checked' : '') + `><span class="explanations"> サイドメニュー化する</span></label>-->
<h5 style="margin:10px 0 5px 0">サイドメニュー開閉ボタンの位置</h5>
<label><input type="radio" name="mod_side_menu_button_position" value="0" style="font-size: 18px; transform:scale(1.5);" ` + (pref.button_position === 0 ? 'checked' : '') + `><span class="explanations"> 左上</span></label>
<label><input type="radio" name="mod_side_menu_button_position" value="1" style="font-size: 18px; transform:scale(1.5);" ` + (pref.button_position === 1 ? 'checked' : '') + `><span class="explanations"> 右上</span></label><br>
<label><input type="radio" name="mod_side_menu_button_position" value="2" style="font-size: 18px; transform:scale(1.5);" ` + (pref.button_position === 2 ? 'checked' : '') + `><span class="explanations"> 左下</span></label>
<label><input type="radio" name="mod_side_menu_button_position" value="3" style="font-size: 18px; transform:scale(1.5);" ` + (pref.button_position === 3 ? 'checked' : '') + `><span class="explanations"> 右下</span></label><br>
<label style="margin: 5px 0">メニュー幅(px):<input type="number" style="font-size: 18px;width:4rem;" id="mod_side_menu_width" value="${pref.side_menu_width}" min="1" max="9999" placeholder="例:650"></label><br>
<label style="margin: 5px 0">メニュー幅の上限(画面幅に対する%):<input type="number" style="font-size: 18px;width:4rem;" id="mod_side_menu_width_max" value="${pref.side_menu_width_max}" min="1" max="100" placeholder="例:50"></label><br>
<label style="margin: 5px 0">開閉ボタンのオフセット(px):<input type="number" style="font-size: 18px;width:4rem;" id="mod_side_menu_offset_height" value="${pref.side_menu_offset_height}" min="1" max="999" placeholder="例:5"></label><br>
<label><input type="checkbox" style="font-size: 18px; transform:scale(1.5);" id="mod_side_menu_offset" ` + (pref.offset ? 'checked' : '') + `><span class="explanations"> メニュー展開時に本文欄に被らないようにする</span></label>
</div>
</dd>
</dl>
`)
// メニュー開閉
window.jQuery('#mod_side_menu_setting').on('click', function() {
window.jQuery(this).next().slideToggle('fast')
})
// ヘルプのポップアップ
window.jQuery("#help_mod_side_menu_setting").on({
'mouseenter': function () {
const $ = window.jQuery
var text = $(this).attr('data-text');
$(this).append('<div class="tooltips_body">' + text + '</div>');
},
'mouseleave': function () {
window.jQuery(this).find(".tooltips_body").remove();
}
})
const changePosition = function (position = undefined, offset = undefined) {
let index = Number(position), offset_px = Number(offset)
if (isNaN(index)) {
index = Number(pref.button_position)
if (isNaN(index)) {
index = 1
}
}
if (isNaN(offset_px)) {
offset_px = Number(pref.side_menu_offset_height)
if (isNaN(offset_px)) {
offset_px = 5
}
}
let class_name = 'top-right', offset_attr = 'top'
switch (index) {
case 0:
class_name = 'top-left'
offset_attr = 'top'
break
case 1:
class_name = 'top-right'
offset_attr = 'top'
break
case 2:
class_name = 'bottom-left'
offset_attr = 'bottom'
break
case 3:
class_name = 'bottom-right'
offset_attr = 'bottom'
break
default:
class_name = 'top-right'
offset_attr = 'top'
index = 1
break
}
menu.classList.value = class_name
menu.style.top = ''
menu.style.bottom = ''
menu.style[offset_attr] = `calc(${offset_px + 6}px + 2rem)`
const menu_toggle = document.getElementById('mod-side-menu-toggle')
menu_toggle.classList.value = class_name
menu_toggle.style.top = ''
menu_toggle.style.bottom = ''
menu_toggle.style[offset_attr] = `${offset_px}px`
pref.button_position = index
pref.side_menu_offset_height = offset_px
const button = document.getElementById('mod-side-menu-toggle-button')
if ((pref.button_position % 2 === 0 && menu.style.display !== '') || (pref.button_position % 2 !== 0 && menu.style.display === '')) {
button.innerText = '≫'
} else {
button.innerText = '≪'
}
savePref()
}
for (const mod_side_menu_button_position of document.getElementsByName('mod_side_menu_button_position')) {
mod_side_menu_button_position.addEventListener('change', function () {
changePosition(this.value)
setMenuOffset()
})
}
const mod_side_menu_offset_height = document.getElementById('mod_side_menu_offset_height')
if (mod_side_menu_offset_height) {
mod_side_menu_offset_height.addEventListener('change', function () {
changePosition(undefined, this.value)
})
}
changePosition()
const mod_side_menu_width = document.getElementById('mod_side_menu_width'),
mod_side_menu_width_max = document.getElementById('mod_side_menu_width_max'),
changeWidth = function () {
let width = Number(mod_side_menu_width.value),
max = Number(mod_side_menu_width_max.value)
if (! width) {
width = 650
}
if (! max) {
max = 50
}
menu.style.width = `${width}px`
menu.style['max-width'] = `${max}%`
const tooltip_width = Math.trunc(window.jQuery(menu).width() * 0.85)
const root = document.querySelector(':root');
root.style.setProperty("--side-menu-tooltips-width", '' + tooltip_width + 'px');
pref.side_menu_width = width
pref.side_menu_width_max = max
savePref()
}
if (mod_side_menu_width && mod_side_menu_width_max) {
mod_side_menu_width.addEventListener('change', function () {
changeWidth()
setMenuOffset()
})
changeWidth()
}
const mod_side_menu_offset = document.getElementById('mod_side_menu_offset')
if (mod_side_menu_offset) {
const getcontinuation = document.getElementById('getcontinuation')
if (getcontinuation) {
getcontinuation.setAttribute('data-width', getcontinuation.style.width)
}
const operation_btn_container = document.getElementById('operation_btn_container')
if (operation_btn_container) {
operation_btn_container.setAttribute('data-width', operation_btn_container.style.width)
operation_btn_container.setAttribute('data-margin-left', operation_btn_container.style['margin-left'])
}
const data_container_title = document.getElementById('data_container_title')
if (data_container_title) {
data_container_title.setAttribute('data-width', data_container_title.style.width)
data_container_title.setAttribute('data-margin-left', data_container_title.style['margin-left'])
}
const data_container = document.getElementById('data_container')
if (data_container) {
const div = data_container.parentElement
if (div.id === 'mainbody') {
data_container.setAttribute('data-width', data_container.style.width)
if (data_container.style['margin-left']) {
data_container.setAttribute('data-margin-left', data_container.style['margin-left'])
} else {
data_container.setAttribute('data-margin-left', data_container.style.margin)
}
} else {
div.setAttribute('data-width', div.style.width)
div.setAttribute('data-margin-left', div.style['margin-left'])
}
}
const data_info = document.getElementById('data_info')
if (data_info) {
data_info.setAttribute('data-width', data_info.style.width)
}
mod_side_menu_offset.addEventListener('change', function () {
pref.offset = this.checked
if (menu.style.display === '') {
if (pref.offset) {
setMenuOffset()
} else {
resetMenuOffset()
}
}
savePref()
})
}
const setMenuOffset = function () {
if ( ! pref.offset) {
return
}
const getcontinuation = document.getElementById('getcontinuation')
if (getcontinuation) {
getcontinuation.style.width = '90%'
}
const operation_btn_container = document.getElementById('operation_btn_container')
if (operation_btn_container) {
operation_btn_container.style.width = `calc(100% - ${pref.side_menu_width}px)`
if (pref.button_position % 2 === 0) {
operation_btn_container.style['margin-left'] = `${pref.side_menu_width}px`
} else {
const margin = operation_btn_container.getAttribute('data-margin-left')
if (margin !== undefined) {
operation_btn_container.style['margin-left'] = margin
}
}
}
const data_container_title = document.getElementById('data_container_title')
if (data_container_title) {
data_container_title.style.width = `calc(98% - ${pref.side_menu_width}px)`
if (pref.button_position % 2 === 0) {
data_container_title.style['margin-left'] = `calc(1% + ${pref.side_menu_width}px)`
} else {
const margin = data_container_title.getAttribute('data-margin-left')
if (margin !== undefined) {
data_container_title.style['margin-left'] = margin
}
}
}
const data_container = document.getElementById('data_container')
if (data_container) {
const div = data_container.parentElement
if (div.id === 'mainbody') {
data_container.style.width = `calc(95% - ${pref.side_menu_width}px)`
if (pref.button_position % 2 === 0) {
data_container.style['margin-left'] = `calc(15px + ${pref.side_menu_width}px)`
} else {
const margin = data_container.getAttribute('data-margin-left')
if (margin !== undefined) {
data_container.style['margin-left'] = margin
}
}
} else {
div.style.width = `calc(100% - ${pref.side_menu_width}px)`
if (pref.button_position % 2 === 0) {
div.style['margin-left'] = `${pref.side_menu_width}px`
} else {
const margin = div.getAttribute('data-margin-left')
if (margin !== undefined) {
div.style['margin-left'] = margin
}
}
}
}
const data_info = document.getElementById('data_info')
if (data_info) {
data_info.style.width = `calc(100% - ${pref.side_menu_width}px)`
}
}
const resetMenuOffset = function () {
const getcontinuation = document.getElementById('getcontinuation')
if (getcontinuation) {
const width = getcontinuation.getAttribute('data-width')
if (width !== undefined) {
getcontinuation.style.width = width
}
}
const operation_btn_container = document.getElementById('operation_btn_container')
if (operation_btn_container) {
const width = operation_btn_container.getAttribute('data-width')
if (width !== undefined) {
operation_btn_container.style.width = width
}
const margin = operation_btn_container.getAttribute('data-margin-left')
if (margin !== undefined) {
operation_btn_container.style['margin-left'] = margin
}
}
const data_container_title = document.getElementById('data_container_title')
if (data_container_title) {
const width = data_container_title.getAttribute('data-width')
if (width !== undefined) {
data_container_title.style.width = width
}
const margin = data_container_title.getAttribute('data-margin-left')
if (margin !== undefined) {
data_container_title.style['margin-left'] = margin
}
}
const data_container = document.getElementById('data_container')
if (data_container) {
const div = data_container.parentElement
if (div.id === 'mainbody') {
const width = data_container.getAttribute('data-width')
if (width !== undefined) {
data_container.style.width = width
}
const margin = data_container.getAttribute('data-margin-left')
if (margin !== undefined) {
data_container.style['margin-left'] = margin
}
} else {
const width = div.getAttribute('data-width')
if (width !== undefined) {
div.style.width = width
}
const margin = div.getAttribute('data-margin-left')
if (margin !== undefined) {
div.style['margin-left'] = margin
}
}
}
const data_info = document.getElementById('data_info')
if (data_info) {
const width = data_info.getAttribute('data-width')
if (width !== undefined) {
data_info.style.width = width
}
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment