PageSourceSearch

https://akipress.com/uiall-css/aki_gallery/aki_gallery.js?11

js akipress.com collected 2026-09-24 15:17:30 UTC 13,956 bytes, 284 lines download raw bytes

1if (typeof aki_galleryjs_loaded !== 'undefined') {} else { var aki_galleryjs_loaded = 1; }
2if (aki_gallery == undefined) { var aki_gallery = []; }
3if (aki_gallery_title == undefined) { var aki_gallery_title = []; }
4
5var aki_gallery_sizes = [500, 250];
6
7function aki_gallery_getsize(aki_gallery_winwidth) {
8  var aki_gallery_sizes_key = ['.max','','.'+500, '.'+250];
9  var aki_gallery_sizes_val = [3840,1000,500,250];
10
11  aki_gallery_sendsize='.max';
12
13  aki_gallery_sizes_val.forEach(function callback(value, index) {
14    if (aki_gallery_winwidth < value) {
15      aki_gallery_sendsize = aki_gallery_sizes_key[index];
16    }
17    else{return aki_gallery_sendsize;}
18  });
19  return aki_gallery_sendsize;
20  // var aki_gallery_sendsize = '';
21  // aki_gallery_sizes.forEach(function(item) {
22  //     if (aki_gallery_winwidth < item) {
23  //         aki_gallery_sendsize = '.' + item;
24  //     }
25  //     else{return aki_gallery_sendsize;}
26  // });
27  // return aki_gallery_sendsize;
28}
29
30function aki_gallery_full_screen(id) {
31    $('.aki_gallery_full_bg').fadeIn();
32    $('.aki_gallery_full_block').fadeIn(100);
33    $(".aki_gallery_full_block").html($('.aki_gallery_' + id).html());
34    var order = parseInt($('.aki_gallery_cur_order' + id).val());
35    $('.aki_gallery_cur').val(id);
36    $('body').css('overflow', 'hidden');
37    aki_gallery_change_gallery(id, order, 2);
38    $(".aki_gallery_full_block").append('<div class="aki_gallery_full_close"><div></div></div>');
39}
40
41function aki_gallery_change_gallery(id, order, where) {
42
43    order = parseInt(order);
44    var window_w = $('.aki_gallery_' + id).width();
45    var all = parseInt($('.aki_gallery_all_order' + id).val());
46
47    aki_gallery_va(id, order, where);
48
49    $('.aki_gallery_cur_order' + id).val(order);
50
51    if ($('.aki_gallery_thumbs_' + id).length) {
52        var thumb_size = 95;
53        var thumb_mid = parseInt((window_w / 2) / thumb_size);
54        var thumb_inpage = parseInt(window_w / thumb_size);
55        var all_size = thumb_size * all;
56
57        if (order > thumb_mid && window_w < all_size) {
58            var setmargin = (thumb_size * (order - thumb_mid));
59            if (((all - thumb_inpage) * thumb_size) < setmargin) {
60                setmargin = (all - thumb_inpage) * thumb_size;
61            }
62            $('.aki_gallery_thumbs_' + id + ' .aki_gallery_thumb:first-child').stop(true, true).animate({ 'margin-left': '-' + setmargin + 'px' }, 200);
63        } else {
64            $('.aki_gallery_thumbs_' + id + ' .aki_gallery_thumb:first-child').stop(true, true).animate({ 'margin-left': '0' }, 200);
65        }
66        $('.aki_gallery_thumbs_' + id + ' .aki_gallery_thumb').removeClass('aki_gallery_sel');
67        $('.aki_gallery_thumbs_' + id + ' .aki_gallery_thumb_' + order).addClass('aki_gallery_sel');
68    }
69}
70
71function aki_gallery_prev(id, where) {
72    var all = parseInt($('.aki_gallery_all_order' + id).val());
73    var order = parseInt($('.aki_gallery_cur_order' + id).val());
74    if (order == 0) {
75        order = all - 1;
76    } else { order--; }
77    aki_gallery_change_gallery(id, order, where);
78}
79
80function aki_gallery_next(id, where) {
81    var all = parseInt($('.aki_gallery_all_order' + id).val());
82    var order = parseInt($('.aki_gallery_cur_order' + id).val());
83    if (order + 1 == all) {
84        order = 0;
85    } else { order++; }
86    aki_gallery_change_gallery(id, order, where);
87}
88
89function aki_gallery_va(id, order, where) {
90    //console.log('aki_gallery_va(' + id + ',' + order + ',' + where + ')');
91    $('.aki_gallery_' + id + ' img').fadeOut(0);
92    var window_w = $('.aki_gallery_' + id).width();
93    var window_h = $('.aki_gallery_' + id).height();
94    var all = parseInt($('.aki_gallery_all_order' + id).val());
95    $('.aki_gallery_' + id + ' img').attr('data-id', id);
96    $('.aki_gallery_' + id + ' img').attr("src", (location.protocol == "https:" ? "https:" : "http:") + "//" + aki_gallery[id][order] + aki_gallery_getsize(window_w) + ".jpg").one("load", function() {
97        $(this).attr('alt', aki_gallery_title[id][order]);
98        if (aki_gallery_title[id][order].length > 1) {
99            $('.aki_gallery_info_' + id + ' .aki_gallery_title').html('<div class="aki_gallery_tittoggle" data-id="' + id + '">&#9679;&#9679;&#9679;</div><div class="tit_text">' + aki_gallery_title[id][order] + '</div>');
100            var show_desc = $('.aki_gallery_show_desc' + id).val();
101            if (show_desc == 0) $('.aki_gallery_info_' + id + ' .aki_gallery_title .tit_text').hide();
102        } else { $('.aki_gallery_info_' + id + ' .aki_gallery_title').html(''); }
103        $('.aki_gallery_' + id + ' .aki_gallery_cnter').html((order + 1) + '<br><div>' + all + '</div>');
104
105        var img_h = parseInt($(this).height());
106        var img_margin = parseInt((window_h - img_h) / 2);
107        /*
108              if(img_margin>1){$(this).css('margin-top',img_margin+'px');}
109              else{$(this).css('margin-top',0);}
110        */
111        $(this).fadeIn(100);
112    });
113    $('.aki_gallery_cur').val(id);
114    if (where == 2) {
115        $('.aki_gallery_full_block img').fadeOut(0);
116        var fwindow_w = $('.aki_gallery_full_block').width();
117        var fwindow_h = $('.aki_gallery_full_block').height();
118
119        $('.aki_gallery_full_block img').attr('data-id', id);
120        $('.aki_gallery_full_block img').attr("src", (location.protocol == "https:" ? "https:" : "http:") + "//" + aki_gallery[id][order] + aki_gallery_getsize(fwindow_w) + ".jpg").one("load", function() {
121
122            var fimg_h = parseInt($(this).height());
123            var fimg_margin = parseInt((fwindow_h - fimg_h) / 2);
124            $('.aki_gallery_full_block .aki_gallery_cnter').html((order + 1) + '<br><div>' + all + '</div>');
125            $('.aki_gallery_full_block .aki_gallery_title .tit_text').html(aki_gallery_title[id][order]);
126            /*
127            if(fimg_margin>1){$('.aki_gallery_full_block img').css('margin-top',fimg_margin+'px');}
128            else{$('.aki_gallery_full_block img').css('margin-top',0);}
129            */
130            $(this).fadeIn(100);
131        });
132    }
133
134}
135
136function aki_gallery_full_screen_close() {
137    $('.aki_gallery_full,.aki_gallery_full_block,.aki_gallery_full_bg').hide();
138    $('.aki_gallery_full_block').html('');
139    $('.aki_gallery_cur').val(0);
140    $('body').css('overflow', 'auto');
141}
142$(document).ready(function() {
143
144    /* def gallery */
145
146    if ($('.gallery .elem').length && !$('.aki_gallery').length) {
147        //console.log($('.gallery .elem').length);
148        var temp_array = new Array();
149        var temp_array2 = new Array();
150        var i = 0;
151        $('.gallery .elem').each(function() {
152            $(this).attr('data-order', i);
153            $(this).attr('data-id', 1);
154            var link = $(this).attr('href');
155            link = link.replace(".jpg", "");
156            link = link.replace("http://", "");
157            temp_array.push(link);
158            temp_array2.push('');
159            $(this).attr('href', 'javascript: void(0)');
160            i++;
161        });
162        aki_gallery[1] = temp_array;
163        aki_gallery_title[1] = temp_array2;
164        if ($('.aki_gallery_full_block').length) {} else { $('body').append("<div class='aki_gallery_full_block'></div><div class='aki_gallery_full_bg'></div>"); }
165        $('body').append("" +
166            "<div class='aki_gallery_hidden'><div class='aki_gallery aki_gallery_1' data-id='1' data-style='2'><div class='aki_gallery_case' data-id='1'><img /></div><div class='aki_gallery_info aki_gallery_info_1'><div class='aki_gallery_title'></div></div><div class='aki_gallery_cnter'></div><div class='aki_gallery_arrows aki_gallery_left' data-id='1'><div></div></div><div class='aki_gallery_arrows aki_gallery_right' data-id='1'><div></div></div><div class='aki_gallery_arrows aki_gallery_zoom' data-id='1'><div class='aki_gallery_button_in'>⇳</div></div></div></div>" +
167            "<input type='hidden' value='1' class='aki_gallery_show_desc aki_gallery_show_desc1' data-id='1'><input type='hidden' value='0' class='aki_gallery_cur_order aki_gallery_cur_order1' data-id='1'><input type='hidden' value='" + $('.gallery .elem').length + "' class='aki_gallery_all_order aki_gallery_all_order1' data-id='1'><input type='hidden' value='0' class='aki_gallery_cur'>");
168        $(document).on("click", ".gallery .elem", function() {
169
170            var id = 1;
171            $('.aki_gallery_cur_order' + id).val($(this).data('order'));
172            aki_gallery_full_screen(id);
173        });
174    }
175
176    /* def gallery end */
177
178    $(document).on("click", ".aki_gallery_styled_list img", function() {
179        var id = $(this).data('id');
180        $('.aki_gallery_cur_order' + id).val($(this).data('order'));
181        //var order=$(this).data('order');
182        aki_gallery_full_screen(id);
183    });
184    /*
185        $(document).on("swipeleft", ".aki_gallery_case,.aki_gallery_full_block", function() {
186            var id = $(this).data('id');
187            aki_gallery_next(id, 1);
188        });
189        $(document).on("swiperight", ".aki_gallery_case,.aki_gallery_full_block", function() {
190            var id = $(this).data('id');
191            aki_gallery_prev(id, 1);
192        });
193    */
194    $(document).on("click", ".aki_gallery .aki_gallery_left", function() {
195        var id = $(this).data('id');
196        aki_gallery_prev(id, 1);
197    });
198    $(document).on("click", ".aki_gallery .aki_gallery_right", function() {
199        var id = $(this).data('id');
200        aki_gallery_next(id, 1);
201    });
202    $(document).on("click", ".aki_gallery img", function() {
203        //$( ".aki_gallery img" ).not($('.aki_gallery_arrows')).on('click',function() {
204        var id = $(this).data('id');
205        aki_gallery_full_screen(id);
206    });
207    $(document).on("click", ".aki_gallery .aki_gallery_zoom", function() {
208        var id = $(this).data('id');
209        aki_gallery_full_screen(id);
210    });
211    $(document).on("click", ".aki_gallery_thumb", function() {
212        var id = $(this).data('id');
213        var order = $(this).data('order');
214        aki_gallery_change_gallery(id, order, 1);
215    });
216    $(document).on("click", ".aki_gallery_tittoggle", function() {
217        var id = $(this).data('id');
218        var show_desc = $('.aki_gallery_show_desc' + id).val();
219        if (show_desc == 0) { $('.aki_gallery_show_desc' + id).val(1); } else { $('.aki_gallery_show_desc' + id).val(0); }
220        $('.aki_gallery_' + id + ' .aki_gallery_title .tit_text,.aki_gallery_full_block .aki_gallery_title .tit_text').toggle();
221    });
222    $(document).on("click", ".aki_gallery_full_block .aki_gallery_zoom,.aki_gallery_full_block .aki_gallery_full_close", function() {
223        aki_gallery_full_screen_close();
224    });
225    $(document).on("click", ".aki_gallery_full_block .aki_gallery_left", function() {
226        var id = $(this).data('id');
227        aki_gallery_prev(id, 2);
228    });
229    $(document).on("click", ".aki_gallery_full_block .aki_gallery_right", function() {
230        var id = $(this).data('id');
231        aki_gallery_next(id, 2);
232    });
233
234    $(document).on("click", ".aki_gallery_full_block .aki_gallery_case", function(e) {
235        var id = $(this).data('id');
236        var posX = $(this).position().left;
237        var w = $(this).width();
238        if ((e.pageX - posX) > (w / 3)) {
239            aki_gallery_next(id, 2);
240        } else { aki_gallery_prev(id, 2); }
241        //alert((e.pageX - posX) + ' , ' + (e.pageY - posY));
242    });
243    $(document).on('mousemove', function(e) {
244        var w = $(document).width();
245        if ((e.pageX) > (w / 3)) {
246            $(".aki_gallery_full_block").find('.aki_gallery_left.light').removeClass('light');
247            $(".aki_gallery_full_block").find('.aki_gallery_right:not(.light)').addClass('light');
248        } else {
249            $(".aki_gallery_full_block").find('.aki_gallery_right.light').removeClass('light');
250            $(".aki_gallery_full_block").find('.aki_gallery_left:not(.light)').addClass('light');
251        }
252    });
253    $(document).on('mouseleave', '.aki_gallery_full_block .aki_gallery_case', function() {
254        $(".aki_gallery_full_block").find('.aki_gallery_arrows.light').removeClass('light');
255    });
256
257    $('.aki_gallery').each(function() {
258        var id = $(this).data('id');
259        var style = $(this).data('style');
260        if (style == '1') {
261            //console.log(aki_gallery);
262            aki_gallery_va(id, 0, 1);
263        } else if (style == '2') {
264            var window_w = $('.aki_gallery_styled_' + id).width();
265            $.each(aki_gallery[id], function(key, val) {
266                $('.aki_gallery_styled_' + id).append('<div class="aki_gallery_styled_list"><img src="' + (location.protocol == "https:" ? "https:" : "http:") + '//' + val + aki_gallery_getsize(window_w) + '.jpg" data-id="' + id + '" data-order="' + key + '"><div>' + aki_gallery_title[id][key] + '</div></div>');
267            });
268        } else if (style == '3') {
269            var window_w = $('.aki_gallery_styled_' + id).width();
270            $.each(aki_gallery[id], function(key, val) {
271                $('.aki_gallery_styled_' + id).append('<div class="aki_gallery_styled_list"><img src="' + (location.protocol == "https:" ? "https:" : "http:") + '//' + val + '.500.jpg" data-id="' + id + '" data-order="' + key + '"><div>' + aki_gallery_title[id][key] + '</div></div>');
272            });
273        }
274    });
275});
276$(document).keydown(function(e) {
277    var aki_gallery_id = $('.aki_gallery_cur').val();
278    if (aki_gallery_id > 0) {
279        if (e.keyCode === 37) { aki_gallery_prev(aki_gallery_id, 2); } // left
280        if (e.keyCode === 39) { aki_gallery_next(aki_gallery_id, 2); } // right
281    }
282    if (e.keyCode === 27) { aki_gallery_full_screen_close(); } // esc
283});
284var aki_galleryjs_loaded = true;

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.