Open bviktor opened 5 years ago
Maybe we should save the default files everytime we run killinuxfloor reset
, then when inotify says there's a change, make a diff, and apply the diff to the My-* files?
But then what about map cycles? We store them in a custom file... duh.
Maybe we should make them read-only in webadmin, much like bans?
Nah, instead, we should make everything editable in webadmin. Then we don't have to deal with command line at all. But then we gotta find a way to make the 2 "default" cycles immutable.
default_maplist.html
cycleId = "<%maplistidx%>";
document.getElementById("simpleEditBtn").hidden = true;
if (cycleId <= 1)
{
document.getElementById("mlactions.save").hidden = true;
document.getElementById("mlactions.delete").hidden = true;
document.getElementById("jsmlctrls").hidden = true;
document.getElementById("jsmapcycle").readOnly = true;
//var element = document.getElementById("jsmapcycle");
//element.classList.remove("ui-sortable");
/* remove the delete buttons reactively
* ugly, but this way we can avoid touching js files */
[].forEach.call(document.querySelectorAll('.deleteButton'), function (el)
{
el.style.visibility = 'hidden';
});
//[].forEach.call(document.querySelectorAll('.ui-droppable'), function (el)
//{
// el.classList.remove("ui-droppable");
//});
}
Still needs work, gotta disable drag-n-drop somehow.
The responsible code in default_maplist_editor.js
:
/* cycle map reordering */
_jsmapcycle.sortable({
axis: "y",
containment: "parent",
cancel: ".deleteButton",
start: function(ev, ui) {
$(ui.helper).addClass('dragging');
},
stop: function(ev, ui) {
$(ui.helper).removeClass('dragging');
}
});
/* cycle map dropping */
$('#jsmapcycle').parent().droppable({
accept: "li.mapEntry",
hoverClass: "dropHover",
activeClass: "droppable",
drop: function(ev, ui) {
var item = $('.entry', ui.draggable).text();
item = createMapListEntry(item);
getDeleteMe(item);
setupRndLimitEditor($(item));
_jsmapcycle.append(item);
_jsmapcycle.sortable("refresh");
_jsmapcycle.sortable("refreshPositions");
}
});
Without these it works perfectly, but this is, again, JS, so you can't patch it, coz it's served as gzip...
But in the meanwhile I realized it's not even a problem, because the save button is already hidden, so apart from UI glitches, nothing wrong can happen.
Uh, this may not necessarily work because there are several keys with multiple values and crudini just won't work with those :(
https://superuser.com/questions/181517/how-to-execute-a-command-whenever-a-file-changes
Then
If only I could log the changes...