mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-03 20:16:33 +02:00
parent
040acb311f
commit
f73a4ee619
5 changed files with 77 additions and 5 deletions
|
@ -212,7 +212,7 @@
|
|||
};
|
||||
addSection();
|
||||
|
||||
const {hide: hideContainer} = settings.getContainers();
|
||||
const {hide: hideContainer, expand: expandContainer} = settings.getContainers();
|
||||
settingsDisplay.forEach(function(display){
|
||||
if (typeof display === "string"){
|
||||
addSection(display);
|
||||
|
@ -248,6 +248,7 @@
|
|||
}
|
||||
if (setting){
|
||||
setting.display = display;
|
||||
|
||||
let hideChangeListeners = [];
|
||||
setting.setHide = function setHide(value){
|
||||
if (hideContainer){
|
||||
|
@ -279,6 +280,31 @@
|
|||
});
|
||||
}
|
||||
|
||||
let expandChangeListeners = [];
|
||||
setting.setExpand = function setExpand(value){
|
||||
if (expandContainer){
|
||||
expandContainer.setExpandByName(display.name, value);
|
||||
}
|
||||
};
|
||||
setting.onExpandChange = function(listener){
|
||||
expandChangeListeners.push(listener);
|
||||
};
|
||||
setting.getExpand = function getExpand(){
|
||||
if (expandContainer){
|
||||
return expandContainer.getExpandByName(display.name);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
if (expandContainer){
|
||||
expandContainer.onExpandChange(display.name, function(value){
|
||||
expandChangeListeners.forEach(function(listener){
|
||||
listener(value);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var row = optionsGui.createSettingRow(setting);
|
||||
let section = lastSection;
|
||||
section.addRow(row);
|
||||
|
|
|
@ -198,14 +198,17 @@
|
|||
|
||||
if (setting.urlSpecific && url === ""){
|
||||
let container = document.createElement("div");
|
||||
container.className = "urlValues collapsed";
|
||||
container.className = "urlValues " + (setting.getExpand()? "expanded": "collapsed");
|
||||
container.appendChild(input);
|
||||
var collapser = document.createElement("span");
|
||||
collapser.classList.add("collapser");
|
||||
container.appendChild(collapser);
|
||||
collapser.addEventListener("click", function(){
|
||||
container.classList.toggle("collapsed");
|
||||
container.classList.toggle("expanded");
|
||||
setting.setExpand(!setting.getExpand());
|
||||
});
|
||||
setting.onExpandChange(function(value){
|
||||
container.classList[value? "remove": "add"]("collapsed");
|
||||
container.classList[value? "add": "remove"]("expanded");
|
||||
});
|
||||
let urlTable = document.createElement("table");
|
||||
let caption = document.createElement("caption");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue