我明白了,你机器上没装silverlight。
它正常的图,左边是个silverlight,右边是广告。
- 图像 001.jpg (337.77 KiB) Viewed 13508 times
JS代码:
Code: Select all
function onBodyLoad() {
if (Silverlight.isInstalled("3.0")) {
chartCSSId = 'SilverlightControl1';
document.getElementById(chartCSSId).style.display = "block";
} else {
document.getElementById('noSilverlightDiv').style.display = "block";
document.getElementById('SilverlightControl1').style.display = "none";
}
// setInterval('postOnlineCount()', 5000);
// setInterval('P()', 600000);
}
function postOnlineCount() {
onlineCounter += 1;
ControlFrame("/SymbolHit.aspx?onlineCount=" + onlineCounter);
}
function FocusChart() {
try {
document.getElementById(chartCSSId).focus();
} catch (err) {
}
}
function onSymbolChange(symbol) {
// alert(symbol);
// parent.frames[2].location = "/SymbolHit.aspx?sym=" + symbol;
ControlFrame("/SymbolHit.aspx?sym=" + symbol);
// document.getElementById('symbolTrack').src = ;
}
function URLEncode(clearString) {
var output = '';
var x = 0;
clearString = clearString.toString();
var regex = /(^[a-zA-Z0-9_.]*)/;
while (x < clearString.length) {
var match = regex.exec(clearString.substr(x));
if (match != null && match.length > 1 && match[1] != '') {
output += match[1];
x += match[1].length;
} else {
if (clearString[x] == ' ')
output += '+';
else {
var charCode = clearString.charCodeAt(x);
var hexVal = charCode.toString(16);
output += '%' + (hexVal.length < 2 ? '0' : '') + hexVal.toUpperCase();
}
x++;
}
}
return output;
}
function makeTinyURLChart(guid) {
// return "http://fsc.bz/1";
var url = 'http://www.freestockcharts.com/tweets/?chart=' + guid;
url = URLEncode(url)
$.get('/Tweets/createchart.aspx?url=' + url, null,
function (data, textStatus) {
SendTinyURL(data);
});
}
function AuthenticateTwitter(webUserID) {
$.get('/Tweets/TwitterAjax.aspx?isAuth=' + webUserID, null,
function (data, textStatus) {
if ((data != null) && (data != "F")) {
var user = eval(data);
// alert(user.screen);
isAuthenticated(true, user.screen, user.img);
} else {
isAuthenticated(false, null, null);
}
});
}
function RevokeTwitter(id) {
$.get('/Tweets/TwitterAjax.aspx?revoke=' + id, null,
function (data, textStatus) {
if ((data != null) && (data != "T")) {
isRevoked(true);
} else {
isRevoked(false);
}
});
}
function SendTinyURL(url) {
var chart = document.getElementById(chartCSSId);
if (chart != null) {
try {
chart.Content.bfcAppScript.SendTinyURL(url);
} catch (e) {
}
}
}
function isRevoked(bool) {
var chart = document.getElementById(chartCSSId);
if (chart != null) {
try {
chart.Content.bfcAppScript.TwitterRevoked(bool);
} catch (e) {
}
}
}
function TweetSent() {
var chart = document.getElementById(chartCSSId);
if (chart != null) {
try {
chart.Content.bfcAppScript.TweetSent(true);
} catch (e) {
}
}
}
function isAuthenticated(bool, screen, img) {
var chart = document.getElementById(chartCSSId);
if (chart != null) {
try {
chart.Content.bfcAppScript.isTwitterAuthenticated(bool, screen, img);
} catch (e) {
}
}
}
function SendTwit(webUserID, aMessage) {
aMessage = URLEncode(aMessage)
$.get('/Tweets/TwitterAjax.aspx?wuid=' + webUserID + "&tweet=" + aMessage, null,
function (data, textStatus) {
TweetSent();
});
return true;
}
function onConversionSuccess() {
// parent.frames[2].location = "/Conversion.aspx";
ControlFrame("/Conversion.aspx");
// document.getElementById('symbolTrack').src = "/Conversion.aspx";
}
var bActivity = true;
var passiveCounter = 0;
function onActivity() {
if (bActivity == false) {
try {
// alert('activity!');
bActivity = true;
setTimeout("doNewAd()", 60000);
}
catch (ex) { }
}
}
function changeAd(location) {
bActivity = false;
bPendingAd = false;
// parent.frames[1].location = location;
// document.getElementById('adFrame').src = location;
}
function doNewAd() {
try {
// alert('changingAd');
bActivity = false;
if (canHideAds() == false) {
showGoogleAd();
// parent.frames[1].location = "/GoogleAd.aspx?cbust=" + Math.random().toString();
}
// ControlFrame("/AdEngine.aspx);
} catch (e) { }
// setRandomAd();
}
// function setRandomAd() {
// // get a random number between 0 and 480000
// var randomnumber = Math.floor(Math.random() * 480000)
// // add 120 to make it between 120 and 600k
// randomnumber += 120000
// setTimeout("doNewAd()", randomnumber);
// }
function CheckForBFCFiles() {
// parent.frames[2].location = "/BFCConversionCheck.aspx";
// document.getElementById("customFrame").src = "/BFCConversionCheck.aspx";
ControlFrame("/BFCConversionCheck.aspx");
}
function ControlFrame(url) {
// ignoreBack = true;
try {
$("#controlFrame").attr('src',url);
//parent.frames[2].location = url
// document.getElementById("customFrame").src = url;
} catch (e) { }
}
function convertFromBFC(guid) {
// parent.frames[2].location = "/SymbolHit.aspx";
ControlFrame("/SymbolHit.aspx");
var chart = document.getElementById(chartCSSId);
if (chart != null) {
try {
chart.Content.bfcAppScript.ConvertFromBFC(guid);
} catch (e) {
}
}
}
function bfc_AdGo() {
doNewAd();
// ControlFrame("/AdEngine.aspx?cbust=" + Math.random().toString());
}
function canHideAds() {
var chart = document.getElementById(chartCSSId);
if (chart != null) {
try {
return chart.Content.bfcAppScript.HideGoog();
} catch (e) {
}
}
}
function setLoginInfo(em, pwd) {
var url = "http://www.worden.com/user/login/?n=" + escape(em) + "&p=" + escape(pwd)
ControlFrame(url);
}
function onLoginChanged() {
if (canHideAds() == true) {
hideFrame();
fixIE8Width();
} else {
noAds = false;
showFrame();
fixIE8Width();
doNewAd();
}
}
function onBlur() {
};
function onFocus() {
setFrameSize();
};
setInterval('updateAdSize()', 60000);
function updateAdSize() {
if (noAds) {
hideFrame();
return;
}
if (allowAdSizeChange) {
var current = use300Ad;
chooseAdSize();
setFrameSize();
//if (current != use300Ad) {
// resizeElements();
// showGoogleAd();
// }
}
}
function hideFrame() {
noAds = true;
adFrame.width("0px");
adFrame.hide();
frameVisible = false;
resizeElements();
}
function fixIE8Width() {
if (ieVer > -1) {
if (ieVer < 9.0) {
// HACK: Fix IE8's layout problem and force the dom to referesh by adding a fake class to the body
$('body').addClass('fixie8hack');
setTimeout(function () {
// remove the fake class
$('body').removeClass('fixie8hack');
}, 1000);
}
}
}
function showFrame() {
frameVisible = true;
adFrame.show();
chooseAdSize();
setFrameSize();
}
function getInternetExplorerVersion()
// Returns the version of Windows Internet Explorer or a -1
// (indicating the use of another browser).
{
var rv = -1; // Return value assumes failure.
if (navigator.appName == 'Microsoft Internet Explorer') {
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat(RegExp.$1);
}
return rv;
}
function setFrameSize() {
if (noAds) {
hideFrame();
return;
}
if (use300Ad) {
adFrame.width("300px");
resizeElements();
if (frameW != 300) {
frameW = 300;
showGoogleAd(true);
}
frameW = 300;
} else {
//var frameset = document.getElementById("mainFrame");
//if (frameset == null) return;
//frameset.cols = "*,160";
adFrame.width("160px");
resizeElements();
if (frameW != 160) {
frameW = 160;
showGoogleAd(true);
}
frameW = 160;
}
}
function chooseAdSize() {
use300Ad = false;
var d = new Date();
var day = d.getDate();
var hour = d.getHours();
if (day % 2 == 0) {
if (hour % 2 !== 0) {
use300Ad = true;
}
} else {
if (hour % 2 == 0) {
use300Ad = true;
}
}
}
function showGoogleAd(forceUpdate) {
var now = new Date();
var diff = now - lastAd;
// at least 45 seconds must have passed before we can show another ad
if ((diff / 1000 > 45) || forceUpdate) {
lastAd = new Date();
if (frameW == 160) {
adFrame.attr('src', "/GoogleAd160.aspx?cbust=" + Math.random().toString())
} else {
if (Math.random() < .256) {
// adFrame.attr('src', "/GoogleAd300.aspx?cbust=" + Math.random().toString())
adFrame.attr('src', "/GoogAd300by600.aspx?cbust=" + Math.random().toString())
} else {
adFrame.attr('src',"/GoogleAd300.aspx?cbust=" + Math.random().toString())
}
}
}
}
function resizeElements() {
//var height = document.documentElement.clientHeight;
//var w = document.documentElement.clientWidth;
var height = $(window).height();
var width = $(window).width();
var iframe = adFrame
//height -= iframe.offsetTop;
//iframe.style.height = height + "px";
iframe.height(height + "px");
var slWidth = (width - iframe.width())
iframe.css('left', slWidth + "px");
// resize the silverlight control
sl = $("#SilverlightControl1")
sl.width(slWidth + "px");
sl.height(height + "px");
fixIE8Width();
};
window.onresize = function () {
resizeElements();
}
$(function () {
onBodyLoad();
adFrame = $("#adFrame");
chooseAdSize();
resizeElements();
document.getElementById('adFrame').onload = resizeElements;
$("#controlFrame").load(function () {
var src = $("#controlFrame").attr('src');
if (src.startsWith("http://www.worden.com")) {
ControlFrame("");
}
});
setTimeout('FocusChart()', 300);
setInterval('postOnlineCount()', 600000);
if (/*@cc_on!@*/false) { // check for Internet Explorer
document.onfocusin = onFocus;
document.onfocusout = onBlur;
} else {
window.onfocus = onFocus;
window.onblur = onBlur;
}
});
</script>