Terrance / Homely

A New Tab page replacement for Google Chrome with custom links and bookmarks/history components.
https://chrome.google.com/webstore/detail/homely/fplghnonomhbnlhdnmjpipoomkjdpeim
103 stars 30 forks source link

Firefox Extension? #2

Open TaylanTatli opened 10 years ago

TaylanTatli commented 10 years ago

Is it possible to make a firefox version? I don't like chrome but i'm using because your extension is so good.

Terrance commented 10 years ago

Since the Chrome and Firefox APIs vary a lot, it would likely require a lot of rewriting. I would like to bring Homely to Firefox, but I don't really have the time to work on this at the moment.

JourneyOver commented 8 years ago

With the upcoming Mozilla WebExtension API coming soon that'll allow chrome extensions to work with firefox do you think you might have time to possibly look into doing this?

Terrance commented 8 years ago

This is quite promising, though I can't find an equivalent to chrome_url_overrides in order to set the custom new tab page. May just require some extra manifest stuff, or at least exposing a URL you can use as your home page. In any case, this looks a lot more doable now! 😃

JourneyOver commented 8 years ago

Sounds great :D honestly been thinking about switching to firefox for a while now because chrome has been very buggy for me lately, but this is one addon/extension that is stopping me from actually doing so as every new tab page I've tried for firefox so far sucks.. So if you can find a way to do it, it would be great!

I did try setting things up with Chrome Store Foxified and a tab switch overrider on firefox and trying out chrome-extension://fplghnonomhbnlhdnmjpipoomkjdpeim/newtab.html for the time being but of course that method didn't work out sadly.

Terrance commented 8 years ago

Looks like it's a bit broken as-is. Steps to get it installed (using Firefox 49 developer):

  1. Checkout a local copy of the repo.
  2. Go to about:debugging#addons, check Enable add-on debugging.
  3. Click Load Temporary Add-on, browse to and open manifest.json in the repo.
  4. Homely should now appear in the extension list, click Debug (might take a few seconds to load).
  5. chrome.extension.getURL("res/html/homely.html") will give you the main page address.

But the stripy background is there, so that's something... 🎉

JourneyOver commented 8 years ago

Yep using chrome store foxified addon and going and installing the addon from the chrome store and mainly doing the same steps as above I was able to get the stripy background as well after it gave me the url of moz-extension://ef82e03d-cf7f-4663-94dd-a676b07fb7c8/res/html/homely.html so at least we can get to that point, now guess next thing is figuring out how to get everything else to work xD

Terrance commented 8 years ago

Something quirky with the JavaScript going on, but no errors in the console...

More is happening than can be seen, because body is hidden until everything is ready. If you remove the display: none; (line 5) from res/css/homely.css, we can see what's actually going on.

Interestingly, link blocks do appear to be working, just not much else.

Terrance commented 8 years ago

Ah, roadblock detected -- chrome.permissions isn't supported yet. Would mean having to declare all permissions upfront, which is not ideal given the scope, or drop things like notifications/baskets for now.

Also means diverging the code base to handle both types of permissions, which could get messy. 😒

JourneyOver commented 8 years ago

ooh wonder whats going on with the javascript to cause the issue with it not loading everything fully even though it's happening in the background.. and aww darn that sucks :( I didn't know the chrome.permissions wasn't supported yet, hopefully they get around to getting those supported soon enough..

Once they get them supported you wouldn't have to diverge the code base any right? so once it's supported you could theoretically possibly make this addon work with Firefox a whole lot more?

Noticed things like import/export and trying to save various options doesn't work either, guessing this is part of the javascript being quirky?

Terrance commented 8 years ago

Hopefully, assuming it works the same as in Chrome, the two should behave the same. I'll hold off officially porting it for now, but will keep an eye on what happens with the WebExtensions spec.

JourneyOver commented 8 years ago

Hopefully they will work the same as in chrome then, and alright that sounds fine :D glad that you are at least going to keep an eye on the WebExtensions stuff and hopefully be able to make an addon for firefox once development for it all opens up a bit more.

Terrance commented 7 years ago

Quick update: looks like optional permissions are scheduled for Firefox 54.

The Firefox nightlies have most of the features for required permissions (unsure about optional) -- I'll hopefully find some time to poke around with this soon.

Terrance commented 7 years ago

Seeing as Chrome has been quite a pain lately, I've swapped back to Firefox for a bit.

54.0a2, no sign of chrome.permissions APIs yet. But here is a working page, complete with block editing and saving. 🙂 Just lacks the optional parts (bookmarks, history, notifications etc.) -- they'll probably work if given as required permissions.

Homely on Firefox

The only other missing API is chrome.fontSettings, which is needed here:

diff --git a/Homely/res/js/homely.js b/Homely/res/js/homely.js
index e104a00..959aabf 100644
--- a/Homely/res/js/homely.js
+++ b/Homely/res/js/homely.js
@@ -2087,10 +2087,12 @@ $(document).ready(function() {
         }
-        // request list of fonts from FontSettings API
-        chrome.fontSettings.getFontList(function fontsCallback(fonts) {
-            for (var i in fonts) {
-                $("#settings-style-font").append($("<option/>").text(fonts[i].displayName));
-            }
-            $("#settings-style-font").val(settings.style["font"]);
-        });
         $(".ext-name").text(manif.name);
         $(".ext-ver").text(manif.version);

A rough permissions mock to get the settings dialog working:

diff --git a/Homely/res/js/homely.js b/Homely/res/js/homely.js
index e104a00..f0727f5 100644
--- a/Homely/res/js/homely.js
+++ b/Homely/res/js/homely.js
@@ -17,4 +17,18 @@ $(document).ready(function() {
     }
     var manif = chrome.runtime.getManifest();
+    // mock out permissions model
+    if (!chrome.permissions) {
+        chrome.permissions = {
+            contains: function(perms, cbk) {
+                cbk(false);
+            },
+            remove: function(perms, cbk) {
+                cbk(true);
+            },
+            request: function(perms, cbk) {
+                cbk(false);
+            }
+        };
+    }
     // default settings
     var settings = {
JourneyOver commented 7 years ago

Lookin good so far :D

Terrance commented 5 years ago

For those still lurking in here, the permissions API now exists, and the latest commits should now allow the extension to be installed in Firefox without any edits.

anton2020 commented 5 years ago

@Terrance great! Does it mean that you are planning to add it to the Firefox Add-ons site?

JourneyOver commented 5 years ago

Yes please @Terrance can you get this up on the firefox add-ons site? so it's an easy click and install of the extension.