xml 파일에서로드되어 json으로 변환되는 재생 목록이있는 jplayer가 있습니다. 공유 버튼 (재생 목록의 각 노래가 아닌 중앙 버튼)을 추가하려고하는데 공유하는 URL에 제목을 추가하는 코드를 만들었지 만 매개 변수를 가져 오는 방법을 알 수는 없습니다. 사용자가 링크를 따라 사이트를 방문 할 때 공유 노래가 재생되는지 확인하기 위해 URL을 차단해야합니다. 재생 목록 파일, 특히 select 함수를 수정합니다. 내 사이트는 로컬이므로 링크를 공유 할 수 없지만 재생 목록 코드의 수정 된 부분을 게시 할 수 있습니다.Jplayer 공유 버튼 - URL에서 매개 변수 가져 오기
도움을 주셔서 감사합니다. 스테파니
Link to original playlist file
수정 된 선택 기능 : 당신은 현재 미디어를 기반으로 URL을 생성해야하고 또한 당신이 연주 경우 현재 재생되는 미디어 알고 싶은 제대로 이해하면
select: function(index) {
$.urlParam = function(homily) {
var results = new RegExp('[\\?&]' + homily + '=([^&#]*)').exec(window.location.href);
return results[1] || 0;
console.log($.urlParam('homily'));
index = (index < 0) ? this.original.length + index : index; // Negative index relates to end of array.
if(encodeURIComponent($.urlParam('homily')) === this.playlist[index].title) {
this.current = this.playlist[index].title;
$(this.cssSelector.jPlayer).jPlayer("setMedia", this.playlist[this.current]);
} else if (0 <= index && index < this.playlist.length) {
this.current = index;
this._highlight(index);
$(this.cssSelector.jPlayer).jPlayer("setMedia", this.playlist[this.current]);
var downloadBtn=this.cssSelector.cssSelectorAncestor+' [class^="download_btn"]';
$(downloadBtn).attr('href', encodeURIComponent(this.playlist[this.current].mp3));
var shareBtn=this.cssSelector.cssSelectorAncestor+' [class^="share_btn"]';
$(shareBtn).attr('href', "?homily=" + decodeURIComponent(this.playlist[this.current].title));
} else {
this.current = 0;
}
}
},