Skip to content

Commit

Permalink
Updated map's js script
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfteam committed Jul 10, 2022
1 parent 7e83faf commit cab3561
Showing 1 changed file with 41 additions and 26 deletions.
67 changes: 41 additions & 26 deletions lib/presentation/map/map_page.dart
Expand Up @@ -7,7 +7,7 @@ import 'package:shiori/presentation/shared/loading.dart';

const _script = '''
let wasRemoved = false;
function removeAds(){
function removeAdsFromOfficialMap(){
console.log("Removing ads..");
let topNav = document.getElementById("topnav");
if (topNav) {
Expand Down Expand Up @@ -45,41 +45,56 @@ const _script = '''
}
}
function removeAds2() {
const ad1 = document.getElementsByClassName('MapLayout_BottomAd');
if (ad1.length > 0)
ad1[0].remove();
function removeAdsFromUnofficialMap() {
try {
const ad1 = document.getElementsByClassName('MapLayout_BottomAd');
if (ad1.length > 0)
ad1[0].remove();
const ad2 = document.getElementsByClassName('MapLayout_BottomMobiAd');
if (ad2.length > 0)
ad2[0].remove();
const appbars = document.getElementsByClassName('MuiAppBar-root');
if (appbars.length > 1)
appbars[1].remove();
const buttons = document.getElementsByClassName('MuiTab-root');
if (buttons.length > 0) {
buttons[2].remove();
buttons[1].remove();
}
const ad2 = document.getElementsByClassName('MapLayout_BottomMobiAd');
if (ad2.length > 0)
ad2[0].remove();
const extraButtons = document.getElementsByClassName('TopNav');
if (extraButtons.length > 0) {
for (var i = 0; i < extraButtons.length; i++){
extraButtons[i].remove();
}
}
const appbars = document.getElementsByClassName('MuiAppBar-root');
if (appbars.length > 0)
appbars[0].remove();
const buttons = document.getElementsByClassName('MuiTab-root');
if (buttons.length > 0) {
buttons[2].remove();
buttons[1].remove();
const hrs = document.getElementsByClassName("mt-4");
if (hrs.length > 0) {
const hr = hrs[0];
const parent = hr.parentElement;
for (var i = 0; i < 3; i++) {
parent.lastElementChild.remove();
}
hr.remove();
}
}
const extraButtons = document.getElementsByClassName('TopNav');
if (extraButtons.length > 0) {
extraButtons[0].remove();
extraButtons[1].remove();
catch(_){
}
}
function removeAds() {
removeAdsFromOfficialMap();
removeAdsFromUnofficialMap();
}
setTimeout(removeAds, 500);
setTimeout(removeAds, 1000);
setTimeout(removeAds, 2000);
setTimeout(removeAds, 3500);
setTimeout(removeAds2, 500);
setTimeout(removeAds2, 1000);
setTimeout(removeAds2, 2000);
setTimeout(removeAds2, 3500);
''';

class MapPage extends StatelessWidget {
Expand Down

0 comments on commit cab3561

Please sign in to comment.