Skip to content
Snippets Groups Projects
Commit f4602de1 authored by rswindell's avatar rswindell
Browse files

Cache the entire avatar_lib.js (in bbs.mods), not just the avatar data -

performance optimization.
parent 17e2c968
No related branches found
No related tags found
No related merge requests found
......@@ -28,10 +28,12 @@ for(var i in argv) {
}
}
var Avatar = load({}, 'avatar_lib.js');
if(!bbs.mods.avatar_lib)
bbs.mods.avatar_lib = load({}, 'avatar_lib.js');
if(draw) {
Avatar.draw(usernum, /* name: */null, /* netaddr: */null, above, right, top);
bbs.mods.avatar_lib.draw(usernum, /* name: */null, /* netaddr: */null, above, right, top);
console.attributes = 7; // Clear the background attribute as the next line might scroll, filling with BG attribute
} else {
Avatar.show(usernum);
bbs.mods.avatar_lib.show(usernum);
}
......@@ -5,7 +5,8 @@ require("userdefs.js", 'USER_ANSI');
// Avatar support here:
if(!(bbs.file_attr&FM_ANON) && console.term_supports(USER_ANSI)) {
var Avatar = load({}, 'avatar_lib.js');
Avatar.draw(null, bbs.file_uploader, null, /* above: */true, /* right-justified: */true);
if(!bbs.mods.avatar_lib)
bbs.mods.avatar_lib = load({}, 'avatar_lib.js');
bbs.mods.avatar_lib.draw(null, bbs.file_uploader, null, /* above: */true, /* right-justified: */true);
console.attributes = 7; // Clear the background attribute as the next line might scroll, filling with BG attribute
}
\ No newline at end of file
......@@ -28,14 +28,15 @@ function draw_default_avatar(sub)
if(!avatar)
avatar = options.msg_default;
if(avatar)
Avatar.draw_bin(avatar, /* above: */true, /* right-justified: */true, bbs.msghdr_top_of_screen);
bbs.mods.avatar_lib.draw_bin(avatar, /* above: */true, /* right-justified: */true, bbs.msghdr_top_of_screen);
}
// Avatar support here:
if(!(bbs.msg_attr&MSG_ANONYMOUS)
&& (console.term_supports()&(USER_ANSI|USER_NO_EXASCII)) == USER_ANSI) {
var Avatar = load({}, 'avatar_lib.js');
var success = Avatar.draw(bbs.msg_from_ext, bbs.msg_from, bbs.msg_from_net, /* above: */true, /* right-justified: */true
if(!bbs.mods.avatar_lib)
bbs.mods.avatar_lib = load({}, 'avatar_lib.js');
var success = bbs.mods.avatar_lib.draw(bbs.msg_from_ext, bbs.msg_from, bbs.msg_from_net, /* above: */true, /* right-justified: */true
,bbs.msghdr_top_of_screen);
if(!success && bbs.smb_sub_code) {
draw_default_avatar(bbs.smb_sub_code);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment