Передвижение jQuery плеера. Как сделать??
Всем привет, скажите пожалуйста ,Как сделать перемещение объекта? в 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('
'+b+'
'); 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( ''+ '' + '
'+ '
' + '' + '' + '
' + '
' + '
' + '
' + '
'+ ''+ '
' + '
' + '
' + '
' + '
' + '
' + ''+ '' + '
'+ ''+ ''); 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( '
' +'
'+TextTitle+'
' + ''+TextClose+''+ '
' + '' + ''+ '
'+TextColor+'
' + '
' + '
'+ '
'+ '
' + '
'+ '' + ''+ '
'+TextTrans+'
' + '
'+ '' + ''+ '
'+TextPPoster+'
' + '
'+ '' + '' + '' + ''+ ''+ '
'+ '' + ''+ '
'+TextPBorder+'
' + '
'+ '' + '' + '' + ''+ ''+ '
'+ '' + ''+ '
'+TextPNext+'
' + '
'+ '' + '' + '' + ''= ''+ '
'+ '' + ''+ '
'+TextPNext1+'
' + '
'+ '' + '' + '' + ''+ ''+ '
'+ '' + ''+ '
'+TextPPosition+'
' + '
' + '
' + '' + '' + '
' + '
' + '' + '' + '' + '
'+ '
'+ '' + ''+ '
Конфиг плеера
' + '
' + ''+ '' + '
' + '
'+ '
' ).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; }
Источник: dle-faq.pro