Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
anqisoft authored Sep 21, 2023
1 parent 9695fa2 commit f3c6a01
Showing 1 changed file with 58 additions and 56 deletions.
114 changes: 58 additions & 56 deletions box.htm
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>

0 comments on commit f3c6a01

Please sign in to comment.