mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
[ready]Makes bIcon better (#29690)
Goonchat will use the asset cache, you now have to specify who to send the icons too. Goonchat will now load icons in the background, displaying them once they load. this prevents the message from being delayed while the icons are sent. Icons that aren't preloaded using the asset cache system will not render on ie8 clients. This is because of a ie8 bug that prevents changes on runtime created images from rendering.
This commit is contained in:
committed by
oranges
parent
d7da0b0de4
commit
f2cf4c2f5c
@@ -29,6 +29,8 @@ var opts = {
|
||||
'messageLimit': 2053, //A limit...for the messages...
|
||||
'scrollSnapTolerance': 10, //If within x pixels of bottom
|
||||
'clickTolerance': 10, //Keep focus if outside x pixels of mousedown position on mouseup
|
||||
'imageRetryDelay': 50, //how long between attempts to reload images (in ms)
|
||||
'imageRetryLimit': 50, //how many attempts should we make?
|
||||
'popups': 0, //Amount of popups opened ever
|
||||
'wasd': false, //Is the user in wasd mode?
|
||||
'chatMode': 'default', //The mode the chat is in
|
||||
@@ -146,6 +148,23 @@ function highlightTerms(el) {
|
||||
el.innerHTML = newText;
|
||||
}
|
||||
}
|
||||
|
||||
function iconError(E) {
|
||||
var that = this;
|
||||
setTimeout(function() {
|
||||
var attempts = $(that).data('reload_attempts');
|
||||
if (typeof attempts === 'undefined' || !attempts) {
|
||||
attempts = 1;
|
||||
}
|
||||
if (attempts > opts.imageRetryLimit)
|
||||
return;
|
||||
var src = that.src;
|
||||
that.src = null;
|
||||
that.src = src+'#'+attempts;
|
||||
$(that).data('reload_attempts', ++attempts);
|
||||
}, opts.imageRetryDelay);
|
||||
}
|
||||
|
||||
//Send a message to the client
|
||||
function output(message, flag) {
|
||||
if (typeof message === 'undefined') {
|
||||
@@ -271,7 +290,7 @@ function output(message, flag) {
|
||||
|
||||
entry.innerHTML = message.trim();
|
||||
$messages[0].appendChild(entry);
|
||||
|
||||
$(entry).find("img.icon").error(iconError);
|
||||
//Actually do the snap
|
||||
if (!filteredOut && atBottom) {
|
||||
$('body,html').scrollTop($messages.outerHeight());
|
||||
@@ -861,7 +880,11 @@ $(function() {
|
||||
$messages.empty();
|
||||
opts.messageCount = 0;
|
||||
});
|
||||
|
||||
|
||||
$('img.icon').error(iconError);
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user