diff --git a/website/ads.txt b/website/ads.txt new file mode 100644 index 000000000..0a7f85be0 --- /dev/null +++ b/website/ads.txt @@ -0,0 +1 @@ +google.com, pub-6535472412829264, DIRECT, f08c47fec0942fa0 diff --git a/website/apple-touch-icon.png b/website/apple-touch-icon.png new file mode 100644 index 000000000..bfff1b75c Binary files /dev/null and b/website/apple-touch-icon.png differ diff --git a/website/autodownload.php b/website/autodownload.php new file mode 100644 index 000000000..e9522844e --- /dev/null +++ b/website/autodownload.php @@ -0,0 +1,29 @@ + + + +
+ +

+ Now downloading a pretty cool pokemon simulator... at least I think it's cool... (click if you're having trouble) + +

+ diff --git a/website/cms/.npmrc b/website/cms/.npmrc new file mode 100644 index 000000000..43c97e719 --- /dev/null +++ b/website/cms/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/website/cms/build b/website/cms/build new file mode 100755 index 000000000..6268befd9 --- /dev/null +++ b/website/cms/build @@ -0,0 +1,45 @@ +#!/usr/bin/env node +'use strict'; + +const fs = require('fs'); +const showdown = require('showdown'); +const converter = new showdown.Converter({ + tables: true, + simpleLineBreaks: true, + requireSpaceBeforeHeadingText: true, + simplifiedAutoLink: true, + literalMidWordUnderscores: true, + literalMidWordAsterisks: true, + openLinksInNewWindow: true, +}); + +process.chdir(__dirname); + +const files = fs.readdirSync('../pages/'); +const template = '' + fs.readFileSync('template.html'); + +for (const file of files) { + if (!file.endsWith('.md')) continue; + if (/[A-Z]/.test(file)) continue; + let buf = '' + fs.readFileSync('../pages/' + file); + const name = file.slice(0, -3); + const nlIndex = buf.indexOf('\n'); + const title = buf.slice(2, nlIndex); + const secondHashIndex = buf.indexOf('\n# '); + if (secondHashIndex > 0 && buf.slice(nlIndex, secondHashIndex).trim() === '') { + buf = buf.slice(secondHashIndex + 1); + } + buf = converter.makeHtml(buf); + buf = buf.replace(/`, ``); + // showdown doesn't do this automatically + buf = buf.replace(/é/g, 'é'); + + fs.writeFileSync('../.pages-cached/' + name + '.html', buf); +} + +console.log("Done."); diff --git a/website/cms/package.json b/website/cms/package.json new file mode 100644 index 000000000..905b3c266 --- /dev/null +++ b/website/cms/package.json @@ -0,0 +1,9 @@ +{ + "name": "cms", + "private": true, + "version": "0.0.1", + "description": "CMS for Pokemon Showdown pages", + "dependencies": { + "showdown": "^1.9.0" + } +} diff --git a/website/cms/template.html b/website/cms/template.html new file mode 100644 index 000000000..81bbf47f3 --- /dev/null +++ b/website/cms/template.html @@ -0,0 +1,44 @@ + + + +{title} - Pokémon Showdown! + + + + + + +
+
+
+ {content} +
+ +
diff --git a/website/credits.php b/website/credits.php new file mode 100644 index 000000000..d32426d7a --- /dev/null +++ b/website/credits.php @@ -0,0 +1,107 @@ + +
+

Credits

+ +

Owner

+ + + +

Staff

+ + + +

Retired Staff

+ + + +

Major Contributors

+ + + +

Contributors

+ + + +

Sponsor

+ + + +

Special Thanks

+ + + +
+ diff --git a/website/favicon.ico b/website/favicon.ico new file mode 100644 index 000000000..34b1536b1 Binary files /dev/null and b/website/favicon.ico differ diff --git a/website/index.php b/website/index.php new file mode 100644 index 000000000..a32292efe --- /dev/null +++ b/website/index.php @@ -0,0 +1,396 @@ +query("SELECT `serverid`, `date`, `usercount` FROM `ntbb_userstats`"); + $usercount = array(); + $timenow = time(); + while ($row = $psdb->fetch_assoc($query)) { + if (($timenow - $row['date'] / 1000 > 60 * 30) && ($row['serverid'] !== 'showdown')) { + $usercount[$row['serverid']] = false; // inactive server + } else { + $usercount[$row['serverid']] = $row['usercount']; + } + } + $sortorder = 0; + foreach ($PokemonServers as &$server) { + $server['sortorder'] = $sortorder++; + if ($server['id'] === 'showdown') { + $server['uri'] = $externProtocol . '//play.pokemonshowdown.com'; + } else { + $server['uri'] = 'http://' . $server['id'] . '.psim.us'; + } + } + uasort($PokemonServers, 'servercmp'); + ob_start(); + $more = false; + foreach ($PokemonServers as &$server) { + if (!empty($server['hidden'])) continue; + if (!isset($usercount[$server['id']])) continue; + if (($c = $usercount[$server['id']]) === false) continue; + $usersbit = "
$c user" . ((intval($c) !== 1) ? 's' : '') . " online"; + if (!$c && !$more && $server['id'] !== 'showdown') { + echo '