From a9addd6ed7ab0e15e1d4b3db4c67ea9b00578d2d Mon Sep 17 00:00:00 2001 From: Heshan Date: Mon, 7 Mar 2011 22:37:41 +0530 Subject: Remove unwanted JS files and added manual thumbnail update on fallback and manual select. --- js/flowplayer-3.2.0.min.js | 24 --- js/jquery.media.js | 457 --------------------------------------------- js/jquery.metadata.js | 147 --------------- js/video.js | 112 +++++------ 4 files changed, 57 insertions(+), 683 deletions(-) delete mode 100644 js/flowplayer-3.2.0.min.js delete mode 100644 js/jquery.media.js delete mode 100644 js/jquery.metadata.js (limited to 'js') diff --git a/js/flowplayer-3.2.0.min.js b/js/flowplayer-3.2.0.min.js deleted file mode 100644 index 2baa001..0000000 --- a/js/flowplayer-3.2.0.min.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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 . - * - * 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];p1){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=''}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+=''}}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+='"}n+="";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="

Flash version "+n.version+" or greater is required

"+(k[0]>0?"Your version is "+k:"You have no flash plugin installed")+"

"+(f.tagName=="A"?"

Click here to download latest version

":"

Download latest version from here

");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 deleted file mode 100644 index 71bc987..0000000 --- a/js/jquery.media.js +++ /dev/null @@ -1,457 +0,0 @@ -/* - * 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 - * - * 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 = $('
').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 = $(''); - - // 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) $('
').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 = $(''); - $(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) $('
').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 = $(''); - o.attr('src', opts.src); - o.css('backgroundColor', o.bgColor); - } - else if ($.browser.msie) { - var a = [''); - var p = ['']; - for (var key in opts.params) - p.push(''); - 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 = [''); - a.push(''); - for (var key in opts.params) { - if (key == 'wmode' && player != 'flash') // FF3/Quicktime borks on wmode - continue; - a.push(''); - } - // Alternate HTML - a.push('

'+o.title+' Required

'+o.title+' is required to view this media. Download Here.

'); - a.push(''); - } - else { - var a = [''); - } - // convert element to div - var id = el.id ? (' id="'+el.id+'"') : ''; - var cls = opts.cls ? (' class="' + opts.cls + '"') : ''; - var $div = $(''); - $el.after($div).remove(); - ($.browser.msie || player == 'iframe') ? $div.append(o) : $div.html(a.join('')); - if (opts.caption) $('
').appendTo($div).html(opts.caption); - return $div; -}; - - -})(jQuery); diff --git a/js/jquery.metadata.js b/js/jquery.metadata.js deleted file mode 100644 index 6ace78f..0000000 --- a/js/jquery.metadata.js +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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 - * - * - */ - -/** - * 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

This is a p

- * @before $.metadata.setType("class") - * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label" - * @desc Reads metadata from the class attribute - * - * @example

This is a 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

This is a 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

This is a 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 index 0a9711a..4a23b53 100644 --- a/js/video.js +++ b/js/video.js @@ -4,79 +4,81 @@ * Adds some show/hide to the admin form to make the UXP easier. * */ +(function($){ -$(document).ready(function() { - //lets see if we have any jmedia movies - if($.fn.media) { - $('.jmedia').media(); - } + $(document).ready(function() { + //lets see if we have any jmedia movies + if($.fn.media) { + $('.jmedia').media(); + } - video_hide_all_options(); - $("input[name='video_convertor']").change(function() { video_hide_all_options(); - }); + $("input[name='video_convertor']").change(function() { + video_hide_all_options(); + }); - // change metadata options - video_hide_all__metadata_options(); - $("input[name='video_metadata']").change(function() { + // change metadata options video_hide_all__metadata_options(); - }); + $("input[name='video_metadata']").change(function() { + video_hide_all__metadata_options(); + }); - // change metadata options - video_hide_all__filesystem_options(); - $("input[name='video_filesystem']").change(function() { + // change metadata options video_hide_all__filesystem_options(); - }); + $("input[name='video_filesystem']").change(function() { + video_hide_all__filesystem_options(); + }); - $('.video_select').each(function() { - var ext = $(this).attr('rel'); - $('select', this).change(function() { - if($(this).val() == 'video_play_flv') { + $('.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(); - } 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; + 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: '', - 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 + //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: '', + 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 - }); + width:width, + height:height + }); + } } - } + }); }); }); -}); +})(jQuery); function video_hide_all_options() { $("input[name='video_convertor']").each(function() { -- cgit v1.2.3