diff --git a/NOTICE.md b/NOTICE.md index 24210951c..40f7f3859 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -323,6 +323,11 @@ bootstrap * License: MIT License * Homepage: https://getbootstrap.com/ * More information in folder: doc/3rd-party-licenses/bootstrap + +crosshair + * License: MIT License + * Homepage: https://eschmann.dev/crosshair.js/ + * More information in folder: doc/3rd-party-licenses/crosshair harPreview diff --git a/config/testreport/css/default.css b/config/testreport/css/default.css index 2a6b2af0d..37a5ea800 100644 --- a/config/testreport/css/default.css +++ b/config/testreport/css/default.css @@ -1775,3 +1775,33 @@ tr:hover .infinity { background: linear-gradient(rgb(200,120,120), rgba(0,0,0,0) transform: rotate(360deg); } } + +.crosshair { + display: block; + position: relative; + overflow: hidden; +} +.crosshair img { + width: 100%; +} +.crosshair .hair { + display: none; + position: absolute; + top: 0; + left: 0; + margin-top: -1px; + margin-left: -1px; + background: transparent; + border-top: 1px solid black; + border-left: 1px solid black; + pointer-events: none; + z-index: 2; + opacity: 0.3; +} +.crosshair .hair.hair-vertical { + height: 100%; +} +.crosshair .hair.hair-horizontal { + width: 100%; +} + diff --git a/config/testreport/js/crosshair.js b/config/testreport/js/crosshair.js new file mode 100644 index 000000000..26b1cd70d --- /dev/null +++ b/config/testreport/js/crosshair.js @@ -0,0 +1,64 @@ +/* + * Based on crosshair.js - v0.1.0 + * https://github.com/eschmar/crosshair + */ + +(function ($) { + // constructor + function Plugin(element){ + $(element).wrap('
'); + this.element = $(element).parent(); + this.init(); + } + + Plugin.prototype = { + init: function() { + var app = this; + this.spawnCrosshair(); + + // hide crosshair onmouseleave + this.element.hover(function() { + app.element.find('.hair').show(); + }, function() { + app.element.find('.hair').hide(); + }); + }, + + spawnCrosshair: function() { + this.element.append('
'); + this.element.append('
'); + + this.initCrosshair(); + }, + + initCrosshair: function() { + var app = this; + $(this.element).on('mousemove touchmove', function(event) { + // calculate relative position + var offset, left, top; + offset = app.element.offset(); + left = event.pageX - offset.left; + top = event.pageY - offset.top; + + // update position + app.element.find('.hair.hair-horizontal').css('top', top); + app.element.find('.hair.hair-vertical').css('left', left); + + event.stopPropagation(); + }); + } + } + + // lightweight plugin wrapper, preventing against multiple instantiations + $.fn["crosshair"] = function () { + return this.each(function() { + if (!$.data(this, "crosshair")) { + $.data(this, "crosshair", new Plugin(this)) + }; + }); + }; + + $(function(){ + $('.chart').crosshair(); + }); +})( jQuery ); diff --git a/config/xsl/common/sections/head.xsl b/config/xsl/common/sections/head.xsl index 737bcaf75..2286bb2d7 100644 --- a/config/xsl/common/sections/head.xsl +++ b/config/xsl/common/sections/head.xsl @@ -36,6 +36,7 @@