2 // By Pike (Heavily inspired by code from Henrik Gemal and Stephen Clavering)
3 // Modified by Jason for Evergreen
7 // --- Editable items begin ---
8 extFullName: 'Evergreen Staff Client Demo', // The name displayed to the user (don't include the version)
9 extShortName: 'evergreen', // The leafname of the JAR file (without the .jar part)
12 extLocaleNames: ['en-US'], //null, // e.g. ['en-US', 'en-GB']
13 extSkinNames: null, // e.g. ['classic', 'modern'] I have this broken
14 extPostInstallMessage: 'Success! Please restart your browser to finish the installation.', // Set to null for no post-install message
15 // --- Editable items end ---
22 var jarName = this.extShortName + '.jar';
23 var profileDir = Install.getFolder('Profile', 'chrome');
25 // Parse HTTP arguments
26 this.parseArguments();
28 // Check if extension is already installed in profile
29 if (File.exists(Install.getFolder(profileDir, jarName)))
31 if (!this.silentInstall)
33 Install.alert('Updating existing Profile install of ' + this.extFullName + ' to version ' + this.extVersion + '.');
35 this.profileInstall = true;
37 else if (!this.silentInstall)
39 // Ask user for install location, profile or browser dir?
40 this.profileInstall = Install.confirm('Install ' + this.extFullName + ' ' + this.extVersion + ' to your Profile directory (OK) or your Browser directory (Cancel)?');
44 var dispName = this.extFullName + ' ' + this.extVersion;
45 var regName = '/' + this.extAuthor + '/' + this.extShortName;
46 Install.initInstall(dispName, regName, this.extVersion);
48 // Find directory to install into
50 if (this.profileInstall) installPath = profileDir;
51 else installPath = Install.getFolder('chrome');
54 Install.addFile(null, 'chrome/' + jarName, installPath, null);
57 var jarPath = Install.getFolder(installPath, jarName);
58 var installType = this.profileInstall ? Install.PROFILE_CHROME : Install.DELAYED_CHROME;
61 Install.registerChrome(Install.CONTENT | installType, jarPath, 'content/' + this.extShortName + '/');
64 for (var locale in this.extLocaleNames)
66 var regPath = 'locale/' + this.extLocaleNames[locale] + '/' + this.extShortName + '/';
67 Install.registerChrome(Install.LOCALE | installType, jarPath, regPath);
71 var regPath = 'skin/' + this.extShortName + '/';
72 Install.registerChrome(Install.SKIN | installType, jarPath, regPath);
75 var err = Install.performInstall();
76 if (err == Install.SUCCESS || err == Install.REBOOT_NEEDED)
78 if (!this.silentInstall && this.extPostInstallMessage)
80 Install.alert(this.extPostInstallMessage);
85 this.handleError(err);
90 parseArguments: function()
92 // Can't use string handling in install, so use if statement instead
93 var args = Install.arguments;
96 this.profileInstall = false;
97 this.silentInstall = true;
99 else if (args == 'p=1')
101 this.profileInstall = true;
102 this.silentInstall = true;
106 handleError: function(err)
108 if (!this.silentInstall)
110 Install.alert('Error: Could not install ' + this.extFullName + ' ' + this.extVersion + ' (Error code: ' + err + ')');
112 Install.cancelInstall(err);
116 XpiInstaller.install();
118 Install.alert('The install.js file for Evergreen is currently broken for Mozilla browsers. Any volunteers for fixing this? The problem I see is with registering the skin component. The install.rdf for Firefox should work');
119 Install.cancelInstall(Install.INSTALL_CANCELLED);