Import/include another XUL file in XUL - import

I am writting an Firefox add-on in XUL and I want to include another XUL file within my browser.xul. In PHP I would use something like this: include("anotherFIle.php"); but I don't know the equivalent in XUL.
What is the best way to accomplish this?

XUL has an iframe similar to the HTML iframe. However, if you are just trying to add in some UI elements into the pre-existing UI, then look at overlays.

Raw file-includes ala PHP cannot be done in a lot of other languages. XUL is/isn't a imperative programming language so much as a markup language -- and includes just ain't gonnna fly.
You can use an iframe to include another html page, but I don't believe you can include local files, or other XUL.
See Using Remote XUL where you'll get this handy tip:
Support for remote XUL has long been a potential security concern; support
for it was removed in Gecko 2.0. This
also means you can't load XUL using
file:// URLs.
XUL tutorial: content panels suggests that you can include XUL via iframe, but I don't see any working example.

Related

Email Editor Similar to Campaign Monitor or Mailchimp's editor?

I looking for either an open source (or otherwise) php script/library/code that will provide me with a similar email composer that Mailchimp and Campaign Monitor have.
I've played around with lots of wysiwyg editors (eg: tinymce, ckeditor) but, they don't work very well for allowing users to compose emails.
Mosaico Editor is the first open source email template builder of this kind (AFAIK).
You can find a free to use deployment (working also as live demo) at http://mosaico.io and you can get sources at https://github.com/voidlabs/mosaico
I choose blocks from a set defined by the "master template", then you fill you contents and change their styles in a WYSIWYG style. If you're on a large window you can also have live preview for the mobile version.
The master template defines what are the blocks, what you can edit and what you can style and it contains any html trick to make it compatible with most clients: this means you can change the editor behaviour a lot by simply writing a new master template.
It is 99% javascript (IE10+, and any other modern browser) and depends on server-side functions only to do "final inlining" and "image upload/resizing"
Next generation tool for building templates without coding
Grapejs official site
GrapesJS is an open-source, multi-purpose, Web Builder Framework which combines different tools and features with the goal to help you (or users of your application) to build HTML templates without any knowledge of coding. It's a perfect solution to replace the common WYSIWYG editors, which are good for content editing but inappropriate for creating HTML structures. You can see it in action with the official demos, but using its API you're able to build your own editors.
I'm in the process of building one but as a designer it is a work in progress! I'd suggest looking at PHP template engines. They have a similar functionality. Most however will use php variables inside the html page instead of tags.
Another oprion is to check out Perch it is officially a CMS, but is really lightweight and might get the job done for you.
Hope that helps even though it is a year after you posted the question...
EDIT: Actually just stumbled across this thread which links to the new CKEditor - looks pretty cool.

SWFObject like setup for Unity

Is there a SWFObject type setup for embedding Unity content and having a fallback HTML content (with a link to install the plugin)?
The JS included with Unity only allows for a button they've created.
Here's the official guide
Basically, for non-IE browsers, you check that the plugin's installed using javascript, and for IE, you use VisualBasic scripting. Their code isn't terribly pretty (all those document.write calls - ugh!) but it's robust.
You can always take their code, clean it up and wrap it in a nicer package. I know I did (but for a client, so I can't give you the code - sorry)

Load firebreath plugin in Firefox extension without injecting anything in DOM

Is there any way to load firebreath plugin in firefox extension.I've seen one way by injecting html related to plugin into DOM as explain here(see "http://stackoverflow.com/questions/5688904/scriptable-npapi-plugin-doesnt-work-with-firefox")
I think its better that extension will load plugin in background to avoid any security issues.
my plugin has nothing to do with drawing, its just send data to a specific port by calling a simple function.I'm new to extension development so any example will be helpful...
Sounds like you figured it out, but for the sake of any who find this question with the same issue: a NPAPI-based plugin (FireBreath or otherwise) can only be loaded inside of a DOM; however, in the case of a firefox extension (or Chrome extension for that matter) it doesn't have to neccesarily be the DOM of the web page, it could also be the DOM of the extension.
In this case, you can load the plugin in the XUL file.
It's also worth checking out this thread:
Using a plugin generated with Firebreath in a Firefox Extension?

How to begin using HTML DOM

I have trouble understanding how some things are related.
For a Wordpress plugin, I would like to use HTML DOM on content from wp_remote_open to find a string.
In order to use DOM, does it have to be enabled by my webhost? or do I include a DOM parsing script with the plugin?
I was thinking that if it needs to be enabled by the webhosting company, I would rather use a regular expression to find the string because then it would be compatible for everyone's installation.
DOM has nothing to do with your hosting provider or infrastructure. It is merely a model representing your HTML document. Most modern browsers support DOM. See more at the XML DOM introduction

GWT and templating engine

I want to design a website using GWT. This is my understanding of how GWT pages will be delivered to the client browser - When the user puts in the URL into her browser she receives all the static HTML + GWT javascript, and then the javascript queries the server for the dynamic page content and adds it to the DOM. eg - For a blog page the content of the blog is queried by the javascript. is my understanding correct?
If I know that the content will surely be a part of the page(add does not depend on user clicking an expand button etc.), Will it be more efficient if the blog content was a part of the HTML initially served? Something that could be done by using a templating engine like django.
Is there a way to make a templating mechanism in GWT?
Yes, putting your content into the HTML will reduce the number of round trips the client makes to your server. It also means that the blog content won't have to wait for your GWT javascript to load before it can be displayed.
GWT itself isn't useful for a template system, but most servers that run GWT servlets will also support JSP pages. GWT works fine with these pages, you just need to put the GWT script tag in as usual. You will no doubt be able to find a ready-made templating solution but rolling your own is not too hard.