sparkline.js

来自「希望此段源编码能给所有需要它的朋友带去快乐」· JavaScript 代码 · 共 59 行

JS
59
字号
$(document).ready( function(){	//for every section	$("a[name='evolutionGraph']").each(		function()		{			//try to find the graph			var graph = $(this);					if(graph && graph.size() > 0)			{				//try to find sparklines and add them clickable behaviour				$(this).parent().find('p').each(					function()					{						var url = "";						//find the sparkline and get it's src attribute						$(".sparkline", this).each(							function()							{								//search viewDataTable parameter and replace it with value for chart								var reg = new RegExp("(viewDataTable=sparkline)", "g");								url = this.src.replace(reg,'viewDataTable=generateDataChartEvolution');							}						);												if(url != "")						{							$("*", this).each(								function()								{									//on click, reload the graph with the new url									$(this).click(										function()										{												//get the main page graph and reload with new data											findSWFGraph(graph.attr('graphId')+"Chart_swf").reload(url);											lazyScrollTo(graph[0], 400);										}									);																		//on hover, change cursor to indicate clickable item									$(this).hover(										function()										{  									 		$(this).css({ cursor: "pointer"}); 									  	}, function (){}									);								}							);						}					}				);			}		}	);});

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?