cyberweb 0.7.9 → 0.8.17

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of cyberweb might be problematic. Click here for more details.

Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +242 -141
  3. data/cyberweb.gemspec +6 -6
  4. data/doc/README.gen +242 -142
  5. data/doc/todo/todo_for_the_cyberweb_project.md +13 -0
  6. data/examples/advanced/animated_colourful_border/animated_colourful_border.cgi +149 -0
  7. data/examples/advanced/no_right_click.cgi +1 -2
  8. data/examples/css/changing_border_colours_animation/changing_border_colours_animation.html +134 -0
  9. data/examples/css/editable_boxes_example/editable_boxes_example.html +75 -0
  10. data/examples/css/flexbox_example/flexbox_example.html +39 -0
  11. data/examples/css/keyboard_example/keyboard_example.html +238 -0
  12. data/examples/css/magic_card/magic_card.html +110 -0
  13. data/examples/css/overflow_example/overflow_example.html +125 -0
  14. data/examples/css/planet_example/planet_example.html +34 -0
  15. data/examples/css/progress_bar_examples/progress_bar_examples.html +316 -0
  16. data/examples/css/single_row_glow/single_row_glow.html +91 -0
  17. data/examples/css/slinky_animation/slinky_animation.html +292 -0
  18. data/examples/html/hbox_and_vbox_example.html +5 -5
  19. data/examples/javascript_and_jquery/all_in_one_example/all_in_one_example.cgi +38 -0
  20. data/lib/cyberweb/base/misc.rb +63 -25
  21. data/lib/cyberweb/cascading_style_sheets/border.css +61 -24
  22. data/lib/cyberweb/cascading_style_sheets/colours.css +2 -0
  23. data/lib/cyberweb/cascading_style_sheets/default.css +102 -89
  24. data/lib/cyberweb/cascading_style_sheets/glow_effects.css +36 -0
  25. data/lib/cyberweb/cascading_style_sheets/margin.css +11 -7
  26. data/lib/cyberweb/cascading_style_sheets/misc.css +7 -0
  27. data/lib/cyberweb/cascading_style_sheets/text_shadow.css +6 -1
  28. data/lib/cyberweb/generator/cgi.rb +9 -1
  29. data/lib/cyberweb/html_template/html_template.rb +7 -2
  30. data/lib/cyberweb/javascript_code/custom_functions.js +33 -2
  31. data/lib/cyberweb/javascript_code/math.js +0 -0
  32. data/lib/cyberweb/objectified/html_tags/progress.rb +8 -8
  33. data/lib/cyberweb/skeleton/README.md +2 -0
  34. data/lib/cyberweb/skeleton/html_keyboard.md +140 -0
  35. data/lib/cyberweb/toplevel_methods/is_an_image.rb +18 -0
  36. data/lib/cyberweb/toplevel_methods/listing.rb +2 -3
  37. data/lib/cyberweb/toplevel_methods/misc.rb +1 -57
  38. data/lib/cyberweb/toplevel_methods/registered_ids.rb +53 -37
  39. data/lib/cyberweb/toplevel_methods/sort_this_array_by_time.rb +65 -0
  40. data/lib/cyberweb/toplevel_methods/video.rb +32 -19
  41. data/lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb +78 -49
  42. data/lib/cyberweb/utility_scripts/remove_this_image_from_that_webpage.rb +125 -0
  43. data/lib/cyberweb/version/version.rb +2 -2
  44. data/lib/cyberweb/web_images/map_symbol_to_image_location.rb +28 -8
  45. data/lib/cyberweb/web_object/effects.rb +19 -0
  46. data/lib/cyberweb/web_object/html_tags.rb +199 -196
  47. data/lib/cyberweb/web_object/images.rb +83 -26
  48. data/lib/cyberweb/web_object/misc.rb +1048 -529
  49. data/lib/cyberweb/web_object/reset.rb +47 -29
  50. data/lib/cyberweb/yaml/custom_tags.yml +2 -0
  51. metadata +52 -52
@@ -10,29 +10,375 @@ module Cyberweb
10
10
 
11
11
  class WebObject < ::Cyberweb::Base # === Cyberweb::WebObject
12
12
 
13
+ require 'cyberweb/web_object/effects.rb'
13
14
  require 'cyberweb/javascript/javascript_helper/javascript_helper.rb'
14
15
  require 'cyberweb/modules/css_style.rb'
15
16
  require 'cyberweb/utility_scripts/obtain_css_rules.rb'
17
+ require 'cyberweb/toplevel_methods/listing.rb'
18
+ require 'cyberweb/web_images/map_symbol_to_image_location.rb'
16
19
 
17
20
  begin
18
21
  require 'roebe/classes/to_binary.rb'
19
22
  rescue LoadError; end
20
23
 
21
24
  # ========================================================================= #
22
- # === Cyberweb::WebObject.evaluate_from_the_same_named_file_then_serve
25
+ # === sanitize_this_id
23
26
  #
24
- # This is the simplified variant that can be used for .cgi files, if
25
- # a nearby .rb file exists. In order for this to work, the file must
26
- # have the same name, minus the extension (which can be different).
27
+ # This method can be used to sanitize the given input, for further use
28
+ # as a HTML id. A few assumptions will be made for input that is
29
+ # passed to this method; but, even aside from these assumptions, the
30
+ # most important point for this method is that it can be consistently
31
+ # used/re-used.
27
32
  # ========================================================================= #
28
- def self.evaluate_from_the_same_named_file_then_serve(
29
- output_the_result = :default,
30
- optional_use_this_name_instead = nil
33
+ def sanitize_this_id(i)
34
+ return ::Cyberweb.sanitize_this_id(i)
35
+ end
36
+
37
+ # ========================================================================= #
38
+ # === dot109?
39
+ #
40
+ # This simply wraps over dot() with a default value and default CSS.
41
+ # ========================================================================= #
42
+ def dot109?
43
+ string_dot(109, 'marr10px')
44
+ end
45
+
46
+ # ========================================================================= #
47
+ # === clickable_image_as_string?
48
+ # ========================================================================= #
49
+ def clickable_image_as_string?
50
+ _ = clickable_image?
51
+ # ======================================================================= #
52
+ # === Handle Symbols next
53
+ #
54
+ # Symbols have to be expanded towards their local path.
55
+ # ======================================================================= #
56
+ if _.is_a? Symbol
57
+ _ = map_symbol_to_image_location(_) # Now we have the real path.
58
+ _.prepend(prepend_path_to_the_images?.dup)
59
+ _ = '<img src="'+_+'" class="marr10px">'
60
+ end
61
+ return _.to_s # Must guarantee that it is a String.
62
+ end
63
+
64
+ # ========================================================================= #
65
+ # === clickable_image?
66
+ #
67
+ # This must stay a simpler getter - no sanitizing is allowed.
68
+ # ========================================================================= #
69
+ def clickable_image?
70
+ @internal_hash[:clickable_image]
71
+ end
72
+
73
+ # ========================================================================= #
74
+ # === map_symbol_to_image_location
75
+ # ========================================================================= #
76
+ def map_symbol_to_image_location(i)
77
+ return ::Cyberweb::WebImages.map_symbol_to_image_location(i)
78
+ end
79
+
80
+ # ========================================================================= #
81
+ # === set_clickable_image
82
+ # ========================================================================= #
83
+ def set_clickable_image(i)
84
+ @internal_hash[:clickable_image] = i
85
+ end
86
+
87
+ require 'cyberweb/toplevel_methods/dot.rb'
88
+ # ========================================================================= #
89
+ # === string_dot
90
+ #
91
+ # This variant will return a String. The regular dot() method on the
92
+ # other hand will append that String onto the resulting webpage
93
+ # content, as-is.
94
+ # ========================================================================= #
95
+ def string_dot(
96
+ i = 108,
97
+ optional_css_class = '',
98
+ optional_the_id = '',
99
+ optional_css_style = ''
100
+ )
101
+ _ = sg(
102
+ "dot#{i}".to_sym,
103
+ optional_css_class,
104
+ optional_the_id,
105
+ optional_css_style
106
+ )
107
+ return _
108
+ end; alias dot string_dot # === dot (dot tag)
109
+
110
+ # ========================================================================= #
111
+ # === h1_id_clickable
112
+ # ========================================================================= #
113
+ def h1_id_clickable(
114
+ i,
115
+ optional_css_class = '',
116
+ &block
117
+ )
118
+ h1_id(i, optional_css_class) { :clickable_image }
119
+ end; alias h1_fancy_id h1_id_clickable # === h1_fancy_id
120
+
121
+ # ========================================================================= #
122
+ # === h1_id
123
+ # ========================================================================= #
124
+ def h1_id(
125
+ i,
126
+ optional_css_class = '',
127
+ &block
128
+ )
129
+ use_this_id = i.to_s.dup.downcase.tr(' ','_').delete(':(),').
130
+ tr('-','_').squeeze('_')
131
+ # ======================================================================= #
132
+ # === Handle blocks next
133
+ # ======================================================================= #
134
+ if block_given?
135
+ yielded = yield
136
+ case yielded
137
+ # ===================================================================== #
138
+ # === :clickable_image
139
+ # ===================================================================== #
140
+ when :clickable_image
141
+ i = "<a href=\"##{use_this_id}\">"+
142
+ clickable_image_as_string?+
143
+ "</a>#{i}"
144
+ end
145
+ end
146
+ h1 i, id: use_this_id
147
+ end
148
+
149
+ # ========================================================================= #
150
+ # === h2_id_clickable
151
+ # ========================================================================= #
152
+ def h2_id_clickable(
153
+ i,
154
+ optional_css_class = '',
155
+ optional_id = nil,
156
+ &block
157
+ )
158
+ h2_id(i, optional_css_class, optional_id) { :clickable_image }
159
+ end; alias h2_fancy_id h2_id_clickable # === h2_fancy_id
160
+
161
+ # ========================================================================= #
162
+ # === h2_id
163
+ #
164
+ # This must be somewhat flexible, to allow for use cases such as:
165
+ #
166
+ # h2_id('Stickstofffixierung - eine symbiotische Beziehung, als '\
167
+ # 'Teil des Stickstoffkreislaufs') { :clickable_image }
168
+ #
169
+ # ========================================================================= #
170
+ def h2_id(
171
+ i,
172
+ optional_css_class = '',
173
+ optional_id = nil,
174
+ &block
175
+ )
176
+ if optional_id and !optional_id.empty?
177
+ use_this_id = sanitize_this_id(optional_id)
178
+ else
179
+ use_this_id = sanitize_this_id(i)
180
+ end
181
+ # ======================================================================= #
182
+ # === Handle blocks next
183
+ # ======================================================================= #
184
+ if block_given?
185
+ yielded = yield
186
+ case yielded
187
+ # ===================================================================== #
188
+ # === :clickable_image
189
+ # ===================================================================== #
190
+ when :clickable_image
191
+ i = "<a href=\"##{use_this_id}\">"+
192
+ clickable_image_as_string?+
193
+ "</a>#{i}"
194
+ end
195
+ end
196
+ h2 i, id: use_this_id, css_class: optional_css_class
197
+ end
198
+
199
+ # ========================================================================= #
200
+ # === h3_id_clickable
201
+ # ========================================================================= #
202
+ def h3_id_clickable(
203
+ i,
204
+ optional_css_class = '',
205
+ &block
206
+ )
207
+ h3_id(i, optional_css_class) { :clickable_image }
208
+ end; alias h3_fancy_id h3_id_clickable # === h3_fancy_id
209
+
210
+ # ========================================================================= #
211
+ # === h3_id
212
+ # ========================================================================= #
213
+ def h3_id(
214
+ i,
215
+ optional_css_class = '',
216
+ &block
217
+ )
218
+ use_this_id = sanitize_this_id(i)
219
+ # ======================================================================= #
220
+ # === Handle blocks next
221
+ # ======================================================================= #
222
+ if block_given?
223
+ yielded = yield
224
+ case yielded
225
+ # ===================================================================== #
226
+ # === :clickable_image
227
+ # ===================================================================== #
228
+ when :clickable_image
229
+ i = "<a href=\"##{use_this_id}\">"+
230
+ dot109?+
231
+ "</a>#{i}"
232
+ end
233
+ end
234
+ h3 i, id: use_this_id
235
+ end
236
+
237
+ # ========================================================================= #
238
+ # === h4_id_clickable
239
+ # ========================================================================= #
240
+ def h4_id_clickable(
241
+ i,
242
+ optional_css_class = '',
243
+ &block
244
+ )
245
+ h4_id(i, optional_css_class) { :clickable_image }
246
+ end; alias h4_fancy_id h4_id_clickable # === h4_fancy_id
247
+
248
+ # ========================================================================= #
249
+ # === h4_id
250
+ # ========================================================================= #
251
+ def h4_id(
252
+ i,
253
+ optional_css_class = '',
254
+ &block
255
+ )
256
+ use_this_id = sanitize_this_id(i)
257
+ # ======================================================================= #
258
+ # === Handle blocks next
259
+ # ======================================================================= #
260
+ if block_given?
261
+ yielded = yield
262
+ case yielded
263
+ # ===================================================================== #
264
+ # === :clickable_image
265
+ # ===================================================================== #
266
+ when :clickable_image
267
+ i = "<a href=\"##{use_this_id}\">"+
268
+ dot109?+
269
+ "</a>#{i}"
270
+ end
271
+ end
272
+ h4 i, id: use_this_id
273
+ end
274
+
275
+ # ========================================================================= #
276
+ # === h5_id_clickable
277
+ # ========================================================================= #
278
+ def h5_id_clickable(
279
+ i,
280
+ optional_css_class = '',
281
+ &block
282
+ )
283
+ h5_id(i, optional_css_class) { :clickable_image }
284
+ end; alias h5_fancy_id h5_id_clickable # === h5_fancy_id
285
+
286
+ # ========================================================================= #
287
+ # === h5_id
288
+ # ========================================================================= #
289
+ def h5_id(
290
+ i,
291
+ optional_css_class = '',
292
+ &block
293
+ )
294
+ use_this_id = sanitize_this_id(i)
295
+ # ======================================================================= #
296
+ # === Handle blocks next
297
+ # ======================================================================= #
298
+ if block_given?
299
+ yielded = yield
300
+ case yielded
301
+ # ===================================================================== #
302
+ # === :clickable_image
303
+ # ===================================================================== #
304
+ when :clickable_image
305
+ i = "<a href=\"##{use_this_id}\">"+
306
+ dot109?+
307
+ "</a>#{i}"
308
+ end
309
+ end
310
+ h5 i, id: use_this_id
311
+ end
312
+
313
+ # ========================================================================= #
314
+ # === h6_id_clickable
315
+ # ========================================================================= #
316
+ def h6_id_clickable(
317
+ i,
318
+ optional_css_class = '',
319
+ &block
320
+ )
321
+ h6_id(i, optional_css_class) { :clickable_image }
322
+ end; alias h6_fancy_id h6_id_clickable # === h6_fancy_id
323
+
324
+ # ========================================================================= #
325
+ # === h6_id
326
+ # ========================================================================= #
327
+ def h6_id(
328
+ i,
329
+ optional_css_class = '',
330
+ &block
331
+ )
332
+ use_this_id = sanitize_this_id(i)
333
+ # ======================================================================= #
334
+ # === Handle blocks next
335
+ # ======================================================================= #
336
+ if block_given?
337
+ yielded = yield
338
+ case yielded
339
+ # ===================================================================== #
340
+ # === :clickable_image
341
+ # ===================================================================== #
342
+ when :clickable_image
343
+ i = "<a href=\"##{use_this_id}\">"+
344
+ dot109?+
345
+ "</a>#{i}"
346
+ end
347
+ end
348
+ h6 i, id: use_this_id
349
+ end
350
+
351
+ # ========================================================================= #
352
+ # === p_default
353
+ #
354
+ # This is similar to p(), but the implicit CSS class 'default' will be
355
+ # used.
356
+ # ========================================================================= #
357
+ def p_default(
358
+ optional_css_class = '',
359
+ the_id = '',
360
+ optional_css_style = '',
361
+ &block
362
+ )
363
+ if optional_css_class.is_a? Hash
364
+ # ===================================================================== #
365
+ # === :id
366
+ # ===================================================================== #
367
+ if optional_css_class.has_key? :id
368
+ the_id = optional_css_class.delete(:id)
369
+ end
370
+ if optional_css_class.is_a?(Hash) and optional_css_class.empty?
371
+ optional_css_class = ''
372
+ end
373
+ end
374
+ optional_css_class = optional_css_class.to_s.dup
375
+ optional_css_class.prepend('default ') # Make it the first argument.
376
+ p(
377
+ optional_css_class.strip,
378
+ the_id,
379
+ optional_css_style,
380
+ &block
31
381
  )
32
- _ = Cyberweb::WebObject.new
33
- ::Cyberweb.set_web_object(_)
34
- _.evaluate_from_the_same_named_file(optional_use_this_name_instead)
35
- return _.do_serve(output_the_result)
36
382
  end
37
383
 
38
384
  # ========================================================================= #
@@ -44,10 +390,11 @@ class WebObject < ::Cyberweb::Base # === Cyberweb::WebObject
44
390
  # The first argument to this method can be additional entries that
45
391
  # the user may want to display.
46
392
  #
47
- # Usage examples:
393
+ # Different usage examples follow next:
48
394
  #
49
395
  # science_hyperlinks
50
396
  # science_hyperlinks { :use_unicode_right_arrows }
397
+ # science_links {{ use_this_image: LINK_IMAGE }}
51
398
  #
52
399
  # ========================================================================= #
53
400
  def science_hyperlinks(
@@ -76,8 +423,27 @@ class WebObject < ::Cyberweb::Base # === Cyberweb::WebObject
76
423
  short_name = File.basename(this_local_link).delete_suffix('.cgi').dup.
77
424
  tr('_',' ').
78
425
  sub(/local/,'')
79
- if yielded == :use_unicode_right_arrows
80
- short_name.prepend('→')
426
+ if yielded.is_a? Hash
427
+ # =================================================================== #
428
+ # === :use_this_image
429
+ # =================================================================== #
430
+ if yielded.has_key?(:use_this_image)
431
+ use_this_image = yielded[:use_this_image]
432
+ short_name = "#{use_this_image}#{short_name.strip}"
433
+ end
434
+ else
435
+ case yielded
436
+ # =================================================================== #
437
+ # === pretty_image
438
+ # =================================================================== #
439
+ when :pretty_image
440
+ short_name.prepend(dot109?)
441
+ # =================================================================== #
442
+ # === :use_unicode_right_arrows
443
+ # =================================================================== #
444
+ when :use_unicode_right_arrows
445
+ short_name.prepend('→')
446
+ end
81
447
  end
82
448
  abr_self(
83
449
  this_local_link,
@@ -87,6 +453,642 @@ class WebObject < ::Cyberweb::Base # === Cyberweb::WebObject
87
453
  end; alias add_science_links science_hyperlinks # === add_science_links
88
454
  alias science_links science_hyperlinks # === science_links
89
455
 
456
+ # ========================================================================= #
457
+ # === listing_css_object
458
+ # ========================================================================= #
459
+ def listing_css_object
460
+ ::Cyberweb.listing_css_object
461
+ end
462
+
463
+ # ========================================================================= #
464
+ # === counter_li
465
+ #
466
+ # This method was added in June 2021.
467
+ # ========================================================================= #
468
+ def counter_li(
469
+ i = '',
470
+ optional_css_class = ''
471
+ )
472
+ @internal_hash[:listing_counter] += 1
473
+ e '('+@internal_hash[:listing_counter].to_s+') '+
474
+ i.to_s,
475
+ optional_css_class
476
+ end; alias listing counter_li # === listing
477
+ alias counter counter_li # === counter
478
+
479
+ # ========================================================================= #
480
+ # === listing_css
481
+ # ========================================================================= #
482
+ def listing_css(i)
483
+ ::Cyberweb.listing_css_object = i
484
+ end
485
+
486
+ # ========================================================================= #
487
+ # === listing_counter?
488
+ # ========================================================================= #
489
+ def listing_counter?
490
+ @internal_hash[:listing_counter]
491
+ end; alias listing_counter listing_counter? # === listing_counter
492
+
493
+ # ========================================================================= #
494
+ # === listing_counter=
495
+ # ========================================================================= #
496
+ def listing_counter=(i)
497
+ @internal_hash[:listing_counter] = i
498
+ end
499
+
500
+ # ========================================================================= #
501
+ # === cmd3
502
+ # ========================================================================= #
503
+ def cmd3(
504
+ i = '',
505
+ optional_css_class = ::Cyberweb.command3?
506
+ )
507
+ e(i, optional_css_class)
508
+ end
509
+
510
+ # ========================================================================= #
511
+ # === l2emb
512
+ # ========================================================================= #
513
+ def l2emb(
514
+ i = '',
515
+ optional_css_class = ''
516
+ )
517
+ l2(i, optional_css_class)
518
+ br
519
+ end; alias l2br l2emb # === l2br
520
+ alias l2embr l2emb # === l2embr
521
+ alias lem2 l2emb # === lem2
522
+ alias lembre2 l2emb # === lembre2
523
+ alias padl2embr l2emb # === padl2embr
524
+ alias le2 l2emb # === le2
525
+ alias lem2br l2emb # === lem2br
526
+
527
+ # ========================================================================= #
528
+ # === l2
529
+ # ========================================================================= #
530
+ def l2(
531
+ i = '',
532
+ optional_css_class = '',
533
+ optional_the_id = ''
534
+ )
535
+ if optional_css_class.is_a? Hash
536
+ # ======================================================================= #
537
+ # === :id
538
+ # ======================================================================= #
539
+ if optional_css_class.has_key? :id
540
+ optional_the_id = optional_css_class.delete(:id)
541
+ end
542
+ end
543
+ if optional_css_class.frozen?
544
+ optional_css_class = optional_css_class.dup
545
+ end
546
+ unless optional_css_class.include? 'padl2em'
547
+ optional_css_class << ' padl2em'
548
+ end
549
+ s2(i, optional_css_class.strip, optional_the_id)
550
+ end; alias l2em l2 # === l2em
551
+ alias padl2em l2 # === padl2em
552
+
553
+ # ========================================================================= #
554
+ # === string_link
555
+ #
556
+ # This method essentially creates a String representation of the HTML
557
+ # <a> tag.
558
+ #
559
+ # Since as of April 2022 the method "slink" is now an alias to string_link;
560
+ # it used to be an alias towards "def a()", but this was changed - the
561
+ # word string_link more logically may refer to slink as its intrinsic
562
+ # abbreviation.
563
+ # ========================================================================= #
564
+ def string_link(
565
+ i = '',
566
+ option_hash = {},
567
+ &block
568
+ )
569
+ # ======================================================================= #
570
+ # === Handle blocks given to this method next
571
+ # ======================================================================= #
572
+ if block_given?
573
+ yielded = yield
574
+ case yielded
575
+ # ===================================================================== #
576
+ # === :pretty
577
+ # ===================================================================== #
578
+ when :pretty
579
+ option_hash[:remote_URL] = beautiful_url(i)
580
+ end
581
+ end
582
+ if i.is_a?(Symbol)
583
+ if i.start_with?('local_')
584
+ i = BeautifulUrl.local_menu(i)
585
+ else
586
+ i = beautiful_url(i)
587
+ # =================================================================== #
588
+ # Also check if the second argument is a String. In this case we
589
+ # must modify it. Example for input that fulfils this criterium:
590
+ #
591
+ # remote_link(:hydrogenase, 'Hydrogenase')+
592
+ #
593
+ # =================================================================== #
594
+ if option_hash.is_a? String
595
+ option_hash = { content: option_hash }
596
+ end
597
+ end
598
+ end
599
+ # ======================================================================= #
600
+ # === Handle local entries for the "/home/x" directory layout.
601
+ # ======================================================================= #
602
+ if i.start_with? '/home/x'
603
+ i = i.dup
604
+ i.sub!(/\/home\/x\//, relative_path?)
605
+ end
606
+ i = rds(i.to_s.dup)
607
+ # ======================================================================= #
608
+ # Delegate onto HtmlTags.a().
609
+ # ======================================================================= #
610
+ return HtmlTags.a(
611
+ i,
612
+ option_hash
613
+ )
614
+ end; alias string_a string_link # === string_a
615
+ alias string_href string_link # === string_href
616
+ alias string_remote_link string_link # === string_remote_link
617
+ alias slink string_link # === slink
618
+
619
+ # ========================================================================= #
620
+ # === return_progress
621
+ # ========================================================================= #
622
+ def return_progress(
623
+ n_percent,
624
+ &block
625
+ )
626
+ return ::Cyberweb::Objectified::HtmlTags::Progress.new(n_percent, &block)
627
+ end
628
+
629
+ # ========================================================================= #
630
+ # === less_than_or_equal
631
+ # ========================================================================= #
632
+ def less_than_or_equal
633
+ '≤'
634
+ end; alias kleiner_gleich less_than_or_equal # === kleiner_gleich
635
+
636
+ # ========================================================================= #
637
+ # === oop_progress
638
+ #
639
+ # The progress element represents the completion progress of a task. The
640
+ # method here will simply delegate towards the corresponding objectified
641
+ # HTML tag.
642
+ #
643
+ # Usage example:
644
+ #
645
+ # progress(35)
646
+ #
647
+ # ========================================================================= #
648
+ def oop_progress(
649
+ n_percent,
650
+ &block
651
+ )
652
+ addnl(
653
+ return_progress(n_percent, &block).to_s
654
+ )
655
+ end; alias progress oop_progress # === progress
656
+
657
+ # ========================================================================= #
658
+ # === l1 (l1 tag)
659
+ #
660
+ # The second argument to this method may sometimes be a Hash, such as:
661
+ #
662
+ # 'foobar', id: 'mini-car'
663
+ #
664
+ # ========================================================================= #
665
+ def l1(
666
+ i = '',
667
+ optional_css_class = '',
668
+ optional_the_id = ''
669
+ )
670
+ if optional_css_class.is_a? Hash
671
+ # ======================================================================= #
672
+ # === :id
673
+ # ======================================================================= #
674
+ if optional_css_class.has_key? :id
675
+ optional_the_id = optional_css_class.delete(:id)
676
+ end
677
+ if optional_css_class.is_a?(Hash) and optional_css_class.empty?
678
+ optional_css_class = optional_css_class.to_s
679
+ end
680
+ end
681
+ optional_css_class = optional_css_class.dup
682
+ optional_css_class << ' padl1em' # Add the padl1em CSS class here.
683
+ s2(
684
+ i, optional_css_class.strip, optional_the_id
685
+ )
686
+ end; alias l1em l1 # === l1em
687
+ alias l1m l1 # === l1m
688
+ alias lem1 l1 # === lem1
689
+ alias padlem l1 # === padlem
690
+ alias padl1em l1 # === padl1em
691
+
692
+ # ========================================================================= #
693
+ # === lembre
694
+ # ========================================================================= #
695
+ def lembre(
696
+ i = '',
697
+ optional_css_class = '',
698
+ optional_the_id = ''
699
+ )
700
+ l1(
701
+ i,
702
+ optional_css_class,
703
+ optional_the_id
704
+ )
705
+ br
706
+ end; alias lem1br lembre # === lembre
707
+ alias lem lembre # === lem
708
+ alias lemspan lembre # === lemspan
709
+ alias lee lembre # === lee
710
+ alias lembr lembre # === lembr
711
+ alias padl1embr lembre # === padl1embr
712
+ alias le lembre # === le
713
+
714
+ # ========================================================================= #
715
+ # === obtain_the_parameters_passed
716
+ #
717
+ # This query-method will return which params have been passed into, for
718
+ # example, a .cgi page.parameters_as_string?
719
+ #
720
+ # Typical invocation may go like this:
721
+ #
722
+ # w.obtain_the_parameters_passed
723
+ #
724
+ # ========================================================================= #
725
+ def obtain_the_parameters_passed
726
+ ::Cyberweb.params? # This is part of params.rb actually.
727
+ end; alias return_params_hash obtain_the_parameters_passed # === return_params_hash
728
+ alias web_params? obtain_the_parameters_passed # === web_params?
729
+ alias web_params obtain_the_parameters_passed # === web_params
730
+ alias params? obtain_the_parameters_passed # === params?
731
+ alias params obtain_the_parameters_passed # === params
732
+
733
+ # ========================================================================= #
734
+ # === params_as_string?
735
+ # ========================================================================= #
736
+ def params_as_string?
737
+ _ = ::Cyberweb.params?
738
+ if _.is_a? Hash
739
+ _ = _.keys.join
740
+ end
741
+ return _
742
+ end
743
+
744
+ # ========================================================================= #
745
+ # === first_param_as_string?
746
+ # ========================================================================= #
747
+ def first_param_as_string?
748
+ _ = ::Cyberweb.params?
749
+ if _.is_a? Hash
750
+ _ = _.keys.first
751
+ end
752
+ return _
753
+ end; alias first_param_as_string first_param_as_string? # === first_param_as_string
754
+
755
+ # ========================================================================= #
756
+ # === obtain_this_param_as_string
757
+ #
758
+ # This method must guarantee to return a String.
759
+ # ========================================================================= #
760
+ def obtain_this_param_as_string(i)
761
+ _ = params?[i]
762
+ _ = _.first if _.is_a? Array
763
+ return _.to_s # e. g. {"view"=>["/tmp"]}
764
+ end
765
+
766
+ # ========================================================================= #
767
+ # === do_copy_the_javascript_code_files_into_current_working_directory
768
+ #
769
+ # This method will copy the javascript code to a path such as
770
+ # "/home/x/Temp/cyberweb/javascript_code/custom_functions.js".
771
+ #
772
+ # Note that this refers to my home setup, so for other users this
773
+ # may be largely irrelevant.
774
+ # ========================================================================= #
775
+ def do_copy_the_javascript_code_files_into_current_working_directory
776
+ use_this_path = "#{Cyberweb.project_base_directory?}javascript_code/"
777
+ current_directory = return_pwd
778
+ # ======================================================================= #
779
+ # The next clause will only copy files - at a later time this may
780
+ # have to be changed to also copy directories, but for now (Oct 2022)
781
+ # this is the way to go.
782
+ #
783
+ # Since as of December 2022, the file will always be copied if the
784
+ # File.mtime() is more recent. That has been enabled specifically
785
+ # for my home system.
786
+ # ======================================================================= #
787
+ Dir["#{use_this_path}*"].select {|entry| File.file?(entry) }.each {|entry|
788
+ mtime_of_the_file_to_be_copied = File.mtime(entry)
789
+ location_for_the_new_file = current_directory+File.basename(entry)
790
+ mtime_location_for_the_new_file = File.mtime(location_for_the_new_file)
791
+ # ===================================================================== #
792
+ # target will be a String such as:
793
+ #
794
+ # "/home/x/Temp/cyberweb/javascript_code/chmod_displayer.js"
795
+ #
796
+ # ===================================================================== #
797
+ if File.exist?(location_for_the_new_file)
798
+ if mtime_of_the_file_to_be_copied > mtime_location_for_the_new_file
799
+ copy_this_file(entry, location_for_the_new_file)
800
+ else # else we don't have to do anything.
801
+ end
802
+ else
803
+ copy_this_file(entry, location_for_the_new_file)
804
+ end
805
+ }
806
+ end
807
+
808
+ # ========================================================================= #
809
+ # === check_whether_to_show_the_source_code
810
+ #
811
+ # This is the method that can display the source code of a given .cgi
812
+ # page.
813
+ # ========================================================================= #
814
+ def check_whether_to_show_the_source_code
815
+ # ======================================================================= #
816
+ # We must also check whether the configuration file allows us to
817
+ # show the source code.
818
+ # ======================================================================= #
819
+ if show_source? and ::Cyberweb.config['may_show_source']
820
+ _ = this_file?(:full_path)
821
+ ee '<html>'
822
+ ee '<head>'
823
+ # ===================================================================== #
824
+ # Add the following in order to enable on-click highlight at a later time.
825
+ # ===================================================================== #
826
+ ee HtmlTags.style('.highlight {
827
+ background:yellow;
828
+ }')
829
+ ee '</head>'
830
+ ee '<body>'
831
+ ee 'Next displaying the source code of the file <b>'+_+'</b>'
832
+ # ===================================================================== #
833
+ # The following has not yet been enabled. It shall follow this
834
+ # here:
835
+ #
836
+ # http://jsfiddle.net/kB7u2/1/
837
+ #
838
+ # ===================================================================== #
839
+ if false
840
+ output_this_javascript "
841
+ $('.stripe_table').hover(
842
+ function() {
843
+ $(this).addClass('highlight');
844
+ }, function() {
845
+ $(this).removeClass('highlight');
846
+ }
847
+ )"
848
+ end
849
+ dataset = File.readlines(_)
850
+ n_lines = dataset.size
851
+ ee '<h4>'+n_lines.to_s+' lines</h4>'
852
+ ee '<pre>'
853
+ # ===================================================================== #
854
+ # Presently, we will always display the index-number.
855
+ # ===================================================================== #
856
+ dataset.each_with_index {|content, index|
857
+ index += 1
858
+ ee '<span class="line_'+index.to_s+'"><b>'+index.to_s.ljust(5)+'</b>'+content+'</span>'
859
+ }
860
+ ee '</pre>'
861
+ ee '</body></html>'
862
+ exit
863
+ end
864
+ end
865
+
866
+ # ========================================================================= #
867
+ # === do_show_source
868
+ # ========================================================================= #
869
+ def do_show_source
870
+ @internal_hash[:show_source] = true
871
+ end
872
+
873
+ require 'cyberweb/toplevel_methods/video.rb'
874
+ # ========================================================================= #
875
+ # === embed_youtube_video
876
+ #
877
+ # This method will "embed" a youtube video into the local web-app.
878
+ #
879
+ # Usage example:
880
+ #
881
+ # embed_youtube_video 'https://www.youtube.com/watch?v=sAeMTsvGmoQ',
882
+ # css_class: 'rounded_black2'
883
+ #
884
+ # ========================================================================= #
885
+ def embed_youtube_video(
886
+ src = 'gexazLr6pSY',
887
+ width = '640',
888
+ height = '385'
889
+ )
890
+ addnl(
891
+ ::Cyberweb.embed_youtube_video(
892
+ src,
893
+ width,
894
+ height
895
+ )
896
+ )
897
+ end; alias eyv embed_youtube_video # === eyv
898
+ alias youtube embed_youtube_video # === youtube
899
+ alias youtube_links embed_youtube_video # === youtube_links
900
+ alias youtube_link embed_youtube_video # === youtube_link
901
+ alias youtube_video embed_youtube_video # === youtube_video
902
+ alias embed_video_file embed_youtube_video # === embed_video_file
903
+ alias embed_video embed_youtube_video # === embed_video
904
+ alias embed_youtube_link embed_youtube_video # === embed_youtube_link
905
+
906
+ # ========================================================================= #
907
+ # === add_this_css_style
908
+ #
909
+ # This method can be used to add ad-hoc CSS code to a webpage.
910
+ # ========================================================================= #
911
+ def add_this_css_style(i)
912
+ addnl(
913
+ return_css_style(i)
914
+ )
915
+ end; alias add_to_CSS_rules add_this_css_style # === add_to_CSS_rules
916
+ alias estyle add_this_css_style # === estyle
917
+
918
+ # ========================================================================= #
919
+ # === show_the_keyboard
920
+ #
921
+ # This method will show a fancy CSS-styled keyboard.
922
+ # ========================================================================= #
923
+ def show_the_keyboard(
924
+ optional_css_class = ''
925
+ )
926
+ estyle '.container_for_the_keyboard {
927
+ margin: 100px 0 0 200px;
928
+ }
929
+
930
+ .row_for_the_keyboard {
931
+ width: 100%;
932
+ height: 60px;
933
+ }
934
+
935
+ .row_one,
936
+ .row_two,
937
+ .row_three,
938
+ .row_four,
939
+ .row_five {
940
+ margin: 10px 0 0 0;
941
+ }
942
+
943
+ button.for_the_keyboard {
944
+ color: black;
945
+ font-weight: 500;
946
+ width: 55px;
947
+ height: 55px;
948
+ border: none;
949
+ background: rgb(214, 214, 214);
950
+ box-shadow: 0 0 10px #9521f3, 0 0 40px #c600ee, 0 0 80px #f704f7;
951
+
952
+ font-size: 15px;
953
+ margin-left: 5px;
954
+ outline: none;
955
+ font-family: Arial, Helvetica, sans-serif;
956
+ border-radius: 20%;
957
+ }
958
+
959
+ button.for_the_keyboard:active {
960
+ box-shadow: 1px 1px 2px #fd0c99,
961
+ 1px 1px 2px #ff00dd;
962
+ }
963
+
964
+ .print_key {
965
+ width: 85px !important;
966
+ border-radius: 10px !important;
967
+ }
968
+
969
+ .backspace_key {
970
+ width: 148px !important;
971
+ border-radius: 10px !important;
972
+ }
973
+
974
+ .tab_key {
975
+ width: 115px !important;
976
+ border-radius: 10px !important;
977
+ }
978
+
979
+ .slace_key {
980
+ width: 90px !important;
981
+ border: 10px !important;
982
+ }
983
+
984
+ .caps_lock_key {
985
+ width: 96px !important;
986
+ border-radius: 10px !important;
987
+ }
988
+
989
+ .enter_button {
990
+ width: 109px !important;
991
+ border-radius: 10px !important;
992
+ }
993
+
994
+ .shift_key {
995
+ width: 135px !important;
996
+ border-radius: 10px !important;
997
+ }
998
+
999
+ .space_key {
1000
+ width: 398px !important;
1001
+ border-radius: 10px !important;
1002
+ }
1003
+
1004
+ .last_row {
1005
+ width: 56px !important;
1006
+ border-radius: 10px !important;
1007
+ }
1008
+ '
1009
+ div(optional_css_class) {
1010
+ e File.read(
1011
+ project_base_directory?+'skeleton/html_keyboard.md',
1012
+ encoding: use_which_encoding?
1013
+ )
1014
+ }
1015
+ end
1016
+
1017
+ # ========================================================================= #
1018
+ # === title?
1019
+ #
1020
+ # Query method for the title of our webpage.
1021
+ #
1022
+ # Note that the method .title() is an alias for .title?(); in the past,
1023
+ # before April 2022, it was an alias for .set_title() instead.
1024
+ # ========================================================================= #
1025
+ def title?
1026
+ ::Cyberweb.title?
1027
+ end; alias use_this_title? title? # === use_this_title?
1028
+ alias title title? # === use_this_title?
1029
+
1030
+ # ========================================================================= #
1031
+ # === p_default_english
1032
+ #
1033
+ # This method is specifically to keep track of IDs that are written
1034
+ # in the english language. At a later time in point this may become
1035
+ # more relevant.
1036
+ # ========================================================================= #
1037
+ def p_default_english(
1038
+ optional_css_class = '',
1039
+ the_id = '',
1040
+ optional_css_style = '',
1041
+ &block
1042
+ )
1043
+ if the_id.empty?
1044
+ the_id = "english"
1045
+ else
1046
+ the_id = "english_{the_id}" unless the_id.start_with?('english_')
1047
+ end
1048
+ p_default(optional_css_class, the_id, optional_css_style, &block)
1049
+ end
1050
+
1051
+ # ========================================================================= #
1052
+ # === div_p_default
1053
+ # ========================================================================= #
1054
+ def div_p_default(
1055
+ optional_css_class = '',
1056
+ the_id = '',
1057
+ optional_css_style = '',
1058
+ &block
1059
+ )
1060
+ div_default(optional_css_class, the_id, optional_css_style) {
1061
+ p_default(optional_css_class, the_id, optional_css_style, &block)
1062
+ }
1063
+ end
1064
+
1065
+ # ========================================================================= #
1066
+ # === current_temperature?
1067
+ # ========================================================================= #
1068
+ def current_temperature?
1069
+ begin
1070
+ require 'wetter'
1071
+ rescue LoadError; end
1072
+ return Wetter.simplified_current_degrees # Wetter.current_degrees
1073
+ end
1074
+
1075
+ # ========================================================================= #
1076
+ # === Cyberweb::WebObject.evaluate_from_the_same_named_file_then_serve
1077
+ #
1078
+ # This is the simplified variant that can be used for .cgi files, if
1079
+ # a nearby .rb file exists. In order for this to work, the file must
1080
+ # have the same name, minus the extension (which can be different).
1081
+ # ========================================================================= #
1082
+ def self.evaluate_from_the_same_named_file_then_serve(
1083
+ output_the_result = :default,
1084
+ optional_use_this_name_instead = nil
1085
+ )
1086
+ _ = Cyberweb::WebObject.new
1087
+ ::Cyberweb.set_web_object(_)
1088
+ _.evaluate_from_the_same_named_file(optional_use_this_name_instead)
1089
+ return _.do_serve(output_the_result)
1090
+ end
1091
+
90
1092
  # ========================================================================= #
91
1093
  # === register_ids?
92
1094
  # ========================================================================= #
@@ -304,72 +1306,6 @@ class WebObject < ::Cyberweb::Base # === Cyberweb::WebObject
304
1306
  main_css "#{i}\n#{TEMPLATE1}"
305
1307
  end
306
1308
 
307
- # ========================================================================= #
308
- # === string_link
309
- #
310
- # This method essentially creates a String representation of the HTML
311
- # <a> tag.
312
- #
313
- # Since as of April 2022 the method "slink" is now an alias to string_link;
314
- # it used to be an alias towards "def a()", but this was changed - the
315
- # word string_link more logically may refer to slink as its intrinsic
316
- # abbreviation.
317
- # ========================================================================= #
318
- def string_link(
319
- i = '',
320
- option_hash = {},
321
- &block
322
- )
323
- # ======================================================================= #
324
- # === Handle blocks given to this method next
325
- # ======================================================================= #
326
- if block_given?
327
- yielded = yield
328
- case yielded
329
- # ===================================================================== #
330
- # === :pretty
331
- # ===================================================================== #
332
- when :pretty
333
- option_hash[:remote_URL] = beautiful_url(i)
334
- end
335
- end
336
- if i.is_a?(Symbol)
337
- if i.start_with?('local_')
338
- i = BeautifulUrl.local_menu(i)
339
- else
340
- i = beautiful_url(i)
341
- # =================================================================== #
342
- # Also check if the second argument is a String. In this case we
343
- # must modify it. Example for input that fulfils this criterium:
344
- #
345
- # remote_link(:hydrogenase, 'Hydrogenase')+
346
- #
347
- # =================================================================== #
348
- if option_hash.is_a? String
349
- option_hash = { content: option_hash }
350
- end
351
- end
352
- end
353
- # ======================================================================= #
354
- # === Handle local entries for the "/home/x" directory layout.
355
- # ======================================================================= #
356
- if i.start_with? '/home/x'
357
- i = i.dup
358
- i.sub!(/\/home\/x\//, relative_path?)
359
- end
360
- i = rds(i.to_s.dup)
361
- # ======================================================================= #
362
- # Delegate onto HtmlTags.a().
363
- # ======================================================================= #
364
- return HtmlTags.a(
365
- i,
366
- option_hash
367
- )
368
- end; alias string_a string_link # === string_a
369
- alias string_href string_link # === string_href
370
- alias string_remote_link string_link # === string_remote_link
371
- alias slink string_link # === slink
372
-
373
1309
  # ========================================================================= #
374
1310
  # === default_hyperlinks_template1
375
1311
  # ========================================================================= #
@@ -822,19 +1758,6 @@ class WebObject < ::Cyberweb::Base # === Cyberweb::WebObject
822
1758
  @internal_hash[:string_lateron] << i
823
1759
  end
824
1760
 
825
- # ========================================================================= #
826
- # === title?
827
- #
828
- # Query method for the title of our webpage.
829
- #
830
- # Note that the method .title() is an alias for .title?(); in the past,
831
- # before April 2022, it was an alias for .set_title() instead.
832
- # ========================================================================= #
833
- def title?
834
- ::Cyberweb.title?
835
- end; alias use_this_title? title? # === use_this_title?
836
- alias title title? # === use_this_title?
837
-
838
1761
  # ========================================================================= #
839
1762
  # === add_html_comment
840
1763
  #
@@ -2713,50 +3636,6 @@ a:hover {
2713
3636
  alias fancy_stars hr_stars # === fancy_stars
2714
3637
  alias pretty_separator hr_stars # === pretty_separator
2715
3638
 
2716
- # ========================================================================= #
2717
- # === div_p_default
2718
- # ========================================================================= #
2719
- def div_p_default(
2720
- optional_css_class = '',
2721
- the_id = '',
2722
- optional_css_style = '',
2723
- &block
2724
- )
2725
- div_default(optional_css_class, the_id, optional_css_style) {
2726
- p_default(optional_css_class, the_id, optional_css_style, &block)
2727
- }
2728
- end
2729
-
2730
- # ========================================================================= #
2731
- # === p_default
2732
- #
2733
- # This is similar to p(), but the implicit CSS class 'default' will
2734
- # be used.
2735
- # ========================================================================= #
2736
- def p_default(
2737
- optional_css_class = '',
2738
- the_id = '',
2739
- optional_css_style = '',
2740
- &block
2741
- )
2742
- if optional_css_class.is_a? Hash
2743
- if optional_css_class.has_key? :id
2744
- the_id = optional_css_class.delete(:id)
2745
- end
2746
- if optional_css_class.is_a?(Hash) and optional_css_class.empty?
2747
- optional_css_class = ''
2748
- end
2749
- end
2750
- optional_css_class = optional_css_class.to_s.dup
2751
- optional_css_class.prepend('default ') # Make it the first argument.
2752
- p(
2753
- optional_css_class.strip,
2754
- the_id,
2755
- optional_css_style,
2756
- &block
2757
- )
2758
- end
2759
-
2760
3639
  # ========================================================================= #
2761
3640
  # === return_stars
2762
3641
  # ========================================================================= #
@@ -2836,24 +3715,6 @@ a:hover {
2836
3715
  end
2837
3716
  end
2838
3717
 
2839
- # ========================================================================= #
2840
- # === do_copy_the_javascript_code_files_into_current_working_directory
2841
- # ========================================================================= #
2842
- def do_copy_the_javascript_code_files_into_current_working_directory
2843
- use_this_path = Cyberweb.project_base_directory?+'javascript_code/'
2844
- current_directory = return_pwd
2845
- # ======================================================================= #
2846
- # The next clause will only copy files - at a later time this may
2847
- # have to be changed to also copy directories, but for now (Oct 2022)
2848
- # this is the way to go.
2849
- # ======================================================================= #
2850
- Dir[use_this_path+'*'].select {|entry| File.file?(entry) }.each {|entry|
2851
- unless File.exist?(current_directory+File.basename(entry))
2852
- copy_this_file(entry)
2853
- end
2854
- }
2855
- end
2856
-
2857
3718
  # ========================================================================= #
2858
3719
  # === return_css_style
2859
3720
  #
@@ -3167,16 +4028,6 @@ a:hover {
3167
4028
  e(i, optional_css_class)
3168
4029
  end
3169
4030
 
3170
- # ========================================================================= #
3171
- # === cmd3
3172
- # ========================================================================= #
3173
- def cmd3(
3174
- i = '',
3175
- optional_css_class = ::Cyberweb.command3?
3176
- )
3177
- e(i, optional_css_class)
3178
- end
3179
-
3180
4031
  # ========================================================================= #
3181
4032
  # === cmd1_is
3182
4033
  # ========================================================================= #
@@ -3659,13 +4510,6 @@ SQL
3659
4510
  end
3660
4511
  end
3661
4512
 
3662
- # ========================================================================= #
3663
- # === listing_css
3664
- # ========================================================================= #
3665
- def listing_css(i)
3666
- ::Cyberweb.listing_css_object = i
3667
- end
3668
-
3669
4513
  # ========================================================================= #
3670
4514
  # === spacer (spacer tag)
3671
4515
  # ========================================================================= #
@@ -3731,13 +4575,6 @@ SQL
3731
4575
  end
3732
4576
  end
3733
4577
 
3734
- # ========================================================================= #
3735
- # === do_show_source
3736
- # ========================================================================= #
3737
- def do_show_source
3738
- @internal_hash[:show_source] = true
3739
- end
3740
-
3741
4578
  # ========================================================================= #
3742
4579
  # === show_source?
3743
4580
  # ========================================================================= #
@@ -4010,22 +4847,6 @@ SQL
4010
4847
  end
4011
4848
  end
4012
4849
 
4013
- # ========================================================================= #
4014
- # === oop_progress
4015
- #
4016
- # The progress element represents the completion progress of a task. The
4017
- # method here will simply delegate towards the corresponding objectified
4018
- # HTML tag.
4019
- # ========================================================================= #
4020
- def oop_progress(
4021
- n_percent,
4022
- &block
4023
- )
4024
- addnl(
4025
- ::Cyberweb::Objectified::HtmlTags::Progress.new(n_percent, &block).to_s
4026
- )
4027
- end; alias progress oop_progress # === progress
4028
-
4029
4850
  # ========================================================================= #
4030
4851
  # === text
4031
4852
  # ========================================================================= #
@@ -4190,64 +5011,6 @@ body {
4190
5011
  alias css_file add_this_remote_css_page # === css_file
4191
5012
  alias external_style_sheet add_this_remote_css_page # === external_style_sheet
4192
5013
 
4193
- # ========================================================================= #
4194
- # === check_whether_to_show_the_source_code
4195
- #
4196
- # This is the method that can display the source code of a given .cgi
4197
- # page.
4198
- # ========================================================================= #
4199
- def check_whether_to_show_the_source_code
4200
- # ======================================================================= #
4201
- # We must also check whether the configuration file allows us to
4202
- # show the source code.
4203
- # ======================================================================= #
4204
- if show_source? and ::Cyberweb.config['may_show_source']
4205
- _ = this_file?(:full_path)
4206
- ee '<html>'
4207
- ee '<head>'
4208
- # ===================================================================== #
4209
- # Add the following in order to enable on-click highlight at a later time.
4210
- # ===================================================================== #
4211
- ee HtmlTags.style('.highlight {
4212
- background:yellow;
4213
- }')
4214
- ee '</head>'
4215
- ee '<body>'
4216
- ee 'Next displaying the source code of the file <b>'+_+'</b>'
4217
- # ===================================================================== #
4218
- # The following has not yet been enabled. It shall follow this
4219
- # here:
4220
- #
4221
- # http://jsfiddle.net/kB7u2/1/
4222
- #
4223
- # ===================================================================== #
4224
- if false
4225
- output_this_javascript "
4226
- $('.stripe_table').hover(
4227
- function() {
4228
- $(this).addClass('highlight');
4229
- }, function() {
4230
- $(this).removeClass('highlight');
4231
- }
4232
- )"
4233
- end
4234
- dataset = File.readlines(_)
4235
- n_lines = dataset.size
4236
- ee '<h4>'+n_lines.to_s+' lines</h4>'
4237
- ee '<pre>'
4238
- # ===================================================================== #
4239
- # Presently, we will always display the index-number.
4240
- # ===================================================================== #
4241
- dataset.each_with_index {|content, index|
4242
- index += 1
4243
- ee '<span class="line_'+index.to_s+'"><b>'+index.to_s.ljust(5)+'</b>'+content+'</span>'
4244
- }
4245
- ee '</pre>'
4246
- ee '</body></html>'
4247
- exit
4248
- end
4249
- end
4250
-
4251
5014
  # ========================================================================= #
4252
5015
  # === display_this_file_without_comments
4253
5016
  #
@@ -4979,31 +5742,14 @@ end
4979
5742
  end; alias path= set_fixed_path # === path=
4980
5743
 
4981
5744
  # ========================================================================= #
4982
- # === set_proper_base_directory
4983
- # ========================================================================= #
4984
- def set_proper_base_directory
4985
- set_fixed_path(
4986
- ::Cyberweb.converted_path+
4987
- ::Cyberweb.name_of_img_dir?
4988
- )
4989
- end; alias absolute_position= set_proper_base_directory # === absolute_position=
4990
-
4991
- # ========================================================================= #
4992
- # === config?
4993
- #
4994
- # A getter-method towards the config dataset.
4995
- #
4996
- # Usage Example:
4997
- #
4998
- # w.config['use_jquery']
4999
- #
5000
- # ========================================================================= #
5001
- def config?
5002
- @config
5003
- end; alias web_object_config? config? # === web_object_config?
5004
- # alias config config? # === config
5005
- # ^^^ The above alias may be problematic; may re-enable or remove at
5006
- # a later time (August 2018)
5745
+ # === set_proper_base_directory
5746
+ # ========================================================================= #
5747
+ def set_proper_base_directory
5748
+ set_fixed_path(
5749
+ ::Cyberweb.converted_path+
5750
+ ::Cyberweb.name_of_img_dir?
5751
+ )
5752
+ end; alias absolute_position= set_proper_base_directory # === absolute_position=
5007
5753
 
5008
5754
  # ========================================================================= #
5009
5755
  # === fetch_css_classes
@@ -5206,36 +5952,6 @@ end
5206
5952
  )
5207
5953
  end; alias mathml_start mathml # === mathml_start
5208
5954
 
5209
- # ========================================================================= #
5210
- # === obtain_the_parameters_passed
5211
- #
5212
- # This query-method will return which params have been passed into,
5213
- # for example, a .cgi page.parameters_as_string?
5214
- #
5215
- # Typical invocation may go like this:
5216
- #
5217
- # w.obtain_the_parameters_passed
5218
- #
5219
- # ========================================================================= #
5220
- def obtain_the_parameters_passed
5221
- ::Cyberweb.params? # This is part of params.rb actually.
5222
- end; alias return_params_hash obtain_the_parameters_passed # === return_params_hash
5223
- alias web_params? obtain_the_parameters_passed # === web_params?
5224
- alias web_params obtain_the_parameters_passed # === web_params
5225
- alias params? obtain_the_parameters_passed # === params?
5226
- alias params obtain_the_parameters_passed # === params
5227
-
5228
- # ========================================================================= #
5229
- # === obtain_this_param_as_string
5230
- #
5231
- # This method must guarantee to return a String.
5232
- # ========================================================================= #
5233
- def obtain_this_param_as_string(i)
5234
- _ = params?[i]
5235
- _ = _.first if _.is_a? Array
5236
- return _.to_s # e. g. {"view"=>["/tmp"]}
5237
- end; alias params_as_string? obtain_this_param_as_string # === params_as_string?
5238
-
5239
5955
  # ========================================================================= #
5240
5956
  # === param_first_key?
5241
5957
  # ========================================================================= #
@@ -6183,31 +6899,6 @@ end
6183
6899
  e i, 'padl1em'
6184
6900
  end
6185
6901
 
6186
- require 'cyberweb/toplevel_methods/video.rb'
6187
- # ========================================================================= #
6188
- # === embed_youtube_video
6189
- # ========================================================================= #
6190
- def embed_youtube_video(
6191
- src = 'gexazLr6pSY',
6192
- width = '640',
6193
- height = '385'
6194
- )
6195
- addnl(
6196
- ::Cyberweb.embed_youtube_video(
6197
- src,
6198
- width,
6199
- height
6200
- )
6201
- )
6202
- end; alias eyv embed_youtube_video # === eyv
6203
- alias youtube embed_youtube_video # === youtube
6204
- alias youtube_links embed_youtube_video # === youtube_links
6205
- alias youtube_link embed_youtube_video # === youtube_link
6206
- alias youtube_video embed_youtube_video # === youtube_video
6207
- alias embed_video_file embed_youtube_video # === embed_video_file
6208
- alias embed_video embed_youtube_video # === embed_video
6209
- alias embed_youtube_link embed_youtube_video # === embed_youtube_link
6210
-
6211
6902
  # ========================================================================= #
6212
6903
  # === embed_videos
6213
6904
  #
@@ -6704,81 +7395,6 @@ end
6704
7395
  ENV['REQUEST_URI'].to_s
6705
7396
  end
6706
7397
 
6707
- # ========================================================================= #
6708
- # === l2
6709
- # ========================================================================= #
6710
- def l2(
6711
- i = '',
6712
- optional_css_class = '',
6713
- optional_the_id = ''
6714
- )
6715
- if optional_css_class.is_a? Hash
6716
- # ======================================================================= #
6717
- # === :id
6718
- # ======================================================================= #
6719
- if optional_css_class.has_key? :id
6720
- optional_the_id = optional_css_class.delete(:id)
6721
- end
6722
- end
6723
- if optional_css_class.frozen?
6724
- optional_css_class = optional_css_class.dup
6725
- optional_css_class << ' padl2em'
6726
- end
6727
- s2(i, optional_css_class.strip, optional_the_id)
6728
- end; alias l2em l2 # === l2em
6729
- alias padl2em l2 # === padl2em
6730
-
6731
- # ========================================================================= #
6732
- # === l1 (l1 tag)
6733
- #
6734
- # The second argument to this method may sometimes be a Hash, such as:
6735
- #
6736
- # 'foobar', id: 'mini-car'
6737
- #
6738
- # ========================================================================= #
6739
- def l1(
6740
- i = '',
6741
- optional_css_class = '',
6742
- optional_the_id = ''
6743
- )
6744
- if optional_css_class.is_a? Hash
6745
- # ======================================================================= #
6746
- # === :id
6747
- # ======================================================================= #
6748
- if optional_css_class.has_key? :id
6749
- optional_the_id = optional_css_class.delete(:id)
6750
- end
6751
- if optional_css_class.is_a?(Hash) and optional_css_class.empty?
6752
- optional_css_class = optional_css_class.to_s
6753
- end
6754
- end
6755
- optional_css_class = optional_css_class.dup
6756
- optional_css_class << ' padl1em' # Add the padl1em CSS class here.
6757
- s2(
6758
- i, optional_css_class.strip, optional_the_id
6759
- )
6760
- end; alias l1em l1 # === l1em
6761
- alias l1m l1 # === l1m
6762
- alias lem1 l1 # === lem1
6763
- alias padlem l1 # === padlem
6764
- alias padl1em l1 # === padl1em
6765
-
6766
- # ========================================================================= #
6767
- # === l2emb
6768
- # ========================================================================= #
6769
- def l2emb(
6770
- i = '',
6771
- optional_css_class = ''
6772
- )
6773
- l2(i, optional_css_class)
6774
- br
6775
- end; alias l2br l2emb # === l2br
6776
- alias l2embr l2emb # === l2embr
6777
- alias lem2 l2emb # === lem2
6778
- alias lembre2 l2emb # === lembre2
6779
- alias padl2embr l2emb # === padl2embr
6780
- alias le2 l2emb # === le2
6781
-
6782
7398
  # ========================================================================= #
6783
7399
  # === load_yaml_configuration (yaml tag)
6784
7400
  #
@@ -6843,28 +7459,6 @@ end
6843
7459
  return '<hr>'
6844
7460
  end
6845
7461
 
6846
- # ========================================================================= #
6847
- # === lembre
6848
- # ========================================================================= #
6849
- def lembre(
6850
- i = '',
6851
- optional_css_class = '',
6852
- optional_the_id = ''
6853
- )
6854
- l1(
6855
- i,
6856
- optional_css_class,
6857
- optional_the_id
6858
- )
6859
- br
6860
- end; alias lem1br lembre # === lembre
6861
- alias lem lembre # === lem
6862
- alias lemspan lembre # === lemspan
6863
- alias lee lembre # === lee
6864
- alias lembr lembre # === lembr
6865
- alias padl1embr lembre # === padl1embr
6866
- alias le lembre # === le
6867
-
6868
7462
  # ========================================================================= #
6869
7463
  # === on_this_id
6870
7464
  # ========================================================================= #
@@ -6913,23 +7507,6 @@ function '+name_of_the_function_to_use+'{
6913
7507
  '
6914
7508
  end
6915
7509
 
6916
- # ========================================================================= #
6917
- # === dimgbr
6918
- #
6919
- # This method combines dimg() and br().
6920
- # ========================================================================= #
6921
- def dimgbr(
6922
- url = '',
6923
- css_class = '',
6924
- the_id = '',
6925
- css_style = '',
6926
- alt_text = '',
6927
- &block
6928
- )
6929
- dimg(url, css_class, the_id, css_style, alt_text, &block)
6930
- br
6931
- end
6932
-
6933
7510
  # ========================================================================= #
6934
7511
  # === stars
6935
7512
  # ========================================================================= #
@@ -7546,42 +8123,6 @@ function simple_clock_timer() {
7546
8123
  return ::Cyberweb.html_comment(of_this_text.to_s)
7547
8124
  end
7548
8125
 
7549
- # ========================================================================= #
7550
- # === reset_the_listing_counter
7551
- # ========================================================================= #
7552
- def reset_the_listing_counter
7553
- @internal_hash[:listing_counter] = 0
7554
- end; alias reset_counter reset_the_listing_counter # === reset_counter
7555
-
7556
- # ========================================================================= #
7557
- # === listing_counter?
7558
- # ========================================================================= #
7559
- def listing_counter?
7560
- @internal_hash[:listing_counter]
7561
- end; alias listing_counter listing_counter? # === listing_counter
7562
-
7563
- # ========================================================================= #
7564
- # === listing_counter=
7565
- # ========================================================================= #
7566
- def listing_counter=(i)
7567
- @internal_hash[:listing_counter] = i
7568
- end
7569
-
7570
- # ========================================================================= #
7571
- # === counter_li
7572
- #
7573
- # This method was added in June 2021.
7574
- # ========================================================================= #
7575
- def counter_li(
7576
- i = '',
7577
- optional_css_class = ''
7578
- )
7579
- @internal_hash[:listing_counter] += 1
7580
- e '('+@internal_hash[:listing_counter].to_s+') '+
7581
- i.to_s,
7582
- optional_css_class
7583
- end
7584
-
7585
8126
  # ========================================================================= #
7586
8127
  # === database?
7587
8128
  # ========================================================================= #
@@ -8159,17 +8700,6 @@ function simple_clock_timer() {
8159
8700
  return i
8160
8701
  end
8161
8702
 
8162
- # ========================================================================= #
8163
- # === add_this_css_style
8164
- #
8165
- # This method can be used to add ad-hoc CSS code to a webpage.
8166
- # ========================================================================= #
8167
- def add_this_css_style(i)
8168
- addnl(
8169
- return_css_style(i)
8170
- )
8171
- end; alias add_to_CSS_rules add_this_css_style # === add_to_CSS_rules
8172
-
8173
8703
  # ========================================================================= #
8174
8704
  # === add_all_local_css_files
8175
8705
  #
@@ -8356,32 +8886,13 @@ function simple_clock_timer() {
8356
8886
  )
8357
8887
  end
8358
8888
 
8359
- require 'cyberweb/toplevel_methods/dot.rb'
8360
- # ========================================================================= #
8361
- # === string_dot
8362
- # ========================================================================= #
8363
- def string_dot(
8364
- i = 108,
8365
- optional_css_class = '',
8366
- optional_the_id = '',
8367
- optional_css_style = ''
8368
- )
8369
- _ = sg(
8370
- "dot#{i}".to_sym,
8371
- optional_css_class,
8372
- optional_the_id,
8373
- optional_css_style
8374
- )
8375
- return _
8376
- end; alias dot string_dot # === dot (dot tag)
8377
-
8378
8889
  # ========================================================================= #
8379
8890
  # === dot101?
8380
8891
  #
8381
8892
  # This simply wraps over dot() with a default value and default CSS.
8382
8893
  # ========================================================================= #
8383
8894
  def dot101?
8384
- dot(101, 'marr10px')
8895
+ string_dot(101, 'marr10px')
8385
8896
  end
8386
8897
 
8387
8898
  # ========================================================================= #
@@ -8390,7 +8901,7 @@ function simple_clock_timer() {
8390
8901
  # This simply wraps over dot() with a default value and default CSS.
8391
8902
  # ========================================================================= #
8392
8903
  def dot102?
8393
- dot(102, 'marr10px')
8904
+ string_dot(102, 'marr10px')
8394
8905
  end
8395
8906
 
8396
8907
  # ========================================================================= #
@@ -8399,7 +8910,7 @@ function simple_clock_timer() {
8399
8910
  # This simply wraps over dot() with a default value and default CSS.
8400
8911
  # ========================================================================= #
8401
8912
  def dot103?
8402
- dot(103, 'marr10px')
8913
+ string_dot(103, 'marr10px')
8403
8914
  end
8404
8915
 
8405
8916
  # ========================================================================= #
@@ -8408,7 +8919,7 @@ function simple_clock_timer() {
8408
8919
  # This simply wraps over dot() with a default value and default CSS.
8409
8920
  # ========================================================================= #
8410
8921
  def dot104?
8411
- dot(104, 'marr10px')
8922
+ string_dot(104, 'marr10px')
8412
8923
  end
8413
8924
 
8414
8925
  # ========================================================================= #
@@ -8417,7 +8928,7 @@ function simple_clock_timer() {
8417
8928
  # This simply wraps over dot() with a default value and default CSS.
8418
8929
  # ========================================================================= #
8419
8930
  def dot105?
8420
- dot(105, 'marr10px')
8931
+ string_dot(105, 'marr10px')
8421
8932
  end
8422
8933
 
8423
8934
  # ========================================================================= #
@@ -8426,7 +8937,7 @@ function simple_clock_timer() {
8426
8937
  # This simply wraps over dot() with a default value and default CSS.
8427
8938
  # ========================================================================= #
8428
8939
  def dot106?
8429
- dot(106, 'marr10px')
8940
+ string_dot(106, 'marr10px')
8430
8941
  end
8431
8942
 
8432
8943
  # ========================================================================= #
@@ -8435,7 +8946,7 @@ function simple_clock_timer() {
8435
8946
  # This simply wraps over dot() with a default value and default CSS.
8436
8947
  # ========================================================================= #
8437
8948
  def dot107?
8438
- dot(107, 'marr10px')
8949
+ string_dot(107, 'marr10px')
8439
8950
  end
8440
8951
 
8441
8952
  # ========================================================================= #
@@ -8444,26 +8955,34 @@ function simple_clock_timer() {
8444
8955
  # This simply wraps over dot() with a default value and default CSS.
8445
8956
  # ========================================================================= #
8446
8957
  def dot108?
8447
- dot(108, 'marr10px')
8958
+ string_dot(108, 'marr10px')
8448
8959
  end
8449
8960
 
8450
8961
  # ========================================================================= #
8451
- # === dot109?
8962
+ # === dot110?
8452
8963
  #
8453
8964
  # This simply wraps over dot() with a default value and default CSS.
8454
8965
  # ========================================================================= #
8455
- def dot109?
8456
- dot(109, 'marr10px')
8966
+ def dot110?
8967
+ string_dot(110, 'marr10px')
8457
8968
  end
8458
8969
 
8459
8970
  # ========================================================================= #
8460
- # === dot110?
8971
+ # === config?
8972
+ #
8973
+ # A getter-method towards the config dataset.
8974
+ #
8975
+ # Usage Example:
8976
+ #
8977
+ # w.config['use_jquery']
8461
8978
  #
8462
- # This simply wraps over dot() with a default value and default CSS.
8463
8979
  # ========================================================================= #
8464
- def dot110?
8465
- dot(110, 'marr10px')
8466
- end
8980
+ def config?
8981
+ @config
8982
+ end; alias web_object_config? config? # === web_object_config?
8983
+ # alias config config? # === config
8984
+ # ^^^ The above alias may be problematic; may re-enable or remove at
8985
+ # a later time (August 2018)
8467
8986
 
8468
8987
  # ========================================================================= #
8469
8988
  # === Cyberweb::WebObject.evaluate_from_this_file_via_beautiful_url