Commit Graph

77 Commits

Author SHA1 Message Date
Guangcong Luo
7fc87cad1c Build data/text.js from server
text.js is no longer maintained in the client repo; it's now built
directly from the server's data/text/ directory.
2020-10-27 17:09:49 +00:00
Guangcong Luo
57d239c128
Use <script nomodule> for polyfills (#1549)
This should make PS marginally slower on really old browsers,
marginally faster on modern browsers, neither of which should be
remotely noticeable.

The intended actual impact is to make it easier to maintain
(`battle-dex` is clearly the wrong place for polyfills) and easier
to reuse outside of PS.
2020-07-23 13:19:12 -07:00
Guangcong Luo
c1135497e0
Remove SoundManager dependency (#1563)
All sound stuff is now handled directly by BattleSound, using the
HTML5 audio API.

The main complicated thing we do with sound is loop music with an intro.
This is unfortunately not supported by ANY sound library out there
(I had to manually add support for it myself to soundManager!)

https://github.com/scottschiller/SoundManager2/pull/13

In the end, I don't think the existing libraries out there actually
give us anything I care about.
2020-07-23 12:51:47 -07:00
Annika
367ed82e56
Support configurable URLs (#1543) 2020-07-21 15:27:21 -07:00
Guangcong Luo
de7b91fe09
Use DexSearch for the teambuilder search engine (#1503)
This will prevent us from needing to maintain two search engines in
the future.

The new DexSearch doesn't have too much in the way of new features so
far, but it does show filtered things in categories, and list illegal
results in-filter even after sorting.

These are really minor differences, though; the main thing is just that
its architecture should make it much easier to maintain, and in
particular, to add more filters.
2020-05-05 20:36:10 -07:00
Guangcong Luo
a176317913 Refactor CSS, add CSS guide
`style/STYLING.html` is now a guide of generic CSS classes that can be
used by bots and chat plugins.

CSS classes that can be used by bots and chat plugins are now in a new
`battle-log.css` (previously just a section of `battle.css`)

Several PS styling patterns (specifically, `message-log`, `option`, and
`blocklink`) have been refactored into CSS classes, so that they can
be used by bots and chat plugins (why yes, I do plan on using 2/3 of
them in the log viewer).

Past CSS has been super messy. This refactor tries to make it neater
by adhering to these rules:

- Instead of trying to use e.g. `.setmenu button` selectors (to save
  `class=` on every individual list item), give up and just put
  `.option` directly on list items. This drastically cuts down on all
  the hacks necessary to have `.button` work inside `.setmenu`.

...That's it. That's the only change. It massively cuts down on CSS
complexity. It does slightly complicate the DOM, which I'm not a _huge_
fan of, but CSS unpredictability is nearly impossible to catch and
debug, so it's massively worth it.
2020-03-15 22:49:36 -07:00
Kirk Scheibelhut
6b3820f523
Backport the Preact testclient's login method (#1471) 2020-03-07 20:45:25 -08:00
Ben Davies
e3fcaa492c
Properly set the encoding to UTF-8 on all HTML pages (#1467)
This adds the BOM to all HTTP pages as per the HTML5 spec and ensures
all pages use UTF-8 as their meta charset (which is still kept for
compatibility with older browsers).
2020-02-23 00:13:56 -08:00
Ben Davies
29bab1bfdf Fix SockJS when using the desktop client (#1360)
* Patch SockJS v1.4.0 to work with nw.js

* Document how to upgrade SockJS in UPGRADING-SOCKJS.md
2019-09-04 14:54:03 -05:00
Ben Davies
02eaeecf46 Implement connection timeouts (#1358)
* Use SockJS' timeout config option

This sets timeouts on connections to 5 minutes, matching the server's
heartbeat interval to close sockets that shouldn't be open anymore.

* Update SockJS client to v1.4.0

This fixes an issue where SockJS would parse the entire HTTP response
received as JSON, not the response's body alone.
2019-09-03 21:31:24 -05:00
Guangcong Luo
fbaceafac1 Implement Rooms room 2019-03-21 20:16:01 +09:00
Guangcong Luo
5c983df6d3 Massively improve tooltips
- Tooltips work in replays now
- Calculation is better (correctly handles more corner cases)
- Explanations are better (better messages for Magic Room etc)
- Tooltips for sidebar pokemon
- Support "locking" tooltips with long-click / long-tap
- Can copy/paste from locked tooltips
- Increased font size
2019-02-18 22:38:13 -06:00
Guangcong Luo
a0aac91aac Fix testclient.html for latest Chrome
Unfortunately, the `loadRemoteData` trick we used to load data no
longer works. The new trick is to load asynchronously, and defer
initialization to `onload`.
2018-11-20 01:53:04 -06:00
Guangcong Luo
9019543dc1 Don't build graphics.js by default
graphics.js will still be built by `./build full`, and once it already
exists, `./build` will rebuild it when it's modified.

Fixes #1150
2018-10-16 03:26:51 -05:00
Guangcong Luo
b6dcc4da35 Remove jQuery-JSON dependency
We now just use JSON.parse and JSON.stringify - it's supported by all
browsers supported by the client.

Tools.safeJSON has also been moved to Storage.safeJSON, since it's not
used in replays at all.
2018-10-14 22:07:55 -05:00
Guangcong Luo
c590a0c370 Add new BattleScene animation engine
battle.js is probably PS's oldest code. It's received minor touch-ups:
a refactor to prototypes early on, and then a refactor to TypeScript
and classes recently, but otherwise it's had basically zero maintenance
until now.

That's probably why this refactor took me over a week.

The biggest change is that the animation engine strewn around
Pokemon, Side, and Battle has been broken out into a new class named
BattleScene.

Pokemon, Side, and Battle now only track state; all animation is now
done in BattleScene and PokemonSprite.

The fates of major classes:

battle.ts:Pokemon - animation has been moved, mostly to PokemonSprite
battle.ts:Side - animation has been moved, to PokemonSprite/BattleScene
battle.ts:Battle - animation has been moved, mostly to BattleScene

Major changes:

- Many many variables have been renamed to be much clearer about what
  they mean. For instance, `animationDelay` is now `timeOffset`, and
  `activityDelay` is now `minWait`. A few bugs relating to me mixing
  up these two variables have also been fixed. jQuery variables named
  like `fooElem` have been renamed like `$foo`.

- The unnecessarily complicated queue1/queue2/activeQueue system,
  previously used for telling the animation engine to stop after Pause
  was pressed, has been replaced with a simple `interruptionCount`
  counter.

- The entire scene can now be reconstructed from scratch, which means
  that the `fastForward` system no longer needs to touch the DOM
  outside of the battle log. "Prev turn" and "Skip to turn" should be
  faster in 1000-turn battles now.

- The animation engine now supports displaying weather and terrain
  simultaneously.

- During a replay, Team Preview is shown for a second (instead of
  immediately skipping to the battle).

- Various aspects of the animation engine should be much less brittle
  now.

- Many bugs were fixed (and new ones were introduced).
2018-06-07 02:22:36 -07:00
Guangcong Luo
c11f8bc356 Remove jQuery Slider from testclient.html 2018-02-21 23:37:59 +09:00
Dickson Tan
2afcc32807 Accessibility improvements to the battle UI (#956)
* Enable screen readers to automatically read incoming battle log text

* Mark sections of the battle UI with landmarks for quicker navigation with screen readers

* Allow tooltips on elements that participate in sequential keyboard navigation to have their tooltips automatically read out by screen readers when they gain focus
2017-06-26 00:21:58 -07:00
Felix Rilling
cde8151838 Update Backbone and lodash #906 (#907) 2017-04-24 22:02:17 -07:00
asgdf
df1aa4357b Fix config file path in testclient (#882)
Also fix possible reference error when config failed to load
2017-03-14 14:45:46 -05:00
Ivo Julca
8918aa2aab Test client: add fallback if local data is unavailable 2016-03-04 19:20:25 -05:00
Guangcong Luo
78334b7a15 Split off client-topbar.js from client.js
client.js is still kind of huge, but oh well. Progress!
2016-01-18 01:42:30 -08:00
Harshvardhan
311acb8fcd Added support for all power-boosting items
Removed redundancy from code

Moved to tooltips file

Reduced code

Reduced code

Reduced code

Reduced globals to 1

Minor error corrections
2015-12-27 21:21:26 +05:30
Guangcong Luo
04a27253e3 Teambuilder: Properly support gen 1-2 learnsets
This also adds a cached learnset format to teambuilder-tables.js,
which replaces and is slightly smaller than learnsets.js and also
has slightly better performance.
2015-12-24 11:33:25 -05:00
Guangcong Luo
a76b0b95ef Build: Minify pokedex.js + formats-data.js, moves.js
The client-relevant parts of formats-data.js have been combined into
pokedex.js. pokedex.js and moves.js are now minified on the client.
2015-12-22 12:11:40 -05:00
Guangcong Luo
7fa72c1d20 Convert teambuilder from utilichart.js to search.js
The teambuilder is now running on search.js! Not all new features I'd
like to be in are in, but we've now reached feature parity, and most
of the bugs I found during testing have been fixed.

New in search.js is on-demand DOM loading, which basically means
much faster performance because instead of trying to load every single
row of e.g. the pokemon list at once, we just load the part that's
visible, and load the rest only when you scroll it into view.

Also new in search.js is a dexsearch-like feature, replacing the old
details-search system. The new filter system is simpler and more powerful
and has the same API as /dexsearch, although not all the more advanced
dexsearch features are supported.

On-demand DOM loading makes teambuilder loading pretty much completely
instantaneous. There are other small differences in how selection of
pokemon/items/abilities/moves works, but it should overall make more
sense.
2015-12-22 00:06:27 -06:00
Guangcong Luo
72ff236cef Hardcode logo img dimensions
Very minor optimization to layout performance, but I'll take it.
2015-12-12 23:04:29 -05:00
Guangcong Luo
211da6e8b1 Major update to background storage and menu colors
When loading a background, we use Color Thief to get a six-color
palette from the image, for use on the main menu buttons.

Only hue and lightness are extracted.

https://github.com/lokesh/color-thief/

Backgrounds are now stored in localStorage in the current origin,
rather than the prefs origin. This allows faster loading, as well
as different backgrounds for different origins, which other
servers should like since it means their backgrounds get seen
at least once before possibly being replaced.

Special thanks to Joim for the base code.
2015-12-12 04:01:00 -06:00
Guangcong Luo
294efc0f4b Stop using the outdated news iframe in testclient 2015-09-25 02:47:06 -05:00
Guangcong Luo
bdcbded0bb Update Font Awesome to 4.4.0
Font Awesome 3 -> 4 was a backwards-incompatible change, so this
update is pretty invasive. I tested everything we use it for and it
still works, though. Including supporting both Font Awesome versions
in battle.js.
2015-09-25 02:46:34 -05:00
Bär Halberkamp
e912b73ac7 Fix the HTML sanitizer in testclient.html 2015-09-25 00:18:24 +02:00
urkerab
a1c674851a Make it possible to minimise the Latest News box 2015-09-09 12:33:09 +01:00
urkerab
84f116be53 Allow non-HTML5 based fragments in the test client 2015-08-18 12:18:17 +01:00
Guangcong Luo
a6e56e969a Update jQuery to 2.1.4 2015-06-28 00:50:16 -04:00
Bryan AA
7c600fdf7c Escape é in "Pokémon"
- Add "&eacute;" Instead of "é".
2015-06-20 14:03:25 -06:00
kubetz
f467808606 Remove crossdomain issues on load for testclient over https 2015-06-08 17:56:50 +00:00
kubetz
b77ab203a1 port is now converted into integer when custom server is used 2015-06-06 18:14:03 +00:00
Konrad Borowski
22502eb07e Disable Chrome Frame
Chrome Frame is not supported for two years, which means removing
support for it on Pokémon Showdown should be safe.
2015-05-19 20:08:45 +02:00
Morfent
d2bc6dd260 Update jQuery to version 2.1.3 2015-02-06 05:07:58 -04:00
Guangcong Luo
a39c1078c4 Update links to jQuery and SockJS 2014-03-26 12:31:28 -05:00
小太
ef69e954c2 Rename client-tournament.js to client-chat-tournament.js 2013-12-09 16:16:11 +11:00
小太
4d03e4d393 Merge remote-tracking branch 'upstream/master' into tournaments 2013-11-11 18:38:16 +11:00
Guangcong Luo
83626ee935 New gen-6-only learnsets file
The client doesn't actually need a full learnset file, so this is
enough (even for the dex).
2013-10-23 22:41:44 -05:00
小太
54042f637c Merge remote-tracking branch 'upstream/master' into tournaments
Conflicts:
	testclient.html
2013-10-20 20:43:13 +11:00
Quinella
da1280ba86 Fixes testclient.html; the loading message didn't disappear.
Because of that PMing and challenging others on testclient.html was impossible.
2013-09-22 15:00:53 +02:00
小太
4c13a800d2 Use a different library for rendering the tree and implement draggable brackets to support it 2013-09-17 20:14:17 +10:00
小太
ffcd67478e Add support for tree-type tournaments 2013-09-15 15:36:37 +10:00
小太
dc79480f31 Merge remote-tracking branch 'upstream/master' into tournaments 2013-09-13 21:55:59 +10:00
Quinella
bb88c1f049 Added storage.js include to testclient.html 2013-09-06 00:48:40 +02:00
小太
3c0e3b1a1e Merge remote-tracking branch 'upstream/master' into tournaments 2013-08-20 22:49:31 +10:00