我正在创建一个使用d3.js可视化某些数据的页面。目前,我只使用d3.js和jquery,但是当我检查页面时,我会在页面中注入一些非常神秘的代码。代码是:
<mytubeelement id="myTubeRelayElementToPage" event="preferencesUpdated" data="{"bundle":{"label_delimitor":"
:","percentage":"
%","smart_buffer":"
Smart Buffer","start_playing_when_buffered":"
Start playing when buffered","sound":"
Sound","desktop_notification":"
Desktop Notification","continuation_on_next_line":"
-","loop":"
Loop","only_notify":"
Only Notify","estimated_time":"
Estimated Time","global_preferences":"
Global Preferences","no_notification_supported_on_your_browser":"
No notification style supported on your browser version","video_buffered":"
Video Buffered","buffered":"
Buffered","hyphen":"
-","buffered_message":"
The video has been buffered as requested and is ready to play.","not_supported":"
Not Supported","on":"
On","off":"
Off","click_to_enable_for_this_site":"
Click to enable for this site","desktop_notification_denied":"
You have denied permission for desktop notification for this site","notification_status_delimitor":"
;","error":"
Error","adblock_interferance_message":"
Adblock (or similar extension) is known to interfere with SmartVideo. Please add this url to adblock whitelist.","calculating":"
Calculating","waiting":"
Waiting","will_start_buffering_when_initialized":"
Will start buffering when initialized","will_start_playing_when_initialized":"
Will start playing when initialized","completed":"
Completed","buffering_stalled":"
Buffering is stalled. Will stop.","stopped":"
Stopped","hr":"
Hr","min":"
Min","sec":"
Sec","any_moment":"
Any Moment","popup_donate_to":"
Donate to","extension_id":"
lnkdbjbjpnpjeciipoaflmpcddinpjjp"},"prefs":{"desktopNotification":true,"soundNotification":true,"logLevel":0,"allowPromotion":true,"enable":true,"loop":false,"hidePopup":true,"autoPlay":false,"autoBuffer":false,"autoPlayOnBuffer":false,"autoPlayOnBufferPercentage":42,"autoPlayOnSmartBuffer":true,"quality":"
default","fshd":false,"onlyNotification":false,"enableFullScreen":true,"saveBandwidth":false,"hideAnnotations":false,"turnOffPagedBuffering":false}}"></mytubeelement>
为了清晰起见,我添加了换行符,但在代码中它全部在一行上。有谁知道这是什么?搜索元素'mytubeelement'并没有告诉我任何事情。
我正在编写的代码只是一个简单的页面,使用d3绘制条形图。
var color = d3.scale.linear()
.domain([0,4500,9000,13500,18000])
.range(["red","orange", "yellow","green","blue"]);
var width = 600,
height = 500;
var margin = {top: 20, right: 30, bottom: 100, left: 70};
var x = d3.time.scale().domain([minDate,maxDate]).range([0,width]);
var y = d3.scale.linear()
.domain([0,18000])
.range([height, 0]);
var xAxis = d3.svg.axis()
.scale(x)
.orient("bottom");
var yAxis = d3.svg.axis()
.scale(y)
.orient("left");
var chart = d3.select(".chart")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
chart.append("g")
.attr("class","y axis")
.call(yAxis);
chart.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(xAxis)
.selectAll("text")
.style("text-anchor", "end")
.attr("dx", "-.8em")
.attr("dy", "-.55em")
.attr("transform", "rotate(-90)" );
chart.append("text")
.attr("class", "label")
.attr("x",-200)
.attr("y",-margin.left+15)
.text("Steps")
.attr("transform","rotate(-90)")
var barWidth = width / computedDataArray.length;
var bar = chart.selectAll("g")
.data(computedDataArray)
.enter().append("g")
.attr("transform", function(d, j) { return "translate(" + ((j-15)*barWidth) + ",0)"; });
bar.append("rect")
.attr("y", function(d) { return y(d.value); })
.attr("height", function(d) { return height - y(d.value); })
.attr("width", barWidth - 1)
.attr("fill", function(d) {return color(d.value);} );
答案 0 :(得分:4)
您是否有任何机会安装某种类型的视频缓冲插件?
我注意到同样的事情(mytubelement被插入到代码中)我记得我安装的插件会将代码注入到我访问过的网页中。
如果你有任何视频缓冲插件,你会尝试禁用插件,看看是否能解决你的问题吗?
答案 1 :(得分:1)
这是因为名为SmartVideo For YouTube™的插件。我禁用了该插件,元素插入已经消失。
答案 2 :(得分:1)
您有一个名为&#34; SmartVideo For YouTube™&#34;它会自动将youtube元素添加到您的页面中......
答案 3 :(得分:0)
SmartVideo for Youtube Chrome扩展程序执行此操作。