PageSourceSearch

https://www.links.co.jp/wp-content/plugins/print-o-matic/printomat.js?ver=1.8.6

js links.co.jp collected 2026-10-02 10:06:32 UTC 6,127 bytes, 175 lines download raw bytes

1/*!
2 * Print-O-Matic JavaScript v1.8.6
3 * http://plugins.twinpictures.de/plugins/print-o-matic/
4 *
5 * Copyright 2017, Twinpictures
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, blend, trade,
11 * bake, hack, scramble, difiburlate, digest and/or sell copies of the Software,
12 * and to permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 */
26
27jQuery(document).ready(function() {
28	jQuery('.printomatic, .printomatictext').click(function() {
29		var id = jQuery(this).attr('id');
30		var target = jQuery(this).data('print_target');
31		if(!target){
32			target = jQuery('#target-' + id).val();
33		}
34		if (target == '%prev%') {
35			target = jQuery(this).prev();
36		}
37		if (target == '%next%') {
38			target = jQuery(this).next();
39		}
40
41		var w = window.open('', 'printomatic print page', 'status=no, toolbar=no, menubar=no, location=no');
42
43		var print_html = '<!DOCTYPE html><html><head><title>' + document.getElementsByTagName('title')[0].innerHTML + '</title>';
44		if ( typeof print_data != 'undefined' && typeof print_data[id] != 'undefined'){
45
46			if ( 'pom_site_css' in print_data[id] && print_data[id]['pom_site_css'] ){
47				print_html += '<link rel="stylesheet" type="text/css" href="' + print_data[id]['pom_site_css'] + '" />';
48			}
49
50			if ( 'pom_custom_css' in print_data[id] && print_data[id]['pom_custom_css']){
51				print_html += '<style>'+ print_data[id]['pom_custom_css'] +'</style>';
52			}
53
54			//build the blank page
55			w.document.open();
56			w.document.write( print_html + '</head><body></body></html>');
57			w.document.close();
58
59			if ( 'pom_do_not_print' in print_data[id] && print_data[id]['pom_do_not_print'] ){
60				jQuery(print_data[id]['pom_do_not_print']).hide();
61			}
62
63			if ( 'pom_html_top' in print_data[id] && print_data[id]['pom_html_top']){
64				jQuery(w.document.body).html( print_data[id]['pom_html_top'] );
65			}
66
67		}
68
69		var ua = window.navigator.userAgent;
70		var ie = true;
71
72		//rot in hell IE
73		if ( ua.indexOf("MSIE ") != -1) {
74			//alert('MSIE - Craptastic');
75			jQuery(w.document.body).append( jQuery( target ).clone( true ).html() );
76		}
77		else if ( ua.indexOf("Trident/") != -1) {
78			//console.log('IE 11 - Trident');
79			jQuery(w.document.body).append( jQuery( target ).clone( true ).html() );
80		}
81		else if ( ua.indexOf("Edge/") != -1 ){
82			//console.log('IE 12 - Edge');
83			//there is a bug in Edge where no nested elements can be appended.
84			jQuery( target ).each(function(){
85				var s = jQuery.trim( jQuery( this ).clone( true ).html() );
86				jQuery( w.document.body ).append( s );
87			});
88		}
89		else{
90			//console.log('good browser');
91			jQuery(w.document.body).append( jQuery( target ).clone( true ) );
92			ie = false;
93		}
94
95		if ( typeof print_data != 'undefined' && typeof print_data[id] != 'undefined'){
96            if ( 'pom_do_not_print' in print_data[id] ){
97                jQuery( print_data[id]['pom_do_not_print']).show();
98            }
99
100            if ( 'pom_html_bottom' in print_data[id] && print_data[id]['pom_html_bottom']){
101				jQuery(w.document.body).append( jQuery.trim( print_data[id]['pom_html_bottom'] ) );
102			}
103		}
104
105		//for IE cycle through and fill in any text input values... rot in hell IE
106		if(ie){
107			jQuery( target ).find('input[type=text]').each(function() {
108				var user_val = jQuery(this).val();
109				if(user_val){
110					var elem_id = jQuery(this).attr('id');
111					if(elem_id){
112						w.document.getElementById(elem_id).value = user_val;
113					}
114					else{
115						//we really should have a ID, let's try and grab the element by name attr.
116						var elem_name = jQuery(this).attr('name');
117						if(elem_name.length){
118							named_elements = w.document.getElementsByName(elem_name);
119							named_elements[0].value = user_val;
120
121						}
122					}
123				}
124			});
125
126			//select values?
127			jQuery( target ).find('select').each(function(i) {
128				console.log('found one: ' + i);
129				var sel_val = jQuery(this).val();
130				console.log('value is: ' + sel_val);
131				if(sel_val){
132					var elem_id = jQuery(this).attr('id');
133					if(elem_id){
134						w.document.getElementById(elem_id).value = sel_val;
135					}
136				}
137			});
138		}
139
140		/* hardcodeed iframe and if so, force a pause... pro version offers more options */
141
142		iframe = jQuery(w.document).find('iframe');
143		if (iframe.length && typeof print_data != 'undefined' && typeof print_data[id] != 'undefined') {
144            if('pom_pause_time' in print_data[id] && print_data[id]['pom_pause_time'] < 3000){
145                print_data[id]['pom_pause_time'] = 3000;
146            }
147            else if(print_data[id]['pom_pause_time'] === 'undefined'){
148                print_data[id]['pom_pause_time'] = 3000;
149            }
150		}
151
152        if(typeof print_data != 'undefined' && typeof print_data[id] != 'undefined' && 'pom_pause_time' in print_data[id] && print_data[id]['pom_pause_time'] > 0){
153            pause_time = setTimeout(printIt, print_data[id]['pom_pause_time']);
154        }
155		else{
156			printIt();
157		}
158
159		function printIt(){
160			w.focus();
161		    w.print();
162
163			if('pom_close_after_print' in print_data[id] && print_data[id]['pom_close_after_print'] == '1'){
164				//need a bit of a pause to let safari on iOS render the print privew properly
165				setTimeout(
166					function() {
167						w.close()
168					}, 1000
169				);
170			}
171		}
172
173	});
174
175});

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.