@@ -18,7 +18,13 @@ var baseLib = {
1818 urlLogoRottenTomatoesImage : "https://i.postimg.cc/rppL76qC/rotten.png" ,
1919 urlLogoGooglePlayStoreImage : "https://i.postimg.cc/pLRvYh7S/google.png" ,
2020
21- urlBaseTMDbPoster : "https://image.tmdb.org/t/p/w600_and_h900_bestv2/"
21+ urlBaseTMDbPoster : "https://image.tmdb.org/t/p/w600_and_h900_bestv2" ,
22+
23+ urlServiceSteam : "https://staging.vindicator.com.br/steam?id=" ,
24+ urlServiceOMDb : "https://www.omdbapi.com/?i=" ,
25+ urlServiceTMDb : "https://api.themoviedb.org/3/find/" ,
26+ urlServicePlayStore : "https://staging.vindicator.com.br/googleplay?id=" ,
27+ urlServiceLastFM : "https://staging.vindicator.com.br/lastfm?id=" ,
2228 } ,
2329
2430 copyToClipboard : function ( str ) {
@@ -57,20 +63,20 @@ var baseLib = {
5763 }
5864 } ,
5965
60- parseHtmlToBBCode : function ( html ) {
61-
66+ parseHtmlToBBCode : function ( html ) {
67+
6268 html = html . replace ( / < p r e ( .* ?) > ( .* ?) < \/ p r e > / gmi, "$2" ) ;
6369
6470 html = html . replace ( / < h [ 1 - 7 ] ( .* ?) > ( .* ?) < \/ h [ 1 - 7 ] > / , "\n$2\n" ) ;
65-
71+
6672 //paragraph handling:
6773 //- if a paragraph opens on the same line as another one closes, insert an extra blank line
6874 //- opening tag becomes two line breaks
6975 //- closing tags are just removed
7076 // html += html.replace(/<\/p><p/<\/p>\n<p/gi;
7177 // html += html.replace(/<p[^>]*>/\n\n/gi;
7278 // html += html.replace(/<\/p>//gi;
73-
79+
7480 html = html . replace ( / < b r ( .* ?) > / gi, "\n" ) ;
7581 html = html . replace ( / < t e x t a r e a ( .* ?) > ( .* ?) < \/ t e x t a r e a > / gmi, "\$2" ) ;
7682 html = html . replace ( / < b > / gi, "[b]" ) ;
@@ -95,30 +101,50 @@ var baseLib = {
95101 html = html . replace ( / < \/ d i v > / gi, "\n" ) ;
96102 html = html . replace ( / < t d ( .* ?) > / gi, " " ) ;
97103 html = html . replace ( / < t r ( .* ?) > / gi, "\n" ) ;
98-
104+
99105 html = html . replace ( / < i m g ( .* ?) s r c = " ( .* ?) " ( .* ?) > / gi, "[img]$2[/img]" ) ;
100106 html = html . replace ( / < a ( .* ?) h r e f = " ( .* ?) " ( .* ?) > ( .* ?) < \/ a > / gi, "[url=$2]$4[/url]" ) ;
101-
107+
102108 html = html . replace ( / < h e a d > ( .* ?) < \/ h e a d > / gmi, "" ) ;
103109 html = html . replace ( / < o b j e c t > ( .* ?) < \/ o b j e c t > / gmi, "" ) ;
104110 html = html . replace ( / < s c r i p t ( .* ?) > ( .* ?) < \/ s c r i p t > / gmi, "" ) ;
105111 html = html . replace ( / < s t y l e ( .* ?) > ( .* ?) < \/ s t y l e > / gmi, "" ) ;
106112 html = html . replace ( / < t i t l e > ( .* ?) < \/ t i t l e > / gmi, "" ) ;
107113 html = html . replace ( / < ! - - ( .* ?) - - > / gmi, "\n" ) ;
108-
114+
109115 html = html . replace ( / \/ \/ / gi, "/" ) ;
110116 html = html . replace ( / h t t p : \/ / gi, "http://" ) ;
111-
117+
112118 html = html . replace ( / < (?: [ ^ > ' " ] * | ( [ ' " ] ) .* ?\1) * > / gmi, "" ) ;
113- html = html . replace ( / \r \r / gi, "" ) ;
119+ html = html . replace ( / \r \r / gi, "" ) ;
114120 html = html . replace ( / \[ i m g ] \/ / gi, "[img]" ) ;
115121 html = html . replace ( / \[ u r l = \/ / gi, "[url=" ) ;
116-
122+
117123 html = html . replace ( / ( \S ) \n / gi, "$1 " ) ;
118-
124+
119125 return html ;
126+ } ,
127+
128+ //https://stackoverflow.com/questions/3733227/javascript-seconds-to-minutes-and-seconds
129+ fancyTimeFormat : function ( time ) {
130+ // Hours, minutes and seconds
131+ var hrs = ~ ~ ( time / 3600 ) ;
132+ var mins = ~ ~ ( ( time % 3600 ) / 60 ) ;
133+ var secs = ~ ~ time % 60 ;
134+
135+ // Output like "1:01" or "4:03:59" or "123:03:59"
136+ var ret = "" ;
137+
138+ if ( hrs > 0 ) {
139+ ret += "" + hrs + ":" + ( mins < 10 ? "0" : "" ) ;
140+ }
141+
142+ ret += "" + mins + ":" + ( secs < 10 ? "0" : "" ) ;
143+ ret += "" + secs ;
144+ return ret ;
120145 }
121146
122147
123148
149+
124150} ;
0 commit comments