New player dialog and bugfixes

This commit is contained in:
Claude Brisson
2023-12-03 15:05:27 +01:00
parent 188d0e27eb
commit 8510bb69ec
11 changed files with 179 additions and 97 deletions

View File

@@ -49,7 +49,7 @@ Element.prototype.toggleClass = function(className) {
NodeList.prototype.hasClass = function(className) {
return this.item(0).classList.contains(className);
}
Element.prototype.toggleClass = function(className) {
Element.prototype.hasClass = function(className) {
this.classList.contains(className);
}
Node.prototype.offset = function() {
@@ -102,3 +102,17 @@ Element.prototype.text = function(txt) {
this.textContent = txt;
}
}
NodeList.prototype.item = function (i) {
return this[+i || 0];
};
NodeList.prototype.find = function(selector) {
let result = [];
this.forEach(function (elem, i) {
let partial = elem.find(selector);
result = result.concat([...partial]);
});
return Reflect.construct(Array, result, NodeList);
}
Element.prototype.find = function (selector) {
return this.querySelectorAll(':scope ' + selector);
}