cyberweb 0.12.35 → 0.13.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +220 -124
- data/bin/cyberweb_sanitize +1 -1
- data/bin/images_from_this_webpage +1 -1
- data/doc/README.gen +209 -98
- data/doc/configuration/configuration.md +7 -4
- data/doc/todo/todo_for_the_cyberweb_project.md +123 -133
- data/examples/html/underlined_text_example/underlined_text_example.html +40 -0
- data/examples/misc/table_example.rb +19 -17
- data/examples/objectified/objectified_caesar_cipher.cgi +73 -0
- data/images/cyberweb_theme.png +0 -0
- data/lib/cyberweb/REST/constants.rb +1 -1
- data/lib/cyberweb/base/base.rb +19 -27
- data/lib/cyberweb/base_module/base_module/base_module.rb +31 -16
- data/lib/cyberweb/base_module/colours/colours.rb +0 -8
- data/lib/cyberweb/cascading_style_sheets/margin.css +4 -0
- data/lib/cyberweb/cascading_style_sheets/misc.css +15 -0
- data/lib/cyberweb/cgi/cookie.rb +160 -156
- data/lib/cyberweb/cgi/core.rb +7 -7
- data/lib/cyberweb/cgi/query_extension.rb +1 -1
- data/lib/cyberweb/cgi/session/memory_store.rb +1 -1
- data/lib/cyberweb/cgi/session/pstore.rb +2 -2
- data/lib/cyberweb/cgi/session.rb +1 -1
- data/lib/cyberweb/cgi/util.rb +4 -1
- data/lib/cyberweb/cmd/cmd.rb +12 -10
- data/lib/cyberweb/coloured_tags/coloured_tags.rb +1 -1
- data/lib/cyberweb/colours/colour_chart.rb +1 -2
- data/lib/cyberweb/colours/colours.rb +1 -1
- data/lib/cyberweb/commandline/commandline_interface.rb +1 -1
- data/lib/cyberweb/configuration/load_the_configuration.rb +3 -1
- data/lib/cyberweb/constants/http_status_codes.rb +4 -1
- data/lib/cyberweb/constants/misc.rb +8 -6
- data/lib/cyberweb/constants/registered_html_tags.rb +6 -5
- data/lib/cyberweb/constants/user_x.rb +7 -0
- data/lib/cyberweb/css_manager/css_manager.rb +5 -2
- data/lib/cyberweb/encoding/encoding.rb +1 -1
- data/lib/cyberweb/erb/test.rhtml +7 -2
- data/lib/cyberweb/experimental/html_template_powered_by_rack.rb +3 -1
- data/lib/cyberweb/foto_gallery/foto_gallery.rb +3 -0
- data/lib/cyberweb/generator/cgi.rb +1 -1
- data/lib/cyberweb/html_template/html_template.rb +383 -311
- data/lib/cyberweb/images/images.rb +2 -2
- data/lib/cyberweb/images/remove_this_substring_from_all_images.rb +5 -1
- data/lib/cyberweb/images/standard_images/standard_images.html +3 -4
- data/lib/cyberweb/information/README.md +2 -2
- data/lib/cyberweb/information/information.cgi +1 -1
- data/lib/cyberweb/javascript/dragula_collection.rb +4 -1
- data/lib/cyberweb/javascript/javascript_magic.rb +2 -2
- data/lib/cyberweb/javascript/on_click_change_opacity.rb +2 -1
- data/lib/cyberweb/javascript/popup.rb +8 -1
- data/lib/cyberweb/javascript/snoweffect.rb +5 -1
- data/lib/cyberweb/javascript_code/custom_functions.js +50 -32
- data/lib/cyberweb/objectified/html_tags/README.md +7 -9
- data/lib/cyberweb/objectified/html_tags/a.rb +62 -3
- data/lib/cyberweb/objectified/html_tags/abbr.rb +33 -3
- data/lib/cyberweb/objectified/html_tags/audio.rb +33 -3
- data/lib/cyberweb/objectified/html_tags/base.rb +661 -588
- data/lib/cyberweb/objectified/html_tags/blockquote.rb +33 -3
- data/lib/cyberweb/objectified/html_tags/body.rb +43 -3
- data/lib/cyberweb/objectified/html_tags/button.rb +75 -5
- data/lib/cyberweb/objectified/html_tags/canvas.rb +43 -3
- data/lib/cyberweb/objectified/html_tags/cite.rb +43 -3
- data/lib/cyberweb/objectified/html_tags/div.rb +70 -7
- data/lib/cyberweb/objectified/html_tags/embed.rb +43 -3
- data/lib/cyberweb/objectified/html_tags/fieldset.rb +43 -3
- data/lib/cyberweb/objectified/html_tags/figure.rb +43 -3
- data/lib/cyberweb/objectified/html_tags/form.rb +78 -3
- data/lib/cyberweb/objectified/html_tags/h1.rb +43 -3
- data/lib/cyberweb/objectified/html_tags/h2.rb +43 -3
- data/lib/cyberweb/objectified/html_tags/h3.rb +43 -3
- data/lib/cyberweb/objectified/html_tags/h4.rb +43 -3
- data/lib/cyberweb/objectified/html_tags/h5.rb +43 -3
- data/lib/cyberweb/objectified/html_tags/h6.rb +43 -3
- data/lib/cyberweb/objectified/html_tags/head.rb +34 -1
- data/lib/cyberweb/objectified/html_tags/i.rb +112 -0
- data/lib/cyberweb/objectified/html_tags/img.rb +65 -18
- data/lib/cyberweb/objectified/html_tags/input.rb +86 -2
- data/lib/cyberweb/objectified/html_tags/label.rb +103 -0
- data/lib/cyberweb/objectified/html_tags/legend.rb +129 -0
- data/lib/cyberweb/objectified/html_tags/li.rb +111 -0
- data/lib/cyberweb/objectified/html_tags/map.rb +43 -3
- data/lib/cyberweb/objectified/html_tags/meta.rb +13 -2
- data/lib/cyberweb/objectified/html_tags/nav.rb +111 -0
- data/lib/cyberweb/objectified/html_tags/object.rb +33 -3
- data/lib/cyberweb/objectified/html_tags/ol.rb +127 -0
- data/lib/cyberweb/objectified/html_tags/p.rb +33 -3
- data/lib/cyberweb/objectified/html_tags/pre.rb +41 -4
- data/lib/cyberweb/objectified/html_tags/progress.rb +43 -3
- data/lib/cyberweb/objectified/html_tags/section.rb +116 -0
- data/lib/cyberweb/objectified/html_tags/select.rb +34 -1
- data/lib/cyberweb/objectified/html_tags/span.rb +64 -5
- data/lib/cyberweb/objectified/html_tags/style.rb +9 -2
- data/lib/cyberweb/objectified/html_tags/table.rb +137 -3
- data/lib/cyberweb/objectified/html_tags/td.rb +135 -0
- data/lib/cyberweb/objectified/html_tags/textarea.rb +37 -3
- data/lib/cyberweb/objectified/html_tags/th.rb +114 -0
- data/lib/cyberweb/objectified/html_tags/thead.rb +114 -0
- data/lib/cyberweb/objectified/html_tags/title.rb +10 -2
- data/lib/cyberweb/objectified/html_tags/tr.rb +110 -0
- data/lib/cyberweb/objectified/html_tags/ul.rb +45 -4
- data/lib/cyberweb/objectified/shorter_helper_methods/shorter_helper_methods.rb +67 -46
- data/lib/cyberweb/oop.rb +9 -0
- data/lib/cyberweb/predefined_and_freeform_methods/hash_registered_extra_tags.rb +2 -0
- data/lib/cyberweb/predefined_and_freeform_methods/header.rb +4 -1
- data/lib/cyberweb/project/project.rb +0 -4
- data/lib/cyberweb/requires/remove_html.rb +1 -1
- data/lib/cyberweb/requires/require_the_cyberweb_project.rb +1 -9
- data/lib/cyberweb/route_handler/module/route_handler_module.rb +2 -1
- data/lib/cyberweb/standalone_classes/all_css_classes.rb +5 -2
- data/lib/cyberweb/standalone_classes/calculator.rb +3 -1
- data/lib/cyberweb/toplevel_methods/audio.rb +3 -1
- data/lib/cyberweb/toplevel_methods/csv.rb +1 -1
- data/lib/cyberweb/toplevel_methods/frames.rb +11 -3
- data/lib/cyberweb/toplevel_methods/greek_letters/greek_letters.rb +3 -0
- data/lib/cyberweb/toplevel_methods/hfin.rb +5 -1
- data/lib/cyberweb/toplevel_methods/html_tags/README.md +8 -7
- data/lib/cyberweb/toplevel_methods/html_tags/html_tags.rb +4211 -2827
- data/lib/cyberweb/toplevel_methods/html_tags/table.rb +1202 -0
- data/lib/cyberweb/toplevel_methods/javascript.rb +9 -1
- data/lib/cyberweb/toplevel_methods/jquery.rb +1 -1
- data/lib/cyberweb/toplevel_methods/{log_directory.rb → log_directory_and_logging.rb} +36 -1
- data/lib/cyberweb/toplevel_methods/params.rb +11 -11
- data/lib/cyberweb/toplevel_methods/random.rb +4 -3
- data/lib/cyberweb/toplevel_methods/registered_ids.rb +3 -0
- data/lib/cyberweb/toplevel_methods/return_head_start.rb +1 -3
- data/lib/cyberweb/toplevel_methods/return_html_start.rb +1 -3
- data/lib/cyberweb/toplevel_methods/sanitize_url.rb +2 -1
- data/lib/cyberweb/toplevel_methods/server_base_directory.rb +0 -1
- data/lib/cyberweb/toplevel_methods/textile.rb +2 -1
- data/lib/cyberweb/toplevel_methods/{misc.rb → toplevel_methods.rb} +1446 -807
- data/lib/cyberweb/toplevel_methods/video.rb +21 -3
- data/lib/cyberweb/toplevel_methods/write_what_into.rb +2 -2
- data/lib/cyberweb/utility_scripts/autogenerate_drop_shadow_rules/autogenerate_drop_shadow_rules.rb +2 -4
- data/lib/cyberweb/utility_scripts/booklet/booklet.rb +0 -4
- data/lib/cyberweb/utility_scripts/download_all_images_from_this_website.rb +1 -1
- data/lib/cyberweb/utility_scripts/{download_balloon_css.rb → download_balloon_css/download_balloon_css.rb} +1 -1
- data/lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb +3 -0
- data/lib/cyberweb/utility_scripts/obtain_files_and_directories_from_this_path/obtain_files_and_directories_from_this_path.rb +184 -72
- data/lib/cyberweb/utility_scripts/pdf_to_html/pdf_to_html.rb +161 -65
- data/lib/cyberweb/version/version.rb +2 -2
- data/lib/cyberweb/web_images/map_symbol_to_image_location.rb +13 -2
- data/lib/cyberweb/web_object/web_object.rb +65 -67
- data/lib/cyberweb/web_scraper/scrape_this_url.rb +3 -1
- data/lib/cyberweb/webmin/biology_server.cgi +1 -1
- data/lib/cyberweb/webmin/calculator.cgi +1 -1
- data/lib/cyberweb/webmin/colour_chart.cgi +1 -1
- data/lib/cyberweb/webmin/comments.cgi +2 -2
- data/lib/cyberweb/webmin/constants.rb +1 -1
- data/lib/cyberweb/webmin/dictionary.cgi +2 -2
- data/lib/cyberweb/webmin/simple_forum/index.cgi +2 -2
- data/lib/cyberweb/webmin/sys_info.cgi +3 -3
- data/lib/cyberweb/webmin/webforum.cgi +1 -1
- data/lib/cyberweb/yaml/registered_html_tags.yml +3 -1
- data/test/simple_tests/testing_return_dataset_without_any_comments.rb +1 -1
- metadata +23 -57
- data/lib/cyberweb/html_tags/README.md +0 -3
- data/lib/cyberweb/html_tags/a.rb +0 -67
- data/lib/cyberweb/html_tags/accesskey.rb +0 -25
- data/lib/cyberweb/html_tags/blockquote.rb +0 -56
- data/lib/cyberweb/html_tags/body.rb +0 -14
- data/lib/cyberweb/html_tags/br.rb +0 -19
- data/lib/cyberweb/html_tags/button.rb +0 -150
- data/lib/cyberweb/html_tags/canvas.rb +0 -59
- data/lib/cyberweb/html_tags/chtml.rb +0 -14
- data/lib/cyberweb/html_tags/div.rb +0 -170
- data/lib/cyberweb/html_tags/fieldset.rb +0 -69
- data/lib/cyberweb/html_tags/figure.rb +0 -72
- data/lib/cyberweb/html_tags/form.rb +0 -203
- data/lib/cyberweb/html_tags/h1.rb +0 -77
- data/lib/cyberweb/html_tags/h2.rb +0 -81
- data/lib/cyberweb/html_tags/h3.rb +0 -60
- data/lib/cyberweb/html_tags/h4.rb +0 -66
- data/lib/cyberweb/html_tags/h5.rb +0 -64
- data/lib/cyberweb/html_tags/h6.rb +0 -60
- data/lib/cyberweb/html_tags/hr.rb +0 -22
- data/lib/cyberweb/html_tags/html_tags.rb +0 -267
- data/lib/cyberweb/html_tags/i.rb +0 -52
- data/lib/cyberweb/html_tags/img.rb +0 -294
- data/lib/cyberweb/html_tags/input.rb +0 -354
- data/lib/cyberweb/html_tags/label.rb +0 -65
- data/lib/cyberweb/html_tags/legend.rb +0 -56
- data/lib/cyberweb/html_tags/li.rb +0 -67
- data/lib/cyberweb/html_tags/map.rb +0 -38
- data/lib/cyberweb/html_tags/nav.rb +0 -63
- data/lib/cyberweb/html_tags/object.rb +0 -57
- data/lib/cyberweb/html_tags/ol.rb +0 -57
- data/lib/cyberweb/html_tags/option.rb +0 -64
- data/lib/cyberweb/html_tags/p.rb +0 -88
- data/lib/cyberweb/html_tags/pre.rb +0 -162
- data/lib/cyberweb/html_tags/section.rb +0 -33
- data/lib/cyberweb/html_tags/select.rb +0 -104
- data/lib/cyberweb/html_tags/span.rb +0 -344
- data/lib/cyberweb/html_tags/strong.rb +0 -42
- data/lib/cyberweb/html_tags/table.rb +0 -284
- data/lib/cyberweb/html_tags/tbody.rb +0 -26
- data/lib/cyberweb/html_tags/td.rb +0 -212
- data/lib/cyberweb/html_tags/textarea.rb +0 -173
- data/lib/cyberweb/html_tags/th.rb +0 -70
- data/lib/cyberweb/html_tags/thead.rb +0 -41
- data/lib/cyberweb/html_tags/tr.rb +0 -99
- data/lib/cyberweb/html_tags/ul.rb +0 -51
- data/lib/cyberweb/requires/require_html_tags_files.rb +0 -23
- data/lib/cyberweb/toplevel_methods/logging.rb +0 -42
- data/lib/cyberweb/web_base/web_base.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12ff841d011b8294776122340546a96d633f05166b424d12e9b2867551bebed6
|
4
|
+
data.tar.gz: 765d1c3d3914d44e3d4197a1ebbf6f8fc5d6bff2029c9b7c5ac5081d687acc31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03fa010ce39ce743510fae459cde8786c5f60318e61677ff5fc7b6cee60d0028caa88ef1853dffd5823e6e0355939d2e50aa8ab488cf5d243f4bab7dd703e123
|
7
|
+
data.tar.gz: 4866876f3e15a6d72de9b5a7759730debd00c9b5a2004f9738186dee75a8f830df72dd0e6a815c68298d000fa44dfd4f718d95cd38fa78e398a44c694cb7fd90
|
data/README.md
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
[![forthebadge](https://forthebadge.com/images/badges/made-with-ruby.svg)](https://www.ruby-lang.org/en/)
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/cyberweb.svg)](https://badge.fury.io/rb/cyberweb)
|
4
4
|
|
5
|
-
This gem was <b>last updated</b> on the <span style="color: darkblue; font-weight: bold">
|
5
|
+
This gem was <b>last updated</b> on the <span style="color: darkblue; font-weight: bold">10.03.2024</span> (dd.mm.yyyy notation), at <span style="color: steelblue; font-weight: bold">15:36:44</span> o'clock.
|
6
6
|
|
7
|
-
<img src="https://i.imgur.com/
|
7
|
+
<img src="https://i.imgur.com/r7tRkFl.png" style="margin-left: 1.2em">
|
8
8
|
|
9
|
-
##
|
9
|
+
## Introduction to the Cyberweb project
|
10
10
|
|
11
11
|
The <b>cyberweb project</b> allows the user to make use of ruby to tap
|
12
12
|
into web-related functionality in general.
|
@@ -2603,100 +2603,6 @@ If you want to use comments in a CSS file, use something like this:
|
|
2603
2603
|
|
2604
2604
|
/* This is a CSS comment. */
|
2605
2605
|
|
2606
|
-
## JavaScript comments
|
2607
|
-
|
2608
|
-
The simplest way to use comments in JavaScript, in my opinion, is
|
2609
|
-
via:
|
2610
|
-
|
2611
|
-
/* This is a comment */
|
2612
|
-
|
2613
|
-
## JavaScript loops
|
2614
|
-
|
2615
|
-
To do a loop in "modern" JavaScript, try:
|
2616
|
-
|
2617
|
-
for (let i = 0; i < 5; ++i) {
|
2618
|
-
/* do stuff here */
|
2619
|
-
}
|
2620
|
-
|
2621
|
-
The index variable <b>i</b> will remain completely local to the
|
2622
|
-
block, and not appear outside of it.
|
2623
|
-
|
2624
|
-
Note that JavaScript also allows you to use a .forEach loop instead,
|
2625
|
-
which no longer requires of you to use an index-counter.
|
2626
|
-
|
2627
|
-
There are a few variations possible for the .forEach() loop.
|
2628
|
-
|
2629
|
-
A somewhat verbose variant is the following one:
|
2630
|
-
|
2631
|
-
array.forEach(
|
2632
|
-
function(entry) {
|
2633
|
-
document.write(
|
2634
|
-
"<img style=\"margin: 2px; margin-bottom: 5px\" src=\""+entry.replace(/^(\/home\/x\/data\/images\/fotos\/)/,"")+
|
2635
|
-
"\"><br>\n"
|
2636
|
-
)
|
2637
|
-
document.write('<br>')
|
2638
|
-
}
|
2639
|
-
);
|
2640
|
-
|
2641
|
-
Here we can easily use multiple lines.
|
2642
|
-
|
2643
|
-
A shorter variant exists via the => arrow.
|
2644
|
-
|
2645
|
-
Example for this:
|
2646
|
-
|
2647
|
-
array.forEach(entry => console.log(entry));
|
2648
|
-
|
2649
|
-
So this is basically like <b>pp</b> in ruby.
|
2650
|
-
|
2651
|
-
## Checking for specific keys pressed, via JavaScript
|
2652
|
-
|
2653
|
-
You can obtain an event, and then call the method .code on it, such as via:
|
2654
|
-
|
2655
|
-
if (e.code === 'ArrowLeft') { # For the left-arrow key.
|
2656
|
-
}
|
2657
|
-
if (e.code === 'ArrowRight') { # For the right-arrow key.
|
2658
|
-
}
|
2659
|
-
|
2660
|
-
## Symbols in JavaScript
|
2661
|
-
|
2662
|
-
To define a symbol in JavaScript, use Symbol() such as in:
|
2663
|
-
|
2664
|
-
let symbol1 = Symbol("mysymbol1")
|
2665
|
-
|
2666
|
-
## String concatenation in JavaScript
|
2667
|
-
|
2668
|
-
The simplest way to concatenate two Strings in JavaScript
|
2669
|
-
is by using the <b>+</b> operator.
|
2670
|
-
|
2671
|
-
Example for this:
|
2672
|
-
|
2673
|
-
foobar = "foo" + "bar"
|
2674
|
-
|
2675
|
-
You can append to an existing String via the <b>+=</b> operator.
|
2676
|
-
|
2677
|
-
Example for this:
|
2678
|
-
|
2679
|
-
foobar = "foo"
|
2680
|
-
foobar += "bar"
|
2681
|
-
|
2682
|
-
You can also use the method .concat(), such as in:
|
2683
|
-
|
2684
|
-
foo = "foo"
|
2685
|
-
foobar = foo.concat("bar")
|
2686
|
-
|
2687
|
-
## Obtaining user input in JavaScript
|
2688
|
-
|
2689
|
-
The following code example shows how to obtain user input via JavScript:
|
2690
|
-
|
2691
|
-
var x, y;
|
2692
|
-
x = prompt("Gib mal eine Zahl ein","")
|
2693
|
-
y = prompt("Gib mir noch eine Zahl","")
|
2694
|
-
alert(Number(x)+Number(y)
|
2695
|
-
|
2696
|
-
So the primary way to obtain user through JavaScript goes via
|
2697
|
-
<b>window.prompt</b>. The second argument to that method
|
2698
|
-
specifies the default value of the input-field.
|
2699
|
-
|
2700
2606
|
## CSS font-face property (in CSS3)
|
2701
2607
|
|
2702
2608
|
Via the <b>@font-face</b> property it is possible to make use of
|
@@ -4269,6 +4175,168 @@ also use onclick="call_function_here()", but one advantage of using
|
|
4269
4175
|
event listeners is that we can be more flexible, and even remove
|
4270
4176
|
events again.
|
4271
4177
|
|
4178
|
+
### JavaScript comments
|
4179
|
+
|
4180
|
+
The simplest way to use comments in JavaScript, in my opinion, is
|
4181
|
+
via:
|
4182
|
+
|
4183
|
+
/* This is a comment */
|
4184
|
+
|
4185
|
+
### JavaScript loops
|
4186
|
+
|
4187
|
+
To do a loop in "modern" JavaScript, try:
|
4188
|
+
|
4189
|
+
for (let i = 0; i < 5; ++i) {
|
4190
|
+
/* do stuff here */
|
4191
|
+
}
|
4192
|
+
|
4193
|
+
The index variable <b>i</b> will remain completely local to the
|
4194
|
+
block, and not appear outside of it.
|
4195
|
+
|
4196
|
+
Note that JavaScript also allows you to use a .forEach loop instead,
|
4197
|
+
which no longer requires of you to use an index-counter.
|
4198
|
+
|
4199
|
+
There are a few variations possible for the .forEach() loop.
|
4200
|
+
|
4201
|
+
A somewhat verbose variant is the following one:
|
4202
|
+
|
4203
|
+
array.forEach(
|
4204
|
+
function(entry) {
|
4205
|
+
document.write(
|
4206
|
+
"<img style=\"margin: 2px; margin-bottom: 5px\" src=\""+entry.replace(/^(\/home\/x\/data\/images\/fotos\/)/,"")+
|
4207
|
+
"\"><br>\n"
|
4208
|
+
)
|
4209
|
+
document.write('<br>')
|
4210
|
+
}
|
4211
|
+
);
|
4212
|
+
|
4213
|
+
Here we can easily use multiple lines.
|
4214
|
+
|
4215
|
+
A shorter variant exists via the => arrow.
|
4216
|
+
|
4217
|
+
Example for this:
|
4218
|
+
|
4219
|
+
array.forEach(entry => console.log(entry));
|
4220
|
+
|
4221
|
+
So this is basically like <b>pp</b> in ruby.
|
4222
|
+
|
4223
|
+
### Checking for specific keys pressed, via JavaScript
|
4224
|
+
|
4225
|
+
You can obtain an event, and then call the method .code on it, such as via:
|
4226
|
+
|
4227
|
+
if (e.code === 'ArrowLeft') { # For the left-arrow key.
|
4228
|
+
}
|
4229
|
+
if (e.code === 'ArrowRight') { # For the right-arrow key.
|
4230
|
+
}
|
4231
|
+
|
4232
|
+
### Converting Strings to Numbers in JavaScript
|
4233
|
+
|
4234
|
+
To convert a String such as "5" to the Integer 5, use:
|
4235
|
+
|
4236
|
+
x = "5"
|
4237
|
+
parseInt(x)
|
4238
|
+
|
4239
|
+
To convert a String such as "5.15" to the Float 5.15, use:
|
4240
|
+
|
4241
|
+
x = "5.15"
|
4242
|
+
parseFloat(x)
|
4243
|
+
|
4244
|
+
Numbers can be converted to a String via the method
|
4245
|
+
<b>toString()</b>.
|
4246
|
+
|
4247
|
+
You can then also use the comparison operator, aka <b>===</b>:
|
4248
|
+
|
4249
|
+
a = parseInt("3");
|
4250
|
+
b = parseInt("5");
|
4251
|
+
a === b
|
4252
|
+
|
4253
|
+
### Setting a default value to a variable in JavaScript
|
4254
|
+
|
4255
|
+
let foobar = object.method1 || 'Default Value here'
|
4256
|
+
|
4257
|
+
### Using the switch statement in JavaScript
|
4258
|
+
|
4259
|
+
Usage example:
|
4260
|
+
|
4261
|
+
switch(expression){
|
4262
|
+
case x:
|
4263
|
+
/* code to run when expression === x */
|
4264
|
+
break;
|
4265
|
+
case y:
|
4266
|
+
/* code to run when expression === y */
|
4267
|
+
break;
|
4268
|
+
default:
|
4269
|
+
/* code to run if nothing else matches expression */
|
4270
|
+
}
|
4271
|
+
|
4272
|
+
### Symbols in JavaScript
|
4273
|
+
|
4274
|
+
To define a symbol in JavaScript, use Symbol() such as in:
|
4275
|
+
|
4276
|
+
let symbol1 = Symbol("mysymbol1")
|
4277
|
+
|
4278
|
+
### String concatenation in JavaScript
|
4279
|
+
|
4280
|
+
The simplest way to concatenate two Strings in JavaScript
|
4281
|
+
is by using the <b>+</b> operator.
|
4282
|
+
|
4283
|
+
Example for this:
|
4284
|
+
|
4285
|
+
foobar = "foo" + "bar"
|
4286
|
+
|
4287
|
+
You can append to an existing String via the <b>+=</b> operator.
|
4288
|
+
|
4289
|
+
Example for this:
|
4290
|
+
|
4291
|
+
foobar = "foo"
|
4292
|
+
foobar += "bar"
|
4293
|
+
|
4294
|
+
You can also use the method .concat(), such as in:
|
4295
|
+
|
4296
|
+
foo = "foo"
|
4297
|
+
foobar = foo.concat("bar")
|
4298
|
+
|
4299
|
+
### Obtaining user input in JavaScript
|
4300
|
+
|
4301
|
+
The following code example shows how to obtain user input via JavScript:
|
4302
|
+
|
4303
|
+
var x, y;
|
4304
|
+
x = prompt("Gib mal eine Zahl ein","")
|
4305
|
+
y = prompt("Gib mir noch eine Zahl","")
|
4306
|
+
alert(Number(x)+Number(y)
|
4307
|
+
|
4308
|
+
So the primary way to obtain user through JavaScript goes via
|
4309
|
+
<b>window.prompt</b>. The second argument to that method
|
4310
|
+
specifies the default value of the input-field.
|
4311
|
+
|
4312
|
+
### Creating an Array in JavaScript
|
4313
|
+
|
4314
|
+
The easiest way is the following:
|
4315
|
+
|
4316
|
+
const array = ['red','green','blue'] # This is also called the Array literal notation.
|
4317
|
+
|
4318
|
+
Note that at the least two additional ways exist in JavaScript
|
4319
|
+
to create an Array.
|
4320
|
+
|
4321
|
+
You can use:
|
4322
|
+
|
4323
|
+
The Array() constructor, aka:
|
4324
|
+
|
4325
|
+
new Array();
|
4326
|
+
|
4327
|
+
and
|
4328
|
+
|
4329
|
+
<b>Functions</b> that <b>return arrays</b>, such as <b>split()</b>.
|
4330
|
+
|
4331
|
+
Note that you can, of course, also pass in elements into the
|
4332
|
+
Array when you create it via <b>new</b>. The following example
|
4333
|
+
shows this:
|
4334
|
+
|
4335
|
+
const array = new Array('January','February','March')
|
4336
|
+
|
4337
|
+
Personally I prefer the [] variant, as Ruby also uses it
|
4338
|
+
and I have become so used to it.
|
4339
|
+
|
4272
4340
|
### Appending and Prepending onto a JavaScript Array
|
4273
4341
|
|
4274
4342
|
The method .push() can be used to add content, via an append-operation, onto an array.
|
@@ -4280,6 +4348,16 @@ If you wish to add elements onto the beginning of an Array, use
|
|
4280
4348
|
|
4281
4349
|
new_array.unshift("foobar"); /* Adds "foobar" to the beginning of the Array */
|
4282
4350
|
|
4351
|
+
## Splitting a String into an Array, in JavaScript
|
4352
|
+
|
4353
|
+
You can use the .split() method on a String, to split it up into an
|
4354
|
+
Array.
|
4355
|
+
|
4356
|
+
Example for this:
|
4357
|
+
|
4358
|
+
let x = 'Foo, Bar, Bla'
|
4359
|
+
const splitted = x.split(',')
|
4360
|
+
|
4283
4361
|
### Simplified for-loop in JavaScript
|
4284
4362
|
|
4285
4363
|
You can iterate over an Array in JavaScript via:
|
@@ -6198,7 +6276,8 @@ optionally also all subdirectories). This was added in November
|
|
6198
6276
|
|
6199
6277
|
## Automatic clipboard button
|
6200
6278
|
|
6201
|
-
class Cyberweb::HtmlTemplate has a method called
|
6279
|
+
<b>class Cyberweb::HtmlTemplate</b> has a method called
|
6280
|
+
<b>.return_copy_to_clipboard_button()</b>.
|
6202
6281
|
|
6203
6282
|
This method can be used to insert a button into a webpage. When the user
|
6204
6283
|
clicks that button a certain text will be inserted into the clipboard,
|
@@ -6245,6 +6324,34 @@ a local .html file).
|
|
6245
6324
|
Unfortunately I broke it in November 2023. Will have to fix it,
|
6246
6325
|
and probably rewrite it, anyway.
|
6247
6326
|
|
6327
|
+
## module WebBase
|
6328
|
+
|
6329
|
+
module WebBase was created before the project html_tags was started,
|
6330
|
+
and before objectified-html-tags were added. So in some ways this
|
6331
|
+
was a legacy-module.
|
6332
|
+
|
6333
|
+
In January 2024, the old code from <b>module WebBase</b> was integrated
|
6334
|
+
into the objectified HTML tags component. Then the old WebBase namespace
|
6335
|
+
was removed.
|
6336
|
+
|
6337
|
+
Note that as part of the rewrite, each individual class that is
|
6338
|
+
part of the module Cyberweb::Objectified::HtmlTags, will
|
6339
|
+
contain a toplevel instance variable called @css_class. This
|
6340
|
+
derived from the old code in WebBase, where we could specify
|
6341
|
+
a default CSS class to be used - which is now defined under
|
6342
|
+
@css_class. This can be accessed by the toplevel method
|
6343
|
+
.css_class?. (Should you discover a class that does not have
|
6344
|
+
this, consider it a bug; it will be added once reported.)
|
6345
|
+
|
6346
|
+
The old functionality in module WebBase, in where we could set
|
6347
|
+
a default CSS class, has been retained API-wise. Example for
|
6348
|
+
how to use this:
|
6349
|
+
|
6350
|
+
Cyberweb::Span.set_css_class 'padl5em green'
|
6351
|
+
|
6352
|
+
Keep in mind that internally this will delegate towards the
|
6353
|
+
<b>Objectified namespace</b>.
|
6354
|
+
|
6248
6355
|
## Useful quotes when designing websites and web-apps
|
6249
6356
|
|
6250
6357
|
The following subsection collects a few <b>interesting statements</b> - kind
|
@@ -6312,7 +6419,11 @@ the current location that the user has or uses on that website</i>.“
|
|
6312
6419
|
„<i>Ideally a website should convey the big picture, and make it clear what the
|
6313
6420
|
site is about</i>.“
|
6314
6421
|
|
6315
|
-
„<i>The web
|
6422
|
+
„<i>The web can be considered a dynamic computing environment</i>.“
|
6423
|
+
|
6424
|
+
„<i>Good design is easier to change than bad design</i>.“
|
6425
|
+
|
6426
|
+
„<i>Build documentation in - don't bolt it on</i>.“
|
6316
6427
|
|
6317
6428
|
„<i>If possible consider to use visual identifiers on the whole web-application at
|
6318
6429
|
hand, to give visitors the right idea about this being a cohesive and integrated
|
@@ -6401,29 +6512,14 @@ gem owner eventually:
|
|
6401
6512
|
see
|
6402
6513
|
https://blog.rubygems.org/2022/06/13/making-packages-more-secure.html
|
6403
6514
|
|
6404
|
-
|
6405
|
-
|
6406
|
-
|
6407
|
-
|
6408
|
-
|
6409
|
-
|
6410
|
-
|
6411
|
-
|
6412
|
-
|
6413
|
-
|
6414
|
-
changed.
|
6415
|
-
|
6416
|
-
Ruby also only allows 2FA users to participate on the issue tracker these
|
6417
|
-
days:
|
6418
|
-
|
6419
|
-
https://bugs.ruby-lang.org/issues/18800
|
6420
|
-
|
6421
|
-
But this has been reverted some months ago, so it is no longer applicable.
|
6422
|
-
Suffice to say that I do not think that we should only be allowed to
|
6423
|
-
interact on the world wide web when some 'authority' authenticated us,
|
6424
|
-
such as via mandatory 2FA, so I hope this won't come back again.
|
6425
|
-
|
6426
|
-
Fighting spam is a noble goal, but when it also means you lock out
|
6427
|
-
real human people then this is definitely NOT a good situation
|
6428
|
-
to be had.
|
6515
|
+
However had, that has been reverted again, so I decided to shorten
|
6516
|
+
this paragraph. Mandatory 2FA may exclude users who do not have a
|
6517
|
+
smartphone device or other means to 'identify'. I do not feel it is
|
6518
|
+
a fair assumption by others to be made that non-identified people may
|
6519
|
+
not contribute code, which is why I reject it. Mandatory 2FA would mean
|
6520
|
+
an end to all my projects on rubygems.org, so let's hope it will never
|
6521
|
+
happen. (Keep in mind that I refer to mandatory 2FA; I have no qualms
|
6522
|
+
for people who use 2FA on their own, but this carrot-and-stick strategy
|
6523
|
+
by those who control the rubygems infrastructure is a very bad one to
|
6524
|
+
pursue.
|
6429
6525
|
|
data/bin/cyberweb_sanitize
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# Encoding: UTF-8
|
3
3
|
# frozen_string_literal: true
|
4
4
|
# =========================================================================== #
|
5
|
-
require 'cyberweb/toplevel_methods/
|
5
|
+
require 'cyberweb/toplevel_methods/toplevel_methods.rb'
|
6
6
|
require 'save_file'
|
7
7
|
|
8
8
|
what = Cyberweb.sanitizer(ARGV)
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# =========================================================================== #
|
5
5
|
# images_from_this_webpage
|
6
6
|
# =========================================================================== #
|
7
|
-
require 'cyberweb/toplevel_methods/
|
7
|
+
require 'cyberweb/toplevel_methods/toplevel_methods.rb'
|
8
8
|
|
9
9
|
Cyberweb.return_all_images_from_this_webpage(ARGV, true).each {|this_remote_image|
|
10
10
|
puts this_remote_image
|