PageSourceSearch

https://k-masui.com/wp-content/themes/k-masui/js/jquery.imageanimation.js

js k-masui.com collected 2026-10-02 20:32:37 UTC 1,912 bytes, 66 lines download raw bytes

1/*
2 * imageAnimation
3 *
4 *Copyright(c) 2010 suzken(http://suzken.com)
5 *
6 *Modified: 2010-10-14
7 *
8 *jQuery 1.4.2
9 */
10
11(function($){
12	$.imageAnimation = function(option){
13		var conf = $.extend({
14			selector: 'koma_',
15			komaTime: 100
16		},option);
17		var tempArray = new Array();
18		var add;
19		var prev;
20
21		function animeStart(obj){
22			obj.timerId = setInterval(function(){
23				if(prev = $(obj).css('backgroundPositionX')){
24					prev = Math.abs(prev.replace(/px/, ''));
25					if(prev >= obj.komaImage.width - obj.komaImage.width / obj.komaNum){
26						$(obj).css('backgroundPositionX', '-' + (obj.komaImage.width / obj.komaNum) + 'px');
27					}else{
28						add =  prev + obj.komaImage.width / obj.komaNum;
29						$(obj).css('backgroundPositionX', '-' + add + 'px');
30					}
31				}else{
32					prev = Math.abs($(obj).css('backgroundPosition').replace(/-?([0-9]+)px -?[0-9]+px/, '$1'));
33					if(prev >= obj.komaImage.width - obj.komaImage.width / obj.komaNum){
34						$(obj).css('backgroundPosition', '-' + (obj.komaImage.width / obj.komaNum) + 'px 0px');
35					}else{
36						add =  prev + obj.komaImage.width / obj.komaNum;
37						$(obj).css('backgroundPosition', '-' + add + 'px 0px');
38					}
39				}
40			}, conf.komaTime);
41		}
42
43		$('[class*=' + conf.selector + ']').each(function(){
44			this.komaNum = 0;
45			tempArray = $(this).attr('class').split(' ');
46			for(var i = 0, l = tempArray.length; i < l; i++){
47				if(tempArray[i].match(new RegExp('^' + conf.selector + '([0-9]{1,2})$'))){
48					this.komaNum = RegExp.$1;
49					this.komaNum++;
50				}
51			}
52
53			if(this.komaNum == 0) return false;
54			this.komaImage = new Image();
55			this.komaImage.src = $(this).css('backgroundImage').replace(/^url\(\"?([\w-\/\.:]+)\"?\)$/, '$1');
56
57			$(this).mouseover(function(){
58				animeStart(this);
59			});
60			$(this).mouseout(function(){
61				$(this).css('backgroundPosition', '0px 0px');
62				clearInterval(this.timerId);
63			});
64		});
65	};
66})(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.