Goal: show page info by using Youtube object that is defined in content script "Youtube.js"
Problem: can not access members.
I have the following script which is also registered in manifest.cs under content_scripts:
/// <reference path="UtilityFunctions.js" />
var playerElementId = "movie_player";
var youtube = new Youtube();
writePageInfo(youtube);
function Youtube() //ctor
{
this.playerObj = getPlayer();
}
Youtube.prototype.IsCurrentSite = function ()
{
var url = location.href;
if (url.indexOf("youtube.com") > 0)
{
return playerObj != null;
}
return false;
}
function getPlayer()
{
return document.getElementById(playerElementId);
}
//debug
function writePageInfo(youtubeObj)
{
//alert("From Youtube content script"); //this line is executed
alert("Youtube - debug: " + youtubeObj.IsCurrentSite()); //this line NOT: undefined function
}
I do not know what to do to write the uncommented alert message.
P.S.: if I open several Youtube pages several objects will be created ?