zystvan / codecademy-redesigned-firefox

Codecademy Redesigned for Firefox
http://zystvan.com/codecademy-redesigned
3 stars 1 forks source link

How do I incorporate my new feature into this extension? #3

Open GaurangTandon opened 8 years ago

GaurangTandon commented 8 years ago

I have written the JS code for Chrome. Could you, if I share the files with you, translate it so that Firefox understands it well, because I have never made a Firefox extension so I don't know much about it (and am a little scared as well) :P

GaurangTandon commented 8 years ago

And I will upload the files as well - files.zip

zystvan commented 8 years ago

@GaurangTandon I'll do this in just a few minutes. I've made it as simple as I know how, the file structure for Chrome is:

- manifest.json
- site-updater.js
- site-updater.css
- forum-updater.js
- forum-updater.css

Then for Firefox, it's:

- package.json
- index.js
- data
  - site-updater.js
  - site-updater.css
  - forum-updater.js
  - forum-updater.css

And to update it, you change the version in package.json and you might have to change stuff in index.js, but unlikely. And after that, the only difference between Chrome and Firefox is in the *.js files, Chrome is:

function siteUpdater() { // or forumUpdater()
  // do stuff
}

var script = document.createElement("script");
script.textContent = "$(document).ready(" + siteUpdater.toString() + ")";
document.documentElement.appendChild(script);

but in Firefox, it's just the // do stuff part, because Firefox automatically runs the code without us injecting it into the page (although I'm surprised Chrome needs us to manually put the code into the page).

zystvan commented 8 years ago

@GaurangTandon Do you mind if I change a few things in your code? I think that

  1. I'd rather set styles in the CSS file, rather than stuff like img.width = "whatever" cluttering up the JS
  2. Since the external link thing is an icon, could we use the Font Awesome external link icon, since forums already use Font Awesome icons?

I don't mind changing those myself, but since it's your code I want to make sure you're OK with it :)

GaurangTandon commented 8 years ago

@zystvan

  1. I agree it clutters the CSS :) but I thought we might have to make a really strong selector and put !important in it so as to make sure the site's styling doesn't interfere with the image styling.
  2. I too thought of using external image service providers, but then it might post caching problems about which I have no idea, already Discourse takes too much time too load. But, go ahead, I didn't know our forums already use Font Awesome, I think caching might happen, though you'll need to check it once.

And by the way, I never had to inject js files in webpages, Chrome offers content scripts which run automatically in the context of each webpage. I think the only need when you have to inject your script is when you are using a background page. I think you are in the latter case, because if you'll see the the js file I sent you, I am using a content script, and I don't need to inject it. You too might want to use content scripts :)

Btw, @A-J-C had experimented with the new courses and he got this bit URL += href[2] + "/lessons/"+href[3]+"/resume"; which seems to be working for new courses as well :) However, I tried it and it doesn't seem to be working for Pro content posts (for normal posts it worked fine). Perhaps, you could check it out since you are a Pro subscriber :) In case it works, then we will have to update the necessary statements in the js file and push new update :tada:

zystvan commented 8 years ago

@GaurangTandon If we give the external link icon thing a unique id, I'm pretty sure that won't be too much of a problem :)

Yeah, that sounds more like what should happen. Is it because you're wrapping it in a (function() {})(window) thing? Because if we can make the code for the Firefox and Chrome versions identical, that'd be great.

I'll play with that & see if you can get it working, thanks for letting me know.

A-J-C commented 8 years ago

Using gitHub is a bit hard for me to manage the code properly. As it's always not on the right version and a pain to update files. So if neither of you mind I'm going to make a Shared folder on Dropbox and share it with both of you so we can all upload/download to the same place :) then once we have a new version I'll just take everything off Dropbox zip it and upload. Should make everything easier for us all.

Do you both have email addresses you use for Dropbox that I could add? :) On 24 Dec 2015 14:21, "Zeke Y" notifications@github.com wrote:

@GaurangTandon https://github.com/GaurangTandon If we give the external link icon thing a unique id, I'm pretty sure that won't be too much of a problem :)

Yeah, that sounds more like what should happen. Is it because you're wrapping it in a (function() {})(window) thing? Because if we can make the code for the Firefox and Chrome versions identical, that'd be great.

I'll play with that & see if you can get it working, thanks for letting me know.

— Reply to this email directly or view it on GitHub https://github.com/zystvan/codecademy-redesigned-firefox/issues/3#issuecomment-167117826 .

zystvan commented 8 years ago

@A-J-C Git is supposed to make managing code easier! But my email address is zeke@zystvan.com :)

A-J-C commented 8 years ago

I know it is! But it just doesnt for me right now :') Maybe once I've learnt how to use it properly, but for not dropbox would be great :).

On Thu, Dec 24, 2015 at 2:28 PM, Zeke Y notifications@github.com wrote:

@A-J-C https://github.com/A-J-C Git is supposed to make managing code easier! But my email address is zeke@zystvan.com :)

— Reply to this email directly or view it on GitHub https://github.com/zystvan/codecademy-redesigned-firefox/issues/3#issuecomment-167118362 .

A-J-C commented 8 years ago

I think before moving on with any major new code we should clean up everything we currently have. I had a few ideas. Feel free to comment on them or suggest different things :+1:

1) We have 3 different "run ats" this could maybe be reduced to 2 by combining the 2 discuss ones, not sure what affect it would have though. 2) Do we need permission for "tabs"? 3) JQuery @GaurangTandon mentioned this. Is it worth converting everything so it doesn't use jQuery? 4) A lot of my scripts inject css files and script files, as this is the way Joah told me to do everything. We could update it to run in a content script so nothing is injected. 5) Use one css styling sheet rather than 2. And move all styling from in-line to the styling sheet. I really want this one because inline styling gets a bit messy. And if we specify things right and use our own id's and classes then it should work fine. 6) We have 5 different js files. These could probably be reduced to one for codecadmey and one for discuss. We just need to make sure everything is in them and will run at the right time. We can also move the injected scripts into these sheets to make everything a bit nicer. 7) We need to work on "branding". If you guys look on line you can include everything in an extensions gooogle page from Banners & logos to videos and descriptions. We need to work on the descriptions and also make better looking screenshots and banners to properly show off what it does. 8) I was also thinking of adding a 'paypal donation' button in somewhere so that if anyone particularly wanted to they could give some money :) Just an idea not sure how it would work yet.

Write a comment on your thoughts about the points :) And maybe come up with some more!

zystvan commented 8 years ago

@A-J-C

  1. I think combining the two Discuss ones would be good
  2. Like, browser tabs? What do you want to be doing with those?
  3. I've thought about it a little. If we do that though, I think we should find a lighter-weight framework that still lets us do JSON stuff as easily because doing that in pure JS isn't going to be fun
  4. Yes! I think if we do that we can have the code identical between the FF & Chrome versions, which'll make contributing to either much easier
  5. I don't want to combine the CSS sheets. It's already somewhat hard to find a certain rule in the forum one, & I like keeping the stuff for one part of the site separate from the other part of the site.
  6. Yeah, moving that back down to two JS files would probably be good
  7. Not my area of expertise at all, but I'm happy to help as much as I can when needed :)
A-J-C commented 8 years ago

@zystvan 2. I'm saying we currently have permissions for tabs. Not sure why, I didnt add it.

zystvan commented 8 years ago

@A-J-C Weird. Probably should be removed, but I'll check the code & see if there was a reason for it.