cyberweb 0.4.174 → 0.5.225
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 +1782 -405
- data/bin/cyberweb_sanitize +10 -0
- data/bin/download_webpage +7 -0
- data/bin/html_to_cyberweb_converter +7 -0
- data/cyberweb.gemspec +25 -25
- data/doc/README.gen +1745 -383
- data/doc/USAGE.md +16 -16
- data/doc/{AUTHORS.md → authors.md} +0 -0
- data/doc/configuration/configuration.md +3 -1
- data/doc/deprecations.md +13 -7
- data/doc/{DOCUMENTATION_FOR_CYBERSPRAWL.md → documentation_for_cybersprawl.md} +7 -4
- data/doc/future_design_goals.md +33 -0
- data/doc/html_characters.md +7 -7
- data/doc/{JQUERY.md → jquery/jquery.md} +20 -12
- data/doc/{MOUSE.md → mouse.md} +1 -9
- data/doc/{RENDER_WEB_BASE.md → render_web_base.md} +11 -4
- data/doc/todo/todo_for_the_cyberweb_project.md +791 -0
- data/examples/advanced/animated_css_example/animated_css_example.html +47 -0
- data/examples/advanced/animated_submarine/animated_submarine.html +511 -0
- data/examples/advanced/animated_windmill/animated_windmill.html +468 -0
- data/examples/advanced/delayed_update_of_the_body_via_javascript.cgi +8 -5
- data/examples/advanced/draw_circle/draw_circle.cgi +36 -0
- data/examples/advanced/drop_shadow_examples.cgi +37 -0
- data/examples/advanced/games/snake/food.png +0 -0
- data/examples/advanced/games/snake/ground.png +0 -0
- data/examples/advanced/games/snake/snake.cgi +28 -0
- data/examples/advanced/games/tetris/tetris.cgi +7 -0
- data/examples/advanced/games/tetris/tetris.rb +17 -0
- data/examples/advanced/games/tetris/tetris.sinatra +58 -0
- data/examples/advanced/games/tic-tac-toe/tic-tac-toe.cgi +123 -0
- data/examples/advanced/get_some_coffee/get_some_coffee.html +293 -0
- data/examples/advanced/glow_on_hover_example/glow_on_hover_example.cgi +27 -0
- data/examples/advanced/hybrid_experiment.cgi +34 -12
- data/examples/advanced/images/global_css_rules_for_the_images.cgi +32 -0
- data/examples/advanced/larger_image_on_mouse_over_example.cgi +2 -2
- data/examples/advanced/no_right_click.cgi +4 -3
- data/examples/advanced/{objectified_html_tags.cgi → objectified_html_tags/objectified_html_tags.cgi} +12 -3
- data/examples/advanced/objectified_html_tags/testing_objectified_html_tags_with_the_webobject.cgi +28 -0
- data/examples/advanced/random_glow_effects.cgi +34 -0
- data/examples/advanced/select_everything_example/select_everything_example.cgi +25 -0
- data/examples/advanced/simple_calculator.cgi +13 -21
- data/examples/advanced/simple_form_example.cgi +11 -11
- data/examples/advanced/traffic_light/traffic_light.html +163 -0
- data/examples/advanced/weather_animation/weather_animation.html +560 -0
- data/examples/css/animated_3D_cube_example/animated_3D_cube_example.html +265 -0
- data/examples/css/animated_bird_example/animated_bird_example.html +207 -0
- data/examples/css/animated_desk_example/animated_desk_example.html +120 -0
- data/examples/css/animated_dog_example/animated_dog_example.html +432 -0
- data/examples/css/animated_submit_button.html +190 -0
- data/examples/css/animated_text_colour_change/animated_text_colour_change.html +41 -0
- data/examples/css/blue_border.html +3 -1
- data/examples/css/border_image_example/border_image_example.html +40 -0
- data/examples/css/box_shadow/box_shadow_example.html +18 -0
- data/examples/css/christmas_snow_globe_animation.html +596 -0
- data/examples/css/css_border_spacing_example.html +5 -5
- data/examples/css/css_bubbles.html +3 -1
- data/examples/css/css_checkboxes_example/css_checkboxes_example.html +110 -0
- data/examples/css/css_drag_and_drop.html +1 -5
- data/examples/css/css_grid_feline_style/css_grid_feline_style.html +161 -0
- data/examples/css/css_neon_glow_effects.html +1 -1
- data/examples/css/css_rotate_these_words.html +83 -0
- data/examples/css/css_text_decoration_example.html +7 -7
- data/examples/css/css_thermometer/css_thermometer.html +91 -0
- data/examples/css/{css_tooltip.html → css_tooltip/css_tooltip.html} +8 -6
- data/examples/css/css_typewriter_example/css_typewriter_example.html +226 -0
- data/examples/css/cyberweb_animated_logo/cyberweb_animated_logo.html +179 -0
- data/examples/css/daily_coffee/daily_coffee.html +1110 -0
- data/examples/css/different_colour_on_selected_text/different_colour_on_selected_text.html +31 -0
- data/examples/css/differentially_glowing_text_example/differentially_glowing_text_example.html +82 -0
- data/examples/css/fade_in_and_fade_out_effect.html +2 -2
- data/examples/css/flying_birds_example/flying_birds_example.html +171 -0
- data/examples/css/folding_cards_example/folding_cards_example.html +624 -0
- data/examples/css/font_size_examples.html +7 -5
- data/examples/css/glowing_on_hover_animation/glowing_on_hover_animation.html +90 -0
- data/examples/css/grow_example.html +31 -0
- data/examples/css/happy_toaster_example/happy_toaster_example.html +830 -0
- data/examples/css/landing_on_mars_animation/landing_on_mars_animation.html +374 -0
- data/examples/css/letter_spacing_example.cgi +18 -14
- data/examples/css/lighthouse_example/lighthouse_example.html +1161 -0
- data/examples/css/{meter_example.html → meter_example/meter_example.html} +0 -0
- data/examples/css/motorcycle_on_the_go/motorcycle_on_the_go.html +227 -0
- data/examples/css/on_hover_glow_effect/on_hover_glow_effect.html +50 -0
- data/examples/css/on_mouse_button_pressed.html +6 -4
- data/examples/css/our_solar_system/our_solar_system.html +441 -0
- data/examples/css/outline/outline_versus_border_example.html +57 -0
- data/examples/css/polaroid_card_effect_example/polaroid_card_effect_example.html +130 -0
- data/examples/css/responsive_image_gallery/responsive_image_gallery.html +97 -0
- data/examples/css/rotating_DNA/rotating_DNA.html +626 -0
- data/examples/css/rotating_sphere_example/rotating_sphere_example.html +112 -0
- data/examples/css/scale_example.html +4 -5
- data/examples/css/shadow_example_in_CSS/shadow_example_in_CSS.cgi +62 -0
- data/examples/css/shaking_shapes_example.html +133 -0
- data/examples/css/simple_stars_example/simple_stars_example.html +27 -0
- data/examples/css/slide_checkbox_example/slide_checkbox_example.html +564 -0
- data/examples/css/speak_bubble_quote_example/speak_bubble_quote_example.html +109 -0
- data/examples/css/speedy_truck_example/speedy_truck_example.html +168 -0
- data/examples/css/{sticky_div_example.html → sticky_div_example/sticky_div_example.html} +0 -0
- data/examples/css/stitched_div.html +9 -0
- data/examples/css/sun_and_clouds_animation/sun_and_clouds_animation.html +292 -0
- data/examples/css/talking_candles_example/talking_candles_example.html +550 -0
- data/examples/css/text_decoration_underline_example/text_decoration_underline_example.html +62 -0
- data/examples/css/this_is_a_cat/this_is_a_cat.html +219 -0
- data/examples/css/three_dots_indicating_page_loading.html +65 -0
- data/examples/css/user_select_example/user_select_example.html +24 -0
- data/examples/css/walking_cat/walking_cat.html +128 -0
- data/examples/css/water_wave_text_animation_effect/water_wave_text_animation_effect.html +86 -0
- data/examples/csv/README.md +2 -1
- data/examples/flip_card_example/flip_card_example.html +10 -3
- data/examples/games/README.md +3 -0
- data/examples/games/snake/images/food.png +0 -0
- data/examples/games/snake/images/ground.png +0 -0
- data/examples/games/snake/snake.html +16 -0
- data/examples/games/snake/snake.js +117 -0
- data/examples/games/tetris/smaller_tetris_game.html +518 -0
- data/examples/games/tetris/tetris.html +461 -0
- data/examples/games/tic-tac-toe/index.js +125 -0
- data/examples/games/tic-tac-toe/style.css +79 -0
- data/examples/games/tic-tac-toe/tic-tac-toe.html +39 -0
- data/examples/html/MathML/001_show_a_simple_quadratic_equation.html +22 -0
- data/examples/html/MathML/002_simple_equation.html +7 -0
- data/examples/html/MathML/003_function_of_example.html +17 -0
- data/examples/html/MathML/README.md +2 -0
- data/examples/html/abbr_example.html +2 -5
- data/examples/html/accordion/README.md +1 -0
- data/examples/html/accordion/accordion.html +56 -0
- data/examples/html/base64_image_example.html +8 -5
- data/examples/html/buttons_example.html +133 -0
- data/examples/html/canvas_drawing_example.html +54 -0
- data/examples/html/colour_wheel.html +441 -442
- data/examples/html/column_width_example.html +2 -2
- data/examples/html/custom_cursor.html +8 -5
- data/examples/html/cyberweb_logo/README.md +2 -0
- data/examples/html/cyberweb_logo/cyberweb_logo.html +11 -0
- data/examples/html/draggable_paragraph.html +1 -2
- data/examples/html/email_popup_example/email_popup_example.html +175 -0
- data/examples/html/fieldset_example.html +3 -1
- data/examples/html/font_examples/README.md +1 -0
- data/examples/html/font_examples/chancery_text.html +19 -0
- data/examples/html/font_examples/fantasy_text.html +19 -0
- data/examples/html/font_examples/georgia_text.html +19 -0
- data/examples/html/font_size_example/font_size_example.html +85 -0
- data/examples/html/glyph_example.html +0 -1
- data/examples/html/grayscale_filter_example/grayscale_filter_example.html +15 -0
- data/examples/html/html_links_example.html +61 -0
- data/examples/html/html_slider/html_slider.html +39 -0
- data/examples/html/input_autofocus_example.html +11 -7
- data/examples/html/input_placeholder_example.html +15 -0
- data/examples/html/larger_image_on_mouse_over_example.html +1 -1
- data/examples/html/ordered_and_unordered_bulletsin.html +4 -2
- data/examples/html/play_video_example.html +3 -2
- data/examples/html/remote_image_example.html +8 -2
- data/examples/html/select_everything_on_mouse_click_event.html +38 -0
- data/examples/html/selected_text_appears_in_another_colour_example.html +34 -0
- data/examples/html/send_email_hyperlink/send_email_hyperlink.html +8 -0
- data/examples/html/simple_unordered_list.html +3 -0
- data/examples/html/spinner_example/spinner.html +79 -0
- data/examples/html/table_with_header_example.html +26 -13
- data/examples/html/test_mkv_codec/test_mkv_codec.html +11 -0
- data/examples/html/two_columns_flex_example.html +4 -1
- data/examples/{javascript → javascript_and_jquery}/README.md +0 -0
- data/examples/{javascript → javascript_and_jquery}/arrays/arrays_example_in_javascript.html +0 -0
- data/examples/javascript_and_jquery/autocomplete_on_an_input_field/autocomplete_on_an_input_field.html +295 -0
- data/examples/javascript_and_jquery/change_the_background_colour_dynamically/change_the_background_colour_dynamically.html +41 -0
- data/examples/{javascript → javascript_and_jquery}/delay_example/delay_example.html +0 -0
- data/examples/{javascript → javascript_and_jquery}/drag_support/drag_support.html +0 -0
- data/examples/javascript_and_jquery/jquery_bubbling_header/bubbling_header.html +109 -0
- data/examples/{javascript → javascript_and_jquery}/jquery_drag_and_drop/drag_and_drop_image_example.html +0 -0
- data/examples/javascript_and_jquery/jquery_showcase/README.md +6 -0
- data/examples/javascript_and_jquery/jquery_showcase/jquery_001.cgi +23 -0
- data/examples/javascript_and_jquery/jquery_showcase/jquery_002.cgi +34 -0
- data/examples/javascript_and_jquery/jquery_showcase/jquery_003.cgi +24 -0
- data/examples/javascript_and_jquery/jquery_showcase/jquery_004.cgi +34 -0
- data/examples/javascript_and_jquery/on_change_event/on_change_event.html +29 -0
- data/examples/javascript_and_jquery/on_click_colour_change/on_click_colour_change.html +31 -0
- data/examples/javascript_and_jquery/on_click_display_random_number/on_click_display_random_number.html +43 -0
- data/examples/{javascript → javascript_and_jquery}/on_click_event_hello_world/on_click_event_hello_world.html +0 -0
- data/examples/javascript_and_jquery/on_mouse_wheel_event/on_mouse_wheel_event.html +37 -0
- data/examples/javascript_and_jquery/read_the_content_of_a_local_file/read_the_content_of_a_local_file.html +35 -0
- data/examples/{javascript → javascript_and_jquery}/rgb_to_hex/rgb_to_hex.html +0 -0
- data/examples/{javascript → javascript_and_jquery}/screen_resolution/screen_resolution.html +2 -1
- data/examples/{javascript → javascript_and_jquery}/select_everything/select_everything.html +1 -1
- data/examples/javascript_and_jquery/vue/README.md +1 -0
- data/examples/javascript_and_jquery/vue/showcasing_vue.html +80 -0
- data/examples/{javascript → javascript_and_jquery}/write_into_a_file/write_into_a_file.html +0 -0
- data/examples/rack/example_with_html_template.rb +5 -4
- data/examples/rack/example_with_rack_and_cyberweb_showing_how_to_use_images.rb +3 -2
- data/examples/rack/hello_world_example_with_rack.rb +3 -2
- data/examples/rack/lobster.rb +7 -5
- data/examples/rack/rack_env.rb +3 -3
- data/examples/{show_greek_letters.rb → show_greek_letters/show_greek_letters.rb} +0 -0
- data/examples/simple/input_example_with_coloured_focus.cgi +32 -0
- data/examples/simple/input_type_examples.cgi +51 -0
- data/examples/simple/on_click_event_hello_world.cgi +5 -5
- data/examples/simple/rotate_these_words.cgi +90 -0
- data/examples/{example1.rb → simple/show_how_to_set_a_title.rb} +0 -0
- data/examples/simple/simple_gradient.cgi +57 -0
- data/images/cyberweb_favicon.png +0 -0
- data/images/cyberweb_logo.png +0 -0
- data/images/cyberweb_theme.png +0 -0
- data/lib/cyberweb/REST/README.md +7 -0
- data/lib/cyberweb/REST/base/accept_entry.rb +94 -0
- data/lib/cyberweb/REST/base/application.rb +37 -0
- data/lib/cyberweb/REST/base/bad_request.rb +10 -0
- data/lib/cyberweb/REST/base/base.rb +1131 -0
- data/lib/cyberweb/REST/base/common_logger.rb +35 -0
- data/lib/cyberweb/REST/base/delegator.rb +75 -0
- data/lib/cyberweb/REST/base/error.rb +8 -0
- data/lib/cyberweb/REST/base/extended_rack.rb +66 -0
- data/lib/cyberweb/REST/base/helpers/helpers.rb +473 -0
- data/lib/cyberweb/REST/base/helpers/stream.rb +75 -0
- data/lib/cyberweb/REST/base/mime_type_entry.rb +67 -0
- data/lib/cyberweb/{constants/file_constants.rb → REST/base/not_found.rb} +10 -5
- data/lib/cyberweb/REST/base/request.rb +145 -0
- data/lib/cyberweb/REST/base/response.rb +94 -0
- data/lib/cyberweb/REST/base/templates/templates.rb +208 -0
- data/lib/cyberweb/REST/base/wrapper.rb +28 -0
- data/lib/cyberweb/{constants/nl.rb → REST/constants.rb} +8 -9
- data/lib/cyberweb/REST/main.rb +109 -0
- data/lib/cyberweb/REST/show_exceptions.rb +396 -0
- data/lib/cyberweb/and_sinatra_base.rb +0 -0
- data/lib/cyberweb/autoinclude.rb +0 -0
- data/lib/cyberweb/autoinclude_webobject.rb +0 -0
- data/lib/cyberweb/base/base.rb +9 -2
- data/lib/cyberweb/base/colours.rb +8 -6
- data/lib/cyberweb/base/constants.rb +8 -0
- data/lib/cyberweb/base/misc.rb +140 -53
- data/lib/cyberweb/base/save_file.rb +3 -0
- data/lib/cyberweb/base_module/base_module.rb +79 -0
- data/lib/cyberweb/cascading_style_sheets/admonition.css +0 -0
- data/lib/cyberweb/cascading_style_sheets/balloon.css +0 -0
- data/lib/cyberweb/cascading_style_sheets/border.css +107 -41
- data/lib/cyberweb/cascading_style_sheets/code.css +0 -0
- data/lib/cyberweb/cascading_style_sheets/colours.css +46 -23
- data/lib/cyberweb/cascading_style_sheets/css_reset.css +59 -0
- data/lib/cyberweb/cascading_style_sheets/cursors.css +14 -0
- data/lib/cyberweb/cascading_style_sheets/custom/animated_bike.css +199 -0
- data/lib/cyberweb/cascading_style_sheets/default.css +171 -136
- data/lib/cyberweb/cascading_style_sheets/div.css +18 -4
- data/lib/cyberweb/cascading_style_sheets/drop_shadow.css +154 -0
- data/lib/cyberweb/cascading_style_sheets/error_404_css_class.css +26 -0
- data/lib/cyberweb/cascading_style_sheets/fonts.css +60 -39
- data/lib/cyberweb/cascading_style_sheets/glow_effects.css +69 -0
- data/lib/cyberweb/cascading_style_sheets/gradient_effects.css +5 -0
- data/lib/cyberweb/cascading_style_sheets/hover.css +4212 -0
- data/lib/cyberweb/cascading_style_sheets/links.css +8 -8
- data/lib/cyberweb/cascading_style_sheets/margin.css +195 -178
- data/lib/cyberweb/cascading_style_sheets/menu.css +0 -0
- data/lib/cyberweb/cascading_style_sheets/message_boxes.css +0 -0
- data/lib/cyberweb/cascading_style_sheets/misc.css +51 -11
- data/lib/cyberweb/cascading_style_sheets/popup.css +0 -0
- data/lib/cyberweb/cascading_style_sheets/rpg.css +0 -0
- data/lib/cyberweb/cascading_style_sheets/ruby_regexes.css +12 -0
- data/lib/cyberweb/cascading_style_sheets/shapes.css +59 -0
- data/lib/cyberweb/cascading_style_sheets/template2.css +0 -0
- data/lib/cyberweb/cascading_style_sheets/text_shadow.css +21 -0
- data/lib/cyberweb/cascading_style_sheets/tooltip.css +0 -0
- data/lib/cyberweb/cgi/constants.rb +1 -2
- data/lib/cyberweb/cgi/exceptions.rb +1 -1
- data/lib/cyberweb/coloured_tags/coloured_tags.rb +1 -1
- data/lib/cyberweb/colours/colour_chart.rb +10 -56
- data/lib/cyberweb/colours/colours.rb +149 -4
- data/lib/cyberweb/commandline/commandline_interface.rb +13 -8
- data/lib/cyberweb/configuration/load_the_configuration_file.rb +1 -1
- data/lib/cyberweb/constants/constants.rb +592 -2
- data/lib/cyberweb/controller/{webobject_controller.rb → controller.rb} +1 -1
- data/lib/cyberweb/css_manager/css_manager.rb +237 -0
- data/lib/cyberweb/databases/sqlite.rb +56 -0
- data/lib/cyberweb/debug/debug.rb +1 -1
- data/lib/cyberweb/encoding/encoding.rb +11 -0
- data/lib/cyberweb/erb/test.rhtml +0 -0
- data/lib/cyberweb/erb/test_template.erb +0 -0
- data/lib/cyberweb/evaluate_from_the_same_named_file_then_serve.rb +1 -1
- data/lib/cyberweb/favicon/favicon.rb +8 -7
- data/lib/cyberweb/forum/README.md +4 -0
- data/lib/cyberweb/foto_gallery/foto_gallery.rb +158 -0
- data/lib/cyberweb/generator/README.md +2 -2
- data/lib/cyberweb/generator/cgi.rb +22 -9
- data/lib/cyberweb/generator/static_webpage.rb +22 -12
- data/lib/cyberweb/html_tags/README.md +3 -3
- data/lib/cyberweb/html_tags/button.rb +10 -2
- data/lib/cyberweb/html_tags/h2.rb +6 -4
- data/lib/cyberweb/html_tags/html_tags.rb +17 -1
- data/lib/cyberweb/html_tags/input.rb +10 -5
- data/lib/cyberweb/html_tags/legend.rb +1 -1
- data/lib/cyberweb/html_tags/span.rb +10 -2
- data/lib/cyberweb/html_tags/table.rb +30 -19
- data/lib/cyberweb/html_template/html_template.rb +248 -85
- data/lib/cyberweb/images/embed_this_image.rb +3 -1
- data/lib/cyberweb/images/images.rb +2 -2
- data/lib/cyberweb/images/is_image.rb +2 -1
- data/lib/cyberweb/images/path_to_images.rb +2 -1
- data/lib/cyberweb/images/remove_this_substring_from_all_images.rb +1 -1
- data/lib/cyberweb/images/standalone_drag_and_drop_this_image.rb +3 -3
- data/lib/cyberweb/images/string_image.rb +6 -3
- data/lib/cyberweb/images_base64_encoded/404_ERROR.png.md +1 -0
- data/lib/cyberweb/images_base64_encoded/AUSRUFUNGSZEICHEN.png.md +0 -0
- data/lib/cyberweb/images_base64_encoded/BLUEARROW.png.md +0 -0
- data/lib/cyberweb/images_base64_encoded/BUBBLE.png.md +0 -0
- data/lib/cyberweb/images_base64_encoded/CAT.png.md +0 -0
- data/lib/cyberweb/images_base64_encoded/CAUTION.png.md +0 -0
- data/lib/cyberweb/images_base64_encoded/CHEERING_PERSON.png.md +0 -0
- data/lib/cyberweb/images_base64_encoded/CURSOR.png.md +0 -0
- data/lib/cyberweb/images_base64_encoded/DOT_01.png.md +0 -0
- data/lib/cyberweb/images_base64_encoded/DUCKY.png.md +0 -0
- data/lib/cyberweb/images_base64_encoded/ELEPHANT.png.md +0 -0
- data/lib/cyberweb/images_base64_encoded/HALLOWEEN.png.md +0 -0
- data/lib/cyberweb/images_base64_encoded/HANGING_MONKEY.png.md +0 -0
- data/lib/cyberweb/images_base64_encoded/LENS.png.md +0 -0
- data/lib/cyberweb/images_base64_encoded/README.md +0 -0
- data/lib/cyberweb/images_base64_encoded/SIX_SIDED_DICE.png.md +1 -0
- data/lib/cyberweb/images_base64_encoded/TU_WIEN_LOGO.png.md +0 -0
- data/lib/cyberweb/images_base64_encoded/VOGEL.png.md +0 -0
- data/lib/cyberweb/javascript/drag_and_drop.rb +17 -14
- data/lib/cyberweb/javascript/javascript.rb +79 -34
- data/lib/cyberweb/javascript/javascript_clock.rb +50 -14
- data/lib/cyberweb/javascript/javascript_helper/javascript_helper.rb +59 -0
- data/lib/cyberweb/javascript/jquery.rb +9 -5
- data/lib/cyberweb/javascript/on_click_change_opacity.rb +5 -1
- data/lib/cyberweb/javascript/on_click_hide.rb +2 -0
- data/lib/cyberweb/javascript/popup.rb +5 -2
- data/lib/cyberweb/javascript/resize.rb +4 -1
- data/lib/cyberweb/javascript_code/README.md +1 -1
- data/lib/cyberweb/javascript_code/custom_functions.js +51 -25
- data/lib/cyberweb/javascript_code/disable_right_click.js +5 -0
- data/lib/cyberweb/javascript_code/games/snake.js +113 -0
- data/lib/cyberweb/javascript_code/games/tetris.js +491 -0
- data/lib/cyberweb/javascript_code/games/tic-tac-toe.js +125 -0
- data/lib/cyberweb/javascript_code/html_colours.js +161 -0
- data/lib/cyberweb/javascript_code/jquery/jquery-3.6.1.js +10909 -0
- data/lib/cyberweb/javascript_code/select_everything_on_mouse_click_event.js +23 -0
- data/lib/cyberweb/javascript_code/simple_calculator.js +3 -3
- data/lib/cyberweb/javascript_code/simulate_a_dice.js +20 -0
- data/lib/cyberweb/javascript_code/sleep.js +3 -0
- data/lib/cyberweb/mouse/mouse.rb +4 -1
- data/lib/cyberweb/objectified/html_tags/README.md +13 -0
- data/lib/cyberweb/{objectified_html_tags → objectified/html_tags}/a.rb +17 -35
- data/lib/cyberweb/{objectified_html_tags → objectified/html_tags}/abbr.rb +18 -9
- data/lib/cyberweb/objectified/html_tags/base.rb +960 -0
- data/lib/cyberweb/objectified/html_tags/blockquote.rb +106 -0
- data/lib/cyberweb/{objectified_html_tags/span.rb → objectified/html_tags/body.rb} +25 -20
- data/lib/cyberweb/{objectified_html_tags → objectified/html_tags}/button.rb +26 -34
- data/lib/cyberweb/objectified/html_tags/canvas.rb +202 -0
- data/lib/cyberweb/objectified/html_tags/cite.rb +103 -0
- data/lib/cyberweb/{objectified_html_tags → objectified/html_tags}/combobox.rb +26 -34
- data/lib/cyberweb/objectified/html_tags/div.rb +155 -0
- data/lib/cyberweb/{objectified_html_tags → objectified/html_tags}/embed.rb +18 -33
- data/lib/cyberweb/objectified/html_tags/fieldset.rb +107 -0
- data/lib/cyberweb/objectified/html_tags/figure.rb +152 -0
- data/lib/cyberweb/objectified/html_tags/form.rb +155 -0
- data/lib/cyberweb/objectified/html_tags/h1.rb +176 -0
- data/lib/cyberweb/{objectified_html_tags → objectified/html_tags}/h2.rb +32 -40
- data/lib/cyberweb/{objectified_html_tags → objectified/html_tags}/h3.rb +30 -42
- data/lib/cyberweb/{objectified_html_tags → objectified/html_tags}/h4.rb +30 -42
- data/lib/cyberweb/{objectified_html_tags → objectified/html_tags}/h5.rb +31 -40
- data/lib/cyberweb/{objectified_html_tags → objectified/html_tags}/h6.rb +31 -41
- data/lib/cyberweb/{objectified_html_tags → objectified/html_tags}/hbox.rb +12 -10
- data/lib/cyberweb/objectified/html_tags/head.rb +126 -0
- data/lib/cyberweb/{objectified_html_tags → objectified/html_tags}/img.rb +47 -32
- data/lib/cyberweb/objectified/html_tags/include_objectified_html_tags.rb +49 -0
- data/lib/cyberweb/{objectified_html_tags → objectified/html_tags}/input.rb +50 -51
- data/lib/cyberweb/objectified/html_tags/map.rb +107 -0
- data/lib/cyberweb/{objectified_html_tags/div.rb → objectified/html_tags/meta.rb} +36 -47
- data/lib/cyberweb/{objectified_html_tags/h1.rb → objectified/html_tags/object.rb} +34 -42
- data/lib/cyberweb/{objectified_html_tags → objectified/html_tags}/p.rb +17 -32
- data/lib/cyberweb/{objectified_html_tags → objectified/html_tags}/pre.rb +28 -34
- data/lib/cyberweb/{objectified_html_tags/table.rb → objectified/html_tags/progress.rb} +99 -94
- data/lib/cyberweb/objectified/html_tags/span.rb +103 -0
- data/lib/cyberweb/objectified/html_tags/table.rb +257 -0
- data/lib/cyberweb/{objectified_html_tags → objectified/html_tags}/textarea.rb +25 -36
- data/lib/cyberweb/{objectified_html_tags → objectified/html_tags}/title.rb +11 -17
- data/lib/cyberweb/{objectified_html_tags/form.rb → objectified/html_tags/ul.rb} +45 -42
- data/lib/cyberweb/{objectified_html_tags → objectified/html_tags}/window.rb +15 -10
- data/lib/cyberweb/objectified/mask/README.md +8 -0
- data/lib/cyberweb/objectified/mask/compatibility_to_html_tags.rb +40 -0
- data/lib/cyberweb/objectified/mask/mask.rb +490 -0
- data/lib/cyberweb/objectified/web_object/README.md +4 -0
- data/lib/cyberweb/objectified/web_object/web_object.rb +119 -0
- data/lib/cyberweb/predefined_and_freeform_methods/frage.rb +4 -2
- data/lib/cyberweb/predefined_and_freeform_methods/freeform_methods.rb +30 -19
- data/lib/cyberweb/predefined_and_freeform_methods/hash_registered_extra_tags.rb +6 -0
- data/lib/cyberweb/predefined_and_freeform_methods/header.rb +2 -0
- data/lib/cyberweb/predefined_and_freeform_methods/predefined_methods.rb +10 -175
- data/lib/cyberweb/project/project.rb +9 -4
- data/lib/cyberweb/rack/request.rb +11 -11
- data/lib/cyberweb/raw_images/404.png +0 -0
- data/lib/cyberweb/raw_images/500.png +0 -0
- data/lib/cyberweb/raw_images/README.md +2 -0
- data/lib/cyberweb/raw_images/a_dice.png +0 -0
- data/lib/cyberweb/raw_images/food.png +0 -0
- data/lib/cyberweb/raw_images/ground.png +0 -0
- data/lib/cyberweb/requires/require_generators.rb +1 -1
- data/lib/cyberweb/requires/require_html_tags_files.rb +1 -1
- data/lib/cyberweb/requires/require_javascript_files.rb +1 -1
- data/lib/cyberweb/requires/require_objectified_html_tags_files.rb +29 -3
- data/lib/cyberweb/requires/require_the_constants.rb +3 -1
- data/lib/cyberweb/requires/require_the_cyberweb_project.rb +12 -31
- data/lib/cyberweb/requires/require_the_toplevel_methods_files.rb +1 -1
- data/lib/cyberweb/requires/require_web_object_files.rb +1 -1
- data/lib/cyberweb/requires/require_yaml.rb +3 -3
- data/lib/cyberweb/rest +1 -0
- data/lib/cyberweb/route_handler/class_based_test.rb +43 -0
- data/lib/cyberweb/route_handler/module/misc.rb +108 -0
- data/lib/cyberweb/route_handler/module/route_handler_module.rb +215 -0
- data/lib/cyberweb/route_handler/module/verbs.rb +53 -0
- data/lib/cyberweb/route_handler/route_handler.rb +56 -0
- data/lib/cyberweb/route_handler/test.rb +43 -0
- data/lib/cyberweb/{constants/array_predefined_constants.rb → sinatra/base/set_use_this_port.rb} +16 -9
- data/lib/cyberweb/sinatra/base/use_this_port.rb +40 -0
- data/lib/cyberweb/sinatra/base.rb +51 -36
- data/lib/cyberweb/sinatra/custom_extensions.rb +39 -14
- data/lib/cyberweb/standalone_classes/all_css_classes.rb +1 -1
- data/lib/cyberweb/standalone_classes/calculator.rb +7 -1
- data/lib/cyberweb/standalone_classes/correct_image_entries_in_html_file.rb +12 -7
- data/lib/cyberweb/standalone_classes/turn_html_into_cyberweb.rb +13 -11
- data/lib/cyberweb/svg/standalone/README.md +2 -0
- data/lib/cyberweb/svg/standalone/amusement_park.svg +738 -0
- data/lib/cyberweb/svg/svg.cgi +2 -3
- data/lib/cyberweb/toplevel_methods/a.rb +2 -1
- data/lib/cyberweb/toplevel_methods/anmerkung.rb +3 -0
- data/lib/cyberweb/toplevel_methods/audio.rb +1 -1
- data/lib/cyberweb/toplevel_methods/bold.rb +9 -3
- data/lib/cyberweb/toplevel_methods/charsets.rb +17 -13
- data/lib/cyberweb/toplevel_methods/consider_serving_the_web_object.rb +3 -3
- data/lib/cyberweb/toplevel_methods/css.rb +719 -25
- data/lib/cyberweb/{csv → toplevel_methods}/csv.rb +5 -3
- data/lib/cyberweb/{constants/roebe.rb → toplevel_methods/custom_error_page.rb} +10 -10
- data/lib/cyberweb/toplevel_methods/{date.rb → date_and_time.rb} +23 -10
- data/lib/cyberweb/toplevel_methods/disable.rb +7 -3
- data/lib/cyberweb/toplevel_methods/dot.rb +2 -2
- data/lib/cyberweb/toplevel_methods/download_webpage.rb +41 -3
- data/lib/cyberweb/toplevel_methods/edit_configuration_file.rb +1 -1
- data/lib/cyberweb/toplevel_methods/fields.rb +2 -0
- data/lib/cyberweb/toplevel_methods/filename.rb +3 -1
- data/lib/cyberweb/toplevel_methods/frames.rb +0 -2
- data/lib/cyberweb/toplevel_methods/google.rb +52 -0
- data/lib/cyberweb/{html_codes → toplevel_methods}/greek_letters.rb +22 -1
- data/lib/cyberweb/toplevel_methods/hardware_information.rb +2 -1
- data/lib/cyberweb/{help → toplevel_methods}/help.rb +3 -2
- data/lib/cyberweb/toplevel_methods/html_comment.rb +2 -2
- data/lib/cyberweb/toplevel_methods/html_tables.rb +401 -266
- data/lib/cyberweb/toplevel_methods/internal_hash.rb +173 -0
- data/lib/cyberweb/{io → toplevel_methods}/io.rb +1 -1
- data/lib/cyberweb/toplevel_methods/javascript.rb +42 -0
- data/lib/cyberweb/toplevel_methods/jquery.rb +8 -0
- data/lib/cyberweb/toplevel_methods/last_modified.rb +4 -0
- data/lib/cyberweb/toplevel_methods/links.rb +23 -7
- data/lib/cyberweb/toplevel_methods/listing.rb +2 -1
- data/lib/cyberweb/toplevel_methods/localhost.rb +3 -0
- data/lib/cyberweb/toplevel_methods/markdown.rb +3 -2
- data/lib/cyberweb/toplevel_methods/mathml.rb +5 -3
- data/lib/cyberweb/toplevel_methods/message_boxes.rb +6 -2
- data/lib/cyberweb/toplevel_methods/misc.rb +531 -79
- data/lib/cyberweb/toplevel_methods/padlem_and_marlem.rb +3 -0
- data/lib/cyberweb/toplevel_methods/path.rb +6 -1
- data/lib/cyberweb/toplevel_methods/pdf.rb +1 -1
- data/lib/cyberweb/toplevel_methods/process_content.rb +4 -7
- data/lib/cyberweb/toplevel_methods/progress.rb +6 -2
- data/lib/cyberweb/toplevel_methods/quote.rb +7 -1
- data/lib/cyberweb/toplevel_methods/random.rb +4 -1
- data/lib/cyberweb/toplevel_methods/rds.rb +14 -6
- data/lib/cyberweb/toplevel_methods/read_and_display.rb +3 -2
- data/lib/cyberweb/toplevel_methods/return_head_start.rb +1 -1
- data/lib/cyberweb/toplevel_methods/return_html_fin.rb +6 -3
- data/lib/cyberweb/toplevel_methods/return_html_header.rb +8 -3
- data/lib/cyberweb/toplevel_methods/return_html_start.rb +7 -2
- data/lib/cyberweb/toplevel_methods/return_meta_collection.rb +15 -4
- data/lib/cyberweb/toplevel_methods/return_pwd.rb +4 -0
- data/lib/cyberweb/toplevel_methods/return_strict_doctype.rb +8 -7
- data/lib/cyberweb/toplevel_methods/roebe.rb +6 -0
- data/lib/cyberweb/toplevel_methods/s2.rb +3 -1
- data/lib/cyberweb/toplevel_methods/sanitize_url.rb +7 -5
- data/lib/cyberweb/toplevel_methods/sbr.rb +7 -7
- data/lib/cyberweb/toplevel_methods/server_base_directory.rb +7 -3
- data/lib/cyberweb/toplevel_methods/show_and_display.rb +15 -15
- data/lib/cyberweb/toplevel_methods/show_configuration.rb +2 -2
- data/lib/cyberweb/toplevel_methods/spacer.rb +5 -2
- data/lib/cyberweb/toplevel_methods/svg.rb +62 -4
- data/lib/cyberweb/toplevel_methods/tag.rb +8 -2
- data/lib/cyberweb/toplevel_methods/temp_directory.rb +2 -2
- data/lib/cyberweb/toplevel_methods/textile.rb +2 -2
- data/lib/cyberweb/toplevel_methods/title.rb +14 -2
- data/lib/cyberweb/toplevel_methods/video.rb +3 -4
- data/lib/cyberweb/toplevel_methods/write_what_into.rb +2 -0
- data/lib/cyberweb/utility_scripts/README.md +3 -4
- data/lib/cyberweb/utility_scripts/autogenerate_drop_shadow_rules/autogenerate_drop_shadow_rules.rb +71 -0
- data/lib/cyberweb/utility_scripts/create_standalone_html_page.rb +223 -0
- data/lib/cyberweb/utility_scripts/download_all_images_from_this_website.rb +143 -0
- data/lib/cyberweb/utility_scripts/download_balloon_css.rb +1 -1
- data/lib/cyberweb/utility_scripts/fix_incorrect_links_to_locally_existing_images_in_this_file.rb +142 -0
- data/lib/cyberweb/utility_scripts/html_to_cyberweb_converter.rb +235 -0
- data/lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb +878 -0
- data/lib/cyberweb/utility_scripts/images_to_html/misc.rb +62 -0
- data/lib/cyberweb/utility_scripts/new_tags.rb +105 -0
- data/lib/cyberweb/utility_scripts/simple_index/README.md +9 -0
- data/lib/cyberweb/utility_scripts/simple_index/simple_index.rb +149 -0
- data/lib/cyberweb/version/version.rb +2 -2
- data/lib/cyberweb/vue/README.md +2 -0
- data/lib/cyberweb/vue/vue.rb +91 -0
- data/lib/cyberweb/web_images/array_listing_all_project_images.rb +1 -1
- data/lib/cyberweb/web_images/map_symbol_to_image_location.rb +60 -4
- data/lib/cyberweb/web_images/web_images.rb +37 -20
- data/lib/cyberweb/{constants/array_images.rb → web_object/display_output_and_report.rb} +11 -10
- data/lib/cyberweb/web_object/english.rb +55 -0
- data/lib/cyberweb/web_object/favicon.rb +103 -22
- data/lib/cyberweb/web_object/html_tags.rb +1433 -0
- data/lib/cyberweb/web_object/images.rb +428 -398
- data/lib/cyberweb/web_object/{javascript.rb → javascript_and_jquery.rb} +174 -276
- data/lib/cyberweb/web_object/{links.rb → link.rb} +185 -83
- data/lib/cyberweb/web_object/misc.rb +3934 -3928
- data/lib/cyberweb/web_object/reset.rb +153 -67
- data/lib/cyberweb/web_object/run.rb +1 -1
- data/lib/cyberweb/web_object/web_object.rb +3690 -49
- data/lib/cyberweb/web_scraper/scrape_this_url.rb +4 -2
- data/lib/cyberweb/webmin/biology_server.cgi +14 -15
- data/lib/cyberweb/webmin/calculator.cgi +2 -2
- data/lib/cyberweb/webmin/colour_chart.cgi +4 -5
- data/lib/cyberweb/webmin/comments.cgi +8 -7
- data/lib/cyberweb/webmin/comments_data +0 -0
- data/lib/cyberweb/webmin/constants.rb +1 -2
- data/lib/cyberweb/webmin/dictionary.cgi +3 -4
- data/lib/cyberweb/webmin/sys_info.cgi +1 -2
- data/lib/cyberweb/webmin/webforum.cgi +1 -2
- data/lib/cyberweb/webmin/webmin.cgi +2 -3
- data/lib/cyberweb/yaml/autogenerated_system_settings.yml +10 -10
- data/lib/cyberweb/yaml/custom_tags.yml +1 -1
- data/lib/cyberweb/yaml/html5_global_attributes.yml +5 -1
- data/lib/cyberweb/yaml/html_tag_legend.yml +2 -0
- data/lib/cyberweb/yaml/http_status_codes.yml +4 -1
- data/lib/cyberweb/yaml/load_these_yaml_files_by_default.yml +29 -0
- data/lib/cyberweb/yaml/project_configuration.yml +42 -31
- data/lib/cyberweb/yaml/video_attributes.yml +2 -0
- data/lib/cyberweb/yaml/web_images.yml +1 -1
- data/test/REST/simple.rb +7 -0
- data/test/complex_tests/simple_sinatra_example_using_cyberweb/simple.rb +1 -1
- data/test/complex_tests/sinatra_or_cyberweb/sinatra_or_cyberweb.cgi +1 -1
- data/test/complex_tests/sinatra_or_cyberweb/sinatra_or_cyberweb.rb +4 -4
- data/test/complex_tests/sinatra_or_cyberweb/sinatra_or_cyberweb.sinatra +1 -2
- data/test/complex_tests/testing_frames.cgi +3 -5
- data/test/complex_tests/testing_objectified_html_tags/testing_objectified_html_tags.html +28 -0
- data/test/complex_tests/testing_objectified_html_tags/testing_objectified_html_tags.rb +175 -0
- data/test/complex_tests/testing_style_variants/show_coloured_boxes.cgi +11 -7
- data/test/complex_tests/testing_tables.cgi +3 -3
- data/test/complex_tests/testing_the_cyberweb_shell.rb +2 -0
- data/test/complex_tests/testing_web_object.rb +5 -2
- data/test/css/README.md +4 -3
- data/test/css/return_the_content_of_these_css_classes.rb +5 -1
- data/test/css/test_hover_css/test_hover_css.cgi +59 -0
- data/test/css/test_ordered_list/test_ordered_list.cgi +31 -0
- data/test/css/testing_css_effects.cgi +3 -4
- data/test/css/testing_css_masking.cgi +3 -4
- data/test/hello_world/hello_world.cgi +6 -4
- data/test/html_template/html_template.rb +15 -0
- data/test/javascript/testing_custom_functions.js +24 -0
- data/test/javascript/testing_drag_and_drop_support.cgi +1 -1
- data/test/javascript/testing_on_click_change_opacity.cgi +4 -5
- data/test/javascript/testing_snowflakes.cgi +2 -2
- data/test/simple_tests/ad-hoc-test.cgi +5 -2
- data/test/simple_tests/cgi/hello_world_with_cyberweb.cgi +14 -0
- data/test/simple_tests/commandline_tests.rb +21 -15
- data/test/simple_tests/display_this_file.cgi +2 -2
- data/test/simple_tests/simple_html_example.cgi +2 -1
- data/test/simple_tests/simple_html_test_page/simple_html_test_page.html +20 -0
- data/test/simple_tests/simple_status_page.cgi +2 -2
- data/test/simple_tests/string_s2_test.rb +5 -0
- data/test/simple_tests/test_simple_string_as_input.rb +3 -1
- data/test/simple_tests/testing_base64_images.cgi +3 -4
- data/test/simple_tests/testing_checkboxes.cgi +22 -0
- data/test/simple_tests/testing_dragging_an_image.cgi +5 -6
- data/test/simple_tests/testing_editable_text.cgi +2 -3
- data/test/simple_tests/testing_email.cgi +6 -7
- data/test/simple_tests/testing_embedding_a_pdf_file.cgi +5 -5
- data/test/simple_tests/testing_google_charts.cgi +3 -3
- data/test/simple_tests/testing_html_forms.cgi +3 -3
- data/test/simple_tests/testing_html_template.rb +2 -0
- data/test/simple_tests/testing_popup_div.cgi +2 -3
- data/test/simple_tests/testing_return_dataset_without_any_comments.rb +3 -1
- data/test/simple_tests/testing_the_cap_box.cgi +3 -4
- data/test/simple_tests/testing_the_div_tag.cgi +3 -4
- data/test/simple_tests/testing_the_headers_tag.cgi +3 -4
- data/test/simple_tests/testing_the_html_colours.cgi +2 -3
- data/test/simple_tests/testing_the_info_box.cgi +2 -3
- data/test/simple_tests/testing_the_li_tag.cgi +2 -1
- data/test/simple_tests/testing_the_s2_method.rb +6 -1
- data/test/simple_tests/testing_the_select_tag.cgi +16 -8
- data/test/simple_tests/testing_the_span_tag.cgi +2 -3
- data/test/simple_tests/testing_web_images.rb +4 -2
- data/test/testing_html_tags/button_example.cgi +6 -7
- metadata +345 -151
- data/doc/CONVENTIONS.md +0 -7
- data/doc/CYBERWEB_TUTORIAL.cgi +0 -43
- data/doc/FUTURE_DESIGN_GOAL_CONSIDERATIONS.md +0 -13
- data/doc/todo/TODO_FOR_THE_CYBERWEB_PROJECT.md +0 -1089
- data/examples/css/shadow_example_in_CSS.cgi +0 -30
- data/lib/cyberweb/charts/README.md +0 -2
- data/lib/cyberweb/charts/google_charts.rb +0 -51
- data/lib/cyberweb/colours/random_colour.rb +0 -28
- data/lib/cyberweb/colours/sanitize_for_colours.rb +0 -95
- data/lib/cyberweb/constants/array_local_css_files.rb +0 -35
- data/lib/cyberweb/constants/configuration_file.rb +0 -33
- data/lib/cyberweb/constants/http_status_codes.rb +0 -42
- data/lib/cyberweb/constants/project_constants.rb +0 -99
- data/lib/cyberweb/constants/standalone_constants.rb +0 -309
- data/lib/cyberweb/csv/README.md +0 -2
- data/lib/cyberweb/generator/webpage_for_images.rb +0 -553
- data/lib/cyberweb/html_codes/README.md +0 -15
- data/lib/cyberweb/images/real/README.md +0 -6
- data/lib/cyberweb/io/README.md +0 -1
- data/lib/cyberweb/javascript/scroll.rb +0 -17
- data/lib/cyberweb/objectified_html_tags/README.md +0 -8
- data/lib/cyberweb/objectified_html_tags/base.rb +0 -376
- data/lib/cyberweb/predefined_and_freeform_methods/hash_css_class_to_use.rb +0 -55
- data/lib/cyberweb/requires/require_charts.rb +0 -20
- data/lib/cyberweb/web_object/css.rb +0 -627
- data/lib/cyberweb/web_object/evaluate.rb +0 -126
- data/lib/cyberweb/web_object/html_related_tags.rb +0 -320
- data/lib/cyberweb/web_object/initialize.rb +0 -51
- data/lib/cyberweb/web_object/input_related_functionality.rb +0 -414
- data/lib/cyberweb/web_object/languages.rb +0 -172
- data/lib/cyberweb/web_object/params.rb +0 -289
- data/lib/cyberweb/web_object/sinatra_related_functionality.rb +0 -30
- data/lib/cyberweb/web_object/sitemap.rb +0 -176
- data/lib/cyberweb/web_object/table.rb +0 -378
- data/test/complex_tests/testing_objectified_html_tags.rb +0 -82
- data/test/javascript/testing_cheerleader_javascript.cgi +0 -0
data/doc/README.gen
CHANGED
@@ -1,48 +1,51 @@
|
|
1
1
|
ADD_GOBOLINUX_AND_RUBY_HEADER
|
2
2
|
ADD_TIME_STAMP
|
3
3
|
|
4
|
-
<img src="https://i.imgur.com/
|
5
|
-
<img src="http://shevy.bplaced.net/cyberweb_theme.png" style="margin-left: 0.5em">
|
4
|
+
<img src="https://i.imgur.com/aNpDmmz.png" style="margin-left: 1.2em">
|
6
5
|
|
7
|
-
## The History of the Cyberweb project
|
6
|
+
## The (slightly convoluted) History of the Cyberweb project
|
8
7
|
|
9
|
-
|
10
|
-
2004 or so, give or take.
|
11
|
-
at old notes, it was more likely started in early 2004.)
|
8
|
+
The cyberweb project was created a very long time ago, written in PHP, in the
|
9
|
+
year **2004** or so, give or take.
|
12
10
|
|
13
|
-
I was
|
14
|
-
back then
|
11
|
+
I was combining **custom functions** to control how to serve web-related
|
12
|
+
content back then.
|
15
13
|
|
16
|
-
The original **class WebObject**, for
|
17
|
-
ago, perhaps in the year **2004** or
|
18
|
-
|
19
|
-
|
14
|
+
The original **class WebObject**, for instance, was written a very long time
|
15
|
+
ago, perhaps in the year **2004** already or early **2005** - something like
|
16
|
+
that, in PHP. When I eventually abandoned PHP I rewrote the parts I was
|
17
|
+
using in PHP in ruby. The functionality that was initially part of cyberweb
|
18
|
+
thus originated from a **legacy use case**. The original use case for
|
19
|
+
**class WebObject** was to describe a web-object, similar to a .html
|
20
|
+
file, but dynamic and adaptable in nature. A **.html page** can be
|
21
|
+
generated from an instance of class WebObject, for instance.
|
20
22
|
|
21
|
-
The Cyberweb-project was rewritten several times
|
22
|
-
|
23
|
-
core methods, though,
|
24
|
-
was using div() in PHP already, and I am using div() in
|
23
|
+
The Cyberweb-project was rewritten several times over the next ~15 years
|
24
|
+
or so. Today it is not quite so similar to the old code base in PHP
|
25
|
+
anymore. The important core methods, though, are still somewhat similar.
|
26
|
+
For example, I was using div() in PHP already, and I am using div() in
|
27
|
+
ruby too.
|
25
28
|
|
26
|
-
Ruby allows for more functionality out of the box, though, so I
|
27
|
-
|
29
|
+
Ruby allows for more functionality out of the box, though, so I can do
|
30
|
+
the following:
|
28
31
|
|
29
32
|
div {
|
30
33
|
}
|
31
34
|
|
32
|
-
In PHP this is not easily possible,
|
33
|
-
more
|
35
|
+
In PHP this is not easily possible, because the syntax is more rigid,
|
36
|
+
so ruby is better in this regard - more flexibility in this regard.
|
34
37
|
|
35
|
-
During that transition phase
|
38
|
+
During that **transition phase**, from **php** to **ruby**, the project
|
36
39
|
was renamed several times - first to **web_foundation**, then to
|
37
40
|
**cybersprawl**, then to **Cyberweb**, then to **web_object** and
|
38
41
|
then back to **Cyberweb** again. I think the name **Cyberweb**
|
39
42
|
is best among these alternatives. While **web_object** is the
|
40
43
|
more technically correct and accurate term, as everything related
|
41
|
-
to the www is handled via that object, I prefer the
|
42
|
-
**Cyberweb** in general for the whole project - it sounds
|
43
|
-
futuristic. The name **WebObject** is a good name too,
|
44
|
-
as we attempt to describe a particular "web-page" as a
|
45
|
-
"web-object", basically.
|
44
|
+
to the www is handled via that object (or such objects), I prefer the
|
45
|
+
name **Cyberweb** in general for the whole project - it sounds
|
46
|
+
rather futuristic. The name **WebObject** is a good name too,
|
47
|
+
though, as we attempt to describe a particular "web-page" as a
|
48
|
+
"web-object", with specific functionality, basically.
|
46
49
|
|
47
50
|
**class WebObject** was originally the very main class I was
|
48
51
|
using in PHP to describe my local knowledge base, an "app" where
|
@@ -65,27 +68,31 @@ The original <b>Cyberweb project</b> was "officially" started on
|
|
65
68
|
**13.06.2012** (13th June in the year 2012) - that is, the name
|
66
69
|
was first used in the year **2012**. In 2020 it came to an end
|
67
70
|
and was replaced with the <b>WebObject</b> project, but in May
|
68
|
-
2021 the original name was
|
71
|
+
2021 the original name was reinstated. Messy history for the
|
72
|
+
win! \o/
|
69
73
|
|
70
74
|
The project called <b>html_tags</b> was created at about the same
|
71
75
|
time back then, in the year **2012**, in order to keep the code
|
72
76
|
base of the newly generated project somewhat cleaner and smaller.
|
73
|
-
**WebFoundation** was thus renamed to Cyberweb
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
77
|
+
**WebFoundation** was thus renamed to Cyberweb - the original
|
78
|
+
directory that kept the code there was put under the directory
|
79
|
+
called **foundation/**. Old gem releases of **cyberweb**
|
80
|
+
may still show that, back when I kept these old releases
|
81
|
+
on rubygems.org.
|
82
|
+
|
83
|
+
In **August 2018**, the **foundation/** subdirectory was removed
|
84
|
+
and the code residing therein put into other parts of the project
|
85
|
+
instead.
|
79
86
|
|
80
87
|
The transition phase in **2012** happened to some extent because
|
81
88
|
I was still using ruby 1.8.x and had to make several changes to
|
82
89
|
the old web-foundation project, in order to have my code work on
|
83
90
|
**ruby 1.9.3** anyway.
|
84
91
|
|
85
|
-
The rewrite would allow me to change some design decisions I made
|
86
|
-
on, which were not that ideal - in other words, to allow me to
|
87
|
-
some of the old code at the same time (which again happened in
|
88
|
-
when I cleaned up the cyberweb project, after many years of
|
92
|
+
The **rewrite*+ would allow me to change some design decisions I made
|
93
|
+
earlier on, which were not that ideal - in other words, to allow me to
|
94
|
+
discard some of the old code at the same time (which again happened in
|
95
|
+
2018, when I cleaned up the cyberweb project, after many years of
|
89
96
|
"semi-activity" only).
|
90
97
|
|
91
98
|
The **rewrite** step worked for the most part, even though it took me
|
@@ -122,6 +129,15 @@ moments in time or may still exist:
|
|
122
129
|
This may not be hugely important to know, but it explains a bit of
|
123
130
|
the historic origin for the cyberweb project.
|
124
131
|
|
132
|
+
## Cyberweb.localhost?
|
133
|
+
|
134
|
+
Cyberweb.localhost? will simply return the String 'http://localhost'.
|
135
|
+
|
136
|
+
This is only useful if you want to quickly test something on your
|
137
|
+
own localhost (local webserver). I had to build "local" URLs and
|
138
|
+
did not want to preface manually via 'http://', so it was easier
|
139
|
+
to use a simpler method instead.
|
140
|
+
|
125
141
|
## Aim, Goals and Scope of the Cyberweb project
|
126
142
|
|
127
143
|
This subsection will detail some of the goals of the Cyberweb project.
|
@@ -227,16 +243,24 @@ or not.
|
|
227
243
|
|
228
244
|
The method **Cyberweb.set_path_to_images()** can be used to set the
|
229
245
|
path to a global image directory, that is - a directory that holds all
|
230
|
-
images. On my home system this defaults to **/home/x/data/images
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
246
|
+
images. On my home system this defaults to **/home/x/data/images/**,
|
247
|
+
so if you find any references to that directory in any of my projects
|
248
|
+
then this is the reason as to why, since it is the default on my
|
249
|
+
home setup.
|
250
|
+
|
251
|
+
I put almost all images into this directory as-is, but there are
|
252
|
+
a few exceptions to this as well. The important thing is that the
|
253
|
+
cyberweb project has to **remain flexible**.
|
254
|
+
|
255
|
+
Note that this directory will only be of relevance **if** the configuration
|
256
|
+
options for the cyberweb project were set up to use such a directory in
|
257
|
+
the first place. Only **image-related methods** are affected by this
|
238
258
|
setting anyway.
|
239
259
|
|
260
|
+
Note that **Cyberweb.set_path()** is a shorter alias to this method;
|
261
|
+
may be useful in IRB. Otherwise I recommend to use the longer
|
262
|
+
method name instead, as it is more explicit.
|
263
|
+
|
240
264
|
## Images
|
241
265
|
|
242
266
|
If an image is not existing, but used within the Cyberweb
|
@@ -256,20 +280,6 @@ display the above notification for images not found. If it is set
|
|
256
280
|
to normal or lower than that, the web_object project will not
|
257
281
|
display that warning.
|
258
282
|
|
259
|
-
## Balloon.css
|
260
|
-
|
261
|
-
You can download the **balloon.css** file via class
|
262
|
-
**DownloadBalloonCss** (**Cyberweb::DownloadBalloonCss**).
|
263
|
-
|
264
|
-
This file resides at the location
|
265
|
-
<b>web_object/utility_scripts/download_balloon_css.rb</b>.
|
266
|
-
|
267
|
-
It presently (May 2018) does not do much other than download
|
268
|
-
that remote .css file.
|
269
|
-
|
270
|
-
I needed a small "pop-up" for displaying additional information
|
271
|
-
to some entries in a table, which is how I found **Balloon.css**.
|
272
|
-
|
273
283
|
## Proper (default) order of arguments to many methods in the Cyberweb project
|
274
284
|
|
275
285
|
The Cyberweb project uses quite a few methods that have more than 4
|
@@ -414,7 +424,7 @@ called **vim**).
|
|
414
424
|
You can also query the current configuration via appending **config?**
|
415
425
|
such as in:
|
416
426
|
|
417
|
-
http://localhost/
|
427
|
+
http://localhost/data/personal/sitemap.cgi?config?
|
418
428
|
|
419
429
|
## HTML Tables and the Cyberweb project
|
420
430
|
|
@@ -495,16 +505,6 @@ a later time back to **cyberweb** - yup, I change
|
|
495
505
|
the project names way too quickly. But the name used to
|
496
506
|
by cyberweb in the past, so I am slowly getting used to
|
497
507
|
that name.
|
498
|
-
|
499
|
-
## Creating input-buttons in a HTML-form field
|
500
|
-
|
501
|
-
<form>
|
502
|
-
<input type="button" class="BG_GRAYSTD bblack1" value="Default" name="foo" onClick="test1(this.form)">
|
503
|
-
</form>
|
504
|
-
|
505
|
-
<form>
|
506
|
-
<input class="BG_GRAYSTD bblack1" type="button" value="Default" name="foo" onClick="test1(this.form)">
|
507
|
-
</form>
|
508
508
|
|
509
509
|
## HTML Entities
|
510
510
|
|
@@ -560,41 +560,31 @@ At least the name of the image directory.
|
|
560
560
|
|
561
561
|
## Viewing the source of a webpage
|
562
562
|
|
563
|
-
Use the view_source() method to add a javascript button,
|
563
|
+
Use the **view_source()** method to add a javascript button,
|
564
564
|
to view the source of a page. The method view_source()
|
565
|
-
is defined in the file
|
565
|
+
is defined in the file
|
566
|
+
**cyberweb/web_object/misc.rb:**.
|
566
567
|
|
567
|
-
|
568
|
+
You can, of course, combine this with other code elements. For
|
569
|
+
instance, if you want to embed the view-source button into
|
570
|
+
a div, and style it, then consider the following:
|
568
571
|
|
569
|
-
|
572
|
+
div('BG_Black white','div_view_source') { view_source }
|
570
573
|
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
All HTML ids are registered into an array. To then show whether
|
576
|
-
you have duplicated IDs in a page, do this:
|
577
|
-
|
578
|
-
show_duplicated_ids()
|
579
|
-
|
580
|
-
Or in a more general way, use the #debug method, like so:
|
581
|
-
|
582
|
-
w.debug
|
583
|
-
|
584
|
-
This will report whether you have a duplicated ID or not.
|
585
|
-
When the page is served, we will also display a little error
|
586
|
-
message in case we have found duplicated IDs. This way we
|
587
|
-
can notify the developer that there is some mistake in his
|
588
|
-
page and we can correct this mistake then.
|
574
|
+
This will create a div-tag with black background and white
|
575
|
+
font colour, and the id of that div will be **div_view_source**.
|
576
|
+
Inside that div-tag the view-source button can be found.
|
589
577
|
|
590
578
|
## The table-tag
|
591
579
|
|
592
|
-
The tag
|
593
|
-
|
580
|
+
The tag that is generated via table() will create a HTML
|
581
|
+
table. It also supports blocks. That means you can use
|
582
|
+
arrays in tables as input, such as shown in the following
|
583
|
+
example:
|
594
584
|
|
595
585
|
table { %w( one two three for ) }
|
596
586
|
|
597
|
-
Or styled with CSS:
|
587
|
+
Or, styled with CSS:
|
598
588
|
|
599
589
|
table('s1em bblack1') { %w(one two three for) }
|
600
590
|
|
@@ -778,7 +768,7 @@ to another page.
|
|
778
768
|
|
779
769
|
Example:
|
780
770
|
|
781
|
-
http://localhost/
|
771
|
+
http://localhost/data/misc/sitemap.cgi?redirect_to=ruby_todo
|
782
772
|
|
783
773
|
This would redirect me to my local todo-file in ruby. In fact:
|
784
774
|
that was the primary reason why the code was added, so that I
|
@@ -789,14 +779,23 @@ run this may have to be modified - but for now it will remain
|
|
789
779
|
as it is. It can be used to quickly "jump" to another page,
|
790
780
|
both a local page or a remote page.
|
791
781
|
|
782
|
+
If you want to do so via the meta-tag, consider using the
|
783
|
+
following method:
|
784
|
+
|
785
|
+
Cyberweb.return_meta_redirect 'foobar.de'
|
786
|
+
|
787
|
+
This would yield the following string:
|
788
|
+
|
789
|
+
<meta http-equiv="Refresh" content="1; URL="foobar.de">
|
790
|
+
|
792
791
|
## Viewing the content of any file
|
793
792
|
|
794
793
|
You can view the content of any file via:
|
795
794
|
|
796
|
-
http://localhost/
|
795
|
+
http://localhost/data/personal/sitemap/sitemap.cgi?view_file=ruby_todo
|
797
796
|
|
798
|
-
This can be disabled since as of
|
799
|
-
|
797
|
+
This can be disabled since as of <b>May 2021</b>, by setting the
|
798
|
+
<b>view_file: true</b> in the project configuration .yml file.
|
800
799
|
I recommend to do so, as you probably don't need this
|
801
800
|
functionality. I needed it for my local webserver, to
|
802
801
|
quickly test things, and view local files in the browser,
|
@@ -806,17 +805,31 @@ only).
|
|
806
805
|
|
807
806
|
## dropdown()
|
808
807
|
|
809
|
-
You can use the dropdown() method to use several <select>
|
810
|
-
statements
|
808
|
+
You can use the **dropdown()** method to use several <select>
|
809
|
+
statements, if you use class **Cyberweb::WebObject**.
|
811
810
|
|
812
|
-
|
811
|
+
Specific usage examples:
|
813
812
|
|
814
813
|
dropdown( %w( a b c ) )
|
815
814
|
dropdown( %w( a b c ) ) {{ selected: 2 }}
|
816
815
|
dropdown( %w( a b c ) ) {{ selected: 3 }}
|
817
816
|
|
818
|
-
The
|
819
|
-
|
817
|
+
The **middle variant** will have the second entry selected as default;
|
818
|
+
the **last variant** will have the third entry selected as default.
|
819
|
+
|
820
|
+
Note that for the purpose of dropdown() we will begin to count
|
821
|
+
at 1 rather than 0. So 1 refers to **the first entry**. Furthermore
|
822
|
+
if the number given to **selected:** is too high then it will be
|
823
|
+
automatically reduced to the last entry of that Array - this should
|
824
|
+
simplify using the method a little bit.
|
825
|
+
|
826
|
+
For a working example of the method have a look at the file
|
827
|
+
**testing_the_select_tag.cgi**.
|
828
|
+
|
829
|
+
Here is also a small screenshot with a bit of CSS styling to
|
830
|
+
show how this looks:
|
831
|
+
|
832
|
+
<img src="https://i.imgur.com/Lqk6rKo.png" style="margin-left: 2em">
|
820
833
|
|
821
834
|
## Cyberweb.display_all_files_in_this_directory
|
822
835
|
|
@@ -876,7 +889,7 @@ to style elements on a given webpage.
|
|
876
889
|
|
877
890
|
## Editable text
|
878
891
|
|
879
|
-
HTML5 allows the visitor to modify text on a webpage (although
|
892
|
+
**HTML5** allows the visitor to modify text on a webpage (although
|
880
893
|
not persistently).
|
881
894
|
|
882
895
|
The Cyberweb project also allows this. Example:
|
@@ -884,7 +897,38 @@ The Cyberweb project also allows this. Example:
|
|
884
897
|
e('Type something here.') { :editable }
|
885
898
|
|
886
899
|
This would make a span-tag, following by a br-tag,
|
887
|
-
and the attribute that this is editable.
|
900
|
+
and the attribute that this is editable. You can
|
901
|
+
select some text and then just type as-is - and
|
902
|
+
thus modify the text.
|
903
|
+
|
904
|
+
## Bold text in CSS
|
905
|
+
|
906
|
+
Normal text usually equates to a font-weight value of
|
907
|
+
<b>400</b> whereas bold text equals to a value of
|
908
|
+
<b>700</b>.
|
909
|
+
|
910
|
+
## Caret cursor in CSS
|
911
|
+
|
912
|
+
You can style the colour of the cursor that appears in an
|
913
|
+
input-field.
|
914
|
+
|
915
|
+
Example for this:
|
916
|
+
|
917
|
+
.input_field {
|
918
|
+
caret-color: tomato;
|
919
|
+
font-weight: bold;
|
920
|
+
font-size: 30px;
|
921
|
+
}
|
922
|
+
|
923
|
+
If you need a specific example, have a look at the following file:
|
924
|
+
|
925
|
+
**cyberweb/examples/css/caret_colour_example.html**
|
926
|
+
|
927
|
+
This may then look like this:
|
928
|
+
|
929
|
+
<img src="https://i.imgur.com/dg0a9gd.png" style="margin-left: 2em">
|
930
|
+
|
931
|
+
The relevant part is the red cursor in the ~middle in that input field.
|
888
932
|
|
889
933
|
## CSS helper code and how it relates to the Cyberweb project
|
890
934
|
|
@@ -979,7 +1023,9 @@ hand, expands horizontally as far as there is space, which is
|
|
979
1023
|
called "expand-to-fit".
|
980
1024
|
|
981
1025
|
If you encounter a CSS rule with a <b>!important</b> classifier
|
982
|
-
then this rule can not be overruled. It became a fixed rule.
|
1026
|
+
then this rule can not be overruled. It became a fixed rule. See
|
1027
|
+
elsewhere in this document in regards to more information about
|
1028
|
+
this.
|
983
1029
|
|
984
1030
|
The hexadecimal notation #FFF is a short hand for #FFFFFF (which
|
985
1031
|
is actually white).
|
@@ -1405,12 +1451,25 @@ approach.
|
|
1405
1451
|
|
1406
1452
|
## Buttons
|
1407
1453
|
|
1454
|
+
**Buttons** are user-elements that can be **clicked**.
|
1455
|
+
|
1408
1456
|
The following should work, in principle:
|
1409
1457
|
|
1410
1458
|
button {}
|
1411
1459
|
|
1412
|
-
My long-term goal is to make this DSL
|
1413
|
-
as well as
|
1460
|
+
My long-term goal in regards to the above is to make this DSL
|
1461
|
+
work in web-applications as well as in 'traditional' toolkits,
|
1462
|
+
such as the ruby bindings to **GTK** (ruby-gtk).
|
1463
|
+
|
1464
|
+
A box-shadow effect applied to a button may yield to a
|
1465
|
+
**depth effect** for that button.
|
1466
|
+
|
1467
|
+
An example for this follows:
|
1468
|
+
|
1469
|
+
box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
|
1470
|
+
|
1471
|
+
See also the file at **cyberweb/examples/html/buttons_example.html**
|
1472
|
+
to see differently styled buttons in action.
|
1414
1473
|
|
1415
1474
|
## How to vertically align any element via CSS
|
1416
1475
|
|
@@ -1480,10 +1539,11 @@ This example shows how, in the main frame:
|
|
1480
1539
|
|
1481
1540
|
## Working with Grids in HTML/CSS
|
1482
1541
|
|
1483
|
-
You can add padding between the grid containers using grid padding
|
1484
|
-
row-gap and column-gap.
|
1542
|
+
You can add **padding** between the grid containers using grid padding
|
1543
|
+
or row-gap and column-gap. This is a general CSS feature implemented
|
1544
|
+
for Grids specifically.
|
1485
1545
|
|
1486
|
-
Examples:
|
1546
|
+
Examples for that, in particular the two last lines:
|
1487
1547
|
|
1488
1548
|
gap
|
1489
1549
|
row-gap
|
@@ -1620,16 +1680,6 @@ then simply modify these classes in your web-page. Right
|
|
1620
1680
|
now this is not trivial if you re-use the distributed .css
|
1621
1681
|
files; at another moment in time the API may be changed to
|
1622
1682
|
allow you to re-define the CSS class as-is.
|
1623
|
-
|
1624
|
-
## Input fields with a different background colour
|
1625
|
-
|
1626
|
-
You can use input fields with a different background colour upon
|
1627
|
-
a mouse-focus event.
|
1628
|
-
|
1629
|
-
Examples for this would be:
|
1630
|
-
|
1631
|
-
input :text, 'Hello world!', :focus_with_salmon_background
|
1632
|
-
input :text, 'Hello World!', :focus_with_salmon_background, :select_on_click
|
1633
1683
|
|
1634
1684
|
## Editing content on a webpage
|
1635
1685
|
|
@@ -1686,6 +1736,20 @@ To use a specific CSS style for these listings, do something like:
|
|
1686
1736
|
|
1687
1737
|
Cyberweb.listing_css = '<b class="red">'
|
1688
1738
|
|
1739
|
+
You can also make use of ordered lists, via:
|
1740
|
+
|
1741
|
+
ordered_list %w( cat dog parrot deer horse )
|
1742
|
+
|
1743
|
+
This would yield exactly this String (if you use Cyberweb::WebObject):
|
1744
|
+
|
1745
|
+
<ol>
|
1746
|
+
<li>cat</li>
|
1747
|
+
<li>dog</li>
|
1748
|
+
<li>parrot</li>
|
1749
|
+
<li>deer</li>
|
1750
|
+
<li>horse</li>
|
1751
|
+
</ol>
|
1752
|
+
|
1689
1753
|
## Link in pages via link()
|
1690
1754
|
|
1691
1755
|
You can link in other pages via the method link().
|
@@ -1798,76 +1862,6 @@ is to be able to do sinatra-specific calls that enable or
|
|
1798
1862
|
disable certain things, in particular in regards to images,
|
1799
1863
|
and have images work properly at the least on my home
|
1800
1864
|
setup.
|
1801
|
-
|
1802
|
-
## JQuery
|
1803
|
-
|
1804
|
-
The Cyberweb framework/toolset favours the use of jquery. Presently,
|
1805
|
-
since **May 2021**, the version that is to be used by default will be
|
1806
|
-
for jquery <b>3.6.0</b>. This may change at a later time.
|
1807
|
-
|
1808
|
-
In the event that it is changed and the documentation here is not
|
1809
|
-
updated, you can always rely on the following method call to yield
|
1810
|
-
the correct version of jquery to be used:
|
1811
|
-
|
1812
|
-
Cyberweb.jquery_version?
|
1813
|
-
|
1814
|
-
For example, the above method called would yield **3.6.0** in
|
1815
|
-
**May 2021**. Personally I always use the latest stable
|
1816
|
-
version of jquery.
|
1817
|
-
|
1818
|
-
You can also query the jquery-ui version in use, via:
|
1819
|
-
|
1820
|
-
Cyberweb.jquery_ui_version?
|
1821
|
-
|
1822
|
-
Again, this also has to be synced manually, via the
|
1823
|
-
.yml file called **project_configuration.yml**.
|
1824
|
-
|
1825
|
-
Since as of **May 2021**, the cyberweb will also bundle this
|
1826
|
-
corresponding version of jquery and jquery-ui into the
|
1827
|
-
**javascript_code/jquery/** subdirectory of the gem. This
|
1828
|
-
is solely done to simplify the use of jquery so that, for
|
1829
|
-
example, dragging an object becomes simpler and available
|
1830
|
-
by default, even if access to the www is unavailable at
|
1831
|
-
the current time.
|
1832
|
-
|
1833
|
-
You can also call this method on a **Cyberweb::WebObject**
|
1834
|
-
instance via the following method:
|
1835
|
-
|
1836
|
-
report_the_jquery_version_in_use
|
1837
|
-
|
1838
|
-
Both jquery-ui and jquery use the same licence as the Cyberweb
|
1839
|
-
project (MIT licence). See also this wikipedia entry if
|
1840
|
-
you want to read more about jquery and its history:
|
1841
|
-
|
1842
|
-
https://en.wikipedia.org/wiki/JQuery
|
1843
|
-
|
1844
|
-
To make a container **resizable** via the mouse, by using
|
1845
|
-
jquery, try this method:
|
1846
|
-
|
1847
|
-
jquery_resizable_via_the_mouse(id: :resizable_via_the_mouse)
|
1848
|
-
|
1849
|
-
As **id** you simply pass in the id of the HTML element at hand.
|
1850
|
-
In this case, the symbol called :resizable_via_the_mouse.
|
1851
|
-
|
1852
|
-
See also the file **JQUERY.md** for a more thorough reference.
|
1853
|
-
|
1854
|
-
Note that in **May 2021**, support for jquery is actually mildly
|
1855
|
-
deprecated. This is not set in stone and it does not mean that
|
1856
|
-
jquery support will be removed, as far as the cyberweb project
|
1857
|
-
is concerned; it is more that I want to see whether we have
|
1858
|
-
better or simpler alternatives, without being tied into jquery
|
1859
|
-
too closely.
|
1860
|
-
|
1861
|
-
The basic syntax for jquery, in javascript, goes like this:
|
1862
|
-
|
1863
|
-
$(selector).action()
|
1864
|
-
|
1865
|
-
The general rules for JQuery go along these lines, in JavaScript:
|
1866
|
-
|
1867
|
-
$(this).hide() # hides the current element.
|
1868
|
-
$("p").hide() # hides all <p> elements.
|
1869
|
-
$(".test").hide() # hides all elements with class="test".
|
1870
|
-
$("#test").hide() # hides the element with id="test".
|
1871
1865
|
|
1872
1866
|
## draggable_image() and the HTML draggable attribute
|
1873
1867
|
|
@@ -1894,11 +1888,23 @@ within the current directory, you can try the following API:
|
|
1894
1888
|
|
1895
1889
|
in_dir_image 'foobar.png', 'marl3em bblack1'
|
1896
1890
|
|
1891
|
+
## Generate system settings
|
1892
|
+
|
1893
|
+
If you want to store the system settings in a file, you may be
|
1894
|
+
able to use this:
|
1895
|
+
|
1896
|
+
cyberweb --systemsettings
|
1897
|
+
|
1898
|
+
Normal users of cyberweb won't need this functionality. I only
|
1899
|
+
wanted to have this available as a separate instruction, to
|
1900
|
+
simplify updating the cyberweb project.
|
1901
|
+
|
1897
1902
|
## Textarea in HTML
|
1898
1903
|
|
1899
|
-
You can make a textarea HTML tag readonly via readonly
|
1904
|
+
You can make a textarea HTML tag readonly via **readonly**,
|
1905
|
+
as an additional attribute to the textarea-tag.
|
1900
1906
|
|
1901
|
-
|
1907
|
+
Specific example for this:
|
1902
1908
|
|
1903
1909
|
<textarea readonly>
|
1904
1910
|
Foobar.
|
@@ -1911,6 +1917,9 @@ as:
|
|
1911
1917
|
resize: none;
|
1912
1918
|
}
|
1913
1919
|
|
1920
|
+
The example **cyberweb/examples/html/readonly_textarea_example.html**
|
1921
|
+
demonstrates this.
|
1922
|
+
|
1914
1923
|
## CSS first-line rule
|
1915
1924
|
|
1916
1925
|
The **first-line** rule can be used to style the first line in a given
|
@@ -1927,7 +1936,18 @@ Example:
|
|
1927
1936
|
|
1928
1937
|
The first line would then appear larger and in another colour.
|
1929
1938
|
|
1930
|
-
|
1939
|
+
Another example:
|
1940
|
+
|
1941
|
+
.foobar:first-line{
|
1942
|
+
font-size: 40px;
|
1943
|
+
line-height: 50px;
|
1944
|
+
font-weight: bold;
|
1945
|
+
color: #662929;
|
1946
|
+
}
|
1947
|
+
|
1948
|
+
In some ways this is similar to using a h-tag such as h1 or h2.
|
1949
|
+
|
1950
|
+
Several properties can be modified within the <b>:first-line</b>
|
1931
1951
|
rule, such as **font properties**, **color properties**,
|
1932
1952
|
**background properties**, **word-spacing**, **letter-spacing**,
|
1933
1953
|
**text-decoration**, **vertical-align**, **text-transform**,
|
@@ -1941,56 +1961,6 @@ The three main variants are:
|
|
1941
1961
|
div.b { text-transform: lowercase; }
|
1942
1962
|
div.c { text-transform: capitalize; }
|
1943
1963
|
|
1944
|
-
## CSS, text-shadow support and drop-shadow support
|
1945
|
-
|
1946
|
-
If you want to have shadows added to a given text then the text-shadow
|
1947
|
-
CSS property may be useful. Be careful when using this, though, because
|
1948
|
-
it can make the text harder to read.
|
1949
|
-
|
1950
|
-
Let's look at an example for the h1 HTML tag:
|
1951
|
-
|
1952
|
-
h1 {text-shadow:2px 2px #FF0000;}
|
1953
|
-
|
1954
|
-
Syntax used here (and in general):
|
1955
|
-
|
1956
|
-
text-shadow: h-shadow, v-shadow, blur, color
|
1957
|
-
text-shadow: 2px 5px tomato;
|
1958
|
-
|
1959
|
-
Another example, for a CSS rule:
|
1960
|
-
|
1961
|
-
.red_text_shadow {
|
1962
|
-
text-shadow: red 0 -2px;
|
1963
|
-
}
|
1964
|
-
|
1965
|
-
Strangely enough you can also re-arrange the arguments a litte:
|
1966
|
-
|
1967
|
-
/* colour | offset-x | offset-y | blur-radius */
|
1968
|
-
text-shadow: #fc0 1px 0 10px;
|
1969
|
-
|
1970
|
-
/* offset-x | offset-y | blur-radius | colour */
|
1971
|
-
text-shadow: 1px 1px 2px black; # This is my preferred style.
|
1972
|
-
|
1973
|
-
I do not know why they went that route, but I recommend to just
|
1974
|
-
stick to one style, and avoid the other.
|
1975
|
-
|
1976
|
-
Note that text-shadow is not the only way you can use to modify
|
1977
|
-
text. drop-shadow is another example.
|
1978
|
-
|
1979
|
-
In CSS the rule would be like this:
|
1980
|
-
|
1981
|
-
drop-shadow(2px 4px 8px #585858);
|
1982
|
-
|
1983
|
-
In cyberweb, you can use this API:
|
1984
|
-
|
1985
|
-
generate_drop_shadow :red, :default, 'drop_shadow_red'
|
1986
|
-
div('drop_shadow_red') {
|
1987
|
-
h3 'This part should show a drop-shadow effect - but in red'
|
1988
|
-
}
|
1989
|
-
|
1990
|
-
This would yield the following text (shown as image):
|
1991
|
-
|
1992
|
-
<img src="https://i.imgur.com/lSDl3qt.png" style="margin-left:2em">
|
1993
|
-
|
1994
1964
|
## CSS letter-spacing property
|
1995
1965
|
|
1996
1966
|
<b>letter-spacing</b> can be used to decrease or increase the
|
@@ -2080,7 +2050,8 @@ The attribute <b>accesskey</b> is allowed in the following tags:
|
|
2080
2050
|
input
|
2081
2051
|
textarea
|
2082
2052
|
label
|
2083
|
-
legend
|
2053
|
+
legend
|
2054
|
+
button
|
2084
2055
|
|
2085
2056
|
## CSS ::before and CSS ::after
|
2086
2057
|
|
@@ -2137,9 +2108,9 @@ Example:
|
|
2137
2108
|
## CSS input autofocus
|
2138
2109
|
|
2139
2110
|
You can modify <input> elements by setting the focus onto
|
2140
|
-
them the moment a page loads
|
2111
|
+
them the moment a page loads, via **autofocus**.
|
2141
2112
|
|
2142
|
-
Example:
|
2113
|
+
Example for this:
|
2143
2114
|
|
2144
2115
|
<form action="/action_page.php">
|
2145
2116
|
<label for="fname">First name:</label>
|
@@ -2149,7 +2120,7 @@ Example:
|
|
2149
2120
|
<input type="submit">
|
2150
2121
|
</form>
|
2151
2122
|
|
2152
|
-
This is a bit similar to ruby-gtk3, e. g. .do_focus or
|
2123
|
+
This is a bit similar to ruby-gtk3, e. g. .do_focus or **.set_focus(true)**.
|
2153
2124
|
|
2154
2125
|
## CSS grouping and CSS selectors
|
2155
2126
|
|
@@ -2397,6 +2368,29 @@ The other properties may be useful in some cases, e. g. when you
|
|
2397
2368
|
wish to indicate some button-like element - but visually, I think
|
2398
2369
|
the first three styles are by far the most appealing ones.
|
2399
2370
|
|
2371
|
+
## Styling a row of a table and styling a table in general
|
2372
|
+
|
2373
|
+
You can use CSS rules such as this:
|
2374
|
+
|
2375
|
+
tr {
|
2376
|
+
background: wheat;
|
2377
|
+
}
|
2378
|
+
tr.even {
|
2379
|
+
background: none;
|
2380
|
+
}
|
2381
|
+
|
2382
|
+
This can be used to use a different colour for each even
|
2383
|
+
row. You still have to use the CSS class called **even**
|
2384
|
+
in this case manually, though. (There may be other solutions
|
2385
|
+
but for now this is simply documented here as-is - perhaps
|
2386
|
+
in the future this may become more flexible.)
|
2387
|
+
|
2388
|
+
This may look like this:
|
2389
|
+
|
2390
|
+
<img src="https://i.imgur.com/PGefpZb.png" style="margin-left: 3em">
|
2391
|
+
|
2392
|
+
See also the file at **cyberweb/examples/html/table_with_header_example.html**.
|
2393
|
+
|
2400
2394
|
## CSS first-letter
|
2401
2395
|
|
2402
2396
|
CSS allows us to modify the first-letter in, for example, a
|
@@ -2477,6 +2471,31 @@ part </script>, such as:
|
|
2477
2471
|
}
|
2478
2472
|
</script>
|
2479
2473
|
|
2474
|
+
## The CSS !important rule
|
2475
|
+
|
2476
|
+
Let's start with a syntax example.
|
2477
|
+
|
2478
|
+
Consider the following CSS rule for the **body** tag:
|
2479
|
+
|
2480
|
+
body {
|
2481
|
+
background: steelblue !important;
|
2482
|
+
}
|
2483
|
+
|
2484
|
+
This will set the background colour of the whole body of
|
2485
|
+
the page to the colour **steelblue**.
|
2486
|
+
|
2487
|
+
It is important to use that very syntax, e. g. to close
|
2488
|
+
the CSS rule at hand via **!important;**. Otherwise it
|
2489
|
+
may not work properly.
|
2490
|
+
|
2491
|
+
Once such an **!important** rule applies then it takes
|
2492
|
+
precedence over every other rule, including the
|
2493
|
+
**style** attribute. Later set **!important** rules
|
2494
|
+
can override earlier set **!important** rules, though.
|
2495
|
+
|
2496
|
+
Use this with caution, though, as it really overrides
|
2497
|
+
any other settings, including user-defined settings.
|
2498
|
+
|
2480
2499
|
## Including external .css files
|
2481
2500
|
|
2482
2501
|
The syntax for adding external (standalone) .css files is as shown in
|
@@ -2688,13 +2707,6 @@ an operator and not a function - but it seems simpler to use
|
|
2688
2707
|
the () just as it is used for other functions in JavaScript
|
2689
2708
|
as well.
|
2690
2709
|
|
2691
|
-
## Use image-checkbox (on and off)
|
2692
|
-
|
2693
|
-
Examples:
|
2694
|
-
|
2695
|
-
show_image_checkbox :on, 'posab','top:10em;right:18%'
|
2696
|
-
show_image_checkbox :off, 'posab','top:10em;right:18%'
|
2697
|
-
|
2698
2710
|
## CSS zoom-on-hover effect
|
2699
2711
|
|
2700
2712
|
This can be done like this:
|
@@ -2722,6 +2734,20 @@ I typically put this into a special CSS class such as:
|
|
2722
2734
|
transform: scale(1.1);
|
2723
2735
|
}
|
2724
2736
|
|
2737
|
+
And then, for instance, for a generate **image** tag:
|
2738
|
+
|
2739
|
+
img(:document, 'enlarge_this_image_on_hover')
|
2740
|
+
# or this example for a draggable image:
|
2741
|
+
dimg 'BOX.png', 'VAM enlarge_this_image_on_hover'
|
2742
|
+
|
2743
|
+
The small drawback (or advantage, depending on your point of view)
|
2744
|
+
is that the CSS rule has to be specified as-is.
|
2745
|
+
|
2746
|
+
In theory we could also autogenerate the CSS rule and use an
|
2747
|
+
API such as **img(:document) {{ enlarge_this_image_on_hover: '25%' }}**
|
2748
|
+
instead, but for now I'll leave it with the above CSS-based approach.
|
2749
|
+
It's quite simple really.
|
2750
|
+
|
2725
2751
|
## Valid values for CSS font-size:
|
2726
2752
|
|
2727
2753
|
xx-small
|
@@ -2734,95 +2760,16 @@ I typically put this into a special CSS class such as:
|
|
2734
2760
|
xx-large
|
2735
2761
|
larger
|
2736
2762
|
|
2737
|
-
##
|
2738
|
-
|
2739
|
-
"When you are creating a website, the primary goal as a designer
|
2740
|
-
should be to get rid of the question marks users have when
|
2741
|
-
visiting that site."
|
2763
|
+
## Cyberweb::Header
|
2742
2764
|
|
2743
|
-
|
2744
|
-
the basic principle of eliminating question marks that a user
|
2745
|
-
has when visiting a website. Keep things simple."
|
2765
|
+
Examples:
|
2746
2766
|
|
2747
|
-
|
2748
|
-
|
2767
|
+
Cyberweb::Header.size = 'h3' # Set to a smaller header.
|
2768
|
+
Cyberweb::Header.reset
|
2749
2769
|
|
2750
|
-
|
2751
|
-
|
2752
|
-
|
2753
|
-
"The average visitor rarely spends much time reading all
|
2754
|
-
content on a given web page, so focus on designing fewer
|
2755
|
-
elements that can be easily navigated, without too much
|
2756
|
-
distracting clutter."
|
2757
|
-
|
2758
|
-
"If your design forces a visitor to incur a small learning
|
2759
|
-
curve, make sure that the added value from this design
|
2760
|
-
change leads to it being worth that additional learning
|
2761
|
-
curve."
|
2762
|
-
|
2763
|
-
"Clarity trumps consistency."
|
2764
|
-
|
2765
|
-
"Each webpage should have a clear visual hierarchy."
|
2766
|
-
|
2767
|
-
"Components in a webpage that are related logically
|
2768
|
-
should also be related visually."
|
2769
|
-
|
2770
|
-
"In order to make a website 'scan-friendly', make good use of
|
2771
|
-
headings having a larger font size. The headings should
|
2772
|
-
indicate what a subsection is about."
|
2773
|
-
|
2774
|
-
"When using a heading, make them visually somewhat closer
|
2775
|
-
to the section they belong to, rather than equally spaced
|
2776
|
-
to the preceding paragraph."
|
2777
|
-
|
2778
|
-
"If you need the visitor to make a difficult choice, provide as
|
2779
|
-
much guidance as necessary - but not more. Be succinct here
|
2780
|
-
and provide only the smallest amount of information that
|
2781
|
-
will help the user."
|
2782
|
-
|
2783
|
-
"Omit needless words. Vigorous writing is concise."
|
2784
|
-
|
2785
|
-
"Try to make everything on a web-site self-explanatory or as
|
2786
|
-
close to it as possible."
|
2787
|
-
|
2788
|
-
"Navigation should ideally remain clear, simple, and consistent."
|
2789
|
-
|
2790
|
-
"It may be useful to consider using an identifier, such as a logo
|
2791
|
-
or an image, for the website, and display this e. g. on the
|
2792
|
-
upper left corner. This may help visitors identify where they
|
2793
|
-
are, in particular if they tend to use several tabs in their
|
2794
|
-
browser."
|
2795
|
-
|
2796
|
-
"If your website makes use of a menu-bar or navigation-bar,
|
2797
|
-
consider highlighting the current location that the user
|
2798
|
-
has or uses on that website."
|
2799
|
-
|
2800
|
-
"Ideally a website should convey the big picture, and make it
|
2801
|
-
clear what the site is about."
|
2802
|
-
|
2803
|
-
"If possible consider to use visual identifiers on the
|
2804
|
-
whole web-application at hand, to give visitors the
|
2805
|
-
right idea about this being a cohesive and integrated
|
2806
|
-
unit."
|
2807
|
-
|
2808
|
-
"Changing a website at a later time is not necessarily trivial.
|
2809
|
-
Some percentage of users that have grown accustomed to a
|
2810
|
-
layout will resist almost any kind of change, and even
|
2811
|
-
apparently simple changes often turn out to have
|
2812
|
-
far-reaching effects."
|
2813
|
-
|
2814
|
-
"Focus ruthlessly on fixing the most serious problems first."
|
2815
|
-
|
2816
|
-
## Cyberweb::Header
|
2817
|
-
|
2818
|
-
Examples:
|
2819
|
-
|
2820
|
-
Cyberweb::Header.size = 'h3' # Set to a smaller header.
|
2821
|
-
Cyberweb::Header.reset
|
2822
|
-
|
2823
|
-
Not sure if this is still necessary in 2021; at a later time
|
2824
|
-
it will be decided whether to keep this or not. If it is kept
|
2825
|
-
then this subsection will be expanded.
|
2770
|
+
Not sure if this is still necessary in 2021; at a later time
|
2771
|
+
it will be decided whether to keep this or not. If it is kept
|
2772
|
+
then this subsection will be expanded.
|
2826
2773
|
|
2827
2774
|
## Working with HTML form elements
|
2828
2775
|
|
@@ -2852,9 +2799,11 @@ generate the web-app as-is, though.
|
|
2852
2799
|
## Cyberweb::HtmlTemplate
|
2853
2800
|
|
2854
2801
|
class **Cyberweb::HtmlTemplate** can be used to fill it with HTML
|
2855
|
-
specific content.
|
2856
|
-
|
2857
|
-
|
2802
|
+
specific content.
|
2803
|
+
|
2804
|
+
Let's show a specific example how this may be used:
|
2805
|
+
|
2806
|
+
require 'cyberweb/requires/require_the_html_template.rb' # This is the recommended way to require class HtmlTemplate.
|
2858
2807
|
|
2859
2808
|
Cyberweb::HtmlTemplate[
|
2860
2809
|
title: 'Status',
|
@@ -2863,27 +2812,65 @@ class:
|
|
2863
2812
|
'</pre>'
|
2864
2813
|
].to_s
|
2865
2814
|
|
2866
|
-
|
2867
|
-
|
2815
|
+
This would represent a "full" HTML page, as a String.
|
2816
|
+
|
2817
|
+
It is possible, since as of **18.06.2021**, to pass **CSS classes**
|
2818
|
+
into this, via:
|
2868
2819
|
|
2869
2820
|
css_classes:
|
2870
2821
|
|
2871
2822
|
For example, passing 'darkblue' to that key means that the CSS
|
2872
|
-
class 'darkblue' will be available, which ultimately comes
|
2873
|
-
to <b>color: darkblue</b>.
|
2823
|
+
class 'darkblue' will be made available, which ultimately comes
|
2824
|
+
down to <b>color: darkblue</b>.
|
2874
2825
|
|
2875
|
-
I needed this functionality to pull in only the CSS classes
|
2876
|
-
I use on a particular page generated by class
|
2826
|
+
I needed this functionality to pull in only the CSS classes
|
2827
|
+
that I use on a particular page generated by class
|
2828
|
+
Cyberweb::HtmlTemplate.
|
2877
2829
|
|
2878
2830
|
Various additional entries are available. For example, if
|
2879
2831
|
you want to modify the css-style in use for the body tag
|
2880
|
-
then you can use the following variant:
|
2832
|
+
then you can simply use the following variant:
|
2881
2833
|
|
2882
2834
|
body_css_style: 'background-color:#DFD1FF'
|
2883
2835
|
|
2884
|
-
In the long run the goal is to extend class HtmlTemplate
|
2885
|
-
such a way that all html-generation used within the
|
2886
|
-
project can be handled by it.
|
2836
|
+
In the long run the goal here is to extend class HtmlTemplate
|
2837
|
+
in such a way that all html-generation used within the
|
2838
|
+
Cyberweb project can be handled by it.
|
2839
|
+
|
2840
|
+
You can also pass ad-hoc CSS style into it. Example:
|
2841
|
+
|
2842
|
+
Cyberweb::HtmlTemplate[
|
2843
|
+
body: _, # The content of <body> goes in here.
|
2844
|
+
css_style: '
|
2845
|
+
img {
|
2846
|
+
border: 8px solid #black;
|
2847
|
+
padding: 2px;
|
2848
|
+
}
|
2849
|
+
' # and ^^^ there you can put your CSS rules into class HtmlTemplate
|
2850
|
+
].to_s
|
2851
|
+
|
2852
|
+
You can also pass in some ad-hoc javascript code via:
|
2853
|
+
|
2854
|
+
javascript_code:
|
2855
|
+
|
2856
|
+
All this does is add the proper [script> tag to it.
|
2857
|
+
|
2858
|
+
You can also specifically add jquery support for the HtmlTemplate.
|
2859
|
+
The following example shows how this can be done:
|
2860
|
+
|
2861
|
+
html_template = Cyberweb::HtmlTemplate[
|
2862
|
+
title: 'This is a test-page,
|
2863
|
+
body: HtmlTags.p('Another test.','','','font-size:1.8em'),
|
2864
|
+
use_jquery: true
|
2865
|
+
].to_s
|
2866
|
+
|
2867
|
+
puts html_template
|
2868
|
+
|
2869
|
+
Typing <b>Cyberweb::HtmlTemplate[]</b> is quite cumbersome, though. Since
|
2870
|
+
as of October 2022 a simpler toplevel API is available:
|
2871
|
+
|
2872
|
+
Cyberweb.html_template
|
2873
|
+
Cyberweb.html_template(body_content) # The String you pass here will be the body of the HTML page.
|
2887
2874
|
|
2888
2875
|
## Embed youtube videos and videos in general
|
2889
2876
|
|
@@ -2967,6 +2954,13 @@ use the following method:
|
|
2967
2954
|
|
2968
2955
|
header_for_sitemap 'This is some generic header.'
|
2969
2956
|
|
2957
|
+
You can also use an Array for a special method:
|
2958
|
+
|
2959
|
+
sitemap_array('Hratie','Tulis','Kuulk')
|
2960
|
+
|
2961
|
+
This will be treated as an Array of headers to be used for the
|
2962
|
+
sitemap that will be generated.
|
2963
|
+
|
2970
2964
|
## Generating standalone webpages (.html files)
|
2971
2965
|
|
2972
2966
|
This subsection deals with the cyberweb project generating standalone
|
@@ -3041,6 +3035,10 @@ the following:
|
|
3041
3035
|
}
|
3042
3036
|
</style>
|
3043
3037
|
|
3038
|
+
Remember that you can also use a title for a href tag. Example:
|
3039
|
+
|
3040
|
+
<a href="http://foobar.de/" class="slateblue" title="Some Superlong Title here">
|
3041
|
+
|
3044
3042
|
## The br-tag
|
3045
3043
|
|
3046
3044
|
The br-tag can be used in HTML to add a linebreak.
|
@@ -3097,16 +3095,128 @@ If you do not need drag-and-drop support then simply use:
|
|
3097
3095
|
If **drag_local_image_or_remote_image()** is too long to type,
|
3098
3096
|
use the alias called **dimg2**.
|
3099
3097
|
|
3098
|
+
To quickly embed a remote image, you can use the following
|
3099
|
+
API:
|
3100
|
+
|
3101
|
+
embed_remote_image
|
3102
|
+
embed_remote_image 'https://foobar.com/cat.jpg'
|
3103
|
+
embed_remote_image 'https://foobar.com/cat.jpg','mar1em mars2em' # This here passes CSS classes to the image at hand.
|
3104
|
+
|
3105
|
+
## Cyberweb.convert_back_german_umlauts
|
3106
|
+
|
3107
|
+
This method can be used to 'convert back' german umlauts, when the
|
3108
|
+
encoding failed somewhere, such as converting '%d6' into 'Ö'. It is
|
3109
|
+
mostly an ad-hoc method that most users of the project will not need,
|
3110
|
+
but sometimes there may be a use case to make use of that method,
|
3111
|
+
such as when one uses open-uri to download a remote website into a
|
3112
|
+
local file, if said remote website contains german umlauts.
|
3113
|
+
|
3114
|
+
In fact this was precisely the reason why that method was added.
|
3115
|
+
|
3116
|
+
## Setting the date-of-creation for a web-app based on WebObject
|
3117
|
+
|
3118
|
+
Since as of **October 2021** you can use:
|
3119
|
+
|
3120
|
+
created_when '20.08.2021'
|
3121
|
+
|
3122
|
+
To **indicate when the webpage at hand has been created**. This will then
|
3123
|
+
add a meta-element to the page, which is roughly equivalent to:
|
3124
|
+
|
3125
|
+
<meta name="DCTERMS.created" scheme="DCTERMS.ISO8601" content="2010-03-17T13:31:50"/>
|
3126
|
+
|
3127
|
+
I am not sure whether this is super-useful or not, but I wanted
|
3128
|
+
to add a method that keeps track of the creation-time of
|
3129
|
+
web-apps based on web_object, which is the main reason why
|
3130
|
+
this functionality was added. At the least it helps me remember
|
3131
|
+
when a web-app was created.
|
3132
|
+
|
3133
|
+
## autogenerated_system_settings.yml
|
3134
|
+
|
3135
|
+
The file <b>cyberweb/yaml/autogenerated_system_settings.yml</b> is created
|
3136
|
+
via the external file **roebe/classes/generate_system_values.rb**.
|
3137
|
+
|
3138
|
+
This file will contain entries such as:
|
3139
|
+
|
3140
|
+
SYSLIB_DIR: "/usr/lib/"
|
3141
|
+
|
3142
|
+
This was needed because in some environments these directories are
|
3143
|
+
not defined, yet there are examples where the cyberweb project
|
3144
|
+
may need to know these paths. Thus, the hardcoded values are
|
3145
|
+
stored in that .yml file. You will probably never need the .rb
|
3146
|
+
file or the .yml file, but it is here documented to explain why
|
3147
|
+
it exists.
|
3148
|
+
|
3149
|
+
## Column width in CSS
|
3150
|
+
|
3151
|
+
You can specify a column width via **column-width: 250px;**.
|
3152
|
+
|
3153
|
+
The following screenshot shows this:
|
3154
|
+
|
3155
|
+
<img src="https://i.imgur.com/485E80P.png" style="margin-left: 2em">
|
3156
|
+
|
3157
|
+
## The meter tag in HTML
|
3158
|
+
|
3159
|
+
HTML allows us to use a **meter** tag.
|
3160
|
+
|
3161
|
+
Example in HTML:
|
3162
|
+
|
3163
|
+
<label for="value1">Low</label>
|
3164
|
+
<meter id="value1" min="0" max="100" low="30" high="75" optimum="80" value="25"></meter>
|
3165
|
+
|
3166
|
+
This would eventually yield a page that may look like this:
|
3167
|
+
|
3168
|
+
<img src="https://i.imgur.com/7f1ICEY.png" style="margin-left: 2em">
|
3169
|
+
|
3170
|
+
This is documented here in the event that we may need this one day.
|
3171
|
+
|
3172
|
+
## Unicode and Encoding
|
3173
|
+
|
3174
|
+
This subsection is currently a stub - in the future it may be expanded
|
3175
|
+
to contain more useful information.
|
3176
|
+
|
3177
|
+
On the world wide web you can sometimes see greek symbols displayed
|
3178
|
+
on a homepage. This often makes use of the "math> tag.
|
3179
|
+
|
3180
|
+
Preliminary support for this was added to the cyberweb project in
|
3181
|
+
October 2021. This is incomplete right now but hopefully will become
|
3182
|
+
more inclusive in the future.
|
3183
|
+
|
3184
|
+
Following next is just one example to add (display) the greek
|
3185
|
+
symbol **omega** on the webpage at hand:
|
3186
|
+
|
3187
|
+
add_omega_symbol_semantics
|
3188
|
+
|
3189
|
+
## Sanitizing .html files
|
3190
|
+
|
3191
|
+
Sometimes a .html file is "compressed", aka newlines are removed.
|
3192
|
+
Everything is then on a single line.
|
3193
|
+
|
3194
|
+
Some editors struggle with this; and it is quite ugly.
|
3195
|
+
|
3196
|
+
Thus, an ad-hoc method was added to Cyberweb.
|
3197
|
+
|
3198
|
+
Its API is:
|
3199
|
+
|
3200
|
+
Cyberweb.sanitize_this_string_by_adding_a_newline_after_every_closing_HTML_tag
|
3201
|
+
Cyberweb.sanitize_this_string_by_adding_a_newline_after_every_closing_HTML_tag('/Depot/j/foobar.html')
|
3202
|
+
|
3203
|
+
Pass a local .html file to the method; alternatively a String should do
|
3204
|
+
well. Every closing > html tag found will be turned into ">\n" instead.
|
3205
|
+
Thus, you get a nicely split .html page. (Ideally we should use a more
|
3206
|
+
sophisticated regex, but I really added this just as a throw-away
|
3207
|
+
action, to sanitize a mangled .html page.)
|
3208
|
+
|
3209
|
+
This can also be called **de-minify-script**.
|
3210
|
+
|
3100
3211
|
## Objectified HTML Tags
|
3101
3212
|
|
3102
|
-
Objectified HTML tags are something like this:
|
3213
|
+
**Objectified HTML tags** are something like this:
|
3103
3214
|
|
3104
|
-
puts Cyberweb::
|
3105
|
-
puts Cyberweb::
|
3215
|
+
puts Cyberweb::Objectified::HtmlTags::Span.new('hey there') # => "<span>hey there</span>"
|
3216
|
+
puts Cyberweb::Objectified::HtmlTags::Span.new('hey there').align_to_the_left # => "<span style="text-align: left;">hey there</span>"
|
3106
3217
|
|
3107
|
-
In other words we may treat HTML tags as strings that can be
|
3108
|
-
|
3109
|
-
such as:
|
3218
|
+
In other words we may treat HTML tags as strings that can be embedded.
|
3219
|
+
The idea for this has been inspired by **ruby-gtk**, such as:
|
3110
3220
|
|
3111
3221
|
widget1.add(widget2)
|
3112
3222
|
|
@@ -3121,7 +3231,7 @@ In late September 2021, the textarea-tag was added.
|
|
3121
3231
|
|
3122
3232
|
Example:
|
3123
3233
|
|
3124
|
-
textarea = Cyberweb::
|
3234
|
+
textarea = Cyberweb::Objectified::HtmlTags::Textarea.new('content')
|
3125
3235
|
# You can also use this instead:
|
3126
3236
|
# textarea = html_textarea
|
3127
3237
|
textarea.class = 'rounded_border_6px bblack1 FS2em pad8px'
|
@@ -3135,19 +3245,27 @@ HTML tags will become objectified, as an additional option. You
|
|
3135
3245
|
need to decide for yourself whether you want to use this or not;
|
3136
3246
|
the one-line approach in regular HTML is probably shorter.
|
3137
3247
|
|
3138
|
-
The following table, alphabetically
|
3139
|
-
(
|
3140
|
-
the cyberweb project. More may be added in the future.
|
3248
|
+
The following table, sorted alphabetically, shows the currently
|
3249
|
+
(<b>February 2022</b>) available objectified HTML tags as part
|
3250
|
+
of the cyberweb project. More may be added in the future.
|
3141
3251
|
|
3142
3252
|
Name of the HTML tag | Implementation Status | True HTML tag
|
3143
3253
|
---------------------|--------------------------|--------------
|
3144
3254
|
a | added | yes
|
3145
|
-
|
3255
|
+
abbr | added | yes
|
3256
|
+
blockquote | added | yes
|
3257
|
+
body | added | yes
|
3146
3258
|
button | added | yes
|
3259
|
+
canvas | added | yes
|
3260
|
+
cite | added | yes
|
3147
3261
|
combobox | added | no
|
3262
|
+
details | not yet added | yes
|
3148
3263
|
div | added | yes
|
3149
3264
|
embed | added | yes
|
3265
|
+
fieldset | added | yes
|
3266
|
+
figure | added | yes
|
3150
3267
|
form | added | yes
|
3268
|
+
head | added | yes
|
3151
3269
|
h1 | added | yes
|
3152
3270
|
h2 | added | yes
|
3153
3271
|
h3 | added | yes
|
@@ -3156,8 +3274,12 @@ Name of the HTML tag | Implementation Status | True HTML tag
|
|
3156
3274
|
h6 | added | yes
|
3157
3275
|
hbox | added | no
|
3158
3276
|
img | added | yes
|
3277
|
+
map | added | yes
|
3278
|
+
meta | added | yes
|
3279
|
+
object | added | yes
|
3159
3280
|
p | added | yes
|
3160
3281
|
pre | added | yes
|
3282
|
+
progress | added | yes
|
3161
3283
|
span | added | yes
|
3162
3284
|
table | added | yes
|
3163
3285
|
textarea | added | yes
|
@@ -3197,29 +3319,1269 @@ I want to try to combine an OOP approach for the www with the
|
|
3197
3319
|
old variant that cyberweb used in the last 15 years. It is a
|
3198
3320
|
bit too verbose for my taste still, but eventually I should
|
3199
3321
|
have ironed this out.
|
3322
|
+
|
3323
|
+
Let's have a look how we could use an objectified table.
|
3324
|
+
|
3325
|
+
Raw example:
|
3326
|
+
|
3327
|
+
alias e puts
|
3328
|
+
table = Cyberweb::Objectified::HtmlTags::Table.new(
|
3329
|
+
[
|
3330
|
+
[1,2,3,4,5,6,7,8,9],
|
3331
|
+
[1,2,3,4,5,6,7,8,9],
|
3332
|
+
[1,2,3,4,5,6,7,8,9],
|
3333
|
+
[1,2,3,4,5,6,7,8,9],
|
3334
|
+
[1,2,3,4,5,6,7,8,9]
|
3335
|
+
]
|
3336
|
+
)
|
3337
|
+
table.id = 'hover_transition'
|
3338
|
+
table.css_class = 'rounded_border_8px wid100 bblack2'
|
3339
|
+
table.css_style = 'font-size: 3.5em'
|
3340
|
+
# We can even add headers:
|
3341
|
+
table.headers = %w( Month Savings )
|
3342
|
+
e table # And output it here.
|
3343
|
+
|
3344
|
+
The above code will generate:
|
3345
|
+
|
3346
|
+
<table class="rounded_border_8px wid100 bblack2" id="hover_transition" style="font-size: 3.5em">
|
3347
|
+
<tr>
|
3348
|
+
<th>Month</th>
|
3349
|
+
<th>Savings</th>
|
3350
|
+
</tr>
|
3351
|
+
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td></tr>
|
3352
|
+
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td></tr>
|
3353
|
+
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td></tr>
|
3354
|
+
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td></tr>
|
3355
|
+
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td></tr>
|
3356
|
+
</table>
|
3357
|
+
|
3358
|
+
You could then either embed this into HTML, or simply use it from a
|
3359
|
+
ruby file - be it sinatra, a .cgi file or anything else.
|
3360
|
+
|
3361
|
+
In the long run I plan to add a lot more methods to these objectified
|
3362
|
+
HTML tags, if these are useful. The idea is that we can treat web-pages
|
3363
|
+
as distinct objects, with convenience features that make creating such
|
3364
|
+
objects simpler.
|
3365
|
+
|
3366
|
+
It is also planned to eventually replace the more complicated "legacy"
|
3367
|
+
code in the WebObject or toplevel-namespace of Cyberweb to make more
|
3368
|
+
use of such objectified HTML tags - in particular for the more advanced
|
3369
|
+
use cases.
|
3370
|
+
|
3371
|
+
You can use some custom javascript code too.
|
3372
|
+
|
3373
|
+
For example, if you want to have a div where the user can select
|
3374
|
+
the whole content of said div-tag on a left-mouse-button-click
|
3375
|
+
event, consider using code such as the following:
|
3376
|
+
|
3377
|
+
div = Cyberweb::Objectified::HtmlTags::Div.new('<h2>Hello world!</h2>')
|
3378
|
+
div.id = 'test_div'
|
3379
|
+
div.on_clicked { :select_everything }
|
3380
|
+
|
3381
|
+
Note that this requires an ID. See the file
|
3382
|
+
**select_everything_example.cgi** for a variant that works on
|
3383
|
+
my home setup.
|
3384
|
+
|
3385
|
+
You may also use some shortcuts here and there. For example, if you
|
3386
|
+
look at the above last line, the **div.on_clicked { :select_everything }**
|
3387
|
+
variant, then you could also simplify this a bit towards:
|
3388
|
+
|
3389
|
+
div.on_click_select
|
3390
|
+
div.on_clicked_select # Or this variant.
|
3391
|
+
|
3392
|
+
This is literally the same as the variant above, but you can use fewer
|
3393
|
+
characters to do the same. Sometimes less is more - but always think
|
3394
|
+
about whether you want to prefer the more succint variant; sometimes
|
3395
|
+
the longer variant is more readable, in particular when you come
|
3396
|
+
back to a project many months lateron. Note that right now, in
|
3397
|
+
October 2021, only some javascript-driven actions are added. This
|
3398
|
+
will be slowly extended, and then documented here as well.
|
3399
|
+
|
3400
|
+
You can respond to on-mouse-hover events via JavaScript too.
|
3401
|
+
|
3402
|
+
Consider the following div variable, assigned to an objectified
|
3403
|
+
HTML tag, as outlined above.
|
3404
|
+
|
3405
|
+
Now you use:
|
3406
|
+
|
3407
|
+
div.css_class = 'BG_Black white'
|
3408
|
+
div.on_mouse_hover {{ bg: :orange }}
|
3409
|
+
|
3410
|
+
This would make the background of that div tag black (as specified
|
3411
|
+
by the CSS rule called **BG_Black**, which is distributed in the
|
3412
|
+
cyberweb project), and then, on a mouse-hover event over that
|
3413
|
+
div change the background of the whole div to **orange**. When the
|
3414
|
+
user moves the mouse cursor away the old colour is reinstated
|
3415
|
+
again.
|
3200
3416
|
|
3201
|
-
|
3417
|
+
Some of the functionality of the **Objectified::HtmlTags** is tested via
|
3418
|
+
the file **cyberweb/test/complex_tests/testing_objectified_html_tags.rb**.
|
3202
3419
|
|
3203
|
-
|
3204
|
-
|
3205
|
-
|
3206
|
-
really, last updated in **May 2021**.
|
3420
|
+
Support for the **canvas** tag was added in **October 2021**. The
|
3421
|
+
**canvas** tag allows us to draw arbitrary objects onto the
|
3422
|
+
browser.
|
3207
3423
|
|
3208
|
-
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3213
|
-
|
3214
|
-
|
3215
|
-
|
3216
|
-
|
3424
|
+
Note that you can mix Cyberweb::WebObject with objectified-html-tags.
|
3425
|
+
|
3426
|
+
For instance:
|
3427
|
+
|
3428
|
+
entry_for_the_name_of_the_card = html_input
|
3429
|
+
entry_for_the_name_of_the_card.css_class = 'bblack2 pad8px'
|
3430
|
+
|
3431
|
+
table2('mars1em','','',
|
3432
|
+
'Name of the card: ',entry_for_the_name_of_the_card.string?
|
3433
|
+
)
|
3434
|
+
|
3435
|
+
This would put an input-tag into the second entry at the table.
|
3436
|
+
|
3437
|
+
The next example shows how to add a button that, on mouse hover
|
3438
|
+
event, **changes its colour to lightblue**:
|
3439
|
+
|
3440
|
+
button = html_button
|
3441
|
+
button.text = 'Save'
|
3442
|
+
button.css_class('larger bblack2 pad4px marl6em mart1em pad5px s1em')
|
3443
|
+
button.on_hover_colour(:lightblue) # This currently does not work for all HTML colours, but it works for :lightblue.
|
3444
|
+
addnl(button.to_s) # This line is currently needed if you use WebObject; in the future we may be able to skip having to do this.
|
3445
|
+
|
3446
|
+
In November 2021 I am still experimenting.
|
3447
|
+
|
3448
|
+
Consider the following ruby code for the objectified HTML tag:
|
3449
|
+
|
3450
|
+
_ = html_h1('Batterien')
|
3451
|
+
_.css_class 'martb1px hover_pulse_grow'
|
3452
|
+
_.append_css_manager('css_rule_for_hover_pulse_grow(8)')
|
3453
|
+
ee _.result?
|
3454
|
+
|
3455
|
+
Alternatively this slightly shorter variant:
|
3456
|
+
|
3457
|
+
_ = Cyberweb.oop_h1('Batterien', 'martb1px hover_pulse_grow')
|
3458
|
+
_.append_css_manager('css_rule_for_hover_pulse_grow(8)')
|
3459
|
+
ee _.result?
|
3460
|
+
|
3461
|
+
This will add a HTML h1 tag, with some special CSS that allows
|
3462
|
+
for pulsing growth. The number 8 means 8 iterations, so 4
|
3463
|
+
times growing up (because every step, forward and reverse,
|
3464
|
+
counts as +1).
|
3465
|
+
|
3466
|
+
I am not yet very happy with the above. It's still too verbose
|
3467
|
+
for my taste - but the good thing is that we actually
|
3468
|
+
auto-generate CSS here. That way we do not have to carry
|
3469
|
+
specific .css files - we simply autogenerate them anew.
|
3470
|
+
|
3471
|
+
## Objectified HTML Tags versus the default class-based HTML Tags
|
3472
|
+
|
3473
|
+
You may have noticed that there are two groups of classes that are
|
3474
|
+
similarly named.
|
3475
|
+
|
3476
|
+
For example:
|
3477
|
+
|
3478
|
+
Cyberweb::Table
|
3479
|
+
|
3480
|
+
versus
|
3481
|
+
|
3482
|
+
Cyberweb::Objectified::HtmlTags::Table
|
3483
|
+
|
3484
|
+
The first variant is older; at this point it is almost 10 years
|
3485
|
+
old. The latter variant is newish, about 1 year old or even
|
3486
|
+
less than that (as of October 2021).
|
3487
|
+
|
3488
|
+
So, which variant to use?
|
3489
|
+
|
3490
|
+
Well, right now the behaviour is not identical, and they have
|
3491
|
+
different use cases. Perhaps in the future I may unify towards
|
3492
|
+
objectified HTML tags, but for now the two will have to co-exist.
|
3493
|
+
|
3494
|
+
Whenever possible I will update the older variant, e. g.
|
3495
|
+
**Cyberweb::Table**, to tap into functionality that is
|
3496
|
+
made directly available within **Cyberweb::Objectified::HtmlTags::Table**,
|
3497
|
+
to give an example.
|
3498
|
+
|
3499
|
+
So, perhaps in the long run, all unique functionality that is currently
|
3500
|
+
made available by Cyberweb::Table and similarly named classes, may
|
3501
|
+
be found under the objectified HTML tags. The latter is more robust,
|
3502
|
+
IMO, and has more flexible use cases.
|
3503
|
+
|
3504
|
+
## Placeholder text
|
3505
|
+
|
3506
|
+
Placeholder text can be assigned to a textarea HTML tag. Let's first
|
3507
|
+
show the raw HTML code for this, mixed in with a bit of CSS:
|
3508
|
+
|
3509
|
+
Describe the physical attributes of your character next:<br><br>
|
3510
|
+
<textarea rows="4" cols="50" style="margin: 1em" placeholder="Describe your character here ..."></textarea>
|
3511
|
+
|
3512
|
+
This would yield the following result in the browser:
|
3513
|
+
|
3514
|
+
<img src="https://i.imgur.com/WqVL83L.png" style="margin: 1em; margin-left: 3em">
|
3515
|
+
|
3516
|
+
You can use the **input** tag to designate a placeholder text to use.
|
3517
|
+
|
3518
|
+
Only two HTML attributes can receive the **placeholder attribute**.
|
3519
|
+
These are:
|
3520
|
+
|
3521
|
+
<input>
|
3522
|
+
<textarea>
|
3523
|
+
|
3524
|
+
An example for this follows for the input tag:
|
3525
|
+
|
3526
|
+
<input type="tel" id="phone" name="phone" placeholder="123-45-678" pattern="[0-9]{3}-[0-9]{2}-[0-9]{3}"><br><br>
|
3527
|
+
|
3528
|
+
And for the textarea tag as well:
|
3529
|
+
|
3530
|
+
<textarea placeholder="Describe your complaint here ..."></textarea>
|
3531
|
+
|
3532
|
+
See also the distributed example file at **cyberweb/examples/input_placeholder_example.html*.
|
3533
|
+
|
3534
|
+
It is possible to style the placerholder-text via CSS.
|
3535
|
+
|
3536
|
+
For instance, if you would like to use the color **steelblue* then
|
3537
|
+
use the following CSS rule:
|
3538
|
+
|
3539
|
+
::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
|
3540
|
+
color: red;
|
3541
|
+
opacity: 1; /* Firefox */
|
3542
|
+
}
|
3543
|
+
|
3544
|
+
## CSS rules in general
|
3545
|
+
|
3546
|
+
This subsection contains a few explanations to CSS rules in general.
|
3547
|
+
|
3548
|
+
Inheritance: after a property has been applied to a particular
|
3549
|
+
element, its children retain those property values as well. That
|
3550
|
+
way you can consistently style these elements via the same CSS
|
3551
|
+
rules.
|
3552
|
+
|
3553
|
+
Normally when a CSS value is changed, the change is instant. This
|
3554
|
+
can be avoided by the **transition** property, which allows us
|
3555
|
+
to animate from the old state to a new state.
|
3556
|
+
|
3557
|
+
## Remote images at imgur
|
3558
|
+
|
3559
|
+
I have some local .cgi files that request images stored in a path
|
3560
|
+
that is not accessible by the local webserver. Sometimes I can
|
3561
|
+
put it into WebImages and use it, such as via Base64 encoding -
|
3562
|
+
but sometimes I just want to be able to link to it via an
|
3563
|
+
**img** tag. So in these cases I am fine linking in to remote
|
3564
|
+
images.
|
3565
|
+
|
3566
|
+
As I may forget which image is available, here comes a listing -
|
3567
|
+
this may be extended over time:
|
3568
|
+
|
3569
|
+
<img src="https://i.imgur.com/EbiyEtQ.png">
|
3570
|
+
<img src="https://i.imgur.com/HnjTJj4.png">
|
3571
|
+
|
3572
|
+
## Downloading a remote webpage
|
3573
|
+
|
3574
|
+
You can use <b>Cyberweb.download_webpage()</b> to download a remote
|
3575
|
+
webpage.
|
3576
|
+
|
3577
|
+
This isn't hugely sophisticated - it just performs URI.open().read
|
3578
|
+
and then dumps that string into a local file. The file **bin/download_webpage**
|
3579
|
+
is representing that functionality from the commandline.
|
3580
|
+
|
3581
|
+
Usage example from within Ruby code:
|
3582
|
+
|
3583
|
+
Cyberweb.download_webpage('https://en.wikipedia.org/wiki/Tom_and_Jerry')
|
3584
|
+
|
3585
|
+
## Tooltip example via CSS
|
3586
|
+
|
3587
|
+
A tooltip is often used to specify extra information about something when
|
3588
|
+
the user moves the mouse pointer over an element.
|
3589
|
+
|
3590
|
+
Have a look at the file at <b>cyberweb/examples/css/css_tooltip.html</b>.
|
3591
|
+
|
3592
|
+
This shows a simple CSS tooltip. Adjust the style, colours, width
|
3593
|
+
according to your own preferences.
|
3594
|
+
|
3595
|
+
## hr_stars
|
3596
|
+
|
3597
|
+
You can use the method call **hr_stars** to display three stars
|
3598
|
+
aligned one to another.
|
3599
|
+
|
3600
|
+
This may look as the following image shows:
|
3601
|
+
|
3602
|
+
<img src="https://i.imgur.com/moDx2f1.png" style="margin-left: 2em">
|
3603
|
+
|
3604
|
+
## cmd1, cmd2, cmd3
|
3605
|
+
|
3606
|
+
The three methods called **cmd1**, **cmd2**, **cmd3**, can be used to
|
3607
|
+
show commands that the user can input. The **1**, **2** or **3** part
|
3608
|
+
refers to the indent-level, so the number **3** means **3x the
|
3609
|
+
basic indent level**.
|
3610
|
+
|
3611
|
+
Note that **cmd** is an alias to **cmd1**.
|
3612
|
+
|
3613
|
+
In the last ten years or so, the code for this was stored under the
|
3614
|
+
module PredefinedMethods, but in December 2021 this was changed and
|
3615
|
+
became part of **internal_hash.rb**. The latter shall slowly replace
|
3616
|
+
all other toplevel-instance variables for the Cyberweb project.
|
3617
|
+
The net gain will be that the new code is easier to maintain.
|
3618
|
+
|
3619
|
+
What is the use case for cmd1 or cmd2 or cmd3?
|
3620
|
+
|
3621
|
+
See the following examples for this:
|
3622
|
+
|
3623
|
+
e 'Input these instructions:'
|
3624
|
+
br
|
3625
|
+
cmd1 'ls -la'
|
3626
|
+
cmd2 'cd /tmp'
|
3627
|
+
# and so forth
|
3628
|
+
|
3629
|
+
Note that you can also customize the toplevel CSS for cmd1, cmd2
|
3630
|
+
and cmd3. The following example shows how to add the steelblue
|
3631
|
+
colour to these:
|
3632
|
+
|
3633
|
+
append_to_cmd1 'steelblue'
|
3634
|
+
append_to_cmd2 'steelblue'
|
3635
|
+
append_to_cmd3 'steelblue'
|
3636
|
+
|
3637
|
+
## Cyberweb::RouteHandlerModule
|
3638
|
+
|
3639
|
+
This module shall eventually replace sinatra for my own needs.
|
3640
|
+
I will not port all of sinatra's functionality, but I want
|
3641
|
+
to be able to use the **core** functionality for my own
|
3642
|
+
custom web-related needs.
|
3643
|
+
|
3644
|
+
To use puma, use:
|
3645
|
+
|
3646
|
+
Cyberweb.puma
|
3647
|
+
|
3648
|
+
And for webrick, use:
|
3649
|
+
|
3650
|
+
Cyberweb.webrick
|
3651
|
+
|
3652
|
+
These methods were added mostly for convenience. If you are
|
3653
|
+
curious have a look at the code to find out which is the
|
3654
|
+
'real' method.
|
3655
|
+
|
3656
|
+
## Rebuilding Sinatra
|
3657
|
+
|
3658
|
+
Sinatra is a small webframework, built on top of Rack. It provides
|
3659
|
+
a useful DSL for specifying what the given application should
|
3660
|
+
respond to, and what it will send back.
|
3661
|
+
|
3662
|
+
The DSL can be as simple as this:
|
3663
|
+
|
3664
|
+
get "/hello" do
|
3665
|
+
[200, {}, "Hello from Sinatra!"]
|
3666
|
+
end
|
3667
|
+
|
3668
|
+
post "/hello" do
|
3669
|
+
[200, {}, "Hello from a post-Sinatra world!"]
|
3670
|
+
end
|
3671
|
+
|
3672
|
+
The **get()** method must take a path (which is the first
|
3673
|
+
argument) and an associated handler block - which is the
|
3674
|
+
part within the **do/end** clause.
|
3675
|
+
|
3676
|
+
A very simple definition may be the following variant:
|
3677
|
+
|
3678
|
+
def get(path, &handler)
|
3679
|
+
route("GET", path, &handler)
|
3680
|
+
end
|
3681
|
+
|
3682
|
+
def route(verb, path, &handler)
|
3683
|
+
@routes[verb] ||= {}
|
3684
|
+
@routes[verb][path] = handler
|
3685
|
+
end
|
3686
|
+
|
3687
|
+
So, in other words: we will append new verb-entries to
|
3688
|
+
the main hash called **@routes**.
|
3689
|
+
|
3690
|
+
This can then be used like this:
|
3691
|
+
|
3692
|
+
route_handler.get "/hello" do
|
3693
|
+
[200, {}, ["Hello world!"]]
|
3694
|
+
end
|
3695
|
+
|
3696
|
+
puts route_handler.routes
|
3697
|
+
|
3698
|
+
The next method that has to be defined, if we want to
|
3699
|
+
support Rack, is .call(), such as:
|
3700
|
+
|
3701
|
+
def call(env)
|
3702
|
+
end
|
3703
|
+
|
3704
|
+
## Hover.css
|
3705
|
+
|
3706
|
+
Since as of **November 2021** the cyberweb project makes use
|
3707
|
+
of **Hover.css** (licence: **MIT**):
|
3708
|
+
|
3709
|
+
http://ianlunn.github.io/Hover/
|
3710
|
+
|
3711
|
+
The .css is distributed as-is. Note that some names were changed,
|
3712
|
+
though, to make it more 'logical'.
|
3713
|
+
|
3714
|
+
## Web-safe fonts
|
3715
|
+
|
3716
|
+
The following list is assumed to contain web-safe fonts, for
|
3717
|
+
use in HTML pages (via CSS):
|
3718
|
+
|
3719
|
+
Arial (sans-serif)
|
3720
|
+
Verdana (sans-serif)
|
3721
|
+
Helvetica (sans-serif)
|
3722
|
+
Tahoma (sans-serif)
|
3723
|
+
Trebuchet MS (sans-serif)
|
3724
|
+
Times New Roman (serif)
|
3725
|
+
Georgia (serif)
|
3726
|
+
Garamond (serif)
|
3727
|
+
Courier New (monospace)
|
3728
|
+
Brush Script MT (cursive)
|
3729
|
+
|
3730
|
+
Note that the names of CSS fonts in general are case insensitive.
|
3731
|
+
Thus you can lowercase them too, if you would like to.
|
3732
|
+
|
3733
|
+
You can also use **generic fonts**. Five are available by default,
|
3734
|
+
being: <b>serif, sans-serif, cursive, fantasy and monospace</b>.
|
3735
|
+
Serif resembles Times New Roman, sans-serif resembles <b>Arial</b>.
|
3736
|
+
|
3737
|
+
Most text on the Web is displayed with a **sans-serif** font family.
|
3738
|
+
|
3739
|
+
## Balloon.css
|
3740
|
+
|
3741
|
+
You can download the **balloon.css** file via class
|
3742
|
+
**DownloadBalloonCss** (**Cyberweb::DownloadBalloonCss**).
|
3743
|
+
|
3744
|
+
This file resides at the location
|
3745
|
+
<b>web_object/utility_scripts/download_balloon_css.rb</b>.
|
3746
|
+
|
3747
|
+
It presently (May 2018) does not do much other than download
|
3748
|
+
that remote .css file.
|
3749
|
+
|
3750
|
+
I needed a small "pop-up" for displaying additional information
|
3751
|
+
to some entries in a table, which is how I found **Balloon.css**.
|
3752
|
+
|
3753
|
+
## Grayscale filtering on an image
|
3754
|
+
|
3755
|
+
**CSS** allows us to "remove" colours in an image. I call this
|
3756
|
+
the **grayscale filter**.
|
3757
|
+
|
3758
|
+
Cyberweb comes with a default CSS class that may be of help
|
3759
|
+
here - simply attach the CSS class **grayscale** to the
|
3760
|
+
image at hand if you want it to "lose" colours (for display
|
3761
|
+
purposes only; of course nothing is lost in the image as
|
3762
|
+
such, only the display of said image is modified via CSS).
|
3763
|
+
|
3764
|
+
## The progress bar in HTML5
|
3765
|
+
|
3766
|
+
You can use a progressbar to indicate progress based on
|
3767
|
+
percentage values. This is described here in detail:
|
3768
|
+
|
3769
|
+
https://css-tricks.com/html5-progress-element/
|
3770
|
+
|
3771
|
+
In cyberweb you can use:
|
3772
|
+
|
3773
|
+
progress
|
3774
|
+
progress('35 / 100') # 35%
|
3775
|
+
|
3776
|
+
At a later time we may add some javascript to indicate
|
3777
|
+
a counter-progress. Right now (as of February 2022)
|
3778
|
+
this is not possible though, so this part has to come
|
3779
|
+
at a later time.
|
3780
|
+
|
3781
|
+
## Converting from a .html page to a cyberweb-object
|
3782
|
+
|
3783
|
+
The file **bin/html_to_cyberweb_converter** can be used
|
3784
|
+
to convert some .html files into cyberweb-objects. This
|
3785
|
+
class has been created in February 2022, but it does not
|
3786
|
+
yet work very well. In the future this may change.
|
3787
|
+
|
3788
|
+
The idea is that we can grab any .html page, re-build
|
3789
|
+
its logic into cyberweb, and allow you to modify this
|
3790
|
+
in any way, shape or form. The long-term goal is to
|
3791
|
+
adjust any .html page to any different format, in
|
3792
|
+
any way, shape or form. It would allow users a
|
3793
|
+
higher level of abstraction to deal with a HTML
|
3794
|
+
page. For instance, you can re-style the CSS classes
|
3795
|
+
in use as-is.
|
3796
|
+
|
3797
|
+
(Note that presently, as of 2022, class WebObject is
|
3798
|
+
actually not used; HtmlTemplate is used instead. The
|
3799
|
+
reason is because WebObject is too big and not flexible
|
3800
|
+
enough right now. In the future this may be resolved,
|
3801
|
+
but for now, class HtmlTemplate will generate the
|
3802
|
+
new .html file.)
|
3803
|
+
|
3804
|
+
## autoextend
|
3805
|
+
|
3806
|
+
If you make use of Cyberweb::WebObject then you may be able
|
3807
|
+
to describe a webpage as an "object". Various methods will
|
3808
|
+
be made available at that point.
|
3809
|
+
|
3810
|
+
The API may include a sort of DSL like this:
|
3811
|
+
|
3812
|
+
english('Title goes here') {
|
3813
|
+
}
|
3814
|
+
|
3815
|
+
This kind of means that the webpage at hand will be using
|
3816
|
+
**english** as its primary language. And the first argument
|
3817
|
+
will become the title of that webpage. (Note that presently
|
3818
|
+
only english() and german() are available. It's not making
|
3819
|
+
any real difference, but perhaps I should add alias-names
|
3820
|
+
for other languages as well. Not so many users of this
|
3821
|
+
project aside from english as the primary language in use,
|
3822
|
+
though.)
|
3823
|
+
|
3824
|
+
Various other methods part of WebObject exist that help
|
3825
|
+
here, one of which is **autoextend**. This method is also
|
3826
|
+
aliased onto **enable_namespace**.
|
3827
|
+
|
3828
|
+
That method will include various other modules. One module that
|
3829
|
+
was somewhat recently (March 2022) added was
|
3830
|
+
<b>Cyberweb::Objectified::Mask</b>. This module will pull
|
3831
|
+
in HTML-tag support. So, for instance, **oop_h1()** can then
|
3832
|
+
be used as a method, which will refer to using h1 as the HTML
|
3833
|
+
tag. These objectified (OOP) HTML tags are described in
|
3834
|
+
more detail in other subsections of this document (**README.md**).
|
3835
|
+
|
3836
|
+
Including the namespace for <b>Cyberweb::Objectified::Mask</b> is
|
3837
|
+
done mostly for convenience, so that the user does not have to
|
3838
|
+
manually include this module.
|
3839
|
+
|
3840
|
+
## Drawing a coloured circle via CSS
|
3841
|
+
|
3842
|
+
You can draw a circle via CSS.
|
3843
|
+
|
3844
|
+
Let's first show the CSS rules for this:
|
3845
|
+
|
3846
|
+
div.circle {
|
3847
|
+
width: 300px;
|
3848
|
+
height: 300px;
|
3849
|
+
background: #2762e9;
|
3850
|
+
border-radius: 50%;
|
3851
|
+
}
|
3852
|
+
|
3853
|
+
Next you can use HTML to draw the circle:
|
3854
|
+
|
3855
|
+
<div class="circle"></div>
|
3856
|
+
|
3857
|
+
That's it.
|
3858
|
+
|
3859
|
+
I found this to be simple and potentially useful, so I added
|
3860
|
+
an API to the cyberweb project to support this.
|
3861
|
+
|
3862
|
+
The API goes like this:
|
3863
|
+
|
3864
|
+
Cyberweb.draw_circle()
|
3865
|
+
Cyberweb.draw_circle(width: 200)
|
3866
|
+
Cyberweb.draw_circle(width: 200, height: 500)
|
3867
|
+
Cyberweb.draw_circle(width: 200, height: 500, background_color: :steelblue)
|
3868
|
+
Cyberweb.draw_circle(width: 200, height: 500, background_color: :steelblue, border_radius: '30%')
|
3869
|
+
|
3870
|
+
Pass a Hash to the method. Note that this will return the CSS rule
|
3871
|
+
as-is, as well as return the div-tag String. Cyberweb::BaseModule
|
3872
|
+
will directly embed this if you use <b>draw_circle()</b>.
|
3873
|
+
|
3874
|
+
Here is a partial screenshot showing three such examples; only the
|
3875
|
+
second example has a border-radius of 50%. See also the example
|
3876
|
+
<b>cyberweb/examples/advanced/draw_circle/draw_circle.cgi</b>.
|
3877
|
+
|
3878
|
+
<img src="https://i.imgur.com/k5wFnwn.png" style="margin: 1em">
|
3879
|
+
|
3880
|
+
## JQuery
|
3881
|
+
|
3882
|
+
The Cyberweb framework/toolset favours the use of jquery. Presently,
|
3883
|
+
since **May 2021**, the version that is to be used by default will be
|
3884
|
+
for jquery <b>3.6.0</b>. This may change at a later time.
|
3885
|
+
|
3886
|
+
In the event that it is changed and the documentation here is not
|
3887
|
+
updated, you can always rely on the following method call to yield
|
3888
|
+
the correct version of jquery to be used:
|
3889
|
+
|
3890
|
+
Cyberweb.jquery_version?
|
3891
|
+
|
3892
|
+
For example, the above method called would yield **3.6.0** in
|
3893
|
+
**May 2021**. Personally I always use the latest stable
|
3894
|
+
version of jquery when possible.
|
3895
|
+
|
3896
|
+
You can also query the **jquery-ui version in use**, via:
|
3897
|
+
|
3898
|
+
Cyberweb.jquery_ui_version?
|
3899
|
+
|
3900
|
+
Again, this also has to be synced manually, via the
|
3901
|
+
.yml file called **project_configuration.yml**.
|
3902
|
+
|
3903
|
+
Since as of **May 2021**, the cyberweb will also bundle this
|
3904
|
+
corresponding version of jquery and jquery-ui into the
|
3905
|
+
**javascript_code/jquery/** subdirectory of the gem. This
|
3906
|
+
is solely done to simplify the use of jquery so that, for
|
3907
|
+
example, dragging an object becomes simpler and available
|
3908
|
+
by default, even if access to the www is unavailable at
|
3909
|
+
the current time.
|
3910
|
+
|
3911
|
+
You can also call this method on a **Cyberweb::WebObject**
|
3912
|
+
instance via the following method:
|
3913
|
+
|
3914
|
+
report_the_jquery_version_in_use
|
3915
|
+
|
3916
|
+
Both jquery-ui and jquery use the same licence as the Cyberweb
|
3917
|
+
project (MIT licence). See also this wikipedia entry if
|
3918
|
+
you want to read more about jquery and its history:
|
3919
|
+
|
3920
|
+
https://en.wikipedia.org/wiki/JQuery
|
3921
|
+
|
3922
|
+
To make a container **resizable** via the mouse, by using
|
3923
|
+
jquery, try this method:
|
3924
|
+
|
3925
|
+
jquery_resizable_via_the_mouse(id: :resizable_via_the_mouse)
|
3926
|
+
|
3927
|
+
As **id** you simply pass in the id of the HTML element at hand.
|
3928
|
+
In this case, the symbol called :resizable_via_the_mouse.
|
3929
|
+
|
3930
|
+
See also the file **JQUERY.md** for a more thorough reference.
|
3931
|
+
|
3932
|
+
Note that in **May 2021**, support for jquery is actually mildly
|
3933
|
+
deprecated. This is not set in stone and it does not mean that
|
3934
|
+
jquery support will be removed, as far as the cyberweb project
|
3935
|
+
is concerned; it is more that I want to see whether we have
|
3936
|
+
better or simpler alternatives, without being tied into jquery
|
3937
|
+
too closely.
|
3938
|
+
|
3939
|
+
The basic syntax for jquery, in javascript, goes like this:
|
3940
|
+
|
3941
|
+
$(selector).action()
|
3942
|
+
|
3943
|
+
The general rules for JQuery go along these lines, in JavaScript:
|
3944
|
+
|
3945
|
+
$(this).hide() # hides the current element.
|
3946
|
+
$("p").hide() # hides all <p> elements.
|
3947
|
+
$(".test").hide() # hides all elements with class="test".
|
3948
|
+
$("#test").hide() # hides the element with id="test".
|
3949
|
+
|
3950
|
+
Some of this is a bit cumbersome to type and use, so the Cyberweb
|
3951
|
+
project simplifies some of it.
|
3952
|
+
|
3953
|
+
For instance, rather than type out the document_ready
|
3954
|
+
functionality via $<b>(document).ready(function(){}</b>
|
3955
|
+
you can simplify this via the following method:
|
3956
|
+
|
3957
|
+
document_ready() # No arguments in this case, which is rather pointless.
|
3958
|
+
document_ready('$("h1").css("color", "lightgreen");') # ← Real usage example here.
|
3959
|
+
|
3960
|
+
This may not appear to be of a huge help, but it gets rid of a bit
|
3961
|
+
of boilerplate code, which I think is useful in its own right.
|
3962
|
+
Future changes may even simplify this further, but for now
|
3963
|
+
<b>let's keep it simple</b>.
|
3964
|
+
|
3965
|
+
## Working with HTML forms, including creating input-buttons in such a form field
|
3966
|
+
|
3967
|
+
<form>
|
3968
|
+
<input type="button" class="BG_GRAYSTD bblack1" value="Default" name="foo" onClick="test1(this.form)">
|
3969
|
+
</form>
|
3970
|
+
|
3971
|
+
<form>
|
3972
|
+
<input class="BG_GRAYSTD bblack1" type="button" value="Default" name="foo" onClick="test1(this.form)">
|
3973
|
+
</form>
|
3974
|
+
|
3975
|
+
You can style ‹input> fields with a different background colour
|
3976
|
+
upon a mouse-focus event.
|
3977
|
+
|
3978
|
+
Examples for this would be:
|
3979
|
+
|
3980
|
+
input :text, 'Hello world!', :focus_with_salmon_background
|
3981
|
+
input :text, 'Hello World!', :focus_with_salmon_background, :select_on_click
|
3982
|
+
|
3983
|
+
View the file at **cyberweb/examples/simple/input_example_with_coloured_focus.cgi**
|
3984
|
+
to see this work in action.
|
3985
|
+
|
3986
|
+
You can modify the ‹input> tag within that via css by using:
|
3987
|
+
|
3988
|
+
input.view_css {}
|
3989
|
+
|
3990
|
+
Note that ‹input type="text"> only works for a single line of
|
3991
|
+
user input. If you would like to have the user work via multiple
|
3992
|
+
lines then you have to use the ‹textarea> tag instead.
|
3993
|
+
There may be work-arounds, such as giving the text-input the
|
3994
|
+
<b>word-break: break-word;</b> attribute, but this may not work
|
3995
|
+
on every browser.
|
3996
|
+
|
3997
|
+
Some shortcuts exist within the Cyberweb project. For instance,
|
3998
|
+
rather than do:
|
3999
|
+
|
4000
|
+
input :checkbox
|
4001
|
+
|
4002
|
+
You can do:
|
4003
|
+
|
4004
|
+
input_checkbox
|
4005
|
+
|
4006
|
+
Same with submit and other variants:
|
4007
|
+
|
4008
|
+
input_submit
|
4009
|
+
input_radio
|
4010
|
+
|
4011
|
+
This may not be a huge improvement, but I wanted to offer
|
4012
|
+
it in the event that some users like to avoid using the
|
4013
|
+
<b>:</b> for the symbol.
|
4014
|
+
|
4015
|
+
Combining a label and input-text is possible via Cyberweb
|
4016
|
+
too. Examples:
|
4017
|
+
|
4018
|
+
label_and_input_text :foobar
|
4019
|
+
label_and_input_text id: :foobar
|
4020
|
+
label_and_input_text id: :foobar, :br
|
4021
|
+
label_and_input_text id: :foobar, :linebreak
|
4022
|
+
label_and_input_text id: :foobar, :middle_break
|
4023
|
+
label_and_input_text :fname, 'First name:'
|
4024
|
+
|
4025
|
+
The last variant is essentially the same as this in HTML:
|
4026
|
+
|
4027
|
+
<label for="fname">First name:</label><br>
|
4028
|
+
<input type="text" id="fname" name="fname"><br>
|
4029
|
+
|
4030
|
+
If you have a need or use case to use a checked checkbox
|
4031
|
+
then you can use a variant such as this:
|
4032
|
+
|
4033
|
+
checked_checkbox name: 'valid_ninja'
|
4034
|
+
|
4035
|
+
It may be important to specify the name parameter, as
|
4036
|
+
shown above; otherwise it can be omitted.
|
4037
|
+
|
4038
|
+
This checked checkbox looks about like this:
|
4039
|
+
|
4040
|
+
<img src="https://i.imgur.com/Fn0GasM.png" style="margin: 1em">
|
4041
|
+
|
4042
|
+
## Use image-checkbox (on and off)
|
4043
|
+
|
4044
|
+
Examples:
|
4045
|
+
|
4046
|
+
show_image_checkbox :on, 'posab','top:10em;right:18%'
|
4047
|
+
show_image_checkbox :off, 'posab','top:10em;right:18%'
|
4048
|
+
|
4049
|
+
## The CSS class called select_everything
|
4050
|
+
|
4051
|
+
This document already mentioned how to use JavaScript to select
|
4052
|
+
everything.
|
4053
|
+
|
4054
|
+
Interestingly it is possible to achieve the same nowadays, without
|
4055
|
+
JavaScript - by making use of *CSS**.
|
4056
|
+
|
4057
|
+
Cyberweb integrates this via the CSS class called <b>.select_everything</b>.
|
4058
|
+
|
4059
|
+
Simply add it to any tag and when the user clicks on it via his or her
|
4060
|
+
mouse, then all content is selected. On Linux this will also assign
|
4061
|
+
to the xorg-buffer, so you can use a one-left mouse-button click,
|
4062
|
+
and then use the middle-mouse button to paste it onto the commandline.
|
4063
|
+
Very convenient! \o/
|
4064
|
+
|
4065
|
+
## CSS tables versus original HTML tables versus flexbox and grid layouts
|
4066
|
+
|
4067
|
+
There are various possibilities to lay out HTML containers on a webpage.
|
4068
|
+
The simplest one is the old HTML table. This one worked really well.
|
4069
|
+
|
4070
|
+
Lateron we had support via simple div-tags, as well as the float element.
|
4071
|
+
Then came grid layouts and flexbox.
|
4072
|
+
|
4073
|
+
Which variant to use?
|
4074
|
+
|
4075
|
+
Well - I have consistently had problems with both grid layouts as well
|
4076
|
+
as flexbox. HTML tables, on the other hand, work really well, and so
|
4077
|
+
do CSS tables. I have no idea why, but for me CSS tables seem to be
|
4078
|
+
the best variant. Flexbox and grid lead to increased complexity,
|
4079
|
+
and always created issues for me, so I mildly deprecated using it
|
4080
|
+
instead; perhaps one day they will become simpler, but for now I
|
4081
|
+
will stick to CSS tables.
|
4082
|
+
|
4083
|
+
How to use a CSS table? Make use of <b>display: table;</b> as
|
4084
|
+
well as <b>display: table-row</b>. That way you can kind of
|
4085
|
+
**simulate** tables.
|
4086
|
+
|
4087
|
+
The following CSS rules show this:
|
4088
|
+
|
4089
|
+
.grid {
|
4090
|
+
display: table;
|
4091
|
+
border-spacing: 5px
|
4092
|
+
}
|
4093
|
+
.row {
|
4094
|
+
display: table-row
|
4095
|
+
}
|
4096
|
+
.cell {
|
4097
|
+
width: 50px;
|
4098
|
+
height: 50px;
|
4099
|
+
background: grey;
|
4100
|
+
display: table-cell;
|
4101
|
+
}
|
4102
|
+
.row div:last-child {
|
4103
|
+
background: red
|
4104
|
+
}
|
4105
|
+
|
4106
|
+
If you need to set a maximum width then the following may
|
4107
|
+
work:
|
4108
|
+
|
4109
|
+
<table style="width: 90%; table-layout: fixed">
|
4110
|
+
|
4111
|
+
|
4112
|
+
## class Cyberweb::ImagesToHtml
|
4113
|
+
|
4114
|
+
This inconspicuously small class can take a directory (as input),
|
4115
|
+
determine all images that can be found in said directory (such as .jpg,
|
4116
|
+
.png, .gif files and so forth), and then create a **.html** page that
|
4117
|
+
has entries to each of these images, thus displaying them, via the
|
4118
|
+
img-HTML tag.
|
4119
|
+
|
4120
|
+
The class supports **jquery drag** operations on every image, so that the
|
4121
|
+
user can move these images via the mouse cursor, just for a better
|
4122
|
+
visual effect, and the ability to reposition the images.
|
4123
|
+
|
4124
|
+
The <b>reason</b> why this class was written was to quickly display images
|
4125
|
+
that you have made available locally. I did not want to use an image
|
4126
|
+
viewer when I could just view this in a .html page as-is.
|
4127
|
+
|
4128
|
+
In **March 2022** the **--videos** option was added. This is used to,
|
4129
|
+
rather than gather images, gather videos. That way you can have a
|
4130
|
+
local collection of video files and have them show up in the .html
|
4131
|
+
page, in your browser. Note that actual playback tends to be limited
|
4132
|
+
to .mp4 files - I could not get older .avi files to work, for instance.
|
4133
|
+
No idea if it is possible to do so or not, so preferentially try to
|
4134
|
+
make use of .mp4 files here.
|
4135
|
+
|
4136
|
+
In <b>May 2022</b> another option was added, called -html-table. This
|
4137
|
+
will arrange the images in a HTML table layout, by default 3 images
|
4138
|
+
per row. You can use more or fewers rows though. For instance,
|
4139
|
+
to use 4 rows make use of:
|
4140
|
+
|
4141
|
+
images_to_html --table=4 # For 4 rows.
|
4142
|
+
|
4143
|
+
I tend to prefer 3 or 2 images per row, though. 2 images for smaller
|
4144
|
+
monitors; 3 images is the best, in my opinion. 4 images tends to be
|
4145
|
+
cluttered, and more than 4 is, in my opinion. not really advisable.
|
4146
|
+
|
4147
|
+
## Working with local files in HTML - input type="file"
|
4148
|
+
|
4149
|
+
You can use:
|
4150
|
+
|
4151
|
+
<input type="file">
|
4152
|
+
|
4153
|
+
To give the user a way to handle local files conveniently.
|
4154
|
+
|
4155
|
+
You can limit the file types handled by this input tag via:
|
4156
|
+
|
4157
|
+
accept="image/png, image/jpeg"
|
4158
|
+
<input type="file" accept="image/png, image/jpeg">
|
4159
|
+
|
4160
|
+
## CSS, text-shadow support and drop-shadow support
|
4161
|
+
|
4162
|
+
The CSS text-shadow can be used to simulate an engraved text.
|
4163
|
+
|
4164
|
+
If you want to have <b>shadows</b> added to a given text then
|
4165
|
+
the text-shadow CSS property may be useful. Be careful when using
|
4166
|
+
this, though, because <b>it can make the text harder to read</b> -
|
4167
|
+
so perhaps <b>use it only for some headers or larger text</b>
|
4168
|
+
rather than for all text content.
|
4169
|
+
|
4170
|
+
At any rate, let us next look at a simple example for the
|
4171
|
+
<b>h1 HTML tag</b>, how it can be styled via the text-shadow
|
4172
|
+
CSS rule:
|
4173
|
+
|
4174
|
+
h1 {
|
4175
|
+
text-shadow: 2px 2px #FF0000;
|
4176
|
+
}
|
4177
|
+
|
4178
|
+
The <b>syntax</b> used here (and in general) is as follows:
|
4179
|
+
|
4180
|
+
text-shadow: h-shadow, v-shadow, blur-radius, color
|
4181
|
+
text-shadow: 1px 1px 2px black;
|
4182
|
+
text-shadow: 2px 5px tomato; /* Note that you can also omit values, as seen here on this line. */
|
4183
|
+
|
4184
|
+
Another example, for a CSS rule:
|
4185
|
+
|
4186
|
+
.red_text_shadow {
|
4187
|
+
text-shadow: red 0 -2px;
|
4188
|
+
}
|
4189
|
+
|
4190
|
+
Strangely enough you can also re-arrange the arguments a litte bit:
|
4191
|
+
|
4192
|
+
/* colour | offset-x | offset-y | blur-radius */
|
4193
|
+
text-shadow: #fc0 1px 0 10px;
|
4194
|
+
|
4195
|
+
/* offset-x | offset-y | blur-radius | colour */
|
4196
|
+
text-shadow: 1px 1px 2px black; # This is my preferred style.
|
4197
|
+
|
4198
|
+
I do not know why they went that route, but I recommend to just
|
4199
|
+
stick to one style, and avoid the other. Seems easier to remember
|
4200
|
+
when one can be consistent about the arguments.
|
4201
|
+
|
4202
|
+
Note that <b>text-shadow</b> is not the only way you can use to modify
|
4203
|
+
text. <b>drop-shadow</b> is another CSS property that can be
|
4204
|
+
used in this regard.
|
4205
|
+
|
4206
|
+
In CSS the rule for <b>drop-shadow</b> would be as follows:
|
4207
|
+
|
4208
|
+
drop-shadow(2px 4px 8px #585858);
|
4209
|
+
|
4210
|
+
More specifically what these **four values** mean:
|
4211
|
+
|
4212
|
+
drop-shadow(offset-x offset-y blur-radius color)
|
4213
|
+
|
4214
|
+
If you make use of the **cyberweb** project then you
|
4215
|
+
can use the following API:
|
4216
|
+
|
4217
|
+
generate_drop_shadow :red, :default, 'drop_shadow_red'
|
4218
|
+
div('drop_shadow_red') {
|
4219
|
+
h3 'This part should show a drop-shadow effect - but in red'
|
4220
|
+
}
|
4221
|
+
|
4222
|
+
This would yield the following text (shown as <b>image</b>,
|
4223
|
+
for convenience):
|
4224
|
+
|
4225
|
+
<img src="https://i.imgur.com/lSDl3qt.png" style="margin-left:2em">
|
4226
|
+
|
4227
|
+
Let's look at another example:
|
4228
|
+
|
4229
|
+
generate_drop_shadow :darkblue,
|
4230
|
+
'4px 2px 4px',
|
4231
|
+
'drop_shadow_lightblue'
|
4232
|
+
div('drop_shadow_darkblue pad0px mar0px') {
|
4233
|
+
h2 dot(105, 'marr12px')+
|
4234
|
+
'Fancy Text',
|
4235
|
+
'ud mart5px'
|
4236
|
+
}
|
4237
|
+
|
4238
|
+
This would yield the following text (shown as image):
|
4239
|
+
|
4240
|
+
<img src="https://i.imgur.com/Ufs2IHl.png" style="margin-left:2em">
|
4241
|
+
|
4242
|
+
You can also use the internal CSS class called **shadow_div_without_restrictions**.
|
4243
|
+
|
4244
|
+
Give it a try on a div-element, such as via:
|
4245
|
+
|
4246
|
+
div('shadow_div_without_restrictions') {
|
4247
|
+
h2 'Hello world!'
|
4248
|
+
}
|
4249
|
+
|
4250
|
+
See also the file at
|
4251
|
+
<b>cyberweb/examples/css/shadow_example_in_CSS/shadow_example_in_CSS.cgi</b>.
|
4252
|
+
|
4253
|
+
A similar effect is shown by the following image:
|
4254
|
+
|
4255
|
+
<img src="https://i.imgur.com/96wV0Vm.png" style="margin: 1em; margin-left: 4em">
|
4256
|
+
|
4257
|
+
The important thing to look at is the border-area around the central
|
4258
|
+
div-container. You can see that it is surrounded via a border; that
|
4259
|
+
is what the CSS class <b>shadow_div1</b> is achieving.
|
4260
|
+
|
4261
|
+
Since as of <b>November 2021</b> you can also use objectified-html-tags.
|
4262
|
+
The drawback is that it is currently a bit verbose.
|
4263
|
+
|
4264
|
+
Example:
|
4265
|
+
|
4266
|
+
_ = Cyberweb.oop_h1('Batterien', 'martb1px')
|
4267
|
+
css_manager = Cyberweb::CssManager.new
|
4268
|
+
css_manager.css_rule_for_drop_shadow(:lightgreen) # Generate the CSS rule here.
|
4269
|
+
_.css_class 'martb1px drop_shadow_lightgreen' # Use the CSS rule - note the last part.
|
4270
|
+
_.css_manager 'css_rule_for_drop_shadow(:lightgreen)'
|
4271
|
+
_.add_to_pre_content css_manager.result_as_CSS_style?
|
4272
|
+
|
4273
|
+
Or simpler:
|
4274
|
+
|
4275
|
+
_ = Cyberweb.oop_h1('Batterien', 'martb1px')
|
4276
|
+
_.css_class 'martb1px drop_shadow_lightgreen'
|
4277
|
+
_.css_manager 'css_rule_for_drop_shadow(:lightgreen)'
|
4278
|
+
_.add_to_pre_content(
|
4279
|
+
Cyberweb.css_manager { css_rule_for_drop_shadow(:lightgreen) }.css_style?
|
4280
|
+
)
|
4281
|
+
|
4282
|
+
Unfortunately the second example (aka the one right above ^^^) does not
|
4283
|
+
work yet. I am not entirely certain how to enable this - ruby's
|
4284
|
+
meta-patterns begin to confuse me.
|
4285
|
+
|
4286
|
+
Since my brain is too feeble, I actually wrote a class instead
|
4287
|
+
that will autogenerate some CSS rules that can be used.
|
4288
|
+
|
4289
|
+
These CSS rules are stored in the file called **drop_shadow.css**
|
4290
|
+
and work without needing any meta-pattern or autogenerator.
|
4291
|
+
|
4292
|
+
To use these in your own scripts, do something like this:
|
4293
|
+
|
4294
|
+
p('drop_shadow_chartreuse') { ee 'Hello world!' }
|
4295
|
+
p('drop_shadow_chocolate') { ee 'Hello world!' }
|
4296
|
+
p('drop_shadow_coral') { ee 'Hello world!' }
|
4297
|
+
p('drop_shadow_cornflowerblue') { ee 'Hello world!' }
|
4298
|
+
p('drop_shadow_cornsilk') { ee 'Hello world!' }
|
4299
|
+
p('drop_shadow_cyan') { ee 'Hello world!' }
|
4300
|
+
p('drop_shadow_darkblue') { ee 'Hello world!' }
|
4301
|
+
p('drop_shadow_darkcyan') { ee 'Hello world!' }
|
4302
|
+
p('drop_shadow_darkgoldenrod') { ee 'Hello world!' }
|
4303
|
+
|
4304
|
+
This is currently hardcoded to 5px. At some point this default
|
4305
|
+
may change, but for now I think 5px is a good compromise.
|
4306
|
+
|
4307
|
+
The actual CSS rule will look like this:
|
4308
|
+
|
4309
|
+
.drop_shadow_cornflowerblue { filter: drop-shadow(5px 5px 5px cornflowerblue); }
|
4310
|
+
|
4311
|
+
This is possible for all registered HTML colours.
|
4312
|
+
|
4313
|
+
Have a look at the file <b>cyberweb/examples/advanced/advanced/drop_shadow_examples.cgi</b>
|
4314
|
+
to see how this may look like.
|
4315
|
+
|
4316
|
+
## HTML IDs
|
4317
|
+
|
4318
|
+
Each <b>HTML tag</b> may have an id entry. The id entry, in HTML, is typically
|
4319
|
+
defined like this:
|
4320
|
+
|
4321
|
+
id="some_value" # A generic example.
|
4322
|
+
<div id="some_div"><h2>Hello world!</h2></div> # A better example.
|
4323
|
+
|
4324
|
+
Which values are permissive here?
|
4325
|
+
|
4326
|
+
For HTML4 ID tokens must begin with a letter
|
4327
|
+
(which is [A-Za-z]) and <b>may</b> be followed by
|
4328
|
+
any number of letters, digits ([0-9]), hyphens
|
4329
|
+
("-"), underscores ("_"), colons (":"), and
|
4330
|
+
periods (".").
|
4331
|
+
|
4332
|
+
In August 2022 I confirmed this, via the following ID:
|
4333
|
+
|
4334
|
+
date_01.09.2022
|
4335
|
+
|
4336
|
+
So you can even use '.' characters. I note this down here
|
4337
|
+
as I tend to forget things - so this documentation here is
|
4338
|
+
a reference for me as well as for others.
|
4339
|
+
|
4340
|
+
As far as the cyberweb project is concerned, all <b>HTML
|
4341
|
+
ids</b> are registered into an array (if you use
|
4342
|
+
Cyberweb::WebObject). To then show whether you have
|
4343
|
+
duplicated IDs in a page, do use the following method:
|
4344
|
+
|
4345
|
+
show_duplicated_ids()
|
4346
|
+
|
4347
|
+
Or in a more general way, use the #debug method, like so:
|
4348
|
+
|
4349
|
+
w.debug
|
4350
|
+
|
4351
|
+
This will report whether you have a duplicated ID or not.
|
4352
|
+
|
4353
|
+
When the page is served, we will also display a little error
|
4354
|
+
message in case we have found duplicated IDs. This way we
|
4355
|
+
can notify the developer that there is some mistake in his
|
4356
|
+
page and we can correct this mistake then.
|
4357
|
+
|
4358
|
+
Have a look at the corresponding source code to see how
|
4359
|
+
this is actually implemented.
|
4360
|
+
|
4361
|
+
## .show_this_local_directory()
|
4362
|
+
|
4363
|
+
The method <b>.show_this_local_directory()</b> can be used
|
4364
|
+
to show content of a local directory. It is available for
|
4365
|
+
<b>class Cyberweb::WebObject</b>.
|
4366
|
+
|
4367
|
+
I plan to extend this in the coming weeks and months. The
|
4368
|
+
key idea is that we can use this in .cgi scripts and
|
4369
|
+
sinatra to show the content of different directories.
|
4370
|
+
|
4371
|
+
## The <mark> tag
|
4372
|
+
|
4373
|
+
You can highlight text in HTML via:
|
4374
|
+
|
4375
|
+
<p>Foo<mark>bar</mark></p>
|
4376
|
+
|
4377
|
+
## Lazy loading of HTML elements, such as the img tag
|
4378
|
+
|
4379
|
+
You can use:
|
4380
|
+
|
4381
|
+
loading=lazy
|
4382
|
+
|
4383
|
+
To load images at a later time - that is when the user
|
4384
|
+
scrolls to such an image, hence the term "<b>lazy
|
4385
|
+
loading</b>" for this functionality.
|
4386
|
+
|
4387
|
+
Let's have a look how this looks in raw HTML:
|
4388
|
+
|
4389
|
+
<img src="foobar.jpg" loading="lazy" alt="Alternative Text">
|
4390
|
+
|
4391
|
+
So all you have to do is add the part <b>loading="lazy"</b> to
|
4392
|
+
the image tag (img) at hand.
|
4393
|
+
|
4394
|
+
The Cyberweb project supports this in both the traditional way, as
|
4395
|
+
well as the OOP variant offered by cyberweb.
|
4396
|
+
|
4397
|
+
The examples for this are:
|
4398
|
+
|
4399
|
+
img 'foobar.jpg', loading: lazy
|
4400
|
+
img('foobar.jpg') { :lazy }
|
4401
|
+
|
4402
|
+
If you want to use it via the OOP variant:
|
4403
|
+
|
4404
|
+
_ = oop_image('foobar.jpg')
|
4405
|
+
_.lazy_loading # or _.lazy
|
4406
|
+
puts _ # => <img src="foobar.jpg" loading="lazy">
|
4407
|
+
|
4408
|
+
As you can see, the OOP variant of cyberweb allows us to assemble
|
4409
|
+
the desired HTML tag as-is. It may seem quite verbose, but
|
4410
|
+
remember that you also get a lot of flexibility that way.
|
4411
|
+
|
4412
|
+
## The method images_css() in class Cyberweb::WebObject
|
4413
|
+
|
4414
|
+
Sometimes you have several images and may want to apply the
|
4415
|
+
same CSS rules to all of them.
|
4416
|
+
|
4417
|
+
For instance, I use the CSS class <b>bblack1</b> which is
|
4418
|
+
equivalent to:
|
4419
|
+
|
4420
|
+
border: 1px solid black;
|
4421
|
+
|
4422
|
+
So, if I want to apply the bblack1 CSS rule to all images
|
4423
|
+
in a WebObject, I do this:
|
4424
|
+
|
4425
|
+
images_css 'bblack1'
|
4426
|
+
|
4427
|
+
Past that point all images on that particular web-object
|
4428
|
+
will have a 1px black border.
|
4429
|
+
|
4430
|
+
See the example file at
|
4431
|
+
<b>cyberweb/examples/advanced/images/global_css_rules_for_the_images.cgi</b>
|
4432
|
+
for a demo in this regard. (Not all images work; some of them
|
4433
|
+
are only available on my home system, but the other images
|
4434
|
+
should work.)
|
4435
|
+
|
4436
|
+
## links.md
|
4437
|
+
|
4438
|
+
If a file called <b>links.md</b> exists in the current working directory
|
4439
|
+
then a .cgi or sinatra application powered by cyberweb will read in the
|
4440
|
+
content of this file. Then it will display each entry in that file
|
4441
|
+
as a HTML hyperlink. I needed this functionality so that I can dynamically
|
4442
|
+
modify links displayed on a webpage, for another user of the cyberweb
|
4443
|
+
gem. So this functionality may not be hugely important for most users,
|
4444
|
+
but in case you need it, it is available.
|
4445
|
+
|
4446
|
+
## CSS Animations
|
4447
|
+
|
4448
|
+
CSS Animations are defined by keyframes.
|
4449
|
+
|
4450
|
+
Typically two transitions use used here:
|
4451
|
+
|
4452
|
+
- The keyframe for the starting value.
|
4453
|
+
- The keyframe for the ending value.
|
4454
|
+
|
4455
|
+
The general syntax goes like this:
|
4456
|
+
|
4457
|
+
@keyframes name_here {
|
4458
|
+
}
|
4459
|
+
|
4460
|
+
## Useful quotes when designing websites and web-apps
|
4461
|
+
|
4462
|
+
The following subsection collects a few <b>interesting statements</b> -
|
4463
|
+
kind of "<i>the poor man's wisdom</i>" when it comes to web-development
|
4464
|
+
and software engineering in general. Do not take any of these
|
4465
|
+
at face-value 1:1 but feel free to use any of them them as a
|
4466
|
+
starting point for **gaining new insights**.
|
4467
|
+
|
4468
|
+
"Any <b>good-enough</b> decision that can be made right now is
|
4469
|
+
still better than any 'perfect' decision that may come in
|
4470
|
+
way too late."
|
4471
|
+
|
4472
|
+
"When you are creating a website, the primary goal as a designer
|
4473
|
+
should be to get rid of the question marks users have when
|
4474
|
+
visiting that site."
|
4475
|
+
|
4476
|
+
"The most important thing a designer can do is to understand
|
4477
|
+
the basic principle of eliminating question marks that a user
|
4478
|
+
has when visiting a website. Keep things simple."
|
4479
|
+
|
4480
|
+
"If you can not make something self-evident, you should at the
|
4481
|
+
least make it self-explanatory."
|
4482
|
+
|
4483
|
+
"If a web page is going to be effective, it has to work most
|
4484
|
+
of its beautiful magic at a single glance."
|
4485
|
+
|
4486
|
+
"The average visitor rarely spends much time reading all
|
4487
|
+
content on a given web page, so focus on designing fewer
|
4488
|
+
elements that can be easily navigated, without too much
|
4489
|
+
distracting clutter."
|
4490
|
+
|
4491
|
+
"If your design forces a visitor to incur a small learning
|
4492
|
+
curve, make sure that the added value from this design
|
4493
|
+
change leads to it being worth that additional learning
|
4494
|
+
curve."
|
4495
|
+
|
4496
|
+
"Clarity trumps consistency."
|
4497
|
+
|
4498
|
+
"Each webpage should have a clear visual hierarchy."
|
4499
|
+
|
4500
|
+
"Components in a webpage that are related logically
|
4501
|
+
should also be related visually."
|
4502
|
+
|
4503
|
+
"In order to make a website 'scan-friendly', make good use of
|
4504
|
+
headings having a larger font size. The headings should
|
4505
|
+
indicate what a subsection is about."
|
4506
|
+
|
4507
|
+
"When using a heading, make them visually somewhat closer
|
4508
|
+
to the section they belong to, rather than equally spaced
|
4509
|
+
to the preceding paragraph."
|
4510
|
+
|
4511
|
+
"If you need the visitor to make a difficult choice, provide as
|
4512
|
+
much guidance as necessary - but not more. Be succinct here
|
4513
|
+
and provide only the smallest amount of information that
|
4514
|
+
will help the user."
|
4515
|
+
|
4516
|
+
"Omit needless words. Vigorous writing is concise."
|
4517
|
+
|
4518
|
+
"Try to make everything on a web-site self-explanatory or as
|
4519
|
+
close to it as possible."
|
4520
|
+
|
4521
|
+
"Navigation should ideally remain clear, simple, and consistent."
|
4522
|
+
|
4523
|
+
"It may be useful to consider using an identifier, such as a logo
|
4524
|
+
or an image, for the website, and display this e. g. on the
|
4525
|
+
upper left corner. This may help visitors identify where they
|
4526
|
+
are, in particular if they tend to use several tabs in their
|
4527
|
+
browser."
|
4528
|
+
|
4529
|
+
"If your website makes use of a menu-bar or navigation-bar,
|
4530
|
+
consider highlighting the current location that the user
|
4531
|
+
has or uses on that website."
|
4532
|
+
|
4533
|
+
"Ideally a website should convey the big picture, and make it
|
4534
|
+
clear what the site is about."
|
4535
|
+
|
4536
|
+
"If possible consider to use visual identifiers on the
|
4537
|
+
whole web-application at hand, to give visitors the
|
4538
|
+
right idea about this being a cohesive and integrated
|
4539
|
+
unit."
|
4540
|
+
|
4541
|
+
"Changing a website at a later time is not necessarily trivial.
|
4542
|
+
Some percentage of users that have grown accustomed to a
|
4543
|
+
layout will resist almost any kind of change, and even
|
4544
|
+
apparently simple changes often turn out to have
|
4545
|
+
far-reaching effects."
|
4546
|
+
|
4547
|
+
"Focus ruthlessly on fixing the most serious problems first."
|
4548
|
+
|
4549
|
+
"Make the best decision you can with the information you have."
|
4550
|
+
|
4551
|
+
## Useful Links
|
4552
|
+
|
4553
|
+
This subsection just keeps a few useful resources. This may become
|
4554
|
+
obsolete over time, so don't expect all links to work or be very
|
4555
|
+
useful. It's just a random collection really, last updated in
|
4556
|
+
**May 2021**.
|
4557
|
+
|
4558
|
+
[https://validator.w3.org/](https://validator.w3.org/)
|
4559
|
+
|
4560
|
+
[https://wiki.selfhtml.org/wiki/HTML/Tutorials/Formulare/Auswahllisten](https://wiki.selfhtml.org/wiki/HTML/Tutorials/Formulare/Auswahllisten)
|
4561
|
+
|
4562
|
+
https://paletton.com/#uid=1000u0kllllaFw0g0qFqFg0w0aF
|
4563
|
+
|
4564
|
+
https://meiert.com/en/indices/css-properties/
|
4565
|
+
|
4566
|
+
https://webdesignerwall.com/tutorials/advanced-css-menu
|
4567
|
+
|
4568
|
+
http://www.ericmeyeroncss.com/projects/01/
|
4569
|
+
|
4570
|
+
http://www.selfhtml5.org/html5-tag-systematik/
|
4571
|
+
|
4572
|
+
https://hyperstack.org/
|
4573
|
+
|
4574
|
+
Fancy CSS Tricks and Hints:
|
4575
|
+
|
4576
|
+
CSS-text effects: https://dev.to/gscode/10-cool-css-text-effects-3elk
|
4577
|
+
|
4578
|
+
Various CSS Tricks: https://catswhocode.com/css-tricks/
|
3217
4579
|
|
3218
|
-
HTML Tutorial (HTML for beginners): https://html.com/
|
4580
|
+
HTML Tutorial (HTML for beginners): [HTML Tutorial (HTML for beginners)](https://html.com/)
|
3219
4581
|
|
3220
|
-
Self-HTML: https://selfhtml.org/
|
4582
|
+
Self-HTML: [Self-HTML](https://selfhtml.org/)
|
3221
4583
|
|
3222
|
-
Fancy Scrollbars: http://www.n-son.com/scripts/jsScrolling/example2.html
|
4584
|
+
Fancy Scrollbars: [Fancy Scrollbars](http://www.n-son.com/scripts/jsScrolling/example2.html)
|
3223
4585
|
|
3224
4586
|
For a quick list (a table) of available HTML tags, you may want to visit:
|
3225
4587
|
|