diff --git a/OSMPlayer.php b/OSMPlayer.php deleted file mode 100755 index f7c96798..00000000 --- a/OSMPlayer.php +++ /dev/null @@ -1,554 +0,0 @@ - 640, - * 'height' => 480, - * 'playlist' => 'http://www.mysite.com/playlist.xml' - * )); - */ - public function __construct( $_params = array() ) { - // First set the defaults. - $this->playerParams = OSMPlayer::getPlayerParams(); - $this->defaults = array_merge( $this->playerParams, OSMPlayer::getPlayerSettings() ); - $this->settings = $this->defaults; - if( $_params ) { - // Set the parameters ( which will override the defaults ). - $this->settings = array_merge( $this->settings, $_params ); - } - - // Create our template. - $templateClass = ucfirst( $this->settings['template'] ) . 'Template'; - require_once( "OSMTemplate.php" ); - require_once( "templates/" . $this->settings['template'] . "/template.php" ); - $this->template = new $templateClass( $this->settings ); - - // Make sure we set the Prefix. - $this->setPrefix( isset($_params['prefix']) ? $_params['prefix'] : ($this->settings['id'] . '_') ); - } - - /** - * Returns the paths to this player library. - */ - public static function getPlayerPath() { - static $playerPath; - - // Get the player path. - if( !$playerPath ) { - // Set the base path and url of this class. - $base_root = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; - $base_url = $base_root .= '://'. check_plain($_SERVER['HTTP_HOST']); - if ($dir = trim(dirname(check_plain($_SERVER['SCRIPT_NAME'])), '\,/')) { - $base_url .= "/$dir"; - } - - $path = parse_url($base_url); - $path = isset($path['path']) ? $path['path'] : ''; - $playerPath = trim( str_replace( realpath('.'), '', dirname(__FILE__) ), '/' ); - $playerPath = trim( str_replace('\\', '/', $playerPath), '/' ); - $playerPath = $playerPath ? $path . '/' . $playerPath . '/' : $playerPath; - } - - // Return the player path. - return $playerPath; - } - - /** - * Returns the player settings. - */ - public static function getPlayerSettings() { - return array( - 'width' => OSMPLAYER_DEFAULT_WIDTH, - 'height' => OSMPLAYER_DEFAULT_HEIGHT, - 'theme' => 'dark-hive', - 'version' => '0.01', - 'showController' => true, - 'disablePlaylist' => false, - 'playlistOnly' => false, - 'showNodeVoter' => false, - 'showTeaserVoter' => false, - 'showTitleBar' => true, - 'showWhenEmpty' => true, - 'playerPath' => self::getPlayerPath() - ); - } - - /** - * Returns the player parameters. - */ - public static function getPlayerParams() { - return array( - 'id' => 'player', - 'showPlaylist' => true, - 'file' => '', - 'flashPlayer' => 'minplayer/minplayer.swf', - 'image' => '', - 'volume' => 80, - 'autostart' => false, - 'autoLoad' => true, - 'streamer' => "", - 'apiKey' => "", - 'sessid' => "", - 'api' => 2, - 'drupalVersion' => 6, - 'links' => array(), - 'linksvertical' => false, - 'logo' => 'logo.png', - 'link' => "http://www.mediafront.org", - 'logopos' => 'sw', - 'logoWidth' => 49, - 'logoHeight' => 15, - 'logox' => 5, - 'logoy' => 5, - 'node' => "", - 'shuffle' => false, - 'loop' => false, - 'repeat' => false, - 'pageLimit' => 10, - 'protocol' => "auto", - 'server' => "drupal", - 'template' => "default", - 'baseURL' => "", - 'draggable' => false, - 'resizable' => false, - 'playlist' => "", - 'args' => array(), - 'wildcard' => "*", - 'gateway' => "", - 'vertical' => true, - 'scrollSpeed' => 15, - 'updateTimeout' => 20, - 'hysteresis' => 40, - 'dynamic' => false, - 'scrollMode' => "auto", - 'pageLink' => false, - 'debug' => false, - 'embedWidth' => 450, - 'embedHeight' => 337, - 'skin' => 'default', - 'autoNext' => true, - 'prefix' => '', - 'showScrollbar' => true, - 'controllerOnly' => false, - 'wmode' => 'transparent', - 'forceOverflow' => false, - 'volumeVertical' => false, - 'incrementTime' => 5, - 'quality' => 'default', - 'zIndex' => 400, - 'timeout' => 4, - 'fluidWidth' => false, - 'fluidHeight' => false, - 'fullscreen' => false - ); - } - - /** - * Set's the current session id for this player. - */ - public function setSessionId( $sessid ) { - $this->settings['sessid'] = $sessid; - } - - /** - * Get's the current template. - */ - public function getTemplate() { - return $this->settings['template']; - } - - /** - * Get's the current theme. - */ - public function getTheme() { - return $this->settings['theme']; - } - - /** - * Connect the playlist of this media player to another media player. - * - * Usage: - * - * $playlist = new OSMPlayer(array( - * 'width' => 150, - * 'height' => 400, - * 'playlistOnly' => true, - * 'playlist' => 'http://www.mysite.com/playlist.xml' - * )); - * - * $player = new OSMPlayer(array( - * 'width' => 450, - * 'height' => 400, - * 'disablePlaylist' => true - * )); - * - * $playlist->addPlaylistTo( $player ); - */ - public function addPlaylistTo( $player ) { - $this->playlists[] = is_string($player) ? $player : $player->getId(); - } - - /** - * Connect the controlbar of this media player to another media player. - * - * Usage: - * - * $controller = new OSMPlayer(array( - * 'width' => 400, - * 'height' => 26, - * 'controllerOnly' => true, - * )); - * - * $player = new OSMPlayer(array( - * 'playlist' => 'http://www.mysite.com/myplaylist.xml - * )); - * - * $controller->addControllerTo( $player ); - */ - public function addControllerTo( $player ) { - $this->controllers[] = is_string($player) ? $player : $player->getId(); - } - - /** - * Returns the current id of the player. - */ - public function getId() { - return $this->settings['id']; - } - - /** - * Set the id for this media player. - */ - public function setId( $newId ) { - // Set the id of this player. - $this->settings['id'] = $newId; - } - - /** - * Returns the current prefix of the player. - */ - public function getPrefix() { - return $this->settings['prefix']; - } - - /** - * Set the prefix for the CSS of this media player. - */ - public function setPrefix( $newPrefix ) { - // We only need to set the prefix if we generate the CSS. - if( $this->template->settings['generateCSS'] ) { - // Set the prefix. - $this->settings['prefix'] = $newPrefix; - - // Set the template prefix. - $this->template->setPrefix( $newPrefix ); - } - else { - $this->settings['prefix'] = ''; - $this->template->setPrefix( '' ); - } - } - - /** - * Get the JS header for this player. - */ - public function getJSHeader() { - $header = ''; - - // Add all of the javascript files. - $jsfiles = $this->getJSFiles(); - foreach( $jsfiles as $file ) { - $header .= ''; - $header .= "\n"; - } - - // Return the header. - return $header; - } - - /** - * Get the header for this media player. - */ - public function getHeader() { - // Add the JS files to the header. - $header = $this->getJSHeader(); - - // Add the CSS files. - $header .= $this->template->getCSSHeader(); - - // Return the header. - return $header; - } - - /** - * Get the javascript files for this media player. - */ - public function getJSFiles() { - $template = $this->settings['template']; - if( $this->settings['debug'] ) { - return array_merge( array( - "js/source/jquery.media.drupal.js", - "js/source/jquery.media.parser.js", - "js/source/jquery.media.auto.js", - "js/source/jquery.media.rpc.js", - "js/source/jquery.media.json.js", - "js/source/jquery.media.sha256.js", - "js/source/jquery.media.utils.js", - "js/source/jquery.media.control.js", - "js/source/jquery.media.flash.js", - "js/source/jquery.media.html5.js", - "js/source/jquery.media.image.js", - "js/source/jquery.media.link.js", - "js/source/jquery.media.links.js", - "js/source/jquery.media.display.js", - "js/source/jquery.media.minplayer.js", - "js/source/jquery.media.menu.js", - "js/source/jquery.media.mousewheel.js", - "js/source/jquery.media.node.js", - "js/source/jquery.media.pager.js", - "js/source/jquery.media.player.js", - "js/source/jquery.media.playlist.js", - "js/source/jquery.media.playlistlink.js", - "js/source/jquery.media.rotator.js", - "js/source/jquery.media.slider.js", - "js/source/jquery.media.teaser.js", - "js/source/jquery.media.titlebar.js", - "js/source/jquery.media.scroll.js", - "js/source/jquery.media.voter.js", - "js/source/jquery.media.youtube.js", - "js/source/jquery.media.vimeo.js", - "js/source/jquery.media.dailymotion.js", - "js/source/jquery.media.file.js" - ), $this->template->settings['jsFiles']['debug'] ); - } - else { - return array_merge( array( - "js/jquery.osmplayer.compressed.js", - ), $this->template->settings['jsFiles']['release'] ); - } - } - - /** - * Converts a PHP variable into its Javascript equivalent. - */ - public function osm_json_encode($var) { - switch (gettype($var)) { - case 'boolean': - return $var ? 'true' : 'false'; // Lowercase necessary! - case 'integer': - case 'double': - return $var; - case 'resource': - case 'string': - return '"'. str_replace(array("\r", "\n", "<", ">", "&", "\'"), - array('\r', '\n', '\x3c', '\x3e', '\x26', "'"), - addslashes($var)) .'"'; - case 'array': - // Arrays in JSON can't be associative. If the array is empty or if it - // has sequential whole number keys starting with 0, it's not associative - // so we can go ahead and convert it as an array. - if (empty ($var) || array_keys($var) === range(0, sizeof($var) - 1)) { - $output = array(); - foreach ($var as $v) { - $output[] = $this->osm_json_encode($v); - } - return '['. implode(',', $output) .']'; - } - // Otherwise, fall through to convert the array as an object. - case 'object': - $output = array(); - foreach ($var as $k => $v) { - $output[] = $this->osm_json_encode(strval($k)) .': '. $this->osm_json_encode($v); - } - return '{'. implode(',', $output) .'}'; - default: - return 'null'; - } - } - - /** - * Get the player parameters. This will only return the parameters that are included in - * the playerParams array. - */ - public function getParams() { - $params = array(); - foreach( $this->settings as $param => $value ) { - if( array_key_exists( $param, $this->playerParams ) && - ($this->playerParams[$param] != $value) ) { - switch( gettype($this->defaults[$param]) ) { - case 'array': - case 'object': - $params[] = $param . ':' . $this->osm_json_encode($value); - break; - case 'string': - // Make sure we are not dealing with a JSON string here. If so, then don't include the quotes. - $params[] = (substr($value, 0, 1) == '{') ? ($param . ':' . $value) : ($param . ':"' . str_replace( '"', "'", $value ) . '"'); - break; - case 'boolean': - $params[] = $param . ':' . ($value ? 'true' : 'false'); - break; - default: - $params[] = $param . ':' . ($value ? $value : 0); - break; - } - } - } - - $ids = array(); - - // Iterate through all of our template Ids. - foreach( $this->template->getIds() as $id => $value ) { - - // Only set this if it is different from the default. - if( $this->template->defaultIds[$id] != $value ) { - $ids[] = $id . ':"' . $value . '"'; - } - } - - // If we have some id's different from the default, then add then to our params. - if( count( $ids ) ) { - // Now add all the Id's to the settings. - $params[] = 'ids:{' . implode(',', $ids) . '}'; - } - - return $params; - } - - /** - * Returns the JavaScript code to add and instantiate the player on the page. - */ - public function getJS() { - // Return the script. - return ''; - } - - /** - * Returns the javascript to add the player to the page. - */ - public function getPlayerJS() { - $playerId = $this->getId(); - $params = $this->getParams(); - - // Create the player in javascript. - $js = 'var ' . $playerId . ' = jQuery("#' . $playerId . '").mediaplayer({' . implode(',', $params) . '});'; - - // Now that the player has made it's way through the loading process... hide the busy cursor. - $js .= 'jQuery("#'. $playerId .'_loading").hide();'; - - // Now add our playlist connections to the javascript. - foreach( $this->playlists as $playlist ) { - $js .= 'jQuery.media.addPlaylist("' . $playlist . '",' . $playerId . ');'; - } - - // Now add our controller connections to the javascript. - foreach( $this->controllers as $controller ) { - $js .= 'jQuery.media.addController("' . $controller . '",' . $playerId . ');'; - } - - // Return the script. - // We need to use setTimeout since some browsers jump the gun on when they are really ready. - return 'jQuery(function() { setTimeout( function() {' . $js . '}, 10 ); });'; - } - - /** - * The main API call for this player. This will return the HTML and JavaScript for the - * media player that you wish to add to your page. - * - * This function allows for dynamic theming of the player by passing parameters to the media - * player ( i.e. playlistOnly, horizontal, etc ). - */ - public function getPlayer() { - $output = $this->getJS(); - $output .= "\n"; - - // Determine the width and height of the player. - $width = ($this->settings['playlistOnly'] && $this->settings['vertical']) ? '' : ('width:' . $this->settings['width'] . 'px;'); - $width = $this->settings['fluidWidth'] ? 'width:100%;' : $width; - $height = (($this->settings['playlistOnly'] && !$this->settings['vertical']) || $this->settings['controllerOnly']) ? '' : ('height:' . $this->settings['height'] . 'px;'); - $height = $this->settings['fluidHeight'] ? 'height:100%;' : $height; - - // Set the version. - $this->settings['version'] = $this->template->getVersion(); - - // Get the output from the template. - $output .= $this->template->theme( array( - 'params' => $this->settings, - 'width' => $width, - 'height' => $height - ) - ); - - return $output; - } -} -?> \ No newline at end of file diff --git a/OSMTemplate.php b/OSMTemplate.php deleted file mode 100755 index 337f4108..00000000 --- a/OSMTemplate.php +++ /dev/null @@ -1,426 +0,0 @@ - '#mediaplayerloading', - 'player' => '#mediaplayer', - 'menu' => '#mediamenu', - 'titleBar' => '#mediatitlebar', - 'node' => '#medianode', - 'playlist' => '#mediaplaylist', - 'currentTime' => '#mediacurrenttime', - 'totalTime' => '#mediatotaltime', - 'playPause' => '#mediaplaypause', - 'seekUpdate' => '#mediaseekupdate', - 'seekProgress' => '#mediaseekprogress', - 'seekBar' => '#mediaseekbar', - 'seekHandle' => '#mediaseekhandle', - 'volumeUpdate' => '#mediavolumeupdate', - 'volumeBar' => '#mediavolumebar', - 'volumeHandle' => '#mediavolumehandle', - 'mute' => '#mediamute', - 'linkText' => '#medialinktext', - 'linkScroll' => '#medialinkscroll', - 'close' => '#mediamenuclose', - 'embed' => '#mediaembed', - 'elink' => '#mediaelink', - 'email' => '#mediaemail', - 'busy' => '#mediabusy', - 'preview' => '#mediapreview', - 'play' => '#mediaplay', - 'media' => '#mediadisplay', - 'control' => '#mediacontrol', - 'voter' => '#mediavoter', - 'uservoter' => '#mediauservoter', - 'mediaRegion' => '#mediaregion', - 'field' => '.mediafield', - 'prev' => '#mediaprev', - 'next' => '#medianext', - 'loadPrev' => '#medialoadprev', - 'loadNext' => '#medialoadnext', - 'prevPage' => '#mediaprevpage', - 'nextPage' => '#medianextpage', - 'pager' => '#mediapager', - 'scroll' => '#mediascroll', - 'busy' => '#mediabusy', - 'links' => '#medialinks', - 'listMask' => '#medialistmask', - 'list' => '#medialist', - 'scrollWrapper' => '#mediascrollbarwrapper', - 'scrollBar' => '#mediascrollbar', - 'scrollTrack' => '#mediascrolltrack', - 'scrollHandle' => '#mediascrollhandle', - 'scrollUp' => '#mediascrollup', - 'scrollDown' => '#mediascrolldown', - 'titleLinks' => '#mediatitlelinks' - ); - - /** - * Constructor for the OSMTempalate class. - */ - public function __construct( $playerSettings ) { - // Set the player settings, which can be used in this template. - $this->playerSettings = $playerSettings; - - // Get the settings for our template - $this->settings = $this->getSettings(); - } - - /** - * Get's the player version number. - */ - public function getVersion() { - $this->version = $this->version ? $this->version : file_get_contents( dirname(__FILE__) . '/version.txt' ); - return $this->version; - } - - /** - * Return's this templates settings. This function is used to tell the Open Standard Media Player class - * about your template. - */ - public function getSettings() { - // We must have a template derive from this class... set all settings to null. - return array(); - } - - /** - * Returns the CSS file that is located within the current theme. - */ - public function getThemeRollerCSS() { - $theme_css = ''; - if( $this->playerSettings['theme'] ) { - $theme_folder = 'jquery-ui/css/' . $this->playerSettings['theme']; - - // Now search this folder for the CSS file... - $theme_path = dirname(__FILE__) . '/' . $theme_folder; - if (is_dir($theme_path)) { - if ($contents = opendir($theme_path)) { - while(($node = readdir($contents)) !== false) { - if( preg_match('/\.css$/', $node) ) { - $theme_css = $node; - break; - } - } - } - } - } - - // Add the theme. - return $theme_css ? ($theme_folder . '/' . $theme_css) : ''; - } - - /** - * Set the CSS directory for this media player. - */ - public function setCSSDir( $dir ) { - // We only want to set this if we are using themeroller since - // this directory can change to a cached directory when the - // themeroller file is created. - if( $this->settings['generateCSS'] ) { - $this->css_dir = $dir; - } - } - - /** - * Resets all generated CSS files. - */ - public function resetCSS() { - $this->deleteCSS(); - $this->createCSS(); - } - - /** - * Get the CSS header for this player. - */ - public function getCSSHeader() { - $playerPath = $this->playerSettings['playerPath']; - - // Add the CSS files. - $css_files = $this->getCSSFiles(); - $header = ''; - $header .= "\n"; - if( isset($css_files['template_ie']) ) { - $header .= ''; - $header .= "\n"; - } - - // Return the header. - return $header; - } - - /** - * Get an array of the CSS files for this player. - */ - public function getCSSFiles() { - $files = array(); - - // If they are using theme roller, then we will use the cached CSS files. - if( $this->settings['generateCSS'] ) { - // Get the CSS path. - $css_path = $this->css_dir ? $this->css_dir : dirname(__FILE__); - $css_local_path = $this->css_dir ? '' : 'css/'; - - // Cache the prefix name. - $id = $this->playerSettings['id']; - - // The CSS files for this id. - $files['template'] = $css_local_path . "{$id}.css"; - $files['template_ie'] = $css_local_path . "{$id}_ie.css"; - - // If the CSS files do not exist, then create them. - if( !is_file( $css_path . '/' . $files['template'] ) ) { - $this->createCSS(); - } - } - else { - $files = $this->settings['cssFiles']; - } - - // Return the CSS files. - return $files; - } - - /** - * Writes the contents of one CSS file to another, but also replaces all the id's and - * class names to take into account the prefix ( id ) of the media player. - */ - private function writeCSS( $css, $handle ) { - // Get the file contents and length. - $contents = file_get_contents( dirname(__FILE__) . '/' . $css); - - // Change all of the images to the correct path... - $playerPath = $this->playerSettings['playerPath'] ? $this->playerSettings['playerPath'] : '../'; - $contents = str_replace( 'images/', $playerPath . str_replace( basename($css), '', $css ) . 'images/', $contents ); - - // Locate all of the z-index elements. - $contents = preg_replace_callback('/z-index\s*:\s*([0-9]+)/', create_function( - '$match', - '$zIndex = intval($match[1]); - return $zIndex ? "z-index:" . (' . $this->playerSettings['zIndex'] . ' + $zIndex) : $zIndex;' - ), $contents); - - // Get the length of the contents. - $len = strlen( $contents ); - - // Make sure we don't overwrite anything within brackets... - $match = 0; - $matches = array(); - preg_match_all('/\{.*\}/sU', $contents, $matches, PREG_OFFSET_CAPTURE); - - if( count($matches[0]) > 0 ) { - $match_len = strlen( $matches[0][$match][0] ); - } - - // Iterate through all the characters. - for( $i=0; $i<$len; $i++ ) { - - // See if we need to increment the current match. - if( isset( $matches[0][$match+1] ) && ($i > $matches[0][$match+1][1]) ) { - $match++; - $match_len = strlen( $matches[0][$match][0] ); - } - - // Get the char at this index. - $char = $contents[$i]; - - // If this is a class or an id, and is not within brackets... - if( (($char == '#') || ($char == '.')) && - !(($i > $matches[0][$match][1]) && ($i <= ($matches[0][$match][1]+$match_len))) ) { - fwrite( $handle, $char . $this->playerSettings['id'] . '_' ); - } - else { - fwrite( $handle, $char ); - } - } - } - - /** - * Create the CSS files for this media player. This will dynamically rename all the - * id's and class names within the master CSS files ( theme and template ), and then create - * a cached version of them within the css folder. - */ - public function createCSS() { - // This is only necessary if they are using Theme Roller. - if( $this->settings['generateCSS'] ) { - // Store the CSS directory for later usage. - $dir = $this->css_dir ? $this->css_dir : dirname(__FILE__) . '/css'; - - // Make sure this directory exists. - if( !is_dir( $dir ) ) { - // Create the directory. - mkdir( $dir, 0777, true ); - } - - // Now make sure the directory has the right permissions. - @chmod( $dir, 0777 ); - - // Store the to path and to css. - $to_path = $dir . '/' . $this->playerSettings['id']; - $to_css = $to_path . '.css'; - - // Setup the files array. - $files = array(); - $files[$to_css] = array(); - if( $this->settings['cssFiles']['theme'] ) { - $files[$to_css][] = $this->settings['cssFiles']['theme']; - } - if( $this->settings['cssFiles']['template'] ) { - $files[$to_css][] = $this->settings['cssFiles']['template']; - } - if( $this->settings['cssFiles']['template_ie'] ) { - $files[$to_path . '_ie.css'] = array( $this->settings['cssFiles']['template_ie'] ); - } - - // Iterate through all of our css files we need to create. - foreach( $files as $file => $contents ) { - // Now open up the new css file. - $handle = fopen( $file, 'a+' ); - if( $handle ) { - // Iterate through all the files that will be combined to - // create this css file. - foreach( $contents as $content ) { - if( $content ) { - // Write to the css file. - $this->writeCSS( $content, $handle ); - } - } - - // Close the file. - fclose( $handle ); - } - - // Now set the file permissions to 775. - @chmod( $file, 0777 ); - } - } - } - - /** - * Delete the current cached CSS files. - */ - public function deleteCSS() { - // This is only necessary if they user Theme Roller. - if( $this->settings['generateCSS'] ) { - $css_path = $this->css_dir ? $this->css_dir : dirname(__FILE__) . '/css'; - $css_path .= '/' . $this->playerSettings['id']; - $css = $css_path . '.css'; - - if( is_file( $css ) ) { - @chmod( $css, 0775 ); - unlink( $css ); - } - - $css = $css_path . '_ie.css'; - if( is_file( $css ) ) { - @chmod( $css, 0775 ); - unlink( $css ); - } - } - } - - /** - * Returns the id's for this template. - */ - public function getIds() { - $ids = array(); - - // Only add the prefix if the template is using themeroller. - if( $this->settings['generateCSS'] ) { - // Iterate through all the id's and add the id. - foreach( $this->settings['ids'] as $index => $id ) { - $ids[$index] = $id[0] . $this->prefix . substr( $id, 1 ); - } - } - else { - $ids = $this->settings['ids']; - } - - // Return the id's with the prefix's in place. - return $ids; - } - - /** - * Set's the prefix of the template. - */ - public function setPrefix( $newPrefix ) { - // Set the prefix for this template. - $this->prefix = $newPrefix; - } - - /** - * Theme function for the base template class. - * - * @param array $variables - The variables used within this particular theme. - * @param string $subtemplate - The subtemplate to include. - * @return string The HTML markup of this theme. - */ - public function theme( $variables, $subtemplate = '' ) - { - $template = $variables['params']['template']; - $preprocess = 'theme_preprocess' . $subtemplate; - if( method_exists( $this, $preprocess ) ) { - $this->{$preprocess}( $variables ); - } - - // Extract the variables to a local namespace - extract($variables, EXTR_SKIP); - - // Start output buffering - ob_start(); - - // Include the template. - include "templates/{$template}/osmplayer_{$template}{$subtemplate}.tpl.php"; - - // Get the contents of the buffer - $contents = ob_get_contents(); - - // End buffering and discard - ob_end_clean(); - - // Return the contents - return $contents; - } -} -?> diff --git a/README.txt b/README.txt deleted file mode 100644 index b9735178..00000000 --- a/README.txt +++ /dev/null @@ -1,25 +0,0 @@ -Open Standard Media Player - Build by Alethia Inc. (c) 2011. - -http://www.mediafront.org - For documentaion, implementations, and examples... -http://www.alethia-inc.com - For customization inquiries and business prospects. - -ABOUT: - The open standard media player is an open source GPL - license free - full featured media player written in jQuery. - It was designed to dynamically play any media thrown it's way, whether it be HTML5 video - Flash video - Audio, etc. - - Although this media player was designed to be used within a Content Management environment, such as Drupal, you can - use this player for other applications outside of a CMS. - -USAGE: - For usage in Drupal Content Management System: - Simply download and install the MediaFront module http://www.drupal.org/project/mediafront. - - For usage outside of Drupal. - Open up the index.html page and observe how this player is created and used. - - -NEED HELP OR CUSTOMIZATIONS? - If you require any assistance, please visit Alethia Design's website at http://www.alethia-inc.com and inquire - using our Contact Form. We will get back with you shortly. - -ENJOY! diff --git a/assets/screenshot.png b/assets/screenshot.png deleted file mode 100755 index dace8fb8..00000000 Binary files a/assets/screenshot.png and /dev/null differ diff --git a/bin/osmplayer.compressed.js b/bin/osmplayer.compressed.js new file mode 100644 index 00000000..efbc09be --- /dev/null +++ b/bin/osmplayer.compressed.js @@ -0,0 +1,29 @@ +jQuery.fn.osmplayer||(jQuery.fn.osmplayer=function(a){return jQuery(this).each(function(){a=a||{};a.id=a.id||$(this).attr("id")||Math.random();minplayer.plugins[a.id]||(a.template=a.template||"default",osmplayer[a.template]?new osmplayer[a.template](jQuery(this),a):new osmplayer(jQuery(this),a))})});osmplayer=function(a,b){minplayer.call(this,a,b)};osmplayer.prototype=new minplayer;osmplayer.prototype.constructor=osmplayer; +osmplayer.prototype.create=function(a,b,c){return minplayer.prototype.create.call(this,a,"osmplayer",c)};osmplayer.prototype.construct=function(){this.options=jQuery.extend({playlist:"",swfplayer:"minplayer/flash/minplayer.swf"},this.options);minplayer.prototype.construct.call(this);this.playQueue=[];this.playIndex=0;this.playlist=this.create("playlist","osmplayer");this.playlist.bind("nodeLoad",function(a){return function(b,c){a.loadNode(c)}}(this))};osmplayer.prototype.fullScreenElement=function(){return this.elements.minplayer}; +osmplayer.prototype.loadNode=function(a){if(a.mediafiles){var b=a.mediafiles.media;if(b){this.playQueue.length=0;this.playQueue=[];this.playIndex=0;this.addToQueue(b.intro);this.addToQueue(b.commercial);this.addToQueue(b.prereel);this.addToQueue(b.media);this.addToQueue(b.postreel)}this.options.preview=osmplayer.getImage(a.mediafiles.image,"preview");this.playLoader.loadPreview();this.playNext()}};osmplayer.prototype.addToQueue=function(a){a&&this.playQueue.push(this.getFile(a))}; +osmplayer.prototype.getFile=function(a){if(a){var b=typeof a;if((b==="object"||b==="array")&&a[0])a=this.getBestMedia(a)}return a};osmplayer.prototype.getBestMedia=function(a){for(var b=null,c=a.length;c--;){var d=new minplayer.file(a[c]);if(!b||d.priority>b.priority)b=d}return b};osmplayer.prototype.playNext=function(){if(this.playQueue.length>this.playIndex){this.load(this.playQueue[this.playIndex]);this.playIndex++}else{if(!this.options.repeat)this.options.autostart=false;this.playIndex=0;this.playNext()}}; +osmplayer.getImage=function(a,b){var c="";if(a)if(a[b])c=a[b];else for(b in a)if(a.hasOwnProperty(b)){c=a[b];break}return typeof c==="string"?c:c.path};var osmplayer=osmplayer||{};osmplayer.parser=osmplayer.parser||{};osmplayer.parser["default"]={priority:1,valid:function(){return true},getType:function(){return"json"},getFeed:function(a,b,c){a=a.replace(/(.*)\??(.*)/i,"$1");return a+("?start-index="+b)+("&max-results="+c)},parse:function(a){return a}};osmplayer=osmplayer||{}; +osmplayer.parser=osmplayer.parser||{}; +osmplayer.parser.youtube={priority:10,valid:function(a){return a.search(/^http(s)?\:\/\/gdata\.youtube\.com/i)===0},getType:function(){return"jsonp"},getFeed:function(a,b,c){a=a.replace(/(.*)\??(.*)/i,"$1");return a+("?start-index="+(b+1))+("&max-results="+c)+"&v=2&alt=jsonc"},parse:function(a){var a=a.data,b={total_rows:a.totalItems,nodes:[]},c;for(c in a.items){var d=a.items[c];b.nodes.push({title:d.title,description:d.description,mediafiles:{image:{thumbnail:{path:d.thumbnail.sqDefault},image:{path:d.thumbnail.hqDefault}}, +media:{media:{player:"youtube",id:d.id}}}})}return b}};osmplayer=osmplayer||{};osmplayer.parser=osmplayer.parser||{}; +osmplayer.parser.rss={priority:8,valid:function(a){a=a.replace(/(.*)\??(.*)/i,"$1");return a.match(/\.rss$/i)!==null},getType:function(){return"xml"},getFeed:function(a){return a},parse:function(a){var b={total_rows:0,nodes:[]};jQuery("rss channel",a).find("item").each(function(){osmplayer.parser.rss.addRSSItem(b,$(this))});return b},addRSSItem:function(a,b){a.total_rows++;a.nodes.push({title:b.find("title").text(),description:b.find("annotation").text(),mediafiles:{image:{image:{path:b.find("image").text()}}, +media:{media:{path:b.find("location").text()}}}})}};osmplayer=osmplayer||{};osmplayer.parser=osmplayer.parser||{};osmplayer.parser.asx={priority:8,valid:function(a){a=a.replace(/(.*)\??(.*)/i,"$1");return a.match(/\.asx$/i)!==null},getType:function(){return"xml"},getFeed:function(a){return a},parse:function(a){var b={total_rows:0,nodes:[]};jQuery("asx entry",a).each(function(){osmplayer.parser.rss.addRSSItem(b,$(this))});return b}};osmplayer=osmplayer||{};osmplayer.parser=osmplayer.parser||{}; +osmplayer.parser.xsfp={priority:8,valid:function(a){a=a.replace(/(.*)\??(.*)/i,"$1");return a.match(/\.xml$/i)!==null},getType:function(){return"xml"},getFeed:function(a){return a},parse:function(a){var b={total_rows:0,nodes:[]};jQuery("playlist trackList track",a).each(function(){osmplayer.parser.rss.addRSSItem(b,$(this))});return b}};osmplayer=osmplayer||{};osmplayer.playlist=function(a,b){minplayer.display.call(this,"playlist",a,b)};osmplayer.playlist.prototype=new minplayer.display; +osmplayer.playlist.prototype.constructor=osmplayer.playlist; +osmplayer.playlist.prototype.construct=function(){this.options=jQuery.extend({vertical:true,playlist:"",pageLimit:10,shuffle:false},this.options);minplayer.display.prototype.construct.call(this);this.nodes=[];this.page=-1;this.currentItem=this.totalItems=0;this.queue=[];this.queuepos=0;this.playlist=this.options.playlist;this.scroll=this.create("scroll","osmplayer");this.pager=this.create("pager","osmplayer");this.pager.bind("nextPage",function(a){return function(){a.nextPage()}}(this));this.pager.bind("prevPage", +function(a){return function(){a.prevPage()}}(this));this.get("media",function(a){a.bind("ended",function(a){return function(){a.next()}}(this))});this.load(0,0)}; +osmplayer.playlist.prototype.set=function(a,b){if(typeof a!=="object")this.trigger("error","Playlist must be an object to set");else if(a.hasOwnProperty("total_rows")){if(a.total_rows&&a.nodes.length){this.totalItems=a.total_rows;this.currentItem=0;(this.page+1)*this.options.pageLimit>=this.totalItems?this.pager.nextPage.hide():this.pager.nextPage.show();var c=null,d=a.nodes.length;this.scroll.elements.list.empty();this.nodes=[];for(var f=0;f=this.queue.length)if(this.options.shuffle){a=Math.floor(Math.random()*this.totalItems);b=Math.floor(a/this.options.pageLimit);a=a%this.options.pageLimit;this.load(b,a)}else{a=this.currentItem+1;a>=this.nodes.length?this.load(b+1,0):this.loadItem(a)}else{this.queuepos=this.queuepos+1;a=this.queue[this.queuepos];this.load(a.page,a.item)}}; +osmplayer.playlist.prototype.prev=function(){this.queuepos=this.queuepos-1;this.queuepos=this.queuepos<0?0:this.queuepos;var a=this.queue[this.queuepos];a&&this.load(a.page,a.item)};osmplayer.playlist.prototype.loadItem=function(a){if(ac.priority&&(c=osmplayer.parser[d]);d={type:"GET",url:c.getFeed(this.playlist,this.page*this.options.pageLimit,this.options.pageLimit),success:function(a){return function(d){a.scroll.elements.playlist_busy&&a.scroll.elements.playlist_busy.hide();a.set(c.parse(d),b)}}(this),error:function(a){return function(b,c){a.scroll.elements.playlist_busy&&a.scroll.elements.playlist_busy.hide();a.trigger("error",c)}}(this)};var f="";if(f=c.getType())d.dataType=f;jQuery.ajax(d)}}; +osmplayer=osmplayer||{};osmplayer.scroll=function(a,b){minplayer.display.call(this,"scroll",a,b)};osmplayer.scroll.prototype=new minplayer.display;osmplayer.scroll.prototype.constructor=osmplayer.scroll; +osmplayer.scroll.prototype.construct=function(){this.options=jQuery.extend({vertical:true,hysteresis:40,scrollSpeed:20,scrollMode:"auto"},this.options);minplayer.display.prototype.construct.call(this);this.getMousePos=function(a){return a.pageY-this.display.offset().top};this.getPos=function(a){return this.ratio*(this.scrollSize-(a+this.handleSize))};this.getHandlePos=function(a){return this.scrollSize-(this.handleSize+a/this.ratio)};if(this.elements.scroll){this.scrollSize=this.elements.scroll.height(); +this.handleSize=17;this.scrollTop=this.scrollSize-this.handleSize;this.scrollMid=this.scrollSize/2;this.mousePos=0;this.refresh();this.scroll=this.elements.scroll.slider({orientation:"vertical",max:this.scrollSize,value:this.scrollTop,slide:function(a){return function(b,c){var d=a.getPos(c.value);if(d<0){d=0;a.scroll.slider("option","value",a.scrollTop)}a.elements.list.css("marginTop",-d+"px");return d>0}}(this)});this.options.scrollMode=="auto"&&this.elements.list.bind("mousemove",function(a){return function(b){b.preventDefault(); +a.mousePos=b.pageY-a.display.offset().top}}(this)).bind("mouseenter",function(a){return function(b){b.preventDefault();a.scrolling=true;setTimeout(function d(){if(a.scrolling){var b=a.mousePos-a.scrollMid;if(Math.abs(b)>a.options.hysteresis){var e=a.options.hysteresis,b=a.options.scrollSpeed*(b+e*(b>0?-1:0)),b=b/a.scrollMid,e=a.elements.list.css("marginTop"),e=parseFloat(e)-b,e=e>0?0:e,b=-a.listSize+a.scrollSize,e=eUsage: + *

+ *
+ *   // Create a media player.
+ *   var player = jQuery("#player").osmplayer({
+ *
+ *   });
+ *
+ * 
+ *

+ * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +osmplayer = function(context, options) { + + // Derive from minplayer + minplayer.call(this, context, options); +}; + +/** Derive from minplayer. */ +osmplayer.prototype = new minplayer(); + +/** Reset the constructor. */ +osmplayer.prototype.constructor = osmplayer; + +/** + * Creates a new plugin within this context. + * + * @param {string} name The name of the plugin you wish to create. + * @param {object} base The base object for this plugin. + * @param {object} context The context which you would like to create. + * @return {object} The new plugin object. + */ +osmplayer.prototype.create = function(name, base, context) { + return minplayer.prototype.create.call(this, name, 'osmplayer', context); +}; + +/** + * @see minplayer.plugin.construct + */ +osmplayer.prototype.construct = function() { + + // Make sure we provide default options... + this.options = jQuery.extend({ + playlist: '', + swfplayer: 'minplayer/flash/minplayer.swf' + }, this.options); + + // Call the minplayer display constructor. + minplayer.prototype.construct.call(this); + + /** The play queue and index. */ + this.playQueue = []; + this.playIndex = 0; + + /** The playlist for this media player. */ + this.playlist = this.create('playlist', 'osmplayer'); + + // Bind when the playlists loads a node. + this.playlist.bind('nodeLoad', (function(player) { + return function(event, data) { + + // Load this node. + player.loadNode(data); + }; + })(this)); +}; + +/** + * Gets the full screen element. + * + * @return {object} The element that will go into fullscreen. + */ +osmplayer.prototype.fullScreenElement = function() { + return this.elements.minplayer; +}; + +/** + * The load node function. + * + * @param {object} node A media node object. + */ +osmplayer.prototype.loadNode = function(node) { + if (node.mediafiles) { + + // Load the media files. + var media = node.mediafiles.media; + if (media) { + this.playQueue.length = 0; + this.playQueue = []; + this.playIndex = 0; + this.addToQueue(media.intro); + this.addToQueue(media.commercial); + this.addToQueue(media.prereel); + this.addToQueue(media.media); + this.addToQueue(media.postreel); + } + + // Load the preview image. + this.options.preview = osmplayer.getImage(node.mediafiles.image, 'preview'); + this.playLoader.loadPreview(); + + // Play the next media + this.playNext(); + } +}; + +/** + * Adds a file to the play queue. + * + * @param {object} file The file to add to the queue. + */ +osmplayer.prototype.addToQueue = function(file) { + if (file) { + this.playQueue.push(this.getFile(file)); + } +}; + +/** + * Returns a valid media file for this browser. + * + * @param {object} file The file object. + * @return {object} The best media file. + */ +osmplayer.prototype.getFile = function(file) { + if (file) { + var type = typeof file; + if (((type === 'object') || (type === 'array')) && file[0]) { + file = this.getBestMedia(file); + } + } + return file; +}; + +/** + * Returns the media file with the lowest weight value provided an array of + * media files. + * + * @param {object} files The media files to play. + * @return {object} The best media file. + */ +osmplayer.prototype.getBestMedia = function(files) { + var mFile = null; + var i = files.length; + while (i--) { + var tempFile = new minplayer.file(files[i]); + if (!mFile || (tempFile.priority > mFile.priority)) { + mFile = tempFile; + } + } + return mFile; +}; + +/** + * Plays the next media file in the queue. + */ +osmplayer.prototype.playNext = function() { + if (this.playQueue.length > this.playIndex) { + this.load(this.playQueue[this.playIndex]); + this.playIndex++; + } + else if (this.options.repeat) { + this.playIndex = 0; + this.playNext(); + } + else { + // If there is no playlist, and no repeat, we will + // just seek to the beginning and pause. + this.options.autostart = false; + this.playIndex = 0; + this.playNext(); + } +}; + +/** + * Returns an image provided image array. + * + * @param {object} images The images to search for. + * @param {string} type The type of image to look for. + * @return {object} The best image match. + */ +osmplayer.getImage = function(images, type) { + var image = ''; + + if (images) { + + // If the image type exists, then just use that one. + if (images[type]) { + image = images[type]; + } + else { + + // Or, just pick the first one available. + for (type in images) { + if (images.hasOwnProperty(type)) { + image = images[type]; + break; + } + } + } + } + + // Return the image path. + return (typeof image === 'string') ? image : image.path; +}; +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +/** The parser object. */ +osmplayer.parser = osmplayer.parser || {}; + +/** + * The default parser object. + * + * @return {object} The default parser. + **/ +osmplayer.parser['default'] = { + + // The priority for this parser. + priority: 1, + + // This parser is always valid. + valid: function(feed) { + return true; + }, + + // Returns the type of request to make. + getType: function(feed) { + return 'json'; + }, + + // Returns the feed provided the start and numItems. + getFeed: function(feed, start, numItems) { + feed = feed.replace(/(.*)\??(.*)/i, '$1'); + feed += '?start-index=' + start; + feed += '&max-results=' + numItems; + return feed; + }, + + // Parse the feed. + parse: function(data) { + return data; + } +}; +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +/** The parser object. */ +osmplayer.parser = osmplayer.parser || {}; + +/** + * The youtube parser object. + * + * @return {object} The youtube parser. + **/ +osmplayer.parser.youtube = { + + // The priority for this parser. + priority: 10, + + // Return if this is a valid youtube feed. + valid: function(feed) { + return (feed.search(/^http(s)?\:\/\/gdata\.youtube\.com/i) === 0); + }, + + // Returns the type of request to make. + getType: function(feed) { + return 'jsonp'; + }, + + // Returns the feed provided the start and numItems. + getFeed: function(feed, start, numItems) { + feed = feed.replace(/(.*)\??(.*)/i, '$1'); + feed += '?start-index=' + (start + 1); + feed += '&max-results=' + (numItems); + feed += '&v=2&alt=jsonc'; + return feed; + }, + + // Parse the feed. + parse: function(data) { + data = data.data; + var playlist = { + total_rows: data.totalItems, + nodes: [] + }; + + // Iterate through the items and parse it. + for (var index in data.items) { + var item = data.items[index]; + playlist.nodes.push({ + title: item.title, + description: item.description, + mediafiles: { + image: { + 'thumbnail': { + path: item.thumbnail.sqDefault + }, + 'image': { + path: item.thumbnail.hqDefault + } + }, + media: { + 'media': { + player: 'youtube', + id: item.id + } + } + } + }); + } + + return playlist; + } +}; +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +/** The parser object. */ +osmplayer.parser = osmplayer.parser || {}; + +/** + * The rss parser object. + * + * @return {object} The rss parser. + **/ +osmplayer.parser.rss = { + + // The priority for this parser. + priority: 8, + + // Return if this is a valid youtube feed. + valid: function(feed) { + feed = feed.replace(/(.*)\??(.*)/i, '$1'); + return feed.match(/\.rss$/i) !== null; + }, + + // Returns the type of request to make. + getType: function(feed) { + return 'xml'; + }, + + // Returns the feed provided the start and numItems. + getFeed: function(feed, start, numItems) { + return feed; + }, + + // Parse the feed. + parse: function(data) { + var playlist = { + total_rows: 0, + nodes: [] + }; + jQuery('rss channel', data).find('item').each(function(index) { + osmplayer.parser.rss.addRSSItem(playlist, $(this)); + }); + return playlist; + }, + + // Parse an RSS item. + addRSSItem: function(playlist, item) { + playlist.total_rows++; + playlist.nodes.push({ + title: item.find('title').text(), + description: item.find('annotation').text(), + mediafiles: { + image: { + 'image': { + path: item.find('image').text() + } + }, + media: { + 'media': { + path: item.find('location').text() + } + } + } + }); + } +}; +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +/** The parser object. */ +osmplayer.parser = osmplayer.parser || {}; + +/** + * The asx parser object. + * + * @return {object} The asx parser. + **/ +osmplayer.parser.asx = { + + // The priority for this parser. + priority: 8, + + // Return if this is a valid youtube feed. + valid: function(feed) { + feed = feed.replace(/(.*)\??(.*)/i, '$1'); + return feed.match(/\.asx$/i) !== null; + }, + + // Returns the type of request to make. + getType: function(feed) { + return 'xml'; + }, + + // Returns the feed provided the start and numItems. + getFeed: function(feed, start, numItems) { + return feed; + }, + + // Parse the feed. + parse: function(data) { + var playlist = { + total_rows: 0, + nodes: [] + }; + jQuery('asx entry', data).each(function(index) { + osmplayer.parser.rss.addRSSItem(playlist, $(this)); + }); + return playlist; + } +}; +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +/** The parser object. */ +osmplayer.parser = osmplayer.parser || {}; + +/** + * The xsfp parser object. + * + * @return {object} The xsfp parser. + **/ +osmplayer.parser.xsfp = { + + // The priority for this parser. + priority: 8, + + // Return if this is a valid youtube feed. + valid: function(feed) { + feed = feed.replace(/(.*)\??(.*)/i, '$1'); + return feed.match(/\.xml$/i) !== null; + }, + + // Returns the type of request to make. + getType: function(feed) { + return 'xml'; + }, + + // Returns the feed provided the start and numItems. + getFeed: function(feed, start, numItems) { + return feed; + }, + + // Parse the feed. + parse: function(data) { + var playlist = { + total_rows: 0, + nodes: [] + }; + jQuery('playlist trackList track', data).each(function(index) { + osmplayer.parser.rss.addRSSItem(playlist, $(this)); + }); + return playlist; + } +}; +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +/** + * @constructor + * @extends minplayer.display + * @class This class creates the playlist functionality for the minplayer. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +osmplayer.playlist = function(context, options) { + + // Derive from display + minplayer.display.call(this, 'playlist', context, options); +}; + +/** Derive from minplayer.display. */ +osmplayer.playlist.prototype = new minplayer.display(); + +/** Reset the constructor. */ +osmplayer.playlist.prototype.constructor = osmplayer.playlist; + +/** + * @see minplayer.plugin#construct + */ +osmplayer.playlist.prototype.construct = function() { + + // Make sure we provide default options... + this.options = jQuery.extend({ + vertical: true, + playlist: '', + pageLimit: 10, + shuffle: false + }, this.options); + + // Call the minplayer plugin constructor. + minplayer.display.prototype.construct.call(this); + + /** The nodes within this playlist. */ + this.nodes = []; + + // Current page. + this.page = -1; + + // The total amount of nodes. + this.totalItems = 0; + + // The current loaded item index. + this.currentItem = 0; + + // The play queue. + this.queue = []; + + // The queue position. + this.queuepos = 0; + + // The current playlist. + this.playlist = this.options.playlist; + + // Create the scroll bar. + this.scroll = this.create('scroll', 'osmplayer'); + + // Create the pager. + this.pager = this.create('pager', 'osmplayer'); + this.pager.bind('nextPage', (function(playlist) { + return function(event) { + playlist.nextPage(); + }; + })(this)); + this.pager.bind('prevPage', (function(playlist) { + return function(event) { + playlist.prevPage(); + }; + })(this)); + + // Get the media. + this.get('media', function(media) { + media.bind('ended', (function(playlist) { + return function(event) { + playlist.next(); + }; + })(this)); + }); + + // Load the playlist. + this.load(0, 0); +}; + +/** + * Sets the playlist. + * + * @param {object} playlist The playlist object. + * @param {integer} loadIndex The index of the item to load. + */ +osmplayer.playlist.prototype.set = function(playlist, loadIndex) { + + // Check to make sure the playlist is an object. + if (typeof playlist !== 'object') { + this.trigger('error', 'Playlist must be an object to set'); + return; + } + + // Check to make sure the playlist has correct format. + if (!playlist.hasOwnProperty('total_rows')) { + this.trigger('error', 'Unknown playlist format.'); + return; + } + + // Make sure the playlist has some rows. + if (playlist.total_rows && playlist.nodes.length) { + + // Set the total rows. + this.totalItems = playlist.total_rows; + this.currentItem = 0; + + // Show or hide the next page if there is or is not a next page. + if (((this.page + 1) * this.options.pageLimit) >= this.totalItems) { + this.pager.nextPage.hide(); + } + else { + this.pager.nextPage.show(); + } + + var teaser = null; + var numNodes = playlist.nodes.length; + this.scroll.elements.list.empty(); + this.nodes = []; + + // Iterate through all the nodes. + for (var index = 0; index < numNodes; index++) { + + // Create the teaser object. + teaser = this.create('teaser', 'osmplayer', this.scroll.elements.list); + teaser.setNode(playlist.nodes[index]); + teaser.bind('nodeLoad', (function(playlist, index) { + return function(event, data) { + playlist.loadItem(index); + }; + })(this, index)); + + // Add this to our nodes array. + this.nodes.push(teaser); + + // If the index is equal to the loadIndex. + if (loadIndex === index) { + this.loadItem(index); + } + } + + // Refresh the sizes. + this.scroll.refresh(); + + // Trigger that the playlist has loaded. + this.trigger('playlistLoad', playlist); + } +}; + +/** + * Stores the current playlist state in the queue. + */ +osmplayer.playlist.prototype.setQueue = function() { + + // Add this item to the queue. + this.queue.push({ + page: this.page, + item: this.currentItem + }); + + // Store the current queue position. + this.queuepos = this.queue.length; +}; + +/** + * Loads the next item. + */ +osmplayer.playlist.prototype.next = function() { + var item = 0, page = this.page; + + // See if we are at the front of the queue. + if (this.queuepos >= this.queue.length) { + + // If this is shuffle, then load a random item. + if (this.options.shuffle) { + item = Math.floor(Math.random() * this.totalItems); + page = Math.floor(item / this.options.pageLimit); + item = item % this.options.pageLimit; + this.load(page, item); + } + else { + + // Otherwise, increment the current item by one. + item = (this.currentItem + 1); + if (item >= this.nodes.length) { + this.load(page + 1, 0); + } + else { + this.loadItem(item); + } + } + } + else { + + // Load the next item in the queue. + this.queuepos = this.queuepos + 1; + var currentQueue = this.queue[this.queuepos]; + this.load(currentQueue.page, currentQueue.item); + } +}; + +/** + * Loads the previous item. + */ +osmplayer.playlist.prototype.prev = function() { + + // Move back into the queue. + this.queuepos = this.queuepos - 1; + this.queuepos = (this.queuepos < 0) ? 0 : this.queuepos; + var currentQueue = this.queue[this.queuepos]; + if (currentQueue) { + this.load(currentQueue.page, currentQueue.item); + } +}; + +/** + * Loads a playlist node. + * + * @param {number} index The index of the item you would like to load. + */ +osmplayer.playlist.prototype.loadItem = function(index) { + if (index < this.nodes.length) { + this.setQueue(); + + // Get the teaser at the current index and deselect it. + var teaser = this.nodes[this.currentItem]; + teaser.select(false); + this.currentItem = index; + + // Get the new teaser and select it. + teaser = this.nodes[index]; + teaser.select(true); + this.trigger('nodeLoad', teaser.node); + } +}; + +/** + * Loads the next page. + * + * @param {integer} loadIndex The index of the item to load. + */ +osmplayer.playlist.prototype.nextPage = function(loadIndex) { + this.load(this.page + 1, loadIndex); +}; + +/** + * Loads the previous page. + * + * @param {integer} loadIndex The index of the item to load. + */ +osmplayer.playlist.prototype.prevPage = function(loadIndex) { + this.load(this.page - 1, loadIndex); +}; + +/** + * Loads a playlist. + * + * @param {integer} page The page to load. + * @param {integer} loadIndex The index of the item to load. + */ +osmplayer.playlist.prototype.load = function(page, loadIndex) { + + // If the playlist and pages are the same, then no need to load. + if ((this.playlist == this.options.playlist) && (page == this.page)) { + this.loadItem(loadIndex); + } + + // Set the new playlist. + this.playlist = this.options.playlist; + + // If the playlist is an object, then go ahead and set it. + if (typeof this.playlist == 'object') { + this.set(this.playlist); + this.playlist = this.playlist.endpoint; + return; + } + + // Say that we are busy. + if (this.scroll.elements.playlist_busy) { + this.scroll.elements.playlist_busy.show(); + } + + // Normalize the page. + page = page || 0; + page = (page < 0) ? 0 : page; + + // Set the queue. + this.setQueue(); + + // Set the new page. + this.page = page; + + // Hide or show the page based on if we are on the first page. + if (this.page == 0) { + this.pager.prevPage.hide(); + } + else { + this.pager.prevPage.show(); + } + + // Get the highest priority parser. + var parser = osmplayer.parser['default']; + for (var name in osmplayer.parser) { + if (osmplayer.parser[name].valid(this.playlist)) { + if (osmplayer.parser[name].priority > parser.priority) { + parser = osmplayer.parser[name]; + } + } + } + + // The start index. + var start = this.page * this.options.pageLimit; + + // Get the feed from the parser. + var feed = parser.getFeed( + this.playlist, + start, + this.options.pageLimit + ); + + // Build our request. + var request = { + type: 'GET', + url: feed, + success: (function(playlist) { + return function(data) { + if (playlist.scroll.elements.playlist_busy) { + playlist.scroll.elements.playlist_busy.hide(); + } + playlist.set(parser.parse(data), loadIndex); + }; + })(this), + error: (function(playlist) { + return function(XMLHttpRequest, textStatus, errorThrown) { + if (playlist.scroll.elements.playlist_busy) { + playlist.scroll.elements.playlist_busy.hide(); + } + playlist.trigger('error', textStatus); + } + })(this) + }; + + // Set the data if applicable. + var dataType = ''; + if (dataType = parser.getType()) { + request.dataType = dataType; + } + + // Perform an ajax callback. + jQuery.ajax(request); +}; +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +/** + * @constructor + * @extends minplayer.display + * @class This class provides the scroll functionality for the playlists. + * + * We can calculate how the scrollbar controls the playlist using the + * following diagram / equations. + * ___ ____________ + * | | |\ + * | | list | \ + * | | |y \ + * | | | \ + * | |____________| \ _ _____ + * | | |\ | | | + * | | | \ | | | + * | | | \ | |x | + * | | | \ | | | + * | | | \|_|_ | + * | | | | | | | + * l | window | | | h w + * | | | |_|_| | + * | | | /| | | + * | | | / | | | + * | | | / v| | | + * | | | / | | | + * | |____________|/ |_|____| + * | | | / + * | | | / + * | | | / + * | | | / + * |__|____________|/ + * + * l - The list height. + * h - Handle Bar height. + * w - Window height. + * x - The distance from top of window to the top of the handle. + * y - The disatnce from the top of the list to the top of the window. + * v - The distance from bottom of window to the bottom of the handle. + * + * jQuery UI provides "v". We already know "l", "h", "w". We can then + * calculate the relationship between the scroll bar handle position to the + * list position using the following equations. + * + * x = (w - (v + h)) + * y = ((l - w)/(w - h)) * x + * + * -- or -- + * + * y = ((l - w)/(w - h)) * (w - (v + h)) + * + * We can statically calculate the ((l - w)/(w - h)) as a ratio and use + * that to speed up calculations as follows. + * + * ratio = ((l - w)/(w - h)); + * + * So, our translation equations are as follows... + * + * y = ratio * (w - (v + h)) + * v = w - (h + (y / ratio)) + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +osmplayer.scroll = function(context, options) { + + // Derive from display + minplayer.display.call(this, 'scroll', context, options); +}; + +/** Derive from minplayer.display. */ +osmplayer.scroll.prototype = new minplayer.display(); + +/** Reset the constructor. */ +osmplayer.scroll.prototype.constructor = osmplayer.scroll; + +/** + * @see minplayer.plugin#construct + */ +osmplayer.scroll.prototype.construct = function() { + + // Make sure we provide default options... + this.options = jQuery.extend({ + vertical: true, + hysteresis: 40, + scrollSpeed: 20, + scrollMode: 'auto' + }, this.options); + + // Call the minplayer plugin constructor. + minplayer.display.prototype.construct.call(this); + + this.getMousePos = function(event) { + return (event.pageY - this.display.offset().top); + }; + this.getPos = function(handlePos) { + return this.ratio * (this.scrollSize - (handlePos + this.handleSize)); + }; + this.getHandlePos = function(pos) { + return this.scrollSize - (this.handleSize + (pos / this.ratio)); + }; + + // If they have a scroll bar. + if (this.elements.scroll) { + + // Get the values of our variables. + this.scrollSize = this.elements.scroll.height(); + this.handleSize = 17; + this.scrollTop = (this.scrollSize - this.handleSize); + this.scrollMid = this.scrollSize / 2; + this.mousePos = 0; + + // Refresh the scroll. + this.refresh(); + + // Create the scroll bar slider control. + this.scroll = this.elements.scroll.slider({ + orientation: 'vertical', + max: this.scrollSize, + value: this.scrollTop, + slide: (function(scroll) { + return function(event, ui) { + + // Get the new position. + var pos = scroll.getPos(ui.value); + + // Ensure it doesn't go over the limits. + if (pos < 0) { + pos = 0; + scroll.scroll.slider('option', 'value', scroll.scrollTop); + } + + // Set our list position. + scroll.elements.list.css('marginTop', -pos + 'px'); + + // Return false to stop the scrolling. + return (pos > 0); + }; + })(this) + }); + + // If they wish to have auto scroll mode. + if (this.options.scrollMode == 'auto') { + + // Bind to the mouse events. + this.elements.list.bind('mousemove', (function(scroll) { + + // Return our event function. + return function(event) { + event.preventDefault(); + scroll.mousePos = (event.pageY - scroll.display.offset().top); + }; + + })(this)).bind('mouseenter', (function(scroll) { + + // Return our event function. + return function(event) { + event.preventDefault(); + scroll.scrolling = true; + setTimeout(function setScroll() { + if (scroll.scrolling) { + + // Get the delta. + var delta = scroll.mousePos - scroll.scrollMid; + + // Determine if we are within our hysteresis. + if (Math.abs(delta) > scroll.options.hysteresis) { + + // Get the hysteresis and delta. + var hyst = scroll.options.hysteresis; + hyst *= (delta > 0) ? -1 : 0; + delta = (scroll.options.scrollSpeed * (delta + hyst)); + delta /= scroll.scrollMid; + + // Get the scroll position. + var pos = scroll.elements.list.css('marginTop'); + pos = parseFloat(pos) - delta; + pos = (pos > 0) ? 0 : pos; + + // Get the maximum top position. + var top = -scroll.listSize + scroll.scrollSize; + pos = (pos < top) ? top : pos; + + // Set the new scroll position. + scroll.elements.list.css('marginTop', pos + 'px'); + + // Set the scroll position. + pos = scroll.getHandlePos(-pos); + scroll.scroll.slider('option', 'value', pos); + } + + // Set timeout to try again. + setTimeout(setScroll, 20); + } + }, 20); + }; + + })(this)).bind('mouseleave', (function(scroll) { + + // Return our event function. + return function(event) { + event.preventDefault(); + scroll.scrolling = false; + }; + + })(this)); + } + } +}; + +/** + * Refresh all the variables that may change. + */ +osmplayer.scroll.prototype.refresh = function() { + this.listSize = this.elements.list.height(); + this.ratio = (this.listSize - this.scrollSize); + this.ratio /= (this.scrollSize - this.handleSize); + if (this.scroll) { + this.elements.list.css('marginTop', '0px'); + this.scroll.slider('option', 'value', this.getHandlePos(0)); + } +}; +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +/** + * @constructor + * @extends minplayer.display + * @class This class provides pager functionality. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +osmplayer.pager = function(context, options) { + + // Derive from display + minplayer.display.call(this, 'pager', context, options); +}; + +/** Derive from minplayer.display. */ +osmplayer.pager.prototype = new minplayer.display(); + +/** Reset the constructor. */ +osmplayer.pager.prototype.constructor = osmplayer.pager; + +/** + * @see minplayer.plugin#construct + */ +osmplayer.pager.prototype.construct = function() { + + // Call the minplayer plugin constructor. + minplayer.display.prototype.construct.call(this); + + // Setup the prev button. + this.prevPage = this.elements.prevPage.click((function(pager) { + return function(event) { + event.preventDefault(); + pager.trigger('prevPage'); + }; + })(this)); + + // Setup the next button. + this.nextPage = this.elements.nextPage.click((function(pager) { + return function(event) { + event.preventDefault(); + pager.trigger('nextPage'); + }; + })(this)); +}; +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +/** + * @constructor + * @extends minplayer.display + * @class This class provides teaser functionality. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +osmplayer.teaser = function(context, options) { + + /** The preview image. */ + this.preview = null; + + // Derive from display + minplayer.display.call(this, 'teaser', context, options); +}; + +/** Derive from minplayer.display. */ +osmplayer.teaser.prototype = new minplayer.display(); + +/** Reset the constructor. */ +osmplayer.teaser.prototype.constructor = osmplayer.teaser; + +/** + * Selects the teaser. + * + * @param {boolean} selected TRUE if selected, FALSE otherwise. + */ +osmplayer.teaser.prototype.select = function(selected) { +}; + +/** + * Sets the node. + * + * @param {object} node The node object to set. + */ +osmplayer.teaser.prototype.setNode = function(node) { + + // Add this to the node info for this teaser. + this.node = node; + + // Set the title of the teaser. + if (this.elements.title) { + this.elements.title.text(node.title); + } + + // Load the thumbnail image if it exists. + var image = osmplayer.getImage(node.mediafiles.image, 'thumbnail'); + if (image) { + if (this.elements.image) { + this.preview = new minplayer.image(this.elements.image); + this.preview.load(image); + } + } + + // Bind when they click on this teaser. + this.display.unbind('click').click((function(teaser) { + return function(event) { + event.preventDefault(); + teaser.trigger('nodeLoad', teaser.node); + }; + })(this)); +}; diff --git a/css/README.txt b/css/README.txt deleted file mode 100755 index 01b3bb02..00000000 --- a/css/README.txt +++ /dev/null @@ -1 +0,0 @@ -This is the folder to contain all of the cached CSS files. Do not place anything in this directory. \ No newline at end of file diff --git a/doc/files.html b/doc/files.html new file mode 100644 index 00000000..73c59bf0 --- /dev/null +++ b/doc/files.html @@ -0,0 +1,336 @@ + + + + + + JsDoc Reference - File Index + + + + + + + + + + +
+

File Index

+ + +
+

src/osmplayer.js

+ +
+ + + + +
+
+
+ +
+

src/osmplayer.pager.js

+ +
+ + + + +
+
+
+ +
+

src/osmplayer.parser.asx.js

+ +
+ + + + +
+
+
+ +
+

src/osmplayer.parser.default.js

+ +
+ + + + +
+
+
+ +
+

src/osmplayer.parser.rss.js

+ +
+ + + + +
+
+
+ +
+

src/osmplayer.parser.xspf.js

+ +
+ + + + +
+
+
+ +
+

src/osmplayer.parser.youtube.js

+ +
+ + + + +
+
+
+ +
+

src/osmplayer.playlist.js

+ +
+ + + + +
+
+
+ +
+

src/osmplayer.scroll.js

+ +
+ + + + +
+
+
+ +
+

src/osmplayer.teaser.js

+ +
+ + + + +
+
+
+ + +
+
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 23:04:33 GMT-0700 (PDT) +
+ + \ No newline at end of file diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 00000000..3e48fd21 --- /dev/null +++ b/doc/index.html @@ -0,0 +1,258 @@ + + + + + + JsDoc Reference - Index + + + + + + + + + + +
+

Class Index

+ + +
+

_global_

+ +
+
+ +
+

jQuery.fn.osmplayer

+ +
+
+ +
+

osmplayer

+ The main osmplayer class. +
+
+ +
+

osmplayer.pager

+ This class provides pager functionality. +
+
+ +
+

osmplayer.playlist

+ This class creates the playlist functionality for the minplayer. +
+
+ +
+

osmplayer.scroll

+ This class provides the scroll functionality for the playlists. +
+
+ +
+

osmplayer.teaser

+ This class provides teaser functionality. +
+
+ + +
+
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 23:04:33 GMT-0700 (PDT) +
+ + \ No newline at end of file diff --git a/doc/symbols/_global_.html b/doc/symbols/_global_.html new file mode 100644 index 00000000..d2580e2a --- /dev/null +++ b/doc/symbols/_global_.html @@ -0,0 +1,488 @@ + + + + + + + JsDoc Reference - _global_ + + + + + + + + + + + + + +
+ +

+ + Built-In Namespace _global_ +

+ + +

+ + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
  +
getFeed(feed, start, numItems) +
+
+
  +
getType(feed) +
+
+
  +
parse(data) +
+
+
  +
valid(feed) +
+
+
+ + + + + + + + + + + + + + + +
+ Method Detail +
+ + +
+ + + getFeed(feed, start, numItems) + +
+
+ + +
+ Defined in: osmplayer.parser.default.js. + + +
+ + + + +
+
Parameters:
+ +
+ feed + +
+
+ +
+ start + +
+
+ +
+ numItems + +
+
+ +
+ + + + + + + + +
+ + +
+ + + getType(feed) + +
+
+ + +
+ Defined in: osmplayer.parser.default.js. + + +
+ + + + +
+
Parameters:
+ +
+ feed + +
+
+ +
+ + + + + + + + +
+ + +
+ + + parse(data) + +
+
+ + +
+ Defined in: osmplayer.parser.default.js. + + +
+ + + + +
+
Parameters:
+ +
+ data + +
+
+ +
+ + + + + + + + +
+ + +
+ + + valid(feed) + +
+
+ + +
+ Defined in: osmplayer.parser.default.js. + + +
+ + + + +
+
Parameters:
+ +
+ feed + +
+
+ +
+ + + + + + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 23:04:33 GMT-0700 (PDT) +
+ + diff --git a/doc/symbols/jQuery.fn.osmplayer.html b/doc/symbols/jQuery.fn.osmplayer.html new file mode 100644 index 00000000..69658a84 --- /dev/null +++ b/doc/symbols/jQuery.fn.osmplayer.html @@ -0,0 +1,329 @@ + + + + + + + JsDoc Reference - jQuery.fn.osmplayer + + + + + + + + + + + + + +
+ +

+ + Class jQuery.fn.osmplayer +

+ + +

+ + + + + + +
Defined in: osmplayer.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ jQuery.fn.osmplayer(options) +
+
+
+ + + + + + + + + + + + +
+
+ Class Detail +
+ +
+ jQuery.fn.osmplayer(options) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {object} options + +
+
The options for this jQuery prototype.
+ +
+ + + + + +
+
Returns:
+ +
{Array} jQuery object.
+ +
+ + + + +
+ + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 23:04:33 GMT-0700 (PDT) +
+ + diff --git a/doc/symbols/osmplayer.html b/doc/symbols/osmplayer.html new file mode 100644 index 00000000..36066ac5 --- /dev/null +++ b/doc/symbols/osmplayer.html @@ -0,0 +1,952 @@ + + + + + + + JsDoc Reference - osmplayer + + + + + + + + + + + + + +
+ +

+ + Class osmplayer +

+ + +

+ +
Extends + minplayer.
+ + + The main osmplayer class. + +

Usage: +


+
+  // Create a media player.
+  var player = jQuery("#player").osmplayer({
+
+  });
+
+
+

+ + +
Defined in: osmplayer.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ osmplayer(context, options) +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  + +
Reset the constructor.
+
<static>   +
+ osmplayer.parser +
+
The parser object.
+
  +
+ playlist +
+
The playlist for this media player.
+
  +
+ playQueue +
+
The play queue and index.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
  +
addToQueue(file) +
+
Adds a file to the play queue.
+
  + +
+
  +
create(name, base, context) +
+
Creates a new plugin within this context.
+
  + +
Gets the full screen element.
+
  +
getBestMedia(files) +
+
Returns the media file with the lowest weight value provided an array of +media files.
+
  +
getFile(file) +
+
Returns a valid media file for this browser.
+
<static>   +
osmplayer.getImage(images, type) +
+
Returns an image provided image array.
+
  +
loadNode(node) +
+
The load node function.
+
  + +
Plays the next media file in the queue.
+
+ + + + + + + + + +
+
+ Class Detail +
+ +
+ osmplayer(context, options) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {object} context + +
+
The jQuery context.
+ +
+ {object} options + +
+
This components options.
+ +
+ + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + constructor + +
+
+ Reset the constructor. + + +
+ + + + + + + + +
+ + +
<static> + + + osmplayer.parser + +
+
+ The parser object. + +
+ Defined in: osmplayer.parser.default.js. + + +
+ + + + + + + + +
+ + +
+ + + playlist + +
+
+ The playlist for this media player. + + +
+ + + + + + + + +
+ + +
+ + + playQueue + +
+
+ The play queue and index. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
+ + + addToQueue(file) + +
+
+ Adds a file to the play queue. + + +
+ + + + +
+
Parameters:
+ +
+ {object} file + +
+
The file to add to the queue.
+ +
+ + + + + + + + +
+ + +
+ + + construct() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.plugin.construct
+ +
+ + +
+ + +
+ + {object} + create(name, base, context) + +
+
+ Creates a new plugin within this context. + + +
+ + + + +
+
Parameters:
+ +
+ {string} name + +
+
The name of the plugin you wish to create.
+ +
+ {object} base + +
+
The base object for this plugin.
+ +
+ {object} context + +
+
The context which you would like to create.
+ +
+ + + + + +
+
Returns:
+ +
{object} The new plugin object.
+ +
+ + + + +
+ + +
+ + {object} + fullScreenElement() + +
+
+ Gets the full screen element. + + +
+ + + + + + + + +
+
Returns:
+ +
{object} The element that will go into fullscreen.
+ +
+ + + + +
+ + +
+ + {object} + getBestMedia(files) + +
+
+ Returns the media file with the lowest weight value provided an array of +media files. + + +
+ + + + +
+
Parameters:
+ +
+ {object} files + +
+
The media files to play.
+ +
+ + + + + +
+
Returns:
+ +
{object} The best media file.
+ +
+ + + + +
+ + +
+ + {object} + getFile(file) + +
+
+ Returns a valid media file for this browser. + + +
+ + + + +
+
Parameters:
+ +
+ {object} file + +
+
The file object.
+ +
+ + + + + +
+
Returns:
+ +
{object} The best media file.
+ +
+ + + + +
+ + +
<static> + + {object} + osmplayer.getImage(images, type) + +
+
+ Returns an image provided image array. + + +
+ + + + +
+
Parameters:
+ +
+ {object} images + +
+
The images to search for.
+ +
+ {string} type + +
+
The type of image to look for.
+ +
+ + + + + +
+
Returns:
+ +
{object} The best image match.
+ +
+ + + + +
+ + +
+ + + loadNode(node) + +
+
+ The load node function. + + +
+ + + + +
+
Parameters:
+ +
+ {object} node + +
+
A media node object.
+ +
+ + + + + + + + +
+ + +
+ + + playNext() + +
+
+ Plays the next media file in the queue. + + +
+ + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 23:04:33 GMT-0700 (PDT) +
+ + diff --git a/doc/symbols/osmplayer.pager.html b/doc/symbols/osmplayer.pager.html new file mode 100644 index 00000000..9ac902d7 --- /dev/null +++ b/doc/symbols/osmplayer.pager.html @@ -0,0 +1,449 @@ + + + + + + + JsDoc Reference - osmplayer.pager + + + + + + + + + + + + + +
+ +

+ + Class osmplayer.pager +

+ + +

+ +
Extends + minplayer.display.
+ + + This class provides pager functionality. + + +
Defined in: osmplayer.pager.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ osmplayer.pager(context, options) +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  + +
Reset the constructor.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
  + +
+
+ + + + + + + + + +
+
+ Class Detail +
+ +
+ osmplayer.pager(context, options) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {object} context + +
+
The jQuery context.
+ +
+ {object} options + +
+
This components options.
+ +
+ + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + constructor + +
+
+ Reset the constructor. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
+ + + construct() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.plugin#construct
+ +
+ + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 23:04:33 GMT-0700 (PDT) +
+ + diff --git a/doc/symbols/osmplayer.playlist.html b/doc/symbols/osmplayer.playlist.html new file mode 100644 index 00000000..68cbad2a --- /dev/null +++ b/doc/symbols/osmplayer.playlist.html @@ -0,0 +1,820 @@ + + + + + + + JsDoc Reference - osmplayer.playlist + + + + + + + + + + + + + +
+ +

+ + Class osmplayer.playlist +

+ + +

+ +
Extends + minplayer.display.
+ + + This class creates the playlist functionality for the minplayer. + + +
Defined in: osmplayer.playlist.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ osmplayer.playlist(context, options) +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  + +
Reset the constructor.
+
  +
+ nodes +
+
The nodes within this playlist.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
  + +
+
  +
load(page, loadIndex) +
+
Loads a playlist.
+
  +
loadItem(index) +
+
Loads a playlist node.
+
  +
next() +
+
Loads the next item.
+
  +
nextPage(loadIndex) +
+
Loads the next page.
+
  +
prev() +
+
Loads the previous item.
+
  +
prevPage(loadIndex) +
+
Loads the previous page.
+
  +
set(playlist, loadIndex) +
+
Sets the playlist.
+
  + +
Stores the current playlist state in the queue.
+
+ + + + + + + + + +
+
+ Class Detail +
+ +
+ osmplayer.playlist(context, options) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {object} context + +
+
The jQuery context.
+ +
+ {object} options + +
+
This components options.
+ +
+ + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + constructor + +
+
+ Reset the constructor. + + +
+ + + + + + + + +
+ + +
+ + + nodes + +
+
+ The nodes within this playlist. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
+ + + construct() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.plugin#construct
+ +
+ + +
+ + +
+ + + load(page, loadIndex) + +
+
+ Loads a playlist. + + +
+ + + + +
+
Parameters:
+ +
+ {integer} page + +
+
The page to load.
+ +
+ {integer} loadIndex + +
+
The index of the item to load.
+ +
+ + + + + + + + +
+ + +
+ + + loadItem(index) + +
+
+ Loads a playlist node. + + +
+ + + + +
+
Parameters:
+ +
+ {number} index + +
+
The index of the item you would like to load.
+ +
+ + + + + + + + +
+ + +
+ + + next() + +
+
+ Loads the next item. + + +
+ + + + + + + + + + + +
+ + +
+ + + nextPage(loadIndex) + +
+
+ Loads the next page. + + +
+ + + + +
+
Parameters:
+ +
+ {integer} loadIndex + +
+
The index of the item to load.
+ +
+ + + + + + + + +
+ + +
+ + + prev() + +
+
+ Loads the previous item. + + +
+ + + + + + + + + + + +
+ + +
+ + + prevPage(loadIndex) + +
+
+ Loads the previous page. + + +
+ + + + +
+
Parameters:
+ +
+ {integer} loadIndex + +
+
The index of the item to load.
+ +
+ + + + + + + + +
+ + +
+ + + set(playlist, loadIndex) + +
+
+ Sets the playlist. + + +
+ + + + +
+
Parameters:
+ +
+ {object} playlist + +
+
The playlist object.
+ +
+ {integer} loadIndex + +
+
The index of the item to load.
+ +
+ + + + + + + + +
+ + +
+ + + setQueue() + +
+
+ Stores the current playlist state in the queue. + + +
+ + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 23:04:33 GMT-0700 (PDT) +
+ + diff --git a/doc/symbols/osmplayer.scroll.html b/doc/symbols/osmplayer.scroll.html new file mode 100644 index 00000000..afa3321a --- /dev/null +++ b/doc/symbols/osmplayer.scroll.html @@ -0,0 +1,673 @@ + + + + + + + JsDoc Reference - osmplayer.scroll + + + + + + + + + + + + + +
+ +

+ + Class osmplayer.scroll +

+ + +

+ +
Extends + minplayer.display.
+ + + This class provides the scroll functionality for the playlists. + +We can calculate how the scrollbar controls the playlist using the +following diagram / equations. + ___ ____________ + | | |\ + | | list | \ + | | |y \ + | | | \ + | |____________| \ _ _____ + | | |\ | | | + | | | \ | | | + | | | \ | |x | + | | | \ | | | + | | | \|_|_ | + | | | | | | | + l | window | | | h w + | | | |_|_| | + | | | /| | | + | | | / | | | + | | | / v| | | + | | | / | | | + | |____________|/ |_|____| + | | | / + | | | / + | | | / + | | | / + |__|____________|/ + + l - The list height. + h - Handle Bar height. + w - Window height. + x - The distance from top of window to the top of the handle. + y - The disatnce from the top of the list to the top of the window. + v - The distance from bottom of window to the bottom of the handle. + + jQuery UI provides "v". We already know "l", "h", "w". We can then + calculate the relationship between the scroll bar handle position to the + list position using the following equations. + + x = (w - (v + h)) + y = ((l - w)/(w - h)) * x + + -- or -- + + y = ((l - w)/(w - h)) * (w - (v + h)) + + We can statically calculate the ((l - w)/(w - h)) as a ratio and use + that to speed up calculations as follows. + + ratio = ((l - w)/(w - h)); + + So, our translation equations are as follows... + + y = ratio * (w - (v + h)) + v = w - (h + (y / ratio)) + + +
Defined in: osmplayer.scroll.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ osmplayer.scroll(context, options) +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  + +
Reset the constructor.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
  + +
+
  +
getHandlePos(pos) +
+
+
  +
getMousePos(event) +
+
+
  +
getPos(handlePos) +
+
+
  +
refresh() +
+
Refresh all the variables that may change.
+
+ + + + + + + + + +
+
+ Class Detail +
+ +
+ osmplayer.scroll(context, options) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {object} context + +
+
The jQuery context.
+ +
+ {object} options + +
+
This components options.
+ +
+ + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + constructor + +
+
+ Reset the constructor. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
+ + + construct() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.plugin#construct
+ +
+ + +
+ + +
+ + + getHandlePos(pos) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ pos + +
+
+ +
+ + + + + + + + +
+ + +
+ + + getMousePos(event) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ event + +
+
+ +
+ + + + + + + + +
+ + +
+ + + getPos(handlePos) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ handlePos + +
+
+ +
+ + + + + + + + +
+ + +
+ + + refresh() + +
+
+ Refresh all the variables that may change. + + +
+ + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 23:04:33 GMT-0700 (PDT) +
+ + diff --git a/doc/symbols/osmplayer.teaser.html b/doc/symbols/osmplayer.teaser.html new file mode 100644 index 00000000..ec3ec649 --- /dev/null +++ b/doc/symbols/osmplayer.teaser.html @@ -0,0 +1,530 @@ + + + + + + + JsDoc Reference - osmplayer.teaser + + + + + + + + + + + + + +
+ +

+ + Class osmplayer.teaser +

+ + +

+ +
Extends + minplayer.display.
+ + + This class provides teaser functionality. + + +
Defined in: osmplayer.teaser.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ osmplayer.teaser(context, options) +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  + +
Reset the constructor.
+
  +
+ preview +
+
The preview image.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
  +
select(selected) +
+
Selects the teaser.
+
  +
setNode(node) +
+
Sets the node.
+
+ + + + + + + + + +
+
+ Class Detail +
+ +
+ osmplayer.teaser(context, options) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {object} context + +
+
The jQuery context.
+ +
+ {object} options + +
+
This components options.
+ +
+ + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + constructor + +
+
+ Reset the constructor. + + +
+ + + + + + + + +
+ + +
+ + + preview + +
+
+ The preview image. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
+ + + select(selected) + +
+
+ Selects the teaser. + + +
+ + + + +
+
Parameters:
+ +
+ {boolean} selected + +
+
TRUE if selected, FALSE otherwise.
+ +
+ + + + + + + + +
+ + +
+ + + setNode(node) + +
+
+ Sets the node. + + +
+ + + + +
+
Parameters:
+ +
+ {object} node + +
+
The node object to set.
+ +
+ + + + + + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 23:04:33 GMT-0700 (PDT) +
+ + diff --git a/doc/symbols/src/src_osmplayer.js.html b/doc/symbols/src/src_osmplayer.js.html new file mode 100644 index 00000000..fe1ce547 --- /dev/null +++ b/doc/symbols/src/src_osmplayer.js.html @@ -0,0 +1,247 @@ +
  1 // Add a way to instanciate using jQuery prototype.
+  2 if (!jQuery.fn.osmplayer) {
+  3 
+  4   /**
+  5    * @constructor
+  6    *
+  7    * Define a jQuery osmplayer prototype.
+  8    *
+  9    * @param {object} options The options for this jQuery prototype.
+ 10    * @return {Array} jQuery object.
+ 11    */
+ 12   jQuery.fn.osmplayer = function(options) {
+ 13     return jQuery(this).each(function() {
+ 14       options = options || {};
+ 15       options.id = options.id || $(this).attr('id') || Math.random();
+ 16       if (!minplayer.plugins[options.id]) {
+ 17         options.template = options.template || 'default';
+ 18         if (osmplayer[options.template]) {
+ 19           new osmplayer[options.template](jQuery(this), options);
+ 20         }
+ 21         else {
+ 22           new osmplayer(jQuery(this), options);
+ 23         }
+ 24       }
+ 25     });
+ 26   };
+ 27 }
+ 28 
+ 29 /**
+ 30  * @constructor
+ 31  * @extends minplayer
+ 32  * @class The main osmplayer class.
+ 33  *
+ 34  * <p><strong>Usage:</strong>
+ 35  * <pre><code>
+ 36  *
+ 37  *   // Create a media player.
+ 38  *   var player = jQuery("#player").osmplayer({
+ 39  *
+ 40  *   });
+ 41  *
+ 42  * </code></pre>
+ 43  * </p>
+ 44  *
+ 45  * @param {object} context The jQuery context.
+ 46  * @param {object} options This components options.
+ 47  */
+ 48 osmplayer = function(context, options) {
+ 49 
+ 50   // Derive from minplayer
+ 51   minplayer.call(this, context, options);
+ 52 };
+ 53 
+ 54 /** Derive from minplayer. */
+ 55 osmplayer.prototype = new minplayer();
+ 56 
+ 57 /** Reset the constructor. */
+ 58 osmplayer.prototype.constructor = osmplayer;
+ 59 
+ 60 /**
+ 61  * Creates a new plugin within this context.
+ 62  *
+ 63  * @param {string} name The name of the plugin you wish to create.
+ 64  * @param {object} base The base object for this plugin.
+ 65  * @param {object} context The context which you would like to create.
+ 66  * @return {object} The new plugin object.
+ 67  */
+ 68 osmplayer.prototype.create = function(name, base, context) {
+ 69   return minplayer.prototype.create.call(this, name, 'osmplayer', context);
+ 70 };
+ 71 
+ 72 /**
+ 73  * @see minplayer.plugin.construct
+ 74  */
+ 75 osmplayer.prototype.construct = function() {
+ 76 
+ 77   // Make sure we provide default options...
+ 78   this.options = jQuery.extend({
+ 79     playlist: '',
+ 80     swfplayer: 'minplayer/flash/minplayer.swf'
+ 81   }, this.options);
+ 82 
+ 83   // Call the minplayer display constructor.
+ 84   minplayer.prototype.construct.call(this);
+ 85 
+ 86   /** The play queue and index. */
+ 87   this.playQueue = [];
+ 88   this.playIndex = 0;
+ 89 
+ 90   /** The playlist for this media player. */
+ 91   this.playlist = this.create('playlist', 'osmplayer');
+ 92 
+ 93   // Bind when the playlists loads a node.
+ 94   this.playlist.bind('nodeLoad', (function(player) {
+ 95     return function(event, data) {
+ 96 
+ 97       // Load this node.
+ 98       player.loadNode(data);
+ 99     };
+100   })(this));
+101 };
+102 
+103 /**
+104  * Gets the full screen element.
+105  *
+106  * @return {object} The element that will go into fullscreen.
+107  */
+108 osmplayer.prototype.fullScreenElement = function() {
+109   return this.elements.minplayer;
+110 };
+111 
+112 /**
+113  * The load node function.
+114  *
+115  * @param {object} node A media node object.
+116  */
+117 osmplayer.prototype.loadNode = function(node) {
+118   if (node.mediafiles) {
+119 
+120     // Load the media files.
+121     var media = node.mediafiles.media;
+122     if (media) {
+123       this.playQueue.length = 0;
+124       this.playQueue = [];
+125       this.playIndex = 0;
+126       this.addToQueue(media.intro);
+127       this.addToQueue(media.commercial);
+128       this.addToQueue(media.prereel);
+129       this.addToQueue(media.media);
+130       this.addToQueue(media.postreel);
+131     }
+132 
+133     // Load the preview image.
+134     this.options.preview = osmplayer.getImage(node.mediafiles.image, 'preview');
+135     this.playLoader.loadPreview();
+136 
+137     // Play the next media
+138     this.playNext();
+139   }
+140 };
+141 
+142 /**
+143  * Adds a file to the play queue.
+144  *
+145  * @param {object} file The file to add to the queue.
+146  */
+147 osmplayer.prototype.addToQueue = function(file) {
+148   if (file) {
+149     this.playQueue.push(this.getFile(file));
+150   }
+151 };
+152 
+153 /**
+154  * Returns a valid media file for this browser.
+155  *
+156  * @param {object} file The file object.
+157  * @return {object} The best media file.
+158  */
+159 osmplayer.prototype.getFile = function(file) {
+160   if (file) {
+161     var type = typeof file;
+162     if (((type === 'object') || (type === 'array')) && file[0]) {
+163       file = this.getBestMedia(file);
+164     }
+165   }
+166   return file;
+167 };
+168 
+169 /**
+170  * Returns the media file with the lowest weight value provided an array of
+171  * media files.
+172  *
+173  * @param {object} files The media files to play.
+174  * @return {object} The best media file.
+175  */
+176 osmplayer.prototype.getBestMedia = function(files) {
+177   var mFile = null;
+178   var i = files.length;
+179   while (i--) {
+180     var tempFile = new minplayer.file(files[i]);
+181     if (!mFile || (tempFile.priority > mFile.priority)) {
+182       mFile = tempFile;
+183     }
+184   }
+185   return mFile;
+186 };
+187 
+188 /**
+189  * Plays the next media file in the queue.
+190  */
+191 osmplayer.prototype.playNext = function() {
+192   if (this.playQueue.length > this.playIndex) {
+193     this.load(this.playQueue[this.playIndex]);
+194     this.playIndex++;
+195   }
+196   else if (this.options.repeat) {
+197     this.playIndex = 0;
+198     this.playNext();
+199   }
+200   else {
+201     // If there is no playlist, and no repeat, we will
+202     // just seek to the beginning and pause.
+203     this.options.autostart = false;
+204     this.playIndex = 0;
+205     this.playNext();
+206   }
+207 };
+208 
+209 /**
+210  * Returns an image provided image array.
+211  *
+212  * @param {object} images The images to search for.
+213  * @param {string} type The type of image to look for.
+214  * @return {object} The best image match.
+215  */
+216 osmplayer.getImage = function(images, type) {
+217   var image = '';
+218 
+219   if (images) {
+220 
+221     // If the image type exists, then just use that one.
+222     if (images[type]) {
+223       image = images[type];
+224     }
+225     else {
+226 
+227       // Or, just pick the first one available.
+228       for (type in images) {
+229         if (images.hasOwnProperty(type)) {
+230           image = images[type];
+231           break;
+232         }
+233       }
+234     }
+235   }
+236 
+237   // Return the image path.
+238   return (typeof image === 'string') ? image : image.path;
+239 };
+240 
\ No newline at end of file diff --git a/doc/symbols/src/src_osmplayer.pager.js.html b/doc/symbols/src/src_osmplayer.pager.js.html new file mode 100644 index 00000000..835d5643 --- /dev/null +++ b/doc/symbols/src/src_osmplayer.pager.js.html @@ -0,0 +1,55 @@ +
  1 /** The osmplayer namespace. */
+  2 var osmplayer = osmplayer || {};
+  3 
+  4 /**
+  5  * @constructor
+  6  * @extends minplayer.display
+  7  * @class This class provides pager functionality.
+  8  *
+  9  * @param {object} context The jQuery context.
+ 10  * @param {object} options This components options.
+ 11  */
+ 12 osmplayer.pager = function(context, options) {
+ 13 
+ 14   // Derive from display
+ 15   minplayer.display.call(this, 'pager', context, options);
+ 16 };
+ 17 
+ 18 /** Derive from minplayer.display. */
+ 19 osmplayer.pager.prototype = new minplayer.display();
+ 20 
+ 21 /** Reset the constructor. */
+ 22 osmplayer.pager.prototype.constructor = osmplayer.pager;
+ 23 
+ 24 /**
+ 25  * @see minplayer.plugin#construct
+ 26  */
+ 27 osmplayer.pager.prototype.construct = function() {
+ 28 
+ 29   // Call the minplayer plugin constructor.
+ 30   minplayer.display.prototype.construct.call(this);
+ 31 
+ 32   // Setup the prev button.
+ 33   this.prevPage = this.elements.prevPage.click((function(pager) {
+ 34     return function(event) {
+ 35       event.preventDefault();
+ 36       pager.trigger('prevPage');
+ 37     };
+ 38   })(this));
+ 39 
+ 40   // Setup the next button.
+ 41   this.nextPage = this.elements.nextPage.click((function(pager) {
+ 42     return function(event) {
+ 43       event.preventDefault();
+ 44       pager.trigger('nextPage');
+ 45     };
+ 46   })(this));
+ 47 };
+ 48 
\ No newline at end of file diff --git a/doc/symbols/src/src_osmplayer.parser.asx.js.html b/doc/symbols/src/src_osmplayer.parser.asx.js.html new file mode 100644 index 00000000..2d3f99e3 --- /dev/null +++ b/doc/symbols/src/src_osmplayer.parser.asx.js.html @@ -0,0 +1,52 @@ +
  1 /** The osmplayer namespace. */
+  2 var osmplayer = osmplayer || {};
+  3 
+  4 /** The parser object. */
+  5 osmplayer.parser = osmplayer.parser || {};
+  6 
+  7 /**
+  8  * The asx parser object.
+  9  *
+ 10  * @return {object} The asx parser.
+ 11  **/
+ 12 osmplayer.parser.asx = {
+ 13 
+ 14   // The priority for this parser.
+ 15   priority: 8,
+ 16 
+ 17   // Return if this is a valid youtube feed.
+ 18   valid: function(feed) {
+ 19     feed = feed.replace(/(.*)\??(.*)/i, '$1');
+ 20     return feed.match(/\.asx$/i) !== null;
+ 21   },
+ 22 
+ 23   // Returns the type of request to make.
+ 24   getType: function(feed) {
+ 25     return 'xml';
+ 26   },
+ 27 
+ 28   // Returns the feed provided the start and numItems.
+ 29   getFeed: function(feed, start, numItems) {
+ 30     return feed;
+ 31   },
+ 32 
+ 33   // Parse the feed.
+ 34   parse: function(data) {
+ 35     var playlist = {
+ 36       total_rows: 0,
+ 37       nodes: []
+ 38     };
+ 39     jQuery('asx entry', data).each(function(index) {
+ 40       osmplayer.parser.rss.addRSSItem(playlist, $(this));
+ 41     });
+ 42     return playlist;
+ 43   }
+ 44 };
+ 45 
\ No newline at end of file diff --git a/doc/symbols/src/src_osmplayer.parser.default.js.html b/doc/symbols/src/src_osmplayer.parser.default.js.html new file mode 100644 index 00000000..9bbc9567 --- /dev/null +++ b/doc/symbols/src/src_osmplayer.parser.default.js.html @@ -0,0 +1,47 @@ +
  1 /** The osmplayer namespace. */
+  2 var osmplayer = osmplayer || {};
+  3 
+  4 /** The parser object. */
+  5 osmplayer.parser = osmplayer.parser || {};
+  6 
+  7 /**
+  8  * The default parser object.
+  9  *
+ 10  * @return {object} The default parser.
+ 11  **/
+ 12 osmplayer.parser['default'] = {
+ 13 
+ 14   // The priority for this parser.
+ 15   priority: 1,
+ 16 
+ 17   // This parser is always valid.
+ 18   valid: function(feed) {
+ 19     return true;
+ 20   },
+ 21 
+ 22   // Returns the type of request to make.
+ 23   getType: function(feed) {
+ 24     return 'json';
+ 25   },
+ 26 
+ 27   // Returns the feed provided the start and numItems.
+ 28   getFeed: function(feed, start, numItems) {
+ 29     feed = feed.replace(/(.*)\??(.*)/i, '$1');
+ 30     feed += '?start-index=' + start;
+ 31     feed += '&max-results=' + numItems;
+ 32     return feed;
+ 33   },
+ 34 
+ 35   // Parse the feed.
+ 36   parse: function(data) {
+ 37     return data;
+ 38   }
+ 39 };
+ 40 
\ No newline at end of file diff --git a/doc/symbols/src/src_osmplayer.parser.rss.js.html b/doc/symbols/src/src_osmplayer.parser.rss.js.html new file mode 100644 index 00000000..49f03538 --- /dev/null +++ b/doc/symbols/src/src_osmplayer.parser.rss.js.html @@ -0,0 +1,73 @@ +
  1 /** The osmplayer namespace. */
+  2 var osmplayer = osmplayer || {};
+  3 
+  4 /** The parser object. */
+  5 osmplayer.parser = osmplayer.parser || {};
+  6 
+  7 /**
+  8  * The rss parser object.
+  9  *
+ 10  * @return {object} The rss parser.
+ 11  **/
+ 12 osmplayer.parser.rss = {
+ 13 
+ 14   // The priority for this parser.
+ 15   priority: 8,
+ 16 
+ 17   // Return if this is a valid youtube feed.
+ 18   valid: function(feed) {
+ 19     feed = feed.replace(/(.*)\??(.*)/i, '$1');
+ 20     return feed.match(/\.rss$/i) !== null;
+ 21   },
+ 22 
+ 23   // Returns the type of request to make.
+ 24   getType: function(feed) {
+ 25     return 'xml';
+ 26   },
+ 27 
+ 28   // Returns the feed provided the start and numItems.
+ 29   getFeed: function(feed, start, numItems) {
+ 30     return feed;
+ 31   },
+ 32 
+ 33   // Parse the feed.
+ 34   parse: function(data) {
+ 35     var playlist = {
+ 36       total_rows: 0,
+ 37       nodes: []
+ 38     };
+ 39     jQuery('rss channel', data).find('item').each(function(index) {
+ 40       osmplayer.parser.rss.addRSSItem(playlist, $(this));
+ 41     });
+ 42     return playlist;
+ 43   },
+ 44 
+ 45   // Parse an RSS item.
+ 46   addRSSItem: function(playlist, item) {
+ 47     playlist.total_rows++;
+ 48     playlist.nodes.push({
+ 49       title: item.find('title').text(),
+ 50       description: item.find('annotation').text(),
+ 51       mediafiles: {
+ 52         image: {
+ 53           'image': {
+ 54             path: item.find('image').text()
+ 55           }
+ 56         },
+ 57         media: {
+ 58           'media': {
+ 59             path: item.find('location').text()
+ 60           }
+ 61         }
+ 62       }
+ 63     });
+ 64   }
+ 65 };
+ 66 
\ No newline at end of file diff --git a/doc/symbols/src/src_osmplayer.parser.xspf.js.html b/doc/symbols/src/src_osmplayer.parser.xspf.js.html new file mode 100644 index 00000000..3d191504 --- /dev/null +++ b/doc/symbols/src/src_osmplayer.parser.xspf.js.html @@ -0,0 +1,52 @@ +
  1 /** The osmplayer namespace. */
+  2 var osmplayer = osmplayer || {};
+  3 
+  4 /** The parser object. */
+  5 osmplayer.parser = osmplayer.parser || {};
+  6 
+  7 /**
+  8  * The xsfp parser object.
+  9  *
+ 10  * @return {object} The xsfp parser.
+ 11  **/
+ 12 osmplayer.parser.xsfp = {
+ 13 
+ 14   // The priority for this parser.
+ 15   priority: 8,
+ 16 
+ 17   // Return if this is a valid youtube feed.
+ 18   valid: function(feed) {
+ 19     feed = feed.replace(/(.*)\??(.*)/i, '$1');
+ 20     return feed.match(/\.xml$/i) !== null;
+ 21   },
+ 22 
+ 23   // Returns the type of request to make.
+ 24   getType: function(feed) {
+ 25     return 'xml';
+ 26   },
+ 27 
+ 28   // Returns the feed provided the start and numItems.
+ 29   getFeed: function(feed, start, numItems) {
+ 30     return feed;
+ 31   },
+ 32 
+ 33   // Parse the feed.
+ 34   parse: function(data) {
+ 35     var playlist = {
+ 36       total_rows: 0,
+ 37       nodes: []
+ 38     };
+ 39     jQuery('playlist trackList track', data).each(function(index) {
+ 40       osmplayer.parser.rss.addRSSItem(playlist, $(this));
+ 41     });
+ 42     return playlist;
+ 43   }
+ 44 };
+ 45 
\ No newline at end of file diff --git a/doc/symbols/src/src_osmplayer.parser.youtube.js.html b/doc/symbols/src/src_osmplayer.parser.youtube.js.html new file mode 100644 index 00000000..a8e984d2 --- /dev/null +++ b/doc/symbols/src/src_osmplayer.parser.youtube.js.html @@ -0,0 +1,79 @@ +
  1 /** The osmplayer namespace. */
+  2 var osmplayer = osmplayer || {};
+  3 
+  4 /** The parser object. */
+  5 osmplayer.parser = osmplayer.parser || {};
+  6 
+  7 /**
+  8  * The youtube parser object.
+  9  *
+ 10  * @return {object} The youtube parser.
+ 11  **/
+ 12 osmplayer.parser.youtube = {
+ 13 
+ 14   // The priority for this parser.
+ 15   priority: 10,
+ 16 
+ 17   // Return if this is a valid youtube feed.
+ 18   valid: function(feed) {
+ 19     return (feed.search(/^http(s)?\:\/\/gdata\.youtube\.com/i) === 0);
+ 20   },
+ 21 
+ 22   // Returns the type of request to make.
+ 23   getType: function(feed) {
+ 24     return 'jsonp';
+ 25   },
+ 26 
+ 27   // Returns the feed provided the start and numItems.
+ 28   getFeed: function(feed, start, numItems) {
+ 29     feed = feed.replace(/(.*)\??(.*)/i, '$1');
+ 30     feed += '?start-index=' + (start + 1);
+ 31     feed += '&max-results=' + (numItems);
+ 32     feed += '&v=2&alt=jsonc';
+ 33     return feed;
+ 34   },
+ 35 
+ 36   // Parse the feed.
+ 37   parse: function(data) {
+ 38     data = data.data;
+ 39     var playlist = {
+ 40       total_rows: data.totalItems,
+ 41       nodes: []
+ 42     };
+ 43 
+ 44     // Iterate through the items and parse it.
+ 45     for (var index in data.items) {
+ 46       var item = data.items[index];
+ 47       playlist.nodes.push({
+ 48         title: item.title,
+ 49         description: item.description,
+ 50         mediafiles: {
+ 51           image: {
+ 52             'thumbnail': {
+ 53               path: item.thumbnail.sqDefault
+ 54             },
+ 55             'image': {
+ 56               path: item.thumbnail.hqDefault
+ 57             }
+ 58           },
+ 59           media: {
+ 60             'media': {
+ 61               player: 'youtube',
+ 62               id: item.id
+ 63             }
+ 64           }
+ 65         }
+ 66       });
+ 67     }
+ 68 
+ 69     return playlist;
+ 70   }
+ 71 };
+ 72 
\ No newline at end of file diff --git a/doc/symbols/src/src_osmplayer.playlist.js.html b/doc/symbols/src/src_osmplayer.playlist.js.html new file mode 100644 index 00000000..217027d3 --- /dev/null +++ b/doc/symbols/src/src_osmplayer.playlist.js.html @@ -0,0 +1,368 @@ +
  1 /** The osmplayer namespace. */
+  2 var osmplayer = osmplayer || {};
+  3 
+  4 /**
+  5  * @constructor
+  6  * @extends minplayer.display
+  7  * @class This class creates the playlist functionality for the minplayer.
+  8  *
+  9  * @param {object} context The jQuery context.
+ 10  * @param {object} options This components options.
+ 11  */
+ 12 osmplayer.playlist = function(context, options) {
+ 13 
+ 14   // Derive from display
+ 15   minplayer.display.call(this, 'playlist', context, options);
+ 16 };
+ 17 
+ 18 /** Derive from minplayer.display. */
+ 19 osmplayer.playlist.prototype = new minplayer.display();
+ 20 
+ 21 /** Reset the constructor. */
+ 22 osmplayer.playlist.prototype.constructor = osmplayer.playlist;
+ 23 
+ 24 /**
+ 25  * @see minplayer.plugin#construct
+ 26  */
+ 27 osmplayer.playlist.prototype.construct = function() {
+ 28 
+ 29   // Make sure we provide default options...
+ 30   this.options = jQuery.extend({
+ 31     vertical: true,
+ 32     playlist: '',
+ 33     pageLimit: 10,
+ 34     shuffle: false
+ 35   }, this.options);
+ 36 
+ 37   // Call the minplayer plugin constructor.
+ 38   minplayer.display.prototype.construct.call(this);
+ 39 
+ 40   /** The nodes within this playlist. */
+ 41   this.nodes = [];
+ 42 
+ 43   // Current page.
+ 44   this.page = -1;
+ 45 
+ 46   // The total amount of nodes.
+ 47   this.totalItems = 0;
+ 48 
+ 49   // The current loaded item index.
+ 50   this.currentItem = 0;
+ 51 
+ 52   // The play queue.
+ 53   this.queue = [];
+ 54 
+ 55   // The queue position.
+ 56   this.queuepos = 0;
+ 57 
+ 58   // The current playlist.
+ 59   this.playlist = this.options.playlist;
+ 60 
+ 61   // Create the scroll bar.
+ 62   this.scroll = this.create('scroll', 'osmplayer');
+ 63 
+ 64   // Create the pager.
+ 65   this.pager = this.create('pager', 'osmplayer');
+ 66   this.pager.bind('nextPage', (function(playlist) {
+ 67     return function(event) {
+ 68       playlist.nextPage();
+ 69     };
+ 70   })(this));
+ 71   this.pager.bind('prevPage', (function(playlist) {
+ 72     return function(event) {
+ 73       playlist.prevPage();
+ 74     };
+ 75   })(this));
+ 76 
+ 77   // Get the media.
+ 78   this.get('media', function(media) {
+ 79     media.bind('ended', (function(playlist) {
+ 80       return function(event) {
+ 81         playlist.next();
+ 82       };
+ 83     })(this));
+ 84   });
+ 85 
+ 86   // Load the playlist.
+ 87   this.load(0, 0);
+ 88 };
+ 89 
+ 90 /**
+ 91  * Sets the playlist.
+ 92  *
+ 93  * @param {object} playlist The playlist object.
+ 94  * @param {integer} loadIndex The index of the item to load.
+ 95  */
+ 96 osmplayer.playlist.prototype.set = function(playlist, loadIndex) {
+ 97 
+ 98   // Check to make sure the playlist is an object.
+ 99   if (typeof playlist !== 'object') {
+100     this.trigger('error', 'Playlist must be an object to set');
+101     return;
+102   }
+103 
+104   // Check to make sure the playlist has correct format.
+105   if (!playlist.hasOwnProperty('total_rows')) {
+106     this.trigger('error', 'Unknown playlist format.');
+107     return;
+108   }
+109 
+110   // Make sure the playlist has some rows.
+111   if (playlist.total_rows && playlist.nodes.length) {
+112 
+113     // Set the total rows.
+114     this.totalItems = playlist.total_rows;
+115     this.currentItem = 0;
+116 
+117     // Show or hide the next page if there is or is not a next page.
+118     if (((this.page + 1) * this.options.pageLimit) >= this.totalItems) {
+119       this.pager.nextPage.hide();
+120     }
+121     else {
+122       this.pager.nextPage.show();
+123     }
+124 
+125     var teaser = null;
+126     var numNodes = playlist.nodes.length;
+127     this.scroll.elements.list.empty();
+128     this.nodes = [];
+129 
+130     // Iterate through all the nodes.
+131     for (var index = 0; index < numNodes; index++) {
+132 
+133       // Create the teaser object.
+134       teaser = this.create('teaser', 'osmplayer', this.scroll.elements.list);
+135       teaser.setNode(playlist.nodes[index]);
+136       teaser.bind('nodeLoad', (function(playlist, index) {
+137         return function(event, data) {
+138           playlist.loadItem(index);
+139         };
+140       })(this, index));
+141 
+142       // Add this to our nodes array.
+143       this.nodes.push(teaser);
+144 
+145       // If the index is equal to the loadIndex.
+146       if (loadIndex === index) {
+147         this.loadItem(index);
+148       }
+149     }
+150 
+151     // Refresh the sizes.
+152     this.scroll.refresh();
+153 
+154     // Trigger that the playlist has loaded.
+155     this.trigger('playlistLoad', playlist);
+156   }
+157 };
+158 
+159 /**
+160  * Stores the current playlist state in the queue.
+161  */
+162 osmplayer.playlist.prototype.setQueue = function() {
+163 
+164   // Add this item to the queue.
+165   this.queue.push({
+166     page: this.page,
+167     item: this.currentItem
+168   });
+169 
+170   // Store the current queue position.
+171   this.queuepos = this.queue.length;
+172 };
+173 
+174 /**
+175  * Loads the next item.
+176  */
+177 osmplayer.playlist.prototype.next = function() {
+178   var item = 0, page = this.page;
+179 
+180   // See if we are at the front of the queue.
+181   if (this.queuepos >= this.queue.length) {
+182 
+183     // If this is shuffle, then load a random item.
+184     if (this.options.shuffle) {
+185       item = Math.floor(Math.random() * this.totalItems);
+186       page = Math.floor(item / this.options.pageLimit);
+187       item = item % this.options.pageLimit;
+188       this.load(page, item);
+189     }
+190     else {
+191 
+192       // Otherwise, increment the current item by one.
+193       item = (this.currentItem + 1);
+194       if (item >= this.nodes.length) {
+195         this.load(page + 1, 0);
+196       }
+197       else {
+198         this.loadItem(item);
+199       }
+200     }
+201   }
+202   else {
+203 
+204     // Load the next item in the queue.
+205     this.queuepos = this.queuepos + 1;
+206     var currentQueue = this.queue[this.queuepos];
+207     this.load(currentQueue.page, currentQueue.item);
+208   }
+209 };
+210 
+211 /**
+212  * Loads the previous item.
+213  */
+214 osmplayer.playlist.prototype.prev = function() {
+215 
+216   // Move back into the queue.
+217   this.queuepos = this.queuepos - 1;
+218   this.queuepos = (this.queuepos < 0) ? 0 : this.queuepos;
+219   var currentQueue = this.queue[this.queuepos];
+220   if (currentQueue) {
+221     this.load(currentQueue.page, currentQueue.item);
+222   }
+223 };
+224 
+225 /**
+226  * Loads a playlist node.
+227  *
+228  * @param {number} index The index of the item you would like to load.
+229  */
+230 osmplayer.playlist.prototype.loadItem = function(index) {
+231   if (index < this.nodes.length) {
+232     this.setQueue();
+233 
+234     // Get the teaser at the current index and deselect it.
+235     var teaser = this.nodes[this.currentItem];
+236     teaser.select(false);
+237     this.currentItem = index;
+238 
+239     // Get the new teaser and select it.
+240     teaser = this.nodes[index];
+241     teaser.select(true);
+242     this.trigger('nodeLoad', teaser.node);
+243   }
+244 };
+245 
+246 /**
+247  * Loads the next page.
+248  *
+249  * @param {integer} loadIndex The index of the item to load.
+250  */
+251 osmplayer.playlist.prototype.nextPage = function(loadIndex) {
+252   this.load(this.page + 1, loadIndex);
+253 };
+254 
+255 /**
+256  * Loads the previous page.
+257  *
+258  * @param {integer} loadIndex The index of the item to load.
+259  */
+260 osmplayer.playlist.prototype.prevPage = function(loadIndex) {
+261   this.load(this.page - 1, loadIndex);
+262 };
+263 
+264 /**
+265  * Loads a playlist.
+266  *
+267  * @param {integer} page The page to load.
+268  * @param {integer} loadIndex The index of the item to load.
+269  */
+270 osmplayer.playlist.prototype.load = function(page, loadIndex) {
+271 
+272   // If the playlist and pages are the same, then no need to load.
+273   if ((this.playlist == this.options.playlist) && (page == this.page)) {
+274     this.loadItem(loadIndex);
+275   }
+276 
+277   // Set the new playlist.
+278   this.playlist = this.options.playlist;
+279 
+280   // If the playlist is an object, then go ahead and set it.
+281   if (typeof this.playlist == 'object') {
+282     this.set(this.playlist);
+283     this.playlist = this.playlist.endpoint;
+284     return;
+285   }
+286 
+287   // Say that we are busy.
+288   if (this.scroll.elements.playlist_busy) {
+289     this.scroll.elements.playlist_busy.show();
+290   }
+291 
+292   // Normalize the page.
+293   page = page || 0;
+294   page = (page < 0) ? 0 : page;
+295 
+296   // Set the queue.
+297   this.setQueue();
+298 
+299   // Set the new page.
+300   this.page = page;
+301 
+302   // Hide or show the page based on if we are on the first page.
+303   if (this.page == 0) {
+304     this.pager.prevPage.hide();
+305   }
+306   else {
+307     this.pager.prevPage.show();
+308   }
+309 
+310   // Get the highest priority parser.
+311   var parser = osmplayer.parser['default'];
+312    for (var name in osmplayer.parser) {
+313     if (osmplayer.parser[name].valid(this.playlist)) {
+314       if (osmplayer.parser[name].priority > parser.priority) {
+315         parser = osmplayer.parser[name];
+316       }
+317     }
+318   }
+319 
+320   // The start index.
+321   var start = this.page * this.options.pageLimit;
+322 
+323   // Get the feed from the parser.
+324   var feed = parser.getFeed(
+325     this.playlist,
+326     start,
+327     this.options.pageLimit
+328   );
+329 
+330   // Build our request.
+331   var request = {
+332     type: 'GET',
+333     url: feed,
+334     success: (function(playlist) {
+335       return function(data) {
+336         if (playlist.scroll.elements.playlist_busy) {
+337           playlist.scroll.elements.playlist_busy.hide();
+338         }
+339         playlist.set(parser.parse(data), loadIndex);
+340       };
+341     })(this),
+342     error: (function(playlist) {
+343       return function(XMLHttpRequest, textStatus, errorThrown) {
+344         if (playlist.scroll.elements.playlist_busy) {
+345           playlist.scroll.elements.playlist_busy.hide();
+346         }
+347         playlist.trigger('error', textStatus);
+348       }
+349     })(this)
+350   };
+351 
+352   // Set the data if applicable.
+353   var dataType = '';
+354   if (dataType = parser.getType()) {
+355     request.dataType = dataType;
+356   }
+357 
+358   // Perform an ajax callback.
+359   jQuery.ajax(request);
+360 };
+361 
\ No newline at end of file diff --git a/doc/symbols/src/src_osmplayer.scroll.js.html b/doc/symbols/src/src_osmplayer.scroll.js.html new file mode 100644 index 00000000..381f6140 --- /dev/null +++ b/doc/symbols/src/src_osmplayer.scroll.js.html @@ -0,0 +1,232 @@ +
  1 /** The osmplayer namespace. */
+  2 var osmplayer = osmplayer || {};
+  3 
+  4 /**
+  5  * @constructor
+  6  * @extends minplayer.display
+  7  * @class This class provides the scroll functionality for the playlists.
+  8  *
+  9  * We can calculate how the scrollbar controls the playlist using the
+ 10  * following diagram / equations.
+ 11  *  ___ ____________
+ 12  *  |  |            |\
+ 13  *  |  |    list    | \
+ 14  *  |  |            |y \
+ 15  *  |  |            |   \
+ 16  *  |  |____________|    \ _ _____
+ 17  *  |  |            |\    | |    |
+ 18  *  |  |            | \   | |    |
+ 19  *  |  |            |  \  | |x   |
+ 20  *  |  |            |   \ | |    |
+ 21  *  |  |            |    \|_|_   |
+ 22  *  |  |            |     | | |  |
+ 23  *  l  |   window   |     | | h  w
+ 24  *  |  |            |     |_|_|  |
+ 25  *  |  |            |    /| |    |
+ 26  *  |  |            |   / | |    |
+ 27  *  |  |            |  / v| |    |
+ 28  *  |  |            | /   | |    |
+ 29  *  |  |____________|/    |_|____|
+ 30  *  |  |            |    /
+ 31  *  |  |            |   /
+ 32  *  |  |            |  /
+ 33  *  |  |            | /
+ 34  *  |__|____________|/
+ 35  *
+ 36  *  l - The list height.
+ 37  *  h - Handle Bar height.
+ 38  *  w - Window height.
+ 39  *  x - The distance from top of window to the top of the handle.
+ 40  *  y - The disatnce from the top of the list to the top of the window.
+ 41  *  v - The distance from bottom of window to the bottom of the handle.
+ 42  *
+ 43  *  jQuery UI provides "v".  We already know "l", "h", "w".  We can then
+ 44  *  calculate the relationship between the scroll bar handle position to the
+ 45  *  list position using the following equations.
+ 46  *
+ 47  *  x = (w - (v + h))
+ 48  *  y = ((l - w)/(w - h)) * x
+ 49  *
+ 50  *   -- or --
+ 51  *
+ 52  *  y = ((l - w)/(w - h)) * (w - (v + h))
+ 53  *
+ 54  *  We can statically calculate the ((l - w)/(w - h)) as a ratio and use
+ 55  *  that to speed up calculations as follows.
+ 56  *
+ 57  *  ratio = ((l - w)/(w - h));
+ 58  *
+ 59  *  So, our translation equations are as follows...
+ 60  *
+ 61  *    y = ratio * (w - (v + h))
+ 62  *    v = w - (h + (y / ratio))
+ 63  *
+ 64  * @param {object} context The jQuery context.
+ 65  * @param {object} options This components options.
+ 66  */
+ 67 osmplayer.scroll = function(context, options) {
+ 68 
+ 69   // Derive from display
+ 70   minplayer.display.call(this, 'scroll', context, options);
+ 71 };
+ 72 
+ 73 /** Derive from minplayer.display. */
+ 74 osmplayer.scroll.prototype = new minplayer.display();
+ 75 
+ 76 /** Reset the constructor. */
+ 77 osmplayer.scroll.prototype.constructor = osmplayer.scroll;
+ 78 
+ 79 /**
+ 80  * @see minplayer.plugin#construct
+ 81  */
+ 82 osmplayer.scroll.prototype.construct = function() {
+ 83 
+ 84   // Make sure we provide default options...
+ 85   this.options = jQuery.extend({
+ 86     vertical: true,
+ 87     hysteresis: 40,
+ 88     scrollSpeed: 20,
+ 89     scrollMode: 'auto'
+ 90   }, this.options);
+ 91 
+ 92   // Call the minplayer plugin constructor.
+ 93   minplayer.display.prototype.construct.call(this);
+ 94 
+ 95   this.getMousePos = function(event) {
+ 96     return (event.pageY - this.display.offset().top);
+ 97   };
+ 98   this.getPos = function(handlePos) {
+ 99     return this.ratio * (this.scrollSize - (handlePos + this.handleSize));
+100   };
+101   this.getHandlePos = function(pos) {
+102     return this.scrollSize - (this.handleSize + (pos / this.ratio));
+103   };
+104 
+105   // If they have a scroll bar.
+106   if (this.elements.scroll) {
+107 
+108     // Get the values of our variables.
+109     this.scrollSize = this.elements.scroll.height();
+110     this.handleSize = 17;
+111     this.scrollTop = (this.scrollSize - this.handleSize);
+112     this.scrollMid = this.scrollSize / 2;
+113     this.mousePos = 0;
+114 
+115     // Refresh the scroll.
+116     this.refresh();
+117 
+118     // Create the scroll bar slider control.
+119     this.scroll = this.elements.scroll.slider({
+120       orientation: 'vertical',
+121       max: this.scrollSize,
+122       value: this.scrollTop,
+123       slide: (function(scroll) {
+124         return function(event, ui) {
+125 
+126           // Get the new position.
+127           var pos = scroll.getPos(ui.value);
+128 
+129           // Ensure it doesn't go over the limits.
+130           if (pos < 0) {
+131             pos = 0;
+132             scroll.scroll.slider('option', 'value', scroll.scrollTop);
+133           }
+134 
+135           // Set our list position.
+136           scroll.elements.list.css('marginTop', -pos + 'px');
+137 
+138           // Return false to stop the scrolling.
+139           return (pos > 0);
+140         };
+141       })(this)
+142     });
+143 
+144     // If they wish to have auto scroll mode.
+145     if (this.options.scrollMode == 'auto') {
+146 
+147       // Bind to the mouse events.
+148       this.elements.list.bind('mousemove', (function(scroll) {
+149 
+150         // Return our event function.
+151         return function(event) {
+152           event.preventDefault();
+153           scroll.mousePos = (event.pageY - scroll.display.offset().top);
+154         };
+155 
+156       })(this)).bind('mouseenter', (function(scroll) {
+157 
+158         // Return our event function.
+159         return function(event) {
+160           event.preventDefault();
+161           scroll.scrolling = true;
+162           setTimeout(function setScroll() {
+163             if (scroll.scrolling) {
+164 
+165               // Get the delta.
+166               var delta = scroll.mousePos - scroll.scrollMid;
+167 
+168               // Determine if we are within our hysteresis.
+169               if (Math.abs(delta) > scroll.options.hysteresis) {
+170 
+171                 // Get the hysteresis and delta.
+172                 var hyst = scroll.options.hysteresis;
+173                 hyst *= (delta > 0) ? -1 : 0;
+174                 delta = (scroll.options.scrollSpeed * (delta + hyst));
+175                 delta /= scroll.scrollMid;
+176 
+177                 // Get the scroll position.
+178                 var pos = scroll.elements.list.css('marginTop');
+179                 pos = parseFloat(pos) - delta;
+180                 pos = (pos > 0) ? 0 : pos;
+181 
+182                 // Get the maximum top position.
+183                 var top = -scroll.listSize + scroll.scrollSize;
+184                 pos = (pos < top) ? top : pos;
+185 
+186                 // Set the new scroll position.
+187                 scroll.elements.list.css('marginTop', pos + 'px');
+188 
+189                 // Set the scroll position.
+190                 pos = scroll.getHandlePos(-pos);
+191                 scroll.scroll.slider('option', 'value', pos);
+192               }
+193 
+194               // Set timeout to try again.
+195               setTimeout(setScroll, 20);
+196             }
+197           }, 20);
+198         };
+199 
+200       })(this)).bind('mouseleave', (function(scroll) {
+201 
+202         // Return our event function.
+203         return function(event) {
+204           event.preventDefault();
+205           scroll.scrolling = false;
+206         };
+207 
+208       })(this));
+209     }
+210   }
+211 };
+212 
+213 /**
+214  * Refresh all the variables that may change.
+215  */
+216 osmplayer.scroll.prototype.refresh = function() {
+217   this.listSize = this.elements.list.height();
+218   this.ratio = (this.listSize - this.scrollSize);
+219   this.ratio /= (this.scrollSize - this.handleSize);
+220   if (this.scroll) {
+221     this.elements.list.css('marginTop', '0px');
+222     this.scroll.slider('option', 'value', this.getHandlePos(0));
+223   }
+224 };
+225 
\ No newline at end of file diff --git a/doc/symbols/src/src_osmplayer.teaser.js.html b/doc/symbols/src/src_osmplayer.teaser.js.html new file mode 100644 index 00000000..e7fca7b5 --- /dev/null +++ b/doc/symbols/src/src_osmplayer.teaser.js.html @@ -0,0 +1,74 @@ +
  1 /** The osmplayer namespace. */
+  2 var osmplayer = osmplayer || {};
+  3 
+  4 /**
+  5  * @constructor
+  6  * @extends minplayer.display
+  7  * @class This class provides teaser functionality.
+  8  *
+  9  * @param {object} context The jQuery context.
+ 10  * @param {object} options This components options.
+ 11  */
+ 12 osmplayer.teaser = function(context, options) {
+ 13 
+ 14   /** The preview image. */
+ 15   this.preview = null;
+ 16 
+ 17   // Derive from display
+ 18   minplayer.display.call(this, 'teaser', context, options);
+ 19 };
+ 20 
+ 21 /** Derive from minplayer.display. */
+ 22 osmplayer.teaser.prototype = new minplayer.display();
+ 23 
+ 24 /** Reset the constructor. */
+ 25 osmplayer.teaser.prototype.constructor = osmplayer.teaser;
+ 26 
+ 27 /**
+ 28  * Selects the teaser.
+ 29  *
+ 30  * @param {boolean} selected TRUE if selected, FALSE otherwise.
+ 31  */
+ 32 osmplayer.teaser.prototype.select = function(selected) {
+ 33 };
+ 34 
+ 35 /**
+ 36  * Sets the node.
+ 37  *
+ 38  * @param {object} node The node object to set.
+ 39  */
+ 40 osmplayer.teaser.prototype.setNode = function(node) {
+ 41 
+ 42   // Add this to the node info for this teaser.
+ 43   this.node = node;
+ 44 
+ 45   // Set the title of the teaser.
+ 46   if (this.elements.title) {
+ 47     this.elements.title.text(node.title);
+ 48   }
+ 49 
+ 50   // Load the thumbnail image if it exists.
+ 51   var image = osmplayer.getImage(node.mediafiles.image, 'thumbnail');
+ 52   if (image) {
+ 53     if (this.elements.image) {
+ 54       this.preview = new minplayer.image(this.elements.image);
+ 55       this.preview.load(image);
+ 56     }
+ 57   }
+ 58 
+ 59   // Bind when they click on this teaser.
+ 60   this.display.unbind('click').click((function(teaser) {
+ 61     return function(event) {
+ 62       event.preventDefault();
+ 63       teaser.trigger('nodeLoad', teaser.node);
+ 64     };
+ 65   })(this));
+ 66 };
+ 67 
\ No newline at end of file diff --git a/getplaylist.php b/getplaylist.php deleted file mode 100755 index d3719929..00000000 --- a/getplaylist.php +++ /dev/null @@ -1,12 +0,0 @@ -getPlaylist(); -?> \ No newline at end of file diff --git a/index.html b/index.html index 825b5763..a937216e 100644 --- a/index.html +++ b/index.html @@ -1,184 +1,59 @@ - + Open Standard Media (OSM) Player: PHP Demo - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - -

Open Standard Media (OSM) Player


-
- -
-
-
- -
-
-
- -
- - - - -
-
-
-
-
-
-
-
-
-
-
- -
- -
-
00:00
-
-
-
00:00
-
- -
- -
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Sample Title
-
-
-
-
-
-
- - - -
-
- - - -
-
+
+ +
\ No newline at end of file diff --git a/index.php b/index.php deleted file mode 100755 index 3b3569b2..00000000 --- a/index.php +++ /dev/null @@ -1,17 +0,0 @@ - 'playlist.xml' - )); -?> - - - Open Standard Media (OSM) Player: PHP Demo - - getHeader(); ?> - - -

Open Standard Media (OSM) Player


- getPlayer(); ?> - - \ No newline at end of file diff --git a/jquery-ui/css/dark-hive/images/ui-bg_glass_40_ffc73d_1x400.png b/jquery-ui/css/dark-hive/images/ui-bg_glass_40_ffc73d_1x400.png deleted file mode 100644 index d683a410..00000000 Binary files a/jquery-ui/css/dark-hive/images/ui-bg_glass_40_ffc73d_1x400.png and /dev/null differ diff --git a/jquery-ui/css/dark-hive/images/ui-icons_a83300_256x240.png b/jquery-ui/css/dark-hive/images/ui-icons_a83300_256x240.png deleted file mode 100644 index bf29609f..00000000 Binary files a/jquery-ui/css/dark-hive/images/ui-icons_a83300_256x240.png and /dev/null differ diff --git a/jquery-ui/js/jquery.js b/jquery-ui/js/jquery.js deleted file mode 100644 index 7c243080..00000000 --- a/jquery-ui/js/jquery.js +++ /dev/null @@ -1,154 +0,0 @@ -/*! - * jQuery JavaScript Library v1.4.2 - * http://jquery.com/ - * - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2010, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Sat Feb 13 22:33:48 2010 -0500 - */ -(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, -Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& -(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, -a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== -"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, -function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
a"; -var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, -parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= -false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= -s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, -applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; -else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, -a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== -w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, -cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= -c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); -a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, -function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); -k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), -C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= -e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& -f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; -if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", -e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, -"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, -d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, -e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); -t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| -g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, -CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, -g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, -text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, -setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= -h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== -"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, -h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& -q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; -if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); -(function(){var g=s.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: -function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= -{},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== -"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", -d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? -a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== -1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= -c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, -wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, -prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, -this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); -return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, -""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); -return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", -""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= -c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? -c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= -function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= -Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, -"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= -a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= -a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== -"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, -serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), -function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, -global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& -e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? -"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== -false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= -false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", -c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| -d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); -g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== -1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== -"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; -if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== -"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| -c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; -this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= -this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, -e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
"; -a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); -c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, -d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- -f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": -"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in -e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); diff --git a/js/compressed/jquery.media.auto.js b/js/compressed/jquery.media.auto.js deleted file mode 100644 index 8770ce01..00000000 --- a/js/compressed/jquery.media.auto.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media=jQuery.extend({},{auto:function(b){return new (function(c){this.json=jQuery.media.json(c);this.rpc=jQuery.media.rpc(c);this.call=function(h,g,d,f,e){if(e=="json"){this.json.call(h,g,d,f,e);}else{this.rpc.call(h,g,d,f,e);}};})(b);}},jQuery.media);})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.control.js b/js/compressed/jquery.media.control.js deleted file mode 100644 index cf416664..00000000 --- a/js/compressed/jquery.media.control.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{volumeVertical:false});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{currentTime:"#mediacurrenttime",totalTime:"#mediatotaltime",playPause:"#mediaplaypause",seekUpdate:"#mediaseekupdate",seekProgress:"#mediaseekprogress",seekBar:"#mediaseekbar",seekHandle:"#mediaseekhandle",volumeUpdate:"#mediavolumeupdate",volumeBar:"#mediavolumebar",volumeHandle:"#mediavolumehandle",mute:"#mediamute"});jQuery.fn.mediacontrol=function(b){if(this.length===0){return null;}return new (function(e,c){c=jQuery.media.utils.getSettings(c);this.display=e;var f=this;this.formatTime=(c.template&&c.template.formatTime)?c.template.formatTime:function(j){j=j?j:0;var k=0;var h=0;var g=0;g=Math.floor(j/3600);j-=(g*3600);h=Math.floor(j/60);j-=(h*60);k=Math.floor(j%60);var i="";if(g){i+=String(g);i+=":";}i+=(h>=10)?String(h):("0"+String(h));i+=":";i+=(k>=10)?String(k):("0"+String(k));return{time:i,units:""};};this.setToggle=function(h,i){var g=i?".on":".off";var j=i?".off":".on";if(h){h.find(g).show();h.find(j).hide();}};var d=this.formatTime(0);this.duration=0;this.volume=-1;this.prevVolume=0;this.percentLoaded=0;this.playState=false;this.muteState=false;this.currentTime=e.find(c.ids.currentTime).text(d.time);this.totalTime=e.find(c.ids.totalTime).text(d.time);this.display.find("a.mediaplayerlink").each(function(){var g=a(this).attr("href");a(this).medialink(c,function(h){h.preventDefault();f.display.trigger(h.data.id);},{id:g.substr(1),obj:a(this)});});this.playPauseButton=e.find(c.ids.playPause).medialink(c,function(g,h){f.playState=!f.playState;f.setToggle(h,f.playState);f.display.trigger("controlupdate",{type:(f.playState?"pause":"play")});});this.seekUpdate=e.find(c.ids.seekUpdate).css("width",0);this.seekProgress=e.find(c.ids.seekProgress).css("width",0);this.seekBar=e.find(c.ids.seekBar).mediaslider(c.ids.seekHandle,false);if(this.seekBar){this.seekBar.display.unbind("setvalue").bind("setvalue",function(g,h){f.seekUpdate.css("width",(h*f.seekBar.trackSize)+"px");f.display.trigger("controlupdate",{type:"seek",value:(h*f.duration)});});this.seekBar.display.unbind("updatevalue").bind("updatevalue",function(g,h){f.seekUpdate.css("width",(h*f.seekBar.trackSize)+"px");});}this.setVolume=function(g){if(this.volumeBar){if(c.volumeVertical){this.volumeUpdate.css({marginTop:(this.volumeBar.handlePos+this.volumeBar.handleMid),height:(this.volumeBar.trackSize-this.volumeBar.handlePos)});}else{this.volumeUpdate.css("width",(g*this.volumeBar.trackSize));}}};this.volumeUpdate=e.find(c.ids.volumeUpdate);this.volumeBar=e.find(c.ids.volumeBar).mediaslider(c.ids.volumeHandle,c.volumeVertical,c.volumeVertical);if(this.volumeBar){this.volumeBar.display.unbind("setvalue").bind("setvalue",function(g,h){f.setVolume(h);f.display.trigger("controlupdate",{type:"volume",value:h});});this.volumeBar.display.unbind("updatevalue").bind("updatevalue",function(g,h){f.setVolume(h);f.volume=h;});}this.mute=e.find(c.ids.mute).medialink(c,function(g,h){f.muteState=!f.muteState;f.setToggle(h,f.muteState);f.setMute(f.muteState);});this.setMute=function(g){this.prevVolume=(this.volumeBar.value>0)?this.volumeBar.value:this.prevVolume;this.volumeBar.updateValue(g?0:this.prevVolume);this.display.trigger("controlupdate",{type:"mute",value:g});};this.setProgress=function(g){if(this.seekProgress&&this.seekBar){this.seekProgress.css("width",(g*(this.seekBar.trackSize+this.seekBar.handleSize)));}};this.onResize=function(){if(this.seekBar){this.seekBar.onResize();}this.setProgress(this.percentLoaded);};this.onMediaUpdate=function(g){switch(g.type){case"reset":this.reset();break;case"paused":this.playState=true;this.setToggle(this.playPauseButton.display,this.playState);break;case"playing":this.playState=false;this.setToggle(this.playPauseButton.display,this.playState);break;case"stopped":this.playState=true;this.setToggle(this.playPauseButton.display,this.playState);break;case"progress":this.percentLoaded=g.percentLoaded;this.setProgress(this.percentLoaded);break;case"meta":case"update":this.timeUpdate(g.currentTime,g.totalTime);if(this.volumeBar){this.volumeBar.updateValue(g.volume);}break;default:break;}};this.reset=function(){this.totalTime.text(this.formatTime(0).time);this.currentTime.text(this.formatTime(0).time);if(this.seekBar){this.seekBar.updateValue(0);}this.seekUpdate.css("width","0px");this.seekProgress.css("width","0px");};this.timeUpdate=function(g,h){this.duration=h;this.totalTime.text(this.formatTime(h).time);this.currentTime.text(this.formatTime(g).time);if(h&&this.seekBar&&!this.seekBar.dragging){this.seekBar.updateValue(g/h);}};this.timeUpdate(0,0);})(this,b);};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.dailymotion.js b/js/compressed/jquery.media.dailymotion.js deleted file mode 100644 index 71e1fef5..00000000 --- a/js/compressed/jquery.media.dailymotion.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};window.onDailymotionPlayerReady=function(b){b=b.replace("_media","");jQuery.media.players[b].node.player.media.player.onReady();};jQuery.media.playerTypes=jQuery.extend(jQuery.media.playerTypes,{dailymotion:function(b){return(b.search(/^http(s)?\:\/\/(www\.)?dailymotion\.com/i)===0);}});jQuery.fn.mediadailymotion=function(c,b){return new (function(f,e,d){this.display=f;var g=this;this.player=null;this.videoFile=null;this.meta=false;this.loaded=false;this.ready=false;this.createMedia=function(i,k){this.videoFile=i;this.ready=false;var h=(e.id+"_media");var j=Math.floor(Math.random()*1000000);var l="http://www.dailymotion.com/swf/"+i.path+"?rand="+j+"&enablejsapi=1&playerapiid="+h;jQuery.media.utils.insertFlash(this.display,l,h,"100%","100%",{},e.wmode,function(m){g.player=m;g.loadPlayer();});};this.loadMedia=function(h){if(this.player){this.loaded=false;this.meta=false;this.videoFile=h;d({type:"playerready"});this.player.loadVideoById(this.videoFile.path,0);}};this.onReady=function(){this.ready=true;this.loadPlayer();};this.loadPlayer=function(){if(this.ready&&this.player){window[e.id+"StateChange"]=function(h){g.onStateChange(h);};window[e.id+"PlayerError"]=function(h){g.onError(h);};this.player.addEventListener("onStateChange",e.id+"StateChange");this.player.addEventListener("onError",e.id+"PlayerError");d({type:"playerready"});this.player.loadVideoById(this.videoFile.path,0);}};this.onStateChange=function(i){var h=this.getPlayerState(i);if(!(!this.meta&&h.state=="stopped")){d({type:h.state,busy:h.busy});}if(!this.loaded&&h.state=="buffering"){this.loaded=true;d({type:"paused",busy:"hide"});if(e.autostart){this.playMedia();}}if(!this.meta&&h.state=="playing"){this.meta=true;d({type:"meta"});}};this.onError=function(i){var h="An unknown error has occured: "+i;if(i==100){h="The requested video was not found. ";h+="This occurs when a video has been removed (for any reason), ";h+="or it has been marked as private.";}else{if((i==101)||(i==150)){h="The video requested does not allow playback in an embedded player.";}}d({type:"error",data:h});};this.getPlayerState=function(h){switch(h){case 5:return{state:"ready",busy:false};case 3:return{state:"buffering",busy:"show"};case 2:return{state:"paused",busy:"hide"};case 1:return{state:"playing",busy:"hide"};case 0:return{state:"complete",busy:false};case -1:return{state:"stopped",busy:false};default:return{state:"unknown",busy:false};}return"unknown";};this.playMedia=function(){d({type:"buffering",busy:"show"});this.player.playVideo();};this.pauseMedia=function(){this.player.pauseVideo();};this.stopMedia=function(){this.player.stopVideo();};this.destroy=function(){this.stopMedia();jQuery.media.utils.removeFlash(this.display,(e.id+"_media"));this.display.children().remove();};this.seekMedia=function(h){d({type:"buffering",busy:"show"});this.player.seekTo(h,true);};this.setVolume=function(h){this.player.setVolume(h*100);};this.getVolume=function(){return(this.player.getVolume()/100);};this.getDuration=function(){return this.player.getDuration();};this.getCurrentTime=function(){return this.player.getCurrentTime();};this.getBytesLoaded=function(){return this.player.getVideoBytesLoaded();};this.getBytesTotal=function(){return this.player.getVideoBytesTotal();};this.getEmbedCode=function(){return this.player.getVideoEmbedCode();};this.getMediaLink=function(){return this.player.getVideoUrl();};this.hasControls=function(){return true;};this.showControls=function(h){};this.setQuality=function(h){};this.getQuality=function(){return"";};})(this,c,b);};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.display.js b/js/compressed/jquery.media.display.js deleted file mode 100644 index 4a78983f..00000000 --- a/js/compressed/jquery.media.display.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{volume:80,autostart:false,streamer:"",embedWidth:450,embedHeight:337,wmode:"transparent",forceOverflow:false,quality:"default",repeat:false});jQuery.fn.mediadisplay=function(b){if(this.length===0){return null;}return new (function(d,c){this.settings=jQuery.media.utils.getSettings(c);this.display=d;var e=this;this.volume=-1;this.player=null;this.preview="";this.updateInterval=null;this.progressInterval=null;this.playQueue=[];this.playIndex=0;this.playerReady=false;this.loaded=false;this.mediaFile=null;this.hasPlaylist=false;if(this.settings.forceOverflow){this.display.parents().css("overflow","visible");}this.reset=function(){this.loaded=false;this.stopMedia();clearInterval(this.progressInterval);clearInterval(this.updateInterval);this.playQueue.length=0;this.playQueue=[];this.playIndex=0;this.playerReady=false;this.mediaFile=null;this.display.empty().trigger("mediaupdate",{type:"reset"});};this.getPlayableMedia=function(j){var h=null;var f=j.length;while(f--){var g=new jQuery.media.file(j[f],this.settings);if(!h||(g.weight0);if(!f){if(this.player){this.player.destroy();this.player=null;}this.display.trigger("mediaupdate",{type:"nomedia"});}return f;};this.playNext=function(){if(this.playQueue.length>this.playIndex){this.loadMedia(this.playQueue[this.playIndex]);this.playIndex++;}else{if(this.settings.repeat){this.playIndex=0;this.playNext();}else{if(this.hasPlaylist){this.reset();}else{this.loaded=false;this.settings.autostart=false;this.playIndex=0;this.playNext();}}}};this.loadMedia=function(g,f){if(g){g=new jQuery.media.file(this.getMediaFile(g),this.settings);g.player=f?f:g.player;this.stopMedia();if(!this.mediaFile||(this.mediaFile.player!=g.player)){this.player=null;this.playerReady=false;if(g.player){this.player=this.display["media"+g.player](this.settings,function(h){e.onMediaUpdate(h);});}if(this.player){this.player.createMedia(g,this.preview);}}else{if(this.player){this.player.loadMedia(g);}}this.mediaFile=g;this.onMediaUpdate({type:"initialize"});}};this.onMediaUpdate=function(g){switch(g.type){case"playerready":this.playerReady=true;this.player.setVolume(0);this.player.setQuality(this.settings.quality);this.startProgress();break;case"buffering":this.startProgress();break;case"stopped":clearInterval(this.progressInterval);clearInterval(this.updateInterval);break;case"error":if(g.code==4){this.loadMedia(this.mediaFile,"flash");}else{clearInterval(this.progressInterval);clearInterval(this.updateInterval);}break;case"paused":clearInterval(this.updateInterval);break;case"playing":this.startUpdate();break;case"progress":var f=this.getPercentLoaded();jQuery.extend(g,{percentLoaded:f});if(f>=1){clearInterval(this.progressInterval);}break;case"meta":jQuery.extend(g,{currentTime:this.player.getCurrentTime(),totalTime:this.getDuration(),volume:this.player.getVolume(),quality:this.getQuality()});break;case"durationupdate":this.mediaFile.duration=g.duration;break;case"complete":this.playNext();break;default:break;}if(g.type=="playing"&&!this.loaded){if(this.settings.autoLoad&&!this.settings.autostart){setTimeout(function(){e.setVolume();e.player.pauseMedia();e.settings.autostart=true;e.loaded=true;},100);}else{this.loaded=true;this.setVolume();this.display.trigger("mediaupdate",g);}}else{this.display.trigger("mediaupdate",g);}};this.startProgress=function(){if(this.playerReady){clearInterval(this.progressInterval);this.progressInterval=setInterval(function(){e.onMediaUpdate({type:"progress"});},500);}};this.startUpdate=function(){if(this.playerReady){clearInterval(this.updateInterval);this.updateInterval=setInterval(function(){if(e.playerReady){e.onMediaUpdate({type:"update",currentTime:e.player.getCurrentTime(),totalTime:e.getDuration(),volume:e.player.getVolume(),quality:e.getQuality()});}},1000);}};this.stopMedia=function(){this.loaded=false;clearInterval(this.progressInterval);clearInterval(this.updateInterval);if(this.playerReady){this.player.stopMedia();}};this.mute=function(f){this.player.setVolume(f?0:this.volume);};this.onResize=function(){if(this.player&&this.player.onResize){this.player.onResize();}};this.getPercentLoaded=function(){if(this.player.getPercentLoaded){return this.player.getPercentLoaded();}else{var g=this.player.getBytesLoaded();var f=this.mediaFile.bytesTotal?this.mediaFile.bytesTotal:this.player.getBytesTotal();return f?(g/f):0;}};this.showControls=function(f){if(this.playerReady){this.player.showControls(f);}};this.hasControls=function(){if(this.player){return this.player.hasControls();}return false;};this.getDuration=function(){if(this.mediaFile){if(!this.mediaFile.duration){this.mediaFile.duration=this.player.getDuration();}return this.mediaFile.duration;}else{return 0;}};this.setVolume=function(f){this.volume=f?f:((this.volume==-1)?(this.settings.volume/100):this.volume);if(this.player){this.player.setVolume(this.volume);}};this.getVolume=function(){if(!this.volume){this.volume=this.player.getVolume();}return this.volume;};this.getQuality=function(){if(!this.mediaFile.quality){this.mediaFile.quality=this.player.getQuality();}return this.mediaFile.quality;};})(this,b);};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.drupal.js b/js/compressed/jquery.media.drupal.js deleted file mode 100644 index 0ab01e13..00000000 --- a/js/compressed/jquery.media.drupal.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{apiKey:"",api:2,sessid:"",drupalVersion:6});jQuery.media=jQuery.extend({},{drupal:function(c,b){return new (function(i,h){h=jQuery.media.utils.getSettings(h);var j=this;var e=(h.apiKey.length>0);var g=(h.api==1);var d=(h.drupalVersion>=6)?"node.get":"node.load";var f=(h.protocol=="auto");jQuery.media=jQuery.extend({},{commands:{connect:{command:{rpc:"system.connect",json:""},useKey:g,protocol:"rpc"},mail:{command:{rpc:"system.mail",json:""},useKey:e,protocol:"rpc"},loadNode:{command:{rpc:d,json:"mediafront_getnode"},useKey:g,protocol:"json"},getPlaylist:{command:{rpc:"mediafront.getPlaylist",json:"mediafront_getplaylist"},useKey:g,protocol:"json"},getVote:{command:{rpc:"vote.getVote",json:""},useKey:g,protocol:"rpc"},setVote:{command:{rpc:"vote.setVote",json:""},useKey:e,protocol:"rpc"},getUserVote:{command:{rpc:"vote.getUserVote",json:""},useKey:g,protocol:"rpc"},deleteVote:{command:{rpc:"vote.deleteVote",json:""},useKey:e,protocol:"rpc"},addTag:{command:{rpc:"tag.addTag",json:""},useKey:e,protocol:"rpc"},incrementCounter:{command:{rpc:"mediafront.incrementNodeCounter",json:""},useKey:e,protocol:"rpc"},setFavorite:{command:{rpc:"favorites.setFavorite",json:""},useKey:e,protocol:"rpc"},deleteFavorite:{command:{rpc:"favorites.deleteFavorite",json:""},useKey:e,protocol:"rpc"},isFavorite:{command:{rpc:"favorites.isFavorite",json:""},useKey:g,protocol:"rpc"},login:{command:{rpc:"user.login",json:""},useKey:e,protocol:"rpc"},logout:{command:{rpc:"user.logout",json:""},useKey:e,protocol:"rpc"},adClick:{command:{rpc:"mediafront.adClick",json:""},useKey:e,protocol:"rpc"},getAd:{command:{rpc:"mediafront.getAd",json:""},useKey:g,protocol:"rpc"},setUserStatus:{command:{rpc:"mediafront.setUserStatus",json:""},useKey:e,protocol:"rpc"}}},jQuery.media);this.user={};this.sessionId="";this.onConnected=null;this.encoder=new jQuery.media.sha256();this.baseURL=h.baseURL.substring(0,(h.baseURL.length-1)).replace(/^(http[s]?\:[\\\/][\\\/])/,"");this.connect=function(k){this.onConnected=k;if(h.sessid){this.onConnect({sessid:h.sessid});}else{this.call(jQuery.media.commands.connect,function(l){j.onConnect(l);},null);}};this.call=function(p,o,m){var k=[];for(var l=3;l1){var m=this.getTimeStamp();var l=this.getNonce();var n=this.computeHMAC(m,this.baseURL,l,o.command.rpc,h.apiKey);k.unshift(l);k.unshift(m);k.unshift(this.baseURL);k.unshift(n);}else{k.unshift(h.apiKey);}}return k;};this.getTimeStamp=function(){return(parseInt(new Date().getTime()/1000,10)).toString();};this.getNonce=function(){var n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";var l="";for(var m=0;m<10;m++){var k=Math.floor(Math.random()*n.length);l+=n.substring(k,k+1);}return l;};this.computeHMAC=function(n,m,l,p,o){var k=n+";"+m+";"+l+";"+p;return this.encoder.encrypt(o,k);};this.onConnect=function(k){if(k){this.sessionId=k.sessid;this.user=k.user;}if(this.onConnected){this.onConnected(k);}};})(c,b);}},jQuery.media);})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.file.js b/js/compressed/jquery.media.file.js deleted file mode 100644 index 3a0e4687..00000000 --- a/js/compressed/jquery.media.file.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media.checkPlayType=function(c,b){if((typeof c.canPlayType)=="function"){return("no"!==c.canPlayType(b))&&(""!==c.canPlayType(b));}else{return false;}};jQuery.media.getPlayTypes=function(){var b={};var c=document.createElement("video");b.ogg=jQuery.media.checkPlayType(c,'video/ogg; codecs="theora, vorbis"');b.h264=jQuery.media.checkPlayType(c,'video/mp4; codecs="avc1.42E01E, mp4a.40.2"');b.webm=jQuery.media.checkPlayType(c,'video/webm; codecs="vp8, vorbis"');c=document.createElement("audio");b.audioOgg=jQuery.media.checkPlayType(c,"audio/ogg");b.mp3=jQuery.media.checkPlayType(c,"audio/mpeg");return b;};jQuery.media.playTypes=null;jQuery.media.file=function(b,c){if(!jQuery.media.playTypes){jQuery.media.playTypes=jQuery.media.getPlayTypes();}b=(typeof b==="string")?{path:b}:b;this.duration=b.duration?b.duration:0;this.bytesTotal=b.bytesTotal?b.bytesTotal:0;this.quality=b.quality?b.quality:0;this.stream=c.streamer?c.streamer:b.stream;this.path=b.path?jQuery.trim(b.path):(c.baseURL+jQuery.trim(b.filepath));this.extension=b.extension?b.extension:this.getFileExtension();this.weight=b.weight?b.weight:this.getWeight();this.player=b.player?b.player:this.getPlayer();this.mimetype=b.mimetype?b.mimetype:this.getMimeType();this.type=b.type?b.type:this.getType();};jQuery.media.file.prototype.getFileExtension=function(){return this.path.substring(this.path.lastIndexOf(".")+1).toLowerCase();};jQuery.media.file.prototype.getPlayer=function(){switch(this.extension){case"ogg":case"ogv":return jQuery.media.playTypes.ogg?"html5":"flash";case"mp4":case"m4v":return jQuery.media.playTypes.h264?"html5":"flash";case"webm":return jQuery.media.playTypes.webm?"html5":"flash";case"oga":return jQuery.media.playTypes.audioOgg?"html5":"flash";case"mp3":return jQuery.media.playTypes.mp3?"html5":"flash";case"swf":case"flv":case"f4v":case"f4a":case"mov":case"3g2":case"3gp":case"3gpp":case"m4a":case"aac":case"wav":case"aif":case"wma":return"flash";default:for(var b in jQuery.media.playerTypes){if(jQuery.media.playerTypes.hasOwnProperty(b)){if(jQuery.media.playerTypes[b](this.path)){return b;}}}break;}return"flash";};jQuery.media.file.prototype.getType=function(){switch(this.extension){case"swf":case"webm":case"ogg":case"ogv":case"mp4":case"m4v":case"flv":case"f4v":case"mov":case"3g2":case"3gp":case"3gpp":return"video";case"oga":case"mp3":case"f4a":case"m4a":case"aac":case"wav":case"aif":case"wma":return"audio";default:break;}return"";};jQuery.media.file.prototype.getWeight=function(){switch(this.extension){case"mp4":case"m4v":case"m4a":return jQuery.media.playTypes.h264?3:7;case"webm":return jQuery.media.playTypes.webm?4:8;case"ogg":case"ogv":return jQuery.media.playTypes.ogg?5:20;case"oga":return jQuery.media.playTypes.audioOgg?5:20;case"mp3":return 6;case"mov":case"swf":case"flv":case"f4v":case"f4a":case"3g2":case"3gp":case"3gpp":return 9;case"wav":case"aif":case"aac":return 10;case"wma":return 11;default:break;}return 0;};jQuery.media.file.prototype.getMimeType=function(){switch(this.extension){case"mp4":case"m4v":case"flv":case"f4v":return"video/mp4";case"webm":return"video/x-webm";case"ogg":case"ogv":return"video/ogg";case"3g2":return"video/3gpp2";case"3gpp":case"3gp":return"video/3gpp";case"mov":return"video/quicktime";case"swf":return"application/x-shockwave-flash";case"oga":return"audio/ogg";case"mp3":return"audio/mpeg";case"m4a":case"f4a":return"audio/mp4";case"aac":return"audio/aac";case"wav":return"audio/vnd.wave";case"wma":return"audio/x-ms-wma";default:break;}return"";};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.flash.js b/js/compressed/jquery.media.flash.js deleted file mode 100644 index 1c2b785c..00000000 --- a/js/compressed/jquery.media.flash.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){window.onFlashPlayerReady=function(b){jQuery.media.players[b].node.player.media.player.onReady();};window.onFlashPlayerUpdate=function(c,b){jQuery.media.players[c].node.player.media.player.onMediaUpdate(b);};window.onFlashPlayerDebug=function(b){if(window.console&&console.log){console.log(b);}};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{flashPlayer:"./flash/mediafront.swf",skin:"default",config:"nocontrols"});jQuery.fn.mediaflash=function(c,b){return new (function(f,e,d){e=jQuery.media.utils.getSettings(e);this.display=f;var g=this;this.player=null;this.mediaFile=null;this.preview="";this.ready=false;this.translate={mediaConnected:"connected",mediaBuffering:"buffering",mediaPaused:"paused",mediaPlaying:"playing",mediaStopped:"stopped",mediaComplete:"complete",mediaMeta:"meta"};this.busy={mediaConnected:false,mediaBuffering:"show",mediaPaused:"hide",mediaPlaying:"hide",mediaStopped:false,mediaComplete:false,mediaMeta:false};this.createMedia=function(h,l){this.mediaFile=h;this.preview=l;this.ready=false;var j=(e.id+"_media");var k=Math.floor(Math.random()*1000000);var m=e.flashPlayer+"?rand="+k;var i={config:e.config,id:e.id,file:h.path,image:this.preview,skin:e.skin,autostart:(e.autostart||!e.autoLoad)};if(h.stream){i.stream=h.stream;}if(e.debug){i.debug="1";}jQuery.media.utils.insertFlash(this.display,m,j,"100%","100%",i,e.wmode,function(n){g.player=n;g.loadPlayer();});};this.loadMedia=function(h){if(this.player&&this.ready){this.mediaFile=h;this.player.loadMedia(h.path,h.stream);d({type:"playerready"});}};this.onReady=function(){this.ready=true;this.loadPlayer();};this.loadPlayer=function(){if(this.ready&&this.player){d({type:"playerready"});}};this.onMediaUpdate=function(h){d({type:this.translate[h],busy:this.busy[h]});};this.playMedia=function(){if(this.player&&this.ready){this.player.playMedia();}};this.pauseMedia=function(){if(this.player&&this.ready){this.player.pauseMedia();}};this.stopMedia=function(){if(this.player&&this.ready){this.player.stopMedia();}};this.destroy=function(){this.stopMedia();jQuery.media.utils.removeFlash(this.display,(e.id+"_media"));this.display.children().remove();};this.seekMedia=function(h){if(this.player&&this.ready){this.player.seekMedia(h);}};this.setVolume=function(h){if(this.player&&this.ready){this.player.setVolume(h);}};this.getVolume=function(){return(this.player&&this.ready)?this.player.getVolume():0;};this.getDuration=function(){return(this.player&&this.ready)?this.player.getDuration():0;};this.getCurrentTime=function(){return(this.player&&this.ready)?this.player.getCurrentTime():0;};this.getBytesLoaded=function(){return(this.player&&this.ready)?this.player.getMediaBytesLoaded():0;};this.getBytesTotal=function(){return(this.player&&this.ready)?this.player.getMediaBytesTotal():0;};this.hasControls=function(){return true;};this.showControls=function(h){if(this.player&&this.ready){this.player.showPlugin("controlBar",h);this.player.showPlugin("playLoader",h);}};this.getEmbedCode=function(){var h={config:"config",id:"mediafront_player",file:this.mediaFile.path,image:this.preview,skin:e.skin};if(this.mediaFile.stream){h.stream=this.mediaFile.stream;}return jQuery.media.utils.getFlash(e.flashPlayer,"mediafront_player",e.embedWidth,e.embedHeight,h,e.wmode);};this.setQuality=function(h){};this.getQuality=function(){return"";};this.getMediaLink=function(){return"This video currently does not have a link.";};})(this,c,b);};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.html5.js b/js/compressed/jquery.media.html5.js deleted file mode 100644 index 03f8efc4..00000000 --- a/js/compressed/jquery.media.html5.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.fn.mediahtml5=function(c,b){return new (function(f,e,d){this.display=f;var g=this;this.player=null;this.bytesLoaded=0;this.bytesTotal=0;this.mediaType="";this.loaded=false;this.mediaFile=null;this.playerElement=null;this.getPlayer=function(h,m){this.mediaFile=h;var j=e.id+"_"+this.mediaType;var l="<"+this.mediaType+' style="position:absolute" id="'+j+'"';l+=m?' poster="'+m+'"':"";if(typeof h==="array"){l+=">";var k=h.length;while(k){k--;l+='';}}else{l+=' src="'+h.path+'">Unable to display media.';}l+="";this.display.append(l);this.bytesTotal=h.bytesTotal;this.playerElement=this.display.find("#"+j);this.onResize();return this.playerElement.eq(0)[0];};this.createMedia=function(h,i){jQuery.media.utils.removeFlash(this.display,e.id+"_media");this.display.children().remove();this.mediaType=this.getMediaType(h);this.player=this.getPlayer(h,i);this.loaded=false;var j=false;if(this.player){this.player.addEventListener("abort",function(){d({type:"stopped"});},true);this.player.addEventListener("loadstart",function(){d({type:"ready",busy:"show"});g.onReady();},true);this.player.addEventListener("loadeddata",function(){d({type:"loaded",busy:"hide"});},true);this.player.addEventListener("loadedmetadata",function(){d({type:"meta"});},true);this.player.addEventListener("canplaythrough",function(){d({type:"canplay",busy:"hide"});},true);this.player.addEventListener("ended",function(){d({type:"complete"});},true);this.player.addEventListener("pause",function(){d({type:"paused"});},true);this.player.addEventListener("play",function(){d({type:"playing"});},true);this.player.addEventListener("playing",function(){d({type:"playing",busy:"hide"});},true);this.player.addEventListener("error",function(k){g.onError(k.target.error);d({type:"error",code:k.target.error.code});},true);this.player.addEventListener("waiting",function(){d({type:"waiting",busy:"show"});},true);this.player.addEventListener("timeupdate",function(){if(j){d({type:"timeupdate",busy:"hide"});}else{j=true;}},true);this.player.addEventListener("durationchange",function(){if(this.duration&&(this.duration!==Infinity)){d({type:"durationupdate",duration:this.duration});}},true);this.player.addEventListener("progress",function(k){g.bytesLoaded=k.loaded;g.bytesTotal=k.total;},true);this.player.autoplay=true;if(typeof this.player.hasAttribute=="function"&&this.player.hasAttribute("preload")&&this.player.preload!="none"){this.player.autobuffer=true;}else{this.player.autobuffer=false;this.player.preload="none";}d({type:"playerready"});}};this.onError=function(h){switch(h.code){case 1:console.log("Error: MEDIA_ERR_ABORTED");break;case 2:console.log("Error: MEDIA_ERR_DECODE");break;case 3:console.log("Error: MEDIA_ERR_NETWORK");break;case 4:console.log("Error: MEDIA_ERR_SRC_NOT_SUPPORTED");break;default:break;}};this.onReady=function(){if(!this.loaded){this.loaded=true;this.playMedia();}};this.loadMedia=function(h){this.mediaFile=h;this.createMedia(h);};this.getMediaType=function(h){var i=(typeof h==="array")?h[0].extension:h.extension;switch(i){case"ogg":case"ogv":case"mp4":case"m4v":return"video";case"oga":case"mp3":return"audio";default:break;}return"video";};this.playMedia=function(){if(this.player&&this.player.play){this.player.play();}};this.pauseMedia=function(){if(this.player&&this.player.pause){this.player.pause();}};this.stopMedia=function(){this.pauseMedia();if(this.player){this.player.src="";}};this.destroy=function(){this.stopMedia();this.display.children().remove();};this.seekMedia=function(h){if(this.player){this.player.currentTime=h;}};this.setVolume=function(h){if(this.player){this.player.volume=h;}};this.getVolume=function(){return this.player?this.player.volume:0;};this.getDuration=function(){var h=this.player?this.player.duration:0;return(h===Infinity)?0:h;};this.getCurrentTime=function(){return this.player?this.player.currentTime:0;};this.getPercentLoaded=function(){if(this.player&&this.player.buffered&&this.player.duration){return(this.player.buffered.end(0)/this.player.duration);}else{if(this.bytesTotal){return(this.bytesLoaded/this.bytesTotal);}else{return 0;}}};this.onResize=function(){if(this.mediaType=="video"){this.playerElement.css({width:this.display.width(),height:this.display.height()});}};this.setQuality=function(h){};this.getQuality=function(){return"";};this.hasControls=function(){return false;};this.showControls=function(h){};this.getEmbedCode=function(){if((this.mediaFile.extension=="mp4")||(this.mediaFile.extension=="m4v")||(this.mediaFile.extension=="webm")){var h={config:"config",id:"mediafront_player",file:this.mediaFile.path,image:this.preview,skin:e.skin};if(this.mediaFile.stream){h.stream=this.mediaFile.stream;}return jQuery.media.utils.getFlash(e.flashPlayer,"mediafront_player",e.embedWidth,e.embedHeight,h,e.wmode);}else{return"This media does not support embedding.";}};this.getMediaLink=function(){return"This media currently does not have a link.";};})(this,c,b);};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.image.js b/js/compressed/jquery.media.image.js deleted file mode 100644 index 0e600b72..00000000 --- a/js/compressed/jquery.media.image.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.fn.mediaimage=function(c,b){if(this.length===0){return null;}return new (function(e,h,d){this.display=e;var i=this;var g=0;var f=false;this.imgLoader=new Image();this.imgLoader.onload=function(){f=true;g=(i.imgLoader.width/i.imgLoader.height);i.resize();i.display.trigger("imageLoaded");};e.css("overflow","hidden");this.loaded=function(){return this.imgLoader.complete;};this.resize=function(n,j){var m=d?this.imgLoader.width:(n?n:this.display.width());var k=d?this.imgLoader.height:(j?j:this.display.height());if(m&&k&&f){var l=jQuery.media.utils.getScaledRect(g,{width:m,height:k});if(this.image){this.image.attr("src",this.imgLoader.src).css({marginLeft:l.x,marginTop:l.y,width:l.width,height:l.height});}this.image.fadeIn();}};this.clear=function(){f=false;if(this.image){this.image.attr("src","");this.imgLoader.src="";this.image.fadeOut(function(){if(h){a(this).parent().remove();}else{a(this).remove();}});}};this.refresh=function(){this.resize();};this.loadImage=function(j){this.clear();this.image=a(document.createElement("img")).attr({src:""}).hide();if(h){this.display.append(a(document.createElement("a")).attr({target:"_blank",href:h}).append(this.image));}else{this.display.append(this.image);}this.imgLoader.src=j;};})(this,c,b);};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.json.js b/js/compressed/jquery.media.json.js deleted file mode 100644 index a71dc66e..00000000 --- a/js/compressed/jquery.media.json.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media=jQuery.extend({},{json:function(b){return new (function(e){var f=this;var c={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};var d={"boolean":function(g){return String(g);},"null":function(g){return"null";},number:function(g){return isFinite(g)?String(g):"null";},string:function(g){if(/["\\\x00-\x1f]/.test(g)){g=g.replace(/([\x00-\x1f\\"])/g,function(i,h){var j=c[h];if(j){return j;}j=h.charCodeAt();return"\\u00"+Math.floor(j/16).toString(16)+(j%16).toString(16);});}return'"'+g+'"';},array:function(h){var k=["["],g,o,n,j=h.length,m;for(n=0;n0){this.scrollRegion.clear();var f=function(i,j){e.setLink(j);};var g=d.links.length;while(g){g--;var h=this.scrollRegion.newItem().playlistlink(d,d.links[g]);h.unbind("linkclick").bind("linkclick",f);}this.scrollRegion.activate();}};this.setLink=function(f){if(this.previousLink){this.previousLink.setActive(false);}f.setActive(true);this.previousLink=f;};})(this,b);};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.menu.js b/js/compressed/jquery.media.menu.js deleted file mode 100644 index 76346e6b..00000000 --- a/js/compressed/jquery.media.menu.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media.ids=jQuery.extend(jQuery.media.ids,{close:"#mediamenuclose",embed:"#mediaembed",elink:"#mediaelink",email:"#mediaemail"});jQuery.fn.mediamenu=function(c,b){if(this.length===0){return null;}return new (function(f,g,e){e=jQuery.media.utils.getSettings(e);var h=this;this.display=g;this.on=false;this.contents=[];this.prevItem={id:0,link:null,contents:null};this.close=this.display.find(e.ids.close);this.close.unbind("click").bind("click",function(){h.display.trigger("menuclose");});this.setMenuItem=function(j,k){if(this.prevItem.id!=k){if(this.prevItem.id&&e.template.onMenuSelect){e.template.onMenuSelect(this.prevItem.link,this.prevItem.contents,false);}var i=this.contents[k];if(e.template.onMenuSelect){e.template.onMenuSelect(j,i,true);}this.prevItem={id:k,link:j,contents:i};}};this.setEmbedCode=function(i){this.setInputItem(e.ids.embed,i);};this.setMediaLink=function(i){this.setInputItem(e.ids.elink,i);};this.setInputItem=function(k,j){var i=this.contents[k].find("input");i.unbind("click").bind("click",function(){a(this).select().focus();});i.attr("value",j);};var d=0;this.links=this.display.find("a");this.links.each(function(){var j=a(this);if(j.length>0){var k=j.attr("href");var i=h.display.find(k);i.hide();h.contents[k]=i;j.unbind("click").bind("click",{id:k,obj:j.parent()},function(l){l.preventDefault();h.setMenuItem(l.data.obj,l.data.id);});if(d===0){h.setMenuItem(j.parent(),k);}d++;}});})(c,this,b);};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.minplayer.js b/js/compressed/jquery.media.minplayer.js deleted file mode 100644 index 35238651..00000000 --- a/js/compressed/jquery.media.minplayer.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{logo:"logo.png",logoWidth:49,logoHeight:15,logopos:"sw",logox:5,logoy:5,link:"http://www.mediafront.org",file:"",image:"",timeout:8,autoLoad:true});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{busy:"#mediabusy",preview:"#mediapreview",play:"#mediaplay",media:"#mediadisplay"});jQuery.fn.minplayer=function(b){if(this.length===0){return null;}return new (function(c,d){d=jQuery.media.utils.getSettings(d);this.display=c;var e=this;this.autoLoad=d.autoLoad;this.busy=c.find(d.ids.busy);this.busyImg=this.busy.find("img");this.busyWidth=this.busyImg.width();this.busyHeight=this.busyImg.height();this.play=c.find(d.ids.play);this.play.unbind("click").bind("click",function(){e.togglePlayPause();});this.playImg=this.play.find("img");this.playWidth=this.playImg.width();this.playHeight=this.playImg.height();this.preview=c.find(d.ids.preview).mediaimage();if(this.preview){this.preview.display.unbind("click").bind("click",function(){e.onMediaClick();});this.preview.display.unbind("imageLoaded").bind("imageLoaded",function(){e.onPreviewLoaded();});}this.usePlayerControls=false;this.busyFlags=0;this.busyVisible=false;this.playVisible=false;this.previewVisible=false;this.playing=false;this.hasMedia=false;this.timeoutId=0;this.width=this.display.width();this.height=this.display.height();this.showElement=function(h,f,g){if(h&&!this.usePlayerControls){if(f){h.show(g);}else{h.hide(g);}}};this.showPlay=function(f,g){f&=this.hasMedia;this.playVisible=f;this.showElement(this.play,f,g);};this.showBusy=function(h,f,g){if(f){this.busyFlags|=(1<0);this.showElement(this.busy,this.busyVisible,g);if(h==1&&!f){this.showBusy(3,false);}};this.showPreview=function(f,g){this.previewVisible=f;if(this.preview){this.showElement(this.preview.display,f,g);}};this.onControlUpdate=function(f){if(this.media){if(this.media.playerReady){switch(f.type){case"play":this.media.player.playMedia();break;case"pause":this.media.player.pauseMedia();break;case"seek":this.media.player.seekMedia(f.value);break;case"volume":this.media.setVolume(f.value);break;case"mute":this.media.mute(f.value);break;default:break;}}else{if((this.media.playQueue.length>0)&&!this.media.mediaFile){this.autoLoad=true;this.playNext();}}if(d.template&&d.template.onControlUpdate){d.template.onControlUpdate(f);}}};this.fullScreen=function(f){if(d.template.onFullScreen){d.template.onFullScreen(f);}this.preview.refresh();};this.onPreviewLoaded=function(){this.previewVisible=true;};this.onMediaUpdate=function(f){switch(f.type){case"paused":this.playing=false;this.showPlay(true);if(!this.media.loaded){this.showPreview(true);}break;case"update":case"playing":this.playing=true;this.showPlay(false);this.showPreview((this.media.mediaFile.type=="audio"));break;case"initialize":this.playing=false;this.showPlay(true);this.showBusy(1,this.autoLoad);this.showPreview(true);break;case"buffering":this.showPlay(true);this.showPreview((this.media.mediaFile.type=="audio"));break;default:break;}if(f.busy){this.showBusy(1,(f.busy=="show"));}};this.onMediaClick=function(){if(this.media.player&&!this.media.hasControls()){if(this.playing){this.media.player.pauseMedia();}else{this.media.player.playMedia();}}};this.media=this.display.find(d.ids.media).mediadisplay(d);if(this.media){this.media.display.unbind("click").bind("click",function(){e.onMediaClick();});}this.setLogoPos=function(){if(this.logo){var f={};if(d.logopos=="se"||d.logopos=="sw"){f.bottom=d.logoy;}if(d.logopos=="ne"||d.logopos=="nw"){f.top=d.logoy;}if(d.logopos=="nw"||d.logopos=="sw"){f.left=d.logox;}if(d.logopos=="ne"||d.logopos=="se"){f.right=d.logox;}this.logo.display.css(f);}};if(!d.controllerOnly){this.display.prepend('');this.logo=this.display.find("."+d.prefix+"medialogo").mediaimage(d.link);if(this.logo){this.logo.display.css({width:d.logoWidth,height:d.logoHeight});this.logo.display.bind("imageLoaded",function(){e.setLogoPos();});this.logo.loadImage(d.logo);}}this.reset=function(){this.hasMedia=false;this.playing=false;jQuery.media.players[d.id].showNativeControls(false);this.showPlay(true);this.showPreview(true);clearTimeout(this.timeoutId);if(this.media){this.media.reset();}};this.togglePlayPause=function(){if(this.media){if(this.media.playerReady){if(this.playing){this.showPlay(true);this.media.player.pauseMedia();}else{this.showPlay(false);this.media.player.playMedia();}}else{if((this.media.playQueue.length>0)&&!this.media.mediaFile){this.autoLoad=true;this.playNext();}}}};this.loadImage=function(f){if(this.preview){this.showBusy(3,true);this.preview.loadImage(f);var g=setInterval(function(){if(e.preview.loaded()){clearInterval(g);e.showBusy(3,false);}},500);if(this.media){this.media.preview=f;}}};this.onResize=function(){if(this.preview){this.preview.refresh();}if(this.media){this.media.onResize();}};this.clearImage=function(){if(this.preview){this.preview.clear();}};this.loadFiles=function(f){this.reset();this.hasMedia=this.media&&this.media.loadFiles(f);if(this.hasMedia&&this.autoLoad){this.media.playNext();}else{if(!this.hasMedia){this.showPlay(false);this.showPreview(true);this.timeoutId=setTimeout(function(){e.media.display.trigger("mediaupdate",{type:"complete"});},(d.timeout*1000));}}return this.hasMedia;};this.playNext=function(){if(this.media){this.media.playNext();}};this.hasControls=function(){if(this.media){return this.media.hasControls();}return true;};this.showControls=function(f){if(this.media){this.media.showControls(f);}};this.loadMedia=function(f){this.reset();if(this.media){this.media.loadMedia(f);}};if(d.file){this.loadMedia(d.file);}if(d.image){this.loadImage(d.image);}})(this,b);};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.mousewheel.js b/js/compressed/jquery.media.mousewheel.js deleted file mode 100644 index 7799cdd7..00000000 --- a/js/compressed/jquery.media.mousewheel.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -/* Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net) - * Licensed under the MIT License (LICENSE.txt). - * - * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. - * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. - * Thanks to: Seamus Leahy for adding deltaX and deltaY - * - * Version: 3.0.4 - * - * Requires: 1.2.2+ - */ -(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){d--;this.addEventListener(a[d],b,false);}}else{this.onmousewheel=b;}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){d--;this.removeEventListener(a[d],b,false);}}else{this.onmousewheel=null;}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel");},unmousewheel:function(d){return this.unbind("mousewheel",d);}});function b(i){var g=i||window.event,f=[].slice.call(arguments,1),j=0,h=true,e=0,d=0;i=c.event.fix(g);i.type="mousewheel";if(i.wheelDelta){j=i.wheelDelta/120;}if(i.detail){j=-i.detail/3;}d=j;if(g.axis!==undefined&&g.axis===g.HORIZONTAL_AXIS){d=0;e=-1*j;}if(g.wheelDeltaY!==undefined){d=g.wheelDeltaY/120;}if(g.wheelDeltaX!==undefined){e=-1*g.wheelDeltaX/120;}f.unshift(i,j,e,d);return c.event.handle.apply(this,f);}})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.node.js b/js/compressed/jquery.media.node.js deleted file mode 100644 index fb62f402..00000000 --- a/js/compressed/jquery.media.node.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{node:"",incrementTime:5});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{voter:"#mediavoter",uservoter:"#mediauservoter",mediaRegion:"#mediaregion",field:".mediafield"});jQuery.fn.medianode=function(c,b){if(this.length===0){return null;}return new (function(f,e,d){d=jQuery.media.utils.getSettings(d);this.display=e;this.nodeInfo={};this.incremented=false;var g=this;this.player=this.display.find(d.ids.mediaRegion).minplayer(d);if(this.player&&(d.incrementTime!==0)){this.player.display.unbind("mediaupdate").bind("mediaupdate",function(h,i){g.onMediaUpdate(i);});}this.images=[];this.addVoters=function(h){this.voter=h.find(d.ids.voter).mediavoter(d,f,false);this.uservoter=h.find(d.ids.uservoter).mediavoter(d,f,true);if(this.uservoter&&this.voter){this.uservoter.display.unbind("processing").bind("processing",function(){g.player.showBusy(2,true);});this.uservoter.display.unbind("voteGet").bind("voteGet",function(){g.player.showBusy(2,false);});this.uservoter.display.unbind("voteSet").bind("voteSet",function(j,i){g.player.showBusy(2,false);g.voter.updateVote(i);});}};this.addVoters(this.display);this.onMediaUpdate=function(h){if(!this.incremented){switch(h.type){case"update":if((d.incrementTime>0)&&(h.currentTime>d.incrementTime)){this.incremented=true;f.call(jQuery.media.commands.incrementCounter,null,null,g.nodeInfo.nid);}break;case"complete":if(d.incrementTime<0){this.incremented=true;f.call(jQuery.media.commands.incrementCounter,null,null,g.nodeInfo.nid);}break;default:break;}}};this.loadNode=function(h){return this.getNode(this.translateNode(h));};this.translateNode=function(i){var j=((typeof i)=="number")||((typeof i)=="string");if(!i){var h=d.node;if((typeof h)=="object"){h.load=false;return h;}else{return h?{nid:h,load:true}:null;}}else{if(j){return{nid:i,load:true};}else{i.load=false;return i;}}};this.getNode=function(h){if(h){if(f&&h.load){f.call(jQuery.media.commands.loadNode,function(i){g.setNode(i);},null,h.nid,{});}else{this.setNode(h);}return true;}return false;};this.setNode=function(h){if(h){this.nodeInfo=h;this.incremented=false;if(this.player&&this.nodeInfo.mediafiles){var i=this.getImage("preview");if(i){this.player.loadImage(i.path);}else{this.player.clearImage();}this.player.loadFiles(this.nodeInfo.mediafiles.media);}if(this.voter){this.voter.getVote(h);}if(this.uservoter){this.uservoter.getVote(h);}this.display.find(d.ids.field).each(function(){g.setField(this,h,a(this).attr("type"),a(this).attr("field"));});this.display.trigger("nodeload",this.nodeInfo);}};this.setField=function(j,i,h,k){if(h){switch(h){case"text":this.setTextField(j,i,k);break;case"image":this.setImageField(j,k);break;case"cck_text":this.setCCKTextField(j,i,k);break;default:break;}}};this.setTextField=function(i,h,k){var j=h[k];if(j){a(i).empty().html(j);}return true;};this.setCCKTextField=function(i,h,k){if(args.fieldType=="cck_text"){var j=h[k];if(j){a(i).empty().html(j["0"].value);}}return true;};this.onResize=function(){if(this.player){this.player.onResize();}};this.getImage=function(j){var h=this.nodeInfo.mediafiles?this.nodeInfo.mediafiles.image:null;var k=null;if(h){if(h[j]){k=h[j];}else{for(var i in h){if(h.hasOwnProperty(i)){k=h[i];break;}}}k=(typeof k==="string")?{path:k}:k;k.path=k.path?jQuery.trim(k.path):(d.baseURL+jQuery.trim(k.filepath));if(k&&k.path){k.path=k.path?jQuery.trim(k.path):(d.baseURL+jQuery.trim(k.filepath));}else{k=null;}}return k;};this.setImageField=function(i,k){var h=this.getImage(k);if(h){var j=a(i).empty().mediaimage();this.images.push(j);j.loadImage(h.path);}};})(c,this,b);};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.pager.js b/js/compressed/jquery.media.pager.js deleted file mode 100644 index 68e4f9df..00000000 --- a/js/compressed/jquery.media.pager.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{shuffle:false,loop:false,pageLimit:10});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{prev:"#mediaprev",next:"#medianext",loadPrev:"#medialoadprev",loadNext:"#medialoadnext",prevPage:"#mediaprevpage",nextPage:"#medianextpage"});jQuery.fn.mediapager=function(b){return new (function(c,d){d=jQuery.media.utils.getSettings(d);this.display=c;var e=this;this.activeIndex=-1;this.currentIndex=-1;this.activePage=0;this.currentPage=0;this.numPages=0;this.numItems=10;this.activeNumItems=10;this.loadState="";this.enabled=false;this.prevButton=c.find(d.ids.prev).medialink(d,function(){if(e.enabled){e.loadPrev(false);}});this.nextButton=c.find(d.ids.next).medialink(d,function(){if(e.enabled){e.loadNext(false);}});this.loadPrevButton=c.find(d.ids.loadPrev).medialink(d,function(){if(e.enabled){e.loadPrev(true);}});this.loadNextButton=c.find(d.ids.loadNext).medialink(d,function(){if(e.enabled){e.loadNext(true);}});this.prevPageButton=c.find(d.ids.prevPage).medialink(d,function(){if(e.enabled){e.loadState="click";e.prevPage();}});this.nextPageButton=c.find(d.ids.nextPage).medialink(d,function(){if(e.enabled){e.loadState="click";e.nextPage();}});this.setTotalItems=function(f){if(f&&d.pageLimit){this.numPages=Math.ceil(f/d.pageLimit);if(this.numPages==1){this.numItems=f;}}};this.setNumItems=function(f){this.numItems=f;};this.reset=function(){this.activePage=0;this.currentPage=0;this.activeIndex=-1;this.currentIndex=-1;this.loadState="";};this.loadIndex=function(h){var f=h?"activeIndex":"currentIndex";var g=this[f];switch(this.loadState){case"prev":this.loadState="";this.loadPrev(h);return;case"first":g=0;break;case"last":g=(this.numItems-1);break;case"rand":g=Math.floor(Math.random()*this.numItems);break;default:break;}this.loadState="";if(g!=this[f]){this.loadState="";this[f]=g;this.display.trigger("loadindex",{index:this[f],active:h});}};this.loadNext=function(g){if(this.loadState){this.loadIndex(g);}else{if(d.shuffle){this.loadRand();}else{var f=g?"activeIndex":"currentIndex";if(g&&(this.activePage!=this.currentPage)){if((this.activeIndex==(this.activeNumItems-1))&&(this.activePage==(this.currentPage-1))){this.currentIndex=this.activeIndex=0;this.activePage=this.currentPage;this.display.trigger("loadindex",{index:0,active:true});}else{this.currentPage=this.activePage;this.loadState="";this.display.trigger("loadpage",{index:this.activePage,active:g});}}else{this[f]++;if(this[f]>=this.numItems){if(this.numPages>1){this[f]=(this.numItems-1);this.loadState=this.loadState?this.loadState:"first";this.nextPage(g);}else{if(!g||d.loop){this[f]=0;this.display.trigger("loadindex",{index:this[f],active:g});}}}else{this.display.trigger("loadindex",{index:this[f],active:g});}}}}};this.loadPrev=function(g){var f=g?"activeIndex":"currentIndex";if(g&&(this.activePage!=this.currentPage)){this.currentPage=this.activePage;this.loadState="prev";this.display.trigger("loadpage",{index:this.activePage,active:g});}else{this[f]--;if(this[f]<0){if(this.numPages>1){this[f]=0;this.loadState=this.loadState?this.loadState:"last";this.prevPage(g);}else{if(!g||d.loop){this[f]=(this.numItems-1);this.display.trigger("loadindex",{index:this[f],active:g});}}}else{this.display.trigger("loadindex",{index:this[f],active:g});}}};this.loadRand=function(){var f=Math.floor(Math.random()*this.numPages);if(f!=this.activePage){this.activePage=f;this.loadState=this.loadState?this.loadState:"rand";this.display.trigger("loadpage",{index:this.activePage,active:true});}else{this.activeIndex=Math.floor(Math.random()*this.numItems);this.display.trigger("loadindex",{index:this.activeIndex,active:true});}};this.nextPage=function(h){var f=h?"activePage":"currentPage";var g=false;if(this[f]<(this.numPages-1)){this[f]++;g=true;}else{if(d.loop){this.loadState=this.loadState?this.loadState:"first";this[f]=0;g=true;}else{this.loadState="";}}this.setPageState(h);if(g){this.display.trigger("loadpage",{index:this[f],active:h});}};this.prevPage=function(h){var f=h?"activePage":"currentPage";var g=false;if(this[f]>0){this[f]--;g=true;}else{if(d.loop){this.loadState=this.loadState?this.loadState:"last";this[f]=(this.numPages-1);g=true;}else{this.loadState="";}}this.setPageState(h);if(g){this.display.trigger("loadpage",{index:this[f],active:h});}};this.setPageState=function(f){if(f){this.currentPage=this.activePage;}else{this.activeNumItems=this.numItems;}};})(this,b);};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.parser.js b/js/compressed/jquery.media.parser.js deleted file mode 100644 index 9e750ef5..00000000 --- a/js/compressed/jquery.media.parser.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.extend({},{parser:function(b){return new (function(c){var d=this;this.onLoaded=null;this.parseFile=function(e,f){this.onLoaded=f;jQuery.ajax({type:"GET",url:e,dataType:"xml",success:function(g){d.parseXML(g);},error:function(g,i,h){if(window.console&&console.log){console.log("Error: "+i);}}});};this.parseXML=function(e){var f=this.parseXSPF(e);if(f.total_rows===0){f=this.parseASX(e);}if(f.total_rows===0){f=this.parseRSS(e);}if(this.onLoaded&&f.total_rows){this.onLoaded(f);}return f;};this.parseXSPF=function(e){var g={total_rows:0,nodes:[]};var f=jQuery("playlist trackList track",e);if(f.length>0){f.each(function(h){g.total_rows++;g.nodes.push({nid:g.total_rows,title:a(this).find("title").text(),description:a(this).find("annotation").text(),mediafiles:{image:{image:{path:a(this).find("image").text()}},media:{media:{path:a(this).find("location").text()}}}});});}return g;};this.parseASX=function(e){var g={total_rows:0,nodes:[]};var f=jQuery("asx entry",e);if(f.length>0){f.each(function(h){g.total_rows++;g.nodes.push({nid:g.total_rows,title:a(this).find("title").text(),mediafiles:{image:{image:{path:a(this).find("image").text()}},media:{media:{path:a(this).find("location").text()}}}});});}return g;};this.parseRSS=function(f){var h={total_rows:0,nodes:[]};var g=jQuery("rss channel",f);if(g.length>0){var e=(g.find("generator").text()=="YouTube data API");g.find("item").each(function(i){h.total_rows++;var j={};j=e?d.parseYouTubeItem(a(this)):d.parseRSSItem(a(this));j.nid=h.total_rows;h.nodes.push(j);});}return h;};this.parseRSSItem=function(e){return{title:e.find("title").text(),mediafiles:{image:{image:{path:e.find("image").text()}},media:{media:{path:e.find("location").text()}}}};};this.parseYouTubeItem=function(f){var e=f.find("description").text();var g=f.find("link").text().replace("&feature=youtube_gdata","");return{title:f.find("title").text(),mediafiles:{image:{image:{path:jQuery("img",e).eq(0).attr("src")}},media:{media:{path:g,player:"youtube"}}}};};})(b);}},jQuery.media);})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.player.js b/js/compressed/jquery.media.player.js deleted file mode 100644 index 8db0c5d8..00000000 --- a/js/compressed/jquery.media.player.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{protocol:"auto",server:"drupal",template:"default",baseURL:"",debug:false,draggable:false,resizable:false,showPlaylist:true,autoNext:true,prefix:"",zIndex:400,fluidWidth:false,fluidHeight:false,fullscreen:false});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{loading:"#mediaplayerloading",player:"#mediaplayer",menu:"#mediamenu",titleBar:"#mediatitlebar",node:"#medianode",playlist:"#mediaplaylist",control:"#mediacontrol"});jQuery.media.players={};jQuery.media.loadCallbacks={};jQuery.media.playlists={};jQuery.media.controllers={};jQuery.media.onLoaded=function(b,d){var c=jQuery.media.players[b];if(c&&c.display&&c.loaded){d(c);}else{if(!jQuery.media.loadCallbacks[b]){jQuery.media.loadCallbacks[b]=[];}jQuery.media.loadCallbacks[b].push(d);}};jQuery.media.addElement=function(d,f,c){if(f&&f[c]){var e=jQuery.media.players[d];if(e){switch(c){case"playlist":e.addPlaylist(f.playlist);break;case"controller":e.addController(f.controller);break;default:break;}}else{var b=c+"s";if(!jQuery.media[b][d]){jQuery.media[b][d]=[];}jQuery.media[b][d].push(f[c]);}}};jQuery.media.addController=function(b,c){jQuery.media.addElement(b,c,"controller");};jQuery.media.addPlaylist=function(b,c){jQuery.media.addElement(b,c,"playlist");};jQuery.fn.mediaplayer=function(b){if(this.length===0){return null;}return new (function(e,f){f=jQuery.media.utils.getSettings(f);if(!f.id){f.id=jQuery.media.utils.getId(e);}this.dialog=e;this.display=this.dialog.find(f.ids.player);var g=this;var c=[];jQuery.media.utils.checkVisibility(this.display,c);jQuery.media.players[f.id]=this;this.loaded=false;var d=0;f.template=jQuery.media.templates[f.template](this,f);if(f.template.getSettings){f=jQuery.extend(f,f.template.getSettings());}a(window).keyup(function(h){switch(h.keyCode){case 0:g.onSpaceBar();break;case 113:case 27:g.onEscKey();break;default:break;}});if(f.fluidWidth||f.fluidHeight){a(window).resize(function(){g.onResize();});}if(jQuery.media[f.protocol]){this.protocol=jQuery.media[f.protocol](f);}if(jQuery.media[f.server]){this.server=jQuery.media[f.server](this.protocol,f);}this.menu=this.dialog.find(f.ids.menu).mediamenu(this.server,f);if(this.menu){this.menu.display.unbind("menuclose").bind("menuclose",function(){g.showMenu(false);});}this.menuOn=false;this.maxOn=!f.showPlaylist;this.fullScreen=false;this.playlist=null;this.activePlaylist=null;this.controller=null;this.activeController=null;this.showMenu=function(h){if(f.template.onMenu){this.menuOn=h;f.template.onMenu(this.menuOn);}};this.onEscKey=function(){if(this.fullScreen){this.onFullScreen(false);}};this.onSpaceBar=function(){if(this.fullScreen&&this.node&&this.node.player){this.node.player.togglePlayPause();}};this.addPlayerEvents=function(h){h.display.unbind("menu").bind("menu",function(i){g.showMenu(!g.menuOn);});h.display.unbind("maximize").bind("maximize",function(i){g.maximize(!g.maxOn);});h.display.unbind("fullscreen").bind("fullscreen",function(i){g.onFullScreen(!g.fullScreen);});};this.onFullScreen=function(h){this.fullScreen=h;if(this.node&&this.node.player){this.node.player.fullScreen(this.fullScreen);this.onResize();if(window.webkitSupportsFullscreen&&window.webkitSupportsFullscreen()){if(h){window.webkitEnterFullscreen();}else{window.webkitExitFullscreen();}}}};this.titleBar=this.dialog.find(f.ids.titleBar).mediatitlebar(f);if(this.titleBar){this.addPlayerEvents(this.titleBar);if(f.draggable&&this.dialog.draggable){this.dialog.draggable({handle:f.ids.titleBar,containment:"document"});}if(f.resizable&&this.dialog.resizable){this.dialog.resizable({alsoResize:this.display,containment:"document",resize:function(h){g.onResize();}});}}this.node=this.dialog.find(f.ids.node).medianode(this.server,f);if(this.node){this.node.display.unbind("nodeload").bind("nodeload",function(h,i){g.onNodeLoad(i);});if(this.node.player&&this.node.player.media){this.node.player.media.display.unbind("mediaupdate").bind("mediaupdate",function(h,i){g.onMediaUpdate(i);});}if(this.node.uservoter){this.node.uservoter.display.unbind("voteSet").bind("voteSet",function(i,h){if(g.activePlaylist){g.activePlaylist.onVoteSet(h);}});}}this.onMediaUpdate=function(h){this.node.player.onMediaUpdate(h);if(f.autoNext&&this.activePlaylist&&(h.type=="complete")){this.activePlaylist.loadNext();}if(this.controller){this.controller.onMediaUpdate(h);}if(this.activeController){this.activeController.onMediaUpdate(h);}if(this.menu&&this.node&&(h.type=="meta")){this.menu.setEmbedCode(this.node.player.media.player.getEmbedCode());this.menu.setMediaLink(this.node.player.media.player.getMediaLink());}if(f.template&&f.template.onMediaUpdate){f.template.onMediaUpdate(h);}};this.onPlaylistLoad=function(h){if(this.node){if(this.node.player&&this.node.player.media){this.node.player.media.hasPlaylist=true;}this.node.loadNode(h);}if(f.template.onPlaylistLoad){f.template.onPlaylistLoad(h);}};this.onNodeLoad=function(h){if(f.template.onNodeLoad){f.template.onNodeLoad(h);}};this.maximize=function(h){if(!this.fullScreen){if(f.template.onMaximize&&(h!=this.maxOn)){this.maxOn=h;f.template.onMaximize(this.maxOn);}}};this.addPlaylist=function(h){if(h){h.display.unbind("playlistload").bind("playlistload",h,function(i,j){g.activePlaylist=i.data;g.onPlaylistLoad(j);});if(!this.activePlaylist&&h.activeTeaser){this.activePlaylist=h;this.onPlaylistLoad(h.activeTeaser.node.nodeInfo);}}return h;};this.searchForElement=function(h){for(var j in h){var i=new RegExp("^"+j+"(\\_[0-9]+)?$","i");if(f.id.search(i)===0){return h[j];}}return null;};this.playlist=this.addPlaylist(this.dialog.find(f.ids.playlist).mediaplaylist(this.server,f));this.addController=function(i,h){if(i){i.display.unbind("controlupdate").bind("controlupdate",i,function(j,k){g.activeController=j.data;if(g.node&&g.node.player){g.node.player.onControlUpdate(k);}});if(h&&!this.activeController){this.activeController=i;}this.addPlayerEvents(i);}return i;};this.controller=this.addController(this.dialog.find(f.ids.control).mediacontrol(f),false);if(this.controller&&this.node){this.node.addVoters(this.controller.display);}this.onResize=function(){if(f.template.onResize){f.template.onResize();}if(this.node){this.node.onResize();}if(this.controller){this.controller.onResize();}};this.showNativeControls=function(h){var i=this.node?this.node.player:null;if(i&&i.hasControls()){i.usePlayerControls=h;if(h){i.busy.hide();i.play.hide();if(i.preview){i.preview.display.hide();}if(this.controller){this.controller.display.hide();}}else{i.showBusy(1,((this.busyFlags&2)==2));i.showPlay(this.playVisible);i.showPreview(this.previewVisible);if(this.controller){this.controller.display.show();}}i.showControls(h);}};this.loadContent=function(){var j=this.searchForElement(jQuery.media.controllers);if(j){d=j.length;while(d){d--;this.addController(j[d],true);}}var h=this.searchForElement(jQuery.media.playlists);if(h){d=h.length;while(d){d--;this.addPlaylist(h[d]);}}var i=false;if(this.playlist){i=this.playlist.loadPlaylist();}if(!i&&this.node){if(this.node.player&&this.node.player.media){this.node.player.media.settings.repeat=(f.loop||f.repeat);}this.node.loadNode();}};this.initializeTemplate=function(){if(f.template.initialize){f.template.initialize(f);}jQuery.media.utils.resetVisibility(c);};this.load=function(){this.initializeTemplate();this.dialog.css("position","relative");this.dialog.css("marginLeft",0);this.dialog.css("overflow","visible");if(f.fullscreen){this.onFullScreen(true);}this.loaded=true;this.display.trigger("playerLoaded",this);if(jQuery.media.loadCallbacks[f.id]){var j=jQuery.media.loadCallbacks[f.id];var h=j.length;while(h){h--;j[h](this);}}this.server.connect(function(i){g.loadContent();});};this.load();})(this,b);};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.playlist.js b/js/compressed/jquery.media.playlist.js deleted file mode 100644 index 610bddff..00000000 --- a/js/compressed/jquery.media.playlist.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{playlist:"",args:[],wildcard:"*"});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{pager:"#mediapager",scroll:"#mediascroll",busy:"#mediabusy",links:"#medialinks"});jQuery.fn.mediaplaylist=function(c,b){if(this.length===0){return null;}return new (function(e,f,d){d=jQuery.media.utils.getSettings(d);this.display=f;var g=this;this.teasers=[];this.selectedTeaser=null;this.activeTeaser=null;this.args=d.args;this.setActive=true;this.activePager=null;this.pager=null;this.parser=jQuery.media.parser(d);this.scrollRegion=f.find(d.ids.scroll).mediascroll(d);this.scrollRegion.clear();this.busy=f.find(d.ids.busy);this.busyVisible=false;this.busyImg=this.busy.find("img");this.busyWidth=this.busyImg.width();this.busyHeight=this.busyImg.height();this.links=f.find(d.ids.links).medialinks(d);this.links.loadLinks();this.loading=function(h){if(this.pager){this.pager.enabled=!h;}if(this.activePager){this.activePager.enabled=!h;}if(h){this.busyVisible=true;this.busy.show();}else{this.busyVisible=false;this.busy.hide();}};this.addPager=function(h,i){if(h){h.display.unbind("loadindex").bind("loadindex",function(j,k){if(k.active){g.activateTeaser(g.teasers[k.index]);}else{g.selectTeaser(g.teasers[k.index]);}});h.display.unbind("loadpage").bind("loadpage",function(j,k){g.setActive=k.active;g.loadPlaylist({pageIndex:k.index});});if(i&&!this.activePager){this.activePager=h;}}return h;};this.pager=this.addPager(f.find(d.ids.pager).mediapager(d),false);this.links.display.unbind("linkclick").bind("linkclick",function(i,h){g.onLinkClick(h);});this.onLinkClick=function(k){var i=k.index;var j=k.playlist;var h=[];h[i]=k.arg;if(this.pager){this.pager.reset();}if(this.activePager){this.activePager.reset();}this.loadPlaylist({playlist:j,args:h});};this.loadNext=function(){if(this.pager){this.pager.loadNext(true);}else{if(this.activePager){this.activePager.loadNext(true);}}};this.loadPlaylist=function(h){var j={playlist:d.playlist,pageLimit:d.pageLimit,pageIndex:(this.pager?this.pager.activePage:0),args:{}};var i=jQuery.extend({},j,h);this.setArgs(i.args);this.loading(true);if(i.playlist){if(((typeof i.playlist)=="object")){d.playlist=i.playlist.name;this.setPlaylist(i.playlist);}else{if(i.playlist.match(/^http[s]?\:\/\/|\.xml$/i)){this.parser.parseFile(i.playlist,function(k){g.setPlaylist(k);});}else{if(e){e.call(jQuery.media.commands.getPlaylist,function(k){g.setPlaylist(k);},null,i.playlist,i.pageLimit,i.pageIndex,this.args);}}}return true;}return false;};this.setPlaylist=function(k){if(k&&k.nodes){var h=[];jQuery.media.utils.checkVisibility(this.display,h);if(this.pager){this.pager.setTotalItems(k.total_rows);}if(this.activePager){this.activePager.setTotalItems(k.total_rows);}this.scrollRegion.clear();this.resetTeasers();var j=k.nodes.length;for(var i=0;i
").mediaimage(null,true);this.display.append(g.display);if((d.rotatorTransition=="hscroll")||(d.rotatorTransition=="vscroll")){g.display.css({"float":"left"});}else{g.display.css({position:"absolute",zIndex:(200-this.images.length),top:0,left:0});}return g;};this.loadImages=function(g){this.images=[];this.imageIndex=0;jQuery.each(g,function(h){var i=f.addImage();if(h===0){i.display.unbind("imageLoaded").bind("imageLoaded",function(){f.onImageLoaded();}).show();}i.loadImage(this);f.images.push(i);});if(d.rotatorHover){this.display.unbind("mouseenter").bind("mouseenter",function(){f.startRotator();}).unbind("mouseleave").bind("mouseleave",function(){clearInterval(f.imageInterval);});}else{this.startRotator();}};this.startRotator=function(){clearInterval(this.imageInterval);this.imageInterval=setInterval(function(){f.showNextImage();},d.rotatorTimeout);};this.showNextImage=function(){this.hideImage(this.images[this.imageIndex].display);this.imageIndex=(this.imageIndex+1)%this.images.length;this.showImage(this.images[this.imageIndex].display);};this.showImage=function(g){if(d.rotatorTransition==="fade"){g.fadeIn(d.rotatorSpeed);}else{g.css({marginLeft:0,marginTop:0}).show();}};this.hideImage=function(g){switch(d.rotatorTransition){case"fade":g.fadeOut(d.rotatorSpeed);break;case"hscroll":g.animate({marginLeft:-this.width},d.rotatorSpeed,d.rotatorEasing,function(){g.css({marginLeft:0}).remove();f.display.append(g);});break;case"vscroll":g.animate({marginTop:-this.height},d.rotatorSpeed,d.rotatorEasing,function(){g.css({marginTop:0}).remove();f.display.append(g);});break;default:g.hide();break;}};var c=[];e.find("img").each(function(){c.push(a(this).attr("src"));});e.empty().css("overflow","hidden").append(a('
'));this.display=e.find(".imagerotatorinner");if(c.length){this.loadImages(c);}})(this,b);};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.rpc.js b/js/compressed/jquery.media.rpc.js deleted file mode 100644 index 13e4fbfc..00000000 --- a/js/compressed/jquery.media.rpc.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{gateway:""});jQuery.media=jQuery.extend({},{rpc:function(b){return new (function(c){c=jQuery.media.utils.getSettings(c);var d=this;this.parseObject=function(h){var e="";if(h instanceof Date){e="";e+=h.getFullYear();e+=h.getMonth();e+=h.getDate();e+="T";e+=h.getHours()+":";e+=h.getMinutes()+":";e+=h.getSeconds();e+="";}else{if(h instanceof Array){e="\n";for(var g=0;g"+this.serializeToXML(h[g])+"\n";}e+="";}else{e="\n";for(var f in h){if(h.hasOwnProperty(f)){e+=" "+f+"";e+=this.serializeToXML(h[f])+"\n";}}e+="";}}return e;};this.serializeToXML=function(f){switch(typeof f){case"boolean":return""+((f)?"1":"0")+"";case"number":var e=parseInt(f,10);if(e==f){return""+f+"";}return""+f+"";case"string":return""+f+"";case"object":return this.parseObject(f);default:break;}return"";};this.parseXMLValue=function(f){var m=jQuery(f).children();var k=m.length;var n=function(i){return function(){i.push(d.parseXMLValue(this));};};var l=function(i){return function(){i[jQuery("> name",this).text()]=d.parseXMLValue(jQuery("value",this));};};for(var h=0;h data > value",j).each(n(e));return e;case"struct":var g={};jQuery("> member",j).each(l(g));return g;case"dateTime.iso8601":return NULL;default:break;}}return null;};this.parseXML=function(f){var e={};e.version="1.0";jQuery("methodResponse params param > value",f).each(function(g){e.result=d.parseXMLValue(this);});jQuery("methodResponse fault > value",f).each(function(g){e.error=d.parseXMLValue(this);});return e;};this.xmlRPC=function(j,h){var e='';e+="";e+=""+j+"";if(h.length>0){e+="";var g=h.length;for(var f=0;f"+this.serializeToXML(h[f])+"";}}e+="";}e+="";return e;};this.call=function(i,h,e,g,f){if(c.gateway){jQuery.ajax({url:c.gateway,dataType:"xml",type:"POST",data:this.xmlRPC(i,g),error:function(j,l,k){if(e){e(l);}else{if(window.console&&console.log){console.log("Error: "+l);}}},success:function(k){var j=d.parseXML(k);if(j.error){if(e){e(j.error);}else{if(window.console&&console.dir){console.dir(j.error);}}}else{if(h){h(j.result);}}},processData:false,contentType:"text/xml"});}else{if(h){h(null);}}};})(b);}},jQuery.media);})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.scroll.js b/js/compressed/jquery.media.scroll.js deleted file mode 100644 index 572cf33e..00000000 --- a/js/compressed/jquery.media.scroll.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{vertical:true,scrollSpeed:20,updateTimeout:40,hysteresis:40,showScrollbar:true,scrollMode:"auto"});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{listMask:"#medialistmask",list:"#medialist",scrollWrapper:"#mediascrollbarwrapper",scrollBar:"#mediascrollbar",scrollTrack:"#mediascrolltrack",scrollHandle:"#mediascrollhandle",scrollUp:"#mediascrollup",scrollDown:"#mediascrolldown"});jQuery.fn.mediascroll=function(b){return new (function(c,e){e=jQuery.media.utils.getSettings(e);this.display=c;var f=this;this.spanMode=(e.scrollMode=="span");this.listMask=c.find(e.ids.listMask);if(this.spanMode||(e.scrollMode=="auto")){this.listMask.unbind("mouseenter").bind("mouseenter",function(g){f.onMouseOver(g);});this.listMask.unbind("mouseleave").bind("mouseleave",function(g){f.onMouseOut(g);});this.listMask.unbind("mousemove").bind("mousemove",function(g){f.onMouseMove(g);});}else{if(e.scrollMode=="mouse"){this.display.bind("mousewheel",function(i,j,h,g){i.preventDefault();f.onMouseScroll(h,g);});}}this.listMask.css("overflow","hidden");this.list=c.find(e.ids.list);var d=this.list.children().eq(0);this.elementWidth=d.width();this.elementHeight=d.height();this.elementSize=e.vertical?d.outerHeight(true):d.outerWidth(true);if(jQuery.browser.msie&&parseInt(jQuery.fn.jquery.replace(".",""),10)<132){this.template=a("
").append(jQuery.media.utils.cloneFix(d)).html();}else{this.template=a("
").append(d.clone()).html();}this.list.empty();this.pagePos=e.vertical?"pageY":"pageX";this.margin=e.vertical?"marginTop":"marginLeft";this.scrollSize=e.vertical?0:this.listMask.width();this.scrollMid=0;this.mousePos=0;this.listPos=0;this.scrollInterval=0;this.shouldScroll=false;this.bottomPos=0;this.ratio=0;this.elements=[];this.listSize=0;this.scrollBar=c.find(e.ids.scrollTrack).mediaslider(e.ids.scrollHandle,e.vertical);this.scrollUp=c.find(e.ids.scrollUp).medialink(e,function(){f.scroll(true);});this.scrollDown=c.find(e.ids.scrollDown).medialink(e,function(){f.scroll(false);});if(this.scrollBar){this.scrollBar.display.unbind("updatevalue").bind("updatevalue",function(g,h){f.setScrollPos(h*f.bottomPos,false);});this.scrollBar.display.unbind("setvalue").bind("setvalue",function(g,h){f.setScrollPos(h*f.bottomPos,true);});this.scrollBar.display.bind("mousewheel",function(i,j,h,g){i.preventDefault();f.onMouseScroll(h,g);});}this.setScrollSize=function(g){if(g){this.scrollSize=g;this.scrollMid=this.scrollSize/2;var h=this.scrollSize-(e.hysteresis*2);this.bottomPos=(this.listSize-this.scrollSize);this.ratio=((this.listSize-h)/h);this.shouldScroll=(this.bottomPos>0);}};this.clear=function(){this.mousePos=0;this.shouldScroll=false;this.bottomPos=0;this.ratio=0;this.scrolling=false;this.elements=[];this.listSize=0;this.list.css(this.margin,0);this.list.children().unbind();clearInterval(this.scrollInterval);this.list.empty();};this.getOffset=function(){return e.vertical?this.listMask.offset().top:this.listMask.offset().left;};this.activate=function(){this.setScrollSize(e.vertical?this.listMask.height():this.listMask.width());this.setScrollPos(0,true);};this.newItem=function(){var h=a(this.template);this.list.append(h);var g=this.getElement(h,this.elements.length);this.listSize+=g.size;if(e.vertical){this.list.css({height:this.listSize});}else{this.list.css({width:this.listSize});}this.elements.push(g);return g.obj;};this.getElement=function(i,g){var h=this.elementSize;var j=this.listSize;return{obj:i,size:h,position:j,bottom:(j+h),mid:(h/2),index:g};};this.scroll=function(g){var h=this.getElementAtPosition(g?0:this.scrollSize);if(h){var j=(h.straddle||g)?h:this.elements[h.index+1];if(j){var i=g?j.position:(j.bottom-this.scrollSize);this.setScrollPos(i,true);}}};this.onMouseScroll=function(h,g){var i=e.vertical?-g:h;this.setScrollPos(this.listPos+(e.scrollSpeed*i));};this.onMouseMove=function(g){this.mousePos=g[this.pagePos]-this.getOffset();if(this.shouldScroll&&this.spanMode){this.setScrollPos((this.mousePos-e.hysteresis)*this.ratio);}};this.onMouseOver=function(g){if(this.shouldScroll){clearInterval(this.scrollInterval);this.scrollInterval=setInterval(function(){f.update();},e.updateTimeout);}};this.onMouseOut=function(g){clearInterval(this.scrollInterval);};this.align=function(g){var h=this.getElementAtPosition(g?0:this.scrollSize);if(h){var i=g?h.position:(h.bottom-this.scrollSize);this.setScrollPos(i,true);}};this.setVisible=function(g){var i=this.elements[g];if(i){var h=this.listPos;if(i.positionthis.scrollSize){h=i.bottom-this.scrollSize;}}if(h!=this.listPos){this.setScrollPos(h,true);}}};this.getElementAtPosition=function(g){var j=null;var h=this.elements.length;while(h--){j=this.elements[h];if(((j.position-this.listPos)=g)){j.straddle=((j.bottom-this.listPos)!=g);break;}}return j;};this.update=function(){var h=this.mousePos-this.scrollMid;if(Math.abs(h)>e.hysteresis){var g=(h>0)?-e.hysteresis:e.hysteresis;h=e.scrollSpeed*((this.mousePos+g-this.scrollMid)/this.scrollMid);this.setScrollPos(this.listPos+h);}};this.setScrollPos=function(i,h){i=(i<0)?0:i;if(this.shouldScroll&&(i>this.bottomPos)){i=this.bottomPos;}this.listPos=i;if(this.scrollBar){var g=this.bottomPos?(this.listPos/this.bottomPos):0;this.scrollBar.setPosition(g);}if(h){if(e.vertical){this.list.animate({marginTop:-this.listPos},(e.scrollSpeed*10));}else{this.list.animate({marginLeft:-this.listPos},(e.scrollSpeed*10));}}else{this.list.css(this.margin,-this.listPos);}};})(this,b);};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.sha256.js b/js/compressed/jquery.media.sha256.js deleted file mode 100644 index dfdebfc1..00000000 --- a/js/compressed/jquery.media.sha256.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.extend({},{sha256:function(){function b(T,S){b.charSize=8;b.b64pad="";b.hexCase=0;var Q=null;var H=null;var x=function(p){var o=[];var s=(1<>5]|=(p.charCodeAt(q/b.charSize)&s)<<(32-b.charSize-q%32);}return o;};var n=function(p){var o=[];var s=p.length;for(var q=0;q>3]|=r<<(24-(4*(q%8)));}else{return"INVALID HEX STRING";}}return o;};var l=null;var j=null;if("HEX"===S){if(0!==(T.length%2)){return"TEXT MUST BE IN BYTE INCREMENTS";}l=T.length*4;j=n(T);}else{if(("ASCII"===S)||("undefined"===typeof(S))){l=T.length*b.charSize;j=x(T);}else{return"UNKNOWN TEXT INPUT TYPE";}}var R=function(p){var o=b.hexCase?"0123456789ABCDEF":"0123456789abcdef";var s="";var r=p.length*4;for(var q=0;q>2]>>((3-q%4)*8+4))&15)+o.charAt((p[q>>2]>>((3-q%4)*8))&15);}return s;};var K=function(p){var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var v="";var u=p.length*4;for(var r=0;r>2]>>8*(3-r%4))&255)<<16)|(((p[r+1>>2]>>8*(3-(r+1)%4))&255)<<8)|((p[r+2>>2]>>8*(3-(r+2)%4))&255);for(var q=0;q<4;q++){if(r*8+q*6>p.length*32){v+=b.b64pad;}else{v+=o.charAt((s>>6*(3-q))&63);}}}return v;};var z=function(o,p){if(p<32){return(o>>>p)|(o<<(32-p));}else{return o;}};var y=function(o,p){if(p<32){return o>>>p;}else{return 0;}};var t=function(o,q,p){return(o&q)^(~o&p);};var m=function(o,q,p){return(o&q)^(o&p)^(q&p);};var k=function(o){return z(o,2)^z(o,13)^z(o,22);};var i=function(o){return z(o,6)^z(o,11)^z(o,25);};var h=function(o){return z(o,7)^z(o,18)^y(o,3);};var g=function(o){return z(o,17)^z(o,19)^y(o,10);};var f=function(p,r){var q=(p&65535)+(r&65535);var o=(p>>>16)+(r>>>16)+(q>>>16);return((o&65535)<<16)|(q&65535);};var e=function(p,o,u,s){var r=(p&65535)+(o&65535)+(u&65535)+(s&65535);var q=(p>>>16)+(o>>>16)+(u>>>16)+(s>>>16)+(r>>>16);return((q&65535)<<16)|(r&65535);};var d=function(p,o,v,u,s){var r=(p&65535)+(o&65535)+(v&65535)+(u&65535)+(s&65535);var q=(p>>>16)+(o>>>16)+(v>>>16)+(u>>>16)+(s>>>16)+(r>>>16);return((q&65535)<<16)|(r&65535);};var c=function(B,A,w){var o=[];var M,L,J,I,G,F,E,D;var v,s;var q;var p=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];if(w==="SHA-224"){q=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428];}else{q=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];}B[A>>5]|=128<<(24-A%32);B[((A+1+64>>9)<<4)+15]=A;var u=B.length;for(var C=0;Cp){v[15]&=4294967040;}}for(var r=0;r<=15;r++){u[r]=v[r]^909522486;s[r]=v[r]^1549556828;}q=c(u.concat(j),512+l,B);q=c(s.concat(q),512+o,B);return(w(q));};}this.encrypt=function(e,c){var d=new b(c,"ASCII");return d.getHMAC(e,"ASCII","SHA-256","HEX");};}},jQuery.media);})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.slider.js b/js/compressed/jquery.media.slider.js deleted file mode 100644 index d5dfcdb4..00000000 --- a/js/compressed/jquery.media.slider.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.fn.mediaslider=function(b,d,c){if(this.length===0){return null;}return new (function(h,e,g,f){var i=this;this.display=h.css({cursor:"pointer"});this.dragging=false;this.value=0;this.handle=this.display.find(e);this.pagePos=g?"pageY":"pageX";this.handlePos=0;if(this.handle.length>0){this.handleSize=g?this.handle.height():this.handle.width();this.handleMid=(this.handleSize/2);}this.onResize=function(){this.setTrackSize();this.updateValue(this.value);};this.setTrackSize=function(){this.trackSize=g?this.display.height():this.display.width();this.trackSize-=this.handleSize;this.trackSize=(this.trackSize>0)?this.trackSize:1;};this.setValue=function(j){this.setPosition(j);this.display.trigger("setvalue",this.value);};this.updateValue=function(j){this.setPosition(j);this.display.trigger("updatevalue",this.value);};this.setPosition=function(j){j=(j<0)?0:j;j=(j>1)?1:j;this.value=j;this.handlePos=f?(1-this.value):this.value;this.handlePos*=this.trackSize;this.handle.css((g?"marginTop":"marginLeft"),this.handlePos);};this.display.unbind("mousedown").bind("mousedown",function(j){j.preventDefault();i.dragging=true;});this.getOffset=function(){var j=g?this.display.offset().top:this.display.offset().left;return(j+(this.handleSize/2));};this.getPosition=function(j){var k=(j-this.getOffset())/this.trackSize;k=(k<0)?0:k;k=(k>1)?1:k;k=f?(1-k):k;return k;};this.display.unbind("mousemove").bind("mousemove",function(j){j.preventDefault();if(i.dragging){i.updateValue(i.getPosition(j[i.pagePos]));}});this.display.unbind("mouseleave").bind("mouseleave",function(j){j.preventDefault();if(i.dragging){i.dragging=false;i.setValue(i.getPosition(j[i.pagePos]));}});this.display.unbind("mouseup").bind("mouseup",function(j){j.preventDefault();if(i.dragging){i.dragging=false;i.setValue(i.getPosition(j[i.pagePos]));}});this.onResize();})(this,b,d,c);};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.teaser.js b/js/compressed/jquery.media.teaser.js deleted file mode 100644 index 41bd591e..00000000 --- a/js/compressed/jquery.media.teaser.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{pageLink:false});jQuery.fn.mediateaser=function(d,b,e,c){if(this.length===0){return null;}return new (function(j,g,k,f,h){h=jQuery.media.utils.getSettings(h);var l=this;this.display=f;this.display.unbind("mouseenter").bind("mouseenter",function(m){if(h.template.onTeaserOver){h.template.onTeaserOver(l);}});this.display.unbind("mouseleave").bind("mouseleave",function(m){if(h.template.onTeaserOut){h.template.onTeaserOut(l);}});this.index=k;this.node=this.display.medianode(j,h);if(this.node){this.node.loadNode(g);}if(this.node&&h.pageLink){var i=h.baseURL;i+=g.path?g.path:("node/"+g.nid);this.node.display.wrap('');}this.reset=function(){if(this.node){this.node.display.unbind();}};this.setActive=function(m){if(h.template.onTeaserActivate){h.template.onTeaserActivate(this,m);}};this.setSelected=function(m){if(h.template.onTeaserSelect){h.template.onTeaserSelect(this,m);}};if(h.template.onTeaserLoad){h.template.onTeaserLoad(this);}})(d,b,e,this,c);};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.titlebar.js b/js/compressed/jquery.media.titlebar.js deleted file mode 100644 index 1880d30c..00000000 --- a/js/compressed/jquery.media.titlebar.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media.ids=jQuery.extend(jQuery.media.ids,{titleLinks:"#mediatitlelinks"});jQuery.fn.mediatitlebar=function(b){if(this.length===0){return null;}return new (function(c,d){var e=this;this.display=c;this.titleLinks=this.display.find(d.ids.titleLinks);this.display.find("a").each(function(){var f=a(this).attr("href");a(this).medialink(d,function(g){g.preventDefault();e.display.trigger(g.data.id);},{id:f.substr(1),obj:a(this)});});})(this,b);};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.utils.js b/js/compressed/jquery.media.utils.js deleted file mode 100644 index 4ffa65ad..00000000 --- a/js/compressed/jquery.media.utils.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.extend({},{utils:{getBaseURL:function(){var b=new RegExp(/^(http[s]?\:[\\\/][\\\/])([^\\\/\?]+)/);var c=b.exec(location.href);return c?c[0]:"";},timer:{},stopElementHide:{},showThenHide:function(b,f,c,d,e){if(b){b.show(c);if(jQuery.media.utils.timer.hasOwnProperty(f)){clearTimeout(jQuery.media.utils.timer[f]);}jQuery.media.utils.timer[f]=setTimeout(function(){if(!jQuery.media.utils.stopElementHide[f]){b.hide(d,function(){if(jQuery.media.utils.stopElementHide[f]){b.show();}if(e){e();}});}},5000);}},stopHide:function(b,c){jQuery.media.utils.stopElementHide[c]=true;clearTimeout(jQuery.media.utils.timer[c]);},stopHideOnOver:function(b,c){if(b){jQuery.media.utils.stopElementHide[c]=false;b.unbind("mouseover").bind("mouseover",{id:c},function(d){jQuery.media.utils.stopElementHide[d.data.id]=true;}).unbind("mouseout").bind("mouseout",{id:c},function(d){jQuery.media.utils.stopElementHide[d.data.id]=false;});}},getSettings:function(b){if(!b){b={};}if(!b.initialized){b=jQuery.extend({},jQuery.media.defaults,b);b.ids=jQuery.extend({},jQuery.media.ids,b.ids);b.baseURL=b.baseURL?b.baseURL:jQuery.media.utils.getBaseURL();b.baseURL+=b.baseURL?"/":"";b.initialized=true;}return b;},getId:function(b){return b.attr("id")?b.attr("id"):b.attr("class")?b.attr("class"):"mediaplayer";},getScaledRect:function(b,e){var d={};d.x=e.x?e.x:0;d.y=e.y?e.y:0;d.width=e.width?e.width:0;d.height=e.height?e.height:0;if(b){var c=(e.width/e.height);d.height=(c>b)?e.height:Math.floor(e.width/b);d.width=(c>b)?Math.floor(e.height*b):e.width;d.x=Math.floor((e.width-d.width)/2);d.y=Math.floor((e.height-d.height)/2);}return d;},checkVisibility:function(d,c){var b=true;d.parents().each(function(){var e=jQuery(this);if(!e.is(":visible")){b=false;var f=e.attr("class");c.push({obj:e,attr:f});e.removeClass(f);}});},resetVisibility:function(b){var c=b.length;while(c){c--;b[c].obj.addClass(b[c].attr);}},getFlash:function(h,b,c,i,e,d){var j=window.location.protocol;if(j.charAt(j.length-1)==":"){j=j.substring(0,j.length-1);}var g=jQuery.param(e);var f=' ';f+='';f+='';f+='';f+='';f+='';f+='';f+='';f+="";return f;},removeFlash:function(c,d){if(typeof(swfobject)!="undefined"){swfobject.removeSWF(d);}else{var b=c.find("object").eq(0)[0];if(b){b.parentNode.removeChild(b);}}},insertFlash:function(h,k,c,d,l,f,e,j){jQuery.media.utils.removeFlash(h,c);h.children().remove();h.append('

Get Adobe Flash player

');if(typeof(swfobject)!="undefined"){var g={allowScriptAccess:"always",allowfullscreen:"true",wmode:e,quality:"high"};swfobject.embedSWF(k,c,d,l,"9.0.0","expressInstall.swf",f,g,{},function(m){j(m.ref);});}else{var i=jQuery.media.utils.getFlash(k,c,d,l,f,e);var b=h.find("#"+c).eq(0);if(jQuery.browser.msie){b[0].outerHTML=i;j(h.find("object").eq(0)[0]);}else{b.replaceWith(i);j(h.find("embed").eq(0)[0]);}}},cloneFix:function(e,d){var b=e.map(function(){var g=this.outerHTML;if(!g){var h=this.ownerDocument.createElement("div");h.appendChild(this.cloneNode(true));g=h.innerHTML;}return jQuery.clean([g.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0];});if(d===true){var f=e.find("*").andSelf(),c=0;b.find("*").andSelf().each(function(){if(this.nodeName!==f[c].nodeName){return;}var g=jQuery.data(f[c],"events");for(var i in g){if(g.hasOwnProperty(i)){for(var h in g[i]){if(g[i].hasOwnProperty(h)){jQuery.event.add(this,i,g[i][h],g[i][h].data);}}}}c++;});}return b;}}},jQuery.media);})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.vimeo.js b/js/compressed/jquery.media.vimeo.js deleted file mode 100644 index f0819ccc..00000000 --- a/js/compressed/jquery.media.vimeo.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};window.onVimeoReady=function(b){b=b.replace(/\_media$/,"");jQuery.media.players[b].node.player.media.player.onReady();};window.onVimeoFinish=function(b){b=b.replace(/\_media$/,"");jQuery.media.players[b].node.player.media.player.onFinished();};window.onVimeoLoading=function(c,b){b=b.replace(/\_media$/,"");jQuery.media.players[b].node.player.media.player.onLoading(c);};window.onVimeoPlay=function(b){b=b.replace(/\_media$/,"");jQuery.media.players[b].node.player.media.player.onPlaying();};window.onVimeoPause=function(b){b=b.replace(/\_media$/,"");jQuery.media.players[b].node.player.media.player.onPaused();};window.onVimeoProgress=function(c,b){b=b.replace(/\_media$/,"");jQuery.media.players[b].node.player.media.player.onProgress(c);};jQuery.media.playerTypes=jQuery.extend(jQuery.media.playerTypes,{vimeo:function(b){return(b.search(/^http(s)?\:\/\/(www\.)?vimeo\.com/i)===0);}});jQuery.fn.mediavimeo=function(c,b){return new (function(f,e,d){this.display=f;var g=this;this.player=null;this.videoFile=null;this.ready=false;this.bytesLoaded=0;this.bytesTotal=0;this.currentVolume=1;this.createMedia=function(j,l){this.videoFile=j;this.ready=false;var i=(e.id+"_media");var h={clip_id:this.getId(j.path),width:"100%",height:"100%",js_api:"1",js_onLoad:"onVimeoReady",js_swf_id:i};var k=Math.floor(Math.random()*1000000);var m="http://vimeo.com/moogaloop.swf?rand="+k;jQuery.media.utils.insertFlash(this.display,m,i,"100%","100%",h,e.wmode,function(n){g.player=n;g.loadPlayer();});};this.getId=function(i){var h=/^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i;return(i.search(h)===0)?i.replace(h,"$3"):i;};this.loadMedia=function(h){this.bytesLoaded=0;this.bytesTotal=0;this.createMedia(h);};this.onReady=function(){this.ready=true;this.loadPlayer();};this.loadPlayer=function(){if(this.ready&&this.player&&this.player.api_addEventListener){this.player.api_addEventListener("onProgress","onVimeoProgress");this.player.api_addEventListener("onFinish","onVimeoFinish");this.player.api_addEventListener("onLoading","onVimeoLoading");this.player.api_addEventListener("onPlay","onVimeoPlay");this.player.api_addEventListener("onPause","onVimeoPause");d({type:"playerready"});this.playMedia();}};this.onFinished=function(){d({type:"complete"});};this.onLoading=function(h){this.bytesLoaded=h.bytesLoaded;this.bytesTotal=h.bytesTotal;};this.onPlaying=function(){d({type:"playing",busy:"hide"});};this.onPaused=function(){d({type:"paused",busy:"hide"});};this.playMedia=function(){d({type:"playing",busy:"hide"});if(this.player.api_play){this.player.api_play();}};this.onProgress=function(h){d({type:"progress"});};this.pauseMedia=function(){d({type:"paused",busy:"hide"});if(this.player.api_pause){this.player.api_pause();}};this.stopMedia=function(){this.pauseMedia();if(this.player.api_unload){this.player.api_unload();}};this.destroy=function(){this.stopMedia();jQuery.media.utils.removeFlash(this.display,(e.id+"_media"));this.display.children().remove();};this.seekMedia=function(h){if(this.player.api_seekTo){this.player.api_seekTo(h);}};this.setVolume=function(h){this.currentVolume=h;if(this.player.api_setVolume){this.player.api_setVolume((h*100));}};this.getVolume=function(){return this.currentVolume;};this.getDuration=function(){return this.player.api_getDuration?this.player.api_getDuration():0;};this.getCurrentTime=function(){return this.player.api_getCurrentTime?this.player.api_getCurrentTime():0;};this.getBytesLoaded=function(){return this.bytesLoaded;};this.getBytesTotal=function(){return this.bytesTotal;};this.setQuality=function(h){};this.getQuality=function(){return"";};this.hasControls=function(){return true;};this.showControls=function(h){};this.getEmbedCode=function(){return"This video cannot be embedded.";};this.getMediaLink=function(){return"This video currently does not have a link.";};})(this,c,b);};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.voter.js b/js/compressed/jquery.media.voter.js deleted file mode 100644 index 0d57cd41..00000000 --- a/js/compressed/jquery.media.voter.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.fn.mediavoter=function(b,d,c){if(this.length===0){return null;}return new (function(f,e,h,g){this.display=f;var i=this;this.nodeId=0;this.votes=[];this.tag=this.display.attr("tag");this.display.find("div").each(function(){if(g){a(this).css("cursor","pointer");a(this).unbind("click").bind("click",function(j){i.setVote(parseInt(a(this).attr("vote"),10));});a(this).unbind("mouseenter").bind("mouseenter",function(j){i.updateVote({value:parseInt(a(this).attr("vote"),10)},true);});}i.votes.push({vote:parseInt(a(this).attr("vote"),10),display:a(this)});});this.votes.sort(function(k,j){return(k.vote-j.vote);});if(g){this.display.unbind("mouseleave").bind("mouseleave",function(j){i.updateVote({value:0},true);});}this.updateVote=function(j,k){if(j&&e.template.updateVote){e.template.updateVote(this,j.value,k);}};this.getVote=function(k){if(k&&k.nid){this.nodeId=parseInt(k.nid,10);if(k.vote){var j=g?k.vote.uservote:k.vote.vote;this.updateVote(k.vote.vote,false);this.display.trigger("voteGet",j);}else{if(h&&k.nid&&(this.display.length>0)){this.display.trigger("processing");var l=g?jQuery.media.commands.getUserVote:jQuery.media.commands.getVote;h.call(l,function(m){i.updateVote(m,false);i.display.trigger("voteGet",m);},null,"node",this.nodeId,this.tag);}}}};this.setVote=function(j){if(h&&this.nodeId){this.display.trigger("processing");this.updateVote({value:j},false);h.call(jQuery.media.commands.setVote,function(k){i.display.trigger("voteSet",k);},null,"node",this.nodeId,j,this.tag);}};this.deleteVote=function(){if(h&&this.nodeId){this.display.trigger("processing");h.call(jQuery.media.commands.deleteVote,function(j){i.updateVote(j,false);i.display.trigger("voteDelete",j);},null,"node",this.nodeId,this.tag);}};})(this,b,d,c);};})(jQuery); \ No newline at end of file diff --git a/js/compressed/jquery.media.youtube.js b/js/compressed/jquery.media.youtube.js deleted file mode 100644 index b7e2fe08..00000000 --- a/js/compressed/jquery.media.youtube.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};window.onYouTubePlayerReady=function(b){b=b.replace(/\_media$/,"");jQuery.media.players[b].node.player.media.player.onReady();};jQuery.media.playerTypes=jQuery.extend(jQuery.media.playerTypes,{youtube:function(b){return(b.search(/^http(s)?\:\/\/(www\.)?youtube\.com/i)===0);}});jQuery.fn.mediayoutube=function(c,b){return new (function(f,e,d){this.display=f;var g=this;this.player=null;this.videoFile=null;this.loaded=false;this.ready=false;this.qualities=[];this.createMedia=function(i,k){this.videoFile=i;this.ready=false;var h=(e.id+"_media");var j=Math.floor(Math.random()*1000000);var l="http://www.youtube.com/apiplayer?rand="+j+"&version=3&enablejsapi=1&playerapiid="+h;jQuery.media.utils.insertFlash(this.display,l,h,"100%","100%",{},e.wmode,function(m){g.player=m;g.loadPlayer();});};this.getId=function(i){var h=/^http[s]?\:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9]+)/i;return(i.search(h)===0)?i.replace(h,"$2"):i;};this.loadMedia=function(h){if(this.player){this.loaded=false;this.videoFile=h;d({type:"playerready"});if(this.player.loadVideoById){this.player.loadVideoById(this.getId(this.videoFile.path),0,e.quality);}}};this.onReady=function(){this.ready=true;this.loadPlayer();};this.loadPlayer=function(){if(this.ready&&this.player){window[e.id+"StateChange"]=function(h){g.onStateChange(h);};window[e.id+"PlayerError"]=function(h){g.onError(h);};window[e.id+"QualityChange"]=function(h){g.quality=h;};if(this.player.addEventListener){this.player.addEventListener("onStateChange",e.id+"StateChange");this.player.addEventListener("onError",e.id+"PlayerError");this.player.addEventListener("onPlaybackQualityChange",e.id+"QualityChange");}if(this.player.getAvailableQualityLevels){this.qualities=this.player.getAvailableQualityLevels();}d({type:"playerready"});if(this.player.loadVideoById){this.player.loadVideoById(this.getId(this.videoFile.path),0);}}};this.onStateChange=function(i){var h=this.getPlayerState(i);d({type:h.state,busy:h.busy});if(!this.loaded&&h=="playing"){this.loaded=true;d({type:"meta"});}};this.onError=function(i){var h="An unknown error has occured: "+i;if(i==100){h="The requested video was not found. ";h+="This occurs when a video has been removed (for any reason), ";h+="or it has been marked as private.";}else{if((i==101)||(i==150)){h="The video requested does not allow playback in an embedded player.";}}if(window.console&&console.log){console.log(h);}d({type:"error",data:h});};this.getPlayerState=function(h){switch(h){case 5:return{state:"ready",busy:false};case 3:return{state:"buffering",busy:"show"};case 2:return{state:"paused",busy:"hide"};case 1:return{state:"playing",busy:"hide"};case 0:return{state:"complete",busy:false};case -1:return{state:"stopped",busy:false};default:return{state:"unknown",busy:false};}return"unknown";};this.playMedia=function(){d({type:"buffering",busy:"show"});if(this.player.playVideo){this.player.playVideo();}};this.pauseMedia=function(){if(this.player.pauseVideo){this.player.pauseVideo();}};this.stopMedia=function(){if(this.player.stopVideo){this.player.stopVideo();}};this.destroy=function(){this.stopMedia();jQuery.media.utils.removeFlash(this.display,(e.id+"_media"));this.display.children().remove();};this.seekMedia=function(h){d({type:"buffering",busy:"show"});if(this.player.seekTo){this.player.seekTo(h,true);}};this.setVolume=function(h){if(this.player.setVolume){this.player.setVolume(h*100);}};this.setQuality=function(h){if(this.player.setPlaybackQuality){this.player.setPlaybackQuality(h);}};this.getVolume=function(){return this.player.getVolume?(this.player.getVolume()/100):0;};this.getDuration=function(){return this.player.getDuration?this.player.getDuration():0;};this.getCurrentTime=function(){return this.player.getCurrentTime?this.player.getCurrentTime():0;};this.getQuality=function(){return this.player.getPlaybackQuality?this.player.getPlaybackQuality():0;};this.getEmbedCode=function(){return this.player.getVideoEmbedCode?this.player.getVideoEmbedCode():0;};this.getMediaLink=function(){return this.player.getVideoUrl?this.player.getVideoUrl():0;};this.getBytesLoaded=function(){return this.player.getVideoBytesLoaded?this.player.getVideoBytesLoaded():0;};this.getBytesTotal=function(){return this.player.getVideoBytesTotal?this.player.getVideoBytesTotal():0;};this.hasControls=function(){return false;};this.showControls=function(h){};})(this,c,b);};})(jQuery); \ No newline at end of file diff --git a/js/createJS.inc b/js/createJS.inc deleted file mode 100755 index e1c37f50..00000000 --- a/js/createJS.inc +++ /dev/null @@ -1,114 +0,0 @@ - 1 ) { - if( file_exists( $uncompressed ) ) { - unlink( $uncompressed ); - } - - $handle = smart_fopen( $uncompressed, 'a+' ); - if( $handle ) { - $index = 0; - foreach( $files as $file ) { - if( !$filter || in_array( basename($file), $filter ) ) { - $contents = file_get_contents($file); - if( $index != 0 ) { - $contents = str_replace('(function($) {', '', $contents); - $contents = str_replace('jQuery.media = jQuery.media ? jQuery.media : {};', '', $contents); - } - if( ++$index < $num_files ) { - $contents = str_replace('})(jQuery);', '', $contents); - } - fwrite( $handle, $contents ); - - if( $source_dir ) { - create_compressed_file( $output_dir, $file, $source_dir . '/' . basename($file) ); - } - } - } - fclose( $handle ); - } - } - - create_compressed_file( $output_dir, $uncompressed, $compressed ); -} - -function addCopyRight( $output_dir, $file ) { - static $copyright; - if( !$copyright ) { - $copyright = file_get_contents($output_dir . 'LICENSE.TXT'); - } - $code = file_get_contents($file); - unlink( $file ); - $handle = fopen( $file, 'a+' ); - if( $handle ) { - fwrite( $handle, $copyright ); - fwrite( $handle, "\n" ); - fwrite( $handle, $code ); - fclose( $handle ); - } -} - -function create_javascript_release( $output_dir = '' ) { - define( "RELEASE_DIR", $output_dir . "js/source" ); - - // Bad things will happen if the release directory is the same as the output. - if( $output_dir != RELEASE_DIR ) { - define( "RELEASE_SOURCE_DIR", $output_dir . "js/compressed"); - define( "MAX_RELEASE_FILE", $output_dir . "js/jquery.osmplayer.js"); - define( "MAX_RELEASE_FILE_COMPRESSED", $output_dir . "js/jquery.osmplayer.compressed.js" ); - define( "MIN_RELEASE_FILE", $output_dir . "js/jquery.minplayer.js" ); - define( "MIN_RELEASE_FILE_COMPRESSED", $output_dir . "js/jquery.minplayer.compressed.js" ); - define( "TEMPLATE_FILE", $output_dir . "templates/default/jquery.media.template.default.js" ); - define( "TEMPLATE_RELEASE_FILE", $output_dir . "templates/default/jquery.media.template.default.compressed.js" ); - - $min_files = array( - "jquery.media.minplayer.js", - "jquery.media.control.js", - "jquery.media.dailymotion.js", - "jquery.media.display.js", - "jquery.media.flash.js", - "jquery.media.html5.js", - "jquery.media.vimeo.js", - "jquery.media.youtube.js" - ); - - // Make sure the src and template directory is created. - if( !is_dir(RELEASE_SOURCE_DIR) ) { - mkdir(RELEASE_SOURCE_DIR, 0755, true); - } - - // Now create the compressed javascript files... - $files = get_files(RELEASE_DIR, array("js"), false); - $num_files = count($files); - if( $num_files > 0 ) { - create_js_files( $output_dir, $files, array(), MAX_RELEASE_FILE, MAX_RELEASE_FILE_COMPRESSED, $num_files, RELEASE_SOURCE_DIR ); - create_js_files( $output_dir, $files, $min_files, MIN_RELEASE_FILE, MIN_RELEASE_FILE_COMPRESSED, count($min_files) ); - } - - // Now create the template javascript file... - create_compressed_file( $output_dir, TEMPLATE_FILE, TEMPLATE_RELEASE_FILE ); - } -} -?> \ No newline at end of file diff --git a/js/createJS.php b/js/createJS.php deleted file mode 100755 index 015f9fdc..00000000 --- a/js/createJS.php +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/js/createJS.sh b/js/createJS.sh deleted file mode 100755 index 000f06be..00000000 --- a/js/createJS.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -DIR="$( cd "$( dirname "$0" )" && pwd )" -php $DIR/createJS.php "$DIR/../" \ No newline at end of file diff --git a/js/jquery.minplayer.compressed.js b/js/jquery.minplayer.compressed.js deleted file mode 100644 index 1f289452..00000000 --- a/js/jquery.minplayer.compressed.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{volumeVertical:false});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{currentTime:"#mediacurrenttime",totalTime:"#mediatotaltime",playPause:"#mediaplaypause",seekUpdate:"#mediaseekupdate",seekProgress:"#mediaseekprogress",seekBar:"#mediaseekbar",seekHandle:"#mediaseekhandle",volumeUpdate:"#mediavolumeupdate",volumeBar:"#mediavolumebar",volumeHandle:"#mediavolumehandle",mute:"#mediamute"});jQuery.fn.mediacontrol=function(b){if(this.length===0){return null;}return new (function(e,c){c=jQuery.media.utils.getSettings(c);this.display=e;var f=this;this.formatTime=(c.template&&c.template.formatTime)?c.template.formatTime:function(j){j=j?j:0;var k=0;var h=0;var g=0;g=Math.floor(j/3600);j-=(g*3600);h=Math.floor(j/60);j-=(h*60);k=Math.floor(j%60);var i="";if(g){i+=String(g);i+=":";}i+=(h>=10)?String(h):("0"+String(h));i+=":";i+=(k>=10)?String(k):("0"+String(k));return{time:i,units:""};};this.setToggle=function(h,i){var g=i?".on":".off";var j=i?".off":".on";if(h){h.find(g).show();h.find(j).hide();}};var d=this.formatTime(0);this.duration=0;this.volume=-1;this.prevVolume=0;this.percentLoaded=0;this.playState=false;this.muteState=false;this.currentTime=e.find(c.ids.currentTime).text(d.time);this.totalTime=e.find(c.ids.totalTime).text(d.time);this.display.find("a.mediaplayerlink").each(function(){var g=a(this).attr("href");a(this).medialink(c,function(h){h.preventDefault();f.display.trigger(h.data.id);},{id:g.substr(1),obj:a(this)});});this.playPauseButton=e.find(c.ids.playPause).medialink(c,function(g,h){f.playState=!f.playState;f.setToggle(h,f.playState);f.display.trigger("controlupdate",{type:(f.playState?"pause":"play")});});this.seekUpdate=e.find(c.ids.seekUpdate).css("width",0);this.seekProgress=e.find(c.ids.seekProgress).css("width",0);this.seekBar=e.find(c.ids.seekBar).mediaslider(c.ids.seekHandle,false);if(this.seekBar){this.seekBar.display.unbind("setvalue").bind("setvalue",function(g,h){f.seekUpdate.css("width",(h*f.seekBar.trackSize)+"px");f.display.trigger("controlupdate",{type:"seek",value:(h*f.duration)});});this.seekBar.display.unbind("updatevalue").bind("updatevalue",function(g,h){f.seekUpdate.css("width",(h*f.seekBar.trackSize)+"px");});}this.setVolume=function(g){if(this.volumeBar){if(c.volumeVertical){this.volumeUpdate.css({marginTop:(this.volumeBar.handlePos+this.volumeBar.handleMid),height:(this.volumeBar.trackSize-this.volumeBar.handlePos)});}else{this.volumeUpdate.css("width",(g*this.volumeBar.trackSize));}}};this.volumeUpdate=e.find(c.ids.volumeUpdate);this.volumeBar=e.find(c.ids.volumeBar).mediaslider(c.ids.volumeHandle,c.volumeVertical,c.volumeVertical);if(this.volumeBar){this.volumeBar.display.unbind("setvalue").bind("setvalue",function(g,h){f.setVolume(h);f.display.trigger("controlupdate",{type:"volume",value:h});});this.volumeBar.display.unbind("updatevalue").bind("updatevalue",function(g,h){f.setVolume(h);f.volume=h;});}this.mute=e.find(c.ids.mute).medialink(c,function(g,h){f.muteState=!f.muteState;f.setToggle(h,f.muteState);f.setMute(f.muteState);});this.setMute=function(g){this.prevVolume=(this.volumeBar.value>0)?this.volumeBar.value:this.prevVolume;this.volumeBar.updateValue(g?0:this.prevVolume);this.display.trigger("controlupdate",{type:"mute",value:g});};this.setProgress=function(g){if(this.seekProgress&&this.seekBar){this.seekProgress.css("width",(g*(this.seekBar.trackSize+this.seekBar.handleSize)));}};this.onResize=function(){if(this.seekBar){this.seekBar.onResize();}this.setProgress(this.percentLoaded);};this.onMediaUpdate=function(g){switch(g.type){case"reset":this.reset();break;case"paused":this.playState=true;this.setToggle(this.playPauseButton.display,this.playState);break;case"playing":this.playState=false;this.setToggle(this.playPauseButton.display,this.playState);break;case"stopped":this.playState=true;this.setToggle(this.playPauseButton.display,this.playState);break;case"progress":this.percentLoaded=g.percentLoaded;this.setProgress(this.percentLoaded);break;case"meta":case"update":this.timeUpdate(g.currentTime,g.totalTime);if(this.volumeBar){this.volumeBar.updateValue(g.volume);}break;default:break;}};this.reset=function(){this.totalTime.text(this.formatTime(0).time);this.currentTime.text(this.formatTime(0).time);if(this.seekBar){this.seekBar.updateValue(0);}this.seekUpdate.css("width","0px");this.seekProgress.css("width","0px");};this.timeUpdate=function(g,h){this.duration=h;this.totalTime.text(this.formatTime(h).time);this.currentTime.text(this.formatTime(g).time);if(h&&this.seekBar&&!this.seekBar.dragging){this.seekBar.updateValue(g/h);}};this.timeUpdate(0,0);})(this,b);};window.onDailymotionPlayerReady=function(b){b=b.replace("_media","");jQuery.media.players[b].node.player.media.player.onReady();};jQuery.media.playerTypes=jQuery.extend(jQuery.media.playerTypes,{dailymotion:function(b){return(b.search(/^http(s)?\:\/\/(www\.)?dailymotion\.com/i)===0);}});jQuery.fn.mediadailymotion=function(c,b){return new (function(f,e,d){this.display=f;var g=this;this.player=null;this.videoFile=null;this.meta=false;this.loaded=false;this.ready=false;this.createMedia=function(i,k){this.videoFile=i;this.ready=false;var h=(e.id+"_media");var j=Math.floor(Math.random()*1000000);var l="http://www.dailymotion.com/swf/"+i.path+"?rand="+j+"&enablejsapi=1&playerapiid="+h;jQuery.media.utils.insertFlash(this.display,l,h,"100%","100%",{},e.wmode,function(m){g.player=m;g.loadPlayer();});};this.loadMedia=function(h){if(this.player){this.loaded=false;this.meta=false;this.videoFile=h;d({type:"playerready"});this.player.loadVideoById(this.videoFile.path,0);}};this.onReady=function(){this.ready=true;this.loadPlayer();};this.loadPlayer=function(){if(this.ready&&this.player){window[e.id+"StateChange"]=function(h){g.onStateChange(h);};window[e.id+"PlayerError"]=function(h){g.onError(h);};this.player.addEventListener("onStateChange",e.id+"StateChange");this.player.addEventListener("onError",e.id+"PlayerError");d({type:"playerready"});this.player.loadVideoById(this.videoFile.path,0);}};this.onStateChange=function(i){var h=this.getPlayerState(i);if(!(!this.meta&&h.state=="stopped")){d({type:h.state,busy:h.busy});}if(!this.loaded&&h.state=="buffering"){this.loaded=true;d({type:"paused",busy:"hide"});if(e.autostart){this.playMedia();}}if(!this.meta&&h.state=="playing"){this.meta=true;d({type:"meta"});}};this.onError=function(i){var h="An unknown error has occured: "+i;if(i==100){h="The requested video was not found. ";h+="This occurs when a video has been removed (for any reason), ";h+="or it has been marked as private.";}else{if((i==101)||(i==150)){h="The video requested does not allow playback in an embedded player.";}}d({type:"error",data:h});};this.getPlayerState=function(h){switch(h){case 5:return{state:"ready",busy:false};case 3:return{state:"buffering",busy:"show"};case 2:return{state:"paused",busy:"hide"};case 1:return{state:"playing",busy:"hide"};case 0:return{state:"complete",busy:false};case -1:return{state:"stopped",busy:false};default:return{state:"unknown",busy:false};}return"unknown";};this.playMedia=function(){d({type:"buffering",busy:"show"});this.player.playVideo();};this.pauseMedia=function(){this.player.pauseVideo();};this.stopMedia=function(){this.player.stopVideo();};this.destroy=function(){this.stopMedia();jQuery.media.utils.removeFlash(this.display,(e.id+"_media"));this.display.children().remove();};this.seekMedia=function(h){d({type:"buffering",busy:"show"});this.player.seekTo(h,true);};this.setVolume=function(h){this.player.setVolume(h*100);};this.getVolume=function(){return(this.player.getVolume()/100);};this.getDuration=function(){return this.player.getDuration();};this.getCurrentTime=function(){return this.player.getCurrentTime();};this.getBytesLoaded=function(){return this.player.getVideoBytesLoaded();};this.getBytesTotal=function(){return this.player.getVideoBytesTotal();};this.getEmbedCode=function(){return this.player.getVideoEmbedCode();};this.getMediaLink=function(){return this.player.getVideoUrl();};this.hasControls=function(){return true;};this.showControls=function(h){};this.setQuality=function(h){};this.getQuality=function(){return"";};})(this,c,b);};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{volume:80,autostart:false,streamer:"",embedWidth:450,embedHeight:337,wmode:"transparent",forceOverflow:false,quality:"default",repeat:false});jQuery.fn.mediadisplay=function(b){if(this.length===0){return null;}return new (function(d,c){this.settings=jQuery.media.utils.getSettings(c);this.display=d;var e=this;this.volume=-1;this.player=null;this.preview="";this.updateInterval=null;this.progressInterval=null;this.playQueue=[];this.playIndex=0;this.playerReady=false;this.loaded=false;this.mediaFile=null;this.hasPlaylist=false;if(this.settings.forceOverflow){this.display.parents().css("overflow","visible");}this.reset=function(){this.loaded=false;this.stopMedia();clearInterval(this.progressInterval);clearInterval(this.updateInterval);this.playQueue.length=0;this.playQueue=[];this.playIndex=0;this.playerReady=false;this.mediaFile=null;this.display.empty().trigger("mediaupdate",{type:"reset"});};this.getPlayableMedia=function(j){var h=null;var f=j.length;while(f--){var g=new jQuery.media.file(j[f],this.settings);if(!h||(g.weight0);if(!f){if(this.player){this.player.destroy();this.player=null;}this.display.trigger("mediaupdate",{type:"nomedia"});}return f;};this.playNext=function(){if(this.playQueue.length>this.playIndex){this.loadMedia(this.playQueue[this.playIndex]);this.playIndex++;}else{if(this.settings.repeat){this.playIndex=0;this.playNext();}else{if(this.hasPlaylist){this.reset();}else{this.loaded=false;this.settings.autostart=false;this.playIndex=0;this.playNext();}}}};this.loadMedia=function(g,f){if(g){g=new jQuery.media.file(this.getMediaFile(g),this.settings);g.player=f?f:g.player;this.stopMedia();if(!this.mediaFile||(this.mediaFile.player!=g.player)){this.player=null;this.playerReady=false;if(g.player){this.player=this.display["media"+g.player](this.settings,function(h){e.onMediaUpdate(h);});}if(this.player){this.player.createMedia(g,this.preview);}}else{if(this.player){this.player.loadMedia(g);}}this.mediaFile=g;this.onMediaUpdate({type:"initialize"});}};this.onMediaUpdate=function(g){switch(g.type){case"playerready":this.playerReady=true;this.player.setVolume(0);this.player.setQuality(this.settings.quality);this.startProgress();break;case"buffering":this.startProgress();break;case"stopped":clearInterval(this.progressInterval);clearInterval(this.updateInterval);break;case"error":if(g.code==4){this.loadMedia(this.mediaFile,"flash");}else{clearInterval(this.progressInterval);clearInterval(this.updateInterval);}break;case"paused":clearInterval(this.updateInterval);break;case"playing":this.startUpdate();break;case"progress":var f=this.getPercentLoaded();jQuery.extend(g,{percentLoaded:f});if(f>=1){clearInterval(this.progressInterval);}break;case"meta":jQuery.extend(g,{currentTime:this.player.getCurrentTime(),totalTime:this.getDuration(),volume:this.player.getVolume(),quality:this.getQuality()});break;case"durationupdate":this.mediaFile.duration=g.duration;break;case"complete":this.playNext();break;default:break;}if(g.type=="playing"&&!this.loaded){if(this.settings.autoLoad&&!this.settings.autostart){setTimeout(function(){e.setVolume();e.player.pauseMedia();e.settings.autostart=true;e.loaded=true;},100);}else{this.loaded=true;this.setVolume();this.display.trigger("mediaupdate",g);}}else{this.display.trigger("mediaupdate",g);}};this.startProgress=function(){if(this.playerReady){clearInterval(this.progressInterval);this.progressInterval=setInterval(function(){e.onMediaUpdate({type:"progress"});},500);}};this.startUpdate=function(){if(this.playerReady){clearInterval(this.updateInterval);this.updateInterval=setInterval(function(){if(e.playerReady){e.onMediaUpdate({type:"update",currentTime:e.player.getCurrentTime(),totalTime:e.getDuration(),volume:e.player.getVolume(),quality:e.getQuality()});}},1000);}};this.stopMedia=function(){this.loaded=false;clearInterval(this.progressInterval);clearInterval(this.updateInterval);if(this.playerReady){this.player.stopMedia();}};this.mute=function(f){this.player.setVolume(f?0:this.volume);};this.onResize=function(){if(this.player&&this.player.onResize){this.player.onResize();}};this.getPercentLoaded=function(){if(this.player.getPercentLoaded){return this.player.getPercentLoaded();}else{var g=this.player.getBytesLoaded();var f=this.mediaFile.bytesTotal?this.mediaFile.bytesTotal:this.player.getBytesTotal();return f?(g/f):0;}};this.showControls=function(f){if(this.playerReady){this.player.showControls(f);}};this.hasControls=function(){if(this.player){return this.player.hasControls();}return false;};this.getDuration=function(){if(this.mediaFile){if(!this.mediaFile.duration){this.mediaFile.duration=this.player.getDuration();}return this.mediaFile.duration;}else{return 0;}};this.setVolume=function(f){this.volume=f?f:((this.volume==-1)?(this.settings.volume/100):this.volume);if(this.player){this.player.setVolume(this.volume);}};this.getVolume=function(){if(!this.volume){this.volume=this.player.getVolume();}return this.volume;};this.getQuality=function(){if(!this.mediaFile.quality){this.mediaFile.quality=this.player.getQuality();}return this.mediaFile.quality;};})(this,b);};window.onFlashPlayerReady=function(b){jQuery.media.players[b].node.player.media.player.onReady();};window.onFlashPlayerUpdate=function(c,b){jQuery.media.players[c].node.player.media.player.onMediaUpdate(b);};window.onFlashPlayerDebug=function(b){if(window.console&&console.log){console.log(b);}};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{flashPlayer:"./flash/mediafront.swf",skin:"default",config:"nocontrols"});jQuery.fn.mediaflash=function(c,b){return new (function(f,e,d){e=jQuery.media.utils.getSettings(e);this.display=f;var g=this;this.player=null;this.mediaFile=null;this.preview="";this.ready=false;this.translate={mediaConnected:"connected",mediaBuffering:"buffering",mediaPaused:"paused",mediaPlaying:"playing",mediaStopped:"stopped",mediaComplete:"complete",mediaMeta:"meta"};this.busy={mediaConnected:false,mediaBuffering:"show",mediaPaused:"hide",mediaPlaying:"hide",mediaStopped:false,mediaComplete:false,mediaMeta:false};this.createMedia=function(h,l){this.mediaFile=h;this.preview=l;this.ready=false;var j=(e.id+"_media");var k=Math.floor(Math.random()*1000000);var m=e.flashPlayer+"?rand="+k;var i={config:e.config,id:e.id,file:h.path,image:this.preview,skin:e.skin,autostart:(e.autostart||!e.autoLoad)};if(h.stream){i.stream=h.stream;}if(e.debug){i.debug="1";}jQuery.media.utils.insertFlash(this.display,m,j,"100%","100%",i,e.wmode,function(n){g.player=n;g.loadPlayer();});};this.loadMedia=function(h){if(this.player&&this.ready){this.mediaFile=h;this.player.loadMedia(h.path,h.stream);d({type:"playerready"});}};this.onReady=function(){this.ready=true;this.loadPlayer();};this.loadPlayer=function(){if(this.ready&&this.player){d({type:"playerready"});}};this.onMediaUpdate=function(h){d({type:this.translate[h],busy:this.busy[h]});};this.playMedia=function(){if(this.player&&this.ready){this.player.playMedia();}};this.pauseMedia=function(){if(this.player&&this.ready){this.player.pauseMedia();}};this.stopMedia=function(){if(this.player&&this.ready){this.player.stopMedia();}};this.destroy=function(){this.stopMedia();jQuery.media.utils.removeFlash(this.display,(e.id+"_media"));this.display.children().remove();};this.seekMedia=function(h){if(this.player&&this.ready){this.player.seekMedia(h);}};this.setVolume=function(h){if(this.player&&this.ready){this.player.setVolume(h);}};this.getVolume=function(){return(this.player&&this.ready)?this.player.getVolume():0;};this.getDuration=function(){return(this.player&&this.ready)?this.player.getDuration():0;};this.getCurrentTime=function(){return(this.player&&this.ready)?this.player.getCurrentTime():0;};this.getBytesLoaded=function(){return(this.player&&this.ready)?this.player.getMediaBytesLoaded():0;};this.getBytesTotal=function(){return(this.player&&this.ready)?this.player.getMediaBytesTotal():0;};this.hasControls=function(){return true;};this.showControls=function(h){if(this.player&&this.ready){this.player.showPlugin("controlBar",h);this.player.showPlugin("playLoader",h);}};this.getEmbedCode=function(){var h={config:"config",id:"mediafront_player",file:this.mediaFile.path,image:this.preview,skin:e.skin};if(this.mediaFile.stream){h.stream=this.mediaFile.stream;}return jQuery.media.utils.getFlash(e.flashPlayer,"mediafront_player",e.embedWidth,e.embedHeight,h,e.wmode);};this.setQuality=function(h){};this.getQuality=function(){return"";};this.getMediaLink=function(){return"This video currently does not have a link.";};})(this,c,b);};jQuery.fn.mediahtml5=function(c,b){return new (function(f,e,d){this.display=f;var g=this;this.player=null;this.bytesLoaded=0;this.bytesTotal=0;this.mediaType="";this.loaded=false;this.mediaFile=null;this.playerElement=null;this.getPlayer=function(h,m){this.mediaFile=h;var j=e.id+"_"+this.mediaType;var l="<"+this.mediaType+' style="position:absolute" id="'+j+'"';l+=m?' poster="'+m+'"':"";if(typeof h==="array"){l+=">";var k=h.length;while(k){k--;l+='';}}else{l+=' src="'+h.path+'">Unable to display media.';}l+="";this.display.append(l);this.bytesTotal=h.bytesTotal;this.playerElement=this.display.find("#"+j);this.onResize();return this.playerElement.eq(0)[0];};this.createMedia=function(h,i){jQuery.media.utils.removeFlash(this.display,e.id+"_media");this.display.children().remove();this.mediaType=this.getMediaType(h);this.player=this.getPlayer(h,i);this.loaded=false;var j=false;if(this.player){this.player.addEventListener("abort",function(){d({type:"stopped"});},true);this.player.addEventListener("loadstart",function(){d({type:"ready",busy:"show"});g.onReady();},true);this.player.addEventListener("loadeddata",function(){d({type:"loaded",busy:"hide"});},true);this.player.addEventListener("loadedmetadata",function(){d({type:"meta"});},true);this.player.addEventListener("canplaythrough",function(){d({type:"canplay",busy:"hide"});},true);this.player.addEventListener("ended",function(){d({type:"complete"});},true);this.player.addEventListener("pause",function(){d({type:"paused"});},true);this.player.addEventListener("play",function(){d({type:"playing"});},true);this.player.addEventListener("playing",function(){d({type:"playing",busy:"hide"});},true);this.player.addEventListener("error",function(k){g.onError(k.target.error);d({type:"error",code:k.target.error.code});},true);this.player.addEventListener("waiting",function(){d({type:"waiting",busy:"show"});},true);this.player.addEventListener("timeupdate",function(){if(j){d({type:"timeupdate",busy:"hide"});}else{j=true;}},true);this.player.addEventListener("durationchange",function(){if(this.duration&&(this.duration!==Infinity)){d({type:"durationupdate",duration:this.duration});}},true);this.player.addEventListener("progress",function(k){g.bytesLoaded=k.loaded;g.bytesTotal=k.total;},true);this.player.autoplay=true;if(typeof this.player.hasAttribute=="function"&&this.player.hasAttribute("preload")&&this.player.preload!="none"){this.player.autobuffer=true;}else{this.player.autobuffer=false;this.player.preload="none";}d({type:"playerready"});}};this.onError=function(h){switch(h.code){case 1:console.log("Error: MEDIA_ERR_ABORTED");break;case 2:console.log("Error: MEDIA_ERR_DECODE");break;case 3:console.log("Error: MEDIA_ERR_NETWORK");break;case 4:console.log("Error: MEDIA_ERR_SRC_NOT_SUPPORTED");break;default:break;}};this.onReady=function(){if(!this.loaded){this.loaded=true;this.playMedia();}};this.loadMedia=function(h){this.mediaFile=h;this.createMedia(h);};this.getMediaType=function(h){var i=(typeof h==="array")?h[0].extension:h.extension;switch(i){case"ogg":case"ogv":case"mp4":case"m4v":return"video";case"oga":case"mp3":return"audio";default:break;}return"video";};this.playMedia=function(){if(this.player&&this.player.play){this.player.play();}};this.pauseMedia=function(){if(this.player&&this.player.pause){this.player.pause();}};this.stopMedia=function(){this.pauseMedia();if(this.player){this.player.src="";}};this.destroy=function(){this.stopMedia();this.display.children().remove();};this.seekMedia=function(h){if(this.player){this.player.currentTime=h;}};this.setVolume=function(h){if(this.player){this.player.volume=h;}};this.getVolume=function(){return this.player?this.player.volume:0;};this.getDuration=function(){var h=this.player?this.player.duration:0;return(h===Infinity)?0:h;};this.getCurrentTime=function(){return this.player?this.player.currentTime:0;};this.getPercentLoaded=function(){if(this.player&&this.player.buffered&&this.player.duration){return(this.player.buffered.end(0)/this.player.duration);}else{if(this.bytesTotal){return(this.bytesLoaded/this.bytesTotal);}else{return 0;}}};this.onResize=function(){if(this.mediaType=="video"){this.playerElement.css({width:this.display.width(),height:this.display.height()});}};this.setQuality=function(h){};this.getQuality=function(){return"";};this.hasControls=function(){return false;};this.showControls=function(h){};this.getEmbedCode=function(){if((this.mediaFile.extension=="mp4")||(this.mediaFile.extension=="m4v")||(this.mediaFile.extension=="webm")){var h={config:"config",id:"mediafront_player",file:this.mediaFile.path,image:this.preview,skin:e.skin};if(this.mediaFile.stream){h.stream=this.mediaFile.stream;}return jQuery.media.utils.getFlash(e.flashPlayer,"mediafront_player",e.embedWidth,e.embedHeight,h,e.wmode);}else{return"This media does not support embedding.";}};this.getMediaLink=function(){return"This media currently does not have a link.";};})(this,c,b);};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{logo:"logo.png",logoWidth:49,logoHeight:15,logopos:"sw",logox:5,logoy:5,link:"http://www.mediafront.org",file:"",image:"",timeout:8,autoLoad:true});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{busy:"#mediabusy",preview:"#mediapreview",play:"#mediaplay",media:"#mediadisplay"});jQuery.fn.minplayer=function(b){if(this.length===0){return null;}return new (function(c,d){d=jQuery.media.utils.getSettings(d);this.display=c;var e=this;this.autoLoad=d.autoLoad;this.busy=c.find(d.ids.busy);this.busyImg=this.busy.find("img");this.busyWidth=this.busyImg.width();this.busyHeight=this.busyImg.height();this.play=c.find(d.ids.play);this.play.unbind("click").bind("click",function(){e.togglePlayPause();});this.playImg=this.play.find("img");this.playWidth=this.playImg.width();this.playHeight=this.playImg.height();this.preview=c.find(d.ids.preview).mediaimage();if(this.preview){this.preview.display.unbind("click").bind("click",function(){e.onMediaClick();});this.preview.display.unbind("imageLoaded").bind("imageLoaded",function(){e.onPreviewLoaded();});}this.usePlayerControls=false;this.busyFlags=0;this.busyVisible=false;this.playVisible=false;this.previewVisible=false;this.playing=false;this.hasMedia=false;this.timeoutId=0;this.width=this.display.width();this.height=this.display.height();this.showElement=function(h,f,g){if(h&&!this.usePlayerControls){if(f){h.show(g);}else{h.hide(g);}}};this.showPlay=function(f,g){f&=this.hasMedia;this.playVisible=f;this.showElement(this.play,f,g);};this.showBusy=function(h,f,g){if(f){this.busyFlags|=(1<0);this.showElement(this.busy,this.busyVisible,g);if(h==1&&!f){this.showBusy(3,false);}};this.showPreview=function(f,g){this.previewVisible=f;if(this.preview){this.showElement(this.preview.display,f,g);}};this.onControlUpdate=function(f){if(this.media){if(this.media.playerReady){switch(f.type){case"play":this.media.player.playMedia();break;case"pause":this.media.player.pauseMedia();break;case"seek":this.media.player.seekMedia(f.value);break;case"volume":this.media.setVolume(f.value);break;case"mute":this.media.mute(f.value);break;default:break;}}else{if((this.media.playQueue.length>0)&&!this.media.mediaFile){this.autoLoad=true;this.playNext();}}if(d.template&&d.template.onControlUpdate){d.template.onControlUpdate(f);}}};this.fullScreen=function(f){if(d.template.onFullScreen){d.template.onFullScreen(f);}this.preview.refresh();};this.onPreviewLoaded=function(){this.previewVisible=true;};this.onMediaUpdate=function(f){switch(f.type){case"paused":this.playing=false;this.showPlay(true);if(!this.media.loaded){this.showPreview(true);}break;case"update":case"playing":this.playing=true;this.showPlay(false);this.showPreview((this.media.mediaFile.type=="audio"));break;case"initialize":this.playing=false;this.showPlay(true);this.showBusy(1,this.autoLoad);this.showPreview(true);break;case"buffering":this.showPlay(true);this.showPreview((this.media.mediaFile.type=="audio"));break;default:break;}if(f.busy){this.showBusy(1,(f.busy=="show"));}};this.onMediaClick=function(){if(this.media.player&&!this.media.hasControls()){if(this.playing){this.media.player.pauseMedia();}else{this.media.player.playMedia();}}};this.media=this.display.find(d.ids.media).mediadisplay(d);if(this.media){this.media.display.unbind("click").bind("click",function(){e.onMediaClick();});}this.setLogoPos=function(){if(this.logo){var f={};if(d.logopos=="se"||d.logopos=="sw"){f.bottom=d.logoy;}if(d.logopos=="ne"||d.logopos=="nw"){f.top=d.logoy;}if(d.logopos=="nw"||d.logopos=="sw"){f.left=d.logox;}if(d.logopos=="ne"||d.logopos=="se"){f.right=d.logox;}this.logo.display.css(f);}};if(!d.controllerOnly){this.display.prepend('');this.logo=this.display.find("."+d.prefix+"medialogo").mediaimage(d.link);if(this.logo){this.logo.display.css({width:d.logoWidth,height:d.logoHeight});this.logo.display.bind("imageLoaded",function(){e.setLogoPos();});this.logo.loadImage(d.logo);}}this.reset=function(){this.hasMedia=false;this.playing=false;jQuery.media.players[d.id].showNativeControls(false);this.showPlay(true);this.showPreview(true);clearTimeout(this.timeoutId);if(this.media){this.media.reset();}};this.togglePlayPause=function(){if(this.media){if(this.media.playerReady){if(this.playing){this.showPlay(true);this.media.player.pauseMedia();}else{this.showPlay(false);this.media.player.playMedia();}}else{if((this.media.playQueue.length>0)&&!this.media.mediaFile){this.autoLoad=true;this.playNext();}}}};this.loadImage=function(f){if(this.preview){this.showBusy(3,true);this.preview.loadImage(f);var g=setInterval(function(){if(e.preview.loaded()){clearInterval(g);e.showBusy(3,false);}},500);if(this.media){this.media.preview=f;}}};this.onResize=function(){if(this.preview){this.preview.refresh();}if(this.media){this.media.onResize();}};this.clearImage=function(){if(this.preview){this.preview.clear();}};this.loadFiles=function(f){this.reset();this.hasMedia=this.media&&this.media.loadFiles(f);if(this.hasMedia&&this.autoLoad){this.media.playNext();}else{if(!this.hasMedia){this.showPlay(false);this.showPreview(true);this.timeoutId=setTimeout(function(){e.media.display.trigger("mediaupdate",{type:"complete"});},(d.timeout*1000));}}return this.hasMedia;};this.playNext=function(){if(this.media){this.media.playNext();}};this.hasControls=function(){if(this.media){return this.media.hasControls();}return true;};this.showControls=function(f){if(this.media){this.media.showControls(f);}};this.loadMedia=function(f){this.reset();if(this.media){this.media.loadMedia(f);}};if(d.file){this.loadMedia(d.file);}if(d.image){this.loadImage(d.image);}})(this,b);};window.onVimeoReady=function(b){b=b.replace(/\_media$/,"");jQuery.media.players[b].node.player.media.player.onReady();};window.onVimeoFinish=function(b){b=b.replace(/\_media$/,"");jQuery.media.players[b].node.player.media.player.onFinished();};window.onVimeoLoading=function(c,b){b=b.replace(/\_media$/,"");jQuery.media.players[b].node.player.media.player.onLoading(c);};window.onVimeoPlay=function(b){b=b.replace(/\_media$/,"");jQuery.media.players[b].node.player.media.player.onPlaying();};window.onVimeoPause=function(b){b=b.replace(/\_media$/,"");jQuery.media.players[b].node.player.media.player.onPaused();};window.onVimeoProgress=function(c,b){b=b.replace(/\_media$/,"");jQuery.media.players[b].node.player.media.player.onProgress(c);};jQuery.media.playerTypes=jQuery.extend(jQuery.media.playerTypes,{vimeo:function(b){return(b.search(/^http(s)?\:\/\/(www\.)?vimeo\.com/i)===0);}});jQuery.fn.mediavimeo=function(c,b){return new (function(f,e,d){this.display=f;var g=this;this.player=null;this.videoFile=null;this.ready=false;this.bytesLoaded=0;this.bytesTotal=0;this.currentVolume=1;this.createMedia=function(j,l){this.videoFile=j;this.ready=false;var i=(e.id+"_media");var h={clip_id:this.getId(j.path),width:"100%",height:"100%",js_api:"1",js_onLoad:"onVimeoReady",js_swf_id:i};var k=Math.floor(Math.random()*1000000);var m="http://vimeo.com/moogaloop.swf?rand="+k;jQuery.media.utils.insertFlash(this.display,m,i,"100%","100%",h,e.wmode,function(n){g.player=n;g.loadPlayer();});};this.getId=function(i){var h=/^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i;return(i.search(h)===0)?i.replace(h,"$3"):i;};this.loadMedia=function(h){this.bytesLoaded=0;this.bytesTotal=0;this.createMedia(h);};this.onReady=function(){this.ready=true;this.loadPlayer();};this.loadPlayer=function(){if(this.ready&&this.player&&this.player.api_addEventListener){this.player.api_addEventListener("onProgress","onVimeoProgress");this.player.api_addEventListener("onFinish","onVimeoFinish");this.player.api_addEventListener("onLoading","onVimeoLoading");this.player.api_addEventListener("onPlay","onVimeoPlay");this.player.api_addEventListener("onPause","onVimeoPause");d({type:"playerready"});this.playMedia();}};this.onFinished=function(){d({type:"complete"});};this.onLoading=function(h){this.bytesLoaded=h.bytesLoaded;this.bytesTotal=h.bytesTotal;};this.onPlaying=function(){d({type:"playing",busy:"hide"});};this.onPaused=function(){d({type:"paused",busy:"hide"});};this.playMedia=function(){d({type:"playing",busy:"hide"});if(this.player.api_play){this.player.api_play();}};this.onProgress=function(h){d({type:"progress"});};this.pauseMedia=function(){d({type:"paused",busy:"hide"});if(this.player.api_pause){this.player.api_pause();}};this.stopMedia=function(){this.pauseMedia();if(this.player.api_unload){this.player.api_unload();}};this.destroy=function(){this.stopMedia();jQuery.media.utils.removeFlash(this.display,(e.id+"_media"));this.display.children().remove();};this.seekMedia=function(h){if(this.player.api_seekTo){this.player.api_seekTo(h);}};this.setVolume=function(h){this.currentVolume=h;if(this.player.api_setVolume){this.player.api_setVolume((h*100));}};this.getVolume=function(){return this.currentVolume;};this.getDuration=function(){return this.player.api_getDuration?this.player.api_getDuration():0;};this.getCurrentTime=function(){return this.player.api_getCurrentTime?this.player.api_getCurrentTime():0;};this.getBytesLoaded=function(){return this.bytesLoaded;};this.getBytesTotal=function(){return this.bytesTotal;};this.setQuality=function(h){};this.getQuality=function(){return"";};this.hasControls=function(){return true;};this.showControls=function(h){};this.getEmbedCode=function(){return"This video cannot be embedded.";};this.getMediaLink=function(){return"This video currently does not have a link.";};})(this,c,b);};window.onYouTubePlayerReady=function(b){b=b.replace(/\_media$/,"");jQuery.media.players[b].node.player.media.player.onReady();};jQuery.media.playerTypes=jQuery.extend(jQuery.media.playerTypes,{youtube:function(b){return(b.search(/^http(s)?\:\/\/(www\.)?youtube\.com/i)===0);}});jQuery.fn.mediayoutube=function(c,b){return new (function(f,e,d){this.display=f;var g=this;this.player=null;this.videoFile=null;this.loaded=false;this.ready=false;this.qualities=[];this.createMedia=function(i,k){this.videoFile=i;this.ready=false;var h=(e.id+"_media");var j=Math.floor(Math.random()*1000000);var l="http://www.youtube.com/apiplayer?rand="+j+"&version=3&enablejsapi=1&playerapiid="+h;jQuery.media.utils.insertFlash(this.display,l,h,"100%","100%",{},e.wmode,function(m){g.player=m;g.loadPlayer();});};this.getId=function(i){var h=/^http[s]?\:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9]+)/i;return(i.search(h)===0)?i.replace(h,"$2"):i;};this.loadMedia=function(h){if(this.player){this.loaded=false;this.videoFile=h;d({type:"playerready"});if(this.player.loadVideoById){this.player.loadVideoById(this.getId(this.videoFile.path),0,e.quality);}}};this.onReady=function(){this.ready=true;this.loadPlayer();};this.loadPlayer=function(){if(this.ready&&this.player){window[e.id+"StateChange"]=function(h){g.onStateChange(h);};window[e.id+"PlayerError"]=function(h){g.onError(h);};window[e.id+"QualityChange"]=function(h){g.quality=h;};if(this.player.addEventListener){this.player.addEventListener("onStateChange",e.id+"StateChange");this.player.addEventListener("onError",e.id+"PlayerError");this.player.addEventListener("onPlaybackQualityChange",e.id+"QualityChange");}if(this.player.getAvailableQualityLevels){this.qualities=this.player.getAvailableQualityLevels();}d({type:"playerready"});if(this.player.loadVideoById){this.player.loadVideoById(this.getId(this.videoFile.path),0);}}};this.onStateChange=function(i){var h=this.getPlayerState(i);d({type:h.state,busy:h.busy});if(!this.loaded&&h=="playing"){this.loaded=true;d({type:"meta"});}};this.onError=function(i){var h="An unknown error has occured: "+i;if(i==100){h="The requested video was not found. ";h+="This occurs when a video has been removed (for any reason), ";h+="or it has been marked as private.";}else{if((i==101)||(i==150)){h="The video requested does not allow playback in an embedded player.";}}if(window.console&&console.log){console.log(h);}d({type:"error",data:h});};this.getPlayerState=function(h){switch(h){case 5:return{state:"ready",busy:false};case 3:return{state:"buffering",busy:"show"};case 2:return{state:"paused",busy:"hide"};case 1:return{state:"playing",busy:"hide"};case 0:return{state:"complete",busy:false};case -1:return{state:"stopped",busy:false};default:return{state:"unknown",busy:false};}return"unknown";};this.playMedia=function(){d({type:"buffering",busy:"show"});if(this.player.playVideo){this.player.playVideo();}};this.pauseMedia=function(){if(this.player.pauseVideo){this.player.pauseVideo();}};this.stopMedia=function(){if(this.player.stopVideo){this.player.stopVideo();}};this.destroy=function(){this.stopMedia();jQuery.media.utils.removeFlash(this.display,(e.id+"_media"));this.display.children().remove();};this.seekMedia=function(h){d({type:"buffering",busy:"show"});if(this.player.seekTo){this.player.seekTo(h,true);}};this.setVolume=function(h){if(this.player.setVolume){this.player.setVolume(h*100);}};this.setQuality=function(h){if(this.player.setPlaybackQuality){this.player.setPlaybackQuality(h);}};this.getVolume=function(){return this.player.getVolume?(this.player.getVolume()/100):0;};this.getDuration=function(){return this.player.getDuration?this.player.getDuration():0;};this.getCurrentTime=function(){return this.player.getCurrentTime?this.player.getCurrentTime():0;};this.getQuality=function(){return this.player.getPlaybackQuality?this.player.getPlaybackQuality():0;};this.getEmbedCode=function(){return this.player.getVideoEmbedCode?this.player.getVideoEmbedCode():0;};this.getMediaLink=function(){return this.player.getVideoUrl?this.player.getVideoUrl():0;};this.getBytesLoaded=function(){return this.player.getVideoBytesLoaded?this.player.getVideoBytesLoaded():0;};this.getBytesTotal=function(){return this.player.getVideoBytesTotal?this.player.getVideoBytesTotal():0;};this.hasControls=function(){return false;};this.showControls=function(h){};})(this,c,b);};})(jQuery); \ No newline at end of file diff --git a/js/jquery.minplayer.js b/js/jquery.minplayer.js deleted file mode 100644 index c656ed1f..00000000 --- a/js/jquery.minplayer.js +++ /dev/null @@ -1,2499 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - volumeVertical:false - }); - - // Set up our defaults for this component. - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - currentTime:"#mediacurrenttime", - totalTime:"#mediatotaltime", - playPause:"#mediaplaypause", - seekUpdate:"#mediaseekupdate", - seekProgress:"#mediaseekprogress", - seekBar:"#mediaseekbar", - seekHandle:"#mediaseekhandle", - volumeUpdate:"#mediavolumeupdate", - volumeBar:"#mediavolumebar", - volumeHandle:"#mediavolumehandle", - mute:"#mediamute" - }); - - jQuery.fn.mediacontrol = function( settings ) { - if( this.length === 0 ) { - return null; - } - return new (function( controlBar, settings ) { - settings = jQuery.media.utils.getSettings(settings); - this.display = controlBar; - var _this = this; - - // Allow the template to provide their own function for this... - this.formatTime = (settings.template && settings.template.formatTime) ? settings.template.formatTime : - function( time ) { - time = time ? time : 0; - var seconds = 0; - var minutes = 0; - var hour = 0; - - hour = Math.floor(time / 3600); - time -= (hour * 3600); - minutes = Math.floor( time / 60 ); - time -= (minutes * 60); - seconds = Math.floor(time % 60); - - var timeString = ""; - - if( hour ) { - timeString += String(hour); - timeString += ":"; - } - - timeString += (minutes >= 10) ? String(minutes) : ("0" + String(minutes)); - timeString += ":"; - timeString += (seconds >= 10) ? String(seconds) : ("0" + String(seconds)); - return { - time:timeString, - units:"" - }; - }; - - this.setToggle = function( button, state ) { - var on = state ? ".on" : ".off"; - var off = state ? ".off" : ".on"; - if( button ) { - button.find(on).show(); - button.find(off).hide(); - } - }; - - var zeroTime = this.formatTime( 0 ); - this.duration = 0; - this.volume = -1; - this.prevVolume = 0; - this.percentLoaded = 0; - this.playState = false; - this.muteState = false; - this.currentTime = controlBar.find( settings.ids.currentTime ).text( zeroTime.time ); - this.totalTime = controlBar.find( settings.ids.totalTime ).text( zeroTime.time ); - - // Allow them to attach custom links to the control bar that perform player functions. - this.display.find("a.mediaplayerlink").each( function() { - var linkId = $(this).attr("href"); - $(this).medialink( settings, function( event ) { - event.preventDefault(); - _this.display.trigger( event.data.id ); - }, { - id:linkId.substr(1), - obj:$(this) - } ); - }); - - // Set up the play pause button. - this.playPauseButton = controlBar.find( settings.ids.playPause ).medialink( settings, function( event, target ) { - _this.playState = !_this.playState; - _this.setToggle( target, _this.playState ); - _this.display.trigger( "controlupdate", { - type: (_this.playState ? "pause" : "play") - }); - }); - - // Set up the seek bar... - this.seekUpdate = controlBar.find( settings.ids.seekUpdate ).css("width", 0); - this.seekProgress = controlBar.find( settings.ids.seekProgress ).css("width", 0); - this.seekBar = controlBar.find( settings.ids.seekBar ).mediaslider( settings.ids.seekHandle, false ); - if( this.seekBar ) { - this.seekBar.display.unbind("setvalue").bind( "setvalue", function( event, data ) { - _this.seekUpdate.css( "width", (data * _this.seekBar.trackSize) + "px" ); - _this.display.trigger( "controlupdate", { - type:"seek", - value:(data * _this.duration) - }); - }); - this.seekBar.display.unbind("updatevalue").bind( "updatevalue", function( event, data ) { - _this.seekUpdate.css( "width", (data * _this.seekBar.trackSize) + "px" ); - }); - } - - this.setVolume = function( vol ) { - if( this.volumeBar ) { - if( settings.volumeVertical ) { - this.volumeUpdate.css({ - "marginTop":(this.volumeBar.handlePos + this.volumeBar.handleMid), - "height":(this.volumeBar.trackSize - this.volumeBar.handlePos) - }); - } - else { - this.volumeUpdate.css( "width", (vol * this.volumeBar.trackSize) ); - } - } - }; - - // Set up the volume bar. - this.volumeUpdate = controlBar.find( settings.ids.volumeUpdate ); - this.volumeBar = controlBar.find( settings.ids.volumeBar ).mediaslider( settings.ids.volumeHandle, settings.volumeVertical, settings.volumeVertical ); - if( this.volumeBar ) { - this.volumeBar.display.unbind("setvalue").bind("setvalue", function( event, data ) { - _this.setVolume( data ); - _this.display.trigger( "controlupdate", { - type:"volume", - value:data - }); - }); - this.volumeBar.display.unbind("updatevalue").bind("updatevalue", function( event, data ) { - _this.setVolume( data ); - _this.volume = data; - }); - } - - // Setup the mute button. - this.mute = controlBar.find(settings.ids.mute).medialink( settings, function( event, target ) { - _this.muteState = !_this.muteState; - _this.setToggle( target, _this.muteState ); - _this.setMute( _this.muteState ); - }); - - this.setMute = function( state ) { - this.prevVolume = (this.volumeBar.value > 0) ? this.volumeBar.value : this.prevVolume; - this.volumeBar.updateValue( state ? 0 : this.prevVolume ); - this.display.trigger( "controlupdate", { - type:"mute", - value:state - }); - }; - - this.setProgress = function( percent ) { - if( this.seekProgress && this.seekBar ) { - this.seekProgress.css( "width", (percent * (this.seekBar.trackSize + this.seekBar.handleSize)) ); - } - }; - - this.onResize = function() { - if( this.seekBar ) { - this.seekBar.onResize(); - } - this.setProgress( this.percentLoaded ); - }; - - // Handle the media events... - this.onMediaUpdate = function( data ) { - switch( data.type ) { - case "reset": - this.reset(); - break; - case "paused": - this.playState = true; - this.setToggle( this.playPauseButton.display, this.playState ); - break; - case "playing": - this.playState = false; - this.setToggle( this.playPauseButton.display, this.playState ); - break; - case "stopped": - this.playState = true; - this.setToggle( this.playPauseButton.display, this.playState ); - break; - case "progress": - this.percentLoaded = data.percentLoaded; - this.setProgress( this.percentLoaded ); - break; - case "meta": - case "update": - this.timeUpdate( data.currentTime, data.totalTime ); - if( this.volumeBar ) { - this.volumeBar.updateValue( data.volume ); - } - break; - default: - break; - } - }; - - // Call to reset all controls... - this.reset = function() { - this.totalTime.text( this.formatTime(0).time ); - this.currentTime.text( this.formatTime(0).time ); - if( this.seekBar ) { - this.seekBar.updateValue(0); - } - this.seekUpdate.css( "width", "0px" ); - this.seekProgress.css( "width", "0px" ); - }; - - this.timeUpdate = function( cTime, tTime ) { - this.duration = tTime; - this.totalTime.text( this.formatTime( tTime ).time ); - this.currentTime.text( this.formatTime( cTime ).time ); - if( tTime && this.seekBar && !this.seekBar.dragging ) { - this.seekBar.updateValue( cTime / tTime ); - } - }; - - // Reset the time values. - this.timeUpdate( 0, 0 ); - })( this, settings ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Called when the YouTube player is ready. - window.onDailymotionPlayerReady = function( playerId ) { - playerId = playerId.replace("_media", ""); - jQuery.media.players[playerId].node.player.media.player.onReady(); - }; - - // Tell the media player how to determine if a file path is a YouTube media type. - jQuery.media.playerTypes = jQuery.extend( jQuery.media.playerTypes, { - "dailymotion":function( file ) { - return (file.search(/^http(s)?\:\/\/(www\.)?dailymotion\.com/i) === 0); - } - }); - - jQuery.fn.mediadailymotion = function( options, onUpdate ) { - return new (function( video, options, onUpdate ) { - this.display = video; - var _this = this; - this.player = null; - this.videoFile = null; - this.meta = false; - this.loaded = false; - this.ready = false; - - this.createMedia = function( videoFile, preview ) { - this.videoFile = videoFile; - this.ready = false; - var playerId = (options.id + "_media"); - var rand = Math.floor(Math.random() * 1000000); - var flashPlayer = 'http://www.dailymotion.com/swf/' + videoFile.path + '?rand=' + rand + '&enablejsapi=1&playerapiid=' + playerId; - jQuery.media.utils.insertFlash( - this.display, - flashPlayer, - playerId, - "100%", - "100%", - {}, - options.wmode, - function( obj ) { - _this.player = obj; - _this.loadPlayer(); - } - ); - }; - - this.loadMedia = function( videoFile ) { - if( this.player ) { - this.loaded = false; - this.meta = false; - this.videoFile = videoFile; - - // Let them know the player is ready. - onUpdate( { - type:"playerready" - } ); - - // Load our video. - this.player.loadVideoById( this.videoFile.path, 0 ); - } - }; - - // Called when the player has finished loading. - this.onReady = function() { - this.ready = true; - this.loadPlayer(); - }; - - this.loadPlayer = function() { - if( this.ready && this.player ) { - // Create our callback functions. - window[options.id + 'StateChange'] = function( newState ) { - _this.onStateChange( newState ); - }; - - window[options.id + 'PlayerError'] = function( errorCode ) { - _this.onError( errorCode ); - }; - - // Add our event listeners. - this.player.addEventListener('onStateChange', options.id + 'StateChange'); - this.player.addEventListener('onError', options.id + 'PlayerError'); - - // Let them know the player is ready. - onUpdate( { - type:"playerready" - } ); - - // Load our video. - this.player.loadVideoById( this.videoFile.path, 0 ); - } - }; - - // Called when the player state changes. - this.onStateChange = function( newState ) { - var playerState = this.getPlayerState( newState ); - - // Alright... Dailymotion's status updates are just crazy... - // write some hacks to just make it work. - - if( !(!this.meta && playerState.state =="stopped") ) { - onUpdate( { - type:playerState.state, - busy:playerState.busy - } ); - } - - if( !this.loaded && playerState.state == "buffering" ) { - this.loaded = true; - onUpdate( { - type:"paused", - busy:"hide" - } ); - if( options.autostart ) { - this.playMedia(); - } - } - - if( !this.meta && playerState.state == "playing" ) { - // Set this player to meta. - this.meta = true; - - // Update our meta data. - onUpdate( { - type:"meta" - } ); - } - }; - - // Called when the player has an error. - this.onError = function( errorCode ) { - var errorText = "An unknown error has occured: " + errorCode; - if( errorCode == 100 ) { - errorText = "The requested video was not found. "; - errorText += "This occurs when a video has been removed (for any reason), "; - errorText += "or it has been marked as private."; - } else if( (errorCode == 101) || (errorCode == 150) ) { - errorText = "The video requested does not allow playback in an embedded player."; - } - onUpdate( { - type:"error", - data:errorText - } ); - }; - - // Translates the player state for the API player. - this.getPlayerState = function( playerState ) { - switch (playerState) { - case 5: - return {state:'ready', busy:false}; - case 3: - return {state:'buffering', busy:"show"}; - case 2: - return {state:'paused', busy:"hide"}; - case 1: - return {state:'playing', busy:"hide"}; - case 0: - return {state:'complete', busy:false}; - case -1: - return {state:'stopped', busy:false}; - default: - return {state:'unknown', busy:false}; - } - return 'unknown'; - }; - - /* - this.setSize = function( newWidth, newHeight ) { - this.player.setSize(newWidth, newHeight); - }; - */ - this.playMedia = function() { - onUpdate({ - type:"buffering", - busy:"show" - }); - this.player.playVideo(); - }; - - this.pauseMedia = function() { - this.player.pauseVideo(); - }; - - this.stopMedia = function() { - this.player.stopVideo(); - }; - - this.destroy = function() { - this.stopMedia(); - jQuery.media.utils.removeFlash( this.display, (options.id + "_media") ); - this.display.children().remove(); - }; - - this.seekMedia = function( pos ) { - onUpdate({ - type:"buffering", - busy:"show" - }); - this.player.seekTo( pos, true ); - }; - - this.setVolume = function( vol ) { - this.player.setVolume( vol * 100 ); - }; - - this.getVolume = function() { - return (this.player.getVolume() / 100); - }; - - this.getDuration = function() { - return this.player.getDuration(); - }; - - this.getCurrentTime = function() { - return this.player.getCurrentTime(); - }; - - this.getBytesLoaded = function() { - return this.player.getVideoBytesLoaded(); - }; - - this.getBytesTotal = function() { - return this.player.getVideoBytesTotal(); - }; - - this.getEmbedCode = function() { - return this.player.getVideoEmbedCode(); - }; - - this.getMediaLink = function() { - return this.player.getVideoUrl(); - }; - - this.hasControls = function() { - return true; - }; - this.showControls = function(show) {}; - this.setQuality = function( quality ) {}; - this.getQuality = function() { - return ""; - }; - })( this, options, onUpdate ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - volume:80, - autostart:false, - streamer:"", - embedWidth:450, - embedHeight:337, - wmode:"transparent", - forceOverflow:false, - quality:"default", - repeat:false - }); - - jQuery.fn.mediadisplay = function( options ) { - if( this.length === 0 ) { - return null; - } - return new (function( mediaWrapper, options ) { - this.settings = jQuery.media.utils.getSettings( options ); - this.display = mediaWrapper; - var _this = this; - this.volume = -1; - this.player = null; - this.preview = ''; - this.updateInterval = null; - this.progressInterval = null; - this.playQueue = []; - this.playIndex = 0; - this.playerReady = false; - this.loaded = false; - this.mediaFile = null; - this.hasPlaylist = false; - - // If they provide the forceOverflow variable, then that means they - // wish to force the media player to override all parents overflow settings. - if( this.settings.forceOverflow ) { - // Make sure that all parents have overflow visible so that - // browser full screen will always work. - this.display.parents().css("overflow", "visible"); - } - - this.reset = function() { - this.loaded = false; - this.stopMedia(); - clearInterval( this.progressInterval ); - clearInterval( this.updateInterval ); - this.playQueue.length = 0; - this.playQueue = []; - this.playIndex = 0; - this.playerReady = false; - this.mediaFile = null; - this.display.empty().trigger( "mediaupdate", {type:"reset"} ); - }; - - // Returns the media that has the lowest weight value, which means - // this player prefers that media over the others. - this.getPlayableMedia = function( files ) { - var mFile = null; - var i = files.length; - while(i--) { - var tempFile = new jQuery.media.file( files[i], this.settings ); - if( !mFile || (tempFile.weight < mFile.weight) ) { - mFile = tempFile; - } - } - return mFile; - }; - - // Returns a valid media file for this browser. - this.getMediaFile = function( file ) { - if( file ) { - var type = typeof file; - if( ((type === 'object') || (type === 'array')) && file[0] ) { - file = this.getPlayableMedia( file ); - } - } - return file; - }; - - // Adds a media file to the play queue. - this.addToQueue = function( file ) { - if( file ) { - this.playQueue.push( this.getMediaFile( file ) ); - } - }; - - this.loadFiles = function( files ) { - if( files ) { - this.playQueue.length = 0; - this.playQueue = []; - this.playIndex = 0; - this.addToQueue( files.intro ); - this.addToQueue( files.commercial ); - this.addToQueue( files.prereel ); - this.addToQueue( files.media ); - this.addToQueue( files.postreel ); - } - var hasMedia = (this.playQueue.length > 0); - if( !hasMedia ) { - if (this.player) { - // Destroy the current player. - this.player.destroy(); - this.player = null; - } - - this.display.trigger( "mediaupdate", {type:"nomedia"} ); - } - return hasMedia; - }; - - this.playNext = function() { - if( this.playQueue.length > this.playIndex ) { - this.loadMedia( this.playQueue[this.playIndex] ); - this.playIndex++; - } - else if( this.settings.repeat ) { - this.playIndex = 0; - this.playNext(); - } - else if( this.hasPlaylist ) { - this.reset(); - } - else { - // If there is no playlist, and no repeat, we will - // just seek to the beginning and pause. - this.loaded = false; - this.settings.autostart = false; - this.playIndex = 0; - this.playNext(); - } - }; - - this.loadMedia = function( file, mediaplayer ) { - if( file ) { - // Get the media file object. - file = new jQuery.media.file( this.getMediaFile( file ), this.settings ); - - // Set the media player if they force it. - file.player = mediaplayer ? mediaplayer : file.player; - - // Stop the current player. - this.stopMedia(); - - if( !this.mediaFile || (this.mediaFile.player != file.player) ) { - // Reset our player variables. - this.player = null; - this.playerReady = false; - - // Create a new media player. - if( file.player ) { - // Set the new media player. - this.player = this.display["media" + file.player]( this.settings, function( data ) { - _this.onMediaUpdate( data ); - }); - } - - if( this.player ) { - // Create our media player. - this.player.createMedia( file, this.preview ); - } - } - else if( this.player ) { - // Load our file into the current player. - this.player.loadMedia( file ); - } - - // Save this file. - this.mediaFile = file; - - // Send out an update about the initialize. - this.onMediaUpdate({ - type:"initialize" - }); - } - }; - - this.onMediaUpdate = function( data ) { - // Now trigger the media update message. - switch( data.type ) { - case "playerready": - this.playerReady = true; - this.player.setVolume(0); - this.player.setQuality(this.settings.quality); - this.startProgress(); - break; - case "buffering": - this.startProgress(); - break; - case "stopped": - clearInterval( this.progressInterval ); - clearInterval( this.updateInterval ); - break; - case "error": - if( data.code == 4 ) { - // It is saying not supported... Try and fall back to flash... - this.loadMedia(this.mediaFile, "flash"); - } - else { - clearInterval( this.progressInterval ); - clearInterval( this.updateInterval ); - } - break; - case "paused": - clearInterval( this.updateInterval ); - break; - case "playing": - this.startUpdate(); - break; - case "progress": - var percentLoaded = this.getPercentLoaded(); - jQuery.extend( data, { - percentLoaded:percentLoaded - }); - if( percentLoaded >= 1 ) { - clearInterval( this.progressInterval ); - } - break; - case "meta": - jQuery.extend( data, { - currentTime:this.player.getCurrentTime(), - totalTime:this.getDuration(), - volume: this.player.getVolume(), - quality: this.getQuality() - }); - break; - case "durationupdate": - this.mediaFile.duration = data.duration; - break; - case "complete": - this.playNext(); - break; - default: - break; - } - - // If this is the playing state, we want to pause the video. - if( data.type=="playing" && !this.loaded ) { - if( this.settings.autoLoad && !this.settings.autostart ) { - setTimeout( function() { - _this.setVolume(); - _this.player.pauseMedia(); - _this.settings.autostart = true; - _this.loaded = true; - }, 100 ); - } - else { - this.loaded = true; - this.setVolume(); - this.display.trigger( "mediaupdate", data ); - } - } - else { - this.display.trigger( "mediaupdate", data ); - } - }; - - this.startProgress = function() { - if( this.playerReady ) { - clearInterval( this.progressInterval ); - this.progressInterval = setInterval( function() { - _this.onMediaUpdate( { - type:"progress" - } ); - }, 500 ); - } - }; - - this.startUpdate = function() { - if( this.playerReady ) { - clearInterval( this.updateInterval ); - this.updateInterval = setInterval( function() { - if( _this.playerReady ) { - _this.onMediaUpdate({ - type:"update", - currentTime:_this.player.getCurrentTime(), - totalTime:_this.getDuration(), - volume:_this.player.getVolume(), - quality:_this.getQuality() - }); - } - }, 1000 ); - } - }; - - this.stopMedia = function() { - this.loaded = false; - clearInterval( this.progressInterval ); - clearInterval( this.updateInterval ); - if( this.playerReady ) { - this.player.stopMedia(); - } - }; - - this.mute = function( on ) { - this.player.setVolume( on ? 0 : this.volume ); - }; - - this.onResize = function() { - if( this.player && this.player.onResize ) { - this.player.onResize(); - } - }; - - this.getPercentLoaded = function() { - if( this.player.getPercentLoaded ) { - return this.player.getPercentLoaded(); - } - else { - var bytesLoaded = this.player.getBytesLoaded(); - var bytesTotal = this.mediaFile.bytesTotal ? this.mediaFile.bytesTotal : this.player.getBytesTotal(); - return bytesTotal ? (bytesLoaded / bytesTotal) : 0; - } - }; - - this.showControls = function(show) { - if( this.playerReady ) { - this.player.showControls(show); - } - }; - - this.hasControls = function() { - if( this.player ) { - return this.player.hasControls(); - } - return false; - }; - - this.getDuration = function() { - if( this.mediaFile ) { - if(!this.mediaFile.duration ) { - this.mediaFile.duration = this.player.getDuration(); - } - return this.mediaFile.duration; - } - else { - return 0; - } - }; - - this.setVolume = function( vol ) { - this.volume = vol ? vol : ((this.volume == -1) ? (this.settings.volume / 100) : this.volume); - if( this.player ) { - this.player.setVolume(this.volume); - } - }; - - this.getVolume = function() { - if( !this.volume ) { - this.volume = this.player.getVolume(); - } - return this.volume; - }; - - this.getQuality = function() { - if( !this.mediaFile.quality ) { - this.mediaFile.quality = this.player.getQuality(); - } - return this.mediaFile.quality; - }; - })( this, options ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - window.onFlashPlayerReady = function( id ) { - jQuery.media.players[id].node.player.media.player.onReady(); - }; - - window.onFlashPlayerUpdate = function( id, eventType ) { - jQuery.media.players[id].node.player.media.player.onMediaUpdate( eventType ); - }; - - window.onFlashPlayerDebug = function( debug ) { - if( window.console && console.log ) { - console.log( debug ); - } - }; - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - flashPlayer:"./flash/mediafront.swf", - skin:"default", - config:"nocontrols" - }); - - jQuery.fn.mediaflash = function( settings, onUpdate ) { - return new (function( video, settings, onUpdate ) { - settings = jQuery.media.utils.getSettings( settings ); - this.display = video; - var _this = this; - this.player = null; - this.mediaFile = null; - this.preview = ''; - this.ready = false; - - // Translate the messages. - this.translate = { - "mediaConnected":"connected", - "mediaBuffering":"buffering", - "mediaPaused":"paused", - "mediaPlaying":"playing", - "mediaStopped":"stopped", - "mediaComplete":"complete", - "mediaMeta":"meta" - }; - - // When to show the busy cursor. - this.busy = { - "mediaConnected":false, - "mediaBuffering":"show", - "mediaPaused":"hide", - "mediaPlaying":"hide", - "mediaStopped":false, - "mediaComplete":false, - "mediaMeta":false - }; - - this.createMedia = function( mediaFile, preview ) { - this.mediaFile = mediaFile; - this.preview = preview; - this.ready = false; - var playerId = (settings.id + "_media"); - var rand = Math.floor(Math.random() * 1000000); - var flashPlayer = settings.flashPlayer + "?rand=" + rand; - var flashvars = { - config:settings.config, - id:settings.id, - file:mediaFile.path, - image:this.preview, - skin:settings.skin, - autostart:(settings.autostart || !settings.autoLoad) - }; - if( mediaFile.stream ) { - flashvars.stream = mediaFile.stream; - } - if( settings.debug ) { - flashvars.debug = "1"; - } - jQuery.media.utils.insertFlash( - this.display, - flashPlayer, - playerId, - "100%", - "100%", - flashvars, - settings.wmode, - function( obj ) { - _this.player = obj; - _this.loadPlayer(); - } - ); - }; - - this.loadMedia = function( mediaFile ) { - if( this.player && this.ready ) { - this.mediaFile = mediaFile; - - // Load the new media file into the Flash player. - this.player.loadMedia( mediaFile.path, mediaFile.stream ); - - // Let them know the player is ready. - onUpdate( { - type:"playerready" - } ); - } - }; - - this.onReady = function() { - this.ready = true; - this.loadPlayer(); - }; - - this.loadPlayer = function() { - if( this.ready && this.player ) { - onUpdate( { - type:"playerready" - } ); - } - }; - - this.onMediaUpdate = function( eventType ) { - onUpdate( { - type:this.translate[eventType], - busy:this.busy[eventType] - }); - }; - - this.playMedia = function() { - if( this.player && this.ready ) { - this.player.playMedia(); - } - }; - - this.pauseMedia = function() { - if( this.player && this.ready ) { - this.player.pauseMedia(); - } - }; - - this.stopMedia = function() { - if( this.player && this.ready ) { - this.player.stopMedia(); - } - }; - - this.destroy = function() { - this.stopMedia(); - jQuery.media.utils.removeFlash( this.display, (settings.id + "_media") ); - this.display.children().remove(); - }; - - this.seekMedia = function( pos ) { - if( this.player && this.ready ) { - this.player.seekMedia( pos ); - } - }; - - this.setVolume = function( vol ) { - if( this.player && this.ready ) { - this.player.setVolume( vol ); - } - }; - - this.getVolume = function() { - return (this.player && this.ready) ? this.player.getVolume() : 0; - }; - - this.getDuration = function() { - return (this.player && this.ready) ? this.player.getDuration() : 0; - }; - - this.getCurrentTime = function() { - return (this.player && this.ready) ? this.player.getCurrentTime() : 0; - }; - - this.getBytesLoaded = function() { - return (this.player && this.ready) ? this.player.getMediaBytesLoaded() : 0; - }; - - this.getBytesTotal = function() { - return (this.player && this.ready) ? this.player.getMediaBytesTotal() : 0; - }; - - this.hasControls = function() { - return true; - }; - - this.showControls = function(show) { - if( this.player && this.ready ) { - this.player.showPlugin("controlBar", show); - this.player.showPlugin("playLoader", show); - } - }; - - this.getEmbedCode = function() { - var flashVars = { - config:"config", - id:"mediafront_player", - file:this.mediaFile.path, - image:this.preview, - skin:settings.skin - }; - if( this.mediaFile.stream ) { - flashVars.stream = this.mediaFile.stream; - } - return jQuery.media.utils.getFlash( - settings.flashPlayer, - "mediafront_player", - settings.embedWidth, - settings.embedHeight, - flashVars, - settings.wmode ); - }; - - // Not implemented yet... - this.setQuality = function( quality ) {}; - this.getQuality = function() { - return ""; - }; - //this.setSize = function( newWidth, newHeight ) {}; - this.getMediaLink = function() { - return "This video currently does not have a link."; - }; - })( this, settings, onUpdate ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - jQuery.fn.mediahtml5 = function( options, onUpdate ) { - return new (function( media, options, onUpdate ) { - this.display = media; - var _this = this; - this.player = null; - this.bytesLoaded = 0; - this.bytesTotal = 0; - this.mediaType = ""; - this.loaded = false; - this.mediaFile = null; - this.playerElement = null; - - this.getPlayer = function( mediaFile, preview ) { - this.mediaFile = mediaFile; - var playerId = options.id + '_' + this.mediaType; - var html = '<' + this.mediaType + ' style="position:absolute" id="' + playerId + '"'; - html += preview ? ' poster="' + preview + '"' : ''; - - if( typeof mediaFile === 'array' ) { - html += '>'; - var i = mediaFile.length; - while(i) { - i--; - html += ''; - } - } - else { - html += ' src="' + mediaFile.path + '">Unable to display media.'; - } - - html += ''; - this.display.append( html ); - this.bytesTotal = mediaFile.bytesTotal; - this.playerElement = this.display.find('#' + playerId); - this.onResize(); - - // return the player object. - return this.playerElement.eq(0)[0]; - }; - - // Create a new HTML5 player. - this.createMedia = function( mediaFile, preview ) { - // Remove any previous Flash players. - jQuery.media.utils.removeFlash( this.display, options.id + "_media" ); - this.display.children().remove(); - this.mediaType = this.getMediaType( mediaFile ); - this.player = this.getPlayer( mediaFile, preview ); - this.loaded = false; - var timeupdated = false; - if( this.player ) { - this.player.addEventListener( "abort", function() { - onUpdate( { - type:"stopped" - } ); - }, true); - this.player.addEventListener( "loadstart", function() { - onUpdate( { - type:"ready", - busy:"show" - }); - - _this.onReady(); - }, true); - this.player.addEventListener( "loadeddata", function() { - onUpdate( { - type:"loaded", - busy:"hide" - }); - }, true); - this.player.addEventListener( "loadedmetadata", function() { - onUpdate( { - type:"meta" - } ); - }, true); - this.player.addEventListener( "canplaythrough", function() { - onUpdate( { - type:"canplay", - busy:"hide" - }); - }, true); - this.player.addEventListener( "ended", function() { - onUpdate( { - type:"complete" - } ); - }, true); - this.player.addEventListener( "pause", function() { - onUpdate( { - type:"paused" - } ); - }, true); - this.player.addEventListener( "play", function() { - onUpdate( { - type:"playing" - } ); - }, true); - this.player.addEventListener( "playing", function() { - onUpdate( { - type:"playing", - busy:"hide" - }); - }, true); - this.player.addEventListener( "error", function(e) { - _this.onError(e.target.error); - onUpdate( { - type:"error", - code:e.target.error.code - } ); - }, true); - this.player.addEventListener( "waiting", function() { - onUpdate( { - type:"waiting", - busy:"show" - }); - }, true); - this.player.addEventListener( "timeupdate", function() { - if( timeupdated ) { - onUpdate( { - type:"timeupdate", - busy:"hide" - }); - } - else { - timeupdated = true; - } - }, true); - this.player.addEventListener( "durationchange", function() { - if( this.duration && (this.duration !== Infinity) ) { - onUpdate( { - type:"durationupdate", - duration:this.duration - }); - } - }, true); - - // Now add the event for getting the progress indication. - this.player.addEventListener( "progress", function( event ) { - _this.bytesLoaded = event.loaded; - _this.bytesTotal = event.total; - }, true); - - this.player.autoplay = true; - - if (typeof this.player.hasAttribute == "function" && this.player.hasAttribute("preload") && this.player.preload != "none") { - this.player.autobuffer = true; - } else { - this.player.autobuffer = false; - this.player.preload = "none"; - } - - onUpdate({ - type:"playerready" - }); - } - }; - - // A function to be called when an error occurs. - this.onError = function( error ) { - switch(error.code) { - case 1: - console.log("Error: MEDIA_ERR_ABORTED"); - break; - case 2: - console.log("Error: MEDIA_ERR_DECODE"); - break; - case 3: - console.log("Error: MEDIA_ERR_NETWORK"); - break; - case 4: - console.log("Error: MEDIA_ERR_SRC_NOT_SUPPORTED"); - break; - default: - break; - } - }; - - // Called when the media has started loading. - this.onReady = function() { - if( !this.loaded ) { - this.loaded = true; - this.playMedia(); - } - }; - - // Load new media into the HTML5 player. - this.loadMedia = function( mediaFile ) { - this.mediaFile = mediaFile; - this.createMedia( mediaFile ); - }; - - this.getMediaType = function( mediaFile ) { - var extension = (typeof mediaFile === 'array') ? mediaFile[0].extension : mediaFile.extension; - switch( extension ) { - case "ogg": case "ogv": case "mp4": case "m4v": - return "video"; - - case "oga": case "mp3": - return "audio"; - - default: - break; - } - return "video"; - }; - - this.playMedia = function() { - if( this.player && this.player.play ) { - this.player.play(); - } - }; - - this.pauseMedia = function() { - if( this.player && this.player.pause ) { - this.player.pause(); - } - }; - - this.stopMedia = function() { - this.pauseMedia(); - if( this.player ) { - this.player.src = ""; - } - }; - - this.destroy = function() { - this.stopMedia(); - this.display.children().remove(); - }; - - this.seekMedia = function( pos ) { - if( this.player ) { - this.player.currentTime = pos; - } - }; - - this.setVolume = function( vol ) { - if( this.player ) { - this.player.volume = vol; - } - }; - - this.getVolume = function() { - return this.player ? this.player.volume : 0; - }; - - this.getDuration = function() { - var dur = this.player ? this.player.duration : 0; - return (dur === Infinity) ? 0 : dur; - }; - - this.getCurrentTime = function() { - return this.player ? this.player.currentTime : 0; - }; - - this.getPercentLoaded = function() { - if( this.player && this.player.buffered && this.player.duration ) { - return (this.player.buffered.end(0) / this.player.duration); - } - else if( this.bytesTotal ) { - return (this.bytesLoaded / this.bytesTotal); - } - else { - return 0; - } - }; - - // Called when the player resizes. - this.onResize = function() { - // If this is a video, set the width and height of the video element. - if( this.mediaType == "video" ) { - this.playerElement.css({width:this.display.width(), height:this.display.height()}); - } - }; - - // Not implemented yet... - this.setQuality = function( quality ) {}; - this.getQuality = function() { - return ""; - }; - this.hasControls = function() { - return false; - }; - this.showControls = function(show) {}; - //this.setSize = function( newWidth, newHeight ) {}; - this.getEmbedCode = function() { - - // Only return the Flash embed if this is a Flash playable media field. - if( (this.mediaFile.extension == 'mp4') || - (this.mediaFile.extension == 'm4v') || - (this.mediaFile.extension == 'webm') ) { - var flashVars = { - config:"config", - id:"mediafront_player", - file:this.mediaFile.path, - image:this.preview, - skin:options.skin - }; - if( this.mediaFile.stream ) { - flashVars.stream = this.mediaFile.stream; - } - return jQuery.media.utils.getFlash( - options.flashPlayer, - "mediafront_player", - options.embedWidth, - options.embedHeight, - flashVars, - options.wmode ); - } - else { - return "This media does not support embedding."; - } - }; - this.getMediaLink = function() { - return "This media currently does not have a link."; - }; - })( this, options, onUpdate ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - logo:"logo.png", - logoWidth:49, - logoHeight:15, - logopos:"sw", - logox:5, - logoy:5, - link:"http://www.mediafront.org", - file:"", - image:"", - timeout:8, - autoLoad:true - }); - - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - busy:"#mediabusy", - preview:"#mediapreview", - play:"#mediaplay", - media:"#mediadisplay" - }); - - jQuery.fn.minplayer = function( settings ) { - if( this.length === 0 ) { - return null; - } - return new (function( player, settings ) { - // Get the settings. - settings = jQuery.media.utils.getSettings(settings); - - // Save the jQuery display. - this.display = player; - var _this = this; - - // If the player should auto load or not. - this.autoLoad = settings.autoLoad; - - // Store the busy cursor and data. - this.busy = player.find( settings.ids.busy ); - this.busyImg = this.busy.find("img"); - this.busyWidth = this.busyImg.width(); - this.busyHeight = this.busyImg.height(); - - // Store the play overlay. - this.play = player.find( settings.ids.play ); - // Toggle the play/pause state if they click on the play button. - this.play.unbind("click").bind("click", function() { - _this.togglePlayPause(); - }); - this.playImg = this.play.find("img"); - this.playWidth = this.playImg.width(); - this.playHeight = this.playImg.height(); - - // Store the preview image. - this.preview = player.find( settings.ids.preview ).mediaimage(); - if( this.preview ) { - this.preview.display.unbind("click").bind("click", function() { - _this.onMediaClick(); - }); - - this.preview.display.unbind("imageLoaded").bind("imageLoaded", function() { - _this.onPreviewLoaded(); - }); - } - - // The internal player controls. - this.usePlayerControls = false; - this.busyFlags = 0; - this.busyVisible = false; - this.playVisible = false; - this.previewVisible = false; - this.playing = false; - this.hasMedia = false; - this.timeoutId = 0; - - // Cache the width and height. - this.width = this.display.width(); - this.height = this.display.height(); - - // Hide or show an element. - this.showElement = function( element, show, tween ) { - if( element && !this.usePlayerControls ) { - if( show ) { - element.show(tween); - } - else { - element.hide(tween); - } - } - }; - - this.showPlay = function( show, tween ) { - show &= this.hasMedia; - this.playVisible = show; - this.showElement( this.play, show, tween ); - }; - - this.showBusy = function( id, show, tween ) { - if( show ) { - this.busyFlags |= (1 << id); - } - else { - this.busyFlags &= ~(1 << id); - } - - // Set the busy cursor visiblility. - this.busyVisible = (this.busyFlags > 0); - this.showElement( this.busy, this.busyVisible, tween ); - - // If the media has finished loading, then we don't need the - // loader for the image. - if (id==1 && !show) { - this.showBusy(3, false); - } - }; - - this.showPreview = function( show, tween ) { - this.previewVisible = show; - if( this.preview ) { - this.showElement( this.preview.display, show, tween ); - } - }; - - // Handle the control events. - this.onControlUpdate = function( data ) { - if( this.media ) { - // If the player is ready. - if( this.media.playerReady ) { - switch( data.type ) { - case "play": - this.media.player.playMedia(); - break; - case "pause": - this.media.player.pauseMedia(); - break; - case "seek": - this.media.player.seekMedia( data.value ); - break; - case "volume": - this.media.setVolume( data.value ); - break; - case "mute": - this.media.mute( data.value ); - break; - default: - break; - } - } - // If there are files in the queue but no current media file. - else if( (this.media.playQueue.length > 0) && !this.media.mediaFile ) { - // They interacted with the player. Always autoload at this point on. - this.autoLoad = true; - - // Then play the next file in the queue. - this.playNext(); - } - - // Let the template do something... - if( settings.template && settings.template.onControlUpdate ) { - settings.template.onControlUpdate( data ); - } - } - }; - - // Handle the full screen event requests. - this.fullScreen = function( full ) { - if( settings.template.onFullScreen ) { - settings.template.onFullScreen( full ); - } - - // Refresh the preview image. - this.preview.refresh(); - }; - - // Handle when the preview image loads. - this.onPreviewLoaded = function() { - this.previewVisible = true; - }; - - // Handle the media events. - this.onMediaUpdate = function( data ) { - switch( data.type ) { - case "paused": - this.playing = false; - this.showPlay(true); - //this.showBusy(1, false); - if( !this.media.loaded ) { - this.showPreview(true); - } - break; - case "update": - case "playing": - this.playing = true; - this.showPlay(false); - this.showPreview((this.media.mediaFile.type == "audio")); - break; - case "initialize": - this.playing = false; - this.showPlay(true); - this.showBusy(1, this.autoLoad); - this.showPreview(true); - break; - case "buffering": - this.showPlay(true); - this.showPreview((this.media.mediaFile.type == "audio")); - break; - default: - break; - } - - // If they provide a busy cursor. - if( data.busy ) { - this.showBusy(1, (data.busy == "show")); - } - }; - - // Called when the media is clicked. - this.onMediaClick = function() { - if( this.media.player && !this.media.hasControls() ) { - if( this.playing ) { - this.media.player.pauseMedia(); - } - else { - this.media.player.playMedia(); - } - } - }; - - // Set the media player. - this.media = this.display.find( settings.ids.media ).mediadisplay( settings ); - if( this.media ) { - // If they click on the media region, then pause the media. - this.media.display.unbind("click").bind("click", function() { - _this.onMediaClick(); - }); - } - - // Sets the logo position. - this.setLogoPos = function() { - if( this.logo ) { - var logocss = {}; - if( settings.logopos=='se' || settings.logopos=='sw' ) { - logocss['bottom'] = settings.logoy; - } - if( settings.logopos=='ne' || settings.logopos=='nw' ) { - logocss['top'] = settings.logoy; - } - if( settings.logopos=='nw' || settings.logopos=='sw' ) { - logocss['left'] = settings.logox; - } - if( settings.logopos=='ne' || settings.logopos=='se' ) { - logocss['right'] = settings.logox; - } - this.logo.display.css(logocss); - } - }; - - // Add the logo. - if( !settings.controllerOnly ) { - this.display.prepend(''); - this.logo = this.display.find("." + settings.prefix + "medialogo").mediaimage( settings.link ); - if( this.logo ) { - this.logo.display.css({ - width:settings.logoWidth, - height:settings.logoHeight - }); - this.logo.display.bind("imageLoaded", function() { - _this.setLogoPos(); - }); - this.logo.loadImage( settings.logo ); - } - } - - // Reset to previous state... - this.reset = function() { - this.hasMedia = false; - this.playing = false; - jQuery.media.players[settings.id].showNativeControls(false); - this.showPlay(true); - this.showPreview(true); - clearTimeout( this.timeoutId ); - if( this.media ) { - this.media.reset(); - } - }; - - // Toggle the play/pause state. - this.togglePlayPause = function() { - if( this.media ) { - if( this.media.playerReady ) { - if( this.playing ) { - this.showPlay(true); - this.media.player.pauseMedia(); - } - else { - this.showPlay(false); - this.media.player.playMedia(); - } - } - else if( (this.media.playQueue.length > 0) && !this.media.mediaFile ) { - // They interacted with the player. Always autoload at this point on. - this.autoLoad = true; - - // Then play the next file in the queue. - this.playNext(); - } - } - }; - - // Loads an image... - this.loadImage = function( image ) { - if( this.preview ) { - // Show a busy cursor for the image loading... - this.showBusy(3, true); - - // Load the image. - this.preview.loadImage( image ); - - // Set and interval to check if the image is loaded. - var imageInterval = setInterval(function() { - - // If the image is loaded, then clear the interval. - if (_this.preview.loaded()) { - - // Clear the interval and stop the busy cursor. - clearInterval(imageInterval); - _this.showBusy(3, false); - } - }, 500); - - // Now set the preview image in the media player. - if( this.media ) { - this.media.preview = image; - } - } - }; - - this.onResize = function() { - if( this.preview ) { - this.preview.refresh(); - } - - if( this.media ) { - this.media.onResize(); - } - }; - - // Clears the loaded image. - this.clearImage = function() { - if( this.preview ) { - this.preview.clear(); - } - }; - - // Expose the public load functions from the media display. - this.loadFiles = function( files ) { - this.reset(); - this.hasMedia = this.media && this.media.loadFiles(files); - if( this.hasMedia && this.autoLoad ) { - this.media.playNext(); - } - else if( !this.hasMedia ) { - // Hide the overlays for non-media types. - this.showPlay(false); - this.showPreview(true); - this.timeoutId = setTimeout( function() { - _this.media.display.trigger( "mediaupdate", {type:"complete"} ); - }, (settings.timeout * 1000) ); - } - return this.hasMedia; - }; - - // Play the next file. - this.playNext = function() { - if( this.media ) { - this.media.playNext(); - } - }; - - // Check the player for controls. - this.hasControls = function() { - if( this.media ) { - return this.media.hasControls(); - } - return true; - }; - - // Show the native controls. - this.showControls = function( show ) { - if( this.media ) { - this.media.showControls( show ); - } - }; - - // Loads a single media file. - this.loadMedia = function( file ) { - this.reset(); - if( this.media ) { - this.media.loadMedia( file ); - } - }; - - // If they provide a file, then load it. - if( settings.file ) { - this.loadMedia( settings.file ); - } - - // If they provide the image, then load it. - if( settings.image ) { - this.loadImage( settings.image ); - } - })( this, settings ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - window.onVimeoReady = function( playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onReady(); - }; - - window.onVimeoFinish = function( playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onFinished(); - }; - - window.onVimeoLoading = function( data, playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onLoading( data ); - }; - - window.onVimeoPlay = function( playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onPlaying(); - }; - - window.onVimeoPause = function( playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onPaused(); - }; - - window.onVimeoProgress = function( time, playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onProgress(time); - }; - - // Tell the media player how to determine if a file path is a YouTube media type. - jQuery.media.playerTypes = jQuery.extend( jQuery.media.playerTypes, { - "vimeo":function( file ) { - return (file.search(/^http(s)?\:\/\/(www\.)?vimeo\.com/i) === 0); - } - }); - - jQuery.fn.mediavimeo = function( options, onUpdate ) { - return new (function( video, options, onUpdate ) { - this.display = video; - var _this = this; - this.player = null; - this.videoFile = null; - this.ready = false; - this.bytesLoaded = 0; - this.bytesTotal = 0; - this.currentVolume = 1; - - this.createMedia = function( videoFile, preview ) { - this.videoFile = videoFile; - this.ready = false; - var playerId = (options.id + "_media"); - var flashvars = { - clip_id:this.getId(videoFile.path), - width:"100%", - height:"100%", - js_api:'1', - js_onLoad:'onVimeoReady', - js_swf_id:playerId - }; - var rand = Math.floor(Math.random() * 1000000); - var flashPlayer = 'http://vimeo.com/moogaloop.swf?rand=' + rand; - jQuery.media.utils.insertFlash( - this.display, - flashPlayer, - playerId, - "100%", - "100%", - flashvars, - options.wmode, - function( obj ) { - _this.player = obj; - _this.loadPlayer(); - } - ); - }; - - this.getId = function( path ) { - var regex = /^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i; - return (path.search(regex) === 0) ? path.replace(regex, "$3") : path; - }; - - this.loadMedia = function( videoFile ) { - this.bytesLoaded = 0; - this.bytesTotal = 0; - this.createMedia( videoFile ); - }; - - // Called when the player has finished loading. - this.onReady = function() { - this.ready = true; - this.loadPlayer(); - }; - - // Load the player. - this.loadPlayer = function() { - if( this.ready && this.player && this.player.api_addEventListener ) { - // Add our event listeners. - this.player.api_addEventListener('onProgress', 'onVimeoProgress'); - this.player.api_addEventListener('onFinish', 'onVimeoFinish'); - this.player.api_addEventListener('onLoading', 'onVimeoLoading'); - this.player.api_addEventListener('onPlay', 'onVimeoPlay'); - this.player.api_addEventListener('onPause', 'onVimeoPause'); - - // Let them know the player is ready. - onUpdate({ - type:"playerready" - }); - - this.playMedia(); - } - }; - - this.onFinished = function() { - onUpdate({ - type:"complete" - }); - }; - - this.onLoading = function( data ) { - this.bytesLoaded = data.bytesLoaded; - this.bytesTotal = data.bytesTotal; - }; - - this.onPlaying = function() { - onUpdate({ - type:"playing", - busy:"hide" - }); - }; - - this.onPaused = function() { - onUpdate({ - type:"paused", - busy:"hide" - }); - }; - - this.playMedia = function() { - onUpdate({ - type:"playing", - busy:"hide" - }); - if (this.player.api_play) { - this.player.api_play(); - } - }; - - this.onProgress = function( time ) { - onUpdate({ - type:"progress" - }); - }; - - this.pauseMedia = function() { - onUpdate({ - type:"paused", - busy:"hide" - }); - if (this.player.api_pause) { - this.player.api_pause(); - } - }; - - this.stopMedia = function() { - this.pauseMedia(); - if (this.player.api_unload) { - this.player.api_unload(); - } - }; - - this.destroy = function() { - this.stopMedia(); - jQuery.media.utils.removeFlash( this.display, (options.id + "_media") ); - this.display.children().remove(); - }; - - this.seekMedia = function( pos ) { - if (this.player.api_seekTo) { - this.player.api_seekTo( pos ); - } - }; - - this.setVolume = function( vol ) { - this.currentVolume = vol; - if (this.player.api_setVolume) { - this.player.api_setVolume( (vol*100) ); - } - }; - - // For some crazy reason... Vimeo has not implemented this... so just cache the value. - this.getVolume = function() { - return this.currentVolume; - }; - - this.getDuration = function() { - return this.player.api_getDuration ? this.player.api_getDuration() : 0; - }; - - this.getCurrentTime = function() { - return this.player.api_getCurrentTime ? this.player.api_getCurrentTime() : 0; - }; - - this.getBytesLoaded = function() { - return this.bytesLoaded; - }; - - this.getBytesTotal = function() { - return this.bytesTotal; - }; - - // Not implemented yet... - this.setQuality = function( quality ) {}; - this.getQuality = function() { - return ""; - }; - this.hasControls = function() { - return true; - }; - this.showControls = function(show) {}; - //this.setSize = function( newWidth, newHeight ) {}; - this.getEmbedCode = function() { - return "This video cannot be embedded."; - }; - this.getMediaLink = function() { - return "This video currently does not have a link."; - }; - })( this, options, onUpdate ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Called when the YouTube player is ready. - window.onYouTubePlayerReady = function( playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onReady(); - }; - - // Tell the media player how to determine if a file path is a YouTube media type. - jQuery.media.playerTypes = jQuery.extend( jQuery.media.playerTypes, { - "youtube":function( file ) { - return (file.search(/^http(s)?\:\/\/(www\.)?youtube\.com/i) === 0); - } - }); - - jQuery.fn.mediayoutube = function( options, onUpdate ) { - return new (function( video, options, onUpdate ) { - this.display = video; - var _this = this; - this.player = null; - this.videoFile = null; - this.loaded = false; - this.ready = false; - this.qualities = []; - - this.createMedia = function( videoFile, preview ) { - this.videoFile = videoFile; - this.ready = false; - var playerId = (options.id + "_media"); - var rand = Math.floor(Math.random() * 1000000); - var flashPlayer = 'http://www.youtube.com/apiplayer?rand=' + rand + '&version=3&enablejsapi=1&playerapiid=' + playerId; - jQuery.media.utils.insertFlash( - this.display, - flashPlayer, - playerId, - "100%", - "100%", - {}, - options.wmode, - function( obj ) { - _this.player = obj; - _this.loadPlayer(); - } - ); - }; - - this.getId = function( path ) { - var regex = /^http[s]?\:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9]+)/i; - return (path.search(regex) === 0) ? path.replace(regex, "$2") : path; - }; - - this.loadMedia = function( videoFile ) { - if( this.player ) { - this.loaded = false; - this.videoFile = videoFile; - - // Let them know the player is ready. - onUpdate( { - type:"playerready" - } ); - - // Load our video. - if (this.player.loadVideoById) { - this.player.loadVideoById( this.getId( this.videoFile.path ), 0, options.quality ); - } - } - }; - - // Called when the player has finished loading. - this.onReady = function() { - this.ready = true; - this.loadPlayer(); - }; - - // Try to load the player. - this.loadPlayer = function() { - if( this.ready && this.player ) { - // Create our callback functions. - window[options.id + 'StateChange'] = function( newState ) { - _this.onStateChange( newState ); - }; - - window[options.id + 'PlayerError'] = function( errorCode ) { - _this.onError( errorCode ); - }; - - window[options.id + 'QualityChange'] = function( newQuality ) { - _this.quality = newQuality; - }; - - // Add our event listeners. - if (this.player.addEventListener) { - this.player.addEventListener('onStateChange', options.id + 'StateChange'); - this.player.addEventListener('onError', options.id + 'PlayerError'); - this.player.addEventListener('onPlaybackQualityChange', options.id + 'QualityChange'); - } - - // Get all of the quality levels. - if (this.player.getAvailableQualityLevels) { - this.qualities = this.player.getAvailableQualityLevels(); - } - - // Let them know the player is ready. - onUpdate( { - type:"playerready" - }); - - // Load our video. - if (this.player.loadVideoById) { - this.player.loadVideoById( this.getId( this.videoFile.path ), 0 ); - } - } - }; - - // Called when the YouTube player state changes. - this.onStateChange = function( newState ) { - var playerState = this.getPlayerState( newState ); - onUpdate( { - type:playerState.state, - busy:playerState.busy - } ); - - if( !this.loaded && playerState == "playing" ) { - // Set this player to loaded. - this.loaded = true; - - // Update our meta data. - onUpdate( { - type:"meta" - } ); - } - }; - - // Called when the YouTube player has an error. - this.onError = function( errorCode ) { - var errorText = "An unknown error has occured: " + errorCode; - if( errorCode == 100 ) { - errorText = "The requested video was not found. "; - errorText += "This occurs when a video has been removed (for any reason), "; - errorText += "or it has been marked as private."; - } else if( (errorCode == 101) || (errorCode == 150) ) { - errorText = "The video requested does not allow playback in an embedded player."; - } - if( window.console && console.log ) { - console.log(errorText); - } - onUpdate( { - type:"error", - data:errorText - } ); - }; - - // Translates the player state for the YouTube API player. - this.getPlayerState = function( playerState ) { - switch (playerState) { - case 5: - return {state:'ready', busy:false}; - case 3: - return {state:'buffering', busy:"show"}; - case 2: - return {state:'paused', busy:"hide"}; - case 1: - return {state:'playing', busy:"hide"}; - case 0: - return {state:'complete', busy:false}; - case -1: - return {state:'stopped', busy:false}; - default: - return {state:'unknown', busy:false}; - } - return 'unknown'; - }; - /* - this.setSize = function( newWidth, newHeight ) { - //this.player.setSize(newWidth, newHeight); - }; - */ - this.playMedia = function() { - onUpdate({ - type:"buffering", - busy:"show" - }); - if (this.player.playVideo) { - this.player.playVideo(); - } - }; - - this.pauseMedia = function() { - if (this.player.pauseVideo) { - this.player.pauseVideo(); - } - }; - - this.stopMedia = function() { - if (this.player.stopVideo) { - this.player.stopVideo(); - } - }; - - this.destroy = function() { - this.stopMedia(); - jQuery.media.utils.removeFlash( this.display, (options.id + "_media") ); - this.display.children().remove(); - }; - - this.seekMedia = function( pos ) { - onUpdate({ - type:"buffering", - busy:"show" - }); - if (this.player.seekTo) { - this.player.seekTo( pos, true ); - } - }; - - this.setVolume = function( vol ) { - if (this.player.setVolume) { - this.player.setVolume( vol * 100 ); - } - }; - - this.setQuality = function( quality ) { - if (this.player.setPlaybackQuality) { - this.player.setPlaybackQuality( quality ); - } - }; - - this.getVolume = function() { - return this.player.getVolume ? (this.player.getVolume() / 100) : 0; - }; - - this.getDuration = function() { - return this.player.getDuration ? this.player.getDuration() : 0; - }; - - this.getCurrentTime = function() { - return this.player.getCurrentTime ? this.player.getCurrentTime() : 0; - }; - - this.getQuality = function() { - return this.player.getPlaybackQuality ? this.player.getPlaybackQuality() : 0; - }; - - this.getEmbedCode = function() { - return this.player.getVideoEmbedCode ? this.player.getVideoEmbedCode() : 0; - }; - - this.getMediaLink = function() { - return this.player.getVideoUrl ? this.player.getVideoUrl() : 0; - }; - - this.getBytesLoaded = function() { - return this.player.getVideoBytesLoaded ? this.player.getVideoBytesLoaded() : 0; - }; - - this.getBytesTotal = function() { - return this.player.getVideoBytesTotal ? this.player.getVideoBytesTotal() : 0; - }; - - this.hasControls = function() { - return false; - }; - this.showControls = function(show) {}; - })( this, options, onUpdate ); - }; -})(jQuery); \ No newline at end of file diff --git a/js/jquery.osmplayer.compressed.js b/js/jquery.osmplayer.compressed.js deleted file mode 100644 index f6a4348c..00000000 --- a/js/jquery.osmplayer.compressed.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(c){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media=jQuery.extend({},{auto:function(d){return new (function(e){this.json=jQuery.media.json(e);this.rpc=jQuery.media.rpc(e);this.call=function(j,i,f,h,g){if(g=="json"){this.json.call(j,i,f,h,g);}else{this.rpc.call(j,i,f,h,g);}};})(d);}},jQuery.media);jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{volumeVertical:false});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{currentTime:"#mediacurrenttime",totalTime:"#mediatotaltime",playPause:"#mediaplaypause",seekUpdate:"#mediaseekupdate",seekProgress:"#mediaseekprogress",seekBar:"#mediaseekbar",seekHandle:"#mediaseekhandle",volumeUpdate:"#mediavolumeupdate",volumeBar:"#mediavolumebar",volumeHandle:"#mediavolumehandle",mute:"#mediamute"});jQuery.fn.mediacontrol=function(d){if(this.length===0){return null;}return new (function(g,e){e=jQuery.media.utils.getSettings(e);this.display=g;var h=this;this.formatTime=(e.template&&e.template.formatTime)?e.template.formatTime:function(l){l=l?l:0;var m=0;var j=0;var i=0;i=Math.floor(l/3600);l-=(i*3600);j=Math.floor(l/60);l-=(j*60);m=Math.floor(l%60);var k="";if(i){k+=String(i);k+=":";}k+=(j>=10)?String(j):("0"+String(j));k+=":";k+=(m>=10)?String(m):("0"+String(m));return{time:k,units:""};};this.setToggle=function(j,k){var i=k?".on":".off";var l=k?".off":".on";if(j){j.find(i).show();j.find(l).hide();}};var f=this.formatTime(0);this.duration=0;this.volume=-1;this.prevVolume=0;this.percentLoaded=0;this.playState=false;this.muteState=false;this.currentTime=g.find(e.ids.currentTime).text(f.time);this.totalTime=g.find(e.ids.totalTime).text(f.time);this.display.find("a.mediaplayerlink").each(function(){var i=c(this).attr("href");c(this).medialink(e,function(j){j.preventDefault();h.display.trigger(j.data.id);},{id:i.substr(1),obj:c(this)});});this.playPauseButton=g.find(e.ids.playPause).medialink(e,function(i,j){h.playState=!h.playState;h.setToggle(j,h.playState);h.display.trigger("controlupdate",{type:(h.playState?"pause":"play")});});this.seekUpdate=g.find(e.ids.seekUpdate).css("width",0);this.seekProgress=g.find(e.ids.seekProgress).css("width",0);this.seekBar=g.find(e.ids.seekBar).mediaslider(e.ids.seekHandle,false);if(this.seekBar){this.seekBar.display.unbind("setvalue").bind("setvalue",function(i,j){h.seekUpdate.css("width",(j*h.seekBar.trackSize)+"px");h.display.trigger("controlupdate",{type:"seek",value:(j*h.duration)});});this.seekBar.display.unbind("updatevalue").bind("updatevalue",function(i,j){h.seekUpdate.css("width",(j*h.seekBar.trackSize)+"px");});}this.setVolume=function(i){if(this.volumeBar){if(e.volumeVertical){this.volumeUpdate.css({marginTop:(this.volumeBar.handlePos+this.volumeBar.handleMid),height:(this.volumeBar.trackSize-this.volumeBar.handlePos)});}else{this.volumeUpdate.css("width",(i*this.volumeBar.trackSize));}}};this.volumeUpdate=g.find(e.ids.volumeUpdate);this.volumeBar=g.find(e.ids.volumeBar).mediaslider(e.ids.volumeHandle,e.volumeVertical,e.volumeVertical);if(this.volumeBar){this.volumeBar.display.unbind("setvalue").bind("setvalue",function(i,j){h.setVolume(j);h.display.trigger("controlupdate",{type:"volume",value:j});});this.volumeBar.display.unbind("updatevalue").bind("updatevalue",function(i,j){h.setVolume(j);h.volume=j;});}this.mute=g.find(e.ids.mute).medialink(e,function(i,j){h.muteState=!h.muteState;h.setToggle(j,h.muteState);h.setMute(h.muteState);});this.setMute=function(i){this.prevVolume=(this.volumeBar.value>0)?this.volumeBar.value:this.prevVolume;this.volumeBar.updateValue(i?0:this.prevVolume);this.display.trigger("controlupdate",{type:"mute",value:i});};this.setProgress=function(i){if(this.seekProgress&&this.seekBar){this.seekProgress.css("width",(i*(this.seekBar.trackSize+this.seekBar.handleSize)));}};this.onResize=function(){if(this.seekBar){this.seekBar.onResize();}this.setProgress(this.percentLoaded);};this.onMediaUpdate=function(i){switch(i.type){case"reset":this.reset();break;case"paused":this.playState=true;this.setToggle(this.playPauseButton.display,this.playState);break;case"playing":this.playState=false;this.setToggle(this.playPauseButton.display,this.playState);break;case"stopped":this.playState=true;this.setToggle(this.playPauseButton.display,this.playState);break;case"progress":this.percentLoaded=i.percentLoaded;this.setProgress(this.percentLoaded);break;case"meta":case"update":this.timeUpdate(i.currentTime,i.totalTime);if(this.volumeBar){this.volumeBar.updateValue(i.volume);}break;default:break;}};this.reset=function(){this.totalTime.text(this.formatTime(0).time);this.currentTime.text(this.formatTime(0).time);if(this.seekBar){this.seekBar.updateValue(0);}this.seekUpdate.css("width","0px");this.seekProgress.css("width","0px");};this.timeUpdate=function(i,j){this.duration=j;this.totalTime.text(this.formatTime(j).time);this.currentTime.text(this.formatTime(i).time);if(j&&this.seekBar&&!this.seekBar.dragging){this.seekBar.updateValue(i/j);}};this.timeUpdate(0,0);})(this,d);};window.onDailymotionPlayerReady=function(d){d=d.replace("_media","");jQuery.media.players[d].node.player.media.player.onReady();};jQuery.media.playerTypes=jQuery.extend(jQuery.media.playerTypes,{dailymotion:function(d){return(d.search(/^http(s)?\:\/\/(www\.)?dailymotion\.com/i)===0);}});jQuery.fn.mediadailymotion=function(e,d){return new (function(h,g,f){this.display=h;var i=this;this.player=null;this.videoFile=null;this.meta=false;this.loaded=false;this.ready=false;this.createMedia=function(k,m){this.videoFile=k;this.ready=false;var j=(g.id+"_media");var l=Math.floor(Math.random()*1000000);var n="http://www.dailymotion.com/swf/"+k.path+"?rand="+l+"&enablejsapi=1&playerapiid="+j;jQuery.media.utils.insertFlash(this.display,n,j,"100%","100%",{},g.wmode,function(o){i.player=o;i.loadPlayer();});};this.loadMedia=function(j){if(this.player){this.loaded=false;this.meta=false;this.videoFile=j;f({type:"playerready"});this.player.loadVideoById(this.videoFile.path,0);}};this.onReady=function(){this.ready=true;this.loadPlayer();};this.loadPlayer=function(){if(this.ready&&this.player){window[g.id+"StateChange"]=function(j){i.onStateChange(j);};window[g.id+"PlayerError"]=function(j){i.onError(j);};this.player.addEventListener("onStateChange",g.id+"StateChange");this.player.addEventListener("onError",g.id+"PlayerError");f({type:"playerready"});this.player.loadVideoById(this.videoFile.path,0);}};this.onStateChange=function(k){var j=this.getPlayerState(k);if(!(!this.meta&&j.state=="stopped")){f({type:j.state,busy:j.busy});}if(!this.loaded&&j.state=="buffering"){this.loaded=true;f({type:"paused",busy:"hide"});if(g.autostart){this.playMedia();}}if(!this.meta&&j.state=="playing"){this.meta=true;f({type:"meta"});}};this.onError=function(k){var j="An unknown error has occured: "+k;if(k==100){j="The requested video was not found. ";j+="This occurs when a video has been removed (for any reason), ";j+="or it has been marked as private.";}else{if((k==101)||(k==150)){j="The video requested does not allow playback in an embedded player.";}}f({type:"error",data:j});};this.getPlayerState=function(j){switch(j){case 5:return{state:"ready",busy:false};case 3:return{state:"buffering",busy:"show"};case 2:return{state:"paused",busy:"hide"};case 1:return{state:"playing",busy:"hide"};case 0:return{state:"complete",busy:false};case -1:return{state:"stopped",busy:false};default:return{state:"unknown",busy:false};}return"unknown";};this.playMedia=function(){f({type:"buffering",busy:"show"});this.player.playVideo();};this.pauseMedia=function(){this.player.pauseVideo();};this.stopMedia=function(){this.player.stopVideo();};this.destroy=function(){this.stopMedia();jQuery.media.utils.removeFlash(this.display,(g.id+"_media"));this.display.children().remove();};this.seekMedia=function(j){f({type:"buffering",busy:"show"});this.player.seekTo(j,true);};this.setVolume=function(j){this.player.setVolume(j*100);};this.getVolume=function(){return(this.player.getVolume()/100);};this.getDuration=function(){return this.player.getDuration();};this.getCurrentTime=function(){return this.player.getCurrentTime();};this.getBytesLoaded=function(){return this.player.getVideoBytesLoaded();};this.getBytesTotal=function(){return this.player.getVideoBytesTotal();};this.getEmbedCode=function(){return this.player.getVideoEmbedCode();};this.getMediaLink=function(){return this.player.getVideoUrl();};this.hasControls=function(){return true;};this.showControls=function(j){};this.setQuality=function(j){};this.getQuality=function(){return"";};})(this,e,d);};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{volume:80,autostart:false,streamer:"",embedWidth:450,embedHeight:337,wmode:"transparent",forceOverflow:false,quality:"default",repeat:false});jQuery.fn.mediadisplay=function(d){if(this.length===0){return null;}return new (function(f,e){this.settings=jQuery.media.utils.getSettings(e);this.display=f;var g=this;this.volume=-1;this.player=null;this.preview="";this.updateInterval=null;this.progressInterval=null;this.playQueue=[];this.playIndex=0;this.playerReady=false;this.loaded=false;this.mediaFile=null;this.hasPlaylist=false;if(this.settings.forceOverflow){this.display.parents().css("overflow","visible");}this.reset=function(){this.loaded=false;this.stopMedia();clearInterval(this.progressInterval);clearInterval(this.updateInterval);this.playQueue.length=0;this.playQueue=[];this.playIndex=0;this.playerReady=false;this.mediaFile=null;this.display.empty().trigger("mediaupdate",{type:"reset"});};this.getPlayableMedia=function(l){var k=null;var h=l.length;while(h--){var j=new jQuery.media.file(l[h],this.settings);if(!k||(j.weight0);if(!h){if(this.player){this.player.destroy();this.player=null;}this.display.trigger("mediaupdate",{type:"nomedia"});}return h;};this.playNext=function(){if(this.playQueue.length>this.playIndex){this.loadMedia(this.playQueue[this.playIndex]);this.playIndex++;}else{if(this.settings.repeat){this.playIndex=0;this.playNext();}else{if(this.hasPlaylist){this.reset();}else{this.loaded=false;this.settings.autostart=false;this.playIndex=0;this.playNext();}}}};this.loadMedia=function(i,h){if(i){i=new jQuery.media.file(this.getMediaFile(i),this.settings);i.player=h?h:i.player;this.stopMedia();if(!this.mediaFile||(this.mediaFile.player!=i.player)){this.player=null;this.playerReady=false;if(i.player){this.player=this.display["media"+i.player](this.settings,function(j){g.onMediaUpdate(j);});}if(this.player){this.player.createMedia(i,this.preview);}}else{if(this.player){this.player.loadMedia(i);}}this.mediaFile=i;this.onMediaUpdate({type:"initialize"});}};this.onMediaUpdate=function(i){switch(i.type){case"playerready":this.playerReady=true;this.player.setVolume(0);this.player.setQuality(this.settings.quality);this.startProgress();break;case"buffering":this.startProgress();break;case"stopped":clearInterval(this.progressInterval);clearInterval(this.updateInterval);break;case"error":if(i.code==4){this.loadMedia(this.mediaFile,"flash");}else{clearInterval(this.progressInterval);clearInterval(this.updateInterval);}break;case"paused":clearInterval(this.updateInterval);break;case"playing":this.startUpdate();break;case"progress":var h=this.getPercentLoaded();jQuery.extend(i,{percentLoaded:h});if(h>=1){clearInterval(this.progressInterval);}break;case"meta":jQuery.extend(i,{currentTime:this.player.getCurrentTime(),totalTime:this.getDuration(),volume:this.player.getVolume(),quality:this.getQuality()});break;case"durationupdate":this.mediaFile.duration=i.duration;break;case"complete":this.playNext();break;default:break;}if(i.type=="playing"&&!this.loaded){if(this.settings.autoLoad&&!this.settings.autostart){setTimeout(function(){g.setVolume();g.player.pauseMedia();g.settings.autostart=true;g.loaded=true;},100);}else{this.loaded=true;this.setVolume();this.display.trigger("mediaupdate",i);}}else{this.display.trigger("mediaupdate",i);}};this.startProgress=function(){if(this.playerReady){clearInterval(this.progressInterval);this.progressInterval=setInterval(function(){g.onMediaUpdate({type:"progress"});},500);}};this.startUpdate=function(){if(this.playerReady){clearInterval(this.updateInterval);this.updateInterval=setInterval(function(){if(g.playerReady){g.onMediaUpdate({type:"update",currentTime:g.player.getCurrentTime(),totalTime:g.getDuration(),volume:g.player.getVolume(),quality:g.getQuality()});}},1000);}};this.stopMedia=function(){this.loaded=false;clearInterval(this.progressInterval);clearInterval(this.updateInterval);if(this.playerReady){this.player.stopMedia();}};this.mute=function(h){this.player.setVolume(h?0:this.volume);};this.onResize=function(){if(this.player&&this.player.onResize){this.player.onResize();}};this.getPercentLoaded=function(){if(this.player.getPercentLoaded){return this.player.getPercentLoaded();}else{var i=this.player.getBytesLoaded();var h=this.mediaFile.bytesTotal?this.mediaFile.bytesTotal:this.player.getBytesTotal();return h?(i/h):0;}};this.showControls=function(h){if(this.playerReady){this.player.showControls(h);}};this.hasControls=function(){if(this.player){return this.player.hasControls();}return false;};this.getDuration=function(){if(this.mediaFile){if(!this.mediaFile.duration){this.mediaFile.duration=this.player.getDuration();}return this.mediaFile.duration;}else{return 0;}};this.setVolume=function(h){this.volume=h?h:((this.volume==-1)?(this.settings.volume/100):this.volume);if(this.player){this.player.setVolume(this.volume);}};this.getVolume=function(){if(!this.volume){this.volume=this.player.getVolume();}return this.volume;};this.getQuality=function(){if(!this.mediaFile.quality){this.mediaFile.quality=this.player.getQuality();}return this.mediaFile.quality;};})(this,d);};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{apiKey:"",api:2,sessid:"",drupalVersion:6});jQuery.media=jQuery.extend({},{drupal:function(e,d){return new (function(k,j){j=jQuery.media.utils.getSettings(j);var l=this;var g=(j.apiKey.length>0);var i=(j.api==1);var f=(j.drupalVersion>=6)?"node.get":"node.load";var h=(j.protocol=="auto");jQuery.media=jQuery.extend({},{commands:{connect:{command:{rpc:"system.connect",json:""},useKey:i,protocol:"rpc"},mail:{command:{rpc:"system.mail",json:""},useKey:g,protocol:"rpc"},loadNode:{command:{rpc:f,json:"mediafront_getnode"},useKey:i,protocol:"json"},getPlaylist:{command:{rpc:"mediafront.getPlaylist",json:"mediafront_getplaylist"},useKey:i,protocol:"json"},getVote:{command:{rpc:"vote.getVote",json:""},useKey:i,protocol:"rpc"},setVote:{command:{rpc:"vote.setVote",json:""},useKey:g,protocol:"rpc"},getUserVote:{command:{rpc:"vote.getUserVote",json:""},useKey:i,protocol:"rpc"},deleteVote:{command:{rpc:"vote.deleteVote",json:""},useKey:g,protocol:"rpc"},addTag:{command:{rpc:"tag.addTag",json:""},useKey:g,protocol:"rpc"},incrementCounter:{command:{rpc:"mediafront.incrementNodeCounter",json:""},useKey:g,protocol:"rpc"},setFavorite:{command:{rpc:"favorites.setFavorite",json:""},useKey:g,protocol:"rpc"},deleteFavorite:{command:{rpc:"favorites.deleteFavorite",json:""},useKey:g,protocol:"rpc"},isFavorite:{command:{rpc:"favorites.isFavorite",json:""},useKey:i,protocol:"rpc"},login:{command:{rpc:"user.login",json:""},useKey:g,protocol:"rpc"},logout:{command:{rpc:"user.logout",json:""},useKey:g,protocol:"rpc"},adClick:{command:{rpc:"mediafront.adClick",json:""},useKey:g,protocol:"rpc"},getAd:{command:{rpc:"mediafront.getAd",json:""},useKey:i,protocol:"rpc"},setUserStatus:{command:{rpc:"mediafront.setUserStatus",json:""},useKey:g,protocol:"rpc"}}},jQuery.media);this.user={};this.sessionId="";this.onConnected=null;this.encoder=new jQuery.media.sha256();this.baseURL=j.baseURL.substring(0,(j.baseURL.length-1)).replace(/^(http[s]?\:[\\\/][\\\/])/,"");this.connect=function(m){this.onConnected=m;if(j.sessid){this.onConnect({sessid:j.sessid});}else{this.call(jQuery.media.commands.connect,function(n){l.onConnect(n);},null);}};this.call=function(r,q,o){var m=[];for(var n=3;n1){var o=this.getTimeStamp();var n=this.getNonce();var p=this.computeHMAC(o,this.baseURL,n,q.command.rpc,j.apiKey);m.unshift(n);m.unshift(o);m.unshift(this.baseURL);m.unshift(p);}else{m.unshift(j.apiKey);}}return m;};this.getTimeStamp=function(){return(parseInt(new Date().getTime()/1000,10)).toString();};this.getNonce=function(){var p="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";var n="";for(var o=0;o<10;o++){var m=Math.floor(Math.random()*p.length);n+=p.substring(m,m+1);}return n;};this.computeHMAC=function(p,o,n,r,q){var m=p+";"+o+";"+n+";"+r;return this.encoder.encrypt(q,m);};this.onConnect=function(m){if(m){this.sessionId=m.sessid;this.user=m.user;}if(this.onConnected){this.onConnected(m);}};})(e,d);}},jQuery.media);jQuery.media.checkPlayType=function(e,d){if((typeof e.canPlayType)=="function"){return("no"!==e.canPlayType(d))&&(""!==e.canPlayType(d));}else{return false;}};jQuery.media.getPlayTypes=function(){var d={};var e=document.createElement("video");d.ogg=jQuery.media.checkPlayType(e,'video/ogg; codecs="theora, vorbis"');d.h264=jQuery.media.checkPlayType(e,'video/mp4; codecs="avc1.42E01E, mp4a.40.2"');d.webm=jQuery.media.checkPlayType(e,'video/webm; codecs="vp8, vorbis"');e=document.createElement("audio");d.audioOgg=jQuery.media.checkPlayType(e,"audio/ogg");d.mp3=jQuery.media.checkPlayType(e,"audio/mpeg");return d;};jQuery.media.playTypes=null;jQuery.media.file=function(d,e){if(!jQuery.media.playTypes){jQuery.media.playTypes=jQuery.media.getPlayTypes();}d=(typeof d==="string")?{path:d}:d;this.duration=d.duration?d.duration:0;this.bytesTotal=d.bytesTotal?d.bytesTotal:0;this.quality=d.quality?d.quality:0;this.stream=e.streamer?e.streamer:d.stream;this.path=d.path?jQuery.trim(d.path):(e.baseURL+jQuery.trim(d.filepath));this.extension=d.extension?d.extension:this.getFileExtension();this.weight=d.weight?d.weight:this.getWeight();this.player=d.player?d.player:this.getPlayer();this.mimetype=d.mimetype?d.mimetype:this.getMimeType();this.type=d.type?d.type:this.getType();};jQuery.media.file.prototype.getFileExtension=function(){return this.path.substring(this.path.lastIndexOf(".")+1).toLowerCase();};jQuery.media.file.prototype.getPlayer=function(){switch(this.extension){case"ogg":case"ogv":return jQuery.media.playTypes.ogg?"html5":"flash";case"mp4":case"m4v":return jQuery.media.playTypes.h264?"html5":"flash";case"webm":return jQuery.media.playTypes.webm?"html5":"flash";case"oga":return jQuery.media.playTypes.audioOgg?"html5":"flash";case"mp3":return jQuery.media.playTypes.mp3?"html5":"flash";case"swf":case"flv":case"f4v":case"f4a":case"mov":case"3g2":case"3gp":case"3gpp":case"m4a":case"aac":case"wav":case"aif":case"wma":return"flash";default:for(var d in jQuery.media.playerTypes){if(jQuery.media.playerTypes.hasOwnProperty(d)){if(jQuery.media.playerTypes[d](this.path)){return d;}}}break;}return"flash";};jQuery.media.file.prototype.getType=function(){switch(this.extension){case"swf":case"webm":case"ogg":case"ogv":case"mp4":case"m4v":case"flv":case"f4v":case"mov":case"3g2":case"3gp":case"3gpp":return"video";case"oga":case"mp3":case"f4a":case"m4a":case"aac":case"wav":case"aif":case"wma":return"audio";default:break;}return"";};jQuery.media.file.prototype.getWeight=function(){switch(this.extension){case"mp4":case"m4v":case"m4a":return jQuery.media.playTypes.h264?3:7;case"webm":return jQuery.media.playTypes.webm?4:8;case"ogg":case"ogv":return jQuery.media.playTypes.ogg?5:20;case"oga":return jQuery.media.playTypes.audioOgg?5:20;case"mp3":return 6;case"mov":case"swf":case"flv":case"f4v":case"f4a":case"3g2":case"3gp":case"3gpp":return 9;case"wav":case"aif":case"aac":return 10;case"wma":return 11;default:break;}return 0;};jQuery.media.file.prototype.getMimeType=function(){switch(this.extension){case"mp4":case"m4v":case"flv":case"f4v":return"video/mp4";case"webm":return"video/x-webm";case"ogg":case"ogv":return"video/ogg";case"3g2":return"video/3gpp2";case"3gpp":case"3gp":return"video/3gpp";case"mov":return"video/quicktime";case"swf":return"application/x-shockwave-flash";case"oga":return"audio/ogg";case"mp3":return"audio/mpeg";case"m4a":case"f4a":return"audio/mp4";case"aac":return"audio/aac";case"wav":return"audio/vnd.wave";case"wma":return"audio/x-ms-wma";default:break;}return"";};window.onFlashPlayerReady=function(d){jQuery.media.players[d].node.player.media.player.onReady();};window.onFlashPlayerUpdate=function(e,d){jQuery.media.players[e].node.player.media.player.onMediaUpdate(d);};window.onFlashPlayerDebug=function(d){if(window.console&&console.log){console.log(d);}};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{flashPlayer:"./flash/mediafront.swf",skin:"default",config:"nocontrols"});jQuery.fn.mediaflash=function(e,d){return new (function(h,g,f){g=jQuery.media.utils.getSettings(g);this.display=h;var i=this;this.player=null;this.mediaFile=null;this.preview="";this.ready=false;this.translate={mediaConnected:"connected",mediaBuffering:"buffering",mediaPaused:"paused",mediaPlaying:"playing",mediaStopped:"stopped",mediaComplete:"complete",mediaMeta:"meta"};this.busy={mediaConnected:false,mediaBuffering:"show",mediaPaused:"hide",mediaPlaying:"hide",mediaStopped:false,mediaComplete:false,mediaMeta:false};this.createMedia=function(j,n){this.mediaFile=j;this.preview=n;this.ready=false;var l=(g.id+"_media");var m=Math.floor(Math.random()*1000000);var o=g.flashPlayer+"?rand="+m;var k={config:g.config,id:g.id,file:j.path,image:this.preview,skin:g.skin,autostart:(g.autostart||!g.autoLoad)};if(j.stream){k.stream=j.stream;}if(g.debug){k.debug="1";}jQuery.media.utils.insertFlash(this.display,o,l,"100%","100%",k,g.wmode,function(p){i.player=p;i.loadPlayer();});};this.loadMedia=function(j){if(this.player&&this.ready){this.mediaFile=j;this.player.loadMedia(j.path,j.stream);f({type:"playerready"});}};this.onReady=function(){this.ready=true;this.loadPlayer();};this.loadPlayer=function(){if(this.ready&&this.player){f({type:"playerready"});}};this.onMediaUpdate=function(j){f({type:this.translate[j],busy:this.busy[j]});};this.playMedia=function(){if(this.player&&this.ready){this.player.playMedia();}};this.pauseMedia=function(){if(this.player&&this.ready){this.player.pauseMedia();}};this.stopMedia=function(){if(this.player&&this.ready){this.player.stopMedia();}};this.destroy=function(){this.stopMedia();jQuery.media.utils.removeFlash(this.display,(g.id+"_media"));this.display.children().remove();};this.seekMedia=function(j){if(this.player&&this.ready){this.player.seekMedia(j);}};this.setVolume=function(j){if(this.player&&this.ready){this.player.setVolume(j);}};this.getVolume=function(){return(this.player&&this.ready)?this.player.getVolume():0;};this.getDuration=function(){return(this.player&&this.ready)?this.player.getDuration():0;};this.getCurrentTime=function(){return(this.player&&this.ready)?this.player.getCurrentTime():0;};this.getBytesLoaded=function(){return(this.player&&this.ready)?this.player.getMediaBytesLoaded():0;};this.getBytesTotal=function(){return(this.player&&this.ready)?this.player.getMediaBytesTotal():0;};this.hasControls=function(){return true;};this.showControls=function(j){if(this.player&&this.ready){this.player.showPlugin("controlBar",j);this.player.showPlugin("playLoader",j);}};this.getEmbedCode=function(){var j={config:"config",id:"mediafront_player",file:this.mediaFile.path,image:this.preview,skin:g.skin};if(this.mediaFile.stream){j.stream=this.mediaFile.stream;}return jQuery.media.utils.getFlash(g.flashPlayer,"mediafront_player",g.embedWidth,g.embedHeight,j,g.wmode);};this.setQuality=function(j){};this.getQuality=function(){return"";};this.getMediaLink=function(){return"This video currently does not have a link.";};})(this,e,d);};jQuery.fn.mediahtml5=function(e,d){return new (function(h,g,f){this.display=h;var i=this;this.player=null;this.bytesLoaded=0;this.bytesTotal=0;this.mediaType="";this.loaded=false;this.mediaFile=null;this.playerElement=null;this.getPlayer=function(j,n){this.mediaFile=j;var k=g.id+"_"+this.mediaType;var m="<"+this.mediaType+' style="position:absolute" id="'+k+'"';m+=n?' poster="'+n+'"':"";if(typeof j==="array"){m+=">";var l=j.length;while(l){l--;m+='';}}else{m+=' src="'+j.path+'">Unable to display media.';}m+="";this.display.append(m);this.bytesTotal=j.bytesTotal;this.playerElement=this.display.find("#"+k);this.onResize();return this.playerElement.eq(0)[0];};this.createMedia=function(j,k){jQuery.media.utils.removeFlash(this.display,g.id+"_media");this.display.children().remove();this.mediaType=this.getMediaType(j);this.player=this.getPlayer(j,k);this.loaded=false;var l=false;if(this.player){this.player.addEventListener("abort",function(){f({type:"stopped"});},true);this.player.addEventListener("loadstart",function(){f({type:"ready",busy:"show"});i.onReady();},true);this.player.addEventListener("loadeddata",function(){f({type:"loaded",busy:"hide"});},true);this.player.addEventListener("loadedmetadata",function(){f({type:"meta"});},true);this.player.addEventListener("canplaythrough",function(){f({type:"canplay",busy:"hide"});},true);this.player.addEventListener("ended",function(){f({type:"complete"});},true);this.player.addEventListener("pause",function(){f({type:"paused"});},true);this.player.addEventListener("play",function(){f({type:"playing"});},true);this.player.addEventListener("playing",function(){f({type:"playing",busy:"hide"});},true);this.player.addEventListener("error",function(m){i.onError(m.target.error);f({type:"error",code:m.target.error.code});},true);this.player.addEventListener("waiting",function(){f({type:"waiting",busy:"show"});},true);this.player.addEventListener("timeupdate",function(){if(l){f({type:"timeupdate",busy:"hide"});}else{l=true;}},true);this.player.addEventListener("durationchange",function(){if(this.duration&&(this.duration!==Infinity)){f({type:"durationupdate",duration:this.duration});}},true);this.player.addEventListener("progress",function(m){i.bytesLoaded=m.loaded;i.bytesTotal=m.total;},true);this.player.autoplay=true;if(typeof this.player.hasAttribute=="function"&&this.player.hasAttribute("preload")&&this.player.preload!="none"){this.player.autobuffer=true;}else{this.player.autobuffer=false;this.player.preload="none";}f({type:"playerready"});}};this.onError=function(j){switch(j.code){case 1:console.log("Error: MEDIA_ERR_ABORTED");break;case 2:console.log("Error: MEDIA_ERR_DECODE");break;case 3:console.log("Error: MEDIA_ERR_NETWORK");break;case 4:console.log("Error: MEDIA_ERR_SRC_NOT_SUPPORTED");break;default:break;}};this.onReady=function(){if(!this.loaded){this.loaded=true;this.playMedia();}};this.loadMedia=function(j){this.mediaFile=j;this.createMedia(j);};this.getMediaType=function(j){var k=(typeof j==="array")?j[0].extension:j.extension;switch(k){case"ogg":case"ogv":case"mp4":case"m4v":return"video";case"oga":case"mp3":return"audio";default:break;}return"video";};this.playMedia=function(){if(this.player&&this.player.play){this.player.play();}};this.pauseMedia=function(){if(this.player&&this.player.pause){this.player.pause();}};this.stopMedia=function(){this.pauseMedia();if(this.player){this.player.src="";}};this.destroy=function(){this.stopMedia();this.display.children().remove();};this.seekMedia=function(j){if(this.player){this.player.currentTime=j;}};this.setVolume=function(j){if(this.player){this.player.volume=j;}};this.getVolume=function(){return this.player?this.player.volume:0;};this.getDuration=function(){var j=this.player?this.player.duration:0;return(j===Infinity)?0:j;};this.getCurrentTime=function(){return this.player?this.player.currentTime:0;};this.getPercentLoaded=function(){if(this.player&&this.player.buffered&&this.player.duration){return(this.player.buffered.end(0)/this.player.duration);}else{if(this.bytesTotal){return(this.bytesLoaded/this.bytesTotal);}else{return 0;}}};this.onResize=function(){if(this.mediaType=="video"){this.playerElement.css({width:this.display.width(),height:this.display.height()});}};this.setQuality=function(j){};this.getQuality=function(){return"";};this.hasControls=function(){return false;};this.showControls=function(j){};this.getEmbedCode=function(){if((this.mediaFile.extension=="mp4")||(this.mediaFile.extension=="m4v")||(this.mediaFile.extension=="webm")){var j={config:"config",id:"mediafront_player",file:this.mediaFile.path,image:this.preview,skin:g.skin};if(this.mediaFile.stream){j.stream=this.mediaFile.stream;}return jQuery.media.utils.getFlash(g.flashPlayer,"mediafront_player",g.embedWidth,g.embedHeight,j,g.wmode);}else{return"This media does not support embedding.";}};this.getMediaLink=function(){return"This media currently does not have a link.";};})(this,e,d);};jQuery.fn.mediaimage=function(e,d){if(this.length===0){return null;}return new (function(g,j,f){this.display=g;var k=this;var i=0;var h=false;this.imgLoader=new Image();this.imgLoader.onload=function(){h=true;i=(k.imgLoader.width/k.imgLoader.height);k.resize();k.display.trigger("imageLoaded");};g.css("overflow","hidden");this.loaded=function(){return this.imgLoader.complete;};this.resize=function(p,l){var o=f?this.imgLoader.width:(p?p:this.display.width());var m=f?this.imgLoader.height:(l?l:this.display.height());if(o&&m&&h){var n=jQuery.media.utils.getScaledRect(i,{width:o,height:m});if(this.image){this.image.attr("src",this.imgLoader.src).css({marginLeft:n.x,marginTop:n.y,width:n.width,height:n.height});}this.image.fadeIn();}};this.clear=function(){h=false;if(this.image){this.image.attr("src","");this.imgLoader.src="";this.image.fadeOut(function(){if(j){c(this).parent().remove();}else{c(this).remove();}});}};this.refresh=function(){this.resize();};this.loadImage=function(l){this.clear();this.image=c(document.createElement("img")).attr({src:""}).hide();if(j){this.display.append(c(document.createElement("a")).attr({target:"_blank",href:j}).append(this.image));}else{this.display.append(this.image);}this.imgLoader.src=l;};})(this,e,d);};jQuery.media=jQuery.extend({},{json:function(d){return new (function(g){var h=this;var e={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};var f={"boolean":function(i){return String(i);},"null":function(i){return"null";},number:function(i){return isFinite(i)?String(i):"null";},string:function(i){if(/["\\\x00-\x1f]/.test(i)){i=i.replace(/([\x00-\x1f\\"])/g,function(k,j){var l=e[j];if(l){return l;}l=j.charCodeAt();return"\\u00"+Math.floor(l/16).toString(16)+(l%16).toString(16);});}return'"'+i+'"';},array:function(k){var n=["["],j,q,p,m=k.length,o;for(p=0;p0){this.scrollRegion.clear();var h=function(i,l){g.setLink(l);};var j=f.links.length;while(j){j--;var k=this.scrollRegion.newItem().playlistlink(f,f.links[j]);k.unbind("linkclick").bind("linkclick",h);}this.scrollRegion.activate();}};this.setLink=function(h){if(this.previousLink){this.previousLink.setActive(false);}h.setActive(true);this.previousLink=h;};})(this,d);};jQuery.media.ids=jQuery.extend(jQuery.media.ids,{close:"#mediamenuclose",embed:"#mediaembed",elink:"#mediaelink",email:"#mediaemail"});jQuery.fn.mediamenu=function(e,d){if(this.length===0){return null;}return new (function(h,i,g){g=jQuery.media.utils.getSettings(g);var j=this;this.display=i;this.on=false;this.contents=[];this.prevItem={id:0,link:null,contents:null};this.close=this.display.find(g.ids.close);this.close.unbind("click").bind("click",function(){j.display.trigger("menuclose");});this.setMenuItem=function(l,m){if(this.prevItem.id!=m){if(this.prevItem.id&&g.template.onMenuSelect){g.template.onMenuSelect(this.prevItem.link,this.prevItem.contents,false);}var k=this.contents[m];if(g.template.onMenuSelect){g.template.onMenuSelect(l,k,true);}this.prevItem={id:m,link:l,contents:k};}};this.setEmbedCode=function(k){this.setInputItem(g.ids.embed,k);};this.setMediaLink=function(k){this.setInputItem(g.ids.elink,k);};this.setInputItem=function(m,l){var k=this.contents[m].find("input");k.unbind("click").bind("click",function(){c(this).select().focus();});k.attr("value",l);};var f=0;this.links=this.display.find("a");this.links.each(function(){var l=c(this);if(l.length>0){var m=l.attr("href");var k=j.display.find(m);k.hide();j.contents[m]=k;l.unbind("click").bind("click",{id:m,obj:l.parent()},function(n){n.preventDefault();j.setMenuItem(n.data.obj,n.data.id);});if(f===0){j.setMenuItem(l.parent(),m);}f++;}});})(e,this,d);};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{logo:"logo.png",logoWidth:49,logoHeight:15,logopos:"sw",logox:5,logoy:5,link:"http://www.mediafront.org",file:"",image:"",timeout:8,autoLoad:true});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{busy:"#mediabusy",preview:"#mediapreview",play:"#mediaplay",media:"#mediadisplay"});jQuery.fn.minplayer=function(d){if(this.length===0){return null;}return new (function(e,f){f=jQuery.media.utils.getSettings(f);this.display=e;var g=this;this.autoLoad=f.autoLoad;this.busy=e.find(f.ids.busy);this.busyImg=this.busy.find("img");this.busyWidth=this.busyImg.width();this.busyHeight=this.busyImg.height();this.play=e.find(f.ids.play);this.play.unbind("click").bind("click",function(){g.togglePlayPause();});this.playImg=this.play.find("img");this.playWidth=this.playImg.width();this.playHeight=this.playImg.height();this.preview=e.find(f.ids.preview).mediaimage();if(this.preview){this.preview.display.unbind("click").bind("click",function(){g.onMediaClick();});this.preview.display.unbind("imageLoaded").bind("imageLoaded",function(){g.onPreviewLoaded();});}this.usePlayerControls=false;this.busyFlags=0;this.busyVisible=false;this.playVisible=false;this.previewVisible=false;this.playing=false;this.hasMedia=false;this.timeoutId=0;this.width=this.display.width();this.height=this.display.height();this.showElement=function(j,h,i){if(j&&!this.usePlayerControls){if(h){j.show(i);}else{j.hide(i);}}};this.showPlay=function(h,i){h&=this.hasMedia;this.playVisible=h;this.showElement(this.play,h,i);};this.showBusy=function(j,h,i){if(h){this.busyFlags|=(1<0);this.showElement(this.busy,this.busyVisible,i);if(j==1&&!h){this.showBusy(3,false);}};this.showPreview=function(h,i){this.previewVisible=h;if(this.preview){this.showElement(this.preview.display,h,i);}};this.onControlUpdate=function(h){if(this.media){if(this.media.playerReady){switch(h.type){case"play":this.media.player.playMedia();break;case"pause":this.media.player.pauseMedia();break;case"seek":this.media.player.seekMedia(h.value);break;case"volume":this.media.setVolume(h.value);break;case"mute":this.media.mute(h.value);break;default:break;}}else{if((this.media.playQueue.length>0)&&!this.media.mediaFile){this.autoLoad=true;this.playNext();}}if(f.template&&f.template.onControlUpdate){f.template.onControlUpdate(h);}}};this.fullScreen=function(h){if(f.template.onFullScreen){f.template.onFullScreen(h);}this.preview.refresh();};this.onPreviewLoaded=function(){this.previewVisible=true;};this.onMediaUpdate=function(h){switch(h.type){case"paused":this.playing=false;this.showPlay(true);if(!this.media.loaded){this.showPreview(true);}break;case"update":case"playing":this.playing=true;this.showPlay(false);this.showPreview((this.media.mediaFile.type=="audio"));break;case"initialize":this.playing=false;this.showPlay(true);this.showBusy(1,this.autoLoad);this.showPreview(true);break;case"buffering":this.showPlay(true);this.showPreview((this.media.mediaFile.type=="audio"));break;default:break;}if(h.busy){this.showBusy(1,(h.busy=="show"));}};this.onMediaClick=function(){if(this.media.player&&!this.media.hasControls()){if(this.playing){this.media.player.pauseMedia();}else{this.media.player.playMedia();}}};this.media=this.display.find(f.ids.media).mediadisplay(f);if(this.media){this.media.display.unbind("click").bind("click",function(){g.onMediaClick();});}this.setLogoPos=function(){if(this.logo){var h={};if(f.logopos=="se"||f.logopos=="sw"){h.bottom=f.logoy;}if(f.logopos=="ne"||f.logopos=="nw"){h.top=f.logoy;}if(f.logopos=="nw"||f.logopos=="sw"){h.left=f.logox;}if(f.logopos=="ne"||f.logopos=="se"){h.right=f.logox;}this.logo.display.css(h);}};if(!f.controllerOnly){this.display.prepend('');this.logo=this.display.find("."+f.prefix+"medialogo").mediaimage(f.link);if(this.logo){this.logo.display.css({width:f.logoWidth,height:f.logoHeight});this.logo.display.bind("imageLoaded",function(){g.setLogoPos();});this.logo.loadImage(f.logo);}}this.reset=function(){this.hasMedia=false;this.playing=false;jQuery.media.players[f.id].showNativeControls(false);this.showPlay(true);this.showPreview(true);clearTimeout(this.timeoutId);if(this.media){this.media.reset();}};this.togglePlayPause=function(){if(this.media){if(this.media.playerReady){if(this.playing){this.showPlay(true);this.media.player.pauseMedia();}else{this.showPlay(false);this.media.player.playMedia();}}else{if((this.media.playQueue.length>0)&&!this.media.mediaFile){this.autoLoad=true;this.playNext();}}}};this.loadImage=function(h){if(this.preview){this.showBusy(3,true);this.preview.loadImage(h);var i=setInterval(function(){if(g.preview.loaded()){clearInterval(i);g.showBusy(3,false);}},500);if(this.media){this.media.preview=h;}}};this.onResize=function(){if(this.preview){this.preview.refresh();}if(this.media){this.media.onResize();}};this.clearImage=function(){if(this.preview){this.preview.clear();}};this.loadFiles=function(h){this.reset();this.hasMedia=this.media&&this.media.loadFiles(h);if(this.hasMedia&&this.autoLoad){this.media.playNext();}else{if(!this.hasMedia){this.showPlay(false);this.showPreview(true);this.timeoutId=setTimeout(function(){g.media.display.trigger("mediaupdate",{type:"complete"});},(f.timeout*1000));}}return this.hasMedia;};this.playNext=function(){if(this.media){this.media.playNext();}};this.hasControls=function(){if(this.media){return this.media.hasControls();}return true;};this.showControls=function(h){if(this.media){this.media.showControls(h);}};this.loadMedia=function(h){this.reset();if(this.media){this.media.loadMedia(h);}};if(f.file){this.loadMedia(f.file);}if(f.image){this.loadImage(f.image);}})(this,d);}; -/* Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net) - * Licensed under the MIT License (LICENSE.txt). - * - * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. - * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. - * Thanks to: Seamus Leahy for adding deltaX and deltaY - * - * Version: 3.0.4 - * - * Requires: 1.2.2+ - */ -var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){d--;this.addEventListener(a[d],b,false);}}else{this.onmousewheel=b;}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){d--;this.removeEventListener(a[d],b,false);}}else{this.onmousewheel=null;}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel");},unmousewheel:function(d){return this.unbind("mousewheel",d);}});function b(i){var g=i||window.event,f=[].slice.call(arguments,1),j=0,h=true,e=0,d=0;i=c.event.fix(g);i.type="mousewheel";if(i.wheelDelta){j=i.wheelDelta/120;}if(i.detail){j=-i.detail/3;}d=j;if(g.axis!==undefined&&g.axis===g.HORIZONTAL_AXIS){d=0;e=-1*j;}if(g.wheelDeltaY!==undefined){d=g.wheelDeltaY/120;}if(g.wheelDeltaX!==undefined){e=-1*g.wheelDeltaX/120;}f.unshift(i,j,e,d);return c.event.handle.apply(this,f);}jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{node:"",incrementTime:5});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{voter:"#mediavoter",uservoter:"#mediauservoter",mediaRegion:"#mediaregion",field:".mediafield"});jQuery.fn.medianode=function(e,d){if(this.length===0){return null;}return new (function(h,g,f){f=jQuery.media.utils.getSettings(f);this.display=g;this.nodeInfo={};this.incremented=false;var i=this;this.player=this.display.find(f.ids.mediaRegion).minplayer(f);if(this.player&&(f.incrementTime!==0)){this.player.display.unbind("mediaupdate").bind("mediaupdate",function(j,k){i.onMediaUpdate(k);});}this.images=[];this.addVoters=function(j){this.voter=j.find(f.ids.voter).mediavoter(f,h,false);this.uservoter=j.find(f.ids.uservoter).mediavoter(f,h,true);if(this.uservoter&&this.voter){this.uservoter.display.unbind("processing").bind("processing",function(){i.player.showBusy(2,true);});this.uservoter.display.unbind("voteGet").bind("voteGet",function(){i.player.showBusy(2,false);});this.uservoter.display.unbind("voteSet").bind("voteSet",function(l,k){i.player.showBusy(2,false);i.voter.updateVote(k);});}};this.addVoters(this.display);this.onMediaUpdate=function(j){if(!this.incremented){switch(j.type){case"update":if((f.incrementTime>0)&&(j.currentTime>f.incrementTime)){this.incremented=true;h.call(jQuery.media.commands.incrementCounter,null,null,i.nodeInfo.nid);}break;case"complete":if(f.incrementTime<0){this.incremented=true;h.call(jQuery.media.commands.incrementCounter,null,null,i.nodeInfo.nid);}break;default:break;}}};this.loadNode=function(j){return this.getNode(this.translateNode(j));};this.translateNode=function(k){var l=((typeof k)=="number")||((typeof k)=="string");if(!k){var j=f.node;if((typeof j)=="object"){j.load=false;return j;}else{return j?{nid:j,load:true}:null;}}else{if(l){return{nid:k,load:true};}else{k.load=false;return k;}}};this.getNode=function(j){if(j){if(h&&j.load){h.call(jQuery.media.commands.loadNode,function(k){i.setNode(k);},null,j.nid,{});}else{this.setNode(j);}return true;}return false;};this.setNode=function(j){if(j){this.nodeInfo=j;this.incremented=false;if(this.player&&this.nodeInfo.mediafiles){var k=this.getImage("preview");if(k){this.player.loadImage(k.path);}else{this.player.clearImage();}this.player.loadFiles(this.nodeInfo.mediafiles.media);}if(this.voter){this.voter.getVote(j);}if(this.uservoter){this.uservoter.getVote(j);}this.display.find(f.ids.field).each(function(){i.setField(this,j,c(this).attr("type"),c(this).attr("field"));});this.display.trigger("nodeload",this.nodeInfo);}};this.setField=function(l,k,j,m){if(j){switch(j){case"text":this.setTextField(l,k,m);break;case"image":this.setImageField(l,m);break;case"cck_text":this.setCCKTextField(l,k,m);break;default:break;}}};this.setTextField=function(k,j,m){var l=j[m];if(l){c(k).empty().html(l);}return true;};this.setCCKTextField=function(k,j,m){if(args.fieldType=="cck_text"){var l=j[m];if(l){c(k).empty().html(l["0"].value);}}return true;};this.onResize=function(){if(this.player){this.player.onResize();}};this.getImage=function(l){var j=this.nodeInfo.mediafiles?this.nodeInfo.mediafiles.image:null;var m=null;if(j){if(j[l]){m=j[l];}else{for(var k in j){if(j.hasOwnProperty(k)){m=j[k];break;}}}m=(typeof m==="string")?{path:m}:m;m.path=m.path?jQuery.trim(m.path):(f.baseURL+jQuery.trim(m.filepath));if(m&&m.path){m.path=m.path?jQuery.trim(m.path):(f.baseURL+jQuery.trim(m.filepath));}else{m=null;}}return m;};this.setImageField=function(k,m){var j=this.getImage(m);if(j){var l=c(k).empty().mediaimage();this.images.push(l);l.loadImage(j.path);}};})(e,this,d);};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{shuffle:false,loop:false,pageLimit:10});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{prev:"#mediaprev",next:"#medianext",loadPrev:"#medialoadprev",loadNext:"#medialoadnext",prevPage:"#mediaprevpage",nextPage:"#medianextpage"});jQuery.fn.mediapager=function(d){return new (function(e,f){f=jQuery.media.utils.getSettings(f);this.display=e;var g=this;this.activeIndex=-1;this.currentIndex=-1;this.activePage=0;this.currentPage=0;this.numPages=0;this.numItems=10;this.activeNumItems=10;this.loadState="";this.enabled=false;this.prevButton=e.find(f.ids.prev).medialink(f,function(){if(g.enabled){g.loadPrev(false);}});this.nextButton=e.find(f.ids.next).medialink(f,function(){if(g.enabled){g.loadNext(false);}});this.loadPrevButton=e.find(f.ids.loadPrev).medialink(f,function(){if(g.enabled){g.loadPrev(true);}});this.loadNextButton=e.find(f.ids.loadNext).medialink(f,function(){if(g.enabled){g.loadNext(true);}});this.prevPageButton=e.find(f.ids.prevPage).medialink(f,function(){if(g.enabled){g.loadState="click";g.prevPage();}});this.nextPageButton=e.find(f.ids.nextPage).medialink(f,function(){if(g.enabled){g.loadState="click";g.nextPage();}});this.setTotalItems=function(h){if(h&&f.pageLimit){this.numPages=Math.ceil(h/f.pageLimit);if(this.numPages==1){this.numItems=h;}}};this.setNumItems=function(h){this.numItems=h;};this.reset=function(){this.activePage=0;this.currentPage=0;this.activeIndex=-1;this.currentIndex=-1;this.loadState="";};this.loadIndex=function(j){var h=j?"activeIndex":"currentIndex";var i=this[h];switch(this.loadState){case"prev":this.loadState="";this.loadPrev(j);return;case"first":i=0;break;case"last":i=(this.numItems-1);break;case"rand":i=Math.floor(Math.random()*this.numItems);break;default:break;}this.loadState="";if(i!=this[h]){this.loadState="";this[h]=i;this.display.trigger("loadindex",{index:this[h],active:j});}};this.loadNext=function(i){if(this.loadState){this.loadIndex(i);}else{if(f.shuffle){this.loadRand();}else{var h=i?"activeIndex":"currentIndex";if(i&&(this.activePage!=this.currentPage)){if((this.activeIndex==(this.activeNumItems-1))&&(this.activePage==(this.currentPage-1))){this.currentIndex=this.activeIndex=0;this.activePage=this.currentPage;this.display.trigger("loadindex",{index:0,active:true});}else{this.currentPage=this.activePage;this.loadState="";this.display.trigger("loadpage",{index:this.activePage,active:i});}}else{this[h]++;if(this[h]>=this.numItems){if(this.numPages>1){this[h]=(this.numItems-1);this.loadState=this.loadState?this.loadState:"first";this.nextPage(i);}else{if(!i||f.loop){this[h]=0;this.display.trigger("loadindex",{index:this[h],active:i});}}}else{this.display.trigger("loadindex",{index:this[h],active:i});}}}}};this.loadPrev=function(i){var h=i?"activeIndex":"currentIndex";if(i&&(this.activePage!=this.currentPage)){this.currentPage=this.activePage;this.loadState="prev";this.display.trigger("loadpage",{index:this.activePage,active:i});}else{this[h]--;if(this[h]<0){if(this.numPages>1){this[h]=0;this.loadState=this.loadState?this.loadState:"last";this.prevPage(i);}else{if(!i||f.loop){this[h]=(this.numItems-1);this.display.trigger("loadindex",{index:this[h],active:i});}}}else{this.display.trigger("loadindex",{index:this[h],active:i});}}};this.loadRand=function(){var h=Math.floor(Math.random()*this.numPages);if(h!=this.activePage){this.activePage=h;this.loadState=this.loadState?this.loadState:"rand";this.display.trigger("loadpage",{index:this.activePage,active:true});}else{this.activeIndex=Math.floor(Math.random()*this.numItems);this.display.trigger("loadindex",{index:this.activeIndex,active:true});}};this.nextPage=function(j){var h=j?"activePage":"currentPage";var i=false;if(this[h]<(this.numPages-1)){this[h]++;i=true;}else{if(f.loop){this.loadState=this.loadState?this.loadState:"first";this[h]=0;i=true;}else{this.loadState="";}}this.setPageState(j);if(i){this.display.trigger("loadpage",{index:this[h],active:j});}};this.prevPage=function(j){var h=j?"activePage":"currentPage";var i=false;if(this[h]>0){this[h]--;i=true;}else{if(f.loop){this.loadState=this.loadState?this.loadState:"last";this[h]=(this.numPages-1);i=true;}else{this.loadState="";}}this.setPageState(j);if(i){this.display.trigger("loadpage",{index:this[h],active:j});}};this.setPageState=function(h){if(h){this.currentPage=this.activePage;}else{this.activeNumItems=this.numItems;}};})(this,d);};jQuery.media=jQuery.extend({},{parser:function(d){return new (function(e){var f=this;this.onLoaded=null;this.parseFile=function(g,h){this.onLoaded=h;jQuery.ajax({type:"GET",url:g,dataType:"xml",success:function(i){f.parseXML(i);},error:function(i,k,j){if(window.console&&console.log){console.log("Error: "+k);}}});};this.parseXML=function(g){var h=this.parseXSPF(g);if(h.total_rows===0){h=this.parseASX(g);}if(h.total_rows===0){h=this.parseRSS(g);}if(this.onLoaded&&h.total_rows){this.onLoaded(h);}return h;};this.parseXSPF=function(g){var i={total_rows:0,nodes:[]};var h=jQuery("playlist trackList track",g);if(h.length>0){h.each(function(j){i.total_rows++;i.nodes.push({nid:i.total_rows,title:c(this).find("title").text(),description:c(this).find("annotation").text(),mediafiles:{image:{image:{path:c(this).find("image").text()}},media:{media:{path:c(this).find("location").text()}}}});});}return i;};this.parseASX=function(g){var i={total_rows:0,nodes:[]};var h=jQuery("asx entry",g);if(h.length>0){h.each(function(j){i.total_rows++;i.nodes.push({nid:i.total_rows,title:c(this).find("title").text(),mediafiles:{image:{image:{path:c(this).find("image").text()}},media:{media:{path:c(this).find("location").text()}}}});});}return i;};this.parseRSS=function(h){var j={total_rows:0,nodes:[]};var i=jQuery("rss channel",h);if(i.length>0){var g=(i.find("generator").text()=="YouTube data API");i.find("item").each(function(k){j.total_rows++;var l={};l=g?f.parseYouTubeItem(c(this)):f.parseRSSItem(c(this));l.nid=j.total_rows;j.nodes.push(l);});}return j;};this.parseRSSItem=function(g){return{title:g.find("title").text(),mediafiles:{image:{image:{path:g.find("image").text()}},media:{media:{path:g.find("location").text()}}}};};this.parseYouTubeItem=function(h){var g=h.find("description").text();var i=h.find("link").text().replace("&feature=youtube_gdata","");return{title:h.find("title").text(),mediafiles:{image:{image:{path:jQuery("img",g).eq(0).attr("src")}},media:{media:{path:i,player:"youtube"}}}};};})(d);}},jQuery.media);jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{protocol:"auto",server:"drupal",template:"default",baseURL:"",debug:false,draggable:false,resizable:false,showPlaylist:true,autoNext:true,prefix:"",zIndex:400,fluidWidth:false,fluidHeight:false,fullscreen:false});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{loading:"#mediaplayerloading",player:"#mediaplayer",menu:"#mediamenu",titleBar:"#mediatitlebar",node:"#medianode",playlist:"#mediaplaylist",control:"#mediacontrol"});jQuery.media.players={};jQuery.media.loadCallbacks={};jQuery.media.playlists={};jQuery.media.controllers={};jQuery.media.onLoaded=function(d,f){var e=jQuery.media.players[d];if(e&&e.display&&e.loaded){f(e);}else{if(!jQuery.media.loadCallbacks[d]){jQuery.media.loadCallbacks[d]=[];}jQuery.media.loadCallbacks[d].push(f);}};jQuery.media.addElement=function(f,h,e){if(h&&h[e]){var g=jQuery.media.players[f];if(g){switch(e){case"playlist":g.addPlaylist(h.playlist);break;case"controller":g.addController(h.controller);break;default:break;}}else{var d=e+"s";if(!jQuery.media[d][f]){jQuery.media[d][f]=[];}jQuery.media[d][f].push(h[e]);}}};jQuery.media.addController=function(d,e){jQuery.media.addElement(d,e,"controller");};jQuery.media.addPlaylist=function(d,e){jQuery.media.addElement(d,e,"playlist");};jQuery.fn.mediaplayer=function(d){if(this.length===0){return null;}return new (function(g,h){h=jQuery.media.utils.getSettings(h);if(!h.id){h.id=jQuery.media.utils.getId(g);}this.dialog=g;this.display=this.dialog.find(h.ids.player);var j=this;var e=[];jQuery.media.utils.checkVisibility(this.display,e);jQuery.media.players[h.id]=this;this.loaded=false;var f=0;h.template=jQuery.media.templates[h.template](this,h);if(h.template.getSettings){h=jQuery.extend(h,h.template.getSettings());}c(window).keyup(function(i){switch(i.keyCode){case 0:j.onSpaceBar();break;case 113:case 27:j.onEscKey();break;default:break;}});if(h.fluidWidth||h.fluidHeight){c(window).resize(function(){j.onResize();});}if(jQuery.media[h.protocol]){this.protocol=jQuery.media[h.protocol](h);}if(jQuery.media[h.server]){this.server=jQuery.media[h.server](this.protocol,h);}this.menu=this.dialog.find(h.ids.menu).mediamenu(this.server,h);if(this.menu){this.menu.display.unbind("menuclose").bind("menuclose",function(){j.showMenu(false);});}this.menuOn=false;this.maxOn=!h.showPlaylist;this.fullScreen=false;this.playlist=null;this.activePlaylist=null;this.controller=null;this.activeController=null;this.showMenu=function(i){if(h.template.onMenu){this.menuOn=i;h.template.onMenu(this.menuOn);}};this.onEscKey=function(){if(this.fullScreen){this.onFullScreen(false);}};this.onSpaceBar=function(){if(this.fullScreen&&this.node&&this.node.player){this.node.player.togglePlayPause();}};this.addPlayerEvents=function(i){i.display.unbind("menu").bind("menu",function(k){j.showMenu(!j.menuOn);});i.display.unbind("maximize").bind("maximize",function(k){j.maximize(!j.maxOn);});i.display.unbind("fullscreen").bind("fullscreen",function(k){j.onFullScreen(!j.fullScreen);});};this.onFullScreen=function(i){this.fullScreen=i;if(this.node&&this.node.player){this.node.player.fullScreen(this.fullScreen);this.onResize();if(window.webkitSupportsFullscreen&&window.webkitSupportsFullscreen()){if(i){window.webkitEnterFullscreen();}else{window.webkitExitFullscreen();}}}};this.titleBar=this.dialog.find(h.ids.titleBar).mediatitlebar(h);if(this.titleBar){this.addPlayerEvents(this.titleBar);if(h.draggable&&this.dialog.draggable){this.dialog.draggable({handle:h.ids.titleBar,containment:"document"});}if(h.resizable&&this.dialog.resizable){this.dialog.resizable({alsoResize:this.display,containment:"document",resize:function(i){j.onResize();}});}}this.node=this.dialog.find(h.ids.node).medianode(this.server,h);if(this.node){this.node.display.unbind("nodeload").bind("nodeload",function(i,k){j.onNodeLoad(k);});if(this.node.player&&this.node.player.media){this.node.player.media.display.unbind("mediaupdate").bind("mediaupdate",function(i,k){j.onMediaUpdate(k);});}if(this.node.uservoter){this.node.uservoter.display.unbind("voteSet").bind("voteSet",function(k,i){if(j.activePlaylist){j.activePlaylist.onVoteSet(i);}});}}this.onMediaUpdate=function(i){this.node.player.onMediaUpdate(i);if(h.autoNext&&this.activePlaylist&&(i.type=="complete")){this.activePlaylist.loadNext();}if(this.controller){this.controller.onMediaUpdate(i);}if(this.activeController){this.activeController.onMediaUpdate(i);}if(this.menu&&this.node&&(i.type=="meta")){this.menu.setEmbedCode(this.node.player.media.player.getEmbedCode());this.menu.setMediaLink(this.node.player.media.player.getMediaLink());}if(h.template&&h.template.onMediaUpdate){h.template.onMediaUpdate(i);}};this.onPlaylistLoad=function(i){if(this.node){if(this.node.player&&this.node.player.media){this.node.player.media.hasPlaylist=true;}this.node.loadNode(i);}if(h.template.onPlaylistLoad){h.template.onPlaylistLoad(i);}};this.onNodeLoad=function(i){if(h.template.onNodeLoad){h.template.onNodeLoad(i);}};this.maximize=function(i){if(!this.fullScreen){if(h.template.onMaximize&&(i!=this.maxOn)){this.maxOn=i;h.template.onMaximize(this.maxOn);}}};this.addPlaylist=function(i){if(i){i.display.unbind("playlistload").bind("playlistload",i,function(k,l){j.activePlaylist=k.data;j.onPlaylistLoad(l);});if(!this.activePlaylist&&i.activeTeaser){this.activePlaylist=i;this.onPlaylistLoad(i.activeTeaser.node.nodeInfo);}}return i;};this.searchForElement=function(i){for(var l in i){var k=new RegExp("^"+l+"(\\_[0-9]+)?$","i");if(h.id.search(k)===0){return i[l];}}return null;};this.playlist=this.addPlaylist(this.dialog.find(h.ids.playlist).mediaplaylist(this.server,h));this.addController=function(k,i){if(k){k.display.unbind("controlupdate").bind("controlupdate",k,function(l,m){j.activeController=l.data;if(j.node&&j.node.player){j.node.player.onControlUpdate(m);}});if(i&&!this.activeController){this.activeController=k;}this.addPlayerEvents(k);}return k;};this.controller=this.addController(this.dialog.find(h.ids.control).mediacontrol(h),false);if(this.controller&&this.node){this.node.addVoters(this.controller.display);}this.onResize=function(){if(h.template.onResize){h.template.onResize();}if(this.node){this.node.onResize();}if(this.controller){this.controller.onResize();}};this.showNativeControls=function(i){var k=this.node?this.node.player:null;if(k&&k.hasControls()){k.usePlayerControls=i;if(i){k.busy.hide();k.play.hide();if(k.preview){k.preview.display.hide();}if(this.controller){this.controller.display.hide();}}else{k.showBusy(1,((this.busyFlags&2)==2));k.showPlay(this.playVisible);k.showPreview(this.previewVisible);if(this.controller){this.controller.display.show();}}k.showControls(i);}};this.loadContent=function(){var l=this.searchForElement(jQuery.media.controllers);if(l){f=l.length;while(f){f--;this.addController(l[f],true);}}var i=this.searchForElement(jQuery.media.playlists);if(i){f=i.length;while(f){f--;this.addPlaylist(i[f]);}}var k=false;if(this.playlist){k=this.playlist.loadPlaylist();}if(!k&&this.node){if(this.node.player&&this.node.player.media){this.node.player.media.settings.repeat=(h.loop||h.repeat);}this.node.loadNode();}};this.initializeTemplate=function(){if(h.template.initialize){h.template.initialize(h);}jQuery.media.utils.resetVisibility(e);};this.load=function(){this.initializeTemplate();this.dialog.css("position","relative");this.dialog.css("marginLeft",0);this.dialog.css("overflow","visible");if(h.fullscreen){this.onFullScreen(true);}this.loaded=true;this.display.trigger("playerLoaded",this);if(jQuery.media.loadCallbacks[h.id]){var l=jQuery.media.loadCallbacks[h.id];var k=l.length;while(k){k--;l[k](this);}}this.server.connect(function(i){j.loadContent();});};this.load();})(this,d);};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{playlist:"",args:[],wildcard:"*"});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{pager:"#mediapager",scroll:"#mediascroll",busy:"#mediabusy",links:"#medialinks"});jQuery.fn.mediaplaylist=function(e,d){if(this.length===0){return null;}return new (function(g,h,f){f=jQuery.media.utils.getSettings(f);this.display=h;var i=this;this.teasers=[];this.selectedTeaser=null;this.activeTeaser=null;this.args=f.args;this.setActive=true;this.activePager=null;this.pager=null;this.parser=jQuery.media.parser(f);this.scrollRegion=h.find(f.ids.scroll).mediascroll(f);this.scrollRegion.clear();this.busy=h.find(f.ids.busy);this.busyVisible=false;this.busyImg=this.busy.find("img");this.busyWidth=this.busyImg.width();this.busyHeight=this.busyImg.height();this.links=h.find(f.ids.links).medialinks(f);this.links.loadLinks();this.loading=function(j){if(this.pager){this.pager.enabled=!j;}if(this.activePager){this.activePager.enabled=!j;}if(j){this.busyVisible=true;this.busy.show();}else{this.busyVisible=false;this.busy.hide();}};this.addPager=function(j,k){if(j){j.display.unbind("loadindex").bind("loadindex",function(l,m){if(m.active){i.activateTeaser(i.teasers[m.index]);}else{i.selectTeaser(i.teasers[m.index]);}});j.display.unbind("loadpage").bind("loadpage",function(l,m){i.setActive=m.active;i.loadPlaylist({pageIndex:m.index});});if(k&&!this.activePager){this.activePager=j;}}return j;};this.pager=this.addPager(h.find(f.ids.pager).mediapager(f),false);this.links.display.unbind("linkclick").bind("linkclick",function(k,j){i.onLinkClick(j);});this.onLinkClick=function(m){var k=m.index;var l=m.playlist;var j=[];j[k]=m.arg;if(this.pager){this.pager.reset();}if(this.activePager){this.activePager.reset();}this.loadPlaylist({playlist:l,args:j});};this.loadNext=function(){if(this.pager){this.pager.loadNext(true);}else{if(this.activePager){this.activePager.loadNext(true);}}};this.loadPlaylist=function(j){var l={playlist:f.playlist,pageLimit:f.pageLimit,pageIndex:(this.pager?this.pager.activePage:0),args:{}};var k=jQuery.extend({},l,j);this.setArgs(k.args);this.loading(true);if(k.playlist){if(((typeof k.playlist)=="object")){f.playlist=k.playlist.name;this.setPlaylist(k.playlist);}else{if(k.playlist.match(/^http[s]?\:\/\/|\.xml$/i)){this.parser.parseFile(k.playlist,function(m){i.setPlaylist(m);});}else{if(g){g.call(jQuery.media.commands.getPlaylist,function(m){i.setPlaylist(m);},null,k.playlist,k.pageLimit,k.pageIndex,this.args);}}}return true;}return false;};this.setPlaylist=function(m){if(m&&m.nodes){var j=[];jQuery.media.utils.checkVisibility(this.display,j);if(this.pager){this.pager.setTotalItems(m.total_rows);}if(this.activePager){this.activePager.setTotalItems(m.total_rows);}this.scrollRegion.clear();this.resetTeasers();var l=m.nodes.length;for(var k=0;k").mediaimage(null,true);this.display.append(i.display);if((f.rotatorTransition=="hscroll")||(f.rotatorTransition=="vscroll")){i.display.css({"float":"left"});}else{i.display.css({position:"absolute",zIndex:(200-this.images.length),top:0,left:0});}return i;};this.loadImages=function(i){this.images=[];this.imageIndex=0;jQuery.each(i,function(j){var k=h.addImage();if(j===0){k.display.unbind("imageLoaded").bind("imageLoaded",function(){h.onImageLoaded();}).show();}k.loadImage(this);h.images.push(k);});if(f.rotatorHover){this.display.unbind("mouseenter").bind("mouseenter",function(){h.startRotator();}).unbind("mouseleave").bind("mouseleave",function(){clearInterval(h.imageInterval);});}else{this.startRotator();}};this.startRotator=function(){clearInterval(this.imageInterval);this.imageInterval=setInterval(function(){h.showNextImage();},f.rotatorTimeout);};this.showNextImage=function(){this.hideImage(this.images[this.imageIndex].display);this.imageIndex=(this.imageIndex+1)%this.images.length;this.showImage(this.images[this.imageIndex].display);};this.showImage=function(i){if(f.rotatorTransition==="fade"){i.fadeIn(f.rotatorSpeed);}else{i.css({marginLeft:0,marginTop:0}).show();}};this.hideImage=function(i){switch(f.rotatorTransition){case"fade":i.fadeOut(f.rotatorSpeed);break;case"hscroll":i.animate({marginLeft:-this.width},f.rotatorSpeed,f.rotatorEasing,function(){i.css({marginLeft:0}).remove();h.display.append(i);});break;case"vscroll":i.animate({marginTop:-this.height},f.rotatorSpeed,f.rotatorEasing,function(){i.css({marginTop:0}).remove();h.display.append(i);});break;default:i.hide();break;}};var e=[];g.find("img").each(function(){e.push(c(this).attr("src"));});g.empty().css("overflow","hidden").append(c('
'));this.display=g.find(".imagerotatorinner");if(e.length){this.loadImages(e);}})(this,d);};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{gateway:""});jQuery.media=jQuery.extend({},{rpc:function(d){return new (function(e){e=jQuery.media.utils.getSettings(e);var f=this;this.parseObject=function(k){var g="";if(k instanceof Date){g="";g+=k.getFullYear();g+=k.getMonth();g+=k.getDate();g+="T";g+=k.getHours()+":";g+=k.getMinutes()+":";g+=k.getSeconds();g+="";}else{if(k instanceof Array){g="\n";for(var j=0;j"+this.serializeToXML(k[j])+"\n";}g+="";}else{g="\n";for(var h in k){if(k.hasOwnProperty(h)){g+=" "+h+"";g+=this.serializeToXML(k[h])+"\n";}}g+="";}}return g;};this.serializeToXML=function(h){switch(typeof h){case"boolean":return""+((h)?"1":"0")+"";case"number":var g=parseInt(h,10);if(g==h){return""+h+"";}return""+h+"";case"string":return""+h+"";case"object":return this.parseObject(h);default:break;}return"";};this.parseXMLValue=function(h){var o=jQuery(h).children();var m=o.length;var p=function(i){return function(){i.push(f.parseXMLValue(this));};};var n=function(i){return function(){i[jQuery("> name",this).text()]=f.parseXMLValue(jQuery("value",this));};};for(var k=0;k data > value",l).each(p(g));return g;case"struct":var j={};jQuery("> member",l).each(n(j));return j;case"dateTime.iso8601":return NULL;default:break;}}return null;};this.parseXML=function(h){var g={};g.version="1.0";jQuery("methodResponse params param > value",h).each(function(i){g.result=f.parseXMLValue(this);});jQuery("methodResponse fault > value",h).each(function(i){g.error=f.parseXMLValue(this);});return g;};this.xmlRPC=function(l,k){var g='';g+="";g+=""+l+"";if(k.length>0){g+="";var j=k.length;for(var h=0;h"+this.serializeToXML(k[h])+"";}}g+="";}g+="";return g;};this.call=function(k,j,g,i,h){if(e.gateway){jQuery.ajax({url:e.gateway,dataType:"xml",type:"POST",data:this.xmlRPC(k,i),error:function(l,n,m){if(g){g(n);}else{if(window.console&&console.log){console.log("Error: "+n);}}},success:function(m){var l=f.parseXML(m);if(l.error){if(g){g(l.error);}else{if(window.console&&console.dir){console.dir(l.error);}}}else{if(j){j(l.result);}}},processData:false,contentType:"text/xml"});}else{if(j){j(null);}}};})(d);}},jQuery.media);jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{vertical:true,scrollSpeed:20,updateTimeout:40,hysteresis:40,showScrollbar:true,scrollMode:"auto"});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{listMask:"#medialistmask",list:"#medialist",scrollWrapper:"#mediascrollbarwrapper",scrollBar:"#mediascrollbar",scrollTrack:"#mediascrolltrack",scrollHandle:"#mediascrollhandle",scrollUp:"#mediascrollup",scrollDown:"#mediascrolldown"});jQuery.fn.mediascroll=function(d){return new (function(e,g){g=jQuery.media.utils.getSettings(g);this.display=e;var h=this;this.spanMode=(g.scrollMode=="span");this.listMask=e.find(g.ids.listMask);if(this.spanMode||(g.scrollMode=="auto")){this.listMask.unbind("mouseenter").bind("mouseenter",function(i){h.onMouseOver(i);});this.listMask.unbind("mouseleave").bind("mouseleave",function(i){h.onMouseOut(i);});this.listMask.unbind("mousemove").bind("mousemove",function(i){h.onMouseMove(i);});}else{if(g.scrollMode=="mouse"){this.display.bind("mousewheel",function(k,l,j,i){k.preventDefault();h.onMouseScroll(j,i);});}}this.listMask.css("overflow","hidden");this.list=e.find(g.ids.list);var f=this.list.children().eq(0);this.elementWidth=f.width();this.elementHeight=f.height();this.elementSize=g.vertical?f.outerHeight(true):f.outerWidth(true);if(jQuery.browser.msie&&parseInt(jQuery.fn.jquery.replace(".",""),10)<132){this.template=c("
").append(jQuery.media.utils.cloneFix(f)).html();}else{this.template=c("
").append(f.clone()).html();}this.list.empty();this.pagePos=g.vertical?"pageY":"pageX";this.margin=g.vertical?"marginTop":"marginLeft";this.scrollSize=g.vertical?0:this.listMask.width();this.scrollMid=0;this.mousePos=0;this.listPos=0;this.scrollInterval=0;this.shouldScroll=false;this.bottomPos=0;this.ratio=0;this.elements=[];this.listSize=0;this.scrollBar=e.find(g.ids.scrollTrack).mediaslider(g.ids.scrollHandle,g.vertical);this.scrollUp=e.find(g.ids.scrollUp).medialink(g,function(){h.scroll(true);});this.scrollDown=e.find(g.ids.scrollDown).medialink(g,function(){h.scroll(false);});if(this.scrollBar){this.scrollBar.display.unbind("updatevalue").bind("updatevalue",function(i,j){h.setScrollPos(j*h.bottomPos,false);});this.scrollBar.display.unbind("setvalue").bind("setvalue",function(i,j){h.setScrollPos(j*h.bottomPos,true);});this.scrollBar.display.bind("mousewheel",function(k,l,j,i){k.preventDefault();h.onMouseScroll(j,i);});}this.setScrollSize=function(i){if(i){this.scrollSize=i;this.scrollMid=this.scrollSize/2;var j=this.scrollSize-(g.hysteresis*2);this.bottomPos=(this.listSize-this.scrollSize);this.ratio=((this.listSize-j)/j);this.shouldScroll=(this.bottomPos>0);}};this.clear=function(){this.mousePos=0;this.shouldScroll=false;this.bottomPos=0;this.ratio=0;this.scrolling=false;this.elements=[];this.listSize=0;this.list.css(this.margin,0);this.list.children().unbind();clearInterval(this.scrollInterval);this.list.empty();};this.getOffset=function(){return g.vertical?this.listMask.offset().top:this.listMask.offset().left;};this.activate=function(){this.setScrollSize(g.vertical?this.listMask.height():this.listMask.width());this.setScrollPos(0,true);};this.newItem=function(){var j=c(this.template);this.list.append(j);var i=this.getElement(j,this.elements.length);this.listSize+=i.size;if(g.vertical){this.list.css({height:this.listSize});}else{this.list.css({width:this.listSize});}this.elements.push(i);return i.obj;};this.getElement=function(k,i){var j=this.elementSize;var l=this.listSize;return{obj:k,size:j,position:l,bottom:(l+j),mid:(j/2),index:i};};this.scroll=function(i){var j=this.getElementAtPosition(i?0:this.scrollSize);if(j){var l=(j.straddle||i)?j:this.elements[j.index+1];if(l){var k=i?l.position:(l.bottom-this.scrollSize);this.setScrollPos(k,true);}}};this.onMouseScroll=function(j,i){var k=g.vertical?-i:j;this.setScrollPos(this.listPos+(g.scrollSpeed*k));};this.onMouseMove=function(i){this.mousePos=i[this.pagePos]-this.getOffset();if(this.shouldScroll&&this.spanMode){this.setScrollPos((this.mousePos-g.hysteresis)*this.ratio);}};this.onMouseOver=function(i){if(this.shouldScroll){clearInterval(this.scrollInterval);this.scrollInterval=setInterval(function(){h.update();},g.updateTimeout);}};this.onMouseOut=function(i){clearInterval(this.scrollInterval);};this.align=function(i){var j=this.getElementAtPosition(i?0:this.scrollSize);if(j){var k=i?j.position:(j.bottom-this.scrollSize);this.setScrollPos(k,true);}};this.setVisible=function(i){var k=this.elements[i];if(k){var j=this.listPos;if(k.positionthis.scrollSize){j=k.bottom-this.scrollSize;}}if(j!=this.listPos){this.setScrollPos(j,true);}}};this.getElementAtPosition=function(j){var l=null;var k=this.elements.length;while(k--){l=this.elements[k];if(((l.position-this.listPos)=j)){l.straddle=((l.bottom-this.listPos)!=j);break;}}return l;};this.update=function(){var j=this.mousePos-this.scrollMid;if(Math.abs(j)>g.hysteresis){var i=(j>0)?-g.hysteresis:g.hysteresis;j=g.scrollSpeed*((this.mousePos+i-this.scrollMid)/this.scrollMid);this.setScrollPos(this.listPos+j);}};this.setScrollPos=function(k,j){k=(k<0)?0:k;if(this.shouldScroll&&(k>this.bottomPos)){k=this.bottomPos;}this.listPos=k;if(this.scrollBar){var i=this.bottomPos?(this.listPos/this.bottomPos):0;this.scrollBar.setPosition(i);}if(j){if(g.vertical){this.list.animate({marginTop:-this.listPos},(g.scrollSpeed*10));}else{this.list.animate({marginLeft:-this.listPos},(g.scrollSpeed*10));}}else{this.list.css(this.margin,-this.listPos);}};})(this,d);};jQuery.media=jQuery.extend({},{sha256:function(){function d(V,U){d.charSize=8;d.b64pad="";d.hexCase=0;var S=null;var Q=null;var z=function(p){var o=[];var s=(1<>5]|=(p.charCodeAt(q/d.charSize)&s)<<(32-d.charSize-q%32);}return o;};var x=function(p){var o=[];var s=p.length;for(var q=0;q>3]|=r<<(24-(4*(q%8)));}else{return"INVALID HEX STRING";}}return o;};var n=null;var l=null;if("HEX"===U){if(0!==(V.length%2)){return"TEXT MUST BE IN BYTE INCREMENTS";}n=V.length*4;l=x(V);}else{if(("ASCII"===U)||("undefined"===typeof(U))){n=V.length*d.charSize;l=z(V);}else{return"UNKNOWN TEXT INPUT TYPE";}}var T=function(p){var o=d.hexCase?"0123456789ABCDEF":"0123456789abcdef";var s="";var r=p.length*4;for(var q=0;q>2]>>((3-q%4)*8+4))&15)+o.charAt((p[q>>2]>>((3-q%4)*8))&15);}return s;};var R=function(p){var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var v="";var u=p.length*4;for(var r=0;r>2]>>8*(3-r%4))&255)<<16)|(((p[r+1>>2]>>8*(3-(r+1)%4))&255)<<8)|((p[r+2>>2]>>8*(3-(r+2)%4))&255);for(var q=0;q<4;q++){if(r*8+q*6>p.length*32){v+=d.b64pad;}else{v+=o.charAt((s>>6*(3-q))&63);}}}return v;};var K=function(o,p){if(p<32){return(o>>>p)|(o<<(32-p));}else{return o;}};var H=function(o,p){if(p<32){return o>>>p;}else{return 0;}};var y=function(o,q,p){return(o&q)^(~o&p);};var t=function(o,q,p){return(o&q)^(o&p)^(q&p);};var m=function(o){return K(o,2)^K(o,13)^K(o,22);};var k=function(o){return K(o,6)^K(o,11)^K(o,25);};var j=function(o){return K(o,7)^K(o,18)^H(o,3);};var i=function(o){return K(o,17)^K(o,19)^H(o,10);};var h=function(p,r){var q=(p&65535)+(r&65535);var o=(p>>>16)+(r>>>16)+(q>>>16);return((o&65535)<<16)|(q&65535);};var g=function(p,o,u,s){var r=(p&65535)+(o&65535)+(u&65535)+(s&65535);var q=(p>>>16)+(o>>>16)+(u>>>16)+(s>>>16)+(r>>>16);return((q&65535)<<16)|(r&65535);};var f=function(p,o,v,u,s){var r=(p&65535)+(o&65535)+(v&65535)+(u&65535)+(s&65535);var q=(p>>>16)+(o>>>16)+(v>>>16)+(u>>>16)+(s>>>16)+(r>>>16);return((q&65535)<<16)|(r&65535);};var e=function(B,A,w){var o=[];var M,L,J,I,G,F,E,D;var v,s;var q;var p=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];if(w==="SHA-224"){q=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428];}else{q=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];}B[A>>5]|=128<<(24-A%32);B[((A+1+64>>9)<<4)+15]=A;var u=B.length;for(var C=0;Cp){v[15]&=4294967040;}}for(var r=0;r<=15;r++){u[r]=v[r]^909522486;s[r]=v[r]^1549556828;}q=e(u.concat(l),512+n,B);q=e(s.concat(q),512+o,B);return(w(q));};}this.encrypt=function(g,e){var f=new d(e,"ASCII");return f.getHMAC(g,"ASCII","SHA-256","HEX");};}},jQuery.media);jQuery.fn.mediaslider=function(d,f,e){if(this.length===0){return null;}return new (function(j,g,i,h){var k=this;this.display=j.css({cursor:"pointer"});this.dragging=false;this.value=0;this.handle=this.display.find(g);this.pagePos=i?"pageY":"pageX";this.handlePos=0;if(this.handle.length>0){this.handleSize=i?this.handle.height():this.handle.width();this.handleMid=(this.handleSize/2);}this.onResize=function(){this.setTrackSize();this.updateValue(this.value);};this.setTrackSize=function(){this.trackSize=i?this.display.height():this.display.width();this.trackSize-=this.handleSize;this.trackSize=(this.trackSize>0)?this.trackSize:1;};this.setValue=function(l){this.setPosition(l);this.display.trigger("setvalue",this.value);};this.updateValue=function(l){this.setPosition(l);this.display.trigger("updatevalue",this.value);};this.setPosition=function(l){l=(l<0)?0:l;l=(l>1)?1:l;this.value=l;this.handlePos=h?(1-this.value):this.value;this.handlePos*=this.trackSize;this.handle.css((i?"marginTop":"marginLeft"),this.handlePos);};this.display.unbind("mousedown").bind("mousedown",function(l){l.preventDefault();k.dragging=true;});this.getOffset=function(){var l=i?this.display.offset().top:this.display.offset().left;return(l+(this.handleSize/2));};this.getPosition=function(l){var m=(l-this.getOffset())/this.trackSize;m=(m<0)?0:m;m=(m>1)?1:m;m=h?(1-m):m;return m;};this.display.unbind("mousemove").bind("mousemove",function(l){l.preventDefault();if(k.dragging){k.updateValue(k.getPosition(l[k.pagePos]));}});this.display.unbind("mouseleave").bind("mouseleave",function(l){l.preventDefault();if(k.dragging){k.dragging=false;k.setValue(k.getPosition(l[k.pagePos]));}});this.display.unbind("mouseup").bind("mouseup",function(l){l.preventDefault();if(k.dragging){k.dragging=false;k.setValue(k.getPosition(l[k.pagePos]));}});this.onResize();})(this,d,f,e);};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{pageLink:false});jQuery.fn.mediateaser=function(f,d,g,e){if(this.length===0){return null;}return new (function(l,i,m,h,j){j=jQuery.media.utils.getSettings(j);var n=this;this.display=h;this.display.unbind("mouseenter").bind("mouseenter",function(o){if(j.template.onTeaserOver){j.template.onTeaserOver(n);}});this.display.unbind("mouseleave").bind("mouseleave",function(o){if(j.template.onTeaserOut){j.template.onTeaserOut(n);}});this.index=m;this.node=this.display.medianode(l,j);if(this.node){this.node.loadNode(i);}if(this.node&&j.pageLink){var k=j.baseURL;k+=i.path?i.path:("node/"+i.nid);this.node.display.wrap('');}this.reset=function(){if(this.node){this.node.display.unbind();}};this.setActive=function(o){if(j.template.onTeaserActivate){j.template.onTeaserActivate(this,o);}};this.setSelected=function(o){if(j.template.onTeaserSelect){j.template.onTeaserSelect(this,o);}};if(j.template.onTeaserLoad){j.template.onTeaserLoad(this);}})(f,d,g,this,e);};jQuery.media.ids=jQuery.extend(jQuery.media.ids,{titleLinks:"#mediatitlelinks"});jQuery.fn.mediatitlebar=function(d){if(this.length===0){return null;}return new (function(e,f){var g=this;this.display=e;this.titleLinks=this.display.find(f.ids.titleLinks);this.display.find("a").each(function(){var h=c(this).attr("href");c(this).medialink(f,function(i){i.preventDefault();g.display.trigger(i.data.id);},{id:h.substr(1),obj:c(this)});});})(this,d);};jQuery.media=jQuery.extend({},{utils:{getBaseURL:function(){var d=new RegExp(/^(http[s]?\:[\\\/][\\\/])([^\\\/\?]+)/);var e=d.exec(location.href);return e?e[0]:"";},timer:{},stopElementHide:{},showThenHide:function(d,h,e,f,g){if(d){d.show(e);if(jQuery.media.utils.timer.hasOwnProperty(h)){clearTimeout(jQuery.media.utils.timer[h]);}jQuery.media.utils.timer[h]=setTimeout(function(){if(!jQuery.media.utils.stopElementHide[h]){d.hide(f,function(){if(jQuery.media.utils.stopElementHide[h]){d.show();}if(g){g();}});}},5000);}},stopHide:function(d,e){jQuery.media.utils.stopElementHide[e]=true;clearTimeout(jQuery.media.utils.timer[e]);},stopHideOnOver:function(d,e){if(d){jQuery.media.utils.stopElementHide[e]=false;d.unbind("mouseover").bind("mouseover",{id:e},function(f){jQuery.media.utils.stopElementHide[f.data.id]=true;}).unbind("mouseout").bind("mouseout",{id:e},function(f){jQuery.media.utils.stopElementHide[f.data.id]=false;});}},getSettings:function(d){if(!d){d={};}if(!d.initialized){d=jQuery.extend({},jQuery.media.defaults,d);d.ids=jQuery.extend({},jQuery.media.ids,d.ids);d.baseURL=d.baseURL?d.baseURL:jQuery.media.utils.getBaseURL();d.baseURL+=d.baseURL?"/":"";d.initialized=true;}return d;},getId:function(d){return d.attr("id")?d.attr("id"):d.attr("class")?d.attr("class"):"mediaplayer";},getScaledRect:function(d,g){var f={};f.x=g.x?g.x:0;f.y=g.y?g.y:0;f.width=g.width?g.width:0;f.height=g.height?g.height:0;if(d){var e=(g.width/g.height);f.height=(e>d)?g.height:Math.floor(g.width/d);f.width=(e>d)?Math.floor(g.height*d):g.width;f.x=Math.floor((g.width-f.width)/2);f.y=Math.floor((g.height-f.height)/2);}return f;},checkVisibility:function(f,e){var d=true;f.parents().each(function(){var g=jQuery(this);if(!g.is(":visible")){d=false;var h=g.attr("class");e.push({obj:g,attr:h});g.removeClass(h);}});},resetVisibility:function(d){var e=d.length;while(e){e--;d[e].obj.addClass(d[e].attr);}},getFlash:function(j,d,e,k,g,f){var l=window.location.protocol;if(l.charAt(l.length-1)==":"){l=l.substring(0,l.length-1);}var i=jQuery.param(g);var h=' ';h+='';h+='';h+='';h+='';h+='';h+='';h+='';h+="";return h;},removeFlash:function(e,f){if(typeof(swfobject)!="undefined"){swfobject.removeSWF(f);}else{var d=e.find("object").eq(0)[0];if(d){d.parentNode.removeChild(d);}}},insertFlash:function(j,m,e,f,n,h,g,l){jQuery.media.utils.removeFlash(j,e);j.children().remove();j.append('

Get Adobe Flash player

');if(typeof(swfobject)!="undefined"){var i={allowScriptAccess:"always",allowfullscreen:"true",wmode:g,quality:"high"};swfobject.embedSWF(m,e,f,n,"9.0.0","expressInstall.swf",h,i,{},function(o){l(o.ref);});}else{var k=jQuery.media.utils.getFlash(m,e,f,n,h,g);var d=j.find("#"+e).eq(0);if(jQuery.browser.msie){d[0].outerHTML=k;l(j.find("object").eq(0)[0]);}else{d.replaceWith(k);l(j.find("embed").eq(0)[0]);}}},cloneFix:function(g,f){var d=g.map(function(){var i=this.outerHTML;if(!i){var j=this.ownerDocument.createElement("div");j.appendChild(this.cloneNode(true));i=j.innerHTML;}return jQuery.clean([i.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0];});if(f===true){var h=g.find("*").andSelf(),e=0;d.find("*").andSelf().each(function(){if(this.nodeName!==h[e].nodeName){return;}var i=jQuery.data(h[e],"events");for(var k in i){if(i.hasOwnProperty(k)){for(var j in i[k]){if(i[k].hasOwnProperty(j)){jQuery.event.add(this,k,i[k][j],i[k][j].data);}}}}e++;});}return d;}}},jQuery.media);window.onVimeoReady=function(d){d=d.replace(/\_media$/,"");jQuery.media.players[d].node.player.media.player.onReady();};window.onVimeoFinish=function(d){d=d.replace(/\_media$/,"");jQuery.media.players[d].node.player.media.player.onFinished();};window.onVimeoLoading=function(e,d){d=d.replace(/\_media$/,"");jQuery.media.players[d].node.player.media.player.onLoading(e);};window.onVimeoPlay=function(d){d=d.replace(/\_media$/,"");jQuery.media.players[d].node.player.media.player.onPlaying();};window.onVimeoPause=function(d){d=d.replace(/\_media$/,"");jQuery.media.players[d].node.player.media.player.onPaused();};window.onVimeoProgress=function(e,d){d=d.replace(/\_media$/,"");jQuery.media.players[d].node.player.media.player.onProgress(e);};jQuery.media.playerTypes=jQuery.extend(jQuery.media.playerTypes,{vimeo:function(d){return(d.search(/^http(s)?\:\/\/(www\.)?vimeo\.com/i)===0);}});jQuery.fn.mediavimeo=function(e,d){return new (function(h,g,f){this.display=h;var i=this;this.player=null;this.videoFile=null;this.ready=false;this.bytesLoaded=0;this.bytesTotal=0;this.currentVolume=1;this.createMedia=function(l,n){this.videoFile=l;this.ready=false;var k=(g.id+"_media");var j={clip_id:this.getId(l.path),width:"100%",height:"100%",js_api:"1",js_onLoad:"onVimeoReady",js_swf_id:k};var m=Math.floor(Math.random()*1000000);var o="http://vimeo.com/moogaloop.swf?rand="+m;jQuery.media.utils.insertFlash(this.display,o,k,"100%","100%",j,g.wmode,function(p){i.player=p;i.loadPlayer();});};this.getId=function(k){var j=/^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i;return(k.search(j)===0)?k.replace(j,"$3"):k;};this.loadMedia=function(j){this.bytesLoaded=0;this.bytesTotal=0;this.createMedia(j);};this.onReady=function(){this.ready=true;this.loadPlayer();};this.loadPlayer=function(){if(this.ready&&this.player&&this.player.api_addEventListener){this.player.api_addEventListener("onProgress","onVimeoProgress");this.player.api_addEventListener("onFinish","onVimeoFinish");this.player.api_addEventListener("onLoading","onVimeoLoading");this.player.api_addEventListener("onPlay","onVimeoPlay");this.player.api_addEventListener("onPause","onVimeoPause");f({type:"playerready"});this.playMedia();}};this.onFinished=function(){f({type:"complete"});};this.onLoading=function(j){this.bytesLoaded=j.bytesLoaded;this.bytesTotal=j.bytesTotal;};this.onPlaying=function(){f({type:"playing",busy:"hide"});};this.onPaused=function(){f({type:"paused",busy:"hide"});};this.playMedia=function(){f({type:"playing",busy:"hide"});if(this.player.api_play){this.player.api_play();}};this.onProgress=function(j){f({type:"progress"});};this.pauseMedia=function(){f({type:"paused",busy:"hide"});if(this.player.api_pause){this.player.api_pause();}};this.stopMedia=function(){this.pauseMedia();if(this.player.api_unload){this.player.api_unload();}};this.destroy=function(){this.stopMedia();jQuery.media.utils.removeFlash(this.display,(g.id+"_media"));this.display.children().remove();};this.seekMedia=function(j){if(this.player.api_seekTo){this.player.api_seekTo(j);}};this.setVolume=function(j){this.currentVolume=j;if(this.player.api_setVolume){this.player.api_setVolume((j*100));}};this.getVolume=function(){return this.currentVolume;};this.getDuration=function(){return this.player.api_getDuration?this.player.api_getDuration():0;};this.getCurrentTime=function(){return this.player.api_getCurrentTime?this.player.api_getCurrentTime():0;};this.getBytesLoaded=function(){return this.bytesLoaded;};this.getBytesTotal=function(){return this.bytesTotal;};this.setQuality=function(j){};this.getQuality=function(){return"";};this.hasControls=function(){return true;};this.showControls=function(j){};this.getEmbedCode=function(){return"This video cannot be embedded.";};this.getMediaLink=function(){return"This video currently does not have a link.";};})(this,e,d);};jQuery.fn.mediavoter=function(d,f,e){if(this.length===0){return null;}return new (function(h,g,j,i){this.display=h;var k=this;this.nodeId=0;this.votes=[];this.tag=this.display.attr("tag");this.display.find("div").each(function(){if(i){c(this).css("cursor","pointer");c(this).unbind("click").bind("click",function(l){k.setVote(parseInt(c(this).attr("vote"),10));});c(this).unbind("mouseenter").bind("mouseenter",function(l){k.updateVote({value:parseInt(c(this).attr("vote"),10)},true);});}k.votes.push({vote:parseInt(c(this).attr("vote"),10),display:c(this)});});this.votes.sort(function(m,l){return(m.vote-l.vote);});if(i){this.display.unbind("mouseleave").bind("mouseleave",function(l){k.updateVote({value:0},true);});}this.updateVote=function(l,m){if(l&&g.template.updateVote){g.template.updateVote(this,l.value,m);}};this.getVote=function(m){if(m&&m.nid){this.nodeId=parseInt(m.nid,10);if(m.vote){var l=i?m.vote.uservote:m.vote.vote;this.updateVote(m.vote.vote,false);this.display.trigger("voteGet",l);}else{if(j&&m.nid&&(this.display.length>0)){this.display.trigger("processing");var n=i?jQuery.media.commands.getUserVote:jQuery.media.commands.getVote;j.call(n,function(o){k.updateVote(o,false);k.display.trigger("voteGet",o);},null,"node",this.nodeId,this.tag);}}}};this.setVote=function(l){if(j&&this.nodeId){this.display.trigger("processing");this.updateVote({value:l},false);j.call(jQuery.media.commands.setVote,function(m){k.display.trigger("voteSet",m);},null,"node",this.nodeId,l,this.tag);}};this.deleteVote=function(){if(j&&this.nodeId){this.display.trigger("processing");j.call(jQuery.media.commands.deleteVote,function(l){k.updateVote(l,false);k.display.trigger("voteDelete",l);},null,"node",this.nodeId,this.tag);}};})(this,d,f,e);};window.onYouTubePlayerReady=function(d){d=d.replace(/\_media$/,"");jQuery.media.players[d].node.player.media.player.onReady();};jQuery.media.playerTypes=jQuery.extend(jQuery.media.playerTypes,{youtube:function(d){return(d.search(/^http(s)?\:\/\/(www\.)?youtube\.com/i)===0);}});jQuery.fn.mediayoutube=function(e,d){return new (function(h,g,f){this.display=h;var i=this;this.player=null;this.videoFile=null;this.loaded=false;this.ready=false;this.qualities=[];this.createMedia=function(k,m){this.videoFile=k;this.ready=false;var j=(g.id+"_media");var l=Math.floor(Math.random()*1000000);var n="http://www.youtube.com/apiplayer?rand="+l+"&version=3&enablejsapi=1&playerapiid="+j;jQuery.media.utils.insertFlash(this.display,n,j,"100%","100%",{},g.wmode,function(o){i.player=o;i.loadPlayer();});};this.getId=function(k){var j=/^http[s]?\:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9]+)/i;return(k.search(j)===0)?k.replace(j,"$2"):k;};this.loadMedia=function(j){if(this.player){this.loaded=false;this.videoFile=j;f({type:"playerready"});if(this.player.loadVideoById){this.player.loadVideoById(this.getId(this.videoFile.path),0,g.quality);}}};this.onReady=function(){this.ready=true;this.loadPlayer();};this.loadPlayer=function(){if(this.ready&&this.player){window[g.id+"StateChange"]=function(j){i.onStateChange(j);};window[g.id+"PlayerError"]=function(j){i.onError(j);};window[g.id+"QualityChange"]=function(j){i.quality=j;};if(this.player.addEventListener){this.player.addEventListener("onStateChange",g.id+"StateChange");this.player.addEventListener("onError",g.id+"PlayerError");this.player.addEventListener("onPlaybackQualityChange",g.id+"QualityChange");}if(this.player.getAvailableQualityLevels){this.qualities=this.player.getAvailableQualityLevels();}f({type:"playerready"});if(this.player.loadVideoById){this.player.loadVideoById(this.getId(this.videoFile.path),0);}}};this.onStateChange=function(k){var j=this.getPlayerState(k);f({type:j.state,busy:j.busy});if(!this.loaded&&j=="playing"){this.loaded=true;f({type:"meta"});}};this.onError=function(k){var j="An unknown error has occured: "+k;if(k==100){j="The requested video was not found. ";j+="This occurs when a video has been removed (for any reason), ";j+="or it has been marked as private.";}else{if((k==101)||(k==150)){j="The video requested does not allow playback in an embedded player.";}}if(window.console&&console.log){console.log(j);}f({type:"error",data:j});};this.getPlayerState=function(j){switch(j){case 5:return{state:"ready",busy:false};case 3:return{state:"buffering",busy:"show"};case 2:return{state:"paused",busy:"hide"};case 1:return{state:"playing",busy:"hide"};case 0:return{state:"complete",busy:false};case -1:return{state:"stopped",busy:false};default:return{state:"unknown",busy:false};}return"unknown";};this.playMedia=function(){f({type:"buffering",busy:"show"});if(this.player.playVideo){this.player.playVideo();}};this.pauseMedia=function(){if(this.player.pauseVideo){this.player.pauseVideo();}};this.stopMedia=function(){if(this.player.stopVideo){this.player.stopVideo();}};this.destroy=function(){this.stopMedia();jQuery.media.utils.removeFlash(this.display,(g.id+"_media"));this.display.children().remove();};this.seekMedia=function(j){f({type:"buffering",busy:"show"});if(this.player.seekTo){this.player.seekTo(j,true);}};this.setVolume=function(j){if(this.player.setVolume){this.player.setVolume(j*100);}};this.setQuality=function(j){if(this.player.setPlaybackQuality){this.player.setPlaybackQuality(j);}};this.getVolume=function(){return this.player.getVolume?(this.player.getVolume()/100):0;};this.getDuration=function(){return this.player.getDuration?this.player.getDuration():0;};this.getCurrentTime=function(){return this.player.getCurrentTime?this.player.getCurrentTime():0;};this.getQuality=function(){return this.player.getPlaybackQuality?this.player.getPlaybackQuality():0;};this.getEmbedCode=function(){return this.player.getVideoEmbedCode?this.player.getVideoEmbedCode():0;};this.getMediaLink=function(){return this.player.getVideoUrl?this.player.getVideoUrl():0;};this.getBytesLoaded=function(){return this.player.getVideoBytesLoaded?this.player.getVideoBytesLoaded():0;};this.getBytesTotal=function(){return this.player.getVideoBytesTotal?this.player.getVideoBytesTotal():0;};this.hasControls=function(){return false;};this.showControls=function(j){};})(this,e,d);};})(jQuery); \ No newline at end of file diff --git a/js/jquery.osmplayer.js b/js/jquery.osmplayer.js deleted file mode 100644 index 8166d2db..00000000 --- a/js/jquery.osmplayer.js +++ /dev/null @@ -1,6912 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Extend the media namespace - jQuery.media = jQuery.extend( {}, { - // Add the auto server object. - auto : function( settings ) { - // Return a new function for this object - return new (function( settings ) { - this.json = jQuery.media.json( settings ); - this.rpc = jQuery.media.rpc( settings ); - this.call = function( method, onSuccess, onFailed, params, protocol ) { - if( protocol == "json" ) { - this.json.call( method, onSuccess, onFailed, params, protocol ); - } - else { - this.rpc.call( method, onSuccess, onFailed, params, protocol ); - } - }; - })( settings ); - } - }, jQuery.media ); - -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - volumeVertical:false - }); - - // Set up our defaults for this component. - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - currentTime:"#mediacurrenttime", - totalTime:"#mediatotaltime", - playPause:"#mediaplaypause", - seekUpdate:"#mediaseekupdate", - seekProgress:"#mediaseekprogress", - seekBar:"#mediaseekbar", - seekHandle:"#mediaseekhandle", - volumeUpdate:"#mediavolumeupdate", - volumeBar:"#mediavolumebar", - volumeHandle:"#mediavolumehandle", - mute:"#mediamute" - }); - - jQuery.fn.mediacontrol = function( settings ) { - if( this.length === 0 ) { - return null; - } - return new (function( controlBar, settings ) { - settings = jQuery.media.utils.getSettings(settings); - this.display = controlBar; - var _this = this; - - // Allow the template to provide their own function for this... - this.formatTime = (settings.template && settings.template.formatTime) ? settings.template.formatTime : - function( time ) { - time = time ? time : 0; - var seconds = 0; - var minutes = 0; - var hour = 0; - - hour = Math.floor(time / 3600); - time -= (hour * 3600); - minutes = Math.floor( time / 60 ); - time -= (minutes * 60); - seconds = Math.floor(time % 60); - - var timeString = ""; - - if( hour ) { - timeString += String(hour); - timeString += ":"; - } - - timeString += (minutes >= 10) ? String(minutes) : ("0" + String(minutes)); - timeString += ":"; - timeString += (seconds >= 10) ? String(seconds) : ("0" + String(seconds)); - return { - time:timeString, - units:"" - }; - }; - - this.setToggle = function( button, state ) { - var on = state ? ".on" : ".off"; - var off = state ? ".off" : ".on"; - if( button ) { - button.find(on).show(); - button.find(off).hide(); - } - }; - - var zeroTime = this.formatTime( 0 ); - this.duration = 0; - this.volume = -1; - this.prevVolume = 0; - this.percentLoaded = 0; - this.playState = false; - this.muteState = false; - this.currentTime = controlBar.find( settings.ids.currentTime ).text( zeroTime.time ); - this.totalTime = controlBar.find( settings.ids.totalTime ).text( zeroTime.time ); - - // Allow them to attach custom links to the control bar that perform player functions. - this.display.find("a.mediaplayerlink").each( function() { - var linkId = $(this).attr("href"); - $(this).medialink( settings, function( event ) { - event.preventDefault(); - _this.display.trigger( event.data.id ); - }, { - id:linkId.substr(1), - obj:$(this) - } ); - }); - - // Set up the play pause button. - this.playPauseButton = controlBar.find( settings.ids.playPause ).medialink( settings, function( event, target ) { - _this.playState = !_this.playState; - _this.setToggle( target, _this.playState ); - _this.display.trigger( "controlupdate", { - type: (_this.playState ? "pause" : "play") - }); - }); - - // Set up the seek bar... - this.seekUpdate = controlBar.find( settings.ids.seekUpdate ).css("width", 0); - this.seekProgress = controlBar.find( settings.ids.seekProgress ).css("width", 0); - this.seekBar = controlBar.find( settings.ids.seekBar ).mediaslider( settings.ids.seekHandle, false ); - if( this.seekBar ) { - this.seekBar.display.unbind("setvalue").bind( "setvalue", function( event, data ) { - _this.seekUpdate.css( "width", (data * _this.seekBar.trackSize) + "px" ); - _this.display.trigger( "controlupdate", { - type:"seek", - value:(data * _this.duration) - }); - }); - this.seekBar.display.unbind("updatevalue").bind( "updatevalue", function( event, data ) { - _this.seekUpdate.css( "width", (data * _this.seekBar.trackSize) + "px" ); - }); - } - - this.setVolume = function( vol ) { - if( this.volumeBar ) { - if( settings.volumeVertical ) { - this.volumeUpdate.css({ - "marginTop":(this.volumeBar.handlePos + this.volumeBar.handleMid), - "height":(this.volumeBar.trackSize - this.volumeBar.handlePos) - }); - } - else { - this.volumeUpdate.css( "width", (vol * this.volumeBar.trackSize) ); - } - } - }; - - // Set up the volume bar. - this.volumeUpdate = controlBar.find( settings.ids.volumeUpdate ); - this.volumeBar = controlBar.find( settings.ids.volumeBar ).mediaslider( settings.ids.volumeHandle, settings.volumeVertical, settings.volumeVertical ); - if( this.volumeBar ) { - this.volumeBar.display.unbind("setvalue").bind("setvalue", function( event, data ) { - _this.setVolume( data ); - _this.display.trigger( "controlupdate", { - type:"volume", - value:data - }); - }); - this.volumeBar.display.unbind("updatevalue").bind("updatevalue", function( event, data ) { - _this.setVolume( data ); - _this.volume = data; - }); - } - - // Setup the mute button. - this.mute = controlBar.find(settings.ids.mute).medialink( settings, function( event, target ) { - _this.muteState = !_this.muteState; - _this.setToggle( target, _this.muteState ); - _this.setMute( _this.muteState ); - }); - - this.setMute = function( state ) { - this.prevVolume = (this.volumeBar.value > 0) ? this.volumeBar.value : this.prevVolume; - this.volumeBar.updateValue( state ? 0 : this.prevVolume ); - this.display.trigger( "controlupdate", { - type:"mute", - value:state - }); - }; - - this.setProgress = function( percent ) { - if( this.seekProgress && this.seekBar ) { - this.seekProgress.css( "width", (percent * (this.seekBar.trackSize + this.seekBar.handleSize)) ); - } - }; - - this.onResize = function() { - if( this.seekBar ) { - this.seekBar.onResize(); - } - this.setProgress( this.percentLoaded ); - }; - - // Handle the media events... - this.onMediaUpdate = function( data ) { - switch( data.type ) { - case "reset": - this.reset(); - break; - case "paused": - this.playState = true; - this.setToggle( this.playPauseButton.display, this.playState ); - break; - case "playing": - this.playState = false; - this.setToggle( this.playPauseButton.display, this.playState ); - break; - case "stopped": - this.playState = true; - this.setToggle( this.playPauseButton.display, this.playState ); - break; - case "progress": - this.percentLoaded = data.percentLoaded; - this.setProgress( this.percentLoaded ); - break; - case "meta": - case "update": - this.timeUpdate( data.currentTime, data.totalTime ); - if( this.volumeBar ) { - this.volumeBar.updateValue( data.volume ); - } - break; - default: - break; - } - }; - - // Call to reset all controls... - this.reset = function() { - this.totalTime.text( this.formatTime(0).time ); - this.currentTime.text( this.formatTime(0).time ); - if( this.seekBar ) { - this.seekBar.updateValue(0); - } - this.seekUpdate.css( "width", "0px" ); - this.seekProgress.css( "width", "0px" ); - }; - - this.timeUpdate = function( cTime, tTime ) { - this.duration = tTime; - this.totalTime.text( this.formatTime( tTime ).time ); - this.currentTime.text( this.formatTime( cTime ).time ); - if( tTime && this.seekBar && !this.seekBar.dragging ) { - this.seekBar.updateValue( cTime / tTime ); - } - }; - - // Reset the time values. - this.timeUpdate( 0, 0 ); - })( this, settings ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Called when the YouTube player is ready. - window.onDailymotionPlayerReady = function( playerId ) { - playerId = playerId.replace("_media", ""); - jQuery.media.players[playerId].node.player.media.player.onReady(); - }; - - // Tell the media player how to determine if a file path is a YouTube media type. - jQuery.media.playerTypes = jQuery.extend( jQuery.media.playerTypes, { - "dailymotion":function( file ) { - return (file.search(/^http(s)?\:\/\/(www\.)?dailymotion\.com/i) === 0); - } - }); - - jQuery.fn.mediadailymotion = function( options, onUpdate ) { - return new (function( video, options, onUpdate ) { - this.display = video; - var _this = this; - this.player = null; - this.videoFile = null; - this.meta = false; - this.loaded = false; - this.ready = false; - - this.createMedia = function( videoFile, preview ) { - this.videoFile = videoFile; - this.ready = false; - var playerId = (options.id + "_media"); - var rand = Math.floor(Math.random() * 1000000); - var flashPlayer = 'http://www.dailymotion.com/swf/' + videoFile.path + '?rand=' + rand + '&enablejsapi=1&playerapiid=' + playerId; - jQuery.media.utils.insertFlash( - this.display, - flashPlayer, - playerId, - "100%", - "100%", - {}, - options.wmode, - function( obj ) { - _this.player = obj; - _this.loadPlayer(); - } - ); - }; - - this.loadMedia = function( videoFile ) { - if( this.player ) { - this.loaded = false; - this.meta = false; - this.videoFile = videoFile; - - // Let them know the player is ready. - onUpdate( { - type:"playerready" - } ); - - // Load our video. - this.player.loadVideoById( this.videoFile.path, 0 ); - } - }; - - // Called when the player has finished loading. - this.onReady = function() { - this.ready = true; - this.loadPlayer(); - }; - - this.loadPlayer = function() { - if( this.ready && this.player ) { - // Create our callback functions. - window[options.id + 'StateChange'] = function( newState ) { - _this.onStateChange( newState ); - }; - - window[options.id + 'PlayerError'] = function( errorCode ) { - _this.onError( errorCode ); - }; - - // Add our event listeners. - this.player.addEventListener('onStateChange', options.id + 'StateChange'); - this.player.addEventListener('onError', options.id + 'PlayerError'); - - // Let them know the player is ready. - onUpdate( { - type:"playerready" - } ); - - // Load our video. - this.player.loadVideoById( this.videoFile.path, 0 ); - } - }; - - // Called when the player state changes. - this.onStateChange = function( newState ) { - var playerState = this.getPlayerState( newState ); - - // Alright... Dailymotion's status updates are just crazy... - // write some hacks to just make it work. - - if( !(!this.meta && playerState.state =="stopped") ) { - onUpdate( { - type:playerState.state, - busy:playerState.busy - } ); - } - - if( !this.loaded && playerState.state == "buffering" ) { - this.loaded = true; - onUpdate( { - type:"paused", - busy:"hide" - } ); - if( options.autostart ) { - this.playMedia(); - } - } - - if( !this.meta && playerState.state == "playing" ) { - // Set this player to meta. - this.meta = true; - - // Update our meta data. - onUpdate( { - type:"meta" - } ); - } - }; - - // Called when the player has an error. - this.onError = function( errorCode ) { - var errorText = "An unknown error has occured: " + errorCode; - if( errorCode == 100 ) { - errorText = "The requested video was not found. "; - errorText += "This occurs when a video has been removed (for any reason), "; - errorText += "or it has been marked as private."; - } else if( (errorCode == 101) || (errorCode == 150) ) { - errorText = "The video requested does not allow playback in an embedded player."; - } - onUpdate( { - type:"error", - data:errorText - } ); - }; - - // Translates the player state for the API player. - this.getPlayerState = function( playerState ) { - switch (playerState) { - case 5: - return {state:'ready', busy:false}; - case 3: - return {state:'buffering', busy:"show"}; - case 2: - return {state:'paused', busy:"hide"}; - case 1: - return {state:'playing', busy:"hide"}; - case 0: - return {state:'complete', busy:false}; - case -1: - return {state:'stopped', busy:false}; - default: - return {state:'unknown', busy:false}; - } - return 'unknown'; - }; - - /* - this.setSize = function( newWidth, newHeight ) { - this.player.setSize(newWidth, newHeight); - }; - */ - this.playMedia = function() { - onUpdate({ - type:"buffering", - busy:"show" - }); - this.player.playVideo(); - }; - - this.pauseMedia = function() { - this.player.pauseVideo(); - }; - - this.stopMedia = function() { - this.player.stopVideo(); - }; - - this.destroy = function() { - this.stopMedia(); - jQuery.media.utils.removeFlash( this.display, (options.id + "_media") ); - this.display.children().remove(); - }; - - this.seekMedia = function( pos ) { - onUpdate({ - type:"buffering", - busy:"show" - }); - this.player.seekTo( pos, true ); - }; - - this.setVolume = function( vol ) { - this.player.setVolume( vol * 100 ); - }; - - this.getVolume = function() { - return (this.player.getVolume() / 100); - }; - - this.getDuration = function() { - return this.player.getDuration(); - }; - - this.getCurrentTime = function() { - return this.player.getCurrentTime(); - }; - - this.getBytesLoaded = function() { - return this.player.getVideoBytesLoaded(); - }; - - this.getBytesTotal = function() { - return this.player.getVideoBytesTotal(); - }; - - this.getEmbedCode = function() { - return this.player.getVideoEmbedCode(); - }; - - this.getMediaLink = function() { - return this.player.getVideoUrl(); - }; - - this.hasControls = function() { - return true; - }; - this.showControls = function(show) {}; - this.setQuality = function( quality ) {}; - this.getQuality = function() { - return ""; - }; - })( this, options, onUpdate ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - volume:80, - autostart:false, - streamer:"", - embedWidth:450, - embedHeight:337, - wmode:"transparent", - forceOverflow:false, - quality:"default", - repeat:false - }); - - jQuery.fn.mediadisplay = function( options ) { - if( this.length === 0 ) { - return null; - } - return new (function( mediaWrapper, options ) { - this.settings = jQuery.media.utils.getSettings( options ); - this.display = mediaWrapper; - var _this = this; - this.volume = -1; - this.player = null; - this.preview = ''; - this.updateInterval = null; - this.progressInterval = null; - this.playQueue = []; - this.playIndex = 0; - this.playerReady = false; - this.loaded = false; - this.mediaFile = null; - this.hasPlaylist = false; - - // If they provide the forceOverflow variable, then that means they - // wish to force the media player to override all parents overflow settings. - if( this.settings.forceOverflow ) { - // Make sure that all parents have overflow visible so that - // browser full screen will always work. - this.display.parents().css("overflow", "visible"); - } - - this.reset = function() { - this.loaded = false; - this.stopMedia(); - clearInterval( this.progressInterval ); - clearInterval( this.updateInterval ); - this.playQueue.length = 0; - this.playQueue = []; - this.playIndex = 0; - this.playerReady = false; - this.mediaFile = null; - this.display.empty().trigger( "mediaupdate", {type:"reset"} ); - }; - - // Returns the media that has the lowest weight value, which means - // this player prefers that media over the others. - this.getPlayableMedia = function( files ) { - var mFile = null; - var i = files.length; - while(i--) { - var tempFile = new jQuery.media.file( files[i], this.settings ); - if( !mFile || (tempFile.weight < mFile.weight) ) { - mFile = tempFile; - } - } - return mFile; - }; - - // Returns a valid media file for this browser. - this.getMediaFile = function( file ) { - if( file ) { - var type = typeof file; - if( ((type === 'object') || (type === 'array')) && file[0] ) { - file = this.getPlayableMedia( file ); - } - } - return file; - }; - - // Adds a media file to the play queue. - this.addToQueue = function( file ) { - if( file ) { - this.playQueue.push( this.getMediaFile( file ) ); - } - }; - - this.loadFiles = function( files ) { - if( files ) { - this.playQueue.length = 0; - this.playQueue = []; - this.playIndex = 0; - this.addToQueue( files.intro ); - this.addToQueue( files.commercial ); - this.addToQueue( files.prereel ); - this.addToQueue( files.media ); - this.addToQueue( files.postreel ); - } - var hasMedia = (this.playQueue.length > 0); - if( !hasMedia ) { - if (this.player) { - // Destroy the current player. - this.player.destroy(); - this.player = null; - } - - this.display.trigger( "mediaupdate", {type:"nomedia"} ); - } - return hasMedia; - }; - - this.playNext = function() { - if( this.playQueue.length > this.playIndex ) { - this.loadMedia( this.playQueue[this.playIndex] ); - this.playIndex++; - } - else if( this.settings.repeat ) { - this.playIndex = 0; - this.playNext(); - } - else if( this.hasPlaylist ) { - this.reset(); - } - else { - // If there is no playlist, and no repeat, we will - // just seek to the beginning and pause. - this.loaded = false; - this.settings.autostart = false; - this.playIndex = 0; - this.playNext(); - } - }; - - this.loadMedia = function( file, mediaplayer ) { - if( file ) { - // Get the media file object. - file = new jQuery.media.file( this.getMediaFile( file ), this.settings ); - - // Set the media player if they force it. - file.player = mediaplayer ? mediaplayer : file.player; - - // Stop the current player. - this.stopMedia(); - - if( !this.mediaFile || (this.mediaFile.player != file.player) ) { - // Reset our player variables. - this.player = null; - this.playerReady = false; - - // Create a new media player. - if( file.player ) { - // Set the new media player. - this.player = this.display["media" + file.player]( this.settings, function( data ) { - _this.onMediaUpdate( data ); - }); - } - - if( this.player ) { - // Create our media player. - this.player.createMedia( file, this.preview ); - } - } - else if( this.player ) { - // Load our file into the current player. - this.player.loadMedia( file ); - } - - // Save this file. - this.mediaFile = file; - - // Send out an update about the initialize. - this.onMediaUpdate({ - type:"initialize" - }); - } - }; - - this.onMediaUpdate = function( data ) { - // Now trigger the media update message. - switch( data.type ) { - case "playerready": - this.playerReady = true; - this.player.setVolume(0); - this.player.setQuality(this.settings.quality); - this.startProgress(); - break; - case "buffering": - this.startProgress(); - break; - case "stopped": - clearInterval( this.progressInterval ); - clearInterval( this.updateInterval ); - break; - case "error": - if( data.code == 4 ) { - // It is saying not supported... Try and fall back to flash... - this.loadMedia(this.mediaFile, "flash"); - } - else { - clearInterval( this.progressInterval ); - clearInterval( this.updateInterval ); - } - break; - case "paused": - clearInterval( this.updateInterval ); - break; - case "playing": - this.startUpdate(); - break; - case "progress": - var percentLoaded = this.getPercentLoaded(); - jQuery.extend( data, { - percentLoaded:percentLoaded - }); - if( percentLoaded >= 1 ) { - clearInterval( this.progressInterval ); - } - break; - case "meta": - jQuery.extend( data, { - currentTime:this.player.getCurrentTime(), - totalTime:this.getDuration(), - volume: this.player.getVolume(), - quality: this.getQuality() - }); - break; - case "durationupdate": - this.mediaFile.duration = data.duration; - break; - case "complete": - this.playNext(); - break; - default: - break; - } - - // If this is the playing state, we want to pause the video. - if( data.type=="playing" && !this.loaded ) { - if( this.settings.autoLoad && !this.settings.autostart ) { - setTimeout( function() { - _this.setVolume(); - _this.player.pauseMedia(); - _this.settings.autostart = true; - _this.loaded = true; - }, 100 ); - } - else { - this.loaded = true; - this.setVolume(); - this.display.trigger( "mediaupdate", data ); - } - } - else { - this.display.trigger( "mediaupdate", data ); - } - }; - - this.startProgress = function() { - if( this.playerReady ) { - clearInterval( this.progressInterval ); - this.progressInterval = setInterval( function() { - _this.onMediaUpdate( { - type:"progress" - } ); - }, 500 ); - } - }; - - this.startUpdate = function() { - if( this.playerReady ) { - clearInterval( this.updateInterval ); - this.updateInterval = setInterval( function() { - if( _this.playerReady ) { - _this.onMediaUpdate({ - type:"update", - currentTime:_this.player.getCurrentTime(), - totalTime:_this.getDuration(), - volume:_this.player.getVolume(), - quality:_this.getQuality() - }); - } - }, 1000 ); - } - }; - - this.stopMedia = function() { - this.loaded = false; - clearInterval( this.progressInterval ); - clearInterval( this.updateInterval ); - if( this.playerReady ) { - this.player.stopMedia(); - } - }; - - this.mute = function( on ) { - this.player.setVolume( on ? 0 : this.volume ); - }; - - this.onResize = function() { - if( this.player && this.player.onResize ) { - this.player.onResize(); - } - }; - - this.getPercentLoaded = function() { - if( this.player.getPercentLoaded ) { - return this.player.getPercentLoaded(); - } - else { - var bytesLoaded = this.player.getBytesLoaded(); - var bytesTotal = this.mediaFile.bytesTotal ? this.mediaFile.bytesTotal : this.player.getBytesTotal(); - return bytesTotal ? (bytesLoaded / bytesTotal) : 0; - } - }; - - this.showControls = function(show) { - if( this.playerReady ) { - this.player.showControls(show); - } - }; - - this.hasControls = function() { - if( this.player ) { - return this.player.hasControls(); - } - return false; - }; - - this.getDuration = function() { - if( this.mediaFile ) { - if(!this.mediaFile.duration ) { - this.mediaFile.duration = this.player.getDuration(); - } - return this.mediaFile.duration; - } - else { - return 0; - } - }; - - this.setVolume = function( vol ) { - this.volume = vol ? vol : ((this.volume == -1) ? (this.settings.volume / 100) : this.volume); - if( this.player ) { - this.player.setVolume(this.volume); - } - }; - - this.getVolume = function() { - if( !this.volume ) { - this.volume = this.player.getVolume(); - } - return this.volume; - }; - - this.getQuality = function() { - if( !this.mediaFile.quality ) { - this.mediaFile.quality = this.player.getQuality(); - } - return this.mediaFile.quality; - }; - })( this, options ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - apiKey:"", - api:2, - sessid:"", - drupalVersion:6 - }); - - // Extend the media namespace - jQuery.media = jQuery.extend( {}, { - // Add the drupal server object. - drupal : function( protocol, settings ) { - // Return a new server object. - return new (function( protocol, settings ) { - settings = jQuery.media.utils.getSettings(settings); - var _this = this; - - var hasKey = (settings.apiKey.length > 0); - var usesKey = (settings.api == 1); - var nodeGet = (settings.drupalVersion >= 6) ? "node.get" : "node.load"; - var autoProtocol = (settings.protocol == "auto"); - - // Set up the commands. - jQuery.media = jQuery.extend( {}, { - commands : { - connect:{command:{rpc:"system.connect", json:""}, useKey:usesKey, protocol:"rpc"}, - mail:{command:{rpc:"system.mail", json:""}, useKey:hasKey, protocol:"rpc"}, - loadNode:{command:{rpc:nodeGet, json:"mediafront_getnode"}, useKey:usesKey, protocol:"json"}, - getPlaylist:{command:{rpc:"mediafront.getPlaylist", json:"mediafront_getplaylist"}, useKey:usesKey, protocol:"json"}, - getVote:{command:{rpc:"vote.getVote", json:""}, useKey:usesKey, protocol:"rpc"}, - setVote:{command:{rpc:"vote.setVote", json:""}, useKey:hasKey, protocol:"rpc"}, - getUserVote:{command:{rpc:"vote.getUserVote", json:""}, useKey:usesKey, protocol:"rpc"}, - deleteVote:{command:{rpc:"vote.deleteVote", json:""}, useKey:hasKey, protocol:"rpc"}, - addTag:{command:{rpc:"tag.addTag", json:""}, useKey:hasKey, protocol:"rpc"}, - incrementCounter:{command:{rpc:"mediafront.incrementNodeCounter", json:""}, useKey:hasKey, protocol:"rpc"}, - setFavorite:{command:{rpc:"favorites.setFavorite", json:""}, useKey:hasKey, protocol:"rpc"}, - deleteFavorite:{command:{rpc:"favorites.deleteFavorite", json:""}, useKey:hasKey, protocol:"rpc"}, - isFavorite:{command:{rpc:"favorites.isFavorite", json:""}, useKey:usesKey, protocol:"rpc"}, - login:{command:{rpc:"user.login", json:""}, useKey:hasKey, protocol:"rpc"}, - logout:{command:{rpc:"user.logout", json:""}, useKey:hasKey, protocol:"rpc"}, - adClick:{command:{rpc:"mediafront.adClick", json:""}, useKey:hasKey, protocol:"rpc"}, - getAd:{command:{rpc:"mediafront.getAd", json:""}, useKey:usesKey, protocol:"rpc"}, - setUserStatus:{command:{rpc:"mediafront.setUserStatus", json:""}, useKey:hasKey, protocol:"rpc"} - } - }, jQuery.media); - - // Public variables. - this.user = {}; - this.sessionId = ""; - this.onConnected = null; - this.encoder = new jQuery.media.sha256(); - - // Cache this... it is a little processor intensive. - // The baseURL has an ending "/". We need to truncate this, and then remove the "http://" - this.baseURL = settings.baseURL.substring(0,(settings.baseURL.length - 1)).replace(/^(http[s]?\:[\\\/][\\\/])/,''); - - this.connect = function( onSuccess ) { - this.onConnected = onSuccess; - // If they provide the session Id, then we can skip this call. - if( settings.sessid ) { - this.onConnect({ - sessid:settings.sessid - }); - } - else { - this.call( jQuery.media.commands.connect, function( result ) { - _this.onConnect( result ); - }, null ); - } - }; - - this.call = function( command, onSuccess, onFailed ) { - var args = []; - for (var i=3; i 1 ) { - var timestamp = this.getTimeStamp(); - var nonce = this.getNonce(); - var hash = this.computeHMAC( timestamp, this.baseURL, nonce, command.command.rpc, settings.apiKey); - args.unshift( nonce ); - args.unshift( timestamp ); - args.unshift( this.baseURL ); - args.unshift( hash ); - } - else { - args.unshift( settings.apiKey ); - } - } - return args; - }; - - this.getTimeStamp = function() { - return (parseInt(new Date().getTime() / 1000, 10)).toString(); - }; - - this.getNonce = function() { - var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"; - var randomString = ''; - for (var i=0; i<10; i++) { - var rnum = Math.floor(Math.random() * chars.length); - randomString += chars.substring(rnum,rnum+1); - } - return randomString; - }; - - this.computeHMAC = function( timestamp, baseURL, nonce, command, apiKey ) { - var input = timestamp + ";" + baseURL + ";" + nonce + ";" + command; - return this.encoder.encrypt( apiKey, input ); - }; - - this.onConnect = function( result ) { - if( result ) { - this.sessionId = result.sessid; - this.user = result.user; - } - if( this.onConnected ) { - this.onConnected( result ); - } - }; - })( protocol, settings ); - } - }, jQuery.media ); -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Checks the file type for browser compatibilty. - jQuery.media.checkPlayType = function( elem, playType ) { - if( (typeof elem.canPlayType) == 'function' ) { - return ("no" !== elem.canPlayType(playType)) && ("" !== elem.canPlayType(playType)); - } - else { - return false; - } - }; - - // Get's all of the types that this browser can play. - jQuery.media.getPlayTypes = function() { - var types = {}; - - // Check for video types... - var elem = document.createElement("video"); - types.ogg = jQuery.media.checkPlayType( elem, 'video/ogg; codecs="theora, vorbis"'); - types.h264 = jQuery.media.checkPlayType( elem, 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'); - types.webm = jQuery.media.checkPlayType( elem, 'video/webm; codecs="vp8, vorbis"'); - - // Now check for audio types... - elem = document.createElement("audio"); - types.audioOgg = jQuery.media.checkPlayType( elem, "audio/ogg"); - types.mp3 = jQuery.media.checkPlayType( elem, "audio/mpeg"); - - return types; - }; - - // The play types for the media player. - jQuery.media.playTypes = null; - - // The constructor for our media file object. - jQuery.media.file = function( file, settings ) { - // Only set the play types if it has not already been set. - if( !jQuery.media.playTypes ) { - jQuery.media.playTypes = jQuery.media.getPlayTypes(); - } - - // Normalize the file object passed to this constructor. - file = (typeof file === "string") ? { - path:file - } : file; - - // The duration of the media file. - this.duration = file.duration ? file.duration : 0; - this.bytesTotal = file.bytesTotal ? file.bytesTotal : 0; - this.quality = file.quality ? file.quality : 0; - this.stream = settings.streamer ? settings.streamer : file.stream; - this.path = file.path ? jQuery.trim(file.path) : ( settings.baseURL + jQuery.trim(file.filepath) ); - this.extension = file.extension ? file.extension : this.getFileExtension(); - this.weight = file.weight ? file.weight : this.getWeight(); - this.player = file.player ? file.player : this.getPlayer(); - this.mimetype = file.mimetype ? file.mimetype : this.getMimeType(); - this.type = file.type ? file.type : this.getType(); - }; - - // Get the file extension. - jQuery.media.file.prototype.getFileExtension = function() { - return this.path.substring(this.path.lastIndexOf(".") + 1).toLowerCase(); - }; - - // Get the player for this media. - jQuery.media.file.prototype.getPlayer = function() { - switch( this.extension ) - { - case "ogg":case "ogv": - return jQuery.media.playTypes.ogg ? "html5" : "flash"; - - case "mp4":case "m4v": - return jQuery.media.playTypes.h264 ? "html5" : "flash"; - - case "webm": - return jQuery.media.playTypes.webm ? "html5" : "flash"; - - case "oga": - return jQuery.media.playTypes.audioOgg ? "html5" : "flash"; - - case "mp3": - return jQuery.media.playTypes.mp3 ? "html5" : "flash"; - - case "swf":case "flv":case "f4v":case "f4a": - case "mov":case "3g2":case "3gp":case "3gpp": - case "m4a":case "aac":case "wav":case "aif": - case "wma": - return "flash"; - - default: - // Now iterate through all of our registered players. - for( var player in jQuery.media.playerTypes ) { - if( jQuery.media.playerTypes.hasOwnProperty( player ) ) { - if( jQuery.media.playerTypes[player]( this.path ) ) { - return player; - } - } - } - break; - } - return "flash"; - }; - - // Get the type of media this is... - jQuery.media.file.prototype.getType = function() { - switch( this.extension ) { - case"swf":case "webm":case "ogg":case "ogv": - case "mp4":case "m4v":case "flv":case "f4v": - case "mov":case "3g2":case "3gp":case "3gpp": - return "video"; - case "oga":case "mp3":case "f4a":case "m4a": - case "aac":case "wav":case "aif":case "wma": - return "audio"; - default: - break; - } - return ''; - }; - - // Get the preference "weight" of this media type. - // The lower the number, the higher the preference. - jQuery.media.file.prototype.getWeight = function() { - switch( this.extension ) { - case 'mp4':case 'm4v':case 'm4a': - return jQuery.media.playTypes.h264 ? 3 : 7; - case'webm': - return jQuery.media.playTypes.webm ? 4 : 8; - case 'ogg':case 'ogv': - return jQuery.media.playTypes.ogg ? 5 : 20; - case 'oga': - return jQuery.media.playTypes.audioOgg ? 5 : 20; - case 'mp3': - return 6; - case 'mov':case'swf':case 'flv':case 'f4v': - case 'f4a':case '3g2':case '3gp':case '3gpp': - return 9; - case 'wav':case 'aif':case 'aac': - return 10; - case 'wma': - return 11; - default: - break; - } - return 0; - }; - - // Return the best guess mime type for the given file. - jQuery.media.file.prototype.getMimeType = function() { - switch( this.extension ) { - case 'mp4':case 'm4v':case 'flv':case 'f4v': - return 'video/mp4'; - case'webm': - return 'video/x-webm'; - case 'ogg':case 'ogv': - return 'video/ogg'; - case '3g2': - return 'video/3gpp2'; - case '3gpp': - case '3gp': - return 'video/3gpp'; - case 'mov': - return 'video/quicktime'; - case'swf': - return 'application/x-shockwave-flash'; - case 'oga': - return 'audio/ogg'; - case 'mp3': - return 'audio/mpeg'; - case 'm4a':case 'f4a': - return 'audio/mp4'; - case 'aac': - return 'audio/aac'; - case 'wav': - return 'audio/vnd.wave'; - case 'wma': - return 'audio/x-ms-wma'; - default: - break; - } - return ''; - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - window.onFlashPlayerReady = function( id ) { - jQuery.media.players[id].node.player.media.player.onReady(); - }; - - window.onFlashPlayerUpdate = function( id, eventType ) { - jQuery.media.players[id].node.player.media.player.onMediaUpdate( eventType ); - }; - - window.onFlashPlayerDebug = function( debug ) { - if( window.console && console.log ) { - console.log( debug ); - } - }; - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - flashPlayer:"./flash/mediafront.swf", - skin:"default", - config:"nocontrols" - }); - - jQuery.fn.mediaflash = function( settings, onUpdate ) { - return new (function( video, settings, onUpdate ) { - settings = jQuery.media.utils.getSettings( settings ); - this.display = video; - var _this = this; - this.player = null; - this.mediaFile = null; - this.preview = ''; - this.ready = false; - - // Translate the messages. - this.translate = { - "mediaConnected":"connected", - "mediaBuffering":"buffering", - "mediaPaused":"paused", - "mediaPlaying":"playing", - "mediaStopped":"stopped", - "mediaComplete":"complete", - "mediaMeta":"meta" - }; - - // When to show the busy cursor. - this.busy = { - "mediaConnected":false, - "mediaBuffering":"show", - "mediaPaused":"hide", - "mediaPlaying":"hide", - "mediaStopped":false, - "mediaComplete":false, - "mediaMeta":false - }; - - this.createMedia = function( mediaFile, preview ) { - this.mediaFile = mediaFile; - this.preview = preview; - this.ready = false; - var playerId = (settings.id + "_media"); - var rand = Math.floor(Math.random() * 1000000); - var flashPlayer = settings.flashPlayer + "?rand=" + rand; - var flashvars = { - config:settings.config, - id:settings.id, - file:mediaFile.path, - image:this.preview, - skin:settings.skin, - autostart:(settings.autostart || !settings.autoLoad) - }; - if( mediaFile.stream ) { - flashvars.stream = mediaFile.stream; - } - if( settings.debug ) { - flashvars.debug = "1"; - } - jQuery.media.utils.insertFlash( - this.display, - flashPlayer, - playerId, - "100%", - "100%", - flashvars, - settings.wmode, - function( obj ) { - _this.player = obj; - _this.loadPlayer(); - } - ); - }; - - this.loadMedia = function( mediaFile ) { - if( this.player && this.ready ) { - this.mediaFile = mediaFile; - - // Load the new media file into the Flash player. - this.player.loadMedia( mediaFile.path, mediaFile.stream ); - - // Let them know the player is ready. - onUpdate( { - type:"playerready" - } ); - } - }; - - this.onReady = function() { - this.ready = true; - this.loadPlayer(); - }; - - this.loadPlayer = function() { - if( this.ready && this.player ) { - onUpdate( { - type:"playerready" - } ); - } - }; - - this.onMediaUpdate = function( eventType ) { - onUpdate( { - type:this.translate[eventType], - busy:this.busy[eventType] - }); - }; - - this.playMedia = function() { - if( this.player && this.ready ) { - this.player.playMedia(); - } - }; - - this.pauseMedia = function() { - if( this.player && this.ready ) { - this.player.pauseMedia(); - } - }; - - this.stopMedia = function() { - if( this.player && this.ready ) { - this.player.stopMedia(); - } - }; - - this.destroy = function() { - this.stopMedia(); - jQuery.media.utils.removeFlash( this.display, (settings.id + "_media") ); - this.display.children().remove(); - }; - - this.seekMedia = function( pos ) { - if( this.player && this.ready ) { - this.player.seekMedia( pos ); - } - }; - - this.setVolume = function( vol ) { - if( this.player && this.ready ) { - this.player.setVolume( vol ); - } - }; - - this.getVolume = function() { - return (this.player && this.ready) ? this.player.getVolume() : 0; - }; - - this.getDuration = function() { - return (this.player && this.ready) ? this.player.getDuration() : 0; - }; - - this.getCurrentTime = function() { - return (this.player && this.ready) ? this.player.getCurrentTime() : 0; - }; - - this.getBytesLoaded = function() { - return (this.player && this.ready) ? this.player.getMediaBytesLoaded() : 0; - }; - - this.getBytesTotal = function() { - return (this.player && this.ready) ? this.player.getMediaBytesTotal() : 0; - }; - - this.hasControls = function() { - return true; - }; - - this.showControls = function(show) { - if( this.player && this.ready ) { - this.player.showPlugin("controlBar", show); - this.player.showPlugin("playLoader", show); - } - }; - - this.getEmbedCode = function() { - var flashVars = { - config:"config", - id:"mediafront_player", - file:this.mediaFile.path, - image:this.preview, - skin:settings.skin - }; - if( this.mediaFile.stream ) { - flashVars.stream = this.mediaFile.stream; - } - return jQuery.media.utils.getFlash( - settings.flashPlayer, - "mediafront_player", - settings.embedWidth, - settings.embedHeight, - flashVars, - settings.wmode ); - }; - - // Not implemented yet... - this.setQuality = function( quality ) {}; - this.getQuality = function() { - return ""; - }; - //this.setSize = function( newWidth, newHeight ) {}; - this.getMediaLink = function() { - return "This video currently does not have a link."; - }; - })( this, settings, onUpdate ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - jQuery.fn.mediahtml5 = function( options, onUpdate ) { - return new (function( media, options, onUpdate ) { - this.display = media; - var _this = this; - this.player = null; - this.bytesLoaded = 0; - this.bytesTotal = 0; - this.mediaType = ""; - this.loaded = false; - this.mediaFile = null; - this.playerElement = null; - - this.getPlayer = function( mediaFile, preview ) { - this.mediaFile = mediaFile; - var playerId = options.id + '_' + this.mediaType; - var html = '<' + this.mediaType + ' style="position:absolute" id="' + playerId + '"'; - html += preview ? ' poster="' + preview + '"' : ''; - - if( typeof mediaFile === 'array' ) { - html += '>'; - var i = mediaFile.length; - while(i) { - i--; - html += ''; - } - } - else { - html += ' src="' + mediaFile.path + '">Unable to display media.'; - } - - html += ''; - this.display.append( html ); - this.bytesTotal = mediaFile.bytesTotal; - this.playerElement = this.display.find('#' + playerId); - this.onResize(); - - // return the player object. - return this.playerElement.eq(0)[0]; - }; - - // Create a new HTML5 player. - this.createMedia = function( mediaFile, preview ) { - // Remove any previous Flash players. - jQuery.media.utils.removeFlash( this.display, options.id + "_media" ); - this.display.children().remove(); - this.mediaType = this.getMediaType( mediaFile ); - this.player = this.getPlayer( mediaFile, preview ); - this.loaded = false; - var timeupdated = false; - if( this.player ) { - this.player.addEventListener( "abort", function() { - onUpdate( { - type:"stopped" - } ); - }, true); - this.player.addEventListener( "loadstart", function() { - onUpdate( { - type:"ready", - busy:"show" - }); - - _this.onReady(); - }, true); - this.player.addEventListener( "loadeddata", function() { - onUpdate( { - type:"loaded", - busy:"hide" - }); - }, true); - this.player.addEventListener( "loadedmetadata", function() { - onUpdate( { - type:"meta" - } ); - }, true); - this.player.addEventListener( "canplaythrough", function() { - onUpdate( { - type:"canplay", - busy:"hide" - }); - }, true); - this.player.addEventListener( "ended", function() { - onUpdate( { - type:"complete" - } ); - }, true); - this.player.addEventListener( "pause", function() { - onUpdate( { - type:"paused" - } ); - }, true); - this.player.addEventListener( "play", function() { - onUpdate( { - type:"playing" - } ); - }, true); - this.player.addEventListener( "playing", function() { - onUpdate( { - type:"playing", - busy:"hide" - }); - }, true); - this.player.addEventListener( "error", function(e) { - _this.onError(e.target.error); - onUpdate( { - type:"error", - code:e.target.error.code - } ); - }, true); - this.player.addEventListener( "waiting", function() { - onUpdate( { - type:"waiting", - busy:"show" - }); - }, true); - this.player.addEventListener( "timeupdate", function() { - if( timeupdated ) { - onUpdate( { - type:"timeupdate", - busy:"hide" - }); - } - else { - timeupdated = true; - } - }, true); - this.player.addEventListener( "durationchange", function() { - if( this.duration && (this.duration !== Infinity) ) { - onUpdate( { - type:"durationupdate", - duration:this.duration - }); - } - }, true); - - // Now add the event for getting the progress indication. - this.player.addEventListener( "progress", function( event ) { - _this.bytesLoaded = event.loaded; - _this.bytesTotal = event.total; - }, true); - - this.player.autoplay = true; - - if (typeof this.player.hasAttribute == "function" && this.player.hasAttribute("preload") && this.player.preload != "none") { - this.player.autobuffer = true; - } else { - this.player.autobuffer = false; - this.player.preload = "none"; - } - - onUpdate({ - type:"playerready" - }); - } - }; - - // A function to be called when an error occurs. - this.onError = function( error ) { - switch(error.code) { - case 1: - console.log("Error: MEDIA_ERR_ABORTED"); - break; - case 2: - console.log("Error: MEDIA_ERR_DECODE"); - break; - case 3: - console.log("Error: MEDIA_ERR_NETWORK"); - break; - case 4: - console.log("Error: MEDIA_ERR_SRC_NOT_SUPPORTED"); - break; - default: - break; - } - }; - - // Called when the media has started loading. - this.onReady = function() { - if( !this.loaded ) { - this.loaded = true; - this.playMedia(); - } - }; - - // Load new media into the HTML5 player. - this.loadMedia = function( mediaFile ) { - this.mediaFile = mediaFile; - this.createMedia( mediaFile ); - }; - - this.getMediaType = function( mediaFile ) { - var extension = (typeof mediaFile === 'array') ? mediaFile[0].extension : mediaFile.extension; - switch( extension ) { - case "ogg": case "ogv": case "mp4": case "m4v": - return "video"; - - case "oga": case "mp3": - return "audio"; - - default: - break; - } - return "video"; - }; - - this.playMedia = function() { - if( this.player && this.player.play ) { - this.player.play(); - } - }; - - this.pauseMedia = function() { - if( this.player && this.player.pause ) { - this.player.pause(); - } - }; - - this.stopMedia = function() { - this.pauseMedia(); - if( this.player ) { - this.player.src = ""; - } - }; - - this.destroy = function() { - this.stopMedia(); - this.display.children().remove(); - }; - - this.seekMedia = function( pos ) { - if( this.player ) { - this.player.currentTime = pos; - } - }; - - this.setVolume = function( vol ) { - if( this.player ) { - this.player.volume = vol; - } - }; - - this.getVolume = function() { - return this.player ? this.player.volume : 0; - }; - - this.getDuration = function() { - var dur = this.player ? this.player.duration : 0; - return (dur === Infinity) ? 0 : dur; - }; - - this.getCurrentTime = function() { - return this.player ? this.player.currentTime : 0; - }; - - this.getPercentLoaded = function() { - if( this.player && this.player.buffered && this.player.duration ) { - return (this.player.buffered.end(0) / this.player.duration); - } - else if( this.bytesTotal ) { - return (this.bytesLoaded / this.bytesTotal); - } - else { - return 0; - } - }; - - // Called when the player resizes. - this.onResize = function() { - // If this is a video, set the width and height of the video element. - if( this.mediaType == "video" ) { - this.playerElement.css({width:this.display.width(), height:this.display.height()}); - } - }; - - // Not implemented yet... - this.setQuality = function( quality ) {}; - this.getQuality = function() { - return ""; - }; - this.hasControls = function() { - return false; - }; - this.showControls = function(show) {}; - //this.setSize = function( newWidth, newHeight ) {}; - this.getEmbedCode = function() { - - // Only return the Flash embed if this is a Flash playable media field. - if( (this.mediaFile.extension == 'mp4') || - (this.mediaFile.extension == 'm4v') || - (this.mediaFile.extension == 'webm') ) { - var flashVars = { - config:"config", - id:"mediafront_player", - file:this.mediaFile.path, - image:this.preview, - skin:options.skin - }; - if( this.mediaFile.stream ) { - flashVars.stream = this.mediaFile.stream; - } - return jQuery.media.utils.getFlash( - options.flashPlayer, - "mediafront_player", - options.embedWidth, - options.embedHeight, - flashVars, - options.wmode ); - } - else { - return "This media does not support embedding."; - } - }; - this.getMediaLink = function() { - return "This media currently does not have a link."; - }; - })( this, options, onUpdate ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - /** - * Load and scale an image while maintining original aspect ratio. - */ - jQuery.fn.mediaimage = function( link, fitToImage ) { - if( this.length === 0 ) { - return null; - } - return new (function( container, link, fitToImage ) { - this.display = container; - var _this = this; - - var ratio = 0; - var imageLoaded = false; - - // Now create the image loader, and add the loaded handler. - this.imgLoader = new Image(); - this.imgLoader.onload = function() { - imageLoaded = true; - ratio = (_this.imgLoader.width / _this.imgLoader.height); - _this.resize(); - _this.display.trigger( "imageLoaded" ); - }; - - // Set the container to not show any overflow... - container.css("overflow", "hidden"); - - // Check to see if this image is completely loaded. - this.loaded = function() { - return this.imgLoader.complete; - }; - - // Resize the image. - this.resize = function( newWidth, newHeight ) { - var rectWidth = fitToImage ? this.imgLoader.width : (newWidth ? newWidth : this.display.width()); - var rectHeight = fitToImage ? this.imgLoader.height : (newHeight ? newHeight : this.display.height()); - if( rectWidth && rectHeight && imageLoaded ) { - // Now resize the image in the container... - var rect = jQuery.media.utils.getScaledRect( ratio, { - width:rectWidth, - height:rectHeight - }); - - // Now set this image to the new size. - if( this.image ) { - this.image.attr( "src", this.imgLoader.src ).css({ - marginLeft:rect.x, - marginTop:rect.y, - width:rect.width, - height:rect.height - }); - } - - // Show the container. - this.image.fadeIn(); - } - }; - - // Clears the image. - this.clear = function() { - imageLoaded = false; - if( this.image ) { - this.image.attr("src", ""); - this.imgLoader.src = ''; - this.image.fadeOut( function() { - if( link ) { - $(this).parent().remove(); - } - else { - $(this).remove(); - } - }); - } - }; - - // Refreshes the image. - this.refresh = function() { - this.resize(); - }; - - // Load the image. - this.loadImage = function( src ) { - // Now add the image object. - this.clear(); - this.image = $(document.createElement('img')).attr({ - src:"" - }).hide(); - if( link ) { - this.display.append($(document.createElement('a')).attr({ - target:"_blank", - href:link - }).append(this.image)); - } - else { - this.display.append(this.image); - } - this.imgLoader.src = src; - }; - })( this, link, fitToImage ); - }; - -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Extend the media namespace - jQuery.media = jQuery.extend( {}, { - // Add the json server object. - json : function( settings ) { - // Return a new function for this object - return new (function( settings ) { - var _this = this; - - // ************************************************ - // This code is from http://kelpi.com/script/a85cbb - // ************************************************ - - // A character conversion map - var m = { - '\b':'\\b', - '\t':'\\t', - '\n':'\\n', - '\f':'\\f', - '\r':'\\r', - '"':'\\"', - '\\':'\\\\' - }; - - // Map type names to functions for serializing those types - var s = { - 'boolean': function (x) { - return String(x); - }, - 'null': function (x) { - return "null"; - }, - number: function (x) { - return isFinite(x) ? String(x) : 'null'; - }, - string: function (x) { - if (/["\\\x00-\x1f]/.test(x)) { - x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) { - var c = m[b]; - if (c) { - return c; - } - c = b.charCodeAt(); - return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16); - }); - } - return '"' + x + '"'; - }, - array: function (x) { - var a = ['['], b, f, i, l = x.length, v; - for (i = 0; i < l; i += 1) { - v = x[i]; - f = s[typeof v]; - if (f) { - v = f(v); - if (typeof v == 'string') { - if (b) { - a[a.length] = ','; - } - a[a.length] = v; - b = true; - } - } - } - a[a.length] = ']'; - return a.join(''); - }, - object: function (x) { - if (x) { - if (x instanceof Array) { - return s.array(x); - } - var a = ['{'], b, f, i, v; - for( i in x ) { - if( x.hasOwnProperty(i) ) { - v = x[i]; - f = s[typeof v]; - if(f) { - v = f(v); - if (typeof v == 'string') { - if (b) { - a[a.length] = ','; - } - a.push(s.string(i), ':', v); - b = true; - } - } - } - } - a[a.length] = '}'; - return a.join(''); - } - return 'null'; - } - }; - - // Public function to serialize any object to JSON format. - this.serializeToJSON = function( o ) { - return s.object(o); - }; - - //************************************************ - // End of code from http://kelpi.com/script/a85cbb - //************************************************ - - this.call = function( method, onSuccess, onFailed, params, protocol ) { - if( settings.baseURL ) { - // Add json functionality here. - jQuery.ajax({ - "url": settings.baseURL + method, - "dataType": "json", - "type": "POST", - "data": { - methodName:method, - params:this.serializeToJSON(params) - }, - "error": function( XMLHttpRequest, textStatus, errorThrown ) { - if( onFailed ) { - onFailed( textStatus ); - } - else if( window.console && console.log ) { - console.log( "Error: " + textStatus ); - } - }, - "success": function( data ) { - if( onSuccess ) { - onSuccess( data ); - } - } - }); - } - else if( onSuccess ) { - onSuccess( null ); - } - }; - })( settings ); - } - }, jQuery.media ); - -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - jQuery.fn.medialink = function( settings, onClick, data ) { - data = data ? data : { - noargs:true - }; - return new (function( link, settings, onClick, data ) { - var _this = this; - this.display = link; - - this.display.css("cursor", "pointer").unbind("click").bind( "click", data, function( event ) { - onClick( event, $(this) ); - }).unbind("mouseenter").bind("mouseenter", function() { - if( settings.template.onLinkOver ) { - settings.template.onLinkOver( $(this) ); - } - }).unbind("mouseleave").bind("mouseleave", function() { - if( settings.template.onLinkOut ) { - settings.template.onLinkOut( $(this) ); - } - }); - })( this, settings, onClick, data ); - }; - -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - links:[], - linksvertical:false - }); - - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - linkScroll:"#medialinkscroll" - }); - - jQuery.fn.medialinks = function( settings ) { - return new (function( links, settings ) { - - // Get our settings. - settings = jQuery.media.utils.getSettings(settings); - - // Save the jQuery display. - this.display = links; - var _this = this; - - // Keep track of the previous link. - this.previousLink = null; - - // Setup the scroll region - this.scrollRegion = links.find( settings.ids.linkScroll ).mediascroll({ - vertical:settings.linksvertical - }); - this.scrollRegion.clear(); - - // Load the links. - this.loadLinks = function() { - if( links.length > 0 ) { - this.scrollRegion.clear(); - var onLinkClick = function( event, data ) { - _this.setLink( data ); - }; - - var i = settings.links.length; - while(i) { - i--; - // Add this link to the scroll region. - var link = this.scrollRegion.newItem().playlistlink( settings, settings.links[i] ); - link.unbind("linkclick").bind("linkclick", onLinkClick); - } - // Activate the scroll region. - this.scrollRegion.activate(); - } - }; - - // Set the active link. - this.setLink = function( link ) { - - // If there is a previous link, then unactivate it. - if( this.previousLink ) { - this.previousLink.setActive(false); - } - - // Add the active class to the clicked target. - link.setActive(true); - - // Store this target for later. - this.previousLink = link; - }; - })( this, settings ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Set up our defaults for this component. - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - close:"#mediamenuclose", - embed:"#mediaembed", - elink:"#mediaelink", - email:"#mediaemail" - }); - - jQuery.fn.mediamenu = function( server, settings ) { - if( this.length === 0 ) { - return null; - } - return new (function( server, menu, settings ) { - settings = jQuery.media.utils.getSettings(settings); - var _this = this; - this.display = menu; - - this.on = false; - - this.contents = []; - this.prevItem = { - id:0, - link:null, - contents:null - }; - - this.close = this.display.find( settings.ids.close ); - this.close.unbind("click").bind( "click", function() { - _this.display.trigger( "menuclose" ); - }); - - this.setMenuItem = function( link, itemId ) { - if( this.prevItem.id != itemId ) { - if( this.prevItem.id && settings.template.onMenuSelect ) { - settings.template.onMenuSelect( this.prevItem.link, this.prevItem.contents, false ); - } - - var contents = this.contents[itemId]; - - if( settings.template.onMenuSelect ) { - settings.template.onMenuSelect( link, contents, true ); - } - - this.prevItem = { - id:itemId, - link:link, - contents:contents - }; - } - }; - - this.setEmbedCode = function( embed ) { - this.setInputItem( settings.ids.embed, embed ); - }; - - - this.setMediaLink = function( mediaLink ) { - this.setInputItem( settings.ids.elink , mediaLink ); - }; - - this.setInputItem = function( id, value ) { - var input = this.contents[id].find("input"); - input.unbind("click").bind("click", function() { - $(this).select().focus(); - }); - input.attr("value", value ); - }; - - var linkIndex = 0; - this.links = this.display.find("a"); - this.links.each( function() { - var link = $(this); - if( link.length > 0 ) { - var linkId = link.attr("href"); - var contents = _this.display.find(linkId); - contents.hide(); - _this.contents[linkId] = contents; - link.unbind("click").bind("click", { - id:linkId, - obj:link.parent() - }, function( event ) { - event.preventDefault(); - _this.setMenuItem( event.data.obj, event.data.id ); - }); - - if( linkIndex === 0 ) { - _this.setMenuItem( link.parent(), linkId ); - } - linkIndex++; - } - }); - - - })( server, this, settings ); - }; - -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - logo:"logo.png", - logoWidth:49, - logoHeight:15, - logopos:"sw", - logox:5, - logoy:5, - link:"http://www.mediafront.org", - file:"", - image:"", - timeout:8, - autoLoad:true - }); - - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - busy:"#mediabusy", - preview:"#mediapreview", - play:"#mediaplay", - media:"#mediadisplay" - }); - - jQuery.fn.minplayer = function( settings ) { - if( this.length === 0 ) { - return null; - } - return new (function( player, settings ) { - // Get the settings. - settings = jQuery.media.utils.getSettings(settings); - - // Save the jQuery display. - this.display = player; - var _this = this; - - // If the player should auto load or not. - this.autoLoad = settings.autoLoad; - - // Store the busy cursor and data. - this.busy = player.find( settings.ids.busy ); - this.busyImg = this.busy.find("img"); - this.busyWidth = this.busyImg.width(); - this.busyHeight = this.busyImg.height(); - - // Store the play overlay. - this.play = player.find( settings.ids.play ); - // Toggle the play/pause state if they click on the play button. - this.play.unbind("click").bind("click", function() { - _this.togglePlayPause(); - }); - this.playImg = this.play.find("img"); - this.playWidth = this.playImg.width(); - this.playHeight = this.playImg.height(); - - // Store the preview image. - this.preview = player.find( settings.ids.preview ).mediaimage(); - if( this.preview ) { - this.preview.display.unbind("click").bind("click", function() { - _this.onMediaClick(); - }); - - this.preview.display.unbind("imageLoaded").bind("imageLoaded", function() { - _this.onPreviewLoaded(); - }); - } - - // The internal player controls. - this.usePlayerControls = false; - this.busyFlags = 0; - this.busyVisible = false; - this.playVisible = false; - this.previewVisible = false; - this.playing = false; - this.hasMedia = false; - this.timeoutId = 0; - - // Cache the width and height. - this.width = this.display.width(); - this.height = this.display.height(); - - // Hide or show an element. - this.showElement = function( element, show, tween ) { - if( element && !this.usePlayerControls ) { - if( show ) { - element.show(tween); - } - else { - element.hide(tween); - } - } - }; - - this.showPlay = function( show, tween ) { - show &= this.hasMedia; - this.playVisible = show; - this.showElement( this.play, show, tween ); - }; - - this.showBusy = function( id, show, tween ) { - if( show ) { - this.busyFlags |= (1 << id); - } - else { - this.busyFlags &= ~(1 << id); - } - - // Set the busy cursor visiblility. - this.busyVisible = (this.busyFlags > 0); - this.showElement( this.busy, this.busyVisible, tween ); - - // If the media has finished loading, then we don't need the - // loader for the image. - if (id==1 && !show) { - this.showBusy(3, false); - } - }; - - this.showPreview = function( show, tween ) { - this.previewVisible = show; - if( this.preview ) { - this.showElement( this.preview.display, show, tween ); - } - }; - - // Handle the control events. - this.onControlUpdate = function( data ) { - if( this.media ) { - // If the player is ready. - if( this.media.playerReady ) { - switch( data.type ) { - case "play": - this.media.player.playMedia(); - break; - case "pause": - this.media.player.pauseMedia(); - break; - case "seek": - this.media.player.seekMedia( data.value ); - break; - case "volume": - this.media.setVolume( data.value ); - break; - case "mute": - this.media.mute( data.value ); - break; - default: - break; - } - } - // If there are files in the queue but no current media file. - else if( (this.media.playQueue.length > 0) && !this.media.mediaFile ) { - // They interacted with the player. Always autoload at this point on. - this.autoLoad = true; - - // Then play the next file in the queue. - this.playNext(); - } - - // Let the template do something... - if( settings.template && settings.template.onControlUpdate ) { - settings.template.onControlUpdate( data ); - } - } - }; - - // Handle the full screen event requests. - this.fullScreen = function( full ) { - if( settings.template.onFullScreen ) { - settings.template.onFullScreen( full ); - } - - // Refresh the preview image. - this.preview.refresh(); - }; - - // Handle when the preview image loads. - this.onPreviewLoaded = function() { - this.previewVisible = true; - }; - - // Handle the media events. - this.onMediaUpdate = function( data ) { - switch( data.type ) { - case "paused": - this.playing = false; - this.showPlay(true); - //this.showBusy(1, false); - if( !this.media.loaded ) { - this.showPreview(true); - } - break; - case "update": - case "playing": - this.playing = true; - this.showPlay(false); - this.showPreview((this.media.mediaFile.type == "audio")); - break; - case "initialize": - this.playing = false; - this.showPlay(true); - this.showBusy(1, this.autoLoad); - this.showPreview(true); - break; - case "buffering": - this.showPlay(true); - this.showPreview((this.media.mediaFile.type == "audio")); - break; - default: - break; - } - - // If they provide a busy cursor. - if( data.busy ) { - this.showBusy(1, (data.busy == "show")); - } - }; - - // Called when the media is clicked. - this.onMediaClick = function() { - if( this.media.player && !this.media.hasControls() ) { - if( this.playing ) { - this.media.player.pauseMedia(); - } - else { - this.media.player.playMedia(); - } - } - }; - - // Set the media player. - this.media = this.display.find( settings.ids.media ).mediadisplay( settings ); - if( this.media ) { - // If they click on the media region, then pause the media. - this.media.display.unbind("click").bind("click", function() { - _this.onMediaClick(); - }); - } - - // Sets the logo position. - this.setLogoPos = function() { - if( this.logo ) { - var logocss = {}; - if( settings.logopos=='se' || settings.logopos=='sw' ) { - logocss['bottom'] = settings.logoy; - } - if( settings.logopos=='ne' || settings.logopos=='nw' ) { - logocss['top'] = settings.logoy; - } - if( settings.logopos=='nw' || settings.logopos=='sw' ) { - logocss['left'] = settings.logox; - } - if( settings.logopos=='ne' || settings.logopos=='se' ) { - logocss['right'] = settings.logox; - } - this.logo.display.css(logocss); - } - }; - - // Add the logo. - if( !settings.controllerOnly ) { - this.display.prepend(''); - this.logo = this.display.find("." + settings.prefix + "medialogo").mediaimage( settings.link ); - if( this.logo ) { - this.logo.display.css({ - width:settings.logoWidth, - height:settings.logoHeight - }); - this.logo.display.bind("imageLoaded", function() { - _this.setLogoPos(); - }); - this.logo.loadImage( settings.logo ); - } - } - - // Reset to previous state... - this.reset = function() { - this.hasMedia = false; - this.playing = false; - jQuery.media.players[settings.id].showNativeControls(false); - this.showPlay(true); - this.showPreview(true); - clearTimeout( this.timeoutId ); - if( this.media ) { - this.media.reset(); - } - }; - - // Toggle the play/pause state. - this.togglePlayPause = function() { - if( this.media ) { - if( this.media.playerReady ) { - if( this.playing ) { - this.showPlay(true); - this.media.player.pauseMedia(); - } - else { - this.showPlay(false); - this.media.player.playMedia(); - } - } - else if( (this.media.playQueue.length > 0) && !this.media.mediaFile ) { - // They interacted with the player. Always autoload at this point on. - this.autoLoad = true; - - // Then play the next file in the queue. - this.playNext(); - } - } - }; - - // Loads an image... - this.loadImage = function( image ) { - if( this.preview ) { - // Show a busy cursor for the image loading... - this.showBusy(3, true); - - // Load the image. - this.preview.loadImage( image ); - - // Set and interval to check if the image is loaded. - var imageInterval = setInterval(function() { - - // If the image is loaded, then clear the interval. - if (_this.preview.loaded()) { - - // Clear the interval and stop the busy cursor. - clearInterval(imageInterval); - _this.showBusy(3, false); - } - }, 500); - - // Now set the preview image in the media player. - if( this.media ) { - this.media.preview = image; - } - } - }; - - this.onResize = function() { - if( this.preview ) { - this.preview.refresh(); - } - - if( this.media ) { - this.media.onResize(); - } - }; - - // Clears the loaded image. - this.clearImage = function() { - if( this.preview ) { - this.preview.clear(); - } - }; - - // Expose the public load functions from the media display. - this.loadFiles = function( files ) { - this.reset(); - this.hasMedia = this.media && this.media.loadFiles(files); - if( this.hasMedia && this.autoLoad ) { - this.media.playNext(); - } - else if( !this.hasMedia ) { - // Hide the overlays for non-media types. - this.showPlay(false); - this.showPreview(true); - this.timeoutId = setTimeout( function() { - _this.media.display.trigger( "mediaupdate", {type:"complete"} ); - }, (settings.timeout * 1000) ); - } - return this.hasMedia; - }; - - // Play the next file. - this.playNext = function() { - if( this.media ) { - this.media.playNext(); - } - }; - - // Check the player for controls. - this.hasControls = function() { - if( this.media ) { - return this.media.hasControls(); - } - return true; - }; - - // Show the native controls. - this.showControls = function( show ) { - if( this.media ) { - this.media.showControls( show ); - } - }; - - // Loads a single media file. - this.loadMedia = function( file ) { - this.reset(); - if( this.media ) { - this.media.loadMedia( file ); - } - }; - - // If they provide a file, then load it. - if( settings.file ) { - this.loadMedia( settings.file ); - } - - // If they provide the image, then load it. - if( settings.image ) { - this.loadImage( settings.image ); - } - })( this, settings ); - }; -/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net) - * Licensed under the MIT License (LICENSE.txt). - * - * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. - * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. - * Thanks to: Seamus Leahy for adding deltaX and deltaY - * - * Version: 3.0.4 - * - * Requires: 1.2.2+ - */ - - - - var types = ['DOMMouseScroll', 'mousewheel']; - - $.event.special.mousewheel = { - setup: function() { - if ( this.addEventListener ) { - for ( var i=types.length; i; ) { - i--; - this.addEventListener( types[i], handler, false ); - } - } else { - this.onmousewheel = handler; - } - }, - - teardown: function() { - if ( this.removeEventListener ) { - for ( var i=types.length; i; ) { - i--; - this.removeEventListener( types[i], handler, false ); - } - } else { - this.onmousewheel = null; - } - } - }; - - $.fn.extend({ - mousewheel: function(fn) { - return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); - }, - - unmousewheel: function(fn) { - return this.unbind("mousewheel", fn); - } - }); - - - function handler(event) { - var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0; - event = $.event.fix(orgEvent); - event.type = "mousewheel"; - - // Old school scrollwheel delta - if ( event.wheelDelta ) { - delta = event.wheelDelta/120; - } - if ( event.detail ) { - delta = -event.detail/3; - } - - // New school multidimensional scroll (touchpads) deltas - deltaY = delta; - - // Gecko - if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { - deltaY = 0; - deltaX = -1*delta; - } - - // Webkit - if ( orgEvent.wheelDeltaY !== undefined ) { - deltaY = orgEvent.wheelDeltaY/120; - } - if ( orgEvent.wheelDeltaX !== undefined ) { - deltaX = -1*orgEvent.wheelDeltaX/120; - } - - // Add event and delta to the front of the arguments - args.unshift(event, delta, deltaX, deltaY); - - return $.event.handle.apply(this, args); - } - -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - node:"", - incrementTime:5 - }); - - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - voter:"#mediavoter", - uservoter:"#mediauservoter", - mediaRegion:"#mediaregion", - field:".mediafield" - }); - - jQuery.fn.medianode = function( server, settings ) { - if( this.length === 0 ) { - return null; - } - return new (function( server, node, settings ) { - settings = jQuery.media.utils.getSettings(settings); - - // Save the jQuery display. - this.display = node; - this.nodeInfo = {}; - this.incremented = false; - var _this = this; - - // Add the min player as the player for this node. - this.player = this.display.find(settings.ids.mediaRegion).minplayer( settings ); - if( this.player && (settings.incrementTime !== 0)) { - this.player.display.unbind("mediaupdate").bind( "mediaupdate", function( event, data ) { - _this.onMediaUpdate( data ); - }); - } - - // Store all loaded images. - this.images = []; - - this.addVoters = function( element ) { - this.voter = element.find(settings.ids.voter).mediavoter( settings, server, false ); - this.uservoter = element.find(settings.ids.uservoter).mediavoter( settings, server, true ); - if( this.uservoter && this.voter ) { - this.uservoter.display.unbind("processing").bind( "processing", function() { - _this.player.showBusy(2, true); - }); - this.uservoter.display.unbind("voteGet").bind( "voteGet", function() { - _this.player.showBusy(2, false); - }); - this.uservoter.display.unbind("voteSet").bind( "voteSet", function( event, vote ) { - _this.player.showBusy(2, false); - _this.voter.updateVote( vote ); - }); - } - }; - - // Add the voters to this node. - this.addVoters( this.display ); - - // Handle the media events. - this.onMediaUpdate = function( data ) { - if( !this.incremented ) { - switch( data.type ) { - case "update": - // Increment node counter if the increment time is positive and is less than the current time. - if( (settings.incrementTime > 0) && (data.currentTime > settings.incrementTime) ) { - this.incremented = true; - server.call( jQuery.media.commands.incrementCounter, null, null, _this.nodeInfo.nid ); - } - break; - case "complete": - // If the increment time is negative, then that means to increment on media completion. - if( settings.incrementTime < 0 ) { - this.incremented = true; - server.call( jQuery.media.commands.incrementCounter, null, null, _this.nodeInfo.nid ); - } - break; - default: - break; - } - } - }; - - this.loadNode = function( _nodeInfo ) { - return this.getNode( this.translateNode( _nodeInfo ) ); - }; - - this.translateNode = function( _nodeInfo ) { - var isValue = ((typeof _nodeInfo) == "number") || ((typeof _nodeInfo) == "string"); - if( !_nodeInfo ) { - var defaultNode = settings.node; - if( (typeof defaultNode) == 'object' ) { - defaultNode.load = false; - return defaultNode; - } - else { - return defaultNode ? { - nid:defaultNode, - load:true - } : null; - } - } - else if( isValue ) { - return { - nid:_nodeInfo, - load:true - }; - } - else { - _nodeInfo.load = false; - return _nodeInfo; - } - }; - - this.getNode = function( _nodeInfo ) { - if( _nodeInfo ) { - if( server && _nodeInfo.load ) { - server.call( jQuery.media.commands.loadNode, function( result ) { - _this.setNode( result ); - }, null, _nodeInfo.nid, {} ); - } - else { - this.setNode( _nodeInfo ); - } - - // Return that the node was loaded. - return true; - } - - // Return that there was no node loaded. - return false; - }; - - this.setNode = function( _nodeInfo ) { - if( _nodeInfo ) { - // Set the node information object. - this.nodeInfo = _nodeInfo; - this.incremented = false; - - // Load the media... - if( this.player && this.nodeInfo.mediafiles ) { - // Load the preview image. - var image = this.getImage("preview"); - if( image ) { - this.player.loadImage( image.path ); - } - else { - this.player.clearImage(); - } - - // Load the media... - this.player.loadFiles( this.nodeInfo.mediafiles.media ); - } - - // Get the vote for these voters. - if( this.voter ) { - this.voter.getVote( _nodeInfo ); - } - if( this.uservoter ) { - this.uservoter.getVote( _nodeInfo ); - } - - // Load all of our fields. - this.display.find(settings.ids.field).each( function() { - _this.setField( this, _nodeInfo, $(this).attr("type"), $(this).attr("field") ); - }); - - // Trigger our node loaded event. - this.display.trigger( "nodeload", this.nodeInfo ); - } - }; - - this.setField = function( fieldObj, _nodeInfo, type, fieldName ) { - // We only want to load the fields that have a type. - if( type ) { - switch( type ) { - case "text": - this.setTextField( fieldObj, _nodeInfo, fieldName ); - break; - - case "image": - this.setImageField( fieldObj, fieldName ); - break; - - case 'cck_text': - this.setCCKTextField( fieldObj, _nodeInfo, fieldName ); - break; - default: - break; - } - } - }; - - this.setTextField = function( fieldObj, _nodeInfo, fieldName ) { - var field = _nodeInfo[fieldName]; - if( field ) { - $(fieldObj).empty().html( field ); - } - return true; - }; - - this.setCCKTextField = function( fieldObj, _nodeInfo, fieldName ) { - if( args.fieldType == 'cck_text' ) { - var field = _nodeInfo[fieldName]; - if( field ) { - $(fieldObj).empty().html( field["0"].value ); - } - } - return true; - }; - - this.onResize = function() { - if( this.player ) { - this.player.onResize(); - } - }; - - this.getImage = function( imageName ) { - var images = this.nodeInfo.mediafiles ? this.nodeInfo.mediafiles.image : null; - var image = null; - if( images ) { - - // Get the image. - if( images[imageName] ) { - image = images[imageName]; - } - else { - // Or just use the first image... - for( var key in images ) { - if( images.hasOwnProperty( key ) ) { - image = images[key]; - break; - } - } - } - - // If they just provided a string, then still show the image. - image = (typeof image === "string") ? { - path:image - } : image; - image.path = image.path ? jQuery.trim(image.path) : ( settings.baseURL + jQuery.trim(image.filepath) ); - if( image && image.path ) { - image.path = image.path ? jQuery.trim(image.path) : ( settings.baseURL + jQuery.trim(image.filepath) ); - } - else { - image = null; - } - } - return image; - }; - - this.setImageField = function( fieldObj, fieldName ) { - var file = this.getImage( fieldName ); - if( file ) { - var image = $(fieldObj).empty().mediaimage(); - this.images.push( image ); - image.loadImage( file.path ); - } - }; - })( server, this, settings ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - shuffle:false, - loop:false, - pageLimit:10 - }); - - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - prev:"#mediaprev", - next:"#medianext", - loadPrev:"#medialoadprev", - loadNext:"#medialoadnext", - prevPage:"#mediaprevpage", - nextPage:"#medianextpage" - }); - - jQuery.fn.mediapager = function( settings ){ - return new (function( pager, settings ) { - settings = jQuery.media.utils.getSettings(settings); - - // Save the jQuery display. - this.display = pager; - var _this = this; - - // The active index within a page. - this.activeIndex = -1; - - // The non-active index within a page. - this.currentIndex = -1; - - // The active page index. - this.activePage = 0; - - // The non-active page index. - this.currentPage = 0; - - // The number of pages. - this.numPages = 0; - - // The number of items on the current page. - this.numItems = 10; - - // The number of items on the active page. - this.activeNumItems = 10; - - // The load state for loading an index after a new page. - this.loadState = ""; - - // Used to turn on and off the pager. - this.enabled = false; - - // Add our buttons... - this.prevButton = pager.find( settings.ids.prev ).medialink( settings, function() { - if( _this.enabled ) { - _this.loadPrev( false ); - } - }); - - this.nextButton = pager.find( settings.ids.next ).medialink( settings, function() { - if( _this.enabled ) { - _this.loadNext( false ); - } - }); - - this.loadPrevButton = pager.find( settings.ids.loadPrev ).medialink( settings, function() { - if( _this.enabled ) { - _this.loadPrev( true ); - } - }); - - this.loadNextButton = pager.find( settings.ids.loadNext ).medialink( settings, function() { - if( _this.enabled ) { - _this.loadNext( true ); - } - }); - - this.prevPageButton = pager.find( settings.ids.prevPage ).medialink( settings, function() { - if( _this.enabled ) { - _this.loadState = "click"; - _this.prevPage(); - } - }); - - this.nextPageButton = pager.find( settings.ids.nextPage ).medialink( settings, function() { - if( _this.enabled ) { - _this.loadState = "click"; - _this.nextPage(); - } - }); - - this.setTotalItems = function( totalItems ) { - if ( totalItems && settings.pageLimit ) { - this.numPages = Math.ceil(totalItems / settings.pageLimit); - if( this.numPages == 1 ) { - this.numItems = totalItems; - } - } - }; - - this.setNumItems = function( _numItems ) { - this.numItems = _numItems; - }; - - this.reset = function() { - this.activePage = 0; - this.currentPage = 0; - this.activeIndex = -1; - this.currentIndex = -1; - this.loadState = ""; - }; - - this.loadIndex = function( setActive ) { - var indexVar = setActive ? "activeIndex" : "currentIndex"; - var newIndex = this[indexVar]; - switch ( this.loadState ) { - case "prev": - this.loadState = ""; - this.loadPrev(setActive); - return; - - case "first": - newIndex = 0; - break; - case "last" : - newIndex = (this.numItems - 1); - break; - - case "rand" : - newIndex = Math.floor(Math.random() * this.numItems); - break; - - default: - break; - } - - this.loadState = ""; - - if( newIndex != this[indexVar] ) { - this.loadState = ""; - this[indexVar] = newIndex; - this.display.trigger("loadindex", { - index:this[indexVar], - active:setActive - }); - } - }; - - this.loadNext = function( setActive ) { - if ( this.loadState ) { - this.loadIndex( setActive ); - } - else if ( settings.shuffle ) { - this.loadRand(); - } - else { - // Increment the playlist index. - var indexVar = setActive ? "activeIndex" : "currentIndex"; - if( setActive && ( this.activePage != this.currentPage ) ) { - - // Check to make sure we cover the crazy corner-case where the activeIndex - // is on the last item of the previous page. Here we don't need to load - // a new page, but simply load the first item on the current page. - if( (this.activeIndex == (this.activeNumItems - 1)) && (this.activePage == (this.currentPage - 1)) ) { - this.currentIndex = this.activeIndex = 0; - this.activePage = this.currentPage; - this.display.trigger("loadindex", { - index:0, - active:true - }); - } - else { - this.currentPage = this.activePage; - this.loadState = ""; - this.display.trigger("loadpage", { - index:this.activePage, - active:setActive - }); - } - } - else { - this[indexVar]++; - if ( this[indexVar] >= this.numItems ) { - if( this.numPages > 1 ) { - this[indexVar] = (this.numItems - 1); - this.loadState = this.loadState ? this.loadState : "first"; - this.nextPage( setActive ); - } - else if( !setActive || settings.loop ) { - this[indexVar] = 0; - this.display.trigger("loadindex", { - index:this[indexVar], - active:setActive - }); - } - } - else { - this.display.trigger("loadindex", { - index:this[indexVar], - active:setActive - }); - } - } - } - }; - - this.loadPrev = function( setActive ) { - var indexVar = setActive ? "activeIndex" : "currentIndex"; - - if( setActive && ( this.activePage != this.currentPage ) ) { - this.currentPage = this.activePage; - this.loadState = "prev"; - this.display.trigger("loadpage", { - index:this.activePage, - active:setActive - }); - } - else { - this[indexVar]--; - if ( this[indexVar] < 0 ) { - if( this.numPages > 1 ) { - this[indexVar] = 0; - this.loadState = this.loadState ? this.loadState : "last"; - this.prevPage( setActive ); - } - else if( !setActive || settings.loop ) { - this[indexVar] = (this.numItems - 1); - this.display.trigger("loadindex", { - index:this[indexVar], - active:setActive - }); - } - } - else { - this.display.trigger( "loadindex", { - index:this[indexVar], - active:setActive - } ); - } - } - }; - - this.loadRand = function() { - var newPage = Math.floor(Math.random() * this.numPages); - - if (newPage != this.activePage) { - this.activePage = newPage; - this.loadState = this.loadState ? this.loadState : "rand"; - this.display.trigger("loadpage", { - index:this.activePage, - active:true - }); - } - else { - this.activeIndex = Math.floor(Math.random() * this.numItems); - this.display.trigger("loadindex", { - index:this.activeIndex, - active:true - }); - } - }; - - this.nextPage = function( setActive ) { - var pageVar = setActive ? "activePage" : "currentPage"; - var pageLoaded = false; - - if ( this[pageVar] < (this.numPages - 1) ) { - this[pageVar]++; - pageLoaded = true; - } - else if ( settings.loop ) { - this.loadState = this.loadState ? this.loadState : "first"; - this[pageVar] = 0; - pageLoaded = true; - } - else { - this.loadState = ""; - } - - // Set the page state. - this.setPageState( setActive ); - - if( pageLoaded ) { - this.display.trigger("loadpage", { - index:this[pageVar], - active:setActive - }); - } - }; - - this.prevPage = function( setActive ) { - var pageVar = setActive ? "activePage" : "currentPage"; - var pageLoaded = false; - - if (this[pageVar] > 0) { - this[pageVar]--; - pageLoaded = true; - } - else if ( settings.loop ) { - this.loadState = this.loadState ? this.loadState : "last"; - this[pageVar] = (this.numPages - 1); - pageLoaded = true; - } - else { - this.loadState = ""; - } - - // Set the page state. - this.setPageState( setActive ); - - if( pageLoaded ) { - this.display.trigger("loadpage", { - index:this[pageVar], - active:setActive - }); - } - }; - - this.setPageState = function( setActive ) { - if( setActive ) { - // If this page is active, then we want to make sure - // we set the current page to the active page. - this.currentPage = this.activePage; - } - else { - // Store the active num items. - this.activeNumItems = this.numItems; - } - }; - })( this, settings ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - jQuery.media = jQuery.extend( {}, { - parser : function( settings ) { - // Return a new parser object. - return new (function( settings ) { - var _this = this; - this.onLoaded = null; - - // Parse the contents from a file. - this.parseFile = function( file, onLoaded ) { - this.onLoaded = onLoaded; - jQuery.ajax({ - type: "GET", - url:file, - dataType:"xml", - success: function(xml) { - _this.parseXML( xml ); - }, - error: function( XMLHttpRequest, textStatus, errorThrown ) { - if( window.console && console.log ) { - console.log( "Error: " + textStatus ); - } - } - }); - }; - - // Parse an xml string. - this.parseXML = function( xml ) { - // Try to parse a playlist in any format... - var playlist = this.parseXSPF( xml ); - if( playlist.total_rows === 0 ) { - playlist = this.parseASX( xml ); - } - if( playlist.total_rows === 0 ) { - playlist = this.parseRSS( xml ); - } - if( this.onLoaded && playlist.total_rows ) { - this.onLoaded( playlist ); - } - return playlist; - }; - - // Parse XSPF contents. - this.parseXSPF = function( xml ) { - var playlist = { - total_rows:0, - nodes:[] - }; - var trackList = jQuery("playlist trackList track", xml); - if( trackList.length > 0 ) { - trackList.each( function(index) { - playlist.total_rows++; - playlist.nodes.push({ - nid:playlist.total_rows, - title: $(this).find("title").text(), - description: $(this).find("annotation").text(), - mediafiles: { - image:{ - "image":{ - path:$(this).find("image").text() - } - }, - media:{ - "media":{ - path:$(this).find("location").text() - } - } - } - }); - }); - } - return playlist; - }; - - // Parse ASX contents. - this.parseASX = function( xml ) { - var playlist = { - total_rows:0, - nodes:[] - }; - var trackList = jQuery("asx entry", xml); - if( trackList.length > 0 ) { - trackList.each( function(index) { - playlist.total_rows++; - playlist.nodes.push({ - nid:playlist.total_rows, - title: $(this).find("title").text(), - mediafiles: { - image:{ - "image":{ - path:$(this).find("image").text() - } - }, - media:{ - "media":{ - path:$(this).find("location").text() - } - } - } - }); - }); - } - return playlist; - }; - - // Parse RSS contents. - this.parseRSS = function( xml ) { - var playlist = { - total_rows:0, - nodes:[] - }; - var channel = jQuery("rss channel", xml); - if( channel.length > 0 ) { - var youTube = (channel.find("generator").text() == "YouTube data API"); - - // Iterate through all the items. - channel.find("item").each( function(index) { - playlist.total_rows++; - var item = {}; - item = youTube ? _this.parseYouTubeItem( $(this) ) : _this.parseRSSItem( $(this) ); - item.nid = playlist.total_rows; - playlist.nodes.push(item); - }); - } - return playlist; - }; - - // Parse a default RSS Item. - this.parseRSSItem = function( item ) { - return { - title: item.find("title").text(), - mediafiles: { - image:{ - "image":{ - path:item.find("image").text() - } - }, - media:{ - "media":{ - path:item.find("location").text() - } - } - } - }; - }; - - // Parse a YouTube item. - this.parseYouTubeItem = function( item ) { - var description = item.find("description").text(); - var media = item.find("link").text().replace("&feature=youtube_gdata", ""); - return { - title: item.find("title").text(), - mediafiles: { - image:{ - "image":{ - path:jQuery("img", description).eq(0).attr("src") - } - }, - media:{ - "media":{ - path:media, - player:"youtube" - } - } - } - }; - }; - })( settings ); - } - }, jQuery.media ); -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - protocol:"auto", - server:"drupal", - template:"default", - baseURL:"", - debug:false, - draggable:false, - resizable:false, - showPlaylist:true, - autoNext:true, - prefix:"", - zIndex:400, - fluidWidth:false, - fluidHeight:false, - fullscreen:false - }); - - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - loading:"#mediaplayerloading", - player:"#mediaplayer", - menu:"#mediamenu", - titleBar:"#mediatitlebar", - node:"#medianode", - playlist:"#mediaplaylist", - control:"#mediacontrol" - }); - - // Initialize our players, playlists, and controllers. - jQuery.media.players = {}; - jQuery.media.loadCallbacks = {}; - jQuery.media.playlists = {}; - jQuery.media.controllers = {}; - - // Use this function to trigger when the player has finished registering and loaded. - jQuery.media.onLoaded = function( playerId, callback ) { - var player = jQuery.media.players[playerId]; - if( player && player.display && player.loaded ) { - callback( player ); - } - else { - if( !jQuery.media.loadCallbacks[playerId] ) { - jQuery.media.loadCallbacks[playerId] = []; - } - jQuery.media.loadCallbacks[playerId].push( callback ); - } - }; - - // Adds a new element to the media player. - jQuery.media.addElement = function( playerId, fromPlayer, name ) { - if( fromPlayer && fromPlayer[name] ) { - var toPlayer = jQuery.media.players[playerId]; - if( toPlayer ) { - switch( name ) { - case "playlist": - toPlayer.addPlaylist( fromPlayer.playlist ); - break; - case "controller": - toPlayer.addController( fromPlayer.controller ); - break; - default: - break; - } - } - else { - // Otherwise, cache it for inclusion when the player is created. - var pName = name + "s"; - if( !jQuery.media[pName][playerId] ) { - jQuery.media[pName][playerId] = []; - } - jQuery.media[pName][playerId].push( fromPlayer[name] ); - } - } - }; - - // To add a new controller to any existing or future-included players. - jQuery.media.addController = function( playerId, fromPlayer ) { - jQuery.media.addElement( playerId, fromPlayer, "controller" ); - }; - - // To add a new playlist to any existing or future-included players. - jQuery.media.addPlaylist = function( playerId, fromPlayer ) { - jQuery.media.addElement( playerId, fromPlayer, "playlist" ); - }; - - // The main entry point into the player. - jQuery.fn.mediaplayer = function( settings ) { - if( this.length === 0 ) { - return null; - } - // Return the media Media Player - return new (function( player, settings ) { - // Get the settings. - settings = jQuery.media.utils.getSettings( settings ); - - // Get the id if it has not been set. - if( !settings.id ) { - settings.id = jQuery.media.utils.getId( player ); - } - - // Save the dialog. - this.dialog = player; - - // Save the jQuery display. - this.display = this.dialog.find( settings.ids.player ); - var _this = this; - - // Fix a really strange issue where if any of the parent elements are invisible - // when this player's template is initializing, it would crash due to the issue - // with calling the position() function on an invisible object. This seems to fix - // that issue. - var invisibleParents = []; - - // Now check the visibility of the parents, and add the offenders to the array. - jQuery.media.utils.checkVisibility( this.display, invisibleParents ); - - // Add this player to the players object. - jQuery.media.players[settings.id] = this; - - // Variable to keep track if this player has finished loading. - this.loaded = false; - - // Store the index variable. - var i = 0; - - // Set the template object. - settings.template = jQuery.media.templates[settings.template]( this, settings ); - - // Get all of the setting overrides used in this template. - if( settings.template.getSettings ) { - settings = jQuery.extend( settings, settings.template.getSettings() ); - } - - // Add some keyboard event handlers. - $(window).keyup( function( event ) { - switch( event.keyCode ) { - case 0: /* SpaceBar */ - _this.onSpaceBar(); - break; - case 113: /* Q key */ - case 27: /* ESC Key */ - _this.onEscKey(); - break; - default: - break; - } - }); - - // Add a resize handler to the window if either our width or height is fluid. - if( settings.fluidWidth || settings.fluidHeight ) { - $(window).resize( function() { - _this.onResize(); - }); - } - - // First get the communication protocol. - if( jQuery.media[settings.protocol] ) { - this.protocol = jQuery.media[settings.protocol]( settings ); - } - - // Load the server. - if( jQuery.media[settings.server] ) { - this.server = jQuery.media[settings.server]( this.protocol, settings ); - } - - // Get the menu. - this.menu = this.dialog.find( settings.ids.menu ).mediamenu( this.server, settings ); - if( this.menu ) { - this.menu.display.unbind("menuclose").bind( "menuclose", function() { - _this.showMenu( false ); - }); - } - - // Setup our booleans. - this.menuOn = false; - this.maxOn = !settings.showPlaylist; - this.fullScreen = false; - - // The attached playlist. - this.playlist = null; - - // The active playlist. - this.activePlaylist = null; - - // Our attached controller. - this.controller = null; - - // The active controller. - this.activeController = null; - - // Hide or Show the menu. - this.showMenu = function( show ) { - if( settings.template.onMenu ) { - this.menuOn = show; - settings.template.onMenu( this.menuOn ); - } - }; - - // Called when the user presses the ESC key. - this.onEscKey = function() { - // If they are in full screen mode, then escape when they press the ESC key. - if( this.fullScreen ) { - this.onFullScreen( false ); - } - }; - - // When they press the space bar, we will toggle the player play/pause state. - this.onSpaceBar = function() { - if( this.fullScreen && this.node && this.node.player ) { - this.node.player.togglePlayPause(); - } - }; - - // Adds the media player events to a given element. - this.addPlayerEvents = function( element ) { - // Trigger on the menu. - element.display.unbind("menu").bind("menu", function(event) { - _this.showMenu( !_this.menuOn ); - }); - - element.display.unbind("maximize").bind("maximize", function( event ) { - _this.maximize( !_this.maxOn ); - }); - - element.display.unbind("fullscreen").bind("fullscreen", function( event ) { - _this.onFullScreen( !_this.fullScreen ); - }); - }; - - // Function to put the player in fullscreen mode. - this.onFullScreen = function( full ) { - this.fullScreen = full; - if( this.node && this.node.player ) { - this.node.player.fullScreen( this.fullScreen ); - this.onResize(); - - // Check to see if this browser supports native fullscreen. - if (window.webkitSupportsFullscreen && window.webkitSupportsFullscreen()) { - if (full) { - window.webkitEnterFullscreen(); - } - else { - window.webkitExitFullscreen(); - } - } - } - }; - - // Setup the title bar. - this.titleBar = this.dialog.find( settings.ids.titleBar ).mediatitlebar( settings ); - if( this.titleBar ) { - // Add the player events to the titlebar. - this.addPlayerEvents( this.titleBar ); - - // If they have jQuery UI, make this draggable. - if( settings.draggable && this.dialog.draggable ) { - this.dialog.draggable({ - handle: settings.ids.titleBar, - containment: 'document' - }); - } - - // If they have jQuery UI, make this resizable. - if( settings.resizable && this.dialog.resizable ) { - this.dialog.resizable({ - alsoResize: this.display, - containment: 'document', - resize: function(event) { - _this.onResize(); - } - }); - } - } - - // Get the node and register for events. - this.node = this.dialog.find( settings.ids.node ).medianode( this.server, settings ); - if( this.node ) { - this.node.display.unbind("nodeload").bind( "nodeload", function( event, data ) { - _this.onNodeLoad( data ); - }); - - if( this.node.player && this.node.player.media ) { - this.node.player.media.display.unbind("mediaupdate").bind( "mediaupdate", function( event, data ) { - _this.onMediaUpdate( data ); - }); - } - - if( this.node.uservoter ) { - this.node.uservoter.display.unbind("voteSet").bind( "voteSet", function( event, vote ) { - if( _this.activePlaylist ) { - _this.activePlaylist.onVoteSet( vote ); - } - }); - } - } - - // Called when the media updates. - this.onMediaUpdate = function( data ) { - // Call the player onMediaUpdate. - this.node.player.onMediaUpdate( data ); - - // When the media completes, have the active playlist load the next item. - if( settings.autoNext && this.activePlaylist && (data.type == "complete") ) { - this.activePlaylist.loadNext(); - } - - // Update our controller. - if( this.controller ) { - this.controller.onMediaUpdate( data ); - } - - // Update our active controller. - if( this.activeController ) { - this.activeController.onMediaUpdate( data ); - } - - // Set the media information in the menu. - if( this.menu && this.node && (data.type == "meta") ) { - this.menu.setEmbedCode( this.node.player.media.player.getEmbedCode() ); - this.menu.setMediaLink( this.node.player.media.player.getMediaLink() ); - } - - // Let the template do something... - if( settings.template && settings.template.onMediaUpdate ) { - settings.template.onMediaUpdate( data ); - } - }; - - // Called when the playlist is finished loading. - this.onPlaylistLoad = function( data ) { - if( this.node ) { - // Let our media know that there is a playlist. - if( this.node.player && this.node.player.media ) { - this.node.player.media.hasPlaylist = true; - } - - this.node.loadNode( data ); - } - - // Allow the template to do something when the playlist is loaded. - if( settings.template.onPlaylistLoad ) { - settings.template.onPlaylistLoad( data ); - } - }; - - // Called when the main node is loaded. - this.onNodeLoad = function( data ) { - // Allow the template to do something when the node is loaded. - if( settings.template.onNodeLoad ) { - settings.template.onNodeLoad( data ); - } - }; - - // Maximize the player. - this.maximize = function( on ) { - // Don't want to maximize in fullscreen mode. - if( !this.fullScreen ) { - if( settings.template.onMaximize && (on != this.maxOn) ) { - this.maxOn = on; - settings.template.onMaximize( this.maxOn ); - } - } - }; - - // Allow multiple playlists to be associated with this single player using this API. - this.addPlaylist = function( newPlaylist ) { - if( newPlaylist ) { - newPlaylist.display.unbind("playlistload").bind( "playlistload", newPlaylist, function( event, data ) { - // Set this as the active playlist. - _this.activePlaylist = event.data; - _this.onPlaylistLoad( data ); - }); - - // Check to see if this playlist has already loaded... If so, then we need to - // go ahead and load the active teaser into this player. - if( !this.activePlaylist && newPlaylist.activeTeaser ) { - this.activePlaylist = newPlaylist; - this.onPlaylistLoad( newPlaylist.activeTeaser.node.nodeInfo ); - } - } - return newPlaylist; - }; - - // Search these elements for the id. - this.searchForElement = function(elementList) { - - // Iterate through the elements. - for(var id in elementList) { - - // We need to tolerate instances. - var reg = new RegExp( '^' + id + '(\\_[0-9]+)?$', 'i'); - if (settings.id.search(reg) === 0) { - return elementList[id]; - } - } - return null; - }; - - // Add the default playlist. - this.playlist = this.addPlaylist( this.dialog.find( settings.ids.playlist ).mediaplaylist( this.server, settings ) ); - - // Allow mulitple controllers to control this media. - this.addController = function( newController, active ) { - if( newController ) { - newController.display.unbind("controlupdate").bind( "controlupdate", newController, function( event, data ) { - _this.activeController = event.data; - if( _this.node && _this.node.player ) { - _this.node.player.onControlUpdate( data ); - } - }); - - if( active && !this.activeController ) { - this.activeController = newController; - } - - this.addPlayerEvents( newController ); - } - return newController; - }; - - // Add the control bar to the media. - this.controller = this.addController( this.dialog.find( settings.ids.control ).mediacontrol( settings ), false ); - if( this.controller && this.node ) { - // Add any voters to the node. - this.node.addVoters( this.controller.display ); - } - - // Called when the player resizes. - this.onResize = function() { - // Call the template resize function. - if( settings.template.onResize ) { - settings.template.onResize(); - } - - // Resize the node. - if( this.node ) { - this.node.onResize(); - } - - // Resize the attached control region. - if( this.controller ) { - this.controller.onResize(); - } - }; - - // Function to show the built in controls or not. - this.showNativeControls = function( show ) { - var player = this.node ? this.node.player : null; - if( player && player.hasControls() ) { - player.usePlayerControls = show; - if( show ) { - player.busy.hide(); - player.play.hide(); - if( player.preview ) { - player.preview.display.hide(); - } - if( this.controller ) { - this.controller.display.hide(); - } - } - else { - player.showBusy( 1, ((this.busyFlags & 0x2) == 0x2) ); - player.showPlay( this.playVisible ); - player.showPreview( this.previewVisible ); - if( this.controller ) { - this.controller.display.show(); - } - } - player.showControls( show ); - } - }; - - // Load the content into the player. - this.loadContent = function() { - - // Now add any queued controllers... - var controllers = this.searchForElement(jQuery.media.controllers); - if (controllers) { - i = controllers.length; - while(i) { - i--; - this.addController( controllers[i], true ); - } - } - - // Now add any queued playlists... - var playlists = this.searchForElement(jQuery.media.playlists); - if (playlists) { - i = playlists.length; - while(i) { - i--; - this.addPlaylist( playlists[i] ); - } - } - - var playlistLoaded = false; - - if( this.playlist ) { - playlistLoaded = this.playlist.loadPlaylist(); - } - - // Don't load the node if there is a plalist loaded. - if( !playlistLoaded && this.node ) { - // Make sure to transfer any playlist settings over to the node. - if( this.node.player && this.node.player.media ) { - this.node.player.media.settings.repeat = (settings.loop || settings.repeat); - } - - this.node.loadNode(); - } - }; - - this.initializeTemplate = function() { - // Initialize our template. - if( settings.template.initialize ) { - settings.template.initialize( settings ); - } - - // Now reset the visibility of the parents. - jQuery.media.utils.resetVisibility( invisibleParents ); - }; - - this.load = function() { - // Initialize our template. - this.initializeTemplate(); - - // The player looks good now. Move the dialog back. - this.dialog.css("position","relative"); - this.dialog.css("marginLeft",0); - this.dialog.css("overflow","visible"); - - // If they wish to default the player in fullscreen mode, do that now. - if( settings.fullscreen ) { - this.onFullScreen(true); - } - - // Set our loaded flag to true. - this.loaded = true; - this.display.trigger( "playerLoaded", this ); - - // Call all of our queued onLoaded callback functions. - if( jQuery.media.loadCallbacks[settings.id] ) { - var callbacks = jQuery.media.loadCallbacks[settings.id]; - var i = callbacks.length; - while(i) { - i--; - callbacks[i]( this ); - } - } - - // Connect to the server. - this.server.connect( function( result ) { - _this.loadContent(); - }); - }; - - this.load(); - })( this, settings ); - }; - -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - playlist:"", - args:[], - wildcard:"*" - }); - - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - pager:"#mediapager", - scroll:"#mediascroll", - busy:"#mediabusy", - links:"#medialinks" - }); - - jQuery.fn.mediaplaylist = function( server, settings ) { - if( this.length === 0 ) { - return null; - } - return new (function( server, playlist, settings ) { - settings = jQuery.media.utils.getSettings(settings); - - // Save the jQuery display. - this.display = playlist; - var _this = this; - - // Store all of the current teasers. - this.teasers = []; - - // The non-active selected teaser. - this.selectedTeaser = null; - - // The active teaser. - this.activeTeaser = null; - - // Set up our playlist args. - this.args = settings.args; - - // Used to keep track if we should set the node active after a playlist load. - this.setActive = true; - - // The active pager. - this.activePager = null; - - // The attached pager bar.. - this.pager = null; - - // Set up the playlist parser. - this.parser = jQuery.media.parser( settings ); - - // Get the Scroll Region. - this.scrollRegion = playlist.find( settings.ids.scroll ).mediascroll( settings ); - this.scrollRegion.clear(); - - // Store the busy cursor. - this.busy = playlist.find( settings.ids.busy ); - this.busyVisible = false; - this.busyImg = this.busy.find("img"); - this.busyWidth = this.busyImg.width(); - this.busyHeight = this.busyImg.height(); - - // Get the links. - this.links = playlist.find( settings.ids.links ).medialinks( settings ); - this.links.loadLinks(); - - this.loading = function( _loading ) { - if( this.pager ) { - this.pager.enabled = !_loading; - } - if( this.activePager ) { - this.activePager.enabled = !_loading; - } - if( _loading ) { - this.busyVisible = true; - this.busy.show(); - } - else { - this.busyVisible = false; - this.busy.hide(); - } - }; - - // Allow mulitple pagers to control this playlist. - this.addPager = function( newPager, active ) { - if( newPager ) { - // Handler for the loadindex event. - newPager.display.unbind("loadindex").bind( "loadindex", function( event, data ) { - if( data.active ) { - _this.activateTeaser( _this.teasers[data.index] ); - } - else { - _this.selectTeaser( _this.teasers[data.index] ); - } - }); - - // Handler for the loadpage event. - newPager.display.unbind("loadpage").bind( "loadpage", function( event, data ) { - _this.setActive = data.active; - _this.loadPlaylist( { - pageIndex:data.index - } ); - }); - - if( active && !this.activePager ) { - this.activePager = newPager; - } - } - return newPager; - }; - - // Add the pager. - this.pager = this.addPager( playlist.find( settings.ids.pager ).mediapager( settings ), false ); - - // Handler for when a link is clicked. - this.links.display.unbind("linkclick").bind( "linkclick", function( event, link ) { - _this.onLinkClick( link ); - }); - - this.onLinkClick = function( link ) { - var index = link.index; - var newPlaylist = link.playlist; - var newArgs = []; - newArgs[index] = link.arg; - - if( this.pager ) { - this.pager.reset(); - } - - if( this.activePager ) { - this.activePager.reset(); - } - - this.loadPlaylist( { - playlist:newPlaylist, - args:newArgs - } ); - }; - - // Loads the next track. - this.loadNext = function() { - if( this.pager ) { - this.pager.loadNext( true ); - } - else if( this.activePager ) { - this.activePager.loadNext( true ); - } - }; - - // Function to load the playlist. - this.loadPlaylist = function( _args ) { - var defaults = { - playlist:settings.playlist, - pageLimit:settings.pageLimit, - pageIndex:(this.pager ? this.pager.activePage : 0), - args:{} - }; - - var playlistArgs = jQuery.extend( {}, defaults, _args ); - - // Set the arguments. - this.setArgs( playlistArgs.args ); - - // Set the busy cursor. - this.loading( true ); - - // If there is a playlist. - if( playlistArgs.playlist ) { - // If the playlist is an object, then just set it directly. - if( ((typeof playlistArgs.playlist) == "object") ) { - settings.playlist = playlistArgs.playlist.name; - this.setPlaylist( playlistArgs.playlist ); - } - else { - // See if the playlist is a URL file. - if( playlistArgs.playlist.match(/^http[s]?\:\/\/|\.xml$/i) ) { - // Parse the XML file. - this.parser.parseFile( playlistArgs.playlist, function( result ) { - _this.setPlaylist( result ); - }); - } - else if( server ) { - // Load the playlist from the server. - server.call( jQuery.media.commands.getPlaylist, function( result ) { - _this.setPlaylist( result ); - }, null, playlistArgs.playlist, playlistArgs.pageLimit, playlistArgs.pageIndex, this.args ); - } - } - - // Return that the playlist was loaded. - return true; - } - - // Return that the playlist was not loaded. - return false; - }; - - // Set this playlist. - this.setPlaylist = function( _playlist ) { - if( _playlist && _playlist.nodes ) { - // Now check the visibility of the parents, and add the offenders to the array. - var invisibleParents = []; - jQuery.media.utils.checkVisibility( this.display, invisibleParents ); - - // Set the total number of items for the pager. - if( this.pager ) { - this.pager.setTotalItems( _playlist.total_rows ); - } - - // Set the total number of items for the active pager. - if( this.activePager ) { - this.activePager.setTotalItems( _playlist.total_rows ); - } - - // Empty the scroll region. - this.scrollRegion.clear(); - - // Reset the teasers. - this.resetTeasers(); - - // Iterate through all of our nodes. - var numNodes = _playlist.nodes.length; - for( var index=0; index < numNodes; index++ ) { - // Add the teaser. - this.addTeaser( _playlist.nodes[index], index ); - } - - // Activate the scroll region. - this.scrollRegion.activate(); - - // Load the next node. - if( this.pager ) { - this.pager.loadNext( this.setActive ); - } - - if( this.activePager ) { - this.activePager.loadNext( this.setActive ); - } - - // Now reset the invisibilty. - jQuery.media.utils.resetVisibility( invisibleParents ); - } - - // We are finished loading. - this.loading( false ); - }; - - // When a vote has been cast, we also need to update the playlist. - this.onVoteSet = function( vote ) { - if( vote ) { - var i = this.teasers.length; - while(i--) { - var teaser = this.teasers[i]; - if( teaser.node.nodeInfo.nid == vote.content_id ) { - teaser.node.voter.updateVote( vote ); - } - } - } - }; - - // Add a single teaser to the list. - this.addTeaser = function( nodeInfo, index ) { - // Setup the teaser. - var teaser = this.scrollRegion.newItem().mediateaser( server, nodeInfo, index, settings ); - if( teaser ) { - // If they click on the teaser, then activate it. - teaser.display.unbind("click").bind( "click", teaser, function( event ) { - _this.activateTeaser( event.data ); - }); - - if( this.activeTeaser ) { - this.activeTeaser.setActive( nodeInfo.nid == this.activeTeaser.node.nodeInfo.nid ); - } - - if( this.selectedTeaser ) { - this.selectedTeaser.setSelected( nodeInfo.nid == this.selectedTeaser.node.nodeInfo.nid ); - } - - // Add this teaser to the teasers array. - this.teasers.push( teaser ); - } - }; - - // Reset the teaser bindings. - this.resetTeasers = function() { - // Remove all handlers. - var i = this.teasers.length; - while(i--) { - this.teasers[i].reset(); - } - this.teasers = []; - }; - - // Set the arguments for this playlist. - this.setArgs = function( _args ) { - if( _args ) { - // Reset the arguments. - this.args = settings.args; - - // Loop through and add the new arguments. - var i = _args.length; - while(i) { - i--; - var arg = _args[i]; - if( arg && (arg != settings.wildcard) ) { - this.args[i] = arg; - } - } - } - }; - - // Selects a teaser. - this.selectTeaser = function( teaser ) { - - // Set the current active teaser to false. - if( this.selectedTeaser ) { - this.selectedTeaser.setSelected( false ); - } - - // Store the active teaser for next time. - this.selectedTeaser = teaser; - - if( this.selectedTeaser ) { - // Now activate the new teaser. - this.selectedTeaser.setSelected( true ); - - // Set this item as visible in the scroll region. - this.scrollRegion.setVisible( teaser.index ); - } - }; - - // Activate the teaser. - this.activateTeaser = function( teaser ) { - // First select the teaser. - this.selectTeaser( teaser ); - - // Set the current active teaser to false. - if( this.activeTeaser ) { - this.activeTeaser.setActive( false ); - } - - // Store the active teaser for next time. - this.activeTeaser = teaser; - - if( this.activeTeaser ) { - // Now activate the new teaser. - this.activeTeaser.setActive( true ); - - // Set the active and current index to this one. - if( this.pager ) { - this.pager.activeIndex = this.pager.currentIndex = teaser.index; - } - - if( this.activePager ) { - this.activePager.activeIndex = this.activePager.currentIndex = teaser.index; - } - - // Trigger an even that the teaser has been activated. - this.display.trigger( "playlistload", teaser.node.nodeInfo ); - } - }; - })( server, this, settings ); - }; - -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Set up our defaults for this component. - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - linkText:"#medialinktext" - }); - - jQuery.fn.playlistlink = function( settings, linkInfo ) { - return new (function( link, settings, linkInfo ) { - settings = jQuery.media.utils.getSettings(settings); - this.display = link; - this.arg = linkInfo.arg; - this.text = linkInfo.text; - this.index = linkInfo.index; - - // Call the setLink when clicked. - this.display.medialink( settings, function( event ) { - _this.display.trigger( "linkclick", event.data ); - }, this ); - - this.setActive = function( active ) { - if( settings.template.onLinkSelect ) { - settings.template.onLinkSelect( _this, active ); - } - }; - - this.display.find( settings.ids.linkText ).html( this.text ); - })( this, settings, linkInfo ); - }; - -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - rotatorTimeout:5000, - rotatorTransition:"fade", - rotatorEasing:"swing", - rotatorSpeed:"slow", - rotatorHover:false - }); - - jQuery.fn.mediarotator = function( settings ) { - if( this.length === 0 ) { - return null; - } - return new (function( rotator, settings ) { - settings = jQuery.media.utils.getSettings(settings); - var _this = this; - this.images = []; - this.imageIndex = 0; - this.imageInterval = null; - this.width = 0; - this.height = 0; - - this.onImageLoaded = function() { - this.width = this.images[0].imgLoader.width; - this.height = this.images[0].imgLoader.height; - rotator.css({ - width:this.width, - height:this.height - }); - var sliderWidth = (settings.rotatorTransition == "hscroll") ? (2*this.width) : this.width; - var sliderHeight = (settings.rotatorTransition == "vscroll") ? (2*this.height) : this.height; - this.display.css({ - width:sliderWidth, - height:sliderHeight - }); - }; - - this.addImage = function() { - var image = $("
").mediaimage(null, true); - this.display.append( image.display ); - - if( (settings.rotatorTransition == "hscroll") || (settings.rotatorTransition == "vscroll") ) { - image.display.css({ - "float":"left" - }); - } - else { - image.display.css({ - position:"absolute", - zIndex:(200 - this.images.length), - top:0, - left:0 - }); - } - return image; - }; - - this.loadImages = function( _images ) { - this.images = []; - this.imageIndex = 0; - - jQuery.each( _images, function( index ) { - var image = _this.addImage(); - if( index === 0 ) { - image.display.unbind("imageLoaded").bind("imageLoaded", function() { - _this.onImageLoaded(); - }).show(); - } - image.loadImage( this ); - _this.images.push( image ); - }); - - if( settings.rotatorHover ) { - this.display.unbind("mouseenter").bind( "mouseenter", function() { - _this.startRotator(); - }).unbind("mouseleave").bind( "mouseleave", function() { - clearInterval( _this.imageInterval ); - }); - } - else { - this.startRotator(); - } - }; - - this.startRotator = function() { - clearInterval( this.imageInterval ); - this.imageInterval = setInterval( function() { - _this.showNextImage(); - }, settings.rotatorTimeout ); - }; - - this.showNextImage = function() { - this.hideImage( this.images[this.imageIndex].display ); - this.imageIndex = (this.imageIndex + 1) % this.images.length; - this.showImage( this.images[this.imageIndex].display ); - }; - - this.showImage = function( image ) { - if( settings.rotatorTransition === 'fade' ) { - image.fadeIn(settings.rotatorSpeed); - } - else { - image.css({ - marginLeft:0, - marginTop:0 - }).show(); - } - }; - - this.hideImage = function( image ) { - switch( settings.rotatorTransition ) { - case "fade": - image.fadeOut(settings.rotatorSpeed); - break; - case "hscroll": - image.animate({ - marginLeft:-this.width - }, settings.rotatorSpeed, settings.rotatorEasing, function() { - image.css({ - marginLeft:0 - }).remove(); - _this.display.append( image ); - }); - break; - case "vscroll": - image.animate({ - marginTop:-this.height - }, settings.rotatorSpeed, settings.rotatorEasing, function() { - image.css({ - marginTop:0 - }).remove(); - _this.display.append( image ); - }); - break; - default: - image.hide(); - break; - } - }; - - // Find all the images in the rotator container. - var _images = []; - rotator.find("img").each( function() { - _images.push( $(this).attr("src") ); - }); - - // Empty the container and setup the inner rotator. - rotator.empty().css("overflow", "hidden").append( $('
') ); - this.display = rotator.find(".imagerotatorinner"); - - // If they provided images, then we will want to load them. - if( _images.length ) { - this.loadImages( _images ); - } - })( this, settings ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - gateway:"" - }); - - // Extend the media namespace - jQuery.media = jQuery.extend( {}, { - // Add the rpc object. - rpc : function( settings ) { - // Return a new function for this object - return new (function( settings ) { - settings = jQuery.media.utils.getSettings(settings); - var _this = this; - - this.parseObject = function( data ) { - var ret = ""; - if( data instanceof Date ) { - ret = ""; - ret += data.getFullYear(); - ret += data.getMonth(); - ret += data.getDate(); - ret += "T"; - ret += data.getHours() + ":"; - ret += data.getMinutes() + ":"; - ret += data.getSeconds(); - ret += ""; - } else if( data instanceof Array ) { - ret = ''+"\n"; - for (var i=0; i < data.length; i++) { - ret += ' '+ this.serializeToXML(data[i]) +"\n"; - } - ret += ''; - } else { - ret = ''+"\n"; - for(var key in data ) { - if( data.hasOwnProperty(key) ) { - ret += " "+ key +""; - ret += this.serializeToXML(data[key]) +"\n"; - } - } - ret += ''; - } - return ret; - }; - - this.serializeToXML = function( data ) { - switch( typeof data ) { - case 'boolean': - return ''+ ((data) ? '1' : '0') +''; - - case 'number': - var parsed = parseInt(data, 10); - if(parsed == data) { - return ''+ data +''; - } - return ''+ data +''; - - case 'string': - return ''+ data +''; - - case 'object': - return this.parseObject( data ); - default: - break; - } - return ''; - }; - - this.parseXMLValue = function( node ) { - var childs = jQuery(node).children(); - var numChildren = childs.length; - var newArray = function(items) { - return function() { - items.push( _this.parseXMLValue(this) ); - }; - }; - var newObject = function( items ) { - return function() { - items[jQuery( "> name", this).text()] = _this.parseXMLValue(jQuery("value", this)); - }; - }; - for(var i=0; i < numChildren; i++) { - var element = childs[i]; - switch(element.tagName) { - case 'boolean': - return (jQuery(element).text() == 1); - case 'int': - return parseInt(jQuery(element).text(), 10); - case 'double': - return parseFloat(jQuery(element).text()); - case "string": - return jQuery(element).text(); - case "array": - var retArray = []; - jQuery("> data > value", element).each( newArray( retArray ) ); - return retArray; - case "struct": - var retObj = {}; - jQuery("> member", element).each( newObject( retObj ) ); - return retObj; - case "dateTime.iso8601": - return NULL; - default: - break; - } - } - return null; - }; - - this.parseXML = function( data ) { - var ret = {}; - ret.version = "1.0"; - jQuery("methodResponse params param > value", data).each( function(index) { - ret.result = _this.parseXMLValue(this); - }); - jQuery("methodResponse fault > value", data).each( function(index) { - ret.error = _this.parseXMLValue(this); - }); - return ret; - }; - - this.xmlRPC = function( method, params ) { - var ret = ''; - ret += ''; - ret += '' + method + ''; - if( params.length > 0 ) { - ret += ''; - var numParams = params.length; - for(var i=0; i < numParams; i++) { - if( params[i] ) { - ret += "" + this.serializeToXML(params[i]) + ""; - } - } - ret += ''; - } - ret += ''; - return ret; - }; - - this.call = function( method, onSuccess, onFailed, params, protocol ) { - if( settings.gateway ) { - jQuery.ajax({ - "url": settings.gateway, - "dataType": "xml", - "type": "POST", - "data": this.xmlRPC( method, params ), - "error": function( XMLHttpRequest, textStatus, errorThrown ) { - if( onFailed ) { - onFailed( textStatus ); - } - else if( window.console && console.log ) { - console.log( "Error: " + textStatus ); - } - }, - "success": function( msg ) { - var xml = _this.parseXML( msg ); - if( xml.error ) { - if( onFailed ) { - onFailed( xml.error ); - } - else if( window.console && console.dir ) { - console.dir( xml.error ); - } - } - else if( onSuccess ) { - onSuccess( xml.result ); - } - }, - "processData": false, - "contentType": "text/xml" - }); - } - else if( onSuccess ) { - onSuccess( null ); - } - }; - })( settings ); - } - }, jQuery.media ); - -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - vertical:true, - scrollSpeed:20, - updateTimeout:40, - hysteresis:40, - showScrollbar:true, - scrollMode:"auto" /* "auto", "span", "mouse", "none" */ - }); - - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - listMask:"#medialistmask", - list:"#medialist", - scrollWrapper:"#mediascrollbarwrapper", - scrollBar:"#mediascrollbar", - scrollTrack:"#mediascrolltrack", - scrollHandle:"#mediascrollhandle", - scrollUp:"#mediascrollup", - scrollDown:"#mediascrolldown" - }); - - jQuery.fn.mediascroll = function( settings ) { - return new (function( scrollRegion, settings ) { - settings = jQuery.media.utils.getSettings(settings); - - // Save the jQuery display. - this.display = scrollRegion; - var _this = this; - - this.spanMode = (settings.scrollMode == "span"); - - // Get the list region. - this.listMask = scrollRegion.find( settings.ids.listMask ); - - // Setup the mouse events for the auto scroll mode. - if( this.spanMode || (settings.scrollMode == "auto") ) { - // Add our event callbacks. - this.listMask.unbind("mouseenter").bind( 'mouseenter', function( event ) { - _this.onMouseOver( event ); - }); - this.listMask.unbind("mouseleave").bind( 'mouseleave', function( event ) { - _this.onMouseOut( event ); - }); - this.listMask.unbind("mousemove").bind( 'mousemove', function( event ) { - _this.onMouseMove( event ); - }); - } - // Setup the mouse events for the mouse scroll mode. - else if(settings.scrollMode == "mouse") { - // Add our event callbacks. - this.display.bind('mousewheel', function(event, delta, deltaX, deltaY) { - event.preventDefault(); - _this.onMouseScroll(deltaX, deltaY); - }); - } - - this.listMask.css("overflow", "hidden"); - - this.list = scrollRegion.find( settings.ids.list ); - - var element = this.list.children().eq(0); - this.elementWidth = element.width(); - this.elementHeight = element.height(); - this.elementSize = settings.vertical ? element.outerHeight(true) : element.outerWidth(true); - - // Early versions of jQuery have a broken clone method for IE. This fixes that. - if( jQuery.browser.msie && parseInt( jQuery.fn.jquery.replace(".", ""), 10 ) < 132 ) { - this.template = $("
").append( jQuery.media.utils.cloneFix( element ) ).html(); - } - else { - this.template = $("
").append( element.clone() ).html(); - } - - // Empty our list. - this.list.empty(); - - // Initialize our variables. - this.pagePos = settings.vertical ? "pageY" : "pageX"; - this.margin = settings.vertical ? "marginTop" : "marginLeft"; - this.scrollSize = settings.vertical ? 0 : this.listMask.width(); - this.scrollMid = 0; - this.mousePos = 0; - this.listPos = 0; - this.scrollInterval = 0; - this.shouldScroll = false; - this.bottomPos = 0; - this.ratio = 0; - this.elements = []; - this.listSize = 0; - - // Add the slider control to this scroll bar. - this.scrollBar = scrollRegion.find( settings.ids.scrollTrack ).mediaslider( settings.ids.scrollHandle, settings.vertical ); - - // Setup the scroll up button. - this.scrollUp = scrollRegion.find( settings.ids.scrollUp ).medialink( settings, function() { - _this.scroll( true ); - }); - - // Setup the scroll down button. - this.scrollDown = scrollRegion.find( settings.ids.scrollDown ).medialink( settings, function() { - _this.scroll( false ); - }); - - if( this.scrollBar ) { - // Handle the update value event. - this.scrollBar.display.unbind("updatevalue").bind("updatevalue", function( event, data ) { - _this.setScrollPos( data * _this.bottomPos, false ); - }); - - // Handle the set value event. - this.scrollBar.display.unbind("setvalue").bind("setvalue", function( event, data ) { - _this.setScrollPos( data * _this.bottomPos, true ); - }); - - // Add our event callbacks. - this.scrollBar.display.bind('mousewheel', function(event, delta, deltaX, deltaY) { - event.preventDefault(); - _this.onMouseScroll(deltaX, deltaY); - }); - } - - this.setScrollSize = function( newSize ) { - if( newSize ) { - this.scrollSize = newSize; - this.scrollMid = this.scrollSize / 2; - var activeSize = this.scrollSize - (settings.hysteresis*2); - this.bottomPos = (this.listSize - this.scrollSize); - this.ratio = ( (this.listSize - activeSize) / activeSize ); - this.shouldScroll = (this.bottomPos > 0); - } - }; - - // Clears this scroll region. - this.clear = function() { - // Reset all variables for a page refresh. - this.mousePos = 0; - this.shouldScroll = false; - this.bottomPos = 0; - this.ratio = 0; - this.scrolling = false; - this.elements = []; - this.listSize = 0; - this.list.css( this.margin, 0 ); - this.list.children().unbind(); - clearInterval( this.scrollInterval ); - this.list.empty(); - }; - - this.getOffset = function() { - return settings.vertical ? this.listMask.offset().top : this.listMask.offset().left; - }; - - // Activates the scroll region. - this.activate = function() { - // Set the scroll size. - this.setScrollSize( settings.vertical ? this.listMask.height() : this.listMask.width() ); - - // Now reset the list position. - this.setScrollPos( 0, true ); - }; - - // Add an item to this scroll region. - this.newItem = function() { - var newTemplate = $(this.template); - this.list.append( newTemplate ); - var element = this.getElement( newTemplate, this.elements.length ); - this.listSize += element.size; - if( settings.vertical ) { - this.list.css({ - height:this.listSize - }); - } - else { - this.list.css({ - width:this.listSize - }); - } - this.elements.push( element ); - return element.obj; - }; - - // Returns the cached element object with all properties. - this.getElement = function( element, index ) { - var size = this.elementSize; - var pos = this.listSize; - return { - obj:element, - size:size, - position:pos, - bottom:(pos+size), - mid:(size/2), - index:index - }; - }; - - // Scroll the list up or down one element. - this.scroll = function( up ) { - var element = this.getElementAtPosition( up ? 0 : this.scrollSize ); - if( element ) { - var newElement = (element.straddle || up) ? element : this.elements[ element.index + 1 ]; - if( newElement ) { - var _listPos = up ? newElement.position : (newElement.bottom - this.scrollSize); - this.setScrollPos( _listPos, true ); - } - } - }; - - // Called when the mouse scrolls. - this.onMouseScroll = function( deltaX, deltaY ) { - var d = settings.vertical ? -deltaY : deltaX; - this.setScrollPos(this.listPos + (settings.scrollSpeed*d)); - }; - - // Called when the mouse moves within the scroll region. - this.onMouseMove = function( event ) { - this.mousePos = event[ this.pagePos ] - this.getOffset(); - - // If the scroll type is span, then just move the list - // up and down according to the listSize/regionSize ratio. - if( this.shouldScroll && this.spanMode ) { - this.setScrollPos( (this.mousePos - settings.hysteresis) * this.ratio ); - } - }; - - // Called when the mouse enters the scroll region. - this.onMouseOver = function( event ) { - if( this.shouldScroll ) { - clearInterval( this.scrollInterval ); - this.scrollInterval = setInterval( function() { - _this.update(); - }, settings.updateTimeout ); - } - }; - - // Called when the mouse exits the scroll region. - this.onMouseOut = function( event ) { - clearInterval( this.scrollInterval ); - }; - - // This function will align the scroll region. - this.align = function( up ) { - var element = this.getElementAtPosition( up ? 0 : this.scrollSize ); - if( element ) { - var _listPos = up ? element.position : (element.bottom - this.scrollSize); - this.setScrollPos( _listPos, true ); - } - }; - - // Will set the element at the given index visible. - this.setVisible = function( index ) { - var element = this.elements[index]; - if( element ) { - var newPos = this.listPos; - if( element.position < this.listPos ) { - newPos = element.position; - } else if( (element.bottom - this.listPos) > this.scrollSize ) { - newPos = element.bottom - this.scrollSize; - } - if( newPos != this.listPos ) { - this.setScrollPos( newPos, true ); - } - } - }; - - // Gets an element at a specific location in the list. - this.getElementAtPosition = function( position ) { - var element = null; - var i = this.elements.length; - while(i--) { - element = this.elements[i]; - if( ((element.position - this.listPos) < position) && - ((element.bottom - this.listPos) >= position) ) { - element.straddle = ((element.bottom - this.listPos) != position); - break; - } - } - return element; - }; - - // Called every interval to update the scroll position. - this.update = function() { - var delta = this.mousePos - this.scrollMid; - if( Math.abs(delta) > settings.hysteresis ) { - var hyst = (delta > 0) ? -settings.hysteresis : settings.hysteresis; - delta = settings.scrollSpeed * (( this.mousePos + hyst - this.scrollMid) / this.scrollMid); - this.setScrollPos(this.listPos + delta); - } - }; - - // Sets the scroll position. - this.setScrollPos = function( _listPos, tween ) { - // Make sure we are greater than zero here. - _listPos = (_listPos < 0) ? 0 : _listPos; - - // See if we should scroll and if the list position is - // greater than the bottom position. - if( this.shouldScroll && (_listPos > this.bottomPos) ) { - _listPos = this.bottomPos; - } - - // Now set the list position. - this.listPos = _listPos; - - // Set the position of the scroll bar. - if( this.scrollBar ) { - var newPos = this.bottomPos ? (this.listPos / this.bottomPos) : 0; - this.scrollBar.setPosition( newPos ); - } - - if( tween ) { - if( settings.vertical ) { - this.list.animate({ - marginTop: -this.listPos - }, (settings.scrollSpeed*10)); - } - else { - this.list.animate({ - marginLeft: -this.listPos - }, (settings.scrollSpeed*10)); - } - } - else { - this.list.css( this.margin, -this.listPos ); - } - }; - })( this, settings ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - // Extend the media namespace - jQuery.media = jQuery.extend( {}, { - // Add the sha256 object. - sha256 : function() { - /* A JavaScript implementation of the SHA family of hashes, as defined in FIPS PUB 180-2 - * as well as the corresponding HMAC implementation as defined in FIPS PUB 198a - * Version 1.2 Copyright Brian Turek 2009 - * Distributed under the BSD License - * See http://jssha.sourceforge.net/ for more information - * - * Several functions taken from Paul Johnson - */ - function jsSHA(o,p){jsSHA.charSize=8;jsSHA.b64pad="";jsSHA.hexCase=0;var q=null;var r=null;var s=function(a){var b=[];var c=(1<>5]|=(a.charCodeAt(i/jsSHA.charSize)&c)<<(32-jsSHA.charSize-i%32)}return b};var u=function(a){var b=[];var c=a.length;for(var i=0;i>3]|=d<<(24-(4*(i%8)))}else{return"INVALID HEX STRING"}}return b};var v=null;var w=null;if("HEX"===p){if(0!==(o.length%2)){return"TEXT MUST BE IN BYTE INCREMENTS"}v=o.length*4;w=u(o)}else if(("ASCII"===p)||('undefined'===typeof(p))){v=o.length*jsSHA.charSize;w=s(o)}else{return"UNKNOWN TEXT INPUT TYPE"}var A=function(a){var b=jsSHA.hexCase?"0123456789ABCDEF":"0123456789abcdef";var c="";var d=a.length*4;for(var i=0;i>2]>>((3-i%4)*8+4))&0xF)+b.charAt((a[i>>2]>>((3-i%4)*8))&0xF)}return c};var B=function(a){var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var c="";var d=a.length*4;for(var i=0;i>2]>>8*(3-i%4))&0xFF)<<16)|(((a[i+1>>2]>>8*(3-(i+1)%4))&0xFF)<<8)|((a[i+2>>2]>>8*(3-(i+2)%4))&0xFF);for(var j=0;j<4;j++){if(i*8+j*6>a.length*32){c+=jsSHA.b64pad}else{c+=b.charAt((e>>6*(3-j))&0x3F)}}}return c};var C=function(x,n){if(n<32){return(x>>>n)|(x<<(32-n))}else{return x}};var D=function(x,n){if(n<32){return x>>>n}else{return 0}};var E=function(x,y,z){return(x&y)^(~x&z)};var F=function(x,y,z){return(x&y)^(x&z)^(y&z)};var G=function(x){return C(x,2)^C(x,13)^C(x,22)};var I=function(x){return C(x,6)^C(x,11)^C(x,25)};var J=function(x){return C(x,7)^C(x,18)^D(x,3)};var L=function(x){return C(x,17)^C(x,19)^D(x,10)};var M=function(x,y){var a=(x&0xFFFF)+(y&0xFFFF);var b=(x>>>16)+(y>>>16)+(a>>>16);return((b&0xFFFF)<<16)|(a&0xFFFF)};var N=function(a,b,c,d){var e=(a&0xFFFF)+(b&0xFFFF)+(c&0xFFFF)+(d&0xFFFF);var f=(a>>>16)+(b>>>16)+(c>>>16)+(d>>>16)+(e>>>16);return((f&0xFFFF)<<16)|(e&0xFFFF)};var O=function(a,b,c,d,e){var f=(a&0xFFFF)+(b&0xFFFF)+(c&0xFFFF)+(d&0xFFFF)+(e&0xFFFF);var g=(a>>>16)+(b>>>16)+(c>>>16)+(d>>>16)+(e>>>16)+(f>>>16);return((g&0xFFFF)<<16)|(f&0xFFFF)};var P=function(j,k,l){var W=[];var a,b,c,d,e,f,g,h;var m,T2;var H;var K=[0x428A2F98,0x71374491,0xB5C0FBCF,0xE9B5DBA5,0x3956C25B,0x59F111F1,0x923F82A4,0xAB1C5ED5,0xD807AA98,0x12835B01,0x243185BE,0x550C7DC3,0x72BE5D74,0x80DEB1FE,0x9BDC06A7,0xC19BF174,0xE49B69C1,0xEFBE4786,0x0FC19DC6,0x240CA1CC,0x2DE92C6F,0x4A7484AA,0x5CB0A9DC,0x76F988DA,0x983E5152,0xA831C66D,0xB00327C8,0xBF597FC7,0xC6E00BF3,0xD5A79147,0x06CA6351,0x14292967,0x27B70A85,0x2E1B2138,0x4D2C6DFC,0x53380D13,0x650A7354,0x766A0ABB,0x81C2C92E,0x92722C85,0xA2BFE8A1,0xA81A664B,0xC24B8B70,0xC76C51A3,0xD192E819,0xD6990624,0xF40E3585,0x106AA070,0x19A4C116,0x1E376C08,0x2748774C,0x34B0BCB5,0x391C0CB3,0x4ED8AA4A,0x5B9CCA4F,0x682E6FF3,0x748F82EE,0x78A5636F,0x84C87814,0x8CC70208,0x90BEFFFA,0xA4506CEB,0xBEF9A3F7,0xC67178F2];if(l==="SHA-224"){H=[0xc1059ed8,0x367cd507,0x3070dd17,0xf70e5939,0xffc00b31,0x68581511,0x64f98fa7,0xbefa4fa4]}else{H=[0x6A09E667,0xBB67AE85,0x3C6EF372,0xA54FF53A,0x510E527F,0x9B05688C,0x1F83D9AB,0x5BE0CD19]}j[k>>5]|=0x80<<(24-k%32);j[((k+1+64>>9)<<4)+15]=k;var n=j.length;for(var i=0;ik){f[15]&=0xFFFFFF00}for(var i=0;i<=15;i++){g[i]=f[i]^0x36363636;h[i]=f[i]^0x5C5C5C5C}j=P(g.concat(w),512+v,c);j=P(h.concat(j),512+l,c);return(e(j))}} - - // But I wrote this... ;) - this.encrypt = function( key, input ) { - var shaObj = new jsSHA(input, "ASCII"); - return shaObj.getHMAC(key, "ASCII", "SHA-256", "HEX"); - }; - } - }, jQuery.media ); - -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - jQuery.fn.mediaslider = function( handleId, vertical, inverted ) { - if( this.length === 0 ) { - return null; - } - return new (function( control, handleId, vertical, inverted ) { - var _this = this; - this.display = control.css({ - cursor:"pointer" - }); - this.dragging = false; - this.value = 0; - this.handle = this.display.find(handleId); - this.pagePos = vertical ? "pageY" : "pageX"; - this.handlePos = 0; - - // Only if there is a handle. - if( this.handle.length > 0 ) { - this.handleSize = vertical ? this.handle.height() : this.handle.width(); - this.handleMid = (this.handleSize/2); - } - - this.onResize = function() { - this.setTrackSize(); - this.updateValue( this.value ); - }; - - this.setTrackSize = function() { - this.trackSize = vertical ? this.display.height() : this.display.width(); - this.trackSize -= this.handleSize; - this.trackSize = (this.trackSize > 0) ? this.trackSize : 1; - }; - - this.setValue = function( _value ) { - this.setPosition( _value ); - this.display.trigger( "setvalue", this.value ); - }; - - this.updateValue = function( _value ) { - this.setPosition( _value ); - this.display.trigger( "updatevalue", this.value ); - }; - - this.setPosition = function( _value ) { - _value = (_value < 0) ? 0 : _value; - _value = (_value > 1) ? 1 : _value; - this.value = _value; - this.handlePos = inverted ? (1-this.value) : this.value; - this.handlePos *= this.trackSize; - this.handle.css( (vertical ? "marginTop" : "marginLeft"), this.handlePos ); - }; - - this.display.unbind("mousedown").bind("mousedown", function( event ) { - event.preventDefault(); - _this.dragging = true; - }); - - this.getOffset = function() { - var offset = vertical ? this.display.offset().top : this.display.offset().left; - return (offset + (this.handleSize / 2)); - }; - - this.getPosition = function( pagePos ) { - var pos = (pagePos - this.getOffset()) / this.trackSize; - pos = (pos < 0) ? 0 : pos; - pos = (pos > 1) ? 1 : pos; - pos = inverted ? (1-pos) : pos; - return pos; - }; - - this.display.unbind("mousemove").bind("mousemove", function( event ) { - event.preventDefault(); - if( _this.dragging ) { - _this.updateValue( _this.getPosition( event[_this.pagePos] ) ); - } - }); - - this.display.unbind("mouseleave").bind("mouseleave", function( event ) { - event.preventDefault(); - if( _this.dragging ) { - _this.dragging = false; - _this.setValue( _this.getPosition( event[_this.pagePos] ) ); - } - }); - - this.display.unbind("mouseup").bind("mouseup", function( event ) { - event.preventDefault(); - if( _this.dragging ) { - _this.dragging = false; - _this.setValue( _this.getPosition( event[_this.pagePos] ) ); - } - }); - - this.onResize(); - - })( this, handleId, vertical, inverted ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - pageLink:false - }); - - jQuery.fn.mediateaser = function( server, nodeInfo, _index, settings ) { - if( this.length === 0 ) { - return null; - } - return new (function( server, nodeInfo, _index, teaser, settings ) { - settings = jQuery.media.utils.getSettings(settings); - - var _this = this; - this.display = teaser; - - // If they hover over the teaser... - this.display.unbind("mouseenter").bind( "mouseenter", function(event) { - if( settings.template.onTeaserOver ) { - settings.template.onTeaserOver( _this ); - } - }); - - // If they hover away from the teaser... - this.display.unbind("mouseleave").bind( "mouseleave", function(event) { - if( settings.template.onTeaserOut ) { - settings.template.onTeaserOut( _this ); - } - }); - - // The index of this teaser - this.index = _index; - - // Setup the node. - this.node = this.display.medianode( server, settings ); - - // Load the node information. - if( this.node ) { - this.node.loadNode( nodeInfo ); - } - - // If they wish to link these teasers to actual nodes. - if( this.node && settings.pageLink ) { - var path = settings.baseURL; - path += nodeInfo.path ? nodeInfo.path : ("node/" + nodeInfo.nid); - this.node.display.wrap(''); - } - - this.reset = function() { - if( this.node ) { - this.node.display.unbind(); - } - }; - - this.setActive = function( _active ) { - if( settings.template.onTeaserActivate ) { - settings.template.onTeaserActivate(this, _active); - } - }; - - this.setSelected = function( _selected ) { - if( settings.template.onTeaserSelect ) { - settings.template.onTeaserSelect(this, _selected); - } - }; - - // Let the template setup the teaser. - if( settings.template.onTeaserLoad ) { - settings.template.onTeaserLoad( this ); - } - })( server, nodeInfo, _index, this, settings ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - titleLinks:"#mediatitlelinks" - }); - - jQuery.fn.mediatitlebar = function( settings ) { - if( this.length === 0 ) { - return null; - } - return new (function( titleBar, settings ) { - // Save the jQuery display. - var _this = this; - this.display = titleBar; - - this.titleLinks = this.display.find( settings.ids.titleLinks ); - - this.display.find("a").each( function() { - var linkId = $(this).attr("href"); - $(this).medialink( settings, function( event ) { - event.preventDefault(); - _this.display.trigger( event.data.id ); - }, { - id:linkId.substr(1), - obj:$(this) - } ); - }); - })( this, settings ); - }; - -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - jQuery.media = jQuery.extend( {}, { - utils : { - getBaseURL : function() { - var url = new RegExp(/^(http[s]?\:[\\\/][\\\/])([^\\\/\?]+)/); - var results = url.exec(location.href); - return results ? results[0] : ""; - }, - - timer:{}, - stopElementHide:{}, - showThenHide : function( element, id, showSpeed, hideSpeed, finished ) { - if( element ) { - element.show(showSpeed); - if( jQuery.media.utils.timer.hasOwnProperty(id) ) { - clearTimeout( jQuery.media.utils.timer[id] ); - } - jQuery.media.utils.timer[id] = setTimeout( function() { - if( !jQuery.media.utils.stopElementHide[id] ) { - element.hide(hideSpeed, function() { - if( jQuery.media.utils.stopElementHide[id] ) { - element.show(); - } - - if( finished ) { - finished(); - } - }); - } - }, 5000); - } - }, - - stopHide : function( element, id ) { - jQuery.media.utils.stopElementHide[id] = true; - clearTimeout(jQuery.media.utils.timer[id]); - }, - - stopHideOnOver : function( element, id ) { - if( element ) { - jQuery.media.utils.stopElementHide[id] = false; - element.unbind("mouseover").bind("mouseover", {id:id}, function( event ) { - jQuery.media.utils.stopElementHide[event.data.id] = true; - }).unbind("mouseout").bind("mouseout", {id:id}, function( event ) { - jQuery.media.utils.stopElementHide[event.data.id] = false; - }); - } - }, - - getSettings : function( settings ) { - // Make sure it exists... - if( !settings ) { - settings = {}; - } - - // Only get the settings if they have not yet been initialized. - if( !settings.initialized ) { - settings = jQuery.extend( {}, jQuery.media.defaults, settings ); - settings.ids = jQuery.extend( {}, jQuery.media.ids, settings.ids ); - settings.baseURL = settings.baseURL ? settings.baseURL : jQuery.media.utils.getBaseURL(); - settings.baseURL += settings.baseURL ? "/" : ""; - settings.initialized = true; - } - - // Return the settings. - return settings; - }, - - getId : function( display ) { - return display.attr("id") ? display.attr("id") : display.attr("class") ? display.attr("class") : "mediaplayer"; - }, - - getScaledRect : function( ratio, rect ) { - var scaledRect = {}; - scaledRect.x = rect.x ? rect.x : 0; - scaledRect.y = rect.y ? rect.y : 0; - scaledRect.width = rect.width ? rect.width : 0; - scaledRect.height = rect.height ? rect.height : 0; - - if( ratio ) { - var newRatio = (rect.width / rect.height); - scaledRect.height = (newRatio > ratio) ? rect.height : Math.floor(rect.width / ratio); - scaledRect.width = (newRatio > ratio) ? Math.floor(rect.height * ratio) : rect.width; - scaledRect.x = Math.floor((rect.width - scaledRect.width) / 2); - scaledRect.y = Math.floor((rect.height - scaledRect.height) / 2); - } - - return scaledRect; - }, - - // Checks all parents visibility, and resets them and adds those items to a passed in - // array which can be used to reset their visibiltiy at a later point by calling - // resetVisibility - checkVisibility : function( display, invisibleParents ) { - var isVisible = true; - display.parents().each( function() { - var jObject = jQuery(this); - if( !jObject.is(':visible') ) { - isVisible = false; - var attrClass = jObject.attr("class"); - invisibleParents.push( { - obj:jObject, - attr:attrClass - } ); - jObject.removeClass(attrClass); - } - }); - }, - - // Reset's the visibility of the passed in parent elements. - resetVisibility : function( invisibleParents ) { - // Now iterate through all of the invisible objects and rehide them. - var i = invisibleParents.length; - while(i){ - i--; - invisibleParents[i].obj.addClass(invisibleParents[i].attr); - } - }, - - getFlash : function( player, id, width, height, flashvars, wmode ) { - // Get the protocol. - var protocol = window.location.protocol; - if (protocol.charAt(protocol.length - 1) == ':') { - protocol = protocol.substring(0, protocol.length - 1); - } - - // Convert the flashvars object to a string... - var flashVarsString = jQuery.param(flashvars); - - // Get the HTML flash object string. - var flash = ' '; - flash += ''; - flash += ''; - flash += ''; - flash += ''; - flash += ''; - flash += ''; - flash += ''; - flash += ''; - return flash; - }, - - removeFlash : function( obj, id ) { - if( typeof(swfobject) != "undefined" ) { - swfobject.removeSWF( id ); - } - else { - var flash = obj.find('object').eq(0)[0]; - if( flash ) { - flash.parentNode.removeChild(flash); - } - } - }, - - // Insert flash routine. If they have swfobject, then this function will dynamically use that instead. - insertFlash : function( obj, player, id, width, height, flashvars, wmode, onAdded ) { - jQuery.media.utils.removeFlash( obj, id ); - obj.children().remove(); - obj.append('

Get Adobe Flash player

'); - if( typeof(swfobject) != "undefined" ) { - var params = { - allowScriptAccess:"always", - allowfullscreen:"true", - wmode:wmode, - quality:"high" - }; - swfobject.embedSWF( - player, - id, - width, - height, - "9.0.0", - "expressInstall.swf", - flashvars, - params, - {}, - function( swf ) { - onAdded( swf.ref ); - } - ); - } - else { - var flash = jQuery.media.utils.getFlash( player, id, width, height, flashvars, wmode ); - var container = obj.find('#' + id).eq(0); - if( jQuery.browser.msie ) { - container[0].outerHTML = flash; - onAdded( obj.find('object').eq(0)[0] ); - } else { - container.replaceWith( flash ); - onAdded( obj.find('embed').eq(0)[0] ); - } - } - }, - - // Fix the clone method for jQuery 1.2.6 - 1.3.1 - cloneFix: function( obj, events ) { - // Do the clone - var ret = obj.map(function(){ - // IE copies events bound via attachEvent when - // using cloneNode. Calling detachEvent on the - // clone will also remove the events from the orignal - // In order to get around this, we use innerHTML. - // Unfortunately, this means some modifications to - // attributes in IE that are actually only stored - // as properties will not be copied (such as the - // the name attribute on an input). - var html = this.outerHTML; - if ( !html ) { - var div = this.ownerDocument.createElement("div"); - div.appendChild( this.cloneNode(true) ); - html = div.innerHTML; - } - - return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0]; - }); - - // Copy the events from the original to the clone - if ( events === true ) { - var orig = obj.find("*").andSelf(), i = 0; - - ret.find("*").andSelf().each(function(){ - if ( this.nodeName !== orig[i].nodeName ) { - return; - } - - var events = jQuery.data( orig[i], "events" ); - - for ( var type in events ) { - if( events.hasOwnProperty( type ) ) { - for ( var handler in events[ type ] ) { - if( events[ type ].hasOwnProperty( handler ) ) { - jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); - } - } - } - } - - i++; - }); - } - - // Return the cloned set - return ret; - } - } - }, jQuery.media ); -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - window.onVimeoReady = function( playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onReady(); - }; - - window.onVimeoFinish = function( playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onFinished(); - }; - - window.onVimeoLoading = function( data, playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onLoading( data ); - }; - - window.onVimeoPlay = function( playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onPlaying(); - }; - - window.onVimeoPause = function( playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onPaused(); - }; - - window.onVimeoProgress = function( time, playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onProgress(time); - }; - - // Tell the media player how to determine if a file path is a YouTube media type. - jQuery.media.playerTypes = jQuery.extend( jQuery.media.playerTypes, { - "vimeo":function( file ) { - return (file.search(/^http(s)?\:\/\/(www\.)?vimeo\.com/i) === 0); - } - }); - - jQuery.fn.mediavimeo = function( options, onUpdate ) { - return new (function( video, options, onUpdate ) { - this.display = video; - var _this = this; - this.player = null; - this.videoFile = null; - this.ready = false; - this.bytesLoaded = 0; - this.bytesTotal = 0; - this.currentVolume = 1; - - this.createMedia = function( videoFile, preview ) { - this.videoFile = videoFile; - this.ready = false; - var playerId = (options.id + "_media"); - var flashvars = { - clip_id:this.getId(videoFile.path), - width:"100%", - height:"100%", - js_api:'1', - js_onLoad:'onVimeoReady', - js_swf_id:playerId - }; - var rand = Math.floor(Math.random() * 1000000); - var flashPlayer = 'http://vimeo.com/moogaloop.swf?rand=' + rand; - jQuery.media.utils.insertFlash( - this.display, - flashPlayer, - playerId, - "100%", - "100%", - flashvars, - options.wmode, - function( obj ) { - _this.player = obj; - _this.loadPlayer(); - } - ); - }; - - this.getId = function( path ) { - var regex = /^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i; - return (path.search(regex) === 0) ? path.replace(regex, "$3") : path; - }; - - this.loadMedia = function( videoFile ) { - this.bytesLoaded = 0; - this.bytesTotal = 0; - this.createMedia( videoFile ); - }; - - // Called when the player has finished loading. - this.onReady = function() { - this.ready = true; - this.loadPlayer(); - }; - - // Load the player. - this.loadPlayer = function() { - if( this.ready && this.player && this.player.api_addEventListener ) { - // Add our event listeners. - this.player.api_addEventListener('onProgress', 'onVimeoProgress'); - this.player.api_addEventListener('onFinish', 'onVimeoFinish'); - this.player.api_addEventListener('onLoading', 'onVimeoLoading'); - this.player.api_addEventListener('onPlay', 'onVimeoPlay'); - this.player.api_addEventListener('onPause', 'onVimeoPause'); - - // Let them know the player is ready. - onUpdate({ - type:"playerready" - }); - - this.playMedia(); - } - }; - - this.onFinished = function() { - onUpdate({ - type:"complete" - }); - }; - - this.onLoading = function( data ) { - this.bytesLoaded = data.bytesLoaded; - this.bytesTotal = data.bytesTotal; - }; - - this.onPlaying = function() { - onUpdate({ - type:"playing", - busy:"hide" - }); - }; - - this.onPaused = function() { - onUpdate({ - type:"paused", - busy:"hide" - }); - }; - - this.playMedia = function() { - onUpdate({ - type:"playing", - busy:"hide" - }); - if (this.player.api_play) { - this.player.api_play(); - } - }; - - this.onProgress = function( time ) { - onUpdate({ - type:"progress" - }); - }; - - this.pauseMedia = function() { - onUpdate({ - type:"paused", - busy:"hide" - }); - if (this.player.api_pause) { - this.player.api_pause(); - } - }; - - this.stopMedia = function() { - this.pauseMedia(); - if (this.player.api_unload) { - this.player.api_unload(); - } - }; - - this.destroy = function() { - this.stopMedia(); - jQuery.media.utils.removeFlash( this.display, (options.id + "_media") ); - this.display.children().remove(); - }; - - this.seekMedia = function( pos ) { - if (this.player.api_seekTo) { - this.player.api_seekTo( pos ); - } - }; - - this.setVolume = function( vol ) { - this.currentVolume = vol; - if (this.player.api_setVolume) { - this.player.api_setVolume( (vol*100) ); - } - }; - - // For some crazy reason... Vimeo has not implemented this... so just cache the value. - this.getVolume = function() { - return this.currentVolume; - }; - - this.getDuration = function() { - return this.player.api_getDuration ? this.player.api_getDuration() : 0; - }; - - this.getCurrentTime = function() { - return this.player.api_getCurrentTime ? this.player.api_getCurrentTime() : 0; - }; - - this.getBytesLoaded = function() { - return this.bytesLoaded; - }; - - this.getBytesTotal = function() { - return this.bytesTotal; - }; - - // Not implemented yet... - this.setQuality = function( quality ) {}; - this.getQuality = function() { - return ""; - }; - this.hasControls = function() { - return true; - }; - this.showControls = function(show) {}; - //this.setSize = function( newWidth, newHeight ) {}; - this.getEmbedCode = function() { - return "This video cannot be embedded."; - }; - this.getMediaLink = function() { - return "This video currently does not have a link."; - }; - })( this, options, onUpdate ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - jQuery.fn.mediavoter = function( settings, server, userVote ) { - if( this.length === 0 ) { - return null; - } - return new (function( voteObj, settings, server, userVote ) { - // Save the jQuery display. - this.display = voteObj; - var _this = this; - - // The node id. - this.nodeId = 0; - - // Store all of our votes. - this.votes = []; - - // Get the tag for the voting. - this.tag = this.display.attr("tag"); - - // Setup each vote element. - this.display.find("div").each( function() { - if( userVote ) { - $(this).css("cursor", "pointer"); - $(this).unbind("click").bind( "click", function( event ) { - _this.setVote( parseInt($(this).attr("vote"), 10) ); - }); - $(this).unbind("mouseenter").bind( "mouseenter", function( event ) { - _this.updateVote( { - value: parseInt($(this).attr("vote"), 10) - }, true ); - }); - } - _this.votes.push( { - vote:parseInt($(this).attr("vote"), 10), - display:$(this) - } ); - }); - - // Sort the votes based on numerical order. - this.votes.sort( function( voteA, voteB ) { - return (voteA.vote - voteB.vote); - }); - - // If this is a uservoter, then add the mouse leave event. - if( userVote ) { - this.display.unbind("mouseleave").bind( "mouseleave", function( event ) { - _this.updateVote( { - value:0 - }, true ); - }); - } - - // Update a vote value. - this.updateVote = function( vote, hover ) { - if( vote && settings.template.updateVote ) { - settings.template.updateVote( this, vote.value, hover ); - } - }; - - // Get the vote from the server. - this.getVote = function( nodeInfo ) { - if( nodeInfo && nodeInfo.nid ) { - this.nodeId = parseInt(nodeInfo.nid, 10); - if( nodeInfo.vote ) { - var vote = userVote ? nodeInfo.vote.uservote : nodeInfo.vote.vote; - this.updateVote( nodeInfo.vote.vote, false ); - this.display.trigger( "voteGet", vote ); - } - else { - if( server && nodeInfo.nid && (this.display.length > 0) ) { - this.display.trigger( "processing" ); - var cmd = userVote ? jQuery.media.commands.getUserVote : jQuery.media.commands.getVote; - server.call( cmd, function( vote ) { - _this.updateVote( vote, false ); - _this.display.trigger( "voteGet", vote ); - }, null, "node", this.nodeId, this.tag ); - } - } - } - }; - - // Set the current vote. - this.setVote = function( voteValue ) { - if( server && this.nodeId ) { - this.display.trigger( "processing" ); - this.updateVote( { - value:voteValue - }, false ); - server.call( jQuery.media.commands.setVote, function( vote ) { - _this.display.trigger( "voteSet", vote ); - }, null, "node", this.nodeId, voteValue, this.tag ); - } - }; - - // Delete the current vote. - this.deleteVote = function() { - if( server && this.nodeId ) { - this.display.trigger( "processing" ); - server.call( jQuery.media.commands.deleteVote, function( vote ) { - _this.updateVote( vote, false ); - _this.display.trigger( "voteDelete", vote ); - }, null, "node", this.nodeId, this.tag ); - } - }; - })( this, settings, server, userVote ); - }; -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - - // Called when the YouTube player is ready. - window.onYouTubePlayerReady = function( playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onReady(); - }; - - // Tell the media player how to determine if a file path is a YouTube media type. - jQuery.media.playerTypes = jQuery.extend( jQuery.media.playerTypes, { - "youtube":function( file ) { - return (file.search(/^http(s)?\:\/\/(www\.)?youtube\.com/i) === 0); - } - }); - - jQuery.fn.mediayoutube = function( options, onUpdate ) { - return new (function( video, options, onUpdate ) { - this.display = video; - var _this = this; - this.player = null; - this.videoFile = null; - this.loaded = false; - this.ready = false; - this.qualities = []; - - this.createMedia = function( videoFile, preview ) { - this.videoFile = videoFile; - this.ready = false; - var playerId = (options.id + "_media"); - var rand = Math.floor(Math.random() * 1000000); - var flashPlayer = 'http://www.youtube.com/apiplayer?rand=' + rand + '&version=3&enablejsapi=1&playerapiid=' + playerId; - jQuery.media.utils.insertFlash( - this.display, - flashPlayer, - playerId, - "100%", - "100%", - {}, - options.wmode, - function( obj ) { - _this.player = obj; - _this.loadPlayer(); - } - ); - }; - - this.getId = function( path ) { - var regex = /^http[s]?\:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9]+)/i; - return (path.search(regex) === 0) ? path.replace(regex, "$2") : path; - }; - - this.loadMedia = function( videoFile ) { - if( this.player ) { - this.loaded = false; - this.videoFile = videoFile; - - // Let them know the player is ready. - onUpdate( { - type:"playerready" - } ); - - // Load our video. - if (this.player.loadVideoById) { - this.player.loadVideoById( this.getId( this.videoFile.path ), 0, options.quality ); - } - } - }; - - // Called when the player has finished loading. - this.onReady = function() { - this.ready = true; - this.loadPlayer(); - }; - - // Try to load the player. - this.loadPlayer = function() { - if( this.ready && this.player ) { - // Create our callback functions. - window[options.id + 'StateChange'] = function( newState ) { - _this.onStateChange( newState ); - }; - - window[options.id + 'PlayerError'] = function( errorCode ) { - _this.onError( errorCode ); - }; - - window[options.id + 'QualityChange'] = function( newQuality ) { - _this.quality = newQuality; - }; - - // Add our event listeners. - if (this.player.addEventListener) { - this.player.addEventListener('onStateChange', options.id + 'StateChange'); - this.player.addEventListener('onError', options.id + 'PlayerError'); - this.player.addEventListener('onPlaybackQualityChange', options.id + 'QualityChange'); - } - - // Get all of the quality levels. - if (this.player.getAvailableQualityLevels) { - this.qualities = this.player.getAvailableQualityLevels(); - } - - // Let them know the player is ready. - onUpdate( { - type:"playerready" - }); - - // Load our video. - if (this.player.loadVideoById) { - this.player.loadVideoById( this.getId( this.videoFile.path ), 0 ); - } - } - }; - - // Called when the YouTube player state changes. - this.onStateChange = function( newState ) { - var playerState = this.getPlayerState( newState ); - onUpdate( { - type:playerState.state, - busy:playerState.busy - } ); - - if( !this.loaded && playerState == "playing" ) { - // Set this player to loaded. - this.loaded = true; - - // Update our meta data. - onUpdate( { - type:"meta" - } ); - } - }; - - // Called when the YouTube player has an error. - this.onError = function( errorCode ) { - var errorText = "An unknown error has occured: " + errorCode; - if( errorCode == 100 ) { - errorText = "The requested video was not found. "; - errorText += "This occurs when a video has been removed (for any reason), "; - errorText += "or it has been marked as private."; - } else if( (errorCode == 101) || (errorCode == 150) ) { - errorText = "The video requested does not allow playback in an embedded player."; - } - if( window.console && console.log ) { - console.log(errorText); - } - onUpdate( { - type:"error", - data:errorText - } ); - }; - - // Translates the player state for the YouTube API player. - this.getPlayerState = function( playerState ) { - switch (playerState) { - case 5: - return {state:'ready', busy:false}; - case 3: - return {state:'buffering', busy:"show"}; - case 2: - return {state:'paused', busy:"hide"}; - case 1: - return {state:'playing', busy:"hide"}; - case 0: - return {state:'complete', busy:false}; - case -1: - return {state:'stopped', busy:false}; - default: - return {state:'unknown', busy:false}; - } - return 'unknown'; - }; - /* - this.setSize = function( newWidth, newHeight ) { - //this.player.setSize(newWidth, newHeight); - }; - */ - this.playMedia = function() { - onUpdate({ - type:"buffering", - busy:"show" - }); - if (this.player.playVideo) { - this.player.playVideo(); - } - }; - - this.pauseMedia = function() { - if (this.player.pauseVideo) { - this.player.pauseVideo(); - } - }; - - this.stopMedia = function() { - if (this.player.stopVideo) { - this.player.stopVideo(); - } - }; - - this.destroy = function() { - this.stopMedia(); - jQuery.media.utils.removeFlash( this.display, (options.id + "_media") ); - this.display.children().remove(); - }; - - this.seekMedia = function( pos ) { - onUpdate({ - type:"buffering", - busy:"show" - }); - if (this.player.seekTo) { - this.player.seekTo( pos, true ); - } - }; - - this.setVolume = function( vol ) { - if (this.player.setVolume) { - this.player.setVolume( vol * 100 ); - } - }; - - this.setQuality = function( quality ) { - if (this.player.setPlaybackQuality) { - this.player.setPlaybackQuality( quality ); - } - }; - - this.getVolume = function() { - return this.player.getVolume ? (this.player.getVolume() / 100) : 0; - }; - - this.getDuration = function() { - return this.player.getDuration ? this.player.getDuration() : 0; - }; - - this.getCurrentTime = function() { - return this.player.getCurrentTime ? this.player.getCurrentTime() : 0; - }; - - this.getQuality = function() { - return this.player.getPlaybackQuality ? this.player.getPlaybackQuality() : 0; - }; - - this.getEmbedCode = function() { - return this.player.getVideoEmbedCode ? this.player.getVideoEmbedCode() : 0; - }; - - this.getMediaLink = function() { - return this.player.getVideoUrl ? this.player.getVideoUrl() : 0; - }; - - this.getBytesLoaded = function() { - return this.player.getVideoBytesLoaded ? this.player.getVideoBytesLoaded() : 0; - }; - - this.getBytesTotal = function() { - return this.player.getVideoBytesTotal ? this.player.getVideoBytesTotal() : 0; - }; - - this.hasControls = function() { - return false; - }; - this.showControls = function(show) {}; - })( this, options, onUpdate ); - }; -})(jQuery); \ No newline at end of file diff --git a/js/myfunctions.inc b/js/myfunctions.inc deleted file mode 100755 index 9293ba04..00000000 --- a/js/myfunctions.inc +++ /dev/null @@ -1,253 +0,0 @@ - 0) { - if(in_array(get_file_ext($node), $extensions)) { - $files[] = $path.'/'.$node; - } - } - else { - $files[] = $path.'/'.$node; - } - } - } - } - } - } - return $files; -} - -// Copy's a file, but makes sure the directory is created. -function smart_copy( $src, $dest, $chmod=0755 ) { - $directory = dirname($dest); - if (!is_dir($directory)){ - if (!mkdir($directory, $chmod, true)){ - return FALSE; - } - } - if( $src && $dest ) { - copy( $src, $dest ); - } -} - -// Opens a new file, but makes sure the directory is created. -function smart_fopen($path, $mode, $chmod=0755) { - $directory = dirname($path); - if (!is_dir($directory)){ - if (!mkdir($directory, $chmod, true)){ - return FALSE; - } - } - return fopen($path, $mode); -} - -/* - * String Encryption: Pass in string with a password. - */ - -function get_rnd_iv($iv_len) -{ - $iv = ''; - while ($iv_len-- > 0) { - $iv .= chr(mt_rand() & 0xff); - } - return $iv; -} -function md5_encrypt($plain_text, $password, $iv_len = 16) -{ - $plain_text .= "\x13"; - $n = strlen($plain_text); - if ($n % 16) $plain_text .= str_repeat("\0", 16 - ($n % 16)); - $i = 0; - $enc_text = get_rnd_iv($iv_len); - $iv = substr($password ^ $enc_text, 0, 512); - while ($i < $n) { - $block = substr($plain_text, $i, 16) ^ pack('H*', md5($iv)); - $enc_text .= $block; - $iv = substr($block . $iv, 0, 512) ^ $password; - $i += 16; - } - return base64_encode($enc_text); -} -function md5_decrypt($enc_text, $password, $iv_len = 16) -{ - $enc_text = base64_decode($enc_text); - $n = strlen($enc_text); - $i = $iv_len; - $plain_text = ''; - $iv = substr($password ^ substr($enc_text, 0, $iv_len), 0, 512); - while ($i < $n) { - $block = substr($enc_text, $i, 16); - $plain_text .= $block ^ pack('H*', md5($iv)); - $iv = substr($block . $iv, 0, 512) ^ $password; - $i += 16; - } - return preg_replace('/\\x13\\x00*$/', '', $plain_text); -} - -/* - * End Encryption routines. - */ - -// This function will extract a string given a start and end tag. -function ExtractString($str, $start, $end) { - $str_low = strtolower($str); - $pos_start = strpos($str_low, $start); - $pos_end = strpos($str_low, $end, ($pos_start + strlen($start))); - if ( ($pos_start !== false) && ($pos_end !== false) ) - { - $pos1 = $pos_start + strlen($start); - $pos2 = $pos_end - $pos1; - return substr($str, $pos1, $pos2); - } -} - -/* A function that detects SRC, HREF and URL links, in addition to URLs in CSS code, and Javascript imports. - * It also understands html entities(such as &) inside URLs. - * $matches[3] will contain Javascript import links, - * $matches[5] will contain the CSS links - * $matches[8] will contain the regular URL/SRC/HREF HTML links. - */ - -function get_links($url) { - if( !($body = @file_get_contents($url)) ) return FALSE; - //Pattern building across multiple lines to avoid page distortion. - $pattern = "/((@import\s+[\"'`]([\w:?=@&\/#._;-]+)[\"'`];)|"; - $pattern .= "(:\s*url\s*\([\s\"'`]*([\w:?=@&\/#._;-]+)"; - $pattern .= "([\s\"'`]*\))|<[^>]*\s+(src|href|url)\=[\s\"'`]*"; - $pattern .= "([\w:?=@&\/#._;-]+)[\s\"'`]*[^>]*>))/i"; - //End pattern building. - preg_match_all ($pattern, $body, $matches); - return (is_array($matches)) ? $matches : FALSE; -} - - -// Validate an email -function validate_email($email){ - $qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]'; - $dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]'; - $atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+'; - $quoted_pair = '\\x5c\\x00-\\x7f'; - $domain_literal = "\\x5b($dtext|$quoted_pair)*\\x5d"; - $quoted_string = "\\x22($qtext|$quoted_pair)*\\x22"; - $domain_ref = $atom; - $sub_domain = "($domain_ref|$domain_literal)"; - $word = "($atom|$quoted_string)"; - $domain = "$sub_domain(\\x2e$sub_domain)*"; - $local_part = "$word(\\x2e$word)*"; - $addr_spec = "$local_part\\x40$domain"; - return preg_match("!^$addr_spec$!", $email); -} - -/* - * Given two arrays, one regular, the other jumbled... the function will determine if the two arrays - * have the same letters (no repeats). - */ -function array_numbers(&$item) { $item = ord($item); } -function same_characters($array, $jumbled) { - $temp1 = array_values($array); - $temp2 = array_values($jumbled); - array_walk($temp1, 'array_numbers'); - array_walk($temp2, 'array_numbers'); - return (array_product($temp2) == array_product($temp1)); -} - -/** - * Regular expression version of the strpos function. Will also change the Pattern variable to the - * actual string that was matched so that we can determine the length. - */ -function preg_strpos($haystack, &$pattern, $offset = 0) { - $matches = array(); - if(preg_match($pattern, substr($haystack, $offset), $matches, PREG_OFFSET_CAPTURE) === 1) { - $pattern = $matches[0][0]; - return ($matches[0][1] + $offset); - } - else { - return FALSE; - } -} - -/** - * A function that takes an array and returns it in XML format. - */ -function array_to_xml($arr,$first=true) { - $output = ($first) ? "\n\n" : ""; - foreach($arr as $key => $val) { - $key = (is_numeric($key)) ? "arr_".$key : $key; // <0 is not allowed - switch (gettype($val)) { - case "array": - $output .= "<".htmlspecialchars($key)." type='array' size='".count($val)."'>". array_to_xml($val,false)."\n"; - break; - case "boolean": - $output .= "<".htmlspecialchars($key)." type='bool'>". ($val?"true":"false"). "\n"; - break; - case "integer": - $output .= "<".htmlspecialchars($key)." type='integer'>". htmlspecialchars($val)."\n"; - break; - case "double": - $output .= "<".htmlspecialchars($key)." type='double'>". htmlspecialchars($val)."\n"; - break; - case "string": - $output .= "<".htmlspecialchars($key)." type='string' size='".strlen($val)."'>". htmlspecialchars($val)."\n"; - break; - default: - $output .= "<".htmlspecialchars($key)." type='unknown'>".gettype($val). "\n"; - break; - } - } - $output .= ($first) ? "\n" : ""; - return $output; -} - -/** - * A function that sorts a two diminsional array. - */ -function array_sort($array, $key) { - for ($i = 0; $i < sizeof($array); $i++) { - $sort_values[$i] = $array[$i][$key]; - } - asort ($sort_values); - reset ($sort_values); - while (list ($arr_key, $arr_val) = each ($sort_values)) { - $sorted_arr[] = $array[$arr_key]; - } - return $sorted_arr; -} -?> diff --git a/js/source/jquery.media.auto.js b/js/source/jquery.media.auto.js deleted file mode 100644 index 5abe6bff..00000000 --- a/js/source/jquery.media.auto.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Extend the media namespace - jQuery.media = jQuery.extend( {}, { - // Add the auto server object. - auto : function( settings ) { - // Return a new function for this object - return new (function( settings ) { - this.json = jQuery.media.json( settings ); - this.rpc = jQuery.media.rpc( settings ); - this.call = function( method, onSuccess, onFailed, params, protocol ) { - if( protocol == "json" ) { - this.json.call( method, onSuccess, onFailed, params, protocol ); - } - else { - this.rpc.call( method, onSuccess, onFailed, params, protocol ); - } - }; - })( settings ); - } - }, jQuery.media ); -})(jQuery); diff --git a/js/source/jquery.media.control.js b/js/source/jquery.media.control.js deleted file mode 100755 index 0880f5a5..00000000 --- a/js/source/jquery.media.control.js +++ /dev/null @@ -1,263 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - volumeVertical:false - }); - - // Set up our defaults for this component. - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - currentTime:"#mediacurrenttime", - totalTime:"#mediatotaltime", - playPause:"#mediaplaypause", - seekUpdate:"#mediaseekupdate", - seekProgress:"#mediaseekprogress", - seekBar:"#mediaseekbar", - seekHandle:"#mediaseekhandle", - volumeUpdate:"#mediavolumeupdate", - volumeBar:"#mediavolumebar", - volumeHandle:"#mediavolumehandle", - mute:"#mediamute" - }); - - jQuery.fn.mediacontrol = function( settings ) { - if( this.length === 0 ) { - return null; - } - return new (function( controlBar, settings ) { - settings = jQuery.media.utils.getSettings(settings); - this.display = controlBar; - var _this = this; - - // Allow the template to provide their own function for this... - this.formatTime = (settings.template && settings.template.formatTime) ? settings.template.formatTime : - function( time ) { - time = time ? time : 0; - var seconds = 0; - var minutes = 0; - var hour = 0; - - hour = Math.floor(time / 3600); - time -= (hour * 3600); - minutes = Math.floor( time / 60 ); - time -= (minutes * 60); - seconds = Math.floor(time % 60); - - var timeString = ""; - - if( hour ) { - timeString += String(hour); - timeString += ":"; - } - - timeString += (minutes >= 10) ? String(minutes) : ("0" + String(minutes)); - timeString += ":"; - timeString += (seconds >= 10) ? String(seconds) : ("0" + String(seconds)); - return { - time:timeString, - units:"" - }; - }; - - this.setToggle = function( button, state ) { - var on = state ? ".on" : ".off"; - var off = state ? ".off" : ".on"; - if( button ) { - button.find(on).show(); - button.find(off).hide(); - } - }; - - var zeroTime = this.formatTime( 0 ); - this.duration = 0; - this.volume = -1; - this.prevVolume = 0; - this.percentLoaded = 0; - this.playState = false; - this.muteState = false; - this.currentTime = controlBar.find( settings.ids.currentTime ).text( zeroTime.time ); - this.totalTime = controlBar.find( settings.ids.totalTime ).text( zeroTime.time ); - - // Allow them to attach custom links to the control bar that perform player functions. - this.display.find("a.mediaplayerlink").each( function() { - var linkId = $(this).attr("href"); - $(this).medialink( settings, function( event ) { - event.preventDefault(); - _this.display.trigger( event.data.id ); - }, { - id:linkId.substr(1), - obj:$(this) - } ); - }); - - // Set up the play pause button. - this.playPauseButton = controlBar.find( settings.ids.playPause ).medialink( settings, function( event, target ) { - _this.playState = !_this.playState; - _this.setToggle( target, _this.playState ); - _this.display.trigger( "controlupdate", { - type: (_this.playState ? "pause" : "play") - }); - }); - - // Set up the seek bar... - this.seekUpdate = controlBar.find( settings.ids.seekUpdate ).css("width", 0); - this.seekProgress = controlBar.find( settings.ids.seekProgress ).css("width", 0); - this.seekBar = controlBar.find( settings.ids.seekBar ).mediaslider( settings.ids.seekHandle, false ); - if( this.seekBar ) { - this.seekBar.display.unbind("setvalue").bind( "setvalue", function( event, data ) { - _this.seekUpdate.css( "width", (data * _this.seekBar.trackSize) + "px" ); - _this.display.trigger( "controlupdate", { - type:"seek", - value:(data * _this.duration) - }); - }); - this.seekBar.display.unbind("updatevalue").bind( "updatevalue", function( event, data ) { - _this.seekUpdate.css( "width", (data * _this.seekBar.trackSize) + "px" ); - }); - } - - this.setVolume = function( vol ) { - if( this.volumeBar ) { - if( settings.volumeVertical ) { - this.volumeUpdate.css({ - "marginTop":(this.volumeBar.handlePos + this.volumeBar.handleMid), - "height":(this.volumeBar.trackSize - this.volumeBar.handlePos) - }); - } - else { - this.volumeUpdate.css( "width", (vol * this.volumeBar.trackSize) ); - } - } - }; - - // Set up the volume bar. - this.volumeUpdate = controlBar.find( settings.ids.volumeUpdate ); - this.volumeBar = controlBar.find( settings.ids.volumeBar ).mediaslider( settings.ids.volumeHandle, settings.volumeVertical, settings.volumeVertical ); - if( this.volumeBar ) { - this.volumeBar.display.unbind("setvalue").bind("setvalue", function( event, data ) { - _this.setVolume( data ); - _this.display.trigger( "controlupdate", { - type:"volume", - value:data - }); - }); - this.volumeBar.display.unbind("updatevalue").bind("updatevalue", function( event, data ) { - _this.setVolume( data ); - _this.volume = data; - }); - } - - // Setup the mute button. - this.mute = controlBar.find(settings.ids.mute).medialink( settings, function( event, target ) { - _this.muteState = !_this.muteState; - _this.setToggle( target, _this.muteState ); - _this.setMute( _this.muteState ); - }); - - this.setMute = function( state ) { - this.prevVolume = (this.volumeBar.value > 0) ? this.volumeBar.value : this.prevVolume; - this.volumeBar.updateValue( state ? 0 : this.prevVolume ); - this.display.trigger( "controlupdate", { - type:"mute", - value:state - }); - }; - - this.setProgress = function( percent ) { - if( this.seekProgress && this.seekBar ) { - this.seekProgress.css( "width", (percent * (this.seekBar.trackSize + this.seekBar.handleSize)) ); - } - }; - - this.onResize = function() { - if( this.seekBar ) { - this.seekBar.onResize(); - } - this.setProgress( this.percentLoaded ); - }; - - // Handle the media events... - this.onMediaUpdate = function( data ) { - switch( data.type ) { - case "reset": - this.reset(); - break; - case "paused": - this.playState = true; - this.setToggle( this.playPauseButton.display, this.playState ); - break; - case "playing": - this.playState = false; - this.setToggle( this.playPauseButton.display, this.playState ); - break; - case "stopped": - this.playState = true; - this.setToggle( this.playPauseButton.display, this.playState ); - break; - case "progress": - this.percentLoaded = data.percentLoaded; - this.setProgress( this.percentLoaded ); - break; - case "meta": - case "update": - this.timeUpdate( data.currentTime, data.totalTime ); - if( this.volumeBar ) { - this.volumeBar.updateValue( data.volume ); - } - break; - default: - break; - } - }; - - // Call to reset all controls... - this.reset = function() { - this.totalTime.text( this.formatTime(0).time ); - this.currentTime.text( this.formatTime(0).time ); - if( this.seekBar ) { - this.seekBar.updateValue(0); - } - this.seekUpdate.css( "width", "0px" ); - this.seekProgress.css( "width", "0px" ); - }; - - this.timeUpdate = function( cTime, tTime ) { - this.duration = tTime; - this.totalTime.text( this.formatTime( tTime ).time ); - this.currentTime.text( this.formatTime( cTime ).time ); - if( tTime && this.seekBar && !this.seekBar.dragging ) { - this.seekBar.updateValue( cTime / tTime ); - } - }; - - // Reset the time values. - this.timeUpdate( 0, 0 ); - })( this, settings ); - }; -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.dailymotion.js b/js/source/jquery.media.dailymotion.js deleted file mode 100644 index 6c158cf4..00000000 --- a/js/source/jquery.media.dailymotion.js +++ /dev/null @@ -1,270 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Called when the YouTube player is ready. - window.onDailymotionPlayerReady = function( playerId ) { - playerId = playerId.replace("_media", ""); - jQuery.media.players[playerId].node.player.media.player.onReady(); - }; - - // Tell the media player how to determine if a file path is a YouTube media type. - jQuery.media.playerTypes = jQuery.extend( jQuery.media.playerTypes, { - "dailymotion":function( file ) { - return (file.search(/^http(s)?\:\/\/(www\.)?dailymotion\.com/i) === 0); - } - }); - - jQuery.fn.mediadailymotion = function( options, onUpdate ) { - return new (function( video, options, onUpdate ) { - this.display = video; - var _this = this; - this.player = null; - this.videoFile = null; - this.meta = false; - this.loaded = false; - this.ready = false; - - this.createMedia = function( videoFile, preview ) { - this.videoFile = videoFile; - this.ready = false; - var playerId = (options.id + "_media"); - var rand = Math.floor(Math.random() * 1000000); - var flashPlayer = 'http://www.dailymotion.com/swf/' + videoFile.path + '?rand=' + rand + '&enablejsapi=1&playerapiid=' + playerId; - jQuery.media.utils.insertFlash( - this.display, - flashPlayer, - playerId, - "100%", - "100%", - {}, - options.wmode, - function( obj ) { - _this.player = obj; - _this.loadPlayer(); - } - ); - }; - - this.loadMedia = function( videoFile ) { - if( this.player ) { - this.loaded = false; - this.meta = false; - this.videoFile = videoFile; - - // Let them know the player is ready. - onUpdate( { - type:"playerready" - } ); - - // Load our video. - this.player.loadVideoById( this.videoFile.path, 0 ); - } - }; - - // Called when the player has finished loading. - this.onReady = function() { - this.ready = true; - this.loadPlayer(); - }; - - this.loadPlayer = function() { - if( this.ready && this.player ) { - // Create our callback functions. - window[options.id + 'StateChange'] = function( newState ) { - _this.onStateChange( newState ); - }; - - window[options.id + 'PlayerError'] = function( errorCode ) { - _this.onError( errorCode ); - }; - - // Add our event listeners. - this.player.addEventListener('onStateChange', options.id + 'StateChange'); - this.player.addEventListener('onError', options.id + 'PlayerError'); - - // Let them know the player is ready. - onUpdate( { - type:"playerready" - } ); - - // Load our video. - this.player.loadVideoById( this.videoFile.path, 0 ); - } - }; - - // Called when the player state changes. - this.onStateChange = function( newState ) { - var playerState = this.getPlayerState( newState ); - - // Alright... Dailymotion's status updates are just crazy... - // write some hacks to just make it work. - - if( !(!this.meta && playerState.state =="stopped") ) { - onUpdate( { - type:playerState.state, - busy:playerState.busy - } ); - } - - if( !this.loaded && playerState.state == "buffering" ) { - this.loaded = true; - onUpdate( { - type:"paused", - busy:"hide" - } ); - if( options.autostart ) { - this.playMedia(); - } - } - - if( !this.meta && playerState.state == "playing" ) { - // Set this player to meta. - this.meta = true; - - // Update our meta data. - onUpdate( { - type:"meta" - } ); - } - }; - - // Called when the player has an error. - this.onError = function( errorCode ) { - var errorText = "An unknown error has occured: " + errorCode; - if( errorCode == 100 ) { - errorText = "The requested video was not found. "; - errorText += "This occurs when a video has been removed (for any reason), "; - errorText += "or it has been marked as private."; - } else if( (errorCode == 101) || (errorCode == 150) ) { - errorText = "The video requested does not allow playback in an embedded player."; - } - onUpdate( { - type:"error", - data:errorText - } ); - }; - - // Translates the player state for the API player. - this.getPlayerState = function( playerState ) { - switch (playerState) { - case 5: - return {state:'ready', busy:false}; - case 3: - return {state:'buffering', busy:"show"}; - case 2: - return {state:'paused', busy:"hide"}; - case 1: - return {state:'playing', busy:"hide"}; - case 0: - return {state:'complete', busy:false}; - case -1: - return {state:'stopped', busy:false}; - default: - return {state:'unknown', busy:false}; - } - return 'unknown'; - }; - - /* - this.setSize = function( newWidth, newHeight ) { - this.player.setSize(newWidth, newHeight); - }; - */ - this.playMedia = function() { - onUpdate({ - type:"buffering", - busy:"show" - }); - this.player.playVideo(); - }; - - this.pauseMedia = function() { - this.player.pauseVideo(); - }; - - this.stopMedia = function() { - this.player.stopVideo(); - }; - - this.destroy = function() { - this.stopMedia(); - jQuery.media.utils.removeFlash( this.display, (options.id + "_media") ); - this.display.children().remove(); - }; - - this.seekMedia = function( pos ) { - onUpdate({ - type:"buffering", - busy:"show" - }); - this.player.seekTo( pos, true ); - }; - - this.setVolume = function( vol ) { - this.player.setVolume( vol * 100 ); - }; - - this.getVolume = function() { - return (this.player.getVolume() / 100); - }; - - this.getDuration = function() { - return this.player.getDuration(); - }; - - this.getCurrentTime = function() { - return this.player.getCurrentTime(); - }; - - this.getBytesLoaded = function() { - return this.player.getVideoBytesLoaded(); - }; - - this.getBytesTotal = function() { - return this.player.getVideoBytesTotal(); - }; - - this.getEmbedCode = function() { - return this.player.getVideoEmbedCode(); - }; - - this.getMediaLink = function() { - return this.player.getVideoUrl(); - }; - - this.hasControls = function() { - return true; - }; - this.showControls = function(show) {}; - this.setQuality = function( quality ) {}; - this.getQuality = function() { - return ""; - }; - })( this, options, onUpdate ); - }; -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.display.js b/js/source/jquery.media.display.js deleted file mode 100755 index 7bf7369b..00000000 --- a/js/source/jquery.media.display.js +++ /dev/null @@ -1,390 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - volume:80, - autostart:false, - streamer:"", - embedWidth:450, - embedHeight:337, - wmode:"transparent", - forceOverflow:false, - quality:"default", - repeat:false - }); - - jQuery.fn.mediadisplay = function( options ) { - if( this.length === 0 ) { - return null; - } - return new (function( mediaWrapper, options ) { - this.settings = jQuery.media.utils.getSettings( options ); - this.display = mediaWrapper; - var _this = this; - this.volume = -1; - this.player = null; - this.preview = ''; - this.updateInterval = null; - this.progressInterval = null; - this.playQueue = []; - this.playIndex = 0; - this.playerReady = false; - this.loaded = false; - this.mediaFile = null; - this.hasPlaylist = false; - - // If they provide the forceOverflow variable, then that means they - // wish to force the media player to override all parents overflow settings. - if( this.settings.forceOverflow ) { - // Make sure that all parents have overflow visible so that - // browser full screen will always work. - this.display.parents().css("overflow", "visible"); - } - - this.reset = function() { - this.loaded = false; - this.stopMedia(); - clearInterval( this.progressInterval ); - clearInterval( this.updateInterval ); - this.playQueue.length = 0; - this.playQueue = []; - this.playIndex = 0; - this.playerReady = false; - this.mediaFile = null; - this.display.empty().trigger( "mediaupdate", {type:"reset"} ); - }; - - // Returns the media that has the lowest weight value, which means - // this player prefers that media over the others. - this.getPlayableMedia = function( files ) { - var mFile = null; - var i = files.length; - while(i--) { - var tempFile = new jQuery.media.file( files[i], this.settings ); - if( !mFile || (tempFile.weight < mFile.weight) ) { - mFile = tempFile; - } - } - return mFile; - }; - - // Returns a valid media file for this browser. - this.getMediaFile = function( file ) { - if( file ) { - var type = typeof file; - if( ((type === 'object') || (type === 'array')) && file[0] ) { - file = this.getPlayableMedia( file ); - } - } - return file; - }; - - // Adds a media file to the play queue. - this.addToQueue = function( file ) { - if( file ) { - this.playQueue.push( this.getMediaFile( file ) ); - } - }; - - this.loadFiles = function( files ) { - if( files ) { - this.playQueue.length = 0; - this.playQueue = []; - this.playIndex = 0; - this.addToQueue( files.intro ); - this.addToQueue( files.commercial ); - this.addToQueue( files.prereel ); - this.addToQueue( files.media ); - this.addToQueue( files.postreel ); - } - var hasMedia = (this.playQueue.length > 0); - if( !hasMedia ) { - if (this.player) { - // Destroy the current player. - this.player.destroy(); - this.player = null; - } - - this.display.trigger( "mediaupdate", {type:"nomedia"} ); - } - return hasMedia; - }; - - this.playNext = function() { - if( this.playQueue.length > this.playIndex ) { - this.loadMedia( this.playQueue[this.playIndex] ); - this.playIndex++; - } - else if( this.settings.repeat ) { - this.playIndex = 0; - this.playNext(); - } - else if( this.hasPlaylist ) { - this.reset(); - } - else { - // If there is no playlist, and no repeat, we will - // just seek to the beginning and pause. - this.loaded = false; - this.settings.autostart = false; - this.playIndex = 0; - this.playNext(); - } - }; - - this.loadMedia = function( file, mediaplayer ) { - if( file ) { - // Get the media file object. - file = new jQuery.media.file( this.getMediaFile( file ), this.settings ); - - // Set the media player if they force it. - file.player = mediaplayer ? mediaplayer : file.player; - - // Stop the current player. - this.stopMedia(); - - if( !this.mediaFile || (this.mediaFile.player != file.player) ) { - // Reset our player variables. - this.player = null; - this.playerReady = false; - - // Create a new media player. - if( file.player ) { - // Set the new media player. - this.player = this.display["media" + file.player]( this.settings, function( data ) { - _this.onMediaUpdate( data ); - }); - } - - if( this.player ) { - // Create our media player. - this.player.createMedia( file, this.preview ); - } - } - else if( this.player ) { - // Load our file into the current player. - this.player.loadMedia( file ); - } - - // Save this file. - this.mediaFile = file; - - // Send out an update about the initialize. - this.onMediaUpdate({ - type:"initialize" - }); - } - }; - - this.onMediaUpdate = function( data ) { - // Now trigger the media update message. - switch( data.type ) { - case "playerready": - this.playerReady = true; - this.player.setVolume(0); - this.player.setQuality(this.settings.quality); - this.startProgress(); - break; - case "buffering": - this.startProgress(); - break; - case "stopped": - clearInterval( this.progressInterval ); - clearInterval( this.updateInterval ); - break; - case "error": - if( data.code == 4 ) { - // It is saying not supported... Try and fall back to flash... - this.loadMedia(this.mediaFile, "flash"); - } - else { - clearInterval( this.progressInterval ); - clearInterval( this.updateInterval ); - } - break; - case "paused": - clearInterval( this.updateInterval ); - break; - case "playing": - this.startUpdate(); - break; - case "progress": - var percentLoaded = this.getPercentLoaded(); - jQuery.extend( data, { - percentLoaded:percentLoaded - }); - if( percentLoaded >= 1 ) { - clearInterval( this.progressInterval ); - } - break; - case "meta": - jQuery.extend( data, { - currentTime:this.player.getCurrentTime(), - totalTime:this.getDuration(), - volume: this.player.getVolume(), - quality: this.getQuality() - }); - break; - case "durationupdate": - this.mediaFile.duration = data.duration; - break; - case "complete": - this.playNext(); - break; - default: - break; - } - - // If this is the playing state, we want to pause the video. - if( data.type=="playing" && !this.loaded ) { - if( this.settings.autoLoad && !this.settings.autostart ) { - setTimeout( function() { - _this.setVolume(); - _this.player.pauseMedia(); - _this.settings.autostart = true; - _this.loaded = true; - }, 100 ); - } - else { - this.loaded = true; - this.setVolume(); - this.display.trigger( "mediaupdate", data ); - } - } - else { - this.display.trigger( "mediaupdate", data ); - } - }; - - this.startProgress = function() { - if( this.playerReady ) { - clearInterval( this.progressInterval ); - this.progressInterval = setInterval( function() { - _this.onMediaUpdate( { - type:"progress" - } ); - }, 500 ); - } - }; - - this.startUpdate = function() { - if( this.playerReady ) { - clearInterval( this.updateInterval ); - this.updateInterval = setInterval( function() { - if( _this.playerReady ) { - _this.onMediaUpdate({ - type:"update", - currentTime:_this.player.getCurrentTime(), - totalTime:_this.getDuration(), - volume:_this.player.getVolume(), - quality:_this.getQuality() - }); - } - }, 1000 ); - } - }; - - this.stopMedia = function() { - this.loaded = false; - clearInterval( this.progressInterval ); - clearInterval( this.updateInterval ); - if( this.playerReady ) { - this.player.stopMedia(); - } - }; - - this.mute = function( on ) { - this.player.setVolume( on ? 0 : this.volume ); - }; - - this.onResize = function() { - if( this.player && this.player.onResize ) { - this.player.onResize(); - } - }; - - this.getPercentLoaded = function() { - if( this.player.getPercentLoaded ) { - return this.player.getPercentLoaded(); - } - else { - var bytesLoaded = this.player.getBytesLoaded(); - var bytesTotal = this.mediaFile.bytesTotal ? this.mediaFile.bytesTotal : this.player.getBytesTotal(); - return bytesTotal ? (bytesLoaded / bytesTotal) : 0; - } - }; - - this.showControls = function(show) { - if( this.playerReady ) { - this.player.showControls(show); - } - }; - - this.hasControls = function() { - if( this.player ) { - return this.player.hasControls(); - } - return false; - }; - - this.getDuration = function() { - if( this.mediaFile ) { - if(!this.mediaFile.duration ) { - this.mediaFile.duration = this.player.getDuration(); - } - return this.mediaFile.duration; - } - else { - return 0; - } - }; - - this.setVolume = function( vol ) { - this.volume = vol ? vol : ((this.volume == -1) ? (this.settings.volume / 100) : this.volume); - if( this.player ) { - this.player.setVolume(this.volume); - } - }; - - this.getVolume = function() { - if( !this.volume ) { - this.volume = this.player.getVolume(); - } - return this.volume; - }; - - this.getQuality = function() { - if( !this.mediaFile.quality ) { - this.mediaFile.quality = this.player.getQuality(); - } - return this.mediaFile.quality; - }; - })( this, options ); - }; -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.drupal.js b/js/source/jquery.media.drupal.js deleted file mode 100644 index 45e39687..00000000 --- a/js/source/jquery.media.drupal.js +++ /dev/null @@ -1,166 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - apiKey:"", - api:2, - sessid:"", - drupalVersion:6 - }); - - // Extend the media namespace - jQuery.media = jQuery.extend( {}, { - // Add the drupal server object. - drupal : function( protocol, settings ) { - // Return a new server object. - return new (function( protocol, settings ) { - settings = jQuery.media.utils.getSettings(settings); - var _this = this; - - var hasKey = (settings.apiKey.length > 0); - var usesKey = (settings.api == 1); - var nodeGet = (settings.drupalVersion >= 6) ? "node.get" : "node.load"; - var autoProtocol = (settings.protocol == "auto"); - - // Set up the commands. - jQuery.media = jQuery.extend( {}, { - commands : { - connect:{command:{rpc:"system.connect", json:""}, useKey:usesKey, protocol:"rpc"}, - mail:{command:{rpc:"system.mail", json:""}, useKey:hasKey, protocol:"rpc"}, - loadNode:{command:{rpc:nodeGet, json:"mediafront_getnode"}, useKey:usesKey, protocol:"json"}, - getPlaylist:{command:{rpc:"mediafront.getPlaylist", json:"mediafront_getplaylist"}, useKey:usesKey, protocol:"json"}, - getVote:{command:{rpc:"vote.getVote", json:""}, useKey:usesKey, protocol:"rpc"}, - setVote:{command:{rpc:"vote.setVote", json:""}, useKey:hasKey, protocol:"rpc"}, - getUserVote:{command:{rpc:"vote.getUserVote", json:""}, useKey:usesKey, protocol:"rpc"}, - deleteVote:{command:{rpc:"vote.deleteVote", json:""}, useKey:hasKey, protocol:"rpc"}, - addTag:{command:{rpc:"tag.addTag", json:""}, useKey:hasKey, protocol:"rpc"}, - incrementCounter:{command:{rpc:"mediafront.incrementNodeCounter", json:""}, useKey:hasKey, protocol:"rpc"}, - setFavorite:{command:{rpc:"favorites.setFavorite", json:""}, useKey:hasKey, protocol:"rpc"}, - deleteFavorite:{command:{rpc:"favorites.deleteFavorite", json:""}, useKey:hasKey, protocol:"rpc"}, - isFavorite:{command:{rpc:"favorites.isFavorite", json:""}, useKey:usesKey, protocol:"rpc"}, - login:{command:{rpc:"user.login", json:""}, useKey:hasKey, protocol:"rpc"}, - logout:{command:{rpc:"user.logout", json:""}, useKey:hasKey, protocol:"rpc"}, - adClick:{command:{rpc:"mediafront.adClick", json:""}, useKey:hasKey, protocol:"rpc"}, - getAd:{command:{rpc:"mediafront.getAd", json:""}, useKey:usesKey, protocol:"rpc"}, - setUserStatus:{command:{rpc:"mediafront.setUserStatus", json:""}, useKey:hasKey, protocol:"rpc"} - } - }, jQuery.media); - - // Public variables. - this.user = {}; - this.sessionId = ""; - this.onConnected = null; - this.encoder = new jQuery.media.sha256(); - - // Cache this... it is a little processor intensive. - // The baseURL has an ending "/". We need to truncate this, and then remove the "http://" - this.baseURL = settings.baseURL.substring(0,(settings.baseURL.length - 1)).replace(/^(http[s]?\:[\\\/][\\\/])/,''); - - this.connect = function( onSuccess ) { - this.onConnected = onSuccess; - // If they provide the session Id, then we can skip this call. - if( settings.sessid ) { - this.onConnect({ - sessid:settings.sessid - }); - } - else { - this.call( jQuery.media.commands.connect, function( result ) { - _this.onConnect( result ); - }, null ); - } - }; - - this.call = function( command, onSuccess, onFailed ) { - var args = []; - for (var i=3; i 1 ) { - var timestamp = this.getTimeStamp(); - var nonce = this.getNonce(); - var hash = this.computeHMAC( timestamp, this.baseURL, nonce, command.command.rpc, settings.apiKey); - args.unshift( nonce ); - args.unshift( timestamp ); - args.unshift( this.baseURL ); - args.unshift( hash ); - } - else { - args.unshift( settings.apiKey ); - } - } - return args; - }; - - this.getTimeStamp = function() { - return (parseInt(new Date().getTime() / 1000, 10)).toString(); - }; - - this.getNonce = function() { - var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"; - var randomString = ''; - for (var i=0; i<10; i++) { - var rnum = Math.floor(Math.random() * chars.length); - randomString += chars.substring(rnum,rnum+1); - } - return randomString; - }; - - this.computeHMAC = function( timestamp, baseURL, nonce, command, apiKey ) { - var input = timestamp + ";" + baseURL + ";" + nonce + ";" + command; - return this.encoder.encrypt( apiKey, input ); - }; - - this.onConnect = function( result ) { - if( result ) { - this.sessionId = result.sessid; - this.user = result.user; - } - if( this.onConnected ) { - this.onConnected( result ); - } - }; - })( protocol, settings ); - } - }, jQuery.media ); -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.file.js b/js/source/jquery.media.file.js deleted file mode 100755 index 9025e4d1..00000000 --- a/js/source/jquery.media.file.js +++ /dev/null @@ -1,207 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Checks the file type for browser compatibilty. - jQuery.media.checkPlayType = function( elem, playType ) { - if( (typeof elem.canPlayType) == 'function' ) { - return ("no" !== elem.canPlayType(playType)) && ("" !== elem.canPlayType(playType)); - } - else { - return false; - } - }; - - // Get's all of the types that this browser can play. - jQuery.media.getPlayTypes = function() { - var types = {}; - - // Check for video types... - var elem = document.createElement("video"); - types.ogg = jQuery.media.checkPlayType( elem, 'video/ogg; codecs="theora, vorbis"'); - types.h264 = jQuery.media.checkPlayType( elem, 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'); - types.webm = jQuery.media.checkPlayType( elem, 'video/webm; codecs="vp8, vorbis"'); - - // Now check for audio types... - elem = document.createElement("audio"); - types.audioOgg = jQuery.media.checkPlayType( elem, "audio/ogg"); - types.mp3 = jQuery.media.checkPlayType( elem, "audio/mpeg"); - - return types; - }; - - // The play types for the media player. - jQuery.media.playTypes = null; - - // The constructor for our media file object. - jQuery.media.file = function( file, settings ) { - // Only set the play types if it has not already been set. - if( !jQuery.media.playTypes ) { - jQuery.media.playTypes = jQuery.media.getPlayTypes(); - } - - // Normalize the file object passed to this constructor. - file = (typeof file === "string") ? { - path:file - } : file; - - // The duration of the media file. - this.duration = file.duration ? file.duration : 0; - this.bytesTotal = file.bytesTotal ? file.bytesTotal : 0; - this.quality = file.quality ? file.quality : 0; - this.stream = settings.streamer ? settings.streamer : file.stream; - this.path = file.path ? jQuery.trim(file.path) : ( settings.baseURL + jQuery.trim(file.filepath) ); - this.extension = file.extension ? file.extension : this.getFileExtension(); - this.weight = file.weight ? file.weight : this.getWeight(); - this.player = file.player ? file.player : this.getPlayer(); - this.mimetype = file.mimetype ? file.mimetype : this.getMimeType(); - this.type = file.type ? file.type : this.getType(); - }; - - // Get the file extension. - jQuery.media.file.prototype.getFileExtension = function() { - return this.path.substring(this.path.lastIndexOf(".") + 1).toLowerCase(); - }; - - // Get the player for this media. - jQuery.media.file.prototype.getPlayer = function() { - switch( this.extension ) - { - case "ogg":case "ogv": - return jQuery.media.playTypes.ogg ? "html5" : "flash"; - - case "mp4":case "m4v": - return jQuery.media.playTypes.h264 ? "html5" : "flash"; - - case "webm": - return jQuery.media.playTypes.webm ? "html5" : "flash"; - - case "oga": - return jQuery.media.playTypes.audioOgg ? "html5" : "flash"; - - case "mp3": - return jQuery.media.playTypes.mp3 ? "html5" : "flash"; - - case "swf":case "flv":case "f4v":case "f4a": - case "mov":case "3g2":case "3gp":case "3gpp": - case "m4a":case "aac":case "wav":case "aif": - case "wma": - return "flash"; - - default: - // Now iterate through all of our registered players. - for( var player in jQuery.media.playerTypes ) { - if( jQuery.media.playerTypes.hasOwnProperty( player ) ) { - if( jQuery.media.playerTypes[player]( this.path ) ) { - return player; - } - } - } - break; - } - return "flash"; - }; - - // Get the type of media this is... - jQuery.media.file.prototype.getType = function() { - switch( this.extension ) { - case"swf":case "webm":case "ogg":case "ogv": - case "mp4":case "m4v":case "flv":case "f4v": - case "mov":case "3g2":case "3gp":case "3gpp": - return "video"; - case "oga":case "mp3":case "f4a":case "m4a": - case "aac":case "wav":case "aif":case "wma": - return "audio"; - default: - break; - } - return ''; - }; - - // Get the preference "weight" of this media type. - // The lower the number, the higher the preference. - jQuery.media.file.prototype.getWeight = function() { - switch( this.extension ) { - case 'mp4':case 'm4v':case 'm4a': - return jQuery.media.playTypes.h264 ? 3 : 7; - case'webm': - return jQuery.media.playTypes.webm ? 4 : 8; - case 'ogg':case 'ogv': - return jQuery.media.playTypes.ogg ? 5 : 20; - case 'oga': - return jQuery.media.playTypes.audioOgg ? 5 : 20; - case 'mp3': - return 6; - case 'mov':case'swf':case 'flv':case 'f4v': - case 'f4a':case '3g2':case '3gp':case '3gpp': - return 9; - case 'wav':case 'aif':case 'aac': - return 10; - case 'wma': - return 11; - default: - break; - } - return 0; - }; - - // Return the best guess mime type for the given file. - jQuery.media.file.prototype.getMimeType = function() { - switch( this.extension ) { - case 'mp4':case 'm4v':case 'flv':case 'f4v': - return 'video/mp4'; - case'webm': - return 'video/x-webm'; - case 'ogg':case 'ogv': - return 'video/ogg'; - case '3g2': - return 'video/3gpp2'; - case '3gpp': - case '3gp': - return 'video/3gpp'; - case 'mov': - return 'video/quicktime'; - case'swf': - return 'application/x-shockwave-flash'; - case 'oga': - return 'audio/ogg'; - case 'mp3': - return 'audio/mpeg'; - case 'm4a':case 'f4a': - return 'audio/mp4'; - case 'aac': - return 'audio/aac'; - case 'wav': - return 'audio/vnd.wave'; - case 'wma': - return 'audio/x-ms-wma'; - default: - break; - } - return ''; - }; -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.flash.js b/js/source/jquery.media.flash.js deleted file mode 100755 index 07631810..00000000 --- a/js/source/jquery.media.flash.js +++ /dev/null @@ -1,248 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - window.onFlashPlayerReady = function( id ) { - jQuery.media.players[id].node.player.media.player.onReady(); - }; - - window.onFlashPlayerUpdate = function( id, eventType ) { - jQuery.media.players[id].node.player.media.player.onMediaUpdate( eventType ); - }; - - window.onFlashPlayerDebug = function( debug ) { - if( window.console && console.log ) { - console.log( debug ); - } - }; - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - flashPlayer:"./flash/mediafront.swf", - skin:"default", - config:"nocontrols" - }); - - jQuery.fn.mediaflash = function( settings, onUpdate ) { - return new (function( video, settings, onUpdate ) { - settings = jQuery.media.utils.getSettings( settings ); - this.display = video; - var _this = this; - this.player = null; - this.mediaFile = null; - this.preview = ''; - this.ready = false; - - // Translate the messages. - this.translate = { - "mediaConnected":"connected", - "mediaBuffering":"buffering", - "mediaPaused":"paused", - "mediaPlaying":"playing", - "mediaStopped":"stopped", - "mediaComplete":"complete", - "mediaMeta":"meta" - }; - - // When to show the busy cursor. - this.busy = { - "mediaConnected":false, - "mediaBuffering":"show", - "mediaPaused":"hide", - "mediaPlaying":"hide", - "mediaStopped":false, - "mediaComplete":false, - "mediaMeta":false - }; - - this.createMedia = function( mediaFile, preview ) { - this.mediaFile = mediaFile; - this.preview = preview; - this.ready = false; - var playerId = (settings.id + "_media"); - var rand = Math.floor(Math.random() * 1000000); - var flashPlayer = settings.flashPlayer + "?rand=" + rand; - var flashvars = { - config:settings.config, - id:settings.id, - file:mediaFile.path, - image:this.preview, - skin:settings.skin, - autostart:(settings.autostart || !settings.autoLoad) - }; - if( mediaFile.stream ) { - flashvars.stream = mediaFile.stream; - } - if( settings.debug ) { - flashvars.debug = "1"; - } - jQuery.media.utils.insertFlash( - this.display, - flashPlayer, - playerId, - "100%", - "100%", - flashvars, - settings.wmode, - function( obj ) { - _this.player = obj; - _this.loadPlayer(); - } - ); - }; - - this.loadMedia = function( mediaFile ) { - if( this.player && this.ready ) { - this.mediaFile = mediaFile; - - // Load the new media file into the Flash player. - this.player.loadMedia( mediaFile.path, mediaFile.stream ); - - // Let them know the player is ready. - onUpdate( { - type:"playerready" - } ); - } - }; - - this.onReady = function() { - this.ready = true; - this.loadPlayer(); - }; - - this.loadPlayer = function() { - if( this.ready && this.player ) { - onUpdate( { - type:"playerready" - } ); - } - }; - - this.onMediaUpdate = function( eventType ) { - onUpdate( { - type:this.translate[eventType], - busy:this.busy[eventType] - }); - }; - - this.playMedia = function() { - if( this.player && this.ready ) { - this.player.playMedia(); - } - }; - - this.pauseMedia = function() { - if( this.player && this.ready ) { - this.player.pauseMedia(); - } - }; - - this.stopMedia = function() { - if( this.player && this.ready ) { - this.player.stopMedia(); - } - }; - - this.destroy = function() { - this.stopMedia(); - jQuery.media.utils.removeFlash( this.display, (settings.id + "_media") ); - this.display.children().remove(); - }; - - this.seekMedia = function( pos ) { - if( this.player && this.ready ) { - this.player.seekMedia( pos ); - } - }; - - this.setVolume = function( vol ) { - if( this.player && this.ready ) { - this.player.setVolume( vol ); - } - }; - - this.getVolume = function() { - return (this.player && this.ready) ? this.player.getVolume() : 0; - }; - - this.getDuration = function() { - return (this.player && this.ready) ? this.player.getDuration() : 0; - }; - - this.getCurrentTime = function() { - return (this.player && this.ready) ? this.player.getCurrentTime() : 0; - }; - - this.getBytesLoaded = function() { - return (this.player && this.ready) ? this.player.getMediaBytesLoaded() : 0; - }; - - this.getBytesTotal = function() { - return (this.player && this.ready) ? this.player.getMediaBytesTotal() : 0; - }; - - this.hasControls = function() { - return true; - }; - - this.showControls = function(show) { - if( this.player && this.ready ) { - this.player.showPlugin("controlBar", show); - this.player.showPlugin("playLoader", show); - } - }; - - this.getEmbedCode = function() { - var flashVars = { - config:"config", - id:"mediafront_player", - file:this.mediaFile.path, - image:this.preview, - skin:settings.skin - }; - if( this.mediaFile.stream ) { - flashVars.stream = this.mediaFile.stream; - } - return jQuery.media.utils.getFlash( - settings.flashPlayer, - "mediafront_player", - settings.embedWidth, - settings.embedHeight, - flashVars, - settings.wmode ); - }; - - // Not implemented yet... - this.setQuality = function( quality ) {}; - this.getQuality = function() { - return ""; - }; - //this.setSize = function( newWidth, newHeight ) {}; - this.getMediaLink = function() { - return "This video currently does not have a link."; - }; - })( this, settings, onUpdate ); - }; -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.html5.js b/js/source/jquery.media.html5.js deleted file mode 100755 index d1d1c4c9..00000000 --- a/js/source/jquery.media.html5.js +++ /dev/null @@ -1,343 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.fn.mediahtml5 = function( options, onUpdate ) { - return new (function( media, options, onUpdate ) { - this.display = media; - var _this = this; - this.player = null; - this.bytesLoaded = 0; - this.bytesTotal = 0; - this.mediaType = ""; - this.loaded = false; - this.mediaFile = null; - this.playerElement = null; - - this.getPlayer = function( mediaFile, preview ) { - this.mediaFile = mediaFile; - var playerId = options.id + '_' + this.mediaType; - var html = '<' + this.mediaType + ' style="position:absolute" id="' + playerId + '"'; - html += preview ? ' poster="' + preview + '"' : ''; - - if( typeof mediaFile === 'array' ) { - html += '>'; - var i = mediaFile.length; - while(i) { - i--; - html += ''; - } - } - else { - html += ' src="' + mediaFile.path + '">Unable to display media.'; - } - - html += ''; - this.display.append( html ); - this.bytesTotal = mediaFile.bytesTotal; - this.playerElement = this.display.find('#' + playerId); - this.onResize(); - - // return the player object. - return this.playerElement.eq(0)[0]; - }; - - // Create a new HTML5 player. - this.createMedia = function( mediaFile, preview ) { - // Remove any previous Flash players. - jQuery.media.utils.removeFlash( this.display, options.id + "_media" ); - this.display.children().remove(); - this.mediaType = this.getMediaType( mediaFile ); - this.player = this.getPlayer( mediaFile, preview ); - this.loaded = false; - var timeupdated = false; - if( this.player ) { - this.player.addEventListener( "abort", function() { - onUpdate( { - type:"stopped" - } ); - }, true); - this.player.addEventListener( "loadstart", function() { - onUpdate( { - type:"ready", - busy:"show" - }); - - _this.onReady(); - }, true); - this.player.addEventListener( "loadeddata", function() { - onUpdate( { - type:"loaded", - busy:"hide" - }); - }, true); - this.player.addEventListener( "loadedmetadata", function() { - onUpdate( { - type:"meta" - } ); - }, true); - this.player.addEventListener( "canplaythrough", function() { - onUpdate( { - type:"canplay", - busy:"hide" - }); - }, true); - this.player.addEventListener( "ended", function() { - onUpdate( { - type:"complete" - } ); - }, true); - this.player.addEventListener( "pause", function() { - onUpdate( { - type:"paused" - } ); - }, true); - this.player.addEventListener( "play", function() { - onUpdate( { - type:"playing" - } ); - }, true); - this.player.addEventListener( "playing", function() { - onUpdate( { - type:"playing", - busy:"hide" - }); - }, true); - this.player.addEventListener( "error", function(e) { - _this.onError(e.target.error); - onUpdate( { - type:"error", - code:e.target.error.code - } ); - }, true); - this.player.addEventListener( "waiting", function() { - onUpdate( { - type:"waiting", - busy:"show" - }); - }, true); - this.player.addEventListener( "timeupdate", function() { - if( timeupdated ) { - onUpdate( { - type:"timeupdate", - busy:"hide" - }); - } - else { - timeupdated = true; - } - }, true); - this.player.addEventListener( "durationchange", function() { - if( this.duration && (this.duration !== Infinity) ) { - onUpdate( { - type:"durationupdate", - duration:this.duration - }); - } - }, true); - - // Now add the event for getting the progress indication. - this.player.addEventListener( "progress", function( event ) { - _this.bytesLoaded = event.loaded; - _this.bytesTotal = event.total; - }, true); - - this.player.autoplay = true; - - if (typeof this.player.hasAttribute == "function" && this.player.hasAttribute("preload") && this.player.preload != "none") { - this.player.autobuffer = true; - } else { - this.player.autobuffer = false; - this.player.preload = "none"; - } - - onUpdate({ - type:"playerready" - }); - } - }; - - // A function to be called when an error occurs. - this.onError = function( error ) { - switch(error.code) { - case 1: - console.log("Error: MEDIA_ERR_ABORTED"); - break; - case 2: - console.log("Error: MEDIA_ERR_DECODE"); - break; - case 3: - console.log("Error: MEDIA_ERR_NETWORK"); - break; - case 4: - console.log("Error: MEDIA_ERR_SRC_NOT_SUPPORTED"); - break; - default: - break; - } - }; - - // Called when the media has started loading. - this.onReady = function() { - if( !this.loaded ) { - this.loaded = true; - this.playMedia(); - } - }; - - // Load new media into the HTML5 player. - this.loadMedia = function( mediaFile ) { - this.mediaFile = mediaFile; - this.createMedia( mediaFile ); - }; - - this.getMediaType = function( mediaFile ) { - var extension = (typeof mediaFile === 'array') ? mediaFile[0].extension : mediaFile.extension; - switch( extension ) { - case "ogg": case "ogv": case "mp4": case "m4v": - return "video"; - - case "oga": case "mp3": - return "audio"; - - default: - break; - } - return "video"; - }; - - this.playMedia = function() { - if( this.player && this.player.play ) { - this.player.play(); - } - }; - - this.pauseMedia = function() { - if( this.player && this.player.pause ) { - this.player.pause(); - } - }; - - this.stopMedia = function() { - this.pauseMedia(); - if( this.player ) { - this.player.src = ""; - } - }; - - this.destroy = function() { - this.stopMedia(); - this.display.children().remove(); - }; - - this.seekMedia = function( pos ) { - if( this.player ) { - this.player.currentTime = pos; - } - }; - - this.setVolume = function( vol ) { - if( this.player ) { - this.player.volume = vol; - } - }; - - this.getVolume = function() { - return this.player ? this.player.volume : 0; - }; - - this.getDuration = function() { - var dur = this.player ? this.player.duration : 0; - return (dur === Infinity) ? 0 : dur; - }; - - this.getCurrentTime = function() { - return this.player ? this.player.currentTime : 0; - }; - - this.getPercentLoaded = function() { - if( this.player && this.player.buffered && this.player.duration ) { - return (this.player.buffered.end(0) / this.player.duration); - } - else if( this.bytesTotal ) { - return (this.bytesLoaded / this.bytesTotal); - } - else { - return 0; - } - }; - - // Called when the player resizes. - this.onResize = function() { - // If this is a video, set the width and height of the video element. - if( this.mediaType == "video" ) { - this.playerElement.css({width:this.display.width(), height:this.display.height()}); - } - }; - - // Not implemented yet... - this.setQuality = function( quality ) {}; - this.getQuality = function() { - return ""; - }; - this.hasControls = function() { - return false; - }; - this.showControls = function(show) {}; - //this.setSize = function( newWidth, newHeight ) {}; - this.getEmbedCode = function() { - - // Only return the Flash embed if this is a Flash playable media field. - if( (this.mediaFile.extension == 'mp4') || - (this.mediaFile.extension == 'm4v') || - (this.mediaFile.extension == 'webm') ) { - var flashVars = { - config:"config", - id:"mediafront_player", - file:this.mediaFile.path, - image:this.preview, - skin:options.skin - }; - if( this.mediaFile.stream ) { - flashVars.stream = this.mediaFile.stream; - } - return jQuery.media.utils.getFlash( - options.flashPlayer, - "mediafront_player", - options.embedWidth, - options.embedHeight, - flashVars, - options.wmode ); - } - else { - return "This media does not support embedding."; - } - }; - this.getMediaLink = function() { - return "This media currently does not have a link."; - }; - })( this, options, onUpdate ); - }; -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.image.js b/js/source/jquery.media.image.js deleted file mode 100644 index b456eba1..00000000 --- a/js/source/jquery.media.image.js +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - /** - * Load and scale an image while maintining original aspect ratio. - */ - jQuery.fn.mediaimage = function( link, fitToImage ) { - if( this.length === 0 ) { - return null; - } - return new (function( container, link, fitToImage ) { - this.display = container; - var _this = this; - - var ratio = 0; - var imageLoaded = false; - - // Now create the image loader, and add the loaded handler. - this.imgLoader = new Image(); - this.imgLoader.onload = function() { - imageLoaded = true; - ratio = (_this.imgLoader.width / _this.imgLoader.height); - _this.resize(); - _this.display.trigger( "imageLoaded" ); - }; - - // Set the container to not show any overflow... - container.css("overflow", "hidden"); - - // Check to see if this image is completely loaded. - this.loaded = function() { - return this.imgLoader.complete; - }; - - // Resize the image. - this.resize = function( newWidth, newHeight ) { - var rectWidth = fitToImage ? this.imgLoader.width : (newWidth ? newWidth : this.display.width()); - var rectHeight = fitToImage ? this.imgLoader.height : (newHeight ? newHeight : this.display.height()); - if( rectWidth && rectHeight && imageLoaded ) { - // Now resize the image in the container... - var rect = jQuery.media.utils.getScaledRect( ratio, { - width:rectWidth, - height:rectHeight - }); - - // Now set this image to the new size. - if( this.image ) { - this.image.attr( "src", this.imgLoader.src ).css({ - marginLeft:rect.x, - marginTop:rect.y, - width:rect.width, - height:rect.height - }); - } - - // Show the container. - this.image.fadeIn(); - } - }; - - // Clears the image. - this.clear = function() { - imageLoaded = false; - if( this.image ) { - this.image.attr("src", ""); - this.imgLoader.src = ''; - this.image.fadeOut( function() { - if( link ) { - $(this).parent().remove(); - } - else { - $(this).remove(); - } - }); - } - }; - - // Refreshes the image. - this.refresh = function() { - this.resize(); - }; - - // Load the image. - this.loadImage = function( src ) { - // Now add the image object. - this.clear(); - this.image = $(document.createElement('img')).attr({ - src:"" - }).hide(); - if( link ) { - this.display.append($(document.createElement('a')).attr({ - target:"_blank", - href:link - }).append(this.image)); - } - else { - this.display.append(this.image); - } - this.imgLoader.src = src; - }; - })( this, link, fitToImage ); - }; -})(jQuery); diff --git a/js/source/jquery.media.json.js b/js/source/jquery.media.json.js deleted file mode 100755 index b2b75c45..00000000 --- a/js/source/jquery.media.json.js +++ /dev/null @@ -1,166 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Extend the media namespace - jQuery.media = jQuery.extend( {}, { - // Add the json server object. - json : function( settings ) { - // Return a new function for this object - return new (function( settings ) { - var _this = this; - - // ************************************************ - // This code is from http://kelpi.com/script/a85cbb - // ************************************************ - - // A character conversion map - var m = { - '\b':'\\b', - '\t':'\\t', - '\n':'\\n', - '\f':'\\f', - '\r':'\\r', - '"':'\\"', - '\\':'\\\\' - }; - - // Map type names to functions for serializing those types - var s = { - 'boolean': function (x) { - return String(x); - }, - 'null': function (x) { - return "null"; - }, - number: function (x) { - return isFinite(x) ? String(x) : 'null'; - }, - string: function (x) { - if (/["\\\x00-\x1f]/.test(x)) { - x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) { - var c = m[b]; - if (c) { - return c; - } - c = b.charCodeAt(); - return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16); - }); - } - return '"' + x + '"'; - }, - array: function (x) { - var a = ['['], b, f, i, l = x.length, v; - for (i = 0; i < l; i += 1) { - v = x[i]; - f = s[typeof v]; - if (f) { - v = f(v); - if (typeof v == 'string') { - if (b) { - a[a.length] = ','; - } - a[a.length] = v; - b = true; - } - } - } - a[a.length] = ']'; - return a.join(''); - }, - object: function (x) { - if (x) { - if (x instanceof Array) { - return s.array(x); - } - var a = ['{'], b, f, i, v; - for( i in x ) { - if( x.hasOwnProperty(i) ) { - v = x[i]; - f = s[typeof v]; - if(f) { - v = f(v); - if (typeof v == 'string') { - if (b) { - a[a.length] = ','; - } - a.push(s.string(i), ':', v); - b = true; - } - } - } - } - a[a.length] = '}'; - return a.join(''); - } - return 'null'; - } - }; - - // Public function to serialize any object to JSON format. - this.serializeToJSON = function( o ) { - return s.object(o); - }; - - //************************************************ - // End of code from http://kelpi.com/script/a85cbb - //************************************************ - - this.call = function( method, onSuccess, onFailed, params, protocol ) { - if( settings.baseURL ) { - // Add json functionality here. - jQuery.ajax({ - "url": settings.baseURL + method, - "dataType": "json", - "type": "POST", - "data": { - methodName:method, - params:this.serializeToJSON(params) - }, - "error": function( XMLHttpRequest, textStatus, errorThrown ) { - if( onFailed ) { - onFailed( textStatus ); - } - else if( window.console && console.log ) { - console.log( "Error: " + textStatus ); - } - }, - "success": function( data ) { - if( onSuccess ) { - onSuccess( data ); - } - } - }); - } - else if( onSuccess ) { - onSuccess( null ); - } - }; - })( settings ); - } - }, jQuery.media ); -})(jQuery); diff --git a/js/source/jquery.media.link.js b/js/source/jquery.media.link.js deleted file mode 100644 index 5edbe78d..00000000 --- a/js/source/jquery.media.link.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.fn.medialink = function( settings, onClick, data ) { - data = data ? data : { - noargs:true - }; - return new (function( link, settings, onClick, data ) { - var _this = this; - this.display = link; - - this.display.css("cursor", "pointer").unbind("click").bind( "click", data, function( event ) { - onClick( event, $(this) ); - }).unbind("mouseenter").bind("mouseenter", function() { - if( settings.template.onLinkOver ) { - settings.template.onLinkOver( $(this) ); - } - }).unbind("mouseleave").bind("mouseleave", function() { - if( settings.template.onLinkOut ) { - settings.template.onLinkOut( $(this) ); - } - }); - })( this, settings, onClick, data ); - }; -})(jQuery); diff --git a/js/source/jquery.media.links.js b/js/source/jquery.media.links.js deleted file mode 100644 index 42b2cf10..00000000 --- a/js/source/jquery.media.links.js +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - links:[], - linksvertical:false - }); - - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - linkScroll:"#medialinkscroll" - }); - - jQuery.fn.medialinks = function( settings ) { - return new (function( links, settings ) { - - // Get our settings. - settings = jQuery.media.utils.getSettings(settings); - - // Save the jQuery display. - this.display = links; - var _this = this; - - // Keep track of the previous link. - this.previousLink = null; - - // Setup the scroll region - this.scrollRegion = links.find( settings.ids.linkScroll ).mediascroll({ - vertical:settings.linksvertical - }); - this.scrollRegion.clear(); - - // Load the links. - this.loadLinks = function() { - if( links.length > 0 ) { - this.scrollRegion.clear(); - var onLinkClick = function( event, data ) { - _this.setLink( data ); - }; - - var i = settings.links.length; - while(i) { - i--; - // Add this link to the scroll region. - var link = this.scrollRegion.newItem().playlistlink( settings, settings.links[i] ); - link.unbind("linkclick").bind("linkclick", onLinkClick); - } - // Activate the scroll region. - this.scrollRegion.activate(); - } - }; - - // Set the active link. - this.setLink = function( link ) { - - // If there is a previous link, then unactivate it. - if( this.previousLink ) { - this.previousLink.setActive(false); - } - - // Add the active class to the clicked target. - link.setActive(true); - - // Store this target for later. - this.previousLink = link; - }; - })( this, settings ); - }; -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.menu.js b/js/source/jquery.media.menu.js deleted file mode 100644 index c0d5e616..00000000 --- a/js/source/jquery.media.menu.js +++ /dev/null @@ -1,124 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Set up our defaults for this component. - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - close:"#mediamenuclose", - embed:"#mediaembed", - elink:"#mediaelink", - email:"#mediaemail" - }); - - jQuery.fn.mediamenu = function( server, settings ) { - if( this.length === 0 ) { - return null; - } - return new (function( server, menu, settings ) { - settings = jQuery.media.utils.getSettings(settings); - var _this = this; - this.display = menu; - - this.on = false; - - this.contents = []; - this.prevItem = { - id:0, - link:null, - contents:null - }; - - this.close = this.display.find( settings.ids.close ); - this.close.unbind("click").bind( "click", function() { - _this.display.trigger( "menuclose" ); - }); - - this.setMenuItem = function( link, itemId ) { - if( this.prevItem.id != itemId ) { - if( this.prevItem.id && settings.template.onMenuSelect ) { - settings.template.onMenuSelect( this.prevItem.link, this.prevItem.contents, false ); - } - - var contents = this.contents[itemId]; - - if( settings.template.onMenuSelect ) { - settings.template.onMenuSelect( link, contents, true ); - } - - this.prevItem = { - id:itemId, - link:link, - contents:contents - }; - } - }; - - this.setEmbedCode = function( embed ) { - this.setInputItem( settings.ids.embed, embed ); - }; - - - this.setMediaLink = function( mediaLink ) { - this.setInputItem( settings.ids.elink , mediaLink ); - }; - - this.setInputItem = function( id, value ) { - var input = this.contents[id].find("input"); - input.unbind("click").bind("click", function() { - $(this).select().focus(); - }); - input.attr("value", value ); - }; - - var linkIndex = 0; - this.links = this.display.find("a"); - this.links.each( function() { - var link = $(this); - if( link.length > 0 ) { - var linkId = link.attr("href"); - var contents = _this.display.find(linkId); - contents.hide(); - _this.contents[linkId] = contents; - link.unbind("click").bind("click", { - id:linkId, - obj:link.parent() - }, function( event ) { - event.preventDefault(); - _this.setMenuItem( event.data.obj, event.data.id ); - }); - - if( linkIndex === 0 ) { - _this.setMenuItem( link.parent(), linkId ); - } - linkIndex++; - } - }); - - - })( server, this, settings ); - }; -})(jQuery); diff --git a/js/source/jquery.media.minplayer.js b/js/source/jquery.media.minplayer.js deleted file mode 100755 index f55ba5cf..00000000 --- a/js/source/jquery.media.minplayer.js +++ /dev/null @@ -1,442 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - logo:"logo.png", - logoWidth:49, - logoHeight:15, - logopos:"sw", - logox:5, - logoy:5, - link:"http://www.mediafront.org", - file:"", - image:"", - timeout:8, - autoLoad:true - }); - - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - busy:"#mediabusy", - preview:"#mediapreview", - play:"#mediaplay", - media:"#mediadisplay" - }); - - jQuery.fn.minplayer = function( settings ) { - if( this.length === 0 ) { - return null; - } - return new (function( player, settings ) { - // Get the settings. - settings = jQuery.media.utils.getSettings(settings); - - // Save the jQuery display. - this.display = player; - var _this = this; - - // If the player should auto load or not. - this.autoLoad = settings.autoLoad; - - // Store the busy cursor and data. - this.busy = player.find( settings.ids.busy ); - this.busyImg = this.busy.find("img"); - this.busyWidth = this.busyImg.width(); - this.busyHeight = this.busyImg.height(); - - // Store the play overlay. - this.play = player.find( settings.ids.play ); - // Toggle the play/pause state if they click on the play button. - this.play.unbind("click").bind("click", function() { - _this.togglePlayPause(); - }); - this.playImg = this.play.find("img"); - this.playWidth = this.playImg.width(); - this.playHeight = this.playImg.height(); - - // Store the preview image. - this.preview = player.find( settings.ids.preview ).mediaimage(); - if( this.preview ) { - this.preview.display.unbind("click").bind("click", function() { - _this.onMediaClick(); - }); - - this.preview.display.unbind("imageLoaded").bind("imageLoaded", function() { - _this.onPreviewLoaded(); - }); - } - - // The internal player controls. - this.usePlayerControls = false; - this.busyFlags = 0; - this.busyVisible = false; - this.playVisible = false; - this.previewVisible = false; - this.playing = false; - this.hasMedia = false; - this.timeoutId = 0; - - // Cache the width and height. - this.width = this.display.width(); - this.height = this.display.height(); - - // Hide or show an element. - this.showElement = function( element, show, tween ) { - if( element && !this.usePlayerControls ) { - if( show ) { - element.show(tween); - } - else { - element.hide(tween); - } - } - }; - - this.showPlay = function( show, tween ) { - show &= this.hasMedia; - this.playVisible = show; - this.showElement( this.play, show, tween ); - }; - - this.showBusy = function( id, show, tween ) { - if( show ) { - this.busyFlags |= (1 << id); - } - else { - this.busyFlags &= ~(1 << id); - } - - // Set the busy cursor visiblility. - this.busyVisible = (this.busyFlags > 0); - this.showElement( this.busy, this.busyVisible, tween ); - - // If the media has finished loading, then we don't need the - // loader for the image. - if (id==1 && !show) { - this.showBusy(3, false); - } - }; - - this.showPreview = function( show, tween ) { - this.previewVisible = show; - if( this.preview ) { - this.showElement( this.preview.display, show, tween ); - } - }; - - // Handle the control events. - this.onControlUpdate = function( data ) { - if( this.media ) { - // If the player is ready. - if( this.media.playerReady ) { - switch( data.type ) { - case "play": - this.media.player.playMedia(); - break; - case "pause": - this.media.player.pauseMedia(); - break; - case "seek": - this.media.player.seekMedia( data.value ); - break; - case "volume": - this.media.setVolume( data.value ); - break; - case "mute": - this.media.mute( data.value ); - break; - default: - break; - } - } - // If there are files in the queue but no current media file. - else if( (this.media.playQueue.length > 0) && !this.media.mediaFile ) { - // They interacted with the player. Always autoload at this point on. - this.autoLoad = true; - - // Then play the next file in the queue. - this.playNext(); - } - - // Let the template do something... - if( settings.template && settings.template.onControlUpdate ) { - settings.template.onControlUpdate( data ); - } - } - }; - - // Handle the full screen event requests. - this.fullScreen = function( full ) { - if( settings.template.onFullScreen ) { - settings.template.onFullScreen( full ); - } - - // Refresh the preview image. - this.preview.refresh(); - }; - - // Handle when the preview image loads. - this.onPreviewLoaded = function() { - this.previewVisible = true; - }; - - // Handle the media events. - this.onMediaUpdate = function( data ) { - switch( data.type ) { - case "paused": - this.playing = false; - this.showPlay(true); - //this.showBusy(1, false); - if( !this.media.loaded ) { - this.showPreview(true); - } - break; - case "update": - case "playing": - this.playing = true; - this.showPlay(false); - this.showPreview((this.media.mediaFile.type == "audio")); - break; - case "initialize": - this.playing = false; - this.showPlay(true); - this.showBusy(1, this.autoLoad); - this.showPreview(true); - break; - case "buffering": - this.showPlay(true); - this.showPreview((this.media.mediaFile.type == "audio")); - break; - default: - break; - } - - // If they provide a busy cursor. - if( data.busy ) { - this.showBusy(1, (data.busy == "show")); - } - }; - - // Called when the media is clicked. - this.onMediaClick = function() { - if( this.media.player && !this.media.hasControls() ) { - if( this.playing ) { - this.media.player.pauseMedia(); - } - else { - this.media.player.playMedia(); - } - } - }; - - // Set the media player. - this.media = this.display.find( settings.ids.media ).mediadisplay( settings ); - if( this.media ) { - // If they click on the media region, then pause the media. - this.media.display.unbind("click").bind("click", function() { - _this.onMediaClick(); - }); - } - - // Sets the logo position. - this.setLogoPos = function() { - if( this.logo ) { - var logocss = {}; - if( settings.logopos=='se' || settings.logopos=='sw' ) { - logocss['bottom'] = settings.logoy; - } - if( settings.logopos=='ne' || settings.logopos=='nw' ) { - logocss['top'] = settings.logoy; - } - if( settings.logopos=='nw' || settings.logopos=='sw' ) { - logocss['left'] = settings.logox; - } - if( settings.logopos=='ne' || settings.logopos=='se' ) { - logocss['right'] = settings.logox; - } - this.logo.display.css(logocss); - } - }; - - // Add the logo. - if( !settings.controllerOnly ) { - this.display.prepend(''); - this.logo = this.display.find("." + settings.prefix + "medialogo").mediaimage( settings.link ); - if( this.logo ) { - this.logo.display.css({ - width:settings.logoWidth, - height:settings.logoHeight - }); - this.logo.display.bind("imageLoaded", function() { - _this.setLogoPos(); - }); - this.logo.loadImage( settings.logo ); - } - } - - // Reset to previous state... - this.reset = function() { - this.hasMedia = false; - this.playing = false; - jQuery.media.players[settings.id].showNativeControls(false); - this.showPlay(true); - this.showPreview(true); - clearTimeout( this.timeoutId ); - if( this.media ) { - this.media.reset(); - } - }; - - // Toggle the play/pause state. - this.togglePlayPause = function() { - if( this.media ) { - if( this.media.playerReady ) { - if( this.playing ) { - this.showPlay(true); - this.media.player.pauseMedia(); - } - else { - this.showPlay(false); - this.media.player.playMedia(); - } - } - else if( (this.media.playQueue.length > 0) && !this.media.mediaFile ) { - // They interacted with the player. Always autoload at this point on. - this.autoLoad = true; - - // Then play the next file in the queue. - this.playNext(); - } - } - }; - - // Loads an image... - this.loadImage = function( image ) { - if( this.preview ) { - // Show a busy cursor for the image loading... - this.showBusy(3, true); - - // Load the image. - this.preview.loadImage( image ); - - // Set and interval to check if the image is loaded. - var imageInterval = setInterval(function() { - - // If the image is loaded, then clear the interval. - if (_this.preview.loaded()) { - - // Clear the interval and stop the busy cursor. - clearInterval(imageInterval); - _this.showBusy(3, false); - } - }, 500); - - // Now set the preview image in the media player. - if( this.media ) { - this.media.preview = image; - } - } - }; - - this.onResize = function() { - if( this.preview ) { - this.preview.refresh(); - } - - if( this.media ) { - this.media.onResize(); - } - }; - - // Clears the loaded image. - this.clearImage = function() { - if( this.preview ) { - this.preview.clear(); - } - }; - - // Expose the public load functions from the media display. - this.loadFiles = function( files ) { - this.reset(); - this.hasMedia = this.media && this.media.loadFiles(files); - if( this.hasMedia && this.autoLoad ) { - this.media.playNext(); - } - else if( !this.hasMedia ) { - // Hide the overlays for non-media types. - this.showPlay(false); - this.showPreview(true); - this.timeoutId = setTimeout( function() { - _this.media.display.trigger( "mediaupdate", {type:"complete"} ); - }, (settings.timeout * 1000) ); - } - return this.hasMedia; - }; - - // Play the next file. - this.playNext = function() { - if( this.media ) { - this.media.playNext(); - } - }; - - // Check the player for controls. - this.hasControls = function() { - if( this.media ) { - return this.media.hasControls(); - } - return true; - }; - - // Show the native controls. - this.showControls = function( show ) { - if( this.media ) { - this.media.showControls( show ); - } - }; - - // Loads a single media file. - this.loadMedia = function( file ) { - this.reset(); - if( this.media ) { - this.media.loadMedia( file ); - } - }; - - // If they provide a file, then load it. - if( settings.file ) { - this.loadMedia( settings.file ); - } - - // If they provide the image, then load it. - if( settings.image ) { - this.loadImage( settings.image ); - } - })( this, settings ); - }; -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.mousewheel.js b/js/source/jquery.media.mousewheel.js deleted file mode 100644 index d358b673..00000000 --- a/js/source/jquery.media.mousewheel.js +++ /dev/null @@ -1,88 +0,0 @@ -/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net) - * Licensed under the MIT License (LICENSE.txt). - * - * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. - * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. - * Thanks to: Seamus Leahy for adding deltaX and deltaY - * - * Version: 3.0.4 - * - * Requires: 1.2.2+ - */ - -(function($) { - - var types = ['DOMMouseScroll', 'mousewheel']; - - $.event.special.mousewheel = { - setup: function() { - if ( this.addEventListener ) { - for ( var i=types.length; i; ) { - i--; - this.addEventListener( types[i], handler, false ); - } - } else { - this.onmousewheel = handler; - } - }, - - teardown: function() { - if ( this.removeEventListener ) { - for ( var i=types.length; i; ) { - i--; - this.removeEventListener( types[i], handler, false ); - } - } else { - this.onmousewheel = null; - } - } - }; - - $.fn.extend({ - mousewheel: function(fn) { - return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); - }, - - unmousewheel: function(fn) { - return this.unbind("mousewheel", fn); - } - }); - - - function handler(event) { - var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0; - event = $.event.fix(orgEvent); - event.type = "mousewheel"; - - // Old school scrollwheel delta - if ( event.wheelDelta ) { - delta = event.wheelDelta/120; - } - if ( event.detail ) { - delta = -event.detail/3; - } - - // New school multidimensional scroll (touchpads) deltas - deltaY = delta; - - // Gecko - if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { - deltaY = 0; - deltaX = -1*delta; - } - - // Webkit - if ( orgEvent.wheelDeltaY !== undefined ) { - deltaY = orgEvent.wheelDeltaY/120; - } - if ( orgEvent.wheelDeltaX !== undefined ) { - deltaX = -1*orgEvent.wheelDeltaX/120; - } - - // Add event and delta to the front of the arguments - args.unshift(event, delta, deltaX, deltaY); - - return $.event.handle.apply(this, args); - } - -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.node.js b/js/source/jquery.media.node.js deleted file mode 100644 index 6036d3ee..00000000 --- a/js/source/jquery.media.node.js +++ /dev/null @@ -1,288 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - node:"", - incrementTime:5 - }); - - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - voter:"#mediavoter", - uservoter:"#mediauservoter", - mediaRegion:"#mediaregion", - field:".mediafield" - }); - - jQuery.fn.medianode = function( server, settings ) { - if( this.length === 0 ) { - return null; - } - return new (function( server, node, settings ) { - settings = jQuery.media.utils.getSettings(settings); - - // Save the jQuery display. - this.display = node; - this.nodeInfo = {}; - this.incremented = false; - var _this = this; - - // Add the min player as the player for this node. - this.player = this.display.find(settings.ids.mediaRegion).minplayer( settings ); - if( this.player && (settings.incrementTime !== 0)) { - this.player.display.unbind("mediaupdate").bind( "mediaupdate", function( event, data ) { - _this.onMediaUpdate( data ); - }); - } - - // Store all loaded images. - this.images = []; - - this.addVoters = function( element ) { - this.voter = element.find(settings.ids.voter).mediavoter( settings, server, false ); - this.uservoter = element.find(settings.ids.uservoter).mediavoter( settings, server, true ); - if( this.uservoter && this.voter ) { - this.uservoter.display.unbind("processing").bind( "processing", function() { - _this.player.showBusy(2, true); - }); - this.uservoter.display.unbind("voteGet").bind( "voteGet", function() { - _this.player.showBusy(2, false); - }); - this.uservoter.display.unbind("voteSet").bind( "voteSet", function( event, vote ) { - _this.player.showBusy(2, false); - _this.voter.updateVote( vote ); - }); - } - }; - - // Add the voters to this node. - this.addVoters( this.display ); - - // Handle the media events. - this.onMediaUpdate = function( data ) { - if( !this.incremented ) { - switch( data.type ) { - case "update": - // Increment node counter if the increment time is positive and is less than the current time. - if( (settings.incrementTime > 0) && (data.currentTime > settings.incrementTime) ) { - this.incremented = true; - server.call( jQuery.media.commands.incrementCounter, null, null, _this.nodeInfo.nid ); - } - break; - case "complete": - // If the increment time is negative, then that means to increment on media completion. - if( settings.incrementTime < 0 ) { - this.incremented = true; - server.call( jQuery.media.commands.incrementCounter, null, null, _this.nodeInfo.nid ); - } - break; - default: - break; - } - } - }; - - this.loadNode = function( _nodeInfo ) { - return this.getNode( this.translateNode( _nodeInfo ) ); - }; - - this.translateNode = function( _nodeInfo ) { - var isValue = ((typeof _nodeInfo) == "number") || ((typeof _nodeInfo) == "string"); - if( !_nodeInfo ) { - var defaultNode = settings.node; - if( (typeof defaultNode) == 'object' ) { - defaultNode.load = false; - return defaultNode; - } - else { - return defaultNode ? { - nid:defaultNode, - load:true - } : null; - } - } - else if( isValue ) { - return { - nid:_nodeInfo, - load:true - }; - } - else { - _nodeInfo.load = false; - return _nodeInfo; - } - }; - - this.getNode = function( _nodeInfo ) { - if( _nodeInfo ) { - if( server && _nodeInfo.load ) { - server.call( jQuery.media.commands.loadNode, function( result ) { - _this.setNode( result ); - }, null, _nodeInfo.nid, {} ); - } - else { - this.setNode( _nodeInfo ); - } - - // Return that the node was loaded. - return true; - } - - // Return that there was no node loaded. - return false; - }; - - this.setNode = function( _nodeInfo ) { - if( _nodeInfo ) { - // Set the node information object. - this.nodeInfo = _nodeInfo; - this.incremented = false; - - // Load the media... - if( this.player && this.nodeInfo.mediafiles ) { - // Load the preview image. - var image = this.getImage("preview"); - if( image ) { - this.player.loadImage( image.path ); - } - else { - this.player.clearImage(); - } - - // Load the media... - this.player.loadFiles( this.nodeInfo.mediafiles.media ); - } - - // Get the vote for these voters. - if( this.voter ) { - this.voter.getVote( _nodeInfo ); - } - if( this.uservoter ) { - this.uservoter.getVote( _nodeInfo ); - } - - // Load all of our fields. - this.display.find(settings.ids.field).each( function() { - _this.setField( this, _nodeInfo, $(this).attr("type"), $(this).attr("field") ); - }); - - // Trigger our node loaded event. - this.display.trigger( "nodeload", this.nodeInfo ); - } - }; - - this.setField = function( fieldObj, _nodeInfo, type, fieldName ) { - // We only want to load the fields that have a type. - if( type ) { - switch( type ) { - case "text": - this.setTextField( fieldObj, _nodeInfo, fieldName ); - break; - - case "image": - this.setImageField( fieldObj, fieldName ); - break; - - case 'cck_text': - this.setCCKTextField( fieldObj, _nodeInfo, fieldName ); - break; - default: - break; - } - } - }; - - this.setTextField = function( fieldObj, _nodeInfo, fieldName ) { - var field = _nodeInfo[fieldName]; - if( field ) { - $(fieldObj).empty().html( field ); - } - return true; - }; - - this.setCCKTextField = function( fieldObj, _nodeInfo, fieldName ) { - if( args.fieldType == 'cck_text' ) { - var field = _nodeInfo[fieldName]; - if( field ) { - $(fieldObj).empty().html( field["0"].value ); - } - } - return true; - }; - - this.onResize = function() { - if( this.player ) { - this.player.onResize(); - } - }; - - this.getImage = function( imageName ) { - var images = this.nodeInfo.mediafiles ? this.nodeInfo.mediafiles.image : null; - var image = null; - if( images ) { - - // Get the image. - if( images[imageName] ) { - image = images[imageName]; - } - else { - // Or just use the first image... - for( var key in images ) { - if( images.hasOwnProperty( key ) ) { - image = images[key]; - break; - } - } - } - - // If they just provided a string, then still show the image. - image = (typeof image === "string") ? { - path:image - } : image; - image.path = image.path ? jQuery.trim(image.path) : ( settings.baseURL + jQuery.trim(image.filepath) ); - if( image && image.path ) { - image.path = image.path ? jQuery.trim(image.path) : ( settings.baseURL + jQuery.trim(image.filepath) ); - } - else { - image = null; - } - } - return image; - }; - - this.setImageField = function( fieldObj, fieldName ) { - var file = this.getImage( fieldName ); - if( file ) { - var image = $(fieldObj).empty().mediaimage(); - this.images.push( image ); - image.loadImage( file.path ); - } - }; - })( server, this, settings ); - }; -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.pager.js b/js/source/jquery.media.pager.js deleted file mode 100644 index 86f2203d..00000000 --- a/js/source/jquery.media.pager.js +++ /dev/null @@ -1,359 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - shuffle:false, - loop:false, - pageLimit:10 - }); - - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - prev:"#mediaprev", - next:"#medianext", - loadPrev:"#medialoadprev", - loadNext:"#medialoadnext", - prevPage:"#mediaprevpage", - nextPage:"#medianextpage" - }); - - jQuery.fn.mediapager = function( settings ){ - return new (function( pager, settings ) { - settings = jQuery.media.utils.getSettings(settings); - - // Save the jQuery display. - this.display = pager; - var _this = this; - - // The active index within a page. - this.activeIndex = -1; - - // The non-active index within a page. - this.currentIndex = -1; - - // The active page index. - this.activePage = 0; - - // The non-active page index. - this.currentPage = 0; - - // The number of pages. - this.numPages = 0; - - // The number of items on the current page. - this.numItems = 10; - - // The number of items on the active page. - this.activeNumItems = 10; - - // The load state for loading an index after a new page. - this.loadState = ""; - - // Used to turn on and off the pager. - this.enabled = false; - - // Add our buttons... - this.prevButton = pager.find( settings.ids.prev ).medialink( settings, function() { - if( _this.enabled ) { - _this.loadPrev( false ); - } - }); - - this.nextButton = pager.find( settings.ids.next ).medialink( settings, function() { - if( _this.enabled ) { - _this.loadNext( false ); - } - }); - - this.loadPrevButton = pager.find( settings.ids.loadPrev ).medialink( settings, function() { - if( _this.enabled ) { - _this.loadPrev( true ); - } - }); - - this.loadNextButton = pager.find( settings.ids.loadNext ).medialink( settings, function() { - if( _this.enabled ) { - _this.loadNext( true ); - } - }); - - this.prevPageButton = pager.find( settings.ids.prevPage ).medialink( settings, function() { - if( _this.enabled ) { - _this.loadState = "click"; - _this.prevPage(); - } - }); - - this.nextPageButton = pager.find( settings.ids.nextPage ).medialink( settings, function() { - if( _this.enabled ) { - _this.loadState = "click"; - _this.nextPage(); - } - }); - - this.setTotalItems = function( totalItems ) { - if ( totalItems && settings.pageLimit ) { - this.numPages = Math.ceil(totalItems / settings.pageLimit); - if( this.numPages == 1 ) { - this.numItems = totalItems; - } - } - }; - - this.setNumItems = function( _numItems ) { - this.numItems = _numItems; - }; - - this.reset = function() { - this.activePage = 0; - this.currentPage = 0; - this.activeIndex = -1; - this.currentIndex = -1; - this.loadState = ""; - }; - - this.loadIndex = function( setActive ) { - var indexVar = setActive ? "activeIndex" : "currentIndex"; - var newIndex = this[indexVar]; - switch ( this.loadState ) { - case "prev": - this.loadState = ""; - this.loadPrev(setActive); - return; - - case "first": - newIndex = 0; - break; - case "last" : - newIndex = (this.numItems - 1); - break; - - case "rand" : - newIndex = Math.floor(Math.random() * this.numItems); - break; - - default: - break; - } - - this.loadState = ""; - - if( newIndex != this[indexVar] ) { - this.loadState = ""; - this[indexVar] = newIndex; - this.display.trigger("loadindex", { - index:this[indexVar], - active:setActive - }); - } - }; - - this.loadNext = function( setActive ) { - if ( this.loadState ) { - this.loadIndex( setActive ); - } - else if ( settings.shuffle ) { - this.loadRand(); - } - else { - // Increment the playlist index. - var indexVar = setActive ? "activeIndex" : "currentIndex"; - if( setActive && ( this.activePage != this.currentPage ) ) { - - // Check to make sure we cover the crazy corner-case where the activeIndex - // is on the last item of the previous page. Here we don't need to load - // a new page, but simply load the first item on the current page. - if( (this.activeIndex == (this.activeNumItems - 1)) && (this.activePage == (this.currentPage - 1)) ) { - this.currentIndex = this.activeIndex = 0; - this.activePage = this.currentPage; - this.display.trigger("loadindex", { - index:0, - active:true - }); - } - else { - this.currentPage = this.activePage; - this.loadState = ""; - this.display.trigger("loadpage", { - index:this.activePage, - active:setActive - }); - } - } - else { - this[indexVar]++; - if ( this[indexVar] >= this.numItems ) { - if( this.numPages > 1 ) { - this[indexVar] = (this.numItems - 1); - this.loadState = this.loadState ? this.loadState : "first"; - this.nextPage( setActive ); - } - else if( !setActive || settings.loop ) { - this[indexVar] = 0; - this.display.trigger("loadindex", { - index:this[indexVar], - active:setActive - }); - } - } - else { - this.display.trigger("loadindex", { - index:this[indexVar], - active:setActive - }); - } - } - } - }; - - this.loadPrev = function( setActive ) { - var indexVar = setActive ? "activeIndex" : "currentIndex"; - - if( setActive && ( this.activePage != this.currentPage ) ) { - this.currentPage = this.activePage; - this.loadState = "prev"; - this.display.trigger("loadpage", { - index:this.activePage, - active:setActive - }); - } - else { - this[indexVar]--; - if ( this[indexVar] < 0 ) { - if( this.numPages > 1 ) { - this[indexVar] = 0; - this.loadState = this.loadState ? this.loadState : "last"; - this.prevPage( setActive ); - } - else if( !setActive || settings.loop ) { - this[indexVar] = (this.numItems - 1); - this.display.trigger("loadindex", { - index:this[indexVar], - active:setActive - }); - } - } - else { - this.display.trigger( "loadindex", { - index:this[indexVar], - active:setActive - } ); - } - } - }; - - this.loadRand = function() { - var newPage = Math.floor(Math.random() * this.numPages); - - if (newPage != this.activePage) { - this.activePage = newPage; - this.loadState = this.loadState ? this.loadState : "rand"; - this.display.trigger("loadpage", { - index:this.activePage, - active:true - }); - } - else { - this.activeIndex = Math.floor(Math.random() * this.numItems); - this.display.trigger("loadindex", { - index:this.activeIndex, - active:true - }); - } - }; - - this.nextPage = function( setActive ) { - var pageVar = setActive ? "activePage" : "currentPage"; - var pageLoaded = false; - - if ( this[pageVar] < (this.numPages - 1) ) { - this[pageVar]++; - pageLoaded = true; - } - else if ( settings.loop ) { - this.loadState = this.loadState ? this.loadState : "first"; - this[pageVar] = 0; - pageLoaded = true; - } - else { - this.loadState = ""; - } - - // Set the page state. - this.setPageState( setActive ); - - if( pageLoaded ) { - this.display.trigger("loadpage", { - index:this[pageVar], - active:setActive - }); - } - }; - - this.prevPage = function( setActive ) { - var pageVar = setActive ? "activePage" : "currentPage"; - var pageLoaded = false; - - if (this[pageVar] > 0) { - this[pageVar]--; - pageLoaded = true; - } - else if ( settings.loop ) { - this.loadState = this.loadState ? this.loadState : "last"; - this[pageVar] = (this.numPages - 1); - pageLoaded = true; - } - else { - this.loadState = ""; - } - - // Set the page state. - this.setPageState( setActive ); - - if( pageLoaded ) { - this.display.trigger("loadpage", { - index:this[pageVar], - active:setActive - }); - } - }; - - this.setPageState = function( setActive ) { - if( setActive ) { - // If this page is active, then we want to make sure - // we set the current page to the active page. - this.currentPage = this.activePage; - } - else { - // Store the active num items. - this.activeNumItems = this.numItems; - } - }; - })( this, settings ); - }; -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.parser.js b/js/source/jquery.media.parser.js deleted file mode 100755 index 0578fae8..00000000 --- a/js/source/jquery.media.parser.js +++ /dev/null @@ -1,196 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.extend( {}, { - parser : function( settings ) { - // Return a new parser object. - return new (function( settings ) { - var _this = this; - this.onLoaded = null; - - // Parse the contents from a file. - this.parseFile = function( file, onLoaded ) { - this.onLoaded = onLoaded; - jQuery.ajax({ - type: "GET", - url:file, - dataType:"xml", - success: function(xml) { - _this.parseXML( xml ); - }, - error: function( XMLHttpRequest, textStatus, errorThrown ) { - if( window.console && console.log ) { - console.log( "Error: " + textStatus ); - } - } - }); - }; - - // Parse an xml string. - this.parseXML = function( xml ) { - // Try to parse a playlist in any format... - var playlist = this.parseXSPF( xml ); - if( playlist.total_rows === 0 ) { - playlist = this.parseASX( xml ); - } - if( playlist.total_rows === 0 ) { - playlist = this.parseRSS( xml ); - } - if( this.onLoaded && playlist.total_rows ) { - this.onLoaded( playlist ); - } - return playlist; - }; - - // Parse XSPF contents. - this.parseXSPF = function( xml ) { - var playlist = { - total_rows:0, - nodes:[] - }; - var trackList = jQuery("playlist trackList track", xml); - if( trackList.length > 0 ) { - trackList.each( function(index) { - playlist.total_rows++; - playlist.nodes.push({ - nid:playlist.total_rows, - title: $(this).find("title").text(), - description: $(this).find("annotation").text(), - mediafiles: { - image:{ - "image":{ - path:$(this).find("image").text() - } - }, - media:{ - "media":{ - path:$(this).find("location").text() - } - } - } - }); - }); - } - return playlist; - }; - - // Parse ASX contents. - this.parseASX = function( xml ) { - var playlist = { - total_rows:0, - nodes:[] - }; - var trackList = jQuery("asx entry", xml); - if( trackList.length > 0 ) { - trackList.each( function(index) { - playlist.total_rows++; - playlist.nodes.push({ - nid:playlist.total_rows, - title: $(this).find("title").text(), - mediafiles: { - image:{ - "image":{ - path:$(this).find("image").text() - } - }, - media:{ - "media":{ - path:$(this).find("location").text() - } - } - } - }); - }); - } - return playlist; - }; - - // Parse RSS contents. - this.parseRSS = function( xml ) { - var playlist = { - total_rows:0, - nodes:[] - }; - var channel = jQuery("rss channel", xml); - if( channel.length > 0 ) { - var youTube = (channel.find("generator").text() == "YouTube data API"); - - // Iterate through all the items. - channel.find("item").each( function(index) { - playlist.total_rows++; - var item = {}; - item = youTube ? _this.parseYouTubeItem( $(this) ) : _this.parseRSSItem( $(this) ); - item.nid = playlist.total_rows; - playlist.nodes.push(item); - }); - } - return playlist; - }; - - // Parse a default RSS Item. - this.parseRSSItem = function( item ) { - return { - title: item.find("title").text(), - mediafiles: { - image:{ - "image":{ - path:item.find("image").text() - } - }, - media:{ - "media":{ - path:item.find("location").text() - } - } - } - }; - }; - - // Parse a YouTube item. - this.parseYouTubeItem = function( item ) { - var description = item.find("description").text(); - var media = item.find("link").text().replace("&feature=youtube_gdata", ""); - return { - title: item.find("title").text(), - mediafiles: { - image:{ - "image":{ - path:jQuery("img", description).eq(0).attr("src") - } - }, - media:{ - "media":{ - path:media, - player:"youtube" - } - } - } - }; - }; - })( settings ); - } - }, jQuery.media ); -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.player.js b/js/source/jquery.media.player.js deleted file mode 100755 index 41c02502..00000000 --- a/js/source/jquery.media.player.js +++ /dev/null @@ -1,588 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - protocol:"auto", - server:"drupal", - template:"default", - baseURL:"", - debug:false, - draggable:false, - resizable:false, - showPlaylist:true, - autoNext:true, - prefix:"", - zIndex:400, - fluidWidth:false, - fluidHeight:false, - fullscreen:false - }); - - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - loading:"#mediaplayerloading", - player:"#mediaplayer", - menu:"#mediamenu", - titleBar:"#mediatitlebar", - node:"#medianode", - playlist:"#mediaplaylist", - control:"#mediacontrol" - }); - - // Initialize our players, playlists, and controllers. - jQuery.media.players = {}; - jQuery.media.loadCallbacks = {}; - jQuery.media.playlists = {}; - jQuery.media.controllers = {}; - - // Use this function to trigger when the player has finished registering and loaded. - jQuery.media.onLoaded = function( playerId, callback ) { - var player = jQuery.media.players[playerId]; - if( player && player.display && player.loaded ) { - callback( player ); - } - else { - if( !jQuery.media.loadCallbacks[playerId] ) { - jQuery.media.loadCallbacks[playerId] = []; - } - jQuery.media.loadCallbacks[playerId].push( callback ); - } - }; - - // Adds a new element to the media player. - jQuery.media.addElement = function( playerId, fromPlayer, name ) { - if( fromPlayer && fromPlayer[name] ) { - var toPlayer = jQuery.media.players[playerId]; - if( toPlayer ) { - switch( name ) { - case "playlist": - toPlayer.addPlaylist( fromPlayer.playlist ); - break; - case "controller": - toPlayer.addController( fromPlayer.controller ); - break; - default: - break; - } - } - else { - // Otherwise, cache it for inclusion when the player is created. - var pName = name + "s"; - if( !jQuery.media[pName][playerId] ) { - jQuery.media[pName][playerId] = []; - } - jQuery.media[pName][playerId].push( fromPlayer[name] ); - } - } - }; - - // To add a new controller to any existing or future-included players. - jQuery.media.addController = function( playerId, fromPlayer ) { - jQuery.media.addElement( playerId, fromPlayer, "controller" ); - }; - - // To add a new playlist to any existing or future-included players. - jQuery.media.addPlaylist = function( playerId, fromPlayer ) { - jQuery.media.addElement( playerId, fromPlayer, "playlist" ); - }; - - // The main entry point into the player. - jQuery.fn.mediaplayer = function( settings ) { - if( this.length === 0 ) { - return null; - } - // Return the media Media Player - return new (function( player, settings ) { - // Get the settings. - settings = jQuery.media.utils.getSettings( settings ); - - // Get the id if it has not been set. - if( !settings.id ) { - settings.id = jQuery.media.utils.getId( player ); - } - - // Save the dialog. - this.dialog = player; - - // Save the jQuery display. - this.display = this.dialog.find( settings.ids.player ); - var _this = this; - - // Fix a really strange issue where if any of the parent elements are invisible - // when this player's template is initializing, it would crash due to the issue - // with calling the position() function on an invisible object. This seems to fix - // that issue. - var invisibleParents = []; - - // Now check the visibility of the parents, and add the offenders to the array. - jQuery.media.utils.checkVisibility( this.display, invisibleParents ); - - // Add this player to the players object. - jQuery.media.players[settings.id] = this; - - // Variable to keep track if this player has finished loading. - this.loaded = false; - - // Store the index variable. - var i = 0; - - // Set the template object. - settings.template = jQuery.media.templates[settings.template]( this, settings ); - - // Get all of the setting overrides used in this template. - if( settings.template.getSettings ) { - settings = jQuery.extend( settings, settings.template.getSettings() ); - } - - // Add some keyboard event handlers. - $(window).keyup( function( event ) { - switch( event.keyCode ) { - case 0: /* SpaceBar */ - _this.onSpaceBar(); - break; - case 113: /* Q key */ - case 27: /* ESC Key */ - _this.onEscKey(); - break; - default: - break; - } - }); - - // Add a resize handler to the window if either our width or height is fluid. - if( settings.fluidWidth || settings.fluidHeight ) { - $(window).resize( function() { - _this.onResize(); - }); - } - - // First get the communication protocol. - if( jQuery.media[settings.protocol] ) { - this.protocol = jQuery.media[settings.protocol]( settings ); - } - - // Load the server. - if( jQuery.media[settings.server] ) { - this.server = jQuery.media[settings.server]( this.protocol, settings ); - } - - // Get the menu. - this.menu = this.dialog.find( settings.ids.menu ).mediamenu( this.server, settings ); - if( this.menu ) { - this.menu.display.unbind("menuclose").bind( "menuclose", function() { - _this.showMenu( false ); - }); - } - - // Setup our booleans. - this.menuOn = false; - this.maxOn = !settings.showPlaylist; - this.fullScreen = false; - - // The attached playlist. - this.playlist = null; - - // The active playlist. - this.activePlaylist = null; - - // Our attached controller. - this.controller = null; - - // The active controller. - this.activeController = null; - - // Hide or Show the menu. - this.showMenu = function( show ) { - if( settings.template.onMenu ) { - this.menuOn = show; - settings.template.onMenu( this.menuOn ); - } - }; - - // Called when the user presses the ESC key. - this.onEscKey = function() { - // If they are in full screen mode, then escape when they press the ESC key. - if( this.fullScreen ) { - this.onFullScreen( false ); - } - }; - - // When they press the space bar, we will toggle the player play/pause state. - this.onSpaceBar = function() { - if( this.fullScreen && this.node && this.node.player ) { - this.node.player.togglePlayPause(); - } - }; - - // Adds the media player events to a given element. - this.addPlayerEvents = function( element ) { - // Trigger on the menu. - element.display.unbind("menu").bind("menu", function(event) { - _this.showMenu( !_this.menuOn ); - }); - - element.display.unbind("maximize").bind("maximize", function( event ) { - _this.maximize( !_this.maxOn ); - }); - - element.display.unbind("fullscreen").bind("fullscreen", function( event ) { - _this.onFullScreen( !_this.fullScreen ); - }); - }; - - // Function to put the player in fullscreen mode. - this.onFullScreen = function( full ) { - this.fullScreen = full; - if( this.node && this.node.player ) { - this.node.player.fullScreen( this.fullScreen ); - this.onResize(); - - // Check to see if this browser supports native fullscreen. - if (window.webkitSupportsFullscreen && window.webkitSupportsFullscreen()) { - if (full) { - window.webkitEnterFullscreen(); - } - else { - window.webkitExitFullscreen(); - } - } - } - }; - - // Setup the title bar. - this.titleBar = this.dialog.find( settings.ids.titleBar ).mediatitlebar( settings ); - if( this.titleBar ) { - // Add the player events to the titlebar. - this.addPlayerEvents( this.titleBar ); - - // If they have jQuery UI, make this draggable. - if( settings.draggable && this.dialog.draggable ) { - this.dialog.draggable({ - handle: settings.ids.titleBar, - containment: 'document' - }); - } - - // If they have jQuery UI, make this resizable. - if( settings.resizable && this.dialog.resizable ) { - this.dialog.resizable({ - alsoResize: this.display, - containment: 'document', - resize: function(event) { - _this.onResize(); - } - }); - } - } - - // Get the node and register for events. - this.node = this.dialog.find( settings.ids.node ).medianode( this.server, settings ); - if( this.node ) { - this.node.display.unbind("nodeload").bind( "nodeload", function( event, data ) { - _this.onNodeLoad( data ); - }); - - if( this.node.player && this.node.player.media ) { - this.node.player.media.display.unbind("mediaupdate").bind( "mediaupdate", function( event, data ) { - _this.onMediaUpdate( data ); - }); - } - - if( this.node.uservoter ) { - this.node.uservoter.display.unbind("voteSet").bind( "voteSet", function( event, vote ) { - if( _this.activePlaylist ) { - _this.activePlaylist.onVoteSet( vote ); - } - }); - } - } - - // Called when the media updates. - this.onMediaUpdate = function( data ) { - // Call the player onMediaUpdate. - this.node.player.onMediaUpdate( data ); - - // When the media completes, have the active playlist load the next item. - if( settings.autoNext && this.activePlaylist && (data.type == "complete") ) { - this.activePlaylist.loadNext(); - } - - // Update our controller. - if( this.controller ) { - this.controller.onMediaUpdate( data ); - } - - // Update our active controller. - if( this.activeController ) { - this.activeController.onMediaUpdate( data ); - } - - // Set the media information in the menu. - if( this.menu && this.node && (data.type == "meta") ) { - this.menu.setEmbedCode( this.node.player.media.player.getEmbedCode() ); - this.menu.setMediaLink( this.node.player.media.player.getMediaLink() ); - } - - // Let the template do something... - if( settings.template && settings.template.onMediaUpdate ) { - settings.template.onMediaUpdate( data ); - } - }; - - // Called when the playlist is finished loading. - this.onPlaylistLoad = function( data ) { - if( this.node ) { - // Let our media know that there is a playlist. - if( this.node.player && this.node.player.media ) { - this.node.player.media.hasPlaylist = true; - } - - this.node.loadNode( data ); - } - - // Allow the template to do something when the playlist is loaded. - if( settings.template.onPlaylistLoad ) { - settings.template.onPlaylistLoad( data ); - } - }; - - // Called when the main node is loaded. - this.onNodeLoad = function( data ) { - // Allow the template to do something when the node is loaded. - if( settings.template.onNodeLoad ) { - settings.template.onNodeLoad( data ); - } - }; - - // Maximize the player. - this.maximize = function( on ) { - // Don't want to maximize in fullscreen mode. - if( !this.fullScreen ) { - if( settings.template.onMaximize && (on != this.maxOn) ) { - this.maxOn = on; - settings.template.onMaximize( this.maxOn ); - } - } - }; - - // Allow multiple playlists to be associated with this single player using this API. - this.addPlaylist = function( newPlaylist ) { - if( newPlaylist ) { - newPlaylist.display.unbind("playlistload").bind( "playlistload", newPlaylist, function( event, data ) { - // Set this as the active playlist. - _this.activePlaylist = event.data; - _this.onPlaylistLoad( data ); - }); - - // Check to see if this playlist has already loaded... If so, then we need to - // go ahead and load the active teaser into this player. - if( !this.activePlaylist && newPlaylist.activeTeaser ) { - this.activePlaylist = newPlaylist; - this.onPlaylistLoad( newPlaylist.activeTeaser.node.nodeInfo ); - } - } - return newPlaylist; - }; - - // Search these elements for the id. - this.searchForElement = function(elementList) { - - // Iterate through the elements. - for(var id in elementList) { - - // We need to tolerate instances. - var reg = new RegExp( '^' + id + '(\\_[0-9]+)?$', 'i'); - if (settings.id.search(reg) === 0) { - return elementList[id]; - } - } - return null; - }; - - // Add the default playlist. - this.playlist = this.addPlaylist( this.dialog.find( settings.ids.playlist ).mediaplaylist( this.server, settings ) ); - - // Allow mulitple controllers to control this media. - this.addController = function( newController, active ) { - if( newController ) { - newController.display.unbind("controlupdate").bind( "controlupdate", newController, function( event, data ) { - _this.activeController = event.data; - if( _this.node && _this.node.player ) { - _this.node.player.onControlUpdate( data ); - } - }); - - if( active && !this.activeController ) { - this.activeController = newController; - } - - this.addPlayerEvents( newController ); - } - return newController; - }; - - // Add the control bar to the media. - this.controller = this.addController( this.dialog.find( settings.ids.control ).mediacontrol( settings ), false ); - if( this.controller && this.node ) { - // Add any voters to the node. - this.node.addVoters( this.controller.display ); - } - - // Called when the player resizes. - this.onResize = function() { - // Call the template resize function. - if( settings.template.onResize ) { - settings.template.onResize(); - } - - // Resize the node. - if( this.node ) { - this.node.onResize(); - } - - // Resize the attached control region. - if( this.controller ) { - this.controller.onResize(); - } - }; - - // Function to show the built in controls or not. - this.showNativeControls = function( show ) { - var player = this.node ? this.node.player : null; - if( player && player.hasControls() ) { - player.usePlayerControls = show; - if( show ) { - player.busy.hide(); - player.play.hide(); - if( player.preview ) { - player.preview.display.hide(); - } - if( this.controller ) { - this.controller.display.hide(); - } - } - else { - player.showBusy( 1, ((this.busyFlags & 0x2) == 0x2) ); - player.showPlay( this.playVisible ); - player.showPreview( this.previewVisible ); - if( this.controller ) { - this.controller.display.show(); - } - } - player.showControls( show ); - } - }; - - // Load the content into the player. - this.loadContent = function() { - - // Now add any queued controllers... - var controllers = this.searchForElement(jQuery.media.controllers); - if (controllers) { - i = controllers.length; - while(i) { - i--; - this.addController( controllers[i], true ); - } - } - - // Now add any queued playlists... - var playlists = this.searchForElement(jQuery.media.playlists); - if (playlists) { - i = playlists.length; - while(i) { - i--; - this.addPlaylist( playlists[i] ); - } - } - - var playlistLoaded = false; - - if( this.playlist ) { - playlistLoaded = this.playlist.loadPlaylist(); - } - - // Don't load the node if there is a plalist loaded. - if( !playlistLoaded && this.node ) { - // Make sure to transfer any playlist settings over to the node. - if( this.node.player && this.node.player.media ) { - this.node.player.media.settings.repeat = (settings.loop || settings.repeat); - } - - this.node.loadNode(); - } - }; - - this.initializeTemplate = function() { - // Initialize our template. - if( settings.template.initialize ) { - settings.template.initialize( settings ); - } - - // Now reset the visibility of the parents. - jQuery.media.utils.resetVisibility( invisibleParents ); - }; - - this.load = function() { - // Initialize our template. - this.initializeTemplate(); - - // The player looks good now. Move the dialog back. - this.dialog.css("position","relative"); - this.dialog.css("marginLeft",0); - this.dialog.css("overflow","visible"); - - // If they wish to default the player in fullscreen mode, do that now. - if( settings.fullscreen ) { - this.onFullScreen(true); - } - - // Set our loaded flag to true. - this.loaded = true; - this.display.trigger( "playerLoaded", this ); - - // Call all of our queued onLoaded callback functions. - if( jQuery.media.loadCallbacks[settings.id] ) { - var callbacks = jQuery.media.loadCallbacks[settings.id]; - var i = callbacks.length; - while(i) { - i--; - callbacks[i]( this ); - } - } - - // Connect to the server. - this.server.connect( function( result ) { - _this.loadContent(); - }); - }; - - this.load(); - })( this, settings ); - }; -})(jQuery); diff --git a/js/source/jquery.media.playlist.js b/js/source/jquery.media.playlist.js deleted file mode 100755 index 87d143b1..00000000 --- a/js/source/jquery.media.playlist.js +++ /dev/null @@ -1,390 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - playlist:"", - args:[], - wildcard:"*" - }); - - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - pager:"#mediapager", - scroll:"#mediascroll", - busy:"#mediabusy", - links:"#medialinks" - }); - - jQuery.fn.mediaplaylist = function( server, settings ) { - if( this.length === 0 ) { - return null; - } - return new (function( server, playlist, settings ) { - settings = jQuery.media.utils.getSettings(settings); - - // Save the jQuery display. - this.display = playlist; - var _this = this; - - // Store all of the current teasers. - this.teasers = []; - - // The non-active selected teaser. - this.selectedTeaser = null; - - // The active teaser. - this.activeTeaser = null; - - // Set up our playlist args. - this.args = settings.args; - - // Used to keep track if we should set the node active after a playlist load. - this.setActive = true; - - // The active pager. - this.activePager = null; - - // The attached pager bar.. - this.pager = null; - - // Set up the playlist parser. - this.parser = jQuery.media.parser( settings ); - - // Get the Scroll Region. - this.scrollRegion = playlist.find( settings.ids.scroll ).mediascroll( settings ); - this.scrollRegion.clear(); - - // Store the busy cursor. - this.busy = playlist.find( settings.ids.busy ); - this.busyVisible = false; - this.busyImg = this.busy.find("img"); - this.busyWidth = this.busyImg.width(); - this.busyHeight = this.busyImg.height(); - - // Get the links. - this.links = playlist.find( settings.ids.links ).medialinks( settings ); - this.links.loadLinks(); - - this.loading = function( _loading ) { - if( this.pager ) { - this.pager.enabled = !_loading; - } - if( this.activePager ) { - this.activePager.enabled = !_loading; - } - if( _loading ) { - this.busyVisible = true; - this.busy.show(); - } - else { - this.busyVisible = false; - this.busy.hide(); - } - }; - - // Allow mulitple pagers to control this playlist. - this.addPager = function( newPager, active ) { - if( newPager ) { - // Handler for the loadindex event. - newPager.display.unbind("loadindex").bind( "loadindex", function( event, data ) { - if( data.active ) { - _this.activateTeaser( _this.teasers[data.index] ); - } - else { - _this.selectTeaser( _this.teasers[data.index] ); - } - }); - - // Handler for the loadpage event. - newPager.display.unbind("loadpage").bind( "loadpage", function( event, data ) { - _this.setActive = data.active; - _this.loadPlaylist( { - pageIndex:data.index - } ); - }); - - if( active && !this.activePager ) { - this.activePager = newPager; - } - } - return newPager; - }; - - // Add the pager. - this.pager = this.addPager( playlist.find( settings.ids.pager ).mediapager( settings ), false ); - - // Handler for when a link is clicked. - this.links.display.unbind("linkclick").bind( "linkclick", function( event, link ) { - _this.onLinkClick( link ); - }); - - this.onLinkClick = function( link ) { - var index = link.index; - var newPlaylist = link.playlist; - var newArgs = []; - newArgs[index] = link.arg; - - if( this.pager ) { - this.pager.reset(); - } - - if( this.activePager ) { - this.activePager.reset(); - } - - this.loadPlaylist( { - playlist:newPlaylist, - args:newArgs - } ); - }; - - // Loads the next track. - this.loadNext = function() { - if( this.pager ) { - this.pager.loadNext( true ); - } - else if( this.activePager ) { - this.activePager.loadNext( true ); - } - }; - - // Function to load the playlist. - this.loadPlaylist = function( _args ) { - var defaults = { - playlist:settings.playlist, - pageLimit:settings.pageLimit, - pageIndex:(this.pager ? this.pager.activePage : 0), - args:{} - }; - - var playlistArgs = jQuery.extend( {}, defaults, _args ); - - // Set the arguments. - this.setArgs( playlistArgs.args ); - - // Set the busy cursor. - this.loading( true ); - - // If there is a playlist. - if( playlistArgs.playlist ) { - // If the playlist is an object, then just set it directly. - if( ((typeof playlistArgs.playlist) == "object") ) { - settings.playlist = playlistArgs.playlist.name; - this.setPlaylist( playlistArgs.playlist ); - } - else { - // See if the playlist is a URL file. - if( playlistArgs.playlist.match(/^http[s]?\:\/\/|\.xml$/i) ) { - // Parse the XML file. - this.parser.parseFile( playlistArgs.playlist, function( result ) { - _this.setPlaylist( result ); - }); - } - else if( server ) { - // Load the playlist from the server. - server.call( jQuery.media.commands.getPlaylist, function( result ) { - _this.setPlaylist( result ); - }, null, playlistArgs.playlist, playlistArgs.pageLimit, playlistArgs.pageIndex, this.args ); - } - } - - // Return that the playlist was loaded. - return true; - } - - // Return that the playlist was not loaded. - return false; - }; - - // Set this playlist. - this.setPlaylist = function( _playlist ) { - if( _playlist && _playlist.nodes ) { - // Now check the visibility of the parents, and add the offenders to the array. - var invisibleParents = []; - jQuery.media.utils.checkVisibility( this.display, invisibleParents ); - - // Set the total number of items for the pager. - if( this.pager ) { - this.pager.setTotalItems( _playlist.total_rows ); - } - - // Set the total number of items for the active pager. - if( this.activePager ) { - this.activePager.setTotalItems( _playlist.total_rows ); - } - - // Empty the scroll region. - this.scrollRegion.clear(); - - // Reset the teasers. - this.resetTeasers(); - - // Iterate through all of our nodes. - var numNodes = _playlist.nodes.length; - for( var index=0; index < numNodes; index++ ) { - // Add the teaser. - this.addTeaser( _playlist.nodes[index], index ); - } - - // Activate the scroll region. - this.scrollRegion.activate(); - - // Load the next node. - if( this.pager ) { - this.pager.loadNext( this.setActive ); - } - - if( this.activePager ) { - this.activePager.loadNext( this.setActive ); - } - - // Now reset the invisibilty. - jQuery.media.utils.resetVisibility( invisibleParents ); - } - - // We are finished loading. - this.loading( false ); - }; - - // When a vote has been cast, we also need to update the playlist. - this.onVoteSet = function( vote ) { - if( vote ) { - var i = this.teasers.length; - while(i--) { - var teaser = this.teasers[i]; - if( teaser.node.nodeInfo.nid == vote.content_id ) { - teaser.node.voter.updateVote( vote ); - } - } - } - }; - - // Add a single teaser to the list. - this.addTeaser = function( nodeInfo, index ) { - // Setup the teaser. - var teaser = this.scrollRegion.newItem().mediateaser( server, nodeInfo, index, settings ); - if( teaser ) { - // If they click on the teaser, then activate it. - teaser.display.unbind("click").bind( "click", teaser, function( event ) { - _this.activateTeaser( event.data ); - }); - - if( this.activeTeaser ) { - this.activeTeaser.setActive( nodeInfo.nid == this.activeTeaser.node.nodeInfo.nid ); - } - - if( this.selectedTeaser ) { - this.selectedTeaser.setSelected( nodeInfo.nid == this.selectedTeaser.node.nodeInfo.nid ); - } - - // Add this teaser to the teasers array. - this.teasers.push( teaser ); - } - }; - - // Reset the teaser bindings. - this.resetTeasers = function() { - // Remove all handlers. - var i = this.teasers.length; - while(i--) { - this.teasers[i].reset(); - } - this.teasers = []; - }; - - // Set the arguments for this playlist. - this.setArgs = function( _args ) { - if( _args ) { - // Reset the arguments. - this.args = settings.args; - - // Loop through and add the new arguments. - var i = _args.length; - while(i) { - i--; - var arg = _args[i]; - if( arg && (arg != settings.wildcard) ) { - this.args[i] = arg; - } - } - } - }; - - // Selects a teaser. - this.selectTeaser = function( teaser ) { - - // Set the current active teaser to false. - if( this.selectedTeaser ) { - this.selectedTeaser.setSelected( false ); - } - - // Store the active teaser for next time. - this.selectedTeaser = teaser; - - if( this.selectedTeaser ) { - // Now activate the new teaser. - this.selectedTeaser.setSelected( true ); - - // Set this item as visible in the scroll region. - this.scrollRegion.setVisible( teaser.index ); - } - }; - - // Activate the teaser. - this.activateTeaser = function( teaser ) { - // First select the teaser. - this.selectTeaser( teaser ); - - // Set the current active teaser to false. - if( this.activeTeaser ) { - this.activeTeaser.setActive( false ); - } - - // Store the active teaser for next time. - this.activeTeaser = teaser; - - if( this.activeTeaser ) { - // Now activate the new teaser. - this.activeTeaser.setActive( true ); - - // Set the active and current index to this one. - if( this.pager ) { - this.pager.activeIndex = this.pager.currentIndex = teaser.index; - } - - if( this.activePager ) { - this.activePager.activeIndex = this.activePager.currentIndex = teaser.index; - } - - // Trigger an even that the teaser has been activated. - this.display.trigger( "playlistload", teaser.node.nodeInfo ); - } - }; - })( server, this, settings ); - }; -})(jQuery); diff --git a/js/source/jquery.media.playlistlink.js b/js/source/jquery.media.playlistlink.js deleted file mode 100644 index e7d01f27..00000000 --- a/js/source/jquery.media.playlistlink.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Set up our defaults for this component. - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - linkText:"#medialinktext" - }); - - jQuery.fn.playlistlink = function( settings, linkInfo ) { - return new (function( link, settings, linkInfo ) { - settings = jQuery.media.utils.getSettings(settings); - this.display = link; - this.arg = linkInfo.arg; - this.text = linkInfo.text; - this.index = linkInfo.index; - - // Call the setLink when clicked. - this.display.medialink( settings, function( event ) { - _this.display.trigger( "linkclick", event.data ); - }, this ); - - this.setActive = function( active ) { - if( settings.template.onLinkSelect ) { - settings.template.onLinkSelect( _this, active ); - } - }; - - this.display.find( settings.ids.linkText ).html( this.text ); - })( this, settings, linkInfo ); - }; -})(jQuery); diff --git a/js/source/jquery.media.rotator.js b/js/source/jquery.media.rotator.js deleted file mode 100644 index 98bfc46c..00000000 --- a/js/source/jquery.media.rotator.js +++ /dev/null @@ -1,182 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - rotatorTimeout:5000, - rotatorTransition:"fade", - rotatorEasing:"swing", - rotatorSpeed:"slow", - rotatorHover:false - }); - - jQuery.fn.mediarotator = function( settings ) { - if( this.length === 0 ) { - return null; - } - return new (function( rotator, settings ) { - settings = jQuery.media.utils.getSettings(settings); - var _this = this; - this.images = []; - this.imageIndex = 0; - this.imageInterval = null; - this.width = 0; - this.height = 0; - - this.onImageLoaded = function() { - this.width = this.images[0].imgLoader.width; - this.height = this.images[0].imgLoader.height; - rotator.css({ - width:this.width, - height:this.height - }); - var sliderWidth = (settings.rotatorTransition == "hscroll") ? (2*this.width) : this.width; - var sliderHeight = (settings.rotatorTransition == "vscroll") ? (2*this.height) : this.height; - this.display.css({ - width:sliderWidth, - height:sliderHeight - }); - }; - - this.addImage = function() { - var image = $("
").mediaimage(null, true); - this.display.append( image.display ); - - if( (settings.rotatorTransition == "hscroll") || (settings.rotatorTransition == "vscroll") ) { - image.display.css({ - "float":"left" - }); - } - else { - image.display.css({ - position:"absolute", - zIndex:(200 - this.images.length), - top:0, - left:0 - }); - } - return image; - }; - - this.loadImages = function( _images ) { - this.images = []; - this.imageIndex = 0; - - jQuery.each( _images, function( index ) { - var image = _this.addImage(); - if( index === 0 ) { - image.display.unbind("imageLoaded").bind("imageLoaded", function() { - _this.onImageLoaded(); - }).show(); - } - image.loadImage( this ); - _this.images.push( image ); - }); - - if( settings.rotatorHover ) { - this.display.unbind("mouseenter").bind( "mouseenter", function() { - _this.startRotator(); - }).unbind("mouseleave").bind( "mouseleave", function() { - clearInterval( _this.imageInterval ); - }); - } - else { - this.startRotator(); - } - }; - - this.startRotator = function() { - clearInterval( this.imageInterval ); - this.imageInterval = setInterval( function() { - _this.showNextImage(); - }, settings.rotatorTimeout ); - }; - - this.showNextImage = function() { - this.hideImage( this.images[this.imageIndex].display ); - this.imageIndex = (this.imageIndex + 1) % this.images.length; - this.showImage( this.images[this.imageIndex].display ); - }; - - this.showImage = function( image ) { - if( settings.rotatorTransition === 'fade' ) { - image.fadeIn(settings.rotatorSpeed); - } - else { - image.css({ - marginLeft:0, - marginTop:0 - }).show(); - } - }; - - this.hideImage = function( image ) { - switch( settings.rotatorTransition ) { - case "fade": - image.fadeOut(settings.rotatorSpeed); - break; - case "hscroll": - image.animate({ - marginLeft:-this.width - }, settings.rotatorSpeed, settings.rotatorEasing, function() { - image.css({ - marginLeft:0 - }).remove(); - _this.display.append( image ); - }); - break; - case "vscroll": - image.animate({ - marginTop:-this.height - }, settings.rotatorSpeed, settings.rotatorEasing, function() { - image.css({ - marginTop:0 - }).remove(); - _this.display.append( image ); - }); - break; - default: - image.hide(); - break; - } - }; - - // Find all the images in the rotator container. - var _images = []; - rotator.find("img").each( function() { - _images.push( $(this).attr("src") ); - }); - - // Empty the container and setup the inner rotator. - rotator.empty().css("overflow", "hidden").append( $('
') ); - this.display = rotator.find(".imagerotatorinner"); - - // If they provided images, then we will want to load them. - if( _images.length ) { - this.loadImages( _images ); - } - })( this, settings ); - }; -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.rpc.js b/js/source/jquery.media.rpc.js deleted file mode 100755 index 1e6de710..00000000 --- a/js/source/jquery.media.rpc.js +++ /dev/null @@ -1,208 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - gateway:"" - }); - - // Extend the media namespace - jQuery.media = jQuery.extend( {}, { - // Add the rpc object. - rpc : function( settings ) { - // Return a new function for this object - return new (function( settings ) { - settings = jQuery.media.utils.getSettings(settings); - var _this = this; - - this.parseObject = function( data ) { - var ret = ""; - if( data instanceof Date ) { - ret = ""; - ret += data.getFullYear(); - ret += data.getMonth(); - ret += data.getDate(); - ret += "T"; - ret += data.getHours() + ":"; - ret += data.getMinutes() + ":"; - ret += data.getSeconds(); - ret += ""; - } else if( data instanceof Array ) { - ret = ''+"\n"; - for (var i=0; i < data.length; i++) { - ret += ' '+ this.serializeToXML(data[i]) +"\n"; - } - ret += ''; - } else { - ret = ''+"\n"; - for(var key in data ) { - if( data.hasOwnProperty(key) ) { - ret += " "+ key +""; - ret += this.serializeToXML(data[key]) +"\n"; - } - } - ret += ''; - } - return ret; - }; - - this.serializeToXML = function( data ) { - switch( typeof data ) { - case 'boolean': - return ''+ ((data) ? '1' : '0') +''; - - case 'number': - var parsed = parseInt(data, 10); - if(parsed == data) { - return ''+ data +''; - } - return ''+ data +''; - - case 'string': - return ''+ data +''; - - case 'object': - return this.parseObject( data ); - default: - break; - } - return ''; - }; - - this.parseXMLValue = function( node ) { - var childs = jQuery(node).children(); - var numChildren = childs.length; - var newArray = function(items) { - return function() { - items.push( _this.parseXMLValue(this) ); - }; - }; - var newObject = function( items ) { - return function() { - items[jQuery( "> name", this).text()] = _this.parseXMLValue(jQuery("value", this)); - }; - }; - for(var i=0; i < numChildren; i++) { - var element = childs[i]; - switch(element.tagName) { - case 'boolean': - return (jQuery(element).text() == 1); - case 'int': - return parseInt(jQuery(element).text(), 10); - case 'double': - return parseFloat(jQuery(element).text()); - case "string": - return jQuery(element).text(); - case "array": - var retArray = []; - jQuery("> data > value", element).each( newArray( retArray ) ); - return retArray; - case "struct": - var retObj = {}; - jQuery("> member", element).each( newObject( retObj ) ); - return retObj; - case "dateTime.iso8601": - return NULL; - default: - break; - } - } - return null; - }; - - this.parseXML = function( data ) { - var ret = {}; - ret.version = "1.0"; - jQuery("methodResponse params param > value", data).each( function(index) { - ret.result = _this.parseXMLValue(this); - }); - jQuery("methodResponse fault > value", data).each( function(index) { - ret.error = _this.parseXMLValue(this); - }); - return ret; - }; - - this.xmlRPC = function( method, params ) { - var ret = ''; - ret += ''; - ret += '' + method + ''; - if( params.length > 0 ) { - ret += ''; - var numParams = params.length; - for(var i=0; i < numParams; i++) { - if( params[i] ) { - ret += "" + this.serializeToXML(params[i]) + ""; - } - } - ret += ''; - } - ret += ''; - return ret; - }; - - this.call = function( method, onSuccess, onFailed, params, protocol ) { - if( settings.gateway ) { - jQuery.ajax({ - "url": settings.gateway, - "dataType": "xml", - "type": "POST", - "data": this.xmlRPC( method, params ), - "error": function( XMLHttpRequest, textStatus, errorThrown ) { - if( onFailed ) { - onFailed( textStatus ); - } - else if( window.console && console.log ) { - console.log( "Error: " + textStatus ); - } - }, - "success": function( msg ) { - var xml = _this.parseXML( msg ); - if( xml.error ) { - if( onFailed ) { - onFailed( xml.error ); - } - else if( window.console && console.dir ) { - console.dir( xml.error ); - } - } - else if( onSuccess ) { - onSuccess( xml.result ); - } - }, - "processData": false, - "contentType": "text/xml" - }); - } - else if( onSuccess ) { - onSuccess( null ); - } - }; - })( settings ); - } - }, jQuery.media ); -})(jQuery); diff --git a/js/source/jquery.media.scroll.js b/js/source/jquery.media.scroll.js deleted file mode 100755 index 3dd3d95b..00000000 --- a/js/source/jquery.media.scroll.js +++ /dev/null @@ -1,355 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - vertical:true, - scrollSpeed:20, - updateTimeout:40, - hysteresis:40, - showScrollbar:true, - scrollMode:"auto" /* "auto", "span", "mouse", "none" */ - }); - - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - listMask:"#medialistmask", - list:"#medialist", - scrollWrapper:"#mediascrollbarwrapper", - scrollBar:"#mediascrollbar", - scrollTrack:"#mediascrolltrack", - scrollHandle:"#mediascrollhandle", - scrollUp:"#mediascrollup", - scrollDown:"#mediascrolldown" - }); - - jQuery.fn.mediascroll = function( settings ) { - return new (function( scrollRegion, settings ) { - settings = jQuery.media.utils.getSettings(settings); - - // Save the jQuery display. - this.display = scrollRegion; - var _this = this; - - this.spanMode = (settings.scrollMode == "span"); - - // Get the list region. - this.listMask = scrollRegion.find( settings.ids.listMask ); - - // Setup the mouse events for the auto scroll mode. - if( this.spanMode || (settings.scrollMode == "auto") ) { - // Add our event callbacks. - this.listMask.unbind("mouseenter").bind( 'mouseenter', function( event ) { - _this.onMouseOver( event ); - }); - this.listMask.unbind("mouseleave").bind( 'mouseleave', function( event ) { - _this.onMouseOut( event ); - }); - this.listMask.unbind("mousemove").bind( 'mousemove', function( event ) { - _this.onMouseMove( event ); - }); - } - // Setup the mouse events for the mouse scroll mode. - else if(settings.scrollMode == "mouse") { - // Add our event callbacks. - this.display.bind('mousewheel', function(event, delta, deltaX, deltaY) { - event.preventDefault(); - _this.onMouseScroll(deltaX, deltaY); - }); - } - - this.listMask.css("overflow", "hidden"); - - this.list = scrollRegion.find( settings.ids.list ); - - var element = this.list.children().eq(0); - this.elementWidth = element.width(); - this.elementHeight = element.height(); - this.elementSize = settings.vertical ? element.outerHeight(true) : element.outerWidth(true); - - // Early versions of jQuery have a broken clone method for IE. This fixes that. - if( jQuery.browser.msie && parseInt( jQuery.fn.jquery.replace(".", ""), 10 ) < 132 ) { - this.template = $("
").append( jQuery.media.utils.cloneFix( element ) ).html(); - } - else { - this.template = $("
").append( element.clone() ).html(); - } - - // Empty our list. - this.list.empty(); - - // Initialize our variables. - this.pagePos = settings.vertical ? "pageY" : "pageX"; - this.margin = settings.vertical ? "marginTop" : "marginLeft"; - this.scrollSize = settings.vertical ? 0 : this.listMask.width(); - this.scrollMid = 0; - this.mousePos = 0; - this.listPos = 0; - this.scrollInterval = 0; - this.shouldScroll = false; - this.bottomPos = 0; - this.ratio = 0; - this.elements = []; - this.listSize = 0; - - // Add the slider control to this scroll bar. - this.scrollBar = scrollRegion.find( settings.ids.scrollTrack ).mediaslider( settings.ids.scrollHandle, settings.vertical ); - - // Setup the scroll up button. - this.scrollUp = scrollRegion.find( settings.ids.scrollUp ).medialink( settings, function() { - _this.scroll( true ); - }); - - // Setup the scroll down button. - this.scrollDown = scrollRegion.find( settings.ids.scrollDown ).medialink( settings, function() { - _this.scroll( false ); - }); - - if( this.scrollBar ) { - // Handle the update value event. - this.scrollBar.display.unbind("updatevalue").bind("updatevalue", function( event, data ) { - _this.setScrollPos( data * _this.bottomPos, false ); - }); - - // Handle the set value event. - this.scrollBar.display.unbind("setvalue").bind("setvalue", function( event, data ) { - _this.setScrollPos( data * _this.bottomPos, true ); - }); - - // Add our event callbacks. - this.scrollBar.display.bind('mousewheel', function(event, delta, deltaX, deltaY) { - event.preventDefault(); - _this.onMouseScroll(deltaX, deltaY); - }); - } - - this.setScrollSize = function( newSize ) { - if( newSize ) { - this.scrollSize = newSize; - this.scrollMid = this.scrollSize / 2; - var activeSize = this.scrollSize - (settings.hysteresis*2); - this.bottomPos = (this.listSize - this.scrollSize); - this.ratio = ( (this.listSize - activeSize) / activeSize ); - this.shouldScroll = (this.bottomPos > 0); - } - }; - - // Clears this scroll region. - this.clear = function() { - // Reset all variables for a page refresh. - this.mousePos = 0; - this.shouldScroll = false; - this.bottomPos = 0; - this.ratio = 0; - this.scrolling = false; - this.elements = []; - this.listSize = 0; - this.list.css( this.margin, 0 ); - this.list.children().unbind(); - clearInterval( this.scrollInterval ); - this.list.empty(); - }; - - this.getOffset = function() { - return settings.vertical ? this.listMask.offset().top : this.listMask.offset().left; - }; - - // Activates the scroll region. - this.activate = function() { - // Set the scroll size. - this.setScrollSize( settings.vertical ? this.listMask.height() : this.listMask.width() ); - - // Now reset the list position. - this.setScrollPos( 0, true ); - }; - - // Add an item to this scroll region. - this.newItem = function() { - var newTemplate = $(this.template); - this.list.append( newTemplate ); - var element = this.getElement( newTemplate, this.elements.length ); - this.listSize += element.size; - if( settings.vertical ) { - this.list.css({ - height:this.listSize - }); - } - else { - this.list.css({ - width:this.listSize - }); - } - this.elements.push( element ); - return element.obj; - }; - - // Returns the cached element object with all properties. - this.getElement = function( element, index ) { - var size = this.elementSize; - var pos = this.listSize; - return { - obj:element, - size:size, - position:pos, - bottom:(pos+size), - mid:(size/2), - index:index - }; - }; - - // Scroll the list up or down one element. - this.scroll = function( up ) { - var element = this.getElementAtPosition( up ? 0 : this.scrollSize ); - if( element ) { - var newElement = (element.straddle || up) ? element : this.elements[ element.index + 1 ]; - if( newElement ) { - var _listPos = up ? newElement.position : (newElement.bottom - this.scrollSize); - this.setScrollPos( _listPos, true ); - } - } - }; - - // Called when the mouse scrolls. - this.onMouseScroll = function( deltaX, deltaY ) { - var d = settings.vertical ? -deltaY : deltaX; - this.setScrollPos(this.listPos + (settings.scrollSpeed*d)); - }; - - // Called when the mouse moves within the scroll region. - this.onMouseMove = function( event ) { - this.mousePos = event[ this.pagePos ] - this.getOffset(); - - // If the scroll type is span, then just move the list - // up and down according to the listSize/regionSize ratio. - if( this.shouldScroll && this.spanMode ) { - this.setScrollPos( (this.mousePos - settings.hysteresis) * this.ratio ); - } - }; - - // Called when the mouse enters the scroll region. - this.onMouseOver = function( event ) { - if( this.shouldScroll ) { - clearInterval( this.scrollInterval ); - this.scrollInterval = setInterval( function() { - _this.update(); - }, settings.updateTimeout ); - } - }; - - // Called when the mouse exits the scroll region. - this.onMouseOut = function( event ) { - clearInterval( this.scrollInterval ); - }; - - // This function will align the scroll region. - this.align = function( up ) { - var element = this.getElementAtPosition( up ? 0 : this.scrollSize ); - if( element ) { - var _listPos = up ? element.position : (element.bottom - this.scrollSize); - this.setScrollPos( _listPos, true ); - } - }; - - // Will set the element at the given index visible. - this.setVisible = function( index ) { - var element = this.elements[index]; - if( element ) { - var newPos = this.listPos; - if( element.position < this.listPos ) { - newPos = element.position; - } else if( (element.bottom - this.listPos) > this.scrollSize ) { - newPos = element.bottom - this.scrollSize; - } - if( newPos != this.listPos ) { - this.setScrollPos( newPos, true ); - } - } - }; - - // Gets an element at a specific location in the list. - this.getElementAtPosition = function( position ) { - var element = null; - var i = this.elements.length; - while(i--) { - element = this.elements[i]; - if( ((element.position - this.listPos) < position) && - ((element.bottom - this.listPos) >= position) ) { - element.straddle = ((element.bottom - this.listPos) != position); - break; - } - } - return element; - }; - - // Called every interval to update the scroll position. - this.update = function() { - var delta = this.mousePos - this.scrollMid; - if( Math.abs(delta) > settings.hysteresis ) { - var hyst = (delta > 0) ? -settings.hysteresis : settings.hysteresis; - delta = settings.scrollSpeed * (( this.mousePos + hyst - this.scrollMid) / this.scrollMid); - this.setScrollPos(this.listPos + delta); - } - }; - - // Sets the scroll position. - this.setScrollPos = function( _listPos, tween ) { - // Make sure we are greater than zero here. - _listPos = (_listPos < 0) ? 0 : _listPos; - - // See if we should scroll and if the list position is - // greater than the bottom position. - if( this.shouldScroll && (_listPos > this.bottomPos) ) { - _listPos = this.bottomPos; - } - - // Now set the list position. - this.listPos = _listPos; - - // Set the position of the scroll bar. - if( this.scrollBar ) { - var newPos = this.bottomPos ? (this.listPos / this.bottomPos) : 0; - this.scrollBar.setPosition( newPos ); - } - - if( tween ) { - if( settings.vertical ) { - this.list.animate({ - marginTop: -this.listPos - }, (settings.scrollSpeed*10)); - } - else { - this.list.animate({ - marginLeft: -this.listPos - }, (settings.scrollSpeed*10)); - } - } - else { - this.list.css( this.margin, -this.listPos ); - } - }; - })( this, settings ); - }; -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.sha256.js b/js/source/jquery.media.sha256.js deleted file mode 100644 index cfa2e4f6..00000000 --- a/js/source/jquery.media.sha256.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - // Extend the media namespace - jQuery.media = jQuery.extend( {}, { - // Add the sha256 object. - sha256 : function() { - /* A JavaScript implementation of the SHA family of hashes, as defined in FIPS PUB 180-2 - * as well as the corresponding HMAC implementation as defined in FIPS PUB 198a - * Version 1.2 Copyright Brian Turek 2009 - * Distributed under the BSD License - * See http://jssha.sourceforge.net/ for more information - * - * Several functions taken from Paul Johnson - */ - function jsSHA(o,p){jsSHA.charSize=8;jsSHA.b64pad="";jsSHA.hexCase=0;var q=null;var r=null;var s=function(a){var b=[];var c=(1<>5]|=(a.charCodeAt(i/jsSHA.charSize)&c)<<(32-jsSHA.charSize-i%32)}return b};var u=function(a){var b=[];var c=a.length;for(var i=0;i>3]|=d<<(24-(4*(i%8)))}else{return"INVALID HEX STRING"}}return b};var v=null;var w=null;if("HEX"===p){if(0!==(o.length%2)){return"TEXT MUST BE IN BYTE INCREMENTS"}v=o.length*4;w=u(o)}else if(("ASCII"===p)||('undefined'===typeof(p))){v=o.length*jsSHA.charSize;w=s(o)}else{return"UNKNOWN TEXT INPUT TYPE"}var A=function(a){var b=jsSHA.hexCase?"0123456789ABCDEF":"0123456789abcdef";var c="";var d=a.length*4;for(var i=0;i>2]>>((3-i%4)*8+4))&0xF)+b.charAt((a[i>>2]>>((3-i%4)*8))&0xF)}return c};var B=function(a){var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var c="";var d=a.length*4;for(var i=0;i>2]>>8*(3-i%4))&0xFF)<<16)|(((a[i+1>>2]>>8*(3-(i+1)%4))&0xFF)<<8)|((a[i+2>>2]>>8*(3-(i+2)%4))&0xFF);for(var j=0;j<4;j++){if(i*8+j*6>a.length*32){c+=jsSHA.b64pad}else{c+=b.charAt((e>>6*(3-j))&0x3F)}}}return c};var C=function(x,n){if(n<32){return(x>>>n)|(x<<(32-n))}else{return x}};var D=function(x,n){if(n<32){return x>>>n}else{return 0}};var E=function(x,y,z){return(x&y)^(~x&z)};var F=function(x,y,z){return(x&y)^(x&z)^(y&z)};var G=function(x){return C(x,2)^C(x,13)^C(x,22)};var I=function(x){return C(x,6)^C(x,11)^C(x,25)};var J=function(x){return C(x,7)^C(x,18)^D(x,3)};var L=function(x){return C(x,17)^C(x,19)^D(x,10)};var M=function(x,y){var a=(x&0xFFFF)+(y&0xFFFF);var b=(x>>>16)+(y>>>16)+(a>>>16);return((b&0xFFFF)<<16)|(a&0xFFFF)};var N=function(a,b,c,d){var e=(a&0xFFFF)+(b&0xFFFF)+(c&0xFFFF)+(d&0xFFFF);var f=(a>>>16)+(b>>>16)+(c>>>16)+(d>>>16)+(e>>>16);return((f&0xFFFF)<<16)|(e&0xFFFF)};var O=function(a,b,c,d,e){var f=(a&0xFFFF)+(b&0xFFFF)+(c&0xFFFF)+(d&0xFFFF)+(e&0xFFFF);var g=(a>>>16)+(b>>>16)+(c>>>16)+(d>>>16)+(e>>>16)+(f>>>16);return((g&0xFFFF)<<16)|(f&0xFFFF)};var P=function(j,k,l){var W=[];var a,b,c,d,e,f,g,h;var m,T2;var H;var K=[0x428A2F98,0x71374491,0xB5C0FBCF,0xE9B5DBA5,0x3956C25B,0x59F111F1,0x923F82A4,0xAB1C5ED5,0xD807AA98,0x12835B01,0x243185BE,0x550C7DC3,0x72BE5D74,0x80DEB1FE,0x9BDC06A7,0xC19BF174,0xE49B69C1,0xEFBE4786,0x0FC19DC6,0x240CA1CC,0x2DE92C6F,0x4A7484AA,0x5CB0A9DC,0x76F988DA,0x983E5152,0xA831C66D,0xB00327C8,0xBF597FC7,0xC6E00BF3,0xD5A79147,0x06CA6351,0x14292967,0x27B70A85,0x2E1B2138,0x4D2C6DFC,0x53380D13,0x650A7354,0x766A0ABB,0x81C2C92E,0x92722C85,0xA2BFE8A1,0xA81A664B,0xC24B8B70,0xC76C51A3,0xD192E819,0xD6990624,0xF40E3585,0x106AA070,0x19A4C116,0x1E376C08,0x2748774C,0x34B0BCB5,0x391C0CB3,0x4ED8AA4A,0x5B9CCA4F,0x682E6FF3,0x748F82EE,0x78A5636F,0x84C87814,0x8CC70208,0x90BEFFFA,0xA4506CEB,0xBEF9A3F7,0xC67178F2];if(l==="SHA-224"){H=[0xc1059ed8,0x367cd507,0x3070dd17,0xf70e5939,0xffc00b31,0x68581511,0x64f98fa7,0xbefa4fa4]}else{H=[0x6A09E667,0xBB67AE85,0x3C6EF372,0xA54FF53A,0x510E527F,0x9B05688C,0x1F83D9AB,0x5BE0CD19]}j[k>>5]|=0x80<<(24-k%32);j[((k+1+64>>9)<<4)+15]=k;var n=j.length;for(var i=0;ik){f[15]&=0xFFFFFF00}for(var i=0;i<=15;i++){g[i]=f[i]^0x36363636;h[i]=f[i]^0x5C5C5C5C}j=P(g.concat(w),512+v,c);j=P(h.concat(j),512+l,c);return(e(j))}} - - // But I wrote this... ;) - this.encrypt = function( key, input ) { - var shaObj = new jsSHA(input, "ASCII"); - return shaObj.getHMAC(key, "ASCII", "SHA-256", "HEX"); - }; - } - }, jQuery.media ); -})(jQuery); diff --git a/js/source/jquery.media.slider.js b/js/source/jquery.media.slider.js deleted file mode 100644 index 83ecf250..00000000 --- a/js/source/jquery.media.slider.js +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.fn.mediaslider = function( handleId, vertical, inverted ) { - if( this.length === 0 ) { - return null; - } - return new (function( control, handleId, vertical, inverted ) { - var _this = this; - this.display = control.css({ - cursor:"pointer" - }); - this.dragging = false; - this.value = 0; - this.handle = this.display.find(handleId); - this.pagePos = vertical ? "pageY" : "pageX"; - this.handlePos = 0; - - // Only if there is a handle. - if( this.handle.length > 0 ) { - this.handleSize = vertical ? this.handle.height() : this.handle.width(); - this.handleMid = (this.handleSize/2); - } - - this.onResize = function() { - this.setTrackSize(); - this.updateValue( this.value ); - }; - - this.setTrackSize = function() { - this.trackSize = vertical ? this.display.height() : this.display.width(); - this.trackSize -= this.handleSize; - this.trackSize = (this.trackSize > 0) ? this.trackSize : 1; - }; - - this.setValue = function( _value ) { - this.setPosition( _value ); - this.display.trigger( "setvalue", this.value ); - }; - - this.updateValue = function( _value ) { - this.setPosition( _value ); - this.display.trigger( "updatevalue", this.value ); - }; - - this.setPosition = function( _value ) { - _value = (_value < 0) ? 0 : _value; - _value = (_value > 1) ? 1 : _value; - this.value = _value; - this.handlePos = inverted ? (1-this.value) : this.value; - this.handlePos *= this.trackSize; - this.handle.css( (vertical ? "marginTop" : "marginLeft"), this.handlePos ); - }; - - this.display.unbind("mousedown").bind("mousedown", function( event ) { - event.preventDefault(); - _this.dragging = true; - }); - - this.getOffset = function() { - var offset = vertical ? this.display.offset().top : this.display.offset().left; - return (offset + (this.handleSize / 2)); - }; - - this.getPosition = function( pagePos ) { - var pos = (pagePos - this.getOffset()) / this.trackSize; - pos = (pos < 0) ? 0 : pos; - pos = (pos > 1) ? 1 : pos; - pos = inverted ? (1-pos) : pos; - return pos; - }; - - this.display.unbind("mousemove").bind("mousemove", function( event ) { - event.preventDefault(); - if( _this.dragging ) { - _this.updateValue( _this.getPosition( event[_this.pagePos] ) ); - } - }); - - this.display.unbind("mouseleave").bind("mouseleave", function( event ) { - event.preventDefault(); - if( _this.dragging ) { - _this.dragging = false; - _this.setValue( _this.getPosition( event[_this.pagePos] ) ); - } - }); - - this.display.unbind("mouseup").bind("mouseup", function( event ) { - event.preventDefault(); - if( _this.dragging ) { - _this.dragging = false; - _this.setValue( _this.getPosition( event[_this.pagePos] ) ); - } - }); - - this.onResize(); - - })( this, handleId, vertical, inverted ); - }; -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.teaser.js b/js/source/jquery.media.teaser.js deleted file mode 100755 index c7a04d55..00000000 --- a/js/source/jquery.media.teaser.js +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - pageLink:false - }); - - jQuery.fn.mediateaser = function( server, nodeInfo, _index, settings ) { - if( this.length === 0 ) { - return null; - } - return new (function( server, nodeInfo, _index, teaser, settings ) { - settings = jQuery.media.utils.getSettings(settings); - - var _this = this; - this.display = teaser; - - // If they hover over the teaser... - this.display.unbind("mouseenter").bind( "mouseenter", function(event) { - if( settings.template.onTeaserOver ) { - settings.template.onTeaserOver( _this ); - } - }); - - // If they hover away from the teaser... - this.display.unbind("mouseleave").bind( "mouseleave", function(event) { - if( settings.template.onTeaserOut ) { - settings.template.onTeaserOut( _this ); - } - }); - - // The index of this teaser - this.index = _index; - - // Setup the node. - this.node = this.display.medianode( server, settings ); - - // Load the node information. - if( this.node ) { - this.node.loadNode( nodeInfo ); - } - - // If they wish to link these teasers to actual nodes. - if( this.node && settings.pageLink ) { - var path = settings.baseURL; - path += nodeInfo.path ? nodeInfo.path : ("node/" + nodeInfo.nid); - this.node.display.wrap(''); - } - - this.reset = function() { - if( this.node ) { - this.node.display.unbind(); - } - }; - - this.setActive = function( _active ) { - if( settings.template.onTeaserActivate ) { - settings.template.onTeaserActivate(this, _active); - } - }; - - this.setSelected = function( _selected ) { - if( settings.template.onTeaserSelect ) { - settings.template.onTeaserSelect(this, _selected); - } - }; - - // Let the template setup the teaser. - if( settings.template.onTeaserLoad ) { - settings.template.onTeaserLoad( this ); - } - })( server, nodeInfo, _index, this, settings ); - }; -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.titlebar.js b/js/source/jquery.media.titlebar.js deleted file mode 100644 index 984c906d..00000000 --- a/js/source/jquery.media.titlebar.js +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media.ids = jQuery.extend( jQuery.media.ids, { - titleLinks:"#mediatitlelinks" - }); - - jQuery.fn.mediatitlebar = function( settings ) { - if( this.length === 0 ) { - return null; - } - return new (function( titleBar, settings ) { - // Save the jQuery display. - var _this = this; - this.display = titleBar; - - this.titleLinks = this.display.find( settings.ids.titleLinks ); - - this.display.find("a").each( function() { - var linkId = $(this).attr("href"); - $(this).medialink( settings, function( event ) { - event.preventDefault(); - _this.display.trigger( event.data.id ); - }, { - id:linkId.substr(1), - obj:$(this) - } ); - }); - })( this, settings ); - }; -})(jQuery); diff --git a/js/source/jquery.media.utils.js b/js/source/jquery.media.utils.js deleted file mode 100644 index 26dc9859..00000000 --- a/js/source/jquery.media.utils.js +++ /dev/null @@ -1,280 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.extend( {}, { - utils : { - getBaseURL : function() { - var url = new RegExp(/^(http[s]?\:[\\\/][\\\/])([^\\\/\?]+)/); - var results = url.exec(location.href); - return results ? results[0] : ""; - }, - - timer:{}, - stopElementHide:{}, - showThenHide : function( element, id, showSpeed, hideSpeed, finished ) { - if( element ) { - element.show(showSpeed); - if( jQuery.media.utils.timer.hasOwnProperty(id) ) { - clearTimeout( jQuery.media.utils.timer[id] ); - } - jQuery.media.utils.timer[id] = setTimeout( function() { - if( !jQuery.media.utils.stopElementHide[id] ) { - element.hide(hideSpeed, function() { - if( jQuery.media.utils.stopElementHide[id] ) { - element.show(); - } - - if( finished ) { - finished(); - } - }); - } - }, 5000); - } - }, - - stopHide : function( element, id ) { - jQuery.media.utils.stopElementHide[id] = true; - clearTimeout(jQuery.media.utils.timer[id]); - }, - - stopHideOnOver : function( element, id ) { - if( element ) { - jQuery.media.utils.stopElementHide[id] = false; - element.unbind("mouseover").bind("mouseover", {id:id}, function( event ) { - jQuery.media.utils.stopElementHide[event.data.id] = true; - }).unbind("mouseout").bind("mouseout", {id:id}, function( event ) { - jQuery.media.utils.stopElementHide[event.data.id] = false; - }); - } - }, - - getSettings : function( settings ) { - // Make sure it exists... - if( !settings ) { - settings = {}; - } - - // Only get the settings if they have not yet been initialized. - if( !settings.initialized ) { - settings = jQuery.extend( {}, jQuery.media.defaults, settings ); - settings.ids = jQuery.extend( {}, jQuery.media.ids, settings.ids ); - settings.baseURL = settings.baseURL ? settings.baseURL : jQuery.media.utils.getBaseURL(); - settings.baseURL += settings.baseURL ? "/" : ""; - settings.initialized = true; - } - - // Return the settings. - return settings; - }, - - getId : function( display ) { - return display.attr("id") ? display.attr("id") : display.attr("class") ? display.attr("class") : "mediaplayer"; - }, - - getScaledRect : function( ratio, rect ) { - var scaledRect = {}; - scaledRect.x = rect.x ? rect.x : 0; - scaledRect.y = rect.y ? rect.y : 0; - scaledRect.width = rect.width ? rect.width : 0; - scaledRect.height = rect.height ? rect.height : 0; - - if( ratio ) { - var newRatio = (rect.width / rect.height); - scaledRect.height = (newRatio > ratio) ? rect.height : Math.floor(rect.width / ratio); - scaledRect.width = (newRatio > ratio) ? Math.floor(rect.height * ratio) : rect.width; - scaledRect.x = Math.floor((rect.width - scaledRect.width) / 2); - scaledRect.y = Math.floor((rect.height - scaledRect.height) / 2); - } - - return scaledRect; - }, - - // Checks all parents visibility, and resets them and adds those items to a passed in - // array which can be used to reset their visibiltiy at a later point by calling - // resetVisibility - checkVisibility : function( display, invisibleParents ) { - var isVisible = true; - display.parents().each( function() { - var jObject = jQuery(this); - if( !jObject.is(':visible') ) { - isVisible = false; - var attrClass = jObject.attr("class"); - invisibleParents.push( { - obj:jObject, - attr:attrClass - } ); - jObject.removeClass(attrClass); - } - }); - }, - - // Reset's the visibility of the passed in parent elements. - resetVisibility : function( invisibleParents ) { - // Now iterate through all of the invisible objects and rehide them. - var i = invisibleParents.length; - while(i){ - i--; - invisibleParents[i].obj.addClass(invisibleParents[i].attr); - } - }, - - getFlash : function( player, id, width, height, flashvars, wmode ) { - // Get the protocol. - var protocol = window.location.protocol; - if (protocol.charAt(protocol.length - 1) == ':') { - protocol = protocol.substring(0, protocol.length - 1); - } - - // Convert the flashvars object to a string... - var flashVarsString = jQuery.param(flashvars); - - // Get the HTML flash object string. - var flash = ' '; - flash += ''; - flash += ''; - flash += ''; - flash += ''; - flash += ''; - flash += ''; - flash += ''; - flash += ''; - return flash; - }, - - removeFlash : function( obj, id ) { - if( typeof(swfobject) != "undefined" ) { - swfobject.removeSWF( id ); - } - else { - var flash = obj.find('object').eq(0)[0]; - if( flash ) { - flash.parentNode.removeChild(flash); - } - } - }, - - // Insert flash routine. If they have swfobject, then this function will dynamically use that instead. - insertFlash : function( obj, player, id, width, height, flashvars, wmode, onAdded ) { - jQuery.media.utils.removeFlash( obj, id ); - obj.children().remove(); - obj.append('

Get Adobe Flash player

'); - if( typeof(swfobject) != "undefined" ) { - var params = { - allowScriptAccess:"always", - allowfullscreen:"true", - wmode:wmode, - quality:"high" - }; - swfobject.embedSWF( - player, - id, - width, - height, - "9.0.0", - "expressInstall.swf", - flashvars, - params, - {}, - function( swf ) { - onAdded( swf.ref ); - } - ); - } - else { - var flash = jQuery.media.utils.getFlash( player, id, width, height, flashvars, wmode ); - var container = obj.find('#' + id).eq(0); - if( jQuery.browser.msie ) { - container[0].outerHTML = flash; - onAdded( obj.find('object').eq(0)[0] ); - } else { - container.replaceWith( flash ); - onAdded( obj.find('embed').eq(0)[0] ); - } - } - }, - - // Fix the clone method for jQuery 1.2.6 - 1.3.1 - cloneFix: function( obj, events ) { - // Do the clone - var ret = obj.map(function(){ - // IE copies events bound via attachEvent when - // using cloneNode. Calling detachEvent on the - // clone will also remove the events from the orignal - // In order to get around this, we use innerHTML. - // Unfortunately, this means some modifications to - // attributes in IE that are actually only stored - // as properties will not be copied (such as the - // the name attribute on an input). - var html = this.outerHTML; - if ( !html ) { - var div = this.ownerDocument.createElement("div"); - div.appendChild( this.cloneNode(true) ); - html = div.innerHTML; - } - - return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0]; - }); - - // Copy the events from the original to the clone - if ( events === true ) { - var orig = obj.find("*").andSelf(), i = 0; - - ret.find("*").andSelf().each(function(){ - if ( this.nodeName !== orig[i].nodeName ) { - return; - } - - var events = jQuery.data( orig[i], "events" ); - - for ( var type in events ) { - if( events.hasOwnProperty( type ) ) { - for ( var handler in events[ type ] ) { - if( events[ type ].hasOwnProperty( handler ) ) { - jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); - } - } - } - } - - i++; - }); - } - - // Return the cloned set - return ret; - } - } - }, jQuery.media ); -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.vimeo.js b/js/source/jquery.media.vimeo.js deleted file mode 100644 index ef0aa9e1..00000000 --- a/js/source/jquery.media.vimeo.js +++ /dev/null @@ -1,258 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - window.onVimeoReady = function( playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onReady(); - }; - - window.onVimeoFinish = function( playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onFinished(); - }; - - window.onVimeoLoading = function( data, playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onLoading( data ); - }; - - window.onVimeoPlay = function( playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onPlaying(); - }; - - window.onVimeoPause = function( playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onPaused(); - }; - - window.onVimeoProgress = function( time, playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onProgress(time); - }; - - // Tell the media player how to determine if a file path is a YouTube media type. - jQuery.media.playerTypes = jQuery.extend( jQuery.media.playerTypes, { - "vimeo":function( file ) { - return (file.search(/^http(s)?\:\/\/(www\.)?vimeo\.com/i) === 0); - } - }); - - jQuery.fn.mediavimeo = function( options, onUpdate ) { - return new (function( video, options, onUpdate ) { - this.display = video; - var _this = this; - this.player = null; - this.videoFile = null; - this.ready = false; - this.bytesLoaded = 0; - this.bytesTotal = 0; - this.currentVolume = 1; - - this.createMedia = function( videoFile, preview ) { - this.videoFile = videoFile; - this.ready = false; - var playerId = (options.id + "_media"); - var flashvars = { - clip_id:this.getId(videoFile.path), - width:"100%", - height:"100%", - js_api:'1', - js_onLoad:'onVimeoReady', - js_swf_id:playerId - }; - var rand = Math.floor(Math.random() * 1000000); - var flashPlayer = 'http://vimeo.com/moogaloop.swf?rand=' + rand; - jQuery.media.utils.insertFlash( - this.display, - flashPlayer, - playerId, - "100%", - "100%", - flashvars, - options.wmode, - function( obj ) { - _this.player = obj; - _this.loadPlayer(); - } - ); - }; - - this.getId = function( path ) { - var regex = /^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i; - return (path.search(regex) === 0) ? path.replace(regex, "$3") : path; - }; - - this.loadMedia = function( videoFile ) { - this.bytesLoaded = 0; - this.bytesTotal = 0; - this.createMedia( videoFile ); - }; - - // Called when the player has finished loading. - this.onReady = function() { - this.ready = true; - this.loadPlayer(); - }; - - // Load the player. - this.loadPlayer = function() { - if( this.ready && this.player && this.player.api_addEventListener ) { - // Add our event listeners. - this.player.api_addEventListener('onProgress', 'onVimeoProgress'); - this.player.api_addEventListener('onFinish', 'onVimeoFinish'); - this.player.api_addEventListener('onLoading', 'onVimeoLoading'); - this.player.api_addEventListener('onPlay', 'onVimeoPlay'); - this.player.api_addEventListener('onPause', 'onVimeoPause'); - - // Let them know the player is ready. - onUpdate({ - type:"playerready" - }); - - this.playMedia(); - } - }; - - this.onFinished = function() { - onUpdate({ - type:"complete" - }); - }; - - this.onLoading = function( data ) { - this.bytesLoaded = data.bytesLoaded; - this.bytesTotal = data.bytesTotal; - }; - - this.onPlaying = function() { - onUpdate({ - type:"playing", - busy:"hide" - }); - }; - - this.onPaused = function() { - onUpdate({ - type:"paused", - busy:"hide" - }); - }; - - this.playMedia = function() { - onUpdate({ - type:"playing", - busy:"hide" - }); - if (this.player.api_play) { - this.player.api_play(); - } - }; - - this.onProgress = function( time ) { - onUpdate({ - type:"progress" - }); - }; - - this.pauseMedia = function() { - onUpdate({ - type:"paused", - busy:"hide" - }); - if (this.player.api_pause) { - this.player.api_pause(); - } - }; - - this.stopMedia = function() { - this.pauseMedia(); - if (this.player.api_unload) { - this.player.api_unload(); - } - }; - - this.destroy = function() { - this.stopMedia(); - jQuery.media.utils.removeFlash( this.display, (options.id + "_media") ); - this.display.children().remove(); - }; - - this.seekMedia = function( pos ) { - if (this.player.api_seekTo) { - this.player.api_seekTo( pos ); - } - }; - - this.setVolume = function( vol ) { - this.currentVolume = vol; - if (this.player.api_setVolume) { - this.player.api_setVolume( (vol*100) ); - } - }; - - // For some crazy reason... Vimeo has not implemented this... so just cache the value. - this.getVolume = function() { - return this.currentVolume; - }; - - this.getDuration = function() { - return this.player.api_getDuration ? this.player.api_getDuration() : 0; - }; - - this.getCurrentTime = function() { - return this.player.api_getCurrentTime ? this.player.api_getCurrentTime() : 0; - }; - - this.getBytesLoaded = function() { - return this.bytesLoaded; - }; - - this.getBytesTotal = function() { - return this.bytesTotal; - }; - - // Not implemented yet... - this.setQuality = function( quality ) {}; - this.getQuality = function() { - return ""; - }; - this.hasControls = function() { - return true; - }; - this.showControls = function(show) {}; - //this.setSize = function( newWidth, newHeight ) {}; - this.getEmbedCode = function() { - return "This video cannot be embedded."; - }; - this.getMediaLink = function() { - return "This video currently does not have a link."; - }; - })( this, options, onUpdate ); - }; -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.voter.js b/js/source/jquery.media.voter.js deleted file mode 100644 index e686be50..00000000 --- a/js/source/jquery.media.voter.js +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.fn.mediavoter = function( settings, server, userVote ) { - if( this.length === 0 ) { - return null; - } - return new (function( voteObj, settings, server, userVote ) { - // Save the jQuery display. - this.display = voteObj; - var _this = this; - - // The node id. - this.nodeId = 0; - - // Store all of our votes. - this.votes = []; - - // Get the tag for the voting. - this.tag = this.display.attr("tag"); - - // Setup each vote element. - this.display.find("div").each( function() { - if( userVote ) { - $(this).css("cursor", "pointer"); - $(this).unbind("click").bind( "click", function( event ) { - _this.setVote( parseInt($(this).attr("vote"), 10) ); - }); - $(this).unbind("mouseenter").bind( "mouseenter", function( event ) { - _this.updateVote( { - value: parseInt($(this).attr("vote"), 10) - }, true ); - }); - } - _this.votes.push( { - vote:parseInt($(this).attr("vote"), 10), - display:$(this) - } ); - }); - - // Sort the votes based on numerical order. - this.votes.sort( function( voteA, voteB ) { - return (voteA.vote - voteB.vote); - }); - - // If this is a uservoter, then add the mouse leave event. - if( userVote ) { - this.display.unbind("mouseleave").bind( "mouseleave", function( event ) { - _this.updateVote( { - value:0 - }, true ); - }); - } - - // Update a vote value. - this.updateVote = function( vote, hover ) { - if( vote && settings.template.updateVote ) { - settings.template.updateVote( this, vote.value, hover ); - } - }; - - // Get the vote from the server. - this.getVote = function( nodeInfo ) { - if( nodeInfo && nodeInfo.nid ) { - this.nodeId = parseInt(nodeInfo.nid, 10); - if( nodeInfo.vote ) { - var vote = userVote ? nodeInfo.vote.uservote : nodeInfo.vote.vote; - this.updateVote( nodeInfo.vote.vote, false ); - this.display.trigger( "voteGet", vote ); - } - else { - if( server && nodeInfo.nid && (this.display.length > 0) ) { - this.display.trigger( "processing" ); - var cmd = userVote ? jQuery.media.commands.getUserVote : jQuery.media.commands.getVote; - server.call( cmd, function( vote ) { - _this.updateVote( vote, false ); - _this.display.trigger( "voteGet", vote ); - }, null, "node", this.nodeId, this.tag ); - } - } - } - }; - - // Set the current vote. - this.setVote = function( voteValue ) { - if( server && this.nodeId ) { - this.display.trigger( "processing" ); - this.updateVote( { - value:voteValue - }, false ); - server.call( jQuery.media.commands.setVote, function( vote ) { - _this.display.trigger( "voteSet", vote ); - }, null, "node", this.nodeId, voteValue, this.tag ); - } - }; - - // Delete the current vote. - this.deleteVote = function() { - if( server && this.nodeId ) { - this.display.trigger( "processing" ); - server.call( jQuery.media.commands.deleteVote, function( vote ) { - _this.updateVote( vote, false ); - _this.display.trigger( "voteDelete", vote ); - }, null, "node", this.nodeId, this.tag ); - } - }; - })( this, settings, server, userVote ); - }; -})(jQuery); \ No newline at end of file diff --git a/js/source/jquery.media.youtube.js b/js/source/jquery.media.youtube.js deleted file mode 100755 index c925ae90..00000000 --- a/js/source/jquery.media.youtube.js +++ /dev/null @@ -1,292 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Called when the YouTube player is ready. - window.onYouTubePlayerReady = function( playerId ) { - playerId = playerId.replace(/\_media$/, ""); - jQuery.media.players[playerId].node.player.media.player.onReady(); - }; - - // Tell the media player how to determine if a file path is a YouTube media type. - jQuery.media.playerTypes = jQuery.extend( jQuery.media.playerTypes, { - "youtube":function( file ) { - return (file.search(/^http(s)?\:\/\/(www\.)?youtube\.com/i) === 0); - } - }); - - jQuery.fn.mediayoutube = function( options, onUpdate ) { - return new (function( video, options, onUpdate ) { - this.display = video; - var _this = this; - this.player = null; - this.videoFile = null; - this.loaded = false; - this.ready = false; - this.qualities = []; - - this.createMedia = function( videoFile, preview ) { - this.videoFile = videoFile; - this.ready = false; - var playerId = (options.id + "_media"); - var rand = Math.floor(Math.random() * 1000000); - var flashPlayer = 'http://www.youtube.com/apiplayer?rand=' + rand + '&version=3&enablejsapi=1&playerapiid=' + playerId; - jQuery.media.utils.insertFlash( - this.display, - flashPlayer, - playerId, - "100%", - "100%", - {}, - options.wmode, - function( obj ) { - _this.player = obj; - _this.loadPlayer(); - } - ); - }; - - this.getId = function( path ) { - var regex = /^http[s]?\:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9]+)/i; - return (path.search(regex) === 0) ? path.replace(regex, "$2") : path; - }; - - this.loadMedia = function( videoFile ) { - if( this.player ) { - this.loaded = false; - this.videoFile = videoFile; - - // Let them know the player is ready. - onUpdate( { - type:"playerready" - } ); - - // Load our video. - if (this.player.loadVideoById) { - this.player.loadVideoById( this.getId( this.videoFile.path ), 0, options.quality ); - } - } - }; - - // Called when the player has finished loading. - this.onReady = function() { - this.ready = true; - this.loadPlayer(); - }; - - // Try to load the player. - this.loadPlayer = function() { - if( this.ready && this.player ) { - // Create our callback functions. - window[options.id + 'StateChange'] = function( newState ) { - _this.onStateChange( newState ); - }; - - window[options.id + 'PlayerError'] = function( errorCode ) { - _this.onError( errorCode ); - }; - - window[options.id + 'QualityChange'] = function( newQuality ) { - _this.quality = newQuality; - }; - - // Add our event listeners. - if (this.player.addEventListener) { - this.player.addEventListener('onStateChange', options.id + 'StateChange'); - this.player.addEventListener('onError', options.id + 'PlayerError'); - this.player.addEventListener('onPlaybackQualityChange', options.id + 'QualityChange'); - } - - // Get all of the quality levels. - if (this.player.getAvailableQualityLevels) { - this.qualities = this.player.getAvailableQualityLevels(); - } - - // Let them know the player is ready. - onUpdate( { - type:"playerready" - }); - - // Load our video. - if (this.player.loadVideoById) { - this.player.loadVideoById( this.getId( this.videoFile.path ), 0 ); - } - } - }; - - // Called when the YouTube player state changes. - this.onStateChange = function( newState ) { - var playerState = this.getPlayerState( newState ); - onUpdate( { - type:playerState.state, - busy:playerState.busy - } ); - - if( !this.loaded && playerState == "playing" ) { - // Set this player to loaded. - this.loaded = true; - - // Update our meta data. - onUpdate( { - type:"meta" - } ); - } - }; - - // Called when the YouTube player has an error. - this.onError = function( errorCode ) { - var errorText = "An unknown error has occured: " + errorCode; - if( errorCode == 100 ) { - errorText = "The requested video was not found. "; - errorText += "This occurs when a video has been removed (for any reason), "; - errorText += "or it has been marked as private."; - } else if( (errorCode == 101) || (errorCode == 150) ) { - errorText = "The video requested does not allow playback in an embedded player."; - } - if( window.console && console.log ) { - console.log(errorText); - } - onUpdate( { - type:"error", - data:errorText - } ); - }; - - // Translates the player state for the YouTube API player. - this.getPlayerState = function( playerState ) { - switch (playerState) { - case 5: - return {state:'ready', busy:false}; - case 3: - return {state:'buffering', busy:"show"}; - case 2: - return {state:'paused', busy:"hide"}; - case 1: - return {state:'playing', busy:"hide"}; - case 0: - return {state:'complete', busy:false}; - case -1: - return {state:'stopped', busy:false}; - default: - return {state:'unknown', busy:false}; - } - return 'unknown'; - }; - /* - this.setSize = function( newWidth, newHeight ) { - //this.player.setSize(newWidth, newHeight); - }; - */ - this.playMedia = function() { - onUpdate({ - type:"buffering", - busy:"show" - }); - if (this.player.playVideo) { - this.player.playVideo(); - } - }; - - this.pauseMedia = function() { - if (this.player.pauseVideo) { - this.player.pauseVideo(); - } - }; - - this.stopMedia = function() { - if (this.player.stopVideo) { - this.player.stopVideo(); - } - }; - - this.destroy = function() { - this.stopMedia(); - jQuery.media.utils.removeFlash( this.display, (options.id + "_media") ); - this.display.children().remove(); - }; - - this.seekMedia = function( pos ) { - onUpdate({ - type:"buffering", - busy:"show" - }); - if (this.player.seekTo) { - this.player.seekTo( pos, true ); - } - }; - - this.setVolume = function( vol ) { - if (this.player.setVolume) { - this.player.setVolume( vol * 100 ); - } - }; - - this.setQuality = function( quality ) { - if (this.player.setPlaybackQuality) { - this.player.setPlaybackQuality( quality ); - } - }; - - this.getVolume = function() { - return this.player.getVolume ? (this.player.getVolume() / 100) : 0; - }; - - this.getDuration = function() { - return this.player.getDuration ? this.player.getDuration() : 0; - }; - - this.getCurrentTime = function() { - return this.player.getCurrentTime ? this.player.getCurrentTime() : 0; - }; - - this.getQuality = function() { - return this.player.getPlaybackQuality ? this.player.getPlaybackQuality() : 0; - }; - - this.getEmbedCode = function() { - return this.player.getVideoEmbedCode ? this.player.getVideoEmbedCode() : 0; - }; - - this.getMediaLink = function() { - return this.player.getVideoUrl ? this.player.getVideoUrl() : 0; - }; - - this.getBytesLoaded = function() { - return this.player.getVideoBytesLoaded ? this.player.getVideoBytesLoaded() : 0; - }; - - this.getBytesTotal = function() { - return this.player.getVideoBytesTotal ? this.player.getVideoBytesTotal() : 0; - }; - - this.hasControls = function() { - return false; - }; - this.showControls = function(show) {}; - })( this, options, onUpdate ); - }; -})(jQuery); \ No newline at end of file diff --git a/js/yuicompressor/build/yuicompressor.jar b/js/yuicompressor/build/yuicompressor.jar deleted file mode 100755 index c29470bd..00000000 Binary files a/js/yuicompressor/build/yuicompressor.jar and /dev/null differ diff --git a/makefile b/makefile new file mode 100644 index 00000000..ade0c5a0 --- /dev/null +++ b/makefile @@ -0,0 +1,61 @@ +# To run this makefile, you must do the following. +# +# 1.) Download http://closure-compiler.googlecode.com/files/compiler-latest.zip +# and place compiler.jar within the tools directory. +# +# 2.) Install closure-linter tool at by following +# http://code.google.com/closure/utilities/docs/linter_howto.html +# +# 3.) Download the JSDoc toolkit found at +# http://code.google.com/p/jsdoc-toolkit and place the jsdoc-toolkit +# directory within the tools directory. + +# Create the list of files +files = src/osmplayer.js\ + src/osmplayer.parser.default.js\ + src/osmplayer.parser.youtube.js\ + src/osmplayer.parser.rss.js\ + src/osmplayer.parser.asx.js\ + src/osmplayer.parser.xspf.js\ + src/osmplayer.playlist.js\ + src/osmplayer.scroll.js\ + src/osmplayer.pager.js\ + src/osmplayer.teaser.js + +.DEFAULT_GOAL := all + +all: jslint js jsdoc + +# Perform a jsLint on all the files. +jslint: ${files} + gjslint $^ + +# Create an aggregated js file and a compressed js file. +js: ${files} + @echo "Generating aggregated bin/osmplayer.js file" + @cat > bin/osmplayer.js $^ + @echo "Generating compressed bin/osmplayer.compressed file" + @java -jar tools/compiler.jar --js bin/osmplayer.js --js_output_file bin/osmplayer.compressed.js + +# Create the documentation from source code. +jsdoc: ${files} + @echo "Generating documetation." + @java -jar tools/jsdoc-toolkit/jsrun.jar tools/jsdoc-toolkit/app/run.js -a -t=tools/jsdoc-toolkit/templates/jsdoc -d=doc $^ + +# Fix the js style on all the files. +fixjsstyle: ${files} + fixjsstyle $^ + +# Install the necessary tools. +tools: + apt-get install python-setuptools + apt-get install unzip + wget http://closure-compiler.googlecode.com/files/compiler-latest.zip -P tools + unzip tools/compiler-latest.zip -d tools + rm tools/compiler-latest.zip tools/COPYING tools/README + easy_install http://closure-linter.googlecode.com/files/closure_linter-latest.tar.gz + wget http://jsdoc-toolkit.googlecode.com/files/jsdoc_toolkit-2.4.0.zip -P tools + unzip tools/jsdoc_toolkit-2.4.0.zip -d tools + mv tools/jsdoc_toolkit-2.4.0/jsdoc-toolkit tools/jsdoc-toolkit + rm -rd tools/jsdoc_toolkit-2.4.0 + rm tools/jsdoc_toolkit-2.4.0.zip diff --git a/minplayer/LICENSE.txt b/minplayer/LICENSE.txt deleted file mode 100755 index 20d40b6b..00000000 --- a/minplayer/LICENSE.txt +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program 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. - - This program 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 this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. \ No newline at end of file diff --git a/minplayer/README.md b/minplayer/README.md new file mode 100644 index 00000000..63034555 --- /dev/null +++ b/minplayer/README.md @@ -0,0 +1,122 @@ +minPlayer - Because less IS more. +=================================== + +The goal of this project is to provide a slim, well documented, object oriented, +plugin-based "core" media player in which other players and libraries can build +on top of. It is written using object oriented JavaScript and is continuously +integrated using JSLint, JSDoc, and Google Closure. + +Multiple players - One single API. +----------------------------------- +It also allows for hot-swappable 3rd party API players by providing a common +API for all of these players so that they can be utilized in the same manner. +This means that once you develop for the minPlayer, one can easily bring in a +different player an your code will still function as it would for all the +others. Out of the box, this player provides a common API for YouTube, Vimeo, +HTML5, and Flash with more on the way. + +Everything is a plugin +----------------------------------- +Since this is a plugin-based media player, every displayable class must derive +from the plugin class, thereby, making it a plugin. This includes the media +player itself. This plugin system is highly flexible to be able to handle +just about any type of plugin imaginable, and allows for every plugin to have +direct dependeny-injected control over any other plugin within the media player. + +Complete User Interface & Business Logic separation +----------------------------------- +One common complaint for many media solutions out there is that they hijack the +DOM and build out their own controls to provide consistency amongst different +browsers. They do this, however, within the core player which completely binds +the user interface to the business logic of the media player. The minPlayer +takes a different approach by keeping ALL user interface functionality within +the "templates" directory, where each template essentially derives from the base +Business logic classes only to provide the user interface aspects of that control. +This allows for easy templating of the media player besides just overriding the +CSS like current media solutions do today. + +No "Features"! +----------------------------------- +I am pleased to say that this media player does NOT have many features, and this +is on purpose. Since this is a "core" player, it does not have any features +other than what is critical in presenting your media. Any additional "bling" +will be added to this player from different repositories and from different +players that extend this "core" functionality. This methodology will keep this +"core" media solution lean & highly functional. + +API +----------------------------------- +The API for minPlayer is very simple. It revolves around a single API that is +able to retrieve any plugin even before that plugin is created. By doing this, +you can have complete control over any plugin within the minPlayer. This API +is simply called + +``` +minplayer.get(); +``` + +This API can take up to three different argument with each argument providing +different usage. The code docs for this function are as follows... + +``` +/** + * The main API for minPlayer. + * + * Provided that this function takes three parameters, there are 8 different + * ways to use this api. + * + * id (0x100) - You want a specific player. + * plugin (0x010) - You want a specific plugin. + * callback (0x001) - You only want it when it is ready. + * + * 000 - You want all plugins from all players, ready or not. + * + * var instances = minplayer.get(); + * + * 001 - You want all plugins from all players, but only when ready. + * + * minplayer.get(function(plugin) { + * // Code goes here. + * }); + * + * 010 - You want a specific plugin from all players, ready or not... + * + * var medias = minplayer.get(null, 'media'); + * + * 011 - You want a specific plugin from all players, but only when ready. + * + * minplayer.get('player', function(player) { + * // Code goes here. + * }); + * + * 100 - You want all plugins from a specific player, ready or not. + * + * var plugins = minplayer.get('player_id'); + * + * 101 - You want all plugins from a specific player, but only when ready. + * + * minplayer.get('player_id', null, function(plugin) { + * // Code goes here. + * }); + * + * 110 - You want a specific plugin from a specific player, ready or not. + * + * var plugin = minplayer.get('player_id', 'media'); + * + * 111 - You want a specific plugin from a specific player, only when ready. + * + * minplayer.get('player_id', 'media', function(media) { + * // Code goes here. + * }); + * + * @this The context in which this function was called. + * @param {string} id The ID of the widget to get the plugins from. + * @param {string} plugin The name of the plugin. + * @param {function} callback Called when the plugin is ready. + * @return {object} The plugin object if it is immediately available. + */ +minplayer.get = function(id, plugin, callback) { +}; +``` + +Thanks and enjoy minPlayer. \ No newline at end of file diff --git a/minplayer/bin/minplayer.compressed.js b/minplayer/bin/minplayer.compressed.js new file mode 100644 index 00000000..86b8f83a --- /dev/null +++ b/minplayer/bin/minplayer.compressed.js @@ -0,0 +1,103 @@ +var minplayer=minplayer||{};function checkPlayType(a,b){if("function"===typeof a.canPlayType){if("object"===typeof b){for(var c=b.length,d="";c--&&!(d=checkPlayType(a,b[c])););return d}c=a.canPlayType(b);if("no"!==c&&""!==c)return b}return""} +minplayer.compatibility=function(){var a=null,a=document.createElement("video");this.videoOGG=checkPlayType(a,"video/ogg");this.videoH264=checkPlayType(a,["video/mp4","video/h264"]);this.videoWEBM=checkPlayType(a,["video/x-webm","video/webm","application/octet-stream"]);a=document.createElement("audio");this.audioOGG=checkPlayType(a,"audio/ogg");this.audioMP3=checkPlayType(a,"audio/mpeg");this.audioMP4=checkPlayType(a,"audio/mp4")};minplayer.playTypes||(minplayer.playTypes=new minplayer.compatibility); +minplayer=minplayer||{};minplayer.async=function(){this.value=null;this.queue=[]};minplayer.async.prototype.get=function(a){this.value!==null?a(this.value):this.queue.push(a)};minplayer.async.prototype.set=function(a){this.value=a;var b=this.queue.length;if(b){for(;b--;)this.queue[b](a);this.queue=[]}};minplayer=minplayer||{};minplayer.flags=function(){this.flag=0;this.ids={};this.numFlags=0}; +minplayer.flags.prototype.setFlag=function(a,b){if(!this.ids.hasOwnProperty(a)){this.ids[a]=this.numFlags;this.numFlags++}this.flag=b?this.flag|1<a){c.height=b.height;c.width=Math.floor(b.height*a)}else{c.height=Math.floor(b.width/a);c.width=b.width}c.x=Math.floor((b.width-c.width)/2);c.y=Math.floor((b.height-c.height)/2)}return c}; +minplayer.display.prototype.getElements=function(){return{}};minplayer.display.prototype.isValid=function(){return this.display.length>0}; +(function(a,b){var c=function(){for(var a=[["requestFullscreen","exitFullscreen","fullscreenchange","fullscreen","fullscreenElement"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitfullscreenchange","webkitIsFullScreen","webkitCurrentFullScreenElement"],["mozRequestFullScreen","mozCancelFullScreen","mozfullscreenchange","mozFullScreen","mozFullScreenElement"]],c=0,d=a.length;c0&&(c=d)}return c}; +minplayer.prototype.loadPlayer=function(){if(this.options.file)if(this.options.file.player){this.error();var a=this.options.file.player.toString();if(!this.media||a!==this.currentPlayer){this.currentPlayer=a;if(this.elements.display){a={};if(this.media){a=this.media.queue;this.media.destroy()}pClass=minplayer.players[this.options.file.player];this.options.mediaelement=this.elements.media;this.media=new pClass(this.elements.display,this.options,a);this.get("media",function(a){return function(c){c.load(a.options.file)}}(this))}else this.error("No media display found.")}else this.media&& +this.media.load(this.options.file)}else this.error("Cannot play media: "+this.options.file.mimetype);else this.error("No media found.")};minplayer.prototype.load=function(a){this.options.files=a||this.options.files;this.options.file=this.getMediaFile(this.options.files);this.loadPlayer()};minplayer.prototype.resize=function(){this.get(function(a){a.onResize()})};minplayer=minplayer||{}; +minplayer.image=function(a,b){this.loaded=false;this.loader=null;this.ratio=0;this.img=null;minplayer.display.call(this,"image",a,b)};minplayer.image.prototype=new minplayer.display;minplayer.image.prototype.constructor=minplayer.image; +minplayer.image.prototype.construct=function(){this.allowResize=true;minplayer.display.prototype.construct.call(this);this.display.css("overflow","hidden");this.loader=new Image;this.loader.onload=function(a){return function(){a.loaded=true;a.ratio=a.loader.width/a.loader.height;a.resize();a.trigger("loaded")}}(this);this.ready()}; +minplayer.image.prototype.load=function(a){this.clear(function(){this.display.empty();this.img=jQuery(document.createElement("img")).attr({src:""}).hide();this.display.append(this.img);this.loader.src=a})};minplayer.image.prototype.clear=function(a){this.loaded=false;this.img?this.img.fadeOut(function(b){return function(){b.img.attr("src","");b.loader.src="";$(this).remove();a.call(b)}}(this)):a.call(this)}; +minplayer.image.prototype.resize=function(a,b){a=a||this.display.width();b=b||this.display.height();if(a&&b&&this.loaded){var c=this.getScaledRect(this.ratio,{width:a,height:b});this.img&&this.img.attr("src",this.loader.src).css({marginLeft:c.x,marginTop:c.y,width:c.width,height:c.height});this.img.fadeIn()}};minplayer.image.prototype.onResize=function(){this.resize()};minplayer=minplayer||{}; +minplayer.file=function(a){this.duration=a.duration||0;this.bytesTotal=a.bytesTotal||0;this.quality=a.quality||0;this.stream=a.stream||"";this.path=a.path||"";this.codecs=a.codecs||"";this.extension=a.extension||this.getFileExtension();this.mimetype=a.mimetype||a.filemime||this.getMimeType();this.type=a.type||this.getType();if(!this.type){this.mimetype=this.getMimeType();this.type=this.getType()}this.player=a.player||this.getBestPlayer();this.priority=a.priority||this.getPriority();this.id=a.id|| +this.getId()};minplayer.file.prototype.getBestPlayer=function(){var a=null,b=0;jQuery.each(minplayer.players,function(c){return function(d,e){var f=e.getPriority();if(e.canPlay(c)&&f>b){a=d;b=f}}}(this));return a}; +minplayer.file.prototype.getPriority=function(){var a=1;this.player&&(a=minplayer.players[this.player].getPriority());switch(this.mimetype){case "video/x-webm":case "video/webm":case "application/octet-stream":return a*10;case "video/mp4":case "audio/mp4":case "audio/mpeg":return a*9;case "video/ogg":case "audio/ogg":case "video/quicktime":return a*8;default:return a*5}};minplayer.file.prototype.getFileExtension=function(){return this.path.substring(this.path.lastIndexOf(".")+1).toLowerCase()}; +minplayer.file.prototype.getMimeType=function(){switch(this.extension){case "mp4":case "m4v":case "flv":case "f4v":return"video/mp4";case "webm":return"video/webm";case "ogg":case "ogv":return"video/ogg";case "3g2":return"video/3gpp2";case "3gpp":case "3gp":return"video/3gpp";case "mov":return"video/quicktime";case "swf":return"application/x-shockwave-flash";case "oga":return"audio/ogg";case "mp3":return"audio/mpeg";case "m4a":case "f4a":return"audio/mp4";case "aac":return"audio/aac";case "wav":return"audio/vnd.wave"; +case "wma":return"audio/x-ms-wma";default:return"unknown"}};minplayer.file.prototype.getType=function(){switch(this.mimetype){case "video/mp4":case "video/webm":case "application/octet-stream":case "video/x-webm":case "video/ogg":case "video/3gpp2":case "video/3gpp":case "video/quicktime":return"video";case "audio/mp3":case "audio/mp4":case "audio/ogg":case "audio/mpeg":return"audio";default:return""}}; +minplayer.file.prototype.getId=function(){var a=minplayer.players[this.player];return a&&a.getMediaId?a.getMediaId(this):""};minplayer=minplayer||{};minplayer.playLoader=function(a,b){this.busy=new minplayer.flags;this.bigPlay=new minplayer.flags;this.preview=null;minplayer.display.call(this,"playLoader",a,b)};minplayer.playLoader.prototype=new minplayer.display;minplayer.playLoader.prototype.constructor=minplayer.playLoader; +minplayer.playLoader.prototype.construct=function(){minplayer.display.prototype.construct.call(this);this.get("media",function(a){if(a.hasPlayLoader()){this.elements.busy&&this.elements.busy.unbind().hide();this.elements.bigPlay&&this.elements.bigPlay.unbind().hide();this.display.unbind().hide()}else{if(!this.options.preview)this.options.preview=a.elements.media.attr("poster");a.elements.media.attr("poster","");this.loadPreview();this.elements.bigPlay&&this.elements.bigPlay.unbind().bind("click", +function(b){b.preventDefault();jQuery(this).hide();a.play()});a.unbind("loadstart").bind("loadstart",function(a){return function(){a.busy.setFlag("media",true);a.bigPlay.setFlag("media",true);a.preview&&a.elements.preview.show();a.checkVisibility()}}(this));a.bind("waiting",function(a){return function(){a.busy.setFlag("media",true);a.checkVisibility()}}(this));a.bind("loadeddata",function(a){return function(){a.busy.setFlag("media",false);a.checkVisibility()}}(this));a.bind("playing",function(a){return function(){a.busy.setFlag("media", +false);a.bigPlay.setFlag("media",false);a.preview&&a.elements.preview.hide();a.checkVisibility()}}(this));a.bind("pause",function(a){return function(){a.bigPlay.setFlag("media",true);a.checkVisibility()}}(this))}});this.ready()};minplayer.playLoader.prototype.loadPreview=function(){if(this.elements.preview)if(this.options.preview){this.elements.preview.addClass("has-preview").show();this.preview=new minplayer.image(this.elements.preview,this.options);this.preview.load(this.options.preview)}else this.elements.preview.hide()}; +minplayer.playLoader.prototype.checkVisibility=function(){this.busy.flag?this.elements.busy.show():this.elements.busy.hide();this.bigPlay.flag?this.elements.bigPlay.show():this.elements.bigPlay.hide();(this.bigPlay.flag||this.busy.flag)&&this.display.show();!this.bigPlay.flag&&!this.busy.flag&&this.display.hide()};minplayer=minplayer||{};minplayer.players=minplayer.players||{};minplayer.players.base=function(a,b,c){minplayer.display.call(this,"media",a,b,c)};minplayer.players.base.prototype=new minplayer.display; +minplayer.players.base.prototype.constructor=minplayer.players.base;minplayer.players.base.prototype.getElements=function(){var a=minplayer.display.prototype.getElements.call(this);return jQuery.extend(a,{media:this.options.mediaelement})};minplayer.players.base.getPriority=function(){return 0};minplayer.players.base.getMediaId=function(){return""};minplayer.players.base.canPlay=function(){return false}; +minplayer.players.base.prototype.construct=function(){minplayer.display.prototype.construct.call(this);this.clear();this.mediaFile=this.options.file;if(!this.playerFound()){this.elements.media&&this.elements.media.remove();this.elements.media=jQuery(this.create());this.display.html(this.elements.media)}this.player=this.getPlayer();jQuery(document).bind("click",function(a){return function(b){a.hasFocus=jQuery(b.target).closest("#"+a.options.id).length==0?false:true}}(this));jQuery(document).bind("keydown", +function(a){return function(b){if(a.hasFocus){b.preventDefault();switch(b.keyCode){case 32:case 179:a.playing?a.pause():a.play();break;case 38:a.setVolumeRelative(0.1);break;case 40:a.setVolumeRelative(-0.1);break;case 37:case 227:a.seekRelative(-0.05);break;case 39:case 228:a.seekRelative(0.05)}}}}(this))};minplayer.players.base.prototype.destroy=function(){minplayer.plugin.prototype.destroy.call(this);this.clear()}; +minplayer.players.base.prototype.clear=function(){this.playerReady=false;this.reset();this.player&&jQuery(this.player).unbind()}; +minplayer.players.base.prototype.reset=function(){this.duration=new minplayer.async;this.currentTime=new minplayer.async;this.bytesLoaded=new minplayer.async;this.bytesTotal=new minplayer.async;this.bytesStart=new minplayer.async;this.volume=new minplayer.async;this.loading=this.playing=this.hasFocus=false;this.trigger("pause");this.trigger("waiting");this.trigger("progress",{loaded:0,total:0,start:0});this.trigger("timeupdate",{currentTime:0,duration:0})}; +minplayer.players.base.prototype.onReady=function(){if(!this.playerReady){this.playerReady=true;this.setVolume(this.options.volume/100);this.loading=true;this.poll(function(a){return function(){a.loading&&a.getBytesLoaded(function(b){a.getBytesTotal(function(c){if(b||c){var d=0;a.getBytesStart(function(a){d=a});a.trigger("progress",{loaded:b,total:c,start:d});if(b>=c)a.loading=false}})});return a.loading}}(this),1E3);this.ready();this.trigger("loadstart")}}; +minplayer.players.base.prototype.onPlaying=function(){this.trigger("playing");this.playing=this.hasFocus=true;this.poll(function(a){return function(){a.playing&&a.getCurrentTime(function(b){a.getDuration(function(c){b=parseFloat(b);c=parseFloat(c);(b||c)&&a.trigger("timeupdate",{currentTime:b,duration:c})})});return a.playing}}(this),1E3)};minplayer.players.base.prototype.onPaused=function(){this.trigger("pause");this.playing=this.hasFocus=false}; +minplayer.players.base.prototype.onComplete=function(){this.hasFocus=this.loading=this.playing=false;this.trigger("ended")};minplayer.players.base.prototype.onLoaded=function(){this.trigger("loadeddata")};minplayer.players.base.prototype.onWaiting=function(){this.trigger("waiting")};minplayer.players.base.prototype.onError=function(a){this.hasFocus=false;this.trigger("error",a)};minplayer.players.base.prototype.isReady=function(){return this.player&&this.playerReady}; +minplayer.players.base.prototype.hasPlayLoader=function(){return false};minplayer.players.base.prototype.playerFound=function(){return false};minplayer.players.base.prototype.create=function(){this.reset();return null};minplayer.players.base.prototype.getPlayer=function(){return this.player};minplayer.players.base.prototype.load=function(a){var b=typeof this.mediaFile=="string"?this.mediaFile:this.mediaFile.path;if(a&&a.path!=b){this.reset();this.mediaFile=a}}; +minplayer.players.base.prototype.play=function(){};minplayer.players.base.prototype.pause=function(){};minplayer.players.base.prototype.stop=function(){this.hasFocus=this.loading=this.playing=false};minplayer.players.base.prototype.seekRelative=function(a){this.getCurrentTime(function(b){return function(c){b.getDuration(function(d){if(d){var e=0,e=a>-1&&a<1?c/d+parseFloat(a):(c+parseFloat(a))/d;b.seek(e)}})}}(this))};minplayer.players.base.prototype.seek=function(){}; +minplayer.players.base.prototype.setVolumeRelative=function(a){this.getVolume(function(b){return function(c){c=c+parseFloat(a);c=c<0?0:c;b.setVolume(c>1?1:c)}}(this))};minplayer.players.base.prototype.setVolume=function(a){this.trigger("volumeupdate",a)};minplayer.players.base.prototype.getVolume=function(a){return this.volume.get(a)};minplayer.players.base.prototype.getCurrentTime=function(a){return this.currentTime.get(a)};minplayer.players.base.prototype.getDuration=function(a){return this.duration.get(a)}; +minplayer.players.base.prototype.getBytesStart=function(a){return this.bytesStart.get(a)};minplayer.players.base.prototype.getBytesLoaded=function(a){return this.bytesLoaded.get(a)};minplayer.players.base.prototype.getBytesTotal=function(a){return this.bytesTotal.get(a)};minplayer=minplayer||{};minplayer.players=minplayer.players||{};minplayer.players.html5=function(a,b,c){minplayer.players.base.call(this,a,b,c)};minplayer.players.html5.prototype=new minplayer.players.base; +minplayer.players.html5.prototype.constructor=minplayer.players.html5;minplayer.players.html5.getPriority=function(){return 10}; +minplayer.players.html5.canPlay=function(a){switch(a.mimetype){case "video/ogg":return!!minplayer.playTypes.videoOGG;case "video/mp4":case "video/x-mp4":case "video/m4v":case "video/x-m4v":return!!minplayer.playTypes.videoH264;case "video/x-webm":case "video/webm":case "application/octet-stream":return!!minplayer.playTypes.videoWEBM;case "audio/ogg":return!!minplayer.playTypes.audioOGG;case "audio/mpeg":return!!minplayer.playTypes.audioMP3;case "audio/mp4":return!!minplayer.playTypes.audioMP4;default:return false}}; +minplayer.players.html5.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this);if(this.player){this.player.addEventListener("abort",function(a){return function(){a.trigger("abort")}}(this),false);this.player.addEventListener("loadstart",function(a){return function(){a.onReady()}}(this),false);this.player.addEventListener("loadeddata",function(a){return function(){a.onLoaded()}}(this),false);this.player.addEventListener("loadedmetadata",function(a){return function(){a.onLoaded()}}(this), +false);this.player.addEventListener("canplaythrough",function(a){return function(){a.onLoaded()}}(this),false);this.player.addEventListener("ended",function(a){return function(){a.onComplete()}}(this),false);this.player.addEventListener("pause",function(a){return function(){a.onPaused()}}(this),false);this.player.addEventListener("play",function(a){return function(){a.onPlaying()}}(this),false);this.player.addEventListener("playing",function(a){return function(){a.onPlaying()}}(this),false);this.player.addEventListener("error", +function(a){return function(){a.trigger("error","An error occured - "+this.error.code)}}(this),false);this.player.addEventListener("waiting",function(a){return function(){a.onWaiting()}}(this),false);this.player.addEventListener("durationchange",function(a){return function(){a.duration.set(this.duration);a.trigger("durationchange",{duration:this.duration})}}(this),false);this.player.addEventListener("progress",function(a){return function(b){a.bytesTotal.set(b.total);a.bytesLoaded.set(b.loaded)}}(this), +false);this.onReady()}};minplayer.players.html5.prototype.playerFound=function(){return this.display.find(this.mediaFile.type).length>0};minplayer.players.html5.prototype.create=function(){minplayer.players.base.prototype.create.call(this);var a=jQuery(document.createElement(this.mediaFile.type)).attr(this.options.attributes).append(jQuery(document.createElement("source")).attr({src:this.mediaFile.path}));a.eq(0)[0].setAttribute("width","100%");a.eq(0)[0].setAttribute("height","100%");return a}; +minplayer.players.html5.prototype.getPlayer=function(){return this.elements.media.eq(0)[0]};minplayer.players.html5.prototype.load=function(a){if(a){var b=this.elements.media.attr("src");b||(b=jQuery("source",this.elements.media).eq(0).attr("src"));if(b!=a.path){b='';this.elements.media.removeAttr("src").empty().html(b)}}minplayer.players.base.prototype.load.call(this,a)}; +minplayer.players.html5.prototype.play=function(){minplayer.players.base.prototype.play.call(this);this.isReady()&&this.player.play()};minplayer.players.html5.prototype.pause=function(){minplayer.players.base.prototype.pause.call(this);this.isReady()&&this.player.pause()};minplayer.players.html5.prototype.stop=function(){minplayer.players.base.prototype.stop.call(this);if(this.isReady()){this.player.pause();this.player.src=""}}; +minplayer.players.html5.prototype.seek=function(a){minplayer.players.base.prototype.seek.call(this,a);if(this.isReady())this.player.currentTime=a};minplayer.players.html5.prototype.setVolume=function(a){minplayer.players.base.prototype.setVolume.call(this,a);if(this.isReady())this.player.volume=a};minplayer.players.html5.prototype.getVolume=function(a){this.isReady()&&a(this.player.volume)};minplayer.players.html5.prototype.getDuration=function(a){this.isReady()&&a(this.player.duration)}; +minplayer.players.html5.prototype.getCurrentTime=function(a){this.isReady()&&a(this.player.currentTime)}; +minplayer.players.html5.prototype.getBytesLoaded=function(a){if(this.isReady()){var b=0;if(this.bytesLoaded.value)b=this.bytesLoaded.value;else if(this.player.buffered&&this.player.buffered.length>0&&this.player.buffered.end&&this.player.duration)b=this.player.buffered.end(0);else if(this.player.bytesTotal!=void 0&&this.player.bytesTotal>0&&this.player.bufferedBytes!=void 0)b=this.player.bufferedBytes;a(b)}}; +minplayer.players.html5.prototype.getBytesTotal=function(a){if(this.isReady()){var b=0;if(this.bytesTotal.value)b=this.bytesTotal.value;else if(this.player.buffered&&this.player.buffered.length>0&&this.player.buffered.end&&this.player.duration)b=this.player.duration;else if(this.player.bytesTotal!=void 0&&this.player.bytesTotal>0&&this.player.bufferedBytes!=void 0)b=this.player.bytesTotal;a(b)}};minplayer=minplayer||{};minplayer.players=minplayer.players||{}; +minplayer.players.flash=function(a,b,c){minplayer.players.base.call(this,a,b,c)};minplayer.players.flash.prototype=new minplayer.players.base;minplayer.players.flash.prototype.constructor=minplayer.players.flash;minplayer.players.flash.getPriority=function(){return 0};minplayer.players.flash.canPlay=function(){return false}; +minplayer.players.flash.getFlash=function(a){var b=window.location.protocol;b.charAt(b.length-1)==":"&&(b=b.substring(0,b.length-1));var c=jQuery.param(a.flashvars),d;d=' ');d=d+''+ +('');d=d+('');d=d+''+('')+(''};minplayer.players.flash.prototype.playerFound=function(){return this.display.find('object[playerType="flash"]').length>0};minplayer.players.flash.prototype.getPlayer=function(){return jQuery(jQuery.browser.msie?"object":"embed",this.display).eq(0)[0]};minplayer=minplayer||{};minplayer.players=minplayer.players||{};minplayer.players.minplayer=function(a,b,c){minplayer.players.flash.call(this,a,b,c)}; +minplayer.players.minplayer.prototype=new minplayer.players.flash;minplayer.players.minplayer.prototype.constructor=minplayer.players.minplayer;window.onFlashPlayerReady=function(a){if(a=minplayer.get(a,"media"))a.onReady()};window.onFlashPlayerUpdate=function(a,b){var c=minplayer.get(a,"media");if(c)c.onMediaUpdate(b)};window.onFlashPlayerDebug=function(a){minplayer.console.log(a)};minplayer.players.minplayer.getPriority=function(){return 1}; +minplayer.players.minplayer.canPlay=function(a){switch(a.mimetype){case "video/mp4":case "video/x-mp4":case "video/m4v":case "video/x-m4v":case "video/x-webm":case "video/webm":case "application/octet-stream":case "video/quicktime":case "video/3gpp2":case "video/3gpp":case "application/x-shockwave-flash":case "audio/mpeg":case "audio/mp4":case "audio/aac":case "audio/vnd.wave":case "audio/x-ms-wma":return true;default:return false}}; +minplayer.players.minplayer.prototype.create=function(){this.options=jQuery.extend({swfplayer:"flash/minplayer.swf"},this.options);minplayer.players.flash.prototype.create.call(this);return minplayer.players.flash.getFlash({swf:this.options.swfplayer,id:this.options.id+"_player",width:this.options.width,height:"100%",flashvars:{id:this.options.id,debug:this.options.debug,config:"nocontrols",file:this.mediaFile.path,autostart:this.options.autoplay},wmode:this.options.wmode})}; +minplayer.players.minplayer.prototype.onMediaUpdate=function(a){switch(a){case "mediaMeta":this.onLoaded();break;case "mediaPlaying":this.onPlaying();break;case "mediaPaused":this.onPaused();break;case "mediaComplete":this.onComplete()}};minplayer.players.minplayer.prototype.load=function(a){minplayer.players.flash.prototype.load.call(this,a);a&&this.isReady()&&this.player.loadMedia(a.path,a.stream)}; +minplayer.players.minplayer.prototype.play=function(){minplayer.players.flash.prototype.play.call(this);this.isReady()&&this.player.playMedia()};minplayer.players.minplayer.prototype.pause=function(){minplayer.players.flash.prototype.pause.call(this);this.isReady()&&this.player.pauseMedia()};minplayer.players.minplayer.prototype.stop=function(){minplayer.players.flash.prototype.stop.call(this);this.isReady()&&this.player.stopMedia()}; +minplayer.players.minplayer.prototype.seek=function(a){minplayer.players.flash.prototype.seek.call(this,a);this.isReady()&&this.player.seekMedia(a)};minplayer.players.minplayer.prototype.setVolume=function(a){minplayer.players.flash.prototype.setVolume.call(this,a);this.isReady()&&this.player.setVolume(a)};minplayer.players.minplayer.prototype.getVolume=function(a){this.isReady()&&a(this.player.getVolume())}; +minplayer.players.minplayer.prototype.getDuration=function(a){if(this.isReady()){var b=this.player.getDuration();b?a(b):this.poll(function(c){return function(){(b=c.player.getDuration())&&a(b);return!b}}(this),1E3)}};minplayer.players.minplayer.prototype.getCurrentTime=function(a){this.isReady()&&a(this.player.getCurrentTime())};minplayer.players.minplayer.prototype.getBytesLoaded=function(a){this.isReady()&&a(this.player.getMediaBytesLoaded())}; +minplayer.players.minplayer.prototype.getBytesTotal=function(a){this.isReady()&&a(this.player.getMediaBytesTotal())};minplayer=minplayer||{};minplayer.players=minplayer.players||{};minplayer.players.youtube=function(a,b,c){this.quality="default";minplayer.players.base.call(this,a,b,c)};minplayer.players.youtube.prototype=new minplayer.players.base;minplayer.players.youtube.prototype.constructor=minplayer.players.youtube;minplayer.players.youtube.getPriority=function(){return 10}; +minplayer.players.youtube.canPlay=function(a){return a.mimetype==="video/youtube"?true:a.path.search(/^http(s)?\:\/\/(www\.)?youtube\.com/i)===0};minplayer.players.youtube.getMediaId=function(a){var b=/^http[s]?\:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9]+)/i;return a.path.search(b)===0?a.path.match(b)[2]:a.path}; +minplayer.players.youtube.prototype.register=function(){window.onYouTubePlayerAPIReady=function(){jQuery.each(minplayer.get(null,"player"),function(a,b){if(b.currentPlayer=="youtube")b.media.player=new YT.Player(a+"-player",{events:{onReady:function(a){b.media.onReady(a)},onStateChange:function(a){b.media.onPlayerStateChange(a)},onPlaybackQualityChange:function(a){b.media.onQualityChange(a)},onError:function(a){b.media.onError(a)}}})})}}; +minplayer.players.youtube.prototype.setPlayerState=function(a){switch(a){case YT.PlayerState.BUFFERING:this.onWaiting();break;case YT.PlayerState.PAUSED:this.onPaused();break;case YT.PlayerState.PLAYING:this.onPlaying();break;case YT.PlayerState.ENDED:this.onComplete()}};minplayer.players.youtube.prototype.onReady=function(){minplayer.players.base.prototype.onReady.call(this);this.onLoaded()}; +minplayer.players.youtube.prototype.playerFound=function(){return this.display.find("iframe#"+this.options.id+"-player").length>0};minplayer.players.youtube.prototype.onPlayerStateChange=function(a){this.setPlayerState(a.data)};minplayer.players.youtube.prototype.onQualityChange=function(a){this.quality=a.data};minplayer.players.youtube.prototype.hasPlayLoader=function(){return true}; +minplayer.players.youtube.prototype.create=function(){minplayer.players.base.prototype.create.call(this);var a=document.createElement("script");a.src="http://www.youtube.com/player_api?enablejsapi=1";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b);this.register();a=document.createElement("iframe");a.setAttribute("id",this.options.id+"-player");a.setAttribute("type","text/html");a.setAttribute("width","100%");a.setAttribute("height","100%");a.setAttribute("frameborder", +"0");var b="http://www.youtube.com/embed/"+(this.mediaFile.id+"?"),c=location.protocol,c=c+("//"+location.hostname),c=c+(location.port&&":"+location.port),b=b+jQuery.param({wmode:"opaque",controls:0,enablejsapi:1,origin:c,autoplay:this.options.autoplay,loop:this.options.loop});a.setAttribute("src",b);return a};minplayer.players.youtube.prototype.load=function(a){minplayer.players.base.prototype.load.call(this,a);a&&this.isReady()&&this.player.loadVideoById(a.id,0,this.quality)}; +minplayer.players.youtube.prototype.play=function(){minplayer.players.base.prototype.play.call(this);this.isReady()&&this.player.playVideo()};minplayer.players.youtube.prototype.pause=function(){minplayer.players.base.prototype.pause.call(this);this.isReady()&&this.player.pauseVideo()};minplayer.players.youtube.prototype.stop=function(){minplayer.players.base.prototype.stop.call(this);this.isReady()&&this.player.stopVideo()}; +minplayer.players.youtube.prototype.seek=function(a){minplayer.players.base.prototype.seek.call(this,a);this.isReady()&&this.player.seekTo(a,true)};minplayer.players.youtube.prototype.setVolume=function(a){minplayer.players.base.prototype.setVolume.call(this,a);this.isReady()&&this.player.setVolume(a*100)};minplayer.players.youtube.prototype.getVolume=function(a){this.isReady()&&a(this.player.getVolume())};minplayer.players.youtube.prototype.getDuration=function(a){this.isReady()&&a(this.player.getDuration())}; +minplayer.players.youtube.prototype.getCurrentTime=function(a){this.isReady()&&a(this.player.getCurrentTime())};minplayer.players.youtube.prototype.getBytesStart=function(a){this.isReady()&&a(this.player.getVideoStartBytes())};minplayer.players.youtube.prototype.getBytesLoaded=function(a){this.isReady()&&a(this.player.getVideoBytesLoaded())};minplayer.players.youtube.prototype.getBytesTotal=function(a){this.isReady()&&a(this.player.getVideoBytesTotal())};minplayer=minplayer||{}; +minplayer.players=minplayer.players||{};minplayer.players.vimeo=function(a,b,c){minplayer.players.base.call(this,a,b,c)};minplayer.players.vimeo.prototype=new minplayer.players.base;minplayer.players.vimeo.prototype.constructor=minplayer.players.vimeo;minplayer.players.vimeo.getPriority=function(){return 10};minplayer.players.vimeo.canPlay=function(a){return a.mimetype==="video/vimeo"?true:a.path.search(/^http(s)?\:\/\/(www\.)?vimeo\.com/i)===0}; +minplayer.players.vimeo.getMediaId=function(a){var b=/^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i;return a.path.search(b)===0?a.path.match(b)[3]:a.path};minplayer.players.vimeo.prototype.reset=function(){minplayer.players.base.prototype.reset.call(this)}; +minplayer.players.vimeo.prototype.create=function(){minplayer.players.base.prototype.create.call(this);var a=document.createElement("script");a.src="http://a.vimeocdn.com/js/froogaloop2.min.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b);var c=document.createElement("iframe");c.setAttribute("id",this.options.id+"-player");c.setAttribute("type","text/html");c.setAttribute("width","100%");c.setAttribute("height","100%");c.setAttribute("frameborder","0");a="http://player.vimeo.com/video/"+ +(this.mediaFile.id+"?");a=a+jQuery.param({wmode:"opaque",api:1,player_id:this.options.id+"-player",title:0,byline:0,portrait:0,autoplay:this.options.autoplay,loop:this.options.loop});c.setAttribute("src",a);this.poll(function(a){return function(){if(window.Froogaloop){a.player=window.Froogaloop(c);a.player.addEvent("ready",function(){a.onReady()})}return!window.Froogaloop}}(this),200);this.trigger("loadstart");return c}; +minplayer.players.vimeo.prototype.onReady=function(){this.player.addEvent("loadProgress",function(a){return function(b){a.duration.set(parseFloat(b.duration));a.bytesLoaded.set(b.bytesLoaded);a.bytesTotal.set(b.bytesTotal)}}(this));this.player.addEvent("playProgress",function(a){return function(b){a.duration.set(parseFloat(b.duration));a.currentTime.set(parseFloat(b.seconds))}}(this));this.player.addEvent("play",function(a){return function(){a.onPlaying()}}(this));this.player.addEvent("pause",function(a){return function(){a.onPaused()}}(this)); +this.player.addEvent("finish",function(a){return function(){a.onComplete()}}(this));minplayer.players.base.prototype.onReady.call(this);this.onLoaded()};minplayer.players.vimeo.prototype.playerFound=function(){return this.display.find("iframe#"+this.options.id+"-player").length>0};minplayer.players.vimeo.prototype.play=function(){minplayer.players.base.prototype.play.call(this);this.isReady()&&this.player.api("play")}; +minplayer.players.vimeo.prototype.pause=function(){minplayer.players.base.prototype.pause.call(this);this.isReady()&&this.player.api("pause")};minplayer.players.vimeo.prototype.stop=function(){minplayer.players.base.prototype.stop.call(this);this.isReady()&&this.player.api("unload")};minplayer.players.vimeo.prototype.seek=function(a){minplayer.players.base.prototype.seek.call(this,a);this.isReady()&&this.player.api("seekTo",a)}; +minplayer.players.vimeo.prototype.setVolume=function(a){minplayer.players.base.prototype.setVolume.call(this,a);if(this.isReady()){this.volume.set(a);this.player.api("setVolume",a)}};minplayer.players.vimeo.prototype.getVolume=function(a){this.player.api("getVolume",function(b){a(b)})};minplayer.players.vimeo.prototype.getDuration=function(a){this.isReady()&&(this.duration.value?a(this.duration.value):this.player.api("getDuration",function(b){a(b)}))};minplayer=minplayer||{}; +minplayer.controller=function(a,b){minplayer.display.call(this,"controller",a,b)};minplayer.controller.prototype=new minplayer.display;minplayer.controller.prototype.constructor=minplayer.controller;minplayer.formatTime=function(a){var a=a||0,b=0,c=0,d=0,e="",d=Math.floor(a/3600),a=a-d*3600,c=Math.floor(a/60),b=Math.floor((a-c*60)%60);d&&(e=e+(""+d)+":");return{time:e+(c>=10?""+c:"0"+c)+":"+(b>=10?""+b:"0"+b),units:""}}; +minplayer.controller.prototype.getElements=function(){var a=minplayer.display.prototype.getElements.call(this);return jQuery.extend(a,{play:null,pause:null,fullscreen:null,seek:null,progress:null,volume:null,timer:null})}; +minplayer.controller.prototype.construct=function(){minplayer.display.prototype.construct.call(this);this.dragging=false;if(this.elements.seek)this.seekBar=this.elements.seek.slider({range:"min"});if(this.elements.volume)this.volumeBar=this.elements.volume.slider({range:"min",orientation:"vertical"});this.get("player",function(a){this.elements.fullscreen&&this.elements.fullscreen.unbind().bind("click",function(){a.toggleFullScreen()}).css({pointer:"hand"})});this.get("media",function(a){if(this.elements.pause){this.elements.pause.unbind().bind("click", +function(b){return function(c){c.preventDefault();b.playPause(false,a)}}(this));a.bind("pause",function(a){return function(){a.setPlayPause(true)}}(this))}if(this.elements.play){this.elements.play.unbind().bind("click",function(b){return function(c){c.preventDefault();b.playPause(true,a)}}(this));a.bind("playing",function(a){return function(){a.setPlayPause(false)}}(this))}if(this.elements.duration){a.bind("durationchange",function(a){return function(c,d){a.setTimeString("duration",d.duration)}}(this)); +a.getDuration(function(a){return function(c){a.setTimeString("duration",c)}}(this))}this.elements.progress&&a.bind("progress",function(a){return function(c,d){a.elements.progress.width((d.total?d.loaded/d.total*100:0)+"%")}}(this));(this.seekBar||this.elements.timer)&&a.bind("timeupdate",function(a){return function(c,d){if(!a.dragging){var e=0;d.duration&&(e=d.currentTime/d.duration*100);a.seekBar&&a.seekBar.slider("option","value",e);a.setTimeString("timer",d.currentTime)}}}(this));this.seekBar&& +this.seekBar.slider({start:function(a){return function(){a.dragging=true}}(this),stop:function(b){return function(c,d){b.dragging=false;a.getDuration(function(b){a.seek(d.value/100*b)})}}(this),slide:function(b){return function(c,d){a.getDuration(function(c){c=d.value/100*c;b.dragging||a.seek(c);b.setTimeString("timer",c)})}}(this)});if(this.volumeBar){this.volumeBar.slider({slide:function(b,c){a.setVolume(c.value/100)}});a.bind("volumeupdate",function(a){return function(c,d){a.volumeBar.slider("option", +"value",d*100)}}(this));a.getVolume(function(a){return function(c){a.volumeBar.slider("option","value",c*100)}}(this))}});this.ready()};minplayer.controller.prototype.setPlayPause=function(a){this.elements.play&&this.elements.play.css("display",a?"inherit":"none");this.elements.pause&&this.elements.pause.css("display",a?"none":"inherit")};minplayer.controller.prototype.playPause=function(a,b){var c=a?"play":"pause";this.display.trigger(c);this.setPlayPause(!a);if(b)b[c]()}; +minplayer.controller.prototype.setTimeString=function(a,b){this.elements[a]&&this.elements[a].text(minplayer.formatTime(b).time)}; diff --git a/minplayer/bin/minplayer.js b/minplayer/bin/minplayer.js new file mode 100644 index 00000000..16950e28 --- /dev/null +++ b/minplayer/bin/minplayer.js @@ -0,0 +1,4167 @@ +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +// Private function to check a single element's play type. +function checkPlayType(elem, playType) { + if ((typeof elem.canPlayType) === 'function') { + if (typeof playType === 'object') { + var i = playType.length; + var mimetype = ''; + while (i--) { + mimetype = checkPlayType(elem, playType[i]); + if (!!mimetype) { + break; + } + } + return mimetype; + } + else { + var canPlay = elem.canPlayType(playType); + if (('no' !== canPlay) && ('' !== canPlay)) { + return playType; + } + } + } + return ''; +} + +/** + * @constructor + * @class This class is used to define the types of media that can be played + * within the browser. + *

+ * Usage: + *


+ *   var playTypes = new minplayer.compatibility();
+ *
+ *   if (playTypes.videoOGG) {
+ *     console.log("This browser can play OGG video");
+ *   }
+ *
+ *   if (playTypes.videoH264) {
+ *     console.log("This browser can play H264 video");
+ *   }
+ *
+ *   if (playTypes.videoWEBM) {
+ *     console.log("This browser can play WebM video");
+ *   }
+ *
+ *   if (playTypes.audioOGG) {
+ *     console.log("This browser can play OGG audio");
+ *   }
+ *
+ *   if (playTypes.audioMP3) {
+ *     console.log("This browser can play MP3 audio");
+ *   }
+ *
+ *   if (playTypes.audioMP4) {
+ *     console.log("This browser can play MP4 audio");
+ *   }
+ * 
+ */ +minplayer.compatibility = function() { + var elem = null; + + // Create a video element. + elem = document.createElement('video'); + + /** Can play OGG video */ + this.videoOGG = checkPlayType(elem, 'video/ogg'); + + /** Can play H264 video */ + this.videoH264 = checkPlayType(elem, [ + 'video/mp4', + 'video/h264' + ]); + + /** Can play WEBM video */ + this.videoWEBM = checkPlayType(elem, [ + 'video/x-webm', + 'video/webm', + 'application/octet-stream' + ]); + + // Create an audio element. + elem = document.createElement('audio'); + + /** Can play audio OGG */ + this.audioOGG = checkPlayType(elem, 'audio/ogg'); + + /** Can play audio MP3 */ + this.audioMP3 = checkPlayType(elem, 'audio/mpeg'); + + /** Can play audio MP4 */ + this.audioMP4 = checkPlayType(elem, 'audio/mp4'); +}; + +if (!minplayer.playTypes) { + + /** The compatible playtypes for this browser. */ + minplayer.playTypes = new minplayer.compatibility(); +} +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** + * @constructor + * @class This class keeps track of asynchronous get requests for certain + * variables within the player. + */ +minplayer.async = function() { + + /** The final value of this asynchronous variable. */ + this.value = null; + + /** The queue of callbacks to call when this value is determined. */ + this.queue = []; +}; + +/** + * Retrieve the value of this variable. + * + * @param {function} callback The function to call when the value is determined. + * @param {function} pollValue The poll function to try and get the value every + * 1 second if the value is not set. + */ +minplayer.async.prototype.get = function(callback, pollValue) { + + // If the value is set, then immediately call the callback, otherwise, just + // add it to the queue when the variable is set. + if (this.value !== null) { + callback(this.value); + } + else { + + // Add this callback to the queue. + this.queue.push(callback); + } +}; + +/** + * Sets the value of an asynchronous value. + * + * @param {void} val The value to set. + */ +minplayer.async.prototype.set = function(val) { + + // Set the value. + this.value = val; + + // Get the callback queue length. + var i = this.queue.length; + + // Iterate through all the callbacks and call them. + if (i) { + while (i--) { + this.queue[i](val); + } + + // Reset the queue. + this.queue = []; + } +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** + * @constructor + * @class This is a class used to keep track of flag states + * which is used to control the busy cursor, big play button, among other + * items in which multiple components can have an interest in hiding or + * showing a single element on the screen. + * + *

+ * Usage: + *


+ *   // Declare a flags variable.
+ *   var flags = new minplayer.flags();
+ *
+ *   // Set the flag based on two components interested in the flag.
+ *   flags.setFlag("component1", true);
+ *   flags.setFlag("component2", true);
+ *
+ *   // Print out the value of the flags. ( Prints 3 )
+ *   console.log(flags.flags);
+ *
+ *   // Now unset a single components flag.
+ *   flags.setFlag("component1", false);
+ *
+ *   // Print out the value of the flags.
+ *   console.log(flags.flags);
+ *
+ *   // Unset the other components flag.
+ *   flags.setFlag("component2", false);
+ *
+ *   // Print out the value of the flags.
+ *   console.log(flags.flags);
+ * 
+ *

+ */ +minplayer.flags = function() { + + /** The flag. */ + this.flag = 0; + + /** Id map to reference id with the flag index. */ + this.ids = {}; + + /** The number of flags. */ + this.numFlags = 0; +}; + +/** + * Sets a flag based on boolean logic operators. + * + * @param {string} id The id of the controller interested in this flag. + * @param {boolean} value The value of this flag ( true or false ). + */ +minplayer.flags.prototype.setFlag = function(id, value) { + + // Define this id if it isn't present. + if (!this.ids.hasOwnProperty(id)) { + this.ids[id] = this.numFlags; + this.numFlags++; + } + + // Use binary operations to keep track of the flag state + if (value) { + this.flag |= (1 << this.ids[id]); + } + else { + this.flag &= ~(1 << this.ids[id]); + } +}; +/** The minplayer namespace. */ +minplayer = minplayer || {}; + +/** Static array to keep track of all plugins. */ +minplayer.plugins = minplayer.plugins || {}; + +/** Static array to keep track of queues. */ +minplayer.queue = minplayer.queue || []; + +/** Mutex lock to keep multiple triggers from occuring. */ +minplayer.lock = false; + +/** + * @constructor + * @class The base class for all plugins. + * + * @param {string} name The name of this plugin. + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.plugin = function(name, context, options, queue) { + + /** The name of this plugin. */ + this.name = name; + + /** The ready flag. */ + this.pluginReady = false; + + /** The options for this plugin. */ + this.options = options || {}; + + /** The event queue. */ + this.queue = queue || {}; + + /** Keep track of already triggered events. */ + this.triggered = {}; + + /** Create a queue lock. */ + this.lock = false; + + // Only call the constructor if we have a context. + if (context) { + + /** Keep track of the context. */ + this.context = context; + + // Construct this plugin. + this.construct(); + } +}; + +/** + * The constructor which is called once the context is set. + * Any class deriving from the plugin class should place all context + * dependant functionality within this function instead of the standard + * constructor function since it is called on object derivation as well + * as object creation. + */ +minplayer.plugin.prototype.construct = function() { + + // Adds this as a plugin. + this.addPlugin(); +}; + +/** + * Destructor. + */ +minplayer.plugin.prototype.destroy = function() { + + // Unbind all events. + this.unbind(); +}; + +/** + * Creates a new plugin within this context. + * + * @param {string} name The name of the plugin you wish to create. + * @param {object} base The base object for this plugin. + * @param {object} context The context which you would like to create. + * @return {object} The new plugin object. + */ +minplayer.plugin.prototype.create = function(name, base, context) { + var plugin = null; + + // Make sure we have a base object. + base = base || 'minplayer'; + + // Make sure there is a context. + context = context || this.display; + + // See if this plugin exists within this object. + if (window[base][name]) { + + // Set the plugin. + plugin = window[base][name]; + + // See if a template version of the plugin exists. + if (plugin[this.options.template]) { + + plugin = plugin[this.options.template]; + } + + // Create the new plugin. + return new plugin(context, this.options); + } + + return null; +}; + +/** + * Plugins should call this method when they are ready. + */ +minplayer.plugin.prototype.ready = function() { + + // Keep this plugin from triggering multiple ready events. + if (!this.pluginReady) { + + // Set the ready flag. + this.pluginReady = true; + + // Now trigger that I am ready. + this.trigger('ready'); + + // Check the queue. + this.checkQueue(); + } +}; + +/** + * Adds a new plugin to this player. + * + * @param {string} name The name of this plugin. + * @param {object} plugin A new plugin object, derived from media.plugin. + */ +minplayer.plugin.prototype.addPlugin = function(name, plugin) { + name = name || this.name; + plugin = plugin || this; + + // Make sure the plugin is valid. + if (plugin.isValid()) { + + // If the plugins for this instance do not exist. + if (!minplayer.plugins[this.options.id]) { + + // Initialize the plugins. + minplayer.plugins[this.options.id] = {}; + } + + // Add this plugin. + minplayer.plugins[this.options.id][name] = plugin; + } +}; + +/** + * Create a polling timer. + * + * @param {function} callback The function to call when you poll. + * @param {integer} interval The interval you would like to poll. + */ +minplayer.plugin.prototype.poll = function(callback, interval) { + setTimeout((function(context) { + return function callLater() { + if (callback.call(context)) { + setTimeout(callLater, interval); + } + }; + })(this), interval); +}; + +/** + * Gets a plugin by name and calls callback when it is ready. + * + * @param {string} plugin The plugin of the plugin. + * @param {function} callback Called when the plugin is ready. + * @return {object} The plugin if no callback is provided. + */ +minplayer.plugin.prototype.get = function(plugin, callback) { + + // If they pass just a callback, then return all plugins when ready. + if (typeof plugin === 'function') { + callback = plugin; + plugin = null; + } + + // Return the minplayer.get equivalent. + return minplayer.get.call(this, this.options.id, plugin, callback); +}; + +/** + * Check the queue and execute it. + */ +minplayer.plugin.prototype.checkQueue = function() { + + // Initialize our variables. + var q = null, i = 0, check = false, newqueue = []; + + // Set the lock. + minplayer.lock = true; + + // Iterate through all the queues. + var length = minplayer.queue.length; + for (i = 0; i < length; i++) { + + // Get the queue. + q = minplayer.queue[i]; + + // Now check to see if this queue is about us. + check = !q.id && !q.plugin; + check |= (q.plugin == this.name) && (!q.id || (q.id == this.options.id)); + + // If the check passes... + if (check) { + check = minplayer.bind.call( + q.context, + q.event, + this.options.id, + this.name, + q.callback + ); + } + + // Add the queue back if it doesn't check out. + if (!check) { + + // Add this back to the queue. + newqueue.push(q); + } + } + + // Set the old queue to the new queue. + minplayer.queue = newqueue; + + // Release the lock. + minplayer.lock = false; +}; + +/** + * Trigger a media event. + * + * @param {string} type The event type. + * @param {object} data The event data object. + * @return {object} The plugin object. + */ +minplayer.plugin.prototype.trigger = function(type, data) { + data = data || {}; + data.plugin = this; + + // Add this to our triggered array. + this.triggered[type] = data; + + // Check to make sure the queue for this type exists. + if (this.queue.hasOwnProperty(type)) { + + var i = 0, queue = {}; + + // Iterate through all the callbacks in this queue. + for (i in this.queue[type]) { + + // Setup the event object, and call the callback. + queue = this.queue[type][i]; + queue.callback({target: this, data: queue.data}, data); + } + } + + // Return the plugin object. + return this; +}; + +/** + * Bind to a media event. + * + * @param {string} type The event type. + * @param {object} data The data to bind with the event. + * @param {function} fn The callback function. + * @return {object} The plugin object. + **/ +minplayer.plugin.prototype.bind = function(type, data, fn) { + + // Allow the data to be the callback. + if (typeof data === 'function') { + fn = data; + data = null; + } + + // You must bind to a specific event and have a callback. + if (!type || !fn) { + return; + } + + // Initialize the queue for this type. + this.queue[type] = this.queue[type] || []; + + // Unbind any existing equivalent events. + this.unbind(type, fn); + + // Now add this event to the queue. + this.queue[type].push({ + callback: fn, + data: data + }); + + // Now see if this event has already been triggered. + if (this.triggered[type]) { + + // Go ahead and trigger the event. + fn({target: this, data: data}, this.triggered[type]); + } + + // Return the plugin. + return this; +}; + +/** + * Unbind a media event. + * + * @param {string} type The event type. + * @param {function} fn The callback function. + * @return {object} The plugin object. + **/ +minplayer.plugin.prototype.unbind = function(type, fn) { + + // If this is locked then try again after 10ms. + if (this.lock) { + setTimeout((function(plugin) { + return function() { + plugin.unbind(type, fn); + }; + })(this), 10); + } + + // Set the lock. + this.lock = true; + + if (!type) { + this.queue = {}; + } + else if (!fn) { + this.queue[type] = []; + } + else { + // Iterate through all the callbacks and search for equal callbacks. + var i = 0, queue = {}; + for (i in this.queue[type]) { + if (this.queue[type][i].callback === fn) { + queue = this.queue[type].splice(1, 1); + delete queue; + } + } + } + + // Reset the lock. + this.lock = false; + + // Return the plugin. + return this; +}; + +/** + * Adds an item to the queue. + * + * @param {object} context The context which this is called within. + * @param {string} event The event to trigger on. + * @param {string} id The player ID. + * @param {string} plugin The name of the plugin. + * @param {function} callback Called when the event occurs. + */ +minplayer.addQueue = function(context, event, id, plugin, callback) { + + // See if it is locked... + if (!minplayer.lock) { + minplayer.queue.push({ + context: context, + id: id, + event: event, + plugin: plugin, + callback: callback + }); + } + else { + + // If so, then try again after 10 milliseconds. + setTimeout(function() { + minplayer.addQueue(context, id, event, plugin, callback); + }, 10); + } +}; + +/** + * Binds an event to a plugin instance, and if it doesn't exist, then caches + * it for a later time. + * + * @param {string} event The event to trigger on. + * @param {string} id The player ID. + * @param {string} plugin The name of the plugin. + * @param {function} callback Called when the event occurs. + * @return {boolean} If the bind was successful. + * @this The object in context who called this method. + */ +minplayer.bind = function(event, id, plugin, callback) { + + // If no callback exists, then just return false. + if (!callback) { + return false; + } + + // Get the plugins. + var inst = minplayer.plugins; + + // See if this plugin exists. + if (inst[id][plugin]) { + + // If so, then bind the event to this plugin. + inst[id][plugin].bind(event, {context: this}, function(event, data) { + callback.call(event.data.context, data.plugin); + }); + return true; + } + + // If not, then add it to the queue to bind later. + minplayer.addQueue(this, event, id, plugin, callback); + + // Return that this wasn't handled. + return false; +}; + +/** + * The main API for minPlayer. + * + * Provided that this function takes three parameters, there are 8 different + * ways to use this api. + * + * id (0x100) - You want a specific player. + * plugin (0x010) - You want a specific plugin. + * callback (0x001) - You only want it when it is ready. + * + * 000 - You want all plugins from all players, ready or not. + * + * var plugins = minplayer.get(); + * + * 001 - You want all plugins from all players, but only when ready. + * + * minplayer.get(function(plugin) { + * // Code goes here. + * }); + * + * 010 - You want a specific plugin from all players, ready or not... + * + * var medias = minplayer.get(null, 'media'); + * + * 011 - You want a specific plugin from all players, but only when ready. + * + * minplayer.get('player', function(player) { + * // Code goes here. + * }); + * + * 100 - You want all plugins from a specific player, ready or not. + * + * var plugins = minplayer.get('player_id'); + * + * 101 - You want all plugins from a specific player, but only when ready. + * + * minplayer.get('player_id', null, function(plugin) { + * // Code goes here. + * }); + * + * 110 - You want a specific plugin from a specific player, ready or not. + * + * var plugin = minplayer.get('player_id', 'media'); + * + * 111 - You want a specific plugin from a specific player, only when ready. + * + * minplayer.get('player_id', 'media', function(media) { + * // Code goes here. + * }); + * + * @this The context in which this function was called. + * @param {string} id The ID of the widget to get the plugins from. + * @param {string} plugin The name of the plugin. + * @param {function} callback Called when the plugin is ready. + * @return {object} The plugin object if it is immediately available. + */ +minplayer.get = function(id, plugin, callback) { + + // Normalize the arguments for a better interface. + if (typeof id === 'function') { + callback = id; + plugin = id = null; + } + + if (typeof plugin === 'function') { + callback = plugin; + plugin = id; + id = null; + } + + // Make sure the callback is a callback. + callback = (typeof callback === 'function') ? callback : null; + + // Get the plugins. + var plugins = minplayer.plugins; + + // 0x000 + if (!id && !plugin && !callback) { + return plugins; + } + // 0x100 + else if (id && !plugin && !callback) { + return plugins[id]; + } + // 0x110 + else if (id && plugin && !callback) { + return plugins[id][plugin]; + } + // 0x111 + else if (id && plugin && callback) { + minplayer.bind.call(this, 'ready', id, plugin, callback); + } + // 0x011 + else if (!id && plugin && callback) { + for (var id in plugins) { + minplayer.bind.call(this, 'ready', id, plugin, callback); + } + } + // 0x101 + else if (id && !plugin && callback) { + for (var plugin in plugins[id]) { + minplayer.bind.call(this, 'ready', id, plugin, callback); + } + } + // 0x010 + else if (!id && plugin && !callback) { + var plugin_types = {}; + for (var id in plugins) { + if (plugins.hasOwnProperty(id) && plugins[id].hasOwnProperty(plugin)) { + plugin_types[id] = plugins[id][plugin]; + } + } + return plugin_types; + } + // 0x001 + else { + for (var id in plugins) { + for (var plugin in plugins[id]) { + minplayer.bind.call(this, 'ready', id, plugin, callback); + } + } + } +}; +/** The minplayer namespace. */ +minplayer = minplayer || {}; + +/** + * @constructor + * @extends minplayer.plugin + * @class Base class used to provide the display and options for any component + * deriving from this class. Components who derive are expected to provide + * the elements that they define by implementing the getElements method. + * + * @param {string} name The name of this plugin. + * @param {object} context The jQuery context this component resides. + * @param {object} options The options for this component. + * @param {object} queue The event queue to pass events around. + */ +minplayer.display = function(name, context, options, queue) { + + // See if we allow resize on this display. + this.allowResize = false; + + if (context) { + + // Set the display. + this.display = this.getDisplay(context, options); + } + + // Derive from plugin + minplayer.plugin.call(this, name, context, options, queue); +}; + +/** Derive from minplayer.plugin. */ +minplayer.display.prototype = new minplayer.plugin(); + +/** Reset the constructor. */ +minplayer.display.prototype.constructor = minplayer.display; + +/** + * Returns the display for this component. + * + * @param {object} context The original context. + * @param {object} options The options for this component. + * @return {object} The jQuery context for this display. + */ +minplayer.display.prototype.getDisplay = function(context, options) { + return jQuery(context); +}; + +/** + * @see minplayer.plugin.construct + */ +minplayer.display.prototype.construct = function() { + + // Call the plugin constructor. + minplayer.plugin.prototype.construct.call(this); + + // Get the display elements. + this.elements = this.getElements(); + + // Only do this if they allow resize for this display. + if (this.allowResize) { + + // Set the resize timeout and this pointer. + var resizeTimeout = 0; + + // Add a handler to trigger a resize event. + jQuery(window).resize((function(display) { + return function() { + clearTimeout(resizeTimeout); + resizeTimeout = setTimeout(function() { + display.onResize(); + }, 200); + }; + })(this)); + } +}; + +/** + * Called when the window resizes. + */ +minplayer.display.prototype.onResize = function() { +}; + +/** + * Gets the full screen element. + * + * @return {object} The display to be used for full screen support. + */ +minplayer.display.prototype.fullScreenElement = function() { + return this.display; +}; + +/** + * Called if you would like for your display item to show then hide. + * + * @param {object} element The element you would like to hide or show. + * @param {number} timeout The timeout to hide and show. + */ +minplayer.showThenHide = function(element, timeout) { + + // Ensure we have a timeout. + timeout = timeout || 5000; + + // If this has not yet been configured. + if (!element.showTimer) { + + // Bind when they move the mouse. + jQuery(document).bind('mousemove', function() { + minplayer.showThenHide(element, timeout); + }); + } + + // Clear the timeout, and then setup the show then hide functionality. + clearTimeout(element.showTimer); + + // Show the display. + element.show(); + + // Set a timer to hide it after the timeout. + element.showTimer = setTimeout(function() { + element.hide('slow'); + }, timeout); +}; + +/** + * Make this display element go fullscreen. + * + * @param {boolean} full Tell the player to go into fullscreen or not. + */ +minplayer.display.prototype.fullscreen = function(full) { + var isFull = this.isFullScreen(); + var element = this.fullScreenElement(); + if (isFull && !full) { + element.removeClass('fullscreen'); + if (screenfull) { + screenfull.exit(); + } + this.trigger('fullscreen', false); + } + else if (!isFull && full) { + element.addClass('fullscreen'); + if (screenfull) { + screenfull.request(element[0]); + screenfull.onchange = (function(display) { + return function(e) { + if (!screenfull.isFullscreen) { + display.fullscreen(false); + } + }; + })(this); + } + this.trigger('fullscreen', true); + } +}; + +/** + * Toggle fullscreen. + */ +minplayer.display.prototype.toggleFullScreen = function() { + this.fullscreen(!this.isFullScreen()); +}; + +/** + * Checks to see if we are in fullscreen mode. + * + * @return {boolean} TRUE - fullscreen, FALSE - otherwise. + */ +minplayer.display.prototype.isFullScreen = function() { + return this.fullScreenElement().hasClass('fullscreen'); +}; + +/** + * Returns a scaled rectangle provided a ratio and the container rect. + * + * @param {number} ratio The width/height ratio of what is being scaled. + * @param {object} rect The bounding rectangle for scaling. + * @return {object} The Rectangle object of the scaled rectangle. + */ +minplayer.display.prototype.getScaledRect = function(ratio, rect) { + var scaledRect = {}; + scaledRect.x = rect.x ? rect.x : 0; + scaledRect.y = rect.y ? rect.y : 0; + scaledRect.width = rect.width ? rect.width : 0; + scaledRect.height = rect.height ? rect.height : 0; + if (ratio) { + if ((rect.width / rect.height) > ratio) { + scaledRect.height = rect.height; + scaledRect.width = Math.floor(rect.height * ratio); + } + else { + scaledRect.height = Math.floor(rect.width / ratio); + scaledRect.width = rect.width; + } + scaledRect.x = Math.floor((rect.width - scaledRect.width) / 2); + scaledRect.y = Math.floor((rect.height - scaledRect.height) / 2); + } + return scaledRect; +}; + +/** + * Returns all the jQuery elements that this component uses. + * + * @return {object} An object which defines all the jQuery elements that + * this component uses. + */ +minplayer.display.prototype.getElements = function() { + return {}; +}; + +/** + * Returns if this component is valid and exists within the DOM. + * + * @return {boolean} TRUE if the plugin display is valid. + */ +minplayer.display.prototype.isValid = function() { + return (this.display.length > 0); +}; + +/** + * From https://github.com/sindresorhus/screenfull.js + */ +/*global Element:true*/ +(function(window, document) { + 'use strict'; + var methods = (function() { + var methodMap = [ + [ + 'requestFullscreen', + 'exitFullscreen', + 'fullscreenchange', + 'fullscreen', + 'fullscreenElement' + ], + [ + 'webkitRequestFullScreen', + 'webkitCancelFullScreen', + 'webkitfullscreenchange', + 'webkitIsFullScreen', + 'webkitCurrentFullScreenElement' + ], + [ + 'mozRequestFullScreen', + 'mozCancelFullScreen', + 'mozfullscreenchange', + 'mozFullScreen', + 'mozFullScreenElement' + ] + ]; + for (var i = 0, l = methodMap.length; i < l; i++) { + var val = methodMap[i]; + if (val[1] in document) { + return val; + } + } + })(); + + if (!methods) { + return window.screenfull = false; + } + + var keyboardAllowed = 'ALLOW_KEYBOARD_INPUT' in Element; + + var screenfull = { + init: function() { + document.addEventListener(methods[2], function(e) { + screenfull.isFullscreen = document[methods[3]]; + screenfull.element = document[methods[4]]; + screenfull.onchange(e); + }); + return this; + }, + isFullscreen: document[methods[3]], + element: document[methods[4]], + request: function(elem) { + elem = elem || document.documentElement; + elem[methods[0]](keyboardAllowed && Element.ALLOW_KEYBOARD_INPUT); + // Work around Safari 5.1 bug: reports support for keyboard in fullscreen + // even though it doesn't. + if (!document.isFullscreen) { + elem[methods[0]](); + } + }, + exit: function() { + document[methods[1]](); + }, + toggle: function(elem) { + if (this.isFullscreen) { + this.exit(); + } else { + this.request(elem); + } + }, + onchange: function() {} + }; + + window.screenfull = screenfull.init(); +})(window, document); +// Add a way to instanciate using jQuery prototype. +if (!jQuery.fn.minplayer) { + + /** + * @constructor + * + * Define a jQuery minplayer prototype. + * + * @param {object} options The options for this jQuery prototype. + * @return {Array} jQuery object. + */ + jQuery.fn.minplayer = function(options) { + return jQuery(this).each(function() { + options = options || {}; + options.id = options.id || $(this).attr('id') || Math.random(); + if (!minplayer.plugins[options.id]) { + options.template = options.template || 'default'; + if (minplayer[options.template]) { + new minplayer[options.template](jQuery(this), options); + } + else { + new minplayer(jQuery(this), options); + } + } + }); + }; +} + +/** + * @constructor + * @extends minplayer.display + * @class The core media player class which governs the media player + * functionality. + * + *

Usage: + *


+ *
+ *   // Create a media player.
+ *   var player = jQuery("#player").minplayer({
+ *
+ *   });
+ *
+ * 
+ *

+ * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +minplayer = jQuery.extend(function(context, options) { + + // Derive from display + minplayer.display.call(this, 'player', context, options); +}, minplayer); + +/** Derive from minplayer.display. */ +minplayer.prototype = new minplayer.display(); + +/** Reset the constructor. */ +minplayer.prototype.constructor = minplayer; + +/** + * Define a way to debug. + */ +minplayer.console = console || {log: function(data) {}}; + +/** + * @see minplayer.plugin.construct + */ +minplayer.prototype.construct = function() { + + // Allow them to provide arguments based off of the DOM attributes. + jQuery.each(this.context[0].attributes, (function(player) { + return function(index, attr) { + player.options[attr.name] = player.options[attr.name] || attr.value; + }; + })(this)); + + // Make sure we provide default options... + this.options = jQuery.extend({ + id: 'player', + build: false, + wmode: 'transparent', + preload: true, + autoplay: false, + loop: false, + width: '100%', + height: '350px', + debug: false, + volume: 80, + files: [], + file: '', + preview: '', + attributes: {} + }, this.options); + + // Call the minplayer display constructor. + minplayer.display.prototype.construct.call(this); + + /** The controller for this player. */ + this.controller = this.create('controller'); + + /** The play loader for this player. */ + this.playLoader = this.create('playLoader'); + + /** Variable to store the current media player. */ + this.currentPlayer = 'html5'; + + // Add key events to the window. + this.addKeyEvents(); + + // Now load these files. + this.load(this.getFiles()); + + // Add the player events. + this.addEvents(); + + // The player is ready. + this.ready(); +}; + +/** + * We need to bind to events we are interested in. + */ +minplayer.prototype.addEvents = function() { + minplayer.get.call(this, this.options.id, null, (function(player) { + return function(plugin) { + + // Bind to the error event. + plugin.bind('error', function(event, data) { + + // If an error occurs within the html5 media player, then try + // to fall back to the flash player. + if (player.currentPlayer == 'html5') { + player.options.file.player = 'minplayer'; + player.loadPlayer(); + } + else { + player.error(data); + } + }); + + // Bind to the fullscreen event. + plugin.bind('fullscreen', function(event, data) { + player.resize(); + }); + }; + })(this)); +}; + +/** + * Sets an error on the player. + * + * @param {string} error The error to display on the player. + */ +minplayer.prototype.error = function(error) { + error = error || ''; + if (this.elements.error) { + + // Set the error text. + this.elements.error.text(error); + if (error) { + this.elements.error.show(); + } + else { + this.elements.error.hide(); + } + } +}; + +/** + * Adds key events to the player. + */ +minplayer.prototype.addKeyEvents = function() { + jQuery(document).bind('keydown', (function(player) { + return function(event) { + switch (event.keyCode) { + case 113: // ESC + case 27: // Q + if (player.isFullScreen()) { + player.fullscreen(false); + } + break; + } + }; + })(this)); +}; + +/** + * Returns all the media files available for this player. + * + * @return {array} All the media files for this player. + */ +minplayer.prototype.getFiles = function() { + var files = []; + var mediaSrc = null; + + // Get the files involved... + if (this.elements.media) { + mediaSrc = this.elements.media.attr('src'); + if (mediaSrc) { + files.push({'path': mediaSrc}); + } + jQuery('source', this.elements.media).each(function() { + files.push({ + 'path': jQuery(this).attr('src'), + 'mimetype': jQuery(this).attr('type'), + 'codecs': jQuery(this).attr('codecs') + }); + }); + } + + return files; +}; + +/** + * Returns the full media player object. + * @param {array} files An array of files to chose from. + * @return {object} The best media file to play in the current browser. + */ +minplayer.prototype.getMediaFile = function(files) { + + // If there are no files then return null. + if (!files) { + return null; + } + + // If the file is a single string, then return the file object. + if (typeof files === 'string') { + return new minplayer.file({'path': files}); + } + + // If the file is already a file object then just return. + if (files.path || files.id) { + return new minplayer.file(files); + } + + // Add the files and get the best player to play. + var i = files.length, bestPriority = 0, mFile = null, file = null; + while (i--) { + file = files[i]; + + // Get the minplayer file object. + if (typeof file === 'string') { + file = new minplayer.file({'path': file}); + } + else { + file = new minplayer.file(file); + } + + // Determine the best file for this browser. + if (file.priority > bestPriority) { + mFile = file; + } + } + + // Return the best minplayer file. + return mFile; +}; + +/** + * Loads a media player based on the current file. + */ +minplayer.prototype.loadPlayer = function() { + + // Do nothing if there isn't a file. + if (!this.options.file) { + this.error('No media found.'); + return; + } + + if (!this.options.file.player) { + this.error('Cannot play media: ' + this.options.file.mimetype); + return; + } + + // Reset the error. + this.error(); + + // Only destroy if the current player is different than the new player. + var player = this.options.file.player.toString(); + + // If there isn't media or if the players are different. + if (!this.media || (player !== this.currentPlayer)) { + + // Set the current media player. + this.currentPlayer = player; + + // Do nothing if we don't have a display. + if (!this.elements.display) { + this.error('No media display found.'); + return; + } + + // Destroy the current media. + var queue = {}; + if (this.media) { + queue = this.media.queue; + this.media.destroy(); + } + + // Get the class name and create the new player. + pClass = minplayer.players[this.options.file.player]; + + // Create the new media player. + this.options.mediaelement = this.elements.media; + this.media = new pClass(this.elements.display, this.options, queue); + + // Now get the media when it is ready. + this.get('media', (function(player) { + return function(media) { + + // Load the media. + media.load(player.options.file); + }; + })(this)); + } + // If the media object already exists... + else if (this.media) { + + // Now load the different media file. + this.media.load(this.options.file); + } +}; + +/** + * Load a set of files or a single file for the media player. + * + * @param {array} files An array of files to chose from to load. + */ +minplayer.prototype.load = function(files) { + + // Set the id and class. + var id = '', pClass = ''; + + // If no file was provided, then get it. + this.options.files = files || this.options.files; + this.options.file = this.getMediaFile(this.options.files); + + // Now load the player. + this.loadPlayer(); +}; + +/** + * Called when the player is resized. + */ +minplayer.prototype.resize = function() { + + // Call onRezie for each plugin. + this.get(function(plugin) { + plugin.onResize(); + }); +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** + * @constructor + * @class A class to easily handle images. + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +minplayer.image = function(context, options) { + + // Determine if the image is loaded. + this.loaded = false; + + // The image loader. + this.loader = null; + + // The ratio of the image. + this.ratio = 0; + + // The image element. + this.img = null; + + // Derive from display + minplayer.display.call(this, 'image', context, options); +}; + +/** Derive from minplayer.display. */ +minplayer.image.prototype = new minplayer.display(); + +/** Reset the constructor. */ +minplayer.image.prototype.constructor = minplayer.image; + +/** + * @see minplayer.plugin.construct + */ +minplayer.image.prototype.construct = function() { + + // Say we need to resize. + this.allowResize = true; + + // Call the media display constructor. + minplayer.display.prototype.construct.call(this); + + // Set the container to not show any overflow... + this.display.css('overflow', 'hidden'); + + /** The loader for the image. */ + this.loader = new Image(); + + /** Register for when the image is loaded within the loader. */ + this.loader.onload = (function(image) { + return function() { + image.loaded = true; + image.ratio = (image.loader.width / image.loader.height); + image.resize(); + image.trigger('loaded'); + }; + })(this); + + // We are now ready. + this.ready(); +}; + +/** + * Loads an image. + * + * @param {string} src The source of the image to load. + */ +minplayer.image.prototype.load = function(src) { + + // First clear the previous image. + this.clear(function() { + + // Create the new image, and append to the display. + this.display.empty(); + this.img = jQuery(document.createElement('img')).attr({src: ''}).hide(); + this.display.append(this.img); + this.loader.src = src; + }); +}; + +/** + * Clears an image. + * + * @param {function} callback Called when the image is done clearing. + */ +minplayer.image.prototype.clear = function(callback) { + this.loaded = false; + if (this.img) { + this.img.fadeOut((function(image) { + return function() { + image.img.attr('src', ''); + image.loader.src = ''; + $(this).remove(); + callback.call(image); + }; + })(this)); + } + else { + callback.call(this); + } +}; + +/** + * Resize the image provided a width and height or nothing. + * + * @param {integer} width (optional) The width of the container. + * @param {integer} height (optional) The height of the container. + */ +minplayer.image.prototype.resize = function(width, height) { + width = width || this.display.width(); + height = height || this.display.height(); + if (width && height && this.loaded) { + + // Get the scaled rectangle. + var rect = this.getScaledRect(this.ratio, { + width: width, + height: height + }); + + // Now set this image to the new size. + if (this.img) { + this.img.attr('src', this.loader.src).css({ + marginLeft: rect.x, + marginTop: rect.y, + width: rect.width, + height: rect.height + }); + } + + // Show the container. + this.img.fadeIn(); + } +}; + +/** + * @see minplayer.display#onResize + */ +minplayer.image.prototype.onResize = function() { + + // Resize the image to fit. + this.resize(); +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** + * @constructor + * @class A wrapper class used to provide all the data necessary to control an + * individual file within this media player. + * + * @param {object} file A media file object with minimal required information. + */ +minplayer.file = function(file) { + this.duration = file.duration || 0; + this.bytesTotal = file.bytesTotal || 0; + this.quality = file.quality || 0; + this.stream = file.stream || ''; + this.path = file.path || ''; + this.codecs = file.codecs || ''; + + // These should be provided, but just in case... + this.extension = file.extension || this.getFileExtension(); + this.mimetype = file.mimetype || file.filemime || this.getMimeType(); + this.type = file.type || this.getType(); + + // Fail safe to try and guess the mimetype and media type. + if (!this.type) { + this.mimetype = this.getMimeType(); + this.type = this.getType(); + } + + // Get the player. + this.player = file.player || this.getBestPlayer(); + this.priority = file.priority || this.getPriority(); + this.id = file.id || this.getId(); +}; + +/** + * Returns the best player for the job. + * + * @return {string} The best player to play the media file. + */ +minplayer.file.prototype.getBestPlayer = function() { + var bestplayer = null, bestpriority = 0; + jQuery.each(minplayer.players, (function(file) { + return function(name, player) { + var priority = player.getPriority(); + if (player.canPlay(file) && (priority > bestpriority)) { + bestplayer = name; + bestpriority = priority; + } + }; + })(this)); + return bestplayer; +}; + +/** + * The priority of this file is determined by the priority of the best + * player multiplied by the priority of the mimetype. + * + * @return {integer} The priority of the media file. + */ +minplayer.file.prototype.getPriority = function() { + var priority = 1; + if (this.player) { + priority = minplayer.players[this.player].getPriority(); + } + switch (this.mimetype) { + case 'video/x-webm': + case 'video/webm': + case 'application/octet-stream': + return priority * 10; + case 'video/mp4': + case 'audio/mp4': + case 'audio/mpeg': + return priority * 9; + case 'video/ogg': + case 'audio/ogg': + case 'video/quicktime': + return priority * 8; + default: + return priority * 5; + } +}; + +/** + * Returns the file extension of the file path. + * + * @return {string} The file extension. + */ +minplayer.file.prototype.getFileExtension = function() { + return this.path.substring(this.path.lastIndexOf('.') + 1).toLowerCase(); +}; + +/** + * Returns the proper mimetype based off of the extension. + * + * @return {string} The mimetype of the file based off of extension. + */ +minplayer.file.prototype.getMimeType = function() { + switch (this.extension) { + case 'mp4': case 'm4v': case 'flv': case 'f4v': + return 'video/mp4'; + case'webm': + return 'video/webm'; + case 'ogg': case 'ogv': + return 'video/ogg'; + case '3g2': + return 'video/3gpp2'; + case '3gpp': + case '3gp': + return 'video/3gpp'; + case 'mov': + return 'video/quicktime'; + case'swf': + return 'application/x-shockwave-flash'; + case 'oga': + return 'audio/ogg'; + case 'mp3': + return 'audio/mpeg'; + case 'm4a': case 'f4a': + return 'audio/mp4'; + case 'aac': + return 'audio/aac'; + case 'wav': + return 'audio/vnd.wave'; + case 'wma': + return 'audio/x-ms-wma'; + default: + return 'unknown'; + } +}; + +/** + * The type of media this is: video or audio. + * + * @return {string} "video" or "audio" based on what the type of media this + * is. + */ +minplayer.file.prototype.getType = function() { + switch (this.mimetype) { + case 'video/mp4': + case 'video/webm': + case 'application/octet-stream': + case 'video/x-webm': + case 'video/ogg': + case 'video/3gpp2': + case 'video/3gpp': + case 'video/quicktime': + return 'video'; + case 'audio/mp3': + case 'audio/mp4': + case 'audio/ogg': + case 'audio/mpeg': + return 'audio'; + default: + return ''; + } +}; + +/** + * Returns the ID for this media file. + * + * @return {string} The id for this media file which is provided by the player. + */ +minplayer.file.prototype.getId = function() { + var player = minplayer.players[this.player]; + return (player && player.getMediaId) ? player.getMediaId(this) : ''; +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** + * @constructor + * @extends minplayer.display + * @class The play loader base class, which is used to control the busy + * cursor, big play button, and the opaque background which shows when the + * player is paused. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +minplayer.playLoader = function(context, options) { + + // Define the flags that control the busy cursor. + this.busy = new minplayer.flags(); + + // Define the flags that control the big play button. + this.bigPlay = new minplayer.flags(); + + /** The preview image. */ + this.preview = null; + + // Derive from display + minplayer.display.call(this, 'playLoader', context, options); +}; + +/** Derive from minplayer.display. */ +minplayer.playLoader.prototype = new minplayer.display(); + +/** Reset the constructor. */ +minplayer.playLoader.prototype.constructor = minplayer.playLoader; + +/** + * The constructor. + */ +minplayer.playLoader.prototype.construct = function() { + + // Call the media display constructor. + minplayer.display.prototype.construct.call(this); + + // Get the media plugin. + this.get('media', function(media) { + + // Only bind if this player does not have its own play loader. + if (!media.hasPlayLoader()) { + + // Get the poster image. + if (!this.options.preview) { + this.options.preview = media.elements.media.attr('poster'); + } + + // Reset the media's poster image. + media.elements.media.attr('poster', ''); + + // Load the preview image. + this.loadPreview(); + + // Trigger a play event when someone clicks on the controller. + if (this.elements.bigPlay) { + this.elements.bigPlay.unbind().bind('click', function(event) { + event.preventDefault(); + jQuery(this).hide(); + media.play(); + }); + } + + // Bind to the player events to control the play loader. + media.unbind('loadstart').bind('loadstart', (function(playLoader) { + return function(event) { + playLoader.busy.setFlag('media', true); + playLoader.bigPlay.setFlag('media', true); + if (playLoader.preview) { + playLoader.elements.preview.show(); + } + playLoader.checkVisibility(); + }; + })(this)); + media.bind('waiting', (function(playLoader) { + return function(event) { + playLoader.busy.setFlag('media', true); + playLoader.checkVisibility(); + }; + })(this)); + media.bind('loadeddata', (function(playLoader) { + return function(event) { + playLoader.busy.setFlag('media', false); + playLoader.checkVisibility(); + }; + })(this)); + media.bind('playing', (function(playLoader) { + return function(event) { + playLoader.busy.setFlag('media', false); + playLoader.bigPlay.setFlag('media', false); + if (playLoader.preview) { + playLoader.elements.preview.hide(); + } + playLoader.checkVisibility(); + }; + })(this)); + media.bind('pause', (function(playLoader) { + return function(event) { + playLoader.bigPlay.setFlag('media', true); + playLoader.checkVisibility(); + }; + })(this)); + } + else { + + // Hide the busy cursor. + if (this.elements.busy) { + this.elements.busy.unbind().hide(); + } + + // Hide the big play button. + if (this.elements.bigPlay) { + this.elements.bigPlay.unbind().hide(); + } + + // Hide the display. + this.display.unbind().hide(); + } + }); + + // We are now ready. + this.ready(); +}; + +/** + * Loads the preview image. + */ +minplayer.playLoader.prototype.loadPreview = function() { + + // If the preview element exists. + if (this.elements.preview) { + + // If there is a preview to show... + if (this.options.preview) { + + // Say that this has a preview. + this.elements.preview.addClass('has-preview').show(); + + // Create a new preview image. + this.preview = new minplayer.image(this.elements.preview, this.options); + + // Create the image. + this.preview.load(this.options.preview); + } + else { + + // Hide the preview. + this.elements.preview.hide(); + } + } +}; + +/** + * Hide or show certain elements based on the state of the busy and big play + * button. + */ +minplayer.playLoader.prototype.checkVisibility = function() { + + // Hide or show the busy cursor based on the flags. + if (this.busy.flag) { + this.elements.busy.show(); + } + else { + this.elements.busy.hide(); + } + + // Hide or show the big play button based on the flags. + if (this.bigPlay.flag) { + this.elements.bigPlay.show(); + } + else { + this.elements.bigPlay.hide(); + } + + // Show the control either flag is set. + if (this.bigPlay.flag || this.busy.flag) { + this.display.show(); + } + + // Hide the whole control if both flags are 0. + if (!this.bigPlay.flag && !this.busy.flag) { + this.display.hide(); + } +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.display + * @class The base media player class where all media players derive from. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.players.base = function(context, options, queue) { + + // Derive from display + minplayer.display.call(this, 'media', context, options, queue); +}; + +/** Derive from minplayer.display. */ +minplayer.players.base.prototype = new minplayer.display(); + +/** Reset the constructor. */ +minplayer.players.base.prototype.constructor = minplayer.players.base; + +/** + * @see minplayer.display.getElements + * @this minplayer.players.base + * @return {object} The elements for this display. + */ +minplayer.players.base.prototype.getElements = function() { + var elements = minplayer.display.prototype.getElements.call(this); + return jQuery.extend(elements, { + media: this.options.mediaelement + }); +}; + +/** + * Get the priority of this media player. + * + * @return {number} The priority of this media player. + */ +minplayer.players.base.getPriority = function() { + return 0; +}; + +/** + * Returns the ID for the media being played. + * + * @param {object} file A {@link minplayer.file} object. + * @return {string} The ID for the provided media. + */ +minplayer.players.base.getMediaId = function(file) { + return ''; +}; + +/** + * Determine if we can play the media file. + * + * @param {object} file A {@link minplayer.file} object. + * @return {boolean} If this player can play this media type. + */ +minplayer.players.base.canPlay = function(file) { + return false; +}; + +/** + * @see minplayer.plugin.construct + * @this minplayer.players.base + */ +minplayer.players.base.prototype.construct = function() { + + // Call the media display constructor. + minplayer.display.prototype.construct.call(this); + + // Clear the media player. + this.clear(); + + /** The currently loaded media file. */ + this.mediaFile = this.options.file; + + // Get the player display object. + if (!this.playerFound()) { + + // Remove the media element if found + if (this.elements.media) { + this.elements.media.remove(); + } + + // Create a new media player element. + this.elements.media = jQuery(this.create()); + this.display.html(this.elements.media); + } + + // Get the player object... + this.player = this.getPlayer(); + + // Set the focus of the element based on if they click in or outside of it. + jQuery(document).bind('click', (function(player) { + return function(event) { + if (jQuery(event.target).closest('#' + player.options.id).length == 0) { + player.hasFocus = false; + } + else { + player.hasFocus = true; + } + }; + })(this)); + + // Bind to key events... + jQuery(document).bind('keydown', (function(player) { + return function(event) { + if (player.hasFocus) { + event.preventDefault(); + switch (event.keyCode) { + case 32: // SPACE + case 179: // GOOGLE play/pause button. + if (player.playing) { + player.pause(); + } + else { + player.play(); + } + break; + case 38: // UP + player.setVolumeRelative(0.1); + break; + case 40: // DOWN + player.setVolumeRelative(-0.1); + break; + case 37: // LEFT + case 227: // GOOGLE TV REW + player.seekRelative(-0.05); + break; + case 39: // RIGHT + case 228: // GOOGLE TV FW + player.seekRelative(0.05); + break; + } + } + }; + })(this)); +}; + +/** + * @see minplayer.plugin.destroy. + */ +minplayer.players.base.prototype.destroy = function() { + minplayer.plugin.prototype.destroy.call(this); + this.clear(); +}; + +/** + * Clears the media player. + */ +minplayer.players.base.prototype.clear = function() { + + // Reset the ready flag. + this.playerReady = false; + + // Reset the player. + this.reset(); + + // If the player exists, then unbind all events. + if (this.player) { + jQuery(this.player).unbind(); + } +}; + +/** + * Resets all variables. + */ +minplayer.players.base.prototype.reset = function() { + + // The duration of the player. + this.duration = new minplayer.async(); + + // The current play time of the player. + this.currentTime = new minplayer.async(); + + // The amount of bytes loaded in the player. + this.bytesLoaded = new minplayer.async(); + + // The total amount of bytes for the media. + this.bytesTotal = new minplayer.async(); + + // The bytes that the download started with. + this.bytesStart = new minplayer.async(); + + // The current volume of the player. + this.volume = new minplayer.async(); + + // Reset focus. + this.hasFocus = false; + + // We are not playing. + this.playing = false; + + // We are not loading. + this.loading = false; + + // Tell everyone else we reset. + this.trigger('pause'); + this.trigger('waiting'); + this.trigger('progress', {loaded: 0, total: 0, start: 0}); + this.trigger('timeupdate', {currentTime: 0, duration: 0}); +}; + +/** + * Called when the player is ready to recieve events and commands. + */ +minplayer.players.base.prototype.onReady = function() { + + // Only continue if we are not already ready. + if (this.playerReady) { + return; + } + + // Set the ready flag. + this.playerReady = true; + + // Set the volume to the default. + this.setVolume(this.options.volume / 100); + + // Setup the progress interval. + this.loading = true; + + // Create a poll to get the progress. + this.poll((function(player) { + return function() { + + // Only do this if the play interval is set. + if (player.loading) { + + // Get the bytes loaded asynchronously. + player.getBytesLoaded(function(bytesLoaded) { + + // Get the bytes total asynchronously. + player.getBytesTotal(function(bytesTotal) { + + // Trigger an event about the progress. + if (bytesLoaded || bytesTotal) { + + // Get the bytes start, but don't require it. + var bytesStart = 0; + player.getBytesStart(function(val) { + bytesStart = val; + }); + + // Trigger a progress event. + player.trigger('progress', { + loaded: bytesLoaded, + total: bytesTotal, + start: bytesStart + }); + + // Say we are not longer loading if they are equal. + if (bytesLoaded >= bytesTotal) { + player.loading = false; + } + } + }); + }); + } + + // Keep polling as long as its loading... + return player.loading; + }; + })(this), 1000); + + // We are now ready. + this.ready(); + + // Trigger that the load has started. + this.trigger('loadstart'); +}; + +/** + * Should be called when the media is playing. + */ +minplayer.players.base.prototype.onPlaying = function() { + + // Trigger an event that we are playing. + this.trigger('playing'); + + // Say that this player has focus. + this.hasFocus = true; + + // Set the playInterval to true. + this.playing = true; + + // Create a poll to get the timeupate. + this.poll((function(player) { + return function() { + + // Only do this if the play interval is set. + if (player.playing) { + + // Get the current time asyncrhonously. + player.getCurrentTime(function(currentTime) { + + // Get the duration asynchronously. + player.getDuration(function(duration) { + + // Convert these to floats. + currentTime = parseFloat(currentTime); + duration = parseFloat(duration); + + // Trigger an event about the progress. + if (currentTime || duration) { + + // Trigger an update event. + player.trigger('timeupdate', { + currentTime: currentTime, + duration: duration + }); + } + }); + }); + } + + // Keep polling as long as it is playing. + return player.playing; + }; + })(this), 1000); +}; + +/** + * Should be called when the media is paused. + */ +minplayer.players.base.prototype.onPaused = function() { + + // Trigger an event that we are paused. + this.trigger('pause'); + + // Remove focus. + this.hasFocus = false; + + // Say we are not playing. + this.playing = false; +}; + +/** + * Should be called when the media is complete. + */ +minplayer.players.base.prototype.onComplete = function() { + // Stop the intervals. + this.playing = false; + this.loading = false; + this.hasFocus = false; + this.trigger('ended'); +}; + +/** + * Should be called when the media is done loading. + */ +minplayer.players.base.prototype.onLoaded = function() { + this.trigger('loadeddata'); +}; + +/** + * Should be called when the player is waiting. + */ +minplayer.players.base.prototype.onWaiting = function() { + this.trigger('waiting'); +}; + +/** + * Called when an error occurs. + * + * @param {string} errorCode The error that was triggered. + */ +minplayer.players.base.prototype.onError = function(errorCode) { + this.hasFocus = false; + this.trigger('error', errorCode); +}; + +/** + * @see minplayer.players.base#isReady + * @return {boolean} Checks to see if the Flash is ready. + */ +minplayer.players.base.prototype.isReady = function() { + + // Return that the player is set and the ready flag is good. + return (this.player && this.playerReady); +}; + +/** + * Determines if the player should show the playloader. + * + * @return {bool} If this player implements its own playLoader. + */ +minplayer.players.base.prototype.hasPlayLoader = function() { + return false; +}; + +/** + * Returns if the media player is already within the DOM. + * + * @return {boolean} TRUE - if the player is in the DOM, FALSE otherwise. + */ +minplayer.players.base.prototype.playerFound = function() { + return false; +}; + +/** + * Creates the media player and inserts it in the DOM. + * + * @return {object} The media player entity. + */ +minplayer.players.base.prototype.create = function() { + this.reset(); + return null; +}; + +/** + * Returns the media player object. + * + * @return {object} The media player object. + */ +minplayer.players.base.prototype.getPlayer = function() { + return this.player; +}; + +/** + * Loads a new media player. + * + * @param {object} file A {@link minplayer.file} object. + */ +minplayer.players.base.prototype.load = function(file) { + + // Store the media file for future lookup. + var isString = (typeof this.mediaFile == 'string'); + var path = isString ? this.mediaFile : this.mediaFile.path; + if (file && (file.path != path)) { + this.reset(); + this.mediaFile = file; + } +}; + +/** + * Play the loaded media file. + */ +minplayer.players.base.prototype.play = function() { +}; + +/** + * Pause the loaded media file. + */ +minplayer.players.base.prototype.pause = function() { +}; + +/** + * Stop the loaded media file. + */ +minplayer.players.base.prototype.stop = function() { + this.playing = false; + this.loading = false; + this.hasFocus = false; +}; + +/** + * Seeks to relative position. + * + * @param {number} pos Relative position. -1 to 1 (percent), > 1 (seconds). + */ +minplayer.players.base.prototype.seekRelative = function(pos) { + + // Get the current time asyncrhonously. + this.getCurrentTime((function(player) { + return function(currentTime) { + + // Get the duration asynchronously. + player.getDuration(function(duration) { + + // Only do this if we have a duration. + if (duration) { + + // Get the position. + var seekPos = 0; + if ((pos > -1) && (pos < 1)) { + seekPos = (currentTime / duration) + parseFloat(pos); + } + else { + seekPos = (currentTime + parseFloat(pos)) / duration; + } + + // Set the seek value. + player.seek(seekPos); + } + }); + }; + })(this)); +}; + +/** + * Seek the loaded media. + * + * @param {number} pos The position to seek the minplayer. 0 to 1. + */ +minplayer.players.base.prototype.seek = function(pos) { +}; + +/** + * Set the volume of the loaded minplayer. + * + * @param {number} vol -1 to 1 - The relative amount to increase or decrease. + */ +minplayer.players.base.prototype.setVolumeRelative = function(vol) { + + // Get the volume + this.getVolume((function(player) { + return function(newVol) { + newVol += parseFloat(vol); + newVol = (newVol < 0) ? 0 : newVol; + newVol = (newVol > 1) ? 1 : newVol; + player.setVolume(newVol); + }; + })(this)); +}; + +/** + * Set the volume of the loaded minplayer. + * + * @param {number} vol The volume to set the media. 0 to 1. + */ +minplayer.players.base.prototype.setVolume = function(vol) { + this.trigger('volumeupdate', vol); +}; + +/** + * Get the volume from the loaded media. + * + * @param {function} callback Called when the volume is determined. + * @return {number} The volume of the media; 0 to 1. + */ +minplayer.players.base.prototype.getVolume = function(callback) { + return this.volume.get(callback); +}; + +/** + * Get the current time for the media being played. + * + * @param {function} callback Called when the time is determined. + * @return {number} The volume of the media; 0 to 1. + */ +minplayer.players.base.prototype.getCurrentTime = function(callback) { + return this.currentTime.get(callback); +}; + +/** + * Return the duration of the loaded media. + * + * @param {function} callback Called when the duration is determined. + * @return {number} The duration of the loaded media. + */ +minplayer.players.base.prototype.getDuration = function(callback) { + return this.duration.get(callback); +}; + +/** + * Return the start bytes for the loaded media. + * + * @param {function} callback Called when the start bytes is determined. + * @return {int} The bytes that were started. + */ +minplayer.players.base.prototype.getBytesStart = function(callback) { + return this.bytesStart.get(callback); +}; + +/** + * Return the bytes of media loaded. + * + * @param {function} callback Called when the bytes loaded is determined. + * @return {int} The amount of bytes loaded. + */ +minplayer.players.base.prototype.getBytesLoaded = function(callback) { + return this.bytesLoaded.get(callback); +}; + +/** + * Return the total amount of bytes. + * + * @param {function} callback Called when the bytes total is determined. + * @return {int} The total amount of bytes for this media. + */ +minplayer.players.base.prototype.getBytesTotal = function(callback) { + return this.bytesTotal.get(callback); +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.display + * @class The HTML5 media player implementation. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.players.html5 = function(context, options, queue) { + + // Derive players base. + minplayer.players.base.call(this, context, options, queue); +}; + +/** Derive from minplayer.players.base. */ +minplayer.players.html5.prototype = new minplayer.players.base(); + +/** Reset the constructor. */ +minplayer.players.html5.prototype.constructor = minplayer.players.html5; + +/** + * @see minplayer.players.base#getPriority + * @return {number} The priority of this media player. + */ +minplayer.players.html5.getPriority = function() { + return 10; +}; + +/** + * @see minplayer.players.base#canPlay + * @return {boolean} If this player can play this media type. + */ +minplayer.players.html5.canPlay = function(file) { + switch (file.mimetype) { + case 'video/ogg': + return !!minplayer.playTypes.videoOGG; + case 'video/mp4': + case 'video/x-mp4': + case 'video/m4v': + case 'video/x-m4v': + return !!minplayer.playTypes.videoH264; + case 'video/x-webm': + case 'video/webm': + case 'application/octet-stream': + return !!minplayer.playTypes.videoWEBM; + case 'audio/ogg': + return !!minplayer.playTypes.audioOGG; + case 'audio/mpeg': + return !!minplayer.playTypes.audioMP3; + case 'audio/mp4': + return !!minplayer.playTypes.audioMP4; + default: + return false; + } +}; + +/** + * @see minplayer.plugin.construct + */ +minplayer.players.html5.prototype.construct = function() { + + // Call base constructor. + minplayer.players.base.prototype.construct.call(this); + + // For the HTML5 player, we will just pass events along... + if (this.player) { + + this.player.addEventListener('abort', (function(player) { + return function() { + player.trigger('abort'); + }; + })(this), false); + this.player.addEventListener('loadstart', (function(player) { + return function() { + player.onReady(); + }; + })(this), false); + this.player.addEventListener('loadeddata', (function(player) { + return function() { + player.onLoaded(); + }; + })(this), false); + this.player.addEventListener('loadedmetadata', (function(player) { + return function() { + player.onLoaded(); + }; + })(this), false); + this.player.addEventListener('canplaythrough', (function(player) { + return function() { + player.onLoaded(); + }; + })(this), false); + this.player.addEventListener('ended', (function(player) { + return function() { + player.onComplete(); + }; + })(this), false); + this.player.addEventListener('pause', (function(player) { + return function() { + player.onPaused(); + }; + })(this), false); + this.player.addEventListener('play', (function(player) { + return function() { + player.onPlaying(); + }; + })(this), false); + this.player.addEventListener('playing', (function(player) { + return function() { + player.onPlaying(); + }; + })(this), false); + this.player.addEventListener('error', (function(player) { + return function() { + player.trigger('error', 'An error occured - ' + this.error.code); + }; + })(this), false); + this.player.addEventListener('waiting', (function(player) { + return function() { + player.onWaiting(); + }; + })(this), false); + this.player.addEventListener('durationchange', (function(player) { + return function() { + player.duration.set(this.duration); + player.trigger('durationchange', {duration: this.duration}); + }; + })(this), false); + this.player.addEventListener('progress', (function(player) { + return function(event) { + player.bytesTotal.set(event.total); + player.bytesLoaded.set(event.loaded); + }; + })(this), false); + + // Say we are ready. + this.onReady(); + } +}; + +/** + * @see minplayer.players.base#playerFound + * @return {boolean} TRUE - if the player is in the DOM, FALSE otherwise. + */ +minplayer.players.html5.prototype.playerFound = function() { + return (this.display.find(this.mediaFile.type).length > 0); +}; + +/** + * @see minplayer.players.base#create + * @return {object} The media player entity. + */ +minplayer.players.html5.prototype.create = function() { + minplayer.players.base.prototype.create.call(this); + var element = jQuery(document.createElement(this.mediaFile.type)) + .attr(this.options.attributes) + .append( + jQuery(document.createElement('source')).attr({ + 'src': this.mediaFile.path + }) + ); + + // Fix the fluid width and height. + element.eq(0)[0].setAttribute('width', '100%'); + element.eq(0)[0].setAttribute('height', '100%'); + return element; +}; + +/** + * @see minplayer.players.base#getPlayer + * @return {object} The media player object. + */ +minplayer.players.html5.prototype.getPlayer = function() { + return this.elements.media.eq(0)[0]; +}; + +/** + * @see minplayer.players.base#load + */ +minplayer.players.html5.prototype.load = function(file) { + + if (file) { + + // Get the current source. + var src = this.elements.media.attr('src'); + if (!src) { + src = jQuery('source', this.elements.media).eq(0).attr('src'); + } + + // If the source is different. + if (src != file.path) { + + // Change the source... + var code = ''; + this.elements.media.removeAttr('src').empty().html(code); + } + } + + // Always call the base first on load... + minplayer.players.base.prototype.load.call(this, file); +}; + +/** + * @see minplayer.players.base#play + */ +minplayer.players.html5.prototype.play = function() { + minplayer.players.base.prototype.play.call(this); + if (this.isReady()) { + this.player.play(); + } +}; + +/** + * @see minplayer.players.base#pause + */ +minplayer.players.html5.prototype.pause = function() { + minplayer.players.base.prototype.pause.call(this); + if (this.isReady()) { + this.player.pause(); + } +}; + +/** + * @see minplayer.players.base#stop + */ +minplayer.players.html5.prototype.stop = function() { + minplayer.players.base.prototype.stop.call(this); + if (this.isReady()) { + this.player.pause(); + this.player.src = ''; + } +}; + +/** + * @see minplayer.players.base#seek + */ +minplayer.players.html5.prototype.seek = function(pos) { + minplayer.players.base.prototype.seek.call(this, pos); + if (this.isReady()) { + this.player.currentTime = pos; + } +}; + +/** + * @see minplayer.players.base#setVolume + */ +minplayer.players.html5.prototype.setVolume = function(vol) { + minplayer.players.base.prototype.setVolume.call(this, vol); + if (this.isReady()) { + this.player.volume = vol; + } +}; + +/** + * @see minplayer.players.base#getVolume + */ +minplayer.players.html5.prototype.getVolume = function(callback) { + if (this.isReady()) { + callback(this.player.volume); + } +}; + +/** + * @see minplayer.players.base#getDuration + */ +minplayer.players.html5.prototype.getDuration = function(callback) { + if (this.isReady()) { + callback(this.player.duration); + } +}; + +/** + * @see minplayer.players.base#getCurrentTime + */ +minplayer.players.html5.prototype.getCurrentTime = function(callback) { + if (this.isReady()) { + callback(this.player.currentTime); + } +}; + +/** + * @see minplayer.players.base#getBytesLoaded + */ +minplayer.players.html5.prototype.getBytesLoaded = function(callback) { + if (this.isReady()) { + var loaded = 0; + + // Check several different possibilities. + if (this.bytesLoaded.value) { + loaded = this.bytesLoaded.value; + } + else if (this.player.buffered && + this.player.buffered.length > 0 && + this.player.buffered.end && + this.player.duration) { + loaded = this.player.buffered.end(0); + } + else if (this.player.bytesTotal != undefined && + this.player.bytesTotal > 0 && + this.player.bufferedBytes != undefined) { + loaded = this.player.bufferedBytes; + } + + // Return the loaded amount. + callback(loaded); + } +}; + +/** + * @see minplayer.players.base#getBytesTotal + */ +minplayer.players.html5.prototype.getBytesTotal = function(callback) { + if (this.isReady()) { + + var total = 0; + + // Check several different possibilities. + if (this.bytesTotal.value) { + total = this.bytesTotal.value; + } + else if (this.player.buffered && + this.player.buffered.length > 0 && + this.player.buffered.end && + this.player.duration) { + total = this.player.duration; + } + else if (this.player.bytesTotal != undefined && + this.player.bytesTotal > 0 && + this.player.bufferedBytes != undefined) { + total = this.player.bytesTotal; + } + + // Return the loaded amount. + callback(total); + } +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.display + * @class The Flash media player class to control the flash fallback. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.players.flash = function(context, options, queue) { + + // Derive from players base. + minplayer.players.base.call(this, context, options, queue); +}; + +/** Derive from minplayer.players.base. */ +minplayer.players.flash.prototype = new minplayer.players.base(); + +/** Reset the constructor. */ +minplayer.players.flash.prototype.constructor = minplayer.players.flash; + +/** + * @see minplayer.players.base#getPriority + * @return {number} The priority of this media player. + */ +minplayer.players.flash.getPriority = function() { + return 0; +}; + +/** + * @see minplayer.players.base#canPlay + * @return {boolean} If this player can play this media type. + */ +minplayer.players.flash.canPlay = function(file) { + return false; +}; + +/** + * API to return the Flash player code provided params. + * + * @param {object} params The params used to populate the Flash code. + * @return {object} A Flash DOM element. + */ +minplayer.players.flash.getFlash = function(params) { + // Get the protocol. + var protocol = window.location.protocol; + if (protocol.charAt(protocol.length - 1) == ':') { + protocol = protocol.substring(0, protocol.length - 1); + } + + // Convert the flashvars object to a string... + var flashVars = jQuery.param(params.flashvars); + + // Set the codebase. + var codebase = protocol + '://fpdownload.macromedia.com'; + codebase += '/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0'; + + // Get the HTML flash object string. + var flash = ' '; + flash += ''; + flash += ''; + flash += ''; + flash += ''; + flash += ''; + flash += ''; + flash += ' 0); +}; + +/** + * @see minplayer.players.base#getPlayer + * @return {object} The media player object. + */ +minplayer.players.flash.prototype.getPlayer = function() { + // IE needs the object, everyone else just needs embed. + var object = jQuery.browser.msie ? 'object' : 'embed'; + return jQuery(object, this.display).eq(0)[0]; +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.display + * @class The Flash media player class to control the flash fallback. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.players.minplayer = function(context, options, queue) { + + // Derive from players flash. + minplayer.players.flash.call(this, context, options, queue); +}; + +/** Derive from minplayer.players.flash. */ +minplayer.players.minplayer.prototype = new minplayer.players.flash(); + +/** Reset the constructor. */ +minplayer.players.minplayer.prototype.constructor = minplayer.players.minplayer; + +/** + * Called when the Flash player is ready. + * + * @param {string} id The media player ID. + */ +window.onFlashPlayerReady = function(id) { + var media = minplayer.get(id, 'media'); + if (media) { + media.onReady(); + } +}; + +/** + * Called when the Flash player updates. + * + * @param {string} id The media player ID. + * @param {string} eventType The event type that was triggered. + */ +window.onFlashPlayerUpdate = function(id, eventType) { + var media = minplayer.get(id, 'media'); + if (media) { + media.onMediaUpdate(eventType); + } +}; + +/** + * Used to debug from the Flash player to the browser console. + * + * @param {string} debug The debug string. + */ +window.onFlashPlayerDebug = function(debug) { + minplayer.console.log(debug); +}; + +/** + * @see minplayer.players.base#getPriority + * @return {number} The priority of this media player. + */ +minplayer.players.minplayer.getPriority = function() { + return 1; +}; + +/** + * @see minplayer.players.base#canPlay + * @return {boolean} If this player can play this media type. + */ +minplayer.players.minplayer.canPlay = function(file) { + switch (file.mimetype) { + case 'video/mp4': + case 'video/x-mp4': + case 'video/m4v': + case 'video/x-m4v': + case 'video/x-webm': + case 'video/webm': + case 'application/octet-stream': + case 'video/quicktime': + case 'video/3gpp2': + case 'video/3gpp': + case 'application/x-shockwave-flash': + case 'audio/mpeg': + case 'audio/mp4': + case 'audio/aac': + case 'audio/vnd.wave': + case 'audio/x-ms-wma': + return true; + + default: + return false; + } +}; + +/** + * @see minplayer.players.base#create + * @return {object} The media player entity. + */ +minplayer.players.minplayer.prototype.create = function() { + + // Make sure we provide default options... + this.options = jQuery.extend({ + swfplayer: 'flash/minplayer.swf' + }, this.options); + + minplayer.players.flash.prototype.create.call(this); + + // The flash variables for this flash player. + var flashVars = { + 'id': this.options.id, + 'debug': this.options.debug, + 'config': 'nocontrols', + 'file': this.mediaFile.path, + 'autostart': this.options.autoplay + }; + + // Return a flash media player object. + return minplayer.players.flash.getFlash({ + swf: this.options.swfplayer, + id: this.options.id + '_player', + width: this.options.width, + height: '100%', + flashvars: flashVars, + wmode: this.options.wmode + }); +}; + +/** + * Called when the Flash player has an update. + * + * @param {string} eventType The event that was triggered in the player. + */ +minplayer.players.minplayer.prototype.onMediaUpdate = function(eventType) { + switch (eventType) { + case 'mediaMeta': + this.onLoaded(); + break; + case 'mediaPlaying': + this.onPlaying(); + break; + case 'mediaPaused': + this.onPaused(); + break; + case 'mediaComplete': + this.onComplete(); + break; + } +}; + +/** + * @see minplayer.players.base#load + */ +minplayer.players.minplayer.prototype.load = function(file) { + minplayer.players.flash.prototype.load.call(this, file); + if (file && this.isReady()) { + this.player.loadMedia(file.path, file.stream); + } +}; + +/** + * @see minplayer.players.base#play + */ +minplayer.players.minplayer.prototype.play = function() { + minplayer.players.flash.prototype.play.call(this); + if (this.isReady()) { + this.player.playMedia(); + } +}; + +/** + * @see minplayer.players.base#pause + */ +minplayer.players.minplayer.prototype.pause = function() { + minplayer.players.flash.prototype.pause.call(this); + if (this.isReady()) { + this.player.pauseMedia(); + } +}; + +/** + * @see minplayer.players.base#stop + */ +minplayer.players.minplayer.prototype.stop = function() { + minplayer.players.flash.prototype.stop.call(this); + if (this.isReady()) { + this.player.stopMedia(); + } +}; + +/** + * @see minplayer.players.base#seek + */ +minplayer.players.minplayer.prototype.seek = function(pos) { + minplayer.players.flash.prototype.seek.call(this, pos); + if (this.isReady()) { + this.player.seekMedia(pos); + } +}; + +/** + * @see minplayer.players.base#setVolume + */ +minplayer.players.minplayer.prototype.setVolume = function(vol) { + minplayer.players.flash.prototype.setVolume.call(this, vol); + if (this.isReady()) { + this.player.setVolume(vol); + } +}; + +/** + * @see minplayer.players.base#getVolume + */ +minplayer.players.minplayer.prototype.getVolume = function(callback) { + if (this.isReady()) { + callback(this.player.getVolume()); + } +}; + +/** + * @see minplayer.players.flash#getDuration + */ +minplayer.players.minplayer.prototype.getDuration = function(callback) { + if (this.isReady()) { + + // Check to see if it is immediately available. + var duration = this.player.getDuration(); + if (duration) { + callback(duration); + } + else { + + // If not, then poll every second for the duration. + this.poll((function(player) { + return function() { + duration = player.player.getDuration(); + if (duration) { + callback(duration); + } + return !duration; + }; + })(this), 1000); + } + } +}; + +/** + * @see minplayer.players.base#getCurrentTime + */ +minplayer.players.minplayer.prototype.getCurrentTime = function(callback) { + if (this.isReady()) { + callback(this.player.getCurrentTime()); + } +}; + +/** + * @see minplayer.players.base#getBytesLoaded + */ +minplayer.players.minplayer.prototype.getBytesLoaded = function(callback) { + if (this.isReady()) { + callback(this.player.getMediaBytesLoaded()); + } +}; + +/** + * @see minplayer.players.base#getBytesTotal. + */ +minplayer.players.minplayer.prototype.getBytesTotal = function(callback) { + if (this.isReady()) { + callback(this.player.getMediaBytesTotal()); + } +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.players.base + * @class The YouTube media player. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.players.youtube = function(context, options, queue) { + + /** The quality of the YouTube stream. */ + this.quality = 'default'; + + // Derive from players base. + minplayer.players.base.call(this, context, options, queue); +}; + +/** Derive from minplayer.players.base. */ +minplayer.players.youtube.prototype = new minplayer.players.base(); + +/** Reset the constructor. */ +minplayer.players.youtube.prototype.constructor = minplayer.players.youtube; + +/** + * @see minplayer.players.base#getPriority + * @return {number} The priority of this media player. + */ +minplayer.players.youtube.getPriority = function() { + return 10; +}; + +/** + * @see minplayer.players.base#canPlay + * @return {boolean} If this player can play this media type. + */ +minplayer.players.youtube.canPlay = function(file) { + + // Check for the mimetype for youtube. + if (file.mimetype === 'video/youtube') { + return true; + } + + // If the path is a YouTube path, then return true. + return (file.path.search(/^http(s)?\:\/\/(www\.)?youtube\.com/i) === 0); +}; + +/** + * Return the ID for a provided media file. + * + * @param {object} file A {@link minplayer.file} object. + * @return {string} The ID for the provided media. + */ +minplayer.players.youtube.getMediaId = function(file) { + var regex = /^http[s]?\:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9]+)/i; + if (file.path.search(regex) === 0) { + return file.path.match(regex)[2]; + } + else { + return file.path; + } +}; + +/** + * Register this youtube player so that multiple players can be present + * on the same page without event collision. + */ +minplayer.players.youtube.prototype.register = function() { + + /** + * Register the standard youtube api ready callback. + */ + window.onYouTubePlayerAPIReady = function() { + + // Iterate over each media player. + jQuery.each(minplayer.get(null, 'player'), function(id, player) { + + // Make sure this is the youtube player. + if (player.currentPlayer == 'youtube') { + + // Create a new youtube player object for this instance only. + var playerId = id + '-player'; + + // Set this players media. + player.media.player = new YT.Player(playerId, { + events: { + 'onReady': function(event) { + player.media.onReady(event); + }, + 'onStateChange': function(event) { + player.media.onPlayerStateChange(event); + }, + 'onPlaybackQualityChange': function(newQuality) { + player.media.onQualityChange(newQuality); + }, + 'onError': function(errorCode) { + player.media.onError(errorCode); + } + } + }); + } + }); + } +}; + +/** + * Translates the player state for the YouTube API player. + * + * @param {number} playerState The YouTube player state. + */ +minplayer.players.youtube.prototype.setPlayerState = function(playerState) { + switch (playerState) { + case YT.PlayerState.CUED: + break; + case YT.PlayerState.BUFFERING: + this.onWaiting(); + break; + case YT.PlayerState.PAUSED: + this.onPaused(); + break; + case YT.PlayerState.PLAYING: + this.onPlaying(); + break; + case YT.PlayerState.ENDED: + this.onComplete(); + break; + default: + break; + } +}; + +/** + * Called when an error occurs. + * + * @param {string} event The onReady event that was triggered. + */ +minplayer.players.youtube.prototype.onReady = function(event) { + minplayer.players.base.prototype.onReady.call(this); + this.onLoaded(); +}; + +/** + * Checks to see if this player can be found. + * @return {bool} TRUE - Player is found, FALSE - otherwise. + */ +minplayer.players.youtube.prototype.playerFound = function() { + var iframe = this.display.find('iframe#' + this.options.id + '-player'); + return (iframe.length > 0); +}; + +/** + * Called when the player state changes. + * + * @param {object} event A JavaScript Event. + */ +minplayer.players.youtube.prototype.onPlayerStateChange = function(event) { + this.setPlayerState(event.data); +}; + +/** + * Called when the player quality changes. + * + * @param {string} newQuality The new quality for the change. + */ +minplayer.players.youtube.prototype.onQualityChange = function(newQuality) { + this.quality = newQuality.data; +}; + +/** + * Determines if the player should show the playloader. + * + * @return {bool} If this player implements its own playLoader. + */ +minplayer.players.youtube.prototype.hasPlayLoader = function() { + return true; +}; + +/** + * @see minplayer.players.base#create + * @return {object} The media player entity. + */ +minplayer.players.youtube.prototype.create = function() { + minplayer.players.base.prototype.create.call(this); + + // Insert the YouTube iframe API player. + var tag = document.createElement('script'); + tag.src = 'http://www.youtube.com/player_api?enablejsapi=1'; + var firstScriptTag = document.getElementsByTagName('script')[0]; + firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); + + // Now register this player. + this.register(); + + // Create the iframe for this player. + var iframe = document.createElement('iframe'); + iframe.setAttribute('id', this.options.id + '-player'); + iframe.setAttribute('type', 'text/html'); + iframe.setAttribute('width', '100%'); + iframe.setAttribute('height', '100%'); + iframe.setAttribute('frameborder', '0'); + + // Get the source. + var src = 'http://www.youtube.com/embed/'; + src += this.mediaFile.id + '?'; + + // Determine the origin of this script. + var origin = location.protocol; + origin += '//' + location.hostname; + origin += (location.port && ':' + location.port); + + // Add the parameters to the src. + src += jQuery.param({ + 'wmode': 'opaque', + 'controls': 0, + 'enablejsapi': 1, + 'origin': origin, + 'autoplay': this.options.autoplay, + 'loop': this.options.loop + }); + + // Set the source of the iframe. + iframe.setAttribute('src', src); + + // Return the player. + return iframe; +}; + +/** + * @see minplayer.players.base#load + */ +minplayer.players.youtube.prototype.load = function(file) { + minplayer.players.base.prototype.load.call(this, file); + if (file && this.isReady()) { + this.player.loadVideoById(file.id, 0, this.quality); + } +}; + +/** + * @see minplayer.players.base#play + */ +minplayer.players.youtube.prototype.play = function() { + minplayer.players.base.prototype.play.call(this); + if (this.isReady()) { + this.player.playVideo(); + } +}; + +/** + * @see minplayer.players.base#pause + */ +minplayer.players.youtube.prototype.pause = function() { + minplayer.players.base.prototype.pause.call(this); + if (this.isReady()) { + this.player.pauseVideo(); + } +}; + +/** + * @see minplayer.players.base#stop + */ +minplayer.players.youtube.prototype.stop = function() { + minplayer.players.base.prototype.stop.call(this); + if (this.isReady()) { + this.player.stopVideo(); + } +}; + +/** + * @see minplayer.players.base#seek + */ +minplayer.players.youtube.prototype.seek = function(pos) { + minplayer.players.base.prototype.seek.call(this, pos); + if (this.isReady()) { + this.player.seekTo(pos, true); + } +}; + +/** + * @see minplayer.players.base#setVolume + */ +minplayer.players.youtube.prototype.setVolume = function(vol) { + minplayer.players.base.prototype.setVolume.call(this, vol); + if (this.isReady()) { + this.player.setVolume(vol * 100); + } +}; + +/** + * @see minplayer.players.base#getVolume + */ +minplayer.players.youtube.prototype.getVolume = function(callback) { + if (this.isReady()) { + callback(this.player.getVolume()); + } +}; + +/** + * @see minplayer.players.base#getDuration. + */ +minplayer.players.youtube.prototype.getDuration = function(callback) { + if (this.isReady()) { + callback(this.player.getDuration()); + } +}; + +/** + * @see minplayer.players.base#getCurrentTime + */ +minplayer.players.youtube.prototype.getCurrentTime = function(callback) { + if (this.isReady()) { + callback(this.player.getCurrentTime()); + } +}; + +/** + * @see minplayer.players.base#getBytesStart. + */ +minplayer.players.youtube.prototype.getBytesStart = function(callback) { + if (this.isReady()) { + callback(this.player.getVideoStartBytes()); + } +}; + +/** + * @see minplayer.players.base#getBytesLoaded. + */ +minplayer.players.youtube.prototype.getBytesLoaded = function(callback) { + if (this.isReady()) { + callback(this.player.getVideoBytesLoaded()); + } +}; + +/** + * @see minplayer.players.base#getBytesTotal. + */ +minplayer.players.youtube.prototype.getBytesTotal = function(callback) { + if (this.isReady()) { + callback(this.player.getVideoBytesTotal()); + } +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.players.base + * @class The vimeo media player. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.players.vimeo = function(context, options, queue) { + + // Derive from players base. + minplayer.players.base.call(this, context, options, queue); +}; + +/** Derive from minplayer.players.base. */ +minplayer.players.vimeo.prototype = new minplayer.players.base(); + +/** Reset the constructor. */ +minplayer.players.vimeo.prototype.constructor = minplayer.players.vimeo; + +/** + * @see minplayer.players.base#getPriority + * @return {number} The priority of this media player. + */ +minplayer.players.vimeo.getPriority = function() { + return 10; +}; + +/** + * @see minplayer.players.base#canPlay + * @return {boolean} If this player can play this media type. + */ +minplayer.players.vimeo.canPlay = function(file) { + + // Check for the mimetype for vimeo. + if (file.mimetype === 'video/vimeo') { + return true; + } + + // If the path is a vimeo path, then return true. + return (file.path.search(/^http(s)?\:\/\/(www\.)?vimeo\.com/i) === 0); +}; + +/** + * Return the ID for a provided media file. + * + * @param {object} file A {@link minplayer.file} object. + * @return {string} The ID for the provided media. + */ +minplayer.players.vimeo.getMediaId = function(file) { + var regex = /^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i; + if (file.path.search(regex) === 0) { + return file.path.match(regex)[3]; + } + else { + return file.path; + } +}; + +/** + * @see minplayer.players.base#reset + */ +minplayer.players.vimeo.prototype.reset = function() { + + // Reset the flash variables.. + minplayer.players.base.prototype.reset.call(this); +}; + +/** + * @see minplayer.players.base#create + * @return {object} The media player entity. + */ +minplayer.players.vimeo.prototype.create = function() { + minplayer.players.base.prototype.create.call(this); + + // Insert the Vimeo Froogaloop player. + var tag = document.createElement('script'); + tag.src = 'http://a.vimeocdn.com/js/froogaloop2.min.js'; + var firstScriptTag = document.getElementsByTagName('script')[0]; + firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); + + // Create the iframe for this player. + var iframe = document.createElement('iframe'); + iframe.setAttribute('id', this.options.id + '-player'); + iframe.setAttribute('type', 'text/html'); + iframe.setAttribute('width', '100%'); + iframe.setAttribute('height', '100%'); + iframe.setAttribute('frameborder', '0'); + + // Get the source. + var src = 'http://player.vimeo.com/video/'; + src += this.mediaFile.id + '?'; + + // Add the parameters to the src. + src += jQuery.param({ + 'wmode': 'opaque', + 'api': 1, + 'player_id': this.options.id + '-player', + 'title': 0, + 'byline': 0, + 'portrait': 0, + 'autoplay': this.options.autoplay, + 'loop': this.options.loop + }); + + // Set the source of the iframe. + iframe.setAttribute('src', src); + + // Now register this player when the froogaloop code is loaded. + this.poll((function(player) { + return function() { + if (window.Froogaloop) { + player.player = window.Froogaloop(iframe); + player.player.addEvent('ready', function() { + player.onReady(); + }); + } + return !window.Froogaloop; + }; + })(this), 200); + + // Trigger that the load has started. + this.trigger('loadstart'); + + // Return the player. + return iframe; +}; + +/** + * @see minplayer.players.base#onReady + */ +minplayer.players.vimeo.prototype.onReady = function(player_id) { + + // Add the other listeners. + this.player.addEvent('loadProgress', (function(player) { + return function(progress) { + player.duration.set(parseFloat(progress.duration)); + player.bytesLoaded.set(progress.bytesLoaded); + player.bytesTotal.set(progress.bytesTotal); + }; + })(this)); + + this.player.addEvent('playProgress', (function(player) { + return function(progress) { + player.duration.set(parseFloat(progress.duration)); + player.currentTime.set(parseFloat(progress.seconds)); + }; + })(this)); + + this.player.addEvent('play', (function(player) { + return function() { + player.onPlaying(); + }; + })(this)); + + this.player.addEvent('pause', (function(player) { + return function() { + player.onPaused(); + }; + })(this)); + + this.player.addEvent('finish', (function(player) { + return function() { + player.onComplete(); + }; + })(this)); + + minplayer.players.base.prototype.onReady.call(this); + this.onLoaded(); +}; + +/** + * Checks to see if this player can be found. + * @return {bool} TRUE - Player is found, FALSE - otherwise. + */ +minplayer.players.vimeo.prototype.playerFound = function() { + var iframe = this.display.find('iframe#' + this.options.id + '-player'); + return (iframe.length > 0); +}; + +/** + * @see minplayer.players.base#play + */ +minplayer.players.vimeo.prototype.play = function() { + minplayer.players.base.prototype.play.call(this); + if (this.isReady()) { + this.player.api('play'); + } +}; + +/** + * @see minplayer.players.base#pause + */ +minplayer.players.vimeo.prototype.pause = function() { + minplayer.players.base.prototype.pause.call(this); + if (this.isReady()) { + this.player.api('pause'); + } +}; + +/** + * @see minplayer.players.base#stop + */ +minplayer.players.vimeo.prototype.stop = function() { + minplayer.players.base.prototype.stop.call(this); + if (this.isReady()) { + this.player.api('unload'); + } +}; + +/** + * @see minplayer.players.base#seek + */ +minplayer.players.vimeo.prototype.seek = function(pos) { + minplayer.players.base.prototype.seek.call(this, pos); + if (this.isReady()) { + this.player.api('seekTo', pos); + } +}; + +/** + * @see minplayer.players.base#setVolume + */ +minplayer.players.vimeo.prototype.setVolume = function(vol) { + minplayer.players.base.prototype.setVolume.call(this, vol); + if (this.isReady()) { + this.volume.set(vol); + this.player.api('setVolume', vol); + } +}; + +/** + * @see minplayer.players.base#getVolume + */ +minplayer.players.vimeo.prototype.getVolume = function(callback) { + this.player.api('getVolume', function(vol) { + callback(vol); + }); +}; + +/** + * @see minplayer.players.base#getDuration. + */ +minplayer.players.vimeo.prototype.getDuration = function(callback) { + if (this.isReady()) { + if (this.duration.value) { + callback(this.duration.value); + } + else { + this.player.api('getDuration', function(duration) { + callback(duration); + }); + } + } +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** + * @constructor + * @extends minplayer.display + * @class This is the base minplayer controller. Other controllers can derive + * from the base and either build on top of it or simply define the elements + * that this base controller uses. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +minplayer.controller = function(context, options) { + + // Derive from display + minplayer.display.call(this, 'controller', context, options); +}; + +/** Derive from minplayer.display. */ +minplayer.controller.prototype = new minplayer.display(); + +/** Reset the constructor. */ +minplayer.controller.prototype.constructor = minplayer.controller; + +/** + * A static function that will format a time value into a string time format. + * + * @param {integer} time An integer value of time. + * @return {string} A string representation of the time. + */ +minplayer.formatTime = function(time) { + time = time || 0; + var seconds = 0, minutes = 0, hour = 0, timeString = ''; + + hour = Math.floor(time / 3600); + time -= (hour * 3600); + minutes = Math.floor(time / 60); + time -= (minutes * 60); + seconds = Math.floor(time % 60); + + if (hour) { + timeString += String(hour); + timeString += ':'; + } + + timeString += (minutes >= 10) ? String(minutes) : ('0' + String(minutes)); + timeString += ':'; + timeString += (seconds >= 10) ? String(seconds) : ('0' + String(seconds)); + return {time: timeString, units: ''}; +}; + +/** + * @see minplayer.display#getElements + * @return {object} The elements defined by this display. + */ +minplayer.controller.prototype.getElements = function() { + var elements = minplayer.display.prototype.getElements.call(this); + return jQuery.extend(elements, { + play: null, + pause: null, + fullscreen: null, + seek: null, + progress: null, + volume: null, + timer: null + }); +}; + +/** + * @see minplayer.plugin#construct + */ +minplayer.controller.prototype.construct = function() { + + // Call the minplayer plugin constructor. + minplayer.display.prototype.construct.call(this); + + // Keep track of if we are dragging... + this.dragging = false; + + // If they have a seek bar. + if (this.elements.seek) { + + // Create the seek bar slider control. + this.seekBar = this.elements.seek.slider({ + range: 'min' + }); + } + + // If they have a volume bar. + if (this.elements.volume) { + + // Create the volume bar slider control. + this.volumeBar = this.elements.volume.slider({ + range: 'min', + orientation: 'vertical' + }); + } + + // Get the player plugin. + this.get('player', function(player) { + + // If they have a fullscreen button. + if (this.elements.fullscreen) { + + // Bind to the click event. + this.elements.fullscreen.unbind().bind('click', function(e) { + + // Toggle fullscreen mode. + player.toggleFullScreen(); + }).css({'pointer' : 'hand'}); + } + }); + + // Get the media plugin. + this.get('media', function(media) { + + // If they have a pause button + if (this.elements.pause) { + + // Bind to the click on this button. + this.elements.pause.unbind().bind('click', (function(controller) { + return function(event) { + event.preventDefault(); + controller.playPause(false, media); + }; + })(this)); + + // Bind to the pause event of the media. + media.bind('pause', (function(controller) { + return function(event) { + controller.setPlayPause(true); + }; + })(this)); + } + + // If they have a play button + if (this.elements.play) { + + // Bind to the click on this button. + this.elements.play.unbind().bind('click', (function(controller) { + return function(event) { + event.preventDefault(); + controller.playPause(true, media); + }; + })(this)); + + // Bind to the play event of the media. + media.bind('playing', (function(controller) { + return function(event) { + controller.setPlayPause(false); + }; + })(this)); + } + + // If they have a duration, then trigger on duration change. + if (this.elements.duration) { + + // Bind to the duration change event. + media.bind('durationchange', (function(controller) { + return function(event, data) { + controller.setTimeString('duration', data.duration); + }; + })(this)); + + // Set the timestring to the duration. + media.getDuration((function(controller) { + return function(duration) { + controller.setTimeString('duration', duration); + }; + })(this)); + } + + // If they have a progress element. + if (this.elements.progress) { + + // Bind to the progress event. + media.bind('progress', (function(controller) { + return function(event, data) { + var percent = data.total ? (data.loaded / data.total) * 100 : 0; + controller.elements.progress.width(percent + '%'); + }; + })(this)); + } + + // If they have a seek bar or timer, bind to the timeupdate. + if (this.seekBar || this.elements.timer) { + + // Bind to the time update event. + media.bind('timeupdate', (function(controller) { + return function(event, data) { + if (!controller.dragging) { + var value = 0; + if (data.duration) { + value = (data.currentTime / data.duration) * 100; + } + + // Update the seek bar if it exists. + if (controller.seekBar) { + controller.seekBar.slider('option', 'value', value); + } + + controller.setTimeString('timer', data.currentTime); + } + }; + })(this)); + } + + // If they have a seekBar element. + if (this.seekBar) { + + // Register the events for the control bar to control the media. + this.seekBar.slider({ + start: (function(controller) { + return function(event, ui) { + controller.dragging = true; + }; + })(this), + stop: (function(controller) { + return function(event, ui) { + controller.dragging = false; + media.getDuration(function(duration) { + media.seek((ui.value / 100) * duration); + }); + }; + })(this), + slide: (function(controller) { + return function(event, ui) { + media.getDuration(function(duration) { + var time = (ui.value / 100) * duration; + if (!controller.dragging) { + media.seek(time); + } + controller.setTimeString('timer', time); + }); + }; + })(this) + }); + } + + // Setup the volume bar. + if (this.volumeBar) { + + // Create the slider. + this.volumeBar.slider({ + slide: function(event, ui) { + media.setVolume(ui.value / 100); + } + }); + + media.bind('volumeupdate', (function(controller) { + return function(event, vol) { + controller.volumeBar.slider('option', 'value', (vol * 100)); + }; + })(this)); + + // Set the volume to match that of the player. + media.getVolume((function(controller) { + return function(vol) { + controller.volumeBar.slider('option', 'value', (vol * 100)); + }; + })(this)); + } + }); + + // We are now ready. + this.ready(); +}; + +/** + * Sets the play and pause state of the control bar. + * + * @param {boolean} state TRUE - Show Play, FALSE - Show Pause. + */ +minplayer.controller.prototype.setPlayPause = function(state) { + var css = ''; + if (this.elements.play) { + css = state ? 'inherit' : 'none'; + this.elements.play.css('display', css); + } + if (this.elements.pause) { + css = state ? 'none' : 'inherit'; + this.elements.pause.css('display', css); + } +}; + +/** + * Plays or pauses the media. + * + * @param {bool} state true => play, false => pause. + * @param {object} media The media player object. + */ +minplayer.controller.prototype.playPause = function(state, media) { + var type = state ? 'play' : 'pause'; + this.display.trigger(type); + this.setPlayPause(!state); + if (media) { + media[type](); + } +}; + +/** + * Sets the time string on the control bar. + * + * @param {string} element The name of the element to set. + * @param {number} time The total time amount to set. + */ +minplayer.controller.prototype.setTimeString = function(element, time) { + if (this.elements[element]) { + this.elements[element].text(minplayer.formatTime(time).time); + } +}; diff --git a/minplayer/com/mediafront/display/Image.as b/minplayer/com/mediafront/display/Image.as deleted file mode 100755 index d07af3b7..00000000 --- a/minplayer/com/mediafront/display/Image.as +++ /dev/null @@ -1,111 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.display { - import com.mediafront.utils.Utils; - import flash.net.*; - import flash.display.*; - import flash.geom.*; - import flash.events.*; - - public class Image extends Sprite { - public function loadImage( imagePath:String, _boundingRect:Rectangle = null ):void { - boundingRect=_boundingRect; - boundingRect=boundingRect?boundingRect:getRect(this); - - // Only load an image who's path is defined. - if (imagePath) { - currentLoader=createImageLoader(); - - var request:URLRequest=new URLRequest(imagePath); - request.requestHeaders.push( new URLRequestHeader("pragma", "no-cache") ); - - // Try to load the image. - try { - currentLoader.load(request); - } catch (e:Error) { - Utils.debug( "Error loading image." ); - } - } - } - - public function createImageLoader():Loader { - clearImage(); - var loader:Loader = new Loader(); - loader.contentLoaderInfo.addEventListener( Event.COMPLETE, onImageLoaded ); - loader.contentLoaderInfo.addEventListener( IOErrorEvent.IO_ERROR, onError ); - loader.addEventListener( IOErrorEvent.IO_ERROR, onError ); - addChild( loader ); - return loader; - } - - public function clearImage() { - var i:int=numChildren; - while (i--) { - var field:* =getChildAt(i); - if (field is Loader) { - field.unload(); - field.contentLoaderInfo.removeEventListener( Event.COMPLETE, onImageLoaded ); - field.contentLoaderInfo.removeEventListener( IOErrorEvent.IO_ERROR, onError ); - field.removeEventListener( IOErrorEvent.IO_ERROR, onError ); - removeChild( field ); - } - } - } - - public function resize( newRect:Rectangle ) { - if (currentLoader) { - var imageRect:Rectangle=Utils.getScaledRect(imageRatio,newRect); - currentLoader.width=imageRect.width; - currentLoader.height=imageRect.height; - currentLoader.x=imageRect.x; - currentLoader.y=imageRect.y; - } - } - - private function onImageLoaded( event:Event ) { - if (boundingRect&&event.target) { - // Get the image ratio of the loaded image. - imageRatio=event.target.width/event.target.height; - - // Resize to the image to our bounding rectangle. - resize( boundingRect ); - - // Trigger an event that the image has been added. - dispatchEvent( new Event( Event.ADDED ) ); - } - } - - private function onError( e:IOErrorEvent ) { - // For now, just give out a trace that an error has occured. - Utils.debug( e.toString() ); - } - - // The current loader variable. - private var currentLoader:Loader; - - // The bounding rectangle for this image. - private var boundingRect:Rectangle; - - // The width/height ratio of the loaded image. - public var imageRatio:Number=1.3333; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/display/Menu.as b/minplayer/com/mediafront/display/Menu.as deleted file mode 100755 index e235c0da..00000000 --- a/minplayer/com/mediafront/display/Menu.as +++ /dev/null @@ -1,54 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.display { - import com.mediafront.plugin.SkinablePlugin; - import com.mediafront.plugin.PluginEvent; - import com.mediafront.utils.Settings; - import com.mediafront.utils.MediaSettings; - import com.mediafront.utils.Utils; - - import flash.display.*; - import flash.events.*; - - public class Menu extends SkinablePlugin { - public function Menu() { - super(); - } - - public override function loadSettings( _settings:Object ):void { - super.loadSettings( new MenuSettings( _settings ) ); - super.loadSkin( settings.menu ); - } - - public override function setSkin( _skin:MovieClip ):void { - super.setSkin( _skin ); - } - - public override function onReady():void { - super.onReady(); - } - - public override function onResize( deltaX:Number, deltaY:Number ):void { - super.onResize( deltaX, deltaY ); - } - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/display/Resizable.as b/minplayer/com/mediafront/display/Resizable.as deleted file mode 100755 index de0979d7..00000000 --- a/minplayer/com/mediafront/display/Resizable.as +++ /dev/null @@ -1,51 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.display { - import flash.display.DisplayObjectContainer; - - public class Resizable extends DisplayObjectContainer { - public var resizeX:Boolean=false; - public var resizeY:Boolean=false; - public var resizeW:Boolean=false; - public var resizeH:Boolean=false; - - public function onResize( deltaX:Number, deltaY:Number ) { - if (resizeX) { - x=x+deltaX; - } - if (resizeY) { - y=y+deltaY; - } - if (resizeW) { - width=width+deltaX; - } - if (resizeH) { - height=height+deltaY; - } - - var i=numChildren; - while ( i-- ) { - getChildAt(i) as Resizable.onResize( deltaX, deltaY ); - } - } - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/display/Skinable.as b/minplayer/com/mediafront/display/Skinable.as deleted file mode 100755 index f1443699..00000000 --- a/minplayer/com/mediafront/display/Skinable.as +++ /dev/null @@ -1,123 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.display { - import com.mediafront.utils.Utils; - - import flash.display.*; - import flash.events.*; - import flash.net.*; - - public class Skinable extends Sprite { - public function loadSkin( _skin:String ):void { - skinPath=_skin; - if (skinPath) { - if (swfLoader) { - swfLoader.unload(); - } else { - loadSWF(); - } - } - } - - public function onResize( deltaX:Number, deltaY:Number ):void { - if ( skin && (skin.onResize is Function) ) { - skin.onResize( deltaX, deltaY ); - } - } - - public function loadSWF():void { - createLoader(); - swfLoader.load( new URLRequest( skinPath ) ); - } - - public function createLoader():void { - if (! swfLoader) { - swfLoader = new Loader(); - swfLoader.contentLoaderInfo.addEventListener( Event.UNLOAD, skinUnloaded ); - swfLoader.contentLoaderInfo.addEventListener( Event.COMPLETE, skinLoaded ); - swfLoader.contentLoaderInfo.addEventListener( IOErrorEvent.IO_ERROR, errorHandler ); - } - } - - public function skinUnloaded( event:Event ):void { - loadSWF(); - } - - public function skinLoaded( event:Event ):void { - skin=MovieClip(swfLoader.content); - if (skin) { - if (skin.initialize is Function) { - skin.initialize( this ); - } - this.parent.addChild( skin ); - setSkin(skin); - } - } - - public function errorHandler( error:Object ):void { - Utils.debug( error.toString() ); - } - - public function setSkin( _skin:MovieClip ):void { - skin=_skin; - } - - public override function get visible():Boolean { - return skin ? skin.visible : false; - } - public override function set visible( _visible:Boolean ):void { - if (skin) { - skin.visible=_visible; - } - } - public override function set x( _x:Number ):void { - if (skin) { - skin.x=_x; - } - } - public override function set y( _y:Number ):void { - if (skin) { - skin.y=_y; - } - } - public override function set width( _width:Number ):void { - if (skin) { - skin.width=_width; - } - } - public override function get width():Number { - return skin ? skin.width : 0; - } - public override function set height( _height:Number ):void { - if (skin) { - skin.height=_height; - } - } - public override function get height():Number { - return skin ? skin.height : 0; - } - - public var skin:MovieClip; - public var skinPath:String; - public var swfLoader:Loader; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/display/Slider.as b/minplayer/com/mediafront/display/Slider.as deleted file mode 100755 index 6f344819..00000000 --- a/minplayer/com/mediafront/display/Slider.as +++ /dev/null @@ -1,126 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.display { - import com.mediafront.display.media.controls.ControlEvent; - - import flash.events.*; - import flash.geom.*; - import flash.display.*; - import flash.utils.*; - - public class Slider extends Skinable { - public function Slider( _skin:* ) { - super(); - setSkin( _skin ); - } - - public override function setSkin( _skin:MovieClip ):void { - super.setSkin( _skin ); - - handle=_skin.handle; - if (handle) { - handle.buttonMode=true; - handle.mouseChildren=false; - handle.addEventListener( MouseEvent.MOUSE_DOWN, onHandleDown ); - handle.addEventListener( MouseEvent.MOUSE_UP, onHandleUp ); - } - - track=_skin.track; - if (track) { - track.buttonMode=true; - track.addEventListener( MouseEvent.CLICK, onSetValue ); - dragRect = new Rectangle( track.x, track.y, (track.width - handle.width), 0 ); - } - - fullness=_skin.fullness; - - dragTimer=new Timer(250); - dragTimer.stop(); - dragTimer.addEventListener( TimerEvent.TIMER, onDragTimer ); - } - - public function setValue( newValue:Number ):void { - setPosition( newValue ); - dispatchEvent( new ControlEvent( ControlEvent.CONTROL_SET ) ); - } - - public function updateValue( newValue:Number, setHandle:Boolean = true ):void { - setPosition( newValue, setHandle ); - dispatchEvent( new ControlEvent( ControlEvent.CONTROL_UPDATE ) ); - } - - public function setPosition( newValue:Number, setHandle:Boolean = true ):void { - newValue = (newValue < 0) ? 0 : newValue; - newValue = (newValue > 1) ? 1 : newValue; - value=newValue; - var fullWidth = (value * (track.width - handle.width)); - - if (fullness) { - fullness.width=fullWidth; - } - - if (handle&&setHandle) { - handle.x=track.x+fullWidth; - } - } - - private function onSetValue( event:MouseEvent ):void { - setValue( (event.localX * event.currentTarget.scaleX) / (track.width - handle.width) ); - } - - private function onTrackOut( event:MouseEvent ):void { - dragTimer.stop(); - dragging=false; - event.target.stopDrag(); - event.target.removeEventListener( MouseEvent.MOUSE_MOVE, onDrag ); - } - - private function onHandleDown( event:MouseEvent ):void { - dragTimer.start(); - dragging=true; - event.target.startDrag(false, dragRect); - event.target.addEventListener( MouseEvent.MOUSE_MOVE, onDrag ); - } - - private function onHandleUp( event:MouseEvent ):void { - onTrackOut( event ); - setValue( dragValue ); - } - - private function onDragTimer( e:TimerEvent ):void { - updateValue( dragValue, false ); - } - - private function onDrag(event:MouseEvent):void { - dragValue = (event.target.x - track.x) / (track.width - handle.width); - } - - public var value:Number=0; - public var handle:MovieClip; - public var track:MovieClip; - public var fullness:MovieClip; - public var dragTimer:Timer; - public var dragRect:Rectangle; - public var dragValue:Number=0; - public var dragging:Boolean=false; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/display/media/AudioPlayer.as b/minplayer/com/mediafront/display/media/AudioPlayer.as deleted file mode 100755 index 82bcfe65..00000000 --- a/minplayer/com/mediafront/display/media/AudioPlayer.as +++ /dev/null @@ -1,229 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.display.media { - import com.mediafront.display.media.MediaPlayer; - import com.mediafront.display.media.MediaEvent; - import com.mediafront.display.media.IMedia; - import com.mediafront.utils.Utils; - - import flash.display.*; - import flash.events.*; - import flash.media.*; - import flash.utils.*; - import flash.net.*; - - public class AudioPlayer extends Sound implements IMedia { - public function AudioPlayer( _debug:Boolean, _onMediaEvent:Function ) { - super(); - debug=_debug; - onMediaEvent=_onMediaEvent; - context=new SoundLoaderContext(5*1000,true); - } - - public function connect( stream:String ):void { - SoundMixer.stopAll(); - onMediaEvent( MediaEvent.CONNECTED ); - } - - public function loadFile( file:String ):void { - removeEventListener( Event.SOUND_COMPLETE, audioUpdate ); - removeEventListener( Event.ID3, audioUpdate ); - removeEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); - - addEventListener( Event.SOUND_COMPLETE, audioUpdate ); - addEventListener( Event.ID3, audioUpdate ); - addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); - - position=0; - duration=0; - vol=0.8; - loaded=false; - - Utils.debug( "AudioPlayer: loadFile( " + file + ")", debug ); - - var request:URLRequest=new URLRequest(file); - request.requestHeaders.push( new URLRequestHeader("pragma", "no-cache") ); - try { - super.load( request, context ); - loadInterval=setInterval(loadHandler,200); - } catch (error:Error) { - Utils.debug("Unable to load " + file); - } - } - - // Make sure we load if they don't have meta data in their audio. - private function loadHandler() { - if (bytesLoaded>=bytesTotal&&bytesLoaded>0) { - onLoaded(); - } - } - - private function onLoaded():void { - if (! loaded) { - loaded=true; - playMedia(); - } - clearInterval( loadInterval ); - } - - public function audioUpdate( e:Object ):void { - switch ( e.type ) { - case Event.ID3 : - onMediaEvent( MediaEvent.META ); - onLoaded(); - break; - - case Event.SOUND_COMPLETE : - onMediaEvent( MediaEvent.COMPLETE ); - break; - } - } - - private function ioErrorHandler(event:Event):void { - } - - public function getVolume():Number { - if (channel) { - return channel.soundTransform.volume; - } - - return 0; - } - - public function setVolume(_vol:Number):void { - Utils.debug( "AudioPlayer: setVolume( " + _vol + ")", debug ); - if (channel) { - try { - var transform:SoundTransform=channel.soundTransform; - transform.volume=vol=_vol; - channel.soundTransform=transform; - } catch (e:Error) { - Utils.debug( "ERROR: setVolume: " + e.toString() ); - } - } - } - - private function stopChannel():void { - if (channel) { - try { - channel.stop(); - } catch (e:Error) { - Utils.debug( e.toString() ); - } - } - clearInterval( loadInterval ); - SoundMixer.stopAll(); - } - - public function playMedia( setPos:Number = -1 ):void { - var newPos = (setPos >= 0) ? setPos : position; - Utils.debug( "AudioPlayer: playMedia( " + newPos + ")", debug ); - - try { - channel=super.play(newPos); - } catch (e:Error) { - Utils.debug( e.toString() ); - } - - if (channel) { - channel.removeEventListener( Event.SOUND_COMPLETE, audioUpdate ); - channel.addEventListener( Event.SOUND_COMPLETE, audioUpdate ); - } - - setVolume( vol ); - onMediaEvent( MediaEvent.PLAYING ); - } - - public function pauseMedia():void { - if (channel) { - position=channel.position; - } - - stopChannel(); - Utils.debug( "AudioPlayer: pauseMedia( " + position + ")", debug ); - onMediaEvent( MediaEvent.PAUSED ); - } - - public function stopMedia():void { - position=0; - duration=0; - vol=0.8; - loaded=false; - stopChannel(); - - // If we are still streaming a audio track, then close it. - try { - this.close(); - } catch (e:Error) { - Utils.debug( e.toString() ); - } - - Utils.debug( "AudioPlayer: stopMedia()", debug ); - onMediaEvent( MediaEvent.STOPPED ); - } - - public function seekMedia( pos:Number ):void { - if (channel) { - stopChannel(); - Utils.debug( "AudioPlayer: seekMedia( " + pos + ")", debug ); - playMedia((pos * 1000)); - } - } - - public function getDuration():Number { - var _duration:Number=duration; - if (this.bytesLoaded>=this.bytesTotal) { - duration=_duration=this.length/1000; - } else if ( !duration && this.length && (this.bytesLoaded > 0) && (this.bytesTotal > 0) ) { - duration = _duration = (uint(this.length/2) / uint(this.bytesLoaded/2)) * (this.bytesTotal / 1000); - } - return _duration; - } - - public function getCurrentTime():Number { - return (channel ? (channel.position / 1000) : 0); - } - - public function getMediaBytesLoaded():Number { - return bytesLoaded; - } - - public function getMediaBytesTotal():Number { - return bytesTotal; - } - - public function getRatio():Number { - return 0; - } - - private var loadInterval:Number; - - public var channel:SoundChannel; - public var context:SoundLoaderContext; - public var duration:Number=0; - public var position:Number=0; - public var loaded:Boolean=false; - public var debug:Boolean=false; - public var vol:Number=0.8; - public var onMediaEvent:Function=null; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/display/media/IMedia.as b/minplayer/com/mediafront/display/media/IMedia.as deleted file mode 100755 index e4529f04..00000000 --- a/minplayer/com/mediafront/display/media/IMedia.as +++ /dev/null @@ -1,38 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.display.media { - public interface IMedia { - function connect( stream:String ):void; - function loadFile( file:String ):void; - function setVolume(vol:Number):void; - function getVolume():Number; - function playMedia( setPos:Number = -1 ):void; - function pauseMedia():void; - function stopMedia():void; - function seekMedia( pos:Number ):void; - function getMediaBytesLoaded():Number; - function getMediaBytesTotal():Number; - function getDuration():Number; - function getCurrentTime():Number; - function getRatio():Number; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/display/media/MediaEvent.as b/minplayer/com/mediafront/display/media/MediaEvent.as deleted file mode 100755 index fff080b1..00000000 --- a/minplayer/com/mediafront/display/media/MediaEvent.as +++ /dev/null @@ -1,49 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.display.media { - import flash.events.*; - - public class MediaEvent extends Event { - public static const CONNECTED:String="mediaConnected"; - public static const BUFFERING:String="mediaBuffering"; - public static const PAUSED:String="mediaPaused"; - public static const PLAYING:String="mediaPlaying"; - public static const STOPPED:String="mediaStopped"; - public static const COMPLETE:String="mediaComplete"; - public static const META:String="mediaMeta"; - - public function MediaEvent( type:String, a:Object = null ) { - super( type, true ); - args=a; - } - - override public function toString():String { - return formatToString( "MediaEvent", "type", "eventPhase" ); - } - - override public function clone():Event { - return new MediaEvent( type, args ); - } - - public var args:Object; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/display/media/MediaFile.as b/minplayer/com/mediafront/display/media/MediaFile.as deleted file mode 100755 index ae21501a..00000000 --- a/minplayer/com/mediafront/display/media/MediaFile.as +++ /dev/null @@ -1,73 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.display.media { - import com.mediafront.utils.Utils; - - public class MediaFile { - public var path:String=""; - public var stream:String=null; - public var extension:String=""; - public var mediaType:String=""; - public var loaded:Boolean=false; - - public function MediaFile( file:Object ) { - path=file.path; - stream=file.stream; - loaded=false; - extension=file.extension?file.extension:Utils.getFileExtension(path); - mediaType=file.mediaType?file.mediaType:getMediaType(); - } - - public function isValid():Boolean { - return (mediaType != ""); - } - - private function getMediaType():String { - switch ( extension ) { - case "swf" : - return "swf"; - - case "flv" : - case "f4v" : - case "mp4" : - case "m4v" : - case "mov" : - case "3g2" : - case "ogg" : - case "ogv" : - return "video"; - - case "mp3" : - case "m4a" : - case "aac" : - case "wav" : - case "aif" : - case "wma" : - case "oga" : - return "audio"; - - default : - return "video"; - } - } - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/display/media/MediaPlayer.as b/minplayer/com/mediafront/display/media/MediaPlayer.as deleted file mode 100755 index 7b6d85da..00000000 --- a/minplayer/com/mediafront/display/media/MediaPlayer.as +++ /dev/null @@ -1,301 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.display.media { - import com.mediafront.plugin.SkinablePlugin; - import com.mediafront.display.Image; - import com.mediafront.display.media.MediaEvent; - import com.mediafront.display.media.MediaFile; - import com.mediafront.display.media.VideoPlayer; - import com.mediafront.display.media.AudioPlayer; - import com.mediafront.plugin.PluginEvent; - import com.mediafront.utils.Settings; - import com.mediafront.utils.MediaSettings; - import com.mediafront.utils.Utils; - - import flash.display.*; - import flash.external.ExternalInterface; - import flash.geom.Rectangle; - import flash.events.*; - import flash.system.Security; - - public class MediaPlayer extends SkinablePlugin { - public function MediaPlayer() { - super(); - addCallbacks(); - } - - public override function loadSettings( _settings:Object ):void { - super.loadSettings( new MediaSettings( _settings ) ); - super.loadSkin( settings.mediaPlayer ); - } - - public override function setSkin( _skin:MovieClip ):void { - mediaRegion=_skin.mediaRegion; - backgroundMC=_skin.backgroundMC; - if (_skin.preview&&settings.image) { - preview=_skin.preview; - preview.addEventListener(Event.ADDED, onPreviewLoaded); - preview.loadImage( settings.image ); - } - - super.setSkin( _skin ); - } - - protected function onPreviewLoaded( event:Event ) { - preview.resize( backgroundMC.getRect(this) ); - } - - public override function onReady():void { - super.onReady(); - - // Don't load the media until all plugins have finished loading. - loadMedia( settings.file, settings.stream ); - } - - private function addCallbacks():void { - if (ExternalInterface.available) { - try { - ExternalInterface.addCallback( "loadMedia", loadMedia ); - ExternalInterface.addCallback( "playMedia", playMedia ); - ExternalInterface.addCallback( "pauseMedia", pauseMedia ); - ExternalInterface.addCallback( "stopMedia", stopMedia ); - ExternalInterface.addCallback( "seekMedia", seekMedia ); - ExternalInterface.addCallback( "setVolume", setVolume ); - ExternalInterface.addCallback( "getVolume", getVolume ); - ExternalInterface.addCallback( "getCurrentTime", getCurrentTime ); - ExternalInterface.addCallback( "getDuration", getDuration ); - ExternalInterface.addCallback( "getMediaBytesLoaded", getMediaBytesLoaded ); - ExternalInterface.addCallback( "getMediaBytesTotal", getMediaBytesTotal ); - } catch (error:SecurityError) { - Utils.debug("A SecurityError occurred: " + error.message + "\n"); - } catch (error:Error) { - Utils.debug("An Error occurred: " + error.message + "\n"); - } - } - } - - public function loadMedia( filePath:String, _stream:String = "" ):void { - createMedia( new MediaFile( {path:filePath, stream:_stream} ) ); - } - - public function playMedia():void { - try { - if (media && loadedFile.loaded) { - media.playMedia(); - } - } catch (e:Error) { - Utils.debug( "ERROR: playMedia: " + e.toString() ); - } - } - public function pauseMedia():void { - try { - if (media && loadedFile.loaded) { - media.pauseMedia(); - } - } catch (e:Error) { - Utils.debug( "ERROR: pauseMedia: " + e.toString() ); - } - } - public function seekMedia( pos:Number ):void { - try { - if (media && loadedFile.loaded) { - media.seekMedia( pos ); - } - } catch (e:Error) { - Utils.debug( "ERROR: seekMedia: " + e.toString() ); - } - } - public function setVolume( vol:Number ):void { - try { - if (media) { - media.setVolume( vol ); - } - } catch (e:Error) { - Utils.debug( "ERROR: setVolume: " + e.toString() ); - } - } - public function getVolume():Number { - return media ? media.getVolume() : 1; - } - public function getCurrentTime():Number { - return media ? media.getCurrentTime() : 0; - } - public function getDuration():Number { - return media ? media.getDuration() : 0; - } - public function getMediaBytesLoaded():Number { - return media ? media.getMediaBytesLoaded() : 0; - } - public function getMediaBytesTotal():Number { - return media ? media.getMediaBytesTotal() : 0; - } - - public override function onResize( deltaX:Number, deltaY:Number ):void { - // Resize the skin. - super.onResize( deltaX, deltaY ); - - // Now resize the video. - var mediaRatio:Number=media?media.getRatio():0; - if (mediaRatio) { - var videoRect:Rectangle=Utils.getScaledRect(mediaRatio,backgroundMC.getRect(this)); - media.setSize( videoRect.width, videoRect.height ); - media.x=videoRect.x; - media.y=videoRect.y; - } - } - - public function onMediaEvent( type:String ):void { - var dispatch:Boolean=true; - - if (ExternalInterface.available&&settings) { - Utils.debug("Calling Flash Update: " + type, settings.debug ); - ExternalInterface.call( "onFlashPlayerUpdate", settings.id, type ); - } - - switch ( type ) { - case MediaEvent.CONNECTED : - onMediaConnected(); - break; - case MediaEvent.PLAYING : - dispatch=onMediaPlaying(); - break; - case MediaEvent.META : - onMediaMeta(); - break; - } - - if (dispatch) { - // Now dispatch this event for everyone interested. - dispatchEvent( new MediaEvent( type ) ); - } - } - - private function onMediaConnected():void { - media.loadFile( loadedFile.path ); - } - - private function onMediaPlaying():Boolean { - loadedFile.loaded=true; - if (settings && !settings.autostart) { - settings.autostart=true; - if (preview && mediaRegion) { - mediaRegion.visible=false; - } - pauseMedia(); - return false; - } else { - // Set the preview to be invisible for non-audio types. - if (preview) { - preview.visible = (loadedFile.mediaType == "audio"); - } - - // Reshow the media region. - if (preview && mediaRegion) { - mediaRegion.visible=true; - } - } - return true; - } - - private function onMediaMeta():void { - loadedFile.loaded=true; - onResize(0,0); - } - - private function createMedia( mediaFile:MediaFile ):void { - if (mediaFile.isValid()) { - stopMedia(); - - // Make sure our preview is visible. - if (preview) { - preview.visible=true; - } - - // Only load a new player if we must. - if ( !loadedFile || (loadedFile.mediaType != mediaFile.mediaType) ) { - switch ( mediaFile.mediaType ) { - case "video" : - addVideo( new VideoPlayer( stage.stageWidth, stage.stageHeight, settings.debug, onMediaEvent) ); - break; - - case "swf" : - addVideo( new SWFPlayer(settings.debug, onMediaEvent) ); - break; - - case "audio" : - media=new AudioPlayer(settings.debug,onMediaEvent); - break; - } - } - - if (media) { - try { - media.addEventListener( MediaEvent.CONNECTED, onMediaEvent ); - media.addEventListener( MediaEvent.META, onMediaEvent ); - media.addEventListener( MediaEvent.BUFFERING, onMediaEvent ); - media.addEventListener( MediaEvent.PAUSED, onMediaEvent ); - media.addEventListener( MediaEvent.PLAYING, onMediaEvent ); - media.addEventListener( MediaEvent.COMPLETE, onMediaEvent ); - } catch (error:Error) { - Utils.debug("An Error occurred: " + error.message + "\n"); - } - } - - // Save the loaded file for later. - loadedFile=mediaFile; - - // Connect to the media stream. - media.connect( mediaFile.stream ); - } - } - - public function stopMedia():void { - if (media) { - media.stopMedia(); - try { - media.removeEventListener( MediaEvent.CONNECTED, onMediaEvent ); - media.removeEventListener( MediaEvent.META, onMediaEvent ); - media.removeEventListener( MediaEvent.BUFFERING, onMediaEvent ); - media.removeEventListener( MediaEvent.PAUSED, onMediaEvent ); - media.removeEventListener( MediaEvent.PLAYING, onMediaEvent ); - media.removeEventListener( MediaEvent.COMPLETE, onMediaEvent ); - } catch (error:Error) { - Utils.debug("An Error occurred: " + error.message + "\n"); - } - } - } - - private function addVideo( _media:* ):void { - if (media) { - mediaRegion.removeChild( media ); - } - media=_media; - mediaRegion.addChild( media ); - } - - public var mediaRegion:MovieClip; - public var backgroundMC:MovieClip; - public var preview:Image; - public var media:* =null; - public var loadedFile:MediaFile=null; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/display/media/SWFPlayer.as b/minplayer/com/mediafront/display/media/SWFPlayer.as deleted file mode 100755 index 59d9d020..00000000 --- a/minplayer/com/mediafront/display/media/SWFPlayer.as +++ /dev/null @@ -1,160 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.display.media { - import com.mediafront.utils.Utils; - import com.mediafront.display.media.MediaEvent; - import com.mediafront.display.media.IMedia; - - import flash.display.*; - import flash.events.*; - import flash.media.*; - import flash.utils.*; - import flash.net.*; - - public class SWFPlayer extends MovieClip implements IMedia { - public function SWFPlayer( _debug:Boolean, _onMediaEvent:Function ) { - loader=null; - bytesLoaded=0; - bytesTotal=0; - as2=false; - debug=_debug; - onMediaEvent=_onMediaEvent; - } - - public function connect( stream:String ):void { - onMediaEvent( MediaEvent.CONNECTED ); - } - - public function loadFile( file:String ):void { - Utils.debug("swf.loadFile( " + file + " )", debug); - bytesLoaded=0; - bytesTotal=0; - if (swf) { - removeChild(swf); - } - loader = new Loader(); - loader.contentLoaderInfo.addEventListener( Event.COMPLETE, onLoaded ); - loader.contentLoaderInfo.addEventListener( ProgressEvent.PROGRESS, onLoading ); - loader.contentLoaderInfo.addEventListener( IOErrorEvent.IO_ERROR, onError ); - loader.load(new URLRequest(file)); - } - - private function onLoaded( event:Event ):void { - try { - swf=MovieClip(loader.content); - } catch (error:Error) { - swf=AVM1Movie(loader.content); - as2=true; - } - addChild(swf); - onMediaEvent( MediaEvent.META ); - onMediaEvent( MediaEvent.PLAYING ); - } - - private function onLoading( event:ProgressEvent ):void { - bytesLoaded=event.bytesLoaded; - bytesTotal=event.bytesTotal; - } - - private function onError(event:Event):void { - } - - public function getVolume():Number { - return 0; - } - - public function setVolume(vol:Number):void { - } - - public function playMedia( setPos:Number = -1 ):void { - Utils.debug("swf.playMedia()", debug); - if (! as2) { - swf.play(); - onMediaEvent( MediaEvent.PLAYING ); - } - } - - public function pauseMedia():void { - Utils.debug("swf.pauseMedia()", debug); - if (! as2) { - swf.stop(); - onMediaEvent( MediaEvent.PAUSED ); - } - } - - public function stopMedia():void { - Utils.debug("swf.stopMedia()", debug); - if (! as2) { - swf.stop(); - } - loader.unload(); - onMediaEvent( MediaEvent.STOPPED ); - } - - public function seekMedia( pos:Number ):void { - if (! as2&&swf&&stage) { - swf.gotoAndPlay( (pos / stage.frameRate) ); - } - } - - public function getDuration():Number { - if (! as2&&swf&&stage) { - return (swf.totalFrames / stage.frameRate); - } else { - return 0; - } - } - - public function getCurrentTime():Number { - if (! as2&&swf&&stage) { - return (swf.currentFrame / stage.frameRate); - } else { - return 0; - } - } - - public function setSize( _width:Number, _height:Number ):void { - swf.width=_width; - swf.height=_height; - } - - public function getRatio():Number { - return (swf.width / swf.height); - } - - public function getMediaBytesLoaded():Number { - return bytesLoaded; - } - - public function getMediaBytesTotal():Number { - return bytesTotal; - } - - public var bytesLoaded:Number; - public var bytesTotal:Number; - private var loader:Loader; - private var swf:*; - private var as2:Boolean=false; - private var debug:Boolean; - private var onMediaEvent:Function=null; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/display/media/VideoPlayer.as b/minplayer/com/mediafront/display/media/VideoPlayer.as deleted file mode 100755 index 537ab45a..00000000 --- a/minplayer/com/mediafront/display/media/VideoPlayer.as +++ /dev/null @@ -1,312 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.display.media { - import com.mediafront.utils.Utils; - import com.mediafront.display.media.MediaEvent; - import com.mediafront.display.media.IMedia; - - import flash.media.Video; - import flash.media.SoundTransform; - import flash.media.SoundMixer; - import flash.display.*; - import flash.events.*; - import flash.net.*; - import flash.utils.*; - - public class VideoPlayer extends Video implements IMedia { - public function VideoPlayer( _width:uint, _height:uint, _debug:Boolean, _onMediaEvent:Function ) { - super(_width,_height); - debug=_debug; - onMediaEvent=_onMediaEvent; - } - - public function connect( videoStream:String ):void { - SoundMixer.stopAll(); - connection = new NetConnection(); - connection.objectEncoding=flash.net.ObjectEncoding.AMF0; - connection.addEventListener(NetStatusEvent.NET_STATUS, statusHandler ); - connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR,errorHandler); - connection.addEventListener(IOErrorEvent.IO_ERROR,errorHandler); - connection.addEventListener(AsyncErrorEvent.ASYNC_ERROR,errorHandler); - connection.client=this; - usingStream = (videoStream != null); - connection.connect( (videoStream ? videoStream : null) ); - } - - private function setupVideoStream():void { - stream=new NetStream(connection); - stream.addEventListener(NetStatusEvent.NET_STATUS,statusHandler); - stream.addEventListener(IOErrorEvent.IO_ERROR,errorHandler); - stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, errorHandler); - stream.bufferTime=5; - stream.client=this; - sound = new SoundTransform(); - stream.soundTransform=sound; - super.attachNetStream(stream); - smoothing=true; - deblocking=3; - onMediaEvent( MediaEvent.CONNECTED ); - } - - private function errorHandler(event:ErrorEvent):void { - Utils.debug("Error: " + event.text); - } - - public function loadFile( file:String ):void { - totalTime=0; - _videoWidth=0; - _videoHeight=0; - file=getFileName(file); - - if (usingStream) { - connection.call( "getStreamLength", new Responder( streamlengthHandler ), file ); - } - - Utils.debug("video.loadFile( " + file + " )", debug); - - if (stream!=null) { - try { - SoundMixer.stopAll(); - stream.play(file); - } catch (error:Error) { - Utils.debug(error.toString()); - return; - } - } - else { - Utils.debug("loadFile ERROR: stream is not ready!", debug); - } - } - - public function seekMedia( pos:Number ):void { - Utils.debug("video.seekMedia( " + pos + " )", debug); - if (stream!=null) { - try { - stream.seek( pos ); - } catch (error:Error) { - Utils.debug(error.toString()); - return; - } - } - else { - Utils.debug("seekMedia ERROR: stream is not ready!", debug); - } - } - - public function pauseMedia():void { - if (stream!=null) { - try { - Utils.debug("stream.pause()", debug); - stream.pause(); - onMediaEvent( MediaEvent.PAUSED ); - } catch (error:Error) { - Utils.debug(error.toString()); - return; - } - } - else { - Utils.debug("pauseMedia ERROR: stream is not ready!", debug); - } - } - - public function playMedia( setPos:Number = -1 ):void { - if (stream!=null) { - try { - Utils.debug("stream.resume()", debug); - stream.resume(); - onMediaEvent( MediaEvent.PLAYING ); - } catch (error:Error) { - Utils.debug(error.toString()); - return; - } - } - else { - Utils.debug("playMedia ERROR: stream is not ready!", debug); - } - } - - public function stopMedia():void { - Utils.debug("video.stopMedia()", debug); - SoundMixer.stopAll(); - if (stream) { - stream.removeEventListener(NetStatusEvent.NET_STATUS,statusHandler); - stream.removeEventListener(IOErrorEvent.IO_ERROR,errorHandler); - stream.removeEventListener(AsyncErrorEvent.ASYNC_ERROR, errorHandler); - stream.close(); - } - - if (connection) { - connection.removeEventListener(NetStatusEvent.NET_STATUS, statusHandler ); - connection.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,errorHandler); - connection.removeEventListener(IOErrorEvent.IO_ERROR,errorHandler); - connection.removeEventListener(AsyncErrorEvent.ASYNC_ERROR,errorHandler); - connection.close(); - } - onMediaEvent( MediaEvent.STOPPED ); - } - - public function getVolume():Number { - if (sound) { - return sound.volume; - } - return 0; - } - - public function setVolume(vol:Number):void { - if (sound && stream) { - sound.volume=vol; - stream.soundTransform=sound; - } - else { - Utils.debug("setVolume ERROR: stream is not ready!", debug); - } - } - - public function onMetaData(info:Object):void { - Utils.debug("onMetaData: totalTime=" + info.duration + ", width=" + info.width + ", height=" + info.height, debug ); - totalTime=info.duration; - _videoWidth=info.width; - _videoHeight=info.height; - onMediaEvent( MediaEvent.META ); - } - - public function onPlayStatus(info:Object):void { - Utils.debug("onPlayStatus( " + info.code + " )", debug ); - if (info.code=="NetStream.Play.Complete") { - onMediaEvent( MediaEvent.COMPLETE ); - } - } - - public function onLastSecond(info:Object):void { - Utils.debug("onLastSecond( " + info.code + " )", debug ); - } - - public function onCuePoint(info:Object):void { - Utils.debug("onCuePoint( " + info.code + " )", debug ); - } - - public function onXMPData(info:Object):void { - } - public function onTextData(info:Object):void { - } - public function onCaptionInfo(info:Object):void { - } - public function onCaption(cps:String,spk:Number):void { - } - public function onBWDone(...args):void { - } - - private function getFileName( fileName:String ):String { - if (usingStream) { - var ext:String=Utils.getFileExtension(fileName); - if (ext=='mp3') { - return 'mp3:'+fileName.substr(0,fileName.length-4); - } else if (ext == 'mp4' || ext == 'mov' || ext == 'aac' || ext == 'm4a') { - return 'mp4:'+fileName; - } else if (ext == 'flv') { - return fileName.substr(0,fileName.length-4); - } - } - return fileName; - } - - private function streamlengthHandler(len:Number):void { - totalTime=len; - onMediaEvent( MediaEvent.META ); - } - - public function getDuration():Number { - return totalTime; - } - - public function getCurrentTime():Number { - return (stream != null) ? stream.time : 0; - } - - public function getMediaBytesLoaded():Number { - return stream ? stream.bytesLoaded : 0; - } - - public function getMediaBytesTotal():Number { - return stream ? stream.bytesTotal : 0; - } - - private function statusHandler(event:NetStatusEvent):void { - Utils.debug("Video: status = " + event.info.code, debug ); - switch ( event.info.code ) { - case "NetConnection.Connect.Success" : - setupVideoStream(); - break; - - case "NetStream.Buffer.Empty" : - onMediaEvent( MediaEvent.BUFFERING ); - break; - - case "NetStream.Pause.Notify" : - onMediaEvent( MediaEvent.PAUSED ); - break; - - case "NetStream.Buffer.Full" : - onMediaEvent( MediaEvent.PLAYING ); - break; - - case "NetStream.Play.Start" : - if (usingStream) { - onMediaEvent( MediaEvent.BUFFERING ); - } - break; - - case "NetStream.Play.Stop" : - if (! usingStream) { - onMediaEvent( MediaEvent.COMPLETE ); - } - break; - - case "NetStream.Play.StreamNotFound" : - stopMedia(); - break; - - default : - break; - } - } - - public function setSize( newWidth:Number, newHeight:Number ):void { - this.width=newWidth; - this.height=newHeight; - } - - public function getRatio():Number { - return (videoHeight) ? (videoWidth / videoHeight) : (_videoWidth / _videoHeight); - } - - private var connection:NetConnection=null; - private var stream:NetStream=null; - private var sound:SoundTransform; - private var totalTime:Number=0; - private var usingStream:Boolean=false; - private var debug:Boolean=false; - private var _videoWidth:Number=0; - private var _videoHeight:Number=0; - private var onMediaEvent:Function=null; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/display/media/controls/ControlBar.as b/minplayer/com/mediafront/display/media/controls/ControlBar.as deleted file mode 100755 index bba44f71..00000000 --- a/minplayer/com/mediafront/display/media/controls/ControlBar.as +++ /dev/null @@ -1,256 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.display.media.controls { - import com.mediafront.utils.Utils; - import com.mediafront.plugin.SkinablePlugin; - import com.mediafront.display.Slider; - import com.mediafront.display.media.MediaEvent; - import com.mediafront.display.media.controls.ControlEvent; - import com.mediafront.plugin.PluginEvent; - import com.mediafront.utils.Settings; - import com.mediafront.utils.ControlSettings; - import flash.utils.Timer; - import flash.display.*; - import flash.text.TextField; - import flash.events.*; - import flash.system.Security; - import flash.external.ExternalInterface; - - public class ControlBar extends SkinablePlugin { - public override function loadSettings( _settings:Object ):void { - super.loadSettings( new ControlSettings( _settings ) ); - super.loadSkin( settings.controlBar ); - } - - public override function initialize( comps:Object ):void { - super.initialize( comps ); - components.mediaPlayer.addEventListener( MediaEvent.CONNECTED, onMediaEvent ); - components.mediaPlayer.addEventListener( MediaEvent.PLAYING, onMediaEvent ); - components.mediaPlayer.addEventListener( MediaEvent.PAUSED, onMediaEvent ); - components.mediaPlayer.addEventListener( MediaEvent.STOPPED, onMediaEvent ); - components.mediaPlayer.addEventListener( MediaEvent.META, onMediaEvent ); - } - - public override function setSkin( _skin:MovieClip ):void { - updateTimer=new Timer(1000); - updateTimer.stop(); - updateTimer.addEventListener( TimerEvent.TIMER, onMediaUpdate ); - - progressTimer=new Timer(500); - progressTimer.stop(); - progressTimer.addEventListener( TimerEvent.TIMER, onMediaProgress ); - - volumeBar=new Slider(_skin.volumeBar); - if (volumeBar) { - volumeBar.addEventListener( ControlEvent.CONTROL_SET, onVolume ); - } - - seekBar=new Slider(_skin.seekBar); - if (seekBar) { - seekBar.addEventListener( ControlEvent.CONTROL_SET, onSeek ); - } - - playPauseButton=_skin.playPauseButton; - if (playPauseButton) { - playPauseButton.buttonMode=true; - playPauseButton.mouseChildren=false; - playPauseButton.addEventListener( MouseEvent.CLICK, onPlayPause ); - } - - toggleFullScreen=_skin.toggleFullScreen; - if (toggleFullScreen) { - toggleFullScreen.buttonMode=true; - toggleFullScreen.mouseChildren=false; - toggleFullScreen.addEventListener( MouseEvent.CLICK, onToggleFullScreen ); - } - - menuButton=_skin.menuButton; - if (menuButton) { - menuButton.buttonMode=true; - menuButton.mouseChildren=false; - menuButton.addEventListener( MouseEvent.CLICK, onMenu ); - } - - mute=_skin.mute; - if (mute) { - mute.buttonMode=true; - mute.mouseChildren=false; - mute.addEventListener( MouseEvent.CLICK, onMute ); - } - - playTime=_skin.playTime; - duration=_skin.duration; - - playState=true; - muteState=false; - setPlayState( false ); - super.setSkin( _skin ); - } - - public override function onResize( deltaX:Number, deltaY:Number ):void { - super.onResize( deltaX, deltaY ); - volumeBar.onResize( deltaX, deltaY ); - seekBar.onResize( deltaX, deltaY ); - } - - public function onMediaEvent( event:* ):void { - switch ( event.type ) { - case MediaEvent.CONNECTED : - progressTimer.start(); - totalTime=0; - break; - case MediaEvent.PLAYING : - updateTimer.start(); - setPlayState( true ); - break; - case MediaEvent.PAUSED : - setPlayState( false ); - break; - case MediaEvent.STOPPED : - updateTimer.stop(); - progressTimer.stop(); - break; - case MediaEvent.META : - volumeBar.setValue(components.mediaPlayer.getVolume()); - updatePlayTime(); - break; - } - } - - private function onMediaUpdate( event:TimerEvent ):void { - updatePlayTime(); - } - - private function onMediaProgress( event:TimerEvent ):void { - var bLoaded:Number=components.mediaPlayer.getMediaBytesLoaded(); - var bTotal:Number=components.mediaPlayer.getMediaBytesTotal(); - var pLoaded:Number = bTotal ? (bLoaded / bTotal) : 0; - if (pLoaded<1) { - setPercentLoaded( pLoaded ); - } else { - setPercentLoaded( 1 ); - progressTimer.stop(); - } - } - - public function onSeek( event:ControlEvent ):void { - components.mediaPlayer.seekMedia( totalTime * seekBar.value ); - } - - public function onVolume( event:ControlEvent ):void { - currentVolume=volumeBar.value; - setMuteState( false ); - components.mediaPlayer.setVolume( currentVolume ); - } - - public function onMute( event:MouseEvent ):void { - setMuteState( !muteState ); - var newVolume:Number = (muteState ? 0 : currentVolume); - if (volumeBar) { - volumeBar.setPosition( newVolume ); - } - components.mediaPlayer.setVolume( newVolume ); - } - - public function onPlayPause( event:MouseEvent ):void { - setPlayState( !playState ); - if (playState) { - components.mediaPlayer.playMedia(); - } else { - components.mediaPlayer.pauseMedia(); - } - } - - public function onToggleFullScreen( event:MouseEvent ):void { - var on:Boolean = (stage.displayState == StageDisplayState.FULL_SCREEN); - stage.displayState=on?StageDisplayState.NORMAL:StageDisplayState.FULL_SCREEN; - } - - public function onMenu( event:MouseEvent ):void { - dispatchEvent( new ControlEvent( ControlEvent.MENU ) ); - } - - public function setVolume( vol:Number ):void { - currentVolume=vol; - if (volumeBar) { - volumeBar.setPosition( vol ); - } - } - - private function updatePlayTime():void { - totalTime=components.mediaPlayer.getDuration(); - var currentTime:Number=components.mediaPlayer.getCurrentTime(); - - if (skin.formatTime is Function) { - if (playTime) { - playTime.text=skin.formatTime(currentTime).time; - } - - if (duration) { - duration.text=skin.formatTime(totalTime).time; - } - } - - if (seekBar&&totalTime&&! seekBar.dragging) { - seekBar.updateValue( currentTime / totalTime ); - } - } - - public function setPercentLoaded( percent:Number ):void { - if (seekBar&&seekBar.skin.progress) { - seekBar.skin.progress.width = (seekBar.track.width * percent); - } - } - - public function setPlayState( newState:Boolean ):void { - if (playPauseButton) { - playPauseButton.onButton.visible=! newState; - playPauseButton.offButton.visible=newState; - playState=newState; - } - } - - public function setMuteState( newState:Boolean ):void { - if (mute) { - mute.onButton.visible=newState; - mute.offButton.visible=! newState; - muteState=newState; - } - } - - public var mute:MovieClip; - public var volumeBar:Slider; - public var seekBar:Slider; - public var playPauseButton:MovieClip; - public var playTime:TextField; - public var duration:TextField; - public var toggleFullScreen:MovieClip; - public var menuButton:MovieClip; - - public var playState:Boolean; - public var muteState:Boolean; - public var updateTimer:Timer; - public var progressTimer:Timer; - public var currentVolume:Number=1; - public var totalTime:Number=0; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/display/media/controls/ControlEvent.as b/minplayer/com/mediafront/display/media/controls/ControlEvent.as deleted file mode 100755 index dbc67104..00000000 --- a/minplayer/com/mediafront/display/media/controls/ControlEvent.as +++ /dev/null @@ -1,50 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.display.media.controls { - import flash.events.*; - - public class ControlEvent extends Event { - public static const PLAY:String="controlPlay"; - public static const PAUSE:String="controlPause"; - public static const SEEK:String="controlSeek"; - public static const VOLUME:String="controlVolume"; - public static const TOGGLEFULL:String="controlToggleFull"; - public static const MENU:String="controlMenu"; - public static const CONTROL_SET:String="controlSet"; - public static const CONTROL_UPDATE:String="controlUpdate"; - - public function ControlEvent( type:String, a:Object = null ) { - super( type, true ); - args=a; - } - - override public function toString():String { - return formatToString( "ControlEvent", "type", "eventPhase" ); - } - - override public function clone():Event { - return new ControlEvent( type, args ); - } - - public var args:Object; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/display/media/controls/PlayLoader.as b/minplayer/com/mediafront/display/media/controls/PlayLoader.as deleted file mode 100755 index 5e64779a..00000000 --- a/minplayer/com/mediafront/display/media/controls/PlayLoader.as +++ /dev/null @@ -1,98 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.display.media.controls { - import com.mediafront.plugin.SkinablePlugin; - import com.mediafront.display.media.MediaEvent; - import com.mediafront.display.Image; - import com.mediafront.plugin.PluginEvent; - import com.mediafront.utils.Settings; - import com.mediafront.utils.PlayLoaderSettings; - - import flash.display.*; - import flash.text.TextField; - import flash.events.*; - - public class PlayLoader extends SkinablePlugin { - public override function loadSettings( _settings:Object ):void { - super.loadSettings( new PlayLoaderSettings( _settings ) ); - super.loadSkin( settings.playLoader ); - } - - public override function initialize( comps:Object ):void { - super.initialize( comps ); - components.mediaPlayer.addEventListener( MediaEvent.PLAYING, onMediaEvent ); - components.mediaPlayer.addEventListener( MediaEvent.PAUSED, onMediaEvent ); - components.mediaPlayer.addEventListener( MediaEvent.BUFFERING, onMediaEvent ); - } - - public override function setSkin( _skin:MovieClip ):void { - playButton=_skin.playButton; - if (playButton) { - playButton.buttonMode=true; - playButton.mouseChildren=false; - playButton.addEventListener( MouseEvent.CLICK, onPlay ); - } - - loader=_skin.loader; - setPlayLoadState( true, true, false ); - super.setSkin( _skin ); - } - - public function onPlay( event:MouseEvent ) { - onMediaEvent( new MediaEvent( MediaEvent.PLAYING ) ); - components.mediaPlayer.playMedia(); - } - - public function onMediaEvent( event:* ) { - if (skin) { - switch ( event.type ) { - case MediaEvent.BUFFERING : - setPlayLoadState( true, true, false ); - break; - case MediaEvent.PLAYING : - setPlayLoadState( false, false, false ); - break; - case MediaEvent.PAUSED : - setPlayLoadState( true, false, true ); - break; - } - } - } - - public function setPlayLoadState( showSkin:Boolean, showLoader:Boolean, showPlay:Boolean ) { - if (skin) { - skin.visible=showSkin; - } - - if (loader) { - loader.visible=showLoader; - } - - if (playButton) { - playButton.visible=showPlay; - } - } - - public var playButton:MovieClip; - public var loader:MovieClip; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/plugin/Plugin.as b/minplayer/com/mediafront/plugin/Plugin.as deleted file mode 100755 index d7c64817..00000000 --- a/minplayer/com/mediafront/plugin/Plugin.as +++ /dev/null @@ -1,60 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.plugin { - import com.mediafront.utils.Settings; - import com.mediafront.plugin.PluginEvent; - - import flash.display.Sprite; - import flash.system.Security; - import flash.events.Event; - - public class Plugin extends Sprite { - public function Plugin() { - super(); - Security.allowDomain("*"); - } - - public function loadSettings( _settings:Object ):void { - settings=new Settings(_settings); - dispatchEvent( new Event( PluginEvent.PLUGIN_LOADED ) ); - } - - public function set info( pluginInfo:Object ):void { - _info=pluginInfo; - } - - public function get info():Object { - return _info; - } - - public function initialize( comps:Object ):void { - components=comps; - } - - public function onReady():void { - } - - protected var components:Object; - protected var settings:Object; - private var _info:Object; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/plugin/PluginEvent.as b/minplayer/com/mediafront/plugin/PluginEvent.as deleted file mode 100755 index f571d94a..00000000 --- a/minplayer/com/mediafront/plugin/PluginEvent.as +++ /dev/null @@ -1,27 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.plugin { - public class PluginEvent { - public static const PLUGIN_ADDED:String="pluginAdded"; - public static const PLUGIN_LOADED:String="pluginLoaded"; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/plugin/PluginLoader.as b/minplayer/com/mediafront/plugin/PluginLoader.as deleted file mode 100755 index a485e0cf..00000000 --- a/minplayer/com/mediafront/plugin/PluginLoader.as +++ /dev/null @@ -1,173 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.plugin { - import flash.events.*; - import flash.display.*; - import flash.utils.getDefinitionByName; - import flash.display.DisplayObject; - import flash.net.*; - import com.mediafront.utils.Settings; - import com.mediafront.utils.Utils; - import com.mediafront.plugin.PluginEvent; - - public class PluginLoader extends Sprite { - // Constructor. - public function PluginLoader( pluginInfo:Object ) { - super(); - - info=pluginInfo; - _syncFlags=0; - _loaded=0; - _loading=false; - dependencyMap = new Object(); - - // Set the visibility of this sprite based on plugin information. - visible=pluginInfo.visible; - - // The current sync flag... - var syncFlag:uint=1; - - // Iterate through all our dependencies. - for each (var dependency:String in pluginInfo.dependencies) { - // Store this value in our depency map. - dependencyMap[dependency]=syncFlag; - - // Set a different sync flag for each dependency. - _syncFlags |= ( 1 << syncFlag++ );//From 0000 to 0001 - } - } - - // Try to load the plugin. - public function loadPlugin( plugin:PluginLoader ):uint { - // Check to see if we have a dependency on this plugin. - if (! _loaded&&dependencyMap.hasOwnProperty(plugin.type)) { - - // Reset the sync bit for this dependency. - _syncFlags &= ~(1 << dependencyMap[plugin.type]); - - // Try to load. - load(); - } - - // Return if we are finished loading or not. - return _loaded; - } - - // Load the plugin. - public function load( baseURL:String = null ):void { - if (baseURL) { - _baseURL=baseURL; - } - // Need to wait for all of our dependencies to be loaded first. - if (! _syncFlags&&! _loading) { - - // Set our loading flag. - _loading=true; - - if (info.definition) { - // Try to load the plugin directly... if this doesn't work, then we will - // fall back to loading the SWF file. - try { - // See if this object exists. - var ClassReference:Class=getDefinitionByName(info.definition) as Class; - addPlugin(new ClassReference()); - } catch (e:ReferenceError) { - // If the class object does not exist, it will throw an exception to be caught here - // where it will try to load the SWF file within the plugins folder. catch (e:ReferenceError) { - // Load the SWF. - loadSWF(); - } - } else { - loadSWF(); - } - } - } - - private function loadSWF():void { - if( _baseURL ) { - _swfLoader = new Loader(); - _swfLoader.contentLoaderInfo.addEventListener( Event.COMPLETE, pluginLoaded ); - _swfLoader.contentLoaderInfo.addEventListener( IOErrorEvent.IO_ERROR, errorHandler ); - - var pluginURL:String=""; - pluginURL+=info.path.match(/^http(s)?\:\/\//)?'':_baseURL+"/"; - pluginURL+=info.path; - _swfLoader.load( new URLRequest( pluginURL ) ); - } - } - - // Typical error handler. - private function errorHandler( event:IOErrorEvent ):void { - Utils.debug( event.toString() ); - } - - // Called when the plugin SWF has finished loading. - private function pluginLoaded( event:Event ):void { - // Save the component. - addPlugin( _swfLoader.content ); - } - - // Used the add a plugin object to the plugin loader. - private function addPlugin( object:* ):void { - // Assign the component to the object. - component=object; - - // Add this component to the stage. - addChild( component ); - - // Now listen for when plugin is completely loaded. - component.addEventListener( PluginEvent.PLUGIN_LOADED, onPluginLoaded ); - - // Let the plugin manager know that a plugin has been added. - dispatchEvent( new Event( PluginEvent.PLUGIN_ADDED ) ); - } - - // Called when a plugin has finished loading. - private function onPluginLoaded( event:Event ):void { - // Set our loaded flag to true, and loading flag to false. - _loaded=1; - _loading=false; - - // Stop the propogation so that the manager doesn't get the event. - event.stopPropagation(); - - // Dispatch our own event to the plugin manager to let him know the - // pluin has finished loading. - dispatchEvent( new Event( PluginEvent.PLUGIN_LOADED ) ); - } - - public function get type():String { - return info.type; - } - - public var component:*; - public var dependencyMap:Object; - public var info:Object; - - private var _loaded:uint; - private var _loading:Boolean; - private var _baseURL:String; - - private var _syncFlags:uint; - private var _swfLoader:Loader; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/plugin/PluginManager.as b/minplayer/com/mediafront/plugin/PluginManager.as deleted file mode 100755 index 41e3a9e2..00000000 --- a/minplayer/com/mediafront/plugin/PluginManager.as +++ /dev/null @@ -1,318 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.plugin { - import com.mediafront.utils.Settings; - import com.mediafront.utils.Utils; - import com.mediafront.plugin.PluginEvent; - import com.mediafront.plugin.PluginLoader; - - import flash.events.Event; - import flash.display.*; - import flash.events.TimerEvent; - import flash.system.Security; - import flash.utils.Timer; - import flash.external.ExternalInterface; - import flash.display.Stage; - import flash.display.StageDisplayState; - import flash.system.Capabilities; - - public class PluginManager extends Sprite { - // Constructor. - public function PluginManager() { - super(); - - // Allow control for laoded SWF's - Security.allowDomain("*"); - - // Store the size of this player. - _lastWidth=stage.stageWidth; - _lastHeight=stage.stageHeight; - - // Set the stage properties. - stage.scaleMode=StageScaleMode.NO_SCALE; - stage.align=StageAlign.TOP_LEFT; - stage.addEventListener(Event.RESIZE, resizeHandler); - - // Initialize our plugins object. - _plugins = new Object(); - - // Create our settings object. - _settings=new Settings(null); - _settings.setLoaderInfo( stage.loaderInfo ); - - // Check to see if the external interface is ready. - if (ExternalInterface.available||isDebugBuild()) { - // If so, then load the plugin manager. - loadManager(); - } else { - // Otherwise, start a check interval. - startTimerCheck(); - } - } - - // Returns true if the swf is built in debug mode - public static function isDebugBuild():Boolean { - return new Error().getStackTrace().search(/:[0-9]+]$/m) > -1; - } - - // Loads the player. - private function loadManager():void { - // Add our JavaScript callbacks. - addCallbacks(); - - // Load the configuration file. - loadConfigFile( _settings.config ); - } - - // Start a timer check. - private function startTimerCheck() { - // Declare the readyTime if we have not already done so. - if (! _readyTimer) { - _readyTimer=new Timer(200); - _readyTimer.addEventListener(TimerEvent.TIMER, timerHandler); - } - - // Start the ready timer. - _readyTimer.start(); - } - - // Check the gateway every timer interval. - private function timerHandler(event:TimerEvent):void { - if (ExternalInterface.available) { - _readyTimer.stop(); - loadManager(); - } - } - - // Allow external components to load plugins. - private function addCallbacks():void { - try { - ExternalInterface.addCallback( "loadConfig", loadConfig ); - ExternalInterface.addCallback( "loadConfigFile", loadConfigFile ); - ExternalInterface.addCallback( "loadPlugins", loadPlugins ); - ExternalInterface.addCallback( "loadPlugin", loadPlugin ); - ExternalInterface.addCallback( "showPlugin", showPlugin ); - } catch (error:Error) { - Utils.debug("An Error occurred: " + error.message + "\n"); - } - } - - // Load the provided configuration. - public function loadConfigFile( config:String ):void { - if (config) { - var xmlURL:String=""; - xmlURL+=_settings.baseURL+"/"; - xmlURL+="config/"+config+".xml"; - Utils.loadFile( xmlURL, onConfigLoad, onConfigLoadError ); - } - } - - // Load the player with a configuration object. - public function loadConfig( config:Object ):void { - // Set the settings. - _settings.setSettings( config.settings ); - - // Now load the plugins. - loadPlugins( config.plugins ); - } - - // Load a series of plugins. - public function loadPlugins( plugins:Array ):void { - // Iterate through all of our plugins and add them. - for each (var pluginInfo:Object in plugins) { - loadPlugin( pluginInfo ); - } - } - - // Load a single plugin - public function loadPlugin( pluginInfo:Object ):void { - // Tell the outside world what is going on. - Utils.debug("Loading Plugin: " + pluginInfo.name, _settings.debug ); - - // Create the plugin and add the event listeners. - var plugin:PluginLoader=new PluginLoader(pluginInfo); - plugin.addEventListener( PluginEvent.PLUGIN_ADDED, onPluginAdded ); - plugin.addEventListener( PluginEvent.PLUGIN_LOADED, onPluginLoaded ); - - // Add the plugin to the stage. - addChild( plugin ); - - // If this type has not beed added yet, we need to create an array to add this to. - if (! _plugins.hasOwnProperty(pluginInfo.type)) { - _plugins[pluginInfo.type] = new Array(); - } - - // Add the plugin to the plugins array. - _plugins[pluginInfo.type].push(plugin); - - // Now load the plugin. - plugin.load(_settings.baseURL); - } - - // Hide or show a plugin. - public function showPlugin( type:String, show:Boolean ):void { - Utils.debug(type); - for each (var plugin:PluginLoader in _plugins[type]) { - plugin.visible=show; - } - } - - // Called when the configuration file is loaded. - private function onConfigLoad(event:Event):void { - // Get the configuration XML. - var configXML:XML=new XML(event.target.data); - var config:Object = {settings:{}, plugins:new Array()}; - - // Iterate through the settings from the XML. - for each (var setting:XML in configXML.settings.children()) { - config.settings[Utils.getLocalName(setting)]=setting.children().toString(); - } - - // Iterate through the plugins from the XML. - for each (var plugin:XML in configXML.plugins.plugin) { - - // Get all the dependencies for this plugin. - var dependencies:Array = new Array(); - for each (var dependency:XML in plugin.dependencies.elements()) { - dependencies.push( dependency.children().toString() ); - } - - // Add this to the plugins of our config object. - config.plugins.push({ - name:plugin.name.children().toString(), - definition:plugin.definition.children().toString(), - path:plugin.path.children().toString(), - skin:plugin.skin.children().toString(), - type:plugin.type.children().toString(), - visible:(plugin.visible.children().toString() == 'false' ? false : true), - dependencies:dependencies - }); - } - - // Now load the configuration. - loadConfig( config ); - } - - // Called when the configuration fails to load. - private function onConfigLoadError(event:Object):void { - Utils.debug( event.toString() ); - } - - // Called when a plugin has been added to the stage. - private function onPluginAdded( event:Event ):void { - // Get the loaded plugin. - var loadedPlugin:PluginLoader = (event.target as PluginLoader); - - // Set the info. - loadedPlugin.component.info=loadedPlugin.info; - - // Load the settings. - loadedPlugin.component.loadSettings( (_settings as Object) ); - } - - // Called when a plugin has finished loading. - private function onPluginLoaded( event:Event ):void { - // Get the loaded plugin. - var loadedPlugin:PluginLoader = (event.target as PluginLoader); - - // Tell the outside world what just happened. - Utils.debug("Plugin Loaded: " + loadedPlugin.name, _settings.debug ); - - // Iterate through all of this plugins dependencies and contruct - // and object of only the components that this plugin is dependent on. - var components:Object = new Object(); - for( var dependency:String in loadedPlugin.dependencyMap ) {; - components[dependency]=_plugins[dependency][0].component; - } - - // Pass our components into our loaded Plugin. - loadedPlugin.component.initialize( components ); - - // See if all the plugins have finished loading. - var allLoaded:uint=1; - - // Now iterate through all of our plugins - for each (var instances:Array in _plugins) { - - // Iterate through all of the plugin instances. - for each (var plugin:PluginLoader in instances) { - - // Load this plugin, and let us know if it is fully loaded. - allLoaded*=plugin.loadPlugin(loadedPlugin); - } - } - - // If all the plugins have finished loading, then we need to signal them accordingly. - if (allLoaded) { - // Tell the outside world what just happened. - Utils.debug( "All Plugins Loaded!", _settings.debug ); - - onReady(); - } - } - - // Called when all plugins are ready to go. - private function onReady():void { - // Iterate through all plugin instances. - for each (var instances:Array in _plugins) { - for each (var plugin:PluginLoader in instances) { - - // Call the onReady function. - plugin.component.onReady(); - } - } - - if (ExternalInterface.available&&_settings) { - ExternalInterface.call( "onFlashPlayerReady", _settings.id ); - } - } - - // Called when the player is resizing. - private function resizeHandler(event:Event):void { - if (stage) { - // Calculate the change in size. - var deltaX:Number = (stage.stageWidth - _lastWidth); - var deltaY:Number = (stage.stageHeight - _lastHeight); - - // Iterate through all of our plugin instances. - for each (var instances:Array in _plugins) { - for each (var plugin:PluginLoader in instances) { - if (plugin.component) { - // Call the resize function on this plugin. - plugin.component.onResize( deltaX, deltaY ); - } - } - } - - // Save the width and height. - _lastWidth=stage.stageWidth; - _lastHeight=stage.stageHeight; - } - } - - private var _plugins:Object; - private var _settings:Settings; - private var _lastWidth:Number; - private var _lastHeight:Number; - private var _readyTimer:Timer; -} -} \ No newline at end of file diff --git a/minplayer/com/mediafront/plugin/SkinablePlugin.as b/minplayer/com/mediafront/plugin/SkinablePlugin.as deleted file mode 100755 index 374ed25c..00000000 --- a/minplayer/com/mediafront/plugin/SkinablePlugin.as +++ /dev/null @@ -1,78 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.plugin { - import com.mediafront.utils.Utils; - import com.mediafront.display.Skinable; - import com.mediafront.utils.Settings; - import com.mediafront.plugin.PluginEvent; - - import flash.system.Security; - import flash.display.MovieClip; - import flash.events.Event; - - public class SkinablePlugin extends Skinable { - public function SkinablePlugin() { - super(); - Security.allowDomain("*"); - } - - public function loadSettings( _settings:Object ):void { - settings=_settings; - } - - public override function loadSkin( _skinName:String ):void { - var skinURL:String=""; - info.skin=info.skin.replace('%skin',settings.skin); - skinURL+=info.skin.match(/^http(s)?\:\/\//) ? '' : settings.baseURL+"/"; - skinURL+=info.skin; - Utils.debug("Loading Skin: " + skinURL, settings.debug); - super.loadSkin( skinURL ); - } - - public override function setSkin( _skin:MovieClip ):void { - dispatchEvent( new Event( PluginEvent.PLUGIN_LOADED ) ); - } - - public function getSettings():Object { - return settings; - } - - public function set info( pluginInfo:Object ):void { - _info=pluginInfo; - } - - public function get info():Object { - return _info; - } - - public function initialize( comps:Object ):void { - components=comps; - } - - public function onReady():void { - } - - protected var components:Object; - protected var settings:Object; - private var _info:Object; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/utils/ControlSettings.as b/minplayer/com/mediafront/utils/ControlSettings.as deleted file mode 100755 index a07a642b..00000000 --- a/minplayer/com/mediafront/utils/ControlSettings.as +++ /dev/null @@ -1,31 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.utils { - public class ControlSettings extends Settings { - public function ControlSettings( settings:Object ) { - super( settings ); - loadSettings(); - } - - public var controlBar:String="controlBar"; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/utils/MediaSettings.as b/minplayer/com/mediafront/utils/MediaSettings.as deleted file mode 100755 index 523fd84c..00000000 --- a/minplayer/com/mediafront/utils/MediaSettings.as +++ /dev/null @@ -1,35 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.utils { - public class MediaSettings extends Settings { - public function MediaSettings( settings:Object ) { - super( settings ); - loadSettings(); - } - - public var file:String=""; - public var image:String=""; - public var mediaPlayer:String="mediaPlayer"; - public var stream:String=null; - public var autostart:Boolean=false; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/utils/MenuSettings.as b/minplayer/com/mediafront/utils/MenuSettings.as deleted file mode 100755 index d5b09304..00000000 --- a/minplayer/com/mediafront/utils/MenuSettings.as +++ /dev/null @@ -1,29 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.utils { - public class MenuSettings extends Settings { - public function MenuSettings( settings:Object ) { - super( settings ); - loadSettings(); - } - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/utils/PlayLoaderSettings.as b/minplayer/com/mediafront/utils/PlayLoaderSettings.as deleted file mode 100755 index 5bddbd7d..00000000 --- a/minplayer/com/mediafront/utils/PlayLoaderSettings.as +++ /dev/null @@ -1,31 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.utils { - public class PlayLoaderSettings extends Settings { - public function PlayLoaderSettings( settings:Object ) { - super( settings ); - loadSettings(); - } - - public var playLoader:String="playLoader"; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/utils/Settings.as b/minplayer/com/mediafront/utils/Settings.as deleted file mode 100755 index fa5bebb3..00000000 --- a/minplayer/com/mediafront/utils/Settings.as +++ /dev/null @@ -1,124 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.utils { - import com.mediafront.utils.Utils; - import flash.display.LoaderInfo; - - public class Settings extends Object { - // A copy constructor... - public function Settings( _settings:Object ) { - super(); - if (_settings) { - baseURL=_settings.baseURL; - skin=_settings.skin; - id=_settings.skin; - config=_settings.config; - debug=_settings.debug; - settings=_settings.settings; - loaderInfo=_settings.loaderInfo; - } - } - - public function setLoaderInfo( lInfo:LoaderInfo ):void { - // Store the loader info. - loaderInfo=lInfo; - - // Set the baseURL. - if (loaderInfo.parameters.hasOwnProperty("baseURL")) { - setValue( "baseURL", loaderInfo.parameters ); - } else { - baseURL=getBaseURL(loaderInfo); - } - - // Set the config file. - if (loaderInfo.parameters.hasOwnProperty("config")) { - setValue( "config", loaderInfo.parameters ); - } - } - - // Set the settings. - public function setSettings( _settings:Object ):void { - settings=_settings; - - // Now load using our settings. - loadSettings(); - } - - // Load the settings. - public function loadSettings():void { - // First go through all of the settings and set the defaults. - for (var setting:String in settings) { - setValue( setting, settings ); - } - - // Now go through all the parameters and override the defaults. - for (setting in loaderInfo.parameters) { - setValue( setting, loaderInfo.parameters ); - } - } - - private function setValue( param:String, _settings:Object ):void { - if (hasOwnProperty(param)) { - this[param]=parseValue(typeof this[param],_settings[param]); - } - } - - private function parseValue( type:String, value:* ):* { - switch ( type ) { - case "boolean" : - return parseBoolean( value ); - - case "string" : - return parseBoolean( value ) ? value : ""; - - default : - return value; - } - } - - private function getBaseURL( loaderInfo:LoaderInfo ):String { - var paths:Array = new Array(); - var file:String=LoaderInfo(loaderInfo).url; - if (file.search(/\?/)>=0) { - paths=file.split(/\?/); - file=paths[0]; - } - paths=file.split(/[\\\/]/); - - paths.pop(); - return paths.join("/"); - } - - private function parseBoolean( value:* ):Boolean { - return (!value || value=="false" || value=="none" || value=="0") ? false : true; - } - - // All global settings go into the base. - public var baseURL:String; - public var skin:String="default"; - public var id:String=""; - public var config:String="config"; - public var debug:Boolean=false; - public var settings:Object; - public var loaderInfo:LoaderInfo; - } -} \ No newline at end of file diff --git a/minplayer/com/mediafront/utils/Utils.as b/minplayer/com/mediafront/utils/Utils.as deleted file mode 100755 index 616adb55..00000000 --- a/minplayer/com/mediafront/utils/Utils.as +++ /dev/null @@ -1,82 +0,0 @@ -/** - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.mediafront.utils { - import flash.geom.Rectangle; - import flash.external.ExternalInterface; - import flash.net.URLLoader; - import flash.net.URLRequest; - import flash.net.URLRequestHeader; - import flash.events.Event; - import flash.events.IOErrorEvent; - - public class Utils { - public static function debug( debugText:String, shouldDebug:Boolean = true ):void { - if (shouldDebug) { - trace( debugText ); - if (ExternalInterface.available) { - ExternalInterface.call("onFlashPlayerDebug", debugText); - } - } - } - - public static function loadFile( _file:String, onLoaded:Function, onError:Function ):void { - var loader:URLLoader = new URLLoader(); - loader.addEventListener( Event.COMPLETE, onLoaded ); - loader.addEventListener( IOErrorEvent.IO_ERROR, onError ); - var request:URLRequest=new URLRequest(_file); - request.requestHeaders.push( new URLRequestHeader("pragma", "no-cache") ); - try { - loader.load( request ); - } catch (error:Error) { - onError(null); - } - } - - public static function getLocalName( element:XML ):String { - var elementName:String = (element.localName() as String); - if (elementName) { - return elementName.toLowerCase(); - } - return ""; - } - - public static function getScaledRect( ratio:Number, rect:Rectangle ):Rectangle { - var scaledRect:Rectangle=new Rectangle(rect.x,rect.y,rect.width,rect.height); - - if (ratio) { - var newRatio:Number = (rect.width / rect.height); - scaledRect.height = (newRatio > ratio) ? rect.height : Math.floor(rect.width / ratio); - scaledRect.width = (newRatio > ratio) ? Math.floor(rect.height * ratio) : rect.width; - scaledRect.x = Math.floor((rect.width - scaledRect.width) / 2); - scaledRect.y = Math.floor((rect.height - scaledRect.height) / 2); - } - - return scaledRect; - } - - public static function getFileExtension( path:String ):String { - return path.substring(path.lastIndexOf(".") + 1).toLowerCase(); - } - - public static var debugEnabled:Boolean=false; - } -} \ No newline at end of file diff --git a/minplayer/doc/files.html b/minplayer/doc/files.html new file mode 100644 index 00000000..5d451caa --- /dev/null +++ b/minplayer/doc/files.html @@ -0,0 +1,424 @@ + + + + + + JsDoc Reference - File Index + + + + + + + + + + +
+

File Index

+ + +
+

src/minplayer.async.js

+ +
+ + + + +
+
+
+ +
+

src/minplayer.compatibility.js

+ +
+ + + + +
+
+
+ +
+

src/minplayer.controller.js

+ +
+ + + + +
+
+
+ +
+

src/minplayer.display.js

+ +
+ + + + +
+
+
+ +
+

src/minplayer.file.js

+ +
+ + + + +
+
+
+ +
+

src/minplayer.flags.js

+ +
+ + + + +
+
+
+ +
+

src/minplayer.image.js

+ +
+ + + + +
+
+
+ +
+

src/minplayer.js

+ +
+ + + + +
+
+
+ +
+

src/minplayer.players.base.js

+ +
+ + + + +
+
+
+ +
+

src/minplayer.players.flash.js

+ +
+ + + + +
+
+
+ +
+

src/minplayer.players.html5.js

+ +
+ + + + +
+
+
+ + +
+ +
+

src/minplayer.players.vimeo.js

+ +
+ + + + +
+
+
+ + +
+ +
+

src/minplayer.playLoader.js

+ +
+ + + + +
+
+
+ +
+

src/minplayer.plugin.js

+ +
+ + + + +
+
+
+ + +
+
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 22:38:48 GMT-0700 (PDT) +
+ + \ No newline at end of file diff --git a/minplayer/doc/index.html b/minplayer/doc/index.html new file mode 100644 index 00000000..91e619db --- /dev/null +++ b/minplayer/doc/index.html @@ -0,0 +1,329 @@ + + + + + + JsDoc Reference - Index + + + + + + + + + + +
+

Class Index

+ + +
+

_global_

+ +
+
+ + +
+ +
+

minplayer.async

+ This class keeps track of asynchronous get requests for certain +variables within the player. +
+
+ +
+

minplayer.compatibility

+ This class is used to define the types of media that can be played +within the browser. +
+
+ +
+

minplayer.display

+ Base class used to provide the display and options for any component +deriving from this class. +
+
+ +
+

minplayer.file

+ A wrapper class used to provide all the data necessary to control an +individual file within this media player. +
+
+ +
+

minplayer.flags

+ This is a class used to keep track of flag states +which is used to control the busy cursor, big play button, among other +items in which multiple components can have an interest in hiding or +showing a single element on the screen. +
+
+ +
+

minplayer.image

+ A class to easily handle images. +
+
+ +
+

minplayer.players.base

+ The base media player class where all media players derive from. +
+
+ +
+

minplayer.players.flash

+ The Flash media player class to control the flash fallback. +
+
+ +
+

minplayer.players.html5

+ The HTML5 media player implementation. +
+
+ +
+

minplayer.players.minplayer

+ The Flash media player class to control the flash fallback. +
+
+ +
+

minplayer.players.vimeo

+ The vimeo media player. +
+
+ +
+

minplayer.players.youtube

+ The YouTube media player. +
+
+ +
+

minplayer.plugin

+ The base class for all plugins. +
+
+ + +
+
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 22:38:48 GMT-0700 (PDT) +
+ + \ No newline at end of file diff --git a/minplayer/doc/symbols/_global_.html b/minplayer/doc/symbols/_global_.html new file mode 100644 index 00000000..a40b7d36 --- /dev/null +++ b/minplayer/doc/symbols/_global_.html @@ -0,0 +1,412 @@ + + + + + + + JsDoc Reference - _global_ + + + + + + + + + + + + + +
+ +

+ + Built-In Namespace _global_ +

+ + +

+ + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  +
+ minplayer +
+
The minplayer namespace.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
  +
checkPlayType(elem, playType) +
+
+
+ + + + + + + + + + + + +
+ Field Detail +
+ + +
+ + + minplayer + +
+
+ The minplayer namespace. + +
+ Defined in: minplayer.compatibility.js. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
+ + + checkPlayType(elem, playType) + +
+
+ + +
+ Defined in: minplayer.compatibility.js. + + +
+ + + + +
+
Parameters:
+ +
+ elem + +
+
+ +
+ playType + +
+
+ +
+ + + + + + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 22:38:47 GMT-0700 (PDT) +
+ + diff --git a/minplayer/doc/symbols/jQuery.fn.minplayer.html b/minplayer/doc/symbols/jQuery.fn.minplayer.html new file mode 100644 index 00000000..4f914790 --- /dev/null +++ b/minplayer/doc/symbols/jQuery.fn.minplayer.html @@ -0,0 +1,345 @@ + + + + + + + JsDoc Reference - jQuery.fn.minplayer + + + + + + + + + + + + + +
+ +

+ + Class jQuery.fn.minplayer +

+ + +

+ + + + + + +
Defined in: minplayer.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ jQuery.fn.minplayer(options) +
+
+
+ + + + + + + + + + + + +
+
+ Class Detail +
+ +
+ jQuery.fn.minplayer(options) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {object} options + +
+
The options for this jQuery prototype.
+ +
+ + + + + +
+
Returns:
+ +
{Array} jQuery object.
+ +
+ + + + +
+ + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 22:38:47 GMT-0700 (PDT) +
+ + diff --git a/minplayer/doc/symbols/minplayer.async.html b/minplayer/doc/symbols/minplayer.async.html new file mode 100644 index 00000000..f125a05c --- /dev/null +++ b/minplayer/doc/symbols/minplayer.async.html @@ -0,0 +1,535 @@ + + + + + + + JsDoc Reference - minplayer.async + + + + + + + + + + + + + +
+ +

+ + Class minplayer.async +

+ + +

+ + + + This class keeps track of asynchronous get requests for certain +variables within the player. + + +
Defined in: minplayer.async.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  +
+ queue +
+
The queue of callbacks to call when this value is determined.
+
  +
+ value +
+
The final value of this asynchronous variable.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
  +
get(callback, pollValue) +
+
Retrieve the value of this variable.
+
  +
set(val) +
+
Sets the value of an asynchronous value.
+
+ + + + + + + + + +
+
+ Class Detail +
+ +
+ minplayer.async() +
+ +
+ + +
+ + + + + + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + queue + +
+
+ The queue of callbacks to call when this value is determined. + + +
+ + + + + + + + +
+ + +
+ + + value + +
+
+ The final value of this asynchronous variable. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
+ + + get(callback, pollValue) + +
+
+ Retrieve the value of this variable. + + +
+ + + + +
+
Parameters:
+ +
+ {function} callback + +
+
The function to call when the value is determined.
+ +
+ {function} pollValue + +
+
The poll function to try and get the value every +1 second if the value is not set.
+ +
+ + + + + + + + +
+ + +
+ + + set(val) + +
+
+ Sets the value of an asynchronous value. + + +
+ + + + +
+
Parameters:
+ +
+ {void} val + +
+
The value to set.
+ +
+ + + + + + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 22:38:47 GMT-0700 (PDT) +
+ + diff --git a/minplayer/doc/symbols/minplayer.compatibility.html b/minplayer/doc/symbols/minplayer.compatibility.html new file mode 100644 index 00000000..2f18e9ad --- /dev/null +++ b/minplayer/doc/symbols/minplayer.compatibility.html @@ -0,0 +1,572 @@ + + + + + + + JsDoc Reference - minplayer.compatibility + + + + + + + + + + + + + +
+ +

+ + Class minplayer.compatibility +

+ + +

+ + + + This class is used to define the types of media that can be played +within the browser. +

+Usage: +


+  var playTypes = new minplayer.compatibility();
+
+  if (playTypes.videoOGG) {
+    console.log("This browser can play OGG video");
+  }
+
+  if (playTypes.videoH264) {
+    console.log("This browser can play H264 video");
+  }
+
+  if (playTypes.videoWEBM) {
+    console.log("This browser can play WebM video");
+  }
+
+  if (playTypes.audioOGG) {
+    console.log("This browser can play OGG audio");
+  }
+
+  if (playTypes.audioMP3) {
+    console.log("This browser can play MP3 audio");
+  }
+
+  if (playTypes.audioMP4) {
+    console.log("This browser can play MP4 audio");
+  }
+
+ + +
Defined in: minplayer.compatibility.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  +
+ audioMP3 +
+
Can play audio MP3
+
  +
+ audioMP4 +
+
Can play audio MP4
+
  +
+ audioOGG +
+
Can play audio OGG
+
  +
+ videoH264 +
+
Can play H264 video
+
  +
+ videoOGG +
+
Can play OGG video
+
  +
+ videoWEBM +
+
Can play WEBM video
+
+ + + + + + + + + + + + +
+
+ Class Detail +
+ +
+ minplayer.compatibility() +
+ +
+ + +
+ + + + + + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + audioMP3 + +
+
+ Can play audio MP3 + + +
+ + + + + + + + +
+ + +
+ + + audioMP4 + +
+
+ Can play audio MP4 + + +
+ + + + + + + + +
+ + +
+ + + audioOGG + +
+
+ Can play audio OGG + + +
+ + + + + + + + +
+ + +
+ + + videoH264 + +
+
+ Can play H264 video + + +
+ + + + + + + + +
+ + +
+ + + videoOGG + +
+
+ Can play OGG video + + +
+ + + + + + + + +
+ + +
+ + + videoWEBM + +
+
+ Can play WEBM video + + +
+ + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 22:38:47 GMT-0700 (PDT) +
+ + diff --git a/minplayer/doc/symbols/minplayer.controller.base.html b/minplayer/doc/symbols/minplayer.controller.base.html new file mode 100644 index 00000000..f6f9cb7c --- /dev/null +++ b/minplayer/doc/symbols/minplayer.controller.base.html @@ -0,0 +1,674 @@ + + + + + + + JsDoc Reference - minplayer.controller.base + + + + + + + + + + + + + +
+ +

+ + Class minplayer.controller.base +

+ + +

+ +
Extends + minplayer.display.
+ + + This is the base minplayer controller. Other controllers can derive +from the base and either build on top of it or simply define the elements +that this base controller uses. + + +
Defined in: minplayer.controller.base.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ minplayer.controller.base(context, options) +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  + +
Reset the constructor.
+
+ + + +
+
Fields borrowed from class minplayer.plugin:
lock, name, options, pluginReady, queue, triggered
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
  + +
+
  + +
+
  +
playPause(state, media) +
+
Plays or pauses the media.
+
  +
setPlayPause(state) +
+
Sets the play and pause state of the control bar.
+
  +
setTimeString(element, time) +
+
Sets the time string on the control bar.
+
+ + + +
+
Methods borrowed from class minplayer.display:
fullscreen, getDisplay, getScaledRect, isFullScreen, isValid, onResize, toggleFullScreen
Methods borrowed from class minplayer.plugin:
addPlugin, bind, checkQueue, destroy, get, loadPlugins, ready, trigger, unbind
+
+ + + + + + + +
+
+ Class Detail +
+ +
+ minplayer.controller.base(context, options) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {object} context + +
+
The jQuery context.
+ +
+ {object} options + +
+
This components options.
+ +
+ + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + constructor + +
+
+ Reset the constructor. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
+ + + construct() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.plugin#construct
+ +
+ + +
+ + +
+ + {object} + getElements() + +
+
+ + + +
+ + + + + + + + +
+
Returns:
+ +
{object} The elements defined by this display.
+ +
+ + + +
+
See:
+ +
minplayer.display#getElements
+ +
+ + +
+ + +
+ + + playPause(state, media) + +
+
+ Plays or pauses the media. + + +
+ + + + +
+
Parameters:
+ +
+ {bool} state + +
+
true => play, false => pause.
+ +
+ {object} media + +
+
The media player object.
+ +
+ + + + + + + + +
+ + +
+ + + setPlayPause(state) + +
+
+ Sets the play and pause state of the control bar. + + +
+ + + + +
+
Parameters:
+ +
+ {boolean} state + +
+
TRUE - Show Play, FALSE - Show Pause.
+ +
+ + + + + + + + +
+ + +
+ + + setTimeString(element, time) + +
+
+ Sets the time string on the control bar. + + +
+ + + + +
+
Parameters:
+ +
+ {string} element + +
+
The name of the element to set.
+ +
+ {number} time + +
+
The total time amount to set.
+ +
+ + + + + + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Tue Mar 06 2012 19:40:59 GMT-0800 (PST) +
+ + diff --git a/minplayer/doc/symbols/minplayer.controllers.base.html b/minplayer/doc/symbols/minplayer.controllers.base.html new file mode 100644 index 00000000..71479dbc --- /dev/null +++ b/minplayer/doc/symbols/minplayer.controllers.base.html @@ -0,0 +1,674 @@ + + + + + + + JsDoc Reference - minplayer.controllers.base + + + + + + + + + + + + + +
+ +

+ + Class minplayer.controllers.base +

+ + +

+ +
Extends + minplayer.display.
+ + + This is the base minplayer controller. Other controllers can derive +from the base and either build on top of it or simply define the elements +that this base controller uses. + + +
Defined in: minplayer.controllers.base.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ minplayer.controllers.base(context, options) +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  + +
Reset the constructor.
+
+ + + +
+
Fields borrowed from class minplayer.plugin:
name, options, pluginReady, queue
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
  + +
+
  + +
+
  +
playPause(state, media) +
+
Plays or pauses the media.
+
  +
setPlayPause(state) +
+
Sets the play and pause state of the control bar.
+
  +
setTimeString(element, time) +
+
Sets the time string on the control bar.
+
+ + + +
+
Methods borrowed from class minplayer.display:
bind, getDisplay, getScaledRect, isValid, onResize, trigger
Methods borrowed from class minplayer.plugin:
addPlugin, checkQueue, destroy, get, loadPlugins, ready
+
+ + + + + + + +
+
+ Class Detail +
+ +
+ minplayer.controllers.base(context, options) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {object} context + +
+
The jQuery context.
+ +
+ {object} options + +
+
This components options.
+ +
+ + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + constructor + +
+
+ Reset the constructor. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
+ + + construct() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.plugin#construct
+ +
+ + +
+ + +
+ + {object} + getElements() + +
+
+ + + +
+ + + + + + + + +
+
Returns:
+ +
{object} The elements defined by this display.
+ +
+ + + +
+
See:
+ +
minplayer.display#getElements
+ +
+ + +
+ + +
+ + + playPause(state, media) + +
+
+ Plays or pauses the media. + + +
+ + + + +
+
Parameters:
+ +
+ {bool} state + +
+
true => play, false => pause.
+ +
+ {object} media + +
+
The media player object.
+ +
+ + + + + + + + +
+ + +
+ + + setPlayPause(state) + +
+
+ Sets the play and pause state of the control bar. + + +
+ + + + +
+
Parameters:
+ +
+ {boolean} state + +
+
TRUE - Show Play, FALSE - Show Pause.
+ +
+ + + + + + + + +
+ + +
+ + + setTimeString(element, time) + +
+
+ Sets the time string on the control bar. + + +
+ + + + +
+
Parameters:
+ +
+ {string} element + +
+
The name of the element to set.
+ +
+ {number} time + +
+
The total time amount to set.
+ +
+ + + + + + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Feb 19 2012 00:13:02 GMT-0600 (CST) +
+ + diff --git a/minplayer/doc/symbols/minplayer.display.html b/minplayer/doc/symbols/minplayer.display.html new file mode 100644 index 00000000..3e4d4229 --- /dev/null +++ b/minplayer/doc/symbols/minplayer.display.html @@ -0,0 +1,881 @@ + + + + + + + JsDoc Reference - minplayer.display + + + + + + + + + + + + + +
+ +

+ + Class minplayer.display +

+ + +

+ +
Extends + minplayer.plugin.
+ + + Base class used to provide the display and options for any component +deriving from this class. Components who derive are expected to provide +the elements that they define by implementing the getElements method. + + +
Defined in: minplayer.display.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ minplayer.display(name, context, options, queue) +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  + +
Reset the constructor.
+
+ + + +
+
Fields borrowed from class minplayer.plugin:
context, lock, name, options, pluginReady, queue, triggered
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
  + +
+
  +
fullscreen(full) +
+
Make this display element go fullscreen.
+
  + +
Gets the full screen element.
+
  +
getDisplay(context, options) +
+
Returns the display for this component.
+
  + +
Returns all the jQuery elements that this component uses.
+
  +
getScaledRect(ratio, rect) +
+
Returns a scaled rectangle provided a ratio and the container rect.
+
  + +
Checks to see if we are in fullscreen mode.
+
  +
isValid() +
+
Returns if this component is valid and exists within the DOM.
+
  + +
Called when the window resizes.
+
  + +
Toggle fullscreen.
+
+ + + +
+
Methods borrowed from class minplayer.plugin:
addPlugin, bind, checkQueue, create, destroy, get, poll, ready, trigger, unbind
+
+ + + + + + + +
+
+ Class Detail +
+ +
+ minplayer.display(name, context, options, queue) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {string} name + +
+
The name of this plugin.
+ +
+ {object} context + +
+
The jQuery context this component resides.
+ +
+ {object} options + +
+
The options for this component.
+ +
+ {object} queue + +
+
The event queue to pass events around.
+ +
+ + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + constructor + +
+
+ Reset the constructor. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
+ + + construct() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.plugin.construct
+ +
+ + +
+ + +
+ + + fullscreen(full) + +
+
+ Make this display element go fullscreen. + + +
+ + + + +
+
Parameters:
+ +
+ {boolean} full + +
+
Tell the player to go into fullscreen or not.
+ +
+ + + + + + + + +
+ + +
+ + {object} + fullScreenElement() + +
+
+ Gets the full screen element. + + +
+ + + + + + + + +
+
Returns:
+ +
{object} The display to be used for full screen support.
+ +
+ + + + +
+ + +
+ + {object} + getDisplay(context, options) + +
+
+ Returns the display for this component. + + +
+ + + + +
+
Parameters:
+ +
+ {object} context + +
+
The original context.
+ +
+ {object} options + +
+
The options for this component.
+ +
+ + + + + +
+
Returns:
+ +
{object} The jQuery context for this display.
+ +
+ + + + +
+ + +
+ + {object} + getElements() + +
+
+ Returns all the jQuery elements that this component uses. + + +
+ + + + + + + + +
+
Returns:
+ +
{object} An object which defines all the jQuery elements that +this component uses.
+ +
+ + + + +
+ + +
+ + {object} + getScaledRect(ratio, rect) + +
+
+ Returns a scaled rectangle provided a ratio and the container rect. + + +
+ + + + +
+
Parameters:
+ +
+ {number} ratio + +
+
The width/height ratio of what is being scaled.
+ +
+ {object} rect + +
+
The bounding rectangle for scaling.
+ +
+ + + + + +
+
Returns:
+ +
{object} The Rectangle object of the scaled rectangle.
+ +
+ + + + +
+ + +
+ + {boolean} + isFullScreen() + +
+
+ Checks to see if we are in fullscreen mode. + + +
+ + + + + + + + +
+
Returns:
+ +
{boolean} TRUE - fullscreen, FALSE - otherwise.
+ +
+ + + + +
+ + +
+ + {boolean} + isValid() + +
+
+ Returns if this component is valid and exists within the DOM. + + +
+ + + + + + + + +
+
Returns:
+ +
{boolean} TRUE if the plugin display is valid.
+ +
+ + + + +
+ + +
+ + + onResize() + +
+
+ Called when the window resizes. + + +
+ + + + + + + + + + + +
+ + +
+ + + toggleFullScreen() + +
+
+ Toggle fullscreen. + + +
+ + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 22:38:47 GMT-0700 (PDT) +
+ + diff --git a/minplayer/doc/symbols/minplayer.file.html b/minplayer/doc/symbols/minplayer.file.html new file mode 100644 index 00000000..ce07b35e --- /dev/null +++ b/minplayer/doc/symbols/minplayer.file.html @@ -0,0 +1,611 @@ + + + + + + + JsDoc Reference - minplayer.file + + + + + + + + + + + + + +
+ +

+ + Class minplayer.file +

+ + +

+ + + + A wrapper class used to provide all the data necessary to control an +individual file within this media player. + + +
Defined in: minplayer.file.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ minplayer.file(file) +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
  + +
Returns the best player for the job.
+
  + +
Returns the file extension of the file path.
+
  +
getId() +
+
Returns the ID for this media file.
+
  + +
Returns the proper mimetype based off of the extension.
+
  + +
The priority of this file is determined by the priority of the best +player multiplied by the priority of the mimetype.
+
  +
getType() +
+
The type of media this is: video or audio.
+
+ + + + + + + + + +
+
+ Class Detail +
+ +
+ minplayer.file(file) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {object} file + +
+
A media file object with minimal required information.
+ +
+ + + + + + + + +
+ + + + + + + +
+ Method Detail +
+ + +
+ + {string} + getBestPlayer() + +
+
+ Returns the best player for the job. + + +
+ + + + + + + + +
+
Returns:
+ +
{string} The best player to play the media file.
+ +
+ + + + +
+ + +
+ + {string} + getFileExtension() + +
+
+ Returns the file extension of the file path. + + +
+ + + + + + + + +
+
Returns:
+ +
{string} The file extension.
+ +
+ + + + +
+ + +
+ + {string} + getId() + +
+
+ Returns the ID for this media file. + + +
+ + + + + + + + +
+
Returns:
+ +
{string} The id for this media file which is provided by the player.
+ +
+ + + + +
+ + +
+ + {string} + getMimeType() + +
+
+ Returns the proper mimetype based off of the extension. + + +
+ + + + + + + + +
+
Returns:
+ +
{string} The mimetype of the file based off of extension.
+ +
+ + + + +
+ + +
+ + {integer} + getPriority() + +
+
+ The priority of this file is determined by the priority of the best +player multiplied by the priority of the mimetype. + + +
+ + + + + + + + +
+
Returns:
+ +
{integer} The priority of the media file.
+ +
+ + + + +
+ + +
+ + {string} + getType() + +
+
+ The type of media this is: video or audio. + + +
+ + + + + + + + +
+
Returns:
+ +
{string} "video" or "audio" based on what the type of media this +is.
+ +
+ + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 22:38:47 GMT-0700 (PDT) +
+ + diff --git a/minplayer/doc/symbols/minplayer.flags.html b/minplayer/doc/symbols/minplayer.flags.html new file mode 100644 index 00000000..306920d0 --- /dev/null +++ b/minplayer/doc/symbols/minplayer.flags.html @@ -0,0 +1,550 @@ + + + + + + + JsDoc Reference - minplayer.flags + + + + + + + + + + + + + +
+ +

+ + Class minplayer.flags +

+ + +

+ + + + This is a class used to keep track of flag states +which is used to control the busy cursor, big play button, among other +items in which multiple components can have an interest in hiding or +showing a single element on the screen. + +

+Usage: +


+  // Declare a flags variable.
+  var flags = new minplayer.flags();
+
+  // Set the flag based on two components interested in the flag.
+  flags.setFlag("component1", true);
+  flags.setFlag("component2", true);
+
+  // Print out the value of the flags. ( Prints 3 )
+  console.log(flags.flags);
+
+  // Now unset a single components flag.
+  flags.setFlag("component1", false);
+
+  // Print out the value of the flags.
+  console.log(flags.flags);
+
+  // Unset the other components flag.
+  flags.setFlag("component2", false);
+
+  // Print out the value of the flags.
+  console.log(flags.flags);
+
+

+ + +
Defined in: minplayer.flags.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  +
+ flag +
+
The flag.
+
  +
+ ids +
+
Id map to reference id with the flag index.
+
  +
+ numFlags +
+
The number of flags.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
  +
setFlag(id, value) +
+
Sets a flag based on boolean logic operators.
+
+ + + + + + + + + +
+
+ Class Detail +
+ +
+ minplayer.flags() +
+ +
+ + +
+ + + + + + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + flag + +
+
+ The flag. + + +
+ + + + + + + + +
+ + +
+ + + ids + +
+
+ Id map to reference id with the flag index. + + +
+ + + + + + + + +
+ + +
+ + + numFlags + +
+
+ The number of flags. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
+ + + setFlag(id, value) + +
+
+ Sets a flag based on boolean logic operators. + + +
+ + + + +
+
Parameters:
+ +
+ {string} id + +
+
The id of the controller interested in this flag.
+ +
+ {boolean} value + +
+
The value of this flag ( true or false ).
+ +
+ + + + + + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 22:38:47 GMT-0700 (PDT) +
+ + diff --git a/minplayer/doc/symbols/minplayer.image.html b/minplayer/doc/symbols/minplayer.image.html new file mode 100644 index 00000000..f92da7c9 --- /dev/null +++ b/minplayer/doc/symbols/minplayer.image.html @@ -0,0 +1,677 @@ + + + + + + + JsDoc Reference - minplayer.image + + + + + + + + + + + + + +
+ +

+ + Class minplayer.image +

+ + +

+ + + + A class to easily handle images. + + +
Defined in: minplayer.image.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ minplayer.image(context, options) +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  + +
Reset the constructor.
+
  +
+ loader +
+
The loader for the image.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
  +
clear(callback) +
+
Clears an image.
+
  + +
+
  +
load(src) +
+
Loads an image.
+
  + +
+
  +
resize(width, height) +
+
Resize the image provided a width and height or nothing.
+
+ + + + + + + + + +
+
+ Class Detail +
+ +
+ minplayer.image(context, options) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {object} context + +
+
The jQuery context.
+ +
+ {object} options + +
+
This components options.
+ +
+ + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + constructor + +
+
+ Reset the constructor. + + +
+ + + + + + + + +
+ + +
+ + + loader + +
+
+ The loader for the image. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
+ + + clear(callback) + +
+
+ Clears an image. + + +
+ + + + +
+
Parameters:
+ +
+ {function} callback + +
+
Called when the image is done clearing.
+ +
+ + + + + + + + +
+ + +
+ + + construct() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.plugin.construct
+ +
+ + +
+ + +
+ + + load(src) + +
+
+ Loads an image. + + +
+ + + + +
+
Parameters:
+ +
+ {string} src + +
+
The source of the image to load.
+ +
+ + + + + + + + +
+ + +
+ + + onResize() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.display#onResize
+ +
+ + +
+ + +
+ + + resize(width, height) + +
+
+ Resize the image provided a width and height or nothing. + + +
+ + + + +
+
Parameters:
+ +
+ {integer} width + +
+
(optional) The width of the container.
+ +
+ {integer} height + +
+
(optional) The height of the container.
+ +
+ + + + + + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 22:38:47 GMT-0700 (PDT) +
+ + diff --git a/minplayer/doc/symbols/minplayer.playLoader.base.html b/minplayer/doc/symbols/minplayer.playLoader.base.html new file mode 100644 index 00000000..f47ea649 --- /dev/null +++ b/minplayer/doc/symbols/minplayer.playLoader.base.html @@ -0,0 +1,574 @@ + + + + + + + JsDoc Reference - minplayer.playLoader.base + + + + + + + + + + + + + +
+ +

+ + Class minplayer.playLoader.base +

+ + +

+ +
Extends + minplayer.display.
+ + + The play loader base class, which is used to control the busy +cursor, big play button, and the opaque background which shows when the +player is paused. + + +
Defined in: minplayer.playLoader.base.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ minplayer.playLoader.base(context, options) +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  + +
Reset the constructor.
+
  +
+ preview +
+
The preview image.
+
+ + + +
+
Fields borrowed from class minplayer.plugin:
lock, name, options, pluginReady, queue, triggered
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
  + +
Hide or show certain elements based on the state of the busy and big play +button.
+
  + +
The constructor.
+
  + +
Loads the preview image.
+
+ + + +
+
Methods borrowed from class minplayer.display:
fullscreen, getDisplay, getElements, getScaledRect, isFullScreen, isValid, onResize, toggleFullScreen
Methods borrowed from class minplayer.plugin:
addPlugin, bind, checkQueue, destroy, get, loadPlugins, ready, trigger, unbind
+
+ + + + + + + +
+
+ Class Detail +
+ +
+ minplayer.playLoader.base(context, options) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {object} context + +
+
The jQuery context.
+ +
+ {object} options + +
+
This components options.
+ +
+ + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + constructor + +
+
+ Reset the constructor. + + +
+ + + + + + + + +
+ + +
+ + + preview + +
+
+ The preview image. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
+ + + checkVisibility() + +
+
+ Hide or show certain elements based on the state of the busy and big play +button. + + +
+ + + + + + + + + + + +
+ + +
+ + + construct() + +
+
+ The constructor. + + +
+ + + + + + + + + + + +
+ + +
+ + + loadPreview() + +
+
+ Loads the preview image. + + +
+ + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Tue Mar 06 2012 19:40:59 GMT-0800 (PST) +
+ + diff --git a/minplayer/doc/symbols/minplayer.players.base.html b/minplayer/doc/symbols/minplayer.players.base.html new file mode 100644 index 00000000..61ec9a71 --- /dev/null +++ b/minplayer/doc/symbols/minplayer.players.base.html @@ -0,0 +1,1913 @@ + + + + + + + JsDoc Reference - minplayer.players.base + + + + + + + + + + + + + +
+ +

+ + Class minplayer.players.base +

+ + +

+ +
Extends + minplayer.display.
+ + + The base media player class where all media players derive from. + + +
Defined in: minplayer.players.base.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ minplayer.players.base(context, options, queue) +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  + +
Reset the constructor.
+
  +
+ mediaFile +
+
The currently loaded media file.
+
+ + + +
+
Fields borrowed from class minplayer.plugin:
context, lock, name, options, pluginReady, queue, triggered
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
<static>   +
minplayer.players.base.canPlay(file) +
+
Determine if we can play the media file.
+
  +
clear() +
+
Clears the media player.
+
  + +
+
  +
create() +
+
Creates the media player and inserts it in the DOM.
+
  +
destroy() +
+
+
  +
getBytesLoaded(callback) +
+
Return the bytes of media loaded.
+
  +
getBytesStart(callback) +
+
Return the start bytes for the loaded media.
+
  +
getBytesTotal(callback) +
+
Return the total amount of bytes.
+
  +
getCurrentTime(callback) +
+
Get the current time for the media being played.
+
  +
getDuration(callback) +
+
Return the duration of the loaded media.
+
  + +
+
<static>   +
minplayer.players.base.getMediaId(file) +
+
Returns the ID for the media being played.
+
  + +
Returns the media player object.
+
<static>   +
minplayer.players.base.getPriority() +
+
Get the priority of this media player.
+
  +
getVolume(callback) +
+
Get the volume from the loaded media.
+
  + +
Determines if the player should show the playloader.
+
  +
isReady() +
+
+
  +
load(file) +
+
Loads a new media player.
+
  + +
Should be called when the media is complete.
+
  +
onError(errorCode) +
+
Called when an error occurs.
+
  + +
Should be called when the media is done loading.
+
  + +
Should be called when the media is paused.
+
  + +
Should be called when the media is playing.
+
  +
onReady() +
+
Called when the player is ready to recieve events and commands.
+
  + +
Should be called when the player is waiting.
+
  +
pause() +
+
Pause the loaded media file.
+
  +
play() +
+
Play the loaded media file.
+
  + +
Returns if the media player is already within the DOM.
+
  +
reset() +
+
Resets all variables.
+
  +
seek(pos) +
+
Seek the loaded media.
+
  +
seekRelative(pos) +
+
Seeks to relative position.
+
  +
setVolume(vol) +
+
Set the volume of the loaded minplayer.
+
  + +
Set the volume of the loaded minplayer.
+
  +
stop() +
+
Stop the loaded media file.
+
+ + + +
+
Methods borrowed from class minplayer.display:
fullscreen, fullScreenElement, getDisplay, getScaledRect, isFullScreen, isValid, onResize, toggleFullScreen
Methods borrowed from class minplayer.plugin:
addPlugin, bind, checkQueue, get, poll, ready, trigger, unbind
+
+ + + + + + + +
+
+ Class Detail +
+ +
+ minplayer.players.base(context, options, queue) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {object} context + +
+
The jQuery context.
+ +
+ {object} options + +
+
This components options.
+ +
+ {object} queue + +
+
The event queue to pass events around.
+ +
+ + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + constructor + +
+
+ Reset the constructor. + + +
+ + + + + + + + +
+ + +
+ + + mediaFile + +
+
+ The currently loaded media file. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
<static> + + {boolean} + minplayer.players.base.canPlay(file) + +
+
+ Determine if we can play the media file. + + +
+ + + + +
+
Parameters:
+ +
+ {object} file + +
+
A minplayer.file object.
+ +
+ + + + + +
+
Returns:
+ +
{boolean} If this player can play this media type.
+ +
+ + + + +
+ + +
+ + + clear() + +
+
+ Clears the media player. + + +
+ + + + + + + + + + + +
+ + +
+ + + construct() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.plugin.construct
+ +
+ + +
+ + +
+ + {object} + create() + +
+
+ Creates the media player and inserts it in the DOM. + + +
+ + + + + + + + +
+
Returns:
+ +
{object} The media player entity.
+ +
+ + + + +
+ + +
+ + + destroy() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.plugin.destroy.
+ +
+ + +
+ + +
+ + {int} + getBytesLoaded(callback) + +
+
+ Return the bytes of media loaded. + + +
+ + + + +
+
Parameters:
+ +
+ {function} callback + +
+
Called when the bytes loaded is determined.
+ +
+ + + + + +
+
Returns:
+ +
{int} The amount of bytes loaded.
+ +
+ + + + +
+ + +
+ + {int} + getBytesStart(callback) + +
+
+ Return the start bytes for the loaded media. + + +
+ + + + +
+
Parameters:
+ +
+ {function} callback + +
+
Called when the start bytes is determined.
+ +
+ + + + + +
+
Returns:
+ +
{int} The bytes that were started.
+ +
+ + + + +
+ + +
+ + {int} + getBytesTotal(callback) + +
+
+ Return the total amount of bytes. + + +
+ + + + +
+
Parameters:
+ +
+ {function} callback + +
+
Called when the bytes total is determined.
+ +
+ + + + + +
+
Returns:
+ +
{int} The total amount of bytes for this media.
+ +
+ + + + +
+ + +
+ + {number} + getCurrentTime(callback) + +
+
+ Get the current time for the media being played. + + +
+ + + + +
+
Parameters:
+ +
+ {function} callback + +
+
Called when the time is determined.
+ +
+ + + + + +
+
Returns:
+ +
{number} The volume of the media; 0 to 1.
+ +
+ + + + +
+ + +
+ + {number} + getDuration(callback) + +
+
+ Return the duration of the loaded media. + + +
+ + + + +
+
Parameters:
+ +
+ {function} callback + +
+
Called when the duration is determined.
+ +
+ + + + + +
+
Returns:
+ +
{number} The duration of the loaded media.
+ +
+ + + + +
+ + +
+ + {object} + getElements() + +
+
+ + + +
+ + + + + + + + +
+
Returns:
+ +
{object} The elements for this display.
+ +
+ + + +
+
See:
+ +
minplayer.display.getElements
+ +
+ + +
+ + +
<static> + + {string} + minplayer.players.base.getMediaId(file) + +
+
+ Returns the ID for the media being played. + + +
+ + + + +
+
Parameters:
+ +
+ {object} file + +
+
A minplayer.file object.
+ +
+ + + + + +
+
Returns:
+ +
{string} The ID for the provided media.
+ +
+ + + + +
+ + +
+ + {object} + getPlayer() + +
+
+ Returns the media player object. + + +
+ + + + + + + + +
+
Returns:
+ +
{object} The media player object.
+ +
+ + + + +
+ + +
<static> + + {number} + minplayer.players.base.getPriority() + +
+
+ Get the priority of this media player. + + +
+ + + + + + + + +
+
Returns:
+ +
{number} The priority of this media player.
+ +
+ + + + +
+ + +
+ + {number} + getVolume(callback) + +
+
+ Get the volume from the loaded media. + + +
+ + + + +
+
Parameters:
+ +
+ {function} callback + +
+
Called when the volume is determined.
+ +
+ + + + + +
+
Returns:
+ +
{number} The volume of the media; 0 to 1.
+ +
+ + + + +
+ + +
+ + {bool} + hasPlayLoader() + +
+
+ Determines if the player should show the playloader. + + +
+ + + + + + + + +
+
Returns:
+ +
{bool} If this player implements its own playLoader.
+ +
+ + + + +
+ + +
+ + {boolean} + isReady() + +
+
+ + + +
+ + + + + + + + +
+
Returns:
+ +
{boolean} Checks to see if the Flash is ready.
+ +
+ + + +
+
See:
+ +
minplayer.players.base#isReady
+ +
+ + +
+ + +
+ + + load(file) + +
+
+ Loads a new media player. + + +
+ + + + +
+
Parameters:
+ +
+ {object} file + +
+
A minplayer.file object.
+ +
+ + + + + + + + +
+ + +
+ + + onComplete() + +
+
+ Should be called when the media is complete. + + +
+ + + + + + + + + + + +
+ + +
+ + + onError(errorCode) + +
+
+ Called when an error occurs. + + +
+ + + + +
+
Parameters:
+ +
+ {string} errorCode + +
+
The error that was triggered.
+ +
+ + + + + + + + +
+ + +
+ + + onLoaded() + +
+
+ Should be called when the media is done loading. + + +
+ + + + + + + + + + + +
+ + +
+ + + onPaused() + +
+
+ Should be called when the media is paused. + + +
+ + + + + + + + + + + +
+ + +
+ + + onPlaying() + +
+
+ Should be called when the media is playing. + + +
+ + + + + + + + + + + +
+ + +
+ + + onReady() + +
+
+ Called when the player is ready to recieve events and commands. + + +
+ + + + + + + + + + + +
+ + +
+ + + onWaiting() + +
+
+ Should be called when the player is waiting. + + +
+ + + + + + + + + + + +
+ + +
+ + + pause() + +
+
+ Pause the loaded media file. + + +
+ + + + + + + + + + + +
+ + +
+ + + play() + +
+
+ Play the loaded media file. + + +
+ + + + + + + + + + + +
+ + +
+ + {boolean} + playerFound() + +
+
+ Returns if the media player is already within the DOM. + + +
+ + + + + + + + +
+
Returns:
+ +
{boolean} TRUE - if the player is in the DOM, FALSE otherwise.
+ +
+ + + + +
+ + +
+ + + reset() + +
+
+ Resets all variables. + + +
+ + + + + + + + + + + +
+ + +
+ + + seek(pos) + +
+
+ Seek the loaded media. + + +
+ + + + +
+
Parameters:
+ +
+ {number} pos + +
+
The position to seek the minplayer. 0 to 1.
+ +
+ + + + + + + + +
+ + +
+ + + seekRelative(pos) + +
+
+ Seeks to relative position. + + +
+ + + + +
+
Parameters:
+ +
+ {number} pos + +
+
Relative position. -1 to 1 (percent), > 1 (seconds).
+ +
+ + + + + + + + +
+ + +
+ + + setVolume(vol) + +
+
+ Set the volume of the loaded minplayer. + + +
+ + + + +
+
Parameters:
+ +
+ {number} vol + +
+
The volume to set the media. 0 to 1.
+ +
+ + + + + + + + +
+ + +
+ + + setVolumeRelative(vol) + +
+
+ Set the volume of the loaded minplayer. + + +
+ + + + +
+
Parameters:
+ +
+ {number} vol + +
+
-1 to 1 - The relative amount to increase or decrease.
+ +
+ + + + + + + + +
+ + +
+ + + stop() + +
+
+ Stop the loaded media file. + + +
+ + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 22:38:47 GMT-0700 (PDT) +
+ + diff --git a/minplayer/doc/symbols/minplayer.players.flash.html b/minplayer/doc/symbols/minplayer.players.flash.html new file mode 100644 index 00000000..3ee49750 --- /dev/null +++ b/minplayer/doc/symbols/minplayer.players.flash.html @@ -0,0 +1,693 @@ + + + + + + + JsDoc Reference - minplayer.players.flash + + + + + + + + + + + + + +
+ +

+ + Class minplayer.players.flash +

+ + +

+ +
Extends + minplayer.display.
+ + + The Flash media player class to control the flash fallback. + + +
Defined in: minplayer.players.flash.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ minplayer.players.flash(context, options, queue) +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  + +
Reset the constructor.
+
+ + + +
+
Fields borrowed from class minplayer.plugin:
context, lock, name, options, pluginReady, queue, triggered
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
<static>   +
minplayer.players.flash.canPlay(file) +
+
+
<static>   +
minplayer.players.flash.getFlash(params) +
+
API to return the Flash player code provided params.
+
  + +
+
<static>   +
minplayer.players.flash.getPriority() +
+
+
  + +
+
+ + + +
+
Methods borrowed from class minplayer.display:
construct, fullscreen, fullScreenElement, getDisplay, getElements, getScaledRect, isFullScreen, isValid, onResize, toggleFullScreen
Methods borrowed from class minplayer.plugin:
addPlugin, bind, checkQueue, create, destroy, get, poll, ready, trigger, unbind
+
+ + + + + + + +
+
+ Class Detail +
+ +
+ minplayer.players.flash(context, options, queue) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {object} context + +
+
The jQuery context.
+ +
+ {object} options + +
+
This components options.
+ +
+ {object} queue + +
+
The event queue to pass events around.
+ +
+ + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + constructor + +
+
+ Reset the constructor. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
<static> + + {boolean} + minplayer.players.flash.canPlay(file) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ file + +
+
+ +
+ + + + + +
+
Returns:
+ +
{boolean} If this player can play this media type.
+ +
+ + + +
+
See:
+ +
minplayer.players.base#canPlay
+ +
+ + +
+ + +
<static> + + {object} + minplayer.players.flash.getFlash(params) + +
+
+ API to return the Flash player code provided params. + + +
+ + + + +
+
Parameters:
+ +
+ {object} params + +
+
The params used to populate the Flash code.
+ +
+ + + + + +
+
Returns:
+ +
{object} A Flash DOM element.
+ +
+ + + + +
+ + +
+ + {object} + getPlayer() + +
+
+ + + +
+ + + + + + + + +
+
Returns:
+ +
{object} The media player object.
+ +
+ + + +
+
See:
+ +
minplayer.players.base#getPlayer
+ +
+ + +
+ + +
<static> + + {number} + minplayer.players.flash.getPriority() + +
+
+ + + +
+ + + + + + + + +
+
Returns:
+ +
{number} The priority of this media player.
+ +
+ + + +
+
See:
+ +
minplayer.players.base#getPriority
+ +
+ + +
+ + +
+ + {boolean} + playerFound() + +
+
+ + + +
+ + + + + + + + +
+
Returns:
+ +
{boolean} TRUE - if the player is in the DOM, FALSE otherwise.
+ +
+ + + +
+
See:
+ +
minplayer.players.base#playerFound
+ +
+ + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 22:38:47 GMT-0700 (PDT) +
+ + diff --git a/minplayer/doc/symbols/minplayer.players.html5.html b/minplayer/doc/symbols/minplayer.players.html5.html new file mode 100644 index 00000000..54908efc --- /dev/null +++ b/minplayer/doc/symbols/minplayer.players.html5.html @@ -0,0 +1,1269 @@ + + + + + + + JsDoc Reference - minplayer.players.html5 + + + + + + + + + + + + + +
+ +

+ + Class minplayer.players.html5 +

+ + +

+ +
Extends + minplayer.display.
+ + + The HTML5 media player implementation. + + +
Defined in: minplayer.players.html5.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ minplayer.players.html5(context, options, queue) +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  + +
Reset the constructor.
+
+ + + +
+
Fields borrowed from class minplayer.plugin:
context, lock, name, options, pluginReady, queue, triggered
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
<static>   +
minplayer.players.html5.canPlay(file) +
+
+
  + +
+
  +
create() +
+
+
  +
getBytesLoaded(callback) +
+
+
  +
getBytesTotal(callback) +
+
+
  +
getCurrentTime(callback) +
+
+
  +
getDuration(callback) +
+
+
  + +
+
<static>   +
minplayer.players.html5.getPriority() +
+
+
  +
getVolume(callback) +
+
+
  +
load(file) +
+
+
  +
pause() +
+
+
  +
play() +
+
+
  + +
+
  +
seek(pos) +
+
+
  +
setVolume(vol) +
+
+
  +
stop() +
+
+
+ + + +
+
Methods borrowed from class minplayer.display:
fullscreen, fullScreenElement, getDisplay, getElements, getScaledRect, isFullScreen, isValid, onResize, toggleFullScreen
Methods borrowed from class minplayer.plugin:
addPlugin, bind, checkQueue, destroy, get, poll, ready, trigger, unbind
+
+ + + + + + + +
+
+ Class Detail +
+ +
+ minplayer.players.html5(context, options, queue) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {object} context + +
+
The jQuery context.
+ +
+ {object} options + +
+
This components options.
+ +
+ {object} queue + +
+
The event queue to pass events around.
+ +
+ + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + constructor + +
+
+ Reset the constructor. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
<static> + + {boolean} + minplayer.players.html5.canPlay(file) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ file + +
+
+ +
+ + + + + +
+
Returns:
+ +
{boolean} If this player can play this media type.
+ +
+ + + +
+
See:
+ +
minplayer.players.base#canPlay
+ +
+ + +
+ + +
+ + + construct() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.plugin.construct
+ +
+ + +
+ + +
+ + {object} + create() + +
+
+ + + +
+ + + + + + + + +
+
Returns:
+ +
{object} The media player entity.
+ +
+ + + +
+
See:
+ +
minplayer.players.base#create
+ +
+ + +
+ + +
+ + + getBytesLoaded(callback) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ callback + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#getBytesLoaded
+ +
+ + +
+ + +
+ + + getBytesTotal(callback) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ callback + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#getBytesTotal
+ +
+ + +
+ + +
+ + + getCurrentTime(callback) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ callback + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#getCurrentTime
+ +
+ + +
+ + +
+ + + getDuration(callback) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ callback + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#getDuration
+ +
+ + +
+ + +
+ + {object} + getPlayer() + +
+
+ + + +
+ + + + + + + + +
+
Returns:
+ +
{object} The media player object.
+ +
+ + + +
+
See:
+ +
minplayer.players.base#getPlayer
+ +
+ + +
+ + +
<static> + + {number} + minplayer.players.html5.getPriority() + +
+
+ + + +
+ + + + + + + + +
+
Returns:
+ +
{number} The priority of this media player.
+ +
+ + + +
+
See:
+ +
minplayer.players.base#getPriority
+ +
+ + +
+ + +
+ + + getVolume(callback) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ callback + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#getVolume
+ +
+ + +
+ + +
+ + + load(file) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ file + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#load
+ +
+ + +
+ + +
+ + + pause() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.players.base#pause
+ +
+ + +
+ + +
+ + + play() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.players.base#play
+ +
+ + +
+ + +
+ + {boolean} + playerFound() + +
+
+ + + +
+ + + + + + + + +
+
Returns:
+ +
{boolean} TRUE - if the player is in the DOM, FALSE otherwise.
+ +
+ + + +
+
See:
+ +
minplayer.players.base#playerFound
+ +
+ + +
+ + +
+ + + seek(pos) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ pos + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#seek
+ +
+ + +
+ + +
+ + + setVolume(vol) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ vol + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#setVolume
+ +
+ + +
+ + +
+ + + stop() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.players.base#stop
+ +
+ + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 22:38:47 GMT-0700 (PDT) +
+ + diff --git a/minplayer/doc/symbols/minplayer.players.minplayer.html b/minplayer/doc/symbols/minplayer.players.minplayer.html new file mode 100644 index 00000000..2348e244 --- /dev/null +++ b/minplayer/doc/symbols/minplayer.players.minplayer.html @@ -0,0 +1,1177 @@ + + + + + + + JsDoc Reference - minplayer.players.minplayer + + + + + + + + + + + + + +
+ +

+ + Class minplayer.players.minplayer +

+ + +

+ +
Extends + minplayer.display.
+ + + The Flash media player class to control the flash fallback. + + +
Defined in: minplayer.players.minplayer.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ minplayer.players.minplayer(context, options, queue) +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  + +
Reset the constructor.
+
+ + + +
+
Fields borrowed from class minplayer.plugin:
context, lock, name, options, pluginReady, queue, triggered
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
<static>   +
minplayer.players.minplayer.canPlay(file) +
+
+
  +
create() +
+
+
  +
getBytesLoaded(callback) +
+
+
  +
getBytesTotal(callback) +
+
+
  +
getCurrentTime(callback) +
+
+
  +
getDuration(callback) +
+
+
<static>   +
minplayer.players.minplayer.getPriority() +
+
+
  +
getVolume(callback) +
+
+
  +
load(file) +
+
+
  +
onMediaUpdate(eventType) +
+
Called when the Flash player has an update.
+
  +
pause() +
+
+
  +
play() +
+
+
  +
seek(pos) +
+
+
  +
setVolume(vol) +
+
+
  +
stop() +
+
+
+ + + +
+
Methods borrowed from class minplayer.display:
construct, fullscreen, fullScreenElement, getDisplay, getElements, getScaledRect, isFullScreen, isValid, onResize, toggleFullScreen
Methods borrowed from class minplayer.plugin:
addPlugin, bind, checkQueue, destroy, get, poll, ready, trigger, unbind
+
+ + + + + + + +
+
+ Class Detail +
+ +
+ minplayer.players.minplayer(context, options, queue) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {object} context + +
+
The jQuery context.
+ +
+ {object} options + +
+
This components options.
+ +
+ {object} queue + +
+
The event queue to pass events around.
+ +
+ + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + constructor + +
+
+ Reset the constructor. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
<static> + + {boolean} + minplayer.players.minplayer.canPlay(file) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ file + +
+
+ +
+ + + + + +
+
Returns:
+ +
{boolean} If this player can play this media type.
+ +
+ + + +
+
See:
+ +
minplayer.players.base#canPlay
+ +
+ + +
+ + +
+ + {object} + create() + +
+
+ + + +
+ + + + + + + + +
+
Returns:
+ +
{object} The media player entity.
+ +
+ + + +
+
See:
+ +
minplayer.players.base#create
+ +
+ + +
+ + +
+ + + getBytesLoaded(callback) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ callback + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#getBytesLoaded
+ +
+ + +
+ + +
+ + + getBytesTotal(callback) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ callback + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#getBytesTotal.
+ +
+ + +
+ + +
+ + + getCurrentTime(callback) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ callback + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#getCurrentTime
+ +
+ + +
+ + +
+ + + getDuration(callback) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ callback + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.flash#getDuration
+ +
+ + +
+ + +
<static> + + {number} + minplayer.players.minplayer.getPriority() + +
+
+ + + +
+ + + + + + + + +
+
Returns:
+ +
{number} The priority of this media player.
+ +
+ + + +
+
See:
+ +
minplayer.players.base#getPriority
+ +
+ + +
+ + +
+ + + getVolume(callback) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ callback + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#getVolume
+ +
+ + +
+ + +
+ + + load(file) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ file + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#load
+ +
+ + +
+ + +
+ + + onMediaUpdate(eventType) + +
+
+ Called when the Flash player has an update. + + +
+ + + + +
+
Parameters:
+ +
+ {string} eventType + +
+
The event that was triggered in the player.
+ +
+ + + + + + + + +
+ + +
+ + + pause() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.players.base#pause
+ +
+ + +
+ + +
+ + + play() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.players.base#play
+ +
+ + +
+ + +
+ + + seek(pos) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ pos + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#seek
+ +
+ + +
+ + +
+ + + setVolume(vol) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ vol + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#setVolume
+ +
+ + +
+ + +
+ + + stop() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.players.base#stop
+ +
+ + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 22:38:48 GMT-0700 (PDT) +
+ + diff --git a/minplayer/doc/symbols/minplayer.players.vimeo.html b/minplayer/doc/symbols/minplayer.players.vimeo.html new file mode 100644 index 00000000..ff08aec8 --- /dev/null +++ b/minplayer/doc/symbols/minplayer.players.vimeo.html @@ -0,0 +1,1110 @@ + + + + + + + JsDoc Reference - minplayer.players.vimeo + + + + + + + + + + + + + +
+ +

+ + Class minplayer.players.vimeo +

+ + +

+ +
Extends + minplayer.players.base.
+ + + The vimeo media player. + + +
Defined in: minplayer.players.vimeo.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ minplayer.players.vimeo(context, options, queue) +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  + +
Reset the constructor.
+
+ + + +
+
Fields borrowed from class minplayer.players.base:
mediaFile
Fields borrowed from class minplayer.plugin:
context, lock, name, options, pluginReady, queue, triggered
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
<static>   +
minplayer.players.vimeo.canPlay(file) +
+
+
  +
create() +
+
+
  +
getDuration(callback) +
+
+
<static>   +
minplayer.players.vimeo.getMediaId(file) +
+
Return the ID for a provided media file.
+
<static>   +
minplayer.players.vimeo.getPriority() +
+
+
  +
getVolume(callback) +
+
+
  +
onReady(player_id) +
+
+
  +
pause() +
+
+
  +
play() +
+
+
  + +
Checks to see if this player can be found.
+
  +
reset() +
+
+
  +
seek(pos) +
+
+
  +
setVolume(vol) +
+
+
  +
stop() +
+
+
+ + + +
+
Methods borrowed from class minplayer.players.base:
clear, construct, destroy, getBytesLoaded, getBytesStart, getBytesTotal, getCurrentTime, getElements, getPlayer, hasPlayLoader, isReady, load, onComplete, onError, onLoaded, onPaused, onPlaying, onWaiting, seekRelative, setVolumeRelative
Methods borrowed from class minplayer.display:
fullscreen, fullScreenElement, getDisplay, getScaledRect, isFullScreen, isValid, onResize, toggleFullScreen
Methods borrowed from class minplayer.plugin:
addPlugin, bind, checkQueue, get, poll, ready, trigger, unbind
+
+ + + + + + + +
+
+ Class Detail +
+ +
+ minplayer.players.vimeo(context, options, queue) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {object} context + +
+
The jQuery context.
+ +
+ {object} options + +
+
This components options.
+ +
+ {object} queue + +
+
The event queue to pass events around.
+ +
+ + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + constructor + +
+
+ Reset the constructor. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
<static> + + {boolean} + minplayer.players.vimeo.canPlay(file) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ file + +
+
+ +
+ + + + + +
+
Returns:
+ +
{boolean} If this player can play this media type.
+ +
+ + + +
+
See:
+ +
minplayer.players.base#canPlay
+ +
+ + +
+ + +
+ + {object} + create() + +
+
+ + + +
+ + + + + + + + +
+
Returns:
+ +
{object} The media player entity.
+ +
+ + + +
+
See:
+ +
minplayer.players.base#create
+ +
+ + +
+ + +
+ + + getDuration(callback) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ callback + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#getDuration.
+ +
+ + +
+ + +
<static> + + {string} + minplayer.players.vimeo.getMediaId(file) + +
+
+ Return the ID for a provided media file. + + +
+ + + + +
+
Parameters:
+ +
+ {object} file + +
+
A minplayer.file object.
+ +
+ + + + + +
+
Returns:
+ +
{string} The ID for the provided media.
+ +
+ + + + +
+ + +
<static> + + {number} + minplayer.players.vimeo.getPriority() + +
+
+ + + +
+ + + + + + + + +
+
Returns:
+ +
{number} The priority of this media player.
+ +
+ + + +
+
See:
+ +
minplayer.players.base#getPriority
+ +
+ + +
+ + +
+ + + getVolume(callback) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ callback + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#getVolume
+ +
+ + +
+ + +
+ + + onReady(player_id) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ player_id + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#onReady
+ +
+ + +
+ + +
+ + + pause() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.players.base#pause
+ +
+ + +
+ + +
+ + + play() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.players.base#play
+ +
+ + +
+ + +
+ + {bool} + playerFound() + +
+
+ Checks to see if this player can be found. + + +
+ + + + + + + + +
+
Returns:
+ +
{bool} TRUE - Player is found, FALSE - otherwise.
+ +
+ + + + +
+ + +
+ + + reset() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.players.base#reset
+ +
+ + +
+ + +
+ + + seek(pos) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ pos + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#seek
+ +
+ + +
+ + +
+ + + setVolume(vol) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ vol + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#setVolume
+ +
+ + +
+ + +
+ + + stop() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.players.base#stop
+ +
+ + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 22:38:48 GMT-0700 (PDT) +
+ + diff --git a/minplayer/doc/symbols/minplayer.players.youtube.html b/minplayer/doc/symbols/minplayer.players.youtube.html new file mode 100644 index 00000000..90565819 --- /dev/null +++ b/minplayer/doc/symbols/minplayer.players.youtube.html @@ -0,0 +1,1566 @@ + + + + + + + JsDoc Reference - minplayer.players.youtube + + + + + + + + + + + + + +
+ +

+ + Class minplayer.players.youtube +

+ + +

+ +
Extends + minplayer.players.base.
+ + + The YouTube media player. + + +
Defined in: minplayer.players.youtube.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ minplayer.players.youtube(context, options, queue) +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  + +
Reset the constructor.
+
  +
+ quality +
+
The quality of the YouTube stream.
+
+ + + +
+
Fields borrowed from class minplayer.players.base:
mediaFile
Fields borrowed from class minplayer.plugin:
context, lock, name, options, pluginReady, queue, triggered
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
<static>   +
minplayer.players.youtube.canPlay(file) +
+
+
  +
create() +
+
+
  +
getBytesLoaded(callback) +
+
+
  +
getBytesStart(callback) +
+
+
  +
getBytesTotal(callback) +
+
+
  +
getCurrentTime(callback) +
+
+
  +
getDuration(callback) +
+
+
<static>   +
minplayer.players.youtube.getMediaId(file) +
+
Return the ID for a provided media file.
+
<static>   +
minplayer.players.youtube.getPriority() +
+
+
  +
getVolume(callback) +
+
+
  + +
Determines if the player should show the playloader.
+
  +
load(file) +
+
+
  + +
Called when the player state changes.
+
  +
onQualityChange(newQuality) +
+
Called when the player quality changes.
+
  +
onReady(event) +
+
Called when an error occurs.
+
  +
pause() +
+
+
  +
play() +
+
+
  + +
Checks to see if this player can be found.
+
  + +
Register this youtube player so that multiple players can be present +on the same page without event collision.
+
  +
seek(pos) +
+
+
  +
setPlayerState(playerState) +
+
Translates the player state for the YouTube API player.
+
  +
setVolume(vol) +
+
+
  +
stop() +
+
+
+ + + +
+
Methods borrowed from class minplayer.players.base:
clear, construct, destroy, getElements, getPlayer, isReady, onComplete, onError, onLoaded, onPaused, onPlaying, onWaiting, reset, seekRelative, setVolumeRelative
Methods borrowed from class minplayer.display:
fullscreen, fullScreenElement, getDisplay, getScaledRect, isFullScreen, isValid, onResize, toggleFullScreen
Methods borrowed from class minplayer.plugin:
addPlugin, bind, checkQueue, get, poll, ready, trigger, unbind
+
+ + + + + + + +
+
+ Class Detail +
+ +
+ minplayer.players.youtube(context, options, queue) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {object} context + +
+
The jQuery context.
+ +
+ {object} options + +
+
This components options.
+ +
+ {object} queue + +
+
The event queue to pass events around.
+ +
+ + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + constructor + +
+
+ Reset the constructor. + + +
+ + + + + + + + +
+ + +
+ + + quality + +
+
+ The quality of the YouTube stream. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
<static> + + {boolean} + minplayer.players.youtube.canPlay(file) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ file + +
+
+ +
+ + + + + +
+
Returns:
+ +
{boolean} If this player can play this media type.
+ +
+ + + +
+
See:
+ +
minplayer.players.base#canPlay
+ +
+ + +
+ + +
+ + {object} + create() + +
+
+ + + +
+ + + + + + + + +
+
Returns:
+ +
{object} The media player entity.
+ +
+ + + +
+
See:
+ +
minplayer.players.base#create
+ +
+ + +
+ + +
+ + + getBytesLoaded(callback) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ callback + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#getBytesLoaded.
+ +
+ + +
+ + +
+ + + getBytesStart(callback) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ callback + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#getBytesStart.
+ +
+ + +
+ + +
+ + + getBytesTotal(callback) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ callback + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#getBytesTotal.
+ +
+ + +
+ + +
+ + + getCurrentTime(callback) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ callback + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#getCurrentTime
+ +
+ + +
+ + +
+ + + getDuration(callback) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ callback + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#getDuration.
+ +
+ + +
+ + +
<static> + + {string} + minplayer.players.youtube.getMediaId(file) + +
+
+ Return the ID for a provided media file. + + +
+ + + + +
+
Parameters:
+ +
+ {object} file + +
+
A minplayer.file object.
+ +
+ + + + + +
+
Returns:
+ +
{string} The ID for the provided media.
+ +
+ + + + +
+ + +
<static> + + {number} + minplayer.players.youtube.getPriority() + +
+
+ + + +
+ + + + + + + + +
+
Returns:
+ +
{number} The priority of this media player.
+ +
+ + + +
+
See:
+ +
minplayer.players.base#getPriority
+ +
+ + +
+ + +
+ + + getVolume(callback) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ callback + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#getVolume
+ +
+ + +
+ + +
+ + {bool} + hasPlayLoader() + +
+
+ Determines if the player should show the playloader. + + +
+ + + + + + + + +
+
Returns:
+ +
{bool} If this player implements its own playLoader.
+ +
+ + + + +
+ + +
+ + + load(file) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ file + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#load
+ +
+ + +
+ + +
+ + + onPlayerStateChange(event) + +
+
+ Called when the player state changes. + + +
+ + + + +
+
Parameters:
+ +
+ {object} event + +
+
A JavaScript Event.
+ +
+ + + + + + + + +
+ + +
+ + + onQualityChange(newQuality) + +
+
+ Called when the player quality changes. + + +
+ + + + +
+
Parameters:
+ +
+ {string} newQuality + +
+
The new quality for the change.
+ +
+ + + + + + + + +
+ + +
+ + + onReady(event) + +
+
+ Called when an error occurs. + + +
+ + + + +
+
Parameters:
+ +
+ {string} event + +
+
The onReady event that was triggered.
+ +
+ + + + + + + + +
+ + +
+ + + pause() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.players.base#pause
+ +
+ + +
+ + +
+ + + play() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.players.base#play
+ +
+ + +
+ + +
+ + {bool} + playerFound() + +
+
+ Checks to see if this player can be found. + + +
+ + + + + + + + +
+
Returns:
+ +
{bool} TRUE - Player is found, FALSE - otherwise.
+ +
+ + + + +
+ + +
+ + + register() + +
+
+ Register this youtube player so that multiple players can be present +on the same page without event collision. + + +
+ + + + + + + + + + + +
+ + +
+ + + seek(pos) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ pos + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#seek
+ +
+ + +
+ + +
+ + + setPlayerState(playerState) + +
+
+ Translates the player state for the YouTube API player. + + +
+ + + + +
+
Parameters:
+ +
+ {number} playerState + +
+
The YouTube player state.
+ +
+ + + + + + + + +
+ + +
+ + + setVolume(vol) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ vol + +
+
+ +
+ + + + + + + +
+
See:
+ +
minplayer.players.base#setVolume
+ +
+ + +
+ + +
+ + + stop() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.players.base#stop
+ +
+ + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 22:38:48 GMT-0700 (PDT) +
+ + diff --git a/minplayer/doc/symbols/minplayer.plugin.html b/minplayer/doc/symbols/minplayer.plugin.html new file mode 100644 index 00000000..fab92ac8 --- /dev/null +++ b/minplayer/doc/symbols/minplayer.plugin.html @@ -0,0 +1,1170 @@ + + + + + + + JsDoc Reference - minplayer.plugin + + + + + + + + + + + + + +
+ +

+ + Class minplayer.plugin +

+ + +

+ + + + The base class for all plugins. + + +
Defined in: minplayer.plugin.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ minplayer.plugin(name, context, options, queue) +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  +
+ context +
+
Keep track of the context.
+
  +
+ lock +
+
Create a queue lock.
+
  +
+ name +
+
The name of this plugin.
+
  +
+ options +
+
The options for this plugin.
+
  + +
The ready flag.
+
  +
+ queue +
+
The event queue.
+
  +
+ triggered +
+
Keep track of already triggered events.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
  +
addPlugin(name, plugin) +
+
Adds a new plugin to this player.
+
  +
bind(type, data, fn) +
+
Bind to a media event.
+
  + +
Check the queue and execute it.
+
  + +
The constructor which is called once the context is set.
+
  +
create(name, base, context) +
+
Creates a new plugin within this context.
+
  +
destroy() +
+
Destructor.
+
  +
get(plugin, callback) +
+
Gets a plugin by name and calls callback when it is ready.
+
  +
poll(callback, interval) +
+
Create a polling timer.
+
  +
ready() +
+
Plugins should call this method when they are ready.
+
  +
trigger(type, data) +
+
Trigger a media event.
+
  +
unbind(type, fn) +
+
Unbind a media event.
+
+ + + + + + + + + +
+
+ Class Detail +
+ +
+ minplayer.plugin(name, context, options, queue) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {string} name + +
+
The name of this plugin.
+ +
+ {object} context + +
+
The jQuery context.
+ +
+ {object} options + +
+
This components options.
+ +
+ {object} queue + +
+
The event queue to pass events around.
+ +
+ + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + context + +
+
+ Keep track of the context. + + +
+ + + + + + + + +
+ + +
+ + + lock + +
+
+ Create a queue lock. + + +
+ + + + + + + + +
+ + +
+ + + name + +
+
+ The name of this plugin. + + +
+ + + + + + + + +
+ + +
+ + + options + +
+
+ The options for this plugin. + + +
+ + + + + + + + +
+ + +
+ + + pluginReady + +
+
+ The ready flag. + + +
+ + + + + + + + +
+ + +
+ + + queue + +
+
+ The event queue. + + +
+ + + + + + + + +
+ + +
+ + + triggered + +
+
+ Keep track of already triggered events. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
+ + + addPlugin(name, plugin) + +
+
+ Adds a new plugin to this player. + + +
+ + + + +
+
Parameters:
+ +
+ {string} name + +
+
The name of this plugin.
+ +
+ {object} plugin + +
+
A new plugin object, derived from media.plugin.
+ +
+ + + + + + + + +
+ + +
+ + {object} + bind(type, data, fn) + +
+
+ Bind to a media event. + + +
+ + + + +
+
Parameters:
+ +
+ {string} type + +
+
The event type.
+ +
+ {object} data + +
+
The data to bind with the event.
+ +
+ {function} fn + +
+
The callback function.
+ +
+ + + + + +
+
Returns:
+ +
{object} The plugin object.
+ +
+ + + + +
+ + +
+ + + checkQueue() + +
+
+ Check the queue and execute it. + + +
+ + + + + + + + + + + +
+ + +
+ + + construct() + +
+
+ The constructor which is called once the context is set. +Any class deriving from the plugin class should place all context +dependant functionality within this function instead of the standard +constructor function since it is called on object derivation as well +as object creation. + + +
+ + + + + + + + + + + +
+ + +
+ + {object} + create(name, base, context) + +
+
+ Creates a new plugin within this context. + + +
+ + + + +
+
Parameters:
+ +
+ {string} name + +
+
The name of the plugin you wish to create.
+ +
+ {object} base + +
+
The base object for this plugin.
+ +
+ {object} context + +
+
The context which you would like to create.
+ +
+ + + + + +
+
Returns:
+ +
{object} The new plugin object.
+ +
+ + + + +
+ + +
+ + + destroy() + +
+
+ Destructor. + + +
+ + + + + + + + + + + +
+ + +
+ + {object} + get(plugin, callback) + +
+
+ Gets a plugin by name and calls callback when it is ready. + + +
+ + + + +
+
Parameters:
+ +
+ {string} plugin + +
+
The plugin of the plugin.
+ +
+ {function} callback + +
+
Called when the plugin is ready.
+ +
+ + + + + +
+
Returns:
+ +
{object} The plugin if no callback is provided.
+ +
+ + + + +
+ + +
+ + + poll(callback, interval) + +
+
+ Create a polling timer. + + +
+ + + + +
+
Parameters:
+ +
+ {function} callback + +
+
The function to call when you poll.
+ +
+ {integer} interval + +
+
The interval you would like to poll.
+ +
+ + + + + + + + +
+ + +
+ + + ready() + +
+
+ Plugins should call this method when they are ready. + + +
+ + + + + + + + + + + +
+ + +
+ + {object} + trigger(type, data) + +
+
+ Trigger a media event. + + +
+ + + + +
+
Parameters:
+ +
+ {string} type + +
+
The event type.
+ +
+ {object} data + +
+
The event data object.
+ +
+ + + + + +
+
Returns:
+ +
{object} The plugin object.
+ +
+ + + + +
+ + +
+ + {object} + unbind(type, fn) + +
+
+ Unbind a media event. + + +
+ + + + +
+
Parameters:
+ +
+ {string} type + +
+
The event type.
+ +
+ {function} fn + +
+
The callback function.
+ +
+ + + + + +
+
Returns:
+ +
{object} The plugin object.
+ +
+ + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 21 2012 22:38:48 GMT-0700 (PDT) +
+ + diff --git a/minplayer/doc/symbols/minplayer.templates.base.html b/minplayer/doc/symbols/minplayer.templates.base.html new file mode 100644 index 00000000..bcdbc0f2 --- /dev/null +++ b/minplayer/doc/symbols/minplayer.templates.base.html @@ -0,0 +1,572 @@ + + + + + + + JsDoc Reference - minplayer.templates.base + + + + + + + + + + + + + +
+ +

+ + Class minplayer.templates.base +

+ + +

+ +
Extends + minplayer.display.
+ + + The base template class which all templates should derive. + + +
Defined in: minplayer.templates.base.js. + +

+ + + + + + + + + + + + + + + + + +
Class Summary
Constructor AttributesConstructor Name and Description
  +
+ minplayer.templates.base(context, options) +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
  + +
Reset the constructor.
+
+ + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
  + +
+
  + +
+
  +
onFullScreen(full) +
+
Called when the media player goes into full screen mode.
+
+ + + +
+
Methods borrowed from class minplayer.display:
bind, getScaledRect, isValid, onResize, trigger
Methods borrowed from class minplayer.plugin:
addPlugin, destroy, eachPlugin, getPlugin, getPlugins, initialize, loading, loadPlugins, ready, setLoading
+
+ + + + + + + +
+
+ Class Detail +
+ +
+ minplayer.templates.base(context, options) +
+ +
+ + +
+ + + + + +
+
Parameters:
+ +
+ {object} context + +
+
The jQuery context.
+ +
+ {object} options + +
+
This components options.
+ +
+ + + + + + + + +
+ + + + +
+ Field Detail +
+ + +
+ + + constructor + +
+
+ Reset the constructor. + + +
+ + + + + + + + + + + + + + +
+ Method Detail +
+ + +
+ + + construct() + +
+
+ + + +
+ + + + + + + + + + +
+
See:
+ +
minplayer.plugin#construct
+ +
+ + +
+ + +
+ + {object} + getElements() + +
+
+ + + +
+ + + + + + + + +
+
Returns:
+ +
{object} The display elemnents for this component.
+ +
+ + + +
+
See:
+ +
minplayer.display#getElements
+ +
+ + +
+ + +
+ + + onFullScreen(full) + +
+
+ Called when the media player goes into full screen mode. + + +
+ + + + +
+
Parameters:
+ +
+ {boolean} full + +
+
TRUE - The player is in fullscreen, FALSE otherwise.
+ +
+ + + + + + + + + + + + + + + +
+
+ + + +
+ + Documentation generated by JsDoc Toolkit 2.4.0 on Sat Feb 11 2012 02:41:00 GMT+0100 (CET) +
+ + diff --git a/minplayer/doc/symbols/src/src_minplayer.async.js.html b/minplayer/doc/symbols/src/src_minplayer.async.js.html new file mode 100644 index 00000000..dc698720 --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.async.js.html @@ -0,0 +1,69 @@ +
  1 /** The minplayer namespace. */
+  2 var minplayer = minplayer || {};
+  3 
+  4 /**
+  5  * @constructor
+  6  * @class This class keeps track of asynchronous get requests for certain
+  7  * variables within the player.
+  8  */
+  9 minplayer.async = function() {
+ 10 
+ 11   /** The final value of this asynchronous variable. */
+ 12   this.value = null;
+ 13 
+ 14   /** The queue of callbacks to call when this value is determined. */
+ 15   this.queue = [];
+ 16 };
+ 17 
+ 18 /**
+ 19  * Retrieve the value of this variable.
+ 20  *
+ 21  * @param {function} callback The function to call when the value is determined.
+ 22  * @param {function} pollValue The poll function to try and get the value every
+ 23  * 1 second if the value is not set.
+ 24  */
+ 25 minplayer.async.prototype.get = function(callback, pollValue) {
+ 26 
+ 27   // If the value is set, then immediately call the callback, otherwise, just
+ 28   // add it to the queue when the variable is set.
+ 29   if (this.value !== null) {
+ 30     callback(this.value);
+ 31   }
+ 32   else {
+ 33 
+ 34     // Add this callback to the queue.
+ 35     this.queue.push(callback);
+ 36   }
+ 37 };
+ 38 
+ 39 /**
+ 40  * Sets the value of an asynchronous value.
+ 41  *
+ 42  * @param {void} val The value to set.
+ 43  */
+ 44 minplayer.async.prototype.set = function(val) {
+ 45 
+ 46   // Set the value.
+ 47   this.value = val;
+ 48 
+ 49   // Get the callback queue length.
+ 50   var i = this.queue.length;
+ 51 
+ 52   // Iterate through all the callbacks and call them.
+ 53   if (i) {
+ 54     while (i--) {
+ 55       this.queue[i](val);
+ 56     }
+ 57 
+ 58     // Reset the queue.
+ 59     this.queue = [];
+ 60   }
+ 61 };
+ 62 
\ No newline at end of file diff --git a/minplayer/doc/symbols/src/src_minplayer.compatibility.js.html b/minplayer/doc/symbols/src/src_minplayer.compatibility.js.html new file mode 100644 index 00000000..8cbb6988 --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.compatibility.js.html @@ -0,0 +1,109 @@ +
  1 /** The minplayer namespace. */
+  2 var minplayer = minplayer || {};
+  3 
+  4 // Private function to check a single element's play type.
+  5 function checkPlayType(elem, playType) {
+  6   if ((typeof elem.canPlayType) === 'function') {
+  7     if (typeof playType === 'object') {
+  8       var i = playType.length;
+  9       var mimetype = '';
+ 10       while (i--) {
+ 11         mimetype = checkPlayType(elem, playType[i]);
+ 12         if (!!mimetype) {
+ 13           break;
+ 14         }
+ 15       }
+ 16       return mimetype;
+ 17     }
+ 18     else {
+ 19       var canPlay = elem.canPlayType(playType);
+ 20       if (('no' !== canPlay) && ('' !== canPlay)) {
+ 21         return playType;
+ 22       }
+ 23     }
+ 24   }
+ 25   return '';
+ 26 }
+ 27 
+ 28 /**
+ 29  * @constructor
+ 30  * @class This class is used to define the types of media that can be played
+ 31  * within the browser.
+ 32  * <p>
+ 33  * <strong>Usage:</strong>
+ 34  * <pre><code>
+ 35  *   var playTypes = new minplayer.compatibility();
+ 36  *
+ 37  *   if (playTypes.videoOGG) {
+ 38  *     console.log("This browser can play OGG video");
+ 39  *   }
+ 40  *
+ 41  *   if (playTypes.videoH264) {
+ 42  *     console.log("This browser can play H264 video");
+ 43  *   }
+ 44  *
+ 45  *   if (playTypes.videoWEBM) {
+ 46  *     console.log("This browser can play WebM video");
+ 47  *   }
+ 48  *
+ 49  *   if (playTypes.audioOGG) {
+ 50  *     console.log("This browser can play OGG audio");
+ 51  *   }
+ 52  *
+ 53  *   if (playTypes.audioMP3) {
+ 54  *     console.log("This browser can play MP3 audio");
+ 55  *   }
+ 56  *
+ 57  *   if (playTypes.audioMP4) {
+ 58  *     console.log("This browser can play MP4 audio");
+ 59  *   }
+ 60  * </code></pre>
+ 61  */
+ 62 minplayer.compatibility = function() {
+ 63   var elem = null;
+ 64 
+ 65   // Create a video element.
+ 66   elem = document.createElement('video');
+ 67 
+ 68   /** Can play OGG video */
+ 69   this.videoOGG = checkPlayType(elem, 'video/ogg');
+ 70 
+ 71   /** Can play H264 video */
+ 72   this.videoH264 = checkPlayType(elem, [
+ 73     'video/mp4',
+ 74     'video/h264'
+ 75   ]);
+ 76 
+ 77   /** Can play WEBM video */
+ 78   this.videoWEBM = checkPlayType(elem, [
+ 79     'video/x-webm',
+ 80     'video/webm',
+ 81     'application/octet-stream'
+ 82   ]);
+ 83 
+ 84   // Create an audio element.
+ 85   elem = document.createElement('audio');
+ 86 
+ 87   /** Can play audio OGG */
+ 88   this.audioOGG = checkPlayType(elem, 'audio/ogg');
+ 89 
+ 90   /** Can play audio MP3 */
+ 91   this.audioMP3 = checkPlayType(elem, 'audio/mpeg');
+ 92 
+ 93   /** Can play audio MP4 */
+ 94   this.audioMP4 = checkPlayType(elem, 'audio/mp4');
+ 95 };
+ 96 
+ 97 if (!minplayer.playTypes) {
+ 98 
+ 99   /** The compatible playtypes for this browser. */
+100   minplayer.playTypes = new minplayer.compatibility();
+101 }
+102 
\ No newline at end of file diff --git a/minplayer/doc/symbols/src/src_minplayer.controller.base.js.html b/minplayer/doc/symbols/src/src_minplayer.controller.base.js.html new file mode 100644 index 00000000..19299dc1 --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.controller.base.js.html @@ -0,0 +1,302 @@ +
  1 /** The minplayer namespace. */
+  2 var minplayer = minplayer || {};
+  3 
+  4 /** Define the controller object. */
+  5 minplayer.controller = minplayer.controller || {};
+  6 
+  7 /**
+  8  * @constructor
+  9  * @extends minplayer.display
+ 10  * @class This is the base minplayer controller.  Other controllers can derive
+ 11  * from the base and either build on top of it or simply define the elements
+ 12  * that this base controller uses.
+ 13  *
+ 14  * @param {object} context The jQuery context.
+ 15  * @param {object} options This components options.
+ 16  */
+ 17 minplayer.controller.base = function(context, options) {
+ 18 
+ 19   // Derive from display
+ 20   minplayer.display.call(this, 'controller', context, options);
+ 21 };
+ 22 
+ 23 // Define the prototype for all controllers.
+ 24 var controllersBase = minplayer.controller.base;
+ 25 
+ 26 /** Derive from minplayer.display. */
+ 27 minplayer.controller.base.prototype = new minplayer.display();
+ 28 
+ 29 /** Reset the constructor. */
+ 30 minplayer.controller.base.prototype.constructor = minplayer.controller.base;
+ 31 
+ 32 /**
+ 33  * A static function that will format a time value into a string time format.
+ 34  *
+ 35  * @param {integer} time An integer value of time.
+ 36  * @return {string} A string representation of the time.
+ 37  */
+ 38 minplayer.formatTime = function(time) {
+ 39   time = time || 0;
+ 40   var seconds = 0, minutes = 0, hour = 0, timeString = '';
+ 41 
+ 42   hour = Math.floor(time / 3600);
+ 43   time -= (hour * 3600);
+ 44   minutes = Math.floor(time / 60);
+ 45   time -= (minutes * 60);
+ 46   seconds = Math.floor(time % 60);
+ 47 
+ 48   if (hour) {
+ 49     timeString += String(hour);
+ 50     timeString += ':';
+ 51   }
+ 52 
+ 53   timeString += (minutes >= 10) ? String(minutes) : ('0' + String(minutes));
+ 54   timeString += ':';
+ 55   timeString += (seconds >= 10) ? String(seconds) : ('0' + String(seconds));
+ 56   return {time: timeString, units: ''};
+ 57 };
+ 58 
+ 59 /**
+ 60  * @see minplayer.display#getElements
+ 61  * @return {object} The elements defined by this display.
+ 62  */
+ 63 minplayer.controller.base.prototype.getElements = function() {
+ 64   var elements = minplayer.display.prototype.getElements.call(this);
+ 65   return jQuery.extend(elements, {
+ 66     play: null,
+ 67     pause: null,
+ 68     fullscreen: null,
+ 69     seek: null,
+ 70     progress: null,
+ 71     volume: null,
+ 72     timer: null
+ 73   });
+ 74 };
+ 75 
+ 76 /**
+ 77  * @see minplayer.plugin#construct
+ 78  */
+ 79 minplayer.controller.base.prototype.construct = function() {
+ 80 
+ 81   // Call the minplayer plugin constructor.
+ 82   minplayer.display.prototype.construct.call(this);
+ 83 
+ 84   // Keep track of if we are dragging...
+ 85   this.dragging = false;
+ 86 
+ 87   // If they have a seek bar.
+ 88   if (this.elements.seek) {
+ 89 
+ 90     // Create the seek bar slider control.
+ 91     this.seekBar = this.elements.seek.slider({
+ 92       range: 'min'
+ 93     });
+ 94   }
+ 95 
+ 96   // If they have a volume bar.
+ 97   if (this.elements.volume) {
+ 98 
+ 99     // Create the volume bar slider control.
+100     this.volumeBar = this.elements.volume.slider({
+101       range: 'min',
+102       orientation: 'vertical'
+103     });
+104   }
+105 
+106   // Get the player plugin.
+107   this.get('player', function(player) {
+108 
+109     // If they have a fullscreen button.
+110     if (this.elements.fullscreen) {
+111 
+112       // Bind to the click event.
+113       this.elements.fullscreen.unbind().bind('click', function(e) {
+114 
+115         // Toggle fullscreen mode.
+116         player.toggleFullScreen();
+117       }).css({'pointer' : 'hand'});
+118     }
+119   });
+120 
+121   // Get the media plugin.
+122   this.get('media', function(media) {
+123 
+124     var _this = this;
+125 
+126     // If they have a pause button
+127     if (this.elements.pause) {
+128 
+129       // Bind to the click on this button.
+130       this.elements.pause.unbind().bind('click', {obj: this}, function(e) {
+131         e.preventDefault();
+132         e.data.obj.playPause(false, media);
+133       });
+134 
+135       // Bind to the pause event of the media.
+136       media.bind('pause', {obj: this}, function(e) {
+137         e.data.obj.setPlayPause(true);
+138       });
+139     }
+140 
+141     // If they have a play button
+142     if (this.elements.play) {
+143 
+144       // Bind to the click on this button.
+145       this.elements.play.unbind().bind('click', {obj: this}, function(e) {
+146         e.preventDefault();
+147         e.data.obj.playPause(true, media);
+148       });
+149 
+150       // Bind to the play event of the media.
+151       media.bind('playing', {obj: this}, function(e) {
+152         e.data.obj.setPlayPause(false);
+153       });
+154     }
+155 
+156     // If they have a duration, then trigger on duration change.
+157     if (this.elements.duration) {
+158 
+159       // Bind to the duration change event.
+160       media.bind('durationchange', {obj: this}, function(e, data) {
+161         e.data.obj.setTimeString('duration', data.duration);
+162       });
+163 
+164       // Set the timestring to the duration.
+165       media.getDuration(function(duration) {
+166         _this.setTimeString('duration', duration);
+167       });
+168     }
+169 
+170     // If they have a progress element.
+171     if (this.elements.progress) {
+172 
+173       // Bind to the progress event.
+174       media.bind('progress', {obj: this}, function(e, data) {
+175         var percent = data.total ? (data.loaded / data.total) * 100 : 0;
+176         e.data.obj.elements.progress.width(percent + '%');
+177       });
+178     }
+179 
+180     // If they have a seek bar or timer, bind to the timeupdate.
+181     if (this.seekBar || this.elements.timer) {
+182 
+183       // Bind to the time update event.
+184       media.bind('timeupdate', {obj: this}, function(e, data) {
+185         if (!e.data.obj.dragging) {
+186           var value = 0;
+187           if (data.duration) {
+188             value = (data.currentTime / data.duration) * 100;
+189           }
+190 
+191           // Update the seek bar if it exists.
+192           if (e.data.obj.seekBar) {
+193             e.data.obj.seekBar.slider('option', 'value', value);
+194           }
+195 
+196           e.data.obj.setTimeString('timer', data.currentTime);
+197         }
+198       });
+199     }
+200 
+201     // If they have a seekBar element.
+202     if (this.seekBar) {
+203 
+204       // Register the events for the control bar to control the media.
+205       this.seekBar.slider({
+206         start: function(event, ui) {
+207           _this.dragging = true;
+208         },
+209         stop: function(event, ui) {
+210           _this.dragging = false;
+211           media.getDuration(function(duration) {
+212             media.seek((ui.value / 100) * duration);
+213           });
+214         },
+215         slide: function(event, ui) {
+216           media.getDuration(function(duration) {
+217             var time = (ui.value / 100) * duration;
+218             if (!_this.dragging) {
+219               media.seek(time);
+220             }
+221             _this.setTimeString('timer', time);
+222           });
+223         }
+224       });
+225     }
+226 
+227     // Setup the volume bar.
+228     if (this.volumeBar) {
+229 
+230       // Create the slider.
+231       this.volumeBar.slider({
+232         slide: function(event, ui) {
+233           media.setVolume(ui.value / 100);
+234         }
+235       });
+236 
+237       media.bind('volumeupdate', {obj: this}, function(event, vol) {
+238         event.data.obj.volumeBar.slider('option', 'value', (vol * 100));
+239       });
+240 
+241       // Set the volume to match that of the player.
+242       media.getVolume(function(vol) {
+243         _this.volumeBar.slider('option', 'value', (vol * 100));
+244       });
+245     }
+246   });
+247 
+248   // We are now ready.
+249   this.ready();
+250 };
+251 
+252 /**
+253  * Sets the play and pause state of the control bar.
+254  *
+255  * @param {boolean} state TRUE - Show Play, FALSE - Show Pause.
+256  */
+257 minplayer.controller.base.prototype.setPlayPause = function(state) {
+258   var css = '';
+259   if (this.elements.play) {
+260     css = state ? 'inherit' : 'none';
+261     this.elements.play.css('display', css);
+262   }
+263   if (this.elements.pause) {
+264     css = state ? 'none' : 'inherit';
+265     this.elements.pause.css('display', css);
+266   }
+267 };
+268 
+269 /**
+270  * Plays or pauses the media.
+271  *
+272  * @param {bool} state true => play, false => pause.
+273  * @param {object} media The media player object.
+274  */
+275 minplayer.controller.base.prototype.playPause = function(state, media) {
+276   var type = state ? 'play' : 'pause';
+277   this.display.trigger(type);
+278   this.setPlayPause(!state);
+279   if (media) {
+280     media[type]();
+281   }
+282 };
+283 
+284 /**
+285  * Sets the time string on the control bar.
+286  *
+287  * @param {string} element The name of the element to set.
+288  * @param {number} time The total time amount to set.
+289  */
+290 minplayer.controller.base.prototype.setTimeString = function(element, time) {
+291   if (this.elements[element]) {
+292     this.elements[element].text(minplayer.formatTime(time).time);
+293   }
+294 };
+295 
\ No newline at end of file diff --git a/minplayer/doc/symbols/src/src_minplayer.controller.js.html b/minplayer/doc/symbols/src/src_minplayer.controller.js.html new file mode 100644 index 00000000..0d0d745b --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.controller.js.html @@ -0,0 +1,320 @@ +
  1 /** The minplayer namespace. */
+  2 var minplayer = minplayer || {};
+  3 
+  4 /**
+  5  * @constructor
+  6  * @extends minplayer.display
+  7  * @class This is the base minplayer controller.  Other controllers can derive
+  8  * from the base and either build on top of it or simply define the elements
+  9  * that this base controller uses.
+ 10  *
+ 11  * @param {object} context The jQuery context.
+ 12  * @param {object} options This components options.
+ 13  */
+ 14 minplayer.controller = function(context, options) {
+ 15 
+ 16   // Derive from display
+ 17   minplayer.display.call(this, 'controller', context, options);
+ 18 };
+ 19 
+ 20 /** Derive from minplayer.display. */
+ 21 minplayer.controller.prototype = new minplayer.display();
+ 22 
+ 23 /** Reset the constructor. */
+ 24 minplayer.controller.prototype.constructor = minplayer.controller;
+ 25 
+ 26 /**
+ 27  * A static function that will format a time value into a string time format.
+ 28  *
+ 29  * @param {integer} time An integer value of time.
+ 30  * @return {string} A string representation of the time.
+ 31  */
+ 32 minplayer.formatTime = function(time) {
+ 33   time = time || 0;
+ 34   var seconds = 0, minutes = 0, hour = 0, timeString = '';
+ 35 
+ 36   hour = Math.floor(time / 3600);
+ 37   time -= (hour * 3600);
+ 38   minutes = Math.floor(time / 60);
+ 39   time -= (minutes * 60);
+ 40   seconds = Math.floor(time % 60);
+ 41 
+ 42   if (hour) {
+ 43     timeString += String(hour);
+ 44     timeString += ':';
+ 45   }
+ 46 
+ 47   timeString += (minutes >= 10) ? String(minutes) : ('0' + String(minutes));
+ 48   timeString += ':';
+ 49   timeString += (seconds >= 10) ? String(seconds) : ('0' + String(seconds));
+ 50   return {time: timeString, units: ''};
+ 51 };
+ 52 
+ 53 /**
+ 54  * @see minplayer.display#getElements
+ 55  * @return {object} The elements defined by this display.
+ 56  */
+ 57 minplayer.controller.prototype.getElements = function() {
+ 58   var elements = minplayer.display.prototype.getElements.call(this);
+ 59   return jQuery.extend(elements, {
+ 60     play: null,
+ 61     pause: null,
+ 62     fullscreen: null,
+ 63     seek: null,
+ 64     progress: null,
+ 65     volume: null,
+ 66     timer: null
+ 67   });
+ 68 };
+ 69 
+ 70 /**
+ 71  * @see minplayer.plugin#construct
+ 72  */
+ 73 minplayer.controller.prototype.construct = function() {
+ 74 
+ 75   // Call the minplayer plugin constructor.
+ 76   minplayer.display.prototype.construct.call(this);
+ 77 
+ 78   // Keep track of if we are dragging...
+ 79   this.dragging = false;
+ 80 
+ 81   // If they have a seek bar.
+ 82   if (this.elements.seek) {
+ 83 
+ 84     // Create the seek bar slider control.
+ 85     this.seekBar = this.elements.seek.slider({
+ 86       range: 'min'
+ 87     });
+ 88   }
+ 89 
+ 90   // If they have a volume bar.
+ 91   if (this.elements.volume) {
+ 92 
+ 93     // Create the volume bar slider control.
+ 94     this.volumeBar = this.elements.volume.slider({
+ 95       range: 'min',
+ 96       orientation: 'vertical'
+ 97     });
+ 98   }
+ 99 
+100   // Get the player plugin.
+101   this.get('player', function(player) {
+102 
+103     // If they have a fullscreen button.
+104     if (this.elements.fullscreen) {
+105 
+106       // Bind to the click event.
+107       this.elements.fullscreen.unbind().bind('click', function(e) {
+108 
+109         // Toggle fullscreen mode.
+110         player.toggleFullScreen();
+111       }).css({'pointer' : 'hand'});
+112     }
+113   });
+114 
+115   // Get the media plugin.
+116   this.get('media', function(media) {
+117 
+118     // If they have a pause button
+119     if (this.elements.pause) {
+120 
+121       // Bind to the click on this button.
+122       this.elements.pause.unbind().bind('click', (function(controller) {
+123         return function(event) {
+124           event.preventDefault();
+125           controller.playPause(false, media);
+126         };
+127       })(this));
+128 
+129       // Bind to the pause event of the media.
+130       media.bind('pause', (function(controller) {
+131         return function(event) {
+132           controller.setPlayPause(true);
+133         };
+134       })(this));
+135     }
+136 
+137     // If they have a play button
+138     if (this.elements.play) {
+139 
+140       // Bind to the click on this button.
+141       this.elements.play.unbind().bind('click', (function(controller) {
+142         return function(event) {
+143           event.preventDefault();
+144           controller.playPause(true, media);
+145         };
+146       })(this));
+147 
+148       // Bind to the play event of the media.
+149       media.bind('playing', (function(controller) {
+150         return function(event) {
+151           controller.setPlayPause(false);
+152         };
+153       })(this));
+154     }
+155 
+156     // If they have a duration, then trigger on duration change.
+157     if (this.elements.duration) {
+158 
+159       // Bind to the duration change event.
+160       media.bind('durationchange', (function(controller) {
+161         return function(event, data) {
+162           controller.setTimeString('duration', data.duration);
+163         };
+164       })(this));
+165 
+166       // Set the timestring to the duration.
+167       media.getDuration((function(controller) {
+168         return function(duration) {
+169           controller.setTimeString('duration', duration);
+170         };
+171       })(this));
+172     }
+173 
+174     // If they have a progress element.
+175     if (this.elements.progress) {
+176 
+177       // Bind to the progress event.
+178       media.bind('progress', (function(controller) {
+179         return function(event, data) {
+180           var percent = data.total ? (data.loaded / data.total) * 100 : 0;
+181           controller.elements.progress.width(percent + '%');
+182         };
+183       })(this));
+184     }
+185 
+186     // If they have a seek bar or timer, bind to the timeupdate.
+187     if (this.seekBar || this.elements.timer) {
+188 
+189       // Bind to the time update event.
+190       media.bind('timeupdate', (function(controller) {
+191         return function(event, data) {
+192           if (!controller.dragging) {
+193             var value = 0;
+194             if (data.duration) {
+195               value = (data.currentTime / data.duration) * 100;
+196             }
+197 
+198             // Update the seek bar if it exists.
+199             if (controller.seekBar) {
+200               controller.seekBar.slider('option', 'value', value);
+201             }
+202 
+203             controller.setTimeString('timer', data.currentTime);
+204           }
+205         };
+206       })(this));
+207     }
+208 
+209     // If they have a seekBar element.
+210     if (this.seekBar) {
+211 
+212       // Register the events for the control bar to control the media.
+213       this.seekBar.slider({
+214         start: (function(controller) {
+215           return function(event, ui) {
+216             controller.dragging = true;
+217           };
+218         })(this),
+219         stop: (function(controller) {
+220           return function(event, ui) {
+221             controller.dragging = false;
+222             media.getDuration(function(duration) {
+223               media.seek((ui.value / 100) * duration);
+224             });
+225           };
+226         })(this),
+227         slide: (function(controller) {
+228           return function(event, ui) {
+229             media.getDuration(function(duration) {
+230               var time = (ui.value / 100) * duration;
+231               if (!controller.dragging) {
+232                 media.seek(time);
+233               }
+234               controller.setTimeString('timer', time);
+235             });
+236           };
+237         })(this)
+238       });
+239     }
+240 
+241     // Setup the volume bar.
+242     if (this.volumeBar) {
+243 
+244       // Create the slider.
+245       this.volumeBar.slider({
+246         slide: function(event, ui) {
+247           media.setVolume(ui.value / 100);
+248         }
+249       });
+250 
+251       media.bind('volumeupdate', (function(controller) {
+252         return function(event, vol) {
+253           controller.volumeBar.slider('option', 'value', (vol * 100));
+254         };
+255       })(this));
+256 
+257       // Set the volume to match that of the player.
+258       media.getVolume((function(controller) {
+259         return function(vol) {
+260           controller.volumeBar.slider('option', 'value', (vol * 100));
+261         };
+262       })(this));
+263     }
+264   });
+265 
+266   // We are now ready.
+267   this.ready();
+268 };
+269 
+270 /**
+271  * Sets the play and pause state of the control bar.
+272  *
+273  * @param {boolean} state TRUE - Show Play, FALSE - Show Pause.
+274  */
+275 minplayer.controller.prototype.setPlayPause = function(state) {
+276   var css = '';
+277   if (this.elements.play) {
+278     css = state ? 'inherit' : 'none';
+279     this.elements.play.css('display', css);
+280   }
+281   if (this.elements.pause) {
+282     css = state ? 'none' : 'inherit';
+283     this.elements.pause.css('display', css);
+284   }
+285 };
+286 
+287 /**
+288  * Plays or pauses the media.
+289  *
+290  * @param {bool} state true => play, false => pause.
+291  * @param {object} media The media player object.
+292  */
+293 minplayer.controller.prototype.playPause = function(state, media) {
+294   var type = state ? 'play' : 'pause';
+295   this.display.trigger(type);
+296   this.setPlayPause(!state);
+297   if (media) {
+298     media[type]();
+299   }
+300 };
+301 
+302 /**
+303  * Sets the time string on the control bar.
+304  *
+305  * @param {string} element The name of the element to set.
+306  * @param {number} time The total time amount to set.
+307  */
+308 minplayer.controller.prototype.setTimeString = function(element, time) {
+309   if (this.elements[element]) {
+310     this.elements[element].text(minplayer.formatTime(time).time);
+311   }
+312 };
+313 
\ No newline at end of file diff --git a/minplayer/doc/symbols/src/src_minplayer.controllers.base.js.html b/minplayer/doc/symbols/src/src_minplayer.controllers.base.js.html new file mode 100644 index 00000000..d6533255 --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.controllers.base.js.html @@ -0,0 +1,299 @@ +
  1 /** The minplayer namespace. */
+  2 var minplayer = minplayer || {};
+  3 
+  4 /** Define the controllers object. */
+  5 minplayer.controllers = minplayer.controllers || {};
+  6 
+  7 /**
+  8  * @constructor
+  9  * @extends minplayer.display
+ 10  * @class This is the base minplayer controller.  Other controllers can derive
+ 11  * from the base and either build on top of it or simply define the elements
+ 12  * that this base controller uses.
+ 13  *
+ 14  * @param {object} context The jQuery context.
+ 15  * @param {object} options This components options.
+ 16  */
+ 17 minplayer.controllers.base = function(context, options) {
+ 18 
+ 19   // Derive from display
+ 20   minplayer.display.call(this, 'controller', context, options);
+ 21 };
+ 22 
+ 23 // Define the prototype for all controllers.
+ 24 var controllersBase = minplayer.controllers.base;
+ 25 
+ 26 /** Derive from minplayer.display. */
+ 27 minplayer.controllers.base.prototype = new minplayer.display();
+ 28 
+ 29 /** Reset the constructor. */
+ 30 minplayer.controllers.base.prototype.constructor = minplayer.controllers.base;
+ 31 
+ 32 /**
+ 33  * A static function that will format a time value into a string time format.
+ 34  *
+ 35  * @param {integer} time An integer value of time.
+ 36  * @return {string} A string representation of the time.
+ 37  */
+ 38 minplayer.formatTime = function(time) {
+ 39   time = time || 0;
+ 40   var seconds = 0, minutes = 0, hour = 0, timeString = '';
+ 41 
+ 42   hour = Math.floor(time / 3600);
+ 43   time -= (hour * 3600);
+ 44   minutes = Math.floor(time / 60);
+ 45   time -= (minutes * 60);
+ 46   seconds = Math.floor(time % 60);
+ 47 
+ 48   if (hour) {
+ 49     timeString += String(hour);
+ 50     timeString += ':';
+ 51   }
+ 52 
+ 53   timeString += (minutes >= 10) ? String(minutes) : ('0' + String(minutes));
+ 54   timeString += ':';
+ 55   timeString += (seconds >= 10) ? String(seconds) : ('0' + String(seconds));
+ 56   return {time: timeString, units: ''};
+ 57 };
+ 58 
+ 59 /**
+ 60  * @see minplayer.display#getElements
+ 61  * @return {object} The elements defined by this display.
+ 62  */
+ 63 minplayer.controllers.base.prototype.getElements = function() {
+ 64   var elements = minplayer.display.prototype.getElements.call(this);
+ 65   return jQuery.extend(elements, {
+ 66     play: null,
+ 67     pause: null,
+ 68     fullscreen: null,
+ 69     seek: null,
+ 70     progress: null,
+ 71     volume: null,
+ 72     timer: null
+ 73   });
+ 74 };
+ 75 
+ 76 /**
+ 77  * @see minplayer.plugin#construct
+ 78  */
+ 79 minplayer.controllers.base.prototype.construct = function() {
+ 80 
+ 81   // Call the minplayer plugin constructor.
+ 82   minplayer.display.prototype.construct.call(this);
+ 83 
+ 84   // If they have a fullscreen button.
+ 85   if (this.elements.fullscreen) {
+ 86 
+ 87     // Bind to the click event.
+ 88     this.elements.fullscreen.bind('click', {obj: this}, function(event) {
+ 89       var isFull = event.data.obj.elements.player.hasClass('fullscreen');
+ 90       if (isFull) {
+ 91         event.data.obj.elements.player.removeClass('fullscreen');
+ 92       }
+ 93       else {
+ 94         event.data.obj.elements.player.addClass('fullscreen');
+ 95       }
+ 96       event.data.obj.trigger('fullscreen', !isFull);
+ 97     }).css({'pointer' : 'hand'});
+ 98   }
+ 99 
+100   // Keep track of if we are dragging...
+101   this.dragging = false;
+102 
+103   // If they have a seek bar.
+104   if (this.elements.seek) {
+105 
+106     // Create the seek bar slider control.
+107     this.seekBar = this.elements.seek.slider({
+108       range: 'min'
+109     });
+110   }
+111 
+112   // If they have a volume bar.
+113   if (this.elements.volume) {
+114 
+115     // Create the volume bar slider control.
+116     this.volumeBar = this.elements.volume.slider({
+117       range: 'min',
+118       orientation: 'vertical'
+119     });
+120   }
+121 
+122   // Get the media plugin.
+123   this.get('media', function(media) {
+124 
+125     var _this = this;
+126 
+127     // If they have a pause button
+128     if (this.elements.pause) {
+129 
+130       // Bind to the click on this button.
+131       this.elements.pause.bind('click', {obj: this}, function(event) {
+132         event.preventDefault();
+133         event.data.obj.playPause(false, media);
+134       });
+135 
+136       // Bind to the pause event of the media.
+137       media.bind('pause', {obj: this}, function(event) {
+138         event.data.obj.setPlayPause(true);
+139       });
+140     }
+141 
+142     // If they have a play button
+143     if (this.elements.play) {
+144 
+145       // Bind to the click on this button.
+146       this.elements.play.bind('click', {obj: this}, function(event) {
+147         event.preventDefault();
+148         event.data.obj.playPause(true, media);
+149       });
+150 
+151       // Bind to the play event of the media.
+152       media.bind('playing', {obj: this}, function(event) {
+153         event.data.obj.setPlayPause(false);
+154       });
+155     }
+156 
+157     // If they have a duration, then trigger on duration change.
+158     if (this.elements.duration) {
+159 
+160       // Bind to the duration change event.
+161       media.bind('durationchange', {obj: this}, function(event, data) {
+162         event.data.obj.setTimeString('duration', data.duration);
+163       });
+164 
+165       // Set the timestring to the duration.
+166       media.getDuration(function(duration) {
+167         _this.setTimeString('duration', duration);
+168       });
+169     }
+170 
+171     // If they have a progress element.
+172     if (this.elements.progress) {
+173 
+174       // Bind to the progress event.
+175       media.bind('progress', {obj: this}, function(event, data) {
+176         var percent = data.total ? (data.loaded / data.total) * 100 : 0;
+177         event.data.obj.elements.progress.width(percent + '%');
+178       });
+179     }
+180 
+181     // If they have a seek bar or timer, bind to the timeupdate.
+182     if (this.seekBar || this.elements.timer) {
+183 
+184       // Bind to the time update event.
+185       media.bind('timeupdate', {obj: this}, function(event, data) {
+186         if (!event.data.obj.dragging) {
+187           var value = 0;
+188           if (data.duration) {
+189             value = (data.currentTime / data.duration) * 100;
+190           }
+191 
+192           // Update the seek bar if it exists.
+193           if (event.data.obj.seekBar) {
+194             event.data.obj.seekBar.slider('option', 'value', value);
+195           }
+196 
+197           event.data.obj.setTimeString('timer', data.currentTime);
+198         }
+199       });
+200     }
+201 
+202     // If they have a seekBar element.
+203     if (this.seekBar) {
+204 
+205       // Register the events for the control bar to control the media.
+206       this.seekBar.slider({
+207         start: function(event, ui) {
+208           _this.dragging = true;
+209         },
+210         stop: function(event, ui) {
+211           _this.dragging = false;
+212           media.getDuration(function(duration) {
+213             media.seek((ui.value / 100) * duration);
+214           });
+215         },
+216         slide: function(event, ui) {
+217           media.getDuration(function(duration) {
+218             var time = (ui.value / 100) * duration;
+219             if (!_this.dragging) {
+220               media.seek(time);
+221             }
+222             _this.setTimeString('timer', time);
+223           });
+224         }
+225       });
+226     }
+227 
+228     // Setup the volume bar.
+229     if (this.volumeBar) {
+230 
+231       // Create the slider.
+232       this.volumeBar.slider({
+233         slide: function(event, ui) {
+234           media.setVolume(ui.value / 100);
+235         }
+236       });
+237 
+238       // Set the volume to match that of the player.
+239       media.getVolume(function(vol) {
+240         _this.volumeBar.slider('option', 'value', (vol * 100));
+241       });
+242     }
+243   });
+244 
+245   // We are now ready.
+246   this.ready();
+247 };
+248 
+249 /**
+250  * Sets the play and pause state of the control bar.
+251  *
+252  * @param {boolean} state TRUE - Show Play, FALSE - Show Pause.
+253  */
+254 minplayer.controllers.base.prototype.setPlayPause = function(state) {
+255   var css = '';
+256   if (this.elements.play) {
+257     css = state ? 'inherit' : 'none';
+258     this.elements.play.css('display', css);
+259   }
+260   if (this.elements.pause) {
+261     css = state ? 'none' : 'inherit';
+262     this.elements.pause.css('display', css);
+263   }
+264 };
+265 
+266 /**
+267  * Plays or pauses the media.
+268  *
+269  * @param {bool} state true => play, false => pause.
+270  * @param {object} media The media player object.
+271  */
+272 minplayer.controllers.base.prototype.playPause = function(state, media) {
+273   var type = state ? 'play' : 'pause';
+274   this.display.trigger(type);
+275   this.setPlayPause(!state);
+276   if (media) {
+277     media[type]();
+278   }
+279 };
+280 
+281 /**
+282  * Sets the time string on the control bar.
+283  *
+284  * @param {string} element The name of the element to set.
+285  * @param {number} time The total time amount to set.
+286  */
+287 minplayer.controllers.base.prototype.setTimeString = function(element, time) {
+288   if (this.elements[element]) {
+289     this.elements[element].text(minplayer.formatTime(time).time);
+290   }
+291 };
+292 
\ No newline at end of file diff --git a/minplayer/doc/symbols/src/src_minplayer.display.js.html b/minplayer/doc/symbols/src/src_minplayer.display.js.html new file mode 100644 index 00000000..fb8318c1 --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.display.js.html @@ -0,0 +1,304 @@ +
  1 /** The minplayer namespace. */
+  2 minplayer = minplayer || {};
+  3 
+  4 /**
+  5  * @constructor
+  6  * @extends minplayer.plugin
+  7  * @class Base class used to provide the display and options for any component
+  8  * deriving from this class.  Components who derive are expected to provide
+  9  * the elements that they define by implementing the getElements method.
+ 10  *
+ 11  * @param {string} name The name of this plugin.
+ 12  * @param {object} context The jQuery context this component resides.
+ 13  * @param {object} options The options for this component.
+ 14  * @param {object} queue The event queue to pass events around.
+ 15  */
+ 16 minplayer.display = function(name, context, options, queue) {
+ 17 
+ 18   // See if we allow resize on this display.
+ 19   this.allowResize = false;
+ 20 
+ 21   if (context) {
+ 22 
+ 23     // Set the display.
+ 24     this.display = this.getDisplay(context, options);
+ 25   }
+ 26 
+ 27   // Derive from plugin
+ 28   minplayer.plugin.call(this, name, context, options, queue);
+ 29 };
+ 30 
+ 31 /** Derive from minplayer.plugin. */
+ 32 minplayer.display.prototype = new minplayer.plugin();
+ 33 
+ 34 /** Reset the constructor. */
+ 35 minplayer.display.prototype.constructor = minplayer.display;
+ 36 
+ 37 /**
+ 38  * Returns the display for this component.
+ 39  *
+ 40  * @param {object} context The original context.
+ 41  * @param {object} options The options for this component.
+ 42  * @return {object} The jQuery context for this display.
+ 43  */
+ 44 minplayer.display.prototype.getDisplay = function(context, options) {
+ 45   return jQuery(context);
+ 46 };
+ 47 
+ 48 /**
+ 49  * @see minplayer.plugin.construct
+ 50  */
+ 51 minplayer.display.prototype.construct = function() {
+ 52 
+ 53   // Call the plugin constructor.
+ 54   minplayer.plugin.prototype.construct.call(this);
+ 55 
+ 56   // Get the display elements.
+ 57   this.elements = this.getElements();
+ 58 
+ 59   // Only do this if they allow resize for this display.
+ 60   if (this.allowResize) {
+ 61 
+ 62     // Set the resize timeout and this pointer.
+ 63     var resizeTimeout = 0;
+ 64 
+ 65     // Add a handler to trigger a resize event.
+ 66     jQuery(window).resize((function(display) {
+ 67       return function() {
+ 68         clearTimeout(resizeTimeout);
+ 69         resizeTimeout = setTimeout(function() {
+ 70           display.onResize();
+ 71         }, 200);
+ 72       };
+ 73     })(this));
+ 74   }
+ 75 };
+ 76 
+ 77 /**
+ 78  * Called when the window resizes.
+ 79  */
+ 80 minplayer.display.prototype.onResize = function() {
+ 81 };
+ 82 
+ 83 /**
+ 84  * Gets the full screen element.
+ 85  *
+ 86  * @return {object} The display to be used for full screen support.
+ 87  */
+ 88 minplayer.display.prototype.fullScreenElement = function() {
+ 89   return this.display;
+ 90 };
+ 91 
+ 92 /**
+ 93  * Called if you would like for your display item to show then hide.
+ 94  *
+ 95  * @param {object} element The element you would like to hide or show.
+ 96  * @param {number} timeout The timeout to hide and show.
+ 97  */
+ 98 minplayer.showThenHide = function(element, timeout) {
+ 99 
+100   // Ensure we have a timeout.
+101   timeout = timeout || 5000;
+102 
+103   // If this has not yet been configured.
+104   if (!element.showTimer) {
+105 
+106     // Bind when they move the mouse.
+107     jQuery(document).bind('mousemove', function() {
+108       minplayer.showThenHide(element, timeout);
+109     });
+110   }
+111 
+112   // Clear the timeout, and then setup the show then hide functionality.
+113   clearTimeout(element.showTimer);
+114 
+115   // Show the display.
+116   element.show();
+117 
+118   // Set a timer to hide it after the timeout.
+119   element.showTimer = setTimeout(function() {
+120     element.hide('slow');
+121   }, timeout);
+122 };
+123 
+124 /**
+125  * Make this display element go fullscreen.
+126  *
+127  * @param {boolean} full Tell the player to go into fullscreen or not.
+128  */
+129 minplayer.display.prototype.fullscreen = function(full) {
+130   var isFull = this.isFullScreen();
+131   var element = this.fullScreenElement();
+132   if (isFull && !full) {
+133     element.removeClass('fullscreen');
+134     if (screenfull) {
+135       screenfull.exit();
+136     }
+137     this.trigger('fullscreen', false);
+138   }
+139   else if (!isFull && full) {
+140     element.addClass('fullscreen');
+141     if (screenfull) {
+142       screenfull.request(element[0]);
+143       screenfull.onchange = (function(display) {
+144         return function(e) {
+145           if (!screenfull.isFullscreen) {
+146             display.fullscreen(false);
+147           }
+148         };
+149       })(this);
+150     }
+151     this.trigger('fullscreen', true);
+152   }
+153 };
+154 
+155 /**
+156  * Toggle fullscreen.
+157  */
+158 minplayer.display.prototype.toggleFullScreen = function() {
+159   this.fullscreen(!this.isFullScreen());
+160 };
+161 
+162 /**
+163  * Checks to see if we are in fullscreen mode.
+164  *
+165  * @return {boolean} TRUE - fullscreen, FALSE - otherwise.
+166  */
+167 minplayer.display.prototype.isFullScreen = function() {
+168   return this.fullScreenElement().hasClass('fullscreen');
+169 };
+170 
+171 /**
+172  * Returns a scaled rectangle provided a ratio and the container rect.
+173  *
+174  * @param {number} ratio The width/height ratio of what is being scaled.
+175  * @param {object} rect The bounding rectangle for scaling.
+176  * @return {object} The Rectangle object of the scaled rectangle.
+177  */
+178 minplayer.display.prototype.getScaledRect = function(ratio, rect) {
+179   var scaledRect = {};
+180   scaledRect.x = rect.x ? rect.x : 0;
+181   scaledRect.y = rect.y ? rect.y : 0;
+182   scaledRect.width = rect.width ? rect.width : 0;
+183   scaledRect.height = rect.height ? rect.height : 0;
+184   if (ratio) {
+185     if ((rect.width / rect.height) > ratio) {
+186       scaledRect.height = rect.height;
+187       scaledRect.width = Math.floor(rect.height * ratio);
+188     }
+189     else {
+190       scaledRect.height = Math.floor(rect.width / ratio);
+191       scaledRect.width = rect.width;
+192     }
+193     scaledRect.x = Math.floor((rect.width - scaledRect.width) / 2);
+194     scaledRect.y = Math.floor((rect.height - scaledRect.height) / 2);
+195   }
+196   return scaledRect;
+197 };
+198 
+199 /**
+200  * Returns all the jQuery elements that this component uses.
+201  *
+202  * @return {object} An object which defines all the jQuery elements that
+203  * this component uses.
+204  */
+205 minplayer.display.prototype.getElements = function() {
+206   return {};
+207 };
+208 
+209 /**
+210  * Returns if this component is valid and exists within the DOM.
+211  *
+212  * @return {boolean} TRUE if the plugin display is valid.
+213  */
+214 minplayer.display.prototype.isValid = function() {
+215   return (this.display.length > 0);
+216 };
+217 
+218 /**
+219  * From https://github.com/sindresorhus/screenfull.js
+220  */
+221 /*global Element:true*/
+222 (function(window, document) {
+223   'use strict';
+224   var methods = (function() {
+225     var methodMap = [
+226       [
+227         'requestFullscreen',
+228         'exitFullscreen',
+229         'fullscreenchange',
+230         'fullscreen',
+231         'fullscreenElement'
+232       ],
+233       [
+234         'webkitRequestFullScreen',
+235         'webkitCancelFullScreen',
+236         'webkitfullscreenchange',
+237         'webkitIsFullScreen',
+238         'webkitCurrentFullScreenElement'
+239       ],
+240       [
+241         'mozRequestFullScreen',
+242         'mozCancelFullScreen',
+243         'mozfullscreenchange',
+244         'mozFullScreen',
+245         'mozFullScreenElement'
+246       ]
+247     ];
+248     for (var i = 0, l = methodMap.length; i < l; i++) {
+249       var val = methodMap[i];
+250       if (val[1] in document) {
+251         return val;
+252       }
+253     }
+254   })();
+255 
+256   if (!methods) {
+257     return window.screenfull = false;
+258   }
+259 
+260   var keyboardAllowed = 'ALLOW_KEYBOARD_INPUT' in Element;
+261 
+262   var screenfull = {
+263     init: function() {
+264       document.addEventListener(methods[2], function(e) {
+265         screenfull.isFullscreen = document[methods[3]];
+266         screenfull.element = document[methods[4]];
+267         screenfull.onchange(e);
+268       });
+269       return this;
+270     },
+271     isFullscreen: document[methods[3]],
+272     element: document[methods[4]],
+273     request: function(elem) {
+274       elem = elem || document.documentElement;
+275       elem[methods[0]](keyboardAllowed && Element.ALLOW_KEYBOARD_INPUT);
+276       // Work around Safari 5.1 bug: reports support for keyboard in fullscreen
+277       // even though it doesn't.
+278       if (!document.isFullscreen) {
+279         elem[methods[0]]();
+280       }
+281     },
+282     exit: function() {
+283       document[methods[1]]();
+284     },
+285     toggle: function(elem) {
+286       if (this.isFullscreen) {
+287         this.exit();
+288       } else {
+289         this.request(elem);
+290       }
+291     },
+292     onchange: function() {}
+293   };
+294 
+295   window.screenfull = screenfull.init();
+296 })(window, document);
+297 
\ No newline at end of file diff --git a/minplayer/doc/symbols/src/src_minplayer.file.js.html b/minplayer/doc/symbols/src/src_minplayer.file.js.html new file mode 100644 index 00000000..05ab45fd --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.file.js.html @@ -0,0 +1,175 @@ +
  1 /** The minplayer namespace. */
+  2 var minplayer = minplayer || {};
+  3 
+  4 /**
+  5  * @constructor
+  6  * @class A wrapper class used to provide all the data necessary to control an
+  7  * individual file within this media player.
+  8  *
+  9  * @param {object} file A media file object with minimal required information.
+ 10  */
+ 11 minplayer.file = function(file) {
+ 12   this.duration = file.duration || 0;
+ 13   this.bytesTotal = file.bytesTotal || 0;
+ 14   this.quality = file.quality || 0;
+ 15   this.stream = file.stream || '';
+ 16   this.path = file.path || '';
+ 17   this.codecs = file.codecs || '';
+ 18 
+ 19   // These should be provided, but just in case...
+ 20   this.extension = file.extension || this.getFileExtension();
+ 21   this.mimetype = file.mimetype || file.filemime || this.getMimeType();
+ 22   this.type = file.type || this.getType();
+ 23 
+ 24   // Fail safe to try and guess the mimetype and media type.
+ 25   if (!this.type) {
+ 26     this.mimetype = this.getMimeType();
+ 27     this.type = this.getType();
+ 28   }
+ 29 
+ 30   // Get the player.
+ 31   this.player = file.player || this.getBestPlayer();
+ 32   this.priority = file.priority || this.getPriority();
+ 33   this.id = file.id || this.getId();
+ 34 };
+ 35 
+ 36 /**
+ 37  * Returns the best player for the job.
+ 38  *
+ 39  * @return {string} The best player to play the media file.
+ 40  */
+ 41 minplayer.file.prototype.getBestPlayer = function() {
+ 42   var bestplayer = null, bestpriority = 0;
+ 43   jQuery.each(minplayer.players, (function(file) {
+ 44     return function(name, player) {
+ 45       var priority = player.getPriority();
+ 46       if (player.canPlay(file) && (priority > bestpriority)) {
+ 47         bestplayer = name;
+ 48         bestpriority = priority;
+ 49       }
+ 50     };
+ 51   })(this));
+ 52   return bestplayer;
+ 53 };
+ 54 
+ 55 /**
+ 56  * The priority of this file is determined by the priority of the best
+ 57  * player multiplied by the priority of the mimetype.
+ 58  *
+ 59  * @return {integer} The priority of the media file.
+ 60  */
+ 61 minplayer.file.prototype.getPriority = function() {
+ 62   var priority = 1;
+ 63   if (this.player) {
+ 64     priority = minplayer.players[this.player].getPriority();
+ 65   }
+ 66   switch (this.mimetype) {
+ 67     case 'video/x-webm':
+ 68     case 'video/webm':
+ 69     case 'application/octet-stream':
+ 70       return priority * 10;
+ 71     case 'video/mp4':
+ 72     case 'audio/mp4':
+ 73     case 'audio/mpeg':
+ 74       return priority * 9;
+ 75     case 'video/ogg':
+ 76     case 'audio/ogg':
+ 77     case 'video/quicktime':
+ 78       return priority * 8;
+ 79     default:
+ 80       return priority * 5;
+ 81   }
+ 82 };
+ 83 
+ 84 /**
+ 85  * Returns the file extension of the file path.
+ 86  *
+ 87  * @return {string} The file extension.
+ 88  */
+ 89 minplayer.file.prototype.getFileExtension = function() {
+ 90   return this.path.substring(this.path.lastIndexOf('.') + 1).toLowerCase();
+ 91 };
+ 92 
+ 93 /**
+ 94  * Returns the proper mimetype based off of the extension.
+ 95  *
+ 96  * @return {string} The mimetype of the file based off of extension.
+ 97  */
+ 98 minplayer.file.prototype.getMimeType = function() {
+ 99   switch (this.extension) {
+100     case 'mp4': case 'm4v': case 'flv': case 'f4v':
+101       return 'video/mp4';
+102     case'webm':
+103       return 'video/webm';
+104     case 'ogg': case 'ogv':
+105       return 'video/ogg';
+106     case '3g2':
+107       return 'video/3gpp2';
+108     case '3gpp':
+109     case '3gp':
+110       return 'video/3gpp';
+111     case 'mov':
+112       return 'video/quicktime';
+113     case'swf':
+114       return 'application/x-shockwave-flash';
+115     case 'oga':
+116       return 'audio/ogg';
+117     case 'mp3':
+118       return 'audio/mpeg';
+119     case 'm4a': case 'f4a':
+120       return 'audio/mp4';
+121     case 'aac':
+122       return 'audio/aac';
+123     case 'wav':
+124       return 'audio/vnd.wave';
+125     case 'wma':
+126       return 'audio/x-ms-wma';
+127     default:
+128       return 'unknown';
+129   }
+130 };
+131 
+132 /**
+133  * The type of media this is: video or audio.
+134  *
+135  * @return {string} "video" or "audio" based on what the type of media this
+136  * is.
+137  */
+138 minplayer.file.prototype.getType = function() {
+139   switch (this.mimetype) {
+140     case 'video/mp4':
+141     case 'video/webm':
+142     case 'application/octet-stream':
+143     case 'video/x-webm':
+144     case 'video/ogg':
+145     case 'video/3gpp2':
+146     case 'video/3gpp':
+147     case 'video/quicktime':
+148       return 'video';
+149     case 'audio/mp3':
+150     case 'audio/mp4':
+151     case 'audio/ogg':
+152     case 'audio/mpeg':
+153       return 'audio';
+154     default:
+155       return '';
+156   }
+157 };
+158 
+159 /**
+160  * Returns the ID for this media file.
+161  *
+162  * @return {string} The id for this media file which is provided by the player.
+163  */
+164 minplayer.file.prototype.getId = function() {
+165   var player = minplayer.players[this.player];
+166   return (player && player.getMediaId) ? player.getMediaId(this) : '';
+167 };
+168 
\ No newline at end of file diff --git a/minplayer/doc/symbols/src/src_minplayer.flags.js.html b/minplayer/doc/symbols/src/src_minplayer.flags.js.html new file mode 100644 index 00000000..22c13e3a --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.flags.js.html @@ -0,0 +1,79 @@ +
  1 /** The minplayer namespace. */
+  2 var minplayer = minplayer || {};
+  3 
+  4 /**
+  5  * @constructor
+  6  * @class This is a class used to keep track of flag states
+  7  * which is used to control the busy cursor, big play button, among other
+  8  * items in which multiple components can have an interest in hiding or
+  9  * showing a single element on the screen.
+ 10  *
+ 11  * <p>
+ 12  * <strong>Usage:</strong>
+ 13  * <pre><code>
+ 14  *   // Declare a flags variable.
+ 15  *   var flags = new minplayer.flags();
+ 16  *
+ 17  *   // Set the flag based on two components interested in the flag.
+ 18  *   flags.setFlag("component1", true);
+ 19  *   flags.setFlag("component2", true);
+ 20  *
+ 21  *   // Print out the value of the flags. ( Prints 3 )
+ 22  *   console.log(flags.flags);
+ 23  *
+ 24  *   // Now unset a single components flag.
+ 25  *   flags.setFlag("component1", false);
+ 26  *
+ 27  *   // Print out the value of the flags.
+ 28  *   console.log(flags.flags);
+ 29  *
+ 30  *   // Unset the other components flag.
+ 31  *   flags.setFlag("component2", false);
+ 32  *
+ 33  *   // Print out the value of the flags.
+ 34  *   console.log(flags.flags);
+ 35  * </code></pre>
+ 36  * </p>
+ 37  */
+ 38 minplayer.flags = function() {
+ 39 
+ 40   /** The flag. */
+ 41   this.flag = 0;
+ 42 
+ 43   /** Id map to reference id with the flag index. */
+ 44   this.ids = {};
+ 45 
+ 46   /** The number of flags. */
+ 47   this.numFlags = 0;
+ 48 };
+ 49 
+ 50 /**
+ 51  * Sets a flag based on boolean logic operators.
+ 52  *
+ 53  * @param {string} id The id of the controller interested in this flag.
+ 54  * @param {boolean} value The value of this flag ( true or false ).
+ 55  */
+ 56 minplayer.flags.prototype.setFlag = function(id, value) {
+ 57 
+ 58   // Define this id if it isn't present.
+ 59   if (!this.ids.hasOwnProperty(id)) {
+ 60     this.ids[id] = this.numFlags;
+ 61     this.numFlags++;
+ 62   }
+ 63 
+ 64   // Use binary operations to keep track of the flag state
+ 65   if (value) {
+ 66     this.flag |= (1 << this.ids[id]);
+ 67   }
+ 68   else {
+ 69     this.flag &= ~(1 << this.ids[id]);
+ 70   }
+ 71 };
+ 72 
\ No newline at end of file diff --git a/minplayer/doc/symbols/src/src_minplayer.image.js.html b/minplayer/doc/symbols/src/src_minplayer.image.js.html new file mode 100644 index 00000000..1af20e8c --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.image.js.html @@ -0,0 +1,152 @@ +
  1 /** The minplayer namespace. */
+  2 var minplayer = minplayer || {};
+  3 
+  4 /**
+  5  * @constructor
+  6  * @class A class to easily handle images.
+  7  * @param {object} context The jQuery context.
+  8  * @param {object} options This components options.
+  9  */
+ 10 minplayer.image = function(context, options) {
+ 11 
+ 12   // Determine if the image is loaded.
+ 13   this.loaded = false;
+ 14 
+ 15   // The image loader.
+ 16   this.loader = null;
+ 17 
+ 18   // The ratio of the image.
+ 19   this.ratio = 0;
+ 20 
+ 21   // The image element.
+ 22   this.img = null;
+ 23 
+ 24   // Derive from display
+ 25   minplayer.display.call(this, 'image', context, options);
+ 26 };
+ 27 
+ 28 /** Derive from minplayer.display. */
+ 29 minplayer.image.prototype = new minplayer.display();
+ 30 
+ 31 /** Reset the constructor. */
+ 32 minplayer.image.prototype.constructor = minplayer.image;
+ 33 
+ 34 /**
+ 35  * @see minplayer.plugin.construct
+ 36  */
+ 37 minplayer.image.prototype.construct = function() {
+ 38 
+ 39   // Say we need to resize.
+ 40   this.allowResize = true;
+ 41 
+ 42   // Call the media display constructor.
+ 43   minplayer.display.prototype.construct.call(this);
+ 44 
+ 45   // Set the container to not show any overflow...
+ 46   this.display.css('overflow', 'hidden');
+ 47 
+ 48   /** The loader for the image. */
+ 49   this.loader = new Image();
+ 50 
+ 51   /** Register for when the image is loaded within the loader. */
+ 52   this.loader.onload = (function(image) {
+ 53     return function() {
+ 54       image.loaded = true;
+ 55       image.ratio = (image.loader.width / image.loader.height);
+ 56       image.resize();
+ 57       image.trigger('loaded');
+ 58     };
+ 59   })(this);
+ 60 
+ 61   // We are now ready.
+ 62   this.ready();
+ 63 };
+ 64 
+ 65 /**
+ 66  * Loads an image.
+ 67  *
+ 68  * @param {string} src The source of the image to load.
+ 69  */
+ 70 minplayer.image.prototype.load = function(src) {
+ 71 
+ 72   // First clear the previous image.
+ 73   this.clear(function() {
+ 74 
+ 75     // Create the new image, and append to the display.
+ 76     this.display.empty();
+ 77     this.img = jQuery(document.createElement('img')).attr({src: ''}).hide();
+ 78     this.display.append(this.img);
+ 79     this.loader.src = src;
+ 80   });
+ 81 };
+ 82 
+ 83 /**
+ 84  * Clears an image.
+ 85  *
+ 86  * @param {function} callback Called when the image is done clearing.
+ 87  */
+ 88 minplayer.image.prototype.clear = function(callback) {
+ 89   this.loaded = false;
+ 90   if (this.img) {
+ 91     this.img.fadeOut((function(image) {
+ 92       return function() {
+ 93         image.img.attr('src', '');
+ 94         image.loader.src = '';
+ 95         $(this).remove();
+ 96         callback.call(image);
+ 97       };
+ 98     })(this));
+ 99   }
+100   else {
+101     callback.call(this);
+102   }
+103 };
+104 
+105 /**
+106  * Resize the image provided a width and height or nothing.
+107  *
+108  * @param {integer} width (optional) The width of the container.
+109  * @param {integer} height (optional) The height of the container.
+110  */
+111 minplayer.image.prototype.resize = function(width, height) {
+112   width = width || this.display.width();
+113   height = height || this.display.height();
+114   if (width && height && this.loaded) {
+115 
+116     // Get the scaled rectangle.
+117     var rect = this.getScaledRect(this.ratio, {
+118       width: width,
+119       height: height
+120     });
+121 
+122     // Now set this image to the new size.
+123     if (this.img) {
+124       this.img.attr('src', this.loader.src).css({
+125         marginLeft: rect.x,
+126         marginTop: rect.y,
+127         width: rect.width,
+128         height: rect.height
+129       });
+130     }
+131 
+132     // Show the container.
+133     this.img.fadeIn();
+134   }
+135 };
+136 
+137 /**
+138  * @see minplayer.display#onResize
+139  */
+140 minplayer.image.prototype.onResize = function() {
+141 
+142   // Resize the image to fit.
+143   this.resize();
+144 };
+145 
\ No newline at end of file diff --git a/minplayer/doc/symbols/src/src_minplayer.js.html b/minplayer/doc/symbols/src/src_minplayer.js.html new file mode 100644 index 00000000..882363fd --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.js.html @@ -0,0 +1,360 @@ +
  1 // Add a way to instanciate using jQuery prototype.
+  2 if (!jQuery.fn.minplayer) {
+  3 
+  4   /**
+  5    * @constructor
+  6    *
+  7    * Define a jQuery minplayer prototype.
+  8    *
+  9    * @param {object} options The options for this jQuery prototype.
+ 10    * @return {Array} jQuery object.
+ 11    */
+ 12   jQuery.fn.minplayer = function(options) {
+ 13     return jQuery(this).each(function() {
+ 14       options = options || {};
+ 15       options.id = options.id || $(this).attr('id') || Math.random();
+ 16       if (!minplayer.plugins[options.id]) {
+ 17         options.template = options.template || 'default';
+ 18         if (minplayer[options.template]) {
+ 19           new minplayer[options.template](jQuery(this), options);
+ 20         }
+ 21         else {
+ 22           new minplayer(jQuery(this), options);
+ 23         }
+ 24       }
+ 25     });
+ 26   };
+ 27 }
+ 28 
+ 29 /**
+ 30  * @constructor
+ 31  * @extends minplayer.display
+ 32  * @class The core media player class which governs the media player
+ 33  * functionality.
+ 34  *
+ 35  * <p><strong>Usage:</strong>
+ 36  * <pre><code>
+ 37  *
+ 38  *   // Create a media player.
+ 39  *   var player = jQuery("#player").minplayer({
+ 40  *
+ 41  *   });
+ 42  *
+ 43  * </code></pre>
+ 44  * </p>
+ 45  *
+ 46  * @param {object} context The jQuery context.
+ 47  * @param {object} options This components options.
+ 48  */
+ 49 minplayer = jQuery.extend(function(context, options) {
+ 50 
+ 51   // Derive from display
+ 52   minplayer.display.call(this, 'player', context, options);
+ 53 }, minplayer);
+ 54 
+ 55 /** Derive from minplayer.display. */
+ 56 minplayer.prototype = new minplayer.display();
+ 57 
+ 58 /** Reset the constructor. */
+ 59 minplayer.prototype.constructor = minplayer;
+ 60 
+ 61 /**
+ 62  * Define a way to debug.
+ 63  */
+ 64 minplayer.console = console || {log: function(data) {}};
+ 65 
+ 66 /**
+ 67  * @see minplayer.plugin.construct
+ 68  */
+ 69 minplayer.prototype.construct = function() {
+ 70 
+ 71   // Allow them to provide arguments based off of the DOM attributes.
+ 72   jQuery.each(this.context[0].attributes, (function(player) {
+ 73     return function(index, attr) {
+ 74       player.options[attr.name] = player.options[attr.name] || attr.value;
+ 75     };
+ 76   })(this));
+ 77 
+ 78   // Make sure we provide default options...
+ 79   this.options = jQuery.extend({
+ 80     id: 'player',
+ 81     build: false,
+ 82     wmode: 'transparent',
+ 83     preload: true,
+ 84     autoplay: false,
+ 85     loop: false,
+ 86     width: '100%',
+ 87     height: '350px',
+ 88     debug: false,
+ 89     volume: 80,
+ 90     files: [],
+ 91     file: '',
+ 92     preview: '',
+ 93     attributes: {}
+ 94   }, this.options);
+ 95 
+ 96   // Call the minplayer display constructor.
+ 97   minplayer.display.prototype.construct.call(this);
+ 98 
+ 99   /** The controller for this player. */
+100   this.controller = this.create('controller');
+101 
+102   /** The play loader for this player. */
+103   this.playLoader = this.create('playLoader');
+104 
+105   /** Variable to store the current media player. */
+106   this.currentPlayer = 'html5';
+107 
+108   // Add key events to the window.
+109   this.addKeyEvents();
+110 
+111   // Now load these files.
+112   this.load(this.getFiles());
+113 
+114   // Add the player events.
+115   this.addEvents();
+116 
+117   // The player is ready.
+118   this.ready();
+119 };
+120 
+121 /**
+122  * We need to bind to events we are interested in.
+123  */
+124 minplayer.prototype.addEvents = function() {
+125   minplayer.get.call(this, this.options.id, null, (function(player) {
+126     return function(plugin) {
+127 
+128       // Bind to the error event.
+129       plugin.bind('error', function(event, data) {
+130 
+131         // If an error occurs within the html5 media player, then try
+132         // to fall back to the flash player.
+133         if (player.currentPlayer == 'html5') {
+134           player.options.file.player = 'minplayer';
+135           player.loadPlayer();
+136         }
+137         else {
+138           player.error(data);
+139         }
+140       });
+141 
+142       // Bind to the fullscreen event.
+143       plugin.bind('fullscreen', function(event, data) {
+144         player.resize();
+145       });
+146     };
+147   })(this));
+148 };
+149 
+150 /**
+151  * Sets an error on the player.
+152  *
+153  * @param {string} error The error to display on the player.
+154  */
+155 minplayer.prototype.error = function(error) {
+156   error = error || '';
+157   if (this.elements.error) {
+158 
+159     // Set the error text.
+160     this.elements.error.text(error);
+161     if (error) {
+162       this.elements.error.show();
+163     }
+164     else {
+165       this.elements.error.hide();
+166     }
+167   }
+168 };
+169 
+170 /**
+171  * Adds key events to the player.
+172  */
+173 minplayer.prototype.addKeyEvents = function() {
+174   jQuery(document).bind('keydown', (function(player) {
+175     return function(event) {
+176       switch (event.keyCode) {
+177         case 113: // ESC
+178         case 27:  // Q
+179           if (player.isFullScreen()) {
+180             player.fullscreen(false);
+181           }
+182           break;
+183       }
+184     };
+185   })(this));
+186 };
+187 
+188 /**
+189  * Returns all the media files available for this player.
+190  *
+191  * @return {array} All the media files for this player.
+192  */
+193 minplayer.prototype.getFiles = function() {
+194   var files = [];
+195   var mediaSrc = null;
+196 
+197   // Get the files involved...
+198   if (this.elements.media) {
+199     mediaSrc = this.elements.media.attr('src');
+200     if (mediaSrc) {
+201       files.push({'path': mediaSrc});
+202     }
+203     jQuery('source', this.elements.media).each(function() {
+204       files.push({
+205         'path': jQuery(this).attr('src'),
+206         'mimetype': jQuery(this).attr('type'),
+207         'codecs': jQuery(this).attr('codecs')
+208       });
+209     });
+210   }
+211 
+212   return files;
+213 };
+214 
+215 /**
+216  * Returns the full media player object.
+217  * @param {array} files An array of files to chose from.
+218  * @return {object} The best media file to play in the current browser.
+219  */
+220 minplayer.prototype.getMediaFile = function(files) {
+221 
+222   // If there are no files then return null.
+223   if (!files) {
+224     return null;
+225   }
+226 
+227   // If the file is a single string, then return the file object.
+228   if (typeof files === 'string') {
+229     return new minplayer.file({'path': files});
+230   }
+231 
+232   // If the file is already a file object then just return.
+233   if (files.path || files.id) {
+234     return new minplayer.file(files);
+235   }
+236 
+237   // Add the files and get the best player to play.
+238   var i = files.length, bestPriority = 0, mFile = null, file = null;
+239   while (i--) {
+240     file = files[i];
+241 
+242     // Get the minplayer file object.
+243     if (typeof file === 'string') {
+244       file = new minplayer.file({'path': file});
+245     }
+246     else {
+247       file = new minplayer.file(file);
+248     }
+249 
+250     // Determine the best file for this browser.
+251     if (file.priority > bestPriority) {
+252       mFile = file;
+253     }
+254   }
+255 
+256   // Return the best minplayer file.
+257   return mFile;
+258 };
+259 
+260 /**
+261  * Loads a media player based on the current file.
+262  */
+263 minplayer.prototype.loadPlayer = function() {
+264 
+265   // Do nothing if there isn't a file.
+266   if (!this.options.file) {
+267     this.error('No media found.');
+268     return;
+269   }
+270 
+271   if (!this.options.file.player) {
+272     this.error('Cannot play media: ' + this.options.file.mimetype);
+273     return;
+274   }
+275 
+276   // Reset the error.
+277   this.error();
+278 
+279   // Only destroy if the current player is different than the new player.
+280   var player = this.options.file.player.toString();
+281 
+282   // If there isn't media or if the players are different.
+283   if (!this.media || (player !== this.currentPlayer)) {
+284 
+285     // Set the current media player.
+286     this.currentPlayer = player;
+287 
+288     // Do nothing if we don't have a display.
+289     if (!this.elements.display) {
+290       this.error('No media display found.');
+291       return;
+292     }
+293 
+294     // Destroy the current media.
+295     var queue = {};
+296     if (this.media) {
+297       queue = this.media.queue;
+298       this.media.destroy();
+299     }
+300 
+301     // Get the class name and create the new player.
+302     pClass = minplayer.players[this.options.file.player];
+303 
+304     // Create the new media player.
+305     this.options.mediaelement = this.elements.media;
+306     this.media = new pClass(this.elements.display, this.options, queue);
+307 
+308     // Now get the media when it is ready.
+309     this.get('media', (function(player) {
+310       return function(media) {
+311 
+312         // Load the media.
+313         media.load(player.options.file);
+314       };
+315     })(this));
+316   }
+317   // If the media object already exists...
+318   else if (this.media) {
+319 
+320     // Now load the different media file.
+321     this.media.load(this.options.file);
+322   }
+323 };
+324 
+325 /**
+326  * Load a set of files or a single file for the media player.
+327  *
+328  * @param {array} files An array of files to chose from to load.
+329  */
+330 minplayer.prototype.load = function(files) {
+331 
+332   // Set the id and class.
+333   var id = '', pClass = '';
+334 
+335   // If no file was provided, then get it.
+336   this.options.files = files || this.options.files;
+337   this.options.file = this.getMediaFile(this.options.files);
+338 
+339   // Now load the player.
+340   this.loadPlayer();
+341 };
+342 
+343 /**
+344  * Called when the player is resized.
+345  */
+346 minplayer.prototype.resize = function() {
+347 
+348   // Call onRezie for each plugin.
+349   this.get(function(plugin) {
+350     plugin.onResize();
+351   });
+352 };
+353 
\ No newline at end of file diff --git a/minplayer/doc/symbols/src/src_minplayer.playLoader.base.js.html b/minplayer/doc/symbols/src/src_minplayer.playLoader.base.js.html new file mode 100644 index 00000000..f65cb3dd --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.playLoader.base.js.html @@ -0,0 +1,190 @@ +
  1 /** The minplayer namespace. */
+  2 var minplayer = minplayer || {};
+  3 
+  4 /** Define the playLoader object. */
+  5 minplayer.playLoader = minplayer.playLoader || {};
+  6 
+  7 /**
+  8  * @constructor
+  9  * @extends minplayer.display
+ 10  * @class The play loader base class, which is used to control the busy
+ 11  * cursor, big play button, and the opaque background which shows when the
+ 12  * player is paused.
+ 13  *
+ 14  * @param {object} context The jQuery context.
+ 15  * @param {object} options This components options.
+ 16  */
+ 17 minplayer.playLoader.base = function(context, options) {
+ 18 
+ 19   // Define the flags that control the busy cursor.
+ 20   this.busy = new minplayer.flags();
+ 21 
+ 22   // Define the flags that control the big play button.
+ 23   this.bigPlay = new minplayer.flags();
+ 24 
+ 25   /** The preview image. */
+ 26   this.preview = null;
+ 27 
+ 28   // Derive from display
+ 29   minplayer.display.call(this, 'playLoader', context, options);
+ 30 };
+ 31 
+ 32 /** Derive from minplayer.display. */
+ 33 minplayer.playLoader.base.prototype = new minplayer.display();
+ 34 
+ 35 /** Reset the constructor. */
+ 36 minplayer.playLoader.base.prototype.constructor = minplayer.playLoader.base;
+ 37 
+ 38 /**
+ 39  * The constructor.
+ 40  */
+ 41 minplayer.playLoader.base.prototype.construct = function() {
+ 42 
+ 43   // Call the media display constructor.
+ 44   minplayer.display.prototype.construct.call(this);
+ 45 
+ 46   // Get the media plugin.
+ 47   this.get('media', function(media) {
+ 48 
+ 49     // Only bind if this player does not have its own play loader.
+ 50     if (!media.hasPlayLoader()) {
+ 51 
+ 52       // Load the preview image.
+ 53       this.loadPreview();
+ 54 
+ 55       // Trigger a play event when someone clicks on the controller.
+ 56       if (this.elements.bigPlay) {
+ 57         this.elements.bigPlay.unbind().bind('click', function(event) {
+ 58           event.preventDefault();
+ 59           jQuery(this).hide();
+ 60           media.play();
+ 61         });
+ 62       }
+ 63 
+ 64       // Bind to the player events to control the play loader.
+ 65       media.unbind('loadstart').bind('loadstart', {obj: this}, function(event) {
+ 66         event.data.obj.busy.setFlag('media', true);
+ 67         event.data.obj.bigPlay.setFlag('media', true);
+ 68         if (event.data.obj.preview) {
+ 69           event.data.obj.elements.preview.show();
+ 70         }
+ 71         event.data.obj.checkVisibility();
+ 72       });
+ 73       media.bind('waiting', {obj: this}, function(event) {
+ 74         event.data.obj.busy.setFlag('media', true);
+ 75         event.data.obj.checkVisibility();
+ 76       });
+ 77       media.bind('loadeddata', {obj: this}, function(event) {
+ 78         event.data.obj.busy.setFlag('media', false);
+ 79         event.data.obj.checkVisibility();
+ 80       });
+ 81       media.bind('playing', {obj: this}, function(event) {
+ 82         event.data.obj.busy.setFlag('media', false);
+ 83         event.data.obj.bigPlay.setFlag('media', false);
+ 84         if (event.data.obj.preview) {
+ 85           event.data.obj.elements.preview.hide();
+ 86         }
+ 87         event.data.obj.checkVisibility();
+ 88       });
+ 89       media.bind('pause', {obj: this}, function(event) {
+ 90         event.data.obj.bigPlay.setFlag('media', true);
+ 91         event.data.obj.checkVisibility();
+ 92       });
+ 93     }
+ 94     else {
+ 95 
+ 96       // Hide the busy cursor.
+ 97       if (this.elements.busy) {
+ 98         this.elements.busy.unbind().hide();
+ 99       }
+100 
+101       // Hide the big play button.
+102       if (this.elements.bigPlay) {
+103         this.elements.bigPlay.unbind().hide();
+104       }
+105 
+106       // Hide the display.
+107       this.display.unbind().hide();
+108     }
+109   });
+110 
+111   // We are now ready.
+112   this.ready();
+113 };
+114 
+115 /**
+116  * Loads the preview image.
+117  */
+118 minplayer.playLoader.base.prototype.loadPreview = function() {
+119 
+120   // If the preview element exists.
+121   if (this.elements.preview) {
+122 
+123     // Get the poster image.
+124     if (!this.options.preview) {
+125       this.options.preview = this.elements.media.attr('poster');
+126     }
+127 
+128     // Reset the media's poster image.
+129     this.elements.media.attr('poster', '');
+130 
+131     // If there is a preview to show...
+132     if (this.options.preview) {
+133 
+134       // Say that this has a preview.
+135       this.elements.preview.addClass('has-preview').show();
+136 
+137       // Create a new preview image.
+138       this.preview = new minplayer.image(this.elements.preview, this.options);
+139 
+140       // Create the image.
+141       this.preview.load(this.options.preview);
+142     }
+143     else {
+144 
+145       // Hide the preview.
+146       this.elements.preview.hide();
+147     }
+148   }
+149 };
+150 
+151 /**
+152  * Hide or show certain elements based on the state of the busy and big play
+153  * button.
+154  */
+155 minplayer.playLoader.base.prototype.checkVisibility = function() {
+156 
+157   // Hide or show the busy cursor based on the flags.
+158   if (this.busy.flag) {
+159     this.elements.busy.show();
+160   }
+161   else {
+162     this.elements.busy.hide();
+163   }
+164 
+165   // Hide or show the big play button based on the flags.
+166   if (this.bigPlay.flag) {
+167     this.elements.bigPlay.show();
+168   }
+169   else {
+170     this.elements.bigPlay.hide();
+171   }
+172 
+173   // Show the control either flag is set.
+174   if (this.bigPlay.flag || this.busy.flag) {
+175     this.display.show();
+176   }
+177 
+178   // Hide the whole control if both flags are 0.
+179   if (!this.bigPlay.flag && !this.busy.flag) {
+180     this.display.hide();
+181   }
+182 };
+183 
\ No newline at end of file diff --git a/minplayer/doc/symbols/src/src_minplayer.playLoader.js.html b/minplayer/doc/symbols/src/src_minplayer.playLoader.js.html new file mode 100644 index 00000000..512609f4 --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.playLoader.js.html @@ -0,0 +1,197 @@ +
  1 /** The minplayer namespace. */
+  2 var minplayer = minplayer || {};
+  3 
+  4 /**
+  5  * @constructor
+  6  * @extends minplayer.display
+  7  * @class The play loader base class, which is used to control the busy
+  8  * cursor, big play button, and the opaque background which shows when the
+  9  * player is paused.
+ 10  *
+ 11  * @param {object} context The jQuery context.
+ 12  * @param {object} options This components options.
+ 13  */
+ 14 minplayer.playLoader = function(context, options) {
+ 15 
+ 16   // Define the flags that control the busy cursor.
+ 17   this.busy = new minplayer.flags();
+ 18 
+ 19   // Define the flags that control the big play button.
+ 20   this.bigPlay = new minplayer.flags();
+ 21 
+ 22   /** The preview image. */
+ 23   this.preview = null;
+ 24 
+ 25   // Derive from display
+ 26   minplayer.display.call(this, 'playLoader', context, options);
+ 27 };
+ 28 
+ 29 /** Derive from minplayer.display. */
+ 30 minplayer.playLoader.prototype = new minplayer.display();
+ 31 
+ 32 /** Reset the constructor. */
+ 33 minplayer.playLoader.prototype.constructor = minplayer.playLoader;
+ 34 
+ 35 /**
+ 36  * The constructor.
+ 37  */
+ 38 minplayer.playLoader.prototype.construct = function() {
+ 39 
+ 40   // Call the media display constructor.
+ 41   minplayer.display.prototype.construct.call(this);
+ 42 
+ 43   // Get the media plugin.
+ 44   this.get('media', function(media) {
+ 45 
+ 46     // Only bind if this player does not have its own play loader.
+ 47     if (!media.hasPlayLoader()) {
+ 48 
+ 49       // Get the poster image.
+ 50       if (!this.options.preview) {
+ 51         this.options.preview = media.elements.media.attr('poster');
+ 52       }
+ 53 
+ 54       // Reset the media's poster image.
+ 55       media.elements.media.attr('poster', '');
+ 56 
+ 57       // Load the preview image.
+ 58       this.loadPreview();
+ 59 
+ 60       // Trigger a play event when someone clicks on the controller.
+ 61       if (this.elements.bigPlay) {
+ 62         this.elements.bigPlay.unbind().bind('click', function(event) {
+ 63           event.preventDefault();
+ 64           jQuery(this).hide();
+ 65           media.play();
+ 66         });
+ 67       }
+ 68 
+ 69       // Bind to the player events to control the play loader.
+ 70       media.unbind('loadstart').bind('loadstart', (function(playLoader) {
+ 71         return function(event) {
+ 72           playLoader.busy.setFlag('media', true);
+ 73           playLoader.bigPlay.setFlag('media', true);
+ 74           if (playLoader.preview) {
+ 75             playLoader.elements.preview.show();
+ 76           }
+ 77           playLoader.checkVisibility();
+ 78         };
+ 79       })(this));
+ 80       media.bind('waiting', (function(playLoader) {
+ 81         return function(event) {
+ 82           playLoader.busy.setFlag('media', true);
+ 83           playLoader.checkVisibility();
+ 84         };
+ 85       })(this));
+ 86       media.bind('loadeddata', (function(playLoader) {
+ 87         return function(event) {
+ 88           playLoader.busy.setFlag('media', false);
+ 89           playLoader.checkVisibility();
+ 90         };
+ 91       })(this));
+ 92       media.bind('playing', (function(playLoader) {
+ 93         return function(event) {
+ 94           playLoader.busy.setFlag('media', false);
+ 95           playLoader.bigPlay.setFlag('media', false);
+ 96           if (playLoader.preview) {
+ 97             playLoader.elements.preview.hide();
+ 98           }
+ 99           playLoader.checkVisibility();
+100         };
+101       })(this));
+102       media.bind('pause', (function(playLoader) {
+103         return function(event) {
+104           playLoader.bigPlay.setFlag('media', true);
+105           playLoader.checkVisibility();
+106         };
+107       })(this));
+108     }
+109     else {
+110 
+111       // Hide the busy cursor.
+112       if (this.elements.busy) {
+113         this.elements.busy.unbind().hide();
+114       }
+115 
+116       // Hide the big play button.
+117       if (this.elements.bigPlay) {
+118         this.elements.bigPlay.unbind().hide();
+119       }
+120 
+121       // Hide the display.
+122       this.display.unbind().hide();
+123     }
+124   });
+125 
+126   // We are now ready.
+127   this.ready();
+128 };
+129 
+130 /**
+131  * Loads the preview image.
+132  */
+133 minplayer.playLoader.prototype.loadPreview = function() {
+134 
+135   // If the preview element exists.
+136   if (this.elements.preview) {
+137 
+138     // If there is a preview to show...
+139     if (this.options.preview) {
+140 
+141       // Say that this has a preview.
+142       this.elements.preview.addClass('has-preview').show();
+143 
+144       // Create a new preview image.
+145       this.preview = new minplayer.image(this.elements.preview, this.options);
+146 
+147       // Create the image.
+148       this.preview.load(this.options.preview);
+149     }
+150     else {
+151 
+152       // Hide the preview.
+153       this.elements.preview.hide();
+154     }
+155   }
+156 };
+157 
+158 /**
+159  * Hide or show certain elements based on the state of the busy and big play
+160  * button.
+161  */
+162 minplayer.playLoader.prototype.checkVisibility = function() {
+163 
+164   // Hide or show the busy cursor based on the flags.
+165   if (this.busy.flag) {
+166     this.elements.busy.show();
+167   }
+168   else {
+169     this.elements.busy.hide();
+170   }
+171 
+172   // Hide or show the big play button based on the flags.
+173   if (this.bigPlay.flag) {
+174     this.elements.bigPlay.show();
+175   }
+176   else {
+177     this.elements.bigPlay.hide();
+178   }
+179 
+180   // Show the control either flag is set.
+181   if (this.bigPlay.flag || this.busy.flag) {
+182     this.display.show();
+183   }
+184 
+185   // Hide the whole control if both flags are 0.
+186   if (!this.bigPlay.flag && !this.busy.flag) {
+187     this.display.hide();
+188   }
+189 };
+190 
\ No newline at end of file diff --git a/minplayer/doc/symbols/src/src_minplayer.players.base.js.html b/minplayer/doc/symbols/src/src_minplayer.players.base.js.html new file mode 100644 index 00000000..fef984df --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.players.base.js.html @@ -0,0 +1,599 @@ +
  1 /** The minplayer namespace. */
+  2 var minplayer = minplayer || {};
+  3 
+  4 /** All the media player implementations */
+  5 minplayer.players = minplayer.players || {};
+  6 
+  7 /**
+  8  * @constructor
+  9  * @extends minplayer.display
+ 10  * @class The base media player class where all media players derive from.
+ 11  *
+ 12  * @param {object} context The jQuery context.
+ 13  * @param {object} options This components options.
+ 14  * @param {object} queue The event queue to pass events around.
+ 15  */
+ 16 minplayer.players.base = function(context, options, queue) {
+ 17 
+ 18   // Derive from display
+ 19   minplayer.display.call(this, 'media', context, options, queue);
+ 20 };
+ 21 
+ 22 /** Derive from minplayer.display. */
+ 23 minplayer.players.base.prototype = new minplayer.display();
+ 24 
+ 25 /** Reset the constructor. */
+ 26 minplayer.players.base.prototype.constructor = minplayer.players.base;
+ 27 
+ 28 /**
+ 29  * @see minplayer.display.getElements
+ 30  * @this minplayer.players.base
+ 31  * @return {object} The elements for this display.
+ 32  */
+ 33 minplayer.players.base.prototype.getElements = function() {
+ 34   var elements = minplayer.display.prototype.getElements.call(this);
+ 35   return jQuery.extend(elements, {
+ 36     media: this.options.mediaelement
+ 37   });
+ 38 };
+ 39 
+ 40 /**
+ 41  * Get the priority of this media player.
+ 42  *
+ 43  * @return {number} The priority of this media player.
+ 44  */
+ 45 minplayer.players.base.getPriority = function() {
+ 46   return 0;
+ 47 };
+ 48 
+ 49 /**
+ 50  * Returns the ID for the media being played.
+ 51  *
+ 52  * @param {object} file A {@link minplayer.file} object.
+ 53  * @return {string} The ID for the provided media.
+ 54  */
+ 55 minplayer.players.base.getMediaId = function(file) {
+ 56   return '';
+ 57 };
+ 58 
+ 59 /**
+ 60  * Determine if we can play the media file.
+ 61  *
+ 62  * @param {object} file A {@link minplayer.file} object.
+ 63  * @return {boolean} If this player can play this media type.
+ 64  */
+ 65 minplayer.players.base.canPlay = function(file) {
+ 66   return false;
+ 67 };
+ 68 
+ 69 /**
+ 70  * @see minplayer.plugin.construct
+ 71  * @this minplayer.players.base
+ 72  */
+ 73 minplayer.players.base.prototype.construct = function() {
+ 74 
+ 75   // Call the media display constructor.
+ 76   minplayer.display.prototype.construct.call(this);
+ 77 
+ 78   // Clear the media player.
+ 79   this.clear();
+ 80 
+ 81   /** The currently loaded media file. */
+ 82   this.mediaFile = this.options.file;
+ 83 
+ 84   // Get the player display object.
+ 85   if (!this.playerFound()) {
+ 86 
+ 87     // Remove the media element if found
+ 88     if (this.elements.media) {
+ 89       this.elements.media.remove();
+ 90     }
+ 91 
+ 92     // Create a new media player element.
+ 93     this.elements.media = jQuery(this.create());
+ 94     this.display.html(this.elements.media);
+ 95   }
+ 96 
+ 97   // Get the player object...
+ 98   this.player = this.getPlayer();
+ 99 
+100   // Set the focus of the element based on if they click in or outside of it.
+101   jQuery(document).bind('click', (function(player) {
+102     return function(event) {
+103       if (jQuery(event.target).closest('#' + player.options.id).length == 0) {
+104         player.hasFocus = false;
+105       }
+106       else {
+107         player.hasFocus = true;
+108       }
+109     };
+110   })(this));
+111 
+112   // Bind to key events...
+113   jQuery(document).bind('keydown', (function(player) {
+114     return function(event) {
+115       if (player.hasFocus) {
+116         event.preventDefault();
+117         switch (event.keyCode) {
+118           case 32:  // SPACE
+119           case 179: // GOOGLE play/pause button.
+120             if (player.playing) {
+121               player.pause();
+122             }
+123             else {
+124               player.play();
+125             }
+126             break;
+127           case 38:  // UP
+128             player.setVolumeRelative(0.1);
+129             break;
+130           case 40:  // DOWN
+131             player.setVolumeRelative(-0.1);
+132             break;
+133           case 37:  // LEFT
+134           case 227: // GOOGLE TV REW
+135             player.seekRelative(-0.05);
+136             break;
+137           case 39:  // RIGHT
+138           case 228: // GOOGLE TV FW
+139             player.seekRelative(0.05);
+140             break;
+141         }
+142       }
+143     };
+144   })(this));
+145 };
+146 
+147 /**
+148  * @see minplayer.plugin.destroy.
+149  */
+150 minplayer.players.base.prototype.destroy = function() {
+151   minplayer.plugin.prototype.destroy.call(this);
+152   this.clear();
+153 };
+154 
+155 /**
+156  * Clears the media player.
+157  */
+158 minplayer.players.base.prototype.clear = function() {
+159 
+160   // Reset the ready flag.
+161   this.playerReady = false;
+162 
+163   // Reset the player.
+164   this.reset();
+165 
+166   // If the player exists, then unbind all events.
+167   if (this.player) {
+168     jQuery(this.player).unbind();
+169   }
+170 };
+171 
+172 /**
+173  * Resets all variables.
+174  */
+175 minplayer.players.base.prototype.reset = function() {
+176 
+177   // The duration of the player.
+178   this.duration = new minplayer.async();
+179 
+180   // The current play time of the player.
+181   this.currentTime = new minplayer.async();
+182 
+183   // The amount of bytes loaded in the player.
+184   this.bytesLoaded = new minplayer.async();
+185 
+186   // The total amount of bytes for the media.
+187   this.bytesTotal = new minplayer.async();
+188 
+189   // The bytes that the download started with.
+190   this.bytesStart = new minplayer.async();
+191 
+192   // The current volume of the player.
+193   this.volume = new minplayer.async();
+194 
+195   // Reset focus.
+196   this.hasFocus = false;
+197 
+198   // We are not playing.
+199   this.playing = false;
+200 
+201   // We are not loading.
+202   this.loading = false;
+203 
+204   // Tell everyone else we reset.
+205   this.trigger('pause');
+206   this.trigger('waiting');
+207   this.trigger('progress', {loaded: 0, total: 0, start: 0});
+208   this.trigger('timeupdate', {currentTime: 0, duration: 0});
+209 };
+210 
+211 /**
+212  * Called when the player is ready to recieve events and commands.
+213  */
+214 minplayer.players.base.prototype.onReady = function() {
+215 
+216   // Only continue if we are not already ready.
+217   if (this.playerReady) {
+218     return;
+219   }
+220 
+221   // Set the ready flag.
+222   this.playerReady = true;
+223 
+224   // Set the volume to the default.
+225   this.setVolume(this.options.volume / 100);
+226 
+227   // Setup the progress interval.
+228   this.loading = true;
+229 
+230   // Create a poll to get the progress.
+231   this.poll((function(player) {
+232     return function() {
+233 
+234       // Only do this if the play interval is set.
+235       if (player.loading) {
+236 
+237         // Get the bytes loaded asynchronously.
+238         player.getBytesLoaded(function(bytesLoaded) {
+239 
+240           // Get the bytes total asynchronously.
+241           player.getBytesTotal(function(bytesTotal) {
+242 
+243             // Trigger an event about the progress.
+244             if (bytesLoaded || bytesTotal) {
+245 
+246               // Get the bytes start, but don't require it.
+247               var bytesStart = 0;
+248               player.getBytesStart(function(val) {
+249                 bytesStart = val;
+250               });
+251 
+252               // Trigger a progress event.
+253               player.trigger('progress', {
+254                 loaded: bytesLoaded,
+255                 total: bytesTotal,
+256                 start: bytesStart
+257               });
+258 
+259               // Say we are not longer loading if they are equal.
+260               if (bytesLoaded >= bytesTotal) {
+261                 player.loading = false;
+262               }
+263             }
+264           });
+265         });
+266       }
+267 
+268       // Keep polling as long as its loading...
+269       return player.loading;
+270     };
+271   })(this), 1000);
+272 
+273   // We are now ready.
+274   this.ready();
+275 
+276   // Trigger that the load has started.
+277   this.trigger('loadstart');
+278 };
+279 
+280 /**
+281  * Should be called when the media is playing.
+282  */
+283 minplayer.players.base.prototype.onPlaying = function() {
+284 
+285   // Trigger an event that we are playing.
+286   this.trigger('playing');
+287 
+288   // Say that this player has focus.
+289   this.hasFocus = true;
+290 
+291   // Set the playInterval to true.
+292   this.playing = true;
+293 
+294   // Create a poll to get the timeupate.
+295   this.poll((function(player) {
+296     return function() {
+297 
+298       // Only do this if the play interval is set.
+299       if (player.playing) {
+300 
+301         // Get the current time asyncrhonously.
+302         player.getCurrentTime(function(currentTime) {
+303 
+304           // Get the duration asynchronously.
+305           player.getDuration(function(duration) {
+306 
+307             // Convert these to floats.
+308             currentTime = parseFloat(currentTime);
+309             duration = parseFloat(duration);
+310 
+311             // Trigger an event about the progress.
+312             if (currentTime || duration) {
+313 
+314               // Trigger an update event.
+315               player.trigger('timeupdate', {
+316                 currentTime: currentTime,
+317                 duration: duration
+318               });
+319             }
+320           });
+321         });
+322       }
+323 
+324       // Keep polling as long as it is playing.
+325       return player.playing;
+326     };
+327   })(this), 1000);
+328 };
+329 
+330 /**
+331  * Should be called when the media is paused.
+332  */
+333 minplayer.players.base.prototype.onPaused = function() {
+334 
+335   // Trigger an event that we are paused.
+336   this.trigger('pause');
+337 
+338   // Remove focus.
+339   this.hasFocus = false;
+340 
+341   // Say we are not playing.
+342   this.playing = false;
+343 };
+344 
+345 /**
+346  * Should be called when the media is complete.
+347  */
+348 minplayer.players.base.prototype.onComplete = function() {
+349   // Stop the intervals.
+350   this.playing = false;
+351   this.loading = false;
+352   this.hasFocus = false;
+353   this.trigger('ended');
+354 };
+355 
+356 /**
+357  * Should be called when the media is done loading.
+358  */
+359 minplayer.players.base.prototype.onLoaded = function() {
+360   this.trigger('loadeddata');
+361 };
+362 
+363 /**
+364  * Should be called when the player is waiting.
+365  */
+366 minplayer.players.base.prototype.onWaiting = function() {
+367   this.trigger('waiting');
+368 };
+369 
+370 /**
+371  * Called when an error occurs.
+372  *
+373  * @param {string} errorCode The error that was triggered.
+374  */
+375 minplayer.players.base.prototype.onError = function(errorCode) {
+376   this.hasFocus = false;
+377   this.trigger('error', errorCode);
+378 };
+379 
+380 /**
+381  * @see minplayer.players.base#isReady
+382  * @return {boolean} Checks to see if the Flash is ready.
+383  */
+384 minplayer.players.base.prototype.isReady = function() {
+385 
+386   // Return that the player is set and the ready flag is good.
+387   return (this.player && this.playerReady);
+388 };
+389 
+390 /**
+391  * Determines if the player should show the playloader.
+392  *
+393  * @return {bool} If this player implements its own playLoader.
+394  */
+395 minplayer.players.base.prototype.hasPlayLoader = function() {
+396   return false;
+397 };
+398 
+399 /**
+400  * Returns if the media player is already within the DOM.
+401  *
+402  * @return {boolean} TRUE - if the player is in the DOM, FALSE otherwise.
+403  */
+404 minplayer.players.base.prototype.playerFound = function() {
+405   return false;
+406 };
+407 
+408 /**
+409  * Creates the media player and inserts it in the DOM.
+410  *
+411  * @return {object} The media player entity.
+412  */
+413 minplayer.players.base.prototype.create = function() {
+414   this.reset();
+415   return null;
+416 };
+417 
+418 /**
+419  * Returns the media player object.
+420  *
+421  * @return {object} The media player object.
+422  */
+423 minplayer.players.base.prototype.getPlayer = function() {
+424   return this.player;
+425 };
+426 
+427 /**
+428  * Loads a new media player.
+429  *
+430  * @param {object} file A {@link minplayer.file} object.
+431  */
+432 minplayer.players.base.prototype.load = function(file) {
+433 
+434   // Store the media file for future lookup.
+435   var isString = (typeof this.mediaFile == 'string');
+436   var path = isString ? this.mediaFile : this.mediaFile.path;
+437   if (file && (file.path != path)) {
+438     this.reset();
+439     this.mediaFile = file;
+440   }
+441 };
+442 
+443 /**
+444  * Play the loaded media file.
+445  */
+446 minplayer.players.base.prototype.play = function() {
+447 };
+448 
+449 /**
+450  * Pause the loaded media file.
+451  */
+452 minplayer.players.base.prototype.pause = function() {
+453 };
+454 
+455 /**
+456  * Stop the loaded media file.
+457  */
+458 minplayer.players.base.prototype.stop = function() {
+459   this.playing = false;
+460   this.loading = false;
+461   this.hasFocus = false;
+462 };
+463 
+464 /**
+465  * Seeks to relative position.
+466  *
+467  * @param {number} pos Relative position.  -1 to 1 (percent), > 1 (seconds).
+468  */
+469 minplayer.players.base.prototype.seekRelative = function(pos) {
+470 
+471   // Get the current time asyncrhonously.
+472   this.getCurrentTime((function(player) {
+473     return function(currentTime) {
+474 
+475       // Get the duration asynchronously.
+476       player.getDuration(function(duration) {
+477 
+478         // Only do this if we have a duration.
+479         if (duration) {
+480 
+481           // Get the position.
+482           var seekPos = 0;
+483           if ((pos > -1) && (pos < 1)) {
+484             seekPos = (currentTime / duration) + parseFloat(pos);
+485           }
+486           else {
+487             seekPos = (currentTime + parseFloat(pos)) / duration;
+488           }
+489 
+490           // Set the seek value.
+491           player.seek(seekPos);
+492         }
+493       });
+494     };
+495   })(this));
+496 };
+497 
+498 /**
+499  * Seek the loaded media.
+500  *
+501  * @param {number} pos The position to seek the minplayer. 0 to 1.
+502  */
+503 minplayer.players.base.prototype.seek = function(pos) {
+504 };
+505 
+506 /**
+507  * Set the volume of the loaded minplayer.
+508  *
+509  * @param {number} vol -1 to 1 - The relative amount to increase or decrease.
+510  */
+511 minplayer.players.base.prototype.setVolumeRelative = function(vol) {
+512 
+513   // Get the volume
+514   this.getVolume((function(player) {
+515     return function(newVol) {
+516       newVol += parseFloat(vol);
+517       newVol = (newVol < 0) ? 0 : newVol;
+518       newVol = (newVol > 1) ? 1 : newVol;
+519       player.setVolume(newVol);
+520     };
+521   })(this));
+522 };
+523 
+524 /**
+525  * Set the volume of the loaded minplayer.
+526  *
+527  * @param {number} vol The volume to set the media. 0 to 1.
+528  */
+529 minplayer.players.base.prototype.setVolume = function(vol) {
+530   this.trigger('volumeupdate', vol);
+531 };
+532 
+533 /**
+534  * Get the volume from the loaded media.
+535  *
+536  * @param {function} callback Called when the volume is determined.
+537  * @return {number} The volume of the media; 0 to 1.
+538  */
+539 minplayer.players.base.prototype.getVolume = function(callback) {
+540   return this.volume.get(callback);
+541 };
+542 
+543 /**
+544  * Get the current time for the media being played.
+545  *
+546  * @param {function} callback Called when the time is determined.
+547  * @return {number} The volume of the media; 0 to 1.
+548  */
+549 minplayer.players.base.prototype.getCurrentTime = function(callback) {
+550   return this.currentTime.get(callback);
+551 };
+552 
+553 /**
+554  * Return the duration of the loaded media.
+555  *
+556  * @param {function} callback Called when the duration is determined.
+557  * @return {number} The duration of the loaded media.
+558  */
+559 minplayer.players.base.prototype.getDuration = function(callback) {
+560   return this.duration.get(callback);
+561 };
+562 
+563 /**
+564  * Return the start bytes for the loaded media.
+565  *
+566  * @param {function} callback Called when the start bytes is determined.
+567  * @return {int} The bytes that were started.
+568  */
+569 minplayer.players.base.prototype.getBytesStart = function(callback) {
+570   return this.bytesStart.get(callback);
+571 };
+572 
+573 /**
+574  * Return the bytes of media loaded.
+575  *
+576  * @param {function} callback Called when the bytes loaded is determined.
+577  * @return {int} The amount of bytes loaded.
+578  */
+579 minplayer.players.base.prototype.getBytesLoaded = function(callback) {
+580   return this.bytesLoaded.get(callback);
+581 };
+582 
+583 /**
+584  * Return the total amount of bytes.
+585  *
+586  * @param {function} callback Called when the bytes total is determined.
+587  * @return {int} The total amount of bytes for this media.
+588  */
+589 minplayer.players.base.prototype.getBytesTotal = function(callback) {
+590   return this.bytesTotal.get(callback);
+591 };
+592 
\ No newline at end of file diff --git a/minplayer/doc/symbols/src/src_minplayer.players.flash.js.html b/minplayer/doc/symbols/src/src_minplayer.players.flash.js.html new file mode 100644 index 00000000..a2b560b5 --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.players.flash.js.html @@ -0,0 +1,116 @@ +
  1 /** The minplayer namespace. */
+  2 var minplayer = minplayer || {};
+  3 
+  4 /** All the media player implementations */
+  5 minplayer.players = minplayer.players || {};
+  6 
+  7 /**
+  8  * @constructor
+  9  * @extends minplayer.display
+ 10  * @class The Flash media player class to control the flash fallback.
+ 11  *
+ 12  * @param {object} context The jQuery context.
+ 13  * @param {object} options This components options.
+ 14  * @param {object} queue The event queue to pass events around.
+ 15  */
+ 16 minplayer.players.flash = function(context, options, queue) {
+ 17 
+ 18   // Derive from players base.
+ 19   minplayer.players.base.call(this, context, options, queue);
+ 20 };
+ 21 
+ 22 /** Derive from minplayer.players.base. */
+ 23 minplayer.players.flash.prototype = new minplayer.players.base();
+ 24 
+ 25 /** Reset the constructor. */
+ 26 minplayer.players.flash.prototype.constructor = minplayer.players.flash;
+ 27 
+ 28 /**
+ 29  * @see minplayer.players.base#getPriority
+ 30  * @return {number} The priority of this media player.
+ 31  */
+ 32 minplayer.players.flash.getPriority = function() {
+ 33   return 0;
+ 34 };
+ 35 
+ 36 /**
+ 37  * @see minplayer.players.base#canPlay
+ 38  * @return {boolean} If this player can play this media type.
+ 39  */
+ 40 minplayer.players.flash.canPlay = function(file) {
+ 41   return false;
+ 42 };
+ 43 
+ 44 /**
+ 45  * API to return the Flash player code provided params.
+ 46  *
+ 47  * @param {object} params The params used to populate the Flash code.
+ 48  * @return {object} A Flash DOM element.
+ 49  */
+ 50 minplayer.players.flash.getFlash = function(params) {
+ 51   // Get the protocol.
+ 52   var protocol = window.location.protocol;
+ 53   if (protocol.charAt(protocol.length - 1) == ':') {
+ 54     protocol = protocol.substring(0, protocol.length - 1);
+ 55   }
+ 56 
+ 57   // Convert the flashvars object to a string...
+ 58   var flashVars = jQuery.param(params.flashvars);
+ 59 
+ 60   // Set the codebase.
+ 61   var codebase = protocol + '://fpdownload.macromedia.com';
+ 62   codebase += '/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0';
+ 63 
+ 64   // Get the HTML flash object string.
+ 65   var flash = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
+ 66   flash += 'codebase="' + codebase + '" ';
+ 67   flash += 'playerType="flash" ';
+ 68   flash += 'width="' + params.width + '" ';
+ 69   flash += 'height="' + params.height + '" ';
+ 70   flash += 'id="' + params.id + '" ';
+ 71   flash += 'name="' + params.id + '"> ';
+ 72   flash += '<param name="allowScriptAccess" value="always"></param>';
+ 73   flash += '<param name="allowfullscreen" value="true" />';
+ 74   flash += '<param name="movie" value="' + params.swf + '"></param>';
+ 75   flash += '<param name="wmode" value="' + params.wmode + '"></param>';
+ 76   flash += '<param name="quality" value="high"></param>';
+ 77   flash += '<param name="FlashVars" value="' + flashVars + '"></param>';
+ 78   flash += '<embed src="' + params.swf + '" ';
+ 79   flash += 'quality="high" ';
+ 80   flash += 'width="' + params.width + '" height="' + params.height + '" ';
+ 81   flash += 'id="' + params.id + '" name="' + params.id + '" ';
+ 82   flash += 'swLiveConnect="true" allowScriptAccess="always" ';
+ 83   flash += 'wmode="' + params.wmode + '"';
+ 84   flash += 'allowfullscreen="true" type="application/x-shockwave-flash" ';
+ 85   flash += 'FlashVars="' + flashVars + '" ';
+ 86   flash += 'pluginspage="' + protocol;
+ 87   flash += '://www.macromedia.com/go/getflashplayer" />';
+ 88   flash += '</object>';
+ 89   return flash;
+ 90 };
+ 91 
+ 92 /**
+ 93  * @see minplayer.players.base#playerFound
+ 94  * @return {boolean} TRUE - if the player is in the DOM, FALSE otherwise.
+ 95  */
+ 96 minplayer.players.flash.prototype.playerFound = function() {
+ 97   return (this.display.find('object[playerType="flash"]').length > 0);
+ 98 };
+ 99 
+100 /**
+101  * @see minplayer.players.base#getPlayer
+102  * @return {object} The media player object.
+103  */
+104 minplayer.players.flash.prototype.getPlayer = function() {
+105   // IE needs the object, everyone else just needs embed.
+106   var object = jQuery.browser.msie ? 'object' : 'embed';
+107   return jQuery(object, this.display).eq(0)[0];
+108 };
+109 
\ No newline at end of file diff --git a/minplayer/doc/symbols/src/src_minplayer.players.html5.js.html b/minplayer/doc/symbols/src/src_minplayer.players.html5.js.html new file mode 100644 index 00000000..a22b2288 --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.players.html5.js.html @@ -0,0 +1,351 @@ +
  1 /** The minplayer namespace. */
+  2 var minplayer = minplayer || {};
+  3 
+  4 /** All the media player implementations */
+  5 minplayer.players = minplayer.players || {};
+  6 
+  7 /**
+  8  * @constructor
+  9  * @extends minplayer.display
+ 10  * @class The HTML5 media player implementation.
+ 11  *
+ 12  * @param {object} context The jQuery context.
+ 13  * @param {object} options This components options.
+ 14  * @param {object} queue The event queue to pass events around.
+ 15  */
+ 16 minplayer.players.html5 = function(context, options, queue) {
+ 17 
+ 18   // Derive players base.
+ 19   minplayer.players.base.call(this, context, options, queue);
+ 20 };
+ 21 
+ 22 /** Derive from minplayer.players.base. */
+ 23 minplayer.players.html5.prototype = new minplayer.players.base();
+ 24 
+ 25 /** Reset the constructor. */
+ 26 minplayer.players.html5.prototype.constructor = minplayer.players.html5;
+ 27 
+ 28 /**
+ 29  * @see minplayer.players.base#getPriority
+ 30  * @return {number} The priority of this media player.
+ 31  */
+ 32 minplayer.players.html5.getPriority = function() {
+ 33   return 10;
+ 34 };
+ 35 
+ 36 /**
+ 37  * @see minplayer.players.base#canPlay
+ 38  * @return {boolean} If this player can play this media type.
+ 39  */
+ 40 minplayer.players.html5.canPlay = function(file) {
+ 41   switch (file.mimetype) {
+ 42     case 'video/ogg':
+ 43       return !!minplayer.playTypes.videoOGG;
+ 44     case 'video/mp4':
+ 45     case 'video/x-mp4':
+ 46     case 'video/m4v':
+ 47     case 'video/x-m4v':
+ 48       return !!minplayer.playTypes.videoH264;
+ 49     case 'video/x-webm':
+ 50     case 'video/webm':
+ 51     case 'application/octet-stream':
+ 52       return !!minplayer.playTypes.videoWEBM;
+ 53     case 'audio/ogg':
+ 54       return !!minplayer.playTypes.audioOGG;
+ 55     case 'audio/mpeg':
+ 56       return !!minplayer.playTypes.audioMP3;
+ 57     case 'audio/mp4':
+ 58       return !!minplayer.playTypes.audioMP4;
+ 59     default:
+ 60       return false;
+ 61   }
+ 62 };
+ 63 
+ 64 /**
+ 65  * @see minplayer.plugin.construct
+ 66  */
+ 67 minplayer.players.html5.prototype.construct = function() {
+ 68 
+ 69   // Call base constructor.
+ 70   minplayer.players.base.prototype.construct.call(this);
+ 71 
+ 72   // For the HTML5 player, we will just pass events along...
+ 73   if (this.player) {
+ 74 
+ 75     this.player.addEventListener('abort', (function(player) {
+ 76       return function() {
+ 77         player.trigger('abort');
+ 78       };
+ 79     })(this), false);
+ 80     this.player.addEventListener('loadstart', (function(player) {
+ 81       return function() {
+ 82         player.onReady();
+ 83       };
+ 84     })(this), false);
+ 85     this.player.addEventListener('loadeddata', (function(player) {
+ 86       return function() {
+ 87         player.onLoaded();
+ 88       };
+ 89     })(this), false);
+ 90     this.player.addEventListener('loadedmetadata', (function(player) {
+ 91       return function() {
+ 92         player.onLoaded();
+ 93       };
+ 94     })(this), false);
+ 95     this.player.addEventListener('canplaythrough', (function(player) {
+ 96       return function() {
+ 97         player.onLoaded();
+ 98       };
+ 99     })(this), false);
+100     this.player.addEventListener('ended', (function(player) {
+101       return function() {
+102         player.onComplete();
+103       };
+104     })(this), false);
+105     this.player.addEventListener('pause', (function(player) {
+106       return function() {
+107         player.onPaused();
+108       };
+109     })(this), false);
+110     this.player.addEventListener('play', (function(player) {
+111       return function() {
+112         player.onPlaying();
+113       };
+114     })(this), false);
+115     this.player.addEventListener('playing', (function(player) {
+116       return function() {
+117         player.onPlaying();
+118       };
+119     })(this), false);
+120     this.player.addEventListener('error', (function(player) {
+121       return function() {
+122         player.trigger('error', 'An error occured - ' + this.error.code);
+123       };
+124     })(this), false);
+125     this.player.addEventListener('waiting', (function(player) {
+126       return function() {
+127         player.onWaiting();
+128       };
+129     })(this), false);
+130     this.player.addEventListener('durationchange', (function(player) {
+131       return function() {
+132         player.duration.set(this.duration);
+133         player.trigger('durationchange', {duration: this.duration});
+134       };
+135     })(this), false);
+136     this.player.addEventListener('progress', (function(player) {
+137       return function(event) {
+138         player.bytesTotal.set(event.total);
+139         player.bytesLoaded.set(event.loaded);
+140       };
+141     })(this), false);
+142 
+143     // Say we are ready.
+144     this.onReady();
+145   }
+146 };
+147 
+148 /**
+149  * @see minplayer.players.base#playerFound
+150  * @return {boolean} TRUE - if the player is in the DOM, FALSE otherwise.
+151  */
+152 minplayer.players.html5.prototype.playerFound = function() {
+153   return (this.display.find(this.mediaFile.type).length > 0);
+154 };
+155 
+156 /**
+157  * @see minplayer.players.base#create
+158  * @return {object} The media player entity.
+159  */
+160 minplayer.players.html5.prototype.create = function() {
+161   minplayer.players.base.prototype.create.call(this);
+162   var element = jQuery(document.createElement(this.mediaFile.type))
+163   .attr(this.options.attributes)
+164   .append(
+165     jQuery(document.createElement('source')).attr({
+166       'src': this.mediaFile.path
+167     })
+168   );
+169 
+170   // Fix the fluid width and height.
+171   element.eq(0)[0].setAttribute('width', '100%');
+172   element.eq(0)[0].setAttribute('height', '100%');
+173   return element;
+174 };
+175 
+176 /**
+177  * @see minplayer.players.base#getPlayer
+178  * @return {object} The media player object.
+179  */
+180 minplayer.players.html5.prototype.getPlayer = function() {
+181   return this.elements.media.eq(0)[0];
+182 };
+183 
+184 /**
+185  * @see minplayer.players.base#load
+186  */
+187 minplayer.players.html5.prototype.load = function(file) {
+188 
+189   if (file) {
+190 
+191     // Get the current source.
+192     var src = this.elements.media.attr('src');
+193     if (!src) {
+194       src = jQuery('source', this.elements.media).eq(0).attr('src');
+195     }
+196 
+197     // If the source is different.
+198     if (src != file.path) {
+199 
+200       // Change the source...
+201       var code = '<source src="' + file.path + '">';
+202       this.elements.media.removeAttr('src').empty().html(code);
+203     }
+204   }
+205 
+206   // Always call the base first on load...
+207   minplayer.players.base.prototype.load.call(this, file);
+208 };
+209 
+210 /**
+211  * @see minplayer.players.base#play
+212  */
+213 minplayer.players.html5.prototype.play = function() {
+214   minplayer.players.base.prototype.play.call(this);
+215   if (this.isReady()) {
+216     this.player.play();
+217   }
+218 };
+219 
+220 /**
+221  * @see minplayer.players.base#pause
+222  */
+223 minplayer.players.html5.prototype.pause = function() {
+224   minplayer.players.base.prototype.pause.call(this);
+225   if (this.isReady()) {
+226     this.player.pause();
+227   }
+228 };
+229 
+230 /**
+231  * @see minplayer.players.base#stop
+232  */
+233 minplayer.players.html5.prototype.stop = function() {
+234   minplayer.players.base.prototype.stop.call(this);
+235   if (this.isReady()) {
+236     this.player.pause();
+237     this.player.src = '';
+238   }
+239 };
+240 
+241 /**
+242  * @see minplayer.players.base#seek
+243  */
+244 minplayer.players.html5.prototype.seek = function(pos) {
+245   minplayer.players.base.prototype.seek.call(this, pos);
+246   if (this.isReady()) {
+247     this.player.currentTime = pos;
+248   }
+249 };
+250 
+251 /**
+252  * @see minplayer.players.base#setVolume
+253  */
+254 minplayer.players.html5.prototype.setVolume = function(vol) {
+255   minplayer.players.base.prototype.setVolume.call(this, vol);
+256   if (this.isReady()) {
+257     this.player.volume = vol;
+258   }
+259 };
+260 
+261 /**
+262  * @see minplayer.players.base#getVolume
+263  */
+264 minplayer.players.html5.prototype.getVolume = function(callback) {
+265   if (this.isReady()) {
+266     callback(this.player.volume);
+267   }
+268 };
+269 
+270 /**
+271  * @see minplayer.players.base#getDuration
+272  */
+273 minplayer.players.html5.prototype.getDuration = function(callback) {
+274   if (this.isReady()) {
+275     callback(this.player.duration);
+276   }
+277 };
+278 
+279 /**
+280  * @see minplayer.players.base#getCurrentTime
+281  */
+282 minplayer.players.html5.prototype.getCurrentTime = function(callback) {
+283   if (this.isReady()) {
+284     callback(this.player.currentTime);
+285   }
+286 };
+287 
+288 /**
+289  * @see minplayer.players.base#getBytesLoaded
+290  */
+291 minplayer.players.html5.prototype.getBytesLoaded = function(callback) {
+292   if (this.isReady()) {
+293     var loaded = 0;
+294 
+295     // Check several different possibilities.
+296     if (this.bytesLoaded.value) {
+297       loaded = this.bytesLoaded.value;
+298     }
+299     else if (this.player.buffered &&
+300         this.player.buffered.length > 0 &&
+301         this.player.buffered.end &&
+302         this.player.duration) {
+303       loaded = this.player.buffered.end(0);
+304     }
+305     else if (this.player.bytesTotal != undefined &&
+306              this.player.bytesTotal > 0 &&
+307              this.player.bufferedBytes != undefined) {
+308       loaded = this.player.bufferedBytes;
+309     }
+310 
+311     // Return the loaded amount.
+312     callback(loaded);
+313   }
+314 };
+315 
+316 /**
+317  * @see minplayer.players.base#getBytesTotal
+318  */
+319 minplayer.players.html5.prototype.getBytesTotal = function(callback) {
+320   if (this.isReady()) {
+321 
+322     var total = 0;
+323 
+324     // Check several different possibilities.
+325     if (this.bytesTotal.value) {
+326       total = this.bytesTotal.value;
+327     }
+328     else if (this.player.buffered &&
+329         this.player.buffered.length > 0 &&
+330         this.player.buffered.end &&
+331         this.player.duration) {
+332       total = this.player.duration;
+333     }
+334     else if (this.player.bytesTotal != undefined &&
+335              this.player.bytesTotal > 0 &&
+336              this.player.bufferedBytes != undefined) {
+337       total = this.player.bytesTotal;
+338     }
+339 
+340     // Return the loaded amount.
+341     callback(total);
+342   }
+343 };
+344 
\ No newline at end of file diff --git a/minplayer/doc/symbols/src/src_minplayer.players.minplayer.js.html b/minplayer/doc/symbols/src/src_minplayer.players.minplayer.js.html new file mode 100644 index 00000000..6233b9db --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.players.minplayer.js.html @@ -0,0 +1,283 @@ +
  1 /** The minplayer namespace. */
+  2 var minplayer = minplayer || {};
+  3 
+  4 /** All the media player implementations */
+  5 minplayer.players = minplayer.players || {};
+  6 
+  7 /**
+  8  * @constructor
+  9  * @extends minplayer.display
+ 10  * @class The Flash media player class to control the flash fallback.
+ 11  *
+ 12  * @param {object} context The jQuery context.
+ 13  * @param {object} options This components options.
+ 14  * @param {object} queue The event queue to pass events around.
+ 15  */
+ 16 minplayer.players.minplayer = function(context, options, queue) {
+ 17 
+ 18   // Derive from players flash.
+ 19   minplayer.players.flash.call(this, context, options, queue);
+ 20 };
+ 21 
+ 22 /** Derive from minplayer.players.flash. */
+ 23 minplayer.players.minplayer.prototype = new minplayer.players.flash();
+ 24 
+ 25 /** Reset the constructor. */
+ 26 minplayer.players.minplayer.prototype.constructor = minplayer.players.minplayer;
+ 27 
+ 28 /**
+ 29  * Called when the Flash player is ready.
+ 30  *
+ 31  * @param {string} id The media player ID.
+ 32  */
+ 33 window.onFlashPlayerReady = function(id) {
+ 34   var media = minplayer.get(id, 'media');
+ 35   if (media) {
+ 36     media.onReady();
+ 37   }
+ 38 };
+ 39 
+ 40 /**
+ 41  * Called when the Flash player updates.
+ 42  *
+ 43  * @param {string} id The media player ID.
+ 44  * @param {string} eventType The event type that was triggered.
+ 45  */
+ 46 window.onFlashPlayerUpdate = function(id, eventType) {
+ 47   var media = minplayer.get(id, 'media');
+ 48   if (media) {
+ 49     media.onMediaUpdate(eventType);
+ 50   }
+ 51 };
+ 52 
+ 53 /**
+ 54  * Used to debug from the Flash player to the browser console.
+ 55  *
+ 56  * @param {string} debug The debug string.
+ 57  */
+ 58 window.onFlashPlayerDebug = function(debug) {
+ 59   minplayer.console.log(debug);
+ 60 };
+ 61 
+ 62 /**
+ 63  * @see minplayer.players.base#getPriority
+ 64  * @return {number} The priority of this media player.
+ 65  */
+ 66 minplayer.players.minplayer.getPriority = function() {
+ 67   return 1;
+ 68 };
+ 69 
+ 70 /**
+ 71  * @see minplayer.players.base#canPlay
+ 72  * @return {boolean} If this player can play this media type.
+ 73  */
+ 74 minplayer.players.minplayer.canPlay = function(file) {
+ 75   switch (file.mimetype) {
+ 76     case 'video/mp4':
+ 77     case 'video/x-mp4':
+ 78     case 'video/m4v':
+ 79     case 'video/x-m4v':
+ 80     case 'video/x-webm':
+ 81     case 'video/webm':
+ 82     case 'application/octet-stream':
+ 83     case 'video/quicktime':
+ 84     case 'video/3gpp2':
+ 85     case 'video/3gpp':
+ 86     case 'application/x-shockwave-flash':
+ 87     case 'audio/mpeg':
+ 88     case 'audio/mp4':
+ 89     case 'audio/aac':
+ 90     case 'audio/vnd.wave':
+ 91     case 'audio/x-ms-wma':
+ 92       return true;
+ 93 
+ 94     default:
+ 95       return false;
+ 96   }
+ 97 };
+ 98 
+ 99 /**
+100  * @see minplayer.players.base#create
+101  * @return {object} The media player entity.
+102  */
+103 minplayer.players.minplayer.prototype.create = function() {
+104 
+105   // Make sure we provide default options...
+106   this.options = jQuery.extend({
+107     swfplayer: 'flash/minplayer.swf'
+108   }, this.options);
+109 
+110   minplayer.players.flash.prototype.create.call(this);
+111 
+112   // The flash variables for this flash player.
+113   var flashVars = {
+114     'id': this.options.id,
+115     'debug': this.options.debug,
+116     'config': 'nocontrols',
+117     'file': this.mediaFile.path,
+118     'autostart': this.options.autoplay
+119   };
+120 
+121   // Return a flash media player object.
+122   return minplayer.players.flash.getFlash({
+123     swf: this.options.swfplayer,
+124     id: this.options.id + '_player',
+125     width: this.options.width,
+126     height: '100%',
+127     flashvars: flashVars,
+128     wmode: this.options.wmode
+129   });
+130 };
+131 
+132 /**
+133  * Called when the Flash player has an update.
+134  *
+135  * @param {string} eventType The event that was triggered in the player.
+136  */
+137 minplayer.players.minplayer.prototype.onMediaUpdate = function(eventType) {
+138   switch (eventType) {
+139     case 'mediaMeta':
+140       this.onLoaded();
+141       break;
+142     case 'mediaPlaying':
+143       this.onPlaying();
+144       break;
+145     case 'mediaPaused':
+146       this.onPaused();
+147       break;
+148     case 'mediaComplete':
+149       this.onComplete();
+150       break;
+151   }
+152 };
+153 
+154 /**
+155  * @see minplayer.players.base#load
+156  */
+157 minplayer.players.minplayer.prototype.load = function(file) {
+158   minplayer.players.flash.prototype.load.call(this, file);
+159   if (file && this.isReady()) {
+160     this.player.loadMedia(file.path, file.stream);
+161   }
+162 };
+163 
+164 /**
+165  * @see minplayer.players.base#play
+166  */
+167 minplayer.players.minplayer.prototype.play = function() {
+168   minplayer.players.flash.prototype.play.call(this);
+169   if (this.isReady()) {
+170     this.player.playMedia();
+171   }
+172 };
+173 
+174 /**
+175  * @see minplayer.players.base#pause
+176  */
+177 minplayer.players.minplayer.prototype.pause = function() {
+178   minplayer.players.flash.prototype.pause.call(this);
+179   if (this.isReady()) {
+180     this.player.pauseMedia();
+181   }
+182 };
+183 
+184 /**
+185  * @see minplayer.players.base#stop
+186  */
+187 minplayer.players.minplayer.prototype.stop = function() {
+188   minplayer.players.flash.prototype.stop.call(this);
+189   if (this.isReady()) {
+190     this.player.stopMedia();
+191   }
+192 };
+193 
+194 /**
+195  * @see minplayer.players.base#seek
+196  */
+197 minplayer.players.minplayer.prototype.seek = function(pos) {
+198   minplayer.players.flash.prototype.seek.call(this, pos);
+199   if (this.isReady()) {
+200     this.player.seekMedia(pos);
+201   }
+202 };
+203 
+204 /**
+205  * @see minplayer.players.base#setVolume
+206  */
+207 minplayer.players.minplayer.prototype.setVolume = function(vol) {
+208   minplayer.players.flash.prototype.setVolume.call(this, vol);
+209   if (this.isReady()) {
+210     this.player.setVolume(vol);
+211   }
+212 };
+213 
+214 /**
+215  * @see minplayer.players.base#getVolume
+216  */
+217 minplayer.players.minplayer.prototype.getVolume = function(callback) {
+218   if (this.isReady()) {
+219     callback(this.player.getVolume());
+220   }
+221 };
+222 
+223 /**
+224  * @see minplayer.players.flash#getDuration
+225  */
+226 minplayer.players.minplayer.prototype.getDuration = function(callback) {
+227   if (this.isReady()) {
+228 
+229     // Check to see if it is immediately available.
+230     var duration = this.player.getDuration();
+231     if (duration) {
+232       callback(duration);
+233     }
+234     else {
+235 
+236       // If not, then poll every second for the duration.
+237       this.poll((function(player) {
+238         return function() {
+239           duration = player.player.getDuration();
+240           if (duration) {
+241             callback(duration);
+242           }
+243           return !duration;
+244         };
+245       })(this), 1000);
+246     }
+247   }
+248 };
+249 
+250 /**
+251  * @see minplayer.players.base#getCurrentTime
+252  */
+253 minplayer.players.minplayer.prototype.getCurrentTime = function(callback) {
+254   if (this.isReady()) {
+255     callback(this.player.getCurrentTime());
+256   }
+257 };
+258 
+259 /**
+260  * @see minplayer.players.base#getBytesLoaded
+261  */
+262 minplayer.players.minplayer.prototype.getBytesLoaded = function(callback) {
+263   if (this.isReady()) {
+264     callback(this.player.getMediaBytesLoaded());
+265   }
+266 };
+267 
+268 /**
+269  * @see minplayer.players.base#getBytesTotal.
+270  */
+271 minplayer.players.minplayer.prototype.getBytesTotal = function(callback) {
+272   if (this.isReady()) {
+273     callback(this.player.getMediaBytesTotal());
+274   }
+275 };
+276 
\ No newline at end of file diff --git a/minplayer/doc/symbols/src/src_minplayer.players.vimeo.js.html b/minplayer/doc/symbols/src/src_minplayer.players.vimeo.js.html new file mode 100644 index 00000000..92dab40c --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.players.vimeo.js.html @@ -0,0 +1,270 @@ +
  1 /** The minplayer namespace. */
+  2 var minplayer = minplayer || {};
+  3 
+  4 /** All the media player implementations */
+  5 minplayer.players = minplayer.players || {};
+  6 
+  7 /**
+  8  * @constructor
+  9  * @extends minplayer.players.base
+ 10  * @class The vimeo media player.
+ 11  *
+ 12  * @param {object} context The jQuery context.
+ 13  * @param {object} options This components options.
+ 14  * @param {object} queue The event queue to pass events around.
+ 15  */
+ 16 minplayer.players.vimeo = function(context, options, queue) {
+ 17 
+ 18   // Derive from players base.
+ 19   minplayer.players.base.call(this, context, options, queue);
+ 20 };
+ 21 
+ 22 /** Derive from minplayer.players.base. */
+ 23 minplayer.players.vimeo.prototype = new minplayer.players.base();
+ 24 
+ 25 /** Reset the constructor. */
+ 26 minplayer.players.vimeo.prototype.constructor = minplayer.players.vimeo;
+ 27 
+ 28 /**
+ 29  * @see minplayer.players.base#getPriority
+ 30  * @return {number} The priority of this media player.
+ 31  */
+ 32 minplayer.players.vimeo.getPriority = function() {
+ 33   return 10;
+ 34 };
+ 35 
+ 36 /**
+ 37  * @see minplayer.players.base#canPlay
+ 38  * @return {boolean} If this player can play this media type.
+ 39  */
+ 40 minplayer.players.vimeo.canPlay = function(file) {
+ 41 
+ 42   // Check for the mimetype for vimeo.
+ 43   if (file.mimetype === 'video/vimeo') {
+ 44     return true;
+ 45   }
+ 46 
+ 47   // If the path is a vimeo path, then return true.
+ 48   return (file.path.search(/^http(s)?\:\/\/(www\.)?vimeo\.com/i) === 0);
+ 49 };
+ 50 
+ 51 /**
+ 52  * Return the ID for a provided media file.
+ 53  *
+ 54  * @param {object} file A {@link minplayer.file} object.
+ 55  * @return {string} The ID for the provided media.
+ 56  */
+ 57 minplayer.players.vimeo.getMediaId = function(file) {
+ 58   var regex = /^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i;
+ 59   if (file.path.search(regex) === 0) {
+ 60     return file.path.match(regex)[3];
+ 61   }
+ 62   else {
+ 63     return file.path;
+ 64   }
+ 65 };
+ 66 
+ 67 /**
+ 68  * @see minplayer.players.base#reset
+ 69  */
+ 70 minplayer.players.vimeo.prototype.reset = function() {
+ 71 
+ 72   // Reset the flash variables..
+ 73   minplayer.players.base.prototype.reset.call(this);
+ 74 };
+ 75 
+ 76 /**
+ 77  * @see minplayer.players.base#create
+ 78  * @return {object} The media player entity.
+ 79  */
+ 80 minplayer.players.vimeo.prototype.create = function() {
+ 81   minplayer.players.base.prototype.create.call(this);
+ 82 
+ 83   // Insert the Vimeo Froogaloop player.
+ 84   var tag = document.createElement('script');
+ 85   tag.src = 'http://a.vimeocdn.com/js/froogaloop2.min.js';
+ 86   var firstScriptTag = document.getElementsByTagName('script')[0];
+ 87   firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
+ 88 
+ 89   // Create the iframe for this player.
+ 90   var iframe = document.createElement('iframe');
+ 91   iframe.setAttribute('id', this.options.id + '-player');
+ 92   iframe.setAttribute('type', 'text/html');
+ 93   iframe.setAttribute('width', '100%');
+ 94   iframe.setAttribute('height', '100%');
+ 95   iframe.setAttribute('frameborder', '0');
+ 96 
+ 97   // Get the source.
+ 98   var src = 'http://player.vimeo.com/video/';
+ 99   src += this.mediaFile.id + '?';
+100 
+101   // Add the parameters to the src.
+102   src += jQuery.param({
+103     'wmode': 'opaque',
+104     'api': 1,
+105     'player_id': this.options.id + '-player',
+106     'title': 0,
+107     'byline': 0,
+108     'portrait': 0,
+109     'autoplay': this.options.autoplay,
+110     'loop': this.options.loop
+111   });
+112 
+113   // Set the source of the iframe.
+114   iframe.setAttribute('src', src);
+115 
+116   // Now register this player when the froogaloop code is loaded.
+117   this.poll((function(player) {
+118     return function() {
+119       if (window.Froogaloop) {
+120         player.player = window.Froogaloop(iframe);
+121         player.player.addEvent('ready', function() {
+122           player.onReady();
+123         });
+124       }
+125       return !window.Froogaloop;
+126     };
+127   })(this), 200);
+128 
+129   // Trigger that the load has started.
+130   this.trigger('loadstart');
+131 
+132   // Return the player.
+133   return iframe;
+134 };
+135 
+136 /**
+137  * @see minplayer.players.base#onReady
+138  */
+139 minplayer.players.vimeo.prototype.onReady = function(player_id) {
+140 
+141   // Add the other listeners.
+142   this.player.addEvent('loadProgress', (function(player) {
+143     return function(progress) {
+144       player.duration.set(parseFloat(progress.duration));
+145       player.bytesLoaded.set(progress.bytesLoaded);
+146       player.bytesTotal.set(progress.bytesTotal);
+147     };
+148   })(this));
+149 
+150   this.player.addEvent('playProgress', (function(player) {
+151     return function(progress) {
+152       player.duration.set(parseFloat(progress.duration));
+153       player.currentTime.set(parseFloat(progress.seconds));
+154     };
+155   })(this));
+156 
+157   this.player.addEvent('play', (function(player) {
+158     return function() {
+159       player.onPlaying();
+160     };
+161   })(this));
+162 
+163   this.player.addEvent('pause', (function(player) {
+164     return function() {
+165       player.onPaused();
+166     };
+167   })(this));
+168 
+169   this.player.addEvent('finish', (function(player) {
+170     return function() {
+171       player.onComplete();
+172     };
+173   })(this));
+174 
+175   minplayer.players.base.prototype.onReady.call(this);
+176   this.onLoaded();
+177 };
+178 
+179 /**
+180  * Checks to see if this player can be found.
+181  * @return {bool} TRUE - Player is found, FALSE - otherwise.
+182  */
+183 minplayer.players.vimeo.prototype.playerFound = function() {
+184   var iframe = this.display.find('iframe#' + this.options.id + '-player');
+185   return (iframe.length > 0);
+186 };
+187 
+188 /**
+189  * @see minplayer.players.base#play
+190  */
+191 minplayer.players.vimeo.prototype.play = function() {
+192   minplayer.players.base.prototype.play.call(this);
+193   if (this.isReady()) {
+194     this.player.api('play');
+195   }
+196 };
+197 
+198 /**
+199  * @see minplayer.players.base#pause
+200  */
+201 minplayer.players.vimeo.prototype.pause = function() {
+202   minplayer.players.base.prototype.pause.call(this);
+203   if (this.isReady()) {
+204     this.player.api('pause');
+205   }
+206 };
+207 
+208 /**
+209  * @see minplayer.players.base#stop
+210  */
+211 minplayer.players.vimeo.prototype.stop = function() {
+212   minplayer.players.base.prototype.stop.call(this);
+213   if (this.isReady()) {
+214     this.player.api('unload');
+215   }
+216 };
+217 
+218 /**
+219  * @see minplayer.players.base#seek
+220  */
+221 minplayer.players.vimeo.prototype.seek = function(pos) {
+222   minplayer.players.base.prototype.seek.call(this, pos);
+223   if (this.isReady()) {
+224     this.player.api('seekTo', pos);
+225   }
+226 };
+227 
+228 /**
+229  * @see minplayer.players.base#setVolume
+230  */
+231 minplayer.players.vimeo.prototype.setVolume = function(vol) {
+232   minplayer.players.base.prototype.setVolume.call(this, vol);
+233   if (this.isReady()) {
+234     this.volume.set(vol);
+235     this.player.api('setVolume', vol);
+236   }
+237 };
+238 
+239 /**
+240  * @see minplayer.players.base#getVolume
+241  */
+242 minplayer.players.vimeo.prototype.getVolume = function(callback) {
+243   this.player.api('getVolume', function(vol) {
+244     callback(vol);
+245   });
+246 };
+247 
+248 /**
+249  * @see minplayer.players.base#getDuration.
+250  */
+251 minplayer.players.vimeo.prototype.getDuration = function(callback) {
+252   if (this.isReady()) {
+253     if (this.duration.value) {
+254       callback(this.duration.value);
+255     }
+256     else {
+257       this.player.api('getDuration', function(duration) {
+258         callback(duration);
+259       });
+260     }
+261   }
+262 };
+263 
\ No newline at end of file diff --git a/minplayer/doc/symbols/src/src_minplayer.players.youtube.js.html b/minplayer/doc/symbols/src/src_minplayer.players.youtube.js.html new file mode 100644 index 00000000..aa599ebd --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.players.youtube.js.html @@ -0,0 +1,354 @@ +
  1 /** The minplayer namespace. */
+  2 var minplayer = minplayer || {};
+  3 
+  4 /** All the media player implementations */
+  5 minplayer.players = minplayer.players || {};
+  6 
+  7 /**
+  8  * @constructor
+  9  * @extends minplayer.players.base
+ 10  * @class The YouTube media player.
+ 11  *
+ 12  * @param {object} context The jQuery context.
+ 13  * @param {object} options This components options.
+ 14  * @param {object} queue The event queue to pass events around.
+ 15  */
+ 16 minplayer.players.youtube = function(context, options, queue) {
+ 17 
+ 18   /** The quality of the YouTube stream. */
+ 19   this.quality = 'default';
+ 20 
+ 21   // Derive from players base.
+ 22   minplayer.players.base.call(this, context, options, queue);
+ 23 };
+ 24 
+ 25 /** Derive from minplayer.players.base. */
+ 26 minplayer.players.youtube.prototype = new minplayer.players.base();
+ 27 
+ 28 /** Reset the constructor. */
+ 29 minplayer.players.youtube.prototype.constructor = minplayer.players.youtube;
+ 30 
+ 31 /**
+ 32  * @see minplayer.players.base#getPriority
+ 33  * @return {number} The priority of this media player.
+ 34  */
+ 35 minplayer.players.youtube.getPriority = function() {
+ 36   return 10;
+ 37 };
+ 38 
+ 39 /**
+ 40  * @see minplayer.players.base#canPlay
+ 41  * @return {boolean} If this player can play this media type.
+ 42  */
+ 43 minplayer.players.youtube.canPlay = function(file) {
+ 44 
+ 45   // Check for the mimetype for youtube.
+ 46   if (file.mimetype === 'video/youtube') {
+ 47     return true;
+ 48   }
+ 49 
+ 50   // If the path is a YouTube path, then return true.
+ 51   return (file.path.search(/^http(s)?\:\/\/(www\.)?youtube\.com/i) === 0);
+ 52 };
+ 53 
+ 54 /**
+ 55  * Return the ID for a provided media file.
+ 56  *
+ 57  * @param {object} file A {@link minplayer.file} object.
+ 58  * @return {string} The ID for the provided media.
+ 59  */
+ 60 minplayer.players.youtube.getMediaId = function(file) {
+ 61   var regex = /^http[s]?\:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9]+)/i;
+ 62   if (file.path.search(regex) === 0) {
+ 63     return file.path.match(regex)[2];
+ 64   }
+ 65   else {
+ 66     return file.path;
+ 67   }
+ 68 };
+ 69 
+ 70 /**
+ 71  * Register this youtube player so that multiple players can be present
+ 72  * on the same page without event collision.
+ 73  */
+ 74 minplayer.players.youtube.prototype.register = function() {
+ 75 
+ 76   /**
+ 77    * Register the standard youtube api ready callback.
+ 78    */
+ 79   window.onYouTubePlayerAPIReady = function() {
+ 80 
+ 81     // Iterate over each media player.
+ 82     jQuery.each(minplayer.get(null, 'player'), function(id, player) {
+ 83 
+ 84       // Make sure this is the youtube player.
+ 85       if (player.currentPlayer == 'youtube') {
+ 86 
+ 87         // Create a new youtube player object for this instance only.
+ 88         var playerId = id + '-player';
+ 89 
+ 90         // Set this players media.
+ 91         player.media.player = new YT.Player(playerId, {
+ 92           events: {
+ 93             'onReady': function(event) {
+ 94               player.media.onReady(event);
+ 95             },
+ 96             'onStateChange': function(event) {
+ 97               player.media.onPlayerStateChange(event);
+ 98             },
+ 99             'onPlaybackQualityChange': function(newQuality) {
+100               player.media.onQualityChange(newQuality);
+101             },
+102             'onError': function(errorCode) {
+103               player.media.onError(errorCode);
+104             }
+105           }
+106         });
+107       }
+108     });
+109   }
+110 };
+111 
+112 /**
+113  * Translates the player state for the YouTube API player.
+114  *
+115  * @param {number} playerState The YouTube player state.
+116  */
+117 minplayer.players.youtube.prototype.setPlayerState = function(playerState) {
+118   switch (playerState) {
+119     case YT.PlayerState.CUED:
+120       break;
+121     case YT.PlayerState.BUFFERING:
+122       this.onWaiting();
+123       break;
+124     case YT.PlayerState.PAUSED:
+125       this.onPaused();
+126       break;
+127     case YT.PlayerState.PLAYING:
+128       this.onPlaying();
+129       break;
+130     case YT.PlayerState.ENDED:
+131       this.onComplete();
+132       break;
+133     default:
+134       break;
+135   }
+136 };
+137 
+138 /**
+139  * Called when an error occurs.
+140  *
+141  * @param {string} event The onReady event that was triggered.
+142  */
+143 minplayer.players.youtube.prototype.onReady = function(event) {
+144   minplayer.players.base.prototype.onReady.call(this);
+145   this.onLoaded();
+146 };
+147 
+148 /**
+149  * Checks to see if this player can be found.
+150  * @return {bool} TRUE - Player is found, FALSE - otherwise.
+151  */
+152 minplayer.players.youtube.prototype.playerFound = function() {
+153   var iframe = this.display.find('iframe#' + this.options.id + '-player');
+154   return (iframe.length > 0);
+155 };
+156 
+157 /**
+158  * Called when the player state changes.
+159  *
+160  * @param {object} event A JavaScript Event.
+161  */
+162 minplayer.players.youtube.prototype.onPlayerStateChange = function(event) {
+163   this.setPlayerState(event.data);
+164 };
+165 
+166 /**
+167  * Called when the player quality changes.
+168  *
+169  * @param {string} newQuality The new quality for the change.
+170  */
+171 minplayer.players.youtube.prototype.onQualityChange = function(newQuality) {
+172   this.quality = newQuality.data;
+173 };
+174 
+175 /**
+176  * Determines if the player should show the playloader.
+177  *
+178  * @return {bool} If this player implements its own playLoader.
+179  */
+180 minplayer.players.youtube.prototype.hasPlayLoader = function() {
+181   return true;
+182 };
+183 
+184 /**
+185  * @see minplayer.players.base#create
+186  * @return {object} The media player entity.
+187  */
+188 minplayer.players.youtube.prototype.create = function() {
+189   minplayer.players.base.prototype.create.call(this);
+190 
+191   // Insert the YouTube iframe API player.
+192   var tag = document.createElement('script');
+193   tag.src = 'http://www.youtube.com/player_api?enablejsapi=1';
+194   var firstScriptTag = document.getElementsByTagName('script')[0];
+195   firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
+196 
+197   // Now register this player.
+198   this.register();
+199 
+200   // Create the iframe for this player.
+201   var iframe = document.createElement('iframe');
+202   iframe.setAttribute('id', this.options.id + '-player');
+203   iframe.setAttribute('type', 'text/html');
+204   iframe.setAttribute('width', '100%');
+205   iframe.setAttribute('height', '100%');
+206   iframe.setAttribute('frameborder', '0');
+207 
+208   // Get the source.
+209   var src = 'http://www.youtube.com/embed/';
+210   src += this.mediaFile.id + '?';
+211 
+212   // Determine the origin of this script.
+213   var origin = location.protocol;
+214   origin += '//' + location.hostname;
+215   origin += (location.port && ':' + location.port);
+216 
+217   // Add the parameters to the src.
+218   src += jQuery.param({
+219     'wmode': 'opaque',
+220     'controls': 0,
+221     'enablejsapi': 1,
+222     'origin': origin,
+223     'autoplay': this.options.autoplay,
+224     'loop': this.options.loop
+225   });
+226 
+227   // Set the source of the iframe.
+228   iframe.setAttribute('src', src);
+229 
+230   // Return the player.
+231   return iframe;
+232 };
+233 
+234 /**
+235  * @see minplayer.players.base#load
+236  */
+237 minplayer.players.youtube.prototype.load = function(file) {
+238   minplayer.players.base.prototype.load.call(this, file);
+239   if (file && this.isReady()) {
+240     this.player.loadVideoById(file.id, 0, this.quality);
+241   }
+242 };
+243 
+244 /**
+245  * @see minplayer.players.base#play
+246  */
+247 minplayer.players.youtube.prototype.play = function() {
+248   minplayer.players.base.prototype.play.call(this);
+249   if (this.isReady()) {
+250     this.player.playVideo();
+251   }
+252 };
+253 
+254 /**
+255  * @see minplayer.players.base#pause
+256  */
+257 minplayer.players.youtube.prototype.pause = function() {
+258   minplayer.players.base.prototype.pause.call(this);
+259   if (this.isReady()) {
+260     this.player.pauseVideo();
+261   }
+262 };
+263 
+264 /**
+265  * @see minplayer.players.base#stop
+266  */
+267 minplayer.players.youtube.prototype.stop = function() {
+268   minplayer.players.base.prototype.stop.call(this);
+269   if (this.isReady()) {
+270     this.player.stopVideo();
+271   }
+272 };
+273 
+274 /**
+275  * @see minplayer.players.base#seek
+276  */
+277 minplayer.players.youtube.prototype.seek = function(pos) {
+278   minplayer.players.base.prototype.seek.call(this, pos);
+279   if (this.isReady()) {
+280     this.player.seekTo(pos, true);
+281   }
+282 };
+283 
+284 /**
+285  * @see minplayer.players.base#setVolume
+286  */
+287 minplayer.players.youtube.prototype.setVolume = function(vol) {
+288   minplayer.players.base.prototype.setVolume.call(this, vol);
+289   if (this.isReady()) {
+290     this.player.setVolume(vol * 100);
+291   }
+292 };
+293 
+294 /**
+295  * @see minplayer.players.base#getVolume
+296  */
+297 minplayer.players.youtube.prototype.getVolume = function(callback) {
+298   if (this.isReady()) {
+299     callback(this.player.getVolume());
+300   }
+301 };
+302 
+303 /**
+304  * @see minplayer.players.base#getDuration.
+305  */
+306 minplayer.players.youtube.prototype.getDuration = function(callback) {
+307   if (this.isReady()) {
+308     callback(this.player.getDuration());
+309   }
+310 };
+311 
+312 /**
+313  * @see minplayer.players.base#getCurrentTime
+314  */
+315 minplayer.players.youtube.prototype.getCurrentTime = function(callback) {
+316   if (this.isReady()) {
+317     callback(this.player.getCurrentTime());
+318   }
+319 };
+320 
+321 /**
+322  * @see minplayer.players.base#getBytesStart.
+323  */
+324 minplayer.players.youtube.prototype.getBytesStart = function(callback) {
+325   if (this.isReady()) {
+326     callback(this.player.getVideoStartBytes());
+327   }
+328 };
+329 
+330 /**
+331  * @see minplayer.players.base#getBytesLoaded.
+332  */
+333 minplayer.players.youtube.prototype.getBytesLoaded = function(callback) {
+334   if (this.isReady()) {
+335     callback(this.player.getVideoBytesLoaded());
+336   }
+337 };
+338 
+339 /**
+340  * @see minplayer.players.base#getBytesTotal.
+341  */
+342 minplayer.players.youtube.prototype.getBytesTotal = function(callback) {
+343   if (this.isReady()) {
+344     callback(this.player.getVideoBytesTotal());
+345   }
+346 };
+347 
\ No newline at end of file diff --git a/minplayer/doc/symbols/src/src_minplayer.plugin.js.html b/minplayer/doc/symbols/src/src_minplayer.plugin.js.html new file mode 100644 index 00000000..3f7d5d12 --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.plugin.js.html @@ -0,0 +1,557 @@ +
  1 /** The minplayer namespace. */
+  2 minplayer = minplayer || {};
+  3 
+  4 /** Static array to keep track of all plugins. */
+  5 minplayer.plugins = minplayer.plugins || {};
+  6 
+  7 /** Static array to keep track of queues. */
+  8 minplayer.queue = minplayer.queue || [];
+  9 
+ 10 /** Mutex lock to keep multiple triggers from occuring. */
+ 11 minplayer.lock = false;
+ 12 
+ 13 /**
+ 14  * @constructor
+ 15  * @class The base class for all plugins.
+ 16  *
+ 17  * @param {string} name The name of this plugin.
+ 18  * @param {object} context The jQuery context.
+ 19  * @param {object} options This components options.
+ 20  * @param {object} queue The event queue to pass events around.
+ 21  */
+ 22 minplayer.plugin = function(name, context, options, queue) {
+ 23 
+ 24   /** The name of this plugin. */
+ 25   this.name = name;
+ 26 
+ 27   /** The ready flag. */
+ 28   this.pluginReady = false;
+ 29 
+ 30   /** The options for this plugin. */
+ 31   this.options = options || {};
+ 32 
+ 33   /** The event queue. */
+ 34   this.queue = queue || {};
+ 35 
+ 36   /** Keep track of already triggered events. */
+ 37   this.triggered = {};
+ 38 
+ 39   /** Create a queue lock. */
+ 40   this.lock = false;
+ 41 
+ 42   // Only call the constructor if we have a context.
+ 43   if (context) {
+ 44 
+ 45     /** Keep track of the context. */
+ 46     this.context = context;
+ 47 
+ 48     // Construct this plugin.
+ 49     this.construct();
+ 50   }
+ 51 };
+ 52 
+ 53 /**
+ 54  * The constructor which is called once the context is set.
+ 55  * Any class deriving from the plugin class should place all context
+ 56  * dependant functionality within this function instead of the standard
+ 57  * constructor function since it is called on object derivation as well
+ 58  * as object creation.
+ 59  */
+ 60 minplayer.plugin.prototype.construct = function() {
+ 61 
+ 62   // Adds this as a plugin.
+ 63   this.addPlugin();
+ 64 };
+ 65 
+ 66 /**
+ 67  * Destructor.
+ 68  */
+ 69 minplayer.plugin.prototype.destroy = function() {
+ 70 
+ 71   // Unbind all events.
+ 72   this.unbind();
+ 73 };
+ 74 
+ 75 /**
+ 76  * Creates a new plugin within this context.
+ 77  *
+ 78  * @param {string} name The name of the plugin you wish to create.
+ 79  * @param {object} base The base object for this plugin.
+ 80  * @param {object} context The context which you would like to create.
+ 81  * @return {object} The new plugin object.
+ 82  */
+ 83 minplayer.plugin.prototype.create = function(name, base, context) {
+ 84   var plugin = null;
+ 85 
+ 86   // Make sure we have a base object.
+ 87   base = base || 'minplayer';
+ 88 
+ 89   // Make sure there is a context.
+ 90   context = context || this.display;
+ 91 
+ 92   // See if this plugin exists within this object.
+ 93   if (window[base][name]) {
+ 94 
+ 95     // Set the plugin.
+ 96     plugin = window[base][name];
+ 97 
+ 98     // See if a template version of the plugin exists.
+ 99     if (plugin[this.options.template]) {
+100 
+101       plugin = plugin[this.options.template];
+102     }
+103 
+104     // Create the new plugin.
+105     return new plugin(context, this.options);
+106   }
+107 
+108   return null;
+109 };
+110 
+111 /**
+112  * Plugins should call this method when they are ready.
+113  */
+114 minplayer.plugin.prototype.ready = function() {
+115 
+116   // Keep this plugin from triggering multiple ready events.
+117   if (!this.pluginReady) {
+118 
+119     // Set the ready flag.
+120     this.pluginReady = true;
+121 
+122     // Now trigger that I am ready.
+123     this.trigger('ready');
+124 
+125     // Check the queue.
+126     this.checkQueue();
+127   }
+128 };
+129 
+130 /**
+131  * Adds a new plugin to this player.
+132  *
+133  * @param {string} name The name of this plugin.
+134  * @param {object} plugin A new plugin object, derived from media.plugin.
+135  */
+136 minplayer.plugin.prototype.addPlugin = function(name, plugin) {
+137   name = name || this.name;
+138   plugin = plugin || this;
+139 
+140   // Make sure the plugin is valid.
+141   if (plugin.isValid()) {
+142 
+143     // If the plugins for this instance do not exist.
+144     if (!minplayer.plugins[this.options.id]) {
+145 
+146       // Initialize the plugins.
+147       minplayer.plugins[this.options.id] = {};
+148     }
+149 
+150     // Add this plugin.
+151     minplayer.plugins[this.options.id][name] = plugin;
+152   }
+153 };
+154 
+155 /**
+156  * Create a polling timer.
+157  *
+158  * @param {function} callback The function to call when you poll.
+159  * @param {integer} interval The interval you would like to poll.
+160  */
+161 minplayer.plugin.prototype.poll = function(callback, interval) {
+162   setTimeout((function(context) {
+163     return function callLater() {
+164       if (callback.call(context)) {
+165         setTimeout(callLater, interval);
+166       }
+167     };
+168   })(this), interval);
+169 };
+170 
+171 /**
+172  * Gets a plugin by name and calls callback when it is ready.
+173  *
+174  * @param {string} plugin The plugin of the plugin.
+175  * @param {function} callback Called when the plugin is ready.
+176  * @return {object} The plugin if no callback is provided.
+177  */
+178 minplayer.plugin.prototype.get = function(plugin, callback) {
+179 
+180   // If they pass just a callback, then return all plugins when ready.
+181   if (typeof plugin === 'function') {
+182     callback = plugin;
+183     plugin = null;
+184   }
+185 
+186   // Return the minplayer.get equivalent.
+187   return minplayer.get.call(this, this.options.id, plugin, callback);
+188 };
+189 
+190 /**
+191  * Check the queue and execute it.
+192  */
+193 minplayer.plugin.prototype.checkQueue = function() {
+194 
+195   // Initialize our variables.
+196   var q = null, i = 0, check = false, newqueue = [];
+197 
+198   // Set the lock.
+199   minplayer.lock = true;
+200 
+201   // Iterate through all the queues.
+202   var length = minplayer.queue.length;
+203   for (i = 0; i < length; i++) {
+204 
+205     // Get the queue.
+206     q = minplayer.queue[i];
+207 
+208     // Now check to see if this queue is about us.
+209     check = !q.id && !q.plugin;
+210     check |= (q.plugin == this.name) && (!q.id || (q.id == this.options.id));
+211 
+212     // If the check passes...
+213     if (check) {
+214       check = minplayer.bind.call(
+215         q.context,
+216         q.event,
+217         this.options.id,
+218         this.name,
+219         q.callback
+220       );
+221     }
+222 
+223     // Add the queue back if it doesn't check out.
+224     if (!check) {
+225 
+226       // Add this back to the queue.
+227       newqueue.push(q);
+228     }
+229   }
+230 
+231   // Set the old queue to the new queue.
+232   minplayer.queue = newqueue;
+233 
+234   // Release the lock.
+235   minplayer.lock = false;
+236 };
+237 
+238 /**
+239  * Trigger a media event.
+240  *
+241  * @param {string} type The event type.
+242  * @param {object} data The event data object.
+243  * @return {object} The plugin object.
+244  */
+245 minplayer.plugin.prototype.trigger = function(type, data) {
+246   data = data || {};
+247   data.plugin = this;
+248 
+249   // Add this to our triggered array.
+250   this.triggered[type] = data;
+251 
+252   // Check to make sure the queue for this type exists.
+253   if (this.queue.hasOwnProperty(type)) {
+254 
+255     var i = 0, queue = {};
+256 
+257     // Iterate through all the callbacks in this queue.
+258     for (i in this.queue[type]) {
+259 
+260       // Setup the event object, and call the callback.
+261       queue = this.queue[type][i];
+262       queue.callback({target: this, data: queue.data}, data);
+263     }
+264   }
+265 
+266   // Return the plugin object.
+267   return this;
+268 };
+269 
+270 /**
+271  * Bind to a media event.
+272  *
+273  * @param {string} type The event type.
+274  * @param {object} data The data to bind with the event.
+275  * @param {function} fn The callback function.
+276  * @return {object} The plugin object.
+277  **/
+278 minplayer.plugin.prototype.bind = function(type, data, fn) {
+279 
+280   // Allow the data to be the callback.
+281   if (typeof data === 'function') {
+282     fn = data;
+283     data = null;
+284   }
+285 
+286   // You must bind to a specific event and have a callback.
+287   if (!type || !fn) {
+288     return;
+289   }
+290 
+291   // Initialize the queue for this type.
+292   this.queue[type] = this.queue[type] || [];
+293 
+294   // Unbind any existing equivalent events.
+295   this.unbind(type, fn);
+296 
+297   // Now add this event to the queue.
+298   this.queue[type].push({
+299     callback: fn,
+300     data: data
+301   });
+302 
+303   // Now see if this event has already been triggered.
+304   if (this.triggered[type]) {
+305 
+306     // Go ahead and trigger the event.
+307     fn({target: this, data: data}, this.triggered[type]);
+308   }
+309 
+310   // Return the plugin.
+311   return this;
+312 };
+313 
+314 /**
+315  * Unbind a media event.
+316  *
+317  * @param {string} type The event type.
+318  * @param {function} fn The callback function.
+319  * @return {object} The plugin object.
+320  **/
+321 minplayer.plugin.prototype.unbind = function(type, fn) {
+322 
+323   // If this is locked then try again after 10ms.
+324   if (this.lock) {
+325     setTimeout((function(plugin) {
+326       return function() {
+327         plugin.unbind(type, fn);
+328       };
+329     })(this), 10);
+330   }
+331 
+332   // Set the lock.
+333   this.lock = true;
+334 
+335   if (!type) {
+336     this.queue = {};
+337   }
+338   else if (!fn) {
+339     this.queue[type] = [];
+340   }
+341   else {
+342     // Iterate through all the callbacks and search for equal callbacks.
+343     var i = 0, queue = {};
+344     for (i in this.queue[type]) {
+345       if (this.queue[type][i].callback === fn) {
+346         queue = this.queue[type].splice(1, 1);
+347         delete queue;
+348       }
+349     }
+350   }
+351 
+352   // Reset the lock.
+353   this.lock = false;
+354 
+355   // Return the plugin.
+356   return this;
+357 };
+358 
+359 /**
+360  * Adds an item to the queue.
+361  *
+362  * @param {object} context The context which this is called within.
+363  * @param {string} event The event to trigger on.
+364  * @param {string} id The player ID.
+365  * @param {string} plugin The name of the plugin.
+366  * @param {function} callback Called when the event occurs.
+367  */
+368 minplayer.addQueue = function(context, event, id, plugin, callback) {
+369 
+370   // See if it is locked...
+371   if (!minplayer.lock) {
+372     minplayer.queue.push({
+373       context: context,
+374       id: id,
+375       event: event,
+376       plugin: plugin,
+377       callback: callback
+378     });
+379   }
+380   else {
+381 
+382     // If so, then try again after 10 milliseconds.
+383     setTimeout(function() {
+384       minplayer.addQueue(context, id, event, plugin, callback);
+385     }, 10);
+386   }
+387 };
+388 
+389 /**
+390  * Binds an event to a plugin instance, and if it doesn't exist, then caches
+391  * it for a later time.
+392  *
+393  * @param {string} event The event to trigger on.
+394  * @param {string} id The player ID.
+395  * @param {string} plugin The name of the plugin.
+396  * @param {function} callback Called when the event occurs.
+397  * @return {boolean} If the bind was successful.
+398  * @this The object in context who called this method.
+399  */
+400 minplayer.bind = function(event, id, plugin, callback) {
+401 
+402   // If no callback exists, then just return false.
+403   if (!callback) {
+404     return false;
+405   }
+406 
+407   // Get the plugins.
+408   var inst = minplayer.plugins;
+409 
+410   // See if this plugin exists.
+411   if (inst[id][plugin]) {
+412 
+413     // If so, then bind the event to this plugin.
+414     inst[id][plugin].bind(event, {context: this}, function(event, data) {
+415       callback.call(event.data.context, data.plugin);
+416     });
+417     return true;
+418   }
+419 
+420   // If not, then add it to the queue to bind later.
+421   minplayer.addQueue(this, event, id, plugin, callback);
+422 
+423   // Return that this wasn't handled.
+424   return false;
+425 };
+426 
+427 /**
+428  * The main API for minPlayer.
+429  *
+430  * Provided that this function takes three parameters, there are 8 different
+431  * ways to use this api.
+432  *
+433  *   id (0x100) - You want a specific player.
+434  *   plugin (0x010) - You want a specific plugin.
+435  *   callback (0x001) - You only want it when it is ready.
+436  *
+437  *   000 - You want all plugins from all players, ready or not.
+438  *
+439  *          var plugins = minplayer.get();
+440  *
+441  *   001 - You want all plugins from all players, but only when ready.
+442  *
+443  *          minplayer.get(function(plugin) {
+444  *            // Code goes here.
+445  *          });
+446  *
+447  *   010 - You want a specific plugin from all players, ready or not...
+448  *
+449  *          var medias = minplayer.get(null, 'media');
+450  *
+451  *   011 - You want a specific plugin from all players, but only when ready.
+452  *
+453  *          minplayer.get('player', function(player) {
+454  *            // Code goes here.
+455  *          });
+456  *
+457  *   100 - You want all plugins from a specific player, ready or not.
+458  *
+459  *          var plugins = minplayer.get('player_id');
+460  *
+461  *   101 - You want all plugins from a specific player, but only when ready.
+462  *
+463  *          minplayer.get('player_id', null, function(plugin) {
+464  *            // Code goes here.
+465  *          });
+466  *
+467  *   110 - You want a specific plugin from a specific player, ready or not.
+468  *
+469  *          var plugin = minplayer.get('player_id', 'media');
+470  *
+471  *   111 - You want a specific plugin from a specific player, only when ready.
+472  *
+473  *          minplayer.get('player_id', 'media', function(media) {
+474  *            // Code goes here.
+475  *          });
+476  *
+477  * @this The context in which this function was called.
+478  * @param {string} id The ID of the widget to get the plugins from.
+479  * @param {string} plugin The name of the plugin.
+480  * @param {function} callback Called when the plugin is ready.
+481  * @return {object} The plugin object if it is immediately available.
+482  */
+483 minplayer.get = function(id, plugin, callback) {
+484 
+485   // Normalize the arguments for a better interface.
+486   if (typeof id === 'function') {
+487     callback = id;
+488     plugin = id = null;
+489   }
+490 
+491   if (typeof plugin === 'function') {
+492     callback = plugin;
+493     plugin = id;
+494     id = null;
+495   }
+496 
+497   // Make sure the callback is a callback.
+498   callback = (typeof callback === 'function') ? callback : null;
+499 
+500   // Get the plugins.
+501   var plugins = minplayer.plugins;
+502 
+503   // 0x000
+504   if (!id && !plugin && !callback) {
+505     return plugins;
+506   }
+507   // 0x100
+508   else if (id && !plugin && !callback) {
+509     return plugins[id];
+510   }
+511   // 0x110
+512   else if (id && plugin && !callback) {
+513     return plugins[id][plugin];
+514   }
+515   // 0x111
+516   else if (id && plugin && callback) {
+517     minplayer.bind.call(this, 'ready', id, plugin, callback);
+518   }
+519   // 0x011
+520   else if (!id && plugin && callback) {
+521     for (var id in plugins) {
+522       minplayer.bind.call(this, 'ready', id, plugin, callback);
+523     }
+524   }
+525   // 0x101
+526   else if (id && !plugin && callback) {
+527     for (var plugin in plugins[id]) {
+528       minplayer.bind.call(this, 'ready', id, plugin, callback);
+529     }
+530   }
+531   // 0x010
+532   else if (!id && plugin && !callback) {
+533     var plugin_types = {};
+534     for (var id in plugins) {
+535       if (plugins.hasOwnProperty(id) && plugins[id].hasOwnProperty(plugin)) {
+536         plugin_types[id] = plugins[id][plugin];
+537       }
+538     }
+539     return plugin_types;
+540   }
+541   // 0x001
+542   else {
+543     for (var id in plugins) {
+544       for (var plugin in plugins[id]) {
+545         minplayer.bind.call(this, 'ready', id, plugin, callback);
+546       }
+547     }
+548   }
+549 };
+550 
\ No newline at end of file diff --git a/minplayer/doc/symbols/src/src_minplayer.templates.base.js.html b/minplayer/doc/symbols/src/src_minplayer.templates.base.js.html new file mode 100644 index 00000000..e4bdb5c8 --- /dev/null +++ b/minplayer/doc/symbols/src/src_minplayer.templates.base.js.html @@ -0,0 +1,66 @@ +
  1 /** The minplayer namespace. */
+  2 var minplayer = minplayer || {};
+  3 
+  4 /** All of the template implementations */
+  5 minplayer.templates = minplayer.templates || {};
+  6 
+  7 /**
+  8  * @constructor
+  9  * @extends minplayer.display
+ 10  * @class The base template class which all templates should derive.
+ 11  *
+ 12  * @param {object} context The jQuery context.
+ 13  * @param {object} options This components options.
+ 14  */
+ 15 minplayer.templates.base = function(context, options) {
+ 16 
+ 17   // Derive from display
+ 18   minplayer.display.call(this, 'template', context, options);
+ 19 };
+ 20 
+ 21 /** Derive from minplayer.display. */
+ 22 minplayer.templates.base.prototype = new minplayer.display();
+ 23 
+ 24 /** Reset the constructor. */
+ 25 minplayer.templates.base.prototype.constructor = minplayer.templates.base;
+ 26 
+ 27 /**
+ 28  * @see minplayer.plugin#construct
+ 29  */
+ 30 minplayer.templates.base.prototype.construct = function() {
+ 31 
+ 32   // Call the minplayer display constructor.
+ 33   minplayer.display.prototype.construct.call(this);
+ 34 
+ 35   // We are now ready.
+ 36   this.ready();
+ 37 };
+ 38 
+ 39 /**
+ 40  * @see minplayer.display#getElements
+ 41  * @return {object} The display elemnents for this component.
+ 42  */
+ 43 minplayer.templates.base.prototype.getElements = function() {
+ 44   var elements = minplayer.display.prototype.getElements.call(this);
+ 45   return jQuery.extend(elements, {
+ 46     player: null,
+ 47     display: null,
+ 48     media: null
+ 49   });
+ 50 };
+ 51 
+ 52 /**
+ 53  * Called when the media player goes into full screen mode.
+ 54  *
+ 55  * @param {boolean} full TRUE - The player is in fullscreen, FALSE otherwise.
+ 56  */
+ 57 minplayer.templates.base.prototype.onFullScreen = function(full) {
+ 58 };
+ 59 
\ No newline at end of file diff --git a/minplayer/README.txt b/minplayer/flash/README.txt similarity index 95% rename from minplayer/README.txt rename to minplayer/flash/README.txt index 944acc3c..e3515881 100755 --- a/minplayer/README.txt +++ b/minplayer/flash/README.txt @@ -1,6 +1,6 @@ The minplayer is a GPLv3, minimalistic, skinable, plugin based Flash media player. -In addition to being a minimal Flash player, it was built with a solid API so that any +In addition to being a minimal Flash player, it was built with a solid API so that any JavaScript widget can communicate to this player easily and effectively controlling it from outside sources. diff --git a/minplayer/config/config.xml b/minplayer/flash/config/config.xml similarity index 100% rename from minplayer/config/config.xml rename to minplayer/flash/config/config.xml diff --git a/minplayer/config/nocontrols.xml b/minplayer/flash/config/nocontrols.xml similarity index 100% rename from minplayer/config/nocontrols.xml rename to minplayer/flash/config/nocontrols.xml diff --git a/minplayer/minplayer.swf b/minplayer/flash/minplayer.swf similarity index 100% rename from minplayer/minplayer.swf rename to minplayer/flash/minplayer.swf diff --git a/minplayer/flash/skins/default/controlBar.swf b/minplayer/flash/skins/default/controlBar.swf new file mode 100644 index 00000000..95e2653b Binary files /dev/null and b/minplayer/flash/skins/default/controlBar.swf differ diff --git a/minplayer/flash/skins/default/mediaPlayer.swf b/minplayer/flash/skins/default/mediaPlayer.swf new file mode 100644 index 00000000..9c161535 Binary files /dev/null and b/minplayer/flash/skins/default/mediaPlayer.swf differ diff --git a/minplayer/flash/skins/default/playLoader.swf b/minplayer/flash/skins/default/playLoader.swf new file mode 100644 index 00000000..521c405e Binary files /dev/null and b/minplayer/flash/skins/default/playLoader.swf differ diff --git a/minplayer/index.html b/minplayer/index.html new file mode 100644 index 00000000..c5146343 --- /dev/null +++ b/minplayer/index.html @@ -0,0 +1,63 @@ + + + + minPlayer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

minPlayer

+

Below are some examples of the minPlayer in action. It is creating a common API to interact with all different types of players, including Vimeo and YouTube.

+

h264 Example

+
+ +
+

YouTube Example

+
+ +
+

Two YouTube Players on same page

+
+ +
+

Vimeo Example

+
+ +
+ + diff --git a/minplayer/makefile b/minplayer/makefile new file mode 100644 index 00000000..3e4036e0 --- /dev/null +++ b/minplayer/makefile @@ -0,0 +1,67 @@ +# To run this makefile, you must do the following. +# +# 1.) Download http://closure-compiler.googlecode.com/files/compiler-latest.zip +# and place compiler.jar within the tools directory. +# +# 2.) Install closure-linter tool at by following +# http://code.google.com/closure/utilities/docs/linter_howto.html +# +# 3.) Download the JSDoc toolkit found at +# http://code.google.com/p/jsdoc-toolkit and place the jsdoc-toolkit +# directory within the tools directory. + +# Create the list of files +files = src/minplayer.compatibility.js\ + src/minplayer.async.js\ + src/minplayer.flags.js\ + src/minplayer.plugin.js\ + src/minplayer.display.js\ + src/minplayer.js\ + src/minplayer.image.js\ + src/minplayer.file.js\ + src/minplayer.playLoader.js\ + src/minplayer.players.base.js\ + src/minplayer.players.html5.js\ + src/minplayer.players.flash.js\ + src/minplayer.players.minplayer.js\ + src/minplayer.players.youtube.js\ + src/minplayer.players.vimeo.js\ + src/minplayer.controller.js + +.DEFAULT_GOAL := all + +all: jslint js jsdoc + +# Perform a jsLint on all the files. +jslint: ${files} + gjslint $^ + +# Create an aggregated js file and a compressed js file. +js: ${files} + @echo "Generating aggregated bin/minplayer.js file" + @cat > bin/minplayer.js $^ + @echo "Generating compressed bin/minplayer.compressed file" + @java -jar tools/compiler.jar --js bin/minplayer.js --js_output_file bin/minplayer.compressed.js + +# Create the documentation from source code. +jsdoc: ${files} + @echo "Generating documetation." + @java -jar tools/jsdoc-toolkit/jsrun.jar tools/jsdoc-toolkit/app/run.js -a -t=tools/jsdoc-toolkit/templates/jsdoc -d=doc $^ + +# Fix the js style on all the files. +fixjsstyle: ${files} + fixjsstyle $^ + +# Install the necessary tools. +tools: + apt-get install python-setuptools + apt-get install unzip + wget http://closure-compiler.googlecode.com/files/compiler-latest.zip -P tools + unzip tools/compiler-latest.zip -d tools + rm tools/compiler-latest.zip tools/COPYING tools/README + easy_install http://closure-linter.googlecode.com/files/closure_linter-latest.tar.gz + wget http://jsdoc-toolkit.googlecode.com/files/jsdoc_toolkit-2.4.0.zip -P tools + unzip tools/jsdoc_toolkit-2.4.0.zip -d tools + mv tools/jsdoc_toolkit-2.4.0/jsdoc-toolkit tools/jsdoc-toolkit + rm -rd tools/jsdoc_toolkit-2.4.0 + rm tools/jsdoc_toolkit-2.4.0.zip diff --git a/minplayer/minplayer.fla b/minplayer/minplayer.fla deleted file mode 100755 index 23954bff..00000000 Binary files a/minplayer/minplayer.fla and /dev/null differ diff --git a/minplayer/skins/default/controlBar.as b/minplayer/skins/default/controlBar.as deleted file mode 100644 index 8371e3e1..00000000 --- a/minplayer/skins/default/controlBar.as +++ /dev/null @@ -1,168 +0,0 @@ -import fl.transitions.*; -import fl.transitions.easing.*; -import flash.external.ExternalInterface; - -var mouseOverVolume = false; -var mouseOverControls = false; - -var mouseTimer:Timer = new Timer( 4000, 1 ); -mouseTimer.stop(); -mouseTimer.addEventListener( TimerEvent.TIMER, onMouseTimer ); - -var volumeTimer:Timer = new Timer( 4000, 1 ); -volumeTimer.stop(); -volumeTimer.addEventListener( TimerEvent.TIMER, onVolumeTimer ); - -var controlTween = new Tween( this, "alpha", Strong.easeIn, this.alpha, 0, 8 ); -controlTween.stop(); - -var volumeTween = new Tween(volumeBar, "alpha", Strong.easeIn, volumeBar.alpha, 0, 8 ); -volumeTween.stop(); - -// The ControlBar object. -var controlBar = null; - -function initialize( _controlBar:* ) -{ - // Store the controlbar object. - controlBar = _controlBar; - - // Set the y position to the bottom of the player.. - this.y = (controlBar.stage.stageHeight - background.height - 10); - - // Hide the volume bar for now... - volumeBar.visible = false; - - // Set the full and normal screen buttons. - toggleFullScreen.normalScreen.visible = false; - toggleFullScreen.fullScreen.visible = true; - - // Add an event listner when the mouse is over the mute button. - mute.addEventListener( MouseEvent.MOUSE_OVER, onVolumeMuteOver ); - volumeBar.addEventListener( MouseEvent.MOUSE_OVER, onVolumeOver ); - volumeBar.addEventListener( MouseEvent.MOUSE_OUT, onVolumeOut ); - - controlBar.stage.addEventListener( MouseEvent.MOUSE_MOVE, onMove ); - this.addEventListener( MouseEvent.MOUSE_OVER, onControlOver ); - this.addEventListener( MouseEvent.MOUSE_OUT, onControlOut ); - mouseTimer.reset(); - mouseTimer.start(); - - // Set the size. - setSize( controlBar.stage.stageWidth ); -} - -function onVolumeOver( event:MouseEvent ) { mouseOverVolume = true; } -function onVolumeOut( event:MouseEvent ) { mouseOverVolume = false; } -function onControlOver( event:MouseEvent ) { mouseOverControls = true; } -function onControlOut( event:MouseEvent ) { mouseOverControls = false; } -function onVolumeMuteOver( event:MouseEvent ) { showVolume(); } -function onMove( event:MouseEvent ) { showControls(); } - -function onMouseTimer( event:TimerEvent ) -{ - if(!mouseOverControls && !mouseOverVolume) { - controlTween.begin = this.alpha; - controlTween.finish = 0; - controlTween.start(); - } - else { - mouseTimer.reset(); - mouseTimer.start(); - } -} - -function onVolumeTimer( event:TimerEvent ) -{ - if(!mouseOverVolume) { - volumeTween.begin = volumeBar.alpha; - volumeTween.finish = 0; - volumeTween.start(); - } - else { - volumeTimer.reset(); - volumeTimer.start(); - } -} - -function showControls() -{ - controlTween.stop(); - this.visible = true; - this.alpha = 1; - mouseTimer.reset(); - mouseTimer.start(); -} - -function showVolume() -{ - volumeTween.stop(); - volumeBar.visible = true; - volumeBar.alpha = 1; - volumeTimer.reset(); - volumeTimer.start(); -} - -function onResize( deltaX:Number, deltaY:Number ) -{ - this.y = this.y + deltaY; - setFullScreenState(); - setSize( controlBar.stage.stageWidth ); - showControls(); -} - -function setFullScreenState() -{ - if( controlBar.stage.displayState == StageDisplayState.FULL_SCREEN ) { - toggleFullScreen.normalScreen.visible = true; - toggleFullScreen.fullScreen.visible = false; - } - else { - toggleFullScreen.normalScreen.visible = false; - toggleFullScreen.fullScreen.visible = true; - } -} - -function setSize( newWidth:Number ) -{ - var bgWidth = background.width; - toggleFullScreen.x = newWidth - (bgWidth - toggleFullScreen.x); - mute.x = newWidth - (bgWidth - mute.x); - duration.x = newWidth - (bgWidth - duration.x); - volumeBar.x = newWidth - (bgWidth - volumeBar.x); - seekBar.track.width = newWidth - (bgWidth - seekBar.track.width); - seekBar.fullness.width = newWidth - (bgWidth - seekBar.fullness.width); - seekBar.progress.width = newWidth - (bgWidth - seekBar.progress.width); - if( controlBar.seekBar && controlBar.seekBar.track ) { - controlBar.seekBar.track.width = seekBar.track.width; - } - if( controlBar.seekBar && controlBar.seekBar.fullness ) { - controlBar.seekBar.fullness.width = seekBar.fullness.width; - } - background.width = newWidth; -} - -function formatTime(mediaTime:Number) : Object -{ - var seconds:Number = 0; - var minutes:Number = 0; - var hour:Number = 0; - - hour = Math.floor(mediaTime / 3600); - mediaTime -= (hour * 3600); - minutes = Math.floor( mediaTime / 60 ); - mediaTime -= (minutes * 60); - seconds = Math.floor(mediaTime % 60); - - var timeString:String = ""; - - if( hour ) { - timeString += String(hour); - timeString += ":"; - } - - timeString += (minutes >= 10) ? String(minutes) : ("0" + String(minutes)); - timeString += ":"; - timeString += (seconds >= 10) ? String(seconds) : ("0" + String(seconds)); - return {time:timeString, units:""}; -} \ No newline at end of file diff --git a/minplayer/skins/default/controlBar.fla b/minplayer/skins/default/controlBar.fla deleted file mode 100644 index 5262824c..00000000 Binary files a/minplayer/skins/default/controlBar.fla and /dev/null differ diff --git a/minplayer/skins/default/controlBar.swf b/minplayer/skins/default/controlBar.swf deleted file mode 100644 index dfb2f683..00000000 Binary files a/minplayer/skins/default/controlBar.swf and /dev/null differ diff --git a/minplayer/skins/default/mediaPlayer.as b/minplayer/skins/default/mediaPlayer.as deleted file mode 100644 index cab52ccb..00000000 --- a/minplayer/skins/default/mediaPlayer.as +++ /dev/null @@ -1,14 +0,0 @@ -function initialize( mediaPlayer:* ) -{ - backgroundMC.width = mediaPlayer.stage.stageWidth; - backgroundMC.height = mediaPlayer.stage.stageHeight; -} - -function onResize( deltaX:Number, deltaY:Number ) : void -{ - backgroundMC.width = backgroundMC.width + deltaX; - backgroundMC.height = backgroundMC.height + deltaY; - - // Now resize the preview. - preview.resize( backgroundMC.getRect(this) ); -} \ No newline at end of file diff --git a/minplayer/skins/default/mediaPlayer.fla b/minplayer/skins/default/mediaPlayer.fla deleted file mode 100644 index 61eda11f..00000000 Binary files a/minplayer/skins/default/mediaPlayer.fla and /dev/null differ diff --git a/minplayer/skins/default/mediaPlayer.swf b/minplayer/skins/default/mediaPlayer.swf deleted file mode 100644 index 3eae131e..00000000 Binary files a/minplayer/skins/default/mediaPlayer.swf and /dev/null differ diff --git a/minplayer/skins/default/playLoader.as b/minplayer/skins/default/playLoader.as deleted file mode 100644 index 2b38e949..00000000 --- a/minplayer/skins/default/playLoader.as +++ /dev/null @@ -1,24 +0,0 @@ -function initialize( playLoader:* ) -{ - backgroundMC.width = playLoader.stage.stageWidth; - backgroundMC.height = playLoader.stage.stageHeight; - - // Set the x position to the middle of the stage. - playButton.x = (playLoader.stage.stageWidth - playButton.width) / 2; - playButton.y = (playLoader.stage.stageHeight - playButton.height) / 2; - - loader.x = (playLoader.stage.stageWidth - loader.width) / 2; - loader.y = (playLoader.stage.stageHeight - loader.height) / 2; -} - -function onResize( deltaX:Number, deltaY:Number ) : void -{ - backgroundMC.width = backgroundMC.width + deltaX; - backgroundMC.height = backgroundMC.height + deltaY; - - playButton.x = playButton.x + (deltaX / 2); - playButton.y = playButton.y + (deltaY / 2); - - loader.x = loader.x + (deltaX / 2); - loader.y = loader.y + (deltaY / 2); -} \ No newline at end of file diff --git a/minplayer/skins/default/playLoader.fla b/minplayer/skins/default/playLoader.fla deleted file mode 100644 index f5d0cf77..00000000 Binary files a/minplayer/skins/default/playLoader.fla and /dev/null differ diff --git a/minplayer/skins/default/playLoader.swf b/minplayer/skins/default/playLoader.swf deleted file mode 100644 index 2e9a4606..00000000 Binary files a/minplayer/skins/default/playLoader.swf and /dev/null differ diff --git a/minplayer/skins/goldstandard/controlBar.as b/minplayer/skins/goldstandard/controlBar.as deleted file mode 100644 index e4a077b2..00000000 --- a/minplayer/skins/goldstandard/controlBar.as +++ /dev/null @@ -1,78 +0,0 @@ -import fl.transitions.*; -import fl.transitions.easing.*; - -var mouseTimer:Timer = new Timer( 4000, 1 ); -mouseTimer.stop(); -mouseTimer.addEventListener( TimerEvent.TIMER, onMouseTimer ); - -var controlTween = new Tween( this, "alpha", Strong.easeIn, this.alpha, 0, 8 ); -controlTween.stop(); - -//Hides the menuButton on the controlBar. -//menuButton.visible = false; - -function initialize( controlBar:* ) -{ - // Set the x position to the middle of the stage. - this.x = (controlBar.stage.stageWidth - this.width) / 2; - - // Set the y position to the bottom of the player.. - this.y = (controlBar.stage.stageHeight - this.height - 10); - - controlBar.stage.addEventListener( MouseEvent.MOUSE_MOVE, onMove ); - mouseTimer.reset(); - mouseTimer.start(); -} - -function onMove( event:MouseEvent ) -{ - showControls(); -} - -function onMouseTimer( event:TimerEvent ) -{ - controlTween.begin = this.alpha; - controlTween.finish = 0; - controlTween.start(); -} - -function showControls() -{ - controlTween.stop(); - this.visible = true; - this.alpha = 1; - mouseTimer.reset(); - mouseTimer.start(); -} - -function onResize( deltaX:Number, deltaY:Number ) -{ - this.x = this.x + (deltaX / 2); - this.y = this.y + deltaY; - showControls(); -} - -function formatTime(mediaTime:Number) : Object -{ - var seconds:Number = 0; - var minutes:Number = 0; - var hour:Number = 0; - - hour = Math.floor(mediaTime / 3600); - mediaTime -= (hour * 3600); - minutes = Math.floor( mediaTime / 60 ); - mediaTime -= (minutes * 60); - seconds = Math.floor(mediaTime % 60); - - var timeString:String = ""; - - if( hour ) { - timeString += String(hour); - timeString += ":"; - } - - timeString += (minutes >= 10) ? String(minutes) : ("0" + String(minutes)); - timeString += ":"; - timeString += (seconds >= 10) ? String(seconds) : ("0" + String(seconds)); - return {time:timeString, units:""}; -} \ No newline at end of file diff --git a/minplayer/skins/goldstandard/controlBar.fla b/minplayer/skins/goldstandard/controlBar.fla deleted file mode 100644 index dca6a468..00000000 Binary files a/minplayer/skins/goldstandard/controlBar.fla and /dev/null differ diff --git a/minplayer/skins/goldstandard/controlBar.swf b/minplayer/skins/goldstandard/controlBar.swf deleted file mode 100644 index 311e1f2b..00000000 Binary files a/minplayer/skins/goldstandard/controlBar.swf and /dev/null differ diff --git a/minplayer/skins/goldstandard/mediaPlayer.as b/minplayer/skins/goldstandard/mediaPlayer.as deleted file mode 100644 index ba2093c6..00000000 --- a/minplayer/skins/goldstandard/mediaPlayer.as +++ /dev/null @@ -1,14 +0,0 @@ -function initialize( mediaPlayer:* ) -{ - backgroundMC.width = mediaPlayer.stage.stageWidth; - backgroundMC.height = mediaPlayer.stage.stageHeight; -} - -function onResize( deltaX:Number, deltaY:Number ) : void -{ - backgroundMC.width = backgroundMC.width + deltaX; - backgroundMC.height = backgroundMC.height + deltaY; - - // Now resize the preview. - preview.resize( backgroundMC.getRect(this) ); -} \ No newline at end of file diff --git a/minplayer/skins/goldstandard/mediaPlayer.fla b/minplayer/skins/goldstandard/mediaPlayer.fla deleted file mode 100644 index 61eda11f..00000000 Binary files a/minplayer/skins/goldstandard/mediaPlayer.fla and /dev/null differ diff --git a/minplayer/skins/goldstandard/mediaPlayer.swf b/minplayer/skins/goldstandard/mediaPlayer.swf deleted file mode 100644 index c39d729f..00000000 Binary files a/minplayer/skins/goldstandard/mediaPlayer.swf and /dev/null differ diff --git a/minplayer/skins/goldstandard/playLoader.as b/minplayer/skins/goldstandard/playLoader.as deleted file mode 100644 index ca965b6e..00000000 --- a/minplayer/skins/goldstandard/playLoader.as +++ /dev/null @@ -1,24 +0,0 @@ -function initialize( playLoader:* ) -{ - backgroundMC.width = playLoader.stage.stageWidth; - backgroundMC.height = playLoader.stage.stageHeight; - - // Set the x position to the middle of the stage. - playButton.x = (playLoader.stage.stageWidth - playButton.width) / 2; - playButton.y = (playLoader.stage.stageHeight - playButton.height) / 2; - - loader.x = (playLoader.stage.stageWidth - loader.width) / 2; - loader.y = (playLoader.stage.stageHeight - loader.height) / 2; -} - -function onResize( deltaX:Number, deltaY:Number ) : void -{ - backgroundMC.width = backgroundMC.width + deltaX; - backgroundMC.height = backgroundMC.height + deltaY; - - playButton.x = playButton.x + (deltaX / 2); - playButton.y = playButton.y + (deltaY / 2); - - loader.x = loader.x + (deltaX / 2); - loader.y = loader.y + (deltaY / 2); -} \ No newline at end of file diff --git a/minplayer/skins/goldstandard/playLoader.fla b/minplayer/skins/goldstandard/playLoader.fla deleted file mode 100644 index f5d0cf77..00000000 Binary files a/minplayer/skins/goldstandard/playLoader.fla and /dev/null differ diff --git a/minplayer/skins/goldstandard/playLoader.swf b/minplayer/skins/goldstandard/playLoader.swf deleted file mode 100644 index cdda72cb..00000000 Binary files a/minplayer/skins/goldstandard/playLoader.swf and /dev/null differ diff --git a/minplayer/skins/shockblack/controlBar.as b/minplayer/skins/shockblack/controlBar.as deleted file mode 100644 index bdc7eba2..00000000 --- a/minplayer/skins/shockblack/controlBar.as +++ /dev/null @@ -1,216 +0,0 @@ -import fl.transitions.*; -import fl.transitions.easing.*; -import flash.external.ExternalInterface; - -var mouseOverVolume = false; -var mouseOverControls = false; - -var mouseTimer:Timer = new Timer( 4000, 1 ); -mouseTimer.stop(); -mouseTimer.addEventListener( TimerEvent.TIMER, onMouseTimer ); - -var volumeTimer:Timer = new Timer( 4000, 1 ); -volumeTimer.stop(); -volumeTimer.addEventListener( TimerEvent.TIMER, onVolumeTimer ); - -var controlTween = new Tween( this, "alpha", Strong.easeIn, this.alpha, 0, 8 ); -controlTween.stop(); - -var volumeTween = new Tween(volumeBar, "alpha", Strong.easeIn, volumeBar.alpha, 0, 8 ); -volumeTween.stop(); - -// The ControlBar object. -var controlBar = null; - -//Hides the menuButton on the controlBar. -//menuButton.visible = false; - -function initialize( _controlBar:* ) -{ - // Store the controlbar object. - controlBar = _controlBar; - - // Set the y position to the bottom of the player.. - this.y = (controlBar.stage.stageHeight - this.height - 5); - - // Hide the volume bar for now... - volumeBar.visible = false; - - // Set the full and normal screen buttons. - toggleFullScreen.normalScreen.visible = false; - toggleFullScreen.fullScreen.visible = true; - - // Add an event listner when the mouse is over the mute button. - mute.addEventListener( MouseEvent.MOUSE_OVER, onVolumeMuteOver ); - mute.buttonMode = true; - mute.mouseChildren = false; - - volumeBar.addEventListener( MouseEvent.MOUSE_OVER, onVolumeOver ); - volumeBar.addEventListener( MouseEvent.MOUSE_OUT, onVolumeOut ); - - controlBar.stage.addEventListener( MouseEvent.MOUSE_MOVE, onMove ); - this.addEventListener( MouseEvent.MOUSE_OVER, onControlOver ); - this.addEventListener( MouseEvent.MOUSE_OUT, onControlOut ); - mouseTimer.reset(); - mouseTimer.start(); - - // Add event listener for the prev and next buttons. - prev.addEventListener( MouseEvent.CLICK, onPrev ); - prev.buttonMode = true; - prev.mouseChildren = false; - - next.addEventListener( MouseEvent.CLICK, onNext ); - next.buttonMode = true; - next.mouseChildren = false; - - // Add an event handler when they click on the menu. - menu.addEventListener( MouseEvent.CLICK, onMenu ); - menu.buttonMode = true; - menu.mouseChildren = false; - - // Add the callbacks to control the tile. - ExternalInterface.addCallback("setTitle", setTitle); - - // Set the size. - setSize( controlBar.stage.stageWidth ); -} - -// Set the title of the control bar. -function setTitle( newTitle:String ) -{ - title.text = newTitle; -} - -function onPrev(event:MouseEvent) -{ - ExternalInterface.call("jQuery.media.loadPrev"); -} - -function onNext(event:MouseEvent) -{ - ExternalInterface.call("jQuery.media.loadNext"); -} - -function onVolumeOver( event:MouseEvent ) { mouseOverVolume = true; } -function onVolumeOut( event:MouseEvent ) { mouseOverVolume = false; } -function onControlOver( event:MouseEvent ) { mouseOverControls = true; } -function onControlOut( event:MouseEvent ) { mouseOverControls = false; } -function onVolumeMuteOver( event:MouseEvent ) { showVolume(); } -function onMove( event:MouseEvent ) { showControls(); } - -function onMouseTimer( event:TimerEvent ) -{ - if(!mouseOverControls && !mouseOverVolume) { - controlTween.begin = this.alpha; - controlTween.finish = 0; - controlTween.start(); - } - else { - mouseTimer.reset(); - mouseTimer.start(); - } -} - -function onVolumeTimer( event:TimerEvent ) -{ - if(!mouseOverVolume) { - volumeTween.begin = volumeBar.alpha; - volumeTween.finish = 0; - volumeTween.start(); - } - else { - volumeTimer.reset(); - volumeTimer.start(); - } -} - -function onMenu( event:MouseEvent ) -{ - ExternalInterface.call( "onFlashPlayerMenu", controlBar.getSettings().id ); -} - -function showControls() -{ - controlTween.stop(); - this.visible = true; - this.alpha = 1; - mouseTimer.reset(); - mouseTimer.start(); -} - -function showVolume() -{ - volumeTween.stop(); - volumeBar.visible = true; - volumeBar.alpha = 1; - volumeTimer.reset(); - volumeTimer.start(); -} - -function onResize( deltaX:Number, deltaY:Number ) -{ - this.y = this.y + deltaY; - setFullScreenState(); - setSize( controlBar.stage.stageWidth ); - showControls(); -} - -function setFullScreenState() -{ - if( controlBar.stage.displayState == StageDisplayState.FULL_SCREEN ) { - toggleFullScreen.normalScreen.visible = true; - toggleFullScreen.fullScreen.visible = false; - } - else { - toggleFullScreen.normalScreen.visible = false; - toggleFullScreen.fullScreen.visible = true; - } -} - -function setSize( newWidth:Number ) -{ - var bgWidth = background.width; - toggleFullScreen.x = newWidth - (bgWidth - toggleFullScreen.x); - mute.x = newWidth - (bgWidth - mute.x); - next.x = newWidth - (bgWidth - next.x); - duration.x = newWidth - (bgWidth - duration.x); - volumeBar.x = newWidth - (bgWidth - volumeBar.x); - menu.x = newWidth - (bgWidth - menu.x); - textBack.width = newWidth - (bgWidth - textBack.width); - title.width = newWidth - (bgWidth - title.width); - seekBar.track.width = newWidth - (bgWidth - seekBar.track.width); - seekBar.fullness.width = newWidth - (bgWidth - seekBar.fullness.width); - seekBar.progress.width = newWidth - (bgWidth - seekBar.progress.width); - if( controlBar.seekBar && controlBar.seekBar.track ) { - controlBar.seekBar.track.width = seekBar.track.width; - } - if( controlBar.seekBar && controlBar.seekBar.fullness ) { - controlBar.seekBar.fullness.width = seekBar.fullness.width; - } - background.width = newWidth; -} - -function formatTime(mediaTime:Number) : Object -{ - var seconds:Number = 0; - var minutes:Number = 0; - var hour:Number = 0; - - hour = Math.floor(mediaTime / 3600); - mediaTime -= (hour * 3600); - minutes = Math.floor( mediaTime / 60 ); - mediaTime -= (minutes * 60); - seconds = Math.floor(mediaTime % 60); - - var timeString:String = ""; - - if( hour ) { - timeString += String(hour); - timeString += ":"; - } - - timeString += (minutes >= 10) ? String(minutes) : ("0" + String(minutes)); - timeString += ":"; - timeString += (seconds >= 10) ? String(seconds) : ("0" + String(seconds)); - return {time:timeString, units:""}; -} \ No newline at end of file diff --git a/minplayer/skins/shockblack/controlBar.fla b/minplayer/skins/shockblack/controlBar.fla deleted file mode 100644 index 4b6aae96..00000000 Binary files a/minplayer/skins/shockblack/controlBar.fla and /dev/null differ diff --git a/minplayer/skins/shockblack/controlBar.swf b/minplayer/skins/shockblack/controlBar.swf deleted file mode 100644 index bd770856..00000000 Binary files a/minplayer/skins/shockblack/controlBar.swf and /dev/null differ diff --git a/minplayer/skins/shockblack/mediaPlayer.as b/minplayer/skins/shockblack/mediaPlayer.as deleted file mode 100644 index cab52ccb..00000000 --- a/minplayer/skins/shockblack/mediaPlayer.as +++ /dev/null @@ -1,14 +0,0 @@ -function initialize( mediaPlayer:* ) -{ - backgroundMC.width = mediaPlayer.stage.stageWidth; - backgroundMC.height = mediaPlayer.stage.stageHeight; -} - -function onResize( deltaX:Number, deltaY:Number ) : void -{ - backgroundMC.width = backgroundMC.width + deltaX; - backgroundMC.height = backgroundMC.height + deltaY; - - // Now resize the preview. - preview.resize( backgroundMC.getRect(this) ); -} \ No newline at end of file diff --git a/minplayer/skins/shockblack/mediaPlayer.fla b/minplayer/skins/shockblack/mediaPlayer.fla deleted file mode 100644 index 61eda11f..00000000 Binary files a/minplayer/skins/shockblack/mediaPlayer.fla and /dev/null differ diff --git a/minplayer/skins/shockblack/mediaPlayer.swf b/minplayer/skins/shockblack/mediaPlayer.swf deleted file mode 100644 index 97315348..00000000 Binary files a/minplayer/skins/shockblack/mediaPlayer.swf and /dev/null differ diff --git a/minplayer/skins/shockblack/playLoader.as b/minplayer/skins/shockblack/playLoader.as deleted file mode 100644 index 2b38e949..00000000 --- a/minplayer/skins/shockblack/playLoader.as +++ /dev/null @@ -1,24 +0,0 @@ -function initialize( playLoader:* ) -{ - backgroundMC.width = playLoader.stage.stageWidth; - backgroundMC.height = playLoader.stage.stageHeight; - - // Set the x position to the middle of the stage. - playButton.x = (playLoader.stage.stageWidth - playButton.width) / 2; - playButton.y = (playLoader.stage.stageHeight - playButton.height) / 2; - - loader.x = (playLoader.stage.stageWidth - loader.width) / 2; - loader.y = (playLoader.stage.stageHeight - loader.height) / 2; -} - -function onResize( deltaX:Number, deltaY:Number ) : void -{ - backgroundMC.width = backgroundMC.width + deltaX; - backgroundMC.height = backgroundMC.height + deltaY; - - playButton.x = playButton.x + (deltaX / 2); - playButton.y = playButton.y + (deltaY / 2); - - loader.x = loader.x + (deltaX / 2); - loader.y = loader.y + (deltaY / 2); -} \ No newline at end of file diff --git a/minplayer/skins/shockblack/playLoader.fla b/minplayer/skins/shockblack/playLoader.fla deleted file mode 100644 index f5d0cf77..00000000 Binary files a/minplayer/skins/shockblack/playLoader.fla and /dev/null differ diff --git a/minplayer/skins/shockblack/playLoader.swf b/minplayer/skins/shockblack/playLoader.swf deleted file mode 100644 index 34159117..00000000 Binary files a/minplayer/skins/shockblack/playLoader.swf and /dev/null differ diff --git a/minplayer/src/minplayer.async.js b/minplayer/src/minplayer.async.js new file mode 100644 index 00000000..656aa110 --- /dev/null +++ b/minplayer/src/minplayer.async.js @@ -0,0 +1,61 @@ +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** + * @constructor + * @class This class keeps track of asynchronous get requests for certain + * variables within the player. + */ +minplayer.async = function() { + + /** The final value of this asynchronous variable. */ + this.value = null; + + /** The queue of callbacks to call when this value is determined. */ + this.queue = []; +}; + +/** + * Retrieve the value of this variable. + * + * @param {function} callback The function to call when the value is determined. + * @param {function} pollValue The poll function to try and get the value every + * 1 second if the value is not set. + */ +minplayer.async.prototype.get = function(callback, pollValue) { + + // If the value is set, then immediately call the callback, otherwise, just + // add it to the queue when the variable is set. + if (this.value !== null) { + callback(this.value); + } + else { + + // Add this callback to the queue. + this.queue.push(callback); + } +}; + +/** + * Sets the value of an asynchronous value. + * + * @param {void} val The value to set. + */ +minplayer.async.prototype.set = function(val) { + + // Set the value. + this.value = val; + + // Get the callback queue length. + var i = this.queue.length; + + // Iterate through all the callbacks and call them. + if (i) { + while (i--) { + this.queue[i](val); + } + + // Reset the queue. + this.queue = []; + } +}; diff --git a/minplayer/src/minplayer.compatibility.js b/minplayer/src/minplayer.compatibility.js new file mode 100644 index 00000000..0a0dbf71 --- /dev/null +++ b/minplayer/src/minplayer.compatibility.js @@ -0,0 +1,101 @@ +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +// Private function to check a single element's play type. +function checkPlayType(elem, playType) { + if ((typeof elem.canPlayType) === 'function') { + if (typeof playType === 'object') { + var i = playType.length; + var mimetype = ''; + while (i--) { + mimetype = checkPlayType(elem, playType[i]); + if (!!mimetype) { + break; + } + } + return mimetype; + } + else { + var canPlay = elem.canPlayType(playType); + if (('no' !== canPlay) && ('' !== canPlay)) { + return playType; + } + } + } + return ''; +} + +/** + * @constructor + * @class This class is used to define the types of media that can be played + * within the browser. + *

+ * Usage: + *


+ *   var playTypes = new minplayer.compatibility();
+ *
+ *   if (playTypes.videoOGG) {
+ *     console.log("This browser can play OGG video");
+ *   }
+ *
+ *   if (playTypes.videoH264) {
+ *     console.log("This browser can play H264 video");
+ *   }
+ *
+ *   if (playTypes.videoWEBM) {
+ *     console.log("This browser can play WebM video");
+ *   }
+ *
+ *   if (playTypes.audioOGG) {
+ *     console.log("This browser can play OGG audio");
+ *   }
+ *
+ *   if (playTypes.audioMP3) {
+ *     console.log("This browser can play MP3 audio");
+ *   }
+ *
+ *   if (playTypes.audioMP4) {
+ *     console.log("This browser can play MP4 audio");
+ *   }
+ * 
+ */ +minplayer.compatibility = function() { + var elem = null; + + // Create a video element. + elem = document.createElement('video'); + + /** Can play OGG video */ + this.videoOGG = checkPlayType(elem, 'video/ogg'); + + /** Can play H264 video */ + this.videoH264 = checkPlayType(elem, [ + 'video/mp4', + 'video/h264' + ]); + + /** Can play WEBM video */ + this.videoWEBM = checkPlayType(elem, [ + 'video/x-webm', + 'video/webm', + 'application/octet-stream' + ]); + + // Create an audio element. + elem = document.createElement('audio'); + + /** Can play audio OGG */ + this.audioOGG = checkPlayType(elem, 'audio/ogg'); + + /** Can play audio MP3 */ + this.audioMP3 = checkPlayType(elem, 'audio/mpeg'); + + /** Can play audio MP4 */ + this.audioMP4 = checkPlayType(elem, 'audio/mp4'); +}; + +if (!minplayer.playTypes) { + + /** The compatible playtypes for this browser. */ + minplayer.playTypes = new minplayer.compatibility(); +} diff --git a/minplayer/src/minplayer.controller.js b/minplayer/src/minplayer.controller.js new file mode 100644 index 00000000..5db6870c --- /dev/null +++ b/minplayer/src/minplayer.controller.js @@ -0,0 +1,312 @@ +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** + * @constructor + * @extends minplayer.display + * @class This is the base minplayer controller. Other controllers can derive + * from the base and either build on top of it or simply define the elements + * that this base controller uses. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +minplayer.controller = function(context, options) { + + // Derive from display + minplayer.display.call(this, 'controller', context, options); +}; + +/** Derive from minplayer.display. */ +minplayer.controller.prototype = new minplayer.display(); + +/** Reset the constructor. */ +minplayer.controller.prototype.constructor = minplayer.controller; + +/** + * A static function that will format a time value into a string time format. + * + * @param {integer} time An integer value of time. + * @return {string} A string representation of the time. + */ +minplayer.formatTime = function(time) { + time = time || 0; + var seconds = 0, minutes = 0, hour = 0, timeString = ''; + + hour = Math.floor(time / 3600); + time -= (hour * 3600); + minutes = Math.floor(time / 60); + time -= (minutes * 60); + seconds = Math.floor(time % 60); + + if (hour) { + timeString += String(hour); + timeString += ':'; + } + + timeString += (minutes >= 10) ? String(minutes) : ('0' + String(minutes)); + timeString += ':'; + timeString += (seconds >= 10) ? String(seconds) : ('0' + String(seconds)); + return {time: timeString, units: ''}; +}; + +/** + * @see minplayer.display#getElements + * @return {object} The elements defined by this display. + */ +minplayer.controller.prototype.getElements = function() { + var elements = minplayer.display.prototype.getElements.call(this); + return jQuery.extend(elements, { + play: null, + pause: null, + fullscreen: null, + seek: null, + progress: null, + volume: null, + timer: null + }); +}; + +/** + * @see minplayer.plugin#construct + */ +minplayer.controller.prototype.construct = function() { + + // Call the minplayer plugin constructor. + minplayer.display.prototype.construct.call(this); + + // Keep track of if we are dragging... + this.dragging = false; + + // If they have a seek bar. + if (this.elements.seek) { + + // Create the seek bar slider control. + this.seekBar = this.elements.seek.slider({ + range: 'min' + }); + } + + // If they have a volume bar. + if (this.elements.volume) { + + // Create the volume bar slider control. + this.volumeBar = this.elements.volume.slider({ + range: 'min', + orientation: 'vertical' + }); + } + + // Get the player plugin. + this.get('player', function(player) { + + // If they have a fullscreen button. + if (this.elements.fullscreen) { + + // Bind to the click event. + this.elements.fullscreen.unbind().bind('click', function(e) { + + // Toggle fullscreen mode. + player.toggleFullScreen(); + }).css({'pointer' : 'hand'}); + } + }); + + // Get the media plugin. + this.get('media', function(media) { + + // If they have a pause button + if (this.elements.pause) { + + // Bind to the click on this button. + this.elements.pause.unbind().bind('click', (function(controller) { + return function(event) { + event.preventDefault(); + controller.playPause(false, media); + }; + })(this)); + + // Bind to the pause event of the media. + media.bind('pause', (function(controller) { + return function(event) { + controller.setPlayPause(true); + }; + })(this)); + } + + // If they have a play button + if (this.elements.play) { + + // Bind to the click on this button. + this.elements.play.unbind().bind('click', (function(controller) { + return function(event) { + event.preventDefault(); + controller.playPause(true, media); + }; + })(this)); + + // Bind to the play event of the media. + media.bind('playing', (function(controller) { + return function(event) { + controller.setPlayPause(false); + }; + })(this)); + } + + // If they have a duration, then trigger on duration change. + if (this.elements.duration) { + + // Bind to the duration change event. + media.bind('durationchange', (function(controller) { + return function(event, data) { + controller.setTimeString('duration', data.duration); + }; + })(this)); + + // Set the timestring to the duration. + media.getDuration((function(controller) { + return function(duration) { + controller.setTimeString('duration', duration); + }; + })(this)); + } + + // If they have a progress element. + if (this.elements.progress) { + + // Bind to the progress event. + media.bind('progress', (function(controller) { + return function(event, data) { + var percent = data.total ? (data.loaded / data.total) * 100 : 0; + controller.elements.progress.width(percent + '%'); + }; + })(this)); + } + + // If they have a seek bar or timer, bind to the timeupdate. + if (this.seekBar || this.elements.timer) { + + // Bind to the time update event. + media.bind('timeupdate', (function(controller) { + return function(event, data) { + if (!controller.dragging) { + var value = 0; + if (data.duration) { + value = (data.currentTime / data.duration) * 100; + } + + // Update the seek bar if it exists. + if (controller.seekBar) { + controller.seekBar.slider('option', 'value', value); + } + + controller.setTimeString('timer', data.currentTime); + } + }; + })(this)); + } + + // If they have a seekBar element. + if (this.seekBar) { + + // Register the events for the control bar to control the media. + this.seekBar.slider({ + start: (function(controller) { + return function(event, ui) { + controller.dragging = true; + }; + })(this), + stop: (function(controller) { + return function(event, ui) { + controller.dragging = false; + media.getDuration(function(duration) { + media.seek((ui.value / 100) * duration); + }); + }; + })(this), + slide: (function(controller) { + return function(event, ui) { + media.getDuration(function(duration) { + var time = (ui.value / 100) * duration; + if (!controller.dragging) { + media.seek(time); + } + controller.setTimeString('timer', time); + }); + }; + })(this) + }); + } + + // Setup the volume bar. + if (this.volumeBar) { + + // Create the slider. + this.volumeBar.slider({ + slide: function(event, ui) { + media.setVolume(ui.value / 100); + } + }); + + media.bind('volumeupdate', (function(controller) { + return function(event, vol) { + controller.volumeBar.slider('option', 'value', (vol * 100)); + }; + })(this)); + + // Set the volume to match that of the player. + media.getVolume((function(controller) { + return function(vol) { + controller.volumeBar.slider('option', 'value', (vol * 100)); + }; + })(this)); + } + }); + + // We are now ready. + this.ready(); +}; + +/** + * Sets the play and pause state of the control bar. + * + * @param {boolean} state TRUE - Show Play, FALSE - Show Pause. + */ +minplayer.controller.prototype.setPlayPause = function(state) { + var css = ''; + if (this.elements.play) { + css = state ? 'inherit' : 'none'; + this.elements.play.css('display', css); + } + if (this.elements.pause) { + css = state ? 'none' : 'inherit'; + this.elements.pause.css('display', css); + } +}; + +/** + * Plays or pauses the media. + * + * @param {bool} state true => play, false => pause. + * @param {object} media The media player object. + */ +minplayer.controller.prototype.playPause = function(state, media) { + var type = state ? 'play' : 'pause'; + this.display.trigger(type); + this.setPlayPause(!state); + if (media) { + media[type](); + } +}; + +/** + * Sets the time string on the control bar. + * + * @param {string} element The name of the element to set. + * @param {number} time The total time amount to set. + */ +minplayer.controller.prototype.setTimeString = function(element, time) { + if (this.elements[element]) { + this.elements[element].text(minplayer.formatTime(time).time); + } +}; diff --git a/minplayer/src/minplayer.display.js b/minplayer/src/minplayer.display.js new file mode 100644 index 00000000..e926f319 --- /dev/null +++ b/minplayer/src/minplayer.display.js @@ -0,0 +1,296 @@ +/** The minplayer namespace. */ +minplayer = minplayer || {}; + +/** + * @constructor + * @extends minplayer.plugin + * @class Base class used to provide the display and options for any component + * deriving from this class. Components who derive are expected to provide + * the elements that they define by implementing the getElements method. + * + * @param {string} name The name of this plugin. + * @param {object} context The jQuery context this component resides. + * @param {object} options The options for this component. + * @param {object} queue The event queue to pass events around. + */ +minplayer.display = function(name, context, options, queue) { + + // See if we allow resize on this display. + this.allowResize = false; + + if (context) { + + // Set the display. + this.display = this.getDisplay(context, options); + } + + // Derive from plugin + minplayer.plugin.call(this, name, context, options, queue); +}; + +/** Derive from minplayer.plugin. */ +minplayer.display.prototype = new minplayer.plugin(); + +/** Reset the constructor. */ +minplayer.display.prototype.constructor = minplayer.display; + +/** + * Returns the display for this component. + * + * @param {object} context The original context. + * @param {object} options The options for this component. + * @return {object} The jQuery context for this display. + */ +minplayer.display.prototype.getDisplay = function(context, options) { + return jQuery(context); +}; + +/** + * @see minplayer.plugin.construct + */ +minplayer.display.prototype.construct = function() { + + // Call the plugin constructor. + minplayer.plugin.prototype.construct.call(this); + + // Get the display elements. + this.elements = this.getElements(); + + // Only do this if they allow resize for this display. + if (this.allowResize) { + + // Set the resize timeout and this pointer. + var resizeTimeout = 0; + + // Add a handler to trigger a resize event. + jQuery(window).resize((function(display) { + return function() { + clearTimeout(resizeTimeout); + resizeTimeout = setTimeout(function() { + display.onResize(); + }, 200); + }; + })(this)); + } +}; + +/** + * Called when the window resizes. + */ +minplayer.display.prototype.onResize = function() { +}; + +/** + * Gets the full screen element. + * + * @return {object} The display to be used for full screen support. + */ +minplayer.display.prototype.fullScreenElement = function() { + return this.display; +}; + +/** + * Called if you would like for your display item to show then hide. + * + * @param {object} element The element you would like to hide or show. + * @param {number} timeout The timeout to hide and show. + */ +minplayer.showThenHide = function(element, timeout) { + + // Ensure we have a timeout. + timeout = timeout || 5000; + + // If this has not yet been configured. + if (!element.showTimer) { + + // Bind when they move the mouse. + jQuery(document).bind('mousemove', function() { + minplayer.showThenHide(element, timeout); + }); + } + + // Clear the timeout, and then setup the show then hide functionality. + clearTimeout(element.showTimer); + + // Show the display. + element.show(); + + // Set a timer to hide it after the timeout. + element.showTimer = setTimeout(function() { + element.hide('slow'); + }, timeout); +}; + +/** + * Make this display element go fullscreen. + * + * @param {boolean} full Tell the player to go into fullscreen or not. + */ +minplayer.display.prototype.fullscreen = function(full) { + var isFull = this.isFullScreen(); + var element = this.fullScreenElement(); + if (isFull && !full) { + element.removeClass('fullscreen'); + if (screenfull) { + screenfull.exit(); + } + this.trigger('fullscreen', false); + } + else if (!isFull && full) { + element.addClass('fullscreen'); + if (screenfull) { + screenfull.request(element[0]); + screenfull.onchange = (function(display) { + return function(e) { + if (!screenfull.isFullscreen) { + display.fullscreen(false); + } + }; + })(this); + } + this.trigger('fullscreen', true); + } +}; + +/** + * Toggle fullscreen. + */ +minplayer.display.prototype.toggleFullScreen = function() { + this.fullscreen(!this.isFullScreen()); +}; + +/** + * Checks to see if we are in fullscreen mode. + * + * @return {boolean} TRUE - fullscreen, FALSE - otherwise. + */ +minplayer.display.prototype.isFullScreen = function() { + return this.fullScreenElement().hasClass('fullscreen'); +}; + +/** + * Returns a scaled rectangle provided a ratio and the container rect. + * + * @param {number} ratio The width/height ratio of what is being scaled. + * @param {object} rect The bounding rectangle for scaling. + * @return {object} The Rectangle object of the scaled rectangle. + */ +minplayer.display.prototype.getScaledRect = function(ratio, rect) { + var scaledRect = {}; + scaledRect.x = rect.x ? rect.x : 0; + scaledRect.y = rect.y ? rect.y : 0; + scaledRect.width = rect.width ? rect.width : 0; + scaledRect.height = rect.height ? rect.height : 0; + if (ratio) { + if ((rect.width / rect.height) > ratio) { + scaledRect.height = rect.height; + scaledRect.width = Math.floor(rect.height * ratio); + } + else { + scaledRect.height = Math.floor(rect.width / ratio); + scaledRect.width = rect.width; + } + scaledRect.x = Math.floor((rect.width - scaledRect.width) / 2); + scaledRect.y = Math.floor((rect.height - scaledRect.height) / 2); + } + return scaledRect; +}; + +/** + * Returns all the jQuery elements that this component uses. + * + * @return {object} An object which defines all the jQuery elements that + * this component uses. + */ +minplayer.display.prototype.getElements = function() { + return {}; +}; + +/** + * Returns if this component is valid and exists within the DOM. + * + * @return {boolean} TRUE if the plugin display is valid. + */ +minplayer.display.prototype.isValid = function() { + return (this.display.length > 0); +}; + +/** + * From https://github.com/sindresorhus/screenfull.js + */ +/*global Element:true*/ +(function(window, document) { + 'use strict'; + var methods = (function() { + var methodMap = [ + [ + 'requestFullscreen', + 'exitFullscreen', + 'fullscreenchange', + 'fullscreen', + 'fullscreenElement' + ], + [ + 'webkitRequestFullScreen', + 'webkitCancelFullScreen', + 'webkitfullscreenchange', + 'webkitIsFullScreen', + 'webkitCurrentFullScreenElement' + ], + [ + 'mozRequestFullScreen', + 'mozCancelFullScreen', + 'mozfullscreenchange', + 'mozFullScreen', + 'mozFullScreenElement' + ] + ]; + for (var i = 0, l = methodMap.length; i < l; i++) { + var val = methodMap[i]; + if (val[1] in document) { + return val; + } + } + })(); + + if (!methods) { + return window.screenfull = false; + } + + var keyboardAllowed = 'ALLOW_KEYBOARD_INPUT' in Element; + + var screenfull = { + init: function() { + document.addEventListener(methods[2], function(e) { + screenfull.isFullscreen = document[methods[3]]; + screenfull.element = document[methods[4]]; + screenfull.onchange(e); + }); + return this; + }, + isFullscreen: document[methods[3]], + element: document[methods[4]], + request: function(elem) { + elem = elem || document.documentElement; + elem[methods[0]](keyboardAllowed && Element.ALLOW_KEYBOARD_INPUT); + // Work around Safari 5.1 bug: reports support for keyboard in fullscreen + // even though it doesn't. + if (!document.isFullscreen) { + elem[methods[0]](); + } + }, + exit: function() { + document[methods[1]](); + }, + toggle: function(elem) { + if (this.isFullscreen) { + this.exit(); + } else { + this.request(elem); + } + }, + onchange: function() {} + }; + + window.screenfull = screenfull.init(); +})(window, document); diff --git a/minplayer/src/minplayer.file.js b/minplayer/src/minplayer.file.js new file mode 100644 index 00000000..24c0f44f --- /dev/null +++ b/minplayer/src/minplayer.file.js @@ -0,0 +1,167 @@ +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** + * @constructor + * @class A wrapper class used to provide all the data necessary to control an + * individual file within this media player. + * + * @param {object} file A media file object with minimal required information. + */ +minplayer.file = function(file) { + this.duration = file.duration || 0; + this.bytesTotal = file.bytesTotal || 0; + this.quality = file.quality || 0; + this.stream = file.stream || ''; + this.path = file.path || ''; + this.codecs = file.codecs || ''; + + // These should be provided, but just in case... + this.extension = file.extension || this.getFileExtension(); + this.mimetype = file.mimetype || file.filemime || this.getMimeType(); + this.type = file.type || this.getType(); + + // Fail safe to try and guess the mimetype and media type. + if (!this.type) { + this.mimetype = this.getMimeType(); + this.type = this.getType(); + } + + // Get the player. + this.player = file.player || this.getBestPlayer(); + this.priority = file.priority || this.getPriority(); + this.id = file.id || this.getId(); +}; + +/** + * Returns the best player for the job. + * + * @return {string} The best player to play the media file. + */ +minplayer.file.prototype.getBestPlayer = function() { + var bestplayer = null, bestpriority = 0; + jQuery.each(minplayer.players, (function(file) { + return function(name, player) { + var priority = player.getPriority(); + if (player.canPlay(file) && (priority > bestpriority)) { + bestplayer = name; + bestpriority = priority; + } + }; + })(this)); + return bestplayer; +}; + +/** + * The priority of this file is determined by the priority of the best + * player multiplied by the priority of the mimetype. + * + * @return {integer} The priority of the media file. + */ +minplayer.file.prototype.getPriority = function() { + var priority = 1; + if (this.player) { + priority = minplayer.players[this.player].getPriority(); + } + switch (this.mimetype) { + case 'video/x-webm': + case 'video/webm': + case 'application/octet-stream': + return priority * 10; + case 'video/mp4': + case 'audio/mp4': + case 'audio/mpeg': + return priority * 9; + case 'video/ogg': + case 'audio/ogg': + case 'video/quicktime': + return priority * 8; + default: + return priority * 5; + } +}; + +/** + * Returns the file extension of the file path. + * + * @return {string} The file extension. + */ +minplayer.file.prototype.getFileExtension = function() { + return this.path.substring(this.path.lastIndexOf('.') + 1).toLowerCase(); +}; + +/** + * Returns the proper mimetype based off of the extension. + * + * @return {string} The mimetype of the file based off of extension. + */ +minplayer.file.prototype.getMimeType = function() { + switch (this.extension) { + case 'mp4': case 'm4v': case 'flv': case 'f4v': + return 'video/mp4'; + case'webm': + return 'video/webm'; + case 'ogg': case 'ogv': + return 'video/ogg'; + case '3g2': + return 'video/3gpp2'; + case '3gpp': + case '3gp': + return 'video/3gpp'; + case 'mov': + return 'video/quicktime'; + case'swf': + return 'application/x-shockwave-flash'; + case 'oga': + return 'audio/ogg'; + case 'mp3': + return 'audio/mpeg'; + case 'm4a': case 'f4a': + return 'audio/mp4'; + case 'aac': + return 'audio/aac'; + case 'wav': + return 'audio/vnd.wave'; + case 'wma': + return 'audio/x-ms-wma'; + default: + return 'unknown'; + } +}; + +/** + * The type of media this is: video or audio. + * + * @return {string} "video" or "audio" based on what the type of media this + * is. + */ +minplayer.file.prototype.getType = function() { + switch (this.mimetype) { + case 'video/mp4': + case 'video/webm': + case 'application/octet-stream': + case 'video/x-webm': + case 'video/ogg': + case 'video/3gpp2': + case 'video/3gpp': + case 'video/quicktime': + return 'video'; + case 'audio/mp3': + case 'audio/mp4': + case 'audio/ogg': + case 'audio/mpeg': + return 'audio'; + default: + return ''; + } +}; + +/** + * Returns the ID for this media file. + * + * @return {string} The id for this media file which is provided by the player. + */ +minplayer.file.prototype.getId = function() { + var player = minplayer.players[this.player]; + return (player && player.getMediaId) ? player.getMediaId(this) : ''; +}; diff --git a/minplayer/src/minplayer.flags.js b/minplayer/src/minplayer.flags.js new file mode 100644 index 00000000..4d97c376 --- /dev/null +++ b/minplayer/src/minplayer.flags.js @@ -0,0 +1,71 @@ +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** + * @constructor + * @class This is a class used to keep track of flag states + * which is used to control the busy cursor, big play button, among other + * items in which multiple components can have an interest in hiding or + * showing a single element on the screen. + * + *

+ * Usage: + *


+ *   // Declare a flags variable.
+ *   var flags = new minplayer.flags();
+ *
+ *   // Set the flag based on two components interested in the flag.
+ *   flags.setFlag("component1", true);
+ *   flags.setFlag("component2", true);
+ *
+ *   // Print out the value of the flags. ( Prints 3 )
+ *   console.log(flags.flags);
+ *
+ *   // Now unset a single components flag.
+ *   flags.setFlag("component1", false);
+ *
+ *   // Print out the value of the flags.
+ *   console.log(flags.flags);
+ *
+ *   // Unset the other components flag.
+ *   flags.setFlag("component2", false);
+ *
+ *   // Print out the value of the flags.
+ *   console.log(flags.flags);
+ * 
+ *

+ */ +minplayer.flags = function() { + + /** The flag. */ + this.flag = 0; + + /** Id map to reference id with the flag index. */ + this.ids = {}; + + /** The number of flags. */ + this.numFlags = 0; +}; + +/** + * Sets a flag based on boolean logic operators. + * + * @param {string} id The id of the controller interested in this flag. + * @param {boolean} value The value of this flag ( true or false ). + */ +minplayer.flags.prototype.setFlag = function(id, value) { + + // Define this id if it isn't present. + if (!this.ids.hasOwnProperty(id)) { + this.ids[id] = this.numFlags; + this.numFlags++; + } + + // Use binary operations to keep track of the flag state + if (value) { + this.flag |= (1 << this.ids[id]); + } + else { + this.flag &= ~(1 << this.ids[id]); + } +}; diff --git a/minplayer/src/minplayer.image.js b/minplayer/src/minplayer.image.js new file mode 100644 index 00000000..7759673f --- /dev/null +++ b/minplayer/src/minplayer.image.js @@ -0,0 +1,144 @@ +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** + * @constructor + * @class A class to easily handle images. + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +minplayer.image = function(context, options) { + + // Determine if the image is loaded. + this.loaded = false; + + // The image loader. + this.loader = null; + + // The ratio of the image. + this.ratio = 0; + + // The image element. + this.img = null; + + // Derive from display + minplayer.display.call(this, 'image', context, options); +}; + +/** Derive from minplayer.display. */ +minplayer.image.prototype = new minplayer.display(); + +/** Reset the constructor. */ +minplayer.image.prototype.constructor = minplayer.image; + +/** + * @see minplayer.plugin.construct + */ +minplayer.image.prototype.construct = function() { + + // Say we need to resize. + this.allowResize = true; + + // Call the media display constructor. + minplayer.display.prototype.construct.call(this); + + // Set the container to not show any overflow... + this.display.css('overflow', 'hidden'); + + /** The loader for the image. */ + this.loader = new Image(); + + /** Register for when the image is loaded within the loader. */ + this.loader.onload = (function(image) { + return function() { + image.loaded = true; + image.ratio = (image.loader.width / image.loader.height); + image.resize(); + image.trigger('loaded'); + }; + })(this); + + // We are now ready. + this.ready(); +}; + +/** + * Loads an image. + * + * @param {string} src The source of the image to load. + */ +minplayer.image.prototype.load = function(src) { + + // First clear the previous image. + this.clear(function() { + + // Create the new image, and append to the display. + this.display.empty(); + this.img = jQuery(document.createElement('img')).attr({src: ''}).hide(); + this.display.append(this.img); + this.loader.src = src; + }); +}; + +/** + * Clears an image. + * + * @param {function} callback Called when the image is done clearing. + */ +minplayer.image.prototype.clear = function(callback) { + this.loaded = false; + if (this.img) { + this.img.fadeOut((function(image) { + return function() { + image.img.attr('src', ''); + image.loader.src = ''; + $(this).remove(); + callback.call(image); + }; + })(this)); + } + else { + callback.call(this); + } +}; + +/** + * Resize the image provided a width and height or nothing. + * + * @param {integer} width (optional) The width of the container. + * @param {integer} height (optional) The height of the container. + */ +minplayer.image.prototype.resize = function(width, height) { + width = width || this.display.width(); + height = height || this.display.height(); + if (width && height && this.loaded) { + + // Get the scaled rectangle. + var rect = this.getScaledRect(this.ratio, { + width: width, + height: height + }); + + // Now set this image to the new size. + if (this.img) { + this.img.attr('src', this.loader.src).css({ + marginLeft: rect.x, + marginTop: rect.y, + width: rect.width, + height: rect.height + }); + } + + // Show the container. + this.img.fadeIn(); + } +}; + +/** + * @see minplayer.display#onResize + */ +minplayer.image.prototype.onResize = function() { + + // Resize the image to fit. + this.resize(); +}; diff --git a/minplayer/src/minplayer.js b/minplayer/src/minplayer.js new file mode 100644 index 00000000..f38c633f --- /dev/null +++ b/minplayer/src/minplayer.js @@ -0,0 +1,352 @@ +// Add a way to instanciate using jQuery prototype. +if (!jQuery.fn.minplayer) { + + /** + * @constructor + * + * Define a jQuery minplayer prototype. + * + * @param {object} options The options for this jQuery prototype. + * @return {Array} jQuery object. + */ + jQuery.fn.minplayer = function(options) { + return jQuery(this).each(function() { + options = options || {}; + options.id = options.id || $(this).attr('id') || Math.random(); + if (!minplayer.plugins[options.id]) { + options.template = options.template || 'default'; + if (minplayer[options.template]) { + new minplayer[options.template](jQuery(this), options); + } + else { + new minplayer(jQuery(this), options); + } + } + }); + }; +} + +/** + * @constructor + * @extends minplayer.display + * @class The core media player class which governs the media player + * functionality. + * + *

Usage: + *


+ *
+ *   // Create a media player.
+ *   var player = jQuery("#player").minplayer({
+ *
+ *   });
+ *
+ * 
+ *

+ * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +minplayer = jQuery.extend(function(context, options) { + + // Derive from display + minplayer.display.call(this, 'player', context, options); +}, minplayer); + +/** Derive from minplayer.display. */ +minplayer.prototype = new minplayer.display(); + +/** Reset the constructor. */ +minplayer.prototype.constructor = minplayer; + +/** + * Define a way to debug. + */ +minplayer.console = console || {log: function(data) {}}; + +/** + * @see minplayer.plugin.construct + */ +minplayer.prototype.construct = function() { + + // Allow them to provide arguments based off of the DOM attributes. + jQuery.each(this.context[0].attributes, (function(player) { + return function(index, attr) { + player.options[attr.name] = player.options[attr.name] || attr.value; + }; + })(this)); + + // Make sure we provide default options... + this.options = jQuery.extend({ + id: 'player', + build: false, + wmode: 'transparent', + preload: true, + autoplay: false, + loop: false, + width: '100%', + height: '350px', + debug: false, + volume: 80, + files: [], + file: '', + preview: '', + attributes: {} + }, this.options); + + // Call the minplayer display constructor. + minplayer.display.prototype.construct.call(this); + + /** The controller for this player. */ + this.controller = this.create('controller'); + + /** The play loader for this player. */ + this.playLoader = this.create('playLoader'); + + /** Variable to store the current media player. */ + this.currentPlayer = 'html5'; + + // Add key events to the window. + this.addKeyEvents(); + + // Now load these files. + this.load(this.getFiles()); + + // Add the player events. + this.addEvents(); + + // The player is ready. + this.ready(); +}; + +/** + * We need to bind to events we are interested in. + */ +minplayer.prototype.addEvents = function() { + minplayer.get.call(this, this.options.id, null, (function(player) { + return function(plugin) { + + // Bind to the error event. + plugin.bind('error', function(event, data) { + + // If an error occurs within the html5 media player, then try + // to fall back to the flash player. + if (player.currentPlayer == 'html5') { + player.options.file.player = 'minplayer'; + player.loadPlayer(); + } + else { + player.error(data); + } + }); + + // Bind to the fullscreen event. + plugin.bind('fullscreen', function(event, data) { + player.resize(); + }); + }; + })(this)); +}; + +/** + * Sets an error on the player. + * + * @param {string} error The error to display on the player. + */ +minplayer.prototype.error = function(error) { + error = error || ''; + if (this.elements.error) { + + // Set the error text. + this.elements.error.text(error); + if (error) { + this.elements.error.show(); + } + else { + this.elements.error.hide(); + } + } +}; + +/** + * Adds key events to the player. + */ +minplayer.prototype.addKeyEvents = function() { + jQuery(document).bind('keydown', (function(player) { + return function(event) { + switch (event.keyCode) { + case 113: // ESC + case 27: // Q + if (player.isFullScreen()) { + player.fullscreen(false); + } + break; + } + }; + })(this)); +}; + +/** + * Returns all the media files available for this player. + * + * @return {array} All the media files for this player. + */ +minplayer.prototype.getFiles = function() { + var files = []; + var mediaSrc = null; + + // Get the files involved... + if (this.elements.media) { + mediaSrc = this.elements.media.attr('src'); + if (mediaSrc) { + files.push({'path': mediaSrc}); + } + jQuery('source', this.elements.media).each(function() { + files.push({ + 'path': jQuery(this).attr('src'), + 'mimetype': jQuery(this).attr('type'), + 'codecs': jQuery(this).attr('codecs') + }); + }); + } + + return files; +}; + +/** + * Returns the full media player object. + * @param {array} files An array of files to chose from. + * @return {object} The best media file to play in the current browser. + */ +minplayer.prototype.getMediaFile = function(files) { + + // If there are no files then return null. + if (!files) { + return null; + } + + // If the file is a single string, then return the file object. + if (typeof files === 'string') { + return new minplayer.file({'path': files}); + } + + // If the file is already a file object then just return. + if (files.path || files.id) { + return new minplayer.file(files); + } + + // Add the files and get the best player to play. + var i = files.length, bestPriority = 0, mFile = null, file = null; + while (i--) { + file = files[i]; + + // Get the minplayer file object. + if (typeof file === 'string') { + file = new minplayer.file({'path': file}); + } + else { + file = new minplayer.file(file); + } + + // Determine the best file for this browser. + if (file.priority > bestPriority) { + mFile = file; + } + } + + // Return the best minplayer file. + return mFile; +}; + +/** + * Loads a media player based on the current file. + */ +minplayer.prototype.loadPlayer = function() { + + // Do nothing if there isn't a file. + if (!this.options.file) { + this.error('No media found.'); + return; + } + + if (!this.options.file.player) { + this.error('Cannot play media: ' + this.options.file.mimetype); + return; + } + + // Reset the error. + this.error(); + + // Only destroy if the current player is different than the new player. + var player = this.options.file.player.toString(); + + // If there isn't media or if the players are different. + if (!this.media || (player !== this.currentPlayer)) { + + // Set the current media player. + this.currentPlayer = player; + + // Do nothing if we don't have a display. + if (!this.elements.display) { + this.error('No media display found.'); + return; + } + + // Destroy the current media. + var queue = {}; + if (this.media) { + queue = this.media.queue; + this.media.destroy(); + } + + // Get the class name and create the new player. + pClass = minplayer.players[this.options.file.player]; + + // Create the new media player. + this.options.mediaelement = this.elements.media; + this.media = new pClass(this.elements.display, this.options, queue); + + // Now get the media when it is ready. + this.get('media', (function(player) { + return function(media) { + + // Load the media. + media.load(player.options.file); + }; + })(this)); + } + // If the media object already exists... + else if (this.media) { + + // Now load the different media file. + this.media.load(this.options.file); + } +}; + +/** + * Load a set of files or a single file for the media player. + * + * @param {array} files An array of files to chose from to load. + */ +minplayer.prototype.load = function(files) { + + // Set the id and class. + var id = '', pClass = ''; + + // If no file was provided, then get it. + this.options.files = files || this.options.files; + this.options.file = this.getMediaFile(this.options.files); + + // Now load the player. + this.loadPlayer(); +}; + +/** + * Called when the player is resized. + */ +minplayer.prototype.resize = function() { + + // Call onRezie for each plugin. + this.get(function(plugin) { + plugin.onResize(); + }); +}; diff --git a/minplayer/src/minplayer.playLoader.js b/minplayer/src/minplayer.playLoader.js new file mode 100644 index 00000000..ca8ba601 --- /dev/null +++ b/minplayer/src/minplayer.playLoader.js @@ -0,0 +1,189 @@ +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** + * @constructor + * @extends minplayer.display + * @class The play loader base class, which is used to control the busy + * cursor, big play button, and the opaque background which shows when the + * player is paused. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +minplayer.playLoader = function(context, options) { + + // Define the flags that control the busy cursor. + this.busy = new minplayer.flags(); + + // Define the flags that control the big play button. + this.bigPlay = new minplayer.flags(); + + /** The preview image. */ + this.preview = null; + + // Derive from display + minplayer.display.call(this, 'playLoader', context, options); +}; + +/** Derive from minplayer.display. */ +minplayer.playLoader.prototype = new minplayer.display(); + +/** Reset the constructor. */ +minplayer.playLoader.prototype.constructor = minplayer.playLoader; + +/** + * The constructor. + */ +minplayer.playLoader.prototype.construct = function() { + + // Call the media display constructor. + minplayer.display.prototype.construct.call(this); + + // Get the media plugin. + this.get('media', function(media) { + + // Only bind if this player does not have its own play loader. + if (!media.hasPlayLoader()) { + + // Get the poster image. + if (!this.options.preview) { + this.options.preview = media.elements.media.attr('poster'); + } + + // Reset the media's poster image. + media.elements.media.attr('poster', ''); + + // Load the preview image. + this.loadPreview(); + + // Trigger a play event when someone clicks on the controller. + if (this.elements.bigPlay) { + this.elements.bigPlay.unbind().bind('click', function(event) { + event.preventDefault(); + jQuery(this).hide(); + media.play(); + }); + } + + // Bind to the player events to control the play loader. + media.unbind('loadstart').bind('loadstart', (function(playLoader) { + return function(event) { + playLoader.busy.setFlag('media', true); + playLoader.bigPlay.setFlag('media', true); + if (playLoader.preview) { + playLoader.elements.preview.show(); + } + playLoader.checkVisibility(); + }; + })(this)); + media.bind('waiting', (function(playLoader) { + return function(event) { + playLoader.busy.setFlag('media', true); + playLoader.checkVisibility(); + }; + })(this)); + media.bind('loadeddata', (function(playLoader) { + return function(event) { + playLoader.busy.setFlag('media', false); + playLoader.checkVisibility(); + }; + })(this)); + media.bind('playing', (function(playLoader) { + return function(event) { + playLoader.busy.setFlag('media', false); + playLoader.bigPlay.setFlag('media', false); + if (playLoader.preview) { + playLoader.elements.preview.hide(); + } + playLoader.checkVisibility(); + }; + })(this)); + media.bind('pause', (function(playLoader) { + return function(event) { + playLoader.bigPlay.setFlag('media', true); + playLoader.checkVisibility(); + }; + })(this)); + } + else { + + // Hide the busy cursor. + if (this.elements.busy) { + this.elements.busy.unbind().hide(); + } + + // Hide the big play button. + if (this.elements.bigPlay) { + this.elements.bigPlay.unbind().hide(); + } + + // Hide the display. + this.display.unbind().hide(); + } + }); + + // We are now ready. + this.ready(); +}; + +/** + * Loads the preview image. + */ +minplayer.playLoader.prototype.loadPreview = function() { + + // If the preview element exists. + if (this.elements.preview) { + + // If there is a preview to show... + if (this.options.preview) { + + // Say that this has a preview. + this.elements.preview.addClass('has-preview').show(); + + // Create a new preview image. + this.preview = new minplayer.image(this.elements.preview, this.options); + + // Create the image. + this.preview.load(this.options.preview); + } + else { + + // Hide the preview. + this.elements.preview.hide(); + } + } +}; + +/** + * Hide or show certain elements based on the state of the busy and big play + * button. + */ +minplayer.playLoader.prototype.checkVisibility = function() { + + // Hide or show the busy cursor based on the flags. + if (this.busy.flag) { + this.elements.busy.show(); + } + else { + this.elements.busy.hide(); + } + + // Hide or show the big play button based on the flags. + if (this.bigPlay.flag) { + this.elements.bigPlay.show(); + } + else { + this.elements.bigPlay.hide(); + } + + // Show the control either flag is set. + if (this.bigPlay.flag || this.busy.flag) { + this.display.show(); + } + + // Hide the whole control if both flags are 0. + if (!this.bigPlay.flag && !this.busy.flag) { + this.display.hide(); + } +}; diff --git a/minplayer/src/minplayer.players.base.js b/minplayer/src/minplayer.players.base.js new file mode 100644 index 00000000..781f27b7 --- /dev/null +++ b/minplayer/src/minplayer.players.base.js @@ -0,0 +1,591 @@ +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.display + * @class The base media player class where all media players derive from. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.players.base = function(context, options, queue) { + + // Derive from display + minplayer.display.call(this, 'media', context, options, queue); +}; + +/** Derive from minplayer.display. */ +minplayer.players.base.prototype = new minplayer.display(); + +/** Reset the constructor. */ +minplayer.players.base.prototype.constructor = minplayer.players.base; + +/** + * @see minplayer.display.getElements + * @this minplayer.players.base + * @return {object} The elements for this display. + */ +minplayer.players.base.prototype.getElements = function() { + var elements = minplayer.display.prototype.getElements.call(this); + return jQuery.extend(elements, { + media: this.options.mediaelement + }); +}; + +/** + * Get the priority of this media player. + * + * @return {number} The priority of this media player. + */ +minplayer.players.base.getPriority = function() { + return 0; +}; + +/** + * Returns the ID for the media being played. + * + * @param {object} file A {@link minplayer.file} object. + * @return {string} The ID for the provided media. + */ +minplayer.players.base.getMediaId = function(file) { + return ''; +}; + +/** + * Determine if we can play the media file. + * + * @param {object} file A {@link minplayer.file} object. + * @return {boolean} If this player can play this media type. + */ +minplayer.players.base.canPlay = function(file) { + return false; +}; + +/** + * @see minplayer.plugin.construct + * @this minplayer.players.base + */ +minplayer.players.base.prototype.construct = function() { + + // Call the media display constructor. + minplayer.display.prototype.construct.call(this); + + // Clear the media player. + this.clear(); + + /** The currently loaded media file. */ + this.mediaFile = this.options.file; + + // Get the player display object. + if (!this.playerFound()) { + + // Remove the media element if found + if (this.elements.media) { + this.elements.media.remove(); + } + + // Create a new media player element. + this.elements.media = jQuery(this.create()); + this.display.html(this.elements.media); + } + + // Get the player object... + this.player = this.getPlayer(); + + // Set the focus of the element based on if they click in or outside of it. + jQuery(document).bind('click', (function(player) { + return function(event) { + if (jQuery(event.target).closest('#' + player.options.id).length == 0) { + player.hasFocus = false; + } + else { + player.hasFocus = true; + } + }; + })(this)); + + // Bind to key events... + jQuery(document).bind('keydown', (function(player) { + return function(event) { + if (player.hasFocus) { + event.preventDefault(); + switch (event.keyCode) { + case 32: // SPACE + case 179: // GOOGLE play/pause button. + if (player.playing) { + player.pause(); + } + else { + player.play(); + } + break; + case 38: // UP + player.setVolumeRelative(0.1); + break; + case 40: // DOWN + player.setVolumeRelative(-0.1); + break; + case 37: // LEFT + case 227: // GOOGLE TV REW + player.seekRelative(-0.05); + break; + case 39: // RIGHT + case 228: // GOOGLE TV FW + player.seekRelative(0.05); + break; + } + } + }; + })(this)); +}; + +/** + * @see minplayer.plugin.destroy. + */ +minplayer.players.base.prototype.destroy = function() { + minplayer.plugin.prototype.destroy.call(this); + this.clear(); +}; + +/** + * Clears the media player. + */ +minplayer.players.base.prototype.clear = function() { + + // Reset the ready flag. + this.playerReady = false; + + // Reset the player. + this.reset(); + + // If the player exists, then unbind all events. + if (this.player) { + jQuery(this.player).unbind(); + } +}; + +/** + * Resets all variables. + */ +minplayer.players.base.prototype.reset = function() { + + // The duration of the player. + this.duration = new minplayer.async(); + + // The current play time of the player. + this.currentTime = new minplayer.async(); + + // The amount of bytes loaded in the player. + this.bytesLoaded = new minplayer.async(); + + // The total amount of bytes for the media. + this.bytesTotal = new minplayer.async(); + + // The bytes that the download started with. + this.bytesStart = new minplayer.async(); + + // The current volume of the player. + this.volume = new minplayer.async(); + + // Reset focus. + this.hasFocus = false; + + // We are not playing. + this.playing = false; + + // We are not loading. + this.loading = false; + + // Tell everyone else we reset. + this.trigger('pause'); + this.trigger('waiting'); + this.trigger('progress', {loaded: 0, total: 0, start: 0}); + this.trigger('timeupdate', {currentTime: 0, duration: 0}); +}; + +/** + * Called when the player is ready to recieve events and commands. + */ +minplayer.players.base.prototype.onReady = function() { + + // Only continue if we are not already ready. + if (this.playerReady) { + return; + } + + // Set the ready flag. + this.playerReady = true; + + // Set the volume to the default. + this.setVolume(this.options.volume / 100); + + // Setup the progress interval. + this.loading = true; + + // Create a poll to get the progress. + this.poll((function(player) { + return function() { + + // Only do this if the play interval is set. + if (player.loading) { + + // Get the bytes loaded asynchronously. + player.getBytesLoaded(function(bytesLoaded) { + + // Get the bytes total asynchronously. + player.getBytesTotal(function(bytesTotal) { + + // Trigger an event about the progress. + if (bytesLoaded || bytesTotal) { + + // Get the bytes start, but don't require it. + var bytesStart = 0; + player.getBytesStart(function(val) { + bytesStart = val; + }); + + // Trigger a progress event. + player.trigger('progress', { + loaded: bytesLoaded, + total: bytesTotal, + start: bytesStart + }); + + // Say we are not longer loading if they are equal. + if (bytesLoaded >= bytesTotal) { + player.loading = false; + } + } + }); + }); + } + + // Keep polling as long as its loading... + return player.loading; + }; + })(this), 1000); + + // We are now ready. + this.ready(); + + // Trigger that the load has started. + this.trigger('loadstart'); +}; + +/** + * Should be called when the media is playing. + */ +minplayer.players.base.prototype.onPlaying = function() { + + // Trigger an event that we are playing. + this.trigger('playing'); + + // Say that this player has focus. + this.hasFocus = true; + + // Set the playInterval to true. + this.playing = true; + + // Create a poll to get the timeupate. + this.poll((function(player) { + return function() { + + // Only do this if the play interval is set. + if (player.playing) { + + // Get the current time asyncrhonously. + player.getCurrentTime(function(currentTime) { + + // Get the duration asynchronously. + player.getDuration(function(duration) { + + // Convert these to floats. + currentTime = parseFloat(currentTime); + duration = parseFloat(duration); + + // Trigger an event about the progress. + if (currentTime || duration) { + + // Trigger an update event. + player.trigger('timeupdate', { + currentTime: currentTime, + duration: duration + }); + } + }); + }); + } + + // Keep polling as long as it is playing. + return player.playing; + }; + })(this), 1000); +}; + +/** + * Should be called when the media is paused. + */ +minplayer.players.base.prototype.onPaused = function() { + + // Trigger an event that we are paused. + this.trigger('pause'); + + // Remove focus. + this.hasFocus = false; + + // Say we are not playing. + this.playing = false; +}; + +/** + * Should be called when the media is complete. + */ +minplayer.players.base.prototype.onComplete = function() { + // Stop the intervals. + this.playing = false; + this.loading = false; + this.hasFocus = false; + this.trigger('ended'); +}; + +/** + * Should be called when the media is done loading. + */ +minplayer.players.base.prototype.onLoaded = function() { + this.trigger('loadeddata'); +}; + +/** + * Should be called when the player is waiting. + */ +minplayer.players.base.prototype.onWaiting = function() { + this.trigger('waiting'); +}; + +/** + * Called when an error occurs. + * + * @param {string} errorCode The error that was triggered. + */ +minplayer.players.base.prototype.onError = function(errorCode) { + this.hasFocus = false; + this.trigger('error', errorCode); +}; + +/** + * @see minplayer.players.base#isReady + * @return {boolean} Checks to see if the Flash is ready. + */ +minplayer.players.base.prototype.isReady = function() { + + // Return that the player is set and the ready flag is good. + return (this.player && this.playerReady); +}; + +/** + * Determines if the player should show the playloader. + * + * @return {bool} If this player implements its own playLoader. + */ +minplayer.players.base.prototype.hasPlayLoader = function() { + return false; +}; + +/** + * Returns if the media player is already within the DOM. + * + * @return {boolean} TRUE - if the player is in the DOM, FALSE otherwise. + */ +minplayer.players.base.prototype.playerFound = function() { + return false; +}; + +/** + * Creates the media player and inserts it in the DOM. + * + * @return {object} The media player entity. + */ +minplayer.players.base.prototype.create = function() { + this.reset(); + return null; +}; + +/** + * Returns the media player object. + * + * @return {object} The media player object. + */ +minplayer.players.base.prototype.getPlayer = function() { + return this.player; +}; + +/** + * Loads a new media player. + * + * @param {object} file A {@link minplayer.file} object. + */ +minplayer.players.base.prototype.load = function(file) { + + // Store the media file for future lookup. + var isString = (typeof this.mediaFile == 'string'); + var path = isString ? this.mediaFile : this.mediaFile.path; + if (file && (file.path != path)) { + this.reset(); + this.mediaFile = file; + } +}; + +/** + * Play the loaded media file. + */ +minplayer.players.base.prototype.play = function() { +}; + +/** + * Pause the loaded media file. + */ +minplayer.players.base.prototype.pause = function() { +}; + +/** + * Stop the loaded media file. + */ +minplayer.players.base.prototype.stop = function() { + this.playing = false; + this.loading = false; + this.hasFocus = false; +}; + +/** + * Seeks to relative position. + * + * @param {number} pos Relative position. -1 to 1 (percent), > 1 (seconds). + */ +minplayer.players.base.prototype.seekRelative = function(pos) { + + // Get the current time asyncrhonously. + this.getCurrentTime((function(player) { + return function(currentTime) { + + // Get the duration asynchronously. + player.getDuration(function(duration) { + + // Only do this if we have a duration. + if (duration) { + + // Get the position. + var seekPos = 0; + if ((pos > -1) && (pos < 1)) { + seekPos = (currentTime / duration) + parseFloat(pos); + } + else { + seekPos = (currentTime + parseFloat(pos)) / duration; + } + + // Set the seek value. + player.seek(seekPos); + } + }); + }; + })(this)); +}; + +/** + * Seek the loaded media. + * + * @param {number} pos The position to seek the minplayer. 0 to 1. + */ +minplayer.players.base.prototype.seek = function(pos) { +}; + +/** + * Set the volume of the loaded minplayer. + * + * @param {number} vol -1 to 1 - The relative amount to increase or decrease. + */ +minplayer.players.base.prototype.setVolumeRelative = function(vol) { + + // Get the volume + this.getVolume((function(player) { + return function(newVol) { + newVol += parseFloat(vol); + newVol = (newVol < 0) ? 0 : newVol; + newVol = (newVol > 1) ? 1 : newVol; + player.setVolume(newVol); + }; + })(this)); +}; + +/** + * Set the volume of the loaded minplayer. + * + * @param {number} vol The volume to set the media. 0 to 1. + */ +minplayer.players.base.prototype.setVolume = function(vol) { + this.trigger('volumeupdate', vol); +}; + +/** + * Get the volume from the loaded media. + * + * @param {function} callback Called when the volume is determined. + * @return {number} The volume of the media; 0 to 1. + */ +minplayer.players.base.prototype.getVolume = function(callback) { + return this.volume.get(callback); +}; + +/** + * Get the current time for the media being played. + * + * @param {function} callback Called when the time is determined. + * @return {number} The volume of the media; 0 to 1. + */ +minplayer.players.base.prototype.getCurrentTime = function(callback) { + return this.currentTime.get(callback); +}; + +/** + * Return the duration of the loaded media. + * + * @param {function} callback Called when the duration is determined. + * @return {number} The duration of the loaded media. + */ +minplayer.players.base.prototype.getDuration = function(callback) { + return this.duration.get(callback); +}; + +/** + * Return the start bytes for the loaded media. + * + * @param {function} callback Called when the start bytes is determined. + * @return {int} The bytes that were started. + */ +minplayer.players.base.prototype.getBytesStart = function(callback) { + return this.bytesStart.get(callback); +}; + +/** + * Return the bytes of media loaded. + * + * @param {function} callback Called when the bytes loaded is determined. + * @return {int} The amount of bytes loaded. + */ +minplayer.players.base.prototype.getBytesLoaded = function(callback) { + return this.bytesLoaded.get(callback); +}; + +/** + * Return the total amount of bytes. + * + * @param {function} callback Called when the bytes total is determined. + * @return {int} The total amount of bytes for this media. + */ +minplayer.players.base.prototype.getBytesTotal = function(callback) { + return this.bytesTotal.get(callback); +}; diff --git a/minplayer/src/minplayer.players.flash.js b/minplayer/src/minplayer.players.flash.js new file mode 100644 index 00000000..8afff596 --- /dev/null +++ b/minplayer/src/minplayer.players.flash.js @@ -0,0 +1,108 @@ +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.display + * @class The Flash media player class to control the flash fallback. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.players.flash = function(context, options, queue) { + + // Derive from players base. + minplayer.players.base.call(this, context, options, queue); +}; + +/** Derive from minplayer.players.base. */ +minplayer.players.flash.prototype = new minplayer.players.base(); + +/** Reset the constructor. */ +minplayer.players.flash.prototype.constructor = minplayer.players.flash; + +/** + * @see minplayer.players.base#getPriority + * @return {number} The priority of this media player. + */ +minplayer.players.flash.getPriority = function() { + return 0; +}; + +/** + * @see minplayer.players.base#canPlay + * @return {boolean} If this player can play this media type. + */ +minplayer.players.flash.canPlay = function(file) { + return false; +}; + +/** + * API to return the Flash player code provided params. + * + * @param {object} params The params used to populate the Flash code. + * @return {object} A Flash DOM element. + */ +minplayer.players.flash.getFlash = function(params) { + // Get the protocol. + var protocol = window.location.protocol; + if (protocol.charAt(protocol.length - 1) == ':') { + protocol = protocol.substring(0, protocol.length - 1); + } + + // Convert the flashvars object to a string... + var flashVars = jQuery.param(params.flashvars); + + // Set the codebase. + var codebase = protocol + '://fpdownload.macromedia.com'; + codebase += '/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0'; + + // Get the HTML flash object string. + var flash = ' '; + flash += ''; + flash += ''; + flash += ''; + flash += ''; + flash += ''; + flash += ''; + flash += ' 0); +}; + +/** + * @see minplayer.players.base#getPlayer + * @return {object} The media player object. + */ +minplayer.players.flash.prototype.getPlayer = function() { + // IE needs the object, everyone else just needs embed. + var object = jQuery.browser.msie ? 'object' : 'embed'; + return jQuery(object, this.display).eq(0)[0]; +}; diff --git a/minplayer/src/minplayer.players.html5.js b/minplayer/src/minplayer.players.html5.js new file mode 100644 index 00000000..34704130 --- /dev/null +++ b/minplayer/src/minplayer.players.html5.js @@ -0,0 +1,343 @@ +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.display + * @class The HTML5 media player implementation. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.players.html5 = function(context, options, queue) { + + // Derive players base. + minplayer.players.base.call(this, context, options, queue); +}; + +/** Derive from minplayer.players.base. */ +minplayer.players.html5.prototype = new minplayer.players.base(); + +/** Reset the constructor. */ +minplayer.players.html5.prototype.constructor = minplayer.players.html5; + +/** + * @see minplayer.players.base#getPriority + * @return {number} The priority of this media player. + */ +minplayer.players.html5.getPriority = function() { + return 10; +}; + +/** + * @see minplayer.players.base#canPlay + * @return {boolean} If this player can play this media type. + */ +minplayer.players.html5.canPlay = function(file) { + switch (file.mimetype) { + case 'video/ogg': + return !!minplayer.playTypes.videoOGG; + case 'video/mp4': + case 'video/x-mp4': + case 'video/m4v': + case 'video/x-m4v': + return !!minplayer.playTypes.videoH264; + case 'video/x-webm': + case 'video/webm': + case 'application/octet-stream': + return !!minplayer.playTypes.videoWEBM; + case 'audio/ogg': + return !!minplayer.playTypes.audioOGG; + case 'audio/mpeg': + return !!minplayer.playTypes.audioMP3; + case 'audio/mp4': + return !!minplayer.playTypes.audioMP4; + default: + return false; + } +}; + +/** + * @see minplayer.plugin.construct + */ +minplayer.players.html5.prototype.construct = function() { + + // Call base constructor. + minplayer.players.base.prototype.construct.call(this); + + // For the HTML5 player, we will just pass events along... + if (this.player) { + + this.player.addEventListener('abort', (function(player) { + return function() { + player.trigger('abort'); + }; + })(this), false); + this.player.addEventListener('loadstart', (function(player) { + return function() { + player.onReady(); + }; + })(this), false); + this.player.addEventListener('loadeddata', (function(player) { + return function() { + player.onLoaded(); + }; + })(this), false); + this.player.addEventListener('loadedmetadata', (function(player) { + return function() { + player.onLoaded(); + }; + })(this), false); + this.player.addEventListener('canplaythrough', (function(player) { + return function() { + player.onLoaded(); + }; + })(this), false); + this.player.addEventListener('ended', (function(player) { + return function() { + player.onComplete(); + }; + })(this), false); + this.player.addEventListener('pause', (function(player) { + return function() { + player.onPaused(); + }; + })(this), false); + this.player.addEventListener('play', (function(player) { + return function() { + player.onPlaying(); + }; + })(this), false); + this.player.addEventListener('playing', (function(player) { + return function() { + player.onPlaying(); + }; + })(this), false); + this.player.addEventListener('error', (function(player) { + return function() { + player.trigger('error', 'An error occured - ' + this.error.code); + }; + })(this), false); + this.player.addEventListener('waiting', (function(player) { + return function() { + player.onWaiting(); + }; + })(this), false); + this.player.addEventListener('durationchange', (function(player) { + return function() { + player.duration.set(this.duration); + player.trigger('durationchange', {duration: this.duration}); + }; + })(this), false); + this.player.addEventListener('progress', (function(player) { + return function(event) { + player.bytesTotal.set(event.total); + player.bytesLoaded.set(event.loaded); + }; + })(this), false); + + // Say we are ready. + this.onReady(); + } +}; + +/** + * @see minplayer.players.base#playerFound + * @return {boolean} TRUE - if the player is in the DOM, FALSE otherwise. + */ +minplayer.players.html5.prototype.playerFound = function() { + return (this.display.find(this.mediaFile.type).length > 0); +}; + +/** + * @see minplayer.players.base#create + * @return {object} The media player entity. + */ +minplayer.players.html5.prototype.create = function() { + minplayer.players.base.prototype.create.call(this); + var element = jQuery(document.createElement(this.mediaFile.type)) + .attr(this.options.attributes) + .append( + jQuery(document.createElement('source')).attr({ + 'src': this.mediaFile.path + }) + ); + + // Fix the fluid width and height. + element.eq(0)[0].setAttribute('width', '100%'); + element.eq(0)[0].setAttribute('height', '100%'); + return element; +}; + +/** + * @see minplayer.players.base#getPlayer + * @return {object} The media player object. + */ +minplayer.players.html5.prototype.getPlayer = function() { + return this.elements.media.eq(0)[0]; +}; + +/** + * @see minplayer.players.base#load + */ +minplayer.players.html5.prototype.load = function(file) { + + if (file) { + + // Get the current source. + var src = this.elements.media.attr('src'); + if (!src) { + src = jQuery('source', this.elements.media).eq(0).attr('src'); + } + + // If the source is different. + if (src != file.path) { + + // Change the source... + var code = ''; + this.elements.media.removeAttr('src').empty().html(code); + } + } + + // Always call the base first on load... + minplayer.players.base.prototype.load.call(this, file); +}; + +/** + * @see minplayer.players.base#play + */ +minplayer.players.html5.prototype.play = function() { + minplayer.players.base.prototype.play.call(this); + if (this.isReady()) { + this.player.play(); + } +}; + +/** + * @see minplayer.players.base#pause + */ +minplayer.players.html5.prototype.pause = function() { + minplayer.players.base.prototype.pause.call(this); + if (this.isReady()) { + this.player.pause(); + } +}; + +/** + * @see minplayer.players.base#stop + */ +minplayer.players.html5.prototype.stop = function() { + minplayer.players.base.prototype.stop.call(this); + if (this.isReady()) { + this.player.pause(); + this.player.src = ''; + } +}; + +/** + * @see minplayer.players.base#seek + */ +minplayer.players.html5.prototype.seek = function(pos) { + minplayer.players.base.prototype.seek.call(this, pos); + if (this.isReady()) { + this.player.currentTime = pos; + } +}; + +/** + * @see minplayer.players.base#setVolume + */ +minplayer.players.html5.prototype.setVolume = function(vol) { + minplayer.players.base.prototype.setVolume.call(this, vol); + if (this.isReady()) { + this.player.volume = vol; + } +}; + +/** + * @see minplayer.players.base#getVolume + */ +minplayer.players.html5.prototype.getVolume = function(callback) { + if (this.isReady()) { + callback(this.player.volume); + } +}; + +/** + * @see minplayer.players.base#getDuration + */ +minplayer.players.html5.prototype.getDuration = function(callback) { + if (this.isReady()) { + callback(this.player.duration); + } +}; + +/** + * @see minplayer.players.base#getCurrentTime + */ +minplayer.players.html5.prototype.getCurrentTime = function(callback) { + if (this.isReady()) { + callback(this.player.currentTime); + } +}; + +/** + * @see minplayer.players.base#getBytesLoaded + */ +minplayer.players.html5.prototype.getBytesLoaded = function(callback) { + if (this.isReady()) { + var loaded = 0; + + // Check several different possibilities. + if (this.bytesLoaded.value) { + loaded = this.bytesLoaded.value; + } + else if (this.player.buffered && + this.player.buffered.length > 0 && + this.player.buffered.end && + this.player.duration) { + loaded = this.player.buffered.end(0); + } + else if (this.player.bytesTotal != undefined && + this.player.bytesTotal > 0 && + this.player.bufferedBytes != undefined) { + loaded = this.player.bufferedBytes; + } + + // Return the loaded amount. + callback(loaded); + } +}; + +/** + * @see minplayer.players.base#getBytesTotal + */ +minplayer.players.html5.prototype.getBytesTotal = function(callback) { + if (this.isReady()) { + + var total = 0; + + // Check several different possibilities. + if (this.bytesTotal.value) { + total = this.bytesTotal.value; + } + else if (this.player.buffered && + this.player.buffered.length > 0 && + this.player.buffered.end && + this.player.duration) { + total = this.player.duration; + } + else if (this.player.bytesTotal != undefined && + this.player.bytesTotal > 0 && + this.player.bufferedBytes != undefined) { + total = this.player.bytesTotal; + } + + // Return the loaded amount. + callback(total); + } +}; diff --git a/minplayer/src/minplayer.players.minplayer.js b/minplayer/src/minplayer.players.minplayer.js new file mode 100644 index 00000000..ad224e2f --- /dev/null +++ b/minplayer/src/minplayer.players.minplayer.js @@ -0,0 +1,275 @@ +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.display + * @class The Flash media player class to control the flash fallback. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.players.minplayer = function(context, options, queue) { + + // Derive from players flash. + minplayer.players.flash.call(this, context, options, queue); +}; + +/** Derive from minplayer.players.flash. */ +minplayer.players.minplayer.prototype = new minplayer.players.flash(); + +/** Reset the constructor. */ +minplayer.players.minplayer.prototype.constructor = minplayer.players.minplayer; + +/** + * Called when the Flash player is ready. + * + * @param {string} id The media player ID. + */ +window.onFlashPlayerReady = function(id) { + var media = minplayer.get(id, 'media'); + if (media) { + media.onReady(); + } +}; + +/** + * Called when the Flash player updates. + * + * @param {string} id The media player ID. + * @param {string} eventType The event type that was triggered. + */ +window.onFlashPlayerUpdate = function(id, eventType) { + var media = minplayer.get(id, 'media'); + if (media) { + media.onMediaUpdate(eventType); + } +}; + +/** + * Used to debug from the Flash player to the browser console. + * + * @param {string} debug The debug string. + */ +window.onFlashPlayerDebug = function(debug) { + minplayer.console.log(debug); +}; + +/** + * @see minplayer.players.base#getPriority + * @return {number} The priority of this media player. + */ +minplayer.players.minplayer.getPriority = function() { + return 1; +}; + +/** + * @see minplayer.players.base#canPlay + * @return {boolean} If this player can play this media type. + */ +minplayer.players.minplayer.canPlay = function(file) { + switch (file.mimetype) { + case 'video/mp4': + case 'video/x-mp4': + case 'video/m4v': + case 'video/x-m4v': + case 'video/x-webm': + case 'video/webm': + case 'application/octet-stream': + case 'video/quicktime': + case 'video/3gpp2': + case 'video/3gpp': + case 'application/x-shockwave-flash': + case 'audio/mpeg': + case 'audio/mp4': + case 'audio/aac': + case 'audio/vnd.wave': + case 'audio/x-ms-wma': + return true; + + default: + return false; + } +}; + +/** + * @see minplayer.players.base#create + * @return {object} The media player entity. + */ +minplayer.players.minplayer.prototype.create = function() { + + // Make sure we provide default options... + this.options = jQuery.extend({ + swfplayer: 'flash/minplayer.swf' + }, this.options); + + minplayer.players.flash.prototype.create.call(this); + + // The flash variables for this flash player. + var flashVars = { + 'id': this.options.id, + 'debug': this.options.debug, + 'config': 'nocontrols', + 'file': this.mediaFile.path, + 'autostart': this.options.autoplay + }; + + // Return a flash media player object. + return minplayer.players.flash.getFlash({ + swf: this.options.swfplayer, + id: this.options.id + '_player', + width: this.options.width, + height: '100%', + flashvars: flashVars, + wmode: this.options.wmode + }); +}; + +/** + * Called when the Flash player has an update. + * + * @param {string} eventType The event that was triggered in the player. + */ +minplayer.players.minplayer.prototype.onMediaUpdate = function(eventType) { + switch (eventType) { + case 'mediaMeta': + this.onLoaded(); + break; + case 'mediaPlaying': + this.onPlaying(); + break; + case 'mediaPaused': + this.onPaused(); + break; + case 'mediaComplete': + this.onComplete(); + break; + } +}; + +/** + * @see minplayer.players.base#load + */ +minplayer.players.minplayer.prototype.load = function(file) { + minplayer.players.flash.prototype.load.call(this, file); + if (file && this.isReady()) { + this.player.loadMedia(file.path, file.stream); + } +}; + +/** + * @see minplayer.players.base#play + */ +minplayer.players.minplayer.prototype.play = function() { + minplayer.players.flash.prototype.play.call(this); + if (this.isReady()) { + this.player.playMedia(); + } +}; + +/** + * @see minplayer.players.base#pause + */ +minplayer.players.minplayer.prototype.pause = function() { + minplayer.players.flash.prototype.pause.call(this); + if (this.isReady()) { + this.player.pauseMedia(); + } +}; + +/** + * @see minplayer.players.base#stop + */ +minplayer.players.minplayer.prototype.stop = function() { + minplayer.players.flash.prototype.stop.call(this); + if (this.isReady()) { + this.player.stopMedia(); + } +}; + +/** + * @see minplayer.players.base#seek + */ +minplayer.players.minplayer.prototype.seek = function(pos) { + minplayer.players.flash.prototype.seek.call(this, pos); + if (this.isReady()) { + this.player.seekMedia(pos); + } +}; + +/** + * @see minplayer.players.base#setVolume + */ +minplayer.players.minplayer.prototype.setVolume = function(vol) { + minplayer.players.flash.prototype.setVolume.call(this, vol); + if (this.isReady()) { + this.player.setVolume(vol); + } +}; + +/** + * @see minplayer.players.base#getVolume + */ +minplayer.players.minplayer.prototype.getVolume = function(callback) { + if (this.isReady()) { + callback(this.player.getVolume()); + } +}; + +/** + * @see minplayer.players.flash#getDuration + */ +minplayer.players.minplayer.prototype.getDuration = function(callback) { + if (this.isReady()) { + + // Check to see if it is immediately available. + var duration = this.player.getDuration(); + if (duration) { + callback(duration); + } + else { + + // If not, then poll every second for the duration. + this.poll((function(player) { + return function() { + duration = player.player.getDuration(); + if (duration) { + callback(duration); + } + return !duration; + }; + })(this), 1000); + } + } +}; + +/** + * @see minplayer.players.base#getCurrentTime + */ +minplayer.players.minplayer.prototype.getCurrentTime = function(callback) { + if (this.isReady()) { + callback(this.player.getCurrentTime()); + } +}; + +/** + * @see minplayer.players.base#getBytesLoaded + */ +minplayer.players.minplayer.prototype.getBytesLoaded = function(callback) { + if (this.isReady()) { + callback(this.player.getMediaBytesLoaded()); + } +}; + +/** + * @see minplayer.players.base#getBytesTotal. + */ +minplayer.players.minplayer.prototype.getBytesTotal = function(callback) { + if (this.isReady()) { + callback(this.player.getMediaBytesTotal()); + } +}; diff --git a/minplayer/src/minplayer.players.vimeo.js b/minplayer/src/minplayer.players.vimeo.js new file mode 100644 index 00000000..a7a9b88a --- /dev/null +++ b/minplayer/src/minplayer.players.vimeo.js @@ -0,0 +1,262 @@ +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.players.base + * @class The vimeo media player. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.players.vimeo = function(context, options, queue) { + + // Derive from players base. + minplayer.players.base.call(this, context, options, queue); +}; + +/** Derive from minplayer.players.base. */ +minplayer.players.vimeo.prototype = new minplayer.players.base(); + +/** Reset the constructor. */ +minplayer.players.vimeo.prototype.constructor = minplayer.players.vimeo; + +/** + * @see minplayer.players.base#getPriority + * @return {number} The priority of this media player. + */ +minplayer.players.vimeo.getPriority = function() { + return 10; +}; + +/** + * @see minplayer.players.base#canPlay + * @return {boolean} If this player can play this media type. + */ +minplayer.players.vimeo.canPlay = function(file) { + + // Check for the mimetype for vimeo. + if (file.mimetype === 'video/vimeo') { + return true; + } + + // If the path is a vimeo path, then return true. + return (file.path.search(/^http(s)?\:\/\/(www\.)?vimeo\.com/i) === 0); +}; + +/** + * Return the ID for a provided media file. + * + * @param {object} file A {@link minplayer.file} object. + * @return {string} The ID for the provided media. + */ +minplayer.players.vimeo.getMediaId = function(file) { + var regex = /^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i; + if (file.path.search(regex) === 0) { + return file.path.match(regex)[3]; + } + else { + return file.path; + } +}; + +/** + * @see minplayer.players.base#reset + */ +minplayer.players.vimeo.prototype.reset = function() { + + // Reset the flash variables.. + minplayer.players.base.prototype.reset.call(this); +}; + +/** + * @see minplayer.players.base#create + * @return {object} The media player entity. + */ +minplayer.players.vimeo.prototype.create = function() { + minplayer.players.base.prototype.create.call(this); + + // Insert the Vimeo Froogaloop player. + var tag = document.createElement('script'); + tag.src = 'http://a.vimeocdn.com/js/froogaloop2.min.js'; + var firstScriptTag = document.getElementsByTagName('script')[0]; + firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); + + // Create the iframe for this player. + var iframe = document.createElement('iframe'); + iframe.setAttribute('id', this.options.id + '-player'); + iframe.setAttribute('type', 'text/html'); + iframe.setAttribute('width', '100%'); + iframe.setAttribute('height', '100%'); + iframe.setAttribute('frameborder', '0'); + + // Get the source. + var src = 'http://player.vimeo.com/video/'; + src += this.mediaFile.id + '?'; + + // Add the parameters to the src. + src += jQuery.param({ + 'wmode': 'opaque', + 'api': 1, + 'player_id': this.options.id + '-player', + 'title': 0, + 'byline': 0, + 'portrait': 0, + 'autoplay': this.options.autoplay, + 'loop': this.options.loop + }); + + // Set the source of the iframe. + iframe.setAttribute('src', src); + + // Now register this player when the froogaloop code is loaded. + this.poll((function(player) { + return function() { + if (window.Froogaloop) { + player.player = window.Froogaloop(iframe); + player.player.addEvent('ready', function() { + player.onReady(); + }); + } + return !window.Froogaloop; + }; + })(this), 200); + + // Trigger that the load has started. + this.trigger('loadstart'); + + // Return the player. + return iframe; +}; + +/** + * @see minplayer.players.base#onReady + */ +minplayer.players.vimeo.prototype.onReady = function(player_id) { + + // Add the other listeners. + this.player.addEvent('loadProgress', (function(player) { + return function(progress) { + player.duration.set(parseFloat(progress.duration)); + player.bytesLoaded.set(progress.bytesLoaded); + player.bytesTotal.set(progress.bytesTotal); + }; + })(this)); + + this.player.addEvent('playProgress', (function(player) { + return function(progress) { + player.duration.set(parseFloat(progress.duration)); + player.currentTime.set(parseFloat(progress.seconds)); + }; + })(this)); + + this.player.addEvent('play', (function(player) { + return function() { + player.onPlaying(); + }; + })(this)); + + this.player.addEvent('pause', (function(player) { + return function() { + player.onPaused(); + }; + })(this)); + + this.player.addEvent('finish', (function(player) { + return function() { + player.onComplete(); + }; + })(this)); + + minplayer.players.base.prototype.onReady.call(this); + this.onLoaded(); +}; + +/** + * Checks to see if this player can be found. + * @return {bool} TRUE - Player is found, FALSE - otherwise. + */ +minplayer.players.vimeo.prototype.playerFound = function() { + var iframe = this.display.find('iframe#' + this.options.id + '-player'); + return (iframe.length > 0); +}; + +/** + * @see minplayer.players.base#play + */ +minplayer.players.vimeo.prototype.play = function() { + minplayer.players.base.prototype.play.call(this); + if (this.isReady()) { + this.player.api('play'); + } +}; + +/** + * @see minplayer.players.base#pause + */ +minplayer.players.vimeo.prototype.pause = function() { + minplayer.players.base.prototype.pause.call(this); + if (this.isReady()) { + this.player.api('pause'); + } +}; + +/** + * @see minplayer.players.base#stop + */ +minplayer.players.vimeo.prototype.stop = function() { + minplayer.players.base.prototype.stop.call(this); + if (this.isReady()) { + this.player.api('unload'); + } +}; + +/** + * @see minplayer.players.base#seek + */ +minplayer.players.vimeo.prototype.seek = function(pos) { + minplayer.players.base.prototype.seek.call(this, pos); + if (this.isReady()) { + this.player.api('seekTo', pos); + } +}; + +/** + * @see minplayer.players.base#setVolume + */ +minplayer.players.vimeo.prototype.setVolume = function(vol) { + minplayer.players.base.prototype.setVolume.call(this, vol); + if (this.isReady()) { + this.volume.set(vol); + this.player.api('setVolume', vol); + } +}; + +/** + * @see minplayer.players.base#getVolume + */ +minplayer.players.vimeo.prototype.getVolume = function(callback) { + this.player.api('getVolume', function(vol) { + callback(vol); + }); +}; + +/** + * @see minplayer.players.base#getDuration. + */ +minplayer.players.vimeo.prototype.getDuration = function(callback) { + if (this.isReady()) { + if (this.duration.value) { + callback(this.duration.value); + } + else { + this.player.api('getDuration', function(duration) { + callback(duration); + }); + } + } +}; diff --git a/minplayer/src/minplayer.players.youtube.js b/minplayer/src/minplayer.players.youtube.js new file mode 100644 index 00000000..ed724197 --- /dev/null +++ b/minplayer/src/minplayer.players.youtube.js @@ -0,0 +1,346 @@ +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.players.base + * @class The YouTube media player. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.players.youtube = function(context, options, queue) { + + /** The quality of the YouTube stream. */ + this.quality = 'default'; + + // Derive from players base. + minplayer.players.base.call(this, context, options, queue); +}; + +/** Derive from minplayer.players.base. */ +minplayer.players.youtube.prototype = new minplayer.players.base(); + +/** Reset the constructor. */ +minplayer.players.youtube.prototype.constructor = minplayer.players.youtube; + +/** + * @see minplayer.players.base#getPriority + * @return {number} The priority of this media player. + */ +minplayer.players.youtube.getPriority = function() { + return 10; +}; + +/** + * @see minplayer.players.base#canPlay + * @return {boolean} If this player can play this media type. + */ +minplayer.players.youtube.canPlay = function(file) { + + // Check for the mimetype for youtube. + if (file.mimetype === 'video/youtube') { + return true; + } + + // If the path is a YouTube path, then return true. + return (file.path.search(/^http(s)?\:\/\/(www\.)?youtube\.com/i) === 0); +}; + +/** + * Return the ID for a provided media file. + * + * @param {object} file A {@link minplayer.file} object. + * @return {string} The ID for the provided media. + */ +minplayer.players.youtube.getMediaId = function(file) { + var regex = /^http[s]?\:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9]+)/i; + if (file.path.search(regex) === 0) { + return file.path.match(regex)[2]; + } + else { + return file.path; + } +}; + +/** + * Register this youtube player so that multiple players can be present + * on the same page without event collision. + */ +minplayer.players.youtube.prototype.register = function() { + + /** + * Register the standard youtube api ready callback. + */ + window.onYouTubePlayerAPIReady = function() { + + // Iterate over each media player. + jQuery.each(minplayer.get(null, 'player'), function(id, player) { + + // Make sure this is the youtube player. + if (player.currentPlayer == 'youtube') { + + // Create a new youtube player object for this instance only. + var playerId = id + '-player'; + + // Set this players media. + player.media.player = new YT.Player(playerId, { + events: { + 'onReady': function(event) { + player.media.onReady(event); + }, + 'onStateChange': function(event) { + player.media.onPlayerStateChange(event); + }, + 'onPlaybackQualityChange': function(newQuality) { + player.media.onQualityChange(newQuality); + }, + 'onError': function(errorCode) { + player.media.onError(errorCode); + } + } + }); + } + }); + } +}; + +/** + * Translates the player state for the YouTube API player. + * + * @param {number} playerState The YouTube player state. + */ +minplayer.players.youtube.prototype.setPlayerState = function(playerState) { + switch (playerState) { + case YT.PlayerState.CUED: + break; + case YT.PlayerState.BUFFERING: + this.onWaiting(); + break; + case YT.PlayerState.PAUSED: + this.onPaused(); + break; + case YT.PlayerState.PLAYING: + this.onPlaying(); + break; + case YT.PlayerState.ENDED: + this.onComplete(); + break; + default: + break; + } +}; + +/** + * Called when an error occurs. + * + * @param {string} event The onReady event that was triggered. + */ +minplayer.players.youtube.prototype.onReady = function(event) { + minplayer.players.base.prototype.onReady.call(this); + this.onLoaded(); +}; + +/** + * Checks to see if this player can be found. + * @return {bool} TRUE - Player is found, FALSE - otherwise. + */ +minplayer.players.youtube.prototype.playerFound = function() { + var iframe = this.display.find('iframe#' + this.options.id + '-player'); + return (iframe.length > 0); +}; + +/** + * Called when the player state changes. + * + * @param {object} event A JavaScript Event. + */ +minplayer.players.youtube.prototype.onPlayerStateChange = function(event) { + this.setPlayerState(event.data); +}; + +/** + * Called when the player quality changes. + * + * @param {string} newQuality The new quality for the change. + */ +minplayer.players.youtube.prototype.onQualityChange = function(newQuality) { + this.quality = newQuality.data; +}; + +/** + * Determines if the player should show the playloader. + * + * @return {bool} If this player implements its own playLoader. + */ +minplayer.players.youtube.prototype.hasPlayLoader = function() { + return true; +}; + +/** + * @see minplayer.players.base#create + * @return {object} The media player entity. + */ +minplayer.players.youtube.prototype.create = function() { + minplayer.players.base.prototype.create.call(this); + + // Insert the YouTube iframe API player. + var tag = document.createElement('script'); + tag.src = 'http://www.youtube.com/player_api?enablejsapi=1'; + var firstScriptTag = document.getElementsByTagName('script')[0]; + firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); + + // Now register this player. + this.register(); + + // Create the iframe for this player. + var iframe = document.createElement('iframe'); + iframe.setAttribute('id', this.options.id + '-player'); + iframe.setAttribute('type', 'text/html'); + iframe.setAttribute('width', '100%'); + iframe.setAttribute('height', '100%'); + iframe.setAttribute('frameborder', '0'); + + // Get the source. + var src = 'http://www.youtube.com/embed/'; + src += this.mediaFile.id + '?'; + + // Determine the origin of this script. + var origin = location.protocol; + origin += '//' + location.hostname; + origin += (location.port && ':' + location.port); + + // Add the parameters to the src. + src += jQuery.param({ + 'wmode': 'opaque', + 'controls': 0, + 'enablejsapi': 1, + 'origin': origin, + 'autoplay': this.options.autoplay, + 'loop': this.options.loop + }); + + // Set the source of the iframe. + iframe.setAttribute('src', src); + + // Return the player. + return iframe; +}; + +/** + * @see minplayer.players.base#load + */ +minplayer.players.youtube.prototype.load = function(file) { + minplayer.players.base.prototype.load.call(this, file); + if (file && this.isReady()) { + this.player.loadVideoById(file.id, 0, this.quality); + } +}; + +/** + * @see minplayer.players.base#play + */ +minplayer.players.youtube.prototype.play = function() { + minplayer.players.base.prototype.play.call(this); + if (this.isReady()) { + this.player.playVideo(); + } +}; + +/** + * @see minplayer.players.base#pause + */ +minplayer.players.youtube.prototype.pause = function() { + minplayer.players.base.prototype.pause.call(this); + if (this.isReady()) { + this.player.pauseVideo(); + } +}; + +/** + * @see minplayer.players.base#stop + */ +minplayer.players.youtube.prototype.stop = function() { + minplayer.players.base.prototype.stop.call(this); + if (this.isReady()) { + this.player.stopVideo(); + } +}; + +/** + * @see minplayer.players.base#seek + */ +minplayer.players.youtube.prototype.seek = function(pos) { + minplayer.players.base.prototype.seek.call(this, pos); + if (this.isReady()) { + this.player.seekTo(pos, true); + } +}; + +/** + * @see minplayer.players.base#setVolume + */ +minplayer.players.youtube.prototype.setVolume = function(vol) { + minplayer.players.base.prototype.setVolume.call(this, vol); + if (this.isReady()) { + this.player.setVolume(vol * 100); + } +}; + +/** + * @see minplayer.players.base#getVolume + */ +minplayer.players.youtube.prototype.getVolume = function(callback) { + if (this.isReady()) { + callback(this.player.getVolume()); + } +}; + +/** + * @see minplayer.players.base#getDuration. + */ +minplayer.players.youtube.prototype.getDuration = function(callback) { + if (this.isReady()) { + callback(this.player.getDuration()); + } +}; + +/** + * @see minplayer.players.base#getCurrentTime + */ +minplayer.players.youtube.prototype.getCurrentTime = function(callback) { + if (this.isReady()) { + callback(this.player.getCurrentTime()); + } +}; + +/** + * @see minplayer.players.base#getBytesStart. + */ +minplayer.players.youtube.prototype.getBytesStart = function(callback) { + if (this.isReady()) { + callback(this.player.getVideoStartBytes()); + } +}; + +/** + * @see minplayer.players.base#getBytesLoaded. + */ +minplayer.players.youtube.prototype.getBytesLoaded = function(callback) { + if (this.isReady()) { + callback(this.player.getVideoBytesLoaded()); + } +}; + +/** + * @see minplayer.players.base#getBytesTotal. + */ +minplayer.players.youtube.prototype.getBytesTotal = function(callback) { + if (this.isReady()) { + callback(this.player.getVideoBytesTotal()); + } +}; diff --git a/minplayer/src/minplayer.plugin.js b/minplayer/src/minplayer.plugin.js new file mode 100644 index 00000000..321f54b1 --- /dev/null +++ b/minplayer/src/minplayer.plugin.js @@ -0,0 +1,549 @@ +/** The minplayer namespace. */ +minplayer = minplayer || {}; + +/** Static array to keep track of all plugins. */ +minplayer.plugins = minplayer.plugins || {}; + +/** Static array to keep track of queues. */ +minplayer.queue = minplayer.queue || []; + +/** Mutex lock to keep multiple triggers from occuring. */ +minplayer.lock = false; + +/** + * @constructor + * @class The base class for all plugins. + * + * @param {string} name The name of this plugin. + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.plugin = function(name, context, options, queue) { + + /** The name of this plugin. */ + this.name = name; + + /** The ready flag. */ + this.pluginReady = false; + + /** The options for this plugin. */ + this.options = options || {}; + + /** The event queue. */ + this.queue = queue || {}; + + /** Keep track of already triggered events. */ + this.triggered = {}; + + /** Create a queue lock. */ + this.lock = false; + + // Only call the constructor if we have a context. + if (context) { + + /** Keep track of the context. */ + this.context = context; + + // Construct this plugin. + this.construct(); + } +}; + +/** + * The constructor which is called once the context is set. + * Any class deriving from the plugin class should place all context + * dependant functionality within this function instead of the standard + * constructor function since it is called on object derivation as well + * as object creation. + */ +minplayer.plugin.prototype.construct = function() { + + // Adds this as a plugin. + this.addPlugin(); +}; + +/** + * Destructor. + */ +minplayer.plugin.prototype.destroy = function() { + + // Unbind all events. + this.unbind(); +}; + +/** + * Creates a new plugin within this context. + * + * @param {string} name The name of the plugin you wish to create. + * @param {object} base The base object for this plugin. + * @param {object} context The context which you would like to create. + * @return {object} The new plugin object. + */ +minplayer.plugin.prototype.create = function(name, base, context) { + var plugin = null; + + // Make sure we have a base object. + base = base || 'minplayer'; + + // Make sure there is a context. + context = context || this.display; + + // See if this plugin exists within this object. + if (window[base][name]) { + + // Set the plugin. + plugin = window[base][name]; + + // See if a template version of the plugin exists. + if (plugin[this.options.template]) { + + plugin = plugin[this.options.template]; + } + + // Create the new plugin. + return new plugin(context, this.options); + } + + return null; +}; + +/** + * Plugins should call this method when they are ready. + */ +minplayer.plugin.prototype.ready = function() { + + // Keep this plugin from triggering multiple ready events. + if (!this.pluginReady) { + + // Set the ready flag. + this.pluginReady = true; + + // Now trigger that I am ready. + this.trigger('ready'); + + // Check the queue. + this.checkQueue(); + } +}; + +/** + * Adds a new plugin to this player. + * + * @param {string} name The name of this plugin. + * @param {object} plugin A new plugin object, derived from media.plugin. + */ +minplayer.plugin.prototype.addPlugin = function(name, plugin) { + name = name || this.name; + plugin = plugin || this; + + // Make sure the plugin is valid. + if (plugin.isValid()) { + + // If the plugins for this instance do not exist. + if (!minplayer.plugins[this.options.id]) { + + // Initialize the plugins. + minplayer.plugins[this.options.id] = {}; + } + + // Add this plugin. + minplayer.plugins[this.options.id][name] = plugin; + } +}; + +/** + * Create a polling timer. + * + * @param {function} callback The function to call when you poll. + * @param {integer} interval The interval you would like to poll. + */ +minplayer.plugin.prototype.poll = function(callback, interval) { + setTimeout((function(context) { + return function callLater() { + if (callback.call(context)) { + setTimeout(callLater, interval); + } + }; + })(this), interval); +}; + +/** + * Gets a plugin by name and calls callback when it is ready. + * + * @param {string} plugin The plugin of the plugin. + * @param {function} callback Called when the plugin is ready. + * @return {object} The plugin if no callback is provided. + */ +minplayer.plugin.prototype.get = function(plugin, callback) { + + // If they pass just a callback, then return all plugins when ready. + if (typeof plugin === 'function') { + callback = plugin; + plugin = null; + } + + // Return the minplayer.get equivalent. + return minplayer.get.call(this, this.options.id, plugin, callback); +}; + +/** + * Check the queue and execute it. + */ +minplayer.plugin.prototype.checkQueue = function() { + + // Initialize our variables. + var q = null, i = 0, check = false, newqueue = []; + + // Set the lock. + minplayer.lock = true; + + // Iterate through all the queues. + var length = minplayer.queue.length; + for (i = 0; i < length; i++) { + + // Get the queue. + q = minplayer.queue[i]; + + // Now check to see if this queue is about us. + check = !q.id && !q.plugin; + check |= (q.plugin == this.name) && (!q.id || (q.id == this.options.id)); + + // If the check passes... + if (check) { + check = minplayer.bind.call( + q.context, + q.event, + this.options.id, + this.name, + q.callback + ); + } + + // Add the queue back if it doesn't check out. + if (!check) { + + // Add this back to the queue. + newqueue.push(q); + } + } + + // Set the old queue to the new queue. + minplayer.queue = newqueue; + + // Release the lock. + minplayer.lock = false; +}; + +/** + * Trigger a media event. + * + * @param {string} type The event type. + * @param {object} data The event data object. + * @return {object} The plugin object. + */ +minplayer.plugin.prototype.trigger = function(type, data) { + data = data || {}; + data.plugin = this; + + // Add this to our triggered array. + this.triggered[type] = data; + + // Check to make sure the queue for this type exists. + if (this.queue.hasOwnProperty(type)) { + + var i = 0, queue = {}; + + // Iterate through all the callbacks in this queue. + for (i in this.queue[type]) { + + // Setup the event object, and call the callback. + queue = this.queue[type][i]; + queue.callback({target: this, data: queue.data}, data); + } + } + + // Return the plugin object. + return this; +}; + +/** + * Bind to a media event. + * + * @param {string} type The event type. + * @param {object} data The data to bind with the event. + * @param {function} fn The callback function. + * @return {object} The plugin object. + **/ +minplayer.plugin.prototype.bind = function(type, data, fn) { + + // Allow the data to be the callback. + if (typeof data === 'function') { + fn = data; + data = null; + } + + // You must bind to a specific event and have a callback. + if (!type || !fn) { + return; + } + + // Initialize the queue for this type. + this.queue[type] = this.queue[type] || []; + + // Unbind any existing equivalent events. + this.unbind(type, fn); + + // Now add this event to the queue. + this.queue[type].push({ + callback: fn, + data: data + }); + + // Now see if this event has already been triggered. + if (this.triggered[type]) { + + // Go ahead and trigger the event. + fn({target: this, data: data}, this.triggered[type]); + } + + // Return the plugin. + return this; +}; + +/** + * Unbind a media event. + * + * @param {string} type The event type. + * @param {function} fn The callback function. + * @return {object} The plugin object. + **/ +minplayer.plugin.prototype.unbind = function(type, fn) { + + // If this is locked then try again after 10ms. + if (this.lock) { + setTimeout((function(plugin) { + return function() { + plugin.unbind(type, fn); + }; + })(this), 10); + } + + // Set the lock. + this.lock = true; + + if (!type) { + this.queue = {}; + } + else if (!fn) { + this.queue[type] = []; + } + else { + // Iterate through all the callbacks and search for equal callbacks. + var i = 0, queue = {}; + for (i in this.queue[type]) { + if (this.queue[type][i].callback === fn) { + queue = this.queue[type].splice(1, 1); + delete queue; + } + } + } + + // Reset the lock. + this.lock = false; + + // Return the plugin. + return this; +}; + +/** + * Adds an item to the queue. + * + * @param {object} context The context which this is called within. + * @param {string} event The event to trigger on. + * @param {string} id The player ID. + * @param {string} plugin The name of the plugin. + * @param {function} callback Called when the event occurs. + */ +minplayer.addQueue = function(context, event, id, plugin, callback) { + + // See if it is locked... + if (!minplayer.lock) { + minplayer.queue.push({ + context: context, + id: id, + event: event, + plugin: plugin, + callback: callback + }); + } + else { + + // If so, then try again after 10 milliseconds. + setTimeout(function() { + minplayer.addQueue(context, id, event, plugin, callback); + }, 10); + } +}; + +/** + * Binds an event to a plugin instance, and if it doesn't exist, then caches + * it for a later time. + * + * @param {string} event The event to trigger on. + * @param {string} id The player ID. + * @param {string} plugin The name of the plugin. + * @param {function} callback Called when the event occurs. + * @return {boolean} If the bind was successful. + * @this The object in context who called this method. + */ +minplayer.bind = function(event, id, plugin, callback) { + + // If no callback exists, then just return false. + if (!callback) { + return false; + } + + // Get the plugins. + var inst = minplayer.plugins; + + // See if this plugin exists. + if (inst[id][plugin]) { + + // If so, then bind the event to this plugin. + inst[id][plugin].bind(event, {context: this}, function(event, data) { + callback.call(event.data.context, data.plugin); + }); + return true; + } + + // If not, then add it to the queue to bind later. + minplayer.addQueue(this, event, id, plugin, callback); + + // Return that this wasn't handled. + return false; +}; + +/** + * The main API for minPlayer. + * + * Provided that this function takes three parameters, there are 8 different + * ways to use this api. + * + * id (0x100) - You want a specific player. + * plugin (0x010) - You want a specific plugin. + * callback (0x001) - You only want it when it is ready. + * + * 000 - You want all plugins from all players, ready or not. + * + * var plugins = minplayer.get(); + * + * 001 - You want all plugins from all players, but only when ready. + * + * minplayer.get(function(plugin) { + * // Code goes here. + * }); + * + * 010 - You want a specific plugin from all players, ready or not... + * + * var medias = minplayer.get(null, 'media'); + * + * 011 - You want a specific plugin from all players, but only when ready. + * + * minplayer.get('player', function(player) { + * // Code goes here. + * }); + * + * 100 - You want all plugins from a specific player, ready or not. + * + * var plugins = minplayer.get('player_id'); + * + * 101 - You want all plugins from a specific player, but only when ready. + * + * minplayer.get('player_id', null, function(plugin) { + * // Code goes here. + * }); + * + * 110 - You want a specific plugin from a specific player, ready or not. + * + * var plugin = minplayer.get('player_id', 'media'); + * + * 111 - You want a specific plugin from a specific player, only when ready. + * + * minplayer.get('player_id', 'media', function(media) { + * // Code goes here. + * }); + * + * @this The context in which this function was called. + * @param {string} id The ID of the widget to get the plugins from. + * @param {string} plugin The name of the plugin. + * @param {function} callback Called when the plugin is ready. + * @return {object} The plugin object if it is immediately available. + */ +minplayer.get = function(id, plugin, callback) { + + // Normalize the arguments for a better interface. + if (typeof id === 'function') { + callback = id; + plugin = id = null; + } + + if (typeof plugin === 'function') { + callback = plugin; + plugin = id; + id = null; + } + + // Make sure the callback is a callback. + callback = (typeof callback === 'function') ? callback : null; + + // Get the plugins. + var plugins = minplayer.plugins; + + // 0x000 + if (!id && !plugin && !callback) { + return plugins; + } + // 0x100 + else if (id && !plugin && !callback) { + return plugins[id]; + } + // 0x110 + else if (id && plugin && !callback) { + return plugins[id][plugin]; + } + // 0x111 + else if (id && plugin && callback) { + minplayer.bind.call(this, 'ready', id, plugin, callback); + } + // 0x011 + else if (!id && plugin && callback) { + for (var id in plugins) { + minplayer.bind.call(this, 'ready', id, plugin, callback); + } + } + // 0x101 + else if (id && !plugin && callback) { + for (var plugin in plugins[id]) { + minplayer.bind.call(this, 'ready', id, plugin, callback); + } + } + // 0x010 + else if (!id && plugin && !callback) { + var plugin_types = {}; + for (var id in plugins) { + if (plugins.hasOwnProperty(id) && plugins[id].hasOwnProperty(plugin)) { + plugin_types[id] = plugins[id][plugin]; + } + } + return plugin_types; + } + // 0x001 + else { + for (var id in plugins) { + for (var plugin in plugins[id]) { + minplayer.bind.call(this, 'ready', id, plugin, callback); + } + } + } +}; diff --git a/minplayer/templates/default/css/images/loader.gif b/minplayer/templates/default/css/images/loader.gif new file mode 100644 index 00000000..5e2d1673 Binary files /dev/null and b/minplayer/templates/default/css/images/loader.gif differ diff --git a/minplayer/templates/default/css/images/pause-icon.png b/minplayer/templates/default/css/images/pause-icon.png new file mode 100644 index 00000000..17874391 Binary files /dev/null and b/minplayer/templates/default/css/images/pause-icon.png differ diff --git a/minplayer/templates/default/css/images/play-icon.png b/minplayer/templates/default/css/images/play-icon.png new file mode 100644 index 00000000..71a34135 Binary files /dev/null and b/minplayer/templates/default/css/images/play-icon.png differ diff --git a/minplayer/templates/default/css/images/volume-full-icon.png b/minplayer/templates/default/css/images/volume-full-icon.png new file mode 100644 index 00000000..b0bfa43a Binary files /dev/null and b/minplayer/templates/default/css/images/volume-full-icon.png differ diff --git a/minplayer/templates/default/css/images/volume-mute-icon.png b/minplayer/templates/default/css/images/volume-mute-icon.png new file mode 100644 index 00000000..23979e32 Binary files /dev/null and b/minplayer/templates/default/css/images/volume-mute-icon.png differ diff --git a/minplayer/templates/default/css/media_player_default.css b/minplayer/templates/default/css/media_player_default.css new file mode 100644 index 00000000..e3b228ae --- /dev/null +++ b/minplayer/templates/default/css/media_player_default.css @@ -0,0 +1,481 @@ + +/* base styles */ +.media-player {} +.media-player-play, .media-player-volume-button { + cursor: pointer; +} +.media-player-timer { + cursor: default; +} + +.media-player { + position: relative; + background:#000; + border:1px solid #333; + font-family:"Trebuchet MS", Helvetica, sans-serif; + -moz-box-shadow:0px 5px 10px #333;/*no-important moz*/ + -webkit-box-shadow:0px 5px 10px #333;/*no-important chrome*/ +} + +.media-player .media-player-error { + display:none; + position: absolute; + top: 80%; + left: 50%; + width: 320px; + height: 40px; + line-height: 40px; + margin: -20px 0 0 -160px; + text-align: center; + vertical-align: center; + border: none; + z-index:1000; + color: #fff; + opacity: 0.9; + border-radius: 10px; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + background: rgba(23, 35, 34, 0.9); + box-shadow: 2px 2px 4px #000; + -webkit-box-shadow: 2px 2px 4px #000; + -moz-box-shadow: 2px 2px 4px #000; +} + +.media-player .media-player-display { + background-color:#000; + width:100%; + height:100%; +} + +.media-player .media-player-display video { + width: 100%; + height: 100%; +} + +.media-player .media-player-preview { + width:100%; + height:100%; + position:absolute; + z-index:1; +} + +.media-player .media-player-preview.has-preview { + background-color: rgb(0, 0, 0); +} + +.media-player .media-player-play-loader { + width:100%; + height:100%; + position:absolute; + z-index:2; + background: rgb(0, 0, 0); + background: rgba(0, 0, 0, 0.3); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#55000000, endColorstr=#55000000); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#55000000, endColorstr=#55000000)"; +} + +.media-player .media-player-play-loader .media-player-loader { + width:42px; + height:10px; + position: absolute; + z-index: 4; + top: 50%; + left: 50%; + margin: -5px 0 0 -21px; + text-align:center; + vertical-align:center; + background: url(images/loader.gif) no-repeat; +} + +/* Big play button */ +.media-player .media-player-play-loader .media-player-big-play { + position: absolute; + top: 50%; + left: 50%; + width: 80px; + height: 80px; + margin: -40px 0 0 -40px; + text-align: center; + vertical-align: center; + cursor: pointer !important; + border: none; + opacity: 0.9; + z-index:3; + border-radius: 10px; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + background: rgba(23, 35, 34, 0.746094); + box-shadow: 2px 2px 4px #000; + -webkit-box-shadow: 2px 2px 4px #000; + -moz-box-shadow: 2px 2px 4px #000; +} + +.media-player .media-player-play-loader .media-player-big-play span { + margin: 22px 0 0 48px; + border-left: 36px solid white; + border-top: 18px solid transparent; + border-bottom: 18px solid transparent; +} + +.media-player .media-player-play-loader .media-player-big-play span { + display: block; + font-size: 0; + line-height: 0; + width: 0; + height: 0; + margin: 20px 0 0 23px; + border-left: 40px solid white; + border-top: 20px solid transparent; + border-bottom: 20px solid transparent; +} + +.media-player.fullscreen, .media-player.fullscreen .media-player-display, .media-player.fullscreen .media-player-play-loader { + position: fixed; + left: 0; + top: 0; + right: 0; + bottom: 0; + overflow: hidden; + z-index:1000; + width: 100% !important; + height: 100% !important; +} + +.media-player.fullscreen .media-player-play-loader { + z-index:1001; +} + +.media-player .media-player-controls { + position: absolute; + display: block; + z-index:3; + bottom:0px; + left:0px; + right:0px; + height:30px; + background-color:rgba(0,0,0,0.5); +} + +.media-player-controls-left { + float:left; + width:30px; + height:26px; + margin: 2px 0; + border-right:1px solid #eee; +} + +.media-player.fullscreen .media-player-controls-left { + width:40px; + border:none; +} + +.media-player-controls-right { + float:right; + width:120px; + height:30px; +} + +.media-player.fullscreen .media-player-controls-right { + width:110px; +} + +.media-player-controls-mid { + position:absolute; + left:40px; + right:130px; + height:30px; +} + +.media-player.fullscreen .media-player-controls-mid { + left:50px; +} + +.media-player .media-player-play, .media-player .media-player-volume, .media-player .media-player-timer { + float: left; +} + +/* play, pause */ +.media-player .media-player-play, .media-player .media-player-pause { + display: block; + width: 22px; + height: 22px; + margin:2px 0 0 4px; + opacity: 0.7; + -moz-transition: all 0.2s ease-in-out; /* Firefox */ + -webkit-transition: all 0.2s ease-in-out; /* Safari and Chrome */ + -o-transition: all 0.2s ease-in-out; /* Opera */ + transition: all 0.2s ease-in-out; +} + +.media-player .media-player-play:hover, .media-player .media-player-pause:hover { + opacity: 1; +} + +.media-player .media-player-play { + background: url(images/play-icon.png) no-repeat; +} + +.media-player .media-player-pause { + background: url(images/pause-icon.png) no-repeat; + display:none; +} + +/* seek */ +.media-player .media-player-seek { + position:relative; + height: 10px; + margin-top:9px; + border: 1px solid #494949; + -moz-border-radius:4px; + -webkit-border-radius:4px; + border-radius:4px; + background: #535353; + background-image: -moz-linear-gradient(top, #535353, #333333); + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #535353),color-stop(1, #333333)); + box-shadow: inset 0 -3px 3px #333333; +} + +.media-player .media-player-seek .ui-slider-handle { + width: 15px; + height: 15px; + border: 1px solid #333; + top: -4px; + z-index:20px; + -moz-border-radius:10px; + -webkit-border-radius:10px; + border-radius:10px; + background: #e6e6e6; + background-image: -moz-linear-gradient(top, #e6e6e6, #d5d5d5); + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #e6e6e6),color-stop(1, #d5d5d5)); + box-shadow: inset 0 -3px 3px #d5d5d5; +} + +.media-player .media-player-seek .ui-slider-handle.ui-state-hover { + background: #fff; +} + +.media-player .media-player-seek .ui-slider-range { + -moz-border-radius:15px; + -webkit-border-radius:15px; + z-index:10px; + border-radius:15px; + background: #4cbae8; + background-image: -moz-linear-gradient(top, #4cbae8, #39a2ce); + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #4cbae8),color-stop(1, #39a2ce)); + box-shadow: inset 0 -3px 3px #39a2ce; +} + +.media-player .media-player-progress { + -moz-border-radius:15px; + -webkit-border-radius:15px; + z-index:8px; + width:0px; + height:10px; + border-radius:15px; + background: #266580; + background-image: -moz-linear-gradient(top, #266580, #153A4A); + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #266580),color-stop(1, #153A4A)); + box-shadow: inset 0 -3px 3px #153A4A; +} + +/* timer */ +.media-player .media-player-timer { + position:relative; + float:left; + color: #999; + margin-top:3px; + padding-right:6px; + font-size: 16px; + font-weight: bold; + border-right:1px solid #eee; +} + +.media-player.fullscreen .media-player-timer { + border:none; + margin-top:4px; +} + +/* volume */ +.media-player .media-player-volume { + position: absolute; + right:33px; + bottom:4px; + float:right; + overflow: hidden; + width: 20px; + height: 30px; + color: #fff; + padding: 0px 10px; + -moz-transition: all 0.1s ease-in-out; /* Firefox */ + -webkit-transition: all 0.1s ease-in-out; /* Safari and Chrome */ + -o-transition: all 0.2s ease-in-out; /* Opera */ + transition: all 0.1s ease-in-out; +} + +.media-player.fullscreen .media-player-volume { + right:40px; + bottom:13px; +} + +.media-player .media-player-volume:hover { + height: 135px; + padding-top: 5px; +} + + +.media-player .media-player-volume:hover .media-player-volume-slider { + position: relative; + visibility: visible; + opacity: 1; +} + +.media-player .media-player-volume-slider { + position: relative; + height: 100px; + width: 7px; + left: 4px; + visiblity: hidden; + opacity: 0; + border: 1px solid #444; + -moz-border-radius:15px; + -webkit-border-radius:15px; + border-radius:15px; + background: #535353; + background-image: -moz-linear-gradient(top, #535353, #333333); + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #535353),color-stop(1, #333333)); + box-shadow: inset 0 3px 3px #333333; + -moz-transition: all 0.1s ease-in-out; /* Firefox */ + -webkit-transition: all 0.1s ease-in-out; /* Safari and Chrome */ + -o-transition: all 0.1s ease-in-out; /* Opera */ + transition: all 0.1s ease-in-out; +} + +.media-player .media-player-volume-slider .ui-slider-handle { + width: 12px; + height: 12px; + left: -4px; + margin-bottom:-0.6em; + margin-left:0; + border: 1px solid #333; + -moz-border-radius:10px; + -webkit-border-radius:10px; + border-radius:10px; + background: #e6e6e6; + background-image: -moz-linear-gradient(top, #e6e6e6, #d5d5d5); + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #e6e6e6),color-stop(1, #d5d5d5)); + + box-shadow: inset 0 3px 3px #d5d5d5; +} + +.media-player .media-player-volume-slider .ui-slider-handle.ui-state-hover { + background: #fff; +} + +.media-player .media-player-volume-slider .ui-slider-range { + -moz-border-radius:15px; + -webkit-border-radius:15px; + border-radius:15px; + background: #e6e6e6; + background-image: -moz-linear-gradient(top, #e6e6e6, #d5d5d5); + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #e6e6e6),color-stop(1, #d5d5d5)); + box-shadow: inset 0 3px 3px #d5d5d5; +} + +/* volume button */ + +.media-player .media-player-volume-button { + position: absolute; + bottom: 0px; + display: block; + width: 22px; + height: 22px; + background: url(images/volume-full-icon.png) no-repeat; + text-indent: -9999px; + opacity: 0.8; +} + +.media-player .media-player-volume-button:hover { + opacity: 1; +} + +.media-player .media-player-volume-mute { + background: url(images/volume-mute-icon.png) no-repeat; +} + +/* Fullscreen button */ +.media-player .media-player-fullscreen { + position: absolute; + right:6px; + bottom:7px; + width: 22px; + height: 14px; + border:1px solid #aaa; +} + +.media-player.fullscreen .media-player-fullscreen { + right:14px; + bottom:16px; +} + +.media-player .media-player-fullscreen-inner, .media-player.fullscreen .media-player-fullscreen:hover .media-player-fullscreen-inner { + position:absolute; + bottom:0; + width:16px; + height:8px; + background-color:#aaa; + -moz-transition: all 0.1s ease-in-out; /* Firefox */ + -webkit-transition: all 0.1s ease-in-out; /* Safari and Chrome */ + -o-transition: all 0.1s ease-in-out; /* Opera */ + transition: all 0.1s ease-in-out; +} + +.media-player .media-player-fullscreen:hover .media-player-fullscreen-inner, .media-player.fullscreen .media-player-fullscreen-inner { + width:20px; + height:12px; +} + +.media-player.fullscreen .media-player-controls { + position: absolute; + z-index:1002; + width:500px; + left: 50%; + bottom:10px; + margin: 0 0 0 -260px; + padding: 10px; + border: 1px solid #2E2E2E; + -moz-border-radius: 5px; /* FF1+ */ + -webkit-border-radius: 5px; /* Saf3+, Chrome */ + border-radius: 5px; /* Opera 10.5, IE 9 */ + background: #000000; + background-image: -moz-linear-gradient(top, #313131, #000000); /* FF3.6 */ + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #313131),color-stop(1, #000000)); /* Saf4+, Chrome */ + box-shadow: inset 0 15px 35px #535353; + -moz-transition: all 0.1s ease-in-out; /* Firefox */ + -webkit-transition: all 0.1s ease-in-out; /* Safari and Chrome */ + -o-transition: all 0.1s ease-in-out; /* Opera */ + transition: all 0.1s ease-in-out; +} + + +/* needed jquery ui styles + * using these, we don't depend on jQuery UI's stylsheet +*/ +.ui-slider-handle { + position: absolute; + z-index: 4; + display: block; + margin-left:-0.6em; + cursor: default; + outline: none; +} + +.ui-slider-range { + display:block; + width:100%; + height:100%; + left:0; + bottom: 0; + border:0 none; + position:absolute; + z-index:3; +} \ No newline at end of file diff --git a/minplayer/templates/default/js/minplayer.controller.default.js b/minplayer/templates/default/js/minplayer.controller.default.js new file mode 100644 index 00000000..5aaf4090 --- /dev/null +++ b/minplayer/templates/default/js/minplayer.controller.default.js @@ -0,0 +1,114 @@ +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +// Define the controller object. +minplayer.controller = minplayer.controller || {}; + +/** + * Constructor for the minplayer.controller + */ +minplayer.controller["default"] = function(context, options) { + + // The fade timer. + this.timer = 0; + + // Derive from base controller + minplayer.controller.call(this, context, options); +}; + +/** Derive from controller. */ +minplayer.controller["default"].prototype = new minplayer.controller(); +minplayer.controller["default"].prototype.constructor = minplayer.controller["default"]; + +/** + * @see minplayer.plugin#construct + */ +minplayer.controller["default"].prototype.construct = function() { + minplayer.controller.prototype.construct.call(this); + minplayer.get.call(this, this.options.id, null, function(plugin) { + plugin.bind('fullscreen', {obj:this}, function(event, full) { + event.data.obj.onFullScreen(full); + }); + }); +} + +/** + * Trigger when we go into full screen. + */ +minplayer.controller["default"].prototype.onFullScreen = function(full) { + if (full) { + + var _this = this; + var showThenHide = function() { + clearTimeout(_this.timer); + _this.display.show(); + _this.timer = setTimeout(function () { + _this.display.hide('fast'); + }, 5000); + }; + + // Bind when they move the mouse. + jQuery(document).bind('mousemove', showThenHide); + showThenHide(); + } + else { + + // Unbind the show then hide function. + this.display.show(); + clearTimeout(this.timer); + jQuery(document).unbind('mousemove', showThenHide); + } +}; + +/** + * Return the display for this plugin. + */ +minplayer.controller["default"].prototype.getDisplay = function(context, options) { + + // See if we need to build out the controller. + if (options.build) { + + // Prepend the control template. + context.prepend('\ +
\ +
\ +
\ + \ + \ +
\ +
\ +
00:00
\ +
\ +
\ +
\ +
\ +
\ + \ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
'); + } + + return jQuery('.media-player-controls', context); +} + +// Return the elements +minplayer.controller["default"].prototype.getElements = function() { + var elements = minplayer.controller.prototype.getElements.call(this); + var timer = jQuery(".media-player-timer", this.display); + return jQuery.extend(elements, { + play: jQuery(".media-player-play", this.display), + pause: jQuery(".media-player-pause", this.display), + fullscreen: jQuery(".media-player-fullscreen", this.display), + seek: jQuery(".media-player-seek", this.display), + progress: jQuery(".media-player-progress", this.display), + volume: jQuery(".media-player-volume-slider", this.display), + timer:timer, + duration:timer + }); +}; diff --git a/minplayer/templates/default/js/minplayer.default.js b/minplayer/templates/default/js/minplayer.default.js new file mode 100644 index 00000000..74a644c9 --- /dev/null +++ b/minplayer/templates/default/js/minplayer.default.js @@ -0,0 +1,60 @@ +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +// Default player. +minplayer["default"] = function(context, options) { + + // Derive from minplayer. + minplayer.call(this, context, options); +}; + +/** + * Define this template prototype. + */ +minplayer["default"].prototype = new minplayer(); +minplayer["default"].prototype.constructor = minplayer["default"]; + +/** + * Return the display for this plugin. + */ +minplayer["default"].prototype.getDisplay = function(context, options) { + + // Convert the context to jQuery object. + context = jQuery(context); + + // If the tag is video or audio, then build out the player. + var tag = context.get(0).tagName.toLowerCase(); + if (tag == 'video' || tag == 'audio') { + + // Build out the player provided the base tag. + context = context.attr({ + 'id': options.id + '-player', + 'class': 'media-player-media' + }) + .wrap(jQuery(document.createElement('div')).attr({ + 'class': 'media-player-display' + })).parent('.media-player-display') + .wrap(jQuery(document.createElement('div')).attr({ + 'id': options.id, + 'class': 'media-player' + })).parent('.media-player'); + + // Mark a flag that says this display needs to be built. + options.build = true; + } + + return context; +} + +// Get the elements for this player. +minplayer["default"].prototype.getElements = function() { + var elements = minplayer.prototype.getElements.call(this); + + // Return the jQuery elements. + return jQuery.extend(elements, { + player:this.display, + display:jQuery(".media-player-display", this.display), + media:jQuery("#" + this.options.id + "-player", this.display), + error:jQuery('.media-player-error', this.display) + }); +}; diff --git a/minplayer/templates/default/js/minplayer.playLoader.default.js b/minplayer/templates/default/js/minplayer.playLoader.default.js new file mode 100644 index 00000000..eb606674 --- /dev/null +++ b/minplayer/templates/default/js/minplayer.playLoader.default.js @@ -0,0 +1,46 @@ +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +// Define the busy object. +minplayer.playLoader = minplayer.playLoader || {}; + +// constructor. +minplayer.playLoader["default"] = function(context, options) { + + // Derive from busy + minplayer.playLoader.call(this, context, options); +}; + +// Define the prototype for all controllers. +minplayer.playLoader["default"].prototype = new minplayer.playLoader(); +minplayer.playLoader["default"].prototype.constructor = minplayer.playLoader["default"]; + +/** + * Return the display for this plugin. + */ +minplayer.playLoader["default"].prototype.getDisplay = function(context, options) { + + // See if we need to build out the controller. + if (options.build) { + + // Prepend the playloader template. + context.prepend('\ +
\ +
\ +
 
\ +
\ +
'); + } + + return jQuery('.media-player-play-loader', context); +} + +// Return the elements +minplayer.playLoader["default"].prototype.getElements = function() { + var elements = minplayer.playLoader.prototype.getElements.call(this); + return jQuery.extend(elements, { + busy:jQuery(".media-player-loader", this.display), + bigPlay:jQuery(".media-player-big-play", this.display), + preview:jQuery(".media-player-preview", this.display) + }); +}; diff --git a/minplayer/templates/default/media_player_default.tpl.php b/minplayer/templates/default/media_player_default.tpl.php new file mode 100644 index 00000000..b39ce953 --- /dev/null +++ b/minplayer/templates/default/media_player_default.tpl.php @@ -0,0 +1,32 @@ +
+
+
+
+ + +
+
+
00:00
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
 
+
+
+
+ +
+
\ No newline at end of file diff --git a/minplayer/tools/README.md b/minplayer/tools/README.md new file mode 100644 index 00000000..cca552e5 --- /dev/null +++ b/minplayer/tools/README.md @@ -0,0 +1,5 @@ +This is a tools folder used to run the makefile. You can easily get all the +necessary tools by navigating to the player folder within Terminal, and then +type the following command. + + sudo make -B tools diff --git a/playlist.xml b/playlist.xml index ebceba3a..c604be98 100644 --- a/playlist.xml +++ b/playlist.xml @@ -2,55 +2,59 @@ - http://upload.wikimedia.org/wikipedia/commons/6/69/RoboCupSoccer_Robot_Football_at_2009_German_Open.ogg - Mike1024 - OGG Video: Robocup Soccer - A robotic soccer tournament. - http://upload.wikimedia.org/wikipedia/commons/thumb/6/69/RoboCupSoccer_Robot_Football_at_2009_German_Open.ogg/mid-RoboCupSoccer_Robot_Football_at_2009_German_Open.ogg.jpg - http://commons.wikimedia.org/wiki/File:RoboCupSoccer_Robot_Football_at_2009_German_Open.ogg - - - http://upload.wikimedia.org/wikipedia/commons/2/2f/Levitron-levitating-top-demonstrating-Roy-M-Harrigans-spin-stabilized-magnetic-levitation.ogg - Scott Stevenson - OGG Video: Levitron - Wikipedia demonstration video of the Levitron levitating top device which partially explains its reliance upon the principle of spin stabilized magnetic levitation. A phenomenon discovered through invention in the late 1970's by Roy M. Harrigan (for which he received a patent in 1983 #4,382,245). - http://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Levitron-levitating-top-demonstrating-Roy-M-Harrigans-spin-stabilized-magnetic-levitation.ogg/mid-Levitron-levitating-top-demonstrating-Roy-M-Harrigans-spin-stabilized-magnetic-levitation.ogg.jpg - http://commons.wikimedia.org/wiki/File:Levitron-levitating-top-demonstrating-Roy-M-Harrigans-spin-stabilized-magnetic-levitation.ogg - - - http://www.vimeo.com/5653474 - nesthor - Vimeo Example: Kuroshio Sea - Vimeo Example. - http://ats.vimeo.com/192/971/19297174_100.jpg - - - http://www.youtube.com/watch?v=dTAAsCNK7RA - Ok Go! - YouTube Example: Ok Go! - YouTube Example. - http://i1.ytimg.com/vi/dTAAsCNK7RA/hqdefault.jpg - - - http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_640x360.m4v - www.bigbuckbunny.org - M4V Example: Big Buck Bunny - M4V Example. - http://upload.wikimedia.org/wikipedia/commons/5/5f/BBB-Bunny.png - - - http://mirror.cs.umn.edu/blender.org/peach/trailer/trailer_480p.mov - www.bigbuckbunny.org - MOV (Flash) Example: Big Buck Bunny Trailer - MOV Example. - http://peach.blender.org/wp-content/uploads/watchtrailer.gif - - - http://upload.wikimedia.org/wikipedia/commons/c/cf/Big_Buck_Bunny_8_seconds_bird_clip.ogv - www.bigbuckbunny.org - OGV Example: Bird in Tree - OGV Example. - http://upload.wikimedia.org/wikipedia/commons/thumb/c/cf/Big_Buck_Bunny_8_seconds_bird_clip.ogv/mid-Big_Buck_Bunny_8_seconds_bird_clip.ogv.jpg - + The Dark Knight Rises + http://progressive.totaleclips.com.edgesuite.net/105/e105947_257.mp4 + http://ia.media-imdb.com/images/M/MV5BMTY0MTc2OTUwNV5BMl5BanBnXkFtZTcwNjk4NjQxNw@@._V1._SX640_SY947_.jpg + + + The Amazing Spiderman + http://progressive.totaleclips.com.edgesuite.net/108/e108011_257.mp4 + http://ia.media-imdb.com/images/M/MV5BMTUwMzk3NTQ2Ml5BMl5BanBnXkFtZTcwMDYyMzUxNw@@._V1._SX640_SY948_.jpg + + + Matagascar III + http://progressive.totaleclips.com.edgesuite.net/105/e105598_257.mp4 + http://ia.media-imdb.com/images/M/MV5BMTM2MTIzNzk2MF5BMl5BanBnXkFtZTcwMDcwMzQxNw@@._V1._SX640_SY946_.jpg + + + Snow White and the Huntsman + http://progressive.totaleclips.com.edgesuite.net/103/e103981_257.mp4 + http://ia.media-imdb.com/images/M/MV5BMTQ1NDA0MTk5OV5BMl5BanBnXkFtZTcwMTM4NDMwNw@@._V1._SX509_SY755_.jpg + + + Men in Black III + http://progressive.totaleclips.com.edgesuite.net/105/e105857_257.mp4 + http://ia.media-imdb.com/images/M/MV5BMTA5MTMyNTQwMjVeQTJeQWpwZ15BbWU3MDExOTk2NDc@._V1._SX508_SY755_.jpg + + + The Three Stooges + http://progressive.totaleclips.com.edgesuite.net/105/e105408_227.mp4 + http://ia.media-imdb.com/images/M/MV5BMTQwMzYwNjQ3OF5BMl5BanBnXkFtZTcwNzczNDMxNw@@._V1._SX486_SY720_.jpg + + + The Hunger Games + http://progressive.totaleclips.com.edgesuite.net/107/e107950_227.mp4 + http://ia.media-imdb.com/images/M/MV5BMjA4NDg3NzYxMF5BMl5BanBnXkFtZTcwNTgyNzkyNw@@._V1._SX640_SY948_.jpg + + + Se7en + http://progressive.totaleclips.com.edgesuite.net/102/e10278_301.mp4 + http://ia.media-imdb.com/images/M/MV5BMTQwNTU3MTE4NF5BMl5BanBnXkFtZTcwOTgxNDM2Mg@@._V1._SX326_SY500_.jpg + + + The Matrix + http://progressive.totaleclips.com.edgesuite.net/445/e44573_301.mp4 + http://ia.media-imdb.com/images/M/MV5BMjEzNjg1NTg2NV5BMl5BanBnXkFtZTYwNjY3MzQ5._V1._SX338_SY475_.jpg + + + Amelie + http://progressive.totaleclips.com.edgesuite.net/203/e20379_301.mp4 + http://ia.media-imdb.com/images/M/MV5BMTUwNzkwMTk5Nl5BMl5BanBnXkFtZTYwMDAzMDI5._V1._SX329_SY475_.jpg + + + The Prestige + http://progressive.totaleclips.com.edgesuite.net/308/e30871_257.mp4 + http://ia.media-imdb.com/images/M/MV5BMjA4NDI0MTIxNF5BMl5BanBnXkFtZTYwNTM0MzY2._V1._SX450_SY667_.jpg + diff --git a/playlist/Playlist.php b/playlist/Playlist.php deleted file mode 100755 index 7a0bb323..00000000 --- a/playlist/Playlist.php +++ /dev/null @@ -1,501 +0,0 @@ -show(); - * ?> - * - * This code will then look inside the "playlists/myplaylist" directory for a series of directories to define a playlist, - * and return that in XML form to be used by any common player, including the Dash Media Player. - * - */ - -class Playlist -{ - private $schema; - private $playlist; - - // The base path where this script is loaded. - private $base_path = ''; - - // The base url where this script is loaded. - private $base_url = ''; - - private $mediaTypes = array('ogg', 'ogv', 'oga', 'flv', 'rtmp', 'mp4', 'm4v', 'mov', '3g2', 'mp3', 'm4a', 'aac', 'wav', 'aif', 'wma'); - private $imageTypes = array('jpg', 'gif', 'png'); - private $folderLength = 5; // The number of characters in "track"... - private $cache = TRUE; - - /** - * Constructor - * - * @param - The playlist to generate and cache. - * @param - The XML schema to use when generating and caching the playlist. - */ - - public function Playlist( $_playlist = 'default', $_schema = SCHEMA_XSPF ) - { - $this->playlist = $_playlist; - $this->schema = $_schema; - - // Set the base path and url of this class. - $base_root = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; - $base_url = $base_root .= '://'. $_SERVER['HTTP_HOST']; - if ($dir = trim(dirname($_SERVER['SCRIPT_NAME']), '\,/')) { - $base_url .= "/$dir"; - } - - $this->base_path = isset($params['base_path']) ? $params['base_path'] : trim( str_replace( realpath('.'), '', dirname(__FILE__)), '/' ); - $this->base_path = trim( str_replace('\\', '/', $this->base_path), '/' ); - $this->base_url = isset($params['base_url']) ? $params['base_url'] : $base_url . '/' . $this->base_path; - } - - /** - * If you would like to use caching or not. - * - * @param - TRUE - use caching, FALSE - do not use caching. - */ - - public function useCache( $_cache ) - { - $this->cache = $_cache; - } - - /** - * Clears the cache by simply deleting the generated XML file. - */ - - public function clearCache() - { - unlink( dirname(__FILE__) . '/' . 'cache' . '/' . $this->playlist . '.xml' ); - } - - /** - * Allows you to set the media types used by this class when searching for media files. - * - * @param - An array of extensions to look for when searching for media files. - */ - - public function setMediaTypes( $_mediaTypes ) - { - $this->mediaTypes = $_mediaTypes; - } - - /** - * Allows you to set the image types used by this class when searching for image files. - * - * @param - An array of extensions to look for when searching for image files. - */ - - public function setImageTypes( $_imageTypes ) - { - $this->imageTypes = $_imageTypes; - } - - /** - * Returns the playlist in XML form. - * - * @return - The XML format of the playlist. - */ - public function getPlaylist() - { - // Initialize some variables. - $xml = ''; - $dirname = dirname(__FILE__); - $playlist_dir = $dirname . '/' . 'playlists' . '/' . $this->playlist; - $playlist_file = $dirname . '/' . 'cache' . '/' . $this->playlist . '.xml'; - - // If there is already a cache file, then we will just want to use it. - if( $this->cache && file_exists($playlist_file) ) - { - // Open the cache file and populate the XML variable with its contents. - $handle = fopen( $playlist_file, "r"); - if( $handle ) - { - while (!feof($handle)) { - $xml .= fgets($handle, 4096); - } - - fclose( $handle ); - } - } - else if( is_dir($playlist_dir) ) - { - // Here we will want to search for all the media files and their images for the playlist. - $contents = ''; - $files = array(); - $this->get_media_files( $playlist_dir, $files ); - if( $files ) - { - $url = $this->base_url; - $numfiles = count($files); - - // Iterate through all the files. - for( $i=0; $i < $numfiles; $i++ ) - { - $file = $files[$i]; - $image = ''; - - // If there is an image association. - if( isset($file['image']) && $file['image'] ) - { - // Set the image variable to be used later. - $image = str_replace($dirname, '', $file['image']); - $image = htmlspecialchars($this->base_url . $image); - } - - // If there is a media file. - if( isset($file['media']) && $file['media'] ) - { - // Iterate through all the media files in this directory. - foreach($file['media'] as $media) - { - $media = str_replace($dirname, '', $media); - $media = htmlspecialchars($this->base_url . $media); - - // Set the contents of this single track listing with - // its associated image file. - switch( $this->schema ) - { - case SCHEMA_RSS: - $contents .= $this->rssGetTrack( $media, $image ); - break; - case SCHEMA_ASX: - $contents .= $this->asxGetTrack( $media, $image ); - break; - case SCHEMA_XSPF: - default: - $contents .= $this->playlistGetTrack( $media, $image ); - break; - } - } - } - } - } - - // Now, set up the whole XML structure given the right schema. - if( $contents ) - { - switch( $this->schema ) - { - case SCHEMA_RSS: - $xml = $this->getRSSXML( $contents ); - break; - case SCHEMA_ASX: - $xml = $this->getASXXML( $contents ); - break; - case SCHEMA_XSPF: - default: - $xml = $this->getPlaylistXML( $contents ); - break; - } - } - - // Now, let's create our cache file. - if( $this->cache ) - { - $handle = fopen( $playlist_file, "w"); - if( $handle ) - { - fwrite( $handle, $xml ); - fclose( $handle ); - } - } - } - else { - print 'Directory ' . $playlist_dir . ' not found'; - } - - // Return the XML structure. - return $xml; - } - - /** - * Gets the file extension of any given file.. - * - * @return - The file to get the extension of. - */ - private function get_file_ext($file) - { - return strtolower(substr($file, strrpos($file, '.') + 1)); - } - - /** - * Recursive directory searcher to locate any media and image files within any given path. - * - * @param - The path where to start your search. - * @param - The files array. - * @param - Used to keep track of the current folder when recursing. - */ - private function get_media_files($path, &$files, $folder = 0) - { - // Only continue if this is a directory. - if(is_dir($path)) { - - // Open the directory. - if($contents = opendir($path)) { - - // Iterate through all the files in this directory. - while(($node = readdir($contents)) !== false) { - - // Make sure this is not the parent or current directory elements. - if($node!="." && $node!="..") { - - // Cache the full node path. - $node = $path.'/'.$node; - - // If this node is a directory, then we will want to recurse. - $directory = is_dir($node); - if($directory) { - - // Get the index of this directory and recurse. - $index = (substr($node, $this->folderLength) - 1); - $this->get_media_files($node, $files, $index); - } - else if (!$directory){ - - // If this is not a directory, then we need to add it to our files list. - $extension = $this->get_file_ext($node); - if( in_array($extension, $this->mediaTypes) ) { - $files[$folder]['media'][] = $node; - } - else if( in_array($extension, $this->imageTypes) ) { - $files[$folder]['image'] = $node; - } - } - } - } - } - } - } - - /** - * Gets the mime type of a file. - * - * @return - The file to get the mime type of. - */ - private function getMimeType( $file ) - { - $extension = $this->get_file_ext($file); - switch( $extension ) - { - case 'flv': - return 'video/x-flv'; - case 'rtmp': - return ''; - case 'mp4': - return 'video/mp4'; - case 'm4v': - return 'video/mp4'; - case 'mov': - return 'video/quicktime'; - case '3g2': - return 'video/3g2'; - case 'mp3': - return 'audio/mpeg'; - case 'm4a': - return 'audio/mp4'; - case 'aac': - return 'audio/aac'; - case 'ogg': - case 'ogv': - return 'video/ogg'; - case 'oga': - return 'audio/ogg'; - case 'wav': - return 'audio/wav'; - case 'aif': - return 'audio/aif'; - case 'wma': - return 'audio/wma'; - case 'jpg': - return 'image/jpeg'; - case 'gif': - return 'image/gif'; - case 'png': - return 'image/png'; - } - } - - /** - * Returns a single track listing in an ASX XML format. - * - * @param - The file used for this track. - * @param - The image associated with this track. - */ - private function asxGetTrack( $file, $image ) - { - $output = ''; - $output .= "\n"; - $output .= '' . basename($file) . ''; - $output .= "\n"; - $output .= ''; - - if( $image ) { - $output .= ''; - } - - $output .= "\n"; - $output .= ''; - $output .= "\n"; - return $output; - } - - /** - * Returns the full playlist in ASX XML format. - * - * @param - The track contents. - */ - private function getASXXML( $content ) - { - $output = ''; - $output .= "\n"; - $output .= $content; - $output .= ''; - $output .= "\n"; - return $output; - } - - /** - * Returns a single track listing in an RSS XML format. - * - * @param - The file used for this track. - * @param - The image associated with this track. - */ - private function rssGetTrack( $file, $image ) - { - $output = ''; - $output .= "\n"; - $output .= '' . basename($file) . ''; - $output .= "\n"; - $output .= ''; - - if( $image ) { - $output .= ''; - } - - $output .= "\n"; - $output .= ''; - $output .= "\n"; - return $output; - } - - /** - * Returns the full playlist in RSS XML format. - * - * @param - The track contents. - */ - private function getRSSXML( $content ) - { - $output = ''; - $output .= "\n"; - $output .= ''; - $output .= "\n"; - $output .= $content; - $output .= ''; - $output .= "\n"; - $output .= ''; - return $output; - } - - /** - * Returns a single track listing in a playist XML format. - * - * @param - The file used for this track. - * @param - The image associated with this track. - */ - private function playlistGetTrack( $file, $image ) - { - $output = ''; - $output .= "\n"; - $output .= '' . basename($file) . ''; - $output .= "\n"; - $output .= '' . $file . ''; - - if( $image ) { - $output .= '' . $image . ''; - } - - $output .= "\n"; - $output .= ''; - $output .= "\n"; - return $output; - } - - /** - * Returns the full playlist in Playlist XML format. - * - * @param - The track contents. - */ - private function getPlaylistXML($content) - { - $output = ''; - $output .= "\n"; - $output .= ''; - $output .= "\n"; - $output .= $content; - $output .= ''; - $output .= "\n"; - return $output; - } -} -?> \ No newline at end of file diff --git a/playlist/cache/README.txt b/playlist/cache/README.txt deleted file mode 100755 index f86a2d2f..00000000 --- a/playlist/cache/README.txt +++ /dev/null @@ -1,3 +0,0 @@ -This is the cache folder to be used to store cached XML files when a playlist is generated. -When you add new songs to your playlist, you MUST delete all the contents of this folder -for your change to take affect. \ No newline at end of file diff --git a/playlist/playlists/default/track1/README.txt b/playlist/playlists/default/track1/README.txt deleted file mode 100755 index bd80f538..00000000 --- a/playlist/playlists/default/track1/README.txt +++ /dev/null @@ -1,2 +0,0 @@ -Place either a video file (MOV, MP4, or FLV) or music file (MP3, WAV) along with whatever image -you would like to associate in this this folder. \ No newline at end of file diff --git a/playlist/playlists/default/track2/README.txt b/playlist/playlists/default/track2/README.txt deleted file mode 100755 index bd80f538..00000000 --- a/playlist/playlists/default/track2/README.txt +++ /dev/null @@ -1,2 +0,0 @@ -Place either a video file (MOV, MP4, or FLV) or music file (MP3, WAV) along with whatever image -you would like to associate in this this folder. \ No newline at end of file diff --git a/playlist/playlists/default/track3/README.txt b/playlist/playlists/default/track3/README.txt deleted file mode 100755 index bd80f538..00000000 --- a/playlist/playlists/default/track3/README.txt +++ /dev/null @@ -1,2 +0,0 @@ -Place either a video file (MOV, MP4, or FLV) or music file (MP3, WAV) along with whatever image -you would like to associate in this this folder. \ No newline at end of file diff --git a/src/osmplayer.js b/src/osmplayer.js new file mode 100644 index 00000000..bae4f245 --- /dev/null +++ b/src/osmplayer.js @@ -0,0 +1,239 @@ +// Add a way to instanciate using jQuery prototype. +if (!jQuery.fn.osmplayer) { + + /** + * @constructor + * + * Define a jQuery osmplayer prototype. + * + * @param {object} options The options for this jQuery prototype. + * @return {Array} jQuery object. + */ + jQuery.fn.osmplayer = function(options) { + return jQuery(this).each(function() { + options = options || {}; + options.id = options.id || $(this).attr('id') || Math.random(); + if (!minplayer.plugins[options.id]) { + options.template = options.template || 'default'; + if (osmplayer[options.template]) { + new osmplayer[options.template](jQuery(this), options); + } + else { + new osmplayer(jQuery(this), options); + } + } + }); + }; +} + +/** + * @constructor + * @extends minplayer + * @class The main osmplayer class. + * + *

Usage: + *


+ *
+ *   // Create a media player.
+ *   var player = jQuery("#player").osmplayer({
+ *
+ *   });
+ *
+ * 
+ *

+ * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +osmplayer = function(context, options) { + + // Derive from minplayer + minplayer.call(this, context, options); +}; + +/** Derive from minplayer. */ +osmplayer.prototype = new minplayer(); + +/** Reset the constructor. */ +osmplayer.prototype.constructor = osmplayer; + +/** + * Creates a new plugin within this context. + * + * @param {string} name The name of the plugin you wish to create. + * @param {object} base The base object for this plugin. + * @param {object} context The context which you would like to create. + * @return {object} The new plugin object. + */ +osmplayer.prototype.create = function(name, base, context) { + return minplayer.prototype.create.call(this, name, 'osmplayer', context); +}; + +/** + * @see minplayer.plugin.construct + */ +osmplayer.prototype.construct = function() { + + // Make sure we provide default options... + this.options = jQuery.extend({ + playlist: '', + swfplayer: 'minplayer/flash/minplayer.swf' + }, this.options); + + // Call the minplayer display constructor. + minplayer.prototype.construct.call(this); + + /** The play queue and index. */ + this.playQueue = []; + this.playIndex = 0; + + /** The playlist for this media player. */ + this.playlist = this.create('playlist', 'osmplayer'); + + // Bind when the playlists loads a node. + this.playlist.bind('nodeLoad', (function(player) { + return function(event, data) { + + // Load this node. + player.loadNode(data); + }; + })(this)); +}; + +/** + * Gets the full screen element. + * + * @return {object} The element that will go into fullscreen. + */ +osmplayer.prototype.fullScreenElement = function() { + return this.elements.minplayer; +}; + +/** + * The load node function. + * + * @param {object} node A media node object. + */ +osmplayer.prototype.loadNode = function(node) { + if (node.mediafiles) { + + // Load the media files. + var media = node.mediafiles.media; + if (media) { + this.playQueue.length = 0; + this.playQueue = []; + this.playIndex = 0; + this.addToQueue(media.intro); + this.addToQueue(media.commercial); + this.addToQueue(media.prereel); + this.addToQueue(media.media); + this.addToQueue(media.postreel); + } + + // Load the preview image. + this.options.preview = osmplayer.getImage(node.mediafiles.image, 'preview'); + this.playLoader.loadPreview(); + + // Play the next media + this.playNext(); + } +}; + +/** + * Adds a file to the play queue. + * + * @param {object} file The file to add to the queue. + */ +osmplayer.prototype.addToQueue = function(file) { + if (file) { + this.playQueue.push(this.getFile(file)); + } +}; + +/** + * Returns a valid media file for this browser. + * + * @param {object} file The file object. + * @return {object} The best media file. + */ +osmplayer.prototype.getFile = function(file) { + if (file) { + var type = typeof file; + if (((type === 'object') || (type === 'array')) && file[0]) { + file = this.getBestMedia(file); + } + } + return file; +}; + +/** + * Returns the media file with the lowest weight value provided an array of + * media files. + * + * @param {object} files The media files to play. + * @return {object} The best media file. + */ +osmplayer.prototype.getBestMedia = function(files) { + var mFile = null; + var i = files.length; + while (i--) { + var tempFile = new minplayer.file(files[i]); + if (!mFile || (tempFile.priority > mFile.priority)) { + mFile = tempFile; + } + } + return mFile; +}; + +/** + * Plays the next media file in the queue. + */ +osmplayer.prototype.playNext = function() { + if (this.playQueue.length > this.playIndex) { + this.load(this.playQueue[this.playIndex]); + this.playIndex++; + } + else if (this.options.repeat) { + this.playIndex = 0; + this.playNext(); + } + else { + // If there is no playlist, and no repeat, we will + // just seek to the beginning and pause. + this.options.autostart = false; + this.playIndex = 0; + this.playNext(); + } +}; + +/** + * Returns an image provided image array. + * + * @param {object} images The images to search for. + * @param {string} type The type of image to look for. + * @return {object} The best image match. + */ +osmplayer.getImage = function(images, type) { + var image = ''; + + if (images) { + + // If the image type exists, then just use that one. + if (images[type]) { + image = images[type]; + } + else { + + // Or, just pick the first one available. + for (type in images) { + if (images.hasOwnProperty(type)) { + image = images[type]; + break; + } + } + } + } + + // Return the image path. + return (typeof image === 'string') ? image : image.path; +}; diff --git a/src/osmplayer.pager.js b/src/osmplayer.pager.js new file mode 100644 index 00000000..d2e01aa2 --- /dev/null +++ b/src/osmplayer.pager.js @@ -0,0 +1,47 @@ +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +/** + * @constructor + * @extends minplayer.display + * @class This class provides pager functionality. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +osmplayer.pager = function(context, options) { + + // Derive from display + minplayer.display.call(this, 'pager', context, options); +}; + +/** Derive from minplayer.display. */ +osmplayer.pager.prototype = new minplayer.display(); + +/** Reset the constructor. */ +osmplayer.pager.prototype.constructor = osmplayer.pager; + +/** + * @see minplayer.plugin#construct + */ +osmplayer.pager.prototype.construct = function() { + + // Call the minplayer plugin constructor. + minplayer.display.prototype.construct.call(this); + + // Setup the prev button. + this.prevPage = this.elements.prevPage.click((function(pager) { + return function(event) { + event.preventDefault(); + pager.trigger('prevPage'); + }; + })(this)); + + // Setup the next button. + this.nextPage = this.elements.nextPage.click((function(pager) { + return function(event) { + event.preventDefault(); + pager.trigger('nextPage'); + }; + })(this)); +}; diff --git a/src/osmplayer.parser.asx.js b/src/osmplayer.parser.asx.js new file mode 100644 index 00000000..f876553e --- /dev/null +++ b/src/osmplayer.parser.asx.js @@ -0,0 +1,44 @@ +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +/** The parser object. */ +osmplayer.parser = osmplayer.parser || {}; + +/** + * The asx parser object. + * + * @return {object} The asx parser. + **/ +osmplayer.parser.asx = { + + // The priority for this parser. + priority: 8, + + // Return if this is a valid youtube feed. + valid: function(feed) { + feed = feed.replace(/(.*)\??(.*)/i, '$1'); + return feed.match(/\.asx$/i) !== null; + }, + + // Returns the type of request to make. + getType: function(feed) { + return 'xml'; + }, + + // Returns the feed provided the start and numItems. + getFeed: function(feed, start, numItems) { + return feed; + }, + + // Parse the feed. + parse: function(data) { + var playlist = { + total_rows: 0, + nodes: [] + }; + jQuery('asx entry', data).each(function(index) { + osmplayer.parser.rss.addRSSItem(playlist, $(this)); + }); + return playlist; + } +}; diff --git a/src/osmplayer.parser.default.js b/src/osmplayer.parser.default.js new file mode 100644 index 00000000..1668951e --- /dev/null +++ b/src/osmplayer.parser.default.js @@ -0,0 +1,39 @@ +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +/** The parser object. */ +osmplayer.parser = osmplayer.parser || {}; + +/** + * The default parser object. + * + * @return {object} The default parser. + **/ +osmplayer.parser['default'] = { + + // The priority for this parser. + priority: 1, + + // This parser is always valid. + valid: function(feed) { + return true; + }, + + // Returns the type of request to make. + getType: function(feed) { + return 'json'; + }, + + // Returns the feed provided the start and numItems. + getFeed: function(feed, start, numItems) { + feed = feed.replace(/(.*)\??(.*)/i, '$1'); + feed += '?start-index=' + start; + feed += '&max-results=' + numItems; + return feed; + }, + + // Parse the feed. + parse: function(data) { + return data; + } +}; diff --git a/src/osmplayer.parser.rss.js b/src/osmplayer.parser.rss.js new file mode 100644 index 00000000..461cd705 --- /dev/null +++ b/src/osmplayer.parser.rss.js @@ -0,0 +1,65 @@ +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +/** The parser object. */ +osmplayer.parser = osmplayer.parser || {}; + +/** + * The rss parser object. + * + * @return {object} The rss parser. + **/ +osmplayer.parser.rss = { + + // The priority for this parser. + priority: 8, + + // Return if this is a valid youtube feed. + valid: function(feed) { + feed = feed.replace(/(.*)\??(.*)/i, '$1'); + return feed.match(/\.rss$/i) !== null; + }, + + // Returns the type of request to make. + getType: function(feed) { + return 'xml'; + }, + + // Returns the feed provided the start and numItems. + getFeed: function(feed, start, numItems) { + return feed; + }, + + // Parse the feed. + parse: function(data) { + var playlist = { + total_rows: 0, + nodes: [] + }; + jQuery('rss channel', data).find('item').each(function(index) { + osmplayer.parser.rss.addRSSItem(playlist, $(this)); + }); + return playlist; + }, + + // Parse an RSS item. + addRSSItem: function(playlist, item) { + playlist.total_rows++; + playlist.nodes.push({ + title: item.find('title').text(), + description: item.find('annotation').text(), + mediafiles: { + image: { + 'image': { + path: item.find('image').text() + } + }, + media: { + 'media': { + path: item.find('location').text() + } + } + } + }); + } +}; diff --git a/src/osmplayer.parser.xspf.js b/src/osmplayer.parser.xspf.js new file mode 100644 index 00000000..8fe4f5cb --- /dev/null +++ b/src/osmplayer.parser.xspf.js @@ -0,0 +1,44 @@ +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +/** The parser object. */ +osmplayer.parser = osmplayer.parser || {}; + +/** + * The xsfp parser object. + * + * @return {object} The xsfp parser. + **/ +osmplayer.parser.xsfp = { + + // The priority for this parser. + priority: 8, + + // Return if this is a valid youtube feed. + valid: function(feed) { + feed = feed.replace(/(.*)\??(.*)/i, '$1'); + return feed.match(/\.xml$/i) !== null; + }, + + // Returns the type of request to make. + getType: function(feed) { + return 'xml'; + }, + + // Returns the feed provided the start and numItems. + getFeed: function(feed, start, numItems) { + return feed; + }, + + // Parse the feed. + parse: function(data) { + var playlist = { + total_rows: 0, + nodes: [] + }; + jQuery('playlist trackList track', data).each(function(index) { + osmplayer.parser.rss.addRSSItem(playlist, $(this)); + }); + return playlist; + } +}; diff --git a/src/osmplayer.parser.youtube.js b/src/osmplayer.parser.youtube.js new file mode 100644 index 00000000..a51138d4 --- /dev/null +++ b/src/osmplayer.parser.youtube.js @@ -0,0 +1,71 @@ +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +/** The parser object. */ +osmplayer.parser = osmplayer.parser || {}; + +/** + * The youtube parser object. + * + * @return {object} The youtube parser. + **/ +osmplayer.parser.youtube = { + + // The priority for this parser. + priority: 10, + + // Return if this is a valid youtube feed. + valid: function(feed) { + return (feed.search(/^http(s)?\:\/\/gdata\.youtube\.com/i) === 0); + }, + + // Returns the type of request to make. + getType: function(feed) { + return 'jsonp'; + }, + + // Returns the feed provided the start and numItems. + getFeed: function(feed, start, numItems) { + feed = feed.replace(/(.*)\??(.*)/i, '$1'); + feed += '?start-index=' + (start + 1); + feed += '&max-results=' + (numItems); + feed += '&v=2&alt=jsonc'; + return feed; + }, + + // Parse the feed. + parse: function(data) { + data = data.data; + var playlist = { + total_rows: data.totalItems, + nodes: [] + }; + + // Iterate through the items and parse it. + for (var index in data.items) { + var item = data.items[index]; + playlist.nodes.push({ + title: item.title, + description: item.description, + mediafiles: { + image: { + 'thumbnail': { + path: item.thumbnail.sqDefault + }, + 'image': { + path: item.thumbnail.hqDefault + } + }, + media: { + 'media': { + player: 'youtube', + id: item.id + } + } + } + }); + } + + return playlist; + } +}; diff --git a/src/osmplayer.playlist.js b/src/osmplayer.playlist.js new file mode 100644 index 00000000..4c6d1231 --- /dev/null +++ b/src/osmplayer.playlist.js @@ -0,0 +1,360 @@ +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +/** + * @constructor + * @extends minplayer.display + * @class This class creates the playlist functionality for the minplayer. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +osmplayer.playlist = function(context, options) { + + // Derive from display + minplayer.display.call(this, 'playlist', context, options); +}; + +/** Derive from minplayer.display. */ +osmplayer.playlist.prototype = new minplayer.display(); + +/** Reset the constructor. */ +osmplayer.playlist.prototype.constructor = osmplayer.playlist; + +/** + * @see minplayer.plugin#construct + */ +osmplayer.playlist.prototype.construct = function() { + + // Make sure we provide default options... + this.options = jQuery.extend({ + vertical: true, + playlist: '', + pageLimit: 10, + shuffle: false + }, this.options); + + // Call the minplayer plugin constructor. + minplayer.display.prototype.construct.call(this); + + /** The nodes within this playlist. */ + this.nodes = []; + + // Current page. + this.page = -1; + + // The total amount of nodes. + this.totalItems = 0; + + // The current loaded item index. + this.currentItem = 0; + + // The play queue. + this.queue = []; + + // The queue position. + this.queuepos = 0; + + // The current playlist. + this.playlist = this.options.playlist; + + // Create the scroll bar. + this.scroll = this.create('scroll', 'osmplayer'); + + // Create the pager. + this.pager = this.create('pager', 'osmplayer'); + this.pager.bind('nextPage', (function(playlist) { + return function(event) { + playlist.nextPage(); + }; + })(this)); + this.pager.bind('prevPage', (function(playlist) { + return function(event) { + playlist.prevPage(); + }; + })(this)); + + // Get the media. + this.get('media', function(media) { + media.bind('ended', (function(playlist) { + return function(event) { + playlist.next(); + }; + })(this)); + }); + + // Load the playlist. + this.load(0, 0); +}; + +/** + * Sets the playlist. + * + * @param {object} playlist The playlist object. + * @param {integer} loadIndex The index of the item to load. + */ +osmplayer.playlist.prototype.set = function(playlist, loadIndex) { + + // Check to make sure the playlist is an object. + if (typeof playlist !== 'object') { + this.trigger('error', 'Playlist must be an object to set'); + return; + } + + // Check to make sure the playlist has correct format. + if (!playlist.hasOwnProperty('total_rows')) { + this.trigger('error', 'Unknown playlist format.'); + return; + } + + // Make sure the playlist has some rows. + if (playlist.total_rows && playlist.nodes.length) { + + // Set the total rows. + this.totalItems = playlist.total_rows; + this.currentItem = 0; + + // Show or hide the next page if there is or is not a next page. + if (((this.page + 1) * this.options.pageLimit) >= this.totalItems) { + this.pager.nextPage.hide(); + } + else { + this.pager.nextPage.show(); + } + + var teaser = null; + var numNodes = playlist.nodes.length; + this.scroll.elements.list.empty(); + this.nodes = []; + + // Iterate through all the nodes. + for (var index = 0; index < numNodes; index++) { + + // Create the teaser object. + teaser = this.create('teaser', 'osmplayer', this.scroll.elements.list); + teaser.setNode(playlist.nodes[index]); + teaser.bind('nodeLoad', (function(playlist, index) { + return function(event, data) { + playlist.loadItem(index); + }; + })(this, index)); + + // Add this to our nodes array. + this.nodes.push(teaser); + + // If the index is equal to the loadIndex. + if (loadIndex === index) { + this.loadItem(index); + } + } + + // Refresh the sizes. + this.scroll.refresh(); + + // Trigger that the playlist has loaded. + this.trigger('playlistLoad', playlist); + } +}; + +/** + * Stores the current playlist state in the queue. + */ +osmplayer.playlist.prototype.setQueue = function() { + + // Add this item to the queue. + this.queue.push({ + page: this.page, + item: this.currentItem + }); + + // Store the current queue position. + this.queuepos = this.queue.length; +}; + +/** + * Loads the next item. + */ +osmplayer.playlist.prototype.next = function() { + var item = 0, page = this.page; + + // See if we are at the front of the queue. + if (this.queuepos >= this.queue.length) { + + // If this is shuffle, then load a random item. + if (this.options.shuffle) { + item = Math.floor(Math.random() * this.totalItems); + page = Math.floor(item / this.options.pageLimit); + item = item % this.options.pageLimit; + this.load(page, item); + } + else { + + // Otherwise, increment the current item by one. + item = (this.currentItem + 1); + if (item >= this.nodes.length) { + this.load(page + 1, 0); + } + else { + this.loadItem(item); + } + } + } + else { + + // Load the next item in the queue. + this.queuepos = this.queuepos + 1; + var currentQueue = this.queue[this.queuepos]; + this.load(currentQueue.page, currentQueue.item); + } +}; + +/** + * Loads the previous item. + */ +osmplayer.playlist.prototype.prev = function() { + + // Move back into the queue. + this.queuepos = this.queuepos - 1; + this.queuepos = (this.queuepos < 0) ? 0 : this.queuepos; + var currentQueue = this.queue[this.queuepos]; + if (currentQueue) { + this.load(currentQueue.page, currentQueue.item); + } +}; + +/** + * Loads a playlist node. + * + * @param {number} index The index of the item you would like to load. + */ +osmplayer.playlist.prototype.loadItem = function(index) { + if (index < this.nodes.length) { + this.setQueue(); + + // Get the teaser at the current index and deselect it. + var teaser = this.nodes[this.currentItem]; + teaser.select(false); + this.currentItem = index; + + // Get the new teaser and select it. + teaser = this.nodes[index]; + teaser.select(true); + this.trigger('nodeLoad', teaser.node); + } +}; + +/** + * Loads the next page. + * + * @param {integer} loadIndex The index of the item to load. + */ +osmplayer.playlist.prototype.nextPage = function(loadIndex) { + this.load(this.page + 1, loadIndex); +}; + +/** + * Loads the previous page. + * + * @param {integer} loadIndex The index of the item to load. + */ +osmplayer.playlist.prototype.prevPage = function(loadIndex) { + this.load(this.page - 1, loadIndex); +}; + +/** + * Loads a playlist. + * + * @param {integer} page The page to load. + * @param {integer} loadIndex The index of the item to load. + */ +osmplayer.playlist.prototype.load = function(page, loadIndex) { + + // If the playlist and pages are the same, then no need to load. + if ((this.playlist == this.options.playlist) && (page == this.page)) { + this.loadItem(loadIndex); + } + + // Set the new playlist. + this.playlist = this.options.playlist; + + // If the playlist is an object, then go ahead and set it. + if (typeof this.playlist == 'object') { + this.set(this.playlist); + this.playlist = this.playlist.endpoint; + return; + } + + // Say that we are busy. + if (this.scroll.elements.playlist_busy) { + this.scroll.elements.playlist_busy.show(); + } + + // Normalize the page. + page = page || 0; + page = (page < 0) ? 0 : page; + + // Set the queue. + this.setQueue(); + + // Set the new page. + this.page = page; + + // Hide or show the page based on if we are on the first page. + if (this.page == 0) { + this.pager.prevPage.hide(); + } + else { + this.pager.prevPage.show(); + } + + // Get the highest priority parser. + var parser = osmplayer.parser['default']; + for (var name in osmplayer.parser) { + if (osmplayer.parser[name].valid(this.playlist)) { + if (osmplayer.parser[name].priority > parser.priority) { + parser = osmplayer.parser[name]; + } + } + } + + // The start index. + var start = this.page * this.options.pageLimit; + + // Get the feed from the parser. + var feed = parser.getFeed( + this.playlist, + start, + this.options.pageLimit + ); + + // Build our request. + var request = { + type: 'GET', + url: feed, + success: (function(playlist) { + return function(data) { + if (playlist.scroll.elements.playlist_busy) { + playlist.scroll.elements.playlist_busy.hide(); + } + playlist.set(parser.parse(data), loadIndex); + }; + })(this), + error: (function(playlist) { + return function(XMLHttpRequest, textStatus, errorThrown) { + if (playlist.scroll.elements.playlist_busy) { + playlist.scroll.elements.playlist_busy.hide(); + } + playlist.trigger('error', textStatus); + } + })(this) + }; + + // Set the data if applicable. + var dataType = ''; + if (dataType = parser.getType()) { + request.dataType = dataType; + } + + // Perform an ajax callback. + jQuery.ajax(request); +}; diff --git a/src/osmplayer.scroll.js b/src/osmplayer.scroll.js new file mode 100644 index 00000000..54ff0d58 --- /dev/null +++ b/src/osmplayer.scroll.js @@ -0,0 +1,224 @@ +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +/** + * @constructor + * @extends minplayer.display + * @class This class provides the scroll functionality for the playlists. + * + * We can calculate how the scrollbar controls the playlist using the + * following diagram / equations. + * ___ ____________ + * | | |\ + * | | list | \ + * | | |y \ + * | | | \ + * | |____________| \ _ _____ + * | | |\ | | | + * | | | \ | | | + * | | | \ | |x | + * | | | \ | | | + * | | | \|_|_ | + * | | | | | | | + * l | window | | | h w + * | | | |_|_| | + * | | | /| | | + * | | | / | | | + * | | | / v| | | + * | | | / | | | + * | |____________|/ |_|____| + * | | | / + * | | | / + * | | | / + * | | | / + * |__|____________|/ + * + * l - The list height. + * h - Handle Bar height. + * w - Window height. + * x - The distance from top of window to the top of the handle. + * y - The disatnce from the top of the list to the top of the window. + * v - The distance from bottom of window to the bottom of the handle. + * + * jQuery UI provides "v". We already know "l", "h", "w". We can then + * calculate the relationship between the scroll bar handle position to the + * list position using the following equations. + * + * x = (w - (v + h)) + * y = ((l - w)/(w - h)) * x + * + * -- or -- + * + * y = ((l - w)/(w - h)) * (w - (v + h)) + * + * We can statically calculate the ((l - w)/(w - h)) as a ratio and use + * that to speed up calculations as follows. + * + * ratio = ((l - w)/(w - h)); + * + * So, our translation equations are as follows... + * + * y = ratio * (w - (v + h)) + * v = w - (h + (y / ratio)) + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +osmplayer.scroll = function(context, options) { + + // Derive from display + minplayer.display.call(this, 'scroll', context, options); +}; + +/** Derive from minplayer.display. */ +osmplayer.scroll.prototype = new minplayer.display(); + +/** Reset the constructor. */ +osmplayer.scroll.prototype.constructor = osmplayer.scroll; + +/** + * @see minplayer.plugin#construct + */ +osmplayer.scroll.prototype.construct = function() { + + // Make sure we provide default options... + this.options = jQuery.extend({ + vertical: true, + hysteresis: 40, + scrollSpeed: 20, + scrollMode: 'auto' + }, this.options); + + // Call the minplayer plugin constructor. + minplayer.display.prototype.construct.call(this); + + this.getMousePos = function(event) { + return (event.pageY - this.display.offset().top); + }; + this.getPos = function(handlePos) { + return this.ratio * (this.scrollSize - (handlePos + this.handleSize)); + }; + this.getHandlePos = function(pos) { + return this.scrollSize - (this.handleSize + (pos / this.ratio)); + }; + + // If they have a scroll bar. + if (this.elements.scroll) { + + // Get the values of our variables. + this.scrollSize = this.elements.scroll.height(); + this.handleSize = 17; + this.scrollTop = (this.scrollSize - this.handleSize); + this.scrollMid = this.scrollSize / 2; + this.mousePos = 0; + + // Refresh the scroll. + this.refresh(); + + // Create the scroll bar slider control. + this.scroll = this.elements.scroll.slider({ + orientation: 'vertical', + max: this.scrollSize, + value: this.scrollTop, + slide: (function(scroll) { + return function(event, ui) { + + // Get the new position. + var pos = scroll.getPos(ui.value); + + // Ensure it doesn't go over the limits. + if (pos < 0) { + pos = 0; + scroll.scroll.slider('option', 'value', scroll.scrollTop); + } + + // Set our list position. + scroll.elements.list.css('marginTop', -pos + 'px'); + + // Return false to stop the scrolling. + return (pos > 0); + }; + })(this) + }); + + // If they wish to have auto scroll mode. + if (this.options.scrollMode == 'auto') { + + // Bind to the mouse events. + this.elements.list.bind('mousemove', (function(scroll) { + + // Return our event function. + return function(event) { + event.preventDefault(); + scroll.mousePos = (event.pageY - scroll.display.offset().top); + }; + + })(this)).bind('mouseenter', (function(scroll) { + + // Return our event function. + return function(event) { + event.preventDefault(); + scroll.scrolling = true; + setTimeout(function setScroll() { + if (scroll.scrolling) { + + // Get the delta. + var delta = scroll.mousePos - scroll.scrollMid; + + // Determine if we are within our hysteresis. + if (Math.abs(delta) > scroll.options.hysteresis) { + + // Get the hysteresis and delta. + var hyst = scroll.options.hysteresis; + hyst *= (delta > 0) ? -1 : 0; + delta = (scroll.options.scrollSpeed * (delta + hyst)); + delta /= scroll.scrollMid; + + // Get the scroll position. + var pos = scroll.elements.list.css('marginTop'); + pos = parseFloat(pos) - delta; + pos = (pos > 0) ? 0 : pos; + + // Get the maximum top position. + var top = -scroll.listSize + scroll.scrollSize; + pos = (pos < top) ? top : pos; + + // Set the new scroll position. + scroll.elements.list.css('marginTop', pos + 'px'); + + // Set the scroll position. + pos = scroll.getHandlePos(-pos); + scroll.scroll.slider('option', 'value', pos); + } + + // Set timeout to try again. + setTimeout(setScroll, 20); + } + }, 20); + }; + + })(this)).bind('mouseleave', (function(scroll) { + + // Return our event function. + return function(event) { + event.preventDefault(); + scroll.scrolling = false; + }; + + })(this)); + } + } +}; + +/** + * Refresh all the variables that may change. + */ +osmplayer.scroll.prototype.refresh = function() { + this.listSize = this.elements.list.height(); + this.ratio = (this.listSize - this.scrollSize); + this.ratio /= (this.scrollSize - this.handleSize); + if (this.scroll) { + this.elements.list.css('marginTop', '0px'); + this.scroll.slider('option', 'value', this.getHandlePos(0)); + } +}; diff --git a/src/osmplayer.teaser.js b/src/osmplayer.teaser.js new file mode 100644 index 00000000..c0dfa7e2 --- /dev/null +++ b/src/osmplayer.teaser.js @@ -0,0 +1,66 @@ +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +/** + * @constructor + * @extends minplayer.display + * @class This class provides teaser functionality. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +osmplayer.teaser = function(context, options) { + + /** The preview image. */ + this.preview = null; + + // Derive from display + minplayer.display.call(this, 'teaser', context, options); +}; + +/** Derive from minplayer.display. */ +osmplayer.teaser.prototype = new minplayer.display(); + +/** Reset the constructor. */ +osmplayer.teaser.prototype.constructor = osmplayer.teaser; + +/** + * Selects the teaser. + * + * @param {boolean} selected TRUE if selected, FALSE otherwise. + */ +osmplayer.teaser.prototype.select = function(selected) { +}; + +/** + * Sets the node. + * + * @param {object} node The node object to set. + */ +osmplayer.teaser.prototype.setNode = function(node) { + + // Add this to the node info for this teaser. + this.node = node; + + // Set the title of the teaser. + if (this.elements.title) { + this.elements.title.text(node.title); + } + + // Load the thumbnail image if it exists. + var image = osmplayer.getImage(node.mediafiles.image, 'thumbnail'); + if (image) { + if (this.elements.image) { + this.preview = new minplayer.image(this.elements.image); + this.preview.load(image); + } + } + + // Bind when they click on this teaser. + this.display.unbind('click').click((function(teaser) { + return function(event) { + event.preventDefault(); + teaser.trigger('nodeLoad', teaser.node); + }; + })(this)); +}; diff --git a/templates/default/createIndex.bat b/templates/default/createIndex.bat deleted file mode 100755 index 1410cf5e..00000000 --- a/templates/default/createIndex.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off -FOR /F "tokens=*" %%i in ('cd') do SET batchDir=%%i -cd %batchDir% -del test.html -C:\php\php.exe %batchDir%\index.php >> test.html - diff --git a/templates/default/createIndex.sh b/templates/default/createIndex.sh deleted file mode 100755 index f6054bda..00000000 --- a/templates/default/createIndex.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -progdir=`dirname $0` -cd "$progdir" -rm -f test.html -php index.php >> test.html \ No newline at end of file diff --git a/templates/default/css/images/loader.gif b/templates/default/css/images/loader.gif new file mode 100644 index 00000000..5e2d1673 Binary files /dev/null and b/templates/default/css/images/loader.gif differ diff --git a/templates/default/css/images/pause-icon.png b/templates/default/css/images/pause-icon.png new file mode 100644 index 00000000..17874391 Binary files /dev/null and b/templates/default/css/images/pause-icon.png differ diff --git a/templates/default/css/images/play-icon.png b/templates/default/css/images/play-icon.png new file mode 100644 index 00000000..71a34135 Binary files /dev/null and b/templates/default/css/images/play-icon.png differ diff --git a/templates/default/css/images/prev.png b/templates/default/css/images/prev.png new file mode 100644 index 00000000..7ed9d442 Binary files /dev/null and b/templates/default/css/images/prev.png differ diff --git a/templates/default/css/images/volume-full-icon.png b/templates/default/css/images/volume-full-icon.png new file mode 100644 index 00000000..b0bfa43a Binary files /dev/null and b/templates/default/css/images/volume-full-icon.png differ diff --git a/templates/default/css/images/volume-mute-icon.png b/templates/default/css/images/volume-mute-icon.png new file mode 100644 index 00000000..23979e32 Binary files /dev/null and b/templates/default/css/images/volume-mute-icon.png differ diff --git a/jquery-ui/css/dark-hive/images/ui-bg_flat_30_cccccc_40x100.png b/templates/default/css/jquery-ui/dark-hive/images/ui-bg_flat_30_cccccc_40x100.png similarity index 100% rename from jquery-ui/css/dark-hive/images/ui-bg_flat_30_cccccc_40x100.png rename to templates/default/css/jquery-ui/dark-hive/images/ui-bg_flat_30_cccccc_40x100.png diff --git a/jquery-ui/css/dark-hive/images/ui-bg_flat_50_5c5c5c_40x100.png b/templates/default/css/jquery-ui/dark-hive/images/ui-bg_flat_50_5c5c5c_40x100.png similarity index 100% rename from jquery-ui/css/dark-hive/images/ui-bg_flat_50_5c5c5c_40x100.png rename to templates/default/css/jquery-ui/dark-hive/images/ui-bg_flat_50_5c5c5c_40x100.png diff --git a/jquery-ui/css/ui-darkness/images/ui-bg_glass_40_ffc73d_1x400.png b/templates/default/css/jquery-ui/dark-hive/images/ui-bg_glass_40_ffc73d_1x400.png similarity index 100% rename from jquery-ui/css/ui-darkness/images/ui-bg_glass_40_ffc73d_1x400.png rename to templates/default/css/jquery-ui/dark-hive/images/ui-bg_glass_40_ffc73d_1x400.png diff --git a/jquery-ui/css/dark-hive/images/ui-bg_highlight-hard_20_0972a5_1x100.png b/templates/default/css/jquery-ui/dark-hive/images/ui-bg_highlight-hard_20_0972a5_1x100.png similarity index 100% rename from jquery-ui/css/dark-hive/images/ui-bg_highlight-hard_20_0972a5_1x100.png rename to templates/default/css/jquery-ui/dark-hive/images/ui-bg_highlight-hard_20_0972a5_1x100.png diff --git a/jquery-ui/css/dark-hive/images/ui-bg_highlight-soft_33_003147_1x100.png b/templates/default/css/jquery-ui/dark-hive/images/ui-bg_highlight-soft_33_003147_1x100.png similarity index 100% rename from jquery-ui/css/dark-hive/images/ui-bg_highlight-soft_33_003147_1x100.png rename to templates/default/css/jquery-ui/dark-hive/images/ui-bg_highlight-soft_33_003147_1x100.png diff --git a/jquery-ui/css/dark-hive/images/ui-bg_highlight-soft_35_222222_1x100.png b/templates/default/css/jquery-ui/dark-hive/images/ui-bg_highlight-soft_35_222222_1x100.png similarity index 100% rename from jquery-ui/css/dark-hive/images/ui-bg_highlight-soft_35_222222_1x100.png rename to templates/default/css/jquery-ui/dark-hive/images/ui-bg_highlight-soft_35_222222_1x100.png diff --git a/jquery-ui/css/dark-hive/images/ui-bg_highlight-soft_44_444444_1x100.png b/templates/default/css/jquery-ui/dark-hive/images/ui-bg_highlight-soft_44_444444_1x100.png similarity index 100% rename from jquery-ui/css/dark-hive/images/ui-bg_highlight-soft_44_444444_1x100.png rename to templates/default/css/jquery-ui/dark-hive/images/ui-bg_highlight-soft_44_444444_1x100.png diff --git a/jquery-ui/css/dark-hive/images/ui-bg_highlight-soft_80_eeeeee_1x100.png b/templates/default/css/jquery-ui/dark-hive/images/ui-bg_highlight-soft_80_eeeeee_1x100.png similarity index 100% rename from jquery-ui/css/dark-hive/images/ui-bg_highlight-soft_80_eeeeee_1x100.png rename to templates/default/css/jquery-ui/dark-hive/images/ui-bg_highlight-soft_80_eeeeee_1x100.png diff --git a/jquery-ui/css/dark-hive/images/ui-bg_loop_25_000000_21x21.png b/templates/default/css/jquery-ui/dark-hive/images/ui-bg_loop_25_000000_21x21.png similarity index 100% rename from jquery-ui/css/dark-hive/images/ui-bg_loop_25_000000_21x21.png rename to templates/default/css/jquery-ui/dark-hive/images/ui-bg_loop_25_000000_21x21.png diff --git a/jquery-ui/css/ui-darkness/images/ui-icons_222222_256x240.png b/templates/default/css/jquery-ui/dark-hive/images/ui-icons_222222_256x240.png similarity index 92% rename from jquery-ui/css/ui-darkness/images/ui-icons_222222_256x240.png rename to templates/default/css/jquery-ui/dark-hive/images/ui-icons_222222_256x240.png index ee039dc0..b273ff11 100644 Binary files a/jquery-ui/css/ui-darkness/images/ui-icons_222222_256x240.png and b/templates/default/css/jquery-ui/dark-hive/images/ui-icons_222222_256x240.png differ diff --git a/jquery-ui/css/dark-hive/images/ui-icons_4b8e0b_256x240.png b/templates/default/css/jquery-ui/dark-hive/images/ui-icons_4b8e0b_256x240.png similarity index 92% rename from jquery-ui/css/dark-hive/images/ui-icons_4b8e0b_256x240.png rename to templates/default/css/jquery-ui/dark-hive/images/ui-icons_4b8e0b_256x240.png index fdaa72a0..3bdb67be 100644 Binary files a/jquery-ui/css/dark-hive/images/ui-icons_4b8e0b_256x240.png and b/templates/default/css/jquery-ui/dark-hive/images/ui-icons_4b8e0b_256x240.png differ diff --git a/templates/default/css/jquery-ui/dark-hive/images/ui-icons_a83300_256x240.png b/templates/default/css/jquery-ui/dark-hive/images/ui-icons_a83300_256x240.png new file mode 100644 index 00000000..95993eab Binary files /dev/null and b/templates/default/css/jquery-ui/dark-hive/images/ui-icons_a83300_256x240.png differ diff --git a/jquery-ui/css/ui-darkness/images/ui-icons_cccccc_256x240.png b/templates/default/css/jquery-ui/dark-hive/images/ui-icons_cccccc_256x240.png similarity index 92% rename from jquery-ui/css/ui-darkness/images/ui-icons_cccccc_256x240.png rename to templates/default/css/jquery-ui/dark-hive/images/ui-icons_cccccc_256x240.png index 2a940237..9254e05c 100644 Binary files a/jquery-ui/css/ui-darkness/images/ui-icons_cccccc_256x240.png and b/templates/default/css/jquery-ui/dark-hive/images/ui-icons_cccccc_256x240.png differ diff --git a/jquery-ui/css/ui-darkness/images/ui-icons_ffffff_256x240.png b/templates/default/css/jquery-ui/dark-hive/images/ui-icons_ffffff_256x240.png similarity index 92% rename from jquery-ui/css/ui-darkness/images/ui-icons_ffffff_256x240.png rename to templates/default/css/jquery-ui/dark-hive/images/ui-icons_ffffff_256x240.png index bef5178a..42f8f992 100644 Binary files a/jquery-ui/css/ui-darkness/images/ui-icons_ffffff_256x240.png and b/templates/default/css/jquery-ui/dark-hive/images/ui-icons_ffffff_256x240.png differ diff --git a/jquery-ui/css/dark-hive/jquery-ui-1.8rc1.custom.css b/templates/default/css/jquery-ui/dark-hive/jquery-ui-1.8.18.custom.css similarity index 69% rename from jquery-ui/css/dark-hive/jquery-ui-1.8rc1.custom.css rename to templates/default/css/jquery-ui/dark-hive/jquery-ui-1.8.18.custom.css index 4ab48746..673ddce8 100644 --- a/jquery-ui/css/dark-hive/jquery-ui-1.8rc1.custom.css +++ b/templates/default/css/jquery-ui/dark-hive/jquery-ui-1.8.18.custom.css @@ -1,20 +1,21 @@ /* -* jQuery UI CSS Framework -* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) -* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. -*/ + * jQuery UI CSS Framework 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + */ /* Layout helpers ----------------------------------*/ .ui-helper-hidden { display: none; } -.ui-helper-hidden-accessible { position: absolute; left: -99999999px; } +.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } -.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } -.ui-helper-clearfix { display: inline-block; } -/* required comment for clearfix to work in Opera \*/ -* html .ui-helper-clearfix { height:1%; } -.ui-helper-clearfix { display:block; } -/* end clearfix */ +.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; } +.ui-helper-clearfix:after { clear: both; } +.ui-helper-clearfix { zoom: 1; } .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } @@ -38,11 +39,16 @@ /* -* jQuery UI CSS Framework -* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) -* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. -* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,%20Arial,%20sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=6px&bgColorHeader=444444&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=44&borderColorHeader=333333&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=000000&bgTextureContent=14_loop.png&bgImgOpacityContent=25&borderColorContent=555555&fcContent=ffffff&iconColorContent=cccccc&bgColorDefault=222222&bgTextureDefault=03_highlight_soft.png&bgImgOpacityDefault=35&borderColorDefault=444444&fcDefault=eeeeee&iconColorDefault=cccccc&bgColorHover=003147&bgTextureHover=03_highlight_soft.png&bgImgOpacityHover=33&borderColorHover=0b93d5&fcHover=ffffff&iconColorHover=ffffff&bgColorActive=0972a5&bgTextureActive=04_highlight_hard.png&bgImgOpacityActive=20&borderColorActive=26b3f7&fcActive=ffffff&iconColorActive=222222&bgColorHighlight=eeeeee&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=80&borderColorHighlight=cccccc&fcHighlight=2e7db2&iconColorHighlight=4b8e0b&bgColorError=ffc73d&bgTextureError=02_glass.png&bgImgOpacityError=40&borderColorError=ffb73d&fcError=111111&iconColorError=a83300&bgColorOverlay=5c5c5c&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=50&opacityOverlay=80&bgColorShadow=cccccc&bgTextureShadow=01_flat.png&bgImgOpacityShadow=30&opacityShadow=60&thicknessShadow=7px&offsetTopShadow=-7px&offsetLeftShadow=-7px&cornerRadiusShadow=8px -*/ + * jQuery UI CSS Framework 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + * + * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,%20Arial,%20sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=6px&bgColorHeader=444444&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=44&borderColorHeader=333333&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=000000&bgTextureContent=14_loop.png&bgImgOpacityContent=25&borderColorContent=555555&fcContent=ffffff&iconColorContent=cccccc&bgColorDefault=222222&bgTextureDefault=03_highlight_soft.png&bgImgOpacityDefault=35&borderColorDefault=444444&fcDefault=eeeeee&iconColorDefault=cccccc&bgColorHover=003147&bgTextureHover=03_highlight_soft.png&bgImgOpacityHover=33&borderColorHover=0b93d5&fcHover=ffffff&iconColorHover=ffffff&bgColorActive=0972a5&bgTextureActive=04_highlight_hard.png&bgImgOpacityActive=20&borderColorActive=26b3f7&fcActive=ffffff&iconColorActive=222222&bgColorHighlight=eeeeee&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=80&borderColorHighlight=cccccc&fcHighlight=2e7db2&iconColorHighlight=4b8e0b&bgColorError=ffc73d&bgTextureError=02_glass.png&bgImgOpacityError=40&borderColorError=ffb73d&fcError=111111&iconColorError=a83300&bgColorOverlay=5c5c5c&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=50&opacityOverlay=80&bgColorShadow=cccccc&bgTextureShadow=01_flat.png&bgImgOpacityShadow=30&opacityShadow=60&thicknessShadow=7px&offsetTopShadow=-7px&offsetLeftShadow=-7px&cornerRadiusShadow=8px + */ /* Component containers @@ -57,24 +63,24 @@ /* Interaction states ----------------------------------*/ -.ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #444444; background: #222222 url(images/ui-bg_highlight-soft_35_222222_1x100.png) 50% 50% repeat-x; font-weight: normal; color: #eeeeee; } +.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #444444; background: #222222 url(images/ui-bg_highlight-soft_35_222222_1x100.png) 50% 50% repeat-x; font-weight: normal; color: #eeeeee; } .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #eeeeee; text-decoration: none; } -.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #0b93d5; background: #003147 url(images/ui-bg_highlight-soft_33_003147_1x100.png) 50% 50% repeat-x; font-weight: normal; color: #ffffff; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #0b93d5; background: #003147 url(images/ui-bg_highlight-soft_33_003147_1x100.png) 50% 50% repeat-x; font-weight: normal; color: #ffffff; } .ui-state-hover a, .ui-state-hover a:hover { color: #ffffff; text-decoration: none; } -.ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #26b3f7; background: #0972a5 url(images/ui-bg_highlight-hard_20_0972a5_1x100.png) 50% 50% repeat-x; font-weight: normal; color: #ffffff; } +.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #26b3f7; background: #0972a5 url(images/ui-bg_highlight-hard_20_0972a5_1x100.png) 50% 50% repeat-x; font-weight: normal; color: #ffffff; } .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #ffffff; text-decoration: none; } .ui-widget :active { outline: none; } /* Interaction Cues ----------------------------------*/ -.ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #cccccc; background: #eeeeee url(images/ui-bg_highlight-soft_80_eeeeee_1x100.png) 50% top repeat-x; color: #2e7db2; } -.ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #2e7db2; } -.ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #ffb73d; background: #ffc73d url(images/ui-bg_glass_40_ffc73d_1x400.png) 50% 50% repeat-x; color: #111111; } -.ui-state-error a, .ui-widget-content .ui-state-error a { color: #111111; } -.ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #111111; } -.ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; } -.ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } -.ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } +.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #cccccc; background: #eeeeee url(images/ui-bg_highlight-soft_80_eeeeee_1x100.png) 50% top repeat-x; color: #2e7db2; } +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #2e7db2; } +.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #ffb73d; background: #ffc73d url(images/ui-bg_glass_40_ffc73d_1x400.png) 50% 50% repeat-x; color: #111111; } +.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #111111; } +.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #111111; } +.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } +.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } /* Icons ----------------------------------*/ @@ -271,20 +277,53 @@ ----------------------------------*/ /* Corner radius */ -.ui-corner-tl { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; } -.ui-corner-tr { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; } -.ui-corner-bl { -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; } -.ui-corner-br { -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } -.ui-corner-top { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; } -.ui-corner-bottom { -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } -.ui-corner-right { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } -.ui-corner-left { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; } -.ui-corner-all { -moz-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; } +.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; -khtml-border-top-left-radius: 6px; border-top-left-radius: 6px; } +.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; -khtml-border-top-right-radius: 6px; border-top-right-radius: 6px; } +.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; -khtml-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; } +.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; -khtml-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } /* Overlays */ .ui-widget-overlay { background: #5c5c5c url(images/ui-bg_flat_50_5c5c5c_40x100.png) 50% 50% repeat-x; opacity: .80;filter:Alpha(Opacity=80); } -.ui-widget-shadow { margin: -7px 0 0 -7px; padding: 7px; background: #cccccc url(images/ui-bg_flat_30_cccccc_40x100.png) 50% 50% repeat-x; opacity: .60;filter:Alpha(Opacity=60); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* Accordion -----------------------------------*/ +.ui-widget-shadow { margin: -7px 0 0 -7px; padding: 7px; background: #cccccc url(images/ui-bg_flat_30_cccccc_40x100.png) 50% 50% repeat-x; opacity: .60;filter:Alpha(Opacity=60); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* + * jQuery UI Resizable 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Resizable#theming + */ +.ui-resizable { position: relative;} +.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; } +.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } +.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } +.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } +.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } +.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } +.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } +.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } +.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } +.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* + * jQuery UI Selectable 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Selectable#theming + */ +.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } +/* + * jQuery UI Accordion 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Accordion#theming + */ +/* IE/Win - Fix animation bug - #4615 */ +.ui-accordion { width: 100%; } .ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } .ui-accordion .ui-accordion-li-fix { display: inline; } .ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } @@ -292,20 +331,36 @@ .ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; } .ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } -.ui-accordion .ui-accordion-content-active { display: block; }/* Autocomplete -----------------------------------*/ -.ui-autocomplete-menu { position: absolute; cursor: default; } +.ui-accordion .ui-accordion-content-active { display: block; } +/* + * jQuery UI Autocomplete 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Autocomplete#theming + */ +.ui-autocomplete { position: absolute; cursor: default; } -.ui-autocomplete-loading { background: white url('images/ui-anim.basic.16x16.gif') right center no-repeat; } -.ui-autocomplete-over { background-color: #0A246A; color: white; } +/* workarounds */ +* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ -/* Menu -----------------------------------*/ +/* + * jQuery UI Menu 1.8.18 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Menu#theming + */ .ui-menu { list-style:none; padding: 2px; margin: 0; display:block; + float: left; } .ui-menu .ui-menu { margin-top: -3px; @@ -313,6 +368,9 @@ .ui-menu .ui-menu-item { margin:0; padding: 0; + zoom: 1; + float: left; + clear: left; width: 100%; } .ui-menu .ui-menu-item a { @@ -320,49 +378,123 @@ display:block; padding:.2em .4em; line-height:1.5; + zoom:1; } .ui-menu .ui-menu-item a.ui-state-hover, .ui-menu .ui-menu-item a.ui-state-active { + font-weight: normal; margin: -1px; } -/* Button -----------------------------------*/ - -.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ +/* + * jQuery UI Button 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Button#theming + */ +.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: hidden; *overflow: visible; } /* the overflow property removes extra width in IE */ .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ -.ui-button-icons-only { width: 3em; } -button.ui-button-icons-only { width: 3.2em; } +.ui-button-icons-only { width: 3.4em; } +button.ui-button-icons-only { width: 3.7em; } /*button text element */ .ui-button .ui-button-text { display: block; line-height: 1.4; } .ui-button-text-only .ui-button-text { padding: .4em 1em; } .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } -.ui-button-text-icon .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 1.8em; } -.ui-button-text-icons .ui-button-text { padding-right: 1.8em; } +.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } +.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } +.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } /* no icon support for input elements, provide padding by default */ input.ui-button { padding: .4em 1em; } /*button icon element(s) */ -.ui-button-icon-only .ui-icon, .ui-button-text-icon .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } +.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } -.ui-button-text-icon .ui-icon-primary, .ui-button-text-icons .ui-icon-primary, .ui-button-icons-only .ui-icon-primary { left: .5em; } +.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } +.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } /*button sets*/ -.ui-button-set { margin-right: 7px; } -.ui-button-set .ui-button { margin-left: 0; margin-right: -.3em; } +.ui-buttonset { margin-right: 7px; } +.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } /* workarounds */ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ +/* + * jQuery UI Dialog 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Dialog#theming + */ +.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } +.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } +.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } +.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } +.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } +.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } +.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } +.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } +.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } +.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } +.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } +.ui-draggable .ui-dialog-titlebar { cursor: move; } +/* + * jQuery UI Slider 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Slider#theming + */ +.ui-slider { position: relative; text-align: left; } +.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } +.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } +.ui-slider-horizontal { height: .8em; } +.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } +.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } +.ui-slider-horizontal .ui-slider-range-min { left: 0; } +.ui-slider-horizontal .ui-slider-range-max { right: 0; } - - - -/* Datepicker -----------------------------------*/ -.ui-datepicker { width: 17em; padding: .2em .2em 0; } +.ui-slider-vertical { width: .8em; height: 100px; } +.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } +.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } +.ui-slider-vertical .ui-slider-range-min { bottom: 0; } +.ui-slider-vertical .ui-slider-range-max { top: 0; }/* + * jQuery UI Tabs 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Tabs#theming + */ +.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ +.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } +.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } +.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } +.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ +.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } +.ui-tabs .ui-tabs-hide { display: none !important; } +/* + * jQuery UI Datepicker 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Datepicker#theming + */ +.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; } .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } @@ -394,7 +526,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } -.ui-datepicker-row-break { clear:both; width:100%; } +.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; } /* RTL support */ .ui-datepicker-rtl { direction: rtl; } @@ -420,58 +552,14 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad left: -4px; /*must have*/ width: 200px; /*must have*/ height: 200px; /*must have*/ -}/* Dialog -----------------------------------*/ -.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } -.ui-dialog .ui-dialog-titlebar { padding: .5em 1em .3em; position: relative; } -.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .2em 0; } -.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } -.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } -.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } -.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } -.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } -.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; } -.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } -.ui-draggable .ui-dialog-titlebar { cursor: move; } -/* Progressbar -----------------------------------*/ -.ui-progressbar { height:2em; text-align: left; } -.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }/* Resizable -----------------------------------*/ -.ui-resizable { position: relative;} -.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;} -.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } -.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } -.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } -.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } -.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } -.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } -.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } -.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } -.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Slider -----------------------------------*/ -.ui-slider { position: relative; text-align: left; } -.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } -.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } - -.ui-slider-horizontal { height: .8em; } -.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } -.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } -.ui-slider-horizontal .ui-slider-range-min { left: 0; } -.ui-slider-horizontal .ui-slider-range-max { right: 0; } - -.ui-slider-vertical { width: .8em; height: 100px; } -.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } -.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } -.ui-slider-vertical .ui-slider-range-min { bottom: 0; } -.ui-slider-vertical .ui-slider-range-max { top: 0; }/* Tabs -----------------------------------*/ -.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ -.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } -.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } -.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } -.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } -.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } -.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ -.ui-tabs .ui-tabs-panel { display: block; border: 0; padding: 1em 1.4em; background: none; } -.ui-tabs .ui-tabs-hide { display: none !important; } +}/* + * jQuery UI Progressbar 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Progressbar#theming + */ +.ui-progressbar { height:2em; text-align: left; overflow: hidden; } +.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } \ No newline at end of file diff --git a/jquery-ui/css/eggplant/images/ui-bg_flat_0_aaaaaa_40x100.png b/templates/default/css/jquery-ui/eggplant/images/ui-bg_flat_0_aaaaaa_40x100.png similarity index 100% rename from jquery-ui/css/eggplant/images/ui-bg_flat_0_aaaaaa_40x100.png rename to templates/default/css/jquery-ui/eggplant/images/ui-bg_flat_0_aaaaaa_40x100.png diff --git a/jquery-ui/css/eggplant/images/ui-bg_flat_0_eeeeee_40x100.png b/templates/default/css/jquery-ui/eggplant/images/ui-bg_flat_0_eeeeee_40x100.png similarity index 100% rename from jquery-ui/css/eggplant/images/ui-bg_flat_0_eeeeee_40x100.png rename to templates/default/css/jquery-ui/eggplant/images/ui-bg_flat_0_eeeeee_40x100.png diff --git a/jquery-ui/css/eggplant/images/ui-bg_flat_55_994d53_40x100.png b/templates/default/css/jquery-ui/eggplant/images/ui-bg_flat_55_994d53_40x100.png similarity index 100% rename from jquery-ui/css/eggplant/images/ui-bg_flat_55_994d53_40x100.png rename to templates/default/css/jquery-ui/eggplant/images/ui-bg_flat_55_994d53_40x100.png diff --git a/jquery-ui/css/eggplant/images/ui-bg_flat_55_fafafa_40x100.png b/templates/default/css/jquery-ui/eggplant/images/ui-bg_flat_55_fafafa_40x100.png similarity index 100% rename from jquery-ui/css/eggplant/images/ui-bg_flat_55_fafafa_40x100.png rename to templates/default/css/jquery-ui/eggplant/images/ui-bg_flat_55_fafafa_40x100.png diff --git a/jquery-ui/css/eggplant/images/ui-bg_gloss-wave_30_3d3644_500x100.png b/templates/default/css/jquery-ui/eggplant/images/ui-bg_gloss-wave_30_3d3644_500x100.png similarity index 100% rename from jquery-ui/css/eggplant/images/ui-bg_gloss-wave_30_3d3644_500x100.png rename to templates/default/css/jquery-ui/eggplant/images/ui-bg_gloss-wave_30_3d3644_500x100.png diff --git a/jquery-ui/css/eggplant/images/ui-bg_highlight-soft_100_dcd9de_1x100.png b/templates/default/css/jquery-ui/eggplant/images/ui-bg_highlight-soft_100_dcd9de_1x100.png similarity index 100% rename from jquery-ui/css/eggplant/images/ui-bg_highlight-soft_100_dcd9de_1x100.png rename to templates/default/css/jquery-ui/eggplant/images/ui-bg_highlight-soft_100_dcd9de_1x100.png diff --git a/jquery-ui/css/eggplant/images/ui-bg_highlight-soft_100_eae6ea_1x100.png b/templates/default/css/jquery-ui/eggplant/images/ui-bg_highlight-soft_100_eae6ea_1x100.png similarity index 100% rename from jquery-ui/css/eggplant/images/ui-bg_highlight-soft_100_eae6ea_1x100.png rename to templates/default/css/jquery-ui/eggplant/images/ui-bg_highlight-soft_100_eae6ea_1x100.png diff --git a/jquery-ui/css/eggplant/images/ui-bg_highlight-soft_25_30273a_1x100.png b/templates/default/css/jquery-ui/eggplant/images/ui-bg_highlight-soft_25_30273a_1x100.png similarity index 100% rename from jquery-ui/css/eggplant/images/ui-bg_highlight-soft_25_30273a_1x100.png rename to templates/default/css/jquery-ui/eggplant/images/ui-bg_highlight-soft_25_30273a_1x100.png diff --git a/jquery-ui/css/eggplant/images/ui-bg_highlight-soft_45_5f5964_1x100.png b/templates/default/css/jquery-ui/eggplant/images/ui-bg_highlight-soft_45_5f5964_1x100.png similarity index 100% rename from jquery-ui/css/eggplant/images/ui-bg_highlight-soft_45_5f5964_1x100.png rename to templates/default/css/jquery-ui/eggplant/images/ui-bg_highlight-soft_45_5f5964_1x100.png diff --git a/jquery-ui/css/eggplant/images/ui-icons_454545_256x240.png b/templates/default/css/jquery-ui/eggplant/images/ui-icons_454545_256x240.png similarity index 100% rename from jquery-ui/css/eggplant/images/ui-icons_454545_256x240.png rename to templates/default/css/jquery-ui/eggplant/images/ui-icons_454545_256x240.png diff --git a/jquery-ui/css/eggplant/images/ui-icons_734d99_256x240.png b/templates/default/css/jquery-ui/eggplant/images/ui-icons_734d99_256x240.png similarity index 100% rename from jquery-ui/css/eggplant/images/ui-icons_734d99_256x240.png rename to templates/default/css/jquery-ui/eggplant/images/ui-icons_734d99_256x240.png diff --git a/jquery-ui/css/eggplant/images/ui-icons_8d78a5_256x240.png b/templates/default/css/jquery-ui/eggplant/images/ui-icons_8d78a5_256x240.png similarity index 100% rename from jquery-ui/css/eggplant/images/ui-icons_8d78a5_256x240.png rename to templates/default/css/jquery-ui/eggplant/images/ui-icons_8d78a5_256x240.png diff --git a/jquery-ui/css/eggplant/images/ui-icons_a8a3ae_256x240.png b/templates/default/css/jquery-ui/eggplant/images/ui-icons_a8a3ae_256x240.png similarity index 100% rename from jquery-ui/css/eggplant/images/ui-icons_a8a3ae_256x240.png rename to templates/default/css/jquery-ui/eggplant/images/ui-icons_a8a3ae_256x240.png diff --git a/jquery-ui/css/eggplant/images/ui-icons_ebccce_256x240.png b/templates/default/css/jquery-ui/eggplant/images/ui-icons_ebccce_256x240.png similarity index 100% rename from jquery-ui/css/eggplant/images/ui-icons_ebccce_256x240.png rename to templates/default/css/jquery-ui/eggplant/images/ui-icons_ebccce_256x240.png diff --git a/jquery-ui/css/dark-hive/images/ui-icons_ffffff_256x240.png b/templates/default/css/jquery-ui/eggplant/images/ui-icons_ffffff_256x240.png similarity index 100% rename from jquery-ui/css/dark-hive/images/ui-icons_ffffff_256x240.png rename to templates/default/css/jquery-ui/eggplant/images/ui-icons_ffffff_256x240.png diff --git a/jquery-ui/css/eggplant/jquery-ui-1.8rc1.custom.css b/templates/default/css/jquery-ui/eggplant/jquery-ui-1.8rc1.custom.css similarity index 100% rename from jquery-ui/css/eggplant/jquery-ui-1.8rc1.custom.css rename to templates/default/css/jquery-ui/eggplant/jquery-ui-1.8rc1.custom.css diff --git a/jquery-ui/css/mint-choc/images/ui-bg_flat_0_aaaaaa_40x100.png b/templates/default/css/jquery-ui/mint-choc/images/ui-bg_flat_0_aaaaaa_40x100.png similarity index 100% rename from jquery-ui/css/mint-choc/images/ui-bg_flat_0_aaaaaa_40x100.png rename to templates/default/css/jquery-ui/mint-choc/images/ui-bg_flat_0_aaaaaa_40x100.png diff --git a/jquery-ui/css/mint-choc/images/ui-bg_glass_15_5f391b_1x400.png b/templates/default/css/jquery-ui/mint-choc/images/ui-bg_glass_15_5f391b_1x400.png similarity index 100% rename from jquery-ui/css/mint-choc/images/ui-bg_glass_15_5f391b_1x400.png rename to templates/default/css/jquery-ui/mint-choc/images/ui-bg_glass_15_5f391b_1x400.png diff --git a/jquery-ui/css/mint-choc/images/ui-bg_gloss-wave_20_1c160d_500x100.png b/templates/default/css/jquery-ui/mint-choc/images/ui-bg_gloss-wave_20_1c160d_500x100.png similarity index 100% rename from jquery-ui/css/mint-choc/images/ui-bg_gloss-wave_20_1c160d_500x100.png rename to templates/default/css/jquery-ui/mint-choc/images/ui-bg_gloss-wave_20_1c160d_500x100.png diff --git a/jquery-ui/css/mint-choc/images/ui-bg_gloss-wave_25_453326_500x100.png b/templates/default/css/jquery-ui/mint-choc/images/ui-bg_gloss-wave_25_453326_500x100.png similarity index 100% rename from jquery-ui/css/mint-choc/images/ui-bg_gloss-wave_25_453326_500x100.png rename to templates/default/css/jquery-ui/mint-choc/images/ui-bg_gloss-wave_25_453326_500x100.png diff --git a/jquery-ui/css/mint-choc/images/ui-bg_gloss-wave_30_44372c_500x100.png b/templates/default/css/jquery-ui/mint-choc/images/ui-bg_gloss-wave_30_44372c_500x100.png similarity index 100% rename from jquery-ui/css/mint-choc/images/ui-bg_gloss-wave_30_44372c_500x100.png rename to templates/default/css/jquery-ui/mint-choc/images/ui-bg_gloss-wave_30_44372c_500x100.png diff --git a/jquery-ui/css/mint-choc/images/ui-bg_highlight-soft_20_201913_1x100.png b/templates/default/css/jquery-ui/mint-choc/images/ui-bg_highlight-soft_20_201913_1x100.png similarity index 100% rename from jquery-ui/css/mint-choc/images/ui-bg_highlight-soft_20_201913_1x100.png rename to templates/default/css/jquery-ui/mint-choc/images/ui-bg_highlight-soft_20_201913_1x100.png diff --git a/jquery-ui/css/mint-choc/images/ui-bg_highlight-soft_20_619226_1x100.png b/templates/default/css/jquery-ui/mint-choc/images/ui-bg_highlight-soft_20_619226_1x100.png similarity index 100% rename from jquery-ui/css/mint-choc/images/ui-bg_highlight-soft_20_619226_1x100.png rename to templates/default/css/jquery-ui/mint-choc/images/ui-bg_highlight-soft_20_619226_1x100.png diff --git a/jquery-ui/css/mint-choc/images/ui-bg_inset-soft_10_201913_1x100.png b/templates/default/css/jquery-ui/mint-choc/images/ui-bg_inset-soft_10_201913_1x100.png similarity index 100% rename from jquery-ui/css/mint-choc/images/ui-bg_inset-soft_10_201913_1x100.png rename to templates/default/css/jquery-ui/mint-choc/images/ui-bg_inset-soft_10_201913_1x100.png diff --git a/jquery-ui/css/dark-hive/images/ui-icons_222222_256x240.png b/templates/default/css/jquery-ui/mint-choc/images/ui-icons_222222_256x240.png similarity index 100% rename from jquery-ui/css/dark-hive/images/ui-icons_222222_256x240.png rename to templates/default/css/jquery-ui/mint-choc/images/ui-icons_222222_256x240.png diff --git a/jquery-ui/css/mint-choc/images/ui-icons_9bcc60_256x240.png b/templates/default/css/jquery-ui/mint-choc/images/ui-icons_9bcc60_256x240.png similarity index 100% rename from jquery-ui/css/mint-choc/images/ui-icons_9bcc60_256x240.png rename to templates/default/css/jquery-ui/mint-choc/images/ui-icons_9bcc60_256x240.png diff --git a/jquery-ui/css/mint-choc/images/ui-icons_add978_256x240.png b/templates/default/css/jquery-ui/mint-choc/images/ui-icons_add978_256x240.png similarity index 100% rename from jquery-ui/css/mint-choc/images/ui-icons_add978_256x240.png rename to templates/default/css/jquery-ui/mint-choc/images/ui-icons_add978_256x240.png diff --git a/jquery-ui/css/mint-choc/images/ui-icons_e3ddc9_256x240.png b/templates/default/css/jquery-ui/mint-choc/images/ui-icons_e3ddc9_256x240.png similarity index 100% rename from jquery-ui/css/mint-choc/images/ui-icons_e3ddc9_256x240.png rename to templates/default/css/jquery-ui/mint-choc/images/ui-icons_e3ddc9_256x240.png diff --git a/jquery-ui/css/mint-choc/images/ui-icons_f1fd86_256x240.png b/templates/default/css/jquery-ui/mint-choc/images/ui-icons_f1fd86_256x240.png similarity index 100% rename from jquery-ui/css/mint-choc/images/ui-icons_f1fd86_256x240.png rename to templates/default/css/jquery-ui/mint-choc/images/ui-icons_f1fd86_256x240.png diff --git a/jquery-ui/css/eggplant/images/ui-icons_ffffff_256x240.png b/templates/default/css/jquery-ui/mint-choc/images/ui-icons_ffffff_256x240.png similarity index 100% rename from jquery-ui/css/eggplant/images/ui-icons_ffffff_256x240.png rename to templates/default/css/jquery-ui/mint-choc/images/ui-icons_ffffff_256x240.png diff --git a/jquery-ui/css/mint-choc/jquery-ui-1.8rc1.custom.css b/templates/default/css/jquery-ui/mint-choc/jquery-ui-1.8rc1.custom.css similarity index 100% rename from jquery-ui/css/mint-choc/jquery-ui-1.8rc1.custom.css rename to templates/default/css/jquery-ui/mint-choc/jquery-ui-1.8rc1.custom.css diff --git a/jquery-ui/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png b/templates/default/css/jquery-ui/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png similarity index 100% rename from jquery-ui/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png rename to templates/default/css/jquery-ui/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png diff --git a/jquery-ui/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png b/templates/default/css/jquery-ui/smoothness/images/ui-bg_flat_75_ffffff_40x100.png similarity index 100% rename from jquery-ui/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png rename to templates/default/css/jquery-ui/smoothness/images/ui-bg_flat_75_ffffff_40x100.png diff --git a/jquery-ui/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png b/templates/default/css/jquery-ui/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png similarity index 100% rename from jquery-ui/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png rename to templates/default/css/jquery-ui/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png diff --git a/jquery-ui/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png b/templates/default/css/jquery-ui/smoothness/images/ui-bg_glass_65_ffffff_1x400.png similarity index 100% rename from jquery-ui/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png rename to templates/default/css/jquery-ui/smoothness/images/ui-bg_glass_65_ffffff_1x400.png diff --git a/jquery-ui/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png b/templates/default/css/jquery-ui/smoothness/images/ui-bg_glass_75_dadada_1x400.png similarity index 100% rename from jquery-ui/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png rename to templates/default/css/jquery-ui/smoothness/images/ui-bg_glass_75_dadada_1x400.png diff --git a/jquery-ui/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png b/templates/default/css/jquery-ui/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png similarity index 100% rename from jquery-ui/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png rename to templates/default/css/jquery-ui/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png diff --git a/jquery-ui/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png b/templates/default/css/jquery-ui/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png similarity index 100% rename from jquery-ui/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png rename to templates/default/css/jquery-ui/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png diff --git a/jquery-ui/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/templates/default/css/jquery-ui/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png similarity index 100% rename from jquery-ui/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png rename to templates/default/css/jquery-ui/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png diff --git a/jquery-ui/css/mint-choc/images/ui-icons_222222_256x240.png b/templates/default/css/jquery-ui/smoothness/images/ui-icons_222222_256x240.png similarity index 100% rename from jquery-ui/css/mint-choc/images/ui-icons_222222_256x240.png rename to templates/default/css/jquery-ui/smoothness/images/ui-icons_222222_256x240.png diff --git a/jquery-ui/css/smoothness/images/ui-icons_2e83ff_256x240.png b/templates/default/css/jquery-ui/smoothness/images/ui-icons_2e83ff_256x240.png similarity index 100% rename from jquery-ui/css/smoothness/images/ui-icons_2e83ff_256x240.png rename to templates/default/css/jquery-ui/smoothness/images/ui-icons_2e83ff_256x240.png diff --git a/jquery-ui/css/smoothness/images/ui-icons_454545_256x240.png b/templates/default/css/jquery-ui/smoothness/images/ui-icons_454545_256x240.png similarity index 100% rename from jquery-ui/css/smoothness/images/ui-icons_454545_256x240.png rename to templates/default/css/jquery-ui/smoothness/images/ui-icons_454545_256x240.png diff --git a/jquery-ui/css/smoothness/images/ui-icons_888888_256x240.png b/templates/default/css/jquery-ui/smoothness/images/ui-icons_888888_256x240.png similarity index 100% rename from jquery-ui/css/smoothness/images/ui-icons_888888_256x240.png rename to templates/default/css/jquery-ui/smoothness/images/ui-icons_888888_256x240.png diff --git a/jquery-ui/css/smoothness/images/ui-icons_cd0a0a_256x240.png b/templates/default/css/jquery-ui/smoothness/images/ui-icons_cd0a0a_256x240.png similarity index 100% rename from jquery-ui/css/smoothness/images/ui-icons_cd0a0a_256x240.png rename to templates/default/css/jquery-ui/smoothness/images/ui-icons_cd0a0a_256x240.png diff --git a/jquery-ui/css/smoothness/jquery-ui-1.8rc1.custom.css b/templates/default/css/jquery-ui/smoothness/jquery-ui-1.8rc1.custom.css similarity index 100% rename from jquery-ui/css/smoothness/jquery-ui-1.8rc1.custom.css rename to templates/default/css/jquery-ui/smoothness/jquery-ui-1.8rc1.custom.css diff --git a/jquery-ui/css/swanky-purse/images/ui-bg_diamond_10_4f4221_10x8.png b/templates/default/css/jquery-ui/swanky-purse/images/ui-bg_diamond_10_4f4221_10x8.png similarity index 100% rename from jquery-ui/css/swanky-purse/images/ui-bg_diamond_10_4f4221_10x8.png rename to templates/default/css/jquery-ui/swanky-purse/images/ui-bg_diamond_10_4f4221_10x8.png diff --git a/jquery-ui/css/swanky-purse/images/ui-bg_diamond_20_372806_10x8.png b/templates/default/css/jquery-ui/swanky-purse/images/ui-bg_diamond_20_372806_10x8.png similarity index 100% rename from jquery-ui/css/swanky-purse/images/ui-bg_diamond_20_372806_10x8.png rename to templates/default/css/jquery-ui/swanky-purse/images/ui-bg_diamond_20_372806_10x8.png diff --git a/jquery-ui/css/swanky-purse/images/ui-bg_diamond_25_675423_10x8.png b/templates/default/css/jquery-ui/swanky-purse/images/ui-bg_diamond_25_675423_10x8.png similarity index 100% rename from jquery-ui/css/swanky-purse/images/ui-bg_diamond_25_675423_10x8.png rename to templates/default/css/jquery-ui/swanky-purse/images/ui-bg_diamond_25_675423_10x8.png diff --git a/jquery-ui/css/swanky-purse/images/ui-bg_diamond_25_d5ac5d_10x8.png b/templates/default/css/jquery-ui/swanky-purse/images/ui-bg_diamond_25_d5ac5d_10x8.png similarity index 100% rename from jquery-ui/css/swanky-purse/images/ui-bg_diamond_25_d5ac5d_10x8.png rename to templates/default/css/jquery-ui/swanky-purse/images/ui-bg_diamond_25_d5ac5d_10x8.png diff --git a/jquery-ui/css/swanky-purse/images/ui-bg_diamond_8_261803_10x8.png b/templates/default/css/jquery-ui/swanky-purse/images/ui-bg_diamond_8_261803_10x8.png similarity index 100% rename from jquery-ui/css/swanky-purse/images/ui-bg_diamond_8_261803_10x8.png rename to templates/default/css/jquery-ui/swanky-purse/images/ui-bg_diamond_8_261803_10x8.png diff --git a/jquery-ui/css/swanky-purse/images/ui-bg_diamond_8_443113_10x8.png b/templates/default/css/jquery-ui/swanky-purse/images/ui-bg_diamond_8_443113_10x8.png similarity index 100% rename from jquery-ui/css/swanky-purse/images/ui-bg_diamond_8_443113_10x8.png rename to templates/default/css/jquery-ui/swanky-purse/images/ui-bg_diamond_8_443113_10x8.png diff --git a/jquery-ui/css/swanky-purse/images/ui-bg_flat_75_ddd4b0_40x100.png b/templates/default/css/jquery-ui/swanky-purse/images/ui-bg_flat_75_ddd4b0_40x100.png similarity index 100% rename from jquery-ui/css/swanky-purse/images/ui-bg_flat_75_ddd4b0_40x100.png rename to templates/default/css/jquery-ui/swanky-purse/images/ui-bg_flat_75_ddd4b0_40x100.png diff --git a/jquery-ui/css/swanky-purse/images/ui-bg_highlight-hard_65_fee4bd_1x100.png b/templates/default/css/jquery-ui/swanky-purse/images/ui-bg_highlight-hard_65_fee4bd_1x100.png similarity index 100% rename from jquery-ui/css/swanky-purse/images/ui-bg_highlight-hard_65_fee4bd_1x100.png rename to templates/default/css/jquery-ui/swanky-purse/images/ui-bg_highlight-hard_65_fee4bd_1x100.png diff --git a/jquery-ui/css/swanky-purse/images/ui-bg_highlight-hard_65_fee4bd_1x100.png0000664 b/templates/default/css/jquery-ui/swanky-purse/images/ui-bg_highlight-hard_65_fee4bd_1x100.png0000664 old mode 100755 new mode 100644 similarity index 100% rename from jquery-ui/css/swanky-purse/images/ui-bg_highlight-hard_65_fee4bd_1x100.png0000664 rename to templates/default/css/jquery-ui/swanky-purse/images/ui-bg_highlight-hard_65_fee4bd_1x100.png0000664 diff --git a/jquery-ui/css/swanky-purse/images/ui-icons_070603_256x240.png b/templates/default/css/jquery-ui/swanky-purse/images/ui-icons_070603_256x240.png similarity index 100% rename from jquery-ui/css/swanky-purse/images/ui-icons_070603_256x240.png rename to templates/default/css/jquery-ui/swanky-purse/images/ui-icons_070603_256x240.png diff --git a/jquery-ui/css/swanky-purse/images/ui-icons_e8e2b5_256x240.png b/templates/default/css/jquery-ui/swanky-purse/images/ui-icons_e8e2b5_256x240.png similarity index 100% rename from jquery-ui/css/swanky-purse/images/ui-icons_e8e2b5_256x240.png rename to templates/default/css/jquery-ui/swanky-purse/images/ui-icons_e8e2b5_256x240.png diff --git a/jquery-ui/css/swanky-purse/images/ui-icons_e9cd86_256x240.png b/templates/default/css/jquery-ui/swanky-purse/images/ui-icons_e9cd86_256x240.png similarity index 100% rename from jquery-ui/css/swanky-purse/images/ui-icons_e9cd86_256x240.png rename to templates/default/css/jquery-ui/swanky-purse/images/ui-icons_e9cd86_256x240.png diff --git a/jquery-ui/css/swanky-purse/images/ui-icons_efec9f_256x240.png b/templates/default/css/jquery-ui/swanky-purse/images/ui-icons_efec9f_256x240.png similarity index 100% rename from jquery-ui/css/swanky-purse/images/ui-icons_efec9f_256x240.png rename to templates/default/css/jquery-ui/swanky-purse/images/ui-icons_efec9f_256x240.png diff --git a/jquery-ui/css/swanky-purse/images/ui-icons_f2ec64_256x240.png b/templates/default/css/jquery-ui/swanky-purse/images/ui-icons_f2ec64_256x240.png similarity index 100% rename from jquery-ui/css/swanky-purse/images/ui-icons_f2ec64_256x240.png rename to templates/default/css/jquery-ui/swanky-purse/images/ui-icons_f2ec64_256x240.png diff --git a/jquery-ui/css/swanky-purse/images/ui-icons_f9f2bd_256x240.png b/templates/default/css/jquery-ui/swanky-purse/images/ui-icons_f9f2bd_256x240.png similarity index 100% rename from jquery-ui/css/swanky-purse/images/ui-icons_f9f2bd_256x240.png rename to templates/default/css/jquery-ui/swanky-purse/images/ui-icons_f9f2bd_256x240.png diff --git a/jquery-ui/css/swanky-purse/images/ui-icons_ff7519_256x240.png b/templates/default/css/jquery-ui/swanky-purse/images/ui-icons_ff7519_256x240.png similarity index 100% rename from jquery-ui/css/swanky-purse/images/ui-icons_ff7519_256x240.png rename to templates/default/css/jquery-ui/swanky-purse/images/ui-icons_ff7519_256x240.png diff --git a/jquery-ui/css/swanky-purse/jquery-ui-1.8rc1.custom.css b/templates/default/css/jquery-ui/swanky-purse/jquery-ui-1.8rc1.custom.css similarity index 100% rename from jquery-ui/css/swanky-purse/jquery-ui-1.8rc1.custom.css rename to templates/default/css/jquery-ui/swanky-purse/jquery-ui-1.8rc1.custom.css diff --git a/jquery-ui/css/ui-darkness/images/ui-bg_flat_30_cccccc_40x100.png b/templates/default/css/jquery-ui/ui-darkness/images/ui-bg_flat_30_cccccc_40x100.png similarity index 100% rename from jquery-ui/css/ui-darkness/images/ui-bg_flat_30_cccccc_40x100.png rename to templates/default/css/jquery-ui/ui-darkness/images/ui-bg_flat_30_cccccc_40x100.png diff --git a/jquery-ui/css/ui-darkness/images/ui-bg_flat_50_5c5c5c_40x100.png b/templates/default/css/jquery-ui/ui-darkness/images/ui-bg_flat_50_5c5c5c_40x100.png similarity index 100% rename from jquery-ui/css/ui-darkness/images/ui-bg_flat_50_5c5c5c_40x100.png rename to templates/default/css/jquery-ui/ui-darkness/images/ui-bg_flat_50_5c5c5c_40x100.png diff --git a/jquery-ui/css/ui-darkness/images/ui-bg_glass_20_555555_1x400.png b/templates/default/css/jquery-ui/ui-darkness/images/ui-bg_glass_20_555555_1x400.png similarity index 100% rename from jquery-ui/css/ui-darkness/images/ui-bg_glass_20_555555_1x400.png rename to templates/default/css/jquery-ui/ui-darkness/images/ui-bg_glass_20_555555_1x400.png diff --git a/jquery-ui/css/ui-darkness/images/ui-bg_glass_40_0078a3_1x400.png b/templates/default/css/jquery-ui/ui-darkness/images/ui-bg_glass_40_0078a3_1x400.png similarity index 100% rename from jquery-ui/css/ui-darkness/images/ui-bg_glass_40_0078a3_1x400.png rename to templates/default/css/jquery-ui/ui-darkness/images/ui-bg_glass_40_0078a3_1x400.png diff --git a/templates/default/css/jquery-ui/ui-darkness/images/ui-bg_glass_40_ffc73d_1x400.png b/templates/default/css/jquery-ui/ui-darkness/images/ui-bg_glass_40_ffc73d_1x400.png new file mode 100644 index 00000000..35ec0d9d Binary files /dev/null and b/templates/default/css/jquery-ui/ui-darkness/images/ui-bg_glass_40_ffc73d_1x400.png differ diff --git a/jquery-ui/css/ui-darkness/images/ui-bg_gloss-wave_25_333333_500x100.png b/templates/default/css/jquery-ui/ui-darkness/images/ui-bg_gloss-wave_25_333333_500x100.png similarity index 100% rename from jquery-ui/css/ui-darkness/images/ui-bg_gloss-wave_25_333333_500x100.png rename to templates/default/css/jquery-ui/ui-darkness/images/ui-bg_gloss-wave_25_333333_500x100.png diff --git a/jquery-ui/css/ui-darkness/images/ui-bg_highlight-soft_80_eeeeee_1x100.png b/templates/default/css/jquery-ui/ui-darkness/images/ui-bg_highlight-soft_80_eeeeee_1x100.png similarity index 100% rename from jquery-ui/css/ui-darkness/images/ui-bg_highlight-soft_80_eeeeee_1x100.png rename to templates/default/css/jquery-ui/ui-darkness/images/ui-bg_highlight-soft_80_eeeeee_1x100.png diff --git a/jquery-ui/css/ui-darkness/images/ui-bg_inset-soft_25_000000_1x100.png b/templates/default/css/jquery-ui/ui-darkness/images/ui-bg_inset-soft_25_000000_1x100.png similarity index 100% rename from jquery-ui/css/ui-darkness/images/ui-bg_inset-soft_25_000000_1x100.png rename to templates/default/css/jquery-ui/ui-darkness/images/ui-bg_inset-soft_25_000000_1x100.png diff --git a/jquery-ui/css/ui-darkness/images/ui-bg_inset-soft_30_f58400_1x100.png b/templates/default/css/jquery-ui/ui-darkness/images/ui-bg_inset-soft_30_f58400_1x100.png similarity index 100% rename from jquery-ui/css/ui-darkness/images/ui-bg_inset-soft_30_f58400_1x100.png rename to templates/default/css/jquery-ui/ui-darkness/images/ui-bg_inset-soft_30_f58400_1x100.png diff --git a/jquery-ui/css/smoothness/images/ui-icons_222222_256x240.png b/templates/default/css/jquery-ui/ui-darkness/images/ui-icons_222222_256x240.png similarity index 100% rename from jquery-ui/css/smoothness/images/ui-icons_222222_256x240.png rename to templates/default/css/jquery-ui/ui-darkness/images/ui-icons_222222_256x240.png diff --git a/jquery-ui/css/ui-darkness/images/ui-icons_4b8e0b_256x240.png b/templates/default/css/jquery-ui/ui-darkness/images/ui-icons_4b8e0b_256x240.png similarity index 100% rename from jquery-ui/css/ui-darkness/images/ui-icons_4b8e0b_256x240.png rename to templates/default/css/jquery-ui/ui-darkness/images/ui-icons_4b8e0b_256x240.png diff --git a/jquery-ui/css/ui-darkness/images/ui-icons_a83300_256x240.png b/templates/default/css/jquery-ui/ui-darkness/images/ui-icons_a83300_256x240.png similarity index 100% rename from jquery-ui/css/ui-darkness/images/ui-icons_a83300_256x240.png rename to templates/default/css/jquery-ui/ui-darkness/images/ui-icons_a83300_256x240.png diff --git a/jquery-ui/css/dark-hive/images/ui-icons_cccccc_256x240.png b/templates/default/css/jquery-ui/ui-darkness/images/ui-icons_cccccc_256x240.png similarity index 100% rename from jquery-ui/css/dark-hive/images/ui-icons_cccccc_256x240.png rename to templates/default/css/jquery-ui/ui-darkness/images/ui-icons_cccccc_256x240.png diff --git a/jquery-ui/css/mint-choc/images/ui-icons_ffffff_256x240.png b/templates/default/css/jquery-ui/ui-darkness/images/ui-icons_ffffff_256x240.png similarity index 100% rename from jquery-ui/css/mint-choc/images/ui-icons_ffffff_256x240.png rename to templates/default/css/jquery-ui/ui-darkness/images/ui-icons_ffffff_256x240.png diff --git a/jquery-ui/css/ui-darkness/jquery-ui-1.8rc1.custom.css b/templates/default/css/jquery-ui/ui-darkness/jquery-ui-1.8rc1.custom.css similarity index 100% rename from jquery-ui/css/ui-darkness/jquery-ui-1.8rc1.custom.css rename to templates/default/css/jquery-ui/ui-darkness/jquery-ui-1.8rc1.custom.css diff --git a/templates/default/css/osmplayer_default.css b/templates/default/css/osmplayer_default.css new file mode 100644 index 00000000..b7c08d9e --- /dev/null +++ b/templates/default/css/osmplayer_default.css @@ -0,0 +1,621 @@ + +/* base styles */ +.media-player {} +.media-player-play, .media-player-volume-button { + cursor: pointer; +} +.media-player-timer { + cursor: default; +} + +.media-player { + position: relative; + background:#000; + border:1px solid #333; + font-family:"Trebuchet MS", Helvetica, sans-serif; + -moz-box-shadow:0px 5px 10px #333;/*no-important moz*/ + -webkit-box-shadow:0px 5px 10px #333;/*no-important chrome*/ +} + +.media-player .media-player-error { + display:none; + position: absolute; + top: 80%; + left: 50%; + width: 320px; + height: 40px; + line-height: 40px; + margin: -20px 0 0 -160px; + text-align: center; + vertical-align: center; + border: none; + z-index:1000; + color: #fff; + opacity: 0.9; + border-radius: 10px; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + background: rgba(23, 35, 34, 0.9); + box-shadow: 2px 2px 4px #000; + -webkit-box-shadow: 2px 2px 4px #000; + -moz-box-shadow: 2px 2px 4px #000; +} + +.media-player .media-player-display { + background-color:#000; + width:100%; + height:100%; +} + +.media-player .media-player-display video { + width: 100%; + height: 100%; +} + +.media-player .media-player-preview { + width:100%; + height:100%; + position:absolute; + z-index:1; +} + +.media-player .media-player-preview.has-preview { + background-color: rgb(0, 0, 0); +} + +.media-player .media-player-play-loader, .osmplayer-playlist .osmplayer-playlist-loader-wrapper { + width:100%; + height:100%; + position:absolute; + z-index:2; + background: rgb(0, 0, 0); + background: rgba(0, 0, 0, 0.3); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#55000000, endColorstr=#55000000); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#55000000, endColorstr=#55000000)"; +} + +.media-player .media-player-loader, .osmplayer-playlist .osmplayer-playlist-loader { + width:42px; + height:10px; + position: absolute; + z-index: 4; + top: 50%; + left: 50%; + margin: -5px 0 0 -21px; + text-align:center; + vertical-align:center; + background: url(images/loader.gif) no-repeat; +} + +/* Big play button */ +.media-player .media-player-play-loader .media-player-big-play { + position: absolute; + top: 50%; + left: 50%; + width: 80px; + height: 80px; + margin: -40px 0 0 -40px; + text-align: center; + vertical-align: center; + cursor: pointer !important; + border: none; + opacity: 0.9; + z-index:3; + border-radius: 10px; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + background: rgba(23, 35, 34, 0.746094); + box-shadow: 2px 2px 4px #000; + -webkit-box-shadow: 2px 2px 4px #000; + -moz-box-shadow: 2px 2px 4px #000; +} + +.media-player .media-player-play-loader .media-player-big-play span { + margin: 22px 0 0 48px; + border-left: 36px solid white; + border-top: 18px solid transparent; + border-bottom: 18px solid transparent; +} + +.media-player .media-player-play-loader .media-player-big-play span { + display: block; + font-size: 0; + line-height: 0; + width: 0; + height: 0; + margin: 20px 0 0 23px; + border-left: 40px solid white; + border-top: 20px solid transparent; + border-bottom: 20px solid transparent; +} + +.media-player.fullscreen, .media-player.fullscreen .media-player-display, .media-player.fullscreen .media-player-play-loader { + position: fixed; + left: 0; + top: 0; + right: 0; + bottom: 0; + overflow: hidden; + z-index:1000; + width: 100% !important; + height: 100% !important; +} + +.media-player.fullscreen .media-player-play-loader { + z-index:1001; +} + +.media-player .media-player-controls { + position: absolute; + display: block; + z-index:3; + bottom:0px; + left:0px; + right:0px; + height:30px; + background-color:rgba(0,0,0,0.5); +} + +.media-player-controls-left { + float:left; + width:30px; + height:26px; + margin: 2px 0; + border-right:1px solid #eee; +} + +.media-player.fullscreen .media-player-controls-left { + width:40px; + border:none; +} + +.media-player-controls-right { + float:right; + width:120px; + height:30px; +} + +.media-player.fullscreen .media-player-controls-right { + width:110px; +} + +.media-player-controls-mid { + position:absolute; + left:45px; + right:130px; + height:30px; +} + +.media-player.fullscreen .media-player-controls-mid { + left:50px; +} + +.media-player .media-player-play, .media-player .media-player-volume, .media-player .media-player-timer { + float: left; +} + +/* play, pause */ +.media-player .media-player-play, .media-player .media-player-pause, .osmplayer-playlist-pager-prevpage, .osmplayer-playlist-pager-nextpage { + display: block; + width: 22px; + height: 22px; + margin:2px 0 0 4px; + opacity: 0.7; + -moz-transition: all 0.2s ease-in-out; /* Firefox */ + -webkit-transition: all 0.2s ease-in-out; /* Safari and Chrome */ + -o-transition: all 0.2s ease-in-out; /* Opera */ + transition: all 0.2s ease-in-out; +} + +.media-player .media-player-play:hover, .media-player .media-player-pause:hover, .osmplayer-playlist-pager-prevpage:hover, .osmplayer-playlist-pager-nextpage:hover { + opacity: 1; +} + +.media-player .media-player-play { + background: url(images/play-icon.png) no-repeat; +} + +.media-player .media-player-pause { + background: url(images/pause-icon.png) no-repeat; + display:none; +} + +/* seek */ +.media-player .media-player-seek { + position:relative; + height: 10px; + margin-top:9px; + border: 1px solid #494949; + -moz-border-radius:4px; + -webkit-border-radius:4px; + border-radius:4px; + background: #535353; + background-image: -moz-linear-gradient(top, #535353, #333333); + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #535353),color-stop(1, #333333)); + box-shadow: inset 0 -3px 3px #333333; +} + +.media-player .media-player-seek .ui-slider-handle { + width: 15px; + height: 15px; + border: 1px solid #333; + top: -4px; + z-index:20px; + -moz-border-radius:10px; + -webkit-border-radius:10px; + border-radius:10px; + background: #e6e6e6; + background-image: -moz-linear-gradient(top, #e6e6e6, #d5d5d5); + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #e6e6e6),color-stop(1, #d5d5d5)); + box-shadow: inset 0 -3px 3px #d5d5d5; +} + +.media-player .media-player-seek .ui-slider-handle.ui-state-hover { + background: #fff; +} + +.media-player .media-player-seek .ui-slider-range { + -moz-border-radius:15px; + -webkit-border-radius:15px; + z-index:10px; + border-radius:15px; + background: #4cbae8; + background-image: -moz-linear-gradient(top, #4cbae8, #39a2ce); + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #4cbae8),color-stop(1, #39a2ce)); + box-shadow: inset 0 -3px 3px #39a2ce; +} + +.media-player .media-player-progress { + -moz-border-radius:15px; + -webkit-border-radius:15px; + z-index:8px; + width:0px; + height:10px; + border-radius:15px; + background: #266580; + background-image: -moz-linear-gradient(top, #266580, #153A4A); + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #266580),color-stop(1, #153A4A)); + box-shadow: inset 0 -3px 3px #153A4A; +} + +/* timer */ +.media-player .media-player-timer { + position:relative; + height: 22px; + float:left; + color: #999; + padding-top:6px; + padding-right:6px; + font-size: 16px; + font-weight: bold; + border-right:1px solid #eee; +} + +.media-player.fullscreen .media-player-timer { + border:none; + margin-top:4px; +} + +/* volume */ +.media-player .media-player-volume { + position: absolute; + right:33px; + bottom:4px; + float:right; + overflow: hidden; + width: 20px; + height: 30px; + color: #fff; + padding: 0px 10px; + -moz-transition: all 0.1s ease-in-out; /* Firefox */ + -webkit-transition: all 0.1s ease-in-out; /* Safari and Chrome */ + -o-transition: all 0.2s ease-in-out; /* Opera */ + transition: all 0.1s ease-in-out; +} + +.media-player.fullscreen .media-player-volume { + right:40px; + bottom:13px; +} + +.media-player .media-player-volume:hover { + height: 135px; + padding-top: 5px; +} + + +.media-player .media-player-volume:hover .media-player-volume-slider { + position: relative; + visibility: visible; + opacity: 1; +} + +.media-player .media-player-volume-slider { + position: relative; + height: 100px; + width: 7px; + left: 4px; + visiblity: hidden; + opacity: 0; + border: 1px solid #444; + -moz-border-radius:15px; + -webkit-border-radius:15px; + border-radius:15px; + background: #535353; + background-image: -moz-linear-gradient(top, #535353, #333333); + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #535353),color-stop(1, #333333)); + box-shadow: inset 0 3px 3px #333333; + -moz-transition: all 0.1s ease-in-out; /* Firefox */ + -webkit-transition: all 0.1s ease-in-out; /* Safari and Chrome */ + -o-transition: all 0.1s ease-in-out; /* Opera */ + transition: all 0.1s ease-in-out; +} + +.media-player .media-player-volume-slider .ui-slider-handle { + width: 12px; + height: 12px; + left: -4px; + margin-bottom:-0.6em; + margin-left:0; + border: 1px solid #333; + -moz-border-radius:10px; + -webkit-border-radius:10px; + border-radius:10px; + background: #e6e6e6; + background-image: -moz-linear-gradient(top, #e6e6e6, #d5d5d5); + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #e6e6e6),color-stop(1, #d5d5d5)); + + box-shadow: inset 0 3px 3px #d5d5d5; +} + +.media-player .media-player-volume-slider .ui-slider-handle.ui-state-hover { + background: #fff; +} + +.media-player .media-player-volume-slider .ui-slider-range { + -moz-border-radius:15px; + -webkit-border-radius:15px; + border-radius:15px; + background: #e6e6e6; + background-image: -moz-linear-gradient(top, #e6e6e6, #d5d5d5); + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #e6e6e6),color-stop(1, #d5d5d5)); + box-shadow: inset 0 3px 3px #d5d5d5; +} + +/* volume button */ + +.media-player .media-player-volume-button { + position: absolute; + bottom: 0px; + display: block; + width: 22px; + height: 22px; + background: url(images/volume-full-icon.png) no-repeat; + text-indent: -9999px; + opacity: 0.8; +} + +.media-player .media-player-volume-button:hover { + opacity: 1; +} + +.media-player .media-player-volume-mute { + background: url(images/volume-mute-icon.png) no-repeat; +} + +/* Fullscreen button */ +.media-player .media-player-fullscreen { + position: absolute; + right:6px; + bottom:7px; + width: 22px; + height: 14px; + border:1px solid #aaa; +} + +.media-player.fullscreen .media-player-fullscreen { + right:14px; + bottom:16px; +} + +.media-player .media-player-fullscreen-inner, .media-player.fullscreen .media-player-fullscreen:hover .media-player-fullscreen-inner { + position:absolute; + bottom:0; + width:16px; + height:8px; + background-color:#aaa; + -moz-transition: all 0.1s ease-in-out; /* Firefox */ + -webkit-transition: all 0.1s ease-in-out; /* Safari and Chrome */ + -o-transition: all 0.1s ease-in-out; /* Opera */ + transition: all 0.1s ease-in-out; +} + +.media-player .media-player-fullscreen:hover .media-player-fullscreen-inner, .media-player.fullscreen .media-player-fullscreen-inner { + width:20px; + height:12px; +} + +.media-player.fullscreen .media-player-controls { + position: absolute; + z-index:1002; + width:500px; + left: 50%; + bottom:10px; + margin: 0 0 0 -260px; + padding: 10px; + border: 1px solid #2E2E2E; + -moz-border-radius: 5px; /* FF1+ */ + -webkit-border-radius: 5px; /* Saf3+, Chrome */ + border-radius: 5px; /* Opera 10.5, IE 9 */ + background: #000000; + background-image: -moz-linear-gradient(top, #313131, #000000); /* FF3.6 */ + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #313131),color-stop(1, #000000)); /* Saf4+, Chrome */ + box-shadow: inset 0 15px 35px #535353; + -moz-transition: all 0.1s ease-in-out; /* Firefox */ + -webkit-transition: all 0.1s ease-in-out; /* Safari and Chrome */ + -o-transition: all 0.1s ease-in-out; /* Opera */ + transition: all 0.1s ease-in-out; +} + +/** OSM Player Styles **/ +.osmplayer { + position:relative; + overflow: hidden; + background:#000; + border:1px solid #333; + font-family:"Trebuchet MS", Helvetica, sans-serif; + color: #999; + -moz-box-shadow:0px 5px 10px #333;/*no-important moz*/ + -webkit-box-shadow:0px 5px 10px #333;/*no-important chrome*/ +} + +.osmplayer-playlist { + position: absolute; + width: 160px; + top: 0px; + bottom: 0px; + right: 0px; + border: 1px solid #333; +} + +.osmplayer-hide-show-playlist { + position: absolute; + z-index: 3; + top: 50%; + right: 160px; + width: 16px; + height: 40px; + margin: -20px 0 0 0; + text-align: center; + vertical-align: center; + opacity: 0.5; + background: rgba(0, 0, 0, 0.5); + background-image: -moz-linear-gradient(top, #313131, #000000); /* FF3.6 */ + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #313131),color-stop(1, #000000)); /* Saf4+, Chrome */ + border: 1px solid #2E2E2E; +} + +.osmplayer-hide-show-playlist span { + position: absolute; + top: 50%; + margin-top: -8px; +} + +.osmplayer-playlist-scroll { + position: absolute; + overflow: hidden; + top: 0px; + right: 0px; + left: 0px; + bottom: 30px; +} + +.osmplayer-playlist-scrollbar { + position: absolute; + width: 10px; + height: 100%; + top: 0px; + bottom: 0px; + right: 0px; + z-index: 20; + border: 1px solid #494949; + -moz-border-radius: 0px; + -webkit-border-radius: 0px; + border-radius: 0px; + background: #535353; + background-image: -moz-linear-gradient(top, #535353, #333333); + background-image: -webkit-gradient(linear,left,right,color-stop(0, #535353),color-stop(1, #333333)); + box-shadow: inset 0 -3px 3px #333333; +} + +.osmplayer-playlist-scrollbar .ui-slider-handle { + width: 8px; + height: 15px; + border: 1px solid #333; + right: 0; + left: 0; + margin: 0; + z-index:20px; + -moz-border-radius:2px; + -webkit-border-radius:2px; + border-radius:2px; + background: #e6e6e6; + background-image: -moz-linear-gradient(top, #e6e6e6, #d5d5d5); + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #e6e6e6),color-stop(1, #d5d5d5)); + box-shadow: inset 0 -3px 3px #d5d5d5; +} + +.osmplayer-playlist-scrollbar .ui-slider-handle.ui-state-hover { + background: #fff; +} + +.osmplayer-playlist-scrollbar .ui-slider-range { + -moz-border-radius:15px; + -webkit-border-radius:15px; + z-index:10px; + border-radius:15px; + background: #4cbae8; + background-image: -moz-linear-gradient(top, #4cbae8, #39a2ce); + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #4cbae8),color-stop(1, #39a2ce)); + box-shadow: inset 0 -3px 3px #39a2ce; +} + +.osmplayer-playlist-list { + margin: 2px 14px 2px 2px; +} + +.osmplayer-teaser { + margin:1px 0 1px 0; + cursor:pointer; + padding: 0; +} + +.osmplayer-teaser-image { + width: 100%; + height: 80px; + margin: auto; +} + +.osmplayer-teaser-info { + z-index: 20; + font-size: 12px; + margin-top: 2px; + padding: 4px; +} + +.osmplayer-playlist-pager { + position: absolute; + display: block; + z-index:3; + bottom:0px; + left:0px; + right:0px; + height:30px; +} + +.osmplayer-playlist-pager-link { + float:left; + margin:5px 2px 0 0px; +} + +.osmplayer-playlist-pager-left { + float:left; + margin-left:3px; +} + +.osmplayer-playlist-pager-right { + float:right; + margin-right:3px; +} + +.osmplayer-playlist-pager-link { + width: 20px; + height: 20px; +} + +.osmplayer-playlist-pager-prevpage { + background: url(images/prev.png) no-repeat 0 0; +} +.osmplayer-playlist-pager-nextpage { + background: url(images/play-icon.png) no-repeat 0 0; +} diff --git a/templates/default/images/busy.gif b/templates/default/images/busy.gif deleted file mode 100644 index bd6dd974..00000000 Binary files a/templates/default/images/busy.gif and /dev/null differ diff --git a/templates/default/images/mask.png b/templates/default/images/mask.png deleted file mode 100644 index 00ac71b0..00000000 Binary files a/templates/default/images/mask.png and /dev/null differ diff --git a/templates/default/images/play.png b/templates/default/images/play.png deleted file mode 100644 index 9f70d05c..00000000 Binary files a/templates/default/images/play.png and /dev/null differ diff --git a/templates/default/index.php b/templates/default/index.php deleted file mode 100755 index f754fb12..00000000 --- a/templates/default/index.php +++ /dev/null @@ -1,22 +0,0 @@ - 'playlist.xml', - 'debug' => true, - 'prefix' => '', - 'base_path' => '../..', - 'base_url' => '../..', - 'theme' => '', - 'template' => 'default' - )); -?> - - - Open Standard Media (OSM) Player: Template Development - - getHeader(); ?> - - - getPlayer(); ?> - - \ No newline at end of file diff --git a/templates/default/jquery.media.template.api.js.js b/templates/default/jquery.media.template.api.js.js deleted file mode 100755 index 476294b7..00000000 --- a/templates/default/jquery.media.template.api.js.js +++ /dev/null @@ -1,250 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -/** - * This file serves as an API documentation on the javascript template file that is used - * to govern special functionality of your template. This system uses a hook system where - * special hooks are called during certain key moments in the media players functionality - * that allows you to hook in and add your own speical functionality to your template. - * Please read all comments below on what you will need to provide in your template to - * implement special funcitonality. - * - * Step 1: First, you will need to copy this file, and rename it as - * jquery.media.template.{YOUR_TEMPLATE_NAME}.js - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - - }); - - jQuery.media.templates = jQuery.extend( {}, { - - /** - * Here you will need to change the name of {YOUR_TEMPLATE_NAME} to the name - * of your template. - */ - "{YOUR_TEMPLATE_NAME}" : function( mediaplayer, settings ) { - - // Return the template - return new (function( mediaplayer, settings ) { - - // Get the settings for this media player. - settings = jQuery.media.utils.getSettings(settings); - - // So that we can access this from any scope. - var _this = this; - - /** - * Initialize our template. - * - * @param - The settings object. - */ - this.initialize = function( settings ) {}; - - /** - * Returns our template settings overrides. - * - * @return - An associative array of our settings. We can use this to override any - * default settings for the player as well as default ids. - */ - this.getSettings = function() { return {}; }; - - /** - * Called when the user presses the menu button. - * - * @param - If the menu should be on (true) or off (false). - */ - this.onMenu = function( on ) {}; - - /** - * Called when the user presses the maximize button. - * - * @param - If the player should be maximized (true) or not (false). - * @param - Boolean if this operation should be tweened or not. - */ - this.onMaximize = function( on ) {}; - - /** - * Called when the user presses the fullscreen button. - * - * @param - If the player is in fullscreen (true) or normal mode (false). - */ - this.onFullScreen = function( on ) {}; - - /** - * Allows the template to handle media events. - * - * @param - The media event. - * event.type - The event type. - * event.data - The data passed from this event. - */ - this.onMediaUpdate = function( event ) {}; - - /** - * Allows the template to handle control bar events. - * - * @param - The control event. - * event.type - The event type. - * event.data - The data passed from this event. - */ - this.onControlUpdate = function( event ) {}; - - /** - * Called when the player resizes. - */ - this.onResize = function() {}; - - /** - * Allows the template to do something custom when the node has finished loading. - * - * @param - The node object. - */ - this.onNodeLoad = function( node ) {}; - - /** - * Allows the template to do something custom when the playlist has finished loading. - * - * @param - The playlist object - */ - this.onPlaylistLoad = function( playlist ) {}; - - /** - * Selects or Deselects a menu item. - */ - this.onMenuSelect = function( link, contents, selected ) {}; - - /** - * Called when the link is hovered over. - * - * @param - The link object passed to this function. - * - * @return - none - */ - this.onLinkOver = function( link ) {}; - - /** - * Called when the mouse moves out of the link. - * - * @param - The link object passed to this function. - * - * @return - none - */ - this.onLinkOut = function( link ) {}; - - /** - * Called when the user selects a link. - * - * @param - The link object passed to this function. - * @param - Boolean to see if the link is selected or not. - * - * @return - none - */ - this.onLinkSelect = function( link, select ) {}; - - /** - * Called when the teaser has loaded.. - * - * @param - The teaser object passed to this function. - * teaser.node - The teaser node object. - * teaser.index - The index in the playlist array. - * - * @return - none - */ - this.onTeaserLoad = function( teaser ) {}; - - /** - * Called when the teaser is hovered over. - * - * @param - The teaser object passed to this function. - * teaser.node - The teaser node object. - * teaser.index - The index in the playlist array. - * - * @return - none - */ - this.onTeaserOver = function( teaser ) {}; - - /** - * Called when the mouse moves out of the teaser. - * - * @param - The teaser object passed to this function. - * teaser.node - The teaser node object. - * teaser.index - The index in the playlist array. - * - * @return - none - */ - this.onTeaserOut = function( teaser ) {}; - - /** - * Called when a teaser has been selected. - * - * @param - The teaser object passed to this function. - * teaser.node - The teaser node object. - * teaser.index - The index in the playlist array. - * - * @param - Boolean to determine if the teaser is selected or not. - * - * @return - none - */ - this.onTeaserSelect = function( teaser, selected ) {}; - - /** - * Called when a teaser has been activated. - * - * @param - The teaser object passed to this function. - * teaser.node - The teaser node object. - * teaser.index - The index in the playlist array. - * - * @param - Boolean to determine if the teaser is active or not. - * - * @return - none - */ - this.onTeaserActivate = function( teaser, active ) {}; - - /** - * Template function used to update a vote value. - * - * @param - The voter object. - * @param - The current vote value. - * @param - If this is a hover update. - */ - this.updateVote = function( voter, voteValue, hover ) {}; - - /** - * This function is currently stubbed out. - * You can implement it and hook into the time display by - * reassigning this as follows... - * - * this.formatTime = function( time ) { - * } - */ - this.formatTime = false; - })( mediaplayer, settings ); - } - }, jQuery.media.templates ); -})(jQuery); \ No newline at end of file diff --git a/templates/default/jquery.media.template.default.compressed.js b/templates/default/jquery.media.template.default.compressed.js deleted file mode 100644 index e1c38b2d..00000000 --- a/templates/default/jquery.media.template.default.compressed.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function(a){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{prefix:"",controllerOnly:false,playlistOnly:false});jQuery.media.templates=jQuery.extend({},{"default":function(b,c){return new (function(d,e){e=jQuery.media.utils.getSettings(e);var f=this;this.player=null;this.titleLinks=null;this.nodeWidth=0;this.nodeHeight=0;this.dialogWidth=0;this.dialogHeight=0;this.controlHeight=0;this.showController=true;this.isFireFox=(typeof document.body.style.MozBoxShadow==="string");this.initialize=function(g){this.nodeWidth=d.display.width();this.nodeHeight=d.display.height();this.dialogWidth=d.dialog.width();this.dialogHeight=d.dialog.height();this.controlHeight=d.controller?d.controller.display.height():0;this.player=d.node?d.node.player:null;this.titleLinks=d.titleBar?d.titleBar.titleLinks:null;this.setPlaylistHeight();};this.setPlaylistHeight=function(){if(e.vertical&&d.playlist&&d.playlist.scrollRegion){var h=d.playlist.display.height();if(h){var g=d.playlist.pager?d.playlist.pager.display.height():0;d.playlist.scrollRegion.display.height(h-g);}}};this.onResize=function(){this.setPlaylistHeight();};this.onMenu=function(g){if(d.menu){if(g){d.menu.display.show("normal");}else{d.menu.display.hide("normal");}}};this.onMaximize=function(h){var g=d.display.position();g=e.vertical?g.left:g.top;var i=e.vertical?h?{width:(this.dialogWidth-g)+"px"}:{width:this.nodeWidth+"px"}:h?{height:(this.dialogHeight-g)+"px"}:{height:this.nodeHeight+"px"};d.display.animate(i,250,"linear",function(){d.onResize();});};this.setFullScreenPos=function(){var i=this.player.media.display.offset();var h=parseInt(this.player.media.display.css("marginLeft"),10);var g=parseInt(this.player.media.display.css("marginTop"),10);this.player.media.display.css({marginLeft:(a(document).scrollLeft()-i.left+h)+"px",marginTop:(a(document).scrollTop()-i.top+g)+"px",width:a(window).width(),height:a(window).height()});};this.onFullScreen=function(h){if(h){if(this.player){a(window).bind("mousemove",function(){if(!f.player.hasControls()&&f.showController){jQuery.media.utils.showThenHide(d.controller.display,"display","fast","slow");}jQuery.media.utils.showThenHide(f.titleLinks,"links","fast","slow");});if(!this.player.hasControls()&&this.showController){jQuery.media.utils.showThenHide(d.controller.display,"display","fast","slow");jQuery.media.utils.stopHideOnOver(d.controller.display,"display");}jQuery.media.utils.showThenHide(this.titleLinks,"links","fast","slow");jQuery.media.utils.stopHideOnOver(this.titleLinks,"links");}d.dialog.addClass(e.prefix+"mediafullscreen");d.dialog.find("#"+e.prefix+"mediamaxbutton").hide();d.showNativeControls(true);if(this.player&&this.player.media){if(this.isFireFox){this.setFullScreenPos();var g=0;a(window).bind("scroll",function(){clearTimeout(g);g=setTimeout(function(){f.setFullScreenPos();},100);});var i=0;a(window).bind("resize",function(){clearTimeout(i);i=setTimeout(function(){f.setFullScreenPos();},100);});}else{this.player.media.display.css({position:"fixed",overflow:"hidden"});}}}else{a(window).unbind("mousemove");jQuery.media.utils.stopHide(d.controller.display,"display");jQuery.media.utils.stopHide(this.titleLinks,"links");if(this.showController){d.controller.display.show();}if(this.titleLinks){this.titleLinks.show();}d.dialog.find("#"+e.prefix+"mediamaxbutton").show();d.dialog.removeClass(e.prefix+"mediafullscreen");d.showNativeControls(false);if(this.player&&this.player.media){if(this.isFireFox){a(window).unbind("scroll");a(window).unbind("resize");this.player.media.display.css({marginLeft:"0px",marginTop:"0px",width:"100%",height:"100%"});}else{this.player.media.display.css({position:"absolute",overflow:"inherit"});}}}d.onResize();};this.onMenuSelect=function(i,h,g){if(g){h.show("normal");i.addClass(e.prefix+"ui-tabs-selected "+e.prefix+"ui-state-active");}else{h.hide("normal");i.removeClass(e.prefix+"ui-tabs-selected "+e.prefix+"ui-state-active");}};this.onLinkOver=function(g){g.addClass(e.prefix+"ui-state-hover");};this.onLinkOut=function(g){g.removeClass(e.prefix+"ui-state-hover");};this.onLinkSelect=function(h,g){if(g){a(h.display).addClass(e.prefix+"active");}else{a(h.display).removeClass(e.prefix+"active");}};this.onTeaserOver=function(g){a(g.node.display).addClass(e.prefix+"ui-state-hover");};this.onTeaserOut=function(g){a(g.node.display).removeClass(e.prefix+"ui-state-hover");};this.onTeaserSelect=function(g,h){if(h){a(g.node.display).addClass(e.prefix+"ui-state-hover");}else{a(g.node.display).removeClass(e.prefix+"ui-state-hover");}};this.onTeaserActivate=function(g,h){if(h){a(g.node.display).addClass(e.prefix+"ui-state-active");}else{a(g.node.display).removeClass(e.prefix+"ui-state-active");}};this.onMediaUpdate=function(g){if(d.fullScreen&&g.type=="playerready"){d.showNativeControls(true);}if(d.controller&&d.node){if(g.type=="reset"){this.showController=true;d.controller.display.show();d.node.display.css("bottom",this.controlHeight+"px");}else{if(g.type=="nomedia"){this.showController=false;d.controller.display.hide();d.node.display.css("bottom","0px");}}}};this.updateVote=function(l,m,k){var h=0;var j=l.votes.length;while(j--){var g=l.votes[j];g.display.removeClass(k?(e.prefix+"ui-state-highlight"):(e.prefix+"ui-state-active"));g.display.removeClass(k?"":(e.prefix+"ui-state-active"));if(m>=g.vote){g.display.addClass(k?(e.prefix+"ui-state-highlight"):(e.prefix+"ui-state-active"));}h=g.vote;}};this.formatTime=false;})(b,c);}},jQuery.media.templates);})(jQuery); \ No newline at end of file diff --git a/templates/default/jquery.media.template.default.js b/templates/default/jquery.media.template.default.js deleted file mode 100755 index a1471c02..00000000 --- a/templates/default/jquery.media.template.default.js +++ /dev/null @@ -1,329 +0,0 @@ -/** - * Copyright (c) 2010 Alethia Inc, - * http://www.alethia-inc.com - * Developed by Travis Tidwell | travist at alethia-inc.com - * - * License: GPL version 3. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -(function($) { - jQuery.media = jQuery.media ? jQuery.media : {}; - - // Set up our defaults for this component. - jQuery.media.defaults = jQuery.extend( jQuery.media.defaults, { - prefix:"", - controllerOnly:false, - playlistOnly:false - }); - - jQuery.media.templates = jQuery.extend( {}, { - "default" : function( mediaplayer, settings ) { - // Return the template - return new (function( mediaplayer, settings ) { - - settings = jQuery.media.utils.getSettings(settings); - var _this = this; - - this.player = null; - this.titleLinks = null; - this.nodeWidth = 0; - this.nodeHeight = 0; - this.dialogWidth = 0; - this.dialogHeight = 0; - this.controlHeight = 0; - this.showController = true; - this.isFireFox = (typeof document.body.style.MozBoxShadow === 'string'); - - this.initialize = function( settings ) { - this.nodeWidth = mediaplayer.display.width(); - this.nodeHeight = mediaplayer.display.height(); - this.dialogWidth = mediaplayer.dialog.width(); - this.dialogHeight = mediaplayer.dialog.height(); - this.controlHeight = mediaplayer.controller ? mediaplayer.controller.display.height() : 0; - this.player = mediaplayer.node ? mediaplayer.node.player : null; - this.titleLinks = mediaplayer.titleBar ? mediaplayer.titleBar.titleLinks : null; - - // Set the playlist height for IE. - this.setPlaylistHeight(); - }; - - this.setPlaylistHeight = function() { - // Stupid IE hack. - if( settings.vertical && mediaplayer.playlist && mediaplayer.playlist.scrollRegion ) { - var pHeight = mediaplayer.playlist.display.height(); - if( pHeight ) { - var pagerHeight = mediaplayer.playlist.pager ? mediaplayer.playlist.pager.display.height() : 0; - mediaplayer.playlist.scrollRegion.display.height( pHeight - pagerHeight ); - } - } - }; - - this.onResize = function() { - this.setPlaylistHeight(); - }; - - this.onMenu = function( on ) { - if( mediaplayer.menu ) { - if( on ) { - mediaplayer.menu.display.show( "normal" ); - } - else { - mediaplayer.menu.display.hide( "normal" ); - } - } - }; - - this.onMaximize = function( on ) { - var position = mediaplayer.display.position(); - position = settings.vertical ? position.left : position.top; - var newCSS = settings.vertical ? - on ? {width:(this.dialogWidth - position) +"px"} : {width:this.nodeWidth+"px"} : - on ? {height:(this.dialogHeight - position) +"px"} : {height:this.nodeHeight+"px"} ; - mediaplayer.display.animate(newCSS, 250, 'linear', function() { - mediaplayer.onResize(); - }); - }; - - /** - * This is only needed for Firefox. * - */ - this.setFullScreenPos = function() { - var offset = this.player.media.display.offset(); - var marginLeft = parseInt(this.player.media.display.css("marginLeft"),10); - var marginTop = parseInt(this.player.media.display.css("marginTop"),10); - this.player.media.display.css({ - marginLeft:($(document).scrollLeft() - offset.left + marginLeft) + "px", - marginTop:($(document).scrollTop() - offset.top + marginTop) + "px", - width:$(window).width(), - height:$(window).height() - }); - }; - - this.onFullScreen = function( on ) { - if( on ) { - if( this.player ) { - // Make sure - $(window).bind("mousemove", function() { - if( !_this.player.hasControls() && _this.showController ) { - jQuery.media.utils.showThenHide( mediaplayer.controller.display, "display", "fast", "slow" ); - } - jQuery.media.utils.showThenHide( _this.titleLinks, "links", "fast", "slow" ); - }); - - if( !this.player.hasControls() && this.showController ) { - jQuery.media.utils.showThenHide( mediaplayer.controller.display, "display", "fast", "slow" ); - jQuery.media.utils.stopHideOnOver( mediaplayer.controller.display, "display" ); - } - - jQuery.media.utils.showThenHide( this.titleLinks, "links", "fast", "slow" ); - jQuery.media.utils.stopHideOnOver( this.titleLinks, "links" ); - } - - mediaplayer.dialog.addClass(settings.prefix + "mediafullscreen"); - mediaplayer.dialog.find("#" + settings.prefix + "mediamaxbutton").hide(); - mediaplayer.showNativeControls(true); - - if( this.player && this.player.media ) { - - /** - * Firefox Hack... Firefox has a nasty bug where it will reload flash if it - * overflows the containing element when it its CSS properties "position" or "overflow" - * are set ( which is needed for full screen ). Because of this, we will just use this - * hacked version of fullscreen mode. - */ - if( this.isFireFox ) { - this.setFullScreenPos(); - - // Called when the window is scrolled. - var scrollTimeout = 0; - $(window).bind('scroll', function() { - clearTimeout( scrollTimeout ); - scrollTimeout = setTimeout( function() { - _this.setFullScreenPos(); - }, 100); - }); - - // Called when the window resizes. - var resizeTimeout = 0; - $(window).bind('resize', function() { - clearTimeout( resizeTimeout ); - resizeTimeout = setTimeout( function() { - _this.setFullScreenPos(); - }, 100); - }); - } - else { - this.player.media.display.css({ - position:"fixed", - overflow:"hidden" - }); - } - } - } - else { - $(window).unbind("mousemove"); - jQuery.media.utils.stopHide( mediaplayer.controller.display, "display" ); - jQuery.media.utils.stopHide( this.titleLinks,"links" ); - if( this.showController ) { - mediaplayer.controller.display.show(); - } - if( this.titleLinks ) { - this.titleLinks.show(); - } - - mediaplayer.dialog.find("#" + settings.prefix + "mediamaxbutton").show(); - mediaplayer.dialog.removeClass(settings.prefix + "mediafullscreen"); - mediaplayer.showNativeControls(false); - - if( this.player && this.player.media ) { - if( this.isFireFox ) { - $(window).unbind('scroll'); - $(window).unbind('resize'); - this.player.media.display.css({ - marginLeft:"0px", - marginTop:"0px", - width:"100%", - height:"100%" - }); - } - else { - this.player.media.display.css({ - position:"absolute", - overflow:"inherit" - }); - } - } - } - - mediaplayer.onResize(); - }; - - this.onMenuSelect = function( link, contents, selected ) { - if( selected ) { - contents.show("normal"); - link.addClass(settings.prefix + 'ui-tabs-selected ' + settings.prefix + 'ui-state-active'); - } - else { - contents.hide("normal"); - link.removeClass(settings.prefix + 'ui-tabs-selected ' + settings.prefix + 'ui-state-active'); - } - }; - - this.onLinkOver = function( link ) { - // Add the hover class. - link.addClass(settings.prefix + "ui-state-hover"); - }; - - this.onLinkOut = function( link ) { - // Remove the hover class. - link.removeClass(settings.prefix + "ui-state-hover"); - }; - - this.onLinkSelect = function( link, select ) { - if( select ) { - $(link.display).addClass(settings.prefix + "active"); - } - else { - $(link.display).removeClass(settings.prefix + "active"); - } - }; - - this.onTeaserOver = function( teaser ) { - // Add the hover class. - $(teaser.node.display).addClass(settings.prefix + "ui-state-hover"); - }; - - this.onTeaserOut = function( teaser ) { - // Remove the hover class. - $(teaser.node.display).removeClass(settings.prefix + "ui-state-hover"); - }; - - this.onTeaserSelect = function( teaser, selected ) { - if( selected ) { - $(teaser.node.display).addClass(settings.prefix + "ui-state-hover"); - } - else { - $(teaser.node.display).removeClass(settings.prefix + "ui-state-hover"); - } - }; - - this.onTeaserActivate = function( teaser, active ) { - if( active ) { - $(teaser.node.display).addClass(settings.prefix + "ui-state-active"); - } - else { - $(teaser.node.display).removeClass(settings.prefix + "ui-state-active"); - } - }; - - this.onMediaUpdate = function( data ) { - if( mediaplayer.fullScreen && data.type == "playerready" ) { - mediaplayer.showNativeControls(true); - } - - if( mediaplayer.controller && mediaplayer.node ) { - if( data.type == "reset" ) { - this.showController = true; - mediaplayer.controller.display.show(); - mediaplayer.node.display.css("bottom", this.controlHeight + "px"); - } - else if( data.type == "nomedia" ) { - this.showController = false; - mediaplayer.controller.display.hide(); - mediaplayer.node.display.css("bottom", "0px"); - } - } - }; - - /** - * Template function used to update a vote value. - * - * @param - The voter object. - * @param - The current vote value. - * @param - If this is a hover update. - */ - this.updateVote = function( voter, voteValue, hover ) { - var lastValue = 0; - - // Iterate through our votes. - var i = voter.votes.length; - while(i--) { - var vote = voter.votes[i]; - - // Remove all states ( empty star ). - vote.display.removeClass( hover ? (settings.prefix + "ui-state-highlight") : (settings.prefix + "ui-state-active") ); - vote.display.removeClass( hover ? "" : (settings.prefix + "ui-state-active") ); - - // See if we need to add a full state... - if( voteValue >= vote.vote ) { - // Add the full state ( full star )... - vote.display.addClass( hover ? (settings.prefix + "ui-state-highlight") : (settings.prefix + "ui-state-active") ); - } - - // Store the this value for the next iteration. - lastValue = vote.vote; - } - }; - - this.formatTime = false; - })( mediaplayer, settings ); - } - }, jQuery.media.templates ); -})(jQuery); \ No newline at end of file diff --git a/templates/default/js/osmplayer.controller.default.js b/templates/default/js/osmplayer.controller.default.js new file mode 100644 index 00000000..ff2a7ae9 --- /dev/null +++ b/templates/default/js/osmplayer.controller.default.js @@ -0,0 +1,79 @@ +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +// Define the controller object. +osmplayer.controller = osmplayer.controller || {}; + +/** + * Constructor for the minplayer.controller + */ +osmplayer.controller['default'] = function(context, options) { + + // Derive from default controller + minplayer.controller.call(this, context, options); +}; + +/** Derive from controller. */ +osmplayer.controller['default'].prototype = new minplayer.controller(); +osmplayer.controller['default'].prototype.constructor = osmplayer.controller['default']; + +/** + * @see minplayer.plugin#construct + */ +osmplayer.controller['default'].prototype.construct = function() { + minplayer.controller.prototype.construct.call(this); + minplayer.showThenHide(this.display); +} + +/** + * Return the display for this plugin. + */ +osmplayer.controller['default'].prototype.getDisplay = function(context, options) { + + // See if we need to build out the controller. + if (options.build) { + + // Prepend the control template. + jQuery('.media-player', context).prepend('\ +
\ +
\ +
\ + \ + \ +
\ +
\ +
00:00
\ +
\ +
\ +
\ +
\ +
\ + \ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
'); + } + + return jQuery('.media-player-controls', context); +} + +// Return the elements +osmplayer.controller['default'].prototype.getElements = function() { + var elements = minplayer.controller.prototype.getElements.call(this); + var timer = jQuery(".media-player-timer", this.display); + return jQuery.extend(elements, { + play: jQuery(".media-player-play", this.display), + pause: jQuery(".media-player-pause", this.display), + fullscreen: jQuery(".media-player-fullscreen", this.display), + seek: jQuery(".media-player-seek", this.display), + progress: jQuery(".media-player-progress", this.display), + volume: jQuery(".media-player-volume-slider", this.display), + timer:timer, + duration:timer + }); +}; diff --git a/templates/default/js/osmplayer.default.js b/templates/default/js/osmplayer.default.js new file mode 100644 index 00000000..2e4eec14 --- /dev/null +++ b/templates/default/js/osmplayer.default.js @@ -0,0 +1,65 @@ +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +// Default player. +osmplayer['default'] = function(context, options) { + + // Derive from osmplayer. + osmplayer.call(this, context, options); +}; + +/** + * Define this template prototype. + */ +osmplayer['default'].prototype = new osmplayer(); +osmplayer['default'].prototype.constructor = osmplayer['default']; + +/** + * Return the display for this plugin. + */ +osmplayer['default'].prototype.getDisplay = function(context, options) { + + // Convert the context to jQuery object. + context = jQuery(context); + + // If the tag is video or audio, then build out the player. + var tag = context.get(0).tagName.toLowerCase(); + if (tag == 'video' || tag == 'audio') { + + // Build out the player provided the base tag. + context = context.attr({ + 'id': options.id + '-player', + 'class': 'media-player-media' + }) + .wrap(jQuery(document.createElement('div')).attr({ + 'class': 'media-player-display' + })).parent('.media-player-display') + .wrap(jQuery(document.createElement('div')).attr({ + 'class': 'media-player' + })).parent('.media-player') + .wrap(jQuery(document.createElement('div')).attr({ + 'id': options.id, + 'class': 'osmplayer' + })).parent('.osmplayer'); + + // Mark a flag that says this display needs to be built. + options.build = true; + } + + return context; +} + +// Get the elements for this player. +osmplayer['default'].prototype.getElements = function() { + var elements = osmplayer.prototype.getElements.call(this); + + // Return the jQuery elements. + return jQuery.extend(elements, { + player:this.display, + minplayer:jQuery(".media-player", this.display), + display:jQuery(".media-player-display", this.display), + media:jQuery("#" + this.options.id + "-player", this.display), + error:jQuery('.media-player-error', this.display), + playlist:jQuery('.osmplayer-playlist', this.display) + }); +}; diff --git a/templates/default/js/osmplayer.pager.default.js b/templates/default/js/osmplayer.pager.default.js new file mode 100644 index 00000000..70af897c --- /dev/null +++ b/templates/default/js/osmplayer.pager.default.js @@ -0,0 +1,47 @@ +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +// Define the busy object. +osmplayer.pager = osmplayer.pager || {}; + +// constructor. +osmplayer.pager['default'] = function(context, options) { + + // Derive from pager + osmplayer.pager.call(this, context, options); +}; + +// Define the prototype for all controllers. +osmplayer.pager['default'].prototype = new osmplayer.pager(); +osmplayer.pager['default'].prototype.constructor = osmplayer.pager['default']; + +/** + * Return the display for this plugin. + */ +osmplayer.pager['default'].prototype.getDisplay = function(context, options) { + + if (options.build) { + + // append the pager. + context.append('\ +
\ +
\ +  \ +
\ +
\ +  \ +
\ +
'); + } + + return jQuery('.osmplayer-playlist-pager', context); +} + +// Return the elements +osmplayer.pager['default'].prototype.getElements = function() { + var elements = osmplayer.pager.prototype.getElements.call(this); + return jQuery.extend(elements, { + prevPage:jQuery(".osmplayer-playlist-pager-prevpage", this.display), + nextPage:jQuery(".osmplayer-playlist-pager-nextpage", this.display) + }); +}; diff --git a/templates/default/js/osmplayer.playLoader.default.js b/templates/default/js/osmplayer.playLoader.default.js new file mode 100644 index 00000000..87dbf92d --- /dev/null +++ b/templates/default/js/osmplayer.playLoader.default.js @@ -0,0 +1,46 @@ +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +// Define the busy object. +osmplayer.playLoader = osmplayer.playLoader || {}; + +// constructor. +osmplayer.playLoader['default'] = function(context, options) { + + // Derive from playLoader + minplayer.playLoader.call(this, context, options); +}; + +// Define the prototype for all controllers. +osmplayer.playLoader['default'].prototype = new minplayer.playLoader(); +osmplayer.playLoader['default'].prototype.constructor = osmplayer.playLoader['default']; + +/** + * Return the display for this plugin. + */ +osmplayer.playLoader['default'].prototype.getDisplay = function(context, options) { + + // See if we need to build out the controller. + if (options.build) { + + // Prepend the playloader template. + jQuery('.media-player', context).prepend('\ +
\ +
\ +
 
\ +
\ +
'); + } + + return jQuery('.media-player-play-loader', context); +} + +// Return the elements +osmplayer.playLoader['default'].prototype.getElements = function() { + var elements = minplayer.playLoader.prototype.getElements.call(this); + return jQuery.extend(elements, { + busy:jQuery(".media-player-loader", this.display), + bigPlay:jQuery(".media-player-big-play", this.display), + preview:jQuery(".media-player-preview", this.display) + }); +}; diff --git a/templates/default/js/osmplayer.playlist.default.js b/templates/default/js/osmplayer.playlist.default.js new file mode 100644 index 00000000..1824862f --- /dev/null +++ b/templates/default/js/osmplayer.playlist.default.js @@ -0,0 +1,77 @@ +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +// Define the busy object. +osmplayer.playlist = osmplayer.playlist || {}; + +// constructor. +osmplayer.playlist['default'] = function(context, options) { + + // Derive from playlist + osmplayer.playlist.call(this, context, options); +}; + +// Define the prototype for all controllers. +osmplayer.playlist['default'].prototype = new osmplayer.playlist(); +osmplayer.playlist['default'].prototype.constructor = osmplayer.playlist['default']; + +/** + * @see minplayer.plugin#construct + */ +osmplayer.playlist['default'].prototype.construct = function() { + osmplayer.playlist.prototype.construct.call(this); + + // Show then hide the element. + minplayer.showThenHide(this.elements.hideShow); + + // Make the main minplayer have the same width as the playlist. + this.get('player', function(player) { + + // Perform the show hide functionality of the playlist. + this.elements.hideShow.bind('click', (function(playlist, width) { + return function(event) { + event.preventDefault(); + var button = $('span', playlist.elements.hideShow); + var visible = button.hasClass('ui-icon-triangle-1-e'); + var from = visible ? 'ui-icon-triangle-1-e' : 'ui-icon-triangle-1-w'; + var to = visible ? 'ui-icon-triangle-1-w' : 'ui-icon-triangle-1-e'; + $('span', playlist.elements.hideShow).removeClass(from).addClass(to); + player.elements.minplayer.animate({ + marginRight: visible ? 0 : width + }, 200); + playlist.display.animate({ + right: visible ? -width : 0 + }, 200, function() { + player.resize(); + }); + }; + })(this, this.display.width())); + + // Set the player to have the correct margin if the playlist is present. + player.elements.minplayer.css('marginRight', this.display.width() + 'px'); + }); +}; + +/** + * Return the display for this plugin. + */ +osmplayer.playlist['default'].prototype.getDisplay = function(context, options) { + if (options.build) { + context.append('\ +
\ +
\ + \ +
\ +
\ + '); + } + return jQuery('.osmplayer-playlist', context); +}; + +// Return the elements +osmplayer.playlist['default'].prototype.getElements = function() { + var elements = osmplayer.playlist.prototype.getElements.call(this); + return jQuery.extend(elements, { + hideShow:jQuery(".osmplayer-hide-show-playlist", this.display) + }); +}; diff --git a/templates/default/js/osmplayer.scroll.default.js b/templates/default/js/osmplayer.scroll.default.js new file mode 100644 index 00000000..e0daff61 --- /dev/null +++ b/templates/default/js/osmplayer.scroll.default.js @@ -0,0 +1,49 @@ +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +// Define the scroll object. +osmplayer.scroll = osmplayer.scroll || {}; + +/** + * Constructor for the minplayer.controller + */ +osmplayer.scroll['default'] = function(context, options) { + + // Derive from scroll + osmplayer.scroll.call(this, context, options); +}; + + +// Define the prototype for all controllers. +osmplayer.scroll['default'].prototype = new osmplayer.scroll(); +osmplayer.scroll['default'].prototype.constructor = osmplayer.scroll['default']; + +/** + * Return the display for this plugin. + */ +osmplayer.scroll['default'].prototype.getDisplay = function(context, options) { + + // See if we need to build the scroll bar. + if (options.build) { + context.append('\ +
\ +
\ +
\ +
\ +
\ +
\ +
'); + } + + return jQuery(".osmplayer-playlist-scroll", this.display); +} + +// Return the elements +osmplayer.scroll['default'].prototype.getElements = function() { + var elements = osmplayer.scroll.prototype.getElements.call(this); + return jQuery.extend(elements, { + playlist_busy:jQuery(".osmplayer-playlist-loader-wrapper", this.display), + list:jQuery(".osmplayer-playlist-list", this.display), + scroll:jQuery(".osmplayer-playlist-scrollbar", this.display) + }); +}; diff --git a/templates/default/js/osmplayer.teaser.default.js b/templates/default/js/osmplayer.teaser.default.js new file mode 100644 index 00000000..c46fc00a --- /dev/null +++ b/templates/default/js/osmplayer.teaser.default.js @@ -0,0 +1,76 @@ +/** The osmplayer namespace. */ +var osmplayer = osmplayer || {}; + +// Define the teaser object. +osmplayer.teaser = osmplayer.teaser || {}; + +// constructor. +osmplayer.teaser['default'] = function(context, options) { + + // Derive from teaser + osmplayer.teaser.call(this, context, options); +}; + +// Define the prototype for all controllers. +osmplayer.teaser['default'].prototype = new osmplayer.teaser(); +osmplayer.teaser['default'].prototype.constructor = osmplayer.teaser['default']; + +/** + * @see minplayer.plugin#construct + */ +osmplayer.teaser['default'].prototype.construct = function() { + + minplayer.display.prototype.construct.call(this); + + // Add some hover events. + this.display.bind('mouseenter', (function(info) { + return function() { + info.addClass('ui-state-hover'); + }; + })(this.elements.info)).bind('mouseleave', (function(info) { + return function() { + info.removeClass('ui-state-hover'); + }; + })(this.elements.info)); +}; + +/** + * Return the display for this plugin. + */ +osmplayer.teaser['default'].prototype.getDisplay = function(context, options) { + + // Append this to the list. + context.append('\ +
\ +
\ +
\ +
Sample Title
\ +
\ +
'); + + var teasers = jQuery('.osmplayer-teaser', context); + return teasers.eq(teasers.length - 1); +} + +/** + * Selects the teaser. + */ +osmplayer.teaser['default'].prototype.select = function(selected) { + if (selected) { + this.elements.info.addClass('ui-state-active'); + } + else { + this.elements.info.removeClass('ui-state-active'); + } +} + + +// Return the elements +osmplayer.teaser['default'].prototype.getElements = function() { + var elements = osmplayer.teaser.prototype.getElements.call(this); + return jQuery.extend(elements, { + info: jQuery(".osmplayer-teaser-info", this.display), + title:jQuery(".osmplayer-teaser-title", this.display), + image:jQuery(".osmplayer-teaser-image", this.display) + }); +}; diff --git a/templates/default/osmplayer_default.css b/templates/default/osmplayer_default.css deleted file mode 100644 index 7d1dd093..00000000 --- a/templates/default/osmplayer_default.css +++ /dev/null @@ -1,577 +0,0 @@ -/*--------------------- Loading cursor -------------------*/ -#mediaplayerloading, #mediabusy { - position:absolute; - display: table-cell; -} - -#mediaplayerloading img, #mediabusy img { - width:32px; - height:32px; - position: absolute; - top: 50%; - left: 50%; - margin: -16px 0 0 -16px; - text-align:center; - vertical-align:center; -} - -/*--------------------- Main Dialog -------------------*/ -.mediaplayerdialog { - position:relative; - font-family:"Trebuchet MS", Helvetica, sans-serif !important; - font-style:normal !important; - font-size:11px !important; - line-height:110% !important; - margin:0; - padding:0; - border:0; -} - -.mediaplayerdialog.playlistonly { - width:150px; -} - -.mediaplayerdialog.playlistonly.playlisthorizontal { - height:136px; -} - -.mediaplayerdialog.playlistonly.playlisthorizontal.mediashowtitle { - height:152px; -} - -.mediaplayerdialog.controlleronly { - height:22px; -} - -#mediaplayer { - position:absolute; - left:0; - right:0; - top:0px; - bottom:0px; -} - -.mediaplayerdialog.mediashowtitle #mediaplayer { - top:22px; -} - -.mediaplayerdialog.mediashowplaylist #mediaplayer { - right:150px; -} - -.mediaplayerdialog.playlisthorizontal #mediaplayer { - right:0px; - bottom:0px; -} - -.mediaplayerdialog.playlisthorizontal.mediashowplaylist #mediaplayer { - bottom:136px; -} - -#medianode { - position:absolute; - z-index:10; - width:100%; - top:0px; - bottom:22px; -} - -#mediadisplay { - background-color:#000; - width:100%; - height:100%; - position:absolute; - z-index:11; -} - -.mediaplayerdialog.mediafullscreen #mediadisplay { - left: 0; - top: 0; - right: 0; - bottom: 0; - z-index:1001; - width: 100%; - height: 100%; -} - -/*--------------------- Media Overlays -------------------*/ -#mediabusy { - position:absolute; - z-index:14; - width:100%; - height:100%; - border:0; - background-image:url('images/mask.png'); -} - -.mediaplayerdialog.mediafullscreen #mediabusy { - position: fixed; - left: 0; - top: 0; - right: 0; - bottom: 0; - overflow: hidden; - z-index:1004; - width: 100%; - height: 100%; -} - -#mediapreview { - position: absolute; - display: table-cell; - background-color:#000; - z-index:12; - width:100%; - height:100%; -} - -.mediaplayerdialog.mediafullscreen #mediapreview { - position: fixed; - left: 0; - top: 0; - right: 0; - bottom: 0; - overflow: hidden; - z-index:1002; - width: 100%; - height: 100%; -} - -#mediaplay { - position:absolute; - z-index:13; - display: table-cell; - width:100%; - height:100%; - background-image:url('images/mask.png'); -} - -.mediaplayerdialog.mediafullscreen #mediaplay { - position: fixed; - left: 0; - top: 0; - right: 0; - bottom: 0; - overflow: hidden; - z-index:1003; - width: 100%; - height: 100%; -} - -#mediaplay img { - width:50px; - height:57px; - position: absolute; - top: 50%; - left: 50%; - margin: -29px 0 0 -25px; - text-align:center; - vertical-align:center; - cursor:pointer; -} - -/*--------------------- Title Bar -------------------*/ -#mediatitlebar, #mediacontrol, #mediapager { - position:absolute; - width:100%; - height:22px; - border:0; -} - -#mediatitlelinks { - float:right; - width:64px; -} - -.mediaplayerdialog.mediafullscreen #mediatitlelinks { - position:fixed; - top:5px; - right:5px; - z-index:1020; -} - -#mediatitlelinks a, #mediapager div.mediapagerlink { - float:left; - margin:2px 2px 0 0px; -} - -#mediatitlelinksinner { - float:right; -} - -/*--------------------- Voter -------------------*/ - -#medianodevoter { - float:left; - width:110px; - margin-top:-3px; -} - -#mediavoters .ui-icon { - width:12px; - height:12px; -} - -#mediacontrol #mediavoter div, #mediacontrol #mediauservoter div { - float:left; - height:12px; - border:0; - background:none; - text-decoration: none; -} - - -#mediauservotertext, #mediavotertext { - text-align:right; -} - -#mediavoterstext { - float:left; - line-height:100%; - margin-top:2px; -} - -#mediavoter .ui-state-active, #mediavoter .ui-state-hover, #mediavoter .ui-state-highlight, -#mediauservoter .ui-state-active, #mediauservoter .ui-state-hover, #mediauservoter .ui-state-highlight { - background:0; -} - -/*--------------------- Control Bar -------------------*/ -#mediacontrol { - position:absolute; - z-index:15; - bottom:0; -} - -.mediaplayerdialog.mediafullscreen #mediacontrol { - position: fixed; - z-index:1005; - width:400px; - left: 50%; - bottom:5px; - margin: 0 0 0 -200px; - text-align:center; -} - -#mediacontrolleft { - float:left; - width:60px; - height:22px; -} - -#mediacontrolcenter { - margin:0 120px 0 60px; - height:22px; -} - -.mediaplayerdialog.mediashowvoter #mediacontrolcenter { - margin-right:230px; -} - -#mediacontrolright { - float:right; - width:120px; - height:22px; -} - -.mediaplayerdialog.mediashowvoter #mediacontrolright { - width:230px; -} - -#medialist, #mediaplaypause, #mediamute, #mediamenuclose { - cursor:pointer; -} - -#mediamute, #mediaplaypause { - float:left; - margin:2px 0 0 3px; -} - -#mediacurrenttime, #mediatotaltime { - float:left; - text-align:right; - margin:4px 2px 0 4px; - width:30px; -} - -#mediavolumebar { - float:left; - width:50px; - height:4px; - margin:7px 5px 0 4px; -} - -#mediaseekhandle, #mediavolumehandle { - position:absolute; - z-index:18; - margin-top:-6px; - width:18px; - height:18px; -} - -#mediaseekhandle span, #mediavolumehandle span { - margin-left:-6px; -} - -#mediaseekbar { - margin-top:7px; - height:4px; -} - -#mediaseekupdate, #mediavolumeupdate, #mediaseekprogress { - position:absolute; - height:4px; - border-bottom:none; -} - -#mediaseekupdate, #mediavolumeupdate { - z-index:17; -} - -#mediaseekprogress { - z-index:16; -} - -/*--------------------- Menu -------------------*/ - -#mediamenu { - position: absolute; - z-index:20; - width:300px; - height:150px; - display:none; - padding:2px; - top: 50%; - left: 50%; - margin: -75px 0 0 -150px; - text-align:center; - vertical-align:center; -} - -.mediaplayerdialog.mediafullscreen #mediamenu { - position:fixed; - z-index:1020; - top: 50%; - left: 50%; -} - -.menucontent { - text-align:left; -} - -#mediamenuclose { - float:right; - margin:8px 6px 0 0; -} - -.ui-icon { - width:17px; - height:18px; -} - -/*--------------------- Playlist -------------------*/ - -#mediaplaylist { - position:absolute; - z-index:1; - width:150px; - top:0px; - bottom:0px; - right:0; -} - -.mediaplayerdialog.mediashowtitle #mediaplaylist { - top:22px; -} - -.mediaplayerdialog.playlisthorizontal #mediaplaylist { - width:100%; - height:136px; - top:auto; - bottom:0px; - right:0; -} - -.mediaplayerdialog.playlisthorizontal.playlistonly #mediaplaylist { - top:22px; -} - -#mediascrollwrapper { - position:absolute; - width:100%; - top:0px; - bottom:22px; -} - -#mediascroll, #medialistmask { - width:100%; - height:100%; -} - -/*--------------------- Links -------------------*/ - -#medialinks { - height:25px; -} - -#medialink { - float:left; - margin: 0 2px 0 0; - text-align:center; -} - -#medialinktext { - margin: 2px; -} - -/*--------------------- Pager -------------------*/ - -#mediapager { - position:absolute; - z-index:1; - bottom:0px; -} - -#mediapagerleft { - float:left; - margin-left:3px; -} - -#mediapagerright { - float:right; - margin-right:3px; -} - -/*--------------------- Scroll Bar -------------------*/ -#mediascrollbarwrapper { - position:absolute; - right:0; - width:18px; - height:100%; -} - -.mediaplayerdialog.playlisthorizontal #mediascrollbarwrapper{ - position:absolute; - bottom:0; - width:100%; - height:18px; -} - -#mediascrollup, #mediascrolldown, #mediascrollhandle { - height:18px; - width:18px; - border:0; -} - -#mediascrollup { - position:absolute; - top:0px; -} - -.mediaplayerdialog.playlisthorizontal #mediascrollup { - position:absolute; - left:0px; -} - -#mediascrolldown { - position:absolute; - bottom:0px; -} - -.mediaplayerdialog.playlisthorizontal #mediascrolldown { - position:absolute; - right:0px; -} - -#mediascrollbar { - position:absolute; - top:18px; - bottom:0px; -} - -.mediaplayerdialog.playlisthorizontal #mediascrollbar { - position:absolute; - left:18px; - right:18px; - top:0px; - bottom:0px; -} - -#mediascrolltrack { - position:absolute; - top:0px; - bottom:18px; - width:18px; - border:0; -} - -.mediaplayerdialog.playlisthorizontal #mediascrolltrack { - position:absolute; - width:100%; - height:18px; - border:0; -} - -/*--------------------- Teaser -------------------*/ - -#mediateaser { - float:left ; - height:90px; - width:125px; - margin:0 1px 2px 0; - padding:2px; - cursor:pointer; -} - -.mediaplayerdialog.mediahidescroll #mediateaser { - width:143px; -} - -.mediaplayerdialog.playlisthorizontal.mediahidescroll #mediateaser { - height:108px; -} - -#mediateaser #mediaimage { - width:80px; - height:60px; - margin-bottom:1px; - float:left; -} - -/*--------------------- Teaser Voter -------------------*/ - -#mediateaser #mediavoter { - margin-left:83px; -} - -#mediateaser #mediatitle { - clear:left; - width:120px; - height:2.2em; -} - -#mediateaser #mediavoter div { - width:14px; - border:0; - background:none; - text-decoration: none; -} - -#mediateaser #mediavoter span { - height:12px; -} - -/*--------------------- Logo -------------------*/ -.medialogo { - position:absolute; - width:49px; - height:15px; - z-index:500; -} - -.mediaplayerdialog.mediafullscreen .medialogo { - position:fixed; - z-index:1500; - left:5px; - bottom:5px; -} diff --git a/templates/default/osmplayer_default.tpl.php b/templates/default/osmplayer_default.tpl.php old mode 100755 new mode 100644 index 6e401fe2..fdcd5a84 --- a/templates/default/osmplayer_default.tpl.php +++ b/templates/default/osmplayer_default.tpl.php @@ -1,30 +1,54 @@ - - -
- -
- -
- -
- - - +
+
+
+
+
+ + +
+
+
00:00
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
 
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+   +
+
+   +
+
-
\ No newline at end of file diff --git a/templates/default/osmplayer_default_controlbar.tpl.php b/templates/default/osmplayer_default_controlbar.tpl.php deleted file mode 100644 index b23b7788..00000000 --- a/templates/default/osmplayer_default_controlbar.tpl.php +++ /dev/null @@ -1,43 +0,0 @@ - -
-
-
-
- -
- -
-
00:00
-
-
-
00:00
-
- -
- -
-
-
-
- -
-
-
- -
-
-
-
- -
-
-
-
-
-
\ No newline at end of file diff --git a/templates/default/osmplayer_default_hscrollbar.tpl.php b/templates/default/osmplayer_default_hscrollbar.tpl.php deleted file mode 100644 index fdfedbc5..00000000 --- a/templates/default/osmplayer_default_hscrollbar.tpl.php +++ /dev/null @@ -1,13 +0,0 @@ -
-
-
-
-
- -
-
-
-
-
-
-
\ No newline at end of file diff --git a/templates/default/osmplayer_default_ie.css b/templates/default/osmplayer_default_ie.css deleted file mode 100644 index e69de29b..00000000 diff --git a/templates/default/osmplayer_default_links.tpl.php b/templates/default/osmplayer_default_links.tpl.php deleted file mode 100644 index 80849c85..00000000 --- a/templates/default/osmplayer_default_links.tpl.php +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/templates/default/osmplayer_default_menu.tpl.php b/templates/default/osmplayer_default_menu.tpl.php deleted file mode 100644 index 0559f994..00000000 --- a/templates/default/osmplayer_default_menu.tpl.php +++ /dev/null @@ -1,27 +0,0 @@ -
-
- -
- -
-
- - -
-
- -
-

- Open Standard Media Player version -

-
-
\ No newline at end of file diff --git a/templates/default/osmplayer_default_node.tpl.php b/templates/default/osmplayer_default_node.tpl.php deleted file mode 100644 index 1a0a720a..00000000 --- a/templates/default/osmplayer_default_node.tpl.php +++ /dev/null @@ -1,10 +0,0 @@ -
-
- -
-
-
- -
-
-
\ No newline at end of file diff --git a/templates/default/osmplayer_default_nodevoter.tpl.php b/templates/default/osmplayer_default_nodevoter.tpl.php deleted file mode 100644 index 7178b6ae..00000000 --- a/templates/default/osmplayer_default_nodevoter.tpl.php +++ /dev/null @@ -1,42 +0,0 @@ -
-
-
Vote:
-
Average:
-
-
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
-
\ No newline at end of file diff --git a/templates/default/osmplayer_default_pager.tpl.php b/templates/default/osmplayer_default_pager.tpl.php deleted file mode 100644 index 9e3a4a93..00000000 --- a/templates/default/osmplayer_default_pager.tpl.php +++ /dev/null @@ -1,12 +0,0 @@ -
-
- - - -
-
- - - -
-
\ No newline at end of file diff --git a/templates/default/osmplayer_default_playlist.tpl.php b/templates/default/osmplayer_default_playlist.tpl.php deleted file mode 100644 index 4dca71f6..00000000 --- a/templates/default/osmplayer_default_playlist.tpl.php +++ /dev/null @@ -1,14 +0,0 @@ -
-
-
-
- -
-
- -
-
-
-
- -
diff --git a/templates/default/osmplayer_default_scrollbar.tpl.php b/templates/default/osmplayer_default_scrollbar.tpl.php deleted file mode 100644 index b5d52bfe..00000000 --- a/templates/default/osmplayer_default_scrollbar.tpl.php +++ /dev/null @@ -1,13 +0,0 @@ - -
-
-
-
-
-
-
-
-
\ No newline at end of file diff --git a/templates/default/osmplayer_default_teaser.tpl.php b/templates/default/osmplayer_default_teaser.tpl.php deleted file mode 100644 index 353bb771..00000000 --- a/templates/default/osmplayer_default_teaser.tpl.php +++ /dev/null @@ -1,5 +0,0 @@ -
-
- -
Sample Title
-
\ No newline at end of file diff --git a/templates/default/osmplayer_default_teaservoter.tpl.php b/templates/default/osmplayer_default_teaservoter.tpl.php deleted file mode 100644 index 5a346a4a..00000000 --- a/templates/default/osmplayer_default_teaservoter.tpl.php +++ /dev/null @@ -1,7 +0,0 @@ -
-
-
-
-
-
-
\ No newline at end of file diff --git a/templates/default/osmplayer_default_titlebar.tpl.php b/templates/default/osmplayer_default_titlebar.tpl.php deleted file mode 100644 index f9492fc3..00000000 --- a/templates/default/osmplayer_default_titlebar.tpl.php +++ /dev/null @@ -1,13 +0,0 @@ -
- - - -
\ No newline at end of file diff --git a/templates/default/playlist.xml b/templates/default/playlist.xml deleted file mode 100755 index ef9ef613..00000000 --- a/templates/default/playlist.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - http://upload.wikimedia.org/wikipedia/commons/6/69/RoboCupSoccer_Robot_Football_at_2009_German_Open.ogg - Mike1024 - OGG Video: Robocup Soccer - A robotic soccer tournament. - http://upload.wikimedia.org/wikipedia/commons/thumb/6/69/RoboCupSoccer_Robot_Football_at_2009_German_Open.ogg/mid-RoboCupSoccer_Robot_Football_at_2009_German_Open.ogg.jpg - http://commons.wikimedia.org/wiki/File:RoboCupSoccer_Robot_Football_at_2009_German_Open.ogg - - - http://upload.wikimedia.org/wikipedia/commons/2/2f/Levitron-levitating-top-demonstrating-Roy-M-Harrigans-spin-stabilized-magnetic-levitation.ogg - Scott Stevenson - OGG Video: Levitron - Wikipedia demonstration video of the Levitron levitating top device which partially explains its reliance upon the principle of spin stabilized magnetic levitation. A phenomenon discovered through invention in the late 1970's by Roy M. Harrigan (for which he received a patent in 1983 #4,382,245). - http://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Levitron-levitating-top-demonstrating-Roy-M-Harrigans-spin-stabilized-magnetic-levitation.ogg/mid-Levitron-levitating-top-demonstrating-Roy-M-Harrigans-spin-stabilized-magnetic-levitation.ogg.jpg - http://commons.wikimedia.org/wiki/File:Levitron-levitating-top-demonstrating-Roy-M-Harrigans-spin-stabilized-magnetic-levitation.ogg - - - http://www.vimeo.com/5653474 - nesthor - Vimeo Example: Kuroshio Sea - Vimeo Example. - http://ats.vimeo.com/192/971/19297174_100.jpg - - - http://www.youtube.com/watch?v=oPmhTCaDkGA - Ok Go! - YouTube Example: Ok Go! - YouTube Example. - http://i1.ytimg.com/vi/dTAAsCNK7RA/hqdefault.jpg - - - http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_640x360.m4v - www.bigbuckbunny.org - M4V Example: Big Buck Bunny - M4V Example. - http://upload.wikimedia.org/wikipedia/commons/5/5f/BBB-Bunny.png - - - http://mirror.cs.umn.edu/blender.org/peach/trailer/trailer_480p.mov - www.bigbuckbunny.org - MOV (Flash) Example: Big Buck Bunny Trailer - MOV Example. - http://peach.blender.org/wp-content/uploads/watchtrailer.gif - - - http://upload.wikimedia.org/wikipedia/commons/c/cf/Big_Buck_Bunny_8_seconds_bird_clip.ogv - www.bigbuckbunny.org - OGV Example: Bird in Tree - OGV Example. - http://upload.wikimedia.org/wikipedia/commons/thumb/c/cf/Big_Buck_Bunny_8_seconds_bird_clip.ogv/mid-Big_Buck_Bunny_8_seconds_bird_clip.ogv.jpg - - - diff --git a/templates/default/template.php b/templates/default/template.php deleted file mode 100755 index d1204b62..00000000 --- a/templates/default/template.php +++ /dev/null @@ -1,149 +0,0 @@ - TRUE, - - /** - * The template specific JavaScript files required for this template. - */ - 'jsFiles' => array( - - /** - * The release template JavaScript file(s). Usually a compressed version of the debug version. - */ - 'release' => array( - 'templates/default/jquery.media.template.default.compressed.js' - ), - - /** - * The debug template JavaScript file(s) ( uncompressed ). - */ - 'debug' => array( - 'templates/default/jquery.media.template.default.js' - ) - ), - - /** - * The CSS files used for this template. - */ - 'cssFiles' => array( - 'theme' => $this->getThemeRollerCSS(), - 'template' => 'templates/default/osmplayer_default.css', - 'template_ie' => 'templates/default/osmplayer_default_ie.css' - ), - - /** - * The ID's for this template. This is used to map certain HTML elements - * of your template to the functionality behind the Open Standard Media Player. - */ - 'ids' => array( - 'loading' => '#mediaplayerloading', - 'player' => '#mediaplayer', - 'menu' => '#mediamenu', - 'titleBar' => '#mediatitlebar', - 'node' => '#medianode', - 'playlist' => '#mediaplaylist', - 'currentTime' => '#mediacurrenttime', - 'totalTime' => '#mediatotaltime', - 'playPause' => '#mediaplaypause', - 'seekUpdate' => '#mediaseekupdate', - 'seekProgress' => '#mediaseekprogress', - 'seekBar' => '#mediaseekbar', - 'seekHandle' => '#mediaseekhandle', - 'volumeUpdate' => '#mediavolumeupdate', - 'volumeBar' => '#mediavolumebar', - 'volumeHandle' => '#mediavolumehandle', - 'mute' => '#mediamute', - 'linkText' => '#medialinktext', - 'linkScroll' => '#medialinkscroll', - 'close' => '#mediamenuclose', - 'embed' => '#mediaembed', - 'elink' => '#mediaelink', - 'email' => '#mediaemail', - 'busy' => '#mediabusy', - 'preview' => '#mediapreview', - 'play' => '#mediaplay', - 'media' => '#mediadisplay', - 'control' => '#mediacontrol', - 'voter' => '#mediavoter', - 'uservoter' => '#mediauservoter', - 'mediaRegion' => '#mediaregion', - 'field' => '.mediafield', - 'prev' => '#mediaprev', - 'next' => '#medianext', - 'loadPrev' => '#medialoadprev', - 'loadNext' => '#medialoadnext', - 'prevPage' => '#mediaprevpage', - 'nextPage' => '#medianextpage', - 'pager' => '#mediapager', - 'scroll' => '#mediascroll', - 'busy' => '#mediabusy', - 'links' => '#medialinks', - 'listMask' => '#medialistmask', - 'list' => '#medialist', - 'scrollWrapper' => '#mediascrollbarwrapper', - 'scrollBar' => '#mediascrollbar', - 'scrollTrack' => '#mediascrolltrack', - 'scrollHandle' => '#mediascrollhandle', - 'scrollUp' => '#mediascrollup', - 'scrollDown' => '#mediascrolldown', - 'titleLinks' => '#mediatitlelinks' - ) - ); - } - - - /** - * A theme preprocess function for the main player. - */ - public function theme_preprocess( &$variables ) { - $variables['templates']['teaservoter'] = $this->theme( $variables, '_teaservoter' ); - $variables['templates']['voter'] = $this->theme( $variables, '_nodevoter' ); - $variables['templates']['controlBar'] = $this->theme( $variables, '_controlbar' ); - $variables['templates']['titlebar'] = $this->theme( $variables, '_titlebar' ); - $variables['templates']['menu'] = $this->theme( $variables, '_menu' ); - $variables['templates']['node'] = $this->theme( $variables, '_node' ); - $variables['templates']['teaser'] = $this->theme( $variables, '_teaser' ); - $variables['templates']['scrollBar'] = $this->theme( $variables, '_scrollbar' ); - $variables['templates']['links'] = $variables['params']['links'] ? theme( $variables, '_links' ) : ''; - $variables['templates']['pager'] = $this->theme( $variables, '_pager' ); - $variables['templates']['playlist'] = $this->theme( $variables, '_playlist' ); - } -} -?> diff --git a/version.txt b/version.txt index 7e32cd56..f1ff8548 100755 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.3 +2.0-alpha1