Inject JS file from FireBreath plugin? - npapi

I have FireBreath plugin, and some JS file in it. What I'm trying to do, at some point , inject that JS file using plugin. How is it possible to inject that js file using plugin? If you can please provide example, I'm new at it.
I need same behavior like NPN_Evaluate does, are there any FireBreath API for that?
P.S. I'm aware of extensions, but for this particular case I need inject JS from plugin.
Thanks in advance.

BrowserHost::evaluateJavascript()
From your main plugin class you can call this with m_host->evaluateJavascript(jsVar);
If you're trying to inject a file you'll have to load it from disk. Another way, of course, would be to inject a script tag that loads it from disk, but that might require injecting javascript to do that with, 'cause I'm not sure if you can actually inject a script tag entirely through the plugin.

Related

code to edit jmeter jmx file in html

I am working on a application where want to open Jmeter test plan (.jmx file) in html5 page so that it can be opened/edited in web browser. Please guide me what would be the best approach and technologies to use. I am considering Javascript and JQuery for this purpose.
Any suggestion or guidance will be a great help.
Thanks
My first idea was that something like this a Online XML Editor must exist.
Open this URL and place the File over Load URL
Then work on the XML Nodes and Save later the result over Button Download.
Complete Example here
http://codebeautify.org/xmlviewer/cbf7710f
The other Idea I had was to load the xml over JQuery as you already mentioned. Then place the content on textbox and edit it. After this copy-paste to a editor and save it.
Use this Example
http://www.jquerybyexample.net/2012/04/read-and-process-xml-using-jquery-ajax.html
You can check this new tool called BlocklyJMX which enables you to edit JMeter file online using the browser.

ClojureScript google closure code splitting partial loading

I'm coming from a javascript/react/react-router/webpack background to a clojurescript/om environment.
With webpack & react-router it was possible to split my code and only load the javascript needed. E.g. on /login I would only load the js necessary to display the login-page everything else would be left out.
How do I the same with clojurescript/om?
Apparently it's possible to split your code into multiple files: https://github.com/clojure/clojurescript/wiki/Compiler-Options#modules
The question is how do I only load the code necessary to render the current page: /login for example...
With webpack I would manually write require.ensure to asynchronously load the necessary javascript to render a certain page. React Router supports this very well.
Is there any equivalent in clojurescript without making multiple html files and each giving it the right script tag with the splitted code through google closure modules?
Sadly I don't have a concrete example yet, and I agree that webpack and react-router make this really easy. There are some links that may direct you to get it working:
Code splitting: http://swannodette.github.io/2015/02/23/hello-google-closure-modules
Manually adding script tags to html files
Actual docs: https://github.com/clojure/clojurescript/wiki/Compiler-Options#modules
Dynamic loading of cljs modules: https://rasterize.io/blog/cljs-dynamic-module-loading.html
Uses multi-methods for route definitions to dynamically add implementations when loading more code
Dense read, there is no easy tooling regarding this use case right now, but the article has all clues to get it working
I hope this helps. If you get around to implementing this in an OSS example it would be great if you could share the link.

How to Access DOM of new web page opened in Chrome

i am writing a NPAPI plugin for that i am using NPSIMPLE sample code from google chrome. i have to get the DOM of web page opened in the chrome browser. My plugin solution also includes background.html file. which when i open in chrome browser calls a method in NPAPI plugin. so my plugin can get the URL of this file. now i want to read the DOM structure of this File.
i have few questions:
when a new page is opened in browser by user how i have to embed my plugin to that page and get the DOM of that page?
whenever a new tab is opened how can i get the notification in My plugin?
How to get the DOM mutation notification to my plugin?
Does NPAPI provides API to get the DOM mutation notification or Content Script is the only option? if content script is the only option then how to establish communication between plugin and content_script?
i am trying to get this answers as well. any help greatly appreciated...
thanks in advance...
1) The only way you could do this automatically would be to put the plugin inside an extension and do it with the extension.
2) You can't, since plugins don't know anything outside of the page they are in. You might be able to jury-rig something using an extension, I suppose, but I'm not sure if that's possible or not.
3 and 4) Your best bet is probably to figure out how to get these notifications with javascript and inject javascript that will call back into your plugin.
Sounds like one of your main sticking points is that you aren't clear on what a plugin can do; you may want to read up a bit.

Any way to dump JavaFX FXML UI as a static HTML page?

We are building a JavaFX desktop app which is made themeable from the get-go with external CSS files. Now we'd like to give our designers (who are not programmers) some opportunity to tweak the look of the app without having to install JFX, NetBeans and restart the app each time.
Is there some way to dump the static FXML look of the UI as a HTML file of some sort? Basically so that the designer can tweak the CSS and refresh the look with F5.
AFAIK, the Scene Builder supports CSS, so there should be no need to transform FXML to HTML.
Otherwise you could write a XSL script or a Java programm (e.g. using StAX) to do the transformation, but that would be quite a bit of work, I guess.

How do i allow the user to select more than one file for upload?

Gmail just released an update to their interface allowing the user to select more than one file for upload by using the CTRL-button. How do they do that? You can read about the new feature and see a screen shot here:
http://gmailblog.blogspot.com/2009/02/updates-to-attachments-multi-select-and.html
You will need to find flash-based sollution, like Google did with Gmail. You can try this jQuery plugin that offers exactly that: jQuery File Upload Plugin
Adobe Flash Player.
Here's a good library that I used: SWFUpload
Of course this is a JavaScript library, and not a jQuery plug-in, making it much more portable.
Take a look at RFC 1867 It defines how to upload files over HTTP using the multipart/mixed encoding. You can use the Apache Commons FileUpload library to do this in Java. I don't know how Google does it, but you can manage the multiple selects with JavaScript processing in your page.
Not the method Gmail uses, but the following link, combined with some jquery you can allow an unlimited number of files to be uploaded at the same time: Link
Google isn't using Flash, but actually some clever javascript (well, that IS what they're all about it seems :-) ). Using javascript and css, you can create a file chooser that lets the user select the file to upload. Then, you use a hidden iframe. The act of posting the form with your upload file targets the hidden iframe so that the result returned from the server on success goes into that hidden iframe. Using javascript, monitor the document body of that iframe to know when the file is uploaded.
This link appears to be a quick example of the basic concept: http://www.seemysites.net/projFolder/uploader/