From: Hendrik B. <nh...@us...> - 2014-11-25 21:45:02
|
Update of /cvsroot/arianne/stendhal/srcjs/stendhal In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv24639/srcjs/stendhal Modified Files: main.js Log Message: cleaned up main.js and removed body-onload Index: main.js =================================================================== RCS file: /cvsroot/arianne/stendhal/srcjs/stendhal/main.js,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** main.js 24 Nov 2014 23:00:18 -0000 1.1 --- main.js 25 Nov 2014 21:44:58 -0000 1.2 *************** *** 1,48 **** ! marauroa.clientFramework.onDisconnect = function(reason, error){ ! stendhal.ui.chatLog.addLine("error", "Disconnected: " + error); ! } ! ! marauroa.clientFramework.onLoginRequired = function() { ! window.location = "/index.php?id=content/account/login&url=" ! + escape(window.location.pathname + window.location.hash); ! } ! marauroa.clientFramework.onLoginFailed = function(reason, text) { ! alert("Login failed. Please login on the Stendhal website first and make sure you open the client on an https://-URL"); ! marauroa.clientFramework.close(); ! document.getElementById("chatbar").disabled = true; ! document.getElementById("chat").style.backgroundColor = "#AAA"; ! } ! marauroa.clientFramework.onAvailableCharacterDetails = function(characters) { ! if (window.location.hash) { ! marauroa.clientFramework.chooseCharacter(window.location.hash.substring(1)); ! } else { ! marauroa.clientFramework.chooseCharacter(marauroa.util.first(characters).a.name); } ! var body = document.getElementById("body") ! body.style.cursor = "auto"; ! stendhal.ui.chatLog.addLine("client", "Loading world..."); ! } ! marauroa.clientFramework.onTransferREQ = function(items) { ! for (var i in items) { ! if (typeof(items[i].name) != "undefined" && items[i].name.match(".collision$")) { ! items[i].ack = true; } } ! } ! document.onkeydown=stendhal.ui.chatBar.keydown; ! document.onkeyup=stendhal.ui.chatBar.keyup; ! function stendhalStartClient() { ! stendhal.ui.chatLog.addLine("client", "Client loaded. Connecting..."); ! var body = document.getElementById("body") ! body.style.cursor = "wait"; ! marauroa.clientFramework.connect(null, null); ! } \ No newline at end of file --- 1,73 ---- + /*************************************************************************** + * (C) Copyright 2003-2014 - Stendhal * + *************************************************************************** + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ ! "use strict"; ! window.stendhal = window.stendhal || {}; ! stendhal.main = { ! registerMarauroaEventHandlers: function() { ! marauroa.clientFramework.onDisconnect = function(reason, error){ ! stendhal.ui.chatLog.addLine("error", "Disconnected: " + error); ! } ! ! marauroa.clientFramework.onLoginRequired = function() { ! window.location = "/index.php?id=content/account/login&url=" ! + escape(window.location.pathname + window.location.hash); } ! marauroa.clientFramework.onLoginFailed = function(reason, text) { ! alert("Login failed. Please login on the Stendhal website first and make sure you open the client on an https://-URL"); ! marauroa.clientFramework.close(); ! document.getElementById("chatbar").disabled = true; ! document.getElementById("chat").style.backgroundColor = "#AAA"; ! } ! ! marauroa.clientFramework.onAvailableCharacterDetails = function(characters) { ! if (window.location.hash) { ! marauroa.clientFramework.chooseCharacter(window.location.hash.substring(1)); ! } else { ! marauroa.clientFramework.chooseCharacter(marauroa.util.first(characters).a.name); ! } ! ! var body = document.getElementById("body") ! body.style.cursor = "auto"; ! stendhal.ui.chatLog.addLine("client", "Loading world..."); ! } ! marauroa.clientFramework.onTransferREQ = function(items) { ! for (var i in items) { ! if (typeof(items[i].name) != "undefined" && items[i].name.match(".collision$")) { ! items[i].ack = true; ! } } } ! }, ! ! registerBrowserEventHandlers: function() { ! document.onkeydown=stendhal.ui.chatBar.keydown; ! document.onkeyup=stendhal.ui.chatBar.keyup; ! }, ! startup: function() { ! stendhal.ui.chatLog.addLine("client", "Client loaded. Connecting..."); ! var body = document.getElementById("body") ! body.style.cursor = "wait"; + stendhal.main.registerMarauroaEventHandlers(); + stendhal.main.registerBrowserEventHandlers(); + marauroa.clientFramework.connect(null, null); + } + } ! document.addEventListener('DOMContentLoaded', stendhal.main.startup); \ No newline at end of file |