зеркало из https://github.com/mozilla/popcorn-js.git
[#578] Made some style fixes
This commit is contained in:
Родитель
c22734eff5
Коммит
ded66ccbad
|
@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Загрузка…
Ссылка в новой задаче