PageSourceSearch

https://impulseleisure.co.uk/plugins/editors/yeeditor/assets/js/base64.js?ver=1.0

js impulseleisure.co.uk collected 2026-10-06 00:15:02 UTC 3,051 bytes, 113 lines download raw bytes

1/**
2*
3*  Base64 encode / decode
4*
5*  @author haitao.tu
6*  @date   2010-04-26
7*  @email  [email protected]
8*
9*/
10 
11function Base64() {
12 
13	// private property
14	_keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
15 
16	// public method for encoding
17	this.encode = function (input) {
18		var output = "";
19		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
20		var i = 0;
21		input = _utf8_encode(input);
22		while (i < input.length) {
23			chr1 = input.charCodeAt(i++);
24			chr2 = input.charCodeAt(i++);
25			chr3 = input.charCodeAt(i++);
26			enc1 = chr1 >> 2;
27			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
28			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
29			enc4 = chr3 & 63;
30			if (isNaN(chr2)) {
31				enc3 = enc4 = 64;
32			} else if (isNaN(chr3)) {
33				enc4 = 64;
34			}
35			output = output +
36			_keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
37			_keyStr.charAt(enc3) + _keyStr.charAt(enc4);
38		}
39		return output;
40	}
41 
42	// public method for decoding
43	this.decode = function (input) {
44		var output = "";
45		var chr1, chr2, chr3;
46		var enc1, enc2, enc3, enc4;
47		var i = 0;
48		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
49		while (i < input.length) {
50			enc1 = _keyStr.indexOf(input.charAt(i++));
51			enc2 = _keyStr.indexOf(input.charAt(i++));
52			enc3 = _keyStr.indexOf(input.charAt(i++));
53			enc4 = _keyStr.indexOf(input.charAt(i++));
54			chr1 = (enc1 << 2) | (enc2 >> 4);
55			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
56			chr3 = ((enc3 & 3) << 6) | enc4;
57			output = output + String.fromCharCode(chr1);
58			if (enc3 != 64) {
59				output = output + String.fromCharCode(chr2);
60			}
61			if (enc4 != 64) {
62				output = output + String.fromCharCode(chr3);
63			}
64		}
65		output = _utf8_decode(output);
66		return output;
67	}
68 
69	// private method for UTF-8 encoding
70	_utf8_encode = function (string) {
71		string = string.replace(/\r\n/g,"\n");
72		var utftext = "";
73		for (var n = 0; n < string.length; n++) {
74			var c = string.charCodeAt(n);
75			if (c < 128) {
76				utftext += String.fromCharCode(c);
77			} else if((c > 127) && (c < 2048)) {
78				utftext += String.fromCharCode((c >> 6) | 192);
79				utftext += String.fromCharCode((c & 63) | 128);
80			} else {
81				utftext += String.fromCharCode((c >> 12) | 224);
82				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
83				utftext += String.fromCharCode((c & 63) | 128);
84			}
85 
86		}
87		return utftext;
88	}
89 
90	// private method for UTF-8 decoding
91	_utf8_decode = function (utftext) {
92		var string = "";
93		var i = 0;
94		var c = c1 = c2 = 0;
95		while ( i < utftext.length ) {
96			c = utftext.charCodeAt(i);
97			if (c < 128) {
98				string += String.fromCharCode(c);
99				i++;
100			} else if((c > 191) && (c < 224)) {
101				c2 = utftext.charCodeAt(i+1);
102				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
103				i += 2;
104			} else {
105				c2 = utftext.charCodeAt(i+1);
106				c3 = utftext.charCodeAt(i+2);
107				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
108				i += 3;
109			}
110		}
111		return string;
112	}
113}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.