PageSourceSearch

https://munksjo.com/wp-content/themes/uncode/library/js/lib/cells-by-row.js?ver=597385404

js munksjo.com collected 2026-10-02 11:11:45 UTC 1,721 bytes, 66 lines download raw bytes

1/*!
2 * cellsByRows layout mode for Isotope
3 * v1.1.3
4 * http://isotope.metafizzy.co/layout-modes/cellsbyrow.html
5 */
6
7/*jshint browser: true, devel: false, strict: true, undef: true, unused: true */
8
9( function( window, factory ) {
10  // universal module definition
11  /* jshint strict: false */ /*globals define, module, require */
12  if ( typeof define === 'function' && define.amd ) {
13    // AMD
14    define( [
15        'isotope/js/layout-mode'
16      ],
17      factory );
18  } else if ( typeof exports === 'object' ) {
19    // CommonJS
20    module.exports = factory(
21      require('isotope-layout/js/layout-mode')
22    );
23  } else {
24    // browser global
25    factory(
26      window.Isotope.LayoutMode
27    );
28  }
29
30}( window, function factory( LayoutMode ) {
31  'use strict';
32
33  var CellsByRow = LayoutMode.create( 'cellsByRow' );
34  var proto = CellsByRow.prototype;
35
36  proto._resetLayout = function() {
37    // reset properties
38    this.itemIndex = 0;
39    // measurements
40    this.getColumnWidth();
41    this.getRowHeight();
42    // set cols
43    this.cols = Math.floor( this.isotope.size.innerWidth / this.columnWidth );
44    this.cols = Math.max( this.cols, 1 );
45  };
46
47  proto._getItemLayoutPosition = function( item ) {
48    item.getSize();
49    var col = this.itemIndex % this.cols;
50    var row = Math.floor( this.itemIndex / this.cols );
51    // center item within cell
52    var x = ( col + 0.5 ) * this.columnWidth - item.size.outerWidth / 2;
53    var y = ( row + 0.5 ) * this.rowHeight - item.size.outerHeight / 2;
54    this.itemIndex++;
55    return { x: x, y: y };
56  };
57
58  proto._getContainerSize = function() {
59    return {
60      height: Math.ceil( this.itemIndex / this.cols ) * this.rowHeight
61    };
62  };
63
64  return CellsByRow;
65
66}));

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.