Commit Graph

32 Commits

Author SHA1 Message Date
Guangcong Luo
2d21de69d9 Support chat formatter 2021-05-04 21:46:24 -07:00
Mia
031702bf10
Restore old jQuery (#1737) 2021-04-01 12:12:06 -04:00
Mia
aa0086856a
Update to latest jQuery 2.2.4 (#1733) 2021-03-30 18:41:38 -07:00
Guangcong Luo
aa82e72e9a
Partial drag/drop panel tab rearranging (#1641)
Not full support, but basic rearranging is now possible!

Supported:

- Rearranging the topbar
- Dragging PMs from the Main Menu to the topbar

Not supported:

- Dragging things from the topbar to the Main Menu
2021-02-01 23:40:20 -08:00
Adam Tran
a9f8adfa39
Preact Client: Ladder (#1709) 2021-01-29 08:10:36 -08:00
Adam Tran
1d9fadde06
Tooling: Preact Client server by URL; tslint (#1711) 2021-01-20 04:44:36 -08: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
8a1ddcd6e2 Rename new BattleSearch -> DexSearch
(Also fix a bunch of bugs.)

The new name `DexSearch` better represents its feature-set, and allows
its name not to clash with the old `BattleSearch`.
2020-05-04 19:07:37 -07:00
Guangcong Luo
40d077903f Support playing battles
This should be a much nicer architecture than the old
`client-battle.js`.

In particular, much of the logic of choosing moves/switches has been
moved into a new `battle-choices.ts`, with `panel-battle.tsx` only
covering the UI.
2020-03-23 06:55:35 -04: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
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
Guangcong Luo
5d6304eeb6 Support PM windows
These are now called `mini-window`s by the client code, and they're now
generic in the sense that any PS room can be a mini-window, not just
PMs and News.

This also adds BattleTextParser as a dependency of client-main,
removing some duplicate code in exchange for a hopefully-negligible
difference in load time.
2019-10-15 19:14:32 +10:30
Guangcong Luo
9e06e72a35 Add support for watching battles
Playing battles is, of course, a lot harder, but watching them
is at least implemented now.
2019-09-06 02:46:54 -05: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
898280c5e5 Improve format/team selector
This introduces a new TeamForm component, which can be used to choose
formats and teams.
2019-08-22 11:08:43 -07:00
Guangcong Luo
b47708efa0 Implement teambuilder dropdown selector
This took way too long to get to a presentable state.

- search.js has been refactored into battle-search.ts (search logic)
  and battle-searchresults.tsx (display)

- panel-teambuilder.tsx has been split into teambuilder (team list) and
  teambuilder-team (team editor).

- The teambuilder's text editor can now detect which line it's on,
  and show the appropriate search result panel.

- The teambuilder's text editor now detects sets dynamically, and has
  the beginnings of support for set comments.

Currently, everything here is really basic, and mostly just a tech
demo for people to play around with and understand the direction of
the new teambuilder, but it'll be improved over time.
2019-06-25 00:51:27 -07:00
Guangcong Luo
bb6fe7ec3e Improve teambuilder stub
This should give an idea of the direction I want to take the
teambuilder in: a text editor, but with special features.

This neatly sidesteps a lot of UI questions, especially all the export
and input buttons, because the regular editing mode can be used to
import and export without anything fancy.

This also makes way for a better way to implement team/set comments:
comments are just invalid Pokémon in a team.
2019-05-16 01:27:19 +04:00
Guangcong Luo
7d52fd8c30 Implement TeamDropdown
Currently it's in the Main Menu where the old team dropdown was, but
the plan is for "Battle!" to eventually open a separate Search window.
2019-04-05 17:34:20 +08:00
Guangcong Luo
fbaceafac1 Implement Rooms room 2019-03-21 20:16:01 +09:00
Guangcong Luo
c02370f8b2 Stub teambuilder implementation 2019-03-17 19:02:53 +09:00
Guangcong Luo
25d2422a58 Add support for chat userlists and usercards
This involves a relatively substantial refactor to how panels work, but
it should be somewhat finalized now. Popups are now fully supported.
2019-03-17 19:02:53 +09:00
Guangcong Luo
04a5454f6e Support login handshake
You can't actually log in through the Preact client anyway, but now
if you set the right config file, you can _be_ logged in.
2019-03-17 19:02:53 +09:00
Guangcong Luo
0246466299 Use BattleLog for chat logs 2019-03-17 19:02:53 +09:00
Guangcong Luo
f3b6352676 Stub chatroom support 2019-03-17 19:02:53 +09:00
Guangcong Luo
e501702a2a Add connection support
The actual connect function is commented out, because there's no reason
for it to do anything. But it can actually connect to a server now.
2019-03-17 19:02:53 +09:00
Guangcong Luo
bc7676838d Rename client-frame.tsx -> panels.tsx
Considering all the individual panels start with `panel-`, this should
make it easier to find and in general be a more intuitive name.

All other tsx files will start with `panel-`, putting them together in
one place when sorting alphabetically.
2019-03-17 19:02:53 +09:00
Guangcong Luo
008e3de862 Implement stub Main Menu and Rooms panels 2019-03-17 19:02:53 +09:00
Guangcong Luo
5def884999 Stub Main Menu 2019-03-17 19:02:53 +09:00
Guangcong Luo
f8d251c8a1 Stub Preact rewrite
HIGHLY UNFINISHED CODE
2019-03-17 19:02:53 +09:00