mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-01-26 00:59:19 +01:00
feat(torrents): new directive for torrent overview picture reorganize
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
function torrentImageList($sce, $parse, $compile, $timeout) {
|
||||
var directive = {
|
||||
restrict: 'A',
|
||||
replace: true,
|
||||
priority: 10,
|
||||
link: link
|
||||
};
|
||||
@@ -18,15 +17,36 @@
|
||||
|
||||
function link(scope, element, attrs) {
|
||||
scope.$watch(attrs.torrentImageList, function (til) {
|
||||
if (til) {
|
||||
console.log(element[0]);
|
||||
hideImage();
|
||||
|
||||
var targetNode = document.getElementById(attrs.torrentImageList);
|
||||
|
||||
var config = {childList: true};
|
||||
|
||||
var callback = function (mutationsList) {
|
||||
for (var mutation of mutationsList) {
|
||||
if (mutation.type === 'childList') {
|
||||
hideImage();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var observer = new MutationObserver(callback);
|
||||
observer.observe(targetNode, config);
|
||||
|
||||
//observer.disconnect();
|
||||
|
||||
function hideImage() {
|
||||
var imgs = element[0].querySelectorAll('img:not(.emoji)');
|
||||
console.log(imgs);
|
||||
angular.forEach(imgs, function (i) {
|
||||
if (i.previousSibling && i.previousSibling.tagName.toUpperCase() === 'BR') {
|
||||
i.previousSibling.remove();
|
||||
}
|
||||
if (i.parentElement.childElementCount === 1) {
|
||||
angular.element(i.parentElement).css('display', 'none');
|
||||
angular.element(i.parentElement).remove();
|
||||
} else {
|
||||
angular.element(i).css('display', 'none');
|
||||
angular.element(i).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -182,9 +182,10 @@
|
||||
{{vm.TGI.getTorrentOverview(vm.torrentLocalInfo)}}
|
||||
</div>
|
||||
<div ng-if="vm.torrentLocalInfo.torrent_type!='movie' && vm.torrentLocalInfo.torrent_type!='tvserial'">
|
||||
<div id="{{vm.torrentLocalInfo._id}}" data-provide="markdown"
|
||||
ng-bind-html="vm.getOverviewMarkedContent(vm.TGI.getTorrentOverview(vm.torrentLocalInfo))"
|
||||
torrent-image-list="vm.torrentLocalInfo">
|
||||
<div id="til_{{vm.torrentLocalInfo._id}}" torrent-image-list="til_{{vm.torrentLocalInfo._id}}">
|
||||
<div id="{{vm.torrentLocalInfo._id}}" data-provide="markdown"
|
||||
ng-bind-html="vm.getOverviewMarkedContent(vm.TGI.getTorrentOverview(vm.torrentLocalInfo))">
|
||||
</div>
|
||||
</div>
|
||||
<div class="edit-overview-div" ng-if="vm.isOwner(vm.torrentLocalInfo) || vm.user.isOper">
|
||||
<a href="#" ng-click="vm.beginEditOverview(vm.torrentLocalInfo)">{{'EDIT_THIS_OVERVIEW' | translate}}</a>
|
||||
@@ -344,7 +345,8 @@
|
||||
</div>
|
||||
<div class="timeline-comment-body">
|
||||
<textarea id="commentContent" name="commentContent" ng-model="vm.new_comment_content"
|
||||
mt-markdown-editor="commentContent" maxlength="{{vm.inputLengthConfig.torrentCommentLength}}"></textarea>
|
||||
mt-markdown-editor="commentContent"
|
||||
maxlength="{{vm.inputLengthConfig.torrentCommentLength}}"></textarea>
|
||||
|
||||
<div class="row margin-top-10">
|
||||
<div class="col-sm-6" style="display: table;">
|
||||
|
||||
Reference in New Issue
Block a user