accessibility improvements and other stuff

This commit is contained in:
Michael Becker 2024-01-17 02:38:41 -05:00
parent 0ec7fc4500
commit ff4c6be547
6 changed files with 45 additions and 28 deletions

View File

@ -3,6 +3,7 @@ function AdditionalDetailWidget(parent)
this.Parent = parent; this.Parent = parent;
this.Show = function () this.Show = function ()
{ {
this.OnOpening();
System.ClassList.Add(this.Parent, "apb-selected"); System.ClassList.Add(this.Parent, "apb-selected");
}; };
this.Hide = function () this.Hide = function ()
@ -11,9 +12,18 @@ function AdditionalDetailWidget(parent)
}; };
this.Toggle = function () this.Toggle = function ()
{ {
if (!System.ClassList.Contains(this.Parent, "apb-selected"))
{
this.OnOpening();
}
System.ClassList.Toggle(this.Parent, "apb-selected"); System.ClassList.Toggle(this.Parent, "apb-selected");
}; };
this.OnOpening = function()
{
};
this.TextLink = parent.childNodes[0]; this.TextLink = parent.childNodes[0];
this.ButtonLink = parent.childNodes[1]; this.ButtonLink = parent.childNodes[1];

View File

@ -1,5 +1,17 @@
function Alert(parentElement) function Alert(parentElement)
{ {
this.ParentElement = parentElement;
this.IconElement = this.ParentElement.children[0];
this.IconElement.NativeObject = this;
this.IconElement.addEventListener("click", function()
{
if (System.ClassList.Contains(this.NativeObject.ParentElement, "uwt-collapsible"))
{
System.ClassList.Toggle(this.NativeObject.ParentElement, "uwt-collapsed");
}
});
this.mvarTitle = ""; this.mvarTitle = "";
this.setTitle = function(value) this.setTitle = function(value)
{ {
@ -137,6 +149,7 @@ window.addEventListener("load", function()
var items = document.getElementsByClassName("uwt-alert"); var items = document.getElementsByClassName("uwt-alert");
for (var i = 0; i < items.length; i++) for (var i = 0; i < items.length; i++)
{ {
items[i].NativeObject = new Alert(items[i]);
if (!System.ClassList.Contains(items[i], "uwt-alert-sticky")) if (!System.ClassList.Contains(items[i], "uwt-alert-sticky"))
{ {
items[i].style.right = "-2000px"; items[i].style.right = "-2000px";

View File

@ -1,48 +1,39 @@
function Disclosure(parentElement) function Disclosure(parentElement)
{ {
this.ParentElement = parentElement; this.ParentElement = parentElement;
this.TitleElement = this.ParentElement.children[0];
parentElement.childNodes[0].childNodes[0].addEventListener("click", function(e) this.TitleElement.NativeObject = this;
this.TitleElement.addEventListener("click", function(e)
{ {
parentElement.NativeObject.ToggleExpanded(); this.NativeObject.toggleExpanded();
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
return false; return false;
}); });
this.mvarExpanded = (parentElement.attributes["data-expanded"] != null ? parentElement.attributes["data-expanded"].value == "true" : false); this.getExpanded = function()
this.GetExpanded = function()
{ {
return this.mvarExpanded; return System.ClassList.Contains(this.ParentElement, "uwt-expanded");
}; };
this.SetExpanded = function(value) this.setExpanded = function(value)
{ {
this.mvarExpanded = value; if (value)
this.Refresh();
};
this.ToggleExpanded = function()
{
this.SetExpanded(!this.GetExpanded());
};
this.Refresh = function()
{
var disclosure = this.ParentElement;
if (this.GetExpanded())
{ {
disclosure.className = "Disclosure Expanded"; System.ClassList.Add(this.ParentElement, "uwt-expanded");
disclosure.attributes["data-expanded"].value = "true";
} }
else else
{ {
disclosure.className = "Disclosure"; System.ClassList.Remove(this.ParentElement, "uwt-expanded");
disclosure.attributes["data-expanded"].value = "false";
} }
}; };
this.toggleExpanded = function()
{
this.setExpanded(!this.getExpanded());
};
} }
window.addEventListener("load", function(e) window.addEventListener("load", function(e)
{ {
var items = document.getElementsByClassName("Disclosure"); var items = document.getElementsByClassName("uwt-disclosure");
for (var i = 0; i < items.length; i++) for (var i = 0; i < items.length; i++)
{ {
items[i].NativeObject = new Disclosure(items[i]); items[i].NativeObject = new Disclosure(items[i]);

View File

@ -1307,5 +1307,8 @@
\date_default_timezone_set(System::GetConfigurationValue("System.DefaultTimezone", date_default_timezone_get())); \date_default_timezone_set(System::GetConfigurationValue("System.DefaultTimezone", date_default_timezone_get()));
session_start(); if (!session_start())
{
echo ("session_start didn't work!");
}
?> ?>

View File

@ -372,7 +372,7 @@
$guidChars .= "}"; $guidChars .= "}";
return $guidChars; return $guidChars;
} }
public function __toStringFormat($includeDashes = false, $prefix = "{", $suffix = "}") public function __toStringFormat($includeDashes = true, $prefix = "{", $suffix = "}")
{ {
$guidChars = $prefix; $guidChars = $prefix;
$guidChars .= UUID::HexsToChars($this->_a >> 24, $this->_a >> 16); $guidChars .= UUID::HexsToChars($this->_a >> 24, $this->_a >> 16);

View File

@ -128,7 +128,7 @@
} }
else else
{ {
echo ("<a class=\"apb-text apb-empty\" href=\"#\">" . $this->Text . "</span>"); echo ("<a class=\"apb-text apb-empty\" href=\"\">" . $this->Text . "</a>");
} }
} }