Skip to content

Commit

Permalink
Correção do script do AdSense
Browse files Browse the repository at this point in the history
  • Loading branch information
dgadelha committed May 2, 2024
1 parent 8c09de4 commit eda8459
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
11 changes: 10 additions & 1 deletion packages/ide/src/app/tab-editor/tab-editor.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
AfterViewInit,
Component,
ElementRef,
EventEmitter,
Expand Down Expand Up @@ -28,7 +29,7 @@ import { WorkerService } from "../worker.service";
templateUrl: "./tab-editor.component.html",
styleUrls: ["./tab-editor.component.scss"],
})
export class TabEditorComponent implements OnInit, OnDestroy {
export class TabEditorComponent implements OnInit, AfterViewInit, OnDestroy {
private _code$?: Subscription;
private _stdOut$?: Subscription;
private _events$?: Subscription;
Expand Down Expand Up @@ -144,6 +145,14 @@ export class TabEditorComponent implements OnInit, OnDestroy {
console.log(`Runtime has ${PortugolJsRuntime.split("\n").length} lines`);
}

ngAfterViewInit() {
setTimeout(() => {
try {
((window as any).adsbygoogle = (window as any).adsbygoogle || []).push({});
} catch {}
}, 1000);
}

ngOnDestroy() {
this._code$?.unsubscribe();
this._events$?.unsubscribe();
Expand Down
12 changes: 10 additions & 2 deletions packages/ide/src/app/tab-start/tab-start.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, EventEmitter, Output } from "@angular/core";
import { AfterViewInit, Component, EventEmitter, Output } from "@angular/core";
import { MatDialog } from "@angular/material/dialog";
import { DomSanitizer } from "@angular/platform-browser";
import { GoogleAnalyticsService } from "ngx-google-analytics";
Expand All @@ -11,7 +11,7 @@ import { DialogOpenExampleComponent } from "../dialog-open-example/dialog-open-e
templateUrl: "./tab-start.component.html",
styleUrls: ["./tab-start.component.scss"],
})
export class TabStartComponent {
export class TabStartComponent implements AfterViewInit {
@Output() newTab = new EventEmitter();
@Output() help = new EventEmitter();

Expand Down Expand Up @@ -43,6 +43,14 @@ export class TabStartComponent {
}
}

ngAfterViewInit() {
setTimeout(() => {
try {
((window as any).adsbygoogle = (window as any).adsbygoogle || []).push({});
} catch {}
}, 1000);
}

openFile(event: Event) {
this.gaService.event("home_open_file", "Aba Inicial", "Abrir arquivo através da aba Inicial");

Expand Down
1 change: 0 additions & 1 deletion packages/ide/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@
<script>var $buoop = {required:{e:-4,f:-3,o:-3,s:-1,c:-3},insecure:true,unsupported:true,api:2022.10,text:"O seu navegador, {brow_name}, está numa versão muito antiga e pode não ser suportada pelo Portugol Webstudio.<p><a{up_but}>Atualize o seu navegador</a> caso a página esteja em branco ou atualize a página para esconder este alerta.</p>"};</script>
<script src="https://browser-update.org/update.min.js" async></script>
<script>if(/github\.io/.test(window.location.hostname)){window.location.href="https://portugol.dev"+window.location.pathname}</script>
<script>(adsbygoogle=window.adsbygoogle||[]).push({});</script>
</body>
</html>

0 comments on commit eda8459

Please sign in to comment.