blacklight_range_limit 8.5.0 → 9.0.0.beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +117 -26
- data/.gitignore +2 -1
- data/.solr_wrapper.yml +8 -0
- data/Gemfile +7 -1
- data/README.md +84 -87
- data/Rakefile +69 -0
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight-range-limit/index.js +345 -0
- data/app/components/blacklight_range_limit/range_facet_component.html.erb +29 -27
- data/app/components/blacklight_range_limit/range_facet_component.rb +27 -9
- data/app/components/blacklight_range_limit/range_form_component.html.erb +23 -5
- data/app/components/blacklight_range_limit/range_form_component.rb +8 -20
- data/app/presenters/blacklight_range_limit/facet_field_presenter.rb +13 -2
- data/app/presenters/blacklight_range_limit/facet_item_presenter.rb +15 -11
- data/app/presenters/blacklight_range_limit/filter_field.rb +9 -3
- data/blacklight_range_limit.gemspec +1 -1
- data/config/importmap.rb +9 -0
- data/config/locales/blacklight_range_limit.ar.yml +13 -8
- data/config/locales/blacklight_range_limit.de.yml +13 -8
- data/config/locales/blacklight_range_limit.en.yml +5 -1
- data/config/locales/blacklight_range_limit.es.yml +18 -0
- data/config/locales/blacklight_range_limit.it.yml +13 -8
- data/doc/example-screenshot.png +0 -0
- data/lib/blacklight_range_limit/controller_override.rb +8 -35
- data/lib/blacklight_range_limit/engine.rb +48 -0
- data/lib/blacklight_range_limit/range_limit_builder.rb +61 -3
- data/lib/blacklight_range_limit.rb +10 -30
- data/lib/generators/blacklight_range_limit/assets_generator.rb +82 -18
- data/lib/generators/blacklight_range_limit/install_generator.rb +5 -2
- data/lib/generators/blacklight_range_limit/jsbundling_bl7_fixup_generator.rb +98 -0
- data/package-lock.json +8 -7
- data/package.json +10 -14
- data/spec/components/range_facet_component_spec.rb +101 -32
- data/spec/components/range_form_component_spec.rb +2 -2
- data/spec/components/range_segments_component_spec.rb +64 -0
- data/spec/features/blacklight_range_limit_spec.rb +21 -13
- data/spec/features/run_through_spec.rb +210 -0
- data/spec/presenters/facet_field_presenter_spec.rb +72 -0
- data/spec/presenters/filter_field_spec.rb +36 -1
- data/spec/requests/bad_param_requests_spec.rb +61 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/test_app_templates/Gemfile.extra +11 -1
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +37 -6
- metadata +27 -51
- data/app/assets/javascripts/blacklight_range_limit/blacklight_range_limit.esm.js +0 -534
- data/app/assets/javascripts/blacklight_range_limit/blacklight_range_limit.esm.js.map +0 -1
- data/app/assets/javascripts/blacklight_range_limit/blacklight_range_limit.umd.js +0 -542
- data/app/assets/javascripts/blacklight_range_limit/blacklight_range_limit.umd.js.map +0 -1
- data/app/assets/javascripts/blacklight_range_limit.js +0 -27
- data/app/assets/stylesheets/blacklight_range_limit/blacklight_range_limit.css +0 -60
- data/app/assets/stylesheets/blacklight_range_limit.css +0 -7
- data/app/helpers/range_limit_helper.rb +0 -130
- data/app/javascript/blacklight_range_limit/index.js +0 -11
- data/app/javascript/blacklight_range_limit/range_limit_distro_facets.js +0 -76
- data/app/javascript/blacklight_range_limit/range_limit_plotting.js +0 -186
- data/app/javascript/blacklight_range_limit/range_limit_shared.js +0 -112
- data/app/javascript/blacklight_range_limit/range_limit_slider.js +0 -163
- data/app/javascripts/blacklight_range_limit/index.js +0 -13
- data/app/views/blacklight_range_limit/_range_segments.html.erb +0 -8
- data/app/views/blacklight_range_limit/range_segments.html.erb +0 -1
- data/app/views/catalog/range_limit_panel.html.erb +0 -1
- data/rollup.config.js +0 -37
- data/spec/features/a_javascript_spec.rb +0 -70
- data/spec/helpers/blacklight_range_limit_helper_spec.rb +0 -37
- data/vendor/assets/javascripts/bootstrap-slider.js +0 -388
- data/vendor/assets/javascripts/flot/jquery.canvaswrapper.js +0 -549
- data/vendor/assets/javascripts/flot/jquery.colorhelpers.js +0 -199
- data/vendor/assets/javascripts/flot/jquery.event.drag.js +0 -145
- data/vendor/assets/javascripts/flot/jquery.flot.browser.js +0 -98
- data/vendor/assets/javascripts/flot/jquery.flot.drawSeries.js +0 -662
- data/vendor/assets/javascripts/flot/jquery.flot.hover.js +0 -359
- data/vendor/assets/javascripts/flot/jquery.flot.js +0 -2818
- data/vendor/assets/javascripts/flot/jquery.flot.saturated.js +0 -43
- data/vendor/assets/javascripts/flot/jquery.flot.selection.js +0 -527
- data/vendor/assets/javascripts/flot/jquery.flot.uiConstants.js +0 -10
- data/vendor/assets/stylesheets/slider.css +0 -138
@@ -1,199 +0,0 @@
|
|
1
|
-
/* Plugin for jQuery for working with colors.
|
2
|
-
*
|
3
|
-
* Version 1.1.
|
4
|
-
*
|
5
|
-
* Inspiration from jQuery color animation plugin by John Resig.
|
6
|
-
*
|
7
|
-
* Released under the MIT license by Ole Laursen, October 2009.
|
8
|
-
*
|
9
|
-
* Examples:
|
10
|
-
*
|
11
|
-
* $.color.parse("#fff").scale('rgb', 0.25).add('a', -0.5).toString()
|
12
|
-
* var c = $.color.extract($("#mydiv"), 'background-color');
|
13
|
-
* console.log(c.r, c.g, c.b, c.a);
|
14
|
-
* $.color.make(100, 50, 25, 0.4).toString() // returns "rgba(100,50,25,0.4)"
|
15
|
-
*
|
16
|
-
* Note that .scale() and .add() return the same modified object
|
17
|
-
* instead of making a new one.
|
18
|
-
*
|
19
|
-
* V. 1.1: Fix error handling so e.g. parsing an empty string does
|
20
|
-
* produce a color rather than just crashing.
|
21
|
-
*/
|
22
|
-
|
23
|
-
(function($) {
|
24
|
-
$.color = {};
|
25
|
-
|
26
|
-
// construct color object with some convenient chainable helpers
|
27
|
-
$.color.make = function (r, g, b, a) {
|
28
|
-
var o = {};
|
29
|
-
o.r = r || 0;
|
30
|
-
o.g = g || 0;
|
31
|
-
o.b = b || 0;
|
32
|
-
o.a = a != null ? a : 1;
|
33
|
-
|
34
|
-
o.add = function (c, d) {
|
35
|
-
for (var i = 0; i < c.length; ++i) {
|
36
|
-
o[c.charAt(i)] += d;
|
37
|
-
}
|
38
|
-
|
39
|
-
return o.normalize();
|
40
|
-
};
|
41
|
-
|
42
|
-
o.scale = function (c, f) {
|
43
|
-
for (var i = 0; i < c.length; ++i) {
|
44
|
-
o[c.charAt(i)] *= f;
|
45
|
-
}
|
46
|
-
|
47
|
-
return o.normalize();
|
48
|
-
};
|
49
|
-
|
50
|
-
o.toString = function () {
|
51
|
-
if (o.a >= 1.0) {
|
52
|
-
return "rgb(" + [o.r, o.g, o.b].join(",") + ")";
|
53
|
-
} else {
|
54
|
-
return "rgba(" + [o.r, o.g, o.b, o.a].join(",") + ")";
|
55
|
-
}
|
56
|
-
};
|
57
|
-
|
58
|
-
o.normalize = function () {
|
59
|
-
function clamp(min, value, max) {
|
60
|
-
return value < min ? min : (value > max ? max : value);
|
61
|
-
}
|
62
|
-
|
63
|
-
o.r = clamp(0, parseInt(o.r), 255);
|
64
|
-
o.g = clamp(0, parseInt(o.g), 255);
|
65
|
-
o.b = clamp(0, parseInt(o.b), 255);
|
66
|
-
o.a = clamp(0, o.a, 1);
|
67
|
-
return o;
|
68
|
-
};
|
69
|
-
|
70
|
-
o.clone = function () {
|
71
|
-
return $.color.make(o.r, o.b, o.g, o.a);
|
72
|
-
};
|
73
|
-
|
74
|
-
return o.normalize();
|
75
|
-
}
|
76
|
-
|
77
|
-
// extract CSS color property from element, going up in the DOM
|
78
|
-
// if it's "transparent"
|
79
|
-
$.color.extract = function (elem, css) {
|
80
|
-
var c;
|
81
|
-
|
82
|
-
do {
|
83
|
-
c = elem.css(css).toLowerCase();
|
84
|
-
// keep going until we find an element that has color, or
|
85
|
-
// we hit the body or root (have no parent)
|
86
|
-
if (c !== '' && c !== 'transparent') {
|
87
|
-
break;
|
88
|
-
}
|
89
|
-
|
90
|
-
elem = elem.parent();
|
91
|
-
} while (elem.length && !$.nodeName(elem.get(0), "body"));
|
92
|
-
|
93
|
-
// catch Safari's way of signalling transparent
|
94
|
-
if (c === "rgba(0, 0, 0, 0)") {
|
95
|
-
c = "transparent";
|
96
|
-
}
|
97
|
-
|
98
|
-
return $.color.parse(c);
|
99
|
-
}
|
100
|
-
|
101
|
-
// parse CSS color string (like "rgb(10, 32, 43)" or "#fff"),
|
102
|
-
// returns color object, if parsing failed, you get black (0, 0,
|
103
|
-
// 0) out
|
104
|
-
$.color.parse = function (str) {
|
105
|
-
var res, m = $.color.make;
|
106
|
-
|
107
|
-
// Look for rgb(num,num,num)
|
108
|
-
res = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(str);
|
109
|
-
if (res) {
|
110
|
-
return m(parseInt(res[1], 10), parseInt(res[2], 10), parseInt(res[3], 10));
|
111
|
-
}
|
112
|
-
|
113
|
-
// Look for rgba(num,num,num,num)
|
114
|
-
res = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str)
|
115
|
-
if (res) {
|
116
|
-
return m(parseInt(res[1], 10), parseInt(res[2], 10), parseInt(res[3], 10), parseFloat(res[4]));
|
117
|
-
}
|
118
|
-
|
119
|
-
// Look for rgb(num%,num%,num%)
|
120
|
-
res = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)%\s*,\s*([0-9]+(?:\.[0-9]+)?)%\s*,\s*([0-9]+(?:\.[0-9]+)?)%\s*\)/.exec(str);
|
121
|
-
if (res) {
|
122
|
-
return m(parseFloat(res[1]) * 2.55, parseFloat(res[2]) * 2.55, parseFloat(res[3]) * 2.55);
|
123
|
-
}
|
124
|
-
|
125
|
-
// Look for rgba(num%,num%,num%,num)
|
126
|
-
res = /rgba\(\s*([0-9]+(?:\.[0-9]+)?)%\s*,\s*([0-9]+(?:\.[0-9]+)?)%\s*,\s*([0-9]+(?:\.[0-9]+)?)%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str);
|
127
|
-
if (res) {
|
128
|
-
return m(parseFloat(res[1]) * 2.55, parseFloat(res[2]) * 2.55, parseFloat(res[3]) * 2.55, parseFloat(res[4]));
|
129
|
-
}
|
130
|
-
|
131
|
-
// Look for #a0b1c2
|
132
|
-
res = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(str);
|
133
|
-
if (res) {
|
134
|
-
return m(parseInt(res[1], 16), parseInt(res[2], 16), parseInt(res[3], 16));
|
135
|
-
}
|
136
|
-
|
137
|
-
// Look for #fff
|
138
|
-
res = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(str);
|
139
|
-
if (res) {
|
140
|
-
return m(parseInt(res[1] + res[1], 16), parseInt(res[2] + res[2], 16), parseInt(res[3] + res[3], 16));
|
141
|
-
}
|
142
|
-
|
143
|
-
// Otherwise, we're most likely dealing with a named color
|
144
|
-
var name = $.trim(str).toLowerCase();
|
145
|
-
if (name === "transparent") {
|
146
|
-
return m(255, 255, 255, 0);
|
147
|
-
} else {
|
148
|
-
// default to black
|
149
|
-
res = lookupColors[name] || [0, 0, 0];
|
150
|
-
return m(res[0], res[1], res[2]);
|
151
|
-
}
|
152
|
-
}
|
153
|
-
|
154
|
-
var lookupColors = {
|
155
|
-
aqua: [0, 255, 255],
|
156
|
-
azure: [240, 255, 255],
|
157
|
-
beige: [245, 245, 220],
|
158
|
-
black: [0, 0, 0],
|
159
|
-
blue: [0, 0, 255],
|
160
|
-
brown: [165, 42, 42],
|
161
|
-
cyan: [0, 255, 255],
|
162
|
-
darkblue: [0, 0, 139],
|
163
|
-
darkcyan: [0, 139, 139],
|
164
|
-
darkgrey: [169, 169, 169],
|
165
|
-
darkgreen: [0, 100, 0],
|
166
|
-
darkkhaki: [189, 183, 107],
|
167
|
-
darkmagenta: [139, 0, 139],
|
168
|
-
darkolivegreen: [85, 107, 47],
|
169
|
-
darkorange: [255, 140, 0],
|
170
|
-
darkorchid: [153, 50, 204],
|
171
|
-
darkred: [139, 0, 0],
|
172
|
-
darksalmon: [233, 150, 122],
|
173
|
-
darkviolet: [148, 0, 211],
|
174
|
-
fuchsia: [255, 0, 255],
|
175
|
-
gold: [255, 215, 0],
|
176
|
-
green: [0, 128, 0],
|
177
|
-
indigo: [75, 0, 130],
|
178
|
-
khaki: [240, 230, 140],
|
179
|
-
lightblue: [173, 216, 230],
|
180
|
-
lightcyan: [224, 255, 255],
|
181
|
-
lightgreen: [144, 238, 144],
|
182
|
-
lightgrey: [211, 211, 211],
|
183
|
-
lightpink: [255, 182, 193],
|
184
|
-
lightyellow: [255, 255, 224],
|
185
|
-
lime: [0, 255, 0],
|
186
|
-
magenta: [255, 0, 255],
|
187
|
-
maroon: [128, 0, 0],
|
188
|
-
navy: [0, 0, 128],
|
189
|
-
olive: [128, 128, 0],
|
190
|
-
orange: [255, 165, 0],
|
191
|
-
pink: [255, 192, 203],
|
192
|
-
purple: [128, 0, 128],
|
193
|
-
violet: [128, 0, 128],
|
194
|
-
red: [255, 0, 0],
|
195
|
-
silver: [192, 192, 192],
|
196
|
-
white: [255, 255, 255],
|
197
|
-
yellow: [255, 255, 0]
|
198
|
-
};
|
199
|
-
})(jQuery);
|
@@ -1,145 +0,0 @@
|
|
1
|
-
// Source: https://github.com/devongovett/jquery.event.drag/blob/451d90e1a737f49f613d0966082ce67582b0afd1/drag/jquery.event.drag.js
|
2
|
-
//
|
3
|
-
// Warning! Make sure the hijack() is patch to work with any jquery version:
|
4
|
-
//
|
5
|
-
// ($.event.dispatch || $.event.handle).call( elem, event );
|
6
|
-
//
|
7
|
-
|
8
|
-
/*!
|
9
|
-
jquery.event.drag.js ~ v1.6 ~ Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)
|
10
|
-
Liscensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-LICENSE.txt
|
11
|
-
*/
|
12
|
-
;(function($){ // secure $ jQuery alias
|
13
|
-
/*******************************************************************************************/
|
14
|
-
// Created: 2008-06-04 | Updated: 2009-04-21
|
15
|
-
/*******************************************************************************************/
|
16
|
-
// Events: drag, dragstart, dragend
|
17
|
-
/*******************************************************************************************/
|
18
|
-
|
19
|
-
// jquery method
|
20
|
-
$.fn.drag = function( fn1, fn2, fn3 ){
|
21
|
-
if ( fn2 ) this.bind('dragstart', fn1 ); // 2+ args
|
22
|
-
if ( fn3 ) this.bind('dragend', fn3 ); // 3 args
|
23
|
-
return !fn1 ? this.trigger('drag') // 0 args
|
24
|
-
: this.bind('drag', fn2 ? fn2 : fn1 ); // 1+ args
|
25
|
-
};
|
26
|
-
|
27
|
-
// local refs
|
28
|
-
var $event = $.event, $special = $event.special,
|
29
|
-
|
30
|
-
// special event configuration
|
31
|
-
drag = $special.drag = {
|
32
|
-
not: ':input', // don't begin to drag on event.targets that match this selector
|
33
|
-
distance: 0, // distance dragged before dragstart
|
34
|
-
which: 1, // mouse button pressed to start drag sequence
|
35
|
-
drop: false, // false to suppress drop events
|
36
|
-
dragging: false, // hold the active target element
|
37
|
-
setup: function( data ){
|
38
|
-
data = $.extend({
|
39
|
-
distance: drag.distance,
|
40
|
-
which: drag.which,
|
41
|
-
not: drag.not,
|
42
|
-
drop: drag.drop
|
43
|
-
}, data || {});
|
44
|
-
data.distance = squared( data.distance ); // x² + y² = distance²
|
45
|
-
$event.add( this, "mousedown", handler, data );
|
46
|
-
if ( this.attachEvent ) this.attachEvent("ondragstart", dontStart ); // prevent image dragging in IE...
|
47
|
-
},
|
48
|
-
teardown: function(){
|
49
|
-
$event.remove( this, "mousedown", handler );
|
50
|
-
if ( this === drag.dragging ) drag.dragging = drag.proxy = false; // deactivate element
|
51
|
-
selectable( this, true ); // enable text selection
|
52
|
-
if ( this.detachEvent ) this.detachEvent("ondragstart", dontStart ); // prevent image dragging in IE...
|
53
|
-
}
|
54
|
-
};
|
55
|
-
|
56
|
-
// prevent normal event binding...
|
57
|
-
$special.dragstart = $special.dragend = { setup:function(){}, teardown:function(){} };
|
58
|
-
|
59
|
-
// handle drag-releatd DOM events
|
60
|
-
function handler ( event ){
|
61
|
-
var elem = this, returned, data = event.data || {};
|
62
|
-
// mousemove or mouseup
|
63
|
-
if ( data.elem ){
|
64
|
-
// update event properties...
|
65
|
-
elem = event.dragTarget = data.elem; // drag source element
|
66
|
-
event.dragProxy = drag.proxy || elem; // proxy element or source
|
67
|
-
event.cursorOffsetX = data.pageX - data.left; // mousedown offset
|
68
|
-
event.cursorOffsetY = data.pageY - data.top; // mousedown offset
|
69
|
-
event.offsetX = event.pageX - event.cursorOffsetX; // element offset
|
70
|
-
event.offsetY = event.pageY - event.cursorOffsetY; // element offset
|
71
|
-
}
|
72
|
-
// mousedown, check some initial props to avoid the switch statement
|
73
|
-
else if ( drag.dragging || ( data.which>0 && event.which!=data.which ) ||
|
74
|
-
$( event.target ).is( data.not ) ) return;
|
75
|
-
// handle various events
|
76
|
-
switch ( event.type ){
|
77
|
-
// mousedown, left click, event.target is not restricted, init dragging
|
78
|
-
case 'mousedown':
|
79
|
-
$.extend( data, $( elem ).offset(), {
|
80
|
-
elem: elem, target: event.target,
|
81
|
-
pageX: event.pageX, pageY: event.pageY
|
82
|
-
}); // store some initial attributes
|
83
|
-
$event.add( document, "mousemove mouseup", handler, data );
|
84
|
-
selectable( elem, false ); // disable text selection
|
85
|
-
drag.dragging = null; // pending state
|
86
|
-
break; // prevents text selection in safari
|
87
|
-
// mousemove, check distance, start dragging
|
88
|
-
case !drag.dragging && 'mousemove':
|
89
|
-
if ( squared( event.pageX-data.pageX )
|
90
|
-
+ squared( event.pageY-data.pageY ) // x² + y² = distance²
|
91
|
-
< data.distance ) break; // distance tolerance not reached
|
92
|
-
event.target = data.target; // force target from "mousedown" event (fix distance issue)
|
93
|
-
returned = hijack( event, "dragstart", elem ); // trigger "dragstart", return proxy element
|
94
|
-
if ( returned !== false ){ // "dragstart" not rejected
|
95
|
-
drag.dragging = elem; // activate element
|
96
|
-
drag.proxy = event.dragProxy = $( returned || elem )[0]; // set proxy
|
97
|
-
}
|
98
|
-
// mousemove, dragging
|
99
|
-
case 'mousemove':
|
100
|
-
if ( drag.dragging ){
|
101
|
-
returned = hijack( event, "drag", elem ); // trigger "drag"
|
102
|
-
if ( data.drop && $special.drop ){ // manage drop events
|
103
|
-
$special.drop.allowed = ( returned !== false ); // prevent drop
|
104
|
-
$special.drop.handler( event ); // "dropstart", "dropend"
|
105
|
-
}
|
106
|
-
if ( returned !== false ) break; // "drag" not rejected, stop
|
107
|
-
event.type = "mouseup"; // helps "drop" handler behave
|
108
|
-
}
|
109
|
-
// mouseup, stop dragging
|
110
|
-
case 'mouseup':
|
111
|
-
$event.remove( document, "mousemove mouseup", handler ); // remove page events
|
112
|
-
if ( drag.dragging ){
|
113
|
-
if ( data.drop && $special.drop ) $special.drop.handler( event ); // "drop"
|
114
|
-
hijack( event, "dragend", elem ); // trigger "dragend"
|
115
|
-
}
|
116
|
-
selectable( elem, true ); // enable text selection
|
117
|
-
drag.dragging = drag.proxy = data.elem = false; // deactivate element
|
118
|
-
break;
|
119
|
-
}
|
120
|
-
};
|
121
|
-
|
122
|
-
// set event type to custom value, and handle it
|
123
|
-
function hijack ( event, type, elem ){
|
124
|
-
event.type = type; // force the event type
|
125
|
-
var result = ($.event.dispatch || $.event.handle).call( elem, event );
|
126
|
-
return result===false ? false : result || event.result;
|
127
|
-
};
|
128
|
-
|
129
|
-
// return the value squared
|
130
|
-
function squared ( value ){ return Math.pow( value, 2 ); };
|
131
|
-
|
132
|
-
// suppress default dragstart IE events...
|
133
|
-
function dontStart(){ return ( drag.dragging === false ); };
|
134
|
-
|
135
|
-
// toggles text selection attributes
|
136
|
-
function selectable ( elem, bool ){
|
137
|
-
if ( !elem ) return; // maybe element was removed ?
|
138
|
-
elem = elem.ownerDocument ? elem.ownerDocument : elem;
|
139
|
-
elem.unselectable = bool ? "off" : "on"; // IE
|
140
|
-
if ( elem.style ) elem.style.MozUserSelect = bool ? "" : "none"; // FF
|
141
|
-
$.event[ bool ? "remove" : "add" ]( elem, "selectstart mousedown", dontStart ); // IE/Opera
|
142
|
-
};
|
143
|
-
|
144
|
-
/*******************************************************************************************/
|
145
|
-
})( jQuery ); // confine scope
|
@@ -1,98 +0,0 @@
|
|
1
|
-
/** ## jquery.flot.browser.js
|
2
|
-
|
3
|
-
This plugin is used to make available some browser-related utility functions.
|
4
|
-
|
5
|
-
### Methods
|
6
|
-
*/
|
7
|
-
|
8
|
-
(function ($) {
|
9
|
-
'use strict';
|
10
|
-
|
11
|
-
var browser = {
|
12
|
-
/**
|
13
|
-
- getPageXY(e)
|
14
|
-
|
15
|
-
Calculates the pageX and pageY using the screenX, screenY properties of the event
|
16
|
-
and the scrolling of the page. This is needed because the pageX and pageY
|
17
|
-
properties of the event are not correct while running tests in Edge. */
|
18
|
-
getPageXY: function (e) {
|
19
|
-
// This code is inspired from https://stackoverflow.com/a/3464890
|
20
|
-
var doc = document.documentElement,
|
21
|
-
pageX = e.clientX + (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0),
|
22
|
-
pageY = e.clientY + (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
|
23
|
-
return { X: pageX, Y: pageY };
|
24
|
-
},
|
25
|
-
|
26
|
-
/**
|
27
|
-
- getPixelRatio(context)
|
28
|
-
|
29
|
-
This function returns the current pixel ratio defined by the product of desktop
|
30
|
-
zoom and page zoom.
|
31
|
-
Additional info: https://www.html5rocks.com/en/tutorials/canvas/hidpi/
|
32
|
-
*/
|
33
|
-
getPixelRatio: function(context) {
|
34
|
-
var devicePixelRatio = window.devicePixelRatio || 1,
|
35
|
-
backingStoreRatio =
|
36
|
-
context.webkitBackingStorePixelRatio ||
|
37
|
-
context.mozBackingStorePixelRatio ||
|
38
|
-
context.msBackingStorePixelRatio ||
|
39
|
-
context.oBackingStorePixelRatio ||
|
40
|
-
context.backingStorePixelRatio || 1;
|
41
|
-
return devicePixelRatio / backingStoreRatio;
|
42
|
-
},
|
43
|
-
|
44
|
-
/**
|
45
|
-
- isSafari, isMobileSafari, isOpera, isFirefox, isIE, isEdge, isChrome, isBlink
|
46
|
-
|
47
|
-
This is a collection of functions, used to check if the code is running in a
|
48
|
-
particular browser or Javascript engine.
|
49
|
-
*/
|
50
|
-
isSafari: function() {
|
51
|
-
// *** https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
|
52
|
-
// Safari 3.0+ "[object HTMLElementConstructor]"
|
53
|
-
return /constructor/i.test(window.top.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window.top['safari'] || (typeof window.top.safari !== 'undefined' && window.top.safari.pushNotification));
|
54
|
-
},
|
55
|
-
|
56
|
-
isMobileSafari: function() {
|
57
|
-
//isMobileSafari adapted from https://stackoverflow.com/questions/3007480/determine-if-user-navigated-from-mobile-safari
|
58
|
-
return navigator.userAgent.match(/(iPod|iPhone|iPad)/) && navigator.userAgent.match(/AppleWebKit/);
|
59
|
-
},
|
60
|
-
|
61
|
-
isOpera: function() {
|
62
|
-
// *** https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
|
63
|
-
//Opera 8.0+
|
64
|
-
return (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
|
65
|
-
},
|
66
|
-
|
67
|
-
isFirefox: function() {
|
68
|
-
// *** https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
|
69
|
-
// Firefox 1.0+
|
70
|
-
return typeof InstallTrigger !== 'undefined';
|
71
|
-
},
|
72
|
-
|
73
|
-
isIE: function() {
|
74
|
-
// *** https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
|
75
|
-
// Internet Explorer 6-11
|
76
|
-
return /*@cc_on!@*/false || !!document.documentMode;
|
77
|
-
},
|
78
|
-
|
79
|
-
isEdge: function() {
|
80
|
-
// *** https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
|
81
|
-
// Edge 20+
|
82
|
-
return !browser.isIE() && !!window.StyleMedia;
|
83
|
-
},
|
84
|
-
|
85
|
-
isChrome: function() {
|
86
|
-
// *** https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
|
87
|
-
// Chrome 1+
|
88
|
-
return !!window.chrome && !!window.chrome.webstore;
|
89
|
-
},
|
90
|
-
|
91
|
-
isBlink: function() {
|
92
|
-
// *** https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
|
93
|
-
return (browser.isChrome() || browser.isOpera()) && !!window.CSS;
|
94
|
-
}
|
95
|
-
};
|
96
|
-
|
97
|
-
$.plot.browser = browser;
|
98
|
-
})(jQuery);
|