Вход Регистрация
Файл: user/files/audio-player-uncompressed.js
Строк: 166
<?php
var AudioPlayer = function () {
    var 
instances = [];
    var 
groups = {};
    var 
activePlayers = {};
    var 
playerURL "";
    var 
defaultOptions = {};
    var 
currentVolume = -1;
    var 
requiredFlashVersion "9";
    
    function 
getPlayer(playerID) {
        if (
document.all && !window[playerID]) {
            for (var 
0document.forms.lengthi++) {
                if (
document.forms[i][playerID]) {
                    return 
document.forms[i][playerID];
                    break;
                }
            }
        }
        return 
document.all window[playerID] : document[playerID];
    }
    
    function 
addListener (playerIDtypefunc) {
        
getPlayer(playerID).addListener(typefunc);
    }
    
    return {
        
setup: function (urloptions) {
            
playerURL url;
            
defaultOptions options;
            if (
swfobject.hasFlashPlayerVersion(requiredFlashVersion)) {
                
swfobject.switchOffAutoHideShow();
                
swfobject.createCSS("p.audioplayer_container span""visibility:hidden;height:24px;overflow:hidden;padding:0;border:none;");
            }
        },

        
getPlayer: function (playerID) {
            return 
getPlayer(playerID);
        },
        
        
addListener: function (playerIDtypefunc) {
            
addListener(playerIDtypefunc);
        },
        
        
embed: function (elementIDoptions) {
            var 
instanceOptions = {};
            var 
key;
            
            var 
flashParams = {};
            var 
flashVars = {};
            var 
flashAttributes = {};
    
            
// Merge default options and instance options
            
for (key in defaultOptions) {
                
instanceOptions[key] = defaultOptions[key];
            }
            for (
key in options) {
                
instanceOptions[key] = options[key];
            }
            
            if (
instanceOptions.transparentpagebg == "yes") {
                
flashParams.bgcolor "#FFFFFF";
                
flashParams.wmode "transparent";
            } else {
                if (
instanceOptions.pagebg) {
                    
flashParams.bgcolor "#" instanceOptions.pagebg;
                }
                
flashParams.wmode "opaque";
            }
            
            
flashParams.menu "false";
            
            for (
key in instanceOptions) {
                if (
key == "pagebg" || key == "width" || key == "transparentpagebg") {
                    continue;
                }
                
flashVars[key] = instanceOptions[key];
            }
            
            
flashAttributes.name elementID;
            
flashAttributes.style "outline: none";
            
            
flashVars.playerID elementID;
            
            
swfobject.embedSWF(playerURLelementIDinstanceOptions.width.toString(), "24"requiredFlashVersionfalseflashVarsflashParamsflashAttributes);
            
            
instances.push(elementID);
            
            if (
options.group) {
                
groups[elementID] = options.group;
            }
        },
        
        
syncVolumes: function (playerIDvolume) {    
            if (
groups[playerID]) return;
            
currentVolume volume;
            for (var 
0instances.lengthi++) {
                if (!
groups[instances[i]] && instances[i] != playerID) {
                    
getPlayer(instances[i]).setVolume(currentVolume);
                }
            }
        },
        
        
activate: function (playerIDinfo) {
            for (var 
activePlayerID in activePlayers) {
                if (
activePlayerID == playerID) {
                    continue;
                }
                if (
groups[playerID] != groups[activePlayerID]) {
                    
this.close(activePlayerID);
                    continue;
                }
                if (!(
groups[playerID] || groups[activePlayerID])) {
                    
this.close(activePlayerID);
                }
            }
            
activePlayers[playerID] = 1;
        },
        
        
load: function (playerIDsoundFiletitlesartists) {
            
getPlayer(playerID).load(soundFiletitlesartists);
        },
        
        
close: function (playerID) {
            
getPlayer(playerID).close();
            if (
playerID in activePlayers) {
                
delete activePlayers[playerID];
            }
        },
        
        
open: function (playerIDindex) {
            if (
index == undefined) {
                
index 1;
            }
            
getPlayer(playerID).open(index == undefined index-1);
        },
        
        
getVolume: function (playerID) {
            return 
currentVolume;
        }
        
    }
    
}();
?>
Онлайн: 1
Реклама