mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 04:26:03 +01:00
Fixed issue with links/buttons not working until first update.
This commit is contained in:
@@ -185,13 +185,11 @@
|
||||
/datum/nanoui/Topic(href, href_list)
|
||||
update_status(0) // update the status
|
||||
if (status != STATUS_INTERACTIVE || user != usr) // If UI is not interactive or usr calling Topic is not the UI user
|
||||
//usr << "Not interaction or wrong usr"
|
||||
return
|
||||
|
||||
if (src_object.Topic(href, href_list))
|
||||
usr << "Update after Topic"
|
||||
nanomanager.update_uis(src_object) // update all UIs attached to src_object
|
||||
else
|
||||
usr << "Don't update after Topic"
|
||||
|
||||
/datum/nanoui/proc/get_footer()
|
||||
var/scriptsContent = ""
|
||||
|
||||
+45
-43
@@ -13,6 +13,49 @@ NanoUpdate = function ()
|
||||
|
||||
var init = function ()
|
||||
{
|
||||
NanoUpdate.addAfterUpdateCallback(function (updateData) {
|
||||
var uiStatusClass;
|
||||
if (updateData['ui']['status'] == 2)
|
||||
{
|
||||
uiStatusClass = 'icon24 uiStatusGood';
|
||||
$('.linkActive').removeClass('inactive');
|
||||
}
|
||||
else if (updateData['ui']['status'] == 1)
|
||||
{
|
||||
uiStatusClass = 'icon24 uiStatusAverage';
|
||||
$('.linkActive').addClass('inactive');
|
||||
}
|
||||
else
|
||||
{
|
||||
uiStatusClass = 'icon24 uiStatusBad'
|
||||
$('.linkActive').addClass('inactive');
|
||||
}
|
||||
$('#uiStatusIcon').attr('class', uiStatusClass);
|
||||
|
||||
$('.linkActive').stopTime('linkPending');
|
||||
$('.linkActive').removeClass('linkPending');
|
||||
|
||||
$('.linkActive').off('click');
|
||||
$('.linkActive').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var href = $(this).data('href');
|
||||
if (href != null && _canClick)
|
||||
{
|
||||
_canClick = false;
|
||||
$('body').oneTime(300, 'enableClick', function () {
|
||||
_canClick = true;
|
||||
});
|
||||
if (updateData['ui']['status'] == 2)
|
||||
{
|
||||
$(this).oneTime(300, 'linkPending', function () {
|
||||
$(this).addClass('linkPending');
|
||||
});
|
||||
}
|
||||
window.location.href = href;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var body = $('body'); // We store data in the body tag, it's as good a place as any
|
||||
|
||||
_data = body.data('initialData');
|
||||
@@ -57,6 +100,8 @@ NanoUpdate = function ()
|
||||
{
|
||||
observedDataUpdateRecursive(_earlyUpdateData, _data);
|
||||
}
|
||||
|
||||
executeCallbacks(_afterUpdateCallbacks, _data);
|
||||
|
||||
//alert($("#mainTemplate").html());
|
||||
}
|
||||
@@ -68,49 +113,6 @@ NanoUpdate = function ()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
NanoUpdate.addAfterUpdateCallback(function (updateData) {
|
||||
var uiStatusClass;
|
||||
if (updateData['ui']['status'] == 2)
|
||||
{
|
||||
uiStatusClass = 'icon24 uiStatusGood';
|
||||
$('.linkActive').removeClass('inactive');
|
||||
}
|
||||
else if (updateData['ui']['status'] == 1)
|
||||
{
|
||||
uiStatusClass = 'icon24 uiStatusAverage';
|
||||
$('.linkActive').addClass('inactive');
|
||||
}
|
||||
else
|
||||
{
|
||||
uiStatusClass = 'icon24 uiStatusBad'
|
||||
$('.linkActive').addClass('inactive');
|
||||
}
|
||||
$('#uiStatusIcon').attr('class', uiStatusClass);
|
||||
|
||||
$('.linkActive').stopTime('linkPending');
|
||||
$('.linkActive').removeClass('linkPending');
|
||||
|
||||
$('.linkActive').off('click');
|
||||
$('.linkActive').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var href = $(this).data('href');
|
||||
if (href != null && _canClick)
|
||||
{
|
||||
_canClick = false;
|
||||
$('body').oneTime(300, 'enableClick', function () {
|
||||
_canClick = true;
|
||||
});
|
||||
if (updateData['ui']['status'] == 2)
|
||||
{
|
||||
$(this).oneTime(300, 'linkPending', function () {
|
||||
$(this).addClass('linkPending');
|
||||
});
|
||||
}
|
||||
window.location.href = href;
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// Receive update data from the server
|
||||
|
||||
Reference in New Issue
Block a user