mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Fix some minor coding errors
This commit is contained in:
@ -2236,7 +2236,7 @@ def stablesortwi():
|
|||||||
last_wi["init"] = False
|
last_wi["init"] = False
|
||||||
last_folder = wi["folder"]
|
last_folder = wi["folder"]
|
||||||
last_wi = wi
|
last_wi = wi
|
||||||
if(last_wi) is not None:
|
if(last_wi is not None):
|
||||||
last_wi["init"] = False
|
last_wi["init"] = False
|
||||||
|
|
||||||
#==================================================================#
|
#==================================================================#
|
||||||
@ -2750,6 +2750,7 @@ def loadRequest(loadpath, filename=None):
|
|||||||
for uid in vars.wifolders_l + [None]:
|
for uid in vars.wifolders_l + [None]:
|
||||||
vars.worldinfo.append({"key": "", "keysecondary": "", "content": "", "comment": "", "folder": uid, "num": None, "init": False, "selective": False, "constant": False})
|
vars.worldinfo.append({"key": "", "keysecondary": "", "content": "", "comment": "", "folder": uid, "num": None, "init": False, "selective": False, "constant": False})
|
||||||
stablesortwi()
|
stablesortwi()
|
||||||
|
organizewi()
|
||||||
|
|
||||||
# Save path for save button
|
# Save path for save button
|
||||||
vars.savedir = loadpath
|
vars.savedir = loadpath
|
||||||
|
@ -341,8 +341,14 @@ function addWiLine(ob) {
|
|||||||
</div>");
|
</div>");
|
||||||
// Assign function to expand WI item to button
|
// Assign function to expand WI item to button
|
||||||
$("#btn_wi"+ob.num).on("click", function () {
|
$("#btn_wi"+ob.num).on("click", function () {
|
||||||
|
var folder = $("#wilistitem"+ob.num).parent().attr("folder-uid");
|
||||||
|
if(folder === undefined) {
|
||||||
|
folder = null;
|
||||||
|
} else {
|
||||||
|
folder = parseInt(folder);
|
||||||
|
}
|
||||||
socket.send({'cmd': 'wiexpand', 'data': ob.num});
|
socket.send({'cmd': 'wiexpand', 'data': ob.num});
|
||||||
socket.send({'cmd': 'wiinit', 'folder': parseInt($("#wilistitem"+ob.num).parent().attr("folder-uid")) || null, 'data': ob.num});
|
socket.send({'cmd': 'wiinit', 'folder': folder, 'data': ob.num});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Assign actions to other elements
|
// Assign actions to other elements
|
||||||
@ -522,7 +528,6 @@ function expandWiLine(num) {
|
|||||||
$("#btn_wi"+num).html("X");
|
$("#btn_wi"+num).html("X");
|
||||||
$("#btn_wi"+num).off();
|
$("#btn_wi"+num).off();
|
||||||
$("#wilistitem"+num).removeClass("wilistitem-uninitialized").removeClass("wisortable-excluded");
|
$("#wilistitem"+num).removeClass("wilistitem-uninitialized").removeClass("wisortable-excluded");
|
||||||
// Tell server the WI entry was initialized
|
|
||||||
$("#btn_wi"+num).on("click", function () {
|
$("#btn_wi"+num).on("click", function () {
|
||||||
showWiDeleteConfirm(num);
|
showWiDeleteConfirm(num);
|
||||||
});
|
});
|
||||||
@ -723,13 +728,19 @@ function returnWiList(ar) {
|
|||||||
var list = [];
|
var list = [];
|
||||||
var i;
|
var i;
|
||||||
for(i=0; i<ar.length; i++) {
|
for(i=0; i<ar.length; i++) {
|
||||||
|
var folder = $("#wilistitem"+ar[i]).parent().attr("folder-uid");
|
||||||
|
if(folder === undefined) {
|
||||||
|
folder = null;
|
||||||
|
} else {
|
||||||
|
folder = parseInt(folder);
|
||||||
|
}
|
||||||
var ob = {"key": "", "keysecondary": "", "content": "", "comment": "", "folder": null, "num": ar[i], "selective": false, "constant": false};
|
var ob = {"key": "", "keysecondary": "", "content": "", "comment": "", "folder": null, "num": ar[i], "selective": false, "constant": false};
|
||||||
ob.selective = $("#wikeyprimary"+ar[i]).css("display") != "none"
|
ob.selective = $("#wikeyprimary"+ar[i]).css("display") != "none"
|
||||||
ob.key = ob.selective ? $("#wikeyprimary"+ar[i]).val() : $("#wikey"+ar[i]).val();
|
ob.key = ob.selective ? $("#wikeyprimary"+ar[i]).val() : $("#wikey"+ar[i]).val();
|
||||||
ob.keysecondary = $("#wikeysecondary"+ar[i]).val();
|
ob.keysecondary = $("#wikeysecondary"+ar[i]).val();
|
||||||
ob.content = $("#wientry"+ar[i]).val();
|
ob.content = $("#wientry"+ar[i]).val();
|
||||||
ob.comment = $("#wicomment"+i).val();
|
ob.comment = $("#wicomment"+i).val();
|
||||||
ob.folder = parseInt($("#wilistitem"+i).parent().attr("folder-uid")) || null;
|
ob.folder = folder;
|
||||||
ob.constant = $("#constant-key-"+ar[i]).hasClass("constant-key-icon-enabled");
|
ob.constant = $("#constant-key-"+ar[i]).hasClass("constant-key-icon-enabled");
|
||||||
list.push(ob);
|
list.push(ob);
|
||||||
}
|
}
|
||||||
@ -1237,12 +1248,18 @@ function downloadStory(format) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var selective = wilist[i].classList.contains("wilistitem-selective");
|
var selective = wilist[i].classList.contains("wilistitem-selective");
|
||||||
|
var folder = $("#wilistitem"+i).parent().attr("folder-uid");
|
||||||
|
if(folder === undefined) {
|
||||||
|
folder = null;
|
||||||
|
} else {
|
||||||
|
folder = parseInt(folder);
|
||||||
|
}
|
||||||
wilist_compiled.push({
|
wilist_compiled.push({
|
||||||
key: selective ? $("#wikeyprimary"+i).val() : $("#wikey"+i).val(),
|
key: selective ? $("#wikeyprimary"+i).val() : $("#wikey"+i).val(),
|
||||||
keysecondary: $("#wikeysecondary"+i).val(),
|
keysecondary: $("#wikeysecondary"+i).val(),
|
||||||
content: $("#wientry"+i).val(),
|
content: $("#wientry"+i).val(),
|
||||||
comment: $("#wicomment"+i).val(),
|
comment: $("#wicomment"+i).val(),
|
||||||
folder: parseInt($("#wilistitem"+i).parent().attr("folder-uid")) || null,
|
folder: folder,
|
||||||
selective: selective,
|
selective: selective,
|
||||||
constant: wilist[i].classList.contains("wilistitem-constant"),
|
constant: wilist[i].classList.contains("wilistitem-constant"),
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user