New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
js json string to object #49
Comments
JSON5https://json5.org/ https://github.com/json5/json5#json5stringify <!DOCTYPE html>
<html lang="zh-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="author" content="xgqfrms">
<meta name="generator" content="VS code">
<title>JSON5</title>
</head>
<body>
<section>
<h1>
<a href="https://feiqa.xgqfrms.xyz/index.html"></a>
</h1>
</section>
<!-- libs -->
<!-- <script src="https://unpkg.com/json5@^2.0.0/dist/index.min.js"></script> -->
<script src="./libs/json5.min.js"></script>
<script type="module">
// const JSON5 = require('json5');
import * as JSON5 from "./libs/json5.min.js";
// JSON5.stringify(value[, replacer[, space]]);
// JSON5.stringify(value[, options]);
</script>
</body>
</html> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON |
input & changehttps://developer.mozilla.org/en-US/docs/Web/Events/change https://www.w3schools.com/tags/ev_onchange.asp
https://github.com/xyz-data/RAIO/issues/176 oninvalid & this.setCustomValidity() |
Q: How to disable the
|
Ace & web code editorhttps://cdn.xgqfrms.xyz/web-ide/ace.js bug
importScripts('https://cdn.xgqfrms.xyz/web-ide/worker-javascript.js'); |
solution 1
solution 2
https://ace.c9.io/#api=editor&nav=api https://ace.c9.io/api/editor.html
|
|
ACE in Action |
Reconstruct mouse target for focusin from recent event.https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent |
Chrome Headless
|
how to get fetch response header in fecth apihttps://stackoverflow.com/questions/43344819/reading-response-headers-with-fetch-api how to get ajax response header in jshttps://www.yukei.net/2016/01/getting-response-headers-data-from-an-ajax-request-with-jquery/
|
https://www.cnblogs.com/xgqfrms/p/9724866.html let url = `http://localhost:9000/api/render`,
obj = {
url: "https://developer.mozilla.org/en-US/docs/Web/CSS/calc",
output: "pdf",
// scrollPage: true,
// pdf: {
// landscape: true,
// },
// output: "screenshot",
ignoreHttpsErrors: true,
};
fetch(url,
{
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json; charset=utf-8",
},
body: JSON.stringify(obj),
})
.then(res => {
let headers = res.headers;
headers.forEach(
(value, key) => {
console.log(`response header =`, `${key} = ${value}`);
// console.log(`response header =`, key, value);
}
);
// console.log(`response headers =`, headers);
return res.blob();
})
.then(blob => {
// base64
let objectURL = URL.createObjectURL(blob);
let a = document.createElement(`a`);
a.href = objectURL;
console.log(`a =`, a);
// let title = document.querySelector(`title`).innerText;
let title = `test`;
// png
// a.setAttribute(`download`, `${title}.png`);
// pdf
a.setAttribute(`download`, `${title}.pdf`);
a.click();
})
.catch((err) => {
console.log(`There has been a problem with your fetch operation: `, err);
}); url-to-pdf-aphttps://github.com/alvarcarto/url-to-pdf-api#2-local-development |
css & no margin
https://stackoverflow.com/questions/46077392/additional-options-in-chrome-headless-print-to-pdf @page {
margin: 0;
}
@page {
margin-top: 0;
}
@page {
margin-bottom: 0;
} |
media & print.cssurl = `http://localhost:9000/api/render`,
obj = {
url: "http://10.1.5.202/stock/f9/fastview/index.html",
output: "pdf",
scrollPage: true,
pdf: {
landscape: true,
},
emulateScreenMedia: true,
// output: "screenshot",
ignoreHttpsErrors: true,
};
fetch(url,
{
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json; charset=utf-8",
},
body: JSON.stringify(obj),
})
.then(res => res.blob())
.then(blob => {
// base64
let objectURL = URL.createObjectURL(blob);
let a = document.createElement(`a`);
a.href = objectURL;
let title = `test`;
// png
// a.setAttribute(`download`, `${title}.png`);
// pdf
a.setAttribute(`download`, `${title}.pdf`);
a.click();
})
.catch((err) => {
console.log(`There has been a problem with your fetch operation: `, err);
}); |
外网
|
highstock crosshairs
tooltip: {
crosshairs:[
{
enabled:true,//是否显示X轴标线
width:3,//标线宽度
color:'red' //标线颜色值
},
{
enabled:true,//是否显示Y轴标线
width:3,//标线宽度
color:'green' //标线颜色值
}
],
style:{
display:'none' //通过样式表控制不显示tooltip数据提示框
}
}, |
window.parent.location.href;
window.parent.location.pathname; |
js & throw new Errorhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/throw throw 'Error2'; // generates an exception with a string value
throw 42; // generates an exception with the value 42
throw true; // generates an exception with the value true
throw new Error('Required'); // generates an error object with the message of Required http://www.javascriptkit.com/javatutors/trycatch2.shtml |
js json string to object
https://stackoverflow.com/questions/9036429/convert-object-string-to-json
https://stackoverflow.com/questions/45015/safely-turning-a-json-string-into-an-object
The text was updated successfully, but these errors were encountered: