; var FFXI_Shout = {}; FFXI_Shout.init = function () { this.inited = 0; this.latest = 0; this.zones = { '243': 'RuLudeGard', '244': 'UpJeuno', '245': 'LowJeuno', '246': 'PortJeuno', '256': 'WestAdoulin', '257': 'EastAduolin' }; this.secs_since_update = 0; this.timer = setInterval(function () { FFXI_Shout.countUp(); }, 1000); FFXI_Shout.render(Shouts['shouts']); }; FFXI_Shout.render = function (data) { data = data.reverse(); $("div", "#shout-wrapper").removeClass("shout-new"); var tmp = FFXI_Shout.latest; for (var i = 0; i < data.length; i++) { if (i >= 25) break; if (FFXI_Shout.latest < data[i].timestamp) { FFXI_Shout.addRow(data[i]); tmp = data[i].timestamp; } } if (!FFXI_Shout.inited) { FFXI_Shout.inited = 1; } $("#shout-wrapper > div").unbind('mouseenter') .mouseenter(function () { $(this).css('backgroundColor', '#325'); }).mouseleave(function () { $(this).css('backgroundColor', ''); }); FFXI_Shout.latest = tmp; FFXI_Shout.resetCounter(); }; FFXI_Shout.countUp = function () { this.secs_since_update++; $("#shouts-last-updated").html(this.secs_since_update); if (this.secs_since_update > 120) { location.reload(); } }; FFXI_Shout.resetCounter = function () { this.secs_since_update = 0; $("#shouts-last-updated").html(0); }; FFXI_Shout.addRow = function (row) { var d = new Date(); d.setTime(row.timestamp); var cnew = (this.inited) ? "style='display:none;' class=shout-new" : ""; var ret = "
"; ret += "" + this.zones[row.zone] + ""; ret += "
["; ret += d.format("H:i:s"); ret += "] "; ret += FFXI.playerLink(Site.server, row.character); ret += " : "; ret += row.message; ret += "
"; ret += "
"; $("#shout-wrapper").append(ret); if (this.inited) { $("#shout-wrapper > div:first-child").remove(); $("#" + row.timestamp).fadeIn(); } }; $(function () { $("#hide").click(function () { $('#gw-iframe').remove(); var flags = Core.getCookie('flags'); if (!flags) { flags = 0; } console.log(Core.setBit(flags, 0x1)); Core.setCookie('flags', Core.setBit(flags, 0x1)); }); FFXI_Shout.init(); Stream.addHandler('shouts', FFXI_Shout.render); Stream.connect(); });