From b2d691d3420a8bdc8035e73f6fd5a56e74e2f820 Mon Sep 17 00:00:00 2001 From: "David Humphrey (:humph) david.humphrey@senecacollege.ca" Date: Thu, 3 May 2012 17:11:46 -0400 Subject: [PATCH] Fix text plugin style nits, add multiline property to manifest --- plugins/text/popcorn.text.js | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/plugins/text/popcorn.text.js b/plugins/text/popcorn.text.js index 21092f72..6c531232 100755 --- a/plugins/text/popcorn.text.js +++ b/plugins/text/popcorn.text.js @@ -20,39 +20,39 @@ * var p = Popcorn('#video') * * // Simple text - * .text( { + * .text({ * start: 5, // seconds * end: 15, // seconds * text: 'This video made exclusively for drumbeat.org', * target: 'textdiv' - * } ) + * }) * * // HTML text, rendered as HTML - * .text( { + * .text({ * start: 15, // seconds * end: 20, // seconds * text: '

This video made exclusively for drumbeat.org

', * target: 'textdiv' - * } ) + * }) * * // HTML text, escaped and rendered as plain text - * .text( { + * .text({ * start: 20, // seconds * end: 25, // seconds * text: 'This is an HTML p element:

paragraph

', * escape: true, * target: 'textdiv' - * } ); + * }); * * // Multi-Line HTML text, escaped and rendered as plain text - * .text( { + * .text({ * start: 25, // seconds * end: 30, // seconds * text: 'This is an HTML p element:

paragraph

\nThis is an HTML b element: bold', * escape: true, * multiline: true, * target: 'textdiv' - * } ); + * }); **/ /** @@ -108,7 +108,12 @@ type: "checkbox", label: "Escape" }, - target: name + "-container" + multiline: { + elem: "input", + type: "checkbox", + label: "Multiline" + }, + target: "text-container" } }, @@ -126,13 +131,11 @@ text = !!options.multiline ? newlineToBreak ( text ) : text; container.innerHTML = text; - if ( target ) { - target.appendChild( container ); - } else { - if ( Popcorn.plugin.debug ) { - throw new Error( "target container doesn't exist" ); - } + if ( !target ) { + throw new Error( "target container doesn't exist" ); } + + target.appendChild( container ); }, /**