From 78aba14267eabc2ac4f9b93f851605a32159dd6e Mon Sep 17 00:00:00 2001 From: anqisoft Date: Mon, 25 Sep 2023 17:26:36 +0800 Subject: [PATCH] Add box\cuboid_with_square_section_a3 and _bat\*.* --- _bat/_common/createJson.core.bat | 94 +++++++ _bat/_common/run.core.bat | 18 ++ .../_run_local.bat | 1 + .../_run_local.min.bat | 1 + .../_run_server.bat | 1 + .../_run_server.min.bat | 1 + .../createJson.local.bat | 1 + .../createJson.local.min.bat | 1 + .../createJson.server.bat | 1 + .../createJson.server.min.bat | 1 + .../cuboid_with_square_section_a3/local.json | 11 + .../local.min.json | 11 + .../cuboid_with_square_section_a3/server.json | 11 + .../server.min.json | 11 + _bat/clearMinCss.bat | 2 + _bat/clearMinJs.bat | 2 + _bat/compressCss.bat | 25 ++ _bat/compressJs.bat | 27 ++ ...ressJs_anqi_cuboid_with_square_section.bat | 1 + _bat/compressJs_anqi_express_box.bat | 1 + _bat/compressJs_anqi_mini_poker.bat | 1 + _bat/compressJs_onlyOne.bat | 14 + _bat/getHelp.bat | 6 + _bat/uglifycss.help.txt | 11 + _bat/uglifyjs.help.txt | 40 +++ box/box_single_file.htm | 8 +- box/cuboid_with_square_section_a3.htm | 19 ++ box/cuboid_with_square_section_a3.min.htm | 1 + dice/dices_a3_use_svg.htm | 3 +- js/anqi_cuboid_with_square_section.js | 240 ++++++++++++++++++ js/anqi_cuboid_with_square_section.min.js | 1 + js/anqi_express_box.js | 203 +++++++++++++-- js/anqi_express_box.min.js | 190 +++++++++----- js/anqi_svg_utils.js | 2 +- js/anqi_svg_utils.min.js | 2 +- js/anqi_utils.js | 3 +- js/anqi_utils.min.js | 2 +- 37 files changed, 872 insertions(+), 96 deletions(-) create mode 100644 _bat/_common/createJson.core.bat create mode 100644 _bat/_common/run.core.bat create mode 100644 _bat/box/cuboid_with_square_section_a3/_run_local.bat create mode 100644 _bat/box/cuboid_with_square_section_a3/_run_local.min.bat create mode 100644 _bat/box/cuboid_with_square_section_a3/_run_server.bat create mode 100644 _bat/box/cuboid_with_square_section_a3/_run_server.min.bat create mode 100644 _bat/box/cuboid_with_square_section_a3/createJson.local.bat create mode 100644 _bat/box/cuboid_with_square_section_a3/createJson.local.min.bat create mode 100644 _bat/box/cuboid_with_square_section_a3/createJson.server.bat create mode 100644 _bat/box/cuboid_with_square_section_a3/createJson.server.min.bat create mode 100644 _bat/box/cuboid_with_square_section_a3/local.json create mode 100644 _bat/box/cuboid_with_square_section_a3/local.min.json create mode 100644 _bat/box/cuboid_with_square_section_a3/server.json create mode 100644 _bat/box/cuboid_with_square_section_a3/server.min.json create mode 100644 _bat/clearMinCss.bat create mode 100644 _bat/clearMinJs.bat create mode 100644 _bat/compressCss.bat create mode 100644 _bat/compressJs.bat create mode 100644 _bat/compressJs_anqi_cuboid_with_square_section.bat create mode 100644 _bat/compressJs_anqi_express_box.bat create mode 100644 _bat/compressJs_anqi_mini_poker.bat create mode 100644 _bat/compressJs_onlyOne.bat create mode 100644 _bat/getHelp.bat create mode 100644 _bat/uglifycss.help.txt create mode 100644 _bat/uglifyjs.help.txt create mode 100644 box/cuboid_with_square_section_a3.htm create mode 100644 box/cuboid_with_square_section_a3.min.htm create mode 100644 js/anqi_cuboid_with_square_section.js create mode 100644 js/anqi_cuboid_with_square_section.min.js diff --git a/_bat/_common/createJson.core.bat b/_bat/_common/createJson.core.bat new file mode 100644 index 0000000..8d021a2 --- /dev/null +++ b/_bat/_common/createJson.core.bat @@ -0,0 +1,94 @@ +@ECHO OFF +chcp 65001 +:: %1: server, local, %2: min, %3: fileName, %4: subFolderName + +set langSet=en zh_cn zh_tw +set landscapeSet=false true + +set htmFilename=%3% + +:: echo %4% +set subFolderName= +if "%4%" neq "" ( + echo %%4%% is defined. + set subFolderName=%4% +) +set subFolderName=%subFolderName:\=\\% +:: echo subFolderName: %subFolderName% +:: pause & exit + +if "%2%" == "min" ( + set minSeg=.min +) else ( + set minSeg= +) + +set htmlPath=%cd% +call set htmlPath=%%htmlPath:_bat\box\%htmFilename%=%% +:: echo %htmlPath% + +if "%1%" == "server" ( + set url=https://anqisoft.github.io/ + set goal=%CD%\server%minSeg%.json +) else ( + set url=file:///%htmlPath:\=/% + set goal=%CD%\local%minSeg%.json +) +set url=%url%box/%htmFilename%%minSeg%.htm + +:: https://www.codenong.com/37071353/ +if "%subFolderName%" neq "" ( + set pdfPath=%htmlPath:\=\\%box\\%htmFilename%\\%subFolderName%\\pdfs\\ +) else ( + set pdfPath=%htmlPath:\=\\%box\\%htmFilename%\\pdfs\\ +) +set pdfPath=%pdfPath:\\\\=\\% +:: echo %pdfPath% && pause +:: echo %url% + +echo [>%goal% + +title "Create json config file for local" + +setlocal enabledelayedexpansion +for %%l in (!langSet!) do ( + set lang=%%l + rem echo !lang! + + for /L %%n in (1, 1, 2) do ( + set no=%%n + rem echo !no! + + for %%d in (!landscapeSet!) do ( + set landscape=%%d + rem echo !lang! !no! !landscape! + + if "!landscape!" == "true" ( + set pdfFile=landscape_!no! + ) else ( + set pdfFile=portrait + ) + rem echo !pdfFile! + + set ok=0 + if "!landscape!" == "true" ( + set ok=1 + ) else ( + if "!no!" == "1" ( + set ok=1 + ) + ) + + if "!ok!" == "1" ( + set endChar=, + if "!lang!:!no!:!landscape!" == "zh_tw:2:true" ( + set endChar= + ) + echo { "url": "!url!?lang=!lang!&landscape=!landscape!&no=!no!", "pdf": "!pdfPath!!lang!\\!pdfFile!.pdf", "params": { } }!endChar!>>%goal% + ) + ) + ) +) + +echo ]>>%goal% +:: PAUSE & exit \ No newline at end of file diff --git a/_bat/_common/run.core.bat b/_bat/_common/run.core.bat new file mode 100644 index 0000000..e058f2b --- /dev/null +++ b/_bat/_common/run.core.bat @@ -0,0 +1,18 @@ +@ECHO OFF + +SET json=%cd%\%1% +if "%2%" == "min" ( + set json=%json%.min +) +SET json=%json%.json +:: ECHO %json% + +title "%json%" +:: setlocal enabledelayedexpansion + +SET PYTHONPATH=P:\anqi\Desktop\tech\python\projects\tools\dev\tools\ + +call %PYTHONPATH%venv\Scripts\activate.bat +python %PYTHONPATH%main.py -F openUrlAndExportPdf -I %json% + +PAUSE \ No newline at end of file diff --git a/_bat/box/cuboid_with_square_section_a3/_run_local.bat b/_bat/box/cuboid_with_square_section_a3/_run_local.bat new file mode 100644 index 0000000..d670ab6 --- /dev/null +++ b/_bat/box/cuboid_with_square_section_a3/_run_local.bat @@ -0,0 +1 @@ +@call ..\..\_common\run.core.bat local "" \ No newline at end of file diff --git a/_bat/box/cuboid_with_square_section_a3/_run_local.min.bat b/_bat/box/cuboid_with_square_section_a3/_run_local.min.bat new file mode 100644 index 0000000..8be45fa --- /dev/null +++ b/_bat/box/cuboid_with_square_section_a3/_run_local.min.bat @@ -0,0 +1 @@ +@call ..\..\_common\run.core.bat local min \ No newline at end of file diff --git a/_bat/box/cuboid_with_square_section_a3/_run_server.bat b/_bat/box/cuboid_with_square_section_a3/_run_server.bat new file mode 100644 index 0000000..2fe899e --- /dev/null +++ b/_bat/box/cuboid_with_square_section_a3/_run_server.bat @@ -0,0 +1 @@ +@call ..\..\_common\run.core.bat server "" \ No newline at end of file diff --git a/_bat/box/cuboid_with_square_section_a3/_run_server.min.bat b/_bat/box/cuboid_with_square_section_a3/_run_server.min.bat new file mode 100644 index 0000000..7374909 --- /dev/null +++ b/_bat/box/cuboid_with_square_section_a3/_run_server.min.bat @@ -0,0 +1 @@ +@call ..\..\_common\run.core.bat server min \ No newline at end of file diff --git a/_bat/box/cuboid_with_square_section_a3/createJson.local.bat b/_bat/box/cuboid_with_square_section_a3/createJson.local.bat new file mode 100644 index 0000000..6920369 --- /dev/null +++ b/_bat/box/cuboid_with_square_section_a3/createJson.local.bat @@ -0,0 +1 @@ +call ..\..\_common\createJson.core.bat local "" cuboid_with_square_section_a3 local \ No newline at end of file diff --git a/_bat/box/cuboid_with_square_section_a3/createJson.local.min.bat b/_bat/box/cuboid_with_square_section_a3/createJson.local.min.bat new file mode 100644 index 0000000..7e69c27 --- /dev/null +++ b/_bat/box/cuboid_with_square_section_a3/createJson.local.min.bat @@ -0,0 +1 @@ +call ..\..\_common\createJson.core.bat local min cuboid_with_square_section_a3 local.min \ No newline at end of file diff --git a/_bat/box/cuboid_with_square_section_a3/createJson.server.bat b/_bat/box/cuboid_with_square_section_a3/createJson.server.bat new file mode 100644 index 0000000..3a8e64c --- /dev/null +++ b/_bat/box/cuboid_with_square_section_a3/createJson.server.bat @@ -0,0 +1 @@ +call ..\..\_common\createJson.core.bat server "" cuboid_with_square_section_a3 server \ No newline at end of file diff --git a/_bat/box/cuboid_with_square_section_a3/createJson.server.min.bat b/_bat/box/cuboid_with_square_section_a3/createJson.server.min.bat new file mode 100644 index 0000000..e1c32cf --- /dev/null +++ b/_bat/box/cuboid_with_square_section_a3/createJson.server.min.bat @@ -0,0 +1 @@ +call ..\..\_common\createJson.core.bat server min cuboid_with_square_section_a3 server.min \ No newline at end of file diff --git a/_bat/box/cuboid_with_square_section_a3/local.json b/_bat/box/cuboid_with_square_section_a3/local.json new file mode 100644 index 0000000..82030b1 --- /dev/null +++ b/_bat/box/cuboid_with_square_section_a3/local.json @@ -0,0 +1,11 @@ +[ + { "url": "file:///P:/ecs_person/websites/anqisoft.github.io/box/cuboid_with_square_section_a3.htm?lang=en&landscape=false&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\local\\pdfs\\en\\portrait.pdf", "params": { } }, + { "url": "file:///P:/ecs_person/websites/anqisoft.github.io/box/cuboid_with_square_section_a3.htm?lang=en&landscape=true&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\local\\pdfs\\en\\landscape_1.pdf", "params": { } }, + { "url": "file:///P:/ecs_person/websites/anqisoft.github.io/box/cuboid_with_square_section_a3.htm?lang=en&landscape=true&no=2", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\local\\pdfs\\en\\landscape_2.pdf", "params": { } }, + { "url": "file:///P:/ecs_person/websites/anqisoft.github.io/box/cuboid_with_square_section_a3.htm?lang=zh_cn&landscape=false&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\local\\pdfs\\zh_cn\\portrait.pdf", "params": { } }, + { "url": "file:///P:/ecs_person/websites/anqisoft.github.io/box/cuboid_with_square_section_a3.htm?lang=zh_cn&landscape=true&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\local\\pdfs\\zh_cn\\landscape_1.pdf", "params": { } }, + { "url": "file:///P:/ecs_person/websites/anqisoft.github.io/box/cuboid_with_square_section_a3.htm?lang=zh_cn&landscape=true&no=2", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\local\\pdfs\\zh_cn\\landscape_2.pdf", "params": { } }, + { "url": "file:///P:/ecs_person/websites/anqisoft.github.io/box/cuboid_with_square_section_a3.htm?lang=zh_tw&landscape=false&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\local\\pdfs\\zh_tw\\portrait.pdf", "params": { } }, + { "url": "file:///P:/ecs_person/websites/anqisoft.github.io/box/cuboid_with_square_section_a3.htm?lang=zh_tw&landscape=true&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\local\\pdfs\\zh_tw\\landscape_1.pdf", "params": { } }, + { "url": "file:///P:/ecs_person/websites/anqisoft.github.io/box/cuboid_with_square_section_a3.htm?lang=zh_tw&landscape=true&no=2", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\local\\pdfs\\zh_tw\\landscape_2.pdf", "params": { } } +] diff --git a/_bat/box/cuboid_with_square_section_a3/local.min.json b/_bat/box/cuboid_with_square_section_a3/local.min.json new file mode 100644 index 0000000..853b11f --- /dev/null +++ b/_bat/box/cuboid_with_square_section_a3/local.min.json @@ -0,0 +1,11 @@ +[ + { "url": "file:///P:/ecs_person/websites/anqisoft.github.io/box/cuboid_with_square_section_a3.min.htm?lang=en&landscape=false&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\local.min\\pdfs\\en\\portrait.pdf", "params": { } }, + { "url": "file:///P:/ecs_person/websites/anqisoft.github.io/box/cuboid_with_square_section_a3.min.htm?lang=en&landscape=true&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\local.min\\pdfs\\en\\landscape_1.pdf", "params": { } }, + { "url": "file:///P:/ecs_person/websites/anqisoft.github.io/box/cuboid_with_square_section_a3.min.htm?lang=en&landscape=true&no=2", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\local.min\\pdfs\\en\\landscape_2.pdf", "params": { } }, + { "url": "file:///P:/ecs_person/websites/anqisoft.github.io/box/cuboid_with_square_section_a3.min.htm?lang=zh_cn&landscape=false&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\local.min\\pdfs\\zh_cn\\portrait.pdf", "params": { } }, + { "url": "file:///P:/ecs_person/websites/anqisoft.github.io/box/cuboid_with_square_section_a3.min.htm?lang=zh_cn&landscape=true&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\local.min\\pdfs\\zh_cn\\landscape_1.pdf", "params": { } }, + { "url": "file:///P:/ecs_person/websites/anqisoft.github.io/box/cuboid_with_square_section_a3.min.htm?lang=zh_cn&landscape=true&no=2", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\local.min\\pdfs\\zh_cn\\landscape_2.pdf", "params": { } }, + { "url": "file:///P:/ecs_person/websites/anqisoft.github.io/box/cuboid_with_square_section_a3.min.htm?lang=zh_tw&landscape=false&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\local.min\\pdfs\\zh_tw\\portrait.pdf", "params": { } }, + { "url": "file:///P:/ecs_person/websites/anqisoft.github.io/box/cuboid_with_square_section_a3.min.htm?lang=zh_tw&landscape=true&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\local.min\\pdfs\\zh_tw\\landscape_1.pdf", "params": { } }, + { "url": "file:///P:/ecs_person/websites/anqisoft.github.io/box/cuboid_with_square_section_a3.min.htm?lang=zh_tw&landscape=true&no=2", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\local.min\\pdfs\\zh_tw\\landscape_2.pdf", "params": { } } +] diff --git a/_bat/box/cuboid_with_square_section_a3/server.json b/_bat/box/cuboid_with_square_section_a3/server.json new file mode 100644 index 0000000..00d027f --- /dev/null +++ b/_bat/box/cuboid_with_square_section_a3/server.json @@ -0,0 +1,11 @@ +[ + { "url": "https://anqisoft.github.io/box/cuboid_with_square_section_a3.htm?lang=en&landscape=false&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\server\\pdfs\\en\\portrait.pdf", "params": { } }, + { "url": "https://anqisoft.github.io/box/cuboid_with_square_section_a3.htm?lang=en&landscape=true&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\server\\pdfs\\en\\landscape_1.pdf", "params": { } }, + { "url": "https://anqisoft.github.io/box/cuboid_with_square_section_a3.htm?lang=en&landscape=true&no=2", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\server\\pdfs\\en\\landscape_2.pdf", "params": { } }, + { "url": "https://anqisoft.github.io/box/cuboid_with_square_section_a3.htm?lang=zh_cn&landscape=false&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\server\\pdfs\\zh_cn\\portrait.pdf", "params": { } }, + { "url": "https://anqisoft.github.io/box/cuboid_with_square_section_a3.htm?lang=zh_cn&landscape=true&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\server\\pdfs\\zh_cn\\landscape_1.pdf", "params": { } }, + { "url": "https://anqisoft.github.io/box/cuboid_with_square_section_a3.htm?lang=zh_cn&landscape=true&no=2", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\server\\pdfs\\zh_cn\\landscape_2.pdf", "params": { } }, + { "url": "https://anqisoft.github.io/box/cuboid_with_square_section_a3.htm?lang=zh_tw&landscape=false&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\server\\pdfs\\zh_tw\\portrait.pdf", "params": { } }, + { "url": "https://anqisoft.github.io/box/cuboid_with_square_section_a3.htm?lang=zh_tw&landscape=true&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\server\\pdfs\\zh_tw\\landscape_1.pdf", "params": { } }, + { "url": "https://anqisoft.github.io/box/cuboid_with_square_section_a3.htm?lang=zh_tw&landscape=true&no=2", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\server\\pdfs\\zh_tw\\landscape_2.pdf", "params": { } } +] diff --git a/_bat/box/cuboid_with_square_section_a3/server.min.json b/_bat/box/cuboid_with_square_section_a3/server.min.json new file mode 100644 index 0000000..c44789f --- /dev/null +++ b/_bat/box/cuboid_with_square_section_a3/server.min.json @@ -0,0 +1,11 @@ +[ + { "url": "https://anqisoft.github.io/box/cuboid_with_square_section_a3.min.htm?lang=en&landscape=false&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\server.min\\pdfs\\en\\portrait.pdf", "params": { } }, + { "url": "https://anqisoft.github.io/box/cuboid_with_square_section_a3.min.htm?lang=en&landscape=true&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\server.min\\pdfs\\en\\landscape_1.pdf", "params": { } }, + { "url": "https://anqisoft.github.io/box/cuboid_with_square_section_a3.min.htm?lang=en&landscape=true&no=2", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\server.min\\pdfs\\en\\landscape_2.pdf", "params": { } }, + { "url": "https://anqisoft.github.io/box/cuboid_with_square_section_a3.min.htm?lang=zh_cn&landscape=false&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\server.min\\pdfs\\zh_cn\\portrait.pdf", "params": { } }, + { "url": "https://anqisoft.github.io/box/cuboid_with_square_section_a3.min.htm?lang=zh_cn&landscape=true&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\server.min\\pdfs\\zh_cn\\landscape_1.pdf", "params": { } }, + { "url": "https://anqisoft.github.io/box/cuboid_with_square_section_a3.min.htm?lang=zh_cn&landscape=true&no=2", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\server.min\\pdfs\\zh_cn\\landscape_2.pdf", "params": { } }, + { "url": "https://anqisoft.github.io/box/cuboid_with_square_section_a3.min.htm?lang=zh_tw&landscape=false&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\server.min\\pdfs\\zh_tw\\portrait.pdf", "params": { } }, + { "url": "https://anqisoft.github.io/box/cuboid_with_square_section_a3.min.htm?lang=zh_tw&landscape=true&no=1", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\server.min\\pdfs\\zh_tw\\landscape_1.pdf", "params": { } }, + { "url": "https://anqisoft.github.io/box/cuboid_with_square_section_a3.min.htm?lang=zh_tw&landscape=true&no=2", "pdf": "P:\\ecs_person\\websites\\anqisoft.github.io\\box\\cuboid_with_square_section_a3\\server.min\\pdfs\\zh_tw\\landscape_2.pdf", "params": { } } +] diff --git a/_bat/clearMinCss.bat b/_bat/clearMinCss.bat new file mode 100644 index 0000000..ce4a177 --- /dev/null +++ b/_bat/clearMinCss.bat @@ -0,0 +1,2 @@ +@echo off +@del /s/q "%CD%\..\css\*.min.css" \ No newline at end of file diff --git a/_bat/clearMinJs.bat b/_bat/clearMinJs.bat new file mode 100644 index 0000000..559d737 --- /dev/null +++ b/_bat/clearMinJs.bat @@ -0,0 +1,2 @@ +@echo off +@del /s/q "%CD%\..\js\*.min.js" \ No newline at end of file diff --git a/_bat/compressCss.bat b/_bat/compressCss.bat new file mode 100644 index 0000000..d340e3f --- /dev/null +++ b/_bat/compressCss.bat @@ -0,0 +1,25 @@ +@echo off +:: https://www.npmjs.com/package/uglifycss uglifycss - npm +:: http://www.symfonychina.com/doc/current/assetic/uglifyjs.html +:: http://camnpr.com/archives/1007.html + +:: npm i -g uglifycss +:: git clone git://github.com/fmarcia/UglifyCSS.git +:: uglifycss [options] [filename] [...] > output + +set CSS_FOLDE=%CD%\..\css\ +chdir /d "%CSS_FOLDE%" +title "Compressing the css files of %CSS_FOLDER%" + +setlocal enabledelayedexpansion + +for /r . %%a in (*.css) do ( + set src=%%~fa + + REM Use "!src:~-8!", not !src:~-8! + if "!src:~-8!" neq ".min.css" ( + echo !src! + set goal=!src:.css=.min.css! + start /B "" uglifycss !src! > !goal! + ) +) \ No newline at end of file diff --git a/_bat/compressJs.bat b/_bat/compressJs.bat new file mode 100644 index 0000000..afa14ac --- /dev/null +++ b/_bat/compressJs.bat @@ -0,0 +1,27 @@ +@echo off + +:: npm install uglify-js -g +:: git clone git://github.com/mishoo/UglifyJS2.git +:: uglifyjs --help +:: * -o, Coutput [string] +:: * -b, Cbeautify [string] +:: * -m, Cmangle [string] +:: uglifyjs lazyLoad.js -m -o lazyLoad.min.js + +set JS_FOLDER="%CD%\..\js\" +chdir /d %JS_FOLDER% + +setlocal enabledelayedexpansion + +title "Compressing the js files of %JS_FOLDER%" + +for /r . %%a in (*.js) do ( + set src=%%~fa + + REM Use "!src:~-7!", not !src:~-7! + if "!src:~-7!" neq ".min.js" ( + echo !src! + set goal=!src:.js=.min.js! + start /B "" uglifyjs !src! -m -o !goal! + ) +) \ No newline at end of file diff --git a/_bat/compressJs_anqi_cuboid_with_square_section.bat b/_bat/compressJs_anqi_cuboid_with_square_section.bat new file mode 100644 index 0000000..49734e9 --- /dev/null +++ b/_bat/compressJs_anqi_cuboid_with_square_section.bat @@ -0,0 +1 @@ +@call compressJs_onlyOne anqi_cuboid_with_square_section.js \ No newline at end of file diff --git a/_bat/compressJs_anqi_express_box.bat b/_bat/compressJs_anqi_express_box.bat new file mode 100644 index 0000000..c939598 --- /dev/null +++ b/_bat/compressJs_anqi_express_box.bat @@ -0,0 +1 @@ +@call compressJs_onlyOne anqi_express_box.js \ No newline at end of file diff --git a/_bat/compressJs_anqi_mini_poker.bat b/_bat/compressJs_anqi_mini_poker.bat new file mode 100644 index 0000000..bbdc780 --- /dev/null +++ b/_bat/compressJs_anqi_mini_poker.bat @@ -0,0 +1 @@ +@call compressJs_onlyOne anqi_mini_poker.js \ No newline at end of file diff --git a/_bat/compressJs_onlyOne.bat b/_bat/compressJs_onlyOne.bat new file mode 100644 index 0000000..7c105e3 --- /dev/null +++ b/_bat/compressJs_onlyOne.bat @@ -0,0 +1,14 @@ +:: %1: The file name of js before compressing. + +@echo off +:: npm i -g uglify-js + +cd ..\js\ + +set src=%cd%\%1 +set goal=%src:.js=.min.js% +:: echo %src% %goal% +:: start /B "" uglifyjs %src% -m -o %goal% +( + uglifyjs %src% -m -o %goal% +) \ No newline at end of file diff --git a/_bat/getHelp.bat b/_bat/getHelp.bat new file mode 100644 index 0000000..daa34db --- /dev/null +++ b/_bat/getHelp.bat @@ -0,0 +1,6 @@ +@echo off + +start /B "" uglifyjs -help >uglifyjs.help.txt +start /B "" uglifycss >uglifycss.help.txt + +exit \ No newline at end of file diff --git a/_bat/uglifycss.help.txt b/_bat/uglifycss.help.txt new file mode 100644 index 0000000..60b2652 --- /dev/null +++ b/_bat/uglifycss.help.txt @@ -0,0 +1,11 @@ +Usage: uglifycss [options] file1.css [file2.css [...]] > output +options: +--max-line-len n add a newline every n characters +--expand-vars expand variables +--ugly-comments remove newlines within preserved comments +--cute-comments preserve newlines within and around preserved comments +--convert-urls d convert relative urls using the d directory as location target +--debug print full error stack on error +--output f put the result in f file +--help show this help +--version display version number \ No newline at end of file diff --git a/_bat/uglifyjs.help.txt b/_bat/uglifyjs.help.txt new file mode 100644 index 0000000..6fa1b59 --- /dev/null +++ b/_bat/uglifyjs.help.txt @@ -0,0 +1,40 @@ +Usage: uglifyjs [files...] [options] + +Options: + -h, --help Print usage information. + `--help options` for details on available options. + -v, -V, --version Print version number. + -p, --parse Specify parser options. + -c, --compress [options] Enable compressor/specify compressor options. + -m, --mangle [options] Mangle names/specify mangler options. + --mangle-props [options] Mangle properties/specify mangler options. + -b, --beautify [options] Beautify output/specify output options. + -O, --output-opts Output options (beautify disabled). + -o, --output Output file (default STDOUT). + --annotations Process and preserve comment annotations. + --no-annotations Ignore and discard comment annotations. + --comments [filter] Preserve copyright comments in the output. + --config-file Read minify() options from JSON file. + -d, --define [=value] Global definitions. + -e, --enclose [arg[,...][:value[,...]]] Embed everything in a big function, with configurable argument(s) & value(s). + --ie Support non-standard Internet Explorer. + --keep-fargs Do not mangle/drop function arguments. + --keep-fnames Do not mangle/drop function names. Useful for code relying on Function.prototype.name. + --module Process input as ES module (implies --toplevel) + --name-cache File to hold mangled name mappings. + --rename Force symbol expansion. + --no-rename Disable symbol expansion. + --self Build UglifyJS as a library (implies --wrap UglifyJS) + --source-map [options] Enable source map/specify source map options. + --timings Display operations run time on STDERR. + --toplevel Compress and/or mangle variables in toplevel scope. + --v8 Support non-standard Chrome & Node.js. + --validate Perform validation during AST manipulations. + --verbose Print diagnostic messages. + --warn Print warning messages. + --webkit Support non-standard Safari/Webkit. + --wrap Embed everything as a function with “exports” corresponding to “name” globally. + +(internal debug use only) + --in-situ Warning: replaces original source files with minified output. + --reduce-test Reduce a standalone test case (assumes cloned repository). diff --git a/box/box_single_file.htm b/box/box_single_file.htm index ad46da9..6ba8a22 100644 --- a/box/box_single_file.htm +++ b/box/box_single_file.htm @@ -84,8 +84,8 @@ const SVG_WIDTH = LONG + HEIGHT * 4 + EXTEND * 2; const SVG_HEIGHT = HEIGHT * 3 + WIDTH * 2; - const HELF_LONG = LONG * 0.5; - const CENTER_X = HELF_LONG + HEIGHT * 2 + EXTEND * 1; + const HALF_LONG = LONG * 0.5; + const CENTER_X = HALF_LONG + HEIGHT * 2 + EXTEND * 1; const LONG_PX = mmToPxScale * LONG; const WIDTH_PX = mmToPxScale * WIDTH; @@ -124,12 +124,12 @@ const Y4_OFFSET = Y4 + THICKESS; const Y5_OFFSET = Y5 - THICKESS; - const X4 = CENTER_X - HELF_LONG; + const X4 = CENTER_X - HALF_LONG; const X3 = X4 - HEIGHT; const X2 = X3 - HEIGHT; const X1 = X2 - EXTEND; - const X5 = CENTER_X + HELF_LONG; + const X5 = CENTER_X + HALF_LONG; const X6 = X5 + HEIGHT; const X7 = X6 + HEIGHT; const X8 = X7 + EXTEND; diff --git a/box/cuboid_with_square_section_a3.htm b/box/cuboid_with_square_section_a3.htm new file mode 100644 index 0000000..ca4137a --- /dev/null +++ b/box/cuboid_with_square_section_a3.htm @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + diff --git a/box/cuboid_with_square_section_a3.min.htm b/box/cuboid_with_square_section_a3.min.htm new file mode 100644 index 0000000..ea7d7bb --- /dev/null +++ b/box/cuboid_with_square_section_a3.min.htm @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/dice/dices_a3_use_svg.htm b/dice/dices_a3_use_svg.htm index 0465d51..2d4e157 100644 --- a/dice/dices_a3_use_svg.htm +++ b/dice/dices_a3_use_svg.htm @@ -11,7 +11,7 @@ A3 Dices (body -> svg) - + @@ -539,4 +539,5 @@ draw(); + diff --git a/js/anqi_cuboid_with_square_section.js b/js/anqi_cuboid_with_square_section.js new file mode 100644 index 0000000..68ad502 --- /dev/null +++ b/js/anqi_cuboid_with_square_section.js @@ -0,0 +1,240 @@ + +// ?top=4&left=3.5&landscape=false&a3=true +function draw() { + setF1Content('?lang=en&landscape=false&no=1\nlang:en, zh_cn, zh_tw\nlandscape:true, false\nno:1,2'); + + // Force to A3 paper, and use the default margins. + const ORIGINAL_URL = window.location.href; + parseExpressBoxParamsFromUrl(ORIGINAL_URL); + parsePageParamsFromUrl(ORIGINAL_URL); + + const url = `&a3=true&landscape=${LANDSCAPE}&lang=${LANG}&no=${NO}`; + parsePageParamsFromUrl(url); + parseExpressBoxParamsFromUrl(url); + + document.getElementsByTagName('title')[0].innerText = `${[ + { + en: 'A3 Cuboid with Square Section Landscape ', + zh_cn: 'A3_带正方形截面的长方体_横排', + zh_tw: 'A3_帶正方形截面的長方體_橫排', + }, + { + en: 'A3 Cuboid with Square Section Portrait ', + zh_cn: 'A3_带正方形截面的长方体_竖排', + zh_tw: 'A3_帶正方形截面的長方體_豎排', + }, + ][LANDSCAPE ? 0 : 1][LANG]}${NO}`; + + document.getElementById('style').innerHTML = getPageCss( + A3, + LANDSCAPE, + PAGE_PADDING_TOP, + PAGE_PADDING_LEFT, + ); + + + + const body = document.getElementsByTagName('body')[0]; + + const pageElement = createPageElement(); + body.appendChild(pageElement); + + if (LANDSCAPE) { + switch (NO) { + case 1: + default: + appendLandscapeCuboids1(pageElement); + break; + case 2: + appendLandscapeCuboids2(pageElement); + break; + } + } else { + appendPortraitCuboids(pageElement); + } + + window.print(); +} + +function appendPortraitCuboids(pageElement) { + createAndAppendCuboids(pageElement, 80, 40, 12, 3); + createAndAppendCuboids(pageElement, 40, 20, 6, 4); + createAndAppendCuboids(pageElement, 20, 10, 4, 12); + + const { ceil, floor } = Math; + const LONG = 10, SIDE = 5, PASTE_WIDTH = 4; + + function getSvgElements(COUNT) { + return createAndAppendCuboids(pageElement, LONG, SIDE, PASTE_WIDTH, COUNT); + } + + getSvgElements(24 + 1); + + getSvgElements(12).forEach((svgElement, i) => { + const svgStyle = svgElement.style; + svgStyle.position = 'absolute'; + + svgStyle.left = `${PAGE_PADDING_LEFT + 40 * 6}mm`; + svgStyle.top = `${PAGE_PADDING_TOP + 40 * 2 * floor(i / 4) + 40 * 1.5 * floor(i % 4 / 2) + 40 * 0.25 * (i % 2)}mm`; + }); + getSvgElements(12).forEach((svgElement, i) => { + const svgStyle = svgElement.style; + svgStyle.position = 'absolute'; + + svgStyle.left = `${PAGE_PADDING_LEFT + 40 * 6 + 12}mm`; + svgStyle.top = `${PAGE_PADDING_TOP + 40 * 0.5 + 40 * 2 * floor(i / 4) + 40 * 0.25 * (i % 4)}mm`; + }); + getSvgElements(2).forEach((svgElement, i) => { + const svgStyle = svgElement.style; + svgStyle.position = 'absolute'; + + svgStyle.transform = 'rotate(90deg)'; + svgStyle.right = `-8mm`; + svgStyle.top = `${PAGE_PADDING_TOP + 40 * 1.5 + 40 * 2 * i + 12}mm`; + }); + + getSvgElements(4).forEach((svgElement, i) => { + const svgStyle = svgElement.style; + svgStyle.position = 'absolute'; + + svgStyle.left = `${PAGE_PADDING_LEFT + 20 * 6 * 2 + 6}mm`; + svgStyle.top = `${PAGE_PADDING_TOP + 40 * 2 * 3 + 20 * 2 * floor(i / 2) + 20 * 1.5 * floor(i % 2)}mm`; + }); + getSvgElements(4).forEach((svgElement, i) => { + const svgStyle = svgElement.style; + svgStyle.position = 'absolute'; + + svgStyle.left = `${PAGE_PADDING_LEFT + 20 * 6 * 2 + 6 * 2}mm`; + svgStyle.top = `${PAGE_PADDING_TOP + 40 * 2 * 3 + 20 * 2 * floor(i / 2) + 20 * 0.5 + 20 * 0.5 * floor(i % 2)}mm`; + }); + + getSvgElements(5).forEach((svgElement, i) => { + const svgStyle = svgElement.style; + svgStyle.position = 'absolute'; + + svgStyle.left = `${PAGE_PADDING_LEFT + (10 * 6 + 4) * 4}mm`; + svgStyle.top = `${PAGE_PADDING_TOP + 40 * 2 * 3 + 20 * 2 * 2 + 10 * i}mm`; + }); + getSvgElements(1).forEach((svgElement, i) => { + const svgStyle = svgElement.style; + svgStyle.position = 'absolute'; + + svgStyle.transform = 'rotate(90deg)'; + svgStyle.right = `-8mm`; + svgStyle.bottom = `11mm`; + }); +} + +function appendLandscapeCuboids1(pageElement) { + // Count: 1, 2, 8, 14, 19 + [ + { long: 128, side: 64, pasteWidth: 16, count: 1 }, + { long: 64, side: 32, pasteWidth: 8, count: 2 }, + { long: 32, side: 16, pasteWidth: 4, count: 8 }, + { long: 16, side: 8, pasteWidth: 4, count: 14 }, + + // { long:8, side:4, pasteWidth: 4, count: 14 }, + ].forEach(({ long, side, pasteWidth, count }) => { + createAndAppendCuboids(pageElement, long, side, pasteWidth, count); + }); + + const { ceil, floor } = Math; + // const LONG = 16, SIDE = 8, PASTE_WIDTH = 4; + const LONG = 8, SIDE = 4, PASTE_WIDTH = 4; + + function getSvgElements(COUNT) { + return createAndAppendCuboids(pageElement, LONG, SIDE, PASTE_WIDTH, COUNT); + } + + getSvgElements(8).forEach((svgElement, i) => { + const svgStyle = svgElement.style; + svgStyle.position = 'absolute'; + + svgStyle.left = `${PAGE_PADDING_LEFT + 64 * 6}mm`; + svgStyle.top = `${PAGE_PADDING_TOP + 64 * 1.5 * floor(i / 4) + SIDE * 2 * (i % 4)}mm`; + }); + + getSvgElements(7).forEach((svgElement, i) => { + rotate90(svgElement); + + const svgStyle = svgElement.style; + svgStyle.position = 'absolute'; + + const { widthMm: WIDTH } = svgElement; + svgStyle.left = `${PAGE_PADDING_LEFT + 64 * 6 + 16}mm`; + if (i < 2) { + svgStyle.top = `${PAGE_PADDING_TOP + 64 * 0.5 + WIDTH * (i % 2)}mm`; + } else { + svgStyle.top = `${PAGE_PADDING_TOP + 64 * 2 + WIDTH * ((i - 2) % 5)}mm`; + } + }); + + // Right of { long:8, side:4, pasteWidth: 4 } + { + const LEFT = PAGE_PADDING_LEFT + (8 * 6 + 4) * 7; + const HEIGHT = SIDE * 2; + + getSvgElements(4).forEach((svgElement, i) => { + const svgStyle = svgElement.style; + svgStyle.position = 'absolute'; + + svgStyle.left = `${LEFT}mm`; + svgStyle.bottom = `${HEIGHT * i}mm`; + }); + } +} + +function appendLandscapeCuboids2(pageElement) { + // Count: 1, 4, 4, 0, 17 + [ + { long: 128, side: 64, pasteWidth: 16, count: 1 }, + { long: 64, side: 32, pasteWidth: 8, count: 4 }, + { long: 32, side: 16, pasteWidth: 4, count: 4 }, + + ].forEach(({ long, side, pasteWidth, count }) => { + createAndAppendCuboids(pageElement, long, side, pasteWidth, count); + }); + + const { ceil, floor } = Math; + // const LONG = 16, SIDE = 8, PASTE_WIDTH = 4; + const LONG = 8, SIDE = 4, PASTE_WIDTH = 4; + + function getSvgElements(COUNT) { + return createAndAppendCuboids(pageElement, LONG, SIDE, PASTE_WIDTH, COUNT); + } + + getSvgElements(8).forEach((svgElement, i) => { + const svgStyle = svgElement.style; + svgStyle.position = 'absolute'; + + svgStyle.left = `${PAGE_PADDING_LEFT + 64 * 6}mm`; + svgStyle.top = `${PAGE_PADDING_TOP + 64 * 1.5 * floor(i / 4) + SIDE * 2 * (i % 4)}mm`; + }); + + getSvgElements(7).forEach((svgElement, i) => { + rotate90(svgElement); + + const svgStyle = svgElement.style; + svgStyle.position = 'absolute'; + + const { widthMm: WIDTH } = svgElement; + svgStyle.left = `${PAGE_PADDING_LEFT + 64 * 6 + 16}mm`; + if (i < 2) { + svgStyle.top = `${PAGE_PADDING_TOP + 64 * 0.5 + WIDTH * (i % 2)}mm`; + } else { + svgStyle.top = `${PAGE_PADDING_TOP + 64 * 2 + WIDTH * ((i - 2) % 5)}mm`; + } + }); + + getSvgElements(2).forEach((svgElement, i) => { + rotate90(svgElement); + + const svgStyle = svgElement.style; + svgStyle.position = 'absolute'; + + svgStyle.left = `${PAGE_PADDING_LEFT + 32 * 6 * (i + 1) + 8 * i}mm`; + svgStyle.top = `${PAGE_PADDING_TOP + 64 * 2 + 32 * 1.5}mm`; + }); +} + +draw(); diff --git a/js/anqi_cuboid_with_square_section.min.js b/js/anqi_cuboid_with_square_section.min.js new file mode 100644 index 0000000..9d2cb43 --- /dev/null +++ b/js/anqi_cuboid_with_square_section.min.js @@ -0,0 +1 @@ +function draw(){setF1Content("?lang=en&landscape=false&no=1\nlang:en, zh_cn, zh_tw\nlandscape:true, false\nno:1,2");const t=window.location.href;parseExpressBoxParamsFromUrl(t);parsePageParamsFromUrl(t);const o=`&a3=true&landscape=${LANDSCAPE}&lang=${LANG}&no=${NO}`;parsePageParamsFromUrl(o);parseExpressBoxParamsFromUrl(o);document.getElementsByTagName("title")[0].innerText=`${[{en:"A3 Cuboid with Square Section Landscape ",zh_cn:"A3_带正方形截面的长方体_横排",zh_tw:"A3_帶正方形截面的長方體_橫排"},{en:"A3 Cuboid with Square Section Portrait ",zh_cn:"A3_带正方形截面的长方体_竖排",zh_tw:"A3_帶正方形截面的長方體_豎排"}][LANDSCAPE?0:1][LANG]}${NO}`;document.getElementById("style").innerHTML=getPageCss(A3,LANDSCAPE,PAGE_PADDING_TOP,PAGE_PADDING_LEFT);const e=document.getElementsByTagName("body")[0];const n=createPageElement();e.appendChild(n);if(LANDSCAPE){switch(NO){case 1:default:appendLandscapeCuboids1(n);break;case 2:appendLandscapeCuboids2(n);break}}else{appendPortraitCuboids(n)}window.print()}function appendPortraitCuboids(o){createAndAppendCuboids(o,80,40,12,3);createAndAppendCuboids(o,40,20,6,4);createAndAppendCuboids(o,20,10,4,12);const{ceil:t,floor:n}=Math;const e=10,s=5,a=4;function i(t){return createAndAppendCuboids(o,e,s,a,t)}i(24+1);i(12).forEach((t,o)=>{const e=t.style;e.position="absolute";e.left=`${PAGE_PADDING_LEFT+40*6}mm`;e.top=`${PAGE_PADDING_TOP+40*2*n(o/4)+40*1.5*n(o%4/2)+40*.25*(o%2)}mm`});i(12).forEach((t,o)=>{const e=t.style;e.position="absolute";e.left=`${PAGE_PADDING_LEFT+40*6+12}mm`;e.top=`${PAGE_PADDING_TOP+40*.5+40*2*n(o/4)+40*.25*(o%4)}mm`});i(2).forEach((t,o)=>{const e=t.style;e.position="absolute";e.transform="rotate(90deg)";e.right=`-8mm`;e.top=`${PAGE_PADDING_TOP+40*1.5+40*2*o+12}mm`});i(4).forEach((t,o)=>{const e=t.style;e.position="absolute";e.left=`${PAGE_PADDING_LEFT+20*6*2+6}mm`;e.top=`${PAGE_PADDING_TOP+40*2*3+20*2*n(o/2)+20*1.5*n(o%2)}mm`});i(4).forEach((t,o)=>{const e=t.style;e.position="absolute";e.left=`${PAGE_PADDING_LEFT+20*6*2+6*2}mm`;e.top=`${PAGE_PADDING_TOP+40*2*3+20*2*n(o/2)+20*.5+20*.5*n(o%2)}mm`});i(5).forEach((t,o)=>{const e=t.style;e.position="absolute";e.left=`${PAGE_PADDING_LEFT+(10*6+4)*4}mm`;e.top=`${PAGE_PADDING_TOP+40*2*3+20*2*2+10*o}mm`});i(1).forEach((t,o)=>{const e=t.style;e.position="absolute";e.transform="rotate(90deg)";e.right=`-8mm`;e.bottom=`11mm`})}function appendLandscapeCuboids1(s){[{long:128,side:64,pasteWidth:16,count:1},{long:64,side:32,pasteWidth:8,count:2},{long:32,side:16,pasteWidth:4,count:8},{long:16,side:8,pasteWidth:4,count:14}].forEach(({long:t,side:o,pasteWidth:e,count:n})=>{createAndAppendCuboids(s,t,o,e,n)});const{ceil:t,floor:n}=Math;const o=8,a=4,e=4;function i(t){return createAndAppendCuboids(s,o,a,e,t)}i(8).forEach((t,o)=>{const e=t.style;e.position="absolute";e.left=`${PAGE_PADDING_LEFT+64*6}mm`;e.top=`${PAGE_PADDING_TOP+64*1.5*n(o/4)+a*2*(o%4)}mm`});i(7).forEach((t,o)=>{rotate90(t);const e=t.style;e.position="absolute";const{widthMm:n}=t;e.left=`${PAGE_PADDING_LEFT+64*6+16}mm`;if(o<2){e.top=`${PAGE_PADDING_TOP+64*.5+n*(o%2)}mm`}else{e.top=`${PAGE_PADDING_TOP+64*2+n*((o-2)%5)}mm`}});{const c=PAGE_PADDING_LEFT+(8*6+4)*7;const A=a*2;i(4).forEach((t,o)=>{const e=t.style;e.position="absolute";e.left=`${c}mm`;e.bottom=`${A*o}mm`})}}function appendLandscapeCuboids2(s){[{long:128,side:64,pasteWidth:16,count:1},{long:64,side:32,pasteWidth:8,count:4},{long:32,side:16,pasteWidth:4,count:4}].forEach(({long:t,side:o,pasteWidth:e,count:n})=>{createAndAppendCuboids(s,t,o,e,n)});const{ceil:t,floor:n}=Math;const o=8,a=4,e=4;function i(t){return createAndAppendCuboids(s,o,a,e,t)}i(8).forEach((t,o)=>{const e=t.style;e.position="absolute";e.left=`${PAGE_PADDING_LEFT+64*6}mm`;e.top=`${PAGE_PADDING_TOP+64*1.5*n(o/4)+a*2*(o%4)}mm`});i(7).forEach((t,o)=>{rotate90(t);const e=t.style;e.position="absolute";const{widthMm:n}=t;e.left=`${PAGE_PADDING_LEFT+64*6+16}mm`;if(o<2){e.top=`${PAGE_PADDING_TOP+64*.5+n*(o%2)}mm`}else{e.top=`${PAGE_PADDING_TOP+64*2+n*((o-2)%5)}mm`}});i(2).forEach((t,o)=>{rotate90(t);const e=t.style;e.position="absolute";e.left=`${PAGE_PADDING_LEFT+32*6*(o+1)+8*o}mm`;e.top=`${PAGE_PADDING_TOP+64*2+32*1.5}mm`})}draw(); \ No newline at end of file diff --git a/js/anqi_express_box.js b/js/anqi_express_box.js index abe3974..2c52368 100644 --- a/js/anqi_express_box.js +++ b/js/anqi_express_box.js @@ -4,25 +4,40 @@ */ function parseExpressBoxParamsFromUrl(url) { - window.THICKESS = Math.min( + url = url.replace('?', '&').toLowerCase(); + const { max, min } = Math; + window.THICKESS = max(0, min( 1, - parseInt( + parseFloat( url.concat('&thickess=1').replace('&thickess=', '厶').split('厶')[1].split('&')[0], ), + )); + window.NO = max(0, + parseInt( + url.concat('&no=1').replace('&no=', '厶').split('厶')[1].split('&')[0], + ), ); + + window.LANG = + url.concat('&lang=en').replace('&lang=', '厶').split('厶')[1].split('&')[0]; + if (['en', 'zh_cn', 'zh_tw'].indexOf(window.LANG) === -1) { + window.LANG = 'en'; + } } function getExpressBoxSvgHtml(long, width, height, extend) { - long = Math.max(1, long || 40); - width = Math.max(1, width || 30); - height = Math.max(1, height || 20); - extend = Math.max(2, extend || 5); + const { max, min } = Math; + + long = max(1, long || 40); + width = max(1, width || 30); + height = max(1, height || 20); + extend = max(2, extend || 5); const SVG_WIDTH = long + height * 4 + extend * 2; const SVG_HEIGHT = height * 3 + width * 2; - const HELF_LONG = long * 0.5; - const CENTER_X = HELF_LONG + height * 2 + extend * 1; + const HALF_LONG = long * 0.5; + const CENTER_X = HALF_LONG + height * 2 + extend * 1; const LONG_PX = mmToPxScale * long; const WIDTH_PX = mmToPxScale * width; @@ -42,7 +57,7 @@ function getExpressBoxSvgHtml(long, width, height, extend) { const SMALL_RADIUS_PX = mmToPxScale * SMALL_RADIUS; // height * 0.25; const BIG_RADIUS_PX = mmToPxScale * BIG_RADIUS; // width * 0.25; - const THIRD_RADIUS_PX = mmToPxScale * Math.max(width, height) * 0.25; + const THIRD_RADIUS_PX = mmToPxScale * max(width, height) * 0.25; const FIRST_V_PX = HEIGHT_PX - SMALL_RADIUS_PX * 2 - THICKESS_PX * 2; const SECOND_V_PX = WIDTH_PX - BIG_RADIUS_PX * 2 - THICKESS_PX * 2; @@ -65,12 +80,12 @@ function getExpressBoxSvgHtml(long, width, height, extend) { const Y4_OFFSET = Y4 + THICKESS; const Y5_OFFSET = Y5 - THICKESS; - const X4 = CENTER_X - HELF_LONG; + const X4 = CENTER_X - HALF_LONG; const X3 = X4 - height; const X2 = X3 - height; const X1 = X2 - extend; - const X5 = CENTER_X + HELF_LONG; + const X5 = CENTER_X + HALF_LONG; const X6 = X5 + height; const X7 = X6 + height; const X8 = X7 + extend; @@ -150,22 +165,23 @@ v -${FIRST_V_PX} a ${HALF_HEIGHT_PX} ${SMALL_RADIUS_PX} 0 0 1 ${HALF_HEIGHT_PX},-${SMALL_RADIUS_PX} v -${THICKESS_PX} -z">`; - html += ``; - html += ``; +z"> + +${getInlineVerticalLine(X4, 0, SVG_HEIGHT)} +${getInlineVerticalLine(X5, 0, SVG_HEIGHT)} - html += ``; - html += ``; +${getInlineVerticalLine(X2, Y4_OFFSET, Y5_OFFSET)} +${getInlineVerticalLine(X3, Y4_OFFSET, Y5_OFFSET)} - html += ``; - html += ``; +${getInlineVerticalLine(X6, Y4_OFFSET, Y5_OFFSET)} +${getInlineVerticalLine(X7, Y4_OFFSET, Y5_OFFSET)} - html += ``; - html += ``; - html += ``; - html += ``; +${getInlineHorizontalLine(X4, X5, Y2)} +${getInlineHorizontalLine(X4, X5, Y3)} +${getInlineHorizontalLine(X4, X5, Y4)} +${getInlineHorizontalLine(X4, X5, Y5)} - // html += ''; +`; return { html: html, @@ -173,3 +189,144 @@ z">`; height: SVG_HEIGHT, }; } + +function getCuboidWithSquareSectionSvgHtml(long, side, pasteWidth) { + const { max, min } = Math; + + long = max(1, long || 40); + width = max(1, side || long * 0.5); + if (width > long) { width += long; long -= width - long; width = width - long; } + height = width; + + return getCuboidWithHalfExtend(long, width, height, pasteWidth); +} + +function getCuboidWithHalfExtend(long, width, height, pasteWidth) { + const { max, min } = Math; + + long = max(1, long || 40); + width = max(1, width || 40); + height = max(1, height || 40); + pasteWidth = max(1, pasteWidth || 40); + + extend = min(width, height) * 0.5; + + const SVG_WIDTH = long * 2 + height * 2 + pasteWidth; + const SVG_HEIGHT = width + extend * 2; + + const LONG_PX = mmToPxScale * long; + const WIDTH_PX = mmToPxScale * width; + const HEIGHT_PX = mmToPxScale * height; + const EXTEND_PX = mmToPxScale * extend; + const PASTE_WIDTH_PX = mmToPxScale * pasteWidth; + + const Y1 = 0; + const Y2 = Y1 + extend; + const Y3 = Y2 + width; + // const Y4 = Y3 + extend; + + const X1 = 0; + const X2 = X1 + height; + const X3 = X2 + long; + const X4 = X3 + height; + const X5 = X4 + long; +// const X6 = X5 + pasteWidth; + + const html = ` + +${getInlineHorizontalLine(X1, X5, Y2)} +${getInlineHorizontalLine(X1, X5, Y3)} + +${getInlineVerticalLine(X2, Y2, Y3)} +${getInlineVerticalLine(X3, Y2, Y3)} +${getInlineVerticalLine(X4, Y2, Y3)} +${getInlineVerticalLine(X5, Y2, Y3)} +`; + + return { + html: html, + width: SVG_WIDTH, + height: SVG_HEIGHT, + }; +} + +function getInlineHorizontalLine(X1, X2, Y) { + return ``; +} + +function getInlineVerticalLine(X, Y1, Y2) { + return ``; +} + +function createAndAppendCuboids(PAGE_ELEMENT, LONG, SIDE, PASTE_WIDTH, COUNT) { + const result = []; + for (let i = 0; i < COUNT; ++i) { + const { html, width, height } = getCuboidWithSquareSectionSvgHtml(LONG, SIDE, PASTE_WIDTH); + const { svgElement } = createSvgElement(html, width, height); + PAGE_ELEMENT.appendChild(svgElement); + + svgElement.widthMm = width; + svgElement.heightMm = height; + result.push(svgElement); + } + + return result; +} + +function createAndAppendCuboid(PAGE_ELEMENT, LONG, SIDE, PASTE_WIDTH) { + const { html, width, height } = getCuboidWithSquareSectionSvgHtml(LONG, SIDE, PASTE_WIDTH); + const { svgElement } = createSvgElement(html, width, height); + PAGE_ELEMENT.appendChild(svgElement); + + svgElement.widthMm = width; + svgElement.heightMm = height; + return svgElement; +} + +function rotate90(svgElement) { + const svgStyle = svgElement.style; + + const { heightMm: HEIGHT } = svgElement; + const HALF_HEIGHT = HEIGHT * 0.5; + svgStyle.transform = 'rotate(90deg)'; + svgStyle.transformOrigin = `${HALF_HEIGHT}mm ${HALF_HEIGHT}mm`; +} diff --git a/js/anqi_express_box.min.js b/js/anqi_express_box.min.js index 75ac353..89b939e 100644 --- a/js/anqi_express_box.min.js +++ b/js/anqi_express_box.min.js @@ -1,73 +1,137 @@ -function parseExpressBoxParamsFromUrl($){window.THICKESS=Math.min(1,parseInt($.concat("&thickess=1").replace("&thickess=","厶").split("厶")[1].split("&")[0]))}function getExpressBoxSvgHtml($,m,t,s){$=Math.max(1,$||40);m=Math.max(1,m||30);t=Math.max(1,t||20);s=Math.max(2,s||5);const o=$+t*4+s*2;const e=t*3+m*2;const a=$*.5;const n=a+t*2+s*1;const r=mmToPxScale*$;const c=mmToPxScale*m;const l=mmToPxScale*t;const h=mmToPxScale*s;const i=mmToPxScale*THICKESS;const x=t*.5;const b=t*.25;const j=m*.25;const q=m*.5;const y=mmToPxScale*x;const k=mmToPxScale*q;const v=mmToPxScale*b;const d=mmToPxScale*j;const S=mmToPxScale*Math.max(m,t)*.25;const T=l-v*2-i*2;const w=c-d*2-i*2;const P=l-S*2-i*2;const p=c-h*2-i*2;let M="";const A=0;const E=A+t;const H=E+m;const I=H+t;const C=I+m;const D=C+t;const K=I+THICKESS;const f=C-THICKESS;const g=n-a;const u=g-t;const B=u-t;const G=B-s;const z=n+a;const F=z+t;const U=F+t;const J=U+s;M+=` + +${getInlineVerticalLine(M,0,c)} +${getInlineVerticalLine(y,0,c)} + +${getInlineVerticalLine(k,E,z)} +${getInlineVerticalLine(V,E,z)} + +${getInlineVerticalLine(b,E,z)} +${getInlineVerticalLine(A,E,z)} + +${getInlineHorizontalLine(M,y,f)} +${getInlineHorizontalLine(M,y,H)} +${getInlineHorizontalLine(M,y,P)} +${getInlineHorizontalLine(M,y,C)} + +`;return{html:T,width:i,height:c}}function getCuboidWithSquareSectionSvgHtml(t,n,e){const{max:$,min:o}=Math;t=$(1,t||40);width=$(1,n||t*.5);if(width>t){width+=t;t-=width-t;width=width-t}height=width;return getCuboidWithHalfExtend(t,width,height,e)}function getCuboidWithHalfExtend(t,n,e,$){const{max:o,min:i}=Math;t=o(1,t||40);n=o(1,n||40);e=o(1,e||40);$=o(1,$||40);extend=i(n,e)*.5;const c=t*2+e*2+$;const s=n+extend*2;const a=mmToPxScale*t;const l=mmToPxScale*n;const m=mmToPxScale*e;const h=mmToPxScale*extend;const r=mmToPxScale*$;const v=0;const d=v+extend;const g=d+n;const S=0;const x=S+e;const p=x+t;const w=p+e;const u=w+t;const I=` -v -${i} -a ${y} ${v} 0 0 1 -${y},-${v} -v -${T} -a ${y} ${v} 0 0 1 ${y},-${v} -v -${i} +${getInlineHorizontalLine(S,u,d)} +${getInlineHorizontalLine(S,u,g)} -z">`;M+=``;M+=``;M+=``;M+=``;M+=``;M+=``;M+=``;M+=``;M+=``;M+=``;return{html:M,width:o,height:e}} \ No newline at end of file +${getInlineVerticalLine(x,d,g)} +${getInlineVerticalLine(p,d,g)} +${getInlineVerticalLine(w,d,g)} +${getInlineVerticalLine(u,d,g)} +`;return{html:I,width:c,height:s}}function getInlineHorizontalLine(t,n,e){return``}function getInlineVerticalLine(t,n,e){return``}function createAndAppendCuboids(n,e,$,o,i){const c=[];for(let t=0;te/this.dpiX*25.4;convertMmToPx=e=>e/25.4*this.dpiX;getMmToPxScale=()=>this.mmToPxScale;getPxToMmScale=()=>this.pxToMmScale}function getBodyElement(){return document.getElementsByTagName("body")[0]}function getNumbersArray(t,n){const a=[];for(let e=t;e<=n;++e){a.push(e.toString())}return a}function createElement(e,t){return document.createElement(e,t)}function createPageElement(){return document.createElement("page")}function setF1Content(t){document.onkeydown=function(e){switch(e.keyCode){case 112:alert(t);e.preventDefault();e.stopPropagation();break;default:break}return false}}function parsePageParamsFromUrl(e){window.LANDSCAPE=e.concat("&landscape=false").replace("&landscape=","厶").split("厶")[1].split("&")[0]==="true";window.A3=e.concat("&a3=true").replace("&a3=","厶").split("厶")[1].split("&")[0]==="true";window.PAGE_PADDING_TOP=Math.max(0,parseFloat(e.concat("&top=3.5").replace("&top=","厶").split("厶")[1].split("&")[0]));window.PAGE_PADDING_LEFT=Math.max(0,parseFloat(e.concat("&left=3.5").replace("&left=","厶").split("厶")[1].split("&")[0]));window.LANG=e.concat("&lang=en").replace("&lang=","厶").split("厶")[1].split("&")[0];const t=A3?LANDSCAPE?420:297:LANDSCAPE?297:210;const n=A3?LANDSCAPE?297:420:LANDSCAPE?210:297;const a=t-PAGE_PADDING_LEFT*2;const o=n-PAGE_PADDING_TOP*2;window.PAPER_WIDTH=t;window.PAPER_HEIGHT=n;window.PAGE_WIDTH=a;window.PAGE_HEIGHT=o}function getPageCss(){return`\@media print\{\@page\{size:${A3?"A3":"A4"} ${LANDSCAPE?"landscape":"portrait"};\} \} +const MONTHS=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Spt","Oct","Nov","Dec");const DEGREE_180=180;const DEGREE_90=90;const DEGREE_90_COUNTERCLOCKWISE=-90;class DPIHelper{dpiArray=[];dpiX=0;mmToPxScale=0;pxToMmScale=0;constructor(){const e=window.screen;const{dpiArray:t}=this;if(e.deviceXDPI){t.push(e.deviceXDPI);t.push(e.deviceYDPI)}else{const o=document.createElement("div");o.style.cssText="width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden";document.body.appendChild(o);t.push(parseInt(o.offsetWidth.toString()));t.push(parseInt(o.offsetHeight.toString()));document.body.removeChild(o)}const n=t[0];this.dpiX=n;this.mmToPxScale=n/25.4;this.pxToMmScale=25.4/n}convertPxToMm=e=>e/this.dpiX*25.4;convertMmToPx=e=>e/25.4*this.dpiX;getMmToPxScale=()=>this.mmToPxScale;getPxToMmScale=()=>this.pxToMmScale}function getBodyElement(){return document.getElementsByTagName("body")[0]}function getNumbersArray(t,n){const o=[];for(let e=t;e<=n;++e){o.push(e.toString())}return o}function createElement(e,t){return document.createElement(e,t)}function createPageElement(){return document.createElement("page")}function setF1Content(t){document.onkeydown=function(e){switch(e.keyCode){case 112:alert(t);e.preventDefault();e.stopPropagation();break;default:break}return false}}function parsePageParamsFromUrl(e){e=e.replace("?","&").toLowerCase();window.LANDSCAPE=e.concat("&landscape=false").replace("&landscape=","厶").split("厶")[1].split("&")[0]==="true";window.A3=e.concat("&a3=true").replace("&a3=","厶").split("厶")[1].split("&")[0]==="true";window.PAGE_PADDING_TOP=Math.max(0,parseFloat(e.concat("&top=3.5").replace("&top=","厶").split("厶")[1].split("&")[0]));window.PAGE_PADDING_LEFT=Math.max(0,parseFloat(e.concat("&left=3.5").replace("&left=","厶").split("厶")[1].split("&")[0]));const t=A3?LANDSCAPE?420:297:LANDSCAPE?297:210;const n=A3?LANDSCAPE?297:420:LANDSCAPE?210:297;const o=t-PAGE_PADDING_LEFT*2;const a=n-PAGE_PADDING_TOP*2;window.PAPER_WIDTH=t;window.PAPER_HEIGHT=n;window.PAGE_WIDTH=o;window.PAGE_HEIGHT=a}function getPageCss(){return`\@media print\{\@page\{size:${A3?"A3":"A4"} ${LANDSCAPE?"landscape":"portrait"};\} \} *\{margin:0;border:0;padding:0;\} page:not(:last-of-type)\{page-break-after:always;\} page\{padding-top:${PAGE_PADDING_TOP}mm;padding-left:${PAGE_PADDING_LEFT}mm;display:block;width:${PAGE_WIDTH}mm;height:${PAGE_HEIGHT}mm;position:relative;overflow:hidden;\}`}function getSvgCss(){return`\@media print\{\@page\{size:${A3?"A3":"A4"} ${LANDSCAPE?"landscape":"portrait"};\} \}