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+ } ;
0 commit comments