Contains the Concourse pipeline definition for building a line-server container
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

739 lines
22 KiB

  1. /*!
  2. * clipboard.js v1.5.10
  3. * https://zenorocha.github.io/clipboard.js
  4. *
  5. * Licensed MIT © Zeno Rocha
  6. */
  7. (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Clipboard = f()}})(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){
  8. var matches = require('matches-selector')
  9. module.exports = function (element, selector, checkYoSelf) {
  10. var parent = checkYoSelf ? element : element.parentNode
  11. while (parent && parent !== document) {
  12. if (matches(parent, selector)) return parent;
  13. parent = parent.parentNode
  14. }
  15. }
  16. },{"matches-selector":5}],2:[function(require,module,exports){
  17. var closest = require('closest');
  18. /**
  19. * Delegates event to a selector.
  20. *
  21. * @param {Element} element
  22. * @param {String} selector
  23. * @param {String} type
  24. * @param {Function} callback
  25. * @param {Boolean} useCapture
  26. * @return {Object}
  27. */
  28. function delegate(element, selector, type, callback, useCapture) {
  29. var listenerFn = listener.apply(this, arguments);
  30. element.addEventListener(type, listenerFn, useCapture);
  31. return {
  32. destroy: function() {
  33. element.removeEventListener(type, listenerFn, useCapture);
  34. }
  35. }
  36. }
  37. /**
  38. * Finds closest match and invokes callback.
  39. *
  40. * @param {Element} element
  41. * @param {String} selector
  42. * @param {String} type
  43. * @param {Function} callback
  44. * @return {Function}
  45. */
  46. function listener(element, selector, type, callback) {
  47. return function(e) {
  48. e.delegateTarget = closest(e.target, selector, true);
  49. if (e.delegateTarget) {
  50. callback.call(element, e);
  51. }
  52. }
  53. }
  54. module.exports = delegate;
  55. },{"closest":1}],3:[function(require,module,exports){
  56. /**
  57. * Check if argument is a HTML element.
  58. *
  59. * @param {Object} value
  60. * @return {Boolean}
  61. */
  62. exports.node = function(value) {
  63. return value !== undefined
  64. && value instanceof HTMLElement
  65. && value.nodeType === 1;
  66. };
  67. /**
  68. * Check if argument is a list of HTML elements.
  69. *
  70. * @param {Object} value
  71. * @return {Boolean}
  72. */
  73. exports.nodeList = function(value) {
  74. var type = Object.prototype.toString.call(value);
  75. return value !== undefined
  76. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  77. && ('length' in value)
  78. && (value.length === 0 || exports.node(value[0]));
  79. };
  80. /**
  81. * Check if argument is a string.
  82. *
  83. * @param {Object} value
  84. * @return {Boolean}
  85. */
  86. exports.string = function(value) {
  87. return typeof value === 'string'
  88. || value instanceof String;
  89. };
  90. /**
  91. * Check if argument is a function.
  92. *
  93. * @param {Object} value
  94. * @return {Boolean}
  95. */
  96. exports.fn = function(value) {
  97. var type = Object.prototype.toString.call(value);
  98. return type === '[object Function]';
  99. };
  100. },{}],4:[function(require,module,exports){
  101. var is = require('./is');
  102. var delegate = require('delegate');
  103. /**
  104. * Validates all params and calls the right
  105. * listener function based on its target type.
  106. *
  107. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  108. * @param {String} type
  109. * @param {Function} callback
  110. * @return {Object}
  111. */
  112. function listen(target, type, callback) {
  113. if (!target && !type && !callback) {
  114. throw new Error('Missing required arguments');
  115. }
  116. if (!is.string(type)) {
  117. throw new TypeError('Second argument must be a String');
  118. }
  119. if (!is.fn(callback)) {
  120. throw new TypeError('Third argument must be a Function');
  121. }
  122. if (is.node(target)) {
  123. return listenNode(target, type, callback);
  124. }
  125. else if (is.nodeList(target)) {
  126. return listenNodeList(target, type, callback);
  127. }
  128. else if (is.string(target)) {
  129. return listenSelector(target, type, callback);
  130. }
  131. else {
  132. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  133. }
  134. }
  135. /**
  136. * Adds an event listener to a HTML element
  137. * and returns a remove listener function.
  138. *
  139. * @param {HTMLElement} node
  140. * @param {String} type
  141. * @param {Function} callback
  142. * @return {Object}
  143. */
  144. function listenNode(node, type, callback) {
  145. node.addEventListener(type, callback);
  146. return {
  147. destroy: function() {
  148. node.removeEventListener(type, callback);
  149. }
  150. }
  151. }
  152. /**
  153. * Add an event listener to a list of HTML elements
  154. * and returns a remove listener function.
  155. *
  156. * @param {NodeList|HTMLCollection} nodeList
  157. * @param {String} type
  158. * @param {Function} callback
  159. * @return {Object}
  160. */
  161. function listenNodeList(nodeList, type, callback) {
  162. Array.prototype.forEach.call(nodeList, function(node) {
  163. node.addEventListener(type, callback);
  164. });
  165. return {
  166. destroy: function() {
  167. Array.prototype.forEach.call(nodeList, function(node) {
  168. node.removeEventListener(type, callback);
  169. });
  170. }
  171. }
  172. }
  173. /**
  174. * Add an event listener to a selector
  175. * and returns a remove listener function.
  176. *
  177. * @param {String} selector
  178. * @param {String} type
  179. * @param {Function} callback
  180. * @return {Object}
  181. */
  182. function listenSelector(selector, type, callback) {
  183. return delegate(document.body, selector, type, callback);
  184. }
  185. module.exports = listen;
  186. },{"./is":3,"delegate":2}],5:[function(require,module,exports){
  187. /**
  188. * Element prototype.
  189. */
  190. var proto = Element.prototype;
  191. /**
  192. * Vendor function.
  193. */
  194. var vendor = proto.matchesSelector
  195. || proto.webkitMatchesSelector
  196. || proto.mozMatchesSelector
  197. || proto.msMatchesSelector
  198. || proto.oMatchesSelector;
  199. /**
  200. * Expose `match()`.
  201. */
  202. module.exports = match;
  203. /**
  204. * Match `el` to `selector`.
  205. *
  206. * @param {Element} el
  207. * @param {String} selector
  208. * @return {Boolean}
  209. * @api public
  210. */
  211. function match(el, selector) {
  212. if (vendor) return vendor.call(el, selector);
  213. var nodes = el.parentNode.querySelectorAll(selector);
  214. for (var i = 0; i < nodes.length; ++i) {
  215. if (nodes[i] == el) return true;
  216. }
  217. return false;
  218. }
  219. },{}],6:[function(require,module,exports){
  220. function select(element) {
  221. var selectedText;
  222. if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  223. element.focus();
  224. element.setSelectionRange(0, element.value.length);
  225. selectedText = element.value;
  226. }
  227. else {
  228. if (element.hasAttribute('contenteditable')) {
  229. element.focus();
  230. }
  231. var selection = window.getSelection();
  232. var range = document.createRange();
  233. range.selectNodeContents(element);
  234. selection.removeAllRanges();
  235. selection.addRange(range);
  236. selectedText = selection.toString();
  237. }
  238. return selectedText;
  239. }
  240. module.exports = select;
  241. },{}],7:[function(require,module,exports){
  242. function E () {
  243. // Keep this empty so it's easier to inherit from
  244. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  245. }
  246. E.prototype = {
  247. on: function (name, callback, ctx) {
  248. var e = this.e || (this.e = {});
  249. (e[name] || (e[name] = [])).push({
  250. fn: callback,
  251. ctx: ctx
  252. });
  253. return this;
  254. },
  255. once: function (name, callback, ctx) {
  256. var self = this;
  257. function listener () {
  258. self.off(name, listener);
  259. callback.apply(ctx, arguments);
  260. };
  261. listener._ = callback
  262. return this.on(name, listener, ctx);
  263. },
  264. emit: function (name) {
  265. var data = [].slice.call(arguments, 1);
  266. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  267. var i = 0;
  268. var len = evtArr.length;
  269. for (i; i < len; i++) {
  270. evtArr[i].fn.apply(evtArr[i].ctx, data);
  271. }
  272. return this;
  273. },
  274. off: function (name, callback) {
  275. var e = this.e || (this.e = {});
  276. var evts = e[name];
  277. var liveEvents = [];
  278. if (evts && callback) {
  279. for (var i = 0, len = evts.length; i < len; i++) {
  280. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  281. liveEvents.push(evts[i]);
  282. }
  283. }
  284. // Remove event from queue to prevent memory leak
  285. // Suggested by https://github.com/lazd
  286. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  287. (liveEvents.length)
  288. ? e[name] = liveEvents
  289. : delete e[name];
  290. return this;
  291. }
  292. };
  293. module.exports = E;
  294. },{}],8:[function(require,module,exports){
  295. (function (global, factory) {
  296. if (typeof define === "function" && define.amd) {
  297. define(['module', 'select'], factory);
  298. } else if (typeof exports !== "undefined") {
  299. factory(module, require('select'));
  300. } else {
  301. var mod = {
  302. exports: {}
  303. };
  304. factory(mod, global.select);
  305. global.clipboardAction = mod.exports;
  306. }
  307. })(this, function (module, _select) {
  308. 'use strict';
  309. var _select2 = _interopRequireDefault(_select);
  310. function _interopRequireDefault(obj) {
  311. return obj && obj.__esModule ? obj : {
  312. default: obj
  313. };
  314. }
  315. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  316. return typeof obj;
  317. } : function (obj) {
  318. return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
  319. };
  320. function _classCallCheck(instance, Constructor) {
  321. if (!(instance instanceof Constructor)) {
  322. throw new TypeError("Cannot call a class as a function");
  323. }
  324. }
  325. var _createClass = function () {
  326. function defineProperties(target, props) {
  327. for (var i = 0; i < props.length; i++) {
  328. var descriptor = props[i];
  329. descriptor.enumerable = descriptor.enumerable || false;
  330. descriptor.configurable = true;
  331. if ("value" in descriptor) descriptor.writable = true;
  332. Object.defineProperty(target, descriptor.key, descriptor);
  333. }
  334. }
  335. return function (Constructor, protoProps, staticProps) {
  336. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  337. if (staticProps) defineProperties(Constructor, staticProps);
  338. return Constructor;
  339. };
  340. }();
  341. var ClipboardAction = function () {
  342. /**
  343. * @param {Object} options
  344. */
  345. function ClipboardAction(options) {
  346. _classCallCheck(this, ClipboardAction);
  347. this.resolveOptions(options);
  348. this.initSelection();
  349. }
  350. /**
  351. * Defines base properties passed from constructor.
  352. * @param {Object} options
  353. */
  354. ClipboardAction.prototype.resolveOptions = function resolveOptions() {
  355. var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
  356. this.action = options.action;
  357. this.emitter = options.emitter;
  358. this.target = options.target;
  359. this.text = options.text;
  360. this.trigger = options.trigger;
  361. this.selectedText = '';
  362. };
  363. ClipboardAction.prototype.initSelection = function initSelection() {
  364. if (this.text) {
  365. this.selectFake();
  366. } else if (this.target) {
  367. this.selectTarget();
  368. }
  369. };
  370. ClipboardAction.prototype.selectFake = function selectFake() {
  371. var _this = this;
  372. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  373. this.removeFake();
  374. this.fakeHandler = document.body.addEventListener('click', function () {
  375. return _this.removeFake();
  376. });
  377. this.fakeElem = document.createElement('textarea');
  378. // Prevent zooming on iOS
  379. this.fakeElem.style.fontSize = '12pt';
  380. // Reset box model
  381. this.fakeElem.style.border = '0';
  382. this.fakeElem.style.padding = '0';
  383. this.fakeElem.style.margin = '0';
  384. // Move element out of screen horizontally
  385. this.fakeElem.style.position = 'fixed';
  386. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  387. // Move element to the same position vertically
  388. this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px';
  389. this.fakeElem.setAttribute('readonly', '');
  390. this.fakeElem.value = this.text;
  391. document.body.appendChild(this.fakeElem);
  392. this.selectedText = (0, _select2.default)(this.fakeElem);
  393. this.copyText();
  394. };
  395. ClipboardAction.prototype.removeFake = function removeFake() {
  396. if (this.fakeHandler) {
  397. document.body.removeEventListener('click');
  398. this.fakeHandler = null;
  399. }
  400. if (this.fakeElem) {
  401. document.body.removeChild(this.fakeElem);
  402. this.fakeElem = null;
  403. }
  404. };
  405. ClipboardAction.prototype.selectTarget = function selectTarget() {
  406. this.selectedText = (0, _select2.default)(this.target);
  407. this.copyText();
  408. };
  409. ClipboardAction.prototype.copyText = function copyText() {
  410. var succeeded = undefined;
  411. try {
  412. succeeded = document.execCommand(this.action);
  413. } catch (err) {
  414. succeeded = false;
  415. }
  416. this.handleResult(succeeded);
  417. };
  418. ClipboardAction.prototype.handleResult = function handleResult(succeeded) {
  419. if (succeeded) {
  420. this.emitter.emit('success', {
  421. action: this.action,
  422. text: this.selectedText,
  423. trigger: this.trigger,
  424. clearSelection: this.clearSelection.bind(this)
  425. });
  426. } else {
  427. this.emitter.emit('error', {
  428. action: this.action,
  429. trigger: this.trigger,
  430. clearSelection: this.clearSelection.bind(this)
  431. });
  432. }
  433. };
  434. ClipboardAction.prototype.clearSelection = function clearSelection() {
  435. if (this.target) {
  436. this.target.blur();
  437. }
  438. window.getSelection().removeAllRanges();
  439. };
  440. ClipboardAction.prototype.destroy = function destroy() {
  441. this.removeFake();
  442. };
  443. _createClass(ClipboardAction, [{
  444. key: 'action',
  445. set: function set() {
  446. var action = arguments.length <= 0 || arguments[0] === undefined ? 'copy' : arguments[0];
  447. this._action = action;
  448. if (this._action !== 'copy' && this._action !== 'cut') {
  449. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  450. }
  451. },
  452. get: function get() {
  453. return this._action;
  454. }
  455. }, {
  456. key: 'target',
  457. set: function set(target) {
  458. if (target !== undefined) {
  459. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  460. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  461. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  462. }
  463. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  464. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  465. }
  466. this._target = target;
  467. } else {
  468. throw new Error('Invalid "target" value, use a valid Element');
  469. }
  470. }
  471. },
  472. get: function get() {
  473. return this._target;
  474. }
  475. }]);
  476. return ClipboardAction;
  477. }();
  478. module.exports = ClipboardAction;
  479. });
  480. },{"select":6}],9:[function(require,module,exports){
  481. (function (global, factory) {
  482. if (typeof define === "function" && define.amd) {
  483. define(['module', './clipboard-action', 'tiny-emitter', 'good-listener'], factory);
  484. } else if (typeof exports !== "undefined") {
  485. factory(module, require('./clipboard-action'), require('tiny-emitter'), require('good-listener'));
  486. } else {
  487. var mod = {
  488. exports: {}
  489. };
  490. factory(mod, global.clipboardAction, global.tinyEmitter, global.goodListener);
  491. global.clipboard = mod.exports;
  492. }
  493. })(this, function (module, _clipboardAction, _tinyEmitter, _goodListener) {
  494. 'use strict';
  495. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  496. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  497. var _goodListener2 = _interopRequireDefault(_goodListener);
  498. function _interopRequireDefault(obj) {
  499. return obj && obj.__esModule ? obj : {
  500. default: obj
  501. };
  502. }
  503. function _classCallCheck(instance, Constructor) {
  504. if (!(instance instanceof Constructor)) {
  505. throw new TypeError("Cannot call a class as a function");
  506. }
  507. }
  508. function _possibleConstructorReturn(self, call) {
  509. if (!self) {
  510. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  511. }
  512. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  513. }
  514. function _inherits(subClass, superClass) {
  515. if (typeof superClass !== "function" && superClass !== null) {
  516. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  517. }
  518. subClass.prototype = Object.create(superClass && superClass.prototype, {
  519. constructor: {
  520. value: subClass,
  521. enumerable: false,
  522. writable: true,
  523. configurable: true
  524. }
  525. });
  526. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  527. }
  528. var Clipboard = function (_Emitter) {
  529. _inherits(Clipboard, _Emitter);
  530. /**
  531. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  532. * @param {Object} options
  533. */
  534. function Clipboard(trigger, options) {
  535. _classCallCheck(this, Clipboard);
  536. var _this = _possibleConstructorReturn(this, _Emitter.call(this));
  537. _this.resolveOptions(options);
  538. _this.listenClick(trigger);
  539. return _this;
  540. }
  541. /**
  542. * Defines if attributes would be resolved using internal setter functions
  543. * or custom functions that were passed in the constructor.
  544. * @param {Object} options
  545. */
  546. Clipboard.prototype.resolveOptions = function resolveOptions() {
  547. var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
  548. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  549. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  550. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  551. };
  552. Clipboard.prototype.listenClick = function listenClick(trigger) {
  553. var _this2 = this;
  554. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  555. return _this2.onClick(e);
  556. });
  557. };
  558. Clipboard.prototype.onClick = function onClick(e) {
  559. var trigger = e.delegateTarget || e.currentTarget;
  560. if (this.clipboardAction) {
  561. this.clipboardAction = null;
  562. }
  563. this.clipboardAction = new _clipboardAction2.default({
  564. action: this.action(trigger),
  565. target: this.target(trigger),
  566. text: this.text(trigger),
  567. trigger: trigger,
  568. emitter: this
  569. });
  570. };
  571. Clipboard.prototype.defaultAction = function defaultAction(trigger) {
  572. return getAttributeValue('action', trigger);
  573. };
  574. Clipboard.prototype.defaultTarget = function defaultTarget(trigger) {
  575. var selector = getAttributeValue('target', trigger);
  576. if (selector) {
  577. return document.querySelector(selector);
  578. }
  579. };
  580. Clipboard.prototype.defaultText = function defaultText(trigger) {
  581. return getAttributeValue('text', trigger);
  582. };
  583. Clipboard.prototype.destroy = function destroy() {
  584. this.listener.destroy();
  585. if (this.clipboardAction) {
  586. this.clipboardAction.destroy();
  587. this.clipboardAction = null;
  588. }
  589. };
  590. return Clipboard;
  591. }(_tinyEmitter2.default);
  592. /**
  593. * Helper function to retrieve attribute value.
  594. * @param {String} suffix
  595. * @param {Element} element
  596. */
  597. function getAttributeValue(suffix, element) {
  598. var attribute = 'data-clipboard-' + suffix;
  599. if (!element.hasAttribute(attribute)) {
  600. return;
  601. }
  602. return element.getAttribute(attribute);
  603. }
  604. module.exports = Clipboard;
  605. });
  606. },{"./clipboard-action":8,"good-listener":4,"tiny-emitter":7}]},{},[9])(9)
  607. });