From 7e01635dd1b1b386e82fbfb45521e0613569f2a0 Mon Sep 17 00:00:00 2001 From: ScottDowne Date: Tue, 21 Jun 2011 19:08:16 -0400 Subject: [PATCH] [#t366] created applyclass effect, appied applyclass to semantic demo --- demos/semantic_video/index.html | 280 +----------------- demos/semantic_video/style.css | 3 +- demos/semantic_video/xml/webMadeMovies.xml | 2 +- .../popcorn.applyclass.html} | 31 +- effects/applyclass/popcorn.applyclass.js | 88 ++++++ effects/applyclass/style.css | 26 ++ effects/expand/popcorn.expand.js | 71 ----- effects/flash/popcorn.flash.html | 58 ---- effects/flash/popcorn.flash.js | 71 ----- 9 files changed, 134 insertions(+), 496 deletions(-) rename effects/{expand/popcorn.expand.html => applyclass/popcorn.applyclass.html} (63%) mode change 100755 => 100644 create mode 100644 effects/applyclass/popcorn.applyclass.js create mode 100644 effects/applyclass/style.css delete mode 100755 effects/expand/popcorn.expand.js delete mode 100644 effects/flash/popcorn.flash.html delete mode 100644 effects/flash/popcorn.flash.js diff --git a/demos/semantic_video/index.html b/demos/semantic_video/index.html index aa7c243..8a6cccf 100644 --- a/demos/semantic_video/index.html +++ b/demos/semantic_video/index.html @@ -17,6 +17,7 @@ + @@ -108,290 +109,11 @@
- -
-
diff --git a/demos/semantic_video/style.css b/demos/semantic_video/style.css index ed2a329..a1cbb48 100644 --- a/demos/semantic_video/style.css +++ b/demos/semantic_video/style.css @@ -423,9 +423,8 @@ border: 1px solid #d9d9d9; margin-bottom: 15px; } -.overlay{ +.applyoverlay{ z-index: 9001; -display: none; top: 0px; left: 0px; opacity: 0.2; diff --git a/demos/semantic_video/xml/webMadeMovies.xml b/demos/semantic_video/xml/webMadeMovies.xml index c13a4a4..36b9821 100644 --- a/demos/semantic_video/xml/webMadeMovies.xml +++ b/demos/semantic_video/xml/webMadeMovies.xml @@ -81,7 +81,7 @@ - + Look around the page as info is updated! diff --git a/effects/expand/popcorn.expand.html b/effects/applyclass/popcorn.applyclass.html old mode 100755 new mode 100644 similarity index 63% rename from effects/expand/popcorn.expand.html rename to effects/applyclass/popcorn.applyclass.html index ca26d8b..a34052b --- a/effects/expand/popcorn.expand.html +++ b/effects/applyclass/popcorn.applyclass.html @@ -5,28 +5,29 @@ - + + @@ -38,7 +39,7 @@
-
+
+
+
diff --git a/effects/applyclass/popcorn.applyclass.js b/effects/applyclass/popcorn.applyclass.js new file mode 100644 index 0000000..3718409 --- /dev/null +++ b/effects/applyclass/popcorn.applyclass.js @@ -0,0 +1,88 @@ +// EFFECT: applyclass + +(function (Popcorn) { + + /** + * apply css class to jquery selector + * selector is relative to plugin target's id + * so .overlay is actually $( "#target .overlay") + * + * @param {Object} options + * + * Example: + var p = Popcorn('#video') + .footnote({ + start: 5, // seconds + end: 15, // seconds + text: 'This video made exclusively for drumbeat.org', + target: 'footnotediv', + effect: 'applyclass', + applyclass: 'selector: class' + }) + * + */ + + var startFunction = Popcorn.nop, + applyFunction = function() { + + startFunction = function( event, options ) { + + Popcorn.forEach( options.classes, function( val, key ) { + + var obj; + if ( key === "parent" ) { + + obj = $("#" + options.target ).parent(); + } else { + + obj = $("#" + options.target + " " + key ); + } + + obj.addClass( val ); + setTimeout( function() { + + obj.removeClass( val ); + }, 250 ); + }); + }; + }; + + if ( typeof $ !== "undefined" ) { + + applyFunction(); + } else { + + Popcorn.getScript( "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js", applyFunction ); + } + + Popcorn.compose( "applyclass", { + + manifest: { + about: { + name: "Popcorn applyclass Effect", + version: "0.1", + author: "@scottdowne", + website: "scottdowne.wordpress.com" + }, + options: {} + }, + _setup: function( options ) { + + options.classes = {}; + + var array = options.applyclass.replace( /\s/g, "" ).split( "," ), + item = [], + idx = 0, len = array.length; + + for ( ; idx < len; idx++ ) { + + item = array[ idx ].split( ":"); + options.classes[ item[ 0 ] ] = item[ 1 ]; + } + }, + start: function( event, options ) { + + startFunction.call( this, event, options ); + } + }); +})( Popcorn ); diff --git a/effects/applyclass/style.css b/effects/applyclass/style.css new file mode 100644 index 0000000..acfaa28 --- /dev/null +++ b/effects/applyclass/style.css @@ -0,0 +1,26 @@ +.applyoverlay { + z-index: 9001; + top: 0px; + left: 0px; + opacity: 0.2; + filter: alpha(opacity=20); + height: 100%; + width: 100%; + background: red; + position: absolute; +} + +section { + display: inline-block; +} + +section.hover { + -webkit-box-shadow: -1px 1px 1px #bdc7c6; + -moz-box-shadow: -1px 1px 1px #bdc7c6; + box-shadow: -1px 1px 1px #bdc7c6; + border: 1px solid #333; + -moz-transform: scale(1.02);-webkit-transform: scale(1.02); + z-index: 999; + background: #FFF; +} + diff --git a/effects/expand/popcorn.expand.js b/effects/expand/popcorn.expand.js deleted file mode 100755 index 6c77e09..0000000 --- a/effects/expand/popcorn.expand.js +++ /dev/null @@ -1,71 +0,0 @@ -// EFFECT: flash - -(function (Popcorn) { - - /** - * Flash effect - * Adds a coloured flash to the background of plugins. - * Optional parameters are flashcolor, which accepts a css colour. Defaults to red. - * - * @param {Object} options - * - * Example: - var p = Popcorn('#video') - .footnote({ - start: 5, // seconds - end: 15, // seconds - text: 'This video made exclusively for drumbeat.org', - target: 'footnotediv', - effect: 'flash', - flashcolor: "green" - } ) - * - */ - - var startFunction = Popcorn.nop, - endFunction = Popcorn.nop; - - Popcorn.getScript( "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js", function() { - startFunction = function( event, options ) { - - $( options.redDiv ).css( "display", "inline" ).css( "left", 0 ).fadeOut( 250 ); - }; - }); - - Popcorn.compose( "flash" , { - - manifest: { - about:{ - name: "Popcorn flash Effect", - version: "0.1", - author: "@scottdowne", - website: "scottdowne.wordpress.com" - }, - options:{ - effect: true - } - }, - _setup: function( options ) { - - options.redDiv = document.createElement( "span" ); - options.redDiv.style.position = "absolute"; - options.redDiv.style.opacity = 0.8; - options.redDiv.style.backgroundColor = options.flashcolor || "red"; - options.redDiv.style.height = "100%"; - options.redDiv.style.width = "100%"; - options.redDiv.style.zindex = options._container.style.zIndex + 1; - options.redDiv.style.display = "none"; - - options._container.style.position = "relative"; - options._container.appendChild( options.redDiv ); - }, - start: function( event, options ) { - - startFunction.call( this, event, options ); - }, - _teardown: function( options ) { - - options.redDiv.parentNode && options._container.removeChild( options.redDiv ); - } - }); -})( Popcorn ); diff --git a/effects/flash/popcorn.flash.html b/effects/flash/popcorn.flash.html deleted file mode 100644 index ca26d8b..0000000 --- a/effects/flash/popcorn.flash.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - Popcorn flash effect Demo - - - - - - - -

Popcorn flash effect Demo

-

A footnote with a red flash displaying This video made exclusively for drumbeat.org' will appear at 5 seconds and disappear at 15 seconds.

-

A footnote with a green flash displaying 'Visit webmademovies.org for more details' will appear at 20 seconds and disappear at 45 seconds.

-
- -
-
- - diff --git a/effects/flash/popcorn.flash.js b/effects/flash/popcorn.flash.js deleted file mode 100644 index 6c77e09..0000000 --- a/effects/flash/popcorn.flash.js +++ /dev/null @@ -1,71 +0,0 @@ -// EFFECT: flash - -(function (Popcorn) { - - /** - * Flash effect - * Adds a coloured flash to the background of plugins. - * Optional parameters are flashcolor, which accepts a css colour. Defaults to red. - * - * @param {Object} options - * - * Example: - var p = Popcorn('#video') - .footnote({ - start: 5, // seconds - end: 15, // seconds - text: 'This video made exclusively for drumbeat.org', - target: 'footnotediv', - effect: 'flash', - flashcolor: "green" - } ) - * - */ - - var startFunction = Popcorn.nop, - endFunction = Popcorn.nop; - - Popcorn.getScript( "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js", function() { - startFunction = function( event, options ) { - - $( options.redDiv ).css( "display", "inline" ).css( "left", 0 ).fadeOut( 250 ); - }; - }); - - Popcorn.compose( "flash" , { - - manifest: { - about:{ - name: "Popcorn flash Effect", - version: "0.1", - author: "@scottdowne", - website: "scottdowne.wordpress.com" - }, - options:{ - effect: true - } - }, - _setup: function( options ) { - - options.redDiv = document.createElement( "span" ); - options.redDiv.style.position = "absolute"; - options.redDiv.style.opacity = 0.8; - options.redDiv.style.backgroundColor = options.flashcolor || "red"; - options.redDiv.style.height = "100%"; - options.redDiv.style.width = "100%"; - options.redDiv.style.zindex = options._container.style.zIndex + 1; - options.redDiv.style.display = "none"; - - options._container.style.position = "relative"; - options._container.appendChild( options.redDiv ); - }, - start: function( event, options ) { - - startFunction.call( this, event, options ); - }, - _teardown: function( options ) { - - options.redDiv.parentNode && options._container.removeChild( options.redDiv ); - } - }); -})( Popcorn ); -- 2.43.0