public
Description: Makes mailto: links load your webmail's compose page and adds a Compose link to the context menu.
Homepage: http://github.com/kommen/webmailcompose/
Clone URL: git://github.com/kommen/webmailcompose.git
Click here to lend your support to: webmailcompose and make a donation at www.pledgie.com !
webmailcompose / src / install.js
100644 56 lines (50 sloc) 2.238 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* ***************
Desc: Installation script
Author: Jed Brown (mozilla@jedbrown.net)
****************** */
const author = "Jed Brown";
const displayName = "WebmailCompose";
const name = "webmailcompose";
const version = "0.6";
var contentFlag = CONTENT | PROFILE_CHROME;
var error = null;
var folder = getFolder("Profile", "chrome");
var localeFlag = LOCALE | PROFILE_CHROME;
var skinFlag = SKIN | PROFILE_CHROME;
var jarName = name + ".jar";
var existsInApplication = File.exists(getFolder(getFolder("chrome"), jarName));
var existsInProfile = File.exists(getFolder(folder, jarName));
const SUCCESS_MESSAGE = " has been Installed!";
 
initInstall(displayName, name, version);
 
// If the extension exists in the application folder or it doesn't exist in the profile folder and the user doesn't want it installed to the profile folder
if(existsInApplication || (!existsInProfile && !confirm("Do you want to install the extension into your profile folder?\n(Cancel will install into the application folder)")))
{
    contentFlag = CONTENT | DELAYED_CHROME;
    folder = getFolder("chrome");
    skinFlag = SKIN | DELAYED_CHROME;
}
 
setPackageFolder(folder);
error = addFile(author, version, 'chrome/' + jarName, folder, null);
// If adding the JAR file succeeded
if(error == SUCCESS)
{
    folder = getFolder(folder, jarName);
    registerChrome(contentFlag, folder, "content/webmailcompose/");
    registerChrome(skinFlag, folder, "skin/classic/webmailcompose/");
    registerChrome(localeFlag, folder, "locale/en-US/webmailcompose/");
 
    error = performInstall();
 
    // If the install failed
    if(error == SUCCESS || error == 999)
    {
      alert(displayName+" "+version+" has been succesfully installed.\n"+displayName + SUCCESS_MESSAGE);
    }else{
      alert("Install failed. Error code:" + error);
      cancelInstall(error);
    }
}
else
{
alert("The installation of the extension failed.\n" + error + "\n Failed to create " +jarName+ " \n"
+"Make sure you have the correct permissions");
cancelInstall(error);
}