cyberweb 0.6.17 → 0.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cyberweb might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +299 -134
- data/bin/images_from_this_webpage +11 -0
- data/doc/README.gen +276 -107
- data/doc/todo/todo_for_the_cyberweb_project.md +90 -90
- data/examples/css/day_night_toggle/day_night_toggle.html +202 -0
- data/examples/css/fleeing_dinosaur_animation/fleeing_dinosaur_animation.html +420 -0
- data/examples/css/important_style/important_style.html +35 -0
- data/examples/html/custom_cursor.html +1 -1
- data/examples/javascript_and_jquery/misc/miscallenous_javascript_examples.html +25 -0
- data/examples/javascript_and_jquery/roll_a_die/roll_a_die.html +48 -0
- data/lib/cyberweb/base/misc.rb +7 -0
- data/lib/cyberweb/cascading_style_sheets/div.css +2 -2
- data/lib/cyberweb/cascading_style_sheets/drop_shadow.css +4 -0
- data/lib/cyberweb/cascading_style_sheets/fonts.css +42 -30
- data/lib/cyberweb/cascading_style_sheets/glow_effects.css +58 -0
- data/lib/cyberweb/cascading_style_sheets/margin.css +254 -248
- data/lib/cyberweb/cascading_style_sheets/tooltip.css +73 -0
- data/lib/cyberweb/generator/cgi.rb +2 -1
- data/lib/cyberweb/javascript_code/custom_functions.js +16 -16
- data/lib/cyberweb/javascript_code/math.js +18 -0
- data/lib/cyberweb/javascript_code/simulate_a_dice.js +13 -5
- data/lib/cyberweb/sinatra/custom_extensions.rb +2 -2
- data/lib/cyberweb/toplevel_methods/misc.rb +44 -0
- data/lib/cyberweb/utility_scripts/create_coloured_tags.rb +1 -5
- data/lib/cyberweb/utility_scripts/download_balloon_css.rb +1 -5
- data/lib/cyberweb/utility_scripts/fix_incorrect_links_to_locally_existing_images_in_this_file.rb +5 -33
- data/lib/cyberweb/utility_scripts/hyperlink_all_images_from.rb +1 -5
- data/lib/cyberweb/utility_scripts/obtain_css_rules.rb +169 -0
- data/lib/cyberweb/version/version.rb +2 -2
- data/lib/cyberweb/web_object/html_tags.rb +12 -1
- data/lib/cyberweb/web_object/images.rb +534 -178
- data/lib/cyberweb/web_object/javascript_and_jquery.rb +9 -9
- data/lib/cyberweb/web_object/link.rb +102 -67
- data/lib/cyberweb/web_object/misc.rb +320 -518
- data/lib/cyberweb/yaml/js_files_to_load.yml +3 -2
- data/lib/cyberweb/yaml/load_these_yaml_files_by_default.yml +1 -0
- data/test/complex_tests/testing_style_variants/show_coloured_boxes.cgi +2 -2
- data/test/javascript/testing_various_javascript_related_APIs.html +17 -0
- data/test/simple_tests/testing_dragging_an_image.cgi +2 -0
- data/test/simple_tests/testing_uniform_css_rules_for_all_images.cgi +25 -0
- metadata +15 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4252b07a6abec2328f6e7d3a71050c0f9a06face83316816f5a57c579a85a886
|
4
|
+
data.tar.gz: 956c7467e2e14c3109ae924edf8b0aaa34cf0991e2566892c744452b895db870
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0eae328a1dda370eeb858d0b21f3ef7e8872d805fbd0cce1a3095d24e8cb02b1b1e1cffafceb7920d88dec9b752d7396b4e7a33f8ab88e13b92437bae8a816de
|
7
|
+
data.tar.gz: 0b0f0e74482310f80c18f9e961d8c8677263ef4bddba123915809722f1a8d3e84bd4c72e6ad7bc632fc1115a1dc5de7dc829de095baa4d05e0ec1b46495fe66f
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
[](https://www.ruby-lang.org/en/)
|
3
3
|
[](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">28.11.2022</span> (dd.mm.yyyy notation), at <span style="color: steelblue; font-weight: bold">13:02:00</span> o'clock.
|
6
6
|
|
7
7
|
<img src="https://i.imgur.com/aC4YzSk.png" style="margin-left: 1.2em">
|
8
8
|
|
@@ -419,11 +419,18 @@ Note that **Cyberweb.set_path()** is a shorter alias to this method;
|
|
419
419
|
may be useful in IRB. Otherwise I recommend to use the longer
|
420
420
|
method name instead, as it is more explicit.
|
421
421
|
|
422
|
+
For many users this API may be fairly irrelevant or even cumbersome.
|
423
|
+
In that case you should consider uploading some of your images to a
|
424
|
+
remote server and then simply link towards these images rather
|
425
|
+
than having to deal with paths to local images being a nuisance. I do
|
426
|
+
that with some of my files, e. g. referring to a FTP site. In the
|
427
|
+
long run, though, this situation will eventually improve.
|
428
|
+
|
422
429
|
## Images
|
423
430
|
|
424
|
-
If an image is not existing, but used within the Cyberweb
|
425
|
-
|
426
|
-
|
431
|
+
If an image is not existing, but used within the Cyberweb framework,
|
432
|
+
then a a red border and a red text will be displayed around that
|
433
|
+
(non-existing) image.
|
427
434
|
|
428
435
|
This way, the user is being encouraged to fix the problem at hand.
|
429
436
|
|
@@ -432,11 +439,13 @@ fix/change this.
|
|
432
439
|
|
433
440
|
This is why the red warning or warnings in general, can be reduced
|
434
441
|
or disabled - have a look at the configuration file for this.
|
442
|
+
Personally I prefer a red warning, but others may not want to
|
443
|
+
have this.
|
435
444
|
|
436
|
-
If warnings are set to verbose, then the
|
437
|
-
display the
|
438
|
-
to normal or lower than that, the
|
439
|
-
display that warning.
|
445
|
+
If <b>warnings</b> are set to verbose, then the <b>cyberweb project</b>
|
446
|
+
will display the notification mentioned above for all images that
|
447
|
+
were not found. If it is set to normal or lower than that, the
|
448
|
+
cyberweb project will <b>not</b> display that warning.
|
440
449
|
|
441
450
|
## Greek letters
|
442
451
|
|
@@ -450,13 +459,6 @@ the following command:
|
|
450
459
|
|
451
460
|
Cyberweb.show_greek_letters
|
452
461
|
|
453
|
-
## Javascript-support in the Cyberweb project
|
454
|
-
|
455
|
-
Have a look at the subdirectory called **javascript/**.
|
456
|
-
|
457
|
-
If a new javascript-component is added, it should be registered
|
458
|
-
in one of the .rb files in said directory.
|
459
|
-
|
460
462
|
## Commandline usage
|
461
463
|
|
462
464
|
A commandline program exists, at <b>bin/cyberweb</b>.
|
@@ -884,18 +886,6 @@ useful for short header-entries, such as "Goals" or
|
|
884
886
|
functionality purely exists due to convenience - I wanted
|
885
887
|
to quickly generate the default id entry for a sitemap.
|
886
888
|
|
887
|
-
## JavaScript clock
|
888
|
-
|
889
|
-
If you wish to display a small JavaScript "clock" that just
|
890
|
-
shows the time, you could use this:
|
891
|
-
|
892
|
-
display_clock('pad1em') { :larger_font_size }
|
893
|
-
|
894
|
-
The block argument just increases the font-size a bit; it can
|
895
|
-
be omitted of course, as can all arguments, too:
|
896
|
-
|
897
|
-
display_clock
|
898
|
-
|
899
889
|
## Redirecting to another page
|
900
890
|
|
901
891
|
You can combine BeautifulUrl, and Cyberweb, to redirect
|
@@ -1839,19 +1829,6 @@ To do this, try:
|
|
1839
1829
|
e('This text should now be editable.') { :editable }
|
1840
1830
|
}
|
1841
1831
|
|
1842
|
-
## Specify javascript files
|
1843
|
-
|
1844
|
-
You can specify a specific javascript file via:
|
1845
|
-
|
1846
|
-
w.javascript_file = '../../CODE/JS/FADER.js'
|
1847
|
-
w.javascript_file = :fader
|
1848
|
-
|
1849
|
-
As you can see, both a string version giving the full path, and a
|
1850
|
-
Symbol shortcut, will work - provided that the Symbol was registered.
|
1851
|
-
|
1852
|
-
I recommend to use the Symbol version for two reasons: first, it is
|
1853
|
-
less to type. Second, it is trivial to change the path lateron.
|
1854
|
-
|
1855
1832
|
## Configuration
|
1856
1833
|
|
1857
1834
|
All meaningful options that can be configured, can be configured
|
@@ -2383,32 +2360,6 @@ Valid cursors include:
|
|
2383
2360
|
not-allowed
|
2384
2361
|
no-drop
|
2385
2362
|
|
2386
|
-
## Removing child elements in JavaScript
|
2387
|
-
|
2388
|
-
An element can be removed via JavaScript by issueing:
|
2389
|
-
|
2390
|
-
this.parentNode.removeChild(this)
|
2391
|
-
|
2392
|
-
## Default parameters to functions in JavaScript
|
2393
|
-
|
2394
|
-
You can use default values to functions in JavaScript.
|
2395
|
-
|
2396
|
-
Example:
|
2397
|
-
|
2398
|
-
function multiply(a, b = 1) {
|
2399
|
-
return a * b;
|
2400
|
-
}
|
2401
|
-
|
2402
|
-
console.log(multiply(5, 2));
|
2403
|
-
console.log(multiply(5));
|
2404
|
-
|
2405
|
-
Alternatively you could also use || inside of the function
|
2406
|
-
body, to simulate default values.
|
2407
|
-
|
2408
|
-
It may then look like this inside of a function:
|
2409
|
-
|
2410
|
-
bar = bar || "Default Value";
|
2411
|
-
|
2412
2363
|
## Using language-specific files as content of a webpage
|
2413
2364
|
|
2414
2365
|
The typical way how I describe the main content of a web-page
|
@@ -2818,44 +2769,6 @@ Example in HTML:
|
|
2818
2769
|
|
2819
2770
|
<img src='foobar.jpg' loading='lazy' alt='Alternative Text'>
|
2820
2771
|
|
2821
|
-
## JavaScript for-in and for-of loops:
|
2822
|
-
|
2823
|
-
Just examples for each:
|
2824
|
-
|
2825
|
-
for (const key in {a: 1, b: 2}) {
|
2826
|
-
console.log(key);
|
2827
|
-
}
|
2828
|
-
// a, b
|
2829
|
-
|
2830
|
-
for (const value of [1,2,3,4,5]) {
|
2831
|
-
console.log(value);
|
2832
|
-
}
|
2833
|
-
// 1, 2, 3, 4, 5
|
2834
|
-
|
2835
|
-
## Data Types in JavaScript (ECMAScript)
|
2836
|
-
|
2837
|
-
There are six simple data types:
|
2838
|
-
|
2839
|
-
Undefined
|
2840
|
-
Null
|
2841
|
-
Boolean
|
2842
|
-
Number
|
2843
|
-
String
|
2844
|
-
Symbol
|
2845
|
-
|
2846
|
-
## How to use the typeof() operator in JavaScript
|
2847
|
-
|
2848
|
-
The typeof operator is called like this:
|
2849
|
-
|
2850
|
-
let x = "some string";
|
2851
|
-
typeof(x) # "string"
|
2852
|
-
typeof(95) # "number"
|
2853
|
-
|
2854
|
-
Note that the () for typeof() could be omitted, as typeof is
|
2855
|
-
an operator and not a function - but it seems simpler to use
|
2856
|
-
the () just as it is used for other functions in JavaScript
|
2857
|
-
as well.
|
2858
|
-
|
2859
2772
|
## CSS zoom-on-hover effect
|
2860
2773
|
|
2861
2774
|
This can be done like this:
|
@@ -4227,8 +4140,8 @@ More specifically what these **four values** mean:
|
|
4227
4140
|
|
4228
4141
|
drop-shadow(offset-x offset-y blur-radius color)
|
4229
4142
|
|
4230
|
-
If you make use of the **cyberweb** project then you
|
4231
|
-
|
4143
|
+
If you make use of the **cyberweb** project then you can use
|
4144
|
+
the following API, to generate a drop shadow:
|
4232
4145
|
|
4233
4146
|
generate_drop_shadow :red, :default, 'drop_shadow_red'
|
4234
4147
|
div('drop_shadow_red') {
|
@@ -4427,8 +4340,8 @@ remember that you also get a lot of flexibility that way.
|
|
4427
4340
|
|
4428
4341
|
## The method images_css() in class Cyberweb::WebObject
|
4429
4342
|
|
4430
|
-
Sometimes you have several images and may want to apply
|
4431
|
-
same CSS rules to all of them.
|
4343
|
+
Sometimes you may have several images and may want to apply
|
4344
|
+
the same CSS rules to all of them.
|
4432
4345
|
|
4433
4346
|
For instance, I use the CSS class <b>bblack1</b> which is
|
4434
4347
|
equivalent to:
|
@@ -4449,6 +4362,10 @@ for a demo in this regard. (Not all images work; some of them
|
|
4449
4362
|
are only available on my home system, but the other images
|
4450
4363
|
should work.)
|
4451
4364
|
|
4365
|
+
Do note that since as of November 2022, when images_css is
|
4366
|
+
used then it will <b>always</b> be appended to every
|
4367
|
+
image tag. So only use it if you really need this functionality.
|
4368
|
+
|
4452
4369
|
## links.md
|
4453
4370
|
|
4454
4371
|
If a file called <b>links.md</b> exists in the current working directory
|
@@ -4660,6 +4577,258 @@ showcasing this functionality.
|
|
4660
4577
|
|
4661
4578
|
<img src="https://i.imgur.com/k5wFnwn.png" style="margin: 1em">
|
4662
4579
|
|
4580
|
+
## class Cyberweb::ObtainCssRules
|
4581
|
+
|
4582
|
+
<b>class Cyberweb::ObtainCssRules</b> was added to quickly fetch the
|
4583
|
+
CSS rule shortcut.
|
4584
|
+
|
4585
|
+
For instance, the cyberweb gem comes with many custom CSS classes
|
4586
|
+
defined. I use these for different project.
|
4587
|
+
|
4588
|
+
One such CSS rule is this:
|
4589
|
+
|
4590
|
+
.mars1em {
|
4591
|
+
margin-left: 1em;
|
4592
|
+
margin-right: 1em;
|
4593
|
+
}
|
4594
|
+
|
4595
|
+
Now: sometimes I can not use these custom CSS rules, even though I
|
4596
|
+
want to.
|
4597
|
+
|
4598
|
+
<b>class Cyberweb::ObtainCssRules</b> fills that use case.
|
4599
|
+
|
4600
|
+
We can tell this class to fetch the body of the CSS rule at
|
4601
|
+
<b>.mars1em</b>. This will then be automatically expanded
|
4602
|
+
onto the corresponding "margin-left" and "margin-right"
|
4603
|
+
entries.
|
4604
|
+
|
4605
|
+
To require this class do:
|
4606
|
+
|
4607
|
+
require 'cyberweb/utility_scripts/obtain_css_rules.rb'
|
4608
|
+
|
4609
|
+
Furthermore, this class was also added to automatically
|
4610
|
+
make use of various shortcuts.
|
4611
|
+
|
4612
|
+
Let me demonstrate how I use this specifically.
|
4613
|
+
|
4614
|
+
In the file pidgin.rb, which is part of the roebe gem,
|
4615
|
+
I use the following:
|
4616
|
+
|
4617
|
+
default_template1 '
|
4618
|
+
|
4619
|
+
p.default {
|
4620
|
+
.mars1em;
|
4621
|
+
}
|
4622
|
+
|
4623
|
+
'
|
4624
|
+
|
4625
|
+
What does the above mean?
|
4626
|
+
|
4627
|
+
It means that the p-tag (in HTML), if it makes use of the
|
4628
|
+
CSS class called default, will use the CSS rules defined
|
4629
|
+
in the .mars1em CSS class' body.
|
4630
|
+
|
4631
|
+
So, it is <b>exactly</b> identical to the following:
|
4632
|
+
|
4633
|
+
p.default {
|
4634
|
+
margin-left: 1em;
|
4635
|
+
margin-right: 1em;
|
4636
|
+
}
|
4637
|
+
|
4638
|
+
This is a bit similar to less and SASS and similar
|
4639
|
+
shortcut-tools.
|
4640
|
+
|
4641
|
+
Within the web-app, for class WebObject, I may then
|
4642
|
+
create these paragraphs via:
|
4643
|
+
|
4644
|
+
p_default {
|
4645
|
+
e 'Hello world!'
|
4646
|
+
}
|
4647
|
+
|
4648
|
+
Note that the above does not work 100% reliably; I
|
4649
|
+
added this in <b>November 2022</b> in part to try it out.
|
4650
|
+
|
4651
|
+
At some later point in time this may be improved,
|
4652
|
+
so use with care. I recommend to be very strict when
|
4653
|
+
using the above functionality; the less complexity,
|
4654
|
+
the better usually (unless you can write more succinct
|
4655
|
+
and more expressive code, perhaps; but even then it
|
4656
|
+
is a trade-off ultimately).
|
4657
|
+
|
4658
|
+
## Returning all images from a remote website
|
4659
|
+
|
4660
|
+
If you ever have a use case that you wish to return all
|
4661
|
+
images found on a remote website, consider using the
|
4662
|
+
following API:
|
4663
|
+
|
4664
|
+
x = Cyberweb.return_all_images_from_this_webpage('https://www.projectaon.org/en/xhtml/lw/02fotw/sect166.htm', true)
|
4665
|
+
|
4666
|
+
This would yield the following Array:
|
4667
|
+
|
4668
|
+
[
|
4669
|
+
"https://www.projectaon.org/en/xhtml/lw/02fotw/title.png",
|
4670
|
+
"https://www.projectaon.org/en/xhtml/lw/02fotw/brdrtpl.png",
|
4671
|
+
"https://www.projectaon.org/en/xhtml/lw/02fotw/brdrtp.png",
|
4672
|
+
"https://www.projectaon.org/en/xhtml/lw/02fotw/brdrtpr.png",
|
4673
|
+
"https://www.projectaon.org/en/xhtml/lw/02fotw/brdrl.png",
|
4674
|
+
"https://www.projectaon.org/en/xhtml/lw/02fotw/ill10.png",
|
4675
|
+
"https://www.projectaon.org/en/xhtml/lw/02fotw/brdrr.png",
|
4676
|
+
"https://www.projectaon.org/en/xhtml/lw/02fotw/brdrbtl.png",
|
4677
|
+
"https://www.projectaon.org/en/xhtml/lw/02fotw/brdrbt.png",
|
4678
|
+
"https://www.projectaon.org/en/xhtml/lw/02fotw/brdrbtr.png",
|
4679
|
+
"https://www.projectaon.org/en/xhtml/lw/02fotw/left.png",
|
4680
|
+
"https://www.projectaon.org/en/xhtml/lw/02fotw/toc.png",
|
4681
|
+
"https://www.projectaon.org/en/xhtml/lw/02fotw/right.png"
|
4682
|
+
]
|
4683
|
+
|
4684
|
+
## JavaScript support in the cyberweb project
|
4685
|
+
|
4686
|
+
### JavaScript for-in and for-of loops:
|
4687
|
+
|
4688
|
+
Just examples for each:
|
4689
|
+
|
4690
|
+
for (const key in {a: 1, b: 2}) {
|
4691
|
+
console.log(key);
|
4692
|
+
}
|
4693
|
+
// a, b
|
4694
|
+
|
4695
|
+
for (const value of [1,2,3,4,5]) {
|
4696
|
+
console.log(value);
|
4697
|
+
}
|
4698
|
+
// 1, 2, 3, 4, 5
|
4699
|
+
|
4700
|
+
### Javascript-support in the Cyberweb project
|
4701
|
+
|
4702
|
+
Have a look at the subdirectory called **javascript/**.
|
4703
|
+
|
4704
|
+
If a new javascript-component is added, it should be registered
|
4705
|
+
in one of the .rb files in said directory.
|
4706
|
+
|
4707
|
+
### Data Types in JavaScript (ECMAScript)
|
4708
|
+
|
4709
|
+
There are six simple data types:
|
4710
|
+
|
4711
|
+
Undefined
|
4712
|
+
Null
|
4713
|
+
Boolean
|
4714
|
+
Number
|
4715
|
+
String
|
4716
|
+
Symbol
|
4717
|
+
|
4718
|
+
### How to use the typeof() operator in JavaScript
|
4719
|
+
|
4720
|
+
The typeof operator is called like this:
|
4721
|
+
|
4722
|
+
let x = "some string";
|
4723
|
+
typeof(x) # "string"
|
4724
|
+
typeof(95) # "number"
|
4725
|
+
|
4726
|
+
Note that the () for typeof() could be omitted, as typeof is
|
4727
|
+
an operator and not a function - but it seems simpler to use
|
4728
|
+
the () just as it is used for other functions in JavaScript
|
4729
|
+
as well.
|
4730
|
+
|
4731
|
+
### JavaScript clock
|
4732
|
+
|
4733
|
+
If you wish to display a small JavaScript "clock" that just
|
4734
|
+
shows the time, you could use this:
|
4735
|
+
|
4736
|
+
display_clock('pad1em') { :larger_font_size }
|
4737
|
+
|
4738
|
+
The block argument just increases the font-size a bit; it can
|
4739
|
+
be omitted of course, as can all arguments, too:
|
4740
|
+
|
4741
|
+
display_clock
|
4742
|
+
|
4743
|
+
### Specify JavaScript files
|
4744
|
+
|
4745
|
+
You can specify a specific javascript file via:
|
4746
|
+
|
4747
|
+
w.javascript_file = '../../CODE/JS/FADER.js'
|
4748
|
+
w.javascript_file = :fader
|
4749
|
+
|
4750
|
+
As you can see, both a string version giving the full path, and a
|
4751
|
+
Symbol shortcut, will work - provided that the Symbol was registered.
|
4752
|
+
|
4753
|
+
I recommend to use the Symbol version for two reasons: first, it is
|
4754
|
+
less to type. Second, it is trivial to change the path lateron.
|
4755
|
+
|
4756
|
+
### Removing child elements in JavaScript
|
4757
|
+
|
4758
|
+
An element can be removed via JavaScript by issueing:
|
4759
|
+
|
4760
|
+
this.parentNode.removeChild(this)
|
4761
|
+
|
4762
|
+
### Default parameters to functions in JavaScript
|
4763
|
+
|
4764
|
+
You can use default values to functions in JavaScript.
|
4765
|
+
|
4766
|
+
Example:
|
4767
|
+
|
4768
|
+
function multiply(a, b = 1) {
|
4769
|
+
return a * b;
|
4770
|
+
}
|
4771
|
+
|
4772
|
+
console.log(multiply(5, 2));
|
4773
|
+
console.log(multiply(5));
|
4774
|
+
|
4775
|
+
Alternatively you could also use || inside of the function
|
4776
|
+
body, to simulate default values.
|
4777
|
+
|
4778
|
+
It may then look like this inside of a function:
|
4779
|
+
|
4780
|
+
bar = bar || "Default Value";
|
4781
|
+
|
4782
|
+
### JavaScript's document.getElementById()
|
4783
|
+
|
4784
|
+
You can use JavaScript's document.getElementById() to modify
|
4785
|
+
values programmatically.
|
4786
|
+
|
4787
|
+
Example showcasing this:
|
4788
|
+
|
4789
|
+
function foobar() {
|
4790
|
+
document.getElementById("set_on_value_changed").value = "44";
|
4791
|
+
}
|
4792
|
+
|
4793
|
+
All you need to know is the ID of the target element.
|
4794
|
+
|
4795
|
+
### Does order matter for JavaScript?
|
4796
|
+
|
4797
|
+
Script tags that are used in a webpage are executed in the order they
|
4798
|
+
appear. So, if you look at the following JavaScript code:
|
4799
|
+
|
4800
|
+
<script>
|
4801
|
+
var x = 42;
|
4802
|
+
</script>
|
4803
|
+
|
4804
|
+
<script>
|
4805
|
+
alert(x); // Will alert '3';
|
4806
|
+
</script>
|
4807
|
+
|
4808
|
+
Then first the variable x will be set, to the value of <b>42</b>.
|
4809
|
+
|
4810
|
+
Note that this also applies to when you load external .js files - first
|
4811
|
+
in, first to be evaluated. So order does indeed matter.
|
4812
|
+
|
4813
|
+
The reason I noted this down here was in the event that I may forgot
|
4814
|
+
why I decided to load some .js files before others.
|
4815
|
+
|
4816
|
+
There is, however had, also a practical consideration here: if you
|
4817
|
+
have some external .js files that take a while to load, it may be
|
4818
|
+
best to put them near the end of the page, or at the least after
|
4819
|
+
other .js files were already loaded, as it may otherwise slow
|
4820
|
+
down the loading of the webpage. This is the reason why some
|
4821
|
+
webpages recommend to put JavaScript script-tags shortly before
|
4822
|
+
the closing </body> tag rather than in the <head> section of
|
4823
|
+
the given HTML code at hand.
|
4824
|
+
|
4825
|
+
You can also use the async keyword; this means that the loading of
|
4826
|
+
the webpage will continue.
|
4827
|
+
|
4828
|
+
Example:
|
4829
|
+
|
4830
|
+
<script src="path/foobar.js" async></script>
|
4831
|
+
|
4663
4832
|
## Useful quotes when designing websites and web-apps
|
4664
4833
|
|
4665
4834
|
The following subsection collects a few <b>interesting statements</b> -
|
@@ -4802,35 +4971,31 @@ more useful in general, feel free to drop me an email at any time, via:
|
|
4802
4971
|
shevy@inbox.lt
|
4803
4972
|
|
4804
4973
|
Before that email I used an email account at Google gmail, but in **2021** I
|
4805
|
-
decided to slowly abandon gmail for various reasons. In order to limit
|
4974
|
+
decided to slowly abandon gmail, for various reasons. In order to limit the
|
4806
4975
|
explanation here, allow me to just briefly state that I do not feel as if I
|
4807
|
-
want to promote any Google service anymore
|
4976
|
+
want to promote any Google service anymore when the user becomes the
|
4977
|
+
product (such as via data collection by upstream services). I feel this is
|
4978
|
+
a hugely flawed business model.
|
4808
4979
|
|
4809
4980
|
Do keep in mind that responding to emails may take some time, depending on
|
4810
4981
|
the amount of work I may have at that moment.
|
4811
4982
|
|
4812
|
-
In 2022 rubygems.org
|
4813
|
-
|
4814
|
-
|
4815
|
-
|
4816
|
-
|
4817
|
-
|
4818
|
-
|
4819
|
-
|
4820
|
-
|
4821
|
-
|
4822
|
-
|
4823
|
-
|
4824
|
-
|
4825
|
-
|
4826
|
-
|
4827
|
-
|
4828
|
-
|
4829
|
-
|
4830
|
-
|
4831
|
-
https://bugs.ruby-lang.org/issues/18800
|
4832
|
-
|
4833
|
-
Guess it may indeed be time to finally abandon ruby - not because
|
4834
|
-
ruby is a bad language, but there are people now in charge who
|
4835
|
-
really should not be part of ruby in the first place.
|
4983
|
+
In <b>2022</b> rubygems.org, or rather the corporate overlords who control the
|
4984
|
+
rubygems.org infrastructure these days, decided to make 2FA mandatory for every
|
4985
|
+
gem owner eventually: see
|
4986
|
+
https://blog.rubygems.org/2022/06/13/making-packages-more-secure.html
|
4987
|
+
|
4988
|
+
Mandatory 2FA will eventually be extended to all rubygems.org developers and
|
4989
|
+
maintainers. As I can not use 2FA, for reasons I will skip explaining here,
|
4990
|
+
this means that my projects will eventually be taken over by shopify (or,
|
4991
|
+
correspondingly, whoever effectively controls the rubygems.org ecosystem).
|
4992
|
+
At that point, I no longer have any control what is done to my projects
|
4993
|
+
since shopify (respectively those controlling the gems ecosystem) took away
|
4994
|
+
control here. Not sure at which point ruby became corporate-controlled -
|
4995
|
+
that was not the case several years ago.
|
4996
|
+
|
4997
|
+
Ruby also only allows 2FA users to participate on the issue tracker these
|
4998
|
+
days:
|
4999
|
+
|
5000
|
+
https://bugs.ruby-lang.org/issues/18800
|
4836
5001
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# images_from_this_webpage
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'cyberweb/toplevel_methods/misc.rb'
|
8
|
+
|
9
|
+
Cyberweb.return_all_images_from_this_webpage(ARGV, true).each {|this_remote_image|
|
10
|
+
puts this_remote_image
|
11
|
+
}
|