aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorMohamed Mujahid <muja_dd@494418.no-reply.drupal.org>2010-07-06 17:04:02 +0000
committerMohamed Mujahid <muja_dd@494418.no-reply.drupal.org>2010-07-06 17:04:02 +0000
commit0c8e7ae689eed6291bb2061c9c75e3057b230339 (patch)
treef0a8ef699214db00367763ba5f30c748d106fd69 /js
parent8041073c8d74e5d24e3b9f10143f3e4bd04db2de (diff)
downloadvideo-0c8e7ae689eed6291bb2061c9c75e3057b230339.tar.gz
video-0c8e7ae689eed6291bb2061c9c75e3057b230339.tar.bz2
merging changes from DRUPAL-6--4
Diffstat (limited to 'js')
-rw-r--r--js/flowplayer-3.2.0.min.js24
-rw-r--r--js/jquery.media.js458
-rw-r--r--js/jquery.metadata.js148
-rw-r--r--js/video.js84
4 files changed, 714 insertions, 0 deletions
diff --git a/js/flowplayer-3.2.0.min.js b/js/flowplayer-3.2.0.min.js
new file mode 100644
index 0000000..2baa001
--- /dev/null
+++ b/js/flowplayer-3.2.0.min.js
@@ -0,0 +1,24 @@
+/*
+ * flowplayer.js 3.2.0. The Flowplayer API
+ *
+ * Copyright 2009 Flowplayer Oy
+ *
+ * This file is part of Flowplayer.
+ *
+ * Flowplayer is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Flowplayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Flowplayer. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Date: 2010-05-03 20:23:59 +0000 (Mon, 03 May 2010)
+ * Revision: 468
+ */
+(function(){function g(o){console.log("$f.fireEvent",[].slice.call(o))}function k(q){if(!q||typeof q!="object"){return q}var o=new q.constructor();for(var p in q){if(q.hasOwnProperty(p)){o[p]=k(q[p])}}return o}function m(t,q){if(!t){return}var o,p=0,r=t.length;if(r===undefined){for(o in t){if(q.call(t[o],o,t[o])===false){break}}}else{for(var s=t[0];p<r&&q.call(s,p,s)!==false;s=t[++p]){}}return t}function c(o){return document.getElementById(o)}function i(q,p,o){if(typeof p!="object"){return q}if(q&&p){m(p,function(r,s){if(!o||typeof s!="function"){q[r]=s}})}return q}function n(s){var q=s.indexOf(".");if(q!=-1){var p=s.slice(0,q)||"*";var o=s.slice(q+1,s.length);var r=[];m(document.getElementsByTagName(p),function(){if(this.className&&this.className.indexOf(o)!=-1){r.push(this)}});return r}}function f(o){o=o||window.event;if(o.preventDefault){o.stopPropagation();o.preventDefault()}else{o.returnValue=false;o.cancelBubble=true}return false}function j(q,o,p){q[o]=q[o]||[];q[o].push(p)}function e(){return"_"+(""+Math.random()).slice(2,10)}var h=function(t,r,s){var q=this,p={},u={};q.index=r;if(typeof t=="string"){t={url:t}}i(this,t,true);m(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","),function(){var v="on"+this;if(v.indexOf("*")!=-1){v=v.slice(0,v.length-1);var w="onBefore"+v.slice(2);q[w]=function(x){j(u,w,x);return q}}q[v]=function(x){j(u,v,x);return q};if(r==-1){if(q[w]){s[w]=q[w]}if(q[v]){s[v]=q[v]}}});i(this,{onCuepoint:function(x,w){if(arguments.length==1){p.embedded=[null,x];return q}if(typeof x=="number"){x=[x]}var v=e();p[v]=[x,w];if(s.isLoaded()){s._api().fp_addCuepoints(x,r,v)}return q},update:function(w){i(q,w);if(s.isLoaded()){s._api().fp_updateClip(w,r)}var v=s.getConfig();var x=(r==-1)?v.clip:v.playlist[r];i(x,w,true)},_fireEvent:function(v,y,w,A){if(v=="onLoad"){m(p,function(B,C){if(C[0]){s._api().fp_addCuepoints(C[0],r,B)}});return false}A=A||q;if(v=="onCuepoint"){var z=p[y];if(z){return z[1].call(s,A,w)}}if(y&&"onBeforeBegin,onMetaData,onStart,onUpdate,onResume".indexOf(v)!=-1){i(A,y);if(y.metaData){if(!A.duration){A.duration=y.metaData.duration}else{A.fullDuration=y.metaData.duration}}}var x=true;m(u[v],function(){x=this.call(s,A,y,w)});return x}});if(t.onCuepoint){var o=t.onCuepoint;q.onCuepoint.apply(q,typeof o=="function"?[o]:o);delete t.onCuepoint}m(t,function(v,w){if(typeof w=="function"){j(u,v,w);delete t[v]}});if(r==-1){s.onCuepoint=this.onCuepoint}};var l=function(p,r,q,t){var o=this,s={},u=false;if(t){i(s,t)}m(r,function(v,w){if(typeof w=="function"){s[v]=w;delete r[v]}});i(this,{animate:function(y,z,x){if(!y){return o}if(typeof z=="function"){x=z;z=500}if(typeof y=="string"){var w=y;y={};y[w]=z;z=500}if(x){var v=e();s[v]=x}if(z===undefined){z=500}r=q._api().fp_animate(p,y,z,v);return o},css:function(w,x){if(x!==undefined){var v={};v[w]=x;w=v}r=q._api().fp_css(p,w);i(o,r);return o},show:function(){this.display="block";q._api().fp_showPlugin(p);return o},hide:function(){this.display="none";q._api().fp_hidePlugin(p);return o},toggle:function(){this.display=q._api().fp_togglePlugin(p);return o},fadeTo:function(y,x,w){if(typeof x=="function"){w=x;x=500}if(w){var v=e();s[v]=w}this.display=q._api().fp_fadeTo(p,y,x,v);this.opacity=y;return o},fadeIn:function(w,v){return o.fadeTo(1,w,v)},fadeOut:function(w,v){return o.fadeTo(0,w,v)},getName:function(){return p},getPlayer:function(){return q},_fireEvent:function(w,v,x){if(w=="onUpdate"){var y=q._api().fp_getPlugin(p);if(!y){return}i(o,y);delete o.methods;if(!u){m(y.methods,function(){var A=""+this;o[A]=function(){var B=[].slice.call(arguments);var C=q._api().fp_invoke(p,A,B);return C==="undefined"||C===undefined?o:C}});u=true}}var z=s[w];if(z){z.apply(o,v);if(w.slice(0,1)=="_"){delete s[w]}}return o}})};function b(q,G,t){var w=this,v=null,D=false,u,s,F=[],y={},x={},E,r,p,C,o,A;i(w,{id:function(){return E},isLoaded:function(){return(v!==null&&!D)},getParent:function(){return q},hide:function(H){if(H){q.style.height="0px"}if(w.isLoaded()){v.style.height="0px"}return w},show:function(){q.style.height=A+"px";if(w.isLoaded()){v.style.height=o+"px"}return w},isHidden:function(){return w.isLoaded()&&parseInt(v.style.height,10)===0},load:function(J){if(!w.isLoaded()&&w._fireEvent("onBeforeLoad")!==false){var H=function(){u=q.innerHTML;if(u&&!flashembed.isSupported(G.version)){q.innerHTML=""}flashembed(q,G,{config:t});if(J){J.cached=true;j(x,"onLoad",J)}};var I=0;m(a,function(){this.unload(function(K){if(++I==a.length){H()}})})}return w},unload:function(J){if(this.isFullscreen()&&/WebKit/i.test(navigator.userAgent)){if(J){J(false)}return w}if(u.replace(/\s/g,"")!==""){if(w._fireEvent("onBeforeUnload")===false){if(J){J(false)}return w}D=true;try{if(v){v.fp_close();w._fireEvent("onUnload")}}catch(H){}var I=function(){v=null;q.innerHTML=u;D=false;if(J){J(true)}};setTimeout(I,50)}else{if(J){J(false)}}return w},getClip:function(H){if(H===undefined){H=C}return F[H]},getCommonClip:function(){return s},getPlaylist:function(){return F},getPlugin:function(H){var J=y[H];if(!J&&w.isLoaded()){var I=w._api().fp_getPlugin(H);if(I){J=new l(H,I,w);y[H]=J}}return J},getScreen:function(){return w.getPlugin("screen")},getControls:function(){return w.getPlugin("controls")._fireEvent("onUpdate")},getLogo:function(){try{return w.getPlugin("logo")._fireEvent("onUpdate")}catch(H){}},getPlay:function(){return w.getPlugin("play")._fireEvent("onUpdate")},getConfig:function(H){return H?k(t):t},getFlashParams:function(){return G},loadPlugin:function(K,J,M,L){if(typeof M=="function"){L=M;M={}}var I=L?e():"_";w._api().fp_loadPlugin(K,J,M,I);var H={};H[I]=L;var N=new l(K,null,w,H);y[K]=N;return N},getState:function(){return w.isLoaded()?v.fp_getState():-1},play:function(I,H){var J=function(){if(I!==undefined){w._api().fp_play(I,H)}else{w._api().fp_play()}};if(w.isLoaded()){J()}else{if(D){setTimeout(function(){w.play(I,H)},50)}else{w.load(function(){J()})}}return w},getVersion:function(){var I="flowplayer.js 3.2.0";if(w.isLoaded()){var H=v.fp_getVersion();H.push(I);return H}return I},_api:function(){if(!w.isLoaded()){throw"Flowplayer "+w.id()+" not loaded when calling an API method"}return v},setClip:function(H){w.setPlaylist([H]);return w},getIndex:function(){return p}});m(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,ClipAdd,Fullscreen*,FullscreenExit,Error,MouseOver,MouseOut").split(","),function(){var H="on"+this;if(H.indexOf("*")!=-1){H=H.slice(0,H.length-1);var I="onBefore"+H.slice(2);w[I]=function(J){j(x,I,J);return w}}w[H]=function(J){j(x,H,J);return w}});m(("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,toggleFullscreen,reset,close,setPlaylist,addClip,playFeed,setKeyboardShortcutsEnabled,isKeyboardShortcutsEnabled").split(","),function(){var H=this;w[H]=function(J,I){if(!w.isLoaded()){return w}var K=null;if(J!==undefined&&I!==undefined){K=v["fp_"+H](J,I)}else{K=(J===undefined)?v["fp_"+H]():v["fp_"+H](J)}return K==="undefined"||K===undefined?w:K}});w._fireEvent=function(Q){if(typeof Q=="string"){Q=[Q]}var R=Q[0],O=Q[1],M=Q[2],L=Q[3],K=0;if(t.debug){g(Q)}if(!w.isLoaded()&&R=="onLoad"&&O=="player"){v=v||c(r);o=v.clientHeight;m(F,function(){this._fireEvent("onLoad")});m(y,function(S,T){T._fireEvent("onUpdate")});s._fireEvent("onLoad")}if(R=="onLoad"&&O!="player"){return}if(R=="onError"){if(typeof O=="string"||(typeof O=="number"&&typeof M=="number")){O=M;M=L}}if(R=="onContextMenu"){m(t.contextMenu[O],function(S,T){T.call(w)});return}if(R=="onPluginEvent"){var H=O.name||O;var I=y[H];if(I){I._fireEvent("onUpdate",O);I._fireEvent(M,Q.slice(3))}return}if(R=="onPlaylistReplace"){F=[];var N=0;m(O,function(){F.push(new h(this,N++,w))})}if(R=="onClipAdd"){if(O.isInStream){return}O=new h(O,M,w);F.splice(M,0,O);for(K=M+1;K<F.length;K++){F[K].index++}}var P=true;if(typeof O=="number"&&O<F.length){C=O;var J=F[O];if(J){P=J._fireEvent(R,M,L)}if(!J||P!==false){P=s._fireEvent(R,M,L,J)}}m(x[R],function(){P=this.call(w,O,M);if(this.cached){x[R].splice(K,1)}if(P===false){return false}K++});return P};function B(){if($f(q)){$f(q).getParent().innerHTML="";p=$f(q).getIndex();a[p]=w}else{a.push(w);p=a.length-1}A=parseInt(q.style.height,10)||q.clientHeight;E=q.id||"fp"+e();r=G.id||E+"_api";G.id=r;t.playerId=E;if(typeof t=="string"){t={clip:{url:t}}}if(typeof t.clip=="string"){t.clip={url:t.clip}}t.clip=t.clip||{};if(q.getAttribute("href",2)&&!t.clip.url){t.clip.url=q.getAttribute("href",2)}s=new h(t.clip,-1,w);t.playlist=t.playlist||[t.clip];var H=0;m(t.playlist,function(){var J=this;if(typeof J=="object"&&J.length){J={url:""+J}}m(t.clip,function(K,L){if(L!==undefined&&J[K]===undefined&&typeof L!="function"){J[K]=L}});t.playlist[H]=J;J=new h(J,H,w);F.push(J);H++});m(t,function(J,K){if(typeof K=="function"){if(s[J]){s[J](K)}else{j(x,J,K)}delete t[J]}});m(t.plugins,function(J,K){if(K){y[J]=new l(J,K,w)}});if(!t.plugins||t.plugins.controls===undefined){y.controls=new l("controls",null,w)}y.canvas=new l("canvas",null,w);function I(J){if(!w.isLoaded()&&w._fireEvent("onBeforeClick")!==false){w.load()}return f(J)}u=q.innerHTML;if(u.replace(/\s/g,"")!==""){if(q.addEventListener){q.addEventListener("click",I,false)}else{if(q.attachEvent){q.attachEvent("onclick",I)}}}else{if(q.addEventListener){q.addEventListener("click",f,false)}w.load()}}if(typeof q=="string"){var z=c(q);if(!z){throw"Flowplayer cannot access element: "+q}else{q=z;B()}}else{B()}}var a=[];function d(o){this.length=o.length;this.each=function(p){m(o,p)};this.size=function(){return o.length}}window.flowplayer=window.$f=function(){var p=null;var o=arguments[0];if(!arguments.length){m(a,function(){if(this.isLoaded()){p=this;return false}});return p||a[0]}if(arguments.length==1){if(typeof o=="number"){return a[o]}else{if(o=="*"){return new d(a)}m(a,function(){if(this.id()==o.id||this.id()==o||this.getParent()==o){p=this;return false}});return p}}if(arguments.length>1){var t=arguments[1],q=(arguments.length==3)?arguments[2]:{};if(typeof t=="string"){t={src:t}}t=i({bgcolor:"#000000",version:[9,0],expressInstall:"http://static.flowplayer.org/swf/expressinstall.swf",cachebusting:true},t);if(typeof o=="string"){if(o.indexOf(".")!=-1){var s=[];m(n(o),function(){s.push(new b(this,k(t),k(q)))});return new d(s)}else{var r=c(o);return new b(r!==null?r:o,t,q)}}else{if(o){return new b(o,t,q)}}}return null};i(window.$f,{fireEvent:function(){var o=[].slice.call(arguments);var q=$f(o[0]);return q?q._fireEvent(o.slice(1)):null},addPlugin:function(o,p){b.prototype[o]=p;return $f},each:m,extend:i});if(typeof jQuery=="function"){jQuery.fn.flowplayer=function(q,p){if(!arguments.length||typeof arguments[0]=="number"){var o=[];this.each(function(){var r=$f(this);if(r){o.push(r)}});return arguments.length?o[arguments[0]]:new d(o)}return this.each(function(){$f(this,k(q),p?k(p):{})})}}})();(function(){var h=document.all,j="http://www.adobe.com/go/getflashplayer",c=typeof jQuery=="function",e=/(\d+)[^\d]+(\d+)[^\d]*(\d*)/,b={width:"100%",height:"100%",id:"_"+(""+Math.random()).slice(9),allowfullscreen:true,allowscriptaccess:"always",quality:"high",version:[3,0],onFail:null,expressInstall:null,w3c:false,cachebusting:false};if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}})}function i(l,f){if(f){for(key in f){if(f.hasOwnProperty(key)){l[key]=f[key]}}}return l}function a(f,n){var m=[];for(var l in f){if(f.hasOwnProperty(l)){m[l]=n(f[l])}}return m}window.flashembed=function(f,m,l){if(typeof f=="string"){f=document.getElementById(f.replace("#",""))}if(!f){return}if(typeof m=="string"){m={src:m}}return new d(f,i(i({},b),m),l)};var g=i(window.flashembed,{conf:b,getVersion:function(){var f;try{f=navigator.plugins["Shockwave Flash"].description.slice(16)}catch(n){try{var l=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");f=l&&l.GetVariable("$version")}catch(m){}}f=e.exec(f);return[f[1],f[3]]},asString:function(l){if(l===null||l===undefined){return null}var f=typeof l;if(f=="object"&&l.push){f="array"}switch(f){case"string":l=l.replace(new RegExp('(["\\\\])',"g"),"\\$1");l=l.replace(/^\s?(\d+\.?\d+)%/,"$1pct");return'"'+l+'"';case"array":return"["+a(l,function(o){return g.asString(o)}).join(",")+"]";case"function":return'"function()"';case"object":var m=[];for(var n in l){if(l.hasOwnProperty(n)){m.push('"'+n+'":'+g.asString(l[n]))}}return"{"+m.join(",")+"}"}return String(l).replace(/\s/g," ").replace(/\'/g,'"')},getHTML:function(o,l){o=i({},o);var n='<object width="'+o.width+'" height="'+o.height+'" id="'+o.id+'"" name="'+o.id+'"';if(o.cachebusting){o.src+=((o.src.indexOf("?")!=-1?"&":"?")+Math.random())}if(o.w3c||!h){n+=' data="'+o.src+'" type="application/x-shockwave-flash"'}else{n+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'}n+=">";if(o.w3c||h){n+='<param name="movie" value="'+o.src+'" />'}o.width=o.height=o.id=o.w3c=o.src=null;o.onFail=o.version=o.expressInstall=null;for(var m in o){if(o[m]){n+='<param name="'+m+'" value="'+o[m]+'" />'}}var p="";if(l){for(var f in l){if(l[f]){var q=l[f];p+=f+"="+(/function|object/.test(typeof q)?g.asString(q):q)+"&"}}p=p.slice(0,-1);n+='<param name="flashvars" value=\''+p+"' />"}n+="</object>";return n},isSupported:function(f){return k[0]>f[0]||k[0]==f[0]&&k[1]>=f[1]}});var k=g.getVersion();function d(f,n,m){if(g.isSupported(n.version)){f.innerHTML=g.getHTML(n,m)}else{if(n.expressInstall&&g.isSupported([6,65])){f.innerHTML=g.getHTML(i(n,{src:n.expressInstall}),{MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title})}else{if(!f.innerHTML.replace(/\s/g,"")){f.innerHTML="<h2>Flash version "+n.version+" or greater is required</h2><h3>"+(k[0]>0?"Your version is "+k:"You have no flash plugin installed")+"</h3>"+(f.tagName=="A"?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='"+j+"'>here</a></p>");if(f.tagName=="A"){f.onclick=function(){location.href=j}}}if(n.onFail){var l=n.onFail.call(this);if(typeof l=="string"){f.innerHTML=l}}}}if(h){window[n.id]=document.getElementById(n.id)}i(this,{getRoot:function(){return f},getOptions:function(){return n},getConf:function(){return m},getApi:function(){return f.firstChild}})}if(c){jQuery.tools=jQuery.tools||{version:"3.2.0"};jQuery.tools.flashembed={conf:b};jQuery.fn.flashembed=function(l,f){return this.each(function(){$(this).data("flashembed",flashembed(this,l,f))})}}})(); \ No newline at end of file
diff --git a/js/jquery.media.js b/js/jquery.media.js
new file mode 100644
index 0000000..dcffa3c
--- /dev/null
+++ b/js/jquery.media.js
@@ -0,0 +1,458 @@
+/*
+ * jQuery Media Plugin for converting elements into rich media content.
+ *
+ * Examples and documentation at: http://malsup.com/jquery/media/
+ * Copyright (c) 2007-2008 M. Alsup
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * @author: M. Alsup
+ * @version: 0.92 (24-SEP-2009)
+ * @requires jQuery v1.1.2 or later
+ * $Id$
+ *
+ * Supported Media Players:
+ * - Flash
+ * - Quicktime
+ * - Real Player
+ * - Silverlight
+ * - Windows Media Player
+ * - iframe
+ *
+ * Supported Media Formats:
+ * Any types supported by the above players, such as:
+ * Video: asf, avi, flv, mov, mpg, mpeg, mp4, qt, smil, swf, wmv, 3g2, 3gp
+ * Audio: aif, aac, au, gsm, mid, midi, mov, mp3, m4a, snd, rm, wav, wma
+ * Other: bmp, html, pdf, psd, qif, qtif, qti, tif, tiff, xaml
+ *
+ * Thanks to Mark Hicken and Brent Pedersen for helping me debug this on the Mac!
+ * Thanks to Dan Rossi for numerous bug reports and code bits!
+ * Thanks to Skye Giordano for several great suggestions!
+ * Thanks to Richard Connamacher for excellent improvements to the non-IE behavior!
+ */
+;(function($) {
+
+/**
+ * Chainable method for converting elements into rich media.
+ *
+ * @param options
+ * @param callback fn invoked for each matched element before conversion
+ * @param callback fn invoked for each matched element after conversion
+ */
+$.fn.media = function(options, f1, f2) {
+ if (options == 'undo') {
+ return this.each(function() {
+ var $this = $(this);
+ var html = $this.data('media.origHTML');
+ if (html)
+ $this.replaceWith(html);
+ });
+ }
+
+ return this.each(function() {
+ if (typeof options == 'function') {
+ f2 = f1;
+ f1 = options;
+ options = {};
+ }
+ var o = getSettings(this, options);
+ // pre-conversion callback, passes original element and fully populated options
+ if (typeof f1 == 'function') f1(this, o);
+
+ var r = getTypesRegExp();
+ var m = r.exec(o.src.toLowerCase()) || [''];
+
+ o.type ? m[0] = o.type : m.shift();
+ for (var i=0; i < m.length; i++) {
+ fn = m[i].toLowerCase();
+ if (isDigit(fn[0])) fn = 'fn' + fn; // fns can't begin with numbers
+ if (!$.fn.media[fn])
+ continue; // unrecognized media type
+ // normalize autoplay settings
+ var player = $.fn.media[fn+'_player'];
+ if (!o.params) o.params = {};
+ if (player) {
+ var num = player.autoplayAttr == 'autostart';
+ o.params[player.autoplayAttr || 'autoplay'] = num ? (o.autoplay ? 1 : 0) : o.autoplay ? true : false;
+ }
+ var $div = $.fn.media[fn](this, o);
+
+ $div.css('backgroundColor', o.bgColor).width(o.width);
+
+ if (o.canUndo) {
+ var $temp = $('<div></div>').append(this);
+ $div.data('media.origHTML', $temp.html()); // store original markup
+ }
+
+ // post-conversion callback, passes original element, new div element and fully populated options
+ if (typeof f2 == 'function') f2(this, $div[0], o, player.name);
+ break;
+ }
+ });
+};
+
+/**
+ * Non-chainable method for adding or changing file format / player mapping
+ * @name mapFormat
+ * @param String format File format extension (ie: mov, wav, mp3)
+ * @param String player Player name to use for the format (one of: flash, quicktime, realplayer, winmedia, silverlight or iframe
+ */
+$.fn.media.mapFormat = function(format, player) {
+ if (!format || !player || !$.fn.media.defaults.players[player]) return; // invalid
+ format = format.toLowerCase();
+ if (isDigit(format[0])) format = 'fn' + format;
+ $.fn.media[format] = $.fn.media[player];
+ $.fn.media[format+'_player'] = $.fn.media.defaults.players[player];
+};
+
+// global defautls; override as needed
+$.fn.media.defaults = {
+ standards: false, // use object tags only (no embeds for non-IE browsers)
+ canUndo: true, // tells plugin to store the original markup so it can be reverted via: $(sel).mediaUndo()
+ width: 400,
+ height: 400,
+ autoplay: 0, // normalized cross-player setting
+ bgColor: '#ffffff', // background color
+ params: { wmode: 'transparent'}, // added to object element as param elements; added to embed element as attrs
+ attrs: {}, // added to object and embed elements as attrs
+ flvKeyName: 'file', // key used for object src param (thanks to Andrea Ercolino)
+ flashvars: {}, // added to flash content as flashvars param/attr
+ flashVersion: '7', // required flash version
+ expressInstaller: null, // src for express installer
+
+ // default flash video and mp3 player (@see: http://jeroenwijering.com/?item=Flash_Media_Player)
+ flvPlayer: 'mediaplayer.swf',
+ mp3Player: 'mediaplayer.swf',
+
+ // @see http://msdn2.microsoft.com/en-us/library/bb412401.aspx
+ silverlight: {
+ inplaceInstallPrompt: 'true', // display in-place install prompt?
+ isWindowless: 'true', // windowless mode (false for wrapping markup)
+ framerate: '24', // maximum framerate
+ version: '0.9', // Silverlight version
+ onError: null, // onError callback
+ onLoad: null, // onLoad callback
+ initParams: null, // object init params
+ userContext: null // callback arg passed to the load callback
+ }
+};
+
+// Media Players; think twice before overriding
+$.fn.media.defaults.players = {
+ flash: {
+ name: 'flash',
+ title: 'Flash',
+ types: 'flv,mp3,swf',
+ mimetype: 'application/x-shockwave-flash',
+ pluginspage: 'http://www.adobe.com/go/getflashplayer',
+ ieAttrs: {
+ classid: 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000',
+ type: 'application/x-oleobject',
+ codebase: 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + $.fn.media.defaults.flashVersion
+ }
+ },
+ quicktime: {
+ name: 'quicktime',
+ title: 'QuickTime',
+ mimetype: 'video/quicktime',
+ pluginspage: 'http://www.apple.com/quicktime/download/',
+ types: 'aif,aiff,aac,au,bmp,gsm,mov,mid,midi,mpg,mpeg,mp4,m4a,psd,qt,qtif,qif,qti,snd,tif,tiff,wav,3g2,3gp',
+ ieAttrs: {
+ classid: 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
+ codebase: 'http://www.apple.com/qtactivex/qtplugin.cab'
+ }
+ },
+ realplayer: {
+ name: 'real',
+ title: 'RealPlayer',
+ types: 'ra,ram,rm,rpm,rv,smi,smil',
+ mimetype: 'audio/x-pn-realaudio-plugin',
+ pluginspage: 'http://www.real.com/player/',
+ autoplayAttr: 'autostart',
+ ieAttrs: {
+ classid: 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'
+ }
+ },
+ winmedia: {
+ name: 'winmedia',
+ title: 'Windows Media',
+ types: 'asx,asf,avi,wma,wmv',
+ mimetype: $.browser.mozilla && isFirefoxWMPPluginInstalled() ? 'application/x-ms-wmp' : 'application/x-mplayer2',
+ pluginspage: 'http://www.microsoft.com/Windows/MediaPlayer/',
+ autoplayAttr: 'autostart',
+ oUrl: 'url',
+ ieAttrs: {
+ classid: 'clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6',
+ type: 'application/x-oleobject'
+ }
+ },
+ // special cases
+ iframe: {
+ name: 'iframe',
+ types: 'html,pdf'
+ },
+ silverlight: {
+ name: 'silverlight',
+ types: 'xaml'
+ }
+};
+
+//
+// everything below here is private
+//
+
+
+// detection script for FF WMP plugin (http://www.therossman.org/experiments/wmp_play.html)
+// (hat tip to Mark Ross for this script)
+function isFirefoxWMPPluginInstalled() {
+ var plugs = navigator.plugins;
+ for (var i = 0; i < plugs.length; i++) {
+ var plugin = plugs[i];
+ if (plugin['filename'] == 'np-mswmp.dll')
+ return true;
+ }
+ return false;
+}
+
+var counter = 1;
+
+for (var player in $.fn.media.defaults.players) {
+ var types = $.fn.media.defaults.players[player].types;
+ $.each(types.split(','), function(i,o) {
+ if (isDigit(o[0])) o = 'fn' + o;
+ $.fn.media[o] = $.fn.media[player] = getGenerator(player);
+ $.fn.media[o+'_player'] = $.fn.media.defaults.players[player];
+ });
+};
+
+function getTypesRegExp() {
+ var types = '';
+ for (var player in $.fn.media.defaults.players) {
+ if (types.length) types += ',';
+ types += $.fn.media.defaults.players[player].types;
+ };
+ return new RegExp('\\.(' + types.replace(/,/ig,'|') + ')\\b$');
+};
+
+function getGenerator(player) {
+ return function(el, options) {
+ return generate(el, options, player);
+ };
+};
+
+function isDigit(c) {
+ return '0123456789'.indexOf(c) > -1;
+};
+
+// flatten all possible options: global defaults, meta, option obj
+function getSettings(el, options) {
+ options = options || {};
+ var $el = $(el);
+ var cls = el.className || '';
+ // support metadata plugin (v1.0 and v2.0)
+ var meta = $.metadata ? $el.metadata() : $.meta ? $el.data() : {};
+ meta = meta || {};
+ var w = meta.width || parseInt(((cls.match(/w:(\d+)/)||[])[1]||0));
+ var h = meta.height || parseInt(((cls.match(/h:(\d+)/)||[])[1]||0));
+
+ if (w) meta.width = w;
+ if (h) meta.height = h;
+ if (cls) meta.cls = cls;
+
+ var a = $.fn.media.defaults;
+ var b = options;
+ var c = meta;
+
+ var p = { params: { bgColor: options.bgColor || $.fn.media.defaults.bgColor } };
+ var opts = $.extend({}, a, b, c);
+ $.each(['attrs','params','flashvars','silverlight'], function(i,o) {
+ opts[o] = $.extend({}, p[o] || {}, a[o] || {}, b[o] || {}, c[o] || {});
+ });
+
+ if (typeof opts.caption == 'undefined') opts.caption = $el.text();
+
+ // make sure we have a source!
+ opts.src = opts.src || $el.attr('href') || $el.attr('src') || 'unknown';
+ return opts;
+};
+
+//
+// Flash Player
+//
+
+// generate flash using SWFObject library if possible
+$.fn.media.swf = function(el, opts) {
+ if (!window.SWFObject && !window.swfobject) {
+ // roll our own
+ if (opts.flashvars) {
+ var a = [];
+ for (var f in opts.flashvars)
+ a.push(f + '=' + opts.flashvars[f]);
+ if (!opts.params) opts.params = {};
+ opts.params.flashvars = a.join('&');
+ }
+ return generate(el, opts, 'flash');
+ }
+
+ var id = el.id ? (' id="'+el.id+'"') : '';
+ var cls = opts.cls ? (' class="' + opts.cls + '"') : '';
+ var $div = $('<div' + id + cls + '>');
+
+ // swfobject v2+
+ if (window.swfobject) {
+ $(el).after($div).appendTo($div);
+ if (!el.id) el.id = 'movie_player_' + counter++;
+
+ // replace el with swfobject content
+ swfobject.embedSWF(opts.src, el.id, opts.width, opts.height, opts.flashVersion,
+ opts.expressInstaller, opts.flashvars, opts.params, opts.attrs);
+ }
+ // swfobject < v2
+ else {
+ $(el).after($div).remove();
+ var so = new SWFObject(opts.src, 'movie_player_' + counter++, opts.width, opts.height, opts.flashVersion, opts.bgColor);
+ if (opts.expressInstaller) so.useExpressInstall(opts.expressInstaller);
+
+ for (var p in opts.params)
+ if (p != 'bgColor') so.addParam(p, opts.params[p]);
+ for (var f in opts.flashvars)
+ so.addVariable(f, opts.flashvars[f]);
+ so.write($div[0]);
+ }
+
+ if (opts.caption) $('<div>').appendTo($div).html(opts.caption);
+ return $div;
+};
+
+// map flv and mp3 files to the swf player by default
+$.fn.media.flv = $.fn.media.mp3 = function(el, opts) {
+ var src = opts.src;
+ var player = /\.mp3\b/i.test(src) ? $.fn.media.defaults.mp3Player : $.fn.media.defaults.flvPlayer;
+ var key = opts.flvKeyName;
+ src = encodeURIComponent(src);
+ opts.src = player;
+ opts.src = opts.src + '?'+key+'=' + (src);
+ var srcObj = {};
+ srcObj[key] = src;
+ opts.flashvars = $.extend({}, srcObj, opts.flashvars );
+ return $.fn.media.swf(el, opts);
+};
+
+//
+// Silverlight
+//
+$.fn.media.xaml = function(el, opts) {
+ if (!window.Sys || !window.Sys.Silverlight) {
+ if ($.fn.media.xaml.warning) return;
+ $.fn.media.xaml.warning = 1;
+ alert('You must include the Silverlight.js script.');
+ return;
+ }
+
+ var props = {
+ width: opts.width,
+ height: opts.height,
+ background: opts.bgColor,
+ inplaceInstallPrompt: opts.silverlight.inplaceInstallPrompt,
+ isWindowless: opts.silverlight.isWindowless,
+ framerate: opts.silverlight.framerate,
+ version: opts.silverlight.version
+ };
+ var events = {
+ onError: opts.silverlight.onError,
+ onLoad: opts.silverlight.onLoad
+ };
+
+ var id1 = el.id ? (' id="'+el.id+'"') : '';
+ var id2 = opts.id || 'AG' + counter++;
+ // convert element to div
+ var cls = opts.cls ? (' class="' + opts.cls + '"') : '';
+ var $div = $('<div' + id1 + cls + '>');
+ $(el).after($div).remove();
+
+ Sys.Silverlight.createObjectEx({
+ source: opts.src,
+ initParams: opts.silverlight.initParams,
+ userContext: opts.silverlight.userContext,
+ id: id2,
+ parentElement: $div[0],
+ properties: props,
+ events: events
+ });
+
+ if (opts.caption) $('<div>').appendTo($div).html(opts.caption);
+ return $div;
+};
+
+//
+// generate object/embed markup
+//
+function generate(el, opts, player) {
+ var $el = $(el);
+ var o = $.fn.media.defaults.players[player];
+
+ if (player == 'iframe') {
+ var o = $('<iframe' + ' width="' + opts.width + '" height="' + opts.height + '" >');
+ o.attr('src', opts.src);
+ o.css('backgroundColor', o.bgColor);
+ }
+ else if ($.browser.msie) {
+ var a = ['<object width="' + opts.width + '" height="' + opts.height + '" '];
+ for (var key in opts.attrs)
+ a.push(key + '="'+opts.attrs[key]+'" ');
+ for (var key in o.ieAttrs || {}) {
+ var v = o.ieAttrs[key];
+ if (key == 'codebase' && window.location.protocol == 'https:')
+ v = v.replace('http','https');
+ a.push(key + '="'+v+'" ');
+ }
+ a.push('></ob'+'ject'+'>');
+ var p = ['<param name="' + (o.oUrl || 'src') +'" value="' + opts.src + '">'];
+ for (var key in opts.params)
+ p.push('<param name="'+ key +'" value="' + opts.params[key] + '">');
+ var o = document.createElement(a.join(''));
+ for (var i=0; i < p.length; i++)
+ o.appendChild(document.createElement(p[i]));
+ }
+ else if (o.standards) {
+ // Rewritten to be standards compliant by Richard Connamacher
+ var a = ['<object type="' + o.mimetype +'" width="' + opts.width + '" height="' + opts.height +'"'];
+ if (opts.src) a.push(' data="' + opts.src + '" ');
+ a.push('>');
+ a.push('<param name="' + (o.oUrl || 'src') +'" value="' + opts.src + '">');
+ for (var key in opts.params) {
+ if (key == 'wmode' && player != 'flash') // FF3/Quicktime borks on wmode
+ continue;
+ a.push('<param name="'+ key +'" value="' + opts.params[key] + '">');
+ }
+ // Alternate HTML
+ a.push('<div><p><strong>'+o.title+' Required</strong></p><p>'+o.title+' is required to view this media. <a href="'+o.pluginspage+'">Download Here</a>.</p></div>');
+ a.push('</ob'+'ject'+'>');
+ }
+ else {
+ var a = ['<embed width="' + opts.width + '" height="' + opts.height + '" style="display:block"'];
+ if (opts.src) a.push(' src="' + opts.src + '" ');
+ for (var key in opts.attrs)
+ a.push(key + '="'+opts.attrs[key]+'" ');
+ for (var key in o.eAttrs || {})
+ a.push(key + '="'+o.eAttrs[key]+'" ');
+ for (var key in opts.params) {
+ if (key == 'wmode' && player != 'flash') // FF3/Quicktime borks on wmode
+ continue;
+ a.push(key + '="'+opts.params[key]+'" ');
+ }
+ a.push('></em'+'bed'+'>');
+ }
+ // convert element to div
+ var id = el.id ? (' id="'+el.id+'"') : '';
+ var cls = opts.cls ? (' class="' + opts.cls + '"') : '';
+ var $div = $('<div' + id + cls + '>');
+ $el.after($div).remove();
+ ($.browser.msie || player == 'iframe') ? $div.append(o) : $div.html(a.join(''));
+ if (opts.caption) $('<div>').appendTo($div).html(opts.caption);
+ return $div;
+};
+
+
+})(jQuery);
diff --git a/js/jquery.metadata.js b/js/jquery.metadata.js
new file mode 100644
index 0000000..e011f52
--- /dev/null
+++ b/js/jquery.metadata.js
@@ -0,0 +1,148 @@
+/*
+ * Metadata - jQuery plugin for parsing metadata from elements
+ *
+ * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * Revision: $Id$
+ *
+ */
+
+/**
+ * Sets the type of metadata to use. Metadata is encoded in JSON, and each property
+ * in the JSON will become a property of the element itself.
+ *
+ * There are four supported types of metadata storage:
+ *
+ * attr: Inside an attribute. The name parameter indicates *which* attribute.
+ *
+ * class: Inside the class attribute, wrapped in curly braces: { }
+ *
+ * elem: Inside a child element (e.g. a script tag). The
+ * name parameter indicates *which* element.
+ * html5: Values are stored in data-* attributes.
+ *
+ * The metadata for an element is loaded the first time the element is accessed via jQuery.
+ *
+ * As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
+ * matched by expr, then redefine the metadata type and run another $(expr) for other elements.
+ *
+ * @name $.metadata.setType
+ *
+ * @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
+ * @before $.metadata.setType("class")
+ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
+ * @desc Reads metadata from the class attribute
+ *
+ * @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
+ * @before $.metadata.setType("attr", "data")
+ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
+ * @desc Reads metadata from a "data" attribute
+ *
+ * @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
+ * @before $.metadata.setType("elem", "script")
+ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
+ * @desc Reads metadata from a nested script element
+ *
+ * @example <p id="one" class="some_class" data-item_id="1" data-item_label="Label">This is a p</p>
+ * @before $.metadata.setType("html5")
+ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
+ * @desc Reads metadata from a series of data-* attributes
+ *
+ * @param String type The encoding type
+ * @param String name The name of the attribute to be used to get metadata (optional)
+ * @cat Plugins/Metadata
+ * @descr Sets the type of encoding to be used when loading metadata for the first time
+ * @type undefined
+ * @see metadata()
+ */
+
+(function($) {
+
+$.extend({
+ metadata : {
+ defaults : {
+ type: 'class',
+ name: 'metadata',
+ cre: /({.*})/,
+ single: 'metadata'
+ },
+ setType: function( type, name ){
+ this.defaults.type = type;
+ this.defaults.name = name;
+ },
+ get: function( elem, opts ){
+ var settings = $.extend({},this.defaults,opts);
+ // check for empty string in single property
+ if ( !settings.single.length ) settings.single = 'metadata';
+
+ var data = $.data(elem, settings.single);
+ // returned cached data if it already exists
+ if ( data ) return data;
+
+ data = "{}";
+
+ var getData = function(data) {
+ if(typeof data != "string") return data;
+
+ if( data.indexOf('{') < 0 ) {
+ data = eval("(" + data + ")");
+ }
+ }
+
+ var getObject = function(data) {
+ if(typeof data != "string") return data;
+
+ data = eval("(" + data + ")");
+ return data;
+ }
+
+ if ( settings.type == "html5" ) {
+ var object = {};
+ $( elem.attributes ).each(function() {
+ var name = this.nodeName;
+ if(name.match(/^data-/)) name = name.replace(/^data-/, '');
+ else return true;
+ object[name] = getObject(this.nodeValue);
+ });
+ } else {
+ if ( settings.type == "class" ) {
+ var m = settings.cre.exec( elem.className );
+ if ( m )
+ data = m[1];
+ } else if ( settings.type == "elem" ) {
+ if( !elem.getElementsByTagName ) return;
+ var e = elem.getElementsByTagName(settings.name);
+ if ( e.length )
+ data = $.trim(e[0].innerHTML);
+ } else if ( elem.getAttribute != undefined ) {
+ var attr = elem.getAttribute( settings.name );
+ if ( attr )
+ data = attr;
+ }
+ object = getObject(data.indexOf("{") < 0 ? "{" + data + "}" : data);
+ }
+
+ $.data( elem, settings.single, object );
+ return object;
+ }
+ }
+});
+
+/**
+ * Returns the metadata object for the first member of the jQuery object.
+ *
+ * @name metadata
+ * @descr Returns element's metadata object
+ * @param Object opts An object contianing settings to override the defaults
+ * @type jQuery
+ * @cat Plugins/Metadata
+ */
+$.fn.metadata = function( opts ){
+ return $.metadata.get( this[0], opts );
+};
+
+})(jQuery); \ No newline at end of file
diff --git a/js/video.js b/js/video.js
new file mode 100644
index 0000000..e724e8b
--- /dev/null
+++ b/js/video.js
@@ -0,0 +1,84 @@
+// $Id$
+
+/**
+ * @file
+ * Adds some show/hide to the admin form to make the UXP easier.
+ *
+ */
+
+$(document).ready(function() {
+ //lets see if we have any jmedia movies
+ if($.fn.media) {
+ $('.jmedia').media();
+ }
+
+ video_hide_all_options();
+ $("input[name='vid_convertor']").change(function() {
+ video_hide_all_options();
+ });
+
+ $('.video_select').each(function() {
+ var ext = $(this).attr('rel');
+ $('select', this).change(function() {
+ if($(this).val() == 'video_play_flv') {
+ $('#flv_player_'+ext).show();
+ } else {
+ $('#flv_player_'+ext).hide();
+ }
+ });
+ if($('select', this).val() == 'video_play_flv') {
+ $('#flv_player_'+ext).show();
+ }
+ });
+
+ if(Drupal.settings.video) {
+ $.fn.media.defaults.flvPlayer = Drupal.settings.video.flvplayer;
+
+ }
+
+ //lets setup our colorbox videos
+ $('.video-box').each(function() {
+ var url = $(this).attr('href');
+ var data = $(this).metadata();
+ var width = data.width;
+ var height= data.height;
+ var player = Drupal.settings.video.player; //player can be either jwplayer or flowplayer.
+ $(this).colorbox({
+ html: '<a id="video-overlay" href="'+url+'" style="height:'+height+'; width:'+width+'; display: block;"></a>',
+ onComplete:function() {
+ if(player == 'flowplayer') {
+ flowplayer("video-overlay", Drupal.settings.video.flvplayer, {
+ clip: {
+ autoPlay: Drupal.settings.video.autoplay,
+ autoBuffering: Drupal.settings.video.autobuffer
+ }
+ });
+ } else {
+ $('#video-overlay').media({ flashvars: {autostart: Drupal.settings.video.autoplay}, width:width, height:height });
+ }
+ },
+ });
+ });
+});
+
+function video_hide_all_options() {
+ $("input[name='vid_convertor']").each(function() {
+ var id = $(this).val();
+ $('#'+id).hide();
+ if ($(this).is(':checked')) {
+ $('#' + id).show();
+ }
+ });
+}
+
+function videoftp_thumbnail_change() {
+ // Add handlers for the video thumbnail radio buttons to update the large thumbnail onchange.
+ $(".video-thumbnails input").each(function() {
+ var path = $(this).val();
+ if($(this).is(':checked')) {
+ var holder = $(this).attr('rel');
+ $('.'+holder+' img').attr('src', Drupal.settings.basePath + path);
+ }
+ });
+
+}