World info folders can now be collapsed by clicking on the folder icon
This commit is contained in:
parent
452b46146b
commit
fc04ff3a08
|
@ -1710,6 +1710,12 @@ def get_message(msg):
|
||||||
elif(msg['cmd'] == 'wiexpandfolder'):
|
elif(msg['cmd'] == 'wiexpandfolder'):
|
||||||
assert 0 <= int(msg['data']) < len(vars.worldinfo)
|
assert 0 <= int(msg['data']) < len(vars.worldinfo)
|
||||||
emit('from_server', {'cmd': 'wiexpandfolder', 'data': msg['data']}, broadcast=True)
|
emit('from_server', {'cmd': 'wiexpandfolder', 'data': msg['data']}, broadcast=True)
|
||||||
|
elif(msg['cmd'] == 'wifoldercollapsecontent'):
|
||||||
|
vars.wifolders_d[msg['data']]['collapsed'] = True
|
||||||
|
emit('from_server', {'cmd': 'wifoldercollapsecontent', 'data': msg['data']}, broadcast=True)
|
||||||
|
elif(msg['cmd'] == 'wifolderexpandcontent'):
|
||||||
|
vars.wifolders_d[msg['data']]['collapsed'] = False
|
||||||
|
emit('from_server', {'cmd': 'wifolderexpandcontent', 'data': msg['data']}, broadcast=True)
|
||||||
elif(msg['cmd'] == 'wiupdate'):
|
elif(msg['cmd'] == 'wiupdate'):
|
||||||
num = int(msg['num'])
|
num = int(msg['num'])
|
||||||
fields = ("key", "keysecondary", "content", "comment")
|
fields = ("key", "keysecondary", "content", "comment")
|
||||||
|
|
|
@ -419,7 +419,7 @@ function addWiLine(ob) {
|
||||||
function addWiFolder(uid, ob) {
|
function addWiFolder(uid, ob) {
|
||||||
if(uid !== null) {
|
if(uid !== null) {
|
||||||
var uninitialized = $("#wilistfoldercontainer"+null);
|
var uninitialized = $("#wilistfoldercontainer"+null);
|
||||||
var html = "<div class=\"wisortable-container\" id=\"wilistfoldercontainer"+uid+"\" folder-uid=\""+uid+"\">\
|
var html = "<div class=\"wisortable-container "+(ob.collapsed ? "" : "folder-expanded")+"\" id=\"wilistfoldercontainer"+uid+"\" folder-uid=\""+uid+"\">\
|
||||||
<div class=\"wilistfolder\" id=\"wilistfolder"+uid+"\">\
|
<div class=\"wilistfolder\" id=\"wilistfolder"+uid+"\">\
|
||||||
<div class=\"wiremove\">\
|
<div class=\"wiremove\">\
|
||||||
<button type=\"button\" class=\"btn btn-primary heightfull\" id=\"btn_wifolder"+uid+"\">X</button>\
|
<button type=\"button\" class=\"btn btn-primary heightfull\" id=\"btn_wifolder"+uid+"\">X</button>\
|
||||||
|
@ -428,7 +428,7 @@ function addWiFolder(uid, ob) {
|
||||||
</div>\
|
</div>\
|
||||||
<div class=\"wifoldericon\">\
|
<div class=\"wifoldericon\">\
|
||||||
<div class=\"wicentered\">\
|
<div class=\"wicentered\">\
|
||||||
<span class=\"oi oi-folder\" aria-hidden=\"true\"></span>\
|
<span class=\"oi oi-folder folder-expand "+(ob.collapsed ? "" : "folder-expanded")+"\" id=\"btn_wifolderexpand"+uid+"\" aria-hidden=\"true\"></span>\
|
||||||
</div>\
|
</div>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class=\"wifoldername\">\
|
<div class=\"wifoldername\">\
|
||||||
|
@ -461,7 +461,7 @@ function addWiFolder(uid, ob) {
|
||||||
var onfocusout = function () {
|
var onfocusout = function () {
|
||||||
socket.send({'cmd': 'wifolderupdate', 'uid': uid, 'data': {
|
socket.send({'cmd': 'wifolderupdate', 'uid': uid, 'data': {
|
||||||
name: $("#wifoldername"+uid).val(),
|
name: $("#wifoldername"+uid).val(),
|
||||||
collapsed: false,
|
collapsed: !$("#btn_wifolderexpand"+uid).hasClass("folder-expanded"),
|
||||||
}});
|
}});
|
||||||
};
|
};
|
||||||
$("#wifoldergutter"+uid).on("click", function () {
|
$("#wifoldergutter"+uid).on("click", function () {
|
||||||
|
@ -488,9 +488,22 @@ function addWiFolder(uid, ob) {
|
||||||
$(this).parent().parent().find(".wisortable-body").removeClass("hidden");
|
$(this).parent().parent().find(".wisortable-body").removeClass("hidden");
|
||||||
$(this).parent().css("max-height", "").find(".wifoldername").find(".form-control").css("max-height", "");
|
$(this).parent().css("max-height", "").find(".wifoldername").find(".form-control").css("max-height", "");
|
||||||
});
|
});
|
||||||
|
$("#btn_wifolderexpand"+uid).on("click", function () {
|
||||||
|
if($(this).hasClass("folder-expanded")) {
|
||||||
|
socket.send({'cmd': 'wifoldercollapsecontent', 'data': uid});
|
||||||
|
} else {
|
||||||
|
socket.send({'cmd': 'wifolderexpandcontent', 'data': uid});
|
||||||
|
}
|
||||||
|
})
|
||||||
adjustWiFolderNameHeight($("#wifoldername"+uid)[0]);
|
adjustWiFolderNameHeight($("#wifoldername"+uid)[0]);
|
||||||
|
if(ob.collapsed) {
|
||||||
|
setTimeout(function() {
|
||||||
|
var container = $("#wilistfoldercontainer"+uid);
|
||||||
|
hide([container.find(".wifoldergutter-container"), container.find(".wisortable-body")]);
|
||||||
|
}, 2);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
wi_menu.append("<div class=\"wisortable-container\" id=\"wilistfoldercontainer"+uid+"\">\
|
wi_menu.append("<div class=\"wisortable-container folder-expanded\" id=\"wilistfoldercontainer"+uid+"\">\
|
||||||
<div class=\"wilistfolder\" id=\"wilistfolder"+uid+"\">\
|
<div class=\"wilistfolder\" id=\"wilistfolder"+uid+"\">\
|
||||||
<div class=\"wiremove\">\
|
<div class=\"wiremove\">\
|
||||||
<button type=\"button\" class=\"btn btn-primary heightfull\" id=\"btn_wifolder"+uid+"\">+</button>\
|
<button type=\"button\" class=\"btn btn-primary heightfull\" id=\"btn_wifolder"+uid+"\">+</button>\
|
||||||
|
@ -499,7 +512,7 @@ function addWiFolder(uid, ob) {
|
||||||
</div>\
|
</div>\
|
||||||
<div class=\"wifoldericon\">\
|
<div class=\"wifoldericon\">\
|
||||||
<div class=\"wicentered\">\
|
<div class=\"wicentered\">\
|
||||||
<span class=\"oi oi-folder\" aria-hidden=\"true\"></span>\
|
<span class=\"oi oi-folder folder-expand folder-expanded\" id=\"btn_wifolderexpand"+uid+"\" aria-hidden=\"true\"></span>\
|
||||||
</div>\
|
</div>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class=\"wifoldername\">\
|
<div class=\"wifoldername\">\
|
||||||
|
@ -564,6 +577,18 @@ function hideWiFolderDeleteConfirm(num) {
|
||||||
hide([$("#btn_wifolderdel"+num), $("#btn_wifoldercan"+num)]);
|
hide([$("#btn_wifolderdel"+num), $("#btn_wifoldercan"+num)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function collapseWiFolderContent(uid) {
|
||||||
|
hide([$("#wifoldergutter"+uid), $(".wisortable-body[folder-uid="+uid+"]")]);
|
||||||
|
$("#btn_wifolderexpand"+uid).removeClass("folder-expanded");
|
||||||
|
$("#wilistfoldercontainer"+uid).removeClass("folder-expanded");
|
||||||
|
}
|
||||||
|
|
||||||
|
function expandWiFolderContent(uid) {
|
||||||
|
show([$("#wifoldergutter"+uid), $(".wisortable-body[folder-uid="+uid+"]")]);
|
||||||
|
$("#btn_wifolderexpand"+uid).addClass("folder-expanded");
|
||||||
|
$("#wilistfoldercontainer"+uid).addClass("folder-expanded");
|
||||||
|
}
|
||||||
|
|
||||||
function enableWiSelective(num) {
|
function enableWiSelective(num) {
|
||||||
hide([$("#wikey"+num)]);
|
hide([$("#wikey"+num)]);
|
||||||
$("#wikeyprimary"+num).val($("#wikey"+num).val());
|
$("#wikeyprimary"+num).val($("#wikey"+num).val());
|
||||||
|
@ -1922,6 +1947,10 @@ $(document).ready(function(){
|
||||||
expandWiLine(msg.data);
|
expandWiLine(msg.data);
|
||||||
} else if(msg.cmd == "wiexpandfolder") {
|
} else if(msg.cmd == "wiexpandfolder") {
|
||||||
expandWiFolderLine(msg.data);
|
expandWiFolderLine(msg.data);
|
||||||
|
} else if(msg.cmd == "wifoldercollapsecontent") {
|
||||||
|
collapseWiFolderContent(msg.data);
|
||||||
|
} else if(msg.cmd == "wifolderexpandcontent") {
|
||||||
|
expandWiFolderContent(msg.data);
|
||||||
} else if(msg.cmd == "wiselon") {
|
} else if(msg.cmd == "wiselon") {
|
||||||
enableWiSelective(msg.data);
|
enableWiSelective(msg.data);
|
||||||
} else if(msg.cmd == "wiseloff") {
|
} else if(msg.cmd == "wiseloff") {
|
||||||
|
@ -2062,6 +2091,7 @@ $(document).ready(function(){
|
||||||
|
|
||||||
// Make the userscripts menu sortable
|
// Make the userscripts menu sortable
|
||||||
var us_sortable_settings = {
|
var us_sortable_settings = {
|
||||||
|
placeholder: "ussortable-placeholder",
|
||||||
delay: 2,
|
delay: 2,
|
||||||
cursor: "move",
|
cursor: "move",
|
||||||
tolerance: "pointer",
|
tolerance: "pointer",
|
||||||
|
|
|
@ -603,7 +603,12 @@ chunk.editing, chunk.editing * {
|
||||||
background-color: #3bf723;
|
background-color: #3bf723;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wisortable-container {
|
.ussortable-placeholder {
|
||||||
|
height: 4px;
|
||||||
|
background-color: #3bf723;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wisortable-container.folder-expanded {
|
||||||
padding-bottom: 50px;
|
padding-bottom: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,6 +707,23 @@ chunk.editing, chunk.editing * {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.folder-expand {
|
||||||
|
opacity: 20%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.folder-expand:hover {
|
||||||
|
opacity: 44%;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.folder-expand.folder-expanded {
|
||||||
|
opacity: 80% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.folder-expand.folder-expanded:hover {
|
||||||
|
opacity: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
.selective-key-icon {
|
.selective-key-icon {
|
||||||
position: absolute !important;
|
position: absolute !important;
|
||||||
top: 5px !important;
|
top: 5px !important;
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
<script src="static/bootstrap.min.js"></script>
|
<script src="static/bootstrap.min.js"></script>
|
||||||
<script src="static/bootstrap-toggle.min.js"></script>
|
<script src="static/bootstrap-toggle.min.js"></script>
|
||||||
<script src="static/rangy-core.min.js"></script>
|
<script src="static/rangy-core.min.js"></script>
|
||||||
<script src="static/application.js?ver=1.16.4j"></script>
|
<script src="static/application.js?ver=1.16.4k"></script>
|
||||||
|
|
||||||
<link rel="stylesheet" href="static/jquery-ui.sortable.min.css">
|
<link rel="stylesheet" href="static/jquery-ui.sortable.min.css">
|
||||||
<link rel="stylesheet" href="static/bootstrap.min.css">
|
<link rel="stylesheet" href="static/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="static/bootstrap-toggle.min.css">
|
<link rel="stylesheet" href="static/bootstrap-toggle.min.css">
|
||||||
<link rel="stylesheet" href="static/custom.css?ver=1.16.4e">
|
<link rel="stylesheet" href="static/custom.css?ver=1.16.4f">
|
||||||
<link rel="stylesheet" href="static/open-iconic-bootstrap.min.css">
|
<link rel="stylesheet" href="static/open-iconic-bootstrap.min.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
Loading…
Reference in New Issue