Skip to content

Commit

Permalink
"There is no Dana, there is only Zhul."
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentj committed Dec 12, 2012
0 parents commit ed5e018
Show file tree
Hide file tree
Showing 10 changed files with 257 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
*.komodoproject
53 changes: 53 additions & 0 deletions README.md
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,53 @@

# SlimerJS

SlimerJS will be an extension for Firefox, allowing to execute an external javascript script which
can manipulate web content.

Its goal is to provide a tool like [PhantomJs](http://phantomjs.org/), with the same API, except that
it runs Gecko instead of Webkit, and it is not headless (but you can still use xfvb to have a headless SlimerJS).

You could then use other tools like CasperJS...

For the moment, it is only a ghostware.

# Install

Click on this invisible-not-existing-yet link ?

# Launching SlimerJS


```
firefox --slimerjs
```

It only opens a window with nothing in it (Probably you could see a ghost...)

In the future, you could indicate a script to execute:

```
firefox --slimerjs myscript.js
```



# Content of a script

See [Documentation of PhantomJS](https://github.com/ariya/phantomjs/wiki/Quick-Start), although it
doesn't work yet.

You could use the [API of PhantomJS 1.7](https://github.com/ariya/phantomjs/wiki/API-Reference), it
is not yet implemented.


# FAQ

- Why is it not Headless?
- Gecko, the rendering engine of Firefox, cannot render web content only in memory, without a window.
See [Mozilla bug 446591](https://bugzilla.mozilla.org/show_bug.cgi?id=446591).
- Why is it called "SlimerJs"?
- Slimer is the name of a ghost in the film "GhostBusters". As you may now, the Firefox source code use
many references from this film, and since PhantomJS, CasperJs and other related tools, its a matter of ghost...


48 changes: 48 additions & 0 deletions src/bootstrap.js
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,48 @@

/*
data = { id: "string",
version: "",
installPath: nsiFile,
resourceURI: nsIURI
}
*/


/*
* Reason types:
* APP_STARTUP
* ADDON_ENABLE
* ADDON_INSTALL
* ADDON_UPGRADE
* ADDON_DOWNGRADE
*/
function startup(data, reason) {

}
/*
* Reason types:
* APP_SHUTDOWN
* ADDON_DISABLE
* ADDON_UNINSTALL
* ADDON_UPGRADE
* ADDON_DOWNGRADE
*/
function shutdown(data, reason) {
}
/*
* Reason types:
* ADDON_INSTALL
* ADDON_UPGRADE
* ADDON_DOWNGRADE
*/
function install(data, reason) {
}
/*
* Reason types:
* ADDON_UNINSTALL
* ADDON_UPGRADE
* ADDON_DOWNGRADE
*/
function uninstall(data, reason) {
}
7 changes: 7 additions & 0 deletions src/chrome.manifest
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,7 @@
content slimerjs chrome/slimerjs/content/
locale slimerjs en-US chrome/slimerjs/locale/en-US/
resource slimerjs modules/

component {00995ba2-223f-4efb-b656-ce98aff7019b} components/commandline.js
contract @mozilla.org/commandlinehandler/general-startup;1?type=slimerjs {00995ba2-223f-4efb-b656-ce98aff7019b}
category command-line-handler m-slimerjscli @mozilla.org/commandlinehandler/general-startup;1?type=slimerjs
34 changes: 34 additions & 0 deletions src/chrome/slimerjs/content/slimerjs.css
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,34 @@
#hauntedwall {
text-align:center;

}


#hauntedwall image {
transition-property: width, height, opacity;
transition-duration: 8s;
opacity:0;
width:10px;
height:10px;

}

#hauntedwall:hover image {
opacity:0.3;
width:320px;
height:320px;
}
/*
@keyframes slidein {
from {
opacity: 0;
width: 20px;
height: 20px;
}
to {
opacity: 0.7;
width: 100px;
height: 100px;
}
}*/
Binary file added src/chrome/slimerjs/content/slimerjs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions src/chrome/slimerjs/content/slimerjs.xul
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<!DOCTYPE window SYSTEM "chrome://slimerjs/locale/slimerjs.dtd">
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://global/skin/applications" type="text/css"?>
<?xml-stylesheet href="slimerjs.css" type="text/css"?>
<window xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="slimerjswin" hidechrome="false" title="SlimerJS"
windowtype="slimerjs"
align="center" pack="center"
width="600" height="400"
>
<stack id="hauntedwall" width="320" height="320">
<html:div>
<html:h1>&slimerjs.title;</html:h1>
<html:h2>&slimerjs.slogan;</html:h2>
</html:div>
<image src="slimerjs.png" width="50" height="50" />
</stack>

</window>
2 changes: 2 additions & 0 deletions src/chrome/slimerjs/locale/en-US/slimerjs.dtd
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,2 @@
<!ENTITY slimerjs.title "SlimerJS">
<!ENTITY slimerjs.slogan "Haunt your Firefox">
58 changes: 58 additions & 0 deletions src/components/commandline.js
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,58 @@

Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");

function slCommandLine() {

}

slCommandLine.prototype = {

classID: Components.ID("{00995ba2-223f-4efb-b656-ce98aff7019b}"),
classDescription: "Command line handler for SlimerJS",
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsICommandLineHandler]),

// ------- nsICommandLineHandler interface

handle : function (cmdLine) {

if (!cmdLine.handleFlag("slimerjs", false)) {
return;
}

cmdLine.preventDefault = true;

if (cmdLine.length > 1) {
Components.utils.reportError("two many arguments");
return;
}

if (cmdLine.length > 0) {
// script parameter
let scriptFileName = '';
let scriptFile = null;
try {
scriptFileName = cmdLine.getArgument(0);
if(scriptFileName) {
scriptFile = cmdLine.resolveFile(scriptFileName);
}
}
catch (e) {
Components.utils.reportError("incorrect script filename ("+e+")");
return;
}
}

Services.ww.openWindow(null, "chrome://slimerjs/content/slimerjs.xul", "_blank",
"chrome,menubar,toolbar,status,resizable,dialog=no",
null);
},

helpInfo : " --slimerjs launch SlimerJS instead of Firefox\n"

}

var NSGetFactory = XPCOMUtils.generateNSGetFactory([slCommandLine]);



33 changes: 33 additions & 0 deletions src/install.rdf
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<RDF:Description about="urn:mozilla:install-manifest">
<em:creator>Laurent Jouanneau</em:creator>
<em:description/>
<em:homepageURL/>
<em:aboutURL></em:aboutURL>
<em:iconURL/>
<em:id>slimerjs@innophi</em:id>
<em:name>SlimerJS</em:name>
<em:version>0.1</em:version>
<em:updateURL/>
<em:type>2</em:type>
<!--<em:bootstrap>true</em:bootstrap>-->
<em:targetApplication>
<RDF:Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>16.*</em:minVersion>
<em:maxVersion>18.*</em:maxVersion>
</RDF:Description>
</em:targetApplication>
<!--<em:optionsURL/>
<em:targetPlatform/>
<em:updateKey/>
<em:hidden/>
<em:localized>
<RDF:Description><em:locale/><em:name/><em:description/></RDF:Description>
</em:localized>
<em:localized><RDF:Description><em:locale/><em:name/><em:description/></RDF:Description></em:localized>
<em:localized><RDF:Description><em:locale/><em:name/><em:description/></RDF:Description></em:localized>
<em:localized><RDF:Description><em:locale/><em:name/><em:description/></RDF:Description></em:localized>-->
</RDF:Description>
</RDF>

0 comments on commit ed5e018

Please sign in to comment.