This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express'); | |
| const next = require('next'); | |
| const { parse } = require('url'); | |
| const { createProxyMiddleware } = require('http-proxy-middleware'); | |
| const devProxy = module.exports = { | |
| '/web': { | |
| target: 'https://api.xxx.com', | |
| pathRewrite: { '/web/': '/' }, | |
| changeOrigin: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var getText = function (node) { | |
| var span = node.querySelector('span'); | |
| if (span) { | |
| return span.innerHTML; | |
| } | |
| return node.innerHTML; | |
| }; | |
| var doc = document.getElementsByTagName('iframe')[0].contentWindow.document; | |
| var wrap = doc.getElementById('u31'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const a = document.createElement('a'); | |
| a.setAttribute('href', 'https://www.baidu.com'); | |
| a.setAttribute('target', '_blank'); | |
| document.body.appendChild(a); | |
| a.click(); | |
| a.parentNode && a.parentNode.removeChild(a); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*fixed元素*/ | |
| .is-fixed { | |
| position: static !important; | |
| display:none; | |
| } | |
| /*专栏页头*/ | |
| .ColumnPageHeader-Wrapper { | |
| display:none; | |
| } | |
| /*头部logo*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nrm 是一个 npm 源管理器,允许你快速地在 npm源间切换。 | |
| ## 安装: | |
| ```shell | |
| npm install -g nrm | |
| ``` | |
| ## 使用 | |
| ### 查看可选源(带*号即为当前使用源) | |
| ```shell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function downloadFileAsync(url, dest) { | |
| return new Promise((resolve, reject) => { | |
| const file = fs.createWriteStream(dest); | |
| http.get(url, (res) => { | |
| if (res.statusCode !== 200) { | |
| reject(response.statusCode); | |
| return; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getClearUrl(url) { | |
| if (url.includes('?') || url.includes('#')) { | |
| return (url.match(/^.*?(?=[?|#])/))[0]; | |
| } else { | |
| return url; | |
| } | |
| } | |
| function getSearch(url: string): string { | |
| let search: string = ''; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.body.addEventListener('lazyImg', function(e) { | |
| loadImgs(e.detail.container); | |
| }, false); | |
| document.body.dispatchEvent(new CustomEvent('lazyImg', { | |
| detail: { | |
| container: document.querySelector('.dropdown'), | |
| force: true | |
| } | |
| })); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const requestAnimFrame = (function() { | |
| return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) { | |
| return window.setTimeout(callback, 1000 / 60, (new Date).getTime()) | |
| }; | |
| })(); | |
| const cancelAnimFrame = function() { | |
| return window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || function(id) { | |
| clearTimeout(id); | |
| }; | |
| }(); |
NewerOlder