Subversion Repositories SmartDukaan

Rev

Rev 15085 | Rev 15767 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
15085 anikendra 1
<html>
15203 anikendra 2
<head>
3
  <title>Redirect</title>
15085 anikendra 4
<script type="text/javascript">
15203 anikendra 5
String.prototype.capitalizeFirstLetter = function() {
6
    return this.charAt(0).toUpperCase() + this.slice(1);
7
}
15085 anikendra 8
function pass_it_on() {
9
   var l=window.location+"";
10
   var dsp=document.getElementById("display");
11
   var qsloc=l.indexOf("?");
12
   if(qsloc>=0) {
15203 anikendra 13
      var link = document.createElement('a');          
15085 anikendra 14
      var query_string=unescape(l.substring(qsloc+1));
15203 anikendra 15
      link.setAttribute('href', Base64.decode(query_string));    
16
      dsp.innerHTML="Redirecting to " + link.hostname.capitalizeFirstLetter();
17
      window.location=Base64.decode(query_string);
15085 anikendra 18
   }
19
}
15203 anikendra 20
var Base64 = {
21
 
22
 
23
    _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
24
 
25
 
26
    encode: function(input) {
27
        var output = "";
28
        var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
29
        var i = 0;
30
 
31
        input = Base64._utf8_encode(input);
32
 
33
        while (i < input.length) {
34
 
35
            chr1 = input.charCodeAt(i++);
36
            chr2 = input.charCodeAt(i++);
37
            chr3 = input.charCodeAt(i++);
38
 
39
            enc1 = chr1 >> 2;
40
            enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
41
            enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
42
            enc4 = chr3 & 63;
43
 
44
            if (isNaN(chr2)) {
45
                enc3 = enc4 = 64;
46
            } else if (isNaN(chr3)) {
47
                enc4 = 64;
48
            }
49
 
50
            output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
51
 
52
        }
53
 
54
        return output;
55
    },
56
 
57
 
58
    decode: function(input) {
59
        var output = "";
60
        var chr1, chr2, chr3;
61
        var enc1, enc2, enc3, enc4;
62
        var i = 0;
63
 
64
        input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
65
 
66
        while (i < input.length) {
67
 
68
            enc1 = this._keyStr.indexOf(input.charAt(i++));
69
            enc2 = this._keyStr.indexOf(input.charAt(i++));
70
            enc3 = this._keyStr.indexOf(input.charAt(i++));
71
            enc4 = this._keyStr.indexOf(input.charAt(i++));
72
 
73
            chr1 = (enc1 << 2) | (enc2 >> 4);
74
            chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
75
            chr3 = ((enc3 & 3) << 6) | enc4;
76
 
77
            output = output + String.fromCharCode(chr1);
78
 
79
            if (enc3 != 64) {
80
                output = output + String.fromCharCode(chr2);
81
            }
82
            if (enc4 != 64) {
83
                output = output + String.fromCharCode(chr3);
84
            }
85
 
86
        }
87
 
88
        output = Base64._utf8_decode(output);
89
 
90
        return output;
91
 
92
    },
93
 
94
    _utf8_encode: function(string) {
95
        string = string.replace(/\r\n/g, "\n");
96
        var utftext = "";
97
 
98
        for (var n = 0; n < string.length; n++) {
99
 
100
            var c = string.charCodeAt(n);
101
 
102
            if (c < 128) {
103
                utftext += String.fromCharCode(c);
104
            }
105
            else if ((c > 127) && (c < 2048)) {
106
                utftext += String.fromCharCode((c >> 6) | 192);
107
                utftext += String.fromCharCode((c & 63) | 128);
108
            }
109
            else {
110
                utftext += String.fromCharCode((c >> 12) | 224);
111
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
112
                utftext += String.fromCharCode((c & 63) | 128);
113
            }
114
 
115
        }
116
 
117
        return utftext;
118
    },
119
 
120
    _utf8_decode: function(utftext) {
121
        var string = "";
122
        var i = 0;
123
        var c = c1 = c2 = 0;
124
 
125
        while (i < utftext.length) {
126
 
127
            c = utftext.charCodeAt(i);
128
 
129
            if (c < 128) {
130
                string += String.fromCharCode(c);
131
                i++;
132
            }
133
            else if ((c > 191) && (c < 224)) {
134
                c2 = utftext.charCodeAt(i + 1);
135
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
136
                i += 2;
137
            }
138
            else {
139
                c2 = utftext.charCodeAt(i + 1);
140
                c3 = utftext.charCodeAt(i + 2);
141
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
142
                i += 3;
143
            }
144
 
145
        }
146
 
147
        return string;
148
    }
149
 
150
}
15085 anikendra 151
</script>
152
</head>
153
<body onload="pass_it_on();">
154
 
155
<div id="display">
156
</div>
157
</body>
158
</html>