_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,
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
_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 : [
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
*/
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
*/
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();
+ }
}
};
})());
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,
}
},
_setup : function( options ) {
- options.target = document.getElementById( options.target );
// make an iframe
options._iframe = document.createElement( 'iframe' ),
options._iframe.setAttribute('width', "100%");
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);
+ }
},
/**
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
} 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;
+ }
}
}
};
// 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);
}
}