Block somebody

在贴吧屏蔽某人,眼不见心不烦

目前为 2016-05-10 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Block somebody
  3. // @author burningall
  4. // @description 在贴吧屏蔽某人,眼不见心不烦
  5. // @version 2016.05.11
  6. // @include *tieba.baidu.com/p/*
  7. // @include *tieba.baidu.com/*
  8. // @include *tieba.baidu.com/f?*
  9. // @grant GM_addStyle
  10. // @grant GM_getValue
  11. // @grant GM_setValue
  12. // @grant GM_listValues
  13. // @grant GM_deleteValue
  14. // @grant GM_registerMenuCommand
  15. // @run-at document-start
  16. // @compatible chrome 两个字,破费
  17. // @compatible firefox 两个字,破费
  18. // @license The MIT License (MIT); http://opensource.org/licenses/MIT
  19. // @supportURL http://www.burningall.com
  20. // @contributionURL troy450409405@gmail.com|alipay.com
  21. // @namespace https://greasyfork.org/zh-CN/users/3400-axetroy
  22. // ==/UserScript==
  23. /******/ (function(modules) { // webpackBootstrap
  24. /******/ // The module cache
  25. /******/ var installedModules = {};
  26.  
  27. /******/ // The require function
  28. /******/ function __webpack_require__(moduleId) {
  29.  
  30. /******/ // Check if module is in cache
  31. /******/ if(installedModules[moduleId])
  32. /******/ return installedModules[moduleId].exports;
  33.  
  34. /******/ // Create a new module (and put it into the cache)
  35. /******/ var module = installedModules[moduleId] = {
  36. /******/ exports: {},
  37. /******/ id: moduleId,
  38. /******/ loaded: false
  39. /******/ };
  40.  
  41. /******/ // Execute the module function
  42. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  43.  
  44. /******/ // Flag the module as loaded
  45. /******/ module.loaded = true;
  46.  
  47. /******/ // Return the exports of the module
  48. /******/ return module.exports;
  49. /******/ }
  50.  
  51.  
  52. /******/ // expose the modules object (__webpack_modules__)
  53. /******/ __webpack_require__.m = modules;
  54.  
  55. /******/ // expose the module cache
  56. /******/ __webpack_require__.c = installedModules;
  57.  
  58. /******/ // __webpack_public_path__
  59. /******/ __webpack_require__.p = "";
  60.  
  61. /******/ // Load entry module and return exports
  62. /******/ return __webpack_require__(0);
  63. /******/ })
  64. /************************************************************************/
  65. /******/ ([
  66. /* 0 */
  67. /***/ function(module, exports, __webpack_require__) {
  68.  
  69. module.exports = __webpack_require__(1);
  70.  
  71.  
  72. /***/ },
  73. /* 1 */
  74. /***/ function(module, exports, __webpack_require__) {
  75.  
  76. 'use strict';
  77.  
  78. var _jqLite = __webpack_require__(2);
  79.  
  80. var _jqLite2 = _interopRequireDefault(_jqLite);
  81.  
  82. var _icon = __webpack_require__(48);
  83.  
  84. var _icon2 = _interopRequireDefault(_icon);
  85.  
  86. var _panel = __webpack_require__(49);
  87.  
  88. var _panel2 = _interopRequireDefault(_panel);
  89.  
  90. var _common = __webpack_require__(51);
  91.  
  92. var _common2 = _interopRequireDefault(_common);
  93.  
  94. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  95.  
  96. var panel = new _panel2.default();
  97. var POSITION = _common2.default.getPosition();
  98.  
  99. var initCount = 0;
  100. var $icon = (0, _jqLite2.default)(document.createElement("a")).addClass('block-icon').html(_icon2.default);
  101. var init = function init() {
  102. if (POSITION === 'post') {
  103. initCount++;
  104. (0, _jqLite2.default)('.p_postlist .l_post').each(function (post) {
  105. var $name = (0, _jqLite2.default)(post).find('.d_author ul.p_author li.d_name');
  106. if (!$name[0]) return;
  107.  
  108. var id = $name.find('a[data-field].p_author_name').text().trim();
  109.  
  110. if (!id) return;
  111.  
  112. var icon = $icon[0].cloneNode(true);
  113.  
  114. if (GM_listValues().indexOf(id) > -1) return post.remove();
  115.  
  116. if ($name.find('svg').length) return;
  117.  
  118. (0, _jqLite2.default)(icon).click(function () {
  119. var bar = _common2.default.getBarName();
  120.  
  121. var reason = '在帖子中选择';
  122.  
  123.  
  124. GM_setValue(id, { id: id, bar: bar, reason: reason, date: new Date() });
  125. (0, _jqLite2.default)('.p_postlist .l_post').each(function (ele) {
  126. var username = (0, _jqLite2.default)(ele).attr('data-field').replace(/\'/g, '"');
  127. if (!username) return;
  128. username = JSON.parse(username).author.user_name || JSON.parse(username).author.name_u;
  129. username = username.replace(/\&ie\=.*$/ig, '');
  130. username = decodeURI(username);
  131. if (username === id) ele.remove();
  132. });
  133. });
  134.  
  135. $name[0].appendChild(icon);
  136. });
  137. } else if (POSITION === 'list') {
  138. (function () {
  139. var interval = setInterval(function () {
  140. var postList = (0, _jqLite2.default)('ul#thread_list li[data-field].j_thread_list');
  141. if (!postList.length) return;
  142.  
  143. clearInterval(interval);
  144. initCount++;
  145. postList.each(function (post) {
  146. var $name = (0, _jqLite2.default)(post).find('.j_threadlist_li_right .tb_icon_author');
  147. if (!$name[0]) return;
  148.  
  149. var id = $name.find('a[data-field].frs-author-name').text().trim();
  150. var icon = $icon[0].cloneNode(true);
  151.  
  152. if (GM_listValues().indexOf(id) > -1) return post.remove();
  153.  
  154. (0, _jqLite2.default)(icon).click(function () {
  155. var bar = _common2.default.getBarName();
  156.  
  157. var reason = '贴吧首页选择';
  158.  
  159. if (!id) return;
  160. GM_setValue(id, { id: id, bar: bar, reason: reason, date: new Date() });
  161.  
  162. (0, _jqLite2.default)('ul#thread_list li[data-field].j_thread_list').each(function (_post) {
  163. var username = (0, _jqLite2.default)(_post).find('a[data-field].frs-author-name').text().trim();
  164. if (!username) return;
  165. if (username === id) _post.remove();
  166. });
  167. });
  168.  
  169. $name[0].appendChild(icon);
  170. });
  171. }, 100);
  172. })();
  173. }
  174. };
  175.  
  176. (0, _jqLite2.default)(function () {
  177.  
  178. GM_registerMenuCommand("控制面板", panel.create);
  179. GM_addStyle(__webpack_require__(53));
  180.  
  181. (0, _jqLite2.default)(document).bind('keyup', function (e) {
  182. if (e.keyCode === 120) panel.create();
  183. });
  184.  
  185. init();
  186.  
  187. (0, _jqLite2.default)(document).observe(function (target) {
  188. var addedNodes = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1];
  189. var removedNodes = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2];
  190.  
  191.  
  192. addedNodes = Array.from(addedNodes);
  193.  
  194. // if (!addedNodes || !addedNodes.length || removedNodes.length) return;
  195.  
  196. addedNodes.forEach(function (node) {
  197. // 翻页
  198. if (node.id === 'content_leftList' || node.id === 'j_p_postlist') {
  199. initCount > 0 && init();
  200. }
  201. });
  202.  
  203. // 楼中楼翻页
  204. if (target && (0, _jqLite2.default)(target).hasClass('j_lzl_m_w')) {
  205. (function () {
  206.  
  207. var $lzlList = (0, _jqLite2.default)(target).find('li.lzl_single_post');
  208.  
  209. $lzlList.each(function (lzl) {
  210. var $lzl = (0, _jqLite2.default)(lzl);
  211. if ($lzl.attr('filter')) return;
  212.  
  213. $lzl.attr('filter', true);
  214. var id = JSON.parse($lzl.attr('data-field').replace(/\'/g, '"')).user_name;
  215. id = decodeURI(id);
  216.  
  217. if (!id) return;
  218.  
  219. if (GM_listValues().indexOf(id) > -1) return lzl.remove();
  220.  
  221. var $name = $lzl.find('.lzl_cnt');
  222.  
  223. if ($name.find('svg').length) return;
  224.  
  225. var icon = $icon[0].cloneNode(true);
  226.  
  227. (0, _jqLite2.default)(icon).click(function (e) {
  228. var bar = _common2.default.getBarName();
  229.  
  230. var reason = '楼中楼选择';
  231.  
  232.  
  233. GM_setValue(id, { id: id, bar: bar, reason: reason, date: new Date() });
  234.  
  235. $lzlList.each(function (_lzl) {
  236. var username = (0, _jqLite2.default)(_lzl).find('div.lzl_cnt a.j_user_card').text().trim();
  237. if (!username) return;
  238. if (username === id) _lzl.remove();
  239. });
  240. });
  241. $lzl.find('.lzl_content_reply')[0].appendChild(icon);
  242. // $name[0].insertBefore(icon, $name[0].childNodes[0]);
  243. });
  244. })();
  245. }
  246.  
  247. //
  248. var $lzlList = (0, _jqLite2.default)('ul.j_lzl_m_w');
  249. if (!$lzlList.length) return;
  250.  
  251. $lzlList.each(function (lzls) {
  252. if ((0, _jqLite2.default)(lzls).attr('filter')) return;
  253.  
  254. (0, _jqLite2.default)(lzls).attr('filter', true);
  255.  
  256. (0, _jqLite2.default)(lzls).find('li.lzl_single_post').each(function (lzl) {
  257. var $lzl = (0, _jqLite2.default)(lzl);
  258. var $name = $lzl.find('.lzl_cnt');
  259.  
  260. if ($name.find('svg').length) return;
  261.  
  262. var icon = $icon[0].cloneNode(true);
  263.  
  264. var id = JSON.parse($lzl.attr('data-field').replace(/\'/g, '"')).user_name;
  265.  
  266. if (GM_listValues().indexOf(id) > -1) return lzl.remove();
  267.  
  268. if (!id) return;
  269.  
  270. (0, _jqLite2.default)(icon).click(function (e) {
  271. var bar = _common2.default.getBarName();
  272.  
  273. var reason = '楼中楼选择';
  274.  
  275. GM_setValue(id, { id: id, bar: bar, reason: reason, date: new Date() });
  276. // 删除当前楼中楼的
  277. $lzlList.each(function (_lzl) {
  278. var $floor = (0, _jqLite2.default)(_lzl).find('div.lzl_cnt');
  279. $floor.each(function (_post) {
  280. var username = (0, _jqLite2.default)(_post).find('a.j_user_card').text().trim();
  281. if (!username) return;
  282. if (username === id) _post.parentElement.remove();
  283. });
  284. });
  285. // 删除帖子里面楼层的
  286. init();
  287. });
  288. // $name[0].insertBefore(icon, $name[0].childNodes[0]);
  289. // $name[0].insertBefore(icon, $lzl.find('.lzl_content_reply'));
  290. // $lzl.find('.lzl_content_reply')[0].insertBefore(icon, $lzl.find('.lzl_content_reply')[0].childNodes[1])
  291. $lzl.find('.lzl_content_reply')[0].appendChild(icon);
  292. });
  293. });
  294. });
  295. });
  296.  
  297. /***/ },
  298. /* 2 */
  299. /***/ function(module, exports, __webpack_require__) {
  300.  
  301. 'use strict';
  302.  
  303. // es6 Array.from
  304.  
  305. Object.defineProperty(exports, "__esModule", {
  306. value: true
  307. });
  308.  
  309. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
  310.  
  311. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  312. // es6 Object.assign
  313.  
  314.  
  315. __webpack_require__(3);
  316.  
  317. __webpack_require__(36);
  318.  
  319. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  320.  
  321. var noop = function noop(x) {
  322. return x;
  323. };
  324.  
  325. var jqLite = function () {
  326. function jqLite() {
  327. var _this = this;
  328.  
  329. var selectors = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
  330. var context = arguments.length <= 1 || arguments[1] === undefined ? document : arguments[1];
  331.  
  332. _classCallCheck(this, jqLite);
  333.  
  334. this.selectors = selectors;
  335. this.context = context;
  336. this.length = 0;
  337.  
  338. switch (typeof selectors === 'undefined' ? 'undefined' : _typeof(selectors)) {
  339. case 'undefined':
  340. break;
  341. case 'string':
  342. Array.from(context.querySelectorAll(selectors), function (ele, i) {
  343. _this[i] = ele;
  344. _this.length++;
  345. }, this);
  346. break;
  347. case 'object':
  348. if (selectors.length) {
  349. Array.from(selectors, function (ele, i) {
  350. _this[i] = ele;
  351. _this.length++;
  352. }, this);
  353. } else {
  354. this[0] = selectors;
  355. this.length = 1;
  356. }
  357. break;
  358. case 'function':
  359. this.ready(selectors);
  360. break;
  361. default:
  362.  
  363. }
  364. }
  365.  
  366. _createClass(jqLite, [{
  367. key: 'eq',
  368. value: function eq() {
  369. var n = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0];
  370.  
  371. return new jqLite(this[n]);
  372. }
  373. }, {
  374. key: 'find',
  375. value: function find(selectors) {
  376. return new jqLite(selectors, this[0]);
  377. }
  378. }, {
  379. key: 'each',
  380. value: function each() {
  381. var fn = arguments.length <= 0 || arguments[0] === undefined ? noop : arguments[0];
  382.  
  383. for (var i = 0; i < this.length; i++) {
  384. fn.call(this, this[i], i);
  385. }
  386. return this;
  387. }
  388. }, {
  389. key: 'bind',
  390. value: function bind() {
  391. var types = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
  392. var fn = arguments.length <= 1 || arguments[1] === undefined ? noop : arguments[1];
  393.  
  394. this.each(function (ele) {
  395. types.trim().split(/\s{1,}/).forEach(function (type) {
  396. ele.addEventListener(type, function (e) {
  397. var target = e.target || e.srcElement;
  398. if (fn.call(target, e) === false) {
  399. e.returnValue = true;
  400. e.cancelBubble = true;
  401. e.preventDefault && e.preventDefault();
  402. e.stopPropagation && e.stopPropagation();
  403. return false;
  404. }
  405. }, false);
  406. });
  407. });
  408. }
  409. }, {
  410. key: 'click',
  411. value: function click() {
  412. var fn = arguments.length <= 0 || arguments[0] === undefined ? noop : arguments[0];
  413.  
  414. this.bind('click', fn);
  415. return this;
  416. }
  417. }, {
  418. key: 'ready',
  419. value: function ready() {
  420. var _this2 = this;
  421.  
  422. var fn = arguments.length <= 0 || arguments[0] === undefined ? noop : arguments[0];
  423.  
  424. window.addEventListener('DOMContentLoaded', function (e) {
  425. fn.call(_this2, e);
  426. }, false);
  427. }
  428. }, {
  429. key: 'observe',
  430. value: function observe() {
  431. var _this3 = this;
  432.  
  433. var fn = arguments.length <= 0 || arguments[0] === undefined ? noop : arguments[0];
  434. var config = arguments.length <= 1 || arguments[1] === undefined ? { childList: true, subtree: true } : arguments[1];
  435.  
  436. this.each(function (ele) {
  437. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
  438. var observer = new MutationObserver(function (mutations) {
  439. mutations.forEach(function (mutation) {
  440. fn.call(_this3, mutation.target, mutation.addedNodes, mutation.removedNodes);
  441. });
  442. });
  443. observer.observe(ele, config);
  444. });
  445. return this;
  446. }
  447. }, {
  448. key: 'attr',
  449. value: function (_attr) {
  450. function attr(_x, _x2) {
  451. return _attr.apply(this, arguments);
  452. }
  453.  
  454. attr.toString = function () {
  455. return _attr.toString();
  456. };
  457.  
  458. return attr;
  459. }(function (attr, value) {
  460. // one agm
  461. if (arguments.length === 1) {
  462. // get attr value
  463. if (typeof attr === 'string') {
  464. return this[0].getAttribute(attr);
  465. }
  466. // set attr with a json
  467. else if ((typeof attr === 'undefined' ? 'undefined' : _typeof(attr)) === 'object') {
  468. this.each(function (ele) {
  469. for (var at in attr) {
  470. if (attr.hasOwnProperty(at)) {
  471. ele.setAttribute(at, value);
  472. }
  473. }
  474. });
  475. return value;
  476. }
  477. }
  478. // set
  479. else if (arguments.length === 2) {
  480. this.each(function (ele) {
  481. ele.setAttribute(attr, value);
  482. });
  483. return this;
  484. } else {
  485. return this;
  486. }
  487. })
  488. }, {
  489. key: 'removeAttr',
  490. value: function removeAttr(attr) {
  491. if (arguments.length === 1) {
  492. this.each(function (ele) {
  493. ele.removeAttribute(attr);
  494. });
  495. }
  496. return this;
  497. }
  498. }, {
  499. key: 'remove',
  500. value: function remove() {
  501. this.each(function (ele) {
  502. ele.remove();
  503. });
  504. this.length = 0;
  505. return this;
  506. }
  507.  
  508. // get the element style
  509.  
  510. }, {
  511. key: 'style',
  512. value: function style(attr) {
  513. return this[0].currentStyle ? this[0].currentStyle[attr] : getComputedStyle(this[0])[attr];
  514. }
  515.  
  516. // (attr,value) || 'string' || {}
  517.  
  518. }, {
  519. key: 'css',
  520. value: function css() {
  521. for (var _len = arguments.length, agm = Array(_len), _key = 0; _key < _len; _key++) {
  522. agm[_key] = arguments[_key];
  523. }
  524.  
  525. if (agm.length === 1) {
  526. // get style
  527. if (typeof agm[0] === 'string') {
  528. // set style as a long text
  529. if (/:/ig.test(agm[0])) {
  530. this.each(function (ele) {
  531. ele.style.cssText = attr;
  532. });
  533. } else {
  534. return this[0].currentStyle ? this[0].currentStyle[agm[0]] : getComputedStyle(this[0])[agm[0]];
  535. }
  536. }
  537. // set style as a object
  538. else {
  539. this.each(function (ele) {
  540. for (var _attr2 in agm[0]) {
  541. if (agm[0].hasOwnProperty(_attr2)) {
  542. ele.style[_attr2] = agm[0][_attr2];
  543. }
  544. }
  545. });
  546. }
  547. }
  548. // set as (key,value)
  549. else if (agm.length === 2) {
  550. this.each(function (ele) {
  551. ele.style[agm[0]] = agm[1];
  552. });
  553. }
  554. return this;
  555. }
  556. }, {
  557. key: 'width',
  558. value: function width(value) {
  559. var element = this[0];
  560. // window or document
  561. if (element.window === element || element.body) {
  562. return document.body.scrollWidth > document.documentElement.scrollWidth ? document.body.scrollWidth : document.documentElement.scrollWidth;
  563. }
  564. // set width
  565. else if (value) {
  566. this.each(function (ele) {
  567. ele.style.width = value + 'px';
  568. });
  569. return this;
  570. }
  571. // get width
  572. else {
  573. return this[0].offsetWidth || parseFloat(this.style('width'));
  574. }
  575. }
  576. }, {
  577. key: 'height',
  578. value: function height(value) {
  579. var ele = this[0];
  580. // window or document
  581. if (ele.window === ele || ele.body) {
  582. return document.body.scrollHeight > document.documentElement.scrollHeight ? document.body.scrollHeight : document.documentElement.scrollHeight;
  583. }
  584. // set height
  585. else if (value) {
  586. this.each(function (ele) {
  587. ele.style.height = value + 'px';
  588. });
  589. return this;
  590. }
  591. // get height
  592. else {
  593. return this[0].offsetHeight || parseFloat(this.style('height'));
  594. }
  595. }
  596. }, {
  597. key: 'html',
  598. value: function html(value) {
  599. if (value !== undefined) {
  600. this.each(function (ele) {
  601. ele.innerHTML = typeof value === 'function' ? value(ele) : value;
  602. });
  603. } else {
  604. return this[0].innerHTML;
  605. }
  606. return this;
  607. }
  608. }, {
  609. key: 'text',
  610. value: function text(value) {
  611. if (value === undefined) return this[0].innerText || this[0].textContent;
  612.  
  613. this.each(function (ele) {
  614. ele.innerText = ele.textContent = value;
  615. });
  616. return this;
  617. }
  618. }, {
  619. key: 'val',
  620. value: function val(value) {
  621. if (value === undefined) return this[0].value;
  622. this.each(function (ele) {
  623. ele.value = value;
  624. });
  625. return this;
  626. }
  627. }, {
  628. key: 'show',
  629. value: function show() {
  630. this.each(function (ele) {
  631. ele.style.display = '';
  632. });
  633. return this;
  634. }
  635. }, {
  636. key: 'hide',
  637. value: function hide() {
  638. this.each(function (ele) {
  639. ele.style.display = 'none';
  640. });
  641. return this;
  642. }
  643.  
  644. // content str || jqLite Object || DOM
  645. // here is jqLite Object
  646.  
  647. }, {
  648. key: 'append',
  649. value: function append(content) {
  650. this.each(function (ele) {
  651. ele.appendChild(content[0]);
  652. });
  653. return this;
  654. }
  655. }, {
  656. key: 'prepend',
  657.  
  658.  
  659. // content str || jqLite Object || DOM
  660. // here is jqLite Object
  661. value: function prepend(content) {
  662. this.each(function (ele) {
  663. ele.insertBefore(content[0], ele.children[0]);
  664. });
  665. return this;
  666. }
  667. }, {
  668. key: 'hasClass',
  669. value: function hasClass(className) {
  670. if (!this[0]) return false;
  671. return this[0].classList.contains(className);
  672. }
  673. }, {
  674. key: 'addClass',
  675. value: function addClass(className) {
  676. this.each(function (ele) {
  677. ele.classList.add(className);
  678. });
  679. return this;
  680. }
  681. }, {
  682. key: 'removeClass',
  683. value: function removeClass(className) {
  684. this.each(function (ele) {
  685. ele.classList.remove(className);
  686. });
  687. return this;
  688. }
  689. }, {
  690. key: 'index',
  691. get: function get() {
  692. var index = 0;
  693. var brothers = this[0].parentNode.children;
  694. for (var i = 0; i < brothers.length; i++) {
  695. if (brothers[i] == this[0]) {
  696. index = i;
  697. break;
  698. }
  699. }
  700. return index;
  701. }
  702. }], [{
  703. key: 'fn',
  704. get: function get() {
  705. var visible = function visible(ele) {
  706. var pos = ele.getBoundingClientRect();
  707. var w = void 0;
  708. var h = void 0;
  709. var inViewPort = void 0;
  710. var docEle = document.documentElement;
  711. var docBody = document.body;
  712. if (docEle.getBoundingClientRect) {
  713. w = docEle.clientWidth || docBody.clientWidth;
  714. h = docEle.clientHeight || docBody.clientHeight;
  715. inViewPort = pos.top > h || pos.bottom < 0 || pos.left > w || pos.right < 0;
  716. return inViewPort ? false : true;
  717. }
  718. };
  719. var merge = function merge() {
  720. for (var _len2 = arguments.length, sources = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  721. sources[_key2] = arguments[_key2];
  722. }
  723.  
  724. return Object.assign.apply(Object, [{}].concat(sources));
  725. };
  726. return {
  727. visible: visible,
  728. merge: merge
  729. };
  730. }
  731. }]);
  732.  
  733. return jqLite;
  734. }();
  735.  
  736. var $ = function $() {
  737. var selectors = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
  738. var context = arguments.length <= 1 || arguments[1] === undefined ? document : arguments[1];
  739.  
  740. return new jqLite(selectors, context);
  741. };
  742. $.fn = jqLite.fn;
  743.  
  744. exports.default = $;
  745.  
  746. /***/ },
  747. /* 3 */
  748. /***/ function(module, exports, __webpack_require__) {
  749.  
  750. 'use strict';
  751. var ctx = __webpack_require__(4)
  752. , $export = __webpack_require__(6)
  753. , toObject = __webpack_require__(22)
  754. , call = __webpack_require__(24)
  755. , isArrayIter = __webpack_require__(25)
  756. , toLength = __webpack_require__(29)
  757. , createProperty = __webpack_require__(31)
  758. , getIterFn = __webpack_require__(32);
  759.  
  760. $export($export.S + $export.F * !__webpack_require__(35)(function(iter){ Array.from(iter); }), 'Array', {
  761. // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
  762. from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){
  763. var O = toObject(arrayLike)
  764. , C = typeof this == 'function' ? this : Array
  765. , aLen = arguments.length
  766. , mapfn = aLen > 1 ? arguments[1] : undefined
  767. , mapping = mapfn !== undefined
  768. , index = 0
  769. , iterFn = getIterFn(O)
  770. , length, result, step, iterator;
  771. if(mapping)mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
  772. // if object isn't iterable or it's array with default iterator - use simple case
  773. if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){
  774. for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){
  775. createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
  776. }
  777. } else {
  778. length = toLength(O.length);
  779. for(result = new C(length); length > index; index++){
  780. createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
  781. }
  782. }
  783. result.length = index;
  784. return result;
  785. }
  786. });
  787.  
  788.  
  789. /***/ },
  790. /* 4 */
  791. /***/ function(module, exports, __webpack_require__) {
  792.  
  793. // optional / simple context binding
  794. var aFunction = __webpack_require__(5);
  795. module.exports = function(fn, that, length){
  796. aFunction(fn);
  797. if(that === undefined)return fn;
  798. switch(length){
  799. case 1: return function(a){
  800. return fn.call(that, a);
  801. };
  802. case 2: return function(a, b){
  803. return fn.call(that, a, b);
  804. };
  805. case 3: return function(a, b, c){
  806. return fn.call(that, a, b, c);
  807. };
  808. }
  809. return function(/* ...args */){
  810. return fn.apply(that, arguments);
  811. };
  812. };
  813.  
  814. /***/ },
  815. /* 5 */
  816. /***/ function(module, exports) {
  817.  
  818. module.exports = function(it){
  819. if(typeof it != 'function')throw TypeError(it + ' is not a function!');
  820. return it;
  821. };
  822.  
  823. /***/ },
  824. /* 6 */
  825. /***/ function(module, exports, __webpack_require__) {
  826.  
  827. var global = __webpack_require__(7)
  828. , core = __webpack_require__(8)
  829. , hide = __webpack_require__(9)
  830. , redefine = __webpack_require__(19)
  831. , ctx = __webpack_require__(4)
  832. , PROTOTYPE = 'prototype';
  833.  
  834. var $export = function(type, name, source){
  835. var IS_FORCED = type & $export.F
  836. , IS_GLOBAL = type & $export.G
  837. , IS_STATIC = type & $export.S
  838. , IS_PROTO = type & $export.P
  839. , IS_BIND = type & $export.B
  840. , target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]
  841. , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
  842. , expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {})
  843. , key, own, out, exp;
  844. if(IS_GLOBAL)source = name;
  845. for(key in source){
  846. // contains in native
  847. own = !IS_FORCED && target && target[key] !== undefined;
  848. // export native or passed
  849. out = (own ? target : source)[key];
  850. // bind timers to global for call from export context
  851. exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
  852. // extend global
  853. if(target)redefine(target, key, out, type & $export.U);
  854. // export
  855. if(exports[key] != out)hide(exports, key, exp);
  856. if(IS_PROTO && expProto[key] != out)expProto[key] = out;
  857. }
  858. };
  859. global.core = core;
  860. // type bitmap
  861. $export.F = 1; // forced
  862. $export.G = 2; // global
  863. $export.S = 4; // static
  864. $export.P = 8; // proto
  865. $export.B = 16; // bind
  866. $export.W = 32; // wrap
  867. $export.U = 64; // safe
  868. $export.R = 128; // real proto method for `library`
  869. module.exports = $export;
  870.  
  871. /***/ },
  872. /* 7 */
  873. /***/ function(module, exports) {
  874.  
  875. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  876. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  877. ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
  878. if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
  879.  
  880. /***/ },
  881. /* 8 */
  882. /***/ function(module, exports) {
  883.  
  884. var core = module.exports = {version: '2.3.0'};
  885. if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
  886.  
  887. /***/ },
  888. /* 9 */
  889. /***/ function(module, exports, __webpack_require__) {
  890.  
  891. var dP = __webpack_require__(10)
  892. , createDesc = __webpack_require__(18);
  893. module.exports = __webpack_require__(14) ? function(object, key, value){
  894. return dP.f(object, key, createDesc(1, value));
  895. } : function(object, key, value){
  896. object[key] = value;
  897. return object;
  898. };
  899.  
  900. /***/ },
  901. /* 10 */
  902. /***/ function(module, exports, __webpack_require__) {
  903.  
  904. var anObject = __webpack_require__(11)
  905. , IE8_DOM_DEFINE = __webpack_require__(13)
  906. , toPrimitive = __webpack_require__(17)
  907. , dP = Object.defineProperty;
  908.  
  909. exports.f = __webpack_require__(14) ? Object.defineProperty : function defineProperty(O, P, Attributes){
  910. anObject(O);
  911. P = toPrimitive(P, true);
  912. anObject(Attributes);
  913. if(IE8_DOM_DEFINE)try {
  914. return dP(O, P, Attributes);
  915. } catch(e){ /* empty */ }
  916. if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
  917. if('value' in Attributes)O[P] = Attributes.value;
  918. return O;
  919. };
  920.  
  921. /***/ },
  922. /* 11 */
  923. /***/ function(module, exports, __webpack_require__) {
  924.  
  925. var isObject = __webpack_require__(12);
  926. module.exports = function(it){
  927. if(!isObject(it))throw TypeError(it + ' is not an object!');
  928. return it;
  929. };
  930.  
  931. /***/ },
  932. /* 12 */
  933. /***/ function(module, exports) {
  934.  
  935. module.exports = function(it){
  936. return typeof it === 'object' ? it !== null : typeof it === 'function';
  937. };
  938.  
  939. /***/ },
  940. /* 13 */
  941. /***/ function(module, exports, __webpack_require__) {
  942.  
  943. module.exports = !__webpack_require__(14) && !__webpack_require__(15)(function(){
  944. return Object.defineProperty(__webpack_require__(16)('div'), 'a', {get: function(){ return 7; }}).a != 7;
  945. });
  946.  
  947. /***/ },
  948. /* 14 */
  949. /***/ function(module, exports, __webpack_require__) {
  950.  
  951. // Thank's IE8 for his funny defineProperty
  952. module.exports = !__webpack_require__(15)(function(){
  953. return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
  954. });
  955.  
  956. /***/ },
  957. /* 15 */
  958. /***/ function(module, exports) {
  959.  
  960. module.exports = function(exec){
  961. try {
  962. return !!exec();
  963. } catch(e){
  964. return true;
  965. }
  966. };
  967.  
  968. /***/ },
  969. /* 16 */
  970. /***/ function(module, exports, __webpack_require__) {
  971.  
  972. var isObject = __webpack_require__(12)
  973. , document = __webpack_require__(7).document
  974. // in old IE typeof document.createElement is 'object'
  975. , is = isObject(document) && isObject(document.createElement);
  976. module.exports = function(it){
  977. return is ? document.createElement(it) : {};
  978. };
  979.  
  980. /***/ },
  981. /* 17 */
  982. /***/ function(module, exports, __webpack_require__) {
  983.  
  984. // 7.1.1 ToPrimitive(input [, PreferredType])
  985. var isObject = __webpack_require__(12);
  986. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  987. // and the second argument - flag - preferred type is a string
  988. module.exports = function(it, S){
  989. if(!isObject(it))return it;
  990. var fn, val;
  991. if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
  992. if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
  993. if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
  994. throw TypeError("Can't convert object to primitive value");
  995. };
  996.  
  997. /***/ },
  998. /* 18 */
  999. /***/ function(module, exports) {
  1000.  
  1001. module.exports = function(bitmap, value){
  1002. return {
  1003. enumerable : !(bitmap & 1),
  1004. configurable: !(bitmap & 2),
  1005. writable : !(bitmap & 4),
  1006. value : value
  1007. };
  1008. };
  1009.  
  1010. /***/ },
  1011. /* 19 */
  1012. /***/ function(module, exports, __webpack_require__) {
  1013.  
  1014. var global = __webpack_require__(7)
  1015. , hide = __webpack_require__(9)
  1016. , has = __webpack_require__(20)
  1017. , SRC = __webpack_require__(21)('src')
  1018. , TO_STRING = 'toString'
  1019. , $toString = Function[TO_STRING]
  1020. , TPL = ('' + $toString).split(TO_STRING);
  1021.  
  1022. __webpack_require__(8).inspectSource = function(it){
  1023. return $toString.call(it);
  1024. };
  1025.  
  1026. (module.exports = function(O, key, val, safe){
  1027. var isFunction = typeof val == 'function';
  1028. if(isFunction)has(val, 'name') || hide(val, 'name', key);
  1029. if(O[key] === val)return;
  1030. if(isFunction)has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
  1031. if(O === global){
  1032. O[key] = val;
  1033. } else {
  1034. if(!safe){
  1035. delete O[key];
  1036. hide(O, key, val);
  1037. } else {
  1038. if(O[key])O[key] = val;
  1039. else hide(O, key, val);
  1040. }
  1041. }
  1042. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  1043. })(Function.prototype, TO_STRING, function toString(){
  1044. return typeof this == 'function' && this[SRC] || $toString.call(this);
  1045. });
  1046.  
  1047. /***/ },
  1048. /* 20 */
  1049. /***/ function(module, exports) {
  1050.  
  1051. var hasOwnProperty = {}.hasOwnProperty;
  1052. module.exports = function(it, key){
  1053. return hasOwnProperty.call(it, key);
  1054. };
  1055.  
  1056. /***/ },
  1057. /* 21 */
  1058. /***/ function(module, exports) {
  1059.  
  1060. var id = 0
  1061. , px = Math.random();
  1062. module.exports = function(key){
  1063. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  1064. };
  1065.  
  1066. /***/ },
  1067. /* 22 */
  1068. /***/ function(module, exports, __webpack_require__) {
  1069.  
  1070. // 7.1.13 ToObject(argument)
  1071. var defined = __webpack_require__(23);
  1072. module.exports = function(it){
  1073. return Object(defined(it));
  1074. };
  1075.  
  1076. /***/ },
  1077. /* 23 */
  1078. /***/ function(module, exports) {
  1079.  
  1080. // 7.2.1 RequireObjectCoercible(argument)
  1081. module.exports = function(it){
  1082. if(it == undefined)throw TypeError("Can't call method on " + it);
  1083. return it;
  1084. };
  1085.  
  1086. /***/ },
  1087. /* 24 */
  1088. /***/ function(module, exports, __webpack_require__) {
  1089.  
  1090. // call something on iterator step with safe closing on error
  1091. var anObject = __webpack_require__(11);
  1092. module.exports = function(iterator, fn, value, entries){
  1093. try {
  1094. return entries ? fn(anObject(value)[0], value[1]) : fn(value);
  1095. // 7.4.6 IteratorClose(iterator, completion)
  1096. } catch(e){
  1097. var ret = iterator['return'];
  1098. if(ret !== undefined)anObject(ret.call(iterator));
  1099. throw e;
  1100. }
  1101. };
  1102.  
  1103. /***/ },
  1104. /* 25 */
  1105. /***/ function(module, exports, __webpack_require__) {
  1106.  
  1107. // check on default Array iterator
  1108. var Iterators = __webpack_require__(26)
  1109. , ITERATOR = __webpack_require__(27)('iterator')
  1110. , ArrayProto = Array.prototype;
  1111.  
  1112. module.exports = function(it){
  1113. return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
  1114. };
  1115.  
  1116. /***/ },
  1117. /* 26 */
  1118. /***/ function(module, exports) {
  1119.  
  1120. module.exports = {};
  1121.  
  1122. /***/ },
  1123. /* 27 */
  1124. /***/ function(module, exports, __webpack_require__) {
  1125.  
  1126. var store = __webpack_require__(28)('wks')
  1127. , uid = __webpack_require__(21)
  1128. , Symbol = __webpack_require__(7).Symbol
  1129. , USE_SYMBOL = typeof Symbol == 'function';
  1130.  
  1131. var $exports = module.exports = function(name){
  1132. return store[name] || (store[name] =
  1133. USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
  1134. };
  1135.  
  1136. $exports.store = store;
  1137.  
  1138. /***/ },
  1139. /* 28 */
  1140. /***/ function(module, exports, __webpack_require__) {
  1141.  
  1142. var global = __webpack_require__(7)
  1143. , SHARED = '__core-js_shared__'
  1144. , store = global[SHARED] || (global[SHARED] = {});
  1145. module.exports = function(key){
  1146. return store[key] || (store[key] = {});
  1147. };
  1148.  
  1149. /***/ },
  1150. /* 29 */
  1151. /***/ function(module, exports, __webpack_require__) {
  1152.  
  1153. // 7.1.15 ToLength
  1154. var toInteger = __webpack_require__(30)
  1155. , min = Math.min;
  1156. module.exports = function(it){
  1157. return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
  1158. };
  1159.  
  1160. /***/ },
  1161. /* 30 */
  1162. /***/ function(module, exports) {
  1163.  
  1164. // 7.1.4 ToInteger
  1165. var ceil = Math.ceil
  1166. , floor = Math.floor;
  1167. module.exports = function(it){
  1168. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  1169. };
  1170.  
  1171. /***/ },
  1172. /* 31 */
  1173. /***/ function(module, exports, __webpack_require__) {
  1174.  
  1175. 'use strict';
  1176. var $defineProperty = __webpack_require__(10)
  1177. , createDesc = __webpack_require__(18);
  1178.  
  1179. module.exports = function(object, index, value){
  1180. if(index in object)$defineProperty.f(object, index, createDesc(0, value));
  1181. else object[index] = value;
  1182. };
  1183.  
  1184. /***/ },
  1185. /* 32 */
  1186. /***/ function(module, exports, __webpack_require__) {
  1187.  
  1188. var classof = __webpack_require__(33)
  1189. , ITERATOR = __webpack_require__(27)('iterator')
  1190. , Iterators = __webpack_require__(26);
  1191. module.exports = __webpack_require__(8).getIteratorMethod = function(it){
  1192. if(it != undefined)return it[ITERATOR]
  1193. || it['@@iterator']
  1194. || Iterators[classof(it)];
  1195. };
  1196.  
  1197. /***/ },
  1198. /* 33 */
  1199. /***/ function(module, exports, __webpack_require__) {
  1200.  
  1201. // getting tag from 19.1.3.6 Object.prototype.toString()
  1202. var cof = __webpack_require__(34)
  1203. , TAG = __webpack_require__(27)('toStringTag')
  1204. // ES3 wrong here
  1205. , ARG = cof(function(){ return arguments; }()) == 'Arguments';
  1206.  
  1207. // fallback for IE11 Script Access Denied error
  1208. var tryGet = function(it, key){
  1209. try {
  1210. return it[key];
  1211. } catch(e){ /* empty */ }
  1212. };
  1213.  
  1214. module.exports = function(it){
  1215. var O, T, B;
  1216. return it === undefined ? 'Undefined' : it === null ? 'Null'
  1217. // @@toStringTag case
  1218. : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
  1219. // builtinTag case
  1220. : ARG ? cof(O)
  1221. // ES3 arguments fallback
  1222. : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
  1223. };
  1224.  
  1225. /***/ },
  1226. /* 34 */
  1227. /***/ function(module, exports) {
  1228.  
  1229. var toString = {}.toString;
  1230.  
  1231. module.exports = function(it){
  1232. return toString.call(it).slice(8, -1);
  1233. };
  1234.  
  1235. /***/ },
  1236. /* 35 */
  1237. /***/ function(module, exports, __webpack_require__) {
  1238.  
  1239. var ITERATOR = __webpack_require__(27)('iterator')
  1240. , SAFE_CLOSING = false;
  1241.  
  1242. try {
  1243. var riter = [7][ITERATOR]();
  1244. riter['return'] = function(){ SAFE_CLOSING = true; };
  1245. Array.from(riter, function(){ throw 2; });
  1246. } catch(e){ /* empty */ }
  1247.  
  1248. module.exports = function(exec, skipClosing){
  1249. if(!skipClosing && !SAFE_CLOSING)return false;
  1250. var safe = false;
  1251. try {
  1252. var arr = [7]
  1253. , iter = arr[ITERATOR]();
  1254. iter.next = function(){ return {done: safe = true}; };
  1255. arr[ITERATOR] = function(){ return iter; };
  1256. exec(arr);
  1257. } catch(e){ /* empty */ }
  1258. return safe;
  1259. };
  1260.  
  1261. /***/ },
  1262. /* 36 */
  1263. /***/ function(module, exports, __webpack_require__) {
  1264.  
  1265. // 19.1.3.1 Object.assign(target, source)
  1266. var $export = __webpack_require__(6);
  1267.  
  1268. $export($export.S + $export.F, 'Object', {assign: __webpack_require__(37)});
  1269.  
  1270. /***/ },
  1271. /* 37 */
  1272. /***/ function(module, exports, __webpack_require__) {
  1273.  
  1274. 'use strict';
  1275. // 19.1.2.1 Object.assign(target, source, ...)
  1276. var getKeys = __webpack_require__(38)
  1277. , gOPS = __webpack_require__(46)
  1278. , pIE = __webpack_require__(47)
  1279. , toObject = __webpack_require__(22)
  1280. , IObject = __webpack_require__(41)
  1281. , $assign = Object.assign;
  1282.  
  1283. // should work with symbols and should have deterministic property order (V8 bug)
  1284. module.exports = !$assign || __webpack_require__(15)(function(){
  1285. var A = {}
  1286. , B = {}
  1287. , S = Symbol()
  1288. , K = 'abcdefghijklmnopqrst';
  1289. A[S] = 7;
  1290. K.split('').forEach(function(k){ B[k] = k; });
  1291. return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
  1292. }) ? function assign(target, source){ // eslint-disable-line no-unused-vars
  1293. var T = toObject(target)
  1294. , aLen = arguments.length
  1295. , index = 1
  1296. , getSymbols = gOPS.f
  1297. , isEnum = pIE.f;
  1298. while(aLen > index){
  1299. var S = IObject(arguments[index++])
  1300. , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S)
  1301. , length = keys.length
  1302. , j = 0
  1303. , key;
  1304. while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];
  1305. } return T;
  1306. } : $assign;
  1307.  
  1308. /***/ },
  1309. /* 38 */
  1310. /***/ function(module, exports, __webpack_require__) {
  1311.  
  1312. // 19.1.2.14 / 15.2.3.14 Object.keys(O)
  1313. var $keys = __webpack_require__(39)
  1314. , enumBugKeys = __webpack_require__(45);
  1315.  
  1316. module.exports = Object.keys || function keys(O){
  1317. return $keys(O, enumBugKeys);
  1318. };
  1319.  
  1320. /***/ },
  1321. /* 39 */
  1322. /***/ function(module, exports, __webpack_require__) {
  1323.  
  1324. var has = __webpack_require__(20)
  1325. , toIObject = __webpack_require__(40)
  1326. , arrayIndexOf = __webpack_require__(42)(false)
  1327. , IE_PROTO = __webpack_require__(44)('IE_PROTO');
  1328.  
  1329. module.exports = function(object, names){
  1330. var O = toIObject(object)
  1331. , i = 0
  1332. , result = []
  1333. , key;
  1334. for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
  1335. // Don't enum bug & hidden keys
  1336. while(names.length > i)if(has(O, key = names[i++])){
  1337. ~arrayIndexOf(result, key) || result.push(key);
  1338. }
  1339. return result;
  1340. };
  1341.  
  1342. /***/ },
  1343. /* 40 */
  1344. /***/ function(module, exports, __webpack_require__) {
  1345.  
  1346. // to indexed object, toObject with fallback for non-array-like ES3 strings
  1347. var IObject = __webpack_require__(41)
  1348. , defined = __webpack_require__(23);
  1349. module.exports = function(it){
  1350. return IObject(defined(it));
  1351. };
  1352.  
  1353. /***/ },
  1354. /* 41 */
  1355. /***/ function(module, exports, __webpack_require__) {
  1356.  
  1357. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  1358. var cof = __webpack_require__(34);
  1359. module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
  1360. return cof(it) == 'String' ? it.split('') : Object(it);
  1361. };
  1362.  
  1363. /***/ },
  1364. /* 42 */
  1365. /***/ function(module, exports, __webpack_require__) {
  1366.  
  1367. // false -> Array#indexOf
  1368. // true -> Array#includes
  1369. var toIObject = __webpack_require__(40)
  1370. , toLength = __webpack_require__(29)
  1371. , toIndex = __webpack_require__(43);
  1372. module.exports = function(IS_INCLUDES){
  1373. return function($this, el, fromIndex){
  1374. var O = toIObject($this)
  1375. , length = toLength(O.length)
  1376. , index = toIndex(fromIndex, length)
  1377. , value;
  1378. // Array#includes uses SameValueZero equality algorithm
  1379. if(IS_INCLUDES && el != el)while(length > index){
  1380. value = O[index++];
  1381. if(value != value)return true;
  1382. // Array#toIndex ignores holes, Array#includes - not
  1383. } else for(;length > index; index++)if(IS_INCLUDES || index in O){
  1384. if(O[index] === el)return IS_INCLUDES || index || 0;
  1385. } return !IS_INCLUDES && -1;
  1386. };
  1387. };
  1388.  
  1389. /***/ },
  1390. /* 43 */
  1391. /***/ function(module, exports, __webpack_require__) {
  1392.  
  1393. var toInteger = __webpack_require__(30)
  1394. , max = Math.max
  1395. , min = Math.min;
  1396. module.exports = function(index, length){
  1397. index = toInteger(index);
  1398. return index < 0 ? max(index + length, 0) : min(index, length);
  1399. };
  1400.  
  1401. /***/ },
  1402. /* 44 */
  1403. /***/ function(module, exports, __webpack_require__) {
  1404.  
  1405. var shared = __webpack_require__(28)('keys')
  1406. , uid = __webpack_require__(21);
  1407. module.exports = function(key){
  1408. return shared[key] || (shared[key] = uid(key));
  1409. };
  1410.  
  1411. /***/ },
  1412. /* 45 */
  1413. /***/ function(module, exports) {
  1414.  
  1415. // IE 8- don't enum bug keys
  1416. module.exports = (
  1417. 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
  1418. ).split(',');
  1419.  
  1420. /***/ },
  1421. /* 46 */
  1422. /***/ function(module, exports) {
  1423.  
  1424. exports.f = Object.getOwnPropertySymbols;
  1425.  
  1426. /***/ },
  1427. /* 47 */
  1428. /***/ function(module, exports) {
  1429.  
  1430. exports.f = {}.propertyIsEnumerable;
  1431.  
  1432. /***/ },
  1433. /* 48 */
  1434. /***/ function(module, exports) {
  1435.  
  1436. "use strict";
  1437.  
  1438. Object.defineProperty(exports, "__esModule", {
  1439. value: true
  1440. });
  1441. /**
  1442. * Created by axetroy on 5/8/16.
  1443. */
  1444. var svg = "\n<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"14\" height=\"14\" viewBox=\"0 0 200 200\" version=\"1.1\" style=\"\n vertical-align: sub;\n\">\n<g class=\"transform-group\">\n <g transform=\"scale(0.1953125, 0.1953125)\">\n <path d=\"M822.809088 510.318592q0-91.994112-49.711104-168.56064l-430.829568 430.258176q78.280704 50.853888 169.703424 50.853888 63.424512 0 120.849408-24.855552t99.136512-66.567168 66.281472-99.707904 24.569856-121.4208zm-570.820608 170.846208l431.40096-430.829568q-77.13792-51.996672-171.4176-51.996672-84.566016 0-155.990016 41.711616t-113.135616 113.707008-41.711616 156.561408q0 92.565504 50.853888 170.846208zm698.812416-170.846208q0 89.708544-34.854912 171.4176t-93.422592 140.562432-139.99104 93.708288-170.560512 34.854912-170.560512-34.854912-139.99104-93.708288-93.422592-140.562432-34.854912-171.4176 34.854912-171.131904 93.422592-140.276736 139.99104-93.708288 170.560512-34.854912 170.560512 34.854912 139.99104 93.708288 93.422592 140.276736 34.854912 171.131904z\" fill=\"#272636\"></path>\n </g>\n </g>\n</svg>\n";
  1445.  
  1446. exports.default = svg;
  1447.  
  1448. /***/ },
  1449. /* 49 */
  1450. /***/ function(module, exports, __webpack_require__) {
  1451.  
  1452. 'use strict';
  1453.  
  1454. Object.defineProperty(exports, "__esModule", {
  1455. value: true
  1456. });
  1457.  
  1458. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  1459.  
  1460. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
  1461. * Created by axetroy on 5/10/16.
  1462. */
  1463.  
  1464. var _jqLite = __webpack_require__(2);
  1465.  
  1466. var _jqLite2 = _interopRequireDefault(_jqLite);
  1467.  
  1468. var _formatDate = __webpack_require__(50);
  1469.  
  1470. var _formatDate2 = _interopRequireDefault(_formatDate);
  1471.  
  1472. var _common = __webpack_require__(51);
  1473.  
  1474. var _common2 = _interopRequireDefault(_common);
  1475.  
  1476. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1477.  
  1478. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1479.  
  1480. var Panel = function () {
  1481. function Panel() {
  1482. _classCallCheck(this, Panel);
  1483. }
  1484.  
  1485. _createClass(Panel, [{
  1486. key: 'create',
  1487. value: function create() {
  1488. if ((0, _jqLite2.default)('#block-mask').length) return;
  1489. var root = document.createElement('div');
  1490.  
  1491. this.$mask = (0, _jqLite2.default)(root.cloneNode(false)).attr('id', 'block-mask');
  1492. this.$panel = (0, _jqLite2.default)(root.cloneNode(false)).attr('id', 'block-panel').html(__webpack_require__(52));
  1493.  
  1494. this.$mask.append(this.$panel);
  1495.  
  1496. this.$menu = this.$panel.find('.block-menu ul li');
  1497. this.$session = this.$panel.find('.block-content .session');
  1498. this.$config = this.$session.eq(0);
  1499. this.$block = this.$session.eq(1);
  1500. this.$list = this.$session.eq(2);
  1501.  
  1502. this.init();
  1503. this.link();
  1504.  
  1505. document.documentElement.appendChild(this.$mask[0]);
  1506. return this;
  1507. }
  1508. }, {
  1509. key: 'remove',
  1510. value: function remove() {
  1511. this.$mask.remove();
  1512. }
  1513. }, {
  1514. key: 'link',
  1515. value: function link() {
  1516. var _this2 = this;
  1517.  
  1518. var _this = this;
  1519.  
  1520. // 屏蔽列表的点击事件
  1521. this.$list.click(function (e) {
  1522. var $target = (0, _jqLite2.default)(e.target);
  1523. var index = +$target.attr('list-index');
  1524. var blockID = $target.attr('block-id');
  1525.  
  1526. _this2.$list.find('table>tbody>tr').each(function (ele) {
  1527. if ((0, _jqLite2.default)(ele).find('.block-remove').attr('block-id') === blockID) {
  1528. ele.remove();
  1529. GM_deleteValue(blockID);
  1530. }
  1531. });
  1532. });
  1533.  
  1534. // 控制面板的切换
  1535. this.$menu.click(function (e) {
  1536. var index = (0, _jqLite2.default)(e.target).index;
  1537. _this2.$menu.removeClass('active').eq(index).addClass('active');
  1538. _this2.$session.hide().eq(index).show();
  1539. return false;
  1540. });
  1541.  
  1542. // 点击屏蔽按钮
  1543. // block someone
  1544. this.$block.find('.block-block-submit').click(function (e) {
  1545. var _map = ['id', 'bar', 'reason'].map(function (name) {
  1546. return _this2.$block.find('.block-' + name);
  1547. });
  1548.  
  1549. var _map2 = _slicedToArray(_map, 3);
  1550.  
  1551. var $id = _map2[0];
  1552. var $bar = _map2[1];
  1553. var $reason = _map2[2];
  1554.  
  1555. var _map3 = [$id, $bar, $reason].map(function (input) {
  1556. return input.val();
  1557. });
  1558.  
  1559. var _map4 = _slicedToArray(_map3, 3);
  1560.  
  1561. var id = _map4[0];
  1562. var bar = _map4[1];
  1563. var reason = _map4[2];
  1564.  
  1565.  
  1566. if (!id) return;
  1567. GM_setValue(id, { id: id, bar: bar, reason: reason, date: new Date() });
  1568. $id.val('');
  1569. $reason.val('');
  1570. });
  1571.  
  1572. // 关掉控制面板
  1573. this.$mask.click(function (e) {
  1574. if ((0, _jqLite2.default)(e.target).attr('id') === 'block-mask') _this2.remove();
  1575. });
  1576. }
  1577. }, {
  1578. key: 'init',
  1579. value: function init() {
  1580. this.$menu.eq(0).addClass('active');
  1581. this.$session.hide().eq(0).show();
  1582. this.$panel.find('.block-bar').val(_common2.default.getBarName());
  1583.  
  1584. this.$list.html(function () {
  1585. var GMList = GM_listValues();
  1586. var list = [];
  1587.  
  1588. for (var i = 0; i < GMList.length; i++) {
  1589. list[i] = GM_getValue(GMList[i]);
  1590. }
  1591.  
  1592. var tableStr = '';
  1593.  
  1594. list.forEach(function (v, i) {
  1595. var time = '';
  1596. if (v.date) {
  1597. var date = new Date(v.date);
  1598. time = (0, _formatDate2.default)(date, 'yyyy-MM-dd');
  1599. }
  1600. tableStr += '\n <tr>\n <td>' + v.id + '</td>\n <td>' + v.bar + '</td>\n <td>' + v.reason + '</td>\n <td>' + time + '</td>\n <td>\n <a class="block-remove btn" href="javascript:void(0)" block-id="' + v.id + '" list-index="' + i + '">移除</a>\n </td>\n </tr>\n ';
  1601. });
  1602.  
  1603. return '\n <table>\n <thead>\n <tr>\n <th><b>贴吧ID</b></th>\n <th><b>所在贴吧</b></th>\n <th><b>屏蔽理由</b></th>\n <th><b>屏蔽时间</b></th>\n <th><b>操作</b></th>\n </tr>\n </thead>\n <tbody>\n ' + tableStr + '\n </tbody>\n </table>\n ';
  1604. });
  1605. }
  1606. }]);
  1607.  
  1608. return Panel;
  1609. }();
  1610.  
  1611. exports.default = Panel;
  1612.  
  1613. /***/ },
  1614. /* 50 */
  1615. /***/ function(module, exports) {
  1616.  
  1617. "use strict";
  1618.  
  1619. Object.defineProperty(exports, "__esModule", {
  1620. value: true
  1621. });
  1622. exports.default = formatDate;
  1623. function formatDate(date, fmt) {
  1624. var o = {
  1625. "M+": date.getMonth() + 1, //月份
  1626. "d+": date.getDate(), //日
  1627. "h+": date.getHours(), //小时
  1628. "m+": date.getMinutes(), //分
  1629. "s+": date.getSeconds(), //秒
  1630. "q+": Math.floor((date.getMonth() + 3) / 3), //季度
  1631. "S": date.getMilliseconds() //毫秒
  1632. };
  1633. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
  1634. for (var k in o) {
  1635. if (new RegExp("(" + k + ")").test(fmt)) {
  1636. fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
  1637. }
  1638. }
  1639. return fmt;
  1640. };
  1641.  
  1642. /***/ },
  1643. /* 51 */
  1644. /***/ function(module, exports) {
  1645.  
  1646. 'use strict';
  1647.  
  1648. Object.defineProperty(exports, "__esModule", {
  1649. value: true
  1650. });
  1651.  
  1652. var common = {
  1653. // 获取当前所在的位置,是贴吧列表,还是贴吧内容页
  1654.  
  1655. getPosition: function getPosition() {
  1656. var url = location.href;
  1657. var postInside = /.*tieba.baidu.com\/p\/.*/ig;
  1658. var postList = /.*tieba.baidu.com\/(f\?.*|[^p])/ig;
  1659. return postInside.test(url) ? 'post' : postList.test(url) ? 'list' : null;
  1660. },
  1661.  
  1662. // 获取当前页的贴吧名
  1663. getBarName: function getBarName() {
  1664. return $(".card_title_fname").text().trim();
  1665. }
  1666. };
  1667.  
  1668. exports.default = common;
  1669.  
  1670. /***/ },
  1671. /* 52 */
  1672. /***/ function(module, exports) {
  1673.  
  1674. module.exports = "<h2 class=\"block-title\">控制面板</h2>\n<div class=\"block-container\">\n\n <div class=\"block-menu\">\n <ul>\n <li>配置</li>\n <li>屏蔽</li>\n <li>名单</li>\n </ul>\n </div>\n\n <div class=\"block-content\">\n\n <div class=\"session block-config\">\n <h2>暂时没什么可配置的...</h2>\n </div>\n\n <div class=\"session block-block\">\n\n <form style=\"margin: 0 auto;\">\n <div>\n <label>\n *贴吧ID\n </label>\n <input class=\"block-id form-control\" type=\"text\" placeholder=\"贴吧ID\"/>\n </div>\n\n <div>\n <label>\n 屏蔽原因\n </label>\n <input class=\"block-reason form-control\" type=\"text\" placeholder=\"屏蔽原因\"/>\n </div>\n\n <div>\n <label>\n 所在贴吧\n </label>\n <input class=\"block-bar form-control\" type=\"text\" placeholder=\"所在贴吧\" value=\"\"/>\n </div>\n\n <input class=\"block-block-submit btn\" type=\"button\" value=\"提交\"/>\n </form>\n\n </div>\n\n <div class=\"session block-list\">\n </div>\n </div>\n\n <div class=\"block-clear\"></div>\n\n</div>";
  1675.  
  1676. /***/ },
  1677. /* 53 */
  1678. /***/ function(module, exports, __webpack_require__) {
  1679.  
  1680. // style-loader: Adds some css to the DOM by adding a <style> tag
  1681.  
  1682. // load the styles
  1683. var content = __webpack_require__(54);
  1684. if(typeof content === 'string') content = [[module.id, content, '']];
  1685. // add the styles to the DOM
  1686. var update = __webpack_require__(56)(content, {});
  1687. if(content.locals) module.exports = content.locals;
  1688. // Hot Module Replacement
  1689. if(false) {
  1690. // When the styles change, update the <style> tags
  1691. if(!content.locals) {
  1692. module.hot.accept("!!./../node_modules/.npminstall/css-loader/0.23.1/css-loader/index.js!./../node_modules/.npminstall/sass-loader/3.2.0/sass-loader/index.js!./style.scss", function() {
  1693. var newContent = require("!!./../node_modules/.npminstall/css-loader/0.23.1/css-loader/index.js!./../node_modules/.npminstall/sass-loader/3.2.0/sass-loader/index.js!./style.scss");
  1694. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  1695. update(newContent);
  1696. });
  1697. }
  1698. // When the module is disposed, remove the <style> tags
  1699. module.hot.dispose(function() { update(); });
  1700. }
  1701.  
  1702. /***/ },
  1703. /* 54 */
  1704. /***/ function(module, exports, __webpack_require__) {
  1705.  
  1706. exports = module.exports = __webpack_require__(55)();
  1707. // imports
  1708.  
  1709.  
  1710. // module
  1711. exports.push([module.id, "@charset \"UTF-8\";\n/** 公共部分 **/\n@font-face {\n font-family: ifont;\n src: url(\"http://at.alicdn.com/t/font_1442373896_4754455.eot?#iefix\") format(\"embedded-opentype\"), url(\"http://at.alicdn.com/t/font_1442373896_4754455.woff\") format(\"woff\"), url(\"http://at.alicdn.com/t/font_1442373896_4754455.ttf\") format(\"truetype\"), url(\"http://at.alicdn.com/t/font_1442373896_4754455.svg#ifont\") format(\"svg\"); }\n\n#block-mask {\n position: fixed;\n top: 0;\n left: 0;\n z-index: 9999999;\n width: 100%;\n height: 100%;\n background: rgba(45, 45, 45, 0.6);\n margin: 0;\n padding: 0;\n overflow: hidden;\n font-size: 14px;\n line-height: 1.42857143em;\n /** 非公共部分 **/ }\n #block-mask * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box; }\n #block-mask label {\n display: inline-block;\n max-width: 100%;\n margin-bottom: 5px;\n font-weight: 700; }\n #block-mask .btn {\n display: inline-block;\n padding: 6px 12px;\n font-size: 14px;\n line-height: 1.42857143;\n text-align: center;\n white-space: nowrap;\n vertical-align: middle;\n -ms-touch-action: manipulation;\n touch-action: manipulation;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n background-image: none;\n border: 1px solid transparent;\n border-radius: 4px;\n margin-top: 5px;\n margin-bottom: 5px;\n color: #333;\n background-color: #fff;\n border-color: #333; }\n #block-mask .form-group {\n margin-bottom: 15px; }\n #block-mask .form-control {\n display: block;\n width: 100%;\n height: 34px;\n padding: 6px 12px;\n font-size: 14px;\n line-height: 1.42857143;\n color: #555;\n background-color: #fff;\n background-image: none;\n border: 1px solid #ccc;\n border-radius: 4px;\n -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;\n transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; }\n #block-mask .form-control:focus {\n border-color: #66afe9;\n outline: 0;\n -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);\n box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); }\n #block-mask p {\n color: #fff;\n line-height: 3em; }\n #block-mask a {\n color: #555;\n text-decoration: none; }\n #block-mask .block-clear {\n visibility: hidden;\n font-size: 0;\n width: 0;\n height: 0;\n clear: both; }\n #block-mask ul {\n list-style: none; }\n #block-mask ul li {\n color: #555; }\n #block-mask #block-panel {\n position: relative;\n top: 100px;\n width: 800px;\n height: auto;\n margin: 0 auto;\n background: #fff;\n z-index: inherit; }\n #block-mask #block-panel .block-title {\n text-align: center;\n line-height: 36px;\n font-size: 1.6em;\n border-bottom: 1px solid #ccc; }\n #block-mask #block-panel .block-container {\n margin-top: 10px;\n padding-bottom: 10px; }\n #block-mask #block-panel .block-menu {\n width: 10%;\n float: left; }\n #block-mask #block-panel .block-menu ul {\n text-align: center; }\n #block-mask #block-panel .block-menu ul li {\n line-height: 4em;\n cursor: pointer; }\n #block-mask #block-panel .block-menu ul li.active {\n background: #6B6B6B;\n color: #fff; }\n #block-mask #block-panel .block-content {\n width: 90%;\n padding-left: 20px;\n float: left;\n max-height: 400px;\n overflow-y: auto; }\n #block-mask #block-panel .block-content .block-list table {\n width: 100%; }\n #block-mask #block-panel .block-content .block-list table tr {\n text-align: center;\n line-height: 24px; }\n\na.block-icon {\n display: inline; }\n", ""]);
  1712.  
  1713. // exports
  1714.  
  1715.  
  1716. /***/ },
  1717. /* 55 */
  1718. /***/ function(module, exports) {
  1719.  
  1720. /*
  1721. MIT License http://www.opensource.org/licenses/mit-license.php
  1722. Author Tobias Koppers @sokra
  1723. */
  1724. // css base code, injected by the css-loader
  1725. module.exports = function() {
  1726. var list = [];
  1727.  
  1728. // return the list of modules as css string
  1729. list.toString = function toString() {
  1730. var result = [];
  1731. for(var i = 0; i < this.length; i++) {
  1732. var item = this[i];
  1733. if(item[2]) {
  1734. result.push("@media " + item[2] + "{" + item[1] + "}");
  1735. } else {
  1736. result.push(item[1]);
  1737. }
  1738. }
  1739. return result.join("");
  1740. };
  1741.  
  1742. // import a list of modules into the list
  1743. list.i = function(modules, mediaQuery) {
  1744. if(typeof modules === "string")
  1745. modules = [[null, modules, ""]];
  1746. var alreadyImportedModules = {};
  1747. for(var i = 0; i < this.length; i++) {
  1748. var id = this[i][0];
  1749. if(typeof id === "number")
  1750. alreadyImportedModules[id] = true;
  1751. }
  1752. for(i = 0; i < modules.length; i++) {
  1753. var item = modules[i];
  1754. // skip already imported module
  1755. // this implementation is not 100% perfect for weird media query combinations
  1756. // when a module is imported multiple times with different media queries.
  1757. // I hope this will never occur (Hey this way we have smaller bundles)
  1758. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  1759. if(mediaQuery && !item[2]) {
  1760. item[2] = mediaQuery;
  1761. } else if(mediaQuery) {
  1762. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  1763. }
  1764. list.push(item);
  1765. }
  1766. }
  1767. };
  1768. return list;
  1769. };
  1770.  
  1771.  
  1772. /***/ },
  1773. /* 56 */
  1774. /***/ function(module, exports, __webpack_require__) {
  1775.  
  1776. /*
  1777. MIT License http://www.opensource.org/licenses/mit-license.php
  1778. Author Tobias Koppers @sokra
  1779. */
  1780. var stylesInDom = {},
  1781. memoize = function(fn) {
  1782. var memo;
  1783. return function () {
  1784. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  1785. return memo;
  1786. };
  1787. },
  1788. isOldIE = memoize(function() {
  1789. return /msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase());
  1790. }),
  1791. getHeadElement = memoize(function () {
  1792. return document.head || document.getElementsByTagName("head")[0];
  1793. }),
  1794. singletonElement = null,
  1795. singletonCounter = 0,
  1796. styleElementsInsertedAtTop = [];
  1797.  
  1798. module.exports = function(list, options) {
  1799. if(false) {
  1800. if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  1801. }
  1802.  
  1803. options = options || {};
  1804. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  1805. // tags it will allow on a page
  1806. if (typeof options.singleton === "undefined") options.singleton = isOldIE();
  1807.  
  1808. // By default, add <style> tags to the bottom of <head>.
  1809. if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
  1810.  
  1811. var styles = listToStyles(list);
  1812. addStylesToDom(styles, options);
  1813.  
  1814. return function update(newList) {
  1815. var mayRemove = [];
  1816. for(var i = 0; i < styles.length; i++) {
  1817. var item = styles[i];
  1818. var domStyle = stylesInDom[item.id];
  1819. domStyle.refs--;
  1820. mayRemove.push(domStyle);
  1821. }
  1822. if(newList) {
  1823. var newStyles = listToStyles(newList);
  1824. addStylesToDom(newStyles, options);
  1825. }
  1826. for(var i = 0; i < mayRemove.length; i++) {
  1827. var domStyle = mayRemove[i];
  1828. if(domStyle.refs === 0) {
  1829. for(var j = 0; j < domStyle.parts.length; j++)
  1830. domStyle.parts[j]();
  1831. delete stylesInDom[domStyle.id];
  1832. }
  1833. }
  1834. };
  1835. }
  1836.  
  1837. function addStylesToDom(styles, options) {
  1838. for(var i = 0; i < styles.length; i++) {
  1839. var item = styles[i];
  1840. var domStyle = stylesInDom[item.id];
  1841. if(domStyle) {
  1842. domStyle.refs++;
  1843. for(var j = 0; j < domStyle.parts.length; j++) {
  1844. domStyle.parts[j](item.parts[j]);
  1845. }
  1846. for(; j < item.parts.length; j++) {
  1847. domStyle.parts.push(addStyle(item.parts[j], options));
  1848. }
  1849. } else {
  1850. var parts = [];
  1851. for(var j = 0; j < item.parts.length; j++) {
  1852. parts.push(addStyle(item.parts[j], options));
  1853. }
  1854. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  1855. }
  1856. }
  1857. }
  1858.  
  1859. function listToStyles(list) {
  1860. var styles = [];
  1861. var newStyles = {};
  1862. for(var i = 0; i < list.length; i++) {
  1863. var item = list[i];
  1864. var id = item[0];
  1865. var css = item[1];
  1866. var media = item[2];
  1867. var sourceMap = item[3];
  1868. var part = {css: css, media: media, sourceMap: sourceMap};
  1869. if(!newStyles[id])
  1870. styles.push(newStyles[id] = {id: id, parts: [part]});
  1871. else
  1872. newStyles[id].parts.push(part);
  1873. }
  1874. return styles;
  1875. }
  1876.  
  1877. function insertStyleElement(options, styleElement) {
  1878. var head = getHeadElement();
  1879. var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
  1880. if (options.insertAt === "top") {
  1881. if(!lastStyleElementInsertedAtTop) {
  1882. head.insertBefore(styleElement, head.firstChild);
  1883. } else if(lastStyleElementInsertedAtTop.nextSibling) {
  1884. head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
  1885. } else {
  1886. head.appendChild(styleElement);
  1887. }
  1888. styleElementsInsertedAtTop.push(styleElement);
  1889. } else if (options.insertAt === "bottom") {
  1890. head.appendChild(styleElement);
  1891. } else {
  1892. throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
  1893. }
  1894. }
  1895.  
  1896. function removeStyleElement(styleElement) {
  1897. styleElement.parentNode.removeChild(styleElement);
  1898. var idx = styleElementsInsertedAtTop.indexOf(styleElement);
  1899. if(idx >= 0) {
  1900. styleElementsInsertedAtTop.splice(idx, 1);
  1901. }
  1902. }
  1903.  
  1904. function createStyleElement(options) {
  1905. var styleElement = document.createElement("style");
  1906. styleElement.type = "text/css";
  1907. insertStyleElement(options, styleElement);
  1908. return styleElement;
  1909. }
  1910.  
  1911. function createLinkElement(options) {
  1912. var linkElement = document.createElement("link");
  1913. linkElement.rel = "stylesheet";
  1914. insertStyleElement(options, linkElement);
  1915. return linkElement;
  1916. }
  1917.  
  1918. function addStyle(obj, options) {
  1919. var styleElement, update, remove;
  1920.  
  1921. if (options.singleton) {
  1922. var styleIndex = singletonCounter++;
  1923. styleElement = singletonElement || (singletonElement = createStyleElement(options));
  1924. update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
  1925. remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
  1926. } else if(obj.sourceMap &&
  1927. typeof URL === "function" &&
  1928. typeof URL.createObjectURL === "function" &&
  1929. typeof URL.revokeObjectURL === "function" &&
  1930. typeof Blob === "function" &&
  1931. typeof btoa === "function") {
  1932. styleElement = createLinkElement(options);
  1933. update = updateLink.bind(null, styleElement);
  1934. remove = function() {
  1935. removeStyleElement(styleElement);
  1936. if(styleElement.href)
  1937. URL.revokeObjectURL(styleElement.href);
  1938. };
  1939. } else {
  1940. styleElement = createStyleElement(options);
  1941. update = applyToTag.bind(null, styleElement);
  1942. remove = function() {
  1943. removeStyleElement(styleElement);
  1944. };
  1945. }
  1946.  
  1947. update(obj);
  1948.  
  1949. return function updateStyle(newObj) {
  1950. if(newObj) {
  1951. if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
  1952. return;
  1953. update(obj = newObj);
  1954. } else {
  1955. remove();
  1956. }
  1957. };
  1958. }
  1959.  
  1960. var replaceText = (function () {
  1961. var textStore = [];
  1962.  
  1963. return function (index, replacement) {
  1964. textStore[index] = replacement;
  1965. return textStore.filter(Boolean).join('\n');
  1966. };
  1967. })();
  1968.  
  1969. function applyToSingletonTag(styleElement, index, remove, obj) {
  1970. var css = remove ? "" : obj.css;
  1971.  
  1972. if (styleElement.styleSheet) {
  1973. styleElement.styleSheet.cssText = replaceText(index, css);
  1974. } else {
  1975. var cssNode = document.createTextNode(css);
  1976. var childNodes = styleElement.childNodes;
  1977. if (childNodes[index]) styleElement.removeChild(childNodes[index]);
  1978. if (childNodes.length) {
  1979. styleElement.insertBefore(cssNode, childNodes[index]);
  1980. } else {
  1981. styleElement.appendChild(cssNode);
  1982. }
  1983. }
  1984. }
  1985.  
  1986. function applyToTag(styleElement, obj) {
  1987. var css = obj.css;
  1988. var media = obj.media;
  1989.  
  1990. if(media) {
  1991. styleElement.setAttribute("media", media)
  1992. }
  1993.  
  1994. if(styleElement.styleSheet) {
  1995. styleElement.styleSheet.cssText = css;
  1996. } else {
  1997. while(styleElement.firstChild) {
  1998. styleElement.removeChild(styleElement.firstChild);
  1999. }
  2000. styleElement.appendChild(document.createTextNode(css));
  2001. }
  2002. }
  2003.  
  2004. function updateLink(linkElement, obj) {
  2005. var css = obj.css;
  2006. var sourceMap = obj.sourceMap;
  2007.  
  2008. if(sourceMap) {
  2009. // http://stackoverflow.com/a/26603875
  2010. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  2011. }
  2012.  
  2013. var blob = new Blob([css], { type: "text/css" });
  2014.  
  2015. var oldSrc = linkElement.href;
  2016.  
  2017. linkElement.href = URL.createObjectURL(blob);
  2018.  
  2019. if(oldSrc)
  2020. URL.revokeObjectURL(oldSrc);
  2021. }
  2022.  
  2023.  
  2024. /***/ }
  2025. /******/ ]);