PageSourceSearch

https://faraon78.ru/g/printme.js

js faraon78.ru collected 2026-09-30 02:58:35 UTC 2,701 bytes, 111 lines download raw bytes

1var s3 = s3 || {};
2
3s3.printMe = (function() {
4
5	function printMe(id, options) {
6		var el, w, content = [], i, len;
7
8		id = id || 'printMe';
9		el = document.getElementById(id);
10
11		if (!el) {
12			return false;
13		}
14		
15		options = options || {};
16		options.doctype = options.doctype || printMe.doctype;
17		options.stylesheet = options.stylesheet || printMe.stylesheet;
18		options.window = printMe.extend(options.window, printMe.window);
19		options.styles = printMe.extend(options.styles, printMe.styles);
20		
21		content.push(printMe.doctypes[options.doctype]);
22		
23		if (!options.stylesheet) {
24			content.push('<style>');
25			content.push(printMe.join(options.styles, '\n', '{', '}'));
26			content.push('</style>');
27		} else {
28			if (!printMe.isArray(options.stylesheet)) {
29				options.stylesheet = [options.stylesheet];
30			}
31			for (i = 0, len = options.stylesheet.length; i < len; i++) {
32				content.push('<link rel="stylesheet" href="' + options.stylesheet[i] + '" />');
33			}
34		}
35
36		content.push('<body onload="print()">');
37		content.push(el.innerHTML);
38		content.push('</body>');
39		content.push('</html>');
40
41		w = window.open('', 'printMe', printMe.join(options.window, ',', '='));
42		w.document.write(content.join('\n'));
43		w.document.close();
44		w.focus();
45	}
46
47	printMe.doctypes = {
48		'html:5': '<!doctype html>\n<html lang="en">',
49		'html:xt': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">'
50	};
51
52	printMe.doctype = 'html:5';
53
54	printMe.styles = {
55		'body, td': 'font-size:12px; font-family: verdana;',
56		'table.table1': 'font-size:8pt; border-collapse: collapse; font-family: verdana;',
57		'table.table1 td': 'padding: 4px; border: 1px solid #333333;',
58		'table.table0': 'font-size:8pt; border-collapse: collapse; font-family: verdana;'
59	};
60
61	printMe.window = {
62		width: 700,
63		height: 600,
64		toolbar: 0,
65		directories: 0,
66		menubar: 0,
67		status: 0,
68		resizable: 1,
69		location: 0,
70		scrollbars: 'yes',
71		copyhistory: 0,
72		top: 10,
73		left: 10
74	};
75
76	printMe.extend = function(a, b) {
77		var prop;
78
79		a = a || {};
80
81		for (prop in b) {
82			if (!a.hasOwnProperty(prop)) {
83				a[prop] = b[prop];
84			}
85		}
86
87		return a;
88	}
89
90	printMe.join = function(options, delimiter, ldelim, rdelim) {
91		var option, arr = [];
92
93		delimiter = delimiter || '\n';
94		ldelim = ldelim || '';
95		rdelim = rdelim || '';
96
97		for (option in options) {
98			arr.push(option + ldelim + options[option] + rdelim);
99		}
100		return arr.join(delimiter);
101	}
102
103	printMe.isArray = function(obj) {
104		return Object.prototype.toString.call(obj) == '[object Array]';
105	}
106
107	return printMe;
108
109})();
110
111var printMe = printMe || s3.printMe;

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.