diff options
| author | erdgeist <erdgeist@bauklotz.fritz.box> | 2016-08-07 02:17:47 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@bauklotz.fritz.box> | 2016-08-07 02:17:47 +0200 |
| commit | 2653f6a943a6ed74e2b72246ba8211c5fb699a7f (patch) | |
| tree | 1583823bf875456212156452ba464933139c3ceb /js/core/grid.js | |
| parent | d850c105940f414caf44705191af8c8b19ca9c85 (diff) | |
restructured ;)
Diffstat (limited to 'js/core/grid.js')
| -rwxr-xr-x | js/core/grid.js | 117 |
1 files changed, 0 insertions, 117 deletions
diff --git a/js/core/grid.js b/js/core/grid.js deleted file mode 100755 index 2552f93..0000000 --- a/js/core/grid.js +++ /dev/null | |||
| @@ -1,117 +0,0 @@ | |||
| 1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
| 2 | (function(UI) { | ||
| 3 | |||
| 4 | "use strict"; | ||
| 5 | |||
| 6 | var grids = []; | ||
| 7 | |||
| 8 | UI.component('gridMatchHeight', { | ||
| 9 | |||
| 10 | defaults: { | ||
| 11 | "target" : false, | ||
| 12 | "row" : true, | ||
| 13 | "ignorestacked" : false, | ||
| 14 | "observe" : false | ||
| 15 | }, | ||
| 16 | |||
| 17 | boot: function() { | ||
| 18 | |||
| 19 | // init code | ||
| 20 | UI.ready(function(context) { | ||
| 21 | |||
| 22 | UI.$("[data-uk-grid-match]", context).each(function() { | ||
| 23 | var grid = UI.$(this), obj; | ||
| 24 | |||
| 25 | if (!grid.data("gridMatchHeight")) { | ||
| 26 | obj = UI.gridMatchHeight(grid, UI.Utils.options(grid.attr("data-uk-grid-match"))); | ||
| 27 | } | ||
| 28 | }); | ||
| 29 | }); | ||
| 30 | }, | ||
| 31 | |||
| 32 | init: function() { | ||
| 33 | |||
| 34 | var $this = this; | ||
| 35 | |||
| 36 | this.columns = this.element.children(); | ||
| 37 | this.elements = this.options.target ? this.find(this.options.target) : this.columns; | ||
| 38 | |||
| 39 | if (!this.columns.length) return; | ||
| 40 | |||
| 41 | UI.$win.on('load resize orientationchange', (function() { | ||
| 42 | |||
| 43 | var fn = function() { | ||
| 44 | if ($this.element.is(":visible")) $this.match(); | ||
| 45 | }; | ||
| 46 | |||
| 47 | UI.$(function() { fn(); }); | ||
| 48 | |||
| 49 | return UI.Utils.debounce(fn, 50); | ||
| 50 | })()); | ||
| 51 | |||
| 52 | if (this.options.observe) { | ||
| 53 | |||
| 54 | UI.domObserve(this.element, function(e) { | ||
| 55 | if ($this.element.is(":visible")) $this.match(); | ||
| 56 | }); | ||
| 57 | } | ||
| 58 | |||
| 59 | this.on("display.uk.check", function(e) { | ||
| 60 | if(this.element.is(":visible")) this.match(); | ||
| 61 | }.bind(this)); | ||
| 62 | |||
| 63 | grids.push(this); | ||
| 64 | }, | ||
| 65 | |||
| 66 | match: function() { | ||
| 67 | |||
| 68 | var firstvisible = this.columns.filter(":visible:first"); | ||
| 69 | |||
| 70 | if (!firstvisible.length) return; | ||
| 71 | |||
| 72 | var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100; | ||
| 73 | |||
| 74 | if (stacked && !this.options.ignorestacked) { | ||
| 75 | this.revert(); | ||
| 76 | } else { | ||
| 77 | UI.Utils.matchHeights(this.elements, this.options); | ||
| 78 | } | ||
| 79 | |||
| 80 | return this; | ||
| 81 | }, | ||
| 82 | |||
| 83 | revert: function() { | ||
| 84 | this.elements.css('min-height', ''); | ||
| 85 | return this; | ||
| 86 | } | ||
| 87 | }); | ||
| 88 | |||
| 89 | UI.component('gridMargin', { | ||
| 90 | |||
| 91 | defaults: { | ||
| 92 | cls : 'uk-grid-margin', | ||
| 93 | rowfirst : 'uk-row-first' | ||
| 94 | }, | ||
| 95 | |||
| 96 | boot: function() { | ||
| 97 | |||
| 98 | // init code | ||
| 99 | UI.ready(function(context) { | ||
| 100 | |||
| 101 | UI.$("[data-uk-grid-margin]", context).each(function() { | ||
| 102 | var grid = UI.$(this), obj; | ||
| 103 | |||
| 104 | if (!grid.data("gridMargin")) { | ||
| 105 | obj = UI.gridMargin(grid, UI.Utils.options(grid.attr("data-uk-grid-margin"))); | ||
| 106 | } | ||
| 107 | }); | ||
| 108 | }); | ||
| 109 | }, | ||
| 110 | |||
| 111 | init: function() { | ||
| 112 | |||
| 113 | var stackMargin = UI.stackMargin(this.element, this.options); | ||
| 114 | } | ||
| 115 | }); | ||
| 116 | |||
| 117 | })(UIkit); | ||
