Open xgqfrms opened 6 years ago
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type
https://en.wikipedia.org/wiki/MIME
https://stackoverflow.com/questions/477816/what-is-the-correct-json-content-type
Content-Type: text/json
https://www.w3.org/Protocols/rfc1341/4_Content-Type.html
Content-Type: text/html; charset=utf-8
Content-Type: text/plain; charset=utf-8
Content-Type: application/json
1,新建一个新的 Chrome 的快捷链接, 如图设置 "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-web-security --user-data-dir=D:\chrome
这样就会创建一个支持CORS 的 Chrome 的副本。
$ npm i -S sweetalert
import swal from "sweetalert";
z-index
setTimeout(() => {
let btn = document.querySelector(`a.layui-layer-btn0`),
btnClose = document.querySelector(`a.layui-layer-btn1`);
btn.addEventListener(`click`, (e) => {
// console.log(`e =`, e);
// console.log(`e.target =`, e.target);
// console.log(`e.target.parentNode =`, e.target.parentNode);
// once
// e.target.parentNode.setAttribute("disabled", true);
// e.target.parentNode.classList.add("btn-disabled");
e.target.setAttribute("disabled", true);
e.target.classList.add("btn-disabled");
e.target.href = "javascript:void(0)";
e.target.style.display = "none";
btnClose.innerHTML = "关闭";
});
}, 0);
WebAssembly
https://github.com/kripken http://www.ruanyifeng.com/blog/2017/09/asmjs_emscripten.html
foreach
& break
http://cwestblog.com/2011/06/30/javascript-foreach-with-breaking/
https://stackoverflow.com/questions/2641347/how-to-short-circuit-array-foreach-like-calling-break
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some
var BreakException = {};
try {
[1, 2, 3].forEach(function(el) {
console.log(el);
if (el === 2) throw BreakException;
});
} catch (e) {
if (e !== BreakException) throw e;
}
Don't use Array.forEach, use for() instead
https://coderwall.com/p/kvzbpa/don-t-use-array-foreach-use-for-instead
How to use a variable in replace function of JavaScript ?
https://stackoverflow.com/questions/10136097/mystring-replace-variable-but-globally
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
http://burnignorance.com/php-programming-tips/how-to-use-a-variable-in-replace-function-of-javascript/