-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
58 additions
and
56 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,58 @@ | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="Permissions-Policy" content="interest-cohort=()" /> | ||
<title>box</title> | ||
<style id="style"></style> | ||
</head> | ||
<body></body> | ||
<script src="js/svg_utils.js"></script> | ||
<script src="js/express_box.js"></script> | ||
<script> | ||
// box.htm?long=80&width=60&height=50&landscape=false&a3=true | ||
function draw() { | ||
const url = window.location.href.replace('?', '&'); | ||
parsePageParamsFromUrl(url); | ||
parseExpressBoxParamsFromUrl(url); | ||
|
||
const LONG = Math.max( | ||
1, | ||
parseInt(url.concat('&long=40').replace('&long=', '厶').split('厶')[1].split('&')[0]), | ||
); | ||
const WIDTH = Math.max( | ||
1, | ||
parseInt(url.concat('&width=30').replace('&width=', '厶').split('厶')[1].split('&')[0]), | ||
); | ||
const HEIGHT = Math.max( | ||
1, | ||
parseInt(url.concat('&height=20').replace('&height=', '厶').split('厶')[1].split('&')[0]), | ||
); | ||
const EXTEND = Math.max( | ||
5, | ||
parseInt(url.concat('&extend=5').replace('&extend=', '厶').split('厶')[1].split('&')[0]), | ||
); | ||
|
||
document.getElementsByTagName('title')[0].innerHTML = `box_${LONG}×${WIDTH}×${HEIGHT}`; | ||
const { | ||
html: svgHtml, | ||
width: svgWidth, | ||
height: svgHeight, | ||
} = getExpressBoxSvgHtml(LONG, WIDTH, HEIGHT, EXTEND); | ||
const html = `<svg version="1.1" xmlns="http://www.w3.org/2000/svg" style="width:${svgWidth}mm;height:${svgHeight}mm;">${svgHtml}</svg>`; | ||
document.getElementsByTagName('body')[0].innerHTML = `<page>${html}</page>`; | ||
|
||
document.getElementById('style').innerHTML = getPageCss( | ||
A3, | ||
LANDSCAPE, | ||
PAGE_PADDING_TOP, | ||
PAGE_PADDING_LEFT, | ||
); | ||
|
||
window.print(); | ||
} | ||
|
||
draw(); | ||
</script> | ||
</html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="Permissions-Policy" content="interest-cohort=()" /> | ||
<title>box</title> | ||
<style id="style"></style> | ||
</head> | ||
<body></body> | ||
<script src="js/utils.js"></script> | ||
<script src="js/svg_utils.js"></script> | ||
<script src="js/express_box.js"></script> | ||
|
||
<script> | ||
// box.htm?long=80&width=60&height=50&landscape=false&a3=true | ||
function draw() { | ||
const url = window.location.href.replace('?', '&'); | ||
parsePageParamsFromUrl(url); | ||
parseExpressBoxParamsFromUrl(url); | ||
|
||
const LONG = Math.max( | ||
1, | ||
parseInt(url.concat('&long=40').replace('&long=', '厶').split('厶')[1].split('&')[0]), | ||
); | ||
const WIDTH = Math.max( | ||
1, | ||
parseInt(url.concat('&width=30').replace('&width=', '厶').split('厶')[1].split('&')[0]), | ||
); | ||
const HEIGHT = Math.max( | ||
1, | ||
parseInt(url.concat('&height=20').replace('&height=', '厶').split('厶')[1].split('&')[0]), | ||
); | ||
const EXTEND = Math.max( | ||
5, | ||
parseInt(url.concat('&extend=5').replace('&extend=', '厶').split('厶')[1].split('&')[0]), | ||
); | ||
|
||
document.getElementsByTagName('title')[0].innerHTML = `box_${LONG}×${WIDTH}×${HEIGHT}`; | ||
const { | ||
html: svgHtml, | ||
width: svgWidth, | ||
height: svgHeight, | ||
} = getExpressBoxSvgHtml(LONG, WIDTH, HEIGHT, EXTEND); | ||
const html = `<svg version="1.1" xmlns="http://www.w3.org/2000/svg" style="width:${svgWidth}mm;height:${svgHeight}mm;">${svgHtml}</svg>`; | ||
document.getElementsByTagName('body')[0].innerHTML = `<page>${html}</page>`; | ||
|
||
document.getElementById('style').innerHTML = getPageCss( | ||
A3, | ||
LANDSCAPE, | ||
PAGE_PADDING_TOP, | ||
PAGE_PADDING_LEFT, | ||
); | ||
|
||
window.print(); | ||
} | ||
|
||
draw(); | ||
</script> | ||
</html> |