[IGNBridge] Removed Ugly Nonworking Widgets (#1413)
This commit is contained in:
parent
a00e75b71c
commit
00dbde2c24
1 changed files with 22 additions and 12 deletions
|
@ -19,6 +19,27 @@ class IGNBridge extends FeedExpander {
|
||||||
// $articlePage gets the entire page's contents
|
// $articlePage gets the entire page's contents
|
||||||
$articlePage = getSimpleHTMLDOM($newsItem->link);
|
$articlePage = getSimpleHTMLDOM($newsItem->link);
|
||||||
|
|
||||||
|
// List of BS elements
|
||||||
|
$uselessElements = array(
|
||||||
|
'.wiki-page-tools',
|
||||||
|
'.feedback-container',
|
||||||
|
'.paging-container',
|
||||||
|
'.dropdown-wrapper',
|
||||||
|
'.mw-editsection',
|
||||||
|
'.jsx-4115608983',
|
||||||
|
'.jsx-4213937408',
|
||||||
|
'.commerce-container',
|
||||||
|
'.widget-container',
|
||||||
|
'.newsletter-signup-button'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Remove useless elements
|
||||||
|
foreach($uselessElements as $uslElement) {
|
||||||
|
foreach($articlePage->find($uslElement) as $jsWidget) {
|
||||||
|
$jsWidget->remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NOTE: Though articles and wiki/howtos have seperate styles of pages, there is no mechanism
|
* NOTE: Though articles and wiki/howtos have seperate styles of pages, there is no mechanism
|
||||||
* for handling them seperately as it just ignores the DOM querys which it does not find.
|
* for handling them seperately as it just ignores the DOM querys which it does not find.
|
||||||
|
@ -33,19 +54,8 @@ class IGNBridge extends FeedExpander {
|
||||||
}
|
}
|
||||||
|
|
||||||
// For Wikis and HowTos
|
// For Wikis and HowTos
|
||||||
$uselessWikiElements = array(
|
|
||||||
'.wiki-page-tools',
|
|
||||||
'.feedback-container',
|
|
||||||
'.paging-container'
|
|
||||||
);
|
|
||||||
foreach($articlePage->find('.wiki-page') as $wikiContents) {
|
foreach($articlePage->find('.wiki-page') as $wikiContents) {
|
||||||
$copy = clone $wikiContents;
|
$article = $article . $wikiContents;
|
||||||
// Remove useless elements present in IGN wiki/howtos
|
|
||||||
foreach($uselessWikiElements as $uslElement) {
|
|
||||||
$toRemove = $wikiContents->find($uslElement, 0);
|
|
||||||
$copy = str_replace($toRemove, '', $copy);
|
|
||||||
}
|
|
||||||
$article = $article . $copy;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add content to feed
|
// Add content to feed
|
||||||
|
|
Loading…
Reference in a new issue