Shift pad initialization into JavaScript.

This commit is contained in:
Chad Weider 2012-01-26 21:10:41 -08:00
parent 3e9b56aa75
commit cd86ef5600
2 changed files with 24 additions and 14 deletions

View File

@ -37,19 +37,6 @@ var padsavedrevs = require('/pad_savedrevs').padsavedrevs;
var paduserlist = require('/pad_userlist').paduserlist; var paduserlist = require('/pad_userlist').paduserlist;
var padutils = require('/pad_utils').padutils; var padutils = require('/pad_utils').padutils;
$(document).ready(function()
{
//start the costum js
if(typeof costumStart == "function") costumStart();
getParams();
handshake();
});
$(window).unload(function()
{
pad.dispose();
});
function createCookie(name, value, days, path) function createCookie(name, value, days, path)
{ {
if (days) if (days)
@ -301,7 +288,7 @@ function handshake()
clientVars.collab_client_vars.clientAgent = "Anonymous"; clientVars.collab_client_vars.clientAgent = "Anonymous";
//initalize the pad //initalize the pad
pad.init(); pad._afterHandshake();
initalized = true; initalized = true;
// If the LineNumbersDisabled value is set to true then we need to hide the Line Numbers // If the LineNumbersDisabled value is set to true then we need to hide the Line Numbers
@ -413,6 +400,21 @@ var pad = {
}, },
init: function() init: function()
{
$(document).ready(function()
{
//start the costum js
if(typeof costumStart == "function") costumStart();
getParams();
handshake();
});
$(window).unload(function()
{
pad.dispose();
});
},
_afterHandshake: function()
{ {
pad.clientTimeOffset = new Date().getTime() - clientVars.serverTimestamp; pad.clientTimeOffset = new Date().getTime() - clientVars.serverTimestamp;
@ -973,6 +975,9 @@ var alertBar = (function()
return self; return self;
}()); }());
function init() {
return pad.init();
}
var settings = { var settings = {
LineNumbersDisabled: false LineNumbersDisabled: false
@ -994,4 +999,5 @@ exports.getUrlVars = getUrlVars;
exports.savePassword = savePassword; exports.savePassword = savePassword;
exports.handshake = handshake; exports.handshake = handshake;
exports.pad = pad; exports.pad = pad;
exports.init = init;
exports.alertBar = alertBar; exports.alertBar = alertBar;

View File

@ -302,6 +302,10 @@
chat = require('/chat').chat; chat = require('/chat').chat;
padeditbar = require('/pad_editbar').padeditbar; padeditbar = require('/pad_editbar').padeditbar;
padimpexp = require('/pad_impexp').padimpexp; padimpexp = require('/pad_impexp').padimpexp;
(function () {
require('/pad').init();
}());
</script> </script>
</html> </html>