Skip to content

Commit ba6c338

Browse files
committed
Gerador para aplicativos da PlayStore e Refatoração das rotas
1 parent 9134ca5 commit ba6c338

4 files changed

Lines changed: 178 additions & 10 deletions

File tree

index.html

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ <h2 class="subtitle">
3939
<option selected disabled="disabled">Selecione</option>
4040
<option value="1">Filmes/Séries/Episódioss</option>
4141
<option value="2">Jogos</option>
42-
<option disabled="disabled" value="3">Músicas</option>
42+
<option value="3">Aplicativo Android (Play Store)</option>
4343
</select>
4444
</div>
4545
</div>
@@ -55,7 +55,7 @@ <h2 class="subtitle">
5555
<div class="field">
5656
<div class="control">
5757
<input class="input is-primary" id="txtIMDbId" type="text"
58-
placeholder="Exemplo: tt4154664">
58+
placeholder="Exemplo: tt4154664">
5959
</div>
6060
</div>
6161

@@ -74,7 +74,7 @@ <h2 class="subtitle">
7474
<div class="field">
7575
<div class="control">
7676
<input class="input is-primary" id="txtSteamId" type="text"
77-
placeholder="Exemplo: 730">
77+
placeholder="Exemplo: 730">
7878
</div>
7979
</div>
8080

@@ -86,6 +86,25 @@ <h2 class="subtitle">
8686
</div>
8787
</div>
8888

89+
<div class="box" id="divPlayStore" style="display:none">
90+
<div class="field has-addons">
91+
<div class="control is-expanded">
92+
<div class=" is-fullwidth">
93+
<div class="field">
94+
<div class="control">
95+
<input class="input is-primary" id="txtPlayStoreId" type="text"
96+
placeholder="Exemplo: com.chucklefish.stardewvalley">
97+
</div>
98+
</div>
99+
100+
</div>
101+
</div>
102+
<div class="control">
103+
<button type="button" id="btnLoadPlayStore" class="button is-primary">Escolher</button>
104+
</div>
105+
</div>
106+
</div>
107+
89108
</div>
90109

91110
</div>
@@ -100,6 +119,7 @@ <h2 class="subtitle">
100119
<script type="text/javascript" src="js/baseLib.js"></script>
101120
<script type="text/javascript" src="js/geradorFilmeSerieEpisodio.js"></script>
102121
<script type="text/javascript" src="js/geradorJogosSteam.js"></script>
122+
<script type="text/javascript" src="js/geradorAplicativoPlayStore.js"></script>
103123
<script type="text/javascript" src="js/indexView.js"></script>
104124
<script type="text/javascript">
105125
$(window).on('load', function () {

js/geradorAplicativoPlayStore.js

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
var GeradorAplicativoPlayStore = {
2+
3+
GooglePlayId: null,
4+
5+
StaticUrl: {
6+
urlSeparatorImage: "https://i.imgur.com/59YOBMq.png",
7+
urlPlayStoreLogoImage: "https://i.imgur.com/W4czhNc.png"
8+
},
9+
10+
Data: {
11+
GooglePlay: null
12+
},
13+
14+
Validar: function () {
15+
16+
if (this.GooglePlayId.trim().length == 0 || this.GooglePlayId == null) {
17+
bulmaToast.toast({ message: "O código do jogo na GOOGLE PLAY é obrigatório", type: "is-danger", duration: 4000 });
18+
return false;
19+
}
20+
21+
this.Data.GooglePlay = this.GooglePlayService(this.GooglePlayId.trim());
22+
23+
if (this.Data.GooglePlay == null || this.Data.GooglePlay == undefined) {
24+
bulmaToast.toast({ message: "O código do jogo na GOOGLE PLAY informado é inválido!", type: "is-danger", duration: 4000 });
25+
return false;
26+
}
27+
28+
baseLib.copyToClipboard(this.GerarBBCode());
29+
bulmaToast.toast({ message: "BBCode copiado para a área de transferência!", type: "is-success", duration: 4000 });
30+
31+
32+
},
33+
34+
GerarBBCode: function () {
35+
var str = `
36+
${this.InserirSeparador()}
37+
${this.InserirTitulo()}
38+
${this.InserirSeparador()}
39+
${this.InserirCapa()}
40+
${this.InserirSeparador()}
41+
${this.InserirSinopse()}
42+
${this.InserirSeparador()}
43+
${this.InserirInformacao()}
44+
${this.InserirSeparador()}
45+
${this.InserirCritica()}
46+
${this.InserirSeparador()}
47+
${this.InserirScreenshots()}
48+
49+
`;
50+
51+
return str;
52+
53+
},
54+
55+
InserirSeparador: function () {
56+
return `[align=center][img]${this.StaticUrl.urlSeparatorImage}[/img][/align]`;
57+
},
58+
59+
InserirTitulo: function () {
60+
var str = `[b][align=center] ${this.Data.GooglePlay.title} [/align][/b]`;
61+
62+
return str;
63+
},
64+
65+
InserirCapa: function () {
66+
return `[align=center][img]${this.Data.GooglePlay.headerImage}[/img][/align]`;
67+
},
68+
69+
InserirSinopse: function () {
70+
var str = `[b][align=center]SINOPSE[/align][/b]
71+
[align=center]${this.Data.GooglePlay.description}[/align]`;
72+
73+
74+
return str;
75+
},
76+
77+
InserirInformacao: function () {
78+
var str = "";
79+
str += "\n[b][align=center]INFORMAÇÕES[/align][/b]";
80+
str += `\n[align=center]Data de Lançamento: ${this.Data.GooglePlay.released} [/align]`;
81+
str += `\n[align=center]Gêneros: ${this.Data.GooglePlay.genre} [/align]`;
82+
str += `\n[align=center]Desenvolvedores: ${this.Data.GooglePlay.developer} [/align]`;
83+
str += `\n[align=center]Preço (na PlayStore): ${this.Data.GooglePlay.priceText} [/align]`;
84+
if (this.Data.GooglePlay.developerWebsite == null) str += `\n[align=center]Site: [url=${this.Data.GooglePlay.developerWebsite}] Clique aqui [/url][/align]`;
85+
86+
return str;
87+
},
88+
89+
InserirCritica: function () {
90+
var str = "";
91+
92+
str += "\n[b][align=center]CRÍTICA[/align][/b]";
93+
if (this.Data.GooglePlay.scoreText != "") {
94+
str += `\n[align=center][img]${this.StaticUrl.urlPlayStoreLogoImage}[/img][/align]`;
95+
str += `\n[align=center][b][url=${this.Data.GooglePlay.url}]${this.Data.GooglePlay.scoreText}/5[/b][/url][/align]`
96+
} else {
97+
str += `\n[align=center][b]###### SEM CRÍTICA ######[/b][/align]`
98+
}
99+
100+
return str;
101+
},
102+
103+
InserirScreenshots: function () {
104+
var str = "";
105+
str += "\n[b][align=center]SCREENSHOTS[/align][/b]";
106+
107+
this.Data.GooglePlay.screenshots.forEach(element => {
108+
str += `\n[align=center][img] ${element.trim()}[/img][/align]`
109+
});
110+
111+
return str;
112+
},
113+
114+
InserirTrailer: function () {
115+
116+
},
117+
118+
InserirAgradecaComente: function () {
119+
120+
},
121+
122+
123+
GooglePlayService: function () {
124+
var urlRequest = "https://vindicator.com.br/services/googleplay?id=" + this.GooglePlayId;
125+
126+
var result = null;
127+
128+
$.ajax({
129+
url: urlRequest,
130+
async: false,
131+
success: function (data) {
132+
result = data;
133+
console.log(result);
134+
}
135+
});
136+
return result;
137+
},
138+
};

js/geradorJogosSteam.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ var GeradorJogosSteam = {
123123

124124

125125
SteamService: function () {
126-
var urlRequest = "https://vindicator.com.br/steam?id=" + this.SteamId;
126+
var urlRequest = "https://vindicator.com.br/services/steam?id=" + this.SteamId;
127127

128128
var result = null;
129129

js/indexView.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ var indexView = {
1212
case "2":
1313
$('#divJogosSteam').show();
1414
break;
15-
15+
case "3":
16+
$('#divPlayStore').show();
17+
break;
1618
default:
1719
break;
1820
}
@@ -33,14 +35,22 @@ var indexView = {
3335

3436
});
3537

38+
$('#btnLoadPlayStore').click(function () {
39+
40+
GeradorAplicativoPlayStore.GooglePlayId = $('#txtPlayStoreId').val().trim();
41+
GeradorAplicativoPlayStore.Validar();
42+
43+
});
44+
45+
3646
jQuery.ajaxSetup({
37-
beforeSend: function () {
47+
beforeSend: function () {
3848
$('#pageLoader').addClass("is-active");
39-
},
40-
complete: function () {
49+
},
50+
complete: function () {
4151
$('#pageLoader').removeClass("is-active");
42-
},
43-
success: function () { }
52+
},
53+
success: function () { }
4454
});
4555

4656

0 commit comments

Comments
 (0)