PageSourceSearch

https://www.toyota-lf.com/js/lib/jquery.replaceImageSP.js

js toyota-lf.com collected 2026-10-02 06:28:46 UTC 1,764 bytes, 64 lines download raw bytes

1/**
2 ***********************************************
3 * 
4 * 画像をSP用に差し替え
5 * 頭にSP_のついた画像を用意
6 * @category 	Application of AZLINK.
7 * @author 		Norio Murata <[email protected]>
8 * @copyright 	2010- AZLINK. <http://www.azlink.jp>
9 * @final 		2017.07.30
10 * 
11 ***********************************************
12 */
13(function($) {
14
15	var pluginName = 'replaceImageSP';
16	var options;
17	var $jq;
18
19	var methods = {
20		init: function(params) {
21			$jq = this;
22
23			options = $.extend({
24				pcName: 		'PC_',
25				spName: 		'SP_',
26				breakPoint: 	768
27			}, params);
28			
29			methods.replace.apply(this);
30
31			$(window).on('resize.rplSPImg', methods.replace);
32
33			return this;
34		},
35		replace: function() {
36			return $jq.each(function(i) {
37				if (parseInt($(window).width()) >= options.breakPoint) {
38					// $this.attr('src', $this.attr('src').replace(options.spName, options.pcName)).css('visibility', 'visible');
39					$(this).attr('src', $(this).attr('src').replace(options.spName, options.pcName));
40				} else {
41					// $this.attr('src', $this.attr('src').replace(options.pcName, options.spName)).css('visibility', 'visible');
42					$(this).attr('src', $(this).attr('src').replace(options.pcName, options.spName));
43				}
44			});
45		},
46		destroy: function() {
47			$(window).off('.rplSPImg');
48
49			return this;
50		}
51	};
52	
53	$.fn[pluginName] = function(method) {
54		if ( methods[method] ) {
55			return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
56		} else if (typeof method === 'object' || ! method) {
57			return methods.init.apply(this, arguments);
58		} else {
59			$.error('Method ' + method + ' does not exist on jQuery.' + pluginName);
60			return this;
61		}
62	};
63	
64}(jQuery));

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.