Skip to content

Commit e8ddcba

Browse files
committed
Initial commit to Git
0 parents  commit e8ddcba

File tree

135 files changed

+8294
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+8294
-0
lines changed

development/build.xml

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
<?xml version="1.0"?>
2+
3+
<project name="user-agent-switcher" default="build">
4+
<!-- Main targets -->
5+
<target name="all" depends="build,test" description="Build and test"/>
6+
7+
<!-- Initialize settings -->
8+
<target name="init" description="Initialize settings">
9+
<tstamp>
10+
<format pattern="MMMM d, yyyy" property="build.date"/>
11+
</tstamp>
12+
<filterset id="common.filters">
13+
<filter token="build.date" value="${build.date}"/>
14+
<filtersfile file="config.properties"/>
15+
</filterset>
16+
</target>
17+
18+
<!-- Build -->
19+
<target name="build" depends="init" description="Build">
20+
<echo level="info" message="Cleaning up the previous build"/>
21+
<delete dir="chrome"/>
22+
<delete file="install.js"/>
23+
<delete file="install.rdf"/>
24+
<delete file="builds/user-agent-switcher.xpi"/>
25+
<echo level="info" message="Creating extension structure"/>
26+
<copy todir="chrome/content">
27+
<fileset dir="source/content_common">
28+
<exclude name="**/*.png"/>
29+
</fileset>
30+
<filterset refid="common.filters"/>
31+
</copy>
32+
<copy todir="chrome/content">
33+
<fileset dir="source/content_common">
34+
<include name="**/*.png"/>
35+
</fileset>
36+
</copy>
37+
<copy todir="chrome/locale/en-US">
38+
<fileset dir="source/locale_common/en-US"/>
39+
</copy>
40+
<!--copy todir="chrome/locale">
41+
<fileset dir="source/locale_common"/>
42+
</copy-->
43+
<copy todir="chrome/skin">
44+
<fileset dir="source/skin_common"/>
45+
</copy>
46+
<echo level="info" message="Compressing extension code"/>
47+
<zip compress="false" destfile="chrome/useragentswitcher.jar">
48+
<zipfileset dir="chrome"/>
49+
</zip>
50+
<delete dir="chrome/content"/>
51+
<delete dir="chrome/locale"/>
52+
<delete dir="chrome/skin"/>
53+
<echo level="info" message="Building extension file"/>
54+
<copy file="common_install.js" tofile="install.js">
55+
<filterset refid="common.filters"/>
56+
</copy>
57+
<copy file="common_install.rdf" tofile="install.rdf">
58+
<filterset refid="common.filters"/>
59+
</copy>
60+
<zip destfile="builds/user-agent-switcher.xpi">
61+
<zipfileset dir="chrome" prefix="chrome"/>
62+
<zipfileset file="chrome.manifest"/>
63+
<zipfileset file="install.js"/>
64+
<zipfileset file="install.rdf"/>
65+
<zipfileset file="license.txt"/>
66+
</zip>
67+
<echo level="info" message="Cleaning up the build"/>
68+
<delete dir="chrome"/>
69+
<delete file="install.js"/>
70+
<delete file="install.rdf"/>
71+
</target>
72+
73+
<!-- Test -->
74+
<target name="test" depends="init" description="Test">
75+
<echo level="info" message="Cleaning up the previous build"/>
76+
<delete dir="chrome"/>
77+
<delete file="install.js"/>
78+
<delete file="install.rdf"/>
79+
<delete file="builds/user-agent-switcher-test.xpi"/>
80+
<echo level="info" message="Creating extension structure"/>
81+
<copy todir="chrome/content">
82+
<fileset dir="source/content_common">
83+
<exclude name="**/*.png"/>
84+
</fileset>
85+
<filterset refid="common.filters"/>
86+
</copy>
87+
<copy todir="chrome/content">
88+
<fileset dir="source/content_common">
89+
<include name="**/*.png"/>
90+
</fileset>
91+
</copy>
92+
<copy todir="chrome/locale/en-US">
93+
<fileset dir="source/locale_common/hu-HU"/>
94+
</copy>
95+
<copy todir="chrome/skin">
96+
<fileset dir="source/skin_common"/>
97+
</copy>
98+
<echo level="info" message="Compressing extension code"/>
99+
<zip compress="false" destfile="chrome/useragentswitcher.jar">
100+
<zipfileset dir="chrome"/>
101+
</zip>
102+
<delete dir="chrome/content"/>
103+
<delete dir="chrome/locale"/>
104+
<delete dir="chrome/skin"/>
105+
<echo level="info" message="Building extension file"/>
106+
<copy file="common_install.js" tofile="install.js">
107+
<filterset refid="common.filters"/>
108+
</copy>
109+
<copy file="common_install.rdf" tofile="install.rdf">
110+
<filterset refid="common.filters"/>
111+
</copy>
112+
<zip destfile="builds/user-agent-switcher-test.xpi">
113+
<zipfileset dir="chrome" prefix="chrome"/>
114+
<zipfileset file="chrome.manifest"/>
115+
<zipfileset file="install.js"/>
116+
<zipfileset file="install.rdf"/>
117+
<zipfileset file="license.txt"/>
118+
</zip>
119+
<echo level="info" message="Cleaning up the build"/>
120+
<delete dir="chrome"/>
121+
<delete file="install.js"/>
122+
<delete file="install.rdf"/>
123+
</target>
124+
</project>
41.5 KB
Binary file not shown.
41.3 KB
Binary file not shown.

development/chrome.manifest

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
content useragentswitcher jar:chrome/useragentswitcher.jar!/content/useragentswitcher/
2+
locale useragentswitcher en-US jar:chrome/useragentswitcher.jar!/locale/en-US/useragentswitcher/
3+
overlay chrome://browser/content/browser.xul chrome://useragentswitcher/content/useragentswitcher.xul
4+
overlay chrome://navigator/content/navigator.xul chrome://useragentswitcher/content/useragentswitcher.xul
5+
overlay chrome://songbird/content/xul/layoutWithBrowserOverlay.xul chrome://useragentswitcher/content/useragentswitcher.xul
6+
skin useragentswitcher classic/1.0 jar:chrome/useragentswitcher.jar!/skin/classic/useragentswitcher/
7+
style chrome://browser/content/browser.xul chrome://useragentswitcher/skin/useragentswitcher.css
8+
style chrome://global/content/customizeToolbar.xul chrome://useragentswitcher/skin/useragentswitcher.css
9+
style chrome://navigator/content/navigator.xul chrome://useragentswitcher/skin/useragentswitcher.css
10+
style chrome://songbird/content/xul/layoutWithBrowserOverlay.xul chrome://useragentswitcher/skin/useragentswitcher.css

development/common_install.js

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
var author = "Chris Pederick";
2+
var contentFlag = CONTENT | PROFILE_CHROME;
3+
var displayName = "@name@";
4+
var error = null;
5+
var folder = getFolder("Current User", "chrome");
6+
var localeFlag = LOCALE | PROFILE_CHROME;
7+
var name = "useragentswitcher";
8+
var jarName = name + ".jar";
9+
var existsInApplication = File.exists(getFolder(getFolder("chrome"), jarName));
10+
var existsInProfile = File.exists(getFolder(folder, jarName));
11+
var skinFlag = SKIN | PROFILE_CHROME;
12+
var version = "@version@";
13+
14+
// 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
15+
if(existsInApplication || (!existsInProfile && !confirm("Do you want to install the " + displayName + " extension into your profile folder?\n(Cancel will install into the application folder)")))
16+
{
17+
contentFlag = CONTENT | DELAYED_CHROME;
18+
folder = getFolder("chrome");
19+
localeFlag = LOCALE | DELAYED_CHROME;
20+
skinFlag = SKIN | DELAYED_CHROME;
21+
}
22+
23+
initInstall(displayName, name, version);
24+
setPackageFolder(folder);
25+
error = addFile(name, version, "chrome/" + jarName, folder, null);
26+
27+
// If adding the JAR file succeeded
28+
if(error == SUCCESS)
29+
{
30+
folder = getFolder(folder, jarName);
31+
32+
registerChrome(contentFlag, folder, "content/" + name + "/");
33+
registerChrome(localeFlag, folder, "locale/en-US/" + name + "/");
34+
registerChrome(skinFlag, folder, "skin/classic/" + name + "/");
35+
36+
error = performInstall();
37+
38+
// If the install failed
39+
if(error != SUCCESS && error != 999 && error != -239)
40+
{
41+
displayError(error);
42+
cancelInstall(error);
43+
}
44+
else
45+
{
46+
alert("The installation of the " + displayName + " extension succeeded.");
47+
}
48+
}
49+
else
50+
{
51+
displayError(error);
52+
cancelInstall(error);
53+
}
54+
55+
// Displays the error message to the user
56+
function displayError(error)
57+
{
58+
// If the error code was -215
59+
if(error == -215)
60+
{
61+
alert("The installation of the " + displayName + " extension failed.\nOne of the files being overwritten is read-only.");
62+
}
63+
else if(error == -235)
64+
{
65+
alert("The installation of the " + displayName + " extension failed.\nThere is insufficient disk space.");
66+
}
67+
else
68+
{
69+
alert("The installation of the " + displayName + " extension failed.\nThe error code is: " + error);
70+
}
71+
}

development/common_install.rdf

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0"?>
2+
3+
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
4+
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
5+
6+
<Description about="urn:mozilla:install-manifest">
7+
<em:aboutURL>chrome://useragentswitcher/content/about/about.xul</em:aboutURL>
8+
<em:creator>Chris Pederick</em:creator>
9+
<em:description>@description@</em:description>
10+
<em:homepageURL>@home.page@</em:homepageURL>
11+
<em:iconURL>chrome://useragentswitcher/content/logo.png</em:iconURL>
12+
<em:id>{e968fc70-8f95-4ab9-9e79-304de2a71ee1}</em:id>
13+
<em:name>@name@</em:name>
14+
<em:optionsURL>chrome://useragentswitcher/content/options/options.xul</em:optionsURL>
15+
<em:updateInfoURL>@home.page@history/</em:updateInfoURL>
16+
<em:version>@version@</em:version>
17+
<em:file>
18+
<Description about="urn:mozilla:extension:file:useragentswitcher.jar">
19+
<em:locale>locale/en-US/useragentswitcher/</em:locale>
20+
<em:package>content/useragentswitcher/</em:package>
21+
<em:skin>skin/classic/useragentswitcher/</em:skin>
22+
</Description>
23+
</em:file>
24+
<em:targetApplication>
25+
<Description>
26+
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
27+
<em:maxVersion>@firefox.max.version@</em:maxVersion>
28+
<em:minVersion>1.0</em:minVersion>
29+
</Description>
30+
</em:targetApplication>
31+
<em:targetApplication>
32+
<Description>
33+
<em:id>{a463f10c-3994-11da-9945-000d60ca027b}</em:id>
34+
<em:maxVersion>@flock.max.version@</em:maxVersion>
35+
<em:minVersion>1.0</em:minVersion>
36+
</Description>
37+
</em:targetApplication>
38+
<em:targetApplication>
39+
<Description>
40+
<em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
41+
<em:maxVersion>@seamonkey.max.version@</em:maxVersion>
42+
<em:minVersion>1.0</em:minVersion>
43+
</Description>
44+
</em:targetApplication>
45+
<em:targetApplication>
46+
<Description>
47+
<em:id>[email protected]</em:id>
48+
<em:maxVersion>@songbird.max.version@</em:maxVersion>
49+
<em:minVersion>1.0</em:minVersion>
50+
</Description>
51+
</em:targetApplication>
52+
</Description>
53+
</RDF>

development/config.properties

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
description=Adds a menu and a toolbar button to switch the user agent of a browser.
2+
home.page=http://chrispederick.com/work/user-agent-switcher/
3+
firefox.max.version=4.0.*
4+
flock.max.version=2.6.*
5+
name=User Agent Switcher
6+
seamonkey.max.version=2.0.*
7+
songbird.max.version=1.8.*
8+
user.agents.page=http://chrispederick.com/work/user-agent-switcher/user-agents/
9+
version=0.7.3

0 commit comments

Comments
 (0)