PageSourceSearch

https://kanatawinery.com/wp-content/themes/kanatawinery/assets/js/ImageManager_ex.js?ver=1712553480

js kanatawinery.com collected 2026-10-04 12:32:10 UTC 2,962 bytes, 116 lines download raw bytes

1jQuery(function(exports) {
2    exports.sample = exports.sample || {};
3    var module = exports.sample;
4
5    /**
6     * 画像の読み込みを管理
7     *
8     * @constructor
9     */
10    module.ImageManager = function(){
11
12    };
13    //-----------------------------------------
14    // Header
15    //-----------------------------------------
16
17    // リスナー管理
18    module.ImageManager.listeners = {};
19
20    /**
21     * 画像読み込みを監視する。
22     *
23     * @param target
24     * @param completeFunc
25     * @param scope
26     * @param origin
27     */
28    module.ImageManager.watch = function(target, completeFunc, scope, origin){
29        var offset = new Date().getMilliseconds();
30        if(module.ImageManager.listeners[target[0].src + offset]) return;
31        var struct = new ImageStruct(target, completeFunc, scope, origin);
32        module.ImageManager.listeners[target[0].src] = struct;
33        struct.loadImage();
34        return struct;
35    };
36
37    /**
38     * 画像読み込み構造体
39     *
40     * @param target
41     * @param scope
42     * @param compFunc
43     * @param args
44     * @constructor
45     */
46    var ImageStruct = function(target, scope, compFunc, args){
47        this.target = target;
48        this.scope = scope;
49        this.callBacks = [];
50        this.addCallBack(scope, compFunc, args);
51        this.counter = 0;
52        this.counterMax = this.target.length;
53    };
54
55    /**
56     * 画像読み込み
57     */
58    ImageStruct.prototype['loadImage'] = function(){
59        var _this = this;
60        this.target.each(function(key, image){
61            image.orginSrc = image.src;
62            image.src = "";
63
64            jQuery(image).bind("load", function(){
65                _this.counter++;
66                if(_this.counter == _this.counterMax){
67                    //console.log("complete = ", _this.counter);
68                    _this.execute();
69                }
70            });
71
72            image.src = image.orginSrc;
73        });
74    };
75
76    /**
77     * コールバック処理の登録
78     * @param scope
79     * @param func
80     * @param args
81     */
82    ImageStruct.prototype['addCallBack'] = function(scope, func, args){
83        var callBack = new CallBack(scope, func, args);
84        this.callBacks.push(callBack);
85    };
86
87    /**
88     * コールバックを実行
89     */
90    ImageStruct.prototype['execute'] = function(){
91        for(var i = 0; i < this.callBacks.length; ++i){
92            var callBack = this.callBacks[i];
93            callBack.execute();
94        }
95    };
96
97    /**
98     * コールバックオブジェクト
99     * @param scope
100     * @param func
101     * @param args
102     * @constructor
103     */
104    var CallBack = function(scope, func, args) {
105        this.scope = scope;
106        this.func = func;
107        this.args = args;
108    }
109
110    /**
111     * コールバック処理を実行
112     */
113    CallBack.prototype['execute'] = function(){
114        this.func.apply(this.scope, [this.args]);
115    }
116});

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.