diff options
| author | hukl <contact@smyck.org> | 2009-09-17 11:03:35 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-09-17 11:03:35 +0200 |
| commit | f952040dd44b914b2d5e405567eb655757dfc85d (patch) | |
| tree | 7e210b01734bd7f311009c705e80027e85468cca /public/javascripts/shadowbox/players | |
| parent | bb4afc944049652f1c51124808fd64de6ebe338a (diff) | |
added shadowbody, first js gallery initializer and template modifications
Diffstat (limited to 'public/javascripts/shadowbox/players')
8 files changed, 42 insertions, 0 deletions
diff --git a/public/javascripts/shadowbox/players/README b/public/javascripts/shadowbox/players/README new file mode 100644 index 0000000..7f32991 --- /dev/null +++ b/public/javascripts/shadowbox/players/README | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | A Shadowbox "player" is a class that is used specifically for displaying a | ||
| 2 | particular medium. For example, an image player is included for displaying | ||
| 3 | images, a QuickTime player is included for playing QuickTime movies, etc. | ||
| 4 | |||
| 5 | All players should implement the same interface. This makes it possible for the | ||
| 6 | Shadowbox class to know what methods to call and properties to check on player | ||
| 7 | objects. | ||
| 8 | |||
| 9 | The interface is described here, with some simple explanations of how each | ||
| 10 | method and/or property is to be used. | ||
| 11 | |||
| 12 | METHOD/PROPERTY DESCRIPTION | ||
| 13 | |||
| 14 | height (Number) The height of the object (in pixels) | ||
| 15 | width (Number) The width of the object (in pixels) | ||
| 16 | ready (optional, Boolean) True if the content is ready to be | ||
| 17 | loaded, false otherwise. Useful when the script should wait | ||
| 18 | until the content loads before proceeding (see below) | ||
| 19 | resizable (optional, Boolean) True if the content can be dynamically | ||
| 20 | resized by the script (e.g. images, but not most movie | ||
| 21 | formats) | ||
| 22 | append() Appends this object to the DOM | ||
| 23 | remove() Removes this object from the DOM | ||
| 24 | onLoad() (optional) Called after the content is loaded and the | ||
| 25 | loading layer is hidden | ||
| 26 | onWindowResize() (optional) Called when the window is resized | ||
| 27 | |||
| 28 | If the ready property is set to false, the script will wait until it is set true | ||
| 29 | before proceeding to call the onReady callback. This property should be changed | ||
| 30 | in some callback function within the player class itself. | ||
| 31 | |||
| 32 | In this case, the object's height and width do not need to be made available | ||
| 33 | immediately (because they may not initially be known). However, in the same | ||
| 34 | callback, the height and width should be set. See the Shadowbox.img class (in | ||
| 35 | shadowbox-img.js) for an example of this behavior. | ||
diff --git a/public/javascripts/shadowbox/players/shadowbox-flv.js b/public/javascripts/shadowbox/players/shadowbox-flv.js new file mode 100644 index 0000000..1925e69 --- /dev/null +++ b/public/javascripts/shadowbox/players/shadowbox-flv.js | |||
| @@ -0,0 +1 @@ | |||
| (function(b){var a=b.util,c=20;b.flv=function(d){this.obj=d;this.resizable=true;this.height=d.height?parseInt(d.height,10):300;if(b.options.showMovieControls==true){this.height+=c}this.width=d.width?parseInt(d.width,10):300};b.flv.prototype={append:function(l,e,n){this.id=e;var j=document.createElement("div");j.id=e;l.appendChild(j);var k=n.resize_h,o=n.resize_w,f=b.path+"libraries/mediaplayer/player.swf",m=b.options.flashVersion,d=b.path+"libraries/swfobject/expressInstall.swf",g=a.apply({file:this.obj.content,height:k,width:o,autostart:(b.options.autoplayMovies?"true":"false"),controlbar:(b.options.showMovieControls?"bottom":"none"),backcolor:"0x000000",frontcolor:"0xCCCCCC",lightcolor:"0x557722"},b.options.flashVars),i=b.options.flashParams;swfobject.embedSWF(f,e,o,k,m,d,g,i)},remove:function(){swfobject.expressInstallCallback();swfobject.removeSWF(this.id)}}})(Shadowbox); \ No newline at end of file | |||
diff --git a/public/javascripts/shadowbox/players/shadowbox-html.js b/public/javascripts/shadowbox/players/shadowbox-html.js new file mode 100644 index 0000000..e01f846 --- /dev/null +++ b/public/javascripts/shadowbox/players/shadowbox-html.js | |||
| @@ -0,0 +1 @@ | |||
| (function(a){a.html=function(b){this.obj=b;this.height=b.height?parseInt(b.height,10):300;this.width=b.width?parseInt(b.width,10):500};a.html.prototype={append:function(b,e,c){this.id=e;var d=document.createElement("div");d.id=e;d.className="html";d.innerHTML=this.obj.content;b.appendChild(d)},remove:function(){var b=document.getElementById(this.id);if(b){a.lib.remove(b)}}}})(Shadowbox); \ No newline at end of file | |||
diff --git a/public/javascripts/shadowbox/players/shadowbox-iframe.js b/public/javascripts/shadowbox/players/shadowbox-iframe.js new file mode 100644 index 0000000..eeac848 --- /dev/null +++ b/public/javascripts/shadowbox/players/shadowbox-iframe.js | |||
| @@ -0,0 +1 @@ | |||
| (function(a){a.iframe=function(c){this.obj=c;var b=document.getElementById("sb-overlay");this.height=c.height?parseInt(c.height,10):b.offsetHeight;this.width=c.width?parseInt(c.width,10):b.offsetWidth};a.iframe.prototype={append:function(b,e,d){this.id=e;var c='<iframe id="'+e+'" name="'+e+'" height="100%" width="100%" frameborder="0" marginwidth="0" marginheight="0" scrolling="auto"';if(a.client.isIE){c+=' allowtransparency="true"';if(a.client.isIE6){c+=" src=\"javascript:false;document.write('');\""}}c+="></iframe>";b.innerHTML=c},remove:function(){var b=document.getElementById(this.id);if(b){a.lib.remove(b);if(a.client.isGecko){delete window.frames[this.id]}}},onLoad:function(){var b=a.client.isIE?document.getElementById(this.id).contentWindow:window.frames[this.id];b.location.href=this.obj.content}}})(Shadowbox); \ No newline at end of file | |||
diff --git a/public/javascripts/shadowbox/players/shadowbox-img.js b/public/javascripts/shadowbox/players/shadowbox-img.js new file mode 100644 index 0000000..3fc42f0 --- /dev/null +++ b/public/javascripts/shadowbox/players/shadowbox-img.js | |||
| @@ -0,0 +1 @@ | |||
| (function(h){var e=h.util,i,k,j="sb-drag-layer",d;function b(){i={x:0,y:0,start_x:null,start_y:null}}function c(m,o,l){if(m){b();var n=["position:absolute","height:"+o+"px","width:"+l+"px","cursor:"+(h.client.isGecko?"-moz-grab":"move"),"background-color:"+(h.client.isIE?"#fff;filter:alpha(opacity=0)":"transparent")].join(";");h.lib.append(h.skin.bodyEl(),'<div id="'+j+'" style="'+n+'"></div>');h.lib.addEvent(e.get(j),"mousedown",g)}else{var p=e.get(j);if(p){h.lib.removeEvent(p,"mousedown",g);h.lib.remove(p)}k=null}}function g(m){h.lib.preventDefault(m);var l=h.lib.getPageXY(m);i.start_x=l[0];i.start_y=l[1];k=e.get(h.contentId());h.lib.addEvent(document,"mousemove",f);h.lib.addEvent(document,"mouseup",a);if(h.client.isGecko){e.get(j).style.cursor="-moz-grabbing"}}function a(){h.lib.removeEvent(document,"mousemove",f);h.lib.removeEvent(document,"mouseup",a);if(h.client.isGecko){e.get(j).style.cursor="-moz-grab"}}function f(o){var q=h.content,p=h.dimensions,n=h.lib.getPageXY(o);var m=n[0]-i.start_x;i.start_x+=m;i.x=Math.max(Math.min(0,i.x+m),p.inner_w-q.width);k.style.left=i.x+"px";var l=n[1]-i.start_y;i.start_y+=l;i.y=Math.max(Math.min(0,i.y+l),p.inner_h-q.height);k.style.top=i.y+"px"}h.img=function(m){this.obj=m;this.resizable=true;this.ready=false;var l=this;d=new Image();d.onload=function(){l.height=m.height?parseInt(m.height,10):d.height;l.width=m.width?parseInt(m.width,10):d.width;l.ready=true;d.onload="";d=null};d.src=m.content};h.img.prototype={append:function(l,o,n){this.id=o;var m=document.createElement("img");m.id=o;m.src=this.obj.content;m.style.position="absolute";m.setAttribute("height",n.resize_h);m.setAttribute("width",n.resize_w);l.appendChild(m)},remove:function(){var l=e.get(this.id);if(l){h.lib.remove(l)}c(false);if(d){d.onload="";d=null}},onLoad:function(){var l=h.dimensions;if(l.oversized&&h.options.handleOversize=="drag"){c(true,l.resize_h,l.resize_w)}},onWindowResize:function(){if(k){var p=h.content,o=h.dimensions,n=parseInt(h.lib.getStyle(k,"top")),m=parseInt(h.lib.getStyle(k,"left"));if(n+p.height<o.inner_h){k.style.top=o.inner_h-p.height+"px"}if(m+p.width<o.inner_w){k.style.left=o.inner_w-p.width+"px"}}}}})(Shadowbox); \ No newline at end of file | |||
diff --git a/public/javascripts/shadowbox/players/shadowbox-qt.js b/public/javascripts/shadowbox/players/shadowbox-qt.js new file mode 100644 index 0000000..0d0ae25 --- /dev/null +++ b/public/javascripts/shadowbox/players/shadowbox-qt.js | |||
| @@ -0,0 +1 @@ | |||
| (function(a){var b=16;a.qt=function(c){this.obj=c;this.height=c.height?parseInt(c.height,10):300;if(a.options.showMovieControls==true){this.height+=b}this.width=c.width?parseInt(c.width,10):300};a.qt.prototype={append:function(l,e,n){this.id=e;var f=a.options,g=String(f.autoplayMovies),o=String(f.showMovieControls);var k="<object",i={id:e,name:e,height:this.height,width:this.width,kioskmode:"true"};if(a.client.isIE){i.classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";i.codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"}else{i.type="video/quicktime";i.data=this.obj.content}for(var h in i){k+=" "+h+'="'+i[h]+'"'}k+=">";var j={src:this.obj.content,scale:"aspect",controller:o,autoplay:g};for(var c in j){k+='<param name="'+c+'" value="'+j[c]+'">'}k+="</object>";l.innerHTML=k},remove:function(){var f=this.id;try{document[f].Stop()}catch(d){}var c=document.getElementById(f);if(c){a.lib.remove(c)}}}})(Shadowbox); \ No newline at end of file | |||
diff --git a/public/javascripts/shadowbox/players/shadowbox-swf.js b/public/javascripts/shadowbox/players/shadowbox-swf.js new file mode 100644 index 0000000..5bcfd22 --- /dev/null +++ b/public/javascripts/shadowbox/players/shadowbox-swf.js | |||
| @@ -0,0 +1 @@ | |||
| (function(b){var a=b.util;b.swf=function(c){this.obj=c;this.resizable=true;this.height=c.height?parseInt(c.height,10):300;this.width=c.width?parseInt(c.width,10):300};b.swf.prototype={append:function(k,d,m){this.id=d;var i=document.createElement("div");i.id=d;k.appendChild(i);var j=m.resize_h,n=m.resize_w,e=this.obj.content,l=b.options.flashVersion,c=b.path+"libraries/swfobject/expressInstall.swf",f=b.options.flashVars,g=b.options.flashParams;swfobject.embedSWF(e,d,n,j,l,c,f,g)},remove:function(){swfobject.expressInstallCallback();swfobject.removeSWF(this.id)}}})(Shadowbox); \ No newline at end of file | |||
diff --git a/public/javascripts/shadowbox/players/shadowbox-wmp.js b/public/javascripts/shadowbox/players/shadowbox-wmp.js new file mode 100644 index 0000000..d95eee3 --- /dev/null +++ b/public/javascripts/shadowbox/players/shadowbox-wmp.js | |||
| @@ -0,0 +1 @@ | |||
| (function(a){var b=(a.client.isIE?70:45);a.wmp=function(c){this.obj=c;this.height=c.height?parseInt(c.height,10):300;if(a.options.showMovieControls){this.height+=b}this.width=c.width?parseInt(c.width,10):300};a.wmp.prototype={append:function(c,j,i){this.id=j;var e=a.options,f=e.autoplayMovies?1:0;var d='<object id="'+j+'" name="'+j+'" height="'+this.height+'" width="'+this.width+'"',h={autostart:e.autoplayMovies?1:0};if(a.client.isIE){d+=' classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"';h.url=this.obj.content;h.uimode=e.showMovieControls?"full":"none"}else{d+=' type="video/x-ms-wmv"';d+=' data="'+this.obj.content+'"';h.showcontrols=e.showMovieControls?1:0}d+=">";for(var g in h){d+='<param name="'+g+'" value="'+h[g]+'">'}d+="</object>";c.innerHTML=d},remove:function(){var f=this.id;if(a.client.isIE){try{window[f].controls.stop();window[f].URL="non-existent.wmv";window[f]=function(){}}catch(d){}}var c=document.getElementById(f);if(c){setTimeout(function(){a.lib.remove(c)},10)}}}})(Shadowbox); \ No newline at end of file | |||
