var NG_DOMAIN_IMAGE = 'http://image.netgame.com'; var NG_DOMAIN_IMG = 'http://img.netgame.com'; var NG_DOMAIN_WWW = 'http://www.netgame.com'; var NG_DOMAIN_LOGIN = 'http://login.netgame.com'; var NG_DOMAIN_MEMBER = 'http://member.netgame.com'; var NG_DOMAIN_PROFILE = 'http://profile.netgame.com'; var NG_DOMAIN_FATE = 'http://fate.netgame.com'; var NG_DOMAIN_OP7 = 'http://op7.netgame.com'; var NG_DOMAIN_HERO = 'http://hero.netgame.com'; function file_get_contents( url ) { // % note 1: This function uses XmlHttpRequest and cannot retrieve resource from different domain. // * example 1: file_get_contents('http://kevin.vanzonneveld.net/pj_test_supportfile_1.htm'); // * returns 1: '123' var req = null; try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { try { req = new XMLHttpRequest(); } catch(e) {} } } if (req == null) throw new Error('XMLHttpRequest not supported'); req.open("GET", url, false); req.send(null); return req.responseText; } function require( filename ) { // % note 1: Force Javascript execution to pause until the file is loaded. Usually causes failure if the file never loads. ( Use sparingly! ) // - depends on: file_get_contents // * example 1: require('/pj_test_supportfile_2.js'); // * returns 1: 2 var js_code = file_get_contents(filename); var script_block = document.createElement('script'); script_block.type = 'text/javascript'; var client_pc = navigator.userAgent.toLowerCase(); if((client_pc.indexOf("msie") != -1) && (client_pc.indexOf("opera") == -1)) { script_block.text = js_code; } else { script_block.appendChild(document.createTextNode(js_code)); } if(typeof(script_block) != "undefined") { document.getElementsByTagName("head")[0].appendChild(script_block); // save include state for reference by include_once and require_once() var cur_file = {}; cur_file[window.location.href] = 1; if (!window.php_js) window.php_js = {}; if (!window.php_js.includes) window.php_js.includes = cur_file; if (!window.php_js.includes[filename]) { window.php_js.includes[filename] = 1; } else { // Use += 1 because ++ waits until AFTER the original value is returned to increment the value. return window.php_js.includes[filename] += 1; } } } function require_once(filename) { // - depends on: require // * example 1: require_once('/pj_test_supportfile_2.js'); // * returns 1: true var cur_file = {}; cur_file[window.location.href] = 1; // save include state for reference by include_once and require_once() if (!window.php_js) window.php_js = {}; if (!window.php_js.includes) window.php_js.includes = cur_file; if (!window.php_js.includes[filename]) { if(require(filename)){ return true; } } else { return true; } }