FusionCharts.js代码

/*** FusionCharts: Flash Player detection and Chart embedding.* Version: 1.2.4 (16th February, 2009) - Added fix for chart with % width/height.* Version: 1.2.3 (15th September, 2008) - Added fix for % and & characters. Additional fixes to properly handle double quotes and single quotes in setDataXML() function.* Version: 1.2.2 (10th July, 2008) - Added fix for % scaled dimensions, fixes in setDataXML() and setDataURL() functions* Version: 1.2.1 (21st December, 2007) - Added setting up transparent/opaque mode: setTransparent() function * Version: 1.2 (1st November, 2007) - Added FORM fixes for IE * Version: 1.1 (29th June, 2007) - Added Player detection, New conditional fixes for IE** Morphed from SWFObject (http://blog.deconcept.com/swfobject/) under MIT License:* http://www.opensource.org/licenses/mit-license.php**/if(typeof infosoftglobal == "undefined") var infosoftglobal = new Object();
if(typeof infosoftglobal.FusionChartsUtil == "undefined") infosoftglobal.FusionChartsUtil = new Object();
infosoftglobal.FusionCharts = function(swf, id, w, h, debugMode, registerWithJS, c, scaleMode, lang, detectFlashVersion, autoInstallRedirect){if (!document.getElementById) { return; }//Flag to see whether data has been set initiallythis.initialDataSet = false;//Create container objectsthis.params = new Object();this.variables = new Object();this.attributes = new Array();//Set attributes for the SWFif(swf) { this.setAttribute('swf', swf); }if(id) { this.setAttribute('id', id); }debugMode = debugMode ? debugMode : 0;this.addVariable('debugMode', debugMode);w=w.toString().replace(/\%$/,"%25");if(w) { this.setAttribute('width', w); }h=h.toString().replace(/\%$/,"%25");if(h) { this.setAttribute('height', h); }//Set background colorif(c) { this.addParam('bgcolor', c); }//Set Qualitythis.addParam('quality', 'high');//Add scripting access parameterthis.addParam('allowScriptAccess', 'always');//Pass width and height to be appended as chartWidth and chartHeightthis.addVariable('chartWidth', w);this.addVariable('chartHeight', h);//Whether in debug mode//Pass DOM ID to Chartthis.addVariable('DOMId', id);//Whether to registed with JavaScriptregisterWithJS = registerWithJS ? registerWithJS : 0;this.addVariable('registerWithJS', registerWithJS);//Scale Mode of chartscaleMode = scaleMode ? scaleMode : 'noScale';this.addVariable('scaleMode', scaleMode);//Application Message Languagelang = lang ? lang : 'EN';this.addVariable('lang', lang);//Whether to auto detect and re-direct to Flash Player installationthis.detectFlashVersion = detectFlashVersion?detectFlashVersion:1;this.autoInstallRedirect = autoInstallRedirect?autoInstallRedirect:1;//Ger Flash Player versionthis.installedVer = infosoftglobal.FusionChartsUtil.getPlayerVersion();if (!window.opera && document.all && this.installedVer.major > 7) {// Only add the onunload cleanup if the Flash Player version supports External Interface and we are in IEinfosoftglobal.FusionCharts.doPrepUnload = true;}
}infosoftglobal.FusionCharts.prototype = {setAttribute: function(name, value){this.attributes[name] = value;},getAttribute: function(name){return this.attributes[name];},addParam: function(name, value){this.params[name] = value;},getParams: function(){return this.params;},addVariable: function(name, value){this.variables[name] = value;},getVariable: function(name){return this.variables[name];},getVariables: function(){return this.variables;},getVariablePairs: function(){var variablePairs = new Array();var key;var variables = this.getVariables();for(key in variables){variablePairs.push(key +"="+ variables[key]);}return variablePairs;},getSWFHTML: function() {var swfNode = "";if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architectureswfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"  ';swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';var params = this.getParams();for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }var pairs = this.getVariablePairs().join("&");if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }swfNode += '/>';} else { // PC IEswfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';var params = this.getParams();for(var key in params) {swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';}var pairs = this.getVariablePairs().join("&");          if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}swfNode += "</object>";}return swfNode;},setDataURL: function(strDataURL){//This method sets the data URL for the chart.//If being set initiallyif (this.initialDataSet==false){this.addVariable('dataURL',strDataURL);//Update flagthis.initialDataSet = true;}else{//Else, we update the chart data using External Interface//Get reference to chart objectvar chartObj = infosoftglobal.FusionChartsUtil.getChartObject(this.getAttribute('id'));if (!chartObj.setDataURL){__flash__addCallback(chartObj, "setDataURL");}chartObj.setDataURL(strDataURL);}},//This function ://fixes the double quoted attributes to single quotes//Encodes all quotes inside attribute values//Encodes % to %25 and & to %26;encodeDataXML: function(strDataXML){var regExpReservedCharacters=["\\$","\\+"];var arrDQAtt=strDataXML.match(/=\s*\".*?\"/g);if (arrDQAtt){for(var i=0;i<arrDQAtt.length;i++){var repStr=arrDQAtt[i].replace(/^=\s*\"|\"$/g,"");repStr=repStr.replace(/\'/g,"%26apos;");var strTo=strDataXML.indexOf(arrDQAtt[i]);var repStrr="='"+repStr+"'";var strStart=strDataXML.substring(0,strTo);var strEnd=strDataXML.substring(strTo+arrDQAtt[i].length);var strDataXML=strStart+repStrr+strEnd;}}strDataXML=strDataXML.replace(/\"/g,"%26quot;");strDataXML=strDataXML.replace(/%(?![\da-f]{2}|[\da-f]{4})/ig,"%25");strDataXML=strDataXML.replace(/\&/g,"%26");return strDataXML;},setDataXML: function(strDataXML){//If being set initiallyif (this.initialDataSet==false){//This method sets the data XML for the chart INITIALLY.this.addVariable('dataXML',this.encodeDataXML(strDataXML));//Update flagthis.initialDataSet = true;}else{//Else, we update the chart data using External Interface//Get reference to chart objectvar chartObj = infosoftglobal.FusionChartsUtil.getChartObject(this.getAttribute('id'));chartObj.setDataXML(strDataXML);}},setTransparent: function(isTransparent){//Sets chart to transparent mode when isTransparent is true (default)//When no parameter is passed, we assume transparent to be true.if(typeof isTransparent=="undefined") {isTransparent=true;}           //Set the propertyif(isTransparent)this.addParam('WMode', 'transparent');elsethis.addParam('WMode', 'Opaque');},render: function(elementId){//First check for installed version of Flash Player - we need a minimum of 8if((this.detectFlashVersion==1) && (this.installedVer.major < 8)){if (this.autoInstallRedirect==1){//If we can auto redirect to install the player?var installationConfirm = window.confirm("You need Adobe Flash Player 8 (or above) to view the charts. It is a free and lightweight installation from Adobe.com. Please click on Ok to install the same.");if (installationConfirm){window.location = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";}else{return false;}}else{//Else, do not take an action. It means the developer has specified a message in the DIV (and probably a link).//So, expect the developers to provide a course of way to their end users.//window.alert("You need Adobe Flash Player 8 (or above) to view the charts. It is a free and lightweight installation from Adobe.com. ");return false;}           }else{//Render the chartvar n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;// If loaded in IE and scaleMode and width/height specified in %, load the chart using onload eventif(  this.getVariable('scaleMode').search(/noscale/i)>=0 &&  ( this.getAttribute('width').search("%")>0 || this.getAttribute('height').search("%")>0) ){//store current object referencevar obj=this;if(window.addEventListener) {//add onload event on firefoxwindow.addEventListener("load",function(){ n.innerHTML = obj.getSWFHTML(); },false );} else if(window.attachEvent) {//add onload event on IEwindow.attachEvent("onload", function() { n.innerHTML = obj.getSWFHTML(); } );} else { // if all onload fails failsn.innerHTML = this.getSWFHTML();        }               } else {//Normal case. Instantly load the chartn.innerHTML = this.getSWFHTML();}//Added <FORM> compatibility//Check if it's added in Mozilla embed array or if already exitsif(!document.embeds[this.getAttribute('id')] && !window[this.getAttribute('id')])window[this.getAttribute('id')]=document.getElementById(this.getAttribute('id')); //or else document.forms[formName/formIndex][chartId]return true;        }}
}/* ---- detection functions ---- */
infosoftglobal.FusionChartsUtil.getPlayerVersion = function(){var PlayerVersion = new infosoftglobal.PlayerVersion([0,0,0]);if(navigator.plugins && navigator.mimeTypes.length){var x = navigator.plugins["Shockwave Flash"];if(x && x.description) {PlayerVersion = new infosoftglobal.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));}}else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ //If Windows CEvar axo = 1;var counter = 3;while(axo) {try {counter++;axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);PlayerVersion = new infosoftglobal.PlayerVersion([counter,0,0]);} catch (e) {axo = null;}}} else { // Win IE (non mobile)// Do minor version lookup in IE, but avoid Flash Player 6 crashing issuestry{var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try {var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");PlayerVersion = new infosoftglobal.PlayerVersion([6,0,21]);axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)} catch(e) {if (PlayerVersion.major == 6) {return PlayerVersion;}}try {axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");} catch(e) {}}if (axo != null) {PlayerVersion = new infosoftglobal.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}return PlayerVersion;
}
infosoftglobal.PlayerVersion = function(arrVersion){this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
}
// ------------ Fix for Out of Memory Bug in IE in FP9 ---------------//
/* Fix for video streaming bug */
infosoftglobal.FusionChartsUtil.cleanupSWFs = function() {var objects = document.getElementsByTagName("OBJECT");for (var i = objects.length - 1; i >= 0; i--) {objects[i].style.display = 'none';for (var x in objects[i]) {if (typeof objects[i][x] == 'function') {objects[i][x] = function(){};}}}
}
// Fixes bug in fp9
if (infosoftglobal.FusionCharts.doPrepUnload) {if (!infosoftglobal.unloadSet) {infosoftglobal.FusionChartsUtil.prepUnload = function() {__flash_unloadHandler = function(){};__flash_savedUnloadHandler = function(){};window.attachEvent("onunload", infosoftglobal.FusionChartsUtil.cleanupSWFs);}window.attachEvent("onbeforeunload", infosoftglobal.FusionChartsUtil.prepUnload);infosoftglobal.unloadSet = true;}
}
/* Add document.getElementById if needed (mobile IE < 5) */
if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }}
/* Add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}/* Function to return Flash Object from ID */
infosoftglobal.FusionChartsUtil.getChartObject = function(id)
{var chartRef=null;if (navigator.appName.indexOf("Microsoft Internet")==-1) {if (document.embeds && document.embeds[id])chartRef = document.embeds[id]; elsechartRef  = window.document[id];}else {chartRef = window[id];}if (!chartRef)chartRef  = document.getElementById(id);return chartRef;
}
/* Aliases for easy usage */
var getChartFromId = infosoftglobal.FusionChartsUtil.getChartObject;
var FusionCharts = infosoftglobal.FusionCharts;

FusionCharts.js代码相关推荐

  1. 超nb的网页标签弹窗js代码!

    首先说一下业务需求: 需要在当前各主流浏览器上从tab标签形式弹出一个页面,尽量不要以单独窗口弹出. 下面是网上搜集并修改.验证后的js代码,以备以后参阅. function getUnionCook ...

  2. 一行js代码识别Selenium+Webdriver及其应对方案

    有不少朋友在开发爬虫的过程中喜欢使用Selenium + Chromedriver,以为这样就能做到不被网站的反爬虫机制发现. 先不说淘宝这种基于用户行为的反爬虫策略,仅仅是一个普通的小网站,使用一行 ...

  3. 判断是否移动端设备的JS代码,超短,百度都用它

    为什么80%的码农都做不了架构师?>>>    大多数人都使用跳转适配的方式实现PC端到移动端的网页转换,而大多数人又是使用通过判断UA的方法来区分PC端还是移动端,思路一样,但代码 ...

  4. 爬虫之selenium控制浏览器执行js代码

    爬虫之selenium控制浏览器执行js代码 selenium可以让浏览器执行我们规定的js代码,运行下列代码查看运行效果 import time from selenium import webdr ...

  5. 浮层java_通过遮罩层实现浮层DIV登录的js代码

    摘要:这篇JavaScript栏目下的"通过遮罩层实现浮层DIV登录的js代码",介绍的技术点是"浮层DIV.JS代码.div.遮罩层.登录.代码",希望对大家 ...

  6. 用鼠标拖动图片的JS代码

    代码简介: 用鼠标拖动一个图片移动,就像拖动一个层一样,这是一个JS拖动类代码,你可以无限制的增加图片,代码复用率比较高. 代码内容: View Code <html><HEAD&g ...

  7. html实体编码遇上js代码

    单双引号 在js代码中 在js中单.双引号引起来的是字符串,如果我们要在字符串中使用单.双引号,需要反斜杠进行转义 let str='user\'s name'; // or let str=&quo ...

  8. python爬虫执行js代码_爬虫之python3用execjs执行JS代码

    JS运行环境 Node.js 是Javascript语言服务器端运行环境 测试运行 测试运行JavaScript程序 微软windows操作系统:附件-命令提示符 需进入到js程序的目录下,node命 ...

  9. html漂浮广告随页面移动代码,JS漂浮广告代码,慢慢漂移的广告JS代码

    JS漂浮广告代码,慢慢漂移的广告js代码,可以漂浮到任何位置,哈哈...直接贴代码,很简单. var xin = true, yin = true var step = 1 var delay = 5 ...

最新文章

  1. OPPO R11巴萨限量版开售,上午10点线上线下火爆开启!
  2. 软工学习笔记——代码规范
  3. leetcode题解132-分割回文串 II
  4. (第一组_GNS3)基于上下文的访问控制
  5. C#下拉列表绑定数据库的使用三层实现
  6. 如何自学python知乎-你是如何自学 Python 的?
  7. 转载:大学生如何让自己强大起来(计算机、电子方向)
  8. 傅里叶变换公式及其推导【超详细!】
  9. excel自动求和_Excel教程:3个按条件定位的小技巧
  10. Oracle 创建用户授权视图,别名通过同义词解决
  11. matlab如何调整顺时针逆时针,关于算法:确定线段的方向是顺时针还是逆时针
  12. mt7620 外置pa_openwrt在mt7620a芯片上对外置PA的支持
  13. c++的继承与派生之从入门到入坟-------集大成者
  14. NFC开发 —————实用工具以及开发文档(四)
  15. 从生物信息学转计算机科学,转一个:学生物的,不会编程,也可以报考生物信息学的研究生...
  16. 浅谈鸽巢原理的证明和简单应用
  17. qs.stringify
  18. Android 解析JSON数据填充到Listview中
  19. windows无法发现任何计算机或设备,电脑网络诊断显示Windows无法与设备或资源(主DNS)通信怎么解决...
  20. 全面刨析VDS链销模式12大优势及下一个机会

热门文章

  1. 基于图卷积网络的测量与先验知识相结合的故障诊断方法
  2. 7-1 构造方法 (5 分)-java
  3. android订餐系统app、android购物商城系统app 手机端+服务器端 mysql数据库,界面简单,功能齐全 安卓购物商城 安卓在线订餐系统
  4. Python中的True和False详解
  5. NOIP2015普及组复赛 解题分析
  6. 公司章程绝对记载事项有哪些
  7. bi平台怎么选,一文详解
  8. 雪碧图HTML人物,animateSprite-可控制雪碧图(sprites)动画的jQuery插件
  9. 基础练习 数的读法(Tom教授正在给研究生讲授一门关于基因的课程,有一件事情让他颇为头疼:一条染色体上有成千上万个碱基对,它们从0开始编号,到几百万,几千万,甚至上亿。   比如说,在对学生讲解第1)
  10. 网页设计实验二( 格式化文本、段落与列表)