Add Merging Playlist (#115)

* Add Merging Playlist

Add Merging Playlist function in my playlist

* Mirror fix

fix some mirror bugs

* Revert "Mirror fix"

This reverts commit 0c77b4ce6c.

* Revert "Revert "Mirror fix""

This reverts commit 239f018f70.

* Minor fixes

* Code improvement

clean some code and fix some issues
This commit is contained in:
Dumeng 2017-12-20 16:25:53 +08:00 committed by Listen 1
parent 26058c3d4b
commit 944bf5af44
5 changed files with 128 additions and 26 deletions

View File

@ -2,6 +2,28 @@ a {
cursor: pointer;
}
*::-webkit-scrollbar-track
{
box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
border-radius: 10px;
background-color: #F5F5F5;
}
*::-webkit-scrollbar
{
width: 12px;
background-color: #F5F5F5;
border-radius: 12px;
}
*::-webkit-scrollbar-thumb
{
border-radius: 10px;
box-shadow: inset 0 0 6px rgba(0,0,0,.3);
background-color: #555;
}
.shadow {
position: fixed;
background: rgba(30,30,30,0.9);
@ -92,19 +114,20 @@ a {
}
.site-wrapper {
width:100%;
/* width:1000px; */
margin:0 auto 0 auto;
overflow:hidden;
position: absolute;
padding-left: 17px;
top: 0; left: 0; bottom: 0; right: 0;
position: absolute;
}
.site-wrapper-innerd {
overflow-y: scroll;
margin-top: 90px;
margin: 90px auto 0 auto;
/* uncomment the line below will hide the scroll bar */
/*padding-right: 17px;*/
box-sizing:content-box;
width:100%;
box-sizing: content-box;
/* width: 1000px; */
background-color: #333;
}
@ -726,7 +749,6 @@ li {
text-indent: -9999px;
width: 36px;
height: 36px;
margin-right: 8px;
margin-top: 0;
background: url(../images/player_large.png) no-repeat 0 9999px;
}
@ -748,45 +770,37 @@ li {
}
.playlist-detail .detail-head-title .link {
background-position: -256px 0px;
background-position: -250px 0px;
}
.playlist-detail .detail-head-title .link:hover {
background-position: -256px -36px;
background-position: -250px -36px;
}
.playlist-detail .detail-head-title .edit {
display: inline-block;
text-indent: -9999px;
width: 36px;
height: 36px;
margin-right: 8px;
margin-top: 0;
background: url(../images/player_large.png) no-repeat 0 9999px;
background-position: -288px 0px;
}
.playlist-detail .detail-head-title .edit:hover {
background: url(../images/player_large.png) no-repeat 0 9999px;
background-position: -288px -36px;
}
.playlist-detail .detail-head-title .clone {
display: inline-block;
text-indent: -9999px;
width: 36px;
height: 36px;
margin-right: 8px;
margin-top: 0;
background: url(../images/player_large.png) no-repeat 0 9999px;
background-position: -144px 0px;
}
.playlist-detail .detail-head-title .clone:hover {
background: url(../images/player_large.png) no-repeat 0 9999px;
background-position: -144px -36px;
}
.playlist-detail .detail-head-title .merge {
background-position: -324px 0px;
}
.playlist-detail .detail-head-title .merge:hover {
background-position: -324px -36px;
}
.playlist-detail .detail-head-title .ply:hover {
background-position: -40px -204px;
}
@ -957,6 +971,32 @@ li {
font-size: 17px;
}
.dialog-merge-playlist {
padding-left: 0px;
text-align: left;
}
.dialog-merge-playlist li {
cursor: pointer;
height: 112px;
padding: 6px;
}
.dialog-merge-playlist li:hover {
background-color: #555555;
}
.dialog-merge-playlist li img {
float: left;
height: 100px;
width: 100px;
}
.dialog-merge-playlist li h2{
margin-left: 125px;
font-size: 17px;
}
.dialog-newplaylist input{
margin-bottom: 22px;
}
@ -1040,6 +1080,7 @@ li {
.settings-content {
padding: 20px;
}
.btn-group button,.btn-pagination,.btn-pagination:focus {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -236,6 +236,14 @@
if (dialog_type == 5) {
$scope.dialog_title = '打开歌单';
$scope.dialog_type = 5;
}
if (dialog_type == 6) {
$scope.dialog_title = '歌单导入合并';
var url = '/show_myplaylist';
loWeb.get(url).success(function(data) {
$scope.myplaylist = data.result;
});
$scope.dialog_type = 6;
}
};
@ -312,6 +320,27 @@
});
};
$scope.mergePlaylist = function(target_list_id) {
Notification.info('正在合并导入歌单……');
var url = '/merge_playlist';
loWeb.post({
url: url,
method: 'POST',
data: $httpParamSerializerJQLike({
source: $scope.list_id,
target: target_list_id,
}),
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).success(function() {
Notification.success('合并歌单成功');
$scope.closeDialog();
$scope.popWindow();
$scope.showPlaylist($scope.list_id);
});
};
$scope.removeSongFromPlaylist = function(song, list_id) {
var url = '/remove_track_from_myplaylist';

View File

@ -67,7 +67,7 @@ function($rootScope, $log, $http, $httpParamSerializerJQLike) {
var url = '/playlist?list_id=' + list_id;
return {
success: function(fn) {
provider.get_playlist(url, $http, $httpParamSerializerJQLike).success(function(data){
provider.get_playlist(url, $http, $httpParamSerializerJQLike).success(function(data){
myplaylist.save_myplaylist(data);
fn();
});
@ -142,6 +142,30 @@ function($rootScope, $log, $http, $httpParamSerializerJQLike) {
return fn({'result': result});
}
}
}
if (request.url.search('/merge_playlist') != -1) {
var source = getParameterByName('source', url+'?'+request.data);
var target = getParameterByName('target', url+'?'+request.data);
var tarData = (localStorage.getObject(target)).tracks;
var srcData = (localStorage.getObject(source)).tracks;
var isInSourceList = false;
for(var i in tarData){
isInSourceList = false;
for(var j in srcData){
if(tarData[i].id==srcData[j].id){
isInSourceList = true;
break;
}
};
if(!isInSourceList){
myplaylist.add_myplaylist(source, tarData[i]);
};
};
return {
success: function(fn) {
fn();
}
};
}
},
bootstrapTrack: function(success, failure) {

View File

@ -122,6 +122,13 @@
<button class="btn btn-primary confirm-button" ng-click="openUrl(dialog_url);closeDialog();">打开歌单</button>
<button class="btn btn-default" ng-click="closeDialog()">取消</button>
</div>
<ul ng-show="dialog_type==6" class="dialog-merge-playlist">
<li ng-repeat="playlist in myplaylist track by $index" ng-class-odd="'odd'" ng-class-even="'even'" ng-click="mergePlaylist(playlist.info.id)">
<img ng-src="{{ playlist.info.cover_img_url }}" />
<h2> {{ playlist.info.title }} </h2>
</li>
</ul>
</div>
</div>
@ -322,6 +329,7 @@
<a title="收藏歌单" class="clone" ng-show="playlist_title!='' && !is_mine" ng-click="clonePlaylist(list_id)">收藏</a>
<a title="编辑歌单" class="edit" ng-show="playlist_title!='' && is_mine" ng-click="showDialog(3, {list_id: list_id, playlist_title: playlist_title, cover_img_url: cover_img_url})">编辑</a>
<a title="原始链接" class="link" ng-show="playlist_title!=''" open-url="playlist_source_url">原始链接</a>
<a title="导入合并" class="merge" ng-show="playlist_title!='' && is_mine" ng-click="showDialog(6)">导入合并</a>
</div>
</div>
<ul class="detail-songlist">