Skip to content

Commit

Permalink
Merge pull request #125 from MannixMD/master
Browse files Browse the repository at this point in the history
fixing conflicting selectors + adding styling for few broken bbcodes
  • Loading branch information
iMattPro authored Sep 14, 2023
2 parents 11fcc2f + af4fa08 commit 27ee01e
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 39 deletions.
5 changes: 5 additions & 0 deletions styles/scaffoldBB/template/event/overall_footer_after.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
{% INCLUDEJS '@vse_abbc3/js/abbc3.min.js' %}
{% INCLUDEJS '@vse_abbc3/js/scaffoldBB.js' %}
<style>
.postbody .content .shadow {
box-shadow: none !important;
}
</style>
142 changes: 103 additions & 39 deletions styles/scaffoldBB/template/js/scaffoldBB.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,115 @@
const mainBox = document.querySelector('#abbc3_buttons');
const buttons = [ ...document.querySelectorAll('#abbc3_buttons .button-secondary') ];
const selectElements = [ ...document.querySelectorAll('#abbc3_buttons select') ];
const modal = document.querySelector('#bbcode_wizard');
const dropdown = document.querySelector('.abbc3_font_menu_btn');
const dropdownLists = [ ...document.querySelectorAll('.abbc3_font_menu_btn ul') ];
const abbc3mainBox = document.querySelector("#abbc3_buttons");
const abbc3buttons = [
...document.querySelectorAll("#abbc3_buttons .button-secondary"),
];
const abbc3selectElements = [
...document.querySelectorAll("#abbc3_buttons select"),
];
const abbc3modal = document.querySelector("#bbcode_wizard");
const abbc3dropdown = document.querySelector(".abbc3_font_menu_btn");
const abbc3dropdownLists = [
...document.querySelectorAll(".abbc3_font_menu_btn ul"),
];
const abbc3icons = document.querySelectorAll(".materialbutton .icon");
abbc3icons.forEach((icon) => {
icon.classList.add("fa");
icon.parentElement.classList.add("btn", "btn-sm", "btn-secondary");
});
const abbc3tables = document.querySelectorAll(".pipe-table");
abbc3tables.forEach((table) => {
table.parentElement.classList.add("table-responsive");
table.parentElement.style.lineHeight = "inherit";
table.parentElement.style.border = "inherit";
table.classList.add(
"table",
"table-sm",
"table-striped",
"table-bordered",
"table-hover"
);
table.querySelectorAll("th").forEach((th) => {
th.style.backgroundColor = "var(--bs-table-bg)";
th.style.color = "var(--bs-body-color)";
});
});

if (mainBox !== null) {
modal.classList.add('modal');
modal.setAttribute('tabindex', '-1');
modal.style.cssText += 'border: inherit;font-size: inherit;background: inherit;border-radius: inherit;box-shadow: inherit;top: 0;left: 0;width: 100%;margin-top: unset;margin-left: unset;';
mainBox.classList.add('my-2', 'gx-0', 'row');
mainBox.firstElementChild.classList.remove('abbc3_buttons_row');
mainBox.firstElementChild.classList.add('bg-gradient', 'bg-body', 'border', 'px-3', 'rounded-top');
mainBox.lastElementChild.classList.remove('abbc3_buttons_row');
mainBox.lastElementChild.classList.add('bg-gradient', 'bg-body', 'border', 'border-top-0', 'px-3', 'rounded-bottom', 'pt-1', 'pb-2');
if (abbc3mainBox !== null) {
const abbc3rows = Array.from(abbc3mainBox.children);
abbc3modal.classList.add("modal");
abbc3modal.setAttribute("tabindex", "-1");
abbc3modal.style.cssText +=
"border: inherit;font-size: inherit;background: inherit;border-radius: inherit;box-shadow: inherit;";
abbc3mainBox.classList.add("my-2", "gx-0", "row");
abbc3mainBox.firstElementChild.classList.remove("abbc3_buttons_row");
abbc3mainBox.firstElementChild.classList.add(
"bg-gradient",
"bg-body",
"border",
"px-3",
"rounded-top"
);
abbc3mainBox.lastElementChild.classList.remove("abbc3_buttons_row");
abbc3mainBox.lastElementChild.classList.add(
"bg-gradient",
"bg-body",
"border",
"border-top-0",
"px-3",
"rounded-bottom",
"pt-1",
"pb-2"
);

if (document.body.contains(document.querySelector('.section-viewtopic'))) {
mainBox.firstElementChild.classList.add('col-md-12');
mainBox.lastElementChild.classList.add('col-md-12');
if (document.body.contains(document.querySelector(".section-viewtopic"))) {
abbc3mainBox.firstElementChild.classList.add("col-md-12");
abbc3mainBox.lastElementChild.classList.add("col-md-12");
} else {
mainBox.firstElementChild.classList.add('col-md-10');
mainBox.lastElementChild.classList.add('col-md-10');
abbc3mainBox.firstElementChild.classList.add("col-md-10");
abbc3mainBox.lastElementChild.classList.add("col-md-10");
}

buttons.forEach(button => {
button.classList.add('btn', 'btn-sm', 'btn-secondary', 'bg-gradient', 'button', 'button-secondary');
abbc3buttons.forEach((button) => {
button.classList.add(
"btn",
"btn-sm",
"btn-secondary",
"bg-gradient",
"button",
"button-secondary"
);
});
selectElements.forEach(element => {
element.style.cssText += 'border: 1px solid #ced4da;padding-top: 0.25rem;padding-bottom: 0.25rem;padding-left: 0.5rem;font-size: 0.875rem;border-radius: 0.2rem;height: auto;';
abbc3selectElements.forEach((element) => {
element.classList.remove("form-select", "form-select-sm");
element.style.cssText +=
"border: 1px solid #ced4da;padding-top: 0.25rem;padding-bottom: 0.25rem;padding-left: 0.5rem;font-size: 0.875rem;border-radius: 0.2rem;height: auto;";
});

dropdown.classList.add('dropdown');
dropdown.classList.remove('dropdown-container');
dropdown.firstElementChild.classList.add('dropdown-toggle');
dropdown.firstElementChild.classList.remove('dropdown-trigger');
dropdown.firstElementChild.setAttribute('id', 'abbc3-dropdown');
dropdown.firstElementChild.setAttribute('data-bs-toggle', 'dropdown');
dropdown.firstElementChild.setAttribute('aria-expanded', 'false');
dropdown.firstElementChild.lastChild.remove();
abbc3dropdown.classList.add("dropdown");
abbc3dropdown.classList.remove("dropdown-container");
abbc3dropdown.firstElementChild.classList.add("dropdown-toggle");
abbc3dropdown.firstElementChild.classList.remove("dropdown-trigger");
abbc3dropdown.firstElementChild.setAttribute("id", "abbc3-dropdown");
abbc3dropdown.firstElementChild.setAttribute("data-bs-toggle", "dropdown");
abbc3dropdown.firstElementChild.setAttribute("aria-expanded", "false");
abbc3dropdown.firstElementChild.lastChild.remove();

dropdown.lastElementChild.classList.remove('dropdown');
dropdown.lastElementChild.classList.add('dropdown-menu');
dropdown.lastElementChild.setAttribute('aria-labelledby', 'abbc3-dropdown');
dropdown.lastElementChild.lastElementChild.classList.add('list-unstyled');
dropdown.lastElementChild.lastElementChild.classList.remove('dropdown-contents');
abbc3dropdown.lastElementChild.classList.remove("dropdown");
abbc3dropdown.lastElementChild.classList.add("dropdown-menu");
abbc3dropdown.lastElementChild.setAttribute(
"aria-labelledby",
"abbc3-dropdown"
);
abbc3dropdown.lastElementChild.lastElementChild.classList.add(
"list-unstyled"
);
abbc3dropdown.lastElementChild.lastElementChild.classList.remove(
"dropdown-contents"
);

dropdownLists.forEach(elem => {
elem.classList.add('list-unstyled', 'dropdown-header');
abbc3dropdownLists.forEach((elem) => {
elem.classList.add("list-unstyled", "dropdown-header");
});
abbc3rows.forEach((row) => {
row.classList.remove("abbc3_buttons_row_legacy");
});
}

0 comments on commit 27ee01e

Please sign in to comment.