-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.js
127 lines (108 loc) · 3.59 KB
/
install.js
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
var version = '1.0.2004081801',
displayName = 'Tabbrowser Extensions:Smooth Resizing Patch',
appName = 'tabextensions_smoothresize',
author = 'SHIMODA Hiroshi',
hasLangPack = true,
hasJLP = true;
var err = initInstall(
displayName,
appName,
version
),
UChrome = getFolder('Chrome'),
messages = loadResources('locale.inf'),
optionsMsg = ('options' in this && options.length ? loadResources('options.inf') : null ),
installedOptions = [],
files = [],
jarName = appName+'.jar',
contentFlag = CONTENT | DELAYED_CHROME,
localeFlag = LOCALE | DELAYED_CHROME,
skinFlag = SKIN | DELAYED_CHROME,
i;
var existsInGlobal = File.exists(getFolder(UChrome, jarName));
var existsInProfile = File.exists(getFolder(getFolder('Current User', 'chrome'), jarName));
var isNewType = File.exists(getFolder(UChrome, 'browser.jar'));
if ('newTypeOnly' in this && newTypeOnly && !isNewType) {
alert(messages.newTypeOnly);
cancelInstall(err);
}
else if (existsInGlobal && existsInProfile) {
cancelInstall(err);
}
else {
if (existsInProfile ||
(!existsInGlobal && confirm(messages.installToProfile))) {
UChrome = getFolder('Current User', 'chrome');
contentFlag = CONTENT | PROFILE_CHROME;
localeFlag = LOCALE | PROFILE_CHROME;
skinFlag = SKIN | PROFILE_CHROME;
}
logComment('initInstall: ' + err);
setPackageFolder(UChrome);
// if (File.exists(getFolder(UChrome, jarName))) {
// alert(messages.exists);
// cancelInstall(err);
// }
// else {
var i = 0;
addFile(author, 'chrome/'+jarName, UChrome, '');
var folder = getFolder(UChrome, jarName);
files.push(folder);
registerChrome(contentFlag, folder, 'content/'+appName+'/');
if (('widgetsName' in this && widgetsName) ||
('bindingsName' in this && bindingsName)) {
if (
isNewType &&
(
Install.buildID < 2003111900 &&
!File.exists(getFolder('Program', 'firefox.exe')) &&
!File.exists(getFolder('Program', 'firefox-bin.exe')) &&
!File.exists(getFolder('Program', 'firefox')) &&
!File.exists(getFolder('Program', 'firefox-bin'))
)
) {
if (widgetsName)
registerChrome(contentFlag, folder, 'content/'+widgetsName+'/');
}
else if (bindingsName)
registerChrome(contentFlag, folder, 'content/'+bindingsName+'/');
}
if ('options' in this && options.length) {
for (i = 0; i < options.length; i++)
{
if (confirm(optionsMsg[options[i]])) {
registerChrome(contentFlag, folder, 'content/'+options[i]+'/');
installedOptions.push(options[i]);
}
}
}
// Language packs
if ('hasLangPack' in this && hasLangPack) {
registerChrome(localeFlag, folder, 'locale/en-US/'+appName+'/');
for (i = 0; i < installedOptions.length; i++)
registerChrome(localeFlag, folder, 'locale/en-US/'+installedOptions[i]+'/');
if ('hasJLP' in this && hasJLP && confirm(messages.JLP)) {
registerChrome(localeFlag, folder, 'locale/ja-JP/'+appName+'/');
for (i = 0; i < installedOptions.length; i++)
registerChrome(localeFlag, folder, 'locale/ja-JP/'+installedOptions[i]+'/');
}
}
if ('hasSkin' in this && hasSkin) {
registerChrome(skinFlag, folder, 'skin/classic/'+appName+'/');
}
err = getLastError();
if (err == SUCCESS) {
performInstall();
alert(
'Ver.'+version+'\n\n'+
messages.installed+'\n'+
files.join('\n')+'\n\n\n'+
messages.complete+
(contentFlag & PROFILE_CHROME ? '' : '\n\n'+messages.permissionNotes)
);
}
else {
cancelInstall(err);
}
// }
}