mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-27 09:43:06 +00:00
1571 lines
173 KiB
JavaScript
1571 lines
173 KiB
JavaScript
|
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.horsey=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var sell = require('sell');
|
||
|
var crossvent = require('crossvent');
|
||
|
var bullseye = require('bullseye');
|
||
|
var fuzzysearch = require('fuzzysearch');
|
||
|
var KEY_BACKSPACE = 8;
|
||
|
var KEY_ENTER = 13;
|
||
|
var KEY_ESC = 27;
|
||
|
var KEY_UP = 38;
|
||
|
var KEY_DOWN = 40;
|
||
|
var KEY_TAB = 9;
|
||
|
var cache = [];
|
||
|
var doc = document;
|
||
|
var docElement = doc.documentElement;
|
||
|
|
||
|
function find (el) {
|
||
|
var entry;
|
||
|
var i;
|
||
|
for (i = 0; i < cache.length; i++) {
|
||
|
entry = cache[i];
|
||
|
if (entry.el === el) {
|
||
|
return entry.api;
|
||
|
}
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
function horsey (el, options) {
|
||
|
var cached = find(el);
|
||
|
if (cached) {
|
||
|
return cached;
|
||
|
}
|
||
|
|
||
|
var o = options || {};
|
||
|
var parent = o.appendTo || doc.body;
|
||
|
var render = o.render || defaultRenderer;
|
||
|
var getText = o.getText || defaultGetText;
|
||
|
var getValue = o.getValue || defaultGetValue;
|
||
|
var form = o.form;
|
||
|
var limit = typeof o.limit === 'number' ? o.limit : Infinity;
|
||
|
var suggestions = o.suggestions;
|
||
|
var userFilter = o.filter || defaultFilter;
|
||
|
var userSet = o.set || defaultSetter;
|
||
|
var ul = tag('ul', 'sey-list');
|
||
|
var selection = null;
|
||
|
var eye;
|
||
|
var deferredFiltering = defer(filtering);
|
||
|
var attachment = el;
|
||
|
var textInput;
|
||
|
var anyInput;
|
||
|
var ranchorleft;
|
||
|
var ranchorright;
|
||
|
var suggestionsLoad = { counter: 0, value: null };
|
||
|
|
||
|
if (o.autoHideOnBlur === void 0) { o.autoHideOnBlur = true; }
|
||
|
if (o.autoHideOnClick === void 0) { o.autoHideOnClick = true; }
|
||
|
if (o.autoShowOnUpDown === void 0) { o.autoShowOnUpDown = el.tagName === 'INPUT'; }
|
||
|
if (o.anchor) {
|
||
|
ranchorleft = new RegExp('^' + o.anchor);
|
||
|
ranchorright = new RegExp(o.anchor + '$');
|
||
|
}
|
||
|
|
||
|
var api = {
|
||
|
add: add,
|
||
|
anchor: o.anchor,
|
||
|
clear: clear,
|
||
|
show: show,
|
||
|
hide: hide,
|
||
|
toggle: toggle,
|
||
|
destroy: destroy,
|
||
|
refreshPosition: refreshPosition,
|
||
|
appendText: appendText,
|
||
|
appendHTML: appendHTML,
|
||
|
filterAnchoredText: filterAnchoredText,
|
||
|
filterAnchoredHTML: filterAnchoredHTML,
|
||
|
defaultAppendText: appendText,
|
||
|
defaultFilter: defaultFilter,
|
||
|
defaultGetText: defaultGetText,
|
||
|
defaultGetValue: defaultGetValue,
|
||
|
defaultRenderer: defaultRenderer,
|
||
|
defaultSetter: defaultSetter,
|
||
|
retarget: retarget,
|
||
|
attachment: attachment,
|
||
|
list: ul,
|
||
|
suggestions: []
|
||
|
};
|
||
|
var entry = { el: el, api: api };
|
||
|
|
||
|
retarget(el);
|
||
|
cache.push(entry);
|
||
|
parent.appendChild(ul);
|
||
|
el.setAttribute('autocomplete', 'off');
|
||
|
|
||
|
if (Array.isArray(suggestions)) {
|
||
|
loaded(suggestions, false);
|
||
|
}
|
||
|
|
||
|
return api;
|
||
|
|
||
|
function retarget (el) {
|
||
|
inputEvents(true);
|
||
|
attachment = api.attachment = el;
|
||
|
textInput = attachment.tagName === 'INPUT' || attachment.tagName === 'TEXTAREA';
|
||
|
anyInput = textInput || isEditable(attachment);
|
||
|
inputEvents();
|
||
|
}
|
||
|
|
||
|
function refreshPosition () {
|
||
|
if (eye) { eye.refresh(); }
|
||
|
}
|
||
|
|
||
|
function loading (forceShow) {
|
||
|
if (typeof suggestions === 'function') {
|
||
|
crossvent.remove(attachment, 'focus', loading);
|
||
|
var value = textInput ? el.value : el.innerHTML;
|
||
|
if (value !== suggestionsLoad.value) {
|
||
|
suggestionsLoad.counter++;
|
||
|
suggestionsLoad.value = value;
|
||
|
|
||
|
var counter = suggestionsLoad.counter;
|
||
|
suggestions(value, function(s) {
|
||
|
if (suggestionsLoad.counter === counter) {
|
||
|
loaded(s, forceShow);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function loaded (suggestions, forceShow) {
|
||
|
clear();
|
||
|
suggestions.forEach(add);
|
||
|
api.suggestions = suggestions;
|
||
|
if (forceShow) {
|
||
|
show();
|
||
|
}
|
||
|
filtering();
|
||
|
}
|
||
|
|
||
|
function clear () {
|
||
|
unselect();
|
||
|
while (ul.lastChild) {
|
||
|
ul.removeChild(ul.lastChild);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function add (suggestion) {
|
||
|
var li = tag('li', 'sey-item');
|
||
|
render(li, suggestion);
|
||
|
crossvent.add(li, 'click', clickedSuggestion);
|
||
|
crossvent.add(li, 'horsey-filter', filterItem);
|
||
|
crossvent.add(li, 'horsey-hide', hideItem);
|
||
|
ul.appendChild(li);
|
||
|
api.suggestions.push(suggestion);
|
||
|
return li;
|
||
|
|
||
|
function clickedSuggestion () {
|
||
|
var value = getValue(suggestion);
|
||
|
set(value);
|
||
|
hide();
|
||
|
attachment.focus();
|
||
|
crossvent.fabricate(attachment, 'horsey-selected', value);
|
||
|
}
|
||
|
|
||
|
function filterItem () {
|
||
|
var value = textInput ? el.value : el.innerHTML;
|
||
|
if (filter(value, suggestion)) {
|
||
|
li.className = li.className.replace(/ sey-hide/g, '');
|
||
|
} else {
|
||
|
crossvent.fabricate(li, 'horsey-hide');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function hideItem () {
|
||
|
if (!hidden(li)) {
|
||
|
li.className += ' sey-hide';
|
||
|
if (selection === li) {
|
||
|
unselect();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function set (value) {
|
||
|
if (o.anchor) {
|
||
|
return (isText() ? api.appendText : api.appendHTML)(value);
|
||
|
}
|
||
|
userSet(value);
|
||
|
}
|
||
|
|
||
|
function filter (value, suggestion) {
|
||
|
if (o.anchor) {
|
||
|
var il = (isText() ? api.filterAnchoredText : api.filterAnchoredHTML)(value, suggestion);
|
||
|
return il ? userFilter(il.input, il.suggestion) : false;
|
||
|
}
|
||
|
return userFilter(value, suggestion);
|
||
|
}
|
||
|
|
||
|
function isText () { return isInput(attachment); }
|
||
|
function visible () { return ul.className.indexOf('sey-show') !== -1; }
|
||
|
function hidden (li) { return li.className.indexOf('sey-hide') !== -1; }
|
||
|
|
||
|
function show () {
|
||
|
if (!visible()) {
|
||
|
ul.className += ' sey-show';
|
||
|
eye.refresh();
|
||
|
crossvent.fabricate(attachment, 'horsey-show');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function toggler (e) {
|
||
|
var left = e.which === 1 && !e.metaKey && !e.ctrlKey;
|
||
|
if (left === false) {
|
||
|
return; // we only care about honest to god left-clicks
|
||
|
}
|
||
|
toggle();
|
||
|
}
|
||
|
|
||
|
function toggle () {
|
||
|
if (!visible()) {
|
||
|
show();
|
||
|
} else {
|
||
|
hide();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function select (suggestion) {
|
||
|
unselect();
|
||
|
if (suggestion) {
|
||
|
selection = suggestion;
|
||
|
selection.className += ' sey-selected';
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function unselect () {
|
||
|
if (selection) {
|
||
|
selection.className = selection.className.replace(/ sey-selected/g, '');
|
||
|
selection = null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function move (up, moves) {
|
||
|
var total = ul.children.length;
|
||
|
if (total < moves) {
|
||
|
unselect();
|
||
|
return;
|
||
|
}
|
||
|
if (total === 0) {
|
||
|
return;
|
||
|
}
|
||
|
var first = up ? 'lastChild' : 'firstChild';
|
||
|
var next = up ? 'previousSibling' : 'nextSibling';
|
||
|
var suggestion = selection && selection[next] || ul[first];
|
||
|
|
||
|
select(suggestion);
|
||
|
|
||
|
if (hidden(suggestion)) {
|
||
|
move(up, moves ? moves + 1 : 1);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function hide () {
|
||
|
eye.sleep();
|
||
|
ul.className = ul.className.replace(/ sey-show/g, '');
|
||
|
unselect();
|
||
|
crossvent.fabricate(attachment, 'horsey-hide');
|
||
|
}
|
||
|
|
||
|
function keydown (e) {
|
||
|
var shown = visible();
|
||
|
var which = e.which || e.keyCode;
|
||
|
if (which === KEY_DOWN) {
|
||
|
if (anyInput && o.autoShowOnUpDown) {
|
||
|
show();
|
||
|
}
|
||
|
if (shown) {
|
||
|
move();
|
||
|
stop(e);
|
||
|
}
|
||
|
} else if (which === KEY_UP) {
|
||
|
if (anyInput && o.autoShowOnUpDown) {
|
||
|
show();
|
||
|
}
|
||
|
if (shown) {
|
||
|
move(true);
|
||
|
stop(e);
|
||
|
}
|
||
|
} else if (which === KEY_BACKSPACE) {
|
||
|
if (anyInput && o.autoShowOnUpDown) {
|
||
|
show();
|
||
|
}
|
||
|
} else if (shown) {
|
||
|
if (which === KEY_ENTER) {
|
||
|
if (selection) {
|
||
|
crossvent.fabricate(selection, 'click');
|
||
|
} else {
|
||
|
hide();
|
||
|
}
|
||
|
stop(e);
|
||
|
} else if (which === KEY_ESC) {
|
||
|
hide();
|
||
|
stop(e);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function stop (e) {
|
||
|
e.stopPropagation();
|
||
|
e.preventDefault();
|
||
|
}
|
||
|
|
||
|
function filtering () {
|
||
|
if (!visible()) {
|
||
|
return;
|
||
|
}
|
||
|
loading(true);
|
||
|
crossvent.fabricate(attachment, 'horsey-filter');
|
||
|
var li = ul.firstChild;
|
||
|
var count = 0;
|
||
|
while (li) {
|
||
|
if (count >= limit) {
|
||
|
crossvent.fabricate(li, 'horsey-hide');
|
||
|
}
|
||
|
if (count < limit) {
|
||
|
crossvent.fabricate(li, 'horsey-filter');
|
||
|
if (li.className.indexOf('sey-hide') === -1) {
|
||
|
count++;
|
||
|
}
|
||
|
}
|
||
|
li = li.nextSibling;
|
||
|
}
|
||
|
if (!selection) {
|
||
|
move();
|
||
|
}
|
||
|
if (!selection) {
|
||
|
hide();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function deferredFilteringNoEnter (e) {
|
||
|
var which = e.which || e.keyCode;
|
||
|
if (which === KEY_ENTER) {
|
||
|
return;
|
||
|
}
|
||
|
deferredFiltering();
|
||
|
}
|
||
|
|
||
|
function deferredShow (e) {
|
||
|
var which = e.which || e.keyCode;
|
||
|
if (which === KEY_ENTER) {
|
||
|
return;
|
||
|
}
|
||
|
setTimeout(show, 0);
|
||
|
}
|
||
|
|
||
|
function horseyEventTarget (e) {
|
||
|
var target = e.target;
|
||
|
if (target === attachment) {
|
||
|
return true;
|
||
|
}
|
||
|
while (target) {
|
||
|
if (target === ul || target === attachment) {
|
||
|
return true;
|
||
|
}
|
||
|
target = target.parentNode;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function hideOnBlur (e) {
|
||
|
var which = e.which || e.keyCode;
|
||
|
if (which === KEY_TAB) {
|
||
|
hide();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function hideOnClick (e) {
|
||
|
if (horseyEventTarget(e)) {
|
||
|
return;
|
||
|
}
|
||
|
hide();
|
||
|
}
|
||
|
|
||
|
function inputEvents (remove) {
|
||
|
var op = remove ? 'remove' : 'add';
|
||
|
if (eye) {
|
||
|
eye.destroy();
|
||
|
eye = null;
|
||
|
}
|
||
|
if (!remove) {
|
||
|
eye = bullseye(ul, attachment, { caret: anyInput && attachment.tagName !== 'INPUT' });
|
||
|
if (!visible()) { eye.sleep(); }
|
||
|
}
|
||
|
if (remove || (anyInput && doc.activeElement !== attachment)) {
|
||
|
crossvent[op](attachment, 'focus', loading);
|
||
|
} else {
|
||
|
loading();
|
||
|
}
|
||
|
if (anyInput) {
|
||
|
crossvent[op](attachment, 'keypress', deferredShow);
|
||
|
crossvent[op](attachment, 'keypress', deferredFiltering);
|
||
|
crossvent[op](attachment, 'keydown', deferredFilteringNoEnter);
|
||
|
crossvent[op](attachment, 'paste', deferredFiltering);
|
||
|
crossvent[op](attachment, 'keydown', keydown);
|
||
|
if (o.autoHideOnBlur) { crossvent[op](attachment, 'keydown', hideOnBlur); }
|
||
|
} else {
|
||
|
crossvent[op](attachment, 'click', toggler);
|
||
|
crossvent[op](docElement, 'keydown', keydown);
|
||
|
}
|
||
|
if (o.autoHideOnClick) { crossvent[op](doc, 'click', hideOnClick); }
|
||
|
if (form) { crossvent[op](form, 'submit', hide); }
|
||
|
}
|
||
|
|
||
|
function destroy () {
|
||
|
inputEvents(true);
|
||
|
if (parent.contains(ul)) { parent.removeChild(ul); }
|
||
|
cache.splice(cache.indexOf(entry), 1);
|
||
|
}
|
||
|
|
||
|
function defaultSetter (value) {
|
||
|
if (textInput) {
|
||
|
el.value = value;
|
||
|
} else {
|
||
|
el.innerHTML = value;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function defaultRenderer (li, suggestion) {
|
||
|
li.innerText = li.textContent = getText(suggestion);
|
||
|
}
|
||
|
|
||
|
function defaultFilter (q, suggestion) {
|
||
|
var text = getText(suggestion) || '';
|
||
|
var value = getValue(suggestion) || '';
|
||
|
var needle = q.toLowerCase();
|
||
|
return fuzzysearch(needle, text.toLowerCase()) || fuzzysearch(needle, value.toLowerCase());
|
||
|
}
|
||
|
|
||
|
function loopbackToAnchor (text, p) {
|
||
|
var result = '';
|
||
|
var anchored = false;
|
||
|
var start = p.start;
|
||
|
while (anchored === false && start >= 0) {
|
||
|
result = text.substr(start - 1, p.start - start + 1);
|
||
|
anchored = ranchorleft.test(result);
|
||
|
start--;
|
||
|
}
|
||
|
return {
|
||
|
text: anchored ? result : null,
|
||
|
start: start
|
||
|
};
|
||
|
}
|
||
|
|
||
|
function filterAnchoredText (q, suggestion) {
|
||
|
var position = sell(el);
|
||
|
var input = loopbackToAnchor(q, position).text;
|
||
|
if (input) {
|
||
|
return { input: input, suggestion: suggestion };
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function appendText (value) {
|
||
|
var current = el.value;
|
||
|
var position = sell(el);
|
||
|
var input = loopbackToAnchor(current, position);
|
||
|
var left = current.substr(0, input.start);
|
||
|
var right = current.substr(input.start + input.text.length + (position.end - position.start));
|
||
|
var before = left + value + ' ';
|
||
|
|
||
|
el.value = before + right;
|
||
|
sell(el, { start: before.length, end: before.length });
|
||
|
}
|
||
|
|
||
|
function filterAnchoredHTML () {
|
||
|
throw new Error('Anchoring in editable elements is disabled by default.');
|
||
|
}
|
||
|
|
||
|
function appendHTML () {
|
||
|
throw new Error('Anchoring in editable elements is disabled by default.');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function isInput (el) { return el.tagName === 'INPUT' || el.tagName === 'TEXTAREA'; }
|
||
|
|
||
|
function defaultGetValue (suggestion) {
|
||
|
return defaultGet('value', suggestion);
|
||
|
}
|
||
|
|
||
|
function defaultGetText (suggestion) {
|
||
|
return defaultGet('text', suggestion);
|
||
|
}
|
||
|
|
||
|
function defaultGet (type, value) {
|
||
|
return value && value[type] !== void 0 ? value[type] : value;
|
||
|
}
|
||
|
|
||
|
function tag (type, className) {
|
||
|
var el = doc.createElement(type);
|
||
|
el.className = className;
|
||
|
return el;
|
||
|
}
|
||
|
|
||
|
function defer (fn) { return function () { setTimeout(fn, 0); }; }
|
||
|
|
||
|
function isEditable (el) {
|
||
|
var value = el.getAttribute('contentEditable');
|
||
|
if (value === 'false') {
|
||
|
return false;
|
||
|
}
|
||
|
if (value === 'true') {
|
||
|
return true;
|
||
|
}
|
||
|
if (el.parentElement) {
|
||
|
return isEditable(el.parentElement);
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
horsey.find = find;
|
||
|
module.exports = horsey;
|
||
|
|
||
|
},{"bullseye":2,"crossvent":14,"fuzzysearch":16,"sell":17}],2:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var crossvent = require('crossvent');
|
||
|
var throttle = require('./throttle');
|
||
|
var tailormade = require('./tailormade');
|
||
|
|
||
|
function bullseye (el, target, options) {
|
||
|
var o = options;
|
||
|
var domTarget = target && target.tagName;
|
||
|
|
||
|
if (!domTarget && arguments.length === 2) {
|
||
|
o = target;
|
||
|
}
|
||
|
if (!domTarget) {
|
||
|
target = el;
|
||
|
}
|
||
|
if (!o) { o = {}; }
|
||
|
|
||
|
var destroyed = false;
|
||
|
var throttledWrite = throttle(write, 30);
|
||
|
var tailorOptions = { update: o.autoupdateToCaret !== false && update };
|
||
|
var tailor = o.caret && tailormade(target, tailorOptions);
|
||
|
|
||
|
write();
|
||
|
|
||
|
if (o.tracking !== false) {
|
||
|
crossvent.add(window, 'resize', throttledWrite);
|
||
|
}
|
||
|
|
||
|
return {
|
||
|
read: readNull,
|
||
|
refresh: write,
|
||
|
destroy: destroy,
|
||
|
sleep: sleep
|
||
|
};
|
||
|
|
||
|
function sleep () {
|
||
|
tailorOptions.sleeping = true;
|
||
|
}
|
||
|
|
||
|
function readNull () { return read(); }
|
||
|
|
||
|
function read (readings) {
|
||
|
var bounds = target.getBoundingClientRect();
|
||
|
var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
|
||
|
if (tailor) {
|
||
|
readings = tailor.read();
|
||
|
return {
|
||
|
x: (readings.absolute ? 0 : bounds.left) + readings.x,
|
||
|
y: (readings.absolute ? 0 : bounds.top) + scrollTop + readings.y + 20
|
||
|
};
|
||
|
}
|
||
|
return {
|
||
|
x: bounds.left,
|
||
|
y: bounds.top + scrollTop
|
||
|
};
|
||
|
}
|
||
|
|
||
|
function update (readings) {
|
||
|
write(readings);
|
||
|
}
|
||
|
|
||
|
function write (readings) {
|
||
|
if (destroyed) {
|
||
|
throw new Error('Bullseye can\'t refresh after being destroyed. Create another instance instead.');
|
||
|
}
|
||
|
if (tailor && !readings) {
|
||
|
tailorOptions.sleeping = false;
|
||
|
tailor.refresh(); return;
|
||
|
}
|
||
|
var p = read(readings);
|
||
|
if (!tailor && target !== el) {
|
||
|
p.y += target.offsetHeight;
|
||
|
}
|
||
|
el.style.left = p.x + 'px';
|
||
|
el.style.top = p.y + 'px';
|
||
|
}
|
||
|
|
||
|
function destroy () {
|
||
|
if (tailor) { tailor.destroy(); }
|
||
|
crossvent.remove(window, 'resize', throttledWrite);
|
||
|
destroyed = true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = bullseye;
|
||
|
|
||
|
},{"./tailormade":11,"./throttle":12,"crossvent":14}],3:[function(require,module,exports){
|
||
|
(function (global){
|
||
|
'use strict';
|
||
|
|
||
|
var getSelection;
|
||
|
var doc = global.document;
|
||
|
var getSelectionRaw = require('./getSelectionRaw');
|
||
|
var getSelectionNullOp = require('./getSelectionNullOp');
|
||
|
var getSelectionSynthetic = require('./getSelectionSynthetic');
|
||
|
var isHost = require('./isHost');
|
||
|
if (isHost.method(global, 'getSelection')) {
|
||
|
getSelection = getSelectionRaw;
|
||
|
} else if (typeof doc.selection === 'object' && doc.selection) {
|
||
|
getSelection = getSelectionSynthetic;
|
||
|
} else {
|
||
|
getSelection = getSelectionNullOp;
|
||
|
}
|
||
|
|
||
|
module.exports = getSelection;
|
||
|
|
||
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||
|
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9idWxsc2V5ZS9ub2RlX21vZHVsZXMvc2VsZWNjaW9uL3NyYy9nZXRTZWxlY3Rpb24uanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsImZpbGUiOiJnZW5lcmF0ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgZ2V0U2VsZWN0aW9uO1xudmFyIGRvYyA9IGdsb2JhbC5kb2N1bWVudDtcbnZhciBnZXRTZWxlY3Rpb25SYXcgPSByZXF1aXJlKCcuL2dldFNlbGVjdGlvblJhdycpO1xudmFyIGdldFNlbGVjdGlvbk51bGxPcCA9IHJlcXVpcmUoJy4vZ2V0U2VsZWN0aW9uTnVsbE9wJyk7XG52YXIgZ2V0U2VsZWN0aW9uU3ludGhldGljID0gcmVxdWlyZSgnLi9nZXRTZWxlY3Rpb25TeW50aGV0aWMnKTtcbnZhciBpc0hvc3QgPSByZXF1aXJlKCcuL2lzSG9zdCcpO1xuaWYgKGlzSG9zdC5tZXRob2QoZ2xvYmFsLCAnZ2V0U2VsZWN0aW9uJykpIHtcbiAgZ2V0U2VsZWN0aW9uID0gZ2V0U2VsZWN0aW9uUmF3O1xufSBlbHNlIGlmICh0eXBlb2YgZG9jLnNlbGVjdGlvbiA9PT0gJ29iamVjdCcgJiYgZG9jLnNlbGVjdGlvbikge1xuICBnZXRTZWxlY3Rpb24gPSBnZXRTZWxlY3Rpb25TeW50aGV0aWM7XG59IGVsc2Uge1xuICBnZXRTZWxlY3Rpb24gPSBnZXRTZWxlY3Rpb25OdWxsT3A7XG59XG5cbm1vZHVsZS5leHBvcnRzID0gZ2V0U2VsZWN0aW9uO1xuIl19
|
||
|
},{"./getSelectionNullOp":4,"./getSelectionRaw":5,"./getSelectionSynthetic":6,"./isHost":7}],4:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
function noop () {}
|
||
|
|
||
|
function getSelectionNullOp () {
|
||
|
return {
|
||
|
removeAllRanges: noop,
|
||
|
addRange: noop
|
||
|
};
|
||
|
}
|
||
|
|
||
|
module.exports = getSelectionNullOp;
|
||
|
|
||
|
},{}],5:[function(require,module,exports){
|
||
|
(function (global){
|
||
|
'use strict';
|
||
|
|
||
|
function getSelectionRaw () {
|
||
|
return global.getSelection();
|
||
|
}
|
||
|
|
||
|
module.exports = getSelectionRaw;
|
||
|
|
||
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||
|
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9idWxsc2V5ZS9ub2RlX21vZHVsZXMvc2VsZWNjaW9uL3NyYy9nZXRTZWxlY3Rpb25SYXcuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJmaWxlIjoiZ2VuZXJhdGVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxuZnVuY3Rpb24gZ2V0U2VsZWN0aW9uUmF3ICgpIHtcbiAgcmV0dXJuIGdsb2JhbC5nZXRTZWxlY3Rpb24oKTtcbn1cblxubW9kdWxlLmV4cG9ydHMgPSBnZXRTZWxlY3Rpb25SYXc7XG4iXX0=
|
||
|
},{}],6:[function(require,module,exports){
|
||
|
(function (global){
|
||
|
'use strict';
|
||
|
|
||
|
var rangeToTextRange = require('./rangeToTextRange');
|
||
|
var doc = global.document;
|
||
|
var body = doc.body;
|
||
|
var GetSelectionProto = GetSelection.prototype;
|
||
|
|
||
|
function GetSelection (selection) {
|
||
|
var self = this;
|
||
|
var range = selection.createRange();
|
||
|
|
||
|
this._selection = selection;
|
||
|
this._ranges = [];
|
||
|
|
||
|
if (selection.type === 'Control') {
|
||
|
updateControlSelection(self);
|
||
|
} else if (isTextRange(range)) {
|
||
|
updateFromTextRange(self, range);
|
||
|
} else {
|
||
|
updateEmptySelection(self);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
GetSelectionProto.removeAllRanges = function () {
|
||
|
var textRange;
|
||
|
try {
|
||
|
this._selection.empty();
|
||
|
if (this._selection.type !== 'None') {
|
||
|
textRange = body.createTextRange();
|
||
|
textRange.select();
|
||
|
this._selection.empty();
|
||
|
}
|
||
|
} catch (e) {
|
||
|
}
|
||
|
updateEmptySelection(this);
|
||
|
};
|
||
|
|
||
|
GetSelectionProto.addRange = function (range) {
|
||
|
if (this._selection.type === 'Control') {
|
||
|
addRangeToControlSelection(this, range);
|
||
|
} else {
|
||
|
rangeToTextRange(range).select();
|
||
|
this._ranges[0] = range;
|
||
|
this.rangeCount = 1;
|
||
|
this.isCollapsed = this._ranges[0].collapsed;
|
||
|
updateAnchorAndFocusFromRange(this, range, false);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
GetSelectionProto.setRanges = function (ranges) {
|
||
|
this.removeAllRanges();
|
||
|
var rangeCount = ranges.length;
|
||
|
if (rangeCount > 1) {
|
||
|
createControlSelection(this, ranges);
|
||
|
} else if (rangeCount) {
|
||
|
this.addRange(ranges[0]);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
GetSelectionProto.getRangeAt = function (index) {
|
||
|
if (index < 0 || index >= this.rangeCount) {
|
||
|
throw new Error('getRangeAt(): index out of bounds');
|
||
|
} else {
|
||
|
return this._ranges[index].cloneRange();
|
||
|
}
|
||
|
};
|
||
|
|
||
|
GetSelectionProto.removeRange = function (range) {
|
||
|
if (this._selection.type !== 'Control') {
|
||
|
removeRangeManually(this, range);
|
||
|
return;
|
||
|
}
|
||
|
var controlRange = this._selection.createRange();
|
||
|
var rangeElement = getSingleElementFromRange(range);
|
||
|
var newControlRange = body.createControlRange();
|
||
|
var el;
|
||
|
var removed = false;
|
||
|
for (var i = 0, len = controlRange.length; i < len; ++i) {
|
||
|
el = controlRange.item(i);
|
||
|
if (el !== rangeElement || removed) {
|
||
|
newControlRange.add(controlRange.item(i));
|
||
|
} else {
|
||
|
removed = true;
|
||
|
}
|
||
|
}
|
||
|
newControlRange.select();
|
||
|
updateControlSelection(this);
|
||
|
};
|
||
|
|
||
|
GetSelectionProto.eachRange = function (fn, returnValue) {
|
||
|
var i = 0;
|
||
|
var len = this._ranges.length;
|
||
|
for (i = 0; i < len; ++i) {
|
||
|
if (fn(this.getRangeAt(i))) {
|
||
|
return returnValue;
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
GetSelectionProto.getAllRanges = function () {
|
||
|
var ranges = [];
|
||
|
this.eachRange(function (range) {
|
||
|
ranges.push(range);
|
||
|
});
|
||
|
return ranges;
|
||
|
};
|
||
|
|
||
|
GetSelectionProto.setSingleRange = function (range) {
|
||
|
this.removeAllRanges();
|
||
|
this.addRange(range);
|
||
|
};
|
||
|
|
||
|
function createControlSelection (sel, ranges) {
|
||
|
var controlRange = body.createControlRange();
|
||
|
for (var i = 0, el, len = ranges.length; i < len; ++i) {
|
||
|
el = getSingleElementFromRange(ranges[i]);
|
||
|
try {
|
||
|
controlRange.add(el);
|
||
|
} catch (e) {
|
||
|
throw new Error('setRanges(): Element could not be added to control selection');
|
||
|
}
|
||
|
}
|
||
|
controlRange.select();
|
||
|
updateControlSelection(sel);
|
||
|
}
|
||
|
|
||
|
function removeRangeManually (sel, range) {
|
||
|
var ranges = sel.getAllRanges();
|
||
|
sel.removeAllRanges();
|
||
|
for (var i = 0, len = ranges.length; i < len; ++i) {
|
||
|
if (!isSameRange(range, ranges[i])) {
|
||
|
sel.addRange(ranges[i]);
|
||
|
}
|
||
|
}
|
||
|
if (!sel.rangeCount) {
|
||
|
updateEmptySelection(sel);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function updateAnchorAndFocusFromRange (sel, range) {
|
||
|
var anchorPrefix = 'start';
|
||
|
var focusPrefix = 'end';
|
||
|
sel.anchorNode = range[anchorPrefix + 'Container'];
|
||
|
sel.anchorOffset = range[anchorPrefix + 'Offset'];
|
||
|
sel.focusNode = range[focusPrefix + 'Container'];
|
||
|
sel.focusOffset = range[focusPrefix + 'Offset'];
|
||
|
}
|
||
|
|
||
|
function updateEmptySelection (sel) {
|
||
|
sel.anchorNode = sel.focusNode = null;
|
||
|
sel.anchorOffset = sel.focusOffset = 0;
|
||
|
sel.rangeCount = 0;
|
||
|
sel.isCollapsed = true;
|
||
|
sel._ranges.length = 0;
|
||
|
}
|
||
|
|
||
|
function rangeContainsSingleElement (rangeNodes) {
|
||
|
if (!rangeNodes.length || rangeNodes[0].nodeType !== 1) {
|
||
|
return false;
|
||
|
}
|
||
|
for (var i = 1, len = rangeNodes.length; i < len; ++i) {
|
||
|
if (!isAncestorOf(rangeNodes[0], rangeNodes[i])) {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
function getSingleElementFromRange (range) {
|
||
|
var nodes = range.getNodes();
|
||
|
if (!rangeContainsSingleElement(nodes)) {
|
||
|
throw new Error('getSingleElementFromRange(): range did not consist of a single element');
|
||
|
}
|
||
|
return nodes[0];
|
||
|
}
|
||
|
|
||
|
function isTextRange (range) {
|
||
|
return range && range.text !== void 0;
|
||
|
}
|
||
|
|
||
|
function updateFromTextRange (sel, range) {
|
||
|
sel._ranges = [range];
|
||
|
updateAnchorAndFocusFromRange(sel, range, false);
|
||
|
sel.rangeCount = 1;
|
||
|
sel.isCollapsed = range.collapsed;
|
||
|
}
|
||
|
|
||
|
function updateControlSelection (sel) {
|
||
|
sel._ranges.length = 0;
|
||
|
if (sel._selection.type === 'None') {
|
||
|
updateEmptySelection(sel);
|
||
|
} else {
|
||
|
var controlRange = sel._selection.createRange();
|
||
|
if (isTextRange(controlRange)) {
|
||
|
updateFromTextRange(sel, controlRange);
|
||
|
} else {
|
||
|
sel.rangeCount = controlRange.length;
|
||
|
var range;
|
||
|
for (var i = 0; i < sel.rangeCount; ++i) {
|
||
|
range = doc.createRange();
|
||
|
range.selectNode(controlRange.item(i));
|
||
|
sel._ranges.push(range);
|
||
|
}
|
||
|
sel.isCollapsed = sel.rangeCount === 1 && sel._ranges[0].collapsed;
|
||
|
updateAnchorAndFocusFromRange(sel, sel._ranges[sel.rangeCount - 1], false);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function addRangeToControlSelection (sel, range) {
|
||
|
var controlRange = sel._selection.createRange();
|
||
|
var rangeElement = getSingleElementFromRange(range);
|
||
|
var newControlRange = body.createControlRange();
|
||
|
for (var i = 0, len = controlRange.length; i < len; ++i) {
|
||
|
newControlRange.add(controlRange.item(i));
|
||
|
}
|
||
|
try {
|
||
|
newControlRange.add(rangeElement);
|
||
|
} catch (e) {
|
||
|
throw new Error('addRange(): Element could not be added to control selection');
|
||
|
}
|
||
|
newControlRange.select();
|
||
|
updateControlSelection(sel);
|
||
|
}
|
||
|
|
||
|
function isSameRange (left, right) {
|
||
|
return (
|
||
|
left.startContainer === right.startContainer &&
|
||
|
left.startOffset === right.startOffset &&
|
||
|
left.endContainer === right.endContainer &&
|
||
|
left.endOffset === right.endOffset
|
||
|
);
|
||
|
}
|
||
|
|
||
|
function isAncestorOf (ancestor, descendant) {
|
||
|
var node = descendant;
|
||
|
while (node.parentNode) {
|
||
|
if (node.parentNode === ancestor) {
|
||
|
return true;
|
||
|
}
|
||
|
node = node.parentNode;
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
function getSelection () {
|
||
|
return new GetSelection(global.document.selection);
|
||
|
}
|
||
|
|
||
|
module.exports = getSelection;
|
||
|
|
||
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||
|
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9idWxsc2V5ZS9ub2RlX21vZHVsZXMvc2VsZWNjaW9uL3NyYy9nZXRTZWxlY3Rpb25TeW50aGV0aWMuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0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mIChpbmRleCA8IDAgfHwgaW5kZXggPj0gdGhpcy5yYW5nZUNvdW50KSB7XG4gICAgdGhyb3cgbmV3IEVycm9
|
||
|
},{"./rangeToTextRange":8}],7:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
function isHostMethod (host, prop) {
|
||
|
var type = typeof host[prop];
|
||
|
return type === 'function' || !!(type === 'object' && host[prop]) || type === 'unknown';
|
||
|
}
|
||
|
|
||
|
function isHostProperty (host, prop) {
|
||
|
return typeof host[prop] !== 'undefined';
|
||
|
}
|
||
|
|
||
|
function many (fn) {
|
||
|
return function areHosted (host, props) {
|
||
|
var i = props.length;
|
||
|
while (i--) {
|
||
|
if (!fn(host, props[i])) {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
};
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
method: isHostMethod,
|
||
|
methods: many(isHostMethod),
|
||
|
property: isHostProperty,
|
||
|
properties: many(isHostProperty)
|
||
|
};
|
||
|
|
||
|
},{}],8:[function(require,module,exports){
|
||
|
(function (global){
|
||
|
'use strict';
|
||
|
|
||
|
var doc = global.document;
|
||
|
var body = doc.body;
|
||
|
|
||
|
function rangeToTextRange (p) {
|
||
|
if (p.collapsed) {
|
||
|
return createBoundaryTextRange({ node: p.startContainer, offset: p.startOffset }, true);
|
||
|
}
|
||
|
var startRange = createBoundaryTextRange({ node: p.startContainer, offset: p.startOffset }, true);
|
||
|
var endRange = createBoundaryTextRange({ node: p.endContainer, offset: p.endOffset }, false);
|
||
|
var textRange = body.createTextRange();
|
||
|
textRange.setEndPoint('StartToStart', startRange);
|
||
|
textRange.setEndPoint('EndToEnd', endRange);
|
||
|
return textRange;
|
||
|
}
|
||
|
|
||
|
function isCharacterDataNode (node) {
|
||
|
var t = node.nodeType;
|
||
|
return t === 3 || t === 4 || t === 8 ;
|
||
|
}
|
||
|
|
||
|
function createBoundaryTextRange (p, starting) {
|
||
|
var bound;
|
||
|
var parent;
|
||
|
var offset = p.offset;
|
||
|
var workingNode;
|
||
|
var childNodes;
|
||
|
var range = body.createTextRange();
|
||
|
var data = isCharacterDataNode(p.node);
|
||
|
|
||
|
if (data) {
|
||
|
bound = p.node;
|
||
|
parent = bound.parentNode;
|
||
|
} else {
|
||
|
childNodes = p.node.childNodes;
|
||
|
bound = offset < childNodes.length ? childNodes[offset] : null;
|
||
|
parent = p.node;
|
||
|
}
|
||
|
|
||
|
workingNode = doc.createElement('span');
|
||
|
workingNode.innerHTML = '&#feff;';
|
||
|
|
||
|
if (bound) {
|
||
|
parent.insertBefore(workingNode, bound);
|
||
|
} else {
|
||
|
parent.appendChild(workingNode);
|
||
|
}
|
||
|
|
||
|
range.moveToElementText(workingNode);
|
||
|
range.collapse(!starting);
|
||
|
parent.removeChild(workingNode);
|
||
|
|
||
|
if (data) {
|
||
|
range[starting ? 'moveStart' : 'moveEnd']('character', offset);
|
||
|
}
|
||
|
return range;
|
||
|
}
|
||
|
|
||
|
module.exports = rangeToTextRange;
|
||
|
|
||
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||
|
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9idWxsc2V5ZS9ub2RlX21vZHVsZXMvc2VsZWNjaW9uL3NyYy9yYW5nZVRvVGV4dFJhbmdlLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0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2xsYXBzZSghc3RhcnRpbmcpO1xuICBwYXJlbnQucmVtb3ZlQ2hpbGQod29ya2luZ05vZGUpO1xuXG4gIGlmIChkYXRhKSB7XG4gICAgcmFuZ2Vbc3RhcnRpbmcgPyAnbW92ZVN0YXJ0JyA6ICdtb3ZlRW5kJ10oJ2NoYXJhY3RlcicsIG9mZnNldCk7XG4gIH1cbiAgcmV0dXJuIHJhbmdlO1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IHJhbmdlVG9UZXh0UmFuZ2U7XG4iXX0=
|
||
|
},{}],9:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var getSelection = require('./getSelection');
|
||
|
var setSelection = require('./setSelection');
|
||
|
|
||
|
module.exports = {
|
||
|
get: getSelection,
|
||
|
set: setSelection
|
||
|
};
|
||
|
|
||
|
},{"./getSelection":3,"./setSelection":10}],10:[function(require,module,exports){
|
||
|
(function (global){
|
||
|
'use strict';
|
||
|
|
||
|
var getSelection = require('./getSelection');
|
||
|
var rangeToTextRange = require('./rangeToTextRange');
|
||
|
var doc = global.document;
|
||
|
|
||
|
function setSelection (p) {
|
||
|
if (doc.createRange) {
|
||
|
modernSelection();
|
||
|
} else {
|
||
|
oldSelection();
|
||
|
}
|
||
|
|
||
|
function modernSelection () {
|
||
|
var sel = getSelection();
|
||
|
var range = doc.createRange();
|
||
|
if (!p.startContainer) {
|
||
|
return;
|
||
|
}
|
||
|
if (p.endContainer) {
|
||
|
range.setEnd(p.endContainer, p.endOffset);
|
||
|
} else {
|
||
|
range.setEnd(p.startContainer, p.startOffset);
|
||
|
}
|
||
|
range.setStart(p.startContainer, p.startOffset);
|
||
|
sel.removeAllRanges();
|
||
|
sel.addRange(range);
|
||
|
}
|
||
|
|
||
|
function oldSelection () {
|
||
|
rangeToTextRange(p).select();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = setSelection;
|
||
|
|
||
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undef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KSB7XG4gICAgICByZXR1cm47XG4gICAgfVxuICAgIGlmIChwLmVuZENvbnRhaW5lcikge1xuICAgICAgcmFuZ2Uuc2V0RW5kKHAuZW5kQ29udGFpbmVyLCBwLmVuZE9mZnNldCk7XG4gICAgfSBlbHNlIHtcbiAgICAgIHJhbmdlLnNldEVuZChwLnN0YXJ0Q29udGFpbmVyLCBwLnN0YXJ0T2Zmc2V0KTtcbiAgICB9XG4gICAgcmFuZ2Uuc2V0U3RhcnQocC5zdGFydENvbnRhaW5lciwgcC5zdGFydE9mZnNldCk7XG4gICAgc2VsLnJlbW92ZUFsbFJhbmdlcygpO1xuICAgIHNlbC5hZGRSYW5nZShyYW5nZSk7XG4gIH1cblxuICBmdW5jdGlvbiBvbGRTZWxlY3Rpb24gKCkge1xuICAgIHJhbmdlVG9UZXh0UmFuZ2UocCkuc2VsZWN0KCk7XG4gIH1cbn1cblxubW9kdWxlLmV4cG9ydHMgPSBzZXRTZWxlY3Rpb247XG4iXX0=
|
||
|
},{"./getSelection":3,"./rangeToTextRange":8}],11:[function(require,module,exports){
|
||
|
(function (global){
|
||
|
'use strict';
|
||
|
|
||
|
var sell = require('sell');
|
||
|
var crossvent = require('crossvent');
|
||
|
var seleccion = require('seleccion');
|
||
|
var throttle = require('./throttle');
|
||
|
var getSelection = seleccion.get;
|
||
|
var props = [
|
||
|
'direction',
|
||
|
'boxSizing',
|
||
|
'width',
|
||
|
'height',
|
||
|
'overflowX',
|
||
|
'overflowY',
|
||
|
'borderTopWidth',
|
||
|
'borderRightWidth',
|
||
|
'borderBottomWidth',
|
||
|
'borderLeftWidth',
|
||
|
'paddingTop',
|
||
|
'paddingRight',
|
||
|
'paddingBottom',
|
||
|
'paddingLeft',
|
||
|
'fontStyle',
|
||
|
'fontVariant',
|
||
|
'fontWeight',
|
||
|
'fontStretch',
|
||
|
'fontSize',
|
||
|
'fontSizeAdjust',
|
||
|
'lineHeight',
|
||
|
'fontFamily',
|
||
|
'textAlign',
|
||
|
'textTransform',
|
||
|
'textIndent',
|
||
|
'textDecoration',
|
||
|
'letterSpacing',
|
||
|
'wordSpacing'
|
||
|
];
|
||
|
var win = global;
|
||
|
var doc = document;
|
||
|
var ff = win.mozInnerScreenX !== null && win.mozInnerScreenX !== void 0;
|
||
|
|
||
|
function tailormade (el, options) {
|
||
|
var textInput = el.tagName === 'INPUT' || el.tagName === 'TEXTAREA';
|
||
|
var throttledRefresh = throttle(refresh, 30);
|
||
|
var o = options || {};
|
||
|
|
||
|
bind();
|
||
|
|
||
|
return {
|
||
|
read: readPosition,
|
||
|
refresh: throttledRefresh,
|
||
|
destroy: destroy
|
||
|
};
|
||
|
|
||
|
function noop () {}
|
||
|
function readPosition () { return (textInput ? coordsText : coordsHTML)(); }
|
||
|
|
||
|
function refresh () {
|
||
|
if (o.sleeping) {
|
||
|
return;
|
||
|
}
|
||
|
return (o.update || noop)(readPosition());
|
||
|
}
|
||
|
|
||
|
function coordsText () {
|
||
|
var p = sell(el);
|
||
|
var context = prepare();
|
||
|
var readings = readTextCoords(context, p.start);
|
||
|
doc.body.removeChild(context.mirror);
|
||
|
return readings;
|
||
|
}
|
||
|
|
||
|
function coordsHTML () {
|
||
|
var sel = getSelection();
|
||
|
if (sel.rangeCount) {
|
||
|
var range = sel.getRangeAt(0);
|
||
|
var needsToWorkAroundNewlineBug = range.startContainer.nodeName === 'P' && range.startOffset === 0;
|
||
|
if (needsToWorkAroundNewlineBug) {
|
||
|
return {
|
||
|
x: range.startContainer.offsetLeft,
|
||
|
y: range.startContainer.offsetTop,
|
||
|
absolute: true
|
||
|
};
|
||
|
}
|
||
|
if (range.getClientRects) {
|
||
|
var rects = range.getClientRects();
|
||
|
if (rects.length > 0) {
|
||
|
return {
|
||
|
x: rects[0].left,
|
||
|
y: rects[0].top,
|
||
|
absolute: true
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return { x: 0, y: 0 };
|
||
|
}
|
||
|
|
||
|
function readTextCoords (context, p) {
|
||
|
var rest = doc.createElement('span');
|
||
|
var mirror = context.mirror;
|
||
|
var computed = context.computed;
|
||
|
|
||
|
write(mirror, read(el).substring(0, p));
|
||
|
|
||
|
if (el.tagName === 'INPUT') {
|
||
|
mirror.textContent = mirror.textContent.replace(/\s/g, '\u00a0');
|
||
|
}
|
||
|
|
||
|
write(rest, read(el).substring(p) || '.');
|
||
|
|
||
|
mirror.appendChild(rest);
|
||
|
|
||
|
return {
|
||
|
x: rest.offsetLeft + parseInt(computed['borderLeftWidth']),
|
||
|
y: rest.offsetTop + parseInt(computed['borderTopWidth'])
|
||
|
};
|
||
|
}
|
||
|
|
||
|
function read (el) {
|
||
|
return textInput ? el.value : el.innerHTML;
|
||
|
}
|
||
|
|
||
|
function prepare () {
|
||
|
var computed = win.getComputedStyle ? getComputedStyle(el) : el.currentStyle;
|
||
|
var mirror = doc.createElement('div');
|
||
|
var style = mirror.style;
|
||
|
|
||
|
doc.body.appendChild(mirror);
|
||
|
|
||
|
if (el.tagName !== 'INPUT') {
|
||
|
style.wordWrap = 'break-word';
|
||
|
}
|
||
|
style.whiteSpace = 'pre-wrap';
|
||
|
style.position = 'absolute';
|
||
|
style.visibility = 'hidden';
|
||
|
props.forEach(copy);
|
||
|
|
||
|
if (ff) {
|
||
|
style.width = parseInt(computed.width) - 2 + 'px';
|
||
|
if (el.scrollHeight > parseInt(computed.height)) {
|
||
|
style.overflowY = 'scroll';
|
||
|
}
|
||
|
} else {
|
||
|
style.overflow = 'hidden';
|
||
|
}
|
||
|
return { mirror: mirror, computed: computed };
|
||
|
|
||
|
function copy (prop) {
|
||
|
style[prop] = computed[prop];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function write (el, value) {
|
||
|
if (textInput) {
|
||
|
el.textContent = value;
|
||
|
} else {
|
||
|
el.innerHTML = value;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function bind (remove) {
|
||
|
var op = remove ? 'remove' : 'add';
|
||
|
crossvent[op](el, 'keydown', throttledRefresh);
|
||
|
crossvent[op](el, 'keyup', throttledRefresh);
|
||
|
crossvent[op](el, 'input', throttledRefresh);
|
||
|
crossvent[op](el, 'paste', throttledRefresh);
|
||
|
crossvent[op](el, 'change', throttledRefresh);
|
||
|
}
|
||
|
|
||
|
function destroy () {
|
||
|
bind(true);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = tailormade;
|
||
|
|
||
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||
|
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9idWxsc2V5ZS90YWlsb3JtYWRlLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E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yLm9mZnNldExlZnQsXG4gICAgICAgICAgeTogcmFuZ2Uuc3RhcnRDb250YWluZXIub2Zmc2V0VG9wLFxuICAgICAgICAgIGFic29sdXRlOiB0cnVlXG4gICAgICAgIH07XG4
|
||
|
},{"./throttle":12,"crossvent":14,"seleccion":9,"sell":17}],12:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
function throttle (fn, boundary) {
|
||
|
var last = -Infinity;
|
||
|
var timer;
|
||
|
return function bounced () {
|
||
|
if (timer) {
|
||
|
return;
|
||
|
}
|
||
|
unbound();
|
||
|
|
||
|
function unbound () {
|
||
|
clearTimeout(timer);
|
||
|
timer = null;
|
||
|
var next = last + boundary;
|
||
|
var now = Date.now();
|
||
|
if (now > next) {
|
||
|
last = now;
|
||
|
fn();
|
||
|
} else {
|
||
|
timer = setTimeout(unbound, next - now);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
module.exports = throttle;
|
||
|
|
||
|
},{}],13:[function(require,module,exports){
|
||
|
(function (global){
|
||
|
|
||
|
var NativeCustomEvent = global.CustomEvent;
|
||
|
|
||
|
function useNative () {
|
||
|
try {
|
||
|
var p = new NativeCustomEvent('cat', { detail: { foo: 'bar' } });
|
||
|
return 'cat' === p.type && 'bar' === p.detail.foo;
|
||
|
} catch (e) {
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Cross-browser `CustomEvent` constructor.
|
||
|
*
|
||
|
* https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent
|
||
|
*
|
||
|
* @public
|
||
|
*/
|
||
|
|
||
|
module.exports = useNative() ? NativeCustomEvent :
|
||
|
|
||
|
// IE >= 9
|
||
|
'function' === typeof document.createEvent ? function CustomEvent (type, params) {
|
||
|
var e = document.createEvent('CustomEvent');
|
||
|
if (params) {
|
||
|
e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail);
|
||
|
} else {
|
||
|
e.initCustomEvent(type, false, false, void 0);
|
||
|
}
|
||
|
return e;
|
||
|
} :
|
||
|
|
||
|
// IE <= 8
|
||
|
function CustomEvent (type, params) {
|
||
|
var e = document.createEventObject();
|
||
|
e.type = type;
|
||
|
if (params) {
|
||
|
e.bubbles = Boolean(params.bubbles);
|
||
|
e.cancelable = Boolean(params.cancelable);
|
||
|
e.detail = params.detail;
|
||
|
} else {
|
||
|
e.bubbles = false;
|
||
|
e.cancelable = false;
|
||
|
e.detail = void 0;
|
||
|
}
|
||
|
return e;
|
||
|
}
|
||
|
|
||
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||
|
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9jcm9zc3ZlbnQvbm9kZV9tb2R1bGVzL2N1c3RvbS1ldmVudC9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJmaWxlIjoiZ2VuZXJhdGVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXNDb250ZW50IjpbIlxudmFyIE5hdGl2ZUN1c3RvbUV2ZW50ID0gZ2xvYmFsLkN1c3RvbUV2ZW50O1xuXG5mdW5jdGlvbiB1c2VOYXRpdmUgKCkge1xuIC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KTtcbiAgZS50eXBlID0gdHlwZTtcbiAgaWYgKHBhcmFtcykge1xuICAgIGUuYnViYmxlcyA9IEJvb2xlYW4ocGFyYW1zLmJ1YmJsZXMpO1xuICAgIGUuY2FuY2VsYWJsZSA9IEJvb2xlYW4ocGFyYW1zLmNhbmNlbGFibGUpO1xuICAgIGUuZGV0YWlsID0gcGFyYW1zLmRldGFpbDtcbiAgfSBlbHNlIHtcbiAgICBlLmJ1YmJsZXMgPSBmYWxzZTtcbiAgICBlLmNhbmNlbGFibGUgPSBmYWxzZTtcbiAgICBlLmRldGFpbCA9IHZvaWQgMDtcbiAgfVxuICByZXR1cm4gZTtcbn1cbiJdfQ==
|
||
|
},{}],14:[function(require,module,exports){
|
||
|
(function (global){
|
||
|
'use strict';
|
||
|
|
||
|
var customEvent = require('custom-event');
|
||
|
var eventmap = require('./eventmap');
|
||
|
var doc = document;
|
||
|
var addEvent = addEventEasy;
|
||
|
var removeEvent = removeEventEasy;
|
||
|
var hardCache = [];
|
||
|
|
||
|
if (!global.addEventListener) {
|
||
|
addEvent = addEventHard;
|
||
|
removeEvent = removeEventHard;
|
||
|
}
|
||
|
|
||
|
function addEventEasy (el, type, fn, capturing) {
|
||
|
return el.addEventListener(type, fn, capturing);
|
||
|
}
|
||
|
|
||
|
function addEventHard (el, type, fn) {
|
||
|
return el.attachEvent('on' + type, wrap(el, type, fn));
|
||
|
}
|
||
|
|
||
|
function removeEventEasy (el, type, fn, capturing) {
|
||
|
return el.removeEventListener(type, fn, capturing);
|
||
|
}
|
||
|
|
||
|
function removeEventHard (el, type, fn) {
|
||
|
return el.detachEvent('on' + type, unwrap(el, type, fn));
|
||
|
}
|
||
|
|
||
|
function fabricateEvent (el, type, model) {
|
||
|
var e = eventmap.indexOf(type) === -1 ? makeCustomEvent() : makeClassicEvent();
|
||
|
if (el.dispatchEvent) {
|
||
|
el.dispatchEvent(e);
|
||
|
} else {
|
||
|
el.fireEvent('on' + type, e);
|
||
|
}
|
||
|
function makeClassicEvent () {
|
||
|
var e;
|
||
|
if (doc.createEvent) {
|
||
|
e = doc.createEvent('Event');
|
||
|
e.initEvent(type, true, true);
|
||
|
} else if (doc.createEventObject) {
|
||
|
e = doc.createEventObject();
|
||
|
}
|
||
|
return e;
|
||
|
}
|
||
|
function makeCustomEvent () {
|
||
|
return new customEvent(type, { detail: model });
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function wrapperFactory (el, type, fn) {
|
||
|
return function wrapper (originalEvent) {
|
||
|
var e = originalEvent || global.event;
|
||
|
e.target = e.target || e.srcElement;
|
||
|
e.preventDefault = e.preventDefault || function preventDefault () { e.returnValue = false; };
|
||
|
e.stopPropagation = e.stopPropagation || function stopPropagation () { e.cancelBubble = true; };
|
||
|
e.which = e.which || e.keyCode;
|
||
|
fn.call(el, e);
|
||
|
};
|
||
|
}
|
||
|
|
||
|
function wrap (el, type, fn) {
|
||
|
var wrapper = unwrap(el, type, fn) || wrapperFactory(el, type, fn);
|
||
|
hardCache.push({
|
||
|
wrapper: wrapper,
|
||
|
element: el,
|
||
|
type: type,
|
||
|
fn: fn
|
||
|
});
|
||
|
return wrapper;
|
||
|
}
|
||
|
|
||
|
function unwrap (el, type, fn) {
|
||
|
var i = find(el, type, fn);
|
||
|
if (i) {
|
||
|
var wrapper = hardCache[i].wrapper;
|
||
|
hardCache.splice(i, 1); // free up a tad of memory
|
||
|
return wrapper;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function find (el, type, fn) {
|
||
|
var i, item;
|
||
|
for (i = 0; i < hardCache.length; i++) {
|
||
|
item = hardCache[i];
|
||
|
if (item.element === el && item.type === type && item.fn === fn) {
|
||
|
return i;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
add: addEvent,
|
||
|
remove: removeEvent,
|
||
|
fabricate: fabricateEvent
|
||
|
};
|
||
|
|
||
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||
|
//# s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cnVlOyB9O1xuICAgIGUud2hpY2ggPSBlLndoaWNoIHx8IGUua2V5Q29kZTtcbiAgICBmbi5jYWxsKGVsLCBlKTtcbiAgfTtcbn1cblxuZnVuY3Rpb24gd3JhcCAoZWwsIHR5cGUsIGZuKSB7XG4gIHZhciB3cmFwcGVyID0gdW53cmFwKGVsLCB0eXBlLCBmbikgfHwgd3JhcHBlckZhY3RvcnkoZWwsIHR5cGUsIGZuKTtcbiAgaGFyZENhY2hlLnB1c2goe1xuICAgIHdyYXBwZXI6IHdyYXBwZXIsXG4gICAgZWxlbWVudDogZWwsXG4gICAgdHlwZTogdHlwZSxcbiAgICBmbjogZm5cbiAgfSk7XG4gIHJldHVybiB3cmFwcGVyO1xufVxuXG5mdW5jdGlvbiB1bndyYXAgKGVsLCB0eXBlLCBmbikge1xuICB2YXIgaSA9IGZpbmQoZWwsIHR5cGUsIGZuKTtcbiAgaWYgKGkpIHtcbiAgICB2YXIgd3JhcHBlciA9IGhhcmRDYWNoZVtpXS53cmFwcGVyO1xuICAgIGhhcmRDYWNoZS5zcGxpY2UoaSwgMSk7IC8vIGZyZWUgdXAgYSB0YWQgb2YgbWVtb3J5XG4gICAgcmV0dXJuIHdyYXBwZXI7XG4gIH1cbn1cblxuZnVuY3Rpb24gZmluZCAoZWwsIHR5cGUsIGZuKSB7XG4gIHZhciBpLCBpdGVtO1xuICBmb3IgKGkgPSAwOyBpIDwgaGFyZENhY2hlLmxlbmd0aDsgaSsrKSB7XG4gICAgaXRlbSA9IGhhcmRDYWNoZVtpXTtcbiAgICBpZiAoaXRlbS5lbGVtZW50ID09PSBlbCAmJiBpdGVtLnR5cGUgPT09IHR5cGUgJiYgaXRlbS5mbiA
|
||
|
},{"./eventmap":15,"custom-event":13}],15:[function(require,module,exports){
|
||
|
(function (global){
|
||
|
'use strict';
|
||
|
|
||
|
var eventmap = [];
|
||
|
var eventname = '';
|
||
|
var ron = /^on/;
|
||
|
|
||
|
for (eventname in global) {
|
||
|
if (ron.test(eventname)) {
|
||
|
eventmap.push(eventname.slice(2));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = eventmap;
|
||
|
|
||
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||
|
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9jcm9zc3ZlbnQvc3JjL2V2ZW50bWFwLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwiZmlsZSI6ImdlbmVyYXRlZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciBldmVudG1hcCA9IFtdO1xudmFyIGV2ZW50bmFtZSA9ICcnO1xudmFyIHJvbiA9IC9eb24vO1xuXG5mb3IgKGV2ZW50bmFtZSBpbiBnbG9iYWwpIHtcbiAgaWYgKHJvbi50ZXN0KGV2ZW50bmFtZSkpIHtcbiAgICBldmVudG1hcC5wdXNoKGV2ZW50bmFtZS5zbGljZSgyKSk7XG4gIH1cbn1cblxubW9kdWxlLmV4cG9ydHMgPSBldmVudG1hcDtcbiJdfQ==
|
||
|
},{}],16:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
function fuzzysearch (needle, haystack) {
|
||
|
var tlen = haystack.length;
|
||
|
var qlen = needle.length;
|
||
|
if (qlen > tlen) {
|
||
|
return false;
|
||
|
}
|
||
|
if (qlen === tlen) {
|
||
|
return needle === haystack;
|
||
|
}
|
||
|
outer: for (var i = 0, j = 0; i < qlen; i++) {
|
||
|
var nch = needle.charCodeAt(i);
|
||
|
while (j < tlen) {
|
||
|
if (haystack.charCodeAt(j++) === nch) {
|
||
|
continue outer;
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
module.exports = fuzzysearch;
|
||
|
|
||
|
},{}],17:[function(require,module,exports){
|
||
|
'use strict';
|
||
|
|
||
|
var get = easyGet;
|
||
|
var set = easySet;
|
||
|
|
||
|
if (document.selection && document.selection.createRange) {
|
||
|
get = hardGet;
|
||
|
set = hardSet;
|
||
|
}
|
||
|
|
||
|
function easyGet (el) {
|
||
|
return {
|
||
|
start: el.selectionStart,
|
||
|
end: el.selectionEnd
|
||
|
};
|
||
|
}
|
||
|
|
||
|
function hardGet (el) {
|
||
|
var active = document.activeElement;
|
||
|
if (active !== el) {
|
||
|
el.focus();
|
||
|
}
|
||
|
|
||
|
var range = document.selection.createRange();
|
||
|
var bookmark = range.getBookmark();
|
||
|
var original = el.value;
|
||
|
var marker = getUniqueMarker(original);
|
||
|
var parent = range.parentElement();
|
||
|
if (parent === null || !inputs(parent)) {
|
||
|
return result(0, 0);
|
||
|
}
|
||
|
range.text = marker + range.text + marker;
|
||
|
|
||
|
var contents = el.value;
|
||
|
|
||
|
el.value = original;
|
||
|
range.moveToBookmark(bookmark);
|
||
|
range.select();
|
||
|
|
||
|
return result(contents.indexOf(marker), contents.lastIndexOf(marker) - marker.length);
|
||
|
|
||
|
function result (start, end) {
|
||
|
if (active !== el) { // don't disrupt pre-existing state
|
||
|
if (active) {
|
||
|
active.focus();
|
||
|
} else {
|
||
|
el.blur();
|
||
|
}
|
||
|
}
|
||
|
return { start: start, end: end };
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function getUniqueMarker (contents) {
|
||
|
var marker;
|
||
|
do {
|
||
|
marker = '@@marker.' + Math.random() * new Date();
|
||
|
} while (contents.indexOf(marker) !== -1);
|
||
|
return marker;
|
||
|
}
|
||
|
|
||
|
function inputs (el) {
|
||
|
return ((el.tagName === 'INPUT' && el.type === 'text') || el.tagName === 'TEXTAREA');
|
||
|
}
|
||
|
|
||
|
function easySet (el, p) {
|
||
|
el.selectionStart = parse(el, p.start);
|
||
|
el.selectionEnd = parse(el, p.end);
|
||
|
}
|
||
|
|
||
|
function hardSet (el, p) {
|
||
|
var range = el.createTextRange();
|
||
|
|
||
|
if (p.start === 'end' && p.end === 'end') {
|
||
|
range.collapse(false);
|
||
|
range.select();
|
||
|
} else {
|
||
|
range.collapse(true);
|
||
|
range.moveEnd('character', parse(el, p.end));
|
||
|
range.moveStart('character', parse(el, p.start));
|
||
|
range.select();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function parse (el, value) {
|
||
|
return value === 'end' ? el.value.length : value || 0;
|
||
|
}
|
||
|
|
||
|
function sell (el, p) {
|
||
|
if (arguments.length === 2) {
|
||
|
set(el, p);
|
||
|
}
|
||
|
return get(el);
|
||
|
}
|
||
|
|
||
|
module.exports = sell;
|
||
|
|
||
|
},{}]},{},[1])(1)
|
||
|
});
|
||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJob3JzZXkuanMiLCJub2RlX21vZHVsZXMvYnVsbHNleWUvYnVsbHNleWUuanMiLCJub2RlX21vZHVsZXMvYnVsbHNleWUvbm9kZV9tb2R1bGVzL3NlbGVjY2lvbi9zcmMvZ2V0U2VsZWN0aW9uLmpzIiwibm9kZV9tb2R1bGVzL2J1bGxzZXllL25vZGVfbW9kdWxlcy9zZWxlY2Npb24vc3JjL2dldFNlbGVjdGlvbk51bGxPcC5qcyIsIm5vZGVfbW9kdWxlcy9idWxsc2V5ZS9ub2RlX21vZHVsZXMvc2VsZWNjaW9uL3NyYy9nZXRTZWxlY3Rpb25SYXcuanMiLCJub2RlX21vZHVsZXMvYnVsbHNleWUvbm9kZV9tb2R1bGVzL3NlbGVjY2lvbi9zcmMvZ2V0U2VsZWN0aW9uU3ludGhldGljLmpzIi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