Subversion Repositories SmartDukaan

Rev

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