PageSourceSearch

https://hantak.co.jp/common/js/iepngfix.js

js hantak.co.jp collected 2026-10-04 06:13:40 UTC 3,218 bytes, 125 lines download raw bytes

1/*
2 * IE PNG Fix v1.4
3 *
4 * Copyright (c) 2006 Takashi Aida http://www.isella.com/aod2/
5 *
6 */
7
8// IE5.5+ PNG Alpha Fix v1.0RC4
9// (c) 2004-2005 Angus Turnbull http://www.twinhelix.com
10
11// This is licensed under the CC-GNU LGPL, version 2.1 or later.
12// For details, see: http://creativecommons.org/licenses/LGPL/2.1/
13
14if (typeof IEPNGFIX == 'undefined') {
15//--============================================================================
16
17var IEPNGFIX = {
18	blank:  'http://www.isella.com/aod2/images/blank.gif',
19	filter: 'DXImageTransform.Microsoft.AlphaImageLoader',
20
21	fixit: function (elem, src, method) {
22		if (elem.filters[this.filter]) {
23			var filter = elem.filters[this.filter];
24			filter.enabled = true;
25			filter.src = src;
26			filter.sizingMethod = method;
27		}
28		else {
29			elem.style.filter = 'progid:' + this.filter +
30				'(src="' + src + '",sizingMethod="' + method + '")';
31		}
32	},
33
34	fixwidth: function(elem) {
35		if (elem.currentStyle.width == 'auto' &&
36			elem.currentStyle.height == 'auto') {
37			elem.style.width = elem.offsetWidth + 'px';
38		}
39	},
40
41	fixchild: function(elem, recursive) {
42		if (!/MSIE (5\.5|6\.|7\.)/.test(navigator.userAgent)) return;
43
44		for (var i = 0, n = elem.childNodes.length; i < n; i++) {
45			var childNode = elem.childNodes[i];
46			if (childNode.style) {
47				if (childNode.style.position) {
48					childNode.style.position = childNode.style.position;
49				}
50				else {
51					childNode.style.position = 'relative';
52				}
53			}
54			if (recursive && childNode.hasChildNodes()) {
55				this.fixchild(childNode, recursive);
56			}
57		}
58	},
59
60	fix: function(elem) {
61		if (!/MSIE (5\.5|6\.|7\.)/.test(navigator.userAgent)) return;
62
63		var bgImg =
64			elem.currentStyle.backgroundImage || elem.style.backgroundImage;
65
66		if (elem.tagName == 'IMG') {
67			if ((/\.png$/i).test(elem.src)) {
68				this.fixwidth(elem);
69				this.fixit(elem, elem.src, 'scale');
70				elem.src = this.blank;
71				elem.runtimeStyle.behavior = 'none';
72			}
73		}
74		else if (bgImg && bgImg != 'none') {
75			if (bgImg.match(/^url[("']+(.*\.png)[)"']+$/i)) {
76				var s = RegExp.$1;
77				this.fixwidth(elem);
78				elem.style.backgroundImage = 'none';
79				this.fixit(elem, s, 'scale'); // crop | image | scale
80
81				if (elem.tagName == 'A' && elem.style) {
82					if (!elem.style.cursor) {
83						elem.style.cursor = 'pointer';
84					}
85				}
86
87				this.fixchild(elem);
88				elem.runtimeStyle.behavior = 'none';
89			}
90		}
91	},
92
93	hover: function(elem, hvImg) {
94		var bgImg = elem.style.backgroundImage;
95
96		if (!bgImg && elem.currentStyle) bgImg = elem.currentStyle.backgroundImage;
97
98		if (elem.tagName == 'IMG' && hvImg) {
99			var image = elem.src;
100			elem.onmouseover = function() {
101				elem.src = hvImg;
102				IEPNGFIX.fix(elem);
103			};
104			elem.onmouseout = function() {
105				elem.src = image;
106				IEPNGFIX.fix(elem);
107			};
108		}
109		else if (bgImg && bgImg != 'none' && hvImg) {
110			elem.onmouseover = function() {
111				elem.style.backgroundImage = 'url(' + hvImg + ')';
112				IEPNGFIX.fix(elem);
113			};
114			elem.onmouseout = function() {
115				elem.style.backgroundImage = bgImg;
116				IEPNGFIX.fix(elem);
117			};
118		}
119
120		IEPNGFIX.fix(elem);
121	}
122};
123
124//--============================================================================
125} // end if (typeof IEPNGFIX == 'undefined')

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.