summaryrefslogtreecommitdiffstats
path: root/afb-client/bower_components/tether/js/abutment.js
diff options
context:
space:
mode:
authorStephane Desneux <stephane.desneux@iot.bzh>2016-05-31 18:16:48 +0200
committerStephane Desneux <stephane.desneux@iot.bzh>2016-05-31 18:16:48 +0200
commit5b1e6cc132f44262a873fa8296a2a3e1017b0278 (patch)
tree43b2cd54e2e300b399ff3f2af4458a2c4ed8a144 /afb-client/bower_components/tether/js/abutment.js
parentf7d2f9ac4168ee5064580c666d508667a73cefc0 (diff)
parent85ace9c1ce9a98e9b8a22f045c7dd752b38d9129 (diff)
Merge afb-client
Diffstat (limited to 'afb-client/bower_components/tether/js/abutment.js')
-rw-r--r--afb-client/bower_components/tether/js/abutment.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/afb-client/bower_components/tether/js/abutment.js b/afb-client/bower_components/tether/js/abutment.js
new file mode 100644
index 0000000..b3acaa0
--- /dev/null
+++ b/afb-client/bower_components/tether/js/abutment.js
@@ -0,0 +1,59 @@
+(function() {
+ var defer, getBounds, updateClasses, _ref;
+
+ _ref = this.Tether.Utils, getBounds = _ref.getBounds, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var abutted, addClasses, allClasses, bottom, height, left, right, side, sides, targetPos, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _ref5,
+ _this = this;
+ top = _arg.top, left = _arg.left;
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ targetPos = this.getTargetBounds();
+ bottom = top + height;
+ right = left + width;
+ abutted = [];
+ if (top <= targetPos.bottom && bottom >= targetPos.top) {
+ _ref2 = ['left', 'right'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ side = _ref2[_i];
+ if ((_ref3 = targetPos[side]) === left || _ref3 === right) {
+ abutted.push(side);
+ }
+ }
+ }
+ if (left <= targetPos.right && right >= targetPos.left) {
+ _ref4 = ['top', 'bottom'];
+ for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
+ side = _ref4[_j];
+ if ((_ref5 = targetPos[side]) === top || _ref5 === bottom) {
+ abutted.push(side);
+ }
+ }
+ }
+ allClasses = [];
+ addClasses = [];
+ sides = ['left', 'top', 'right', 'bottom'];
+ allClasses.push(this.getClass('abutted'));
+ for (_k = 0, _len2 = sides.length; _k < _len2; _k++) {
+ side = sides[_k];
+ allClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ if (abutted.length) {
+ addClasses.push(this.getClass('abutted'));
+ }
+ for (_l = 0, _len3 = abutted.length; _l < _len3; _l++) {
+ side = abutted[_l];
+ addClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return true;
+ }
+ });
+
+}).call(this);