]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
Merge commit 'scott/340' into 0.4
authorAnna Sobiepanek <annaopensource@gmail.com>
Tue, 8 Mar 2011 21:50:30 +0000 (16:50 -0500)
committerAnna Sobiepanek <annaopensource@gmail.com>
Tue, 8 Mar 2011 21:50:30 +0000 (16:50 -0500)
1  2 
plugins/googlenews/popcorn.googlenews.js
plugins/subtitle/popcorn.subtitle.js

index b80b55437a7cf16eace48b80814db5ba16550510,acc5e8a42a0636e7a953619e30e861092b76c0c3..b0cfdf7de6f67289e12d6fc03fed7c01d02f5ffa
@@@ -1,29 -1,13 +1,34 @@@
  // PLUGIN: Google News
  
  (function (Popcorn) {
-   
+   var scriptLoaded = false;
+ 
+   Popcorn.getScript( "http://www.google.com/jsapi", function() {
+     google.load("elements", "1", {packages : ["newsshow"], callback: function() {scriptLoaded = true;}});
+   });
+ 
    /**
 +   * Google News popcorn plug-in 
 +   * Displays Google News information on a topic in a targeted div.
 +   * Options parameter will need a start, end and target.
 +   * Optional parameters are topic. topic defaults to "top stories"
 +   * Start is the time that you want this plug-in to execute
 +   * End is the time that you want this plug-in to stop executing
 +   * Target is the id of the document element that the content is
 +   *  appended to, this target element must exist on the DOM
 +   * Topic is the topic of news articles you want to display.
 +   * 
 +   * @param {Object} options
 +   * 
 +   * Example:
 +     var p = Popcorn('#video')
 +        .footnote({
 +          start:          5,                 // seconds, mandatory
 +          end:            15,                // seconds, mandatory
 +          topic:          'oil spill',       // optional
 +          target:         'newsdiv'        // mandatory
 +        } )
 +   *
     */
    Popcorn.plugin( "googlenews" , {
  
index 83098d1804bb3876f550f9b7c79efb998879a991,5755331abe1df15cf3dd4c798d18762b712e7f09..0cad282ff7cab6a5ca69954ac5e51f725c3a245c
@@@ -1,54 -1,14 +1,60 @@@
  // PLUGIN: Subtitle
  
  (function (Popcorn) {
-   
+ 
+   var scriptLoaded = false;
+ 
+   Popcorn.getScript( "http://www.google.com/jsapi", function() {
+     google.load("language", "1", {callback: function() {scriptLoaded = true;}});
+   });
+ 
    /**
 +   * Subtitle popcorn plug-in 
 +   * Displays a subtitle over the video, or in the target div
 +   * Options parameter will need a start, and end.
 +   * Optional parameters are target and text.
 +   * Start is the time that you want this plug-in to execute
 +   * End is the time that you want this plug-in to stop executing
 +   * Target is the id of the document element that the content is
 +   *  appended to, this target element must exist on the DOM
 +   * Text is the text of the subtitle you want to display.
 +   *
 +   * Language is the expected language the subtitle text is in
 +   * Languagesrc is the target id of the element that contains 
 +   *  the language value ("en", "fr", etc.) to translate the text into
 +   *  example:
 +   *  <select id="language">
 +   *    <option value="zh" selected="selected">Chinese</option>
 +   *    <option value="en">English</option>
 +   *    <option value="fr">French</option>
 +   *    <option value="de">German</option>
 +   *    <option value="it">Italian</option>
 +   *    <option value="ja">Japanese</option>
 +   *    <option value="ko">Korean</option>
 +   *    <option value="fa">Persian</option>
 +   *    <option value="pl">Polish</option>
 +   *    <option value="pt">Portuguese</option>
 +   *    <option value="es">Spanish</option>
 +   *  </select>
 +   * Accessibilitysrc is the target id of a checkbox element
 +   *  checked means show all subtitles regardless of language and languagesrc
 +   *  not checked means only translate if language and languagesrc are different
 +   *  if no accessibilitysrc exists, default is to display all subtitles regardless
 +   * 
 +   * @param {Object} options
 +   * 
 +   * Example:
 +     var p = Popcorn('#video')
 +        .footnote({
 +          start:            5,                 // seconds, mandatory
 +          end:              15,                // seconds, mandatory
 +          text:             'Hellow world',    // optional
 +          target:           'subtitlediv',     // optional
 +          language:         'en',              // optional
 +          languagesrc:      'language',        // optional
 +          accessibilitysrc: 'accessibility'    // optional
 +        } )
 +   *
     */
  
    // just a little tool function