ami/src/ami.js/strings.js

284 lines
9.5 KiB
JavaScript

var AmiStrings = (function() {
var menuText = {
chans: "Channels",
online: "Online Users",
sets: "Settings",
uploads: "Uploads",
help: "Help",
submit: "Submit",
send: "Send",
kick: "You have been kicked!",
ban: "You have been banned until",
authfail: "Could not join chat: Authorization data supplied was denied! Contact the system administrator if the problem persists.",
userfail: "Could not join chat: Username in use!",
sockfail: "Could not join chat: A session already exists from this socket!",
joinfail: "Could not join chat: You are banned until",
conn: "Connecting to chat server...",
auth: "Authenticating login data...",
term: "Connection terminated! Details: ",
back: "Click here to go back",
eot: "the end of time.",
enable: "Enable {0} Tag",
persist: "Persist {0} Tag",
bprompt: "Enter the argument:",
urlprompt: "Enter the URL:",
chanpwd: "Enter the password for {0}:",
username: "Username",
message: "Message",
whisper: "(whispers)",
whisperto: "(whispers to {0})",
delmsg: "Are you sure you want to delete this message?",
ctxlou: "List online users",
ctxlchan: "List available channels",
ctxda: "Describe action",
ctxnick: "Change username",
ctxcchan: "Create channel",
ctxjchan: "Join a channel",
ctxpm: "Send private message",
ctxkick: "Kick user",
ctxban: "Ban user",
ctxwho: "Display IP Address",
};
var botText = {
say: "{0}",
join: "{0} has joined the chat.",
leave: "{0} has disconnected.",
jchan: "{0} entered the channel.",
lchan: "{0} left the channel.",
kick: "{0} has been kicked.",
timeout: "{0} exploded.",
nick: "{0} is now known as {1}.",
crchan: "{0} has been created.",
delchan: "{0} has been deleted.",
cpwdchan: "Password changed successfully.",
cprivchan: "Channel privilege changed successfully.",
ipaddr: "User {0} - IP Address: {1}",
silence: "You have been silenced!",
unsil: "You have been unsilenced!",
usilok: "{0} has been unsilenced.",
silok: "{0} has been silenced.",
flood: "{0} has been kicked for flood protection.",
flwarn: "[b]Warning! You will be kicked for flood protection if you continue.[/b]",
unban: "{0} has been unbanned.",
banlist: "Banned Users/IPs: {0}",
who: "Online Users: {0}",
whochan: "Users in {0}: {1}",
};
var botErrText = {
nolang: "Error: Chatbot sent {1} id '{0}' with no definition in this language!",
nocmd: "Error: Command {0} not found!",
cmdna: "Error: Not allowed to use {0}!",
cmderr: "Error: Command formatted incorrectly!",
usernf: "Error: User {0} not found!",
kickna: "Error: Not allowed to kick {0}!",
samechan: "Error: You are already in {0}!",
nochan: "Error: Channel {0} does not exist!",
ipchan: "Error: You are not allowed to join {0}!",
nopwchan: "Error: Channel {0} is password-protected! Use '/join {0} [password]'.",
ipwchan: "Error: Password to channel {0} is incorrect!",
inchan: "Error: Channel name cannot start with a @ or *!",
nischan: "Error: Channel {0} already exists!",
ndchan: "Error: You are not allowed to delete channel {0}!",
namchan: "Error: You are not allowed to modify channel {0}!",
nameinuse: "Error: Username {0} in use!",
rankerr: "Error: Cannot set channel privilege higher than your own!",
reconnect: "Connection lost! Attempting to reconnect automatically...",
logerr: "Server uses the flat file database implementation and cannot serve logs to clients. To view chat logs, open the logs.txt file in the ffdb folder in the server's root directory.",
generr: "An error has occurred!",
logimper: "You are not allowed to view the logs.",
silerr: "Error: User is already silenced!",
usilerr: "Error: User is not silenced!",
silperr: "Error: You are not allowed to silence this user!",
usilperr: "Error: You are not allowed to unsilence this user!",
silself: "Error: You cannot silence yourself!",
delerr: "Error: Not allowed to delete this message!",
notban: "Error: {0} is not banned!",
whoerr: "Error: Not allowed to look into channel {0}!",
};
var settingsText = {
bbcode: "Enable BBCode",
emotes: "Enable emoticons",
links: "Enable hyperlinks",
volume: "Sound volume",
spack: "Sound pack",
style: "Style",
runjoketrig: "Run joke triggers",
shownotifs: "Enable notifications",
dumppackets: "Dump packets to console",
autoembedmedia: "Auto-embed media",
skipdomainpopupthing: "Skip domain pop up thing",
};
var bbCodeText = {
b: "Bold",
i: "Italics",
u: "Underline",
s: "Strikethrough",
quote: "Quote",
code: "Code",
sjis: "SJIS",
url: "Link",
img: "Image",
video: "Video",
audio: "Audio",
color: "Colour",
spoiler: "Spoiler",
};
var helpText = [
{
title: "Send Private Message",
format: "/msg name message",
},
{
title: "Describe an Action",
format: "/me description",
},
{
title: "Away From Keyboard",
format: "/afk [reason]",
},
{
title: "List Users",
format: "/who [channel]",
},
{
title: "Create a Channel",
format: "/create [rank] name",
},
{
title: "Join a Channel",
format: "/join name",
},
{
title: "Set Channel Password",
format: "/pwd [password]",
},
{
title: "Set Channel Rank",
format: "/rank [rank]",
},
{
title: "Kick User (moderator only)",
format: "/kick user [time]",
modOnly: true,
},
{
title: "Ban User (moderator only)",
format: "/ban user [time]",
modOnly: true,
},
{
title: "Unban User (moderator only)",
format: "/unban user",
modOnly: true,
},
{
title: "Unban IP (moderator only)",
format: "/unbanip ip",
modOnly: true,
},
{
title: "Silence User (moderator only)",
format: "/silence user [time]",
modOnly: true,
},
{
title: "Unsilence User (moderator only)",
format: "/unsilence user",
modOnly: true,
},
{
title: "Server-Wide Broadcast (moderator only)",
format: "/say message",
modOnly: true,
},
{
title: "Get User IP (moderator only)",
format: "/whois user",
modOnly: true,
},
{
title: "Delete Channel (moderator only)",
format: "/delete name",
modOnly: true,
},
];
var formatStr = function(string, args) {
if(args)
for(var i = 0; i < args.length; ++i) {
var arg = args[i];
string = string.replace(new RegExp('\\{' + i + '\\}', 'g'), arg);
}
return string;
};
return {
hasMenuString: function(name) {
return name in menuText;
},
getMenuString: function(name, args) {
if(name in menuText)
return formatStr(menuText[name], args);
return 'getMenuString(' + name + ')';
},
hasBBCodeString: function(name) {
return name in bbCodeText;
},
getBBCodeString: function(name) {
if(name in bbCodeText)
return bbCodeText[name];
return name;
},
hasSettingsString: function(name) {
return name in settingsText;
},
getSettingsString: function(name) {
if(name in settingsText)
return settingsText[name];
return 'getSettingsString(' + name + ')';
},
parseBotMessage: function(text) {
var parts = text.split("\f"),
isError = parts[0] !== '0',
type = parts[1],
args = parts.slice(2),
string = null;
if(isError) {
if(type in botErrText)
string = botErrText[type];
} else {
if(type in botText)
string = botText[type];
}
if(string === null) {
args = [type, isError ? 'error' : 'message'];
isError = true;
type = 'nolang';
string = botErrText[type];
}
string = formatStr(string, args);
return {
isError: isError,
type: type,
args: args,
string: string,
html: ('<span class="' + (isError ? 'botError' : 'botMessage') + '">' + string + '</span>'),
};
},
forEachHelpString: function(body) {
for(var i = 0; i < helpText.length; ++i)
body(helpText[i]);
},
};
})();