1
const APP_DISPLAY_NAME = "Flashblock";
2
const APP_NAME = "flashblock";
3
const APP_PACKAGE = "/Ted Mielczarek,Ted Drake/flashblock";
4
const APP_VERSION = "1.3.9a";
5
const APP_DEFAULTS = "Flashblock Defaults";
7
const APP_JAR_FILE = "flashblock.jar";
8
const APP_CONTENT_FOLDER = "content/flashblock/";
9
const APP_SKIN_FOLDER = "skin/classic/flashblock/";
11
const APP_SUCCESS_MESSAGE = "Flash objects will now be replaced with a button that you can click on to view them.\n\n";
15
var contentFlag = CONTENT | PROFILE_CHROME;
16
var localeFlag = LOCALE | PROFILE_CHROME;
17
var skinFlag = SKIN | PROFILE_CHROME;
20
"en-US", "it-IT", "nl-NL", "de-DE", "fr-FR", "pl-PL", "ko-KR", "pt-BR",
21
"da-DK", "hu-HU", "cs-CZ", "es-ES", "ru-RU", "ro-RO", "de-AT", "ja-JP",
22
"zh-CN", "ar-YE", "ar-JO", "fi-FI", "sv-SE", "sk-SK", "zh-TW", "tr-TR",
23
"el-GR", "bg-BG", "te-IN", "ca-ES","is-IS"]
26
initInstall(APP_NAME, APP_PACKAGE, APP_VERSION);
28
// get user's profile chrome directory
29
var chromef = getFolder("Profile", "chrome");
30
var prefDir = getFolder("Program", "defaults/pref")
32
var err = addFile(APP_PACKAGE, APP_VERSION, "chrome/" + APP_JAR_FILE, chromef, null, true);
34
err = addFile(APP_DEFAULTS, APP_VERSION, "defaults/preferences/flashblock.js", prefDir, "flashblock.js", true);
35
// on unixy platforms, global defaults directory is not writable! Ignore this error!
36
if(err == ACCESS_DENIED || err == READ_ONLY) {
42
var jar = getFolder(chromef, APP_JAR_FILE);
43
registerChrome(contentFlag, jar, APP_CONTENT_FOLDER);
44
registerChrome(skinFlag , jar, APP_SKIN_FOLDER);
45
for (var i = 0; i < locales.length; i++) {
46
registerChrome(localeFlag, jar, "locale/" + locales[i] + "/"+APP_NAME+"/" );
49
err = performInstall();
50
if(err == SUCCESS || err == REBOOT_NEEDED) {
51
var gPlatform = getPlatform();
52
alert("Debug: We think your OS is: " + APP_PLATFORM);
53
if(gPlatform == 'unix') {
54
// var uxerr = setUnixPermissions();
55
// alert("Debug: setUnixPermissions returned with: " + uxerr);
57
msg = APP_NAME + " " + APP_VERSION + " has been succesfully installed.\n"
59
+"Please restart your browser to enable flashblock.";
62
else if(err == CHROME_REGISTRY_ERROR) {
63
msg = "Install failed. There was a Chrome Registry Error: " + err
64
+ ".\nPlease restart Mozilla and try installing "
65
+ APP_DISPLAY_NAME + " again.";
71
alert("Install failed. Could not performInstall. Error code:" + err);
76
alert("Install failed. Could not addFile: " + APP_JAR_FILE + ". Error code:" + err);
80
function getPlatform() {
81
var platformStr, platformNode;
83
if ('platform' in Install) {
84
platformStr = new String(Install.platform);
85
APP_PLATFORM = platformStr;
86
// Mac OS X (aka Darwin) is a real unix system
87
if (!platformStr.search(/.*Darwin/))
88
platformNode = 'unix';
89
else if (!platformStr.search(/^Macintosh/))
91
else if (!platformStr.search(/^Win/))
93
else if (!platformStr.search(/^OS\/2/))
95
else if (!platformStr.search(/unix|sun|linux/i))
96
platformNode = 'unix';
97
else if (getFolder("Unix Lib") != null)
98
platformNode = 'unix';
100
platformNode = 'unknown';
104
if (getFolder("Unix Lib") != null)
105
platformNode = 'unix';
106
else if (getFolder("Mac System")!= null)
107
platformNode = 'mac';
108
else if(getFolder("Win System")!= null)
109
platformNode = 'win';
111
platformNode = 'unknown';
116
function setUnixPermissions() {
117
initInstall(APP_NAME, APP_PACKAGE, APP_VERSION);
119
var chromeF = getFolder(getFolder("Profile", "chrome"), APP_JAR_FILE);
120
var cmdArgs = "u+rwx,go+r ";
122
alert("Debug: The next step will try to set unix permissions");
125
if (!File.isFile(cmdPath)) {
126
alert("Cannot find :" + cmdPath);
127
return DOES_NOT_EXIST;
130
cmdPath = getFolder("OS Drive");
131
if (!File.isDirectory(cmdPath)) {
132
alert("Cannot find OS Drive :" + cmdPath);
133
return DOES_NOT_EXIST;
136
cmdPath = getFolder(cmdPath, "bin");
137
if (!File.isDirectory(cmdPath)) {
138
alert("Cannot find bin directory:" + cmdPath);
139
return DOES_NOT_EXIST;
142
cmdPath = getFolder(cmdPath, "chmod");
143
if (!File.isFile(cmdPath)) {
144
alert("Cannot find chmod:" + cmdPath);
145
return DOES_NOT_EXIST;
148
cmdArgs = cmdArgs + chromeF;
149
alert( "Will perform chmod");
151
err = File.execute(cmdPath, cmdArgs );
152
} catch(e) { alert("Error executing chmod: " + e) };
153
if (err != SUCCESS) {
154
alert("chmod didn't work, Error :" + err + " " + cmdPath + " " + cmdArgs);
158
alert( "Will performInstall on setUnixPermissions");
159
err = performInstall();
161
alert("setUnixpermissions Error: "+ err + " " + cmdPath + " " + CmdArgs);
b'\\ No newline at end of file'