удаление метатэга на всякий случай

This commit is contained in:
Alexey Kasyanchuk
2017-01-31 07:49:54 +03:00
parent 2160d9d00f
commit 513b38b730
2 changed files with 14 additions and 1 deletions

View File

@ -10,7 +10,7 @@ export default class Page extends Component {
setDescription(description) {
this.setMetaTag('description', description);
}
setMetaTag(name, content) {
findMetaTag(name) {
const head = document.getElementsByTagName('head')[0];
const headChilds = head.children;
let meta;
@ -20,6 +20,10 @@ export default class Page extends Component {
break;
}
}
return {head, meta};
}
setMetaTag(name, content) {
let {head, meta} = this.findMetaTag(name);
if(!meta) {
meta = document.createElement('meta');
head.appendChild(meta);
@ -27,4 +31,10 @@ export default class Page extends Component {
meta.name = name;
meta.content = content;
}
removeMetaTag(name) {
let {head, meta} = this.findMetaTag(name);
if(meta) {
head.removeChild(meta);
}
}
}

View File

@ -213,6 +213,9 @@ export default class TorrentPage extends Page {
window.torrentSocket.off('filesReady', this.filesUpdated);
if(this.trackerUpdate)
window.torrentSocket.off('trackerTorrentUpdate', this.trackerUpdate);
if(this.torrent && this.torrent.contentCategory == 'xxx') {
this.removeMetaTag('robots');
}
}
vote(good) {
if(!this.torrent)