how to create simple bookmarker firefox addon - firefox

I don't know why creating firefox addons is difficult. Maybe it's not my duty to create a new addons for company.
After 2 week in searching how to create firefox addons, I should say I don't know.
We need a simple addons for sending url of visited site to our server with a little information.
It should have a form with some fields : title, description and a selection area with submit button.
When clicking submit it should send these information with url of this page to our server.
How can I do this?

You will want to use page-mod - https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/SDK/High-Level_APIs/page-mod
You should insert a content script, which will port message back to your main.js telling it the information of that web page. Docs on port - https://developer.mozilla.org/en-US/Add-ons/SDK/Guides/Content_Scripts/using_port#port.emit%28%29
When your main.js receives that message, then you would use the request module to send it to your server. https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/SDK/High-Level_APIs/request
Now to get started follow this very simple guide to make your first addon - https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Getting_Started_%28jpm%29

Related

Find navigation/redirect request with DevTools after button click that executes javascript/ajax

The question is probably easily misunderstood, so I'll go into more detail:
I am trying to automate a task in a certain (very outdated) browser-based idle game that is written in PHP in order to polish my portfolio with a little more variated projects.
I used DevTools to reverse most of the requests and wrote a small C# Request wrapper to test them. I can get most of the actions I want to work, using the respective ajax get requests and the correct cookies/headers - not really part of the problem.
Example:
Attacking an enemy:
https://somebrowsergame.com/game/ajax.php?mod=location&submod=attack&location=3&stage=2&premium=0&sh=****mysessionhash****
Making a GET request to this URI with the correct headers and cookies, I can perform the in-game action programmatically and successfully from my C# console application and see that the fight has taken place when visiting the site in the browser.
The problem:
When monitoring all requests after clicking the "attack" button, via DevTools, even with preserve logs enabled, I don't see any redirects or way of determining how my browser gets told where to navigate to.
Findings
I found out that the button calls a javascript function attack() in its onClick event and tried debugging the javascript in DevTools in order to find out where somethign happens (such as setting document.href or smth), but when Debugging I ran into a seemingly infinite loop of setInterval handler and setTimeout handler in the call stack.
I also cleared the Network tab after the onClick event (and after the ajax request which I could find during Debugging) but the only request/response I got was the document GET request for the final page, no request telling my browser which site to navigate to.
Monitoring requests
The request made to initiate the action (via button click on website or ajax GET request as outlined above)
The document response / site navigated to
What I want to know is how my browser got told which site to navigate too, as the request URI for the document request (getting the html of the target page) has a parameter generated on the server side (logId)
I have also used "All" request types in DevTools, as well as negative filters when monitoring requests but never was I able to see how my browser knows which page to navigate to. I tried with source breakpoints at "beforeunload", tried inspecting the javascript source connected to the onclick event of the button (which didnt give me anything, as the js is minified and barely readable - i am not even sure if the navigation is done via window.target.href) and googled this question in all possible wordings which lead me nowhere
I am not too versed in web development, but I am sure my browser has to be told where to navigate to in some fashion after clicking that button?

ClickFunnels integration with rails2 app

Is there a way to create a page in ClickFunnels(https://www.clickfunnels.com/) website and when I submit that page, I need to store the form details in my rails app(into a particular table). Which means I want to display my database in the clickfunnels integrations list. I googled hours but couldn't get much information on this.
can anyone suggest me if you have done this. A reference link also much appreciated.
We couldn't find any way to do this inside clickfunnels itself, if there is a easy way to add custom systems to their integrations I too look forward to seeing those answers. Until then, here's what we did: We just put our custom form on their page and used ajax to send it back out the end point in our system it needed to hand that data too.
Then, since we also needed to submit the same info to click funnels, we build a fake CF form(I think we actually put one on the page, but used CSS to hide it, then filled it out dynamically from our custom form), and call submit on that form, sending the user through the normal click funnels submission process and sending them to the next page in the funnel.

Firefox addon - is it possible to capture text/html from the webpage?

I have never wrote a firefox addon so I am wondering if this can be done. Is it possible to continually scan a webpage for certain text, and then if that text appears, capture it and save it to a file?
For example
Say a user is on amazon and adds a few items to their shopping cart.
They click checkout and fill in their details and click submit order.
When the order is processed the user is shown the text 'Order complete' and given a receipt of their purchase.
In this example I would like to keep scanning the webpage until 'Order complete' appears. Then I want to capture the html of the receipt and save it to a file.
Is this possible with a firefox addon?
From my experience as a Firefox user, this is definitely possible. As a matter of fact there are add-ons that do far more than that.
For example, Greasemonkey can actually act as a filter and change the content of a viewed webpage as specified by a user script. Zotero and AlertBox are able to selectively watch specific HTML elements for interesting information and act upon it.
It is also quite possible that there is an existing add-on that either does what you need already, or can be used as a basis for a custom add-on of your own - what you are asking for is not all that unusual...
You probably want to create your add-on with the Add-on SDK. You can then use the page-mod package to attach a content script to Amazon pages. The content script should check whether it got loaded into an order confirmation page - and send the HTML code of that page (probably document.body.innerHTML) back to the extension.
The extension then needs to write the data to a file. You need to use internal API for that, something like this:
var file = require("file");
var writer = file.open("c:\\foo\\bar.html", "w");
writer.writeAsync(data);
If you want the user to choose the file name, you can do this using chrome authority and nsIFilePicker component.

Alfresco share page state history

How can I manage page state history in share (surf?) so that I remember for example which yui tab was active and on which page the pager was on?
I noticed that alfresco share does something like that after form submit. You get redirected to the exact same page url where you were before. If any "ajax state" (don't know what they are called) parameters are in url like #something=asdf you get the same url.
But when using manual navigation like moving through site pages those parameters aren't saved.
Is this even a good idea to do? To save page state in session for example?
Some pages have support for URL parameters that are passed in. In those cases the browser history is used, e.g. we editing metadata in the full page meta data view the user is send back to the page he is coming from. This is done in javascript by calling window.history.go(-1) after form submit but only works when parameters are set/retrieved by URL. The document library implements page specific javascript for setting the URL and parsing parameters from it.
I some places Alfresco uses the preference service to store user settings between different pages permanently. For example this is used in the document library for the "show folders" and "simple/thumbnail view" buttons. Here is some sample code from the document library javascript setting a preference option:
var PREFERENCES_DOCLIST = "org.alfresco.share.documentList",
PREF_SHOW_FOLDERS = PREFERENCES_DOCLIST + ".showFolders";
var preferences = new Alfresco.service.Preferences();
this.services.preferences.set(PREF_SHOW_FOLDERS, true);
The evaluation of the properties is usually done in the Share component webscripts, you can have a look in share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\documentlibrary\include\documentlist.lib.js for an example.
In any case you have to dig into Alfresco's javascript code in the browser and the share tier to see how to implement it.
You could check parameters sended to the server side after form submiting in the firebug (firefox plugin) and then you could use the same parameters.
Also perhaps you should use yui history manager:

Can I make simplemodal contact form post across domains?

I'm using the SMCF Wordpress plugin on this site: http://fingelly.com/
As you can see it uses ajax to post the form fields to get mailed and then updates the modal.
Some of the nav options at the site take you to a 3rd party IDX (real estate listings) provider. For example click on the tabs marked agents and the url changes to fingelly.idxre.com...
As you can see the html is customizable there... I had tried adding the same simple modal contact form to my template there but encountered a problem because I cannot post using ajax to my wordpress driven site from this other domain.
I understand this limitation is for security reasons to prevent xss. How would you suggest working around it in this case?
For now we've simply removed the contact tab.
If you just need to send information to the server and not worry about the response, you create a hidden iframe on the page and post the data there. You could also make a JSONP call if the data would fit in a GET.

Resources