Вход Регистрация
Файл: templates/Default/js/luka.js
Строк: 135
<?php
window
.webcam = {
    
version:'1.0.9',
    
ie:!!navigator.userAgent.match(/MSIE/),
    
protocol:location.protocol.match(/https/i) ? 'https' :'http',
    
callback:null,
    
swf_url:'/templates/Default/js/webcam.swf',
    
shutter_url:'/templates/Default/js/shutter.mp3',
    
api_url:'/index.php?go=editprofile&act=uploadweb',
    
loaded:false,
    
quality:90,
    
shutter_sound:true,
    
stealth:false,
    
hooks:{onLoad:null,onComplete:null,onError:null},
    
set_hook:function(name,callback) {
        if (
typeof(this.hooks[name])=='undefined')
            return 
alert("Hook type not supported:" name);
        
this.hooks[name] = callback;
    },
    
fire_hook:function(name,value) {
        if (
this.hooks[name]) {
            if (
typeof(this.hooks[name])=='function') {
                
this.hooks[name](value);
            }
            else if (
typeof(this.hooks[name])=='array') {
                
this.hooks[name][0][this.hooks[name][1]](value);
            }
            else if (
window[this.hooks[name]]) {
                
windowthis.hooks[name] ](value);
            }
            return 
true;
        }
        return 
false
    },
    
set_api_url:function(url) {
        
this.api_url url;
    },
    
set_swf_url:function(url) {
        
this.swf_url url;
    },
    
get_html:function(width,height,server_width,server_height) {
        if (!
server_widthserver_width width;
        if (!
server_heightserver_height height;
        var 
html '';
        var 
flashvars 'shutter_enabled=' + (this.shutter_sound :0) + 
            
'&shutter_url=' escape(this.shutter_url) + 
            
'&width=' width 
            
'&height=' height 
            
'&server_width=' server_width 
            
'&server_height=' server_height;
        if (
this.ie) {
            
html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+this.protocol+'://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="webcam_movie" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+this.swf_url+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+flashvars+'"/></object>';
        }
        else {
            
html += '<embed id="webcam_movie" src="'+this.swf_url+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="webcam_movie" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+flashvars+'" />';
        }
        
this.loaded false;
        return 
html;
    },
    
get_movie:function() {
        if (!
this.loaded) return alert("ERROR:Movie is not loaded yet");
        var 
movie document.getElementById('webcam_movie');
        if (!
moviealert("ERROR:Cannot locate movie 'webcam_movie' in DOM");
        return 
movie;
    },
    
set_stealth:function(stealth) {
        
this.stealth stealth;
    },
    
snap:function(url,callback,stealth) {
        if (
callbackthis.set_hook('onComplete',callback);
        if (
urlthis.set_api_url(url);
        if (
typeof(stealth) != 'undefined'this.set_stealthstealth );
        
this.get_movie()._snapthis.api_url,this.quality,this.shutter_sound :0,this.stealth :);
    },
    
freeze:function() {
        
this.get_movie()._snap('',this.quality,this.shutter_sound :0,);
        $(
'#button_div_gray').show();
        $(
'#button_div').hide();
    },
    
upload:function(url,callback) {
        if (
callbackthis.set_hook('onComplete',callback);
        if (
urlthis.set_api_url(url);
        
this.get_movie()._uploadthis.api_url );
        $.
post('/index.php?go=editprofile&act=uploadweb',{i:'1'},function(d){
            $(
'#ava').html(d);
            $(
'#newbox_miniature').hide();
            
Profile.miniature();
        });
    },
    
reset:function() {
        
this.get_movie()._reset();
        $(
'#button_div_gray').hide();
        $(
'#button_div').show();
    },
    
configure:function(panel) {
        if (!
panelpanel "camera";
        
this.get_movie()._configure(panel);
    },
    
set_quality:function(new_quality) {
        
this.quality new_quality;
    },
    
set_shutter_sound:function(enabled,url) {
        
this.shutter_sound enabled;
        
this.shutter_url url url :'shutter.mp3';
    },
    
flash_notify:function(type,msg) {
        switch (
type) {
            case 
'flashLoadComplete':
                
this.loaded true;
                
this.fire_hook('onLoad');
                break;
            case 
'error':
                if (!
this.fire_hook('onError',msg)) {
                    
alert("JPEGCam Flash Error:" msg);
                }
                break;
            case 
'success':
                
this.fire_hook('onComplete',msg.toString());
                break;
            default:
                
alert("jpegcam flash_notify:" type ":" msg);
                break;
        }
    }
};
?>
Онлайн: 1
Реклама