]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#578] Made some style fixes
authorDavid Seifried <david.c.seifried@gmail.com>
Thu, 23 Jun 2011 17:34:41 +0000 (13:34 -0400)
committerDavid Seifried <david.c.seifried@gmail.com>
Thu, 23 Jun 2011 17:34:41 +0000 (13:34 -0400)
plugins/wikipedia/popcorn.wikipedia.js
plugins/wikipedia/popcorn.wikipedia.unit.js

index 0bc841fbd973cca7ffc49d959ceed668fc04d7b1..e26e6da1b2cc25eac385a971e272a3348f97a080 100755 (executable)
@@ -22,12 +22,12 @@ var wikiCallback;
    * @param {Object} options
    * 
    * Example:
-     var p = Popcorn('#video')
+     var p = Popcorn("#video")
         .wikipedia({
           start: 5, // seconds
           end: 15, // seconds
-          src: 'http://en.wikipedia.org/wiki/Cape_Town',
-          target: 'wikidiv'
+          src: "http://en.wikipedia.org/wiki/Cape_Town",
+          target: "wikidiv"
         } )
    *
    */
@@ -42,36 +42,36 @@ var wikiCallback;
       },
       options:{
         start: {
-          elem: 'input', 
-          type: 'text', 
-          label: 'In'
+          elem: "input", 
+          type: "text", 
+          label: "In"
         },
         end: {
-          elem: 'input', 
-          type: 'text', 
-          label: 'Out'
+          elem: "input", 
+          type: "text", 
+          label: "Out"
         },
         lang: {
-          elem: 'input', 
-          type: 'text', 
-          label: 'Language'
+          elem: "input", 
+          type: "text", 
+          label: "Language"
         },
         src: {
-          elem: 'input', 
-          type: 'text', 
-          label: 'Src'
+          elem: "input", 
+          type: "text", 
+          label: "Src"
         },
         title: {
-          elem: 'input', 
-          type: 'text', 
-          label: 'Title'
+          elem: "input", 
+          type: "text", 
+          label: "Title"
         },
         numberofwords: {
-          elem: 'input', 
-          type: 'text', 
-          label: 'Num Of Words'
+          elem: "input", 
+          type: "text", 
+          label: "Num Of Words"
         },
-        target: 'wikipedia-container'
+        target: "wikipedia-container"
       }
     },
     /**
@@ -88,7 +88,7 @@ var wikiCallback;
       var  _text, _guid = Popcorn.guid(); 
       
       // if the user didn't specify a language default to english
-      if ( typeof options.lang === 'undefined' ) { 
+      if ( !options.lang ) { 
         options.lang = "en"; 
       }
 
@@ -100,18 +100,18 @@ var wikiCallback;
       // and stores it by appending values to the options object
       window[ "wikiCallback" + _guid ]  = function ( data ) { 
 
-        options._link = document.createElement( 'a' );
-        options._link.setAttribute( 'href', options.src );
-        options._link.setAttribute( 'target', '_blank' );
+        options._link = document.createElement( "a" );
+        options._link.setAttribute( "href", options.src );
+        options._link.setAttribute( "target", "_blank" );
 
         // add the title of the article to the link
         options._link.innerHTML = options.title || data.parse.displaytitle;
 
         // get the content of the wiki article
-        options._desc = document.createElement( 'p' );
+        options._desc = document.createElement( "p" );
 
         // get the article text and remove any special characters
-        _text = data.parse.text[ "*" ].substr( data.parse.text[ "*" ].indexOf( '<p>' ) );
+        _text = data.parse.text[ "*" ].substr( data.parse.text[ "*" ].indexOf( "<p>" ) );
         _text = _text.replace( /((<(.|\n)+?>)|(\((.*?)\) )|(\[(.*?)\]))/g, "" );
         options._desc.innerHTML = _text.substr( 0,  options.numberofwords ) + " ...";
         
@@ -171,11 +171,11 @@ var wikiCallback;
 
     _teardown: function( options ){
 
-        if ( options._added ) {
-          options._link.parentNode && document.getElementById( options.target ).removeChild( options._link );
-          options._desc.parentNode && document.getElementById( options.target ).removeChild( options._desc );
-          delete options.target;
-        }
+      if ( options._added ) {
+        options._link.parentNode && document.getElementById( options.target ).removeChild( options._link );
+        options._desc.parentNode && document.getElementById( options.target ).removeChild( options._desc );
+        delete options.target;
+      }
     }
   });
 
index f24629f80e3ff2e1fa0c3a0097434343c04e4110..d30de47bbb5103c6335a185e7b6a7346972156c8 100755 (executable)
@@ -3,7 +3,7 @@ test("Popcorn wikipedia Plugin", function () {
   var popped        = Popcorn( "#video" ),
       expects       = 11, 
       count         = 0,
-      theArticle    = document.getElementById( 'wikidiv' );
+      theArticle    = document.getElementById( "wikidiv" );
        
   expect( expects );
   
@@ -15,7 +15,7 @@ test("Popcorn wikipedia Plugin", function () {
   
   stop();
    
-  ok ( 'wikipedia' in popped, "wikipedia is a mehtod of the popped instance" );
+  ok ( "wikipedia" in popped, "wikipedia is a mehtod of the popped instance" );
   plus();
   
   equals ( theArticle.innerHTML, "", "initially, there is nothing in the wikidiv" );
@@ -24,15 +24,15 @@ test("Popcorn wikipedia Plugin", function () {
   popped.wikipedia({
       start: 1, // seconds
       end: 3, // seconds
-      src: 'http://en.wikipedia.org/wiki/Cape_Town',
+      src: "http://en.wikipedia.org/wiki/Cape_Town",
       title: "this is an article",
-      target: 'wikidiv'
+      target: "wikidiv"
     } )
     .wikipedia({
       start: 4, // seconds
       end: 5, // seconds
-      src: 'http://en.wikipedia.org/wiki/S%C3%A3o_Paulo',
-      target: 'wikidiv'
+      src: "http://en.wikipedia.org/wiki/S%C3%A3o_Paulo",
+      target: "wikidiv"
     } )
     .volume(0)
     .play();