diff options
Diffstat (limited to 'chrome/ui')
-rw-r--r-- | chrome/ui/browserOverlay.xul | 34 | ||||
-rw-r--r-- | chrome/ui/editRedirect.xul | 58 | ||||
-rw-r--r-- | chrome/ui/help.html | 182 | ||||
-rw-r--r-- | chrome/ui/settings.xul | 118 | ||||
-rw-r--r-- | chrome/ui/skin/movedown.png | bin | 0 -> 294 bytes | |||
-rw-r--r-- | chrome/ui/skin/movedowndisabled.png | bin | 0 -> 361 bytes | |||
-rw-r--r-- | chrome/ui/skin/moveup.png | bin | 0 -> 360 bytes | |||
-rw-r--r-- | chrome/ui/skin/moveupdisabled.png | bin | 0 -> 282 bytes | |||
-rw-r--r-- | chrome/ui/skin/redirector.css | 15 | ||||
-rw-r--r-- | chrome/ui/skin/redirector.png | bin | 0 -> 1462 bytes | |||
-rw-r--r-- | chrome/ui/skin/statusactive.png | bin | 0 -> 360 bytes | |||
-rw-r--r-- | chrome/ui/skin/statusinactive.png | bin | 0 -> 396 bytes |
12 files changed, 407 insertions, 0 deletions
diff --git a/chrome/ui/browserOverlay.xul b/chrome/ui/browserOverlay.xul new file mode 100644 index 0000000..32bf1d5 --- /dev/null +++ b/chrome/ui/browserOverlay.xul @@ -0,0 +1,34 @@ +<?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/redirect.js"/> + <script src="../code/redirectorprefs.js"/> + <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"> + <image id="redirector-statusbar-img" src="chrome://redirector/skin/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/ui/editRedirect.xul b/chrome/ui/editRedirect.xul new file mode 100644 index 0000000..6d7b133 --- /dev/null +++ b/chrome/ui/editRedirect.xul @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- $Id$ --> +<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> +<?xml-stylesheet href="chrome://redirector/skin/redirector.css" 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/redirect.js"/> + <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 class="editRedirects"> + <row align="center"> + <text value="&txtExampleUrl.label;" /> + <textbox id="txtExampleUrl" /> + </row> + <row align="center"> + <text value="&txtIncludePattern.label;" /> + <textbox id="txtIncludePattern" taborder="1"/> + <button id="btnTestPattern" label="&btnTestPattern.label;" onclick="EditRedirect.testPattern();" taborder="2"/> + </row> + <row align="center"> + <text value="&txtExcludePattern.label;" /> + <textbox id="txtExcludePattern" taborder="3"/> + </row> + <row align="center"> + <text value="&txtRedirectUrl.label;" /> + <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;" /> + <hbox> + <checkbox id="chkUnescapeMatches" label="" taborder="7"/> + <spacer flex="1" /> + </hbox> + </row> + </rows> + </grid> +</dialog> diff --git a/chrome/ui/help.html b/chrome/ui/help.html new file mode 100644 index 0000000..4534d96 --- /dev/null +++ b/chrome/ui/help.html @@ -0,0 +1,182 @@ +<!-- $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> + <li><a href="#unescapematches">Unescape matches</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> + + <li><a name="unescapematches"></a><strong>Unescape matches:</strong> A common usage of Redirector is to catch urls like + <em>http://foo.com/redirect.php?url=http%3A%2F%2Fbar%2Ecom%2Fpath</em> and try to catch the url parameter and redirect to it. A pattern + like <em>http://foo.com/redirect.php?url=*</em> might be used for that purpose. However, if the url parameter is <em>escaped</em> (also known + as <em>urlencoded</em>) then that won't work. In the url above we see that it starts with <em>http%3A%2F%2F</em> instead of <em>http://</em>, and Firefox + won't accept this as a new url to redirect to. So, in cases like these you can check the <em>Unescape matches</em> option and then all + matches will be unescaped (turned from e.g. <em>http%3A%2F%2Fbar%2Ecom</em> to <em>http://bar.com</em>) before being inserted into the target url. + </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/ui/settings.xul b/chrome/ui/settings.xul new file mode 100644 index 0000000..ccb9569 --- /dev/null +++ b/chrome/ui/settings.xul @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- $Id$ --> +<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> +<?xml-stylesheet href="chrome://redirector/skin/redirector.css" type="text/css"?> + +<!DOCTYPE dialog SYSTEM "chrome://redirector/locale/settings.xul.dtd"> +<window title="&window.title;" + orient="vertical" + onload="Settings.onLoad();" + onunload="Settings.onUnload();" + buttons="accept" + width="650px" + height="500px" + id="redirectorSettings" + 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/redirectorprefs.js"/> + <script type="application/x-javascript" src="../code/redirect.js"/> + <script type="application/x-javascript" src="../code/settings.xul.js"/> + <stringbundleset id="stringbundleset"> + <stringbundle id="redirector-strings" src="chrome://redirector/locale/redirector.properties"/> + </stringbundleset> + <tabbox flex="1" > + <tabs> + <tab label="&tabRedirects.label;" accesskey="&tabRedirects.accesskey;" /> + <tab label="&tabPreferences.label;" accesskey="&tabPreferences.accesskey;" /> + <tab label="&tabImportExport.label;" accesskey="&tabImportExport.accesskey;" /> + <tab label="&tabHelp.label;" accesskey="&tabHelp.accesskey;" /> + </tabs> + <tabpanels flex="1"> + <tabpanel flex="1"> + <vbox flex="1"> + <richlistbox seltype="single" id="lstRedirects" flex="1" onkeypress="Settings.listKeypress(event);" ondblclick="Settings.editRedirect();" onselect="Settings.selectionChange();"> + <richlistitem class="SettingsItem" selected="false"> + <grid> + <cols /> + <rows class="redirectRows"> + <row> + <label value="&colIncludePattern.label;:" /> + <description name="dscrIncludePattern" /> + </row> + <row> + <label value="&colExcludePattern.label;:" /> + <description name="dscrExcludePattern" /> + </row> + <row> + <label value="&colRedirectTo.label;:" /> + <description name="dscrRedirectTo" /> + </row> + <row> + <label value="&colEnabled.label;:" /> + <hbox><checkbox checked="false" name="chkEnabled" label="" /> <spacer flex="1"/></hbox> + </row> + </rows> + </grid> + </richlistitem> + </richlistbox> + <hbox> + <button id="btnAdd" oncommand="Settings.addRedirect();" accesskey="&btnAdd.accesskey;" label="&btnAdd.label;" tooltiptext="&btnAdd.tooltip;" disabled="false" /> + <button id="btnEdit" oncommand="Settings.editRedirect();" accesskey="&btnEdit.accesskey;" label="&btnEdit.label;" tooltiptext="&btnEdit.tooltip;" disabled="true" /> + <button id="btnDelete" oncommand="Settings.deleteRedirect();" accesskey="&btnDelete.accesskey;" label="&btnDelete.label;" tooltiptext="&btnDelete.tooltip;" disabled="true" /> + <button id="btnUp" oncommand="Settings.moveUp();" tooltiptext="&btnUp.tooltip;" disabled="true" /> + <button id="btnDown" oncommand="Settings.moveDown();" tooltiptext="&btnDown.tooltip;" disabled="true" /> + </hbox> + </vbox> + </tabpanel> + <tabpanel> + <vbox flex="1"> + <groupbox> + <caption label="&grpGeneralPreferences.label;" /> + <hbox> + <checkbox id="chkEnableRedirector" label="&chkEnableRedirector.label;" oncommand="Settings.preferenceChange(event);" accesskey="&chkEnableRedirector.accesskey;" preference="enabled" /> + <spacer flex="1" /> + </hbox> + <hbox> + <checkbox id="chkShowStatusBarIcon" label="&chkShowStatusBarIcon.label;" oncommand="Settings.preferenceChange(event);" accesskey="&chkShowStatusBarIcon.accesskey;" preference="showStatusBarIcon" /> + <spacer flex="1" /> + </hbox> + <hbox> + <checkbox id="chkShowContextMenu" label="&chkShowContextMenu.label;" oncommand="Settings.preferenceChange(event);" accesskey="&chkShowContextMenu.accesskey;" preference="showContextMenu" /> + <spacer flex="1" /> + </hbox> + </groupbox> + <groupbox> + <caption label="&grpDebuggingPreferences.label;" /> + <hbox> + <checkbox id="chkEnableDebugOutput" label="&chkEnableDebugOutput.label;" oncommand="Settings.preferenceChange(event);" accesskey="&chkEnableDebugOutput.accesskey;" preference="debugEnabled" /> + <spacer flex="1" /> + </hbox> + </groupbox> + <spacer flex="1" /> + </vbox> + </tabpanel> + <tabpanel> + <groupbox flex="1" id="grpImportExport"> + <vbox> + <hbox align="middle"> + <button id="btnImport" accesskey="&btnImport.accesskey;" oncommand="Settings.import();" label="&btnImport.label;"/> + <label id="lblImport" value="&lblImport.label;" /> + <spacer flex="1" /> + </hbox> + <hbox> + <button id="btnExport" accesskey="&btnExport.accesskey;" oncommand="Settings.export();" label="&btnExport.label;"/> + <label id="lblExport" value="&lblExport.label;" /> + <spacer flex="1" /> + </hbox> + <spacer flex="1" /> + </vbox> + </groupbox> + </tabpanel> + <tabpanel> + <browser type="content" src="chrome://redirector/content/ui/help.html" flex="1" /> + </tabpanel> + </tabpanels> + </tabbox> +</window> diff --git a/chrome/ui/skin/movedown.png b/chrome/ui/skin/movedown.png Binary files differnew file mode 100644 index 0000000..d32b79c --- /dev/null +++ b/chrome/ui/skin/movedown.png diff --git a/chrome/ui/skin/movedowndisabled.png b/chrome/ui/skin/movedowndisabled.png Binary files differnew file mode 100644 index 0000000..afd8fc6 --- /dev/null +++ b/chrome/ui/skin/movedowndisabled.png diff --git a/chrome/ui/skin/moveup.png b/chrome/ui/skin/moveup.png Binary files differnew file mode 100644 index 0000000..3025378 --- /dev/null +++ b/chrome/ui/skin/moveup.png diff --git a/chrome/ui/skin/moveupdisabled.png b/chrome/ui/skin/moveupdisabled.png Binary files differnew file mode 100644 index 0000000..e526b29 --- /dev/null +++ b/chrome/ui/skin/moveupdisabled.png diff --git a/chrome/ui/skin/redirector.css b/chrome/ui/skin/redirector.css new file mode 100644 index 0000000..ff9762e --- /dev/null +++ b/chrome/ui/skin/redirector.css @@ -0,0 +1,15 @@ +/* $Id$ */ + +.disabledRedirect { color:grey; } +#lstRedirects richlistitem { border-bottom:dotted 1px grey; padding:3px; } +.redirectRows > row > label { font-weight:bold;} +.editRedirects > row > textbox { width: 350px; } +#redirectorSettings > tabbox { margin:4px; } +#btnUp { list-style-image: url('chrome://redirector/skin/moveup.png'); } +#btnDown { list-style-image: url('chrome://redirector/skin/movedown.png'); } +#btnUp[disabled=true] { list-style-image: url('chrome://redirector/skin/moveupdisabled.png'); } +#btnDown[disabled=true] { list-style-image: url('chrome://redirector/skin/movedowndisabled.png'); } + +#btnUp, #btnDown { width:25px; min-width:25px; } +#lblExport, #lblImport { padding-top:5px; } +#grpImportExport { padding-top:10px; padding-left:5px;}
\ No newline at end of file diff --git a/chrome/ui/skin/redirector.png b/chrome/ui/skin/redirector.png Binary files differnew file mode 100644 index 0000000..f8de12c --- /dev/null +++ b/chrome/ui/skin/redirector.png diff --git a/chrome/ui/skin/statusactive.png b/chrome/ui/skin/statusactive.png Binary files differnew file mode 100644 index 0000000..06ce766 --- /dev/null +++ b/chrome/ui/skin/statusactive.png diff --git a/chrome/ui/skin/statusinactive.png b/chrome/ui/skin/statusinactive.png Binary files differnew file mode 100644 index 0000000..8b83562 --- /dev/null +++ b/chrome/ui/skin/statusinactive.png |