From: Anna Sobiepanek Date: Sat, 26 Jun 2010 23:23:54 +0000 (-0400) Subject: added attribution and Creative Commons images [#34 state:peer-review-requested]... X-Git-Tag: v0.1~66^2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=ff7b572297ef19ea59871e2d25e1b09463ad78b6;p=popcorn-js.git added attribution and Creative Commons images [#34 state:peer-review-requested] [#20 state:peer-review-requested] --- diff --git a/index.html b/index.html index 7c2167e..1f0e85c 100644 --- a/index.html +++ b/index.html @@ -37,6 +37,7 @@

+

In this video:

diff --git a/popcorn.js b/popcorn.js index 282b1c9..cccf022 100644 --- a/popcorn.js +++ b/popcorn.js @@ -159,7 +159,61 @@ MapCommand.map.setZoom(0); }; }; - + + var AttributionCommand = function(name, params, text) { + VideoCommand.call(this, name, params, text); + var attribution = ""; + var image = ""; + if ( this.params.nameofwork ) { + attribution += this.params.nameofwork; + } + if ( this.params.copyrightholder ) { + attribution += ", " + this.params.copyrightholder; + } + if ( this.params.license ) { + if ( this.params.license.toUpperCase() === "CC-BY" ) { + image = ""; + } else if ( this.params.license.toUpperCase() === "CC-BY-SA" ) { + image = ""; + } else if ( this.params.license.toUpperCase() === "CC-BY-ND" ) { + image = ""; + } else if ( this.params.license.toUpperCase() === "CC-BY-NC" ) { + image = ""; + } else if ( this.params.license.toUpperCase() === "CC-BY-NC-SA" ) { + image = ""; + } else if ( this.params.license.toUpperCase() === "CC-BY-NC-ND" ) { + image = ""; + } + if ( image ){ + attribution = image + " " +attribution; + } else { + attribution += ", license: " +this.params.license; + } + } + if ( this.params.licenseurl ){ + attribution += ", License URL"; + } + //if the user did not specify any parameters just pull the text from the tag + if( attribution === "" ){ + attribution = this.text + } + this.onIn = function() { + //check if the user specified a target div otherwise create default + if( this.params.target ) { + document.getElementById( this.params.target ).innerHTML = attribution; + } else { + //default div + } + }; + this.onOut = function() { + if( this.params.target ) { + document.getElementById( this.params.target ).innerHTML = ""; + } else { + //default div + } + }; + }; + var TwitterCommand = function(name, params, text) {}; // http://twitter.com/celinecelines // Wrapper for accessing commands by name @@ -181,7 +235,12 @@ create: function(name, params, text) { return new MapCommand(name, params, text); } - } + }, + attribution: { + create: function(name, params, text) { + return new AttributionCommand(name, params, text); + } + }, }; // Parses xml into command objects and adds them to the video manager diff --git a/xml/webMadeMovies.xml b/xml/webMadeMovies.xml index 9135cc2..bf34fb4 100644 --- a/xml/webMadeMovies.xml +++ b/xml/webMadeMovies.xml @@ -15,6 +15,9 @@ Noah Celine Celine + + +