Javascript OAuth and Opera Link - javascript

I am writing a Chrome extension that synchronizes with Opera Link, but I keep struggling with OAuth. I have tried three different OAuth libraries, but they don't work.
These libraries are:
http://oauth.googlecode.com/svn/code/javascript/
https://github.com/bytespider/jsoauth
http://code.google.com/chrome/extensions/tut_oauth.html
All of them can't fetch client tokens. I have only read-only access when I use the first and insert the tokens.
"javascript oauth opera link" doesn't give results in Google.
(EDIT:) My question is: has anyone had luck in using Opera Link in pure JavaScript, or does anyone know what the problem is?
EDIT2: this doesn't work for me: application that uses OAuth and javascript. I can use it if I get 'token' and 'tokenSecret' with the Python API debugger, but only read-only. I can't for example add new bookmarks.

I just put my Opera Link JavaScript library up at https://github.com/ChaosinaCan/OperaLink.js. (It's the one emanchado linked to)
I've only tested some of the bookmark functions so far, so please tell me if anything doesn't work.

Hey there!
The other day I made an Opera extension work with the Opera Link API: https://github.com/emanchado/Javascript-OAuth-experiments
Have a look at both the extension code itself, and https://github.com/emanchado/Javascript-OAuth-experiments/blob/master/oauthtest.js (also oauthtestget.js for a GET request example).

The Opera Link API introduction article gives information and specifically a debugger python script. I might help to understand your code issues.
It would help also if you could provide a bit of code.

Related

How to call function inside a firefox add on from another firefox add on

I am working on a project in my company and I have to decide on whether to build a web application or a firefox add on that would be then published.
The major motivation behind building a firefox addon is being able to call functions inside other add ons.
Excuse me if I am saying something stupid, I have no experience with firefox or add ons and couldn't find anything useful. I would be very grateful for any information, or even a hint on where to start my research.
Thank you very much for your answers.
Answer 1 is more of an old-school approach to building add-ons for Firefox. There is a newer, more web-like api Mozilla has been working on called the Add-on SDK:
https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/index.html#getting-started
This is the place you need to go if you need information on building Firefox addons or extensions
https://developer.mozilla.org/en-US/docs/Building_an_Extension
And MDN docs are one of the most complete docs for JavaScript, which you will be using a lot for the extension. Most of your doubts should be cleared there.

How to trigger the "yellow prompt" in Google Chrome or Chromium?

Sometimes while browsing websites using Chrome, you can see a yellow prompt showup. How can I trigger that prompt for my own websites?
For example try going to the The Independent's website and you will be prompted "The Independent now has a Google Chrome Extension. Get the latest news on the topics you like, direct to your browser."
I have previously seen this prompt on Google.com as well, however I assumed that that was something internal for google only websites. This is the first time I have seen the prompt for Non-Google owned websites.
It's a custom look-a-like they've made. Take a look at their javascript file here: http://www.independent.co.uk/independent.co.uk/editorial/javascript/tb.js
It does most of the work. You might be able to get some ideas from there :)
I assume you need to check this question: Chrome - Notify User to install your extension
Looks like there are no standard API for defining extension available for particular site – so you need to imitate such behavior with JS.
If I made a mistake, feel free to correct me in comments.
You are looking for the Infobars API, but this feature is only available for extensions.

Create Internet Explorer extension changing content of a webpage

I'd like to develop an Internet Explorer extension that changes the content of a specific webpage, like content scripts in Google Chrome. (eg. when I go to the website Google and I search for "car" I'd like to have a div created on the page with the word "car" inside).
I've been looking on SO but haven't found clear evidences if this kind of thing is possible.
What I'm specifically looking for is a clear tutorial or some example of how to do this.
Bruno,
That is exactly what GreaseMonkey for IE is made for http://www.gm4ie.com/
I have answered a similar question, but the answer is in C#. It describes how to create a fully working project to accomplish exactly what you asked: changing page contents!
How to get started with developing Internet Explorer extensions?
It covers other topics too:
running javascripts from the addin
how to register IE addins
saving data (addin configurations)
You can read more about Internet Explorer Extension from MSDN:
http://msdn.microsoft.com/en-us/library/aa753587(v=vs.85).aspx
Extensions in IE are not created using web technologies, they are created using C++/.NET. Such as ActiveX
Similar to "GreaseMonkey for IE" is Trixie:
Trixie is to Internet Explorer as Greasemonkey is to Firefox. It lets you remix the Web via scripts. You may do this to either make it more readable, fix bugs or to even add little features to make the site more usable to you. Trixie by itself does none of this. It is just a plugin for Internet Explorer that enables executing chunks of JavaScript code and thus lets you use the Web the way you want to use it.
This is one of the best I found. http://www.enhanceie.com/ie/dev.asp It has give sample scripts as well. Which will help you.
Another one is open source and stable version : firebreath
same kind question is also asked How to get started with developing Internet Explorer extensions?
This is a working example of manipulating the DOM from microsoft. This is a BHO development with MS Visual Studio. Check it out: http://msdn.microsoft.com/en-us/library/bb250489%28v=vs.85%29.aspx

Firebug how to (For addons/extensions)

Can anyone recommend a tutorial on how to use firebug with Firefox Addon development?
Most google and youtube searches only give me results on how to use it for webpages :(
My main requirement right now is to see and modify if my addon is saving to localstorage.
Thanks!
http://getfirebug.com/wiki/index.php/Firebug_Internals#How_to_write_a_Firebug_extension.3F
and more links from that page eg: http://www.softwareishard.com/blog/category/firebug/

Is there a way to port a chrome extension to other browsers?

Is there a way to port a chrome extension to other browsers, without having to entirely re-write the code? My chrome extension uses the browser_action command to open "popup.html" in the extension window...
Update: I found adblockforchrome port.js and found it only somewhat helpful for porting to Safari...
Apple provides some guidance on how to port convert a Chrome extension to Safari, but the problem you're going to run into is that each browser has a different set of allowed functionality for extensions. Even with Chrome to Safari, there are things you could do in Chrome you can't do in Safari, and visa versa.
It depends on the type of the extension, but not really. To answer your question more clearly, you need to specify what your extension is about: modify some pages (like userscripts/userstyles), extend browsers' features, or something else.
There are a few portability notes, however, that could help you to simplify this process:
Don't write browser specific code. In some modern browsers you're able to use HTML5 features, like Web SQL Database API. It is difficult to emulate such behaviour on IE, for instance.
Keep your JavaScript modular; don't use vendor specific JavaScript methods, and your code will be portable and will not rely on TraceMonkey or V8;
Separate HTML from CSS and Javascript, don't make your code dirty and complicated.
Jumping in a bit late.
Our company - Slice Factory (full disclosure here!) does provide a browser extension conversion service: http://gallery.extensionfactory.com/labs/conversion/
In most cases your chrome extension will work seamlessly in FF and Safari.
The service is still in beta trial, and Firefox conversion is working better than Safari one.
I can't fully disclose what's our technical solution, but this being an SO answer, I can add a few details: we have re-developed a full javascript api stack that mimics most of chrome extension APIs for Safari and Firefox; in Firefox we base our work on JetChrome. Plus we have wrappers that re-package the chrome extension adding our library and rewriting manifests and so on.
Beyond that, it's mostly a few good ideas, trial and error, and a LOT of development time.
As an example:
Safari 5.1 just introduced a popup corresponding to Chrome's browser_action, but we have already an alternative solution that works for previous versions. Firefox does not support HTML5 WebSQL, but we have an API for it. We also provide a way to bring webapps to FF, and soon to Safari.
The objective is to have Chrome API as a reference, and mimic it on all the other browsers.
Without pushing you towards our solution, I might add that the time to fully cover the Chrome API on both Safari and Firefox is probably not worth it - unless you plan to convert several extensions. So for just one or two extensions I would advise making your code as modular as possible, and just creating three extensions - or trying our service!
Yes, it's possible with Webextension API using webextension-polyfill.
I made use of it to build this where I only had to change the callback methods to Promises and using browser.something instead of chrome.something to call the browser APIs.

Categories

Resources