// ==UserScript== // @name Block somebody // @author burningall // @description 在贴吧屏蔽某人,眼不见心不烦 // @version 2016.6.4 // @include *tieba.baidu.com/p/* // @include *tieba.baidu.com/* // @include *tieba.baidu.com/f?* // @grant GM_addStyle // @grant GM_getValue // @grant GM_setValue // @grant GM_listValues // @grant GM_deleteValue // @grant GM_registerMenuCommand // @run-at document-start // @compatible chrome 两个字,破费 // @compatible firefox 两个字,破费 // @license The MIT License (MIT); http://opensource.org/licenses/MIT // @supportURL http://www.burningall.com // @contributionURL troy450409405@gmail.com|alipay.com // @namespace https://greasyfork.org/zh-CN/users/3400-axetroy // @downloadURL https://update.greasyfork.icu/scripts/19520/Block%20somebody.user.js // @updateURL https://update.greasyfork.icu/scripts/19520/Block%20somebody.meta.js // ==/UserScript== /* Github源码:https://github.com/axetroy/GMscript */ /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var _jqLite = __webpack_require__(1); var _jqLite2 = _interopRequireDefault(_jqLite); var _icon = __webpack_require__(33); var _icon2 = _interopRequireDefault(_icon); var _panel = __webpack_require__(34); var _panel2 = _interopRequireDefault(_panel); var _common = __webpack_require__(36); var _common2 = _interopRequireDefault(_common); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var panel = new _panel2.default(); var POSITION = _common2.default.getPosition(); var initCount = 0; var $icon = (0, _jqLite2.default)(document.createElement("a")).addClass('block-icon').html(_icon2.default); var init = function init() { if (POSITION === 'post') { initCount++; (0, _jqLite2.default)('.p_postlist .l_post').each(function (post) { var $name = (0, _jqLite2.default)(post).find('.d_author ul.p_author li.d_name'); if (!$name[0]) return; var id = $name.find('a[data-field].p_author_name').text().trim(); if (!id) return; var icon = $icon[0].cloneNode(true); if (GM_listValues().indexOf(id) > -1) return post.remove(); if ($name.find('svg').length) return; (0, _jqLite2.default)(icon).click(function () { var bar = _common2.default.getBarName(); var reason = '在帖子中选择'; GM_setValue(id, { id: id, bar: bar, reason: reason, date: new Date() }); (0, _jqLite2.default)('.p_postlist .l_post').each(function (ele) { var username = (0, _jqLite2.default)(ele).attr('data-field').replace(/\'/g, '"'); if (!username) return; username = JSON.parse(username).author.user_name || JSON.parse(username).author.name_u; username = username.replace(/\&ie\=.*$/ig, ''); username = decodeURI(username); if (username === id) ele.remove(); }); }); $name[0].appendChild(icon); }); } else if (POSITION === 'list') { (function () { var interval = setInterval(function () { var postList = (0, _jqLite2.default)('ul#thread_list li[data-field].j_thread_list'); if (!postList.length) return; clearInterval(interval); initCount++; postList.each(function (post) { var $name = (0, _jqLite2.default)(post).find('.j_threadlist_li_right .tb_icon_author'); if (!$name[0]) return; var id = $name.find('a[data-field].frs-author-name').text().trim(); var icon = $icon[0].cloneNode(true); if (GM_listValues().indexOf(id) > -1) return post.remove(); (0, _jqLite2.default)(icon).click(function () { var bar = _common2.default.getBarName(); var reason = '贴吧首页选择'; if (!id) return; GM_setValue(id, { id: id, bar: bar, reason: reason, date: new Date() }); (0, _jqLite2.default)('ul#thread_list li[data-field].j_thread_list').each(function (_post) { var username = (0, _jqLite2.default)(_post).find('a[data-field].frs-author-name').text().trim(); if (!username) return; if (username === id) _post.remove(); }); }); $name[0].appendChild(icon); }); }, 100); })(); } }; (0, _jqLite2.default)(function () { GM_registerMenuCommand("控制面板", panel.create); GM_addStyle(__webpack_require__(38)); (0, _jqLite2.default)(document).bind('keyup', function (e) { if (e.keyCode === 120) panel.create(); }); init(); (0, _jqLite2.default)(document).observe(function (target) { var addedNodes = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1]; var removedNodes = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2]; addedNodes = Array.from(addedNodes); // if (!addedNodes || !addedNodes.length || removedNodes.length) return; addedNodes.forEach(function (node) { // 翻页 if (node.id === 'content_leftList' || node.id === 'j_p_postlist') { initCount > 0 && init(); } }); // 楼中楼翻页 if (target && (0, _jqLite2.default)(target).hasClass('j_lzl_m_w')) { (function () { var $lzlList = (0, _jqLite2.default)(target).find('li.lzl_single_post'); $lzlList.each(function (lzl) { var $lzl = (0, _jqLite2.default)(lzl); if ($lzl.attr('filter')) return; $lzl.attr('filter', true); var id = JSON.parse($lzl.attr('data-field').replace(/\'/g, '"')).user_name; id = decodeURI(id); if (!id) return; if (GM_listValues().indexOf(id) > -1) return lzl.remove(); var $name = $lzl.find('.lzl_cnt'); if ($name.find('svg').length) return; var icon = $icon[0].cloneNode(true); (0, _jqLite2.default)(icon).click(function (e) { var bar = _common2.default.getBarName(); var reason = '楼中楼选择'; GM_setValue(id, { id: id, bar: bar, reason: reason, date: new Date() }); $lzlList.each(function (_lzl) { var username = (0, _jqLite2.default)(_lzl).find('div.lzl_cnt a.j_user_card').text().trim(); if (!username) return; if (username === id) _lzl.remove(); }); }); $lzl.find('.lzl_content_reply')[0].appendChild(icon); // $name[0].insertBefore(icon, $name[0].childNodes[0]); }); })(); } // var $lzlList = (0, _jqLite2.default)('ul.j_lzl_m_w'); if (!$lzlList.length) return; $lzlList.each(function (lzls) { if ((0, _jqLite2.default)(lzls).attr('filter')) return; (0, _jqLite2.default)(lzls).attr('filter', true); (0, _jqLite2.default)(lzls).find('li.lzl_single_post').each(function (lzl) { var $lzl = (0, _jqLite2.default)(lzl); var $name = $lzl.find('.lzl_cnt'); if ($name.find('svg').length) return; var icon = $icon[0].cloneNode(true); var id = JSON.parse($lzl.attr('data-field').replace(/\'/g, '"')).user_name; if (GM_listValues().indexOf(id) > -1) return lzl.remove(); if (!id) return; (0, _jqLite2.default)(icon).click(function (e) { var bar = _common2.default.getBarName(); var reason = '楼中楼选择'; GM_setValue(id, { id: id, bar: bar, reason: reason, date: new Date() }); // 删除当前楼中楼的 $lzlList.each(function (_lzl) { var $floor = (0, _jqLite2.default)(_lzl).find('div.lzl_cnt'); $floor.each(function (_post) { var username = (0, _jqLite2.default)(_post).find('a.j_user_card').text().trim(); if (!username) return; if (username === id) _post.parentElement.remove(); }); }); // 删除帖子里面楼层的 init(); }); // $name[0].insertBefore(icon, $name[0].childNodes[0]); // $name[0].insertBefore(icon, $lzl.find('.lzl_content_reply')); // $lzl.find('.lzl_content_reply')[0].insertBefore(icon, $lzl.find('.lzl_content_reply')[0].childNodes[1]) $lzl.find('.lzl_content_reply')[0].appendChild(icon); }); }); }); }); /***/ }, /* 1 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // es6 Array.from Object.defineProperty(exports, "__esModule", { value: true }); 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; }; 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; }; }(); // es6 Object.assign __webpack_require__(2); __webpack_require__(30); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var noop = function noop(x) { return x; }; var jqLite = function () { function jqLite() { var _this = this; var selectors = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; var context = arguments.length <= 1 || arguments[1] === undefined ? document : arguments[1]; _classCallCheck(this, jqLite); this.selectors = selectors; this.context = context; this.length = 0; switch (typeof selectors === 'undefined' ? 'undefined' : _typeof(selectors)) { case 'undefined': break; case 'string': Array.from(context.querySelectorAll(selectors), function (ele, i) { _this[i] = ele; _this.length++; }, this); break; case 'object': if (selectors.length) { Array.from(selectors, function (ele, i) { _this[i] = ele; _this.length++; }, this); } else { this[0] = selectors; this.length = 1; } break; case 'function': this.ready(selectors); break; default: } } _createClass(jqLite, [{ key: 'eq', value: function eq() { var n = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0]; return new jqLite(this[n]); } }, { key: 'find', value: function find(selectors) { return new jqLite(selectors, this[0]); } }, { key: 'each', value: function each() { var fn = arguments.length <= 0 || arguments[0] === undefined ? noop : arguments[0]; for (var i = 0; i < this.length; i++) { fn.call(this, this[i], i); } return this; } }, { key: 'bind', value: function bind() { var types = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; var fn = arguments.length <= 1 || arguments[1] === undefined ? noop : arguments[1]; this.each(function (ele) { types.trim().split(/\s{1,}/).forEach(function (type) { ele.addEventListener(type, function (e) { var target = e.target || e.srcElement; if (fn.call(target, e) === false) { e.returnValue = true; e.cancelBubble = true; e.preventDefault && e.preventDefault(); e.stopPropagation && e.stopPropagation(); return false; } }, false); }); }); } }, { key: 'click', value: function click() { var fn = arguments.length <= 0 || arguments[0] === undefined ? noop : arguments[0]; this.bind('click', fn); return this; } }, { key: 'ready', value: function ready() { var _this2 = this; var fn = arguments.length <= 0 || arguments[0] === undefined ? noop : arguments[0]; window.addEventListener('DOMContentLoaded', function (e) { fn.call(_this2, e); }, false); } }, { key: 'observe', value: function observe() { var _this3 = this; var fn = arguments.length <= 0 || arguments[0] === undefined ? noop : arguments[0]; var config = arguments.length <= 1 || arguments[1] === undefined ? { childList: true, subtree: true } : arguments[1]; this.each(function (ele) { var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; var observer = new MutationObserver(function (mutations) { mutations.forEach(function (mutation) { fn.call(_this3, mutation.target, mutation.addedNodes, mutation.removedNodes); }); }); observer.observe(ele, config); }); return this; } }, { key: 'attr', value: function (_attr) { function attr(_x, _x2) { return _attr.apply(this, arguments); } attr.toString = function () { return _attr.toString(); }; return attr; }(function (attr, value) { // one agm if (arguments.length === 1) { // get attr value if (typeof attr === 'string') { return this[0].getAttribute(attr); } // set attr with a json else if ((typeof attr === 'undefined' ? 'undefined' : _typeof(attr)) === 'object') { this.each(function (ele) { for (var at in attr) { if (attr.hasOwnProperty(at)) { ele.setAttribute(at, value); } } }); return value; } } // set else if (arguments.length === 2) { this.each(function (ele) { ele.setAttribute(attr, value); }); return this; } else { return this; } }) }, { key: 'removeAttr', value: function removeAttr(attr) { if (arguments.length === 1) { this.each(function (ele) { ele.removeAttribute(attr); }); } return this; } }, { key: 'remove', value: function remove() { this.each(function (ele) { ele.remove(); }); this.length = 0; return this; } // get the element style }, { key: 'style', value: function style(attr) { return this[0].currentStyle ? this[0].currentStyle[attr] : getComputedStyle(this[0])[attr]; } // (attr,value) || 'string' || {} }, { key: 'css', value: function css() { for (var _len = arguments.length, agm = Array(_len), _key = 0; _key < _len; _key++) { agm[_key] = arguments[_key]; } if (agm.length === 1) { // get style if (typeof agm[0] === 'string') { // set style as a long text if (/:/ig.test(agm[0])) { this.each(function (ele) { ele.style.cssText = attr; }); } else { return this[0].currentStyle ? this[0].currentStyle[agm[0]] : getComputedStyle(this[0])[agm[0]]; } } // set style as a object else { this.each(function (ele) { for (var _attr2 in agm[0]) { if (agm[0].hasOwnProperty(_attr2)) { ele.style[_attr2] = agm[0][_attr2]; } } }); } } // set as (key,value) else if (agm.length === 2) { this.each(function (ele) { ele.style[agm[0]] = agm[1]; }); } return this; } }, { key: 'width', value: function width(value) { var element = this[0]; // window or document if (element.window === element || element.body) { return document.body.scrollWidth > document.documentElement.scrollWidth ? document.body.scrollWidth : document.documentElement.scrollWidth; } // set width else if (value) { this.each(function (ele) { ele.style.width = value + 'px'; }); return this; } // get width else { return this[0].offsetWidth || parseFloat(this.style('width')); } } }, { key: 'height', value: function height(value) { var ele = this[0]; // window or document if (ele.window === ele || ele.body) { return document.body.scrollHeight > document.documentElement.scrollHeight ? document.body.scrollHeight : document.documentElement.scrollHeight; } // set height else if (value) { this.each(function (ele) { ele.style.height = value + 'px'; }); return this; } // get height else { return this[0].offsetHeight || parseFloat(this.style('height')); } } }, { key: 'html', value: function html(value) { if (value !== undefined) { this.each(function (ele) { ele.innerHTML = typeof value === 'function' ? value(ele) : value; }); } else { return this[0].innerHTML; } return this; } }, { key: 'text', value: function text(value) { if (value === undefined) return this[0].innerText || this[0].textContent; this.each(function (ele) { ele.innerText = ele.textContent = value; }); return this; } }, { key: 'val', value: function val(value) { if (value === undefined) return this[0].value; this.each(function (ele) { ele.value = value; }); return this; } }, { key: 'show', value: function show() { this.each(function (ele) { ele.style.display = ''; }); return this; } }, { key: 'hide', value: function hide() { this.each(function (ele) { ele.style.display = 'none'; }); return this; } // content str || jqLite Object || DOM // here is jqLite Object }, { key: 'append', value: function append(content) { this.each(function (ele) { ele.appendChild(content[0]); }); return this; } }, { key: 'prepend', // content str || jqLite Object || DOM // here is jqLite Object value: function prepend(content) { this.each(function (ele) { ele.insertBefore(content[0], ele.children[0]); }); return this; } }, { key: 'hasClass', value: function hasClass(className) { if (!this[0]) return false; return this[0].classList.contains(className); } }, { key: 'addClass', value: function addClass(className) { this.each(function (ele) { ele.classList.add(className); }); return this; } }, { key: 'removeClass', value: function removeClass(className) { this.each(function (ele) { ele.classList.remove(className); }); return this; } }, { key: 'index', get: function get() { var index = 0; var brothers = this[0].parentNode.children; for (var i = 0; i < brothers.length; i++) { if (brothers[i] == this[0]) { index = i; break; } } return index; } }], [{ key: 'fn', get: function get() { var visible = function visible(ele) { var pos = ele.getBoundingClientRect(); var w = void 0; var h = void 0; var inViewPort = void 0; var docEle = document.documentElement; var docBody = document.body; if (docEle.getBoundingClientRect) { w = docEle.clientWidth || docBody.clientWidth; h = docEle.clientHeight || docBody.clientHeight; inViewPort = pos.top > h || pos.bottom < 0 || pos.left > w || pos.right < 0; return inViewPort ? false : true; } }; var merge = function merge() { for (var _len2 = arguments.length, sources = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { sources[_key2] = arguments[_key2]; } return Object.assign.apply(Object, [{}].concat(sources)); }; return { visible: visible, merge: merge }; } }]); return jqLite; }(); var $ = function $() { var selectors = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; var context = arguments.length <= 1 || arguments[1] === undefined ? document : arguments[1]; return new jqLite(selectors, context); }; $.fn = jqLite.fn; exports.default = $; /***/ }, /* 2 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var ctx = __webpack_require__(3) , $export = __webpack_require__(5) , toObject = __webpack_require__(15) , call = __webpack_require__(17) , isArrayIter = __webpack_require__(20) , toLength = __webpack_require__(24) , getIterFn = __webpack_require__(26); $export($export.S + $export.F * !__webpack_require__(29)(function(iter){ Array.from(iter); }), 'Array', { // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){ var O = toObject(arrayLike) , C = typeof this == 'function' ? this : Array , $$ = arguments , $$len = $$.length , mapfn = $$len > 1 ? $$[1] : undefined , mapping = mapfn !== undefined , index = 0 , iterFn = getIterFn(O) , length, result, step, iterator; if(mapping)mapfn = ctx(mapfn, $$len > 2 ? $$[2] : undefined, 2); // if object isn't iterable or it's array with default iterator - use simple case if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){ for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){ result[index] = mapping ? call(iterator, mapfn, [step.value, index], true) : step.value; } } else { length = toLength(O.length); for(result = new C(length); length > index; index++){ result[index] = mapping ? mapfn(O[index], index) : O[index]; } } result.length = index; return result; } }); /***/ }, /* 3 */ /***/ function(module, exports, __webpack_require__) { // optional / simple context binding var aFunction = __webpack_require__(4); module.exports = function(fn, that, length){ aFunction(fn); if(that === undefined)return fn; switch(length){ case 1: return function(a){ return fn.call(that, a); }; case 2: return function(a, b){ return fn.call(that, a, b); }; case 3: return function(a, b, c){ return fn.call(that, a, b, c); }; } return function(/* ...args */){ return fn.apply(that, arguments); }; }; /***/ }, /* 4 */ /***/ function(module, exports) { module.exports = function(it){ if(typeof it != 'function')throw TypeError(it + ' is not a function!'); return it; }; /***/ }, /* 5 */ /***/ function(module, exports, __webpack_require__) { var global = __webpack_require__(6) , core = __webpack_require__(7) , hide = __webpack_require__(8) , redefine = __webpack_require__(13) , ctx = __webpack_require__(3) , PROTOTYPE = 'prototype'; var $export = function(type, name, source){ var IS_FORCED = type & $export.F , IS_GLOBAL = type & $export.G , IS_STATIC = type & $export.S , IS_PROTO = type & $export.P , IS_BIND = type & $export.B , target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE] , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) , expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}) , key, own, out, exp; if(IS_GLOBAL)source = name; for(key in source){ // contains in native own = !IS_FORCED && target && key in target; // export native or passed out = (own ? target : source)[key]; // bind timers to global for call from export context exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; // extend global if(target && !own)redefine(target, key, out); // export if(exports[key] != out)hide(exports, key, exp); if(IS_PROTO && expProto[key] != out)expProto[key] = out; } }; global.core = core; // type bitmap $export.F = 1; // forced $export.G = 2; // global $export.S = 4; // static $export.P = 8; // proto $export.B = 16; // bind $export.W = 32; // wrap module.exports = $export; /***/ }, /* 6 */ /***/ function(module, exports) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef /***/ }, /* 7 */ /***/ function(module, exports) { var core = module.exports = {version: '1.2.6'}; if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef /***/ }, /* 8 */ /***/ function(module, exports, __webpack_require__) { var $ = __webpack_require__(9) , createDesc = __webpack_require__(10); module.exports = __webpack_require__(11) ? function(object, key, value){ return $.setDesc(object, key, createDesc(1, value)); } : function(object, key, value){ object[key] = value; return object; }; /***/ }, /* 9 */ /***/ function(module, exports) { var $Object = Object; module.exports = { create: $Object.create, getProto: $Object.getPrototypeOf, isEnum: {}.propertyIsEnumerable, getDesc: $Object.getOwnPropertyDescriptor, setDesc: $Object.defineProperty, setDescs: $Object.defineProperties, getKeys: $Object.keys, getNames: $Object.getOwnPropertyNames, getSymbols: $Object.getOwnPropertySymbols, each: [].forEach }; /***/ }, /* 10 */ /***/ function(module, exports) { module.exports = function(bitmap, value){ return { enumerable : !(bitmap & 1), configurable: !(bitmap & 2), writable : !(bitmap & 4), value : value }; }; /***/ }, /* 11 */ /***/ function(module, exports, __webpack_require__) { // Thank's IE8 for his funny defineProperty module.exports = !__webpack_require__(12)(function(){ return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; }); /***/ }, /* 12 */ /***/ function(module, exports) { module.exports = function(exec){ try { return !!exec(); } catch(e){ return true; } }; /***/ }, /* 13 */ /***/ function(module, exports, __webpack_require__) { // add fake Function#toString // for correct work wrapped methods / constructors with methods like LoDash isNative var global = __webpack_require__(6) , hide = __webpack_require__(8) , SRC = __webpack_require__(14)('src') , TO_STRING = 'toString' , $toString = Function[TO_STRING] , TPL = ('' + $toString).split(TO_STRING); __webpack_require__(7).inspectSource = function(it){ return $toString.call(it); }; (module.exports = function(O, key, val, safe){ if(typeof val == 'function'){ val.hasOwnProperty(SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); val.hasOwnProperty('name') || hide(val, 'name', key); } if(O === global){ O[key] = val; } else { if(!safe)delete O[key]; hide(O, key, val); } })(Function.prototype, TO_STRING, function toString(){ return typeof this == 'function' && this[SRC] || $toString.call(this); }); /***/ }, /* 14 */ /***/ function(module, exports) { var id = 0 , px = Math.random(); module.exports = function(key){ return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; /***/ }, /* 15 */ /***/ function(module, exports, __webpack_require__) { // 7.1.13 ToObject(argument) var defined = __webpack_require__(16); module.exports = function(it){ return Object(defined(it)); }; /***/ }, /* 16 */ /***/ function(module, exports) { // 7.2.1 RequireObjectCoercible(argument) module.exports = function(it){ if(it == undefined)throw TypeError("Can't call method on " + it); return it; }; /***/ }, /* 17 */ /***/ function(module, exports, __webpack_require__) { // call something on iterator step with safe closing on error var anObject = __webpack_require__(18); module.exports = function(iterator, fn, value, entries){ try { return entries ? fn(anObject(value)[0], value[1]) : fn(value); // 7.4.6 IteratorClose(iterator, completion) } catch(e){ var ret = iterator['return']; if(ret !== undefined)anObject(ret.call(iterator)); throw e; } }; /***/ }, /* 18 */ /***/ function(module, exports, __webpack_require__) { var isObject = __webpack_require__(19); module.exports = function(it){ if(!isObject(it))throw TypeError(it + ' is not an object!'); return it; }; /***/ }, /* 19 */ /***/ function(module, exports) { module.exports = function(it){ return typeof it === 'object' ? it !== null : typeof it === 'function'; }; /***/ }, /* 20 */ /***/ function(module, exports, __webpack_require__) { // check on default Array iterator var Iterators = __webpack_require__(21) , ITERATOR = __webpack_require__(22)('iterator') , ArrayProto = Array.prototype; module.exports = function(it){ return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); }; /***/ }, /* 21 */ /***/ function(module, exports) { module.exports = {}; /***/ }, /* 22 */ /***/ function(module, exports, __webpack_require__) { var store = __webpack_require__(23)('wks') , uid = __webpack_require__(14) , Symbol = __webpack_require__(6).Symbol; module.exports = function(name){ return store[name] || (store[name] = Symbol && Symbol[name] || (Symbol || uid)('Symbol.' + name)); }; /***/ }, /* 23 */ /***/ function(module, exports, __webpack_require__) { var global = __webpack_require__(6) , SHARED = '__core-js_shared__' , store = global[SHARED] || (global[SHARED] = {}); module.exports = function(key){ return store[key] || (store[key] = {}); }; /***/ }, /* 24 */ /***/ function(module, exports, __webpack_require__) { // 7.1.15 ToLength var toInteger = __webpack_require__(25) , min = Math.min; module.exports = function(it){ return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 }; /***/ }, /* 25 */ /***/ function(module, exports) { // 7.1.4 ToInteger var ceil = Math.ceil , floor = Math.floor; module.exports = function(it){ return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); }; /***/ }, /* 26 */ /***/ function(module, exports, __webpack_require__) { var classof = __webpack_require__(27) , ITERATOR = __webpack_require__(22)('iterator') , Iterators = __webpack_require__(21); module.exports = __webpack_require__(7).getIteratorMethod = function(it){ if(it != undefined)return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; }; /***/ }, /* 27 */ /***/ function(module, exports, __webpack_require__) { // getting tag from 19.1.3.6 Object.prototype.toString() var cof = __webpack_require__(28) , TAG = __webpack_require__(22)('toStringTag') // ES3 wrong here , ARG = cof(function(){ return arguments; }()) == 'Arguments'; module.exports = function(it){ var O, T, B; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (T = (O = Object(it))[TAG]) == 'string' ? T // builtinTag case : ARG ? cof(O) // ES3 arguments fallback : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; }; /***/ }, /* 28 */ /***/ function(module, exports) { var toString = {}.toString; module.exports = function(it){ return toString.call(it).slice(8, -1); }; /***/ }, /* 29 */ /***/ function(module, exports, __webpack_require__) { var ITERATOR = __webpack_require__(22)('iterator') , SAFE_CLOSING = false; try { var riter = [7][ITERATOR](); riter['return'] = function(){ SAFE_CLOSING = true; }; Array.from(riter, function(){ throw 2; }); } catch(e){ /* empty */ } module.exports = function(exec, skipClosing){ if(!skipClosing && !SAFE_CLOSING)return false; var safe = false; try { var arr = [7] , iter = arr[ITERATOR](); iter.next = function(){ safe = true; }; arr[ITERATOR] = function(){ return iter; }; exec(arr); } catch(e){ /* empty */ } return safe; }; /***/ }, /* 30 */ /***/ function(module, exports, __webpack_require__) { // 19.1.3.1 Object.assign(target, source) var $export = __webpack_require__(5); $export($export.S + $export.F, 'Object', {assign: __webpack_require__(31)}); /***/ }, /* 31 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.1 Object.assign(target, source, ...) var $ = __webpack_require__(9) , toObject = __webpack_require__(15) , IObject = __webpack_require__(32); // should work with symbols and should have deterministic property order (V8 bug) module.exports = __webpack_require__(12)(function(){ var a = Object.assign , A = {} , B = {} , S = Symbol() , K = 'abcdefghijklmnopqrst'; A[S] = 7; K.split('').forEach(function(k){ B[k] = k; }); return a({}, A)[S] != 7 || Object.keys(a({}, B)).join('') != K; }) ? function assign(target, source){ // eslint-disable-line no-unused-vars var T = toObject(target) , $$ = arguments , $$len = $$.length , index = 1 , getKeys = $.getKeys , getSymbols = $.getSymbols , isEnum = $.isEnum; while($$len > index){ var S = IObject($$[index++]) , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S) , length = keys.length , j = 0 , key; while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key]; } return T; } : Object.assign; /***/ }, /* 32 */ /***/ function(module, exports, __webpack_require__) { // fallback for non-array-like ES3 and non-enumerable old V8 strings var cof = __webpack_require__(28); module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ return cof(it) == 'String' ? it.split('') : Object(it); }; /***/ }, /* 33 */ /***/ function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Created by axetroy on 5/8/16. */ var svg = "\n\n\n \n \n \n \n\n"; exports.default = svg; /***/ }, /* 34 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); 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"); } }; }(); 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; }; }(); /** * Created by axetroy on 5/10/16. */ var _jqLite = __webpack_require__(1); var _jqLite2 = _interopRequireDefault(_jqLite); var _formatDate = __webpack_require__(35); var _formatDate2 = _interopRequireDefault(_formatDate); var _common = __webpack_require__(36); var _common2 = _interopRequireDefault(_common); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Panel = function () { function Panel() { _classCallCheck(this, Panel); } _createClass(Panel, [{ key: 'create', value: function create() { if ((0, _jqLite2.default)('#block-mask').length) return; var root = document.createElement('div'); this.$mask = (0, _jqLite2.default)(root.cloneNode(false)).attr('id', 'block-mask'); this.$panel = (0, _jqLite2.default)(root.cloneNode(false)).attr('id', 'block-panel').html(__webpack_require__(37)); this.$mask.append(this.$panel); this.$menu = this.$panel.find('.block-menu ul li'); this.$session = this.$panel.find('.block-content .session'); this.$config = this.$session.eq(0); this.$block = this.$session.eq(1); this.$list = this.$session.eq(2); this.init(); this.link(); document.documentElement.appendChild(this.$mask[0]); return this; } }, { key: 'remove', value: function remove() { this.$mask.remove(); } }, { key: 'link', value: function link() { var _this2 = this; var _this = this; // 屏蔽列表的点击事件 this.$list.click(function (e) { var $target = (0, _jqLite2.default)(e.target); var index = +$target.attr('list-index'); var blockID = $target.attr('block-id'); _this2.$list.find('table>tbody>tr').each(function (ele) { if ((0, _jqLite2.default)(ele).find('.block-remove').attr('block-id') === blockID) { ele.remove(); GM_deleteValue(blockID); } }); }); // 控制面板的切换 this.$menu.click(function (e) { var index = (0, _jqLite2.default)(e.target).index; _this2.$menu.removeClass('active').eq(index).addClass('active'); _this2.$session.hide().eq(index).show(); return false; }); // 点击屏蔽按钮 // block someone this.$block.find('.block-block-submit').click(function (e) { var _map = ['id', 'bar', 'reason'].map(function (name) { return _this2.$block.find('.block-' + name); }); var _map2 = _slicedToArray(_map, 3); var $id = _map2[0]; var $bar = _map2[1]; var $reason = _map2[2]; var _map3 = [$id, $bar, $reason].map(function (input) { return input.val(); }); var _map4 = _slicedToArray(_map3, 3); var id = _map4[0]; var bar = _map4[1]; var reason = _map4[2]; if (!id) return; GM_setValue(id, { id: id, bar: bar, reason: reason, date: new Date() }); $id.val(''); $reason.val(''); }); // 关掉控制面板 this.$mask.click(function (e) { if ((0, _jqLite2.default)(e.target).attr('id') === 'block-mask') _this2.remove(); }); } }, { key: 'init', value: function init() { this.$menu.eq(0).addClass('active'); this.$session.hide().eq(0).show(); this.$panel.find('.block-bar').val(_common2.default.getBarName()); this.$list.html(function () { var GMList = GM_listValues(); var list = []; for (var i = 0; i < GMList.length; i++) { list[i] = GM_getValue(GMList[i]); } var tableStr = ''; list.forEach(function (v, i) { var time = ''; if (v.date) { var date = new Date(v.date); time = (0, _formatDate2.default)(date, 'yyyy-MM-dd'); } tableStr += '\n \n ' + v.id + '\n ' + v.bar + '\n ' + v.reason + '\n ' + time + '\n \n 移除\n \n \n '; }); return '\n \n \n \n \n \n \n \n \n \n \n \n ' + tableStr + '\n \n
贴吧ID所在贴吧屏蔽理由屏蔽时间操作
\n '; }); } }]); return Panel; }(); exports.default = Panel; /***/ }, /* 35 */ /***/ function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = formatDate; function formatDate(date, fmt) { var o = { "M+": date.getMonth() + 1, //月份 "d+": date.getDate(), //日 "h+": date.getHours(), //小时 "m+": date.getMinutes(), //分 "s+": date.getSeconds(), //秒 "q+": Math.floor((date.getMonth() + 3) / 3), //季度 "S": date.getMilliseconds() //毫秒 }; if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) { if (new RegExp("(" + k + ")").test(fmt)) { fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)); } } return fmt; }; /***/ }, /* 36 */ /***/ function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var common = { // 获取当前所在的位置,是贴吧列表,还是贴吧内容页 getPosition: function getPosition() { var url = location.href; var postInside = /.*tieba.baidu.com\/p\/.*/ig; var postList = /.*tieba.baidu.com\/(f\?.*|[^p])/ig; return postInside.test(url) ? 'post' : postList.test(url) ? 'list' : null; }, // 获取当前页的贴吧名 getBarName: function getBarName() { return $(".card_title_fname").text().trim(); } }; exports.default = common; /***/ }, /* 37 */ /***/ function(module, exports) { module.exports = "

控制面板

\n
\n\n
\n \n
\n\n
\n\n
\n

暂时没什么可配置的...

\n
\n\n
\n\n
\n
\n \n \n
\n\n
\n \n \n
\n\n
\n \n \n
\n\n \n
\n\n
\n\n
\n
\n
\n\n
\n\n
"; /***/ }, /* 38 */ /***/ function(module, exports, __webpack_require__) { // style-loader: Adds some css to the DOM by adding a