Skip to content

WIP: Core BPM changes for Discord #12

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

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

ByzantineFailure
Copy link
Contributor

Following a PM conversation with @Rothera, I'm going to try and track all BPM core changes in their own branch and keep this PR open here. The discord-specific code will be kept in a branch that will be continually rebased off of this one.

The discord-specific Makefile changes are not included here as they observe files that would not exist without the discord-specific code and will break the Makefile.

The PR as it stands does the following:

  1. Recognize when the code is in a discord environment (detect window.process)
  2. Create Discord implementations for bpm-browser.js
  3. Ensure emote search is always enabled for Discord
  4. Change the emote search <a>s with external hrefs to have target="_blank" when in running in Discord so that they open in a new browser window rather than navigating Discord's browser window.
  5. Apply the Chrome animote CSS fix to Discord (because it's essentially just a chromium instance)
  6. Don't add the global emote search button if we're in Discord. Use a Discord-specific button-setup function if we are.
  7. If we're in discord we should make the default settings for enableGlobalEmotes and enableGlobalSearch be true.
  8. Fixed a bug where a user could drag the search window outside the browser window
  9. Fixed a bug where resizing the browser window could "lose" the search container.
  10. Sets all emote maps to be present on module.exports for bpm-resources.js then if we're in an electron (Discord) context imports them as variables.
  11. Adds a discord-specific setting to disallow emotes in disruptive places. If this setting is flagged true it fires the locate_matching_ancestor function when assessing if a node with text is valid for replacement.
  12. Adds code to bpm-searchbox.js so that if we're in discord clicking an emote fires a message to the discord code rather than inserting normally (this is so we always insert in the discord chat input textarea)

I intend to make a few more changes before considering this PR good to go:

  1. Make changes to the Store object and code which references preferences so that changes made in the Discord preferences pane are immediately reflected in the Discord window.

CAVEAT EMPTOR: I have not tested any of these changes with any of the browser extension builds.

@Rothera
Copy link
Owner

Rothera commented Jan 3, 2016

Regarding moving the search box off the window: I believe I have heard complaints before that it's possible to "lose" the search box in BPM by resizing the page, and similar things. The best change, not necessarily the most expedient one, may be to ensure the box generally tries to stay within the visible area.

The content script is already wrapped in a giant (function() { ... })(), unless I'm missing something.

@ByzantineFailure
Copy link
Contributor Author

I have just coded up the dragging, will add on a todo for the window resize. Note: It's specifically when resizing the window down from the right or up from the bottom. Works fine if resizing from the top or left.

EDIT: ...until you resize it off the page. Okay.

@ByzantineFailure
Copy link
Contributor Author

Regarding the content script, huh, so it is. Not sure how I missed that
image

@Ajedi32
Copy link
Contributor

Ajedi32 commented Jan 3, 2016

@ByzantineFailure Probably because of the way the top of the function wrapper is in a totally different file from the end of it. That confused me at first too. O.o

@Rothera
Copy link
Owner

Rothera commented Jan 3, 2016

Hooray for cat based build systems!

@ByzantineFailure
Copy link
Contributor Author

I think the search box dragging, window-resizing, and searchbox resizing bugs are hammered out now.

@ByzantineFailure
Copy link
Contributor Author

Question, given that this is likely to be a long-lived PR, would it be wise to split out the "Search cannot leave browser window" commit into its own PR? That one seems to be something that would benefit BPM as a whole and can stand on its own without the Discord changes.

@Rothera
Copy link
Owner

Rothera commented Jan 27, 2016

Oh. That would probably be good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants