PageSourceSearch

https://changzhi.gov.cn/irs-c-web/libs/jquery.flex-images.js?v20210104

js changzhi.gov.cn collected 2026-10-02 10:00:41 UTC 3,203 bytes, 70 lines download raw bytes

1/*
2	jQuery flexImages v1.0.4
3    Copyright (c) 2014 Simon Steinberger / Pixabay
4    GitHub: https://github.com/Pixabay/jQuery-flexImages
5	License: http://www.opensource.org/licenses/mit-license.php
6*/
7
8(function($){
9  $.fn.flexImages = function(options){
10      var o = $.extend({ container: '.item', object: 'img', rowHeight: 180, maxRows: 0, truncate: 0 }, options);
11      return this.each(function(){
12          var grid = $(this), containers = $(grid).find(o.container), items = [], t = new Date().getTime(),
13              s = window.getComputedStyle ? getComputedStyle(containers[0], null) : containers[0].currentStyle;
14          o.margin = (parseInt(s.marginLeft) || 0) + (parseInt(s.marginRight) || 0) + (Math.round(parseFloat(s.borderLeftWidth)) || 0) + (Math.round(parseFloat(s.borderRightWidth)) || 0);
15          for (j=0;j<containers.length;j++) {
16              var c = containers[j],
17                  w = parseInt(c.getAttribute('data-w')),
18                  norm_w = w*(o.rowHeight/parseInt(c.getAttribute('data-h'))), // normalized width
19                  obj = $(c).find(o.object);
20              items.push([c, w, norm_w, obj, obj.data('src')]);
21          }
22          makeGrid(grid, items, o);
23          $(window).off('resize.flexImages'+grid.data('flex-t'));
24          $(window).on('resize.flexImages'+t, function(){ makeGrid(grid, items, o); });
25          grid.data('flex-t', t)
26      });
27  }
28
29  function makeGrid(grid, items, o, noresize){
30      var x, new_w, ratio = 1, rows = 1, max_w = grid.width()-2, row = [], row_width = 0, row_h = o.rowHeight;
31      if (!max_w) max_w = grid.width()-2; // IE < 8 bug
32
33      // define inside makeGrid to access variables in scope
34      function _helper(lastRow){
35          if (o.maxRows && rows > o.maxRows || o.truncate && lastRow && rows > 1) row[x][0].style.display = 'none';
36          else {
37              if (row[x][4]) { row[x][3].attr('src', row[x][4]); row[x][4] = ''; }
38              row[x][0].style.width = new_w+'px';
39              row[x][0].style.height = row_h+'px';
40              row[x][0].style.display = 'block';
41          }
42      }
43
44      for (i=0; i<items.length; i++) {
45          row.push(items[i]);
46          row_width += items[i][2] + o.margin;
47          if (row_width >= max_w) {
48              var margins_in_row = row.length * o.margin;
49              ratio = (max_w-margins_in_row) / (row_width-margins_in_row), row_h = Math.ceil(o.rowHeight*ratio), exact_w = 0, new_w;
50              for (x=0; x<row.length; x++) {
51                  new_w = Math.ceil(row[x][2]*ratio);
52                  exact_w += new_w + o.margin;
53                  if (exact_w > max_w) new_w -= exact_w - max_w;
54                  _helper();
55              }
56              // reset for next row
57              row = [], row_width = 0;
58              rows++;
59          }
60      }
61      // layout last row - match height of last row to previous row
62      for (x=0; x<row.length; x++) {
63          new_w = Math.floor(row[x][2]*ratio), h = Math.floor(o.rowHeight*ratio);
64          _helper(true);
65      }
66
67      // scroll bars added or removed during rendering new layout?
68      if (!noresize && max_w != grid.width()) makeGrid(grid, items, o, true);
69  }
70}(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.