aboutsummaryrefslogtreecommitdiff
path: root/chrome/content/redirect.js
blob: cfd2a2e46087f3a4b0361026bf0c313bd1c77415 (plain)
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
//// $Id$

var Redirect = {

    onLoad : function() {
        var params = window.arguments[0];
        $('txtExampleUrl').value = params.inn.url;
        $('txtPattern').value = params.inn.url;
        $('txtRedirectUrl').value = params.inn.redirect || '';

    },

    onAccept : function() {
        var params = window.arguments[0];

        params.out.pattern = $('txtPattern').value;
        params.out.patternType = kRedirectorWildcard;
        params.out.exampleUrl =$('txtExampleUrl').value;
        params.out.redirectUrl = $('txtRedirectUrl').value;
        params.out.onlyIfLinkExists = $('chkOnlyIfLinkExists').checked;

        return true;
    },

    testPattern : function() {
        try {
        alert(Redirector.wildcardMatch($('txtPattern').value, $('txtExampleUrl').value));
        } catch(e) {alert(e);}
    }

};