Merge pull request #13637 from ItsSelis/vchat-qol1

[VChat QoL] Minifies JS & Updates Vue
This commit is contained in:
Casey
2022-09-18 09:31:57 +00:00
committed by CHOMPStation2
parent dbf648d4c0
commit 6e67879063
7 changed files with 34 additions and 11992 deletions
+6 -6
View File
@@ -11,9 +11,9 @@
<link rel="stylesheet" type="text/css" href="ss13styles.css" />
<!-- Important scripts -->
<script type="text/javascript" src="polyfills.js"></script>
<script type="text/javascript" src="polyfills.min.js"></script>
<script type="text/javascript" src="vue.min.js"></script>
<script type="text/javascript" src="vchat.js"></script>
<script type="text/javascript" src="vchat.min.js"></script>
</head>
<body>
@@ -32,7 +32,7 @@
<i v-show="editing && !tab.immutable && index != tabs.length-1" class="icon-right-open-outline" @click.stop.prevent="movetab(tab,1)" title="Move tab right"></i>
<div v-if="tab_unread_count(tab) > 0" class="ui top right attached red label">{{tab_unread_count(tab)}}</div>
</div>
<div class="right menu">
<div class="item" @click="newtab" title="New Tab"><i class="icon-folder-add"></i></div>
<div class="item" @click="pause" title="Pause Autoscroll">
@@ -49,9 +49,9 @@
</span>
</div>
</div>
</div>
<!-- Editor box -->
<div id="contentbox">
<div v-show="editing" id="editbox" class="ui segment" :class="{ inverted: inverted }">
@@ -175,7 +175,7 @@
shown_messages.length: {{shown_messages.length}}<br>
</div>
-->
</div>
+1
View File
@@ -0,0 +1 @@
function storageAvailable(e){var t;try{t=window[e];var r="__storage_test__";return t.setItem(r,r),t.removeItem(r),!0}catch(e){return e instanceof DOMException&&(22===e.code||1014===e.code||"QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)&&t&&0!==t.length}}Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw TypeError('"this" is null or not defined');var t=Object(this),r=t.length>>>0;if("function"!=typeof e)throw TypeError("predicate must be a function");for(var n=arguments[1],o=0;o<r;){var a=t[o];if(e.call(n,a,o,t))return a;o++}},configurable:!0,writable:!0}),Date.now||(Date.now=function(){return(new Date).getTime()});
+16 -16
View File
@@ -95,7 +95,7 @@ function start_vchat() {
doWinset("htmloutput", {"is-visible": true});
doWinset("oldoutput", {"is-visible": false});
doWinset("chatloadlabel", {"is-visible": false});
//Commence the pingening
setInterval(check_ping, vchat_opts.msBeforeDropped);
@@ -316,7 +316,7 @@ function start_vue() {
document.body.classList.remove("inverted");
switch_ui_mode(LIGHTMODE_COLORS);
}
},
},
crushing: function (newSetting) {
set_storage("crushing",newSetting);
},
@@ -352,7 +352,7 @@ function start_vue() {
this.showingnum = oldSetting;
return;
}
newSetting = Math.floor(newSetting);
if(newSetting < 50) {
this.showingnum = 50;
@@ -383,7 +383,7 @@ function start_vue() {
ping_classes: function() {
if(!this.latency) {
return this.reconnecting ? "red" : "green"; //Standard
}
}
if (this.latency == "?") { return "grey"; } //Waiting for latency test reply
else if(this.latency < 0 ) {return "red"; }
@@ -442,9 +442,9 @@ function start_vue() {
this.tabs.forEach(function(tab){
if(tab.immutable)
return;
var name = tab.name;
var categories = [];
tab.categories.forEach(function(category){categories.push(category);});
@@ -645,7 +645,7 @@ function start_vue() {
event.preventDefault ? event.preventDefault() : (event.returnValue = false); //The second one is the weird IE method.
var href = ele.getAttribute('href'); // Gets actual href without transformation into fully qualified URL
if (href[0] == '?' || (href.length >= 8 && href.substring(0,8) == "byond://")) {
window.location = href; //Internal byond link
} else { //It's an external link
@@ -676,7 +676,7 @@ function start_vue() {
},
save_chatlog: function() {
var textToSave = "<html><head><style>"+this.ext_styles+"</style></head><body>";
var messagesToSave = this.archived_messages.concat(this.messages);
messagesToSave.forEach( function(message) {
@@ -751,7 +751,7 @@ function check_ping() {
function send_latency_check() {
if(vchat_state.latency_sent)
return;
vchat_state.latency_sent = Date.now();
vueapp.latency = "?";
push_Topic("ping");
@@ -776,10 +776,10 @@ function get_latency_check() {
//We accept double-url-encoded JSON strings because Byond is garbage and UTF-8 encoded url_encode() text has crazy garbage in it.
function byondDecode(message) {
//Byond encodes spaces as pluses?! This is 1998 I guess.
message = message.replace(/\+/g, "%20");
try {
try {
message = decodeURIComponent(message);
} catch (err) {
message = unescape(message);
@@ -839,7 +839,7 @@ function get_event(event) {
case 'internal_error':
system_message("Event parse error: " + event);
break;
//They provided byond data.
case 'byond_player':
send_client_data();
@@ -867,8 +867,8 @@ function get_event(event) {
case 'availability':
push_Topic("done_loading");
break;
default:
default:
system_message("Didn't know what to do with event: " + event);
}
}
@@ -892,7 +892,7 @@ function set_localstorage(key, value) {
function get_localstorage(key, deffo) {
let localstorage = window.localStorage;
let value = localstorage.getItem(vchat_opts.cookiePrefix+key);
//localstorage only stores strings.
if(value === "null" || value === null) {
value = deffo;
@@ -944,7 +944,7 @@ function get_cookie(key, deffo) {
var SKIN_BUTTONS = [
/* Rpane */ "rpane.textb", "rpane.infob", "rpane.wikib", "rpane.forumb", "rpane.rulesb", "rpane.github", "rpane.discord", "rpane.mapb", "rpane.changelog",
/* Mainwindow */ "mainwindow.saybutton", "mainwindow.mebutton", "mainwindow.hotkey_toggle"
];
// Windows or controls that need background-color set.
var SKIN_ELEMENTS = [
File diff suppressed because one or more lines are too long
+8 -11962
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -5,9 +5,9 @@ GLOBAL_LIST_INIT(vchatFiles, list(
"code/modules/vchat/css/vchat-font-embedded.css",
"code/modules/vchat/css/semantic.min.css",
"code/modules/vchat/css/ss13styles.css",
"code/modules/vchat/js/polyfills.js",
"code/modules/vchat/js/polyfills.min.js",
"code/modules/vchat/js/vue.min.js",
"code/modules/vchat/js/vchat.js"
"code/modules/vchat/js/vchat.min.js"
))
// The to_chat() macro calls this proc