Elma Center: Chrome extension

Advertise your levels, contests, sites etc.

Moderator: Moporators

Post Reply
User avatar
skint0r
39mins club
Posts: 768
Joined: 16 Jun 2002, 07:36
Location: Oslo, Norway

Elma Center: Chrome extension

Post by skint0r »

I was curious about how Chrome extensions were made the other week, so I made this for fun just to get familiar with the process. The code is absolute garbage since I was learning while making; and now it's all a big mess. It does however work, more or less... Uh-huh, so what does it do then? Well basically right now since I didn't have any other ideas, I stole from pab and just made a battle notifier. It is pretty sparse in features and without any filtering options, if really any options at all. The upside being it's just an extension and runs in your browser. I don't know if it's really going to get much more features unless I'm really in the mood and decide to rewrite it, but I just decided to share it in case someone wants something really simple to use.

It has some localization support, which can also be disabled. Only works if you have your browser locale set to non-english though. Right now it just has Finnish and Polish, thanks to Jappe2 and chris for doing those translations. I don't really know if more than a few people will use this extension in the first place, let alone want to use localization of it, but it wasn't too much work to put in either way. If you want to add some other languages, hit me up, there's not too much work involved in doing the translations and it'd be cool to have some more either way, whether they'll see any use or not.

Anyway, here's the Chrome webstore link.

Here's how the popup notifications look like:
Image
They can be turned off in the settings.

Here's the popup when you click the icon in the Chrome toolbar thing:
Image
When a battle is running the icon will be colored according to how much time is left of the battle. Green when over half left, yellow when under half, and red when under a quarter left (I think).

Shitty things:
  • There's no real proper way to control the notification windows, so they will close by themselves after a few seconds unless you hover over it.
  • If you are running some fullscreen thing, the notification windows will be queued in the background, so old battles might popup if you have been fullscreen in something for too long. Could be fixed but that means work and well ugh. Maybe some time, if anyone will actually use it and care.
  • When you turn off or on localization, the current running battle will still have the old setting until it's over. Not hard to fix, but also work. And unless you for some reason are turning it off and on constantly, it's not an issue.
WTFFF??!! Extension asks me for access to clipboard and some hax ip!?!!!1 Clipboard thing was intended to potentially incorporate recsource or some other sites at some point. While it's not used now, I still kept the permission for it enabled because lazy and no real reason. It doesn't actually use it for anything. Chrome extensions are pretty locked down, so unless you see something mentioned in permissions, it can't post or access any other sites than those listed. The hax ip is bene/domis battle API url, big thanks to them for making and also for quickly adding json support :*
If you are super paranoid there's the source code available, or you can simply look at the code directly in chrome using the developer setting in the extension page.

Since battles are sporadically started, it's been hard to do really intensive testing, but I did as much as I could. There will probably be the random bug here and there beyond the ones mentioned. Again, just made it for fun and to learn a bit about extensions, it's not super serious work so don't expect too much of it. Use it or don't!
Prestigious member of 14.6x Tutor14 club
User avatar
Pab
38mins club
Posts: 887
Joined: 4 Apr 2008, 23:46

Re: Elma Center: Chrome extension

Post by Pab »

Cool i installed it ^^ but no battles yet!! Someone start! Seems like battle notifiers younger prettier brother.
My Youtube Channel Level Stats Maker Battle Notifier!

Image
Image
Signatür ruined by SveinR - smaller plz :*
User avatar
Ismo
39mins club
Posts: 114
Joined: 28 Mar 2005, 18:16

Re: Elma Center: Chrome extension

Post by Ismo »

:beer:
[00:21:58] (@cyre) ismo taas juonu liikaa omenamehuu
User avatar
dawid
Kuski
Posts: 176
Joined: 10 May 2014, 19:23

Re: Elma Center: Chrome extension

Post by dawid »

Nice! What about updating battle time left every second when popup is visible (ext icon clicked)?
User avatar
skint0r
39mins club
Posts: 768
Joined: 16 Jun 2002, 07:36
Location: Oslo, Norway

Re: Elma Center: Chrome extension

Post by skint0r »

I thought about it, but questioned how often someone would keep the popup window open for longer than a few seconds. Not a huge deal to add it though probably.
Prestigious member of 14.6x Tutor14 club
User avatar
dawid
Kuski
Posts: 176
Joined: 10 May 2014, 19:23

Re: Elma Center: Chrome extension

Post by dawid »

What happens when battle is aborted? Did u test it?
User avatar
skint0r
39mins club
Posts: 768
Joined: 16 Jun 2002, 07:36
Location: Oslo, Norway

Re: Elma Center: Chrome extension

Post by skint0r »

Impsy to test real world situation, but I imagine it should work just like when a battle is finished; displaying no battle and clear all data. It doesn't really do anything special when a battle is over so there is no difference, or shouldn't be anyway. All it does it poll battle api every 10s: if empty result returned it clears all battle data (battle is over or aborted presumably), if the battle ID is same as the one already fetched, skip and do nothing, if new id = new battle etc. It's pretty naively coded and extremely simple, but works for now so oke.
Prestigious member of 14.6x Tutor14 club
User avatar
skint0r
39mins club
Posts: 768
Joined: 16 Jun 2002, 07:36
Location: Oslo, Norway

Re: Elma Center: Chrome extension

Post by skint0r »

btw there is link to source in extension but in case no one saw it there: https://github.com/hexjelly/elma-center (warning don't laff i'm nab) and the function/part in question is here https://github.com/hexjelly/elma-center ... und.js#L92
Prestigious member of 14.6x Tutor14 club
Post Reply