зеркало из https://github.com/mozilla/popcorn-js.git
target.options fixed [#256 state:peer-review-requested]
This commit is contained in:
Родитель
a64396da1c
Коммит
0249621d94
|
@ -60,7 +60,9 @@
|
|||
_setup: function( options ) {
|
||||
options.container = document.createElement( 'div' );
|
||||
options.container.style.display = "none";
|
||||
document.getElementById( options.target ).appendChild( options.container );
|
||||
if ( document.getElementById( options.target ) ) {
|
||||
document.getElementById( options.target ).appendChild( options.container );
|
||||
}
|
||||
var height = options.height || "50px",
|
||||
width = options.width || "50px",
|
||||
count = options.numberofimages || 4,
|
||||
|
|
|
@ -44,8 +44,9 @@
|
|||
options._container = document.createElement( 'div' );
|
||||
options._container.style.display = "none";
|
||||
options._container.innerHTML = options.text;
|
||||
options.target = document.getElementById( options.target );
|
||||
options.target.appendChild( options._container );
|
||||
if ( document.getElementById( options.target ) ) {
|
||||
document.getElementById( options.target ).appendChild( options._container );
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @member footnote
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
_setup : function( options ) {
|
||||
|
||||
options.container = document.createElement( 'div' );
|
||||
|
||||
document.getElementById( options.target ).appendChild( options.container );
|
||||
|
||||
if ( document.getElementById( options.target ) ) {
|
||||
document.getElementById( options.target ).appendChild( options.container );
|
||||
}
|
||||
var newsShow = new google.elements.NewsShow( options.container, {
|
||||
format : "300x250",
|
||||
queryList : [
|
||||
|
|
|
@ -52,9 +52,9 @@
|
|||
options.link.href = options.href;
|
||||
}
|
||||
options.link.target = "_blank";
|
||||
|
||||
document.getElementById( options.target ).appendChild( options.link ); // add the widget's div to the target div
|
||||
|
||||
if ( document.getElementById( options.target ) ) {
|
||||
document.getElementById( options.target ).appendChild( options.link ); // add the widget's div to the target div
|
||||
}
|
||||
var img = document.createElement( 'img' );
|
||||
img.src = options.src;
|
||||
img.style.borderStyle = "none"; // borders look really bad, if someone wants it they can put it on their div target
|
||||
|
|
|
@ -81,7 +81,9 @@
|
|||
*/
|
||||
start: function(event, options){
|
||||
options._p.contains[options.person] = options.person;
|
||||
document.getElementById(options.target).innerHTML = options._p.toString();
|
||||
if (document.getElementById(options.target)) {
|
||||
document.getElementById(options.target).innerHTML = options._p.toString();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @member tagthisperson
|
||||
|
@ -91,7 +93,9 @@
|
|||
*/
|
||||
end: function(event, options){
|
||||
delete options._p.contains[options.person];
|
||||
document.getElementById(options.target).innerHTML = options._p.toString();
|
||||
if (document.getElementById(options.target)) {
|
||||
document.getElementById(options.target).innerHTML = options._p.toString();
|
||||
}
|
||||
}
|
||||
};
|
||||
})());
|
||||
|
|
|
@ -64,8 +64,9 @@
|
|||
options.container = document.createElement( 'div' ); // create the div to store the widget
|
||||
options.container.setAttribute('id', Popcorn.guid()); // use this id to connect it to the widget
|
||||
options.container.style.display = "none"; // display none by default
|
||||
document.getElementById( options.target ).appendChild( options.container ); // add the widget's div to the target div
|
||||
|
||||
if ( document.getElementById( options.target ) ) {
|
||||
document.getElementById( options.target ).appendChild( options.container ); // add the widget's div to the target div
|
||||
}
|
||||
// setup info for the widget
|
||||
var src = options.src || "",
|
||||
width = options.width || 250,
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
}
|
||||
},
|
||||
_setup : function( options ) {
|
||||
options.target = document.getElementById( options.target );
|
||||
// make an iframe
|
||||
options._iframe = document.createElement( 'iframe' ),
|
||||
options._iframe.setAttribute('width', "100%");
|
||||
|
@ -53,8 +52,10 @@
|
|||
options._iframe.id = options.id;
|
||||
options._iframe.src = options.src;
|
||||
options._iframe.style.display = 'none';
|
||||
// add the hidden iframe to the DON
|
||||
options.target.appendChild(options._iframe);
|
||||
// add the hidden iframe to the DOM
|
||||
if ( document.getElementById( options.target ) ) {
|
||||
document.getElementById( options.target ).appendChild(options._iframe);
|
||||
}
|
||||
|
||||
},
|
||||
/**
|
||||
|
|
|
@ -67,9 +67,7 @@ var wikiCallback;
|
|||
if (typeof options.lang === 'undefined') { options.lang ="en"; }
|
||||
// if the user didn't specify number of words to use default to 200
|
||||
options.numberofwords = options.numberofwords || 200;
|
||||
// replace the user specified target with the actual DOM element
|
||||
options.target = document.getElementById( options.target );
|
||||
|
||||
|
||||
// wiki global callback function with a unique id
|
||||
// function gets the needed information from wikipedia
|
||||
// and stores it by appending values to the options object
|
||||
|
@ -112,9 +110,11 @@ var wikiCallback;
|
|||
} else {
|
||||
|
||||
if (options._link && options._desc) {
|
||||
options.target.appendChild(options._link);
|
||||
options.target.appendChild(options._desc);
|
||||
options._added = true;
|
||||
if ( document.getElementById( options.target ) ) {
|
||||
document.getElementById( options.target ).appendChild(options._link);
|
||||
document.getElementById( options.target ).appendChild(options._desc);
|
||||
options._added = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -131,8 +131,8 @@ var wikiCallback;
|
|||
// ensure that the data was actually added to the
|
||||
// DOM before removal
|
||||
if (options._added) {
|
||||
options.target.removeChild(options._link);
|
||||
options.target.removeChild(options._desc);
|
||||
document.getElementById( options.target ).removeChild(options._link);
|
||||
document.getElementById( options.target ).removeChild(options._desc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче