I don't like developing firefox/chrome extensions
-
I want to switch between tabs in Firefox without taking my hands off the keyboard (and without having to reach and hit something like Alt+8). And I don't want to install those vi mode addons.
After doing some searching, it appears that I'm supposed to use the WebExtension system. This means I have to write HTML/CSS/Javascript ( :( ).
so I want to display a modal dialog in the middle of the browser window. when I hit a key, the browser will switch tabs and the dialog disappears.
because this is the future of writing extensions, this means i need to inject an iframe with my interface (written in HTML) onto the current tab. this seems like a pain in the ass. (if I'm , please don't hesitate to let me know)
: /
e: so I got it working using the addon SDK, not webextensions. /shrug
-
I'll try to start writing it, and use this as my horror log. worst comes to worst, I guess I can always check the mozilla forums—OH JESUS CHRIST
-
- click 'SIGN UP' on mozilla forums
- see this dialog:
- click 'connect':
- okay...nothing too crazy
- sure! I'll just click on this, and confirm my account
- ok.
-
firefox extensions must be signed by mozilla if you wish to install them in a permanent fashion. to get your addon signed, you must submit it to the addons.mozilla.org site and wait for them to approve it.
you can temporarily install addons through a debug page but they deactivate after a restart.
mozilla has graced us with 'unbranded' builds of FF that allow you to use unsigned addons.
on the plus side, if mozilla doesn't sign my addon that I wrote then I can rest assured that my code that I wrote won't install any malware onto my machine.
-
@bb36e this sort of shit is why @Lorne-Kates does what he does.
-
is the best way to center a floating element in the viewport still placing its position at 50%,50% and translating it -50%,-50%? why does this feel so hacky?
-
I give up for now. this is fucking impossible to debug. the only way to get data on the page is for the page script to send a message to some background script, and have that reply. the background script then receives the message and a callback, and fetches the list of open tabs using the tab API. the only way to get data out of the tab API is to provide it a callback.
so the background script creates a callback that calls back the original callback so that data can be passed back to the actual fucking script. the data is then provided to a callback that the original (message initiating) script provided when it sent the message.
well guess what, the content script isn't receiving the message. but if I reload the extension, then it receives
undefined
. I don't fucking know.computers are the worst thing I have ever encountered
-
Ctrl+Tab is too much effort? Or does that not work in FireFox?
-
@LB_ said in I don't like developing firefox/chrome extensions:
Ctrl+Tab is too much effort? Or does that not work in FireFox?
Well say I have 15 tabs open, I don't like mashing that 10 times to skip a bunch of tabs
What I had in mind was a list of auto generated shortcuts for each tab based on the home row in a dialogue - E.g.
a - Gmail
,ad - tdwtf
,s - reddit
, and typing one of them would take you to the tab
-
@bb36e said in I don't like developing firefox/chrome extensions:
so I want to display a modal dialog in the middle of the browser window. when I hit a key, the browser will switch tabs and the dialog disappears.
I wish it is not possible
@bb36e said in I don't like developing firefox/chrome extensions:
well guess what, the content script isn't receiving the message. but if I reload the extension, then it receives undefined. I don't fucking know.
Am glad it does not work :--)
Do you want to sell it online malware vendors or something?@bb36e said in I don't like developing firefox/chrome extensions:
computers are the worst thing I have ever encountered
Nope, they are the bestest
-
@dse 2021: Russian hackers have compromised millions of computers after tricking web surfers into encrypting their hard drives under the pretense of 'finding grumpy cat'
-
@bb36e Ctrl+T, ma enter for gmail, wh enter for TDWTF, re enter for reddit.
-
@LB_ I guess...I just really wanted something like uzbl and I was foolish to think that this could be hacked together in a couple of hours :(
-
The "unbranded builds" are variations of the beta and release versions that look a little different, but functionally the only difference should be that you can disable the signing requirement. These builds are pretty new, but the tracking bug for them has now been closed. There are a handful of bugs open against them, including that they auto-upgrade back to the branded version.
-
-
EDIT: this appears to be a cygwin-related issue. switching to cmd.exe worked.
-
why isn't there an easy way to HTML encode stuff without stuff like this? is everyone in web dev actually secretly not using HTML??
function htmlEncode( html ) { return document.createElement( 'a' ).appendChild( document.createTextNode( html ) ).parentNode.innerHTML; };
-
@bb36e JavaScript doesn't have a proper native library/module support, and is intended to be a platform-agnostic scripting language. So, no, no web specific stuff in there apart from DOM manipulation (which you're abusing there) , and you only have that because your platform (browser) provides that.
And that is why we have jBootstrapToolsScriptQuery...
-
Is there an option in
about:config
to disable signing? I don't have too much experience with playing around with the settings (except for turning off telemetry), but the ability might exist.
-
@Sumireko IIRC Chrome and Opera will let you have an unsigned extension in dev mode without disabling it. By "dev mode" I mean you give it a directory containing the code, as soon as you "pack" it (which basically zips it up with a custom extension) it becomes an unsigned extension that will get disabled on browser restart.
-
@Sumireko only in the unbranded and developer editions.
-
@Onyx said in I don't like developing firefox/chrome extensions:
@Sumireko IIRC Chrome and Opera will let you have an unsigned extension in dev mode without disabling it. By "dev mode" I mean you give it a directory containing the code, as soon as you "pack" it (which basically zips it up with a custom extension) it becomes an unsigned extension that will get disabled on browser restart.
When you're running unpacked extensions in the official Chrome builds, you also have to click past this nuisance every time you start the browser:
-
@DCoder hmmm, pretty sure Opera doesn't do that, where I did the bulk of that one time I tried making something (and then getting pissed at the signing process).
-
@bb36e Tell them that Discourse is immune to spammers and hackers, they probably didn't get the memo.
-
@bb36e said in I don't like developing firefox/chrome extensions:
We were joking at once point that future versions of Discourse would use a function that banned TDWTF users.
Joke's on us, I guess.
-
@bb36e said in I don't like developing firefox/chrome extensions:
it appears that I'm supposed to use the WebExtension system.
If you installed FF22, you'd be able to write extensions using the original add-on framework. You'd have instant access to tabs. And you wouldn't need to have anything signed.
-
@Lorne-Kates they still have the addon SDK stuff enabled, but MDN has big scary warnings saying that you should use the new shiny. but I've gotten infinitely more work done after hacking on the addon SDK so I'll stick with the old one.
-
@bb36e said in I don't like developing firefox/chrome extensions:
but I've gotten infinitely more work done after hacking on the addon SDK so I'll stick with the old one.
Once again, wins over "shiny new for the sake of shiny new".
What's the emoji antonym for anyways?
-
@Lorne-Kates said in I don't like developing firefox/chrome extensions:
What's the emoji antonym for anyways?
?
-
@bb36e said in I don't like developing firefox/chrome extensions:
This means I have to write HTML/CSS/Javascript ( :( ).
Surely, at this point there must be some tool that lets you write in an alternative language and set of APIs that gets later translated to HTML5? (at the very least, you could render an existing GUI tolkit to a <canvas>)
You'd still need some work to integrate it with the "WebExtension system" but at least it'd let you write complex things without dealing with javascript.
-
@anonymous234 the problem for me was that it's not a very complex program. So most of the code was dealing with interfacing with the API which is the hard-to-debug part. But yeah, I'd imagine that's what they'd do for larger extensions.
-
@bb36e said in I don't like developing firefox/chrome extensions:
so I want to display a modal dialog in the middle of the browser window. when I hit a key, the browser will switch tabs and the dialog disappears.
You should try Vivaldi.
-
@bb36e said in I don't like developing firefox/chrome extensions:
@LB_ said in I don't like developing firefox/chrome extensions:
Ctrl+Tab is too much effort? Or does that not work in FireFox?
Well say I have 15 tabs open, I don't like mashing that 10 times to skip a bunch of tabs
What I had in mind was a list of auto generated shortcuts for each tab based on the home row in a dialogue - E.g.
a - Gmail
,ad - tdwtf
,s - reddit
, and typing one of them would take you to the tabOkay... I found an addon called keyconfig, which allows you to create custom hotkeys that run Javascript, and started experimenting.
For example, I wrote a simple script to find and activate the tab with Facebook, or open it in a new tab if it's not already open:
// if a tab matching this URI is found in the current window, it's selected // otherwise, a new tab is added and the URI is loaded in it var URI = 'www.facebook.com'; var tabs = [...gBrowser.mTabContainer.childNodes]; if (!tabs.some(tab => { // this selects the first matching tab and returns true so tabs.some() is true // if a matching tab is not found, tabs.some() will be false try { var tabURI = tab.linkedBrowser.registeredOpenURI; if (tabURI.spec == URI || tabURI.host == URI) { gBrowser.selectedTab = tab; return true; } } catch (e) { // this error fires on tabs like about:config when you try to read tabURI.host // note that it only happens if tabURI.spec doesn't already match the given URI return false; } })) { // if the tab was not found, add the URI in a new tab and select it gBrowser.selectedTab = gBrowser.addTab(URI); }
And then I did this script, which might actually do exactly what you're looking for...
try { var tabs = [...gBrowser.mTabContainer.childNodes], shortcuts = {}; var titles = tabs.map(tab => { var title, prefix = ''; try { title = tab.linkedBrowser._contentWindow.document.title; prefix = (title.match(/^[^a-z]*/i) || [''])[0]; } catch (e) {} if (!title) { title = tab.linkedBrowser.registeredOpenURI.spec; prefix = (title.match(/^(.*:\/*(www\.)?)?[^a-z]*/i) || [''])[0]; } title = title.slice(prefix.length); var len = 1, i = "", max_len = 3; while (title.slice(0, len).toLowerCase() + i in shortcuts) { if (i === "") { ++ len; if (len > max_len) i = 0; } else { ++ i; } len = Math.max(0, Math.min(len, max_len - String(i).length)); } var shortcut = title.slice(0, len) + i; shortcuts[shortcut.toLowerCase()] = tab; return prefix + '<' + shortcut + '>' + title.slice(len); }); var shortcut = prompt(titles.join('\n') + '\n\nEnter shortcut:'); if (typeof shortcut == 'string') shortcut = shortcut.toLowerCase(); if (shortcut in shortcuts) gBrowser.selectedTab = shortcuts[shortcut]; } catch (e) { alert(e); }
Upon pressing the assigned shortcut combination (I used Alt+`), it produces this:
After typing a shortcut and hitting Enter, that tab is activated.
-
@Lorne-Kates said in I don't like developing firefox/chrome extensions:
If you installed FF22, you'd be able to
But then you'd have FF22 on you. Ick.
-
This post is deleted!
-
@anotherusername that's awesome! thanks for the script!
unfortunately...I just finished my addon using the legacy api :P
-
@HardwareGeek said in I don't like developing firefox/chrome extensions:
@Lorne-Kates said in I don't like developing firefox/chrome extensions:
If you installed FF22, you'd be able to
But then you'd have FF22 on you. Ick.
You get used to it. It's fun. We can have an install party-- FF22 flying everywhere, on everyone.
-
@Lorne-Kates said in I don't like developing firefox/chrome extensions:
We can have an install party-- FF22 flying everywhere, on everyone.
You can even go do it down at that gay club in Australia, now that they fixed the lube.
-
-
@pydsigner said in I don't like developing firefox/chrome extensions:
Vivaldi
Decent GUI (not native, but what browser is these days?). Good feature set. Good vision.
WRITTEN IN FUCKING WEBKIT-OVER-NODE SO SHIT BREAKS BECAUSE JAVASCRIPT AND EVENT BUBBLING!
Stuff like Ctrl + S still bubbles up to the browser. Backspace sometimes goes back when editing something on the page instead of deleting text. Etc. etc.
Fucking NodeTML bullshit everywhere these days. Yeah, it works, mostly, but when it doesn't it's the most annoying shit ever.
-
@anotherusername said in I don't like developing firefox/chrome extensions:
After typing a shortcut and hitting Enter, that tab is activated.
Needs more slow slow random. Otherwise, cool work!
-
@Lorne-Kates said in I don't like developing firefox/chrome extensions:
We can have an install party-- FF22 flying everywhere, on everyone.
You reminded me of the Guiness Record attempt by Firefox in most downloads of a single file in 24 hours, back when FF3 was released.
-
@flabdablet Didn't watch the video, but I did work at a place once where the application was written by some idiot savant who didn't trust the database's transaction functionality, so he wrote this huge PITA thing. To save a record, you'd copy it to a temp-table with a definition identical to the DB table, and then call a library function (one per table, IIRC), that found the original record and updated it by copying the contents of the temp-table. Horrible.
-
@bb36e said in I don't like developing firefox/chrome extensions:
What I had in mind was a list of auto generated shortcuts for each tab based on the home row in a dialogue - E.g. a - Gmail, ad - tdwtf, s - reddit, and typing one of them would take you to the tab
- Ctrl+L to focus the awfully-named-awesomebar-everyone-just-calls-addressbar (unless the website hijacks the shortcut, NodeBB).
- Begin to type part of the title or address of the tab you want to switch to.
- Find and select with arrow keys and enter/return the option with a little tab icon and the text "Switch to tab":
- Eventually realize in practice this does not work as well as in theory, in fact it's borderline useless with all the other results from your history interfering.
- Keep this in the back of your mind anyway.
Well say I have 15 tabs open, I don't like mashing that 10 times to skip a bunch of tabs
- Install Tab Groups;
- Press Ctrl+Shift+E;
- Navigate with arrow keys, press Enter when done;
- Wish there was a way to directly switch to tabs on different windows;
- Realize keyboard navigation among tab groups seems to be buggy;
- Realize Esc still opens the tab you've selected, rather than close without changing.
- Go post these issues with the Tab Groups developer, because @Zecc was too lazy.
-
The extension you've created looks great.
-
@Zecc ^_^
-
@Onyx said in I don't like developing firefox/chrome extensions:
WRITTEN IN FUCKING WEBKIT-OVER-NODE SO SHIT BREAKS BECAUSE JAVASCRIPT AND EVENT BUBBLING!
Stuff like Ctrl + S still bubbles up to the browser. Backspace sometimes goes back when editing something on the page instead of deleting text. Etc. etc.
Fucking NodeTML bullshit everywhere these days. Yeah, it works, mostly, but when it doesn't it's the most annoying shit ever.Yep. I feel the same way about Atom too, but since Vivaldi is my Chrome replacement I kinda expect it to consume lots of memory anyways. The backspace thing has nabbed me once or twice.
And yet all over the internet you can find awful people giving the advice to "use electron, you'll have free cross-platform compatible and homogenous UI yay!!!
Sometimes you get what you pay for in terms of dev hours....
-
@pydsigner said in I don't like developing firefox/chrome extensions:
I feel the same way about Atom too
I use Atom currently, actually, because Sublime tends to lock up completely (by which I mean, goes freaking unkillable, nothing helps) if you're using a networked drive and the connection experiences a hiccup at any point. The most fun part is when you hit Ctrl+Shift+I by accident before switching focus to your browser, and the inspector opens... in Atom. Yes, exactly what I wanted, I need to inspect my editor...
Oh, also, additional Vivaldi rant: The inspector cannot be docked into the main window! I can kinda work around that, yes, but it's freaking annoying at times I want it in split view (which is most of the time, TBQH)!
-
@FrostCat said in I don't like developing firefox/chrome extensions:
@flabdablet Didn't watch the video, but I did work at a place once where the application was written by some idiot savant who didn't trust the database's transaction functionality, so he wrote this huge PITA thing. To save a record, you'd copy it to a temp-table with a definition identical to the DB table, and then call a library function (one per table, IIRC), that found the original record and updated it by copying the contents of the temp-table. Horrible.
I mean, that's clever, were it not for the fact that it already exists.
-
@Onyx said in I don't like developing firefox/chrome extensions:
Oh, also, additional Vivaldi rant: The inspector cannot be docked into the main window! I can kinda work around that, yes, but it's freaking annoying at times I want it in split view (which is most of the time, TBQH)!
I use a tiled window manager, imagine how I feel...
(I could put the inspector side by sideo, but then it'd be up for every website, costing me screenspace unnecessarily.)