var remote; function checkId() { task = setTimeout("checkId()", 2000); remote.getUser(siqur_hash, function(data){ if (data != null) { switch (data["action"]) { case "login": { clearTimeout(task); login(data["params"]["user_name"],data["params"]["token"]); break; } case "logout": { clearTimeout(task); logout(); break; } } } } ); } jQuery(document).ready(function() { var host = 'accounts.dev.safetivity.com'; if(typeof(safetivity_app) != "undefined") { host = safetivity_app + '.' + host; } /** * When the window is finished loading start setting up the channel */ remote = new easyXDM.Interface(/** The channel configuration */{ /** * Register the url to hash.html, this must be an absolute path * or a path relative to the root. * @field */ local: "./hash.html", /** * Register the url to the remote interface * @field */ remote: "http://"+host+"/mini-login?token="+siqur_hash, /** * Register the DOMElement that the generated IFrame should be inserted into */ container: document.getElementById("login") }, /** The interface configuration */ { remote: { getUser: {} } },/**The onReady handler*/ function(){ checkId(); }); });