// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;
// for load swf
function writeswf2(swfid, swfsrc, noRandom){
document.write(swfLoad2(swfid, swfsrc, noRandom));
}
function swfLoad2(swfid, swfsrc, noRandom)
{
// check whether maxthon
//alert(navigator.appName);
var swfSRC = swfsrc||swfid;
var tail = '';
if (!noRandom)
tail = '?rdm=' + Math.random().toString() + '&from=' + window.location.host;
else
tail = '?' + 1 + '&from=' + window.location.host;
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = DetectFlashVer(6, 0, 65);
// Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
// Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
if ( hasProductInstall && !hasRequestedVersion )
{
// MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
// This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
// DO NOT MODIFY THE FOLLOWING FOUR LINES
// Location visited after installation is complete if installation is required
var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
var MMredirectURL = window.location;
document.title = document.title.slice(0, 47) + " - Flash Player Installation";
var MMdoctitle = document.title;
return AC_FL_RunContent(
"src", "/swf/playerProductInstall" + tail,
"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
"width", "100%",
"height", "100%",
"align", "middle",
"id", swfid,
"quality", "high",
"bgcolor", "#ffffff",
"name", swfid,
"allowScriptAccess","always",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
}
else if (hasRequestedVersion)
{
// if we've detected an acceptable version
// embed the Flash Content SWF when all tests are passed
return AC_FL_RunContent(
"src", 'swf/' + swfSRC + tail,
//"src", swfid,
"width", "100%",
"height", "100%",
"align", "middle",
"id", swfid,
"quality", "high",
"bgcolor", "#ffffff",
"name", swfid,
"wmode", "opaque",
"allowScriptAccess","always",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
}
else
{ // flash is too old or we can't detect the plugin
var alternateContent = '您的浏览器没有安装Flash播放器,请点击' + '这里下载安装';
return alternateContent;
}
}
// for market big trade stock
function znzMarketBigTradeStock(divID, interval, stockType)
{
this.divID = divID;
this.interval = interval;
this.stockType = stockType || 'SH';
this.sNumber = 0;
this.dateTime = "00000000";
this.tradeItems = [];
this.running = true;
this.mTimer = null;
this.inited = false;
this._init();
}
znzMarketBigTradeStock.prototype._init = function()
{
this._update();
this.inited = true;
}
znzMarketBigTradeStock.prototype._update = function()
{
if(this.mTimer)
window.clearTimeout(this.mTimer);
if(this.running)
{
if(!this.inited || inHqTime())
this._refresh();
this.mTimer = window.setTimeout(this._update.bind(this), this.interval);
}
}
znzMarketBigTradeStock.prototype._refresh = function()
{
var args = {
method : 'get', onComplete : function(rep){
var ret = rep;
var retObj = ret.parseJSON();
if( !retObj || retObj.length != 2 || retObj[1].length != 3)
return;
if(retObj[0] != this.dateTime)
{
this.dateTime = retObj[0];
this.tradeItems = [];
}
this.sNumber = retObj[1][1];
this.dataObj = retObj;
this.tradeItems = this.tradeItems.concat(this.dataObj[1][2]);
// limit length to 50
while(this.tradeItems.length > 50)
{
this.tradeItems.shift();
}
this._set();
}.bind(this)
};
var infoURL = 'http://' + rdmDataDomainNameGet()+ '/test/data.py/bigTradeMarket.znzDo?cmd=' + this.stockType.toLowerCase() + '|' + this.dateTime + '|' + this.sNumber + '|' + Math.random().toString();
//alert(infoURL);
var myAjaj = new Ajaj(infoURL, args);
}
// rewrite znzMarketBigTradeStock's _set function
znzMarketBigTradeStock.prototype._set = function()
{
if(this.tradeItems.length < 1)
{
$(this.divID + '-table').style.display = "none";
return;
}
var tableStr = '';
innerSet($(this.divID + '-table'), tableStr, null);
if($(this.divID + '-table').style.display != "block")
{
$(this.divID + '-table').style.display = "block";
}
}
znzMarketBigTradeStock.prototype.stop = function()
{
this.running = false;
if(this.mTimer)
window.clearTimeout(this.mTimer);
}
znzMarketBigTradeStock.prototype.restart = function()
{
this.running = true;
this._update();
}
//for ddz sort
function znzDDZSort(divID, interval, ctrID, data)
{
this.divID = divID;
interval = interval||60000;
if (!(interval < 60000))
interval = 60000;
this.interval = interval;
this.ctrID = ctrID;
this.topOrder = true;
this.dataObj = null;
if(data)
this.data = data.substr(0, data.length -1);
this.inited = false;
this._init();
}
znzDDZSort.prototype._init = function()
{
if(!$(this.ctrID))
return;
$(this.ctrID).onclick = function()
{
if (this.topOrder == true)
{
this.topOrder = false;
$(this.ctrID).innerHTML = '切换至排行前十 ';
$(this.ctrID).className = 'incolor';
}
else
{
this.topOrder = true;
$(this.ctrID).innerHTML = '切换至排行后十 ';
$(this.ctrID).className = 'decolor';
}
window.setTimeout(this._refresh.bind(this), 100);
}.bind(this)
this._update();
this.inited = true;
}
znzDDZSort.prototype._update = function()
{
if(this.data)
{
this._set(this.data);
this.data = null;
}
else
{
if(!this.inited || inHqTime())
this._refresh();
}
window.setTimeout(this._update.bind(this), this.interval);
}
znzDDZSort.prototype._refresh = function()
{
var args = {
method : 'get', onComplete : function(rep)
{
this._set(rep);
}.bind(this)
};
var infoURL;
if(this.topOrder == true)
infoURL = '//' + rdmDataDomainNameGet() + '/test/ddz.py/history_top10.znzDo?cmd=' + Math.random().toString();
else
infoURL = '//' + rdmDataDomainNameGet() + '/test/ddz.py/history_last10.znzDo?cmd='+ Math.random().toString();
var myAjaj = new Ajaj(infoURL, args);
}
znzDDZSort.prototype._set = function(dataStr){
var retObj = dataStr.parseJSON();
if(retObj[0] == -1)
{
$(this.divID).style.display = "none";
return;
}
div = '';
div += '
\n';
div += ' 名 称 | 价 格 | 主力动向 |
'
for(var i=0; i< retObj.length; i++)
{
div += '';
var currValue;
var lastValue;
var stockName;
var stockCode;
var ddzValue;
currValue = retObj[i][4];
lastValue = retObj[i][3];
if (currValue == null || lastValue == null){
return;
}
stockName = decodeURIComponent(retObj[i][2]);
stockCode = retObj[i][0];
ddzValue = retObj[i][1];
var valueColor = 'nocolor';
if (currValue > lastValue)
valueColor = 'incolor';
if (currValue < lastValue)
valueColor = 'decolor';
var ddzColor = 'nocolor';
if (ddzValue > 0)
ddzColor = 'incolor';
if (ddzValue < 0)
ddzColor = 'decolor';
div += ' | ';
div += '' + currValue.toFixed(2).toString() + ' | ';
div += '' + ddzValue.toFixed(2).toString() + ' | ';
div += '
\n';
}
div += '
';
innerSet($(this.divID), div, null);
if($(this.divID).style.display != "block")
$(this.divID).style.display = "block";
}
// for index summary
function znzIdxSummary(divID, interval, data, realDomain, targetType, setFunction, jmpUrl)
{
this.divID = divID;
this.interval = interval;
if(data)
this.data = data.substr(0, data.length -1);
if(realDomain)
this.realDomain = realDomain;
this.targetType = '_self';
if(targetType)
this.targetType = targetType;
this._set = setFunction || this._set;
this.mJumpUrl = jmpUrl || "realstock.php";
this.inited = false;
this._init();
}
znzIdxSummary.prototype._init = function()
{
this._update();
this.inited = true;
}
znzIdxSummary.prototype._update = function()
{
if(this.mTimer)
window.clearTimeout(this.mTimer);
if(this.data)
{
this._set(this.data);
this.data = null;
}
else
{
if(!this.inited || inHqTime())
this._refresh();
}
this.mTimer = window.setTimeout(this._update.bind(this), this.interval);
}
znzIdxSummary.prototype._refresh = function()
{
var args = {
method : 'get', onComplete : function(rep){
this._set(rep);
}.bind(this)
};
infoURL = '//' + rdmDataDomainNameGet()+ '/test/data.py/prices.znzDo?cmd=sh000001,sz399001,sz399006|' + Math.random().toString();
var myAjaj = new Ajaj(infoURL, args);
}
znzIdxSummary.prototype._set = function(dataStr)
{
var retObj = dataStr.parseJSON();
var div = '';
var color = 'nocolor';
if (retObj['sh000001'][2] > retObj['sh000001'][1])
color = 'incolor';
if (retObj['sh000001'][2] < retObj['sh000001'][1])
color = 'decolor';
var urlPrefix = '';
if (this.realDomain)
{
urlPrefix = '//' + this.realDomain + '/stock/';
}
var flag0, flag1, flag2, flag3;
flag0 = flag1 = flag2 = flag3 = "+";
if(retObj['sh000001'][2]-retObj['sh000001'][1] < 0.0)
flag0 = "";
if(retObj['sz399001'][2]-retObj['sz399001'][1] < 0.0)
flag1 = "";
// if(retObj['sz399005'][2]-retObj['sz399005'][1] < 0.0)
// flag2 = "";
if(retObj['sz399006'][2]-retObj['sz399006'][1] < 0.0)
flag3 = "";
if(typeof idxSumIndec == "undefined")
idxSumIndec = "rate";
div += '';
color = 'nocolor';
if (retObj['sz399001'][2] > retObj['sz399001'][1])
color = 'incolor';
if (retObj['sz399001'][2] < retObj['sz399001'][1])
color = 'decolor';
div += '';
/*
color = 'nocolor';
if (retObj['sz399005'][2] > retObj['sz399005'][1])
color = 'incolor';
if (retObj['sz399005'][2] < retObj['sz399005'][1])
color = 'decolor';
div += '';
*/
color = 'nocolor';
if (retObj['sz399006'][2] > retObj['sz399006'][1])
color = 'incolor';
if (retObj['sz399006'][2] < retObj['sz399006'][1])
color = 'decolor';
div += '';
innerSet($(this.divID), div, null);
}
var sug6181Data = {
"61" : "61;68Ash;沪A排名;",
"62" : "62;68Bsh;沪B排名;",
"63" : "63;68Asz;深A排名;",
"64" : "64;68Bsz;深B排名;",
"81" : "81;68A81sh;沪A排名;",
"82" : "82;68B81sh;沪B排名;",
"83" : "83;68A81sz;深A排名;",
"84" : "84;68B81sz;深B排名;"
}
var defaultu = "realstock.php";
// for query
var suggestQuery = function(queryInputId, selectDivId, codeInputId, queryformId, defUrl, defUrlSubFunc, directSubmitFunc, need8161){
this.mCurrLine = -1;
this.mCurrTRs = [];
this.mQueryInput = $(queryInputId);
this.mSelectDiv = $(selectDivId);
this.mTableID = "";
this.mCodeInput = $(codeInputId);
this.mQueryForm = $(queryformId);
this.mDefUrl = defUrl || "realstock.php";
this.mDirectSubmitFunc = directSubmitFunc || null;
this.mDefUrlSubFunc = defUrlSubFunc || null;
this.mNeed8161 = need8161 || true;
this.mOnInput = false;
this.mSelStockType = null;
this.mSelStockCode = null;
this.mSelStockName = null;
this._init();
}
suggestQuery.prototype._init = function()
{
if(!this.mQueryInput)
return;
this.mQueryInput.value = '代码/名称/拼音';
this.mQueryInput.onfocus = function()
{
this.oninput = true;
if(this.mQueryInput.value == '代码/名称/拼音')
this.mQueryInput.value = '';
}.bind(this);
this.mQueryInput.onclick = function()
{
if(this.mQueryInput.value == '代码/名称/拼音')
this.mQueryInput.value = '';
}.bind(this);
this.mQueryInput.onblur = function ()
{
if(this.mQueryInput.value == '')
{
this.mQueryInput.value = '代码/名称/拼音';
this.mSelectDiv.style.display = 'none';
}
this.mOnInput = false;
//
}.bind(this);
this.mQueryInput.onkeyup = function (ev)
{
ev = ev || window.event || null;
if (typeof ev.keyCode != "number")
return;
if(ev.keyCode == 38 || ev.keyCode == 40 ) // key is up or down
{
if (this.mCurrTRs)
{
var newLine = this.mCurrLine;
if(ev.keyCode == 38)
{
if(this.mCurrLine > 0)
newLine = this.mCurrLine - 1;
}
else
{
if(this.mCurrLine < this.mCurrTRs.length -1)
newLine = this.mCurrLine +1;
}
this.selectChange(newLine);
}
}
else
{
var query = this.mQueryInput.value;
if (query.indexOf('代码/名称/拼音')>=0){
query = query.replace('代码/名称/拼音', '');
this.mQueryInput.value = query;
}
query = query.replace(' ', '');
if( query == '')
{
this.mSelectDiv.innerHTML = '';
this.mSelectDiv.style.display = 'none';
return;
}
var args = {
method : 'get', onComplete : this.onSugRecved.bind(this)
};
query = encodeURIComponent(query);
query = '//' + WEB_SERVER + '/pyui/suggestion.py/handler?query=' + query;
var myAjaj = new Ajaj(query, args);
}
}.bind(this);
var that = this;
if(this.mDirectSubmitFunc)
{
this.mQueryForm.onsubmit = function(){
if(that.mSelStockCode)
{
that.mDirectSubmitFunc(that.mSelStockType + that.mSelStockCode, that.mSelStockName);
}
else
{
alert('没有相应的股票存在!');
}
that.mSelectDiv.innerHTML = '';
that.mSelectDiv.style.display = "none";
that.mQueryInput.value = '';
return false;
};
return;
}
else
{
this.mQueryForm.onsubmit = function(){
this.submit();
return false;
};
}
}
suggestQuery.prototype.onSugRecved = function(rep)
{
var ret = decodeURIComponent(rep);
var lines = ret.split('|');
var query = this.mQueryInput.value;
if (this.mNeed8161 && sug6181Data[query]){
lines.unshift(sug6181Data[query]);
}
this.tableid = "select-table-" + Math.random();
var content = ''
for(var i=0; i< lines.length&&i < 10; i++)
{
stocks = lines[i].split(';');
if(stocks.length != 4 )
continue;
content += '';
content += '' + stocks[0] + ' | ' + '' + stocks[1] + ' | ' + '' + stocks[2] + ' | ' + '' + stocks[3] + ' | ';
content += '
';
}
content += '
';
this.mSelectDiv.innerHTML = content;
this.mSelectDiv.style.display = "block";
window.setTimeout(this.selectInit.bind(this), 100);
}
suggestQuery.prototype.selectInit = function()
{
var table = $(this.tableid);
var that = this;
if (table)
{
if (table.childNodes[0])
{
this.mCurrTRs = table.childNodes[0].childNodes;
this.selectChange(0)
for (var i=0; i< this.mCurrTRs.length; i++)
{
this.mCurrTRs[i].onmouseover = function()
{
var j = 0;
for(j =0; j< that.mCurrTRs.length; j ++)
{
if(that.mCurrTRs[j] == this)
break;
}
that.selectChange(j);
}
this.mCurrTRs[i].onclick = function()
{
var j = 0;
for(j =0; j< that.mCurrTRs.length; j ++)
{
if(that.mCurrTRs[j] == this)
break;
}
that.mQueryForm.onsubmit();
}
}
}
}
}
suggestQuery.prototype.selectChange = function(newLine)
{
if (this.mCurrTRs.length <= 0)
{
this.mSelStockType = null;
this.mSelStockCode = null;
this.mSelStockName = null;
return false;
}
if (this.mCurrLine < 0 || this.mCurrLine > this.mCurrTRs.length -1)
this.mCurrLine = 0;
this.mCurrTRs[this.mCurrLine].className = "realstock-query-select-unselected";
this.mCurrTRs[newLine].className = "realstock-query-select-selected";
this.mCurrLine = newLine;
// set input values
var tds = this.mCurrTRs[this.mCurrLine].childNodes;
var stype = tds[1].innerHTML;
var code = tds[0].innerHTML;
this.mSelStockType = stype;
this.mSelStockCode = code;
this.mSelStockName = tds[2].innerHTML;
this.mCodeInput.name = 'code';
var nowaction = this.mQueryForm.action.toString();
if (nowaction.lastIndexOf("/") > 0){
nowaction = nowaction.substring(0, nowaction.lastIndexOf("/")+1);
}else{
nowaction = "";
}
if(stype == 'SH'){
this.mQueryForm.action = nowaction + defaultu;
this.mCodeInput.value = 'sh' + tds[0].innerHTML;
}else{
if(stype == 'SZ'){
this.mQueryForm.action = nowaction + defaultu;
this.mCodeInput.value = 'sz' + tds[0].innerHTML;
}else{
this.mQueryForm.action = nowaction + "newsort.php";
this.mCodeInput.name = 'boardNo';
this.mCodeInput.value = '' + tds[0].innerHTML;
if(stype == 'IH'){
this.mCodeInput.value = 'SHHQ' + tds[0].innerHTML;
}
if(stype == 'IZ'){
this.mCodeInput.value = 'SZHQ' + tds[0].innerHTML;
}
if(stype.indexOf('68') == 0){
this.mCodeInput.name = 'markettype';
this.mCodeInput.value = tds[1].innerHTML.toString().substring(2);
}
if(this.mDefUrlSubFunc)
{
this.mQueryForm.onsubmit = function(){
that.mDefUrlSubFunc(stype);
return false;
};
}
}
}
}
var znzIdxSort = function(keys, count, interval, data){
this.interval = interval;
this.count = count;
this.keys = keys;
if(data)
this.data = data.substr(0, data.length -1);
this.inited = false;
this._init();
}
znzIdxSort.prototype._init = function()
{
this._update();
this.inited = true;
}
znzIdxSort.prototype._update = function()
{
if(this.data)
{
this._set(this.data);
this.data = null;
}
else
{
if(!this.inited || inHqTime())
this._refresh();
}
window.setTimeout(this._update.bind(this), this.interval);
}
znzIdxSort.prototype._refresh = function(){
var args = {
method : 'get', onComplete : function(rep){
this._set(rep);
}.bind(this)
};
var infoURL = '//'+rdmDataDomainNameGet()+'/test/sort2.py/sortCover.znzDo?cmd=' + Math.random().toString();
var myAjaj = new Ajaj(infoURL, args);
}
$old_znzIdxSort_set = znzIdxSort.prototype._setDiv;
znzIdxSort.prototype._setDiv = function(up, retList){
var divText = "涨跌幅";
var div = ""
else
div += "'>";
div += '
';
div += '排名 | 名 称 | 价 格 | ';
div += divText+" |
\n";
while (retList.length > this.count)
retList.pop();
for (var i = 0; i < retList.length; i++){
div += "";
div += " | ";
var stockcode = retList[i][0].toLowerCase().replace("hq","");
div += " | ";
var classN = "";
if (retList[i][2] < retList[i][3])
classN = "incolor";
if (retList[i][2] > retList[i][3])
classN = "decolor";
div += ""+parseFloat(retList[i][3]).toFixed(retList[i][5]?3:2)+" | ";
classN = "";
if (retList[i][4] > 0)
classN = "incolor";
if (retList[i][4] < 0)
classN = "decolor";
retList[i][4] = retList[i][4].toFixed(2) + "%";
div += "" + ( retList[i][4] ) + " | ";
div += "
";
}
div += "
";
div += "
";
return div;
}
znzIdxSort.prototype._set = function(rep){
var retObj = rep.parseJSON();
var divStr = "";
if (retObj["sz"]){
var retHash = retObj["sz"];
divStr = this._setDiv("inc", retHash["ratio_inc"]);
divStr += this._setDiv("dec", retHash["ratio_dec"]);
innerSet($("sz_a_inc_dec_table"), divStr, null);
}
if (retObj["sh"]){
var retHash = retObj["sh"];
divStr = this._setDiv("inc", retHash["ratio_inc"]);
divStr += this._setDiv("dec", retHash["ratio_dec"]);
innerSet($("sh_a_inc_dec_table"), divStr, null);
}
}