jquery-asGradient.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
  1. /**
  2. * jQuery asGradient v0.3.3
  3. * https://github.com/amazingSurge/jquery-asGradient
  4. *
  5. * Copyright (c) amazingSurge
  6. * Released under the LGPL-3.0 license
  7. */
  8. (function(global, factory) {
  9. if (typeof define === 'function' && define.amd) {
  10. define('AsGradient', ['exports', 'jquery', 'jquery-asColor'], factory);
  11. } else if (typeof exports !== 'undefined') {
  12. factory(exports, require('jquery'), require('jquery-asColor'));
  13. } else {
  14. var mod = {
  15. exports: {}
  16. };
  17. factory(mod.exports, global.jQuery, global.AsColor);
  18. global.AsGradient = mod.exports;
  19. }
  20. })(this, function(exports, _jquery, _jqueryAsColor) {
  21. 'use strict';
  22. Object.defineProperty(exports, '__esModule', {
  23. value: true
  24. });
  25. var _jquery2 = _interopRequireDefault(_jquery);
  26. var _jqueryAsColor2 = _interopRequireDefault(_jqueryAsColor);
  27. function _interopRequireDefault(obj) {
  28. return obj && obj.__esModule
  29. ? obj
  30. : {
  31. default: obj
  32. };
  33. }
  34. var _typeof =
  35. typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol'
  36. ? function(obj) {
  37. return typeof obj;
  38. }
  39. : function(obj) {
  40. return obj &&
  41. typeof Symbol === 'function' &&
  42. obj.constructor === Symbol &&
  43. obj !== Symbol.prototype
  44. ? 'symbol'
  45. : typeof obj;
  46. };
  47. function _classCallCheck(instance, Constructor) {
  48. if (!(instance instanceof Constructor)) {
  49. throw new TypeError('Cannot call a class as a function');
  50. }
  51. }
  52. var _createClass = (function() {
  53. function defineProperties(target, props) {
  54. for (var i = 0; i < props.length; i++) {
  55. var descriptor = props[i];
  56. descriptor.enumerable = descriptor.enumerable || false;
  57. descriptor.configurable = true;
  58. if ('value' in descriptor) descriptor.writable = true;
  59. Object.defineProperty(target, descriptor.key, descriptor);
  60. }
  61. }
  62. return function(Constructor, protoProps, staticProps) {
  63. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  64. if (staticProps) defineProperties(Constructor, staticProps);
  65. return Constructor;
  66. };
  67. })();
  68. var DEFAULTS = {
  69. prefixes: ['-webkit-', '-moz-', '-ms-', '-o-'],
  70. forceStandard: true,
  71. angleUseKeyword: true,
  72. emptyString: '',
  73. degradationFormat: false,
  74. cleanPosition: true,
  75. color: {
  76. format: false, // rgb, rgba, hsl, hsla, hex
  77. hexUseName: false,
  78. reduceAlpha: true,
  79. shortenHex: true,
  80. zeroAlphaAsTransparent: false,
  81. invalidValue: {
  82. r: 0,
  83. g: 0,
  84. b: 0,
  85. a: 1
  86. }
  87. }
  88. };
  89. /* eslint no-extend-native: "off" */
  90. if (!String.prototype.includes) {
  91. String.prototype.includes = function(search, start) {
  92. 'use strict';
  93. if (typeof start !== 'number') {
  94. start = 0;
  95. }
  96. if (start + search.length > this.length) {
  97. return false;
  98. }
  99. return this.indexOf(search, start) !== -1;
  100. };
  101. }
  102. function getPrefix() {
  103. var ua = window.navigator.userAgent;
  104. var prefix = '';
  105. if (/MSIE/g.test(ua)) {
  106. prefix = '-ms-';
  107. } else if (/Firefox/g.test(ua)) {
  108. prefix = '-moz-';
  109. } else if (/(WebKit)/i.test(ua)) {
  110. prefix = '-webkit-';
  111. } else if (/Opera/g.test(ua)) {
  112. prefix = '-o-';
  113. }
  114. return prefix;
  115. }
  116. function flip(o) {
  117. var flipped = {};
  118. for (var i in o) {
  119. if (o.hasOwnProperty(i)) {
  120. flipped[o[i]] = i;
  121. }
  122. }
  123. return flipped;
  124. }
  125. function reverseDirection(direction) {
  126. var mapping = {
  127. top: 'bottom',
  128. right: 'left',
  129. bottom: 'top',
  130. left: 'right',
  131. 'right top': 'left bottom',
  132. 'top right': 'bottom left',
  133. 'bottom right': 'top left',
  134. 'right bottom': 'left top',
  135. 'left bottom': 'right top',
  136. 'bottom left': 'top right',
  137. 'top left': 'bottom right',
  138. 'left top': 'right bottom'
  139. };
  140. return mapping.hasOwnProperty(direction) ? mapping[direction] : direction;
  141. }
  142. function isDirection(n) {
  143. var reg = /^(top|left|right|bottom)$/i;
  144. return reg.test(n);
  145. }
  146. var keywordAngleMap = {
  147. 'to top': 0,
  148. 'to right': 90,
  149. 'to bottom': 180,
  150. 'to left': 270,
  151. 'to right top': 45,
  152. 'to top right': 45,
  153. 'to bottom right': 135,
  154. 'to right bottom': 135,
  155. 'to left bottom': 225,
  156. 'to bottom left': 225,
  157. 'to top left': 315,
  158. 'to left top': 315
  159. };
  160. var angleKeywordMap = flip(keywordAngleMap);
  161. var RegExpStrings = (function() {
  162. var color = /(?:rgba|rgb|hsla|hsl)\s*\([\s\d\.,%]+\)|#[a-z0-9]{3,6}|[a-z]+/i;
  163. var position = /\d{1,3}%/i;
  164. var angle = /(?:to ){0,1}(?:(?:top|left|right|bottom)\s*){1,2}|\d+deg/i;
  165. var stop = new RegExp(
  166. '(' + color.source + ')\\s*(' + position.source + '){0,1}',
  167. 'i'
  168. );
  169. var stops = new RegExp(stop.source, 'gi');
  170. var parameters = new RegExp(
  171. '(?:(' + angle.source + ')){0,1}\\s*,{0,1}\\s*(.*?)\\s*',
  172. 'i'
  173. );
  174. var full = new RegExp(
  175. '^(-webkit-|-moz-|-ms-|-o-){0,1}(linear|radial|repeating-linear)-gradient\\s*\\(\\s*(' +
  176. parameters.source +
  177. ')\\s*\\)$',
  178. 'i'
  179. );
  180. return {
  181. FULL: full,
  182. ANGLE: angle,
  183. COLOR: color,
  184. POSITION: position,
  185. STOP: stop,
  186. STOPS: stops,
  187. PARAMETERS: new RegExp('^' + parameters.source + '$', 'i')
  188. };
  189. })();
  190. var GradientString = {
  191. matchString: function matchString(string) {
  192. var matched = this.parseString(string);
  193. if (
  194. matched &&
  195. matched.value &&
  196. matched.value.stops &&
  197. matched.value.stops.length > 1
  198. ) {
  199. return true;
  200. }
  201. return false;
  202. },
  203. parseString: function parseString(string) {
  204. string = _jquery2.default.trim(string);
  205. var matched = void 0;
  206. if ((matched = RegExpStrings.FULL.exec(string)) !== null) {
  207. var value = this.parseParameters(matched[3]);
  208. return {
  209. prefix: typeof matched[1] === 'undefined' ? null : matched[1],
  210. type: matched[2],
  211. value: value
  212. };
  213. } else {
  214. return false;
  215. }
  216. },
  217. parseParameters: function parseParameters(string) {
  218. var matched = void 0;
  219. if ((matched = RegExpStrings.PARAMETERS.exec(string)) !== null) {
  220. var stops = this.parseStops(matched[2]);
  221. return {
  222. angle: typeof matched[1] === 'undefined' ? 0 : matched[1],
  223. stops: stops
  224. };
  225. } else {
  226. return false;
  227. }
  228. },
  229. parseStops: function parseStops(string) {
  230. var _this = this;
  231. var matched = void 0;
  232. var result = [];
  233. if ((matched = string.match(RegExpStrings.STOPS)) !== null) {
  234. _jquery2.default.each(matched, function(i, item) {
  235. var stop = _this.parseStop(item);
  236. if (stop) {
  237. result.push(stop);
  238. }
  239. });
  240. return result;
  241. } else {
  242. return false;
  243. }
  244. },
  245. formatStops: function formatStops(stops, cleanPosition) {
  246. var stop = void 0;
  247. var output = [];
  248. var positions = [];
  249. var colors = [];
  250. var position = void 0;
  251. for (var i = 0; i < stops.length; i++) {
  252. stop = stops[i];
  253. if (typeof stop.position === 'undefined' || stop.position === null) {
  254. if (i === 0) {
  255. position = 0;
  256. } else if (i === stops.length - 1) {
  257. position = 1;
  258. } else {
  259. position = undefined;
  260. }
  261. } else {
  262. position = stop.position;
  263. }
  264. positions.push(position);
  265. colors.push(stop.color.toString());
  266. }
  267. positions = (function(data) {
  268. var start = null;
  269. var average = void 0;
  270. for (var _i = 0; _i < data.length; _i++) {
  271. if (isNaN(data[_i])) {
  272. if (start === null) {
  273. start = _i;
  274. continue;
  275. }
  276. } else if (start) {
  277. average = (data[_i] - data[start - 1]) / (_i - start + 1);
  278. for (var j = start; j < _i; j++) {
  279. data[j] = data[start - 1] + (j - start + 1) * average;
  280. }
  281. start = null;
  282. }
  283. }
  284. return data;
  285. })(positions);
  286. for (var x = 0; x < stops.length; x++) {
  287. if (
  288. cleanPosition &&
  289. ((x === 0 && positions[x] === 0) ||
  290. (x === stops.length - 1 && positions[x] === 1))
  291. ) {
  292. position = '';
  293. } else {
  294. position = ' ' + this.formatPosition(positions[x]);
  295. }
  296. output.push(colors[x] + position);
  297. }
  298. return output.join(', ');
  299. },
  300. parseStop: function parseStop(string) {
  301. var matched = void 0;
  302. if ((matched = RegExpStrings.STOP.exec(string)) !== null) {
  303. var position = this.parsePosition(matched[2]);
  304. return {
  305. color: matched[1],
  306. position: position
  307. };
  308. } else {
  309. return false;
  310. }
  311. },
  312. parsePosition: function parsePosition(string) {
  313. if (typeof string === 'string' && string.substr(-1) === '%') {
  314. string = parseFloat(string.slice(0, -1) / 100);
  315. }
  316. if (typeof string !== 'undefined' && string !== null) {
  317. return parseFloat(string, 10);
  318. } else {
  319. return null;
  320. }
  321. },
  322. formatPosition: function formatPosition(value) {
  323. return parseInt(value * 100, 10) + '%';
  324. },
  325. parseAngle: function parseAngle(string, notStandard) {
  326. if (typeof string === 'string' && string.includes('deg')) {
  327. string = string.replace('deg', '');
  328. }
  329. if (!isNaN(string)) {
  330. if (notStandard) {
  331. string = this.fixOldAngle(string);
  332. }
  333. }
  334. if (typeof string === 'string') {
  335. var directions = string.split(' ');
  336. var filtered = [];
  337. for (var i in directions) {
  338. if (isDirection(directions[i])) {
  339. filtered.push(directions[i].toLowerCase());
  340. }
  341. }
  342. var keyword = filtered.join(' ');
  343. if (!string.includes('to ')) {
  344. keyword = reverseDirection(keyword);
  345. }
  346. keyword = 'to ' + keyword;
  347. if (keywordAngleMap.hasOwnProperty(keyword)) {
  348. string = keywordAngleMap[keyword];
  349. }
  350. }
  351. var value = parseFloat(string, 10);
  352. if (value > 360) {
  353. value %= 360;
  354. } else if (value < 0) {
  355. value %= -360;
  356. if (value !== 0) {
  357. value += 360;
  358. }
  359. }
  360. return value;
  361. },
  362. fixOldAngle: function fixOldAngle(value) {
  363. value = parseFloat(value);
  364. value = Math.abs(450 - value) % 360;
  365. value = parseFloat(value.toFixed(3));
  366. return value;
  367. },
  368. formatAngle: function formatAngle(value, notStandard, useKeyword) {
  369. value = parseInt(value, 10);
  370. if (useKeyword && angleKeywordMap.hasOwnProperty(value)) {
  371. value = angleKeywordMap[value];
  372. if (notStandard) {
  373. value = reverseDirection(value.substr(3));
  374. }
  375. } else {
  376. if (notStandard) {
  377. value = this.fixOldAngle(value);
  378. }
  379. value = value + 'deg';
  380. }
  381. return value;
  382. }
  383. };
  384. var ColorStop = (function() {
  385. function ColorStop(color, position, gradient) {
  386. _classCallCheck(this, ColorStop);
  387. this.color = (0, _jqueryAsColor2.default)(color, gradient.options.color);
  388. this.position = GradientString.parsePosition(position);
  389. this.id = ++gradient._stopIdCount;
  390. this.gradient = gradient;
  391. }
  392. _createClass(ColorStop, [
  393. {
  394. key: 'setPosition',
  395. value: function setPosition(string) {
  396. var position = GradientString.parsePosition(string);
  397. if (this.position !== position) {
  398. this.position = position;
  399. this.gradient.reorder();
  400. }
  401. }
  402. },
  403. {
  404. key: 'setColor',
  405. value: function setColor(string) {
  406. this.color.fromString(string);
  407. }
  408. },
  409. {
  410. key: 'remove',
  411. value: function remove() {
  412. this.gradient.removeById(this.id);
  413. }
  414. }
  415. ]);
  416. return ColorStop;
  417. })();
  418. var GradientTypes = {
  419. LINEAR: {
  420. parse: function parse(result) {
  421. return {
  422. r:
  423. result[1].substr(-1) === '%'
  424. ? parseInt(result[1].slice(0, -1) * 2.55, 10)
  425. : parseInt(result[1], 10),
  426. g:
  427. result[2].substr(-1) === '%'
  428. ? parseInt(result[2].slice(0, -1) * 2.55, 10)
  429. : parseInt(result[2], 10),
  430. b:
  431. result[3].substr(-1) === '%'
  432. ? parseInt(result[3].slice(0, -1) * 2.55, 10)
  433. : parseInt(result[3], 10),
  434. a: 1
  435. };
  436. },
  437. to: function to(gradient, instance, prefix) {
  438. if (gradient.stops.length === 0) {
  439. return instance.options.emptyString;
  440. }
  441. if (gradient.stops.length === 1) {
  442. return gradient.stops[0].color.to(instance.options.degradationFormat);
  443. }
  444. var standard = instance.options.forceStandard;
  445. var _prefix = instance._prefix;
  446. if (!_prefix) {
  447. standard = true;
  448. }
  449. if (
  450. prefix &&
  451. -1 !== _jquery2.default.inArray(prefix, instance.options.prefixes)
  452. ) {
  453. standard = false;
  454. _prefix = prefix;
  455. }
  456. var angle = GradientString.formatAngle(
  457. gradient.angle,
  458. !standard,
  459. instance.options.angleUseKeyword
  460. );
  461. var stops = GradientString.formatStops(
  462. gradient.stops,
  463. instance.options.cleanPosition
  464. );
  465. var output = 'linear-gradient(' + angle + ', ' + stops + ')';
  466. if (standard) {
  467. return output;
  468. } else {
  469. return _prefix + output;
  470. }
  471. }
  472. }
  473. };
  474. var AsGradient = (function() {
  475. function AsGradient(string, options) {
  476. _classCallCheck(this, AsGradient);
  477. if (
  478. (typeof string === 'undefined' ? 'undefined' : _typeof(string)) ===
  479. 'object' &&
  480. typeof options === 'undefined'
  481. ) {
  482. options = string;
  483. string = undefined;
  484. }
  485. this.value = {
  486. angle: 0,
  487. stops: []
  488. };
  489. this.options = _jquery2.default.extend(true, {}, DEFAULTS, options);
  490. this._type = 'LINEAR';
  491. this._prefix = null;
  492. this.length = this.value.stops.length;
  493. this.current = 0;
  494. this._stopIdCount = 0;
  495. this.init(string);
  496. }
  497. _createClass(
  498. AsGradient,
  499. [
  500. {
  501. key: 'init',
  502. value: function init(string) {
  503. if (string) {
  504. this.fromString(string);
  505. }
  506. }
  507. },
  508. {
  509. key: 'val',
  510. value: function val(value) {
  511. if (typeof value === 'undefined') {
  512. return this.toString();
  513. } else {
  514. this.fromString(value);
  515. return this;
  516. }
  517. }
  518. },
  519. {
  520. key: 'angle',
  521. value: function angle(value) {
  522. if (typeof value === 'undefined') {
  523. return this.value.angle;
  524. } else {
  525. this.value.angle = GradientString.parseAngle(value);
  526. return this;
  527. }
  528. }
  529. },
  530. {
  531. key: 'append',
  532. value: function append(color, position) {
  533. return this.insert(color, position, this.length);
  534. }
  535. },
  536. {
  537. key: 'reorder',
  538. value: function reorder() {
  539. if (this.length < 2) {
  540. return;
  541. }
  542. this.value.stops = this.value.stops.sort(function(a, b) {
  543. return a.position - b.position;
  544. });
  545. }
  546. },
  547. {
  548. key: 'insert',
  549. value: function insert(color, position, index) {
  550. if (typeof index === 'undefined') {
  551. index = this.current;
  552. }
  553. var stop = new ColorStop(color, position, this);
  554. this.value.stops.splice(index, 0, stop);
  555. this.length = this.length + 1;
  556. this.current = index;
  557. return stop;
  558. }
  559. },
  560. {
  561. key: 'getById',
  562. value: function getById(id) {
  563. if (this.length > 0) {
  564. for (var i in this.value.stops) {
  565. if (id === this.value.stops[i].id) {
  566. return this.value.stops[i];
  567. }
  568. }
  569. }
  570. return false;
  571. }
  572. },
  573. {
  574. key: 'removeById',
  575. value: function removeById(id) {
  576. var index = this.getIndexById(id);
  577. if (index) {
  578. this.remove(index);
  579. }
  580. }
  581. },
  582. {
  583. key: 'getIndexById',
  584. value: function getIndexById(id) {
  585. var index = 0;
  586. for (var i in this.value.stops) {
  587. if (id === this.value.stops[i].id) {
  588. return index;
  589. }
  590. index++;
  591. }
  592. return false;
  593. }
  594. },
  595. {
  596. key: 'getCurrent',
  597. value: function getCurrent() {
  598. return this.value.stops[this.current];
  599. }
  600. },
  601. {
  602. key: 'setCurrentById',
  603. value: function setCurrentById(id) {
  604. var index = 0;
  605. for (var i in this.value.stops) {
  606. if (this.value.stops[i].id !== id) {
  607. index++;
  608. } else {
  609. this.current = index;
  610. }
  611. }
  612. }
  613. },
  614. {
  615. key: 'get',
  616. value: function get(index) {
  617. if (typeof index === 'undefined') {
  618. index = this.current;
  619. }
  620. if (index >= 0 && index < this.length) {
  621. this.current = index;
  622. return this.value.stops[index];
  623. } else {
  624. return false;
  625. }
  626. }
  627. },
  628. {
  629. key: 'remove',
  630. value: function remove(index) {
  631. if (typeof index === 'undefined') {
  632. index = this.current;
  633. }
  634. if (index >= 0 && index < this.length) {
  635. this.value.stops.splice(index, 1);
  636. this.length = this.length - 1;
  637. this.current = index - 1;
  638. }
  639. }
  640. },
  641. {
  642. key: 'empty',
  643. value: function empty() {
  644. this.value.stops = [];
  645. this.length = 0;
  646. this.current = 0;
  647. }
  648. },
  649. {
  650. key: 'reset',
  651. value: function reset() {
  652. this.value._angle = 0;
  653. this.empty();
  654. this._prefix = null;
  655. this._type = 'LINEAR';
  656. }
  657. },
  658. {
  659. key: 'type',
  660. value: function type(_type) {
  661. if (
  662. typeof _type === 'string' &&
  663. (_type = _type.toUpperCase()) &&
  664. typeof GradientTypes[_type] !== 'undefined'
  665. ) {
  666. this._type = _type;
  667. return this;
  668. } else {
  669. return this._type;
  670. }
  671. }
  672. },
  673. {
  674. key: 'fromString',
  675. value: function fromString(string) {
  676. var _this2 = this;
  677. this.reset();
  678. var result = GradientString.parseString(string);
  679. if (result) {
  680. this._prefix = result.prefix;
  681. this.type(result.type);
  682. if (result.value) {
  683. this.value.angle = GradientString.parseAngle(
  684. result.value.angle,
  685. this._prefix !== null
  686. );
  687. _jquery2.default.each(result.value.stops, function(i, stop) {
  688. _this2.append(stop.color, stop.position);
  689. });
  690. }
  691. }
  692. }
  693. },
  694. {
  695. key: 'toString',
  696. value: function toString(prefix) {
  697. if (prefix === true) {
  698. prefix = getPrefix();
  699. }
  700. return GradientTypes[this.type()].to(this.value, this, prefix);
  701. }
  702. },
  703. {
  704. key: 'matchString',
  705. value: function matchString(string) {
  706. return GradientString.matchString(string);
  707. }
  708. },
  709. {
  710. key: 'toStringWithAngle',
  711. value: function toStringWithAngle(angle, prefix) {
  712. var value = _jquery2.default.extend(true, {}, this.value);
  713. value.angle = GradientString.parseAngle(angle);
  714. if (prefix === true) {
  715. prefix = getPrefix();
  716. }
  717. return GradientTypes[this.type()].to(value, this, prefix);
  718. }
  719. },
  720. {
  721. key: 'getPrefixedStrings',
  722. value: function getPrefixedStrings() {
  723. var strings = [];
  724. for (var i in this.options.prefixes) {
  725. if (Object.hasOwnProperty.call(this.options.prefixes, i)) {
  726. strings.push(this.toString(this.options.prefixes[i]));
  727. }
  728. }
  729. return strings;
  730. }
  731. }
  732. ],
  733. [
  734. {
  735. key: 'setDefaults',
  736. value: function setDefaults(options) {
  737. _jquery2.default.extend(
  738. true,
  739. DEFAULTS,
  740. _jquery2.default.isPlainObject(options) && options
  741. );
  742. }
  743. }
  744. ]
  745. );
  746. return AsGradient;
  747. })();
  748. var info = {
  749. version: '0.3.3'
  750. };
  751. var OtherAsGradient = _jquery2.default.asGradient;
  752. var jQueryAsGradient = function jQueryAsGradient() {
  753. for (
  754. var _len = arguments.length, args = Array(_len), _key = 0;
  755. _key < _len;
  756. _key++
  757. ) {
  758. args[_key] = arguments[_key];
  759. }
  760. return new (Function.prototype.bind.apply(
  761. AsGradient,
  762. [null].concat(args)
  763. ))();
  764. };
  765. _jquery2.default.asGradient = jQueryAsGradient;
  766. _jquery2.default.asGradient.Constructor = AsGradient;
  767. _jquery2.default.extend(
  768. _jquery2.default.asGradient,
  769. {
  770. setDefaults: AsGradient.setDefaults,
  771. noConflict: function noConflict() {
  772. _jquery2.default.asGradient = OtherAsGradient;
  773. return jQueryAsGradient;
  774. }
  775. },
  776. GradientString,
  777. info
  778. );
  779. var main = _jquery2.default.asGradient;
  780. exports.default = main;
  781. });