Repository: qpid-dispatch Updated Branches: refs/heads/master 5cb320f03 -> e22091b3f
DISPATCH-753 'Fixing' javascript to support IE11 Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/e22091b3 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/e22091b3 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/e22091b3 Branch: refs/heads/master Commit: e22091b3fb3eba0870463d096a2c88ad15beb249 Parents: 5cb320f Author: Ernest Allen <[email protected]> Authored: Mon Jun 19 16:07:18 2017 -0400 Committer: Ernest Allen <[email protected]> Committed: Mon Jun 19 16:07:18 2017 -0400 ---------------------------------------------------------------------- .../src/main/webapp/plugin/js/qdrTopology.js | 4 +- console/stand-alone/plugin/js/qdrOverview.js | 14 ++--- console/stand-alone/plugin/js/qdrService.js | 63 ++++++++++++++++++++ console/stand-alone/plugin/js/qdrTopology.js | 7 ++- 4 files changed, 75 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e22091b3/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js ---------------------------------------------------------------------- diff --git a/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js b/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js index 1449008..762b212 100644 --- a/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js +++ b/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js @@ -1619,7 +1619,7 @@ QDR.log.debug("attr.description " + attr.description) } mousedown_node = d; // mouse position relative to svg - initial_mouse_down_position = d3.mouse(this.parentElement.parentElement.parentElement).slice(); + initial_mouse_down_position = d3.mouse(this.parentNode.parentNode.parentNode).slice(); }) .on('mouseup', function(d) { // mouse up for circle if (!mousedown_node) @@ -1631,7 +1631,7 @@ QDR.log.debug("attr.description " + attr.description) // check for drag mouseup_node = d; - var mySvg = this.parentElement.parentElement.parentElement; + var mySvg = this.parentNode.parentNode.parentNode; // if we dragged the node, make it fixed var cur_mouse = d3.mouse(mySvg); if (cur_mouse[0] != initial_mouse_down_position[0] || http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e22091b3/console/stand-alone/plugin/js/qdrOverview.js ---------------------------------------------------------------------- diff --git a/console/stand-alone/plugin/js/qdrOverview.js b/console/stand-alone/plugin/js/qdrOverview.js index 303a91d..06da097 100644 --- a/console/stand-alone/plugin/js/qdrOverview.js +++ b/console/stand-alone/plugin/js/qdrOverview.js @@ -516,14 +516,12 @@ var QDR = (function (QDR) { $scope.pagedLinkData = [] $scope.selectedLinks = [] - var linkRowTmpl = ` - <div ng-class="{linkDirIn: row.getProperty('linkDir') == 'in', linkDirOut: row.getProperty('linkDir') == 'out'}"> - <div ng-style="{ 'cursor': row.cursor }" ng-repeat="col in renderedColumns" ng-class="col.colIndex()" class="ngCell {{col.cellClass}}"> - <div class="ngVerticalBar" ng-style="{height: rowHeight}" ng-class="{ ngVerticalBarVisible: !$last }"> </div> - <div ng-cell></div> - </div> - </div> - `; + var linkRowTmpl = "<div ng-class=\"{linkDirIn: row.getProperty('linkDir') == 'in', linkDirOut: row.getProperty('linkDir') == 'out'}\">" + + "<div ng-style=\"{ 'cursor': row.cursor }\" ng-repeat=\"col in renderedColumns\" ng-class=\"col.colIndex()\" class=\"ngCell {{col.cellClass}}\">" + + "<div class=\"ngVerticalBar\" ng-style=\"{height: rowHeight}\" ng-class=\"{ ngVerticalBarVisible: !$last }\"> </div>" + + "<div ng-cell></div>" + + "</div>" + + "</div>"; $scope.linksGrid = { saveKey: 'linksGrid', http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e22091b3/console/stand-alone/plugin/js/qdrService.js ---------------------------------------------------------------------- diff --git a/console/stand-alone/plugin/js/qdrService.js b/console/stand-alone/plugin/js/qdrService.js index 93a9f76..b894029 100644 --- a/console/stand-alone/plugin/js/qdrService.js +++ b/console/stand-alone/plugin/js/qdrService.js @@ -1151,3 +1151,66 @@ function ngGridFlexibleHeightPlugin (opts) { self.scope.$watch(self.grid.config.data, recalcHeightForData); }; } + +if (!String.prototype.startsWith) { + String.prototype.startsWith = function (searchString, position) { + return this.substr(position || 0, searchString.length) === searchString + } +} + +if (!String.prototype.endsWith) { + String.prototype.endsWith = function(searchString, position) { + var subjectString = this.toString(); + if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) { + position = subjectString.length; + } + position -= searchString.length; + var lastIndex = subjectString.lastIndexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; + }; +} + +// https://tc39.github.io/ecma262/#sec-array.prototype.findIndex +if (!Array.prototype.findIndex) { + Object.defineProperty(Array.prototype, 'findIndex', { + value: function(predicate) { + // 1. Let O be ? ToObject(this value). + if (this == null) { + throw new TypeError('"this" is null or not defined'); + } + + var o = Object(this); + + // 2. Let len be ? ToLength(? Get(O, "length")). + var len = o.length >>> 0; + + // 3. If IsCallable(predicate) is false, throw a TypeError exception. + if (typeof predicate !== 'function') { + throw new TypeError('predicate must be a function'); + } + + // 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + var thisArg = arguments[1]; + + // 5. Let k be 0. + var k = 0; + + // 6. Repeat, while k < len + while (k < len) { + // a. Let Pk be ! ToString(k). + // b. Let kValue be ? Get(O, Pk). + // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + // d. If testResult is true, return k. + var kValue = o[k]; + if (predicate.call(thisArg, kValue, k, o)) { + return k; + } + // e. Increase k by 1. + k++; + } + + // 7. Return -1. + return -1; + } + }); +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e22091b3/console/stand-alone/plugin/js/qdrTopology.js ---------------------------------------------------------------------- diff --git a/console/stand-alone/plugin/js/qdrTopology.js b/console/stand-alone/plugin/js/qdrTopology.js index e1745b7..2fc657a 100644 --- a/console/stand-alone/plugin/js/qdrTopology.js +++ b/console/stand-alone/plugin/js/qdrTopology.js @@ -498,7 +498,7 @@ var QDR = (function(QDR) { $scope.isFixed = function() { if (!$scope.contextNode) return false; - return ($scope.contextNode.fixed & 0b1); + return ($scope.contextNode.fixed == 1); } var mouseX, mouseY; @@ -1632,7 +1632,7 @@ var QDR = (function(QDR) { } mousedown_node = d; // mouse position relative to svg - initial_mouse_down_position = d3.mouse(this.parentElement.parentElement.parentElement).slice(); + initial_mouse_down_position = d3.mouse(this.parentNode.parentNode.parentNode).slice(); }) .on('mouseup', function(d) { // mouse up for circle if (!mousedown_node) @@ -1644,7 +1644,8 @@ var QDR = (function(QDR) { // check for drag mouseup_node = d; - var mySvg = this.parentElement.parentElement.parentElement; + + var mySvg = this.parentNode.parentNode.parentNode; // if we dragged the node, make it fixed var cur_mouse = d3.mouse(mySvg); if (cur_mouse[0] != initial_mouse_down_position[0] || --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
