aboutsummaryrefslogtreecommitdiff
path: root/chrome/content/ui
diff options
context:
space:
mode:
authorEinar Egilsson2009-09-15 21:41:06 +0000
committerEinar Egilsson2009-09-15 21:41:06 +0000
commit96966ca83f96ed1babcd2bd23aa68feb63fbb7a7 (patch)
treef2483b413192a279753cb02d2d8fcff9f0ad9b03 /chrome/content/ui
parentd32cd776748e45abeaa6c2284b96210952c79717 (diff)
Total restructuring of files.
Unescape matches fully working Export of redirects working. git-svn-id: http://einaregilsson.googlecode.com/svn/mozilla/redirector/trunk@249 119bf307-c92d-0410-89bd-8f53e6181181
Diffstat (limited to 'chrome/content/ui')
-rw-r--r--chrome/content/ui/browserOverlay.xul38
-rw-r--r--chrome/content/ui/editRedirect.xul53
-rw-r--r--chrome/content/ui/help.html173
-rw-r--r--chrome/content/ui/redirectList.xul54
4 files changed, 318 insertions, 0 deletions
diff --git a/chrome/content/ui/browserOverlay.xul b/chrome/content/ui/browserOverlay.xul
new file mode 100644
index 0000000..9a02332
--- /dev/null
+++ b/chrome/content/ui/browserOverlay.xul
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- $Id$ -->
+<!DOCTYPE overlay SYSTEM "chrome://redirector/locale/browserOverlay.xul.dtd">
+<overlay id="redirector-overlay"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="../code/browserOverlay.xul.js"/>
+
+ <stringbundleset id="stringbundleset">
+ <stringbundle id="redirector-strings" src="chrome://redirector/locale/redirector.properties"/>
+ </stringbundleset>
+
+ <menupopup id="menu_ToolsPopup">
+ <menuitem id="redirector-menuitem" label="&RedirectorMenuItem.label;"
+ accesskey="&RedirectorMenuItem.accesskey;"
+ oncommand="RedirectorOverlay.onMenuItemCommand(event);"/>
+ </menupopup>
+ <popup id="contentAreaContextMenu">
+ <menuitem id="redirector-context" label="&RedirectorContext.label;"
+ accesskey="&RedirectorContext.accesskey;"
+ insertafter="context-stop"
+ oncommand="RedirectorOverlay.onContextMenuCommand(event)"/>
+ </popup>
+ <statusbar id="status-bar">
+ <statusbarpanel id="redirector-status">
+ <!-- Put back in later
+ <menupopup id="redirector-status-popup" position="at_pointer">
+ <menuitem label="&RedirectorManageRedirects.label;" accesskey="&RedirectorManageRedirects.accesskey;" oncommand="RedirectorOverlay.openSettings();" />
+ <menuitem label="&RedirectorHelp.label;" accesskey="&RedirectorHelp.accesskey;" oncommand="Redirector.openHelp();" />
+ </menupopup>
+ -->
+ <image id="redirector-statusbar-img" src="chrome://redirector/content/images/statusactive.PNG"
+ tooltiptext="Redirector is enabled;"
+ style="width:16px; height:16px;"
+ onclick="RedirectorOverlay.statusBarClick(event);" />
+ </statusbarpanel>
+ </statusbar>
+
+</overlay> \ No newline at end of file
diff --git a/chrome/content/ui/editRedirect.xul b/chrome/content/ui/editRedirect.xul
new file mode 100644
index 0000000..afca5b6
--- /dev/null
+++ b/chrome/content/ui/editRedirect.xul
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- $Id$ -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<!DOCTYPE dialog SYSTEM "chrome://redirector/locale/editRedirect.xul.dtd">
+<dialog title="&redirectWindow.title;"
+ orient="vertical"
+ autostretch="always"
+ onload="EditRedirect.onLoad();"
+ buttons="accept,cancel"
+ ondialogaccept="return EditRedirect.onAccept();"
+ xmlns:nc="http://home.netscape.com/NC-rdf#"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <script type="application/x-javascript" src="../code/editRedirect.xul.js"/>
+ <stringbundleset id="stringbundleset">
+ <stringbundle id="redirector-strings" src="chrome://redirector/locale/redirector.properties"/>
+ </stringbundleset>
+
+ <grid>
+ <rows>
+ <row align="center">
+ <text value="&txtExampleUrl.label;" style="margin-top:6px;"/>
+ <textbox id="txtExampleUrl" style="width:400px;"/>
+ </row>
+ <row align="center">
+ <text value="&txtPattern.label;" style="margin-top:6px;"/>
+ <textbox id="txtPattern" taborder="1"/>
+ <button id="btnTestPattern" label="&btnTestPattern.label;" onclick="EditRedirect.testPattern();" taborder="2"/>
+ </row>
+ <row align="center">
+ <text value="&txtExcludePattern.label;" style="margin-top:6px;"/>
+ <textbox id="txtExcludePattern" taborder="3"/>
+ </row>
+ <row align="center">
+ <text value="&txtRedirectUrl.label;" style="margin-top:6px;"/>
+ <textbox id="txtRedirectUrl" taborder="4"/>
+ </row>
+ <row align="center">
+ <text value="&rdoPatternTypes.label;"/>
+ <radiogroup>
+ <hbox>
+ <radio id="rdoWildcard" label="&rdoWildcard.label;" accesskey="&rdoWildcard.accessKey;" selected="true" taborder="5"/>
+ <radio id="rdoRegex" label="&rdoRegex.label;" accesskey="&rdoRegex.accessKey;" taborder="6"/>
+ </hbox>
+ </radiogroup>
+ </row>
+ <row align="center">
+ <text value="&chkUnescapeMatches.label;" />
+ <checkbox id="chkUnescapeMatches" label="" taborder="7"/>
+ </row>
+ </rows>
+ </grid>
+</dialog>
diff --git a/chrome/content/ui/help.html b/chrome/content/ui/help.html
new file mode 100644
index 0000000..0ce6769
--- /dev/null
+++ b/chrome/content/ui/help.html
@@ -0,0 +1,173 @@
+<!-- $Id$ -->
+<html>
+ <head>
+ <title>Redirector Help</title>
+ <style type="text/css">
+ body { font-family: Verdana, Arial; color:black; background-color:white; font-size:0.9em;}
+ a { color:blue; }
+ </style>
+ </head>
+ <body>
+ <h1>Redirector Help</h1>
+ <h3>Table of contents</h3>
+ <ul>
+ <li><a href="#whatisredirector">What is Redirector?</a></li>
+ <li><a href="#basicusage">Basic usage</a>
+ <ul>
+ <li><a href="#exampleurl">Example url</a></li>
+ <li><a href="#includepattern">Include pattern</a></li>
+ <li><a href="#excludepattern">Exclude pattern</a></li>
+ <li><a href="#redirectto">Redirect to</a></li>
+ <li><a href="#patterntype">Pattern type</a></li>
+ </ul>
+ </li>
+ <li><a href="#wildcards">Wildcards</a></li>
+ <li><a href="#regularexpressions">Regular expressions</a></li>
+ <li><a href="#examples">Examples</a>
+ <ol>
+ <li><a href="#ex1">Static redirect</a></li>
+ <li><a href="#ex2">Redirect using query string parameter and wildcards</a></li>
+ <li><a href="#ex3">Redirect using query string parameter and regular expressions</a></li>
+ <li><a href="#ex4">Redirect to a different folder using wildcards</a></li>
+ <li><a href="#ex5">Redirect http to https using wildcards</a></li>
+ </ol>
+
+ </li>
+ </ul>
+
+
+ <a name="whatisredirector"></a>
+ <h4>What is Redirector?</h4>
+
+ <p>Redirector is an extension for Firefox that allows you to automatically redirect from
+ one webpage to another. For example, every time you visit http://abc.com you will automatically
+ load http://def.com instead. This can be useful for instance to always redirect articles to printer friendly
+ versions, redirect http:// to https:// for sites that support both, bypass advertising pages that appear before
+ being able to view certain pages and more.</p>
+
+ <a name="basicusage"></a>
+ <h4>Basic usage</h4>
+ <p>To add a new redirect you can go to the <em>Tools</em> menuitem and select <em>Redirector</em>. That will
+ open the <em>Redirector settings</em> window which shows all your redirects. The window can also be opened
+ by right clicking on the <strong>R</strong> icon in your statusbar.
+ There you can press the <em>Add...</em> button and then you can enter the details for the new redirect. A redirect
+ consists of a few things:
+ <ul>
+ <li><a name="exampleurl"></a><strong>Example url:</strong> This is an example of an url you want to redirect. It is not really used for anything,
+ it's just there to show what types of urls you're targetting. You can leave this out, but then you can't use the <em>Test pattern</em> button.</li>
+
+ <li><a name="includepattern"></a><strong>Include pattern:</strong> This is pattern for the urls you want to redirect. In the simplest case, where you just want
+ to redirect one specific url to another then this will just be the exact url you want to redirect. For instance, if you just want http://aaa.com to
+ redirect to http://bbb.com then <em>Include pattern</em> will just be http://aaa.com. For more complex patterns that match many
+ urls you can use either <a href="#wildcards">wildcards</a> or <a href="#regularexpressions">regular expressions</a>.</li>
+
+ <li><a name="excludepattern"></a><strong>Exclude pattern:</strong> Urls that match this pattern will never be redirected. This is not necessary to
+ fill out, but can be useful when you want to redirect all urls that contain some text except if they contain some other text.
+ Redirects like that can often be done with a complex regular expression, but using an exclude pattern makes it much simpler. The exclude
+ patterns can use wildcard characters or regular expressions like the include patterns.</li>
+
+ <li><a name="redirectto"></a><strong>Redirect to:</strong> This is the url that you will be redirected to when you open any page where the url matches the
+ include pattern. You can use the special signs $1, $2, $3 etc. in the url, they will be replaced by the results of captures with regular
+ expressions or stars with wildcards. For instance, if you have the include pattern <em>http://google.com/*</em>, redirect to <em>http://froogle.com/$1</em>
+ and you open the page http://google.com/foobar, then you will be redireced to http://froogle.com/foobar, since 'foobar' was what the star replaced. $1 is for the
+ first star in the pattern, $2 for the second and so on. For regular expression $1 is for the first parantheses, $2 for the second etc.</li>
+
+ <li><a name="patterntype"></a><strong>Pattern type:</strong> This specifies how Redirector should interpret the patterns, either as
+ <a href="#wildcards">wildcards</a> or <a href="#regularexpressions#">regular expressions</a>.</li>
+
+ </ul>
+ </p>
+
+ <a name="wildcards"></a>
+ <h4>Wildcards</h4>
+
+ <p>Wildcards are the simplest way to specify include and exclude patterns. When you create a wildcard pattern there
+ is just one special character, the asterisk *. An asterisk in your pattern will match zero or more characters and you can
+ have more than one star in your pattern. Some examples:
+ <ul>
+ <li><em>http://example.com/*</em> matches http://example.com/, http://example.com/foo, http://example.com/bar and all other urls that start with http://example.com/.</li>
+ <li><em>http://*.example.com</em> matches all subdomains of example.com, like http://www.example.com, http://mail.example.com.</li>
+ <li><em>http*://example.com</em> matches both http://example.com and https://example.com.</li>
+ <li><em>http://example.com/index.asp*</em> matches http://example.com/index.asp, http://example.com/index.asp?a=b&c=d.</li>
+ </ul>
+ $1, $2, $3 in the redirect urls will match the text that the stars matched. Examples:
+ <ul>
+ <li><em>http://example.com/*</em> matches http://example.com/foobar, $1 is foobar.</li>
+ <li><em>http://*.example.com/*</em> matches http://www.example.com/foobar, $1 is www, $2 is foobar.</li>
+ </ul>
+ </p>
+
+ <a name="regularexpressions"></a>
+ <h4>Regular expressions</h4>
+
+ <p>Regular expressions allow for more complicated patterns but they are a lot harder to learn than wildcards. I'm not gonna
+ create a regex tutorial here but normal javascript regex syntax works, look at <a href="http://regular-expressions.info" target="_blank">http://regular-expressions.info</a> for
+ an introduction to regular expressions. $1,$2 etc. can be used in the redirect url and will be replaced with contents of captures in
+ the regular expressions. Captures are specified with parantheses. Example: http://example.com/index.asp\?id=(\d+) will match the url
+ http://example.com/index.asp?id=12345 and $1 will be replaced by 12345. (A common mistake in regex patterns is to forget to escape
+ the ? sign in the querystring of the url. ? is a special character in regular expressions so if you want to match an url with a querystring
+ you should escape it as \?).</p>
+
+ <a name="examples"></a>
+ <h4>Examples</h4>
+
+ <ol>
+ <li>
+ <strong><a name="ex1"></a>Static redirect</strong><br/>
+ Redirects from http://example.com/foo to http://example.com/bar
+ <p>
+ <strong>Include pattern:</strong> http://example.com/foo<br/>
+ <strong>Exclude pattern:</strong><br/>
+ <strong>Redirect to:</strong> http://example.com/bar<br/>
+ <strong>Pattern type:</strong> Wildcard<br />
+ </p>
+
+ </li>
+ <li>
+ <strong><a name="ex2"></a>Redirect using query string parameter and wildcards</strong><br/>
+ Redirects from http://example.com/index.php?id=12345&a=b to http://example.com/printerfriendly.php?id=12345&a=b
+ where 12345 could be any number.
+ <p>
+ <strong>Include pattern:</strong> http://example.com/index.php?id=*&a=b<br/>
+ <strong>Exclude pattern:</strong><br/>
+ <strong>Redirect to:</strong> http://example.com/printerfriendly.com?id=$1&a=b<br/>
+ <strong>Pattern type:</strong> Wildcard<br />
+ </p>
+ </li>
+ <li>
+ <strong><a name="ex3"></a>Redirect using query string parameter and regular expressions</strong><br/>
+ Redirects from http://example.com/index.php?id=12345&a=b to http://example.com/printerfriendly.php?id=12345&a=b
+ where 12345 could be any number.
+ <p>
+ <strong>Include pattern:</strong> http://example.com/index.php\?id=(\d+)&a=b<br/>
+ <strong>Exclude pattern:</strong><br/>
+ <strong>Redirect to:</strong> http://example.com/printerfriendly.com?id=$1&a=b<br/>
+ <strong>Pattern type:</strong> Regular Expression<br />
+ </p>
+ </li>
+ <li>
+ <strong><a name="ex4"></a>Redirect to a different folder using wildcards</strong><br/>
+ Redirects from http://example.com/category/fish/index.php to http://example.com/category/cats/index.php
+ where fish could be any word. The exclude pattern makes sure that there is only one
+ folder there, so for instance http://example.com/category/fish/cat/mouse/index.php would not match.
+ <p>
+ <strong>Include pattern:</strong> http://example.com/category/*/index.php<br/>
+ <strong>Exclude pattern:</strong> http://example.com/category/*/*/index.php<br/>
+ <strong>Redirect to:</strong> http://example.com/category/cats/index.php<br/>
+ <strong>Pattern type:</strong> Wildcard<br />
+ </p>
+ </li>
+ <li>
+ <strong><a name="ex5"></a>Redirect http to https using wildcards</strong><br/>
+ Redirects from http://mail.google.com/randomcharacters to https://mail.google.com/randomcharacters
+ where randomcharacters could be anything.
+ <p>
+ <strong>Include pattern:</strong> http://mail.google.com*<br/>
+ <strong>Exclude pattern:</strong><br/>
+ <strong>Redirect to:</strong> https://mail.google.com$1<br/>
+ <strong>Pattern type:</strong> Wildcard<br />
+ </p>
+ </li>
+ </ol>
+ </body>
+</html> \ No newline at end of file
diff --git a/chrome/content/ui/redirectList.xul b/chrome/content/ui/redirectList.xul
new file mode 100644
index 0000000..29d5ceb
--- /dev/null
+++ b/chrome/content/ui/redirectList.xul
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- $Id -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<!DOCTYPE dialog SYSTEM "chrome://redirector/locale/redirectList.xul.dtd">
+<window title="&window.title;"
+ orient="vertical"
+ onload="RedirectList.onLoad();"
+ buttons="accept"
+ width="600px"
+ height="400px"
+ windowtype="redirectorSettings"
+ xmlns:nc="http://home.netscape.com/NC-rdf#"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <script type="application/x-javascript" src="../code/redirectList.xul.js"/>
+
+ <vbox>
+ <richlistbox seltype="single" id="lstRedirects" style="margin-bottom:5px; border:solid 1px grey;" height="330px" ondblclick="RedirectList.editRedirect();" onselect="RedirectList.selectionChange();">
+ <richlistitem style="border-bottom:dotted 1px grey;" selected="false">
+ <grid>
+ <cols>
+ </cols>
+ <rows>
+ <row>
+ <label style="font-weight:bold;" value="&colIncludePattern.label;:" />
+ <description name="dscrIncludePattern" />
+ </row>
+ <row>
+ <label style="font-weight:bold;" value="&colExcludePattern.label;:" />
+ <description name="dscrExcludePattern" />
+ </row>
+ <row>
+ <label style="font-weight:bold;" value="&colRedirectTo.label;:" />
+ <description name="dscrRedirectTo" />
+ </row>
+ </rows>
+ </grid>
+ </richlistitem>
+ </richlistbox>
+ <hbox style="align:right;">
+ <button id="btnAdd" onclick="RedirectList.addRedirect();" label="&btnAdd.label;" disabled="false" />
+ <button id="btnEdit" onclick="RedirectList.editRedirect();" label="&btnEdit.label;" disabled="true" />
+ <button id="btnDelete" onclick="RedirectList.deleteRedirect();" label="&btnDelete.label;" disabled="true" />
+ <button id="btnImport" onclick="RedirectList.import();" label="&btnImport.label;"/>
+ <button id="btnExport" onclick="RedirectList.export();" label="&btnExport.label;"/>
+ <button id="btnHelp" onclick="RedirectList.openHelp();" label="&btnHelp.label;"/>
+ <button id="btnClose" onclick="RedirectList.close();" label="&btnClose.label;"/>
+ <!-- TODO: include in v2.0
+ <button id="btnUp" onclick="RedirectList.moveUp();" label="UP" disabled="false" />
+ <button id="btnDown" onclick="RedirectList.moveDown();" label="Down" />
+ -->
+ </hbox>
+ </vbox>
+</window>