// ==UserScript==
// @name 边读边看图
// @namespace http://tampermonkey.net/
// @version 0.8.8
// @description 功能一览:1、双击把图片固定在页面上,同时支持缩放、移动功能,便于图文对照阅读; 2、使用浏览器查看在线图片或本地图片时,增加页面背景图,以便清晰显示当前图片轮廓 3、打开链接方式,总是以命名的新窗口 4、点击链接文本时,跳转相应链接 5、复制所选文字:鼠标选中文字,0.5秒后,自动复制到剪贴板 6、一键复制代码块:鼠标悬浮代码块后,点击显示的红色边框,复制到剪贴板 7、CSDN:仅在主动触发登录时,显示登录弹层 8、微信公证号文章:内容左对齐;列表增加序号和斑马纹,便于阅读。【最后:1、localStorage中,支持配置】
// @author Enjoy
// @icon https://foruda.gitee.com/avatar/1698283059572409586/4867929_enjoy_li_1698283059.png!avatar200
// @match *://*/*
// @match file:///*
// @grant GM_addElement
// @grant GM_setClipboard
// @license GPL License
// 函数文档 https://www.tampermonkey.net/documentation.php#api:GM_addElement
// ==/UserScript==
/******/ (() => { // webpackBootstrap
/******/ "use strict";
var __webpack_exports__ = {};
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js
function _toPrimitive(input, hint) {
if (_typeof(input) !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (_typeof(res) !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return _typeof(key) === "symbol" ? key : String(key);
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
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, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
;// CONCATENATED MODULE: ./tools/GM.js
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
/** @描述 函数文档 https://www.tampermonkey.net/documentation.php#api:GM_addElement */
function createElement(tag) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var win = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : window;
if (!win.GM_createElement) {
win.GM_createElement = GM_createElement;
}
return GM_createElement(tag, options);
/**
* @param {*} tag
* @param {*} options {
* idPrefix = `enjoy_${ENV_CRX}_${tag}`,
* el = 'html',
* autoInsert = true,
* randomType = 'single',
* id = '',
* addPrefix = true,
* insertType = tag === 'style' ? 'appendChild' : 'prepend',
* }
* @returns {*} dom
*/
function GM_createElement(tag, options) {
var _options$idPrefix = options.idPrefix,
idPrefix = _options$idPrefix === void 0 ? "enjoy_".concat("ImgPreview", "_").concat(tag, "_") : _options$idPrefix,
_options$el = options.el,
el = _options$el === void 0 ? 'html' : _options$el,
_options$autoInsert = options.autoInsert,
autoInsert = _options$autoInsert === void 0 ? true : _options$autoInsert,
_options$randomType = options.randomType,
randomType = _options$randomType === void 0 ? 'single' : _options$randomType,
_options$id = options.id,
id = _options$id === void 0 ? '' : _options$id,
_options$addPrefix = options.addPrefix,
addPrefix = _options$addPrefix === void 0 ? true : _options$addPrefix,
_options$insertType = options.insertType,
insertType = _options$insertType === void 0 ? tag === 'style' ? 'appendChild' : 'prepend' : _options$insertType;
if (addPrefix) {
id = "".concat(idPrefix).concat(id);
}
if (randomType !== 'single') {
id = "".concat(id, "_").concat(Math.floor(Math.random() * 1000));
}
options.id = id;
var dom = document.querySelector("#".concat(id));
if (!dom) {
dom = document.createElement(tag);
}
for (var key in options) {
if (Object.hasOwnProperty.call(options, key) && key !== 'el') {
dom[key] = options[key];
}
}
if (autoInsert) {
if (typeof el === 'string') {
el = document.querySelector(el);
}
//insertType prepend | appendChild
el[insertType](dom);
}
return dom;
}
}
/** @描述 是否匹配到目标url */
function isMatched() {
var urls = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var currentUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : location.href;
if (typeof urls === 'string') {
urls = [urls];
}
return !!urls.find(function (regUrl) {
return new RegExp(regUrl).test(currentUrl);
});
}
function prependMetaUF8() {
return document.querySelector('meta[charset="UTF-8"]') || createElement('meta', {
charset: 'utf-8'
});
}
function doCopy(newValue) {
var _navigator;
var selector = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'textarea';
if ((_navigator = navigator) !== null && _navigator !== void 0 && (_navigator = _navigator.clipboard) !== null && _navigator !== void 0 && _navigator.writeText) {
// 读取剪贴板
// navigator.clipboard.readText().then((clipText) => {console.log('clipText=',clipText)})
// 写入剪贴板
navigator.clipboard.writeText(newValue)["catch"](function (err) {
return console.error("clipboard.writeText\uFF1A".concat(err));
});
return;
}
var textarea = createElement('textarea', {
el: 'body',
id: selector,
style: 'position: absolute;left: -500px;top: -500px;max-width: 50px;opacity: 0;'
});
textarea.value = newValue;
textarea.select();
setTimeout(function () {
document.execCommand('Copy');
}, 200);
}
function createElementTipFn() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var _options$setTimeoutSt = options.setTimeoutStep,
setTimeoutStep = _options$setTimeoutSt === void 0 ? 1000 : _options$setTimeoutSt,
_options$backgroundCo = options.backgroundColors,
backgroundColors = _options$backgroundCo === void 0 ? {
warn: 'rgb(181 156 51 / 60%)',
success: 'rgb(3 113 3 / 60%)',
error: 'rgb(165 2 2 / 60%)',
info: 'rgb(67 62 62 / 60%)'
} : _options$backgroundCo,
_options$color = options.color,
color = _options$color === void 0 ? '#ffffff' : _options$color,
_options$opacity = options.opacity,
opacity = _options$opacity === void 0 ? 1 : _options$opacity;
var setTimeoutStamp = 0;
return function createElementTip() {
var configs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var content = configs.content,
e = configs.e,
_configs$type = configs.type,
type = _configs$type === void 0 ? 'info' : _configs$type,
_configs$tagType = configs.tagType,
tagType = _configs$tagType === void 0 ? 'span' : _configs$tagType;
if (!content) return;
console.log("content => %O ", content);
clearTimeout(setTimeoutStamp);
var contentDom = createElement(tagType, {
id: 'createElementTip',
innerText: content,
style: "\n font-size:14px;\n font-weight:600;\n color:".concat(color, ";\n position: fixed;\n left: ").concat(numbericalInterval(e.clientX - 46), "px;\n top: ").concat(numbericalInterval(e.clientY - 30, [5, window.innerHeight - 35]), "px;\n background-color:").concat(backgroundColors[type], ";\n opacity: ").concat(opacity, ";\n border-radius: 4px;\n padding: 4px 8px;\n box-shadow:0 0 5px 0 rgb(255 255 255 / 60%) inset;\n z-index:").concat((Math.floor(Date.now() / 1000) + '').slice(-5), "\n ")
});
setTimeoutStamp = setTimeout(function () {
contentDom.remove();
}, setTimeoutStep);
};
}
/**
* @description dom是否可编辑
* @param {*} [dom=document.activeElement]
* @returns {*} {boolean}
*/
function isContentEditableOfDOM() {
var dom = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.activeElement;
var activeElement = dom;
if (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA' || activeElement.contenEditable === 'true') return true;
return false;
}
/**
* @description 数字区间
* @param {*} val
* @param {*} [interval=[10, window.innerWidth]]
* @returns {*}
*/
function numbericalInterval(val) {
var interval = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [5, window.innerWidth - 130];
var indexStart = interval[0];
var indexEnd = interval[1];
if (val < indexStart) return indexStart;
if (val > indexEnd) return indexEnd;
return val;
}
/**
* @description 可滚动的dom
* @param {*} dom
* @returns {*}
*/
function findHasScrollbarDom(dom) {
while (dom) {
if (dom.offsetHeight < dom.scrollHeight && window.getComputedStyle(dom).overflowY !== 'visible') {
break;
}
dom = dom.parentElement;
}
if (!dom || dom === document.body) {
// 始终是 documentElement等同于window
dom = document.documentElement;
}
console.warn("\u9875\u9762\u6EDA\u52A8\u5143\u7D20\u7684tagName: ", dom.tagName.toLocaleLowerCase());
return dom;
}
/**
* @description 获取方法配置
* @param {string} [key='']
* @param {*} [defaultOpt={ includedUrls: [] }]
* @returns {*} {Object}
**/
function getSettingFromLocalStorage() {
var _localStorage, _localStorage2;
var fileName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var defaultOpt = arguments.length > 1 ? arguments[1] : undefined;
var mergedSettingOpt = _objectSpread({
runType: '0',
includedUrls: [],
excludeUrls: []
}, defaultOpt);
var fullSettingKey = "\uD83C\uDF1F_enjoy_setting";
var fullSettings = (_localStorage = localStorage) !== null && _localStorage !== void 0 && _localStorage[fullSettingKey] ? JSON.parse((_localStorage2 = localStorage) === null || _localStorage2 === void 0 ? void 0 : _localStorage2[fullSettingKey]) : {};
var SETTING = _objectSpread(_objectSpread({}, mergedSettingOpt), fullSettings === null || fullSettings === void 0 ? void 0 : fullSettings[fileName]);
fullSettings[fileName] = SETTING;
fullSettings.runTypeDest = undefined;
fullSettings.instructions = "\n\u4E00\u3001\u5339\u914D\u89C4\u5219\u4F18\u5148\u7EA7\uFF1Aruntype > * > excludedUrls > includedUrls\n\u4E8C\u3001runType\u662F\u9488\u5BF9\u5728\u5F53\u524D\u57DF\u540D\u89C4\u5219\uFF1A0(\u9ED8\u8BA4\u6267\u884C\u5339\u914D\u89C4\u5219)\uFF1B1(\u5F3A\u5236\u6267\u884C,\u5373\u8DF3\u8FC7\u5339\u914D\u89C4\u5219)\uFF1B2(\u4E0D\u6267\u884C)\n";
localStorage[fullSettingKey] = JSON.stringify(fullSettings || {});
return SETTING;
}
/**
* @description 是否执行该方法
* @param {*} [settingOpt={}]
* @returns {*} {Boolean}
*/
function isExcutableBySetting() {
var settingOpt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var runType = settingOpt.runType,
_settingOpt$excludeUr = settingOpt.excludeUrls,
excludeUrls = _settingOpt$excludeUr === void 0 ? [] : _settingOpt$excludeUr,
_settingOpt$includedU = settingOpt.includedUrls,
includedUrls = _settingOpt$includedU === void 0 ? [] : _settingOpt$includedU;
if (runType === '1') return true;
if (runType === '2') return false;
var HREF = location.href;
if (excludeUrls !== null && excludeUrls !== void 0 && excludeUrls.length && isMatched(excludeUrls, HREF)) {
return false;
}
if ((includedUrls === null || includedUrls === void 0 ? void 0 : includedUrls.length) === 0) return true;
var findOne = isMatched(includedUrls, HREF);
return !!findOne;
}
/**
* @description 是否不执行
* @param {*} fileName
* @param {*} settingOpt
* @returns {*} {Boolean}
*/
function codeIsNotExcutable(fileName, settingOpt) {
logSettingOptWithColor();
return !isExcutableBySetting(getSettingFromLocalStorage(fileName, settingOpt));
}
/**
* @description 彩色打印
* @param {string} [key='🌟_enjoy_setting']
*/
function logSettingOptWithColor(key) {
var dataKey = 'is-log-of-enjoy';
if (document.body.getAttribute(dataKey)) return;
document.body.setAttribute(dataKey, '1');
setTimeout(function () {
var _key;
(_key = key) !== null && _key !== void 0 ? _key : key = '🌟_enjoy_setting';
var SETTINGS = JSON.parse(localStorage[key] || '{}');
console.log("%c\uD83D\uDC47 ".concat(key, " \u8BBE\u7F6E\u53C2\u6570\uFF1A"), 'background:#4e0ab780;color:#fff;', '\n', SETTINGS, "\n\nkeyNameList:", Object.keys(SETTINGS));
console.log("%c\uD83D\uDC47\u81EA\u5B9A\u4E49\u914D\u7F6E\uFF0C\u4EE3\u7801\u5982\u4E0B\uFF1A", 'background:#4e0ab747;color:#fff;', "\n\u5F53\u524D\u57DF\u540D\u4E0B\u662F\u5426\u8FD0\u884C\u76F8\u5E94\u51FD\u6570,", "\n\u8BBE\u7F6ErunType(1\u3001\u5F3A\u5236\u8FD0\u884C\uFF1B2\u3001\u4E0D\u8FD0\u884C)\u3002", '\n\n', modifyRuntype.toString(), "\nmodifyRuntype('keyName',2)");
}, 3 * 1000);
}
function modifyRuntype(keyName, runType) {
var keyOfSETTINGS = '🌟_enjoy_setting';
var SETTINGS = JSON.parse(localStorage[keyOfSETTINGS] || '{}');
if (!SETTINGS[keyName]) return;
SETTINGS[keyName].runType = runType || 2;
localStorage[keyOfSETTINGS] = JSON.stringify(SETTINGS);
}
;// CONCATENATED MODULE: ./src/tool/previewImg.js
var ImgPreviewer = /*#__PURE__*/function () {
function ImgPreviewer() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
_classCallCheck(this, ImgPreviewer);
/** @描述 状态 */
_defineProperty(this, "state", null);
_defineProperty(this, "shadowRoot", null);
this.state = this.mergeOptions(options);
this.shadowRoot = this.createShadowRoot();
this.onPreviwerEvent();
return this.shadowRoot;
}
_createClass(ImgPreviewer, [{
key: "createShadowRoot",
value: /** @描述 创建 shadowRoot */
function createShadowRoot() {
var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '#imgPreview';
selector = selector.replace(/[.#]/g, '');
var dom = document.querySelector("#".concat(selector));
if (!dom) {
dom = createElement('div', {
addPrefix: false,
id: selector,
style: 'width:0;height:0'
});
}
if (!dom.shadowRoot) {
// 添加在body下,获取 dom.shadowRoot
dom.attachShadow({
mode: 'open'
});
// dom.shadowRoot.appendChild(maskContent)
// 创建蒙层容器
var maskContent = createElement('div', {
className: 'modal',
el: dom.shadowRoot
});
maskContent.appendChild(this.createStyle(this.state));
}
return dom.shadowRoot;
}
/** @描述 合并选项 */
}, {
key: "mergeOptions",
value: function mergeOptions(options) {
var opt = {};
var defaultOptions = {
contentSelector: 'body',
selector: 'img',
showRootSelector: '#img_preview',
backgroundColor: 'rgba(0,0,0,0)',
extraStyle: ''
};
Object.assign(opt, defaultOptions, options);
return opt;
}
/** @描述 创建shadowbox中的样式 */
}, {
key: "createStyle",
value: function createStyle(_ref) {
var contentSelector = _ref.contentSelector,
selector = _ref.selector,
backgroundColor = _ref.backgroundColor,
extraStyle = _ref.extraStyle;
return createElement('style', {
autoInsert: false,
randomType: 'newOne',
innerHTML: "".concat(contentSelector, " ").concat(selector, " {\n cursor: zoom-in;\n }\n /* \u56FE\u7247\u9884\u89C8 */\n .modal {\n touch-action: none;\n position: fixed;\n z-index: 10000;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background-color: ").concat(backgroundColor, ";\n user-select: none;\n pointer-events: none;\n }\n .modal>*{\n pointer-events: auto;\n }\n .modal>img {\n position: absolute;\n padding: 0;\n margin: 0;\n box-shadow: rgb(27 115 7 / 71%) 0px 0px 5px 5px;\n border-radius: 10px;\n /* transition: all var(--delay_time); */\n transform: translateZ(0);\n }\n\n img.active {\n animation: activeImg 0.5s 4 ease-out forwards;\n transition: all;\n\n }\n\n @keyframes activeImg {\n 0% {\n box-shadow: rgb(27 115 7 / 71%) 0px 0px 5px 5px;\n }\n 50% {\n box-shadow: rgb(255 0 0 / 66%) 0px 0px 5px 5px;\n }\n 100% {\n box-shadow: rgb(239 126 4 / 75%) 0px 0px 5px 5px;\n }\n }\n ").concat(extraStyle, "\n ")
});
}
/** @描述 预览操作 */
}, {
key: "onPreviwerEvent",
value: function onPreviwerEvent() {
var that = this;
var _that$state = that.state,
contentSelector = _that$state.contentSelector,
selector = _that$state.selector;
var eventsProxy = document.querySelector(contentSelector) || window.document.body;
eventsProxy.addEventListener('dblclick', function (e) {
var src = that.getImgSrc(e.target);
if (!src) return;
e.preventDefault();
var findOneInPage = _toConsumableArray(eventsProxy.querySelectorAll(selector)).find(function (item) {
return item === e.target;
});
if (findOneInPage) {
var findOneInModal = _toConsumableArray(that.shadowRoot.querySelectorAll(selector)).find(function (item) {
return that.getImgSrc(item) === src;
});
if (findOneInModal) {
if (!findOneInModal.classList.contains('active')) {
findOneInModal.classList.add('active');
findOneInModal.remove();
that.shadowRoot.querySelector('.modal').appendChild(findOneInModal);
return;
} else {
findOneInModal.remove();
findOneInModal = null;
}
}
// else
if (!findOneInModal) {
// originalEl.style.opacity = 0
new ImgItemInModal(that.shadowRoot, e.target, src);
}
}
});
}
}, {
key: "getImgSrc",
value: function getImgSrc(dom) {
var _dom$dataset, _window$getComputedSt;
return (dom === null || dom === void 0 || (_dom$dataset = dom.dataset) === null || _dom$dataset === void 0 ? void 0 : _dom$dataset.src) || (dom === null || dom === void 0 ? void 0 : dom.src) || ((_window$getComputedSt = window.getComputedStyle(dom).backgroundImage.match(/^url\("([^\s]+)"\)$/i)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt[1]);
}
}]);
return ImgPreviewer;
}();
var ImgItemInModal = /*#__PURE__*/function () {
function ImgItemInModal(shadowRoot, originalEl, src) {
var _this = this;
_classCallCheck(this, ImgItemInModal);
_defineProperty(this, "state", {
scale: 1,
offset: {
left: 0,
top: 0
},
origin: 'center',
initialData: {
offset: {},
origin: 'center',
scale: 1
},
startPoint: {
x: 0,
y: 0
},
// 记录初始触摸点位
isTouching: false,
// 标记是否正在移动
isMove: false,
// 正在移动中,与点击做区别
touches: new Map(),
// 触摸点数组
lastDistance: 0,
lastScale: 1,
// 记录下最后的缩放值
scaleOrigin: {
x: 0,
y: 0
}
});
/** @描述 双击事件 */
_defineProperty(this, "ondblclick", function (e) {
e.preventDefault();
var that = _this;
var state = that.state;
setTimeout(function () {
if (state.isMove) {
state.isMove = false;
} else {
that.changeStyle(state.cloneEl, ['transition: all .3s', "left: ".concat(state.left, "px"), "top: ".concat(state.top, "px"), "transform: translate(0,0)", "width: ".concat(state.offsetWidth, "px")]);
setTimeout(function () {
state.maskContent.removeChild(state.cloneEl);
// originalEl.style.opacity = 1
state.cloneEl.removeEventListener('dblclick', that.ondblclick);
}, 300);
}
}, 280);
});
/** @描述 指针按下事件*/
_defineProperty(this, "onpointerdown", function (e) {
e.preventDefault();
var that = _this;
var state = that.state;
state.touches.set(e.pointerId, e);
// TODO: 点击存入触摸点
state.isTouching = true;
state.startPoint = {
x: e.clientX,
y: e.clientY
};
if (state.touches.size === 2) {
// TODO: 判断双指触摸,并立即记录初始数据
state.lastDistance = that.getDistance();
state.lastScale = state.scale;
}
});
/** @描述 滚轮缩放 */
_defineProperty(this, "onmousewheel", function (e) {
e.preventDefault();
if (!e.deltaY) return;
var that = _this;
var state = that.state;
state.origin = "".concat(e.offsetX, "px ").concat(e.offsetY, "px");
// 缩放执行
if (e.deltaY < 0) {
// 放大
state.scale += 0.1;
} else if (e.deltaY > 0) {
state.scale >= 0.2 && (state.scale -= 0.1);
// 缩小
}
if (state.scale < state.initialData.scale) {
console.log("state.scale < state.initialData.scale => %O ", state.scale, state.initialData.scale);
that.reduction();
}
state.offset = that.getOffsetPageCenter(e.offsetX, e.offsetY);
that.changeStyle(state.cloneEl, ['transition: all .15s', "transform-origin: ".concat(state.origin), "transform: translate(".concat(state.offset.left + 'px', ", ").concat(state.offset.top + 'px', ") scale(").concat(state.scale, ")")]);
});
/** @描述 松开指针 事件 */
_defineProperty(this, "onpointerup", function (e) {
e.preventDefault();
var that = _this;
var state = that.state;
state.touches["delete"](e.pointerId);
// TODO: 抬起移除触摸点
if (state.touches.size <= 0) {
state.isTouching = false;
} else {
var touchArr = Array.from(state.touches);
// 更新点位
state.startPoint = {
x: touchArr[0][1].clientX,
y: touchArr[0][1].clientY
};
}
setTimeout(function () {
state.isMove = false;
}, 300);
});
/** @描述 指针移动事件 */
_defineProperty(this, "onpointermove", function (e) {
e.preventDefault();
var that = _this;
var state = that.state;
if (state.isTouching) {
state.isMove = true;
if (state.touches.size < 2) {
// 单指滑动
state.offset = {
left: state.offset.left + (e.clientX - state.startPoint.x),
top: state.offset.top + (e.clientY - state.startPoint.y)
};
that.changeStyle(state.cloneEl, ['transition: all 0s', "transform: translate(".concat(state.offset.left + 'px', ", ").concat(state.offset.top + 'px', ") scale(").concat(state.scale, ")"), "transform-origin: ".concat(origin)]);
// 更新点位
state.startPoint = {
x: e.clientX,
y: e.clientY
};
} else {
// 双指缩放
state.touches.set(e.pointerId, e);
var ratio = that.getDistance() / state.lastDistance;
state.scale = ratio * state.lastScale;
state.offset = that.getOffsetPageCenter();
if (state.scale < state.initialData.scale) {
that.reduction();
}
that.changeStyle(state.cloneEl, ['transition: all 0s', "transform: translate(".concat(state.offset.left + 'px', ", ").concat(state.offset.top + 'px', ") scale(").concat(state.scale, ")"), "transform-origin: ".concat(state.origin)]);
}
}
});
/** @描述 取消指针事件 */
_defineProperty(this, "onpointercancel", function (e) {
e.preventDefault();
_this.state.touches.clear();
// 可能存在特定事件导致中断,真机操作时 pointerup 在某些边界情况下不会生效,所以需要清空
});
this.state = Object.assign({}, this.state, this.mergeOptions(shadowRoot, originalEl, src));
var cloneEl = this.appendImg(src, originalEl);
this.state.cloneEl = cloneEl;
this.fixPosition(cloneEl);
this.addEvents(cloneEl);
return cloneEl;
}
_createClass(ImgItemInModal, [{
key: "mergeOptions",
value: function mergeOptions(shadowRoot, originalEl, src) {
var _window = window,
winWidth = _window.innerWidth,
winHeight = _window.innerHeight;
var offsetWidth = originalEl.offsetWidth,
offsetHeight = originalEl.offsetHeight;
// Element.getBoundingClientRect() 方法返回元素的大小及其相对于【视口】的位置
var _originalEl$getBoundi = originalEl.getBoundingClientRect(),
top = _originalEl$getBoundi.top,
left = _originalEl$getBoundi.left;
return {
shadowRoot: shadowRoot,
originalEl: originalEl,
src: src,
winWidth: winWidth,
winHeight: winHeight,
offsetWidth: offsetWidth,
offsetHeight: offsetHeight,
top: top,
left: left,
maskContent: shadowRoot.querySelector('.modal')
};
}
/** @描述 添加图片 */
}, {
key: "appendImg",
value: function appendImg(src, originalEl) {
console.log("\u53CC\u51FB\u7684\u56FE\u7247\u5730\u5740 => %O ", src);
// 克隆节点 能从缓存中获取图片,以便节省流量
var cloneEl = null;
if (originalEl.tagName === 'IMG') {
cloneEl = originalEl.cloneNode();
} else {
cloneEl = document.createElement('img');
cloneEl.src = src;
}
this.state.maskContent.appendChild(cloneEl);
return cloneEl;
}
/** @描述 添加监听事件 */
}, {
key: "addEvents",
value: function addEvents(cloneEl) {
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['dblclick', 'mousewheel', 'pointerdown', 'pointerup', 'pointermove', 'pointercancel'];
var that = this;
events.forEach(function (item) {
if (item === 'mousewheel') {
cloneEl.addEventListener('mousewheel', that["on".concat(item)], {
passive: false
});
return;
}
cloneEl.addEventListener(item, that["on".concat(item)]);
});
}
}, {
key: "getOffsetPageCenter",
value: /** @描述 获取中心改变的偏差 */
function getOffsetPageCenter() {
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var state = this.state;
var touchArr = Array.from(state.touches);
if (touchArr.length === 2) {
var start = touchArr[0][1];
var end = touchArr[1][1];
x = (start.offsetX + end.offsetX) / 2;
y = (start.offsetY + end.offsetY) / 2;
}
state.origin = "".concat(x, "px ").concat(y, "px");
var offsetLeft = (state.scale - 1) * (x - state.scaleOrigin.x) + state.offset.left;
var offsetTop = (state.scale - 1) * (y - state.scaleOrigin.y) + state.offset.top;
state.scaleOrigin = {
x: x,
y: y
};
return {
left: offsetLeft,
top: offsetTop
};
}
/** @描述 获取距离*/
}, {
key: "getDistance",
value: function getDistance() {
var touchArr = Array.from(this.state.touches);
if (touchArr.length < 2) {
return 0;
}
var start = touchArr[0][1];
var end = touchArr[1][1];
return Math.hypot(end.x - start.x, end.y - start.y);
}
/** @描述 修改样式,减少回流重绘*/
}, {
key: "changeStyle",
value: function changeStyle(el, arr) {
var original = el.style.cssText.split(';');
original.pop();
el.style.cssText = original.concat(arr).join(';') + ';';
}
/** @描述 还原记录,用于边界处理 */
}, {
key: "reduction",
value: function reduction() {
var that = this;
var state = that.state;
that.timer && clearTimeout(that.timer);
that.timer = setTimeout(function () {
// offset = state.initialData.offset
// origin = state.initialData.origin
// scale = state.initialData.scale
console.log("state => %O ", state);
that.changeStyle(state.cloneEl, ["transform: translate(".concat(state.offset.left + 'px', ", ").concat(state.offset.top + 'px', ") scale(").concat(state.scale, ")"), "transform-origin: ".concat(state.origin)]);
}, 300);
}
}, {
key: "fixPosition",
value: /** @描述 移动图片到屏幕中心位置 */
function fixPosition(cloneEl) {
var that = this;
var state = that.state;
/** @描述 原图片 中心点 */
var originalCenterPoint = {
x: state.offsetWidth / 2 + state.left,
y: state.offsetHeight / 2 + state.top
};
/** @描述 页面 中心点 */
var winCenterPoint = {
x: state.winWidth / 2,
y: state.winHeight / 2
};
/** @描述 新建图片的定位点:通过原图片中心点到页面中心点的 偏移量*/
var offsetDistance = {
left: winCenterPoint.x - originalCenterPoint.x + state.left,
top: winCenterPoint.y - originalCenterPoint.y + state.top
};
/** @描述 放大后的 */
var scaleNum = this.adaptScale();
var diffs = {
left: (scaleNum - 1) * state.offsetWidth / 2,
top: (scaleNum - 1) * state.offsetHeight / 2
};
this.changeStyle(cloneEl, ["left: ".concat(state.left, "px"), "top: ".concat(state.top, "px"), 'transition: all 0.3s', "width: ".concat(state.offsetWidth * scaleNum + 'px'), "transform: translate(".concat(offsetDistance.left - state.left - diffs.left, "px, ").concat(offsetDistance.top - state.top - diffs.top, "px)")]);
/** @描述 消除偏差:让图片相对于window 0 0定位,通过translate设置中心点重合*/
setTimeout(function () {
that.changeStyle(cloneEl, ['transition: all 0s', "left: 0", "top: 0", "transform: translate(".concat(offsetDistance.left - diffs.left, "px, ").concat(offsetDistance.top - diffs.top, "px)")]);
that.state.offset = {
left: offsetDistance.left - diffs.left,
top: offsetDistance.top - diffs.top
};
// 记录值
that.record();
}, 300);
}
/** @描述 记录初始化数据 */
}, {
key: "record",
value: function record() {
var state = this.state;
state.initialData = Object.assign({}, {
offset: state.offset,
origin: state.origin,
scale: state.scale
});
}
/** @描述 计算自适应屏幕的缩放 */
}, {
key: "adaptScale",
value: function adaptScale() {
var _this$state = this.state,
winWidth = _this$state.winWidth,
winHeight = _this$state.winHeight,
originalEl = _this$state.originalEl;
var w = originalEl.offsetWidth,
h = originalEl.offsetHeight;
var scale = winWidth / w;
if (h * scale > winHeight - 80) {
scale = (winHeight - 80) / h;
}
return scale;
}
}]);
return ImgItemInModal;
}();
function run() {
if (codeIsNotExcutable('previewImg', {
name: '图文对照阅读',
feature: '图片预览,固定图片,便于图文对照阅读',
includedUrls: []
})) return;
var shadowRoot = new ImgPreviewer({
backgroundColor: 'transparent'
});
}
;// CONCATENATED MODULE: ./src/tool/addBackgroundImg.js
/**
* @description 添加背景色
*/
function addBackgroundImg_run() {
if (codeIsNotExcutable('addBackgroundImg', {
name: '添加背景图片',
feature: '使用浏览器查看在线图片或本地图片时,增加页面背景图,以便清晰显示当前图片轮廓',
includedUrls: []
})) return;
addBackgroundImg();
}
/** @描述 添加背景色*/
function addBackgroundImg() {
var ua = navigator.userAgent.toLowerCase();
var doc = document.body || document.documentElement;
var isQQBrowser = ua.indexOf('qqbrowser/') > -1;
if (document.contentType.startsWith('image/')) {
if (isQQBrowser && doc.tagName !== 'svg') {
setTimeout(function () {
loaded();
}, 666);
} else {
loaded();
}
}
}
function loaded() {
var bgImage = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2NCIgaGVpZ2h0PSI2NCIgdmlld0JveD0iMCAwIDY0IDY0Ij4KICA8ZGVmcz4KICAgIDxzdHlsZT4KICAgICAgLmNscy0xIHsKICAgICAgICBmaWxsOiAjMzAzMDMwOwogICAgICB9CgogICAgICAuY2xzLTIgewogICAgICAgIGZpbGw6ICMyMDIwMjA7CiAgICAgIH0KICAgIDwvc3R5bGU+CiAgPC9kZWZzPgogIDxyZWN0IGlkPSJsdCIgY2xhc3M9ImNscy0xIiB3aWR0aD0iMzIiIGhlaWdodD0iMzIiLz4KICA8cmVjdCBpZD0icmIiIGNsYXNzPSJjbHMtMSIgeD0iMzIiIHk9IjMyIiB3aWR0aD0iMzIiIGhlaWdodD0iMzIiLz4KICA8cmVjdCBpZD0ibGIiIGNsYXNzPSJjbHMtMiIgeT0iMzIiIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIvPgogIDxyZWN0IGlkPSJydCIgY2xhc3M9ImNscy0yIiB4PSIzMiIgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIi8+Cjwvc3ZnPgo=";
var docTagName = function (tag) {
var tagName = tag && tag.tagName.toLowerCase();
if (tagName) {
if (tagName == 'svg') {
return tagName;
}
if (tagName == 'body' && tag.children && tag.children.length) {
tagName = tag.children[0].tagName.toLowerCase();
if (tagName == 'img') {
return tagName;
} else {
tagName = document.querySelector('img');
return tagName && tagName.tagName && tagName.tagName.toLowerCase();
}
}
}
}(doc);
var isViewerMode = docTagName == 'svg' || docTagName == 'img';
if (isViewerMode) {
if (document.head) {
var styleText = [];
if (isQQBrowserPS()) {
styleText.push("body{box-sizing: border-box;background-attachment: fixed !important;background-repeat: repeat !important;}");
styleText.push("body{background: url(".concat(bgImage, ") !important;}"));
} else {
styleText.push("img{position: static !important;background: none !important;background-color: transparent !important;}");
}
createElement('style', {
randomType: 'newOne',
el: 'head',
type: 'text/css',
innerHTML: styleText.join('')
}, win);
}
if (isQQBrowserPS()) {
doc.style.position = 'static';
doc.style.top = 'auto';
doc.style.left = 'auto';
doc.style.transform = 'none';
} else {
doc.style.backgroundImage = "url(".concat(bgImage, ")");
doc.style.backgroundAttachment = 'fixed';
doc.style.boxSizing = 'border-box';
if (docTagName == 'svg') {
doc.style.position = 'absolute';
doc.style.top = '50%';
doc.style.left = '50%';
doc.style.transform = 'translate(-50%, -50%)';
doc.style.margin = '10px';
doc.style.width = 'auto';
doc.style.height = 'auto';
doc.style.maxWidth = '100%';
doc.style.maxHeight = '100%';
}
}
}
function isQQBrowserPS() {
return document && document.body && document.body.classList.contains('qb-picture-ps');
}
}
;// CONCATENATED MODULE: ./src/tool/linkByNamedWin.js
/**
* @description 链接方式,总是以命名方式在新窗口打开
* @export
*/
function linkByNamedWin_run() {
if (codeIsNotExcutable('linkByNamedWin', {
name: '链接命名式打开',
feature: '打开a链接的方式,总是以命名方式在新窗口打开,以便减少同一链接的标签页数',
excludeUrls: ['www.zhipin.com']
})) return;
/* createElement('style', {
el: 'head',
id: 'linkByNamedWin',
randomType: 'newOne',
textContent: `
a[href*='/']>*{ pointer-events: none; }
a#aging-total-page { display: inline; }
a{ display: inline-block; }
`,
}) */
window.addEventListener('click', function (e) {
var _dom$href, _dom$href$match, _dom$href2, _dom$href2$replace, _dom$href2$replace$ma;
var dom = e.target;
// 非锚点的a 打开链接方式,总是以命名的新窗口
if (dom.tagName === 'A' && dom.href && dom !== null && dom !== void 0 && (_dom$href = dom.href) !== null && _dom$href !== void 0 && (_dom$href$match = _dom$href.match) !== null && _dom$href$match !== void 0 && _dom$href$match.call(_dom$href, /^https?:/) && !(dom !== null && dom !== void 0 && (_dom$href2 = dom.href) !== null && _dom$href2 !== void 0 && (_dom$href2$replace = _dom$href2.replace) !== null && _dom$href2$replace !== void 0 && (_dom$href2$replace = _dom$href2$replace.call(_dom$href2, location.href, '')) !== null && _dom$href2$replace !== void 0 && (_dom$href2$replace$ma = _dom$href2$replace.match) !== null && _dom$href2$replace$ma !== void 0 && _dom$href2$replace$ma.call(_dom$href2$replace, /^#/))) {
var newTabWindosName = dom.innerText.replace(/\s/g, '').slice(0, 30);
if (window.name === newTabWindosName) {
newTabWindosName = newTabWindosName + 'extra';
}
dom.setAttribute('target', newTabWindosName);
}
}, {
capture: true //利用捕获阶段,解决【阻止冒泡】阻断事件传播
});
}
;// CONCATENATED MODULE: ./src/tool/openUrlInText.js
/**
* @description 含有链接的文本,点击时跳转相应链接
* @export
*/
function openUrlInText_run() {
if (codeIsNotExcutable('openUrlInText', {
name: '单击打开文本中链接',
feature: '点击链接文本时,跳转相应链接,便于查看链接地址的内容',
includedUrls: []
})) return;
window.addEventListener('click', function (e) {
var _innerTextsOfAllText$;
if (isContentEditableOfDOM()) return;
// 如果处于选中文字状态,则不进行跳转操作
if (window.getSelection().toString()) return;
var dom = e.target;
if (!(e.button == 0) || dom !== null && dom !== void 0 && dom.href && dom.tagName === 'A') return;
// 非【右击】 或 【a链接href存在时】
var innerTextsOfAllText = _toConsumableArray(dom.childNodes).reduce(function (pre, cur) {
if (!(cur.nodeName === '#text' && cur.textContent)) return pre;
return pre = "".concat(pre, " ").concat(cur.textContent);
}, '');
var url = innerTextsOfAllText === null || innerTextsOfAllText === void 0 || (_innerTextsOfAllText$ = innerTextsOfAllText.match) === null || _innerTextsOfAllText$ === void 0 ? void 0 : _innerTextsOfAllText$.call(innerTextsOfAllText, /https?:\/\/[\S]{4,}/);
if (url) {
window.open(url[0], url[0]);
}
}, {
capture: true //利用捕获阶段,解决【阻止冒泡】阻断事件传播
});
}
;// CONCATENATED MODULE: ./src/tool/copySelectedText.js
/**
* @description 复制所选文字:鼠标选中文字,0.5秒后,自动复制到剪贴板
* @export
*/
function copySelectedText_run() {
if (codeIsNotExcutable('copySelectedText', {
name: '复制所选文本',
feature: '1、复制所选文字:鼠标选中文字,0.5秒后,自动复制到剪贴板;2、一键复制代码块:鼠标悬浮代码块后,点击显示的红色边框,复制到剪贴板',
includedUrls: []
})) return;
createElement('style', {
el: 'head',
id: 'a_click_target',
randomType: 'newOne',
textContent: "\n /* \u4E00\u952E\u590D\u5236\u4EE3\u7801\uFF1A\u9F20\u6807\u60AC\u6D6E\u4EE3\u7801\uFF0C\u70B9\u51FB\u7EA2\u8272\u8FB9\u6846 */\n :not(blockquote,pre)>pre{\n border-left: 10px solid #5a5c61 !important;\n border-radius: 10px !important;\n overflow-x: auto !important;\n white-space:pre-wrap !important;\n cursor: pointer;\n }\n :not(blockquote,pre)>pre:hover{\n border-left-color: rgb(91 4 4 / 90%) !important;\n }\n\n :not(blockquote,pre)>pre>*{\n border-radius:0 !important;\n }\n\n /* \u6CE8\u91CA\u6587\u672C\u8FC7\u957F\u65F6\uFF0C\u6362\u884C */\n :not(blockquote,pre)>pre code{\n white-space:pre-wrap !important;\n display:block !important;\n cursor: auto;\n }\n /*\n =============\u6CE8\u91CA\u4E0D\u8981\u7684=============\n overflow-y: auto !important;\n */\n "
});
var createElementTip = createElementTipFn();
window.addEventListener('click', function (e) {
if (isContentEditableOfDOM()) return;
var dom = e.target;
var selectedText = window.getSelection().toString();
// || dom.tagName === 'BLOCKQUOTE'
// https://mp.weixin.qq.com/s/1iBEjoZeA7bUmpAA1KEYhA
if (dom.tagName === 'PRE') {
var _dom$querySelector;
var willCopyText = selectedText || ((_dom$querySelector = dom.querySelector('code')) === null || _dom$querySelector === void 0 ? void 0 : _dom$querySelector.innerText) || dom.innerText;
copyTextAndTip(e, willCopyText, selectedText);
} else if (selectedText) {
copyTextAndTip(e, '', selectedText);
}
}, {
capture: true //利用捕获阶段,解决【阻止冒泡】阻断事件传播
});
function copyTextAndTip(e, willCopyText, selectedText) {
setTimeout(function () {
createElementTip({
e: e,
content: selectedText ? '文字_复制成功' : '代码块_复制成功'
});
doCopy(willCopyText || selectedText);
}, 500);
}
}
;// CONCATENATED MODULE: ./src/tool/notaryNumberUI.js
function notaryNumberUI_run() {
if (codeIsNotExcutable('notaryNumberUI', {
name: '微信公证号',
feature: '1、微信公证号左对齐布局,以便为图片预览腾出操作空间;2、列表项目li标签增加序号和斑马纹,便于阅读',
includedUrls: ['mp.weixin.qq.com']
})) return;
modifyUI();
}
function modifyUI() {
// 微信公众号
createElement('style', {
id: 'notaryNumberUI',
innerHTML: "\n span, p {\n font-size: 14px !important;\n }\n\t\t\t.pages_skin_pc .rich_media_area_primary_inner,\n\t\t\t.pages_skin_pc .rich_media_area_extra_inner {\n\t\t\t\tmargin-left:initial !important;\n\t\t\t}\n\n\t\t\t.rich_media_area_primary_inner ol,\n\t\t\t.rich_media_area_primary_inner ul{\n\t\t\t\tpadding-left:50px !important;\n list-style-type:decimal !important;\n\t\t\t}\n\n\t\t\t.rich_media_area_primary_inner ol>li:nth-child(2n),\n\t\t\t.rich_media_area_primary_inner ul>li:nth-child(2n){\n\t\t\t\tbackground: rgb(0 0 0/ 5%);\n\t\t\t}\n\t\t\t"
}, window);
}
;// CONCATENATED MODULE: ./src/tool/addFaviconOfDevApi.js
function addFaviconOfDevApi_run() {
if (codeIsNotExcutable('addFaviconOfDevApi', {
name: '开发环境下创建favicon',
feature: '127.0.0.1域名下增加,网页增加favicon和标题,便于区别非开发环境',
includedUrls: ['127.0.0.1']
})) return;
createFaviconElementInLocalhostIP();
modifyDocumentTitle();
}
function createFaviconElementInLocalhostIP() {
if (document.querySelector("link[rel*='icon'][href*='/']")) return;
createElement('link', {
el: 'head',
rel: 'shortcut icon',
href: 'https://www.runoob.com/images/compatible_opera.gif',
type: 'image/x-icon'
});
}
function modifyDocumentTitle() {
var _document$title;
if (!((_document$title = document.title) !== null && _document$title !== void 0 && _document$title.includes('Document'))) return;
document.title = '🌄🌔🌟🌈';
}
;// CONCATENATED MODULE: ./src/tool/csdn.js
function csdn_run() {
if (codeIsNotExcutable('csdn', {
name: 'csdn登录',
feature: 'CSDN:仅在主动触发登录时,显示登录弹层,以便减少不必要的登录',
includedUrls: ['csdn.net']
})) return;
createElement('style', {
el: 'head',
id: 'csdn-ui',
textContent: "\n /* csdn \u4EE3\u7801\u5185\u5BB9\u5168\u5C55\u793A */\n .hide-preCode-box{\n padding-top:0px !important;\n }\n\n /* \u9690\u85CF\u3010\u767B\u5F55\u540E\u590D\u5236\u3011\u6587\u6848*/\n .hljs-button.signin{\n opacity:0;\n }\n\n /* csdn\u767B\u5F55\u5F39\u5C42\u79FB\u81F3\u5DE6\u4E0B\u89D2\n .passport-login-container {\n top:calc(100vh - 485px) !important;\n width:410px !important;\n height: 520px !important;\n border-radius: 8px !important;\n box-shadow: -5px 5px 10px 5px #979393 !important;\n transform: scale(0.8) !important;\n left: -24px;\n }\n */\n "
});
createElement('style', {
el: 'head',
addPrefix: '',
id: 'csdn-ui-login',
randomType: 'single',
textContent: "\n /* \u9690\u85CF\u767B\u5F55\u5F39\u5C42 */\n .passport-login-container{\n display:none;\n }\n .passport-login-mark {\n display:none !important;\n }\n "
});
window.addEventListener('click', function (e) {
var _target$className, _target$className$inc;
var target = e.target;
if ((_target$className = target.className) !== null && _target$className !== void 0 && (_target$className$inc = _target$className.includes) !== null && _target$className$inc !== void 0 && _target$className$inc.call(_target$className, 'toolbar-btn-loginfun')) {
var _document$querySelect;
(_document$querySelect = document.querySelector('#csdn-ui-login')) === null || _document$querySelect === void 0 || _document$querySelect.remove();
}
});
}
;// CONCATENATED MODULE: ./src/tool/hideNdmOnItab.js
function hideNdmOnItab_run() {
if (codeIsNotExcutable('hideNdmOnItab', {
name: '隐藏Neat Download Manager',
feature: '隐藏Neat Download Manager',
includedUrls: ['go.itab.link']
})) return;
hideNdmOnItab_modifyUI();
}
function hideNdmOnItab_modifyUI() {
// 微信公众号
createElement('style', {
id: 'hideNdmOnItab',
innerHTML: "\n\t\t\tdiv[id*=neatDiv]{\n display:none !important;\n }\n\t\t\t"
}, window);
}
;// CONCATENATED MODULE: ./src/ImgPreview.js
ImgPreview_run();
function ImgPreview_run() {
run();
addBackgroundImg_run();
linkByNamedWin_run();
openUrlInText_run();
copySelectedText_run();
notaryNumberUI_run();
addFaviconOfDevApi_run();
csdn_run();
hideNdmOnItab_run();
}
/******/ })()
;