};
};
- ////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////
// Wiki Command
////////////////////////////////////////////////////////////////////////////
VideoCommand.call(this, name, params, text, videoManager);
var src = this.params.src;
+ var length = this.params.numberOfWords;
// Setup a default, hidden div to hold the images
var target = document.createElement('div');
target.setAttribute('id', this.id);
document.getElementById(this.params.target).appendChild(target);
// Div is hidden by default
target.setAttribute('style', 'display:none');
-
// This uses jquery
- $.getJSON("http://en.wikipedia.org/w/api.php?action=parse&props=text&page=" + this.params.title+ "&format=json&callback=?", function(data){
- //$.each(data.parse, function(i, item) {
+ $.getJSON("http://en.wikipedia.org/w/api.php?action=parse&props=text&page=" + ( this.params.title || src.slice(src.lastIndexOf("/")+1) ) + "&format=json&callback=?", function(data){
+ if( data ) {
+ //make a link to the document
var link = document.createElement('a');
link.setAttribute('href', src);
var p = document.createElement('p');
p.innerHTML = data.parse.displaytitle;
link.appendChild(p);
+ // get the first 140 characters of the wiki content
var desc = document.createElement('p');
- //((<(.|\n)+?>)|\[(.*?)\]|\((.*?)\))
var text = data.parse.text.*.substr(data.parse.text.*.indexOf('<p>'));
- text = text.replace(/(<(.|\n)+?>)|\((.*?)\)|\[(.*?)\]/g, "");
- alert(text);desc.innerHTML = text;
+ text = text.replace(/((<(.|\n)+?>)|(\((.*?)\) )|(\[(.*?)\]))/g, "");
+ desc.innerHTML = text.substr(0, ( length || 140 )) + " ...";
target.appendChild(link);
target.appendChild(desc);
- //});
+ }
});
this.target = target;
- //this.onIn = function() {
+ this.onIn = function() {
this.target.setAttribute('style', 'display:inline');
- //};
+ };
this.onOut = function() {
- //this.target.setAttribute('style', 'display:none');
+ this.target.setAttribute('style', 'display:none');
};
};
////////////////////////////////////////////////////////////////////////////
<places>
<place id="acc" type="building" name="Austin Convention Center">
<resource id="acchomepage" src="http://www.austinconventioncenter.com/" description="Austin Convention Center"/>
+ <resource id="accwiki" src="http://en.wikipedia.org/wiki/Austin_Convention_Center" description="Austin Convention Center Wiki"/>
</place>
<place id="saopaulo" type="city" name="Sao Paulo">
<resource id="saupaulowiki" src="http://en.wikipedia.org/wiki/S%C3%A3o_Paulo" title="S%C3%A3o_Paulo" description="Sao Paulo city, Brazil"/>
<resources>
<twitter source="#oilspill" title="BP Oil Spill" target="twitter" width="238" height="160"/>
<twitter in="00:00:01:00" out="00:00:20:00" title="Celine Celine" source="from:celinecelines" target="personaltwitter" width="238" height="120"/>
- <wiki in="00:00:02:00" out="00:01:00:00" resourceid="saupaulowiki" target="wikidiv"/>
+ <wiki in="00:00:02:00" out="00:00:15:00" resourceid="saupaulowiki" numberOfWords="200" target="wikidiv"/>
+ <wiki in="00:00:10:00" out="00:00:25:00" resourceid="accwiki" target="wikidiv"/>
<attribution in="00:00:1:00" out="00:40:00" target="container5" resourceid="attrib" />
<attribution in="00:42:00" out="00:00:48:00" target="container5">A Shared Culture, Jesse Dylan</attribution>
<flickr in="00:01:00" out="00:20:00" target="flickr" userid="13072070" numberofimages="8" padding="4px"/>