diff --git a/code/modules/client/verbs/ooc.dm b/code/modules/client/verbs/ooc.dm index 9e4f397dbe..ba89ee40df 100644 --- a/code/modules/client/verbs/ooc.dm +++ b/code/modules/client/verbs/ooc.dm @@ -53,14 +53,15 @@ var/ooc_style = "everyone" if(holder && !holder.fakekey) ooc_style = "elevated" - //YawnWider Block Edit Start - if(holder.rights & R_MOD && !(holder.rights & R_BAN)) //Moderator + + if(holder.rights & R_EVENT) //Retired Admins + ooc_style = "event_manager" + if(holder.rights & R_ADMIN && !(holder.rights & R_BAN)) //Game Masters ooc_style = "moderator" if(holder.rights & R_DEBUG && !(holder.rights & R_BAN)) //Developers ooc_style = "developer" if(holder.rights & R_ADMIN && holder.rights & R_BAN) //Admins ooc_style = "admin" - //YawnWider Block Edit End for(var/client/target in GLOB.clients) if(target.is_preference_enabled(/datum/client_preference/show_ooc)) @@ -147,12 +148,12 @@ display_name = holder.fakekey if(mob.stat != DEAD) display_name = mob.name - //VOREStation Add - Resleeving shenanigan prevention + if(ishuman(mob)) var/mob/living/carbon/human/H = mob if(H.original_player && H.original_player != H.ckey) //In a body not their own display_name = "[H.mind.name] (as [H.name])" - //VOREStation Add End + // Everyone in normal viewing range of the LOOC for(var/mob/viewer in m_viewers) @@ -175,12 +176,12 @@ if(target in GLOB.admins) admin_stuff += "/([key])" - to_chat(target, "" + create_text_tag("looc", "LOOC:", target) + " [display_name][admin_stuff]: [msg]") + to_chat(target, "" + create_text_tag("looc", "LOOC:", target) + " [display_name][admin_stuff]: [msg]") for(var/client/target in r_receivers) var/admin_stuff = "/([key])([admin_jump_link(mob, target.holder)])" - to_chat(target, "" + create_text_tag("looc", "LOOC:", target) + " (R)[display_name][admin_stuff]: [msg]") //CHOMPEdit + to_chat(target, "" + create_text_tag("looc", "LOOC:", target) + " (R)[display_name][admin_stuff]: [msg]") /mob/proc/get_looc_source() return src diff --git a/code/modules/vchat/README.md b/code/modules/vchat/README.md new file mode 100644 index 0000000000..fc7029b217 --- /dev/null +++ b/code/modules/vchat/README.md @@ -0,0 +1,24 @@ +# VChat +(Please add to this file as you learn how this thing works. Thank you!) +## Development + +To implement changes to VChat, one must modify either vchat.js or vchat_client, + where vchat.js corresponds to what actually appears to the user. + Not all of the logic is isolated within vchat_client, vchat.js handles a significant amount of processing as well. + +### vchat.js + +vchat.js is a development file - it is not actually included in the actual game code. Instead, what the game expects is +the minified version "vchat.min.js" + +Therefore, to have your changes in "vchat.js" apply to the game for either PR or testing - you must first minify your script. +If you are unfamiliar how to, simply you copy the file contants in vchat.js, paste them into https://codebeautify.org/minify-js +or any similar tool and paste its output into vchat.min.js . + +As of 2023/08/05, no tool is provided by the codebase to handle minification for the developer. + +### ss13styles.css + +Handles chat colours, background colours, filtering. + +Please keep this file synchronized with code\stylesheet.dm where possible (filters, lightmode colours). diff --git a/code/modules/vchat/css/css-testing.html b/code/modules/vchat/css/css-testing.html index 94e2844b91..0aee4628e9 100644 --- a/code/modules/vchat/css/css-testing.html +++ b/code/modules/vchat/css/css-testing.html @@ -15,7 +15,7 @@ OOC
15
- + - +
@@ -36,35 +36,40 @@ Testing danger message.
[Security] Secu Person says, "Testing radio message."
Testing OOC message.
- Testing LOOC message.
+ Testing LOOC message.
+ Testing RLOOC message.
Testing asay message.
Test Person says, "Testing say message 2."
Testing notice message 2.
Testing danger message 2.
[Security] Secu Person says, "Testing radio message 2".
Testing OOC message 2.
- Testing LOOC message 2.
+ Testing LOOC message 2.
+ Testing RLOOC message 2.
Testing asay message 2.
Test Person says, "Testing say message 3."
Testing notice message 3.
Testing danger message 3.
[Security] Secu Person says, "Testing radio message 3".
Testing OOC message 3.
- Testing LOOC message 3.
+ Testing LOOC message 3.
+ Testing RLOOC message 3.
Testing asay message 3.
Test Person says, "Testing say message 4."
Testing notice message 4.
Testing danger message 4.
[Security] Secu Person says, "Testing radio message 4".
Testing OOC message 4.
- Testing LOOC message 4.
+ Testing LOOC message 4.
+ Testing RLOOC message 4.
Testing asay message 4.
Test Person says, "Testing say message 5."
Testing notice message 5.
Testing danger message 5.
[Security] Secu Person says, "Testing radio message 5".
Testing OOC message 5.
- Testing LOOC message 5.
+ Testing LOOC message 5.
+ Testing RLOOC message 5.
Testing asay message 5.
@@ -73,38 +78,43 @@ Testing danger message.
[Security] Secu Person says, "Testing radio message."
Testing OOC message.
- Testing LOOC message.
+ Testing LOOC message.
+ Testing RLOOC message.
Testing asay message.
Test Person says, "Testing say message 2."
Testing notice message 2.
Testing danger message 2.
[Security] Secu Person says, "Testing radio message 2".
Testing OOC message 2.
- Testing LOOC message 2.
+ Testing LOOC message 2.
+ Testing RLOOC message 2.
Testing asay message 2.
Test Person says, "Testing say message 3."
Testing notice message 3.
Testing danger message 3.
[Security] Secu Person says, "Testing radio message 3".
Testing OOC message 3.
- Testing LOOC message 3.
+ Testing LOOC message 3.
+ Testing RLOOC message 3.
Testing asay message 3.
Test Person says, "Testing say message 4."
Testing notice message 4.
Testing danger message 4.
[Security] Secu Person says, "Testing radio message 4".
Testing OOC message 4.
- Testing LOOC message 4.
+ Testing LOOC message 4.
+ Testing RLOOC message 4.
Testing asay message 4.
Test Person says, "Testing say message 5."
Testing notice message 5.
Testing danger message 5.
[Security] Secu Person says, "Testing radio message 5".
Testing OOC message 5.
- Testing LOOC message 5.
+ Testing LOOC message 5.
+ Testing RLOOC message 5.
Testing asay message 5.
- \ No newline at end of file + diff --git a/code/modules/vchat/css/ss13styles.css b/code/modules/vchat/css/ss13styles.css index 8342a54d1a..93b181186c 100644 --- a/code/modules/vchat/css/ss13styles.css +++ b/code/modules/vchat/css/ss13styles.css @@ -75,8 +75,8 @@ body.inverted { .ooc .everyone {color: #002eb8;} .inverted .ooc .everyone {color: #004ed8;} /* Dark mode */ -.looc {color: #3A9696;} -.rlooc {color: #3ABB96;} +.looc {color: #3A9696; font-weight: bold} +.rlooc {color: #3ABB96; font-weight: bold} .ooc .elevated {color: #2e78d9;} .ooc .moderator {color: #184880;} .ooc .developer {color: #1b521f;} diff --git a/code/modules/vchat/js/vchat.js b/code/modules/vchat/js/vchat.js index 5387f75839..dd514e84dd 100644 --- a/code/modules/vchat/js/vchat.js +++ b/code/modules/vchat/js/vchat.js @@ -185,7 +185,7 @@ function start_vue() { admin: false }, { - matches: ".filter_ooc, .ooc:not(.looc)", + matches: ".ooc, .filter_ooc", becomes: "vc_globalooc", pretty: "Global OOC", tooltip: "The bluewall of global OOC messages", @@ -275,12 +275,20 @@ function start_vue() { admin: true }, { - matches: ".ooc.looc, .ooc, .looc", //Dumb game + matches: ".looc", becomes: "vc_looc", pretty: "Local OOC", tooltip: "Local OOC messages", required: false //YW Edit }, + { + matches: ".rlooc", + becomes: "vc_rlooc", + pretty: "Remote LOOC", + tooltip: "Remote LOOC messages", + required: false, + admin: true + }, { matches: ".boldannounce, .filter_system", becomes: "vc_system", diff --git a/code/modules/vchat/js/vchat.min.js b/code/modules/vchat/js/vchat.min.js index bcd2c699c7..0a6df956f7 100644 --- a/code/modules/vchat/js/vchat.min.js +++ b/code/modules/vchat/js/vchat.min.js @@ -1 +1 @@ -!function(){var e=console.log;console.log=function(t){send_debug(t),e.apply(console,arguments)};var t=console.error;console.error=function(e){send_debug(e),t.apply(console,arguments)},window.onerror=function(e,t,s,a,n){var o="";return n&&n.stack&&(o=n.stack),send_debug(e+" ("+t+"@"+s+":"+a+") "+n+"|UA: "+navigator.userAgent+"|Stack: "+o),!0}}();var vchat_opts={msBeforeDropped:3e4,cookiePrefix:"vst-",alwaysShow:["vc_looc","vc_system"],vchatTabsVer:1},DARKMODE_COLORS={buttonBgColor:"#40628a",buttonTextColor:"#FFFFFF",windowBgColor:"#272727",highlightColor:"#009900",tabTextColor:"#FFFFFF",tabBackgroundColor:"#272727"},LIGHTMODE_COLORS={buttonBgColor:"none",buttonTextColor:"#000000",windowBgColor:"none",highlightColor:"#007700",tabTextColor:"#000000",tabBackgroundColor:"none"},set_storage=set_cookie,get_storage=get_cookie,domparser=new DOMParser;storageAvailable("localStorage")&&(set_storage=set_localstorage,get_storage=get_localstorage);var vueapp,vchat_state={ready:!1,byond_ip:null,byond_cid:null,byond_ckey:null,lastPingReceived:0,latency_sent:0,lastId:0};function start_vchat(){start_vue(),vchat_state.ready=!0,push_Topic("done_loading"),push_Topic_showingnum(this.showingnum),doWinset("htmloutput",{"is-visible":!0}),doWinset("oldoutput",{"is-visible":!1}),doWinset("chatloadlabel",{"is-visible":!1}),setInterval(check_ping,vchat_opts.msBeforeDropped),send_debug("VChat Loaded!")}function start_vue(){vueapp=new Vue({el:"#app",data:{messages:[],shown_messages:[],unshown_messages:0,archived_messages:[],tabs:[{name:"Main",categories:[],immutable:!0,active:!0}],unread_messages:{},editing:!1,paused:!1,latency:0,reconnecting:!1,ext_styles:"",is_admin:!1,inverted:!1,crushing:3,animated:!1,fontsize:.9,lineheight:130,showingnum:200,type_table:[{matches:".filter_say, .say, .emote, .emote_subtle",becomes:"vc_localchat",pretty:"Local Chat",tooltip:"In-character local messages (say, emote, etc)",required:!1,admin:!1},{matches:".filter_radio, .alert, .syndradio, .centradio, .airadio, .entradio, .comradio, .secradio, .engradio, .medradio, .sciradio, .supradio, .srvradio, .expradio, .radio, .deptradio, .newscaster",becomes:"vc_radio",pretty:"Radio Comms",tooltip:"All departments of radio messages",required:!1,admin:!1},{matches:".filter_notice, .notice:not(.pm), .adminnotice, .info, .sinister, .cult",becomes:"vc_info",pretty:"Notices",tooltip:"Non-urgent messages from the game and items",required:!1,admin:!1},{matches:".filter_warning, .warning:not(.pm), .critical, .userdanger, .italics",becomes:"vc_warnings",pretty:"Warnings",tooltip:"Urgent messages from the game and items",required:!1,admin:!1},{matches:".filter_deadsay, .deadsay",becomes:"vc_deadchat",pretty:"Deadchat",tooltip:"All of deadchat",required:!1,admin:!1},{matches:".filter_ooc, .ooc:not(.looc)",becomes:"vc_globalooc",pretty:"Global OOC",tooltip:"The bluewall of global OOC messages",required:!1,admin:!1},{matches:".nif",becomes:"vc_nif",pretty:"NIF Messages",tooltip:"Messages from the NIF itself and people inside",required:!1,admin:!1},{matches:".mentor_channel, .mentor",becomes:"vc_mentor",pretty:"Mentor messages",tooltip:"Mentorchat and mentor pms",required:!1,admin:!1},{matches:".filter_pm, .pm",becomes:"vc_adminpm",pretty:"Admin PMs",tooltip:"Messages to/from admins ('adminhelps')",required:!1,admin:!1},{matches:".filter_ASAY, .admin_channel",becomes:"vc_adminchat",pretty:"Admin Chat",tooltip:"ASAY messages",required:!1,admin:!0},{matches:".filter_MSAY, .mod_channel",becomes:"vc_modchat",pretty:"Mod Chat",tooltip:"MSAY messages",required:!1,admin:!0},{matches:".filter_ESAY, .event_channel",becomes:"vc_eventchat",pretty:"Event Chat",tooltip:"ESAY messages",required:!1,admin:!0},{matches:".filter_combat, .danger",becomes:"vc_combat",pretty:"Combat Logs",tooltip:"Urist McTraitor has stabbed you with a knife!",required:!1,admin:!1},{matches:".filter_adminlogs, .log_message",becomes:"vc_adminlogs",pretty:"Admin Logs",tooltip:"ADMIN LOG: Urist McAdmin has jumped to coordinates X, Y, Z",required:!1,admin:!0},{matches:".filter_attacklogs",becomes:"vc_attacklogs",pretty:"Attack Logs",tooltip:"Urist McTraitor has shot John Doe",required:!1,admin:!0},{matches:".filter_debuglogs",becomes:"vc_debuglogs",pretty:"Debug Logs",tooltip:"DEBUG: SSPlanets subsystem Recover().",required:!1,admin:!0},{matches:".ooc.looc, .ooc, .looc",becomes:"vc_looc",pretty:"Local OOC",tooltip:"Local OOC messages, always enabled",required:!0},{matches:".boldannounce, .filter_system",becomes:"vc_system",pretty:"System Messages",tooltip:"Messages from your client, always enabled",required:!0},{matches:".unsorted",becomes:"vc_unsorted",pretty:"Unsorted",tooltip:"Messages that don't have any filters.",required:!1,admin:!1}]},mounted:function(){this.load_settings();var e=new XMLHttpRequest;e.open("GET","ss13styles.css"),e.onreadystatechange=function(){this.ext_styles=e.responseText}.bind(this),e.send()},updated:function(){this.editing||this.paused||window.scrollTo(0,document.getElementById("messagebox").scrollHeight)},watch:{reconnecting:function(e,t){1==e&&0==t?this.internal_message("Your client has lost connection to the server, or there is severe lag. Your client will reconnect if possible."):0==e&&1==t&&this.internal_message("Your client has reconnected to the server.")},inverted:function(e){set_storage("darkmode",e),e?(document.body.classList.add("inverted"),switch_ui_mode(DARKMODE_COLORS)):(document.body.classList.remove("inverted"),switch_ui_mode(LIGHTMODE_COLORS))},crushing:function(e){set_storage("crushing",e)},animated:function(e){set_storage("animated",e)},fontsize:function(e,t){isNaN(e)?this.fontsize=t:(e<.2?this.fontsize=.2:e>5&&(this.fontsize=5),set_storage("fontsize",e))},lineheight:function(e,t){isFinite(e)?(e<100?this.lineheight=100:e>200&&(this.lineheight=200),set_storage("lineheight",e)):this.lineheight=t},showingnum:function(e,t){isFinite(e)?((e=Math.floor(e))<50?this.showingnum=50:e>2e3&&(this.showingnum=2e3),set_storage("showingnum",this.showingnum),push_Topic_showingnum(this.showingnum),this.attempt_archive()):this.showingnum=t},current_categories:function(e,t){e.length&&this.apply_filter(e)}},computed:{active_tab:function(){return this.tabs.find((function(e){return e.active}))},ping_classes:function(){return this.latency?"?"==this.latency?"grey":this.latency<0?"red":this.latency<=200?"green":this.latency<=400?"yellow":"grey":this.reconnecting?"red":"green"},current_categories:function(){return this.active_tab==this.tabs[0]?[]:this.active_tab.categories.concat(vchat_opts.alwaysShow)}},methods:{load_settings:function(){this.inverted=get_storage("darkmode",!1),this.crushing=get_storage("crushing",3),this.animated=get_storage("animated",!1),this.fontsize=get_storage("fontsize",.9),this.lineheight=get_storage("lineheight",130),this.showingnum=get_storage("showingnum",200),isNaN(this.crushing)&&(this.crushing=3),isNaN(this.fontsize)&&(this.fontsize=.9),this.load_tabs()},load_tabs:function(){var e=get_storage("tabs");if(e){var t=JSON.parse(e);t.version&&t.tabs?!t.version!=vchat_opts.vchatTabsVer?this.tabs.push.apply(this.tabs,t.tabs):this.internal_message("Your saved tabs are for an older version of VChat and must be recreated, sorry."):this.internal_message("There was a problem loading your tabs. Any new ones you make will be saved, however.")}},save_tabs:function(){var e={version:vchat_opts.vchatTabsVer,tabs:[]};this.tabs.forEach((function(t){if(!t.immutable){var s=t.name,a=[];t.categories.forEach((function(e){a.push(e)}));var n={name:s,categories:a,immutable:!1,active:!1};e.tabs.push(n)}}));var t=JSON.stringify(e);set_storage("tabs",t)},switchtab:function(e){e!=this.active_tab&&(this.active_tab.active=!1,e.active=!0,e.categories.forEach((function(e){this.unread_messages[e]=0}),this),this.apply_filter(this.current_categories))},editmode:function(){this.editing=!this.editing,this.save_tabs()},pause:function(){this.paused=!this.paused},newtab:function(){this.tabs.push({name:"New Tab",categories:[],immutable:!1,active:!1}),this.switchtab(this.tabs[this.tabs.length-1])},renametab:function(){if(!this.active_tab.immutable){var e=this.active_tab,t=window.prompt("Type the desired tab name:",e.name);null!==t&&""!==t&&null!==e&&(e.name=t)}},deltab:function(e){e||(e=this.active_tab),e.immutable||(this.switchtab(this.tabs[0]),this.tabs.splice(this.tabs.indexOf(e),1))},movetab:function(e,t){if(e&&!e.immutable){var s=this.tabs.indexOf(e),a=s+t;this.tabs.splice(a,0,this.tabs.splice(s,1)[0])}},tab_unread_count:function(e){var t=0,s=this.unread_messages;return e.categories.find((function(e){s[e]&&(t+=s[e])})),t},tab_unread_categories:function(e){var t=!1,s=this.unread_messages;return e.categories.find((function(e){if(s[e])return t=!0,!0})),{red:t,grey:!t}},attempt_archive:function(){if(this.messages.length>this.showingnum){var e=this.messages.splice(0,20);Array.prototype.push.apply(this.archived_messages,e)}},apply_filter:function(e){this.shown_messages.splice(0),this.unshown_messages=0,this.messages.forEach((function(t){e.indexOf(t.category)>-1&&this.shown_messages.push(t)}),this),this.archived_messages.forEach((function(t){e.indexOf(t.category)>-1&&this.unshown_messages++}),this)},add_message:function(e){let t={time:e.time,category:"error",content:e.message,repeats:1};if(t.category=this.get_category(t.content),"vc_unsorted"==t.category&&(t.content=""+t.content+""),this.crushing){let e=this.messages.slice(-this.crushing);for(let s=e.length-1;s>=0;s--){let a=e[s];a.content==t.content&&(t.repeats+=a.repeats,this.messages.splice(this.messages.indexOf(a),1))}}t.content=t.content.replace(/(\b(https?):\/\/[\-A-Z0-9+&@#\/%?=~_|!:,.;]*[\-A-Z0-9+&@#\/%=~_|])/gim,'$1'),this.current_categories.length&&this.current_categories.indexOf(t.category)<0?(isNaN(this.unread_messages[t.category])&&(this.unread_messages[t.category]=0),this.unread_messages[t.category]+=1):this.current_categories.length&&this.shown_messages.push(t),t.id=++vchat_state.lastId,this.attempt_archive(),this.messages.push(t)},internal_message:function(e){let t={time:this.messages.length?this.messages.slice(-1).time+1:0,category:"vc_system",content:"[VChat Internal] "+e+""};t.id=++vchat_state.lastId,this.messages.push(t)},on_mouseup:function(e){let t=e.target;"getSelection"in window&&!1===window.getSelection().isCollapsed||t&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName)||(focusMapWindow(),e.preventDefault(),e.target.click())},click_message:function(e){let t=e.target;if("A"===t.tagName){e.stopPropagation(),e.preventDefault?e.preventDefault():e.returnValue=!1;var s=t.getAttribute("href");"?"==s[0]||s.length>=8&&"byond://"==s.substring(0,8)?window.location=s:window.location="byond://?action=openLink&link="+encodeURIComponent(s)}},get_category:function(e){if(!vchat_state.ready)return void push_Topic("not_ready");let t=domparser.parseFromString(e,"text/html").querySelector("span"),s="vc_unsorted";return t?(this.type_table.find((function(e){if(t.msMatchesSelector(e.matches))return s=e.becomes,!0})),s):s},save_chatlog:function(){var e="",t=this.archived_messages.concat(this.messages),s=this.current_categories;t.forEach((function(t){(0==s.length||s.indexOf(t.category)>=0)&&(e+=t.content,t.repeats>1&&(e+="(x"+t.repeats+")"),e+="
\n")})),e+="";var a=new Date,n=String(a.getHours());n.length<2&&(n="0"+n);var o=String(a.getMinutes());o.length<2&&(o="0"+o);var i=String(a.getDate());i.length<2&&(i="0"+i);var r=String(a.getMonth()+1);r.length<2&&(r="0"+r);var c="log"+(" "+String(a.getFullYear())+"-"+r+"-"+i+" ("+n+" "+o+")")+".html",l=document.createElement("a");if(void 0!==l.download)l.href="data:attachment/text,"+encodeURI(e),l.target="_blank",l.download=c,l.click();else{var h=new Blob([e],{type:"text/html;charset=utf8;"});saved=window.navigator.msSaveOrOpenBlob(h,c)}},do_latency_test:function(){send_latency_check()},blur_this:function(e){e.target.blur()}}})}function check_ping(){Date.now()-vchat_state.lastPingReceived>vchat_opts.msBeforeDropped&&(vueapp.reconnecting=!0)}function send_latency_check(){vchat_state.latency_sent||(vchat_state.latency_sent=Date.now(),vueapp.latency="?",push_Topic("ping"),setTimeout((function(){"?"==vchat_state.latency_ms&&(vchat_state.latency_ms=999)}),1e3),setTimeout((function(){vchat_state.latency_sent=0,vueapp.latency=0}),5e3))}function get_latency_check(){vchat_state.latency_sent&&(vueapp.latency=Date.now()-vchat_state.latency_sent)}function byondDecode(e){e=e.replace(/\+/g,"%20");try{e=decodeURIComponent(e)}catch(t){e=unescape(e)}return JSON.parse(e)}function putmessage(e){e=byondDecode(e),Array.isArray(e)?e.forEach((function(e){vueapp.add_message(e)})):"object"==typeof e&&vueapp.add_message(e)}function system_message(e){vueapp.internal_message(e)}function push_Topic(e){window.location="?_src_=chat&proc="+e}function push_Topic_showingnum(e){window.location="?_src_=chat&showingnum="+e}function focusMapWindow(){window.location="byond://winset?mapwindow.map.focus=true"}function send_debug(e){push_Topic("debug¶m[message]="+encodeURIComponent(e))}function get_event(e){if(vchat_state.ready){var t;switch((t=byondDecode(e)).evttype){case"internal_error":system_message("Event parse error: "+e);break;case"byond_player":send_client_data(),vueapp.is_admin="true"===t.admin,vchat_state.byond_ip=t.address,vchat_state.byond_cid=t.cid,vchat_state.byond_ckey=t.ckey,set_storage("ip",vchat_state.byond_ip),set_storage("cid",vchat_state.byond_cid),set_storage("ckey",vchat_state.byond_ckey);break;case"keepalive":vchat_state.lastPingReceived=Date.now(),vueapp.reconnecting=!1;break;case"pong":get_latency_check();break;case"availability":push_Topic("done_loading");break;default:system_message("Didn't know what to do with event: "+e)}}else push_Topic("not_ready")}function send_client_data(){let e={ip:get_storage("ip"),cid:get_storage("cid"),ckey:get_storage("ckey")};push_Topic("ident¶m[clientdata]="+JSON.stringify(e))}function set_localstorage(e,t){window.localStorage.setItem(vchat_opts.cookiePrefix+e,t)}function get_localstorage(e,t){let s=window.localStorage.getItem(vchat_opts.cookiePrefix+e);return"null"===s||null===s?s=t:"true"===s?s=!0:"false"===s?s=!1:isNaN(s)||(s=+s),s}function set_cookie(e,t){let s=new Date;s.setFullYear(s.getFullYear()+1);let a=s.toUTCString();document.cookie=vchat_opts.cookiePrefix+e+"="+t+";expires="+a+";path=/"}function get_cookie(e,t){let s=document.cookie.split(";"),a={};s.forEach((function(e){let s=e.replace(vchat_opts.cookiePrefix,"").trim(),n=s.search("="),o=decodeURIComponent(s.substring(0,n)),i=decodeURIComponent(s.substring(n+1));"null"==i||null===i?i=t:"true"===i?i=!0:"false"===i?i=!1:isNaN(i)||(i=+i),a[o]=i})),a[e]}var SKIN_BUTTONS=["rpane.textb","rpane.infob","rpane.wikib","rpane.forumb","rpane.rulesb","rpane.github","rpane.discord","rpane.mapb","rpane.changelog","mainwindow.saybutton","mainwindow.mebutton","mainwindow.hotkey_toggle"],SKIN_ELEMENTS=["mainwindow","mainwindow.mainvsplit","mainwindow.tooltip","rpane","rpane.rpanewindow","rpane.mediapanel"];function switch_ui_mode(e){doWinset(SKIN_BUTTONS.reduce((function(t,s){return t[s+".background-color"]=e.buttonBgColor,t}),{})),doWinset(SKIN_BUTTONS.reduce((function(t,s){return t[s+".text-color"]=e.buttonTextColor,t}),{})),doWinset(SKIN_ELEMENTS.reduce((function(t,s){return t[s+".background-color"]=e.windowBgColor,t}),{})),doWinset("infowindow",{"background-color":e.tabBackgroundColor,"text-color":e.tabTextColor}),doWinset("infowindow.info",{"background-color":e.tabBackgroundColor,"text-color":e.tabTextColor,"highlight-color":e.highlightColor,"tab-text-color":e.tabTextColor,"tab-background-color":e.tabBackgroundColor})}function doWinset(e,t){void 0===t&&(t=e,e=null);var s="byond://winset?";e&&(s+="id="+e+"&"),s+=Object.keys(t).map((function(e){return e+"="+encodeURIComponent(t[e])})).join("&"),window.location=s} \ No newline at end of file +!function(){var e=console.log;console.log=function(t){send_debug(t),e.apply(console,arguments)};var t=console.error;console.error=function(e){send_debug(e),t.apply(console,arguments)},window.onerror=function(e,t,s,a,n){var o="";return n&&n.stack&&(o=n.stack),send_debug(e+" ("+t+"@"+s+":"+a+") "+n+"|UA: "+navigator.userAgent+"|Stack: "+o),!0}}();var vchat_opts={msBeforeDropped:3e4,cookiePrefix:"vst-",alwaysShow:["vc_looc","vc_system"],vchatTabsVer:1},DARKMODE_COLORS={buttonBgColor:"#40628a",buttonTextColor:"#FFFFFF",windowBgColor:"#272727",highlightColor:"#009900",tabTextColor:"#FFFFFF",tabBackgroundColor:"#272727"},LIGHTMODE_COLORS={buttonBgColor:"none",buttonTextColor:"#000000",windowBgColor:"none",highlightColor:"#007700",tabTextColor:"#000000",tabBackgroundColor:"none"},set_storage=set_cookie,get_storage=get_cookie,domparser=new DOMParser;storageAvailable("localStorage")&&(set_storage=set_localstorage,get_storage=get_localstorage);var vueapp,vchat_state={ready:!1,byond_ip:null,byond_cid:null,byond_ckey:null,lastPingReceived:0,latency_sent:0,lastId:0};function start_vchat(){start_vue(),vchat_state.ready=!0,push_Topic("done_loading"),push_Topic_showingnum(this.showingnum),doWinset("htmloutput",{"is-visible":!0}),doWinset("oldoutput",{"is-visible":!1}),doWinset("chatloadlabel",{"is-visible":!1}),setInterval(check_ping,vchat_opts.msBeforeDropped),send_debug("VChat Loaded!")}function start_vue(){vueapp=new Vue({el:"#app",data:{messages:[],shown_messages:[],unshown_messages:0,archived_messages:[],tabs:[{name:"Main",categories:[],immutable:!0,active:!0}],unread_messages:{},editing:!1,paused:!1,latency:0,reconnecting:!1,ext_styles:"",is_admin:!1,inverted:!1,crushing:3,animated:!1,fontsize:.9,lineheight:130,showingnum:200,type_table:[{matches:".filter_say, .say, .emote, .emote_subtle",becomes:"vc_localchat",pretty:"Local Chat",tooltip:"In-character local messages (say, emote, etc)",required:!1,admin:!1},{matches:".filter_radio, .alert, .syndradio, .centradio, .airadio, .entradio, .comradio, .secradio, .engradio, .medradio, .sciradio, .supradio, .srvradio, .expradio, .radio, .deptradio, .newscaster",becomes:"vc_radio",pretty:"Radio Comms",tooltip:"All departments of radio messages",required:!1,admin:!1},{matches:".filter_notice, .notice:not(.pm), .adminnotice, .info, .sinister, .cult",becomes:"vc_info",pretty:"Notices",tooltip:"Non-urgent messages from the game and items",required:!1,admin:!1},{matches:".filter_warning, .warning:not(.pm), .critical, .userdanger, .italics",becomes:"vc_warnings",pretty:"Warnings",tooltip:"Urgent messages from the game and items",required:!1,admin:!1},{matches:".filter_deadsay, .deadsay",becomes:"vc_deadchat",pretty:"Deadchat",tooltip:"All of deadchat",required:!1,admin:!1},{matches:".ooc, .filter_ooc",becomes:"vc_globalooc",pretty:"Global OOC",tooltip:"The bluewall of global OOC messages",required:!1,admin:!1},{matches:".nif",becomes:"vc_nif",pretty:"NIF Messages",tooltip:"Messages from the NIF itself and people inside",required:!1,admin:!1},{matches:".mentor_channel, .mentor",becomes:"vc_mentor",pretty:"Mentor messages",tooltip:"Mentorchat and mentor pms",required:!1,admin:!1},{matches:".filter_pm, .pm",becomes:"vc_adminpm",pretty:"Admin PMs",tooltip:"Messages to/from admins ('adminhelps')",required:!1,admin:!1},{matches:".filter_ASAY, .admin_channel",becomes:"vc_adminchat",pretty:"Admin Chat",tooltip:"ASAY messages",required:!1,admin:!0},{matches:".filter_MSAY, .mod_channel",becomes:"vc_modchat",pretty:"Mod Chat",tooltip:"MSAY messages",required:!1,admin:!0},{matches:".filter_ESAY, .event_channel",becomes:"vc_eventchat",pretty:"Event Chat",tooltip:"ESAY messages",required:!1,admin:!0},{matches:".filter_combat, .danger",becomes:"vc_combat",pretty:"Combat Logs",tooltip:"Urist McTraitor has stabbed you with a knife!",required:!1,admin:!1},{matches:".filter_adminlogs, .log_message",becomes:"vc_adminlogs",pretty:"Admin Logs",tooltip:"ADMIN LOG: Urist McAdmin has jumped to coordinates X, Y, Z",required:!1,admin:!0},{matches:".filter_attacklogs",becomes:"vc_attacklogs",pretty:"Attack Logs",tooltip:"Urist McTraitor has shot John Doe",required:!1,admin:!0},{matches:".filter_debuglogs",becomes:"vc_debuglogs",pretty:"Debug Logs",tooltip:"DEBUG: SSPlanets subsystem Recover().",required:!1,admin:!0},{matches:".looc",becomes:"vc_looc",pretty:"Local OOC",tooltip:"Local OOC messages, always enabled",required:!0},{matches:".rlooc",becomes:"vc_rlooc",pretty:"Remote LOOC",tooltip:"Remote LOOC messages",required:!1,admin:!0},{matches:".boldannounce, .filter_system",becomes:"vc_system",pretty:"System Messages",tooltip:"Messages from your client, always enabled",required:!0},{matches:".unsorted",becomes:"vc_unsorted",pretty:"Unsorted",tooltip:"Messages that don't have any filters.",required:!1,admin:!1}]},mounted:function(){this.load_settings();var e=new XMLHttpRequest;e.open("GET","ss13styles.css"),e.onreadystatechange=function(){this.ext_styles=e.responseText}.bind(this),e.send()},updated:function(){this.editing||this.paused||window.scrollTo(0,document.getElementById("messagebox").scrollHeight)},watch:{reconnecting:function(e,t){1==e&&0==t?this.internal_message("Your client has lost connection to the server, or there is severe lag. Your client will reconnect if possible."):0==e&&1==t&&this.internal_message("Your client has reconnected to the server.")},inverted:function(e){set_storage("darkmode",e),e?(document.body.classList.add("inverted"),switch_ui_mode(DARKMODE_COLORS)):(document.body.classList.remove("inverted"),switch_ui_mode(LIGHTMODE_COLORS))},crushing:function(e){set_storage("crushing",e)},animated:function(e){set_storage("animated",e)},fontsize:function(e,t){isNaN(e)?this.fontsize=t:(e<.2?this.fontsize=.2:e>5&&(this.fontsize=5),set_storage("fontsize",e))},lineheight:function(e,t){isFinite(e)?(e<100?this.lineheight=100:e>200&&(this.lineheight=200),set_storage("lineheight",e)):this.lineheight=t},showingnum:function(e,t){isFinite(e)?((e=Math.floor(e))<50?this.showingnum=50:e>2e3&&(this.showingnum=2e3),set_storage("showingnum",this.showingnum),push_Topic_showingnum(this.showingnum),this.attempt_archive()):this.showingnum=t},current_categories:function(e,t){e.length&&this.apply_filter(e)}},computed:{active_tab:function(){return this.tabs.find((function(e){return e.active}))},ping_classes:function(){return this.latency?"?"==this.latency?"grey":this.latency<0?"red":this.latency<=200?"green":this.latency<=400?"yellow":"grey":this.reconnecting?"red":"green"},current_categories:function(){return this.active_tab==this.tabs[0]?[]:this.active_tab.categories.concat(vchat_opts.alwaysShow)}},methods:{load_settings:function(){this.inverted=get_storage("darkmode",!1),this.crushing=get_storage("crushing",3),this.animated=get_storage("animated",!1),this.fontsize=get_storage("fontsize",.9),this.lineheight=get_storage("lineheight",130),this.showingnum=get_storage("showingnum",200),isNaN(this.crushing)&&(this.crushing=3),isNaN(this.fontsize)&&(this.fontsize=.9),this.load_tabs()},load_tabs:function(){var e=get_storage("tabs");if(e){var t=JSON.parse(e);t.version&&t.tabs?!t.version!=vchat_opts.vchatTabsVer?this.tabs.push.apply(this.tabs,t.tabs):this.internal_message("Your saved tabs are for an older version of VChat and must be recreated, sorry."):this.internal_message("There was a problem loading your tabs. Any new ones you make will be saved, however.")}},save_tabs:function(){var e={version:vchat_opts.vchatTabsVer,tabs:[]};this.tabs.forEach((function(t){if(!t.immutable){var s=t.name,a=[];t.categories.forEach((function(e){a.push(e)}));var n={name:s,categories:a,immutable:!1,active:!1};e.tabs.push(n)}}));var t=JSON.stringify(e);set_storage("tabs",t)},switchtab:function(e){e!=this.active_tab&&(this.active_tab.active=!1,e.active=!0,e.categories.forEach((function(e){this.unread_messages[e]=0}),this),this.apply_filter(this.current_categories))},editmode:function(){this.editing=!this.editing,this.save_tabs()},pause:function(){this.paused=!this.paused},newtab:function(){this.tabs.push({name:"New Tab",categories:[],immutable:!1,active:!1}),this.switchtab(this.tabs[this.tabs.length-1])},renametab:function(){if(!this.active_tab.immutable){var e=this.active_tab,t=window.prompt("Type the desired tab name:",e.name);null!==t&&""!==t&&null!==e&&(e.name=t)}},deltab:function(e){e||(e=this.active_tab),e.immutable||(this.switchtab(this.tabs[0]),this.tabs.splice(this.tabs.indexOf(e),1))},movetab:function(e,t){if(e&&!e.immutable){var s=this.tabs.indexOf(e),a=s+t;this.tabs.splice(a,0,this.tabs.splice(s,1)[0])}},tab_unread_count:function(e){var t=0,s=this.unread_messages;return e.categories.find((function(e){s[e]&&(t+=s[e])})),t},tab_unread_categories:function(e){var t=!1,s=this.unread_messages;return e.categories.find((function(e){if(s[e])return t=!0,!0})),{red:t,grey:!t}},attempt_archive:function(){if(this.messages.length>this.showingnum){var e=this.messages.splice(0,20);Array.prototype.push.apply(this.archived_messages,e)}},apply_filter:function(e){this.shown_messages.splice(0),this.unshown_messages=0,this.messages.forEach((function(t){e.indexOf(t.category)>-1&&this.shown_messages.push(t)}),this),this.archived_messages.forEach((function(t){e.indexOf(t.category)>-1&&this.unshown_messages++}),this)},add_message:function(e){let t={time:e.time,category:"error",content:e.message,repeats:1};if(t.category=this.get_category(t.content),"vc_unsorted"==t.category&&(t.content=""+t.content+""),this.crushing){let e=this.messages.slice(-this.crushing);for(let s=e.length-1;s>=0;s--){let a=e[s];a.content==t.content&&(t.repeats+=a.repeats,this.messages.splice(this.messages.indexOf(a),1))}}t.content=t.content.replace(/(\b(https?):\/\/[\-A-Z0-9+&@#\/%?=~_|!:,.;]*[\-A-Z0-9+&@#\/%=~_|])/gim,'$1'),this.current_categories.length&&this.current_categories.indexOf(t.category)<0?(isNaN(this.unread_messages[t.category])&&(this.unread_messages[t.category]=0),this.unread_messages[t.category]+=1):this.current_categories.length&&this.shown_messages.push(t),t.id=++vchat_state.lastId,this.attempt_archive(),this.messages.push(t)},internal_message:function(e){let t={time:this.messages.length?this.messages.slice(-1).time+1:0,category:"vc_system",content:"[VChat Internal] "+e+""};t.id=++vchat_state.lastId,this.messages.push(t)},on_mouseup:function(e){let t=e.target;"getSelection"in window&&!1===window.getSelection().isCollapsed||t&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName)||(focusMapWindow(),e.preventDefault(),e.target.click())},click_message:function(e){let t=e.target;if("A"===t.tagName){e.stopPropagation(),e.preventDefault?e.preventDefault():e.returnValue=!1;var s=t.getAttribute("href");"?"==s[0]||s.length>=8&&"byond://"==s.substring(0,8)?window.location=s:window.location="byond://?action=openLink&link="+encodeURIComponent(s)}},get_category:function(e){if(!vchat_state.ready)return void push_Topic("not_ready");let t=domparser.parseFromString(e,"text/html").querySelector("span"),s="vc_unsorted";return t?(this.type_table.find((function(e){if(t.msMatchesSelector(e.matches))return s=e.becomes,!0})),s):s},save_chatlog:function(){var e="",t=this.archived_messages.concat(this.messages),s=this.current_categories;t.forEach((function(t){(0==s.length||s.indexOf(t.category)>=0)&&(e+=t.content,t.repeats>1&&(e+="(x"+t.repeats+")"),e+="
\n")})),e+="";var a=new Date,n=String(a.getHours());n.length<2&&(n="0"+n);var o=String(a.getMinutes());o.length<2&&(o="0"+o);var i=String(a.getDate());i.length<2&&(i="0"+i);var r=String(a.getMonth()+1);r.length<2&&(r="0"+r);var c="log"+(" "+String(a.getFullYear())+"-"+r+"-"+i+" ("+n+" "+o+")")+".html",l=document.createElement("a");if(void 0!==l.download)l.href="data:attachment/text,"+encodeURI(e),l.target="_blank",l.download=c,l.click();else{var h=new Blob([e],{type:"text/html;charset=utf8;"});saved=window.navigator.msSaveOrOpenBlob(h,c)}},do_latency_test:function(){send_latency_check()},blur_this:function(e){e.target.blur()}}})}function check_ping(){Date.now()-vchat_state.lastPingReceived>vchat_opts.msBeforeDropped&&(vueapp.reconnecting=!0)}function send_latency_check(){vchat_state.latency_sent||(vchat_state.latency_sent=Date.now(),vueapp.latency="?",push_Topic("ping"),setTimeout((function(){"?"==vchat_state.latency_ms&&(vchat_state.latency_ms=999)}),1e3),setTimeout((function(){vchat_state.latency_sent=0,vueapp.latency=0}),5e3))}function get_latency_check(){vchat_state.latency_sent&&(vueapp.latency=Date.now()-vchat_state.latency_sent)}function byondDecode(e){e=e.replace(/\+/g,"%20");try{e=decodeURIComponent(e)}catch(t){e=unescape(e)}return JSON.parse(e)}function putmessage(e){e=byondDecode(e),Array.isArray(e)?e.forEach((function(e){vueapp.add_message(e)})):"object"==typeof e&&vueapp.add_message(e)}function system_message(e){vueapp.internal_message(e)}function push_Topic(e){window.location="?_src_=chat&proc="+e}function push_Topic_showingnum(e){window.location="?_src_=chat&showingnum="+e}function focusMapWindow(){window.location="byond://winset?mapwindow.map.focus=true"}function send_debug(e){push_Topic("debug¶m[message]="+encodeURIComponent(e))}function get_event(e){if(vchat_state.ready){var t;switch((t=byondDecode(e)).evttype){case"internal_error":system_message("Event parse error: "+e);break;case"byond_player":send_client_data(),vueapp.is_admin="true"===t.admin,vchat_state.byond_ip=t.address,vchat_state.byond_cid=t.cid,vchat_state.byond_ckey=t.ckey,set_storage("ip",vchat_state.byond_ip),set_storage("cid",vchat_state.byond_cid),set_storage("ckey",vchat_state.byond_ckey);break;case"keepalive":vchat_state.lastPingReceived=Date.now(),vueapp.reconnecting=!1;break;case"pong":get_latency_check();break;case"availability":push_Topic("done_loading");break;default:system_message("Didn't know what to do with event: "+e)}}else push_Topic("not_ready")}function send_client_data(){let e={ip:get_storage("ip"),cid:get_storage("cid"),ckey:get_storage("ckey")};push_Topic("ident¶m[clientdata]="+JSON.stringify(e))}function set_localstorage(e,t){window.localStorage.setItem(vchat_opts.cookiePrefix+e,t)}function get_localstorage(e,t){let s=window.localStorage.getItem(vchat_opts.cookiePrefix+e);return"null"===s||null===s?s=t:"true"===s?s=!0:"false"===s?s=!1:isNaN(s)||(s=+s),s}function set_cookie(e,t){let s=new Date;s.setFullYear(s.getFullYear()+1);let a=s.toUTCString();document.cookie=vchat_opts.cookiePrefix+e+"="+t+";expires="+a+";path=/"}function get_cookie(e,t){let s=document.cookie.split(";"),a={};s.forEach((function(e){let s=e.replace(vchat_opts.cookiePrefix,"").trim(),n=s.search("="),o=decodeURIComponent(s.substring(0,n)),i=decodeURIComponent(s.substring(n+1));"null"==i||null===i?i=t:"true"===i?i=!0:"false"===i?i=!1:isNaN(i)||(i=+i),a[o]=i})),a[e]}var SKIN_BUTTONS=["rpane.textb","rpane.infob","rpane.wikib","rpane.forumb","rpane.rulesb","rpane.github","rpane.discord","rpane.mapb","rpane.changelog","mainwindow.saybutton","mainwindow.mebutton","mainwindow.hotkey_toggle"],SKIN_ELEMENTS=["mainwindow","mainwindow.mainvsplit","mainwindow.tooltip","rpane","rpane.rpanewindow","rpane.mediapanel"];function switch_ui_mode(e){doWinset(SKIN_BUTTONS.reduce((function(t,s){return t[s+".background-color"]=e.buttonBgColor,t}),{})),doWinset(SKIN_BUTTONS.reduce((function(t,s){return t[s+".text-color"]=e.buttonTextColor,t}),{})),doWinset(SKIN_ELEMENTS.reduce((function(t,s){return t[s+".background-color"]=e.windowBgColor,t}),{})),doWinset("infowindow",{"background-color":e.tabBackgroundColor,"text-color":e.tabTextColor}),doWinset("infowindow.info",{"background-color":e.tabBackgroundColor,"text-color":e.tabTextColor,"highlight-color":e.highlightColor,"tab-text-color":e.tabTextColor,"tab-background-color":e.tabBackgroundColor})}function doWinset(e,t){void 0===t&&(t=e,e=null);var s="byond://winset?";e&&(s+="id="+e+"&"),s+=Object.keys(t).map((function(e){return e+"="+encodeURIComponent(t[e])})).join("&"),window.location=s} diff --git a/code/stylesheet.dm b/code/stylesheet.dm index de3cc4e55f..6ef480975c 100644 --- a/code/stylesheet.dm +++ b/code/stylesheet.dm @@ -15,9 +15,9 @@ em {font-style: normal;font-weight: bold;} .log_message {color: #386AFF; font-weight: bold;} /* OOC */ -.ooc {font-weight: bold;} -.looc {color: #3A9696;} -.rlooc {color: #3ABB96;} +.ooc {font-weight: bold;} +.looc {color: #3A9696; font-weight: bold} +.rlooc {color: #3ABB96; font-weight: bold} .ooc img.text_tag {width: 32px; height: 10px;} .ooc .everyone {color: #002eb8;}