feat(torrents): add music torrent MTV flag

This commit is contained in:
OldHawk
2017-10-05 02:29:31 +08:00
parent 10f4035420
commit e119f19470
15 changed files with 87 additions and 30 deletions

View File

@@ -17,10 +17,18 @@
function link(scope, element, attrs) {
scope.$watch(attrs.musicDisk, function (s) {
if (s) {
if (s && s.torrent_type === 'music') {
var border_color = '#515151';
if (s.torrent_tags.indexOf('MTV') !== -1) {
var div1 = angular.element('<div>MTV</div>');
div1.addClass('music-badge');
border_color = '#d9534f';
}
var cir1 = angular.element('<div></div>');
cir1.css('border-radius', '50%');
cir1.css('border', 'solid 2px #515151');
cir1.css('border', 'solid 2px ' + border_color);
cir1.css('background-color', '#ddd');
cir1.css('padding', '1px');
cir1.css('cursor', 'pointer');
@@ -47,7 +55,7 @@
var cir4 = angular.element('<div></div>');
cir4.css('border-radius', '50%');
cir4.css('border', 'solid 2px #515151');
cir4.css('border', 'solid 2px ' + border_color);
cir4.css('background-color', '#fff');
cir4.css('height', '100%');
cir4.css('width', '100%');
@@ -57,6 +65,7 @@
cir2.append(cir3);
cir3.append(cir4);
element.parent().append(div1);
element.replaceWith(cir1);
}
});

View File

@@ -164,6 +164,17 @@ body {
background-color: #555;
}
}
.music-badge {
position: absolute;
top: 30px;
right: 20px;
font-size: 20px;
color: #fff;
padding: 0 5px;
background-color: @label-danger-bg;
border: solid 1px #fff;
border-radius: 6px;
}
}
}
@@ -239,6 +250,17 @@ body {
}
}
}
.music-badge {
position: absolute;
top: 50px;
right: 20px;
font-size: 14px;
color: #fff;
padding: 0 5px;
background-color: @label-danger-bg;
border: solid 1px #fff;
border-radius: 4px;
}
}
.torrent-votes {
@@ -531,6 +553,17 @@ body {
/* csslint ignore:end */
}
}
.music-badge {
position: absolute;
top: 35px;
left: 50px;
font-size: 12px;
color: #fff;
padding: 0 4px;
background-color: @label-danger-bg;
border: solid 1px #fff;
border-radius: 3px;
}
}
.se-info {
position: absolute;
@@ -711,6 +744,17 @@ body {
width: 66.66px;
margin: 16.66px 0;
}
.music-badge {
position: absolute;
top: 10px;
right: 10px;
font-size: 12px;
color: #fff;
padding: 0 5px;
background-color: @label-danger-bg;
border: solid 1px #fff;
border-radius: 3px;
}
.media-object {
height: 100px;
width: 66.66px;

View File

@@ -431,7 +431,7 @@
<div class="topone">
<div class="col-md-3">
<div ng-click="vm.openTorrentInfo(vm.musicTopOne._id);">
<img class="img-thumbnail center-block" music-disk="vm.musicTopOne.torrent_type=='music'"
<img class="img-thumbnail center-block" music-disk="vm.musicTopOne"
ng-src="{{vm.TGI.getTorrentTopOneImage(vm.musicTopOne)}}"
alt="{{vm.TGI.getTorrentTitle(vm.musicTopOne)}}" onload="this.style.opacity='1';">
</div>
@@ -483,7 +483,7 @@
<div data-ng-if="$index != 0 && $index % 4 == 0" class="clearfix visible-md-block visible-lg-block"></div>
<div class="col-xs-6 col-sm-3 col-md-3 col-small-padding">
<div class="thumbnail torrent-post-info" ng-click="vm.openTorrentInfo(item._id);">
<img class="img-responsive" music-disk="item.torrent_type=='music'"
<img class="img-responsive" music-disk="item"
ng-src="{{vm.TGI.getTorrentListTopImage(item)}}"
alt="{{vm.TGI.getTorrentTitle(item)}}">
@@ -540,7 +540,7 @@
ng-class="[$index > 0 ? 'hide-big' : 'show-big', $index >= 12 ? 'hide-more' : '']">
<td>
<div class="newest-item-big music-margin" ng-click="vm.openTorrentInfo(nm._id);">
<img class="img-responsive" music-disk="nm.torrent_type=='music'"
<img class="img-responsive" music-disk="nm"
ng-src="{{vm.TGI.getTorrentListTopImage(nm)}}"
alt="{{vm.TGI.getTorrentTitle(nm)}}">

View File

@@ -87,17 +87,20 @@
if (vm.torrentLocalInfo && vm.torrentLocalInfo._replies) {
var hasme = false;
var meitem = null;
if (newValue._replies.length > oldValue._replies.length) {
angular.forEach(newValue._replies, function (n) {
if (oldValue._replies.indexOf(n) < 0) {
if (n.user._id.toString() === vm.user._id) {
hasme = true;
meitem = n;
if(newValue && oldValue) {
if (newValue._replies.length > oldValue._replies.length) {
angular.forEach(newValue._replies, function (n) {
if (oldValue._replies.indexOf(n) < 0) {
if (n.user._id.toString() === vm.user._id) {
hasme = true;
meitem = n;
}
}
}
});
});
}
}
if (hasme) {
var totalPages = vm.commentItemsPerPage < 1 ? 1 : Math.ceil(newValue._replies.length / vm.commentItemsPerPage);
var p = Math.max(totalPages || 0, 1);
@@ -118,9 +121,12 @@
* getTorrentInfo
*/
vm.getTorrentInfo = function () {
vm.torrentLocalInfo = TorrentsService.get({
TorrentsService.get({
torrentId: $stateParams.torrentId
}, function (res) {
vm.torrentLocalInfo = res;
mtDebug.info(vm.torrentLocalInfo);
$('.backdrop').css('backgroundImage', 'url(' + vm.TGI.getTorrentBackdropImage(vm.torrentLocalInfo) + ')');
vm.rating_vote = res.resource_detail_info.vote_average;
@@ -130,8 +136,6 @@
ScrapeService.scrapeTorrent(vm.torrentLocalInfo);
}
});
mtDebug.info(vm.torrentLocalInfo);
};
/**

View File

@@ -159,7 +159,7 @@
<td class="col-md-7 td-text-overflow-admin">
<div class="media">
<div class="media-left">
<img class="media-object" music-disk="{{vm.selectedType=='music'}}"
<img class="media-object" music-disk="item"
ng-src="{{vm.TGI.getTorrentListImage(item)}}"
alt="...">

View File

@@ -6,7 +6,7 @@
<div data-ng-if="$index != 0 && $index % 6 == 0" class="clearfix visible-md-block visible-lg-block"></div>
<div class="col-xs-6 col-sm-4 col-md-2 col-small-padding">
<div class="thumbnail torrent-post-info" ng-click="vm.openTorrentInfo(item._id);">
<img class="img-responsive" music-disk="item.torrent_type=='music'"
<img class="img-responsive" music-disk="item"
ng-src="{{vm.TGI.getTorrentListTopImage(item)}}"
alt="{{vm.TGI.getTorrentTitle(item)}}">
@@ -155,7 +155,7 @@
<td class="col-md-7 td-text-overflow">
<div class="media">
<div class="media-left">
<img class="media-object" music-disk="item.torrent_type=='music'"
<img class="media-object" music-disk="item"
ng-src="{{vm.TGI.getTorrentListImage(item)}}"
alt="...">

View File

@@ -1,10 +1,10 @@
<section ng-controller="TorrentsInfoController as vm" ng-init="vm.getTorrentInfo();">
<div class="backdrop" ng-if="vm.torrentLocalInfo">
<div class="backdrop" ng-show="vm.torrentLocalInfo">
<div class="filter">
<div class="container">
<div class="topone">
<div class="col-md-3 text-center">
<img class="img-thumbnail center-block" music-disk="vm.torrentLocalInfo.torrent_type=='music'"
<img class="img-thumbnail center-block" music-disk="vm.torrentLocalInfo"
ng-src="{{vm.TGI.getTorrentTopOneImage(vm.torrentLocalInfo)}}"
alt="{{vm.TGI.getTorrentTitle(vm.torrentLocalInfo)}}" onload="this.style.opacity='1';">

View File

@@ -34,7 +34,7 @@
<td class="col-md-7 td-text-overflow">
<div class="media">
<div class="media-left">
<img class="media-object" music-disk="{{item.torrent.torrent_type=='music'}}"
<img class="media-object" music-disk="item.torrent"
ng-src="{{vm.TGI.getTorrentListImage(item.torrent)}}"
alt="...">

View File

@@ -33,7 +33,7 @@
<td class="col-md-7 td-text-overflow">
<div class="media">
<div class="media-left">
<img class="media-object" music-disk="{{item.torrent.torrent_type=='music'}}"
<img class="media-object" music-disk="item.torrent"
ng-src="{{vm.TGI.getTorrentListImage(item.torrent)}}"
alt="...">

View File

@@ -29,7 +29,7 @@
<td class="col-md-7 td-text-overflow">
<div class="media">
<div class="media-left">
<img class="media-object" music-disk="{{item.torrent_type=='music'}}"
<img class="media-object" music-disk="item"
ng-src="{{vm.TGI.getTorrentListImage(item)}}"
alt="...">

View File

@@ -31,7 +31,7 @@
<td class="col-md-7 td-text-overflow">
<div class="media">
<div class="media-left">
<img class="media-object" music-disk="{{item.torrent.torrent_type=='music'}}"
<img class="media-object" music-disk="item.torrent"
ng-src="{{vm.TGI.getTorrentListImage(item.torrent)}}"
alt="...">

View File

@@ -49,7 +49,7 @@
<td class="col-md-7 td-text-overflow">
<div class="media">
<div class="media-left">
<img class="media-object" music-disk="{{item.torrent.torrent_type=='music'}}"
<img class="media-object" music-disk="item.torrent"
ng-src="{{vm.TGI.getTorrentListImage(item.torrent)}}"
alt="...">

View File

@@ -49,7 +49,7 @@
<td class="col-md-7 td-text-overflow">
<div class="media">
<div class="media-left">
<img class="media-object" music-disk="{{item.torrent.torrent_type=='music'}}"
<img class="media-object" music-disk="item.torrent"
ng-src="{{vm.TGI.getTorrentListImage(item.torrent)}}"
alt="...">

View File

@@ -46,7 +46,7 @@
<td class="col-md-7 td-text-overflow">
<div class="media">
<div class="media-left">
<img class="media-object" music-disk="{{item.torrent_type=='music'}}"
<img class="media-object" music-disk="item"
ng-src="{{vm.TGI.getTorrentListImage(item)}}"
alt="...">

View File

@@ -41,7 +41,7 @@
<td class="col-md-7 td-text-overflow">
<div class="media">
<div class="media-left">
<img class="media-object" music-disk="{{item.torrent.torrent_type=='music'}}"
<img class="media-object" music-disk="item.torrent"
ng-src="{{vm.TGI.getTorrentListImage(item.torrent)}}"
alt="...">