удаление метатэга на всякий случай
This commit is contained in:
12
src/page.js
12
src/page.js
@ -10,7 +10,7 @@ export default class Page extends Component {
|
|||||||
setDescription(description) {
|
setDescription(description) {
|
||||||
this.setMetaTag('description', description);
|
this.setMetaTag('description', description);
|
||||||
}
|
}
|
||||||
setMetaTag(name, content) {
|
findMetaTag(name) {
|
||||||
const head = document.getElementsByTagName('head')[0];
|
const head = document.getElementsByTagName('head')[0];
|
||||||
const headChilds = head.children;
|
const headChilds = head.children;
|
||||||
let meta;
|
let meta;
|
||||||
@ -20,6 +20,10 @@ export default class Page extends Component {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return {head, meta};
|
||||||
|
}
|
||||||
|
setMetaTag(name, content) {
|
||||||
|
let {head, meta} = this.findMetaTag(name);
|
||||||
if(!meta) {
|
if(!meta) {
|
||||||
meta = document.createElement('meta');
|
meta = document.createElement('meta');
|
||||||
head.appendChild(meta);
|
head.appendChild(meta);
|
||||||
@ -27,4 +31,10 @@ export default class Page extends Component {
|
|||||||
meta.name = name;
|
meta.name = name;
|
||||||
meta.content = content;
|
meta.content = content;
|
||||||
}
|
}
|
||||||
|
removeMetaTag(name) {
|
||||||
|
let {head, meta} = this.findMetaTag(name);
|
||||||
|
if(meta) {
|
||||||
|
head.removeChild(meta);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,6 +213,9 @@ export default class TorrentPage extends Page {
|
|||||||
window.torrentSocket.off('filesReady', this.filesUpdated);
|
window.torrentSocket.off('filesReady', this.filesUpdated);
|
||||||
if(this.trackerUpdate)
|
if(this.trackerUpdate)
|
||||||
window.torrentSocket.off('trackerTorrentUpdate', this.trackerUpdate);
|
window.torrentSocket.off('trackerTorrentUpdate', this.trackerUpdate);
|
||||||
|
if(this.torrent && this.torrent.contentCategory == 'xxx') {
|
||||||
|
this.removeMetaTag('robots');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
vote(good) {
|
vote(good) {
|
||||||
if(!this.torrent)
|
if(!this.torrent)
|
||||||
|
Reference in New Issue
Block a user