вопрос
Всем привет, скажите пожалуйста ,Как сделать перемещение объекта? в jQuery
Вот код плеера
Вот код плеера
// Квары (1 - on, 0 - off)
var PosterOn = 1, // Постер трека
BtnSetting = 1, // Кнопкa Настройки
BtnAgain = 1, // Кнопкa Повторить
BtnStop = 1, // Кнопкa Стоп
BtnClose = 1, // Кнопкa Закрыть
BtnPrev = 1, // Кнопкa Предыдущий трек
BtnNext = 1, // Кнопкa Следующий трек
BtnDownload = 1, // Кнопкa Скачать
BtngetCode = 0, // Кнопка "Поставить себе на сайт такой плеер"
changeTitle = 0, // Менять титул
changeTitleID = 0, // Показать ID трека в титул
SettingPColor = 0, // Опция "Цвет плеера"
SettingPTrans = 1, // Опция "Прозрачность"
SettingPPoster = 1, // Опция "Показать постер"
SettingPBorder = 1, // Опция "Обводка и фон кнопок"
SettingPNext = 1, // Опция "Переключать в конце"
SettingPNext1 = 1, // Опция "Переключать вперед или назад"
SettingPPosition = 1, // Опция "Положения"
SettingConfig = 0, // Опция "Конфиг"
SettingScroll = 0, // Прятать полосу прокрутки когда окно "Настройки плеера" открытое?
// Текст окна Настроки плеера
TextTitle = 'Настройки плеера',
TextClose = 'Закрыть',
TextColor = 'Цвет плеера:',
TextTrans = 'Прозрачность:',
TextPPoster = 'Показать постер?',
TextPBorder = 'Обводка и фон кнопок',
TextPNext = 'Переключать в конце?',
TextPNext1 = 'Переключать вперед или назад?',
TextPPosition = 'Положения:',
TextPPositionTop = 'Сверху',
TextPPositionBottom = 'Снизу',
TextPPositionLeft = 'Слева',
TextPPositionCenter = 'По центру',
TextPPositionRight = 'Справа',
// Другой текст
TextEnd = 'Воспроизведения закончилось', // Если отключена опция "Автоматическое переключения в конце" то в конце каждого трека выводится эта запись
TextPlayed = 'Играет ', // Если включена опция "Менять титул" то во вкладке браузера буде выводится эта запись + название трека
TextNoTrack = 'На этой странице воспроизведения закончилось, перейдите на следующую страницу.',
// Подсказки (title)
titlePrev = 'Предыдущий трек',
titlePlayPause = 'Плей / Пауза',
titleAgain = 'Повторить трек',
titleStop = 'Остановить',
titleNext = 'Следующий трек',
titleSetting = 'Настройки плеера',
titleDownload = 'Скачать',
titlegetCode = 'Поставить себе на сайт такой плеер',
titleClose = 'Закрыть плеер',
// Основные настройки плеера
PlayerID = 'SwfPlayer',
PlayerData = dle_root+'templates/'+dle_skin+'/music/player/uppod.swf', // swf плеер
PlayerST = dle_root+'templates/'+dle_skin+'/music/player/style.txt', // стиль плеера
PlayerWidth = 330,
PlayerHieght = 40,
PlayerClass = 'TablePl',
// Другое
getCodeUrl = dle_root,
BtClick = 'Player',
NoPoster = dle_root+'templates/'+dle_skin+'/music/img/nocover.png',
html = jQuery('#SwfPlayerv'),
Text = document.title,
iTitle = jQuery('title'),
htmlClass = '.'+html.attr('class'),
windowHeight = jQuery(window).height();
Again = 0,
Xx = '#',
xX = '.',
Cookies = ['PlayerPG','PlayerPV','PlayerTransparency','Poster','AutoNext','AutoNext2','PlayerColorRed','PlayerColorGreen','PlayerColorBlue','BottonBorder'],
Botton = ['Close','Play','Pause','Stop','Next','Prev','Download','Settings','Again','Poster','PlayPause','getCode','config','all','border'],
CSSP = ['','50px','25%','15px']
function setCookie(name, value, days) {
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires = "; expires=" + date.toGMTString();
}
else {
var expires = "";
}
document.cookie = name + "=" + value + expires + "; path=/";
};
function getCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
};
function uppodEvent(playerID,event) {
switch(event){
case 'init':
break;
case 'start':
break;
case 'play':
break;
case 'pause':
break;
case 'stop':
break;
case 'seek':
break;
case 'loaded':
break;
case 'end':
break;
case 'download':
break;
case 'quality':
break;
case 'error':
break;
case 'ad_end':
break;
case 'pl':
break;
}
}
function uppodSend(playerID,com,callback) {
document.getElementById(playerID).sendToUppod(com);
}
function uppodGet(playerID,com,callback) {
return document.getElementById(playerID).getUppod(com);
}
function uppodEvent(a, b){
setInterval(function (){
if (Again < 1) {
jQuery(Xx+Botton[8]).click(function (){
Again = 1;
jQuery(this).css({opacity : '1'})
});
}
else {
jQuery(Xx+Botton[8]).click(function (){
Again = 0;
jQuery(this).css({opacity : '0.4'})
});
}
}, 300);
jQuery(Xx+Botton[12]).prepend('<p>'+b+'</p>');
switch (b){
case "end":
jQuery(Xx+Botton[10]).removeClass(Botton[2]).addClass(Botton[1]);
setTimeout(function (){
var c=Player.getCookie(4),d=Player.getCookie(5);
if (Again === 1)Player.sendTo('play');
else if (c)alert(TextEnd);
else if (d)Player.switching(a,'prev');
else Player.switching(a,'next');
}, 300);
break;
case "play":
jQuery(Xx+Botton[10]).removeClass(Botton[1]).addClass(Botton[2])
break;
case "stop":
jQuery(Xx+Botton[10]).removeClass(Botton[2]).addClass(Botton[1])
break;
case "pause":
jQuery(Xx+Botton[10]).removeClass(Botton[2]).addClass(Botton[1])
break;
}
}
var Player = {
send : function (a, b, c, d, e){
if(a.length > titletrack) {
title = a.substring(0, titletrack)+"...";
}
else {
title = a
}
html.stop().animate({opacity : '1', display : ''},{queue : false, duration : 350})
.html(
'<table border="0" cellpadding="0" cellspacing="0" height="44">'+
'<tr>' +
'<td style="padding-right:5px;"><div id="'+Botton[9]+'"><img style="width:44px; height:44px;" src="'+e+'"></div></td>'+
'<td>' +
'<table border="0" cellpadding="0" cellspacing="0" class="'+PlayerClass+'" height="44">' +
'<tr>' +
'<td title="'+titlePrev+'" onclick="Player.switching('+c+',\'prev\')"><font id="'+Botton[5]+'"></font></td>' +
'<td title="'+titlePlayPause+'" onclick="Player.sendTo(\'toggle\')"><font id="'+Botton[10]+'"></font></td>' +
'<td title="'+titleStop+'" onclick="Player.sendTo(\'stop\')"><font id="'+Botton[3]+'"></font></td>' +
'<td title="'+titleNext+'" onclick="Player.switching('+c+',\'next\')"><font id="'+Botton[4]+'"></font></td>' +
'<td>'+
'<object id="'+PlayerID+'" type="application/x-shockwave-flash" data="'+PlayerData+'" width="'+PlayerWidth+'" height="'+PlayerHieght+'">'+
'<param value="#ffffff" />' +
'<param name="allowFullScreen" value="true" />' +
'<param name="allowScriptAccess" value="always" />' +
'<param name="wmode" value="transparent" />' +
'<param name="movie" value="'+PlayerData+'" />' +
'<param name="flashvars" value="uid='+c+'&comment='+title+'&st='+PlayerST+'&file='+b+'" />' +
'</object>'+
'</td>' +
'<td title="'+titleAgain+'"><font id="'+Botton[8]+'"></font></td>' +
'<td title="'+titleSetting+'"><font id="'+Botton[7]+'" onclick="Player.setting(\'open\');"></font></td>' +
'<td title="'+titleDownload+' '+a+'"><a id="'+Botton[6]+'" href="'+d+'"></a></td>' +
'<td title="'+titlegetCode+'"><a id="'+Botton[11]+'" href="'+getCodeUrl+'" target="_blank"></a></td>' +
'<td title="'+titleClose+'" onclick="Player.close();"><font id="'+Botton[0]+'"></font></td>' +
'</tr>'+
'</table>' +
'</td>'+
'</tr>'+
'</table>');
Again=0;
Player.addClass();
Player.ifs(a,b,c);
},
addClass : function () {
jQuery(Xx+Botton[0]).addClass(Botton[0]+' '+Botton[13]+' '+Botton[14]);
jQuery(Xx+Botton[1]).addClass(Botton[1]+' '+Botton[13]+' '+Botton[14]);
jQuery(Xx+Botton[2]).addClass(Botton[2]+' '+Botton[13]+' '+Botton[14]);
jQuery(Xx+Botton[3]).addClass(Botton[3]+' '+Botton[13]+' '+Botton[14]);
jQuery(Xx+Botton[4]).addClass(Botton[4]+' '+Botton[13]+' '+Botton[14]);
jQuery(Xx+Botton[5]).addClass(Botton[5]+' '+Botton[13]+' '+Botton[14]);
jQuery(Xx+Botton[6]).addClass(Botton[6]+' '+Botton[13]+' '+Botton[14]);
jQuery(Xx+Botton[7]).addClass(Botton[7]+' '+Botton[13]+' '+Botton[14]);
jQuery(Xx+Botton[8]).addClass(Botton[8]+' '+Botton[13]+' '+Botton[14]);
jQuery(Xx+Botton[9]).addClass(Botton[9]+' '+Botton[13]+' '+Botton[14]);
jQuery(Xx+Botton[10]).addClass(Botton[2]+' '+Botton[13]+' '+Botton[14]);
jQuery(Xx+Botton[11]).addClass(Botton[11]+' '+Botton[13]+' '+Botton[14]);
jQuery(Xx+Botton[12]).addClass(Botton[12]);
},
ifs : function (e,f,g) {
var a=Player.getCookie(0),b=Player.getCookie(1),c=Player.getCookie(2),d=Player.getCookie(3),h=Player.getCookie(6),i=Player.getCookie(7),g=Player.getCookie(8),p=Player.getCookie(9),z='CHECKED';
if (b==='top') jQuery(htmlClass).css({top:CSSP[3], bottom:CSSP[0]}); else
if (b==='bottom') jQuery(htmlClass).css({top:CSSP[0], bottom:CSSP[3]}); else jQuery(htmlClass).css({bottom:CSSP[3]});
if (a==='left') jQuery(htmlClass).css({left:CSSP[1], right:CSSP[0]}); else
if (a==='center') jQuery(htmlClass).css({left:CSSP[2], right:CSSP[0]}); else
if (a==='right') jQuery(htmlClass).css({left:CSSP[0], right:CSSP[1]}); else jQuery(htmlClass).css({left:CSSP[2]});
if (SettingPBorder === 0) {jQuery(xX+Botton[13]).removeClass(Botton[14]);jQuery('#PBorder').hide();} else if (p) jQuery(xX+Botton[13]).addClass(Botton[14]); else jQuery(xX+Botton[13]).removeClass(Botton[14]);
if (c) jQuery(xX+PlayerClass).css({background:'rgba('+h+','+i+','+g+',0.'+c+')'});jQuery(Xx+Botton[9]).css({border:'1px solid rgba('+h+','+i+','+g+',0.8)'});
if (d || PosterOn === 0) jQuery(Xx+Botton[9]).hide(); else jQuery(xX+Botton[9]+' img').error(function () {jQuery(this).attr('src', NoPoster)});
if (BtnSetting === 0 || SettingPColor === 0 && SettingPTrans === 0 && SettingPPoster === 0 && SettingPNext === 0 && SettingPNext1 === 0 && SettingPPosition === 0 && SettingPBorder === 0) jQuery(Xx+Botton[7]).hide();
if (BtnDownload === 0) jQuery(Xx+Botton[6]).hide()
if (BtnStop === 0) jQuery(Xx+Botton[3]).hide()
if (BtnAgain === 0) jQuery(Xx+Botton[8]).hide()
if (BtnClose === 0) jQuery(Xx+Botton[0]).hide()
if (BtnPrev === 0) jQuery(Xx+Botton[5]).hide()
if (BtnNext === 0) jQuery(Xx+Botton[4]).hide()
if (BtngetCode === 0) jQuery(Xx+Botton[11]).hide()
if (changeTitle === 0) iTitle.html(Text); else if (changeTitleID === 1) iTitle.html('['+g+'] '+TextPlayed+e); else iTitle.html(TextPlayed+e);
},
setting : function (a) {
if (a === 'open') {
var a=Player.getCookie(4),b=Player.getCookie(5),c=Player.getCookie(3),d=Player.getCookie(0),e=Player.getCookie(1),f='CHECKED',p=Player.getCookie(9);
if (SettingPColor === 0) jQuery('#PColor').hide();
if (SettingPTrans === 0) jQuery('#PTrans').hide();
if (SettingPPoster === 0) jQuery('#PPoster').hide(); else if (c) jQuery('#PPoster2').attr(f,f); else jQuery('#PPoster1').attr(f,f);
if (SettingPNext === 0) jQuery('#PNext').hide(); else if (a) {jQuery('#PNext2').attr(f,f);jQuery('#PNext34').hide();} else {jQuery('#PNext1').attr(f,f); if (SettingPNext1 === 0) {jQuery('#PNext34').hide();} else {jQuery('#PNext34').show();}}
if (SettingPNext1 === 0) jQuery('#PNext34').hide(); else if (b) jQuery('#PNext4').attr(f,f); else jQuery('#PNext3').attr(f,f);
if (SettingPPosition === 0) jQuery('#PPosition').hide(); else if (d) {jQuery('#PP'+d).addClass('active');} else {jQuery('#PPcenter').addClass('active');} if (e) {jQuery('#PP'+e).addClass('active');} else {jQuery('#PPbottom').addClass('active');}
if (p) jQuery('#PBorder1').attr(f,f); else jQuery('#PBorder2').attr(f,f);
if (SettingConfig === 0) jQuery('#PConfig').hide();
if (SettingScroll === 1) document.body.style.overflow = "hidden";
jQuery(Xx+Botton[7]).css({opacity : '1'});
jQuery('#Modal').stop().fadeIn(500);
}
else {
jQuery('#Modal').stop().fadeOut(500);
document.body.style.overflow = '';
jQuery(Xx+Botton[7]).css({opacity : ''});
}
},
settings : function (a,b,c,d,e,f) {
if (a === 'PPosition'){
if (b === 'top' || b === 'bottom'){
jQuery(htmlClass).css({top : CSSP[e], bottom : CSSP[f]});
}
else {
jQuery(htmlClass).css({left : CSSP[e], right : CSSP[f]});
}
}
else if (a === 'PBorder') {
if (b === 1){
jQuery(xX+Botton[13]).addClass(Botton[14]);
}
else {
jQuery(xX+Botton[13]).removeClass(Botton[14]);
}
}
Player.setCookie(c,b,d);
},
switching : function (a,b,c) {
if (!c) c = 1; //else if (c > 100) alert(TextNoTrack);
if (b === 'next') {
a=a-1;
if (document.getElementById(BtClick+a)) {
jQuery(Xx+BtClick+a).click();
}
else {
c=+c+1;
a=a-1;
Player.switching(a,'next',c)
}
}
else {
a=+a+1;
if (document.getElementById(BtClick+a)) {
jQuery(Xx+BtClick+a).click();
}
else {
c=+c+1;
a=+a+1;
Player.switching(a,'prev',c)
}
}
},
close : function () {
Player.setting('close')
jQuery(Xx+Botton[3]).click()
html.animate({opacity : '0', display : 'none'},{queue : false, duration : 350});
Again = 0;
iTitle.html(Text)
},
sendTo : function (a) {
uppodSend(PlayerID, a)
},
getTo : function (a) {
return uppodGet(PlayerID,a)
},
setCookie : function (a,b,c) {
setCookie(Cookies[a], b, c);
},
getCookie : function (a) {
return getCookie(Cookies[a]);
},
delCookie : function (a) {
setCookie(Cookies[a], 1, -1);
}
}
function refreshSwatch() {
var red = jQuery( "#red" ).slider( "value" ),
green = jQuery( "#green" ).slider( "value" ),
blue = jQuery( "#blue" ).slider( "value" ),
trans = jQuery( "#trans" ).slider( "value" );
jQuery(xX+PlayerClass).css({background:'rgba('+red+', '+green+', '+blue+', 0.'+trans+')'});
jQuery(Xx+Botton[9]).css({border:'1px solid rgba('+red+', '+green+', '+blue+', 0.'+trans+')'});
Player.setCookie(6,red,365);
Player.setCookie(7,green,365);
Player.setCookie(8,blue,365);
Player.setCookie(2,trans,365);
}
jQuery(function() {
jQuery("#Modal").html(
'<div class="Window">'
+'<div class="WinTitle">'+TextTitle+'</div>' +
'<a class="WinClose" onclick="Player.setting(\'close\');">'+TextClose+'</a>'+
'<div class="WinContent">' +
'<table border="0" cellpadding="0" width="100%" cellspacing="0" class="AjaxOptions">' +
'<tr class="AjaxOpt" id="PColor">'+
'<td align="left" width="200" valign="top" style="padding:5px;">'+TextColor+'</td>' +
'<td style="padding:5px;">' +
'<div id="red"></div>'+
'<div id="green"></div>'+
'<div id="blue"></div>' +
'</td>'+
'</tr>' +
'<tr class="AjaxOpt" id="PTrans">'+
'<td align="left" style="padding:5px;">'+TextTrans+'</td>' +
'<td style="padding:5px;"><div id="trans"></div></td>'+
'</tr>' +
'<tr class="AjaxOpt" id="PPoster">'+
'<td align="left" style="padding:5px;">'+TextPPoster+'</td>' +
'<td style="padding:5px;">'+
'<span class="toggle-bg">' +
'<input onclick="Player.settings(\'PPoster\',1,3,-1);jQuery(Xx+Botton[9]).show();" id="PPoster1" class="PPoster" name="PPoster" type="radio">' +
'<input onclick="Player.settings(\'PPoster\',0,3,365);jQuery(Xx+Botton[9]).hide();" id="PPoster2" class="PPoster" name="PPoster" type="radio">' +
'<span class="switch"></span>'+
'</span>'+
'</td>'+
'</tr>' +
'<tr class="AjaxOpt" id="PBorder">'+
'<td align="left" style="padding:5px;">'+TextPBorder+'</td>' +
'<td style="padding:5px;">'+
'<span class="toggle-bg">' +
'<input onclick="Player.settings(\'PBorder\',1,9,365);" id="PBorder1" class="PBorder" name="PBorder" type="radio">' +
'<input onclick="Player.settings(\'PBorder\',0,9,-1);" id="PBorder2" class="PBorder" name="PBorder" type="radio">' +
'<span class="switch"></span>'+
'</span>'+
'</td>'+
'</tr>' +
'<tr class="AjaxOpt" id="PNext">'+
'<td align="left" style="padding:5px;">'+TextPNext+'</td>' +
'<td style="padding:5px;">'+
'<span class="toggle-bg">' +
'<input onclick="Player.settings(\'PNext\',1,4,-1);jQuery(\'#PNext34\').fadeIn(300);" id="PNext1" class="PNext" name="PNext" type="radio">' +
'<input onclick="Player.settings(\'PNext\',0,4,365);jQuery(\'#PNext34\').fadeOut(300); " id="PNext2" class="PNext" name="PNext" type="radio">' +
'<span class="switch"></span>'=
'</span>'+
'</td>'+
'</tr>' +
'<tr class="AjaxOpt" id="PNext34">'+
'<td align="left" style="padding:5px;">'+TextPNext1+'</td>' +
'<td style="padding:5px;">'+
'<span class="toggle-bg">' +
'<input onclick="Player.settings(\'PNext2\',0,5,-1);" id="PNext3" class="PNext1" name="PNext1" type="radio">' +
'<input onclick="Player.settings(\'PNext2\',0,5,365);" id="PNext4" class="PNext1" name="PNext1" type="radio">' +
'<span class="switch"></span>'+
'</span>'+
'</td>'+
'</tr>' +
'<tr class="AjaxOpt" id="PPosition">'+
'<td align="left" valign="center" style="padding:5px;">'+TextPPosition+'</td>' +
'<td style="padding-top:10px;">' +
'<div class="btn-group" data-toggle="buttons-radio">' +
'<button type="button" class="btn btn-primary" onclick="Player.settings(\'PPosition\',\'top\',1,365,3,0);" id="PPtop">'+TextPPositionTop+'</button>' +
'<button type="button" class="btn btn-primary" onclick="Player.settings(\'PPosition\',\'bottom\',1,365,0,3);" id="PPbottom">'+TextPPositionBottom+'</button>' +
'</div>' +
'<div class="btn-group" data-toggle="buttons-radio" style="margin-left:10px;">' +
'<button type="button" class="btn btn-primary" onclick="Player.settings(\'PPosition\',\'left\',0,365,1,0);" id="PPleft">'+TextPPositionLeft+'</button>' +
'<button type="button" class="btn btn-primary" onclick="Player.settings(\'PPosition\',\'center\',0,365,2,0);" id="PPcenter">'+TextPPositionCenter+'</button>' +
'<button type="button" class="btn btn-primary" onclick="Player.settings(\'PPosition\',\'right\',0,365,0,1);" id="PPright">'+TextPPositionRight+'</button>' +
'</div>'+
'</td>'+
'</tr>' +
'<tr id="PConfig">'+
'<td valign="top" align="left" style="padding:5px;">Конфиг плеера</td>' +
'<td style="padding-top:10px;"><div id="'+Botton[12]+'"></div></td>' +
'</tr>'+
'</table>' +
'<div align="right" style="margin-top:15px;"></div>' +
'</div>'+
'</div>'
).css({height: +windowHeight+20+'px'})
jQuery( "#red, #green, #blue" ).slider({
orientation: "horizontal",
range: "min",
min: 30,
max: 200,
value: 127,
slide: refreshSwatch,
change: refreshSwatch
});
jQuery( "#trans" ).slider({
orientation: "horizontal",
range: "min",
min: 20,
max: 99,
value: 60,
slide: refreshSwatch,
change: refreshSwatch
});
a=Player.getCookie(6),b=Player.getCookie(7),c=Player.getCookie(8),d=Player.getCookie(2);
if (a) {
var red = a,
green = b,
blue = c,
trans = d;
}
else {
var red = 74,
green = 170,
blue = 74,
trans = 60;
}