forked from scpwiki/interwiki
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decouple resizer from interwiki #3
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add scpfoundation.net support through Crom
Removes global-like flag variable that tracked whether to show the interwiki. Flag started off and switched on when a translation link was added. Resize attempts would no-op until this was the case. Moving this logic from the resize function to the main interwiki script means the resize functions are now logically independent of the interwiki. When the resize function is called, the iframe resizes. It is the interwiki's job to decide when to call the function.
As opposed to calling the debounced function with the Arguments object as the sole argument
Currently, making POST requests [with a JSON content type](https://developer.mozilla.org/en-US/docs/Glossary/CORS-safelisted_request_header) means that the browser needs to make a [preflight request](https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request) first, and that adds an additional request overhead. The preflight request itself doesn't add much load to the API server, and it probably doesn't add a _huge_ overhead to the client either, but with the server running out of a single geographic region, switching to a "CORS-safe" GET request would spare a good chunk of a second of latency for the end-user, depending on their location. In the long term, this would also open up the avenue for basic HTTP-layer caching. Implementation-wise, GraphQL doesn't exactly have an official spec for interfacing with HTTP, but the Crom API's custom implementation follows [the guidelines](https://graphql.org/learn/serving-over-http), which includes a recommendation for making requests over GET. The accept header is there so that the browser doesn't serve the playground HTML instead (which it would if the accept included text/html or \*/\*). Couldn't use URLSearchParams with the ES5 limitation, but the alternative isn't so bad. Also, I drafted this in the GitHub editor, so I haven't actually tested this change.
Decouple resizer from interwiki
Add Russian WL branch
ukwhatn
approved these changes
Jun 1, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
scpwiki#25