MediaWiki: Common.js
From ShareRice Wiki (AFN)
Line 59: | Line 59: | ||
addOnloadHook( initAsianFuseVideoPanels ); | addOnloadHook( initAsianFuseVideoPanels ); | ||
+ | |||
+ | document.write('<script type="text/javascript" src="http://asianfuse.tv/flowplayer/dist/flowplayer-3.2.4.min.js"></script> | ||
+ | <link rel="stylesheet" type="text/css" href="http://asianfuse.tv/flowplayer/dist/global.css">'); |
Revision as of 20:45, 24 July 2011
/* Any JavaScript here will be loaded for all users on every page load. */ video_panel = function(id, cfg) { this.config = cfg this.container = jQuery('#af-media-embed-container_' + id) this.embedded = jQuery('#af-media-embed_' + id) this.restorer = jQuery('#af-media-restore_' + id) this.widths = { container: this.container.width(), embedded: this.embedded.width() } this.heights = { container: this.container.height(), embedded: this.embedded.height() } this.maximize = function() { if( this.is_maximized() ) { return; } this.container.width(this.config.maxWidth + 'px'); this.container.height(this.config.maxHeight + 45 + 'px'); this.embedded.width(this.config.maxWidth + 'px'); this.embedded.height(this.config.maxHeight + 'px'); // Reset the width relative to the width of the embedded video, // because we cannot count on it's parent element's calculated width to cause this to display as expected this.restorer.width((this.config.maxWidth * 0.98) + 'px'); this.restorer.show(); } this.minimize = function() { if( this.is_maximized() ) { this.restorer.hide(); this.embedded.width(this.widths.embedded + 'px') this.embedded.height(this.heights.embedded + 'px'); this.container.width(this.widths.container + 'px') this.container.height(this.heights.container + 'px') } } this.is_maximized = function() { o = (this.container.length > 0 ? 'container' : 'embedded'); return parseInt(this[o].height()) == parseInt(this.config.maxHeight + (this.container.length > 0 ? 45 : 0)) && parseInt(this[o].width()) == parseInt(this.config.maxWidth); } } // Provide easy access to default values, neatly hidden in a "namespace" that SHOULDN'T conflict with any other environmental variables. var _asianfuse2 = { maxWidth: 425, maxHeight: 350, video_panels: [], add: function(id, config) { this.video_panels[id] = new video_panel(id, config); } } function initAsianFuseVideoPanels() { jQuery('.afv').each(function(i, el) { id = el.id.split('_', 2) _asianfuse2.add(id[1], _asianfuse2); }); } addOnloadHook( initAsianFuseVideoPanels ); document.write('<script type="text/javascript" src="http://asianfuse.tv/flowplayer/dist/flowplayer-3.2.4.min.js"></script> <link rel="stylesheet" type="text/css" href="http://asianfuse.tv/flowplayer/dist/global.css">');