Implemented URL query parsing for initial token /opa/?token=abcde
[src/app-framework-demo.git] / afb-client / bower_components / tether / js / abutment.js
1 (function() {
2   var defer, getBounds, updateClasses, _ref;
3
4   _ref = this.Tether.Utils, getBounds = _ref.getBounds, updateClasses = _ref.updateClasses, defer = _ref.defer;
5
6   this.Tether.modules.push({
7     position: function(_arg) {
8       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,
9         _this = this;
10       top = _arg.top, left = _arg.left;
11       _ref1 = this.cache('element-bounds', function() {
12         return getBounds(_this.element);
13       }), height = _ref1.height, width = _ref1.width;
14       targetPos = this.getTargetBounds();
15       bottom = top + height;
16       right = left + width;
17       abutted = [];
18       if (top <= targetPos.bottom && bottom >= targetPos.top) {
19         _ref2 = ['left', 'right'];
20         for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
21           side = _ref2[_i];
22           if ((_ref3 = targetPos[side]) === left || _ref3 === right) {
23             abutted.push(side);
24           }
25         }
26       }
27       if (left <= targetPos.right && right >= targetPos.left) {
28         _ref4 = ['top', 'bottom'];
29         for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
30           side = _ref4[_j];
31           if ((_ref5 = targetPos[side]) === top || _ref5 === bottom) {
32             abutted.push(side);
33           }
34         }
35       }
36       allClasses = [];
37       addClasses = [];
38       sides = ['left', 'top', 'right', 'bottom'];
39       allClasses.push(this.getClass('abutted'));
40       for (_k = 0, _len2 = sides.length; _k < _len2; _k++) {
41         side = sides[_k];
42         allClasses.push("" + (this.getClass('abutted')) + "-" + side);
43       }
44       if (abutted.length) {
45         addClasses.push(this.getClass('abutted'));
46       }
47       for (_l = 0, _len3 = abutted.length; _l < _len3; _l++) {
48         side = abutted[_l];
49         addClasses.push("" + (this.getClass('abutted')) + "-" + side);
50       }
51       defer(function() {
52         updateClasses(_this.target, addClasses, allClasses);
53         return updateClasses(_this.element, addClasses, allClasses);
54       });
55       return true;
56     }
57   });
58
59 }).call(this);