j1-template 2022.0.9 → 2022.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/modules/ads/google_ad_content_home.html +11 -0
  3. data/_includes/themes/j1/modules/ads/google_ad_top_home.html +11 -0
  4. data/apps/public/cc/index.adoc +0 -1
  5. data/assets/data/article_navigator/index.html +0 -1
  6. data/assets/data/news_panel_posts/index.html +0 -1
  7. data/assets/error_pages/HTTP445.html +5 -4
  8. data/assets/error_pages/HTTP446.html +2 -2
  9. data/assets/error_pages/HTTP447.html +110 -0
  10. data/assets/error_pages/HTTP448.html +111 -0
  11. data/assets/themes/j1/adapter/js/advertising.js +416 -0
  12. data/assets/themes/j1/adapter/js/cookieConsent.js +8 -3
  13. data/assets/themes/j1/adapter/js/framer.js +0 -3
  14. data/assets/themes/j1/adapter/js/j1.js +6 -2
  15. data/assets/themes/j1/adapter/js/rouge.js +1 -1
  16. data/assets/themes/j1/adapter/js/scroller.js +1 -1
  17. data/assets/themes/j1/adapter/js/translator.js +15 -15
  18. data/assets/themes/j1/core/css/themes/unolight/bootstrap.css +6 -0
  19. data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +1 -1
  20. data/assets/themes/j1/modules/advertising/js/google/adInitializer.js +117 -0
  21. data/assets/themes/j1/modules/deeplAPI/js/deeplAPI.2.js +1 -1
  22. data/assets/themes/j1/modules/deeplAPI/js/deeplAPI.js +1 -1
  23. data/assets/themes/j1/modules/scroller/js/scroller.js +1 -1
  24. data/lib/j1/version.rb +1 -1
  25. data/lib/starter_web/Gemfile +1 -1
  26. data/lib/starter_web/_config.yml +1 -5
  27. data/lib/starter_web/_data/layouts/default.yml +7 -7
  28. data/lib/starter_web/_data/layouts/home.yml +24 -0
  29. data/lib/starter_web/_data/modules/advertising.yml +137 -10
  30. data/lib/starter_web/_data/modules/cookies.yml +1 -1
  31. data/lib/starter_web/_data/modules/defaults/advertising.yml +105 -0
  32. data/lib/starter_web/_data/resources.yml +24 -0
  33. data/lib/starter_web/_includes/attributes.asciidoc +1 -1
  34. data/lib/starter_web/_includes/themes/j1/modules/ads/google_ad_content_home.html +11 -0
  35. data/lib/starter_web/_includes/themes/j1/modules/ads/google_ad_top_home.html +11 -0
  36. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  37. data/lib/starter_web/index.html +0 -1
  38. data/lib/starter_web/package.json +1 -1
  39. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/documentation.adoc +0 -1
  40. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/multi.adoc +0 -1
  41. data/lib/starter_web/pages/public/asciidoc_skeletons/simple-document/simple.adoc +0 -1
  42. data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +0 -1
  43. data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +0 -1
  44. data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +0 -1
  45. data/lib/starter_web/pages/public/blog/navigator/archive.html +0 -1
  46. data/lib/starter_web/pages/public/blog/navigator/index.html +0 -1
  47. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.adoc +4 -3
  48. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.ads.asciidoc +265 -0
  49. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.no_ads.asciidoc +237 -0
  50. data/lib/starter_web/pages/public/learn/roundtrip/100_present_videos.adoc +62 -0
  51. data/lib/starter_web/pages/public/learn/roundtrip/_includes/google-ad.js +130 -0
  52. data/lib/starter_web/pages/public/legal/en/100_copyright.adoc +0 -1
  53. data/lib/starter_web/pages/public/legal/en/200_impress.adoc +0 -1
  54. data/lib/starter_web/pages/public/legal/en/400_comment_policy.adoc +0 -1
  55. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  56. data/lib/starter_web/utilsrv/package.json +1 -1
  57. metadata +14 -47
  58. data/_includes/themes/j1/modules/connectors/ad/custom-provider.html +0 -30
  59. data/_includes/themes/j1/modules/connectors/ad/google-adsense.html +0 -62
  60. data/_includes/themes/j1/modules/connectors/ads +0 -56
  61. data/lib/starter_web/pages/_test_pages/100_side-bar-tester.adoc +0 -244
  62. data/lib/starter_web/pages/_test_pages/_includes/attributes.asciidoc +0 -110
  63. data/lib/starter_web/pages/_test_pages/_includes/documents/100_gistblock.asciidoc +0 -28
  64. data/lib/starter_web/pages/_test_pages/_includes/documents/410_bottom_info.asciidoc +0 -14
  65. data/lib/starter_web/pages/_test_pages/_includes/documents/410_bottom_left_warning.asciidoc +0 -11
  66. data/lib/starter_web/pages/_test_pages/_includes/documents/410_bottom_right_danger.asciidoc +0 -11
  67. data/lib/starter_web/pages/_test_pages/_includes/documents/410_central_success.asciidoc +0 -11
  68. data/lib/starter_web/pages/_test_pages/_includes/documents/410_full_height_left_info.asciidoc +0 -11
  69. data/lib/starter_web/pages/_test_pages/_includes/documents/410_full_height_right_success.asciidoc +0 -11
  70. data/lib/starter_web/pages/_test_pages/_includes/documents/410_table_bs_modal_examples.asciidoc +0 -47
  71. data/lib/starter_web/pages/_test_pages/_includes/documents/410_top_info.asciidoc +0 -11
  72. data/lib/starter_web/pages/_test_pages/_includes/documents/410_top_left_info.asciidoc +0 -11
  73. data/lib/starter_web/pages/_test_pages/_includes/documents/410_top_right_success.asciidoc +0 -11
  74. data/lib/starter_web/pages/_test_pages/_includes/documents/419_advanced_modals_demo.asciidoc +0 -337
  75. data/lib/starter_web/pages/_test_pages/_includes/documents/tables/bs_modal_examples.asciidoc +0 -47
  76. data/lib/starter_web/pages/_test_pages/accordion-01-tester.adoc +0 -220
  77. data/lib/starter_web/pages/_test_pages/accordion-02-tester.adoc +0 -177
  78. data/lib/starter_web/pages/_test_pages/accordion-03-tester.adoc +0 -148
  79. data/lib/starter_web/pages/_test_pages/attribute-changes-01-tester.adoc +0 -226
  80. data/lib/starter_web/pages/_test_pages/backdrop-tester.adoc +0 -109
  81. data/lib/starter_web/pages/_test_pages/button-tester-1.adoc +0 -127
  82. data/lib/starter_web/pages/_test_pages/card-tester.adoc +0 -128
  83. data/lib/starter_web/pages/_test_pages/cookieConsent.adoc +0 -96
  84. data/lib/starter_web/pages/_test_pages/deepl.0.adoc +0 -258
  85. data/lib/starter_web/pages/_test_pages/deepl.adoc +0 -204
  86. data/lib/starter_web/pages/_test_pages/desandro-button.adoc +0 -171
  87. data/lib/starter_web/pages/_test_pages/desandro.adoc +0 -147
  88. data/lib/starter_web/pages/_test_pages/flipcard-1-tester.adoc +0 -308
  89. data/lib/starter_web/pages/_test_pages/formular-01-tester.adoc +0 -167
  90. data/lib/starter_web/pages/_test_pages/formular-02-tester.adoc +0 -727
  91. data/lib/starter_web/pages/_test_pages/google-translate-tester.0.adoc +0 -113
  92. data/lib/starter_web/pages/_test_pages/google-translate-tester.1.adoc +0 -231
  93. data/lib/starter_web/pages/_test_pages/google-translate-tester.3.adoc +0 -149
  94. data/lib/starter_web/pages/_test_pages/google-translate-tester.4.adoc +0 -237
  95. data/lib/starter_web/pages/_test_pages/infinite-scroll-tester-2.adoc +0 -183
  96. data/lib/starter_web/pages/_test_pages/infinite-scroll-tester-3.adoc +0 -235
  97. data/lib/starter_web/pages/_test_pages/infinite-scroll-tester-4.adoc +0 -222
  98. data/lib/starter_web/pages/_test_pages/infinite-scroll-tester-5.adoc +0 -119
  99. data/lib/starter_web/pages/_test_pages/infinite-scroll-tester.1.adoc +0 -236
  100. data/lib/starter_web/pages/_test_pages/infinite-scroll-tester.adoc +0 -225
  101. data/lib/starter_web/pages/_test_pages/list-group-tester.adoc +0 -265
  102. data/lib/starter_web/pages/_test_pages/tictok.adoc +0 -127
@@ -1,127 +0,0 @@
1
- ---
2
- title: Tester
3
- tagline: button
4
- date: 2020-11-03 00:00:00 +100
5
- description: >
6
- Welcome to the preview page focussing on the image module. This page
7
- shows some valuable features of the J1 Template to manage your image-based
8
- content using lightboxes, carousels (slider), and galleries.
9
-
10
- categories: [ Testpages ]
11
- tags: [ Example ]
12
-
13
- comments: false
14
- fab_menu_id: page_ctrl_simple
15
-
16
- permalink: /pages/public/learn/button_tester/
17
- regenerate: false
18
-
19
- resources: [
20
- clipboard, rouge, carousel, lightbox,
21
- justifiedGallery, lightGallery
22
- ]
23
- resource_options:
24
- - attic:
25
- padding_top: 400
26
- padding_bottom: 50
27
- opacity: 0.5
28
- slides:
29
- - url: /assets/images/pages/roundtrip/images-1920x1280-bw.jpg
30
- alt: Photo by Ricardo Gomez Angel on Unsplash
31
- badge:
32
- type: unsplash
33
- author: Ricardo Gomez Angel
34
- href: https://unsplash.com/@ripato/portfolio
35
- ---
36
-
37
- // Page Initializer
38
- // =============================================================================
39
- // Enable the Liquid Preprocessor
40
- :page-liquid:
41
-
42
- // Set (local) page attributes here
43
- // -----------------------------------------------------------------------------
44
- // :page--attr: <attr-value>
45
- :images-dir: {imagesdir}/pages/roundtrip/100_present_images
46
-
47
- // Load Liquid procedures
48
- // -----------------------------------------------------------------------------
49
- {% capture load_attributes %}themes/{{site.template.name}}/procedures/global/attributes_loader.proc{%endcapture%}
50
-
51
- // Load page attributes
52
- // -----------------------------------------------------------------------------
53
- {% include {{load_attributes}} scope="all" %}
54
-
55
- // Page content
56
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57
-
58
- // Include sub-documents (if any)
59
- // -----------------------------------------------------------------------------
60
-
61
- ++++
62
- <div>
63
-
64
- <a href="#void" class="btn btn-xl btn-primary text-uppercase mr-2 mb-2">
65
- <i class="mdi mdi-language-ruby mdi-3x mr-2"></i>
66
- <span class="float-right text-left mt-2">Let's Use this Button
67
- <span class="d-block r-text-200">30 days free for all users</span>
68
- </span>
69
- </a>
70
-
71
- <a href="#void" class="btn btn-xl btn-primary text-uppercase mr-2 mb-2">
72
- <i class="mdi mdi-language-ruby mdi-3x mr-2"></i>
73
- <span class="float-right text-left mt-2">Let's Use this Button
74
- <span class="d-block r-text-200">30 days free for all users</span>
75
- </span>
76
- </a>
77
-
78
- </div>
79
-
80
- <style>
81
-
82
- /*
83
- .btn-xl {
84
- line-height: 1.4;
85
- padding: 0.92857rem 1.85714rem;
86
- font-size: 1.28571rem;
87
- }
88
-
89
- .u-btn-content {
90
- white-space: normal;
91
- }
92
-
93
- .g-font-weight-600 {
94
- font-weight: 600 !important;
95
- }
96
-
97
- .g-letter-spacing-0_5 {
98
- letter-spacing: 0.03571rem;
99
- }
100
-
101
- .g-brd-2 {
102
- border-width: 2px !important;
103
- }
104
-
105
- .g-mr-10 {
106
- margin-right: 0.71429rem !important;
107
- }
108
-
109
- .g-mb-15 {
110
- margin-bottom: 1.07143rem !important;
111
- }
112
-
113
- .g-font-size-11 {
114
- font-size: 0.78571rem !important;
115
- }
116
-
117
- .g-font-size-42 {
118
- font-size: 3rem !important;
119
- }
120
-
121
- .pull-left {
122
- float: left;
123
- }
124
- */
125
-
126
- </style>
127
- ++++
@@ -1,128 +0,0 @@
1
- ---
2
- title: Tester
3
- tagline: button
4
- date: 2020-11-03 00:00:00 +100
5
- description: >
6
- Welcome to the preview page focussing on the image module. This page
7
- shows some valuable features of the J1 Template to manage your image-based
8
- content using lightboxes, carousels (slider), and galleries.
9
-
10
- categories: [ Testpages ]
11
- tags: [ Example ]
12
-
13
- comments: false
14
- fab_menu_id: page_ctrl_simple
15
-
16
- permalink: /pages/public/learn/card_tester/
17
- regenerate: false
18
-
19
- resources: [
20
- clipboard, rouge, carousel, lightbox,
21
- justifiedGallery, lightGallery
22
- ]
23
- resource_options:
24
- - attic:
25
- padding_top: 400
26
- padding_bottom: 50
27
- opacity: 0.5
28
- slides:
29
- - url: /assets/images/pages/roundtrip/images-1920x1280-bw.jpg
30
- alt: Photo by Ricardo Gomez Angel on Unsplash
31
- badge:
32
- type: unsplash
33
- author: Ricardo Gomez Angel
34
- href: https://unsplash.com/@ripato/portfolio
35
- ---
36
-
37
- // Page Initializer
38
- // =============================================================================
39
- // Enable the Liquid Preprocessor
40
- :page-liquid:
41
-
42
- // Set (local) page attributes here
43
- // -----------------------------------------------------------------------------
44
- // :page--attr: <attr-value>
45
- :images-dir: {imagesdir}/pages/roundtrip/100_present_images
46
-
47
- // Load Liquid procedures
48
- // -----------------------------------------------------------------------------
49
- {% capture load_attributes %}themes/{{site.template.name}}/procedures/global/attributes_loader.proc{%endcapture%}
50
-
51
- // Load page attributes
52
- // -----------------------------------------------------------------------------
53
- {% include {{load_attributes}} scope="all" %}
54
-
55
- // Page content
56
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57
-
58
- // Include sub-documents (if any)
59
- // -----------------------------------------------------------------------------
60
-
61
- ++++
62
- <div>
63
-
64
- <article class="card raised-z3 mb-5">
65
- <h3 id="35983" class="card-header bg-primary">Welcome</h3>
66
- <!-- h5 class="notoc card-subtitle text-muted mb-2">jekyll for everyone</h5 -->
67
-
68
- <div class="row mx-0">
69
-
70
- <div class="col-md-6 img-bg--fill px-0"
71
- style="border-right: 1px dotted rgba(0, 0, 0, 0.25); background-image: url(/assets/images/modules/attics/katie-moum-1920x1280.jpg);">
72
- </div>
73
-
74
- <!-- div class="col-md-6 px-0">
75
- <img class="img__object--cover" src="/assets/images/modules/attics/katie-moum-1920x1280.jpg" alt="Welcome">
76
- </div -->
77
-
78
- <div class="col-md-6 p-0">
79
- <div class="card-body r-text-300">All you’re doing at the end of the day is writing your content, and the J1 Template does all the tricky things: putting out HTML, Javascript, and CSS. As a result, the site creation process gets out of your way. Sounds fun, isn’t it? ...</div>
80
- <div class="card-footer r-text-200">
81
-
82
- <div class="card-footer-text">
83
- <i class="mdi mdi-calendar-blank mdi-md-grey mr-1"></i> 2021 March, 28
84
- </div>
85
- <a class="card-link text-muted text-lowercase" href="/posts/public/featured/2021/03/28/welcome-to-j1/#readmore">
86
- Read · jekyll for everyone
87
- </a>
88
- </div>
89
- </div>
90
-
91
- </div>
92
-
93
- </article>
94
-
95
-
96
- <article class="card raised-z5 mb-5">
97
- <h3 id="35983" class="card-header bg-primary">Welcome</h3>
98
- <!-- h5 class="notoc card-subtitle text-muted mb-2">jekyll for everyone</h5 -->
99
- <div class="card-body r-text-300">All you’re doing at the end of the day is writing your content, and the J1 Template does all the tricky things: putting out HTML, Javascript, and CSS. As a result, the site creation process gets out of your way. Sounds fun, isn’t it? ...</div>
100
- <div class="card-footer r-text-200">
101
- <div class="card-footer-text">
102
- <i class="mdi mdi-calendar-blank mr-1"></i> 2021 March, 28
103
- </div>
104
- <a class="card-link md-grey-800 font-weight-bold g-font-size-12 text-uppercase" href="/posts/public/featured/2021/03/28/welcome-to-j1/#readmore">
105
- Read · jekyll for everyone
106
- </a>
107
- </div>
108
- </article>
109
-
110
- </div>
111
-
112
- <style>
113
-
114
-
115
- .g-bg-img-hero {
116
- background-size: cover;
117
- background-repeat: no-repeat;
118
- background-position: center;
119
- }
120
-
121
- .g-px-0 {
122
- padding-left: 0 !important;
123
- padding-right: 0 !important;
124
- }
125
-
126
- </style>
127
-
128
- ++++
@@ -1,96 +0,0 @@
1
- ---
2
- title: J1
3
- tagline: Cookie Consent
4
- date: 2021-06-24 00:00:00 +100
5
- description: >
6
- Bootstrap Cookie Consent Module
7
- for J1 Template
8
-
9
- categories: [ Testpages ]
10
- tags: [ Example ]
11
-
12
- scrollbar: false
13
- fab_menu_id: default
14
-
15
- advertising: false
16
- comments: false
17
-
18
- permalink: /pages/public/cookieConsent/
19
- regenerate: true
20
-
21
- resources: [ bsCookieConsent ]
22
- resource_options:
23
- - attic:
24
- padding_top: 400
25
- padding_bottom: 50
26
- opacity: 0.5
27
- slides:
28
- - url: /assets/images/modules/attics/cookies-1920x1200.jpg
29
- ---
30
-
31
- // Page Initializer
32
- // =============================================================================
33
- // Enable the Liquid Preprocessor
34
- :page-liquid:
35
-
36
- // Set (local) page attributes here
37
- // -----------------------------------------------------------------------------
38
- // :page--attr: <attr-value>
39
- :badges-enabled: false
40
-
41
- // Load Liquid procedures
42
- // -----------------------------------------------------------------------------
43
- {% capture load_attributes %}themes/{{site.template.name}}/procedures/global/attributes_loader.proc{%endcapture%}
44
-
45
- // Load page attributes
46
- // -----------------------------------------------------------------------------
47
- {% include {{load_attributes}} scope="global" %}
48
-
49
-
50
- // Page content
51
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52
-
53
- ++++
54
- <div class="container">
55
- <h2>Usage</h2>
56
- <p>Initialize the cookie consent framework with the constructor</p>
57
- <p><code>var cookieSettings = new BootstrapCookieConsent()</code></p>
58
- <h3>Show the Dialog</h3>
59
- <p>
60
- On a new visit the dialog is shown automatically. For reconfiguration
61
- show the Dialog again with <code>cookieSettings.showDialog()</code>.
62
- </p>
63
- <p>
64
- <a href="javascript:showSettingsDialog()" class="btn btn-primary">Cookie Settings</a>
65
- </p>
66
- <h2>Read the settings</h2>
67
- <p>Read all cookie settings with <code>cookieSettings.getSettings()</code></p>
68
- <div class="card mb-4">
69
- <div class="card-body">
70
- <pre class="mb-0" id="settingsOutput"></pre>
71
- </div>
72
- </div>
73
- <p>Read a specific cookie setting with <code>cookieSettings.getSettings('analyses')</code></p>
74
- <div class="card">
75
- <div class="card-body">
76
- <pre class="mb-0" id="settingsAnalysisOutput"></pre>
77
- </div>
78
- </div>
79
- </div>
80
-
81
- <script>
82
-
83
- function showSettingsDialog() {
84
- j1.cookieConsent.showDialog();
85
- }
86
-
87
- var dependencies_met_cookie_consent_ready = setInterval (function (options) {
88
- if ( typeof j1.cookieConsent !== 'undefined' ) {
89
- $("#settingsOutput").text(JSON.stringify(j1.cookieConsent.getSettings()))
90
- $("#settingsAnalysisOutput").text(j1.cookieConsent.getSettings('analyses'))
91
- clearInterval(dependencies_met_cookie_consent_ready);
92
- }
93
- });
94
-
95
- </script>
96
- ++++
@@ -1,258 +0,0 @@
1
- ---
2
- title: Tester
3
- tagline: deepl
4
- date: 2020-11-03 00:00:00 +100
5
- description: >
6
- Welcome to the preview page focussing on the image module. This page
7
- shows some valuable features of the J1 Template to manage your image-based
8
- content using lightboxes, carousels (slider), and galleries.
9
-
10
- categories: [ Testpages ]
11
- tags: [ Example ]
12
-
13
- comments: false
14
- fab_menu_id: page_ctrl_simple
15
-
16
- permalink: /pages/public/learn/deepl-0/
17
- regenerate: false
18
-
19
- resources: [ clipboard, rouge ]
20
- resource_options:
21
- - attic:
22
- padding_top: 400
23
- padding_bottom: 50
24
- opacity: 0.5
25
- slides:
26
- - url: /assets/images/pages/roundtrip/images-1920x1280-bw.jpg
27
- alt: Photo by Ricardo Gomez Angel on Unsplash
28
- badge:
29
- type: unsplash
30
- author: Ricardo Gomez Angel
31
- href: https://unsplash.com/@ripato/portfolio
32
- ---
33
-
34
- // Page Initializer
35
- // =============================================================================
36
- // Enable the Liquid Preprocessor
37
- :page-liquid:
38
-
39
- // Set (local) page attributes here
40
- // -----------------------------------------------------------------------------
41
- // :page--attr: <attr-value>
42
- :images-dir: {imagesdir}/pages/roundtrip/100_present_images
43
-
44
- // Load Liquid procedures
45
- // -----------------------------------------------------------------------------
46
- {% capture load_attributes %}themes/{{site.template.name}}/procedures/global/attributes_loader.proc{%endcapture%}
47
-
48
- // Load page attributes
49
- // -----------------------------------------------------------------------------
50
- {% include {{load_attributes}} scope="global" %}
51
-
52
- // Page content
53
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54
- // https://github.com/EdwardBalaj/Simple-DeepL-API-Integration
55
-
56
- // Include sub-documents (if any)
57
- // -----------------------------------------------------------------------------
58
-
59
- == Deepl API V2
60
-
61
- An integration of the DeepL API that translates a given text from one language
62
- (default:English) to another language and outputs the translation.
63
-
64
- ++++
65
- <div>
66
- <!-- Keeps all elements in a well laid out form. -->
67
- <form id="layout">
68
- <!-- Source language part, also kept in its own element. -->
69
- <div id="source">
70
- <!-- Since English is the only option, it will default to it. -->
71
- <select id="source-language" name="source-language">
72
- <option value="DE">Auto</option>
73
- <option value="EN">English</option>
74
- <option value="DE">German</option>
75
- </select>
76
-
77
- <textarea type="text" id="original-text"></textarea>
78
- </div>
79
-
80
- <!-- Uses the translateText() function in the API-DeepL.js file to parse the input, s
81
- end it for translation, and then parse the response. -->
82
- <input type="button" id="translate" onclick="translateText()" value="Translate">
83
- </br>
84
-
85
- <!-- Destination language part, also kept in its own element. -->
86
- <div id="destination">
87
- <!-- Since there are more destination languages, and they are all sorted in alphabetical order,
88
- Bulgarian is the default one. -->
89
- <select id="destination-language" name="destination-language">
90
- <option value="BG">Bulgarian</option>
91
- <option value="ZH">Chinese</option>
92
- <option value="CS">Czech</option>
93
- <option value="DA">Danish</option>
94
- <option value="NL">Dutch</option>
95
- <option value="EN-US">English (American)</option>
96
- <option value="EN-GB">English (British)</option>
97
- <option value="EN">English (Others)</option>
98
- <option value="ET">Estonian</option>
99
- <option value="FI">Finnish</option>
100
- <option value="FR">French</option>
101
- <option selected value="DE">German</option>
102
- <option value="EL">Greek</option>
103
- <option value="HU">Hungarian</option>
104
- <option value="IT">Italian</option>
105
- <option value="JA">Japanese</option>
106
- <option value="LV">Latvian</option>
107
- <option value="LT">Lithuanian</option>
108
- <option value="PL">Polish</option>
109
- <option value="PT-PT">Portuguese (Portugal)</option>
110
- <option value="PT-BR">Portuguese (Brazilian)</option>
111
- <option value="PT">Portuguese (Others)</option>
112
- <option value="RO">Romanian</option>
113
- <option value="RU">Russian</option>
114
- <option value="SK">Slovak</option>
115
- <option value="SL">Slovenian</option>
116
- <option value="ES">Spanish</option>
117
- <option value="SV">Swedish</option>
118
- </select>
119
-
120
- <textarea type="text" id="translated-text"></textarea>
121
- </div>
122
-
123
- </form>
124
- </div>
125
- ++++
126
-
127
- ++++
128
- <style>
129
-
130
- textarea {
131
- word-wrap: break-word;
132
- min-width: 100%;
133
- max-width: 100%;
134
- min-height: 10em;
135
- }
136
-
137
- select {
138
- display: block;
139
- width: 10em;
140
- margin: 1em 0;
141
- }
142
-
143
- </style>
144
- ++++
145
-
146
- ++++
147
- <script>
148
-
149
- /*
150
- Author: Alexandru Edward Balaj
151
- Date: 15/07/2021
152
- Project: Simple DeepL API Integration
153
- License: MIT License
154
- File name: API-DeepL.js
155
- File description: JavaScript algorithm that parses the input, sends it using the DeepL API,
156
- and then parses the output to display it.
157
- */
158
-
159
- /*
160
- The aim of the algorithm design laid out here,
161
- was to create a module oriented way,
162
- to help with futures updates and allow for easier error tracking.
163
- */
164
-
165
- /*
166
- Authentication key given in the specifications.
167
- */
168
- // var AUTH_KEY = "5652c0b9-adcf-7f2e-f6a2-3a577f700dc9:fx";
169
- var AUTH_KEY = "fe1c56dc-1342-9899-26db-c5d701791e2d:fx";
170
-
171
- var TAG_HANDLING = "xml";
172
- /*
173
- Since the specifications required for the website,
174
- to accept only English text, the source language is coded here,
175
- so that in the future, if required this could be easily changed.
176
- */
177
- var SOURCE_LANG = "auto";
178
-
179
- /*
180
- According to XMLHttpRequest specifications, when the request is done,
181
- it returns a code ("4"), and when the status of the request is ok,
182
- it returns another code ("200");
183
- */
184
- var READYSTATE_DONE = 4;
185
- var STATUS_OK = 200;
186
-
187
- /*
188
- Creates an xmlHttpRequest object as soon as the page has loaded.
189
- */
190
- var xhr = new XMLHttpRequest();
191
-
192
- /*
193
- Setup function for creating a request, designed as a module, according to DeepL API specifications.
194
- */
195
- function setup() {
196
- xhr.open("POST", "https://api-free.deepl.com/v2/translate", true);
197
-
198
- xhr.setRequestHeader("Accept", "*/*");
199
- xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
200
- // xhr.setRequestHeader("tag_handling", "xml");
201
- // xhr.setRequestHeader("User-Agent", "DeepL API Implementation");
202
- // xhr.setRequestHeader("Content-Length", null);
203
- }
204
-
205
- /*
206
- Prepare text function used to parse, or arrange text, designed as a module.
207
- Currently it splits all text whenever a newline ("\n") is met,
208
- so that it preserves the original layout of the text,
209
- which would have otherwise been lost because of the way DeepL accepts multiple sentences.
210
- */
211
- function prepareText(original_text) {
212
- return original_text.split("\n");
213
- }
214
-
215
- /*
216
- Translate text function which uses all the other modules, in order to create a request,
217
- which is sent to the DeepL API to translate, and then display the result, designed as a module.
218
- */
219
- function translateText() {
220
- setup();
221
-
222
- var target_language = document.getElementById("destination-language").value;
223
-
224
- var original_text = document.getElementById("original-text").value;
225
-
226
- original_text_lines = prepareText(original_text);
227
-
228
- // Makes a request with every line, as a new text to translate.
229
- var request = "";
230
- for(var i = 0; i < original_text_lines.length; i++) {
231
- request += "&text=" + original_text_lines[i];
232
- }
233
-
234
- xhr.onload = function () {
235
- if (xhr.readyState === xhr.DONE) {
236
- if (xhr.status === 200) {
237
- // Uses JSON to parse the response.
238
- var result = JSON.parse(xhr.responseText);
239
-
240
- // Recreates the response as one text, which kept its original layout.
241
- var translated_text = "";
242
- for(var i = 0; i < result.translations.length; i++) {
243
- translated_text += result.translations[i].text;
244
- translated_text += "\n";
245
- }
246
-
247
- document.getElementById("translated-text").value = translated_text;
248
- }
249
- }
250
- };
251
-
252
- // Send the request to the server for translation.
253
- //xhr.send("auth_key=" + AUTH_KEY + request + "&source_lang=" + SOURCE_LANG + "&target_lang=" + target_language);
254
- xhr.send("auth_key=" + AUTH_KEY + request + "&target_lang=" + target_language + "&tag_handling=xml&ignore_tags=em");
255
- //xhr.send("auth_key=" + AUTH_KEY + request + "&source_lang=" + SOURCE_LANG + "&target_lang=" + target_language + "tag_handling=" + TAG_HANDLING);
256
- }
257
- </script>
258
- ++++