From 95aca4b4d8fa62815d4bd412fff1a364f842814a Mon Sep 17 00:00:00 2001 From: Ryan Johnson Date: Thu, 29 Apr 2021 16:16:42 -0700 Subject: remove retired locales (#699) --- files/ar/_redirects.txt | 92 - files/ar/_wikihistory.json | 1813 ------------ .../conflicting/learn/css/first_steps/index.html | 45 - files/ar/conflicting/learn/css/index.html | 25 - .../learn/getting_started_with_the_web/index.html | 306 -- .../learn/javascript/objects/index.html | 425 --- files/ar/conflicting/web/guide/index.html | 99 - files/ar/conflicting/web/html/element/index.html | 600 ---- files/ar/conflicting/web/html/index.html | 89 - files/ar/games/index.html | 98 - .../3d_on_the_web/basic_theory/index.html | 126 - files/ar/games/techniques/3d_on_the_web/index.html | 113 - files/ar/games/techniques/index.html | 32 - files/ar/glossary/accessibility/index.html | 32 - files/ar/glossary/algorithm/index.html | 32 - files/ar/glossary/api/index.html | 23 - files/ar/glossary/argument/index.html | 23 - files/ar/glossary/array/index.html | 31 - files/ar/glossary/attribute/index.html | 18 - files/ar/glossary/bandwidth/index.html | 19 - files/ar/glossary/blink/index.html | 18 - files/ar/glossary/boolean/index.html | 48 - files/ar/glossary/browser/index.html | 26 - files/ar/glossary/character/index.html | 21 - files/ar/glossary/compile/index.html | 28 - files/ar/glossary/computer_programming/index.html | 21 - files/ar/glossary/cookie/index.html | 20 - files/ar/glossary/copyleft/index.html | 17 - files/ar/glossary/data_structure/index.html | 17 - files/ar/glossary/decryption/index.html | 25 - files/ar/glossary/denial_of_service/index.html | 9 - files/ar/glossary/dom/index.html | 35 - files/ar/glossary/dos_attack/index.html | 33 - files/ar/glossary/first-class_function/index.html | 15 - files/ar/glossary/forbidden_header_name/index.html | 51 - files/ar/glossary/function/index.html | 87 - files/ar/glossary/google_chrome/index.html | 35 - files/ar/glossary/gpl/index.html | 19 - files/ar/glossary/grid_areas/index.html | 78 - files/ar/glossary/hyperlink/index.html | 33 - files/ar/glossary/identifier/index.html | 18 - files/ar/glossary/index.html | 18 - files/ar/glossary/mozilla_firefox/index.html | 26 - files/ar/glossary/object/index.html | 25 - files/ar/glossary/oop/index.html | 21 - files/ar/glossary/parameter/index.html | 42 - files/ar/glossary/php/index.html | 49 - files/ar/glossary/property/index.html | 21 - files/ar/glossary/recursion/index.html | 17 - files/ar/glossary/rendering_engine/index.html | 23 - files/ar/glossary/scope/index.html | 44 - files/ar/glossary/search_engine/index.html | 29 - files/ar/glossary/semantics/index.html | 75 - files/ar/glossary/server/index.html | 30 - files/ar/glossary/string/index.html | 20 - files/ar/glossary/tag/index.html | 24 - files/ar/glossary/variable/index.html | 24 - files/ar/glossary/wai/index.html | 18 - files/ar/glossary/wrapper/index.html | 17 - files/ar/learn/accessibility/index.html | 53 - .../accessibility/what_is_accessibility/index.html | 206 -- .../how_does_the_internet_work/index.html | 117 - files/ar/learn/common_questions/index.html | 133 - .../what_is_a_web_server/index.html | 118 - files/ar/learn/css/building_blocks/index.html | 90 - .../learn/css/building_blocks/selectors/index.html | 223 -- .../type_class_and_id_selectors/index.html | 119 - files/ar/learn/css/css_layout/index.html | 77 - .../first_steps/how_css_is_structured/index.html | 179 -- files/ar/learn/css/first_steps/index.html | 46 - files/ar/learn/css/index.html | 63 - .../css/styling_text/styling_lists/index.html | 385 --- files/ar/learn/forms/index.html | 115 - files/ar/learn/front-end_web_developer/index.html | 189 -- .../css_basics/index.html | 298 -- .../dealing_with_files/index.html | 112 - .../how_the_web_works/index.html | 109 - .../html_basics/index.html | 232 -- .../learn/getting_started_with_the_web/index.html | 58 - .../installing_basic_software/index.html | 74 - .../javascript_basics/index.html | 422 --- .../what_will_your_website_look_like/index.html | 111 - files/ar/learn/html/index.html | 60 - .../getting_started/index.html | 760 ----- .../html_text_fundamentals/index.html | 657 ----- .../ar/learn/html/introduction_to_html/index.html | 61 - files/ar/learn/html/tables/index.html | 37 - files/ar/learn/index.html | 128 - .../first_steps/a_first_splash/index.html | 618 ---- files/ar/learn/javascript/first_steps/index.html | 70 - .../first_steps/useful_string_methods/index.html | 684 ----- files/ar/learn/javascript/index.html | 58 - .../ar/learn/javascript/objects/basics/index.html | 258 -- files/ar/learn/javascript/objects/index.html | 53 - .../javascript/objects/inheritance/index.html | 228 -- .../objects/object-oriented_js/index.html | 296 -- .../objects/object_prototypes/index.html | 248 -- files/ar/learn/server-side/django/index.html | 70 - .../ar/learn/server-side/express_nodejs/index.html | 77 - files/ar/learn/server-side/index.html | 58 - files/ar/mdn/about/index.html | 110 - files/ar/mdn/at_ten/index.html | 38 - files/ar/mdn/contribute/feedback/index.html | 74 - files/ar/mdn/contribute/getting_started/index.html | 107 - .../howto/create_and_edit_pages/index.html | 180 -- files/ar/mdn/contribute/howto/index.html | 16 - .../contribute/howto/report_a_problem/index.html | 22 - files/ar/mdn/contribute/howto/tag/index.html | 376 --- .../write_a_new_entry_in_the_glossary/index.html | 138 - files/ar/mdn/contribute/index.html | 38 - files/ar/mdn/guidelines/index.html | 16 - .../mdn/guidelines/writing_style_guide/index.html | 730 ----- files/ar/mdn/index.html | 28 - files/ar/mdn/tools/index.html | 15 - files/ar/mdn/yari/index.html | 26 - files/ar/mozilla/add-ons/index.html | 92 - .../webextensions/api/browsingdata/index.html | 122 - .../webextensions/api/contentscripts/index.html | 38 - .../mozilla/add-ons/webextensions/api/index.html | 53 - files/ar/mozilla/add-ons/webextensions/index.html | 131 - .../manifest.json/content_scripts/index.html | 223 -- .../add-ons/webextensions/manifest.json/index.html | 109 - .../webextensions/match_patterns/index.html | 449 --- .../what_are_webextensions/index.html | 57 - files/ar/mozilla/firefox/index.html | 72 - files/ar/mozilla/firefox/releases/index.html | 26 - files/ar/mozilla/index.html | 13 - files/ar/orphaned/heesfoord007/index.html | 55 - .../ar/orphaned/learn/how_to_contribute/index.html | 83 - files/ar/orphaned/mdn/community/index.html | 47 - .../mdn/community/whats_happening/index.html | 42 - .../howto/create_an_mdn_account/index.html | 44 - .../howto/do_a_technical_review/index.html | 68 - .../howto/do_an_editorial_review/index.html | 59 - .../howto/set_the_summary_for_a_page/index.html | 117 - .../index.html | 112 - .../ar/orphaned/mdn/tools/page_deletion/index.html | 22 - .../index.html" | 64 - .../index.html" | 32 - .../index.html" | 66 - .../index.html" | 62 - files/ar/tools/browser_console/index.html | 181 -- files/ar/tools/index.html | 209 -- files/ar/tools/page_inspector/how_to/index.html | 13 - files/ar/tools/page_inspector/index.html | 65 - files/ar/tools/storage_inspector/index.html | 112 - files/ar/tools/web_console/index.html | 45 - .../the_command_line_interpreter/index.html | 185 -- files/ar/web/accessibility/index.html | 55 - files/ar/web/api/attr/index.html | 157 - files/ar/web/api/canvas_api/index.html | 169 -- files/ar/web/api/document/designmode/index.html | 110 - files/ar/web/api/document/index.html | 461 --- files/ar/web/api/domtokenlist/index.html | 117 - files/ar/web/api/domtokenlist/length/index.html | 62 - files/ar/web/api/element/classname/index.html | 137 - files/ar/web/api/element/closest/index.html | 148 - files/ar/web/api/element/index.html | 656 ----- .../web/api/element/insertadjacenthtml/index.html | 102 - files/ar/web/api/event/index.html | 136 - files/ar/web/api/geolocation/index.html | 118 - files/ar/web/api/geolocation_api/index.html | 295 -- .../using_the_geolocation_api/index.html | 167 -- files/ar/web/api/history_api/example/index.html | 417 --- files/ar/web/api/history_api/index.html | 262 -- .../web/api/htmlelement/contenteditable/index.html | 75 - files/ar/web/api/htmlelement/index.html | 400 --- files/ar/web/api/index.html | 15 - files/ar/web/api/navigator/battery/index.html | 32 - files/ar/web/api/navigator/index.html | 155 - files/ar/web/api/node/index.html | 381 --- files/ar/web/api/node/removechild/index.html | 144 - files/ar/web/api/window/alert/index.html | 77 - .../api/window/domcontentloaded_event/index.html | 72 - files/ar/web/api/window/index.html | 708 ----- .../web/api/xsltprocessor/basic_example/index.html | 57 - files/ar/web/api/xsltprocessor/index.html | 138 - files/ar/web/css/align-content/index.html | 294 -- files/ar/web/css/attribute_selectors/index.html | 199 -- files/ar/web/css/comments/index.html | 65 - .../ar/web/css/css_animated_properties/index.html | 20 - .../basic_concepts_of_flexbox/index.html | 234 -- .../ar/web/css/css_flexible_box_layout/index.html | 119 - files/ar/web/css/css_grid_layout/index.html | 253 -- .../relationship_of_grid_layout/index.html | 624 ---- files/ar/web/css/css_writing_modes/index.html | 106 - files/ar/web/css/index.html | 91 - files/ar/web/css/order/index.html | 108 - files/ar/web/css/pointer-events/index.html | 148 - files/ar/web/css/reference/index.html | 179 -- files/ar/web/css/transform/index.html | 137 - files/ar/web/events/index.html | 2990 -------------------- files/ar/web/guide/graphics/index.html | 48 - files/ar/web/guide/html/html5/index.html | 178 -- files/ar/web/guide/index.html | 27 - files/ar/web/guide/mobile/index.html | 19 - files/ar/web/html/element/article/index.html | 154 - files/ar/web/html/element/bdo/index.html | 109 - .../web/html/element/heading_elements/index.html | 245 -- files/ar/web/html/element/index.html | 240 -- files/ar/web/html/element/input/index.html | 1380 --------- files/ar/web/html/element/input/radio/index.html | 356 --- files/ar/web/html/element/span/index.html | 123 - files/ar/web/html/element/tt/index.html | 162 -- files/ar/web/html/index.html | 91 - files/ar/web/http/basics_of_http/index.html | 51 - .../mime_types/common_types/index.html | 360 --- .../web/http/basics_of_http/mime_types/index.html | 382 --- .../connection_management_in_http_1.x/index.html | 86 - files/ar/web/http/headers/index.html | 433 --- files/ar/web/http/index.html | 79 - files/ar/web/http/overview/index.html | 167 -- files/ar/web/index.html | 93 - .../ar/web/javascript/about_javascript/index.html | 61 - .../control_flow_and_error_handling/index.html | 467 --- files/ar/web/javascript/guide/functions/index.html | 699 ----- .../javascript/guide/grammar_and_types/index.html | 680 ----- files/ar/web/javascript/guide/index.html | 116 - .../web/javascript/guide/introduction/index.html | 159 -- .../guide/loops_and_iteration/index.html | 352 --- .../guide/regular_expressions/index.html | 813 ------ .../guide/working_with_objects/index.html | 516 ---- files/ar/web/javascript/index.html | 121 - .../reference/classes/constructor/index.html | 132 - .../ar/web/javascript/reference/classes/index.html | 380 --- .../ar/web/javascript/reference/errors/index.html | 31 - .../reference/errors/unexpected_type/index.html | 68 - .../javascript/reference/functions/get/index.html | 166 -- .../web/javascript/reference/functions/index.html | 646 ----- .../reference/global_objects/array/index.html | 481 ---- .../global_objects/array/isarray/index.html | 146 - .../reference/global_objects/array/join/index.html | 143 - .../reference/global_objects/array/pop/index.html | 134 - .../global_objects/array/reverse/index.html | 124 - .../global_objects/array/slice/index.html | 151 - .../global_objects/date/getdate/index.html | 85 - .../reference/global_objects/date/index.html | 261 -- .../reference/global_objects/date/now/index.html | 80 - .../reference/global_objects/date/parse/index.html | 182 -- .../global_objects/date/setdate/index.html | 95 - .../reference/global_objects/date/utc/index.html | 133 - .../global_objects/function/call/index.html | 219 -- .../reference/global_objects/function/index.html | 183 -- .../javascript/reference/global_objects/index.html | 126 - .../reference/global_objects/json/index.html | 215 -- .../reference/global_objects/map/index.html | 358 --- .../reference/global_objects/math/index.html | 190 -- .../reference/global_objects/number/index.html | 13 - .../global_objects/object/constructor/index.html | 152 - .../reference/global_objects/object/index.html | 182 -- .../reference/global_objects/string/index.html | 314 -- .../global_objects/string/startswith/index.html | 101 - files/ar/web/javascript/reference/index.html | 50 - .../operators/destructuring_assignment/index.html | 428 --- .../web/javascript/reference/operators/index.html | 302 -- .../operators/object_initializer/index.html | 403 --- .../operators/operator_precedence/index.html | 420 --- .../web/javascript/reference/statements/index.html | 141 - .../reference/statements/return/index.html | 145 - files/ar/web/mathml/index.html | 123 - files/ar/web/reference/index.html | 43 - files/ar/web/security/index.html | 17 - files/ar/web/svg/attribute/index.html | 387 --- files/ar/web/svg/index.html | 94 - files/ar/web/tutorials/index.html | 217 -- 265 files changed, 46568 deletions(-) delete mode 100644 files/ar/_redirects.txt delete mode 100644 files/ar/_wikihistory.json delete mode 100644 files/ar/conflicting/learn/css/first_steps/index.html delete mode 100644 files/ar/conflicting/learn/css/index.html delete mode 100644 files/ar/conflicting/learn/getting_started_with_the_web/index.html delete mode 100644 files/ar/conflicting/learn/javascript/objects/index.html delete mode 100644 files/ar/conflicting/web/guide/index.html delete mode 100644 files/ar/conflicting/web/html/element/index.html delete mode 100644 files/ar/conflicting/web/html/index.html delete mode 100644 files/ar/games/index.html delete mode 100644 files/ar/games/techniques/3d_on_the_web/basic_theory/index.html delete mode 100644 files/ar/games/techniques/3d_on_the_web/index.html delete mode 100644 files/ar/games/techniques/index.html delete mode 100644 files/ar/glossary/accessibility/index.html delete mode 100644 files/ar/glossary/algorithm/index.html delete mode 100644 files/ar/glossary/api/index.html delete mode 100644 files/ar/glossary/argument/index.html delete mode 100644 files/ar/glossary/array/index.html delete mode 100644 files/ar/glossary/attribute/index.html delete mode 100644 files/ar/glossary/bandwidth/index.html delete mode 100644 files/ar/glossary/blink/index.html delete mode 100644 files/ar/glossary/boolean/index.html delete mode 100644 files/ar/glossary/browser/index.html delete mode 100644 files/ar/glossary/character/index.html delete mode 100644 files/ar/glossary/compile/index.html delete mode 100644 files/ar/glossary/computer_programming/index.html delete mode 100644 files/ar/glossary/cookie/index.html delete mode 100644 files/ar/glossary/copyleft/index.html delete mode 100644 files/ar/glossary/data_structure/index.html delete mode 100644 files/ar/glossary/decryption/index.html delete mode 100644 files/ar/glossary/denial_of_service/index.html delete mode 100644 files/ar/glossary/dom/index.html delete mode 100644 files/ar/glossary/dos_attack/index.html delete mode 100644 files/ar/glossary/first-class_function/index.html delete mode 100644 files/ar/glossary/forbidden_header_name/index.html delete mode 100644 files/ar/glossary/function/index.html delete mode 100644 files/ar/glossary/google_chrome/index.html delete mode 100644 files/ar/glossary/gpl/index.html delete mode 100644 files/ar/glossary/grid_areas/index.html delete mode 100644 files/ar/glossary/hyperlink/index.html delete mode 100644 files/ar/glossary/identifier/index.html delete mode 100644 files/ar/glossary/index.html delete mode 100644 files/ar/glossary/mozilla_firefox/index.html delete mode 100644 files/ar/glossary/object/index.html delete mode 100644 files/ar/glossary/oop/index.html delete mode 100644 files/ar/glossary/parameter/index.html delete mode 100644 files/ar/glossary/php/index.html delete mode 100644 files/ar/glossary/property/index.html delete mode 100644 files/ar/glossary/recursion/index.html delete mode 100644 files/ar/glossary/rendering_engine/index.html delete mode 100644 files/ar/glossary/scope/index.html delete mode 100644 files/ar/glossary/search_engine/index.html delete mode 100644 files/ar/glossary/semantics/index.html delete mode 100644 files/ar/glossary/server/index.html delete mode 100644 files/ar/glossary/string/index.html delete mode 100644 files/ar/glossary/tag/index.html delete mode 100644 files/ar/glossary/variable/index.html delete mode 100644 files/ar/glossary/wai/index.html delete mode 100644 files/ar/glossary/wrapper/index.html delete mode 100644 files/ar/learn/accessibility/index.html delete mode 100644 files/ar/learn/accessibility/what_is_accessibility/index.html delete mode 100644 files/ar/learn/common_questions/how_does_the_internet_work/index.html delete mode 100644 files/ar/learn/common_questions/index.html delete mode 100644 files/ar/learn/common_questions/what_is_a_web_server/index.html delete mode 100644 files/ar/learn/css/building_blocks/index.html delete mode 100644 files/ar/learn/css/building_blocks/selectors/index.html delete mode 100644 files/ar/learn/css/building_blocks/selectors/type_class_and_id_selectors/index.html delete mode 100644 files/ar/learn/css/css_layout/index.html delete mode 100644 files/ar/learn/css/first_steps/how_css_is_structured/index.html delete mode 100644 files/ar/learn/css/first_steps/index.html delete mode 100644 files/ar/learn/css/index.html delete mode 100644 files/ar/learn/css/styling_text/styling_lists/index.html delete mode 100644 files/ar/learn/forms/index.html delete mode 100644 files/ar/learn/front-end_web_developer/index.html delete mode 100644 files/ar/learn/getting_started_with_the_web/css_basics/index.html delete mode 100644 files/ar/learn/getting_started_with_the_web/dealing_with_files/index.html delete mode 100644 files/ar/learn/getting_started_with_the_web/how_the_web_works/index.html delete mode 100644 files/ar/learn/getting_started_with_the_web/html_basics/index.html delete mode 100644 files/ar/learn/getting_started_with_the_web/index.html delete mode 100644 files/ar/learn/getting_started_with_the_web/installing_basic_software/index.html delete mode 100644 files/ar/learn/getting_started_with_the_web/javascript_basics/index.html delete mode 100644 files/ar/learn/getting_started_with_the_web/what_will_your_website_look_like/index.html delete mode 100644 files/ar/learn/html/index.html delete mode 100644 files/ar/learn/html/introduction_to_html/getting_started/index.html delete mode 100644 files/ar/learn/html/introduction_to_html/html_text_fundamentals/index.html delete mode 100644 files/ar/learn/html/introduction_to_html/index.html delete mode 100644 files/ar/learn/html/tables/index.html delete mode 100644 files/ar/learn/index.html delete mode 100644 files/ar/learn/javascript/first_steps/a_first_splash/index.html delete mode 100644 files/ar/learn/javascript/first_steps/index.html delete mode 100644 files/ar/learn/javascript/first_steps/useful_string_methods/index.html delete mode 100644 files/ar/learn/javascript/index.html delete mode 100644 files/ar/learn/javascript/objects/basics/index.html delete mode 100644 files/ar/learn/javascript/objects/index.html delete mode 100644 files/ar/learn/javascript/objects/inheritance/index.html delete mode 100644 files/ar/learn/javascript/objects/object-oriented_js/index.html delete mode 100644 files/ar/learn/javascript/objects/object_prototypes/index.html delete mode 100644 files/ar/learn/server-side/django/index.html delete mode 100644 files/ar/learn/server-side/express_nodejs/index.html delete mode 100644 files/ar/learn/server-side/index.html delete mode 100644 files/ar/mdn/about/index.html delete mode 100644 files/ar/mdn/at_ten/index.html delete mode 100644 files/ar/mdn/contribute/feedback/index.html delete mode 100644 files/ar/mdn/contribute/getting_started/index.html delete mode 100644 files/ar/mdn/contribute/howto/create_and_edit_pages/index.html delete mode 100644 files/ar/mdn/contribute/howto/index.html delete mode 100644 files/ar/mdn/contribute/howto/report_a_problem/index.html delete mode 100644 files/ar/mdn/contribute/howto/tag/index.html delete mode 100644 files/ar/mdn/contribute/howto/write_a_new_entry_in_the_glossary/index.html delete mode 100644 files/ar/mdn/contribute/index.html delete mode 100644 files/ar/mdn/guidelines/index.html delete mode 100644 files/ar/mdn/guidelines/writing_style_guide/index.html delete mode 100644 files/ar/mdn/index.html delete mode 100644 files/ar/mdn/tools/index.html delete mode 100644 files/ar/mdn/yari/index.html delete mode 100644 files/ar/mozilla/add-ons/index.html delete mode 100644 files/ar/mozilla/add-ons/webextensions/api/browsingdata/index.html delete mode 100644 files/ar/mozilla/add-ons/webextensions/api/contentscripts/index.html delete mode 100644 files/ar/mozilla/add-ons/webextensions/api/index.html delete mode 100644 files/ar/mozilla/add-ons/webextensions/index.html delete mode 100644 files/ar/mozilla/add-ons/webextensions/manifest.json/content_scripts/index.html delete mode 100644 files/ar/mozilla/add-ons/webextensions/manifest.json/index.html delete mode 100644 files/ar/mozilla/add-ons/webextensions/match_patterns/index.html delete mode 100644 files/ar/mozilla/add-ons/webextensions/what_are_webextensions/index.html delete mode 100644 files/ar/mozilla/firefox/index.html delete mode 100644 files/ar/mozilla/firefox/releases/index.html delete mode 100644 files/ar/mozilla/index.html delete mode 100644 files/ar/orphaned/heesfoord007/index.html delete mode 100644 files/ar/orphaned/learn/how_to_contribute/index.html delete mode 100644 files/ar/orphaned/mdn/community/index.html delete mode 100644 files/ar/orphaned/mdn/community/whats_happening/index.html delete mode 100644 files/ar/orphaned/mdn/contribute/howto/create_an_mdn_account/index.html delete mode 100644 files/ar/orphaned/mdn/contribute/howto/do_a_technical_review/index.html delete mode 100644 files/ar/orphaned/mdn/contribute/howto/do_an_editorial_review/index.html delete mode 100644 files/ar/orphaned/mdn/contribute/howto/set_the_summary_for_a_page/index.html delete mode 100644 files/ar/orphaned/mdn/contribute/howto/write_an_article_to_help_learn_about_the_web/index.html delete mode 100644 files/ar/orphaned/mdn/tools/page_deletion/index.html delete mode 100644 "files/ar/orphaned/\330\243\330\255\330\257\330\247\330\253_\331\205\331\203\330\252\330\250\330\251_jquery/index.html" delete mode 100644 "files/ar/orphaned/\331\205\331\203\330\252\330\250\330\251_\330\254\331\212_\331\203\331\210\331\212\330\261\331\212/index.html" delete mode 100644 "files/ar/orphaned/\331\210\330\247\330\265\331\201\330\251_spellcheck_\330\247\331\204\330\254\330\257\331\212\330\257\330\251_\331\201\331\212_html5/index.html" delete mode 100644 "files/ar/orphaned/\331\210\330\247\330\265\331\201\330\251_\330\247\331\204\330\271\331\206\331\210\330\247\331\206_\331\201\331\212_html/index.html" delete mode 100644 files/ar/tools/browser_console/index.html delete mode 100644 files/ar/tools/index.html delete mode 100644 files/ar/tools/page_inspector/how_to/index.html delete mode 100644 files/ar/tools/page_inspector/index.html delete mode 100644 files/ar/tools/storage_inspector/index.html delete mode 100644 files/ar/tools/web_console/index.html delete mode 100644 files/ar/tools/web_console/the_command_line_interpreter/index.html delete mode 100644 files/ar/web/accessibility/index.html delete mode 100644 files/ar/web/api/attr/index.html delete mode 100644 files/ar/web/api/canvas_api/index.html delete mode 100644 files/ar/web/api/document/designmode/index.html delete mode 100644 files/ar/web/api/document/index.html delete mode 100644 files/ar/web/api/domtokenlist/index.html delete mode 100644 files/ar/web/api/domtokenlist/length/index.html delete mode 100644 files/ar/web/api/element/classname/index.html delete mode 100644 files/ar/web/api/element/closest/index.html delete mode 100644 files/ar/web/api/element/index.html delete mode 100644 files/ar/web/api/element/insertadjacenthtml/index.html delete mode 100644 files/ar/web/api/event/index.html delete mode 100644 files/ar/web/api/geolocation/index.html delete mode 100644 files/ar/web/api/geolocation_api/index.html delete mode 100644 files/ar/web/api/geolocation_api/using_the_geolocation_api/index.html delete mode 100644 files/ar/web/api/history_api/example/index.html delete mode 100644 files/ar/web/api/history_api/index.html delete mode 100644 files/ar/web/api/htmlelement/contenteditable/index.html delete mode 100644 files/ar/web/api/htmlelement/index.html delete mode 100644 files/ar/web/api/index.html delete mode 100644 files/ar/web/api/navigator/battery/index.html delete mode 100644 files/ar/web/api/navigator/index.html delete mode 100644 files/ar/web/api/node/index.html delete mode 100644 files/ar/web/api/node/removechild/index.html delete mode 100644 files/ar/web/api/window/alert/index.html delete mode 100644 files/ar/web/api/window/domcontentloaded_event/index.html delete mode 100644 files/ar/web/api/window/index.html delete mode 100644 files/ar/web/api/xsltprocessor/basic_example/index.html delete mode 100644 files/ar/web/api/xsltprocessor/index.html delete mode 100644 files/ar/web/css/align-content/index.html delete mode 100644 files/ar/web/css/attribute_selectors/index.html delete mode 100644 files/ar/web/css/comments/index.html delete mode 100644 files/ar/web/css/css_animated_properties/index.html delete mode 100644 files/ar/web/css/css_flexible_box_layout/basic_concepts_of_flexbox/index.html delete mode 100644 files/ar/web/css/css_flexible_box_layout/index.html delete mode 100644 files/ar/web/css/css_grid_layout/index.html delete mode 100644 files/ar/web/css/css_grid_layout/relationship_of_grid_layout/index.html delete mode 100644 files/ar/web/css/css_writing_modes/index.html delete mode 100644 files/ar/web/css/index.html delete mode 100644 files/ar/web/css/order/index.html delete mode 100644 files/ar/web/css/pointer-events/index.html delete mode 100644 files/ar/web/css/reference/index.html delete mode 100644 files/ar/web/css/transform/index.html delete mode 100644 files/ar/web/events/index.html delete mode 100644 files/ar/web/guide/graphics/index.html delete mode 100644 files/ar/web/guide/html/html5/index.html delete mode 100644 files/ar/web/guide/index.html delete mode 100644 files/ar/web/guide/mobile/index.html delete mode 100644 files/ar/web/html/element/article/index.html delete mode 100644 files/ar/web/html/element/bdo/index.html delete mode 100644 files/ar/web/html/element/heading_elements/index.html delete mode 100644 files/ar/web/html/element/index.html delete mode 100644 files/ar/web/html/element/input/index.html delete mode 100644 files/ar/web/html/element/input/radio/index.html delete mode 100644 files/ar/web/html/element/span/index.html delete mode 100644 files/ar/web/html/element/tt/index.html delete mode 100644 files/ar/web/html/index.html delete mode 100644 files/ar/web/http/basics_of_http/index.html delete mode 100644 files/ar/web/http/basics_of_http/mime_types/common_types/index.html delete mode 100644 files/ar/web/http/basics_of_http/mime_types/index.html delete mode 100644 files/ar/web/http/connection_management_in_http_1.x/index.html delete mode 100644 files/ar/web/http/headers/index.html delete mode 100644 files/ar/web/http/index.html delete mode 100644 files/ar/web/http/overview/index.html delete mode 100644 files/ar/web/index.html delete mode 100644 files/ar/web/javascript/about_javascript/index.html delete mode 100644 files/ar/web/javascript/guide/control_flow_and_error_handling/index.html delete mode 100644 files/ar/web/javascript/guide/functions/index.html delete mode 100644 files/ar/web/javascript/guide/grammar_and_types/index.html delete mode 100644 files/ar/web/javascript/guide/index.html delete mode 100644 files/ar/web/javascript/guide/introduction/index.html delete mode 100644 files/ar/web/javascript/guide/loops_and_iteration/index.html delete mode 100644 files/ar/web/javascript/guide/regular_expressions/index.html delete mode 100644 files/ar/web/javascript/guide/working_with_objects/index.html delete mode 100644 files/ar/web/javascript/index.html delete mode 100644 files/ar/web/javascript/reference/classes/constructor/index.html delete mode 100644 files/ar/web/javascript/reference/classes/index.html delete mode 100644 files/ar/web/javascript/reference/errors/index.html delete mode 100644 files/ar/web/javascript/reference/errors/unexpected_type/index.html delete mode 100644 files/ar/web/javascript/reference/functions/get/index.html delete mode 100644 files/ar/web/javascript/reference/functions/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/array/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/array/isarray/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/array/join/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/array/pop/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/array/reverse/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/array/slice/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/date/getdate/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/date/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/date/now/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/date/parse/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/date/setdate/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/date/utc/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/function/call/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/function/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/json/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/map/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/math/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/number/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/object/constructor/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/object/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/string/index.html delete mode 100644 files/ar/web/javascript/reference/global_objects/string/startswith/index.html delete mode 100644 files/ar/web/javascript/reference/index.html delete mode 100644 files/ar/web/javascript/reference/operators/destructuring_assignment/index.html delete mode 100644 files/ar/web/javascript/reference/operators/index.html delete mode 100644 files/ar/web/javascript/reference/operators/object_initializer/index.html delete mode 100644 files/ar/web/javascript/reference/operators/operator_precedence/index.html delete mode 100644 files/ar/web/javascript/reference/statements/index.html delete mode 100644 files/ar/web/javascript/reference/statements/return/index.html delete mode 100644 files/ar/web/mathml/index.html delete mode 100644 files/ar/web/reference/index.html delete mode 100644 files/ar/web/security/index.html delete mode 100644 files/ar/web/svg/attribute/index.html delete mode 100644 files/ar/web/svg/index.html delete mode 100644 files/ar/web/tutorials/index.html (limited to 'files/ar') diff --git a/files/ar/_redirects.txt b/files/ar/_redirects.txt deleted file mode 100644 index c134f42a5c..0000000000 --- a/files/ar/_redirects.txt +++ /dev/null @@ -1,92 +0,0 @@ -# DO NOT EDIT THIS FILE MANUALLY. -# Use the CLI instead: -# -# yarn content add-redirect -# -# FROM-URL TO-URL -/ar/docs/Glossary/الحروف /ar/docs/Glossary/Character -/ar/docs/Glossary/الخاصية /ar/docs/Glossary/property -/ar/docs/Glossary/الدوال_من_الدرجة_الأولى /ar/docs/Glossary/First-class_Function -/ar/docs/Glossary/الكائنات /ar/docs/Glossary/Object -/ar/docs/Glossary/المجالات /ar/docs/Glossary/Scope -/ar/docs/HTML /ar/docs/Web/HTML -/ar/docs/HTML/Element /ar/docs/Web/HTML/Element -/ar/docs/HTML/Element/article /ar/docs/Web/HTML/Element/article -/ar/docs/HTML/Element/bdo /ar/docs/Web/HTML/Element/bdo -/ar/docs/HTML/Element/headings_elements /ar/docs/Web/HTML/Element/Heading_Elements -/ar/docs/HTML/Element/span /ar/docs/Web/HTML/Element/span -/ar/docs/HTML/Element/tt /ar/docs/Web/HTML/Element/tt -/ar/docs/Learn/CSS/Introduction_to_CSS /en-US/docs/Learn/CSS/First_steps -/ar/docs/Learn/CSS/Introduction_to_CSS/How_CSS_works /en-US/docs/Learn/CSS/First_steps/How_CSS_works -/ar/docs/Learn/CSS/Introduction_to_CSS/Selectors /en-US/docs/Learn/CSS/Building_blocks/Selectors -/ar/docs/Learn/Common_questions/كيفية_عمل /ar/docs/Learn/Common_questions/How_does_the_Internet_work -/ar/docs/Learn/Getting_started_with_the_web/أساسيات_صفحات_الطرز_المتراصة /ar/docs/Learn/Getting_started_with_the_web/CSS_basics -/ar/docs/Learn/Getting_started_with_the_web/أساسيات_لغة_ترميز_النص_الفائق /ar/docs/Learn/Getting_started_with_the_web/HTML_basics -/ar/docs/Learn/Getting_started_with_the_web/التعامل_مع_الملفات /ar/docs/Learn/Getting_started_with_the_web/Dealing_with_files -/ar/docs/Learn/Getting_started_with_the_web/تثبيت_البرمجيات_الأساسية /ar/docs/Learn/Getting_started_with_the_web/Installing_basic_software -/ar/docs/Learn/Getting_started_with_the_web/كيف_يجب_أن_يبدو_موقعك /ar/docs/Learn/Getting_started_with_the_web/What_will_your_website_look_like -/ar/docs/Learn/HTML/Forms /ar/docs/Learn/Forms -/ar/docs/Learn/HTML/الجداول /ar/docs/Learn/HTML/Tables -/ar/docs/Learn/HTML/بسيطة_HTML_إنشاء_صفحة /ar/docs/conflicting/Learn/Getting_started_with_the_web -/ar/docs/Learn/HTML/مقدمة_إلى_لغة_ترميز_النص_الفائق /ar/docs/Learn/HTML/Introduction_to_HTML -/ar/docs/Learn/HTML/مقدمة_إلى_لغة_ترميز_النص_الفائق/Getting_started /ar/docs/Learn/HTML/Introduction_to_HTML/Getting_started -/ar/docs/Learn/HTML/مقدمة_إلى_لغة_ترميز_النص_الفائق/HTML_text_fundamentals /ar/docs/Learn/HTML/Introduction_to_HTML/HTML_text_fundamentals -/ar/docs/Learn/How_to_contribute /ar/docs/orphaned/Learn/How_to_contribute -/ar/docs/MDN/Community /ar/docs/orphaned/MDN/Community -/ar/docs/MDN/Community/Whats_happening /ar/docs/orphaned/MDN/Community/Whats_happening -/ar/docs/MDN/Contribute/Guidelines /ar/docs/MDN/Guidelines -/ar/docs/MDN/Contribute/Guidelines/Writing_style_guide /ar/docs/MDN/Guidelines/Writing_style_guide -/ar/docs/MDN/Contribute/Howto/Do_a_technical_review /ar/docs/orphaned/MDN/Contribute/Howto/Do_a_technical_review -/ar/docs/MDN/Contribute/Howto/Do_an_editorial_review /ar/docs/orphaned/MDN/Contribute/Howto/Do_an_editorial_review -/ar/docs/MDN/Contribute/Howto/Set_the_summary_for_a_page /ar/docs/orphaned/MDN/Contribute/Howto/Set_the_summary_for_a_page -/ar/docs/MDN/Contribute/Howto/Write_an_article_to_help_learn_about_the_Web /ar/docs/orphaned/MDN/Contribute/Howto/Write_an_article_to_help_learn_about_the_Web -/ar/docs/MDN/Contribute/Howto/إنشاء_حساب_على_شبكة_مطوري_موزيلا /ar/docs/orphaned/MDN/Contribute/Howto/Create_an_MDN_account -/ar/docs/MDN/Contribute/Howto/كيفية_إنشاء_وتحرير_الصفحات /ar/docs/MDN/Contribute/Howto/Create_and_edit_pages -/ar/docs/MDN/Contribute/Tools /ar/docs/MDN/Tools -/ar/docs/MDN/Contribute/Tools/Deleting_pages /ar/docs/orphaned/MDN/Tools/Page_deletion -/ar/docs/MDN/Feedback /ar/docs/MDN/Contribute/Feedback -/ar/docs/MDN/Getting_started /ar/docs/MDN/Contribute/Getting_started -/ar/docs/MDN/Kuma /ar/docs/MDN/Yari -/ar/docs/MDN/Tools/Deleting_pages /ar/docs/orphaned/MDN/Tools/Page_deletion -/ar/docs/MDN/User_guide /ar/docs/MDN/Tools -/ar/docs/MDN/User_guide/Deleting_pages /ar/docs/orphaned/MDN/Tools/Page_deletion -/ar/docs/MDN_at_ten /ar/docs/MDN/At_ten -/ar/docs/Mozilla/Add-ons/WebExtensions/ما_هي_امتدادات_الويب /ar/docs/Mozilla/Add-ons/WebExtensions/What_are_WebExtensions -/ar/docs/Web/API/Geolocation/Using_geolocation /ar/docs/Web/API/Geolocation_API -/ar/docs/Web/API/Geolocation/Using_geolocation/Using_the_Geolocation_API /ar/docs/Web/API/Geolocation_API/Using_the_Geolocation_API -/ar/docs/Web/API/HTMLElement.contentEditable /ar/docs/Web/API/HTMLElement/contentEditable -/ar/docs/Web/API/History_API/مثال /ar/docs/Web/API/History_API/Example -/ar/docs/Web/API/Navigator.battery /ar/docs/Web/API/Navigator/battery -/ar/docs/Web/CSS/CSS_Flexible_Box_Layout/المفاهيم_الأساسية_للصندوق_المرن /ar/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox -/ar/docs/Web/CSS/CSS_Grid_Layout/Relationship_of_Grid_Layout_arabic /ar/docs/Web/CSS/CSS_Grid_Layout/Relationship_of_Grid_Layout -/ar/docs/Web/CSS/التحول /ar/docs/Web/CSS/transform -/ar/docs/Web/CSS/التعليقات /ar/docs/Web/CSS/Comments -/ar/docs/Web/CSS/العناصر_التي_يمكن_تحريكها_باستخدام_CSS_Transitions /ar/docs/Web/CSS/CSS_animated_properties -/ar/docs/Web/Guide/CSS /ar/docs/conflicting/Learn/CSS -/ar/docs/Web/Guide/CSS/Getting_started /ar/docs/conflicting/Learn/CSS/First_steps -/ar/docs/Web/Guide/CSS/Getting_started/Readable_CSS /ar/docs/Learn/CSS/First_steps/How_CSS_is_structured -/ar/docs/Web/Guide/CSS/Getting_started/القوائم /ar/docs/Learn/CSS/Styling_text/Styling_lists -/ar/docs/Web/Guide/HTML /ar/docs/Learn/HTML -/ar/docs/Web/Guide/HTML/HTML5/HTML5_element_list /ar/docs/conflicting/Web/HTML/Element -/ar/docs/Web/Guide/HTML/مقدمة /ar/docs/Learn/HTML/Introduction_to_HTML -/ar/docs/Web/Guide/الرسومات /ar/docs/Web/Guide/Graphics -/ar/docs/Web/HTML/Element/headings_elements /ar/docs/Web/HTML/Element/Heading_Elements -/ar/docs/Web/HTML_لغة_ترميز_النص_الفائق /ar/docs/conflicting/Web/HTML -/ar/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types /ar/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types -/ar/docs/Web/JavaScript/Guide/الدوال /ar/docs/Web/JavaScript/Guide/Functions -/ar/docs/Web/JavaScript/Introduction_to_Object-Oriented_JavaScript /ar/docs/conflicting/Learn/JavaScript/Objects -/ar/docs/Web/JavaScript/Reference/Global_Objects/الارقام /ar/docs/Web/JavaScript/Reference/Global_Objects/Number -/ar/docs/Web/JavaScript/Reference/Global_Objects/رياضيات /ar/docs/Web/JavaScript/Reference/Global_Objects/Math -/ar/docs/Web/JavaScript/Reference/الدوال /ar/docs/Web/JavaScript/Reference/Functions -/ar/docs/Web/JavaScript/Reference/الدوال/get /ar/docs/Web/JavaScript/Reference/Functions/get -/ar/docs/Web/حماية /ar/docs/Web/Security -/ar/docs/Web/دروس /ar/docs/Web/Tutorials -/ar/docs/Web/مرجع. /ar/docs/Web/Reference -/ar/docs/Web_Development /ar/docs/conflicting/Web/Guide -/ar/docs/Web_Development/Mobile /ar/docs/Web/Guide/Mobile -/ar/docs/en /en-US/ -/ar/docs/heesfoord007 /ar/docs/orphaned/heesfoord007 -/ar/docs/أحداث_مكتبة_jQuery /ar/docs/orphaned/أحداث_مكتبة_jQuery -/ar/docs/مكتبة_جي_كويري /ar/docs/orphaned/مكتبة_جي_كويري -/ar/docs/واصفة_SpellCheck_الجديدة_في_HTML5 /ar/docs/orphaned/واصفة_SpellCheck_الجديدة_في_HTML5 -/ar/docs/واصفة_العنوان_في_HTML /ar/docs/orphaned/واصفة_العنوان_في_HTML diff --git a/files/ar/_wikihistory.json b/files/ar/_wikihistory.json deleted file mode 100644 index a4cec6cf97..0000000000 --- a/files/ar/_wikihistory.json +++ /dev/null @@ -1,1813 +0,0 @@ -{ - "Games": { - "modified": "2019-09-11T08:38:03.462Z", - "contributors": [ - "SphinxKnight", - "aminezouhair", - "wbamberg" - ] - }, - "Games/Techniques": { - "modified": "2019-01-17T03:24:22.867Z", - "contributors": [ - "wbamberg" - ] - }, - "Games/Techniques/3D_on_the_web": { - "modified": "2019-03-18T21:28:51.724Z", - "contributors": [ - "wbamberg" - ] - }, - "Games/Techniques/3D_on_the_web/Basic_theory": { - "modified": "2019-03-18T21:28:59.194Z", - "contributors": [ - "HusseinYounis" - ] - }, - "Glossary": { - "modified": "2019-03-23T23:11:22.322Z", - "contributors": [ - "wbamberg", - "ahmadnourallah", - "teoli" - ] - }, - "Glossary/API": { - "modified": "2020-08-25T20:10:54.712Z", - "contributors": [ - "duduindo", - "mcqueen10pr" - ] - }, - "Glossary/Accessibility": { - "modified": "2019-03-18T21:35:58.833Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Algorithm": { - "modified": "2019-03-18T21:36:28.768Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Argument": { - "modified": "2019-03-18T21:36:51.297Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Attribute": { - "modified": "2019-03-18T21:36:29.428Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Bandwidth": { - "modified": "2019-06-11T03:12:16.122Z", - "contributors": [ - "aminezouhair" - ] - }, - "Glossary/Blink": { - "modified": "2019-03-18T21:35:41.170Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Boolean": { - "modified": "2019-03-18T21:31:11.758Z", - "contributors": [ - "mestoo" - ] - }, - "Glossary/Browser": { - "modified": "2019-03-18T21:36:31.049Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Character": { - "modified": "2019-03-18T20:41:14.582Z", - "contributors": [ - "moussagigawatt" - ] - }, - "Glossary/Compile": { - "modified": "2019-03-18T21:23:37.200Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Computer_Programming": { - "modified": "2019-03-18T21:16:51.875Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Cookie": { - "modified": "2019-03-18T21:36:16.444Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Copyleft": { - "modified": "2019-03-18T21:35:36.953Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/DOM": { - "modified": "2019-03-18T20:40:48.174Z", - "contributors": [ - "moussagigawatt" - ] - }, - "Glossary/DOS_attack": { - "modified": "2019-03-18T21:36:23.407Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Data_structure": { - "modified": "2019-03-18T21:36:26.711Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Decryption": { - "modified": "2019-03-18T21:36:31.371Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Denial_of_Service": { - "modified": "2019-01-17T02:56:58.044Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/First-class_Function": { - "modified": "2019-03-18T21:43:51.692Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Forbidden_header_name": { - "modified": "2020-06-22T06:31:52.598Z", - "contributors": [ - "AboAeqab" - ] - }, - "Glossary/Function": { - "modified": "2019-03-18T21:36:11.164Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/GPL": { - "modified": "2019-03-18T21:35:39.106Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Google_Chrome": { - "modified": "2019-03-23T23:11:25.083Z", - "contributors": [ - "ahmadnourallah", - "billhiba" - ] - }, - "Glossary/Grid_Areas": { - "modified": "2020-06-28T15:51:15.774Z", - "contributors": [ - "mos528884" - ] - }, - "Glossary/Hyperlink": { - "modified": "2019-03-18T21:35:47.475Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Identifier": { - "modified": "2019-03-18T21:36:09.613Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Mozilla_Firefox": { - "modified": "2019-03-18T21:36:31.912Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/OOP": { - "modified": "2019-03-18T21:17:28.449Z", - "contributors": [ - "HeSoKa05" - ] - }, - "Glossary/Object": { - "modified": "2019-03-18T21:23:58.693Z", - "contributors": [ - "ahmadnourallah", - "yagoub76" - ] - }, - "Glossary/PHP": { - "modified": "2019-06-12T12:19:18.205Z", - "contributors": [ - "aminezouhair" - ] - }, - "Glossary/Parameter": { - "modified": "2019-03-18T21:36:56.678Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Recursion": { - "modified": "2019-03-18T21:36:11.837Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Rendering_engine": { - "modified": "2019-03-18T21:35:46.725Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Scope": { - "modified": "2019-03-18T20:58:54.465Z", - "contributors": [ - "laloshify" - ] - }, - "Glossary/Search_engine": { - "modified": "2019-03-18T21:36:28.244Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Semantics": { - "modified": "2020-08-29T02:02:08.247Z", - "contributors": [ - "M.M.J", - "ahmadnourallah" - ] - }, - "Glossary/Server": { - "modified": "2019-03-18T21:36:23.269Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/String": { - "modified": "2019-03-18T21:36:08.991Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Tag": { - "modified": "2019-03-18T21:35:59.869Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Variable": { - "modified": "2019-03-18T21:36:36.155Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/WAI": { - "modified": "2019-03-18T21:35:55.598Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/Wrapper": { - "modified": "2019-03-18T21:36:15.120Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/array": { - "modified": "2019-03-18T21:36:12.215Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Glossary/property": { - "modified": "2019-03-18T20:41:18.902Z", - "contributors": [ - "moussagigawatt" - ] - }, - "Learn": { - "modified": "2020-07-16T22:43:37.457Z", - "contributors": [ - "waleed5544", - "svarlamov", - "ahmadnourallah", - "yaser-alazem", - "atefBB", - "AbuShelbayeh", - "Andrew_Pfeiffer" - ] - }, - "Learn/Accessibility": { - "modified": "2020-07-16T22:39:55.334Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Learn/Accessibility/What_is_accessibility": { - "modified": "2020-07-16T22:40:02.857Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Learn/CSS": { - "modified": "2020-07-16T22:25:31.838Z", - "contributors": [ - "MOTZ79567", - "abdallahelmalawy", - "ashrafreda", - "chrisdavidmills" - ] - }, - "Learn/CSS/Building_blocks": { - "modified": "2020-07-16T22:28:06.517Z", - "contributors": [ - "salutis" - ] - }, - "Learn/CSS/Building_blocks/Selectors": { - "modified": "2020-07-16T22:28:34.404Z", - "contributors": [ - "mr0111240" - ] - }, - "Learn/CSS/Building_blocks/Selectors/Type_Class_and_ID_Selectors": { - "modified": "2020-07-16T22:28:38.491Z", - "contributors": [ - "Emory" - ] - }, - "Learn/CSS/CSS_layout": { - "modified": "2020-07-16T22:26:28.954Z", - "contributors": [ - "kalalmohammad", - "MNizam0802" - ] - }, - "Learn/CSS/First_steps": { - "modified": "2020-07-16T22:27:38.309Z", - "contributors": [ - "wasim1772" - ] - }, - "Learn/CSS/First_steps/How_CSS_is_structured": { - "modified": "2019-03-23T22:26:15.891Z", - "contributors": [ - "atefBB", - "Muhnad" - ] - }, - "Learn/CSS/Styling_text/Styling_lists": { - "modified": "2019-03-23T22:26:05.454Z", - "contributors": [ - "atefBB", - "EmanShaltoutTrend" - ] - }, - "Learn/Common_questions": { - "modified": "2020-07-16T22:35:21.349Z", - "contributors": [ - "ahmadnourallah", - "stephaniehobson" - ] - }, - "Learn/Common_questions/How_does_the_Internet_work": { - "modified": "2020-09-14T10:55:57.301Z", - "contributors": [ - "hichamikka", - "mestoo" - ] - }, - "Learn/Common_questions/What_is_a_web_server": { - "modified": "2020-07-16T22:35:31.003Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Learn/Forms": { - "modified": "2020-12-06T05:54:22.728Z", - "contributors": [ - "coderclouds2018" - ] - }, - "Learn/Front-end_web_developer": { - "modified": "2020-12-09T17:02:05.907Z", - "contributors": [ - "SphinxKnight", - "fffffaadiatom", - "Ghaith_Qublan", - "mohamedalisaleh501" - ] - }, - "Learn/Getting_started_with_the_web": { - "modified": "2020-07-16T22:33:48.981Z", - "contributors": [ - "EngMoathOmar", - "ahmadnourallah", - "cloudresourcemanagergoogleapis", - "chrisdavidmills" - ] - }, - "Learn/Getting_started_with_the_web/CSS_basics": { - "modified": "2020-07-16T22:34:55.259Z", - "contributors": [ - "aminezouhair", - "sami-assasa", - "ahmadnourallah" - ] - }, - "Learn/Getting_started_with_the_web/Dealing_with_files": { - "modified": "2020-07-16T22:34:31.389Z", - "contributors": [ - "ahmadnourallah", - "jwhitlock" - ] - }, - "Learn/Getting_started_with_the_web/HTML_basics": { - "modified": "2020-07-16T22:34:41.479Z", - "contributors": [ - "aminezouhair", - "ahmadnourallah", - "jwhitlock" - ] - }, - "Learn/Getting_started_with_the_web/How_the_Web_works": { - "modified": "2020-09-01T21:08:17.715Z", - "contributors": [ - "fahad43926375", - "EngMoathOmar", - "ipfinder", - "aminezouhair" - ] - }, - "Learn/Getting_started_with_the_web/Installing_basic_software": { - "modified": "2020-07-16T22:34:05.245Z", - "contributors": [ - "ahmadnourallah", - "jwhitlock" - ] - }, - "Learn/Getting_started_with_the_web/JavaScript_basics": { - "modified": "2020-07-16T22:35:07.787Z", - "contributors": [ - "Mohd-PH", - "zidanlab" - ] - }, - "Learn/Getting_started_with_the_web/What_will_your_website_look_like": { - "modified": "2020-07-16T22:34:13.678Z", - "contributors": [ - "ahmadnourallah", - "jwhitlock" - ] - }, - "Learn/HTML": { - "modified": "2020-07-16T22:22:14.487Z", - "contributors": [ - "aminezouhair", - "wasem1772", - "Alihoday", - "Andrew_Pfeiffer" - ] - }, - "Learn/HTML/Introduction_to_HTML": { - "modified": "2020-07-16T22:22:44.780Z", - "contributors": [ - "aminezouhair", - "ahmadnourallah", - "jwhitlock" - ] - }, - "Learn/HTML/Introduction_to_HTML/Getting_started": { - "modified": "2020-07-16T22:22:56.623Z", - "contributors": [ - "aminezouhair", - "ahmadnourallah", - "jwhitlock" - ] - }, - "Learn/HTML/Introduction_to_HTML/HTML_text_fundamentals": { - "modified": "2020-07-16T22:23:29.319Z", - "contributors": [ - "jwhitlock", - "ahmadnourallah" - ] - }, - "Learn/HTML/Tables": { - "modified": "2020-07-16T22:25:09.678Z", - "contributors": [ - "aminezouhair" - ] - }, - "Learn/JavaScript": { - "modified": "2020-07-16T22:29:36.627Z", - "contributors": [ - "Mohd-PH", - "Roadsky", - "amirmekk", - "chrisdavidmills" - ] - }, - "Learn/JavaScript/First_steps": { - "modified": "2020-07-16T22:29:47.870Z", - "contributors": [ - "Mohd-PH", - "SphinxKnight" - ] - }, - "Learn/JavaScript/First_steps/A_first_splash": { - "modified": "2020-11-17T07:52:07.930Z", - "contributors": [ - "heshamali", - "ibrahim.ham" - ] - }, - "Learn/JavaScript/First_steps/Useful_string_methods": { - "modified": "2020-11-07T10:08:34.284Z", - "contributors": [ - "heshamali", - "GawiSh97" - ] - }, - "Learn/JavaScript/Objects": { - "modified": "2020-07-16T22:31:47.619Z", - "contributors": [ - "aminezouhair", - "ALSULTAN", - "moatazalshabuo", - "chrisdavidmills" - ] - }, - "Learn/JavaScript/Objects/Basics": { - "modified": "2020-07-16T22:31:55.874Z", - "contributors": [ - "Youssef-Belmeskine", - "atefBB" - ] - }, - "Learn/JavaScript/Objects/Inheritance": { - "modified": "2020-07-16T22:32:11.167Z", - "contributors": [ - "Youssef-Belmeskine", - "AbrahemAlhofe", - "MohammedAlaa88" - ] - }, - "Learn/JavaScript/Objects/Object-oriented_JS": { - "modified": "2020-07-16T22:32:04.348Z", - "contributors": [ - "Youssef-Belmeskine", - "atefBB" - ] - }, - "Learn/JavaScript/Objects/Object_prototypes": { - "modified": "2020-07-16T22:32:18.432Z", - "contributors": [ - "Youssef-Belmeskine", - "MohammedAlaa88", - "atefBB" - ] - }, - "Learn/Server-side": { - "modified": "2020-07-16T22:35:55.037Z", - "contributors": [ - "moussagigawatt" - ] - }, - "Learn/Server-side/Django": { - "modified": "2020-07-18T13:31:54.614Z", - "contributors": [ - "tawfik123", - "kruschk" - ] - }, - "Learn/Server-side/Express_Nodejs": { - "modified": "2020-07-16T22:37:50.857Z", - "contributors": [ - "ckashby" - ] - }, - "MDN": { - "modified": "2020-02-19T19:23:57.984Z", - "contributors": [ - "jswisher", - "SphinxKnight", - "aminezouhair", - "wbamberg", - "ahmadnourallah", - "Jeremie", - "MoniV", - "ziyunfei" - ] - }, - "MDN/About": { - "modified": "2019-09-10T08:50:08.705Z", - "contributors": [ - "SphinxKnight", - "wbamberg", - "ahmadnourallah" - ] - }, - "MDN/At_ten": { - "modified": "2019-03-23T22:44:47.432Z", - "contributors": [ - "M.IRAQY999" - ] - }, - "MDN/Contribute": { - "modified": "2019-03-23T23:16:50.906Z", - "contributors": [ - "wbamberg", - "ahmadnourallah", - "Jeremie", - "Mars" - ] - }, - "MDN/Contribute/Feedback": { - "modified": "2020-09-30T17:50:14.200Z", - "contributors": [ - "chrisdavidmills", - "SphinxKnight", - "aminezouhair", - "wbamberg", - "ahmadnourallah" - ] - }, - "MDN/Contribute/Getting_started": { - "modified": "2020-09-30T17:08:48.786Z", - "contributors": [ - "chrisdavidmills", - "wbamberg", - "ahmadnourallah", - "Abu3safeer", - "ihanafieh", - "T9nf" - ] - }, - "MDN/Contribute/Howto": { - "modified": "2019-01-16T19:20:51.257Z", - "contributors": [ - "wbamberg", - "Jeremie", - "Sheppy" - ] - }, - "MDN/Contribute/Howto/Create_and_edit_pages": { - "modified": "2019-03-18T21:28:07.470Z", - "contributors": [ - "AhmedElhatem" - ] - }, - "MDN/Contribute/Howto/Report_a_problem": { - "modified": "2020-01-07T12:21:22.751Z", - "contributors": [ - "peterbe", - "aminezouhair" - ] - }, - "MDN/Contribute/Howto/Tag": { - "modified": "2019-09-10T11:04:17.206Z", - "contributors": [ - "wasim1772", - "wasem1772" - ] - }, - "MDN/Contribute/Howto/Write_a_new_entry_in_the_Glossary": { - "modified": "2019-06-15T16:35:07.831Z", - "contributors": [ - "aminezouhair" - ] - }, - "MDN/Guidelines": { - "modified": "2020-09-30T15:27:52.369Z", - "contributors": [ - "chrisdavidmills", - "wbamberg" - ] - }, - "MDN/Guidelines/Writing_style_guide": { - "modified": "2020-09-30T15:27:53.353Z", - "contributors": [ - "chrisdavidmills", - "jswisher", - "maherv" - ] - }, - "MDN/Tools": { - "modified": "2020-09-30T16:47:53.767Z", - "contributors": [ - "chrisdavidmills", - "wbamberg", - "Jeremie", - "Sheppy" - ] - }, - "MDN/Yari": { - "modified": "2019-09-09T15:51:34.712Z", - "contributors": [ - "SphinxKnight", - "wbamberg", - "ahmadnourallah", - "dr-m1991" - ] - }, - "Mozilla": { - "modified": "2019-03-23T23:28:10.569Z", - "contributors": [ - "Daef32", - "Sheppy" - ] - }, - "Mozilla/Add-ons": { - "modified": "2019-09-09T13:12:40.993Z", - "contributors": [ - "SphinxKnight", - "asromre1", - "MGWVc", - "mazenaliyane", - "google", - "hamada7-ym1403", - "viiiiiip123", - "Sheppy" - ] - }, - "Mozilla/Add-ons/WebExtensions": { - "modified": "2020-01-01T18:00:38.391Z", - "contributors": [ - "Anonymous", - "ahmadnourallah", - "ahmedhemada", - "mconca" - ] - }, - "Mozilla/Add-ons/WebExtensions/API": { - "modified": "2019-11-26T22:20:07.365Z", - "contributors": [ - "wbamberg", - "stephaniehobson" - ] - }, - "Mozilla/Add-ons/WebExtensions/API/browsingData": { - "modified": "2020-10-15T22:33:14.238Z", - "contributors": [ - "namma2012" - ] - }, - "Mozilla/Add-ons/WebExtensions/API/contentScripts": { - "modified": "2020-10-15T22:02:46.821Z", - "contributors": [ - "tikooooo" - ] - }, - "Mozilla/Add-ons/WebExtensions/Match_patterns": { - "modified": "2019-03-18T21:03:12.955Z", - "contributors": [ - "kremx80" - ] - }, - "Mozilla/Add-ons/WebExtensions/What_are_WebExtensions": { - "modified": "2020-01-01T17:57:33.756Z", - "contributors": [ - "Anonymous" - ] - }, - "Mozilla/Add-ons/WebExtensions/manifest.json": { - "modified": "2020-10-15T21:59:58.901Z", - "contributors": [ - "wbamberg" - ] - }, - "Mozilla/Add-ons/WebExtensions/manifest.json/content_scripts": { - "modified": "2020-10-15T21:59:55.952Z", - "contributors": [ - "wbamberg", - "ralshammrei" - ] - }, - "Mozilla/Firefox": { - "modified": "2019-09-10T14:57:18.485Z", - "contributors": [ - "SphinxKnight", - "wbamberg", - "ahmadnourallah", - "Benseidseid", - "XMKMX_1937_XMKMX", - "3Li", - "asd996" - ] - }, - "Mozilla/Firefox/Releases": { - "modified": "2020-07-19T01:50:20.887Z", - "contributors": [ - "chrisdavidmills" - ] - }, - "Tools": { - "modified": "2020-07-16T22:44:13.280Z", - "contributors": [ - "SphinxKnight", - "aminezouhair", - "irenesmith", - "hamoody", - "Rami055302" - ] - }, - "Tools/Browser_Console": { - "modified": "2020-07-16T22:35:41.935Z", - "contributors": [ - "ssa918362" - ] - }, - "Tools/Page_Inspector": { - "modified": "2020-08-05T15:30:36.106Z", - "contributors": [ - "jswisher" - ] - }, - "Tools/Page_Inspector/How_to": { - "modified": "2020-08-05T15:30:36.225Z" - }, - "Tools/Storage_Inspector": { - "modified": "2020-07-16T22:36:09.328Z", - "contributors": [ - "7to328" - ] - }, - "Tools/Web_Console": { - "modified": "2020-07-16T22:34:03.927Z", - "contributors": [ - "HeSoKa05" - ] - }, - "Tools/Web_Console/The_command_line_interpreter": { - "modified": "2020-07-16T22:34:18.356Z", - "contributors": [ - "fasol1f" - ] - }, - "Web": { - "modified": "2020-04-16T08:53:18.820Z", - "contributors": [ - "ahmadnourallah", - "hayamgamil26", - "Anonymous", - "alktub", - "aminezouhair", - "mohamed7afezz", - "walidamriou", - "antaraz", - "kadimi", - "ethertank", - "fusionchess" - ] - }, - "Web/API": { - "modified": "2019-03-23T23:12:32.062Z", - "contributors": [ - "ahmadnourallah", - "SafaAlfulaij", - "jehad1123", - "iii59300", - "Ab_sahb2011", - "nickwong" - ] - }, - "Web/API/Attr": { - "modified": "2020-10-15T22:29:41.057Z", - "contributors": [ - "joree20003" - ] - }, - "Web/API/Canvas_API": { - "modified": "2019-03-18T21:38:39.416Z", - "contributors": [ - "SafaAlfulaij" - ] - }, - "Web/API/DOMTokenList": { - "modified": "2020-10-15T22:07:40.998Z", - "contributors": [ - "xfq" - ] - }, - "Web/API/DOMTokenList/length": { - "modified": "2020-10-15T22:07:42.370Z", - "contributors": [ - "GawiSh97" - ] - }, - "Web/API/Document": { - "modified": "2019-07-30T13:32:03.743Z", - "contributors": [ - "alwayslearnedstuff" - ] - }, - "Web/API/Document/designMode": { - "modified": "2019-03-23T22:02:58.144Z", - "contributors": [ - "khaled3afan" - ] - }, - "Web/API/Element": { - "modified": "2019-03-18T21:09:03.057Z", - "contributors": [ - "fscholz", - "fvsch" - ] - }, - "Web/API/Element/className": { - "modified": "2019-03-23T22:07:01.121Z", - "contributors": [ - "Abu3safeer" - ] - }, - "Web/API/Element/closest": { - "modified": "2020-10-15T22:31:36.454Z", - "contributors": [ - "suqbit" - ] - }, - "Web/API/Element/insertAdjacentHTML": { - "modified": "2020-10-15T22:31:15.283Z", - "contributors": [ - "suqbit" - ] - }, - "Web/API/Event": { - "modified": "2019-03-23T23:00:25.185Z", - "contributors": [ - "teoli" - ] - }, - "Web/API/Geolocation": { - "modified": "2019-03-23T22:48:52.907Z", - "contributors": [ - "fscholz" - ] - }, - "Web/API/Geolocation_API": { - "modified": "2019-08-31T16:04:10.213Z", - "contributors": [ - "1043465747", - "elsisi" - ] - }, - "Web/API/Geolocation_API/Using_the_Geolocation_API": { - "modified": "2020-03-22T20:37:24.802Z", - "contributors": [ - "i7cn" - ] - }, - "Web/API/HTMLElement": { - "modified": "2019-03-23T23:00:29.058Z", - "contributors": [ - "teoli" - ] - }, - "Web/API/HTMLElement/contentEditable": { - "modified": "2019-03-23T23:12:35.618Z", - "contributors": [ - "teoli", - "Syrian-Guy" - ] - }, - "Web/API/History_API": { - "modified": "2019-03-23T22:22:50.858Z", - "contributors": [ - "SphinxKnight", - "iJianHuang" - ] - }, - "Web/API/History_API/Example": { - "modified": "2019-03-23T22:22:46.391Z", - "contributors": [ - "atefBB" - ] - }, - "Web/API/Navigator": { - "modified": "2019-03-23T22:15:21.162Z", - "contributors": [ - "Sheppy" - ] - }, - "Web/API/Navigator/battery": { - "modified": "2019-03-23T23:12:40.096Z", - "contributors": [ - "jsx", - "Syrian-Guy" - ] - }, - "Web/API/Node": { - "modified": "2020-10-15T22:29:49.949Z", - "contributors": [ - "Sheppy" - ] - }, - "Web/API/Node/removeChild": { - "modified": "2020-10-15T22:29:47.795Z", - "contributors": [ - "SphinxKnight", - "bodykabetano" - ] - }, - "Web/API/Window": { - "modified": "2020-10-15T22:32:14.260Z", - "contributors": [ - "ANH25" - ] - }, - "Web/API/Window/DOMContentLoaded_event": { - "modified": "2020-10-15T22:33:25.719Z", - "contributors": [ - "katbi89" - ] - }, - "Web/API/Window/alert": { - "modified": "2020-10-15T22:31:54.660Z", - "contributors": [ - "Sultan-Alrefaei" - ] - }, - "Web/API/XSLTProcessor": { - "modified": "2020-10-15T22:07:58.558Z", - "contributors": [ - "ExE-Boss" - ] - }, - "Web/API/XSLTProcessor/Basic_Example": { - "modified": "2019-03-18T21:28:33.053Z", - "contributors": [ - "EnasMahdy" - ] - }, - "Web/Accessibility": { - "modified": "2020-03-18T03:39:58.995Z", - "contributors": [ - "SphinxKnight", - "ahmadnourallah", - "hasabonassor" - ] - }, - "Web/CSS": { - "modified": "2019-09-11T03:31:55.318Z", - "contributors": [ - "SphinxKnight", - "ahmadnourallah", - "Qlbaz" - ] - }, - "Web/CSS/Attribute_selectors": { - "modified": "2020-10-15T22:10:15.383Z", - "contributors": [ - "zidanlab" - ] - }, - "Web/CSS/CSS_Flexible_Box_Layout": { - "modified": "2020-03-28T04:45:36.291Z", - "contributors": [ - "vnctdj" - ] - }, - "Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox": { - "modified": "2020-03-28T05:18:29.446Z", - "contributors": [ - "Mutazalhawash" - ] - }, - "Web/CSS/CSS_Grid_Layout": { - "modified": "2019-03-18T21:35:22.946Z", - "contributors": [ - "AmineBelmili", - "rachelandrew" - ] - }, - "Web/CSS/CSS_Grid_Layout/Relationship_of_Grid_Layout": { - "modified": "2019-03-18T21:35:18.134Z", - "contributors": [ - "harchaoui" - ] - }, - "Web/CSS/CSS_Writing_Modes": { - "modified": "2019-03-23T22:03:16.266Z", - "contributors": [ - "Micro-Shadi" - ] - }, - "Web/CSS/CSS_animated_properties": { - "modified": "2019-03-23T22:09:06.742Z", - "contributors": [ - "Abu3safeer" - ] - }, - "Web/CSS/Comments": { - "modified": "2019-03-23T22:09:00.996Z", - "contributors": [ - "Abu3safeer" - ] - }, - "Web/CSS/Reference": { - "modified": "2019-06-30T14:40:59.845Z", - "contributors": [ - "ESlam247" - ] - }, - "Web/CSS/align-content": { - "modified": "2020-10-17T19:46:08.545Z", - "contributors": [ - "chouaib" - ] - }, - "Web/CSS/order": { - "modified": "2020-10-15T22:25:59.036Z", - "contributors": [ - "CU1KNIGHT" - ] - }, - "Web/CSS/pointer-events": { - "modified": "2020-10-15T22:16:23.258Z", - "contributors": [ - "duduindo", - "AF555" - ] - }, - "Web/CSS/transform": { - "modified": "2020-10-15T22:06:18.420Z", - "contributors": [ - "mohamadlounnas" - ] - }, - "Web/Events": { - "modified": "2020-07-05T11:11:44.298Z", - "contributors": [ - "suqbit" - ] - }, - "Web/Guide": { - "modified": "2019-03-23T23:26:08.829Z", - "contributors": [ - "NadhirBoukhenifra", - "kadimi", - "Sheppy" - ] - }, - "Web/Guide/Graphics": { - "modified": "2019-03-18T21:43:50.204Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Web/Guide/HTML/HTML5": { - "modified": "2020-10-19T18:49:26.722Z", - "contributors": [ - "moussa32", - "teoli", - ".1234waleed", - "ess_a25", - "John.Smith" - ] - }, - "Web/Guide/Mobile": { - "modified": "2019-03-23T23:25:26.627Z", - "contributors": [ - "BenB" - ] - }, - "Web/HTML": { - "modified": "2019-09-11T08:59:54.831Z", - "contributors": [ - "SphinxKnight" - ] - }, - "Web/HTML/Element": { - "modified": "2019-09-11T08:42:21.522Z", - "contributors": [ - "SphinxKnight", - "moaz_osama_okasha", - "elzoz531", - "teoli", - "HelmiHB" - ] - }, - "Web/HTML/Element/Heading_Elements": { - "modified": "2020-10-15T22:08:39.845Z", - "contributors": [ - "SphinxKnight", - "Alhakem" - ] - }, - "Web/HTML/Element/article": { - "modified": "2020-10-15T22:31:03.274Z", - "contributors": [ - "M.M.J", - "a01273477051" - ] - }, - "Web/HTML/Element/bdo": { - "modified": "2020-10-15T22:02:29.578Z", - "contributors": [ - "SphinxKnight", - "zidanlab" - ] - }, - "Web/HTML/Element/input": { - "modified": "2020-10-15T22:35:12.617Z", - "contributors": [ - "chrisdavidmills" - ] - }, - "Web/HTML/Element/input/radio": { - "modified": "2020-10-15T22:35:10.964Z", - "contributors": [ - "mhayajneh" - ] - }, - "Web/HTML/Element/span": { - "modified": "2020-10-15T22:05:54.978Z", - "contributors": [ - "SphinxKnight", - "moaz_osama_okasha" - ] - }, - "Web/HTML/Element/tt": { - "modified": "2020-10-15T22:05:53.553Z", - "contributors": [ - "SphinxKnight", - "moaz_osama_okasha" - ] - }, - "Web/HTTP": { - "modified": "2019-12-23T16:16:43.680Z", - "contributors": [ - "syednomanfaakhir", - "aminezouhair", - "ahmadnourallah", - "ahmadmayahi" - ] - }, - "Web/HTTP/Basics_of_HTTP": { - "modified": "2019-03-18T21:20:43.883Z", - "contributors": [ - "ExE-Boss" - ] - }, - "Web/HTTP/Basics_of_HTTP/MIME_types": { - "modified": "2019-03-18T21:20:43.648Z", - "contributors": [ - "sideshowbarker" - ] - }, - "Web/HTTP/Basics_of_HTTP/MIME_types/Common_types": { - "modified": "2020-02-28T13:10:36.312Z", - "contributors": [ - "chrisdavidmills", - "SphinxKnight", - "bz-a" - ] - }, - "Web/HTTP/Connection_management_in_HTTP_1.x": { - "modified": "2020-06-22T06:07:59.299Z", - "contributors": [ - "semsm128" - ] - }, - "Web/HTTP/Headers": { - "modified": "2019-12-03T06:31:26.128Z", - "contributors": [ - "Malvoz" - ] - }, - "Web/HTTP/Overview": { - "modified": "2020-10-30T02:06:11.197Z", - "contributors": [ - "gms.2000.9.12" - ] - }, - "Web/JavaScript": { - "modified": "2020-05-08T07:16:04.132Z", - "contributors": [ - "joree20003", - "SphinxKnight", - "abdu56", - "ahmadnourallah", - "zidanlab", - "Boukhtam", - "maherv", - "DevOsamaMohamed", - "Benseidseid", - "kadimi", - "walidov", - "riva7", - "ralshammrei2", - "NISHANTSHRESHTH" - ] - }, - "Web/JavaScript/About_JavaScript": { - "modified": "2020-03-12T19:47:47.486Z", - "contributors": [ - "HeSoKa05" - ] - }, - "Web/JavaScript/Guide": { - "modified": "2020-03-12T19:42:18.289Z", - "contributors": [ - "Benseidseid", - "Naaman", - "SphinxKnight" - ] - }, - "Web/JavaScript/Guide/Control_flow_and_error_handling": { - "modified": "2020-03-12T19:45:33.664Z", - "contributors": [ - "Youssef-Belmeskine" - ] - }, - "Web/JavaScript/Guide/Functions": { - "modified": "2020-03-12T19:44:03.918Z", - "contributors": [ - "Youssef-Belmeskine", - "Benseidseid" - ] - }, - "Web/JavaScript/Guide/Grammar_and_types": { - "modified": "2020-03-12T19:42:15.788Z", - "contributors": [ - "atefBB", - "Youssef-Belmeskine", - "Benseidseid", - "Naaman", - "jwasily" - ] - }, - "Web/JavaScript/Guide/Introduction": { - "modified": "2020-03-12T19:42:21.553Z", - "contributors": [ - "Youssef-Belmeskine", - "Benseidseid", - "Naaman" - ] - }, - "Web/JavaScript/Guide/Loops_and_iteration": { - "modified": "2020-03-12T19:45:31.602Z", - "contributors": [ - "Youssef-Belmeskine" - ] - }, - "Web/JavaScript/Guide/Regular_Expressions": { - "modified": "2020-03-12T19:47:23.942Z", - "contributors": [ - "Youssef-Belmeskine", - "SafaAlfulaij" - ] - }, - "Web/JavaScript/Guide/Working_with_Objects": { - "modified": "2020-03-12T19:45:29.171Z", - "contributors": [ - "Youssef-Belmeskine", - "SphinxKnight" - ] - }, - "Web/JavaScript/Reference": { - "modified": "2020-03-12T19:39:44.947Z", - "contributors": [ - "maherv", - "LJHarb" - ] - }, - "Web/JavaScript/Reference/Classes": { - "modified": "2020-10-15T22:05:06.152Z", - "contributors": [ - "rwaldron" - ] - }, - "Web/JavaScript/Reference/Classes/constructor": { - "modified": "2020-10-15T22:05:06.518Z", - "contributors": [ - "MohammedAlaa88" - ] - }, - "Web/JavaScript/Reference/Errors": { - "modified": "2020-03-12T19:48:15.925Z", - "contributors": [ - "Sheppy" - ] - }, - "Web/JavaScript/Reference/Errors/Unexpected_type": { - "modified": "2020-03-12T19:48:14.682Z", - "contributors": [ - "mohamadlounnas" - ] - }, - "Web/JavaScript/Reference/Functions": { - "modified": "2020-03-12T19:44:04.047Z", - "contributors": [ - "Benseidseid" - ] - }, - "Web/JavaScript/Reference/Functions/get": { - "modified": "2020-10-15T22:32:22.148Z", - "contributors": [ - "abdwfawzy985" - ] - }, - "Web/JavaScript/Reference/Global_Objects": { - "modified": "2020-03-12T19:39:41.981Z", - "contributors": [ - "SphinxKnight", - "fscholz" - ] - }, - "Web/JavaScript/Reference/Global_Objects/Array": { - "modified": "2019-03-23T22:26:28.438Z", - "contributors": [ - "DevOsamaMohamed" - ] - }, - "Web/JavaScript/Reference/Global_Objects/Array/isArray": { - "modified": "2019-06-23T15:06:41.749Z", - "contributors": [ - "GawiSh97", - "DevOsamaMohamed" - ] - }, - "Web/JavaScript/Reference/Global_Objects/Array/join": { - "modified": "2019-03-23T22:26:12.736Z", - "contributors": [ - "Abu3safeer", - "DevOsamaMohamed" - ] - }, - "Web/JavaScript/Reference/Global_Objects/Array/pop": { - "modified": "2019-03-23T22:26:21.251Z", - "contributors": [ - "Dr-Rakcha" - ] - }, - "Web/JavaScript/Reference/Global_Objects/Array/reverse": { - "modified": "2019-03-23T22:26:07.581Z", - "contributors": [ - "DevOsamaMohamed" - ] - }, - "Web/JavaScript/Reference/Global_Objects/Array/slice": { - "modified": "2020-10-15T22:31:18.515Z", - "contributors": [ - "suqbit" - ] - }, - "Web/JavaScript/Reference/Global_Objects/Date": { - "modified": "2019-03-23T23:09:44.322Z", - "contributors": [ - "GawiSh97", - "bekti", - "fscholz" - ] - }, - "Web/JavaScript/Reference/Global_Objects/Date/UTC": { - "modified": "2020-10-15T22:07:16.359Z", - "contributors": [ - "GawiSh97" - ] - }, - "Web/JavaScript/Reference/Global_Objects/Date/getDate": { - "modified": "2020-10-15T22:07:16.005Z", - "contributors": [ - "GawiSh97" - ] - }, - "Web/JavaScript/Reference/Global_Objects/Date/now": { - "modified": "2020-10-15T21:56:36.366Z", - "contributors": [ - "GawiSh97", - "Abu3safeer" - ] - }, - "Web/JavaScript/Reference/Global_Objects/Date/parse": { - "modified": "2020-10-15T22:07:15.028Z", - "contributors": [ - "GawiSh97" - ] - }, - "Web/JavaScript/Reference/Global_Objects/Date/setDate": { - "modified": "2020-10-15T22:07:16.408Z", - "contributors": [ - "GawiSh97" - ] - }, - "Web/JavaScript/Reference/Global_Objects/Function": { - "modified": "2020-10-15T22:05:05.412Z", - "contributors": [ - "danielsamuels" - ] - }, - "Web/JavaScript/Reference/Global_Objects/Function/call": { - "modified": "2020-10-15T22:05:04.168Z", - "contributors": [ - "ViNoS-ab", - "Youssef-Belmeskine", - "MohammedAlaa88" - ] - }, - "Web/JavaScript/Reference/Global_Objects/JSON": { - "modified": "2019-03-23T23:01:55.663Z", - "contributors": [ - "Mingun" - ] - }, - "Web/JavaScript/Reference/Global_Objects/Map": { - "modified": "2020-10-15T22:31:39.296Z", - "contributors": [ - "mohamed.yahya.zakria73" - ] - }, - "Web/JavaScript/Reference/Global_Objects/Math": { - "modified": "2020-10-15T22:14:04.029Z", - "contributors": [ - "SphinxKnight", - "ALSULTAN" - ] - }, - "Web/JavaScript/Reference/Global_Objects/Number": { - "modified": "2020-10-10T09:54:31.841Z", - "contributors": [ - "Flemer" - ] - }, - "Web/JavaScript/Reference/Global_Objects/Object": { - "modified": "2020-10-15T22:05:05.541Z", - "contributors": [ - "stmoreau" - ] - }, - "Web/JavaScript/Reference/Global_Objects/Object/constructor": { - "modified": "2020-10-15T22:05:03.728Z", - "contributors": [ - "MohammedAlaa88" - ] - }, - "Web/JavaScript/Reference/Global_Objects/String": { - "modified": "2020-10-15T21:56:27.422Z", - "contributors": [ - "Qrsan", - "fscholz" - ] - }, - "Web/JavaScript/Reference/Global_Objects/String/startsWith": { - "modified": "2020-10-15T22:22:14.192Z", - "contributors": [ - "Mourad_Ouchane" - ] - }, - "Web/JavaScript/Reference/Operators": { - "modified": "2020-12-14T11:30:35.207Z", - "contributors": [ - "Arous" - ] - }, - "Web/JavaScript/Reference/Operators/Destructuring_assignment": { - "modified": "2020-10-15T22:30:09.713Z", - "contributors": [ - "hasheemeg" - ] - }, - "Web/JavaScript/Reference/Operators/Object_initializer": { - "modified": "2020-03-12T19:45:32.164Z", - "contributors": [ - "poode", - "Youssef-Belmeskine" - ] - }, - "Web/JavaScript/Reference/Operators/Operator_Precedence": { - "modified": "2020-03-12T19:49:40.482Z", - "contributors": [ - "suqbit" - ] - }, - "Web/JavaScript/Reference/Statements": { - "modified": "2020-03-12T19:44:08.522Z", - "contributors": [ - "fscholz" - ] - }, - "Web/JavaScript/Reference/Statements/return": { - "modified": "2020-11-23T19:27:26.302Z", - "contributors": [ - "skarfstri" - ] - }, - "Web/MathML": { - "modified": "2019-03-23T22:01:47.703Z", - "contributors": [ - "ahmadnourallah" - ] - }, - "Web/Reference": { - "modified": "2020-09-14T07:03:21.633Z", - "contributors": [ - "coderclouds2018", - "ashqaljnoob07", - "Syrian-Guy" - ] - }, - "Web/SVG": { - "modified": "2019-03-23T23:09:34.687Z", - "contributors": [ - "plgatto" - ] - }, - "Web/SVG/Attribute": { - "modified": "2019-03-23T23:09:27.790Z", - "contributors": [ - "stevenvachon" - ] - }, - "Web/Security": { - "modified": "2019-09-10T16:31:27.104Z", - "contributors": [ - "SphinxKnight", - "aminezouhair" - ] - }, - "Web/Tutorials": { - "modified": "2019-03-23T22:49:35.256Z", - "contributors": [ - "sami-assasa", - "ahmadnourallah", - "jwhitlock", - "hamza-mostafa", - "antaraz" - ] - }, - "conflicting/Learn/CSS": { - "modified": "2019-03-23T23:26:10.869Z", - "contributors": [ - "Sheppy" - ] - }, - "conflicting/Learn/CSS/First_steps": { - "modified": "2019-03-23T22:26:23.175Z", - "contributors": [ - "wjinca" - ] - }, - "conflicting/Learn/Getting_started_with_the_web": { - "modified": "2020-07-16T22:22:26.344Z", - "contributors": [ - "wbamberg", - "mubarak823", - "mhmdiaa" - ] - }, - "conflicting/Learn/JavaScript/Objects": { - "modified": "2020-03-12T19:44:59.681Z", - "contributors": [ - "HeSoKa05", - "Youssef-Belmeskine", - "mustafasalah" - ] - }, - "conflicting/Web/Guide": { - "modified": "2019-03-23T23:25:33.143Z", - "contributors": [ - "ethertank" - ] - }, - "conflicting/Web/HTML": { - "modified": "2019-09-11T08:10:23.337Z", - "contributors": [ - "SphinxKnight", - "aminezouhair", - "ahmadnourallah", - "antaraz" - ] - }, - "conflicting/Web/HTML/Element": { - "modified": "2019-03-23T23:14:56.560Z", - "contributors": [ - "Abu3safeer", - "atefBB", - "mohamedmahmoud", - "teoli", - "Ali.Talib" - ] - }, - "orphaned/Learn/How_to_contribute": { - "modified": "2020-07-16T22:33:42.427Z", - "contributors": [ - "SphinxKnight", - "ahmadnourallah" - ] - }, - "orphaned/MDN/Community": { - "modified": "2019-03-23T22:39:46.468Z", - "contributors": [ - "wbamberg", - "ahmadnourallah", - "Jeremie", - "1071432726" - ] - }, - "orphaned/MDN/Community/Whats_happening": { - "modified": "2019-06-11T03:43:32.787Z", - "contributors": [ - "aminezouhair" - ] - }, - "orphaned/MDN/Contribute/Howto/Create_an_MDN_account": { - "modified": "2019-06-11T03:35:08.931Z", - "contributors": [ - "aminezouhair", - "wbamberg", - "ahmadnourallah", - "mhmdiaa", - "Syrian-Guy" - ] - }, - "orphaned/MDN/Contribute/Howto/Do_a_technical_review": { - "modified": "2019-06-10T14:47:38.844Z", - "contributors": [ - "aminezouhair", - "wbamberg", - "ashqaljnoob" - ] - }, - "orphaned/MDN/Contribute/Howto/Do_an_editorial_review": { - "modified": "2019-06-15T16:26:58.954Z", - "contributors": [ - "aminezouhair" - ] - }, - "orphaned/MDN/Contribute/Howto/Set_the_summary_for_a_page": { - "modified": "2020-02-14T19:30:29.921Z", - "contributors": [ - "a0m0rajab", - "maherv" - ] - }, - "orphaned/MDN/Contribute/Howto/Write_an_article_to_help_learn_about_the_Web": { - "modified": "2020-02-28T22:26:02.885Z", - "contributors": [ - "aminezouhair" - ] - }, - "orphaned/MDN/Tools/Page_deletion": { - "modified": "2020-09-30T16:47:53.745Z", - "contributors": [ - "chrisdavidmills", - "wbamberg", - "Jeremie", - "Bettr", - "iii59300" - ] - }, - "orphaned/heesfoord007": { - "modified": "2019-03-23T22:50:44.174Z", - "contributors": [ - "heesfoord007" - ] - }, - "orphaned/أحداث_مكتبة_jQuery": { - "modified": "2019-03-23T23:08:54.898Z", - "contributors": [ - "Syrian-Guy" - ] - }, - "orphaned/مكتبة_جي_كويري": { - "modified": "2019-03-23T23:08:46.056Z", - "contributors": [ - "Syrian-Guy" - ] - }, - "orphaned/واصفة_SpellCheck_الجديدة_في_HTML5": { - "modified": "2019-03-23T23:11:43.327Z", - "contributors": [ - "Syrian-Guy" - ] - }, - "orphaned/واصفة_العنوان_في_HTML": { - "modified": "2019-03-23T23:11:41.974Z", - "contributors": [ - "Syrian-Guy" - ] - } -} diff --git a/files/ar/conflicting/learn/css/first_steps/index.html b/files/ar/conflicting/learn/css/first_steps/index.html deleted file mode 100644 index 523fc257b0..0000000000 --- a/files/ar/conflicting/learn/css/first_steps/index.html +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: Getting started with CSS -slug: conflicting/Learn/CSS/First_steps -tags: - - Beginner - - CSS - - CSS:Getting_Started - - Guide - - Needs - - NeedsBeginnerUpdate - - NeedsTranslation - - NeedsUpdate - - TopicStub - - Web -translation_of: Learn/CSS/First_steps -translation_of_original: Web/Guide/CSS/Getting_started -original_slug: Web/Guide/CSS/Getting_started ---- -

This tutorial introduces you to the basic features and language (the syntax) for Cascading Style Sheets (CSS). You use CSS to change the look of a structured document, such as a web page. The tutorial also includes sample exercises you can try on your own computer to see the effects of CSS and features that work in modern browsers.

-

The tutorial is for beginners and anyone who would like to review the basics of CSS. If you have more experience with CSS, the CSS main page lists more advanced resources.

- -

What you need to get started

-
    -
  • A text editor
  • -
  • A modern browser
  • -
  • Some experience working with a text editor and browser
  • -
-

Although the exercises can help you learn, you are not required to complete them. You can simply read the tutorial and look at the pictures.

-

Note: The tutorial covers how CSS works with color. It will be easier to complete these sections with a color display and normal color vision.

-

How to use this tutorial

-

To use this tutorial, read the pages carefully and in sequence. If you skip a page, it may be difficult to understand pages later in the tutorial.

-

Part I: The Basics of CSS

-

On each page, use the Information section to understand how CSS works. Use the Action section to try using CSS on your own computer.

-

To test your understanding, take the challenge at the end of each page. Solutions to the challenges are linked under the challenges, so you don't need to look at them if you don't want to.

-

To understand CSS in more depth, read the information that you find in boxes captioned More details. Use the links there to find reference information about CSS.

-

Part II: The Scope of CSS

-

A second part of the tutorial provides examples, which show the scope of CSS with other web and Mozilla technologies.

-
    -
  1. JavaScript
  2. -
  3. SVG graphics
  4. -
  5. XML data
  6. -
  7. XBL bindings
  8. -
  9. XUL user interfaces
  10. -
diff --git a/files/ar/conflicting/learn/css/index.html b/files/ar/conflicting/learn/css/index.html deleted file mode 100644 index 134aff0622..0000000000 --- a/files/ar/conflicting/learn/css/index.html +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: CSS developer guide -slug: conflicting/Learn/CSS -tags: - - CSS - - Guide - - Landing - - NeedsTranslation - - TopicStub -translation_of: Learn/CSS -translation_of_original: Web/Guide/CSS -original_slug: Web/Guide/CSS ---- -

{{draft}}

-

Cascading Style Sheets (CSS) is a stylesheet language used to describe the presentation of a document written in HTML or other markup languages such as SVG. CSS describes how the structured elements in the document are to be rendered on screen, on paper, in speech, or on other media. The ability to adjust the document's presentation depending on the output medium is a key feature of CSS.

-

CSS is one of the core languages of the open Web and has a standardized W3C specification.

-

{{LandingPageListSubpages}}

-

Pages elsewhere

-

Here are other pages related to CSS that should be linked to from here.

-

See also

- diff --git a/files/ar/conflicting/learn/getting_started_with_the_web/index.html b/files/ar/conflicting/learn/getting_started_with_the_web/index.html deleted file mode 100644 index f1c63a6ed4..0000000000 --- a/files/ar/conflicting/learn/getting_started_with_the_web/index.html +++ /dev/null @@ -1,306 +0,0 @@ ---- -title: إنشاء صفحة HTML بسيطة -slug: conflicting/Learn/Getting_started_with_the_web -tags: - - البداية -translation_of: Learn/Getting_started_with_the_web -translation_of_original: Learn/HTML/Write_a_simple_page_in_HTML -original_slug: Learn/HTML/بسيطة_HTML_إنشاء_صفحة ---- -
-

فى هذا المقال سوف تتعلم كيق تنشئ صفحة ويب بسيطة باستخدام {{Glossary("HTML")}}

-
- - - - - - - - - - - - -
المتطلبات الأساسية:يجب ان يكون لديك محرر نصوص و أن تعلم كيف  كيف تفتح ملف فى متصفح.
الهدف:إنشاء صفحة ويب يمكنك عرضها باستخدام متصفحك.
- -

الملخص

- -

أن أبسط صفحة ويب هى فقط ملف {{Glossary("HTML")}} . فقط ملف HTML صحيح واحد موجود على حاسبك و متصفح ويب هى كل ما تحتاجه. سوف نرى كبف كيف يمكن استخدام HTML {{Glossary("Tag","tags")}} و سوف تكون فادر على عرض الصفحة التى أنشأتها فى متصفحك.

- -

التعلم النشط

- -

أول شئ؛ تأكد أنه يوجد لديك محرر نصوص تجيد استخدامه و متصفح ويب. على الأغلب أى محرر نصوص سوف يكون كافى؛ على سبيل المثال Notepad فى Windows أو TextEdit فى Mac ؛ ولكن تأكد أنك ستنشئ ملفات نصوص بسيطة (حروف فقط بدون تنسيق). إذا كنت تستخدم TextEdit فى Mac يمكنك اختيار "Make Plain Text" من قائمة "Format".

- -

الخطوة الأولى: ملف

- -

صفحة الويب الواحدة تتكون (على الأقل) من ملف HTML ؛ لذلك سنبدأ بإنشاء واحد. قم بفتح محرر النصوص و قم بإنشاء ملف نصى ؛ ثم اكتب شئ مثل هذا:

- -
<!DOCTYPE html>
-<html>
-<head>
-  <title>Hi there</title>
-</head>
-<body>
-  This is a page
-  a simple page
-</body>
-</html>
- -

يمكنك تعديل هذا كما تشاء؛ أنت حر فى أن تضيف أو تغير النص بين وسمى <title></title> و <body></body>. تأكد أن تعطى الملف اسم ينتهى بالإضافة ".html" . على سبيل المثال يمكنك تسميتها "my_page.html".

- -

الآن لديك ملف على حاسبك ؛ من الممكن أن يكون شكله يشبه هذا (هذا يتوقف على نظام التشغيل الذى تستخدمه) :

- -

Screenshot of a file explorer with a html file for local test

- -

إذا قمت فقط بالضغط مرتين على هذا الملف سوف يُفتح فى متصفحك. إذا أردت فتحه فى محرر النصوص لتعديله قم بالضغط عليه بزر الفأرة الأيمن و اختر فتح الملف فى محرر النصوص. (أو قم بسحبه و إفلاته فى المحرر؛ أو قم بفتح الملف باختيار "open" من قائمة "File" فى المحرر.) ,حسب محررك الملف سوف يبدو مثل هذا:

- -

Screenshot of a file explorer with a html file for local test

- -

الخطوة الثانية: متصفح ويب

- -

داخل متصفح الملفات الخاص بك(مثل Explorer فى Windows؛ أو Finder فى Mac أو Files فى Ubuntu)، اعثر على الملف الذى أنشأته و قم بفتحه فى متصفحك (بالضغط عليه مرتين؛ أو سحبه و إفلاته على أيقونة المتصفح) الآن المتصفح يعرض النص من ملف HTML الذى أنشأته والتبويب يعرض عنوان الصفحة. هذا يجب أن يشبه هذا؛ حسب نظام تشغيلك و متصفحك:

- -

Screenshot of a file explorer with a html file for local test

- -

يمكنك أن ترى محتوى جسم الصفحة (بين وسمى <body></body>)؛ و العنوان الذى اخترته (بين وسمى <title></title>) يظهر فى التبويب ولكن لا يوجد فاصل بين سطرى النص. شئ مثير للاهتمام.

- -

الخطوة الثالثة: التجربة والتعلم

- -

جرب أن تحذف بعض أجزاء ملف HTML وشاهد ما يحدث. بعض الأخطاء لن تؤثر كثيرًا والصفحة ستظل قابلة للعرض فى المتصفح، البعض الاَخر سوف يسبب مشاكل واضحة للنتائج. هذا يحدث لأن المتصفحات تحاول أن تعوض عن بعض الأخطاء الشائعة.

- -

 

- -

لشيء الذي يجب أن تلاحظه هو أن الشيء الوحيد الذي تراه معروضًا على الشاشة هو النص الذي ليس داخل أقواس الزاوية (والمعروف باسم الرموز الأكبر من وأقل من الرموز ، ولكننا نسميها أقواس معقوفة عند الحديث عن HTML). كل شيء داخل الأقواس الزاوية هو {{Glossary ("tag")}} ، والذي يمثل البنية أو الهيكل العظمي لصفحة الويب الخاصة بك. يظهر كل المحتوى المعروض بين العلامات.

- -

تحتوي صفحة HTML الخاصة بنا كمثال على قسمين رئيسيين: رأس ، ومضمون في كتلة {{HTMLElement ("head")}} ، وهيئة ، موجودة داخل {{HTMLElement ("body")}}. يحتوي النص على النص المعروض داخل الصفحة.

- -

لكل علامة معنى محدد ويجب استخدامها وفقًا لذلك ؛ على سبيل المثال ، يتم استخدام {{HTMLElement ("title")}} للإشارة إلى عنوان الصفحة ، والذي قد يختلف عن اسم الملف. لاحظ أيضًا أن العلامات يمكن أن تحدث داخل محتوى علامات أخرى. يتم تضمين {{HTMLElement ("title")}} داخل {@ HTMLElement ("head")}} ، على سبيل المثال.

- -

إذا كنت تريد إضافة شيء ما مثل صورة إلى صفحتك ، فستحتاج إلى إضافة علامة للصورة والصورة نفسها. فمثلا:

- -

 

- -
<!DOCTYPE html>
-<html>
-<head>
-  <title>Hi there</title>
-</head>
-<body>
-  This is a page
-  a simple page
-  <img src="unicorn_pic.png" alt="Unicorn picture :)" />
-  now with a unicorn
-</body>
-</html>
- -

عدّل ملفك ليتضمن علامة {{HTMLElement ("img")}} ، على النحو التالي:

- -
<img src="unicorn_pic.png" alt="Unicorn picture :)" />
- -

 

- -

يمكن أن تذهب إلى أي مكان داخل {{HTMLElement ("body")}}. لا تنس حفظ الصفحة التي تم تغييرها!

- -

ثم ضع ملفًا باسم "unicorn_pic.png" في المجلد نفسه كملف HTML. عند تحديث نافذة المتصفح (أو إعادة فتح ملف HTML في متصفحك) ، يجب أن تشاهد المحتوى الذي تم تغييره ، مع استكمال يونيكورن! (لا تنس حفظ صفحتك).

- -

 

- -

Original file for the unicorn image

- -
-

ملاحظة: يمكنك الحصول على نسخة من صورة يونيكورن لاستخدامها في تجاربك عن طريق النقر بزر الماوس الأيمن فوق الصورة واختيار خيار "حفظ الصورة باسم ..." من القائمة التي تظهر.

-
- -

The files needed for this page to work now look something like this in your desktop:

- -

Screenshot of the explorer with 2 files : a html file and a picture file

- -

تبدو الملفات المطلوبة لهذه الصفحة الآن تبدو كشيء من هذا القبيل في سطح المكتب الخاص بك:

- -

Screenshot for the example with a picture

- -

 

- -

ربما لاحظت أن علامة {{HTMLElement ("img")}} تحتوي على {{Glossary ("attribute", "attributes")}} التي توفر معلومات إضافية مطلوبة لبناء الكائن المطلوب ، وفي هذه الحالة ، اسم الملف الصورة التي سيتم عرضها والنص البديل الذي سيتم عرضه عندما يتعذر تحميل الصورة.

- -

هذا مثال على كيفية إضافة صورة إلى صفحتك ، ولكن يمكنك استخدام تقنيات مشابهة لإضافة الموسيقى ومقاطع الفيديو والمزيد ، وكل ذلك باستخدام لا شيء أكثر من HTML.
-  

- -

 

- -

الغوص أعمق
- هذه ليست صفحة ويب جميلة جدا
- كما قد تكون لاحظت ، هذه الصفحة ليست معجزة بالتصميم والجمال. وذلك لأن HTML تدور حول المحتوى وما يعنيه المحتوى (من حيث السياق والعلاقات بين كتل المحتوى) ، بدلاً من التصميم.

- -

يمكّنك {{Glossary ("CSS")}} من جعل المحتوى يتألق ، وذلك بإضافة التخطيط واللون والخطوط وما إلى ذلك. إن HTML الخالص جيد بما يكفي لصنع صفحات ويب بسيطة ، لكن الصفحات الأكثر تعقيدًا (أو حتى الصفحات البسيطة ذات التصميمات الجذابة) تحتاج عادة إلى CSS وربما {{Glossary ("JavaScript")}}. ينشئ HTML المحتوى وأنماط CSS للمحتوى وجافا سكريبت يجعل المحتوى ديناميكيًا.

- -

دعونا نجرب قليلا مع CSS بجعل النص الأساسي للصفحة باللون الأزرق:
- alghaws 'aemaq
-  

- -

 

- -
<!DOCTYPE html>
-<html>
-<head>
-  <title>Hi there</title>
-  <style>
-    body {
-      color: blue;
-    }
-  </style>
-</head>
-  <body>
-    <p>This is a some blue text</p>
-    <img src="unicorn_pic.png" alt="Unicorn picture :)" />
-  </body>
-</html>
- -

 

- -

لاحظ إضافة عنصر {{HTMLElement ("style")}} إلى الصفحة {{HTMLElement ("head")}}. هذا يحدد CSS لتطبيقه على النص الأساسي.

- -

تريد أن يتم تسطير النص؟ حاول إضافة "زخرفة النص: تسطير ؛" حكم على أسلوبك:

- -

 

- -
body {
-  color: blue;
-  text-decoration: underline;
-}
- -

تريد أن يكون النص بحجم محدد؟ جرب إضافة "font-size: 42px؛" مثله:

- -
body {
-  color: blue;
-  text-decoration: underline;
-  font-size: 42px;
-}
- -

والنهاية ستكون هكذا:

- -
<html>
-<head>
-  <title>Hi there</title>
-  <style>
-  body {
-    color: blue;
-    text-decoration: underline;
-    font-size: 42px;
-  }
-  </style>
-</head>
-<body>
-  <p>This is a blue underlined big text</p>
-  <img src="unicorn_pic.png" alt="Unicorn picture :)" />
-</body>
-</html>
- -

وإذا قمت بحفظ الصفحة في المحرر الخاص بك ، ثم قم بتحديث المتصفح ، فيجب أن تبدو الصفحة كما يلي:

- -

Screenshot of the browser with the page with some CSS

- -

ينمو إلى صفحتين
- عندما تتصفح الويب ، غالبًا ما تصادفك {{Glossary ("hyperlink","links")}} ، وهي الطريقة الأكثر فائدة للانتقال من صفحة إلى أخرى. نظرًا لأن HTML عبارة عن محتوى وتعتبر الروابط نوعًا من المحتوى ، يمكنك إنشاء روابط بين الصفحات باستخدام HTML فقط.

- -

الربط بين صفحتين محليتين
- في هذا التمرين ، ستحتاج إلى إنشاء ملف HTML ثاني على جهاز الكمبيوتر الخاص بك. سنضيف رابطًا إلى كل صفحة حتى يمكنك التبديل سريعًا ذهابًا وإيابًا فيما بينها.

- -

في الملف الأول يمكنك الاحتفاظ بنفس البنية العامة كما كان من قبل. المهم هو إضافة علامة جديدة ، {{HTMLElement ("a")}} ، على النحو التالي:

- -

 

- -
<!DOCTYPE html>
-<html>
-<head>
-  <title>Page 1 to ground control</title>
-</head>
-<body>
-  This is page 1.
-  <a href="page2.html" title="to page 2">What is going on on page 2?</a>
-</body>
-</html>
- -

يجب أن ترتبط الصفحة الثانية بالصفحة الأولى:

- -
<!DOCTYPE html>
-<html>
-<head>
-  <title>Page 2 :)</title>
-</head>
-<body>
-  This is a page 2.
-  <a href="page1.html" title="to page 1">Want to go back to page 1? Click here</a>
-</body>
-</html>
- -
-

ملاحظة: تأكد من تطابق أسماء الملفات المحددة في سمة href للعلامة {{HTMLElement ("a")}} مع أسماء الملفات التي أنشأتها على جهاز الكمبيوتر.

-
- -

 

- -

يمكنك الآن التنقل بين اثنين من مستندات HTML. افتح الصفحة 1 في المستعرض الخاص بك وانقر فوق الارتباط لفتح الصفحة 2 ، والعكس. يمكنك أيضًا اختبار الزر "السابق" في متصفحك. ستعيدك إلى الصفحة الأخيرة التي كنت تبحث عنها.

- -

يجب أن يكون لمدير الملفات ملفي HTML في نفس المجلد ، على النحو التالي:

- -

Screenshot of the file explorer with two HTML documents in one directory/folder

- -

الصفحة الاولي تشبه هذه:

- -

Screenshot of a file explorer with a html file for local test

- -

والصفحة الثانية تشبهه هذه بعد الضغط علي link:

- -

Screenshot of the 2nd page of the 2 pages example in the browser

- -
-

- -

- -

- -

113/5000

- -

ملاحظة: يعتبر الارتباط مرة أخرى إلى الصفحة رقم 1 هو البنفسجي لأن المتصفح "يعلم" بأننا سبق أن زرنا الصفحة الأولى.

- -

 

-
- -

 

- -

إذا أردت ، يمكنك تجربة ذلك بأكثر من صفحتين ، أو المتابعة إلى القسم التالي للانتقال إلى المستوى التالي.

- -

الربط بموقع آخر
- في هذا التمرين ، سنقوم بإضافة ارتباط إلى ملف HTML بحيث يمكن للقارئ الوصول بسرعة إلى بعض الصفحات المفيدة على الويب. يمكنك الربط بأي شيء متوفر على الويب العام. دعونا نحاول ربط ويكيبيديا:

- -

 

- -
<!DOCTYPE html>
-<html>
-<head>
-  <title>My page</title>
-</head>
-<body>
-  One day,...Unicorns are great...See you.
-  <a href="https://en.wikipedia.org/wiki/Unicorn" title="Unicorn page on Wikipedia">Want to go know more about unicorns? Wikipedia is right here</a>
-</body>
-</html>
- -

يجب أن يبدو هذا أكثر أو أقل مثل هذا في المتصفح:

- -

Screenshot of the example page with a link to Wikipedia in the browser

- -

قم بتحريك مؤشر الماوس فوق الرابط ؛ سترى السمة {{htmlattrxref ("title")}} المعروضة في تلميح أداة تحويم. يمكن استخدام هذا لتوفير مزيد من المعلومات حول الارتباط ، بحيث يمكن للمستخدم اتخاذ قرار مستنير حول ما إذا كان سيتم النقر عليه أم لا.

- -
-

تذكير: عندما تقوم بتحرير الصفحة ، لا تنس حفظ الملف على المحرر وتحديث الصفحة على متصفحك حتى تتمكن من رؤية التغييرات التي قمت بها.

-
- -

الخطوات التالية
- كيفية استخدام علامات HTML: هناك الكثير من العلامات في HTML ؛ لقد نظرنا فقط في الأساسيات هنا! ستجد المزيد من الموارد حول ما هو ممكن هنا.
- تشريح صفحة الويب: تحتوي HTML على بعض القواعد وقد تحتوي الصفحة على الكثير من المحتوى ؛ يمكن أن يساعدك ذلك في فهم صفحات أكثر تعقيدًا ، مثل تلك المستخدمة في بعض المواقع الأكثر شيوعًا على الويب!
- فهم الروابط: استخدمنا بعض الأمثلة البسيطة جدًا مع الروابط ؛ هذه المقالة لك إذا كنت تريد أن تعرف فهم لماذا "الروابط" هي أصل اسم "ويب".
- يفيد استخدام الصور وإضافة الصوت والفيديو لإضافة محتوى متعدد الوسائط باستخدام HTML بسيط.

diff --git a/files/ar/conflicting/learn/javascript/objects/index.html b/files/ar/conflicting/learn/javascript/objects/index.html deleted file mode 100644 index 74c5fd84fb..0000000000 --- a/files/ar/conflicting/learn/javascript/objects/index.html +++ /dev/null @@ -1,425 +0,0 @@ ---- -title: مدخل إلى جافاسكريبت كائنية التوجه -slug: conflicting/Learn/JavaScript/Objects -tags: - - الأفراد - - البرمجة الكائنية - - التغليف - - الجافاسكريبت - - المتوسط - - المجال - - المشيد - - ب.ك.ت - - كائن -translation_of: Learn/JavaScript/Objects -translation_of_original: Web/JavaScript/Introduction_to_Object-Oriented_JavaScript -original_slug: Web/JavaScript/Introduction_to_Object-Oriented_JavaScript ---- -
{{jsSidebar("Introductory")}}
- -

كائنية التوجه حتى النخاع، ميزات جافا سكريبت القوية، القدرات المرنة {{Glossary("OOP")}}. يبدأ هذا المقال بمقدمة إلى البرمجة الكائنية التوجه، ثم مراجعات لنموذج كائن جافا سكريبت، و أخيراً يوضح مفاهيم البرمجة الكائنية التوجه في جافا سكريبت. لا يصف هذا المقال البناء اللغوي الجديد للبرمجة الكائنية التوجه في ECMAScript 6.

- -
-

مراجعة جافا سكريبت

- -

إذا كنت لا تشعر بالثقة حول مفاهيم جافا سكريبت مثل المتغيرات والأنواع والوظائف و المجال ، يمكنك ان تقرأ عن هذه المواضيع في مدخل إلى جافا سكريبت. يمكنك أيضا الاطلاع علي دليل جافا سكريبت.

- -

البرمجة الكائنية التوجه (Object-oriented programming)

- -

إن البرمجة الكائنية (OOP) ما هي إلا نمط برمجي يَستخدم التجريد في إنشاء نماذج/نسخ لتجسيد العالم الحقيقي، وتَستخدم البرمجة الكائنية في ذلك أساليب مُتعدّدة من هذا النمط، فهي تستخدم الوحدات module، وتعدديّة الأشكال polymorphism والتغليف encapsulation، وتجدر الإشارة إلى أن معظم لغات البرمجة تدعم مفهوم OOP أمثال اللغات البرمجية: جافا، بايثون، روبي، وطبعًا جافا سكريبت.

- -

يُعالج أو لنقل يَتصور مفهوم البرمجة الكائنية OOP البرنامج كتشكيلة من الأشياء/الكائنات المتعاونة/المترابطة بدلًا من يتصوّره كتشكيلة من الدوال (functions) أو كسرد من الأوامر. ففي مفهوم OOP، كل كائن/شيء له القدرة على استقبال الرسائل، ومعالجة البيانات، وإرسال الرسائل إلى باقي الكائنات، ويُمكن اعتبار أنه لكل كائن object كينونة خاصة به ودور/وظيفة مستقلة عن الكائن الآخر.

- -

تُعزز البرمجة الكائنية القدرة على صيانة الشيفرة البرمجية والمرونة في التطوير، وأثبتت جدارتها على نطاق واسع في هندسة البرمجيات الكبيرة، ولأن البرمجة الكائنية تُشدد على استخدام الوحدات module، فإن الشيفرة/الكود المكتوب بمفهوم البرمجة الكائنية هو أبسط في التطوير وأسهل في الفهم مستقبلًا (عند التنقيح والتعديل)، وكما يعزز مفهوم البرمجة الكائنية التحليل المباشر للشيفرة، وفهم الحالات الشائكة فهمًا أفضل من باقي الأساليب البرمجية الأخرى.

- -

مصطلحات البرمجة الكائنية

- -
-
-

المجال في البرمجة الكائنية Namespace

- -

ما هو إلا عبارة عن حاوي تسمح للمطوّر بتحزيم جميع الوظائف تحت اسم محدد وفريد.

- -

الصنف أو الفئة Class في البرمجة الكائنية

- -

يعتني الصنف بكل ما يتعلّق بميزات وخصائص الكائن، والصنف ما هو إلا قالب template تعريفي بخاصيات properties وبطُرق/وظائف methods الكائن object.

- -

الكائن Object في البرمجة الكائنية

- -

الكائن ما هو إلا حالة/أمثولة instance من صنف class.

- -

الخاصية property في البرمجة الكائنية

- -

ما هي إلا مميزات وخصائص الكائن، كاللون مثلًا.

- -

الطريقة أو الوظيفة Method في البرمجة الكائنية

- -

تعتني الطريقة أو الوظيفة كما يُسميها البعض بقدرات الكائن، مثل قدرة المشي مثلًا، وهي دور أو وظيفة مرتبطة مع صنف class.

- -

المشيد Constructor في البرمجة الكائنية

- -

ما هو إلا طريقة method تُستدعى في لحظة استهلال instantiate الكائن، وعادةً ما يكون له نفس اسم الصنف الذي يحتويه.

- -

الوراثة Inheritance في البرمجة الكائنية

- -

يُمكن للصنف أن يرث مميزات من صنف آخر.

- -

التغليف Encapsulation في البرمجة الكائنية

- -

طريقة في تحزيم البيانات data والطُرق methods التي تستخدم البيانات.

- -

التجريد Abstraction في البرمجة الكائنية

- -

يجب على الاقتران الحاصل من: الوراثة والطُرق methods والخاصيات properties لكائن معقد وشائك التمثيل برمجيًا أن يعكس الواقع المراد محاكاته في البرمجة الكائنية.

- -

تعددية الأشكال Polymorphism في البرمجة الكائنية

- -

تحمل كلمة Poly بحد ذاتها المعنى "متعدد" وتحمل الكلمة morphism المعنى "أشكال، ويُشير المفهوم ككل إلى أن أكثر من صنف قد يُعرّف نفس الطريقة method أو الخاصية property.

-
-
- -

للحصول على وصف أكثر شمولية للبرمجة الكائنية التوجه، أنظر {{interwiki("wikipedia", "البرمجة كائنية التوجه")}} على ويكيبيديا.

- -

البرمجة المعتمدة على النموذج الأولي Prototype

- -

البرمجة المعتمدة على النموذج الأوّلي (Prototype-based programming) ما هي إلا نموذج من البرمجة الكائنية OOP ولكنها لا تستخدم الأصناف classes، بل تقوم أولًا بإعداد سلوك أي صنف class ما ومن ثم تُعيد استخدامه، ويُطلق البعض على هذا النموذج: البرمجة بلا أصناف classless، أو البرمجة المَبْدَئِية المنحى prototype-oriented، أو البرمجة المعتمدة على الأمثولة instance-based).

- -

يعود أصل اللغة المعتمدة على النموذج الأولي إلى لغة Self، والتي طوّرها David Ungar وRandall Smith، ولكن أسلوب البرمجة بدون أصناف class-less توسّع ونال شهرة كبيرة في العقد الأخير، واُعتمد من قبل العديد من اللغات البرمجية أشهرهم جافا سكريبت.

- -

 

- -

البرمجة الكائنية باستخدام جافا سكريبت

- -

المجال Namespace في جافا سكريبت

- -

المجال هو أشبه بمستوعب/بحاوية (container) تسمح للمطوّر في تحزيم وظائف تحت اسم فريد، أو اسم تطبيق محدد، ففي جافا سكريبت المجال هو مجرد كائن object كأي كائن آخر يحتوي على طُرق methods، وخاصيات properties، وحتى كائنات objects.

- -
-

ملاحظة هامة: من المهم جدًا الانتباه إلى أنه في جافا سكريبت، لا يوجد فرق بين الكائنات العادية والمجالات namespaces، وهذا يختلف عن اللغات الكائنية الأخرى، الأمر الذي قد يُربك المبرمجين المبتدئين في جافا سكريبت.

-
- -

إن إنشاء مجال namespace في جافا سكريبت بسيطٌ للغاية، فمن خلال إنشاء كائن عام/مشترك/شامل global، ستصبح جميع المُتغيّرات variables والطرق methods، والدوال functions خاصياتٍ لهذا الكائن، ويٌقلل استخدام المجالات namespaces أيضًا من احتمالية تضارب الأسماء في التطبيق، منذ أن كل كائن من كائنات التطبيق ما هي إلى خاصيات كائن شامل/عام معرّفة على مستوى التطبيق.

- -

سيُنشئ في الخطوة التالية كائنًا عامًا global وبالاسم MYAPP:

- -
// مجال عالمي
-var MYAPP = MYAPP || {};
- -

يُظهر المثال السابق، كيف تم التأكّد أولًا فيما إذا كان MYAPP معرفًا (سواء في نفس الملف أو في آخر)، ففي حال الإيجاب سيُستخدم الكائن العام MYAPP، وفي حال عدم تعريفه مُسبقًا سيُنشئ كائنًا خالٍ وبالاسمMYAPP والذي سيغلّف encapsulate الطرق methods والدوال functions والمتغيرات variables والكائنات objects.

- -

كما يُمكن أيضًا إنشاء مجال فرعي sub-namespaces:

- -
// مجال فرعي
-MYAPP.event = {};
- -

يوضّح المثال التالي الصيغة المستخدمة في إنشاء مجال namespace وإضافة متغيرات ودوال:

- -
// إنشاء حاوي يدعى MYAPP.commonMethod للوظائف و الخصائص الشائعة
-MYAPP.commonMethod = {
-  regExForName: "", // تعريف تعبير نظامي للتحقق من الإسم
-  regExForPhone: "", // تعريف تعبير نظامي للهاتف، لا يوجد تحقق من الصحة
-  validateName: function(name){
-    // إفعل شيئا ما بالإسم، يمكنك الوصول إلى المتغير regExForName
-    // بإستعمال "this.regExForName"
-  },
-
-  validatePhoneNo: function(phoneNo){
-    // إفعل شيئا ما برقم الهاتف
-  }
-}
-
-// تعريفات الكائن مع الزظيفة في نفس الوقت
-MYAPP.event = {
-    addListener: function(el, type, fn) {
-    // بعض الأكواد
-    },
-    removeListener: function(el, type, fn) {
-    // بعض الأكواد
-    },
-    getEvent: function(e) {
-    // بعض اﻷكواد
-    }
-
-    // يمكن إضافة وظائف و خصائص أخرى
-}
-
-// البناء اللغوي لإستعمال وظيفة addListener:
-MYAPP.event.addListener("yourel", "type", callback);
- -

 

- -

الكائنات الأساسية/القياسية المبنية داخل لغة جافا سكريبت (Standard built-in objects)

- -

تتضمن لغة جافا سكريبت العديد من الكائنات في تركيبتها، على سبيل المثال، يوجد كائنات مثل Math،Object، Array، String، ويُظهر المثال التالي كيفيّة استخدام الكائن Math للحصول على رقم عشوائي باستخدام أحد طُرق method هذا الكائن وهي الطريقة ()random.

- -
console.log(Math.random());
-
- -
-

ملاحظة: يَفترض المثال السابق وجميع الأمثلة التالية في المقال وجود دالة function بالاسم()console.log معرّفة تعريفًا عامًا (globally)، مع العلم أن هذه الدالة ليست جزء من اللغة نفسها، ولكنها دالة متوفّرة في العديد من متصفحات الإنترنت لأغراض تشخيص الشيفرة البرمجية debugging.

-
- -

يُمكن العودة إلى مرجع لغة جافا سكريبت: الكائنات الأصلية المعيارية للحصول على قائمة بالكائنات المبينة داخل لغة جافا سكريبت نفسها.

- -

كل كائن في جافا سكريبت هو حالة/أمثولة instance من الكائن Object ويَرث كافة خاصياته properties وطُرقه methods.

- -

 

- -

الكائنات الخاصة
- الصنف (الفئة)

- -

لغة جافا سكريبت لغة من النوع prototype-based ولا تحتوي على العبارة class كما هو حال باقي لغات البرمجة الكائنية، كما في روبي أو بايثون، ويُربك هذا الأمر المبرمجين المعتادين على اللغات التي تعتمد على هذه العبارة أو المفهوم، وتستخدم جافا سكريبت بدلًا من ذلك الدوال functions لمحاكات مفهوم الأصناف classes، وتعريف صنف هو بسهولة تعريف أي دالّة:

- -
var Person = function () {};
-
- -

الكائن (أمثولة الصنف class instance)

- -

يتطلب إنشاء حالة/أمثولة instance جديدة من كائن obj استخدام العبارة new obj، وتعيين النتيجة إلى متغيّر بغرض الوصول إلى فيما بعد.

- -

عُرّف في الشيفرة السابقة صنف class بالاسم Person، وفي الشيفرة التالية، سيُنشئ حالتين/أمثولتين instances من هذا الصنف، الأولى بالاسم person1 والثانية بالاسم person2.

- -
var person1 = new Person();
-var person2 = new Person();
-
- -
فضلا أنظر {{jsxref("Object.create()")}} للحصول على وظيفة الإنشاء الجديدة الإضافية التي تنشأ حالة غير مهيأة
- -

المشيد The constructor

- -

يُستدعى المُشيّد constructor في لحظة الاستهلال instantiation (اللحظة التي يُنشئ فيها الكائن)، والمُشيّد ما هو إلا طريقة method من طُرق الصنف class، وفي جافا سكريبت تعمل الدالة على تشييد الكائن، ولذلك لا داعي إلى تعريف طريقة method من أجل عميلة التشييد، وكل إجراء مصرّح في الصنف class يُنفّذ في لحظة الاستهلال instantiation.

- -

يُستخدم المُشيّد في تعيين خاصيات properties الكائن، أو في استدعاء طُرق methods معينة لتحضير الكائن للاستخدام، وأما إضافة طُرق صنف وتعريفها يحدث باستخدام صيغة syntax مختلفة سنتطرّق إليها فيما بعد خلال المقال.

- -

تُظهر الشيفرة التالية كيف يُسجّل log (يُرسل رسالة نصية إلى طرفية المتصفح console) مُشيّد الصنفPerson رسالة نصية حينما يُستهل instantiated.

- -
var Person = function () {
-  console.log('تم إنشاء حالة');
-};
-
-var person1 = new Person();
-var person2 = new Person();
-
-
- -

الخاصية The property (خاصية الكائن object attribute)

- -

الخاصيات properties ما هي إلا متغيرات محتوات في الصنف class، وكل حالة/أمثولة من الكائن تمتلك هذه الخاصيات، وتُعيّن الخاصيات في دالة مُشيّد الصنف بحيثُ تُنشئ مع كل حالة/أمثولة instance.

- -

إن الكلمة المفتاحية this، والتي تُشير إلى الكائن الحالي، تسمح للمطوّر بالعمل مع الخاصيات من ضمن الصنف، والوصول (قراءةً وكتابةً) إلى الخاصية property من خارج الصنف يكون من خلال الصيغةInstanceName.Property كما هو الأمر في لغة C++ (سي بلس بلس) وJava والعديد من اللغات الأخرى، ومن داخل الصنف تُستخدم الصيغة this.Property للحصول على قيمة الخاصية أو لتعيين قيمتها.

- -

في الشيفرة التالية، عُرّفت الخاصية firstName للصنف Person وفي لحظة الاستهلال instantiation:

- -
var Person = function (firstName) {
-  this.firstName = firstName;
-  console.log('تم إنشاء حالة من Person');
-};
-
-var person1 = new Person('سفيان');
-var person2 = new Person('محمد');
-
-// Show the firstName properties of the objects
-console.log('الشخص1 هو ' + person1.firstName); // النتيجة ==> "الشخص1 هو سفيان"
-console.log('الشخص2 هو ' + person2.firstName); // النتيجة ==> "الشخص2 هو محمد"
-
- -

الطرق The methods

- -

الطرق methods ما هي إلا دوال (وتُعرّف كما تعرّف الدوال functions)، فيما عدا ذلك فهي تُشبه الخاصيات properties، واستدعاء طريقة method مشابه إلى الوصول إلى خاصيّة ما، ولكن مع إضافة () في نهاية اسم الطريقة، وربما مع مُعطيات arguments، ولتعريف طريقة، تُعيّن دالة إلى خاصيّة مُسمّات من خاصيّة الصنف prototype، ويُمكن فيما بعد استدعاء الطريقة على الكائن بنفس الاسم الذي عُيّن للدالة.

- -

في الشيفرة التالية، عُرّفت ومن ثم اُستخدِمت الطريقة ()sayHello للصنف Person.

- -
var Person = function (firstName) {
-  this.firstName = firstName;
-};
-
-Person.prototype.sayHello = function() {
-  console.log("مرحبا، أنا " + this.firstName);
-};
-
-var person1 = new Person("سفيان");
-var person2 = new Person("محمد");
-
-// إستدعاء طريقة Person sayHello.
-person1.sayHello(); // النتيجة ==>"مرحبا، أنا سفيان"
-person2.sayHello(); // النتيجة ==> "مرحبا، أنا محمد"
-
- -

إن الطُرق methods في جافا سكريبت ما هي إلا دالة كائن عادية مرتبطة مع كائن كخاصية property، وهذا يعني أنه يُمكن استدعاء الطُرق خارج السياق، كما في المثال التالي:

- -
var Person = function (firstName) {
-  this.firstName = firstName;
-};
-
-Person.prototype.sayHello = function() {
-  console.log("مرحبا، أنا " + this.firstName);
-};
-
-var person1 = new Person("سفيان");
-var person2 = new Person("محمد");
-var helloFunction = person1.sayHello;
-
-// النتيجة ==> "مرحبا، أنا سفيان"
-person1.sayHello();
-
-// النتيجة ==> "مرحبا، أنا محمد"
-person2.sayHello();
-
-// النتيجة ==> "مرحبا، أنا undefined" (أو أخطاء
-// TypeError في الوضع الصارم)
-helloFunction();
-
-// النتيجة ==> true
-console.log(helloFunction === person1.sayHello);
-
-// النتيجة ==> true
-console.log(helloFunction === Person.prototype.sayHello);
-
-// النتيجة ==> "مرحبا، أنا سفيان"
-helloFunction.call(person1);
- -

كما يُظهر المثال السابق، جميع الإحالات المستخدمة في استدعاء الدالة sayHello تُشير إلى نفس الدالةسواءً الاستدعاء الحاصل مع person1 أو Person.prototype أو حتى في المتغيّر helloFunctionوقيمة this خلال استدعاء الدالة يعتمد على الكيفية التي تُستدعى فيها، حيث تُشير الكلمة المفتاحيةthis إلى الكائن الحالي الذي تُستدعى عليه الطريقة method، بمعنى عندما تم استدعاء الطريقة()sayHello على الكائن person1 فإن this تُشير إلى الكائن person1، وعند استدعاء sayHelloعلى الكائن person2 فإن this تُشير إلى الكائن person2، ولكن إن تم الاستدعاء بطريقة مختلفة، فإنthis ستُعيّن تعينًا مختلفًا، فاستدعاء this من المتغيّر (كما في ()helloFunction) سيُعيّن this إلى الكائن العام global (والذي سيكون window في متصفح الإنترنت)، ومنذ أن هذا الكائن (على الأغلب) لا يملك الخاصّيّة firstName، ستكون النتيجة كما هو الحال في المثال السابق “Hello, I’m undefined”، كما يمكن دائمًا تعيين this صراحةً باستخدام Function#call (أو Function#apply) وهو كما كان في نهاية المثال.

- -
ملاحظة: أنظر المزيد حول this على call و apply
- -

الوراثة

- -

تُستخدم الوراثة في جافا سكريبت في إنشاء صنف class كمثيل مخصص لصنف أو أكثر (تدعم جافا سكريبت وراثة وحيدة فقط single inheritance)، ويُطلق على الصنف المخصص عادةً ابن (child)، ويطلق على الصنف الآخر عادةً  الأب (parent)، وفي جافا سكريبت يتمّ ذلك من خلال إسناد حالة/أمثولة من الصنف الأب إلى الصنف الابن، ومن ثم تخصيصه، وفي متصفحات الإنترنت الحديثة يُمكن استخدامObject.create في تحقيق الوراثة inheritance أيضًا.

- -
-

ملاحظة: لا تتفقد جافا سكريبت مُشيّد صنف الابن prototype.constructor (راجعObject.prototype)، وعليه يجب التصريح عن ذلك يدويًا، لمزيد من التفصيل راجع السؤال التالي علىStackoverflow.

-
- -

عُرّف في الشيفرة التالية الصنف Student كصنف ابن للصنف Person، ومن ثم أُعيد تعريف الطريقة()sayHello وأُضيفت الطريقة ()sayGoodBye علاوة على ذلك.

- -
// تعريف المشيد Person
-var Person = function(firstName) {
-  this.firstName = firstName;
-};
-
-// إضافة زوج من الطرق إلى Person.prototype
-Person.prototype.walk = function(){
-  console.log("أنا أتمشى!");
-};
-
-Person.prototype.sayHello = function(){
-  console.log("مرحبا، أنا " + this.firstName);
-};
-
-// تعريف مشيد Student
-function Student(firstName, subject) {
-  // إستدعاء المشيد اﻷب, التأكد (عن طريق الإستدعاء)
-  // من أن "this" وضعت بشكل صحيح أثناء اﻹستدعاء
-  Person.call(this, firstName);
-
-  // تهيئة خصائص الطالب المحددة
-  this.subject = subject;
-}
-
-// إنشاء كائن Student.prototype الذي يرث من Person.prototype.
-// ملاحظة: خطأ شائع أن يستعمل "new Person()" ﻹنشاء
-// Student.prototype. هذا غير صحيح لعدة أسباب،
-// ليس أقل أننا ليس لدينا أي شيء ﻹعطاء Person إلى المعامل "firstName".
-// الطريقة الصحيحة ﻹستدعاء Person هي في الأعلى حيث
-// إستدعيناه من Student.
-Student.prototype = Object.create(Person.prototype); // See note below
-
-// وضع الخاصية "constructor" للإشارة إلى Student
-Student.prototype.constructor = Student;
-
-// إستبدال الطريقة "sayHello"
-Student.prototype.sayHello = function(){
-  console.log("مرحبا، أنا " + this.firstName + ". أنا أدرس "
-              + this.subject + ".");
-};
-
-// إضافة الطريقة "sayGoodBye"
-Student.prototype.sayGoodBye = function(){
-  console.log("وداعا!");
-};
-
-// إستعمال المثال:
-var student1 = new Student("سفيان", "المناجم");
-student1.sayHello();   // "مرحبا، أنا سفيان. أنا أدرس المناجم."
-student1.walk();       // "أنا أتمشى!"
-student1.sayGoodBye(); // "وداعا!"
-
-// التحقق من أن instanceof يعمل بشكل صحيح
-console.log(student1 instanceof Person);  // true
-console.log(student1 instanceof Student); // true
-
- -

فيما يخص السطر ;(Student.prototype = Object.create(Person.prototype في الإصدارات القديمة من جافا سكريبت والتي لا تدعم Object.create يمكن إما استخدام بعض الحيل في خداع المتصفحات –هذه الخدع معروفة إما بالاسم polyfill أو shim—أو استخدام دالة تحقق نفس النتيجة كما في المثال التالي:

- -
function createObject(proto) {
-    function ctor() { }
-    ctor.prototype = proto;
-    return new ctor();
-}
-
-// الإستعمال:
-Student.prototype = createObject(Person.prototype);
-
- -
ملاحظة: أنظر Object.create للمزيد من المعلومات حول ما يقوم به, و الرقاقات للمحركات القديمة.
- -

التأكّد من أن this تُشير إلى الكائن المطلوب بغض النظر عن كيف للكائن أن يُستهل يمكن أن يكون صعبًا، ومع ذلك يوجد صياغة أبسط من شأنها أن تسهّل الأمر.

- -
var Person = function(firstName) {
-  if (this instanceof Person) {
-    this.firstName = firstName;
-  } else {
-    return new Person(firstName);
-  }
-}
-
- -

التغليف Encapsulation

- -

ليس بالضرورة أن يعلم الصنف Student كيف تمّ تنفيذ/تعريف الطريقة ()walk للصنف Person لكي يستطيع استخدام تلك الطريقة، ولا يحتاج الصنف Student إلى تعريف تلك الطريقة صراحةً إلا إذا كان المطلوب التعديل عليها، ويُطلق على هذا الإجراء مفهوم التغليف encapsulation، والذي فيه يَحزم كل صنف البيانات والطُرق methods داخل وحدة/كينونة وحيدة.

- -

إخفاء المعلومات سمة شائعة في باقي اللغات البرمجية وعادةً ما توجد كخاصيات/كطُرق إما بالاسمprivate أو protected، وعلى الرغم من أنه يُمكن مماثلة/محاكاة ذات الأمر في جافا سكريبت، إلا أن هذا الأمر ليس مطلبًا من متطلبات البرمجة الكائنية.

- -

التجريد Abstraction

- -

التجرير ما هو إلا ميكانيكية تسمح للمطوّر في تجسيد جانب من المشكلة التي يُعمل عليها، إما من خلال الوراثة inheritance (التخصيص specialization) أو التركيب composition، وتُحقق جافا سكريبت التخصيص من خلال الوراثة، والتركيب من خلال السماح لحالات/أمثولات الصنف لتكون قيمًا لخاصيات attributes الكائنات الأخرى.

- -

الصنف Function في جافا سكريبت يرث من الصنف Object (وهذا يوضّح التخصيص في هذا النموذج) والخاصية Function.prototype ما هي إلا حالة/أمثولة من الصنف Object (وهذا يوضّح جزئية التركيب composition).

- -
var foo = function () {};
-
-// النتيجة ==> "foo عبارة عن وظيفة: true"
-console.log('foo عبارة عن وظيفة: ' + (foo instanceof Function));
-
-// النتيجة ==> "foo.prototype عبارة عن كائن: true"
-console.log('foo.prototype عبارة عن كائن: ' + (foo.prototype instanceof Object));
- -

تعددية الأشكال Polymorphism

- -

كما أن جميع الطُرق methods والخاصيات properties معرّفة ضمن الخاصية prototype، فيُمكن لبقية الأصناف أن تُعرِّف طُرقًا methods بنفس الاسم، وستكون الطُرق في نطاق الصنف الذي عُرفت به، إلا إذا كان الصنفان على علاقة من نوع أب وابن parent-child، بمعنى آخر أحد الصنفان يرث من الآخر
-
- هذه المقالة تُرجمة الي العربية بواسطة : محمد أبرص

- -

ملاحظات

- -

هذه ليست الطرق الوحيدة التي يمكنك من خلالها تنفيذ البرمجة الشيئية في جافا سكريبت ، والتي تعد مرنة للغاية في هذا الصدد. وبالمثل ، فإن التقنيات الموضحة هنا لا تستخدم أي لغة خارقة ، ولا تحاكي تطبيقات اللغات الأخرى لنظرية الكائن.

- -

هناك تقنيات أخرى تجعل البرمجة الكائنية التوجه أكثر تقدما لكنها خارج نطاق الهذه المقالة التمهيدية.

-
- -

المراجع

- -
    -
  1. ويكيبيديا - البرمجة الكائنية التوجه
  2. -
  3. ويكيبيديا - البرمجة القائمة على النوذج
  4. -
  5. ويكيبيديا - التغليف (البرمجة الكائنية التوجه)
  6. -
- -

أنظر أيضا

- -
    -
  • {{jsxref("Function.prototype.call()")}}
  • -
  • {{jsxref("Function.prototype.apply()")}}
  • -
  • {{jsxref("Object.create()")}}
  • -
  • الوضع الصارم
  • -
diff --git a/files/ar/conflicting/web/guide/index.html b/files/ar/conflicting/web/guide/index.html deleted file mode 100644 index d85901e920..0000000000 --- a/files/ar/conflicting/web/guide/index.html +++ /dev/null @@ -1,99 +0,0 @@ ---- -title: Web Development -slug: conflicting/Web/Guide -tags: - - NeedsTranslation - - TopicStub - - Web Development -translation_of: Web/Guide -translation_of_original: Web_Development -original_slug: Web_Development ---- -

Web development comprises all aspects of developing a web site or web application.

-

Learn how to create anything from a simple web site to complex, highly interactive web sites featuring the latest Web technologies by perusing the articles you'll find here.

- - - - - - - -
-

Documentation topics

-

Technologies

-
-
- Introduction to Web development
-
- A guide to learning how to develop for the Web.
-
- HTML
-
- HyperText Markup Language is the basic language for creating web pages and other documents displayed in a browser.
-
- CSS
-
- Cascading Style Sheets make it possible to do advanced layout and page design on the Web.
-
- JavaScript
-
- JavaScript is the most commonly used scripting language for developing web applications; it's also used in the development of Mozilla-based software.
-
- DOM
-
- The Document Object Model is an API for HTML and XML documents, providing a structural representation of the document that you can modify in order to alter its visual presentation.
-
- AJAX
-
- Asynchronous JavaScript and XML isn't so much a technology as a combination of technologies; using JavaScript and other modern web technologies together to create dynamic web applications.
-
- XHTML
-
- Extensible HyperText Markup Language is an XML-based HTML-like language that offers a stricter syntax than HTML.
-
- SVG
-
- Scalable Vector Graphics is an XML markup language for describing 2D vector graphics.
-
-

Strategies

-
-
- Web standards
-
- Learn how to make your Web site or application reach the largest number of users through compatibility with the open Web.
-
- Responsive Web design
-
- Use CSS to present the same content across all hardware platforms, from mobile phones to wide-screen, high-res desktop displays.
-
- Writing forward-compatible websites
-
- Best practices for creating websites that do not break when browsers are updated.
-
- Mobile Web development
-
- Developing sites for be viewed on mobile devices involves some unique approaches that may not be familiar to those accustomed to developing for desktop browsers.
-
- Mozilla Web developer FAQ
-
- Frequently asked questions from Web developers. With answers!
-
-

View All...

-
-

Community

- -

Tools

- -

View All...

-
diff --git a/files/ar/conflicting/web/html/element/index.html b/files/ar/conflicting/web/html/element/index.html deleted file mode 100644 index 3cccb98dbd..0000000000 --- a/files/ar/conflicting/web/html/element/index.html +++ /dev/null @@ -1,600 +0,0 @@ ---- -title: مجموعه عناصر لغة HTML5 -slug: conflicting/Web/HTML/Element -tags: - - اتش تي ام ال - - اتش تي ام ال 5 - - المبتدئين - - الويب - - انترنت - - دليل - - وسوم -translation_of: Web/HTML/Element -translation_of_original: Web/Guide/HTML/HTML5/HTML5_element_list -original_slug: Web/Guide/HTML/HTML5/HTML5_element_list ---- -

كل عناصر HTML5 المعتمدة مدرجة هنا، حيث أن اسماءها تصفها ومرتبة في مجموعات حسب وظائفها.

- -

على عكس فهرس عناصر HTML الذي يشمل جميع عناصر HTML بما فيها المعتمدة وغير المعتمدة والصالحة والمهملة والملغية أيضًا، هذه الصفحة تتضمن عناصر HTML5 الصالحة فقط، العناصر الموجودة هنا هي التي يتوجب أن تستعمل في إنشاء المواقع الجديدة.

- -

العلامة This element was added as part of HTML5 ترمز إلى أن العنصر قد تمت إضافته في HTML5، لاحظ أن العناصر الأخرى الموجودة هنا قد تكون ممددة أو معدلة في معانيها ضمن مواصفات HTML5.

- -

عنصر الجذر

- - - - - - - - - - - - - - -
العنصرنبذة عنه
{{HTMLElement("html")}}وهو يمثل جذر الـ HTML أو مستند XHTML و يجب أن تكون جميع العناصر الأخرى من نسل هذا العنصر.
- -

البيانات الرئيسة للوثيقة

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
العنصرنبذة عنه
{{HTMLElement("head")}}وهو يمثل مجموعة من البيانات الوصفية حول الوثيقة بما في ذلك الوصلات أو تعريفات و البرامج النصية والسكريبتات و انماط الـ CSS .
{{HTMLElement("title")}}يحدد عنوان الوثيقة  كما هو موضح في شريط عنوان المتصفح أو في علامة التبويب الصفحة ولابد أن يحتوي على نصوص فقط لا غير .
{{HTMLElement("base")}}وهو يحدد الرابط الفتراضي للوثيقة كي يتم من خلاله فرز الروابط المنتسبة لصفحة من الرابط التابعه لاجناس اخرى .
{{HTMLElement("link")}}وهو يستخدم لربط ملفات  ألـ CSS والـ Javascript الخارجي مع وثيقة HTML .
{{HTMLElement("meta")}}يستخدم لتعريف العناصر التي لايمكن تعريفها مثل الترميز وغير من الاستخدامات الاخرى .
{{HTMLElement("style")}}يستخدم لكتابة CSS داخل وثيقة HTML  .
- -

البرمجة

- - - - - - - - - - - - - - - - - - - - - - -
العنصرنبذة عنه
{{HTMLElement("script")}}يستخدم لربط ملف نصي برمجي خارجي او تضمين ملف نص برمجي ويمكن الكتابة داخله بالغات متعدده مثل javascript او php و غيره .
{{HTMLElement("noscript")}}يحدد محتوى بديل لعرضه عندما لا يدعم المتصفح البرمجة .
{{HTMLElement("template")}}This element has been added in HTML5حاوية للمحتوى العميل أثناء وقت التشغيل باستخدام جافا سكريبت .
- -

اقسام التضمين

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
العنصرنبذة عنه
{{HTMLElement("body")}} -
وهو يمثل محتوى وثيقة HTML ولابد ان تكون كل العناصر الضاهره في الجسم داخلة .
-
{{HTMLElement("section")}} This element has been added in HTML5يمثل قطعه في في المستند .
{{HTMLElement("nav")}} This element has been added in HTML5يحدد المقطع الذي يحتوي على ارتباطات التنقل .
{{HTMLElement("article")}} This element has been added in HTML5يحدد محتوى  منفصل بذاته والذي يمكن أن يوجد بشكل مستقل عن بقية المحتوى.
{{HTMLElement("aside")}} This element has been added in HTML5يعرف بعض المحتويات التي لها علاقة فضفاضة إلى محتوى الصفحة. إذا تم إزالته ، والمحتوى المتبقية لا يزال من المنطقي .
<h1>,<h2>,<h3>,<h4>,<h5>,<h6>وهو يمثل 6 مستويات من عناوين النصية واكبرهم حجماً <h1> وعكسه <h6>
{{HTMLElement("header")}} This element has been added in HTML5يحدد محتوى بذاتها التي يمكن أن توجد بشكل مستقل عن بقية المحتوى . 
{{HTMLElement("footer")}} This element has been added in HTML5>يحدد تذييل للصفحة أو قسم  فإنه غالبا ما يحتوي على إشعار حقوق التأليف والنشر وبعض الروابط على المعلومات القانونية أو عناوين .
{{HTMLElement("address")}}يعرف الجزء الذي يحتوي على معلومات للإتصال به.
{{HTMLElement("main")}}This element has been added in HTML5يحدد المحتوى الرئيسي أو مهم في الوثيقة. هناك واحد فقط <main> عنصر في الوثيقة.
- -

جداول البيانات

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
العنصرنبذة عنه
{{HTMLElement("p")}}يحدد الجزء الذي يجب أن يتم عرض كفقرة .
{{HTMLElement("hr")}}يمثل خط فاصل بين موضوعين .
{{HTMLElement("pre")}}يحدد النص المكتوب كما هو بالسطر وافراغ .
{{HTMLElement("blockquote")}} -

يمثل المحتوى الذي يتم نقلا عن مصدر آخر.

-
{{HTMLElement("ol")}}يحدد قائمة مرتبة مرقمة من العناصر .
{{HTMLElement("ul")}}يحدد قائمة غير مرتبة من البنود.
{{HTMLElement("li")}}يحدد عنصر من قائمة التعداد.
{{HTMLElement("dl")}}تعرف على قائمة تعريف ، وهذا هو ، على قائمة المصطلحات والتعاريف المرتبطة بها .
{{HTMLElement("dt")}}يمثل مصطلح يعرفه القادم < DD > .<dd>.
{{HTMLElement("dd")}}يمثل تعريف المصطلحات الواردة فورا قبل ذلك.
{{HTMLElement("figure")}} This element has been added in HTML5يمثل الرقم يتضح كجزء من الوثيقة.
{{HTMLElement("figcaption")}} This element has been added in HTML5يمثل أسطورة شخصية .
{{HTMLElement("div")}}يمثل وعاء العامة مع عدم وجود معنى خاص .
- -

عناصر النصوص

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
العنصرنبذة عنه
{{HTMLElement("a")}}يمثل الارتباط التشعبي   وربط إلى مورد آخر .
{{HTMLElement("em")}}يمثل خط مائل .
{{HTMLElement("strong")}} يمثل خط مشدد .
{{HTMLElement("small")}}يمثل خط نحيف .
{{HTMLElement("s")}}يمثل نص مشطوب او محذوف
{{HTMLElement("cite")}} -

يمثل عنوان العمل. .

-
{{HTMLElement("q")}}يمثل الاقتباس المضمنة. .
{{HTMLElement("dfn")}}يمثل مصطلح الذي يرد في أقرب محتوى الجد التعريف.
{{HTMLElement("abbr")}}يمثل اختصار أو اختصار . التوسع في اختصار يمكن أن تكون ممثلة في سمة العنوان.
{{HTMLElement("data")}} This element has been added in HTML5الزميلة ل محتواه ما يعادل المقروءة آليا . ( هذا العنصر فقط في إصدار WHATWG للمعيار HTML ، و ليس في الإصدار W3C من HTML5
{{HTMLElement("time")}} This element has been added in HTML5يمثل قيمة التاريخ والوقت . أي ما يعادل المقروءة آليا يمكن أن تكون ممثلة في سمة التاريخ والوقت .
{{HTMLElement("code")}}يمثل عنصر يكتب بداخله الكود
{{HTMLElement("var")}}يمثل المتغير ، وهذا هو ، تعبير أو البرمجة الرياضية السياق الفعلي ، معرف تمثل ثابت ، رمزا تحديد الكمية الفعلية ، معلمة وظيفة ، أو مجرد نائب في النثر .
{{HTMLElement("samp")}}يمثل الناتج من برنامج أو جهاز كمبيوتر .
{{HTMLElement("kbd")}}تمثل مدخلات المستخدمين، في كثير من الأحيان من لوحة المفاتيح ، ولكن ليس بالضرورة . قد تمثل المدخلات الأخرى ، مثل الأوامر الصوتية كتب .
{{HTMLElement("sub")}},{{HTMLElement("sup")}}يمثل نص منخفظ او مرتفع
{{HTMLElement("i")}}تمثل بعض النص في صوت بديل أو المزاج، أو على الأقل من نوعية مختلفة ، مثل تسمية التصنيف، مصطلح تقني ، عبارة اصطلاحية ، الفكر، أو اسم السفينة
{{HTMLElement("b")}}يمثل نص مشدد .
{{HTMLElement("u")}}يمثل annoatation غير النصية التي العرض التقليدية و التسطير ، واصفة هذا النص كما يجري أخطأ في الهجاء أو وصفها الاسم الصحيح في النص الصيني
{{HTMLElement("mark")}} This element has been added in HTML5يمثل نص مشار اليه بالون الاصفر
{{HTMLElement("ruby")}} This element has been added in HTML5يمثل المحتوى إلى أن تكون علامة مع شروح روبي ، المديين القصير من النص قدمت جنبا إلى جنب مع النص. وكثيرا ما يستخدم هذا بالتزامن مع لغة شرق آسيا حيث تعمل شروح كدليل للنطق ، مثل furigana الياباني . .
{{HTMLElement("rt")}} This element has been added in HTML5يمثل نص الشرح روبي .
{{HTMLElement("rp")}} This element has been added in HTML5يمثل قوسين حول الشرح روبي ، وتستخدم لعرض الشرح بطريقة بديلة من قبل المتصفحات لا تدعم العرض القياسية ل شروحه.
{{HTMLElement("bdi")}} This element has been added in HTML5يمثل النص الذي يجب أن تكون معزولة عن محيطها ل تنسيق النص ثنائي الاتجاه . لأنها تتيح تضمين فترة من النص مع مختلف أو غير معروف، الاتجاهية .
{{HTMLElement("bdo")}}يمثل اتجاهها من أبنائها ، من أجل تجاوز صراحة خوارزمية ثنائية الاتجاه يونيكود
{{HTMLElement("span")}}يمثل النص مع عدم وجود معنى محدد . هذا لابد من استخدامها عند ينقل أي عنصر النص الدلالي الآخرين معنى كاف، وهو ، في هذه الحالة، وغالبا ما رفعتها سمات عالمية مثل الطبقة ، لانج ، أو دير.
{{HTMLElement("br")}}يمثل سطر جديد
{{HTMLElement("wbr")}} This element has been added in HTML5يمثل فرصة كسر خط ، وهذا هو نقطة المقترحة لل التفاف النص من أجل تحسين إمكانية القراءة من تقسيم النص على عدة أسطر .
- -

التعديلات

- - - - - - - - - - - - - - - - - - -
العنصرنبذة عنه
{{HTMLElement("ins")}}عنصر مضاف او تم تعديله
{{HTMLElement("del")}}عنصر محذوف وهو مثيل العنصر {{HTMLElement("s")}}
- -

التضمين و الميديا

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
العنصرنبذة عنه
{{HTMLElement("img")}}يستخدم لربط الصور بالوثيقه
{{HTMLElement("iframe")}}يمثل السياق تصفح متداخلة ، وهذا هو وثيقة HTML المضمنة.
{{HTMLElement("embed")}} This element has been added in HTML5تمثل نقطة التكامل ل خارجي ، في كثير من الأحيان غير HTML ، تطبيق أو المحتوى التفاعلي .
{{HTMLElement("object")}}تمثل الموارد الخارجية ، التي تعامل على أنها صورة، وثيقة الفرعية HTML ، أو الموارد الخارجية التي سيتم تجهيزها من قبل في المكونات .
{{HTMLElement("param")}}تعرف المعلمات للاستخدام من قبل المكونات الإضافية التي يحتج بها <كائن > العناصر.
{{HTMLElement("video")}} This element has been added in HTML5يمثل الفيديو ، والملفات المرتبطة به الصوت و تعليق عليها، مع واجهة اللازمة لتشغيله .
{{HTMLElement("audio")}} This element has been added in HTML5يمثل الصوت ، أو تيار الصوت.
{{HTMLElement("source")}} This element has been added in HTML5يسمح المؤلفين لتحديد الموارد وسائل الإعلام البديلة ل عناصر الوسائط مثل {{HTMLElement("video")}} or {{HTMLElement("audio")}}.
{{HTMLElement("track")}} This element has been added in HTML5يسمح المؤلفين لتحديد مسار النص توقيت ل عناصر الوسائط مثل {{HTMLElement("video")}}or {{HTMLElement("audio")}}.
{{HTMLElement("canvas")}} This element has been added in HTML5تمثل منطقة خريطة أبيت أن النصوص يمكن استخدامها ل تقديم الرسومات ، مثل الرسوم البيانية والرسوم البيانية لعبة ، أو أي الصور المرئية على الطاير .
{{HTMLElement("map")}}بالتزامن مع {{HTMLElement("area")}}, يحدد مخطط صورة.
{{HTMLElement("area")}}بالتزامن مع {{HTMLElement("map")}},يحدد مخطط صورة.
{{SVGElement("svg")}} This element has been added in HTML5تعرف على إد الإدارة الانتخابية دائرة التنمية الاقتصادية صورة اتجاهي .
{{MathMLElement("math")}} This element has been added in HTML5يحدد صيغة رياضية.
- -

Tabular data

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
العنصرنبذة عنه
{{HTMLElement("table")}}تمثل البيانات مع أكثر من بعد واحد.
{{HTMLElement("caption")}}يمثل عنوان الجدول.
{{HTMLElement("colgroup")}}تمثل مجموعة من واحد أو أكثر من الأعمدة من الجدول.
{{HTMLElement("col")}}يمثل عمود من الجدول.
{{HTMLElement("tbody")}}يمثل كتلة من الصفوف التي تصف البيانات ملموسة من الجدول.
{{HTMLElement("thead")}}يمثل كتلة من الصفوف التي تصف التسميات عمود من الجدول.
{{HTMLElement("tfoot")}}يمثل كتلة من الصفوف التي تصف ملخصات عمود من الجدول.
{{HTMLElement("tr")}}يمثل صف من الخلايا في الجدول.
{{HTMLElement("td")}}يمثل خلية البيانات في الجدول.
{{HTMLElement("th")}}يمثل خلية رأس في الجدول.
- -

 الاشكال

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
العنصرنبذة عنه
{{HTMLElement("form")}}عنصر تبادل المعلومات مع الخادم حيث يكون داخله مجموعه من العناصر تتيح لمستخدم التعديل والاضافه
{{HTMLElement("fieldset")}}مثل عنصار او ضوابط مرتبة
{{HTMLElement("legend")}}يمثل عنوان <fieldset> .
{{HTMLElement("label")}}يعتبر توضيح او اسم عنصر داخل <form>
{{HTMLElement("input")}}يمثل حقل من البينات مما يتحُيح للمستخدم استعمالها
{{HTMLElement("button")}}عباره عن وز .
{{HTMLElement("select")}} يمثل مجموعه من الخيارات المٌسدله المرتبة .
{{HTMLElement("datalist")}} This element has been added in HTML5يمثل  قائمة منسدله تحوي مجموعه من الخيارات المعدة مسبقاً اشبه باقائمة .
{{HTMLElement("optgroup")}}يمثل عنوان لمجموعه خيارات <option> الي تكون ادخل {{HTMLElement("optgroup")}} الي هي داخل {{HTMLElement("datalist")}}.
{{HTMLElement("option")}}يمثلخيارات داخل العنصر{{HTMLElement("select")}} أو اقتراح من{{HTMLElement("datalist")}}.
{{HTMLElement("textarea")}}مربع يكتب بداخله نص يمكن التحكم به .
{{HTMLElement("keygen")}} This element has been added in HTML5يمثل سطر مولد مفاتيح .
{{HTMLElement("output")}} This element has been added in HTML5سَحاب يمكن التحكم به .
{{HTMLElement("progress")}} This element has been added in HTML5يمثل شريط اخذ بالمتلاء يعني مثل الداون لود منيجر لما يكون ايحمل
{{HTMLElement("meter")}} This element has been added in HTML5يمثل قيمة مئويه اخذه بالمتلاء بشكل صغير .
- -

العناصر التفاعلية

- - - - - - - - - - - - - - - - - - - - - - - - - - -
العنصرنبذة عنه
{{HTMLElement("details")}} This element has been added in HTML5يمثل قائمة مُنسدله من الخيارات
{{HTMLElement("summary")}} This element has been added in HTML5وهو يمثل عنوان لقائمة العنصر <details> .
{{HTMLElement("menuitem")}} This element has been added in HTML5يمثل الأوامر  التي تمكن المستخدم  من الاستدعاء.
{{HTMLElement("menu")}} This element has been added in HTML5يمثل قائمة من العناصر .
- -

وهنُاك أيضاً

- - diff --git a/files/ar/conflicting/web/html/index.html b/files/ar/conflicting/web/html/index.html deleted file mode 100644 index 2a44ef2024..0000000000 --- a/files/ar/conflicting/web/html/index.html +++ /dev/null @@ -1,89 +0,0 @@ ---- -title: HTML (لغة ترميز النص الفائق) -slug: conflicting/Web/HTML -translation_of: Web/HTML -original_slug: Web/HTML_لغة_ترميز_النص_الفائق ---- -
{{HTMLSidebar}}
- -

HTML ( لغة ترميز النصوص التشعبية ) هي اللبنة الأساسية للويب. فهي تقوم بوصف و تعريف محتوى صفحة الويب. التقنيات الأخرى إلى جانب HTML تعمل عادةً على وصف مظهر صفحة الويب (CSS) أو تفاعلها مع المستخدم (الجافاسكربت).

- -

مصطلح "نص تشعبي" يشير إلى الروابط التي تربط صفحات الويب ببعضها, إما بموقع واحد أو بين مواقع متعددة. فالروابط هي جانب أساسي من الويب. عبر رفعك لمحتوى على الأنترنت و ربطه بصفحات أخرى أنشأها أشخاص آخرون, فأنت تصبح مشارك نشيط في شبكة الأنترنت.

- -

تستخدم HTML "الوسوم" لوصف النصوص, الصور, وغيرها من المحتويات لعرضعها على متصفح الويب. وسوم HTML تتضمن "عناصر" خاصة مثل  {{HTMLElement("head")}}, {{HTMLElement("title")}}, {{HTMLElement("body")}}, {{HTMLElement("header")}}, {{HTMLElement("footer")}}, {{HTMLElement("article")}}, {{HTMLElement("section")}}, {{HTMLElement("p")}}, {{HTMLElement("div")}}, {{HTMLElement("span")}}, {{HTMLElement("img")}}, وغيرها الكثير.

- -

المقالات أدناه ستساعدك على تعلم المزيد حول HTML.

- -
-
    -
  • مقدمة عن HTMLإذا كنت جديداً على تطوير الويب, فاحرص على قراءة مقالتنا حول أساسيات HTML لتعرف ماهي HTML وكيف يمكنك استخدامها.
  • -
  • دورات عن HTMLللحصول على مقالات عن كيفية استخدام HTML, و كذلك على دورات و أمثلة شاملة, تفقد منطقة تعلم HTML خاصتنا.
  • -
  • مرجع HTML -

    في قسم مرجع HTML الشامل خاصتنا, ستجد تفاصيل حول كل عنصر و صِفة في HTML . 

    -
  • -
- -
-
-

دورات للمبتدئين

- -

منطقة تعلم HTML خاصتنا تتميز بوحدات متعددة و التي تقوم بتعليم HTML من الألف إلى الياء — لا تتطلب معرفة مسبقة.

- -
-
مقدمة عن HTML
-
هذا الوحدة تقوم بتحديد المستوى, تأخذك لتعلم المفاهيم المهمة و تركيب اللغة, كيف يمكنك إنشاء وصلات أنترنت, و كيف يمكنك استخدام HTML لبناء صفحة ويب.
-
الوسائط المتعددة و التضمين
-
هذه الوحدة تشرح كيف يمكنك استخدام أتش تي أم إل لتضمين وسائط متعددة في صفحات الويب خاصتك, وتتضمن المقالة طرق مختلفة يمكنك استخدامها لإضافة صورة, و كيف يمكنك تضمين فيديو, صوت, و حتى صفحات ويب أخرى كاملة.
-
جداول HTML
-
يمثل عرض البيانات المجدولة على صفحة الويب بطريق مفهومة و سهلة الوصول تحدياً. هذه الوحدة تغطي وسوم الجدول الأساسية, إلى جانب ميزات أكثر تعقيداً مثل إضافة تسميات توضيحية و ملخصات.
-
استمارات HTML
-
الاستمارات هي جزئ مهم جداً من الويب — فهذا يوفر الكثير من الوظائف التي ستحتاجها للتفاعل مع الموقع, مثل التسجيل و تسجيل التدخول, ارسال دعم, شراء منتجات, و المزيد. هذه الوحدة ستأخذك لتبدأ بإنشاء استمارة من ناحية جهة الخادم.
-
استخدام HTML لحل مشاكل شائعة
-
توفر هذه المقالة روابط لأقسام تحتوي على شرح لكيفية استخدام HTML لحل مشاكل شائعة جداً عندما تقوم بإنشاء صفحة ويب مثل: التعامل مع العناوين, إضافة صورة أو فيديو, تأكيد المحتوى, إنشاء استمارة بسيطة و المزيد.
-
- -

مواضيع متقدمة

- -
-
ادارة التركيز في HTML
-
الصفة activeElement و الدالة hasFocus() التي تساعدك على تتبع و التحكم بتفاعلات المستخدم مع عناصر صفحة الويب. 
-
استخدام ذاكرة التخزين المؤقت للتطبيق
-
ذاكرة التخزين المؤقت تسمح للتطبيقات المبنية على الويب بالعمل في وضع عدم الإتصال. يمكنك استخدام واجهة ذاكرة التخزين المؤقت للتطبيق (AppCache) لتحديد الموارد التي يجب على المتصفح تخزينها و إتاحتها للمستخدمين في وضع عدم الإتصال. التطبيقات التي يتم تحميلها مؤقتاً تعمل بشكل صحيح حتى و لو قام المستخدمون بالضغط على زر التحديث عندما يكونون في وضع عدم الإتصال. 
-
-
- -
-

مراجع

- -
-
مرجع HTML
-
تتألف HTML من عناصر, كل منها يمكن تعديلها بواسطة عدد من الصفات. وثائق HTML متلصة ببعضها البعض بواسطة روابط.
-
مرجع عناصر HTML
-
تصفح قائمة لجميع عناصر HTML.
-
مرجع صفات HTML
-
العناصر في HTML تمتلك صفات. تعد هذه الصفات قيم إضافية تقوم بتعديل العناصر أو تخصيص وظيفتها بطرق مختلفة.
-
الصفات الشاملة
-
الصفات الشاملة قد يمكن استخدامها على جميع عناصر HTML, حتى العناصر الغير معيارية. هذا يعني أنَّ أي عنصر غير معياري لا يزال يجب أن يسمح باستخدام هذه الصفات, على الرغم أنَّ هذه العناصر تجعل مستند HTML5 غير متوافق.
-
العناصر المضمنة و العناصر المستحوذة
-
العناصر في HTML عادةً إما "مضمنة" أو "مستحوذة". العنصر المضمن يأحذ المساحة المحصورة بواسطة الوسوم التي تحدده. أما العنصر المستحوذ فأنه يأخذ كامل مساحة العنصر الأب (الحاوي), وبالتالي فإنه ينشئ "كتلة".
-
أنواع الرابط
-
في HTML, أنواع روابط متنوعة يمكن استخدامها لإنشاء أو تعريف صلة بين وثيقتين. تتضمن عناصر الرابط التي يمكن استخدامها على <a>, <area>, و <link>.
-
صيغ الوسائط المدعومة في HTML و عناصر الصوت و الفيديو
-
عنصر <audio> و <video> يسمح لك بتشغيل وسائط الصوت و الفيديو. هذه العناصر توفر بدائل مشابهة للمتصفح كالتي موجودة في أدوبي فلاش و الإضافات الأخرى.
-
أنواع محتوى HTML
-
تتألف HTML من عدة أنواع من المحتوى, كل نوع يسمح لك باستخدام عدة سياقات و يمنعك استخدامها في أخرى. وبالمثل كل نوع يملك مجموعة من الفئات يمكن أن تحتوي على عناصر يمكن أو لا يمكن استخدامها. هذا دليل لهذه الفئات.
-
وضع المراوغة و الوضع المعياري
-
معلومات تاريخية عن وضع المراوغة و الوضع المعياري.
-
- -

مواضيع متعلقة

- -
-
إضافة لون إلى عناصر HTML باستخدام السي أس أس
-
هذه المقالة تغطي معظم الطرق التي يمكن ان تستخدمها لإضافة لون لمحتوى HTML, و تسرد ما الأجزاء من وثيقة HTML التي يمكن تلوينها و ما خصائص السي أس أس التي يمكنك استخدامها لفعل ذلك. تتضمن أمثلة, روابط لأدوات تصميم أنماط (اختيار ألوان, اختيار تدرج لوني ..), و المزيد.
-
-
-
- -

رؤية المزيد..

-
diff --git a/files/ar/games/index.html b/files/ar/games/index.html deleted file mode 100644 index 8bf9ec3ff9..0000000000 --- a/files/ar/games/index.html +++ /dev/null @@ -1,98 +0,0 @@ ---- -title: Games development -slug: Games -tags: - - Apps - - Game Development - - Gamedev - - Games - - HTML5 Games - - JavaScript Games - - NeedsTranslation - - TopicStub - - Web -translation_of: Games ---- -
{{GamesSidebar}}
- -
-

الألعاب هي واحدة من أكثر أنشطة الكمبيوتر شعبية.تصل التقنيات الحديثة باستمرار لتتمكن من تطوير ألعاب أفضل وأكثر قوة حيث يمكن تشغيلها في أي متصفح ويب متوافق مع المعايير.

-
- -
{{EmbedGHLiveSample("web-tech-games/index.html", '100%', 820)}}
- -
-
-

تطوير ألعاب الويب

- -

- -

مرحبًا بك في مركز تطوير ألعاب MDN! في هذا المجال من الموقع ، نوفر موارد لمطوري الويب الراغبين في تطوير الألعاب. ستجد العديد من البرامج التعليمية والمقالات المفيدة في القائمة الرئيسية على اليسار ، لذلك لا تتردد في الاستكشاف.

- -

لقد قمنا أيضًا بتضمين قسم مرجعي حتى تتمكن من العثور بسهولة على معلومات حول جميع واجهات برمجة التطبيقات الأكثر شيوعًا المستخدمة في تطوير اللعبة.

- -

- - - -
ملاحظة: يعتمد إنشاء الألعاب على الويب على عدد من تقنيات الويب الأساسية مثل HTML و CSS و JavaScript. تعتبر منطقة التعلم مكانًا جيدًا للبدء في الأساسيات.
-
- -
-

Port native games to the Web

- -

If you are a native developer (for example writing games in C++), and you are interested in how you can port your games over to the Web, you should learn more about our Emscripten tool — this is an LLVM to JavaScript compiler, which takes LLVM bytecode (e.g. generated from C/C++ using Clang, or from another language) and compiles that into asm.js, which can be run on the Web.

- -

To get started, see:

- - -
-
- -
-
-

أمثلة

- -

للحصول على قائمة من أمثلة ألعاب الويب. انظر صفحة الأمثلة لدينا. أيضا تحقق من games.mozilla.org لمزيد من الموارد المفيدة!

-
-
- -

See also

- -
-
-
-
Build New Games
-
A collaborative site featuring a large number of open web game development tutorials. Has not been very active recently, but still holds some nice resources.
-
Creative JS
-
A collection of impressive JavaScript techniques and experiments, not specific to games, but helpful nonetheless. Has not been very active recently, but still holds some nice resources.
-
Game programming patterns
-
An online book, written by Bob Nystrom, which discusses programming patterns in the context of game development with the aim of helping game developers produce more effective and efficient code.
-
Gamedev.js Weekly
-
Weekly newsletter about HTML5 game development, sent every Friday. Contains the latest articles, tutorials, tools and resources.
-
HTML5 Game Devs Forum
-
Forums for developers, framework creators and publishers. Ask questions, get feedback and help others.
-
-
- -
-
-
HTML5 Game Engine
-
List of the most popular HTML5 game frameworks along with their rating, features and samples.
-
JSBreakouts
-
Compare JavaScript Breakout clones in different frameworks to help you choose the right one for you.
-
Tuts+ Game Development
-
Tutorials and articles about game development in general.
-
HTML5 Gamedev Starter
-
Starter for the new game developers, a curated list of links to various, useful resources around the web.
-
js13kGames
-
JavaScript coding competition for HTML5 game developers with the file size limit set to 13 kilobytes. All the submitted games are available in a readable form on GitHub.
-
Mozilla Hacks blog
-
Games category on the Mozilla Hacks blog containing interesting gamedev related articles.
-
-
-
diff --git a/files/ar/games/techniques/3d_on_the_web/basic_theory/index.html b/files/ar/games/techniques/3d_on_the_web/basic_theory/index.html deleted file mode 100644 index 502a63c9f9..0000000000 --- a/files/ar/games/techniques/3d_on_the_web/basic_theory/index.html +++ /dev/null @@ -1,126 +0,0 @@ ---- -title: شرح نظرية ثلاثية الابعاد الأساسية -slug: Games/Techniques/3D_on_the_web/Basic_theory -translation_of: Games/Techniques/3D_on_the_web/Basic_theory ---- -
{{GamesSidebar}}
- -

This article explains all of the basic theory that's useful to know when you are getting started working with 3D.

- -

نظام الاحداثيات الديكارتي

- -

ثلاثي الابعاد بشكل أساسي هو عبارة عن تمثيل للأشكال في مساحة ثلاثية الابعاد مع نظام احداثي يستخدم لحساب موضع الاشكال.

- -

يستخدم WebGL نظام الاحداثيات الديكارتي حيث يشير x الى محور السينات (اليمين) ويشير y الى محور الصادات (للأعلى) ويشير z الى محور الزينات (خارج الشاشة) كما هو موضح بالشكل التالي:Coordinate system

- -

الكائنات 

- -

تسمى النقطة التي تمثل الكائن في الفضاء بـِ الرأس vertices والتي تمثل موقع الكائن. كل نقطة لها عدة سمات وهي:

- -
    -
  1. الموقع: يحدد من خلال نقطة ثلاثية الابعاد x y z.
  2. -
  3. اللون: يحمل قيمة مكونة من أربعة خانات وهي: قيمة اللون الأحمر وقيمة اللون الأخضر وقيمة اللون الأزرق وقيمة الشفافية التي تتراوح ما بين 0.0 و1.0.
  4. -
  5. الاتجاه.
  6. -
  7. البنية texture: وهي عبارة عن صورة ثنائية الابعاد تستخدم لتعبئة أحد السطوح بدلا من اللون.
  8. -
- -

 

- -

Cube

- -

 

- -

فمثلا: الكائن أعلاه (مكعب) يحتوي على 8 رؤوس مختلفة في الفضاء v0,v1,v2,v3,v4,v5,v6,v7 وعلى 6 سطوح (أوجه) كل منها مكون من 4 نقاط.

- -
    -
  • عندما نقوم بتوصيل النقاط فإننا نقوم على انشاء حواف edge المكعب.
  • -
  • الهندسة geometry تبنى من خلال الرؤوس vertices والسطوح faces بينما المادة materials تتمثل في البنية texture والتي تكون اما لون أو صورة.
  • -
  • عندما نقوم بتوصيل الهندسة بالمادة فإننا نحصل على الشبكة mesh.
  • -
- -

 

- -

Rendering pipeline

- -

يتم معالجة الجرافيك من خلال أخذ الكائنات ثلاثية الابعاد والتي يتم انشاءها من العناصر الأولية (نقطة، مثلث، خط) باستخدام الرؤوس ومن ثم حساب الأجزاء fragments وعرضها على الشاشة (ثنائية الابعاد) بوحدة البيكسل pixel.

- -

Rendering pipeline

- -

 

- -

المصطلحات المستخدمة في الرسمة أعلاه هي كالتالي:

- -
    -
  1. العنصر البدائي primitive: والذي يتكون من الرؤوس والتي تكون اما مثلث أو نقطة أو خط.
  2. -
  3. الجزء fragment: وهو اسقاط ثلاثي الابعاد لبيكسل والذي يحمل نفس السمات المميزة لكل بيكسل.
  4. -
  5. البيكسل pixel: نقطة على الشاشة ثنائية الابعاد والتي تحمل قيمة لون RGBA.
  6. -
- -

 

- -

معالجة الرؤوس

- -

يتم معالجة الرؤوس من خلال جمع المعلومات حول كل رأس على حدا في العنصر البدائي وتعيين احداثياتها في المساحة ثلاثية الابعاد للمشاهد ليراها. وتشبه المعالجة طريقة أخذ صورة لمشهد أنت قمت باعداه (وضع الأشياء بمكانها المناسب ومن ثم تهيئة الكمرة ومن ثم أخذ الصورة).Vertex processing

- -

 

- -

هناك أربع مراحل لهذه العملية:

- -
    -
  1. ترتيب المكونات objects والتي تسمى تحويل النموذج modal transformation.
  2. -
  3. تحويل العرض view transformation والذي يعتني بالموضع وتحديد اتجاه الكمرة في الفضاء ثلاثي الابعاد حيث يتم ضبط الكمرة من خلال ثلاثة متغيرات وهي الموقع والاتجاه والتوجيه.
    -  
  4. -
- -

Camera

- -
    -
  1. تحويل الاسقاط projection transformation والذي يدعى أيضا تحويل المنظور perspective transformation حيث يعتني بإعداد ما يمكن رؤيته بواسطة الكمرة من خلال اعداد مجال الرؤية ونسبة العرض الى الارتفاع aspect ratio والقرب والبعد.
  2. -
- -

Camera settings

- -

 

- -
    -
  1.  تحويل إطار العرض viewport transformation والذي يهتم بكل المخرجات في طريقة عرض الجرافيك على الشاشة.
  2. -
- -

 

- -

 

- -

المسح المجالي

- -

يتم بالمسح المجالي تحويل الاشكال الأولية الناتجة عن توصيل الرؤوس الى مجموعة من الأجزاء fragments (اسقاطات ثلاثية الابعاد للبيكسلات ثنائية الابعاد) حيث يتم محاذاتها مع شبكة البيكسل.Rasterization

- -

 

- -

معالجة الجزء

- -

ترتكز معالجة الأجزاء على البنية texture والإضاءة حيث تقوم بحساب الألوان النهائية استنادًا إلى المعلمات المحددة.

- -

Fragment processing

- -

الإضاءة

- -

الألوان التي نراها على الشاشة هي نتيجة تفاعل مصدر ضوء مع ألوان سطح مادة الكائن. الضوء قد يمتص أو قد ينعكس تبعا لذلك.

- -

 

- -

هناك أربع أنواع أساسية من الإضاءة:

- -
    -
  • ضوء اتجاهي Diffuse بعيد مثل الشمس.
  • -
  • نقطة ضوئية Specular مثل مصباح الإضاءة في الغرفة.
  • -
  • ضوء محيطي Ambient وهو ضوء ثابت ينعكس على كل شيء.
  • -
  • ضوء اشعاعي Emissive وهو الضوء المنبعث مباشرة من الكائن.
  • -
- -

مخرجات الدمج

- -

أثناء مرحلة معالجة المخرجات يتم تحويل جميع أجزاء الأوليات من الفضاء ثلاثي الابعاد الى شبكة ثنائية الابعاد من البيكسلات ثم تطبع على الشاشة. أيضا يتم تطبيق بعض المعالجات من أجل تجاهل بعض المعلومات الغير مطلوبة مثل الكائنات الغير مرئية أو الأجزاء خارج الشاشة أو الكائنات التي تقع خلف كائنات أخرى.

- -

Output merging

- -

 

diff --git a/files/ar/games/techniques/3d_on_the_web/index.html b/files/ar/games/techniques/3d_on_the_web/index.html deleted file mode 100644 index 3944c617c6..0000000000 --- a/files/ar/games/techniques/3d_on_the_web/index.html +++ /dev/null @@ -1,113 +0,0 @@ ---- -title: 3D games on the Web -slug: Games/Techniques/3D_on_the_web -tags: - - Games - - Graphics - - NeedsContent - - NeedsExample - - NeedsTranslation - - TopicStub - - WebGL - - WebVR - - three.js -translation_of: Games/Techniques/3D_on_the_web ---- -
{{GamesSidebar}}

For rich gaming experiences on the Web the weapon of choice is WebGL, which is rendered on HTML {{htmlelement("canvas")}}. WebGL is basically an OpenGL ES 2.0 for the Web — it's a JavaScript API providing tools to build rich interactive animations and of course also games. You can generate and render dynamic 3D graphics with JavaScript that is hardware accelerated.

- -

Documentation and browser support

- -

The WebGL project documentation and specification is maintained by the Khronos Group, not the W3C as with most of the Web APIs. Support on modern browsers is very good, even on mobile, so you don't have to worry about that too much. The main browsers are all supporting WebGL and all you need to focus on is optimizing the performance on the devices you use.

- -

There's an ongoing effort on releasing WebGL 2.0 (based on OpenGL ES 3.0) in the near future, which will bring many improvements and will help developers build games for the modern Web using current, powerful hardware.

- -

Explaining basic 3D theory

- -

The basics of 3D theory centers around shapes represented in a 3D space, with a coordinate system being used to calculate their positions. See our Explaining basic 3D theory article for all the information you need.

- -

Advanced concepts

- -

You can do a lot more with WebGL. There are some advanced concepts which you should dive into and learn more about — like shaders, collision detection, or the latest hot topic — virtual reality on the web.

- -

Shaders

- -

It's worth mentioning shaders, which are a separate story on their own. Shaders use GLSL, a special OpenGL Shading Language with syntax similar to C that is executed directly by the graphics pipeline. They can be split into Vertex Shaders and Fragment Shaders (or Pixel Shaders) — the former transforms shape positions to real 3D drawing coordinates, while the latter computes rendering colors and other attributes. You should definitely check out GLSL Shaders article to learn more about them.

- -

Collision Detection

- -

It's hard to imagine a game without the collision detection — we always need to work out when something is hitting something else. We have information available for your to learn from:

- - - -

WebVR

- -

The concept of virtual reality is not new, but it's storming onto the web thanks to hardware advancements such as the Oculus Rift, and the (currently experimental) WebVR API for capturing information form VR hardware and making it available for use in JavaScript applications. For more, read WebVR — Virtual Reality for the Web.

- -

There's also the Building up a basic demo with A-Frame article showing you how easy it is to build 3D environments for virtual reality using the A-Frame framework.

- -

The rise of libraries and frameworks

- -

Coding raw WebGL is fairly complex, but you'll want to get to grips with it in the long run, as your projects get more advanced (see our WebGL documentation to get started.) For real world projects you'll probably also make use of a framework to speed up development and help you manage the project you're working on. Using a framework for 3D games also helps optimize the performance as a lot is taken care of by the tools you use, so you can focus on building the game itself.

- -

The most popular JavaScript 3D library is Three.js, a multi-purpose tool that makes common 3D techniques simpler to implement. There are other popular game development libraries and frameworks worth checking too; A-FramePlayCanvas and Babylon.js are among the most recognizable ones with rich documentation, online editors and active communities.

- -

Building up a basic demo with A-Frame

- -

A-Frame is a web framework for building 3D and VR experiences. Under the hood, it is a three.js framework with a declarative entity-component pattern, meaning we can build scenes with just HTML. See the Building up a basic demo with A-Frame subpage for the step-by-step process of creating the demo.

- -

Building up a basic demo with Babylon.js

- -

Babylon.js is one of the most popular 3D game engines used by developers. As with any other 3D library it provides built-in functions to help you implement common 3D functionality more quickly. See the Building up a basic demo with Babylon.js subpage for the basics of using Babylon.js, including setting up a development environment, structuring the necessary HTML, and writing the JavaScript code.

- -

Building up a basic demo with PlayCanvas

- -

PlayCanvas is a popular 3D WebGL game engine open sourced on GitHub, with an editor available online and good documentation. See the Building up a basic demo with PlayCanvas subpage for high level details, and further articles showing how to create demos using the PlayCanvas library, and the online editor.

- -

Building up a basic demo with Three.js

- -

Three.js, as any other library, gives you a huge advantage: instead of writing hundreds of lines of WebGL code to build anything interesting you can use built-in helper functions to do it a lot easier and faster. See the Building up a basic demo with Three.js subpage for the step-by-step process of creating the demo.

- -

Other tools

- -

Both Unity and Unreal can export your game to WebGL with asm.js, so you're free to use their tools and techniques to build games that will be exported to the web.

- -

- -

Where to go next

- -

With this article we just scratched the surface of what's possible with currently available technologies. You can build immersive, beautiful and fast 3D games on the Web using WebGL, and the libraries and frameworks build on top of it.

- -

Source code

- -

You can find all the source code for this series demos on GitHub.

- -

APIs

- - - -

Frameworks

- - - -

Tutorials

- - diff --git a/files/ar/games/techniques/index.html b/files/ar/games/techniques/index.html deleted file mode 100644 index 66edeebd82..0000000000 --- a/files/ar/games/techniques/index.html +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: Techniques for game development -slug: Games/Techniques -tags: - - Games - - Guide - - NeedsTranslation - - TopicStub -translation_of: Games/Techniques ---- -
{{GamesSidebar}}
{{IncludeSubnav("/en-US/docs/Games")}}
- -
-

This page lists essential core techniques for anyone wanting to develop games using open web technologies.

-
- -
-
Using async scripts for asm.js
-
Especially when creating medium to large-sized games, async scripts are an essential technique to take advantage of, so that your game's JavaScript can be compiled off the main thread and be cached for future game running, resulting in a significant performance improvement for your users. This article explains how.
-
Optimizing startup performance
-
How to make sure your game starts up quickly, smoothly, and without appearing to lock up the user's browser or device.
-
Using WebRTC peer-to-peer data channels
-
In addition to providing support for audio and video communication, WebRTC lets you set up peer-to-peer data channels to exchange text or binary data actively between your players. This article explains what this can do for you, and shows how to use libraries that make this easy.
-
Efficient animation for web games
-
This article covers techniques and advice for creating efficient animation for web games, with a slant towards supporting lower end devices such as mobile phones. We touch on CSS transitions and CSS animations, and JavaScript loops involving {{ domxref("window.requestAnimationFrame") }}.
-
Audio for Web Games
-
Audio is an important part of any game — it adds feedback and atmosphere. Web-based audio is maturing fast, but there are still many browser differences to negotiate. This article provides a detailed guide to implementing audio for web games, looking at what works currently across as wide a range of platforms as possible.
-
2D collision detection
-
A concise introduction to collision detection in 2D games.
-
Tilemaps
-
Tiles are a very popular technique in 2D games for building the game world. These articles provide an introduction to tilemaps and how to implement them with the Canvas API.
-
diff --git a/files/ar/glossary/accessibility/index.html b/files/ar/glossary/accessibility/index.html deleted file mode 100644 index 38f2f02832..0000000000 --- a/files/ar/glossary/accessibility/index.html +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: إتاحة -slug: Glossary/Accessibility -tags: - - إتاحة - - مسرد -translation_of: Glossary/Accessibility ---- -

تشير الإتاحة الويبيّة (Web Accessibility) إلى أفضل الممارسات المُستخدمة لإبقاء المواقع قابلة للاستخدام بغض النظر عن الإعاقات (أو القيود) الجسديّة والتقنيّة. عُرِفَت ونُقِشَت الإتاحة الويبيّة رسمياً في رابطة الويب العالمية (W3C) خلال {{Glossary("WAI","مبادرة الإتاحة الويبيّة")}} (WAI).

- -

المزيد من التفاصيل

- -

معلومات عامة

- - - -

تعلم الإتاحة

- - - -

مراجع تقنية

- - diff --git a/files/ar/glossary/algorithm/index.html b/files/ar/glossary/algorithm/index.html deleted file mode 100644 index e3dbdbfd5f..0000000000 --- a/files/ar/glossary/algorithm/index.html +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: خوارزمية -slug: Glossary/Algorithm -tags: - - مسرد -translation_of: Glossary/Algorithm ---- -

الخوارزميّة هي مجموعة من الخطوات المتكاملة لتنفيذ مهمة معينة.

- -

بتعبير آخر، الخوارزميّة هي وسيلة لوصف طريقة (أسلوب) لحل مشكلة ما ليُمكِن حلها، لاحقاً، بشكل متكرر (أي مهما تكررت المشكلة يُمكِن استخدام هذه الخوارزميّة لحلها دوماً) سواءً من قبل الآلات أو البشر. يقيّم علماء الحاسوب كفاءة الخوارزميّة من خلال مفهوم "التعقيد الخوارزمي" أو "Big O".

- -

على سبيل المثال:

- -
    -
  • وصفة الطعام هي مثال بسيط على خوارزميّة يُمكِن تنفيذها من قبل البشر.
  • -
  • غالباً ما تُستخدم خوارزميّة الفرز (sorting algorithm) في البرمجة لشرح كيفيّة فرز الآلات للبيانات.
  • -
- -

المزيد من التفاصيل

- -

معلومات عامة

- - - -

مراجع تقنيّة

- - diff --git a/files/ar/glossary/api/index.html b/files/ar/glossary/api/index.html deleted file mode 100644 index 84fa067677..0000000000 --- a/files/ar/glossary/api/index.html +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: API -slug: Glossary/API -translation_of: Glossary/API ---- -

API (واجهة برمجة التطبيقات) هي مجموعة من الميزات والقواعد الموجودة داخل برنامج (التطبيق) مما يتيح التفاعل معها من خلال البرامج - بدلاً من واجهة مستخدم بشرية. يمكن اعتبار واجهة برمجة التطبيقات عقد بسيط (الواجهة) بين التطبيق الذي يقدمها والعناصر الأخرى، مثل برامج أو أجهزة خارجية.

- -

في تطوير الويب، تعد واجهة برمجة التطبيقات عادةً مجموعة من ميزات التعليمات البرمجية (على سبيل المثال. {{glossary("method","methods")}}، {{Glossary("property","properties")}}، events and {{Glossary("URL", "URLS")}} التي يمكن للمطور استخدامها في تطبيقاتها للتفاعل مع مكونات مستعرض ويب الخاص بالمستخدم، أو البرامج/الأجهزة الأخرى على كمبيوتر المستخدم، أو مواقع ويب أو خدمات خارجية.

- -

على سبيل المثال:

- -

يمكن استخدام getUserMedia API للاستيلاء على الصوت والفيديو من كاميرا ويب للمستخدم ، والتي يمكن استخدامها بعد ذلك بأي طريقة يحبها المطور ، على سبيل المثال ، تسجيل الفيديو والصوت ، وبثه إلى مستخدم آخر في مؤتمر عبر الهاتف ، أو التقاط الصور الثابتة من الفيديو.
-     يمكن استخدام واجهة برمجة تطبيقات تحديد الموقع الجغرافي لاسترداد معلومات الموقع من أي خدمة متاحة للمستخدم على أجهزتهم (مثل GPS) ، والتي يمكن استخدامها بعد ذلك بالاقتران مع واجهات برمجة التطبيقات لخرائط Google لرسم موقع المستخدم على خريطة مخصصة على سبيل المثال وإظهارها لما هي مناطق الجذب السياحي في منطقتهم.
-     يمكن استخدام واجهات برمجة تطبيقات تويتر لاسترداد البيانات من حسابات المستخدم على تويتر، على سبيل المثال، لعرض أحدث تغريداتهم على صفحة ويب.
-     يمكن استخدام واجهة برمجة تطبيقات "رسوم الويب" لتحريك أجزاء صفحة ويب — على سبيل المثال، لجعل الصور تتحرك أو تستدير.

- -
التعرف على المزيد المعرفة العامة
- -

{{Interwiki("wikipedia", "Application_programming_interface", "API")}} على ويكيبيديا

- -
المرجع التقني
- -

مرجع واجهة برمجة تطبيقات ويب

diff --git a/files/ar/glossary/argument/index.html b/files/ar/glossary/argument/index.html deleted file mode 100644 index 18c1671651..0000000000 --- a/files/ar/glossary/argument/index.html +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: مُعطى -slug: Glossary/Argument -tags: - - جافاسكربت - - مسرد -translation_of: Glossary/Argument ---- -

المُعطى (بالإنجليزيَّة: Argument)هو {{glossary("value", "قيمة")}} ({{Glossary("primitive", "أوليَّة")}} أو {{Glossary("object", "كائنيَّة")}}) تُمرَّر إلى الدالة كمُدخَل.

- -

المزيد من التفاصيل

- -

معلومات عامة

- - - -

مراجع تقنيّة

- -
    -
  • الكائن {{jsxref("Functions/arguments","arguments")}} في لغة {{glossary("JavaScript", "الجافاسكربت")}}
  • -
diff --git a/files/ar/glossary/array/index.html b/files/ar/glossary/array/index.html deleted file mode 100644 index f250d38a45..0000000000 --- a/files/ar/glossary/array/index.html +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: مصفوفة -slug: Glossary/array -tags: - - جافاسكربت - - مسرد -translation_of: Glossary/array ---- -

المصفوفة هي مجموعة مرتبة من البيانات (إما {{Glossary("primitive", "بدائية")}} أو {{Glossary("object", "شيئيّة")}} هذا يعتمد على اللغة المُستخدمة). تُستخدَم المصفوفات لتخزين عدَّة قيم في متغيّر واحد مقارنةً بالمتغيّر العادي الذي لا يمكن أن يُخزِّن سوى قيمة واحدة.

- -

لكل عنصر في المصفوفة رقم يدل عليه، يدعى بالرقم الفهرسي، يسمح هذا الرقم بالوصول إلى قيمة العنصر. تبدأ الفهرسة في لغة الجافاسكربت (كما في معظم اللغات) من الرقم صفر ويمكن التلاعب بعناصر المصفوفة باستخدام العديد من {{Glossary("Method", "الدوالة الصنفيّة")}}.

- -

تكون للمصفوفات الشكل التالي في لغة الجافاسكربت:

- -
var myArray = [1, 2, 3, 4];
-var catNamesArray = ["Jacqueline", "Sophia", "Autumn"];
-//يمكن أن تحتوي المصفوفات في لغة الجافاسكربت على أنواع مختلفة من البيانات كما هو موضَّح أعلاه
- -

المزيد من التفاصيل

- -

معلومات عامة

- - - -

مراجع تقنيّة

- -
    -
  • توثيقات الكائن {{jsxref("Array")}} في لغة الجافاسكربت.
  • -
diff --git a/files/ar/glossary/attribute/index.html b/files/ar/glossary/attribute/index.html deleted file mode 100644 index 522ffb8f91..0000000000 --- a/files/ar/glossary/attribute/index.html +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: خاصية -slug: Glossary/Attribute -tags: - - لغة ترميز النص الفائق - - مسرد -translation_of: Glossary/Attribute ---- -

تُعزِّز الخاصيّة (أو السمة أو الخاصة) الوسم، وتُعدِل من وظيفته أو تضيف بيانات وصفيّة له (metadata). تُعرَّف الخواص دوماً بالصيغة اسم الخاصيّة=القيمة (اسم الخاصيّة متبوعاً بالقيمة المُسندة لها).

- -

المزيد من التفاصيل

- -

مراجع تقنيّة

- - diff --git a/files/ar/glossary/bandwidth/index.html b/files/ar/glossary/bandwidth/index.html deleted file mode 100644 index bfbadfce0f..0000000000 --- a/files/ar/glossary/bandwidth/index.html +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: Bandwidth -slug: Glossary/Bandwidth -tags: - - Bandwidth - - بنية تحتية - - قاموس مصطلحات - - معجم -translation_of: Glossary/Bandwidth ---- -

النطاق الترددي (Bandwidth) هو مقياس مقدار المعلومات التي يمكن أن تمر عبر اتصال بيانات في فترة زمنية محددة. يتم قياسه عادة بمضاعفات بت في الثانية (bps)، على سبيل المثال ميغابت في الثانية (Mbps) أو غيغابت في الثانية (Gbps).

- -

اعرف أكثر

- -
    -
  • {{Interwiki("wikipedia", "Bandwidth")}} على ويكيبيديا
  • -
- -
 
diff --git a/files/ar/glossary/blink/index.html b/files/ar/glossary/blink/index.html deleted file mode 100644 index 9637f62c04..0000000000 --- a/files/ar/glossary/blink/index.html +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: بلينك -slug: Glossary/Blink -tags: - - مسرد -translation_of: Glossary/Blink ---- -

يعد بلينك (Blink) محرِّك تنسيق (أو مُحرِّك تخطيط أو مُحرِّك تموضع - layout engine) مفتوح المصدر طوِّر من شركة جوجل كجزء من مشروع كروميوم (وبالتالي من مشروع كروم أيضاً كونه مبنياً على كروميوم). بلينك هو بالأصل اشتقاق من مكتبة {{glossary("WebKit", "ويب كيت")}} التي تقوم بعملية موضَعِة وعرض الأشكال، وتتعامل مع {{glossary("DOM", "نموذج كائن المستند")}} (DOM).

- -

المزيد من التفاصيل

- -

معلومات عامة

- - diff --git a/files/ar/glossary/boolean/index.html b/files/ar/glossary/boolean/index.html deleted file mode 100644 index b050bb3d8d..0000000000 --- a/files/ar/glossary/boolean/index.html +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: متغير بولياني -slug: Glossary/Boolean -tags: - - أنواع البيانات - - جافاسكربت - - شيفرة المكتوب - - لغات برمجية - - مسرد -translation_of: Glossary/Boolean ---- -

المتغير البولياني هو نوع من البيانات، يأخذ فقط القيمة صحيح أو خطأ. مثلا في جافاسكربت، الشروط البوليانية تستعمل عادة لتحديد أي جزء من الشيفرة سينفذ (كالتعبير الشرطي if) أو سيكرر (كحلقة التكرار for).

- -
/* التعبير الشرطي الجافاسكربتي */
-if (الشرط البولياني) {
-   // ما سينفذ في حالة الشرط صحيح
-}
-
-if (الشرط البولياني) {
-  console.log("الشرط البولياني صحيح");
-} else {
-  console.log("الشرط البولياني خاطئ");
-}
-
-
-/* حلقة التكرار الجافاسكربتية */
-for (متغير التحكم; الشرط البولياني; counter) {
-  // ما سيكرر في حالة الشرط صحيح
-
-for (var i=0; i < 4; i++) {
-  console.log("أطبع فقط إذا الشرط صحيح");
-}
-
- -

المزيد

- -

المركز المعرفي

- -
    -
  • {{Interwiki("wikipedia", "Boolean data type", "Boolean")}} on Wikipedia
  • -
- -

المرجع التقني

- - diff --git a/files/ar/glossary/browser/index.html b/files/ar/glossary/browser/index.html deleted file mode 100644 index 8ce6faac33..0000000000 --- a/files/ar/glossary/browser/index.html +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: متصفح -slug: Glossary/Browser -tags: - - مسرد -translation_of: Glossary/Browser ---- -

مُتصفِح الويب هو برنامج يُستخدَم لاستقبال وعرض الصفحات من {{Glossary("World Wide Web","الشابكة")}}، كما يُمكِّن المستخدمين من الولوج إلى صفحات أخرى عبر {{Glossary("hyperlink","الوصلات")}}.

- -

المزيد من التفاصيل

- -

معلومات عامة

- - - -

متصفحات للتنزيل

- - diff --git a/files/ar/glossary/character/index.html b/files/ar/glossary/character/index.html deleted file mode 100644 index d691ce44ce..0000000000 --- a/files/ar/glossary/character/index.html +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: الحروف -slug: Glossary/Character -translation_of: Glossary/Character -original_slug: Glossary/الحروف ---- -

الحرف هي إما "رمز" (حروف ، أرقام ، علامات ترقيم) أو "تحكم" غير طباعي (على سبيل المثال ، رمز الإرجاع أوخطّ وصل).

- -

{{glossary ("UTF-8")}} هي مجموعة الأحرف الأكثر شيوعًا وتتضمن حروفًا لغوية من أشهر اللغات البشرية.

- -

لمعرفة المزيد

- -

معلومات عامة

- -
    -
  • {{interwiki("wikipedia", "Character (computing)")}} على Wikipedia
  • -
  • {{interwiki("wikipedia", "Character encoding")}} على Wikipedia
  • -
  • {{interwiki("wikipedia", "ASCII")}} على Wikipedia
  • -
  • {{interwiki("wikipedia", "UTF-8")}} على Wikipedia
  • -
  • {{interwiki("wikipedia", "Unicode")}} على Wikipedia
  • -
diff --git a/files/ar/glossary/compile/index.html b/files/ar/glossary/compile/index.html deleted file mode 100644 index dd841b3e04..0000000000 --- a/files/ar/glossary/compile/index.html +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: تصريف -slug: Glossary/Compile -tags: - - مسرد -translation_of: Glossary/Compile ---- -

التصريف (بالإنجليزيَّة: Compiling) هو عمليَّة تحويل برنامج حاسوبي مكتوب {{Glossary("computer programming", "بلغة برمجة")}} إلى برنامجٍ مُكافِئ مكتوب بلغةٍ أخرى (المُصرِّف هو البرمجيَّة التي تؤدي هذه المهمة). تُسمَّى أحيانًا هذه العمليَّة "بالتجميع (بالإنجليزيَّة: Assembling)" أو "البناء (بالإنجليزيَّة: Build)"، ما يوضِّح عادةً وجود المزيد من الخطوات بعد التصريف (كتحزيم البرنامج في صيغة ثنائيَّة تنفيذيَّة).

- -

يُحوِّل المُصرِّف عادةً لغةً عالية المُستوى (مثل سي أو {{Glossary("Java", "جافا")}})، المفهومة من البشر، إلى لغة الآلة (كلغة التجميع)، المفهومة من المعالِج. تتُرجِم بعض المُصرِّفات بين لُغتين من نفس المستوى، فتُسمَّى مُصبرِفات (نحتًا من مُصرِّف بيني) أو مُصعرِفات (نحتًا من مُصرِّف تقاطعي)، كتصريف لغة التايب سكربت إلى {{Glossary("JavaScript", "الجافاسكربت")}}.

- -

مُعظَم المُصرِّفات إمّا قبليَّة (تُصرِّف البرنامج قبل تشغيله، بالإنجليزيَّة: Ahead of time) وإمّا آنيَّة (تُصرِّف البرنامج أثناء تشغيله، بالإنجليزيَّة: Just in time). عادةً ما يستخدم المُطوِّر المُصرِّفات القبليَّة الاعتياديَّة من سطر الأوامر أو من {{Glossary("IDE", "بيئته البرمجيَّة")}}. من أشهر مُصرِّفات هذا النوع هو مُصرِّف جنو GCC. هذا بالنسبة للمُصرِّفات القبليَّة، أم المُصرِّفات الآنية فهي عادةً شفّافة بالنسبة لك، وتُستخدَم لأداءٍ أفضل. يحوي مُحرِّك الجافاسكربت SpiderMonkey لمُتصفِّح فايرفوكس كمثال مُصرِّفًا آنيًّا مُضمّنًا فيه، يُصرِّف هذا المُصرِّف أكواد الجافاسكربت في المواقع العنكبوتيَّة إلى لغة الآلة أثناء تصفُّحِكَ لها، ما يُحسِّن الأداء ويزيده سُرعة. تعمل مشاريع مثل لغة التجميع العنكبوتيَّة (بالإنجليزيَّة: WebAssembly) على جعل الأداء أفضل من ذلك حتّى.

- -

المزيد من التفاصيل

- -

معلومات عامة

- - - -

موارد تعليميَّة

- - diff --git a/files/ar/glossary/computer_programming/index.html b/files/ar/glossary/computer_programming/index.html deleted file mode 100644 index c497bed929..0000000000 --- a/files/ar/glossary/computer_programming/index.html +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: برمجة -slug: Glossary/Computer_Programming -tags: - - برمجة - - لغات برمجة - - مسرد -translation_of: Glossary/Computer_Programming ---- -

تُعرَّف البرمجة (أو برمجة الحاسب الآلي) بأنَّها عمليّة إنشاء وتنظيم مجموعة من التعليمات. تُخبِر هذه التعليمات الحاسوب بما عليه فعله باللغة التي يفهمها. تأتي هذه التعليمات بأشكال لغات مختلفة مثل جافا، جافاسكربت، بايثون، روبي ...إلخ.

- -

يمكنك، باستخدام اللغة المناسبة، إنشاء جميع أنواع البرمجيات. على سبيل المثال، برنامج يساعد العلماء على حل المعادلات المُعقدة، قاعدة بيانات تُخزِن كميّة هائلة من البيانات، موقع يتيح للناس تحميل الأغاني، أو برنامج يتيح للناس إنشاء أفلام رسوم متحركة.

- -

المزيد من التفاصيل

- -

معلومات عامة

- -
    -
  • مقالة عن {{Interwiki("wikipedia", "برمجة", "البرمجة")}} في الموسوعة الحرَّة
  • -
  • مقالة عن {{Interwiki("wikipedia", "قائمة_لغات_البرمجة", "قائمة بلغات البرمجة")}} في الموسوعة الحرَّة
  • -
diff --git a/files/ar/glossary/cookie/index.html b/files/ar/glossary/cookie/index.html deleted file mode 100644 index 05e0621c77..0000000000 --- a/files/ar/glossary/cookie/index.html +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: كعكة -slug: Glossary/Cookie -tags: - - مسرد -translation_of: Glossary/Cookie ---- -

الكعكة (ملف تعريف الارتباط) هي قدر صغير من المعلومات يُترَك على حواسيب الزوار من قبل الموقع بواسطة {{ Glossary("browser", "المُتصفِح") }}.

- -

تُستخدَم الكعكات لتخصيص تجربة المُستخدِم مع الموقع. قد تحتوي هذه الكعكات على تفضيلات أو مدخلات المُستخدِم عند دخوله لهذا الموقع. يستطيع المُستخدمِين تعديل متصفحاتِهم لقبول، أو رفض، أو حذف هذه الكعكات.

- -

يُمكِن وضع الكعكات وتعديلها من جهة الخادم باستخدام الترويسة Set-Cookie، أو بواسطة الجافاسكربت باستخدام الخاصيّة document.cookie.

- -

المزيد من التفاصيل

- -

معلومات عامة

- - diff --git a/files/ar/glossary/copyleft/index.html b/files/ar/glossary/copyleft/index.html deleted file mode 100644 index 5b44cfb6ad..0000000000 --- a/files/ar/glossary/copyleft/index.html +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: حقوق متروكة -slug: Glossary/Copyleft -tags: - - ترخيص - - مسرد -translation_of: Glossary/Copyleft ---- -

يشير مصطلح الحقوق المتروكة (copyleft)، في سياق التراخيص القانونيّة، إلى نوع الرخص التي تفرض ترخيص إعادة توزيع العمل المُرخَص بها بالرخصة الأصل. يمكننا أخذ {{Glossary("GPL", "رخصة جنو العموميّة")}} كمثال على تراخيص الحقوق المتروكة للبرمجيات ورخص المشاع الإبداعي من فئة الترخيص بالمثل كمثال على تراخيص الحقوقة المتروكة للأعمال الفنيّة.

- -

المزيد من التفاصيل

- -

معلومات عامة

- - diff --git a/files/ar/glossary/data_structure/index.html b/files/ar/glossary/data_structure/index.html deleted file mode 100644 index 49529d5852..0000000000 --- a/files/ar/glossary/data_structure/index.html +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: هيكل بيانات -slug: Glossary/Data_structure -tags: - - مسرد - - هياكل-البيانات -translation_of: Glossary/Data_structure ---- -

هيكل البيانات (بالإنجليزيَّة: Data Structure) هو طريقة مُعينة  لتخزين وتنظيم البيانات ما يُمكِّن استخدامها بكفاءة.

- -

المزيد من التفاصيل

- -

معلومات عامة

- - diff --git a/files/ar/glossary/decryption/index.html b/files/ar/glossary/decryption/index.html deleted file mode 100644 index fc8c14de60..0000000000 --- a/files/ar/glossary/decryption/index.html +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: فك التشفير -slug: Glossary/Decryption -tags: - - حماية - - مسرد -translation_of: Glossary/Decryption ---- -

فك التشفير، في علم التشفير، هو تحويل {{glossary("ciphertext", "نص مُشفَر")}} إلى {{glossary("cleartext", "نص مقروء")}}.

- -

فك التشفير هو من مبادئ عمليّة التشفير، فهو يحوِّل النص المُشفَر (كما يسمى النص المُعمَّى أيضاً) إلى نص مقروء باستخدام خوارزميّة تشفير تُسمى {{glossary("cipher", "الشيفرة")}}. كما في التشفير، تجري عمليّة فك التشفير في الخوارزميات الحديثة باستخدام خوارزميّة وكلمة سريّة معينة، تدعى {{glossary("key", "المفتاح")}}. في حين أنَّ الخوارزميات غالباً ما تُنشَر للعامة، فالمفتاح ينبغي أن يبقى سرياً مادام النص المُشفَر يجب أن يبقى سرياً.

- -

 

- -

مبدأ عمليّة فك التشفير.

- -

فك التشفير هو العمليّة المعاكسة {{glossary("encryption", "للتشفير")}}. تكون عمليّة فك التشفير صعبة الإجراء حسابياً إن كان المفتاح السري غير ملعوم. يتوقف مدى الصعوبة على قوَّة الخوارزميّة المُختارة وعلى التقدُم في عمليّة تحليلها (أي كُلما عُلِمَت تفاصيل أكثر عن آلية التشفير المُستخدمة وضَعُفَت قوة الخوارزميّة سهل كسرها).

- -

المزيد من التفاصيل

- -

مراجع تقنيّة

- - diff --git a/files/ar/glossary/denial_of_service/index.html b/files/ar/glossary/denial_of_service/index.html deleted file mode 100644 index 4fe7c06334..0000000000 --- a/files/ar/glossary/denial_of_service/index.html +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: حجب الخدمة -slug: Glossary/Denial_of_Service -tags: - - حماية - - مسرد -translation_of: Glossary/Denial_of_Service ---- -

{{page("/ar/docs/Glossary/DOS_attack")}}

diff --git a/files/ar/glossary/dom/index.html b/files/ar/glossary/dom/index.html deleted file mode 100644 index 11757b223f..0000000000 --- a/files/ar/glossary/dom/index.html +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: DOM -slug: Glossary/DOM -tags: - - CodingScripting - - DOM - - Glossary -translation_of: Glossary/DOM ---- -

 

- -

DOM (نموذج كائن المستند) هو {{glossary("API")}} يمثل ويتفاعل مع أي مستند {{glossary("HTML")}} أو {{glossary("XML")}} .

- -

DOM عبارة عن نموذج مستند تم تحميله في {{glossary("browser")}} ويمثل المستند على شكل شجرة عقدة ، حيث تمثل كل عقدة جزءًا من المستند (على سبيل المثال ، {{Glossary("element")}} ، سلسلة نصية ، أو تعليق).

- -

يُعد DOM واحدًا من أكثر {{Glossary("API")}} المستخدم في  {{glossary("World Wide Web","Web")}} لأنه يسمح بتشغيل التعليمات البرمجية في المتصفح للوصول و التفاعل مع كل عقدة في الوثيقة. يمكن إنشاء العقد ونقلها وتغييرها. يمكن إضافة مستمعي الحدث إلى العقد وتشغيله عند وقوع حدث معين.

- -

لم يتم تحديد DOM في الأصل - فقد جاء عندما بدأت المتصفحات في تنفيذ {{Glossary("JavaScript")}}. يطلق على هذا DOM القديم أحيانًا اسم DOM 0. واليوم ، يحافظ WHATWG على معيار DOM .

- -

 

- -

أعرف أكثر

- -

معرفة عامة

- -
    -
  • {{interwiki("wikipedia", "Document_Object_Model", "The Document Object Model")}} على Wikipedia
  • -
- -

معلومات تقنية

- - diff --git a/files/ar/glossary/dos_attack/index.html b/files/ar/glossary/dos_attack/index.html deleted file mode 100644 index 4ab372752a..0000000000 --- a/files/ar/glossary/dos_attack/index.html +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: هجمة حجب الخدمة -slug: Glossary/DOS_attack -tags: - - حماية - - مسرد -translation_of: Glossary/DOS_attack ---- -

هجوم حجب الخدمة (أو هجوم الحرمان من الخدمة - Dos) هي هجمة شبكيّة تمنَع الاستخدام الشرعي (العادي) لموارد {{glossary("server", "الخادم")}} عن طريق إغراقه بالطلبات.

- -

تمتلك الحواسيب حد معين من الموارد، كالقدرة الحسابيّة أو الذاكرة. عندما تُستهلَك هذه الموارد قد يتجمد أو يتعطل البرنامج، مما يجعله غير متوفراً. تتألف هجمة حجب الخدمة من تقنيات متنوعة لجعل لاستنفاذ هذه الموارد وجعل الخادمة أو الشبكة غير متاحة لمستخدميها الشرعيين، أو على الأقل لإبطاء أداء الخادم.

- -

أنواع هجمات حجب الخدمة

- -

هجمات حجب الخدمة هي تصنيف أكثر من أن تكون نوع معين من الهجمات. أدناه توجد قائمة غير شاملة لأنواع هجمات حجب الخدمة:

- -
    -
  • هجوم النطاق الترددي (bandwidth attack)
  • -
  • هجوم إغراق الخدمة بالطلبات (service request flood)
  • -
  • هجوم الغمر التزامني (SYN flooding attack)
  • -
  • هجوم الغمر بطلبات ميثاق رسائل التحكم في الإنترنت (ICMP flood attack)
  • -
  • هجوم الند للند (peer-to-peer attack)
  • -
  • هجوم حجب الخدمة المُستمِر (permanent DoS attack)
  • -
  • هجوم الغمر على مستوى طبقة التطبيقات (application level flood attack)
  • -
- -

المزيد من المعلومات

- - diff --git a/files/ar/glossary/first-class_function/index.html b/files/ar/glossary/first-class_function/index.html deleted file mode 100644 index 83e098f519..0000000000 --- a/files/ar/glossary/first-class_function/index.html +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: الدوال من الدرجة الأولى -slug: Glossary/First-class_Function -translation_of: Glossary/First-class_Function -original_slug: Glossary/الدوال_من_الدرجة_الأولى ---- -

يقال عن لغة البرمجة أنها تملك دوال من الدرجة الأولى عندما تعامل هذه الدوال في تلك اللغة كأي متغير أخر. على سبيل المثال، في تلك اللغات، يمكن أن تمرر الدالة كمعامل لدالة أخرى، ويمكن أن يتم إرجاعها من قبل دالة أخرى، ويمكن تعيينها كقيمة لمتغير.

- -

تعلم المزيد

- -

معلومات عامة

- - diff --git a/files/ar/glossary/forbidden_header_name/index.html b/files/ar/glossary/forbidden_header_name/index.html deleted file mode 100644 index 12776e896f..0000000000 --- a/files/ar/glossary/forbidden_header_name/index.html +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: Forbidden header name -slug: Glossary/Forbidden_header_name -translation_of: Glossary/Forbidden_header_name ---- -

A forbidden header name is the name of any HTTP header that cannot be modified programmatically; specifically, an HTTP request header name (in contrast with a {{Glossary("Forbidden response header name")}}).

- -

Modifying such headers is forbidden because the user agent retains full control over them. Names starting with `Sec-` are reserved for creating new headers safe from {{glossary("API","APIs")}} using Fetch that grant developers control over headers, such as {{domxref("XMLHttpRequest")}}.

- -

Forbidden header names start with Proxy- or Sec-, or are one of the following names:

- -
    -
  • Accept-Charset
  • -
  • Accept-Encoding
  • -
  • Access-Control-Request-Headers
  • -
  • Access-Control-Request-Method
  • -
  • Connection
  • -
  • Content-Length
  • -
  • Cookie
  • -
  • Cookie2
  • -
  • Date
  • -
  • DNT
  • -
  • Expect
  • -
  • Feature-Policy
  • -
  • Host
  • -
  • Keep-Alive
  • -
  • Origin
  • -
  • Proxy-
  • -
  • Sec-
  • -
  • Referer
  • -
  • TE
  • -
  • Trailer
  • -
  • Transfer-Encoding
  • -
  • Upgrade
  • -
  • Via
  • -
- -
-

Note: The User-Agent header is no longer forbidden, as per spec — see forbidden header name list (this was implemented in Firefox 43) — it can now be set in a Fetch Headers object, or via XHR setRequestHeader().  However, Chrome will silently drop the header from Fetch requests (see Chromium bug 571722).

-
- - diff --git a/files/ar/glossary/function/index.html b/files/ar/glossary/function/index.html deleted file mode 100644 index 169997f62c..0000000000 --- a/files/ar/glossary/function/index.html +++ /dev/null @@ -1,87 +0,0 @@ ---- -title: دالة -slug: Glossary/Function -tags: - - جافاسكربت - - مسرد -translation_of: Glossary/Function ---- -

الدالة (بالإنجليزيَّة: Function) هي قطعة من الكود يُمكِن استدعاؤها من جزء آخر أو من قبل نفسها، أو هي {{Glossary("variable", "مُتغيِّر")}} يشير إلى دالة. عندما تُستدعى الدالة، تُمرَّر {{Glossary("Argument", "المُعطيات")}} إلى الدالة كمُدخلات، كما يُمكِن للدالة - اختياريًا - أن تُعيد مُخرجًا. تُصنَّف الدوال في لغة {{glossary("JavaScript", "الجافاسكربت")}} على أنهَّا {{glossary("object", "كائنات")}}.

- -

اسم الدالة هو {{Glossary("identifier", "مُعرِّف")}} يُصرَّح عنه كجزء من كود التصريح عن الدالة. يعتمد {{Glossary("scope", "مجال")}} اسم الدالة على ما إذا كان اسمها تصريحًا أم تعبيرًا (حيث إذا كان تصريحًا سيُحمَّل قبل تنفيذ الكود، أما إذا كان تعبيرًا  سيُحمَّل عند وصول المُفسِّر إليه. طالع هذا السؤال للمزيد من المعلومات).

- -

الأنواع المختلفة للدوال

- -

الدالة المجهولة (بالإنجليزيَّة: Anonymous function) هي دالة لا تملك اسمًا:

- -
function () {};
-// أو باستخدام الأسهم في إصدار EMAScript 2015
-() => {};
-
- -

الدالة المُسمّاة (بالإنجليزيَّة: Named function) هي دالة تملك اسمًا:

- -
function foo() {};
-// أو باستخدام الأسهم في إصدار EMAScript 2015
-const foo = () => {};
-
- -

الدالة المُحاطة (بالإنجليزيَّة: Inner function) هي دالة بداخل أخرى (الدالة square كما في مثالنا أدناه). الدالة المُحيطة (outer function) هي دالة (الدالة addSquares كما في مثالنا أدناه) تُحيط بأخرى:

- -
function addSquares(a,b) {
-   function square(x) {
-      return x * x;
-   }
-   return square(a) + square(b);
-};
-//باستخدام الأسهم في إصدار ECMAScript 2015
-const addSquares = (a,b) => {
-   const square = x => x*x;
-   return square(a) + square(b);
-};
-
- -

الدالة العوديّة (بالإنجليزيَّة: Recursive function) هي دالة تستدعي نفسها. طالع {{Glossary("Recursion", "المعاودة")}} للمزيد من التفاصيل.

- -
function loop(x) {
-   if (x >= 10)
-      return;
-   loop(x + 1);
-};
-//باستخدام الأسهم في إصدار ECMAScript 2015
-const loop = x => {
-   if (x >= 10)
-      return;
-   loop(x + 1);
-};
-
- -

التعبيرات الداليَّة المُستحضرة فوريًا (بالإنجليزيَّة: Immediately Invoked Function Expressions) هي دوال تُستدعى مباشرةً بعد أنْ تُحمَّل إلى {{glossary("Compiler", "مُصرِّف")}} المُتصفِّح. يُعرَّف هذا النوع من الدوال عبر إضافة قوسان: يساري ويميني إضافيان في نهاية تصريح الدالة (انظر أدناه).

- -
// Error (https://en.wikipedia.org/wiki/Immediately-invoked_function_expression)
-/*
-​function foo() {
-    console.log('Hello Foo');
-}();
-*/
-
-(function foo() {
-    console.log("Hello Foo");
-}());
-
-(function food() {
-    console.log("Hello Food");
-})();
-
-
- -

اقرأ هذه المقالة في الموسوعة الحرَّة للمزيد عن هذا النوع من الدوال.

- -

المزيد من التفاصيل

- -

مراجع تقنيّة

- - diff --git a/files/ar/glossary/google_chrome/index.html b/files/ar/glossary/google_chrome/index.html deleted file mode 100644 index 02a62dc468..0000000000 --- a/files/ar/glossary/google_chrome/index.html +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: جوجل كروم -slug: Glossary/Google_Chrome -tags: - - مسرد -translation_of: Glossary/Google_Chrome ---- -

جوجل كروم هو {{glossary("browser", "مُتصفِح")}} ويب مجاني طوِّر بواسطة شركة جوجل. يعد هذا المتصفح مبنياً على مشروع كروميوم مفتوح المصدر. يوجد بضعة اختلافات رئيسيّة بينهما (كروم وكروميوم) مشروحة في موسوعة مشروع كروميوم. يستخدم كلا المشروعين مُحرِّك عرض مُشتَق من {{glossary("WebKit", "ويب كيت")}} يسمى {{glossary("Blink", "بلينك")}}. من الجدير بالذكر أنَّ نسخة كروم لهواتف الآي أو إس لا تستخدم بلينك وإنما تستخدم مُحرِّك عرض نظام التشغيل الأساسي.

- -

المزيد من التفاصيل

- -

معلومات عامة

- - - -

تنزيل كروم للمستخدمين

- -

استخدم الرابط المناسب لمنصتك لتنزيل نسخة كروم للمستخدمين العاديين:

- - - -

تنزيل كروم للمطورين

- -

إذا كنت راغباً بتجربة أحدث مزايا كروم قيد الاختبار، قم بتثبيت النسخ ما قبل المستقرة (الغير مستقرة). تدفع جوجل التحديثات دورياً ليتم تجربتها، كما صُمِمَت هذه النسخ لتعمل جنباً إلى جنب مع النسخ المستقرة بلا مشاكل. قم بزيارة مدونة أخبار الإصدارات الخاصة بكروم لمعرفة آخر التفاصيل.

- - diff --git a/files/ar/glossary/gpl/index.html b/files/ar/glossary/gpl/index.html deleted file mode 100644 index a7d73de893..0000000000 --- a/files/ar/glossary/gpl/index.html +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: رخصة جنو العمومية -slug: Glossary/GPL -tags: - - ترخيص - - مسرد -translation_of: Glossary/GPL ---- -

رخصة جنو العموميّة (GPL) هي رخصة للبرمجيات الحرَّة من نوع رخص {{Glossary("copyleft", "الحقوق المتروكة")}} نُشِرَت من قبل مؤسسة البرمجيات الحرَّة (FSF).  يُمنَح مستخدمين البرمجيات المُرخصة بهذه الرخصة حريّة استخدامها، وقراءة شيفرتها المصدرية، وتعديلها وإعادة توزيع التغييرات التي أجروها (الحريات الأربعة) بشرط توفير نسختهم الموزَّعة من البرمجيّة (سواءً كانت معدلة أم غير معدلة) تحت بنود نفس الرخصة (ولهذا تُعرَف بالرخصة الجرثوميّة أو الفيروسيّة لأنها تصيب جميع البرمجيات المشتقة منها "بالعدوة").

- -

المزيد من التفاصيل

- -

معلومات عامة

- - diff --git a/files/ar/glossary/grid_areas/index.html b/files/ar/glossary/grid_areas/index.html deleted file mode 100644 index 5e89defe39..0000000000 --- a/files/ar/glossary/grid_areas/index.html +++ /dev/null @@ -1,78 +0,0 @@ ---- -title: Grid Areas -slug: Glossary/Grid_Areas -translation_of: Glossary/Grid_Areas ---- -

A grid area is one or more {{glossary("grid cell", "grid cells")}} that make up a rectangular area on the grid. Grid areas are created when you place an item using line-based placement or when defining areas using named grid areas.

- -

Image showing a highlighted grid area

- -

Grid areas must be rectangular in nature; it is not possible to create, for example, a T- or L-shaped grid area.

- -

In the example below I have a grid container with two grid items. I have named these with the {{cssxref("grid-area")}} property and then laid them out on the grid using {{cssxref("grid-template-areas")}}. This creates two grid areas, one covering four grid cells, the other two.

- -
- - -
.wrapper {
-  display: grid;
-  grid-template-columns: repeat(3,1fr);
-  grid-template-rows: 100px 100px;
-  grid-template-areas:
-    "a a b"
-    "a a b";
-}
-.item1 {
-  grid-area: a;
-}
-.item2 {
-  grid-area: b;
-}
-
- -
<div class="wrapper">
-   <div class="item1">Item</div>
-   <div class="item2">Item</div>
-</div>
-
- -

{{ EmbedLiveSample('example_1', '300', '280') }}

-
- -

Learn More

- -

Property reference

- -
    -
  • {{cssxref("grid-template-columns")}}
  • -
  • {{cssxref("grid-template-rows")}}
  • -
  • {{cssxref("grid-auto-rows")}}
  • -
  • {{cssxref("grid-auto-columns")}}
  • -
  • {{cssxref("grid-template-areas")}}
  • -
  • {{cssxref("grid-area")}}
  • -
- -

Further reading

- - diff --git a/files/ar/glossary/hyperlink/index.html b/files/ar/glossary/hyperlink/index.html deleted file mode 100644 index c2aff9a198..0000000000 --- a/files/ar/glossary/hyperlink/index.html +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: رابط -slug: Glossary/Hyperlink -tags: - - ل.ت.ن.ف - - لغة توصيف النص الفائق - - مسرد -translation_of: Glossary/Hyperlink ---- -

تَربُط الروابط (أو الوصلات) الصفحات العنكبوتيَّة أو عناصر البيانات مع بعضها البعض. يُستخدَم العنصر {{HTMLElement("a")}}، في {{glossary("HTML", "لغة توصيف النص الفائق")}}، لتعريف رابط من نقطة في الصفحة (كنص أو صورة) إلى نقطة في صفحة أخرى (أو حتى في نفس الصفحة).

- -

المزيد من التفاصيل

- -

معلومات عامة

- - - -

مراجعة تقنيّة

- - - -

تعلَّم المزيد عن الروابط

- - diff --git a/files/ar/glossary/identifier/index.html b/files/ar/glossary/identifier/index.html deleted file mode 100644 index da321dbda0..0000000000 --- a/files/ar/glossary/identifier/index.html +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: مُعرِّف -slug: Glossary/Identifier -tags: - - مسرد -translation_of: Glossary/Identifier ---- -

المُعرِّف (Identifier) هو مجموعة من {{glossary("character", "المحارف")}} تُعرِّف (تُعبِر عن، تُسمي) {{glossary("variable", "متغيّر")}}، {{glossary("function", "دالة")}}، أو {{glossary("property", "خاصيّة")}}.

- -

في لغة {{glossary("JavaScript", "الجافاسكربت")}}، يُمكِن أن تحتوي المُعرِّفات على أحرف أبجديّة فقط (أو "$" أو "_")، ولايمكن أن تبدأ برقم. يختلف المُعرِّف عن السلسلة النصيّة، بأنَّ الأخيرة عبارة نوع من البيانات، بينما المُعرِّف هو جزء من الشيفرة. لا توجد أيّة طريقة لتحويل المُعرِّفات إلى سلاسل نصيّة في الجافاسكربت، ولكن في بعض الأحيان من الممكن {{glossary("parse", "تحليل")}} السلاسل النصيّة إلى مُعرِّفات.

- -

المزيد من التفاصيل

- -

معلومات عامة

- - diff --git a/files/ar/glossary/index.html b/files/ar/glossary/index.html deleted file mode 100644 index 39ad063caf..0000000000 --- a/files/ar/glossary/index.html +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: المعجم -slug: Glossary -tags: - - صفحة هبوط - - مبتدئين - - مسرد -translation_of: Glossary ---- -
 
- -
{{LearnBox({"title":"تعلَّم مُصطلحاً جديداً:"})}}
- -

تحتوي تقنيات الويب على قائمة ضخمة من المصطلحات والاختصارات التي تستخدم في التوثيقات والبرمجة. يهدف المسرد (معجم المصطلحات) إلى توفير تعريفات للكلمات والاختصارات التي تحتاج معرفتها لبناء فهم صحيح للويب وتطويره.

- -

أضف مصطلحاً جديداً إلى المسرد

- -

{{GlossaryList({"split":"h3", "css":"multiColumnList"})}}

diff --git a/files/ar/glossary/mozilla_firefox/index.html b/files/ar/glossary/mozilla_firefox/index.html deleted file mode 100644 index 4d23e8e6ab..0000000000 --- a/files/ar/glossary/mozilla_firefox/index.html +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: موزيلا فايرفوكس -slug: Glossary/Mozilla_Firefox -tags: - - فايرفوكس - - مسرد - - موزيلا -translation_of: Glossary/Mozilla_Firefox ---- -

موزيلا فايرفوكس هو {{Glossary("browser","متصفح")}} حر ومفتوح المصدر، يطوَّر بإشراف مؤسسة موزيلا. يعمل فايرفوكس على أنظمة ويندوز، ماك، لينُكس، وأندوريد.

- -

أُصدِر فايرفوكس لأوَّل مرَّة في شهر تشرين الثاني عام 2004، فايرفوكس قابل للتخصيص كليّاً بواسطة السِمات (themes)، المُلحقات (plug-ins)، والإضافات (add-تons). يستخدم فايرفوكس مُحرِّك {{glossary("Gecko","جيكو")}} لعرض صفحات الويب، ولتطبيق معايير الويب الحاليّة والقادمة.

- -

المزيد من التفاصيل

- -

معلومات عامة

- - - -

مراجع تقنيّة

- - diff --git a/files/ar/glossary/object/index.html b/files/ar/glossary/object/index.html deleted file mode 100644 index fad54c1142..0000000000 --- a/files/ar/glossary/object/index.html +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: كائن -slug: Glossary/Object -tags: - - كائن - - مسرد -translation_of: Glossary/Object -original_slug: Glossary/الكائنات ---- -

الكائِن (بالإنجليزيَّة: Object) يشير إلى هيكل بيانات يحوي بيانات وتعليمات للتعامل مع البيانات. تُشير الكائِنات أحيانًا إلى أشياء حقيقيَّة، كالكائِن car أو map المُعرَّف في لعبة سباق. تُعد لغة {{glossary("JavaScript", "الجافاسكربت")}} والجافا والسي++ وبايثون وروبي من الأمثلة على لغات {{glossary("OOP","البرمجة الكائنيَّة")}}.

- -

المزيد من التفاصيل

- -

معلومات عامة

- -
    -
  • مقالة عن البرمجة الكائنيَّة في الموسوعة الحرَّة
  • -
- -

مراجع تقنيَّة

- - diff --git a/files/ar/glossary/oop/index.html b/files/ar/glossary/oop/index.html deleted file mode 100644 index 96cbc24aa9..0000000000 --- a/files/ar/glossary/oop/index.html +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: OOP -slug: Glossary/OOP -tags: - - شيفرة برمجية - - قاموس المصطلحات - - مبتدئ -translation_of: Glossary/OOP ---- -

OOP (البرمجة الكائنية التوجه) هو نهج في البرمجة حيث يتم تغليف البيانات داخل {{glossary("كائن","كائنات")}} ويتم تشغيل الكائن نفسه بدلاً من الأجزاء المكونة له.

- -

{{glossary("جافا سكريبت")}} كائنية التوجه بشكل كبير. تعتمد على النماذج الأولية' (بدلا من الأصناف).

- -

تعلم المزيد

- -

معرفة عامة

- - diff --git a/files/ar/glossary/parameter/index.html b/files/ar/glossary/parameter/index.html deleted file mode 100644 index 97eda429cf..0000000000 --- a/files/ar/glossary/parameter/index.html +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: وسيط -slug: Glossary/Parameter -tags: - - جافاسكربت - - مسرد -translation_of: Glossary/Parameter ---- -

الوسيط (بالإنجليزيَّة: Parameter) هو مُتغيِّر مُسمَّى يُمرَّر للدالة {{Glossary("function", "للدالة")}}. تُستخدم الوسيطات (أو الوسطاء) لإرسال المُعطيات إلى الدوال.

- -

الفرق بين الوسيطات و{{Glossary("argument","المعطيات")}}:

- -
    -
  • وسيطات الدالة هي أسماء تُدرَج عند تعريفها.
  • -
  • مُعطيات الدالة هي القيمة الفعليَّة المُمرَّرة إلى الدالة.
  • -
  • تُسنَد للوسيطات قيم المُعطيات المُمرَّرة.
  • -
- -

يوجد نوعين من الوسيطات:

- -
-
وسيطات الإدخال
-
وهي أكثر الأنواع شيوعًا. تُمرِّر هذه الوسيطات القيم إلى الدوال. اعتمادًا على لغة البرمجة المُستخدمة، تتعدّد طُرُق تمرير وسيطات الإدخال (كالاستدعاء عبر القيمة أو العنوان أو المرجع).
-
معاملات الإخراج أو الإعادة
-
مهمتها الأساسيّة إعادة عدّة قيم من الدالة، إلّا أنَّه لا يُحبَّذ فعل ذلك لِما يُسبِّب من مشكلات.
-
- -

المزيد من التفاصيل

- -

معلومات عامة

- - - -

مراجع تقنيّة

- - diff --git a/files/ar/glossary/php/index.html b/files/ar/glossary/php/index.html deleted file mode 100644 index 158a3223ae..0000000000 --- a/files/ar/glossary/php/index.html +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: PHP -slug: Glossary/PHP -tags: - - PHP - - المعجم -translation_of: Glossary/PHP ---- -

تعد لغة PHP بدائية متكررة (PHP: Hypertext Preprocessor) لغة برمجة نصية من جانب الخادم مفتوحة المصدر (open-source server-side scripting language) يمكن تضمينها في HTML لإنشاء تطبيقات الويب والمواقع الديناميكية.

- -

أمثلة

- -

بناء الجملة الأساسية

- -
  // start of PHP code
-<?php
-     // PHP code goes here
- ?>
-// end of PHP code
- -

طباعة البيانات على الشاشة

- -
<?php
-   echo "Hello World!";
-?>
- -

متغيرات PHP

- -
​​​​​​​​​​​​​​<?php
- // variables
- $nome='Danilo';
- $sobrenome='Santos';
- $pais='Brasil';
- $email='danilocarsan@gmailcom';
-​​​​​​​
- // printing the variables
- echo $nome;
- echo $sobrenome;
- echo $pais;
- echo $email;
-?>
- -

أعرف أكثر

- - diff --git a/files/ar/glossary/property/index.html b/files/ar/glossary/property/index.html deleted file mode 100644 index 7b4aa8c321..0000000000 --- a/files/ar/glossary/property/index.html +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: الخاصية -slug: Glossary/property -translation_of: Glossary/property -original_slug: Glossary/الخاصية ---- -

يمكن أن يكون لمصطلح الخاصية عدة معاني حسب السياق. قد يشير إلى:

- -
    -
  • خاصية (CSS)
  • -
- -

     الخاصية CSS هي خاصية مميزة (مثل اللون) تحدد القيمة المرتبطة بها جانبًا واحدًا من كيفية عرض المتصفح للعنصر.

- -
    -
  • خاصية (JavaScript)
  • -
- -

     تعد خاصية JavaScript إحدى خصائص الكائن ، وغالبًا ما تصف السمات المرتبطة ببنية البيانات.

- -

{{GlossaryDisambiguation}}

diff --git a/files/ar/glossary/recursion/index.html b/files/ar/glossary/recursion/index.html deleted file mode 100644 index 6c6e98a0ac..0000000000 --- a/files/ar/glossary/recursion/index.html +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: معاودة -slug: Glossary/Recursion -tags: - - مسرد -translation_of: Glossary/Recursion ---- -

المعاودة (أو الاستدعاء الذاتي) هي إجراء استدعاء الدالة لنفسها. تُستخدم المعاودة لحل مشاكل تحتوي مشاكل فرعيّة أصغر. يمكن أن تستقبل الدالة العوديّة نوعين من المدخلات: المدخلات الأساسيّة (عندما ينتهي التكرار - المعاودة -) ومدخلات عوديّة (عندما يكون التكرار سارياً).

- -

المزيد من التفاصيل

- -

معلومات عامة

- - diff --git a/files/ar/glossary/rendering_engine/index.html b/files/ar/glossary/rendering_engine/index.html deleted file mode 100644 index de82aa4114..0000000000 --- a/files/ar/glossary/rendering_engine/index.html +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: محرك العرض -slug: Glossary/Rendering_engine -tags: - - مسرد -translation_of: Glossary/Rendering_engine ---- -

مُحرِّك العرض هو البرمجيّة التي ترسم النصوص والصور على الشاشة. يرسم المُحرِّك النص المُنظَم من مستند (مثل مستند {{glossary("HTML", "لغة ترميز النص الفائق")}}) ويقوم بتنسيقه بناءً على التصميم المُعرَّف من قبل المطوَّر (باستخدام تقنيّة مثل {{glossary("CSS", "صفحات الأنماط الانسيابية")}}). أمثلة على محركات العرض: {{glossary("Blink", "بلينك")}}، و{{glossary("Gecko", "جيكو")}}، وإيدج (edge)، و{{glossary("WebKit", "ويب كيت")}}.

- -

المزيد من التفاصيل

- -

معلومات عامة

- - - -

مراجع تقنيّة

- - diff --git a/files/ar/glossary/scope/index.html b/files/ar/glossary/scope/index.html deleted file mode 100644 index 13d28ff8cc..0000000000 --- a/files/ar/glossary/scope/index.html +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: المجالات -slug: Glossary/Scope -translation_of: Glossary/Scope -original_slug: Glossary/المجالات ---- -

تعبر عن سياق التنفيذ الحالي للبرنامج والذي يمكنك فيه الوصول لقيم المتغيرات والتوابع واستعمالها. فإذا تم البحث عن متغير او تابع خارج المجال (أو سياق التنفيذ) الحالي وتبين أنّه  غير موجود فلن تستطيع الوصول إليه واستعماله. وتتشكل هذه المجالات بشكل هرمي (أو دائري بشرط لايوجد دائرتين متقاطعتين وكل الدوائر محتواة في بعضها البعض) بحيث ان المجال الداخلي (أو الدائرة الداخلية) الابن يستطيع الوصول لمجال الأب (الدائرة التي تحتويه) ولكن العكس غير ممكن.

- -

nested scopes intro in javascript

- -

التوابع  ({{glossary("function")}}) في {{glossary("JavaScript")}} تستعمل لإنشاء مجالات جديدة (كل تابع يمثل مجال جديد خاص به) فعلى سبيل المثال,إن تعريف متغير داخل التابع لن يمكنك من استعماله داخل تابع آخر او من اي مجال خارج هذا التابع, وهذا مثال يوضح لك الفكرة:

- -
function exampleFunction() {
-
-    // هذا المتغير لا يمكن استعماله إلا ضمن التابع الحالي فقط
-    // او أي تابع محتوى داخله
-    var x = "متغير داخل التابع";
-    console.log("داخل التابع");
-    console.log(x);
-}
-
-console.log(x);  // لا يمكن الوصول للمتغير من الخارج
- -

بينما يستطيع التابع الوصول للمتغيرات المعرفة في مجال يقع خارجه او في المجال العام للبرنامج الخاص بك

- -
var x = "انا متغير مُعرف خارج التابع";
-
-exampleFunction();
-
-function exampleFunction() {
-    console.log("انا داخل التابع");
-    console.log(x); // يمكن لمجال داخلي ابن ان يصل لمتغيرات مجال خارجي أب
-}
-
-console.log("انا خارج التابع في المجال العام");
-console.log(x);
- -

Learn more

- -

General knowledge

- -
    -
  • {{Interwiki("wikipedia", "Scope (computer science)")}} في ويكبيديا
  • -
diff --git a/files/ar/glossary/search_engine/index.html b/files/ar/glossary/search_engine/index.html deleted file mode 100644 index a914aefd11..0000000000 --- a/files/ar/glossary/search_engine/index.html +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: باحوث -slug: Glossary/Search_engine -tags: - - باحوث - - مسرد -translation_of: Glossary/Search_engine ---- -

الباحوث (اسم الآلة من الفعل بحثَ على زِنة فاعول، أو مُحرِّك البحث) هو منظومة برمجيّة تجمع البيانات من {{Glossary("World Wide Web", "الشبكة العنكبوتيَّة")}} وتعرضها للمستخدمين الباحثين عن معلومات معينة.

- -

يُجري الباحوث العمليات التالية لتأدية عمله:

- -
    -
  • تمشيط الشبكة (crawling): البحث في المواقع عبر تصفُّح {{Glossary("Hyperlinks", "الروابط")}} في داخل الصفحات العنكبوتيَّة وبينها. بإمكان مالك الموقع مَنع المُمشِّطات العنكبوتيَّة (أو العناكِب) من دخول بعض المناطِق في موقعه، وذلك عبر التعليمة "robot exclusion" في الملف robots.txt.
  • -
  • الفهرسة: ربط كلمات مفتاحيَّو ومعلومات أخرى بالصفحات التي مُشِّطَت. هذا يُمكِّن المُستخدمين من إيجاد صفحات مُتعلقة بأقصى سرعة ممكنة.
  • -
  • البحث: إيجاد الصفحات المتعلقة اعتمادًا على الاستعلامات المؤلفة من الكلمات المفتاحيّة وغيرها من الأوامر المُدخلة إلى الباحوث. يعثر الباحوث عن روابط الصفحات المطابقة للاستعلام، ويرتبها حسب مدى ملاءمتها، ومن ثم يعرض النتائج للمستخدم مُرتَّبةً.
  • -
- -

يعد جوجل أكثر البواحيث شعبيّةً. توجد كذلك بواحيث أخرى مشهورة، كياهو وبينج.

- -

المزيد من التفاصيل

- -

معلومات عامة

- - diff --git a/files/ar/glossary/semantics/index.html b/files/ar/glossary/semantics/index.html deleted file mode 100644 index 699c9192c9..0000000000 --- a/files/ar/glossary/semantics/index.html +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: دلالات semantics -slug: Glossary/Semantics -tags: - - لغة ترميز النص الفائق - - مسرد -translation_of: Glossary/Semantics ---- -

في البرمجة فأن كلمة semantics تشير الى معنى قطعه من الكود code. اليوم نتحدث عن معنى العناصر وليس مظهرها. هذا الموضوع الشيق يأخذنا الى ابعد من ذلك من خلال تركيز على معنى كتابة الكود code. وطرح تسائل مهم هو "ماهو تأثير هذا السطر عندما نقوم بتنفيذ الايعاز؟" وربما يأخذنا الى ابعد من ذلك بقليل "ماهو الغرض او الدور الذي يلعبة هذا العنصر في الـ html ؟".

- -

دعنا نأخذ العنصر {{htmlelement("h1")}} كمثال تطبيقي، فهو عنصر دلالي semantics يقوم بإعطاء النص الذي يحيطه القدرة على أن يؤدي دور (أو وظيفة) "مستوى العنونة الأوّل في صفحتك" (أي أوَّل عنوان رئيسي في الصفحة).

- -
<h1>هذا مستوى العنونة الأوّل</h1>
- -

يُنسَّق العنصر السابق، إفتراضياً، بحجم خط كبير لجعله عنواناً (بالرغم من أنَّه يمكنك إعادة تصميمه وتنسيقه لتغيير شكله جذرياً)، ولكن الأكثر أهميّة من شكله هو القيمة الدلاليّة (semantic) التي يحملها هذا العنصر ويمكن استخدامها في طرق متعددة، كاستخدامها من قبل محركات البحث عبر اعتبار هذا الجزء من المحتوى (العنوان) كلمة مفتاحيّة مهمة ستُؤثِر على ترتيب الموقع في نتائج البحث (طالع مصطلح {{Glossary("SEO", "تحسين محركات البحث")}})، أو كاستخدام قيمة العنوان الدلاليّة من قبل قارئِات الشاشة كإشارة (أو ما يسمى بعلامة الإرشاد) لمساعدة المستخدمين المتضررين بصرياً على التنقل بين محتويات الصفحة.

- -

على الرغم من كل ما سبق، يمكنك جعل أي عنصر يبدو كعنوان ذو درجة عنونة أولى. دعنا نأخذ المثال أدناه على سبيل المثال:

- -
<span style="font-size: 32px; margin: 21px 0;">هل هذا مستوى العنونة الأوّل؟</span>
- -

سيُعرَض هذا العنصر في المتصفح كعنوان من الدرجة الأولى، ولكنه لن يحمل أي قيمة دلاليّة، وبالتالي لن تستفيد من الفوائد الإضافيّة التي تضفيها هذه القيمة كما شُرِحَ أعلاه. وبالتالي، من الأفضل استخدام عنصر ل.ت.ن.ف الصحيح في المكان الصحيح لإنجاز المهمة المخصص لها.

- -

- -

الـ semantics  و الجافا سكربت javaScript

- -

لنفهم الـ semantics في الجافا سكربت javaScript علينا ان نأخذ مثال يقوم بانشاء عنصر ولنقل مثلا عنصر <li>. الدالة function التي تقوم بهذا الامر تقوم بأرجاع هذا العنصر ونحن نقوم فقط بارسال محتوى العنصر textContent. حسناً اذا اسمينا الدالة باسم build وقمنا باستخدامها : 

- -
build('Peach');
-
- -

بالتأكيد لم تسطيع فهم عمل هذه الدالة الى في حالة رؤية الكود الداخلي الخاص بها. او البعض يحل المشكلة باستخدام التعليقات comments . وهذا حل ليس مثاليا. 

- -

الحال المثالي ان تجعل اسم الدالة يدعى على عملها. بهذا حققت غالية الـ semantics ولا تحتاج الى سطر اضافي لتعليقات comments: 

- -
createLiWithContent('Peach')
-
- -

برأيك من هو الاحلى والافضل الدالة build او createLiWithContent ؟!!! 

- -

عناصر دلاليّة

- -

يوجد أدناه بعض من عناصر ل.ت.ن.ف الدلاليّة (مأخوذة من هنا):

- -
    -
  • {{htmlelement("article")}}
  • -
  • {{htmlelement("aside")}}
  • -
  • {{htmlelement("details")}}
  • -
  • {{htmlelement("figcaption")}}
  • -
  • {{htmlelement("figure")}}
  • -
  • {{htmlelement("footer")}}
  • -
  • {{htmlelement("header")}}
  • -
  • {{htmlelement("main")}}
  • -
  • {{htmlelement("mark")}}
  • -
  • {{htmlelement("nav")}}
  • -
  • {{htmlelement("section")}}
  • -
  • {{htmlelement("summary")}}
  • -
  • {{htmlelement("time")}}
  • -
- -

المزيد من التفاصيل

- -

معلومات عامة

- - - -

مراجع تقنيّة

- - diff --git a/files/ar/glossary/server/index.html b/files/ar/glossary/server/index.html deleted file mode 100644 index 9e99905209..0000000000 --- a/files/ar/glossary/server/index.html +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: خادم -slug: Glossary/Server -tags: - - خادم - - خادوم - - شبكات - - مسرد -translation_of: Glossary/Server ---- -

الخادِم (ويُقال عن الجهاز خادوم) هو برمجيّة تُقدِّم خدمة للمستخدم، أو ما يُسمى بالزبون. الخادوم هو حاسوب مُشترَك على الشبكة، يُشغَّل ويُستضاف غالبًا في مراكز البيانات. الخادم هو برنامج يُقدِم الخدمات لبرامج الزئائِن أو {{glossary("UI","واجهة مُستخدم")}} للزبائِن من البشر.

- -

تُقدَم هذه الخدمات عامةً عبر الشبكات المحليّة أو الشبكات واسعة النطاق مثل الشابكة العالميَّة. يتواصل برنامج الزبون والخادم عبر إرسال رسائل مُرمَّزِة بواسطة {{glossary("protocol", "ميثاق")}} من خلال {{glossary("API", "واجهة برمجيّة")}}.

- -

أمثلة على الخوادم والخواديم:

- -
    -
  • تُرسِل الخوادم العنكبوتيَّة ملفات {{glossary("HTML", "لغة توصيف النص الفائق")}} إلى {{glossary("browser", "مُتصفِحَك")}} حتّى تتمكن من قراءتها.
  • -
  • خوادم الشبكة المحليّة للملفات والبريد والطباعة والناسوخ.
  • -
  • الحواسيب الصغيرة والكبيرة والفائقة في مراكز البيانات.
  • -
- -

المزيد من التفاصيل

- -

معلومات عامة

- - diff --git a/files/ar/glossary/string/index.html b/files/ar/glossary/string/index.html deleted file mode 100644 index e14d0150fe..0000000000 --- a/files/ar/glossary/string/index.html +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: سلسلة نصيّة -slug: Glossary/String -tags: - - مبتدئين - - مسرد -translation_of: Glossary/String ---- -

في أيّة لغة برمجة، السلسلة النصيّة (string) هي عبارة عن مجموعة من {{Glossary("character","المحارف")}} تُستخَدم لتمثيل نص ما.

- -

في لغة الجافاسكربت، السلسلة النصيّة هي إحدى {{Glossary("Primitive", "القيم البدائيّة")}} والكائن {{jsxref("String")}} هو {{Glossary("wrapper", "غلاف")}} لهذا النوع البدائي.

- -

المزيد من التفاصيل

- -

معلومات عامة

- - diff --git a/files/ar/glossary/tag/index.html b/files/ar/glossary/tag/index.html deleted file mode 100644 index 65f3e0fc21..0000000000 --- a/files/ar/glossary/tag/index.html +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: وسم -slug: Glossary/Tag -tags: - - لغة ترميز النص الفائق - - مسرد -translation_of: Glossary/Tag ---- -

في سياق {{Glossary("HTML", "لغة ترميز النص الفائق")}}، يُستخدَم الوسم لإنشاء {{Glossary("element", "العنصر")}}. اسم العنصر هو الاسم الذي يُستخدم بين قوسين معقوفين، كمثال، الوسم `<p>` الذي يُستخدم لإنشاء الفقرات. لاحظ أنَّ الاسم في وسم الإغلاق مسبوق بمائلة (`<p/>`). لا يجب وضع وسم إغلاق في الوسوم المفردة (ذاتية الإغلاق - التي تتكون من وسم واحد). إذا كانت {{Glossary("Attribute", "خاصيات")}} الوسم غير مذكورة عند تعريفه، ستستخدم القيمة الإفتراضية لكل خاصية.

- -

المزيد من التفاصيل

- -

معلومات عامة

- - - -

مراجع تقنيّة

- - diff --git a/files/ar/glossary/variable/index.html b/files/ar/glossary/variable/index.html deleted file mode 100644 index bece718d50..0000000000 --- a/files/ar/glossary/variable/index.html +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: متغيّر -slug: Glossary/Variable -tags: - - جافاسكربت - - مسرد -translation_of: Glossary/Variable ---- -

المتغيّر هو مكان في الذاكرة لتخزين {{Glossary("Value", "القيم")}} (البيانات). باستخدام هذه التقنيّة يُمكِن الوصول لقيمة مُتقلِّبة (متغيّرة) من خلال اسم مذكور سلفاً.

- -

المزيد من التفاصيل

- -

معلومات عامة

- - - -

مراجع تقنيّة

- - diff --git a/files/ar/glossary/wai/index.html b/files/ar/glossary/wai/index.html deleted file mode 100644 index 5d0e1bf329..0000000000 --- a/files/ar/glossary/wai/index.html +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: مبادرة الإتاحة الويبية -slug: Glossary/WAI -tags: - - إتاحة - - مسرد -translation_of: Glossary/WAI ---- -

مبادرة الإتاحة الويبيّة (أو WAI كاختصار) هي مبادرة تقودها رابطة الويب العالمية لتحسين الإتاحة (accessibility) للأشخاص ذوي الحالات الخاصة المتنوعة، والذين قد يحتاجون إلى {{Glossary("browser", "متصفحات")}} أو أجهزة مخصصة (غير قياسية).

- -

المزيد من التفاصيل

- -

معلومات عامة

- - diff --git a/files/ar/glossary/wrapper/index.html b/files/ar/glossary/wrapper/index.html deleted file mode 100644 index ebfecad2ff..0000000000 --- a/files/ar/glossary/wrapper/index.html +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: غلاف -slug: Glossary/Wrapper -tags: - - غلاف - - مسرد -translation_of: Glossary/Wrapper ---- -

في لغات البرمجة المشابهة للجافاسكربت، الغلاف (wrapper) هو دالة تهدف إلى استدعاء دالة أو أكثر أخرى، أحياناً لتسهيل عملها (أي راحة أكثر بالتعامل)، وأحياناً لتعديلها لكي تجري مهمة مختلفة قليلاً أثناء عملها.

- -

بمعنى آخر، يُستخدَم الغلاف لاستدعاء دالة من أجل تعديل شيء فيها، سواءً كان هذا الشيء متعلقاً بسهولة استخدامها، أو بوظيفتها.

- -

المزيد من التفاصيل

- -

معلومات عامة

- -

مقالة عن الدوال المُغلِّفة في الموسوعة الحرَّة (باللغة الإنجليزيّة، يرجى النظر بالمساهمة)

diff --git a/files/ar/learn/accessibility/index.html b/files/ar/learn/accessibility/index.html deleted file mode 100644 index 3a4577ebb0..0000000000 --- a/files/ar/learn/accessibility/index.html +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: الإتاحة -slug: Learn/Accessibility -tags: - - الإتاحة - - تعليم - - صفحة هبوط - - مبتدئين -translation_of: Learn/Accessibility ---- -
{{LearnSidebar}}
- -

من المفيد تعلم لغة ترميز النص الفائق، صفحات الأنماط الانسيابية، والجافاسكربت إن كنت تريد أن تصبح مطوراً، ولكن معرفتك يجب أن تكون أبعد من استخدام تلك التقنيات وحسب، فعليك استخدامها أيضاً بمسؤوليّة؛ حتّى تتمكن من زيادة مستخدمين موقعك و عدم حرمان أياً على استخدامه. عليك التقيّد بالممارسات الفُضلى (المشروحة في دورات لغة ترميز النص الفائق، صفحات الأنماط الانسيابية، والجافاسكربت)، القيام باختبار الموقع على عدة متصفحات، ووضع الإتاحة بعين الاعتبار منذ بداية تطوير الموقع. سنغطي في هذه المقالة موضوع الإتاحة بالتفصيل.

- -

المتطلبات

- -

لتحقيق أقصى استفادة من هذه الوحدة، يجب عليك، إما دراسة الوحدتين الأولى - على الأقل - من لغة ترميز النص الفائق، صفحات الأنماط الانسيابية، والجافاسكربت، أو، وهذا أفضل، دراسة أجزاء الإتاحة المُتعلقة بالتقنيّة التي تدرسها.

- -
-

ملاحظة: إن كنت تعمل على حاسوب/جهاز لوحي/شيء آخر، ولا تملك القدرة على إنشاء ملفات، يمكنك تجربة (معظم) الأمثلة هنا باستخدام محرر شيفرات برمجيّة على الأنترنت مثل JSBin أو Thimble.

-
- -

دروس إرشاديّة

- -
-
ما هي الإتاحة؟
-
تُمثِل هذه المقالة بداية للوحدة، بحيث تعطيك لمحة عن ماهيّة الإتاحة، فهي تتضمن معلومات عن مجموعة الأشخاص الذين يشملهم هذا المصطلح ولماذا، الأدوات المُختلفة التي تُستخدَم للتعامل مع الويب، وكيف يمكننا جعل الإتاحة جزءً لا يتجزأ من عمليّة تطوير الويب.
-
أساسيات مهمة في لغة ترميز النص الفائق للعمل مع الإتاحة
-
يمكن جعل جزء كبير من محتوى الويب مُتاحاً؛ عبر التأكُّد من استخدام عناصر لغة ترميز النص الفائق الصحيحة في أماكنها الصحيحة وبالوقت المناسب. هذه المقالة تتعمق بالتفصيل في كيفيّة استخدام هذه اللغة لضمان الاستفادة بالحد الأقصى من الإتاحة.
-
أفضل الطرق لاستخدام صفحات الأنماط الانسيابية والجافاسكربت لإتاحة أفضل
-
يُمكِّن أيضاً الاستخدام الصحيح لهاتين اللغتين توفير تجربة ويب أفضل، أو يمكن أن يجعلها أسوء إذا أُسيءَ استخدام هاتِه اللغات. تُعَنوِن هذه المقالة بعض استخدامات صفحات الأنماط الانسيابية والجافاسكربت الفضلى التي يجب اخذها بعين الاعتبار لضمان جعل المحتوى المُعقَد مُتاحاً قدر الإمكان.
-
أساسيات تقنيّة WAI-ARIA
-
إكمالاً للمقالة السابقة، من الصعب في بعض الأحيان إنشاء عناصر تحكم رسوميّة تستخدم عناصر من لغة ترميز النص الفائق غير دلاليّة (أي وظيفتها غير واضحة من اسمها، مما يجعل تذكر العنصر وفهمه أصعب - unsemantic) ومحتوى جافاسكربت مُحدَث تلقائياً. يمكن لهذه التقنيّة المساعدة في حل هذه المشكلات عبر إضافة المزيد من العناصر الدلاليّة (semantic) التي يُمكِن للمتصفحات التعرُّف عليها واستخدامها لجعل المستخدمين يفهمون الأمور بشكل أوضح. سنشرح في هذه المقالة كيفيّة استخدام هذه التقنيّة لتحسين التجربة الإتاحيّة.
-
الوسائط المُتاحة
-
هناك فئة أخرى من المحتوى تُحدِث مشاكل إتاحيّة وهي الوسائط المتعددة (multimedia) - محتوى الفيديو، الصوت، والصورة يجب أن يُعطى نصاً بديلاً يشرحه؛ كي تتمكن التقنيات المعاونة (المساعدة - assistive) ومستخدميها من فهم المحتوى. تشرح هذه المقالة كيفيّة القيام بذلك.
-
الإتاحة الخلويّة (Mobile Accessibility)
-
نظراً لشيوع الوصول إلى محتوى الويب عبر الهواتف، ولامتلاك منصات الهواتف الشهيرة، مثل iOS والأندرويد، على أدوات لهذا الغرض، أصبح من المهم الاهتمام بإتاحة محتواك على هذه المنصات. تتعمق هذه المقالة في الاعتبارات التي يجب أن تؤخذ عند إتاحة محتوى الويب للهواتف.
-
- -

اختبارات

- -
-
معالجة الأخطاء الإتاحيّة
-
في هذا الإختبار من الوحدة، قدمنا لك موقع بسيطة يحتوي على عدد من الأخطاء الإتاحيّة التي عليك استكشافها وإصلاحها.
-
- -

انظر أيضاً

- - diff --git a/files/ar/learn/accessibility/what_is_accessibility/index.html b/files/ar/learn/accessibility/what_is_accessibility/index.html deleted file mode 100644 index 338c3dd9e8..0000000000 --- a/files/ar/learn/accessibility/what_is_accessibility/index.html +++ /dev/null @@ -1,206 +0,0 @@ ---- -title: ما هي الإتاحة؟ -slug: Learn/Accessibility/What_is_accessibility -tags: - - أدوات - - إتاحة - - مبتدئين - - مستخدمين -translation_of: Learn/Accessibility/What_is_accessibility ---- -
{{LearnSidebar}}
- -
{{NextMenu("Learn/Accessibility/HTML", "Learn/Accessibility")}}
- -

تُمثِل هذه المقالة بداية للوحدة، بحيث تعطيك لمحة عن ماهيّة الإتاحة (accessibility)، فهي تتضمن معلومات عن مجموعة الأشخاص الذين يشملهم هذا المصطلح ولماذا، الأدوات المُختلفة التي تُستخدَم للتعامل مع الويب، وكيف يمكننا جعل الإتاحة جزءً لا يتجزأ من عمليّة تطوير الويب.

- - - - - - - - - - - - -
المتطلبات: -

معرفة بسيطة بالحاسوب، وفهم بسيط للغة ترميز النص الفائق وصفحات الأنماط الانسيابية.

-
الهدف: -

حصول القارئ على معرفة حول الإتاحة، ما هي، وكيف تؤثر عليك كمطور مواقع.

-
- -

ما هي الإتاحة؟

- -

هي عمليّة جعل المواقع قابلة للاستخدام لأكبر قدر ممكن من الأشخاص. يُعتقَد عادةً أنَّها تتعلق بالأشخاص ذوي الإعاقات وحسب، ولكنها بالحقيقة تشمل أيضاً جماعة الأشخاص الذين يستخدمون الهواتف، أو الذين يملكون صبيب ضعيف من الإنترنت.

- -

يمكنك أيضاً النظر للإتاحة على أنَّها معاملة الجميع بالمثل، وإعطائِهم الفُرص ذاتها، بغض النظر عن قدراتهم أو ظروفهم. بنفس الطريقة التي لا يجوز فيها إخراج شخص ما من مبنى لأنَّه مُقعَد (تحتوي معظم المباني عامةً على منحدرات للمقاعد المتحركة ومصاعد هذه الأيام)، لا يجوز أيضاً منع أحدهم من استخدام الموقع لأنَّه مُعاق بصرياً أو يستخدم هاتف محمول. كلنا مُختلفون، ولكن جميعنا بشر، وبالتالي لدينا نفس الحقوق (الإنسانيّة).

- -

الإتاحة عمل صحيح، ولكنها أيضاً جزء من القانون في بعض البلدان، ويمكنها أنْ تفتح بعض الأسواق المهمة التي بدونها لا يُمكِن استخدام خدماتك، أو شراء منتجاتك ...إلخ.

- -

تفيد الإتاحة وممارساتها الصحيحة الجميع:

- -
    -
  • تُحسِن لغة ترميز النص الفائق (HTML) الدلاليّة (التي تستخدم عناصر اسمائها تدُل على وظيفتها - semantic) فهرسة الموقع في محركات البحث (SEO)، فتجعله أكثر رواجاً سوقياً.
  • -
  • يظهِر الاهتمام بالإتاحة صورة حسنة وأخلاقيّة؛ مما يُحسِن صورتك بين الناس.
  • -
  • تجعل أيضاً الممارسات الجيدة الأخرى، التي تُحسِن الإتاحة، موقعك أكثر استخداميّة عند مجموعات أخرى من المُستخدمين، مثل مُستخدمين الهواتف المحمولة، المُستخدمين ممن لديهم صبيب إنترنت ضعيف ...إلخ. يمكن للجميع حقيقةً الاستفادة من تحسينات كهذه.
  • -
  • هل ذكرنا أيضاً أنَّ ذلك قانون في بعض الأماكن؟
  • -
- -

ما هي أنواع الإعاقات التي نتكلم عنها؟

- -

الأشخاص ذوي الإعاقات متنوعون تماماً كالأشخاص السليمين، كما إعاقاتهم متنوعة أيضاً. الدرس الرئيسي هنا هو التفكير بعيداً عن الحاسوب وكيفيّة استخدامك للويب، والبدأ في التعلم كيف يستخدمه الآخرون - أنت لست كمُستخدمي خدماتِك. تُشرَح أدناه الإعاقات الرئيسيّة التي يجب الاهتمام بها، بالإضافة إلى الأدوات التي يستخدمها من لديهم تلك الإعاقات للوصول إلى محتوى الويب (المعروفة بالتقنيات المعاونة (assistive technologies) أو ATs كاختصار).

- -
-

ملاحظة: تشير منظمة الصحة العالميّة في مقالة العجز والصحة إلى "معاناة أكثر من مليار شخص، أي نحو 15% من سكان العالم، من شكل ما من أشكال العجز."، و "معاناة ما بين 110 مليون و190 مليون بالغ من صعوبات جسميّة في أداء الوظائف".

-
- -

الإعاقات البصريّة

- -

يشمل هذا المصطلح العميان، من لديهم ضعف نظر، أو من لديهم عمى ألوان ...إلخ. العديد من الأشخاص في هذه الفئة يستخدمون مُكبرات الشاشة (إما المُكبرات المادية، أو خواص التكبير في البرمجيات. لدى معظم المتصفحات وأنظمة التشغيل هذه الأيام القدرة على التكبير)، وبعضهم يستخدم قارِئات الشاشة، وهي برمجيات تقرأ النصوص الرقميّة:

- -
    -
  • البعض منها احتكاريّة مدفوعة، مثلJAWS (لنظام ويندوز) و Window Eyes (لنظام ويندوز).
  • -
  • البعض الآخر منها مجانيّة، مثلNVDA (لنظام ويندوز)،ChromeVox (لنظام كروم، ويندوز، وماك)، وOrca (لنظام لينُكس).
  • -
  • البعض الآخر مبني إفتراضياً في أنظمة التشغيل، مثلVoiceOver (نظام ماك و iOS)،Narrator (لنظام ويندوز)،ChromeVox (لنظام كروم)، TalkBack (لنظام الأندرويد).
  • -
- -

إنَّها لفكرة سديدة أن تتعرف على استخدام بعض القارِئات، بحيث ينبغي عليك تثبيت إحداها والتعامل معها قليلاً؛ لتأخذ فكرة عن آلية عملها. انظر لدليل اختبار العدة متصفحات لقارئِات الشاشة (cross browser testing screen readers guide) للمزيد من التفاصيل عن استخدامها، يوفر الفيديو أدناه مثال موجز لماهيّة التجربة.

- -

{{EmbedYouTube("IK97XMibEws")}}

- -

من حيث الجانب الإحصائي، تُقدِر المنظمة العالميّة للصحة أنَّ "هناك نحو 285 مليون نسمة ممن يعانون من ضعف البصر في جميع أنحاء العالم منهم 39 مليون نسمة كُفّت أبصارهم و246 مليون نسمة ضعفت رؤيتهم." (انظر إلى تقرير ضعف البصر والعمى). هذا القدر الكبير من المستخدمين - والذي يساوي عدد سكان الولايات المُتخدة الأمريكيّة تقريباً - لن يستطيع استخدام موقعك لأنَّه غير مُبرمَج بشكل صحيح وحسب.

- -

الإعاقات السمعيّة

- -

تُعرَف أيضاً بالإعاقات الصوتيّة (auditory)، أو الصمم. هؤلاء المجموعة من الأشخاص إما يملكون قدرة سمعيّة ضعيفة، أو هم صُمّ بالكامل. يستخدم المعاقين سمعياً التقنيات المعاونة (انظر إلى الأجهزة المعاونة للأشخاص ذوي الاضطرابات السمعيّة، الصوتيّة، النطقيّة، أو اللغويّة)، ولكن لا يوجد تقنيات معاونة مخصصة للعمل مع الحاسب أو الويب.

- -

ومع ذلك، هناك عدة تكتيكات يجب وضعها في عين الاعتبار لتوفير بدائل نصيّة للمحتوى الصوتي حتّى يتمكنون من قراءته، كالنصوص النصيّة البسيطة (simple text transcripts) والتعليقات النصيّة على الفيديوهات. سنناقش ذلك في مقالة لاحقاً.

- -

يمثل أيضاً المعاقين سمعياً نسبة كبيرة من المُستخدمين، حيث يشير تقرير الصمم وضعف السمع من منظمة الصحة العالميّة إلى أنَّ "يعاني 360 مليون شخص على الصعيد العالمي من فقدان السمع المسبب للعجز، و32 مليون شخص منهم هم من الأطفال".

- -

الإعاقات الحركيّة

- -

يملك هؤلاء الأشخاص إعاقات تتعلق بالحركة، والتي قد تتضمن مشاكل جسديّة بحتة (كفقدان طرف أو الشلل)،  أو اضطرابات عصبيّة أو وراثيّة تؤدي إلى ضعف أو عدم القدرة على التحكم بالأطراف. بعض الأشخاص قد تكون لديهم صعوبة في دقة حركات اليد للتعامل مع الفأرة، وقد تكون حالة الآخرين أخطر، فالربما يكونون مشلولين إلى حد كبير مما يجعلهم محتاجين لمؤشر رأسي ليتعاملوا مع الحواسيب.

- -

يُمكِن أنْ يكون هذا النوع من الإعاقات أيضاً كنتيجة لِكِبَر السن، بدلاً من كونه نتيجة لصدمة أو حالة معينة، ويمكن أن يكون نتيجة لنقص في العتاد، فبعض المستخدمين قد لا يملكون فأرة (mouse).

- -

الطريقة الفعالة للتعامل مع هذا هي جعل عناصر الصفحة قابلة للوصول بواسطة لوحة المفاتيح، سنناقش ذلك في مقالة لاحقة في الوحدة، ولكن من الجيد أن تقوم حالياً بتجربة استخدام بعض المواقع بلوحة المفاتيح لترى كيف يحدث الأمر. هل يمكنك - على سبيل المثال - استخدام زر الجدولة (tab) للتنقل بين عناصر الاستمارة (form)؟ يمكنك إيجاد المزيد من التفاصيل حول التحكم بلوحة المفاتيح في قسم الإتاحة باستخدام لوحة المفاتيح في اختبار العدة متصفحات (Cross browser testing Using native keyboard accessibility).

- -

من حيث الجانب الإحصائي، يعاني عدد كبير من الناس من الإعاقات الحركيّة. يشير تقرير العجز والوظائف الحركيّة (Disability and Functioning) لمراكز الولايات المتحدة لمكافحة الأمراض والوقاية أنَّ "نسبة البالغين الذين يعانون من مختلف الصعوبات الحركيّة تبلغ 15.1%" في الولايات المُتحدة الأمريكيّة".

- -

الإعاقات المعرفيّة

- -

لربما تتواجد أوسع مجموعة من الإعاقات في هذه الفئة؛ فيمكن أن تشير الإعاقة المعرفيّة إلى الأمراض العقليّة، الصعوبات في التعلم، الصعوبات في الفهم والتركيز، مثل اضطراب نقص الانتباه وفرط النشاط (ADHD)، الأشخاص الذين يعانون من التوحد، الأشخاص المصابين بانفصام الشخصيّة، والعديد من أنواع الاضطرابات الأخرى. يمكن أن تؤثر هذه الإعاقات على أجزاء كثيرة من الحياة اليوميّة، بسبب المشاكل في الذاكرة، حل المشكلات، الاستيعاب، والانتباه ...إلخ.

- -

أكثر الطرق شيوعًا التي قد تؤثر فيها هذه الإعاقات على استخدام موقع الويب هي صعوبة في فهم كيفيّة إكمال مهمة ما، أو تذكر كيفيّة القيام بشيء تم إنجازه، أو زيادة الإحباط عند العمل المُربِك أو الأمور الغير متناسقة، مثل التنسيقات، التنقل، وميزات الصفحة الأخرى.

- -

على نقيض المشاكل الإتاحيّة الأخرى، من المستحيل تحديد إصلاحات سريعة للمشاكل الإتاحيّة الناتجة عن الإعاقات المعرفيّة، فرصتك الوحيدة هي تصميم موقعك ليكون منطقياً، متناسقاً، مراعياً للاستخداميّة قدر الإمكان. كمثال، احرص على:

- -
    -
  • جعل الصفحات متناسقة. أن يكون الشريط العلوي، الرأس، الذيل، والمحتوى الرئيسي دائماً في المكان الصحيح.
  • -
  • أن تكون الأدوات مُصممة بشكل جيدة وسهلة الاستخدام.
  • -
  • تقسيم العمليات متعددة المراحل إلى خطوات منطقيّة تتضمن على تذكيرات دوريّة حول المراحل التي قطعتها في تنفيذها، وكم من المتبقي لتنهيها، إذا كان ذلك ممكناً.
  • -
  • أن تكون طريقة سير العمليات منطقية، بسيطة، وتتطلب أقل قدر ممكن من الخطوات لإنجازها. على سبيل المثال، غالباً ما تكون عمليات التسجيل (registering) وتسجيل الدخول (signing in) في المواقع معقد بشكل غير ضروري.
  • -
  • أن تكون الصفحة الواحدة غير طويلة وكثيفة المعلومات.
  • -
  • أن تكون اللغة المُستخدمة في صفحاتك واضحة قدر الإمكان، وغير ممتلئة بالكلمات العاميّة أو المصطلحات الغير ضروريّة.
  • -
  • أن تكون النقاط المُهمة مُعلَّم بطريقة ما.
  • -
  • أن تكون أخطاء المُستخدمين واضحة، وتتضمن رسائل تحوي إقتراحات لحل المشكلة.
  • -
- -

هذه ليست "تكتيكات إتاحيّة" بقدر ما هي ممارسات جيدة في عمليّة التصميم. ستفيد الجميع باستخدامك لهذه التقنيات في مواقعك، كما يجب أن تكون دوماً جزءً معيارياً من عملك.

- -

من الجانب الإحصائي، العدد كبير مجدداً. وضَّحت جامعة كورنيل في تقريرها عن حالات الإعاقة لعام 2014 أنَّ "4.5% من الناس الذين تترواح أعمارهم بين 21-64 سنة يعانون من شكل من أشكال الإعاقة المعرفيّة".

- -
-

ملاحظة: توفر صفحة WebAIM للإعاقات المعرفيّة توضيح موسَع لهذه الأفكار، وهي بالتأكيد تستحق القراءة.

-
- -

تضمين الإتاحة في مشروعك

- -

هناك خرافة عن الإتاحة تقول أنَّها مزيّة زائدة وتعتبر "كنوع من الرفاهيّة" لتضيفها لمشروعك. حقيقةً، يُمكِن أن تكون هذه الخرافة صحيحة (بعض الصحة) إذا كنت:

- -
    -
  • تحاول تضمين الإتاحة في موقع فيه عدد ضخم من المشاكل الإتاحيّة.
  • -
  • بدأت التفكير بالإتاحة والمشاكل المُتعلقة بها الموجودة في المشروع في مرحلة متأخرة.
  • -
- -

بالرغم من ذلك، إن كنت واضعاً الإتاحة في عين الاعتبار منذ بداية عملك على المشروع، فسيكون الثمن الذي ستدفعه لجعل محتواك مُتاحاً بخساً إلى حدٍ ما.

- -

عندما تُخطِط لمشروعك، أضف عمليّة اختبار الإتاحة إلى منظومتك الاختباريّة (testing regime)، كما تفعل مع اختبار أي شريحة جماهيريّة مستهدفة مهمة (مثل متصفحات الهواتف وأسطح المكتب المُستهدفة)، اختبر الأمور باكراً وكثيراً (early and often)، يمكنك إجراء اختبارات مؤتمتة لاكتشاف المزايا الناقصة برمجياً (مثل نقصان النص البديل للصورة أو وجود نص سيء يصف الرابط - انظر إلى مقالة العلاقات بين العناصر والسياق)، وقم ببعض الاختبارات مع فئة المُستخدمين المُتضررة؛ لترى كيف تعمل ميزات الموقع المُعقدة معهم. على سبيل المقال:

- -
    -
  • هل أداة التقاط التاريخ (date picker widget) تعمل جيداً عند مَن يستخدمون قارئات الشاشة؟
  • -
  • إن كان المُحتوى يُحدَث ديناميكياً، فهل يلاحظ المعوقين بصرياً ذلك؟
  • -
  • هل يمكن الوصول إلى الأزرار الرسوميّة في الموقع عبر لوحة المفاتيح والشاشات التي تعمل باللمس؟
  • -
- -

يمكنك وينبغي عليك أن تبقى متيقظاً لتنتبه إلى المناطق في محتواك التي من المُحتمَل أن تَحصُل فيها أخطاءً ستحتاج للعمل عليها لجعها مُتاحة، وعليك أن تقوم بفحصها بعنايّة، وتفُكِر بحلول أو بدائِل. التعامل مع المحتوى النصي (كما سترى في المقالة التالية) سهل، ولكن ماذا عن الوسائط المتعددة، ورسوماتك ثلاثيّة الأبعاد؟ يجب عليك النظر إلى ميزانيّة مشروعك والتفكير بواقعيّة حول الحلول المتاحة لجعل محتوى مشروعك متاحاً. يمكنك الدفع مثلاً لتحويل جميع الوسائط المتعددة لديك إلى نصوص مكتوبة، هذا مُكلِف، ولكنه خيار وارد يُمكِن أن يُنجَز.

- -

كن واقعياً أيضاً. الحصول على إتاحة بنسبة 100% أمر مستحيل، ستجد دوماً شخص يعاني بعض المشاكل والصعوبات في التعامل مع موقعك، ولكن هذا يجب أن يكون حافزاً لتبذل أقصى ما في وسعك. إذا كنت تخطط لتضمين رسوم بيانية ثلاثيّة الأبعاد بواسطة مكتبة WebGL، فقد ترغب بإضافة جدول كبديل إتاحي يعرض البيانات في حالة عدم القدرة على قراءة الرسم البياني، أو قد ترغب بتضمين جدول فحسب وإزالة الرسم البياني، فالجدول يُمكِن استخدامه من قبل الجميع، كتابته أسهل، وأقل استهلاكاً للموارد، وسهل الصيانة والتعديل.

- -

من الناحية الأخرى، إذا كنت تعمل على معرض صور يعرض رسوم ثلاثيّة الأبعاد، فمن الغير عقلاني توقُّع أنَّ كل صورة ستكون متاحة بشكل تام للمعاقين بصرياً، فالموقع أصلاً يستهدف الأشخاص ذوي البصر السليم.

- -

لتُظهِر أنَّك مُهتم وقد فكرت في موضوع الإتاحة، انشر بياناً في موقع يشرح سياستك حيال الإتاحة، والخطوات التي اتخذتها لجعل الموقع مُتاحاً. إذا اشتكى أحدهم أنَّ موقعك فيه مشكلة إتاحيّة، حاول التحدث معه، كن صبوراً ومتعاطِفاً، وقم بخطوات حكيمة لمحاولة حل المشكلة.

- -
-

ملاحظة: تغطي مقالة التعامل مع المشاكل الإتاحيّة الشائعة الأمور التي يجب اختبارها بشكل تفصيلي.

-
- -

مُلخَص الأفكار:

- -
    -
  • ضع الإتاحة في عين الاعتبار منذ بداية عملك على المشروع، واختبر الأمور باكراً وكثيراً. كما كأي علّة أخرى، يصبح ثمن إصلاح المشاكل الإتاحيّة كبيراً عند إصلاحها لاحقاً.
  • -
  • ضع في ذهنك أنَّ الممارسات الإتاحيّة الجيدة تفيد الجميع، وليس فقط من لديهم إعاقات. على سبيل المثال، الشيفرة الدلاليّة الواضحة ليست مُساعدة لقارِئات الشاشة وحسب، وإنما تفيد في الأداء والسرعة، وبالتالي هذا مفيد للجميع، وخاصةً للذين يستخدمون الهواتف النقالة ولديهم صبيب ضعيف من اﻹنترنت.
  • -
  • انشر تقريراً عن الحالة الإتاحيّة لموقعك، واجعل من لديهم مشاكل يشاركون.
  • -
- -

دروس إرشاديّة وقوانين عن الإتاحة

- -

يوجد عدد ضخم من القوائم والدروس الإرشاديّة المُتاحة لتعليم إجراء الاختبارات الأساسية. نصيحتنا لك هي أن تتعلم الأمور التي تحتاجها، وأن تفهم الفكرة الأساسية من الدروس المهمة بالنسبة لك.

- -
    -
  • كبداية، نشرت منظمة W3C وثيقة كبيرة وشديدة التفصيل تتضمن معايير دقيقة ومحددة للتقنيات المتوافقة (التي تعمل جيداً) مع الإتاحة. تدعى هذه الوثيقة بدليل إتاحة محتوى الويب (WCAG- الترجمة العربيّة). المعايير مفصولة إلى أربع فئات أساسية تحدد كيف من الممكن إجراء التوصيات بشكل مدروك (perceivable)، عملي (operable)، مفهوم (understandable)، ومتين (robust). المكان الأفضل للحصول على مقدمة خفيفة والبدأ بتعلم هذه الأشياء هو قسم توصيات WCAG بالمختصر من موقع رابطة الويب العالمية (W3C). لا حاجة لحفظ تلك التوصيات عن ظهر قلب، كن متيقظاً فقط للمناطق المثيرة للقلق في موقعك، واستخدم تقنيات وأدوات متنوعة للتعامل مع الأمور الغير متوافقة مع معايير WCAG (انظر أدناه للمزيد من التفاصيل).
  • -
  • قد يكون لدى بلدك تشريعات قانونيّة حول الإتاحة يجب تطبيقها على المواقع التي تستهدف سكانها، كالقسم 508 من قانون إعادة التأهيل في الولايات المتحدة.
  • -
- -

ففي حين أنَّ توصيات WCAG هي مجرد أدّلة إرشادية، قد يكون في دولتك قوانين حول الإتاحة في الويب، أو على الأقل قانون حول إتاحة الخدمات المنشورة للعامة (والتي قد تتضمن المواقع، الخدمات التلفزية... إلخ). من الجيد البحث عن قوانين بلدك المتعلقة بهذا الموضوع وتطبيقها. إن لم تبذل جهداً لتوافِق محتوى موقعك مع قوانين حكومتك، فقد تواجه مشاكل قانونيّة إن اشتكى أحد زوارك ذوي الإعاقات.

- -

قد يبدو هذا غريباً، ولكن الأمر بسيط، فكل ما عليك وضع الإتاحة كأمر ذو أولوية في عملية تطوير الويب (كما شُرِحَ سابقاً). إن كنت تشك في مصداقية ما نقول، يمكنك سؤال محامي مُختَص عن الأمر. لن نوفر المزيد من النصائح، فنحن لسنا برجال قانون.

- -

واجهات برمجيّة للإتاحة

- -

تستفيد المتصفحات من واجهات الإتاحة البرمجيّة (accessibility APIs) الخاصة (التي يوفرها نظام التشغيل الذي يعمل عليه المُتصفح) التي توفِر معلومات مفيدة للتقنيات المعاونة (assistive technologies)، تميل التقنيات المعاونة غالباً للاستفادة من المعلومات الدلاليّة (semantic information)، بالتالي، لا تتضمن هذه المعلومات أشياء تصميميّة، أو بيانات جافاسكربت. تُنظَم هذه المعلومات في شجرة معلوماتيّة تُسمى بالشجرة الإتاحيّة (accessibility tree).

- -

تتوافر في أنظمة التشغيل المختلفة واجهات إتاحيّة مختلفة، مثل:

- -
    -
  • نظام ويندوز: MSAA/IAccessible ،UIAExpress ،IAccessible2
  • -
  • نظام ماك: AT-SPI
  • -
  • نظام أندرويد: Accessibility framework
  • -
  • نظام آي أو إس أو: UIAccessibility
  • -
- -

عندما تفشل المعلومات الدلاليّة الأصيلة الموفرة من قبل عناصر لغة ترميز النص الفائق من إيضاح الغرض، يمكنك تدعيمها بالمزايا المذكورة في توصيات WAI-ARIA، والتي تضيف معلومات دلاليّة إلى شجرة الإتاحة لتُحسِن التجربة الإتاحيّة. يمكنك تعلم المزيد حول تقنيّة WAI-ARIA في مقالة أساسيات تقنيّة WAI-ARIA.

- -

الخلاصة

- -

يبنغي على هذه المقالة أن تكون قد اعطتك لمحة مفيدة عن الإتاحة، عارضةً لك سبب أهميتها، شارحةً كيفيّة إضافتها إلى سير عملك. ينبغي أن تكون الآن متتوقاً (راغباً) لتعلم المزيد حول التفاصيل التي تجعل مواقعك مُتاحة، وسنبدأ بذلك في الفصل الثاني، حيث سنشرح سبب كون لغة ترميز النص الفائق (HTML) أساساً مهماً للإتاحة.

- -

{{NextMenu("Learn/Accessibility/HTML", "Learn/Accessibility")}}

- -

في هذه الوحدة أيضاً

- - - -
-
diff --git a/files/ar/learn/common_questions/how_does_the_internet_work/index.html b/files/ar/learn/common_questions/how_does_the_internet_work/index.html deleted file mode 100644 index 4fff1099e5..0000000000 --- a/files/ar/learn/common_questions/how_does_the_internet_work/index.html +++ /dev/null @@ -1,117 +0,0 @@ ---- -title: كيف يعمل الإنترنت؟ -slug: Learn/Common_questions/How_does_the_Internet_work -tags: - - الإنترنت - - درس - - دليل - - مبتدأ -translation_of: Learn/Common_questions/How_does_the_Internet_work -original_slug: Learn/Common_questions/كيفية_عمل ---- -
-
{{LearnSidebar}}
-
- -
-

يتحدث هذا المقال عن اﻹنترنت وكيفية عملها.

-
- - - - - - - - - - - - -
-

لا يوجد، لكن حبذا لو تقرأ المقال الآتي أولا: كيف أبدأ بتصميم موقعي.

-
-

متطلبات:

-
-

سوف تتعلم الأساسيات التقنية للبنية التحتية للويب والفرق بين الشابكة (الإنترنت) والويب.

-
-

الهدف:

-
- -

- -

ملخص

- -

الشابكة (الإنترنت) هي عماد الويب. والبنية التحتية التي جعلته ممكنا. وفي الأساس الإنترنت هي شبكة واسعة من الحواسيب التي تتواصل فيما بينها.

- -

تاريخ الإنترنت غير واضح تماما. فقد بدأت في ستينات القرن الماضي كمشروع بحث للجيش الأمريكي، وبدعم العديد من الجامعات العمومية والشركات الخاصة تطورت إلى بنية تحتية عامة. التقانات المختلفة التي تدعم الإنترنت تطورت عبر الزمن، لكن الطريقة التي تعمل بها لم تتغير كثيرا: فالإنترنت هي طريقة اتصال الحواسيب مع بعضها وضمان أنه مهما حدث تبقى تلك الحواسيب متصلة.

- -

التعلم الفعال

- - - -

نظرة أعمق

- -

شبكة بسيطة

- -

عندما نرغب بجعل حاسوبين يتصلان ببعضهما، سنربطهما إما فيزيائيا (عادة ما يكون بكابل إيثرنت) أو لاسلكيا (على سبيل المقال نظامي الوايفاي أو البلوتوث). جميع الحواسيب الحديثة تستطيع استعمال أي من هذه الارتباطات.

- -
-

 فيما تبقى من المقال سنتحدث فقط عن الكابلات الفيزيائية، لكن الشبكات اللاسلكية تعمل بنفس المبدأ.

-
- -

Two computers linked together

- -

شبكة كهذه ليست محدودة بحاسوبين فحسب، يمكنك ربط حواسيب أخرى قدر ما تريد. لكن سرعان ما تصبح هذه الشبكة معقدة. مثلا لنقل أنك تريد ربط عشر حواسيب فستحتاج إلى 45 كابلا مع تسعة قوابس في كل حاسوب!

- -

Ten computers all together

- -

لحل هذه المشكلة، يجب أن نربط كل حاسوب في الشبكة بحاسوب مصغر خاص يسمى روتر. هذا الروتر كعامل الإشارة في السكك الحديدية، لديه مهمة واحدة وهي ضمان وصول رسالة ما من حاسوب إلى الحاسوب المقصود الصحيح. لإرسال رسالة إلى الحاسوب B، على الحاسوب A أن يُرسل الرسالة إلى الروتر، الذي سيُوجهها بدوره إلى الحاسوب B ويضمن أن لا تُرسل إلى الحاسوب C مثلا.

- -

عند إضافة روتر إلى الشبكة من عشرة حواسيب، كل ما نحتاجه هو عشرة كابلات مع مقبس في كل حاسوب وروتر بعشرة مقابس.

- -

Ten computers with a router

- -

شبكة من الشبكات

- -
    -
  • إلى هذا الحد جيد جداً، ولكن مذا عن ربط المئات، الآلاف، المليارات من أجهزة الكمبيوتر؟ بالطبع لا يستطيع جهاز توجيه (router) واحد أن يصل إلى هذا الحد، لكن، إذا قرأت بعناية, قلنا أن جهاز التوجيه هو جهاز كمبيوتر مثل أي جهاز آخر، إذن ما الذي يمنعنا من توصيل جهازي توجيه معاً، لاشئ، لذلك دعونا نفعل ذلك.
  • -
- -

Two routers linked together

- -
    -
  • عن طريق توصيل أجهزة الكمبيوتر بأجهزة التوجيه (router)، ثم أجهزة التوجيه إلى أجهزة التوجيه، نحن قادرون على التوسع إلى ما لا نهاية.
  • -
- -

Routers linked to routers

- -

Such a network comes very close to what we call the Internet, but we're missing something. We built that network for our own purposes. There are other networks out there: your friends, your neighbors, anyone can have their own network of computers. But it's not really possible to set cables up between your house and the rest of the world, so how can you handle this? Well, there are already cables linked to your house, for example, electric power and telephone. The telephone infrastructure already connects your house with anyone in the world so it is the perfect wire we need. To connect our network to the telephone infrastructure, we need a special piece of equipment called a modem. This modem turns the information from our network into information manageable by the telephone infrastructure and vice versa.

- -

A router linked to a modem

- -

So we are connected to the telephone infrastructure. The next step is to send the messages from our network to the network we want to reach. To do that, we will connect our network to an Internet Service Provider (ISP). An ISP is a company that manages some special routers that are all linked together and can also access other ISPs' routers. So the message from our network is carried through the network of ISP networks to the destination network. The Internet consists of this whole infrastructure of networks.

- -

Full Internet stack

- -

Finding computers

- -

If you want to send a message to a computer, you have to specify which one. Thus any computer linked to a network has a unique address that identifies it, called an "IP address" (where IP stands for Internet Protocol). It's an address made of a series of four numbers separated by dots, for example: 192.168.2.10.

- -

That's perfectly fine for computers, but we human beings have a hard time remembering that sort of address. To make things easier, we can alias an IP address with a human readable name called a domain name. For example, google.com is the domain name used on top of the IP address 173.194.121.32. So using the domain name is the easiest way for us to reach a computer over the Internet.

- -

Show how a domain name can alias an IP address

- -

Internet and the web

- -

As you might notice, when we browse the Web with a Web browser, we usually use the domain name to reach a website. Does that mean the Internet and the Web are the same thing? It's not that simple. As we saw, the Internet is a technical infrastructure which allows billions of computers to be connected all together. Among those computers, some computers (called Web servers) can send messages intelligible to web browsers. The Internet is an infrastructure, whereas the Web is a service built on top of the infrastructure. It is worth noting there are several other services built on top of the Internet, such as email and {{Glossary("IRC")}}.

- -

Next steps

- - diff --git a/files/ar/learn/common_questions/index.html b/files/ar/learn/common_questions/index.html deleted file mode 100644 index 34df4764d6..0000000000 --- a/files/ar/learn/common_questions/index.html +++ /dev/null @@ -1,133 +0,0 @@ ---- -title: أسئلة شائعة -slug: Learn/Common_questions -tags: - - أسئلة-شائعة - - صفحة هبوط - - ويب -translation_of: Learn/Common_questions ---- -
{{LearnSidebar}}
- -

هذا القسم من منطقة التعلُّم (قسم التعلُّم) مُصمَم لتوفير أجوبة عن الأسئلة الشائعة، والتي ليست بالضرورة أن تكون جزءً جوهرياً من المسارات التعليميّة (مثل مقالات لغة ترميز النص الفائق وصفحات الأنماط الانسيابية التعليميّة). حيث أنَّ هذه المقالات صُمِمَت لتكون مُستقلة عن أي قسم آخر.

- -

كيف يعمل الويب

- -

يغطي هذا القسم آليات عمل الويب، الأسئلة المتعلقة بالمعلومات العامة حول نظام الويب وكيفيّة عمله.

- -
-
-

كيف تعمل الشابكة؟

-
-
الشابكة (الإنترنت) هي العمود الفقري (اللبنة الأساسيّة) للويب، فهي البنيّة التقنيّة التحتيّة التي تجعل الإنترنت يعمل. كشرح بسيط، الشابكة هي شبكة ضخمة من الحواسيب تتواصل مع بعضها البعض. تناقش هذه المقالة كيفيّة عمل الشابكة بشكل تفصيلي بسيط.
-
-

ما الفرق بين صفحة الويب، موقع الويب، خادم الويب، ومُحرِّك البحث؟

-
-
تشرح هذه المقالة مفاهيم متنوعة متعلقة بعمل الويب، وهي: الصفحات، المواقع، خوادم الويب، ومحرِّكات البحث. غالباً ما تُستخدَم هذه المصطلحات بشكل خاطئ، أو تُشتت القادمين الجدد إلى المجال. دعنا نتعرَّف على كل مصطلحٍ منهم في هذا المقال.
-
-

ما هو الرابط؟

-
-
بجانب {{Glossary("Hypertext", "النصوص الفائقة")}} و{{Glossary("HTTP", "ميثاق نقل النص الفائق")}}، يعد الرابط (URL) أحد المفاهيم الأساسيّة في الويب. فهو آلية تستخدمها {{Glossary("Browser","المُتصفحات")}} للنفاذ لأي مورِد منشور على الويب.
-
-

ما هو اسم النطاق؟

-
-
أسماء النطاقات هي جزء أساسي من البنيّة التحتيّة للشابكة. فهي توفِر عناوين مقروءة بشرياً لخوادم الويب الموجودة على الإنترنت.
-
-

ما هو خادم الويب؟

-
-
-

يُمكِن أن يشير مُصطلَح "خادم الويب (Web Server)" إلى برمجيّة أو جهاز يقوم بإرسال المواقع، أو لكلاهما عندما يعملان معاً. سنتعرف في هذه المقالة على ماهيّة خوادم الويب، كيفيّة عملها، وأهميتها.

-
-
-

ما هي الوصلات؟

-
-
سنتعرف في هذه المقالة على ماهيّة الوصلات (hyperlinks) وأهميتها.
-
- -

الإعداد والأدوات

- -

يحوي هذا القسم الأسئلة المتعلقة بالبرمجيات والأدوات التي يمكنك استخدامها لبناء موقعك.

- -
-
-

كم يكلِف إنشاء شيء ما على الويب؟

-
-
عندما تنشر مشروعك، قد لا تُنفِق شيء أو قد تصل التكلفة إلى مستوى عالٍ جداً. سنناقش في هذه المقالة تكلفة كل شيء وما تحصَل عليه مقابل ما تدفعه (وما لا تدفعه).
-
-

ما البرمجيات التي احتاجها لبناء موقع؟

-
-
سنشرح في هذه المقالة البرمجيات التي تحتاجها عندما تقوم بتعديل، رفع (تحميل)، أو عرض موقعك.
-
-

ما هي محررات النصوص المتوفرة؟

-
-
سنُعنوِن في هذه المقالة بعض الأشياء التي عليك التمهل والتفكير حولها عندما تقوم بتثبيت محرر نصوص لاستخدامه في تطوير الويب.
-
-

ما هي أدوات المطورين في المُتصفِح؟

-
-
يوفِر كل {{ glossary("browser", "مُتصفِح") }} مجموعة من أدوات المطورين لتنقيح شيفرات لغة ترميز النص الفائق، صفحات الأنماط الانسيابية، وغيرها من اللغات الأخرى. تشرح هذه المقالة كيفيّة استخدام الوظائف الأساسيّة لأدوات المطورين في مُتصفِحك.
-
-

كيف تتأكَّد من أنَّ موقعك يعمل بشكل سليم؟

-
-
الآن، وبعد أن نشرت موقعك على الأنترنت (مبارك عليك هذا)، هل تأكَّدت من أنَّه يعمل بشكل سليم؟ توفر هذه المقالة بعض الخطوات الأساسيّة في عمليّة استكشاف اﻷخطاء وإصلاحها.
-
-

كيف تقوم بإعداد خادم اختبار محلي؟

-
-
-
-

تشرح هذه المقالة كيف يمكنك إعداد خادم اختبار محلي بسيط على جهازك، كما تشرح بعض اساسيات استخدامه.

-
-
-
-

كيف تقوم برفع ملفاتك إلى خادم الويب؟

-
-
تُظهِر هذه المقالة الكيفيّة التي يمكنك استخدامها لنشر موقعك باستخدام أدوات {{ glossary("FTP", "ميثاق نقل الملفات") }}، وهي إحدى أكثر الأدوات شيوعاً التي تستخدم لوضع موقعك على الإنترنت ليتمكن الآخرون من الدخول إليه عبر حواسيبهم.
-
-

كيف استخدم خدمة "صفحات جيتهاب"؟

-
-
توفِر هذه المقالة دليل بسيط لعمليّة نشر المحتوى باستخدام خدمة "صفحات جيتهاب (Github pages)".
-
-

كيف تستضيف موقعك على مُحرِّك تطبيقات جوجل؟

-
-
أتبحث عن مكان لاستضافة موقعك؟ إليك هذا الدليل التدريجي لاستضافة موقعك على خدمة مُحرِّك تطبيقات جوجل (Google App Engine).
-
-

ما الأدوات المتوفرة لتنقيح وتحسين أداء الموقع؟

-
-
تُظهِر لك مجموعة المقالات هذه طريقة استخدام أدوات المطورين في فايرفوكس لتنقيح وتحسين أداء موقعك، استخدام الأدوات لفحص استخدام الذاكرة، شجرة استدعاءات الجافاسكربت (JavaScript call tree)، وكميّة عقد DOM المعروضة، والمزيد من الأمور.
-
- -

التصميم والإتاحة

- -

يسرُد هذا القسم الأسئلة المتعلقة بالأمور الجماليّة، تنظيم الصفحات، وتقنيات الإتاحة (accessibility) ...إلخ.

- -
-
-

كيف أبدأ تصميم موقعي؟

-
-
تغطي هذه المقالة جميع الجوانب المهمة للخطوة الأوليّة المهمة لكل مشروع وهي تحديد الغايّة التي تريد تحقيقها من خلاله.
-
-

ماذا تحوي نماذج الويب الشائعة؟

-
-
عند تصميم صفحات موقعك، من الجيد الحصول على فكرة عن أكثر النماذج (layouts) شيوعاً. تغطي هذه المقالة بعض نماذج الويب الشائعة، وتشرح الأجزاء المكوِّنة لكل نموذج منها.
-
-

ما هي الإتاحة؟

-
-
توفِر هذه المقالة مقدمة عن المفاهيم الأساسية للإتاحة.
-
-

كيف يمكننا إنشاء تصميم لجميع أنواع المُستخدمين؟

-
-
توفِر هذه المقالة بعض التقنيات البسيطة التي تساعد على تصميم مواقع لجميع أنواع المُستخدمين، حيث تحتوي على تكتيكات سريعة للإتاحة، وأمور أخرى مشابهة.
-
-

ما هي مميزات لغة ترميز النص الفائق المُعزِّزة للإتاحة؟

-
-
تشرح هذه المقالة ميزات لغة ترميز النص الفائقة التي يُمكِن أن تُستخدَم لجعل صفحات الويب مُتاحة بشكل أكبر للأشخاص الذين يعانون من إعاقات مختلفة.
-
- -

أسئلة عن لغة ترميز النص الفائق، صفحات الأنماط الانسيابية، والجافاسكربت

- -

للحصول على حلول شائعة للمشاكل التي تصادفك في لغة ترميز النص الفائق (HTML)، صفحات الأنماط الانسيابية (CSS)، والجافاسكربت، أقرأ المقالات التالية:

- - diff --git a/files/ar/learn/common_questions/what_is_a_web_server/index.html b/files/ar/learn/common_questions/what_is_a_web_server/index.html deleted file mode 100644 index f08c4cf37c..0000000000 --- a/files/ar/learn/common_questions/what_is_a_web_server/index.html +++ /dev/null @@ -1,118 +0,0 @@ ---- -title: ما هو خادم الويب؟ -slug: Learn/Common_questions/What_is_a_web_server -tags: - - مبتدئين -translation_of: Learn/Common_questions/What_is_a_web_server ---- -
-

سنتعرف في هذه المقالة على ماهيّة خوادم الويب، كيفيّة عملها، وأهميتها.

-
- - - - - - - - - - - - -
المتطلبات:يجب أن تكون على علم مُسبَق بكيفيّة عمل الإنترنت، ومُتفَهِماً الفرق بين صفحة الويب، الموقع، خادم الويب، ومُحرِّك البحث.
الهدف:ستتعلم ماهيّة خوادم الويب وستحصل على فهم عام لكيفيّة عملها.
- -

الخلاصة

- -

يُمكِن أن يشير مُصطلَح "خادم الويب (Web Server)" إلى برمجيّة أو جهاز، أو لكلاهما عندما يعملان معاً.

- -
    -
  1. خادم الويب (كجهاز) هو حاسوب يُخزِّن برمجيّة خادم الويب والملفات المكوِّنة للموقع (مثل ملفات {{ glossary("HTML", "لغة ترميز النص الفائق") }}، الصور، ملفات {{ glossary("CSS", "صفحات الأنماط الانسيابية") }}، وملفات الجافاسكربت). يتصِل هذا الخادم بالشابكة (الإنترنت) ويدعم التبادل المادي للبيانات مع الأجهزة الأخرى المتصلة بالويب.
  2. -
  3. خادم الويب (كبرمجيّة) يتضمن أجزاء عدَّة تتحكم بطريق وصول مُستخدمين الويب للملفات المُستضافة، يتضمن على الأقل خادم ميثاق نقل النص الفائق (HTTP Server). خادم ميثاق نقل النص الفائق هو جزء من برمجيّة تفهم {{Glossary("URL","الروابط")}} (عناوين الويب) و{{Glossary("HTTP", "ميثاق نقل النص الفائق")}} (ميثاق يستخدمه مُتصفِحُك لعرض صفحات الويب). يُمكِن الوصول لهذا الخادم عبر أسماء نطاقات الموقع (مثل mozilla.org) التي يُخزِنها، والوصول للمحتوى الذي تقدمه لأجهزة مستخدميها.
  4. -
- -

كشرح بسيط جداً، كلما احتاج المُتصفِح ملفاً مُستضافاً على خادم ويب، يطلب المُتصفِح الملف عبر ميثاق نقل النص الفائق (HTTP). عندما يصل الطلب لخادم الويب المطلوب (الجهاز)، يقبل خادم ميثاق نقل النص الفائق (البرمجيّة) هذا الطلب، ويبحث عن الملف المطلوب (إن لم يكن موجوداً، سيعيد الخادم رمز الحالة 404)، ثم يُعيدُه بواسطة ميثاق نقل النص الفائق إلى المُتصفِح.

- -

تمثيل بسيط للإتصال بين الخادم والعميل بواسط ميثاق نقل النص الفائق

- -

تحتاج إما لخادم ويب ساكن (static) أو ديناميكي (dynamic) لنشر موقعك.

- -

يتألَّف خادم الويب الساكن من حاسب (الجهاز) وميثاق نقل النص الفائق (البرمجيّة). نُسمي هذا النوع من الخوادم "ساكناً" لأنَّه يُرسِل الملف المُستضاف كما هو إلى مُتصفِحك.

- -

يتألَّف خادم الويب الديناميكي من خادم ويب ساكن وبرمجيات إضافيّة، أكثرها شعبيّة خادم التطبيق (application server) وقاعدة البيانات. نُسمي هذا النوع من الخوادم "ديناميكياً" لأنَّ خادم التطبيق يُحدِّث الملفات المُستضافة قبل إرسالها إلى مُتصفِحك بواسطة خادم ميثاق نقل النص الفائق.

- -

على سبيل المثال، لإنتاج الصفحات النهائيّة التي تراها في مُتصفِحك، قد يملأ خادم التطبيق قالب لغة ترميز النص الفائق ببعض المحتويات من قاعدة البيانات. مواقع مثل شبكة مطوري موزيلا (MDN) والموسوعة الحرَّة (ويكيبيديا) تملك آلاف الصفحات، ولكنها ليست مستندات لغة ترميز نص فائق فعليّة، وإنما بضعة قوالب وقاعدة بيانات ضخمة. هذه الطريقة تجعل من السهل والسريع صيانة وتسليم المحتوى.

- -

التعلم النشط

- -

لا يوجد بعد قسم تعلم نشط في هذه الصفحة. الرجاء النظر في المُساهمة.

- -

الشرح بتعمُق

- -

لجلب الصفحات، كما ذكرنا مُسبقاً، يقوم مُتصفحك بإرسال طلب إلى خادم الويب، الذي يقوم بالبحث عن الملف المطلوب في مساحته التخزينيّة. حالما يجد الملف، يقوم الخادم بقراءته، معالجته حسب الحاجة، ومن ثم إرساله إلى المُتصفِح. دعنا نُلقي نظرة على هذه الخطوات بتعمُق أكبر.

- -

استضافة الملفات

- -

على خادم الويب أولاً تخزين ملفات الموقع، أي جميع مستندات لغة ترميز النص الفائق وأصولها (assets)، بما فيها الصور، ملفات صفحات الأنماط الانسيابية، ملفات الجافاسكربت، الخطوط، والفيديوهات.

- -

تقنياً، يمكنك استضافة كل تلك الملفات على حاسبك الشخصي، ولكنه من الأكثر ملائمة تخزينهم في خادم ويب مخصص:

- -
    -
  • يعمل طوال الوقت.
  • -
  • مُتصل بالإنترنت دوماً.
  • -
  • يملك عنوان الشبكة (IP) ثابِت (لا توفِر جميع {{Glossary("ISP", "مزودات الخدمة")}} عناوين شبكة ثابتة للخطوط المنزليّة).
  • -
  • تتم صيانته من قبل مزوِّد خارجي.
  • -
- -

تبعاً لكل تلك الاسباب، إيجاد مزوِّد استضافة جيد هو جزء رئيسي من عمليّة بناء موقعك. ابحث بين عروض الشركات الخدميّة المتنوعة واختر العرض المناسب لاحتياحاتك وميزانيتك (تترواح أسعار الخدمات من المجان إلى الألف دولار في الشهر). يمكنك إيجاد المزيد من التفاصيل في هذه المقالة.

- -

حالما تنتهي من إعداد استضافة الويب، سيكون عليك رفع (تحميل) ملفاتك إلى خادم الويب.

- -

التواصل عبر ميثاق نقل النص الفائق

- -

ثانياً، يوفِر خادم الويب دعماً {{Glossary("HTTP", "لميثاق نقل النص الفائق")}}. كما يوضِح اسمه، يحدد هذا الميثاق كيفيّة نقل النص الفائق (أي مستندات الويب المُرتَبِطة) بين حاسوبين.

- -

{{Glossary("Protocol", "الميثاق")}} (البروتوكول) هو مجموعة من القواعد التي تحدد كيفيّة تواصل حاسوبين مع بعضهما. يعد ميثاق نقل النص الفائق ميثاقاً نصيّاً (textual) وعديم الحالة (stateless).

- -
-
ميثاق نصي
-
أي أنَّ جميع الأومر نصيّة ومقروءة من قبل البشر (غير مُشفَرة أو معماة).
-
عديم الحالة
-
لا الخادم أو العميل يتذكر عمليّة التواصل السابقة. على سبيل المثال، بالإعتماد على ميثاق نقل النص الفائق وحسب، لن يكون الخادم قادراً على تذكر كلمة المرور التي أدخلتها، أو الخطوة التي أنت فيها في عمليّة التسجيل. تحتاج إلى خادم تطبيق لإنجاز هذه الأمور. (سنغطي نوع التقنيات هذا في مقالات مستقبليّة).
-
- -

يوفِر ميثاق نقل النص الفائق قواعد واضحة للكيفيّة التي يتواصل بها الخادم والعميل. سنغطي الأمور المتعلقة بالميثاق ذاته في مقالة تقنيّة مرجعيّة لاحقاً. حالياً عليك أن تعلم هذه الأمور وحسب:

- -
    -
  • فقط العميل يمكنه إرسال الطلبات، وللخادِم وحسب. يُمكن للخوادم فقط الرد على طلبات العميل.
  • -
  • عندما يتم طلب ملف عبر ميثاق نقل النص الفائق، على العميل إرسال {{Glossary("URL", "رابط")}} الملف.
  • -
  • على خادم الويب الإجابة (لا خيار آخر) على كل طلب يأتيه، على الأقل عليه أن يرسل رسالة الخطأ.
  • -
- -

صفحة الحطأ 404 لشبكة مطوري موزيلا كمثال على صفحة خطأفي خادم الويب، يكون خادم ميثاق نقل النص الفائق مسؤولاً عن معالجة والإجابة على الطلبات الآتية.

- -
    -
  1. عند تلقي طلب، يقوم خادم ميثاق نقل النص الفائق بدايةً بالتحقق مما إذا كان رابط الملف المطلوب موجوداً.
  2. -
  3. إن كان كذلك، يُرسِل خادم الويب محتوى الملف إلى المُتصفِح. إن لم يكن، يقوم خادم التطبيق ببناءه (عندما يكون المحتوى ديناميكياً لا تُمثِل جميع الصفحات ملفاتاً، لذلك يبني خادم التطبيق الملف المطلوب من قالب آخر).
  4. -
  5. إن لم تكن كلتا العمليتين ممكنتين، يُرسِل خادم الويب رسالة خطأ إلى المُتصفِح، أكثر تلك الرسائل شيوعاً هي "404 غير موجود" (هذا الخطأ شائع لأنَّ الكثير من مصممي الويب يقضون وقتاً لتصميم صفحة الخطأ 404).
  6. -
- -

المحتوى الساكن والديناميكي

- -

بشكل تقريبي، يُمكِن للخادم إما أن يُرسِل محتوى ساكناً أو ديناميكياً. يعني المُصطلَح "ساكن (Static)" أنَّ المحتوى "يُرسَل كما هو (served as-is)". المحتويات الساكنة هي الأكثر سهولةً في الإعداد، لذلك ننصحك بأن يكون أوَّل موقع لك ساكناً.

- -

يعني المُصطلَح "ديناميكي (Dynamic)" أنَّ الخادِم يعالِج المحتوى أو حتى يولِّده كاملاً من قاعدة البيانات. يوِفِر هذا حل أكثر مرونة، ولكن الجانب التقني يصبح التعامُل معه أكثر صعوبة، مما يجعل بناء الموقع أكثر صعوبة بمقدار كبير.

- -

لنأخذ الصفحة التي تقرأها الآن على سبيل المثال. على خادم الويب المُستضيف للموقع، يوجد خادم تطبيق يأخذ محتوى المقالة من قاعدة بيانات، ينسِقَهُ، يَضَعُهُ بداخل بعض القوالب، ومن ثم يرسِل لك النتائج. في مثالنا هذا، اسم خادم التطبيق هو كوما (Kuma) وهو مبني بواسطة بايثون (باستخدام إطار جانغو). قام فريق موزيلا ببناء كوما وفقاً لاحتياجات الشبكة، ولكن توجد العديد من التطبيقات الأخرى المشابهة مبنيّة على العديد من التقنيات الأخرى.

- -

توجد العديد من خوادم التطبيقات مما يجعل من الصعب اقتراح واحد. تلبي بعض خوادم التطبيقات احتياجات فئة معينة من التطبيقات مثل المدونات، الموسوعات (wiki)، أو مواقع التسوق الإلكترونيّة، وأُخرى تدعى {{Glossary("CMS", "أنظمة إدارة المحتوى")}} (CMS) وهي أكثر عموميّة. إن كنت تبني موقعاً ديناميكياً، تمهل قليلاً لاختيار الأداة التي تناسب احتياجاتك. ما لم ترغب بتعلم بعض مهارات برمجة خوادم الويب (والذي يعد مجال مثير بحد ذاته!)، فأنت لا ترغَب بكتابة خادم تطبيق خاص بك. فهذا إعادة اختراع للعجلة!

- -

الخطوات التالية

- -

الآن، وبمعرفتك لكيفيّة عمل خوادم الويب يمكنك:

- - diff --git a/files/ar/learn/css/building_blocks/index.html b/files/ar/learn/css/building_blocks/index.html deleted file mode 100644 index 8768d600eb..0000000000 --- a/files/ar/learn/css/building_blocks/index.html +++ /dev/null @@ -1,90 +0,0 @@ ---- -title: CSS building blocks -slug: Learn/CSS/Building_blocks -tags: - - Beginner - - CSS - - Learn - - NeedsTranslation - - TopicStub - - building blocks -translation_of: Learn/CSS/Building_blocks ---- -
{{LearnSidebar}}
- -

This module carries on where CSS first steps left off — now you've gained familiarity with the language and its syntax, and got some basic experience with using it, its time to dive a bit deeper. This module looks at the cascade and inheritance, all the selector types we have available, units, sizing, styling backgrounds and borders, debugging, and lots more.

- -

The aim here is to provide you with a toolkit for writing competent CSS and help you understand all the essential theory, before moving on to more specific disciplines like text styling and CSS layout.

- -

Prerequisites

- -

Before starting this module, you should have:

- -
    -
  1. Basic familiarity with using computers, and using the Web passively (i.e. just looking at it, consuming the content.)
  2. -
  3. A basic work environment set up as detailed in Installing basic software, and an understanding of how to create and manage files, as detailed in Dealing with files.
  4. -
  5. Basic familiarity with HTML, as discussed in the Introduction to HTML module.
  6. -
  7. An understanding of the basics of CSS, as discussed in the CSS first steps module.
  8. -
- -
-

Note: If you are working on a computer/tablet/another device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin or Glitch.

-
- -

Guides

- -

This module contains the following articles, which cover the most essential parts of the CSS language. Along the way you'll come across plenty of exercises to allow you to test your understanding.

- -
-
Cascade and inheritance
-
The aim of this lesson is to develop your understanding of some of the most fundamental concepts of CSS — the cascade, specificity, and inheritance — which control how CSS is applied to HTML and how conflicts are resolved.
-
CSS selectors
-
There are a wide variety of CSS selectors available, allowing for fine-grained precision when selecting elements to style. In this article and its sub-articles, we'll run through the different types in great detail, seeing how they work. The sub-articles are as follows: - -
-
The box model
-
Everything in CSS has a box around it, and understanding these boxes is key to being able to create layouts with CSS, or to align items with other items. In this lesson, we will take a proper look at the CSS Box Model, in order that you can move onto more complex layout tasks with an understanding of how it works and the terminology that relates to it.
-
Backgrounds and borders
-
In this lesson we will take a look at some of the creative things you can do with CSS backgrounds and borders. From adding gradients, background images, and rounded corners, backgrounds and borders are the answer to a lot of styling questions in CSS.
-
Handling different text directions
-
In recent years, CSS has evolved in order to better support different directionality of content, including right-to-left but also top-to-bottom content (such as Japanese) — these different directionalities are called writing modes. As you progress in your study and begin to work with layout, an understanding of writing modes will be very helpful to you, therefore we will introduce them in this article.
-
Overflowing content
-
In this lesson we will look at another important concept in CSS — overflow. Overflow is what happens when there is too much content to be contained comfortably inside a box. In this guide, you will learn what it is and how to manage it.
-
CSS values and units
-
Every property used in CSS has a value or set of values that are allowed for that property. In this lesson, we will take a look at some of the most common values and units in use.
-
Sizing items in CSS
-
In the various lessons so far you have come across a number of ways to size items on a web page using CSS. Understanding how big the different features in your design will be is important, and in this lesson, we will summarize the various ways elements get a size via CSS and define a few terms around sizing that will help you in the future.
-
Images, media, and form elements
-
In this lesson we will take a look at how certain special elements are treated in CSS. Images, other media, and form elements behave a little differently in terms of your ability to style them with CSS than regular boxes. Understanding what is and isn't possible can save some frustration, and this lesson will highlight some of the main things that you need to know.
-
Styling tables
-
Styling an HTML table isn't the most glamorous job in the world, but sometimes we all have to do it. This article provides a guide to making HTML tables look good, with some specific table styling techniques highlighted.
-
Debugging CSS
-
Sometimes when writing CSS you will encounter an issue where your CSS doesn't seem to be doing what you expect. This article will give you guidance on how to go about debugging a CSS problem, and show you how the DevTools included in all modern browsers can help you find out what is going on.
-
Organizing your CSS
-
As you start to work on larger stylesheets and big projects you will discover that maintaining a huge CSS file can be challenging. In this article, we will take a brief look at some best practices for writing your CSS to make it easily maintainable, and some of the solutions you will find in use by others to help improve maintainability.
-
- -

Assessments

- -

Want to test your CSS skills? The following assessments will test your understanding of the CSS covered in the guides above.

- -
-
Fundamental CSS comprehension
-
This assessment tests your understanding of basic syntax, selectors, specificity, box model, and more.
-
Creating fancy letterheaded paper
-
If you want to make the right impression, writing a letter on nice letterheaded paper can be a really good start. In this assessment, we'll challenge you to create an online template to achieve such a look.
-
A cool looking box
-
Here you'll get some practice in using background and border styling to create an eye-catching box.
-
- -

See also

- -
-
Advanced styling effects
-
This article acts as a box of tricks, providing an introduction to some interesting advanced styling features such as box shadows, blend modes, and filters.
-
diff --git a/files/ar/learn/css/building_blocks/selectors/index.html b/files/ar/learn/css/building_blocks/selectors/index.html deleted file mode 100644 index 9bc86d8abc..0000000000 --- a/files/ar/learn/css/building_blocks/selectors/index.html +++ /dev/null @@ -1,223 +0,0 @@ ---- -title: CSS selectors -slug: Learn/CSS/Building_blocks/Selectors -translation_of: Learn/CSS/Building_blocks/Selectors ---- -
{{LearnSidebar}}{{PreviousMenuNext("Learn/CSS/Building_blocks/Cascade_and_inheritance", "Learn/CSS/Building_blocks/Selectors/Type_Class_and_ID_Selectors", "Learn/CSS/Building_blocks")}}
- -

In {{Glossary("CSS")}}, selectors are used to target the {{glossary("HTML")}} elements on our web pages that we want to style. There are a wide variety of CSS selectors available, allowing for fine-grained precision when selecting elements to style. In this article and its sub-articles we'll run through the different types in great detail, seeing how they work.

- - - - - - - - - - - - -
Prerequisites:Basic computer literacy, basic software installed, basic knowledge of working with files, HTML basics (study Introduction to HTML), and an idea of how CSS works (study CSS first steps.)
Objective:To learn how CSS selectors work in detail.
- -

What is a selector?

- -

You have met selectors already. A CSS selector is the first part of a CSS Rule. It is a pattern of elements and other terms that tell the browser which HTML elements should be selected to have the CSS property values inside the rule applied to them. The element or elements which are selected by the selector are referred to as the subject of the selector.

- -

Some code with the h1 highlighted.

- -

In earlier articles you met some different selectors, and learned that there are selectors that target the document in different ways — for example by selecting an element such as h1, or a class such as .special.

- -

In CSS, selectors are defined in the CSS Selectors specification; like any other part of CSS they need to have support in browsers for them to work. The majority of selectors that you will come across are defined in the Level 3 Selectors specification, which is a mature specification, therefore you will find excellent browser support for these selectors.

- -

Selector lists

- -

If you have more than one thing which uses the same CSS then the individual selectors can be combined into a selector list so that the rule is applied to all of the individual selectors. For example, if I have the same CSS for an h1 and also a class of .special, I could write this as two separate rules.

- -
h1 {
-  color: blue;
-}
-
-.special {
-  color: blue;
-} 
- -

I could also combine these into a selector list, by adding a comma between them.

- -
h1, .special {
-  color: blue;
-} 
- -

White space is valid before or after the comma. You may also find the selectors more readable if each is on a new line.

- -
h1,
-.special {
-  color: blue;
-} 
- -

In the live example below try combining the two selectors which have identical declarations. The visual display should be the same after combining them.

- -

{{EmbedGHLiveSample("css-examples/learn/selectors/selector-list.html", '100%', 1000)}} 

- -

When you group selectors in this way, if any selector is invalid the whole rule will be ignored.

- -

In the following example, the invalid class selector rule will be ignored, whereas the h1 would still be styled.

- -
h1 {
-  color: blue;
-}
-
-..special {
-  color: blue;
-} 
- -

When combined however, neither the h1 nor the class will be styled as the entire rule is deemed invalid.

- -
h1, ..special {
-  color: blue;
-} 
- -

Types of selectors

- -

There are a few different groupings of selectors, and knowing which type of selector you might need will help you to find the right tool for the job. In this article's subarticles we will look at the different groups of selectors in more detail.

- -

Type, class, and ID selectors

- -

This group includes selectors that target an HTML element such as an <h1>.

- -
h1 { }
- -

It also includes selectors which target a class:

- -
.box { }
- -

or, an ID:

- -
#unique { }
- -

Attribute selectors

- -

This group of selectors gives you different ways to select elements based on the presence of a certain attribute on an element:

- -
a[title] { }
- -

Or even make a selection based on the presence of an attribute with a particular value:

- -
a[href="https://example.com"] { }
- -

Pseudo-classes and pseudo-elements

- -

This group of selectors includes pseudo-classes, which style certain states of an element. The :hover pseudo-class for example selects an element only when it is being hovered over by the mouse pointer:

- -
a:hover { }
- -

It also includes pseudo-elements, which select a certain part of an element rather than the element itself. For example, ::first-line always selects the first line of text inside an element (a <p> in the below case), acting as if a <span> was wrapped around the first formatted line and then selected.

- -
p::first-line { }
- -

Combinators

- -

The final group of selectors combine other selectors in order to target elements within our documents. The following for example selects paragraphs that are direct children of <article> elements using the child combinator (>):

- -
article > p { }
- -

Next steps

- -

You can take a look at the reference table of selectors below for direct links to the various types of selectors in this Learn section or on MDN in general, or continue on to start your journey by finding out about type, class, and ID selectors.

- -

{{PreviousMenuNext("Learn/CSS/Building_blocks/Cascade_and_inheritance", "Learn/CSS/Building_blocks/Selectors/Type_Class_and_ID_Selectors", "Learn/CSS/Building_blocks")}}

- -

Reference table of selectors

- -

The below table gives you an overview of the selectors you have available to use, along with links to the pages in this guide which will show you how to use each type of selector. I have also included a link to the MDN page for each selector where you can check browser support information. You can use this as a reference to come back to when you need to look up selectors later in the material, or as you experiment with CSS generally.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SelectorExampleLearn CSS tutorial
Type selectorh1 {  }Type selectors
Universal selector* {  }The universal selector
Class selector.box {  }Class selectors
id selector#unique { }ID selectors
Attribute selectora[title] {  }Attribute selectors
Pseudo-class selectorsp:first-child { }Pseudo-classes
Pseudo-element selectorsp::first-line { }Pseudo-elements
Descendant combinatorarticle pDescendant combinator
Child combinatorarticle > pChild combinator
Adjacent sibling combinatorh1 + pAdjacent sibling
General sibling combinatorh1 ~ pGeneral sibling
- -

In this module

- -
    -
  1. Cascade and inheritance
  2. -
  3. CSS selectors - -
  4. -
  5. The box model
  6. -
  7. Backgrounds and borders
  8. -
  9. Handling different text directions
  10. -
  11. Overflowing content
  12. -
  13. Values and units
  14. -
  15. Sizing items in CSS
  16. -
  17. Images, media, and form elements
  18. -
  19. Styling tables
  20. -
  21. Debugging CSS
  22. -
  23. Organizing your CSS
  24. -
diff --git a/files/ar/learn/css/building_blocks/selectors/type_class_and_id_selectors/index.html b/files/ar/learn/css/building_blocks/selectors/type_class_and_id_selectors/index.html deleted file mode 100644 index 749f576534..0000000000 --- a/files/ar/learn/css/building_blocks/selectors/type_class_and_id_selectors/index.html +++ /dev/null @@ -1,119 +0,0 @@ ---- -title: 'Type, class, and ID selectors' -slug: Learn/CSS/Building_blocks/Selectors/Type_Class_and_ID_Selectors -translation_of: Learn/CSS/Building_blocks/Selectors/Type_Class_and_ID_Selectors ---- -

{{LearnSidebar}}{{PreviousMenuNext("Learn/CSS/Building_blocks/Selectors", "Learn/CSS/Building_blocks/Selectors/Attribute_selectors", "Learn/CSS/Building_blocks")}}

- -

In this lesson we will take a look at the simplest selectors that are available, which you will probably use the most in your work.

- - - - - - - - - - - - -
Prerequisites:Basic computer literacy, basic software installed, basic knowledge of working with files, HTML basics (study Introduction to HTML), and an idea of how CSS works (study CSS first steps.)
Objective:To learn about the different CSS selectors we can use to apply CSS to a document.
- -

Type selectors

- -

A type selector is sometimes referred to as a tag name selector or element selector, because it selects an HTML tag/element in your document. In the example below we have used the span, em and strong selectors. All instances of <span>, <em> and <strong> elements are therefore styled accordingly.

- -

Try adding a CSS rule to select the <h1> element and change its color to blue.

- -

{{EmbedGHLiveSample("css-examples/learn/selectors/type.html", '100%', 1100)}}

- -

The universal selector

- -

The universal selector is indicated by an asterisk (*) and selects everything in the document (or inside the parent element if it is being chained together with another element and a descendant combinator). In the following example we have used the universal selector to remove the margins on all elements. This means that instead of the default styling added by the browser, which spaces out headings and paragraphs with margins, everything is close together and we can't see the different paragraphs easily.

- -

{{EmbedGHLiveSample("css-examples/learn/selectors/universal.html", '100%', 750)}}

- -

This kind of behavior can sometimes be seen in "reset stylesheets", which strips out all of the browser styling. Since the universal selector makes global changes, we use it to deal with very specific situations such as the one outlined below.

- -

Using the universal selector to make your selectors easier to read

- -

One use of the universal selector is to make selectors easier to read and more obvious in terms of what they are doing. For example, if I wanted to select the first child of any descendant element of <article> , no matter what element it was, and make it bold, I could use the {{cssxref(":first-child")}} selector, which we will learn more about in the lesson on pseudo-classes and pseudo-elements, as a descendant selector along with the <article> element selector: 

- -
article :first-child {
-
-}
- -

This could be confused however with article:first-child, which will select any <article> element that is the first child of another element.

- -

To avoid this confusion we can add the universal selector to the :first-child selector, so it is obvious what the selector is doing. It is selecting any element which is the first-child of any descendant element of <article>:

- -
article *:first-child {
-
-} 
- -

Although both do the same thing, the readability is significantly improved.

- -

Class selectors

- -

The class selector starts with a full stop (.) character and will select everything in the document with that class applied to it. In the live example below we have created a class called .highlight, and have applied it to several places in my document. All of the elements that have the class applied are highlighted.

- -

{{EmbedGHLiveSample("css-examples/learn/selectors/class.html", '100%', 750)}}

- -

Targeting classes on particular elements

- -

You can create a selector that will target specific elements with the class applied. In this next example we will highlight a <span> with a class of highlight differently to an <h1> heading with a class of highlight. We do this by using the type selector for the element I want to target, with the class appended using a dot, with no white space in between.

- -

{{EmbedGHLiveSample("css-examples/learn/selectors/class-type.html", '100%', 750)}}

- -

This approach reduces the scope of a rule as the rule will only apply to that particular element  & class combination; so you would need to add another selector if you decided the rule should apply to other elements too.

- -

Target an element if it has more than one class applied

- -

You can apply multiple classes to an element and target them individually, or only select the element when all of the classes in the selector are present. This can be helpful when building up components that can be combined in different ways on your site.

- -

In the example below we have a <div> that contains a note. The grey border is applied when the box has a class of notebox. If it also has a class of warning or danger, we change the {{cssxref("border-color")}}.

- -

We can tell the browser that we only want to match the element if it has two classes applied by chaining them together with no white space between them. You'll see that the last <div> doesn't get any styling applied, as it only has the danger class; it needs notebox as well to get anything applied.

- -

{{EmbedGHLiveSample("css-examples/learn/selectors/class-many.html", '100%', 900)}}

- -

ID Selectors

- -

An ID selector begins with a # rather than a full stop character, but is basically used in the same way as a class selector. An ID however can be used only once per document. It can select an element that has the id set on it, and you can precede the ID with a type selector to only target the element if both the element and ID match. You can see both of these uses in the following example:

- -

{{EmbedGHLiveSample("css-examples/learn/selectors/id.html", '100%', 750)}}

- -
-

Note: As we learned in the lesson on specificity, an ID has high specificity and will overrule most other selectors. This can make them difficult to deal with. In most cases it is preferable to add a class to the element rather than use an ID, however if using the ID is the only way to target the element — perhaps because you do not have access to the markup and so cannot edit it — this will work.

-
- -

In the next article

- -

We'll continue exploring selectors by looking at attribute selectors.

- -

{{PreviousMenuNext("Learn/CSS/Building_blocks/Selectors", "Learn/CSS/Building_blocks/Selectors/Attribute_selectors", "Learn/CSS/Building_blocks")}}

- -

In this module

- -
    -
  1. Cascade and inheritance
  2. -
  3. CSS selectors - -
  4. -
  5. The box model
  6. -
  7. Backgrounds and borders
  8. -
  9. Handling different text directions
  10. -
  11. Overflowing content
  12. -
  13. Values and units
  14. -
  15. Sizing items in CSS
  16. -
  17. Images, media, and form elements
  18. -
  19. Styling tables
  20. -
  21. Debugging CSS
  22. -
  23. Organizing your CSS
  24. -
diff --git a/files/ar/learn/css/css_layout/index.html b/files/ar/learn/css/css_layout/index.html deleted file mode 100644 index a0fadc9403..0000000000 --- a/files/ar/learn/css/css_layout/index.html +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: تخطيط التصميم في CSS -slug: Learn/CSS/CSS_layout -tags: - - Beginner - - CSS - - Floating - - Grids - - Guide - - Landing - - Layout - - Learn - - Module - - Multiple column - - NeedsTranslation - - Positioning - - TopicStub - - alignment - - flexbox - - float - - table -translation_of: Learn/CSS/CSS_layout ---- -
{{LearnSidebar}}
- -

At this point we've already looked at CSS fundamentals, how to style text, and how to style and manipulate the boxes that your content sits inside. Now it's time to look at how to place your boxes in the right place in relation to the viewport, and one another. We have covered the necessary prerequisites so we can now dive deep into CSS layout, looking at different display settings, modern layout tools like flexbox, CSS grid, and positioning, and some of the legacy techniques you might still want to know about.

- -

Prerequisites

- -

Before starting this module, you should already:

- -
    -
  1. Have basic familiarity with HTML, as discussed in the Introduction to HTML module.
  2. -
  3. Be comfortable with CSS fundamentals, as discussed in Introduction to CSS.
  4. -
  5. Understand how to style boxes.
  6. -
- -
-

Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin or Thimble.

-
- -

Guides

- -

These articles will provide instruction on the fundamental layout tools and techniques available in CSS. At the end of the lessons is an assessment to help you check your understanding of layout methods, by laying out a webpage.

- -
-
Introduction to CSS layout
-
This article will recap some of the CSS layout features we've already touched upon in previous modules — such as different {{cssxref("display")}} values — and introduce some of the concepts we'll be covering throughout this module.
-
Normal Flow
-
Elements on webpages lay themselves out according to normal flow - until we do something to change that. This article explains the basics of normal flow as a grounding for learning how to change it.
-
Flexbox
-
Flexbox is a one-dimensional layout method for laying out items in rows or columns. Items flex to fill additional space and shrink to fit into smaller spaces. This article explains all the fundamentals.
-
Grids
-
CSS Grid Layout is a two-dimensional layout system for the web. It lets you lay content out in rows and columns, and has many feature that make building complex layouts straightforward. This article will give you all you need to know to get started with page layout.
-
Floats
-
Originally for floating images inside blocks of text, the {{cssxref("float")}} property became one of the most commonly used tools for creating multiple column layouts on webpages. With the advent of Flexbox and Grid it has now returned to its original purpose, as this article explains.
-
Positioning
-
Positioning allows you to take elements out of the normal document layout flow, and make them behave differently, for example sitting on top of one another, or always remaining in the same place inside the browser viewport. This article explains the different {{cssxref("position")}} values, and how to use them.
-
Multiple-column layout
-
The multiple-column layout specification gives you a method of laying content out in columns, as you might see in a newspaper. This article explains how to use this feature.
-
Legacy layout methods
-
Grid systems are a very common feature used in CSS layouts, and before CSS Grid Layout they tended to be implemented using floats or other layout features. You imagine your layout as a set number of columns (e.g. 4, 6, or 12), and then fit your content columns inside these imaginary columns. In this article we'll explore how these older methods work, in order that you understand how they were used if you work on an older project.
-
Supporting older browsers
-
-

In this module we recommend using Flexbox and Grid as the main layout methods for your designs. However there will be visitors to your site who use older browsers, or browsers which do not support the methods you have used. This will always be the case on the web — as new features are developed, different browsers will prioritise different things. This article explains how to use modern web techniques without locking out users of older technology.

-
-
Fundamental Layout Comprehension
-
An assessment to test your knowledge of different layout methods by laying out a  webpage.
-
- -

See also

- -
-
Practical positioning examples
-
This article shows how to build some real world examples to illustrate what kinds of things you can do with positioning.
-
-
diff --git a/files/ar/learn/css/first_steps/how_css_is_structured/index.html b/files/ar/learn/css/first_steps/how_css_is_structured/index.html deleted file mode 100644 index 53b455f460..0000000000 --- a/files/ar/learn/css/first_steps/how_css_is_structured/index.html +++ /dev/null @@ -1,179 +0,0 @@ ---- -title: Readable CSS -slug: Learn/CSS/First_steps/How_CSS_is_structured -translation_of: Learn/CSS/Introduction_to_CSS/Syntax#Beyond_syntax_make_CSS_readable -translation_of_original: Web/Guide/CSS/Getting_started/Readable_CSS -original_slug: Web/Guide/CSS/Getting_started/Readable_CSS ---- -

{{ CSSTutorialTOC() }}

- -

{{ previousPage("/en-US/docs/Web/Guide/CSS/Getting_Started/Selectors", "Selectors")}}This is the 6th section of the CSS Getting Started tutorial; it discusses the style and grammar of the CSS language itself. You change the way your sample CSS file looks, to make it more readable.

- -

معلومة: CSS مقروء (قابل للقراءة = سهل القراءة)

- -

يمكنك إضافة مساحات فارغة وأيضا تعليقات داخل ملف النمط لجعل الشيفرة البرمجية (code) أكثر قابلية وسهولة للقراءة. أيضا يمكنك تجميع العناصر المختلفة معا عندما تتطابق الخصائص بينهم.

- -

المساحة الفارغة

- -

المساحة الفارغة أوالبيضاء هي عبارة عن مسافات قد تكون مسافة من خطوة واحدة أو من عدة خطوات وقد تكون عبارة عن سطر جديد. يمكنك إضافة المساحات البيضاء إلى ملف النمط الخاص بك لجعله أكثر قابلية وسهولة للقراءة.

- -

في سياق تخطيط وتكوين الصفحة، المساحات الفارغة تكون جزءًا من الصفحة كمسافات بين الأعمدة والسطور أو كهوامش.

- -

يحتوي ملف النمط الخاص بك حاليا على قاعدة واحدة لكل سطر، وعدد أدنى من المساحات الفارغة أو البيضاء. في الأنماط المعقدة سيكون من الصعب قراءة ملف النمط، مما يجعل من الصعب الحفاظ عليها.

- -

التخطيط دائما ما يكون شَخْصِـيًّا، ولكن إذا كان ملف النمط بين مجموعة من الأفراد بصفته جزءً من مشاريع مشتركة، من المحتمل أن تلك المشاريع تحمل اتفاقيات خاصة بها يتم الأعتماد عليها والعمل بها.

- -

 

- -
-
Examples
- -

بعض الأشخاص يفضلون دمج الخصائص مع بعضها، فقط يقومون بتقسيم الخط عندما يصبح طويلا جدا:

- -

.carrot {color: orange; text-decoration: underline; font-style: italic;}

- -


- بعض الناس يفضلون خاصية واحدة لكل سطر:

- -
.carrot
-{
-color: orange;
-text-decoration: underline;
-font-style: italic;
-}
-
- -

بعض الأشخاص يستخدمون مسافتين أو أربع أو علامة التبويب الشائعة:

- -
.carrot {
-  color: orange;
-  text-decoration: underline;
-  font-style: italic;
-}
-
- -


- (بعض الأشخاص يفضلون جعل كل شيء عموديا  (ولكن تخطيط مثل هذا من الصعب الحفاظ عليه.

- -
.carrot
-    {
-    color           : orange;
-    text-decoration : underline;
-    font-style      : italic;
-    }
-
- -

بعض الأشخاص يستخدمون مزيج من المسافات الفارغة أو البيضاء لتعزيز سهولة القراءة.

- -
.vegetable         { color: green; min-height:  5px; min-width:  5px }
-.vegetable.carrot  { color: orange;    height: 90px;     width: 10px }
-.vegetable.spinach { color: darkgreen; height: 30px;     width: 30px }
-
-
- -

بعض الأشخاص يستخدمون علامة التبويب والبعض الآخر يستخدم فقط المسافات البيضاء.

- -

التعليقات
-  

- -

التعليقات في ملف النمط تبدأ بـ «*/» وتنتهي بـ«/*».
-
- يمكنك استخدام التعليقات في ملف النمط الخاص بك لكتابة تعليقات وتعليمات، وأيضا لكتابة تعليمات مؤقتة قد يكون الغرض منها هو اختبار العملية.
-
- التعليق في جزء من النمط، ضع هذا الجزء في تعليق بحيث يتجاهله المتصفح عند قراءة الملف، وكن حذرا في بداية ونهاية التعليق. بقية الأنماط والخصائص يجب أن يكون لها البنية الصحيحة.

- -
-
Example
- -
/* style for initial letter C in first paragraph */
-.carrot {
-  color:            orange;
-  text-decoration:  underline;
-  font-style:       italic;
-  }
-
-
- -

تجميع العناصر
-
- عندما يكون لمجموعة من العناصر عدد من الخصائص المتشابهة في النمط، يمكنك تجميع العناصر مع الفصل بينهم بعلامة فاصلة. وتـنطبق هذة الخصائص على جميع العناصر المجمعة.
-  

- -

في أماكن أخرى من ملف النمط يمكنك أيضا تجميع عدد من العناصر ولكن فرديا، وتطبيق خصائص فردية عليهم.

- -
-
Example
- -

This rule makes {{ HTMLElement("h1") }}, {{ HTMLElement("h2") }}, and {{ HTMLElement("h3") }} elements the same color.

- -

إنها مناسبة لتحديد اللون لمجموعة من العناصر في مكان واحد، في حالة لابد من تغييرها.

- -
/* color for headings */
-h1, h2, h3 {color: navy;}
-
-
- -

العمل: إضافة تعليقات و تحسين التخطيط

- -
    -
  1. قم بتعديل ملف النمط الخاص بك، وقم بالتأكد أن لديها هذه القواعد في ذلك (في أي أمر): -
    strong {color: red;}
    -.carrot {color: orange;}
    -.spinach {color: green;}
    -#first {font-style: italic;}
    -p {color: blue;}
    -
    -
  2. -
  3. جعلها أكثر قابلية للقراءة من خلال إعادة ترتيبها بطريقة منطقية، وذلك من خلال إضافة مساحات بيضاء أو فارغة وأيضا تعليقات مناسبة.
  4. -
  5. قم بحفظ التعديلات واذهب إلى المتصفح لتشاهد الصفحة للتَّـأكد أنه لا يوجد أي تأثير على ملف النمط من خلال عمله. - - - - - - - - - -
    Cascading Style Sheets
    Cascading Style Sheets
    -
  6. -
- -
-
تحدي
- -
 
- -

ضع تعليقا يوجد به جزء من ملف النمط الخاص بك، بدون  تغيير أي شيء آخر ، لعمل أول حرف من الوثيقة أحمر اللون.

- - - - - - - - - - -
Cascading Style Sheets
Cascading Style Sheets
- -

(هناك العديد من الطرق لفعل ذلك)

- -
-
Possible solution
- -

One way to do this is to put comment delimiters around the rule for .carrot:

- -
/*.carrot {
-  color: orange;
-}*/
- -

Hide solution

-
- -

See a solution for the challenge.

-
- -

ما التالي؟

- -

{{ nextPage("/en-US/docs/Web/Guide/CSS/Getting_Started/Text_styles", "Text styles") }}Your sample stylesheet has used italic text and underlined text. The next page describes more ways to specify the appearance of text in your document.

diff --git a/files/ar/learn/css/first_steps/index.html b/files/ar/learn/css/first_steps/index.html deleted file mode 100644 index 34b8e9fefb..0000000000 --- a/files/ar/learn/css/first_steps/index.html +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: CSS first steps -slug: Learn/CSS/First_steps -translation_of: Learn/CSS/First_steps ---- -
{{LearnSidebar}}
- -

CSS (Cascading Style Sheets) is used to style and lay out web pages — for example, to alter the font, color, size, and spacing of your content, split it into multiple columns, or add animations and other decorative features. This module provides a gentle beginning to your path towards CSS mastery with the basics of how it works, what the syntax looks like, and how you can start using it to add styling to HTML.

- -

Prerequisites

- -

Before starting this module, you should have:

- -
    -
  1. Basic familiarity with using computers, and using the Web passively (i.e. looking at it, consuming the content.)
  2. -
  3. A basic work environment set up as detailed in Installing basic software, and an understanding of how to create and manage files, as detailed in Dealing with files.
  4. -
  5. Basic familiarity with HTML, as discussed in the Introduction to HTML module.
  6. -
- -
-

Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin or Thimble.

-
- -

Guides

- -

This module contains the following articles, which will take you through all the basic theory of CSS, and provide opportunities for you to test out some skills.

- -
-
What is CSS?
-
{{Glossary("CSS")}} (Cascading Style Sheets) allows you to create great-looking web pages, but how does it work under the hood? This article explains what CSS is, with a simple syntax example, and also covers some key terms about the language.
-
Getting started with CSS
-
In this article we will take a simple HTML document and apply CSS to it, learning some practical things about the language along the way.
-
How CSS is structured
-
Now that you have an idea about what CSS is and the basics of using it, it is time to look a little deeper into the structure of the language itself. We have already met many of the concepts discussed here; you can return to this one to recap if you find any later concepts confusing.
-
How CSS works
-
We have learned the basics of CSS, what it is for and how to write simple stylesheets. In this lesson we will take a look at how a browser takes CSS and HTML and turns that into a webpage.
-
Using your new knowledge
-
With the things you have learned in the last few lessons you should find that you can format simple text documents using CSS, to add your own style to them. This article gives you a chance to do that.
-
- -

See also

- -
-
Intermediate Web Literacy 1: Intro to CSS
-
An excellent Mozilla foundation course that explores and tests a lot of the skills talked about in the Introduction to CSS module. Learn about styling HTML elements on a webpage, CSS selectors, attributes, and values.
-
diff --git a/files/ar/learn/css/index.html b/files/ar/learn/css/index.html deleted file mode 100644 index 3a56c01335..0000000000 --- a/files/ar/learn/css/index.html +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: CSS -slug: Learn/CSS -tags: - - Beginner - - CSS - - CodingScripting - - Debugging - - Landing - - NeedsContent - - NeedsTranslation - - Topic - - TopicStub - - length - - specificity -translation_of: Learn/CSS ---- -

الترجمة الحرفية للـ {{glossary("CSS")}} لن تفيدك كثيراً ولكن من باب العلم بها فمعناها (أوراق النمط المتعاقب)، لكن دعنا نتعرف أكثر ما هي الـ CSS وما الذي تقوم به، هي التقنية الأولى من تقنيات الويب التي يجب أن تبدأ بها رحلتك في تعلم تطوير الويب، في حين تقوم بإستخدام الـ HTML في إنشاء العناصر الأساسية للصفحة (هيكلة صفحة الويب)، تقوم بإستخدام الـ CSS في إضفاء الشكل الجمالي لصفحات الويب من خلال إضافة الألوان والمساحات وأماكن العناصر المختلفة، أو إضافة تأثيرات الحركة على بعض العناصر في صفحة الويب.

- -

مسار التعلم المتبع

- -

يجب عليك تعلم اساسيات HTML أولاً قبل الشروع في تعلم الـ CSS، فكيف تقوم بإضافة الجماليات على صفحة ويب لم يتم إنشاءها بعد؟ لذلك ننصحك بتعمل أساسيات الـ HTML من هنا مقدمة في الـ HTML بعد ذلك يمكنك تعلم:

- - - -

مباشرةً عندما تجد نفسك مستوعباً لأساسيات الـ HTML, ننصحك بتعلم الـ HTML والـ CSS بشكل متزامن (في نفس الوقت) لانك غالباً ستحتاج إلى تطوير نفسك في كليهما بشكل مستمر. وأيضاً لان الـ HTML شيقة في التعلم لسهولة تطبيقها خلال رحلة تعلمك، وستجد أنك تستوعبها سريعاً، وستجد أيضاً انها اكثر متعه عندما تقوم بتطبيق ما تعلمته من الـ CSS. وتذكر دائماً انك لن تستطيع تعلم الـ CSS بدون معرفة الـ HTML.

- -

قبل البداية في تعمل هذه التقنية، لابد من تعلم أساسيات التعامل مع الحاسب وإستخدام الويب، أيضاً لابد من تهيئة بيئة العمل التي تحتاجها لإنشاء صفحات الويب كما تم شرحها في تنصيب البرامج المستخدمة في بيئة العمل، وكيفية إنشاء وإدارة الملفات كما تم شرحنا في التعامل مع الملفات، هذين المقالين أجزاء من ملف شرح البداية في تعلم الويب للمبتدئين.

- -

وننصحك أيضاً أن تقوم بتعلم البداية في تعلم الويب قبل الشروع في هذا المقال، على كل حال هذا ليس ضرورياً للغاية، كثيرا مما تم شرحه في أساسيات CSS تم شرحه أيضاً في مقدمة CSS ولكن بشكل أكثر تفصيلاً.

- -

العناصر

- -

هذا الموضوع يحتوى على العناصر التالية، نقترح عليك أن تبدأ في تعلمهم بهذا الترتيب، ويجب عليك بشكل مؤكد أن تبدأ بالعنصر الأول لأهميته.

- -
-
مقدمة في CSS
-
في هذا الجزء سنبدأ في تعلم أساسيات كيفية عمل الـ CSS وسنقوم بشرح المحددات (Selectors) والخصائص (Properties) وكيفية كتاب قواعد الـ CSS وكيفية تطبيق CSS على عناصر HTML، كيف تحدد الطول واللون والوحدات الأخرى في CSS وسنقوم أيضاً بشرح وراثة القيم وأساسيات العناصر الأساسية في الصفحة (Box Model) وكيفية معالجة الأخطاء في CSS.
-
تنسيق/شكل الخطوط
-
هنا ، ننظر إلى أساسيات تصميم النصوص ، بما في ذلك ضبط الخط ، السماكة ، والميول ; الخط والمسافات بين الحروف 
-
هنا نلقي نظرة على أساسيات تصميم النص ، بما في ذلك تعيين الخط والخط الجريء والخط المائل وتباعد الأسطر والحروف والظلال المسقطة وميزات النص الأخرى. ننهي الوحدة من خلال النظر في تطبيق الخطوط المخصصة على صفحتك وقوائم التصميم والروابط.
-
Styling boxes
-
بعد ذلك ، نلقي نظرة على مربعات التصميم ، وهي إحدى الخطوات الأساسية نحو تخطيط صفحة الويب. في هذه الوحدة ، نلخص نموذج الصندوق ثم ننظر إلى التحكم في تخطيطات الصندوق عن طريق تعيين المساحة المتروكة والحدود والهوامش ، وتعيين ألوان خلفية مخصصة وصور وميزات أخرى ، وميزات فاخرة مثل الظلال المسقطة والمرشحات على الصناديق.
-
CSS layout
-
في هذه المرحلة ، اطلعنا بالفعل على أساسيات CSS ، وكيفية تصميم النص ، وكيفية تصميم ومعالجة المربعات الموجودة في المحتوى الخاص بك. حان الوقت الآن للنظر في كيفية وضع مربعاتك في المكان المناسب بالنسبة إلى إطار العرض ، وبعضها البعض. لقد قمنا بتغطية المتطلبات الأساسية اللازمة حتى تتمكن الآن من التعمق في تخطيط CSS ، والنظر في إعدادات العرض المختلفة ، وطرق التخطيط التقليدية التي تتضمن العوامة وتحديد المواقع ، وأدوات التخطيط الجديدة المتشعبة مثل flexbox.
-
Responsive design (TBD)
-
مع وجود العديد من الأنواع المختلفة من الأجهزة التي يمكنها تصفح الويب هذه الأيام ،responsive web design (RWD) أصبحت مهارة تطوير الويب الأساسية. ستغطي هذه الوحدة المبادئ والأدوات الأساسية لـ RWD ، وتشرح كيفية تطبيق CSS مختلفة على مستند اعتمادًا على ميزات الجهاز مثل عرض الشاشة ، والتوجيه ، والدقة ، واستكشاف التقنيات المتاحة لتقديم الفيديو والصور المختلفة اعتمادًا على هذه الميزات.
-
- -

Solving common CSS problems

- -

Use CSS to solve common problems provides links to sections of content explaining how to use CSS to solve very common problems when creating a webpage.

- -

See also

- -
-
CSS on MDN
-
The main entry point for CSS documentation on MDN, where you'll find detailed reference documentation for all features of the CSS language. Want to know all the values a property can take? This is a good place to go.
-
diff --git a/files/ar/learn/css/styling_text/styling_lists/index.html b/files/ar/learn/css/styling_text/styling_lists/index.html deleted file mode 100644 index aedafbd023..0000000000 --- a/files/ar/learn/css/styling_text/styling_lists/index.html +++ /dev/null @@ -1,385 +0,0 @@ ---- -title: القوائم -slug: Learn/CSS/Styling_text/Styling_lists -translation_of: Learn/CSS/Styling_text/Styling_lists -translation_of_original: Web/Guide/CSS/Getting_started/Lists -original_slug: Web/Guide/CSS/Getting_started/القوائم ---- -

{{ CSSTutorialTOC() }}

- -

 الصفحة السابقة هي ("/en-US/docs/Web/Guide/CSS/Getting_Started/Content", "Content") أما هذا الجزء فهو العاشِر في سلسلة  تعليم لغة CSS على هذا الموقع  CSS Getting Started، وهو يصف كيف يُمكن استخدام لغة الـCSS لتحديد مظهر القائمة. ستقوم بإنشاء مثال مستند يحتوي على قائمة بالـHTML  وملف تنسيق بلغة الـCSS والذي من خلاله سوف نقوم بتنسيق القائمة التي قمنا بإنشَائها. 

- -

معلومات عن القوائم 

- -

لو نظرت إلى الجزء السابق، سوف يتضح لك  كيف يمكن إضافة محتـوًى قبل أي عنصر بحيث يظهر وكأنّه عنصرٌ في قائمة.

- -

تقدم لغة الـCSS بعض الخواص المُصَمَّـمَـة للقائمة، والتي يجب استخدامها دائما مع القوائم.

- -

لتحديد نمط القائمة، عليك استخدام هذه الخاصية «list-style» وذلك لتحديد نوع  العلامة الموجودة قبل كل عنصر في القائمة. 

- -
-

من الممكن أن يتم اختيار القائمة ككل بهذا الوسم «ul» أو اختيار عنصر بداخل القائمة من خلال هذا الوسم «li».  

- -

وعند اختيار القائمة ككل فإنَّ هذا الوسم يسمى الأب للقائمة وهو«ul»، ويورث الخواص التى تٌطبق عليه لكُـلِّ عنصر في القائمة. 

-
- -

القوائم غير المرتبة

- -

 في القوائم غير المُرَتَّـبة، يكون كل عنصر من القائمة معَلَّــمًا بنفس الطريقة. 

- -

 يوجد ثلاثة أنواع من العلامات، وأدناه هي كيفية عرض المتصفح لهذه العلامات:

- -

• disc  قرص 

- -

○ circle دائرة

- -

◘ square مربع

- -

بدلا من ذلك، يمكن تحديد رابط صورة لاستخدامها كعلامة للعناصر بدل من العلامات السابقة.

- -
-

مثال 

- -

 هذه القواعد تُـوَضِّح علامات مختلفة لأصناف (classes) مختلفة من عناصر القائمة:

- -
li.open {
-    list-style: circle;
-}
-li.closed {
-    list-style: disc;
-}
-
- -

عندما يتم استعمال هذه الأصناف (classes) في قائمة، تقوم بالتمييز بين العناصر المفتوحة والمغلقة (مثلًا في قائمة مهامّ).

- -
<ul>
-  <li class="open">Lorem ipsum</li>
-  <li class="closed">Dolor sit</li>
-  <li class="closed">Amet consectetuer</li>
-  <li class="open">Magna aliquam</li>
-  <li class="closed">Autem veleum</li>
-</ul>
-
- -

وهكذا تبدو النتيجة: 

- -
  ○ Lorem ipsum
- -
  •  Dolor sit
- -
  •  Amet consectetuer
- -
  ○ Magna aliquam
- -
  • Autem veleum
- -
 
-
- -

القوائم المُـرَتَّـبة 

- -

في القوائم المُرتّبة، يكون لكل عنصر علامة مختلفة تُميّز موضعه في القائمة.

- -

استخدم الخاصية «list-style» لتعيين نمط القائمة، لتحديد نوع العلامة التي تظهر قبل كل عنصرفي القائمة.

- -
    -
  • decimal (تعداد بأرقام عشرية)
  • -
  • lower-roman (تعداد بحروف رومانية صغيرة)
  • -
  • upper-roman (تعداد بحروف رومانية كبيرة)
  • -
  • lower-latin (تعداد بحروف لاتيتنية صغيرة)
  • -
  • upper-latin (تعداد بحروف لاتينية كبيرة)
  • -
- -
-
 
- -

مثال                                                                                                                                              

- -
القاعدة التّالية تجعل العناصر في القائمة المرتّبة <ol> والتي تٌميز بصنف .«info» مُرتبة بحروف لاتينية كبيرة.  
- -
 
- -
<ol class="info">
-  <li>Lorem ipsum</li>
-  <li>Dolor sit</li>
-  <li>Amet consectetuer</li>
-  <li>Magna aliquam</li>
-  <li>Autem veleum</li>
-</ol>
- -
ol.info {
-    list-style: upper-latin;
-}
-
- -
-

عند تطبيق خاصية النمط على الـ «ol»  يُوَرِّثُ هذه الخاصية إلى الأبناء وهم عناصر القائمة المرتبة وهي العناصر المسبوقة بوسم «li».

-
- -

فتكون النتيجة كالتالي:

- -
ِA. Lorem ipsum
- -
B. Dolor sit
- -
C. Amet consectetuer
- -
D. Magna aliquam
- -
E. Autem veleum
-
- -
-
-

تفاصيل أكثر                                                                             

- -
الخاصية «list-style» هي خاصية مختصرة أي أنه من الممكن استخدامها إذا أردت أن يكون نمط القائمة سواء كان 
- -
 (صورة أو رقم أو شكل أو حرف )
- -
       ولكن يمكن أن تستخدم خواص منفردة لكل شكل على حدة وليكن للصورة لها  خاصية محددة مثل «list-style-image»    
- -

يمكنك مراجعة هذه الخاصية وما بها من تفاصيل من خلال هذه الصفحة  list style 

- -
إن كنت تستخدم لغة HTML فإنها تُـوفر وسوما مُختلفة، فعلى سبيل المثال  للقوائم المرتبة يُستخدم هذا الوسم «ol»
- -
والقوائم  الغير مرتبة «ul»
- -
  فيفضّل استخدام هذه القوائم بحسب دلالتها ولكن من الممكن إذا أردت أن تجعل القوائم المرتبة كغير المرتبة شكلا 
- -
والعكس، فذلك يتم من خلال الـCSS أيضا يتم كل هذا باستخدام الخواص المختلفة لتحصل على ما تريد من نتائج 
- -
ولكن يُفَضَّـل أن تُسْتَخدم كل قائمة حسب وضعها والاستخدام الخاص بها. 
- -
 
- -

قد تختلف المتصفّحات في طرق عرضها لتنسيق القوائم، لا يُمكن أن تحصُل على نفس النتيجة في كل المتصفحات. 

-
-
- -

العَـدَّادَات

- -
-

ملاحظة هامّة:

- -
  بعض المتصفحات لا تدعم العدّادات، تقدّم هذه الصّفحة CSS contents and browser comptability على موقع QuirksMode معلومات تفصيلية عن دعم  المتصفحات لهذه الميزة وميزات أخرى.
- -
كما توفّر الصّفحات الفرديّة في CSS مرجعا للمعلومات عن دعم  المتصفحات أيضا لهذه الخاصية وغيرها.
-
- -

 

- -
يُمكن استخدام العدّادات لعدّ أيّة عناصر، وليس فقط عناصر القوائم، فمثلًا يمكن عدّ العناوين والفقرات في المستند.
- -
تحتاج إلى إنشاء عدّاد counter باسم خاص بك لتستخدمه فى العّد.
- -
 
- -
 يمكن تهيئة العدّاد قبل البدء بالعدّ باستخدام الخاصية «counter-reset» واسم العدادَ الخاص بك الذي أنشأته. 
- -
وعليك أن تعلم أن الأب للعنصر الذي تقوم بِعده هو المكان الأنسب لتهيئة العّداد، ولكن يمكن استخدام أي عنصر يأتي قبل العناصر المطلوب عدّها.
- -
 
- -
 في كلّ عنصر ترغب بعدّه، استخدم الخاصية «counter-increment» مع اسم العّداد الذي تٌريده.
- -
 استخدم «befor» ،«:after:» لعرض العدّاد، مع استخدام هذه الخاصية «content» مع العنصر المٌحدد المُراد عّده (سيتم شرح ذلك لاحقاَ).
- -
يمكنك معرفة معلومات أكثر عن هذه الخاصية في هذه الصفحة Content
- -
 
- -

استخدام ()counter مع اسم العّداد كقيمة لـcontent   

- -
ويمكن كذلك استخدام نوع للعلامة فى العد. الأنواع المُتاحة هي التي تم عرضها في فقرة القوائم المرتّبة.
- -

عادةً يزيد العنصر الّذي يعرض العدّاد من قيمته. 

- -
-
          مثال                                                                                                                                            
- -
 
- -
    هذه القاعدة تُنشئ عدّادًا لكلّ عنصر<h3> له تصنيف (كلاس) «numbered»:                                          
- -
h3.numbered {
-    counter-reset: mynum;
-}
-
- -

 أما هذه القاعدة فهى تعرض عّداد الـ <p>  والتي لها تصنيف «numbered»

- -
<p class="numbered">Lorem ipsum</p>
-<p class="numbered">Dolor sit</p>
-<p class="numbered">Amet consectetuer</p>
-<p class="numbered">Magna aliquam</p>
-<p class="numbered">Autem veleum</p>
-
- -
body {
-   counter-reset: mynum;
-}
-p.numbered:before {
-  content: counter(mynum) ": ";
-  counter-increment: mynum;
-  font-weight: bold;
-}
-
- -

والنتيجة ستبدُو هكذا:

- -
1: Lorem ipsum
- -
2: Dolor sit
- -
3: Amet consectetuer
- -
4: Magna aliquam
- -
5:  Autem veleum
- -
 
-
- -
-
تفاصِيل أكثر                                                                                                                                 
- -
 
- -
   لا تستطيع استخدام العَدادات إلا إذا تيقنت من أنَ كل شخص يستخدم العدادات يستعمل  متصفحاً يُدعمها.  
- -
  العًدادات بها مِيزات ويمكن تنسيقها منفصلة عن عنصر القَائمة المرافِقة لها كما في المثال السابق 
- -
ترى أن العًدادات لها تنسيق خاص فهي بِخط عريض غير عناصر القّائمة.  
- -
 
- -
يمكن أيضًا استخدام العدّادات بطرق أكثر تعقيدًا؛ مثلًا: لعدّ الفقرات والعناوين والعناوين الفرعيّة والفقرات في المستندات الرسمية.
- -
 ولتفاصِيل أكثر عليك الرجوع إلى هذِه الصفحة  Automatic counters and numbering.
-
- -

تمرين: قوائم مُنسقة

- -

   قم بإنشاء ملف  HTML  باسم doc2.html، انسخ والصق هذا المحتوى إلى الملف الخاص بك:

- -
<!DOCTYPE html>
-<html>
-  <head>
-    <meta charset="UTF-8">
-    <title>Sample document 2</title>
-    <link rel="stylesheet" href="style2.css">
-  </head>
-  <body>
-
-    <h3 id="oceans">The oceans</h3>
-    <ul>
-      <li>Arctic</li>
-      <li>Atlantic</li>
-      <li>Pacific</li>
-      <li>Indian</li>
-      <li>Southern</li>
-    </ul>
-
-    <h3 class="numbered">Numbered paragraphs</h3>
-    <p class="numbered">Lorem ipsum</p>
-    <p class="numbered">Dolor sit</p>
-    <p class="numbered">Amet consectetuer</p>
-    <p class="numbered">Magna aliquam</p>
-    <p class="numbered">Autem veleum</p>
-
-  </body>
-</html>
-
- -

  قم بإنشاء ملف CSS وقُم بتسميته  style2.css، انسخ والصق هذه الشيفرة البرمجية إلى صفحتك:

- -
/* numbered paragraphs */
-h3.numbered {counter-reset: mynum;}
-
-p.numbered:before {
-  content: counter(mynum) ": ";
-  counter-increment: mynum;
-  font-weight: bold;
-}
-
- -

قم بتغيير أسلوب  التعليقات كما تحبّ إن لم يعجبك هذا.

- -

افتح الملف على المٌتصفح الخاص بِك. إذا كان متصفحط يَدعم العّدادات سوف ترى النتيجة كما هي موضحة أدناه، وإن لم يكُن يُدعمها فلن ترى إلاَّ الأرقام والنُقتطان قبل القائمة التي هي بعنوان «Numbered paragraphs» :

- -

The oceans

- -
Arctic
- -
Atlantic
- -
Pacific
- -
Indian
- -
Southern
- -

Numbered paragraphs

- -
1:Lorem ipsum
- -
2:Dolor sit
- -
3:Amet consectetuer
- -
4:Magna aliquam
- -
5:Autem veleum
- -
-
 تمرين إضافي                                                                                                                                          
- -
 أضِف قاعدة لملف التنسيق الخاص بك بحيث تجعل النمط قبل عناصِر القائِمة بحروف رومانية من i إلى v، بحيث تحصل على هذه النتيجة: 
- -
 
- - - - - - - -
-

The oceans

- -
    -
  • Arctic
  • -
  • Atlantic
  • -
  • Pacific
  • -
  • Indian
  • -
  • Southern
  • -
-
- -

وقم بتغييرها مرة أُخرى إلى حروف لاتينية كبيرة قبل عناصرالقائمة، وستكون النتيجة هكذا: 

- - - - - - - -
-

(A) The oceans

- -

. . .

- -

(B) Numbered paragraphs

- -

. . .

-
-
- -

See solutions to these challenges.

- -

ما هو القادم ؟

- -

الصفحة القادمو هي ("/en-US/docs/Web/Guide/CSS/Getting_Started/Boxes", "Boxes")

- -

عندما يعرض المتصفّح مستند الخاص بك، فإِنه يُنشئ مساحات حول العناصر عندما يضعها في مواضعها في الصّفحة. الصفّحة القادِمة تصف كيف يُمكن استخدام لغة الـCSS لتَّعامل مع  هذه الأشكال من خلال الـboxes.

diff --git a/files/ar/learn/forms/index.html b/files/ar/learn/forms/index.html deleted file mode 100644 index ab44f3ea1f..0000000000 --- a/files/ar/learn/forms/index.html +++ /dev/null @@ -1,115 +0,0 @@ ---- -title: نماذج HTML -slug: Learn/Forms -tags: - - Beginner - - Featured - - Forms - - Guide - - HTML - - Landing - - Learn - - NeedsTranslation - - TopicStub - - Web -translation_of: Learn/Forms -original_slug: Learn/HTML/Forms ---- -
{{LearnSidebar}}
- -

توفر هذه الوحدة سلسلة من المقالات التي ستساعدك على إتقان نماذج HTML. تعد نماذج HTML أداة قوية جدًا للتفاعل مع المستخدمين ؛ ومع ذلك ، لأسباب تاريخية وتقنية ، ليس من الواضح دائمًا كيفية استخدامها بكامل طاقتها. في هذا الدليل ، سنغطي جميع جوانب نماذج HTML ، من البنية إلى التصميم ، من معالجة البيانات إلى الأدوات المخصصة.

- -

المتطلبات الأساسية

- -

قبل البدء في هذه الوحدة ، يجب أن تعمل على الأقل من خلال مقدمة إلى HTML. في هذه المرحلة ، يجب أن تجد {{anch ("Basic Guides")}} سهل الفهم ، كما يمكنك الاستفادة من دليل أدوات النماذج الأصلية.

- -

ومع ذلك ، تعد بقية الوحدة أكثر تقدمًا - فمن السهل وضع أدوات النموذج على صفحة ، ولكن لا يمكنك فعل الكثير معها دون استخدام بعض ميزات النموذج المتقدمة و CSS و JavaScript. لذلك ، قبل إلقاء نظرة على الأقسام الأخرى ، نوصيك بالابتعاد وتعلم بعض CSS و JavaScript أولاً.

- -
-

ملاحظة: إذا كنت تعمل على جهاز كمبيوتر / جهاز لوحي / جهاز آخر حيث لا يمكنك إنشاء ملفاتك الخاصة ، فيمكنك تجربة (معظم) أمثلة التعليمات البرمجية في برنامج تشفير عبر الإنترنت مثل JSBin أو Glitch.

-
- -

أدلة أساسية

- - - -
أول نموذج HTML خاص بك
- -
تقدم المقالة الأولى في سلسلتنا تجربتك الأولى في إنشاء نموذج HTML ، بما في ذلك تصميم نموذج بسيط وتنفيذه باستخدام عناصر HTML الصحيحة وإضافة بعض الأنماط البسيطة جدًا عبر CSS وكيفية إرسال البيانات إلى الخادم.
- -
كيفية بناء نموذج HTML
- -
مع استبعاد الأساسيات ، ننظر الآن بمزيد من التفصيل في العناصر المستخدمة لتوفير البنية والمعنى للأجزاء المختلفة من النموذج.
- -

ما هو شكل الحاجيات المتاحة؟

- - - -
حاجيات النموذج الأصلي
- -
نحن الآن نلقي نظرة على وظائف أدوات النماذج المختلفة بالتفصيل ، وننظر في الخيارات المتاحة لجمع أنواع مختلفة من البيانات.
- -

التحقق من صحة بيانات النموذج وإرسالها

- - - -
إرسال بيانات النموذج
- -
تتناول هذه المقالة ما يحدث عندما يرسل المستخدم نموذجًا - إلى أين تذهب البيانات ، وكيف نتعامل معها عندما تصل إلى هناك؟ نحن ننظر أيضًا في بعض المخاوف الأمنية المرتبطة بإرسال بيانات النموذج.
- -
- -
التحقق من صحة بيانات النموذج
- -
لا يعد إرسال البيانات كافيًا - نحتاج أيضًا إلى التأكد من أن البيانات التي يملأها المستخدمون في النماذج بالتنسيق الصحيح الذي نحتاجه لمعالجتها بنجاح ، وأن ذلك لن يفسد تطبيقاتنا. نريد أيضًا مساعدة مستخدمينا على ملء نماذجنا بشكل صحيح وعدم الشعور بالإحباط عند محاولة استخدام تطبيقاتنا. يساعدنا التحقق من صحة النموذج في تحقيق هذه الأهداف - تخبرك هذه المقالة بما تحتاج إلى معرفته.
- -

أدلة متقدمة

- - - -
كيفية بناء الحاجيات النموذجية المخصصة
- -
ستصادف بعض الحالات التي لا توفر فيها أدوات النموذج الأصلية ما تحتاجه ، على سبيل المثال بسبب التصميم أو الوظيفة. في مثل هذه الحالات ، قد تحتاج إلى إنشاء عنصر واجهة مستخدم للنموذج من HTML خام. تشرح هذه المقالة كيفية القيام بذلك والاعتبارات التي يجب أن تكون على دراية بها عند القيام بذلك ، مع دراسة حالة عملية.
- -
- -
إرسال النماذج من خلال JavaScript
- -
تبحث هذه المقالة في طرق استخدام نموذج لتجميع طلب HTTP وإرساله عبر JavaScript مخصص ، بدلاً من إرسال النموذج القياسي. يبحث أيضًا في سبب رغبتك في القيام بذلك ، والآثار المترتبة على القيام بذلك. (راجع أيضًا استخدام كائنات FormData.)
- -
- -
نماذج HTML في المتصفحات القديمة
- -
اكتشاف ميزة تغطية المقالة ، وما إلى ذلك ، يجب إعادة توجيه هذا إلى وحدة اختبار عبر المتصفح ، حيث تتم تغطية نفس الأشياء بشكل أفضل هناك.
- -

أدلة تصميم النموذج

- - - -
تصميم نماذج HTML
- -
توفر هذه المقالة مقدمة لنماذج التصميم باستخدام CSS ، بما في ذلك جميع الأساسيات التي قد تحتاج إلى معرفتها لمهام التصميم الأساسية.
- -
- -
التصميم المتقدم لنماذج HTML
- -
هنا نلقي نظرة على بعض تقنيات تصميم النماذج الأكثر تقدمًا والتي يجب استخدامها عند محاولة التعامل مع بعض العناصر الأكثر صعوبة في التصميم.
- -
- -
جدول توافق الخاصية لعناصر واجهة المستخدم للنموذج
- -
توفر هذه المقالة الأخيرة مرجعًا مفيدًا يسمح لك بالبحث عن خصائص CSS المتوافقة مع عناصر النموذج.
- -
- -
مقدمة إلى HTML تعلم HTML HTML5 دليل المطور مرجع العنصر المرجع
- -

إقرأ أيضا

- - diff --git a/files/ar/learn/front-end_web_developer/index.html b/files/ar/learn/front-end_web_developer/index.html deleted file mode 100644 index a062423f96..0000000000 --- a/files/ar/learn/front-end_web_developer/index.html +++ /dev/null @@ -1,189 +0,0 @@ ---- -title: Front-end web developer -slug: Learn/Front-end_web_developer -translation_of: Learn/Front-end_web_developer ---- -

{{Learnsidebar}}

- -

مرحبًا بك في مسار تعلم مطوري الويب الأمامي!

- -

هنا نقدم لك دورة منظمة ستعلمك كل ما تحتاج إلى معرفته لتصبح مطور ويب أمامي. ما عليك سوى العمل من خلال كل قسم ، وتعلم مهارات جديدة (أو تحسين المهارات الحالية) أثناء تقدمك. يتضمن كل قسم تمارين وتقييمات لاختبار فهمك قبل المضي قدمًا.

- -

الموضوعات المشمولة

- -

الموضوعات المشمولة هي:

- -
    -
  • الإعداد الأساسي وتعلم كيفية التعلم
  • -
  • معايير الويب وأفضل الممارسات (مثل إمكانية الوصول والتوافق عبر المتصفحات)
  • -
  • HTML ، اللغة التي تعطي بنية محتوى الويب والمعنى
  • -
  • CSS ، اللغة المستخدمة في تصميم صفحات الويب
  • -
  • JavaScript ، لغة البرمجة النصية المستخدمة لإنشاء وظائف ديناميكية على الويب
  • -
  • الأدوات المستخدمة لتسهيل تطوير الويب الحديث من جانب العميل.
  • -
- -

يمكنك العمل من خلال الأقسام بالترتيب ، ولكن كل قسم قائم بذاته. على سبيل المثال ، إذا كنت تعرف HTML بالفعل ، يمكنك التخطي إلى قسم CSS.

- -

المتطلبات الأساسية

- -

لا تحتاج إلى أي معرفة سابقة لبدء هذه الدورة. كل ما تحتاجه هو جهاز كمبيوتر يمكنه تشغيل متصفحات الويب الحديثة واتصال بالإنترنت والرغبة في التعلم.

- -

إذا لم تكن متأكدًا مما إذا كان تطوير الويب من أجلك أم لا ، و / أو كنت تريد مقدمة لطيفة قبل البدء في دورة تدريبية أطول وأكثر اكتمالًا ، فقم بالعمل من خلال البدء باستخدام وحدة الويب أولاً.

- -

الحصول على مساعدة

- -

لقد حاولنا أن نجعل تعلم تطوير الواجهة الأمامية أمرًا مريحًا قدر الإمكان ، ولكن ربما ستظل عالقًا لأنك لا تفهم شيئًا ، أو أن بعض التعليمات البرمجية لا تعمل.

- -

لا داعي للذعر. نتعثر جميعًا ، سواء كنا مبتدئين أو مطورين ويب محترفين. في التعلم والحصول على تعليمات المادة يوفر لك مجموعة من النصائح ليبحث عن معلومات ومساعدة نفسك. إذا كنت لا تزال عالقًا ، فلا تتردد في نشر سؤال في منتدى الخطاب الخاص بنا .

- -

هيا بنا نبدأ. حظا سعيدا!

- -

مسار التعلم

- -

 البدء 

- -

الوقت اللازم للانهاء: 1.5 - 2 ساعة

- -

المتطلبات الاساسية 

- -

لا شيء عدا المعرفة في اساسيات الحاسب الالي.

- -

كيف اعرف انني جاهز للبدء؟

- -

There are no assessments in this part of the course. But make sure you don't skip. It is important to get you set up and ready to do work for exercises later on in the course.

- -

ارشادات قبل البدء

- - - -

Semantics and structure with HTML

- -

الوقت اللازم للانهاء: 35 - 50 ساعة

- -

المتطلبات الاساسية 

- -

Nothing except basic computer literacy, and a basic web development environment.

- -

How will I know I'm ready to move on?

- -

The assessments in each module are designed to test your knowledge of the subject matter.  Completing the assessments confirms that you are ready to move on to the next module.

- -

Modules

- - - -

Styling and layout with CSS

- -

Time to complete: 90–120 hours

- -

Prerequisites

- -

It is recommended that you have basic HTML knowledge before starting to learn CSS. You should at least study Introduction to HTML first.

- -

How will I know I'm ready to move on?

- -

The assessments in each module are designed to test your knowledge of the subject matter.  Completing the assessments confirms that you are ready to move on to the next module.

- -

Modules

- - - -

Additional resources

- - - -

Interactivity with JavaScript

- -

Time to complete: 135–185 hours

- -

Prerequisites

- -

It is recommended that you have basic HTML knowledge before starting to learn JavaScript. You should at least study Introduction to HTML first.

- -

How will I know I'm ready to move on?

- -

The assessments in each module are designed to test your knowledge of the subject matter.  Completing the assessments confirms that you are ready to move on to the next module.

- -

Modules

- - - -

Web forms — Working with user data

- -

Time to complete: 40–50 hours

- -

Prerequisites

- -

Forms require HTML, CSS, and JavaScript knowledge. Given the complexity of working with forms, it is a dedicated topic.

- -

How will I know I'm ready to move on?

- -

The assessments in each module are designed to test your knowledge of the subject matter.  Completing the assessments confirms that you are ready to move on to the next module.

- -

Modules

- - - -

Making the web work for everyone

- -

Time to complete: 60–75 hours

- -

Prerequisites

- -

It is a good idea to know HTML, CSS, and JavaScript before working through this section. Many of the techniques and best practices touch on multiple technologies.

- -

How will I know I'm ready to move on?

- -

The assessments in each module are designed to test your knowledge of the subject matter.  Completing the assessments confirms that you are ready to move on to the next module.

- -

Modules

- - - -

Modern tooling

- -

Time to complete: 55–90 hours

- -

Prerequisites

- -

It is a good idea to know HTML, CSS, and JavaScript before working through this section, as the tools discussed work alongside many of these technologies.

- -

How will I know I'm ready to move on?

- -

لا توجد مقالات تقييم محددة في هذه المجموعة من الوحدات. تُعدك دروس دراسة الحالة في نهاية الوحدتين الثانية والثالثة لاستيعاب أساسيات الأدوات الحديثة.

- -

الوحدات

- - diff --git a/files/ar/learn/getting_started_with_the_web/css_basics/index.html b/files/ar/learn/getting_started_with_the_web/css_basics/index.html deleted file mode 100644 index e66e1abb24..0000000000 --- a/files/ar/learn/getting_started_with_the_web/css_basics/index.html +++ /dev/null @@ -1,298 +0,0 @@ ---- -title: أساسيات الـ CSS -slug: Learn/Getting_started_with_the_web/CSS_basics -tags: - - CSS - - تصميم - - تعلم - - مبتدأ - - ويب -translation_of: Learn/Getting_started_with_the_web/CSS_basics -original_slug: Learn/Getting_started_with_the_web/أساسيات_صفحات_الطرز_المتراصة ---- -
{{LearnSidebar}}
- -
{{PreviousMenuNext("Learn/Getting_started_with_the_web/HTML_basics", "Learn/Getting_started_with_the_web/JavaScript_basics", "Learn/Getting_started_with_the_web")}}
- -
-

السي إس إس CSS (صفحات الطرز المتراصة) هي التعليمات البرمجية التي تستخدم لتنسيق صفحتك. ستناقش مقالة  أساسياتCSS ما تحتاجه لتبدأ باستخدام هذه التقنية. سنجيب عن أسئلة مثل: كيف أجعل النصّ ذا لون أسود أو أحمر؟ كيف أجعل محتويات الصفحة في أماكن محددة على الشاشة؟ كيف أزين الصفحة بصور و بألوان خلفية؟

-
- -

إذاً ماهي CSS عملياً؟

- -

لاتعد السي إس إس لغة برمجة (كما الأتش تي أم إل لا تعد كذلك). وهي ليست لغة ترميزية حتى — فهي لغة أنماط (تصميم). هذا يعني أنها تسمح لك بتطبيق تنسيقات على عناصر منتقاة من وثيقة لغة ترميز النص الفائق. على سبيل المثال، لاختيار جميع عناصر الفقرة في صفحة الويب وجعل لون النص بداخلها أحمر، تستطيع استخدام هذه التعليمة:

- -
p {
-  color: red;
-}
- -

دعنا ننسخ الثلاث سطور السابقة ونضعها في ملف جديد وبعدها نقوم بحفظ الملف باسم style.css داخل المجلد styles.

- -

ولكننا مازلنا بحاجة لربط الملف مع وثيقة لغة ترميز النص الفائق. وإلا لن يعمل التنسيق الذي أضافه ملف styls.css على صفحتك. (إذا لم تكن قد تابعت معنا الوحدة من بدايتها قم بقراءة مقالة التعامل مع الملفات و مقالة أساسيات لغة ترميز النص الفائق لمعرفة ما أنت بحاجة إليه لتبدأ).

- -
    -
  1. افتح الملف index.html والصق السطر أدناه في وسم head: - -
    <link href="styles/style.css" rel="stylesheet" type="text/css">
    -
  2. -
  3. احفظ الملف وقم بفتح الصفحة في متصفحك. يجب أن ترى شيئاً من هذا القبيل:
  4. -
- -

A mozilla logo and some paragraphs. The paragraph text has been styled red by our css.

- -

تهانينا! إذا أصبح نص فقرتك باللون الأحمر، فقد قمت بكتابة أول ملف سي إس إس ناجح.

- -

تشريح أمر السي إس إس

- -

دعنا نأخذ نظرة مفصلة حول الثلاث سطور السابقة:

- -

- -

تدعى الثلاث سطور السابقة بمجموعة الأمر (rule set). لاحظ أيضاً أسماء كل جزئ من مجموعة الأوامر تلك:

- -
-
المحدد (المنتقي)
-
هو اسم عنصر الأتش تي أم إل ويوضع في بداية مجموعة الأوامر. يقوم بتحديد العنصر/العناصر التي يراد تنسيقها (في حالتنا العناصر ذات الوسم p). لتقوم بتنسيق عنصر أخر ما عليك سوى تغيير المحدد.
-
الإعلان
-
هو أمر مفرد مثل color: red والذي يحدد الخاصية التي تريد استخدامها لتنسيق العنصر.
-
الخاصية
-
هي الطريقة التي تريد تنسيق العنصر فيها. (في حالتنا الخاصية color هي خاصية للعنصر {{htmlelement("p")}}). في السي إس إس أنت تقوم باختيار الخواص التي تريدها أن تأثر على عنصرك.
-
قيمة الخاصية
-
توضع على يمين اسم الخاصية بعد النقطتين، والتي تحدد واحدة من  العديد من الخيارات المتاحة (يوجد العديد من القيم الأخرى إلى جانب القيمة red للخاصية color).
-
- -

انتبه للأجزاء المهمة الأخرى من البنية الكتابية لمجموعة الأمر:

- -
    -
  • كل مجموعة أمر (بغض النظر عن المحدد) يجب أن تحاط بأقواس معقوفة ({}).
  • -
  • بداخل كل إعلان يجيب عليك استخدام نقطتين (:) للفصل بين الخاصية وقيمتها.
  • -
  • بداخل كل مجموعة أمر يجب عليك استخدام فاصلة منقوطة (;) للفصل بين كل إعلان والإعلان الذي يليه.
  • -
- -

إذا لكتابة عدة خواص في مجموعة أمر واحدة ما عليك سوى كتابتهم والفصل بينهم باستخدام فاصلة منقوطة، كالتالي:

- -
p {
-  color: red;
-  width: 500px;
-  border: 1px solid black;
-}
- -

اختيار عدة عناصر

- -

يمكنك أيضاً اختيار عدة أنواع من العناصر وتطبيق عليهم مجموعة أمر واحدة. قم بإضافة عدة محددات مفصولين بفاصلة. على سبيل المثال:

- -
p,li,h1 {
-  color: red;
-}
- -

أنواع مختلفة من المحدد

- -

هناك عدة أنواع مختلفة من المحدد. أعلاه، قمنا فقط باستخدام محددات العنصر، والذي يختار جميع العناصر من النوع نفسه في وثيقة الأتش تي أم إل. ولكن يمكننا القيام بتحديد أكثر دقةً من ذلك. يوجد هنا بعض الأنواع الشائعة من المحددات:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
اسم المحددماذا يحددمثال
محدد العناصر (يسمى أحيانا بمحدد النوع أو الوسم)جميع العناصر التي من نفس النوعp
- تحدد العناصر ذات الوسم <p>
محدد الهويةالعنصر الموجود في الصفحة والذي يملك تلك الهوية (في صفحة الأتش تي أم إل يُسمح لك بإعطاء هوية واحدة مميزة لكل عنصر)#my-id
- تحدد العناصر ذات الهوية <p id="my-id"> أو <a id="my-id">
محدد الصنفالعنصر/العناصر الموجودة على الصفحة والتي تملك ذلك الصنف (يمكن استخدام الصنف نفسه على عدة عناصر).my-class
- Selects <p class="my-class"> and <a class="my-class">
محدد السمةالعناصر في الصفحة والتي تملك السمة المحددةimg[src]
- تحدد الصور ذات السمة <img src="myimage.png"> ولكن لا تحدد عنصر الصورة بدون السمة المذكورة <img>
محدد فئة الشبهعنصر/عناصر محدد ولكن عندما يكون بحالة معينة، مثال عندما يتم التحويم فوقه -

a:hover
- تحدد العناصر <a>

- -

ولكن فقط عندما يتم تحويم مؤشر الفأرة فوق الرابط

-
- -

يوجد العديد من المحددات الأخرى لاكتشافها، يمكنك إيجاد قائمة مفصلة أكثر في مقالة دليل المحددات.

- -

الخطوط والنصوص

- -

والآن بعد أن تعرفنا على بعض أساسيات السي إس إس، دعنا نبدأ بإضافة بعد الأوامر والمعلومات لملف style.css لنجعل مثالنا يبدو أجمل. دعنا نبدأ بجعل الخطوط والنصوص التي نستخدمها تبدو أفضل.

- -
    -
  1. بدايةً، قم بالحصول على مسار الخط الذي جلبته من موقع خطوط جوجل. أضف العنصر {{htmlelement("link")}} في الوسم <head>. كالتالي: - -
    <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
    -
  2. -
  3. بعدها، قم بحذف التعليمة السابقة التي كتبناها في ملف style.css. لقد كانت تجربة جيدة، ولكن اللون الأحمر ليس ملائماً بما فيه الكفاية.
  4. -
  5. ضع السطور التالية في الملف، استبدل سطر placeholder بسطر عائلة الخط font-family التي حصلت عليها من موقع خطوط جوجل Google Fonts. (تعني font-family بالخطوط التي تريد استخدامها في النص.) تقوم هذه التعليمة بتعيين خط أساسي شامل و قياس للخط من أجل كامل الصفحة (طالما أن <html> يمثل العنصر الأب لكامل الصفحة, و جميع العناصر داخله ترث نفس ال font-size و الـ font-family): -
    html {
    -  font-size: 10px; /* px means 'pixels': the base font size is now 10 pixels high  */
    -  font-family: placeholder: this should be the rest of the output you got from Google fonts
    -}
    - -
    -

    ملاحظة: أي شيء يكتب في ملف الـ CSS بين */ و /* عبارة عن تعليق CSS, حيث أن المتصفح يقوم بتجاهله عندما يعالج التعليمات البرمجية. يمكنك الاستفادة من تعليقات الـ CSS لكتابة ملاحظات مفيدة عمّا تحاول فعله.

    -
    -
  6. -
  7. الآن سنقوم بتعيين قياسات الخطوط للعناصر التي تتضمن نصوص داخل جسد الـ HTML ({{htmlelement("h1")}}, {{htmlelement("li")}}, {{htmlelement("p")}}). بالإضافة إلى ذلك سنجعل النص الخاص بعنوان الصفحة في المركز, و سنغير ارتفاع الخط (line height) بالإَافة إلى المسافة بين الحروف (letter spacing) لمحتويات الـ body لجعلها أسهل للقراءة: -
    h1 {
    -  font-size: 60px;
    -  text-align: center;
    -}
    -
    -p, li {
    -  font-size: 16px;
    -  line-height: 2;
    -  letter-spacing: 1px;
    -}
    -
  8. -
- -

يمكنك تعديل قيم الـ px هذه إلى أي شيء تحبه لتحصل على التصميم الذي تريده, لكن بشكل عام يجب أن يبدو التصميم كالتالي:

- -

a mozilla logo and some paragraphs. a sans-serif font has been set, the font sizes, line height and letter spacing are adjusted, and the main page heading has been centered

- -

صناديق الـ CSS

- -

إحدى الأشياء التي تلاحظها عندما تكتب الـ CSS هي أن الكثير من خصائصها يتعلق بالصناديق — ضبط قياسها, لونها, موضعها, الخ. أغلب عناصر الـ HTML في صفحتك يمكن اعتبارها على أنها صناديق موضوعة فوق بعضها البعض

- -

a big stack of boxes or crates sat on top of one another

- -

Not surprisingly, CSS layout is based principally on the box model. Each of the blocks taking up space on your page has properties like this:

- -
    -
  • padding, the space just around the content (e.g., around paragraph text)
  • -
  • border, the solid line that sits just outside the padding
  • -
  • margin, the space around the outside of the element
  • -
- -

three boxes sat inside one another. From outside to in they are labelled margin, border and padding

- -

In this section we also use:

- -
    -
  • width (of an element)
  • -
  • background-color, the color behind an element's content and padding
  • -
  • color, the color of an element's content (usually text)
  • -
  • text-shadow: sets a drop shadow on the text inside an element
  • -
  • display: sets the display mode of an element (don't worry about this yet)
  • -
- -

So, let's get started and add some more CSS to our page! Keep adding these new rules to the bottom of the page, and don't be afraid to experiment with changing values to see how it turns out.

- -

Changing the page color

- -
html {
-  background-color: #00539F;
-}
- -

This rule sets a background color for the whole page. Change the color code above to whatever color you chose when planning your site.

- -

Sorting the body out

- -
body {
-  width: 600px;
-  margin: 0 auto;
-  background-color: #FF9500;
-  padding: 0 20px 20px 20px;
-  border: 5px solid black;
-}
- -

Now for the {{htmlelement("body")}} element. There are quite a few declarations here, so let's go through them all one by one:

- -
    -
  • width: 600px; — this forces the body to always be 600 pixels wide.
  • -
  • margin: 0 auto; — When you set two values on a property like margin or padding, the first value affects the element's top and bottom side (make it 0 in this case), and the second value the left and right side (here, auto is a special value that divides the available horizontal space evenly between left and right). You can also use one, three, or four values, as documented here.
  • -
  • background-color: #FF9500; — as before, this sets the element's background color. We've used a sort of reddish orange for the body as opposed to dark blue for the {{htmlelement("html")}} element, but feel free to go ahead and experiment.
  • -
  • padding: 0 20px 20px 20px; — we have four values set on the padding, to make a bit of space around our content. This time we are setting no padding on the top of the body, and 20 pixels on the left, bottom and right. The values set top, right, bottom, left, in that order.
  • -
  • border: 5px solid black; — this simply sets a 5-pixel–wide, solid black border on all sides of the body.
  • -
- -

Positioning and styling our main page title

- -
h1 {
-  margin: 0;
-  padding: 20px 0;
-  color: #00539F;
-  text-shadow: 3px 3px 1px black;
-}
- -

You may have noticed there's a horrible gap at the top of the body. That happens because browsers apply some default styling to the {{htmlelement("h1")}} element (among others), even when you haven't applied any CSS at all! That might sound like a bad idea, but we want even an unstyled webpage to have basic readability. To get rid of the gap we overrode the default styling by setting margin: 0;.

- -

Next up, we've set the heading's top and bottom padding to 20 pixels, and made the heading text the same color as the html background color.

- -

One rather interesting property we've used here is text-shadow, which applies a text shadow to the text content of the element. Its four values are as follows:

- -
    -
  • The first pixel value sets the horizontal offset of the shadow from the text — how far it moves across: a negative value should move it to the left.
  • -
  • The second pixel value sets the vertical offset of the shadow from the text — how far it moves down, in this example; a negative value should move it up.
  • -
  • The third pixel value sets the blur radius of the shadow — a bigger value will mean a more blurry shadow.
  • -
  • The fourth value sets the base color of the shadow.
  • -
- -

Again, try experimenting with different values to see what you can come up with!

- -

Centering the image

- -
img {
-  display: block;
-  margin: 0 auto;
-}
- -

Finally, we'll center the image to make it look better. We could use the margin: 0 auto trick again as we did earlier for the body, but we also need to do something else. The {{htmlelement("body")}} element is block level, meaning it takes up space on the page and can have margin and other spacing values applied to it. Images, on the other hand, are inline elements, meaning they can't. So to apply margins to the image, we have to give the image block-level behavior using display: block;.

- -
-

Note: Don't worry if you don't yet understand display: block; and the block-level/inline distinction. You will as you study CSS in more depth. You can find out more about the different available display values at our display reference page.

-
- -

Conclusion

- -

If you have followed all the instructions in this article, you should end up with a page that looks something like this (you can also view our version here):

- -

a mozilla logo, centered, and a header and paragraphs. It now looks nicely styled, with a blue background for the whole page and orange background for the centered main content strip.

- -

If you get stuck, you can always compare your work with our finished example code on GitHub.

- -

Here, we have only really scratched the surface of CSS. To find out more, go to our CSS Learning topic.

- -

{{PreviousMenuNext("Learn/Getting_started_with_the_web/HTML_basics", "Learn/Getting_started_with_the_web/JavaScript_basics", "Learn/Getting_started_with_the_web")}}

- -

 

- -

In this module

- - - -

 

diff --git a/files/ar/learn/getting_started_with_the_web/dealing_with_files/index.html b/files/ar/learn/getting_started_with_the_web/dealing_with_files/index.html deleted file mode 100644 index ba85c7a629..0000000000 --- a/files/ar/learn/getting_started_with_the_web/dealing_with_files/index.html +++ /dev/null @@ -1,112 +0,0 @@ ---- -title: التعامل مع الملفات -slug: Learn/Getting_started_with_the_web/Dealing_with_files -tags: - - البدء مع الويب - - لغة ترميز النص الفائق - - مبتدئين -translation_of: Learn/Getting_started_with_the_web/Dealing_with_files ---- -
{{LearnSidebar}}
- -
{{PreviousMenuNext("Learn/Getting_started_with_the_web/What_will_your_website_look_like", "Learn/Getting_started_with_the_web/HTML_basics", "Learn/Getting_started_with_the_web")}}
- -
-

يتألف الموقع من العديد من الملفات: المحتوى النصي، والنص المصدري، وملفات التصميم (ملفات الأنماط)، والوسائط، والكثير من الملفات الأخرى. عندما تبني موقعك، سوف تحتاج لتجميع جميع تلك الملفات بهيكليّة منطقيّة، وتتأكد من أنَّهم قادرين على الوصول لبعضهم البعض. مقالة التعامل مع الملفات تشرح كيف يمكنك إعداد هيكلة ملفات منطقيّة لموقعك، وما المشاكل التي يجب أن تكون حذر منها.

-
- -

في أي مكان يجب أن أضع موقعي؟

- -

عندما تكون قيد العمل على موقع محلياً على حاسبك، فيجب عليك وضع جميع الملفات في مجلد واحد يعكس هيكلة الملفات الموجودة على {{Glossary("Server", "الخادم") }}. يمكنك وضع ذلك المجلد في أي مكان تريد، ولكن يجب أن تحرص على وضعه في مكان يسهل عليك العثور عليه، في سطح المكتب مثلاً، أو في مجلد المنزل، أو في مجلد الجذر على القرص الصلب.

- -
    -
  1. اختر مكان لتحتفظ فيه بملفات المشروع. قم بإنشاء مجلد في ذلك المكان ولندعوه بـ web-projects على سبيل المثال (أو أي شيء مشابه). في هذا المجلد سيكون جميع ملفات مشاريعك.
  2. -
  3. في نفس المجلد، أنشئ مُجلداً آخر وسمه test-site (أو شيء أكثر دلالةً).
  4. -
- -

حالة الحروف والمسافات

- -

ستلاحظ خلال هذه المقالة أننا سنخبرك أن تسمي جميع المجلدات والملفات بأحرف صغيرة (lowercase) وبدون مسافات. وهذا بسبب أنَّ:

- -
    -
  1. العديد من الحواسيب، وخاصةً خوادم الويب، حسّاسة لحالة الحروف. فعلى سبيل المثال، إذا وضعت صورة في موقعك في المسار test-site/MyImage.jpg، ومن ثم في ملف آخر حاولتَ استدعاء تلك الصورة بالاسم test-site/myimage.jpg قد لا ينجح الاستدعاء.
  2. -
  3. الخوادم، وخوادم الويب، ولغات البرمجة لاتتعامل مع المسافات بشكل جيد. فعلى سبيل المثال، إذا قمت باستخدام مسافات خلال كتابتك لاسم ملفك، بعض الأنظمة قد تعامل اسم الملف على أنَّه اسم لملفين. وبعض الخوادم ستستبدل المسافات في اسم ملفك ب "%20" (رمز المسافات في روابط URI)، مما سيؤدي إلى تلف جميع الروابط. من الأفضل الفصل بين الكلمات باستخدام شرطات بدلاً من شرطة السفلية: my-file.html بدلاً من my_file.html.
  4. -
- -

الجواب القصير أنَّه يجب عليك استخدام شرطة في اسماء ملفاتك. يعامل مُحرِّك البحث جوجل الشرطة على أنَّها فارزة للكلمة، ولكنه لا يعامل الشرطة السفلية بهذه الطريقة. لهذه الأسباب، من الأفضل الاعتياد على كتابة اسماء مجلداتك وملفاتك بدون مسافات وبكلمات منفصلة باستخدام شرطات، على الأقل حتى تبدأ بمعرفة ماذا تفعل (تصل لمرحلة متقدمة قليلاً بالتعلُّم). وبهذه الطريقة ستواجه مشاكل أقل لاحقاً أثناء تعلمك.

- -

كيف يجب أن تكون هكيليّة الملفات لموقعي؟

- -

الآن دعنا نأخذ نظرة على هيكليّة الملفات للموقع التجريبي خاصتنا. أكثر الأشياء شيوعاً التي سنقوم بها في أي موقع هي إنشاء ملف ل.ت.ن.ف (لغة ترميز النص الفائق - HTML) يسمى index ومجلدات تحوي الصور، وملفات التصميم، والملفات البرمجيّة. دعنا الآن ننشئ الأشياء التالية:

- -
    -
  1. الملف index.html: يحوي هذا الملف عادةً على محتويات الصفحة الرئيسية لموقعك، والتي تحتوي على النصوص والصور التي سيراها الناس عندما سيزورون الموقع. استخدم محرِّر النصوص وأنشئ ملفاً جديداً بالاسم index.html ومن ثم احفظه بداخل المجلد text-site.
  2. -
  3. المجلد images: سيوضع في هذا المجلد جميع الصور التي ستستخدمها في موقعك. أنشئ مجلداً يسمى images بداخل المجلد test-site.
  4. -
  5. المجلد styles: سيحتوي هذا المجلد على جميع ملفات ص.أ.ا (صفحات الأنماط الانسيابية - CSS) المُستخدمة لتنسيق محتوى الموقع.
  6. -
  7. مجلد scripts: سيحتوي هذا المجلد على جميع ملفات الجافالسكربت (JavaScript) المُستخدمة لإضافة مزايا تفاعليّة لموقعك (مثال: تحميل بيانات عندما يتم الضغط على أزرار معينة). أنشئ مجلد يدعى scripts بداخل المجلد test-site.
  8. -
- -
-

ملاحظة: على الحواسيب بنظام ويندوز قد تواجه صعوبة برؤية اسماء الملفات، وذلك لأنَّ نظام ملفات الويندوز يحتوي على خيار إخفاء لاحقة أنواع الملفات المعروفة مُمكناً بشكل إفتراضي. يمكنك تعطيل هذا الخيار عادةً بالذهاب إلى متصفح ملفات ويندوز واختيار الخيار خيارات المجلد...، وإزالة علامة الصح عن الخيار إخفاء لاحقة أنواع الملفات المعروفة، وبعدها قم بالضغط على موافق. للمزيد من المعلومات حول إصدار الويندوز خاصتك، قم بالبحث في الإنترنت.

-
- -

مسارات الملفات

- -

لتجعل الملفات تصل لبعضها البعض عليك توفير مسار الملف لكل واحدٍ منهم (أو بمعنى آخر عنوان مكان تواجد كل ملف). لتوضيح هذا، سنضع شيفرة صغيرة في ملف index.html، وسنجعلها تُظهِر الصورة التي اخترتها في مقالة "كيف سيكون مظهر موقعك؟".

- -
    -
  1. انسخ الصورة التي اخترتها وقم بوضعها في المجلد images.
  2. -
  3. افتح الملف index.html وقم بوضع هذه الشيفرة بداخله (كما أدناه). لا تهتم حيال ما تعنيه تلك الشيفرة حالياً (سنتكلم عنها بالتفصيل لاحقاً في السلسلة). -
    <!DOCTYPE html>
    -<html>
    -  <head>
    -    <meta charset="utf-8">
    -    <title>My test page</title>
    -  </head>
    -  <body>
    -    <img src="" alt="My test image">
    -  </body>
    -</html> 
    -
  4. -
  5. السطر <"img src="" alt="My test image> هو التعليمة التي تُستخدَم لعرض صورة في الصفحة. علينا إخبار ل.ت.ن.ف أيّة صورة نريد. توجد هذه الصورة في المجلد images، والذي يقع في نفس المجلد الذي يوجد فيه الملف index.html. لتستطيع الصفحة أن تصل لمجلد تلك الصورة، نحن بحاجة إلى وضع المسار التالي images/your-image-filename. على سبيل المثال، إن كانت صورتنا تسمى firefox-icon.png إذاً مسار الملف سيكون images/firefox-icon.png.
  6. -
  7. ضع مسار الملف داخل شيفرة ل.ت.ن.ف بين علامتي التنصيص في التعليمة src=="".
  8. -
  9. قم بحفظ الملف index.html وقم بفتحه في متصفح الويب (انقر عليه مرتين). يجب أن ترى صفحة ويب جديدة تعرض صورتك.
  10. -
- -

A screenshot of our basic website showing just the firefox logo - a flaming fox wrapping the world

- -

بعض القواعد الأساسية لمسارات الملفات:

- -
    -
  • لتربط الملف الهدف الموجود في نفس المجلد الذي يوجد فيه ملف ل.ت.ن.ف، استخدم اسم الملف فقط، مثال my-image.jpg.
  • -
  • للإشارة إلى ملف في دليل فرعي، اكتب اسم الدليل في مقدمة المسار، وبعدها شرطة مائلة، مثال: subdirectory/my-image.jpg.
  • -
  • لربط الملف الهدف الموجود بمجلد يسبق المجلد الذي يوجد فيه ملف ل.ت.ن.ف، اكتب نقطتين. فعلى سبيل المثال، إذا كان الملف index.html داخل مجلد فرعي في المجلد test-site وكانت الصورة my-image.jpg داخل المجلد test-site، يمكنك الإشارة للصورة my-image.jpg من الملف index.html باستخدام المسار ../my-image.jpg.
  • -
  • يمكنك الدمج بين تلك القواعد كما تشاء، على سبيل المثال: ../subdirectory/another-subdirectory/my-image.jpg.
  • -
- -

هذا كل ما تحتاج معرفته حالياً.

- -
-

ملاحظة: يستخدم نظام ملفات ويندوز المائلة الخلفية، وليس الأمامية، مثال C:\windows. هذا لا يهم عند استخدام ل.ت.ن.ف (فحتى عندما تقوم بتطوير موقعك على ويندوز، فعليك استخدام المائلة الأمامية في شيفرتك).

-
- -

ماذا يجب أن أفعل أيضاً؟

- -

هذا كل شيء للوقت الراهن. هيكيّلة مجلداتك يجب أن تبدو كشيء من هذا القبيل:

- -

A file structure in mac os x finder, showing an images folder with an image in, empty scripts and styles folders, and an index.html file

- -

{{PreviousMenuNext("Learn/Getting_started_with_the_web/What_will_your_website_look_like", "Learn/Getting_started_with_the_web/HTML_basics", "Learn/Getting_started_with_the_web")}}

- -

في هذه الوحدة أيضاًEditEdit

- - diff --git a/files/ar/learn/getting_started_with_the_web/how_the_web_works/index.html b/files/ar/learn/getting_started_with_the_web/how_the_web_works/index.html deleted file mode 100644 index 915bcef409..0000000000 --- a/files/ar/learn/getting_started_with_the_web/how_the_web_works/index.html +++ /dev/null @@ -1,109 +0,0 @@ ---- -title: كيف يعمل الويب -slug: Learn/Getting_started_with_the_web/How_the_Web_works -translation_of: Learn/Getting_started_with_the_web/How_the_Web_works ---- -
{{LearnSidebar}}
- -
{{PreviousMenu("Learn/Getting_started_with_the_web/Publishing_your_website", "Learn/Getting_started_with_the_web")}}
- -
-

توفر طريقة عمل الويب طريقة عرض مبسطة لما يحدث عند عرض صفحة ويب في مستعرض ويب على الكمبيوتر أو الهاتف.

-
- -

هذه النظرية ليست ضرورية لكتابة كود الويب على المدى القصير ، ولكن قبل وقت طويل سوف تبدأ حقًا بالاستفادة من فهم ما يحدث في الخلفية.

- -

العملاء والخوادم | Clients and servers

- -

تقسم أجهزة الكمبيوتر المتصلة بشبكة الإنترنت الى عملاء (clients) وخوادم (servers). حيث يوضح الرسم التخطيطي المبسط كيفية تفاعلهم هكذا:

- -

- -
    -
  • -

    ويطلق مصطلح العميل أو العملاء على الأجهزة المتصلة بالانترنت اوالبرمجيات المثبتة عليها والتي تستهلك الخدمات المختلفة المتوفرة على الشبكة بدأً من برامج تصفح المواقع ( مثل Firefox أو Chrome ). مرورا بالتطبيقات المختلفة التي تعتمد على الاتصال بالانترنت كتطبيقات تصفح البريد الاكتروني (outlook) وغيرها.

    -
  • -
  • -

    اما الخوادم فهي الاجهزة والبرمجيات التي تخزن وتوفر صفحات الويب أو المواقع أو التطبيقات. أو البرمجيات التي تقدم خدمات متعلقة بخزين واستعادة البيانات عبر واجهة برمجية معينة (API) فمثلا عندما يريد عميل ما الوصول إلى صفحة ويب، يطلبها من الخادم فيقوم بارسال او تنزيل نسخة منها على جهاز العميل ليتم عرضها في متصفح الويب الخاص بالمستخدم.

    -
  • -
- -

الأجزاء الأخرى من الأدوات

- -

العميل والخادم الذي وصفناه أعلاه لا يخبران القصة بأكملها. هناك العديد من الأجزاء الأخرى المعنية ، وسنقوم بوصفها أدناه.

- -

الآن ، دعنا نتخيل أن الويب هو طريق. على طرف واحد من الطريق هو العميل ، الذي يشبه منزلك. على الطرف الآخر من الطريق ، يوجد الخادم ، وهو متجر تريد شراء شيء منه.

- -

- -

بالإضافة إلى العميل والخادم ، نحتاج أيضًا أن نقول مرحباً بما يلي:

- -
    -
  • اتصال الإنترنت الخاص بك: تيح لك إرسال واستقبال البيانات على شبكة الإنترنت. انها في الأساس مثل الشارع بين منزلك والمتجر.
  • -
  • -
    TCP/IP: بروتوكول التحكم في الإرسال وبروتوكول الإنترنت هما بروتوكولا اتصال يحددان كيفية انتقال البيانات عبر الويب. هذا يشبه آليات النقل التي تتيح لك تقديم طلب ، والذهاب إلى المتجر ، وشراء البضائع الخاصة بك. في مثالنا ، هذا يشبه سيارة أو دراجة (أو مع ذلك ، قد تتجول).
    - -
    -
  • -
  • DNS: خوادم اسم المجال تشبه دفتر العناوين لمواقع الويب. عندما تكتب عنوان ويب في المستعرض الخاص بك ، يبحث المستعرض في DNS للعثور على عنوان موقع الويب الحقيقي قبل أن يتمكن من استرداد موقع الويب. يحتاج المتصفح إلى معرفة الخادم الذي يعمل عليه الموقع ، حتى يتمكن من إرسال رسائل HTTP إلى المكان الصحيح (انظر أدناه). هذا يشبه البحث عن عنوان المتجر حتى تتمكن من الوصول إليه.
    -  HTTP: بروتوكول نقل "النصوص المترابطة"  وهو احد البروتوكولات "يمكن تخيله على انه اللغة المشتركة" التي يتم من خلالها التواصل والتفاعل بين الخادم والعميل. 
  • -
  • -
    Component files:يتكون موقع الويب من العديد من الملفات المختلفة ، والتي تشبه الأجزاء المختلفة للبضائع التي تشتريها من المتجر. هذه الملفات تأتي في نوعين رئيسيين:
    - -
      -
    • Code files: يتم بناء مواقع الويب بشكل أساسي من HTML و CSS و JavaScript ، على الرغم من أنك ستقابل التقنيات الأخرى في وقت لاحق.
    • -
    • Assets: هذا اسم جماعي لجميع العناصر الأخرى التي تشكل موقعًا على الويب، مثل الصور والموسيقى والفيديو ومستندات Word وملفات PDF.
    • -
    -
  • -
- -

إذن ما الذي يحدث بالضبط؟

- -

عندما تطلب عنوان صفحة ويب من متصفحك  (على سبيل المثال https://wiki.developer.mozilla.org/، ولنستعين بمثال السير الى المتجر) يحدث ما يلي:

- -
    -
  1. يقوم المتصفح بسؤال خادم تزويد العنوان DNS عن بالعنوان الحقيقي للخادم الذي يعيش عليه الموقع IP (حيث تتوقع الحصول على العنوان التفصيلي للمحل مثلا المبنى الخامس في نهاية الطريق ).
  2. -
  3. يستخدم المتصفح هذا العنوان للإرسال رسالة  إلى الخادم مستخدما بروتوكول ال HTTP، ويطلب منه إرسال نسخة من موقع الويب إلى العميل (تذهب إلى المتجر وطلب البضائع الخاصة بك). يتم إرسال هذه الرسالة وجميع البيانات الأخرى المرسلة بين العميل والخادم عبر اتصال الإنترنت الخاص بك باستخدام TCP / IP.
  4. -
  5. في حال توافر هذه الخدمة او الصفحة لدى الخادم، وتبعا لبروتوكول ال HTTP سيرد الخادم على الطلب مستخدما ترميزالحالة 200 للتعبير عن الايجاب او النجاح ثم يبدأ بنقل وارسال ملف الصفحة او البيانات على شكل سلسلة حزم بيانات صغيرة ( يمكن تشبيه هذه العملية بطلبك من عالم المتجر بعض الحاجيات او تناولك اياها بعد البحث داخل المتجر، ثم تجميعها وحزمها في اكياس.
  6. -
  7. وختاما يقوم المتصفح بتجميع هذه الحزم على شكل ملف واحد من جديد وعرضها بالشكل المناسب.
  8. -
- -

شرح DNS 

- -

عناوين المواقع المكتوبة التي تطلبها من المتصفح مثل mozilla.org هي ليست العنوان الرقمي الذي تفهمه الالة وانما هو العنوان الذي نفهمه نحن البشر ويسهل علينا تذكره، اما العنوان الحقيقي الرقمي فهو مجموعة من الارقام بترتيب معين مثل 63.245.215.20 .والتي تدعى عنوان بروتوكول الانترنت الرقمي او {{Glossary("IP Address", "IP address")}} وهو يمثل العنوان الرقمي الحقيقي والذي يشير الى جهاز خادم حقيقي واحد وفريد على الشبكة العنكبوتية الذي نود طلب الصفحة منه. 

- -

ومن هنا كانت الحاجة الى خدمة اوخوادم لتحويل وتمثيل او مقابلة اي عنوان مكتوب الى العنوان الرقمي الذي تفهمه الالة عبر جداول خصصت لهذا الغرض، وتسمى هذه الخدمة ب DNS اختصارا ل  Domain Name server. 

- -

يمكن الوصول إلى المواقع مباشرة عبر عناوين IP الخاصة بها. يمكنك العثور على عنوان IP لموقع ويب عن طريق كتابة المجال الخاص به في أداة مثل IP FINDER.

- -

شرح الحزم [Packets]

- -

في وقت سابق ، استخدمنا المصطلح "حزم" (Packets) لوصف التنسيق الذي يتم به إرسال البيانات من خادم إلى عميل. ماذا نعني هنا؟ بشكل أساسي ، عندما يتم إرسال البيانات عبر الويب ، يتم إرسالها كآلاف من القطع الصغيرة ، بحيث يمكن للعديد من مستخدمي الويب المختلفين تنزيل نفس الموقع في نفس الوقت. إذا تم إرسال مواقع الويب كمقاطع كبيرة مفردة ، فيمكن لمستخدم واحد فقط تنزيلها مرة واحدة في كل مرة ، مما من الواضح أنه سيجعل الويب غير فعال للغاية وليس كثير الاستخدام.

- -

أنظر أيضا

- - - -

Credit

- -

صورة الشارع: Street composing, بواسطة كيفن د.

- -

{{PreviousMenu("Learn/Getting_started_with_the_web/Publishing_your_website", "Learn/Getting_started_with_the_web")}}

- -

في هذه الوحدة

- - diff --git a/files/ar/learn/getting_started_with_the_web/html_basics/index.html b/files/ar/learn/getting_started_with_the_web/html_basics/index.html deleted file mode 100644 index d8e10cb20f..0000000000 --- a/files/ar/learn/getting_started_with_the_web/html_basics/index.html +++ /dev/null @@ -1,232 +0,0 @@ ---- -title: أساسيات HTML -slug: Learn/Getting_started_with_the_web/HTML_basics -tags: - - البدء مع الويب -translation_of: Learn/Getting_started_with_the_web/HTML_basics ---- -
{{LearnSidebar}}
- -
{{PreviousMenuNext("Learn/Getting_started_with_the_web/Dealing_with_files", "Learn/Getting_started_with_the_web/CSS_basics", "Learn/Getting_started_with_the_web")}}
- -
-

لغة ترميز النص الفائق (HTML) هي التعليمات التي تُستخدَم لهيكلة صفحة الويب ومحتواها. فعلى سبيل المثال، يمكن، باستخدام هذه اللغة، بناء صفحة تحوي مجموعة من النصوص، وقائمة نقطية، أو تحوي صور و بعض جداول البيانات. كما يشير العنوان، ستزودك هذه المقالة بالمفاهيم الأساسيّة حول هذه اللغة وخواصها.

-
- -

ما هي لغة ترميز النص الفائق؟

- -

لغة ترميز النص الفائق هي ليست لغة برمجيّة بل لغة وصفيّة (markup language) تعمل على وصف هيكلة محتويات صفحات الويب. تتألف لغة ترميز النص الفائق من مجموعة من العناصر (elements) تُستخدَم لاحتواء الأجزاء المختلفة من المحتوى لتجعله يظهر بطريقة معينة. فيمكن استخدام الوسوم المغلقة (enclosing tage)، مثلاً، لإضافة رابط تشعبي لكلمة أو لصورة يشير لموقع آخر، كما يمكن استخدامها لجعل الكلام مائل أو لتصغير الخط وتكبيره. لنأخذ  النص التالي كمثال:

- -
قطتي شديدة الجمال
- -

يمكننا وصف هذا النص على أنه فقرة (paragraph) عن طريق تضمينه باستخدام وسم الفقرة التالي:

- -
<p>قطتي شديدة الجمال</p>
- -

تشريح عنصر لغة ترميز النص الفائق

- -

دعنا نستكشف عنصر الفقرة هذا قليلاً بعد:

- -

- -

الأجزاء الرئيسية من عنصرنا هي:

- -
    -
  1. وسم الفتح: يتألف من اسم العنصر (في حالتنا p)، محاطاً بقوس مفتوح وآخر مغلق. يحدد هذا المكوِّن بداية العنصر، أو بداية التأثير الذي يُضفيه (في حالتنا بداية الفقرة).
  2. -
  3. وسم الإغلاق: مشابه لسابقه، ما عدا أنَّه يتضمن مائلة أماميّة (/) قبل اسم العنصر. يحدد هذا المكوِّن نهاية العنصر (في حالتنا نهاية الفقرة). يُعد نسيان وضع وسم الإغلاق أحد الأخطاء الشائعة التي يقع بها المبتدئون والتي تؤدي إلى مشاكل مزعجة.
  4. -
  5. المحتوى: يُمثِّل هذا المكوِّن محتوى العنصر (في حالتنا نص الفقرة).
  6. -
  7. العنصر: هو الكيان ككل المؤلَّف من وسم الفتح، ووسم الإغلاق، ويتوسطه محتواه.
  8. -
- -

قد يحتوي العنصر أيضاً على بعض السِمات (attributes)، والتي تبدو كشيء من هذا القبيل:

- -

رسم توضيحي يُشرِّح الوسم عندما يمتلك خاصيّة

- -

تحتوي السِمات على معلومات إضافية حول العنصر لا تظهر في المحتوى الفعلي. في حالتنا، يُعد class اسم السِمَة و editor-note قيمتها. السِمَة class تسمح لك بأن تعطي العنصر مُعرِّف يُمكِن استخدامه لاحقاً للإشارة للعنصر لإعطائه تنسيق معين وأشياء أخرى.

- -

ينبغي أن تكون للسِمَة المكوِّنات التالية دوماً:

- -
    -
  1. مسافة بينها وبين اسم العنصر (أو السِمَة التي تسبقها في حال امتلاك العنصر أكثر من سِمَة).
  2. -
  3. اسم السِمَة متبوعاً بإشارة يساوي.
  4. -
  5. علامتي تنصيص تُحيط بقيمة السِمَة.
  6. -
- -
-

ملاحظة: يمكن أن تظل قيم السمات البسيطة التي لا تحتوي على مسافة بيضاء لـ ASCII (أو أي من الأحرف " ' ` = < >) غير مذكورة ، لكن يُنصح بأن تقوم بتحديد كل قيم السمات ، حيث تجعل الشفرة أكثر اتساقًا وفهمًا.

-
- -

العناصر المتداخلة

- -

يمكنك وضع عنصر بداخل عنصر آخر أيضاً، يدعى هذا النمط بالتداخل (nesting). إذا أردنا التأكيد على جمال قطتنا، مثلاً، يمكننا إحاطة الكلمة "شديدة" بالعنصر {{htmlelement("strong")}}، كالتالي:

- -
<p>My cat is <strong>very</strong> grumpy.</p>
- -

 

- -

احرص على إنشاء تداخل صحيح بين عناصرك: في المثال أعلاه قمنا بفتح العنصر {{htmlelement("p")}} أولاً، وبعدها العنصر {{htmlelement("strong")}}، وبالتالي علينا إغلاق العنصر {{htmlelement("strong")}} ويليه الآخر. فالشكل التالي ليس صحيحاً:

- -
<p>My cat is <strong>very grumpy.</p></strong>
- -

على العناصر أن تُفتَح وتُغلَق بشكل صحيح ليكونوا بشكل واضح داخل أو خارج بعضهم البعض. فإذا تشابكوا بشكل خاطئ كما في الأعلى، سيقوم متصفحك بمحاولة القيام بأفضل تخمين حيال ما تحاول القيام به، والذي قد يؤدي إلى نتائج غير متوقعة.

- -

العناصر الفارغة

- -

بعض العناصر لا يوجد فيها محتوىً. تُدعى تلك العناصر بالعناصر الفارغة. خذ العنصر {{htmlelement("img")}} الموجود في شيفرة المقالة هذه التي تقرأها على سبيل المثال:

- -
<img src="images/firefox-icon.png" alt="My test image">
- -

يحتوي هذا العنصر على خاصيتيّن، ولكن، إن لاحظت، لا يوجد وسم الإغلاق <img/>، ولا يوجد محتوىً بداخل العنصر. هذا بسبب أنَّ عنصر الصورة لا يحيط بمحتوىً كي يؤثر عليه، فهدفه ببساطة تضمين صورة في الصفحة وحسب.

- -

تشريح وثيقة لغة ترميز النص الفائق

- -

لحد الآن قمنا بتغطية بعض العناصر الفردية الأساسية في هذه اللغة، ولكن تلك العناصر ليست بتلك الفائدة لوحدها. الآن سنأخذ نظرة حول كيف يمكن للعناصر الفردية أن تنمزج معاً لتشكل صفحة ويب متكاملة. دعنا نعاود رؤية الشفرة البرمجية التي وضعنها في مثالنا عن الملف index.html (الذي استخدمناه في مقالة التعامل مع الملفات):

- -
<!DOCTYPE html>
-<html>
-  <head>
-    <meta charset="utf-8">
-    <title>My test page</title>
-  </head>
-  <body>
-    <img src="images/firefox-icon.png" alt="My test image">
-  </body>
-</html>
- -

في هذا المثال لدينا:

- -
    -
  • التعليمة <!DOCTYPE html>. تحدد هذه التعليمة نوع الوثيقة. في فترة سابقة من الزمن، عندما كانت لغة ترميز النص السابق تقنية يافعة (في حوالي 1991/2)، كان المقصود من doctypes أن تكون بمثابة روابط لمجموعة من القواعد التي يجب على وثائق لغة ترميز النص الفائق أن تتبعها لتعتبر صالحة. ولكن مع مرور الزمن، وفي هذه الأيام تحديداً، لا أحد يهتم حقاً حيال هذه التعليمة بعد الآن، فهي مجرد تحفة أثرية كانت تُضمَّن في كل شيء ليعمل بشكل صحيح. هذا كل ما نريد منك أن تعرفه حالياً.
  • -
  • التعليمة <html></html>. يحيط هذا العنصر بجميع محتويات الصفحة، ويعرف باسم "العنصر الجذر".
  • -
  • التعليمة <head></head>. يعمل هذا العنصر كحاوي لجميع الأشياء التي تريد تضمينها في صفحتك والتي لا تعد محتوىً تريد إظهاره لزوار موقعك. هذا يتضمن الأشياء مثل الكلمات المفتاحية ووصف الصفحة الذي ترغب في إظهاره في نتائج البحث، وشيفرة صفحات الأنماط الانسايبية لتنسيق المحتوى، والإعلان عن نوع ترميز النص، والكثير من الأمور الأخرى.
  • -
  • التعليمة <body></body>. يحتوي هذا العنصر على محتوى الذي تريد إظهاره لزوارك، سواءً كان نصاً، أو صورة، أو فيديو، أو لعبة، أو ملف صوتي، أو أياً كان.
  • -
  • التعليمة <"meta charset="utf-8>. يحدد هذا العنصر الترميز الذي تستخدمه صفحتك، والذي هو في مثالنا الترميز UTF-8. يتضمن نوع الترميز هذا معظم المحارف والرموز من الغالبية العظمة من اللغات البشرية المكتوبة. الآن يمكن التعامل مع أي محتوى نصي تقوم بوضعه. عليك أن تلتزم دائماً بتعريف هذا العنصر، فهو يساعد على تجاوز العديد من المشكلات في وقت لاحق.
  • -
  • التعليمة <title></title>. يقوم هذا العنصر بتحديد عنوان صفحتك، والذي هو العنوان الذي يظهر في نافذة المتصفح التي يتم تحميل الصفحة فيها. كما يستخدم أيضاً لوصف الصفحة عندما تقوم بإضافتها للمفضلة.
  • -
- -

الصور

- -

دعنا نوجه إنتباهنا إلى العنصر {{htmlelement("img")}} مجدداً:

- -
<img src="images/firefox-icon.png" alt="My test image">
- -

كما قلنا سابقاً، يقوم هذا العنصر بتضمين صورة في صفحتنا في موضع مُعين. يتم تحديد الصورة باستخدام السِمَة src، والتي تأخذ مسار الصورة كقيمة.

- -

كما قمنا أيضاً بإضافة السِمَة alt. تقوم هذه السِمَة بإضافة وصف للصورة للمستخدمين الذين لايمكنهم رؤية الصورة، وقد يكون هذا بسبب:

- -
    -
  1. نظرهم الضعيف. المستخدمين الذي لديهم إعاقات بصرية كبيرة غالباً ما يستخدمون أدوات تسمى قارئات شاشة لقراءة النص البديل لهم.
  2. -
  3. حدوث شيء ما خاطئ جعل الصورة لاتظهر. على سبيل المثال، حاول تغيير مسار الصورة داخل السمة src واجعله خاطئ عمداً. إذا قمت بحفظ وإعادة تحميل الصفحة، يجب أن ترى شيء من هذا القبيل مكان الصورة:
  4. -
- -

- -

النص البديل (alt text) هو "نص وصفي". النص البديل الذي عليك كتابته يجب أن يوفر للقارئ معلومات كافية ليصبح لديه فكرة جيدة عما تعنيه الصورة. في هذا المثال، النص البديل الذي استخدمناه "My test image" ليس جيداً على الإطلاق. يمكننا استخدام نص بديل أفضل منه بكثير يعبر عن شعار فايرفوكس خاصتنا وهو "The Firefox logo: a flamin fox surrounding the Earth" ("شعار فايرفوكس: ثعلب مُشتعِل يحيط بِكُرَة أرضيّة"، والذي هو، كما ترى، وصف دقيق للصورة).

- -

حاول التفكير ببعض النصوص البديلة الأفضل لصورك.

- -
-

ملاحظة: اعثر على المزيد حول الإتاحة في مقالة الإتاحة على شبكتنا.

-
- -

التعامل مع النصوص

- -

في هذا القسم سنغطي بعضاً من العناصر الأساسية في لغة ترميز النص الفائق التي نستخدمها للتعامل مع المحتويات النصيّة.

- -

العناوين

- -

تتيح لك عناصر العنونة (heading elements) القدرة على تحديد جزء معين من النص على أنَّه عنوان رئيسي - أو فرعي - من محتواك. فكما يملك الكتاب عنوان رئيسي، وعناوين رئيسية وفرعية للفصول، تملك وثيقة لغة ترميز النص الفائق هذه الخاصية أيضاً. تحتوي لغة ترميز النص الفائق على ست مستويات عنونة، تبدأ من {{htmlelement("h1")}} إلى {{htmlelement("h6")}}، على الرغم من أنك لن تستخدم عادةً أكثر من ثلاث أو أربع مستويات:

- -
<h1>My main title</h1>
-<h2>My top level heading</h2>
-<h3>My subheading</h3>
-<h4>My sub-subheading</h4>
- -

والآن حاول أن تضيف عنوان مناسب لصفتحك أعلى العنصر {{htmlelement("img")}}.

- -

الفقرات

- -

كما شرحنا أعلاه، تقوم العناصر {{htmlelement("p")}} باحتواء فقرات من النص. سنستخدم هذا العنصر بشكل متكرر عندما سنضيف محتويات نصيّة عاديّة:

- -
<p>This is a single paragraph</p>
- -

قم بإضافة بعض الفقرات أسفل العنصر {{htmlelement("img")}} وشاهد ماذا سيحدث.

- -

القوائم

- -

تستخدم القوائم في الكثير من مواقع الويب، وتملك لغة ترميز النص الفائق عناصر خاصة لذلك. دائماً ما تحوي القوائم عنصرين على الأقل. أكثر أنواع القوائم شيوعاً هي القوائم المرتبة والغير مرتبة:

- -
    -
  1. تُستخدَم القوائم الغير مرتبة (unordered lists) مع القوائم التي لايكون فيها الترتيب أمراً مهماً، كقوائم التسوُّق مثلاً. تُحاط تلك القوائم بالعنصر {{htmlelement("ul")}}.
  2. -
  3. تُستخدَم القوائم المرتبة (ordered lists) مع القوائم التي يكون فيها الترتيب أمراً مهماً، كقوائم وصفات الطعام. تُحاط تلك القوائم بالعنصر {{htmlelement("ol")}}.
  4. -
- -

كل عنصر من القائمة يوضع داخل العنصر {{htmlelement("li")}} (والذي هو اختصار لـ list item).

- -

على سبيل المثال، إذا أردنا تحويل جزء من هذه الفقرة إلى قائمة كالتالية:

- -
<p>At Mozilla, we’re a global community of technologists, thinkers, and builders working together ... </p>
- -

يجب علينا تعديل الشفرة إلى الشكل الآتي:

- -
<p>At Mozilla, we’re a global community of</p>
-
-<ul>
-  <li>technologists</li>
-  <li>thinkers</li>
-  <li>builders</li>
-</ul>
-
-<p>working together ... </p>
- -

حاول إضافة قائمة مرتبة أو غير مرتبة إلى مثال صفحتك.

- -

الروابط

- -

تُعَد الروابط عناصر مهمة للغايّة، فهي ما تجعل من الويب ويب! يتم استخدام العنصر {{htmlelement("a")}} لإضافة الروبط. الحرف "a" هو اختصار للكلمة الإنجليزيّة "anchor" (مرساة). لتحويل نص في فقرتك إلى رابط عليك اتباع الخطوات التالية:

- -
    -
  1. اختر نصاً ما. لقد اخترنا النص "Mozilla Manifesto" لمثالنا هذا.
  2. -
  3. قم بإحاطة النص بالعنصر {{htmlelement("a")}}، كما أدناه: -
    <a>Mozilla Manifesto</a>
    -
  4. -
  5.  أضف السِمَة href للعنصر {{htmlelement("a")}}، كما أدناه: -
    <a href="">Mozilla Manifesto</a>
    -
  6. -
  7. قم بملء قيمة السِمَة href بعنوان الويب الذي تريد أن تفتحه من خلال الرابط، كما أدناه: -
    <a href="https://www.mozilla.org/en-US/about/manifesto/">Mozilla Manifesto</a>
    -
  8. -
- -

قد تحصل على نتائج غير متوقعة إذا نسيت وضع https:// أو http://. يسمى هذا الجزء الموجود ببداية عنوان الويب بالبروتوكول. بعد الإنتهاء من صنع الرابط قم بالضغط عليه لتتأكد أنه يرسلك حيثما أردت.

- -
-

الكلمة href قد تبدو خيار غريب لاسم السِمَة للوهلة الأولى. إذا كنت تواجه مشكلة في تذكر اسم السمة تلك، حاول أن تتذكر أنها إختصار لـ hypertext reference (مرجع نص تشعبي).

-
- -

جرِّب إضافة رابط لصفحتك كما تعلمت.

- -

الخاتمة

- -

إذا كنت قد تابعت المقالة من البداية بحذافيرها ينبغي في النهاية على صفحة مماثلة للصورة أدناه (يمكنك رؤيتها أيضاً من هنا):

- -

A web page screenshot showing a firefox logo, a heading saying mozilla is cool, and two paragraphs of filler text

- -

إذا واجهتك مشاكل يمكنك دائماً مقارنة عملك مع الشفرة المصدرية خاصتنا على جيتهاب.

- -

في هذه المقالة لم نناقش سوى أمور سطحية في لغة ترميز النص الفائق. يمكنك مطالعة المزيد في قسم تعلم لغة ترميز النص الفائق على شبكتنا.

- -

{{PreviousMenuNext("Learn/Getting_started_with_the_web/Dealing_with_files", "Learn/Getting_started_with_the_web/CSS_basics", "Learn/Getting_started_with_the_web")}}

- -

في هذه الوحدة أيضاً

- - diff --git a/files/ar/learn/getting_started_with_the_web/index.html b/files/ar/learn/getting_started_with_the_web/index.html deleted file mode 100644 index ff4642f58e..0000000000 --- a/files/ar/learn/getting_started_with_the_web/index.html +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: البدء مع الويب -slug: Learn/Getting_started_with_the_web -tags: - - البدء مع الويب - - دليل - - صفحة هبوط - - مبتدئين -translation_of: Learn/Getting_started_with_the_web ---- -
{{LearnSidebar}}
- -
-

البدء مع الويب هي سلسلة موجزة تُعرِّفُك على عملية تطوير الويب. سوف نبدأ معك من إعداد الأدوات التي ستحتاجها لبناء صفحة ويب بسيطة وصولاً لعمليّة نشرها.

-
- -

قصة موقعك الأوَّل

- -

من الصعب إنشاء موقع ويب احترافي، لذلك إن  كنت جديداً على تطوير الويب نشجعك على أن تبدأ بشيء صغير. لن تستطيع بناء فيسبوك آخر حالاً، ولكن ليس من الصعب إنشاء موقع بسيط خاص بك على الإنترنت، لذلك سنبدأ من تلك النقطة.

- -

من خلال متابعة المقالات المسرودة بالترتيب أدناه، سوف تبدأ من لا شيء حتى تحصل على موقعك الأول على الإنترنت. هيا بنا نبدأ!

- -

كيف يعمل الويب

- -

عندما تدخل إلى مواقعك المفضلة، تحصل العديد من الأمور المعقدة في الخلفيّة التي قد لا تعلمها. في مقالة كيف يعمل الويب قمنا بشرح ما الذي يحدث عندما تقوم بعرض صفحات الويب على حاسبك.

- -

تثبيت البرمجيات الأساسية

- -

عندما يتعلق الأمر بالأدوات لبناء موقع فهناك الكثير منها لتختار. إذا كنت مازلت في بداية مشوراك، قد تكون مشوشاً من عدد محررات النصوص، وأطر العمل، وأدوات الاختبار الموجودة. في مقالة تثبيت البرمجيات الأساسية قمنا بعرض خطوة بخطوة كيفيّة تثبيت البرمجيات التي تحتاجها لبداية بسيطة في تطوير الويب.

- -

كيف سيكون مظهر موقعك؟

- -

قبل أن تبدأ في كتابة شيفرة موقعك، يجب أن تخطط أولاً. ما المعلومات التي تعرضها؟ ما الخطوط والألوان التي تستخدمها؟ كيف سيكون مظهر موقعك؟ لقد قمنا بعنونة الطريقة البسيطة التي يمكنك اتباعها للتخطيط لمحتوى موقعك وتصميمه.

- -

التعامل مع الملفات

- -

يتألف الموقع من العديد من الملفات: المحتوى النصي، والنص المصدري (البرمجيات)، وملفات التصميم (ملفات الأنماط)، والوسائط، والكثير من الملفات الأخرى.
- عندما تبني موقعك، سوف تحتاج لتجميع جميع تلك الملفات بهيكليّة منطقيّة، وتتأكد من أنَّهم قادرين على الوصول لبعضهم البعض.
- مقالة التعامل مع الملفات تشرح كيف يمكنك إعداد هيكلة ملفات منطقيّة لموقعك، وما المشاكل التي يجب أن تكون حذر منها.

- -

أساسيات لغة ترميز النص الفائق

- -

لغة ترميز النص الفائق (HTML) هي التعليمات المُستخدمة لهيكلة محتويات الويب وإعطائها معنىً (دلالة) وهدف. على سبيل المثال، هل محتوايَ هو مجموعة من الفقرات، أو قائمة نقطيّة؟ هل لدي صورة مدرجة في صفحتي؟ هل لدي جدول بيانات؟ من دون إرباكك، مقالة أساسيات لغة ترميز النص الفائق توفر معلومات كافية لجعلك على وفاق مع هذه اللغة.

- -

أساسيات صفحات الأنماط الانسيابية CSS 

- -

صفحات الأنماط الانسيابية (او التنسيقات المتعاقبة) (CSS) هي التعليمات المُستخدمة لتنسيق موقعك. حيث تدير هذه التنسيقات الجوانب الفنية البصرية للموقع بدأً من الالوان والخطوطمرورا بالتحكم باحجام وابعاد وهوامش العناصر وتوزيعها وانتهائا بالتأثيرات التصميمية والتحريكية للعناصر (Animation).   
- فعلى سبيل المثال، هل أريد ان يكون لون النص أسود أم أحمر؟ هل هناك اطار لعنصر معين ماهي الوانه وابعاده؟ كم المسافة بين الاطار والمحتوى؟كم يبعد عن العناصر المجاورة؟ أين يجب أن يظهر المحتوى على الشاشة؟
- مقالة أساسيات صفحات الأنماط الانسيابية CSS تطلعك على ما تحتاج معرفته لتبدأ مع هذه اللغة.

- -

أساسيات الجافاسكربت

- -

جافاسكربت هي اللغة البرمجة المُستخدمة لإضافة مزايا تفاعليّة لموقع. بدا من ادارة ما يجب فعله عند تفاعل المستخدم كضغط احد الازرار، مرورا بجلب بيانات من مصادر متعددة، وتفريغ هذه البيانات على شكل عناصر او رسومات بيانية او في جداول  (حيث نلجا لجمل التكرار وبعض الحسابات). انتهاءا بتطبيقات اكثر تعقيدا كالالعاب واضافة التاثيرات التصميمية الديناميكية.
- مقالة أساسيات الجافاسكربت سوف تقدم لك فكرة عمّا هو ممكن القيام به بهذه اللغة المثيرة، وكيف يمكنك أن تبدأ معها.

- -

نشر موقعك

- -

حالما تنتهي من تجهيز موقعك وتنظيم ملفاتك البرمجية وملفات المحتوى المكونة للموقع، سوف تحتاج إلى وضع موقعك على الإنترنت حتّى يتمكن الناس من العثور عليه. في مقالة نشر موقعك سنتكلم عن كيف يمكنك وضع شيفرتك البسيطة على الأنترنت بأقل مجهود.

diff --git a/files/ar/learn/getting_started_with_the_web/installing_basic_software/index.html b/files/ar/learn/getting_started_with_the_web/installing_basic_software/index.html deleted file mode 100644 index 9d945d2ffd..0000000000 --- a/files/ar/learn/getting_started_with_the_web/installing_basic_software/index.html +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: تثبيت البرمجيات الأساسية -slug: Learn/Getting_started_with_the_web/Installing_basic_software -tags: - - أدوات - - أساسيات - - البدء مع الويب - - تعلم - - مبتدئين - - محرر نصوص -translation_of: Learn/Getting_started_with_the_web/Installing_basic_software ---- -
{{LearnSidebar}}
- -
{{NextMenu("Learn/Getting_started_with_the_web/What_will_your_website_look_like", "Learn/Getting_started_with_the_web")}}
- -
-

في هذه المقالة، سوف نعرض ما هي الأدوات التي تحتاجها في عملية تطوير الويب، وكيف تقوم بتثبيتها بشكل صحيح.

-
- -

ما هي الأدوات التي يتسخدمها المحترفون؟

- -
    -
  • حاسوب. قد يبدو هذا غريباً لبعضٍ من الناس، ولكن البعض منكم يقرأ هذه المقالة من هاتفه أو من حاسب المكتبة. لعمليّة تطوير ويب جادة، من الأفضل أن تستخدم حاسب مكتبي أو حاسب محمول (بنظام ويندوز، أو ماك، أو لينُكس).
  • -
  • محرر نصوص لكتابة الشيفرة فيه. قد يكون هذا المحرر محرر نصوص (مثل Brackets، أو Atom، أو Visual Studio Code)، أو محرر هجين (مثل Dreamweaver، أو WebStorm). محررات الوثائق المكتبيّة لن تكون مناسبة لهذا الاستخدام؛ لأنها تعتمد على عناصر خفيّة (hidden elements) والتي تتداخل مع محركات العرض المُستخدمة في متصفحات الويب.
  • -
  • متصفح ويب لتجربة الشيفرة فيه. حالياً أكثر المتصفحات استخداماً هي: فايرفوكس، وجوجل كروم، وأوبرا، وسفاري، وإنترنت إكسبلورر، ومايكروسوفت أيدج. يجب عليك أيضاً تجربة أداء موقعك على الهواتف وعلى المتصفحات القديمة التي قد مايزال جمهورك المُستهدف يستخدمها على نطاق واسع (مثل IE 8–10).
  • -
  • محرر رسومات، مثل GIMP، أو Paint.NET ، أو Photoshop لتصنع صور لصفحتك.
  • -
  • نظام تحكم بالإصدارات لتدير الملفات على الخادم، وتساهم في مشروع مع فريق، ولتشارك الشيفرة والملفات، ولتتجنب تضارب التعديلات. لحد الآن يعتبر جيت أكثر أدوات التحكم بالإصدارات شيوعاً، كما تعد خدمة الإستضافة جيتهاب المبنيّة على جيت الأكثر شيوعاً في مجال استضافة المشاريع.
  • -
  • برنامج FTP المُستخدم على حسابات استضافات الويب القديمة لإدارة الملفات على الخادم (يزداد استخدام جيت لهذا الغرض، مؤخراً، بدلاً من برمجيات FTP التقليديّة). هناك الكثير من برامج FTP المتوافرة ومنها Cyberduck، وFetch، وFileZilla.
  • -
  • نظام أتمتة مثل Grunt أو Gulp لأتمتة بعض المهمات التكراريّة، مثل تصغير حجم الشيفرة واختبارها.
  • -
  • القوالب، والمكتبات، وأطر العمل، ...إلخ لتسريع كتابة الوظائف الشائعة.
  • -
  • بالإضافة للمزيد من الأدوات!
  • -
- -

ما الأدوات التي احتاجها حالياً؟

- -

تلك القائمة تبدو مرعبة، ولكن لحسن الحظ تستطيع البدء بتطوير الويب بدون معرفة أي شيء عن معظم تلك الأدوات. في هذه القائمة سنقوم بإعداد الحد الأدنى من تلك الأدوات (محرر النصوص وبعض متصفحات الويب العصريّة).

- -

تثبيت محرر النصوص

- -

أنت على الأرجح تملك محرر نصوص بدائي (بسيط) على حاسبك. فيأتي الويندوز بشكل أفتراضي متضمناً برنامج Notepad ويأتي نظام الماك مع TextEdit. تختلف توزيعات لينكس بالمحرر الإفتراضي، فتأتي أبونتو مثلاً بمحرر gedit.

- -

من أجل تطوير الويب، يمكنك على الأرجح استخدام شيء أفضل من Notepad أو TextEdit. نحن نوصي ببدء استخدام Brackets، فهو محرر مجاني يقدم ميزة العرض الحي والتلميحات (code hints).

- -

تثبيت المتصفحات العصريّة

- -

سنقوم حالياً بتثبيت بضعة متصفحات ويب فقط لتجربة شيفرتنا. اختر نظام تشغيلك أدناه وانقر على الروابط المرفقة لتحميل مثبتات متصفحاتك المفضلة:

- - - -

قبل أن تبدأ، يجب على الأقل أن تُثبِت متصفحين من المتصفحات السالف ذكرها حتى يكونوا جاهزين للعمل.

- -

تثبيت خادم ويب محلي

- -

بعض الأمثلة ستحتاج لِأن تعمل عبر خادم ويب. تستطيع إيجاد طريقة القيام بذلك من خلال مقالة كيف تُعِد خادم اختبار محلي؟

- -

{{NextMenu("Learn/Getting_started_with_the_web/What_will_your_website_look_like", "Learn/Getting_started_with_the_web")}}

- -

في هذه الوحدة أيضاًEdit

- - diff --git a/files/ar/learn/getting_started_with_the_web/javascript_basics/index.html b/files/ar/learn/getting_started_with_the_web/javascript_basics/index.html deleted file mode 100644 index 130aeeed41..0000000000 --- a/files/ar/learn/getting_started_with_the_web/javascript_basics/index.html +++ /dev/null @@ -1,422 +0,0 @@ ---- -title: أساسيات الجافاسكربت -slug: Learn/Getting_started_with_the_web/JavaScript_basics -tags: - - برمجة سكربتات - - تعلم - - جافاسكربت - - مبتدئ - - ويب -translation_of: Learn/Getting_started_with_the_web/JavaScript_basics ---- -
{{LearnSidebar}}
- -
{{PreviousMenuNext("Learn/Getting_started_with_the_web/CSS_basics", "Learn/Getting_started_with_the_web/Publishing_your_website", "Learn/Getting_started_with_the_web")}}
- -
-

جافا سكريبت هي لغة البرمجة التي تضيف التفاعل إلى موقع الويب الخاص بك (على سبيل المثال: الألعاب، والردود عندما يتم الضغط على أزرار أو إدخال البيانات في النماذج، والتصميم الديناميكي، والرسوم المتحركة). تساعدك هذه المقالة على البدء في هذه اللغة المثيرة وتعطيك فكرة عن ما هو ممكن.

-
- -

ما هي جافاسكريبت، حقاً؟

- -

{{Glossary("JavaScript")}} ("JS" للإختصار)هي بشكل كامل {{Glossary("لغة برمجة ديناميكية ", "لغة برمجة ديناميكية")}} حيت, عندما تطبق على ملف {{Glossary("HTML")}} , يمكن أن توفر التفاعل الديناميكي على المواقع. تم اختراعه من قبل بريندان إيتش، المؤسس المشارك لمشروع موزيلا، ومؤسسة موزيلا، وشركة موزيلا.

- -

جافا سكريبت متعددة الجوانب والاستعمالات بشكل لا يصدق. يمكنك البدء صغير، مع دوارات، معارض الصور، مخططات بيانية، والاستجابات لنقرات زر. مع المزيد من الخبرة، عليك أن تكون قادرا على خلق الألعاب، والرسوم المتحركة 2D و 3D الرسومات، تطبيقات شاملة لقاعدة البيانات، وأكثر من ذلك بكثير!

- -

جافا سكريبت نفسها المدمجة إلى حد ما إلى الآن مرنة جدا. وقد كتب المطورين مجموعة كبيرة ومتنوعة من الأدوات على رأس لغة جافا سكريبت الأساسية، وفتح كمية هائلة من وظائف إضافية مع الحد الأدنى من الجهد. وتشمل هذه:

- -
    -
  • متصفح واجهات برمجة التطبيقات ({{Glossary("API","APIs")}})  المدمج في متصفحات الويب، وتوفير وظائف مثل إنشاء HTML ديناميكيا ووضع أنماط CSS، وجمع وتلاعب في دفق الفيديو من كاميرا ويب المستخدم، أو توليد الرسومات 3D وعينات الصوت.
  • -
  •  APIs الطرف الثالث  يسمح للمطورين بدمج الوظائف في مواقعهم من موفري المحتوى الآخرين، مثل تويتر أو فاسيبوك.
  • -
  • أطر ومكتبات الطرف الثالث التي يمكن تطبيقها على HTML الخاص بك للسماح لك لبناء المواقع والتطبيقات بشكل أسرع.
  • -
- -

نظرا لأن هذه المقالة من المفترض أن تكون مقدمة خفيفة لجافا سكريبت، فلن نربكك في هذه المرحلة من خلال الحديث بالتفصيل عن الفرق بين لغة جافا سكريبت الأساسية والأدوات المختلفة المذكورة أعلاه. يمكنك معرفة كل ذلك بالتفصيل في وقت لاحق، في منطقتنا لتعليم جافا سكريبت، وفي بقية MDN.

- -

أدناه سوف أعرض لكم لبعض جوانب اللغة الأساسية، وعليك أن تلعب أيضا مع عدد قليل من الميزات API المتصفح أيضا. إستمتع!

- -

مثال "hello world"

- -

قد يبدو القسم أعلاه مثير حقا، ولذا ينبغي أن - جافاسكريبت هي واحدة من تقنيات الويب الأكثر حيوية، وأثناء البدء في الحصول على ماهو جيد في استخدامه، مواقعك الخاصة سوف تدخل بك إلى بعداً جديداً من القوة والإبداع.

- -

ومع ذلك، لتصبح مرتاح مع جافا سكريبت أصعب قليلا من أن تصبح مرتاح مع HTML و CSS. قد تضطر إلى أن تبدأ صغيراً وتظل تعمل في خطوات صغيرة منسقة . للبدء، سنعرض لك كيفية إضافة بعض أساسيات جافا سكريبت إلى صفحتك، وإنشاء "hello world!" مثال (المعيار في أمثلة البرمجة الأساسية).

- -
-

هام: إذا لم تكن متابعاً لبقية الدورة التدريبية، فيمكنك تنزيل شيفرة المثال هذا واستخدامه كنقطة بداية.

-
- -
    -
  1. أولا، انتقل إلى موقع الاختبار الخاص بك وإنشاء مجلد جديد يسمى 'scripts' (بدون علامات الاقتباس). ثم، داخل مجلد scripts الجديد الذي قمت بإنشائه، إنشاء ملف جديد يسمى main.js. إحفظه في مجلد scripts.
  2. -
  3. بعد ذلك، في ملف index.html، أدخل العنصر التالي في سطر جديد قبل علامة الإغلاق <body/> مباشرة: -
    <script src="scripts/main.js"></script>
    -
  4. -
  5. هذا بكل بساطة يعمل كما يعمل {{htmlelement("link")}} للـCSS، يقوم بإضافة الجافاسكربت للصفحة، لترى التأثيرات على الصفحة.
  6. -
  7. الآن اضف هذا الكود الى ملف main.js: -
    var myHeading = document.querySelector('h1');
    -myHeading.textContent = 'Hello world!';
    -
  8. -
  9. الآن تأكد أنك حفظت التعديلات على ملف HTML و الجافاسكربت. ثم قم بفتح ملف الHTML بالمتصفح، ينبغى ان تشاهد نتيجة مماثلة للصورة:
  10. -
- -
-

ملاحظة: السبب لأننا اضفنا {{htmlelement("script")}} قرب نهاية ملف HTML لأن المتصفح يقرأ الملف بالترتيب من السطر الأول الى الأخير. فإذا كان ملف الجافاسكربت يقوم بتعديل ملف الHTML ولكن ملف الجافاسكربت عمل قبل ان يتم تحميل HTML بشكل كامل فلن يعمل بشكل صحيح. لذلك يفضل دائما اضافة ملفات الجافاسكربت بنهاية ملف الHTML

-
- -

مالذي حدث؟

- -

الآن العنوان اصبح "Hello world!" بإستخدام الجافاسكربت. فعلت ذلك بإستخدام دالة تسمى {{domxref("Document.querySelector", "querySelector()")}} لحفظ مرجع للعنوان وحفظه الى متغير يسمى myHeading. هذا قريب جدا لما تفعله بإستخدام CSS، اذا اردت ان تقوم بتعديل احد العناصر يجب اختياره مسبقا.

- -

بعد ذلك، حددت قيمة خاصية {{domxref("Node.textContent", "textContent")}}  للمتغير myHeading الى "Hello world!"

- -
-

ملاحظة: جميع الخواص اللاتي استخدمتهن بالأعلى هي جزء من Document Object Model (DOM) API, الذي يسمح لك بالتعديل على الصفحات.

-
- -

أساسيات اللغة ودورة بسيطة

- -

لنتعلم بعض المميزات الأساسية بلغة الجافاسكربت، لتفهم كيف تعمل. نقطة مهمة هي أن اغلب المفاهيم تتشارك معها اللغات البرمجية الأخرى، لذلك اذا كسبت خبرة بهذه المفاهيم، يمكنك برمجة كل ما تريد!

- -
-

مهم: في هذا الدرس، جرب بأن تكتب الأكواد في كونسول الجافاسكربت لترى ماذا تعمل. لمعرفة المزيد عن الكونسول القِ نظرة على هذا الدرس Discover browser developer tools.

-
- -

المتغيرات

- -

{{Glossary("Variable", "Variables")}} هي مثل الصناديق نقوم بتخزين البيانات فيها. تبدأ اولا بتعريف المتغير بإستخدام كلمة var وبعدها تسميها بالإسم الذي ترغب به:

- -
var myVariable;
- -
-

ملاحظة: الفاصلة المنقوطة بنهاية السطر تعني أن السطر البرمجي ينتهي هنا; لكنها ليست مطلوبة الا اذا احتجت ان تدمج اكثر من سطر برمجي في سطر برمجي واحد. لذلك من الأفضل وما هو متعارف عليه ان تقوم بإضافة الفاصلة المنقوطة نهاية كل سطر برمجي لتفادي الأخطاء البرمجية الغير مقصودة. بالطبع هناك قواعد متى يفضل إستخدامها ومتى لا يفضل، للمزيد يمكنك الإطلاع على Your Guide to Semicolons in JavaScript.

-
- -
-

ملاحظة: يمكنك تسمية المتغيرات بالإسم الذي تفضله. لكن هناك بعض الشروط التي ينبغي الإلتزام بها (إطلع على هذا الدرس variable naming rules). إذا ما كنت غير متأكد انه يمكنك استخدام اسم معين ام لا يمكنك إستخدام هذا الموقع يمكنك إستخدام هذا الموقع  للتأكد أن الإسم صالح للإستخدام.

-
- -
-

ملاحظة: الجافاسكربت حساسة لحجم الحرف الإنجليزي, مثلا myVariable يعتبر متغير اخر عن myvariable . لذلك دائما اذا واجهت مشكلة تأكد من احجام حروف المتغيرات لديك.

-
- -

بعد تعريف المتغير يمكنك إسناد قيمة إليه:

- -
myVariable = 'Bob';
- -

يمكنك ايضا أن تعرف المتغير وتسند إليه قيمه بنفس الوقت:

- -
var myVariable = 'Bob';
- -

يمكنك الحصول على قيمة المتغير بإستخدام إسم المتغير:

- -
myVariable;
- -

يمكنك أيضا تغيير قيمة المتغير متى ما أردت:

- -
var myVariable = 'Bob';
-myVariable = 'Steve';
- -

بإمكانك تخزين انواع مختلفة من البيانات بالمتغيرات انواع البيانات:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
نوع المتغيرشرحمثال
{{Glossary("String")}}نص محاط بعلامات التنصيصvar myVariable = 'Bob';
{{Glossary("Number")}}رقم, لاحظ أن الأرقام لا نحيطها بعلامات التنصيصvar myVariable = 10;
{{Glossary("Boolean")}}قيمة صحيحة  true او خاطئة false هي كلمات خاصة بالجافاسكربت لا تحتاج علامات تنصيصvar myVariable = true;
{{Glossary("Array")}}قائمة تحتوي على عدة بيانات بإسم متغير واحدvar myVariable = [1,'Bob','Steve',10];
- بإمكانك إستدعاء كل قيمة بالمصفوفة بهذا الشكل:
- myVariable[0], myVariable[1], الخ.
{{Glossary("Object")}}بكل بساطة كل شيء بالجافاسكربت عبارة عن كائن. ويمكنك تخزينه بإسم متغير. تذكر ذلك وانت تتعلمvar myVariable = document.querySelector('h1');
- All of the above examples too.
- -

لماذا نحتاج المتغيرات؟ نحتاج المتغيرات اذا اردنا ان نبرمج اي شيء قيمته تتغيّر. على سبيل المثال تعديل رسالة ترحيب بعضو جديد، فمن غير المعقول ان تكتب رسالة خاصة لكل عضو جديد بل تستخدم المتغيرات لتعديل الرسالة على حسب إسم المستخدم.

- -

التعليقات

- -

يمكنك كتابة التعليقات كما تفعل بلغة الـCSS:

- -
/*
-أي شيء هنا يعتبر تعليق.
-*/
- -

اذا كان تعليقك لا يتكون الا من سطر واحد يمكنك إستخدام الطريقة السهلة التالية:

- -
// هذا تعليق
-
- -

العوامل الحسابية

- -

{{Glossary("operator")}} هو عامل حسابي ينتج لنا نتيجة بإستخدام اكثر من قيمة أو متغير. بالجدول التالي يمكنك الإطلاع على بعض الأمثلة على كيفية استخدامهم وتجربتهم بكونسول الجافاسكربت:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
العامل الحسابيشرحالرمزمثال
الجمعيستخدم لجمع الأرقام أو لدمج النصوص مع بعضهم البعض+6 + 9;
- "Hello " + "world!";
الطرح, الضرب, القسمةبالطبع تعمل كما تعمل بالرياضيات-, *, /9 - 3;
- 8 * 2; // نستخدم رمز النجمة للضرب
- 9 / 3;
-

الإسناد

-
كما تعلمت مسبقا. نستخدم علامة يساوي واحدة لإسناد قيمة إلى متغير=var myVariable = 'Bob';
المساواةتقوم بإختبار قيمتين. اذا كانو متساويين تقوم بإرجاع قيمة صح true  وإذا كانت خاطئة تقوم بإرجاع قيمة خطأ false===var myVariable = 3;
- myVariable === 4;
ليست, لا تساوي -

ترجع قيمة عكس القيمة المعطاة. فعلى سبيل المثال إذا اعطيتها قيمة صحيحة ترجع لك قيمة خاطئة والعكس صحيح. واذا أستخدمت مع علامة المساواة ترجع صح اذا كانت القيمتين لا يتساوون وترجع خطأ إذا كانوا يتساوون

-
!, !== -

القيمة هنا صحيحة لأن myVariable تساوي 3 لكنها سترجع خطأ لأننا إستخدمنا علامة !

- -

var myVariable = 3;
- !(myVariable === 3);

- -

هنا نجرب "هل المتغير myVariable لا يساوي 3".

- -

لكنه سيرجع قيمة خاطئة لأن myVariable  تساوي 3

- -

var myVariable = 3;
- myVariable !== 3;

-
- -

هناك الكثير للتعلم عن العمليات الرياضية بالجافاسكربت، لكن هذا كافي لهذه المرحلة.إطلع على Expressions and operators للمزيد.

- -
-

ملاحظة: قد تحصل على نتائج غريبة عند إستخدام اكثر من نوع من البيانات بالعمليات الحسابية. لذلك كن حريص بأن تستخدم المتغيرات بشكل صحيح لتحصل على النتيجة المرادة. على سبيل المثال قم بكتابة "35" + "25" بكونسول الجافاسكربت، نتيجة غريبة أليس كذلك؟ لأن علامات التنصيص تقوم بتحويل الأرقام إلى نصوص لذلك عندما جمعتهم بالفعل انت قمت بدمج نصين وليس بجمع رقمين. لذلك جرب كتابة 35 + 25 بالكونسول وسترى النتيجة الصحيحة.

-
- -

الشروط

- -

الأكواد الشَرْطِيّة تسمح لك بإختبار شرط محدد فإذا كان صحيحا يقوم بتشغيل اكواد أخرى. وإذا كان خاطئا يقوم بتجاهل الأكواد. من أكثر الأكواد الشَرْطِيّة إستخداما هي if ... else  والمثال عليها:

- -
var iceCream = 'chocolate';
-if (iceCream === 'chocolate') {
-  alert('Yay, I love chocolate ice cream!');
-} else {
-  alert('Awwww, but chocolate is my favorite...');
-}
- -

الكود الذي بداخل القوسين if ( ... ) هو الإختبار الشَرْطي. يمكنك كتابة الاختبارات بداخله مثال هل المتغير يساوي عدد معين او نص معين. بمالمثال قمنا بإختبار هل المتغير iceCream يساوي القيمة chocolate. بالطبع النتيجة صحيح كما هو واضح امامنا لذلك سيقوم بتشغيل السطور البرمجية بداخل الأقواس {}، لكن ماذا لو كان المتغير لا يساوي chocolate في هذه الحالة ستقوم الجافاسكربت بتشغيل السطور الموجودة بداخل الأقواس {}else.

- -

الدوال

- -

{{Glossary("Function", "Functions")}}  هي طريقة لتجميع السطور البرمجية متى ما أردت إعادة إستخدامها أو لأجل الترتيب. فعلى سبيل المثال لديك كود تريد أن تقوم بتشغيله اكثر من مرة ومن أكثر من مكان، فمن غير المعقول كتابة الكود أكثر من مرة في اكثر من مكان، بل يفضل كتابته مرة واحدة وإسناده إلى دالة تقوم بإستدعائها بإسم الدالة متى ما اردت. تذكر أنك إستخدمت بعض الدوال مسبقا والأمثلة عليها كالتالي:

- -
    -
  1. -
    var myVariable = document.querySelector('h1');
    -
  2. -
  3. -
    alert('hello!');
    -
  4. -
- -

هذه الدوال, document.querySelector و alert, هي دوال جاهزة بالمتصفح يمكنك إستخدامها متى ما أردت.

- -

إذا رأيت شيئا مشابها للمتغيرات لكنه ينتهي بقوسين () غالبا تعني انها دالّة. الدوال عادة تطلب {{Glossary("Argument", "arguments")}} وهي عبارة عن بيانات تحتاجها الدالة لتأدي عملها المطلوب منها. هذه البيانات تكون داخل القوسين () ونقوم بإرسال عدة بيانات بالتفريق بينهم بعلامة الفاصلة , اذا ما دعت الحاجة لذلك.

- -

على سبيل المثال دالة alert() وهي دالة تقوم بإبراز رسالة منبثقة للمستخدم داخل المتصفح. ونحتاج ان نعطيها النص المراد عرضه للمستخدم.

- -

المميز بالموضوع انه يمكنك كتابة الدوال الخاصة بك. بالمثال التالي سنطلع على كيف يمكنك كتابة الدالة والتي تقبل بأن تأخذ رقمين وتقوم بإرجاع ناتج الضرب بينهم:

- -
function multiply(num1,num2) {
-  var result = num1 * num2;
-  return result;
-}
- -

قم بكتابة الكود بالأعلى بكونسول الجافاسكربت ثم قم بتجربة الدالة بإستخدام عدة ارقام، على سبيل المثال:

- -
multiply(4,7);
-multiply(20,20);
-multiply(0.5,3);
- -
-

ملاحظة: كلمة return تخبر الدالة ماذا ينبغي ان تقوم بإرجاعه اذا قمنا بإستدعائها.

-
- -

الأحداث

- -

لبناء صفحات ويب تفاعلية فإننا سنحتاج الى ما يسمى بالأحداث (Events). الفكرة بكل بساطة هي بأن تقوم بربط جزء معين من برنامج ليقوم بالعمل عند حدوث حدثٌ معين. أحد اهم الأحداث وأكثرها إستخداما هو حدث click event وهو يحدث عندما تقوم بالضغط على شيء ما بالفأرة. لنأخذ مثال بسيط يشرح حدث الضغط، قم بنسخ الكود التالي ولصقه بكونسول الجافاسكربت الخاص بك ثم قم بالضغط على أي مكان بالصفحة:

- -
document.querySelector('html').onclick = function() {
-    alert('Ouch! Stop poking me!');
-}
- -

هناك اكثر من طريقة لربط حدث بأحد عناصر الصفحة. في هذا المثال قمنا بإختيار عنصر {{htmlelement("html")}}، وحددنا حدث الضغط عليه onclick وقمنا بإعطاه الحدث دالة مجهولة (من غير إسم)  يقوم بتشغيلها عندما يحصل هذا الحدث (الضغط على العنصر).

- -

لاحظ أن:

- -
document.querySelector('html').onclick = function() {};
- -

مثل:

- -
var myHTML = document.querySelector('html');
-myHTML.onclick = function() {};
- -

لكنها بصيغة اقصر.

- -

تحسين مثال الموقع الخاص بنا

- -

الآن تعلمنا بعض بعض أساسيات الجافاسكربت، لنقم بإضافة بعض الخصائص الرائعة إلى موقعنا الذي تعلمنا عليه بداية الدرس.

- -

إضافة خاصية إستبدال الصور

- -

في هذا الجزء من الدرس. سنضيف صورة جديدة إلى موقعنا بإستخدام الجافاسكربت و DOM API للتبديل بين الصور عند الضغط على الصورة.

- -
    -
  1. بالبداية إبحث عن صورة تود عرضها بالصفحة. تأكد أن الصورة بنفس حجم الصورة السابقة او اقرب
  2. -
  3. احفظ الصورة بمجلد images.
  4. -
  5. غير إسم الصورة إلى firefox2.png.
  6. -
  7. إفتح ملف main.js, وقم بكتابة الكود التالي بالملف. (إذا كنت تحتفظ بالكود بالأمثلة السابقة يفضل حذفه.) -
    var myImage = document.querySelector('img');
    -
    -myImage.onclick = function() {
    -    var mySrc = myImage.getAttribute('src');
    -    if(mySrc === 'images/firefox-icon.png') {
    -      myImage.setAttribute ('src','images/firefox2.png');
    -    } else {
    -      myImage.setAttribute ('src','images/firefox-icon.png');
    -    }
    -}
    -
  8. -
  9. احفظ جميع الملفات ثم قم بفتح ملف index.html بالمتصفح. الآن عندما تضغط على الصورة يجب ان تتحول إلى الصورة الأخرى!
  10. -
- -

كما تلاحظ بالكود فقد قمنا بحفظ مرجع إلى الصورة  {{htmlelement("img")}} بإسم متغير myImage، بعد ذلك نقوم بربط حدث  onclick بدالة مجهولة (بدون اسم) لتعمل عن الضغط على الصورة، الدالة تقوم بعمل التالي:

- -
    -
  1. نقوم بجلب قيمة خاصية  src الخاصة بالصورة.
  2. -
  3. ثم نقوم بالتأكد هل قيمة src الخاصة بالصورة تساوي رابط الصورة الأساسية : -
      -
    1. إذا كانت كذلك فنقوم بتغيير قيمة src بقيمة الصورة الثانية ليتم تحميلها بعنصر {{htmlelement("img")}}.
    2. -
    3.   لكن اذا كانت غير ذلك (بمعنى انه قد قمنا بتغيير القيمة) فسنقوم بإرجاع قيمة src إلى القيمة الأساسية.
    4. -
    -
  4. -
- -

إضافة رسالة ترحيبية مخصصة للمستخدم

- -

الآن سنقوم بكتابة بعض السطور البرمجية لتغيير عنوان الصفحة إلى رسالة مخصصة للمستخدم. حيث سيقوم المستخدم بإدخال إسمه ثم نقوم بإضافة إسمه إلى العنوان عندما يقوم بالدخول إلى الصفحة. سنقوم بتخزين إسم المستخدم بخاصية تخزين البيانات الموجودة بالمتصفح التي تسمى Web Storage API. وسنقوم أيضا بإضافة خيار لتغيير إسم المستخدم.

- -
    -
  1. بملف index.html, قم بإضافة هذا السطر قبل عنصر {{htmlelement("script")}}: - -
    <button>Change user</button>
    -
  2. -
  3. بملف main.js, قم بإضافة هذا الكود في آخر الملف كما هي، الكود يقوم بتخزين مرجع للزر والعنوان بمتغيرات: -
    var myButton = document.querySelector('button');
    -var myHeading = document.querySelector('h1');
    -
  4. -
  5. الآن قم بإضافة هذه الدالة التي تقوم بتخزين إسم المستخدم بقاعدة بيانات المتصفح: -
    function setUserName() {
    -  var myName = prompt('Please enter your name.');
    -  localStorage.setItem('name', myName);
    -  myHeading.textContent = 'Mozilla is cool, ' + myName;
    -}
    - الدالة كما تلاحظ تقوم بإستخدام دالة  prompt() والتي تقوم بإظهار رسالة منبثقة للمستخدم مشابهه لدالة  alert() لكنها تطلب منه إدخال بعض البيانات. وتقوم بحفظ البيانات المدخلة في متغير اسمه myName عند الضغط على موافق، في هذه الحالة نحن نقوم بالطلب من المستخدم بكتابة إسمه بعد ذلك نقوم بإستخدام خاصية التخزين localStorage والتي تسمح لنا بتخزين وإسترجاع بيانات من المتصفح. نقوم بإستخدام دالة setItem  لإنشاء مفتاح بقاعدة البيانات بإسم name ومن ثم نقوم بتخزين إسم المستخدم بها. وأخيرا نقوم بتتغير نص العنوان لنقوم بإظهار إسم المستخدم به.
  6. -
  7.  بعد ذلك نقوم بإستخدام دالة شَرطِيّة للتأكد ما اذا كان إسم المستخدم محفوظ مسبقا بقاعدة بيانات المتصفح سنسمي هذه السطور سطور بداية البرنامج لأنها ستعمل مع بداية عمل البرنامج: -
    if(!localStorage.getItem('name')) {
    -  setUserName();
    -} else {
    -  var storedName = localStorage.getItem('name');
    -  myHeading.textContent = 'Mozilla is cool, ' + storedName;
    -}
    - كما ترا الدالة الشرطية تقوم بالتأكد بأنه "لا" يوجد إسم في قاعدة بيانات المتصفح لأننا إستخدمنا علامة التعجب. فإذا لم يجد إسم في قاعدة البيانات فإنه سيبدأ بتشغيل دالة setUserName() التي كتبناها مسبقا ليطلب من المستخدم إسمه وتخزينه في قاعدة البيانات. لكن إذا كان الإسم موجود في قاعدة البيانات فسيتم جلبه بإستخدام دالة  getItem()، بعد ذلك نقوم بعرضه مع .العنوان
  8. -
  9. أخيرا سنقوم بربط حدث الضغط على الزر onclick الذي قمنا بإنشاءه مسبقا بدالة مجهولة تقوم بتشغيل الدالة setUserName()  التي قمنا بكتابتها، هذه الطريقة تسمح للمستخدم بتغيير إسمه متى ما أراد: -
    myButton.onclick = function() {
    -  setUserName();
    -}
    -
    -
  10. -
- -

الآن عندما يزور المستخدم الصفحة لأول مرة، ستطلب منه كتابة إسمه ثم ستظهر رسالة مخصصة بإسمه. ويمكنه تغيير إسمه بالضغط على الزر الذي قمنا بإضافته. قاعدة البيانات تقوم بحفظ البيانات حتى لو قام المستخدم بإغلاق الصفحة لذلك عندما يزور الصفحة مرة أخرى سيرى الرسالة الخاصة به!

- -

خاتمة

- -

إذا كنت قد تابعت جميع التعليمات التي ذكرناها، فيجب ان تحصل على صفحة مشابهة للصورة بالأسفل (تستطيع تجرب نسختنا من هنا):

- -

- -

إذا واجهت مشاكل، يمكنك مقارنه عملك مع مثالنا المنشور على قيت هب.

- -

إلى الآن لم نقم بتعلم الكثير عن الجافاسكربت ودائما هناك المزيد للتعلم عنها. إذا كنت قد إستمتعت بتعلمها فيمكنك التقدم بمتابعة الدروس، إطلع على دروس الجافاسكربت.

- -

{{PreviousMenuNext("Learn/Getting_started_with_the_web/CSS_basics", "Learn/Getting_started_with_the_web/Publishing_your_website", "Learn/Getting_started_with_the_web")}}

- -

 

- -

في هذا الدرس

- - - -

 

diff --git a/files/ar/learn/getting_started_with_the_web/what_will_your_website_look_like/index.html b/files/ar/learn/getting_started_with_the_web/what_will_your_website_look_like/index.html deleted file mode 100644 index 3981454cb9..0000000000 --- a/files/ar/learn/getting_started_with_the_web/what_will_your_website_look_like/index.html +++ /dev/null @@ -1,111 +0,0 @@ ---- -title: كيف سيكون مظهر موقعك؟ -slug: Learn/Getting_started_with_the_web/What_will_your_website_look_like -tags: - - البدء مع الويب - - مبتدئين -translation_of: Learn/Getting_started_with_the_web/What_will_your_website_look_like ---- -
{{LearnSidebar}}
- -
{{PreviousMenuNext("Learn/Getting_started_with_the_web/Installing_basic_software", "Learn/Getting_started_with_the_web/Dealing_with_files", "Learn/Getting_started_with_the_web")}}
- -
-

تناقش مقالة كيف سيكون مظهر موقعك؟ عمليّة التخطيط والتصميم التي يجب عليك القيام بها من أجل موقعك قبل البدء بكتابة الشيفرة المصدرية، متضمنةً: "ما المعلومات التي يجب أن يقدمها موقعي؟"، "ما الخطوط والألوان التي أريدها؟"، "ماذا يفعل موقعي؟".

-
- -

 أهم الأشياء أولاً: التخطيط

- -

قبل أن تفعل أي شيء، أنت تحتاج لبعض الأفكار. ماذا على موقعك أن يفعل؟ يستطيع الموقع جوهرياً فعل أي شيء، ولكن يجب أن تبدأ بأمور بسيطة في محاولتك الأولى. سنبدأ بإنشاء صفحة بسيطة فيها عناوين، وصورة، وبعض الفقرات.

- -

للبدء ستحتاج للإجابة على هذه الأسئلة:

- -
    -
  1. عمّا هو موقعك؟ هل تحب الكلاب؟ مدينة نيويورك؟ شخصية باكمان؟
  2. -
  3. ما المعلومات التي تقدمها حول الموضوع؟ اكتب عنواناً وبعض فقرات، وفكِّر بصورة تريد عرضها على صفحتك.
  4. -
  5. كيف يبدو موقعك؟ ما لون الخلفية؟ ما نوع الخط المناسب: رسمي، كرتوني، غامق، رقيق؟
  6. -
- -
-

ملاحظة: المشاريع المُعقدة تحتاج لدليل مُفصَّل يغطي جميع التفاصيل من ألوان، والخطوط، والمسافات بين العناصر، والأسلوب المناسب لكتابة التصميم، وهلمَّ جرّا. ذلك النوع من الكتيّبات الإرشادية يدعى دليل التصميم، يمكنك رؤية مثال عنه في دليل نظام فايرفوكس.

-
- -

ارسم تصميمك

- -

بعد إجابتك على الأسئلة السابقة التقط قلماً وورقة وارسم (بطريقة تقريبيّة) كيف تريد أن يبدو الموقع. لأوَّل موقع بسيط تقوم به لن يكون هناك الكثير لترسمه، ولكن يجب أن تعتاد على القيام بهذا. تلك الطريقة تساعد حقاً (لا يجب عليك أن تكون فان غوخ لتُنجِز ذلك!).

- -

- -
-

ملاحظة: حتى على الواقع يقوم فريق التصميم عادةً بالرسم بدايةً على الورق وبعدها يقومون ببناء نموذج رقمي لتلك الرسمة باستخدام إحدى محررات الرسوميات أو تقنيات الويب.

- -

غالباً ما يضم فريق الويب مصمم رسوميات (UI) ومصمم لتجربة المستخدم (UX). يقوم مصمم الرسوميات بصنع رؤية للموقع. أما مصمم تجربة المستخدم فيقوم بدور معالجة كيف ستكون تجربة المستخدمين مع الموقع وكيف سيتفاعل الموقع معهم.

-
- -

اختر مواد العرض

- -

في هذه المرحلة من الجيد البدء في وضع المحتوى الموجود على الورقة في صفحة الويب.

- -

النص

- -

يجب أن يكون لازال لديك الفقرات والعنوان من السابق (عندما رسمتها على ورقة). ابقِ تلك الأشياء قريبة منك حالياً (سنحتاجها بعد قليل).

- -

اللون

- -

لاختيار لون قم بالذهاب لموقع منتقي الألوان وابحث عن اللون الذي تريده. عندما تضغط على اللون سوف ترى عبارة غريبة مكوّنة من ستة أحرف مثل 660066#. تدعى تلك العبارة بالرمز السداسي عشري (hexadecimal)، وهي تمثل لونك. قم حالياً بنسخ ذلك الرمز واحفظه في مكان ما.

- -

- -

الصور

- -

قم بالذهاب إلى موقع صور جوجل لاختيار صورة وابحث عن شيء مناسب لك.

- -
    -
  1. عندما تجد الصورة التي تريدها اضغط عليها.
  2. -
  3. اضغط على الزر عرض الصورة (View image).
  4. -
  5. في الصفحة التالية التي ستفتح اضغط على الصورة بواسطة الزر الأيمن للفأرة (استخدم  Ctrl + click على نظام ماك) واختر حفظ الصورة ك (Save Image As) واختر مكان ما على جهازك لتحفظها عليه. هناك حل بديل وهو أن تنسخ عنوان الصورة من متصفحك لاستخدامه لاحقاً.
  6. -
- -

- -

- -
-

ملاحظة: معظم الصور على الويب، بما فيها الصور الموجودة في موقع جوجل صور، تحتوي على حقوق ملكيّة. لتقلل من احتمال انتهاك حقوق الطبع والنشر قم بترشيح الصور باستخدام مُرشِّح جوجل. اضغط على أدوات البحث (Search tools) ومن ثم اختر حقوق الاستخدام (Usage rights):

- -

-
- -

الخط

- -

لاختيار الخط:

- -
    -
  1. قم بالذهاب إلى موقع خطوط جوجل وحرِّك الفأرة للأسفل حتى تجد الخط الذي تريده. تستطيع أيضاً استخدام الأدوات الموجودة في الجهة اليمنى للموقع لإجراء ترشيح مُتقدِم للنتائج.
  2. -
  3. اضغط على أيقونة الزائد الموجودة بجانب الخط الذي تريده.
  4. -
  5. اضغط على زر "* العائلة المختارة (Family Selected)" الموجود في الشريط الموجود أسفل الموقع (الرمز "*" يتغيّر اعتماداً على عدد الخطوط التي اخترتها).
  6. -
  7. قم بنسخ السطور التي ستظهر في النافذة المنبثقة إلى محرر النصوص لتحفظها لاستخدامها لاحقاً.
  8. -
- -

- -

 

- -

- -

{{PreviousMenuNext("Learn/Getting_started_with_the_web/Installing_basic_software", "Learn/Getting_started_with_the_web/Dealing_with_files", "Learn/Getting_started_with_the_web")}}

- -

 

- -

في هذه الوحدة أيضاًEditEdit

- - diff --git a/files/ar/learn/html/index.html b/files/ar/learn/html/index.html deleted file mode 100644 index 0e2a90b71a..0000000000 --- a/files/ar/learn/html/index.html +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: 'تعلم HTML: أدلة ودروس' -slug: Learn/HTML -tags: - - Beginner - - CodingScripting - - HTML - - NeedsContent - - NeedsTranslation - - TopicStub -translation_of: Learn/HTML ---- -

 

- -

لبناء المواقع، يجب أن نعرف عن {{معجم ( 'HTML')}} - التكنولوجيا الأساسية المستخدمة لتحديد هيكل صفحة ويب. يستخدم HTML لتحديد ما إذا كان ينبغي الاعتراف محتوى الويب الخاص بك كفقرة، القائمة، العنوان، وصلة، صورة، لاعب الوسائط المتعددة، شكل، أو واحد من العديد من العناصر الأخرى المتاحة أو حتى عنصر الجديد الذي قمت بتحديده.

- -

مسار التعلم

- -

من الناحية المثالية يجب أن تبدأ رحلة التعلم عن طريق تعلم HTML. ابدأ القراءة مقدمة إلى HTML . ثم تستطيع الانتقال إلى تعلم حول مواضيع أكثر تقدما مثل:

- -
    -
  • CSS ، وكيفية استخدامه لHTML أسلوب (على سبيل المثال تغيير حجم النص والخطوط المستخدمة، إضافة الحدود والظلال، تخطيط صفحتك مع عدة أعمدة، إضافة الرسوم المتحركة والتأثيرات البصرية الأخرى.)
  • -
  • جافا سكريبت ، وكيفية استخدامها لإضافة وظائف حيوية على صفحات الويب (على سبيل المثال العثور على موقعك ورسم على الخريطة، جعل تظهر عناصر واجهة المستخدم / تختفي عند تبديل زر، حفظ بيانات المستخدمين محليا على أجهزة الكمبيوتر الخاصة بهم، والكثير أكثر بكثير.)
  • -
- -

قبل البدء في هذا الموضوع، يجب أن يكون لديك معرفة أساسية على الأقل مع استخدام أجهزة الكمبيوتر، واستخدام شبكة الإنترنت بشكل سلبي (أي مجرد النظر اليها، واستهلاك المحتوى). يجب ان تكون بيئة العمل الأساسية اقامة النحو المفصل فيتثبيت البرامج الأساسية ، وفهم كيفية إنشاء وإدارة الملفات، كما هو مفصل في التعامل مع الملفات - على حد سواء هي جزء من لدينا الشروع في العمل مع شبكة الإنترنت وحدة مبتدئا كاملة ل.

- -

فمن المستحسن أن تعمل من خلال الشروع في العمل مع شبكة الإنترنت قبل محاولة هذا الموضوع، ومع ذلك فإنه ليس من الضروري على الاطلاق. كثيرا ما تتم تغطيتها في أساسيات HTML تغطي المادة أيضا فيما لدينا مقدمة إلى HTML وحدة، وإن كان ذلك في مزيد من التفاصيل الكثير.

- -

وحدات

- -

هذا الموضوع يحتوي على الوحدات التالية، في الترتيب المقترح للعمل من خلالها. يجب عليك بالتأكيد تبدأ مع أول واحد.

- -
-
مقدمة إلى HTML
-
هذه الوحدة يمهد الطريق، والحصول على استخدمته لمفاهيم هامة وتركيب، والنظر في تطبيق HTML إلى النص، وكيفية إنشاء ارتباطات تشعبية، وكيفية استخدام HTML لهيكلة صفحة ويب.
-
الوسائط المتعددة وتضمينها
-
هذه الوحدة يستكشف كيفية استخدام HTML لتشمل الوسائط المتعددة في صفحات الويب الخاصة بك، بما في ذلك الطرق المختلفة التي يمكن أن تكون الصور المدرجة، وكيفية تضمين الفيديو والصوت، وحتى صفحات الويب الأخرى كلها.
-
جداول HTML
-
يمكن أن تمثل جداول البيانات على صفحة ويب في ومفهومة الطريقة يكون تحديا. هذه الوحدة تغطي العلامات الجدول الأساسية، جنبا إلى جنب مع ميزات أكثر تعقيدا مثل تنفيذ التسميات وملخصات.
-
نماذج HTML
-
أشكال هي جزء مهم جدا من الشبكة - هذه توفر الكثير من الوظائف التي تحتاج إليها للتفاعل مع المواقع على شبكة الإنترنت، على سبيل المثال تسجيل وتسجيل الدخول، وإرسال ردود الفعل، وشراء المنتجات، وأكثر من ذلك. هذه الوحدة التي يحصل لك مع خلق الأجزاء العميل من الأشكال.
-
- -

حل المشاكل المشتركة HTML

- -

استخدام HTML لحل المشاكل المشتركة يوفر روابط لأقسام المحتوى شرح كيفية استخدام HTML لحل مشاكل شائعة جدا عند إنشاء صفحة ويب: التعامل مع العناوين، وإضافة الصور ومقاطع الفيديو، مؤكدا المحتوى، وخلق شكل أساسي، الخ

- -

أنظر أيضا

- -
-
HTML (لغة توصيف النص التشعبي) على MDN
-
نقطة الدخول الرئيسية للثائق HTML على MDN، بما في ذلك عنصر مفصلة والسمة المراجع - إذا كنت تريد أن تعرف ما سمات عنصر ديه أو ما تقدر سمة لها، على سبيل المثال، وهذا هو مكان عظيم للبدء.
-
- -

 

- -

 

- -
 
diff --git a/files/ar/learn/html/introduction_to_html/getting_started/index.html b/files/ar/learn/html/introduction_to_html/getting_started/index.html deleted file mode 100644 index 35213057e3..0000000000 --- a/files/ar/learn/html/introduction_to_html/getting_started/index.html +++ /dev/null @@ -1,760 +0,0 @@ ---- -title: ابدء مع HTML -slug: Learn/HTML/Introduction_to_HTML/Getting_started -translation_of: Learn/HTML/Introduction_to_HTML/Getting_started ---- -
{{LearnSidebar}}
- -
{{NextMenu("Learn/HTML/Introduction_to_HTML/The_head_metadata_in_HTML", "Learn/HTML/Introduction_to_HTML")}}
- -

في هذه المقالة سنغطي أساسيات لغة ترميز النص الفائق (HTML). سنقوم بتوفير تعريف للعناصر، السمات، وجميع المصطلحات الأخرى التي قد تكون قد سمعتها من قبل، ومتى يتم استخدامها في اللغة. سنقوم أيضاً بشرح كيف يتم كتابة العنصر في اللغة، وكيف يتم تنظيم وثيقة لغة ترميز النص الفائق، وسنشرح الميزات الأساسية الأخرى في اللغة. على طول الشرح، سنقوم باستخدام بعض الأمثلة، لنخلق نوعاً من الإثارة!

- - - - - - - - - - - - -
المتطلبات:أساسيات استخدام الحاسوب، البرمجيات الأساسية مثبتة، معرفة أساسية حول التعامل مع الملفات.
الهدف:الحصول على معرفة مبدئية باللغة، والحصول على بعض التدريبات لكتابة بعض العناصر في اللغة.
- -

ما هي HTML؟

- -

لغة ترميز النص الفائق ليس لغة برمجة؛ وإنما لغة ترميزيّة (markup language) تُستخدم لإخبار المتصفح بكيفيّة تنظيم صفحات الويب التي تزورها. يُمكن أن تكون هذه اللغة معقدة أو بسيطة كما يرغبها أن تكون مطور الويب. تتألف هذه اللغة من مجموعة من العناصر، والتي تحيط أو تُرَمِز أجزاء من المحتوى لتجعلها تظهر أو تتصرف بطريقة معينة. الوسوم المغلقة يُمكن أن تحوِّل جزء من النص إلى رابط يشير لموقع آخر، أو يمكن أن تجعل الكلمات مائلة، وهلم جرا. على سبيل المثال، انظر للسطر التالي:

- -
قطتي شديدة الجمال
- -

إذا أردنا جعل هذا النص فقرة، يمكننا القيام بهذا عن طريق توصيفه على أنه فقرة عن طريق إحاطته بعنصر الفقرة ({{htmlelement("p")}}):

- -
<p>قطتي شديدة الجمال</p>
- -
-

ملاحظة: عناصر لغة ترميز النص الفائق غير حساسة لحالة الحرف، أي يُمكِن كتابتها باستخدام حروف صغيرة أو كبيرة. على سبيل المثال يمكن كتابة العنصر {{htmlelement("title")}} بالشكل <title>، أو <TITLE>، أو <Title>، أو <TiTlE>، إلخ. جميع تلك الأشكال ستعمل بدون مشاكل. الأفضل هو كتابة جميع العنصار بحروف صغيرة لأسباب تنسيقيّة، ومقروئيّة، وغيرها من الأسباب الأخرى.

-
- -

تشريح عنصر لغة ترميز النص الفائق

- -

دعنا نستكشف عنصر الفقرة ذاك أكثر قليلاً:

- -

- -

الأجزاء الرئيسية من عنصرنا هي:

- -
    -
  1. وسم الفتح (أو وسم البداية أو الوسم الإفتتاحي): يتألف من اسم العنصر (في حالتنا p)، محاطاً بقوس مفتوح وآخر مُغلَق. هذا المكوِّن يحدد بداية العنصر، أو بداية تأثيره (في حالتنا يحدد أين تبدأ الفقرة).
  2. -
  3. وسم الإغلاق (أو وسم النهاية أو الوسم الختامي): مشابه لوسم البداية، ماعدا أنه يتضمن شرطة مائلة (/) قبل اسم العنصر. هذا المكوِّن يحدد نهاية (في حالتنا نهاية الفقرة). يُعَد نسيان وضع وسم الإغلاق أحد الأخطاء الشائعة التي يقع بها المبتدئون والتي تؤدي إلى مشاكل تنظيميّة في الصفحة (خروج النص من مكان مثلاً).
  4. -
  5. المحتوى: هذا المكوِّن يمثل محتوى الذي يُرمِزُهُ العنصر، والذي هو في حالتنا النص.
  6. -
  7. العنصر: يتألف من وسم البداية، ووسم الإغلاق، والمحتوى (جميع المحتويات السابقة).
  8. -
- -

التعلم النشط: إنشاء أول عنصر لك في لغة ترميز النص الفائق

- -

قم بتعديل السطر أدناه في منطقة الإدخال عن طريق إحاطته باستخدام الوسمين <em> و </em> (ضع <em> قبله لفتح العنصر، و </em> بعده لإغلاق العنصر)، هذا ينبغي أن يحوِّل النص إلى مائل. يمكنك رؤية التغييرات في منطقة الخرج.

- -

إذا قمت بخطأ ما، فيمكنك دائماً تصفير (إعادتها إلى ما كانت عليه) الشيفرة باستخدام زر التصفير. إذا كنت عالقاً بشكل كامل، فيمكنك الضغط على زر عرض الحل لرؤية الجواب.

- - - -

{{ EmbedLiveSample('Playable_code', 700, 400, "", "", "hide-codepen-jsfiddle") }}

- -

العناصر المتداخلة

- -

يمكنك وضع عنصر بداخل عنصر أخر أيضاً، وهذا ما يدعى بالتداخل (nesting). إذا أردنا تحديد أن قطتنا جميلة جداً، يمكننا إحاطة الكلمة "جداً" بالعنصر <strong>، الذي يدل على تأكيد الكلمة بشدّة:

- -
<p>قطتي جميلة <strong>جداً</strong>.</p>
- -

عليك أن تتأكد من أن عناصرك متداخلة بشكل صحيح. في المثال أعلاه قمنا بفتح العنصر <p> أولاً، وبعده العنصر <strong>، وبالتالي علينا إغلاق العنصر <strong> ويليه الآخر. فالشكل التالي ليس صحيحاً:

- -
<p>قطتي جميلة <strong>جداً.</p></strong>
- -

على العناصر أن تُفتَح وتُغلَق بشكل صحيح ليكونوا بشكل واضح داخل أو خارج بعضهما البعض. فإذا تشابكوا بشكل خاطئ كما في الأعلى، سيقوم مُتصفحك بمحاولة القيام بأفضل تخمين حيال ما تحاول القيام به، والذي قد يؤدي إلى نتائج تنسيقيّة خاطئة. لذلك لا تقم بهذا!

- -

العناصر المستحوذة والمُضمَنِة

- -

يوجد تصنيفين مهمين للعناصر في لغة الترميز النص الفائق، والذين ينبغي عليك معرفتهم، وهم العناصر المستحوذة (أو الكتلية block elements) والعناصر المُضمَنِة (inline elements).

- -
    -
  • ستظهر العناصر الكتلية (Block-level elements) الموجودة في كتلة ظاهرة في الصفحة في سطر جديد مهما كان المحتوى الذي قبلها، وأي محتوى سيأتي بعدها سيظهر أيضاً في سطر جديد. تميل العناصر الكتلية إلى أن تكون عناصر هيكلية للصفحة التي تُمثلُها، فعلى سبيل المثال، الفقرات، والقوائم، وقوائم الملاحة (Navigation Menus)، والذيول (Footers)، إلخ. لا تتداخل العنصر الكتلي بداخل عنصر مضمن، ولكن قد يتداخل بداخل عنصر كتلي آخر.
  • -
  • العناصر المضمنة هي تلك العناصر لتي تُحتوى بداخل العناصر الكتلية وتحيط بأجزاء صغيرة فقط من محتوى الوثيقة، وليس فقرات كاملة أو مجموعات من المحتويات. العنصر المضمن لا يُنشئ سطر جديد ليظهر في الوثيقة، فيمكن أن يظهر بشكل طبيعي بجانب فقرة، على سبيل المثال العنصر {{htmlelement("a")}} (رابط تشعيبي) أو العناصر التوكيدية مثل {{htmlelement("em")}} أو {{htmlelement("strong")}}.
  • -
- -

خذ المثال التالي:

- -
<em>first</em><em>second</em><em>third</em>
-
-<p>fourth</p><p>fifth</p><p>sixth</p>
-
- -

العنصر {{htmlelement("em")}} هو عنصر مضمن، لذلك كما ترى أدناه، العناصر الثلاثة الأولى تتوضع بنفس السطر بدون وجود مسافات بينها. من الناحية الأخرى، العنصر {{htmlelement("p")}} هو عنصر كتلي، لذلك كل عنصر يظهر على سطر جديد، بمسافات سفلية وعلوية بين كل واحد (تخضع المسافات لتنسيق لغة صفحات الطرز المتراصة الإفتراضي الذي يفرضه على الفقرات).

- -

{{ EmbedLiveSample('Block_versus_inline_elements', 700, 200, "", "", "hide-codepen-jsfiddle") }}

- -
-

ملاحظة: لغة ترميز النص الفائق الإصدار الخامس أعادت تعريف تصنيفات العناصر: انظر إلى تصنيفات محتوى العناصر. في حين أن هذه التعريفات أكثر دقة وأقل غموضاً من السابقة، إلاّ أنهم أكثر تعقيداً من ناحية الفهم، لذلك سنكمل باستخدام التعريفات القديمة في هذا الموضوع

-
- -
-

ملاحظة: المصطلحات "كتلي" و "ضمني" المستخدمة في هذا الموضوع، لا ينبغي أن يشوشوك مع المصطلحات المستخدمة في مقالة أنواع صناديق لغة صفحات الطرز المتراصة التي تحمل نفس الاسم. في حين أنهم مرتبطين إفتراضياً، إلا أن تغيير نوع العرض في صفحات الطرز المتراصة لا يغير تصنيف العنصر ولا يؤثر على العناصر التي تحتوي وعلى ولا على العناصر التي سيتم إحتواءها. أحد الأسباب التي جعلت لغة ترميز النص الفائق الإصدار الخامس تتخلى عن هذه المصطلحات هي لمنع هذا الارتباك.

-
- -
-

ملاحظة: يمكنك إيجاد صفحات مرجعية مفيدة تتضمن قوائم تحوي العناصر الكتلية والمضمنة، انظر إلى العناصر الكتلية و العناصر المضمنة.

-
- -

العناصر الفارغة

- -

لا تتبع جميع العناصر النمط المشروح أعلاه، والذي هو عبارة عن وضع وسم الفتح، وبعده المحتوى، وبعده وسم الإغلاق. فبعض العناصر تتألف من وسم مُفرَد، والذي يستخدم عادةً لإدخال/تضمين شيء في الوثيقة. على سبيل المثال، يُضمِن العنصر {{htmlelement("img")}} صورة في الصفحة في الموضع الذي عُرِفَ فيه:

- -
<img src="https://raw.githubusercontent.com/mdn/beginner-html-site/gh-pages/images/firefox-icon.png">
- -

ينبغي أن يُخرِج ذلك السطر الشكل التالي في صفحتك:

- -

{{ EmbedLiveSample('Empty_elements', 700, 300, "", "", "hide-codepen-jsfiddle") }}

- -
-

ملاحظة: تسمى العناصر الفارغة أحياناً بالعناصر الخاوية (void elements).

-
- -

السمات

- -

يمكن للعناصر أيضاً أنت تحتوي على سمات، والتي تبدو كشيء من هذا القبيل:

- -

&amp;amp;lt;p class="editor-note">قطتي شديدة الجمال&amp;amp;lt;/p>

- -

تحتوي السمات على معلومات إضافية حول العنصر والتي لا تريد أن تظهرها في المحتوي الفعلي. في حالتنا تسمح لك السمة class أن تعطي العنصر مُعرِف والذي يمكن استخدامه لاحقاً للإشارة للعنصر وإعطائه تنسيق معين وأشياء أخرى.

- -

السمة يجب أن تملك دائماً:

- -
    -
  1. مسافة بينها وبين اسم العنصر (أو السمة التي تسبقها، إذا كان العنصر يملك بالفعل سمةً أو أكثر).
  2. -
  3. اسم السمة، متبوعاً بإشارة يساوي.
  4. -
  5. علامتي تنصيص تحيط بقيمة السمة.
  6. -
- -

التعلم النشط: إضافة سمات إلى عنصر

- -

يمكننا أخذ العنصر {{htmlelement("a")}} كمثال آخر. يعد الحرف "a" إختصاراً لكلمة "مرساة (anchor)"، يحول هذا العنصر النص الذي يحيط به إلى رابط تشعبي. يُمكن أن يأخذ هذا العنصر عدداً من السمات، منها:

- -
    -
  • السمة href: تحدد قيمة هذه السمة عنوان الويب الذي يشير إليه الرابط؛ لينتقل إلى المتصفح عند الضغط عليه. على سبيل المثال، href="https://www.mozilla.org/".
  • -
  • السمة title: تحدد قيمة هذه السمة معلومات إضافية حول الرابط، مثل ما هي الصفحة التي يشير إليها هذا الرابط. على سبيل المثال، يمكننا وضع القيمة: title="The Mozilla homepage". سيظهر هذا النص كتلميح عند التحويم على الرابط.
  • -
  • السمة target: تحدد هذه السمة سياق التصفح الذي سيفتح به الرابط. فعلى سبيل المثال، القيمة target="_blank" ستعرض الرابط (الموقع الذي يشير إلى الرابط) في نافذة جديدة. إذا أردت عرض الرابط في الصحة الحالية، فلا تستخدم هذه السمة وحسب.
  • -
- -

قم بتعديل السطر أدناه في منطقة الإدخال لتحويله إلى رابط يشير لموقعك المفضل. أولاً، أضف العنصر <a>. ثانياً، أضف السمتين href و title. وأخيراً، عَرِف السمة target لفتح الرابط في نافذة جديدة. ستكون قادراً على رؤية التغييرات بشكل حي في منطقة الإخراج. ينبغي أن ترى أنه عند التحويم على الرابط سيُعرض محتوى السمة title، وعند الضغط عليه سيتم الإنتقال إلى عنوان الويب الموجود في السمة href. تذكر أنه ينبغي عليك وضع مسافة بين اسم العنصر وكل سمة يملكها.

- -

إذا قمت بخطأ ما، فيمكنك دائماً تصفير (إعادت الشيفرة إلى ما كانت عليه) الشيفرة باستخدام زر التصفير. إذا كنت عالقاً بشكل كامل، فيمكنك الضغط على زر عرض الحل لرؤية الجواب.

- - - -

{{ EmbedLiveSample('Playable_code2', 700, 400, "", "", "hide-codepen-jsfiddle") }}

- -

السمات البوليانية (المنطقية)

- -

سترى أحياناً سمات تُكتَب من دون قيمة. تدعى هذه السمات بالسمات المنطقية، ويمكن أن تأخذ هذه السمات قيمة واحدة، والتي هي عادةً اسم السمة نفسها. على سبيل المثال، السمة {{htmlattrxref("disabled", "input")}}، والتي يُمكن أن تُسندها لعناصر الإدخال إذا أردت تعطيلها حتى لا يستطيع المستخدم إدخال أية بيانات فيها.

- -
<input type="text" disabled="disabled">
- -

كاختصار، يمكنك كتابة السمة أيضاً بالشكل التالي (قمنا أيضاً بإضافة عنصر إدخال غير مُعطَل لتوضيح الفكرة أكثر):

- -
<input type="text" disabled>
-
-<input type="text">
-
- -

المثالين سيعطيانك نفس النتيجة:

- -

{{ EmbedLiveSample('Boolean_attributes', 700, 100, "", "", "hide-codepen-jsfiddle") }}

- -

حذف علامات الإقتباس من حول قيم السمات

- -

When you look around the World Wide Web, you'll come across all kind of strange markup styles, including attribute values without quotes. This is allowable in certain circumstances, but will break your markup in others. For example, if we revisit our link example from earlier, we could write a basic version with only the href attribute, like this:

- -
<a href=https://www.mozilla.org/>favourite website</a>
- -

However, as soon as we add the title attribute in this style, things will go wrong:

- -
<a href=https://www.mozilla.org/ title=The Mozilla homepage>favourite website</a>
- -

At this point the browser will misinterpret your markup, thinking that the title attribute is actually three attributes — a title attribute with the value "The", and two boolean attributes, Mozilla and homepage. This is obviously not what was intended, and will cause errors or unexpected behavior in the code, as seen in the live example below. Try hovering over the link to see what the title text is!

- -

{{ EmbedLiveSample('Omitting_quotes_around_attribute_values', 700, 100, "", "", "hide-codepen-jsfiddle") }}

- -

Our advice is to always include the attribute quotes — it avoids such problems, and results in more readable code too.

- -

هل استخدم علامة تنصيص مزدوجة أم مفردة؟

- -

In this article you'll notice that the attributes are all wrapped in double quotes. You might however see single quotes in some people's HTML. This is purely a matter of style, and you can feel free to choose which one you prefer. Both the following lines are equivalent:

- -
<a href="http://www.example.com">A link to my example.</a>
-
-<a href='http://www.example.com'>A link to my example.</a>
- -

You should however make sure you don't mix them together. The following will go wrong!

- -
<a href="http://www.example.com'>A link to my example.</a>
- -

If you've used one type of quote in your HTML, you can include the other type of quote without causing any problems:

- -
<a href="http://www.example.com" title="Isn't this fun?">A link to my example.</a>
- -

However if you want to include a quote within the quotes where both the quotes are of the same type(single quote or double quote), you'll have to use HTML entities for the quotes.

- -

تشريح وثيقة لغة ترميز النص الفائق

- -

That wraps up the basics of individual HTML elements, but they aren't very useful on their own. Now we'll look at how individual elements are combined to form an entire HTML page:

- -
<!DOCTYPE html>
-<html>
-  <head>
-    <meta charset="utf-8">
-    <title>My test page</title>
-  </head>
-  <body>
-    <p>This is my page</p>
-  </body>
-</html>
- -

Here we have:

- -
    -
  1. <!DOCTYPE html>: The doctype. In the mists of time, when HTML was young (about 1991/2), doctypes were meant to act as links to a set of rules that the HTML page had to follow to be considered good HTML, which could mean automatic error checking and other useful things. They used to look something like this: - -
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    -"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    - However, these days no one really cares about them, and they are really just a historical artifact that needs to be included for everything to work right. <!DOCTYPE html> is the shortest string of characters that counts as a valid doctype; that's all you really need to know.
  2. -
  3. <html></html>: The {{htmlelement("html")}} element. This element wraps all the content on the entire page, and is sometimes known as the root element.
  4. -
  5. <head></head>: The {{htmlelement("head")}} element. This element acts as a container for all the stuff you want to include on the HTML page that isn't the content you are showing to your page's viewers. This includes things like keywords and a page description that you want to appear in search results, CSS to style our content, character set declarations, and more. You'll learn more about this in the next article in the series.
  6. -
  7. <meta charset="utf-8">: This element sets the character set your document should use to UTF-8, which includes most characters from the vast majority of human written languages. Essentially it can now handle any textual content you might put on it. There is no reason not to set this, and it can help avoid some problems later.
  8. -
  9. <title></title>: The {{htmlelement("title")}} element. This sets the title of your page, which is the title that appears in the browser tab the page is loaded in, and is used to describe the page when you bookmark/favorite it.
  10. -
  11. <body></body>: The {{htmlelement("body")}} element. This contains all the content that you want to show to web users when they visit your page, whether that's text, images, videos, games, playable audio tracks, or whatever else.
  12. -
- -

التعلم النشط: إضافة بعض الميزات لوثيقة ترميز النص الفائق

- -

If you want to experiment with writing some HTML on your local computer, you can:

- -
    -
  1. Copy the HTML page example listed above.
  2. -
  3. Create a new file in your text editor.
  4. -
  5. Paste the code into the new text file.
  6. -
  7. Save the file as index.html.
  8. -
- -
-

Note: You can also find this basic HTML template on the MDN Learning Area Github repo.

-
- -

You can now open this file in a web browser to see what the rendered code looks like, and then edit the code and refresh the browser to see what the result is. Initially it will look like this:

- -

A simple HTML page that says This is my pageSo in this exercise, you can edit the code locally on your computer, as outlined above, or you can edit it in the editable sample window below (the editable sample window represents just the contents of the {{htmlelement("body")}} element, in this case.) We'd like you to have a go at implementing the following steps:

- -
    -
  • Just below the opening tag of the {{htmlelement("body")}} element, add a main title for the document. This should be wrapped inside an <h1> opening tag and </h1> closing tag.
  • -
  • Edit the paragraph content to include some text about something you are interested in.
  • -
  • Make any important words stand out in bold by wrapping them inside a <strong> opening tag and </strong> closing tag
  • -
  • Add a link to your paragraph, as explained earlier in the article.
  • -
  • Add an image to your document, below the paragraph, as explained earlier in the article. You'll get bonus points if you manage to link to a different image (either locally on your computer, or somewhere else on the web.)
  • -
- -

If you make a mistake, you can always reset it using the Reset button. If you get really stuck, press the Show solution button to see the answer.

- - - -

{{ EmbedLiveSample('Playable_code3', 700, 600, "", "", "hide-codepen-jsfiddle") }}

- -

المساحات الفارغة في لغة ترميز النص الفائق

- -

In the above examples you may have noticed that a lot of whitespace is included in the code listings — this is not necessary at all; the two following code snippets are equivalent:

- -
<p>Dogs are silly.</p>
-
-<p>Dogs        are
-         silly.</p>
- -

No matter how much whitespace you use (which can include space characters, but also line breaks), the HTML parser reduces each one down to a single space when rendering the code. So why use so much whitespace? The answer is readability — it is so much easier to understand what is going on in your code if you have it nicely formatted, and not just bunched up together in a big mess. In our HTML we've got each nested element indented by two spaces more than the one it is sitting inside. It is up to you what style of formatting you use (how many spaces for each level of indentation, for example), but you should consider formatting it.

- -

Entity references: Including special characters in HTML

- -

In HTML, the characters <, >,",' and & are special characters. They are parts of the HTML syntax itself, so how do you include one of these characters in your text, for example if you really want to use an ampersand or less than sign, and not have it interpreted as code as some browsers may do?

- -

We have to use character references — special codes that represent characters, and can be used in these exact circumstances. Each character reference is started with an ampersand (&), and ended by a semicolon (;).

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Literal characterCharacter reference equivalent
<&lt;
>&gt;
"&quot;
'&apos;
&&amp;
- -

In the below example, you can see two paragraphs, which are talking about web technologies:

- -
<p>In HTML, you define a paragraph using the <p> element.</p>
-
-<p>In HTML, you define a paragraph using the &lt;p&gt; element.</p>
- -

In the live output below, you can see that the first paragraph has gone wrong, because the browser thinks that the second instance of <p> is starting a new paragraph. The second paragraph looks fine, because we have replaced the angle brackets with character references.

- -

{{ EmbedLiveSample('Entity_references_Including_special_characters_in_HTML', 700, 200, "", "", "hide-codepen-jsfiddle") }}

- -
-

Note: A chart of all the available HTML character entity references can be found on Wikipedia: List of XML and HTML character entity references.

-
- -

التعليقات في لغة ترميز النص الفائق

- -

In HTML, as with most programming languages, there is a mechanism available to write comments in the code — comments are ignored by the browser and invisible to the user, and their purpose is to allow you to include comments in the code to say how your code works, what the different parts of the code do, etc. This can be very useful if you return to a code base that you've not worked on for six months, and can't remember what you did — or if you hand your code over to someone else to work on.

- -

To turn a section of content inside your HTML file into a comment, you need to wrap it in the special markers <!-- and -->, for example:

- -
<p>I'm not inside a comment</p>
-
-<!-- <p>I am!</p> -->
- -

As you can see below, the first paragraph appears in the live output, but the second one doesn't.

- -

{{ EmbedLiveSample('HTML_comments', 700, 100, "", "", "hide-codepen-jsfiddle") }}

- -

الملخص

- -

You've reached the end of the article — we hope you enjoyed your tour of the very basics of HTML! At this point you should understand what the language looks like, how it works at a basic level, and be able to write a few elements and attributes. This is a perfect place to be right now, as in subsequent articles in the module we will go into some of the things you have already looked at in a lot more detail, and introduce some new features of the language. Stay tuned!

- -
-

Note: At this point, as you start to learn more about HTML, you might also want to start to explore the basics of Cascading Style Sheets, or CSS. CSS is the language you use to style your web pages (whether e.g. changing the font or colors, or altering the page layout). HTML and CSS go very well together, as you'll soon discover.

-
- -

انظر أيضاً

- - - -
{{NextMenu("Learn/HTML/Introduction_to_HTML/The_head_metadata_in_HTML", "Learn/HTML/Introduction_to_HTML")}}
diff --git a/files/ar/learn/html/introduction_to_html/html_text_fundamentals/index.html b/files/ar/learn/html/introduction_to_html/html_text_fundamentals/index.html deleted file mode 100644 index fba39b360c..0000000000 --- a/files/ar/learn/html/introduction_to_html/html_text_fundamentals/index.html +++ /dev/null @@ -1,657 +0,0 @@ ---- -title: أساسيات النصوص في لغة ترميز النص الفائق -slug: Learn/HTML/Introduction_to_HTML/HTML_text_fundamentals -tags: - - العنونة - - الفقرات - - النصوص - - دليل - - مبدئين - - مقدمة إلى لغة ترميز النص الفائق -translation_of: Learn/HTML/Introduction_to_HTML/HTML_text_fundamentals ---- -
{{LearnSidebar}}
- -
{{PreviousMenuNext("Learn/HTML/Introduction_to_HTML/The_head_metadata_in_HTML", "Learn/HTML/Introduction_to_HTML/Creating_hyperlinks", "Learn/HTML/Introduction_to_HTML")}}
- -

أحد الأهداف الرئيسية للغة ترميز النص الفائق هي هيكلة النصوص وإعطائها هدف ووظيفة (كما تُعرف هذه الوظيفة ب {{glossary("semantics")}}) حتّى يتمكن المتصفح بعرض النصوص بطريقة مناسبة. تشرح هذه المقالة الطريقة التي يُمكن استخدام هذه اللغة لهيكلة صفحة تتكون من نصوص، عن طريق إضافة عناوين وفقرات، ومؤكدات على الكلمات (حروف غامقة ومائلة، على سبيل المثال)، وإنشاء قوائم، وغيرها.

- - - - - - - - - - - - -
المتطلبات:معرف بسيطة بلغة ترميز النص الفائقة، كما هو مشروح في مقالة البدء مع اللغة.
الهدف:تعلم كيفية ترميز صفحة بسيطة مؤلفة من نصوص لإعطائها هيكلية ووظيفة.
- -

الأساسيات: العناوين والفقرات

- -

تتألف معظم النصوص المُنظمة من عناوين وفقرات، بغض النظر عما إذا كنت تقرأ قصة، أو جريدة، أو كتاب جامعي، أو مجلة ... إلخ.

- -

An example of a newspaper front cover, showing use of a top level heading, subheadings and paragraphs.

- -

بحيث يجعل المحتوى المنظم القراءة أكثر سهولة ومتعة.

- -

في لغة ترميز النص الفائق، تحاط الفقرات بالعنصر {{htmlelement("p")}}، كالتالي:

- -
<p>I am a paragraph, oh yes I am.</p>
- -

وتحاط العناوين بوسوم العنونة المخصصة:

- -
<h1>I am the title of the story.</h1>
- -

يوجد ست عناوين متدرجة المستويات، وهي {{htmlelement("h1")}}، و {{htmlelement("h2")}}، و {{htmlelement("h3")}}، و {{htmlelement("h4")}}، و {{htmlelement("h5")}}، و {{htmlelement("h6")}}. يمثل الوسم <h1> العنوان الرئيسي، بينما يمثل الوسم <h2> عنوان فرعي، والوسم <h3> عنوان فرعي للعنوان الفرعي الأول، وهكذا.

- -

تنفيذ التسلسل الهيكلي

- -

على سبيل المثال، في قصة ما، سيمثل الوسم <h1> عنوان القصة، والوسم <h2> سيمثل عنوان كل فصل، بينما سيمثل الوسم <h3> القسم الفرعي لكل فصل،وهلم جرا.

- -
<h1>The Crushing Bore</h1>
-
-<p>By Chris Mills</p>
-
-<h2>Chapter 1: The dark night</h2>
-
-<p>It was a dark night. Somewhere, an owl hooted. The rain lashed down on the ...</p>
-
-<h2>Chapter 2: The eternal silence</h2>
-
-<p>Our protagonist could not so much as a whisper out of the shadowy figure ...</p>
-
-<h3>The specter speaks</h3>
-
-<p>Several more hours had passed, when all of a sudden the specter sat bolt upright and exclaimed, "Please have mercy on my soul!"</p>
- -

فتحديد وظيفة بعض العناصر يعود لك، طالما أنك تستخدم تسلسل منطقي. ولكنك تحتاج إلى أن تضع بالإعتبار بعض الأمور عندما تقوم بتنظيم محتوى مشابه:

- -
    -
  • من الأفضل أن تستخدم والوسم <h1> مرة واحدة في كل صفحة، حيث يعد يمثل هذا الوسم أعلى مستويات العنونة، وبقية العناوين تتوضع أسفله بشكل تسلسلي.
  • -
  • تأكد أنك تستخدم العناوين بترتيبها التسلسلي الصحيح. أي لا تستخدم الوسم <h3> لتمثيل عنوان فرعي، وتستخدم بعده الوسم <h2> لتمثيل عنوان فرعي من درجة ثانية، فهذا لا يبدو منطقياً، كما يؤدي إلى نتائج غريبة!
  • -
  • من الست درجات عنونة المتاحة، حاول ألاَّ تستخدم أكثر من ثلاثة في كل صفحة، مالم يكن هذا ضرورياً. حيث أنَّ المستندات ذات المستويات المتعددة (أي تسلسل هرمي عميق) تصبح غير عملية وصعبة التنقل. في مثل هذه الحالات، من المستحسن نشر المحتوى على صفحات متعددة إذا كان ذلك ممكناً.
  • -
- -

لماذا نحتاج الهيكلة (التنظيم)؟

- -

للإجابة على هذا السؤال، دعنا نأخذ على الملف text-start.html، يعتبر هذا الملف نقطة البداية لمثالنا في هذه المقالة (وهي وصفحة حمص جميلة). يجب عليك حفظ نسخة من هذا الملف على جهازك، فستحتاجه في تمارين لاحقة. تحتوي جسم الوثيقة على عدة أجزاء من المحتوى، وهي غير مُرمَزِة بأي شكل، ولكنهم مفصولين بسطور.

- -

بكل الأحوال، عندما ستفتح هذه الوثيقة في متصفحك، سترى أنَّ النص سيظهر كقطعة كبيرة!

- -

A webpage that shows a wall of unformatted text, because there are no elements on the page to structure it.

- -

يرجع هذا لعدم وجود عناصر لتنظم المحتوى، ولذلك لم يتمكن المتصفح بمعرفة أي جزء هو عنوان وأي جزء هو فقرة. المزيد:

- -
    -
  • يميل المستخدمون لتصفح صفحات الويب بسرعة شديدة لإيجاد محتوى متعلق، فغالباً ما يقومون بقراءة العناوين كبداية (المستخدمون عادةً ما يقضون وقت قصير جداً في صفحة الويب). فإذا لم يجدوا شيء مفيد خلال بضعة ثواني، فسوف يشعرون بالملل ويقومون بالذهاب إلى مكان آخر.
  • -
  • تعتبر محركات البحث التي تفهرس محتويات صفحتك العناوين كلمات رئيسية مهمة التأثير على ترتيب الصفحة عند البحث. وبدون العناوين، ستؤدي صفحتك بشكل سيء من حيث {{glossary("SEO")}} (تحسين محركات البحث).
  • -
  • غالباً لا يقوم المعاق بصرياً بقراءة صفحات الويب، حيث يقوم بالإستماع لها بدلاً من ذلك. يتم ذلك باستخدم برمجية تسمى بقارئ الشاشة. توفر هذه البرمجية طرق للوصول السريع للنص المُعطى. فمن بين العديد من الأساليب المستخدمة، توفر هذه البرمجية طريقة للحصول على خلاصة المستند من خلال قراءة العناوين، مما يسمح للمستخدمين بالحصول على المعلومات التي يريدونها بسرعة. فإذا كانت العناوين غير متوفرة، سيضطر هؤلاء للسماع للمستند بأكمله.
  • -
  • To style content with {{glossary("CSS")}}, or make it do interesting things with {{glossary("JavaScript")}}, you need to have elements wrapping the relevant content, so CSS/JavaScript can effectively target it.
  • -
- -

We therefore need to give our content structural markup.

- -

Active learning: Giving our content structure

- -

Let's jump straight in with a live example. In the example below, add elements to the raw text in the Input field so that it appears as a heading and two paragraphs in the Output field.

- -

If you make a mistake, you can always reset it using the Reset button. If you get stuck, press the Show solution button to see the answer.

- - - -

{{ EmbedLiveSample('Playable_code', 700, 500) }}

- -

Why do we need semantics?

- -

Semantics are relied on everywhere around us — we rely on previous experience to tell us what the function of everyday objects is; when we see something, we know what its function will be. So, for example, we expect a red traffic light to mean "stop", and a green traffic light to mean "go". Things can get tricky very quickly if the wrong semantics are applied (do any countries use red to mean "go"? I hope not.)

- -

In a similar vein, we need to make sure we are using the correct elements, giving our content the correct meaning, function, or appearance. In this context the {{htmlelement("h1")}} element is also a semantic element, which gives the text it wraps around the role (or meaning) of "a top level heading on your page."

- -
<h1>This is a top level heading</h1>
- -

By default, the browser will give it a large font size to make it look like a heading (although you could style it to look like anything you wanted using CSS). More importantly, its semantic value will be used in multiple ways, for example by search engines and screen readers (as mentioned above.)

- -

On the other hand, you could make any element look like a top level heading. Consider the following:

- -
<span style="font-size: 32px; margin: 21px 0;">Is this a top level heading?</span>
- -

This is a {{htmlelement("span")}} element. It has no semantics. You use it to wrap content when you want to apply CSS to it (or do something to it with JavaScript) without giving it any extra meaning (You'll find out more about these later on in the course.) We've applied some CSS to it to make it look like a top level heading, but since it has no semantic value, it will not get any of the extra benefits described above. It is a good idea to use the relevant HTML element for the job.

- -

Lists

- -

Now let's turn our attention to lists. Lists are everywhere in life — from your shopping list to the list of directions you subconsciously follow to get to your house every day, to the lists of instructions you are following in these tutorials! Lists are everywhere on the Web too, and we've got three different types to worry about.

- -

Unordered

- -

Unordered lists are used to mark up lists of items for which the order of the items doesn't matter — let's take a shopping list as an example.

- -
milk
-eggs
-bread
-hummus
- -

Every unordered list starts off with a {{htmlelement("ul")}} element — this wraps around all the list items:

- -
<ul>
-milk
-eggs
-bread
-hummus
-</ul>
- -

The last step is to wrap each list item in a {{htmlelement("li")}} (list item) element:

- -
<ul>
-  <li>milk</li>
-  <li>eggs</li>
-  <li>bread</li>
-  <li>hummus</li>
-</ul>
- -

Active learning: Marking up an unordered list

- -

Try editing the live sample below to create your very own HTML unordered list.

- - - -

{{ EmbedLiveSample('Playable_code_2', 700, 400) }}

- -

Ordered

- -

Ordered lists are lists in which the order of the items does matter — let's take a set of directions as an example:

- -
Drive to the end of the road
-Turn right
-Go straight across the first two roundabouts
-Turn left at the third roundabout
-The school is on your right, 300 meters up the road
- -

The markup structure is the same as for unordered lists, except that you have to wrap the list items in an {{htmlelement("ol")}} element, rather than <ul>:

- -
<ol>
-  <li>Drive to the end of the road</li>
-  <li>Turn right</li>
-  <li>Go straight across the first two roundabouts</li>
-  <li>Turn left at the third roundabout</li>
-  <li>The school is on your right, 300 meters up the road</li>
-</ol>
- -

Active learning: Marking up an ordered list

- -

Try editing the live sample below to create your very own HTML ordered list.

- - - -

{{ EmbedLiveSample('Playable_code_3', 700, 500) }}

- -

Active learning: Marking up our recipe page

- -

So at this point in the article, you have all the information you need to mark up our recipe page example. You can choose to either save a local copy of our text-start.html starting file and do the work there, or do it in the editable example below. Doing it locally will probably be better, as then you'll get to save the work you are doing, whereas if you fill it in to the editable example, it will be lost the next time you open the page. Both have pros and cons.

- - - -

{{ EmbedLiveSample('Playable_code_4', 700, 500) }}

- -

If you get stuck, you can always press the Show solution button, or check out our text-complete.html example on our github repo.

- -

Nesting lists

- -

It is perfectly ok to nest one list inside another one. You might want to have some sub-bullets sitting below a top level bullet. Let's take the second list from our recipe example:

- -
<ol>
-  <li>Remove the skin from the garlic, and chop coarsely.</li>
-  <li>Remove all the seeds and stalk from the pepper, and chop coarsely.</li>
-  <li>Add all the ingredients into a food processor.</li>
-  <li>Process all the ingredients into a paste.</li>
-  <li>If you want a coarse "chunky" hummus, process it for a short time.</li>
-  <li>If you want a smooth hummus, process it for a longer time.</li>
-</ol>
- -

Since the last two bullets are very closely related to the one before them (they read like sub-instructions or choices that fit below that bullet), it might make sense to nest them inside their own unordered list, and put that list inside the current fourth bullet. This would look like so:

- -
<ol>
-  <li>Remove the skin from the garlic, and chop coarsely.</li>
-  <li>Remove all the seeds and stalk from the pepper, and chop coarsely.</li>
-  <li>Add all the ingredients into a food processor.</li>
-  <li>Process all the ingredients into a paste.
-    <ul>
-      <li>If you want a coarse "chunky" hummus, process it for a short time.</li>
-      <li>If you want a smooth hummus, process it for a longer time.</li>
-    </ul>
-  </li>
-</ol>
- -

Try going back to the previous active learning example and updating the second list like this.

- -

Emphasis and importance

- -

In human language, we often emphasise certain words to alter the meaning of a sentence, and we often want to mark certain words as important or different in some way. HTML provides various semantic elements to allow us to mark up textual content with such effects, and in this section, we'll look at a few of the most common ones.

- -

Emphasis

- -

When we want to add emphasis in spoken language, we stress certain words, subtly altering the meaning of what we are saying. Similarly, in written language we tend to stress words by putting them in italics. For example, the following two sentences have different meanings.

- -

I am glad you weren't late.

- -

I am glad you weren't late.

- -

The first sentence sounds genuinely relieved that the person wasn't late. In contrast, the second one sounds sarcastic or passive-aggressive, expressing annoyance that the person arrived a bit late.

- -

In HTML we use the {{htmlelement("em")}} (emphasis) element to mark up such instances. As well as making the document more interesting to read, these are recognised by screen readers and spoken out in a different tone of voice. Browsers style this as italic by default, but you shouldn't use this tag purely to get italic styling. To do that, you'd use a {{htmlelement("span")}} element and some CSS, or perhaps an {{htmlelement("i")}} element (see below.)

- -
<p>I am <em>glad</em> you weren't <em>late</em>.</p>
- -

Strong importance

- -

To emphasize important words, we tend to stress them in spoken language and bold them in written language. For example:

- -

This liquid is highly toxic.

- -

I am counting on you. Do not be late!

- -

In HTML we use the {{htmlelement("strong")}} (strong importance) element to mark up such instances. As well as making the document more useful, again these are recognized by screen readers and spoken in a different tone of voice. Browsers style this as bold text by default, but you shouldn't use this tag purely to get bold styling. To do that, you'd use a {{htmlelement("span")}} element and some CSS, or perhaps a {{htmlelement("b")}} element (see below.)

- -
<p>This liquid is <strong>highly toxic</strong>.</p>
-
-<p>I am counting on you. <strong>Do not</strong> be late!</p>
- -

You can nest strong and emphasis inside one another if desired:

- -
<p>This liquid is <strong>highly toxic</strong> —
-if you drink it, <strong>you may <em>die</em></strong>.</p>
- -

Active learning: Let's be important!

- -

In this active learning section, we have provided an editable example. Inside it, we'd like you to try adding emphasis and strong importance to the words you think need them, just to have some practice.

- - - -

{{ EmbedLiveSample('Playable_code_5', 700, 500) }}

- -

Italic, bold, underline...

- -

The elements we've discussed so far have clearcut associated semantics. The situation with {{htmlelement("b")}}, {{htmlelement("i")}}, and {{htmlelement("u")}} is somewhat more complicated. They came about so people could write bold, italics, or underlined text in an era when CSS was still supported poorly or not at all. Elements like this, which only affect presentation and not semantics, are known as presentational elements and should no longer be used, because as we've seen before, semantics is so important to accessibility, SEO, etc.

- -

HTML5 redefined <b>, <i> and <u> with new, somewhat confusing, semantic roles.

- -

Here's the best rule of thumb: it's likely appropriate to use <b>, <i>, or <u> to convey a meaning traditionally conveyed with bold, italics, or underline, provided there is no more suitable element. However, it always remains critical to keep an accessibility mindset. The concept of italics isn't very helpful to people using screen readers, or to people using a writing system other than the Latin alphabet.

- -
    -
  • {{HTMLElement('i')}} is used to convey a meaning traditionally conveyed by italic: Foreign words, taxonomic designation, technical terms, a thought...
  • -
  • {{HTMLElement('b')}} is used to convey a meaning traditionally conveyed by bold: Key words, product names, lead sentence...
  • -
  • {{HTMLElement('u')}} is used to convey a meaning traditionally conveyed by underline: Proper name, misspelling...
  • -
- -
-

A kind warning about underline: People strongly associate underlining with hyperlinks. Therefore, on the Web, it's best to underline only links. Use the <u> element when it's semantically appropriate, but consider using CSS to change the default underline to something more appropriate on the Web. The example below illustrates how it can be done.

-
- -
<!-- scientific names -->
-<p>
-  The Ruby-throated Hummingbird (<i>Archilochus colubris</i>)
-  is the most common hummingbird in Eastern North America.
-</p>
-
-<!-- foreign words -->
-<p>
-  The menu was a sea of exotic words like <i lang="uk-latn">vatrushka</i>,
-  <i lang="id">nasi goreng</i> and <i lang="fr">soupe à l'oignon</i>.
-</p>
-
-<!-- a known misspelling -->
-<p>
-  Someday I'll learn how to <u>spel</u> better.
-</p>
-
-<!-- Highlight keywords in a set of instructions -->
-<ol>
-  <li>
-    <b>Slice</b> two pieces of bread off the loaf.
-  </li>
-  <li>
-    <b>Insert</b> a tomato slice and a leaf of
-    lettuce between the slices of bread.
-  </li>
-</ol>
- -

Summary

- -

That's it for now! This article should have given you a good idea of how to start marking up text in HTML, and introduced you to some of the most important elements in this area. There are a lot more semantic elements to cover in this area, and we'll look at a lot more in our 'More Semantic Elements' article, later on in the course. In the next article, we'll be looking in detail at how to create hyperlinks, possibly the most important element on the Web.

- -

{{PreviousMenuNext("Learn/HTML/Introduction_to_HTML/The_head_metadata_in_HTML", "Learn/HTML/Introduction_to_HTML/Creating_hyperlinks", "Learn/HTML/Introduction_to_HTML")}}

- -

 

- -

In this module

- - - -

 

diff --git a/files/ar/learn/html/introduction_to_html/index.html b/files/ar/learn/html/introduction_to_html/index.html deleted file mode 100644 index f237220f27..0000000000 --- a/files/ar/learn/html/introduction_to_html/index.html +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: مقدمة إلى HTML -slug: Learn/HTML/Introduction_to_HTML -tags: - - HTML - - صفحة هبوط - - لغة ترميز النص الفائق -translation_of: Learn/HTML/Introduction_to_HTML ---- -
{{LearnSidebar}}
- -

تعد لغة ترميز النص الفائق (HTML) لغة بسيطة جداً في صميمها، فهي مكوِّنة من عناصر يمكن تطبيقها على أجزاء من النص لإعطائها شكل أو وصف مختلف في الوثيقة (هل هذا النص فقرة؟ قائمة نقطية؟ هل هو جزء من جدول؟)، وتقوم بهيكلة الوثيقة إلى أقسام مُقسمة منطقياً (هل تملك تلك الصفحة رأس؟ ثلاث أعمدة من المحتوى؟ قائمة؟)، وتقوم بتضمين محتوى مثل الصور والفيديوهات في الصفحة. هذا القسم سوف يقدم لك أول وظيفتين سلف ذكرهما، كما سيغطي المفاهيم الأساسية والبنيّة الكتابيّة (syntax) التي تحتاج معرفتها لفهم اللغة.

- -

المتطلبات

- -

لا تحتاج لأي معرفة مسبقة في لغة ترميز النص الفائق للبدء في هذه الوحدة، ولكن يجب على الأقل أن تملك معرفة مبدئيّة حول استخدام الحواسيب، واستخدام متصفح الويب بشكل سلبي (بمعنى أخر، النظر إليه والتعامل مع المحتوى). يجب أن تملك بيئة عمل مُعدِة كما شُرِح في مقالة تثبيت البرمجيات الأساسية، ويجب أن يكون لديك معرفة بكيفيّة إنشاء وإدارة الملفات، كما شُرِح في مقالة التعامل مع الملفات. كلا المقالتين السابقتين جزء من وحدة البدء مع الويب المخصصة للمبتدئين.

- -
-

ملاحظة: إن كنت تعمل على حاسوب، جهاز لوحي، أو شيء آخر ولا تملك القدرة على إنشاء ملفات، يمكنك تجربة (معظم) الأمثلة هنا باستخدام محرر شيفرات برمجيّة على الأنترنت مثل JSBin أو Thimble.

-
- -

مقالات تعليميّة

- -

تحتوي هذه الوحدة على المقالات التالية، والتي ستتكلم عن جميع المواضيع الأساسيّة في هذه اللغة وستعطيك فرصة لتختبر بعض المهارات.

- -
-
البدء مع لغة ترميز النص الفائق
-
تغطي هذه المقالة أساسيات لغة ترميز النص الفائق، لقد شرحنا هنا العناصر، السمات، وجميع المصطلحات المهمة الأخرى التي قد سمعت عنها، وقد قمنا بشرحها بطريقة ملائمة. لقد قمنا أيضاً بشرح كيفيّة هيكلة (إنشاء) عنصر في اللغة، وكيف يتم استخدام اللغة لهيكلة صفحة قياسيّة، وقمنا بشرح مزايا اللغة الأخرى الأساسيّة. سوف نستخدم أيضاً خلال الشرح بعض الأمثلة لنخلق بعضاً من الإثارة!
-
ماذا يوجد في رأس الصفحة؟ البيانات الوصفية في لغة ترميز النص الفائق
-
رأس وثيقة لغة ترميز النص الفائق هو الجزء الذي لا يظهر في متصفح الويب عندما يتم تحميل الصفحة. يحتوي رأس الوثيقة على معلومات مثل عنوان الصفحة، وروابط ملفات صفحات الأنماط الانسيابية (إذا أردت أنْ تُنسِق محتوى وثيقتك باستخدام هذه اللغة)، وروابط لأيقونات المُفضلة (favicons)، والبيانات الوصفيّة (هي معلومات حول الوثيقة، مثل من كَتَبها، وكلمات مفتاحيّة مهمة تصفها).
-
أساسيات النصوص في لغة ترميز النص الفائق
-
إحدى الوظائف الرئيسيّة للغة ترميز النص الفائق هي وصف النصوص (إعطائها معنىً ودلالة)؛ حتّى يستطيع المتصفح أن يعلم كيف سيعرضها بشكل صحيح. هذه المقالة تقوم بعرض كيف يمكنك استخدام هذه اللغة لتقطيع النص إلى هياكل من العناوين والفقرات، وتعليم الكلمات على أنَّها مهمة، وإنشاء قوائم، والكثير من الأمور الأخرى.
-
إنشاء الوصلات
-
الوصلات مهمة جداً، فهي التي تجعل الويب ويباً. هذه المقالة تشرح طريقة إنشاء وصلات، وتناقش الطرق المثلى لاستخدامها.
-
تنسيق النصوص بشكل متقدم
-
يوجد العديد من العناصر الأخرى في لغة ترميز النص الفائق لتنسيق النصوص، والتي لم نتكلم عنها في مقالة أساسيات النصوص في لغة ترميز النص الفائق. العناصر المشروحة في هذه المقالة قليل الاستخدام، ولكن من الجيد معرفتها. في هذه المقالة ستتعلم التعامل مع الاقتباسات، القوائم الوصفيّة، الشيفرات البرمجيّة، كتابة كلمات علويّة وسفليّة (مثل التربيع عندما يكتب على عدد بالشكل 22)، معلومات الاتصال، والمزيد من الأمور.
-
هيكليّة الوثيقة والموقع
-
كما يتم تعريف الأجزاء الفرديّة من صفحتك (مثل الفقرة والصورة)، تُستخدَم لغة ترميز النص الفائق أيضاً لتعريف أقسام موقعك (مثل الرأس، الشريط، وأعمدة المحتوى الرئيسي). هذه المقالة تشرح كيفيّة تخطيط الهيكل الأساسي للموقع، وكيفيّة استخدام اللغة لتمثيل ذلك الهيكل.
-
تنقيح شيفرة لغة ترميز النص الفائق
-
كتابة وثيقة بلغة ترميز النص الفائق أمر سهل، ولكن ماذا إن حدث خطأ ما، ولم تستطع معرفة مكان ذلك الخطأ؟ هذه المقالة ستقدم لك بعض الأدوات التي ستساعدك على حل المشاكل المشابهة.
-
- -

اختبارات

- -

الاختبارات (التقييمات) التالية ستختبر فهمك لأساسيات اللغة المُغطاة في المقالات أعلاه.

- -
-
تنسيق رسالة
-
سوف تتعلم كتابة رسالة عاجلاً أم آجلاً. إنه لمن المثال المفيد لتجربة مهاراتنا في تنسيق النصوص! لذلك هذا الاختبار سوف يعطيك رسالة لتقوم بتنسيقها.
-
هيكلة محتوى الصفحة
-
هذا الاختبار سوف يختبر قدراتك على استخدام لغة ترميز النص الفائق لهيكلة محتوى صفحة بسيطة، تحتوي على رأس، ذيل، شريط، محتوى رئيسي، وشريط جانبي.
-
- -

طالِع أيضاً

- -
-
أساسيات محو أمية ويب
-
درس ممتاز من شركة موزيلا يقوم باستكشاف واختبار الكثير من المهارات التي تحدثنا عنها في وحدة مقدمة إلى HTML. المتعلمون سيحصلون على دراية في قراءة، كتابة، والمشاركة في الويب من خلال هذه الوحدة التي تتألف من ست أجزاء. اكتشف أساسيات الويب من خلال التعلم بطريقة إنتاجيّة وتعاونيّة.
-
- -
 
diff --git a/files/ar/learn/html/tables/index.html b/files/ar/learn/html/tables/index.html deleted file mode 100644 index de12a6ae1a..0000000000 --- a/files/ar/learn/html/tables/index.html +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: جداول HTML -slug: Learn/HTML/Tables -translation_of: Learn/HTML/Tables -original_slug: Learn/HTML/الجداول ---- -
{{LearnSidebar}}
- -

تتمثل مهمة شائعة جدًا في HTML في هيكلة البيانات الجدولية ، ولديها عدد من العناصر والسمات لهذا الغرض فقط. إلى جانب القليل من CSS للتصميم ، يجعل HTML من السهل عرض جداول المعلومات على شبكة الإنترنت مثل خطة درس مدرستك أو الجدول الزمني في حمام السباحة المحلي الخاص بك أو إحصائيات حول الديناصورات المفضلة لديك أو فريق كرة القدم. تنقلك هذه الوحدة إلى كل ما تحتاج إلى معرفته حول هيكلة بيانات الجداول باستخدام HTML.

- -

المتطلبات الأساسية

- -

قبل بدء هذه الوحدة ، يجب أن تكون قد قمت بالفعل بتغطية أساسيات HTML - راجع مقدمة إلى HTML.

- -
-

ملاحظة: إذا كنت تعمل على جهاز كمبيوتر / جهاز لوحي / جهاز آخر حيث لا تملك القدرة على إنشاء ملفاتك الخاصة ، فيمكنك تجربة (أكثر من) أمثلة التعليمات البرمجية في برنامج الترميز عبر الإنترنت مثل JSBin أو Thimble.

-
- -

خطوط إرشاد

- -

تحتوي هذه الوحدة على المقالات التالية:

- -
-
أساسيات جدول  HTML
-
تبدأ هذه المقالة في البدء بجداول HTML ، والتي تغطي الأساسيات ذاتها ، مثل الصفوف والخلايا ، والعناوين ، وخلايا تجعل الأعمدة والصفوف متعددة ، وكيفية تجميع كل الخلايا في عمود معًا لأغراض التصميم.
-
الميزات المتقدمة لجداول HTML وسهولة الوصول إليها
-
في المقالة الثانية في هذه الوحدة ، نلقي نظرة على بعض الميزات المتقدمة لجداول HTML - مثل التسميات التوضيحية / الملخصات وتجميع صفوفك في أقسام رأس الجدول والجسم والتذييل - وكذلك النظر في إمكانية الوصول إلى الجداول للمستخدمين ذوي الإعاقات البصرية .
-
- -

تقييم

- -
-
هيكلة بيانات الكوكب
-
في تقييم الجدول الخاص بنا ، نوفر لك بعض البيانات حول الكواكب في نظامنا الشمسي ، ونجعلك تنظّمها في جدول HTML.
-
- -
diff --git a/files/ar/learn/index.html b/files/ar/learn/index.html deleted file mode 100644 index 056540bdd7..0000000000 --- a/files/ar/learn/index.html +++ /dev/null @@ -1,128 +0,0 @@ ---- -title: تعلم تطوير الويب -slug: Learn -tags: - - تعلم - - صفحة هبوط - - فهرس - - مبتدئين - - مقدمة - - ويب -translation_of: Learn ---- -
-

مرحبا بك في قسم بـشبكة مطوري موزيلا للتعلم. تهدف مجموعة المقالات هذه إلى توفير كل ما يحتاجه المبتدئون في تطوير الويب للبدء ببناء مواقعهم.

-
- -

ليس الهدف من هذا القسم هو أن يأخذك من مرحلة «مبتدئ» إلى مرحلة «الإحتراف» ولكن لأخذك من مرحلة «مبتدئ» إلى «الإكتفاء بالأساسيات». ثم ومن هنا يجب أن تكون قادراً على إكمال طريقك عبر دراسة  بقيّة مصادر شبكة مطوري موزيلا، وغيرها من المصادر ذات المستوى المتوسط والمتقدم التي تتطلب معرفة مسبقة.

- -

إذا كنت مبتدئ، تطوير الويب يمكن أن يكون تحدياً - سنساعدك وسنوفر لك تفاصيل كافية لتشعر بالراحة وتدرس المواضيع كما ينبغي. هذا هو مكانك إن كنت طالباً يتعلم تطوير الويب (بشكل ذاتي أو كجزء من الدراسة)، مدرساً يبحث عن مصادر، هاوٍ، أو شخص ما يريد فقط فهم المزيد حول طريقة عمل تقنيات الويب.

- -
-

مهم: المحتوى في هذا القسم هو محتوى متجدد باستمرار. فإذا كان لديك أسئلة بخصوص مواضيع تود أن يتم تغطيتها أو تشعر أنها ناقصة، انظر إلى قسم «تواصل معنا» أسفله للحصول على معلومات عن كيفية التواصل معنا.

-
- -

من أين أبدا

- - - -
-

ملاحظة: يحتوي قاموسنا على تعريفات للمصطلحات

-
- -

{{LearnBox({"title":"معلومة سريعة", "sources":"/ar/docs/Glossary"})}}

- -

المواضيع المغطاة

- -

القائمة التالية تحتوي على جميع المواضيع التي تمت تغطيتها في قسم التعلم الخاص بشبكة مطوري موزيلا.

- -
-
البدء مع الويب
-
توفر الوحدة مقدمة عملية عن تطوير الويب للمبتدئين.
-
لغة ترميز النص الفائق — لبنة الويب
-
لغة ترميز النص الفائق (HTML) هي اللغة التي نستخدمها لهيكلة أجزاء مختلفة من محتوانا ولتحديد معناها أو الغرض منها. هذا الموضوع يشرح هذه اللغة بالتفصيل.
-
صفحة الأنماط الانسيابية — تصميم الويب
-
صفحات الأنماط الانسيابية (CSS) هي اللغة التي نستخدمها لتصميم وتنسيق محتوى الويب، كما نستخدمها لإضافة تأثيرات مثل الرسوم المتحركة. يوفر هذا الموضوع تغطية شاملة لهذه التقنية.
-
الجافاسكربت — لغة برمجة ديناميكية لتطوير جهة العميل
-
تعد الجافاسكربت (JavaScript) لغة برمجة ديناميكيّة تُستخدم لإضافة ميزات تفاعليّة لصفحات الويب. يشرح هذا الموضوع جميع الأساسيات الضرورية لتُصبح قادراً على القراءة والكتابة باستخدام هاته اللغة.
-
الإتاحة — اجعل الويب متاحاً للجميع
-
الإتاحة (Accessibility) هي جعل محتوى الويب متاحاً لأكبر قدر من الناس بغض النظر عن الإعاقة التي لديهم، أو الجهاز الذي يستخدمونه، أو اللغة التي يتقنوها، أو أي عامل آخر. يقدم هذا الموضوع كل ما تحتاج معرفته عن هذا المفهوم.
-
الأدوات والإختبار
-
يُغطي هذا الموضوع الأدوات التي يستخدمها المطورون لتسهيل عملهم، مثل أدوات الإختبار العابرة للمتصفحات (corss-browser).
-
برمجة جهة الخادم
-
حتى ولو كنت مُركزاً على تطوير جهة العميل (client-side)، مازال من المفيد التعرُّف على كيفيّة عمل الخوادم وما هي المزايا التي تمتلكها لغات جهة الخادم (server-side). توفر هذه المقالة مقدمة عامة حول كيفيّة عمل جهة الخادم، كما تقدم دورة مُفصلة عن كيفيّة بناء تطبيق يعمل على الخادم باستخدام إطارين عمل (frameworks) مشهورين — جانغو (لغة بايثون) وأكسبريس (نود).
-
- -

احصل على أمثلتنا البرمجيّة

- -

جميع الأمثلة البرمجية التي ستشاهدها في قسم التعلم متوفرة على جيتهاب. إذا أردت نسخهم جميعاً إلى حاسوبك، فأسهل طريقة هي:

- -
    -
  1. تثبيت جيت على حاسوبك. يعد جيت برمجيّة التحكم بالإصدارات الأساسيّة التي يستخدمها جيتهاب للقيام بعمله.
  2. -
  3. قم بإنشاء حساب على جيتهاب. العملية سهلة وبسيطة
  4. -
  5. بعدما تنتهي من إنشاء الحساب، قم بتسجيل الدخول إلى الموقع باسم المستخدم وكلمة المرور خاصتك.
  6. -
  7. افتح موجه الأوامر على حاسوبك (إذا كنت تستخدم ويندوز) أو الطرفية (إذا كنت تستخدم لينُكس أو ماك)
  8. -
  9. لتقوم بنسخ مستودع قسم التعلم إلى مجلد يسمى "learning-are" في مسارك الحالي، استخدم الأمر التالي: -
    git clone https://github.com/mdn/learning-area
    -
  10. -
  11. يمكنك الآن الدخول إلى المجلد لتجد الملف الذي تبحث عنه (إما باستخدام مدير الملفات أو باستخدام الأمر cd)
  12. -
- -

يمكنك الحصول على آخر التحديثات المُجراة على مستودع وتحميلها إلى مجلدك تلقائياً عن طريق اتباع الخطوات التالية:

- -
    -
  1. باستخدام موجه الأوامر/الطرفية، ادخل إلى المجلد  learning-area باستخدام الأمر cd. على سبيل المثال إذا كنت في المجلد الحاوي للمجلد   learning-area استخدم الأمر: - -
    cd learning-area
    -
  2. -
  3. قم بتحديث المستودع باستخدام الأمر التالي: -
    git pull
    -
  4. -
- -

- -

تواصل معنا

- -

إذا أردت التواصل معنا من أجل إخبارنا بأي شيءٍ كان، فأفضل طريقة هي إرسال رسالة لنا عن طريق موضوع قسم التعلم أو باستخدام قنوات IRC. نود أن نسمع منك أي شيء بخصوص ما تظنه خاطئاً أو مفقوداً على هذا الموقع، أو طلبات لمواضيع تعلم جديدة، أو طلبات للمساعدة بخصوص شيء لا تستطيع فهمه، أو أي أسئلة أخرى.

- -

- -

طالع أيضاً

- -
-
القائمة البريدية لمطوري موزيلا
-
قائمتنا البريدية لمطوري الويب، والتي تعد مصدر عظيم لجميع مستويات الخبرة.
-
- -
-
موقع Codecademy
-
موقع تفاعلي رائع لتعليم لغات البرمجة من الصفر.
-
EXLskills
-
دورات مجانية ومفتوحة لتعلم المهارات التقنية ، مع الإرشاد والتعلم القائم على المشاريع
-
موقع Code.org
-
مقالات وتدريبات برمجيّة بسيطة تستهدف بشكل أساسي المبتدئين.
-
موقع freeCodeCamp.org
-
موقع تفاعلي يحتوي على دورات ومشاريع لتعليم تطوير الويب.
-
- -
-
أنشطة تعليميّة
-
سلسلة من الأنشطة التعليميّة للتعليم مُنشأة من قبل مؤسسة موزيلا، تغطي كل شيء بدءً من أساسيات الويب والخصوصيّة وصولاً إلى الجافا سكربت وغيرها من التقنيات المتقدمة.
-
- -

diff --git a/files/ar/learn/javascript/first_steps/a_first_splash/index.html b/files/ar/learn/javascript/first_steps/a_first_splash/index.html deleted file mode 100644 index 2a6a1c4860..0000000000 --- a/files/ar/learn/javascript/first_steps/a_first_splash/index.html +++ /dev/null @@ -1,618 +0,0 @@ ---- -title: البداية في الجافا سكربت -slug: Learn/JavaScript/First_steps/A_first_splash -tags: - - أحداث - - تعلم - - جافا سكربت - - حالات شرطية - - دالة - - سكربت - - عمليات - - كائنات - - مبتديء - - متغيرات - - مقال -translation_of: Learn/JavaScript/First_steps/A_first_splash ---- -
{{LearnSidebar}}
- -
{{PreviousMenuNext("Learn/JavaScript/First_steps/What_is_JavaScript", "Learn/JavaScript/First_steps/What_went_wrong", "Learn/JavaScript/First_steps")}}
- -

بما أنك الآن قد تعرفت على المفهوم العام للغةْ جافاسكريبت, و ما الذي يمكن أن تعمله بها, سنقوم الآن بإعطائك كورس مكثف في أساسيات جافاسكريبت من خلال دروس تعتمد تماما على التجربة العملية. ستقوم الآن و خطوة بخطوة بعمل لعبةْإحزر الرقم .

- -

- - - - - - - - - - - - -
المتطلبات اﻷساسية:فهم أساسيات الحاسوب، فهم أساسيات HTML و CSS, وفهم ما هي الجافا سكربت.
الهدف:أخذ قليل من الخبرة في كتابة بعض الجافا سكربت، وفهم القليل من اﻷساسيات لفهم كتابة برنامج بالجافا سكربت  .
- -

لا تتوقع أن تفهم كل تفاصيل الكود في الوقت الحالي __ نحن نريد أن نقدم لك المباديء العليا اﻵن، وإعطاؤك فكرة عن كيفية عمل الجافاسكربت ( وأي لغة برمجة أخرى ). في المقالات اللاحقة ، سوف نرى كل هذه الميزات بكثير من التفصيل!

- -
-

ملحوظة: العديد من ملامح الكود سوف تراها في الجافا سكربت كما في اللغات البرمجية اﻵخرى __ الدوال ، الحلقات التكرارية، إلخ. بنية الكود تبدو مختلفة ، ولكن المبدأ واحد ﻻ يتغير .

-
- -

فكر مثل المُبَرْمِج

- -

واحد من اﻷشياء الصعبة في تعلم البرمجة ليس بنية الكود، ولكن كيف تطبق هذا الكود لحل المشاكل في العالم الحقيقي. أنت تحتاج للبدء في التفكير مثل المُبَرْمِج__ عمومًا هذا يتضمن النظر في وصف ماذا يحتاج برنامجك لكي يعمل, وعلى ماذا يعمل. ملامح الكود تحتاج ﻷن تحقق هذه اﻷشياء، وكيفية جعلهم يعملون معًا.

- -

المتطلبات مزيج من العمل الجاد ، الخبرة في تركيب الجملة البرمجية ، و التدريب بجانب قليل من اﻹبداع. كلما قمت بكتابة الكود ، كلما كان ذلك أفضل . ﻻ نعدك أن تطور " عقل المبرمج " في خمسة دقائق، ولكن سوف نعطيك الكثير من الفرص للتدريب على التفكير مثل المُبَرْمِج خلال هذه الدورة .

- -

مع أخذ ذلك في الاعتبار ، دعنا نأخذ مثال سوف ننشأه في هذا المقال، ومراجعة العملية العامة لتقسيمها إلى مهام ملموسة . 

- -

مثال __ لعبة تخمين الرقم

- -

في هذا المقال سنعرض لك كيفية بناء لعبة بسيطة كما في هذا المثال :

- - - -

{{ EmbedLiveSample('Top_hidden_code', '100%', 320, "", "", "hide-codepen-jsfiddle") }}

- -

جرب اللعب __ تعرف بنفسك على اللعبة قبل أن تمضي قُدُمًا .

- -

دعنا نتخيل رئيسك في العمل أعطاك المختصر التالي ﻹنشاء هذه اللعبة :

- -
-

أريد منك أن تنشيء لعبة بسيطة وهي لعبة تخمين الرقم. يجب اختيار رقم عشوائي بين 1 و 100 ،  ثم تحدي اللاعب لتخمين الرقم في 10 مرات. بعد كل مرة يجب إخبار اللاعب هل الرقم صحيح أم خطأ  — و إذا كانت اﻷرقام المخمنة خطأ ، فهل كان التخمين قريب جدًا أم بعيد جدًا . يجب أن يخبر اللاعب أيضًا ما اﻷرقام التي خمنها سابقًا . اللعبة تنتهي عندما يخمن اللاعب الرقم الصحيح، أو تستمر اللعبة حتي نهاية عدد المرات. عندما تنتهي اللعبة يجب إعطاء اللاعب خيار بدء اللعبة مرة أخرى .

-
- -

بناءًا على النظر في هذا المختصر ، أول شيء يمكننا فعله هو البدء في تقسيمها إلى مهام بسيطة قابلة للتنفيذ، مثل عقلية المبرمج :

- -
    -
  1. أنشيء رقم عشوائي بين 1 و 100 .
  2. -
  3. سجل الرقم الذي أدخله اللاعب . بداية من رقم 1 .
  4. -
  5. أعطِ اللاعب طريقة لتخمين ما هو الرقم .
  6. -
  7. بمجرد أن يدخل اللاعب الرقم ، سجل أول رقم بحيث يستطيع اللاعب أي يرى تخمينات السابقة.
  8. -
  9. ثم ، تأكد ما إذا كان الرقم صحيح.
  10. -
  11. إذا كان صحيحًا : -
      -
    1. اعرض رسالة التهنئة .
    2. -
    3. امنع اللاعب من كتابة تخمينات أخرى ( ﻷن هذا سيفسد اللعبة) .
    4. -
    5. اعرض للاعب أن يبدأ اللعبة مرة أخرى .
    6. -
    -
  12. -
  13. إذا كان خطأ واللاعب لديه مرات أخرى : -
      -
    1. أخبر اللاعب أن التخمين خطأ .
    2. -
    3. اسمح للاعب بإدخال تخمين آخر.
    4. -
    5. قم بزيادة المحاوﻻت بمقدار 1 .
    6. -
    -
  14. -
  15. إذا كان خطأ واللاعب ليس لدي مرات أخرى: -
      -
    1. أخبر اللاعب أن اللعبة انتهت .
    2. -
    3. امنع اللاعب من كتابة تخمينات أخرى ( ﻷن هذا سيفسد اللعبة) .
    4. -
    5. اعرض للاعب أن يبدأ اللعبة مرة أخرى .
    6. -
    -
  16. -
  17. عندما يُعاد تشغيل اللعبة ، تأكد من إعادة تعيين اللعبة وواجهة المستخدم ، ثم نفذ الخطوة رقم 1 .
  18. -
- -

دعنا نبدأ اﻵن ، لنرى كيف نستطيع أن نحول هذه الخطوات إلى كود، وننشيء هذا المثال ، ونستكشف ميزات الجافا سكربت في طريقنا :

- -

اﻹعداد اﻷولي

- -

للبدء في الحل ، نفضل أن تأخذ نسخة من ملف , number-guessing-game-start.html  (هنا يمكن رؤية المثال الحي). افتح الملف في محرر النصوص الخاص بك وفي متصفح الويب.سترى عنوان رئيسي وفقرة التعليمات و نموذج ﻹدخال التخمينات ، ولكن هذا النموذج حاليًا لن يقوم بعمل أي شيء .

- -

المكان حيث سنضيف الكود الخاص بنا بداخله  {{htmlelement("script")}} يوجد في آخر ملف HTML :

- -
<script>
-
-  // Your JavaScript goes here
-
-</script>
-
- -

إضافة المتغيرات لتخزين البيانات الخاصة بنا

- -

دعونا نبدأ. قبل كل شيء ، أضف اﻷسطر التالية بداخل عنصر{{htmlelement("script")}} :

- -
let randomNumber = Math.floor(Math.random() * 100) + 1;
-
-const guesses = document.querySelector('.guesses');
-const lastResult = document.querySelector('.lastResult');
-const lowOrHi = document.querySelector('.lowOrHi');
-
-const guessSubmit = document.querySelector('.guessSubmit');
-const guessField = document.querySelector('.guessField');
-
-let guessCount = 1;
-let resetButton;
- -

في هذا القسم من الكود فقد هيئنا المتغيرات والثوابت التي سنحتاجها لتخزين بيانات برنامجنا. المتغيرات تحتوي بشكل أساسي على قيم ( مثل الأرقام، النصوص). ﻹنشاء متغير نكتب الكلمة let  ( أو var ) متبوعة باسم المتغير ( للمزيد عن الاختلاف بين الكلمات المفتاحية في هذه المقالة ). الثوابت تستخدم لتخزين قيم غير قابلة للتغيير أو ﻻ تتغير وتكتب الثوابت بعد الكلمة المفتاحية const. في هذه الحالة ، نستخدم الثوابت لتخزين مراجع ﻷجزاء من واجهة المستخدم ; النص بداخل بعض هذه الثوابت ممكن أن يتغير ، ولكن عنصر HTML  يبقى كما هو .

- -

تستطيع تعيين قيمة للمتغير أو الثابت بعد علامة يساوي (=) متبوعة بالقيمة التي تريدها .

- -

في مثالنا :

- -
    -
  • المتغير اﻷول — randomNumber — يحدد رقم عشوائي بين 1 و 100 ، حيث تم حسابه باستخدام خوارزمية رياضية .
  • -
  • أول ثلاثة ثوابت هي لتخزين مرجع للفقرات في HTML ، وتستخدم ﻹدخال قيم في عنصر الفقرات في الكود ( ﻻحظ أنهم بداخل عنصر <div> ، الذي يستخدم لتحديد الثلاثة لتهيئتهم في وقت ﻻحق ، عندما نعيد تشغيل اللعبة) -
    <div class="resultParas">
    -  <p class="guesses"></p>
    -  <p class="lastResult"></p>
    -  <p class="lowOrHi"></p>
    -</div>
    -
  • -
  • الثابتين التاليين يخزنان مراجع لنص حقل اﻹدخال و زر اﻹرسال حيث يستخدم للتحكم في إرسال الرقم الذي تم تخمينه .
  • -
  • -
    <label for="guessField">Enter a guess: </label><input type="text" id="guessField" class="guessField">
    -<input type="submit" value="Submit guess" class="guessSubmit">
    -
  • -
  • آخر متغيرين لدينا يخزنان عدد مرات التخمين بداية من المرة 1 ( يستخدم لحفظ كم مرة قام اللاعب بالتخمين )، ومرجع لزر التهيئة (حيث سيكون موجود فيما بعد ) .
  • -
- -
-

ملحوظة: سوف تتعمل المزيد عن المتغيرات / الثوابت فيما بعد في هذه الدورة ، بداية من المقال التالي .

-
- -

الدوال

- -

ثم ، أضف التالي أسفل كود الجافا سكربت الذي كتبناه باﻷعلى :

- -
function checkGuess() {
-  alert('I am a placeholder');
-}
- -

الدوال هي جزء من الكود يمكن إعادة استخدامه حيث تستطيع كتابة مرة واحدة واستدعاؤه مرة أخرى ومرة أخرى، وحفظ الكود الذي نحتاج لتكراره دائمًا .هذا حقًا مفيد.هناك عدة طرق لتعريف الدوال، ولكن اﻵن سنركز على نوع بسيط. هنا عرَّفنا الدالة باستخدام الكلمة المفتاحية  function, متبوعة بالاسم, مع اﻷقواس بعدها . بعد ذلك وضعنا اﻷقواس المعقوفة ({ }). بداخل اﻷقواس المعقوفة نكتب الكود الذي نريده لكي يعمل عندما نستدعي هذه الدالة.

- -

عندما نريد تشغير الكود ، نكتب اسم الدالة متبوعًا باﻷقواس.

- -

دعنا نحاول اﻵن. احفظ الكود و أعد تحميل الصفحة في المتصفح. ثم اذهب إلى   developer tools JavaScript console, وأدخل السطر التالي :

- -
checkGuess();
- -

بعد الضغط على Return/Enter, يجب أن ترى تحذير يقول لك "I am a placeholder" لقد عرَّفنا الدالة في الكود الخاص بنا حيث تنشيء تحذير عند استدعائها.

- -
-

ملحوظة: سوف تتعلم المزيد عن الدوال في هذه الدورة .

-
- -

العمليات الرياضية

- -

العمليات الرياضية في الجافا سكربت تسمح لنا أن نجري اختبارات، حل الرياضيات، ربط مجموعة كلمات ونصوص مع بعضهم البعض، وأشياء أخرى.

- -

إذا لم تقم بذلك بالفعل ، احفظ الكود الخاص بك، أعد تحميل الصفحة في المتصفح الخاص بك، وافتح developer tools JavaScript console .بعد ذلك نستطيع الكتابة كما في المثال التالي __ اكتب كل واحد من أعمدة "المثال" كما هو موضح تمامًا، اضغط Return/Enter بعد كل واحد، وانظر ما هي النتائج التي ظهرت :

- -

أوﻻً دعنا نلقى نظرة على العمليات الحسابية ، على سبيل المثال :

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
العمليةالمسمىمثال
+الجمع6 + 9
-الطرح20 - 15
*الضرب3 * 7
/القسمة10 / 5
- -

أيضًا تستطيع استخدام علامة + لربط النصوص معًا ( في البرمجة، هذا يسمى التسلسل). جرب إدخال السطور التالية ، واحدًا تلو الآخر :

- -
let name = 'Bingo';
-name;
-let hello = ' says hello!';
-hello;
-let greeting = name + hello;
-greeting;
- -

هناك أيضًا بعض العمليات الحسابية المختصرة ، تسمى زيادة عوامل التخصيص. على سبيل المثال ، إذا أردت إضافة نص جديد لنص موجود بالفعل وترى النتيجة ، تستطيع كتابة هذا :

- -
name += ' says hello!';
- -

هذا يعادل :

- -
name = name + ' says hello!';
- -

عند استخدام حالة صح/ خطأ ( على سبيل المثال بداخل الحاﻻت الشرطية __ انظر {{anch("Conditionals", "below")}} ) نستخدم عمليات المقارنة . على سبيل المثال :

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
العمليةالمسمىمثال
===المساواة الصارمة(هل هي نفسها بالضبط؟) -
-5 === 2 + 4 // false
-'Chris' === 'Bob' // false
-5 === 2 + 3 // true
-2 === '2' // false; number versus string
-
!==عدم المساواة (أليست هي نفسها؟) -
-5 !== 2 + 4 // true
-'Chris' !== 'Bob' // true
-5 !== 2 + 3 // false
-2 !== '2' // true; number versus string
-
<أقل من -
-6 < 10 // true
-20 < 10 // false
-
>أكبر من -
-6 > 10 // false
-20 > 10  // true
-
- -

الحاﻻت الشرطية

- -

بالعودة إلى دالة checkGuess() ، أعتقد أنه من المكن قول أننا ﻻ نريدها ﻹظهار رسالة placeholder . نحن نريدها لفحص هل تخمين اللاعب صحيح أم غير صحيح،  واﻹستجابة بشكل مناسب.

- -

في هذه النقطة، استبدل دالة checkGuess() بهذا بدلًا من ذلك :

- -
function checkGuess() {
-  let userGuess = Number(guessField.value);
-  if (guessCount === 1) {
-    guesses.textContent = 'Previous guesses: ';
-  }
-  guesses.textContent += userGuess + ' ';
-
-  if (userGuess === randomNumber) {
-    lastResult.textContent = 'Congratulations! You got it right!';
-    lastResult.style.backgroundColor = 'green';
-    lowOrHi.textContent = '';
-    setGameOver();
-  } else if (guessCount === 10) {
-    lastResult.textContent = '!!!GAME OVER!!!';
-    setGameOver();
-  } else {
-    lastResult.textContent = 'Wrong!';
-    lastResult.style.backgroundColor = 'red';
-    if(userGuess < randomNumber) {
-      lowOrHi.textContent = 'Last guess was too low!';
-    } else if(userGuess > randomNumber) {
-      lowOrHi.textContent = 'Last guess was too high!';
-    }
-  }
-
-  guessCount++;
-  guessField.value = '';
-  guessField.focus();
-}
- -

هذا كثير من التعليمات البرمجية __ حسنًا ! دعنا ننتقل إلى كل قسم وشرح ما يفعله.

- -
    -
  • السطر اﻷول (سطر رقم 2 في اﻷعلى) يعلن عن متغير يسمى userGuess ويهييء قيمته إلى القيمة المدخلة في حقل النصوص. أيضًا نستطيع أخذ هذه القيمة بواسطة دالة Number() ، فقط للتأكد من أن القيمة بالفعل رقم .
  • -
  • في السطر التالي، سنقابل أول كود من الحالات الشرطية (سطر 3-5 في اﻷعلى). كود الحالة الشرطية يسمح لك بتشغيل الكود بشكل انتقائي، بالاعتماد على حالة شرطية مؤكدة صح أو خطأ. يشبه هذا قليلًا الدالة، لكنه ليس بدالة. ببساطة لبدء كود الحالة الشرطية نكتب الكلمة المفتاحية if ، ثم بعض اﻷقواس، ثم اﻷقواس المعقوفة. بداخل اﻷقواس نكتب الشرط. إذا كان الشرط صحيح true ، سوف يشغل الكود بداخل اﻷقواس المعقوفة. وإذا كان غير ذلك ، لن ينفذ شيء وسينتقل لتشغيل باقي الكود. في حالتنا هذه الشرط سوف يتحقق ما إذا كان متغير guessCount يساوي 1 (أي ما إذا كانت هذه هي المرة اﻷولى للاعب أم ﻻ):
  • -
  • -
    guessCount === 1
    -
  • -
- -

إذا كان اﻷمر كذلك، فإننا نجعل نص فقرة التخمينات مساويًا لــ "Previous guesses: ". وإذا كان غير ذلك ، فلن نفعل.

- -
    -
  • السطر 6 يضيف قيمة  userGuess في نهاية الفقرة guesses ، باﻹضافة إلى مسافة لذلك ستكون هناك مسافة بين كل تخمين .
  • -
  • الكود التالي (السطور من 8-24 في اﻷعلى) تقوم بالقليل من المراجعات : -
      -
    • أولًا if(){} تفحص ما إذا كان تخمين المستخدم مساويًا لــ randomNumber الذي عرفناه في أعلى كود الجافاسكربت. إذا صحيحًا إذا اللاعب قام بالتخمين الصحيح وربح في هذه اللعبة، لذلك يتم عرض رسالة التهاني ، ويتم مسح مربع النص الذي يحتوي على تخمين عالي/منخفض، ويتم تشغيل دالة setGameOver() التي سنشرحها فيما بعد.
    • -
    • اﻵن لدينا حالة شرطية أخرى باستخدام else if(){}. حيث إنها تفحص ما إذا كانت هذه المرة هي آخر مرة للاعب أم ﻻ. إذا كانت آخر مرة فإن هذا البرنامج يفعل نفس اﻷشياء في الكود السابق، مع عرض رسالة انتهت اللعبة بدلاً من رسالة التهنئة.
    • -
    • الجزء اﻷخير يحتوي على ( else { } )الذي يحتوي على الكود الذي يعمل فقط في حالة الحاﻻت الشرطية( مثل أن اللاعب لم يخمن الرقم الصحيح، ولكن تبقى له المزيد من التخمينات). في هذه الحالة سوف نخبره بأن تخمينه خطأ ، ثم نشغل حالة شرطية أخرى حيث تفحص ما إذا كان التخمين عالى أو أقل من اﻹجابة، وعرض رسالة أخرى تخبر اللاعب إذا كان تخمينه أعلى أو أقل .
    • -
    -
  • -
  • آخر ثلاثة أسطر في هذه الدالة ( السطور من 26-28 في الأعلى)تكون مستعدة ﻹرسال التخمين. لقد أضفنا 1 لمتغير guessCount لحساب استهلاك اللاعب عدد أدواره(++ هي عملية زيادة__ أي زيادة بمقدار 1 في المرة)، وتفريغ قيم حقل النصوص ، والاستعداد للدور القادم من التخمين .
  • -
- -

اﻷحداث

- -

At this point we have a nicely implemented checkGuess() function, but it won't do anything because we haven't called it yet. Ideally we want to call it when the "Submit guess" button is pressed, and to do this we need to use an event. Events are things that happen in the browser — a button being clicked, a page loading, a video playing, etc. — in response to which we can run blocks of code. The constructs that listen out for the event happening are called event listeners, and the blocks of code that run in response to the event firing are called event handlers.

- -

Add the following line below your checkGuess() function:

- -
guessSubmit.addEventListener('click', checkGuess);
- -

Here we are adding an event listener to the guessSubmit button. This is a method that takes two input values (called arguments) — the type of event we are listening out for (in this case click) as a string, and the code we want to run when the event occurs (in this case the checkGuess() function). Note that we don't need to specify the parentheses when writing it inside {{domxref("EventTarget.addEventListener", "addEventListener()")}}).

- -

Try saving and refreshing your code now, and your example should work — to a point. The only problem now is that if you guess the correct answer or run out of guesses, the game will break because we've not yet defined the setGameOver() function that is supposed to be run once the game is over. Let's add our missing code now and complete the example functionality.

- -

Finishing the game functionality

- -

Let's add that setGameOver() function to the bottom of our code and then walk through it. Add this now, below the rest of your JavaScript:

- -
function setGameOver() {
-  guessField.disabled = true;
-  guessSubmit.disabled = true;
-  resetButton = document.createElement('button');
-  resetButton.textContent = 'Start new game';
-  document.body.appendChild(resetButton);
-  resetButton.addEventListener('click', resetGame);
-}
- -
    -
  • The first two lines disable the form text input and button by setting their disabled properties to true. This is necessary, because if we didn't, the user could submit more guesses after the game is over, which would mess things up.
  • -
  • The next three lines generate a new {{htmlelement("button")}} element, set its text label to "Start new game", and add it to the bottom of our existing HTML.
  • -
  • The final line sets an event listener on our new button so that when it is clicked, a function called resetGame() is run.
  • -
- -

Now we need to define this function too! Add the following code, again to the bottom of your JavaScript:

- -
function resetGame() {
-  guessCount = 1;
-
-  var resetParas = document.querySelectorAll('.resultParas p');
-  for (var i = 0 ; i < resetParas.length ; i++) {
-    resetParas[i].textContent = '';
-  }
-
-  resetButton.parentNode.removeChild(resetButton);
-
-  guessField.disabled = false;
-  guessSubmit.disabled = false;
-  guessField.value = '';
-  guessField.focus();
-
-  lastResult.style.backgroundColor = 'white';
-
-  randomNumber = Math.floor(Math.random() * 100) + 1;
-}
- -

This rather long block of code completely resets everything to how it was at the start of the game, so the player can have another go. It:

- -
    -
  • Puts the guessCount back down to 1.
  • -
  • Clears all the information paragraphs.
  • -
  • Removes the reset button from our code.
  • -
  • Enables the form elements, and empties and focuses the text field, ready for a new guess to be entered.
  • -
  • Removes the background color from the lastResult paragraph.
  • -
  • Generates a new random number so that you are not just guessing the same number again!
  • -
- -

At this point you should have a fully working (simple) game — congratulations!

- -

All we have left to do now in this article is talk about a few other important code features that you've already seen, although you may have not realized it.

- -

Loops

- -

One part of the above code that we need to take a more detailed look at is the for loop. Loops are a very important concept in programming, which allow you to keep running a piece of code over and over again, until a certain condition is met.

- -

To start with, go to your browser developer tools JavaScript console again, and enter the following:

- -
for (var i = 1 ; i < 21 ; i++) { console.log(i) }
- -

What happened? The numbers 1 to 20 were printed out in your console. This is because of the loop. A for loop takes three input values (arguments):

- -
    -
  1. A starting value: In this case we are starting a count at 1, but this could be any number you like. You could replace the letter i with any name you like too, but i is used as a convention because it's short and easy to remember.
  2. -
  3. An exit condition: Here we have specified i < 21 — the loop will keep going until i is no longer less than 21. When i reaches 21, the loop will no longer run.
  4. -
  5. An incrementor: We have specified i++, which means "add 1 to i". The loop will run once for every value of i, until i reaches a value of 21 (as discussed above). In this case, we are simply printing the value of i out to the console on every iteration using {{domxref("Console.log", "console.log()")}}.
  6. -
- -

Now let's look at the loop in our number guessing game — the following can be found inside the resetGame() function:

- -
var resetParas = document.querySelectorAll('.resultParas p');
-for (var i = 0 ; i < resetParas.length ; i++) {
-  resetParas[i].textContent = '';
-}
- -

This code creates a variable containing a list of all the paragraphs inside <div class="resultParas"> using the {{domxref("Document.querySelectorAll", "querySelectorAll()")}} method, then it loops through each one, removing the text content of each.

- -

A small discussion on objects

- -

Let's add one more final improvement before we get to this discussion. Add the following line just below the var resetButton; line near the top of your JavaScript, then save your file:

- -
guessField.focus();
- -

This line uses the {{domxref("HTMLElement.focus", "focus()")}} method to automatically put the text cursor into the {{htmlelement("input")}} text field as soon as the page loads, meaning that the user can start typing their first guess right away, without having to click the form field first. It's only a small addition, but it improves usability — giving the user a good visual clue as to what they've got to do to play the game.

- -

Let's analyze what's going on here in a bit more detail. In JavaScript, everything is an object. An object is a collection of related functionality stored in a single grouping. You can create your own objects, but that is quite advanced and we won't be covering it until much later in the course. For now, we'll just briefly discuss the built-in objects that your browser contains, which allow you to do lots of useful things.

- -

In this particular case, we first created a guessField variable that stores a reference to the text input form field in our HTML — the following line can be found amongst our variable declarations near the top:

- -
var guessField = document.querySelector('.guessField');
- -

To get this reference, we used the {{domxref("document.querySelector", "querySelector()")}} method of the {{domxref("document")}} object. querySelector() takes one piece of information — a CSS selector that selects the element you want a reference to.

- -

Because guessField now contains a reference to an {{htmlelement("input")}} element, it will now have access to a number of properties (basically variables stored inside objects, some of which can't have their values changed) and methods (basically functions stored inside objects). One method available to input elements is focus(), so we can now use this line to focus the text input:

- -
guessField.focus();
- -

Variables that don't contain references to form elements won't have focus() available to them. For example, the guesses variable contains a reference to a {{htmlelement("p")}} element, and guessCount contains a number.

- -

Playing with browser objects

- -

Let's play with some browser objects a bit.

- -
    -
  1. First of all, open up your program in a browser.
  2. -
  3. Next, open your browser developer tools, and make sure the JavaScript console tab is open.
  4. -
  5. Type in guessField and the console will show you that the variable contains an {{htmlelement("input")}} element. You'll also notice that the console autocompletes the names of objects that exist inside the execution environment, including your variables!
  6. -
  7. Now type in the following: -
    guessField.value = 'Hello';
    - The value property represents the current value entered into the text field. You'll see that by entering this command, we've changed the text in the text field!
  8. -
  9. Now try typing in guesses and pressing return. The console will show you that the variable contains a {{htmlelement("p")}} element.
  10. -
  11. Now try entering the following line: -
    guesses.value
    - The browser will return undefined, because paragraphs don't have the value property.
  12. -
  13. To change the text inside a paragraph, you need the {{domxref("Node.textContent", "textContent")}} property instead. Try this: -
    guesses.textContent = 'Where is my paragraph?';
    -
  14. -
  15. Now for some fun stuff. Try entering the below lines, one by one: -
    guesses.style.backgroundColor = 'yellow';
    -guesses.style.fontSize = '200%';
    -guesses.style.padding = '10px';
    -guesses.style.boxShadow = '3px 3px 6px black';
    - Every element on a page has a style property, which itself contains an object whose properties contain all the inline CSS styles applied to that element. This allows us to dynamically set new CSS styles on elements using JavaScript.
  16. -
- -

Finished for now...

- -

So that's it for building the example. You got to the end — well done! Try your final code out, or play with our finished version here. If you can't get the example to work, check it against the source code.

- -

{{PreviousMenuNext("Learn/JavaScript/First_steps/What_is_JavaScript", "Learn/JavaScript/First_steps/What_went_wrong", "Learn/JavaScript/First_steps")}}

- -

في هذه الوحدة

- - diff --git a/files/ar/learn/javascript/first_steps/index.html b/files/ar/learn/javascript/first_steps/index.html deleted file mode 100644 index 66c8c8c2f8..0000000000 --- a/files/ar/learn/javascript/first_steps/index.html +++ /dev/null @@ -1,70 +0,0 @@ ---- -title: الخطوات الأولى مع الجافاسكربت -slug: Learn/JavaScript/First_steps -tags: - - Landing - - Module - - NeedsTranslation - - TopicStub - - 'l10n:priority' - - أرقام - - برمجةسكربتات - - جافاسكربت - - دروس - - رياضيات - - عمليات حسابية - - مبتدئ - - متغيرات - - مصفوفات - - مقالة - - نصوص - - واجب -translation_of: Learn/JavaScript/First_steps ---- -
{{LearnSidebar}}
- -

في اول دروس تعلم الجافاسكربت. ينبغي ان نجاوب عن اسئلة أساسية مثل "ماهي الجافاسكربت؟", "ماهي شكلها؟" و "مالذي تستطيع لغة الجافاسكربت عمله؟",  قبل ما نبدأ الأمثلة العملية لكتابة اكواد الجافاسكربت.  بعد ذلك سنناقش الأركان الأساسية بالتفصيل. مثل المتغيرات, النصوص, الأرقام و المصفوفات.

- -

متطلبات مسبقة

- -

قبل ان تبدأ بهذه الدروس. لا تحتاج الى اي معرفة بالجافاسكربت, لكنك تحتاج خبرة بسيطة بكتابة اكواد HTML و CSS. ننصحك بهذه الدروس قبل البدء بتعلم الجافاسكربت:

- - - -
-

ملاحظة:

-اذا كنت لا تستخدم كمبيوتر, لابتوب او اي جهاز لا يسمح لك بإنشاء ملفات جديدة يمكنك تجربة (اغلب) الاكواد بإستخدام احد الخدمات السحابية لكتابة الاكواد مثل JSBin أو Thimble
- -

دروس

- -
-
ما هي الجافاسكربت؟
-
اهلا بك في دورة جافاسكربت للمبتدئين من MDN! في اول درس في هذه الدورة سنلقي نظرة على الجافاسكربت. سنجاوب بعض الاسئلة بشكل بسيط مثل "ماهي جافاسكربت؟", "ماذا تعمل الجافاسكربت؟", لنتأكد بأن تأخذ راحتك مع اللغة.
-
نظرة اولية على الجافاسكربت
-
الآن تعلمت الجافاسكربت من الناحية النظرية, وماذا يمكننا العمل بها. لنلقي نظرة على المميزات الأساسية بالجافاسكربت من الناحية العملية. في هذا الدرس سنبرمج لعبة "توقّع الرقم". خطوة بخطوة.
-
مالذي حصل؟ اصلاح اخطاء الجافاسكربت
-
عندما برمجت لعبة "توقّع الرقم" في الدرس السابق. ربما وجدت انها لا تعمل! لا تخف. في هذا الدرس سنقوم بتعلم كيف تبحث عن الاخطاء في لعبتك وكيفية اصلاحها.
-
تخزين المعلومات التي تحتاجها ــ المتغيرات
-
بعد قراءة الدروس الاخيرة ينبغي ان تعلم الآن ماهي الجافاسكربت و ماذا يمكنها ان تعمل من اجلك وكيف يمكنك استخدامها مع تقنيات الويب الأخرى وما هي مميزاتها الرئيسية بشكل مبسط. في هذا الدرس سنتعلم أحد أهم و أبسط الأشياء، المتغيرات. 
-
الرياضيات بالجافاسكربت ــ الأرقام والعمليات الحسابية
-
عند هذه المرحلة من الدورة ينبغي أن نناقش الرياضيات في الجافاسكربت, كيف يمكننا إجراء العمليات الحسابية باللغة.
-
التعامل مع النصوص ــ النصوص بالجافاسكربت
-
بعد ذلك سنلقي نظرة على النصوص. في هذا الدرس ستتعلم كيف تتعامل مع النصوص. مثل انشاء النصوص. كتابة بعض الرموز. و جمع اكثر من نص مع بعض.
-
دوال للنصوص مفيدة
-
بما اننا تعلمنا اساسيات التعامل مع النصوص. لننتقل الى المرحلة التالية ولنفكر ماذا يمكننا ان نعمل بالنصوص. مثلا لنجد طول نص, دمج النصوص, استبدال احد الاحرف بحرف اخر. وغيرها.
-
المصفوفات
-
في آخر درس في هذه الدورة البسيطة، سنلقي نظرة على المصفوفات. طريقة مثالية لجمع بيانات تحت اسم متغير واحد. سنتعلم لماذا هذا مفيد، كيف انشاءها، الحصول على احد البيانات الموجودة، اضافة المزيد من البيانات، حذف بعض البيانات والمزيد
-
- -

الواجبات

- -

في هذا الواجب ستختبر فهمك للدروس السابقة

- -
-
مصنع القصص الظريفة
-
في هذا الواجب سيطلب منك بإستخدام المعرفة التي اكتسبتها من الدروس السابقة كتابة برنامج يكتب قصة ظريفة عشوائية. استمتع!
-
diff --git a/files/ar/learn/javascript/first_steps/useful_string_methods/index.html b/files/ar/learn/javascript/first_steps/useful_string_methods/index.html deleted file mode 100644 index fac2541302..0000000000 --- a/files/ar/learn/javascript/first_steps/useful_string_methods/index.html +++ /dev/null @@ -1,684 +0,0 @@ ---- -title: بعض الخصائص المفيدة للسلاسل الحرفية -slug: Learn/JavaScript/First_steps/Useful_string_methods -tags: - - استبدال - - تعلم - - تقطيع - - جافا سكربت - - حالة - - حرف صغير - - حرف كبير - - سلسلة حرفية - - مبتديء - - مقال -translation_of: Learn/JavaScript/First_steps/Useful_string_methods ---- -
{{LearnSidebar}}
- -
{{PreviousMenuNext("Learn/JavaScript/First_steps/Strings", "Learn/JavaScript/First_steps/Arrays", "Learn/JavaScript/First_steps")}}
- -

الآن بعدما تعلمنا أساسيات السلاسل، دعنا نبدأ في التفكير وتجربة العمليات التي يمكننا القيام بها على هذه السلاسل، مثل إيجاد طول السلسلة، ربط السلاسل وأيضًا طريقة تقسيمها إلى أجزاء، ومعرفة كيفية استبدال حرف بآخر، وأشياء أخرى.

- - - - - - - - - - - - -
المتطلبات اﻷساسية:أساسيات استخدام الحاسوب ، فهم أساسيات HTML و CSS ، وفهم ماهية الجافاسكربت.
الهدف:فهم أن سلاسل الحروف strings هو عبارة عن كائنات ، وتعلم كيفية استخدام الطرق المتاحة لهذه الكائنات لمعالجة سلاسل الحروف strings .
- -

السلاسل ككائنات

- -

معظم اﻷشياء في الجافا سكريبت هي كائنات. فعند إنشاء سلسلة، على سبيل المثال بإستخدام :

- -
let string = 'This is my string';
- -

يصبح المتغير الخاص بك مثل كائن سلسلة، وبناءًا على ذلك يصبح لديه العديد من الخصائص والأساليب المتاحة له والتي يمكن تنفيذها عليه. يمكنك رؤية ذلك إذا انتقلت إلى صفحة الكائن {{jsxref("String")}} وألقيت نظرة على القائمة الموجودة في هذه الصفحة بالأسفل.

- -

اﻵن وقبل أن يبدأ عقلك في التوهان أو التشتيت، لا تقلق! أنت لست بحاجة لمعرفة هذه اﻷشياء في وقت مبكر من رحلة تعلمك للجافا سكريبت. وهناك عدد قليل من الاحتمالات لإستخدامك هذا كثيرًا والذي سننظر إليه هنا في هذا المقال.

- -

دعنا نجرب بعض اﻷمثلة داخل الكونسول الخاص بالمتصفح.

- -

إيجاد طول السلسلة

- -

هذا سهل للغاية — أنت ببساطة تستخدم هذه الخاصية لإيجاد طول السلسلة {{jsxref("String.prototype.length", "length")}} حاول إتباع الأسطر التالية :

- -
// هنا نقوم بإنشاء متغير يحتوي على سلسلة نصية
-let browserType = 'العربية';
-
-// هنا نقوم بكتابة اسم المتغير متبوعًا بالخاصية لمعرفة طول القيمة الموجودة داخل المتغير
-browserType.length;
- -

النتيجة ستكون 7, ﻷن كلمة "العربية" تحتوي على 7 أحرف. وهذه الخاصية مفيدة لعدة أسباب؛ على سبيل المثال، قد ترغب في العثور على أطول سلسلة نصية من اﻷسماء حتى تتمكن من عرضها بترتيب الطول، أو إخبار المستخدم أن اسم المستخدم الذي قام بإدخاله في حقل النموذج (حقل الإدخال) هو طويل جدًا. (في حالة تجاوز الاسم طول معين.)

- -

استرجاع (استدعاء) حرف سلسلة معين

- -

في ملاحظة ذات صلة،  يمكن إرجاع أي حرف داخل السلسلة باستخدام الاقواس المربعة — هذا يعني إدراج أو تضمين اﻷقواس المربعة ([]) في نهاية اسم المتغيرالخاص بك. وفي داخل اﻷقواس ستقوم بكتابة رقم الحرف الذي تريد إرجاعه،  لذا على سبيل المثال إذا كنت تريد إرجاع الحرف اﻷول فستقوم بإتباع الكود التالي:

- -
browserType[0];
- -

تذكر: الكمبيوتر يبدأ العد من 0 وليس1! ويمكنك استخدام هذا على سبيل المثال للعثور على الحرف اﻷول من السلسلة وترتيبها أبجديًا.

- -

لكي نستدعي الحرف اﻷخير ﻷي سلسلة حروف ، سوف نستخدم السطر التالي , باﻹضافة إلى استخدام خاصية length  التي ذكرناها في اﻷعلى:

- -
browserType[browserType.length-1];
- -

إن طول  "mozilla" هو 7 حروف , ولكن ﻷن العد يبدأ من 0 , فإن موقع الحرف هو 6; باستخدام  length-1 يعطينا الحرف اﻷخير.

- -

إيجاد سلسلة حروف فرعية داخل السلسلة الرئيسية واستخراجها

- -

أحيانًا تريد أن تسدعي بعض الحروف الموجودة داخل السلسلة الكبيرة (نقول بشكل عام إذا كانت سلسلة فرعية موجودة داخل السلسلة اﻷم ). نستطيع فعل هذا بواسطة استخدام طريقة {{jsxref("String.prototype.indexOf()", "indexOf()")}} , والتي تحتوي عامل  {{glossary("parameter")}} — السلسلة الفرعية التي نريد أن نستدعيها.

- -
    -
  1. جرب هذا: -
    browserType.indexOf('zilla');
    - والنتيجة هي 2 , ﻷن سلسلة الحروف الفرعية  "zilla" تبدأ من الموقع 2 (0, 1, 2  — أي 3 حروف) بداخل "mozilla". مثل هذا الكود من الممكن أن يستخدم لفلترة السلاسل الحرفية. على سبيل المثال , لدينا قائمة بالعديد من عنواين الويب ونريد أن نستدعي فقط العنوان الذي يحتوي كلمة "mozilla" .
  2. -
- -
    -
  1. هناك طريقة أخري لذلك , التي من الممكن أن تكون فعالة . جرب المثال التالي: -
    browserType.indexOf('vanilla');
    - يجب أن تكون النتيجة هي -1 — هذا ﻷن سلسلة الحروف التي نبحث عنها في هذه الحالة ,  'vanilla', غير موجودة في السلسلة الرئيسية.
    -
    - يمكن استخدام هذا ﻹيجاد كل حالات السلسلة  حيث ﻻ تحتوي السلسلة الفرعية  'mozilla',( أو فعل ذلك باستخدام عامل النفي ، !==) : - -
    if(browserType.indexOf('mozilla') === -1) {
    -  // do stuff with the string if the 'mozilla'
    -  // substring is NOT contained within it
    -}
    -
    -if(browserType.indexOf('mozilla') !== -1) {
    -  // do stuff with the string if the 'mozilla'
    -  // substring IS contained within it
    -}
    -
  2. -
  3. إذا علمت أين تبدأ السلسلة الفرعية داخل السلسلة الرئيسية , وتعلم الحرف اﻷخير الذي تريده ,فإن {{jsxref("String.prototype.slice()", "slice()")}} تستخدم لاستدعاءه . جرب المثال التالي: -
    browserType.slice(0,3);
    - النتيجة هي "moz" — البرامتر اﻷولparameter يشير إلى موقع الحرف الذي نريد أن نبدأ البحث من عنده , البرامتر الثاني parameterيشير إلى موقع الحرف الذي يوجد بعد آخر حرف تم استدعاءه. لذلك التقطيع slice  يحدث بداية من الحرف اﻷول حتى الحرف اﻷخير لكنه ﻻ يشمل الحرف اﻷخير . في هذا المثال , من البداية 0 ، فإن البرامتر الثاني  يساوي طول السلسلة التي نريد استدعائها.
  4. -
  5. أيضًا ، إذا أردت استدعاء كل الحروف المتبقية بعد حرف معين , فإننا ﻻ نحتاج البرامتر الثاني! بدلًا من ذلك نحتاج فقط موقع الحرف الذي نريد أن نستدعي الحروف المتبقية بعده. جرب المثال التالي: -
    browserType.slice(2);
    - والنتيجة هي "zilla" — وهذا ﻷن الحرف الذي رقمه 2 هو الحرف z ، وﻷننا لم نكتب البرامتر الثاني ، فإن النتيجة هي طباعة كل الحروف بعد هذا الحرف . 
  6. -
- -
-

ملاحظة : البرامتر الثاني  parameter للــ slice() هو اختياري : إذا لم نكتبه ، فإن النتيجة تكون حتى نهاية السلسلة الرئيسية.   أيضًا هناك خيار آخر ، راجع صفحة ;  {{jsxref("String.prototype.slice()", "slice()")}}  للاطلاع على المزيد حول slice.

-
- -

تغيير حالة الحروف

- -

خاصية {{jsxref("String.prototype.toLowerCase()", "toLowerCase()")}} و {{jsxref("String.prototype.toUpperCase()", "toUpperCase()")}} تستخدم لتحويل الحروف لحروف صغيرة أو حروف كبيرة, على التوالي. وهذا مفيد حيث على سبيل المثال إذا أردنا تهيئة البيانات التي أدخلها المستخدم قبل حفظها في قاعدة البيانات . 

- -

دعونا نجرب المثال التالي ونرى ما سيحدث:

- -
let radData = 'My NaMe Is HeSHam';
-radData.toLowerCase();
-radData.toUpperCase();
- -

تحديث أجزاء من السلسلة

- -

نستطيع استبدال سلسلة حروف بأخرى داخل السلسلة الرئيسية باستخدام خاصية  .{{jsxref("String.prototype.replace()", "replace()")}}  إنها خاصية بسيطة جدًا ، ولكنها تملك خيارات متقدمة سوف نستخدمها ولكن ليس اﻵن .

- -

هذه الخاصية لها 2 بارامتر ( الحروف الذي تريد استبدالها, والحروف الجديدة). جرب هذا المثال:

- -
browserType.replace('moz','van');
- -

والنتيجة هي طباعة كلمة "vanilla"  في الكونسول. ولكن إذا تفحصنا قيمة . browserType,فإنها ما تزال "mozilla" . لتحديث قيمة المتغير  browserType حقيقة, سوف نحتاج إلى تحديد قيمة المتغير للقيمة التي نتجت لدينا ؛ حيث أن قيمة المتغير ﻻ تتحدث تلقائيًا . لذلك نحن بحاجة لكتابة هذا الكود: 

- -
browserType = browserType.replace('moz','van');
- -

أمثلة عملية للتعلم

- -

في هذا القسم سوف نتعلم كتابة كود لمعالجة السلاسل الحرفية. في كل مثال باﻷسفل , لدينا مصفوفة من العبارات ، و حلقات تكرارية لتنفيذ القيم في المصفوفة وعرضها في قائمة نقطية. ﻻ تحتاج إلى معرفة المصفوفات والحلقات التكرارية اﻵن ( سوف تُشرح في مقالات مستقبلية). كل ما تحتاجه في كل مثال هو كتابة الكود الذي سوف يعرض العبارات في الهيئة التي نريدها.

- -

كل مثال يحتوي على زر "reset" حيث يمكن إرجاع الكود إلى حالته اﻷصلية في حالة الخطأ أو أن الحل لم يعمل جيدًا ، وهناك زر "Show solution" يمكن الضغط عليه لترى اﻹجابة المحتملة إذا واجهتك مشكلة بالفعل.

- -

معالجة رسائل التهنئة

- -

في أول تمرين سوف نبدأ بشيء بسيط — حيث لدينا مصفوفة من رسائل التهنئة ، ولكننا نريد أن نرتبها في قائمة مثل رسائل العيد. سوف نستخدم الحاﻻت الشرطية   if( ... )  ، لطباعة الجمل في قائمة إذا كانت رسائل تهنئة.

- -
    -
  1. نفكر أوﻻً حول كيفية معرفة رسائل التهنئة في كل عبارة. هل هذه العبارة موجودة في الرسائل ، وما هي الطريقة التي نستخدمها لمعرفة ذلك ؟
  2. -
  3. سوف نحتاج إلى كتابة حالة شرطية .
  4. -
  5. تلميح: في هذا المثال من الفيد اختبار الطريقة لمعرفة النتيجة الصحيحة.
  6. -
- - - -

{{ EmbedLiveSample('Playable_code', '100%', 590, "", "", "hide-codepen-jsfiddle") }}

- -

إصلاح الحروف الكبيرة

- -

في هذا التمرين لدينا أسماء المدن في المملكة المتحدة، ولكن الحروف الكبيرة مكتوبة بشكل عبثي . نريد منك تغييرها للحروف الصغيرة، ماعدا الحرف اﻷول يكون كبير . وأفضل طريق لعمل ذلك هو :

- -
    -
  1. حول كل كلمة في متغير  input  للحروف الصغيرة وخزنها في متغير جديد.
  2. -
  3. اقتنص الحرف اﻷول من كل كلمة في هذا المتغير الجديد وخزنه في متغير آخر.
  4. -
  5. استخدم المتغير اﻷخير لاستبدال الحرف اﻷول من الكلمة بحرف كبير. وخزن نتيجة عملية الاستبدال لمتغير جديد آخر.
  6. -
  7. غيِّر قيمة متغير result لتساوي النتيجة النهائية.
  8. -
- -
-

ملحوظة: البرامتر الخاص بالطريقة المستخدمة ليس فقط الحروف ، بل يمكن أن يكون متغير أيضًا .

-
- - - -

{{ EmbedLiveSample('Playable_code_2', '100%', 550, "", "", "hide-codepen-jsfiddle") }}

- -

عمل عبارة جديدة من العبارة اﻷصلية

- -

في هذا التمرين اﻷخير ، المصفوفة تحتوي على مجموعة من العبارات التي تحتوي معلومات عن محطات القطار في شمال انجلترا. هذه الكلمات تحتوي على ثلاثة حروف لكود المحطة ، متبوعًا بكود القطار، متبوعًا بالفاصلة المنقوطة، متبوعًا اسم المحطة. على سبيل المثال:

- -
MAN675847583748sjt567654;Manchester Piccadilly
- -

نريد استخراج كود المحطة والاسم ، ووضعهم جميعًا في عبارة واحدة بالهيئة التالية:

- -
MAN: Manchester Piccadilly
- -

نقترح أن تتبع هذه الخطوات:

- -
    -
  1. استخرج الثلاثة أحرف لكود المحطة وخزنه في متغير جديد.
  2. -
  3. أوجد رقم موقع حرف الفاصلة المنقوطة ; .
  4. -
  5. استخرج اسم المحطة باستخدام رقم موقع الفاصلة المنقوطة كنقطة مرجعية ، وخزنه في متغير جديد .
  6. -
  7. اربط المتغيرين الجديدين مع العبارة لعمل عبارة جديدة .
  8. -
  9. غيِّر قيمة المتغير result لتساوي العبارة النهائية، وليست العبارة الأصلية input.
  10. -
- - - -

{{ EmbedLiveSample('Playable_code_3', '100%', 585, "", "", "hide-codepen-jsfiddle") }}

- -

اختبر مهاراتك!

- -

لقد وصلنا لنهاية هذا المقال. ولكن هل تستطيع أن تتذكر المعلومات المهمة؟ تستطيع أن تجد بعض الاختبارات لتثبت هذه المعلومات في الذاكرة قبل أن تذهب __   اختبر مهاراتك : السلاسل الحرفية.

- -

الخاتمة

- -

ﻻ نستطيع الهروب من الحقيقة بأنه القدرة على معالجة الكلمات والجُمَل في البرمجة هو في غاية اﻷهمية __ بخاصة في الجافا سكربت، مثل مواقع التواصل مع الناس. هذا المقال يعطيك اﻷساسيات التي تحتاج معرفتها حول معالجة سلاسل الحروف (العبارات). هذا يجب أن يفيدك جيدًا عند قراءة مواضيع معقدة في المستقبل. اﻵن لنذهب للنظر في النوع الرئيسي من البيانات التي نحتاج للتركيز عليها __ المصفوفات arrays  .

- -

تمت بحمد الله.

- -

{{PreviousMenuNext("Learn/JavaScript/First_steps/Strings", "Learn/JavaScript/First_steps/Arrays", "Learn/JavaScript/First_steps")}}

- -

في هذه الوحدة

- - diff --git a/files/ar/learn/javascript/index.html b/files/ar/learn/javascript/index.html deleted file mode 100644 index 6677754e3d..0000000000 --- a/files/ar/learn/javascript/index.html +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: جافاسكريبت Javascript -slug: Learn/JavaScript -tags: - - Beginner - - CodingScripting - - JavaScript - - Landing - - NeedsTranslation - - Topic - - TopicStub - - جافاسكريبت - - ساعد في الترجمة - - مبتدئ -translation_of: Learn/JavaScript ---- -

جافاسكريبت هي لغة برمجة تسمح لك بتوظيف أشياء أكثر تعقيدا في صفحات الويب -- في كل مرة يقوم فيها موقع بأكثر من مجرد عرض معلومات بسيطة ساكنة -- كعرض تغييرات وتحديثات للصفحة , خرائط تفاعلية , رسومات ثنائية او ثلاثية الابعاد متحركة ومتفاعل معها ,  التمرير في خزانات كبيرة من فيديوهات ... الخ. يمكنك بالتأكيد المراهنة على أن اللغة تطورت عما كانت عليه وهي دائما في تقدم مستمر.

- -

مسار التعلم

- -

لغة جافاسكربت تعتبر اكثر تعقيدا نظريا من التكنولوجيات التابعة لها من امثال HTML و CSS . قبل انطلاقك في تعلم جافاسكريبت  , ينصحك اولا بان تصبح متعودا على هاتين التقنيتين اولا , وربما تقنيات اخرى ايضا. ابدا عن طريق المقالات و الدورات التالية :

- - - -

المعرفة و الخبرة بلغات البرمجة السابقة يمكنه كذلك ان يساعدك

- -

بعد أن تصبح اكثر تعودا على مبادئ جافاسكريت . يمكنك ام تنطلق في مواضيع اكثر تعقيدا , مثال ذلك مايلي :

- - - -

الوحدات

- -

هذا الموضوع يحتوي على الوحدات التالية حسب الترتيب المقرح الانطلاق منه :

- -
-
الخطوات الأولى في جافاسكريب
-
في الوحدة الاولى , سنجيب عن بعض الاسئلة الجوهرية مثل ’ماهي جافاسكريبت؟’ , ’كيف تبدو اللغة؟’ و ’ماذا يمكنها ان تفعل’ , قبل الانطلاق الى تجربتك العملية الاولى في كتابة اللغة. بعد ذلك ننقاش مميزات اللغة بالتفصيل كالمتغيرات , السلاسل , الارقام و صفائف وتتظيمات البيانات
-
قواعد بناء و أساسيات لغة جافاسكريبت
-
في هذه الوحدة سنتابع تغطيتنا لكل مبادئ ومفاتيح لغة جافاسكريبت مع ادارة الانتباه الى اكثر طرق البرمجة شيوعا كالجمل الشرطية , الحلقات , الوظائف و الاحداث . لقد رأيت واستعملت هذه الاشياء من قبل في هذا الدرس لكن مررنا بها سريعا , هنا سندرسها بالتفصيل .
-
تقديم الكائنات في جافاسكريبت
-
في لغة الجافاسكريبت معظم معظم العمل سيكون مع الاجسام , انطلاقات من اساسيات اللغة كالحلقات والسلاسل وصولا الى واجهات تطبيقات المتصفح المبنية بواسطة جافاسكريبت. يمكنك كتابة اجسامك لتشمل وتغلف الوظائف والمتغيرات في حزم فعالة. طبيعة جافاسكريبت الجسمية التوجيه مهمة جدا اذا اردت الذهاب بعيدا في تعلم اللغة و كتابة برامج اكثر فعالية , لهذا نوفر لك هذه الوحدة لتساعدك. هنا نعلمك الاجسام وطريقة البناء بالتفصيل , تعلم كيفية كتابة اجسامك  الخاصة , شرح ماهية بيانات JSON وكيفية عملها مع بعض.
-
تطبيقات واجهات الويب من جهة المستخدم
-
عند كتابة جافاسكربت لمواقع الويب او التطبيقات , لن تذهب بعيدا من دون الاحاطة بواجهات التطبيقات API , هذه الواجهات يجب ان تعمل على مختاف المتصفحات و انظمة التشغيل التي بمكن ان تستخدم الموقع , وحتى اذا كنت تجمع بياناتك من جهة اخرى.في هذه الوحدة سنتعرف على ماهية واجهات التطبيقات , وكيفية استعمال اشهرها التي ستمر على اسخدامها عند عملك في التطوير.
-
- -

أنظر ايضا

- -
-
الرياضيات المستعملة في البرمجة
-
سلسلة من الفيديوهات الممتازة لتعليمك الرياضيات التي تحتاجها لكي تصبح مبرمجا فعالا بواسطة   Keith Peters.
-
diff --git a/files/ar/learn/javascript/objects/basics/index.html b/files/ar/learn/javascript/objects/basics/index.html deleted file mode 100644 index 7b6ca3fd15..0000000000 --- a/files/ar/learn/javascript/objects/basics/index.html +++ /dev/null @@ -1,258 +0,0 @@ ---- -title: اساسيات الكائن في جافاسكريبت -slug: Learn/JavaScript/Objects/Basics -translation_of: Learn/JavaScript/Objects/Basics ---- -
{{LearnSidebar}}
- -
{{NextMenu("Learn/JavaScript/Objects/Object-oriented_JS", "Learn/JavaScript/Objects")}}
- -

في المادة الأولى من هذا الدرس سنتطرق إلى كائنات الجافا سكريبت، ثم سنلقي نظرة على التركيبة الأساسية لكائن الجافاسكريبت، ومن ثم إعادة النظر في بعض الميزات التي سبق وأن درسناها في وقت سابق من هذه الدورة التدريبية. علينا التأكيد أن العديد من الميزات التي قمت بالفعل بالتعامل معها هي في الحقيقة كائنات.

- - - - - - - - - - - - -
المتطلبات الأساسية:دراية لا بأس بها بخصوص الحاسوب، الإلمام بمبادئ وأساسيات HTML و CSS، وبطبيعة الحال التمكن من أساسيات الجافاسكريبت (شاهد First steps وأيضا Building blocks).
الهدف :التمكن من فهم لغة البرمجة كائنية التوجه وكيف أن  (" معظم الأشياء كائنات ") في الجافا سكريبت
- وأيضا الشروع في العمل مع كائنات الجافا سكريبت.
- -

أساسيات الكائن

- -
-

أولا وقبل كل شيء، قم بتحميل نسخة من الملف التالي oojs.html. هذا الملف يتضمن العنصر —  {{HTMLElement("script")}} سنستخدمه في كتابة الكود الخاص بنا، وعنصر الإدخال {{HTMLElement("input")}} سنستخدمه لإدخال بعض التعليمات البرمجية،  وبعض المتغيرات والوظائف لاستخراج النتائج من حقل المدخلات ووضعها في العنصر {{HTMLElement("p")}}. سنستخدم هذه  العناصر كأساس، لدراسة أساسيات بناء الكائن.

- -

كما هو الحال مع الكثير من الأشياء في جافا سكريبت، إنشاء كائن غالباً ما يبدأ بتعريف وتهيئة متغير.
- حاول إدخال التعليمة البرمجية أدناه في الملف الخاص بك، ثم قم بحفظ وتحديث:

- -
var person = {};
- -

قم بإدخال person  إلى حقل المدخلات الخاص بك واضغط على الزر button، لتحصل على النتيجة التالية:

- -
[object Object]
- -

تهانينا، لقد أنشأت للتو  أول كائن خاص بك. أنجزت المهمة! لكن هذا كائن فارغ، دعونا نقوم بتحديث هذ الكائن ليصبح على هذا الشكل:

- -
var person = {
-  name : ['Bob', 'Smith'],
-  age : 32,
-  gender : 'male',
-  interests : ['music', 'skiing'],
-  bio : function() {
-    alert(this.name[0] + ' ' + this.name[1] + ' is ' + this.age + ' years old. He likes ' + this.interests[0] + ' and ' + this.interests[1] + '.');
-  },
-  greeting: function() {
-    alert('Hi! I\'m ' + this.name[0] + '.');
-  }
-};
-
- -

بعد الحفظ والتحديث، قم بإدخال التعليمات البرمجية التالية واحدة تلو الاخرى في حقل المدخلات الخاص بك:

- -
person.name[0]
-person.age
-person.interests[1]
-person.bio()
-person.greeting()
-
- -

لقد حصلت الآن على بعض البيانات والوظائف من داخل الكائن الخاص بك، جميل! أصبحت الآن قادرا على الوصول إلى البعض من التركيبة الاساسية للكائن.

- -
-

ملاحظة : إذا واجهتك صعوبة في الحصول على هذا العمل، حاول مقارنة التعليمات البرمجية الخاصة بك مع النسخة لدينا، انظر oojs-finished.html (يمكنك ايضا see it running live). من الأخطاء الشائعة أثناء العمل مع الكائنات هو وضع فاصلة في نهاية آخر العضو — وهذا سوف يسبب خطأ.

-
- -

هذا ما يحدث هنا؟ لدينا كائن يتكون من عدة أعضاء، لكل واحد منهم اسماً (مثل name و age أعلاه)، وقيمة ( مثل ['Bob', 'Smith'] و 32). كل زوج (name: value) يجب أن يفصلا بفاصلة، والاسم والقيمة في كل حالة مفصولة بفاصلة منقوطة. فيما تكون دائماً، تركيبة الكائن الأساسية على هذا النحو :

- -
var objectName = {
-  member1Name : member1Value,
-  member2Name : member2Value,
-  member3Name : member3Value
-}
- -

قيمة العضو  في الكائن يمكن أن تكون أي شيء، في الكائن person لدينا سلسلة نصية، وقيمة رقمية، ومصفوفتان، ووظيفتان. العناصر الأربعة الأولى تسمى عناصر البيانات، ويشار إليها بخصائص الكائن (object properties). والعنصرين الأخيرين هما من الوظائف التي تسمح للكائن أن يفعل شيئا مع تلك البيانات، ويشار إليها بوظائف الكائن (object methods).

- -

يسمى هذا النوع من الكائنات بـ object literal — لقد كتبنا حرفيا محتويات الكائن إلى أن وصلنا إلى إنشائه. هذا على النقيض من الكائنات المبنية على الأصناف (classes)، والتي سوف نتطرق إليها في وقت لاحق.

- -

من الشائع جدا إنشاء كائن باستخدام  object literal لنقل سلسلة من البيانات الهيكلية، البيانات المتصلة بطريقة ما، على سبيل المثال إرسال طلب إلى الخادم (server) لوضعها في قاعدة البيانات. إرسال كائن واحد سيكون أكثر كفاءة بكثير من إرسال عدة عناصر على حدة، وأسهل مقارنة بالعمل مع المصفوفة (Array)، حينما تريد تحديد عناصر فردية حسب الاسم.

- -

رمز النقطة

- -

أعلاه، يمكنك الوصول لخصائص الكائن ووظائفه باستخدام رمز النقطة.
- اسم الكائن (person) بمثابة namespace - يجب أن يتم ادراجه أولا قبل الوصول إلى أي شيء مغلف داخله. تليه النقطة،  ثم يليها العنصر الذي تريد الوصول إليه - وهذا يمكن أن يكون اسم خاصية بسيطة،  او عنصر من المصفوفة أو تنفيذ احدى وظائف الكائن، على سبيل المثال:

- -
person.age
-person.interests[1]
-person.bio()
- -

Sub-namespaces

- -

من الممكن تغيير شكل التعليمة البرمجية، من مصفوفة الى Sub-namespaces. على سبيل المثال، حاول تغيير اسم العضو من :

- -
name : ['Bob', 'Smith'],
- -

الى

- -
name : {
-  first : 'Bob',
-  last : 'Smith'
-},
- -

على نحو فعال قمنا بانشاء Sub-namespaces. هذا يبدو معقدا، في الحقيقة هو ليس كذالك - للوصول إلى هذه العناصر كل ما تحتاج اليه هو  ربط سلسلة العناصر بنقطة الترميز. جرب هذا :

- -
person.name.first
-person.name.last
- -

هام : في هذه الحالة ستحتاج أيضا للذهاب الى الكود الخاص بك واستبدال الحالات التالية من :

- -
name[0]
-name[1]
- -

الى

- -
name.first
-name.last
- -

وإلا، فسوف لن تعمل الوظائف الخاصة بك.

- -

رمز الاقواس

- -

هناك طريقة أخرى للوصول إلى خصائص الكائن – باستخدام رمز الاقواس. بدلاً من استخدام هذه :

- -
person.age
-person.name.first
- -

يمكنك استخدام هذه

- -
person['age']
-person['name']['first']
- -

تبدو هذه الطريقة مشابهة جدا لكيفية الوصول إلى العناصر في المصفوفة، فعلا هي كذالك - بدلا من استخدام رقم الفهرس للوصول الى العنصر المطلوب،  نستخدم اسم  القيمة للوصول اليه. ليس مستغربا أن تسمى هذه الكائنات أحيانا بالمصفوفات الترابطية associative arrays - هذه السلاسل النصية  تشير الى قيمها. نفس الشئ بالنسبة للمصفوفات حيث تشير الفهرسة الرقمية لقيمها.

- -

إعداد اعضاء الكائن

- -

حتى الآن قمنا فقط بارجاع/ جلب اعضاء الكائن - يمكننا أيضا تعيين/تحديث  اعضاء الكائن ببساطة عن طريق الإعلان عن العضو الذي نريد تحديثه سواء باستخدام النقطة أو برمز الاقواس، كالتالي :

- -
person.age = 45
-person['name']['last'] = 'Cratchit'
- -

في حقل المدخلات الخاص بك جرب ادخال التعليمات البرمجية التالية واحدة تلوى الاخرى للحصول على الاعضاء مرة أخرى بعد التحديث :

- -
person.age
-person['name']['last']
- -

إعداد ألاعضاء لا يقتصر فقط على تحديث قيم الخصائص والوظائف القائمة، يمكنك أيضا إنشاء أعضاء جدد تماما. جرب هذا:

- -
person['eyes'] = 'hazel'
-person.farewell = function() { alert("Bye everybody!") }
- -

يمكنك الآن اختبار ألاعضاء الجدد خاصتك :

- -
person['eyes']
-person.farewell()
- -

احد اهم الجوانب المفيدة في استخدام رموز الاقواس هو امكانية استخدامها ليس فقط لتحديد قيم الاعضاء، ولكن أسماء الأعضاء أيضا. دعونا نقول أننا نريد أن يتمكن المستخدم من تخزين قيمة مخصصة لبيانات الاشخاص، عن طريق كتابة اسم العضو وقيمته في اثنين من المدخلات النصية؟ يمكن أن نحصل على تلك القيم كالتالي :

- -
var myDataName = nameInput.value
-var myDataValue = nameValue.value
-
- -

يمكننا بعد ذلك إضافة اسم العضو الجديد وقيمته إلى الكائن person  كالتالي :

- -
person[myDataName] = myDataValue
- -

لاختبار هذا، قم بإضافة الأسطر التالية أسفل التعليمات البرمجية خاصتك،  بعد قوس الاغلاق للكائن person :

- -
var myDataName = 'height'
-var myDataValue = '1.75m'
-person[myDataName] = myDataValue
- -

الآن قم بحفظ وتحديث، وادخل ما يلي في حقل المدخلات الخاص بك :

- -
person.height
- -

وهذا لم يكن ممكناً مع طريقة نقطة الترميز، لانها تقبل اسم العضو كقيمة حرفية فقط، والتالي لا يمكن لهذه القيمة الحرفية ان تشير إلى اسم المتغير.

- -

ما هي this؟       

- -

لربما لاحظت شيئا غريبا بعض الشيء في الوظائف الخاصة بنا؟. القي نظرة على هذه  على سبيل المثال:

- -
greeting: function() {
-  alert('Hi! I\'m ' + this.name.first + '.');
-}
- -


- ربما تسألت ما هي this. هي كلمة من الكلمات المحجوزة للغة جافاسكريبت.
-  تشير إلى الكائن الحالي الذي تم كتابة التعليمات البرمجية داخله — في هذه الحالة هي تعادل person. فلماذا لا نستخدم person بدلا من ذلك؟
- كما سترى في  جافاسكريبت - البرمجة غرضية التوجه للمبتدئين عندما نبدأ بانشاء constructors، ... الخ، this مفيدة جداً — لانها ستضمن دائما أن تستخدم القيم الصحيحة عندما يتغير سياق العضو.
- ( على سبيل المثال عند وجود حالتين مختلفتين للكائن person بأسماء مختلفة، سوف ترغب في التعامل مع ال name الموجودة في كل منهما عن طريق الوظيفة ()greeting ).

- -

ولتوضيح ما نعنيه مع زوج من الكائنات person1  و person2 :

- -
var person1 = {
-  name : 'Chris',
-  greeting: function() {
-    alert('Hi! I\'m ' + this.name + '.');
-  }
-}
-
-var person2 = {
-  name : 'Brian',
-  greeting: function() {
-    alert('Hi! I\'m ' + this.name + '.');
-  }
-}
- -

في هذه الحالة، الوظيفة ()greeting  الخاصة بالكائن person1، ستظهر ".Hi! I'm Chris".
-  فيما الوظيفة ()greeting الخاصة بالكائن person2، ستقوم باظهار ".Hi! I'm Brian".
- على الرغم من ان التعليمات البرمجية للوظيفة greeting هي نفسها في كلا الحالتين. وكما قلنا في وقت سابق، this تساوي الكائن داخل التعليمات البرمجية — هي ليست مفيدة بشكل كبير خصوصا عند الكتابة خارج ال object literals، لكنها مفيدة جدا عندما تريد توليد كائن حيوي (على سبيل المثال باستخدام ال constructors).  سوف تتضح لك الامور في وقت لاحق.

- -

استخدمنا الكائنات طوال المرحلة

- -

من خلال الأمثلة السابقة، لربما فكرت بأن نقطة الترميز التي استخدمناها مؤلوفة جدا. هذا لأننا استخدمناها تقريبا في جميع المراحل السابقة، في كل مرة كنا نعمل من خلال مثال يستخدم اما built-in browser API او JavaScript object، استخدمنا الكائنات، نظراً لأن هذه الميزات تم بناؤها باستخدام نفس النوع من ال object structures مثل ما راينا هنا،
- وإن كانت أكثر تعقيدا من الأمثلة الخاصة بنا.

- -

عند استخدامك لوظائف السلاسل النصية string methods، كهذه :

- -
myString.split(',');
- -

فقد استخدمت وظيفة متاحة في مثيل الفئة  String. في كل مرة تقوم فيها بإنشاء سلسلة نصية في التعليمات البرمجية الخاصة بك، بشكل اوتوماتيكي يتم انشاء هذه السلسلة النصية ك instance  (مثيل) من String، وبالتالي سيصبح متاح لها العديد من ال methods/properties الخاصة بال String.

- -


- عندما تصل  الى document object model باستخدام سطور كهذه :

- -
var myDiv = document.createElement('div');
-var myVideo = document.querySelector('video');
- -

فقد استخدمت وظيفة متاحة في مثيل الفئة Document.  في كل مرة تحمل فيها صفحة الويب، يتم إنشاء instance (مثيل) من الوثيقة، تسمى document، والتي تمثل بنية الصفحة كاملة، والمحتوى، وغيرها من الميزات مثل عنوان URL الخاص بها. وهذا يعني أن لديها العديد من ال methods/properties المتاحة لها.

- -

وينطبق الأمر نفسه على اي من (كائنات برمجة واجهة التطبيقات المدمجة built-in object/API)  الاخرى قد تمت باستخدام  —  Array, Math, etc.

- -

لاحظ ان الكائنات المدمجة Objects/APIs لا تقوم دائما بانشاء object instances (مثيلات الكائن) اوتوماتيكيا. وكمثال على ذلك، Notifications API — التي تسمح للمتصفحات الحديثة باطلاق system notifications - يتطلب منك إنشاء مثيل object instance جديد باستخدام ال constructor لكل اشعار تريد اطلاقه.

- -

قم بادخال التعليمة التالية في console الجافاسكريبت الخاص بك :

- -
var myNotification = new Notification('Hello!');
- -

سوف نبحث في ال constructor في مقال لاحق.

- -
-

ملاحظة: من المفيد أن نفكر في طريقة تواصل الكائنات على شكل رسائل ممررة. — عندما يكون الكائن بحاجة لأداء بعض العمل في كثير من الأحيان سوف يرسل رسالة إلى كائن آخر عن طريق احدى وظائفه،
- وينتظر الرد، والذي يعرف بالقيمة المرجعة.

-
- -

ملخص

- -

تهانينا، لقد وصلت إلى نهاية الجزء الخاص  بكائنات الجافاسكريبت الأولىية  — وينبغي الآن ان تكون لديك فكرة جيدة عن كيفية العمل مع الكائنات في الجافا سكريبت بما في ذلك إنشاء الكائنات البسيطة الخاصة بك. وينبغي أن تدرك أيضا أن الكائنات مفيدة جداً كهياكل لتخزين البيانات والوظائف الخاصة بها. — إذا حاولت جعل كافة الخصائص والوظائف في الكائن person  كمتغيرات ووظائف مستقلة، سيكون امر غير فعال ومخيب للامال، بحيث يمكن أن تتعرض لمخاطر اشتباك المتغيرات والوظائف التي لها نفس الأسماء.
- الكائنات تسمح لنا بالاحتفاظ بالمعلومات مؤمنة بأمان في حزمة خاصة بها، وتحفظها من الاذى.

- -

في المقال القادم سنبدأ بالنظر في البرمجة كائنية التوجه (OOP) ، وكيف يمكن استخدام هذه التقنية في جافا سكريبت.

- -

{{NextMenu("Learn/JavaScript/Objects/Object-oriented_JS", "Learn/JavaScript/Objects")}}

-
diff --git a/files/ar/learn/javascript/objects/index.html b/files/ar/learn/javascript/objects/index.html deleted file mode 100644 index 9eb705138c..0000000000 --- a/files/ar/learn/javascript/objects/index.html +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: تقديم JavaScript objects -slug: Learn/JavaScript/Objects -tags: - - Article - - Assessment - - Beginner - - CodingScripting - - Guide - - JavaScript - - Learn - - NeedsTranslation - - Objects - - TopicStub - - Tutorial -translation_of: Learn/JavaScript/Objects ---- -
{{LearnSidebar}}
- -

في JavaScript ، معظم الأشياء هي كائنات ، من ميزات JavaScript الأساسية مثل السلاسل والمصفوفات إلى واجهات برمجة التطبيقات للمتصفح المبنية أعلى جافا سكريبت. يمكنك حتى إنشاء الكائنات الخاصة بك لتغليف الوظائف والمتغيرات ذات الصلة إلى حزم فعالة ، وتكون بمثابة حاويات بيانات مفيدة. إن طبيعة جافا سكريبت الموجهة للكائنات مهمة لفهم ما إذا كنت ترغب في مواصلة معرفتك باللغة ، لذلك قمنا بتوفير هذه الوحدة لمساعدتك. هنا نقوم بتدريس نظرية وجوه وبناء الجملة بالتفصيل ، ثم ننظر في كيفية إنشاء الأشياء الخاصة بك.

- -

المتطلبات الأساسية
- قبل البدء في هذه الوحدة ، يجب أن يكون لديك بعض الإلمام بـ HTML و CSS. يُنصح بالعمل من خلال مقدمة HTML ومقدمة إلى وحدات CSS قبل البدء في JavaScript.

- -

يجب أيضًا أن يكون لديك بعض الإلمام بأساسيات JavaScript قبل النظر إلى كائنات JavaScript بالتفصيل. قبل محاولة هذه الوحدة ، اعمل من خلال الخطوات الأولى لجافا سكريبت وكتل JavaScript

- -

 

- -
ملاحظة: إذا كنت تعمل على جهاز كمبيوتر / جهاز لوحي / جهاز آخر لا تملك فيه القدرة على إنشاء ملفاتك الخاصة ، يمكنك تجربة (معظم) أمثلة التعليمات البرمجية في برنامج ترميز عبر الإنترنت مثل JSBin أو Thimble
- -

 

- -
 
- -
-

خطوط إرشاد
- أساسيات الكائن
- في المقالة الأولى التي تبحث في كائنات JavaScript ، سننظر في بنية كائن جافا سكريبت الأساسية ، ونعاود زيارة بعض ميزات جافا سكريبت التي رأيناها سابقًا في الدورة التدريبية ، مع التأكيد على حقيقة أن العديد من الميزات التي تعاملت معها بالفعل هي في الواقع الأشياء.
- جافا سكريبت وجوه المنحى للمبتدئين
- مع وضع الأساسيات ، سنركز الآن على JavaScript (Object-oriented JavaScript) (OOJS) - تقدم هذه المقالة عرضًا أساسيًا لنظرية البرمجة الشيئية (OOP) ، ثم تستكشف كيفية محاكاة جافا سكريبت لفئات الكائن عن طريق وظائف منشئ ، كيفية إنشاء مثيلات الكائن.
- نماذج الكائن
- النماذج الأولية هي الآلية التي ترث بها كائنات JavaScript عناصر من بعضها البعض ، وتعمل بشكل مختلف مع آليات الوراثة في لغات البرمجة الكلاسيكية الموجهة للكائنات. في هذه المقالة ، نستكشف هذا الاختلاف ، ونشرح كيفية عمل سلاسل النموذج الأولي ، وننظر في كيفية استخدام خاصية النموذج الأولي لإضافة أساليب إلى المنشئات الموجودة.
- وراثة في جافا سكريبت
- مع شرح معظم تفاصيل دموية OOJS الآن ، يوضح هذا المقال كيفية إنشاء فئات الكائن "التابعة" (المنشئات) التي ترث ميزات من الفئات "الأصل" الخاصة بهم. بالإضافة إلى ذلك ، نقدم بعض النصائح حول متى وأين قد تستخدم OOJS.
- التعامل مع بيانات JSON
- يعد ترميز كائن جافا سكريبت (JSON) تنسيقًا قياسيًا لتمثيل البيانات المنظمة مثل كائنات جافا سكريبت ، والتي تستخدم عادة لتمثيل ونقل البيانات على مواقع الويب (أي إرسال بعض البيانات من الخادم إلى العميل ، بحيث يمكن عرضها على الويب الصفحة). ستصادفه كثيرًا ، لذا في هذه المقالة نقدم لك كل ما تحتاجه للعمل مع JSON باستخدام JavaScript ، بما في ذلك الوصول إلى عناصر البيانات في كائن JSON وكتابة JSON الخاص بك.
- ممارسة بناء الكائن
- في المقالات السابقة ، نظرنا في جميع تفاصيل بنية وجوه جافا سكريبت الأساسية وتفاصيل التركيب ، مما يمنحك قاعدة صلبة للبدء منها. في هذا المقال ، نتعمق في تمرين عملي ، مما يمنحك المزيد من التدريب على بناء كائنات جافا سكريبت مخصصة ، والتي تنتج شيئًا ممتعًا وملونًا - بعض الكرات المرتدة الملونة.

-
- -

تقييم
- إضافة ميزات إلى الكرات المرتدة التجريبية
- في هذا التقييم ، يتوقع منك استخدام الكرات المرتدة التجريبية من المقالة السابقة كنقطة بداية ، وإضافة بعض الميزات الجديدة والممتعة إليها.

diff --git a/files/ar/learn/javascript/objects/inheritance/index.html b/files/ar/learn/javascript/objects/inheritance/index.html deleted file mode 100644 index 7dc1333c96..0000000000 --- a/files/ar/learn/javascript/objects/inheritance/index.html +++ /dev/null @@ -1,228 +0,0 @@ ---- -title: الوراثة في جافاسكريبت -slug: Learn/JavaScript/Objects/Inheritance -translation_of: Learn/JavaScript/Objects/Inheritance ---- -
{{LearnSidebar}}
- -
{{PreviousMenuNext("Learn/JavaScript/Objects/Object_prototypes", "Learn/JavaScript/Objects/JSON", "Learn/JavaScript/Objects")}}
- -

مع معظم التفاصيل المثيرة في OOJS التي درسناها حتى الآن،سنتطرق في هذا الدرس لكيفية إنشاء طفل  (child" object classes (constructors" الذي يرث الميزات من أبيه parent" classes". بالإضافة إلى ذلك، سنقدم بعض النصائح، حول متى وأين يجب عليك استخدام ال OOJS.

- - - - - - - - - - - - -
المتطلبات الأساسية :دراية لا بأس بها بخصوص الحاسوب، الإلمام بمبادئ وأساسيات الـ HTML وCSS وجافاسكريبت (راجع First steps and Building blocks) وأساسيات بناء الكائنات في الجافاسكريبت OOJS (راجع Introduction to objects).
الهدف :فهم كيفية تنفيذ الوراثة في جافا سكريبت.
- -

الوراثة النمودجية - Prototypal inheritance

- -
-

لقد راينا حتى الآن بعض عمليات الوراثة — وراينا كيف تعمل الـ prototype chains، وكيف يتم توارث الاعضاء صعودا في السلسلة، ولكن معظمها اقتصر على الدوال المدمجة في المتصفح (built-in browser functions). الان، سنرى كيف يمكننا إنشاء كائن يرث من كائن آخر في جافا سكريبت؟

- -

كما ذكرنا في وقت سابق من هذه الدورة التدريبية، بعض الاشخاص يعتقدون أن جافاسكريبت ليست لغة كائنية حقيقية. في لغات "OO الكلاسيكية"، حيث يجب تعريف class objects من نوع ما، بعد ذلك يمكنك ببساطة تعريف الكلاس الذي سترث منه الكلاسات الأخرى (شاهد بعض الامثلة البسيطة بخصوص الوراثة في لغة  C++ inheritance). الجافا سكريبت تستخدم نظام مختلف — نظام الربط بين الكائنات — في الجافسكريبت لا يتم نسخ الوظائف الموروثة على الكائنات التي تقوم  بالوراثة، بدلا من ذالك يتم عمل رابط بينها — الوظائف التي ترث مرتبطة عن طريق ال prototype chain (غالباً ما يشار لها بال prototypal inheritance).

- -

دعونا نستكشف كيفية القيام بذلك مع مثال ملموس.

- -

الشروع في العمل

- -

اولا وقبل كل شئ، قم بعمل نسخة من الملف الخاص بنا oojs-class-inheritance-start.html (او شاهد running live). ستجد داخله نفس مثال Person() constructor الذي استخدمناه طوال هذه الدورة التدريبية مع اختلاف طفيف — لقد قمنا بتعريف الخصائص فقط، داخل ال constructor:

- -
function Person(first, last, age, gender, interests) {
-  this.name = {
-    first,
-    last
-  };
-  this.age = age;
-  this.gender = gender;
-  this.interests = interests;
-};
- -

وكافة ال method معرفة كـ constructor's prototype  ، على سبيل المثال:

- -
Person.prototype.greeting = function() {
-  alert('Hi! I\'m ' + this.name.first + '.');
-};
- -
-

ملحوظة :  في شفرة المصدر سترى ايضا الوظائف ()bio و ()farewell  معرفة . في وقت لاحق سترى كيف يمكن أن تكون موروثة من قبل منشئات-constructors آخرى.

-
- -

سنقوم بإنشاء Teacher class، مثل الذي قمنا بتوصيفه في تعريف object-oriented definition الخاصة بنا —والذي سيرث كافة الأعضاء من ال Person،  ولكن سيشتمل أيضا على:

- -
    -
  1. خاصية جديدة، subject  — والتي ستحتوي على المادة التي يدرسها المدرس.
  2. -
  3. وعلى الوظيفة greeting() محدثة، والتي تبدو أكثر رسمية من الوظيفة greeting() القياسية —
    - وهي اكثر ملائمة مع المدرس الذي يقوم بتدريس بعض الطلاب في المدرسة.
  4. -
- -

تعريف ال Teacher() constructor function

- -

أول شيء يتعين علينا القيام به هو إنشاء Teacher() constructor —  اضف ما يلي أدناه في التعليمات البرمجية خاصتك:

- -
function Teacher(first, last, age, gender, interests, subject) {
-  Person.call(this, first, last, age, gender, interests);
-
-  this.subject = subject;
-}
- -

تبدو هذه مشابهة لل Person constructor  في نواح كثيرة، ولكن هناك شيء غريب والذي لم نره من قبل — الدالة ()call . هذه الدالة تسمح لك باستدعاء دالة اخرى معرفة في مكان آخر، ولكن في السياق الحالي، البراميتر الاول لتحديد قيمة this، اي هذا الذي نريد استخدامه عند تشغيل الدالة، والبرامترات الاخرى لتحديد البرامترات التي يجب ان تمرر للدالة عند تشغيلها.

- -
-

ملاحظة: في هذه الحالة سنقوم بتحديد الخصائص الموروثة عندما سنقوم بانشاء object instance، لكن لاحظ أنك ستحتاج إلى تحديدها كباراميترات في ال constructor حتى لو كان ال instance لا يتطلب ان تكون محددة كبارامترات.

-
- -

في هذه الحالة، وعلى نحو فعال قمنا بتشغيل ال Person() constructor function داخل ال Teacher() constructor function (انظر اعلاه). ما نتج عنه نفس الخصائص المعرفة داخل ()Teacher ولكن باستخدام قيم البرامترات التي تم تمريرها إلى ()Teacher وليس الى ()Person (ببساطة قمنا بتمرير this الى ()call وهذا يعني أن this داخل ()cal ستشير الى Teacher() function).

- -

السطر الأخير داخل ال constructor يعرف الخاصية subject الجديدة وهي خاصة ب ()Teacher فقط.

- -

كملاحظة، بإمكاننا ببساطة القيام بذلك على هذا النحو :

- -
function Teacher(first, last, age, gender, interests, subject) {
-  this.name = {
-    first,
-    last
-  };
-  this.age = age;
-  this.gender = gender;
-  this.interests = interests;
-  this.subject = subject;
-}
- -

ولكن هذا مجرد إعادة تحديد الخصائص من جديد، و ()Teacher لا يرثها من ال ()Person، لذا لا فائدة لما نحاول القيام به. لانه سيأخذ المزيد من السطور في التعليمات البرمجية لا اكثر.

- -

إعداد Teacher() prototype ومرجع ال constructor

- -

كل شيء جيد حتى الآن، ولكن لدينا مشكلة. قمنا بتعيين constructor جديد، وبشكل افتراضي يحتوي على الخاصية prototype فارغة. ونحن بحاجة لجعل ()Teacher يرث الوظائف المعرفة في ال Person() prototype. فكيف نفعل ذلك؟

- -

أضف السطر التالي اسفل التعليمة البرمجية الخاصة بك:

- -
Teacher.prototype = Object.create(Person.prototype);
- -

وهنا يأتي دور الوظيفة ()create للإنقاذ مرة أخرى — في هذه الحالة استخدمناها لإنشاء قيمة جديدة للخاصية prototype (وهي في حد ذاتها كائن يحتوي على خصائص ووظائف) مع prototype يساوي Person.prototype، وتعيينها كقيمة ل Teacher.prototype، وهذا يعني أن Teacher.prototype الآن سوف يرث كل الوظائف الموجودة في ال Person.prototype.

- -

نحن بحاجة إلى فعل شيئا آخر قبل أن نكمل — constructor الخاصية prototype ل ()Teacher
- هو الان على شكل ()Person، بسبب الطريقة التي ورثناها منه (لمزيد من المعلومات حول هذا Stack Overflow post) — حاول حفظ التعليمات البرمجية الخاصة بك، واعد تحميل الصفحة من المتصفح، وادخل هذا في console الجافاسكريبت للتحقق:

- -
Teacher.prototype.constructor
- -

وهذا يمكن أن يسبب مشكلة، لذلك نحن بحاجة لتصحيح هذا الوضع، يمكنك القيام بذلك بالرجوع إلى التعليمات البرمجية الخاصة بك وإضافة السطر التالي في الجزء السفلي:

- -
Teacher.prototype.constructor = Teacher;
- -

الآن إذا قمت بحفظ وتحديث، وإدخال Teacher.prototype.constructor سيتم إرجاع ()Teacher، كما هو مطلوب.

- -

منح ()Teacher الوظيفة ()greeting الجديدة

- -

لانهاء الكود الخاص بنا، سنحتاج إلى تعريف الوظيفة الجديدة ()greeting في Teacher() constructor.

- -

أسهل طريقة للقيام بذلك، هو تعريفها على Teacher() prototype — اضف ما يلي في الجزء السفلي من التعليمات البرمجية الخاصة بك:

- -
Teacher.prototype.greeting = function() {
-  var prefix;
-
-  if(this.gender === 'male' || this.gender === 'Male' || this.gender === 'm' || this.gender === 'M') {
-    prefix = 'Mr.';
-  } else if(this.gender === 'female' || this.gender === 'Female' || this.gender === 'f' || this.gender === 'F') {
-    prefix = 'Mrs.';
-  } else {
-    prefix = 'Mx.';
-  }
-
-  alert('Hello. My name is ' + prefix + ' ' + this.name.last + ', and I teach ' + this.subject + '.');
-};
- -

تحية المدرس هذه (alert)، يستخدم فيها أيضا الاسم prefix المناسب لجنسهم، بناءا على عبارة شرطية.

- -

تجربة المثال

- -

لقد ادخلت الآن كافة التعليمات البرمجية، حاول انشاء object instance من ()Teacher، عن طريق وضع ما يلي في الجزء السفلي لجافا سكريبت الخاصة بك :

- -
var teacher1 = new Teacher('Dave', 'Griffiths', 31, 'male', ['football', 'cookery'], 'mathematics');
- -

الآن حفظ وتحديث، وحاول الوصول إلى خصائص ووظائف الكائن teacher1 الجديد الخاص بك، على سبيل المثال:

- -
teacher1.name.first;
-teacher1.interests[0];
-teacher1.bio();
-teacher1.subject;
-teacher1.greeting();
- -

ستعمل جميعها بشكل جيد، الثلاثة الأولى ستصل إلى الأعضاء التي تم وراثتها من Person() constructor (class العام فيما الاثنان المتبقيان سيصلان إلى الأعضاء الموجودة في  (Teacher() constructor (class.

- -
-

ملاحظة : إذا واجهتك مشكلة في الحصول على هذا العمل، قارن التعليمات البرمجية الخاصة بك مع خاصتنا  finished version (شاهد running live ).

-
- -

التقنية التي قمنا بتغطيتها هنا ليست الطريقة الوحيدة لإنشاء كلاسات موروثة في جافا سكريبت، ولكنها تعمل بشكل جيد، وتعطيك فكرة جيدة عن كيفية تنفيذ الوراثة في جافا سكريبت.

- -

قد يهمك ايضا الاطلاع على بعض المستجدات {{glossary("ECMAScript")}} بخصوص المميزات الجديدة التي تسمح لنا بالقيام بوراثة أكثر نظافة في جافا سكريبت (شاهد Classes). ونحن لم نقم بتغطيتها هنا، كما لم يتم حتى الآن اعتمادها على نطاق واسع جداً عبر المتصفحات. كل التعليمات البرمجية الأخرى التي ناقشناها في هذه المجموعة من المقالات مدعومة بقدر ما، باستثناء IE9 وإلاصدارات السابقة،  هناك طرق لتحقيق الدعم لما سبق.

- -

الطريقة الشائعة هي استخدام مكتبة جافا سكريبت — معظم الخيارات الشائعة تحتوي على مجموعة سهلة من الوظائف المتاحة لتنفيذ الوراثة بسهولة وسرعة. CoffeeScript على سبيل المثال، توفر class ،extends،... الخ.

- -

اختبر قدراتك

- -

في القسم النظري الخاص بال OOP theory section، أدرجنا أيضا Student class كمفهوم، والذي يرث كافة ميزات ال Person، ويحتوي على الوظيفة ()greeting بتحية مختلفة للشخص، وتحيته أكثر رسمية بكثير من تحية المدرس. الق نظرة على ما يشبه تحية الطالب في هذا القسم، وحاول تنفيذ Student() constructor خاص بك، على أن يرث كل ميزات ال ()Person، وقم بتنفيذ وظيفة ()greeting مختلفة.

- -
-

ملاحظة : إذا واجهتك مشكلة في الحصول على هذا العمل، قارن التعليمات البرمجية الخاصة بك مع خاصتنا finished version (شاهد ايضا running live).

-
- -

Object member summary

- -

تلخيص، لديك ثلاثة أنواع من property/method لتهتم بشانهم.

- -
    -
  1. تلك المعرفة داخل ال constructor function والتي تمرر لل object instances. هذه سهلة إلى حد ما، في التعليمات البرمجية الخاصة بك، هناك أعضاء معرفة داخل ال constructor تستخدم نوع السطر this.x = x في built in browser code وهي متاحة فقط للأعضاء في object instances (عادة ما يتم إنشاؤها من خلال استدعاء ال constructor باستخدام الكلمة المحجوزة  new مثل var myInstance = new  myConstructor())
  2. -
  3. تلك التي تم تحديدها مباشرة على constructor نفسها، وهي متاحة فقط في ال constructor.
    - وهذه عادة متوفرة فقط في ال built-in browser objects,
    -  المعترف بها حاليا بالسلاسل مباشرة على ال constructor،
    - لا على ال instance. على سبيل المثال Object.keys().
  4. -
  5. -

    تلك المحددة في constructor ال prototype، والموروثة من جميع ال instances
    - ووراثة فئات الكائن. وتشمل اي عضو معرف على الخاصية Constructor's prototype property
    - (مثلا ()myConstructor.prototype.x).

    -
  6. -
- -

إذا لم تتمكن من استعاب هذا، فلا تقلق فانت حتى الآن لا تزال تتعلم، وسوف تستوعبها اكثر مع الممارسة.

- -

متى تستخدم الوراثة في جافا سكريبت؟

- -

على الارجح بعد هذه المادة الأخيرة، ستقول "يا الهي، هذا معقد"، حسنا، انت على حق، ال prototypes والوراثة تمثل بعض اهم الجوانب الأكثر تعقيداً في جافا سكريبت، لكن قوة ومرونة  الجافا سكريبت تاتي من تركيبة الكائن والوراثة ومن المفيد فهم كيف تعمل.

- -

بطريقة ما، فانت تستخدم الوراثة طوال الوقت، كلما استخدمت الميزات المختلفة ل  Web API (واجهة برمجة تطبيقات الويب) او الخصائص والوظائف المعرفة في كائنات المتصفح المدمجة (built-in browser) التي تقوم باستدعائها على السلاسل النصية الخاصة بك، او على المصفوفات...الخ، بشكل فعلي، فانت تستخدم الوراثة.

- -

بالنسبة لاستخدام الوراثة في التعليمات البرمجية الخاصة بك، ربما لن تحتاج لاستخدامها في كثير من الأحيان، لا سيما وانت مبتدئ فيها، او لديك مشاريع صغيرة. استخدام الكائنات والوراثة في هذه الحالة،  سيكون مضيعة للوقت، وانت لست في حاجة إليها. ولكن كان تكون التعليمات البرمجية الخاصة بك اكبر وقابلة للتمدد، فأنت على الأرجح ستحتاجها بشكل كبير، إذا بدأت في إنشاء عدد من الكائنات، ووجدت ان لها خصائص مماثلة، عندها، قم بإنشاء نوع الكائن عام يحتوي على كافة الوظائف المشتركة ووراثة تلك المشتركة في نوع الكائنات الاكثر تخصصا، ما سيجعل هذ العمل مفيد ومريح.

- -
-

ملاحظة: بسبب طريقة عمل الجافاسكريبت مع ال prototype chain ...الخ، غالباً ما تسمى مشاركة الوظائف بين الكائنات ب delegation (التفويض)، الكائنات المتخصصة تفوض هذه الوظائف إلى نوع الكائن العام. وربما هذا هو الوصف الاكثر دقة لوصف الوراثة، كما  لا يتم نسخ الوظائف "الموروثة" على الكائنات التي تقوم  "بالوراثة". بدلا من ذلك يتم عمل رابط بينها، لذا  فالوظائف الموروثة لاتزال في الكائن العام.

-
- -

عند استخدام الوراثة، ينصح ان لا يكون لديك عدة مستويات من الوراثة، وتقوم بتتبع دقيق حيث يمكنك تحديد الخصائص والوظائف الخاصة بك. من الممكن البدء بكتابة التعليمات البرمجية والقيام بتعديل prototypes الكائنات المدمجة في المتصفح مؤقتاً، ولكن يجب أن لا تفعل ذلك إلا إذا كان لديك سبب وجيه حقا. والكثير من الوراثة يمكن أن يؤدي إلى ارتباكات لا نهاية لها، وآلام لا نهاية لها عند محاولة تصحيح هذه التعليمات البرمجية.

- -

في نهاية المطاف، الكائنات ليست سوى شكل آخر من أشكال إعادة استخدام التعليمات البرمجية، مثل الدوال والحلقات...الخ، مع أدوار محددة ومزايا خاصة بها. إذا كنت تقوم بإنشاء مجموعة من المتغيرات والمهام ذات الصلة،  وتريد أن تجعلها جميعا معا محزمة بدقة وبعيدة عن مخاطر الاشتباك، فالكائن هو الحل. الكائنات أيضا مفيدة جداً عندما تريد تمرير مجموعة من البيانات من مكان إلى آخر. كل هذه الأمور لا يمكن تحقيقها بدون استخدام ال constructors أو الوراثة. إذا كنت بحاجة إلى instance واحد فقط من الكائن، فمن الافضل استخدام object literal، وبالتأكيد فلن تحتاج للوراثة.

- -

خلاصة

- -

 غطت هذه المادة ما تبقى من نظرية ال OOJS الأساسية، وتركيبة الكائن الاساسية، من خلال هذه المعطيات فعلى الارجح انك اصبحت اكثر قدرة على فهم كائن الجافاسكريبت وأساسيات ال OOP، وايضا ال prototypes والميراث النمودجي (prototypal inheritance)، وكيفية إنشاء كلاسات (اي ما يعادل ال constructors في جافاسكريبت) وال object instances، واضافة ميزات الى الكلاسات، وانشاء كلاسات فرعية (subclasses)، التي ترث من الكلاسات الأخرى.

- -

في الدرس القادم سنلقي نظرة على كيفية التعامل مع ال (JavaScript Object Notation (JSON، وتبادل البيانات المشتركة باستخدام كائنات جافا سكريبت.

-
- -

See also

- -
    -
  • ObjectPlayground.com — A really useful interactive learning site for learning about objects.
  • -
  • Secrets of the JavaScript Ninja, Chapter 6 — A good book on advanced JavaScript concepts and techniques, by John Resig and Bear Bibeault. Chapter 6 covers aspects of prototypes and inheritance really well; you can probably track down a print or online copy fairly easily.
  • -
  • You Don't Know JS: this & Object Prototypes — Part of Kyle Simpson's excellent series of JavaScript manuals, Chapter 5 in particular looks at prototypes in much more detail than we do here. We've presented a simplified view in this series of articles aimed at beginners, whereas Kyle goes into great depth and provides a more complex but more accurate picture.
  • -
- -

{{PreviousMenuNext("Learn/JavaScript/Objects/Object_prototypes", "Learn/JavaScript/Objects/JSON", "Learn/JavaScript/Objects")}}

diff --git a/files/ar/learn/javascript/objects/object-oriented_js/index.html b/files/ar/learn/javascript/objects/object-oriented_js/index.html deleted file mode 100644 index c57bbb13d5..0000000000 --- a/files/ar/learn/javascript/objects/object-oriented_js/index.html +++ /dev/null @@ -1,296 +0,0 @@ ---- -title: جافاسكريبت - البرمجة غرضية التوجه للمبتدئين -slug: Learn/JavaScript/Objects/Object-oriented_JS -translation_of: Learn/JavaScript/Objects/Object-oriented_JS ---- -
{{LearnSidebar}}
- -
{{PreviousMenuNext("Learn/JavaScript/Objects/Basics", "Learn/JavaScript/Objects/Object_prototypes", "Learn/JavaScript/Objects")}}
- -

مع ما تعلمناه من أساسيات، سنركز الآن على جافاسكريبت غرضية التوجه (object oriented programming). او ما يعرف ب (OOP)، سنستعرض في هذه المقالة أساسيات البرمجة غرضية التوجه  نظريا، ثم سنستكشف كيف أن الجافا سكريبت تظاهي الـ object classes المستخدمة في لغات البرمجة الأخرى (php مثلا) عن طريق الـ constructor functions، وأيضا كيفية إنشاء instances من الكائن (أو مثيل الكائن).

- - - - - - - - - - - - -
المتطلبات الأساسية : -

دراية لا باس بها بخصوص الحاسوب، الإلمام بمبادئ وأساسيات الـ HTML وCSS وjavascript (شاهد First steps و Building blocks)  وأساسيات بناء الـكائنات OOJS. (شاهد Introduction to objects).

-
الهدف :فهم نظريا الـبرمجة غرضية التوجه (object-oriented programming)، وكيف أن كل شيء في الجافاسكريبت عبارة عن كائن (object) !.
- وأيضا كيفية إنشاء الـ constructors وobject instances.
- -

البرمجة الكائنية (أو البرمجة غرضية التوجه) 

- -
-

لنبدأ، دعونا نقوم بعرض نبذة بسيطة عن ماهي البرمجة غرضية التوجه ( Object-oriented programming ( OOP على مهل. نقول على مهل، لأن فهم واستيعاب البرمجة غرضية التوجه (OOP) على عجل سيكون امر غاية في التعقيد، كأن نعطيك العلاج الكامل الآن على الأرجح سيسبب لك خلطا أكثر مما سيساعدك.   
- الفكرة الأساسية من البرمجة غرضية التوجه OOP هي أن نستخدم أشياءً من عالمنا الحقيقي ونحولها إلى كائنات ونقوم بتمثيلها داخل برامجنا، ونوفر وسائل سهلة للوصول إلى وظائفها، حتى نستفيد منها.

- -

يتكون الكائن من مجموعة من البيانات والتعليمات البرمجية المتصلة فيما بينها. والتي تمثل معلومات عن الشيء الذي نتعامل معه، والوظيفة أو السلوك الذي نريد منه أن يقوم به. بيانات الكائن في كثير من الأحيان تكون عبارة عن وظائف كثيرة يمكن تخزينها بدقة (أو تغليفها) داخل حزمة الكائن (object package). حزمة الكائن يمكن أن تمتلك اسما يشير إليها، وهو ما يسمى في بعض الأحيان ب namespace. ما يجعل من السهل إعادة هيكلتها أو الوصول إليها، كما يمكن أيضا استخدام الكائنات كمخازن للبيانات حتى يمكن إرسالها بسهولة عبر شبكة الاتصال.
-  

- -

تعريف الـ object template

- -

دعونا ننظر في برنامج سهل يستعرض معلومات عن الطلاب والمعلمين في المدرسة.
- هنا سوف نبحث في نظرية البرمجة الغرضية التوجه OOP بشكل عام، وليس في سياق أي لغة برمجة معينة.

- -

اولا، دعونا نعود إلى الكائن Person الذي عملنا عليه في الدرس السابق قسم اساسيات الكائن في جافاسكريبت، والذي يحدد البيانات العامة والأداء الوظيفي للشخص. هناك الكثير من المواصفات التي يمكن أن يتصف بها اي شخص (عنوانه، الطول، حجم الحذاء، الحمض النووي للشخصية DNA، ورقم جواز السفر، مواصفات شخصية كثيرة...)، في المثال  الذي عملنا عليه في الدرس السابق، ركزنا اهتمامنا فقط على عرض الاسم، والسن والجنس، والاهتمامات، نريد أيضا أن نكون قادرين على كتابة مقدمة قصيرة حول هؤلاء الاشخاص، على أساس هذه البيانات، وجعلهم يقولون مرحبا، وهذا ما يعرف بالتجريد abstraction.

- -

- -

في بعض لغات البرمجة غرضية التوجه OOP الأخرى (PHP مثلا)، يعرف الكائن عامة بال  class (جافا سكريبت تستخدم مصطلحات وآلية مختلفة، كما سنرى أدناه) - في الواقع هو ليس كائنا، بل هو القالب الذي يعرف خصائص الكائن وكيف ينبغي له أن يكون.

- -

إنشاء كائنات فعلية - Creating actual objects 

- -

من خلال الـ class، يمكنك إنشاء object instances  — وهي الكائنات التي تحتوي على البيانات والوظائف المحددة في الـ class (وبالتالي هي مثيلة له). من خلال الـ class Person الخاص بنا، يمكننا الآن إنشاء بعض الأشخاص الفعليين :

- -

- -

عندما يتم إنشاء object instance من الـ class، ستبدأ الـ constructor function الخاصة بال class بإنشائه،  تسمى عملية إنشاء الـ object instance من الـ class بال instantiation (إنشاء مثيل).
- أي أنَّ الـ object instance هو instantiated (مثيل) من الـ class.

- -

كلاسات متخصصة - Specialist classes

- -

في هذه الحالة لسنا بحاجة للأشخاص بصفة عامة، سنستخدم الأساتذة والطلاب بصفة خاصة. في البرمجة غرضية التوجه OOP، يمكنك إنشاء كلاسات بناءً على كلاسات أخرى. مثلا كلاسات الأبناء child الجديدة يمكنها أن ترث البيانات والتعليمات البرمجية من الكلاس الأب parent.
- يمكنك إعادة استخدام وظيفة مشتركة بين جميع أنواع الكائنات بدلاً من الاضطرار إلى تكرار العملية عدة مرات، حيث يختلف الأداء الوظيفي من كلاس لآخر، يمكنك تخصيص ميزات معينة لكل منها حسب الحاجة.

- -

- -

وهذا مفيد حقاً – حيث يتشارك المعلمين والطلاب في الكثير من الخصوصيات المشتركة مثل الاسم ونوع الجنس، والعمر، سيكون من المفيد جدا تعريف تلك الخصوصيات المشتركة مرة واحدة فقط. يمكنك أيضا تعريف نفس تلك الخصوصيات كل على حدة في الكلاسات المختلفة، كما سيتم تعريف كل من هذه الخصوصيات في namespace مختلفة. على سبيل المثال، قد تكون تحية الطالب على هذا الشكل ( Yo, I'm [firstName]" ( Hi, I'm Sam"، بينما قد يستخدم المعلم شيئا أكثر رسمية،
- مثلHello, my name is [Prefix] [lastName] and I teach [Subject]. " )  Hello, My name is Mr Griffiths, and I teach Chemistry).

- -
-

ملاحظة : قدرة الكائنات المتعددة على تنفيذ نفس الوظائف تسمى polymorphism (تعدد الأشكال).

-
- -

يمكنك الآن إنشاء object instances من child classes. على سبيل المثال :

- -

- -

في باقي المقالة سنبدأ بإلقاء نظرة عملية على البرمجة غرضية التوجه OOP في جافا سكريبت.

- -

الـ Constructors والـ object instances

- -

بعض الناس يقولون أن جافاسكريبت ليست لغة كائنية حقيقية، لأنها لا تستخدم الكلمة المحجوزة class لإنشاء الكلاسات مثل العديد من لغات البرمجة الغرضية التوجه OOP. بدلاً من ذلك، الجافاسكريبت تستخدم وظائف خاصة تسمى constructor functions لتعريف الكائنات وميزاتها. هذه الوظائف مفيدة جدا لأنك غالبا ما ستواجه حالات، حيث لا يمكنك معرفة عدد الكائنات التي ستقوم بإنشائها. وبالتالي ستوفر لك الـ constructors الوسائل اللاَّزمة لإنشاء العديد من الكائنات التي تحتاج إليها بطريقة فعالة، وربط البيانات والوظائف كما هو مطلوب.

- -

عندما يتم إنشاء object instance جديد من الـ constructor function، لا يتم نسخ كل الوظائف الى الكائن الجديد مثل الـ «classic OO languages». بدلاً من ذلك يتم تكوين رابط وظيفي بواسطة reference chain تسمى prototype chain  (شاهد Object prototypes). حتى هذا ليس تجسيدًا حقيقـيًّا، إذا توخينا الدقة، فجافاسكريبت تستخدم آلية مختلفة لتبادل الوظائف بين الكائنات.

- -
-

ملاحظة : عدم وجود الـ "classic OOP" ليس بالضرورة أمرا سيئاً، كما ذكر أعلاه، البرمجة الغرضية التوجه OOP معقدة للغاية، لكن للجافاسكريبت بعض الطرق اللطيفة للاستفادة من ميزات الـ OO  دون الحاجة للتعمق كثيرا فيها.

-
- -

لنبدأ بإنشاء كلاسات عن طريق الـ constructors، وإنشاء object instances منها في جافاسكريبت.
- أولاً وقبل كل شيء، نود منك عمل نسخة من الملف التالي oojs.html الذي سبق وأن عملنا عليه في الدرس السابق.

- -

مثال سهل

- -

دعونا نبدأ بالنظر في كيفية تعريف شخص من خلال دالة عادية. أضف هذه الدالة أدناه إلى التعليمات البرمجية الموجودة لديك:

- -
function createNewPerson(name)
-{
-  var obj = {};
-  obj.name = name;
-  obj.greeting = function () {
-    alert('Hi! I\'m ' + this.name + '.');
-  }
-  return obj;
-}
- -

يمكنك الآن إنشاء Person جديد بواسطة استدعاء هذه الدالة، حاول إدخال الأسطر التالية في console الجافاسكريبت في المتصفح الخاص بك:

- -
var salva = createNewPerson('salva');
-salva.name;
-salva.greeting();
- -

يعمل بشكل جيد، ولكنه عمل متعب قليلا. إذا كنا نعرف أننا سننشئ كائنًـا، لماذا نحتاج إلى إنشاء كائن جديد فارغ ونعود إليه  (عبر return)؟ من حسن الحظ، جافاسكريبت تزودنا باختصار مفيد على شكل constructor functions، دعونا الآن ننشئ واحدا !

- -

قم  باستبدال الدالة السابقة بهذه :

- -
function Person(name)
-{
-  this.name = name;
-  this.greeting = function() {
-    alert('Hi! I\'m ' + this.name + '.');
-  };
-}
- -

الـ constructor function هو نسخة الجافاسكريبت فيما يتعلق بال class.
- ستلاحظ أن لديها كافة الميزات التي تتوقعها في الدالة، على الرغم من أنها لا تقوم بإرجاع أي شيء، ولا تقوم بإنشاء كائن، لحد الآن هي مجرد تعريف للـخصائص (properties) والوظائف (methods)، سترى أيضا هذه الكلمة this المستخدمة هنا، فكرتها  أنه كلما تم إنشاء أحد الـ object instances، فإن الـ object's name property سيساوي قيمة الـ name الممررة إلى الـ constructor call،  والوظيفة () greeting ستستخدم قيمة name الممررة إلى الـ constructor call أيضا.

- -

الـ constructor call هو الذي يكون على هذا الشكل  new Object(parameters) كما سنرى بعد قليل.

- -
-

ملاحظة : عادة ما يبدأ اسم الـ constructor function بحرف كبير - يتم استخدام هذا التقليد حتى يسهل التعرف على الـ constructor functions في التعليمات البرمجية بسهولة.

-
- -

كيف يمكننا استدعاء الـ constructor  لإنشاء بعض الكائنات؟

- -

أضف الأسطر التالية أدناه الى اسفل التعليمات البرمجية الخاص بك:

- -
var person1 = new Person('Bob');
-var person2 = new Person('Sarah');
- -

احفظ التعليمات البرمجية الخاصة بك واعد تحميل الصفحة، وحاول إدخال الأسطر التالية في حقل المدخلات الخاص بك (كل على حدة) :

- -
person1.name
-person1.greeting()
-person2.name
-person2.greeting()
- -

جميل! اصبح لدينا كائنان جديدان في الصفحة، تم تخزين كل منهما ضمن namespace مختلفين، للوصول إلى الخصائص والوظائف الخاصة بهما، عليك أن تبدأ بالاتصال اما مع person1 أو person2، هما الان مغلفين بدقة، وبالتالي سنضمن عدم تشابك الوظائف مع بعضها، لاحظ ان لديهم نفس الخاصية name ونفس الوظيفة () greeting، الا أن كل واحد منهما سيحصل على القيمة name التي تم تعيينها له. هذا واحد من الاسباب التي تعرفنا على اهمية this، حيث انها ستشير الى الكائن الخاص بها وليس لشئ اخر.

- -

دعونا ننظر في ال constructor calls مرة أخرى :

- -
var person1 = new Person('Bob');
-var person2 = new Person('Sarah');
- -

في كل حالة من الحالتين، يتم استخدام الكلمة المحجوزة new لاخبار المتصفح بأننا نريد إنشاء object instance جديد، متبوعة باسم الدالة  و ال parameters المطلوبة بين الأقواس، ويتم تخزين النتيجة في متغير، وهي شبيهة جدا بكيفية استدعاء   standard function، ويتم إنشاء كل instance وفقا لهذا التعريف:

- -
function Person(name) {
-  this.name = name;
-  this.greeting = function() {
-    alert('Hi! I\'m ' + this.name + '.');
-  };
-}
- -

بعد أن يتم إنشاء الكائنات الجديدة، فعليا، ستحتوي المتغيرات person1 و person2 على الكائنات التالية على هذا النحو :

- -
{
-  name : 'Bob',
-  greeting : function() {
-    alert('Hi! I\'m ' + this.name + '.');
-  }
-}
-
-{
-  name : 'Sarah',
-  greeting : function() {
-    alert('Hi! I\'m ' + this.name + '.');
-  }
-}
- -

قلنا فعليا لأنه في الواقع الفعلي لا يزال يتم تعريف الوظائف في ال class، وليس في object instances، على عكس ال object literal كما راينا سابقا.

- -

انشاء  constructor

- -

المثال الذي راينا اعلاه، كان مجرد مقدمة، دعونا الان ننشئ Person() constructor function. فعلي.

- -

قم بحذف التعليمات البرمجية التي قمت بإدراجها حتى الآن، واضف هذا ال constructor بدلا منه – هو بالضبط نفس المثال البسيط اعلاه من حيث المبدأ، مع القليل من التعقيد :

- -
function Person(first, last, age, gender, interests) {
-  this.name = {
-    first,
-    last
-  };
-  this.age = age;
-  this.gender = gender;
-  this.interests = interests;
-  this.bio = function() {
-    alert(this.name.first + ' ' + this.name.last + ' is ' + this.age + ' years old. He likes ' + this.interests[0] + ' and ' + this.interests[1] + '.');
-  };
-  this.greeting = function() {
-    alert('Hi! I\'m ' + this.name.first + '.');
-  };
-};
- -

الآن أضف ال constructor call التالي، لإنشاء object instance من ال constructor خاصتنا :

- -
var person1 = new Person('Bob', 'Smith', 32, 'male', ['music', 'skiing']);
- -

يمكنك الآن الوصول إلى الخصائص والوظائف مثلما فعلنا مع الكائن اعلاه :

- -
person1['age']
-person1.interests[1]
-person1.bio()
-// etc.
- -
-

ملاحظة: إذا كنت تواجه صعوبة في الحصول على هذا العمل، حاول مقارنة التعليمات البرمجية الخاصة بك مع التعليمات الخاصة بنا — see oojs-class-finished.html (also see it running live).

-
- -

امتحان بسيط

- -

في هذا الامتحان البسيط وجب عليك إضافة بضعة أسطر اضافية الى الكائن Person خاصتك، ومحاولة جلب وإعداد الاعضاء من ناتج ال object instances.

- -

هناك مشكلتين بخصوص الوظيفة ()bio :
- أ- مخرجاتها ستكون دائما عبارة عن الضمير هو "He"، حتى وان كان الشخص انثى.
- ب- الوظيفة bio سترجع اثنين من الاهتمامات (interests) فقط، حتى وان تم تعيين أكثر من ذالك في مصفوفة الاهتمامات interests.
- يمكن العمل على حل هذه المشكلة داخل ال ?( class definition ( constructor.
- يمكنك وضع أي كود تريده داخل ال constructor (على الأرجح سوف تحتاج لبضع جمل شرطية "if..else if...else" وحلقة "for").
- مطلوب منك حل هذه المشكلة آخدا بعين الاعتبار نوع الجنس (ذكر/انثى). وايضا عدد الاهتمامات interests كان تكون 1 أو 2 أو أكثر من 2. 

- -
-

ملاحظة : إذا واجهتك مشكلة، فقد قمنا بتوفير الاجابة، answer inside our GitHub repo (see it live) — ننصح بالاعتماد على نفسك اولا !.

-
- -

طريقة اخرى لانشاء ال object instances

- -

حتى الآن رأينا طريقتان مختلفتان لإنشاء ال object instance :

- -
    -
  1. باستخدام الاعلان عن ال object literal (الدرس السابق).
  2. -
  3. باستخدام constructor function (انظر أعلاه).
  4. -
- -

هذا منطقي, ولكن هناك طرق أخرى، نريد ان نجعلها مالوفة لديك في حالة مصادفتها في مكان ما على شبكة الويب.

- -

The Object() constructor

- -

يمكنك استخدام ال Object() constructor لانشاء كائن جديد، نعم، حتى الكائنات العامة تحتوي على constructor والذي بدوره يولد كائنا فارغا.

- -

حاول ادخال السطر التالي في console المتصفح الخاص بك :

- -
var person1 = new Object();
- -

سيقوم هذا بتخزين كائن فارغ في المتغير person1. يمكنك بعد ذالك اضافة الخصائص والوظائف لهدا الكائن،
- باستخدام نقطة الترميز او باستخدام اقواس الترميز، حسب الطلب. جرب هذا المثال :

- -
person1.name = 'Chris';
-person1['age'] = 38;
-person1.greeting = function() {
-  alert('Hi! I\'m ' + this.name + '.');
-}
- -

يمكنك ايضا تمرير object literal الى ال Object() constructor ك parameter معبأة على شكل properties/methods. جربه بنفسك :

- -
var person1 = new Object({
-  name : 'Chris',
-  age : 38,
-  greeting : function() {
-    alert('Hi! I\'m ' + this.name + '.');
-  }
-});
- -

باستخدام الوظيفة ()create

- -

الجافاسكريبت لديها وظيفة مبنية مسبقا   (built-in method) تسمى ()create, والتي تسمح لك بإنشاء object instance جديد استناداً إلى كائن موجود.

- -

جرب ادخال هذا السطر في console المتصفح الخاص بك :

- -
var person2 = Object.create(person1);
- -

والان جرب هذه :

- -
person2.name
-person2.greeting()
- -

سترى أن person2 قد تم إنشاؤه استناداً إلى person1 — فاصبح يمتلك نفس الخصائص والوظائف المتاحة لل person1 وهذا مفيد جداً، حيث أنه سيسمح لك بإنشاء object instances جديد، دون الحاجة إلى تعريف ال constructor.
- الجانب السلبي هو أن ال ()create غير مدعومة من قبل بعض المتصفحات، فيما يتعلق بالعودة ك constructors ( IE8 وما قبله لا يدعم هذه الوظيفة ) ، بالإضافة إلى ذلك يعتقد البعض أن ال constructors  تمنح التعليمات البرمجية الخاصة بك مميزات اكثر. يمكنك إنشاء constructors خاصة بك  في مكان واحد، ومن ثم إنشاء instances حسب الحاجة،

- -

ومع ذلك، إذا لم تكن قلقا جداً بشأن دعم المتصفحات القديمة حقاً، وتحتاج فقط لبضع نسخ من الكائن، فان انشاء constructor قد يكون مبالغة بالنسبة للتعليمات البرمجية الخاصة بك. الأمر متروك لك ولما تفضله. ببساطة بعض الناس يجدون ال ()create. سهلة في الفهم والاستخدام.

- -

سوف نستكشف ال ()create بمزيد من التفصيل في وقت لاحق.

- -

ملخص

- -

قدمت هذه المقالة طريقة مفصلة حول ال object-oriented نظريا، هذه ليست القصة بأكملها، ولكنها تعطيك فكرة عن ما نتعامل معه هنا. باﻹضافة إلى ذلك، فقد راينا الكيفية التي ترتبط بها جافا سكريبت، وكيف انها تختلف عن مفهوم ال "classic OOP"، راينا كذالك، كيفية تنفيذ ال الكلاسات classes في الجافاسكريبت باستخدام ال constructor functions، وطرق مختلفة لتوليد ال object instances.

-
- -

ان شاء الله في الدرس القادم سوف نستكشف prototypes الجافا سكريبت.

- -

{{PreviousMenuNext("Learn/JavaScript/Objects/Basics", "Learn/JavaScript/Objects/Object_prototypes", "Learn/JavaScript/Objects")}}

diff --git a/files/ar/learn/javascript/objects/object_prototypes/index.html b/files/ar/learn/javascript/objects/object_prototypes/index.html deleted file mode 100644 index 1e91d18013..0000000000 --- a/files/ar/learn/javascript/objects/object_prototypes/index.html +++ /dev/null @@ -1,248 +0,0 @@ ---- -title: ال Object prototypes -slug: Learn/JavaScript/Objects/Object_prototypes -translation_of: Learn/JavaScript/Objects/Object_prototypes ---- -
{{LearnSidebar}}
- -
{{PreviousMenuNext("Learn/JavaScript/Objects/Object-oriented_JS", "Learn/JavaScript/Objects/Inheritance", "Learn/JavaScript/Objects")}}
- -

ال Prototypes هي الآلية التي تعتمدها الجافاسكريبت للوراثة، بمعنى آخر، يمكننا من خلال ال Prototypes جعل كائن يرث مميزات كائن آخر. وهي تعمل بشكل مختلف عن مفهوم آلية الوراثة في اللغات الغرضية التوجة الكلاسيكية. في هذا الدرس سنكتشف هذا الاختلاف، وسنرى كيف تعمل ال prototype chains، وسنلقي نظرة حول كيفية إضافة وظيفة معينة لـ constructors موجودة عن طريق الخاصية prototype. 

- - - - - - - - - - - - -
المتطلبات الأساسية :دراية لا بأس بها بخصوص الحاسوب، الإلمام بمبادئ وأساسيات الـ HTML وCSS وجافاسكريبت (راجع First steps and Building blocks) وأساسيات بناء الكائنات في الجافاسكريبت OOJS (راجع Introduction to objects).
الهدف :فهم جافاسكريبت object prototypes، وكيف تعمل ال  prototype chains، وكيفية إضافة وظائف جديدة على الخاصية prototype.
- -

الجافا سكريبت لغة تعتمد على ال prototype ؟

- -
-

غالبا ما توصف جافاسكريبت، على أنها لغة تعتمد على البروتوتايب (prototype-based language)، بمعنى، ان كل كائن في الجافاسكريبت يحتوي على الكائن prototype، الذي يرث خصائص ووظائف ال Object. الكائن prototype يمكنه أيضا أن يحتوي على كائن prototype خاص به، ويرث خصائصه ووظائفه ايضا، وهكذا ودواليك. يعرف هذا السلوك بال prototype chain (سلسلة النمودج). وهذا يشرح، كيف انه بإمكان كائن معين ان يصل لخصائص ووظائف مُعَرَّفة في كائن اخر.

- -

حسنا، حتى نكون أكثر دقة، الخصائص والوظائف مُعَرَّفة في الـ Objects' constructor functions  وليس في الـ object instances (مثيلات الكائن).

- -

بالنسبة للبرمجة الكلاسيكية غرضية التوجه classic OOP، يتم تعريف الكلاسات، بعد أن يتم إنشاء object instances، ويتم نسخ كافة الخصائص والوظائف المعرفة في الكلاس فوق ال instance.
- في الجافاسكريبت، الأمر مختلف، حيث يتم تكوين رابط بين الـ object instance والـ constructor الخاص به. يمكن تشبيه الأمر بتكوين (حلقة في سلسلة ال prototype)، ويتم الوصول إلى الخصائص والوظائف من الـ constructor، من خلال التنقل صعودا في السلسلة. بمعنى اخر، سيبدأ مُفسِّر الجافاسكريبت بالبحث داخل النمادج prototypes، عن الخاصّية او الوظيفة المطلوبة، من اسفل سلسلة الوراثة، ويكمل بالبحث حتى يصل الى اعلاها.

- -

دعونا نلقي نظرة على هذا المثال ليصبح الأمر أكثر وضوحا.

- -

فهم ال prototype objects

- -

لنَـعُد إلى المثال الذي انتهينا من كتابتة Person() constructor، قم بتحميل المثال التالي في المتصفح الخاص بك، إذا لم يكن لديك المثال الذي عملنا عليه في الدرس السابق استخدم المثال الخاص بنا oojs-class-further-exercises.html او (قم بنسخ source code).

- -

في هذا المثال قمنا بتعريف constructor function، كالتالي :

- -
function Person(first, last, age, gender, interests) {
-
-  // property and method definitions
-  this.frist = frist;
-  //etc..
-};
- -

ثم قمنا بإنشاء object instance منه هكذا :

- -
var person1 = new Person('Bob', 'Smith', 32, 'male', ['music', 'skiing']);
- -

إذا قمت بكتابة ".person1" في console الجافاسكريبت، ستلاحظ ان المتصفح يقوم بالاكمال التلقائي ويظهر اسماء الاعضاء الموجودة في هذا الكائن.  

- -

- -

في هذه القائمة، نرى الاعضاء المعرفة في ال Person() constructor، الذي يمثله ال person1   وهذه الاعضاء هي name, age, gender, interests, bio و greeting. كما نرى ايضا بعض الأعضاء الآخرين مثل watch ،valueOf،...الخ. وهي معرفة في prototype ال Person() constructor، ال prototype الخاص بال Person() constructor هو ال Object نفسه.

- -

والرسم التبياني التالي يوضح لنا، كيفة عمل ال prototype chain.

- -

- -

فماذا سيحدث إذا قمنا باستدعاء وظيفة على ال person1، وهي احدى الوظائف المعرفة في ال Object؟. على سبيل المثال:

- -
person1.valueOf()
- -

ببساطة فهذه الوظيفة  ()valueOf مملوكة لل Object وبما ان بروتوتايب ال ()Person هو ال  Object وال person1 هو من يمثله فسيرث ال  person1 هذه الخاصية  من  Object. مهمة ال valueOf هي العودة بقيمة الكائن الذي تم استدعاؤها عليه، حاول تجربتها وسترى ما الذي سيحدث.

- -

في هذه الحالة ستسير عملية البحث  على الشكل التالي:

- -
    -
  • في البداية سيقوم المتصفح بالتحقق ما اذا كان الكائن person1 يحتوي على الوظيفة ()valueOf. (لاحظ هنا، بدا البحث من اسفل السلسلة كما ذكرنا اعلاه).
  • -
  • اذا لم يتم ذالك، سيقوم المتصفح بالتحقق ما اذا كان ال Person() constructor يحتوي على الوظيفة ()valueOf
  • -
  • اذا لم يتم ذالك، سيقوم المتصفح بالتحقق ما اذا كان prototype ال Person() constructor يحتوي على الوظيفة ()valueOf
  • -
  • اذا لم يتم ذالك ايضا، سيقوم المتصفح بالتحقق ما اذا كان __proto__ ال Person() constructor الذي هو (Object) يحتوي على الوظيفة ()valueOf
    - اذا تم، ستستدعى الوظيفة المطلوبة للعمل عليها، وكل شئ على ما يرام. اذا لم يجد ما يبحث عنه من ادنى السلسلة الى اعلاها، سيعود ب nullnull هي اعلى السلسلة).
  • -
- -
-

تذكير: الخصائص والوظائف لا يتم نسخها من كائن إلى آخر في ال ptototype chain —
- بل يتم الوصول إليها من خلال التنقل صعودا في السلسلة كما هو موضح أعلاه.

-
- -
-

ملاحظة:  رسميا لا توجد طريقة للوصول مباشرة الى الكائن prototype داخل كائن. "الروابط" بين العناصر موجودة في السلسلة ويتم تعريفها في خاصية داخلية، يشار إليها ب [[prototype]] في مواصفات لغة جافا سكريبت  (see {{glossary("ECMAScript")}}). ومع ذلك فمعظم المتصفحات الحديثة تحتوي على خاصية متاحة لها تسمى __proto__ (لديها 2 underscores في كلا جوانبها), والتي تحتوي على الكائن prototype. على سبيل المثال جرب:
-    __person1.__proto  او  __eprson1.__proto__.__proto
- لمشاهدة ما يشبه السلسلة في التعليمات البرمجية!

-
- -

الخاصية prototype : اين يتم تعريف الأعضاء الموروثة

- -

اذاً، أين يتم تعريف الخصائص والوظائف الموروثة؟
- إذا نظرتم إلى صفحة مرجع ال Object سترون هناك في الجانب الأيسر عددا كبيرا من الخصائص والوظائف المدرجة، البعض منها موروثة، واخرى غير موروثة، لم هذا؟

- -

الجواب، هو أن الاعضاء الموروثة هي تلك المعرفة في الخاصية prototype  (يمكن استدعاؤها تحت ال namespace)، اي تلك التي تبدأ ب .Object.prototype وليست تلك التي تبدأ بمجرد .Object، قيمة الخاصية prototype هي كائن، والتي هي في الاساس حزمة او وعاء لتخزين الخصائص والوظائف التي نريدها أن تكون موروثة من قبل الكائنات السفلية في ال prototype chain.

- -

حتى ال ()Object.prototype.watch او  ()Object.prototype.valueOf، متاحة لأي نوع من أنواع الكائنات التي ترث من ال Object.prototype بما في ذلك ال object instances الجديدة التي يتم إنشاؤها من ال constructor، (ك person1 مثلا).

- -

()Object.is() ،Object.keys، والأعضاء الاخرى غير معرفة داخل حزمة ال prototype وهي غير موروثة بواسطة ال object instances أو أنواع الكائنات التي ترث من ال ()Object. هي خصائص ووظائف متاحة فقط لل Object() constructor نفسه.

- -
-

ملاحظة: يبدو هذا غريبا - كيف يمكن أن يكون لديك وظيفة معرفة في ال constructor،  الذي هو في حد ذاته function؟ حسنا، هي ايضا function من النوع object - راجع مرجع ال Function() constructor حتى تتاكد بنفسك.

-
- -

يمكنك التحقق من خصائص البروتوتايب الموجودة بنفسك، ارجع الى مثالنا السابق وحاول ادخال السطر التالي في الجافاسكريبت console:

- -
Person.prototype
- -

المخرجات لن تظهر لك الكثير، لاننا حتى الان، لم نقم باضافة أي شيء في بروتوتايب ال constructor الخاص بنا، بشكل افتراضي، دائماً يبدأ بروتوتايب ال constructor فارغا. الآن جرب ما يلي:

- -
Object.prototype
- -

سترى عددا كبيرا من الوظائف المعرفة في الخاصية prototype الخاصة بال Object، ثم التي تتوفر على الكائنات التي ترث من ال Object، كما وضحنا في وقت سابق.

- -

سنرى أمثلة أخرى للوراثة عن طريق سلسلة البروتوتايب prototype chain في جميع أنحاء جافا سكريبت، حاول البحث في الوظائف والخصائص المعرفة في بروتوتايب الكائنات العامة ك String ،Date ،Number، و Array  على سبيل المثال. كلها تحتوي على عدد من الأعضاء المعرفة في البروتوتايب  الخاص بها، على سبيل المثال عندما نقوم بإنشاء سلسلة نصية (string)، مثل هذه:

- -
var myString = 'This is my string.';
- -

myString، فور انشائها سيتاح لها العديد من الوظائف المفيدة، مثل ()split و ()indexOf و ()replace ... الخ.

- -
-

هام:  الخاصية prototype هي واحدة من أكثر الاجزاء ارباكا لجافا سكريبت، قد تعتقد أن this تشير الى الكائن prototype  للكائن الحالي، لكن ليس هذا ما يحدث (تذكر ان هذا كائن داخلي  يمكن الوصول إليه بواسطة ال __proto__ ). ال prototype هي خاصية تحتوي على الكائن الذي ستعرف فيه الاعضاء التي تريدها أن تكون موروثة.

-
- -

إعادة النظر في الوظيفة ()create

- -

راينا سابقا كيف يمكن استخدام الوظيفة ()Object.create لانشاء object instance.

- -

على سبيل المثال، حاول تجربة هذا في console الجافا سكريبت في المثال الخاص بك:

- -
var person2 = Object.create(person1);
- -

ماتفعله الوظيفة ()create في الواقع هو انشاء كائن جديد، من الكائن prototype المحدد، في هذه الحالة، سيتم إنشاء person2 باستخدام person1 على شكل كائن prototype، يمكنك التحقق من ذلك عن طريق إدخال ما يلي في ال console :

- -
person2.__proto__
- -

النتيجة: إرجاع الكائن person1.

- -

الخاصية  constructor

- -

كل object instance يحتوي على الخاصية constructor والتي تشير إلى ال constructor function الأصلي الذي أنشأ ال instance.

- -

على سبيل المثال، حاول ادخال هذه الأوامر في ال console:

- -
person1.constructor
-person2.constructor
- -

المفروض على كل منهما العودة لل Person() constructor، كما سيحتوي كل منهما على التعريف الأصلي لهذه ال instances.

- -

خدعة ذكية، يمكنك وضع الاقواس في نهاية الخاصية constructor (مع البرامترات المطلوبة) لانشاء object instance اخر من هذا ال constructor، ال constructor هو في النهاية function، لذالك يمكنك استدعاؤها باستخدام الأقواس، ستحتاج فقط إلى تضمين الكلمة المحجوزة new لتحديد أنك تريد استخدام هذه ال function ك constructor.

- -

حاول ادخال هذا في ال console:

- -
var person3 = new person1.constructor('Karen', 'Stephenson', 26, 'female', ['playing drums', 'mountain climbing']);
- -

الآن حاول الوصول إلى خصائص الكائن الجديد الخاص بك، على سبيل المثال:

- -
person3.name.first
-person3.age
-person3.bio()
- -

هذا سيعمل بشكل جيد. وعلى الارجح لن تحتاج لاستخدامه في كثير من الأحيان، ولكن يمكن أن يكون مفيدا حقا، عندما تريد إنشاء instance جديد لا يشير إلى ال constructor الأصلي المتاح.

- -

الخاصية constructor لها استخدامات أخرى كذالك. على سبيل المثال، إذا كان لديك
-  object instance وترغب في إرجاع اسم ال contructor وهو instance، يمكنك استخدام ما يلي:

- -
instanceName.constructor.name
- -

جرب هذا، على سبيل المثال:

- -
person1.constructor.name
- -

التعديل على ال prototypes

- -

دعونا نلقي نظرة على مثال يقوم بتعديل الخاصية prototype الخاصة بال constructor.

- -

نعود إلى مثالنا oojs-class-further-exercises.html قم بعمل نسخة من الكود التالي source code. اسفل كود الجافاسكريبت، اضف التعليمة البرمجية التالية، وهي خاصة باظافة وظيفة جديدة على بروتوتايب ال constructor :  

- -
Person.prototype.farewell = function() {
-  alert(this.name.first + ' has left the building. Bye for now!');
-}
- -

احفظ التعليمات البرمجية وقم بتحميل الصفحة في المتصفح، وحاول إدخال ما يلي في حقل المدخلات الخاص بك:

- -
person1.farewell();
- -

ستحصل على رسالة تنبيه معروضة (alert)، تضم اسم الشخص كما هو محدد داخل ال constructor. وهذا مفيد حقاً، ولكن الاكثر افائدة هو أنه سيتم تحديث سلسلة الوراثة باكملها بشكل حيوي، و بشكل تلقائي يتم جعل الوظيفة الجديدة متاحة لجميع ال object instances المشتقة من ال constructor.

- -

لنفكر في هذا للحظة. في التعليمة البرمجية خاصتنا، قمنا بتعريف ال  Person constructor
- ثم قمنا بانشاء instance object من هذا ال Person constructor وهو ال person1 ثم قمنا باظافة الوظيفة الجديدة على بروتوتايب ال Person constructor.

- -
function Person(first, last, age, gender, interests) {
-
-  // property and method definitions
-
-};
-
-var person1 = new Person('Tammi', 'Smith', 32, 'neutral', ['music', 'skiing', 'kickboxing']);
-
-Person.prototype.farewell = function() {
-  alert(this.name.first + ' has left the building. Bye for now!');
-}
- -

ولكن الوظيفة ()farewell لا تزال متاحة في ال person1 object instance  — تم تحديث الوظائف المتاحة لها تلقائيا، هذا يثبت ما قلناه سابقا عن ال prototype chain. والمتصفح سيبحث صعودا في السلسلة لإيجاد الوظائف التي لم يتم تعريفها في ال object instance نفسها، بدلا من تلك الوظائف التي يتم نسخها إلى ال instance. وهذا يجعلها قوية جداً، و نظامها الوظيفي قابل للتوسع/للتمدد.

- -
-

Note: إذا كنت تواجه صعوبة في الحصول على هذا العمل, الق نظرة على المثال الخاص بنا oojs-class-prototype.html  (شاهد ايضا running live ).

-
- -

نادرا ما ستشاهد خصائص معرفة في الخاصية prototype، على سبيل المثال يمكن إضافة خاصية جديدة كالتالي:

- -
Person.prototype.fullName = 'Bob Smith';
- -

ولكن هذه ليست مرنة جداً، حيث ان ال person لا يمكنه استدعاءها، من الافضل القيام بذلك من خلال بناء fullName خارج name.first و name.last:

- -
Person.prototype.fullName = this.name.first + ' ' + this.name.last;
- -

ومع ذالك فهي لن تعمل، في هذه الحالة this ستشير الى النطاق العام (global scope). وليس الى نطاق الدالة (function scope). استدعاء هذه الخاصية سيعود ب undefined undefined. سيعمل هذا بشكل جيد في الوظائف التي عرفناها سابقا في ال prototype لانها توجد داخل ال function scope، والتي ستنقل بنجاح إلى نطاق مثيل الكائن (object instance scope). لذا قد تقوم بتعريف خصائص ثابتة (constant properties — أي تلك التي لا تحتاج للتغيير) في ال prototype، ولكن عموما فهي تعمل بشكل أفضل لتعريف خصائص داخل ال constructor.

- -

في الواقع، النمط الشائع إلى حد كبير بخصوص تعريف الكائن، هو ان يتم تحديد الخصائص داخل ال constructor، والوظائف على ال prototype. وهذا يجعل الكود اسهل في القراءة، كما سيحتوي ال constructor على الخصائص المعرفة فقط، ويتم تقسيم الوظائف في بلوكات منفصلة، مثلا:

- -
// Constructor with property definitions
-
-function Test(a,b,c,d) {
-  // property definitions
-};
-
-// First method definition
-
-Test.prototype.x = function () { ... }
-
-// Second method definition
-
-Test.prototype.y = function () { ... }
-
-// etc.
- -

هذا النمط من العمل يمكن ان نراه في Piotr Zalewa's school plan app.

- -

Summary

- -

غطت هذه المادة، جافاسكريبت object prototypes، وكيف يسمح ال prototype object chains للكائنات أن ترث الميزات من بعضها البعض، وكيف يمكن استخدام الخاصية prototype لإضافة وظائف جديدة على ال constructors، وغيرها من الموضوعات ذات الصلة.

- -

في المقال القادم سنرى كيفية تنفيذ الوراثة بين اثنين من الكائنات الخاصة بك.

-
- -

{{PreviousMenuNext("Learn/JavaScript/Objects/Object-oriented_JS", "Learn/JavaScript/Objects/Inheritance", "Learn/JavaScript/Objects")}}

diff --git a/files/ar/learn/server-side/django/index.html b/files/ar/learn/server-side/django/index.html deleted file mode 100644 index 27acf45d5e..0000000000 --- a/files/ar/learn/server-side/django/index.html +++ /dev/null @@ -1,70 +0,0 @@ ---- -title: Django Web Framework (Python) -slug: Learn/Server-side/Django -tags: - - Beginner - - CodingScripting - - Intro - - Learn - - NeedsTranslation - - Python - - Server-side programming - - TopicStub - - django -translation_of: Learn/Server-side/Django ---- -
{{LearnSidebar}}
- -

Django هو إطار ويب بشعبية كبيرة ومميز بالكامل ، مكتوب بلغة Python. توضح لك هذه الوحدة سبب كون Django أحد أكثر أطر خادم الويب شيوعًا ، وكيفية إعداد بيئة تطوير ، وكيفية البدء في استخدامه لإنشاء تطبيقات الويب الخاصة بك.

- -

المتطلبات الأساسية

- -

قبل البدء في هذه الوحدة ، لا تحتاج إلى أي معرفة بجانغو. من الناحية المثالية ، ستحتاج إلى فهم برمجة الويب من جانب الخادم وأطر الويب من خلال قراءة الموضوعات في وحدة الخطوات الأولى لبرمجة موقع الويب من جانب الخادم .

- -

يوصى بمعرفة عامة بمفاهيم البرمجة  Python ، ولكنها ليست ضرورية لفهم المفاهيم الأساسية.

- -
-

Note: Python is one of the easiest programming languages for novices to read and understand. That said, if you want to understand this module better, there are numerous free books and tutorials available on the Internet to help you out (new programmers might want to check out the Python for Non Programmers page on the python.org wiki).

-
- -

Guides

- -
-
Django introduction
-
In this first Django article we answer the question "What is Django?" and give you an overview of what makes this web framework special. We'll outline the main features, including some advanced functionality that we won't have time to cover in detail in this module. We'll also show you some of the main building blocks of a Django application, to give you an idea of what it can do before you set it up and start playing.
-
Setting up a Django development environment
-
Now that you know what Django is for, we'll show you how to set up and test a Django development environment on Windows, Linux (Ubuntu), and macOS — whatever common operating system you are using, this article should give you what you need to be able to start developing Django apps.
-
Django Tutorial: The Local Library website
-
The first article in our practical tutorial series explains what you'll learn, and provides an overview of the "local library" — an example website we'll be working through and evolving in subsequent articles.
-
Django Tutorial Part 2: Creating a skeleton website
-
This article shows how you can create a "skeleton" website project as a basis, which you can then go on to populate with site-specific settings, urls, models, views, and templates.
-
Django Tutorial Part 3: Using models
-
This article shows how to define models for the LocalLibrary website — models represent the data structures we want to store our app's data in, and also allow Django to store data in a database for us (and modify it later on). It explains what a model is, how it is declared, and some of the main field types. It also briefly shows a few of the main ways you can access model data.
-
Django Tutorial Part 4: Django admin site
-
Now that we've created models for the LocalLibrary website, we'll use the Django Admin site to add some "real" book data. First we'll show you how to register the models with the admin site, then we'll show you how to login and create some data. At the end we show some ways in which you can further improve the presentation of the admin site.
-
Django Tutorial Part 5: Creating our home page
-
We're now ready to add the code to display our first full page — a home page for the LocalLibrary that shows how many records we have of each model type and provides sidebar navigation links to our other pages. Along the way we'll gain practical experience in writing basic URL maps and views, getting records from the database, and using templates.
-
Django Tutorial Part 6: Generic list and detail views
-
This tutorial extends our LocalLibrary website, adding list and detail pages for books and authors. Here we'll learn about generic class-based views, and show how they can reduce the amount of code you have to write for common use cases. We'll also go into URL handling in greater detail, showing how to perform basic pattern matching.
-
Django Tutorial Part 7: Sessions framework
-
This tutorial extends our LocalLibrary website, adding a session-based visit-counter to the home page. This is a relatively simple example, but it does show how you can use the session framework to provide persistent behaviour for anonymous users in your own sites.
-
Django Tutorial Part 8: User authentication and permissions
-
In this tutorial we'll show you how to allow users to login to your site with their own accounts, and how to control what they can do and see based on whether or not they are logged in and their permissions. As part of this demonstration we'll extend the LocalLibrary website, adding login and logout pages, and user- and staff-specific pages for viewing books that have been borrowed.
-
Django Tutorial Part 9: Working with forms
-
In this tutorial we'll show you how to work with HTML Forms in Django, and in particular the easiest way to write forms to create, update, and delete model instances. As part of this demonstration we'll extend the LocalLibrary website so that librarians can renew books, and create, update, and delete authors using our own forms (rather than using the admin application).
-
Django Tutorial Part 10: Testing a Django web application
-
As websites grow they become harder to test manually — not only is there more to test, but, as the interactions between components become more complex, a small change in one area can require many additional tests to verify its impact on other areas. One way to mitigate these problems is to write automated tests, which can easily and reliably be run every time you make a change. This tutorial shows how to automate unit testing of your website using Django's test framework.
-
Django Tutorial Part 11: Deploying Django to production
-
Now you've created (and tested) an awesome LocalLibrary website, you're going to want to install it on a public web server so that it can be accessed by library staff and members over the Internet. This article provides an overview of how you might go about finding a host to deploy your website, and what you need to do in order to get your site ready for production.
-
Django web application security
-
Protecting user data is an essential part of any website design. We previously explained some of the more common security threats in the article Web security — this article provides a practical demonstration of how Django's built-in protections handle such threats.
-
- -

Assessments

- -

The following assessment will test your understanding of how to create a website using Django, as described in the guides listed above.

- -
-
DIY Django mini blog
-
In this assessment you'll use some of the knowledge you've learned from this module to create your own blog.
-
diff --git a/files/ar/learn/server-side/express_nodejs/index.html b/files/ar/learn/server-side/express_nodejs/index.html deleted file mode 100644 index 4a5dc0699f..0000000000 --- a/files/ar/learn/server-side/express_nodejs/index.html +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: Express web framework (Node.js/JavaScript) -slug: Learn/Server-side/Express_Nodejs -tags: - - Beginner - - CodingScripting - - Express - - Express.js - - Intro - - JavaScript - - Learn - - NeedsTranslation - - Node - - Server-side programming - - TopicStub - - node.js -translation_of: Learn/Server-side/Express_Nodejs ---- -
{{LearnSidebar}}
- -

Express is a popular unopinionated web framework, written in JavaScript and hosted within the Node.js runtime environment. This module explains some of the key benefits of the framework, how to set up your development environment and how to perform common web development and deployment tasks.

- -

Prerequisites

- -

Before starting this module you will need to understand what server-side web programming and web frameworks are, ideally by reading the topics in our Server-side website programming first steps module. A general knowledge of programming concepts and JavaScript is highly recommended, but not essential to understanding the core concepts.

- -
-

Note: This website has many useful resources for learning JavaScript in the context of client-side development: JavaScriptJavaScript Guide, JavaScript BasicsJavaScript (learning). The core JavaScript language and concepts are the same for server-side development on Node.js and this material will be relevant. Node.js offers additional APIs for supporting functionality that is useful in browserless environments (e.g., to create HTTP servers and access the file system), but does not support JavaScript APIs for working with the browser and DOM.

- -

This guide will provide some information about working with Node.js and Express, and there are numerous other excellent resources on the Internet and in books — some of these linked from How do I get started with Node.js (StackOverflow) and What are the best resources for learning Node.js? (Quora).

-
- -

Guides

- -
-
Express/Node introduction
-
In this first Express article we answer the questions "What is Node?" and "What is Express?" and give you an overview of what makes the Express web framework special. We'll outline the main features and show you some of the main building blocks of an Express application (although at this point you won't yet have a development environment in which to test it).
-
Setting up a Node (Express) development environment
-
Now that you know what Express is for, we'll show you how to set up and test a Node/Express development environment on Windows, Linux (Ubuntu), and Mac OS X. Whatever common operating system you are using, this article should give you what you need to be able to start developing Express apps.
-
Express Tutorial: The Local Library website
-
The first article in our practical tutorial series explains what you'll learn and provides an overview of the "local library" example website we'll be working through and evolving in subsequent articles.
-
Express Tutorial Part 2: Creating a skeleton website
-
This article shows how you can create a "skeleton" website project, which you can then go on to populate with site-specific routes, templates/views, and databases.
-
Express Tutorial Part 3: Using a Database (with Mongoose)
-
This article briefly introduces databases for Node/Express. It then goes on to show how we can use Mongoose to provide database access for the LocalLibrary website. It explains how object schema and models are declared, the main field types, and basic validation. It also briefly shows a few of the main ways you can access model data.
-
Express Tutorial Part 4: Routes and controllers
-
In this tutorial we'll set up routes (URL handling code) with "dummy" handler functions for all the resource endpoints that we'll eventually need in the LocalLibrary website. On completion, we'll have a modular structure for our route handling code, that we can extend with real handler functions in the following articles. We'll also have a really good understanding of how to create modular routes using Express.
-
Express Tutorial Part 5: Displaying library data
-
We're now ready to add the pages that display the LocalLibrary website books and other data. The pages will include a home page that shows how many records we have of each model type and list and detail pages for all of our models. Along the way, we'll gain practical experience in getting records from the database and using templates.
-
Express Tutorial Part 6: Working with forms
-
In this tutorial we'll show you how to work with HTML Forms in Express, using Pug, and in particular how to write forms to create, update, and delete documents from the database.
-
Express Tutorial Part 7: Deploying to production
-
Now you've created an awesome LocalLibrary website, you're going to want to install it on a public web server so that it can be accessed by library staff and members over the Internet. This article provides an overview of how you might go about finding a host to deploy your website, and what you need to do in order to get your site ready for production.
-
- -

See also

- -
-
Installing LocalLibrary on PWS/Cloud Foundry
-
This article provides a practical demonstration of how to install LocalLibrary on the Pivotal Web Services PaaS cloud — this is a full-featured, open source alternative to Heroku, the PaaS cloud service used in Part 7 of the tutorial, listed above. PWS/Cloud Foundry is definitely worth checking out if you are looking for an alternative to Heroku (or another PaaS cloud service), or simply feel like trying something different. 
-
- -

Adding more tutorials

- -
-

All existing tutorials are listed above, but if you would like to extend this module, some other interesting topics to cover include:

- -
    -
  • Using sessions.
  • -
  • User authentication.
  • -
  • User authorization and permissions.
  • -
  • Testing an Express web application.
  • -
  • Web security for Express web applications.
  • -
- -

An assessment for the module would also make a wonderful addition!

-
diff --git a/files/ar/learn/server-side/index.html b/files/ar/learn/server-side/index.html deleted file mode 100644 index 67740218b4..0000000000 --- a/files/ar/learn/server-side/index.html +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: برمجة موقع الويب من ناحية الخادم -slug: Learn/Server-side -translation_of: Learn/Server-side ---- -
{{LearnSidebar}}
- -

 

- -

المواقع الديناميكية - البرمجة من جانب الخادم عبارة عن سلسلة من الوحدات التي تُظهر كيفية إنشاء مواقع ويب ديناميكية ؛ مواقع الويب التي تقدم معلومات مخصصة استجابة لطلبات HTTP. توفر الوحدات مدخلاً عامًا للبرمجة من جانب الخادم ، إلى جانب توجيهات للمبتدئين حول كيفية استخدام الأطر الشبكية ل Django (Python) و Express (Node.js / JavaScript) لإنشاء التطبيقات الأساسية.

- -

تستخدم معظم مواقع الويب الرئيسية نوعًا من تقنية جانب الخادم لعرض البيانات المختلفة ديناميكيًا كما هو مطلوب. على سبيل المثال ، تخيل كم عدد المنتجات المتوفرة على Amazon ، وتخيل عدد الرسائل التي تمت كتابتها على Facebook؟ إن عرض كل هذه الصفحات باستخدام صفحات ثابتة مختلفة تمامًا سيكون غير فعال تمامًا ، لذلك تعرض هذه المواقع بدلاً من ذلك قوالب ثابتة (تم إنشاؤها باستخدام HTML و CSS و JavaScript ) ، ثم تقوم بتحديث البيانات المعروضة داخل تلك النماذج ديناميكيًا عند الحاجة ، على سبيل المثال ، عندما تريد عرض منتج مختلف على Amazon.

- -

في عالم تطوير الويب الحديث ، ينصح بالتعلم عن التطوير من جانب الخادم.

- -

 

- -

 

- -

مسار التعلم

- -

 

- -

عادة ما تكون عملية البدء بالبرمجة من جانب الخادم أسهل من عملية التطوير من جانب العميل ، لأن مواقع الويب الديناميكية تميل إلى تنفيذ الكثير من العمليات المتشابهة (استرداد البيانات من قاعدة بيانات وعرضها في صفحة ، والتحقق من صحة البيانات المدخلة من قبل المستخدم وحفظها في قاعدة بيانات ، وفحص أذونات المستخدم ومستخدمي تسجيل الدخول ، وما إلى ذلك) ، ويتم بناؤها باستخدام أطر الويب التي تجعل هذه العمليات وغيرها من عمليات خادم الويب الشائعة سهلة.

- -

تعتبر المعرفة الأساسية لمفاهيم البرمجة (أو لغة برمجة معينة) مفيدة ، ولكنها ليست ضرورية. وبالمثل ، ليست هناك حاجة إلى خبرة في كتابة التعليمات البرمجية من جانب العميل ، ولكن المعرفة الأساسية ستساعدك على العمل بشكل أفضل مع المطورين الذين ينشئون "واجهة المستخدم" على جانب العميل.

- -

ستحتاج إلى فهم "كيفية عمل الويب". نوصيك أولاً بقراءة المواضيع التالية:

- -

 

- - - -

مع هذا الفهم الأساسي ، ستكون مستعدًا للعمل في طريقك من خلال الوحدات في هذا القسم.

- -

الوحدات

- -

هذا الموضوع يحتوي على الوحدات التالية. يجب أن تبدأ بالوحدة الأولى ، ثم انتقل إلى احدى الوحدات التالية ، والتي توضح كيفية العمل مع اثنين من اللغات الشائعة جدًا من جانب الخادم باستخدام إطارات ويب مناسبة.

- -
-
برمجة موقع الويب من ناحية الخادم الخطوات الأولى
-
توفر هذه الوحدة معلومات عن تكنولوجيا الخادم و برمجة مواقع الويب من جانب الخادم ، بما في ذلك إجابات على الأسئلة الأساسية حول البرمجة من جانب الخادم - "ما هو" ، "كيف تختلف عن برمجة العميل" ، و "لماذا هي كذلك مفيدة "- ونظرة عامة على بعض الأطر الأكثر شعبية على شبكة الإنترنت من جانب الخادم والإرشادات حول كيفية اختيار الأنسب لموقعك. وأخيرًا ، نقدم قسمًا تقديميًا حول أمان خادم الويب.
-
Django Web Framework (Python)
-
Django هو إطار عمل شائع للغاية ومميز للغاية من جانب الخادم ، مكتوب بلغة بايثون. تشرح الوحدة النمطية لماذا يعتبر Django إطارًا جيدًا لخادم الويب ، وكيفية إعداد بيئة تطوير وكيفية تنفيذ المهام الشائعة معها.
-
Express Web Framework (Node.js/JavaScript)
-
Express هو إطار ويب شائع ، مكتوب بلغة JavaScript ومُستضاف في بيئة تشغيل node.js. تشرح الوحدة بعض الفوائد الأساسية لهذا الإطار ، وكيفية إعداد بيئة التطوير الخاصة بك وكيفية تنفيذ مهام مشتركة لتطوير الويب ونشره.
-
- -

أنظر أيضا

- -
-
Node server without framework
-
توفر هذه المقالة ملقم ملفات ثابت بسيطًا تم إنشاؤه باستخدام Node.js خالصًا ، وذلك لمن لا يريد استخدام إطار عمل.
-
diff --git a/files/ar/mdn/about/index.html b/files/ar/mdn/about/index.html deleted file mode 100644 index 8c6962b5c4..0000000000 --- a/files/ar/mdn/about/index.html +++ /dev/null @@ -1,110 +0,0 @@ ---- -title: حول شبكة مطوري موزيلا -slug: MDN/About -tags: - - التوثيق - - الرخص - - المساهمة - - حقوق الملكية - - حول الشبكة - - دليل -translation_of: MDN/About ---- -
{{MDNSidebar}}
- -
{{IncludeSubNav("/ar/docs/MDN")}}
- -

توثيقات شبكة مطوري موزيلا هي منصة تعليمية متطورة لتقنيات الويب والبرمجيات التي يقوم عليها الويب، متضمنةً:

- - - -

هدفنا

- -

هدف شبكة مطوري موزيلا بسيط، فهي تهدف لتزويد المطورين بالمعلومات التي يحتاجونها ليتمكنوا من بناء مشاريع بسهولة على الويب المفتوح. فإذا كانت تقنية مفتوحة متعلقة بالويب، فنحن نريد توثيقها.

- -

بالإضافة لذلك، نقوم بتوفير توثيقات حول منتجات موزيلا وكيف يمكنك بناء والمساهمة في مشاريع موزيلا.

- -

إذا كنت لست متأكداَ إن كان موضوع معين يجب أن يوجد في شبكة مطوري موزيلا، أقرأ مقالة: هل ينتمي هذا إلى شبكة مطوري موزيلا؟

- -

كيف يمكنك المساعدة

- -

أنت لست بحاجة لأن تكون قادراً على البرمجة - أو الكتابة جيداً - لتكون قادراً على مساعدة شبكة مطوري موزيلا! فنملك العديد من الطرق التي يمكنك المساعدة فيها، من إعادة كتابة المقالات لتجعلها منطقية، إلى إضافة العينات البرمجية. في الحقيقة، يوجد العديد من الطرق التي يمكنك المساعدة فيها ولذلك قمنا بكتابة مقالة خطواتك الأولى التي ستساعدك على انتقاء المهمات التي يمكنك القيام بها، اعتماداً على اهتماماتك وعلى وقتك. 

- -

يمكنك المساعدة أيضاً عن طريق نشر شبكة مطوري موزيلا على مدونتك أو موقعك.

- -

مجتمع شبكة مطوري موزيلا

- -

مجتمعنا مجتمع عالمي! فنملك مساهمين رائعين من جميع أنحاء العالم، بأعداد مختلفة من اللغات. إذا أحببت معرفة المزيد حولنا، أو إذا أردت مساعدة شبكة مطوري موزيلا بأي طريقة، تحقق من منتدى المناقشة خاصتنا أو من قناة IRC. يمكنك أيضاً مواكبة أخبارنا عن طريق متابعة حسابنا على التويتر @MozDevNet. تستطيع أيضاً إرسال تغريدة لنا إن كنت ترى شيئاً خاطئاً أو إذا أردت تقديم تعليق لكتابِنا ومساهمينا.

- - - -

استخدام محتوى توثيقات شبكة مطوري موزيلا

- -

حقوق الطباعة والنشر والرخص

- -

تم إنشاء توثيقات شبكة مطوري موزيلا من مساهمات للعديد من الأشخاص، البعض منهم من مؤسسة موزيلا والبعض الآخر من خارجها. ما لم يذكر خلاف ذلك، يتوفر المحتوى تحت بنود رخصة المشاع الإبداعي نَسب المُصنَّف - الترخيص بالمثل، الإصدار 2.5 فما فوق. يرجى إدراج "Mozilla Contributors" ("المساهمين في موزيلا") وإضافة رابط تشعيبي (على الأنترنت) أو عنوان URL (في المحتوى المطبوع) لتحديد الصفحة التي ينتمي إليها المحتوى المستشهد به. فعلى سبيل المثال، لتوفير إسناد لهذه المقالة، يمكنك كتابة:

- -
مقالة حول شبكة مطوري موزيلا من قبل المساهمين في موزيلا مرخصة تحت رخصة المشاع الإبداعي نَسب المُصنَّف - الترخيص بالمثل.
- -

لاحظ في المثال أنَّ "المساهمين في موزيلا" تشير برابط إلى الصفحة المذكورة. اقرأ مقالة أفضل الطرق للإسناد للمزيد من التوضيح.

- -
-

اقرأ مقالة محتوى شبكة مطوري موزيلا على موقع WebPlatform.org للمزيد من المعلومات حول كيفيّة إعادة استخدام وإسناد محتوى شبكة مطوري موزيلا على ذاك الموقع.

-
- -

العينات البرمجية المضافة إلى الموسوعة قبل آب في 2010/20 متوفرة تحت رخصة MIT؛ يجب عليك إضافة معلومات الإسناد التالية إلى الرخصة: "© <تاريخ آخر مراجعة للصفحة> <اسم الشخص الذي أنشأ الصفحة>".

- -

العينات البرمجية المضافة إلى الموسوعة في أو بعد آب في 2010/20 متوفرة تحت رخصة المشاع الإبداعي التخصيص للملك العام. لا يلزم إشعار الترخيص، ولكن إذا أردت واحداً، يمكنك استخدام: "أي حق للمؤلف مخصص للملك العام. http://creativecommons.org/publicdomain/zero/1.0/".

- -

إذا أردت المساهمة في هذه الموسوعة، يجب عليك وضع مساهمتك تحت رخصة المشاع الإبداعي نَسب المُصنَّف - الترخيص بالمثل (أو أحياناً تحت رخصة بديلة مذكورة في الصفحة التي تحررها)، وعيناتك البرمجية يجب أن تكون متوفرة تحت رخصة المشاع الإبداعي التخصيص للملك العام. فبإضافة صفحة لهذه الموسوعة أنت توافق على وضع مساهماتك تحت تلك الرخص المذكورة.

- -

بعض المحتوى الأقدم مُرخص تحت رخصة أخرى غير مذكورة أعلاه؛ تلك رخصة مذكورة أسفل كل صفحة كما في الطريقة المذكورة في مقالة الترخيص البديل.

- -
-
-
-
لا يمكن إنشاء صفحات جديدة باستخدام تراخيص بديلة
-
-
-
- -

تُعزا حقول الطبع والنشر للمواد الملحقة بالمساهمة للمؤلف ما لم يَعزُها لشخصٍ آخر.

- -

إذا كان لديك أي سؤال أو أهتمام حول أي شيء تم مناقشته هنا، رجاءً تواصل مع اريك شيبيرد.

- -
-

الحقوق في العلامات التجارية والشعارات وعلامات الخدمة لمؤسسة موزيلا، فضلاً عن الشكل والمظهر في هذا الموقع، ليست مرخصة بموجب رخصة المشاع الإبداعي، وإلى الحد الذي هي أعمال التأليف (مثل الشعارات والتصميمات)، فهي ليست مدرجة في العمل المرخص بموجب هذه الشروط. إذا كنت تستخدم نص المستندات، وترغب أيضا في استخدام أي من هذه الحقوق، أو إذا كان لديك أي أسئلة أخرى حول الامتثال لشروط الترخيص لهذه المجموعة، يجب عليك الاتصال بمؤسسة موزيلا: license@mozilla.org.

- -

الإشارة إلى شبكة مطوري موزيلا

- -

اقرأ هذه المقالة للحصول على دليل إرشادي حول الإشارة إلى شبكة مطوري موزيلا لمعرفة الطرق الأفضل عندما تقوم بالإشارة إلى شبكتنا.

- -

تحميل المحتوى

- -

يمكنك تحميل النسخة الكاملة من شبكة مطوري موزيلا (بحجم 2.1GB الذي رصد في شباط 2017).

- -

الصفحات الفردية

- -

يمكنك الحصول على محتوى صفحة فردية في شبكة مطوري موزيلا بإضافة معاملات الوثيقة للرابط لتحديد الصيغة التي تريدها.

- -

أدوات طرف ثالث

- -

يمكنك رؤية محتوى شبكة مطوري موزيلا باستخدام أدوات طرف ثالث مثل Dash (لنظام ماك) و Zeal (لنظام لينُكس وويندوز).

- -

الإبلاغ عن مشاكل في توثيقات شبكة مطوري موزيلا

- -

اقرأ كيف تُبلِّغ عن مشكلة في شبكة مطورين موزيلا.

- -

تاريخ توثيقات شبكة مطوري موزيلا

- -

بدأ مشروع وثائق شبكة مطوري موزيلا (مركز مطوري موزيلا سابقاً) في نهاية 2005، عندما حصلت مؤسسة موزيلا على ترخيص من AOL لاستخدام محتوى نيتسكيب DevEdge. حيث تم استخراج المحتوى المفيد من DevEdge، وبعدها قام المتطوعون بالانتقال لهذه الموسوعة.

- -

يمكنك إيجاد المزيد عن تاريخ شبكة مطوري موزيلا على صفحة احتفال الذكرة العاشرة، حيث تحتوي على تاريخ الشفهي من قبل بعض الأشخاص الذين ساهموا في المشروع.

- -

حول موزيلا

- -

سواءً كنت تريد معرفة المزيد حول من نحن، أو كيف يمكنك أن تكون جزءً من موزيلا أو فقط تريد أن تعرف أين يمكنك إيجادنا، فأنت في المكان المناسب. لمعرفة ما يدفعنا ويجعلنا مختلفين، يرجى زيارة صفحة هدفنا.

diff --git a/files/ar/mdn/at_ten/index.html b/files/ar/mdn/at_ten/index.html deleted file mode 100644 index e467484b96..0000000000 --- a/files/ar/mdn/at_ten/index.html +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: MDN at 10 -slug: MDN/At_ten -translation_of: MDN_at_ten -original_slug: MDN_at_ten ---- - - -
-
-

The history of MDN

- -

In early 2005, a small team of idealists set out to create a new, free, community-built online resource for all Web developers. Their brilliant but offbeat idea grew into today’s Mozilla Developer Network—the premier resource for all open Web technologies. Ten years later, our global community is bigger than ever, and together we’re still creating documentation, sample code and learning resources for all open Web technologies, including CSS, HTML, JavaScript and everything else that makes the open Web as powerful as it is.

- -

Learn more about the history

- - -

Contributing to MDN

- -

For ten years, the MDN community has been documenting the open Web. From fixing simple typos to writing entire suites of an entirely new API, everyone has something to offer and no contribution is too large or too small. We have over 90,000 pages of content that have been written or translated by members of our outstanding community of Mozillians. You can become one of them.

- -

Learn more about contributing

- -

 

- -

 

-
- -
{{TenthCampaignQuote}}
- - - -
    -
  1. MDN at 10
  2. -
  3. The history of MDN
  4. -
  5. Contributing to MDN
  6. -
-
diff --git a/files/ar/mdn/contribute/feedback/index.html b/files/ar/mdn/contribute/feedback/index.html deleted file mode 100644 index 9bd5d9e5d5..0000000000 --- a/files/ar/mdn/contribute/feedback/index.html +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: ارسل تعليقاتك حول الشبكة -slug: MDN/Contribute/Feedback -tags: - - التوثيق - - حول - - حول الشبكة - - دليل -translation_of: MDN/Contribute/Feedback ---- -
{{MDNSidebar}}
- -
{{IncludeSubnav("/ar/docs/MDN")}}
- -

مرحباً بك في شبكة مطوري موزيلا! إن كنت تملك أية إقتراحات، أو تواجه مشكلة في استخدام الشبكة، فهذه الصفحة مناسبة لك. في الحقيقة، مجرد اهتمامك بالتفاعل معنا يجعلك جزءً من مجتمع موزيلا، فشكراً مقدماً على هذا الاهتمام.

- -

يوجد عدة طرق لتقدم اقتراحك؛ وهذه المقالة ستساعدك على ذلك.

- -

حدِّث التوثيقات

- -

قبل كل شيء، إذا رأيت أي مشكلة بالتوثيقات، فعليك ألا تتردد أبدا بتصحيحها بنفسك.

- -
    -
  1. قم بتسجيل الدخول باستخدام GitHub.
  2. -
  3. انقر على الزر الأزرق المسمى عدِّل (Edit)، الموجود بأي صفحة، لتفتح المُحرِر.
  4. -
  5. انقر على الزر انشر (Publish) لتحتفظ بالتغييرات بعد انتهائك.
  6. -
- -

تعمل التوثيقات هنا بنظام الموسوعة، والتي يتم إدارتها من قبل مجموعة من المتطوعين والموظفين، لذلك لا تشعر بالخجل، فلا يجب أن تكون كتابتك القواعديّة مثالية. سنصحح لك إن أخطأت؛ لا ضرر في ذلك!

- -

للمزيد من المعلومات حول المساهمة في وثائق شبكة مطوري موزيلا، اقرأ:

- - - -

انضم إلى المحادثات

- -

تحدث معنا! يوجد بضعة طرق للتواصل مع الآخرين الذين يعملون على محتوى الشبكة.

- -

الدردشة (المتزامنة)

- -

نستخدم IRC للتحدث عن الشبكة ومحتواها. يمكنك أنت أيضاً الانضمام إلى المحادثة! لدينا عدة قنوات لتختار منها بناءً على اهتمامك:

- -
-
محتوى موقع الشبكة (mdn#)
-
هذه القناة مخصصة للنقاش العام حول الشبكة، متضمنةً: استخدام الموقع، وقراءة المحتوى على الموقع، والمساهمة في محتوى الموقع. إذا كنت تملك سؤالاً أو تعليقاً حول محتوى مقالة، أو كنت ترغب في رؤية أو إنشاء مقالة جديدة، أو لمجرد أنك تريد التحدث مع فريق الكتابة، فهذه القناة مناسبة لك بالتأكيد.
-
تطوير موقع التوثيق (mdndev#)
-
تعد هذه القناة المكان الذي نتكلم فيه عن أعمال تطوير المنصة التي تعمل عليها الشبكة. فإذا كنت تواجه مشكلة مع إحدى وظائف الموقع، أو تملك فكرة لميزة جديدة، يمكنك الإنضمام إلينا.
-
- -

المناقشات (الغير متزامنة)

- -

تَحدُث المناقشات الطويلة في منتدى النقاش الخاص بالشبكة. يمكنك النشر في المنتدى باستخدام البريد mdn@mozilla-community.org. إذا انضممت للمنتدى، يمكنك الحصول على إشعارات حول المناقشات عبر البريد الإلكتروني أيضاً.

- -

بلِّغ عن الأخطاء

- -

أخطاء في التوثيق

- -

إذا وجدت مشكلة في التوثيق ولم تستطع إصلاحها لسببٍ ما، فيمكنك الإبلاغ عنها! يمكنك استخدام هذه الاستمارة للتبليغ عن أي مشكلة متعلقة بالتوثيق، على سبيل المثال:

- -
    -
  • تصحيح بسيط
  • -
  • طلب فقرة جديدة ليتم إضافتها للمحتوى
  • -
  • الإبلاغ عن محتوى غير لائق (مثل محتوى غير مرغوب أو ترجمة ليست في مكانها الصحيح)
  • -
- -

كما ذكرنا سابقاً، ندعوك للمساهمة في تلك التغييرات بنفسك، ولكن هذا الخيار متوفر أيضاً.

- -

أخطاء في الموقع

- -

إذا واجهت مشكلة في موقع الشبكة، أو كنت تملك فكرة لميزة جديدة، فيمكنك فتح تذكرة لفريق التطوير.

diff --git a/files/ar/mdn/contribute/getting_started/index.html b/files/ar/mdn/contribute/getting_started/index.html deleted file mode 100644 index 6721236823..0000000000 --- a/files/ar/mdn/contribute/getting_started/index.html +++ /dev/null @@ -1,107 +0,0 @@ ---- -title: خطواتك الأولى في الشبكة -slug: MDN/Contribute/Getting_started -tags: - - الإرشادات - - البداية - - الدليل - - المبتدئين - - المقدمة - - حول الشبكة - - دليل -translation_of: MDN/Contribute/Getting_started ---- -
{{MDNSidebar}}
{{IncludeSubnav("/ar/docs/MDN")}}
- -

نحن مجتمع مفتوح من المطورين والكتاب نبني موارد لتحسين شبكة الإنترنت، بغض النظر عن العلامة التجارية، أو المتصفح، أو النظام الأساسي. يمكن لأي شخص المساهمة وكل شخص يجعلنا أقوى. معاً يمكننا الاستمرار في دفع الابتكار على شبكة الإنترنت لخدمة الخير. كل شيء يبدأ هنا، وبمساعدتك.

- -

يتم بناء كل جزء من الشبكة (من التعليمات البرمجية التي تجعل الموقع يعمل إلى العينات البرمجية والعروض التوضيحية) من قبل مجتمع من المطورين والكُتّاب. كلٌ منا يمكنه ان يقدم شيء، ونأمل أن تفعل ذلك أيضاً!

- -

ثلاث خطوات سهلة للبدء

- -

شبكة مطوري موزيلا هي عبارة عن موسوعة، حيث يمكن  للجميع أن يضيف أو يعدل المحتوى. لست ملزمًا أن تكون مبرمجاً أو أن تكون مُلِمَّاً بقدر كبير من التقنية، هناك الكثير من الأشياء التي يجب فعلها، بدءاً من المهام السهلة مثل التدقيق اللغوي أو تصحيح الأخطاء المطبعيّة، إلى تلك المهام الصعبة مثل كتابة وثائق للواجهات البرمجيّة. هذا الدليل سيساعدك على إيجاد أفضل طريقة للمساعدة في تحسين محتوى الشبكة.

- -

المساهمة هنا سهلة وآمنة. حتى لو قمت بخطأٍ ما، فيمكن إصلاحه بسهولة؛ إذا كنت لا تعلم كيف يفترض أن تبدو الصفحات، أو أن مهاراتك اللغويّة ليست ممتازة، فلا تقلق حيال ذلك! لدينا فريق من الأشخاص الذين أوكلنا إليهم الحرص على جودة محتوى الشبكة وظهوره بأفضل شكل ممكن. سيتأكد شخص ما من أنّ ما قمت بكتابته يظهر بشكل أنيق ومكتوب بشكل صحيح. شارك معرفتك وابذل كل جهدك، وكن على ثقة بأنَّ بقيّة أفراد المجتمع سيجعلون عملك يظهر بشكل أفضل مما تتصور.

- -

الخطوة الأولى: أنشئ حساباً على الشبكة

- -

لتبدأ المساهمة يجب عليك امتلاك حساب في  الشبكة. للمزيد من التفاصيل، رجاءً اقرأ كيف تقوم بإنشاء حساب. لاحظ أنّك ستحتاج إلى حساب جيتهاب قبل أن تنشئ واحداً على الشبكة، حيث أننا نقوم باستخدام الجيتهاب كوسيلة للمصادقة في الوقت الراهن.

- -

الخطوة الثانية: اختر مهمة

- -

الآن وقد سجلت الدخول، اقرأ معلومات حول أنواع المهمات المختلفة في {{anch("أنواع المهام المتاحة", "القائمة أدناه")}}، واختر أيهم أنسب لك. يمكنك اختيار أي مهمة تريدها والبدء بالمساهمة.

- -

تفضل وطالع مقالة كيفَ تحصل على صلاحيّة إنشاء الصفحات في حال احتجت لإنشاء صفحة جديدة أثناء أداء مهماتك. لاحظ أنَّ الحسابات الجديدة لا تمتلك القدرة على إنشاء صفحات جديدة، افتراضياً، لأسباب أمنيّة.

- -

الخطوة الثالثة: أنجز المهمة

- -

عندما تختار نوع المهمة التي تريدها، ابحث عن صفحة أو شيفرة أو أمثلة ...إلخ لكي تبدأ به، وقم بها فقط!

- -

لا تقلق حول جودة عملك؛ المساهمون الآخرون في الشبكة موجودون هنا لإصلاح الأخطاء التي تسقط منك سهوًا. إذا كانت لديك أسئلة لتطرحها، اذهب لصفحة المجتمع لمعلومات حول القوائم البريدية وقنوات الدردشة حيث يمكنك إيجاد إجابات لأسئلتك.

- -
-

إذا كنت تريد تعديل بعض الصفحات على الشبكة بغرض التجربة فقط قبل القيام بذلك على الصفحات الرئيسية، فنحن قد وفرنا لك صفحة تجريبيّة حيث يمكنك تجربة ما تشاء فيها. ومن فضلك قم بكل تجاربك في تلك الصفحة فقط. ولا تقم بتعديلات غير ضروريّة للصفحات الأخرى لكي ترى ما الذي قد يحدث؛ فهذا قد يتسبب بمشاكل للآخرين فلا يمكنهم إصلاحها أو أسوأ من ذلك، فقد تتسبب بتضليل القراء الذين يبحثون عن معلومة.

-
- -

عندما تنتهي من القيام بمهمتك، يمكنك البدء بواحدة أخرى، أو اقرأ حول {{anch("أشياء أُخرى يمكنك فعلها على الشبكة", "أشياء أُخرى يمكنك فعلها على الشبكة")}}.

- -

أنواع المهام المتاحة

- -

هناك العديد من السبل التي يمكنك اتباعها للمساهمة في الشبكة، اعتماداً على مهاراتك واهتماماتك. على الرغم من وجود العديد من المهام الشاقة، إلاّ أنه توجد الكثير من المهام السهلة المتوفر أيضاً. الكثير منها لا يتطلب سوى خمسة دقائق من وقتك (أو أقل!). أدناه، إلى جانب المهمة ووصف قصير لها، ستجد الوقت التقريبي الذي تأخذه كل مهمة للقيام بها.

- -

الخيار الأول: أحب الكتابة!

- -

يمكنك مساعدتنا بمراجعة أو تحرير الوثائق، وإضافة الوسوم المناسبة لها.

- - - -
إن كنت تكتب أو تراجع المقالات، فيرجى أن تقرأ دليل التنسيق. هذا سيساعدك على التأكد أن المقالة متسقة ومُنسَّقة.
- -

الخيار الثاني: أحب البرمجة!

- -

نحتاج المزيد من العينات البرمجية! يمكنك أيضاً المساعدة ببناء المنصة التي يعمل عليها الموقع (منصة Kuma).

- - - -

الخيار الثالث: أحب الكتابة والبرمجة!

- -

لدينا مهام تتطلب المهارتين التقنية واللغوية معاً، ككتابة مقالات جديدة، أو المراجعة للدقة التقنية، أو تكييف الوثائق.

- - - -

الخيار الرابع: أريد الشبكة بلغتي!

- -

جميع الترجمات التي تتم في الشبكة تكون بفضل مجتمعنا الرائع من المتطوعين.

- - - -

الخيار الخامس: وجدت بعض المعلومات الخاطئة ولكن لا أعلم كيفية إصلاحها!

- -

يمكنك الإبلاغ عنها عبر ملء استمارة الإبلاغ (خمسة دقائق)

- -

أشياء أُخرى يمكنك فعلها على الشبكة

- - diff --git a/files/ar/mdn/contribute/howto/create_and_edit_pages/index.html b/files/ar/mdn/contribute/howto/create_and_edit_pages/index.html deleted file mode 100644 index f7f9f136b8..0000000000 --- a/files/ar/mdn/contribute/howto/create_and_edit_pages/index.html +++ /dev/null @@ -1,180 +0,0 @@ ---- -title: كيفية إنشاء وتحرير الصفحات -slug: MDN/Contribute/Howto/Create_and_edit_pages -translation_of: MDN/Contribute/Howto/Create_and_edit_pages -original_slug: MDN/Contribute/Howto/كيفية_إنشاء_وتحرير_الصفحات ---- -
{{MDNSidebar}}
- -

This article introduces new contributors to the process of editing existing pages and creating new ones.

- -

Editing an existing page

- -

To edit a page:

- -
    -
  1. Click the Edit button near the top right corner of the page.
  2. -
  3. The page then reloads, with an editing interface where you can add or delete information directly.
  4. -
  5. Add paragraphs, delete text, insert headings, and perform more of the basic functions involved in writing and editing.
  6. -
- -

See the guide to Editor UI elements in the MDN Editor guide for more information on using MDN's built-in editor.

- -

Preview changes

- -

To see what your changes look like:

- -
    -
  • Click the Preview button, within the editing function at the top or bottom of the page.
  • -
  • This opens the preview page, showing your revisions in a new window, or tab.
  • -
  • Each time you click this button, it refreshes your preview page with the latest changes.
  • -
- -

Be careful! Previewing a page does not save your progress. Don't close the editing tab until you've saved your work.

- -

Revision comment

- -

After previewing your changes, you will want to save your revision. Before you save, look for the revision comment box, below the editing box, leaving a comment to inform other contributors why you made changes. For example, you might have added a new section, changed some words to make the terminology more consistent, rewritten a paragraph to clarify the language, or removed information because it was redundant.

- -

Table of Contents

- -

The 'In this Article' section of an article, is an auto-generated list of links to the headings on the page. The wording of these can be edited via the headings. It's also possible to remove a table of contents, or decrease its number of links, by selecting 'Edit Page Title and Properties', changing the value of the "TOC" drop down.

- -

Tags

- -

You can add or remove tags, which describe the page content and purpose, below the editing section. See How to properly tag pages, for information on which tags to apply.

- -

Review needed?

- -

If an expert, or experienced contributor should review your edits, please request a technical review (for code, API's, or technologies), and/or an editorial review (for prose, grammar, and content), making sure the appropriate box is checked before you save.

- -

Attach files

- -

If you wish to attach a file to an existing page, or to add an illustration for further clarification, this can be added to the bottom of the page. When uploading an image, please be sure to use an image optimization tool to make the file as small to download as possible. This improves page load time and helps MDN's performance overall. You may use your preferred tool, if you have one. Otherwise, we suggest TinyPNG, a handy Web tool.

- -

Publish, Discard, or Keep editing

- -

When you finish editing, and are happy with your preview, publish your work and comments by clicking the green Publish button, to the right of the page title, or towards the bottom of the page. If you wish to continue working, click Publish and keep editing, which publishes your changes and keeps the edit interface open. 

- -

If you change your mind, you can discard edits, by clicking the red Discard button. Note that discarding changes permanently discards them.

- -

Pressing Enter in the Revision Comment field is equivalent to clicking Publish and Keep Editing.

- -
-

Note: If attempting to save, but changes are rejected as invalid, and you feel the content is appropriate for MDN, email the MDN admin team for assistance.

-
- -

Getting page-creation permissions

- -

For security reasons, newly-created accounts don't have the ability to create new pages. If you try to do so, you'll see a page instructing you how to get the page created. There are two options:

- -
    -
  • Ask for the page to be created for you. To do this, file a documentation request bug, with the subject "Create page: <page title>". Fill out the URL field with the location on MDN where you'd like the page to go, if you know where to place it. In the comment text, include information on why this page needs creating.
  • -
  • Request page creation privileges. If you request page creation privileges, and they're granted to you, you'll be able to add new pages by following the instructions here. To request these privileges, email the MDN admin team with your request. Include your username, why you would like to have the ability to create new pages. For instance, you're documenting a new API which involves many new pages, or you'd like to add new terms to the glossary. You should also have made useful contributions to this site's content, and been a contributor for some time. This length of time, and the other factors, are collectively considered.
  • -
- -

Creating a new page

- -

Once you have page-creation permission, you can begin creating pages.

- -

If you do not know where to place a new article, do not worry. Put it anywhere, we will find it, move to where it belongs, or merge it into existing content. Whatever makes the most sense. Do not worry about making it perfect. We have happy helper gnomes who help making your content clean and rather luscious.

- -

There are a few ways to create a new page:

- - - -
-
- - - -

As with most wikis, it is possible to create a link to a page that is yet to exist. For example, an author might create a list of all the members of an API, before creating the pages for those members. On MDN, links to non-existent pages are typically displayed in red.

- -

To create a page from a 'missing page' link:

- -
    -
  1. Log into MDN, and have page-creation permission. If not logged in, clicking a 'missing page' link results in a 404 (page not found) error.
  2. -
  3. Click the 'missing page' link. If you have page creation permission, the MDN Editor UI opens, ready for you to create the missing page.
  4. -
  5. Write the content of the page, and save it.
  6. -
- - - -

To create a new page without linking from another page, enter a unique page name in the URL field of your browser. For example, if you enter:

- -
https://developer.mozilla.org/en-US/docs/FooBar
- -

MDN creates a new page, with the title "FooBar", opening the editor for you to add new content. Refer to the Editing an existing page section of this article, for information on how to use the editor mode.

- -

To create a new page without linking from another page:

- -
    -
  1. Log in, and have page-creation permission.
  2. -
  3. Enter the following in the URL field of your browser:
  4. -
- -
https://developer.mozilla.org/en-US/docs/new
- -

MDN creates a new page, with a place for a title, opening the editor to add new content to this page. Refer to Editing an existing page, for information on using editor mode.

- -

Subpage of an existing page

- -

To create a page you want to be below an existing page, in the page hierarchy:

- -
    -
  1. On the 'parent' page, click the Advanced menu (the gear icon in the toolbar), then click New sub-page.
  2. -
  3. An editor view opens for creating a new document.
  4. -
  5. Add a title for this document, in the Title field.
  6. -
  7. Change the Slug field, if needed. For example, if the title is long, and a shorter URL seems appropriate. This field is automatically filled by the editor, substituting underscores for spaces found in the title, changing only the last part of the URL.
  8. -
  9. In the TOC field, select heading levels you want to be displayed in the table of contents for the page. Or select 'No table of contents', if one is not needed.
  10. -
  11. Write content of the page in the editor pane, saving your changes. Refer to Editing an existing page, for further information on using editor mode.
  12. -
- -

Clone of an existing page

- -

If there is an existing page, whose format you wish to use as a base for your new page, you can 'clone' that page, and then change its content.

- -
    -
  1. On the original page, click the Advanced menu (the gear icon in the toolbar), and click Clone this page. An editor view opens, for creating a new document.
  2. -
  3. Change the Title of the page, as appropriate for the new content. The Slug field is updated automatically as you change the Title field.
  4. -
  5. Change the path portion of the Slug field, as needed, to put the new document in a different location in the document hierarchy. In most cases, this is not needed. A cloned page often has similar content to its original, and need to be in a similar location.
  6. -
  7. In the TOC field, select the heading levels you want to be automatically displayed in the table of contents for this page. Or select 'No table of contents', if one is not needed.
  8. -
  9. Write your content in the editor pane, saving your changes. Refer to Editing an existing page, for more information on using editor mode.
  10. -
- - - -

This is a bit of a hybrid. You can create a link on another page, then click the link you just inserted, to create the new page:

- -
    -
  1. Enter the name of your new page, anywhere that makes sense in the text of an existing page.
  2. -
  3. Highlight this new name, and click the Link icon () in the editor's toolbar. The 'Update Link' dialog opens, with the highlighted text in the 'Link To' field.
  4. -
  5. "/en-US/docs/" is inserted by default, to the beginning of the URL field. Enter the name of the page after "/en-US/docs/". The page name does not have to be the same as the link text.
  6. -
  7. Click OK, to create and insert the link.
  8. -
- -

If the page does not yet exist, the link is displayed in red. If the page does exist, the link is displayed blue. If you want to create a new page, but the page title you desire is already taken, check if it makes sense helping edit and improve the page already there. Otherwise, think of a unique title for your new page, and create a link for it. Refer to page naming guide for guidelines.

- -

To add content to your new page, click on the red link you just created, after saving and closing the editor. The new page opens in editor mode, enabling you to start writing. Refer to Editing an existing page, for further information on using editor mode.

- -

Refreshing page content

- -

MDN support of KumaScript macros, and integration of content from other pages, can sometimes be hampered by the need for caching of pages, for performance reasons. Pages are built from their source, and this output is cached for future requests. From that moment on, any macros (templates), or integrations (using the macroPage), will not reflect later changes made to the macro, its output, or the contents of the integrated material.

- -
    -
  • To manually update a page, force-refresh your Web browser. MDN detects this, triggering a page rebuild, pulling in updated macro output, and integrating page content.
  • -
  • You can also configure pages to periodically rebuild, automatically. This should not be done, unless you expect the page to update frequently. See Page regeneration, for detailed information.
  • -
- -

See also

- - diff --git a/files/ar/mdn/contribute/howto/index.html b/files/ar/mdn/contribute/howto/index.html deleted file mode 100644 index 6623e08af6..0000000000 --- a/files/ar/mdn/contribute/howto/index.html +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: How-to guides -slug: MDN/Contribute/Howto -tags: - - Documentation - - Landing - - MDN - - NeedsTranslation - - TopicStub -translation_of: MDN/Contribute/Howto ---- -
{{MDNSidebar}}
{{IncludeSubnav("/ar/docs/MDN")}}
- -

These articles provide step-by-step guides to accomplishing specific goals when contributing to MDN.

- -

{{LandingPageListSubpages}}

diff --git a/files/ar/mdn/contribute/howto/report_a_problem/index.html b/files/ar/mdn/contribute/howto/report_a_problem/index.html deleted file mode 100644 index 32a5b16087..0000000000 --- a/files/ar/mdn/contribute/howto/report_a_problem/index.html +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: كيفية الإبلاغ عن مشكلة في MDN -slug: MDN/Contribute/Howto/Report_a_problem -translation_of: MDN/Contribute/Howto/Report_a_problem ---- -
{{MDNSidebar}}
- -

Now and then, you may run into problems while using MDN. Whether it's a problem with site infrastructure or an error in documentation content, you can either try to fix it yourself or report the problem. While the former is preferred, the latter is sometimes the best you can manage, and that's okay too.

- -

Documentation errors or requests

- -

Obviously, since MDN is a wiki, the best thing you can possibly do is fix problems you spot yourself. But maybe you don't know the answer or are in the middle of a deadline on your own project or something, and need to jot down the problem so someone can look at it later.

- -

The way to report a documentation problem by filing an documentation issue. The issue template contains sections for the information needed to get us started on fixing the issue. Feel free to delete any part of the template that isn't helpful or relevant to your issue.

- -

Of course, our writing community is busy, so sometimes the quickest way to see a documentation problem resolved is to fix it yourself. See How to create and edit pages for details. 

- -

Site bugs or feature requests

- -

Kuma, the Mozilla-developed platform used for the MDN web site, is in a state of continuous development. Our developers—as well as a number of volunteer contributors—are constantly making improvements. If you see a bug, or have a problem with the site, or even have a suggestion for something that could make the software more awesome, you can use the Kuma bug form to file a report. You can also use this form to report performance problems with the site, though odds are that performance-monitoring tools have already notified the appropriate people.

- -
diff --git a/files/ar/mdn/contribute/howto/tag/index.html b/files/ar/mdn/contribute/howto/tag/index.html deleted file mode 100644 index ec40ef97c6..0000000000 --- a/files/ar/mdn/contribute/howto/tag/index.html +++ /dev/null @@ -1,376 +0,0 @@ ---- -title: How to properly tag pages -slug: MDN/Contribute/Howto/Tag -translation_of: MDN/Contribute/Howto/Tag ---- -
{{MDNSidebar}}
- -

Article tags are an important way to put visitors in touch with helpful content. Each page should normally have several tags to help keep content organized. This page explains the best way to tag pages so that our readers can find information and we can keep ourselves organized.

- -

For a help with the user interface for editing tags, see the tagging section in our editor guide.

- -

Please use tags properly as explained below. If you don't, our automated tools will not correctly generate lists of content, landing pages, and cross-linking of articles.

- -

How MDN uses tags

- -

Tags get used on MDN several ways:

- -
-
{{anch("Document category", "Document categorization")}}
-
What type of document is it? Is it a reference? A tutorial? A landing page? Our visitors can use these tags to filter searches, so they're really important!
-
{{anch("Topic", "Topic identification")}}
-
What is the article about? Is it about an API? The DOM? Graphics? Again, these tags are important because they can filter searches.
-
{{anch("API identification")}}
-
Reference pages about an API need to identify the specific component of the API being documented (that is, what interface it's a part of, and what property or method the page covers, if applicable).
-
{{anch("Technology status")}}
-
What's the status of the technology? Is it non-standard? Obsolete or deprecated? Experimental?
-
{{anch("Skill level")}}
-
For tutorials and guides, how advanced is the material covered by the article?
-
{{anch("Document metadata")}}
-
The writing community uses tags to keep track of which pages need what kind of work.
-
- -

Tag type guide

- -

Here's a quick guide to the types of tags and possible values for them.

- -

Document category

- -

When you tag an article with one of these categories, you help the automated tools more accurately generate landing pages, tables of contents, and so on. Our new search system will also use these terms so that our visitors can locate reference or guide information at will.

- -

We use the following category names as standard tagging terms:

- -
-
{{Tag("Intro")}}
-
The article provides introductory material about a topic. Ideally each technology area should have only one "Intro"
-
{{Tag("Reference")}}
-
The article contains reference material about an API, element, attribute, property, or the like.
-
{{Tag("Landing")}}
-
The page is a landing page.
-
{{Tag("Guide")}}
-
The article is a how-to or guide page.
-
{{Tag("Example")}}
-
The article is a code sample page, or has code samples (that is, actual snippets of useful code, not one-line "syntax examples").
-
- -

Topic

- -

By identifying the article's topic area, you are helping generate better search results (and landing pages and navigation as well).

- -

While there's some room for flexibility here as we identify new topic areas, we try to limit ourselves to the names of APIs or technologies. Some useful examples:

- -
    -
  • {{Tag("HTML")}}
  • -
  • {{Tag("CSS")}}
  • -
  • {{Tag("JavaScript")}} (notice the capital "S"!)
  • -
  • {{Tag("Document")}}
  • -
  • {{Tag("DOM")}}
  • -
  • {{Tag("API")}} for each API's overview, interface, method, and property.
  • -
  • {{Tag("Method")}} for each method of an API
  • -
  • {{Tag("Property")}} for each property of an API
  • -
  • {{Tag("Graphics")}}
  • -
  • {{Tag("SVG")}}
  • -
  • {{Tag("WebGL")}}
  • -
  • {{Tag("Tools")}}
  • -
  • {{Tag("Web")}}
  • -
  • {{Tag("Element")}}
  • -
  • {{Tag("Extensions")}} and {{Tag("WebExtensions")}} for WebExtension documentation.
  • -
- -

In general, your topic identification tag should be the name of an interface with a number of related pages (like Node, which has many pages for its various properties and methods), or the name of an overall technology type. You might tag a page about WebGL with Graphics and WebGL, for example, but a page about {{HTMLElement("canvas")}} with HTML, Element, Canvas, and Graphics.

- -

Mozilla-specific content

- -

These tags are used in Mozilla-specific content only:

- -
    -
  • {{Tag("Mozilla")}}
  • -
  • {{Tag("Firefox")}}
  • -
  • {{Tag("Firefox OS")}}
  • -
  • {{Tag("Gecko")}}
  • -
  • {{Tag("XUL")}}
  • -
  • {{Tag("XPCOM")}}
  • -
- -

API identification

- -

Within the API reference, each article should identify which part of the API it covers:

- -
-
{{tag("Interface")}}
-
The main article for an interface should have this tag. For example, {{DOMxRef("RTCPeerConnection")}}.
-
{{tag("Constructor")}}
-
Each interface may have up to one page tagged "Constructor"; this is the interface's constructor. The page should have the same name as the interface, like {{DOMxRef("RTCPeerConnection.RTCPeerConnection()", "RTCPeerConnection()")}}.
-
{{tag("Property")}}
-
Every article describing a particular property within an interface needs this tag. See {{DOMxRef("RTCPeerConnection.connectionState")}}, for example.
-
{{tag("Method")}}
-
Each article documenting an interface method needs this tag. See {{DOMxRef("RTCPeerConnection.createOffer()")}} for example.
-
- -

In addition, the reference pages need to include interface, property, and method names among their tags. Some examples:

- -
-
The interface {{DOMxRef("RTCPeerConnection")}}
-
Include the tag {{Tag("RTCPeerConnection")}} along with the other relevant tags ({{Tag("Interface")}}, {{Tag("WebRTC")}}, {{Tag("WebRTC API")}}, {{Tag("API")}}, {{Tag("Reference")}}, and so forth).
-
The method {{DOMxRef("RTCPeerConnection.createOffer()")}}
-
Include the tags {{Tag("RTCPeerConnection")}} and {{Tag("createOffer")}} (note no parentheses in tag names!) along with the other relevant tags, including {{Tag("Method")}}, {{Tag("WebRTC")}}, {{Tag("WebRTC API")}}, {{Tag("API")}}, {{Tag("Reference")}}, and so forth. Consider including things like {{Tag("Offer")}} and {{Tag("SDP")}}, which are also relevant here.
-
The property {{DOMxRef("RTCPeerConnection.iceConnectionState")}}
-
Include the tags {{Tag("RTCPeerConnection")}} and {{Tag("iceConnectionState")}} along with the other relevant tags, including {{Tag("Property")}}, {{Tag("WebRTC")}}, {{Tag("WebRTC API")}}, {{Tag("API")}} and {{Tag("Reference")}}. Also consider including {{Tag("ICE")}}.
-
- -

Technology status

- -

To help the reader understand how viable a technology is, we use tags to label pages as to the status of the technology's specification. This isn't as detailed as actually explaining what the spec is and how far the technology has come in the specification process (that's what the Specifications table is for), but it helps the reader judge, at a glance, whether it's a good idea to use the technology described in the article.

- -

Here are possible values for these tags:

- -
-
{{Tag("Read-only")}}
-
Apply this tag to reference pages which describe a property or attribute which is read-only.
-
{{Tag("Non-standard")}}
-
Indicates that the technology or API described on the page is not part of a standard, whether it's stable or not in any browsers which implement it (if it's not stable, it should also be {{Tag("Experimental")}}). If you don't use this tag, your readers will assume the technology is standard. The compatibility table on the page should clarify which browser(s) support this technology or API.
-
{{Tag("Deprecated")}}
-
The technology or API covered on the page is marked as deprecated in the specification, and is likely to eventually be removed, but is generally still available in current versions of browsers.
-
{{Tag("Obsolete")}}
-
The technology or API has been deemed obsolete and has been removed (or is actively being removed) from all or most current browsers.
-
{{Tag("Experimental")}}
-
The technology is not standardized, and is an experimental technology or API that may or may not ever become part of a standard. It is also subject to change in the browser engine (typically only one) that implements it. If the technology isn't part of any specification (even in draft form), it should also have the {{tag("Non-standard")}} tag.
-
{{Tag("Needs Privileges")}}
-
The API requires privileged access to the device on which the code is running.
-
{{Tag("Certified Only")}}
-
The API only works in certified code.
-
- -

These tags are no excuse to leave out the compatibility table in your article! That should always be present.

- -

Skill level

- -

Use the skill-level tag type only for guides and tutorials (that is, pages tagged Guide) to help users choose tutorials based on how familiar they are with a technology. There are three values for this:

- -
-
{{Tag("Beginner")}}
-
Articles designed to introduce the reader to a technology they've never used or have only a passing familiarity with.
-
{{Tag("Intermediate")}}
-
Articles for users who have gotten started with the technology but aren't experts.
-
{{Tag("Advanced")}}
-
Articles about stretching the capabilities of a technology and of the reader.
-
- -

Document metadata

- -

The writing community uses tags to label articles as requiring specific types of work. Here's a list of the ones we use most:

- -
-
{{Tag("Draft")}}
-
The article is not complete, and is at least in theory still actively being updated (although it's also possible it's been forgotten about). Try to check with the most recent contributors before making changes, in order to avoid potential content collisions.
-
{{Tag("NeedsCompatTable")}}
-
The article needs a table to specify compatibility of a feature across browsers. See here for a guide on contributing to browser compatibility.
-
{{Tag("NeedsContent")}}
-
The article is a stub, or is otherwise lacking information. This tag means that someone should review the content and add more details and/or finish writing the article.
-
{{Tag("NeedsExample")}}
-
The article needs one or more examples created to help illustrate the article's point. These examples should use the live sample system.
-
{{Tag("NeedsLiveSamples")}}
-
The article has one or more examples that need to be updated to use the live sample system.
-
{{Tag("NeedsMarkupWork")}}
-
The article needs improvement to the page markup (usually because the page content consists mostly or entirely of {{HTMLElement("p")}} tags).
-
{{Tag("NeedsSpecTable")}}
-
The article needs a table to indicate on which specification document(s) the feature was defined.
-
{{Tag("NeedsUpdate")}}
-
The content is out of date and needs to be updated.
-
{{Tag("l10n:exclude")}}
-
The content is not really worth localizing and will not appear on localization status pages.
-
{{Tag("l10n:priority")}}
-
The content is important and should be marked as a priority for MDN translators. Shows up in an extra priority table on localization status pages.
-
- -

Putting it all together

- -

So to each page you assign tags from several tag types, for example

- -
-
A tutorial about WebGL for beginners
-
{{Tag("WebGL")}}, {{Tag("Graphics")}}, {{Tag("Guide")}}, {{Tag("Beginner")}}
-
Reference page for {{HTMLElement("canvas")}}
-
{{Tag("Canvas")}}, {{Tag("HTML")}}, {{Tag("Element")}}, {{Tag("Graphics")}}, {{Tag("Reference")}}
-
A landing page for Firefox OS developer tools
-
{{Tag("Tools")}}, {{Tag("Firefox OS")}}, {{Tag("Landing")}}
-
- -

Tagging and search filters

- -

Search filters won't work properly unless we tag MDN pages properly. Here's a table of search filters and which tags they look for.

- -
-

Note: If multiple tags are listed under "Tag name," that means any one or more of these tags must be present for the article to match.

-
- -
-

FIXME: Filter topics have been changed since this was last updated.

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Filter groupSearch filter nameTag name
TopicAPIs and DOM{{Tag("API")}} || {{Tag("DOM")}} {{Deprecated_Inline}}
Add-ons & Extensions {{Deprecated_Inline}}{{Tag("Add-ons")}} || {{Tag("Extensions")}} || {{Tag("Plugins")}} || {{Tag("Themes")}} || {{Tag("WebExtensions")}}
CSS{{Tag("CSS")}}
Canvas{{Tag("Canvas")}}
Firefox{{Tag("Firefox")}}
Firefox for Android {{Obsolete_Inline}}{{Tag("Firefox Mobile")}}
Firefox for Desktop {{Obsolete_Inline}}{{Tag("Firefox Desktop")}}
Firefox OS{{Tag("Firefox OS")}}
Games{{Tag("Games")}}
HTML{{Tag("HTML")}}
HTTP{{Tag("HTTP")}}
JavaScript{{Tag("JavaScript")}}
Marketplace {{Non-standard_Inline}}{{Tag("Marketplace")}}
MathML{{Tag("MathML")}}
Mobile{{Tag("Mobile")}}
Open Web Apps {{Non-standard_Inline}}{{Tag("Apps")}}
SVG{{Tag("SVG")}}
Web Development{{Tag("Web Development")}}
Web Standards{{Tag("Web")}}
WebExtensions{{Tag("WebExtensions")}}
WebGL{{Tag("WebGL")}}
XPCOM {{Non-standard_Inline}}{{Tag("XPCOM")}}
XUL {{Non-standard_Inline}}{{Tag("XUL")}}
{{anch("Skill level")}}I'm an Expert{{Tag("Advanced")}}
Intermediate{{Tag("Intermediate")}}
I'm Learning{{Tag("Beginner")}}
Document typeDocsThis restricts the search to docs content, leaving out Hacks and other MDN content.
DemosThis includes Demo Studio content in the search results.
Tools{{Tag("Tools")}}
Code Samples{{Tag("Example")}}
How-To & Tutorial{{Tag("Guide")}}
Developer ProfilesThis includes developer profiles from the MDN site in the search results.
External ResourcesThe dev team is still figuring this out...
- -

Tagging problems you can fix

- -

There are several kinds of tag problems you can help fix:

- -
-
No tags
-
Generally articles should have at least a "{{anch("Document category", "category")}}" tag and a "{{anch("Topic", "topic")}}" tag. Usually other tags are appropriate as well, but if you can help us ensure that the minimum tags are present, you'll be a documentation hero!
-
Tags that don't follow our tagging standards
-
Please fix any documents whose tags don't follow the standards on this page.
- Note that you may occasionally see some localized tags (such as Référence) showing up on some English pages. This was due to a bug in Kuma, which caused the tags to reappear even if they were deleted. That bug has since been fixed, so any remaining localized tags can be cleaned up if they're spotted.
-
Incorrect tags
-
If you're looking at an article about HTML and it's tagged "JavaScript", that's probably wrong! Likewise, if an article discusses Mozilla internals but has a "Web" tag, that's probably wrong too. Remove these tags and add the right tags if they aren't already there. Please also correct misspelled tags (e.g., "Javascript" will still match, since tags are case-insensitive, but let's not be sloppy!).
-
Missing tags
-
If an article has some but not all of the tags it needs, feel free to add more. For example, if a page in JavaScript reference is (correctly) tagged "JavaScript" but nothing else, you're invited to tag the page "Reference" or {{anch("Document category", "another category tag")}} as well!
-
Tag spam
-
This insidious beast is the most revolting tag problem of all: some Web vermin has deposited its droppings in the page tags (like "Free warez!" or "Hey I was browsing your site and wanted to ask you if you could help me solve this problem I'm having with Flash crashing all the time"). We've got to delete these right away! They're ugly, they're hard to manage if they're allowed to linger too long, and they're terrible for {{Glossary("SEO")}}.
-
- -

If you see one (or more) of these problems, please log into MDN and click EDIT at the top right of the MDN window. Once the editor loads up, scroll down to the bottom of the page, where you'll see the tag box. For more details on the tagging interface, see "The tags box" in the MDN editor guide.

diff --git a/files/ar/mdn/contribute/howto/write_a_new_entry_in_the_glossary/index.html b/files/ar/mdn/contribute/howto/write_a_new_entry_in_the_glossary/index.html deleted file mode 100644 index c97cbc3136..0000000000 --- a/files/ar/mdn/contribute/howto/write_a_new_entry_in_the_glossary/index.html +++ /dev/null @@ -1,138 +0,0 @@ ---- -title: كيفية الكتابة والرجوع إلى التدوين في قاموس المصطلحات -slug: MDN/Contribute/Howto/Write_a_new_entry_in_the_Glossary -translation_of: MDN/Contribute/Howto/Write_a_new_entry_in_the_Glossary ---- -
{{MDNSidebar}}
- -
{{IncludeSubnav("/en-US/docs/MDN")}}
- -

In this article, we cover how to add and link to entries in the MDN Web Docs glossary. We also provide guidelines about glossary entry layout and content. The glossary provides definitions for all of the terms, jargon, abbreviations, and acronyms you'll come across when reading about the web and about web development.

- -

المسرد ليس كاملاً ، وربما لن يكتمل. الويب يتغير دائمًا وينمو دائمًا. يمكنك مساعدتنا في الحفاظ على تحديث المسرد ، وملء أي فجوات ، من خلال المساهمة في إدخالات جديدة في المسرد (أو حتى عن طريق إصلاح المشكلات التي تحددها في الإدخالات الحالية).

- -

المساهمة في المسرد هي طريقة سهلة للمساعدة في جعل شبكة الإنترنت أسهل للجميع لفهمها. لا تحتاج إلى مستوى عالٍ من المهارة الفنية للقيام بذلك ، أيضًا ، لأن مقالات المسرد تهدف إلى أن تكون واضحة وموجزة.

- -

كيف تكتب في قاموس

- -

If you're looking for topics that need a glossary entry, check the list of undocumented terms at the end of the Glossary landing page; click any of those links to start a new Glossary page for the item you clicked; then follow the steps below.

- -

إذا كانت لديك فكرة عن إدخال مسرد مصطلحات جديد ، فما عليك سوى فتح الزر التالي في علامة تبويب جديدة ، ثم اتبع الخطوات الموجودة أسفل الزر:

- - - - - - - -

Step 1: Select a term to explain

- -

The first thing to do is to choose a term to write about. If you don't know which terms are in need of definitions, you can check out our list of suggestions. Just click one and get started writing! If you're logged in already, you'll wind up in the MDN editor.

- -

Step 2: Write a summary

- -

The first paragraph of any glossary page is a simple and short description of the term (preferably no more than two sentences). Make sure anyone reading the description can understand the defined term immediately.

- -
-

 ملاحظة: يرجى عدم نسخ تعريفات ولصقها من أي مكان آخر (لا سيما ويكيبيديا ، لأن مجموعة إصدارات الترخيص الخاصة بها أصغر ، وبالتالي فهي غير متوافقة مع نسخة MDN). من المهم حقًا التأكد من أن هذا المحتوى بسيط وسهل الفهم. الأمر يستحق قضاء بعض الوقت على ذلك بدلاً من سرقة المحتوى بشكل أعمى. يجب أن يكون هذا المسرد محتوى جديدًا مفيدًا ، وليس تكرار الأشياء من مكان آخر.

-
- -

Writing a good glossary entry

- -

If you must, you can add a few extra paragraphs, but it's very easy to find yourself writing a whole article. Writing a whole article is fine, but please don't put it in the glossary. If you aren't sure where to put your article, feel free to reach out to discuss it.

- -

A few simple guidelines to consider while writing a glossary entry that may help you create a better one:

- -
    -
  • When you use terms in the glossary's description of the term or abbreviation, you should create appropriate links for them. Often, this will just involve creating links to other pages in the glossary (see How to use the Glossary macro below). For terms directly related to the term being described by the glossary, it may be more useful to link to MDN Web Docs' main body article on the topic.
  • -
  • Try to use appropriate related terms (with links) within your article if it can be done without making the article hard to follow. Having a good web of related, useful inks can make a page or set of pages much easier to use.
  • -
  • Think about what you would type into a search engine if you wanted to find this page. Try to use all the words you'd search on in the article, without making the article nonsensical, overly long, or difficult to read.
  • -
- -

Specifying the tooltip

- -

As is the case with most MDN links, hovering the mouse cursor over a gossary link will show a brief description of the page (in this case, a short summary of the term's definition). By default, the tooltip is the entire first paragraph of the article, but this is often too long.

- -

You can specify a subsection of text that will be used as the page summary (and therefore the tooltip text) by selecting a sentence or two that best summarize the definition of the term, then adding the "SEO Summary" style to them. This not only establishes the tooltip text, but also specifies the text that will be sent to Google and other search engines when they ask for a brief summary describing the page contents. For that reason, specifically selecting a page summary is also valuable for helping your new page get found more easily.

- -
-

ملاحظة: من الناحية المثالية ، يجب أن يتراوح الملخص بين 150 و 160 حرفًا ؛ أقل ما يرام ، وأكثر ليست جيدة ولكن لن كسر أي شيء ، احد الامرين.

-
- - - -

Finally, a glossary entry should always end with a "Learn more" section. This section should contain links to help the reader move forward: discovering more details, learning to use the relevant technology, and so on.

- -

We recommend that you sort the links into at least these three groups:

- -
-
General knowledge
-
Links that provide more general information; for example, such as a link to a relevant page on Wikipedia.
-
Technical reference
-
Links to more in-depth technical information, on MDN Web Docs or elsewhere.
-
Learn about it
-
Links to tutorials, exercises, examples, or any other materials that help the reader learn to use the technology behind the defined term.
-
- -

التعامل مع الغموض

- -

Sometimes, a term has several meanings depending on the context. To resolve the ambiguities, you must follow those guidelines:

- -
    -
  • The term's main page must be a disambiguation page containing the {{TemplateLink("GlossaryDisambiguation")}} macro.
  • -
  • The term has subpages that define the term for a given context.
  • -
- -

Let's illustrate that with an example. The term signature can have different meanings in at least three different contexts: security, function and email.

- -
    -
  1. The page Glossary/Signature is the disambiguation page with the {{TemplateLink("GlossaryDisambiguation")}} macro.
  2. -
  3. The page Glossary/Signature/Security is the page defining a signature in a security context.
  4. -
  5. The page Glossary/Signature/Function is the page defining a function signature.
  6. -
  7. The page Glossary/Signature/Email is the page defining email signature.
  8. -
- -

How to use the \{{Glossary}} macro

- -

The glossary is much more useful when people can access the definitions from another document without navigating away from what they're reading. Therefore we urge you to link to the glossary whenever you can, using the {{TemplateLink("Glossary")}} macro:

- - - - - - - - - - - - - - - - - - - - - - - - - - -
MacroResultNote
\{{Glossary("browser")}}{{Glossary("browser")}}When a text matches the term to be defined, just use the macro as is (it's case insensitive)
\{{Glossary("browser", "Web browser")}}{{Glossary("browser","Web browser")}}To display an alternative text, use the second argument to specify that text
\{{Glossary("browser", "Web browser", 1)}}{{Glossary("browser","Web browser",1)}}Specify 1 as an optional third argument to display the link as a regular link rather than a subtle hint
- -

Links created with the \{{Glossary}} macro always display a tooltip containing the glossary entry's summary paragraph or the "SEO summary" if one has been selected as described in Specifying the tooltip above.

- -

Using the macro wisely

- -

In many cases, it's perfectly safe to use the Glossary macro anywhere on MDN. There are a couple of guidelines to consider, though:

- -
    -
  • If a term already has a link to an appropriate page somewhere else on MDN, don't replace the link with a glossary link.
  • -
  • Within an article section, use the \{{Glossary}} macro only once for the same term (hint: a section always starts with a title).
  • -
diff --git a/files/ar/mdn/contribute/index.html b/files/ar/mdn/contribute/index.html deleted file mode 100644 index c22c7b6d14..0000000000 --- a/files/ar/mdn/contribute/index.html +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: ساهم في شبكة مطوري موزيلا -slug: MDN/Contribute -tags: - - حول الشبكة - - صفحة هبوط -translation_of: MDN/Contribute ---- -
{{MDNSidebar}}
{{IncludeSubnav("/ar/docs/MDN")}}
- -
مرحباً بك! بزيارتك لهذه الصفحة، فأنت تأخذ أول خطوة لتصبح مساهماً في الشبكة!
- -

المقالات المسرودة هنا تغطي جميع جوانب المساهمة في الشبكة، بما فيها دليل التنسيق، ومقالات إرشادية لاستخدام محررنا والأدوات المختلفة، والمزيد. تأكد رجاءً من قراءة (والموافقة على) بنود استخدام موزيلا قبل تعديل أو إنشاء أي صفحة.

- -

إذا لم تساهم في شبكة مطوري موزيلا مسبقاً، احرص على قراءة دليل البدء ليساعدك على انتقاء مهمة وتنفيذها.

- -
-
-
-
مقالات "كيف تقوم"
-
توفر هذه المقالات دلائل إرشادية خطوة بخطوة لتنفيذ مهمة معينة عند المساهمة في الشبكة.
-
ترجمة شبكة مطوري موزيلا
-
تُستخدم هذه الشبكة من أشخاص حول العالم كمرجع ودليل في تقنيات الويب، بالإضافة لاستخدامها كمرجع في أجزاء فيرفوكس الداخلية. تعتبر مجتمعات الترجمة خاصتنا الجزء الرئيسي من مشروع موزيلا؛ فعملهم في ترجمة وتوطين توثيقاتنا تساعد الناس حول العالم في تطوير الويب المفتوح. إن كنت ترغب في تعلم المزيد حول فِرق ترجمتنا، أو الانضمام لإحداها، أو حتى بدء فريق ترجمة جديد، فهذا هو المكان المناسب لتبدأ.
-
- -
-
-
- -
-
-
أدوات شبكة موزيلا للمطورين
-
توفر أدوات شبكة موزيلا للمطورين عدداً من الميزات، التي تجعل تتبع التقدم، وإدارة المحتوى، ومواكبة تحديثات الموقع أسهل.
-
دليلك نحو محرر شبكة مطوري موزيلا
-
الـ WYSIWYG (يقصد به ما تراه هو ما تحصل عليه) هو محرر تقدمه موسوعة شبكة مطوري موزيلا، يجعل من السهل المساهمة بمحتوى جديد. يوفر دليل محرر شبكة مطوري موزيلا بعض المعلومات عن كيفية استخدام محرر، فضلاً عن بعض المعلومات حول الميزات المفيدة التي قد تساهم في تحسين إنتاجيتك.
-
-
-
diff --git a/files/ar/mdn/guidelines/index.html b/files/ar/mdn/guidelines/index.html deleted file mode 100644 index 8f14102c44..0000000000 --- a/files/ar/mdn/guidelines/index.html +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: Guidelines -slug: MDN/Guidelines -tags: - - Guidelines - - Landing - - MDN Meta - - NeedsTranslation - - TopicStub -translation_of: MDN/Guidelines ---- -
{{MDNSidebar}}
{{IncludeSubnav("/en-US/docs/MDN")}}
- -

These guides provide details on how MDN documentation should be written and formatted, as well as how our code samples and other content should be presented. By following these guides, you can ensure that the material you produce is clean and easy to use.

- -

{{LandingPageListSubpages}}

diff --git a/files/ar/mdn/guidelines/writing_style_guide/index.html b/files/ar/mdn/guidelines/writing_style_guide/index.html deleted file mode 100644 index 1eed23f4b1..0000000000 --- a/files/ar/mdn/guidelines/writing_style_guide/index.html +++ /dev/null @@ -1,730 +0,0 @@ ---- -title: Writing style guide -slug: MDN/Guidelines/Writing_style_guide -translation_of: MDN/Guidelines/Writing_style_guide ---- -
{{FirefoxSidebar}}
- -
{{IncludeSubnav("/en-US/docs/MDN")}}
- -

لتقديم الوثائق بطريقة منظمة وموحدة وسهلة القراءة ، يصف دليل نمط مستندات ويب MDN كيفية تنظيم النص وتهجيته وتنسيقه وما إلى ذلك. هذه إرشادات بدلاً من قواعد صارمة. نحن مهتمون بالمحتوى أكثر من التنسيق ، لذلك لا تشعر بأنك ملزم بتعلم دليل الأسلوب قبل المساهمة. لكن لا تنزعج أو تفاجأ إذا قام متطوِّر كادح في وقت لاحق بتحرير عملك ليتوافق مع هذا الدليل.

- -

تنطبق الجوانب اللغوية لهذا الدليل في المقام الأول على وثائق باللغة الإنجليزية. لغات أخرى قد يكون (وأرحب لإنشاء) دلائل الاسلوب. يجب نشرها كصفحات فرعية لصفحة فريق التعريب.

- -

بالنسبة لمعايير الأنماط التي تنطبق على المحتوى المكتوب لمواقع أخرى غير MDN ، يرجى الرجوع إلى دليل أسلوب One Mozilla.

- - - -

المبادئ

- -

أفضل مكان للبدء به في أي دليل واسع النطاق للنشر هو مع بعض معايير النصوص الأساسية للمساعدة في الحفاظ على ثبات الوثائق. توضح الأقسام التالية بعضًا من هذه الأساسيات لمساعدتك.

- -

عنوان الصفحة

- -

يتم استخدام عناوين الصفحات في نتائج البحث وتستخدم أيضًا لترتيب التسلسل الهرمي للصفحة في قائمة مسارات التنقل أعلى الصفحة. يمكن أن يكون عنوان الصفحة (الذي يتم عرضه في أعلى الصفحة وفي نتائج البحث) مختلفًا عن الصفحة "slug" ، وهو جزء من عنوان URL الخاص بالصفحة بعد "<locale> / docs /".

- -

العنوان ورسملة العنوان

- -

يجب أن تستخدم عناوين الصفحات وعناوين الأقسام طريقة الكتابة بالأحرف الكبيرة على شكل الجملة (لا تستخدم سوى الأحرف الكبيرة في الكلمة الأولى والأسماء المناسبة) بدلاً من الكتابة بالأحرف الكبيرة على نمط العنوان:

- -
    -
  • الصواب: "A new method for creating JavaScript rollovers"
  • -
  • الخطأ: "A New Method for Creating JavaScript Rollovers"
  • -
- -

We have many older pages that were written before this style rule was established. Feel free to update them as needed if you like. We're gradually getting to them.

- -

Choosing titles and slugs

- -

Page slugs should be kept short; when creating a new level of hierarchy, the new level's component in the slug should just be a word or two.

- -

Page titles, on the other hand, may be as long as you like, within reason, and they should be descriptive.

- -

Creating new subtrees

- -

When you need to add some articles about a topic or subject area, you will typically do so by creating a landing page, then adding subpages for each of the individual articles. The landing page should open with a paragraph or two describing the topic or technology, then provide a list of the subpages with descriptions of each page. You can automate the insertion of pages into the list using some macros we've created.

- -

For example, consider the JavaScript guide, which is structured as follows:

- - - -

Try to avoid putting your article at the top of the hierarchy, which slows the site down and makes search and site navigation less effective.

- -

General article content guidelines

- -

When writing any document, it's important to know how much to say. If you ramble on too long, the article becomes tedious to read and nobody will use it. Getting the amount of coverage right is important for several reasons. Among those reasons: to ensure that the reader finds the information they truly need, and to provide enough quality material for search engines to adequately analyze and rank the article. We'll discuss the former (providing the information the reader may need) here. To learn a little about ensuring that pages are properly classified and ranked by search engines, see the article How to write for SEO on MDN.

- -

The goal is to write pages that include all the information that readers may need without going on too long about it all. We have a few recommendations in this area.

- -

Consider your audience

- -

Keep in mind that these are guidelines. Some of these tips may not apply in every case. Certainly keep your article's audience in mind. An article on advanced network techniques likely doesn't need to go into as much detail about basic networking concepts as the typical article on networking code, for instance.

- -

Provide a useful summary

- -

Make sure the article's summary—that is, the opening paragraph or paragraphs before the first heading—provides enough information for the reader to understand if the article is likely to be covering what they're interested in reading about. In guide or tutorial content, the summary should let the reader know what topics will be covered and what they're already expected to know, if anything. It should mention the technology, technologies, and/or APIs that are being documented or discussed, with links to those, and it should offer hints as to the situations in which the article's contents might be useful.

- -
Example: Too short!
- -

This example of a summary is far too short. It leaves out too much information, such as what it means exactly to "stroke" text, where the text is drawn, and so forth.

- -
-

CanvasRenderingContext2D.strokeText() draws a string.

-
- -
Example: Too long!
- -

Here, we've updated the summary, but now it's far too long. Too much detail is included, and the text gets far too much into other methods and properties. Instead, the summary should focus on the strokeText() method, and should refer to the appropriate guide where the other details are offered.

- -
-

When called, the Canvas 2D API method CanvasRenderingContext2D.strokeText() strokes the characters in the specified string beginning at the coordinates specified, using the current pen color. In the terminology of computer graphics, "stroking" text means to draw the outlines of the glyphs in the string without filling in the contents of each character with color.

- -

The text is drawn using the context's current font as specified in the context's {{domxref("CanvasRenderingContext2D.font", "font")}} property.

- -

The placement of the text relative to the specified coordinates are determined by the context's textAlign, textBaseline, and direction properties. textAlign controls the placement of the string relative to the X coordinate specified; if the value is "center", then the string is drawn starting at x - (stringWidth / 2), placing the specified X-coordinate in the middle of the string. If the value is "left", the string is drawn starting at the specified value of x. And if textAlign is "right", the text is drawn such that it ends at the specified X-coordinate.

- -

(etc etc etc...)

- -

You can, optionally, provide a fourth parameter that lets you specify a maximum width for the string, in pixels. If you provide this parameter, the text is compressed horizontally or scaled (or otherwise adjusted) to fit inside a space that wide when being drawn.

- -

You can call the fillText() method to draw a string's characters as filled with color instead of only drawing the outlines of the characters.

-
- -
Example: Much better!
- -

Here we see a much better overview for the strokeText() method.

- -
-

The {{domxref("CanvasRenderingContext2D")}} method strokeText(), part of the Canvas 2D API, strokes—that is, draws the outlines of—the characters of a specified string, anchored at the position indicated by the given X and Y coordinates. The text is drawn using the context's current {{domxref("CanvasRenderingContext2D.font", "font")}}, and is justified and aligned according to the {{domxref("CanvasRenderingContext2D.textAlign", "textAlign")}}, {{domxref("CanvasRenderingContext2D.textBaseline", "textBaseline")}}, and {{domxref("CanvasRenderingContext2D.direction", "direction")}} properties.

- -

For more details and further examples, see {{SectionOnPage("/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Drawing_graphics", "Text")}} in the Learning Area as well as our main article on the subject, Drawing text.

-
- -

Include all relevant examples

- -

More pages should have examples than should not have them. The majority of pages most likely deserve multiple examples, in fact. It's important to ensure that you use examples to clarify what every parameter is used for, and to clarify any edge cases that may exist. You should also use examples to demonstrate solutions for common tasks, and you should use examples to demonstrate solutions to problems that may arise.

- -

Each example should be preceded by text explaining what the example does and anything the reader should know before beginning to read or try out the example.

- -

In addition, each piece of code should include an explanation of how it works. Keep in mind that it may make sense to break up a large piece of code into smaller portions so they can be described individually. The text following each piece of code should explain anything relevant, using an appropriate level of detail. If the code is very simple and doesn't really feature anything directly related to the API being documented, you may only give a quick summary of what it is and why it's there. If the code is intricate, uses the API being documented, or is technically creative, you should provide a more detailed explanation.

- -

When using the live sample system, it's helpful to be aware that all of the {{HTMLElement("pre")}} blocks in the area that contains the sample are concatenated together before running the example, which lets you break any or all of the HTML, CSS, and JavaScript into multiple segments, each optionally with its own descriptions, headings, and so forth. This makes documenting code incredibly powerful and flexible.

- -

Overly-short articles are hard to find

- -

If an article is "thin"—that is, too short—it may not be indexed properly (or at all) by search engines. As a rule of thumb, the article's body text should be at least 250-300 words. Don't artificially inflate a page that can't reasonably be expanded, but treat this guideline as a minimum target length when possible.

- -

Sections, paragraphs, and newlines

- -

Use heading levels in decreasing order: {{HTMLElement("h2")}} then {{HTMLElement("h3")}} then {{HTMLElement("h4")}}, without skipping levels. H2 is the highest level allowed because H1 is reserved for the page title. If you need more than three or four levels of headers you should consider breaking up the article into several smaller articles with a landing page, linking them together using the {{TemplateLink("Next")}}, {{TemplateLink("Previous")}}, and {{TemplateLink("PreviousNext")}} macros.

- -

The Enter (or Return) key on your keyboard starts a new paragraph. To insert a newline without a space, hold down the Shift key while pressing Enter.

- -

Don't create single subsections — you don't subdivide a topic into one. It's either two subheadings or more, or none at all.

- -

Don't have bumping heads, which are headings followed immediately by headings. Aside from looking horrible, it's helpful to readers if every heading has at least a brief intro after it to introduce the subsections beneath.

- -

Lists

- -

Lists should be formatted and structured uniformly across all contributions. Individual list items should be written with suitable punctuation, regardless of the list format. However, depending on the type of list you are creating, you will want to adjust your writing as described in the sections below.

- -

Bulleted Lists

- -

Bulleted lists should be used to group related pieces of concise information. Each item in the list should follow a similar sentence structure. Phrases and sentences in bulleted lists should include standard punctuation. Periods must appear at the end of each sentence in a bulleted list, including the item's final sentence, just as would be expected in a paragraph.

- -

An example of a correctly structured bulleted list:

- -
-

In this example we should include:

- -
    -
  • A condition, with a brief explanation.
  • -
  • A similar condition, with a brief explanation.
  • -
  • Yet another condition, with some further explanation.
  • -
-
- -

Note how the same sentence structure repeats from bullet to bullet. In this example, each bullet point states a condition followed by a comma and a brief explanation, and each item in the list ends with a period.

- -

Numbered Lists

- -

Numbered lists are used primarily to enumerate steps in a set of instructions. Because instructions can be complex, clarity is a priority, especially if the text in each list item is lengthy. As with bulleted lists, follow standard punctuation usage.

- -

An example of a correctly structured numbered list:

- -
-

In order to correctly structure a numbered list, you should:

- -
    -
  1. Open with a heading or brief paragraph to introduce the instructions. It's important to provide the user with context before beginning the instructions.
  2. -
  3. Start creating your instructions, and keep each step in its own numbered item. Your instructions may be quite extensive, so it is important to write clearly and use correct punctuation.
  4. -
  5. After you have finished your instructions, close off the numbered list with a brief summary or explanation of the expected outcome upon completion.
  6. -
- -

This is an example of writing a closing explanation. We have created a short numbered list that provides instructive steps to produce a numbered list with the correct formatting.

-
- -

Note how the items in numbered lists read like short paragraphs. Because numbered lists are routinely used for instructional purposes, or to walk someone through an orderly procedure, be sure to keep each item focused: one item per number or step.

- -

Text formatting and styles

- -

Use the "Formatting Styles" drop-down list to apply predefined styles to selected content.

- -
The "Note" style is used to call out important notes, like this one.
- -
Similarly, the "Warning" style creates warning boxes like this.
- -

Unless specifically instructed to do so, do not use the HTML style attribute to manually style content. If you can't do it using a predefined class, drop into {{IRCLink("mdn")}} and ask for help.

- -

Code sample style and formatting

- -
-

Note: This section deals with the styling/formatting of code as it appears on an MDN article. If you want guidelines on actually writing code examples, see our Code sample guidelines.

-
- -

Tabs and line breaks

- -

Use two spaces per tab in all code examples. Indent the code cleanly, with open-brace ("{") characters on the same line as the statement that opens the block. For example:

- -
if (condition) {
-  /* handle the condition */
-} else {
-  /* handle the "else" case */
-}
-
- -

Long lines shouldn't be allowed to stretch off horizontally to the extent that they require horizontal scrolling to read. Instead, break at natural breaking points. Some examples follow:

- -
if (class.CONDITION || class.OTHER_CONDITION || class.SOME_OTHER_CONDITION
-       || class.YET_ANOTHER_CONDITION ) {
-  /* something */
-}
-
-var toolkitProfileService = Components.classes["@mozilla.org/toolkit/profile-service;1"]
-                           .createInstance(Components.interfaces.nsIToolkitProfileService);
-
- -

Inline code formatting

- -

Use the "Code" button (labeled with two angle brackets "<>") to apply inline code-style formatting to function names, variable names, and method names (this uses the {{HTMLElement("code")}} element). For example, "the frenchText() function".

- -

Method names should be followed by a pair of parentheses: doSomethingUseful(). The parentheses help differentiate methods from other code terms.

- -

Syntax highlighting

- -

Screenshot of the 'Syntax Highlighter' menu.Entire lines (or multiple lines) of code should be formatted using syntax highlighting rather than the {{HTMLElement("code")}} element. Select the appropriate language from the language list button (the one with the two code blocks), as seen in the screenshot to the right. This will insert a preformatted code box with line numbers and syntax highlighting for the chosen language.

- -

The following example shows text with JavaScript formatting:

- -
-
for (var i = 0, j = 9; i <= 9; i++, j--)
-  document.writeln("a[" + i + "][" + j + "]= " + a[i][j]);
-
- -

If no appropriate language is available, use ("No Highlight" in the language menu). This will result in code without syntax highlighting:

- -
x = 42;
- -

Syntax definitions

- -

If you want to insert a syntax definition, you can choose the "Syntax Box" option from the "Styles" drop-down menu in the editor toolbar. This will give the syntax definition a special formatting distinguishing it from normal code.

- -

Blocks not referring to code

- -

There are a few use cases where a <pre> block does not refer to code and doesn't have syntax highlighting nor line numbers. In such cases you should add a <pre> without class. Those cases include things like tree structures:

- -
root/
-
-    folder1/
-        file1
-
-    folder2/
-        file2
-        file3
-
- -

To create preformatted content without syntax highlighting and line numbers click the "pre" button in the toolbar. Then start to type the text.

- -

Styling HTML element references

- -

There are specific rules to follow when writing about HTML elements. These rules produce consistent descriptions of elements and their components. They also ensure correct linking to detailed documentation.

- -
-
Element names
-
Use the {{TemplateLink("HTMLElement")}} macro, which creates a link to the page for that element. For example, writing \{{HTMLElement("title")}} produces "{{HTMLElement("title")}}". If you don't want to create a link, enclose the name in angle brackets and use "Code (inline)" style (e.g., <title>).
-
Attribute names
-
Use bold face.
-
Attribute definitions
-
Use the {{TemplateLink("htmlattrdef")}} macro (e.g., \{{htmlattrdef("type")}}) for the definition term, so that it can be linked to from other pages, then use the {{TemplateLink("htmlattrxref")}} macro (e.g., \{{htmlattrxref("attr","element")}}) to reference attribute definitions.
-
Attribute values
-
Use "Code (inline)" style, and do not use quotation marks around strings, unless needed by the syntax of a code sample. For example: When the type attribute of an <input> element is set to email or tel ...
-
- -

Latin abbreviations

- -

In notes and parentheses

- -
    -
  • Common Latin abbreviations (etc., i.e., e.g.) may be used in parenthetical expressions and notes. Use periods in these abbreviations, followed by a comma or other appropriate punctuation. -
      -
    • Correct: Web browsers (e.g., Firefox) can be used ...
    • -
    • Incorrect: Web browsers e.g. Firefox can be used ...
    • -
    • Incorrect: Web browsers, e.g. Firefox, can be used ...
    • -
    • Incorrect: Web browsers, (eg: Firefox) can be used ...
    • -
    -
  • -
- -

In running text

- -
    -
  • In regular text (i.e., text outside of notes or parentheses), use the English equivalent of the abbreviation. -
      -
    • Correct: ... web browsers, and so on.
    • -
    • Incorrect: ... web browsers, etc.
    • -
    • Correct: Web browsers such as Firefox can be used ...
    • -
    • Incorrect: Web browsers e.g. Firefox can be used ...
    • -
    -
  • -
- -

Meanings and English equivalents of Latin abbreviations

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbbrevLatinEnglish
cf.confercompare
e.g.exempli gratiafor example
et al.et aliiand others
etc.et ceteraand so forth, and so on
i.e.id estthat is, in other words
N.B.nota benenote well
P.S.post scriptumpostscript
- -
-

Always consider whether it's truly beneficial to use a Latin abbreviation. Some of these are used so rarely that many readers won't understand the meaning, and others are often confused with one another. And be sure that you use them correctly, if you choose to do so. For example, be careful not to confuse "e.g." with "i.e.", which is a common error.

-
- -

Acronyms and abbreviations

- -

Capitalization and periods

- -

Use full capitals and delete periods in all acronyms and abbreviations, including organizations such as "US" and "UN".

- -
    -
  • Correct: XUL
  • -
  • Incorrect: X.U.L.; Xul
  • -
- -

Expansion

- -

On the first mention of a term on a page, expand acronyms likely to be unfamiliar to users. When in doubt, expand it, or, better, link it to the article or glossary entry describing the technology.

- -
    -
  • Correct: "XUL (XML User Interface Language) is Mozilla's XML-based language..."
  • -
  • Incorrect: "XUL is Mozilla's XML-based language..."
  • -
- -

Plurals of acronyms and abbreviations

- -

For plurals of acronyms or abbreviations, add s. Don't use an apostrophe. Ever. Please.

- -
    -
  • Correct: CD-ROMs
  • -
  • Incorrect: CD-ROM's
  • -
- -

"Versus", "vs.", and "v."

- -

The contraction "vs." is preferred.

- -
    -
  • Correct: this vs. that
  • -
  • Incorrect: this v. that
  • -
  • Incorrect: this versus that
  • -
- -

Capitalization

- -

Use standard English capitalization rules in body text, and capitalize "World Wide Web." It is acceptable to use lower case for "web" (used alone or as a modifier) and "internet;" this guideline is a change from a previous version of this guide, so you may find many instances of "Web" and "Internet" on MDN. Feel free to change these as you are making other changes, but editing an article just to change capitalization is not necessary.

- -

Keyboard keys should use sentence-style capitalization, not all-caps capitalization. For example, "Enter" not "ENTER."

- -

Contractions

- -

Our writing style tends to be casual, so you should feel free to use contractions (e.g., "don't", "can't", "shouldn't") if you prefer.

- -

Pluralization

- -

Use English-style plurals, not the Latin- or Greek-influenced forms.

- -
    -
  • Correct: syllabuses, octopuses
  • -
  • Incorrect: syllabi, octopi
  • -
- -

Hyphenation

- -

Hyphenate compounds when the last letter of the prefix is a vowel and is the same as the first letter of the root.

- -
    -
  • Correct: email, re-elect, co-op
  • -
  • Incorrect: e-mail, reelect, coop
  • -
- -

Gender-neutral language

- -

It is a good idea to use gender-neutral language in any writing where gender is irrelevant to the subject matter, to make the text as inclusive as possible. So for example, if you are talking about the actions of a specific man, usage of he/his would be fine, but if the subject is a person of either gender, he/his isn't appropriate.
-
- Let's take the following example:

- -
-

A confirmation dialog appears, asking the user if he allows the Web page to make use of his Web cam.

-
- -
-

A confirmation dialog appears, asking the user if she allows the Web page to make use of her Web cam.

-
- -

Both versions are gender-specific. To fix this, use gender-neutral pronouns:

- -
-

A confirmation dialog appears, asking the user if they allow the Web page to make use of their Web cam.

-
- -
-

MDN allows the use of this very common syntax (which is controversial among usage authorities), to make up for the lack of a neutral gender in English. The use of the third-person plural as a gender neutral pronoun (that is, using "they," "them", "their," and "theirs") is an accepted practice, commonly known as "singular 'they.'"

-
- -

You can use both genders:

- -
-

A confirmation dialog appears, asking the user if he or she allows the web page to make use of his/her web cam.

-
- -

making the users plural:

- -
-

A confirmation dialog appears, asking the users if they allow the web page to make use of their web cams.

-
- -

The best solution, of course, is to rewrite and eliminate the pronouns:

- -
-

A confirmation dialog appears, requesting the user's permission for web cam access.

-
- -
-

A confirmation dialog box appears, which asks the user for permission to use the web cam.

-
- -

The last way of dealing with the problem is arguably better, as it is not only grammatically more correct but removes some of the complexity associated with dealing with genders across different languages that may have wildly varying gender rules. This solution can make translation easier for both readers and localizers.

- -

Numbers and numerals

- -

Dates

- -

For dates (not including dates in code samples) use the format "January 1, 1990".

- -
    -
  • Correct: February 24, 2006
  • -
  • Incorrect: February 24th, 2006; 24 February, 2006; 24/02/2006
  • -
- -

Alternately, you can use the YYYY/MM/DD format.

- -
    -
  • Correct: 2006/02/24
  • -
  • Incorrect: 02/24/2006; 24/02/2006; 02/24/06
  • -
- -

Decades

- -

For decades, use the format "1990s". Don't use an apostrophe.

- -
    -
  • Correct: 1990s
  • -
  • Incorrect: 1990's
  • -
- -

Plurals of numerals

- -

For plurals of numerals add "s". Don't use an apostrophe.

- -
    -
  • Correct: 486s
  • -
  • Incorrect: 486's
  • -
- -

Commas

- -

In running text, use commas only in five-digit and larger numbers.

- -
    -
  • Correct: 4000; 54,000
  • -
  • Incorrect: 4,000; 54000
  • -
- -

Punctuation

- -

Serial comma

- -

Use the serial comma. The serial (also known as "Oxford") comma is the comma that appears before the conjunction in a series of three or more items.

- -
    -
  • Correct: I will travel on trains, planes, and automobiles.
  • -
  • Incorrect: I will travel on trains, planes and automobiles.
  • -
- -
-

This is in contrast to the One Mozilla style guide, which specifies that the serial comma is not to be used. MDN is an exception to this rule.

-
- -

Apostrophes and quotation marks

- -

Do not use "curly" quotes and quotation marks. On MDN, we only use straight quotes and apostrophes. There are a couple of reasons for this. First, because we need to choose one or the other for consistency, and second, because if curly quotes or apostrophes make their way into code snippets (even inline ones), readers may copy and paste them and expect them to function, which they will not.

- -
    -
  • Correct: Please don't use "curly quotes."
  • -
  • Incorrect: Please don‘t use “curly quotes.”
  • -
- -

Spelling

- -

For words with variant spellings, always use their American English spelling. In general, use the first entry at Dictionary.com, unless that entry is listed as a variant spelling or as being primarily used in a non-American form of English; for example, if you look up "behaviour", you find the phrase "Chiefly British" followed by a link to the American standard form, "behavior". Do not use variant spellings.

- -
    -
  • Correct: localize, behavior
  • -
  • Incorrect: localise, behaviour
  • -
- -

Terminology

- -
-
- -

HTML elements

- -

Use "elements" to refer to HTML and XML elements, rather than "tags". In addition, they should almost always be wrapped in "<>", and should be in the {{HTMLElement("code")}} style. When you reference a given element for the first time in a section, you should use the {{TemplateLink("HTMLElement")}} macro to create a link to the documentation for the element (unless you're writing within that element's reference document page).

- -
    -
  • Correct: the {{HTMLElement("span")}} element
  • -
  • Incorrect: the span tag
  • -
- -

Parameters vs. arguments

- -

The preferred term on MDN is parameters. Please avoid the term "arguments" for consistency if at all possible.

- -

User interface actions

- -

In task sequences, describe user interface actions using the imperative mood. Identify the user interface element by its label and type.

- -
    -
  • Correct: Click the Edit button.
  • -
  • Incorrect: Click Edit.
  • -
- -

Voice

- -

While the active voice is preferred, the passive voice is also acceptable, given the informal feel of our content. Try to be consistent, though.

- -

Wiki markup and usage

- - - -

Links are a large part of what makes a wiki a powerful learning and teaching tool. Below you'll find some basic information, but you can find a complete guide to creating and editing links on MDN in our editor guide.

- -

We encourage you to create appropriate links among articles; they help improve navigation and discoverability of content, and they provide important context to search engines like Google to help them provide better results. Every page should have a good set of links from words or phrases to other pages that expand upon the relevant ideas. This can be used both to define terms and to provide more in-depth or detailed documentation about a topic, or to connect to a related page that offers examples or information that may be of further interest.

- -

You can easily create links not only among pages on MDN (internal links) but also to pages outside MDN (external links).

- -

There are two ways to create links: you explicitly create a link using the Link button in the editor's toolbar—or by pressing Ctrl+K (Cmd-K on the Mac)—or you can use MDN's powerful macro system to generate links automatically or based on an input value.

- -

When deciding what text to use as a link, there are a few guidelines you can follow:

- -
    -
  • Whenever a macro exists which will create the link you need, and you are able to do so, please do. Using macros to create links will not only help you get it right, but will allow future improvements to MDN to automatically be applied to your link.
  • -
  • For an API name, use the entire string of the API term as written in your content. The easiest way to do this is to use the appropriate macro to construct a properly-formatted link for you.
  • -
  • For a term for which you're linking to a page defining or discussing that term, use the name of the term and no additional text as the link's text. For example: -
      -
    • Correct: You can use JavaScript code to create dynamic applications on the Web.
    • -
    • Incorrect: You can use JavaScript code to create dynamic applications on the Web.
    • -
    -
  • -
  • Otherwise, when adding a useful link to prose, try to choose an action and object phrase, such as: - -
  • -
- -

URL schemes

- -

For security reasons, you should only create links that use the following schemes:

- -
    -
  • http://
  • -
  • https://
  • -
  • ftp://
  • -
  • mailto:
  • -
- -

Others may or may not work, but are not supported and will probably be removed by editorial staff.

- -
-

In particular, be sure not to use the about: or chrome:// schemes, as they will not work. Similarly, the javascript: scheme is blocked by most modern browsers, as is jar:.

-
- -

Page tags

- -

Tags provide meta information about a page and/or indicate that a page has specific improvements needed to its content. Every page in the wiki should have tags. You can find details on tagging in our How to properly tag pages guide.

- -

The tagging interface lives at the bottom of a page while you're in edit mode, and looks something like this:

- -

Screenshot of the UX for adding and removing tags on MDN

- -

To add a tag, click in the edit box at the end of the tag list and type the tag name you wish to add. Tags will autocomplete as you type. Press enter (or return) to submit the new tag. Each article may have as many tags as needed. For example, an article about using JavaScript in AJAX programming might have both "JavaScript" and "AJAX" as tags.

- -

To remove a tag, just click the little "X" icon in the tag.

- -

Tagging pages that need work

- -

In addition to using tags to track information about the documentation's quality and content, we also use them to mark articles as needing specific types of work.

- -

Tagging obsolete pages

- -

Use the following tags for pages that are not current:

- -
    -
  • Junk: Use for spam, pages created by mistake, or content that is so bad that it should be deleted. Pages with this tag are deleted from time to time.
  • -
  • Obsolete: Use for content that is technically superseded, but still valid in context. For example an HTML element that is obsolete in HTML5 is still valid in HTML 4.01. You can also use the {{TemplateLink("obsolete_header")}} macro to put a prominent banner on the topic.
  • -
  • Archive: Use for content that is technically superseded and no longer useful. If possible, add a note to the topic referring readers to a more current topic. For example, a page that describes how to use the Mozilla CVS repository should refer readers to a current topic on using Mercurial repos. (If no corresponding current topic exists, use the NeedsUpdate tag, and add an explanation on the Talk page.) Pages with the Archive tag are eventually moved from the main content of MDN to the Archive section.
  • -
- -

SEO summary

- -

The SEO summary provides a short description of a page. It will be reported as a summary of the article to robots crawling the site, and will then appear in search results for the page. It is also used by macros that automate the construction of landing pages inside MDN itself.

- -

By default, the first paragraph of the page is used as the SEO summary. However, you can override this behavior by marking a section with the "SEO summary" style in the WYSIWYG editor.

- -

Landing pages

- -

Landing pages are pages at the root of a topic area of the site, such as the main CSS or HTML pages. They have a standard format that consists of three areas:

- -
    -
  1. A brief (typically one paragraph) overview of what the technology is and how it's used. See {{anch("Writing a landing page overview")}} for tips.
  2. -
  3. A two-column list of links with appropriate headings. See {{anch("Creating a page link list")}} for guidelines.
  4. -
  5. An optional "Browser compatibility" section at the bottom of the page.
  6. -
- - - -

The link list section of an MDN landing page consists of two columns. These are created using the following HTML:

- -
<div class="row topicpage-table">
-  <div class="section">
-    ... left column contents ...
-  </div>
-  <div class="section">
-    ... right column contents ...
-  </div>
-</div>
- -

The left column should be a list of articles, with an <h2> header at the top of the left column explaining that it's a list of articles about the topic (e.g., "Documentation and tutorials about foo"); this header should use the CSS class "Documentation". Below that is a <dl> list of articles with each article's link in a <dt> block and a brief one-or-two sentence summary of the article in the corresponding <dd> block.

- -

The right column should contain one or more of the following sections, in order:

- -
-
Getting help from the community
-
This should provide information on Matrix chat roomsand mailing lists available on the topic. The heading should use the class "Community".
-
Tools
-
A list of tools the user can look at to help with the use of the technology described in this section of MDN. The heading should use the class "Tools".
-
Related topics
-
A list of links to landing pages for other, related, technologies of relevance. The heading should use the class "Related_Topics".
-
- -

<<<finish this once we finalize the landing page standards>>>

- -

Using, inserting images

- -

It's sometimes helpful to provide an image in an article you create or modify, especially if the article is very technical. To include an image:

- -
    -
  1. Attach the desired image file to the article (at the bottom of every article in edit mode)
  2. -
  3. Create an image in the WYSIWYG editor
  4. -
  5. In the WYSIWYG editor, in the drop-down list of attachments, select the newly created attachment that is your image
  6. -
  7. Press OK.
  8. -
- -

Other references

- -

Preferred style guides

- -

If you have questions about usage and style not covered here, we recommend referring to the Economist style guide or, failing that, the Chicago Manual of Style.

- -

Preferred dictionary

- -

For questions of spelling, please refer to Dictionary.com. The spelling checker for this site uses American English. Please do not use variant spellings (e.g., use color rather than colour).

- -

We will be expanding the guide over time, so if you have specific questions that aren't covered in this document, please post them on the MDN discussion forum, so we know what should be added.

- -

MDN-specific

- - - -

Language, grammar, spelling

- -

If you're interested in improving your writing and editing skills, you may find the following resources to be helpful.

- - diff --git a/files/ar/mdn/index.html b/files/ar/mdn/index.html deleted file mode 100644 index 351c99c218..0000000000 --- a/files/ar/mdn/index.html +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: مشروع شبكة مطوري موزيلا -slug: MDN -tags: - - صفحة هبوط - - معلومات عن الشبكة -translation_of: MDN ---- -
{{MDNSidebar}}
- -

شبكة مطوري موزيلا (MDN) هي موسوعة نقوم فيها بتوثيق كل ما يخص الأنترنت المفتوح، التقنيات، وغيرها من الموضوعات التي تخص المطورين. أي شخص مرحب به لإضافة وتحرير المحتوى. تجدر الإشارة إلى أنك لست بحاجة إلى أن تكون مبرمجا أو أن تعرف الكثير عن التكنولوجيا؛ حيث أن هناك العديد من المهام المختلفة التي يمكنك القيام بها، من البسيط (مراجعة وتصحيح الأخطاء الإملائية) إلى المتقدم (كتابة وثائق حول الواجهات البرمجية).

- -

هدف مشروع MDN هو توثيق الويب الحر، تكنولوجيات موزيلا وكذا مشاريعها. ندعوك لمساعدتنا في ذلك!

- -

نحن في حاجة إلى مساعدتك! إن الأمر بسيط. ولا تقلق حيال طلب الإذن أو إرتكاب الأخطاء. من جهة أخرى، ندعوك للتعرف على مجتمع شبكة مطوري موزيلا، فنحن هنا لمساعدتك! التوثيق أسفله سوف يساعدك على الانطلاق

- -
    -
  • بداية سريعة للوافدين الجدد - -

    هل أنت جديد على شبكة مطوري موزيلا وتود تعلم كيفية جعلها أفضل؟ إذن إبدأ من هنا

    -
  • -
  • أنا مستخدم متمرس -

    أدخل إلى دليلنا الشامل والمعمق لمساهمي شبكة مطوري موزيلا لتعلم المزيد

    -
  • -
  • أخبر الباقي عنا -

    إذا كنت تحب شبكة مطوري موزيلا، ساعد إذن على إخبار الناس عنها! يمكنك إيجاد كل مايمكنه مساعدتك على ذلك من أدوات وإرشادات

    -
  • -
diff --git a/files/ar/mdn/tools/index.html b/files/ar/mdn/tools/index.html deleted file mode 100644 index 179ed3a070..0000000000 --- a/files/ar/mdn/tools/index.html +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: MDN tools -slug: MDN/Tools -tags: - - Landing - - MDN Meta -translation_of: MDN/Tools ---- -
{{MDNSidebar}}
- -
{{IncludeSubnav("/ar/docs/MDN")}}
- -

MDN offers a number of features that make it easier to track progress, manage content, and keep up with the latest changes to the site.

- -
{{LandingPageListSubpages}}
diff --git a/files/ar/mdn/yari/index.html b/files/ar/mdn/yari/index.html deleted file mode 100644 index 4f62570731..0000000000 --- a/files/ar/mdn/yari/index.html +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: برمجية الموسوعة كوما -slug: MDN/Yari -tags: - - صفحة هبوط - - معلومات عن الشبكة -translation_of: MDN/Kuma -original_slug: MDN/Kuma ---- -
{{MDNSidebar}}
- -
{{IncludeSubnav("/ar/docs/MDN")}}
- -

كوما (Kuma) هي برمجيّة موسوعة مبنيّة باستخدام جانغو، وهي البرمجيّة التي تعتمد عليها شبكة مطوري موزيلا في عملها.

- -

{{SubpagesWithSummaries}}

- -

شارك بتطوير المنصة

- -

للمشاركة في تطوير كوما:

- - diff --git a/files/ar/mozilla/add-ons/index.html b/files/ar/mozilla/add-ons/index.html deleted file mode 100644 index 3e0a66abdb..0000000000 --- a/files/ar/mozilla/add-ons/index.html +++ /dev/null @@ -1,92 +0,0 @@ ---- -title: Add-ons -slug: Mozilla/Add-ons -tags: - - Add-ons - - NeedsTranslation - - TopicStub -translation_of: Mozilla/Add-ons ---- -
تعديل وتوسيع تطبيقات موزيلا
- -

تضيف الإضافات وظائف جديدة إلى تطبيقات Gecko- based مثل Firefox و SeaMonkey و Thunderbird. هناك نوعان رئيسيان من الوظائف الإضافية: الإضافات تضيف ميزات جديدة إلى التطبيق ، بينما تقوم السمات بتعديل واجهة المستخدم الخاصة بالتطبيق.

- -

بالنسبة إلى كل من الإضافات والمظاهر ، تشغل Mozilla مستودعًا في addons.mozilla.org ، والمعروف أيضًا باسم AMO. عند إرسال إضافات إلى AMO يتم مراجعتها ، وبعد اجتياز المراجعة يتم إتاحتها للمستخدمين. لا يتعين عليك تقديم إضافات إلى AMO ، ولكن إذا قمت بذلك ، يمكن للمستخدمين الوثوق في حقيقة أنهم قد تمت مراجعتهم ، ويمكنك الاستفادة من رؤية AMO كمصدر للوظائف الإضافية المفيدة.

- -

يمكن أن تؤثر الإضافات بشكل كبير على سلوك التطبيق الذي يستضيفها. لقد طورنا مجموعة من الإرشادات للمساعدة في ضمان تقديم تجربة جيدة للمستخدمين. تنطبق هذه الإرشادات على جميع أنواع الإضافات ، سواء تم استضافتها على addons.mozilla.org أم لا.

- -
-

ملحقات

- -

تضيف الإضافات وظائف جديدة إلى تطبيقات Mozilla مثل Firefox و Thunderbird. يمكنهم إضافة ميزات جديدة إلى المتصفح ، مثل طريقة مختلفة لإدارة علامات التبويب ، ويمكنهم تعديل محتوى الويب لتحسين إمكانية الاستخدام أو الأمان لمواقع ويب معينة.

- -

هناك ثلاثة أساليب مختلفة يمكنك استخدامها لإنشاء إضافات: الإضافات المستندة إلى SDK الإضافي ، وإضافات غير قابلة لإعادة التشغيل يدويًا ، وإضافات التراكب.

- - - -

إذا استطعت ، فمن المستحسن استخدام أداة إضافة SDK الإضافية ، التي تستخدم آلية الإضافة دون إعادة التشغيل ، ولكن تبسط بعض المهام وتنظفها بعد نفسها. إذا لم تكن حزمة إضافة SDK كافية لاحتياجاتك ، فقم بتطبيق ملحق إعادة التشغيل يدويًا بدلاً من ذلك.

- -

لمزيد من المعلومات حول اختيار التقنية المستخدمة ، اقرأ هذه المقارنة .

- -
-
-

الممارسات الجيدة

- -

بغض النظر عن كيفية تطوير إضافة ، هناك بعض الإرشادات التي يمكنك اتباعها للمساعدة في التأكد من أن الإضافة توفر تجربة مستخدم جيدة قدر الإمكان.

- -
-
Performance
-
Ensuring your extension is fast, responsive and memory-efficient.
-
Security
-
Ensuring your extension doesn't expose the user to malicious websites.
-
Etiquette
-
Ensuring your extension plays nicely with other extensions.
-
-
- -
-

Application-specific

- -

Most of the documentation assumes you're developing for Firefox Desktop. If you're developing for some other Gecko-based application, there are major differences you need to know about.

- -
-
Thunderbird
-
Developing extensions for the Thunderbird mail client.
-
Firefox for Android
-
Developing extensions for Firefox for Android.
-
SeaMonkey
-
Developing extensions for the SeaMonkey software suite.
-
-
-
- -
-

Themes

- -

Themes are add-ons that customize the application's user interface. There are two sorts of themes: lightweight themes and complete themes.

- -
-
-

Lightweight themes are much simpler to implement than complete themes, but provide very limited customization.

-
- -
-

With complete themes you can make much deeper modifications to the application UI. The documentation for complete themes is out of date, but is linked to here as a possible basis for updated documentation.

-
-
- -
-

Other types of add-ons

- -

Search engine plugins are a simple and very specific type of add-on: they add new search engines to the browser's search bar.

- -

Plugins help the application understand web content that it does not natively support. NPAPI plugins are a legacy technology and new sites should not use them. In general, plugins are not available on most modern mobile systems including, and websites should transition away from using plugins.

- -

{{AddonSidebar}}

diff --git a/files/ar/mozilla/add-ons/webextensions/api/browsingdata/index.html b/files/ar/mozilla/add-ons/webextensions/api/browsingdata/index.html deleted file mode 100644 index 2ef0a4433f..0000000000 --- a/files/ar/mozilla/add-ons/webextensions/api/browsingdata/index.html +++ /dev/null @@ -1,122 +0,0 @@ ---- -title: browsingData -slug: Mozilla/Add-ons/WebExtensions/API/browsingData -translation_of: Mozilla/Add-ons/WebExtensions/API/browsingData ---- -

- -

{{AddonSidebar}}

- -

Enables extensions to clear the data that is accumulated while the user is browsing.

- -

In the browsingData API, browsing data is divided into types:

- -
    -
  • browser cache
  • -
  • cookies
  • -
  • downloads
  • -
  • history
  • -
  • local storage
  • -
  • plugin data
  • -
  • saved form data
  • -
  • saved passwords
  • -
- -

You can use the {{WebExtAPIRef("browsingData.remove()")}} function to remove any combination of these types. There are also dedicated functions to remove each particular type of data, such as {{WebExtAPIRef("browsingData.removePasswords()", "removePasswords()")}}, {{WebExtAPIRef("browsingData.removeHistory()", "removeHistory()")}} and so on.

- -

All the browsingData.remove[X]() functions take a {{WebExtAPIRef("browsingData.RemovalOptions")}} object, which you can use to control two further aspects of data removal:

- -
    -
  • how far back in time to remove data
  • -
  • whether to remove data only from normal web pages, or also from hosted web apps and add-ons. Note that this option is not yet supported in Firefox.
  • -
- -

Finally, this API gives you a {{WebExtAPIRef("browsingData.settings()")}} function that gives you the current value of the settings for the browser's built-in "Clear History" feature.

- -

To use this API you must have the "browsingData" API permission.

- -

Types

- -
-
{{WebExtAPIRef("browsingData.DataTypeSet")}}
-
Object used to specify the type of data to remove: for example, history, downloads, passwords, and so on.
-
{{WebExtAPIRef("browsingData.RemovalOptions")}}
-
Object used to specify how far back in time to remove data, and whether to remove data added through normal web browsing, by hosted apps, or by add-ons.
-
- -

Methods

- -
-
{{WebExtAPIRef("browsingData.remove()")}}
-
Removes browsing data for the data types specified.
-
{{WebExtAPIRef("browsingData.removeCache()")}}
-
Clears the browser's cache.
-
{{WebExtAPIRef("browsingData.removeCookies()")}}
-
Removes cookies.
-
{{WebExtAPIRef("browsingData.removeDownloads()")}}
-
Removes the list of downloaded files.
-
{{WebExtAPIRef("browsingData.removeFormData()")}}
-
Clears saved form data.
-
{{WebExtAPIRef("browsingData.removeHistory()")}}
-
Clears the browser's history.
-
{{WebExtAPIRef("browsingData.removeLocalStorage()")}}
-
Clears any local storage created by websites.
-
{{WebExtAPIRef("browsingData.removePasswords()")}}
-
Clears saved passwords.
-
{{WebExtAPIRef("browsingData.removePluginData()")}}
-
Clears data associated with plugins.
-
{{WebExtAPIRef("browsingData.settings()")}}
-
Gets the current value of settings in the browser's "Clear History" feature.
-
- -

Browser compatibility

- - - -

{{Compat("webextensions.api.browsingData", 2)}}

- - - -

{{WebExtExamples("h2")}}

- -
Acknowledgements - -

This API is based on Chromium's chrome.browsingData API.

- -

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

-
- - diff --git a/files/ar/mozilla/add-ons/webextensions/api/contentscripts/index.html b/files/ar/mozilla/add-ons/webextensions/api/contentscripts/index.html deleted file mode 100644 index 16f7fa2fdf..0000000000 --- a/files/ar/mozilla/add-ons/webextensions/api/contentscripts/index.html +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: contentScripts -slug: Mozilla/Add-ons/WebExtensions/API/contentScripts -translation_of: Mozilla/Add-ons/WebExtensions/API/contentScripts ---- -
{{AddonSidebar}}
- -

Use this API to register content scripts. Registering a content script instructs the browser to insert the given content scripts into pages that match the given URL patterns.

- -

This API is very similar to the "content_scripts" manifest.json key, except that with  "content_scripts" , the set of content scripts and associated patterns is fixed at install time. With the contentScripts API, an extension can register and unregister scripts at runtime.

- -

To use the API, call {{WebExtAPIRef("contentScripts.register()")}} passing in an object defining the scripts to register, the URL patterns, and other options. This returns a Promise that is resolved with a {{WebExtAPIRef("contentScripts.RegisteredContentScript")}} object.

- -

The RegisteredContentScript object represents the scripts that were registered in the register() call. It defines an unregister() method that you can use to unregister the content scripts. Content scripts are also unregistered automatically when the page that created them is destroyed. For example, if they are registered from the background page they will be unregistered automatically when the background page is destroyed, and if they are registered from a sidebar or a popup, they will be unregistered automatically when the sidebar or popup is closed.

- -

There is no contentScripts API permission, but an extension must have the appropriate host permissions for any patterns it passes to register().

- -

Types

- -
-
{{WebExtAPIRef("contentScripts.RegisteredContentScript")}}
-
-

An object of this type is returned by the {{WebExtAPIRef("contentScripts.register()")}} function. It represents the content scripts that were registered by that call, and can be used to unregister the content script.

-
-
- -

Functions

- -
-
{{WebExtAPIRef("contentScripts.register()")}}
-
Registers the given content scripts.
-
- -

Browser compatibility

- -

{{Compat("webextensions.api.contentScripts", 10, 1)}}

- -

 {{WebExtExamples("h2")}}

diff --git a/files/ar/mozilla/add-ons/webextensions/api/index.html b/files/ar/mozilla/add-ons/webextensions/api/index.html deleted file mode 100644 index 955086de10..0000000000 --- a/files/ar/mozilla/add-ons/webextensions/api/index.html +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: JavaScript APIs -slug: Mozilla/Add-ons/WebExtensions/API -tags: - - NeedsTranslation - - TopicStub - - WebExtensions -translation_of: Mozilla/Add-ons/WebExtensions/API ---- -
{{AddonSidebar}}
- -
-

JavaScript APIs for WebExtensions can be used inside the extension's background scripts and in any other documents bundled with the extension, including browser action or page action popups, sidebars, options pages, or new tab pages. A few of these APIs can also be accessed by an extension's content scripts (see the list in the content script guide).

- -

To use the more powerful APIs you need to request permission in your extension's manifest.json.

- -

You can access the APIs using the browser namespace:

- -
function logTabs(tabs) {
-  console.log(tabs);
-}
-
-browser.tabs.query({currentWindow: true}, logTabs);
-
- -
-

Many of the APIs are asynchronous, returning a Promise:

- -
function logCookie(c) {
-  console.log(c);
-}
-
-function logError(e) {
-  console.error(e);
-}
-
-var setCookie = browser.cookies.set(
-  {url: "https://developer.mozilla.org/"}
-);
-setCookie.then(logCookie, logError);
-
- -
-

Note that this is different from Google Chrome's extension system, which uses the chrome namespace instead of browser, and which uses callbacks instead of promises for asynchronous functions. As a porting aid, the Firefox implementation of WebExtensions APIs supports chrome and callbacks as well as browser and promises. Mozilla has also written a polyfill which enables code that uses browser and promises to work unchanged in Chrome: https://github.com/mozilla/webextension-polyfill.

- -

Firefox also implements these APIs under the chrome namespace using callbacks. This allows code written for Chrome to run largely unchanged in Firefox for the APIs documented here.

- -

Microsoft Edge uses the browser namespace, but doesn't yet support promise-based asynchronous APIs. In Edge, for the time being, asynchronous APIs must use callbacks.

- -

Not all browsers support all the APIs: for the details, see Browser support for JavaScript APIs.

-
- -
{{SubpagesWithSummaries}}
diff --git a/files/ar/mozilla/add-ons/webextensions/index.html b/files/ar/mozilla/add-ons/webextensions/index.html deleted file mode 100644 index 387f9bf8ac..0000000000 --- a/files/ar/mozilla/add-ons/webextensions/index.html +++ /dev/null @@ -1,131 +0,0 @@ ---- -title: امتدادات المتصفح -slug: Mozilla/Add-ons/WebExtensions -tags: - - إضافات - - صفحة هبوط -translation_of: Mozilla/Add-ons/WebExtensions ---- -
-
{{AddonSidebar}}
- -

تستطيع الامتدادات (extensions) أن تزيد وتُعدِل من إمكانيّة المُتصفِح. امتدادات فايرفوكس مبنيّة بواسطة الواجهة البرمجيّة المسماة WebExtensions، وهي نظام عابر للمتصفحات (cross-browser) لتطوير الإضافات. يتوافق النظام إلى حدٍ كبير مع واجهة الإضافات البرمجيّة المدعومة بواسطة متصفخ جوجل كروم وأوبرا، كما يتوافق مع مسودة W3C المجتمعيّة. الإضافات المكتوبة لتلك المتصفحات ستعمل على فايرفوكس ومايكروسوفت أيدج في معظم الحالات بتغييرات طفيفة. الواجهة البرمجيّة متوافقة أيضاً مع فايرفوكس متعدد العمليات (multiprocess firefox).

- -

إذا كانت لديك أسئلة أو أفكار، أو تريد مساعدة في نقل إضافة قديمة وجعلها تستخدم الواجهة البرمجيّة الحديثة، يمكنك التواصل معنا عبر قائمة مطورين الإضافات البريديّة أو على قناة webextensions#.

- -
-
-

دليل البداية

- - - -

مفاهيم

- - - -

واجهة المستخدم

- - - -

مقالات "كيف تقوم بـ"

- - - -
    -
- -

الترحيل

- - - -

سير العمل مع فيرفوكس

- - -
- -
-

مراجع

- -

واجهات جافاسكربت البرمجيّة

- - - -
{{ ListSubpages ("/ar/Add-ons/WebExtensions/API") }}
- -

قيم ملف Manifest

- - - -
{{ ListSubpages ("/ar/Add-ons/WebExtensions/manifest.json") }}
-
-
-
diff --git a/files/ar/mozilla/add-ons/webextensions/manifest.json/content_scripts/index.html b/files/ar/mozilla/add-ons/webextensions/manifest.json/content_scripts/index.html deleted file mode 100644 index ac1c401c35..0000000000 --- a/files/ar/mozilla/add-ons/webextensions/manifest.json/content_scripts/index.html +++ /dev/null @@ -1,223 +0,0 @@ ---- -title: content_scripts -slug: Mozilla/Add-ons/WebExtensions/manifest.json/content_scripts -translation_of: Mozilla/Add-ons/WebExtensions/manifest.json/content_scripts ---- -
{{AddonSidebar}}
- - - - - - - - - - - - - - - - -
TypeArray
MandatoryNo
Example -
-"content_scripts": [
-  {
-    "matches": ["*://*.mozilla.org/*"],
-    "js": ["borderify.js"]
-  }
-]
-
- -

Instructs the browser to load content scripts into web pages whose URL matches a given pattern.

- -

This key is an array. Each item is an object which:

- -
    -
  • must contain a key named matches, that specifies the URL patterns to be matched in order for the scripts to be loaded
  • -
  • may contain keys named js and css, which list scripts to be loaded into matching pages
  • -
  • may contain a number of other properties that control finer aspects of how and when content scripts are loaded
  • -
- -

Details of all the keys you can include are given in the table below.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
all_framesBoolean -

true: inject the scripts specified in js and css into all frames matching the specified URL requirements, even if the frame is not the topmost frame in a tab. This does not inject into child frames where only their parent matches the URL requirements and the child frame does not match the URL requirements. The URL requirements are checked for each frame independently.

- -

false: inject only into frames matching the URL requirements which are the topmost frame in a tab.

- -

Defaults to false.

-
cssArray -

An array of paths, relative to manifest.json, referencing CSS files that will be injected into matching pages.

- -

Files are injected in the order given, and before the DOM is loaded.

-
exclude_globsArrayAn array of strings containing wildcards. See Matching URL patterns below.
exclude_matchesArrayAn array of match patterns. See Matching URL patterns below.
include_globsArrayAn array of strings containing wildcards. See Matching URL patterns below.
jsArray -

An array of paths, relative to the manifest.json file, referencing JavaScript files that will be injected into matching pages.

- -

Files are injected in the order given. This means that, for example, if you include jQuery here followed by another content script, like this:

- -
-"js": ["jquery.js", "my-content-script.js"]
- -

then "my-content-script.js" can use jQuery.

- -

Files are injected at the time specified by run_at.

-
match_about_blankBoolean -

Insert the content scripts into pages whose URL is "about:blank" or "about:srcdoc", if the URL of the page that opened or created this page matches the patterns specified in the rest of the content_scripts key.

- -

This is especially useful to run scripts in empty iframes , whose URL is "about:blank". To do this you should also set the all_frames key.

- -

For example, suppose you have a content_scripts key like this:

- -
-  "content_scripts": [
-    {
-      "js": ["my-script.js"],
-      "matches": ["https://example.org/"],
-      "match_about_blank": true,
-      "all_frames": true
-    }
-  ]
- -

If the user loads https://example.org/, and this page embeds an empty iframe, then "my-script.js" will be loaded into the iframe.

- -

match_about_blank is supported in Firefox from version 52. Note that in Firefox, content scripts won't be injected into empty iframes at "document_start" even if you specify that value in run_at.

-
matchesArray -

An array of match patterns. See Matching URL patterns below.

- -

This is the only mandatory key.

-
run_atString -

This option determines when the scripts specified in js are injected. You can supply one of three strings here, each of which identifies a state in the process of loading a document. The states directly correspond to {{domxref("Document/readyState", "Document.readyState")}}:

- -
    -
  • "document_start": corresponds to loading. The DOM is still loading.
  • -
  • "document_end": corresponds to interactive. The DOM has finished loading, but resources such as scripts and images may still be loading.
  • -
  • "document_idle": corresponds to complete. The document and all its resources have finished loading.
  • -
- -

The default value is "document_idle".

- -

In all cases, files in js are injected after files in css.

-
- -

Matching URL patterns

- -

The "content_scripts" key attaches content scripts to documents based on URL matching: if the document's URL matches the specification in the key, then the script will be attached. There are four properties inside "content_scripts" that you can use for this specification:

- - - -

To match one of these properties, a URL must match at least one of the items in its array. For example, given a property like:

- -
"matches": ["*://*.example.org/*", "*://*.example.com/*"]
- -

Both "http://example.org/" and "http://example.com/" will match.

- -

Since matches is the only mandatory key, the other three keys are use to limit further the URLs that match. To match the key as a whole, a URL must:

- -
    -
  1. match the matches property
  2. -
  3. AND match the include_globs property, if present
  4. -
  5. AND NOT match the exclude_matches property, if present
  6. -
  7. AND NOT match the exclude_globs property, if present
  8. -
- -

globs

- -

A glob is just a string that may contain wildcards. There are two types of wildcard, and you can combine them in the same glob:

- -
    -
  • "*" matches zero or more characters
  • -
  • "?" matches exactly one character.
  • -
- -

For example: "*na?i" would match "illuminati" and "annunaki", but not "sagnarelli".

- -

Example

- -
"content_scripts": [
-  {
-    "matches": ["*://*.mozilla.org/*"],
-    "js": ["borderify.js"]
-  }
-]
- -

This injects a single content script "borderify.js" into all pages under "mozilla.org" or any of its subdomains, whether served over HTTP or HTTPS.

- -
  "content_scripts": [
-    {
-      "exclude_matches": ["*://developer.mozilla.org/*"],
-      "matches": ["*://*.mozilla.org/*"],
-      "js": ["jquery.js", "borderify.js"]
-    }
-  ]
- -

This injects two content scripts into all pages under "mozilla.org" or any of its subdomains except "developer.mozilla.org", whether served over HTTP or HTTPS.

- -

The content scripts see the same view of the DOM and are injected in the order they appear in the array, so "borderify.js" can see global variables added by "jquery.js".

- -

Browser compatibility

- - - -

{{Compat("webextensions.manifest.content_scripts")}}

diff --git a/files/ar/mozilla/add-ons/webextensions/manifest.json/index.html b/files/ar/mozilla/add-ons/webextensions/manifest.json/index.html deleted file mode 100644 index 332566c368..0000000000 --- a/files/ar/mozilla/add-ons/webextensions/manifest.json/index.html +++ /dev/null @@ -1,109 +0,0 @@ ---- -title: manifest.json -slug: Mozilla/Add-ons/WebExtensions/manifest.json -tags: - - Add-ons - - Extensions - - NeedsTranslation - - TopicStub - - WebExtensions -translation_of: Mozilla/Add-ons/WebExtensions/manifest.json ---- -
{{AddonSidebar}}
- -

The manifest.json file is a JSON-formatted file, and is the only file that every extension using WebExtension APIs must contain.

- -

Using manifest.json, you specify basic metadata about your extension such as the name and version, and can also specify aspects of your extension's functionality, such as background scripts, content scripts, and browser actions.

- -

manifest.json keys are listed below:

- -
{{ ListSubpages ("/en-US/Add-ons/WebExtensions/manifest.json") }}
- -
 
- -

"manifest_version", "version", and "name" are the only mandatory keys. "default_locale" must be present if the "_locales" directory is present and must be absent otherwise. "applications" is not supported in Google Chrome, and is mandatory in Firefox before Firefox 48 and Firefox for Android.

- -

You can access your extension's manifest from the extension's JavaScript using the {{WebExtAPIRef("runtime.getManifest()")}} function:

- -
browser.runtime.getManifest().version;
- -

Browser compatibility

- -

{{Compat("webextensions.manifest")}}

- -

Example

- -

Quick syntax example for manifest.json:

- -
{
-  "applications": {
-    "gecko": {
-      "id": "addon@example.com",
-      "strict_min_version": "42.0"
-    }
-  },
-
-  "background": {
-    "scripts": ["jquery.js", "my-background.js"],
-    "page": "my-background.html"
-  },
-
-  "browser_action": {
-    "default_icon": {
-      "19": "button/geo-19.png",
-      "38": "button/geo-38.png"
-    },
-    "default_title": "Whereami?",
-    "default_popup": "popup/geo.html"
-  },
-
-  "commands": {
-    "toggle-feature": {
-      "suggested_key": {
-        "default": "Ctrl+Shift+Y",
-        "linux": "Ctrl+Shift+U"
-      },
-      "description": "Send a 'toggle-feature' event"
-    }
-  },
-
-  "content_security_policy": "script-src 'self' https://example.com; object-src 'self'",
-
-  "content_scripts": [
-    {
-      "exclude_matches": ["*://developer.mozilla.org/*"],
-      "matches": ["*://*.mozilla.org/*"],
-      "js": ["borderify.js"]
-    }
-  ],
-
-  "default_locale": "en",
-
-  "description": "...",
-
-  "icons": {
-    "48": "icon.png",
-    "96": "icon@2x.png"
-  },
-
-  "manifest_version": 2,
-
-  "name": "...",
-
-  "page_action": {
-    "default_icon": {
-      "19": "button/geo-19.png",
-      "38": "button/geo-38.png"
-    },
-    "default_title": "Whereami?",
-    "default_popup": "popup/geo.html"
-  },
-
-  "permissions": ["webNavigation"],
-
-  "version": "0.1",
-
-  "web_accessible_resources": ["images/my-image.png"]
-}
- -

 

diff --git a/files/ar/mozilla/add-ons/webextensions/match_patterns/index.html b/files/ar/mozilla/add-ons/webextensions/match_patterns/index.html deleted file mode 100644 index d5775418be..0000000000 --- a/files/ar/mozilla/add-ons/webextensions/match_patterns/index.html +++ /dev/null @@ -1,449 +0,0 @@ ---- -title: Match patterns -slug: Mozilla/Add-ons/WebExtensions/Match_patterns -translation_of: Mozilla/Add-ons/WebExtensions/Match_patterns ---- -
{{AddonSidebar}}
- -

Match patterns are a way to specify groups of URLs: a match pattern matches a specific set of URLs. They are for extensions using WebExtensions APIs in a few places, most notably to specify which documents to load content scripts into, and to specify which URLs to add webRequest listeners to.

- -

APIs that use match patterns usually accept a list of match patterns, and will perform the appropriate action if the URL matches any of the patterns. See, for example, the content_scripts key in manifest.json.

- -

Match pattern structure

- -

All match patterns are specified as strings. Apart from the special "<all_urls>" pattern, match patterns consist of three parts: scheme, host, and path. The scheme and host are separated by "://".

- -
<scheme>://<host><path>
- -

scheme

- -

The scheme component may take one of two forms:

- - - - - - - - - - - - - - - - - - -
FormMatches
"*"Only "http" and "https".
One of "http", "https", "file", "ftp", "app".Only the given scheme.
- -

host

- -

The host component may take one of three forms:

- - - - - - - - - - - - - - - - - - - - - - -
FormMatches
"*"Any host.
"*." followed by part of the hostname.The given host and any of its subdomains.
A complete hostname, without wildcards.Only the given host.
- -

host is optional only if the scheme is "file".

- -

Note that the wildcard may only appear at the start.

- -

path

- -

The path component must begin with a "/".

- -

After that, it may subsequently contain any combination of the "*" wildcard and any of the characters that are allowed in URL paths. Unlike host, the path component may contain the "*" wildcard in the middle or at the end, and the "*" wildcard may appear more than once.

- -

<all_urls>

- -

The special value "<all_urls>" matches all URLs under any of the supported schemes: that is, "http", "https", "file", "ftp", "app".

- -

Examples

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PatternExample matchesExample non-matches
-

<all_urls>

- -

Match all URLs.

-
-

http://example.org/

- -

ftp://files.somewhere.org/

- -

https://a.org/some/path/

-
-

resource://a/b/c/
- (unsupported scheme)

-
-

*://*.mozilla.org/*

- -

Match all HTTP and HTTPS URLs that are hosted at "mozilla.org" or one of its subdomains.

-
-

http://mozilla.org/

- -

https://mozilla.org/

- -

http://a.mozilla.org/

- -

http://a.b.mozilla.org/

- -

https://b.mozilla.org/path/

-
-

ftp://mozilla.org/
- (unmatched scheme)

- -

http://mozilla.com/
- (unmatched host)

- -

http://firefox.org/
- (unmatched host)

-
-

*://mozilla.org/

- -

Match all HTTP and HTTPS URLs that are hosted at exactly "mozilla.org/".

-
-

http://mozilla.org/

- -

https://mozilla.org/

-
-

ftp://mozilla.org/
- (unmatched scheme)

- -

http://a.mozilla.org/
- (unmatched host)

- -

http://mozilla.org/a
- (unmatched path)

-
-

ftp://mozilla.org/

- -

Match only "ftp://mozilla.org/".

-
ftp://mozilla.org -

http://mozilla.org/
- (unmatched scheme)

- -

ftp://sub.mozilla.org/
- (unmatched host)

- -

ftp://mozilla.org/path
- (unmatched path)

-
-

https://*/path

- -

Match HTTPS URLs on any host, whose path is "path".

-
-

https://mozilla.org/path

- -

https://a.mozilla.org/path

- -

https://something.com/path

-
-

http://mozilla.org/path
- (unmatched scheme)

- -

https://mozilla.org/path/
- (unmatched path)

- -

https://mozilla.org/a
- (unmatched path)

- -

https://mozilla.org/
- (unmatched path)

-
-

https://*/path/

- -

Match HTTPS URLs on any host, whose path is "path/".

-
-

https://mozilla.org/path/

- -

https://a.mozilla.org/path/

- -

https://something.com/path/

-
-

http://mozilla.org/path/
- (unmatched scheme)

- -

https://mozilla.org/path
- (unmatched path)

- -

https://mozilla.org/a
- (unmatched path)

- -

https://mozilla.org/
- (unmatched path)

-
-

https://mozilla.org/*

- -

Match HTTPS URLs only at "mozilla.org", with any path.

-
-

https://mozilla.org/

- -

https://mozilla.org/path

- -

https://mozilla.org/another

- -

https://mozilla.org/path/to/doc

-
-

http://mozilla.org/path
- (unmatched scheme)

- -

https://mozilla.com/path
- (unmatched host)

-
-

https://mozilla.org/a/b/c/

- -

Match only this URL.

-
https://mozilla.org/a/b/c/Anything else.
-

https://mozilla.org/*/b/*/

- -

Match HTTPS URLs hosted on "mozilla.org", whose path contains a component "b" somewhere in the middle.

-
-

https://mozilla.org/a/b/c/

- -

https://mozilla.org/d/b/f/

- -

https://mozilla.org/a/b/c/d/

-
-

https://mozilla.org/b/*/
- (unmatched path)

- -

https://mozilla.org/a/b/
- (unmatched path)

-
-

file:///blah/*

- -

Match any FILE URL whose path begins with "blah".

-
-

file:///blah/

- -

file:///blah/bleh

-
file:///bleh/
- (unmatched path)
- -

Invalid match patterns

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Invalid patternReason
resource://path/Unsupported scheme.
https://mozilla.orgNo path.
https://mozilla.*.org/"*" in host must be at the start.
https://*zilla.org/"*" in host must be the only character or be followed by ".".
http*://mozilla.org/"*" in scheme must be the only character.
file://*Empty path: this should be "file:///*".
- -

Testing match patterns

- -

When writing extensions, you don't generally work with match patterns directly: usually you pass a match pattern string into an API, and the API constructs a match pattern and uses it to test URLs. However, if you're trying to work out which match pattern to use, or debugging a problem with one, it can be useful to be able to create and test match patterns directly. This section explains how to do this.

- -

Note that the code here will not work in an extension, and is only provided to help manually test match patterns using the console.

- -

First, open the developer tool settings and check the setting marked "Enable browser chrome and add-on debugging toolboxes":

- -

{{EmbedYouTube("JDEe2fyFpHE")}}

- -

Next, open the "Browser Console":

- -

{{EmbedYouTube("mfuBMje6dA4")}}

- -

This gives you a command line that you can use to execute privileged JavaScript in Firefox.

- -
-

Because code running in the Browser Console has system privileges, any time you use it to run code, you need to understand exactly what the code is doing. That includes the code samples in this article.

-
- -

Now paste this code into the command line and press enter:

- -
Cu.import("resource://gre/modules/MatchPattern.jsm");
-Cu.import("resource://gre/modules/BrowserUtils.jsm");
- -

This does two things:

- -
    -
  • imports "MatchPattern.jsm": this is the system module that implements match patterns. Specifically, the module contains a constructor for MatchPattern objects. MatchPattern objects define a function called matches(), that takes a URI and returns true or false.
  • -
  • imports "BrowserUtils.jsm": this includes a function makeURI(), that converts a string into an nsIURI object. nsIURI is the type that matches() expects to receive.
  • -
- -

Now you can construct MatchPattern objects, construct URIs, and check whether the URIs match:

- -
var match = new MatchPattern("*://mozilla.org/");
-
-var uri = BrowserUtils.makeURI("https://mozilla.org/");
-match.matches(uri); //        < true
-
-uri = BrowserUtils.makeURI("https://mozilla.org/path");
-match.matches(uri); //        < false
- -

Converting Match Patterns to Regular Expressions

- -

All match patterns can be represented by regular expressions. This code converts a match pattern to a regular expression:

- -
/**
- * Transforms a valid match pattern into a regular expression
- * which matches all URLs included by that pattern.
- *
- * @param  {string}  pattern  The pattern to transform.
- * @return {RegExp}           The pattern's equivalent as a RegExp.
- * @throws {TypeError}        If the pattern is not a valid MatchPattern
- */
-function matchPatternToRegExp(pattern) {
-    if (pattern === '') {
-        return (/^(?:http|https|file|ftp|app):\/\//);
-    }
-
-    const schemeSegment = '(\\*|http|https|file|ftp)';
-    const hostSegment = '(\\*|(?:\\*\\.)?(?:[^/*]+))?';
-    const pathSegment = '(.*)';
-    const matchPatternRegExp = new RegExp(
-        `^${schemeSegment}://${hostSegment}/${pathSegment}$`
-    );
-
-    let match = matchPatternRegExp.exec(pattern);
-    if (!match) {
-         throw new TypeError(`"${pattern}" is not a valid MatchPattern`);
-    }
-
-    let [, scheme, host, path] = match;
-    if (!host) {
-        throw new TypeError(`"${pattern}" does not have a valid host`);
-    }
-
-    let regex = '^';
-
-    if (scheme === '*') {
-        regex += '(http|https)';
-    } else {
-        regex += scheme;
-    }
-
-    regex += '://';
-
-    if (host && host === '*') {
-        regex += '[^/]+?';
-    } else if (host) {
-        if (host.match(/^\*\./)) {
-            regex += '[^/]*?';
-            host = host.substring(2);
-        }
-        regex += host.replace(/\./g, '\\.');
-    }
-
-    if (path) {
-        if (path === '*') {
-            regex += '(/.*)?';
-        } else if (path.charAt(0) !== '/') {
-            regex += '/';
-            regex += path.replace(/\./g, '\\.').replace(/\*/g, '.*?');
-            regex += '/?';
-        }
-    }
-
-    regex += '$';
-    return new RegExp(regex);
-}
-
diff --git a/files/ar/mozilla/add-ons/webextensions/what_are_webextensions/index.html b/files/ar/mozilla/add-ons/webextensions/what_are_webextensions/index.html deleted file mode 100644 index e5a17da914..0000000000 --- a/files/ar/mozilla/add-ons/webextensions/what_are_webextensions/index.html +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: ما هي الامتدادات؟ -slug: Mozilla/Add-ons/WebExtensions/What_are_WebExtensions -translation_of: Mozilla/Add-ons/WebExtensions/What_are_WebExtensions -original_slug: Mozilla/Add-ons/WebExtensions/ما_هي_امتدادات_الويب ---- -
{{AddonSidebar}}
- -

An extension adds features and functions to a browser. It’s created using familiar web-based technologies—HTML, CSS, and JavaScript. It can take advantage of the same web APIs as JavaScript on a web page, but an extension also has access to its own set of JavaScript APIs. This means that you can do a lot more in an extension than you can with code in a web page. Here are just a few examples of the things you can do:

- -

Enhance or complement a website: Use an add-on to deliver additional in-browser features or information from your website. Allow users to collect details from pages they visit to enhance the service you offer.

- -

- -

Examples: Amazon Assistant for Firefox, OneNote Web Clipper, and Grammarly for Firefox

- -

Let users show their personality: Browser extensions can manipulate the content of web pages; for example, letting users add their favorite logo or picture as a background to every page they visit. Extensions may also enable users to update the look of the Firefox UI, the same way standalone theme add-ons do.

- -

- -

Examples: MyWeb New Tab, Tabliss, and VivaldiFox

- -

Add or remove content from web pages: You might want to help users block intrusive ads from web pages, provide access to a travel guide whenever a country or city is mentioned in a web page, or reformat page content to offer a consistent reading experience. With the ability to access and update both a page’s HTML and CSS, extensions can help users see the web the way they want to.

- -

- -

Examples: uBlock Origin, Reader, and Toolbox for Google Play Store™

- -

Add tools and new browsing features: Add new features to a taskboard, or generate QR code images from URLs, hyperlinks, or page text. With flexible UI options and the power of the WebExtensions APIs you can easily add new features to a browser. And, you can enhance almost any website’s features or functionality, it doesn't have to be your website.

- -

- -

Examples: Swimlanes for Trello and Tomato Clock

- -

Games: Offer traditional computer games with off-line play features, or explore new game possibilities; for example, by incorporating gameplay into everyday browsing.

- -

 

- -

Examples: Asteroids in Popup, Solitaire Card Game New Tab, and 2048 Prime.

- -

Add development tools: You may provide web development tools as your business or have developed a useful technique or approach to web development that you want to share. Either way, you can enhance the built-in Firefox developer tools by adding a new tab to the developer toolbar.

- -

- -

Examples: Web Developer, Web React Developer Tools, and aXe Developer Tools

- -

Extensions for Firefox are built using the WebExtensions APIs, a cross-browser system for developing extensions. To a large extent, the API is compatible with the extension API supported by Google Chrome and Opera. Extensions written for these browsers will in most cases run in Firefox or Microsoft Edge with just a few changes. The API is also fully compatible with multiprocess Firefox.

- -

If you have ideas or questions, or need help migrating a legacy add-on to WebExtensions APIs, you can reach us on the dev-addons mailing list or in #addons on IRC.

- -

What's next?

- - diff --git a/files/ar/mozilla/firefox/index.html b/files/ar/mozilla/firefox/index.html deleted file mode 100644 index ab373eb27d..0000000000 --- a/files/ar/mozilla/firefox/index.html +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: فايرفوكس -slug: Mozilla/Firefox -tags: - - فايرفوكس - - موزيلا -translation_of: Mozilla/Firefox ---- -
{{FirefoxSidebar}}
- -

يعد فايرفوكس متصفح موزيلا الأكثر شعبية، وهو متاح لمنصات متعددة على سطح المكتب، بما فيها ويندوز، وماك، ولينكس كما يتوفر على جميع هواتف الأندرويد والأيفون. بفضل التوافقية الممتازة، وأحدث تقنيات الويب، وتقنيات التطوير القوية، يعد فايرفوكس خياراً ممتازاً لكلٍ من مطوري الويب والمستخدمين العاديين.

- -

يعد فايرفوكس مشروع مفتوح المصدر. فمعظم النص المصدري قد ساهم بكتابته مجتمع ضخم من المتطوعين. هنا يمكنك معرفة المزيد عن كيفية المساهمة في المشروع، وسوف تجد أيضاً روابط لمعلومات حول تعلم تطوير إضافات لمتصفح فايرفوكس، واستخدام أدوات المطورين في متصفح، وغيرها من الموضوعات.

- -
-

تعرّف على كيفية إنشاء إضافات لمتصفح فايرفوكس، وكيفية تطويره وبناءه، وكيف تعمل الأجزاء الداخلية لفايرفوكس والمشاريع الفرعية الأخرى.

-
- -
    -
  • ملاحظات الإصدار للمطور - -

    تركز هذه الملاحظات على المطور. تعرّف على القدرات الجديدة القادمة لكلاً من مواقع الويب والإضافات في كل إصدار جديد من فايرفوكس.

    -
  • -
  • توثيقات المشروع -

    احصل على معلومات مُفصلة حول الأجزاء الداخلية ونظام بناء فايرفوكس، لتصبح قادراً على فهم النص المصدري للمشروع.

    -
  • -
  • دليل المطور -

    يوفر دليل المطور معلومات حول كيفية الحصول النص المصدري لمتصفح فايرفوكس وترجمته (تجميعه)، وكيف يمكنك فهم آلية عمله، والمساهمة في المشروع.

    -
  • -
- -

نسخ فايرفوكس

- -

يمتلك فايرفوكس خمسة نسخ متاحة.

- -

النسخة المتأخرة (الليلية)

- -

كل ليلة نبني النص المصدري الأحدث الذي توصلنا إليه من فايرفوكس في مستودع موزيلا المركزي. هذه الإصدارات التي نبنيها موجهة لمطورين فايرفوكس أو للذين يرغبون بتجربة أحدث التقنيات المتطورة والتي مازالت قيد التطوير.

- -

نزّل فايرفوكس النسخة الليلية

- -

نسخة المطورين

- -

هذه الإصدارة من فيرفوكس موجهة للمطورين. كل ستة أسابيع، نأخذ الميزات الناضجة بما فيه الكفاية، الموجودة في النسخة الليلية من فيرفوكس، ونبني نسخة جديدة من فايرفوكس إصدار المطورين. ونقوم أيضاً بإضافة بعض الميزات الإضافية للمطورين والتي تتوفر في هذه النسخة فقط.

- -

تعرّف على المزيد حول نسخة فايرفوكس للمطورين.

- -

نزّل نسخة فايرفوكس للمطورين

- -

النسخة التجريبية

- -

بعض قضاء ستة أسابيع في إصدارة موزيلا للمطورين، نأخذ الميزات التي نضجت بما فيه الكفاية من نسخة المطورين، ونقوم بإنشاء نسخة جديدة من فايرفوكس الإصدارة التجربيبة. تُبنى هذه الإصدارة من أجل عشاق فايرفوكس لاختبار الميزات الجديدة القادمة للإصدار المستقر.

- -

نزّل النسخة التجريبية

- -

نسخة فايرفوكس (المستقرة)

- -

بعد الإستقرار لستة أسابيع أخرى في الإصدار التجريبية، نكون قد أصبحنا مستعدين لشحن الميزات الجديدة لمئات الملايين من المستخدمين في إصدار جديد من فايرفوكس.

- -

نزّل فايرفوكس (النسخة المستقرة)

- -

النسخة طويلة الدعم

- -

تعد هذه النسخة إصدار طويل الأجل من فايرفوكس نسخة سطح المكتب موجهة للاستخدام من قبل المنظمات مثل المدارس، والجامعات، والشركات وغيرها من المنظمات التي تحتاج دعم موسع لعمليات النشر الجماعي.

- -

تعرّف على المزيد حول نسخة فايرفوكس طويلة الدعم.

- -

نزّل النسخة طويلة الدعم

- -

ملفات فايرفوكس الشخصية

- -

إذا كنت تستخدم عدة نسخ — أو حتى عدة إعدادات مختلفة — بشكل منتظم، فعليك قراءة كيف تستخدم عدة ملفات شخصية مع فايرفوكس لتستخدم مدير الملف الشخصي الخاص بفايرفوكس وأدوات إدارة الملفات الشخصية الأخرى لصالحك.

diff --git a/files/ar/mozilla/firefox/releases/index.html b/files/ar/mozilla/firefox/releases/index.html deleted file mode 100644 index 63372869bd..0000000000 --- a/files/ar/mozilla/firefox/releases/index.html +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: Firefox developer release notes -slug: Mozilla/Firefox/Releases -tags: - - Firefox - - Landing - - Mozilla - - NeedsTranslation - - Release - - TopicStub -translation_of: Mozilla/Firefox/Releases ---- -
{{FirefoxSidebar}}
- -

Below you'll find links to the developer release notes for every Firefox release. These lovingly-crafted notes provide details on what features and APIs were added and improved and what bugs were eliminated in each version of Firefox. All written to give developers like you the information they need most. You're welcome.

- -
{{ListSubpages("",1,1,1)}}
- -


- Whew! That's a lot of Firefoxen!

- -

See also

- - diff --git a/files/ar/mozilla/index.html b/files/ar/mozilla/index.html deleted file mode 100644 index ecbabce71c..0000000000 --- a/files/ar/mozilla/index.html +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Mozilla -slug: Mozilla -tags: - - NeedsTranslation - - TopicStub -translation_of: Mozilla ---- -
- {{draft}}
-

This will soon be an awesome landing page for Mozilla internals. For now, it's not.

-
- {{LandingPageListSubpages}}
diff --git a/files/ar/orphaned/heesfoord007/index.html b/files/ar/orphaned/heesfoord007/index.html deleted file mode 100644 index f79e7c1a1b..0000000000 --- a/files/ar/orphaned/heesfoord007/index.html +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: heesfoord007 -slug: orphaned/heesfoord007 -tags: - - Landing - - NeedsTranslation - - TopicStub - - Web -original_slug: heesfoord007 ---- -
The open Web presents incredible opportunities for developers. To take full advantage of these technologies, you need to know how to use them. Below you'll find links to our Web technology documentation.
- -
-
-

Documentation for Web developers

- -
-
Web Developer Reference
-
A list of all references for Web technologies, including those for HTML, CSS, and so on.
-
Web Developer Guide
-
The Web Developer Guide provides useful how-to content to help you actually use Web technologies to do what you want or need to do.
-
Tutorials for Web developers
-
A list of tutorials to take you step-by-step through learning APIs, technologies, or broad topic areas.
-
Developing Web applications
-
Documentation for Web application developers; Web apps are true write-once, deploy anywhere apps for mobile, desktop, and Firefox OS.
-
Code snippets
-
This is a quick list of useful code snippets (small code samples) available for developers of extensions for the various Mozilla applications. Many of these samples can also be used in XULRunner applications, as well as in actual Mozilla code itself.
-
- -

View All...

-
- -
-

Web technology references

- -
-
Web APIs
-
Reference material for each of the interfaces that comprise the Web's APIs, including the DOM and all of the related APIs and interfaces you can use to build Web content and apps.
-
HTML
-
HyperText Markup Language is the language used to describe and define the content of a Web page.
-
CSS
-
Cascading Style Sheets are used to describe the appearance of Web content.
-
SVG
-
Scalable Vector Graphics let you describe images as sets of vectors and shapes in order to allow them to scale smoothly regardless of the size at which they're drawn.
-
MathML
-
The Mathematical Markup Language makes it possible to display complex mathematical equations and syntax.
-
-
-
- -

Temporary

- -

The stuff below here is temporary to help keep track of things while organization work is ongoing. Pay it no mind.

- -
{{ListSubpages}}
diff --git a/files/ar/orphaned/learn/how_to_contribute/index.html b/files/ar/orphaned/learn/how_to_contribute/index.html deleted file mode 100644 index c1efde80b2..0000000000 --- a/files/ar/orphaned/learn/how_to_contribute/index.html +++ /dev/null @@ -1,83 +0,0 @@ ---- -title: كيف تساهم في قسم التعلم في الشبكة -slug: orphaned/Learn/How_to_contribute -tags: - - توثيق - - دليل - - ساهم - - مبتدئين -translation_of: Learn/How_to_contribute -original_slug: Learn/How_to_contribute ---- -
{{LearnSidebar}}
- -

إن كنت هنا لأوَّل مرَّة أو بعد بحثٍ طويل، فمن المُرجَح أنَّ هذا يرجع لكونك مُهتماً في المساهمة في قسم شبكة مطوري موزيلا للتعلم. إنَّ هذا لنبؤٌ سعيد!

- -

ستجد في هذه الصفحة كل شيء ستحتاج إليه لتحسين محتوى قسم التعلم. يوجد العديد من الأشياء التي يمكنك القيام بها، بناءً على وقتك، وما إذا كنت مُبتدِئاً، مطوراً، أو مُدرِساً.

- -
-

ملاحظة: يمكنك إيجاد دليل إرشادي حول كتابة مقالة جديدة في قسم التعلم في مقالة "كيفيّة كتابة مقالة لمساعدة الناس على التعلُّم حول الويب".

-
- -

جِد مهمة محددة

- -

الطرق الشائعة للمساهمة في قسم التعلم هي قراءة المقالات، إصلاح الأخطاء المطبعيّة، واقتراح التحسينات. نُرحِب أيضاً بإضافة أمثلة إلى مستودعنا على جيتهاب، والتواصل معنا إن رغبت بطرح سؤال ما.

- -

المساهمة هي طريقة رائعة لاكتساب المتعة في حين تعلم أشياء جديدة. إن شعرت يوماً بالضياع أو كان لديك سؤالاً ما، فلا تتردد أبداً بالتواصل معنا على موضوع قسم التعلُّم في منصة ديسكورس، أو على قناة IRC (اطّلع على نهاية هذه الصفحة للمزيد من التفاصيل). كريس ميلز (Chris Mills) هو مدير المواضيع لهذا القسم، يمكنك أيضاً محاولة التواصل معه مباشرةً.

- -

توفِر الأقسام التاليّة بعض الأفكار العامة حول أنواع المهام التي يمكنك القيام بها.

- -

أنا مُبتدِئ

- -

هذا مُذهِل! المبتدئون هم عامل مُهم وقيّم جداً في تقديم التعليقات حول المواد الدراسيّة. لديك - بالتأكيد - وجهة نظر فريدة حول مقالتنا كعضو من جمهورنا المُستهدف، مما يجعلك عضواً لا يقدر بثمن في فريقنا. إن كنت تستخدم مقالاتنا لتتعلم شيئاً ما ووقعت في المشاكل، أو وجدت مقالة تحوي معلومات مُشتتة، يمكنك إما إصلاحها أو إعلامنا بذلك حتى نتحقق من المشكلة ونحلُها.

- -

إليك بعض الاقتراحات حول الطرق التي يمكنك المساهمة فيها:

- -
-
إضافات الوسوم إلى المقالات (تستغرق العمليّة قرابة الخمس دقائق)
-
وسِم (tagging) محتوى الشبكة هو أحد أسهل الطرق التي يمكنك المساهمة فيها. في حين أنَّ العديد من المزايا لدينا تستخدم الوسوم (tags) لتساعدها في تقديم المعلومات بسياقها الصحيح، فيُعَد الوسِم مساهمة قيّمة جداً. ألقي نظرة على قائمة المصطلحات في المسرد والمقالات التعليميّة التي لا تحتوي على وسوم لتبدأ بالمساهمة.
-
قراءة ومراجعة المصطلحات في المسرد (تستغرق العمليّة قرابة الخمس دقائق)
-
كمبتدئ، نحتاج إلى أعين يقظة لمراجعة محتوانا. إذا وجدت مصطلحاً صعب الفهم، فهذا يعني أنَّ المسرد بحاجة ليُحسَن. لا تتردد بإجراء أي تغييرات تظنها ضروريّة. إذا كنت تظن أنَّك لا تملك المهارة الكافيّة لتعديل مصطلح بنفسك، يمكنك على الأقل إعلامنا بذلك على قائمتنا البريديّة.
-
كتابة مصطلح جديد في المسرد (تستغرق العمليّة قرابة العشرين دقيقة)
-
هذه أكثر الطرق فعاليّة لتتعلم شيئاً جديداً. اختر مفهوماً جديداً تريد فهمه، أقرأ عنه، واكتب شرحاً له في المسرد. الشرح للآخرين هي إحدى الطرق الرائعة "لتثبيت" المعرفة في ذهنك، وتساعدك على فهم الأشياء بنفسك، كل هذا في حين أنَّك تساعد الآخرين أيضاً. الجميع رابِح!
-
قراءة ومراجعة المقالات التعليميّة (تستغرق العمليّة قرابة الساعتين)
-
تشبه هذه المهمة كثيراً مراجعة المصطلحات في المسرد (انظر أعلاه). ولكن هذه المهمة تحتاج لوقتٍ أطول؛ بسبب أنَّ هذه المقالات عادةً ما تكون أطول قليلاً.
-
- -

أنا مُطوِّر

- -

عظيم! مهاراتك التقنيّة هي ما نحتاجه لتوفير محتوى تقني دقيق للمتبدئين. بما أنَّ هذا القسم من الشبكة مُخصص لتعليم الويب، كُن حريصاً على جعل توضيحاتك بسيطة قدر الإمكان، مع الحرص على كونها مفيدة. من الأكثر أهميّة أن تكون مفهومة على أن تكون دقيقة للغاية.

- -
-
قراءة ومراجعة المصطلحات في المسرد (تستغرق العمليّة قرابة الخمس دقائق)
-
كمطوِّر، نحتاج لتتأكد أنَّ محتوانا دقيق تقنياً بدون أن يكون مُتحذلق بشكل مبالغ. لا تتردد عن إجراء أي تغييرات تظن أنَّها ضروريّة. إذا أردت مناقشة المحتوى قبل إجراء أيّة تغييرات، تواصل معنا على قائمتنا البريديّة أو على قناة IRC.
-
كتابة مصطلح جديد في المسرد (تستغرق العمليّة قرابة العشرين دقيقة)
-
توضيح المصطلحات التقنيّة هي طريقة جيدة جداً للتعلم ولتصبح دقيق تقنياً وبسيطاً في شرحك. سيشكرك المبتدئون على ذلك. لدينا العديد من المصطلحات الغير معرفة والتي تحتاج لاهتمامك. اختر واحداً وابدأ بشرحه.
-
قراءة ومراجعة المقالات التعليميّة (تستغرق العمليّة قرابة الساعتين)
-
هذه المهمة مماثلة لمراجعة المصطلحات في المسرد (انظر أعلاه). الفرق هو أنَّ هذه المقالات أطول قليلاً مما سيتطلب وقتاً أطول.
-
كتابة مقالة تعليميّة جديدة (تستغرق العمليّة قرابة الأربع ساعات أو أكثر)
-
تفتقر شبكة مطوري موزيلا إلى المقالات البسيطة حول استخدام تقنيات الويب (مثل لغة ترميز النص الفائق، صفحات الأنماط الانسيابية، الجافاسكربت ...إلخ). لدينا في الشبكة محتوى قديم يتطلب إعادة المراجعة والنشر. ادفع بمهاراتك إلى أقصى حد لتجعل تقنيات الويب قابلة للاستخدام من قبل المبتدئين.
-
إنشاء تمرينات، عينات برمجيّة، أو أدوات تعليم تفاعليّة (تستغرق العمليّة وقتاً غير محدد)
-
تحتاج جميع مقالاتنا التعليميّة إلى ما ندعوه بمواد "التعليم النشطة"، ﻷنَّ الناس يتعلمون الشيء بشكل أفضل عندما يقومون به بأنفسهم. هذه المواد هي تمرينات أو محتويات تفاعليّة تساعد المُستخدمين على تطبيق والتلاعب بالمفاهيم المشروحة في المقالة. يوجد العديد من الطرق الممكنة لصنع محتوى تفاعلي، من إنشاء عينات برمجيّة باستخدام JSFiddle أو أشباهه، إلى بناء محتوى تفاعلي مُتكامل بواسطة Thimble. أطلق العنان لإبداعك!
-
- -

أنا مُدرِس

- -

تملك شبكة مطوري موزيلا تاريخ طويل من النجاح التقني، ولكننا نفتقر للفهم العميق حول الطرق الفُضلى لتعليم المفاهيم للجدد. هنا حيث نحتاج إليك بصفتك مُدرِس. يمكنك مساعدتنا على الحرص على أنَّ موادنا التعليميّة توفِر مسار تعليمي جيد وعملي لقرائِنا.

- -
-
قراءة ومراجعة المصطلحات في المسرد (تستغرق العمليّة قرابة الخمس عشرة دقيقة)
-
تَفَقَد المصطلحات في المسرد ولا تتردد عن إجراء أيّة تغييرات تراها ضروريّة. إذا أردت مناقشة المحتوى قبل تعديله، تواصل معنا على قائمتنا البريديّة أو على قناة IRC.
-
كتابة مصطلح جديد في المسرد (تستغرق العمليّة قرابة الساعة)
-
تعريفات المصطلحات البسيطة والواضحة، واللمحات البسيطة عن المفاهيم في المسرد هو قطعاً ما يلبي احتياجات المبتدئِين. يمكن أن تساعد خبرتك كمُدرِس على إنشاء تعريفات ممتازة للمصطلحات. لدينا العديد من المصطلحات الغير معرفة والتي تحتاج لاهتمامك. اختر واحداً وابدأ بشرحه.
-
إضافة رسوم توضيحيّة ومخططات للمقالات (تستغرق العمليّة قرابة الساعة)
-
كما تعلم، الرسوم التوضيحيّة (illustrations) هي جزء لا يقدر بثمن في أي محتوى تعليمي. تلك هي إحدى الأمور التي نفتقدها في الشبكة ومهاراتك يمكن أن تُحدِث فرقاً. تفقد المقالات التي تحوي نقصاً في المحتوى التوضيحي واختر مقالة ترغَب بإنشاء رسماً توضيحياً يشرحها.
-
قراءة ومراجعة المقالات التعليميّة (تستغرق العمليّة قرابة الساعتين)
-
هذه المهمة مشابهة لمراجعة المصطلحات في المسرد (انظر أعلاه)، ولكنها تتطلب وقتاً أطول لكون المقالات بالعادة أطول قليلاً.
-
كتابة مقالات تعليميّة جديدة (تستغرق العمليّة قرابة الأربع ساعات)
-
نحتاج إلى مقالات بسيطة وواضحة حول النظام الشابكي (Web ecosystem) والمواضيع الأخرى المتعلقة به. في حين أنَّ المقالات التعليميّة من الضروري أن تكون تدريسيّة بدلاً من أن تقوم بتغطيّة كل شيء حرفياً، فخبرتك بمعرفة الأشياء التي يجب شرحها وكيفيّة القيام بذلك ستكون مساعدة رائعة!
-
إنشاء تمرينات، اختبارات، أو أدوات تعليم تفاعليّة (يستغرق الأمر وقتاً غير محدد)
-
تحتاج جميع مقالاتنا التعليميّة إلى مواد "التعليم النشط". هذه المواد هي تمرينات أو محتويات تفاعليّة تساعد المُستخدمين على تعلم استخدام والتوسع في المفاهيم المشروحة في المقالة. يوجد العديد من الأمور التي يمكنك القيام بها هنا، من إنشاء اختبارات (quizzes)، إلى بناء محتوى تفاعلي مُتكامل بواسطة Thimble. أطلق العنان لإبداعك!
-
إنشاء مسارات تعليميّة (تستغرق العمليّة وقتاً غير محدد)
-
بغرض توفير دورات شاملة وتدريجيّة، نحتاج إلى تهيئة محتوانا في مسارات. هذه طريقة لجمع المحتوى الحالي وإيجاد المفقود لإنشاء مقالات تعليميّة عنه.
-
diff --git a/files/ar/orphaned/mdn/community/index.html b/files/ar/orphaned/mdn/community/index.html deleted file mode 100644 index 01a5b68eb5..0000000000 --- a/files/ar/orphaned/mdn/community/index.html +++ /dev/null @@ -1,47 +0,0 @@ ---- -title: انضم إلى مجتمع شبكة مطوري موزيلا -slug: orphaned/MDN/Community -tags: - - حول الشبكة -translation_of: MDN/Community -original_slug: MDN/Community ---- -
{{MDNSidebar}}
{{IncludeSubNav("/ar/docs/MDN")}}
- -
-

تعد شبكة مطوري موزيلا أكثر من موسوعة: فهي مجتمع للمطورين الذين يعملون معاً لجعل هذه الشبكة مصدر بارز للمطورين الذين يرغبون باستخدام تقنيات الويب المفتوح.

-
- -

سنود أن تساهم في المشروع، ولكننا نود أكثر أن تشارك في مجمتع شبكة مطوري موزيلا. في الأسفل سنشرح كيف يمكنك المشاركة بثلاثة خطوات سهلة:

- -
    -
  1.  أنشئ حساب في شبكة مطوري موزيلا.
  2. -
  3. انضم إلى المحادثات.
  4. -
  5. تابع ما يحدث.
  6. -
- -

كيف يعمل المجتمع

- -

يوجد أدناه مقالات أكثر تصف مجتمع شبكة مطوري موزيلا.

- -
-
-
-
رُتب المجتمع
-
يوجد عدد من الرُتب في مجتمع شبكة مطوري موزيلا والتي تملك صلاحيات ومسؤوليات معينة.
-
سباقات التوثيق
-
تعد هذه المقالة دليل لتنظيم سباق توثيق. فهي تحتوي على نصائح من أناس قاموا بتنظيم سباقات توثيق، ليساعدوك على تنظيم واحد أيضاً.
-
تابع ما يحدث
-
يعمل مجتمع شبكة مطوري موزيلا على تقديم هذه الموسوعة لك. يوجد في هذه المقالة بعض الطرق لتبادل المعلومات حول ما نقوم به.  
-
-
- -
-
-
محادثات مجتمع شبكة مطورين موزيلا
-
تُقام علمية التوثيق على موقع شبكة مطوري موزيلا أما المجتمع فيعمل من خلال مناقشات ومحادثات ولقاءات على الإنترنت.
-
العمل في المجتمع
-
الجزء الرئيسي من المساهمة في وثائق شبكة مطوري موزيلا هو معرفة كيفية العمل كجزء من المجتمع. تقدم هذه المقالة نصائح لتساعدك على تحقيق أقصى استفادة من تفاعلك مع كل من الكتاب الآخرين وفرق التطوير.
-
-
-
diff --git a/files/ar/orphaned/mdn/community/whats_happening/index.html b/files/ar/orphaned/mdn/community/whats_happening/index.html deleted file mode 100644 index 0f45cc3fc5..0000000000 --- a/files/ar/orphaned/mdn/community/whats_happening/index.html +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: اتبع ما يحدث -slug: orphaned/MDN/Community/Whats_happening -translation_of: MDN/Community/Whats_happening -original_slug: MDN/Community/Whats_happening ---- -
{{MDNSidebar}}
- -

MDN is brought to you by the MDN community. Here are some ways to that we share information about what we're doing.

- -

المدونات

- -
-
Mozilla Hacks
-
-

أخبار حول وتغطية متعمقة لتقنيات وميزات الويب و Mozilla.

-
-
إشراك المطورين
-
تعزيز النشاط والمناقشة بين المجتمع المشترك في MDN في موزيلا.
-
- -

Streams of ephemera

- -
    -
  • @MozDevNet: صفحات مثيرة للاهتمام ، ودروس تعليمية ، وأدلة ، وطلبات التقديم ، وتحديثات هامة ، وغيرها من الأخبار حول شبكة مطور Mozilla.
  • -
  • @MozHacks: تغريدات حول تقنيات الويب الجديدة وتطبيقات HTML5 الرائعة وميزات Firefox.
  • -
  • Mozilla Hacks (YouTube)
  • -
- -

لوحات الحالة ولوحات المعلومات

- -

ألقِ نظرة على صفحات حالة "الوثائق" لمعرفة ما يجري عبر النطاق الكامل لمحتوى MDN. ستكون قادرًا على رؤية المقالات التي تحتاج إلى كتابتها أو تحديثها ، وما الموضوعات التي تحتاج إلى مزيد من المساعدة ، وأكثر من ذلك بكثير

- -

اجتماعات MDN

- -

There are a number of regular meetings for tracking and sharing progress on various MDN-related projects and processes. These are described on the MDN meetings wiki page.

- -

To get a general sense of what's happening, the best meeting to attend is the MDN Community meeting, which occurs every two weeks on Wednesdays, 10:00 US Pacific time (UTC-0800 October-March, UTC-0700 in March-October), in the #mdn IRC channel. See the MDN community meetings wiki page for agendas and notes from past meetings.

- -

The Public MDN Events calendar contains MDN community meetings, doc sprints, and other MDN-related events. If you see a meeting which takes place in the "mdn" channel on our Vidyo videoconferencing system, you can join the conversation on the web.

- -
 
diff --git a/files/ar/orphaned/mdn/contribute/howto/create_an_mdn_account/index.html b/files/ar/orphaned/mdn/contribute/howto/create_an_mdn_account/index.html deleted file mode 100644 index c6485726bc..0000000000 --- a/files/ar/orphaned/mdn/contribute/howto/create_an_mdn_account/index.html +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: كيف تنشئ حساباً على شبكة MDN -slug: orphaned/MDN/Contribute/Howto/Create_an_MDN_account -tags: - - MDN Account - - إنشاء حساب MDN - - حساب MDN -translation_of: MDN/Contribute/Howto/Create_an_MDN_account -original_slug: MDN/Contribute/Howto/إنشاء_حساب_على_شبكة_مطوري_موزيلا ---- -
{{MDNSidebar}}
- -

عليك امتلاك ملف شخصي حتى تتمكن من التعديل على محتوى الشبكة، ولكنك لا تحتاج لإنشاء حساب إن كنت تريد القراءة والبحث في التوثيقات التي نتيحها. سيساعدك هذا الدليل على إعداد ملفك الشخصي في الشبكة.

- -
-
-

لما تحتاج الشبكة لعنوان البريد الإلكتروني؟

- -

يُستخدم بريدك الإلكتروني لاسترجاع الحساب إذا لزم الأمر، كما يُستخدم من قبل مدراء الشبكة ليتمكنوا من التواصل معك حول حسابك ونشاطك على الشبكة.
- بالإضافة لذلك، يمكنك الاشتراك بالإشعارات (على سبيل المثال، يمكنك تلقي إشعار عندما يتم تعديل صفحة معينة) والرسائل (على سبيل المثال، إن قمت بالإنضمام إلى فريق التجربة، فقد تتلقى رسائل إلكترونية حول الميزات الجديدة التي تحتاج للاختبار)
- لن يظهر بريدك الإلكتروني أبداً في الشبكة وسيتم استخدامه فقط وفقاً لسياسة الخصوصية.

- -
إذا قمت بتسجيل الدخول بالشبكة باستخدام GitHub و استخدمت "عدم الرد (noreply)" على بريد الغيت هاب، فلن تتلقى رسائل (بما فيها الإشعارات عندما تشترك بصفحة) من الشبكة.
-
-
- -
    -
  1. في أعلى كل صفحة ستجد زر تسجيل الدخول. اضغط على هذا الزر لعرض قائمة الخدمات التي ندعمها للمصادقة وتسجيل الدخول في الشبكة.
  2. -
  3. اختر إحدى تلك الخدمات. حالياً، غيت هاب هو الخيار الوحيد. لاحظ أنك إذا اخترت غيت هاب سيتم إضافة رابط لملفك الشخصي على الموقع في الشبكة.
  4. -
  5. اتبع الطلبات التي سيخبرك بها غيت هاب لتربط ملفك الشخصي بالشبكة.
  6. -
  7. حالما تعيدك خدمة المصادقة إلى الشبكة (والتي هي غيت هاب - إذا أخترتها -)، ستتمكن من إدخال اسم المستخدم وكلمة المرور، سيتم عرض اسم المستخدم خاصتك للعموم لشكرك على العمل الذي قمت به. فلا تستخدم البريد الإلكتروني كاسم مستخدم.
  8. -
  9. اضغط على إنشاء ملف شخصي خاص بي على الشبكة (أو ما يقابله بالمعنى).
  10. -
  11. إذا كان البريد الإلكتروني الذي حددته في الخطوة الرابعة ليس هو نفسه الذي استخدمته مع خدمة المصادقة، فيرجى التحقق من بريدك الإلكتروني والضغط على رابط التأكيد المُرسل إليك.
  12. -
- -

هذا كل شيء! والآن أصبح لديك حساب على الشبكة، ويمكنك القيام بتعديلات مباشرةً!

- -

يمكنك الضغط على اسمك في الشريط العلوي لرؤية ملفك الشخصي. من هناك، يمكنك الضغط على زرتحرير (أو ما يقابله بالمعنى) للقيام بتغييرات على ملفك الشخصي.

- -
-

اسماء المستخدمين الجدد لا يمكن أن يحتوا على مسافات أو المحرف "@". تذكر أن اسم المستخدم الخاص بك سيظهر للعموم ليحدد الأعمال التي قمت بها.

-
- -
 
diff --git a/files/ar/orphaned/mdn/contribute/howto/do_a_technical_review/index.html b/files/ar/orphaned/mdn/contribute/howto/do_a_technical_review/index.html deleted file mode 100644 index 97ac1b3478..0000000000 --- a/files/ar/orphaned/mdn/contribute/howto/do_a_technical_review/index.html +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: كيفية القيام بمراجعة فنية -slug: orphaned/MDN/Contribute/Howto/Do_a_technical_review -translation_of: MDN/Contribute/Howto/Do_a_technical_review -original_slug: MDN/Contribute/Howto/Do_a_technical_review ---- -
{{MDNSidebar}}
- -
{{IncludeSubnav("/en-US/docs/MDN")}}
- -

تتكون المراجعة الفنية من مراجعة الدقة الفنية واكتمال مقال ما وتصحيحه إذا لزم الأمر. إذا أراد كاتب مقال أن يقوم شخص آخر بالتحقق من المحتوى الفني لمقال ما ، فإن الكاتب يضع علامة اختيار في خانة "المراجعة الفنية" أثناء التحرير. غالبًا ما يتصل الكاتب بمهندس معين لإجراء المراجعة الفنية ، ولكن يمكن لأي شخص لديه خبرة فنية في الموضوع أن يفعل ذلك.

- -

توضح هذه المقالة كيفية إجراء مراجعة فنية ، مما يساعد على ضمان دقة محتوى MDN

- -

ما هي المهمة؟

- -
-
مراجعة وتصحيح المقالات للتأكد من دقتها واكتمالها.
-
أين يجب القيام به؟
-
في مقالات محددة تم وضع علامة على أنها تتطلب مراجعة فنية.
-
ما الذي تحتاج إلى معرفته لأداء المهمة؟
-
-
    -
  • معرفة الخبراء بموضوع المقالة التي تراجعها. إذا كانت قراءة المقال لا تعلمك أي شيء جديد ، فاعتبر نفسك خبيرًا.
  • -
  • -

    كيفية تحرير مقالة ويكي على MDN.

    -
  • -
-
-
-

ما هي خطوات القيام بذلك؟

-
-
-
    -
  1. اختيار مقال للمراجعة: -
      -
    1. انتقل إلى قائمة الصفحات التي تحتاج إلى مراجعات فنية. هذا يسرد جميع الصفحات التي طلبت مراجعة فنية لها.
    2. -
    3. اختر صفحة موضوعك مألوفة لديك.
    4. -
    5. انقر على رابط المقال لتحميل الصفحة.
    6. -
    -
  2. -
  3. اقرأ المقال ، مع إيلاء اهتمام وثيق للتفاصيل الفنية: هل المقال صحيح؟ هل هناك شيء مفقود؟ لا تتردد في التبديل إلى صفحة مختلفة إذا كانت أول صفحة تختارها لا تناسبك. -
      -
    -
  4. -
  5. إذا لم تكن هناك أخطاء ، فلن تحتاج إلى تعديل المقالة لوضع علامة عليها كمراجعة. ابحث عن مربع "المراجعة السريعة" في الشريط الجانبي الأيسر من الصفحة. يسرد هذا المربع الأصفر أي مراجعات معلقة ويسمح لك بمسح علامة طلب المراجعة. يبدو مثل هذا إذا تم طلب مراجعة فنية:
    - Screenshot of the sidebar's box listing reviews that have been requested and allowing the flags to be changed.
  6. -
  7. -

    ألغ تحديد مربع الاختيار الفني ، وانقر فوق "حفظ".

    -
  8. -
  9. -

    إذا وجدت أخطاء تحتاج إلى تصحيح ، فسيسعدك معرفة أنه يمكنك أيضًا تغيير حالة طلب المراجعة من داخل المحرر. إليك سير العمل:

    - -
      -
    1. لتحرير الصفحة ، انقر فوق الزر "تحرير" بالقرب من أعلى الصفحة ؛ هذا يضعك في محرر MDN.
    2. -
    3. إصلاح أي معلومات فنية غير صحيح ، و / أو إضافة أي معلومات مهمة مفقودة.
    4. -
    5. أدخل تعليق المراجعة في أسفل المقال. هذه رسالة مختصرة تصف ما قمت به ، مثل "إكمال المراجعة الفنية". إذا قمت بتصحيح المعلومات ، فقم بتضمينها في تعليقك ، على سبيل المثال "المراجعة الفنية وأوصاف المعلمات الثابتة". يساعد ذلك المساهمين الآخرين ومحرري الموقع في معرفة ما الذي قمت بتغييره ولماذا. يمكنك أيضًا ذكر ما إذا كانت هناك وحدات بت محددة لم تشعر أنها مؤهلة للمراجعة
    6. -
    7. ألغ تحديد المربع الفني تحت المراجعة المطلوبة؟ أسفل منطقة تعليق المراجعة بالصفحة.
    8. -
    9. انقر على زر نشر.
    10. -
    -
  10. -
- -

تهانينا! لقد أنهيت أول مراجعة فنية لك! شكرا لك على مساعدتك!

-
-
- -
 
diff --git a/files/ar/orphaned/mdn/contribute/howto/do_an_editorial_review/index.html b/files/ar/orphaned/mdn/contribute/howto/do_an_editorial_review/index.html deleted file mode 100644 index 71ece898d3..0000000000 --- a/files/ar/orphaned/mdn/contribute/howto/do_an_editorial_review/index.html +++ /dev/null @@ -1,59 +0,0 @@ ---- -title: كيفية القيام بمراجعة تحريرية -slug: orphaned/MDN/Contribute/Howto/Do_an_editorial_review -translation_of: MDN/Contribute/Howto/Do_an_editorial_review -original_slug: MDN/Contribute/Howto/Do_an_editorial_review ---- -
{{MDNSidebar}}
- -
{{IncludeSubnav("/en-US/docs/MDN")}}
- -

Editorial reviews consist of fixing typos, spelling, grammar, usage, or textual errors in an article. One does not have to be a writing expert to make valuable contributions to MDN's technical documentation, but articles still need copy-editing and proof-reading. This is done in an editorial review.

- -

توضح هذه المقالة كيفية إجراء مراجعة تحريرية ، مما يساعد على ضمان دقة محتوى MDN وكتابته بشكل جيد.

- -
-
ما هي المهمة؟
-
-

تحرير النسخ وقراءة التجارب للمقالات التي تم تحديدها على أنها تتطلب مراجعة تحريرية.

-
-
-

أين يجب القيام به؟

-
-
-

ضمن مقالات محددة تم تعليمها على أنها تتطلب مراجعة افتتاحية.

-
-
ما الذي تحتاج إلى معرفته لأداء المهمة؟
-
You need to have good English grammar and spelling skills. An editorial review is about ensuring that the grammar, spelling, and wording are correct and make sense, and that the MDN writing style guide is followed.
-
-

ما هي خطوات القيام بذلك؟

-
-
-
    -
  1. Pick an article to review: -
      -
    1. Go to the list of articles needing editorial review. This lists all the pages for which an editorial review has been requested.
    2. -
    3. Click on the article link to load the page.
      - Note: This listing is generated automatically but infrequently, so some articles appear on the list that no longer need editorial review. If the article you picked does not display a banner that says "This article needs an editorial review", skip that article and pick a different one.
    4. -
    -
  2. -
  3. Read the article carefully, looking out for typos, spelling, grammar, or usage errors. Don't hesitate to switch to a different page if the first one you choose doesn't suit you.
  4. -
  5. If there are no errors, you don't need to edit the article to mark it as reviewed. Look for the "quick review" box in the left sidebar of the page:
    - Screenshot of the editorial review request sidebar box
  6. -
  7. Deselect the Editorial box and click Save.
  8. -
  9. If you find errors that need to be corrected: -
      -
    1. Click the Edit button near the top of the page; this brings you into the MDN editor.
    2. -
    3. Correct any typos and spelling, grammar, or usage errors you find. You don't have to fix everything to be useful, but be sure to leave the editorial review request in place if you don't feel reasonably sure that you've done a complete review of the entire article.
    4. -
    5. Enter a Revision Comment at the bottom of the article; something like 'Editorial review: fixed typos, grammar & spelling.' This lets other contributors and site editors know what you changed and why.
    6. -
    7. Deselect the Editorial box under Review Needed?. This is located just below the Revision Comment section of the page.
    8. -
    9. Click the Publish button.
    10. -
    -
  10. -
- -
-

التغييرات الخاصة بك قد لا تكون مرئية مباشرة بعد الحفظ ؛ قد يكون هناك تأخير أثناء معالجة الصفحة وحفظها.

-
-
-
diff --git a/files/ar/orphaned/mdn/contribute/howto/set_the_summary_for_a_page/index.html b/files/ar/orphaned/mdn/contribute/howto/set_the_summary_for_a_page/index.html deleted file mode 100644 index 13077abb15..0000000000 --- a/files/ar/orphaned/mdn/contribute/howto/set_the_summary_for_a_page/index.html +++ /dev/null @@ -1,117 +0,0 @@ ---- -title: How to set the summary for a page -slug: orphaned/MDN/Contribute/Howto/Set_the_summary_for_a_page -translation_of: MDN/Contribute/Howto/Set_the_summary_for_a_page -original_slug: MDN/Contribute/Howto/Set_the_summary_for_a_page ---- -
{{MDNSidebar}}
- -
{{IncludeSubnav("/en-US/docs/MDN")}}
- -

في هذه المقالة ، سنعرض كيفية تعيين ملخص تحسين محركات البحث (المعروف أيضًا بالوصف أو ملخصًا فقط) لمقالة على موقع مستندات ويب MDN. يستخدم الملخص بعدة طرق:

- -
    -
  •  يتم استخدام جوجل ومحركات البحث الاخرى للمساعدة على فهرسة الصفحات.
  • -
  • تعرض محركات البحث الملخص في صفحات نتائج البحث لمساعدة القراء على اختيار الصفحة الأكثر تطابقاً لاحتياجاتهم.
  • -
  • غالبًا ما تعرض قوائم MDN والصفحات المقصودة للموضوع الملخص أسفل عنوان المقالة ، ومرة أخرى لمساعدة المستخدمين في العثور على المعلومات التي يبحثون عنها.
  • -
  • تحتوي الروابط على MDN بشكل متكرر على تلميحات تحتوي على نص الملخص ، لتوفير نظرة سريعة للمستخدمين دون الحاجة إلى النقر على المقالة نفسها.
  • -
- -

لذلك ، يجب أن يكون الملخص نصًا منطقيًا في سياق المقالة نفسها وكذلك عند تقديمه بمفرده في سياقات أخرى. يجب عليك أيضًا الاحتفاظ بدليل نمط كتابة MDN في الاعتبار أثناء كتابة نص الملخص.

- - - -

الملخص الافتراضي

- -

تعتمد الصفحات التي لا تحتوي أي ملخص على الملخص الافتراضي.
- بشكل افتراضي يعتبر ملخص الصفحة هو أول قسم من الصفحة مكتوب ب 
- {{Glossary("HTML")}}
- لذلك من الممكن أي يكون الملخص عبارة عن نص وليس عنوان. 

- -

هذا النص ليس الأفضل للاستخدام دائما ولكن ولبعض الأسباب المذكورة أدناه يعتبر أفضل استخدام.

- -
    -
  • النص الأول يعتبر شيء جانبي أو ملاحظة ما, ولا يقدم أي مراجعة كاملة للصفحة
  • -
  • أول نص مكتوب يعتبر نص محتوى ولكن لا يقدم مراجعة كاملة لمحتوى المقالة
  • -
  • النص طويل أو قصير للغاية
  • -
- -

من الأفضل كتابة وتحديد ملخص الصفحة لضمان سهولة قراءة الملخصات واعتبارها مفيدة بقدر الإمكان.

- -

Setting the summary

- -

Let's look at how to go about setting a page's summary.

- -
-
What is the task?
-
Marking the text within a page that should be used as its summary in other contexts; if appropriate text isn't already available, this task might include writing a small amount of appropriate text.
-
Where does it need to be done?
-
On pages that lack a summary, have a summary that isn't helpful, or have a summary that unnecessarily fails to meet recommended guidelines.
-
What do you need to know to do the task?
-
Ability to use the MDN editor; good English writing skills; enough familiarity with the topic of the page to write a good summary.
-
What are the steps to do it?
-
- -
    -
  • Pick a page on which to set the summary. If you already have one in mind, great! You can skip to step 2; otherwise, to find a page to fix: -
      -
    1. In the MDN documentation status page, click the link under Sections for a topic that you know something about (for example, HTML):
      -
    2. -
    3. On the topic's documentation status page, click the Pages header in the Summary table. This takes you to an index of all the pages in that topic section; it shows the page links in the left column, and the tags and summaries in the right column:
      -
    4. -
    5. Pick a page that is missing a summary, or that has a poor summary:
      -
    6. -
    7. Click the link to go to that page.
    8. -
    -
  • -
- -
-
-
    -
  1. Once on the page to which you wish to add a summary, click Edit to open the page in the MDN editor. See the Guide to the MDN editor if you need information about using the editor.
  2. -
  3. Look for a sentence or two that works as a summary, even if taken out of context. If needed, edit the existing content to create or modify the text until you can select a sentence or two that make a good summary. See {{anch("Crafting a good summary")}} for help selecting or creating an appropriate summary.
  4. -
  5. Select the text to be used as a summary.
  6. -
  7. In the Styles widget of the editor toolbar, select SEO Summary. In the page source, this creates a {{HTMLElement("span")}} element with class="seoSummary" around the selected text.
    -
  8. -
  9. Save your changes with a revision comment. The comment is optional, but we encourage you to provide one. It makes it easier for other people to track the changes. Something like "Set SEO summary" is enough.
  10. -
-
-
- -

Crafting a good summary

- -

The summary is used in many different scenarios, including these:

- -
    -
  • As the description of the article on search results pages on MDN as well as on Google and other search engines.
  • -
  • As the description of the article in menus and topic landing pages on MDN itself.
  • -
  • In contextual tooltips when the user hovers the cursor over links to articles on MDN.
  • -
- -

It's important to keep these scenarios in mind while composing a summary. In order to help ensure that the summary works well in all of these situations, please try to follow the guidelines below.

- -
-

Note: Unless otherwise specifically stated, these are guidelines, not hard and fast rules. While you should do what you can to meet these guidelines, sometimes there are exceptions that can't be  avoided.

-
- -
    -
  • The summary should indicate both the topic and the type of page. "In this guide, we'll learn to use the Intersection Observer API to create responsive web apps that only update animations that are currently visible on screen." is 160 characters, for example, and explains what technology is being covered, how the technology is being used, and that the article is a tutorial.
  • -
  • You can choose text from anywhere within any paragraph in the article, but it should ideally be within the first paragraph (or the second, in some cases). If the point of the article isn't made in those paragraphs, the introduction of the page probably needs rewriting.
  • -
  • The summary must still fit well within the context of the article's body, since it is in fact part of the article.
  • -
  • It's okay to have links to other pages within the summary. These are automatically removed before being given to search engines, and do not count against you. They're also removed before the summary is used as a tooltip. Links are not removed from the summary when used as a page description within menus and landing pages on MDN, which is really convenient as well.
  • -
  • The summary should include an appropriate selection of key terms likely to be searched for by someone looking for information contained on the page. In the example case about the Intersection Observer API, those keywords include the API name, "animations", "visible", "responsive", and "web apps", possibly among others.
  • -
  • To optimize the Search Engine Optimization (SEO) value gained from a summary, it should be no shorter than 150 characters long.
  • -
  • Since a search engine result page (SERP) typically doesn't show more than 160 characters of the summary, you should avoid summaries longer than that. Having your text unceremoniously chopped off can dissuade people from clicking the link.
  • -
  • It might be tempting to write a great summary that doesn't work on page, then hide the summary inside a block with the "hidden" class on it. But this doesn't work, because search engines ignore text that's not visible to the user.
  • -
- -

Think of the summary as being akin to the {{interwiki("wikipedia", "blurb")}} on the back or inside the front cover of a book. This short text has to catch the reader's attention quickly and encourage them to read on.

- -

It can be a little tricky to write an summary that works well both for search engine result pages and within the article text itself, but currently MDN doesn't offer a way to create an SEO summary separate from the page content, so do the best you can.

- -

See also

- - diff --git a/files/ar/orphaned/mdn/contribute/howto/write_an_article_to_help_learn_about_the_web/index.html b/files/ar/orphaned/mdn/contribute/howto/write_an_article_to_help_learn_about_the_web/index.html deleted file mode 100644 index 41f9945501..0000000000 --- a/files/ar/orphaned/mdn/contribute/howto/write_an_article_to_help_learn_about_the_web/index.html +++ /dev/null @@ -1,112 +0,0 @@ ---- -title: كيفية كتابة مقال لمساعدة الناس على التعرف على شبكة الإنترنت -slug: orphaned/MDN/Contribute/Howto/Write_an_article_to_help_learn_about_the_Web -translation_of: MDN/Contribute/Howto/Write_an_article_to_help_learn_about_the_Web -original_slug: MDN/Contribute/Howto/Write_an_article_to_help_learn_about_the_Web ---- -
{{MDNSidebar}}
- -

منطقة التعلم MDN هي موطننا للمقالات التي تقدم مفاهيم الويب للمطورين الجدد. نظرًا لأن محتواها يستهدف المبتدئين في الغالب ، فهو مكان رائع لمشاركة معرفتك ومساعدة القادمين الجدد على التعرف على الويب. من المهم التأكد من أن المطورين الجدد يمكنهم متابعة هذا المحتوى ، لذلك نولي اهتمامًا خاصًا به.

- -

يشرح هذا المقال كيفية كتابة صفحات للمنطقة التعليمية.

- -

How to write a Learning Area article

- -

To start contributing your knowledge, simply click the big green button, then follow the five steps below. If you're looking for ideas, please take a look at the our team Trello board!

- - - - - - - -

This article might not end up in exactly the right place, but at least it's on MDN. If you need to talk to someone about getting it moved to the right place, please  Contact us.

- -

Step 1: Write a two-liner

- -

Your article's first sentence needs to summarize what subject you're going to cover, and the second one should go into a few more specifics of the items that you'll put in the article. For example:

- -
-

Whereas {{glossary("HTML")}} files contain structured content, {{Glossary("CSS")}}, another major Web technology, makes the content look the way you want. In this article we are going to cover how this technology works, and how to write your own basic example.

-
- -

Note how the example briefly explains that CSS is a core Web technology used to style pages. That's enough for the reader to get a pretty good idea what the article covers.

- -

Because Learning Area articles primarily target beginners, each article should cover one straightforward topic so as not to overwhelm the reader with too much new information. If you can't summarize the article in one sentence, you might be trying to do too much in one article!

- -

Step 2: Add a top box

- -

Add a top box to help readers understand where they are in the learning process.  Here's an example of a top box from "Understanding URLs and their structure". You can use this article as an model when writing your own.

- - - - - - - - - - - - -
Prerequisites:You need to first know how the Internet works, what a Web server is, and the concepts behind links on the web.
Objective:You will learn what a URL is and how it works on the Web.
- -
-
Prerequisites
-
What must the reader already know to follow the article? When possible, make each prerequisite a link to another Learning Area article covering the concept (unless it's a really basic article that doesn't require prior knowledge).
-
Objectives
-
This section briefly states what the reader will learn over the course of the article. This is a bit different than the one-liner; the one-liner summarizes the topic of the article, while the objectives section specifically lays out what the reader can expect to accomplish over the course of the article.
-
- -
-

Note: To create this table, you can either copy and paste the example table above, or use MDN's editor's table tool. If you choose to use the table tool, you need to specifically add the learn-box CSS class in addition to the default standard-table class. To do this, when you create or edit the table's properties, go to the "Advanced" panel and set the Stylesheet Classes field to "standard-table learn-box".

-
- -

Step 3: Write a full description

- -

Next, write a longer description that provides a more thorough overview of the article highlighting the most important concepts. Don't forget to explain why the reader should take the time to learn this topic and read your article!

- -

Step 4: Dig deeper

- -

When you're done with all that, you can finally dive deeply into the topic. You can structure this part of your article however you like (although feel free to consult our style guide). This is your chance to shine! Go into detail explaining the topic you're writing about. Provide links to the full reference documentation, explain how the technology works in detail, provide syntax and usage details, and so forth. It's up to you!

- -

As a guide, here are some writing tips for beginners:

- -
    -
  • Focus on a single topic. If you feel like you need to cover other topics, it means either you're missing a prerequisite article, or you need to break up your article into more than one.
  • -
  • Use simple English. Avoid technical terms when you can, or at least define them and link to their glossary entries where applicable.
  • -
  • Include straightforward examples to make the theoretical concepts easier to grasp. Many people learn best by example. Rather than writing academic papers, we want beginners to follow the text readily.
  • -
  • Visual aids often can make things easier to digest and carry extra information, so feel free to use images, diagrams, videos, and tables. If you're using diagrams or charts that include text, we encourage you to use {{Glossary("SVG")}} so our translation teams can localize the text.
  • -
- -

Have a look at the first few sections of our Functions — reusable blocks of code article for some good descriptive sections.

- -

Step 5: Provide "active learning" material

- -

To illustrate the article and help the reader better understand what they're learning, be sure to provide exercises, tutorials, and tasks to accomplish. By having them actively and practically using and experimenting with the concepts your article explains, you can help "lock" the information into their brains.

- -

You can choose to include the examples directly in the page as live samples or link to them if they don't really work as a live sample. If you're interested in helping create these valuable materials, please read the article Create an interactive exercise to help learning the Web.

- -

If you can't provide links to existing active learning materials (you don't know of any or don't have time to create them), you should add the tag {{Tag("NeedsActiveLearning")}} to the article. That way other contributors can find articles that need active learning materials and help you come up with them.

- -

Have a look at Active learning: selecting different elements for a live interactive learning exercise, or Active learning: Playing with scope for a different style of exercise that calls upon them to download a template locally and modify it following the provided steps.

- -

Step 6: Get the article reviewed, and put into the Learning Area navigation menu

- -

After you've written your article, let us know so we can have a look at it, do a review, and suggest improvements. Again, see our Contact us section for the best ways to get in touch.

- -

The last step is adding your article to the Learning Area main navigation menu. This menu is generated by the LearnSidebar macro, and requires special editing privileges, so talk to one of our team about your contribution.

- -

For now, add the menu to your page by adding the macro call \{{LearnSidebar}} into a paragraph at the top of your page.

- -
    -
- -

Suggested articles

- -

So you want to contribute but you're not sure what to write about?

- -

The Learning Area team maintains a Trello board with ideas of articles to write. Feel free to pick one and get to work!

diff --git a/files/ar/orphaned/mdn/tools/page_deletion/index.html b/files/ar/orphaned/mdn/tools/page_deletion/index.html deleted file mode 100644 index 496ab17054..0000000000 --- a/files/ar/orphaned/mdn/tools/page_deletion/index.html +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: Deleting pages -slug: orphaned/MDN/Tools/Page_deletion -tags: - - Guide - - MDN Meta - - Page-level - - Tools -translation_of: MDN/Tools/Page_deletion -original_slug: MDN/Tools/Deleting_pages ---- -
{{MDNSidebar}}

Only MDN administrators are able to delete pages. This article explains how to request that a page be removed from MDN.

- -

To arrange for a page to be deleted, you should do the following:

- -
    -
  1. Do not erase or change the page content. We want to have the record of the page as it was at deletion time.
  2. -
  3. Add the tag "junk" to the page. Do not remove other tags.
  4. -
  5. If the page is particularly urgently in need of deletion (for example, its content is inappropriate, offensive, or technically dangerous), notify an MDN administrator.
  6. -
- -

An administrator will delete the page when possible, after confirming that deletion is appropriate

diff --git "a/files/ar/orphaned/\330\243\330\255\330\257\330\247\330\253_\331\205\331\203\330\252\330\250\330\251_jquery/index.html" "b/files/ar/orphaned/\330\243\330\255\330\257\330\247\330\253_\331\205\331\203\330\252\330\250\330\251_jquery/index.html" deleted file mode 100644 index 56ca59f3b5..0000000000 --- "a/files/ar/orphaned/\330\243\330\255\330\257\330\247\330\253_\331\205\331\203\330\252\330\250\330\251_jquery/index.html" +++ /dev/null @@ -1,64 +0,0 @@ ---- -title: أحداث مكتبة jQuery -slug: orphaned/أحداث_مكتبة_jQuery -original_slug: أحداث_مكتبة_jQuery ---- -

تعريف

-

أحداث مكتبة jQuery تقوم بربط الدوال مع عنصر معين.

-

يمكن أخذ مثال عن أحداث مكتبة jQuery كعندما يضغط المستخدم على زر أو يقوم بإدخال نص أو يحرك مؤشر الفأرة فوق منطقة محددة في الصفحة.

-

أحداث مكتبة jQuery

-

حدث blur()

-

يقوم الحدث blur() بمعالجة دالة ما عندما يفقد مربع إدخال النصوص المحدد إمكانيته على الإدخال,مثال:

-
<script src="http://code.jquery.com/jquery-latest.js"></script>
-<script>
-$(document).ready(function() {
-$("#text").blur(function() {
-$(this).css("background-color","orange");
-});
-});
-</script>
-<input type="text" id="text">
-
-

إنتقل إلى الرابط التالي لتشاهد كيف يعمل هذا الحدث: http://jsbin.com/tibequrucelu/1/edit

-
-

حدث change()

-

يقوم الحدث change() بمعالجة دالة ما عندما يتغير محتوى مربع إدخال النصوص,مثال:

-
<script src="http://code.jquery.com/jquery-latest.js"></script>
-<script>
-$(document).ready(function() {
-$("#text").change(function() {
-alert("
لقد تغير محتوى النص
"); -}); -}); -</script> -<input type="text" id="text"> -
-

انتقل إلى الرابط التالي لتشاهد كيف يعمل هذا الحدث: http://jsbin.com/getigucoqeba/1/edit

-
-

حدث click()

-

يقوم حدث click() بمعالجة دالة ما عندما يتم الضغط بزر الفأرة الأيسر على العنصر المحدد,مثال:

-
<script src="http://code.jquery.com/jquery-latest.js"></script>
-<script>
-$(document).ready(function() {
-$("#button").click(function() {
-alert("
لقد تم ضغط الزر
"); -}); -}); -</script> -<input type="button" id="button" value="
اضغط هنا
"> -
-

انتقل إلى الرابط التالي لتشاهد كيف يعمل هذا الحدث: http://jsbin.com/radepuyuwexe/1/edit

-
-

حدث dblclick()

-

يقوم حدث dblclick() بمعالجة دالة ما عندما يتم الضغط بشكل مزدوج بإستخدام زر الفأرة الأيسر على العنصر المحدد,مثال:

-
<script src="http://code.jquery.com/jquery-latest.js"></script>
-<script>
-$(document).ready(function() {
-$("#button").dblclick(function() {
-alert("
لقد تم ضغط الزر بشكل مزدوج
"); -}); -}); -</script> -<input type="button" id="button" value="
اضغط هنا
"> -
-

انتقل إلى الرابط التالي لتشاهد كيف يعمل هذا الحدث: http://jsbin.com/delazakoloye/1/edit

diff --git "a/files/ar/orphaned/\331\205\331\203\330\252\330\250\330\251_\330\254\331\212_\331\203\331\210\331\212\330\261\331\212/index.html" "b/files/ar/orphaned/\331\205\331\203\330\252\330\250\330\251_\330\254\331\212_\331\203\331\210\331\212\330\261\331\212/index.html" deleted file mode 100644 index 45c02f275b..0000000000 --- "a/files/ar/orphaned/\331\205\331\203\330\252\330\250\330\251_\330\254\331\212_\331\203\331\210\331\212\330\261\331\212/index.html" +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: مكتبة jQuery -slug: orphaned/مكتبة_جي_كويري -original_slug: مكتبة_جي_كويري ---- -

مقدمة

-

jQuery هي عبارة عن مكتبة مكتوبة بلغة JavaScript.

-

تقوم مكتبة jQuery بإزالة التعقيدات من برمجة JavaScript.

-

أهمية مكتبة jQuery

-

تقوم مكتبة jQuery بإختصار شيفرات JavaScript الطويلة.

-

تخيل أنه عوضاً عن كتابة:

-
document.getElementById(Element_Id);
-
-

يمكنك الإكتفاء بكتابة:

-
$(Element_Id)
-
-

مكونات مكتبة jQuery

-

تتألف مكتبة jQuery من المكونات التالية:

-

النواة:

-

بما أن مكتبة jQuery مكتوبة بشكل كامل بلغة JavaScript,فإن نواتها مكونة من لغة JavaScript.

-

الأحداث:

-

تتمتع مكتبة jQuery بمجموعة ضخمة من الأحداث التي تمكن الشيفرة من الإشتغال بمجرد إطلاق الحدث,قد يكون الحدث ضغطة زر أو تغيير المحتوى أو...

-

التأثيرات:

-

تتمتع مكتبة jQuery بمجموعة كبيرة من التأثيرات كالإنزلاق و الإختفاء و التحريك...

-

الأجاكس:

-

تتمتع مكتبة jQuery بقدرة على تقليص كود الأجاكس مما يوفر الكثير من الوقت في كتابته.

-

مميزات مكتبة jQuery

-

تتمتع مكتبة jQuery بمجموعة كبيرة من المميزات مثل:الحجم الصغير,تقليص حجوم شيفرات JavaScript,مجانية و مفتوحة المصدر.

-

مشاكل مكتبة jQuery

-

لا تدعم مكتبة jQuery المتصفحات القديمة و لا تعمل جيداً مع الإتصالات البطيئة.

-

روابط ذات فائدة:

-

الموقع الرسمي

diff --git "a/files/ar/orphaned/\331\210\330\247\330\265\331\201\330\251_spellcheck_\330\247\331\204\330\254\330\257\331\212\330\257\330\251_\331\201\331\212_html5/index.html" "b/files/ar/orphaned/\331\210\330\247\330\265\331\201\330\251_spellcheck_\330\247\331\204\330\254\330\257\331\212\330\257\330\251_\331\201\331\212_html5/index.html" deleted file mode 100644 index b42e5e3135..0000000000 --- "a/files/ar/orphaned/\331\210\330\247\330\265\331\201\330\251_spellcheck_\330\247\331\204\330\254\330\257\331\212\330\257\330\251_\331\201\331\212_html5/index.html" +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: واصفة SpellCheck الجديدة في HTML5 -slug: orphaned/واصفة_SpellCheck_الجديدة_في_HTML5 -original_slug: واصفة_SpellCheck_الجديدة_في_HTML5 ---- -
-

مقدمة.

-

تستخدم واصفة SpellCheck في التحقق من أن العنصر الذي يحتوي هذه الواصفة خالي من الأخطاء الإملائية و النحوية.

-

الإستعمال.

-

تستعمل واصفة SpellCheck لتحديد إذا ما كان مصحح الأخطاء الإملائية للعنصر فعال أو لا.

-

يمكن إستعمالها في الفقرات القابلة للتحرير,مربعات إدخال النصوص,أو مربعات الحوار.

-

التوافق مع العناصر.

-

إن واصفة SpellCheck متوافقة مع كافة العناصر,و يمكن إضافتها إلى أي عنصر داخل معايير HTML.

-
- إن واصفة SpellCheck جديدة في HTML5.
-

التأثير الظاهري للواصفة على الصفحة.

-

إن واصفة SpellCheck سوف تتحقق من محتوى العنصر,إذا كان المحتوى خالياً من الأخطاء الإملائية و الهجائية,لن يطرأ أي تغيير في الصفحة,و إذا وجد خطأ هجائي أو نحوي,فإن الواصفة ستقوم بوضع خط أحمر تحت المحتوى.

-

الشكل العام لصيغة الواصفة.

-
<p spellcheck="true">This Is A Paragraph</p>
-
-<p spellcheck="false">This Is Another Paragraph</p>
-
-

إذا أخذت الواصفة القيمة المنطقية true,فإن مصحح الأخطاء الهجائية للعنصر سيعمل,و إذا أخذت الواصفة القيمة المنطقية false,فإن مصحح الأخطاء الهجائية للعنصر لن يعمل,و في هذه الحالة لا يوجد داعي لتضمين هذه الواصفة في العنصر

-
- لا تدعم واصفة SpellCheck كل اللغات,من أمثلة اللغات غير المدعومة:اللغة العربية.
-

أمثلة:

-

في المثال التالي,سوف تتحقق واصفة SpellCheck من وجود أخطاء إملائية في مربع إدخال النصوص.

-

هذه هي الشيفرة:

-
<textarea rows="10" cols="40" spellcheck="true"></textarea>
-
-

الآن شاهد في الأسفل كيف أن الكلمات التي تحتوي أخطاء هجائية سيظهر تحتها خط أحمر:

-
-
-

التوافق مع المتصفحات.

- - - - - - - - - - - - - - - - - - -
- دعم المتصفحات لواصفة SpellCheck
Internet Explorer 10Google ChromeMozzila FirefoxOperaSafari
مدعومةمدعومةمدعومةمدعومةمدعومة
-

إستعمال الواصفة في JavaScript.

-

يمكن إستخدام هذه الواصفة في نصوص JavaScript.

-

الصيغة العامة لتشغيل أو إيقاف تشغيل واصفة SpellCheck بإستخدام JavaScript:

-
document.getElementById(Some_Id).spellCheck=true; //تشغيل مصحح الأخطاء الهجائية للعنصر المحدد.
-document.getElementById(Some_Id).spellCheck=false; //إيقاف تشغيل مصحح الأخطاء الهجائية للعنصر المحدد.
-
-

توافق الواصفة SpellCheck مع الكائنات الأخرى في JavaScript

-

بما أن الواصفة SpellCheck في JavaScript هي من النوع العام,فهي متوافقة مع كل الكائنات الأخرى في JavaScript.

-

روابط ذات صلة بالموضوع:

- تخصيص واصفة SpellCheck في معايير منظمة W3C.
-

 

diff --git "a/files/ar/orphaned/\331\210\330\247\330\265\331\201\330\251_\330\247\331\204\330\271\331\206\331\210\330\247\331\206_\331\201\331\212_html/index.html" "b/files/ar/orphaned/\331\210\330\247\330\265\331\201\330\251_\330\247\331\204\330\271\331\206\331\210\330\247\331\206_\331\201\331\212_html/index.html" deleted file mode 100644 index fbaf3bc33e..0000000000 --- "a/files/ar/orphaned/\331\210\330\247\330\265\331\201\330\251_\330\247\331\204\330\271\331\206\331\210\330\247\331\206_\331\201\331\212_html/index.html" +++ /dev/null @@ -1,62 +0,0 @@ ---- -title: واصفة العنوان في HTML -slug: orphaned/واصفة_العنوان_في_HTML -original_slug: واصفة_العنوان_في_HTML ---- -
-

مقدمة.

-

تستخدم واصفة العنوان في إظهار معلومات إضافية حول عنصر ما.

-

الإستعمال.

-

يمكن إستخدام واصفة العنوان في إضافة توضيحات حول عنصر ما.

-

التوافق مع العناصر.

-

إن واصفة العنوان متوافقة مع كافة العناصر في HTML.

-

التأثير الظاهري للواصفة على الصفحة.

-

معظم المتصفحات سوف تعرض هذه الأداة كمربع تلميحات يظهر عندما يتم تحريك مؤشر الفأرة فوق العنصر.

-

الشكل العام لصيغة الواصفة.

-
-
<element title="معلومات يتم إظهارها...">
-
-
-

أمثلة:

-

في المثال التالي,عندما يقوم المستخدم بتحريك مؤشر الفأرة فوق الرابط,سيظهر له تلميح.

-

هذه هي الشيفرة:

-
-
<a href="http://developer.mozzila.org" title="زوروا موقع شبكة مطوري موزيلا">Mozzila Developer Network</a>
-
-
-

الآن حرك مؤشر الفأرة فوق الرابط أدناه و شاهد ظهور مربع تلميح يحتوي الكتابة"زوروا موقع شبكة مطوري موزيلا.":

- Mozzila Developer Network -

التوافق مع المتصفحات.

-
- - - - - - - - - - - - - - - - - - -
- دعم المتصفحات لواصفة title
Internet ExplorerGoogle ChromeMozzila FirefoxOperaSafari
مدعومةمدعومةمدعومةمدعومةمدعومة
-

إستعمال الواصفة في JavaScript.

-

يمكن إستخدام هذه الواصفة في JavaScript.

-

الصيغة العامة لإستخدام واصفة العنوان في JavaScript:

-
-
document.getElementById(Some_Id).title="Your Text Goes Here..."; //تعيين نص ما ليتم عرضه.
-document.getElementById(Some_Id).title=null; //عدم عرض أي نص.
-
-
-

توافق واصفة العنوان مع الكائنات الأخرى في JavaScript.

-

بما أن واصفة العنوان من النوع العام,فهي متوافقة مع جميع كائنات JavaScript.

-

روابط ذات صلة بالموضوع:

-تخصيص واصفة العنوان في معايير منظمة W3C. diff --git a/files/ar/tools/browser_console/index.html b/files/ar/tools/browser_console/index.html deleted file mode 100644 index 81a9a8d321..0000000000 --- a/files/ar/tools/browser_console/index.html +++ /dev/null @@ -1,181 +0,0 @@ ---- -title: Browser Console -slug: Tools/Browser_Console -translation_of: Tools/Browser_Console ---- -

{{ToolsSidebar}}

- -

The Browser Console is like the Web Console, but applied to the whole browser rather than a single content tab.

- -

So it logs the same sorts of information as the Web Console - network requests, JavaScript, CSS, and security errors and warnings, and messages explicitly logged by JavaScript code. However, rather than logging this information for a single content tab, it logs information for all content tabs, for add-ons, and for the browser's own code.

- -

If you also want to use the other web developer tools in the regular Web Toolbox with add-on or browser code, consider using the Browser Toolbox.

- -

Similarly, you can execute JavaScript expressions using the Browser Console. But while the Web Console executes code in the page window scope, the Browser Console executes them in the scope of the browser's chrome window. This means you can interact with all the browser's tabs using the gBrowser global, and even with the XUL used to specify the browser's user interface.

- -
-

NB: The Browser Console command line (to execute JavaScript expressions) is disabled by default. To enable it set the devtools.chrome.enabled preference to true in about:config, or set the "Enable browser {{Glossary("chrome")}} and add-on debugging toolboxes" (Firefox 40 and later)  option in the developer tool settings.

-
- -

Opening the Browser Console

- -

You can open the Browser Console in one of two ways:

- -
    -
  1. from the menu: select "Browser Console" from the Web Developer submenu in the Firefox Menu (or Tools menu if you display the menu bar or are on macOS).
  2. -
  3. from the keyboard: press Ctrl+Shift+J (or Cmd+Shift+J on a Mac).
  4. -
- -

You can also start the Browser Console by launching Firefox from the command line and passing the -jsconsole argument:

- -
/Applications/FirefoxAurora.app/Contents/MacOS/firefox-bin -jsconsole
- -

The Browser Console looks like this:

- -

- -

You can see that the Browser Console looks and behaves very much like the Web Console:

- - - -

Beginning with Firefox 68, the Browser Console allows you to show or hide messages from the content process (i.e. the messages from scripts in all the opened pages) by setting or clearing the checkbox labeled Show Content Messages. The following image shows the browser console focused on the same page as above after clicking on the Show Content Messages checkbox.

- -

- -

Browser Console logging

- -

The Browser console logs the same sorts of messages as the Web Console:

- - - -

However, it displays such messages from:

- -
    -
  • web content hosted by all browser tabs
  • -
  • the browser's own code
  • -
  • add-ons.
  • -
- -

Messages from add-ons

- -

The Browser Console displays messages logged by all Firefox add-ons.

- -

Console.jsm

- -

To use the console API from a traditional or bootstrapped add-on, get it from the Console module.

- -

One exported symbol from Console.jsm is "console". Below is an example of how to access it, which adds a message to the Browser Console.

- -
Components.utils.import("resource://gre/modules/Console.jsm");
-console.log("Hello from Firefox code"); //output messages to the console
- -

Learn more:

- - - -

HUDService

- -

There is also the HUDService which allows access to the Browse Console. The module is available at Mozilla DXR. We see we can not only access the Browser Console but also Web Console.

- -

Here is an example on how to clear the contents of the Browser console:

- -
Components.utils.import("resource://devtools/shared/Loader.jsm");
-var HUDService = devtools.require("devtools/client/webconsole/hudservice");
-
-var hud = HUDService.getBrowserConsole();
-hud.jsterm.clearOutput(true);
- -

If you would like to access the content document of the Browser Console this can be done with the HUDService. This example here makes it so that when you mouse over the "Clear" button it will clear the Browser Console:

- -
Components.utils.import("resource://devtools/shared/Loader.jsm");
-var HUDService = devtools.require("devtools/client/webconsole/hudservice");
-
-var hud = HUDService.getBrowserConsole();
-
-var clearBtn = hud.chromeWindow.document.querySelector('.webconsole-clear-console-button');
-clearBtn.addEventListener('mouseover', function() {
-  hud.jsterm.clearOutput(true);
-}, false);
- -

Bonus Features Available

- -

For Add-on SDK add-ons, the console API is available automatically. Here's an example add-on that just logs an error when the user clicks a widget:

- -
widget = require("sdk/widget").Widget({
-  id: "an-error-happened",
-  label: "Error!",
-  width: 40,
-  content: "Error!",
-  onClick: logError
-});
-
-function logError() {
-  console.error("something went wrong!");
-}
- -

If you build this as an XPI file, then open the Browser Console, then open the XPI file in Firefox and install it, you'll see a widget labeled "Error!" in the Add-on bar:

- -

Click the icon. You'll see output like this in the Browser Console:

- -

- -

For Add-on SDK-based add-ons only, the message is prefixed with the name of the add-on ("log-error"), making it easy to find all messages from this add-on using the "Filter output" search box. By default, only error messages are logged to the console, although you can change this in the browser's preferences.

- -

Browser Console command line

- -
-

The Browser Console command line is disabled by default. To enable it set the devtools.chrome.enabled preference to true in about:config, or set the "Enable chrome debugging" option in the developer tool settings.

-
- -

Like the Web Console, the command line interpreter enables you to evaluate JavaScript expressions in real time:Also like the Web Console's command line interpreter, this command line supports autocomplete, history, and various keyboard shortcuts and helper commands. If the result of a command is an object, you can click on the object to see its details.

- -

But while the Web Console executes code in the scope of the content window it's attached to, the browser console executes code in the scope of the chrome window of the browser. You can confirm this by evaluating window:

- -

- -

This means you can control the browser: opening, closing tabs and windows and changing the content that they host, and modify the browser's UI by creating, changing and removing XUL elements.

- -

Controlling the browser

- -

The command line interpreter gets access to the tabbrowser object, through the gBrowser global, and that enables you to control the browser through the command line. Try running this code in the Browser Console's command line (remember that to send multiple lines to the Browser Console, use Shift+Enter):

- -
var newTabBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
-newTabBrowser.addEventListener("load", function() {
-  newTabBrowser.contentDocument.body.innerHTML = "<h1>this page has been eaten</h1>";
-}, true);
-newTabBrowser.contentDocument.location.href = "https://mozilla.org/";
- -

It adds a listener to the currently selected tab's load event that will eat the new page, then loads a new page.

- -
-

Note: You can restart the browser with the command Ctrl + Alt + R (Windows, Linux) or Cmd + Alt + R (Mac) This command restarts the browser with the same tabs open as before the restart.

-
- -

Modifying the browser UI

- -

Since the global window object is the browser's chrome window, you can also modify the browser's user interface. On Windows, the following code will add a new item to the browser's main menu:

- -
var parent = window.document.getElementById("appmenuPrimaryPane");
-var makeTheTea = gBrowser.ownerDocument.defaultView.document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuitem");
-makeTheTea.setAttribute("label", "A nice cup of tea?");
-parent.appendChild(makeTheTea);
- -

On macOS, this similar code will add a new item to the "Tools" menu:

- -
var parent = window.document.getElementById("menu_ToolsPopup");
-var makeTheTea = gBrowser.ownerDocument.defaultView.document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuitem");
-makeTheTea.setAttribute("label", "A nice cup of tea?");
-parent.appendChild(makeTheTea);
- -

diff --git a/files/ar/tools/index.html b/files/ar/tools/index.html deleted file mode 100644 index 7fe4951617..0000000000 --- a/files/ar/tools/index.html +++ /dev/null @@ -1,209 +0,0 @@ ---- -title: أدوات مطور فايرفوكس -slug: Tools -translation_of: Tools ---- -
{{ToolsSidebar}}
- -

Examine, edit, and debug HTML, CSS, and JavaScript on the desktop and on mobile.

- -

If you are looking for information on using the web developer tools available in Firefox, you've come to the right place — this page provides links to detailed information on all of the core tools and additional tools, and further information such as how to connect to and debug Firefox for Android, how to extend the devtools, and how to debug the browser as a whole.

- -

Please explore the links found in the sidebar, and further down the page. If you have any feedback or questions about the devtools, send us messages on our mailing list or IRC channel (see the community links near the bottom of the page). If you have any feedback or questions specifically about the documentation, the MDN discourse is a good place to post.

- -
-

Note: If you are just getting started with web development and using developer tools, our learning web development docs will help you — see Getting started with the Web and What are browser developer tools? for good starting points.

-
- -

The Core Tools

- -

You can open the Firefox Developer Tools from the menu by selecting Tools > Web Developer > Toggle Tools or use the keyboard shortcut Ctrl + Shift + I or F12 on Windows and Linux, or Cmd + Opt + I on macOS.

- -

The ellipsis menu on the right-hand side of Developer Tools, contains several commands that let you perform actions or change tool settings.

- -

- - - - - - - - - - - - - - - - - - - - - - - - -
This button only appears when there are multiple iframes on a page. Click it to display a list of the iframes on the current page and select the one with which you want to work.
Click this button to take a screenshot of the current page. (Note: This feature is not turned on by default and must be enabled in settings before the icon will appear.)
Toggles Responsive Design Mode.
Opens the menu that includes docking options, the ability to show or hide the split console, and Developer Tools settings. The menu also includes links to the documentation for Firefox Web Tools and the Mozilla Community.
Closes the Developer Tools
- -
-
-

Page Inspector

- -

The all-new Inspector panel in Firefox 57.

- -

View and edit page content and layout. Visualise many aspects of the page including the box model, animations, and grid layouts.

-
- -
-

Web Console

- -

The all-new Console in Firefox 57.

- -

See messages logged by a web page and interact with the page using JavaScript.

-
-
- -
-
-

JavaScript Debugger

- -

The all-new Firefox 57 Debugger.html

- -

Stop, step through, examine, and modify the JavaScript running in a page.

-
- -
-

Network Monitor

- -

The Network panel in Firefox 57 DevTools.

- -

See the network requests made when a page is loaded.

-
-
- -
-
-

Performance Tools

- -

Performance Tools in Firefox 57 Developer Tools

- -

Analyze your site's general responsiveness, JavaScript, and layout performance.

-
- -
-

Responsive Design Mode

- -

Responsive Design mode in Firefox 57.

- -

See how your website or app will look and behave on different devices and network types.

-
-
- -
-
-

Accessibility inspector

- -

Performance Tools in Firefox 57 Developer Tools

- -

Provides a means to access the page's accessibility tree, allowing you to check what's missing or otherwise needs attention.

-
- -
-
- -
-

Note: The collective term for the UI inside which the DevTools all live is the Toolbox.

-
- -

More Tools

- -

These developer tools are also built into Firefox. Unlike the "Core Tools" above, you might not use them every day.

- -
-
-
Memory
-
Figure out which objects are keeping memory in use.
-
Storage Inspector
-
Inspect cookies, local storage, indexedDB, and session storage present in a page.
-
DOM Property Viewer
-
Inspect the page's DOM properties, functions, etc.
-
Eyedropper
-
Select a color from the page.
-
Scratchpad
-
A text editor built into Firefox that lets you write and execute JavaScript.
-
Style Editor
-
View and edit CSS styles for the current page.
-
Taking screenshots
-
Take a screenshot of the entire page or of a single element.
-
Measure a portion of the page
-
Measure a specific area of a web page.
-
Rulers
-
Overlay horizontal and vertical rulers on a web page
-
-
- -
-
-

- -

For the latest developer tools and features, try Firefox Developer Edition.

- -

Download Firefox Developer Edition

-
- -
-
- -

Connecting the Developer Tools

- -

If you open the developer tools using keyboard shortcuts or the equivalent menu items, they'll target the document hosted by the currently active tab. But you can attach the tools to a variety of other targets, too, both within the current browser and in different browsers or even different devices.

- -
-
-
about:debugging
-
Debug add-ons, content tabs, and workers running in the browser.
-
Connecting to Firefox for Android
-
Connect the developer tools to an instance of Firefox running on an Android device.
-
Connecting to iframes
-
Connect the developer tools to a specific iframe in the current page.
-
Connecting to other browsers
-
Connect the developer tools to Chrome on Android and Safari on iOS.
-
-
- -

Debugging the browser

- -

By default, the developer tools are attached to a web page or web app. But you can also connect them to the browser as a whole. This is useful for browser and add-on development.

- -
-
-
Browser Console
-
See messages logged by the browser itself and by add-ons, and run JavaScript code in the browser's scope.
-
Browser Toolbox
-
Attach the Developer Tools to the browser itself.
-
-
- -

Extending the devtools

- -

For information on extending the Firefox DevTools, see Extending the developer tools over in the Browser Extensions section of MDN.

- -

Migrating from Firebug

- -

Firebug has come to the end of its lifespan (see Firebug lives on in Firefox DevTools for details of why), and we appreciate that some people will find migrating to another less familiar set of DevTools to be challenging. To ease a transition from Firebug to the Firefox developer tools, we have written a handy guide — Migrating from Firebug.

- -

Contribute

- -

If you want to help improve the developer tools, these resources will get you started.

- -
-
-
Get Involved
-
Our developer documentation explains how to get involved.
-
bugs.firefox-dev.tools
-
A tool helping to find bugs to work on.
-
-
diff --git a/files/ar/tools/page_inspector/how_to/index.html b/files/ar/tools/page_inspector/how_to/index.html deleted file mode 100644 index 2f18038ec9..0000000000 --- a/files/ar/tools/page_inspector/how_to/index.html +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: How to -slug: Tools/Page_Inspector/How_to -tags: - - NeedsTranslation - - TopicStub -translation_of: Tools/Page_Inspector/How_to ---- -
{{ToolsSidebar}}

Links for various HOW TO's can be found here. These links describe in depth the HOW TO techniques.

- -

{{ ListSubpages () }}

- -

 

diff --git a/files/ar/tools/page_inspector/index.html b/files/ar/tools/page_inspector/index.html deleted file mode 100644 index 518af28f10..0000000000 --- a/files/ar/tools/page_inspector/index.html +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: Page Inspector -slug: Tools/Page_Inspector -tags: - - CSS - - DOM - - HTML - - NeedsTranslation - - Stylesheets - - TopicStub - - Web Development - - 'Web Development:Tools' - - 'l10n:priority' -translation_of: Tools/Page_Inspector ---- -
{{ToolsSidebar}}
- -

Use the Page Inspector to examine and modify the HTML and CSS of a page.

- -

You can examine pages loaded in the local copy of Firefox or in a remote target such as Firefox for Android. See remote debugging to learn how to connect the developer tools to a remote target.

- -
-

User Interface Tour

- -

To find your way around the Inspector, here's a quick tour of the UI.

- -

You can split the Rules view out into its own pane, separate from the other tabs on the CSS pane — this is called 3-pane mode.

- -
-

How to

- -

To find out what you can do with the Inspector, see the following how to guides:

- - - -
-

Reference

- - diff --git a/files/ar/tools/storage_inspector/index.html b/files/ar/tools/storage_inspector/index.html deleted file mode 100644 index b4292a14ea..0000000000 --- a/files/ar/tools/storage_inspector/index.html +++ /dev/null @@ -1,112 +0,0 @@ ---- -title: Storage Inspector -slug: Tools/Storage_Inspector -translation_of: Tools/Storage_Inspector ---- -
{{ToolsSidebar}}
- -

The Storage Inspector enables you to inspect various types of storage that a web page can use. Currently it can be used to inspect the following storage types:

- -
    -
  • Cache Storage — any DOM caches created using the Cache API.
  • -
  • Cookies — All the cookies created by the page or any iframes inside of the page. Cookies created as a part of response of network calls are also listed, but only for calls that happened while the tool is open.
  • -
  • IndexedDB — All IndexedDB databases created by the page or any iframes inside the page, their Object Stores and the items stored in these Object Stores.
  • -
  • Local Storage — All local storage items created by the page or any iframes inside the page.
  • -
  • Session Storage — All session storage items created by the page or any iframes inside the page.
  • -
- -

For the time being, the Storage Inspector only gives you a read-only view of storage. But we're working to let you edit storage contents in future releases.

- -

Opening the Storage Inspector

- -

You can open the Storage Inspector by selecting "Storage Inspector" from the Web Developer submenu in the Firefox Menu Panel (or Tools menu if you display the menu bar or are on macOS), or by pressing its Shift + F9 keyboard shortcut.

- -

The Toolbox will appear at the bottom of the browser window, with the Storage Inspector activated. It's just called "Storage" in the Developer Toolbox.

- -

- -

Storage Inspector User Interface

- -

The Storage Inspector UI is split into three main components:

- - - -

- -

Storage tree

- -

The storage tree lists all the storage types that the Storage Inspector can inspect:

- -

- -

Under each type, objects are organized by origin. For cookies, the protocol does not differentiate the origin. For Indexed DB or local storage an origin is a combination of protocol + hostname. For example, "http://mozilla.org" and "https://mozilla.org" are two different origins so local storage items cannot be shared between them.

- -

Under "Cache Storage", objects are organized by origin and then by the name of the cache:

- -

- -

IndexedDB objects are organized by origin, then by database name, then by object store name:

- -

- -

With the Cookies, Local Storage, and Session Storage types, there's only one level in the hierarchy, so stored items are listed directly under each origin:

- -

- -

You can click on each item in the tree to expand or collapse its children. The tree is live, so if a new origin gets added (by adding an iframe, for example), it will be added to each storage type automatically.

- -

Clicking on a tree item will display detailed information about that item in the Table Widget on the right. For example, clicking on an origin which is a child of the Cookies storage type will show all the cookies belonging to that domain.

- -

Table Widget

- -

The table widget displays a list of all the items corresponding to the selected tree item (be it an origin, or database) are listed. Depending on the storage type and tree item, the number of columns in the table might differ.

- -

All the columns in a Table Widget are resizable. You can hide and show columns by context-clicking on the table header and selecting the columns you want to see:

- -

- - - -

There's a search box at the top of the Table Widget:

- -

- -

This filters the table to show only items which match the search term. Items match the search term if any of their fields (including fields whose columns you have hidden) contain the search term.

- -

You can use Ctrl + F (Cmd + F on a Mac) to focus the search box.

- -

Add and refresh storage

- -

You'll also have buttons available to add a new storage entry or refresh the view of the currently viewed storage type where applicable (you can't add new entries to IndexedDB or Cache):

- -

- - - -

When you select any row in the Storage table widget, the sidebar is shown with details about that row. If a cookie is selected, it will list all the details about that cookie.

- -

The sidebar can parse the value of the cookie or local storage item or an IndexedDB item and convert it into a meaningful object instead of just a string. For example:

- -
    -
  • A stringified JSON like '{"foo": "bar"}' is shown as the origin JSON: {foo: "bar"}.
  • -
  • A string containing a key separated value, like "1~2~3~4" or "1=2=3=4" is shown like an array: [1, 2, 3, 4].
  • -
  • A string containing key-value pairs, like "ID=1234:foo=bar" is shown as JSON: {ID:1234, foo: "bar"}.
  • -
- -

The shown values can also be filtered using the search box at the top of the sidebar.

- -

Working with the Storage Inspector

- -

The following articles cover different aspects of using the network monitor:

- - diff --git a/files/ar/tools/web_console/index.html b/files/ar/tools/web_console/index.html deleted file mode 100644 index f209646681..0000000000 --- a/files/ar/tools/web_console/index.html +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: Web Console -slug: Tools/Web_Console -tags: - - أدوات - - الأمان - - التصحيح - - التنقيح - - تطوير الويب - - 'تطوير الويب: أدوات' - - وحدة تحكم الويب -translation_of: Tools/Web_Console ---- -

وحدة تحكم الويب:

- -
    -
  1. تسجل المعلومات المرتبطة بصفحة الويب: طلبات الشبكة، جافا سكريبت، CSS, أخطاء الأمان و التحذيرات باﻹضافة إلى اﻷخطاء، التحذير والرسائل الإعلامية التي يتم تسجيلها بشكل صريح من خلال شفرة جافا سكريبت التي تعمل في سياق الصفحة
  2. -
  3. تمكّنك من التفاعل مع صفحة الويب عن طريق تنفيذ تعبيرات جافا سكريبت في سياق الصفحة
  4. -
- -

{{EmbedYouTube("C6Cyrpkb25k")}}

- -
-
-
-
فتح وحدة تحكم الويب
-
كيف تبدأ إستعمال وحدة تحكم الويب.
-
مفسّر سطر الأوامر
-
كيف تتفاعل مع مستند بإستعمال وحدة التحكم.
-
وحدة التحكم
-
إستخدم وحدة التحكم بجانب الأدوات الأخرى.
-
-
- -
-
-
رسائل وحدة التحكم
-
تفاصيل الرسائل التي تسجلها وحدة التحكم.
-
خرج غني
-
شاهد و تفاعل مع الكائنات التي تسجلها وحدة التحكم.
-
إختصارات لوحة المفاتيح
-
مرجع اﻹختصار.
-
-
-
diff --git a/files/ar/tools/web_console/the_command_line_interpreter/index.html b/files/ar/tools/web_console/the_command_line_interpreter/index.html deleted file mode 100644 index 119cc57f13..0000000000 --- a/files/ar/tools/web_console/the_command_line_interpreter/index.html +++ /dev/null @@ -1,185 +0,0 @@ ---- -title: The JavaScript input interpreter -slug: Tools/Web_Console/The_command_line_interpreter -translation_of: Tools/Web_Console/The_command_line_interpreter ---- -
{{ToolsSidebar}}
- -

You can interpret JavaScript expressions in real time using the interpreter provided by the Web Console. It has two modes: single-line entry and multi-line entry.

- -

Single-line mode

- -

For single-line entry, you can type JavaScript expressions in the field at the bottom of the console log, at the >> prompt.

- -

The Web Console, showing single-line mode

- -

To enter expressions in single-line mode, type at the prompt and press Enter. To enter multi-line expressions, press Shift+Enter after typing each line, then Enter to run all the entered lines.

- -

The expression you type is echoed under the input prompt, followed by the result.

- -

If your input does not appear to be complete when you press Enter, then the Console treats this as Shift+Enter , enabling you to finish your input.

- -

For example, if you type:

- -
function foo() {
- -

and then Enter, the Console does not immediately execute the input, but behaves as if you had pressed Shift+Enter , so you can finish entering the function definition.

- -

Multi-line mode

- -

For multi-line entry, click the "split pane" icon at the right hand side of the single-line entry field, or press  Ctrl+B (Windows/Linux) or Cmd+B (macOS). The multi-line editing pane opens on the left side the of Web Console.

- -

Web Console in multi-line mode

- -

You can enter multiple lines of JavaScript by default in this mode, pressing Enter after each one. To execute the snippet that is currently in the editing pane, click the Run button or press Ctrl+Enter (or Cmd+Return on MacOS). The snippet is echoed under the input prompt (in the right-side pane), followed by the result. You can also select a range of lines in the editing pane, and run just the code on those lines.

- -

Starting in Firefox 76, if the code snippet is more than five lines long, only the first five lines are echoed in the console, preceeded by a disclosure triangle (or "twistie"), and followed by an ellipsis (…). Click anywhere in the area containing the echoed code to show the whole snippet; click again in that area to collapse it.

- -

You can open files when in multi-line mode, and save the current contents of the editing pane to a file.

- -
    -
  • To open a file, press Ctrl+O (Cmd+O on MacOS). A file dialog box opens so you can select the file to open.
  • -
  • To save the contents of the editing pane, press Ctrl+S (Cmd+S on MacOS). A file dialog box opens so you can specify the location to save to.
  • -
- -

To switch back to single-line mode, click the X icon at the top of the multi-line editing pane, or press  Ctrl+B (Windows/Linux) or Cmd+B (MacOS).

- -

Accessing variables

- -

You can access variables defined in the page, both built-in variables like window and variables added by JavaScript libraries like jQuery:

- -

- -

Autocomplete

- -

The editor has autocomplete: enter the first few letters and a popup appears with possible completions:

- -

- -

Press  Enter, Tab, or the right arrow key to accept the suggestion, use the up/down arrows to move to a different suggestion, or just keep typing if you don't like any of the suggestions.

- -

Console autocomplete suggestions are case-insensitive.

- -

The console suggests completions from the scope of the currently executing stack frame. This means that if you've hit a breakpoint in a function you get autocomplete for objects local to the function.

- -

You get autocomplete suggestions for array elements, as well:

- -

- -

You can enable or disable autocompletion via the Settings ("gear") menu in the Web Console toolbar. The menuitem Enable Autocompletion has a checkmark next to it when the feature is enabled, which is missing when it is disabled. Select the menuitem to change the state.

- -

Instant evaluation

- -
-

This feature is available in Firefox Nightly, in versions labeled 74 and later.

-
- -

When the "instant evaluation" feature is enabled, the interpreter displays results of expressions as you're typing them in single-line mode. Note that the result might be an error message. Expressions that have side effects are not evaluated.

- -

You can enable or disable instant evaluation via the Settings ("gear") menu in the Web Console toolbar. The menuitem Instant Evaluation has a checkmark next to it when the feature is enabled, which is missing when it is disabled. Select the menuitem to change the state.

- -

Execution context

- -

Code that you have executed becomes part of the execution context, regardless of what editing mode you were in when you executed it. For example, if you type a function definition in the multi-line editor, and click Run, you can switch to single-line mode and still use your function.

- -

Syntax highlighting

- -

Console output showing syntax highlighting

- -

The text you enter has syntax highlighting as soon as you have typed enough for the highlighter to parse it and infer the meanings of the "words".

- -

The output is highlighted as well where appropriate.

- -
-

Note: Syntax highlighting is not visible in your browser if Accessibility features have been enabled.

-
- -

Execution history

- -

The interpreter remembers expressions you've typed. To move back and forward through your history:

- -
    -
  • In single-line mode, use the up and down arrows. 
  • -
  • In multi-line mode, use the  and icons in the editing panel's toolbar.
  • -
- -

The expression history is persisted across sessions. To clear the history, use the clearHistory() helper function.

- -

You can initiate a reverse search through the expression history, much like you can in bash on Linux and Mac or PowerShell on Windows. On Windows and Linux press F9. On Mac press Ctrl+R (note: not Cmd+R!) to initiate the reverse search.

- -

- -

Enter the text you want to search for in the input box at the bottom of the Console. Start typing part of the expression you are looking for and the first match is displayed in the console. Repeatedly typing F9 on Windows and Linux ( Ctrl+R on Mac) cycles backwards through the matches.

- -

- -

Once you  have initiated the reverse search, you can use Shift + F9 on Windows or Linux ( Ctrl+S on Mac) to search forward in the list of matches. You can also use the  and icons in the expression search bar.

- -

When you find the expression you want, press Enter (Return) to execute the statement.

- -

Working with iframes

- -

If a page contains embedded iframes, you can use the cd() function to change the console's scope to a specific iframe, and then you can execute functions defined in the document hosted by that iframe. There are three ways to select an iframe using cd():

- -

You can pass the iframe DOM element:

- -
var frame = document.getElementById("frame1");
-cd(frame);
- -

You can pass a CSS selector that matches the iframe:

- -
cd("#frame1");
- -

You can pass the iframe's global window object:

- -
var frame = document.getElementById("frame1");
-cd(frame.contentWindow);
-
- -

To switch the context back to the top-level window, call cd() with no arguments:

- -
cd();
- -

For example, suppose we have a document that embeds an iframe:

- -
<!DOCTYPE html>
-<html>
-  <head>
-    <meta charset="UTF-8">
-  </head>
-  <body>
-    <iframe id="frame1" src="static/frame/my-frame1.html"></iframe>
-  </body>
-</html>
- -

The iframe defines a new function:

- -
<!DOCTYPE html>
-<html>
-  <head>
-    <meta charset="UTF-8">
-    <script>
-      function whoAreYou() {
-        return "I'm frame1";
-      }
-   </script>
-  </head>
-  <body>
-  </body>
-</html>
- -

You can switch context to the iframe like this:

- -
cd("#frame1");
- -

Now you'll see that the global window's document is the iframe:

- -

- -

And you can call the function defined in the iframe:

- -

- -

Helper commands

- -

{{ page("en-US/docs/Tools/Web_Console/Helpers", "The commands") }}

diff --git a/files/ar/web/accessibility/index.html b/files/ar/web/accessibility/index.html deleted file mode 100644 index de5fd7a935..0000000000 --- a/files/ar/web/accessibility/index.html +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: الإتاحة -slug: Web/Accessibility -tags: - - الإتاحة - - صفحة هبوط -translation_of: Web/Accessibility ---- -

تعني الإتاحة (Accessibility)، في مفهوم تطوير الويب، تمكين أكبر قدر ممكن من الأشخاص من استخدام مواقع الويب، حتى وإن كانت قدراتهم محدودة بطريقةٍ ما (لديهم إعاقات). يوجد في هذه الصفحة معلومات حول تطوير محتوى سهل الوصول إليه (مُتاح).

- -

"غالباً ما تستخدم الإتاحة لوصف وسائل التسهيل التي تساعد الأشخاص ممن لديهم إعاقات، مثل المقاعد المُتحركة". هذا ممكن أن يمتد ليشمل لافتات برايل (لافتات مُخصصة للإشارة لشيء ما)، الرصائف المُنحدِرة للكراسي المتحركة (التي تساعد الكرسي المُتحرِك على الصعود بيسر)، الإشارات الصوتيّة عند معابر المُشاة، تصاميم المواقع، وهلمَّ جرا." مقالة ويكبيديا عن الإتاحة (النسخة العربيّة)

- -

"صُمِمَ الويب بشكل أساسي ليعمل لدى الجميع، بغض النظر عن عتادهم (الأجهزة التي يستخدمونها)، تجهيزاتِهم البرمجيّة (نظام التشغيل، المتُصفح ...إلخ)، لغتهم، ثقافتُهم، مكان تواجدهم، أو قدرتهم الجسديّة أو العقليّة. عندما يحقق الويب هذه الأهداف، سيكون مُتاح للوصول من قبل الأشخاص الذين لديهم قدرات سمعيّة، حركيّة، بصريّة، ومعرفيّة مختلفة".الإتاحة في موسوعة

- -
-
-

دروس رئيسيّة

- -

يحتوي قسم تعلم الإتاحة على دورات دائمة التحديث وعصريّة تُغطي جميع نقاط الإتاحة الأساسيّة:

- -
-
ما هي الإتاحة؟
-
تُمثِل هذه المقالة بداية للوحدة، بحيث تعطيك لمحة عن ماهيّة الإتاحة، فهي تتضمن معلومات عن مجموعة الأشخاص الذين يشملهم هذا المصطلح ولماذا، الأدوات المُختلفة التي تُستخدَم للتعامل مع الويب، وكيف يمكننا جعل الإتاحة جزءً لا يتجزأ من عمليّة تطوير الويب.
-
أساسيات مهمة في لغة ترميز النص الفائق للعمل مع الإتاحة
-
يمكن جعل جزء كبير من محتوى الويب مُتاحاً؛ عبر التأكُّد من استخدام عناصر لغة ترميز النص الفائق الصحيحة في أماكنها الصحيحة وبالوقت المناسب. هذه المقالة تتعمق بالتفصيل في كيفيّة استخدام هذه اللغة لضمان الاستفادة بالحد الأقصى من الإتاحة.
-
أفضل الطرق لاستخدام صفحات الأنماط الانسيابية والجافاسكربت لإتاحة أفضل
-
يُمكِّن أيضاً الاستخدام الصحيح لهاتين اللغتين توفير تجربة ويب أفضل، أو يمكن أن يجعلها أسوء إذا أُسيءَ استخدام هاتِه اللغات. تُعَنوِن هذه المقالة بعض استخدامات صفحات الأنماط الانسيابية والجافاسكربت الفضلى التي يجب اخذها بعين الاعتبار لضمان جعل المحتوى المُعقَد مُتاحاً قدر الإمكان.
-
أساسيات تقنيّة WAI-ARIA
-
إكمالاً للمقالة السابقة، من الصعب في بعض الأحيان إنشاء عنصر تحكم رسوميّة تستخدم عناصر من لغة ترميز النص الفائق غير دلاليّة (أي وظيفتها غير واضحة من اسمها، مما يجعل تذكر العنصر وفهمه أصعب - unsemantic) ومحتوى جافاسكربت مُحدَث تلقائياً. يمكن لهذه التقنيّة المساعدة في حل هذه المشكلات عبر إضافة المزيد من العناصر الدلاليّة (semantic) التي يُمكِن للمتصفحات التعرُّف عليها واستخدامها لجعل المستخدمين يفهمون الأمور بشكل أوضح. سنشرح في هذه المقالة كيفيّة استخدام هذه التقنيّة لتحسين التجربة الإتاحيّة.
-
الوسائط المُتاحة
-
هناك فئة أخرى من المحتوى تُحدِث مشاكل إتاحيّة وهي الوسائط المتعددة (multimedia) - محتوى الفيديو، الصوت، والصورة يجب أن يُعطى نصاً بديلاً يشرحه؛ كي تتمكن التقنيات المعاونة (المساعدة - assistive) ومستخدميها من فهم المحتوى. تشرح هذه المقالة كيفيّة القيام بذلك.
-
الإتاحة الخلويّة (Mobile Accessibility)
-
نظراً لشيوع الوصول إلى محتوى الويب عبر الهواتف، ولامتلاك منصات الهواتف الشهيرة، مثل iOS والأندرويد، على أدوات لهذا الغرض، أصبح من المهم الاهتمام بإتاحة محتواك على هذه المنصات. تتعمق هذه المقالة في الاعتبارات التي يجب أن تؤخذ عند إتاحة محتوى الويب للهواتف.
-
-
- -
-

توثيقات أخرى

- -
-
دروس إرشاديّة لفهم إتاحة محتوى الويب
-
توفر مجموعة المقالات هذه شرح سريع لمساعدتك على فهم الخطوات التي يجب أن تؤخذ لتطبيق التوصيات المشروحة في أدلة (guidelines) W3C لإتاحة محتوى الويب 2.0 (إختصاراً WCAG).
-
عناصر الجافا سكربت القابلة للتنقل بلوحة المفاتيح
-
حتى الآن، يفتقر مطورو الويب الذين يقومون بصناعة عناصر رسوميّة (widgets) باستخدام العنصر <div> و <span> إلى التقنيات المناسبة. الوصوليّة بلوحة المفاتيح (Keyboard accessibility) هي من أقل متطلبات الإتاحة والتي يجب على المطورين الاهتمام بها.
-
تطبيقات الأنترنت سهلة الوصول (ARIA)
-
مجموعة من المقالات تشرح كيفيّة استخدام تقنيّة ARIA لجعل مستندات لغة ترميز النص الفائق سهلة الوصول بشكل أكبر.
-
تطوير التقنيات المعاونة (AT)
-
مجموعة من المقالات مخصصة لمطورين التقنيات المعاونة.
-
قائمة تقنيات الإتاحة للجوال
-
تهدف هذه المقالة إلى توفير قائمة مُختصرة لمتطلبات الإتاحة لمطورين تطبيقات الهواتف.
-
- -

عرض المزيد...

-
-
diff --git a/files/ar/web/api/attr/index.html b/files/ar/web/api/attr/index.html deleted file mode 100644 index 0b01877112..0000000000 --- a/files/ar/web/api/attr/index.html +++ /dev/null @@ -1,157 +0,0 @@ ---- -title: Attr -slug: Web/API/Attr -translation_of: Web/API/Attr ---- -

{{APIRef("DOM")}}

- -

The Attr interface represents one of a DOM element's attributes as an object. In most DOM methods, you will directly retrieve the attribute as a string (e.g., {{domxref("Element.getAttribute()")}}), but certain functions (e.g., {{domxref("Element.getAttributeNode()")}}) or means of iterating return Attr types.

- -

{{InheritanceDiagram}}

- -
Warning: Starting in Gecko 7.0 {{geckoRelease("7.0")}}, a number of deprecated properties and methods output warning messages to the console. You should revise your code accordingly. See Deprecated properties and methods for a complete list.
- -

Properties

- -
-
{{domxref("Attr.name", "name")}} {{readOnlyInline}}
-
The attribute's name.
-
{{domxref("Attr.namespaceURI", "namespaceURI")}} {{readOnlyInline}}
-
A {{domxref("DOMString")}} representing the namespace URI of the attribute, or null if there is no namespace.
-
{{domxref("Attr.localName", "localName")}} {{readOnlyInline}}
-
A {{domxref("DOMString")}} representing the local part of the qualified name of the attribute.
-
{{domxref("Attr.prefix", "prefix")}} {{readOnlyInline}}
-
A {{domxref("DOMString")}} representing the namespace prefix of the attribute, or null if no prefix is specified.
-
{{domxref("Attr.ownerElement", "ownerElement")}} {{readOnlyInline}}
-
-

The element holding the attribute.

- -
-

Note: DOM Level 4 removed this property. The assumption was that since you get an Attr object from an {{domxref("Element")}}, you should already know the associated element.
- As that doesn't hold true in cases like Attr objects being returned by {{domxref("Document.evaluate")}}, the DOM Living Standard reintroduced the property.

- -

Gecko outputs a deprecation note starting from Gecko 7.0 {{geckoRelease("7.0")}}. This note was removed again in Gecko 49.0 {{geckoRelease("49.0")}}.

-
-
-
{{domxref("Attr.specified", "specified")}} {{readOnlyInline}}
-
This property always returns true. Originally, it returned true if the attribute was explicitly specified in the source code or by a script, and false if its value came from the default one defined in the document's DTD.
-
{{domxref("Attr.value", "value")}}
-
The attribute's value.
-
- -
-

Note: DOM Level 3 defined namespaceURI, localName and prefix on the {{domxref("Node")}} interface. In DOM4 they were moved to Attr.

- -

This change is implemented in Chrome since version 46.0 and Firefox since version 48.0.

-
- -

Deprecated properties and methods

- -

The following properties have been deprecated. Where available, the appropriate replacement is noted.

- -
-
attributes
-
This property now always returns NULL.
-
childNodes {{obsolete_inline(14)}}
-
This property now always returns an empty {{domxref("NodeList")}}.
-
firstChild {{obsolete_inline(14)}}
-
This property now always returns NULL.
-
isId {{readOnlyInline}}
-
Indicates whether the attribute is an "ID attribute". An "ID attribute" being an attribute which value is expected to be unique across a DOM Document. In HTML DOM, "id" is the only ID attribute, but XML documents could define others. Whether or not an attribute is unique is often determined by a {{Glossary("DTD")}} or other schema description.
-
lastChild {{obsolete_inline(14)}}
-
This property now always returns NULL.
-
nextSibling
-
This property now always returns NULL.
-
nodeName
-
Use {{domxref("Attr.name")}} instead.
-
nodeType
-
This property now always returns 2 (ATTRIBUTE_NODE).
-
nodeValue
-
Use {{domxref("Attr.value")}} instead.
-
ownerDocument
-
You shouldn't have been using this in the first place, so you probably don't care that this is going away.
-
parentNode
-
This property now always returns NULL.
-
previousSibling
-
This property now always returns NULL.
-
schemaTypeInfo {{obsolete_inline}} {{readOnlyInline}}
-
The type information associated with this attribute. While the type information contained in this attribute is guaranteed to be correct after loading the document or invoking {{domxref("Document.normalizeDocument")}}, this property may not be reliable if the node was moved.
-
specified
-
This property now always returns true.
-
textContent
-
Use {{domxref("Attr.value")}} instead.
-
- -

The following methods have been deprecated:

- -
-
appendChild() {{obsolete_inline(14)}}
-
Modify the value of {{domxref("Attr.value")}} instead.
-
cloneNode()
-
You shouldn't have been using this in the first place, so you probably don't care that this is going away.
-
createAttribute()
-
Use {{domxref("Element.setAttribute()")}} instead.
-
createAttributeNS()
-
Use {{domxref("Element.setAttributeNS()")}} instead.
-
getAttributeNode()
-
Use {{domxref("Element.getAttribute()")}} instead.
-
getAttributeNodeNS()
-
Use {{domxref("Element.getAttributeNS()")}} instead.
-
hasAttributes() {{obsolete_inline("21.0")}}
-
This method now always returns false.
-
hasChildNodes()
-
This method now always returns false.
-
insertBefore()
-
Modify the value of {{domxref("Attr.value")}} instead.
-
isSupported()
-
You shouldn't have been using this in the first place, so you probably don't care that this is going away.
-
isEqualNode()
-
You shouldn't have been using this in the first place, so you probably don't care that this is going away.
-
normalize()
-
You shouldn't have been using this in the first place, so you probably don't care that this is going away.
-
removeAttributeNode()
-
Use {{domxref("Element.removeAttribute()")}} instead.
-
removeChild() {{obsolete_inline(14)}}
-
Modify the value of {{domxref("Attr.value")}} instead.
-
replaceChild() {{obsolete_inline(14)}}
-
Modify the value of {{domxref("Attr.value")}} instead.
-
setAttributeNode()
-
Use {{domxref("Element.setAttribute()")}} instead.
-
setAttributeNodeNS()
-
Use {{domxref("Element.setAttributeNS()")}} instead.
-
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName("DOM WHATWG", "#interface-attr", "Attr")}}{{Spec2("DOM WHATWG")}}Added ownerElement property back
{{SpecName("DOM4", "#interface-attr", "Attr")}}{{Spec2("DOM4")}}Moved namespaceURI, prefix and localName from {{domxref("Node")}} to this API and removed ownerElement, schemaTypeInfo and isId.
{{SpecName("DOM3 Core", "core.html#ID-637646024", "Attr")}}{{Spec2("DOM3 Core")}}Initial definition
- -

Browser compatibility

- - - -

{{Compat("api.Attr")}}

diff --git a/files/ar/web/api/canvas_api/index.html b/files/ar/web/api/canvas_api/index.html deleted file mode 100644 index e28c5e7a96..0000000000 --- a/files/ar/web/api/canvas_api/index.html +++ /dev/null @@ -1,169 +0,0 @@ ---- -title: الواجهة البرمجية لرقعة الرسم -slug: Web/API/Canvas_API -tags: - - API - - رقعة رسم - - مرجع - - نظرة عامة -translation_of: Web/API/Canvas_API ---- -
{{CanvasSidebar}}
- -

في HTML5، أُضيف عنصر HTML ‏{{HTMLElement("canvas")}} والذي يمكن استخدامه لرسم الرسوميات ببرمجتها عبر جافاسكربت. فمثلا، يمكن استخدامها لرسم الرسوم البيانية، أو تراكبات الصور، أو إنشاء الحركات أو حتى معالجة الفديوهات آنيا وتصييرها.

- -

حصلت تطبيقات موزيلا على دعم <canvas> بدءًا من إصدارة جيكو رقم ١٫٨ (أي فَيَرفُكس ١٫٥). طُوّر هذا العنصر على يد شركة آبل للوحة أوإس إكس وسفاري. يدعم إنترنت إكسبلورر <canvas> بدءًا من الإصدارة التاسعة فما فوق، بينما الإصدارات الأقدم منه تحتاج سكربتا ليعمل عنصر رقعة الرسم بكفاءة، هذا السكربت هو من مشروع جوجل باسم Explorer Canvas. يدعم جوجل كروم وأوبرا ٩ عتصر <canvas> أيضا.

- -

يُستخدم عنصر <canvas> في تقنية WebGL أيضا لرسم الرسومات ثلاثية الأبعاد على صفحات الوب بتسريع عتادي.

- -

مثال

- -

هذه عيّنة مقتطفة من كود يستخدم طريقة {{domxref("CanvasRenderingContext2D.fillRect()")}}.

- -

HTML

- -
<canvas id="canvas"></canvas>
-
- -

جافاسكربت

- -
var canvas = document.getElementById('canvas');
-var ctx = canvas.getContext('2d');
-
-ctx.fillStyle = 'green';
-ctx.fillRect(10, 10, 100, 100);
-
- -

حرّر الكود أدناه لترى التغييرات تحدث آنيا في رقعة الرسم:

- - - -

{{ EmbedLiveSample('Playable_code', 700, 360) }}

- -

المرجع

- -
-
    -
  • {{domxref("HTMLCanvasElement")}}
  • -
  • {{domxref("CanvasRenderingContext2D")}}
  • -
  • {{domxref("CanvasGradient")}}
  • -
  • {{domxref("CanvasImageSource")}}
  • -
  • {{domxref("CanvasPattern")}}
  • -
  • {{domxref("ImageBitmap")}}
  • -
  • {{domxref("ImageData")}}
  • -
  • {{domxref("RenderingContext")}}
  • -
  • {{domxref("TextMetrics")}}
  • -
  • {{domxref("OffscreenCanvas")}}{{experimental_inline}}
  • -
  • {{domxref("Path2D")}} {{experimental_inline}}{{domxref("ImageBitmapRenderingContext")}}{{experimental_inline}}
  • -
-
- -

الواجهات المتعلقة بِ‍ WebGLRenderingContext مذكورة في مرجع WebGL.

- -

واجهة {{domxref("CanvasCaptureMediaStream")}} لها علاقة أيضا.

- -

الأدلة والدروس

- -
-
درس رقعة الرسم
-
درس شامل يغطي كلا من الاستخدام البسيط لرقعة الرسم <canvas> وأيضا مزاياها المتقدمة.
-
مقتطفات من كود: رقعة الرسم
-
بعض المقتطفات المخصصة لمطوري الامتدادات والتي تستخدم  <canvas>.
-
Demo: A basic ray-caster
-
عرض لحركة تعقّب الأشعة باستخدام رقعة الرسم.
-
رسم كائنات DOM في رقعة رسم
-
طريقة رسم محتوى DOM (مثل عناصر HTML) في رقعة رسم.
-
التعديل على الفديو باستخدام رقعة الرسم
-
يمكنك بدمج {{HTMLElement("video")}} و{{HTMLElement("canvas")}} التلاعب والتعديل على الفديو آنيا.
-
- -

الموارد

- -

عامة

- - - -

المكتبات

- -
    -
  • Fabric.js مكتبة رقعة رسم مفتوحة المصدر تأتي بإمكانيات تحليل SVG.
  • -
  • Kinetic.js مكتبة رقعة رسم مفتوحة المصدر تركز على التفاعل في تطبيقات سطح المكتب والمحمول.
  • -
  • Paper.js إطار عمل رسوميات متجهية مفتوح المصدر يعمل على رقعة رسم HTML5.
  • -
  • Origami.js مكتبة رقعة رسم خفيفة مفتوحة المصدر.
  • -
  • libCanvas إطار عمل رقعة رسم خفيف وقوي.
  • -
  • Processing.js نقل للغة التمثيل Processing.
  • -
  • PlayCanvas محرّك ألعاب مفتوح المصدر.
  • -
  • Pixi.js محرّك ألعاب مفتوح المصدر.
  • -
  • PlotKit مكتبة للرسوم البيانية.
  • -
  • Rekapi واجهة برمجة تطبيقات تتعامل مع الإطارات المفتاحية للحركات لرقعة الرسم.
  • -
  • PhiloGL إطار عمل WebGL لتمثيل البيانات، والبرمجة الخلّاقة وتطوير الألعاب.
  • -
  • JavaScript InfoVis Toolkit تُنشئ تمثيلات بيانات لرقعة الرسم ثنائية الأبعاد تفاعلية للوب.
  • -
  • EaselJS مكتبة مفتوحة المصدر حرة تسهّل استخدام رقعة الرسم للألعاب والفنون.
  • -
  • Scrawl-canvas مكتبة جافاسكربت مفتوحة المصدر لإنشاء وتعديل عناصر رقعة الرسم ثنائية الأبعاد.
  • -
  • heatmap.js مكتبة مفتوحة المصدر لإنشاء خرائط حرارية بناء على رقعة الرسم.
  • -
- -

المواصفات

- - - - - - - - - - - - - - - - -
المواصفةالحالةتعليق
{{SpecName('HTML WHATWG', 'scripting.html#the-canvas-element', '<canvas>')}}{{Spec2('HTML WHATWG')}} 
- -

طالع أيضا

- - diff --git a/files/ar/web/api/document/designmode/index.html b/files/ar/web/api/document/designmode/index.html deleted file mode 100644 index 2300a50dd1..0000000000 --- a/files/ar/web/api/document/designmode/index.html +++ /dev/null @@ -1,110 +0,0 @@ ---- -title: Document.designMode -slug: Web/API/Document/designMode -translation_of: Web/API/Document/designMode ---- -
{{ ApiRef() }}
- -
 
- -

نبذه مختصره

- -

document.designMode

- -

يتحكم بطبيعة عرض كامل المحتوى كـ قابل للتعديل. القيم التي يقبلها هي "off" معطل​ و "on" مشغل  .بحسب تخصيصه. القيمة الافتراضية لهذه الخاصية معطله "off". فايرفوكس يتبع هذا النمط. الاصدارات الحديثة من كروم و إنترنت اكسبلورر القيمة الافتراضية فيها "inherit". بدأً من الاصدار 43 لمتصفح كروم، القيمة الافتراضية هي "off" و "inherit" لم تعد مدعومه اكثر. في إنترنت اكسبلورر 6 حتى 10، القيمة هي مستثمرة

- -

الصيغة

- -
var mode = document.designMode;
-document.designMode = "on";
-document.designMode = "off";
- -

مثال

- -

جعل عنصر/عناصر ifram  قابله للتعديل:

- -
iframeNode.contentDocument.designMode = "on";
-
- -

التخصيص

- - - - - - - - - - - - - - -
الخاصيةالحالةتعليق
{{SpecName('HTML WHATWG', '#making-entire-documents-editable:-the-designmode-idl-attribute', 'designMode')}}{{Spec2('HTML WHATWG')}}Initial definition.
- -

دعم المتصفحات

- -

{{ CompatibilityTable() }}

- -
- - - - - - - - - - - - - - - - - - - - - -
الدعمكرومايدجفايرفوكسإنترنت اكسبلورراوبراسفاري
Basic support{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidAndroid WebviewEdgeFirefox Mobile (Gecko)IE MobileOpera MobileSafari MobileChrome for Android
Basic support{{CompatNo}}{{ CompatVersionUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatVersionUnknown() }}
-
- -

شاهد ايضاً

- - diff --git a/files/ar/web/api/document/index.html b/files/ar/web/api/document/index.html deleted file mode 100644 index 0813f488e0..0000000000 --- a/files/ar/web/api/document/index.html +++ /dev/null @@ -1,461 +0,0 @@ ---- -title: Document -slug: Web/API/Document -tags: - - API - - DOM - - Document - - Interface - - NeedsTranslation - - Reference - - TopicStub - - whereas -translation_of: Web/API/Document ---- -
{{APIRef}}
- -
 
- -

The Document interface represents any web page loaded in the browser and serves as an entry point into the web page's content, which is the DOM tree. The DOM tree includes elements such as {{HTMLElement("body")}} and {{HTMLElement("table")}}, among many others. It provides functionality globally to the document, like how to obtain the page's URL and create new elements in the document.

- -

{{inheritanceDiagram}}

- -

The Document interface describes the common properties and methods for any kind of document. Depending on the document's type (e.g. HTML, XML, SVG, …), a larger API is available: HTML documents, served with the text/html content type, also implement the {{domxref("HTMLDocument")}} interface, whereas XML and SVG documents implement the {{domxref("XMLDocument")}} interface.

- -

Constructor

- -
-
{{domxref("Document.Document","Document()")}}{{non-standard_inline}}
-
Creates a new Document object.
-
- -

Properties

- -

This interface also inherits from the {{domxref("Node")}} and {{domxref("EventTarget")}} interfaces.

- -
-
{{domxref("Document.all")}} {{Deprecated_inline}} {{non-standard_inline}}
-
Provides access to all elements in the document. This is a legacy, non-standard interface and should not be used.
-
{{domxref("Document.async")}} {{Deprecated_inline}}
-
Used with {{domxref("Document.load")}} to indicate an asynchronous request.
-
{{domxref("Document.characterSet")}} {{readonlyinline}}
-
Returns the character set being used by the document.
-
{{domxref("Document.charset")}} {{readonlyinline}} {{Deprecated_inline}}
-
Alias of {{domxref("Document.characterSet")}}. Use this property instead.
-
{{domxref("Document.compatMode")}} {{readonlyinline}} {{experimental_inline}}
-
Indicates whether the document is rendered in quirks or strict mode.
-
{{domxref("Document.contentType")}} {{readonlyinline}} {{experimental_inline}}
-
Returns the Content-Type from the MIME Header of the current document.
-
{{domxref("Document.doctype")}} {{readonlyinline}}
-
Returns the Document Type Definition (DTD) of the current document.
-
{{domxref("Document.documentElement")}} {{readonlyinline}}
-
Returns the {{domxref("Element")}} that is a direct child of the document. For HTML documents, this is normally the {{HTMLElement("html")}} element.
-
{{domxref("Document.documentURI")}} {{readonlyinline}}
-
Returns the document location as a string.
-
{{domxref("Document.domConfig")}} {{Deprecated_inline}}
-
Should return a {{domxref("DOMConfiguration")}} object.
-
{{domxref("Document.fullscreen")}} {{obsolete_inline}}
-
true when the document is in {{domxref("Using_full-screen_mode","full-screen mode")}}.
-
{{domxref("Document.hidden")}} {{readonlyinline}}
-
-
{{domxref("Document.implementation")}} {{readonlyinline}}
-
Returns the DOM implementation associated with the current document.
-
{{domxref("Document.inputEncoding")}} {{readonlyinline}} {{Deprecated_inline}}
-
Alias of {{domxref("Document.characterSet")}}. Use this property instead.
-
{{domxref("Document.lastStyleSheetSet")}} {{readonlyinline}}
-
Returns the name of the style sheet set that was last enabled. Has the value null until the style sheet is changed by setting the value of {{domxref("document.selectedStyleSheetSet","selectedStyleSheetSet")}}.
-
{{domxref("Document.mozSyntheticDocument")}} {{non-standard_inline}} {{gecko_minversion_inline("8.0")}}
-
Returns a {{jsxref("Boolean")}} that is true only if this document is synthetic, such as a standalone image, video, audio file, or the like.
-
{{domxref("Document.mozFullScreenElement")}} {{readonlyinline}} {{non-standard_inline}} {{gecko_minversion_inline("9.0")}}
-
The element that's currently in full screen mode for this document.
-
{{domxref("Document.mozFullScreenEnabled")}} {{readonlyinline}} {{non-standard_inline}} {{gecko_minversion_inline("9.0")}}
-
true if calling {{domxref("Element.mozRequestFullscreen()")}} would succeed in the curent document.
-
{{domxref("Document.pointerLockElement")}} {{readonlyinline}} {{experimental_inline}}
-
Returns the element set as the target for mouse events while the pointer is locked. null if lock is pending, pointer is unlocked, or if the target is in another document.
-
{{domxref("Document.preferredStyleSheetSet")}} {{readonlyinline}}
-
Returns the preferred style sheet set as specified by the page author.
-
{{domxref("Document.scrollingElement")}} {{experimental_inline}} {{readonlyinline}}
-
Returns a reference to the {{domxref("Element")}} that scrolls the document.
-
{{domxref("Document.selectedStyleSheetSet")}}
-
Returns which style sheet set is currently in use.
-
{{domxref("Document.styleSheets")}} {{readonlyinline}}
-
Returns a list of the style sheet objects on the current document.
-
{{domxref("Document.styleSheetSets")}} {{readonlyinline}}
-
Returns a list of the style sheet sets available on the document.
-
{{domxref("Document.timeline")}} {{readonlyinline}}
-
-
{{domxref("Document.undoManager")}} {{readonlyinline}} {{experimental_inline}}
-
-
{{domxref("Document.visibilityState")}} {{readonlyinline}}
-
-

Returns a string denoting the visibility state of the document. Possible values are visiblehiddenprerender, and unloaded.

-
-
{{domxref("Document.xmlEncoding")}} {{Deprecated_inline}}
-
Returns the encoding as determined by the XML declaration.
-
{{domxref("Document.xmlStandalone")}} {{obsolete_inline("10.0")}}
-
Returns true if the XML declaration specifies the document to be standalone (e.g., An external part of the DTD affects the document's content), else false.
-
{{domxref("Document.xmlVersion")}} {{obsolete_inline("10.0")}}
-
Returns the version number as specified in the XML declaration or "1.0" if the declaration is absent.
-
- -

The Document interface is extended with the {{domxref("ParentNode")}} interface:

- -

{{page("/en-US/docs/Web/API/ParentNode","Properties")}}

- -

Extension for HTML document

- -

The Document interface for HTML documents inherits from the {{domxref("HTMLDocument")}} interface or, since HTML5,  is extended for such documents.

- -
-
{{domxref("Document.activeElement")}} {{readonlyinline}}
-
Returns the currently focused element.
-
{{domxref("Document.alinkColor")}} {{Deprecated_inline}}
-
Returns or sets the color of active links in the document body.
-
{{domxref("Document.anchors")}}
-
Returns a list of all of the anchors in the document.
-
{{domxref("Document.applets")}} {{Deprecated_inline}}
-
Returns an ordered list of the applets within a document.
-
{{domxref("Document.bgColor")}} {{Deprecated_inline}}
-
Gets/sets the background color of the current document.
-
{{domxref("Document.body")}}
-
Returns the {{HTMLElement("body")}} element of the current document.
-
{{domxref("Document.cookie")}}
-
Returns a semicolon-separated list of the cookies for that document or sets a single cookie.
-
{{domxref("Document.defaultView")}} {{readonlyinline}}
-
Returns a reference to the window object.
-
{{domxref("Document.designMode")}}
-
Gets/sets the ability to edit the whole document.
-
{{domxref("Document.dir")}} {{readonlyinline}}
-
Gets/sets directionality (rtl/ltr) of the document.
-
{{domxref("Document.domain")}}
-
Gets/sets the domain of the current document.
-
{{domxref("Document.embeds")}} {{readonlyinline}}
-
Returns a list of the embedded {{HTMLElement('embed')}} elements within the current document.
-
{{domxref("document.fgColor")}} {{Deprecated_inline}}
-
Gets/sets the foreground color, or text color, of the current document.
-
{{domxref("Document.forms")}} {{readonlyinline}}
-
Returns a list of the {{HTMLElement("form")}} elements within the current document.
-
{{domxref("Document.head")}} {{readonlyinline}}
-
Returns the {{HTMLElement("head")}} element of the current document.
-
{{domxref("Document.height")}} {{non-standard_inline}} {{obsolete_inline}}
-
Gets/sets the height of the current document.
-
{{domxref("Document.images")}} {{readonlyinline}}
-
Returns a list of the images in the current document.
-
{{domxref("Document.lastModified")}} {{readonlyinline}}
-
Returns the date on which the document was last modified.
-
{{domxref("Document.linkColor")}} {{Deprecated_inline}}
-
Gets/sets the color of hyperlinks in the document.
-
{{domxref("Document.links")}} {{readonlyinline}}
-
Returns a list of all the hyperlinks in the document.
-
{{domxref("Document.location")}} {{readonlyinline}}
-
Returns the URI of the current document.
-
{{domxref("Document.plugins")}} {{readonlyinline}}
-
Returns a list of the available plugins.
-
{{domxref("Document.readyState")}} {{readonlyinline}}  {{gecko_minversion_inline("1.9.2")}}
-
Returns loading status of the document.
-
{{domxref("Document.referrer")}} {{readonlyinline}}
-
Returns the URI of the page that linked to this page.
-
{{domxref("Document.scripts")}} {{readonlyinline}}
-
Returns all the {{HTMLElement("script")}} elements on the document.
-
{{domxref("Document.title")}}
-
Sets or gets the title of the current document.
-
{{domxref("Document.URL")}} {{readonlyInline}}
-
Returns the document location as a string.
-
{{domxref("Document.vlinkColor")}} {{Deprecated_inline}}
-
Gets/sets the color of visited hyperlinks.
-
{{domxref("Document.width")}} {{non-standard_inline}} {{obsolete_inline}}
-
Returns the width of the current document.
-
- -

Event handlers

- -
-
{{domxref("Document.onafterscriptexecute")}} {{non-standard_inline}}
-
Represents the event handling code for the {{event("afterscriptexecute")}} event.
-
{{domxref("Document.onbeforescriptexecute")}} {{non-standard_inline}}
-
Represents the event handling code for the {{event("beforescriptexecute")}} event.
-
{{domxref("Document.oncopy")}} {{non-standard_inline}}
-
Represents the event handling code for the {{event("copy")}} event.
-
{{domxref("Document.oncut")}} {{non-standard_inline}}
-
Represents the event handling code for the {{event("cut")}} event.
-
{{domxref("Document.onfullscreenchange")}}
-
Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("fullscreenchange")}} event is raised.
-
{{domxref("Document.onfullscreenerror")}}
-
Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("fullscreenerror")}} event is raised.
-
{{domxref("Document.onpaste")}} {{non-standard_inline}}
-
Represents the event handling code for the {{event("paste")}} event.
-
{{domxref("Document.onpointerlockchange")}} {{experimental_inline}}
-
Represents the event handling code for the {{event("pointerlockchange")}} event.
-
{{domxref("Document.onpointerlockerror")}} {{experimental_inline}}
-
Represetnts the event handling code for the {{event("pointerlockerror")}} event.
-
{{domxref("Document.onreadystatechange")}} {{gecko_minversion_inline("1.9.2")}}
-
Represents the event handling code for the {{event("readystatechange")}} event.
-
{{domxref("Document.onselectionchange")}} {{experimental_inline}}
-
Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("selectionchange")}} event is raised.
-
{{domxref("Document.onvisibilitychange")}}
-
Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("visibilitychange")}} event is raised.
-
{{domxref("Document.onwheel")}} {{non-standard_inline}}
-
Represents the event handling code for the {{event("wheel")}} event.
-
- -

The Document interface is extended with the {{domxref("GlobalEventHandlers")}} interface:

- -

{{Page("/en-US/docs/Web/API/GlobalEventHandlers", "Properties")}}

- -

Methods

- -

This interface also inherits from the {{domxref("Node")}} and {{domxref("EventTarget")}} interfaces.

- -
-
{{domxref("Document.adoptNode()")}}
-
Adopt node from an external document.
-
{{domxref("Document.captureEvents()")}} {{Deprecated_inline}}
-
See {{domxref("Window.captureEvents")}}.
-
{{domxref("Document.caretPositionFromPoint()")}}{{experimental_inline}}
-
Gets the {{domxref("CaretPosition")}} at or near the specified coordinates.
-
{{domxref("Document.caretRangeFromPoint()")}}{{non-standard_inline}}
-
Gets a {{Domxref("Range")}} object for the document fragment under the specified coordinates.
-
{{domxref("Document.createAttribute()")}}
-
Creates a new {{domxref("Attr")}} object and returns it.
-
{{domxref("Document.createAttributeNS()")}}
-
Creates a new attribute node in a given namespace and returns it.
-
{{domxref("Document.createCDATASection()")}}
-
Creates a new CDATA node and returns it.
-
{{domxref("Document.createComment()")}}
-
Creates a new comment node and returns it.
-
{{domxref("Document.createDocumentFragment()")}}
-
Creates a new document fragment.
-
{{domxref("Document.createElement()")}}
-
Creates a new element with the given tag name.
-
{{domxref("Document.createElementNS()")}}
-
Creates a new element with the given tag name and namespace URI.
-
{{domxref("Document.createEntityReference()")}} {{obsolete_inline}}
-
Creates a new entity reference object and returns it.
-
{{domxref("Document.createEvent()")}}
-
Creates an event object.
-
{{domxref("Document.createNodeIterator()")}}
-
Creates a {{domxref("NodeIterator")}} object.
-
{{domxref("Document.createProcessingInstruction()")}}
-
Creates a new {{domxref("ProcessingInstruction")}} object.
-
{{domxref("Document.createRange()")}}
-
Creates a {{domxref("Range")}} object.
-
{{domxref("Document.createTextNode()")}}
-
Creates a text node.
-
{{domxref("Document.createTouch()")}} {{Deprecated_inline}}
-
Creates a {{domxref("Touch")}} object.
-
{{domxref("Document.createTouchList()")}}
-
Creates a {{domxref("TouchList")}} object.
-
{{domxref("Document.createTreeWalker()")}}
-
Creates a {{domxref("TreeWalker")}} object.
-
{{domxref("Document.elementFromPoint()")}}{{experimental_inline}}
-
Returns the topmost element at the specified coordinates. 
-
{{domxref("Document.elementsFromPoint()")}}{{experimental_inline}}
-
Returns an array of all elements at the specified coordinates.
-
{{domxref("Document.enableStyleSheetsForSet()")}}
-
Enables the style sheets for the specified style sheet set.
-
{{domxref("Document.exitPointerLock()")}} {{experimental_inline}}
-
Release the pointer lock.
-
{{domxref("Document.getAnimations()")}} {{experimental_inline}}
-
Returns an array of all {{domxref("Animation")}} objects currently in effect, whose target elements are descendants of the document.
-
{{domxref("Document.getElementsByClassName()")}}
-
Returns a list of elements with the given class name.
-
{{domxref("Document.getElementsByTagName()")}}
-
Returns a list of elements with the given tag name.
-
{{domxref("Document.getElementsByTagNameNS()")}}
-
Returns a list of elements with the given tag name and namespace.
-
{{domxref("Document.importNode()")}}
-
Returns a clone of a node from an external document.
-
{{domxref("Document.normalizeDocument()")}} {{obsolete_inline}}
-
Replaces entities, normalizes text nodes, etc.
-
{{domxref("Document.registerElement()")}} {{experimental_inline}}
-
Registers a web component.
-
{{domxref("Document.releaseCapture()")}} {{non-standard_inline}} {{gecko_minversion_inline("2.0")}}
-
Releases the current mouse capture if it's on an element in this document.
-
{{domxref("Document.releaseEvents()")}} {{non-standard_inline}} {{Deprecated_inline}}
-
See {{domxref("Window.releaseEvents()")}}.
-
{{domxref("Document.routeEvent()")}} {{non-standard_inline}} {{obsolete_inline(24)}}
-
See {{domxref("Window.routeEvent()")}}.
-
{{domxref("Document.mozSetImageElement()")}} {{non-standard_inline}} {{gecko_minversion_inline("2.0")}}
-
Allows you to change the element being used as the background image for a specified element ID.
-
- -

The Document interface is extended with the {{domxref("ParentNode")}} interface:

- -
-
{{domxref("document.getElementById","document.getElementById(String id)")}}
-
Returns an object reference to the identified element.
-
{{domxref("document.querySelector","document.querySelector(String selector)")}} {{gecko_minversion_inline("1.9.1")}}
-
Returns the first Element node within the document, in document order, that matches the specified selectors.
-
{{domxref("document.querySelectorAll","document.querySelectorAll(String selector)")}} {{gecko_minversion_inline("1.9.1")}}
-
Returns a list of all the Element nodes within the document that match the specified selectors.
-
- -

The Document interface is extended with the {{domxref("XPathEvaluator")}} interface:

- -
-
{{domxref("document.createExpression","document.createExpression(String expression, XPathNSResolver resolver)")}}
-
Compiles an XPathExpression which can then be used for (repeated) evaluations.
-
{{domxref("document.createNSResolver","document.createNSResolver(Node resolver)")}}
-
Creates an {{domxref("XPathNSResolver")}} object.
-
{{domxref("document.evaluate","document.evaluate(String expression, Node contextNode, XPathNSResolver resolver, Number type, Object result)")}}
-
Evaluates an XPath expression.
-
- -

Extension for HTML documents

- -

The Document interface for HTML documents inherit from the {{domxref("HTMLDocument")}} interface or, since HTML5,  is extended for such documents:

- -
-
{{domxref("document.clear()")}} {{non-standard_inline}} {{Deprecated_inline}}
-
In majority of modern browsers, including recent versions of Firefox and Internet Explorer, this method does nothing.
-
{{domxref("document.close()")}}
-
Closes a document stream for writing.
-
{{domxref("document.execCommand","document.execCommand(String command[, Boolean showUI[, String value]])")}}
-
On an editable document, executes a formating command.
-
{{domxref("document.getElementsByName","document.getElementsByName(String name)")}}
-
Returns a list of elements with the given name.
-
{{domxref("document.getSelection()")}}
-
Returns a {{domxref("Selection")}} object related to text selected in the document.
-
{{domxref("document.hasFocus()")}}
-
Returns true if the focus is currently located anywhere inside the specified document.
-
{{domxref("document.open()")}}
-
Opens a document stream for writing.
-
{{domxref("document.queryCommandEnabled","document.queryCommandEnabled(String command)")}}
-
Returns true if the formating command can be executed on the current range.
-
{{domxref("document.queryCommandIndeterm","document.queryCommandIndeterm(String command)")}}
-
Returns true if the formating command is in an indeterminate state on the current range.
-
{{domxref("document.queryCommandState","document.queryCommandState(String command)")}}
-
Returns true if the formating command has been executed on the current range.
-
{{domxref("document.queryCommandSupported","document.queryCommandSupported(String command)")}}
-
Returns true if the formating command is supported on the current range.
-
{{domxref("document.queryCommandValue","document.queryCommandValue(String command)")}}
-
Returns the current value of the current range for a formating command.
-
{{domxref("document.write","document.write(String text)")}}
-
Writes text in a document.
-
{{domxref("document.writeln","document.writeln(String text)")}}
-
Writes a line of text in a document.
-
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('Page Visibility API', '#onvisiblitychange-event-handler', 'onvisibilitychange')}}{{Spec2('Page Visibility API')}}Adds onvisibilitychange.
{{SpecName('Selection API', '', 'Extend Document and GlobalEventHandlers')}}{{Spec2('Selection API')}}Adds onselectstart and onselectionchange.
{{SpecName('DOM1','#i-Document','Document')}}{{Spec2('DOM1')}}Initial definition for the interface
{{SpecName('DOM2 Core','#i-Document','Document')}}{{Spec2('DOM2 Core')}}Supersede DOM 1
{{SpecName('DOM3 Core','#i-Document','Document')}}{{Spec2('DOM3 Core')}}Supersede DOM 2
{{SpecName('DOM WHATWG','#interface-document','Document')}}{{Spec2('DOM WHATWG')}}Intend to supersede DOM 3
{{SpecName('HTML WHATWG','dom.html#the-document-object','Document')}}{{Spec2('HTML WHATWG')}}Turn the {{domxref("HTMLDocument")}} interface into a Document extension.
{{SpecName('DOM3 XPath','xpath.html#XPathEvaluator','XPathEvaluator')}}{{Spec2('DOM3 XPath')}}Define the {{domxref("XPathEvaluator")}} interface which extend document.
{{SpecName('Page Visibility API', '#sec-document-interface', 'Document')}}{{Spec2('Page Visibility API')}}Extend the Document interface with the visibilityState and hidden attributes
{{SpecName('HTML Editing','#dom-document-getselection','Document')}}{{Spec2('HTML Editing')}}Extend the Document interface
{{SpecName('CSSOM View','#extensions-to-the-document-interface','Document')}}{{Spec2('CSSOM View')}}Extend the Document interface
{{SpecName('CSSOM','#extensions-to-the-document-interface','Document')}}{{Spec2('CSSOM')}}Extend the Document interface
{{SpecName('Pointer Lock','#extensions-to-the-document-interface','Document')}}{{Spec2('Pointer Lock')}}Extend the Document interface
- -

Browser compatibility notes

- -

Firefox notes

- -

Mozilla defines a set of non-standard properties made only for XUL content:

- -
-
{{domxref("document.currentScript")}} {{non-standard_inline}} {{gecko_minversion_inline("2.0")}}
-
Returns the {{HTMLElement("script")}} element that is currently executing.
-
{{domxref("document.documentURIObject")}} {{gecko_minversion_inline("1.9")}}
-
(Mozilla add-ons only!) Returns the {{Interface("nsIURI")}} object representing the URI of the document. This property only has special meaning in privileged JavaScript code (with UniversalXPConnect privileges).
-
{{domxref("document.popupNode")}}
-
Returns the node upon which a popup was invoked.
-
{{domxref("document.tooltipNode")}}
-
Returns the node which is the target of the current tooltip.
-
- -

Mozilla also define some non-standard methods:

- -
-
{{domxref("document.execCommandShowHelp")}} {{obsolete_inline("14.0")}}
-
This method never did anything and always threw an exception, so it was removed in Gecko 14.0 {{geckoRelease("14.0")}}.
-
{{domxref("document.getBoxObjectFor")}} {{obsolete_inline}}
-
Use the {{domxref("Element.getBoundingClientRect()")}} method instead.
-
{{domxref("document.loadOverlay")}}
-
Loads a XUL overlay dynamically. This only works in XUL documents.
-
{{domxref("document.queryCommandText")}} {{obsolete_inline("14.0")}}
-
This method never did anything but throw an exception, and was removed in Gecko 14.0 {{geckoRelease("14.0")}}.
-
- -

Internet Explorer notes

- -

Microsoft defines some non-standard properties:

- -
-
{{domxref("document.fileSize")}}* {{non-standard_inline}} {{obsolete_inline}}
-
Returns size in bytes of the document. Starting with Internet Explorer 11, that property is no longer supported. See MSDN.
-
Internet Explorer does not support all methods from the Node interface in the Document interface:
-
- -
-
{{domxref("document.contains")}}
-
As a work-around, document.body.contains() can be used.
-
- -

 

diff --git a/files/ar/web/api/domtokenlist/index.html b/files/ar/web/api/domtokenlist/index.html deleted file mode 100644 index a4981c8649..0000000000 --- a/files/ar/web/api/domtokenlist/index.html +++ /dev/null @@ -1,117 +0,0 @@ ---- -title: DOMTokenList -slug: Web/API/DOMTokenList -tags: - - API - - DOM - - DOMTokenList - - Interface - - NeedsTranslation - - Reference - - TopicStub -translation_of: Web/API/DOMTokenList ---- -
{{APIRef("DOM")}}
- -

The DOMTokenList interface represents a set of space-separated tokens. Such a set is returned by {{domxref("Element.classList")}}, {{domxref("HTMLLinkElement.relList")}}, {{domxref("HTMLAnchorElement.relList")}}, {{domxref("HTMLAreaElement.relList")}}, {{domxref("HTMLIframeElement.sandbox")}}, or {{domxref("HTMLOutputElement.htmlFor")}}. It is indexed beginning with 0 as with JavaScript {{jsxref("Array")}} objects. DOMTokenList is always case-sensitive.

- -

Properties

- -
-
{{domxref("DOMTokenList.length")}} {{ReadOnlyInline}}
-
Is an integer representing the number of objects stored in the object.
-
{{domxref("DOMTokenList.value")}}
-
The value of the list as a {{domxref("DOMString")}}.
-
- -

Methods

- -
-
{{domxref("DOMTokenList.item()")}}
-
Returns an item in the list by its index (returns undefined if the number is greater than or equal to the length of the list).
-
{{domxref("DOMTokenList.contains()")}}
-
Returns true if the list contains the given token, otherwise false.
-
{{domxref("DOMTokenList.add()")}}
-
Adds the given token to the list.
-
{{domxref("DOMTokenList.remove()")}}
-
Removes the specified token from the list.
-
{{domxref("DOMTokenList.replace()")}}
-
Replaces an existing token with a new token.
-
{{domxref("DOMTokenList.supports()")}}
-
Returns true if a given token is in the associated attribute's supported tokens.
-
{{domxref("DOMTokenList.toggle()")}}
-
Removes a given token from the list and returns false. If token doesn't exist it's added and the function returns true.
-
{{domxref("DOMTokenList.entries()")}}
-
Returns an {{jsxref("Iteration_protocols","iterator")}} allowing you to go through all key/value pairs contained in this object.
-
{{domxref("DOMTokenList.forEach()")}}
-
Executes a provided function once per DOMTokenList element.
-
{{domxref("DOMTokenList.keys()")}}
-
Returns an {{jsxref("Iteration_protocols", "iterator")}} allowing you to go through all keys of the key/value pairs contained in this object.
-
{{domxref("DOMTokenList.values()")}}
-
Returns an {{jsxref("Iteration_protocols", "iterator")}} allowing you to go through all values of the key/value pairs contained in this object.
-
- -

Examples

- -

In the following simple example we retrieve the list of classes set on a {{htmlelement("p")}} element as a DOMTokenList using {{domxref("Element.classList")}}, add a class using {{domxref("DOMTokenList.add()")}}, and then update the {{domxref("Node.textContent")}} of the <p> to equal the DOMTokenList.

- -

First, the HTML:

- -
<p class="a b c"></p>
- -

Now the JavaScript:

- -
var para = document.querySelector("p");
-var classes = para.classList;
-para.classList.add("d");
-para.textContent = 'paragraph classList is "' + classes + '"';
- -

The output looks like this:

- -

{{ EmbedLiveSample('Examples', '100%', 60) }}

- -

Trimming of whitespace and removal of duplicates

- -

Methods that modify the DOMTokenList (such as {{domxref("DOMTokenList.add()")}}) automatically trim any excess whitespace and remove duplicate values from the list. For example:

- -
<span class="    d   d e f"></span>
- -
var span = document.querySelector("span");
-var classes = span.classList;
-span.classList.add("x");
-span.textContent = 'span classList is "' + classes + '"';
- -

The output looks like this:

- -

{{ EmbedLiveSample('Trimming_of_whitespace_and_removal_of_duplicates', '100%', 60) }}

- -

Specifications

- - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName("DOM WHATWG", "#interface-domtokenlist", "DOMTokenList")}}{{Spec2("DOM WHATWG")}}Initial definition
- -

Browser compatibility

- - - -

{{Compat("api.DOMTokenList")}}

- -

See Also

- -
    -
  • {{domxref("DOMSettableTokenList")}} (object that extends DOMTokenList with settable .value property)
  • -
diff --git a/files/ar/web/api/domtokenlist/length/index.html b/files/ar/web/api/domtokenlist/length/index.html deleted file mode 100644 index c65f931027..0000000000 --- a/files/ar/web/api/domtokenlist/length/index.html +++ /dev/null @@ -1,62 +0,0 @@ ---- -title: DOMTokenList.length -slug: Web/API/DOMTokenList/length -translation_of: Web/API/DOMTokenList/length ---- -

{{APIRef("DOM")}}

- -

The length read-only property of the {{domxref("DOMTokenList")}} interface is an integer representing the number of objects stored in the object.

- -

بنية الجملة

- -
tokenList.length;
- -

القيمة العائدة

- -

تُعيد رقم صحيح.

- -

أمثلة

- -

في المثال التالي نقوم بإسترداد قيمة الـ classes الموضوعة داخل {{htmlelement("span")}} element as a DOMTokenList using {{domxref("Element.classList")}}, then write the length of the list to the <span>'s {{domxref("Node.textContent")}}.

- -

أولاً، الـ HTML:

- -
<span class="a b c"></span>
- -

الآن الـ JavaScript:

- -
var span = document.querySelector("span");
-var classes = span.classList;
-var length = classes.length;
-
-span.textContent = 'classList length = ' + length;
-
- -

نتيجة الكود ستكون بالشكل التالي:

- -

{{ EmbedLiveSample('Examples', '100%', 60) }}

- -

الخصائص

- - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('DOM WHATWG','#dom-domtokenlist-length','length')}}{{Spec2('DOM WHATWG')}}Initial definition
- -

دعم المتصفحات

- -
- - -

{{Compat("api.DOMTokenList.length")}}

-
diff --git a/files/ar/web/api/element/classname/index.html b/files/ar/web/api/element/classname/index.html deleted file mode 100644 index cd37ae178e..0000000000 --- a/files/ar/web/api/element/classname/index.html +++ /dev/null @@ -1,137 +0,0 @@ ---- -title: Element.className سمة العنصر -slug: Web/API/Element/className -tags: - - API - - DOM - - Gecko - - Property - - Reference - - خاصية - - مرجع -translation_of: Web/API/Element/className ---- -
{{APIRef("DOM")}}
- -

الخلاصة

- -

تقوم className بجلب أو ضبط  قيمة سمة class الخاصة بالعنصر.

- -

بنية الجملة

- -
var cName = elementNodeReference.className;
-elementNodeReference.className = cName;
-
- -
    -
  • إن cName هو متغير نصي يعبر عن اسم class العنصر أو أكثر من class واحد يفصل بينها مسافات للعنصر الحالي.
  • -
- -

مثال

- -
let elm = document.getElementById('item');
-
-if(elm.className === 'active'){
-    elm.className = 'inactive';
-} else {
-    elm.className = 'active';
-}
- -

ملاحظات

- -

تم استخدام className عوضًا عن class فقط لكي لا يتم خلطها مع كلمة class التي تستخدم في البرمجة الكائنية

- -

يمكن استخدام className  في حالة {{domxref("SVGAnimatedString")}} إذا كان العنصر عبارة عن {{domxref("SVGElement")}}، من الأفضل أن تجلب قيمة className أو تضبطها باستخدام {{domxref("Element.getAttribute")}} و{{domxref("Element.setAttribute")}} إذا كنت تتعامل مع عنصر من نوع SVG.

- -
elm.setAttribute('class', elm.getAttribute('class'))
- -

 

- -

الخواص

- - - - - - - - - - - - - - - - - - - - - - - - -
الخاصيةالحالةتعليق
{{SpecName("DOM WHATWG", "#dom-element-classname", "element.className")}}{{Spec2("DOM WHATWG")}} 
{{SpecName("DOM4", "#dom-element-classname", "element.className")}}{{Spec2("DOM4")}} 
{{SpecName("DOM2 HTML", "html.html#ID-95362176", "element.className")}}{{Spec2("DOM2 HTML")}}Initial definition
- -

التوافق مع المتصفحات

- -

{{CompatibilityTable}}

- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidEdgeFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

اقرأ ايضًا

- -
    -
  • {{domxref("element.classList")}}
  • -
diff --git a/files/ar/web/api/element/closest/index.html b/files/ar/web/api/element/closest/index.html deleted file mode 100644 index 5ad476bb9d..0000000000 --- a/files/ar/web/api/element/closest/index.html +++ /dev/null @@ -1,148 +0,0 @@ ---- -title: Element.closest() -slug: Web/API/Element/closest -tags: - - دوم - - مرجع - - واجهة برمجة تطبيقات -translation_of: Web/API/Element/closest ---- -
{{APIRef('DOM')}}
- -
ال closest() method تجتاز {{domxref ("Element")}} والأصل(يتجهون نحو جذر المستند) حتى يعثروا على عقدة تتطابق مع الstring المحدد. سيعود نفسه أو أسلاف مطابقة. إذا لم يكن هناك مثل هذا العنصر ، فإنه يعيد null.
- -

تركيب الجملة

- -
var closestElement = targetElement.closest(selectors);
-
- -

المعاملات

- -
    -
  • selectors is a {{domxref("DOMString")}} containing a selector list.
    - ex: p:hover, .toto + q
  • -
- -

القيمة المرجعة

- -
    -
  • closestElement is the {{domxref("Element")}} which is the closest ancestor of the selected element. It may be null.
  • -
- -

استثناءات

- -
    -
  • {{exception("SyntaxError")}} is thrown if the selectors is not a valid selector list string.
  • -
- -

مثال

- -

HTML

- -
<article>
-  <div id="div-01">Here is div-01
-    <div id="div-02">Here is div-02
-      <div id="div-03">Here is div-03</div>
-    </div>
-  </div>
-</article>
- -

JavaScript

- -
var el = document.getElementById('div-03');
-
-var r1 = el.closest("#div-02");
-// returns the element with the id=div-02
-
-var r2 = el.closest("div div");
-// returns the closest ancestor which is a div in div, here it is the div-03 itself
-
-var r3 = el.closest("article > div");
-// returns the closest ancestor which is a div and has a parent article, here it is the div-01
-
-var r4 = el.closest(":not(div)");
-// returns the closest ancestor which is not a div, here it is the outmost article
- -

Polyfill

- -

بالنسبة للمتصفحات التي لا تدعم ()Element.closest ، ولكنها تدعم ال()element.matches (أو ما يعادله سابقًا ، بمعنى IE9 +) ، توجد تعبئة متعددة:

- -
if (!Element.prototype.matches) {
-  Element.prototype.matches = Element.prototype.msMatchesSelector ||
-                              Element.prototype.webkitMatchesSelector;
-}
-
-if (!Element.prototype.closest) {
-  Element.prototype.closest = function(s) {
-    var el = this;
-
-    do {
-      if (Element.prototype.matches.call(el, s)) return el;
-      el = el.parentElement || el.parentNode;
-    } while (el !== null && el.nodeType === 1);
-    return null;
-  };
-}
- -

ومع ذلك ، إذا كنت تحتاج بالفعل إلى دعم IE 8 ، فإن polyfill التالي سيقوم بالمهمة ببطء شديد ، ولكن في النهاية. ومع ذلك ، ستدعم فقط محددات CSS 2.1 في IE 8 ، ويمكن أن تسبب تأخر كبير في إنتاج المواقع .

- -
if (window.Element && !Element.prototype.closest) {
-  Element.prototype.closest =
-  function(s) {
-    var matches = (this.document || this.ownerDocument).querySelectorAll(s),
-        i,
-        el = this;
-    do {
-      i = matches.length;
-      while (--i >= 0 && matches.item(i) !== el) {};
-    } while ((i < 0) && (el = el.parentElement));
-    return el;
-  };
-}
-
- -

مواصفات

- - - - - - - - - - - - - - - - -
مواصفاتالحالةتعليق
{{SpecName('DOM WHATWG', '#dom-element-closest', 'Element.closest()')}}{{Spec2('DOM WHATWG')}}تعريف ابتدائي.
- -

التوافق مع المتصفحات

- -
- - -

{{Compat("api.Element.closest")}}

- -

ملاحظات التوافق

- -
    -
  • في Edge 15-18 document.createElement(tagName).closest(tagName) ستعيد null ذا كان العنصر غير متصل أولاً (بشكل مباشر أو غير مباشر) بObject السياق ، على سبيل المثال {{domxref ("Document")}}
    - Object في حالة DOM العادي.
  • -
-
- -

إقرأ أيضا

- -
    -
  • The {{domxref("Element")}} interface.
  • -
  • - -
  • -
  • -
    Other methods that take selectors: {{domxref("element.querySelector()")}} and {{domxref("element.matches()")}}.
    -
  • -
diff --git a/files/ar/web/api/element/index.html b/files/ar/web/api/element/index.html deleted file mode 100644 index 070f2c26a5..0000000000 --- a/files/ar/web/api/element/index.html +++ /dev/null @@ -1,656 +0,0 @@ ---- -title: Element -slug: Web/API/Element -tags: - - API - - DOM - - DOM Reference - - Element - - Interface - - NeedsTranslation - - Reference - - TopicStub - - Web API -translation_of: Web/API/Element ---- -

{{ APIRef("DOM") }}

- -

Element is the most general base class from which all objects in a {{domxref("Document")}} inherit. It only has methods and properties common to all kinds of element. More specific classes inherit from Element. For example, the {{domxref("HTMLElement")}} interface is the base interface for HTML elements, while the {{domxref("SVGElement")}} interface is the basis for all SVG elements. Most functionality is specified further down the class hierarchy.

- -

Languages outside the realm of the Web platform, like XUL through the XULElement interface, also implement Element.

- -

{{InheritanceDiagram}}

- -

Properties

- -

Inherits properties from its parent interface, {{domxref("Node")}}, and by extension that interface's parent, {{domxref("EventTarget")}}. It implements the properties of {{domxref("ParentNode")}}, {{domxref("ChildNode")}}, {{domxref("NonDocumentTypeChildNode")}}, and {{domxref("Animatable")}}.

- -
-
{{ domxref("Element.assignedSlot")}} {{experimental_inline}} {{readOnlyInline}}
-
Returns the {{domxref("HTMLSlotElement")}} interface associated with the element.
-
{{ domxref("Element.attributes") }} {{readOnlyInline}}
-
Returns a {{ domxref("NamedNodeMap") }} object containing the assigned attributes of the corresponding HTML element.
-
{{ domxref("Element.classList") }} {{readOnlyInline}}
-
Returns a {{ domxref("DOMTokenList") }} containing the list of class attributes.
-
{{ domxref("Element.className") }}
-
Is a {{domxref("DOMString")}} representing the class of the element.
-
{{ domxref("Element.clientHeight") }} {{experimental_inline}} {{readOnlyInline}}
-
Returns a {{jsxref("Number")}} representing the inner height of the element.
-
{{ domxref("Element.clientLeft") }} {{experimental_inline}} {{readOnlyInline}}
-
Returns a {{jsxref("Number")}} representing the width of the left border of the element.
-
{{ domxref("Element.clientTop") }} {{experimental_inline}} {{readOnlyInline}}
-
Returns a {{jsxref("Number")}} representing the width of the top border of the element.
-
{{ domxref("Element.clientWidth") }} {{experimental_inline}} {{readOnlyInline}}
-
Returns a {{jsxref("Number")}} representing the inner width of the element.
-
{{domxref("Element.computedName")}} {{readOnlyInline}}
-
Returns a {{domxref("DOMString")}} containing the label exposed to accessibility.
-
{{domxref("Element.computedRole")}} {{readOnlyInline}}
-
Returns a {{domxref("DOMString")}} containing the ARIA role that has been applied to a particular element. 
-
{{ domxref("Element.id") }}
-
Is a {{domxref("DOMString")}} representing the id of the element.
-
{{ domxref("Element.innerHTML") }}
-
Is a {{domxref("DOMString")}} representing the markup of the element's content.
-
{{ domxref("Element.localName") }} {{readOnlyInline}}
-
A {{domxref("DOMString")}} representing the local part of the qualified name of the element.
-
{{domxref("Element.namespaceURI")}} {{readonlyInline}}
-
The namespace URI of the element, or null if it is no namespace. -
-

Note: In Firefox 3.5 and earlier, HTML elements are in no namespace. In later versions, HTML elements are in the http://www.w3.org/1999/xhtml namespace in both HTML and XML trees. {{ gecko_minversion_inline("1.9.2") }}

-
-
-
{{ domxref("NonDocumentTypeChildNode.nextElementSibling") }} {{readOnlyInline}}
-
Is a {{ domxref("Element") }}, the element immediately following the given one in the tree, or null if there's no sibling node.
-
{{ domxref("Element.outerHTML") }} {{experimental_inline}}
-
Is a {{domxref("DOMString")}} representing the markup of the element including its content. When used as a setter, replaces the element with nodes parsed from the given string.
-
{{ domxref("Element.prefix") }} {{readOnlyInline}}
-
A {{domxref("DOMString")}} representing the namespace prefix of the element, or null if no prefix is specified.
-
{{ domxref("NonDocumentTypeChildNode.previousElementSibling") }} {{readOnlyInline}}
-
Is a {{ domxref("Element") }}, the element immediately preceding the given one in the tree, or null if there is no sibling element.
-
{{ domxref("Element.scrollHeight") }} {{experimental_inline}} {{readOnlyInline}}
-
Returns a {{jsxref("Number")}} representing the scroll view height of an element.
-
{{ domxref("Element.scrollLeft") }} {{experimental_inline}}
-
Is a {{jsxref("Number")}} representing the left scroll offset of the element.
-
{{ domxref("Element.scrollLeftMax") }} {{non-standard_inline}} {{readOnlyInline}}
-
Returns a {{jsxref("Number")}} representing the maximum left scroll offset possible for the element.
-
{{ domxref("Element.scrollTop") }} {{experimental_inline}}
-
Is a {{jsxref("Number")}} representing the top scroll offset the element.
-
{{ domxref("Element.scrollTopMax") }} {{non-standard_inline}} {{readOnlyInline}}
-
Returns a {{jsxref("Number")}} representing the maximum top scroll offset possible for the element.
-
{{ domxref("Element.scrollWidth") }} {{experimental_inline}} {{readOnlyInline}}
-
Returns a {{jsxref("Number")}} representing the scroll view width of the element.
-
{{domxref("Element.shadowRoot") }} {{experimental_inline}} {{readOnlyInline}}
-
Returns the youngest shadow root that is hosted by the element.
-
{{domxref("Element.slot")}} {{experimental_inline}}
-
Returns the name of the shadow DOM slot attached to the element. A slot is a placeholder inside a web component that users can fill with their own markup.
-
{{domxref("Element.tabStop")}} {{non-standard_inline}}
-
Is a {{jsxref("Boolean")}} indicating if the element can receive input focus via the tab key.
-
{{ domxref("Element.tagName") }} {{readOnlyInline}}
-
Returns a {{domxref("String")}} with the name of the tag for the given element.
-
{{ domxref("Element.undoManager")}} {{experimental_inline}} {{readOnlyInline}}
-
Returns the {{domxref("UndoManager")}} associated with the element.
-
{{ domxref("Element.undoScope")}} {{experimental_inline}}
-
Is a {{jsxref("Boolean")}} indicating if the element is an undo scope host, or not.
-
- -
-

Note: DOM Level 3 defined namespaceURI, localName and prefix on the {{domxref("Node")}} interface. In DOM4 they were moved to Element.

- -

This change is implemented in Chrome since version 46.0 and Firefox since version 48.0.

-
- -

Event handlers

- -
-
{{ domxref("Element.ongotpointercapture") }}
-
Returns the event handler for the {{event("gotpointercapture")}} event type.
-
{{ domxref("Element.onlostpointercapture") }}
-
Returns the event handler for the {{event("lostpointercapture")}} event type.
-
- -

Obsolete event handlers

- -
-
{{ domxref("Element.onwheel") }}
-
Returns the event handling code for the wheel event. This is now implemented on {{domxref("GlobalEventHandlers.onwheel", "GlobalEventHandlers")}}.
-
- -

Methods

- -

Inherits methods from its parents {{domxref("Node")}}, and its own parent, {{domxref("EventTarget")}}, and implements those of {{domxref("ParentNode")}}, {{domxref("ChildNode")}}, {{domxref("NonDocumentTypeChildNode")}}, and {{domxref("Animatable")}}.

- -
-
{{ domxref("EventTarget.addEventListener()") }}
-
Registers an event handler to a specific event type on the element.
-
{{domxref("Element.attachShadow()")}} {{experimental_inline}}
-
Attatches a shadow DOM tree to the specified element and returns a reference to its {{domxref("ShadowRoot")}}.
-
{{domxref("Element.animate()")}} {{experimental_inline}}
-
A shortcut method to create and run an animation on an element. Returns the created Animation object instance.
-
{{ domxref("Element.closest()")}} {{experimental_inline}}
-
Returns the {{domxref("Element")}} which is the closest ancestor of the current element (or the current element itself) which matches the selectors given in parameter.
-
{{ domxref("Element.createShadowRoot()")}} {{experimental_inline}} {{deprecated_inline()}}
-
Creates a shadow DOM on on the element, turning it into a shadow host. Returns a {{domxref("ShadowRoot")}}.
-
{{ domxref("EventTarget.dispatchEvent()") }}
-
Dispatches an event to this node in the DOM and returns a {{jsxref("Boolean")}} that indicates that at least one handler has not canceled it.
-
{{domxref("Element.getAnimations()")}} {{experimental_inline}}
-
Returns an array of Animation objects currently active on the element.
-
{{ domxref("Element.getAttribute()") }}
-
Retrieves the value of the named attribute from the current node and returns it as an {{jsxref("Object")}}.
-
{{ domxref("Element.getAttributeNames()") }}
-
Returns an array of attribute names from the current element.
-
{{ domxref("Element.getAttributeNS()") }}
-
Retrieves the value of the attribute with the specified name and namespace, from the current node and returns it as an {{jsxref("Object")}}.
-
{{ domxref("Element.getAttributeNode()") }} {{obsolete_inline}}
-
Retrieves the node representation of the named attribute from the current node and returns it as an {{ domxref("Attr") }}.
-
{{ domxref("Element.getAttributeNodeNS()") }} {{obsolete_inline}}
-
Retrieves the node representation of the attribute with the specified name and namespace, from the current node and returns it as an {{ domxref("Attr") }}.
-
{{ domxref("Element.getBoundingClientRect()") }}
-
Returns the size of an element and its position relative to the viewport.
-
{{ domxref("Element.getClientRects()") }}
-
Returns a collection of rectangles that indicate the bounding rectangles for each line of text in a client.
-
{{ domxref("Element.getElementsByClassName()") }}
-
Returns a live {{ domxref("HTMLCollection") }} that contains all descendants of the current element that possess the list of classes given in the parameter.
-
{{ domxref("Element.getElementsByTagName()") }}
-
Returns a live {{ domxref("HTMLCollection") }} containing all descendant elements, of a particular tag name, from the current element.
-
{{ domxref("Element.getElementsByTagNameNS()") }}
-
Returns a live {{ domxref("HTMLCollection") }} containing all descendant elements, of a particular tag name and namespace, from the current element.
-
{{ domxref("Element.hasAttribute()") }}
-
Returns a {{jsxref("Boolean")}} indicating if the element has the specified attribute or not.
-
{{ domxref("Element.hasAttributeNS()") }}
-
Returns a {{jsxref("Boolean")}} indicating if the element has the specified attribute, in the specified namespace, or not.
-
{{ domxref("Element.hasAttributes()") }}
-
Returns a {{jsxref("Boolean")}} indicating if the element has one or more HTML attributes present.
-
{{ domxref("Element.insertAdjacentElement") }} {{experimental_inline}}
-
Inserts a given element node at a given position relative to the element it is invoked upon.
-
{{ domxref("Element.insertAdjacentHTML") }} {{experimental_inline}}
-
Parses the text as HTML or XML and inserts the resulting nodes into the tree in the position given.
-
{{ domxref("Element.insertAdjacentText") }} {{experimental_inline}}
-
Inserts a given text node at a given position relative to the element it is invoked upon.
-
{{ domxref("Element.matches()") }} {{experimental_inline}}
-
Returns a {{jsxref("Boolean")}} indicating whether or not the element would be selected by the specified selector string.
-
{{ domxref("Element.querySelector()") }}
-
Returns the first {{ domxref("Node") }} which matches the specified selector string relative to the element.
-
{{ domxref("Element.querySelectorAll") }}
-
Returns a {{ domxref("NodeList") }} of nodes which match the specified selector string relative to the element.
-
{{ domxref("Element.releasePointerCapture")}}
-
Releases (stops) pointer capture that was previously set for a specific {{domxref("PointerEvent","pointer event")}}.
-
{{domxref("ChildNode.remove()")}} {{experimental_inline}}
-
Removes the element from the children list of its parent.
-
{{ domxref("Element.removeAttribute()") }}
-
Removes the named attribute from the current node.
-
{{ domxref("Element.removeAttributeNS()") }}
-
Removes the attribute with the specified name and namespace, from the current node.
-
{{ domxref("Element.removeAttributeNode()") }} {{obsolete_inline}}
-
Removes the node representation of the named attribute from the current node.
-
{{ domxref("EventTarget.removeEventListener()") }}
-
Removes an event listener from the element.
-
{{ domxref("Element.requestFullscreen()") }} {{experimental_inline}}
-
Asynchronously asks the browser to make the element full-screen.
-
{{ domxref("Element.requestPointerLock()")}} {{experimental_inline}}
-
Allows to asynchronously ask for the pointer to be locked on the given element.
-
- -
-
{{ domxref("Element.scrollIntoView()") }} {{experimental_inline}}
-
Scrolls the page until the element gets into the view.
-
{{ domxref("Element.setAttribute()") }}
-
Sets the value of a named attribute of the current node.
-
{{ domxref("Element.setAttributeNS()") }}
-
Sets the value of the attribute with the specified name and namespace, from the current node.
-
{{ domxref("Element.setAttributeNode()") }} {{obsolete_inline}}
-
Sets the node representation of the named attribute from the current node.
-
{{ domxref("Element.setAttributeNodeNS()") }} {{obsolete_inline}}
-
Setw the node representation of the attribute with the specified name and namespace, from the current node.
-
{{ domxref("Element.setCapture()") }} {{non-standard_inline}}
-
Sets up mouse event capture, redirecting all mouse events to this element.
-
{{domxref("Element.setPointerCapture()")}}
-
Designates a specific element as the capture target of future {{domxref("PointerEvent","pointer events")}}.
-
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName("Web Animations", '', '')}}{{Spec2("Web Animations")}}Added the getAnimations() method.
{{SpecName('Undo Manager', '', 'Element')}}{{Spec2('Undo Manager')}}Added the undoScope and undoManager properties.
{{SpecName('Pointer Events 2', '#extensions-to-the-element-interface', 'Element')}}{{Spec2('Pointer Events 2')}}Added the following event handlers: ongotpointercapture and onlostpointercapture.
- Added the following methods: setPointerCapture() and releasePointerCapture().
{{SpecName('Pointer Events', '#extensions-to-the-element-interface', 'Element')}}{{Spec2('Pointer Events')}}Added the following event handlers: ongotpointercapture and onlostpointercapture.
- Added the following methods: setPointerCapture() and releasePointerCapture().
{{SpecName('Selectors API Level 1', '#interface-definitions', 'Element')}}{{Spec2('Selectors API Level 1')}}Added the following methods: querySelector() and querySelectorAll().
{{SpecName('Pointer Lock', 'index.html#element-interface', 'Element')}}{{Spec2('Pointer Lock')}}Added the requestPointerLock() method.
{{SpecName('Fullscreen', '#api', 'Element')}}{{Spec2('Fullscreen')}}Added the requestFullscreen() method.
{{SpecName('DOM Parsing', '#extensions-to-the-element-interface', 'Element')}}{{Spec2('DOM Parsing')}}Added the following properties: innerHTML, and outerHTML.
- Added the following method: insertAdjacentHTML().
{{SpecName('CSSOM View', '#extensions-to-the-element-interface', 'Element')}}{{Spec2('CSSOM View')}}Added the following properties: scrollTop, scrollLeft, scrollWidth, scrollHeight, clientTop, clientLeft, clientWidth, and clientHeight.
- Added the following methods: getClientRects(), getBoundingClientRect(), and scrollIntoView().
{{SpecName('Element Traversal', '#ecmascript-bindings', 'Element')}}{{Spec2('Element Traversal')}}Added inheritance of the {{domxref("ElementTraversal")}} interface.
{{SpecName('DOM WHATWG', '#interface-element', 'Element')}}{{Spec2('DOM WHATWG')}}Removed the following methods: closest(), setIdAttribute(), setIdAttributeNS(), and setIdAttributeNode().
- Removed the schemaTypeInfo property.
- Modified the return value of getElementsByTag() and getElementsByTagNS().
- Moved hasAttributes() from the Node interface to this one.
- Inserted insertAdjacentElement() and insertAdjacentText().
{{SpecName('DOM3 Core', 'core.html#ID-745549614', 'Element')}}{{Spec2('DOM3 Core')}}Added the following methods: setIdAttribute(), setIdAttributeNS(), and setIdAttributeNode(). These methods were never implemented and have been removed in later specifications.
- Added the schemaTypeInfo property. This property was never implemented and has been removed in later specifications.
{{SpecName('DOM2 Core', 'core.html#ID-745549614', 'Element')}}{{Spec2('DOM2 Core')}}The normalize() method has been moved to {{domxref("Node")}}.
{{SpecName('DOM1', 'level-one-core.html#ID-745549614', 'Element')}}{{Spec2('DOM1')}}Initial definition.
- -

Browser compatibility

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support1.0{{CompatVersionUnknown}}{{CompatGeckoDesktop("1")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}1.0
children{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoDesktop("1.9")}}7.0 with a significant bug [1]
- 9.0 according to the spec
{{CompatVersionUnknown}}{{CompatNo}}
childElementCount, nextElementSibling, previousElementSibling{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoDesktop("1.9.1")}}9.0{{CompatVersionUnknown}}{{CompatVersionUnknown}}
firstElementChild, lastElementChild{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoDesktop("1.9")}}9.0{{CompatVersionUnknown}}{{CompatVersionUnknown}}
classList{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoDesktop("1.9.2")}} {{CompatVersionUnknown}}{{CompatVersionUnknown}}
outerHTML {{experimental_inline}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoDesktop("11")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
clientLeft, clientTop {{experimental_inline}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoDesktop("1.9.1")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
getBoundingClientRect(), getClientRects() {{experimental_inline}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoDesktop("1.9")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
querySelector(), querySelectorAll()1.0{{CompatVersionUnknown}}{{CompatGeckoDesktop("1.9.1")}}8.010.03.2 (525.3)
insertAdjacentHTML() {{experimental_inline}}1.0{{CompatVersionUnknown}}{{CompatGeckoDesktop("8")}}4.07.04.0 (527)
setCapture() {{non-standard_inline}}{{CompatNo}}{{CompatNo}}{{CompatGeckoDesktop("2")}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
oncopy, oncut, onpaste {{non-standard_inline}}{{CompatNo}}{{CompatNo}}{{CompatGeckoDesktop("1.9")}}{{CompatVersionUnknown}} {{CompatNo}}
onwheel {{non-standard_inline}}{{CompatNo}}{{CompatVersionUnknown}}{{CompatGeckoDesktop("17")}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
ongotpointercapture, onlostpointercapture, setPointerCapture(), and releasePointerCapture(){{CompatChrome(52.0)}} [4]{{CompatVersionUnknown}}{{CompatVersionUnknown}} [3]10.0{{CompatNo}}{{CompatNo}}
matches() {{experimental_inline}}{{CompatVersionUnknown}} with the non-standard name webkitMatchesSelector{{CompatVersionUnknown}} {{property_prefix("webkit")}} {{property_prefix("ms")}}{{CompatGeckoDesktop("1.9.2")}} with the non-standard name mozMatchesSelector
- {{CompatGeckoDesktop("34")}} with the standard name
9.0 with the non-standard name msMatchesSelector11.5 with the non-standard name oMatchesSelector
- 15.0 with the non-standard name webkitMatchesSelector
5.0 with the non-standard name webkitMatchesSelector
requestPointerLock()16.0 {{property_prefix("webkit")}}, behind an about:flags
- 22.0 {{property_prefix("webkit")}} (with special cases, progressively lifted see [2])
{{CompatVersionUnknown}}{{CompatGeckoDesktop("14")}}{{property_prefix("moz")}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
requestFullscreen()14.0 {{property_prefix("webkit")}}{{CompatVersionUnknown}}{{CompatGeckoDesktop("10")}} {{property_prefix("moz")}}11.0 {{property_prefix("ms")}}12.10
- 15.0 {{property_prefix("webkit")}}
5.1 {{property_prefix("webkit")}}
undoManager and undoScope{{CompatNo}}{{CompatNo}}{{CompatVersionUnknown}} (behind the dom.undo_manager.enabled pref){{CompatNo}}{{CompatNo}}{{CompatNo}}
attributes{{CompatUnknown}}{{CompatNo}}{{CompatGeckoDesktop("22")}}
- Before this it was available via the {{domxref("Node")}} interface that any element inherits.
{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
scrollTopMax() and scrollLeftMax(){{CompatNo}}{{CompatNo}}{{CompatGeckoDesktop("16")}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
closest(){{CompatUnknown}}{{CompatVersionUnknown}}{{CompatGeckoDesktop("35")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
hasAttributes(){{CompatVersionUnknown}}{{CompatNo}}{{CompatGeckoDesktop("1.0")}} (on the {{domxref("Node")}} interface)
- {{CompatGeckoDesktop("35")}} (on this interface
{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
insertAdjacentElement(), insertAdjacentText(){{CompatVersionUnknown}}{{CompatNo}}{{CompatGeckoDesktop("48.0")}}{{CompatUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
assignedSlotattatchShadow, shadowRoot, and slot{{CompatChrome(53)}}{{CompatNo}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
computedRole and computedName{{CompatChrome(41)}}[4]{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}28[4]{{CompatUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidAndroid WebviewEdgeFirefox Mobile (Gecko)IE PhoneOpera MobileSafari MobileChrome for Android
Basic support1.0 {{CompatVersionUnknown}}{{CompatGeckoMobile("1")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}1.0 
scrollTopMax() and scrollLeftMax(){{CompatNo}} {{CompatNo}}{{CompatGeckoMobile("16")}}{{CompatNo}}{{CompatNo}}{{CompatNo}} 
closest(){{CompatUnknown}} {{CompatVersionUnknown}}{{CompatGeckoMobile("35")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}} 
hasAttributes(){{CompatVersionUnknown}} {{CompatNo}}{{CompatGeckoMobile("1.0")}} (on the {{domxref("Node")}} interface)
- {{CompatGeckoMobile("35")}} (on this interface
{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}} 
insertAdjacentElement(), insertAdjacentText(){{CompatVersionUnknown}} {{CompatVersionUnknown}}{{CompatGeckoMobile("48.0")}}{{CompatUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}} 
assignedSlotattatchShadow, shadowRoot, and slot{{CompatNo}}{{CompatChrome(53.0)}}{{CompatNo}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatChrome(53)}}
computedRole and computedName{{CompatNo}}{{CompatNo}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}28[4]{{CompatUnknown}}{{CompatNo}}
-
- -

[1] Internet Explorer 7 and 8 incorrectly return the comments as part of the children of an Element. This is fixed in Internet Explorer 9 and later.

- -

[2] Chrome 16 allowed webkitRequestPointerLock() only in fullscreen; Chrome 21 for trusted web site (permission asked); Chrome 22 allowed it by default for all same-origin document; Chrome 23 allowed it in sandboxed {{HTMLElement("iframe")}} if the non-standard value webkit-allow-pointer-lock is set to the {{htmlattrxref("sandbox", "iframe")}} attribute.

- -

[3] Implementation withdrawn. See {{Bug("1166347")}}.

- -

[4] Behind a flag.

diff --git a/files/ar/web/api/element/insertadjacenthtml/index.html b/files/ar/web/api/element/insertadjacenthtml/index.html deleted file mode 100644 index 3b02d86986..0000000000 --- a/files/ar/web/api/element/insertadjacenthtml/index.html +++ /dev/null @@ -1,102 +0,0 @@ ---- -title: Element.insertAdjacentHTML() -slug: Web/API/Element/insertAdjacentHTML -tags: - - دوم - - عنصر إدخال -translation_of: Web/API/Element/insertAdjacentHTML ---- -
{{APIRef("DOM")}}
- -

تعمل طريقة  ()insertAdjacentHTML ل {{domxref ("Element")}}

- -

للواجهة على تحليل النص المحدد بتنسيق HTML أو XML وإدراج العقد الناتجة في شجرة DOM في موضع محدد. لا يعيد العنصر الذي يتم استخدامه عليه، وبالتالي لا يفسد العناصر الموجودة داخل هذا العنصر. هذا يتجنب الخطوة الإضافية للتسلسل، مما يجعلها أسرع بكثير من المعالجة المباشر

- -

{{domxref ("Element.innerHTML","innerHTML")}}.

- -

بناء الجملة

- -
element.insertAdjacentHTML(position, text);
- -

العوامل

- -
-
position الموضع 
-
{{domxref ("DOMString")}} يمثل الموضع المتعلق بالعنصر element ؛ يجب أن يكون أحد السلاسل strings التالية:
-
-
    -
  • 'beforebegin':   قبل العنصر element نفسه.
  • -
  • 'afterbegin': داخل العنصر element, قبل التابع الأول له (child).
  • -
  • 'beforeend': داخل العنصر element, بعد آخر تابع له (child).
  • -
  • 'afterend': بعد العنصر element نفسه.
  • -
-
-
text النص
-
السلسلة (string) المطلوب تحليلها كـ HTML أو XML وإدراجها في الشجرة.
-
- -

تصور مرئي لأسماء المواقع

- -
<!-- beforebegin -->
-<p>
-  <!-- afterbegin -->
-  foo
-  <!-- beforeend -->
-</p>
-<!-- afterend -->
- -
ملحوظة: لا يعمل الوضع قبل البداية والنهاية إلا إذا كانت العقدة في شجرة DOM ولها عنصر أصل.
- -

مثال

- -
// <div id="one">one</div>
-var d1 = document.getElementById('one');
-d1.insertAdjacentHTML('afterend', '<div id="two">two</div>');
-
-// 
- -
At this point, the new structure is:
- -
// <div id="one">one</div><div id="two">two</div>
- -

ملاحظات

- -

إعتبارات أمنية

- -

عند إدراج HTML في صفحة باستخدام insertAdjacentHTML () ، احرص على عدم استخدام إدخال المستخدم الذي لم يتم تجاوزه.

- -

لا يُنصح باستخدام insertAdjacentHTML () عند إدراج نص عادي ؛ بدلاً من ذلك ، استخدم خاصية {{domxref ("Node.textContent")}} أو طريقة method {{domxref ("Element.insertAdjacentText ()")}}. هذا لا يفسر المحتوى الذي تم تمريره على أنه HTML ، ولكن بدلاً من ذلك يُدرجه كنص خام.

- -

مواصفات

- - - - - - - - - - - - - - - - -
مواصفاتالحالةتعليق
{{SpecName('DOM Parsing', '#dom-element-insertadjacenthtml', 'Element.insertAdjacentHTML()')}}{{ Spec2('DOM Parsing') }}
- -

التوافق مع المتصفحات

- - - -

{{Compat("api.Element.insertAdjacentHTML")}}

- -

شاهد أيضا

- -
    -
  • {{domxref("Element.insertAdjacentElement()")}}
  • -
  • {{domxref("Element.insertAdjacentText()")}}
  • -
  • {{domxref("XMLSerializer")}}: Construct a DOM representation of XML text
  • -
  • hacks.mozilla.org guest post by Henri Sivonen including benchmark showing that insertAdjacentHTML can be way faster in some cases.
  • -
diff --git a/files/ar/web/api/event/index.html b/files/ar/web/api/event/index.html deleted file mode 100644 index bd9bc76522..0000000000 --- a/files/ar/web/api/event/index.html +++ /dev/null @@ -1,136 +0,0 @@ ---- -title: Event -slug: Web/API/Event -translation_of: Web/API/Event ---- -

{{APIRef("DOM")}}

- -

The Event interface represents any event of the DOM. It contains common properties and methods to any event.

- -

A lot of other interfaces inherits, directly or not, from this base interface:

- -
-
    -
  • {{domxref("AnimationEvent")}}
  • -
  • {{domxref("AudioProcessingEvent")}}
  • -
  • {{domxref("BeforeInputEvent")}}
  • -
  • {{domxref("BeforeUnloadEvent")}}
  • -
  • {{domxref("BlobEvent")}}
  • -
  • {{domxref("ClipboardEvent")}}
  • -
  • {{domxref("CloseEvent")}}
  • -
  • {{domxref("CompositionEvent")}}
  • -
  • {{domxref("CSSFontFaceLoadEvent")}}
  • -
  • {{domxref("CustomEvent")}}
  • -
  • {{domxref("DeviceLightEvent")}}
  • -
  • {{domxref("DeviceMotionEvent")}}
  • -
  • {{domxref("DeviceOrientationEvent")}}
  • -
  • {{domxref("DeviceProximityEvent")}}
  • -
  • {{domxref("DOMTransactionEvent")}}
  • -
  • {{domxref("DragEvent")}}
  • -
  • {{domxref("EditingBeforeInputEvent")}}
  • -
  • {{domxref("ErrorEvent")}}
  • -
  • {{domxref("FocusEvent")}}
  • -
  • {{domxref("GamepadEvent")}}
  • -
  • {{domxref("HashChangeEvent")}}
  • -
  • {{domxref("IDBVersionChangeEvent")}}
  • -
  • {{domxref("InputEvent")}}
  • -
  • {{domxref("KeyboardEvent")}}
  • -
  • {{domxref("MediaStreamEvent")}}
  • -
  • {{domxref("MessageEvent")}}
  • -
  • {{domxref("MouseEvent")}}
  • -
  • {{domxref("MutationEvent")}}
  • -
  • {{domxref("OfflineAudioCompletionEvent")}}
  • -
  • {{domxref("PageTransitionEvent")}}
  • -
  • {{domxref("PointerEvent")}}
  • -
  • {{domxref("PopStateEvent")}}
  • -
  • {{domxref("ProgressEvent")}}
  • -
  • {{domxref("RelatedEvent")}}
  • -
  • {{domxref("RTCDataChannelEvent")}}
  • -
  • {{domxref("RTCIdentityErrorEvent")}}
  • -
  • {{domxref("RTCIdentityEvent")}}
  • -
  • {{domxref("RTCPeerConnectionIceEvent")}}
  • -
  • {{domxref("SensorEvent")}}
  • -
  • {{domxref("StorageEvent")}}
  • -
  • {{domxref("SVGEvent")}}
  • -
  • {{domxref("SVGZoomEvent")}}
  • -
  • {{domxref("TimeEvent")}}
  • -
  • {{domxref("TouchEvent")}}
  • -
  • {{domxref("TrackEvent")}}
  • -
  • {{domxref("TransitionEvent")}}
  • -
  • {{domxref("UIEvent")}}
  • -
  • {{domxref("UserProximityEvent")}}
  • -
  • {{domxref("WheelEvent")}}
  • -
-
- -

Constructor

- -
-
{{domxref("Event.Event", "Event()")}}
-
Creates an Event object.
-
- -

Properties

- -

This interface doesn't inherit any property.

- -
-
{{domxref("Event.bubbles")}} {{readonlyinline}}
-
A boolean indicating whether the event bubbles up through the DOM or not.
-
{{domxref("Event.cancelable")}} {{readonlyinline}}
-
A boolean indicating whether the event is cancelable.
-
{{domxref("Event.currentTarget")}} {{readonlyinline}}
-
A reference to the currently registered target for the event.
-
{{domxref("Event.defaultPrevented")}} {{readonlyinline}}
-
Indicates whether or not {{domxref("event.preventDefault()")}} has been called on the event.
-
{{domxref("Event.eventPhase")}} {{readonlyinline}}
-
Indicates which phase of the event flow is being processed.
-
{{domxref("Event.explicitOriginalTarget")}} {{non-standard_inline}} {{readonlyinline}}
-
The explicit original target of the event (Mozilla-specific).
-
{{domxref("Event.originalTarget")}} {{non-standard_inline}} {{readonlyinline}}
-
The original target of the event, before any retargetings (Mozilla-specific).
-
{{domxref("Event.target")}} {{readonlyinline}}
-
A reference to the target to which the event was originally dispatched.
-
{{domxref("Event.timeStamp")}} {{readonlyinline}}
-
The time that the event was created.
-
{{domxref("Event.type")}} {{readonlyinline}}
-
The name of the event (case-insensitive).
-
{{domxref("Event.isTrusted")}} {{readonlyinline}}
-
Indicates whether or not the event was initiated by the browser (after a user click for instance) or by a script (using an event creation method, like event.initEvent)
-
- -

Methods

- -

This interface doesn't inherit any method.

- -
-
{{domxref("Event.initEvent()")}} {{deprecated_inline}}
-
Initializes the value of an Event created. If the event has already being dispatched, this method does nothing.
-
{{domxref("Event.preventBubble()")}} {{non-standard_inline}} {{Obsolete_inline(24)}}
-
Prevents the event from bubbling. Obsolete, use {{domxref("event.stopPropagation")}} instead.
-
{{domxref("Event.preventCapture()")}} {{non-standard_inline}} {{Obsolete_inline(24)}}
-
Obsolete, use {{domxref("event.stopPropagation")}} instead.
-
{{domxref("Event.preventDefault()")}}
-
Cancels the event (if it is cancelable).
-
{{domxref("Event.stopImmediatePropagation()")}}
-
For this particular event, no other listener will be called. Neither those attached on the same element, nor those attached on elements which will be traversed later (in capture phase, for instance)
-
{{domxref("Event.stopPropagation()")}}
-
Stops the propagation of events further along in the DOM.
-
{{domxref("Event.getPreventDefault()")}} {{non-standard_inline}}
-
?
-
- -

See also

- - diff --git a/files/ar/web/api/geolocation/index.html b/files/ar/web/api/geolocation/index.html deleted file mode 100644 index 81d4548549..0000000000 --- a/files/ar/web/api/geolocation/index.html +++ /dev/null @@ -1,118 +0,0 @@ ---- -title: Geolocation -slug: Web/API/Geolocation -tags: - - API - - Advanced - - Geolocation API - - Interface - - NeedsTranslation - - Reference - - TopicStub -translation_of: Web/API/Geolocation ---- -
{{APIRef("Geolocation API")}}
- -

The Geolocation interface represents an object able to programmatically obtain the position of the device. It gives Web content access to the location of the device. This allows a Web site or app to offer customized results based on the user's location.

- -

An object with this interface is obtained using the {{domxref("NavigatorGeolocation.geolocation")}} property implemented by the {{domxref("Navigator")}} object.

- -
-

Note: For security reasons, when a web page tries to access location information, the user is notified and asked to grant permission. Be aware that each browser has its own policies and methods for requesting this permission.

-
- -

Properties

- -

The Geolocation interface neither implements, nor inherits any property.

- -

Methods

- -

The Geolocation interface doesn't inherit any method.

- -
-
{{domxref("Geolocation.getCurrentPosition()")}}
-
Determines the device's current location and gives back a {{domxref("Position")}} object with the data.
-
{{domxref("Geolocation.watchPosition()")}}
-
Returns a long value representing the newly established callback function to be invoked whenever the device location changes.
-
{{domxref("Geolocation.clearWatch()")}}
-
Removes the particular handler previously installed using watchPosition().
-
- -

Specifications

- - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('Geolocation')}}{{Spec2('Geolocation')}}Initial specification.
- -

Browser compatibility

- -

{{ CompatibilityTable() }}

- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support5{{CompatGeckoDesktop("1.9.1")}}910.60
- Removed in 15.0
- Reintroduced in 16.0
5
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatUnknown()}}{{CompatUnknown()}}{{CompatGeckoMobile("4")}}{{CompatUnknown()}}10.60{{CompatUnknown()}}
-
- -

See also

- - diff --git a/files/ar/web/api/geolocation_api/index.html b/files/ar/web/api/geolocation_api/index.html deleted file mode 100644 index 74cf4c6caf..0000000000 --- a/files/ar/web/api/geolocation_api/index.html +++ /dev/null @@ -1,295 +0,0 @@ ---- -title: Using geolocation -slug: Web/API/Geolocation_API -translation_of: Web/API/Geolocation_API -original_slug: Web/API/Geolocation/Using_geolocation ---- -

The geolocation API allows the user to provide their location to web applications if they so desire. For privacy reasons, the user is asked for permission to report location information.

- -

The geolocation object

- -

The geolocation API is published through the {{domxref("navigator.geolocation")}} object.

- -

If the object exists, geolocation services are available. You can test for the presence of geolocation thusly:

- -
if ("geolocation" in navigator) {
-  /* geolocation is available */
-} else {
-  /* geolocation IS NOT available */
-}
-
- -
-

Note: On Firefox 24 and older versions, "geolocation" in navigator always returned true even if the API was disabled. This has been fixed with Firefox 25 to comply with the spec. ({{bug(884921)}}).

-
- -

Getting the current position

- -

To obtain the user's current location, you can call the {{domxref("geolocation.getCurrentPosition()","getCurrentPosition()")}} method. This initiates an asynchronous request to detect the user's position, and queries the positioning hardware to get up-to-date information. When the position is determined, the defined callback function is executed. You can optionally provide a second callback function to be executed if an error occurs. A third, optional, parameter is an options object where you can set the maximum age of the position returned, the time to wait for a request, and if you want high accuracy for the position.

- -
-

Note: By default, {{domxref("Geolocation.getCurrentPosition()","getCurrentPosition()")}} tries to answer as fast as possible with a low accuracy result. It is useful if you need a quick answer regardless of the accuracy. Devices with a GPS, for example, can take a minute or more to get a GPS fix, so less accurate data (IP location or wifi) may be returned to {{domxref("Geolocation.getCurrentPosition()","getCurrentPosition()")}}.

-
- -
navigator.geolocation.getCurrentPosition(function(position) {
-  do_something(position.coords.latitude, position.coords.longitude);
-});
- -

The above example will cause the do_something() function to execute when the location is obtained.

- -

Watching the current position

- -

If the position data changes (either by device movement or if more accurate geo information arrives), you can set up a callback function that is called with that updated position information. This is done using the {{domxref("Geolocation.watchPosition()","watchPosition()")}} function, which has the same input parameters as {{domxref("Geolocation.getCurrentPosition()","getCurrentPosition()")}}. The callback function is called multiple times, allowing the browser to either update your location as you move, or provide a more accurate location as different techniques are used to geolocate you. The error callback function, which is optional just as it is for {{domxref("Geolocation.getCurrentPosition()","getCurrentPosition()")}}, can be called repeatedly.

- -
-

Note: You can use {{domxref("Geolocation.watchPosition()","watchPosition()")}} without an initial {{domxref("Geolocation.getCurrentPosition()","getCurrentPosition()")}} call.

-
- -
var watchID = navigator.geolocation.watchPosition(function(position) {
-  do_something(position.coords.latitude, position.coords.longitude);
-});
- -

The {{domxref("Geolocation.watchPosition()","watchPosition()")}} method returns an ID number that can be used to uniquely identify the requested position watcher; you use this value in tandem with the {{domxref("Geolocation.clearWatch()","clearWatch()")}} method to stop watching the user's location.

- -
navigator.geolocation.clearWatch(watchID);
-
- -

Fine tuning response

- -

Both {{domxref("Geolocation.getCurrentPosition()","getCurrentPosition()")}} and {{domxref("Geolocation.watchPosition()","watchPosition()")}} accept a success callback, an optional error callback, and an optional PositionOptions object.

- -

{{page("/en-US/docs/DOM/navigator.geolocation.getCurrentPosition","PositionOptions")}}

- -

A call to {{domxref("Geolocation.watchPosition()","watchPosition")}} could look like:

- -
function geo_success(position) {
-  do_something(position.coords.latitude, position.coords.longitude);
-}
-
-function geo_error() {
-  alert("Sorry, no position available.");
-}
-
-var geo_options = {
-  enableHighAccuracy: true,
-  maximumAge        : 30000,
-  timeout           : 27000
-};
-
-var wpid = navigator.geolocation.watchPosition(geo_success, geo_error, geo_options);
- -

A demo of watchPosition in use: http://www.thedotproduct.org/experiments/geo/
- 

- -

Describing a position

- -

The user's location is described using a Position object referencing a Coordinates object.

- -

{{page("/en-US/docs/DOM/navigator/geolocation/getCurrentPosition","Position")}}

- -

{{page("/en-US/docs/DOM/navigator/geolocation/getCurrentPosition","Coordinates")}}

- -

Handling errors

- -

The error callback function, if provided when calling getCurrentPosition() or watchPosition(), expects a PositionError object as its first parameter.

- -
function errorCallback(error) {
-  alert('ERROR(' + error.code + '): ' + error.message);
-};
-
- -

{{page("/en-US/docs/DOM/navigator/geolocation/getCurrentPosition","PositionError")}}

- -

Geolocation Live Example

- - - -

HTML Content

- -
<p><button onclick="geoFindMe()">Show my location</button></p>
-<div id="out"></div>
-
- -

JavaScript Content

- -
function geoFindMe() {
-  var output = document.getElementById("out");
-
-  if (!navigator.geolocation){
-    output.innerHTML = "<p>Geolocation is not supported by your browser</p>";
-    return;
-  }
-
-  function success(position) {
-    var latitude  = position.coords.latitude;
-    var longitude = position.coords.longitude;
-
-    output.innerHTML = '<p>Latitude is ' + latitude + '° <br>Longitude is ' + longitude + '°</p>';
-
-    var img = new Image();
-    img.src = "https://maps.googleapis.com/maps/api/staticmap?center=" + latitude + "," + longitude + "&zoom=13&size=300x300&sensor=false";
-
-    output.appendChild(img);
-  };
-
-  function error() {
-    output.innerHTML = "Unable to retrieve your location";
-  };
-
-  output.innerHTML = "<p>Locating…</p>";
-
-  navigator.geolocation.getCurrentPosition(success, error);
-}
-
- -

Live Result

- -

{{EmbedLiveSample('Geolocation_Live_Example', 350, 410)}}

- -

Prompting for permission

- -

Any add-on hosted on addons.mozilla.org which makes use of geolocation data must explicitly request permission before doing so. The following function will request permission in a manner similar to the automatic prompt displayed for web pages. The user's response will be saved in the preference specified by the pref parameter, if applicable. The function provided in the callback parameter will be called with a boolean value indicating the user's response. If true, the add-on may access geolocation data.

- -
function prompt(window, pref, message, callback) {
-    let branch = Components.classes["@mozilla.org/preferences-service;1"]
-                           .getService(Components.interfaces.nsIPrefBranch);
-
-    if (branch.getPrefType(pref) === branch.PREF_STRING) {
-        switch (branch.getCharPref(pref)) {
-        case "always":
-            return callback(true);
-        case "never":
-            return callback(false);
-        }
-    }
-
-    let done = false;
-
-    function remember(value, result) {
-        return function() {
-            done = true;
-            branch.setCharPref(pref, value);
-            callback(result);
-        }
-    }
-
-    let self = window.PopupNotifications.show(
-        window.gBrowser.selectedBrowser,
-        "geolocation",
-        message,
-        "geo-notification-icon",
-        {
-            label: "Share Location",
-            accessKey: "S",
-            callback: function(notification) {
-                done = true;
-                callback(true);
-            }
-        }, [
-            {
-                label: "Always Share",
-                accessKey: "A",
-                callback: remember("always", true)
-            },
-            {
-                label: "Never Share",
-                accessKey: "N",
-                callback: remember("never", false)
-            }
-        ], {
-            eventCallback: function(event) {
-                if (event === "dismissed") {
-                    if (!done) callback(false);
-                    done = true;
-                    window.PopupNotifications.remove(self);
-                }
-            },
-            persistWhileVisible: true
-        });
-}
-
-prompt(window,
-       "extensions.foo-addon.allowGeolocation",
-       "Foo Add-on wants to know your location.",
-       function callback(allowed) { alert(allowed); });
-
- -

Browser compatibility

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support5{{CompatGeckoDesktop("1.9.1")}}[1]910.60
- {{CompatNo}} 15.0
- 16.0
5
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)Firefox OSIE MobileOpera MobileSafari Mobile
Basic support{{CompatUnknown}}{{CompatUnknown}}{{CompatGeckoMobile("4")}}1.0.1{{CompatUnknown}}10.60
- {{CompatNo}} 15.0
- 16.0
{{CompatUnknown}}
-
- -

[1] Firefox includes support for locating you based on your WiFi information using Google Location Services. In the transaction between Firefox and Google, data is exchanged including WiFi Access Point data, an access token (similar to a 2 week cookie), and the user's IP address. For more information, please check out Mozilla's Privacy Policy and Google's Privacy Policy covering how this data can be used.

- -

Firefox 3.6 (Gecko 1.9.2) added support for using the GPSD (GPS daemon) service for geolocation on Linux.

- -

See also

- - diff --git a/files/ar/web/api/geolocation_api/using_the_geolocation_api/index.html b/files/ar/web/api/geolocation_api/using_the_geolocation_api/index.html deleted file mode 100644 index 86610979b0..0000000000 --- a/files/ar/web/api/geolocation_api/using_the_geolocation_api/index.html +++ /dev/null @@ -1,167 +0,0 @@ ---- -title: Using the Geolocation API -slug: Web/API/Geolocation_API/Using_the_Geolocation_API -translation_of: Web/API/Geolocation_API/Using_the_Geolocation_API -original_slug: Web/API/Geolocation/Using_geolocation/Using_the_Geolocation_API ---- -
{{securecontext_header}}{{DefaultAPISidebar("Geolocation API")}}
- -

The Geolocation API is used to retrieve the user's location, so that it can for example be used to display their position using a mapping API. This article explains the basics of how to use it.

- -

The geolocation object

- -

The Geolocation API is available through the {{domxref("navigator.geolocation")}} object.

- -

If the object exists, geolocation services are available. You can test for the presence of geolocation thusly:

- -
if ("geolocation" in navigator) {
-  /* geolocation is available */
-} else {
-  /* geolocation IS NOT available */
-}
-
- -

Getting the current position

- -

To obtain the user's current location, you can call the {{domxref("geolocation.getCurrentPosition()","getCurrentPosition()")}} method. This initiates an asynchronous request to detect the user's position, and queries the positioning hardware to get up-to-date information. When the position is determined, the defined callback function is executed. You can optionally provide a second callback function to be executed if an error occurs. A third, optional, parameter is an options object where you can set the maximum age of the position returned, the time to wait for a request, and if you want high accuracy for the position.

- -
-

Note: By default, {{domxref("Geolocation.getCurrentPosition()","getCurrentPosition()")}} tries to answer as fast as possible with a low accuracy result. It is useful if you need a quick answer regardless of the accuracy. Devices with a GPS, for example, can take a minute or more to get a GPS fix, so less accurate data (IP location or wifi) may be returned to {{domxref("Geolocation.getCurrentPosition()","getCurrentPosition()")}}.

-
- -
navigator.geolocation.getCurrentPosition(function(position) {
-  do_something(position.coords.latitude, position.coords.longitude);
-});
- -

The above example will cause the do_something() function to execute when the location is obtained.

- -

Watching the current position

- -

If the position data changes (either by device movement or if more accurate geo information arrives), you can set up a callback function that is called with that updated position information. This is done using the {{domxref("Geolocation.watchPosition()","watchPosition()")}} function, which has the same input parameters as {{domxref("Geolocation.getCurrentPosition()","getCurrentPosition()")}}. The callback function is called multiple times, allowing the browser to either update your location as you move, or provide a more accurate location as different techniques are used to geolocate you. The error callback function, which is optional just as it is for {{domxref("Geolocation.getCurrentPosition()","getCurrentPosition()")}}, can be called repeatedly.

- -
-

Note: You can use {{domxref("Geolocation.watchPosition()","watchPosition()")}} without an initial {{domxref("Geolocation.getCurrentPosition()","getCurrentPosition()")}} call.

-
- -
var watchID = navigator.geolocation.watchPosition(function(position) {
-  do_something(position.coords.latitude, position.coords.longitude);
-});
- -

The {{domxref("Geolocation.watchPosition()","watchPosition()")}} method returns an ID number that can be used to uniquely identify the requested position watcher; you use this value in tandem with the {{domxref("Geolocation.clearWatch()","clearWatch()")}} method to stop watching the user's location.

- -
navigator.geolocation.clearWatch(watchID);
-
- -

Fine tuning the response

- -

Both {{domxref("Geolocation.getCurrentPosition()","getCurrentPosition()")}} and {{domxref("Geolocation.watchPosition()","watchPosition()")}} accept a success callback, an optional error callback, and an optional PositionOptions object.

- -

This object allows you to specify whether to enable high accuracy, a maximum age for the returned position value (up until this age it will be cached and reused if the same position is requested again; after this the browser will request fresh position data), and a timeout value that dictates how long the browser should attempt to get the position data for, before it times out.

- -

A call to {{domxref("Geolocation.watchPosition()","watchPosition")}} could look like:

- -
function geo_success(position) {
-  do_something(position.coords.latitude, position.coords.longitude);
-}
-
-function geo_error() {
-  alert("Sorry, no position available.");
-}
-
-var geo_options = {
-  enableHighAccuracy: true,
-  maximumAge        : 30000,
-  timeout           : 27000
-};
-
-var wpid = navigator.geolocation.watchPosition(geo_success, geo_error, geo_options);
- -

Describing a position

- -

The user's location is described using a {{domxref("GeolocationPosition")}} object instance, which itself contains a {{domxref("GeolocationCoordinates")}} object instance.

- -

The GeolocationPosition instance contains only two things, a coords property that contains the GeolocationCoordinates instance, and a timestamp property that contains a {{domxref("DOMTimeStamp")}} instance representing the time at which the position data was retrieved.

- -

The GeolocationCoordinates instance contains a number of properties, but the two you'll use most commonly are latitude and longitude, which are what you need to draw your position on a map. Hence many Geolocation success callbacks look fairly simple:

- -
function success(position) {
-  const latitude  = position.coords.latitude;
-  const longitude = position.coords.longitude;
-
-  // Do something with your latitude and longitude
-}
- -

You can however get a number of other bits of information from a GeolocationCoordinates object, including altitude, speed, what direction the device is facing, and an accuracy measure of the altitude, longitude, and latitude data.

- -

Handling errors

- -

The error callback function, if provided when calling getCurrentPosition() or watchPosition(), expects a GeolocationPositionError object instance as its first parameter. This object type contains two properties, a code indicating what type of error has been returned, and a human-readable message that describes what the error code means.

- -

You could use it like so:

- -
function errorCallback(error) {
-  alert('ERROR(' + error.code + '): ' + error.message);
-};
-
- -

Examples

- -

In the following example the Geolocation API is used to retrieve the user's latitude and longitude. If sucessful, the available hyperlink is populated with an openstreetmap.org URL that will show their location.

- - - -

HTML Content

- -
<button id = "find-me">Show my location</button><br/>
-<p id = "status"></p>
-<a id = "map-link" target="_blank"></a>
-
- -

JavaScript Content

- -
function geoFindMe() {
-
-  const status = document.querySelector('#status');
-  const mapLink = document.querySelector('#map-link');
-
-  mapLink.href = '';
-  mapLink.textContent = '';
-
-  function success(position) {
-    const latitude  = position.coords.latitude;
-    const longitude = position.coords.longitude;
-
-    status.textContent = '';
-    mapLink.href = `https://www.openstreetmap.org/#map=18/${latitude}/${longitude}`;
-    mapLink.textContent = `Latitude: ${latitude} °, Longitude: ${longitude} °`;
-  }
-
-  function error() {
-    status.textContent = 'Unable to retrieve your location';
-  }
-
-  if (!navigator.geolocation) {
-    status.textContent = 'Geolocation is not supported by your browser';
-  } else {
-    status.textContent = 'Locating…';
-    navigator.geolocation.getCurrentPosition(success, error);
-  }
-
-}
-
-document.querySelector('#find-me').addEventListener('click', geoFindMe);
-
- -

Live Result

- -

{{EmbedLiveSample('Examples', 350, 150, "", "", "", "geolocation")}}

diff --git a/files/ar/web/api/history_api/example/index.html b/files/ar/web/api/history_api/example/index.html deleted file mode 100644 index b31bb01cf2..0000000000 --- a/files/ar/web/api/history_api/example/index.html +++ /dev/null @@ -1,417 +0,0 @@ ---- -title: مثال تصفح آجاكس -slug: Web/API/History_API/Example -translation_of: Web/API/History_API/Example -original_slug: Web/API/History_API/مثال ---- -

هذا مثال عن موقع واب يستعمل تقنية Ajax مُكَـوَّن فقط من ثلاث صفحات (first_page.php، second_page.php  و third_page.php). لرؤية كيفية اشتغالها، رجاء، قم بصنع الملفات التالية (أو git clone https://github.com/giabao/mdn-ajax-nav-example.git)

- -
ملاحظة: لدمج كامل لعناصر{{HTMLElement("form")}} ضمن هذه الآلية، رجاء ألق نظرة على فقرة Submitting forms and uploading files.
- -

first_page.php:

- -
-
<?php
-    $page_title = "First page";
-
-    $as_json = false;
-    if (isset($_GET["view_as"]) && $_GET["view_as"] == "json") {
-        $as_json = true;
-        ob_start();
-    } else {
-?>
-<!doctype html>
-<html>
-<head>
-<?php
-        include "include/header.php";
-        echo "<title>" . $page_title . "</title>";
-?>
-</head>
-
-<body>
-
-<?php include "include/before_content.php"; ?>
-
-<p>This paragraph is shown only when the navigation starts from <strong>first_page.php</strong>.</p>
-
-<div id="ajax-content">
-<?php } ?>
-
-    <p>This is the content of <strong>first_page.php</strong>.</p>
-
-<?php
-    if ($as_json) {
-        echo json_encode(array("page" => $page_title, "content" => ob_get_clean()));
-    } else {
-?>
-</div>
-
-<p>This paragraph is shown only when the navigation starts from <strong>first_page.php</strong>.</p>
-
-<?php
-        include "include/after_content.php";
-        echo "</body>\n</html>";
-    }
-?>
-
-
- -

second_page.php:

- -
-
<?php
-    $page_title = "Second page";
-
-    $as_json = false;
-    if (isset($_GET["view_as"]) && $_GET["view_as"] == "json") {
-        $as_json = true;
-        ob_start();
-    } else {
-?>
-<!doctype html>
-<html>
-<head>
-<?php
-        include "include/header.php";
-        echo "<title>" . $page_title . "</title>";
-?>
-</head>
-
-<body>
-
-<?php include "include/before_content.php"; ?>
-
-<p>This paragraph is shown only when the navigation starts from <strong>second_page.php</strong>.</p>
-
-<div id="ajax-content">
-<?php } ?>
-
-    <p>This is the content of <strong>second_page.php</strong>.</p>
-
-<?php
-    if ($as_json) {
-        echo json_encode(array("page" => $page_title, "content" => ob_get_clean()));
-    } else {
-?>
-</div>
-
-<p>This paragraph is shown only when the navigation starts from <strong>second_page.php</strong>.</p>
-
-<?php
-        include "include/after_content.php";
-        echo "</body>\n</html>";
-    }
-?>
-
-
- -

third_page.php:

- -
-
<?php
-    $page_title = "Third page";
-    $page_content = "<p>This is the content of <strong>third_page.php</strong>. This content is stored into a php variable.</p>";
-
-    if (isset($_GET["view_as"]) && $_GET["view_as"] == "json") {
-        echo json_encode(array("page" => $page_title, "content" => $page_content));
-    } else {
-?>
-<!doctype html>
-<html>
-<head>
-<?php
-        include "include/header.php";
-        echo "<title>" . $page_title . "</title>";
-?>
-</head>
-
-<body>
-
-<?php include "include/before_content.php"; ?>
-
-<p>This paragraph is shown only when the navigation starts from <strong>third_page.php</strong>.</p>
-
-<div id="ajax-content">
-<?php echo $page_content; ?>
-</div>
-
-<p>This paragraph is shown only when the navigation starts from <strong>third_page.php</strong>.</p>
-
-<?php
-        include "include/after_content.php";
-        echo "</body>\n</html>";
-    }
-?>
-
-
- -

css/style.css:

- -
#ajax-loader {
-    position: fixed;
-    display: table;
-    top: 0;
-    left: 0;
-    width: 100%;
-    height: 100%;
-}
-
-#ajax-loader > div {
-    display: table-cell;
-    width: 100%;
-    height: 100%;
-    vertical-align: middle;
-    text-align: center;
-    background-color: #000000;
-    opacity: 0.65;
-}
-
- -

include/after_content.php:

- -
<p>This is the footer. It is shared between all ajax pages.</p>
-
- -

include/before_content.php:

- -
<p>
-[ <a class="ajax-nav" href="first_page.php">First example</a>
-| <a class="ajax-nav" href="second_page.php">Second example</a>
-| <a class="ajax-nav" href="third_page.php">Third example</a>
-| <a class="ajax-nav" href="unexisting.php">Unexisting page</a> ]
-</p>
-
-
- -

include/header.php:

- -
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<script type="text/javascript" src="js/ajax_nav.js"></script>
-<link rel="stylesheet" href="css/style.css" />
-
- -

js/ajax_nav.js:

- -

(قبل تنفيذها في بيئة العمل، رجاءً اقرأ the note about the const statement compatibility)

- -
-
"use strict";
-
-const ajaxRequest = new (function () {
-
-    function closeReq () {
-        oLoadingBox.parentNode && document.body.removeChild(oLoadingBox);
-        bIsLoading = false;
-    }
-
-    function abortReq () {
-        if (!bIsLoading) { return; }
-        oReq.abort();
-        closeReq();
-    }
-
-    function ajaxError () {
-        alert("Unknown error.");
-    }
-
-    function ajaxLoad () {
-        var vMsg, nStatus = this.status;
-        switch (nStatus) {
-            case 200:
-                vMsg = JSON.parse(this.responseText);
-                document.title = oPageInfo.title = vMsg.page;
-                document.getElementById(sTargetId).innerHTML = vMsg.content;
-                if (bUpdateURL) {
-                    history.pushState(oPageInfo, oPageInfo.title, oPageInfo.url);
-                    bUpdateURL = false;
-                }
-                break;
-            default:
-                vMsg = nStatus + ": " + (oHTTPStatus[nStatus] || "Unknown");
-                switch (Math.floor(nStatus / 100)) {
-                    /*
-                    case 1:
-                        // Informational 1xx
-                        console.log("Information code " + vMsg);
-                        break;
-                    case 2:
-                        // Successful 2xx
-                        console.log("Successful code " + vMsg);
-                        break;
-                    case 3:
-                        // Redirection 3xx
-                        console.log("Redirection code " + vMsg);
-                        break;
-                    */
-                    case 4:
-                        /* Client Error 4xx */
-                        alert("Client Error #" + vMsg);
-                        break;
-                    case 5:
-                        /* Server Error 5xx */
-                        alert("Server Error #" + vMsg);
-                        break;
-                    default:
-                        /* Unknown status */
-                        ajaxError();
-                }
-        }
-        closeReq();
-    }
-
-    function filterURL (sURL, sViewMode) {
-        return sURL.replace(rSearch, "") + ("?" + sURL.replace(rHost, "&").replace(rView, sViewMode ? "&" + sViewKey + "=" + sViewMode : "").slice(1)).replace(rEndQstMark, "");
-    }
-
-    function getPage (sPage) {
-        if (bIsLoading) { return; }
-        oReq = new XMLHttpRequest();
-        bIsLoading = true;
-        oReq.onload = ajaxLoad;
-        oReq.onerror = ajaxError;
-        if (sPage) { oPageInfo.url = filterURL(sPage, null); }
-        oReq.open("get", filterURL(oPageInfo.url, "json"), true);
-        oReq.send();
-        oLoadingBox.parentNode || document.body.appendChild(oLoadingBox);
-    }
-
-    function requestPage (sURL) {
-        if (history.pushState) {
-            bUpdateURL = true;
-            getPage(sURL);
-        } else {
-            /* Ajax navigation is not supported */
-            location.assign(sURL);
-        }
-    }
-
-    function processLink () {
-        if (this.className === sAjaxClass) {
-            requestPage(this.href);
-            return false;
-        }
-        return true;
-    }
-
-    function init () {
-        oPageInfo.title = document.title;
-        for (var oLink, nIdx = 0, nLen = document.links.length; nIdx < nLen; document.links[nIdx++].onclick = processLink);
-    }
-
-    const
-
-        /* customizable constants */
-        sTargetId = "ajax-content", sViewKey = "view_as", sAjaxClass = "ajax-nav",
-
-        /* not customizable constants */
-        rSearch = /\?.*$/, rHost = /^[^\?]*\?*&*/, rView = new RegExp("&" + sViewKey + "\\=[^&]*|&*$", "i"), rEndQstMark = /\?$/,
-        oLoadingBox = document.createElement("div"), oCover = document.createElement("div"), oLoadingImg = new Image(),
-        oPageInfo = {
-            title: null,
-            url: location.href
-        }, oHTTPStatus = /* http://www.iana.org/assignments/http-status-codes/http-status-codes.xml */ {
-            100: "Continue",
-            101: "Switching Protocols",
-            102: "Processing",
-            200: "OK",
-            201: "Created",
-            202: "Accepted",
-            203: "Non-Authoritative Information",
-            204: "No Content",
-            205: "Reset Content",
-            206: "Partial Content",
-            207: "Multi-Status",
-            208: "Already Reported",
-            226: "IM Used",
-            300: "Multiple Choices",
-            301: "Moved Permanently",
-            302: "Found",
-            303: "See Other",
-            304: "Not Modified",
-            305: "Use Proxy",
-            306: "Reserved",
-            307: "Temporary Redirect",
-            308: "Permanent Redirect",
-            400: "Bad Request",
-            401: "Unauthorized",
-            402: "Payment Required",
-            403: "Forbidden",
-            404: "Not Found",
-            405: "Method Not Allowed",
-            406: "Not Acceptable",
-            407: "Proxy Authentication Required",
-            408: "Request Timeout",
-            409: "Conflict",
-            410: "Gone",
-            411: "Length Required",
-            412: "Precondition Failed",
-            413: "Request Entity Too Large",
-            414: "Request-URI Too Long",
-            415: "Unsupported Media Type",
-            416: "Requested Range Not Satisfiable",
-            417: "Expectation Failed",
-            422: "Unprocessable Entity",
-            423: "Locked",
-            424: "Failed Dependency",
-            425: "Unassigned",
-            426: "Upgrade Required",
-            427: "Unassigned",
-            428: "Precondition Required",
-            429: "Too Many Requests",
-            430: "Unassigned",
-            431: "Request Header Fields Too Large",
-            500: "Internal Server Error",
-            501: "Not Implemented",
-            502: "Bad Gateway",
-            503: "Service Unavailable",
-            504: "Gateway Timeout",
-            505: "HTTP Version Not Supported",
-            506: "Variant Also Negotiates (Experimental)",
-            507: "Insufficient Storage",
-            508: "Loop Detected",
-            509: "Unassigned",
-            510: "Not Extended",
-            511: "Network Authentication Required"
-        };
-
-    var
-
-        oReq, bIsLoading = false, bUpdateURL = false;
-
-    oLoadingBox.id = "ajax-loader";
-    oCover.onclick = abortReq;
-    oLoadingImg.src = "data:image/gif;base64,R0lGODlhEAAQAPIAAP///wAAAMLCwkJCQgAAAGJiYoKCgpKSkiH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOggZnAdOmGYJRbExwroUmcG2LmDEwnHQLVsYOd2mBzkYDAdKa+dIAAAh+QQJCgAAACwAAAAAEAAQAAADNAi63P5OjCEgG4QMu7DmikRxQlFUYDEZIGBMRVsaqHwctXXf7WEYB4Ag1xjihkMZsiUkKhIAIfkECQoAAAAsAAAAABAAEAAAAzYIujIjK8pByJDMlFYvBoVjHA70GU7xSUJhmKtwHPAKzLO9HMaoKwJZ7Rf8AYPDDzKpZBqfvwQAIfkECQoAAAAsAAAAABAAEAAAAzMIumIlK8oyhpHsnFZfhYumCYUhDAQxRIdhHBGqRoKw0R8DYlJd8z0fMDgsGo/IpHI5TAAAIfkECQoAAAAsAAAAABAAEAAAAzIIunInK0rnZBTwGPNMgQwmdsNgXGJUlIWEuR5oWUIpz8pAEAMe6TwfwyYsGo/IpFKSAAAh+QQJCgAAACwAAAAAEAAQAAADMwi6IMKQORfjdOe82p4wGccc4CEuQradylesojEMBgsUc2G7sDX3lQGBMLAJibufbSlKAAAh+QQJCgAAACwAAAAAEAAQAAADMgi63P7wCRHZnFVdmgHu2nFwlWCI3WGc3TSWhUFGxTAUkGCbtgENBMJAEJsxgMLWzpEAACH5BAkKAAAALAAAAAAQABAAAAMyCLrc/jDKSatlQtScKdceCAjDII7HcQ4EMTCpyrCuUBjCYRgHVtqlAiB1YhiCnlsRkAAAOwAAAAAAAAAAAA==";
-    oCover.appendChild(oLoadingImg);
-    oLoadingBox.appendChild(oCover);
-
-    onpopstate = function (oEvent) {
-        bUpdateURL = false;
-        oPageInfo.title = oEvent.state.title;
-        oPageInfo.url = oEvent.state.url;
-        getPage();
-    };
-
-    window.addEventListener ? addEventListener("load", init, false) : window.attachEvent ? attachEvent("onload", init) : (onload = init);
-
-    // Public methods
-
-    this.open = requestPage;
-    this.stop = abortReq;
-    this.rebuildLinks = init;
-
-})();
-
-
-
- -
ملاحظة: التنفيذ الحالي لـconst (تعليمة ثابتة) ليست جزءا من ECMAScript 5. هي مدعومة على متصفحات فايرفوكس وكروم (V8) ومدعومة جزئيا على أوبرا 9+ وسافاري. ليست مدعومة على Internet Explorer 6-9، ولا في معاينة Internet Explorer 10. - ستكون معرفة في ECMAScript 6، لكن بدلالات أخرى. على غرار المتغيرات المعرفة (declared) بـتعليمة let ، الثوابت المعرفة بـconst ستكون. نقوم باستعمالها لغرض تعليمي. إذا كنت تريد توافقا كاملا مع المتصفح، رجاء قم باستبدال تعليمات const بتعليمات var.
- -

For more information, please see: Manipulating the browser history.

- -

See also

- -
    -
  • {{ domxref("window.history") }}
  • -
  • {{ domxref("window.onpopstate") }}
  • -
diff --git a/files/ar/web/api/history_api/index.html b/files/ar/web/api/history_api/index.html deleted file mode 100644 index 0db39b3b98..0000000000 --- a/files/ar/web/api/history_api/index.html +++ /dev/null @@ -1,262 +0,0 @@ ---- -title: Manipulating the browser history -slug: Web/API/History_API -tags: - - Advanced - - DOM - - HTML5 - - History - - NeedsTranslation - - TopicStub -translation_of: Web/API/History_API ---- -

با استفاده از آبجکت {{ domxref("window") }} می توانید به تاریخچه مرورگر توسط آبجت {{ domxref("window.history", "history") }}  دسترسی داشته باشید . این آبجکت متد ها و ویژگی های بسیار کاربردی را در اختیار شما قرار میدهد تا بتوانید در تاریخچه مرورگر به عقب یا جلو بروید در واقع قادر خواهید بود تا عمل back و forward را انجام دهید

- -

مرور در تاریخچه مرورگر

- -

با استفاده از

- -

Moving backward and forward through the user's history is done using the back(), forward(), and go() methods.

- -

Moving forward and backward

- -

To move backward through history, just do:

- -
window.history.back();
-
- -

This will act exactly like the user clicked on the Back button in their browser toolbar.

- -

Similarly, you can move forward (as if the user clicked the Forward button), like this:

- -
window.history.forward();
-
- -

Moving to a specific point in history

- -

You can use the go() method to load a specific page from session history, identified by its relative position to the current page (with the current page being, of course, relative index 0).

- -

To move back one page (the equivalent of calling back()):

- -
window.history.go(-1);
-
- -

To move forward a page, just like calling forward():

- -
window.history.go(1);
-
- -

Similarly, you can move forward 2 pages by passing 2, and so forth.

- -

You can determine the number of pages in the history stack by looking at the value of the length property:

- -
var numberOfEntries = window.history.length;
-
- -
Note: Internet Explorer supports passing string URLs as a parameter to go(); this is non-standard and not supported by Gecko.
- -

Adding and modifying history entries

- -

{{ gecko_minversion_header("2") }}

- -

HTML5 introduced the history.pushState() and history.replaceState() methods, which allow you to add and modify history entries, respectively. These methods work in conjunction with the {{ domxref("window.onpopstate") }} event.

- -

Using history.pushState() changes the referrer that gets used in the HTTP header for XMLHttpRequest objects created after you change the state. The referrer will be the URL of the document whose window is this at the time of creation of the XMLHttpRequest object.

- -

Example of pushState() method

- -

Suppose http://mozilla.org/foo.html executes the following JavaScript:

- -
var stateObj = { foo: "bar" };
-history.pushState(stateObj, "page 2", "bar.html");
-
- -

This will cause the URL bar to display http://mozilla.org/bar.html, but won't cause the browser to load bar.html or even check that bar.html exists.

- -

Suppose now that the user now navigates to http://google.com, then clicks back. At this point, the URL bar will display http://mozilla.org/bar.html, and the page will get a popstate event whose state object contains a copy of stateObj. The page itself will look like foo.html, although the page might modify its contents during the popstate event.

- -

If we click back again, the URL will change to http://mozilla.org/foo.html, and the document will get another popstate event, this time with a null state object. Here too, going back doesn't change the document's contents from what they were in the previous step, although the document might update its contents manually upon receiving the popstate event.

- -

The pushState() method

- -

pushState() takes three parameters: a state object, a title (which is currently ignored), and (optionally) a URL. Let's examine each of these three parameters in more detail:

- -
    -
  • -

    state object — The state object is a JavaScript object which is associated with the new history entry created by pushState(). Whenever the user navigates to the new state, a popstate event is fired, and the state property of the event contains a copy of the history entry's state object.

    - -

    The state object can be anything that can be serialized. Because Firefox saves state objects to the user's disk so they can be restored after the user restarts the browser, we impose a size limit of 640k characters on the serialized representation of a state object. If you pass a state object whose serialized representation is larger than this to pushState(), the method will throw an exception. If you need more space than this, you're encouraged to use sessionStorage and/or localStorage.

    -
  • -
  • -

    title — Firefox currently ignores this parameter, although it may use it in the future. Passing the empty string here should be safe against future changes to the method. Alternatively, you could pass a short title for the state to which you're moving.

    -
  • -
  • -

    URL — The new history entry's URL is given by this parameter. Note that the browser won't attempt to load this URL after a call to pushState(), but it might attempt to load the URL later, for instance after the user restarts the browser. The new URL does not need to be absolute; if it's relative, it's resolved relative to the current URL. The new URL must be of the same origin as the current URL; otherwise, pushState() will throw an exception. This parameter is optional; if it isn't specified, it's set to the document's current URL.

    -
  • -
- -
Note: In Gecko 2.0 {{ geckoRelease("2.0") }} through Gecko 5.0 {{ geckoRelease("5.0") }}, the passed object is serialized using JSON. Starting in Gecko 6.0 {{ geckoRelease("6.0") }}, the object is serialized using the structured clone algorithm. This allows a wider variety of objects to be safely passed.
- -

In a sense, calling pushState() is similar to setting window.location = "#foo", in that both will also create and activate another history entry associated with the current document. But pushState() has a few advantages:

- -
    -
  • The new URL can be any URL in the same origin as the current URL. In contrast, setting window.location keeps you at the same {{ domxref("document") }} only if you modify only the hash.
  • -
  • You don't have to change the URL if you don't want to. In contrast, setting window.location = "#foo"; only creates a new history entry if the current hash isn't #foo.
  • -
  • You can associate arbitrary data with your new history entry. With the hash-based approach, you need to encode all of the relevant data into a short string.
  • -
  • If title is subsequently used by browsers, this data can be utilized (independent of, say, the hash).
  • -
- -

Note that pushState() never causes a hashchange event to be fired, even if the new URL differs from the old URL only in its hash.

- -

In a XUL document, it creates the specified XUL element.

- -

In other documents, it creates an element with a null namespace URI.

- -

The replaceState() method

- -

history.replaceState() operates exactly like history.pushState() except that replaceState() modifies the current history entry instead of creating a new one. Note that this doesn't prevent the creation of a new entry in the global browser history.

- -

replaceState() is particularly useful when you want to update the state object or URL of the current history entry in response to some user action.

- -
Note: In Gecko 2.0 {{ geckoRelease("2.0") }} through Gecko 5.0 {{ geckoRelease("5.0") }}, the passed object is serialized using JSON. Starting in Gecko 6.0 {{ geckoRelease("6.0") }}, the object is serialized using the structured clone algorithm. This allows a wider variety of objects to be safely passed.
- -

Example of replaceState() method

- -

Suppose http://mozilla.org/foo.html executes the following JavaScript:

- -
var stateObj = { foo: "bar" };
-history.pushState(stateObj, "page 2", "bar.html");
-
- -

The explanation of these two lines above can be found at "Example of pushState() method" section. Then suppose http://mozilla.org/bar.html executes the following JavaScript:

- -
history.replaceState(stateObj, "page 3", "bar2.html");
-
- -

This will cause the URL bar to display http://mozilla.org/bar2.html, but won't cause the browser to load bar2.html or even check that bar2.html exists.

- -

Suppose now that the user now navigates to http://www.microsoft.com, then clicks back. At this point, the URL bar will display http://mozilla.org/bar2.html. If the user now clicks back again, the URL bar will display http://mozilla.org/foo.html, and totally bypass bar.html.

- -

The popstate event

- -

A popstate event is dispatched to the window every time the active history entry changes. If the history entry being activated was created by a call to pushState or affected by a call to replaceState, the popstate event's state property contains a copy of the history entry's state object.

- -

See {{ domxref("window.onpopstate") }} for sample usage.

- -

Reading the current state

- -

When your page loads, it might have a non-null state object.  This can happen, for example, if the page sets a state object (using pushState() or replaceState()) and then the user restarts their browser.  When your page reloads, the page will receive an onload event, but no popstate event.  However, if you read the history.state property, you'll get back the state object you would have gotten if a popstate had fired.

- -

You can read the state of the current history entry without waiting for a popstate event using the history.state property like this:

- -
var currentState = history.state;
-
- -

Examples

- -

For a complete example of AJAX web site, please see: Ajax navigation example.

- -

Specifications

- - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('HTML WHATWG', "browsers.html#history", "History")}}{{Spec2('HTML WHATWG')}}No change from {{SpecName("HTML5 W3C")}}.
{{SpecName('HTML5 W3C', "browsers.html#history", "History")}}{{Spec2('HTML5 W3C')}}Initial definition.
- -

Browser compatibility

- -

{{ CompatibilityTable() }}

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
replaceState, pushState5{{CompatVersionUnknown}}{{ CompatGeckoDesktop("2.0") }}1011.505.0
history.state18{{CompatVersionUnknown}}{{ CompatGeckoDesktop("2.0") }}1011.506.0
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidEdgeFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
replaceState, pushState{{ CompatUnknown() }}{{CompatVersionUnknown}}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}
history.state{{ CompatUnknown() }}{{CompatVersionUnknown}}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}
-
- -

See also

- -
    -
  • {{ domxref("window.history") }}
  • -
  • {{ domxref("window.onpopstate") }}
  • -
- -

 

- -

 

diff --git a/files/ar/web/api/htmlelement/contenteditable/index.html b/files/ar/web/api/htmlelement/contenteditable/index.html deleted file mode 100644 index aee7a4f1f2..0000000000 --- a/files/ar/web/api/htmlelement/contenteditable/index.html +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: HTMLElement.contentEditable -slug: Web/API/HTMLElement/contentEditable -tags: - - API - - المراجع - - خاصية contenteditable - - عناصر HTML -translation_of: Web/API/HTMLElement/contentEditable ---- -
- {{APIRef}}
-

إن خاصية HTMLElement.contentEditable تستخدم لتحديد إذا ما كان العنصر قابل للتحرير أو لا.هذه الخاصية يمكن أن تأخذ إحدى القيم التالية:

-
    -
  • true, أو عدم تعيين قيمة,تحديد أن العنصر قابل للتحرير.
  • -
  • false,تعيين أن العنصر غير قابل للتحرير.
  • -
  • inherit,تحديد أن كل العناصر التي تليه سوف ترث إمكانية التحرير من عدمها من خلال العنصر الأب.
  • -
-

الشكل العام

-
editable = element.contentEditable
-element.contentEditable = "true"
-
-

ملاحظات

-

بإمكانك إستعمال خاصية  {{domxref("HTMLElement.isContentEditable")}} لإختبارالقيمة المنطقية المحوسبة {{domxref("Boolean")}} من هذا العنصر.

-

توافق المتصفحات

-
- {{CompatibilityTable}}
-
- - - - - - - - - - - - - - - - - - - -
الميزةChromeFirefox (Gecko)Internet ExplorerOperaSafari
الدعم الأساسي11{{CompatGeckoDesktop(1.9)}}610.63.2
-
-
- - - - - - - - - - - - - - - - - - - -
الميزةAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
الدعم الأساسي3{{CompatGeckoMobile(1.9)}}6{{CompatNo}}5
-
-

المواصفات

- diff --git a/files/ar/web/api/htmlelement/index.html b/files/ar/web/api/htmlelement/index.html deleted file mode 100644 index 976b2b7017..0000000000 --- a/files/ar/web/api/htmlelement/index.html +++ /dev/null @@ -1,400 +0,0 @@ ---- -title: HTMLElement -slug: Web/API/HTMLElement -translation_of: Web/API/HTMLElement ---- -
-
{{ APIRef("HTML DOM") }}
-
- -
 
- -

The HTMLElement interface represents any HTML element. Some elements directly implement this interface, others implement it via an interface that inherits it.

- -

Properties

- -

Inherits properties from its parent, {{domxref("Element")}}, and implements those from {{domxref("GlobalEventHandlers")}} and {{domxref("TouchEventHandlers")}}.

- -
-
{{domxref("HTMLElement.accessKey")}}
-
Is a {{domxref("DOMString")}} representing the access key assigned to the element.
-
{{domxref("HTMLElement.accessKeyLabel")}} {{readonlyInline}}
-
Returns a {{domxref("DOMString")}} containing the element's assigned access key.
-
{{domxref("HTMLElement.contentEditable")}}
-
Is a {{domxref("DOMString")}}, where a value of "true" means the element is editable and a value of "false" means it isn't.
-
{{domxref("HTMLElement.isContentEditable")}} {{readonlyInline}}
-
Returns a {{domxref("Boolean")}} that indicates whether or not the content of the element can be edited.
-
{{domxref("HTMLElement.contextMenu")}}
-
Is an {{domxref("HTMLMenuElement")}} representing the contextual menu associated with the element. It may be null
-
{{domxref("HTMLElement.dataset")}} {{readonlyInline}}
-
Returns a {{domxref("DOMStringMap")}} that allows access to read and write the element custom data attributes (data-*) .
-
{{domxref("HTMLElement.dir")}}
-
Is a {{domxref("DOMString")}}, reflecting the dir global attribute, representing the directionality of the element. Possible values are "ltr", "rtl", and "auto".
-
{{domxref("HTMLElement.draggable")}}
-
Is a {{jsxref("Boolean")}} indicating if the element can be dragged.
-
{{domxref("HTMLElement.dropzone")}} {{readonlyInline}}
-
Returns a {{domxref("DOMSettableTokenList")}} reflecting the dropzone global attribute and describing the behavior of the element regarding a drop operation.
-
{{domxref("HTMLElement.hidden")}}
-
Is a {{jsxref("Boolean")}} indicating if the element is hidden or not.
-
{{domxref("HTMLElement.itemScope")}} {{experimental_inline}}
-
Is a {{jsxref("Boolean")}}…
-
{{domxref("HTMLElement.itemType")}} {{readonlyInline}}{{experimental_inline}}
-
Returns a {{domxref("DOMSettableTokenList")}}…
-
{{domxref("HTMLElement.itemId")}} {{experimental_inline}}
-
Is a {{domxref("DOMString")}}…
-
{{domxref("HTMLElement.itemRef")}} {{readonlyInline}}{{experimental_inline}}
-
Returns a {{domxref("DOMSettableTokenList")}}…
-
{{domxref("HTMLElement.itemProp")}} {{readonlyInline}}{{experimental_inline}}
-
Returns a {{domxref("DOMSettableTokenList")}}…
-
{{domxref("HTMLElement.itemValue")}} {{experimental_inline}}
-
Returns an {{jsxref("Object")}}…
-
{{domxref("HTMLElement.lang")}}
-
Is a {{domxref("DOMString")}} representing the language of an element's attributes, text, and element contents.
-
{{domxref("HTMLElement.offsetHeight")}} {{readonlyInline}}{{experimental_inline}}
-
Returns a double containing the height of an element, relative to the layout.
-
{{domxref("HTMLElement.offsetLeft")}}{{readonlyInline}}{{experimental_inline}}
-
Returns a double, the distance from this element's left border to its offsetParent's left border.
-
{{domxref("HTMLElement.offsetParent")}}{{readonlyInline}}{{experimental_inline}}
-
Returns an {{domxref("Element")}} that is the element from which all offset calculations are currently computed.
-
{{domxref("HTMLElement.offsetTop")}}{{readonlyInline}}{{experimental_inline}}
-
Returns a double, the distance from this element's top border to its offsetParent's top border.
-
{{domxref("HTMLElement.offsetWidth")}}{{readonlyInline}}{{experimental_inline}}
-
Returns a double containing the width of an element, relative to the layout.
-
{{domxref("HTMLElement.properties")}} {{readonlyInline}}{{experimental_inline}}
-
Returns an {{domxref("HTMLPropertiesCollection")}}…
-
{{domxref("HTMLElement.spellcheck")}}{{ gecko_minversion_inline("1.9")}}
-
Is a {{jsxref("Boolean")}} that controls spell-checking. It is present on all HTML elements, though it hasn't an effect on all of them.
-
{{domxref("HTMLElement.style")}}
-
Is {{domxref("CSSStyleDeclaration")}}, an object representing the declarations of an element's style attributes.
-
{{domxref("HTMLElement.tabIndex")}}
-
Is a long representing the position of the element in the tabbing order.
-
{{domxref("HTMLElement.title")}}
-
Is a {{domxref("DOMString")}} containing the text that appears in a popup box when mouse is over the element.
-
{{domxref("HTMLElement.translate")}} {{experimental_inline}}
-
Is a {{jsxref("Boolean")}}
-
- -

Event handlers

- -

Most events properties, of the form onXYZ, are defined on the {{domxref("GlobalEventHandlers")}} or {{domxref("TouchEventHandlers")}}, implemented by HTMLElement. A few more are specific to HTMLElement.

- -
-
{{ domxref("HTMLElement.oncopy") }}  {{ non-standard_inline() }}
-
Returns the event handling code for the copy event ({{bug("280959")}}).
-
{{ domxref("HTMLElement.oncut") }}  {{ non-standard_inline() }}
-
Returns the event handling code for the cut event ({{bug("280959")}}).
-
{{ domxref("HTMLElement.onpaste") }} {{ non-standard_inline() }}
-
Returns the event handling code for the paste event ({{bug("280959")}}).
-
{{domxref("TouchEventHandlers.ontouchstart")}} {{non-standard_inline}}
-
Returns the event handling code for the {{event("touchstart")}} event.
-
{{domxref("TouchEventHandlers.ontouchend")}} {{non-standard_inline}}
-
Returns the event handling code for the {{event("touchend")}} event.
-
{{domxref("TouchEventHandlers.ontouchmove")}} {{non-standard_inline}}
-
Returns the event handling code for the {{event("touchmove")}} event.
-
{{domxref("TouchEventHandlers.ontouchenter")}} {{non-standard_inline}}
-
Returns the event handling code for the {{event("touchenter")}} event.
-
{{domxref("TouchEventHandlers.ontouchleave")}} {{non-standard_inline}}
-
Returns the event handling code for the {{event("touchleave")}} event.
-
{{domxref("TouchEventHandlers.ontouchcancel")}} {{non-standard_inline}}
-
Returns the event handling code for the {{event("touchcancel")}} event.
-
- -

Methods

- -

Inherits methods from its parent, {{domxref("Element")}}.

- -
-
{{domxref("HTMLElement.blur()")}}
-
Removes keyboard focus from the currently focused element.
-
{{domxref("HTMLElement.click()")}}
-
Sends a mouse click event to the element.
-
{{domxref("HTMLElement.focus()")}}
-
Makes the element the current keyboard focus.
-
{{domxref("HTMLElement.forceSpellCheck()")}} {{experimental_inline}}
-
Makes the spell checker runs on the element.
-
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('CSSOM View', '#extensions-to-the-htmlelement-interface', 'HTMLElement')}}{{Spec2('CSSOM View')}}Added the following properties: offsetParent, offsetTop, offsetLeft, offsetWidth, and offsetHeight.
{{SpecName('HTML WHATWG', 'elements.html#htmlelement', 'HTMLElement')}}{{Spec2('HTML WHATWG')}}Added the following properties: translate, itemScope, itemType, itemId, itemRef, itemProp, properties, and itemValue.
- Added the following method: forceSpellcheck().
- Moved the onXYZ attributes to the {{domxref("GlobalEventHandlers")}} interface and added an inheritance from it.
{{SpecName('HTML5 W3C', 'dom.html#htmlelement', 'HTMLElement')}}{{Spec2('HTML5 W3C')}}Added the following properties: dataset, hidden, tabindex, accessKey, accessKeyLabel, draggable, dropzone, contentEditable, isContentEditable, contextMenu, spellcheck, commandType, commandLabel, commandIcon, commandHidden, commandDisabled, commandChecked, style, and all the onXYZ properties.
- Moved the id and className properties to the {{domxref("Element")}} interface.
{{SpecName('DOM2 HTML', 'html.html#ID-011100101', 'HTMLElement')}}{{Spec2('DOM2 HTML')}}No change from {{SpecName('DOM2 HTML')}}
{{SpecName('DOM1', 'level-one-html.html#ID-011100101', 'HTMLElement')}}{{Spec2('DOM1')}}Initial definition.
- -

Browser compatibility

- -

{{CompatibilityTable}}

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureFirefox (Gecko)ChromeInternet ExplorerOperaSafari
Basic support{{CompatGeckoDesktop("1.0")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
{{domxref("HTMLElement.accessKey", "accessKey")}}{{CompatGeckoDesktop("5.0")}}17.0{{CompatUnknown}}{{CompatUnknown}}{{CompatVersionUnknown}}(535.10)
{{domxref("HTMLElement.accessKeyLabel", "accessKeyLabel")}}{{CompatGeckoDesktop("8.0")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatNo}}{{WebkitBug(72715)}}
{{domxref("HTMLElement.blur()", "blur()")}}{{CompatGeckoDesktop("5.0")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
{{domxref("HTMLElement.click()", "click()")}}{{CompatGeckoDesktop("5.0")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatVersionUnknown}}(535.24)
{{domxref("HTMLElement.dataset", "dataset")}}{{CompatGeckoDesktop("6.0")}}9.0{{CompatUnknown}}11.105.1
{{domxref("HTMLElement.focus()", "focus()")}}{{CompatGeckoDesktop("5.0")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
{{domxref("HTMLElement.contentEditable", "contentEditable")}}{{CompatGeckoDesktop("1.9")}}{{CompatVersionUnknown}}5.59{{CompatVersionUnknown}}
{{domxref("HTMLElement.spellcheck", "spellcheck")}}{{CompatGeckoDesktop("1.8.1")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
{{domxref("HTMLElement.style", "style")}}{{CompatVersionUnknown}} (returns a {{domxref("CSS2Properties")}}, rather than a {{domxref("CSSStyleDeclaration")}}){{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
{{domxref("HTMLElement.forceSpellCheck", "forceSpellCheck()")}} {{experimental_inline}}{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
{{domxref("HTMLElement.dataset", "dataset")}}{{CompatGeckoDesktop("6.0")}}8.01111.106
{{domxref("HTMLElement.draggable", "draggable")}}{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatUnknown}}12.0{{CompatUnknown}}
{{domxref("HTMLElement.dropzone", "dropzone")}}{{CompatNo}}{{CompatNo}}{{CompatNo}}12.0{{CompatNo}}
{{domxref("HTMLElement.offsetLeft", "offsetLeft")}}, {{domxref("HTMLElement.offsetTop", "offsetTop")}}, {{domxref("HTMLElement.offsetParent", "offsetParent")}}, {{domxref("HTMLElement.offsetHeight", "offsetHeight")}} and {{domxref("HTMLElement.offsetWidth", "offsetWidth")}} {{experimental_inline}}{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatUnknown}}
{{domxref("HTMLElement.translate", "translate")}} {{experimental_inline}}{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
{{domxref("HTMLElement.itemScope", "itemScope")}}, {{domxref("HTMLElement.itemType", "itemType")}}, {{domxref("HTMLElement.itemRef", "itemRef")}}, {{domxref("HTMLElement.itemId", "itemId")}}, {{domxref("HTMLElement.itemProp", "itemProp")}}, and {{domxref("HTMLElement.itemValue", "itemValue")}} {{experimental_inline}}{{CompatGeckoDesktop("6.0")}}{{CompatNo}}{{CompatNo}}11.60
- (Removed in Opera 15)
{{CompatNo}}
{{domxref("HTMLElement.properties", "properties")}} {{experimental_inline}}{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
{{domxref("HTMLElement.ontouchstart")}}, {{domxref("HTMLElement.ontouchend")}}, {{domxref("HTMLElement.ontouchmove")}}, {{domxref("HTMLElement.ontouchenter")}}, {{domxref("HTMLElement.ontouchleave")}}, and {{domxref("HTMLElement.ontouchcancel")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatNo}}{{CompatUnknown}}{{CompatVersionUnknown}}
{{domxref("HTMLElement.oncopy")}}, {{domxref("HTMLElement.oncut")}}, and {{domxref("HTMLElement.onpaste")}} {{Non-standard_inline}}{{CompatGeckoDesktop("1.9")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureFirefox Mobile (Gecko)AndroidIE MobileOpera MobileSafari Mobile
Basic support -

{{CompatGeckoMobile("1.0")}}

-
{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
{{domxref("HTMLElement.accessKey", "accessKey")}}{{CompatGeckoMobile("5.0")}}
{{domxref("HTMLElement.accessKeyLabel", "accessKeyLabel")}}{{CompatGeckoMobile("8.0")}}
{{domxref("HTMLElement.blur()", "blur()")}}{{CompatGeckoMobile("5.0")}}
{{domxref("HTMLElement.click()", "click()")}}{{CompatGeckoMobile("5.0")}}
{{domxref("HTMLElement.dataset", "dataset")}}{{CompatGeckoMobile("6.0")}}
{{domxref("HTMLElement.focus()", "focus()")}}{{CompatGeckoMobile("5.0")}}
{{domxref("HTMLElement.oncopy")}}, {{domxref("HTMLElement.oncut")}}, and {{domxref("HTMLElement.onpaste")}} {{Non-standard_inline}}{{CompatGeckoMobile("1.9")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
-
- -

See also

- -
    -
  • {{domxref("Element")}}
  • -
diff --git a/files/ar/web/api/index.html b/files/ar/web/api/index.html deleted file mode 100644 index 62573a0945..0000000000 --- a/files/ar/web/api/index.html +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: واجهات الويب البرمجيّة -slug: Web/API -tags: - - DOM - - جافاسكربت - - مرجع - - واجهات برمجية -translation_of: Web/API ---- -

عندما تكتب نصوصاً برمجيّة للويب مُستخدِماً لغة الجافاسكرِبت، ستجد العديد من الواجهات البرمجيّة (API) المتوفرة. القائمة أدناه تسرد كل الواجهات (أي أنواع الكائنات) التي يمكنك استخدامها أثناء تطوير تطبيقات أو موقع الويب.

- -
-
{{APIListAlpha}}
-
diff --git a/files/ar/web/api/navigator/battery/index.html b/files/ar/web/api/navigator/battery/index.html deleted file mode 100644 index 0596c21aed..0000000000 --- a/files/ar/web/api/navigator/battery/index.html +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: Navigator.battery -slug: Web/API/Navigator/battery -tags: - - API - - batter - - navigator.battery - - المراجع - - كائن البطارية -translation_of: Web/API/Navigator/battery -original_slug: Web/API/Navigator.battery ---- -

{{ ApiRef() }}

-

الملخص

-

يقوم كائن battery بتقديم معلومات حول مستوى شحن بطارية النظام.

-

بإمكانك أيضاً التنصت على الأحداث التي يرسلها النظام حول تحديثات حالة البطارية.هذه الأداة تندرج تحت تطبيق الواجهة البرمجية لحالة البطارية,اقرأ ذلك المستند لتفاصيل إضافية,مع دليل لكيفية أستعمالها,و نموذج برمجي.

-

الشكل العام

-
var battery = window.navigator.battery;
-

القيمة

-

navigator.battery هو كائن {{domxref("لإدارة البطارية.")}}.

-

المواصفات

-

{{page("/en-US/docs/Web/API/BatteryManager","Specifications")}}

-

توافق المتصفحات

-

{{page("/en-US/docs/Web/API/BatteryManager","Browser_compatibility")}}

-

اقرأ أيضاً

- diff --git a/files/ar/web/api/navigator/index.html b/files/ar/web/api/navigator/index.html deleted file mode 100644 index a2c4e0c815..0000000000 --- a/files/ar/web/api/navigator/index.html +++ /dev/null @@ -1,155 +0,0 @@ ---- -title: Navigator -slug: Web/API/Navigator -tags: - - API - - DOM4 - - Interface - - Navigator - - NeedsBrowserCompatibility - - NeedsSpecTable - - NeedsTranslation - - Reference - - TopicStub - - Web - - Web Performance -translation_of: Web/API/Navigator ---- -

{{ APIRef("DOM4") }}

- -

The Navigator interface represents the state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities.

- -

A Navigator object can be retrieved using the read-only {{domxref("window.navigator")}} property.

- -

Properties

- -

Doesn't inherit any properties, but implements those defined in {{domxref("NavigatorID")}}, {{domxref("NavigatorLanguage")}}, {{domxref("NavigatorOnLine")}}, {{domxref("NavigatorContentUtils")}}, {{domxref("NavigatorStorage")}}, {{domxref("NavigatorStorageUtils")}}, {{domxref("NavigatorCookies")}}, {{domxref("NavigatorConcurrentHardware")}}, {{domxref("NavigatorPlugins")}}, and {{domxref("NavigatorUserMedia")}}.

- -

Standard

- -
-
{{domxref("Navigator.activeVRDisplays")}} {{readonlyInline}}{{experimental_inline}}
-
Returns an array containing every {{domxref("VRDisplay")}} object that is currently presenting ({{domxref("VRDisplay.ispresenting")}} is true).
-
{{domxref("NavigatorID.appCodeName")}} {{readonlyInline}}{{experimental_inline}}
-
Returns the internal "code" name of the current browser. Do not rely on this property to return the correct value.
-
{{domxref("NavigatorID.appName")}} {{readonlyInline}}{{experimental_inline}}
-
Returns a {{domxref("DOMString")}} with the official name of the browser. Do not rely on this property to return the correct value.
-
{{domxref("NavigatorID.appVersion")}} {{readonlyInline}}{{experimental_inline}}
-
Returns the version of the browser as a {{domxref("DOMString")}}. Do not rely on this property to return the correct value.
-
{{domxref("Navigator.battery")}} {{readonlyInline}}
-
Returns a {{domxref("BatteryManager")}} object you can use to get information about the battery charging status.
-
{{domxref("Navigator.connection")}} {{readonlyInline}}{{experimental_inline}}
-
Provides a {{domxref("NetworkInformation")}} object containing information about the network connection of a device.
-
{{domxref("Navigator.geolocation")}} {{readonlyInline}}
-
Returns a {{domxref("Geolocation")}} object allowing accessing the location of the device.
-
{{domxref("NavigatorConcurrentHardware.hardwareConcurrency")}} {{readOnlyInline}}
-
Returns the number of logical processor cores available.
-
{{domxref("NavigatorPlugins.javaEnabled")}} {{readonlyInline}}{{experimental_inline}}
-
Returns a {{domxref("Boolean")}} flag indicating whether the host browser is Java-enabled or not.
-
{{domxref("NavigatorLanguage.language")}} {{readonlyInline}}
-
Returns a {{domxref("DOMString")}} representing the preferred language of the user, usually the language of the browser UI. The null value is returned when this is unknown.
-
{{domxref("NavigatorLanguage.languages")}} {{readonlyInline}}
-
Returns an array of {{domxref("DOMString")}} representing the languages known to the user, by order of preference.
-
{{domxref("NavigatorPlugins.mimeTypes")}} {{readonlyInline}}{{experimental_inline}}
-
Returns an {{domxref("MimeTypeArray")}} listing the MIME types supported by the browser.
-
{{domxref("NavigatorOnLine.onLine")}} {{readonlyInline}}
-
Returns a {{domxref("Boolean")}} indicating whether the browser is working online.
-
{{domxref("Navigator.oscpu")}}
-
Returns a string that represents the current operating system.
-
{{domxref("Navigator.permissions")}} {{readonlyinline}}{{experimental_inline}}
-
Returns a {{domxref("Permissions")}} object that can be used to query and update permission status of APIs covered by the Permissions API.
-
{{domxref("NavigatorID.platform")}} {{readonlyInline}}{{experimental_inline}}
-
Returns a string representing the platform of the browser. Do not rely on this function to return a significant value.
-
{{domxref("NavigatorPlugins.plugins")}} {{readonlyInline}}{{experimental_inline}}
-
Returns a {{domxref("PluginArray")}} listing the plugins installed in the browser.
-
{{domxref("NavigatorID.product")}} {{readonlyInline}} {{experimental_inline}}
-
Always returns 'Gecko', on any browser. This property is kept only for compatibility purpose.
-
{{domxref("Navigator.serviceWorker")}} {{readonlyInline}}
-
Returns a {{domxref("ServiceWorkerContainer")}} object, which provides access to registration, removal, upgrade, and communication with the {{domxref("ServiceWorker")}} objects for the associated document.
-
{{domxref("Navigator.storage")}} {{readonlyinline}}
-
Returns the singleton {{domxref('StorageManager')}} object used for managing persistance permissions and estimating available storage on a site-by-site/app-by-app basis.
-
{{domxref("NavigatorID.userAgent")}} {{readonlyInline}}
-
Returns the user agent string for the current browser.
-
- -

Non-standard

- -
-

Firefox OS devices adds more non-standard properties. You can consult them on the Firefox OS Navigator extensions article.

-
- -

{{domxref("Navigator.buildID")}} {{non-standard_inline}}

- -
-
Returns the build identifier of the browser (e.g., "2006090803").
-
{{domxref("Navigator.cookieEnabled")}} {{non-standard_inline}}
-
Returns a boolean indicating whether cookies are enabled in the browser or not.
-
{{domxref("Navigator.credentials")}} {{non-standard_inline}}
-
Returns the {{domxref("CredentialsContainer")}} interface which exposes methods to request credentials and notify the user agent when interesting events occur such as successful sign in or sign out. 
-
{{domxref("Navigator.doNotTrack")}} {{non-standard_inline}}
-
Reports the value of the user's do-not-track preference. When this value is "yes", your web site or application should not track the user.
-
{{domxref("Navigator.id")}} {{non-standard_inline}}
-
Returns the {{domxref("window.navigator.id", "id")}} object which you can use to add support for BrowserID to your web site.
-
{{domxref("Navigator.mediaDevices")}} {{non-standard_inline}}
-
Returns a reference to a {{domxref("MediaDevices")}} object which can then be used to get information about available media devices ({{domxref("MediaDevices.enumerateDevices()")}}), find out what constrainable properties are supported for media on the user's computer and user agent ({{domxref("MediaDevices.getSupportedConstraints()")}}), and to request access to media using {{domxref("MediaDevices.getUserMedia()")}}.
-
{{domxref("Navigator.mozNotification")}} {{deprecated_inline("22")}} {{non-standard_inline}}
- {{domxref("Navigator.webkitNotification")}}
-
Returns a {{domxref("navigator.mozNotification", "notification")}} object you can use to deliver notifications to the user from your web application.
-
{{domxref("Navigator.mozSocial")}} {{non-standard_inline}}
-
The Object, returned by the navigator.mozSocial property, is available within the social media provider's panel to provide functionality it may need.
-
{{domxref("Navigator.presentation")}} {{non-standard_inline}}
-
Returns a reference to the {{domxref("Presentation")}} API.
-
{{domxref("Navigator.productSub")}} {{non-standard_inline}}
-
Returns the build number of the current browser (e.g., "20060909").
-
{{domxref("Navigator.securitypolicy")}} {{non-standard_inline}}
-
Returns an empty string. In Netscape 4.7x, returns "US & CA domestic policy" or "Export policy".
-
{{domxref("Navigator.standalone")}} {{non-standard_inline}}
-
Returns a boolean indicating whether the browser is running in standalone mode. Available on Apple's iOS Safari only.
-
{{domxref("Navigator.storageQuota")}} {{readonlyinline}} {{experimental_inline}}
-
Returns a {{domxref('StorageQuota')}} interface which provides means to query and request storage usage and quota information.
-
{{domxref("Navigator.vendor")}} {{non-standard_inline}}
-
Returns the vendor name of the current browser (e.g., "Netscape6").
-
{{domxref("Navigator.vendorSub")}} {{non-standard_inline}}
-
Returns the vendor version number (e.g. "6.1").
-
{{domxref("Navigator.webkitPointer")}} {{non-standard_inline}}
-
Returns a PointerLock object for the Mouse Lock API.
-
- -

Methods

- -

Doesn't inherit any method, but implements those defined in {{domxref("NavigatorID")}}, {{domxref("NavigatorContentUtils")}}, {{domxref("NavigatorUserMedia")}}, and {{domxref("NavigatorStorageUtils")}}.

- -

Standard

- -
-
{{domxref("Navigator.getVRDisplays()")}} {{experimental_inline}}
-
Returns a promise that resolves to an array of {{domxref("VRDisplay")}} objects representing any available VR devices connected to the computer.
-
{{domxref("Navigator.getUserMedia", "Navigator.getUserMedia()")}} {{experimental_inline}}
-
After having prompted the user for permission, returns the audio or video stream associated to a camera or microphone on the local computer.
-
{{domxref("Navigator.registerContentHandler()")}}
-
Allows web sites to register themselves as a possible handler for a given MIME type.
-
{{domxref("Navigator.registerProtocolHandler()")}}
-
Allows web sites to register themselves as a possible handler for a given protocol.
-
{{domxref("Navigator.requestMediaKeySystemAccess()")}} {{experimental_inline}}
-
Returns a {{jsxref("Promise")}} for a MediaKeySystemAccess object.
-
{{domxref("Navigator.sendBeacon()")}}{{experimental_inline}}
-
Used to asynchronously transfer a small amount of data using {{Glossary("HTTP")}} from the User Agent to a web server.
-
{{domxref("NavigatorID.taintEnabled()")}} {{deprecated_inline("1.7.8")}} {{obsolete_inline("9.0")}} {{experimental_inline}}
-
Returns false. JavaScript taint/untaint functions removed in JavaScript 1.2.
-
{{domxref("Navigator.vibrate()")}} {{gecko_minversion_inline("11.0")}}
-
Causes vibration on devices with support for it. Does nothing if vibration support isn't available.
-
- -

Non-standard

- -
-

Firefox OS devices adds more non-standard methods. You can consult them on the Firefox OS Navigator extensions article.

-
- -

{{domxref("Navigator.mozIsLocallyAvailable()")}} {{non-standard_inline}}

- -
-
Lets code check to see if the document at a given URI is available without using the network.
-
{{domxref("Navigator.mozPay()")}} {{non-standard_inline}}
-
Allows in-app payment.
-
diff --git a/files/ar/web/api/node/index.html b/files/ar/web/api/node/index.html deleted file mode 100644 index ddebb32cb9..0000000000 --- a/files/ar/web/api/node/index.html +++ /dev/null @@ -1,381 +0,0 @@ ---- -title: Node -slug: Web/API/Node -tags: - - API - - DOM - - Interface - - NeedsTranslation - - Node - - Reference - - TopicStub -translation_of: Web/API/Node ---- -

{{APIRef("DOM")}}

- -

The {{Glossary("DOM")}} Node interface is a key base class upon which many other DOM API objects are based, thus letting those object types to be used similarly and often interchangeably. Key among the interfaces which inherit the features of Node are {{domxref("Document")}} and {{domxref("Element")}}. However, all of the following also inherit methods and properties from Node: {{DOMxRef("Attr")}}, {{DOMxRef("CharacterData")}} (which {{DOMxRef("Text")}}, {{DOMxRef("Comment")}}, and {{DOMxRef("CDATASection")}} are all based on), {{DOMxRef("ProcessingInstruction")}}, {{DOMxRef("DocumentFragment")}}, {{DOMxRef("DocumentType")}}, {{DOMxRef("Notation")}}, {{DOMxRef("Entity")}}, and {{DOMxRef("EntityReference")}}.

- -

In some cases, a particular feature of Node may not apply to a particular interface based on it; in that case, the inheriting node may return null or throw an exception, depending on circumstances. For example, attempting to add children to a node type that cannot have children will throw an exception.

- -

{{InheritanceDiagram}}

- -

Properties

- -

Inherits properties from its parent, {{DOMxRef("EventTarget")}}.[1]

- -
-
{{DOMxRef("Node.baseURI")}}{{ReadOnlyInline}}
-
Returns a {{DOMxRef("DOMString")}} representing the base URL of the document containing the Node.
-
{{DOMxRef("Node.baseURIObject")}} {{Non-standard_inline}} {{ReadOnlyInline}}
-
(Not available to web content.) The {{ Interface("nsIURI") }} object representing the base URI for the element.
-
{{DOMxRef("Node.childNodes")}}{{ReadOnlyInline}}
-
Returns a live {{DOMxRef("NodeList")}} containing all the children of this node. {{DOMxRef("NodeList")}} being live means that if the children of the Node change, the {{DOMxRef("NodeList")}} object is automatically updated.
-
{{DOMxRef("Node.firstChild")}}{{ReadOnlyInline}}
-
Returns a {{DOMxRef("Node")}} representing the first direct child node of the node, or null if the node has no child.
-
{{DOMxRef("Node.isConnected")}}{{ReadOnlyInline}}
-
A boolean indicating whether or not the Node is connected (directly or indirectly) to the context object, e.g. the {{DOMxRef("Document")}} object in the case of the normal DOM, or the {{DOMxRef("ShadowRoot")}} in the case of a shadow DOM.
-
{{DOMxRef("Node.lastChild")}}{{ReadOnlyInline}}
-
Returns a {{DOMxRef("Node")}} representing the last direct child node of the node, or null if the node has no child.
-
{{DOMxRef("Node.nextSibling")}}{{ReadOnlyInline}}
-
Returns a {{DOMxRef("Node")}} representing the next node in the tree, or null if there isn't such node.
-
{{DOMxRef("Node.nodeName")}}{{ReadOnlyInline}}
-
Returns a {{DOMxRef("DOMString")}} containing the name of the Node. The structure of the name will differ with the node type. E.g. An {{DOMxRef("HTMLElement")}} will contain the name of the corresponding tag, like 'audio' for an {{DOMxRef("HTMLAudioElement")}}, a {{DOMxRef("Text")}} node will have the '#text' string, or a {{DOMxRef("Document")}} node will have the '#document' string.
-
{{DOMxRef("Node.nodeType")}}{{ReadOnlyInline}}
-
Returns an unsigned short representing the type of the node. Possible values are: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameValue
ELEMENT_NODE1
ATTRIBUTE_NODE {{Deprecated_Inline}}2
TEXT_NODE3
CDATA_SECTION_NODE4
ENTITY_REFERENCE_NODE {{Deprecated_Inline}}5
ENTITY_NODE {{Deprecated_Inline}}6
PROCESSING_INSTRUCTION_NODE7
COMMENT_NODE8
DOCUMENT_NODE9
DOCUMENT_TYPE_NODE10
DOCUMENT_FRAGMENT_NODE11
NOTATION_NODE {{Deprecated_Inline}}12
-
-
{{DOMxRef("Node.nodeValue")}}
-
Returns / Sets the value of the current node.
-
{{DOMxRef("Node.ownerDocument")}}{{ReadOnlyInline}}
-
Returns the {{DOMxRef("Document")}} that this node belongs to. If the node is itself a document, returns null.
-
{{DOMxRef("Node.parentNode")}}{{ReadOnlyInline}}
-
Returns a {{DOMxRef("Node")}} that is the parent of this node. If there is no such node, like if this node is the top of the tree or if doesn't participate in a tree, this property returns null.
-
{{DOMxRef("Node.parentElement")}}{{ReadOnlyInline}}
-
Returns an {{DOMxRef("Element")}} that is the parent of this node. If the node has no parent, or if that parent is not an {{DOMxRef("Element")}}, this property returns null.
-
{{DOMxRef("Node.previousSibling")}}{{ReadOnlyInline}}
-
Returns a {{DOMxRef("Node")}} representing the previous node in the tree, or null if there isn't such node.
-
{{DOMxRef("Node.textContent")}}
-
Returns / Sets the textual content of an element and all its descendants.
-
- -

Obsolete properties

- -
-
{{DOMxRef("Node.localName")}} {{Obsolete_Inline}}{{ReadOnlyInline}}
-
Returns a {{DOMxRef("DOMString")}} representing the local part of the qualified name of an element. -
-

Note: In Firefox 3.5 and earlier, the property upper-cases the local name for HTML elements (but not XHTML elements). In later versions, this does not happen, so the property is in lower case for both HTML and XHTML.

-
-
-
{{DOMxRef("Node.namespaceURI")}} {{Obsolete_Inline}}{{ReadOnlyInline}}
-
The namespace URI of this node, or null if it is no namespace. -
-

Note: In Firefox 3.5 and earlier, HTML elements are in no namespace. In later versions, HTML elements are in the http://www.w3.org/1999/xhtml/ namespace in both HTML and XML trees.

-
-
-
{{DOMxRef("Node.nodePrincipal")}} {{Non-standard_inline}}{{Obsolete_Inline("gecko46")}}
-
A {{Interface("nsIPrincipal")}} representing the node principal.
-
{{DOMxRef("Node.prefix")}} {{Obsolete_Inline}}{{ReadOnlyInline}}
-
Is a {{DOMxRef("DOMString")}} representing the namespace prefix of the node, or null if no prefix is specified.
-
{{DOMxRef("Node.rootNode")}} {{Obsolete_Inline}}{{ReadOnlyInline}}
-
Returns a {{DOMxRef("Node")}} object representing the topmost node in the tree, or the current node if it's the topmost node in the tree. This has been replaced by {{DOMxRef("Node.getRootNode()")}}.
-
- -

Methods

- -

Inherits methods from its parent, {{DOMxRef("EventTarget")}}.[1]

- -
-
{{DOMxRef("Node.appendChild()", "Node.appendChild(childNode)")}}
-
Adds the specified childNode argument as the last child to the current node.
- If the argument referenced an existing node on the DOM tree, the node will be detached from its current position and attached at the new position.
-
{{DOMxRef("Node.cloneNode()")}}
-
Clone a {{DOMxRef("Node")}}, and optionally, all of its contents. By default, it clones the content of the node.
-
{{DOMxRef("Node.compareDocumentPosition()")}}
-
Compares the position of the current node against another node in any other document.
-
{{DOMxRef("Node.contains()")}}
-
Returns a {{jsxref("Boolean")}} value indicating whether or not a node is a descendant of the calling node.
-
{{domxref("Node.getBoxQuads()")}} {{experimental_inline}}
-
Returns a list of the node's CSS boxes relative to another node.
-
{{DOMxRef("Node.getRootNode()")}}
-
Returns the context object's root which optionally includes the shadow root if it is available. 
-
{{DOMxRef("Node.hasChildNodes()")}}
-
Returns a {{jsxref("Boolean")}} indicating whether or not the element has any child nodes.
-
{{DOMxRef("Node.insertBefore()")}}
-
Inserts a {{DOMxRef("Node")}} before the reference node as a child of a specified parent node.
-
{{DOMxRef("Node.isDefaultNamespace()")}}
-
Accepts a namespace URI as an argument and returns a {{jsxref("Boolean")}} with a value of true if the namespace is the default namespace on the given node or false if not.
-
{{DOMxRef("Node.isEqualNode()")}}
-
Returns a {{jsxref("Boolean")}} which indicates whether or not two nodes are of the same type and all their defining data points match.
-
{{DOMxRef("Node.isSameNode()")}}
-
Returns a {{jsxref("Boolean")}} value indicating whether or not the two nodes are the same (that is, they reference the same object).
-
{{DOMxRef("Node.lookupPrefix()")}}
-
Returns a {{DOMxRef("DOMString")}} containing the prefix for a given namespace URI, if present, and null if not. When multiple prefixes are possible, the result is implementation-dependent.
-
{{DOMxRef("Node.lookupNamespaceURI()")}}
-
Accepts a prefix and returns the namespace URI associated with it on the given node if found (and null if not). Supplying null for the prefix will return the default namespace.
-
{{DOMxRef("Node.normalize()")}}
-
Clean up all the text nodes under this element (merge adjacent, remove empty).
-
{{DOMxRef("Node.removeChild()")}}
-
Removes a child node from the current element, which must be a child of the current node.
-
{{DOMxRef("Node.replaceChild()")}}
-
Replaces one child {{DOMxRef("Node")}} of the current one with the second one given in parameter.
-
- -

Obsolete methods

- -
-
{{DOMxRef("Node.getFeature()")}} {{Obsolete_Inline}}
-
-
{{DOMxRef("Node.getUserData()")}} {{Obsolete_Inline}}
-
Allows a user to get some {{DOMxRef("DOMUserData")}} from the node.
-
{{DOMxRef("Node.hasAttributes()")}} {{Obsolete_Inline}}
-
Returns a {{jsxref("Boolean")}} indicating if the element has any attributes, or not.
-
{{DOMxRef("Node.isSupported()")}} {{Obsolete_Inline}}
-
Returns a {{jsxref("Boolean")}} flag containing the result of a test whether the DOM implementation implements a specific feature and this feature is supported by the specific node.
-
{{DOMxRef("Node.setUserData()")}} {{Obsolete_Inline}}
-
Allows a user to attach, or remove, {{DOMxRef("DOMUserData")}} to the node.
-
- -

Examples

- -

Remove all children nested within a node

- -
function removeAllChildren(element) {
-  while (element.firstChild) {
-    element.removeChild(element.firstChild)
-  }
-}
- -

Sample usage

- -
/* ... an alternative to document.body.innerHTML = "" ... */
-removeAllChildren(document.body)
- -

Recurse through child nodes

- -

The following function recursively calls a callback function for each node contained by a root node (including the root itself):

- -
function eachNode(rootNode, callback) {
-	if (!callback) {
-		const nodes = []
-		eachNode(rootNode, function(node) {
-			nodes.push(node)
-		})
-		return nodes
-	}
-
-	if (false === callback(rootNode)) {
-		return false
-    }
-
-	if (rootNode.hasChildNodes()) {
-		const nodes = rootNode.childNodes
-		for (let i = 0, l = nodes.length; i < l; ++i) {
-			if (false === eachNode(nodes[i], callback)) {
-				return
-            }
-        }
-	}
-}
-
- -

Syntax

- -
eachNode(rootNode, callback)
- -

Description

- -

Recursively calls a function for each descendant node of rootNode (including the root itself).

- -

If callback is omitted, the function returns an {{jsxref("Array")}} instead, which contains rootNode and all nodes contained within.

- -

If callback is provided, and it returns {{jsxref("Boolean")}} false when called, the current recursion level is aborted, and the function resumes execution at the last parent's level. This can be used to abort loops once a node has been found (such as searching for a text node which contains a certain string).

- -

Parameters

- -
-
rootNode
-
The Node object whose descendants will be recursed through.
-
callback {{optional_inline}}
-
An optional callback function that receives a Node as its only argument. If omitted, eachNode returns an {{jsxref("Array")}} of every node contained within rootNode (including the root itself).
-
- -

Sample usage

- -

The following example prints the textContent properties of each <span> tag in a <div> element named "box":

- -
<div id="box">
-  <span>Foo</span>
-  <span>Bar</span>
-  <span>Baz</span>
-</div>
- -
const box = document.getElementById("box")
-eachNode(box, function(node) {
-  if (null != node.textContent) {
-    console.log(node.textContent)
-  }
-})
- -

The above will result in the following strings printing to the user's console:

- -
"\n\t", "Foo", "\n\t", "Bar", "\n\t", "Baz"
- -
-

Note: Whitespace forms part of a {{DOMxRef("Text")}} node, meaning indentation and newlines form separate Text between the Element nodes.

-
- -

Realistic usage

- -

The following demonstrates a real-world use of the eachNode() function: searching for text on a web-page.

- -

We use a wrapper function named grep to do the searching:

- -
function grep(parentNode, pattern) {
-	const matches = []
-	let endScan = false
-
-	eachNode(parentNode, function(node){
-		if (endScan) {
-			return false
-        }
-
-		// Ignore anything which isn't a text node
-		if (node.nodeType !== Node.TEXT_NODE) {
-			return
-        }
-
-		if (typeof pattern === "string") {
-			if (-1 !== node.textContent.indexOf(pattern)) {
-				matches.push(node)
-            }
-		}
-		else if (pattern.test(node.textContent)) {
-			if (!pattern.global) {
-				endScan = true
-				matches = node
-			}
-			else {
-                matches.push(node)
-            }
-		}
-	})
-
-	return matches
-}
- -

For example, to find {{DOMxRef("Text")}} nodes that contain typos:

- -
const typos = ["teh", "adn", "btu", "adress", "youre", "msitakes"]
-const pattern = new RegExp("\\b(" + typos.join("|") + ")\\b", "gi")
-const mistakes = grep(document.body, pattern)
-console.log(mistakes)
-
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName("DOM WHATWG", "#interface-node", "Node")}}{{Spec2("DOM WHATWG")}}Added the following methods: getRootNode()
{{SpecName("DOM4", "#interface-node", "Node")}}{{Spec2("DOM4")}}Removed the following properties: attributes, namespaceURI, prefix, and localName.
- Removed the following methods: isSupported(), hasAttributes(), getFeature(), setUserData(), and getUserData().
{{SpecName("DOM3 Core", "core.html#ID-1950641247", "Node")}}{{Spec2("DOM3 Core")}}The methods insertBefore(), replaceChild(), removeChild(), and appendChild() returns one more kind of error (NOT_SUPPORTED_ERR) if called on a {{DOMxRef("Document")}}.
- The normalize() method has been modified so that {{DOMxRef("Text")}} node can also be normalized if the proper {{DOMxRef("DOMConfiguration")}} flag is set.
- Added the following methods: compareDocumentPosition(), isSameNode(), lookupPrefix(), isDefaultNamespace(), lookupNamespaceURI(), isEqualNode(), getFeature(), setUserData(), and getUserData().
- Added the following properties: baseURI and textContent.
{{SpecName("DOM2 Core", "core.html#ID-1950641247", "Node")}}{{Spec2("DOM2 Core")}}The ownerDocument property was slightly modified so that {{DOMxRef("DocumentFragment")}} also returns null.
- Added the following properties: namespaceURI, prefix, and localName.
- Added the following methods: normalize(), isSupported() and hasAttributes().
{{SpecName("DOM1", "level-one-core.html#ID-1950641247", "Node")}}{{Spec2("DOM1")}}Initial definition.
- -

Browser compatibility

- - - -

{{Compat("api.Node")}}

diff --git a/files/ar/web/api/node/removechild/index.html b/files/ar/web/api/node/removechild/index.html deleted file mode 100644 index aea43247bd..0000000000 --- a/files/ar/web/api/node/removechild/index.html +++ /dev/null @@ -1,144 +0,0 @@ ---- -title: Node.removeChild() -slug: Web/API/Node/removeChild -translation_of: Web/API/Node/removeChild ---- -
{{APIRef("DOM")}}
- -

و Node.removeChild()الأسلوب يزيل عقدة الطفل من DOM وإرجاع العقدة التي تمت إزالتها.

- -

بناء الجملة

- -
var oldChild = العقدة .removeChild ( child ) ؛
-أو 
-عقدة. إزالة الطفل ( طفل ) ؛
-
- -
    -
  • child هي العقدة الفرعية المراد إزالتها من DOM.
  • -
  • nodeهي العقدة الأم لـ child.
  • -
  • oldChildيحمل إشارة إلى العقدة الفرعية التي تمت إزالتها ، أي oldChild === child.
  • -
- -

لا تزال العقدة الفرعية التي تمت إزالتها موجودة في الذاكرة ، ولكنها لم تعد جزءًا من DOM. مع عرض أول صيغة ، يمكنك إعادة استخدام العقدة التي تمت إزالتها لاحقًا في التعليمات البرمجية ، عبر oldChildمرجع الكائن.

- -

ومع ذلك ، في النموذج الثاني للبناء ، لا يوجد oldChildمرجع محفوظ ، لذلك بافتراض أن الشفرة الخاصة بك لم تحتفظ بأي مرجع آخر للعقدة في مكان آخر ، فستصبح غير قابلة للاستخدام ولا رجعة فيها على الفور ، وعادة ما يتم حذفها تلقائيًا من الذاكرة بعد وقت قصير.

- -

إذا childلم يكن في الواقع تابع elementللعقدة ، فإن الطريقة تستثني. سيحدث هذا أيضًا إذا childكان في الواقع طفلًا elementفي وقت المكالمة ، ولكن تمت إزالته بواسطة معالج حدث تم استدعاؤه أثناء محاولة إزالة العنصر (على سبيل المثال ، {{Event("blur")}}.)

- -

ألقيت أخطاء

- -

تقدم الطريقة استثناءً بطريقتين مختلفتين:

- -
    -
  1. -

    If the child was in fact a child of element and so existing on the DOM, but was removed the method throws the following exception:

    - -

    Uncaught NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

    -
  2. -
  3. -

    If the child doesn't exist on the DOM of the page, the method throws the following exception:
    -
    - Uncaught TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'.

    -
  4. -
- -

Examples

- -

Simple examples

- -

Given this HTML:

- -
<div id="top">
-  <div id="nested"></div>
-</div>
-
- -

To remove a specified element when knowing its parent node:

- -
let d = document.getElementById("top");
-let d_nested = document.getElementById("nested");
-let throwawayNode = d.removeChild(d_nested);
-
- -

To remove a specified element without having to specify its parent node:

- -
let node = document.getElementById("nested");
-if (node.parentNode) {
-  node.parentNode.removeChild(node);
-}
-
- -

To remove all children from an element:

- -
let element = document.getElementById("top");
-while (element.firstChild) {
-  element.removeChild(element.firstChild);
-}
-
- -

Causing a TypeError

- -
<!--Sample HTML code-->
-<div id="top"> </div>
-
-<script type="text/javascript">
-  let top = document.getElementById("top");
-  let nested = document.getElementById("nested");
-
-  // Throws Uncaught TypeError
-  let garbage = top.removeChild(nested);
-</script>
-
- -

Causing a NotFoundError

- -
<!--Sample HTML code-->
-<div id="top">
-  <div id="nested"></div>
-</div>
-
-<script type="text/javascript">
-  let top = document.getElementById("top");
-  let nested = document.getElementById("nested");
-
-  // This first call correctly removes the node
-  let garbage = top.removeChild(nested);
-
-  // Throws Uncaught NotFoundError
-  garbage = top.removeChild(nested);
-</script>
-
- -

Specifications

- - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName("DOM WHATWG", "#dom-node-removechild", "Node: removeChild")}}{{Spec2("DOM WHATWG")}}
- -

التوافق المتصفح

- - - -

{{Compat("api.Node.removeChild")}}

- -

أنظر أيضا

- -
    -
  • {{domxref("Node.replaceChild")}}
  • -
  • {{domxref("Node.parentNode")}}
  • -
  • {{domxref("ChildNode.remove")}}
  • -
diff --git a/files/ar/web/api/window/alert/index.html b/files/ar/web/api/window/alert/index.html deleted file mode 100644 index 11041a50a9..0000000000 --- a/files/ar/web/api/window/alert/index.html +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: Window.alert() -slug: Web/API/Window/alert -tags: - - تنبية - - تنبيه - - دالة تنبيه - - مستند HTML - - مصادر - - نافذة -translation_of: Web/API/Window/alert ---- -

{{ APIRef }}

- -

دالة التنبية ()Window.alert هي وظيفة تقوم بإظهار رسالة مخصصة مع زر حسناً.

- -

بناء الجملة

- -
window.alert(message);
- -

خصائص

- -
-
message {{optional_inline}}
-
-
يمكنك تمرير سلسلة نصية بين أقواس الدالة  حتى يتم إظهارها من خلال نافذة التنبيه، أو كائن يتم تحويلة إلى نص ثم عرض محتواه.
-
- -

مثال

- -
window.alert("مرحبا بالعالم!");
-alert("مرحبا بالعالم!");
- -

كلاهما ينتج:

- -

Image:AlertHelloWorld.png

- -

Notes

- -

The alert dialog should be used for messages which do not require any response on the part of the user, other than the acknowledgement of the message.

- -

The following text is shared between this article, DOM:window.prompt and DOM:window.confirm Dialog boxes are modal windows - they prevent the user from accessing the rest of the program's interface until the dialog box is closed. For this reason, you should not overuse any function that creates a dialog box (or modal window).

- -

Specification

- - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'timers-and-user-prompts.html#dom-alert', 'alert()')}}{{Spec2('HTML WHATWG')}}
- -

Browser compatibility

- - - -

{{Compat("api.Window.alert")}}

- -

See also

- -
    -
  • {{domxref("window.confirm","confirm")}}
  • -
  • {{domxref("window.prompt","prompt")}}
  • -
  • For Mozilla Chrome see {{ifmethod("nsIPromptService","alert")}} and {{ifmethod("nsIPromptService","alertCheck")}}
  • -
- -
-
-
diff --git a/files/ar/web/api/window/domcontentloaded_event/index.html b/files/ar/web/api/window/domcontentloaded_event/index.html deleted file mode 100644 index d585930f1f..0000000000 --- a/files/ar/web/api/window/domcontentloaded_event/index.html +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: 'Window: DOMContentLoaded event' -slug: Web/API/Window/DOMContentLoaded_event -translation_of: Web/API/Window/DOMContentLoaded_event ---- -
{{APIRef}}
- -

يبدأ حدث DOMContentLoaded عند تحميل مستند HTML الأولي وتحليله بالكامل ، دون انتظار انتهاء تحميل صفحات الأنماط والصور والأطر الفرعية.

- - - - - - - - - - - - - - - - - - - - -
BubblesYes
CancelableYes (although specified as a simple event that isn't cancelable)
Interface{{domxref("Event")}}
Event handler propertyNone
- -

The original target for this event is the {{domxref("Document")}} that has loaded. You can listen for this event on the Window interface to handle it in the capture or bubbling phases. For full details on this event please see the page on the Document: {{domxref("Document/DOMContentLoaded_event", "DOMContentLoaded")}} event.

- -

A different event, {{domxref("Window/load_event", "load")}}, should be used only to detect a fully-loaded page. It is a common mistake to use load where DOMContentLoaded would be more appropriate.

- -

Examples

- -

Basic usage

- -
window.addEventListener('DOMContentLoaded', (event) => {
-    console.log('DOM fully loaded and parsed');
-});
-
- -

Specifications

- - - - - - - - - - - - - - -
SpecificationStatus
{{SpecName('HTML WHATWG', 'indices.html#event-domcontentloaded')}}{{Spec2('HTML WHATWG')}}
- -

Browser compatibility

- - - -

{{Compat("api.Window.DOMContentLoaded_event")}}

- -

See also

- -
    -
  • Related events: {{domxref("Window/load_event", "load")}}, {{domxref("Document/readystatechange_event", "readystatechange")}}, {{domxref("Window/beforeunload_event", "beforeunload")}}, {{domxref("Window/unload_event", "unload")}}
  • -
  • This event on {{domxref("Document")}} targets: {{domxref("Document/DOMContentLoaded_event", "DOMContentLoaded")}}
  • -
diff --git a/files/ar/web/api/window/index.html b/files/ar/web/api/window/index.html deleted file mode 100644 index aedbf1702b..0000000000 --- a/files/ar/web/api/window/index.html +++ /dev/null @@ -1,708 +0,0 @@ ---- -title: Window -slug: Web/API/Window -tags: - - API - - Browser - - HTML DOM - - Interface - - NeedsTranslation - - Reference - - Tab - - TopicStub - - Window - - global - - global scope - - scope -translation_of: Web/API/Window ---- -
{{APIRef("DOM")}}
- -

The Window interface represents a window containing a {{glossary("DOM")}} document; the document property points to the DOM document loaded in that window. A window for a given document can be obtained using the {{domxref("document.defaultView")}} property.

- -

A global variable, window, representing the window in which the script is running, is exposed to JavaScript code.

- -

The Window interface is home to a variety of functions, namespaces, objects, and constructors which are not necessarily directly associated with the concept of a user interface window. However, the Window interface is a suitable place to include these items that need to be globally available. Many of these are documented in the JavaScript Reference and the DOM Reference.

- -

In a tabbed browser, each tab is represented by its own Window object; the global window seen by JavaScript code running within a given tab always represents the tab in which the code is running. That said, even in a tabbed browser, some properties and methods still apply to the overall window that contains the tab, such as {{Domxref("Window.resizeTo", "resizeTo()")}} and {{Domxref("Window.innerHeight", "innerHeight")}}. Generally, anything that can't reasonably pertain to a tab pertains to the window instead.

- -

{{InheritanceDiagram}}

- -

Constructors

- -

See also the DOM Interfaces.

- -
-
{{domxref("DOMParser")}}
-
DOMParser can parse XML or HTML source stored in a string into a DOM Document. DOMParser is specified in DOM Parsing and Serialization.
-
{{domxref("Image")}}
-
Used for creating an {{domxref("HTMLImageElement")}}.
-
{{domxref("Option")}}
-
Used for creating an {{domxref("HTMLOptionElement")}}.
-
{{domxref("StaticRange")}} {{experimental_inline}} {{readonlyinline}}
-
Returns a {{domxref('StaticRange.StaticRange','StaticRange()')}} constructor which creates a {{domxref('StaticRange')}} object.
-
{{domxref("Worker")}}
-
Used for creating a Web worker.
-
{{domxref("XMLSerializer")}}
-
Converts a DOM tree into XML or HTML source.
-
- -

Properties

- -

This interface inherits properties from the {{domxref("EventTarget")}} interface and implements properties from the {{domxref("WindowOrWorkerGlobalScope")}} and {{domxref("WindowEventHandlers")}} mixins.

- -

Note that properties which are objects (e.g.,. for overriding the prototype of built-in elements) are listed in a separate section below.

- -
-
{{domxref("Window.closed")}} {{Non-standard_inline}} {{readOnlyInline}}
-
This property indicates whether the current window is closed or not.
-
{{domxref("Window.console")}} {{ReadOnlyInline}}
-
Returns a reference to the console object which provides access to the browser's debugging console.
-
{{domxref("Window.controllers")}} {{non-standard_inline}} {{ReadOnlyInline}}
-
Returns the XUL controller objects for the current chrome window.
-
{{domxref("Window.customElements")}} {{ReadOnlyInline}}
-
returns a reference to the {{domxref("CustomElementRegistry")}} object, which can be used to register new custom elements and get information about previously registered custom elements.
-
{{domxref("Window.crypto")}} {{readOnlyInline}}
-
Returns the browser crypto object.
-
{{domxref("Window.devicePixelRatio")}} {{non-standard_inline}} {{ReadOnlyInline}}
-
Returns the ratio between physical pixels and device independent pixels in the current display.
-
{{domxref("Window.dialogArguments")}} {{ReadOnlyInline}}
-
Gets the arguments passed to the window (if it's a dialog box) at the time {{domxref("window.showModalDialog()")}} was called. This is an {{Interface("nsIArray")}}.
-
{{domxref("Window.document")}} {{ReadOnlyInline}}
-
Returns a reference to the document that the window contains.
-
{{domxref("Window.DOMMatrix")}} {{readOnlyInline}} {{experimental_inline}}
-
Returns a reference to a {{domxref("DOMMatrix")}} object, which represents 4x4 matrices, suitable for 2D and 3D operations.
-
{{domxref("Window.DOMMatrixReadOnly")}} {{readOnlyInline}} {{experimental_inline}}
-
Returns a reference to a {{domxref("DOMMatrixReadOnly")}} object, which represents 4x4 matrices, suitable for 2D and 3D operations.
-
{{domxref("Window.DOMPoint")}} {{readOnlyInline}} {{experimental_inline}}
-
Returns a reference to a {{domxref("DOMPoint")}} object, which represents a 2D or 3D point in a coordinate system.
-
{{domxref("Window.DOMPointReadOnly")}} {{readOnlyInline}} {{experimental_inline}}
-
Returns a reference to a {{domxref("DOMPointReadOnly")}} object, which represents a 2D or 3D point in a coordinate system.
-
{{domxref("Window.DOMQuad")}} {{readOnlyInline}} {{experimental_inline}}
-
Returns a reference to a {{domxref("DOMQuad")}} object, which provides represents a quadrilaterial object, that is one having four corners and four sides.
-
{{domxref("Window.DOMRect")}} {{readOnlyInline}} {{experimental_inline}}
-
Returns a reference to a {{domxref("DOMRect")}} object, which represents a rectangle.
-
{{domxref("Window.DOMRectReadOnly")}} {{readOnlyInline}} {{experimental_inline}}
-
Returns a reference to a {{domxref("DOMRectReadOnly")}} object, which represents a rectangle.
-
{{domxref("Window.event")}} {{ReadOnlyInline}}
-
Returns the current event, which is the event currently being handled by the JavaScript code's context, or undefined if no event is currently being handled. The {{domxref("Event")}} object passed directly to event handlers should be used instead whenever possible.
-
{{domxref("Window.frameElement")}} {{readOnlyInline}}
-
Returns the element in which the window is embedded, or null if the window is not embedded.
-
{{domxref("Window.frames")}} {{readOnlyInline}}
-
Returns an array of the subframes in the current window.
-
{{domxref("Window.fullScreen")}}
-
This property indicates whether the window is displayed in full screen or not.
-
{{domxref("Window.history")}} {{ReadOnlyInline}}
-
Returns a reference to the history object.
-
{{domxref("Window.innerHeight")}} {{readOnlyInline}}
-
Gets the height of the content area of the browser window including, if rendered, the horizontal scrollbar.
-
{{domxref("Window.innerWidth")}} {{readOnlyInline}}
-
Gets the width of the content area of the browser window including, if rendered, the vertical scrollbar.
-
{{domxref("Window.isSecureContext")}} {{experimental_inline}} {{readOnlyInline}}
-
Indicates whether a context is capable of using features that require secure contexts.
-
{{domxref("Window.length")}} {{readOnlyInline}}
-
Returns the number of frames in the window. See also {{domxref("window.frames")}}.
-
{{domxref("Window.location")}}
-
Gets/sets the location, or current URL, of the window object.
-
{{domxref("Window.locationbar")}} {{ReadOnlyInline}}
-
Returns the locationbar object, whose visibility can be toggled in the window.
-
{{domxref("Window.localStorage")}} {{readOnlyInline}}
-
Returns a reference to the local storage object used to store data that may only be accessed by the origin that created it.
-
{{domxref("Window.menubar")}} {{ReadOnlyInline}}
-
Returns the menubar object, whose visibility can be toggled in the window.
-
{{domxref("Window.messageManager")}}
-
Returns the message manager object for this window.
-
{{domxref("Window.mozInnerScreenX")}} {{ReadOnlyInline}} {{non-standard_inline}}
-
Returns the horizontal (X) coordinate of the top-left corner of the window's viewport, in screen coordinates. This value is reported in CSS pixels. See mozScreenPixelsPerCSSPixel in {{interface("nsIDOMWindowUtils")}} for a conversion factor to adapt to screen pixels if needed.
-
{{domxref("Window.mozInnerScreenY")}} {{ReadOnlyInline}} {{non-standard_inline}}
-
Returns the vertical (Y) coordinate of the top-left corner of the window's viewport, in screen coordinates. This value is reported in CSS pixels. See mozScreenPixelsPerCSSPixel for a conversion factor to adapt to screen pixels if needed.
-
{{domxref("Window.name")}}
-
Gets/sets the name of the window.
-
{{domxref("Window.navigator")}} {{readOnlyInline}}
-
Returns a reference to the navigator object.
-
{{domxref("Window.opener")}}
-
Returns a reference to the window that opened this current window.
-
{{domxref("Window.orientation")}} {{non-standard_inline}} {{deprecated_inline}} {{readOnlyInline}}
-
Returns the orientation in degrees (in 90 degree increments) of the viewport relative to the device's natural orientation.
-
{{domxref("Window.outerHeight")}} {{readOnlyInline}}
-
Gets the height of the outside of the browser window.
-
{{domxref("Window.outerWidth")}} {{readOnlyInline}}
-
Gets the width of the outside of the browser window.
-
{{domxref("Window.scrollX","Window.pageXOffset")}} {{readOnlyInline}}
-
An alias for {{domxref("window.scrollX")}}.
-
{{domxref("Window.scrollY","Window.pageYOffset")}} {{readOnlyInline}}
-
An alias for {{domxref("window.scrollY")}}
-
{{domxref("Window.parent")}} {{readOnlyInline}}
-
Returns a reference to the parent of the current window or subframe.
-
{{domxref("Window.performance")}} {{readOnlyInline}}
-
Returns a {{domxref("Performance")}} object, which includes the {{domxref("Performance.timing", "timing")}} and {{domxref("Performance.navigation", "navigation")}} attributes, each of which is an object providing performance-related data. See also Using Navigation Timing for additional information and examples.
-
{{domxref("Window.personalbar")}} {{readOnlyInline}}
-
Returns the personalbar object, whose visibility can be toggled in the window.
-
{{domxref("Window.screen")}} {{readOnlyInline}}
-
Returns a reference to the screen object associated with the window.
-
{{domxref("Window.screenX")}} and {{domxref("Window.screenLeft")}} {{readOnlyInline}}
-
Both properties return the horizontal distance from the left border of the user's browser viewport to the left side of the screen.
-
{{domxref("Window.screenY")}} and {{domxref("Window.screenTop")}} {{readOnlyInline}}
-
Both properties return the vertical distance from the top border of the user's browser viewport to the top side of the screen.
-
{{domxref("Window.scrollbars")}} {{readOnlyInline}}
-
Returns the scrollbars object, whose visibility can be toggled in the window.
-
{{domxref("Window.scrollMaxX")}} {{non-standard_inline}} {{ReadOnlyInline}}
-
The maximum offset that the window can be scrolled to horizontally, that is the document width minus the viewport width.
-
{{domxref("Window.scrollMaxY")}} {{non-standard_inline}} {{ReadOnlyInline}}
-
The maximum offset that the window can be scrolled to vertically (i.e., the document height minus the viewport height).
-
{{domxref("Window.scrollX")}} {{readOnlyInline}}
-
Returns the number of pixels that the document has already been scrolled horizontally.
-
{{domxref("Window.scrollY")}} {{readOnlyInline}}
-
Returns the number of pixels that the document has already been scrolled vertically.
-
{{domxref("Window.self")}} {{ReadOnlyInline}}
-
Returns an object reference to the window object itself.
-
{{domxref("Window.sessionStorage")}}
-
Returns a reference to the session storage object used to store data that may only be accessed by the origin that created it.
-
{{domxref("Window.sidebar")}} {{non-standard_inline}} {{ReadOnlyInline}}
-
Returns a reference to the window object of the sidebar.
-
{{domxref("Window.speechSynthesis")}} {{ReadOnlyInline}}
-
Returns a {{domxref("SpeechSynthesis")}} object, which is the entry point into using Web Speech API speech synthesis functionality.
-
{{domxref("Window.status")}}
-
Gets/sets the text in the statusbar at the bottom of the browser.
-
{{domxref("Window.statusbar")}} {{readOnlyInline}}
-
Returns the statusbar object, whose visibility can be toggled in the window.
-
{{domxref("Window.toolbar")}} {{readOnlyInline}}
-
Returns the toolbar object, whose visibility can be toggled in the window.
-
{{domxref("Window.top")}} {{readOnlyInline}}
-
Returns a reference to the topmost window in the window hierarchy. This property is read only.
-
{{domxref("Window.visualViewport")}} {{readOnlyInline}}
-
Returns a {{domxref("VisualViewport")}} object which represents the visual viewport for a given window.
-
{{domxref("Window.window")}} {{ReadOnlyInline}}
-
Returns a reference to the current window.
-
window[0], window[1], etc.
-
Returns a reference to the window object in the frames. See {{domxref("Window.frames")}} for more details.
-
- -

Properties implemented from elsewhere

- -
-
{{domxref("WindowOrWorkerGlobalScope.caches")}} {{readOnlyinline}}
-
Returns the {{domxref("CacheStorage")}} object associated with the current context. This object enables functionality such as storing assets for offline use, and generating custom responses to requests.
-
{{domxref("WindowOrWorkerGlobalScope.indexedDB")}} {{readonlyInline}}
-
Provides a mechanism for applications to asynchronously access capabilities of indexed databases; returns an {{domxref("IDBFactory")}} object.
-
{{domxref("WindowOrWorkerGlobalScope.isSecureContext")}} {{readOnlyinline}}
-
Returns a boolean indicating whether the current context is secure (true) or not (false).
-
{{domxref("WindowOrWorkerGlobalScope.origin")}} {{readOnlyinline}}
-
Returns the global object's origin, serialized as a string. (This does not yet appear to be implemented in any browser.)
-
- -

Obsolete properties

- -
-
{{domxref("Window.content")}} and Window._content {{Non-standard_inline}} {{obsolete_inline}} {{ReadOnlyInline}}
-
Returns a reference to the content element in the current window. Since Firefox 57 (initially Nightly-only), both versions are only available from chrome (privileged) code, and not available to the web anymore.
-
{{domxref("Window.defaultStatus")}} {{obsolete_inline}}
-
Gets/sets the status bar text for the given window.
-
{{domxref("Window.directories")}} {{obsolete_inline}}
-
Synonym of {{domxref("window.personalbar")}}
-
{{domxref("Window.globalStorage")}} {{Non-standard_inline}} {{obsolete_inline}}
-
Multiple storage objects that were used for storing data across multiple pages.
-
{{domxref("Window.mozAnimationStartTime")}} {{Non-standard_inline}} {{obsolete_inline}}
-
The time in milliseconds since epoch at which the current animation cycle began. Use {{domxref("Animation.startTime")}} instead.
-
{{domxref("Window.mozPaintCount")}} {{non-standard_inline}} {{obsolete_inline}}
-
Returns the number of times the current document has been rendered to the screen in this window. This can be used to compute rendering performance.
-
{{domxref("Window.pkcs11")}} {{obsolete_inline}}
-
Formerly provided access to install and remove PKCS11 modules.
-
{{domxref("Window.returnValue")}} {{obsolete_inline}}
-
The return value to be returned to the function that called {{domxref("window.showModalDialog()")}} to display the window as a modal dialog.
-
- -

Methods

- -

This interface inherits methods from the {{domxref("EventTarget")}} interface and implements methods from {{domxref("WindowOrWorkerGlobalScope")}} and {{domxref("EventTarget")}}.

- -
-
{{domxref("Window.alert()")}}
-
Displays an alert dialog.
-
{{domxref("Window.blur()")}}
-
Sets focus away from the window.
-
{{domxref("Window.cancelAnimationFrame()")}} {{experimental_inline}}
-
Enables you to cancel a callback previously scheduled with {{domxref("Window.requestAnimationFrame")}}.
-
{{domxref("Window.cancelIdleCallback()")}} {{experimental_inline}}
-
Enables you to cancel a callback previously scheduled with {{domxref("Window.requestIdleCallback")}}.
-
{{domxref("Window.clearImmediate()")}}
-
Cancels the repeated execution set using setImmediate.
-
{{domxref("Window.close()")}}
-
Closes the current window.
-
{{domxref("Window.confirm()")}}
-
Displays a dialog with a message that the user needs to respond to.
-
{{domxref("Window.dump()")}} {{Non-standard_inline}}
-
Writes a message to the console.
-
{{domxref("Window.find()")}}
-
Searches for a given string in a window.
-
{{domxref("Window.focus()")}}
-
Sets focus on the current window.
-
{{domxref("Window.getComputedStyle()")}}
-
Gets computed style for the specified element. Computed style indicates the computed values of all CSS properties of the element.
-
{{domxref("Window.getDefaultComputedStyle()")}} {{Non-standard_inline}}
-
Gets default computed style for the specified element, ignoring author stylesheets.
-
{{domxref("Window.getSelection()")}}
-
Returns the selection object representing the selected item(s).
-
{{domxref("Window.matchMedia()")}}
-
Returns a {{domxref("MediaQueryList")}} object representing the specified media query string.
-
{{domxref("Window.maximize()")}}
-
{{todo("NeedsContents")}}
-
{{domxref("Window.minimize()")}} (top-level XUL windows only)
-
Minimizes the window.
-
{{domxref("Window.moveBy()")}}
-
Moves the current window by a specified amount.
-
{{domxref("Window.moveTo()")}}
-
Moves the window to the specified coordinates.
-
{{domxref("Window.open()")}}
-
Opens a new window.
-
{{domxref("Window.postMessage()")}}
-
Provides a secure means for one window to send a string of data to another window, which need not be within the same domain as the first.
-
{{domxref("Window.print()")}}
-
Opens the Print Dialog to print the current document.
-
{{domxref("Window.prompt()")}}
-
Returns the text entered by the user in a prompt dialog.
-
{{domxref("Window.requestAnimationFrame()")}}
-
Tells the browser that an animation is in progress, requesting that the browser schedule a repaint of the window for the next animation frame.
-
{{domxref("Window.requestIdleCallback()")}} {{experimental_inline}}
-
Enables the scheduling of tasks during a browser's idle periods.
-
{{domxref("Window.resizeBy()")}}
-
Resizes the current window by a certain amount.
-
{{domxref("Window.resizeTo()")}}
-
Dynamically resizes window.
-
{{domxref("Window.scroll()")}}
-
Scrolls the window to a particular place in the document.
-
{{domxref("Window.scrollBy()")}}
-
Scrolls the document in the window by the given amount.
-
{{domxref("Window.scrollByLines()")}} {{Non-standard_inline}}
-
Scrolls the document by the given number of lines.
-
{{domxref("Window.scrollByPages()")}} {{Non-standard_inline}}
-
Scrolls the current document by the specified number of pages.
-
{{domxref("Window.scrollTo()")}}
-
Scrolls to a particular set of coordinates in the document.
-
{{domxref("Window.setCursor()")}} {{Non-standard_inline}} (top-level XUL windows only)
-
Changes the cursor for the current window
-
{{domxref("Window.setImmediate()")}}
-
Executes a function after the browser has finished other heavy tasks
-
{{domxref("Window.setResizable()")}} {{Non-standard_inline}}
-
Toggles a user's ability to resize a window.
-
{{domxref("Window.sizeToContent()")}} {{Non-standard_inline}}
-
Sizes the window according to its content.
-
{{domxref("Window.stop()")}}
-
This method stops window loading.
-
{{domxref("Window.updateCommands()")}} {{Non-standard_inline}}
-
Updates the state of commands of the current chrome window (UI).
-
- -

Methods implemented from elsewhere

- -
-
{{domxref("EventTarget.addEventListener()")}}
-
Register an event handler to a specific event type on the window.
-
{{domxref("EventTarget.dispatchEvent()")}}
-
Used to trigger an event.
-
{{domxref("WindowOrWorkerGlobalScope.atob()")}}
-
Decodes a string of data which has been encoded using base-64 encoding.
-
{{domxref("WindowOrWorkerGlobalScope.btoa()")}}
-
Creates a base-64 encoded ASCII string from a string of binary data.
-
{{domxref("WindowOrWorkerGlobalScope.clearInterval()")}}
-
Cancels the repeated execution set using {{domxref("WindowOrWorkerGlobalScope.setInterval()")}}.
-
{{domxref("WindowOrWorkerGlobalScope.clearTimeout()")}}
-
Cancels the delayed execution set using {{domxref("WindowOrWorkerGlobalScope.setTimeout()")}}.
-
{{domxref("WindowOrWorkerGlobalScope.createImageBitmap()")}}
-
Accepts a variety of different image sources, and returns a {{domxref("Promise")}} which resolves to an {{domxref("ImageBitmap")}}. Optionally the source is cropped to the rectangle of pixels originating at (sx, sy) with width sw, and height sh.
-
{{domxref("WindowOrWorkerGlobalScope.fetch()")}}
-
Starts the process of fetching a resource from the network.
-
{{domxref("EventTarget.removeEventListener")}}
-
Removes an event listener from the window.
-
{{domxref("WindowOrWorkerGlobalScope.setInterval()")}}
-
Schedules a function to execute every time a given number of milliseconds elapses.
-
{{domxref("WindowOrWorkerGlobalScope.setTimeout()")}}
-
Schedules a function to execute in a given amount of time.
-
- -

Obsolete methods

- -
-
{{domxref("Window.back()")}} {{Non-standard_inline}} {{obsolete_inline}}
-
Moves back one in the window history. This method is obsolete; you should instead use {{domxref("History.back", "window.history.back()")}}.
-
{{domxref("Window.captureEvents()")}} {{Non-standard_inline}} {{obsolete_inline}}
-
Registers the window to capture all events of the specified type.
-
{{domxref("Window.forward()")}} {{Non-standard_inline}} {{obsolete_inline}}
-
Moves the window one document forward in the history. This method is obsolete; you should instead use {{domxref("History.forward", "window.history.forward()")}}.
-
{{domxref("Window.getAttention()")}} {{Non-standard_inline}} {{obsolete_inline}}
-
Flashes the application icon.
-
{{domxref("Window.home()")}} {{Non-standard_inline}} {{obsolete_inline}}
-
Returns the browser to the home page.
-
{{domxref("Window.openDialog()")}} {{Non-standard_inline}} {{obsolete_inline}}
-
Opens a new dialog window.
-
{{domxref("Window.releaseEvents()")}} {{Non-standard_inline}} {{obsolete_inline}}
-
Releases the window from trapping events of a specific type.
-
{{domxref("Window.showModalDialog()")}} {{Non-standard_inline}} {{obsolete_inline}}
-
Displays a modal dialog.
-
- -

Event handlers

- -

These are properties of the window object that can be set to establish event handlers for the various things that can happen in the window that might be of interest.

- -

This interface inherits event handlers from the {{domxref("EventTarget")}} interface and implements event handlers from {{domxref("WindowEventHandlers")}}.

- -
-

Note: Starting in {{Gecko("9.0")}}, you can now use the syntax if ("onabort" in window) to determine whether or not a given event handler property exists. This is because event handler interfaces have been updated to be proper web IDL interfaces. See DOM event handlers for details.

-
- -
-
{{domxref("Window.onappinstalled")}}
-
Called when the page is installed as a webapp. See {{domxref("Window/appinstalled_event", "appinstalled")}} event.
-
{{domxref("Window.onbeforeinstallprompt")}}
-
An event handler property dispatched before a user is prompted to save a web site to a home screen on mobile.
-
{{domxref("Window.ondevicelight")}}
-
An event handler property for any ambient light levels changes
-
{{domxref("Window.ondevicemotion")}}
-
Called if accelerometer detects a change (For mobile devices)
-
{{domxref("Window.ondeviceorientation")}}
-
Called when the orientation is changed (For mobile devices)
-
{{domxref("Window.ondeviceorientationabsolute")}} {{non-standard_inline}}
-
An event handler property for any device orientation changes.
-
{{domxref("Window.ondeviceproximity")}}
-
An event handler property for device proximity event
-
{{domxref("Window.ongamepadconnected")}}
-
Represents an event handler that will run when a gamepad is connected (when the {{event('gamepadconnected')}} event fires).
-
{{domxref("Window.ongamepaddisconnected")}}
-
Represents an event handler that will run when a gamepad is disconnected (when the {{event('gamepaddisconnected')}} event fires).
-
{{domxref("Window.onmozbeforepaint")}}
-
An event handler property for the MozBeforePaint event, which is sent before repainting the window if the event has been requested by a call to the {{domxref("Window.mozRequestAnimationFrame()")}} method.
-
{{domxref("Window.onpaint")}}
-
An event handler property for paint events on the window.
-
{{domxref("Window.onrejectionhandled")}} {{experimental_inline}}
-
An event handler for handled {{jsxref("Promise")}} rejection events.
-
{{domxref("Window.onuserproximity")}}
-
An event handler property for user proximity events.
-
{{domxref("Window.onvrdisplayconnect")}}
-
Represents an event handler that will run when a compatible VR device has been connected to the computer (when the {{event("vrdisplayconnected")}} event fires).
-
{{domxref("Window.onvrdisplaydisconnect")}}
-
Represents an event handler that will run when a compatible VR device has been disconnected from the computer (when the {{event("vrdisplaydisconnected")}} event fires).
-
{{domxref("Window.onvrdisplayactivate")}}
-
Represents an event handler that will run when a display is able to be presented to (when the {{event("vrdisplayactivate")}} event fires), for example if an HMD has been moved to bring it out of standby, or woken up by being put on.
-
{{domxref("Window.onvrdisplaydeactivate")}}
-
Represents an event handler that will run when a display can no longer be presented to (when the {{event("vrdisplaydeactivate")}} event fires), for example if an HMD has gone into standby or sleep mode due to a period of inactivity.
-
{{domxref("Window.onvrdisplayblur")}}
-
Represents an event handler that will run when presentation to a display has been paused for some reason by the browser, OS, or VR hardware (when the {{event("vrdisplayblur")}} event fires) — for example, while the user is interacting with a system menu or browser, to prevent tracking or loss of experience.
-
{{domxref("Window.onvrdisplayfocus")}}
-
Represents an event handler that will run when presentation to a display has resumed after being blurred (when the {{event("vrdisplayfocus")}} event fires).
-
{{domxref("Window.onvrdisplaypresentchange")}}
-
represents an event handler that will run when the presenting state of a VR device changes — i.e. goes from presenting to not presenting, or vice versa (when the {{event("vrdisplaypresentchange")}} event fires).
-
- -

Event handlers implemented from elsewhere

- -
-
{{domxref("GlobalEventHandlers.onabort")}}
-
Called when the loading of a resource has been aborted, such as by a user canceling the load while it is still in progress
-
{{domxref("WindowEventHandlers.onafterprint")}}
-
Called when the print dialog box is closed. See {{event("afterprint")}} event.
-
{{domxref("WindowEventHandlers.onbeforeprint")}}
-
Called when the print dialog box is opened. See {{event("beforeprint")}} event.
-
{{domxref("WindowEventHandlers.onbeforeunload")}}
-
An event handler property for before-unload events on the window.
-
{{domxref("GlobalEventHandlers.onblur")}}
-
Called after the window loses focus, such as due to a popup.
-
{{domxref("GlobalEventHandlers.onchange")}}
-
An event handler property for change events on the window.
-
{{domxref("GlobalEventHandlers.onclick")}}
-
Called after the ANY mouse button is pressed & released
-
{{domxref("GlobalEventHandlers.ondblclick")}}
-
Called when a double click is made with ANY mouse button.
-
{{domxref("GlobalEventHandlers.onclose")}}
-
Called after the window is closed
-
{{domxref("GlobalEventHandlers.oncontextmenu")}}
-
Called when the RIGHT mouse button is pressed
-
{{domxref("GlobalEventHandlers.onerror")}}
-
Called when a resource fails to load OR when an error occurs at runtime. See {{event("error")}} event.
-
{{domxref("GlobalEventHandlers.onfocus")}}
-
Called after the window receives or regains focus. See {{event("focus")}} events.
-
{{domxref("WindowEventHandlers.onhashchange")}} {{gecko_minversion_inline("1.9.2")}}
-
An event handler property for {{event('hashchange')}} events on the window; called when the part of the URL after the hash mark ("#") changes.
-
{{domxref("GlobalEventHandlers.oninput")}}
-
Called when the value of an <input> element changes
-
{{domxref("GlobalEventHandlers.onkeydown")}}
-
Called when you begin pressing ANY key. See {{event("keydown")}} event.
-
{{domxref("GlobalEventHandlers.onkeypress")}}
-
Called when a key (except Shift, Fn, and CapsLock) is in pressed position. See {{event("keypress")}} event.
-
{{domxref("GlobalEventHandlers.onkeyup")}}
-
Called when you finish releasing ANY key. See {{event("keyup")}} event.
-
{{domxref("WindowEventHandlers.onlanguagechange")}}
-
An event handler property for {{event("languagechange")}} events on the window.
-
{{domxref("GlobalEventHandlers.onload")}}
-
Called after all resources and the DOM are fully loaded. WILL NOT get called when the page is loaded from cache, such as with back button.
-
{{domxref("WindowEventHandlers.onmessage")}}
-
Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("message")}} event is raised.
-
{{domxref("GlobalEventHandlers.onmousedown")}}
-
Called when ANY mouse button is pressed.
-
{{domxref("GlobalEventHandlers.onmousemove")}}
-
Called continously when the mouse is moved inside the window.
-
{{domxref("GlobalEventHandlers.onmouseout")}}
-
Called when the pointer leaves the window.
-
{{domxref("GlobalEventHandlers.onmouseover")}}
-
Called when the pointer enters the window
-
{{domxref("GlobalEventHandlers.onmouseup")}}
-
Called when ANY mouse button is released
-
{{domxref("WindowEventHandlers.onoffline")}}
-
Called when network connection is lost. See {{event("offline")}} event.
-
{{domxref("WindowEventHandlers.ononline")}}
-
Called when network connection is established. See {{event("online")}} event.
-
{{domxref("WindowEventHandlers.onpagehide")}}
-
Called when the user navigates away from the page, before the onunload event. See {{event("pagehide")}} event.
-
{{domxref("WindowEventHandlers.onpageshow")}}
-
Called after all resources and the DOM are fully loaded. See {{event("pageshow")}} event.
-
{{domxref("WindowEventHandlers.onpopstate")}}
-
Called when a back button is pressed.
-
{{domxref("GlobalEventHandlers.onreset")}}
-
Called when a form is reset
-
{{domxref("GlobalEventHandlers.onresize")}}
-
Called continuously as you are resizing the window.
-
{{domxref("GlobalEventHandlers.onscroll")}}
-
Called when the scroll bar is moved via ANY means. If the resource fully fits in the window, then this event cannot be invoked
-
{{domxref("GlobalEventHandlers.onwheel")}}
-
Called when the mouse wheel is rotated around any axis
-
{{domxref("GlobalEventHandlers.onselect")}}
-
Called after text in an input field is selected
-
{{domxref("GlobalEventHandlers.onselectionchange")}}
-
Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("selectionchange")}} event is raised.
-
{{domxref("WindowEventHandlers.onstorage")}}
-
Called when there is a change in session storage or local storage. See {{event("storage")}} event
-
{{domxref("GlobalEventHandlers.onsubmit")}}
-
Called when a form is submitted
-
{{domxref("WindowEventHandlers.onunhandledrejection")}} {{experimental_inline}}
-
An event handler for unhandled {{jsxref("Promise")}} rejection events.
-
{{domxref("WindowEventHandlers.onunload")}}
-
Called when the user navigates away from the page.
-
- -

Events

- -

Listen to these events using addEventListener() or by assigning an event listener to the oneventname property of this interface.

- -
-
{{domxref("Window/error_event", "error")}}
-
Fired when a resource failed to load, or can't be used. For example, if a script has an execution error or an image can't be found or is invalid.
- Also available via the {{domxref("GlobalEventHandlers/onerror", "onerror")}} property.
-
{{domxref("Window/languagechange_event", "languagechange")}}
-
Fired at the global scope object when the user's preferred language changes.
- Also available via the {{domxref("WindowEventHandlers/onlanguagechange", "onlanguagechange")}} property.
-
{{domxref("Window/orientationchange_event", "orientationchange")}}
-
Fired when the orientation of the device has changed.
- Also available via the {{domxref("Window/onorientationchange", "onorientationchange")}} property.
-
{{domxref("Window/devicemotion_event", "devicemotion")}}
-
Fired at a regular interval, indicating the amount of physical force of acceleration the device is receiving and the rate of rotation, if available.
-
{{domxref("Window/deviceorientation_event", "deviceorientation")}}
-
Fired when fresh data is available from the magnetometer orientation sensor about the current orientation of the device as compared to the Earth coordinate frame.
-
{{domxref("Document/defaultView/resize_event", "resize")}}
-
Fired when the window has been resized.
- Also available via the {{domxref("GlobalEventHandlers/onresize", "onresize")}} property.
-
{{domxref("Document/defaultView/storage_event", "storage")}}
-
Fired when a storage area (localStorage or sessionStorage) has been modified in the context of another document.
- Also available via the {{domxref("WindowEventHandlers/onstorage", "onstorage")}} property.
-
- -

Animation events

- -
-
{{domxref("Window/animationcancel_event", "animationcancel")}}
-
Fired when an animation unexpectedly aborts.
- Also available via the {{domxref("GlobalEventHandlers/onanimationcancel", "onanimationcancel")}} property.
-
{{domxref("Window/animationend_event", "animationend")}}
-
Fired when an animation has completed normally.
- Also available via the {{domxref("GlobalEventHandlers/onanimationend", "onanimationend")}} property.
-
{{domxref("Window/animationiteration_event", "animationiteration")}}
-
Fired when an animation iteration has completed.
- Also available via the {{domxref("GlobalEventHandlers/onanimationiteration", "onanimationiteration")}} property.
-
{{domxref("Window/animationstart_event", "animationstart")}}
-
Fired when an animation starts.
- Also available via the {{domxref("GlobalEventHandlers/onanimationstart", "onanimationstart")}} property.
-
- -

Clipboard events

- -
-
{{domxref("Window/clipboardchange_event", "clipboardchange")}}
-
Fired when the system clipboard content changes.
-
{{domxref("Window/copy_event", "copy")}}
-
Fired when the user initiates a copy action through the browser's user interface.
- Also available via the {{domxref("HTMLElement/oncopy", "oncopy")}} property.
-
{{domxref("Window/cut_event", "cut")}}
-
Fired when the user initiates a cut action through the browser's user interface.
- Also available via the {{domxref("HTMLElement/oncut", "oncut")}} property.
-
{{domxref("Window/paste_event", "paste")}}
-
Fired when the user initiates a paste action through the browser's user interface.
- Also available via the {{domxref("HTMLElement/onpaste", "onpaste")}} property.
-
- -

Connection events

- -
-
{{domxref("Window/offline_event", "offline")}}
-
Fired when the browser has lost access to the network and the value of navigator.onLine has switched to false.
- Also available via the {{domxref("WindowEventHandlers.onoffline", "onoffline")}} property.
-
{{domxref("Window/online_event", "online ")}}
-
Fired when the browser has gained access to the network and the value of navigator.onLine has switched to true.
- Also available via the {{domxref("WindowEventHandlers.ononline", "ononline")}} property.
-
- -

Focus events

- -
-
{{domxref("Window/blur_event", "blur")}}
-
Fired when an element has lost focus.
- Also available via the {{domxref("GlobalEventHandlers/onblur", "onblur")}} property.
-
{{domxref("Window/focus_event", "focus")}}
-
Fired when an element has gained focus.
- Also available via the {{domxref("GlobalEventHandlers/onfocus", "onfocus")}} property
-
- -

Gamepad events

- -
-
{{domxref("Window/gamepadconnected_event", "gamepadconnected")}}
-
Fired when the browser detects that a gamepad has been connected or the first time a button/axis of the gamepad is used.
- Also available via the {{domxref("Window/ongamepadconnected", "ongamepadconnected")}} property.
-
{{domxref("Window/gamepaddisconnected_event", "gamepaddisconnected")}}
-
Fired when the browser detects that a gamepad has been disconnected.
- Also available via the {{domxref("Window/ongamepaddisconnected", "ongamepaddisconnected")}} property
-
- -

History events

- -
-
{{domxref("Window/hashchange_event", "hashchange")}}
-
Fired when the fragment identifier of the URL has changed (the part of the URL beginning with and following the # symbol).
- Also available via the {{domxref("WindowEventHandlers/onhashchange", "onhashchange")}} property.
-
{{domxref("Window/pagehide_event", "pagehide")}}
-
Sent when the browser hides the current document while in the process of switching to displaying in its place a different document from the session's history. This happens, for example, when the user clicks the Back button or when they click the Forward button to move ahead in session history.
- Also available through the onpagehide event handler property.
-
{{domxref("Window/pageshow_event", "pageshow")}}
-
Sent when the browser makes the document visible due to navigation tasks, including not only when the page is first loaded, but also situations such as the user navigating back to the page after having navigated to another within the same tab.
- Also available using the onpageshow event handler property.
-
{{domxref("Document/defaultView/popstate_event", "popstate")}}
-
Fired when the active history entry changes.
- Also available using the {{domxref("WindowEventHandlers/onpopstate", "onpopstate")}} event handler property.
-
- -

Load & unload events

- -
-
{{domxref("Window/beforeunload_event", "beforeunload")}}
-
Fired when the window, the document and its resources are about to be unloaded.
- Also available via the {{domxref("WindowEventHandlers/onbeforeunload", "onbeforeunload")}} property.
-
{{domxref("Window/DOMContentLoaded_event", "DOMContentLoaded")}}
-
Fired when the document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading.
-
{{domxref("Window/load_event", "load")}}
-
Fired when the whole page has loaded, including all dependent resources such as stylesheets images.
- Also available via the {{domxref("GlobalEventHandlers/onload", "onload")}} property.
-
{{domxref("Window/unload_event", "unload")}}
-
Fired when the document or a child resource is being unloaded.
- Also available via the {{domxref("WindowEventHandlers/onunload", "onunload")}} property.
-
- -

Manifest events

- -
-
{{domxref("Window/appinstalled_event", "appinstalled")}}
-
Fired when the browser has successfully installed a page as an application.
- Also available via the {{domxref("Window/onappinstalled", "onappinstalled")}} property.
-
{{domxref("Window/beforeinstallprompt_event", "beforeinstallprompt")}}
-
Fired when a user is about to be prompted to install a web application.
- Also available via the {{domxref("Window/onbeforeinstallprompt", "onbeforeinstallprompt")}} property.
-
- -

Messaging events

- -
-
{{domxref("Window/message_event", "message")}}
-
Fired when the window receives a message, for example from a call to {{domxref("Window/postMessage", "Window.postMessage()")}} from another browsing context.
- Also available via the {{domxref("WindowEventHandlers/onmessage", "onmessage")}} property.
-
{{domxref("Window/messageerror_event", "messageerror")}}
-
Fired when a Window object receives a message that can't be deserialized.
- Also available via the {{domxref("WindowEventHandlers/onmessageerror", "onmessageerror")}} property.
-
- - - -
-
{{domxref("Window/afterprint_event", "afterprint")}}
-
Fired after the associated document has started printing or the print preview has been closed.
- Also available via the {{domxref("WindowEventHandlers/onafterprint", "onafterprint")}} property.
-
{{domxref("Window/beforeprint_event", "beforeprint")}}
-
Fired when the associated document is about to be printed or previewed for printing.
- Also available via the {{domxref("WindowEventHandlers/onbeforeprint", "onbeforeprint")}} property.
-
- -

Promise rejection events

- -
-
{{domxref("Window/rejectionhandled_event", "rejectionhandled")}}
-
Sent every time a JavaScript {{jsxref("Promise")}} is rejected, regardless of whether or not there is a handler in place to catch the rejection.
- Also available through the {{domxref("WindowEventHandlers/onrejectionhandled", "onrejectionhandled")}} event handler property.
-
{{domxref("Window/unhandledrejection_event", "unhandledrejection")}}
-
Sent when a JavaScript {{jsxref("Promise")}} is rejected but there is no handler in place to catch the rejection.
- Also available using the {{domxref("WindowEventHandlers/onunhandledrejection", "onunhandledrejection")}} event handler property.
-
- -

Transition events

- -
-
{{domxref("Window/transitioncancel_event", "transitioncancel")}}
-
Fired when a CSS transition is canceled.
- Also available via the {{domxref("GlobalEventHandlers/ontransitioncancel", "ontransitioncancel")}} property.
-
{{domxref("Window/transitionend_event", "transitionend")}}
-
Fired when a CSS transition has completed.
- Also available via the {{domxref("GlobalEventHandlers/ontransitionend", "ontransitionend")}} property.
-
{{domxref("Window/transitionrun_event", "transitionrun")}}
-
Fired when a CSS transition is first created.
- Also available via the {{domxref("GlobalEventHandlers/ontransitionrun", "ontransitionrun")}} property.
-
{{domxref("Window/transitionstart_event", "transitionstart")}}
-
Fired when a CSS transition has actually started.
- Also available via the {{domxref("GlobalEventHandlers/ontransitionstart", "ontransitionstart")}} property.
-
- -

WebVR events

- -
-
{{domxref("Window/vrdisplayactivate_event", "vrdisplayactivate")}}
-
Fired when a VR display becomes available to be presented to, for example if an HMD has been moved to bring it out of standby, or woken up by being put on.
- Also available via the {{domxref("Window/onvrdisplayactivate", "onvrdisplayactivate")}} property.
-
{{domxref("Window/vrdisplayblur_event", "vrdisplayblur")}}
-
Fired when presentation to a VR display has been paused for some reason by the browser, OS, or VR hardware.
- Also available via the {{domxref("Window/onvrdisplayblur", "onvrdisplayblur")}} property.
-
{{domxref("Window/vrdisplayconnect_event", "vrdisplayconnect")}}
-
Fired when a compatible VR display is connected to the computer.
- Also available via the {{domxref("Window/onvrdisplayconnect", "onvrdisplayconnect")}} property.
-
{{domxref("Window/vrdisplaydeactivate_event", "vrdisplaydeactivate")}}
-
Fired when a VR display can no longer be presented to, for example if an HMD has gone into standby or sleep mode due to a period of inactivity.
- Also available via the {{domxref("Window/onvrdisplaydeactivate", "onvrdisplaydeactivate")}} property.
-
{{domxref("Window/vrdisplaydisconnect_event", "vrdisplaydisconnect")}}
-
Fired when a compatible VR display is disconnected from the computer.
- Also available via the {{domxref("Window/onvrdisplaydisconnect", "onvrdisplaydisconnect")}} property.
-
{{domxref("Window/vrdisplayfocus_event", "vrdisplayfocus")}}
-
Fired when presentation to a VR display has resumed after being blurred.
- Also available via the {{domxref("Window/onvrdisplayfocus", "onvrdisplayfocus")}} property.
-
{{domxref("Window/vrdisplaypresentchange_event", "vrdisplaypresentchange")}}
-
Fired when the presenting state of a VR display changes — i.e. goes from presenting to not presenting, or vice versa.
- Also available via the {{domxref("Window/onvrdisplaypresentchange", "onvrdisplaypresentchange")}} property.
-
{{domxref("Window/vrdisplaypointerrestricted_event", "vrdisplaypointerrestricted")}}
-
Fired when the VR display's pointer input is restricted to consumption via a pointerlocked element.
- Also available via the {{domxref("Window/onvrdisplaypointerrestricted", "onvrdisplaypointerrestricted")}} property.
-
{{domxref("Window/vrdisplaypointerunrestricted_event", "vrdisplaypointerunrestricted")}}
-
Fired when the VR display's pointer input is no longer restricted to consumption via a pointerlocked element.
- Also available via the {{domxref("Window/onvrdisplaypointerunrestricted", "onvrdisplaypointerunrestricted")}} property.
-
- -

Interfaces

- -

See DOM Reference.

- -

Browser compatibility

- - - -

{{Compat("api.Window")}}

diff --git a/files/ar/web/api/xsltprocessor/basic_example/index.html b/files/ar/web/api/xsltprocessor/basic_example/index.html deleted file mode 100644 index 19e3b75c8f..0000000000 --- a/files/ar/web/api/xsltprocessor/basic_example/index.html +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: مثال XSLT أساسي -slug: Web/API/XSLTProcessor/Basic_Example -tags: - - XSLT - - xsl -translation_of: Web/API/XSLTProcessor/Basic_Example ---- -

مثال أساسي

- -

يوضح المثال الأول أساسيات تفعيل محول XSLT في المتصفح. سوف يقوم المثال على ملف XML يحتوي على معلومات (العنوان - قائمة المؤلفين - المحتوى) عن مقال. ثم يقوم بعرضه بهيئة صالحة للقراءة.

- -

يبين الشكل ١ مثال على شكل ملف المصدر الأساسي لـ XSLT. يحتوي ملف XML  (example.xml) على معلومات حول المقال. وباستخدام أمر المعالجة ?xml-stylesheet? يتم ربط ملف example.xml بملف XSLT عن طريق صفة href.

- -

تبدأ صحيفة أنماط XSLT بالمكون xsl:stylesheet الذي يحوي كل القوالب المستخدمة في إنشاء المُخرَج المطلوب. يحتوي المثال في الشكل ١ على قالبين، أحدهما يُطَبَّق على عقدة التَفَرُّع الرئيسية والآخر يُطَبَّق على عقدة Author. يقوم القالب الذي يُطَبَّق على عقدة التَفَرُّع الرئيسية بإخراج عنوان المقال، ثم يقوم بعدها باستدعاء باقي القوالب (عن طريق apply-templates) التي تطابق عقدة Author وتكون فرعية عنها.

- -

الشكل ١: مثال XSLT بسيط

- -

ملف XML (example.xml):

- -
<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="example.xsl"?>
-<Article>
-  <Title>مقالي</Title>
-  <Authors>
-    <Author>السيد أحمد</Author>
-    <Author>السيد محمد</Author>
-  </Authors>
-  <Body>هنا محتوي مقالي.</Body>
-</Article>
- -

صحيفة أنماط XSL (example.xsl):

- -
<?xml version="1.0"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
-  <xsl:output method="text"/>
-
-  <xsl:template match="/">
-    Article - <xsl:value-of select="/Article/Title"/>
-    Authors: <xsl:apply-templates select="/Article/Authors/Author"/>
-  </xsl:template>
-
-  <xsl:template match="Author">
-    - <xsl:value-of select="." />
-  </xsl:template>
-
-</xsl:stylesheet>
- -

مُخرَج المتصفح:

- -
-

مقال - مقالي
- المؤلفون:
- - السيد أحمد
- - السيد محمد

-
diff --git a/files/ar/web/api/xsltprocessor/index.html b/files/ar/web/api/xsltprocessor/index.html deleted file mode 100644 index dbc44795da..0000000000 --- a/files/ar/web/api/xsltprocessor/index.html +++ /dev/null @@ -1,138 +0,0 @@ ---- -title: XSLTProcessor -slug: Web/API/XSLTProcessor -tags: - - API - - DOM - - DOM Reference - - NeedsTranslation - - Reference - - TopicStub - - XSLT -translation_of: Web/API/XSLTProcessor ---- -
{{Non-standard_header}}{{SeeCompatTable}}{{APIRef("XSLT")}}
- -

An XSLTProcessor applies an XSLT stylesheet transformation to an XML document to produce a new XML document as output. It has methods to load the XSLT stylesheet, to manipulate <xsl:param> parameter values, and to apply the transformation to documents.

- -

Syntax

- -

The constructor has no parameters.

- -
new XSLTProcessor()
- -

Methods

- -
-
[Throws] void {{domxref("XSLTProcessor.importStylesheet")}}({{domxref("Node")}} styleSheet)
-
Imports the XSLT stylesheet. If the given node is a document node, you can pass in a full XSL Transform or a literal result element transform; otherwise, it must be an <xsl:stylesheet> or <xsl:transform> element.
-
[Throws] {{domxref("DocumentFragment")}} {{domxref("XSLTProcessor.transformToFragment")}}({{domxref("Node")}} source, {{domxref("Document")}} owner)
-
Transforms the node source by applying the stylesheet imported using the {{domxref("XSLTProcessor.importStylesheet()")}} function. The owner document of the resulting document fragment is the owner node.
-
[Throws] {{domxref("Document")}} {{domxref("XSLTProcessor.transformToDocument")}}({{domxref("Node")}} source)
-
-

Transforms the node source applying the stylesheet given importing using the {{domxref("XSLTProcessor.importStylesheet()")}} function.

- -

The resultant object depends on the output method of the stylesheet:

- - - - - - - - - - - - - - - - - - - - - - -
Output methodResult type
html{{domxref("HTMLDocument")}}
xml{{domxref("XMLDocument")}}
text{{domxref("XMLDocument")}} with a single root element <transformiix:result> with the text as a child
-
-
[Throws] void {{domxref("XSLTProcessor.setParameter")}}({{jsxref("String")}} namespaceURI, {{jsxref("String")}} localName, any value)
-
Sets a parameter in the XSLT stylesheet that was imported. (Sets the value of an <xsl:param>.) A null value for namespaceURI is treated the same as an empty string.
-
[Throws] any {{domxref("XSLTProcessor.getParameter")}}({{jsxref("String")}} namespaceURI, {{jsxref("String")}} localName)
-
Gets the value of a parameter from the XSLT stylesheet. A null value for namespaceURI is treated the same as an empty string.
-
[Throws] void {{domxref("XSLTProcessor.removeParameter")}}({{jsxref("String")}} namespaceURI, {{jsxref("String")}} localName)
-
Removes the parameter if it was previously set. This will make the XSLTProcessor use the default value for the parameter as specified in the stylesheet. A null value for namespaceURI is treated the same as an empty string.
-
void {{domxref("XSLTProcessor.clearParameters()")}}
-
Removes all set parameters from the XSLTProcessor. The XSLTProcessor will then use the defaults specified in the XSLT stylesheet.
-
void {{domxref("XSLTProcessor.reset()")}}
-
Removes all parameters and stylesheets from the XSLTProcessor.
-
- -

Properties

- -

Non-Web-exposed properties

- -

The following properties are [ChromeOnly] and not exposed to Web content:

- -
-
[ChromeOnly] attribute unsigned long {{domxref("XSLTProcessor.flags")}}
-
-

Flags that tweak the behavior of the processor. Not reset by calling {{domxref("XSLTProcessor.reset()")}}. Default value: 0

- -

Possible values are:

- - - - - - - - - - - - - - - - - - - - - -
NameValueEffect
(None)0None
DISABLE_ALL_LOADS1Disable loading external documents (via e.g. <xsl:import> and document())
-
-
- -

Examples

- -
    -
  1. Basic example
  2. -
  3. Advanced example
  4. -
  5. Additional example
  6. -
- -

Specifications

- -

Not part of any specification. This is a proprietary interface that originated in Gecko.

- -

Gecko IDL

- -
    -
  • {{ Source("dom/webidl/XSLTProcessor.webidl", "XSLTProcessor.webidl") }}
  • -
  • {{ Source("dom/xslt/nsIXSLTProcessor.idl", "nsIXSLTProcessor.idl") }}
  • -
- -

Browser compatibility

- - - -

{{Compat("api.XSLTProcessor")}}

- -

See also

- - diff --git a/files/ar/web/css/align-content/index.html b/files/ar/web/css/align-content/index.html deleted file mode 100644 index 974ea0c632..0000000000 --- a/files/ar/web/css/align-content/index.html +++ /dev/null @@ -1,294 +0,0 @@ ---- -title: align-content -slug: Web/CSS/align-content -translation_of: Web/CSS/align-content ---- -

تحدد خاصية align-content CSS توزيع المساحة بين و حول محتوى العناصر على طول المحور العرضي لـ flexbox أو محور كتلة الشبكة.

- -

The interactive example below use Grid Layout to demonstrate some of the values of this property.

- -
{{EmbedInteractiveExample("pages/css/align-content.html")}}
- - - -

This property has no effect on single line flex containers (i.e. ones with flex-wrap: nowrap).

- -

Syntax

- -
/* Basic positional alignment */
-/* align-content does not take left and right values */
-align-content: center;     /* Pack items around the center */
-align-content: start;      /* Pack items from the start */
-align-content: end;        /* Pack items from the end */
-align-content: flex-start; /* Pack flex items from the start */
-align-content: flex-end;   /* Pack flex items from the end */
-
-/* Normal alignment */
-align-content: normal;
-
-/* Baseline alignment */
-align-content: baseline;
-align-content: first baseline;
-align-content: last baseline;
-
-/* Distributed alignment */
-align-content: space-between; /* Distribute items evenly
-                                 The first item is flush with the start,
-                                 the last is flush with the end */
-align-content: space-around;  /* Distribute items evenly
-                                 Items have a half-size space
-                                 on either end */
-align-content: space-evenly;  /* Distribute items evenly
-                                 Items have equal space around them */
-align-content: stretch;       /* Distribute items evenly
-                                 Stretch 'auto'-sized items to fit
-                                 the container */
-
-/* Overflow alignment */
-align-content: safe center;
-align-content: unsafe center;
-
-/* Global values */
-align-content: inherit;
-align-content: initial;
-align-content: unset;
-
- -

Values

- -
-
start
-
The items are packed flush to each other against the start edge of the alignment container in the cross axis.
-
end
-
The items are packed flush to each other against the end edge of the alignment container in the cross axis.
-
flex-start
-
The items are packed flush to each other against the edge of the alignment container depending on the flex container's cross-start side.
- This only applies to flex layout items. For items that are not children of a flex container, this value is treated like start.
-
flex-end
-
The items are packed flush to each other against the edge of the alignment container depending on the flex container's cross-end side.
- This only applies to flex layout items. For items that are not children of a flex container, this value is treated like end.
-
center
-
The items are packed flush to each other in the center of the alignment container along the cross axis.
-
normal
-
The items are packed in their default position as if no align-content value was set.
-
baseline
- first baseline

- last baseline
-
the baseline is the line upon which most letters "sit" and below which descenders extend.
-
Specifies participation in first- or last-baseline alignment: aligns the alignment baseline of the box’s first or last baseline set with the corresponding baseline in the shared first or last baseline set of all the boxes in its baseline-sharing group.
- The fallback alignment for first baseline is start, the one for last baseline is end.
-
space-between
-
The items are evenly distributed within the alignment container along the cross axis. The spacing between each pair of adjacent items is the same. The first item is flush with the start edge of the alignment container in the cross axis, and the last item is flush with the end edge of the alignment container in the cross axis.
-
space-around
-
The items are evenly distributed within the alignment container along the cross axis. The spacing between each pair of adjacent items is the same. The empty space before the first and after the last item equals half of the space between each pair of adjacent items.
-
space-evenly
-
The items are evenly distributed within the alignment container along the cross axis. The spacing between each pair of adjacent items, the start edge and the first item, and the end edge and the last item, are all exactly the same.
-
stretch
-
If the combined size of the items along the cross axis is less than the size of the alignment container, any auto-sized items have their size increased equally (not proportionally), while still respecting the constraints imposed by {{cssxref("max-height")}}/{{cssxref("max-width")}} (or equivalent functionality), so that the combined size exactly fills the alignment container along the cross axis.
-
safe
-
Used alongside an alignment keyword. If the chosen keyword means that the item overflows the alignment container causing data loss, the item is instead aligned as if the alignment mode were start.
-
unsafe
-
Used alongside an alignment keyword. Regardless of the relative sizes of the item and alignment container and whether overflow which causes data loss might happen, the given alignment value is honored.
-
- -

Formal definition

- -

{{CSSInfo}}

- -

Formal syntax

- -{{csssyntax}} - -

Examples

- -

CSS

- -
#container {
-  height:200px;
-  width: 240px;
-  align-content: center; /* Can be changed in the live sample */
-  background-color: #8c8c8c;
-}
-
-.flex {
-  display: flex;
-  flex-wrap: wrap;
-}
-
-.grid {
-  display: grid;
-  grid-template-columns: repeat(auto-fill, 50px);
-}
-
-div > div {
-  box-sizing: border-box;
-  border: 2px solid #8c8c8c;
-  width: 50px;
-  display: flex;
-  align-items: center;
-  justify-content: center;
-}
-
-#item1 {
-  background-color: #8cffa0;
-  min-height: 30px;
-}
-
-#item2 {
-  background-color: #a0c8ff;
-  min-height: 50px;
-}
-
-#item3 {
-  background-color: #ffa08c;
-  min-height: 40px;
-}
-
-#item4 {
-  background-color: #ffff8c;
-  min-height: 60px;
-}
-
-#item5 {
-  background-color: #ff8cff;
-  min-height: 70px;
-}
-
-#item6 {
-  background-color: #8cffff;
-  min-height: 50px;
-  font-size: 30px;
-}
-
-select {
-  font-size: 16px;
-}
-
-.row {
-  margin-top: 10px;
-}
-
- -

HTML

- -
<div id="container" class="flex">
-  <div id="item1">1</div>
-  <div id="item2">2</div>
-  <div id="item3">3</div>
-  <div id="item4">4</div>
-  <div id="item5">5</div>
-  <div id="item6">6</div>
-</div>
-
-<div class="row">
-  <label for="display">display: </label>
-  <select id="display">
-    <option value="flex">flex</option>
-    <option value="grid">grid</option>
-  </select>
-</div>
-
-<div class="row">
-  <label for="values">align-content: </label>
-  <select id="values">
-    <option value="normal">normal</option>
-    <option value="stretch">stretch</option>
-    <option value="flex-start">flex-start</option>
-    <option value="flex-end">flex-end</option>
-    <option value="center" selected>center</option>
-    <option value="space-between">space-between</option>
-    <option value="space-around">space-around</option>
-    <option value="space-evenly">space-evenly</option>
-
-    <option value="start">start</option>
-    <option value="end">end</option>
-    <option value="left">left</option>
-    <option value="right">right</option>
-
-    <option value="baseline">baseline</option>
-    <option value="first baseline">first baseline</option>
-    <option value="last baseline">last baseline</option>
-
-    <option value="safe center">safe center</option>
-    <option value="unsafe center">unsafe center</option>
-    <option value="safe right">safe right</option>
-    <option value="unsafe right">unsafe right</option>
-    <option value="safe end">safe end</option>
-    <option value="unsafe end">unsafe end</option>
-    <option value="safe flex-end">safe flex-end</option>
-    <option value="unsafe flex-end">unsafe flex-end</option>
-  </select>
-</div>
-
- - - -

Result

- -

{{EmbedLiveSample("Examples", 260, 290)}}

- -

Specifications

- - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName("CSS3 Box Alignment", "#propdef-align-content", "align-content")}}{{Spec2("CSS3 Box Alignment")}}Adds the [ first | last ]? baseline, start, end, left, right, unsafe | safe values.
{{SpecName("CSS3 Flexbox", "#align-content-property", "align-content")}}{{Spec2("CSS3 Flexbox")}}Initial definition
- -
{{cssinfo}}
- -

Browser compatibility

- -
- - -

Support in Flex layout

- -

{{Compat("css.properties.align-content.flex_context")}}

- -

Support in Grid layout

- -

{{Compat("css.properties.align-content.grid_context")}}

-
- -

See also

- - - -
{{CSSRef}}
diff --git a/files/ar/web/css/attribute_selectors/index.html b/files/ar/web/css/attribute_selectors/index.html deleted file mode 100644 index b129e4dc6a..0000000000 --- a/files/ar/web/css/attribute_selectors/index.html +++ /dev/null @@ -1,199 +0,0 @@ ---- -title: Attribute selectors -slug: Web/CSS/Attribute_selectors -tags: - - Attribute - - Attribute selectors - - CSS - - CSS 3 - - CSS 3 Attribute selectors - - CSS Attributes - - Identifying Elements - - Identifying Nodes - - Selecting Elements - - Selectors - - محدد الخاصية - - محددات -translation_of: Web/CSS/Attribute_selectors ---- -
{{CSSRef}}
- -

يطابق محدد خاصية CSS عناصر تستند إلى وجود أو قيمة لخاصية معينة.

- -
/* <a> elements with a title attribute */
-a[title] {
-  color: purple;
-}
-
-/* <a> elements with an href matching "https://example.org" */
-a[href="https://example.org"] {
-  color: green;
-}
-
-/* <a> elements with an href containing "example" */
-a[href*="example"] {
-  font-size: 2em;
-}
-
-/* <a> elements with an href ending ".org" */
-a[href$=".org"] {
-  font-style: italic;
-}
- -
-
[attr]
-
يمثل عناصر ذات اسم خاصية attr.
-
[attr=value]
-
يمثل العناصر التي تحتوي على اسم خاصية attr التي قيمتها هي ذات القيمة بالضبط.
-
[attr~=value]
-
يمثل العناصر التي تحتوي على اسم خاصية attr التي تكون قيمتها قائمة كلمات مفصولة بمسافات بيضاء ، واحدة منها هي القيمة بالضبط.
-
[attr|=value]
-
يمثل عناصر ذات اسم خاصية attr يمكن أن تكون قيمتها ذات قيمة بالضبط أو يمكن أن تبدأ بالقيمة مباشرة متبوعة بواصلة ، - (U + 002D).
-
وغالبًا ما يتم استخدامه لمطابقة اللغة الفرعية.
-
[attr^=value]
-
يمثل عناصر ذات اسم خاصية attr التي تكون قيمتة تماثل اول القيمة
-
(يبحث عن تماثل في بداية القيمة).
-
[attr$=value]
-
يمثل العناصر ذا اسم الخاصية attr التي تكون قيمته تماثل آخر القيمة
-
(يبحث عن تماثل في نهاية القيمة)
-
[attr*=value]
-
يمثل عناصر ذات اسم خاصية attr تحتوي قيمتها على تواجد واحد على الأقل للقيمة
-
داخل قيمة الخاصية.
-
[attr operator value i]
-
تؤدي إضافة حرف (i) أو (I) قبل قوس الإغلاق إلى مقارنة القيمة بحالة غير حساسة  (للأحرف ضمن نطاق ASCII).
-
- -

أمثلة

- -

روابط

- -

CSS

- -
a {
-  color: blue;
-}
-
-/*  "#" الروابط الداخلية ، تبدأ بـ*/
-a[href^="#"] {
-  background-color: gold;
-}
-
-/*  URL روابط مع "example" في أي مكان في عنوان */
-a[href*="example"] {
-  background-color: silver;
-}
-
-/* URL روابط "غير حساسة" في أي مكان في عنوان ،
-    بغض النظر عن الكتابة بحرف كبير*/
-a[href*="insensitive" i] {
-  color: cyan;
-}
-
-/* ".org"الروابط التي تنتهي بـ  */
-a[href$=".org"] {
-  color: red;
-}
-
- -

HTML

- -
<ul>
-  <li><a href="#internal">Internal link</a></li>
-  <li><a href="http://example.com">Example link</a></li>
-  <li><a href="#InSensitive">Insensitive internal link</a></li>
-  <li><a href="http://example.org">Example org link</a></li>
-</ul>
- -

Result

- -

{{EmbedLiveSample('Links')}}

- -

لغات

- -

CSS

- -
/* All divs with a `lang` attribute are bold. */
-div[lang] {
-  font-weight: bold;
-}
-
-/* All divs in US English are blue. */
-div[lang~="en-us"] {
-  color: blue;
-}
-
-/* All divs in Portuguese are green. */
-div[lang="pt"] {
-  color: green;
-}
-
-/* All divs in Chinese are red, whether
-   simplified (zh-CN) or traditional (zh-TW). */
-div[lang|="zh"] {
-  color: red;
-}
-
-/* All divs with a Traditional Chinese
-   `data-lang` are purple. */
-/* Note: You could also use hyphenated attributes
-   without double quotes */
-div[data-lang="zh-TW"] {
-  color: purple;
-}
-
- -

HTML

- -
<div lang="en-us en-gb en-au en-nz">Hello World!</div>
-<div lang="pt">Olá Mundo!</div>
-<div lang="zh-CN">世界您好!</div>
-<div lang="zh-TW">世界您好!</div>
-<div data-lang="zh-TW">?世界您好!</div>
-
- -

Result

- -

{{EmbedLiveSample('Languages')}}

- -

مواصفات

- - - - - - - - - - - - - - - - - - - - - - - - - - -
مواصفاتالحالةتعليق
{{SpecName('CSS4 Selectors', '#attribute-selectors', 'attribute selectors')}}{{Spec2('CSS4 Selectors')}}يضيف المعدل ل ASCII اختيار قيمة خاصية غير حساسة لحالة الأحرف
{{SpecName('CSS3 Selectors', '#attribute-selectors', 'attribute selectors')}}{{Spec2('CSS3 Selectors')}} 
{{SpecName('CSS2.1', 'selector.html#attribute-selectors', 'attribute selectors')}}{{Spec2('CSS2.1')}}التعريف الأولي
- -

توافق المتصفح

- - - -

{{Compat("css.selectors.attribute")}}

- -

See also

- -
    -
  • Selecting a single element: {{domxref("Document.querySelector()")}}, {{domxref("DocumentFragment.querySelector()")}}, or {{domxref("Element.querySelector()")}}
  • -
  • Selecting all matching elements: {{domxref("Document.querySelectorAll()")}}, {{domxref("DocumentFragment.querySelectorAll()")}}, or {{domxref("Element.querySelectorAll()")}}
  • -
  • The above methods are all implemented based on the {{domxref("ParentNode")}} mixin; see {{domxref("ParentNode.querySelector()")}} and {{domxref("ParentNode.querySelectorAll()")}}
  • -
diff --git a/files/ar/web/css/comments/index.html b/files/ar/web/css/comments/index.html deleted file mode 100644 index 8f7726f714..0000000000 --- a/files/ar/web/css/comments/index.html +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: التعليقات -slug: Web/CSS/Comments -tags: - - CSS - - تعليقات - - مرجع - - ملاحظات -translation_of: Web/CSS/Comments -original_slug: Web/CSS/التعليقات ---- -
{{CSSRef}}
- -

تعليقات CSS تستخدم من أجل إضافة جمل توضيحية وتنبيهات في الكود أو حتى لمنع المتصفح من تطبيق بعض الأكواد المكتوبة في ورقة الأنماط (ملف CSS)، هذه التعليقات لا تؤثر على تصميم الملفات نهائيًا.

- -

طريقة الكتابة

- -

يمكن كتابة التعليقات في أي مكان داخل ورقة الأنماط، سواء كانت بسطر واحد أو بعدة أسطر.

- -
/* تعليق */
- -

أمثلة

- -
/* تعليق بسطر واحد */
-
-/*
-تعليق
-يمكن
-كتابته
-بأكثر
-من
-سطر
-*/
-
-/* التعليق أدناه جعل الخواص المذكروة للعنصر
-   Span
-   دون تأثير */
-/*
-span {
-  color: blue;
-  font-size: 1.5em;
-}
-*/
-
- -

تنبيهات

- -

الرمز /* */ يستخدم في كلا الحالتين سطر واحد أو متعدد الأسطر، لا يوجد أي طريقة أخرى من أجل كتابة تعليقات داخل ورقة الأنماط، عندما تستخدم عنصر {{htmlelement("style")}} فيمكنك استخدام <!-- --> من أجل إخفاء أكواد CSS عن المتصفحات القديمة، رغم أن ذلك غير مستحسن، معظم المبرمجين يستخدمون صيغة /* */.

- -

لا يمكن كتابة التعليقات بشكل متداخل، بمعنى أن التعليقات ستبدأ عند كتابة /* وستغلق عند أول علامة */ تقابلها.

- -

الخصائص

- - - -

اقرأ أيضًا

- - - -

 

diff --git a/files/ar/web/css/css_animated_properties/index.html b/files/ar/web/css/css_animated_properties/index.html deleted file mode 100644 index 2af4826ad4..0000000000 --- a/files/ar/web/css/css_animated_properties/index.html +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: العناصر التي يمكن تحريكها باستخدام CSS Transitions -slug: Web/CSS/CSS_animated_properties -tags: - - CSS - - CSS3 - - تحريك - - ترانزشن - - سلاسة - - نعومة -translation_of: Web/CSS/CSS_animated_properties -original_slug: Web/CSS/العناصر_التي_يمكن_تحريكها_باستخدام_CSS_Transitions ---- -

{{CSSRef}}

- -

يمكن تحريك بعض عناصر CSS بشكل ناعم وسلس عندما تتغير قيم وخصائص العناصر، سواء باستخدام CSS Animations أو CSS Transitions.

- -

هذه قائمة بالعناصر التي يمكن استخدام خاصية Transitions عليها:

- -

{{CSSAnimatedProperties}}

diff --git a/files/ar/web/css/css_flexible_box_layout/basic_concepts_of_flexbox/index.html b/files/ar/web/css/css_flexible_box_layout/basic_concepts_of_flexbox/index.html deleted file mode 100644 index 5556baedd5..0000000000 --- a/files/ar/web/css/css_flexible_box_layout/basic_concepts_of_flexbox/index.html +++ /dev/null @@ -1,234 +0,0 @@ ---- -title: المفاهيم الأساسية للصندوق المرن -slug: Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox -translation_of: Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox -original_slug: Web/CSS/CSS_Flexible_Box_Layout/المفاهيم_الأساسية_للصندوق_المرن ---- -
{{CSSRef}}
- -

يشار لوحدة الصندوق المرن عادةً  بالflexbox وقد تم تصميمها كنموذج تخطيط احادي البعد. وكطريقة يمكنها ان تعرض توزيع المسافات بين العناصر في واجهة وقدرات محاذاة (ترتيب) قوية. تقدم هذه المقالة الخطوط العريضة للميزات الرئيسية لفلكس بوكس (flexbox)، والتي سنكتشف تفاصيلها في بقية هذه الارشادات.

- -

عندما نوصف الفلكس بوكس بأنه احادي البعد، نقوم بوصف الحقيقة ان الفلكس بوكس يتعامل مع المخطط في بعد واحد في ذات الوقت — إما كصف أو كعمود. وهذا يمكن أن يتناقض مع نموذج ثنائي الأبعاد الخاص بـتخطيط شبكة CSS Grid والذي يتحكم في الصفوف والاعمدة معاً.

- -

مِحوَريّ الفلكس بوكس

- -

عندما نشتغل بفلكس بوكس نحتاج للتفكير في محورين — المحور الاساشي او الرئيسي ومحور التقاطع (المتقاطع).
- يتم تعريف المحور الرئيسي بإستخدام الخاصية {{cssxref("flex-direction")}}
- ومن هناك يتم تعامد المحور المتقاطع بناءًا على المحور الرئيسي.
- لذا يجدر فهم كيفية عملها منذ البداية.

- -

المحور الرئيسي

- -

يتم تعريف المحور الرئيسي عن طريق flex-direction  ، والتي لديها اربع قيم ممكنة هي:

- -
    -
  • الصف row
  • -
  • الصف المعكوس row-reverse
  • -
  • العامود column
  • -
  • العامود المعكوس column-reverse
  • -
- -

هل تختار الصف او الصف المعكوس؟ سيشتغل المحور الاساسي في اتجاه مضمَن مع الصف.

- -

If flex-direction is set to row the main axis runs along the row in the inline direction.

- -

اختر العامود او العامود المعكوس وسيعمل المحور الاساسي من رأس الصفحة الى قاعها في اتجاه السد

- -

If flex-direction is set to column the main axis runs in the block direction.

- -

محور التقاطع

- -

يتعامد محور التقاطع على المحور الرئيسي الذي تم تعريفة مسبقا باستخدام flex-direction كصف row  او صف معكوس row-reverse  فيشغل دور الاعمدة.

- -

If flex-direction is set to row then the cross axis runs in the block direction.

- -

أما لو كان عامود column او عامود معكوس column-reverse  فيشغل محور التقاطع دور الصف.

- -

If flex-direction is set to column then the cross axis runs in the inline direction.

- -

من المهم فهم اي محور من الاخر عندما نبدأ في البحث عن الترتيب والاصطفاف لعانصر الفلكس، خصائص ميزات الفلكس بوكس التي ستقوم بإصطفافها وترتيب المحتوى على محور او الاخر.

- -

خطوط البداية والنهاية

- -

من النقاط المهمة للغاية أن نفهم كيف يقوم فلكس بوكس بعدم افتراض كيفية الكتابة في الوثيقة. ففي الماضي، كانت الCSS مثقولة الوزن نحو الكتابة الافقية و اسلوب كتابة اليسار الى اليمين. اما في المخططات الحديثة تشمل نطاق من اساليب الكتابة. فلهذا لم نعد نفرض ان بداية خط الكتابة سيكون في يسار اعلى الصفحة ويسري الى اليمين، بصفوف جديدة تظهر اسفل بعضها تلو الاخرى.

- -

يمكنك ان تقرأ اكثر عن العلاقة ما بين الفلكس بوكس وخصائص اساليب الكتابة في مقالة لاحقة. ومع ذلك، من المفروض ان يساعدك الوصف التالي بشرح السبب للماذا لا نتحدث عن تحديد يسار ويمين واعلى واسفل عندما نقوم بوصف اتجاه سير عناصر فلكس.

- -

اذا كان الصف هو اتجاه فلكس،  flex-direction: row ونعمل باستخدام اللغة الانجليزية.
- اذن ستكون حافة البداية للمحور الاساسي على اليسار ويقابلها على الجهة الاخرى علي اليمين حافة النهاية.

- -

Working in English the start edge is on the left.

- -

اما اذا كنا سنستخدم اللغة العربية، فستكون حافة البداية للمحور الاساسي على اليمين ويقابلها على الجهة الاخرى علي اليسار حافة النهاية.

- -

The start edge in a RTL language is on the right.

- -

وفي كلا الحالتين ستكون حافة البداية للمحور المتقاطع في الاعلى من حاوية الفلكس وحافة النهاية في اسفلها. وذلك لان اللغتين يسيرون في سياق افقي للكتابة.

- -

بعد فترة، التفكير في البداية والنهاية بدلا من الايمن والايسر سيصبح طبيعيا اكثر. وسيكون مفيدا عن التعامل مع وسائل التخطيط الاخرى مثل مخطط الشبكة CSS Grid Layout الذي يتبع النمط نفسه.

- -

حاوية فلكس

- -

An area of a document laid out using flexbox is called a flex container. To create a flex container, we set the value of the area's container's {{cssxref("display")}} property to flex or inline-flex. As soon as we do this the direct children of that container become flex items. As with all properties in CSS, some initial values are defined, so when creating a flex container all of the contained flex items will behave in the following way.

- -
    -
  • Items display in a row (the flex-direction property's default is row).
  • -
  • The items start from the start edge of the main axis.
  • -
  • The items do not stretch on the main dimension, but can shrink.
  • -
  • The items will stretch to fill the size of the cross axis.
  • -
  • The {{cssxref("flex-basis")}} property is set to auto.
  • -
  • The {{cssxref("flex-wrap")}} property is set to nowrap.
  • -
- -

The result of this is that your items will all line up in a row, using the size of the content as their size in the main axis. If there are more items than can fit in the container, they will not wrap but will instead overflow. If some items are taller than others, all items will stretch along the cross axis to fill its full size.

- -

You can see in the live example below how this looks. Try editing the items or adding additional items in order to test the initial behavior of flexbox.

- -

{{EmbedGHLiveSample("css-examples/flexbox/basics/the-flex-container.html", '100%', 480)}} 

- -

Changing flex-direction

- -

Adding the {{cssxref("flex-direction")}} property to the flex container allows us to change the direction in which our flex items display. Setting flex-direction: row-reverse will keep the items displaying along the row, however the start and end lines are switched.

- -

If we change flex-direction to column the main axis switches and our items now display in a column. Set column-reverse and the start and end lines are again switched.

- -

The live example below has flex-direction set to row-reverse. Try the other values — row, column and column-reverse — to see what happens to the content.

- -

{{EmbedGHLiveSample("css-examples/flexbox/basics/flex-direction.html", '100%', 350)}}

- -

Multi-line flex containers with flex-wrap

- -

While flexbox is a one dimensional model, it is possible to cause our flex items to wrap onto multiple lines. In doing so, you should consider each line as a new flex container. Any space distribution will happen across that line, without reference to the lines either side.

- -

To cause wrapping behaviour add the property {{cssxref("flex-wrap")}} with a value of wrap. Now, should your items be too large to all display in one line, they will wrap onto another line. The live sample below contains items that have been given a width, the total width of the items being too wide for the flex container. As flex-wrap is set to wrap, the items wrap. Set it to nowrap, which is also the initial value, and they will instead shrink to fit the container because they are using initial flexbox values that allows items to shrink. Using nowrap would cause an overflow if the items were not able to shrink, or could not shrink small enough to fit.

- -

{{EmbedGHLiveSample("css-examples/flexbox/basics/flex-wrap.html", '100%', 400)}}

- -

Find out more about wrapping flex items in the guide Mastering Wrapping of Flex Items.

- -

The flex-flow shorthand

- -

You can combine the two properties flex-direction and flex-wrap into the {{cssxref("flex-flow")}} shorthand. The first value specified is flex-direction and the second value is flex-wrap.

- -

In the live example below try changing the first value to one of the allowable values for flex-direction - row, row-reverse, column or column-reverse, and also change the second to wrap and nowrap.

- -

{{EmbedGHLiveSample("css-examples/flexbox/basics/flex-flow.html", '100%', 400)}}

- -

Properties applied to flex items

- -

To have more control over flex items we can target them directly. We do this by way of three properties:

- -
    -
  • {{cssxref("flex-grow")}}
  • -
  • {{cssxref("flex-shrink")}}
  • -
  • {{cssxref("flex-basis")}}
  • -
- -

We will take a brief look at these properties in this overview, and you can gain a fuller understanding in the guide Controlling Ratios of Flex Items on the Main Axis.

- -

Before we can make sense of these properties we need to consider the concept of available space. What we are doing when we change the value of these flex properties is to change the way that available space is distributed amongst our items. This concept of available space is also important when we come to look at aligning items.

- -

If we have three 100 pixel-wide items in a container which is 500 pixels wide, then the space we need to lay out our items is 300 pixels. This leaves 200 pixels of available space. If we don’t change the initial values then flexbox will put that space after the last item.

- -

This flex container has available space after laying out the items.

- -

If we instead would like the items to grow and fill the space, then we need to have a method of distributing the leftover space between the items. This is what the flex properties that we apply to the items themselves, will do.

- -

The flex-basis property

- -

The flex-basis is what defines the size of that item in terms of the space it leaves as available space. The initial value of this property is auto — in this case the browser looks to see if the items have a size. In the example above, all of the items have a width of 100 pixels and so this is used as the flex-basis.

- -

If the items don’t have a size then the content's size is used as the flex-basis. This is why when we just declare display: flex on the parent to create flex items, the items all move into a row and take only as much space as they need to display their contents.

- -

The flex-grow property

- -

With the flex-grow property set to a positive integer, flex items can grow along the main axis from their flex-basis. This will cause the item to stretch and take up any available space on that axis, or a proportion of the available space if other items are allowed to grow too.

- -

If we gave all of our items in the example above a flex-grow value of 1 then the available space in the flex container would be equally shared between our items and they would stretch to fill the container on the main axis.

- -

The flex-grow property can be used to distribute space in proportion. If we give our first item a flex-grow value of 2 and the other items a value of 1, 2 parts will be given to the first item (100px out of 200px in the case of the example above), 1 part each the other two (50px each out of the 200px total).

- -

The flex-shrink property

- -

Where the flex-grow property deals with adding space in the main axis, the flex-shrink property controls how it is taken away. If we do not have enough space in the container to lay out our items and flex-shrink is set to a positive integer the item can become smaller than the flex-basis. As with flex-grow different values can be assigned in order to cause one item to shrink faster than others — an item with a higher value set for flex-shrink will shrink faster than its siblings that have lower values.

- -

The minimum size of the item will be taken into account while working out the actual amount of shrinkage that will happen, which means that flex-shrink has the potential to appear less consistent than flex-grow in behavior. We’ll therefore take a more detailed look at how this algorithm works in the article Controlling Ratios of items along the main axis.

- -
-

Note that these values for flex-grow and flex-shrink are proportions. Typically if we had all of our items set to flex: 1 1 200px and then wanted one item to grow at twice the rate, we would set that item to flex: 2 1 200px. However you could use flex: 10 1 200px and flex: 20 1 200px if you wanted.

-
- -

Shorthand values for the flex properties

- -

You will very rarely see the flex-grow, flex-shrink, and flex-basis properties used individually; instead they are combined into the {{cssxref("flex")}} shorthand. The flex shorthand allows you to set the three values in this order — flex-grow, flex-shrink, flex-basis.

- -

The live example below allows you to test out the different values of the flex shorthand; remember that the first value is flex-grow. Giving this a positive value means the item can grow. The second is flex-shrink — with a positive value the items can shrink, but only if their total values overflow the main axis. The final value is flex-basis; this is the value the items are using as their base value to grow and shrink from.

- -

{{EmbedGHLiveSample("css-examples/flexbox/basics/flex-properties.html", '100%', 510)}}

- -

There are also some predefined shorthand values which cover most of the use cases. You will often see these used in tutorials, and in many cases these are all you will need to use. The predefined values are as follows:

- -
    -
  • flex: initial
  • -
  • flex: auto
  • -
  • flex: none
  • -
  • flex: <positive-number>
  • -
- -

Setting flex: initial resets the item to the initial values of Flexbox. This is the same as flex: 0 1 auto. In this case the value of flex-grow is 0, so items will not grow larger than their flex-basis size. The value of flex-shrink is 1, so items can shrink if they need to rather than overflowing. The value of flex-basis is auto. Items will either use any size set on the item in the main dimension, or they will get their size from the content size.

- -

Using flex: auto is the same as using flex: 1 1 auto; everything is as with flex:initial but in this case the items can grow and fill the container as well as shrink if required.

- -

Using flex: none will create fully inflexible flex items. It is as if you wrote flex: 0 0 auto. The items cannot grow or shrink but will be laid out using flexbox with a flex-basis of auto.

- -

The shorthand you often see in tutorials is flex: 1 or flex: 2 and so on. This is as if you used flex: 1 1 0. The items can grow and shrink from a flex-basis of 0.

- -

Try these shorthand values in the live example below.

- -

{{EmbedGHLiveSample("css-examples/flexbox/basics/flex-shorthands.html", '100%', 510)}}

- -

Alignment, justification and distribution of free space between items

- -

A key feature of flexbox is the ability to align and justify items on the main- and cross-axes, and to distribute space between flex items.

- -

align-items

- -

The {{cssxref("align-items")}} property will align the items on the cross axis.

- -

The initial value for this property is stretch and this is why flex items stretch to the height of the tallest one by default. They are in fact stretching to fill the flex container — the tallest item is defining the height of that.

- -

You could instead set align-items to flex-start in order to make the items line up at the start of the flex container, flex-end to align them to the end, or center to align them in the centre. Try this in the live example — I have given the flex container a height in order that you can see how the items can be moved around inside the container. See what happens if you set the value of align-items to:

- -
    -
  • stretch
  • -
  • flex-start
  • -
  • flex-end
  • -
  • center
  • -
- -

{{EmbedGHLiveSample("css-examples/flexbox/basics/align-items.html", '100%', 520)}}

- -

justify-content

- -

The {{cssxref("justify-content")}} property is used to align the items on the main axis, the direction in which flex-direction has set the flow. The initial value is flex-start which will line the items up at the start edge of the container, but you could also set the value to flex-end to line them up at the end, or center to line them up in the centre.

- -

You can also use the value space-between to take all the spare space after the items have been laid out, and share it out evenly between the items so there will be an equal amount of space between each item. To cause an equal amount of space on the right and left of each item use the value space-around. With space-around, items have a half-size space on either end. Or, to cause items to have equal space around them use the value space-evenly. With space-evenly, items have a full-size space on either end.

- -

Try the following values of justify-content in the live example:

- -
    -
  • flex-start
  • -
  • flex-end
  • -
  • center
  • -
  • space-around
  • -
  • space-between
  • -
  • space-evenly
  • -
- -

{{EmbedGHLiveSample("css-examples/flexbox/basics/justify-content.html", '100%', 380)}}

- -

In the article Aligning Items in a Flex Container we will explore these properties in more depth, in order to have a better understanding of how they work. These simple examples however will be useful in the majority of use cases.

- -

Next steps

- -

After reading this article you should have an understanding of the basic features of Flexbox. In the next article we will look at how this specification relates to other parts of CSS.

diff --git a/files/ar/web/css/css_flexible_box_layout/index.html b/files/ar/web/css/css_flexible_box_layout/index.html deleted file mode 100644 index 9cb25b5221..0000000000 --- a/files/ar/web/css/css_flexible_box_layout/index.html +++ /dev/null @@ -1,119 +0,0 @@ ---- -title: CSS Flexible Box Layout -slug: Web/CSS/CSS_Flexible_Box_Layout -tags: - - CSS - - CSS Flexible Boxes - - NeedsTranslation - - Overview - - Reference - - TopicStub - - flexbox -translation_of: Web/CSS/CSS_Flexible_Box_Layout ---- -
{{CSSRef}}
- -

CSS Flexible Box Layout is a module of CSS that defines a CSS box model optimized for user interface design, and the layout of items in one dimension. In the flex layout model, the children of a flex container can be laid out in any direction, and can “flex” their sizes, either growing to fill unused space or shrinking to avoid overflowing the parent. Both horizontal and vertical alignment of the children can be easily manipulated.

- -

Basic Example

- -

In the following example a container has been set to display: flex, which means that the three child items become flex items. The value of justify-content has been set to space-between in order to space the items out evenly on the main axis. An equal amount of space is placed between each item with the left and right items being flush with the edges of the flex container. You can also see that the items are stretching on the cross axis, due to the default value of align-items being stretch. The items stretch to the height of the flex container, making them each appear as tall as the tallest item.

- -

{{EmbedGHLiveSample("css-examples/flexbox/basics/simple-example.html", '100%', 500)}}

- -

Reference

- -

CSS Properties

- -
-
    -
  • {{cssxref("flex")}}
  • -
  • {{cssxref("flex-basis")}}
  • -
  • {{cssxref("flex-direction")}}
  • -
  • {{cssxref("flex-flow")}}
  • -
  • {{cssxref("flex-grow")}}
  • -
  • {{cssxref("flex-shrink")}}
  • -
  • {{cssxref("flex-wrap")}}
  • -
  • {{cssxref("order")}}
  • -
-
- -

Alignment Properties

- -

The properties align-content, align-self, align-items and justify-content initially appeared in the Flexbox specification, but are now defined in Box Alignment. The Flexbox spec now refers to the Box Alignment specification for up to date definitions. Also additional alignment properties are now defined in Box Alignment.

- -
-
    -
  • {{cssxref("justify-content")}}
  • -
  • {{cssxref("align-content")}}
  • -
  • {{cssxref("align-items")}}
  • -
  • {{cssxref("align-self")}}
  • -
  • {{cssxref("place-content")}}
  • -
  • {{cssxref("place-items")}}
  • -
  • {{cssxref("row-gap")}}
  • -
  • {{cssxref("column-gap")}}
  • -
  • {{cssxref("gap")}}
  • -
-
- -

Glossary entries

- -
-
    -
  • {{Glossary("Flexbox", "", 1)}}
  • -
  • {{Glossary("Flex Container", "", 1)}}
  • -
  • {{Glossary("Flex Item", "", 1)}}
  • -
  • {{Glossary("Main Axis", "", 1)}}
  • -
  • {{Glossary("Cross Axis", "", 1)}}
  • -
  • {{Glossary("Flex", "", 1)}}
  • -
-
- -

Guides

- -
-
Basic Concepts of Flexbox
-
An overview of the features of Flexbox
-
Relationship of Flexbox to other layout methods
-
How Flexbox relates to other layout methods, and other CSS specifications
-
Aligning items in a flex container
-
How the Box Alignment properties work with Flexbox.
-
Ordering flex items
-
Explaining the different ways to change the order and direction of items, and covering the potential issues in doing so.
-
Controlling Ratios of flex items along the main axis
-
Explaining the flex-grow, flex-shrink and flex-basis properties.
-
Mastering wrapping of flex items
-
How to create flex containers with multiple lines and control the display of the items in those lines.
-
Typical use cases of Flexbox
-
Common design patterns that are typical Flexbox use cases.
-
Backwards compatibility of Flexbox
-
Browser status of Flexbox, interoperability issues and supporting older browsers and versions of the spec
-
- -

Specifications

- - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{ SpecName('CSS3 Flexbox') }}{{ Spec2('CSS3 Flexbox') }}Initial definition.
- -

See also

- -
-
Flexbugs
-
a community-curated list of Flexbox browser bugs and workarounds
-
Cross-browser Flexbox mixins
-
This article provides a set of mixins for those who want to create cross-browser Flexbox experiences that even work in older browser that don't support the modern Flexbox syntax
-
diff --git a/files/ar/web/css/css_grid_layout/index.html b/files/ar/web/css/css_grid_layout/index.html deleted file mode 100644 index 5509e745fa..0000000000 --- a/files/ar/web/css/css_grid_layout/index.html +++ /dev/null @@ -1,253 +0,0 @@ ---- -title: CSS Grid Layout -slug: Web/CSS/CSS_Grid_Layout -tags: - - CSS - - Grid Layout - - Grids - - Layout - - NeedsTranslation - - Overview - - Reference - - TopicStub -translation_of: Web/CSS/CSS_Grid_Layout ---- -

CSS Grid Layout  أو شبكة تخطيط الصفحة هو مخطط لترتيب الصفحة و تصنيف العناصر الرئيسية أو الاختلافات من حيث الحجم أو الموضع أو الطبقة

- -

Like tables, grid layout enables an author to align elements into columns and rows. However, many more layouts are either possible or easier with CSS grid than they were with tables. For example, a grid container's child elements could position themselves so they actually overlap and layer, similar to CSS positioned elements.

- -

Basic example

- -

The example below shows a three-column track grid with new rows created at a minimum of 100 pixels and a maximum of auto. Items have been placed onto the grid using line-based placement.

- -
- - -

HTML

- -
<div class="wrapper">
-  <div class="one">One</div>
-  <div class="two">Two</div>
-  <div class="three">Three</div>
-  <div class="four">Four</div>
-  <div class="five">Five</div>
-  <div class="six">Six</div>
-</div>
- -

CSS

- -
.wrapper {
-  display: grid;
-  grid-template-columns: repeat(3, 1fr);
-  grid-gap: 10px;
-  grid-auto-rows: minmax(100px, auto);
-}
-.one {
-  grid-column: 1 / 3;
-  grid-row: 1;
-}
-.two {
-  grid-column: 2 / 4;
-  grid-row: 1 / 3;
-}
-.three {
-  grid-column: 1;
-  grid-row: 2 / 5;
-}
-.four {
-  grid-column: 3;
-  grid-row: 3;
-}
-.five {
-  grid-column: 2;
-  grid-row: 4;
-}
-.six {
-  grid-column: 3;
-  grid-row: 4;
-}
-
- -

{{ EmbedLiveSample('example', '500', '440') }}

-
- -

Reference

- -

CSS properties

- -
-
    -
  • {{cssxref("grid-template-columns")}}
  • -
  • {{cssxref("grid-template-rows")}}
  • -
  • {{cssxref("grid-template-areas")}}
  • -
  • {{cssxref("grid-template")}}
  • -
  • {{cssxref("grid-auto-columns")}}
  • -
  • {{cssxref("grid-auto-rows")}}
  • -
  • {{cssxref("grid-auto-flow")}}
  • -
  • {{cssxref("grid")}}
  • -
  • {{cssxref("grid-row-start")}}
  • -
  • {{cssxref("grid-column-start")}}
  • -
  • {{cssxref("grid-row-end")}}
  • -
  • {{cssxref("grid-column-end")}}
  • -
  • {{cssxref("grid-row")}}
  • -
  • {{cssxref("grid-column")}}
  • -
  • {{cssxref("grid-area")}}
  • -
  • {{cssxref("grid-row-gap")}}
  • -
  • {{cssxref("grid-column-gap")}}
  • -
  • {{cssxref("grid-gap")}}
  • -
-
- -

CSS functions

- -
-
    -
  • {{cssxref("repeat", "repeat()")}}
  • -
  • {{cssxref("minmax", "minmax()")}}
  • -
  • {{cssxref("fit-content", "fit-content()")}}
  • -
-
- -

CSS data types

- -
-
    -
  • {{cssxref("<flex>")}}
  • -
-
- -

Glossary entries

- - - -

Guides

- - - -

External resources

- - - -

Specifications

- - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{ SpecName('CSS3 Grid') }}{{ Spec2('CSS3 Grid') }}Initial definition.
- - diff --git a/files/ar/web/css/css_grid_layout/relationship_of_grid_layout/index.html b/files/ar/web/css/css_grid_layout/relationship_of_grid_layout/index.html deleted file mode 100644 index 04cd3b6370..0000000000 --- a/files/ar/web/css/css_grid_layout/relationship_of_grid_layout/index.html +++ /dev/null @@ -1,624 +0,0 @@ ---- -title: العلاقة بين التنسيق الشبكي وطرق التنسيق الأخرى -slug: Web/CSS/CSS_Grid_Layout/Relationship_of_Grid_Layout -translation_of: Web/CSS/CSS_Grid_Layout/Relationship_of_Grid_Layout -original_slug: Web/CSS/CSS_Grid_Layout/Relationship_of_Grid_Layout_arabic ---- -

صمم التنسيق الشبكي ليعمل جنبا إلى جنب مع جميع التنسيقات الأخرى مشكلا بذلك نظاما متكاملا لإنشاءها. في هذا الدليل سوف نشرح كيف يتوافق النظام الشبكي مع التقنيات الأخرى التي كنت قد استعملتها سابقا.

- -

نظام الشبكة ونظام الأجزاء المرنة

- -

إن الفرق الأساسي بين نظام التنسيق الشبكي ونظام نتسيق الأجزاء المرنة يثمثل في كون أن نظام نتسيق الأجزاء المرنة قد صمم للتنسيق على بعد واحد -أي أفقيا أو عموديا. بينما صمم نظام التنسيق الشبكي لإنشاء تنسيقات على بعدين -إي أفقيا وعموديا في نفس الوقت. إن نصوص المواصفات المعيارية لكلا النظامين يلتقيان في العديد من المميزات، لذلك فإن كنت قد تعلمت استعمال نظام الأجزاء المرنة، فإن هذا التشابه المتواجد بينهما سيمكنك من ضبط استعمال نظام الشبكة.

- -

النسق ذو بعد واحد مقارنة مع النسق ذو بعدين

- -

سنستعمل مثالا بسيطا لإظاهر الإختلاف المتواجد بين النسق ذو بعد واحد والنسق ذو بعدين.

- -

في هذا المثال الأول، سنستعمل نسق الأجزاء المرنة لتنسيق مجموعة من المربعات. حيث أتوفر على حاوية تضم خمسة أبناء من العناصر، وقد أعطيت خاصيات وقيم flex بيحث ستتمكن هذه العناصر من التمدد والتقلص انطلاقا من 200 بيكسل.

- -

وقمنا كذلك بإعطاء القيمة wrap للخاصية  {{cssxref("flex-wrap")}}،  مما ينتج عنه انتقال العناصر إلى سطر جديد في حالة إن كانت مساحة الحاوية غير كافية لضمان قيمة المرونة الأساسية.

- -
- - -
<div class="wrapper">
-  <div>One</div>
-  <div>Two</div>
-  <div>Three</div>
-  <div>Four</div>
-  <div>Five</div>
-</div>
-
- -
.wrapper {
-  display: flex;
-  flex-wrap: wrap;
-}
-.wrapper > div {
-  flex: 1 1 200px;
-}
-
-
- -

{{ EmbedLiveSample('onedtwod', '500', '230') }}

- -

في هذه الصورة، يمكننا ملاحظة انتقال (قفز) عنصرين إلى سطر جديد. حيث يتقاسمان نفس المساحة المتوفرة وأنهما غير منتظمين في نفس العمود مع العناصر المتواجدة بالإعلى. و يرجع ذلك إلى كون الأسطر ( أو الأعمدة في حالة استعمال الأعمدة) الجديدة المكونة من انتقال عناصر مرنة جديدة تصبح حاويات (أوعية) مرنة كذلك. ويحدث هذا التوزيع على طول السطر.

- -

وسؤال المطروح هو كيف يمكننا تنظيم هاته العناصر في نفس العمود. وهنا تأتي الحاجة إلى طريقة للتنسيق العناصر على بعدين: تريد ضبط توزيع العناصر من خلال أسطر وأعمدة، وهنا يبدأ دور التنسيق الشبكي.

- -

نفس التنسيق باستعمال نظام الشبكات

- -

في المثال الموالي، قمنا بانشاء نفس النسق باستعمال نظام الشبكة. حيث نتوفر حاليا على ثلاثة مسارات عمودية قياسها 1fr. مع العلم أننا لسنا بحاجة إلى إضافة أية خاصية على مستوى العناصر نفسها، حيث ستتوزع  هاته العناصر بشكل تلاقئ وسيتموضع كل عنصر داخل خلية من الشبكة التي أنشأنها. ويمكننا ملاحظة أن هاته العناصر موزعة (متراصة) في أسطر وأعمدة، بالإضافة إلى تواجد فجوة في نهاية السطر الثاني عند استعمالنا لخسمة عناصر.

- -
- - -
<div class="wrapper">
-  <div>One</div>
-  <div>Two</div>
-  <div>Three</div>
-  <div>Four</div>
-  <div>Five</div>
-</div>
-
- -
.wrapper {
-  display: grid;
-  grid-template-columns: repeat(3, 1fr);
-}
-
- -

{{ EmbedLiveSample('Two_Dimensional_With_Grid', '300', '170') }}

-
- -

من بين الأسئلة البسيطة التي يتوجب على كل مصمم طرحها عند محاولة الاختيار بين نظام الأجزاء المرنة و نظام الشبكة هي:

- -
    -
  • هل أريد فقط التحكم في التنسيق في اتجاه واحد، إما على مستوى سطر أو عمود ( أفقيا أو عموديا فقط) - لدى استعمل نظام الأجزاء المرنة.
  • -
  • هل أريد أن أتحكم في التنسيق في الإتجاهين معا، أي على مستوى سطر وعمود ( أفقيا وعموديا معا) - لدى استعمل نظام الشبكة.
  • -
- -

المحتوى الخارجي أو النسق الداخلي؟

- -

توجد طريقة أخرى لتحديد النظام المناسب الذي يجب عليك اختياره عند محاولتك الاختيار بين نظام الأجزاء المرنة و نظام الشبكة، بالإضافة إلى الطريقة التي تعرفنا عليها سابقا والمتمحورة حول الفرق بين العمل على بعد واحد أو بعدين.

- -

نظام الأجزاء المرنة Flexbox يعتمد على المحتوى الخارجي. من بين طرق الاستعمال لهذا النظام وهي عند توفرك على مجموعة من العناصر وتريد توزيعها على مساحة لحاوية بشكل متساوي. حيث أن حجم محتوى كل عنصر هو المحدد الأول للمساحة التي سيحتلها ( أي أن المساحة المحتلة متناسبة مع حجم محتوى العنصر). عند انتقال العناصر إلى سطر جديد فسنتظم نفسها بناء على مقاسها و المساحة المتوفرة في هذا السطر الجديد.

- -

يعتمد نظام الشبكة على التنسيق الداخلي. أي عندما نعمل بنظام الشبكة فإننا نقوم تعريف نسق مسبقا ونحدده ثم نقوم بوضع هذه العناصر داخل هذا النسق (أو الشبكة). ويمكن كذلك استعمال خاصيات التموضع الآلي التي تعمل على توزيع العناصر داخل الشبكة في خلايا محددة باتباع نظام الشبكة المحكمة. يمكن أيضا إنشاء مسارات مرنة تتكيف مع حجم المحتوى، هذه التقينة تجعل من حجم المسار يتغيير بالكامل. ( ملاحظة سيأخد المسار حجم العنصر الذي به محتوى أكبر).

- -

إن كنت تستعمل نظام Flex وشعرت بأنك تفقد شيئا من المرونة التي يفرها فهنالك احتمال كبير على أنك بحاجة لاستعمال نظام Grid. فعلى سبيل المثال إن قمت بتحديد قيمة مئوية لعرض أحد عناصر نظام Flex لكي يأخد نفس قياس العناصر المتواجدة في السطر الأعلى، في هذه الحالة فعليك استعمال نظام Grid. 

- -

المحاذات بين الأجزاء

- -

من بين الخاصيات الأكثر إثارة للكثير منا والتي تقدم بها نظام الأجزاء المرنة هي القدرة ولأول مرة على التحكم في توزيع العناصر والمحاذاة فيما بينها وبشكل واضح. حيث جعل من عملية وضع أي جزء في مركز أية صفحة سهلة للغاية. تتمدد العناصر المرنة لتأخد كل الحيز الموجود بالحاوية، مما يعني إمكانية الحصول على أعمدة متساوية الإرتفاع. حيت تعتبر هاته الأشياء المذكورة من الأمور التي كنا دائما نرغب في فعلها منذ وقت طويل، مما جعلنا نقوم بالبحث وخلق العديد من الحيل لإنشاء تأثير بصري على الأقل مشابه لذلك.

- -

لقد تمت إضافة خاصيات المحاذاة المتواجدة في نصوص المواصفات المعيارية لنظام الأجزاء المرنة إلى معيار جديد يسمى المحاذاة بين الأجزاء المستوى 3. مما يعني أنها سوف تستعمل في نصوص المواصفات المعيارية، من ضمنها نظام الشبكة. حيث من الممكن كذلك إدراجها في أنظمة التنسيق الأخرى.

- -

سوف نتطرق وبشكل واضح في دليل مقبل من هاته السلسلة إلى الكيفية التي تعمل بها خاصيات المحاذاة بين الأجزاء في نظام الشبكة. إليك مقارنة بسيطة بين نظام الأجزاء المرنة و نظام الشبكة.

- -

في المثال الأول والذي يستعمل نظام الأجزاء المرنة، نتوفر على حاوية (وعاء) بها ثلاثة عناصر. قمنا بتحديد ارتفاع هاته الحاوية المرنة من خلال إعطاء قيمة للخاصية {{cssxref("min-height")}} للفئة wrapper. ولكي نبدأ ترتيب العناصر داخل هاته الحاوية المرنة انطلاقا من النهاية قمنا بإعطاء القيمة flex-end للخاصية {{cssxref("align-items")}}. نريد كذلك إلغاء خاصية التمدد الإفتراضية للعنصر box1 وجعله يتمدد ليحتل كل ارتفاع هاته الحاوية بالإضافة لذلك قمنا بإعطاء القيمة stretch للخاصية {{cssxref("align-self")}} بالإضافة قمنا بإعطاء هاته الخاصية القيمة flex-start بالنسية للعنصر box2 لكي يقوم بوضع نفسه (يصطف) انطلاقا من نقطة بداية هاته الحاوية المرنة.

- - - -
<div class="wrapper">
-  <div class="box1">One</div>
-  <div class="box2">Two</div>
-  <div class="box3">Three</div>
-</div>
-
- -
.wrapper {
-  display: flex;
-  align-items: flex-end;
-  min-height: 200px;
-}
-.box1 {
-  align-self: stretch;
-}
-.box2 {
-  align-self: flex-start;
-}
-
- -

{{ EmbedLiveSample('Box_alignment', '300', '230') }}

- -

 المحاذاة في نظام الشبكات

- -

في هذا المثال الثاني استعملنا نظام الشبكة لإنشاء نفس التنسيق. حيث سنستعمل خاصيات محاذاة الأجزاء كما ثم تطبيقها في التنسق الشبكي. نقوم بمحاذاة باستعمال start و end عوضا عن flex-start  وflex-end. في حالة التنسيق الشبكي، يتم توزيع العناصر لتستقر في الحيز الشبكي الخاص بها في هاته الشبكة، والمتمثلة في خلية واحدة في هذا المثال، مع إمكانية تكونه من عدد كثير من الخلايا الشبكية.

- - - -
<div class="wrapper">
-  <div class="box1">One</div>
-  <div class="box2">Two</div>
-  <div class="box3">Three</div>
-</div>
-
- -
.wrapper {
-  display: grid;
-  grid-template-columns: repeat(3,1fr);
-  align-items: end;
-  grid-auto-rows: 200px;
-}
-.box1 {
-  align-self: stretch;
-}
-.box2 {
-  align-self: start;
-}
-
- -

{{ EmbedLiveSample('Alignment_in_CSS_Grids', '200', '310') }}

- -

الوحدة fr و flex-basis

- -

لقد قمنا بالتعرف على الكيفية التي تقوم بها الوحدة fr لتحديد نسبة من المساحة المتوفرللمسارات الشبكية لشبكة حاوية. عند المزج بين الوحدة fr و بين الدالة {{cssxref("minmax", "minmax()")}} فإننا نحصل على نتيجة ( سلوك) مشابهة لخاصيات flex التي يمنحها نظام تنسيق الأجزاء المرنة مع منحنا إمكاينة إنشاء نسق ذو بعدين.

- -

إن قمنا بالرجوع إلى المثل السابق الذي بينا فيه الفرق بين التنسيق ذو البعد الواحد والتنسيق ذو البعدين، فإننا سنلاحظ الفرق في كفية استجابة بالنسبة لكل منهما. فبالنسبة للتنسيق المرن، وفي حالة تحريك نافذة المتصفح لتوسيع أو تضييق حجمها، فإن نظام الأجزاء المرنة يقوم بعمل جيد في نتظيم عدد العناصر المكونة لكل سطر بناء على المساحة المتوفر. فإن كنا نتوفر على مساحة كبيرة فإن جميع العناصر الخمسة ستجد مكانها في سطر واحد، أما إن كنا نتوفر على حاوية جد صغير فمن الممكن أن نجد أن هاته المساحة تتسع لعنصر واحد فقط.

- -

وبالمقارنة، فإن النسخة المبنية باستعمال النظام الشبكي تتكون دائما من ثلاثة مسارات عمودية. حيث تقوم هاته المسارات بالتمدد والتقلص، وستظهر لنا ثلاث مسارات عمودية دائما، لأننا قمنا بتحديدها منذ البداية عند تعريفنا لهاته الشبكة.

- -

الملأ الآلي لمسارات الشبكة

- -

يمكننا إنشاء تأثير مشابه لنظام الأجزاء المرنة، مع إمكانية المحافظة على تموضع المحتوى بإحكام في أسطر وأعمدة، وذلك باستعمال الدالة repeat و الخاصيتين auto-fill و auto-fit لإنشاء مجموع هاته المسارات.

- -

في المثال التالي، استعملت الخاصية auto-fill عوضا عن القيم الرقيمة داخل الدالة repeat و تحديد قيمة 200 بيكسل لمجموع هاته المسارات. أي أن هاته الشبكة سوف تعمل على إنشاء العدد الكافي من أعمدة المسارات لتتناسب مع حجم الحاوية.

- - - -
<div class="wrapper">
-  <div>One</div>
-  <div>Two</div>
-  <div>Three</div>
-</div>
-
- -
.wrapper {
-  display: grid;
-  grid-template-columns: repeat(auto-fill, 200px);
-}
-
- -

{{ EmbedLiveSample('Auto-filling_grid_tracks', '500', '170') }}

- -

عدد المسارات المرنة

- -

يختلف الوضع هنا بالنسبة لنظام الأجزاء المرنة. في المثال الخاص بنظام الأجزاء المرنة،  تنتقل العناصر إلى السطر الموالي عندما تتجاوز 200 بيكسل. ويمكننا الوصول إلى نفس النتيجة بنظام الشبكة باستعمال  auto-fill والدالة {{cssxref("minmax", "minmax()")}}. وفي المثال الموالي، قمت بإنشاء مسارات آلية الملأ باستعمال الدالة minmax. أريد من المسارات أن تأخذ عرضا لا يقل عن 200 بيكسل، وحددت الحد الأقصى في 1fr. بمجرد أن يقوم المتصفح بحساب عدد المرات المرات الكافية لملأ الحاوية بمسارات ذات قياس 200 بيكسل - مع الأخد بعين الإعتبار قياس الفجوات المتواجدة بين مسارات الشبكة- فإنه يقوم بالتعامل مع المساحة القصوية 1fr كوحدة لتوزيعها بين جميع العناصر المتبيقة.

- - - -
<div class="wrapper">
-  <div>One</div>
-  <div>Two</div>
-  <div>Three</div>
-</div>
-
- -
.wrapper {
-  display: grid;
-  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
-}
-
- -

{{ EmbedLiveSample('A_flexible_number_of_tracks', '500', '170') }}

- -

لقد أصبحنا الآن قادرين على إنشاء شبكة مكونة من عدد مرن من المسارات المرنة كذلك، في ظل إمكانية أن تتوزع هذه العناصر وفي نفس الوقت على مستوى أسطر وأعمدة.

- -

Grid and absolutely positioned elements

- -

Grid interacts with absolutely positioned elements, which can be useful if you want to position an item inside a grid or grid area. The specification defines the behavior when a grid container is a containing block and a parent of the absolutely positioned item.

- -

A grid container as containing block

- -

To make the grid container a containing block you need to add the position property to the container with a value of relative, just as you would make a containing block for any other absolutely positioned items. Once you have done this, if you give a grid item position: absolute it will take as its containing block the grid container or, if the item also has a grid position, the area of the grid it is placed into.

- -

In the below example I have a wrapper containing four child items. Item three is absolutely positioned and also placed on the grid using line-based placement. The grid container has position: relative and so becomes the positioning context of this item.

- - - -
<div class="wrapper">
-  <div class="box1">One</div>
-  <div class="box2">Two</div>
-  <div class="box3">
-   This block is absolutely positioned. In this example the grid container is the containing block and so the absolute positioning offset values are calculated in from the outer edges of the area it has been placed into.
-  </div>
-  <div class="box4">Four</div>
-</div>
-
- -
.wrapper {
-  display: grid;
-  grid-template-columns: repeat(4,1fr);
-  grid-auto-rows: 200px;
-  grid-gap: 20px;
-  position: relative;
-}
-.box3 {
-  grid-column-start: 2;
-  grid-column-end: 4;
-  grid-row-start: 1;
-  grid-row-end: 3;
-  position: absolute;
-  top: 40px;
-  left: 40px;
-}
-
- -

{{ EmbedLiveSample('A_grid_container_as_containing_block', '500', '330') }}

- -

You can see that the item is taking the area from grid row line 2 to 4, and starting after line 1. Then it is offset in that area using the top and left properties. However, it has been taken out of flow as is usually for absolutely positioned items and so the auto-placement rules now place items into the same space. The item also doesn’t cause the additional row to be created to span to row line 3.

- -

If we remove position: absolute from the rules for .box3 you can see how it would display without the positioning.

- -

A grid container as parent

- -

If the absolutely positioned child has a grid container as a parent but that container does not create a new positioning context, then it is taken out of flow as in the previous example. The positioning context will be whatever element creates a positioning context as is common to other layout methods. In our case, if we remove position: relative from the wrapper above, positioning context is from the viewport, as shown in this image.

- -

Image of grid container as parent

- -

Once again the item no longer participates in the grid layout in terms of sizing or when other items are auto-placed.

- -

With a grid area as the parent

- -

If the absolutely positioned item is nested inside a grid area then you can create a positioning context on that area. In the below example we have our grid as before but this time I have nested an item inside .box3 of the grid.

- -

I have given .box3 position relative and then positioned the sub-item with the offset properties. In this case, the positioning context is the grid area.

- - - -
<div class="wrapper">
-  <div class="box1">One</div>
-  <div class="box2">Two</div>
-  <div class="box3">Three
-    <div class="abspos">
-     This block is absolutely positioned. In this example the grid area is the containing block and so the absolute positioning offset values are calculated in from the outer edges of the grid area.
-    </div>
-  </div>
-  <div class="box4">Four</div>
-</div>
-
- -
.wrapper {
-  display: grid;
-  grid-template-columns: repeat(4,1fr);
-  grid-auto-rows: 200px;
-  grid-gap: 20px;
-}
-.box3 {
-  grid-column-start: 2;
-  grid-column-end: 4;
-  grid-row-start: 1;
-  grid-row-end: 3;
-  position: relative;
-}
-.abspos {
-  position: absolute;
-  top: 40px;
-  left: 40px;
-  background-color: rgba(255,255,255,.5);
-  border: 1px solid rgba(0,0,0,0.5);
-  color: #000;
-  padding: 10px;
-}
-
- -

{{ EmbedLiveSample('With_a_grid_area_as_the_parent', '500', '420') }}

- -

Grid and display: contents

- -

A final interaction with another layout specification that is worth noting is the interaction between CSS Grid Layout and display: contents. The contents value of the display property is a new value that is described in the Display specification as follows:

- -
-

“The element itself does not generate any boxes, but its children and pseudo-elements still generate boxes as normal. For the purposes of box generation and layout, the element must be treated as if it had been replaced with its children and pseudo-elements in the document tree.”

-
- -

If you set an item to display: contents the box it would normally create disappears, and the boxes of the child elements appear as if they have risen up a level. This means that children of a grid item can become grid items. Sound odd? Here is a simple example. In the following markup, I have a grid and the first item on the grid is set to span all three column tracks. It contains three nested items. As these items are not direct children, they don’t become part of the grid layout and so display using regular block layout.

- -
- - -
<div class="wrapper">
-  <div class="box box1">
-    <div class="nested">a</div>
-    <div class="nested">b</div>
-    <div class="nested">c</div>
-  </div>
-  <div class="box box2">Two</div>
-  <div class="box box3">Three</div>
-  <div class="box box4">Four</div>
-  <div class="box box5">Five</div>
-</div>
-
- -
.wrapper {
-  display: grid;
-  grid-template-columns: repeat(3, 1fr);
-  grid-auto-rows: minmax(100px, auto);
-}
-.box1 {
-  grid-column-start: 1;
-  grid-column-end: 4;
-}
-
-
- -

{{ EmbedLiveSample('Display_Contents_Before', '400', '420') }}

-
- -

If I now add display: contents to the rules for box1, the box for that item vanishes and the sub-items now become grid items and lay themselves out using the auto-placement rules.

- -
- - -
<div class="wrapper">
-  <div class="box box1">
-    <div class="nested">a</div>
-    <div class="nested">b</div>
-    <div class="nested">c</div>
-  </div>
-  <div class="box box2">Two</div>
-  <div class="box box3">Three</div>
-  <div class="box box4">Four</div>
-  <div class="box box5">Five</div>
-</div>
-
- -
.wrapper {
-  display: grid;
-  grid-template-columns: repeat(3, 1fr);
-  grid-auto-rows: minmax(100px, auto);
-}
-.box1 {
-  grid-column-start: 1;
-  grid-column-end: 4;
-  display: contents;
-}
-
- -

{{ EmbedLiveSample('Display_Contents_After', '400', '330') }}

-
- -

This can be a way to get items nested into the grid to act as if they are part of the grid, and is a way around some of the issues that would be solved by subgrids once they are implemented. You can also use display: contents in a similar way with flexbox to enable nested items to become flex items.

- -

As you can see from this guide, CSS Grid Layout is just one part of your toolkit. Don’t be afraid to mix it with other methods of doing layout, to get the different effects you need.

- - diff --git a/files/ar/web/css/css_writing_modes/index.html b/files/ar/web/css/css_writing_modes/index.html deleted file mode 100644 index 7bfa9822b4..0000000000 --- a/files/ar/web/css/css_writing_modes/index.html +++ /dev/null @@ -1,106 +0,0 @@ ---- -title: CSS Writing Modes -slug: Web/CSS/CSS_Writing_Modes -translation_of: Web/CSS/CSS_Writing_Modes ---- -
{{CSSRef}}
- -

نمط الكتابة بالـ CSS هو ميزة تحدد طرق كتابة عالمية متعددة، مثل من اليسار الى اليمين (مثال: اللغات المعتمدة على السركبتات اللاتينية و الهندية)، من اليمين الى اليسار (مثال: اللغة العربية و العبرية)، متعددة الاتجاه ( تستخدم عند المزج بين اللغات التي تستخدم الاتجاه من اليمين الي اليسار و من اليسار الى اليمين معاً) و اللغات التي تاخد اتجاه افقي (مثل بعض اللغات الاسيوية).

- -

Reference

- -

Properties

- -
-
    -
  • {{cssxref("direction")}}
  • -
  • {{cssxref("glyph-orientation-horizontal")}}
  • -
  • {{cssxref("text-combine-upright")}}
  • -
  • {{cssxref("text-orientation")}}
  • -
  • {{cssxref("unicode-bidi")}}
  • -
  • {{cssxref("writing-mode")}}
  • -
-
- -

Guides

- -

None.

- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('CSS3 Writing Modes')}}{{Spec2('CSS3 Writing Modes')}} 
{{SpecName('CSS2.1', 'text.html')}}{{Spec2('CSS2.1')}} 
{{SpecName('CSS1')}}{{Spec2('CSS1')}}Initial definition
- -

Browser compatibility

- -

{{CompatibilityTable}}

- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support1.0{{CompatGeckoDesktop(1.0)}}33.51.0 (85)
-
- -
- - - - - - - - - - - - - - - - - - - -
FeatureAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}1.0 (85)
-
diff --git a/files/ar/web/css/index.html b/files/ar/web/css/index.html deleted file mode 100644 index 34e33dcf4f..0000000000 --- a/files/ar/web/css/index.html +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: صفحات الأنماط الانسيابية -slug: Web/CSS -tags: - - CSS - - صفحات الأنماط الانسيابية - - صفحة هبوط - - مرجع -translation_of: Web/CSS ---- -

صفحات الأنماط الانسيابية (CSS) هي لغة أنماط تستخدم لوصف طريقة عرض الوثيقة المكتوبة بلغة ترميز النص الفائق أو بلغة الترميز القابلة للإمتداد (بالإضافة إلى نكهاتها). تصف هذه التقنيّة كيف يجب على العناصر أن تظهر على الشاشة، الورقة، الكلام، أو على الوسائط الأخرى.

- -

صفحات الأنماط الانسيابية هي أحد اللغات الأساسيّة للويب المفتوح، وهي لغة قياسيّة في جميع المتصفحات بناءً على معايير W3C. طوِّرت هذه اللغة في عدة إصدارا، الأول الآن مهجور، الثاني (2.1) موصى به، و الثالث، هو الآن منقسم إلى عدة وحدات، وهذا الإصدار على طريقه لصبح قياسياً في جميع المتصفحات.

- -
-
    -
  • مقدمة عن صفحات الأنماط الانسيابية - -

    إن كنت جديداً على تطوير الويب، فاحرص أن تقرأ مقالة أساسيات اللغة لتتعرف على ماهيَّة هذه اللغة وكيف يمكنك استخدامها.

    -
  • -
  • دورات عن صفحات الأنماط الانسيابية -

    يحتوي قسم تعلم هذه اللغة على ثروة من الدورات التي تأخذك من الصفر إلى الإحتراف، مغطيةً جميع الأساسيات.

    -
  • -
  • مرجع صفحات الأنماط الانسيابية -

    يصف مرجع اللغة الشامل لمطورين الويب المخضرمين كل خاصيّة ومفهوم في هذه اللغة.

    -
  • -
- -
-
-

دورات

- -

يمتاز قسم تعلم صفحات الأنماط الانسيابية بوحدات متعددة تُدرِس هذه التقنيّة من الألف إلى الياء، ولا يتطلب معرفة مسبقة.

- -
-
مقدمة في صفحات الأنماط الانسيابية
-
تبدأ هذه الوحدة معك بأساسيات عمل هذه التقنيّة، متضمنةً معلومات عن المحددات (selectors) الخواص (properties)، كتابة التعليمات، تطبيق التنسيقات المجراة على صفحة لغة ترميز النص الفائق، كيفيّة تحديد الطول واللون وأمور أخرى، التتالي (cascade)، الوراثة (inheritance)، أساسيات نموذج الصندوق (box model)، والتنقيح (debugging).
-
تنسيق النصوص
-
تحتوي هذه المقالة على شرح لأساسيات تنسيق النصوص. تتضمن المقالة أيضاً إعداد الخطوط الغامقة والمائلة، المسافات بين الحروف والسطور، الظلال، وغيرها من خواص النصوص. ننهي المقالة بشرح كيفيّة إضافة خطوط مخصصة لصفحتك، وتنسيق القوائم والروابط.
-
صناديق التصميم
-
سنأخذ في هذه الوحدة نظرة على صناديق التصميم (styling boxes)، والتي تعد واحدة من الخطوات الأساسيّة نحو تنظيم صفحة الويب. في هذه المقالة سنلخص نموذج الصندوق (box model)، وبعدها سنأخذ نظرة حول التحكم بنماذج الصندوق عن طريق إعداد الحشو (margin)، الحواف (border) الهوامش (padding)، وإعداد لون خلفية مخصصة، والصور وغيرها من الميزات. كما تشرح المقالة ميزات زخرفيّة، مثل استخدام الظلال (shadows) والمرشحات (filters) على الصناديق.
-
النماذج
-
في هذه المرحلة سنكون قد أخذنا نظرة حول أساسيات صفحات الأنماط الانسيابية، بدءً من كيفيّة تنسيق النصوص، إلى تنسيق والتلاعب بالصناديق التي يوجد بها محتواك. الآن حان الوقت لأخذ نظرة حول كيفيّة وضع صناديقك في المكان المناسب. قد غطينا في هذه المقالة المتطلبات الضروريّة اللازمة حتّى تتمكن من الغوص في عالم النمذجة (layout)، وتتمكن من تعلم إعدادات العرض المختلفة، وطرق النمذجة التقليديّة والتي تنطوي على التعويم (float)، التعيين (positioning)، وأدوات التخطيط الجديدة مثل الصندوق المرن (flexbox).
-
-
- -
-

مراجع

- - - -

أدوات تطوير

- - - -

علل

- -
    -
  • : {{bug(1323667)}}
  • -
-
-
-
- -

انظر أيضاً

- - diff --git a/files/ar/web/css/order/index.html b/files/ar/web/css/order/index.html deleted file mode 100644 index 6bf2e5fd83..0000000000 --- a/files/ar/web/css/order/index.html +++ /dev/null @@ -1,108 +0,0 @@ ---- -title: order -slug: Web/CSS/order -translation_of: Web/CSS/order ---- -
{{CSSRef}}
- -

order عبارة عن خاصية CSS تضع الترتيب كقالب مرن او شبكة. العناصر في القالب تخزن بشكل تصاعدي القيمة و من ثم حسب ترتيب الكود المصدري.

- -
{{EmbedInteractiveExample("pages/css/order.html")}}
- - - -

النحو

- -
/* <integer> values */
-order: 5;
-order: -5;
-
-/* Global values */
-order: inherit;
-order: initial;
-order: unset;
- -
-

Note: order is only meant to affect the visual order of elements and not their logical or tab order. order must not be used on non-visual media such as speech.

-
- -

القيم

- -
-
{{cssxref("<integer>")}}
-
تمثل المجموعة المرتبة ليستخدمه العنصر
-
- -

الصيغة النحوية

- -{{csssyntax}} - -

مثال

- -

هنا مثال اساسي ل html chunk:

- -
<header>...</header>
-<main>
-  <article>Article</article>
-  <nav>Nav</nav>
-  <aside>Aside</aside>
-</main>
-<footer>...</footer>
-
- -

كود الcss التالي ينشأ زوجي sidebar كلاسيكي  الشكل  محيط بمحتوى الblock.نموذج تصميم الصندوق المرن يشكل blocks متساوي الحجم بشكل عمودي و يستخدم مساحة افقية حسب الامكانية.

- -
main { display: flex;  text-align:center; }
-main > article { flex:1;        order: 2; }
-main > nav     { width: 200px;  order: 1; }
-main > aside   { width: 200px;  order: 3; }
- -

النتيجة

- -

{{ EmbedLiveSample('Example') }}

- -

هواجز الوصول

- -

استخدام خاصية الorder سينشأ فصل اتصال بين العرض المرئي للمحتوى  و ترتيب ال DOM. هذا سيؤثر عكسيا على تجربة المستخدمين ذي الرؤية المنخفضة للتصفح مع مساعدة التقنيات المساعدة مثل قارئ الشاشة. اذا كان ترتيب ال(CSS) المرئي مهم, اذاً لن يكون لمستخدمي قارئ الشاشة وصصول لقراءة الترتيب الصحيح.

- - - -

مواصفات

- - - - - - - - - - - - - - - - -
المواصفةالحالةالتعليق
{{SpecName('CSS3 Flexbox', '#order-property', 'order')}}{{Spec2('CSS3 Flexbox')}}Initial definition
- -

{{cssinfo}}

- -

ملائمة المتصفح

- - - -

{{Compat("css.properties.order")}}

- -

انظر ايضا

- - diff --git a/files/ar/web/css/pointer-events/index.html b/files/ar/web/css/pointer-events/index.html deleted file mode 100644 index 7974b501d6..0000000000 --- a/files/ar/web/css/pointer-events/index.html +++ /dev/null @@ -1,148 +0,0 @@ ---- -title: pointer-events -slug: Web/CSS/pointer-events -translation_of: Web/CSS/pointer-events ---- -
{{CSSRef}}
- -

و CSS مجموعات الممتلكات تحت أي ظرف من الظروف (إن وجدت) لعنصر رسومي معين يمكن أن تصبح الهدف من الأحداث المؤشر. pointer-events

- -
{{EmbedInteractiveExample("pages/css/pointer-events.html")}}
- - - - -

عندما تكون هذه الخاصية غير محددة ، visiblePaintedتنطبق نفس خصائص القيمة على محتوى SVG.

- -

بالإضافة إلى الإشارة إلى أن العنصر ليس هدفًا لأحداث المؤشر ، noneترشد القيمة حدث المؤشر إلى "استعراض" العنصر والهدف مهما كان "أسفل" هذا العنصر بدلاً من ذلك.

- -

بناء الجملة

- -
/ * قيم الكلمات الرئيسية * /
-أحداث مؤشر: السيارات.
-أحداث المؤشر: لا شيء ؛
-أحداث المؤشر: visualPainted؛ / * SVG فقط * /
-أحداث المؤشر: visualFill؛ / * SVG فقط * /
-أحداث المؤشر: visualStroke؛ / * SVG فقط * /
-أحداث مؤشر: مرئية. / * SVG فقط * /
-أحداث المؤشر: رسمت. / * SVG فقط * /
-أحداث المؤشر: ملء ؛ / * SVG فقط * /
-أحداث مؤشر: السكتة الدماغية. / * SVG فقط * /
-أحداث المؤشر: جميع ؛ / * SVG فقط * /
-
-/ * القيم العالمية * /
-أحداث المؤشر: ترث.
-أحداث المؤشر: الأولي ؛
-أحداث المؤشر: unset؛
-
- -

و pointer-eventsيتم تحديد الممتلكات، كلمة رئيسية واحدة اختياره من قائمة القيم أدناه.

- -

القيم

- -
-
auto
-
يتصرف العنصر كما لو pointer-eventsلم يتم تحديد الخاصية. في محتوى SVG ، يكون لهذه القيمة والقيمة visiblePaintedنفس التأثير.
-
none
-
العنصر ليس هدفًا لأحداث المؤشر ؛ ومع ذلك ، قد تستهدف أحداث المؤشر عناصره التنازلي إذا كانت تلك النزول قد عيّنت pointer-eventsبعض القيمة الأخرى. في هذه الظروف ، ستؤدي أحداث المؤشر إلى تشغيل مستمعي الأحداث على هذا العنصر الرئيسي كما هو مناسب في طريقهم إلى / من السليل أثناء مراحل التقاط / فقاعة الحدث .
-
- -

SVG فقط

- -
-
visiblePainted
-
SVG فقط. يمكن أن يكون العنصر هو هدف حدث المؤشر فقط عند visibilityتعيين الخاصية على visibleسبيل المثال عندما يكون مؤشر الماوس فوق الجزء الداخلي (أي ، "تعبئة") للعنصر وتعيين fillالخاصية على قيمة أخرى بخلاف none، أو عندما مؤشر الماوس فوق المحيط (أي ، "حد") للعنصر strokeويتم ضبط الخاصية على قيمة أخرى غير none.
-
visibleFill
-
SVG فقط. يمكن أن يكون العنصر هو هدف حدث المؤشر فقط عندما visibilityيتم تعيين الخاصية إلى visibleوعندما على سبيل المثال ، يكون مؤشر الماوس فوق الجزء الداخلي (أي ، تعبئة) العنصر. fillلا تؤثر قيمة الخاصية على معالجة الحدث.
-
visibleStroke
-
SVG فقط. يمكن أن يكون العنصر هو هدف حدث المؤشر فقط عند visibilityتعيين الخاصية على visibleسبيل المثال عندما يكون مؤشر الماوس فوق محيط العنصر (أي الحد). strokeلا تؤثر قيمة الخاصية على معالجة الحدث.
-
visible
-
SVG فقط. يمكن أن يكون العنصر هو هدف حدث المؤشر عند visibilityتعيين الخاصية على visibleسبيل المثال ، يكون مؤشر الماوس على الجانب الداخلي (أي ، الحشو) أو المحيط (أي الحد) للعنصر. قيم fillو strokeلا تؤثر على معالجة الحدث.
-
painted
-
SVG فقط. يمكن أن يكون العنصر هو الهدف لحدث المؤشر فقط عندما يكون مؤشر الماوس فوق المنطقة الداخلية (على سبيل المثال ، "تعبئة") fillويتم ضبط الخاصية على قيمة أخرى بخلاف noneأو عندما يكون مؤشر الماوس فوق المحيط (أي ، "حد") للعنصر strokeوالممتلكات يتم تعيينها على قيمة غير none. visibilityلا تؤثر قيمة الخاصية على معالجة الحدث.
-
fill
-
SVG فقط. يمكن أن يكون العنصر هو هدف حدث المؤشر فقط عندما يكون المؤشر فوق الجزء الداخلي (أي ، تعبئة) العنصر. قيم fillو visibilityخصائص لا تؤثر معالجة الحدث.
-
stroke
-
SVG فقط. يمكن أن يكون العنصر هو هدف حدث المؤشر فقط عندما يكون المؤشر فوق محيط العنصر (أي الحد). قيم strokeو visibilityخصائص لا تؤثر معالجة الحدث.
-
all
-
SVG فقط. يمكن أن يكون العنصر هو هدف حدث المؤشر فقط عندما يكون المؤشر فوق الجزء الداخلي (أي ، التعبئة) أو المحيط (أي الحد) للعنصر. قيم fill، strokeو visibilityخصائص لا تؤثر معالجة الحدث.
-
- -

بناء الجملة الرسمي

- -
{{csssyntax}}
- -

أمثلة

- -

مثال أساسي

- -

يعطل هذا المثال أحداث المؤشر (النقر والسحب والتحويم وما إلى ذلك) على جميع الصور.

- -
img
-  أحداث المؤشر: لا شيء ؛
-}
- -

تعطيل الروابط

- -

يعطل هذا المثال أحداث المؤشر على الرابط إلى http://example.com.

- -
<UL>
-  <li> <a href="https://developer.mozilla.org"> MDN </a> </li>
-  <li> <a href="http://example.com"> example.com </a> </li>
-</ UL>
- -
a [href = "http://example.com"] {
-  أحداث المؤشر: لا شيء ؛
-}
- -
{{EmbedLiveSample("Disabling_links", "500", "100")}}
- -

ملاحظات

- -

لاحظ أن منع عنصر من كونها هدفا للأحداث المؤشر باستخدام pointer-eventsلا لا يعني بالضرورة أن المستمعين الحدث المؤشر على هذا العنصر لا يمكن أو لا يمكن تشغيلها. إذا كان أحد أطفال العنصر قد pointer-eventsحدد صراحة للسماح لهذا الطفل بأن يكون هدفًا لأحداث المؤشر ، فإن أي أحداث تستهدف هذا الطفل تمر عبر الوالد أثناء انتقال الحدث على طول سلسلة الوالدين ، وتحفيز مستمعي الحدث على الوالد كما هو مناسب. . بالطبع لن يتم القبض على أي نشاط مؤشر في نقطة على الشاشة يغطيه الوالد ولكن ليس من قِبل الطفل من قِبل الطفل أو الوالد (سوف يمر "الوالد" ويستهدف كل ما هو تحتها).

- -

pointer-events: noneستظل العناصر التي تحتوي على التركيز من خلال التنقل المتسلسل للوحة المفاتيح باستخدام Tabالمفتاح.

- -

نود أن نوفر تحكمًا محببًا دقيقًا (أكثر من مجرد autoو none) في HTML لأي أجزاء من العنصر ستؤدي إلى "التقاط" أحداث المؤشر ومتى. لمساعدتنا في تحديد الكيفية التي pointer-eventsينبغي بها تمديد HTML ، إذا كان لديك أي أشياء معينة ترغب في القيام بها مع هذه الخاصية ، يرجى إضافتها إلى قسم حالات الاستخدام في صفحة الويكي هذه (لا تقلق حول ابقائها مرتبة).

- -

مواصفات

- - - - - - - - - - - - - - - - - - - - - -
تخصيصالحالةتعليق
{{SpecName('SVG2', 'interact.html#PointerEventsProperty', 'pointer-events')}}{{Spec2 ( 'SVG2')}}
{{SpecName('SVG1.1', 'interact.html#PointerEventsProperty', 'pointer-events')}}{{Spec2 ( 'SVG1.1')}}التعريف الأولي
- -

{{cssinfo}}

- -

امتداده إلى عناصر HTML ، على الرغم من وجوده في المسودات المبكرة من CSS Basic User Interface Module المستوى 3 ، فقد تم دفعه إلى المستوى 4 .

- -

التوافق المتصفح

- - - -

{{Compat("css.properties.pointer-events")}}

- -

أنظر أيضا

- -
    -
  • سمة SVG {{SVGAttr ("pointer-events")}}
  • -
  • سمة SVG {{SVGAttr ("visibility")}}
  • -
  • توسيع WebKit Specs PointerEventsProperty للاستخدام في محتوى HTML (X)
  • -
diff --git a/files/ar/web/css/reference/index.html b/files/ar/web/css/reference/index.html deleted file mode 100644 index e0d134fb04..0000000000 --- a/files/ar/web/css/reference/index.html +++ /dev/null @@ -1,179 +0,0 @@ ---- -title: CSS reference -slug: Web/CSS/Reference -translation_of: Web/CSS/Reference ---- -
{{CSSRef}}
- -

Use this CSS reference to browse an alphabetical index of all the standard CSS properties, pseudo-classes, pseudo-elements, data types, and at-rules. You can also browse a list of all the CSS selectors organized by type and a list of key CSS concepts. Also included is a brief DOM-CSS / CSSOM reference.

- -

Basic rule syntax

- -

Style rule syntax

- -
style-rule ::=
-    selectors-list {
-      properties-list
-    }
-
- -

... where :

- -
selectors-list ::=
-    selector[:pseudo-class] [::pseudo-element]
-    [, selectors-list]
-
-properties-list ::=
-    [property : value] [; properties-list]
-
- -

See selector, pseudo-class, pseudo-element lists below. The syntax for each specified value depends on the data type defined for each specified property.

- -

Style rule examples

- -
strong {
-  color: red;
-}
-
-div.menu-bar li:hover > ul {
-  display: block;
-}
-
- -

For a beginner-level introduction to the syntax of CSS selectors, please see this tutorial. Be aware that any CSS syntax error in a rule definition invalidates the entire rule. Invalid rules are ignored by the browser. Note that CSS rule definitions are entirely (ASCII) text-based, whereas DOM-CSS / CSSOM (the rule management system) is object-based.

- -

At-rule syntax

- -

As the structure of at-rules varies widely, please see At-rule to find the syntax of the specific one you want.

- -

Keyword index

- -
-

Note: The property names in this index do not include the JavaScript names where they differ from the CSS standard names.

-
- -
{{CSS_Ref}}
- -

Selectors

- -

The following are the various selectors, which allow styles to be conditional based on various features of elements within the DOM.

- -

Simple selectors

- -

Simple selectors are fundamental selectors; these are the most basic selectors that are frequently combined to create other, more complex selectors.

- - - -

Combinators

- -

Combinators are selectors that establish a relationship between two or more simple selectors, such as "A is a child of B" or "A is adjacent to B."

- -
-
Adjacent sibling combinator A + B
-
Specifies that the elements selected by both A and B have the same parent and that the element selected by B immediately follows the element selected by A horizontally.
-
General sibling combinator A ~ B
-
Specifies that the elements selected by both A and B share the same parent and that the element selected by A comes before—but not necessarilyl immediately before—the element selected by B.
-
Child combinator A > B
-
Specifies that the element selected by B is the direct child of the element selected by A.
-
Descendant combinator A B
-
Specifies that the element selected by B is a descendant of the element selected by A, but is not necessarily a direct child.
-
Column combinator A || B {{Experimental_Inline}}
-
Specifies that the element selected by B is located within the table column specified by A. Elements which span multiple columns are considered to be a member of all of those columns.
-
- -

Pseudo-classes

- -
-
    - -
-
- -

Pseudo-elements

- -
-
    - -
-
- -
-

See also: A complete list of selectors in the Selectors Level 3 specification.

-
- -

Concepts

- -

Syntax and semantics

- - - -

Values

- - - -

Layout

- - - -

DOM-CSS / CSSOM

- -

Major object types

- -
    -
  • {{DOMxRef("DocumentOrShadowRoot.styleSheets")}}
  • -
  • {{DOMxRef("StyleSheetList", "styleSheets", "", 1)}}[i].{{DOMxRef("CSSRuleList", "cssRules", "", 1)}}
  • -
  • cssRules[i].{{DOMxRef("CSSRule.cssText", "cssText", "", 1)}} (selector & style)
  • -
  • cssRules[i].{{DOMxRef("CSSStyleRule.selectorText", "selectorText", "", 1)}}
  • -
  • {{DOMxRef("HTMLElement.style")}}
  • -
  • HTMLElement.style.{{DOMxRef("CSSStyleDeclaration.cssText", "cssText", "", 1)}} (just style)
  • -
  • {{DOMxRef("Element.className")}}
  • -
  • {{DOMxRef("Element.classList")}}
  • -
- -

Important methods

- -
    -
  • {{DOMxRef("CSSStyleSheet.insertRule()")}}
  • -
  • {{DOMxRef("CSSStyleSheet.deleteRule()")}}
  • -
- -

See also

- - diff --git a/files/ar/web/css/transform/index.html b/files/ar/web/css/transform/index.html deleted file mode 100644 index 7b25fd9c6a..0000000000 --- a/files/ar/web/css/transform/index.html +++ /dev/null @@ -1,137 +0,0 @@ ---- -title: التحول (transform) -slug: Web/CSS/transform -tags: - - التحول - - التحول في صفحات الطرز المتراصة - - خواص صفحات الطرز المتراصة - - صفحات الطرز المتراصة - - مرجع -translation_of: Web/CSS/transform -original_slug: Web/CSS/التحول ---- -
{{CSSRef}}
- -

تسمح لك خاصية التحويل transform في CSS بإدارة وتغيير إحداثيات وأبعاد العناصر وما إلى ذلك كما سنتعرف في هذه الوثيقة.

- -

ويتم ذلك عن طريق تعديل الإحداثيات لنموذج التنسيق المرئي للـ CSS.

- -

 

- -
{{EmbedInteractiveExample("pages/css/transform.html")}}
- - - -

إذا كانت الخاصية لها قيمة مختلفة عن none ، فسيتم إنشاء سياق تجميع. في هذه الحالة ، سيكون الكائن بمثابة كتلة تحتوي على position: fixed العناصر التي تحتوي عليها.

- -

بناء الجملة

- -
/* قيم رئيسية */
-transform: none;
-
-/* قيم وضيفية */
-transform: matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0);
-transform: translate(12px, 50%);
-transform: translateX(2em);
-transform: translateY(3in);
-transform: scale(2, 0.5);
-transform: scaleX(2);
-transform: scaleY(0.5);
-transform: rotate(0.5turn);
-transform: skew(30deg, 20deg);
-transform: skewX(30deg);
-transform: skewY(1.07rad);
-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
-transform: translate3d(12px, 50%, 3em);
-transform: translateZ(2px);
-transform: scale3d(2.5, 1.2, 0.3);
-transform: scaleZ(0.3);
-transform: rotate3d(1, 2.0, 3.0, 10deg);
-transform: rotateX(10deg);
-transform: rotateY(10deg);
-transform: rotateZ(10deg);
-transform: perspective(17px);
-
-/*  قيم وضيفية متعددة */
-transform: translateX(10px) rotate(10deg) translateY(5px);
-
-/* قيمة عامة */
-transform: inherit;
-transform: initial;
-transform: unset;
-
- -

التحويل يمكن أن يحدد بقيمة واحدة أو أكثر من وضيفة.

- -

القيم

- -
-
{{cssxref("<transform-function>")}}
-
يمكنك استعمال وظيفة واحد أو أكثر من وظائف تحويل CSS ليتم تطبيقها. يتم تطبيق التحويلات المركبة بشكل فعال بالترتيب من اليسار إلى اليمين.
-
noneيحدد بعدم تحديد أي تحويل.
-
- -

البنية

- -{{csssyntax}} - -

أمثلة

- -

HTML

- -
<div>عنصر التحويل</div>
- -

CSS

- -
div {
-  border: solid red;
-  transform: translate(30px, 20px) rotate(20deg);
-  width: 140px;
-  height: 60px;
-}
- -

النتيجة

- -

{{EmbedLiveSample("Examples", "400", "160")}}

- -

Please see Using CSS transforms and {{cssxref("<transform-function>")}} for more examples.

- -

الميزات

- - - - - - - - - - - - - - - - - - - - - -
الميزةالحالةالتعليق
{{SpecName('CSS Transforms 2', '#transform-functions', 'transform')}}{{Spec2('CSS Transforms 2')}}Adds 3D transform functions.
{{SpecName('CSS3 Transforms', '#transform-property', 'transform')}}{{Spec2('CSS3 Transforms')}}Initial definition.
- -

{{cssinfo}}

- -

توافق المتصفح

- - - -

{{Compat("css.properties.transform")}}

- -

قد يفيدك

- - diff --git a/files/ar/web/events/index.html b/files/ar/web/events/index.html deleted file mode 100644 index 95f1ffd4bb..0000000000 --- a/files/ar/web/events/index.html +++ /dev/null @@ -1,2990 +0,0 @@ ---- -title: مرجع للأحداث -slug: Web/Events -translation_of: Web/Events ---- -

يتم إرسال أحداث DOM Events لإبلاغ الكود أن أشياء مثيرة قد حدثت. يتم تمثيل كل حدث ب Object يعتمد على واجهة {{domxref ("Event")}} ، وقد يحتوي على حقول و / أو دوال مخصصة إضافية للحصول على معلومات إضافية حول ما حدث. يمكن أن تمثل الأحداث كل شيء بدءًا من تفاعلات المستخدم الأساسية إلى الإشعارات التلقائية للأشياء التي تحدث في نموذج العرض.

- -

تقدم هذه المقالة قائمة بالأحداث التي يمكن إرسالها؛ بعضها أحداث قياسية محددة في المواصفات الرسمية ، والبعض الآخر أحداث تستخدم داخليًا بواسطة متصفحات محددة، على سبيل المثال، الأحداث الخاصة بـ Mozilla  مدرجة بحيث يمكن للإضافات add-ons استخدامها للتفاعل مع المستعرض.

- -

الأقسام الأكثر شيوعا

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

أحداث المصادر

-
اسم الحدثيُطلق عندما
{{Event("error")}}فشل تحميل مصدر.
{{Event("abort")}}تم إلغاء تحميل مصدر.
{{Event("load")}}انتهى تحميل المصدر والمصادر التابعة له.
{{Event("beforeunload")}} -

النافذة والمستند والمصادر الخاصة بهم على وشك ان يتم تحميلهم.

-
{{Event("unload")}} يتم إلغاء تحميل المستند أو المصدر التابع له.
- - - - - - - - - - - - - - - - - - - -
-

أحداث الشبكة

-
اسم الحدثيُطلق عندما
{{Event("online")}}حصل المتصفح على الوصول الى الشبكة.
{{Event("offline")}}فقد المتصفح الوصل الى الشبكة.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

أحداث التركيز

-
اسم الحدثيُطلق عندما
{{Event("focus")}}تلقى عنصر ما التركيز (بدون فقاعة).
{{Event("blur")}}فقد عنصر ما التركيز (بدون فقاعة).
{{Event("focusin")}}عنصر ما على وشك تقلي التركيز (بفقاعة).
{{Event("focusout")}}فقد عنصر ما التركيز (بفقاعة).
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

WebSocket أحداث

-
اسم الحدثيُطلق عندما
openتم إنشاء اتصال WebSocket.
messageيتم استلام رسالة من خلال WebSocket.
{{Event("error")}}تم إغلاق اتصال WebSocket مع ضرر (تعذر إرسال بعض البيانات على سبيل المثال).
closeتم إغلاق اتصال WebSocket.
- - - - - - - - - - - - - - - - - - - - - - - -
-

أحداث سجل الجلسة

-
اسم الحدثيُطلق عندما
{{Event("pagehide")}}يتم قطع إدخال سجل الجلسة من.
{{Event("pageshow")}}يتم قطع إدخال محفوظات الجلسة إلى.
{{Event("popstate")}}يتم نقل إدخال محفوظات الجلسة إلى (في حالات معينة).
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

CSS Animation  أحداث الحركة

-
اسم الحدثيُطلق عندما
{{Event("animationstart")}}بدأ CSS animation .
{{Event("animationcancel")}}تم إيقاف CSS animation .
{{Event("animationend")}}اكتمل CSS animation .
{{Event("animationiteration")}} تم تكرارCSS animation .
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

أحداث CSS انتقالية 

-
اسم الحدثيُطلق عندما
{{Event("transitionstart")}}CSS transition بدأ بالفعل (يتم إطلاقه بعد أي تأخير)
{{Event("transitioncancel")}}CSS transition تم إلغائه.
{{Event("transitionend")}}CSS transition اكتمل.
{{Event("transitionrun")}}CSS transition بدأ تشغيله (تم إطلاقه قبل بدء أي تأخير).
- - - - - - - - - - - - - - - - - - - -
-

أحداث النموذج

-
اسم الحدثيُطلق عندما
{{Event("reset")}}تم الضغط على زر "إعادة الضبط"
{{Event("submit")}}تم الضغط على زر "تسليم"
- - - - - - - - - - - - - - - - - - - -
-

أحداث الطباعة

-
اسم الحدثيُطلق عندما
{{Event("beforeprint")}}تم فتح صندوق الطباعة.
{{Event("afterprint")}}تم إغلاق صندوق الطباعة.
- - - - - - - - - - - - - - - - - - - - - - - -
-

أحداث تكوين النص

-
اسم الحدثيُطلق عندما
{{Event("compositionstart")}}يتم تحضير مقطع النص (مشابه لkeydown لإدخال لوحة المفاتيح ، ولكنها تعمل مع إدخالات أخرى مثل التعرف على الكلام).
{{Event("compositionupdate")}}تم إضافة حرف إلى مقطع من النص الذي يتم تكوينه.
{{Event("compositionend")}}تم الانتهاء من تكوين مقطع من النص أو إلغاؤه.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

أحداث العرض

-
اسم الحدثيُطلق عندما
{{Event("fullscreenchange")}}تم تبديل عنصر إلى وضع ملء الشاشة أو منه.
{{Event("fullscreenerror")}}كان من المستحيل التبديل إلى وضع ملء الشاشة لأسباب فنية أو بسبب رفض الإذن.
{{Event("resize")}}تم تغيير حجم عرض المستند.
{{Event("scroll")}}تم تمرير عرض المستند أو تمرير عنصر.
- - - - - - - - - - - - - - - - - - - - - - - -
-

أحداث الحافظة

-
اسم الحدثيُطلق عندما
{{Event("cut")}}تم قص التحديد ونسخه إلى الحافظة.
{{Event("copy")}}تم نسخ التحديد إلى الحافظة.
{{Event("paste")}}تم لصق العنصر من الحافظة.
- - - - - - - - - - - - - - - - - - - - - -
-

أحداث لوحة المفاتيح

-
اسم الحدثيُطلق عندما
{{Event("keydown")}}تم الضغط على أي مفتاح.
{{Event("keypress")}}أي مفتاح (ما عدا Shift, Fn, أو CapsLock) في حالة الضغط عليه. (يُطلق بالتزامن.)
{{Event("keyup")}}تم تحرير الضغط من على أي مفتاح
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

أحداث الماوس

-
اسم الحدثيُطلق عندما
{{Event("auxclick")}}تم الضغط على زر جهاز التأشير (أي زر غير أساسي) وتحريره على عنصر.
{{Event("click")}}تم الضغط على زر جهاز التأشير (أي زر ، وسيصبح قريباً زر أساسي فقط) وتحريره على عنصر.
{{Event("contextmenu")}}يتم الضغط على الزر الأيمن للماوس (قبل عرض قائمة السياق).
{{Event("dblclick")}}يتم الضغط على زر جهاز تأشير مرتين على عنصر.
{{Event("mousedown")}}يتم الضغط على زر جهاز التأشير على عنصر.
{{Event("mouseenter")}}يتم نقل جهاز تأشير على العنصر المرفق به المستمع.
{{Event("mouseleave")}}يتم نقل جهاز تأشير بعيدًا عن العنصر المرفق به المستمع.
{{Event("mousemove")}}يتم نقل جهاز تأشير فوق عنصر. (يتم تشغيله باستمرار أثناء تحريك الماوس.)
{{Event("mouseover")}}يتم نقل جهاز التأشير إلى العنصر الذي يحتوي على المستمع مرفقًا أو على أحد توابعه.
{{Event("mouseout")}}يتم نقل جهاز تأشير بعيدا عن العنصر الذي يحتوي على المستمع مرفقًا أو بعيدًا عن أحد توابعه.
{{Event("mouseup")}}تم تحرير زر جهاز التأشير فوق عنصر.
{{Event("pointerlockchange")}}تم قفل المؤشر أو تحريره.
{{Event("pointerlockerror")}}كان من المستحيل تأمين المؤشر لأسباب فنية أو بسبب رفض الإذن.
{{Event("select")}}يتم تحديد بعض النص.
{{Event("wheel")}}يتم تدوير الزر العجلة لجهاز التأشير في أي اتجاه.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

أحداث السحب و الإفلات

-
اسم الحدثيُطلق عندما
{{Event("drag")}}يتم سحب عنصر أو نص محدد. (يتم إطلاقه باستمرار كل 350 مللي ثانية)
{{Event("dragend")}}يتم إنهاء عملية السحب (عن طريق تحرير زر الماوس أو الضغط على مفتاح escape).
{{Event("dragenter")}}يدخل العنصر المسحوب أو تحديد النص في هدف إسقاط صالح.
{{Event("dragstart")}}يبدأ المستخدم في سحب عنصر أو تحديد نص.
{{Event("dragleave")}}العنصر المسحوب أو تحديد النص يترك هدف إفلات صالح.
{{Event("dragover")}}يتم سحب عنصر أو تحديد نص فوق هدف إفلات صالح. (يتم إطلاقه باستمرار كل 350 مللي ثانية)
{{Event("drop")}}يتم إسقاط عنصر على هدف إسقاط صالح.
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

أحداث الوسائط

-
اسم الحدثيُطلق عندما
{{Event("audioprocess")}}المخزن المؤقت للإدخال لـ {{DOMxRef ("ScriptProcessorNode")}} جاهز للمعالجة.
{{Event("canplay")}}يمكن للمتصفح تشغيل الوسائط ، ولكن التقدير يشير أنه لم يتم تحميل بيانات كافية لتشغيل الوسائط حتى نهايتها دون الحاجة إلى التوقف لمزيد من التخزين المؤقت للمحتوى.
{{Event("canplaythrough")}}يُقَدِّر المتصفح أنه يمكنه تشغيل الوسائط حتى نهايتها دون التوقف لتخزين المحتوى مؤقتًا.
{{Event("complete")}}يتم إنهاء عرض {{DOMxRef ("OfflineAudioContext")}}}.
{{Event("durationchange")}}تم تحديث خاصية المدة duration.
{{Event("emptied")}}أصبحت الوسائط فارغة؛ على سبيل المثال، يتم إرسال هذا الحدث إذا تم تحميل الوسائط بالفعل (أو تحميلها جزئيًا) ، ويتم استدعاء load () method لإعادة تحميلها.
{{Event("ended")}}توقف التشغيل لأنه تم الوصول إلى نهاية الوسائط.
{{Event("loadeddata")}}تم الانتهاء من تحميل الإطار الأول للوسائط.
{{Event("loadedmetadata")}}تم تحميل البيانات الوصفية metadata.
{{Event("pause")}}تم إيقاف التشغيل مؤقتا.
{{Event("play")}}بدأ التشغيل.
{{Event("playing")}}التشغيل جاهز للبدء بعد التوقف المؤقت أو التأخير بسبب نقص البيانات.
{{Event("ratechange")}}لقد تغير معدل التشغيل.
{{Event("seeked")}}اكتملت عملية البحث.
{{Event("seeking")}}بدأت عملية البحث.
{{Event("stalled")}}يحاول وكيل المستخدم جلب بيانات الوسائط، ولكن البيانات بشكل غير متوقع لا تستجيب.
{{Event("suspend")}}تم تعليق تحميل بيانات الوسائط.
{{Event("timeupdate")}}تم تحديث الوقت المشار إليه بواسطة خاصية currentTime.
{{Event("volumechange")}}تم تغيير مستوى الصوت.
{{Event("waiting")}}توقف التشغيل بسبب نقص مؤقت في البيانات.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

أحداث التقدم

-
اسم الحدث...يُطلق عندما
abortتم إنهاء التقدم (ليس بسبب خطأ).
{{Event("error")}}فشل التقدم.
loadتم التقدم بنجاح.
{{Event("loadend")}} توقف التقدم (بعد أن تم إرسال "error", "abort", أو "load" ).
{{Event("loadstart")}}بدأ التقدم.
{{Event("progress")}}جاري التقدم.
{{Event("timeout")}}تم إنهاء التقدم بسبب انتهاء الوقت المحدد مسبقا.
- -

أحداث التخزين

- -

{{Event("change")}} (see {{anch("Non-standard events")}})
- {{Event("storage")}}

- -

أحداث الترقية

- -

{{Event("checking")}}
- {{Event("downloading")}}
- {{Event("error")}}
- {{Event("noupdate")}}
- {{Event("obsolete")}}
- {{Event("updateready")}}

- -

أحداث اغيير القيمة

- -

{{Event("broadcast")}}
- {{Event("CheckboxStateChange")}}
- {{Event("hashchange")}}
- {{Event("input")}}
- {{Event("RadioStateChange")}}
- {{Event("readystatechange")}}
- {{Event("ValueChange")}}

- -

أحداث غير مصنفة

- -

{{Event("invalid")}}
- message
- message
- open
- show

- -

أحداث أقل شيوعا وغير قياسية

- -

Abortable Fetch events

- - - - - - - - - - - - - - -
اسم الحدثيُطلق عندما
abortتم إحباط طلب DOM ، مثل استخدام {{DOMxRef("AbortController.abort()")}}.
- -

WebVR events

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
اسم الحدثيُطلق عندما
{{Event("vrdisplayactivate")}}عندما يكون من الممكن عرض شاشة VR ، على سبيل المثال إذا تم نقل HMD لإخراجها من وضع الاستعداد، أو إيقاظها من خلال تشغيلها.
{{Event("vrdisplayblur")}}عند إيقاف العرض إلى {{DOMxRef ("VRDisplay")}} مؤقتًا لسبب ما من قبل المتصفح أو نظام التشغيل أو جهاز VR - على سبيل المثال ، أثناء تفاعل المستخدم مع قائمة النظام أو المتصفح ، لمنع تجربة التتبع أو الفقد.
{{Event("vrdisplayconnect")}}عند توصيل {{DOMxRef ("VRDisplay")}} متوافق بالكمبيوتر.
{{Event("vrdisplaydeactivate")}}عندما يتعذر عرض {{DOMxRef ("VRDisplay")}} إلى ، على سبيل المثال إذا انتقل HMD إلى وضع الاستعداد أو وضع السكون بسبب فترة من عدم النشاط.
{{Event("vrdisplaydisconnect")}}عندما يتم فصل {{DOMxRef ("VRDisplay")}} المتوافق مع الكمبيوتر.
{{Event("vrdisplayfocus")}}عند استئناف العرض التقديمي على {{DOMxRef ("VRDisplay")}} بعد أن تم تشويشه.
{{Event("vrdisplaypresentchange")}}تغيير حالة العرض {{DOMxRef ("VRDisplay")}} - مثلا تنتقل من العرض إلى عدم العرض أو العكس.
- -

SVG أحداث

- -

{{Event("SVGAbort")}}
- {{Event("SVGError")}}
- {{Event("SVGLoad")}}
- {{Event("SVGResize")}}
- {{Event("SVGScroll")}}
- {{Event("SVGUnload")}}
- {{Event("SVGZoom")}}

- -

أحداث قاعدة البيانات

- -

abort
- blocked
- complete
- {{Event("error")}}
- success
- upgradeneeded
- versionchange

- -

أحداث السكريبت

- -

{{Event("afterscriptexecute")}}
- {{Event("beforescriptexecute")}}

- -

أحداث القائمة

- -

{{Event("DOMMenuItemActive")}}
- {{Event("DOMMenuItemInactive")}}

- -

أحداث النافذة

- -

close

- -

أحداث منبثقة

- -

{{Event("popuphidden")}}
- {{Event("popuphiding")}}
- {{Event("popupshowing")}}
- {{Event("popupshown")}}

- -

أحداث تبويب

- -

{{Event("visibilitychange")}}

- -
    -
- -

أحداث البطارية

- -

{{Event("chargingchange")}}
- {{Event("chargingtimechange")}}
- {{Event("dischargingtimechange")}}
- {{Event("levelchange")}}

- -

أحداث الاستدعاء

- -

{{Event("alerting")}}
- {{Event("busy")}}
- {{Event("callschanged")}}
- {{Event("cfstatechange")}}
- {{Event("connected")}}
- {{Event("connecting")}}
- {{Event("dialing")}}
- {{Event("disconnected")}}
- {{Event("disconnecting")}}
- {{Event("error_(Telephony)","error")}}
- {{Event("held")}}, {{Event("holding")}}
- {{Event("incoming")}}
- {{Event("resuming")}}
- {{Event("statechange")}}
- {{Event("voicechange")}}

- -

 أحداث مستشعر

- -

{{Event("compassneedscalibration")}}
- {{Event("devicemotion")}}
- {{Event("deviceorientation")}}
- {{Event("orientationchange")}}

- -

أحداث بطاقة ذكية

- -

{{Event("icccardlockerror")}}
- {{Event("iccinfochange")}}
- {{Event("smartcard-insert")}}
- {{Event("smartcard-remove")}}
- {{Event("stkcommand")}}
- {{Event("stksessionend")}}
- {{Event("cardstatechange")}}

- -

SMS و USSD أحداث

- -

{{Event("delivered")}}
- {{Event("received")}}
- {{Event("sent")}}
- {{Event("ussdreceived")}}

- -

أحداث إطار المتصفح

- -

{{Event("mozbrowserclose")}}
- {{Event("mozbrowsercontextmenu")}}
- {{Event("mozbrowsererror")}}
- {{Event("mozbrowsericonchange")}}
- {{Event("mozbrowserlocationchange")}}
- {{Event("mozbrowserloadend")}}
- {{Event("mozbrowserloadstart")}}
- {{Event("mozbrowseropenwindow")}}
- {{Event("mozbrowsersecuritychange")}}
- {{Event("mozbrowsershowmodalprompt")}}
- {{Event("mozbrowsertitlechange")}}

- -

DOM أحداث معالجة

- -

DOMAttributeNameChanged
- DOMAttrModified
- DOMCharacterDataModified
- {{Event("DOMContentLoaded")}}
- DOMElementNameChanged
- DOMNodeInserted
- DOMNodeInsertedIntoDocument
- DOMNodeRemoved
- DOMNodeRemovedFromDocument
- DOMSubtreeModified

- -

أحداث اللمس

- -

{{Event("touchcancel")}}
- {{Event("touchend")}}
- {{Event("touchmove")}}
- {{Event("touchstart")}}

- -

أحداث الإشارة

- -

{{Event("pointerover")}}
- {{Event("pointerenter")}}
- {{Event("pointerdown")}}
- {{Event("pointermove")}}
- {{Event("pointerup")}}
- {{Event("pointercancel")}}
- {{Event("pointerout")}}
- {{Event("pointerleave")}}
- {{Event("gotpointercapture")}}
- {{Event("lostpointercapture")}}

- -

أحداث قياسية

- -

يتم تعريف هذه الأحداث في مواصفات الويب الرسمية ويجب أن تكون شائعة عبر المتصفحات. يتم سرد كل حدث جنبًا إلى جنب مع الواجهة التي تمثل ال Object المرسل إلى مستلمي الحدث (حتى تتمكن من العثور على معلومات حول البيانات التي يتم توفيرها مع كل حدث) بالإضافة إلى ارتباط بالمواصفات أو المواصفات التي تحدد الحدث.

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
اسم الحدثنوع الحدثتخصيصيُطلق عندما...
{{Event("abort")}}{{DOMxRef("UIEvent")}}DOM L3تم إلغاء تحميل المصدر.
abort{{DOMxRef("ProgressEvent")}}Progress and XMLHttpRequestتم إنهاء التقدم (ليس بسبب خطأ).
abort{{DOMxRef("Event")}}IndexedDBتم إلغاء الإجراء.
{{Event("afterprint")}}{{DOMxRef("Event")}}HTML5بدأ المستند المرتبط في الطباعة أو تم إغلاق معاينة الطباعة.
{{Event("animationcancel")}}{{DOMxRef("AnimationEvent")}} {{Experimental_Inline}}CSS Animationsتم إلغاء CSS animation .
{{Event("animationend")}}{{DOMxRef("AnimationEvent")}} {{Experimental_Inline}}CSS Animationsتم إكمال CSS animation .
{{Event("animationiteration")}}{{DOMxRef("AnimationEvent")}} {{Experimental_Inline}}CSS Animations تم تكرار CSS animation.
{{Event("animationstart")}}{{DOMxRef("AnimationEvent")}} {{Experimental_Inline}}CSS Animationsبدأ CSS animation.
{{Event("appinstalled")}}{{DOMxRef("Event")}}Web App Manifestتم تثبيت تطبيق ويب بنجاح progressive web app.
{{Event("audioprocess")}}{{DOMxRef("AudioProcessingEvent")}} {{Deprecated_Inline}}{{SpecName('Web Audio API', '#AudioProcessingEvent', 'audioprocess')}}مخزن الإدخال المؤقت لـ {{DOMxRef ("ScriptProcessorNode")}} جاهز للمعالجة.
{{Event("audioend")}} {{Experimental_Inline}}{{DOMxRef("Event")}}{{SpecName('Web Speech API')}}انتهى وكيل المستخدم من التقاط الصوت للتعرف على الكلام.
{{Event("audiostart")}} {{Experimental_Inline}}{{DOMxRef("Event")}}{{SpecName('Web Speech API')}}بدأ وكيل المستخدم في التقاط الصوت للتعرف على الكلام.
{{Event("beforeprint")}}{{DOMxRef("Event")}}HTML5المستند المرتبط على وشك الطباعة أو المعاينة للطباعة.
{{Event("beforeunload")}}{{DOMxRef("BeforeUnloadEvent")}}HTML5النافذة والمستند ومصدره على وشك التفريغ.
{{Event("beginEvent")}}{{DOMxRef("TimeEvent")}}SVGيبدأ عنصر الرسوم المتحركة SMIL.
blockedIndexedDBيؤدي الاتصال المفتوح بقاعدة بيانات إلى حظر معاملة versionchange في نفس قاعدة البيانات.
{{Event("blur")}}{{DOMxRef("FocusEvent")}} {{Experimental_Inline}}DOM L3العنصر فقد التركيز (لافقاعة).
{{Event("boundary")}} {{Experimental_Inline}}{{DOMxRef("SpeechSynthesisEvent")}}{{SpecName('Web Speech API')}}يصل الكلام المنطوق الكلمة أو الجملة إلى حد
{{Event("canplay")}}{{DOMxRef("Event")}}HTML5 mediaيمكن لوكيل المستخدم تشغيل الوسائط ، لكنه قام بالتقدير أنه لم يتم تحميل بيانات كافية لتشغيل الوسائط حتى نهايتها دون الحاجة إلى التوقف لمزيد من التخزين المؤقت للمحتوى.
{{Event("canplaythrough")}}{{DOMxRef("Event")}}HTML5 mediaيمكن لوكيل المستخدم تشغيل الوسائط حتى نهايتها دون الحاجة إلى التوقف لمزيد من التخزين المؤقت للمحتوى.
{{Event("change")}}{{DOMxRef("Event")}}DOM L2, HTML5يتم تشغيل حدث التغيير لعناصر {{HTMLElement ("input")}} و {{HTMLElement ("select")}}} و {{HTMLElement ("textarea")}} عندما يتم الالتزام بتغيير قيمة العنصر بواسطة المستخدم.
{{Event("chargingchange")}}{{DOMxRef("Event")}}Battery statusتبدأ البطارية أو تتوقف عن الشحن.
{{Event("chargingtimechange")}}{{DOMxRef("Event")}}Battery statusتم تحديث السمة ChargingTime.
{{Event("click")}}{{DOMxRef("MouseEvent")}}DOM L3تم الضغط على زر جهاز تأشير وتحريره على عنصر.
close{{DOMxRef("Event")}}WebSocketتم إغلاق اتصال WebSocket.
completeIndexedDBتمت المعاملة بنجاح.
{{Event("complete")}}{{DOMxRef("OfflineAudioCompletionEvent")}} {{Deprecated_Inline}}{{SpecName('Web Audio API', '#OfflineAudioCompletionEvent-section', 'OfflineAudioCompletionEvent')}}يتم إنهاء عرض {{DOMxRef ("OfflineAudioContext")}}}.
{{Event("compositionend")}}{{DOMxRef("CompositionEvent")}}DOM L3تم الانتهاء من تكوين مقطع من النص أو إلغاؤه.
{{Event("compositionstart")}}{{DOMxRef("CompositionEvent")}}DOM L3يتم إعداد تركيبة النص (مشابه لمفتاح الإدخال لإدخال لوحة المفاتيح ، ولكنها تعمل مع إدخالات أخرى مثل التعرف على الكلام).
{{Event("compositionupdate")}}{{DOMxRef("CompositionEvent")}}DOM L3تتم إضافة حرف إلى مقطع من النص الذي يتم تكوينه.
{{Event("contextmenu")}}{{DOMxRef("MouseEvent")}}HTML5يتم الضغط على الزر الأيمن للماوس (قبل عرض قائمة السياق).
{{Event("copy")}}{{DOMxRef("ClipboardEvent")}} {{Experimental_Inline}}Clipboardتمت إضافة النص المحدد إلى الحافظة.
{{Event("cut")}}{{DOMxRef("ClipboardEvent")}} {{Experimental_Inline}}Clipboardتمت إزالة تحديد النص من المستند وإضافته إلى الحافظة.
{{Event("dblclick")}}{{DOMxRef("MouseEvent")}}DOM L3يتم الضغط فوق زر جهاز تأشير مرتين على عنصر.
{{Event("devicechange")}}{{DOMxRef("Event")}}{{SpecName("Media Capture")}}يتم توصيل جهاز وسائط مثل الكاميرا أو الميكروفون أو مكبر الصوت أو إزالته من النظام.
{{Event("devicemotion")}}{{DOMxRef("DeviceMotionEvent")}} {{Experimental_Inline}}Device Orientation Eventsتتوفر بيانات حديثة من مستشعر الحركة.
{{Event("deviceorientation")}}{{DOMxRef("DeviceOrientationEvent")}} {{Experimental_Inline}}Device Orientation Eventsتتوفر بيانات حديثة من مستشعر الاتجاه.
{{Event("dischargingtimechange")}}{{DOMxRef("Event")}}Battery statusتم تحديث الخاصية dischargingTime.
DOMActivate {{Deprecated_Inline}}{{DOMxRef("UIEvent")}}DOM L3يتم تنشيط زر أو رابط أو عنصر تغيير الحالة (استخدم {{Event ("click")}} بدلاً من ذلك).
DOMAttributeNameChanged {{Deprecated_Inline}}{{DOMxRef("MutationNameEvent")}}DOM L3 Removedتغير اسم الخاصية (استخدم  mutation observers بدلاً من ذلك).
DOMAttrModified {{Deprecated_Inline}}{{DOMxRef("MutationEvent")}}DOM L3تم تعديل قيمة الخاصية (استخدم mutation observers بدلا من ذلك).
DOMCharacterDataModified {{Deprecated_Inline}}{{DOMxRef("MutationEvent")}}DOM L3تم تغيير نص أو CharacterData آخر (استخدم mutation observers بدلاً من ذلك).
{{Event("DOMContentLoaded")}}{{DOMxRef("Event")}}HTML5انتهى تحميل المستند (ولكن ليس مصادره التابعة).
DOMElementNameChanged {{Deprecated_Inline}}{{DOMxRef("MutationNameEvent")}}DOM L3 Removed -

تم تغيير اسم العنصر (استخدم mutation observers بدلاً من ذلك).

-
DOMFocusIn {{Deprecated_Inline}}{{DOMxRef("FocusEvent")}} {{Experimental_Inline}}DOM L3تلقى عنصر التركيز (استخدم {{Event ("focus")}} أو {{Event ("focusin")}} بدلاً من ذلك).
DOMFocusOut {{Deprecated_Inline}}{{DOMxRef("FocusEvent")}} {{Experimental_Inline}}DOM L3فقد العنصر التركيز (استخدم {{Event ("blur")}} أو {{Event ("focusout")}} بدلاً من ذلك).
DOMNodeInserted {{Deprecated_Inline}}{{DOMxRef("MutationEvent")}}DOM L3تمت إضافة العقدة "node" كتابع لعقدة أخرى (استخدم mutation observers بدلاً من ذلك).
DOMNodeInsertedIntoDocument {{Deprecated_Inline}}{{DOMxRef("MutationEvent")}}DOM L3 -

تم إدراج عقدة "node" في المستند (استخدم mutation observers بدلاً من ذلك).

-
DOMNodeRemoved {{Deprecated_Inline}}{{DOMxRef("MutationEvent")}}DOM L3تمت إزالة العقدة "node" من العقدة الأصلية (استخدم mutation observers بدلاً من ذلك).
DOMNodeRemovedFromDocument {{Deprecated_Inline}}{{DOMxRef("MutationEvent")}}DOM L3تمت إزالة عقدة "node" من المستند (استخدم mutation observers بدلاً من ذلك).
DOMSubtreeModified {{Deprecated_Inline}}{{DOMxRef("MutationEvent")}}DOM L3حدث تغيير في المستند (استخدم mutation observers بدلاً من ذلك).
{{Event("drag")}}{{DOMxRef("DragEvent")}}HTML5يتم سحب عنصر أو نص محدد (كل 350 مللي ثانية).
{{Event("dragend")}}{{DOMxRef("DragEvent")}}HTML5يتم إنهاء عملية السحب (عن طريق تحرير زر الماوس أو الضغط على مفتاح escape).
{{Event("dragenter")}}{{DOMxRef("DragEvent")}}HTML5يدخل العنصر المسحوب أو تحديد النص في هدف إسقاط صالح.
{{Event("dragleave")}}{{DOMxRef("DragEvent")}}HTML5العنصر المسحوب أو تحديد النص يترك هدف إفلات صالح.
{{Event("dragover")}}{{DOMxRef("DragEvent")}}HTML5يتم سحب عنصر أو نص محدد فوق هدف إسقاط صالح (يتم تشغيله كل 350 مللي ثانية).
{{Event("dragstart")}}{{DOMxRef("DragEvent")}}HTML5يبدأ المستخدم في سحب عنصر أو تحديد نص.
{{Event("drop")}}{{DOMxRef("DragEvent")}}HTML5يتم إسقاط عنصر على هدف إسقاط صالح.
{{Event("durationchange")}}{{DOMxRef("Event")}}HTML5 mediaتم تحديث خاصية duration.
{{Event("emptied")}}{{DOMxRef("Event")}}HTML5 media -

أصبحت وسائل الإعلام فارغة. على سبيل المثال ، يتم تشغيل هذا الحدث إذا تم تحميل الوسائط بالفعل (أو تم تحميلها جزئيًا) ، وتم استدعاء load() method لإعادة تحميلها.

-
{{Event("end_(SpeechRecognition)","end")}} {{Experimental_Inline}}{{DOMxRef("Event")}}{{SpecName('Web Speech API')}}تم قطع خدمة التعرف على الكلام.
{{Event("end_(SpeechSynthesis)","end")}} {{Experimental_Inline}}{{DOMxRef("SpeechSynthesisEvent")}}{{SpecName("Web Speech API")}}تم الانتهاء من نطق الكلام.
{{Event("ended")}}{{DOMxRef("Event")}}HTML5 mediaتوقف التشغيل بسبب الوصول إلى نهاية الوسائط.
{{Event("ended_(Web_Audio)", "ended")}}{{DOMxRef("Event")}}{{SpecName("Web Audio API")}}توقف التشغيل بسبب الوصول إلى نهاية الوسائط.
{{Event("endEvent")}}{{DOMxRef("TimeEvent")}}SVGينتهي عنصر الحركة SMIL.
{{Event("error")}}{{DOMxRef("UIEvent")}}DOM L3فشل تحميل مصدر.
{{Event("error")}}{{DOMxRef("ProgressEvent")}}Progress and XMLHttpRequestفشل التقدم.
{{Event("error")}}{{DOMxRef("Event")}}WebSocketتم إغلاق اتصال WebSocket مع التحيز (تعذر إرسال بعض البيانات على سبيل المثال).
{{Event("error")}}{{DOMxRef("Event")}}Server Sent Eventsفشل اتصال مصدر الحدث.
{{Event("error")}}{{DOMxRef("Event")}}IndexedDBتسبب الطلب بخطأ وفشل.
{{Event("error_(SpeechRecognitionError)","error")}} {{Experimental_Inline}}{{DOMxRef("Event")}}{{SpecName('Web Speech API')}}يحدث خطأ في التعرف على الكلام.
{{Event("error_(SpeechSynthesisError)","error")}}{{DOMxRef("SpeechSynthesisErrorEvent")}}{{SpecName('Web Speech API')}}حدث خطأ يمنع نطق الكلام بنجاح.
{{Event("focus")}}{{DOMxRef("FocusEvent")}} {{Experimental_Inline}}DOM L3تلقى عنصر ما التركيز (لا فقاعة).
{{Event("focusin")}}{{DOMxRef("FocusEvent")}} {{Experimental_Inline}}DOM L3عنصر ما على وشك تلقي التركيز (فقاعات).
{{Event("focusout")}}{{DOMxRef("FocusEvent")}} {{Experimental_Inline}}DOM L3عنصر ما على وشك فقدان التركيز (الفقاعات).
{{Event("fullscreenchange")}}{{gecko_minversion_inline("9")}}{{DOMxRef("Event")}}Full Screenتم تبديل عنصر إلى وضع ملء الشاشة أو منه.
{{Event("fullscreenerror")}}{{gecko_minversion_inline("9")}}{{DOMxRef("Event")}}Full Screenكان من المستحيل التبديل إلى وضع ملء الشاشة لأسباب فنية أو بسبب رفض الإذن.
{{Event("gamepadconnected")}}{{DOMxRef("GamepadEvent")}} {{Experimental_Inline}}Gamepadتم توصيل لوحة ألعاب.
{{Event("gamepaddisconnected")}}{{DOMxRef("GamepadEvent")}} {{Experimental_Inline}}Gamepadتم قطع اتصال لوحة الألعاب.
{{Event("gotpointercapture")}}{{DOMxRef("PointerEvent")}}Pointer Eventsيتلقى العنصر التقاط مؤشر.
{{Event("hashchange")}}{{DOMxRef("HashChangeEvent")}}HTML5تم تغيير جزء المعرف من عنوان URL (جزء عنوان URL الذي بعد #).
{{Event("lostpointercapture")}}{{DOMxRef("PointerEvent")}}Pointer Eventsفقد العنصر التقاط مؤشر.
{{Event("input")}}{{DOMxRef("Event")}}HTML5يتم تعديل قيمة عنصر ما أو تعديل محتوى عنصر ذو خاصية contenteditable.
{{Event("invalid")}}{{DOMxRef("Event")}}HTML5تم التحقق من عنصر قابل للإرسال ولا يستوفي قيوده.
{{Event("keydown")}}{{DOMxRef("KeyboardEvent")}}DOM L3تم الضغط على مفتاح.
{{Event("keypress")}} {{Deprecated_Inline}}{{DOMxRef("KeyboardEvent")}}DOM L3يتم الضغط على مفتاح، وينتج هذا المفتاح عادة قيمة حرفية (استخدم حدث input بدلاً من ذلك).
{{Event("keyup")}}{{DOMxRef("KeyboardEvent")}}DOM L3تم تحرير مفتاح.
{{Event("languagechange")}} {{Experimental_Inline}}{{DOMxRef("Event")}}{{ SpecName('HTML5.1', '#dom-navigator-languages', 'NavigatorLanguage.languages') }}تغيرت اللغات المفضلة للمستخدم.
{{Event("levelchange")}}{{DOMxRef("Event")}}Battery statusتم تحديث خاصية المستوى level.
{{Event("load")}}{{DOMxRef("UIEvent")}}DOM L3انتهى تحميل المصدر والمصادر التابعة له.
load{{DOMxRef("ProgressEvent")}}Progress and XMLHttpRequestكان التقدم ناجح.
{{Event("loadeddata")}}{{DOMxRef("Event")}}HTML5 mediaتم الانتهاء من تحميل الإطار الأول للوسائط.
{{Event("loadedmetadata")}}{{DOMxRef("Event")}}HTML5 mediaتم تحميل البيانات الوصفية.
{{Event("loadend")}}{{DOMxRef("ProgressEvent")}}Progress and XMLHttpRequest -

توقف التقدم (بعد إرسال "error" أو "abort" أو "load").

-
{{Event("loadstart")}}{{DOMxRef("ProgressEvent")}}Progress and XMLHttpRequestبدأ التقدم.
{{Event("mark")}} {{Experimental_Inline}}{{DOMxRef("SpeechSynthesisEvent")}}{{SpecName('Web Speech API')}}يصل الكلام المنطوق إلى علامة "SSML "mark مسماة.
message{{DOMxRef("MessageEvent")}}WebSocketيتم استلام رسالة من خلال WebSocket.
message{{DOMxRef("MessageEvent")}}Web Workersيتم تلقي رسالة من Web Worker.
message{{DOMxRef("MessageEvent")}}Web Messaging -

يتم تلقي رسالة من إطار تابع (i) أو من نافذة أصل.

-
message{{DOMxRef("MessageEvent")}}Server Sent Eventsيتم تلقي رسالة من خلال مصدر الحدث.
{{Event("messageerror")}}{{DOMxRef("MessageEvent")}}{{DOMxRef("MessagePort")}}, Web Workers, Broadcast Channel, {{DOMxRef("Window")}}يظهر خطأ في الرسالة عندما يتم تلقي رسالة بواسطة Object.
{{Event("message_(ServiceWorker)","message")}} {{Experimental_Inline}}{{DOMxRef("ServiceWorkerMessageEvent")}} or {{DOMxRef("ExtendableMessageEvent")}}, depending on context.Service Workersيتم تلقي رسالة من عامل خدمة ، أو تلقي رسالة في عامل خدمة من سياق آخر.
{{Event("mousedown")}}{{DOMxRef("MouseEvent")}}DOM L3يتم الضغط على زر جهاز التأشير (عادة الماوس/الفأرة) على عنصر.
{{Event("mouseenter")}}{{DOMxRef("MouseEvent")}}DOM L3يتم نقل جهاز التأشير إلى العنصر المُرفق به المستمع.
{{Event("mouseleave")}}{{DOMxRef("MouseEvent")}}DOM L3يتم نقل جهاز التأشير بعيدا عن العنصر المرفق به المستمع.
{{Event("mousemove")}}{{DOMxRef("MouseEvent")}}DOM L3يتم نقل جهاز التأشير فوق عنصر.
{{Event("mouseout")}}{{DOMxRef("MouseEvent")}}DOM L3يتم تحريك جهاز التأشير بعيدا عن العنصر الذي يحتوي على المستمع مرفقا به أو بعيدا عن أحد تابعيه.
{{Event("mouseover")}}{{DOMxRef("MouseEvent")}}DOM L3يتم نقل جهاز التأشير إلى العنصر الذي يحتوي على المستمع مرفقا به أو على أحد تابعيه.
{{Event("mouseup")}}{{DOMxRef("MouseEvent")}}DOM L3يتم تحرير زر جهاز التأشير فوق عنصر.
{{Event("nomatch")}} {{Experimental_Inline}}{{DOMxRef("SpeechRecognitionEvent")}}{{SpecName('Web Speech API')}}تقوم خدمة التعرف على الكلام بإرجاع نتيجة نهائية مع عدم التعرف بشكل ملحوظ.
{{Event("notificationclick")}}{{DOMxRef("NotificationEvent")}} {{Experimental_Inline}}{{SpecName('Web Notifications','#dom-serviceworkerglobalscope-onnotificationclick','onnotificationclick')}} إشعار النظام الذي تم إنتاجه بواسطة عندما تم الضغط على {{DOMxRef ("ServiceWorkerRegistration.showNotification ()")}}.
{{Event("offline")}}{{DOMxRef("Event")}}HTML5 offlineفقد المتصفح الوصول إلى الشبكة.
{{Event("online")}}{{DOMxRef("Event")}}HTML5 offlineلقد تمكن المتصفح من الوصول إلى الشبكة (ولكن قد يتعذر الوصول إلى مواقع ويب معينة).
open{{DOMxRef("Event")}}WebSocketتم إنشاء اتصال WebSocket.
open{{DOMxRef("Event")}}Server Sent Eventsتم إنشاء اتصال مصدر حدث.
{{Event("orientationchange")}}{{DOMxRef("Event")}}Screen Orientationتم تغيير اتجاه الجهاز (عمودي / أفقي).
{{Event("pagehide")}}{{DOMxRef("PageTransitionEvent")}}HTML5يتم قطع إدخال سجل الجلسة من.
{{Event("pageshow")}}{{DOMxRef("PageTransitionEvent")}}HTML5يتم قطع إدخال محفوظات الجلسة إلى.
{{Event("paste")}}{{DOMxRef("ClipboardEvent")}} {{Experimental_Inline}}Clipboardتم نقل البيانات من حافظة النظام إلى المستند.
{{Event("pause")}}{{DOMxRef("Event")}}HTML5 mediaتم إيقاف التشغيل مؤقتًا.
{{Event("pause_(SpeechSynthesis)", "pause")}} {{Experimental_Inline}}{{DOMxRef("SpeechSynthesisEvent")}}{{SpecName('Web Speech API')}}الكلام متوقف مؤقتا جزئيا.
{{Event("pointercancel")}}{{DOMxRef("PointerEvent")}}Pointer Eventsمن غير المحتمل أن ينتج عن المؤشر أي أحداث أخرى.
{{Event("pointerdown")}}{{DOMxRef("PointerEvent")}}Pointer Eventsيدخل المؤشر في حالة الأزرار النشطة.
{{Event("pointerenter")}}{{DOMxRef("PointerEvent")}}Pointer Eventsيتم نقل جهاز التأشير داخل حدود اختبار الهدف.
{{Event("pointerleave")}}{{DOMxRef("PointerEvent")}}Pointer Eventsيتم نقل جهاز التأشير خارج حدود اختبار الهدف.
{{Event("pointerlockchange")}}{{DOMxRef("Event")}}Pointer Lockتم قفل المؤشر أو تحريره.
{{Event("pointerlockerror")}}{{DOMxRef("Event")}}Pointer Lockكان من المستحيل قفل المؤشر لأسباب فنية أو بسبب رفض الإذن.
{{Event("pointermove")}}{{DOMxRef("PointerEvent")}}Pointer Eventsقام المؤشر بتغيير الإحداثيات.
{{Event("pointerout")}}{{DOMxRef("PointerEvent")}}Pointer Events -

انتقل جهاز التأشير خارج حدود اختبار الهدف أو يترك نطاق الهدف الذي يمكن التقاطه.

-
Pointer Eventsيتم نقل جهاز التأشير إلى حدود اختبار الهدف.
{{Event("pointerup")}}{{DOMxRef("PointerEvent")}}Pointer Eventsيترك المؤشر حالة الأزرار النشطة.
{{Event("play")}}{{DOMxRef("Event")}}HTML5 mediaبدأ التشغيل.
{{Event("playing")}}{{DOMxRef("Event")}}HTML5 mediaالتشغيل جاهز للبدء بعد توقفه أو تأجيله بسبب نقص البيانات.
{{Event("popstate")}}{{DOMxRef("PopStateEvent")}}HTML5يتم نقل إدخال محفوظات الجلسة إلى (في حالات معينة).
{{Event("progress")}}{{DOMxRef("ProgressEvent")}}Progress and XMLHttpRequestجاري العمل.
{{Event("push")}}{{DOMxRef("PushEvent")}} {{Experimental_Inline}}{{SpecName("Push API")}}تلقى Service Worker رسالة.
{{Event("pushsubscriptionchange")}}{{DOMxRef("PushEvent")}} {{Experimental_Inline}}{{SpecName("Push API")}}انتهت صلاحية PushSubscription .
{{Event("ratechange")}}{{DOMxRef("Event")}}HTML5 mediaتغير معدل التشغيل.
{{Event("readystatechange")}}{{DOMxRef("Event")}}HTML5 and XMLHttpRequestتم تغيير خاصية readyState للمستند.
{{Event("repeatEvent")}}{{DOMxRef("TimeEvent")}}SVGيتم تكرار عنصر الرسوم المتحركة SMIL animation .
{{Event("reset")}}{{DOMxRef("Event")}}DOM L2, HTML5يتم إعادة تعيين النموذج.
{{Event("resize")}}{{DOMxRef("UIEvent")}}DOM L3تم تغيير حجم عرض المستند.
{{Event("resourcetimingbufferfull")}}{{DOMxRef("Performance")}}Resource Timingالمخزن المؤقت لتوقيت مصدر المتصفح ممتلئ.
{{Event("result")}} {{Experimental_Inline}}{{DOMxRef("SpeechRecognitionEvent")}} {{Experimental_Inline}}{{SpecName('Web Speech API')}}تُعيد خدمة التعرف على الكلام نتيجة - تم التعرف بشكل إيجابي على كلمة أو عبارة وتم إعادة توصيلها إلى التطبيق.
{{Event("resume")}} {{Experimental_Inline}}{{DOMxRef("SpeechSynthesisEvent")}} {{Experimental_Inline}}{{SpecName('Web Speech API')}}يتم استئناف الكلام المتوقف مؤقتا.
{{Event("scroll")}}{{DOMxRef("UIEvent")}}DOM L3تم تمرير عرض المستند أو عنصر.
{{Event("seeked")}}{{DOMxRef("Event")}}HTML5 mediaاكتملت عملية البحث.
{{Event("seeking")}}{{DOMxRef("Event")}}HTML5 mediaبدأت عملية البحث.
{{Event("select")}}{{DOMxRef("UIEvent")}}DOM L3يتم تحديد بعض النص.
{{Event("selectstart")}} {{Experimental_Inline}}{{DOMxRef("Event")}}{{ SpecName('Selection API')}}بدأ الاختيار للتو.
{{Event("selectionchange")}} {{Experimental_Inline}}{{DOMxRef("Event")}}{{ SpecName('Selection API')}}تم تغيير التحديد في المستند.
{{Event("show")}}{{DOMxRef("MouseEvent")}}HTML5 -

تم إطلاق حدث contextmenu (أو تم عمل فقاعة) على عنصر له خاصية contextmenu.

-
{{Event("slotchange")}}{{DOMxRef("Event")}}{{ SpecName('DOM WHATWG')}}تم تغيير محتويات  "Node" العقدة  {{DOMxRef ("HTMLSlotElement")}} ({{htmlelement ("slot")}}).
{{Event("soundend")}} {{Experimental_Inline}}{{DOMxRef("Event")}}{{SpecName('Web Speech API')}}توقف اكتشاف أي صوت - سواء كان يمكن التعرف عليه أم لا.
{{Event("soundstart")}} {{Experimental_Inline}}{{DOMxRef("Event")}}{{SpecName('Web Speech API')}}تم اكتشاف أي صوت - سواء كان يمكن التعرف عليه أم لا .
{{Event("speechend")}} {{Experimental_Inline}}{{DOMxRef("Event")}}{{SpecName('Web Speech API')}}توقف التعرف على الكلام الذي يتم التعرف عليه بواسطة خدمة التعرف على الكلام.
{{Event("speechstart")}} {{Experimental_Inline}}{{DOMxRef("Event")}}{{SpecName('Web Speech API')}}الصوت الذي تتعرف عليه خدمة التعرف على الكلام عند التقاط الكلام.
{{Event("stalled")}}{{DOMxRef("Event")}}HTML5 mediaيحاول وكيل المستخدم جلب بيانات الوسائط ، ولكن البيانات لا تأتي بشكل غير متوقع.
{{Event("start_(SpeechRecognition)","start")}} {{Experimental_Inline}}{{DOMxRef("Event")}}{{SpecName('Web Speech API')}}بدأت خدمة التعرف على الكلام في الاستماع إلى الصوت الوارد بقصد التعرف على القواعد النحوية المرتبطة بSpeechRecognition.
{{Event("start_(SpeechSynthesis)","start")}}{{DOMxRef("SpeechSynthesisEvent")}}{{SpecName('Web Speech API')}}بدأ نطق الكلام.
{{Event("storage")}}{{DOMxRef("StorageEvent")}}Web Storageتم تغيير مكان التخزين (localStorage or sessionStorage) .
{{Event("submit")}}{{DOMxRef("Event")}}DOM L2, HTML5تم تسليم نموذج.
success{{DOMxRef("Event")}}IndexedDBتم إكمال الطلب بنجاح.
{{Event("suspend")}}{{DOMxRef("Event")}}HTML5 mediaتم إيقاف تحميل بيانات الوسائط.
{{Event("SVGAbort")}}{{DOMxRef("SVGEvent")}}SVGتم إيقاف تحميل الصفحة قبل تحميل SVG .
{{Event("SVGError")}}{{DOMxRef("SVGEvent")}}SVGحدث خطأ قبل تحميل SVG.
{{Event("SVGLoad")}}{{DOMxRef("SVGEvent")}}SVGتم تحميل مستند SVG وتحليله .
{{Event("SVGResize")}}{{DOMxRef("SVGEvent")}}SVGيتم تغيير حجم مستند SVG.
{{Event("SVGScroll")}}{{DOMxRef("SVGEvent")}}SVGيتم تمرير وتصفح مستند  SVG.
{{Event("SVGUnload")}}{{DOMxRef("SVGEvent")}}SVGتمت إزالة مستند SVG من نافذة أو إطار.
{{Event("SVGZoom")}}{{DOMxRef("SVGZoomEvent")}}SVGيتم تكبير مستند SVG.
{{Event("timeout")}}{{DOMxRef("ProgressEvent")}}XMLHttpRequest
{{Event("timeupdate")}}{{DOMxRef("Event")}}HTML5 mediaتم تحديث الوقت المشار إليه بواسطة خاصية currentTime.
{{Event("touchcancel")}}{{DOMxRef("TouchEvent")}}Touch Eventsتم تعطيل نقطة اتصال بطريقة خاصة بالتنفيذ (الكثير من نقاط الاتصال ، على سبيل المثال).
{{Event("touchend")}}{{DOMxRef("TouchEvent")}}Touch Eventsتتم إزالة نقطة اتصال من سطح مساحة اللمس.
{{Event("touchmove")}}{{DOMxRef("TouchEvent")}}Touch Eventsيتم تحريك نقطة اتصال على طول سطح اللمس.
{{Event("touchstart")}}{{DOMxRef("TouchEvent")}}Touch Eventsيتم وضع نقطة اتصال على سطح اللمس.
{{Event("transitionend")}}{{DOMxRef("TransitionEvent")}} {{Experimental_Inline}}CSS Transitionsتم إكمال CSS transition .
{{Event("unload")}}{{DOMxRef("UIEvent")}}DOM L3يتم إلغاء تحميل المستند أو المصدر التابع.
upgradeneededIndexedDBجرت محاولة لفتح قاعدة بيانات برقم إصدار أعلى من نسختها الحالية. تم إنشاء معاملة تغيير الإصدار versionchange ..
{{Event("userproximity")}}{{DOMxRef("UserProximityEvent")}} {{Experimental_Inline}}{{SpecName("Proximity Events")}}تتوفر بيانات حديثة من مستشعر القرب (يشير إلى ما إذا كان ال Object  near بالقرب من الجهاز أم لا).
{{Event("voiceschanged")}} {{Experimental_Inline}}{{DOMxRef("Event")}}{{SpecName('Web Speech API')}}قائمة الأوبجكتس  {{DOMxRef ("SpeechSynthesisVoice")}} التي سيتم إرجاعها بواسطة method  {{DOMxRef ("SpeechSynthesis.getVoices ()")}} قد تغيرت (عندما يكون {{Event ("voiceschanged")}} الحدث قد تم إطلاقه.)
versionchangeIndexedDBاكتملت معاملة versionchange.
{{Event("visibilitychange")}}{{DOMxRef("Event")}}Page visibilityأصبح محتوى علامة التبويب مرئيًا أو تم إخفاؤه.
{{Event("volumechange")}}{{DOMxRef("Event")}}HTML5 mediaتم تغيير الصوت.
{{Event("waiting")}}{{DOMxRef("Event")}}HTML5 mediaتوقف التشغيل بسبب نقص مؤقت في البيانات.
{{Event("wheel")}}{{DOMxRef("WheelEvent")}}DOM L3يتم تدوير زر عجلة جهاز التأشير في أي اتجاه.
-
- -

أحداث غير قياسية

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
اسم الحدثنوع الحدثتخصيصيُُطلق عندما...
{{Event("afterscriptexecute")}}{{DOMxRef("Event")}}Mozilla Specificتم تنفيذ نص.
{{Event("beforescriptexecute")}}{{DOMxRef("Event")}}Mozilla Specificالنص على وشك التنفيذ.
{{Event("beforeinstallprompt")}}{{DOMxRef("Event")}}Chrome specificتتم مطالبة من قبل المستخدم بحفظ موقع ويب على شاشة رئيسية على الهاتف الجوال.
{{Event("cardstatechange")}}Firefox OS specificتقوم الخاصية {{DOMxRef("MozMobileConnection.cardState")}} بتغيير قيمة.
{{Event("change")}}{{DOMxRef("DeviceStorageChangeEvent")}}Firefox OS specificيتم إطلاق هذا الحدث في كل مرة يتم فيها إنشاء ملف أو تعديله أو حذفه في منطقة تخزين معينة.
{{Event("connectionInfoUpdate")}}Firefox OS specificتم تحديث المعلومات حول قوة الإشارة وسرعة الارتباط.
{{Event("cfstatechange")}}Firefox OS specificتتغير حالة إعادة توجيه الاتصال.
{{Event("datachange")}}Firefox OS specificيقوم ال Object {{DOMxRef("MozMobileConnection.data")}} بتغيير قيمة.
{{Event("dataerror")}}Firefox OS specificيتلقى ال Object {{DOMxRef("MozMobileConnection.data")}} خطأ من RIL.
{{Event("DOMMouseScroll")}} {{Deprecated_Inline}}Mozilla specificيتم تدوير زر عجلة جهاز التأشير (detail الخاصية هي عدد من الأسطر). (استخدم بدلا {{Event("wheel")}})
dragdrop {{Deprecated_Inline}}DragEventMozilla specificتم إسقاط عنصر (استخدم بدلا {{Event("drop")}}).
dragexit {{Deprecated_Inline}}DragEventMozilla specificجاري إنهاء عملية السحب (استخدم بدلا {{Event("dragend")}}).
draggesture {{Deprecated_Inline}}DragEventMozilla specificيبدأ المستخدم في سحب عنصر أو تحديد نص (استخدم بدل {{Event("dragstart")}}).
{{Event("icccardlockerror")}}Firefox OS specificفشلت احدى ال methods هذه {{DOMxRef("MozMobileConnection.unlockCardLock()")}} أو {{DOMxRef("MozMobileConnection.setCardLock()")}} .
{{Event("iccinfochange")}}Firefox OS specificتغير ال Object {{DOMxRef("MozMobileConnection.iccInfo")}} .
{{Event("localized")}}Mozilla Specificتم تحديد موقع الصفحة باستخدام الخصائص data-l10n-* .
{{Event("mousewheel")}} {{Deprecated_Inline}}IE inventedيتم تدوير زر عجلة جهاز التأشير.
{{Event("MozAudioAvailable")}}{{DOMxRef("Event")}}Mozilla specificالمخزن المؤقت الصوتي ممتلئ وتتوفر العينات الخام المقابلة.
MozBeforeResize {{Obsolete_Inline}}Mozilla specificنافذة على وشك أن يتم تغييرحجمها.
{{Event("mozbrowseractivitydone")}}Firefox OS Browser API-specificيتم إرساله عند اكتمال بعض الأنشطة (الوصف الكامل سيتم تحديده لاحقًا TBD).
{{Event("mozbrowserasyncscroll")}}Firefox OS Browser API-specificيتم إرساله عند تغير موضع التمرير داخل متصفح {{HTMLElement("iframe")}}.
{{Event("mozbrowseraudioplaybackchange")}}Firefox OS Browser API-specificيتم إرساله عند بدء تشغيل الصوت أو إيقاف تشغيله داخل محتوى المتصفح{{HTMLElement("iframe")}}.
{{Event("mozbrowsercaretstatechanged")}}Firefox OS Browser API-specificيتم إرساله عندما يتغير النص المحدد داخل المتصفح{{HTMLElement("iframe")}} .
{{Event("mozbrowserclose")}}Firefox OS Browser API-specificيتم إرساله عند استدعاء ()window.close داخل المستعرض {{HTMLElement("iframe")}}.
{{Event("mozbrowsercontextmenu")}}Firefox OS Browser API-specificيتم إرساله عندما يحاول متصفح {{HTMLElement ("iframe")}} فتح قائمة سياق.
{{Event("mozbrowserdocumentfirstpaint")}}Firefox OS Browser API-specificيتم إرساله عند ظهور لون طلاء جديد على أي مستند في المستعرض {{HTMLElement("iframe")}}.
{{Event("mozbrowsererror")}}Firefox OS Browser API-specificيتم إرساله عند حدوث خطأ أثناء محاولة تحميل محتوى داخل متصفح {{HTMLElement("iframe")}}.
{{Event("mozbrowserfindchange")}}Firefox OS Browser API-specificيتم إرساله عند إجراء عملية بحث على محتوى المتصفح {{HTMLElement ("iframe")}} (انظر HTMLIFrameElement search methods.)
{{Event("mozbrowserfirstpaint")}}Firefox OS Browser API-specificيتم إرساله عندما قوم بتلوين {{HTMLElement ("iframe")}} المحتوى لأول مرة (لا يتضمن هذا الطلاء الأولي منabout:blank.)
{{Event("mozbrowsericonchange")}}Firefox OS Browser API-specificيتم إرساله عند تغيير الرمز المفضل للمتصفح {{HTMLElement ("iframe")}}.
{{Event("mozbrowserlocationchange")}}Firefox OS Browser API-specificيتم إرساله عندما يتغير موقع متصفح {{HTMLElement ("iframe")}}.
{{Event("mozbrowserloadend")}}Firefox OS Browser API-specificيتم إرساله عندما ينتهي المتصفح {{HTMLElement ("iframe")}} من تحميل جميع أصوله.
{{Event("mozbrowserloadstart")}}Firefox OS Browser API-specificيتم إرساله عندما يبدأ المتصفح {{HTMLElement ("iframe")}} في تحميل صفحة جديدة.
{{Event("mozbrowsermanifestchange")}}Firefox OS Browser API-specificيتم إرساله عندما يتغير مسار بيان التطبيق ، في حالة المتصفح {{HTMLElement ("iframe")}} مع تضمين تطبيق ويب مفتوح فيه.
{{Event("mozbrowsermetachange")}}Firefox OS Browser API-specificيتم إرساله عند إضافة عنصر {{htmlelement ("meta")}} إلى محتوى المتصفح {{HTMLElement ("iframe")}} أو إزالته منه أو تغييره.
{{Event("mozbrowseropensearch")}}Firefox OS Browser API-specificيتم إرساله عند العثور على رابط لمحرك بحث.
{{Event("mozbrowseropentab")}}Firefox OS Browser API-specificيتم إرساله عند فتح علامة تبويب جديدة داخل متصفح {{HTMLElement ("iframe")}} نتيجة قيام المستخدم بإصدار أمر لفتح هدف ارتباط في علامة تبويب جديدة (على سبيل المثال Ctrl/Cmd + click.)
{{Event("mozbrowseropenwindow")}}Firefox OS Browser API-specificيتم إرساله عند استدعاء {{DOMxRef ("window.open ()")}} داخل iframe للمتصفح.
{{Event("mozbrowserresize")}}Firefox OS Browser API-specificيتم إرساله عند تغيير حجم نافذة المتصفح {{HTMLElement ("iframe")}}.
{{Event("mozbrowserscroll")}}Firefox OS Browser API-specificيتم إرساله عند تمرير محتوى المتصفح {{HTMLElement ("iframe")}}.
{{Event("mozbrowserscrollareachanged")}}Firefox OS Browser API-specificيتم إرساله عندما تتغير منطقة التمرير المتاحة في المتصفح {{HTMLElement ("iframe")}}. يمكن أن يحدث هذا عند تغيير الحجم وعندما يتغير حجم الصفحة (أثناء التحميل على سبيل المثال.)
{{Event("mozbrowserscrollviewchange")}}Firefox OS Browser API-specificيتم إرساله عند بدء أو إيقاف التمرير غير المتزامن (أي APCZ).
{{Event("mozbrowsersecuritychange")}}Firefox OS Browser API-specificيتم إرساله عندما تتغير حالة SSL داخل متصفح {{HTMLElement ("iframe")}}.
{{Event("mozbrowserselectionstatechanged")}} {{deprecated_inline}}Firefox OS Browser API-specificيتم إرساله عندما يتغير النص المحدد داخل المتصفح {{HTMLElement ("iframe")}}. لاحظ أنه تم تجاهل هذا ، وتستخدم عمليات التنفيذ الأحدث {{Event ("mozbrowsercaretstatechanged")}} بدلاً من ذلك.
{{Event("mozbrowsershowmodalprompt")}}Firefox OS Browser API-specific -

Sent when {{DOMxRef("window.alert","alert()")}}, {{DOMxRef("window.confirm","confirm()")}} or {{DOMxRef("window.prompt","prompt()")}} are called within a browser {{HTMLElement("iframe")}}

-
{{Event("mozbrowsertitlechange")}}Firefox OS Browser API-specificيتم إرساله عندما يتغير عنوان document.title داخل متصفح iframe.
{{Event("mozbrowserusernameandpasswordrequired")}}Firefox OS Browser API-specificيتم إرساله عند طلب مصادقة HTTP.
{{Event("mozbrowservisibilitychange")}}Firefox OS Browser API-specificيتم إرساله عندما تتغير حالة الرؤية لمتصفح iframe الحالي {{HTMLElement("iframe")}} , على سبيل المثال بسبب استدعاء {{DOMxRef("HTMLIFrameElement.setVisible","setVisible()")}}.
{{Event("MozGamepadButtonDown")}}To be specifiedيتم الضغط على زر لوحة الألعاب لأسفل.
{{Event("MozGamepadButtonUp")}}To be specifiedيتم تحرير زر لوحة الألعاب.
{{Event("MozMousePixelScroll")}} {{Deprecated_Inline}}Mozilla specificيتم تدوير زر عجلة جهاز التأشير (خاصية التفاصيل هي عدد من البكسل). (استخدم العجلة بدلاً من ذلك)
{{Event("MozOrientation")}} {{Deprecated_Inline}}Mozilla specificالبيانات الحديثة متاحة من مستشعر التوجه (انظر توجيه الجهاز).
{{Event("MozScrolledAreaChanged")}}{{DOMxRef("UIEvent")}}Mozilla specificتم تمرير عرض المستند أو تغيير حجمه.
{{Event("moztimechange")}}Mozilla specificتم تغيير وقت الجهاز.
MozTouchDown {{Deprecated_Inline}}Mozilla specificيتم وضع نقطة اتصال على سطح اللمس (استخدم touchstart بدلاً من ذلك).
MozTouchMove {{Deprecated_Inline}}Mozilla specificيتم تحريك نقطة اتصال على طول سطح اللمس (استخدم touchmove بدلاً من ذلك).
MozTouchUp {{Deprecated_Inline}}Mozilla specificتتم إزالة نقطة اتصال من سطح اللمس (استخدم touchend بدلاً من ذلك).
{{Event("alerting")}}{{DOMxRef("CallEvent")}}To be specifiedيتم تنبيه المراسل (رنين هاتفه/ها).
{{Event("busy")}}{{DOMxRef("CallEvent")}}To be specifiedخط المراسل مشغول.
{{Event("callschanged")}}{{DOMxRef("CallEvent")}}To be specifiedتمت إضافة مكالمة أو إزالتها من قائمة المكالمات الحالية.
onconnected {{Event("connected")}}{{DOMxRef("CallEvent")}}To be specifiedتم توصيل مكالمة.
{{Event("connecting")}}{{DOMxRef("CallEvent")}}To be specifiedمكالمة على وشك الاتصال.
{{Event("delivered")}}{{DOMxRef("SMSEvent")}}To be specifiedتم تسليم رسالة SMS بنجاح.
{{Event("dialing")}}{{DOMxRef("CallEvent")}}To be specifiedتم طلب رقم المراسل.
{{Event("disabled")}}Firefox OS specificتم تعطيل WiFi على الجهاز.
{{Event("disconnected")}}{{DOMxRef("CallEvent")}}To be specifiedتم قطع اتصال المكالمة.
{{Event("disconnecting")}}{{DOMxRef("CallEvent")}}To be specifiedمكالمة على وشك قطع الاتصال.
{{Event("enabled")}}Firefox OS specificتم تمكين WiFi على الجهاز.
{{Event("error_(Telephony)","error")}}{{DOMxRef("CallEvent")}}To be specifiedحدث خطأ.
{{Event("held")}}{{DOMxRef("CallEvent")}}To be specifiedتم تعليق المكالمة.
{{Event("holding")}}{{DOMxRef("CallEvent")}}To be specifiedمكالمة على وشك أن تعقد.
{{Event("incoming")}}{{DOMxRef("CallEvent")}}To be specifiedيتم تلقي مكالمة.
{{Event("received")}}{{DOMxRef("SMSEvent")}}To be specifiedتم استلام رسالة نصية قصيرة.
{{Event("resuming")}}{{DOMxRef("CallEvent")}}To be specifiedمكالمة على وشك الاستئناف.
{{Event("sent")}}{{DOMxRef("SMSEvent")}}To be specifiedتم إرسال رسالة نصية قصيرة.
{{Event("statechange")}}{{DOMxRef("CallEvent")}}To be specifiedتغيرت حالة المكالمة.
{{Event("statuschange")}}Firefox OS specificتغيرت حالة اتصال Wifi.
{{Event("overflow")}}{{DOMxRef("UIEvent")}}Mozilla specificتم تجاوز عنصر ما من خلال محتواه أو تم عرضه لأول مرة في هذه الحالة (يعمل فقط مع العناصر التي تم تصميمها باستخدام overflow != visible).
{{Event("smartcard-insert")}}Mozilla specificتم إدخال البطاقة الذكية smartcard 
{{Event("smartcard-remove")}}Mozilla specificتمت إزالة البطاقة الذكية smartcard .
{{Event("stkcommand")}}Firefox OS specificيتم إصدار الأمر STK Proactive من ICC.
{{Event("stksessionend")}}Firefox OS specificتم إنهاء جلسة STK بحلول ICC.
{{Event("touchenter")}}{{DOMxRef("TouchEvent")}}Touch Events Removed
{{Event("touchleave")}}{{DOMxRef("TouchEvent")}}Touch Events Removed
{{Event("underflow")}}{{DOMxRef("UIEvent")}}Mozilla specificلم يعد العنصر يغمر من خلال محتواه (يعمل فقط مع العناصر التي تم تصميمها باستخدام overflow != visible).
uploadprogress {{Deprecated_Inline}}{{DOMxRef("ProgressEvent")}}Mozilla Specificالتحميل قيد التقدم (انظر {{Event("progress")}}).
-

{{Event("ussdreceived")}}

-
Firefox OS specificتم استلام رسالة USSD جديدة
{{Event("voicechange")}}Firefox OS specificيقوم ال Object  {{DOMxRef("MozMobileConnection.voice")}} بتغيير القيم.
{{Event("msContentZoom")}}Microsoft specific
{{Event("MSManipulationStateChanged")}}Microsoft specific
{{Event("MSPointerHover")}} {{Deprecated_Inline}}Microsoft specific
-
- -

أحداث خاصة بموزيللا

- -
-

ملاحظة: لا يتم عرض هذه الأحداث مطلقًا لمحتوى الويب ولا يمكن استخدامها إلا في سياق محتوى XUL chrome.

-
- -

XUL أحداث

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
اسم الحدث -

نوع الحدث

-
تخصيصيُطلق عندما...
{{Event("broadcast")}}XULلاحظ أحد ال observer تغييرا في خصائص المذيع المراقب..
{{Event("CheckboxStateChange")}}XULحالة ال checkbox تم تغييره إما عن طريق إجراء المستخدم أو عن طريق برنامج نصي (مفيد لإمكانية الوصول).
closeXULتم الضغط على زر الإغلاق للنافذة.
{{Event("command")}}XULتم تنشيط عنصر.
{{Event("commandupdate")}}XULحدث تحديث الأمر على عنصر .commandset 
{{Event("DOMMenuItemActive")}}XUL تحوم قائمة أو menuitem أو تم تمييزها.
{{Event("DOMMenuItemInactive")}}XULلم تعد القائمة أو menuitem تحوم أو يتم تمييزها.
{{Event("popuphidden")}}PopupEventXULتم إخفاء القائمة المنبثقة أو اللوحة أو تلميح الأدوات.
{{Event("popuphiding")}}PopupEventXULA menupopup، لوحة، أو تلميح الأدوات على وشك أن تكون مخفية.
{{Event("popupshowing")}}PopupEventXULA menupopup، لوحة، أو تلميح الأدوات هو على وشك أن تصبح مرئية.
{{Event("popupshown")}}PopupEventXULأصبحت القائمة المنبثقة أو اللوحة أو تلميح الأدوات مرئية.
{{Event("RadioStateChange")}}XULحالة ال radio تم تغييره إما عن طريق إجراء المستخدم أو عن طريق برنامج نصي (مفيد لإمكانية الوصول).
{{Event("ValueChange")}}XULتم تغيير قيمة عنصر (شريط تقدم ، على سبيل المثال ، مفيد لإمكانية الوصول).
-
- -

Add-on-specific events

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
اسم الحدث -

نوع

- -

الحدث

-
تخصيصيُطلق عندما...
MozSwipeGestureAddons specificيتم تمرير نقطة اتصال عبر سطح اللمس.
MozMagnifyGestureStartAddons specificتبدأ نقطتا اللمس في الابتعاد عن بعضهما البعض.
MozMagnifyGestureUpdateAddons specificتتحرك نقطتا اللمس بعيدًا عن بعضهما البعض (بعدMozMagnifyGestureStart).
MozMagnifyGestureAddons specificابتعدت نقطتا اللمس عن بعضهما البعض (بعد تسلسلMozMagnifyGestureUpdate).
MozRotateGestureStartAddons specificتبدأ نقطتا اللمس في التناوب حول نقطة.
MozRotateGestureUpdateAddons specificتدور نقطتا اللمس حول نقطة (بعد MozRotateGestureStart).
MozRotateGestureAddons specificتدور نقطتا اللمس حول نقطة (بعد تسلسلMozRotateGestureUpdate).
MozTapGestureAddons specificيتم الضغط على نقطتي اتصال على سطح اللمس.
MozPressTapGestureAddons specific"press-tap" حدثت على سطح اللمس (الإصبع الأول لأسفل ، والإصبع الثاني لأسفل ، والإصبع الثاني لأعلى ، والإصبع الأول لأعلى).
MozEdgeUIGestureAddons specificيتم تمرير نقطة اتصال عبر سطح اللمس لاستدعاء Edge UI (Win8 فقط).
MozAfterPaintAddons specificتم إعادة رسم المحتوى.
DOMPopupBlockedAddons specificتم حظر نافذة منبثقة.
DOMWindowCreatedAddons specificتم إنشاء نافذة.
DOMWindowCloseAddons specificنافذة على وشك أن تكون مغلقة.
DOMTitleChangedAddons specificتم تغيير عنوان النافذة.
DOMLinkAddedAddons specificتم إضافة رابط مستند.
DOMLinkRemovedAddons specificتمت إزالة رابط بالداخل من مستند.
DOMMetaAddedAddons specificتمت إضافة العنصرmeta إلى مستند.
DOMMetaRemovedAddons specificتمت إزالة العنصر  meta من المستند.
DOMWillOpenModalDialogAddons specificمربع حوار شكلي على وشك الفتح.
DOMModalDialogClosedAddons specificمربع حوار شكلي تم إغلاقه.
DOMAutoCompleteAddons specificتم إكمال محتوى عنصر تلقائيًا.
DOMFrameContentLoadedAddons specificانتهى تحميل الإطار (ولكن ليس مصادره التابعة).
AlertActiveAddons specificتم إظهار عنصر تنبيه notification .
AlertCloseAddons specificتم إغلاق عنصر تنبيه notification .
fullscreenAddons specificتم تبديل وضع ملء الشاشة في المتصفح.
sizemodechangeAddons specificدخلت النافذة / تركت وضع ملء الشاشة ، أو تم تصغيرها / تصغيرها.
MozEnteredDomFullscreenAddons specificDOM fullscreen تم إدخال الوضع.
SSWindowClosingAddons specificسيتوقف مخزن الجلسة عن تتبع هذه النافذة.
SSTabClosingAddons specificسيتوقف مخزن الجلسة عن تتبع علامة التبويب هذه.
SSTabRestoringAddons specificعلامة التبويب على وشك الاستعادة.
SSTabRestoredAddons specificتمت استعادة علامة تبويب.
SSWindowStateReadyAddons specificتم تبديل حالة النافذة إلى "ready".
SSWindowStateBusyAddons specificتم تبديل حالة النافذة الى"مشغول".
TabOpenAddons specificتم فتح علامة تبويب.
TabCloseAddons specificتم إغلاق علامة تبويب.
TabSelectAddons specificتم تحديد علامة تبويب.
TabShowAddons specificتم عرض علامة تبويب.
TabHideAddons specificتم إخفاء علامة تبويب.
TabPinnedAddons specificتم تثبيت علامة تبويب.
TabUnpinnedAddons specificتم إلغاء تثبيت علامة تبويب.
-
- -

Developer tool-specific events

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
اسم الحدث -

نوع

- -

الحدث

-
تخصيصيُطلق عندما...
CssRuleViewRefresheddevtools specificتم تحديث طريقة عرض "Rules" لعارض الستايل.
CssRuleViewChangeddevtools specificتم تغيير طريقة عرض "Rules" لعارض الستايل.
CssRuleViewCSSLinkClickeddevtools specificتم الضغط على رابط لملف CSS في عرض "Rules" في عارض الستايل.
-
- -

انظر أيضا

- - diff --git a/files/ar/web/guide/graphics/index.html b/files/ar/web/guide/graphics/index.html deleted file mode 100644 index 34229e4441..0000000000 --- a/files/ar/web/guide/graphics/index.html +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: الرسومات على الويب -slug: Web/Guide/Graphics -tags: - - رسومات - - رسوميات ثلاثية الأبعاد - - رسوميات ثنائية الأبعاد - - كانفاس -translation_of: Web/Guide/Graphics -original_slug: Web/Guide/الرسومات ---- -

غالباً ما تحتاج المواقع والتطبيقات لعرض الرسومات. الصور العاديّة يمكن عرضها بسهولة باستخدام العنصر {{HTMLElement("img")}}، أو بإعداد خلفيّة الصفحة باستخدام الخاصيّة {{cssxref("background-image")}}. تستطيع أيضاً إنشاء رسومات في الهواء (طافية)، أو يمكنك التلاعب بالصور بعد حدث ما. هذه المقالات توفر نظرة حول كيف يمكنك القيام بهذه الأشياء.

- -
-
-

الرسوميات ثنائيّة الأبعاد

- -
-
الكانفاس
-
عنصر <canvas> يوفر واجهات برمجيّة لرسم رسومات ثنائيّة الأبعاد باستخدام لغة الجافاسكربت.
-
الرسوميات المتجهيّة المتغيرة
-
تتيح الرسوميات المتجهيّة المتغيرة (SVG) لك استخدام الخطوط، المنحنيات، و غيرها من الأشكال الهندسيّة لتشكيل الرسومات. مع الفيكتور (vector) يمكنك إنشاء صور يمكن أن يتم تحجيمها بدون أن تفقد دقتها.
-
- -

عرض المزيد...

-
- -
-

الرسوميات ثلاثيّة الأبعاد

- -
-
تقنيّة WebGL
-
دليلك للبدء مع تقنيّة WebGL، الواجهة البرمجيّة المخصصة للويب لرسم رسوميات ثلاثيّة الأبعاد. تسمح هذه التقنيّة باستخدام معايير OpenGL ES في محتوى الويب.
-
- -

فيديو

- -
-
استخدام ملفات الفيديو والصوت في لغة ترميز النص الفائق
-
تضمين ملفات الفيديو والصوت في صفحات الويب، والتحكم بتشغيلها.
-
- -
-
تقنيّة WebRTC
-
تقنية RTC في الويب تعني الإتصال في الوقت الحالي (Real-Time Communications), وهي تقنيّة تسمح بتمكين تدفق الصوت والصورة ومشاركتها بين المُتصفحات.
-
-
-
diff --git a/files/ar/web/guide/html/html5/index.html b/files/ar/web/guide/html/html5/index.html deleted file mode 100644 index cfa45a9839..0000000000 --- a/files/ar/web/guide/html/html5/index.html +++ /dev/null @@ -1,178 +0,0 @@ ---- -title: HTML5 -slug: Web/Guide/HTML/HTML5 -tags: - - Guide - - HTML - - HTML5 - - NeedsTranslation - - Overview - - TopicStub - - Web - - Web Development -translation_of: Web/Guide/HTML/HTML5 ---- -

HTML5 هي أحدث تطور للمعاير الذي يعرف HTML. يمثل المصطلح مفهومين مختلفين:

- -
    -
  • إنها نسخة جديدة من لغة HTML, مع عناصر وسمات وسلوكيات جديدة,
  • -
  • ومجموعة أكبر من التقنيات التي تسمح بمواقع وتطبيقات ويب أكثر تنوعًا وقوة. تسمى هذه المجموعة أحيانًا (HTML5 & friends) وغالبًا ما يتم اختصارها إلى HTML5 فقط.
  • -
- -

تم تصميم هذه الصفحة المرجعية لتكون قابلة للاستخدام من قبل جميع مطوري الويب ، وترتبط هذه الصفحة المرجعية بالعديد من المصادر حول تقنيات HTML5 ، مصنفة في عدة مجموعات بناءً على وظيفتها.

- -
    -
  • الدلالات: تتيح لك وصف المحتوى الخاص بك بدقة أكبر.
  • -
  • الاتصال: يتيح لك التواصل مع الخادم بطرق جديدة ومبتكرة.
  • -
  • عدم الإتصال بالإنترنت والتخزين: السماح لصفحات الويب بتخزين البيانات محليًا من جانب المستخدم والعمل دون اتصال بشكل أكثر كفاءة.
  • -
  • الوسائط المتعددة: جعل الفيديو والصوت ذو أولوية أولى في الويب المفتوح.
  • -
  • 2D / 3D الرسوم & التأثيرات: السماح بمجموعة أكثر تنوعًا من خيارات العرض التقديمي.
  • -
  • الأداء والتكامل: توفير تحسين أكبر للسرعة واستخدام أفضل لأجهزة الكمبيوتر.
  • -
  • الوصول إلى الجهاز: السماح باستخدام أجهزة الإدخال والإخراج المختلفة.
  • -
  • التصميم: السماح للمؤلفين بكتابة مواضيع أكثر تطورا.
  • -
- -
-

Semantics

- -
-
Sections and outlines in HTML5
-
A look at the new outlining and sectioning element in HTML5: {{HTMLElement("section")}}, {{HTMLElement("article")}}, {{HTMLElement("nav")}}, {{HTMLElement("header")}}, {{HTMLElement("footer")}} and {{HTMLElement("aside")}}.
-
أستخدام HTML5 audio and video
-
يتم تضمين عنصري {{HTMLElement ("audio")}} و {{HTMLElement ("video")}} والسماح بمعالجة محتوى الوسائط المتعددة الجديدة.
-
النماذج في HTML5
-
A look at improvements to web forms in HTML5: the constraint validation API, several new attributes, new values for the {{HTMLElement("input")}} attribute {{htmlattrxref("type", "input")}} and the new {{HTMLElement("output")}} element.
-
New semantic elements
-
Beside sections, media and forms elements, there are numerous new elements, like {{HTMLElement("mark")}}, {{HTMLElement("figure")}}, {{HTMLElement("figcaption")}}, {{HTMLElement("data")}}, {{HTMLElement("time")}}, {{HTMLElement("output")}}, {{HTMLElement("progress")}}, or {{HTMLElement("meter")}} and {{HTMLElement("main")}}, increasing the amount of valid HTML5 elements.
-
Improvement in {{HTMLElement("iframe")}}
-
Using the {{htmlattrxref("sandbox", "iframe")}}, {{htmlattrxref("seamless", "iframe")}}, and {{htmlattrxref("srcdoc", "iframe")}} attributes, authors can now be precise about the level of security and the wished rendering of an {{HTMLElement("iframe")}} element.
-
MathML
-
السماح بتضمين المعادلات الرياضية مباشرة.
-
مقدمة إلى HTML5
-
This article introduces how to indicate to the problem that you are using HTML5 in your web design or web application.
-
HTML5-compliant parser
-
The parser, which turns the bytes of an HTML document into a DOM, has been extended and now precisely defines the behavior to use in all cases, even when faced with invalid HTML. This leads to far greater predictability and interoperability between HTML5-compliant browsers.
-
- -

Connectivity

- -
-
Web Sockets
-
يسمح بإنشاء اتصال دائم بين الصفحة والخادم وتبادل البيانات بدون تنسيق HTML (Non-HTML) من خلال هذه الوسائل.
-
Server-sent events
-
Allows a server to push events to a client, rather than the classical paradigm where the server could send data only in response to a client's request.
-
WebRTC
-
This technology, where RTC stands for Real-Time Communication, allows connecting to other people and controlling videoconferencing directly in the browser, without the need for a plugin or an external application.
-
- -

Offline & storage

- -
-
Offline resources: the application cache
-
Firefox fully supports the HTML5 offline resource specification. Most others have offline resource support at some level.
-
Online and offline events
-
Firefox 3 supports WHATWG online and offline events, which let applications and extensions detect whether or not there's an active Internet connection, as well as to detect when the connection goes up and down.
-
WHATWG client-side session and persistent storage (aka DOM Storage)
-
Client-side session and persistent storage allows web applications to store structured data on the client side.
-
IndexedDB
-
IndexedDB is a web standard for the storage of significant amounts of structured data in the browser and for high performance searches on this data using indexes.
-
Using files from web applications
-
Support for the new HTML5 File API has been added to Gecko, making it possible for web applications to access local files selected by the user. This includes support for selecting multiple files using the {{HTMLElement("input")}} of type file HTML element's new multiple attribute. There also is FileReader.
-
- -

Multimedia

- -
-
Using HTML5 audio and video
-
The {{HTMLElement("audio")}} and {{HTMLElement("video")}} elements embed and allow the manipulation of new multimedia content.
-
WebRTC
-
This technology, where RTC stands for Real-Time Communication, allows connecting to other people and controlling videoconferencing directly in the browser, without the need for a plugin or an external application.
-
Using the Camera API
-
Allows using, manipulating, and storing an image from the computer's camera.
-
Track and WebVTT
-
The {{HTMLElement("track")}} element allows subtitles and chapters. WebVTT is a text track format.
-
- -

3D, graphics & effects

- -
-
Canvas Tutorial
-
Learn about the new {{HTMLElement("canvas")}} element and how to draw graphs and other objects in Firefox.
-
HTML5 text API for <canvas> elements
-
The HTML5 text API is now supported by {{HTMLElement("canvas")}} elements.
-
WebGL
-
WebGL brings 3D graphics to the Web by introducing an API that closely conforms to OpenGL ES 2.0 that can be used in HTML5 {{HTMLElement("canvas")}} elements.
-
SVG
-
An XML-based format of vectorial images that can directly be embedded in the HTML.
-
-
-
-
- -
-
-
- -
-

Performance & integration

- -
-
Web Workers
-
Allows delegation of JavaScript evaluation to background threads, allowing these activities to prevent slowing down interactive events.
-
XMLHttpRequest Level 2
-
Allows fetching asynchronously some parts of the page, allowing it to display dynamic content, varying according to the time and user actions. This is the technology behind Ajax.
-
JIT-compiling JavaScript engines
-
The new generation of JavaScript engines is much more powerful, leading to greater performance.
-
History API
-
Allows the manipulation of the browser history. This is especially useful for pages loading interactively new information.
-
The contentEditable attribute: transform your website to a wiki!
-
HTML5 has standardized the contentEditable attribute. Learn more about this feature.
-
Drag and drop
-
The HTML5 drag and drop API allows support for dragging and dropping items within and between web sites. This also provides a simpler API for use by extensions and Mozilla-based applications.
-
Focus management in HTML
-
The new HTML5 activeElement and hasFocus attributes are supported.
-
Web-based protocol handlers
-
You can now register web applications as protocol handlers using the navigator.registerProtocolHandler() method.
-
requestAnimationFrame
-
Allows control of animations rendering to obtain optimal performance.
-
Fullscreen API
-
Controls the usage of the whole screen for a Web page or application, without the browser UI displayed.
-
Pointer Lock API
-
Allows locking the pointer to the content, so games and similar applications don't lose focus when the pointer reaches the window limit.
-
Online and offline events
-
In order to build a good offline-capable web application, you need to know when your application is actually offline. Incidentally, you also need to know when your application has returned to an online status again.
-
- -

Device access

- -
-
Using the Camera API
-
Allows using, manipulating, and storing an image from the computer's camera.
-
Touch events
-
Handlers to react to events created by a user pressing touch screens.
-
Using geolocation
-
Let browsers locate the position of the user using geolocation.
-
Detecting device orientation
-
Get the information when the device on which the browser runs changes orientation. This can be used as an input device (e.g., to make games that react to the position of the device) or to adapt the layout of a page to the orientation of the screen (portrait or landscape).
-
Pointer Lock API
-
Allows locking the pointer to the content, so games and similar application don't lose focus when the pointer reaches the window limit.
-
- -

Styling

- -

CSS has been extended to be able to style elements in a much more complex way. This is often referred as CSS3, though CSS is not a monolithic specification any more and the different modules are not all at level 3: some are at level 1 and others at level 4, with all the intermediate levels covered.

- -
-
New background styling features
-
It is now possible to put a shadow to a box, using {{cssxref("box-shadow")}} and multiple backgrounds can be set.
-
More fancy borders
-
Not only it is now possible to use images to style borders, using {{cssxref("border-image")}} and its associated longhand properties, but rounded borders are supported via the {{cssxref("border-radius")}} property.
-
Animating your style
-
Using CSS Transitions to animate between different states or using CSS Animations to animate parts of the page without a triggering event, you can now control mobile elements on your page.
-
Typography improvement
-
Authors have better control to reach better typography. They can control {{cssxref("text-overflow")}} and hyphenation, but also can add a shadow to it or control more precisely its decorations. Custom typefaces can be downloaded and applied thanks to the new {{cssxref("@font-face")}} at-rule.
-
New presentational layouts
-
In order to improve the flexibility of designs, two new layouts have been added: the CSS multi-column layout, and the CSS flexible box layout.
-
-
-
diff --git a/files/ar/web/guide/index.html b/files/ar/web/guide/index.html deleted file mode 100644 index 8d89a9e619..0000000000 --- a/files/ar/web/guide/index.html +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: دليل مطور الويب -slug: Web/Guide -tags: - - الويب - - تعقيب لموضوع - - توجيهات -translation_of: Web/Guide ---- -

هذه المقالات توفر المعلومات التي تساعدك على الإستفادة من التقنيات الخصصة و APIs (واجهة برمجة التطبيقات).

- -
-

تذكير: هذه الصفحة ستكون غير منسقة لبعض الوقت حتى ننتهي من عملية نقل المحتوى. نحن آسفون!

-
- -
{{LandingPageListSubpages}}
- -
-
الجافا سكربت
-
الجافا سكربت هي لغة برمجة نصية قوية تستخدم لإنشاء تطبيقات الويب.
-
- -

أُنظر أيضا

- - diff --git a/files/ar/web/guide/mobile/index.html b/files/ar/web/guide/mobile/index.html deleted file mode 100644 index 11f17242c7..0000000000 --- a/files/ar/web/guide/mobile/index.html +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: Mobile Web development -slug: Web/Guide/Mobile -tags: - - Mobile - - NeedsTranslation - - TopicStub - - Web Development -translation_of: Web/Guide/Mobile -translation_of_original: Web_Development/Mobile -original_slug: Web_Development/Mobile ---- -

Developing web sites to be viewed on mobile devices requires approaches that ensure a web site works as well on mobile devices as it does on desktop browsers. The following articles describe some of these approaches.

- diff --git a/files/ar/web/html/element/article/index.html b/files/ar/web/html/element/article/index.html deleted file mode 100644 index ac37a279f7..0000000000 --- a/files/ar/web/html/element/article/index.html +++ /dev/null @@ -1,154 +0,0 @@ ---- -title: عنصر المقالة
-slug: Web/HTML/Element/article -translation_of: Web/HTML/Element/article -original_slug: HTML/Element/article ---- -
{{HTMLRef}}
- -

عنصر الـ <article> الموجود في الـ html فهو مفهوم من عنوانه والذي يعني (مقال) ونعرف جميعنا ان المقالات بنية مستقلة بذاتها. وتوجد في الوثائق, الصفحات, التطبيقات او المواقع. ما نتحدث عنه اليوم هو كيف نكتب عناصر الـ html لصفحة تحتوي على مقالات مثل : منشور المنتديات, مقالات الصفحات و المجلات. حتى منشورات المدونات blogs تعتبر مقالة. 

- -

في حالة اردت ان تبرمج صفحة تختص بالمقالات لابد لك ان تقوم باستخدام تاك او عنصر <article>. المثال التالي يوضع استخدام المقالة بابسط صوره لها: 

- -
{{EmbedInteractiveExample("pages/tabbed/article.html", "tabbed-standard")}}
- -
- - - -

يمكن لصفحة الواحدة ان تحتوي على الكثير من المقالات. وهذا المثال دليل على ذلك. ليس هذا فحسب, فيمكن ان يكون عنصر المقالة يحتوي على عناصر مقالة بداخله ( تسمى nested element اي العناصر المتداخلة ).

- -

اليك معلومات خاطفة عن هذا العنصر:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
فئة المكون -

Flow content, sectioning content, palpable content

-
Permitted contentFlow content.
Tag omission{{no_tag_omission}}
Permitted parentsAny element that accepts flow content. Note that an <article> element must not be a descendant of an {{HTMLElement("address")}} element.
Implicit ARIA rolearticle
Permitted ARIA roles{{ARIARole("application")}}, {{ARIARole("document")}}, {{ARIARole("feed")}}, {{ARIARole("main")}}, {{ARIARole("none")}}, {{ARIARole("presentation")}}, {{ARIARole("region")}}
DOM interface{{domxref("HTMLElement")}}
- -

الخصائص

- -

هذا العنصر يحتوي على الخصائص العامة فقط. يمكنك زيارتها من هنا

- -

ملاحظات الاستخدام

- -

انت حر في استخدام هذا العنصر. ولكننا نفضل ان تقوم بمراعات هذه النقاط على الاقل.

- -
    -
  • كل عنصر <article> يجب ان يتم تعريفه من خلال تضمين عناوين heading باستخدام h1-h6 وتكون هذه العناصر بداخل هذا العنصر
  • -
  • عندما تحاول ان تكتب عنصر <article> (اي عندما تحول كتابة nested element) عليك مراعاة ان يكون العنصر الداخلي متصل بالعنصر الخارجي. مثلا تعليقات المنشور يجب ان تكون article . 
  • -
  • معلومات مؤلف المنشور اذا امكن ان تكون في عنصر الـ <address> 
  • -
  • التواريخ الخاص بالمقالة مثل تاريخ النشر وغيرها يجب ان تكون من اختصاص العنصر <time> ويمكنك الاطلاع على هذا العنصر من هنا
  • -
- -

المثال التالي يلخص لك هذه النقاط:

- -
<article class="film_review">
-  <header>
-    <h2>Jurassic Park</h2>
-  </header>
-  <section class="main_review">
-    <p>Dinos were great!</p>
-  </section>
-  <section class="user_reviews">
-    <article class="user_review">
-      <p>Way too scary for me.</p>
-      <footer>
-        <p>
-          Posted on
-          <time datetime="2015-05-16 19:00">May 16</time>
-          by Lisa.
-        </p>
-      </footer>
-    </article>
-    <article class="user_review">
-      <p>I agree, dinos are my favorite.</p>
-      <footer>
-        <p>
-          Posted on
-          <time datetime="2015-05-17 19:00">May 17</time>
-          by Tom.
-        </p>
-      </footer>
-    </article>
-  </section>
-  <footer>
-    <p>
-      Posted on
-      <time datetime="2015-05-15 19:00">May 15</time>
-      by Staff.
-    </p>
-  </footer>
-</article>
-
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'semantics.html#the-article-element', '<article>')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5.1', 'sections.html#the-article-element', '<article>')}}{{Spec2('HTML5.1')}}
{{SpecName('HTML5 W3C', 'sections.html#the-article-element', '<article>')}}{{Spec2('HTML5 W3C')}}
- -

Browser compatibility

- - - -

{{Compat("html.elements.article")}}

- -

يمكنك زيارة التالي:

- -
    -
  • العناصر المرتبطة بهذا العنصر - او ربما تستخدمها معه: {{HTMLElement("body")}}, {{HTMLElement("nav")}}, {{HTMLElement("section")}}, {{HTMLElement("aside")}}, {{HTMLElement("h1")}}, {{HTMLElement("h2")}}, {{HTMLElement("h3")}}, {{HTMLElement("h4")}}, {{HTMLElement("h5")}}, {{HTMLElement("h6")}}, {{HTMLElement("hgroup")}}, {{HTMLElement("header")}}, {{HTMLElement("footer")}}, {{HTMLElement("address")}}
  • -
  • Using HTML sections and outlines
  • -
diff --git a/files/ar/web/html/element/bdo/index.html b/files/ar/web/html/element/bdo/index.html deleted file mode 100644 index 5b7dd775eb..0000000000 --- a/files/ar/web/html/element/bdo/index.html +++ /dev/null @@ -1,109 +0,0 @@ ---- -title: ': عنصر تجاوز النص ثنائي الاتجاه' -slug: Web/HTML/Element/bdo -translation_of: Web/HTML/Element/bdo -original_slug: HTML/Element/bdo ---- -
{{HTMLRef}}
- -

HTML عنصر تجاوز النص ثنائي الاتجاه(<bdo>) يتجاوز الاتجاه الحالي للنص، بحيث يتم تقديم النص داخل في اتجاه مختلف. يتم رسم أحرف النص من نقطة البداية في الاتجاه المحدد. لا يتأثر اتجاه الحروف الفردية (حتى لا تحصل على أحرف إلى الوراء، على سبيل المثال).

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
يحتوي الفئاتFlow content, phrasing content, palpable content.
المحتوى المسموح بهPhrasing content.
وسم الإقفال{{no_tag_omission}}
يسمح الآباءأي عنصر يقبل  صياغة المحتوى.
قواعد ARIA مسموحالكل
DOM واجهة{{domxref("HTMLElement")}} Up to Gecko 1.9.2 (Firefox 4) inclusive, Firefox implements the HTMLSpanElement interface for this element.
- -

السِمات

- -

تتضمن سمات هذه العناصر  السمات العامة.

- -
-
{{htmlattrdef("dir")}}
-
الاتجاه الذي يجب أن يظهر فيه النص في محتويات هذا العنصر.
-
القيم المحتملة هي:
-
-
    -
  • ltr: يشير إلى أن النص يجب أن يسير في الاتجاه من اليسار إلى اليمين.
  • -
  • rtl:يشير إلى أن النص يجب أن يكون في الاتجاه من اليمين إلى اليسار.
  • -
-
-
- -

الأمثلة

- -
<!-- Switch text direction -->
-<p>This text will go left to right.</p>
-<p><bdo dir="rtl">This text will go right
-to left.</bdo></p>
-
- -

النتيجة

- -

 

- -

{{EmbedLiveSample('Examples')}}

- -

 

- -

ملاحظات

- -

مواصفات HTML 4 لم تحدد أحداث لهذا العنصر؛ تمت إضافتها في XHTML. وهذا على الأرجح سهو.

- -

مميزات

- - - - - - - - - - - - - - - - - - - - - - - - - - -
المميزاتالحالةتعليق
{{SpecName('HTML WHATWG', 'semantics.html#the-bdo-element', '<bdo>')}}{{Spec2('HTML WHATWG')}} 
{{SpecName('HTML5 W3C', 'textlevel-semantics.html#the-bdo-element', '<bdo>')}}{{Spec2('HTML5 W3C')}} 
{{SpecName('HTML4.01', 'dirlang.html#h-8.2.4', '<bdo>')}}{{Spec2('HTML4.01')}} 
- -

التكامل(دعم) مع المتصفح

- - - -

{{Compat("html.elements.bdo")}}

diff --git a/files/ar/web/html/element/heading_elements/index.html b/files/ar/web/html/element/heading_elements/index.html deleted file mode 100644 index 4770490bd3..0000000000 --- a/files/ar/web/html/element/heading_elements/index.html +++ /dev/null @@ -1,245 +0,0 @@ ---- -title: '

: عناصر العناوين' -slug: Web/HTML/Element/Heading_Elements -translation_of: Web/HTML/Element/Heading_Elements -original_slug: HTML/Element/headings_elements ---- -

 عناصر <h1><h6> تقدم لنا سته مستويات من عناوين الأقسام. حيث أن العنصر<h1> يمثل العنوان الأعلى مستوى في الأهمية بينما العنصر <h2> هو الأقل.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
فئات المحتوى Flow content, heading content, palpable content.
المحتوى المسموح بهPhrasing content.
إغفال الوسوملا شئ، كلاً من وسمّي الفتح والإقفال إجباري
الأباء المسموح بهم للعنصرAny element that accepts flow content; don't use an heading element as a child of the {{HTMLElement("hgroup")}} element — it is now deprecated.
Permitted ARIA roles{{ARIARole("tab")}}, {{ARIARole("presentation")}}
DOM interface{{domxref("HTMLHeadingElement")}}
- -

السمات

- -

هذه العناصر تتضمن السمات العامة.

- -
-

السمة align عفاء عنها الزمن، لا تستخدمها

-
- -

ملاحظات الإستخدام

- -
    -
  • يمكن إستخدام معلومات العناوين من قبل الـ user agents, على سبيل المثال لإنشاء جدول المحتويات لمستند بشكل تلقائي.
  • -
  • لا تستخدم عناوين بمستويات منخفضة لتقليل حجم خط العناوين: إستخدم خاصية لغة CSS المسؤولة عن التحكم بأحجام الخطوط font-size بدلاً من ذلك.
  • -
  •  تجنب تخطي مستويات العناوين: دائماً إبدا من <h1>، من ثم إستخدم <h2> وهكذا.
  • -
  • يجب أن تأخذ بعين الإعتبار تجنب إستخدام العنصر <h1> أكثر من مرة في الصفحة. إطلع على تعريف الأقسام في إستخدام الأقسام و وتسلسل العناوين في الـ HTML لمعلومات أكثر.
  • -
- -

أمثلة

- -

جميع العناوين

- -

الكود التالي يظهر كل مستويات العناوين، قيد الإستخدام.

- -
<h1>Heading level 1</h1>
-<h2>Heading level 2</h2>
-<h3>Heading level 3</h3>
-<h4>Heading level 4</h4>
-<h5>Heading level 5</h5>
-<h6>Heading level 6</h6>
-
- -

هنا نتيجة هذا الكود:

- -

{{ EmbedLiveSample('All_headings', '280', '300', '') }}

- -

مثال لصفحة

- -

الكود التالي يظهر بعض العناوين مع بعض المحتوى بأسفلها.

- -
<h1>Heading elements</h1>
-<h2>Summary</h2>
-<p>Some text here...</p>
-
-<h2>Examples</h2>
-<h3>Example 1</h3>
-<p>Some text here...</p>
-
-<h3>Example 2</h3>
-<p>Some text here...</p>
-
-<h2>See also</h2>
-<p>Some text here...</p>
-
- -

هنا نتيجة هذا الكود:

- -

{{ EmbedLiveSample('Example_page', '280', '480', '') }}

- -

سهولة الوصول

- -

التنقل بين الأجزاء والصفحات

- -

من الأساليب الشائعة للتنقل بين أجزاء الصفحة من قبل مستخدمي قارئات الشاشات هو القفز من عنوان لأخر لتحديد محتوى الصفحة بشكل سريع. 

- -

لهذا السبب، من المهم عدم تخطي أحد مستويات العناوين فالقيام بذلك قد يسبب ارتباك للشخص الذي يقوم بالتنقل بين أجزاء الموقع بهذه الطريقة وربما يترك لدية نوع من الحيرة عن أين هو العنوان المفقود.

- -

لا تقم بالتالي:

- -
<h1>Heading level 1</h1>
-<h3>Heading level 3</h3>
-<h4>Heading level 4</h4>
-
- -

قم بالتالي:

- -
<h1>Heading level 1</h1>
-<h2>Heading level 2</h2>
-<h3>Heading level 3</h3>
-
- -

تسلسل العناوين -  Nesting

- -

قد يتم عمل تسلسل لبعض العناوين لتبدو كعناوين أقسام فرعية لعكس تنظيم محتوى الصفحة. أغلب قارئات الشاشات تستطيع أيضا تكوين قائمة مرتبة لكل العناوين التي في الصفحة، ما قد يساعد الشخص لتحديد التسلسل الهرمي للمحتوى بسرعة :

- -
    -
  1. h1 Beetles - -
      -
    1. h2 Etymology
    2. -
    3. h2 Distribution and Diversity
    4. -
    5. h2 Evolution -
        -
      1. h3 Late Paleozoic
      2. -
      3. h3 Jurassic
      4. -
      5. h3 Cretaceous
      6. -
      7. h3 Cenozoic
      8. -
      -
    6. -
    7. h2 External Morphology -
        -
      1. h3 Head -
          -
        1. h4 Mouthparts
        2. -
        -
      2. -
      3. h3 Thorax -
          -
        1. h4 Prothorax
        2. -
        3. h4 Pterothorax
        4. -
        -
      4. -
      5. h3 Legs
      6. -
      7. h3 Wings
      8. -
      9. h3 Abdomen
      10. -
      -
    8. -
    -
  2. -
- -

When headings are nested, heading levels may be "skipped" when closing a subsection.

- - - -

Labeling section content

- -

Another common navigation technique for users of screen reading software is to generate a list of sectioning content and use it to determine the page's layout.

- -

Sectioning content can be labeled using a combination of the aria-labelledby and {{htmlattrxref("id")}} attributes, with the label concisely describing the purpose of the section. This technique is useful for situations where there is more than one sectioning element on the same page.

- -

Example

- -
<header>
-  <nav aria-labelledby="primary-navigation">
-    <h2 id="primary-navigation">Primary navigation</h2>
-    <!-- navigation items -->
-  </nav>
-</header>
-
-<!-- page content -->
-
-<footer>
-  <nav aria-labelledby="footer-navigation">
-    <h2 id="footer-navigation">Footer navigation</h2>
-    <!-- navigation items -->
-  </nav>
-</footer>
-
- -

In this example, screen reading technology would announce that there are two {{HTMLElement("nav")}} sections, one called "Primary navigation" and one called "Footer navigation". If labels were not provided, the person using screen reading software may have to investigate each nav element's contents to determine their purpose.

- - - -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'sections.html#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements', '<h1>, <h2>, <h3>, <h4>, <h5>, and <h6>')}}{{Spec2('HTML WHATWG')}} 
{{SpecName('HTML5 W3C', 'sections.html#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements', '<h1>, <h2>, <h3>, <h4>, <h5>, and <h6>')}}{{Spec2('HTML5 W3C')}} 
{{SpecName('HTML4.01', 'struct/global.html#h-7.5.5', '<h1>, <h2>, <h3>, <h4>, <h5>, and <h6>')}}{{Spec2('HTML4.01')}} 
- -

Browser compatibility

- - - -

{{Compat("html.elements.h1")}}

- -

See also

- -
    -
  • {{HTMLElement("p")}}
  • -
  • {{HTMLElement("div")}}
  • -
  • {{HTMLElement("section")}}
  • -
- -
{{HTMLRef}}
diff --git a/files/ar/web/html/element/index.html b/files/ar/web/html/element/index.html deleted file mode 100644 index 753d271820..0000000000 --- a/files/ar/web/html/element/index.html +++ /dev/null @@ -1,240 +0,0 @@ ---- -title: HTML element reference -slug: Web/HTML/Element -translation_of: Web/HTML/Element -original_slug: HTML/Element ---- -

يسرد مرجع HTML هذا جميع عناصر HTML ، المحددة في HTML5 أو في مواصفات سابقة. عند تضمينها داخل أقواس زاوية ، فإنها تشكل علامات HTML : <elementname>.العناصر عبارة عن كيانات تحدد كيفية إنشاء مستندات HTML ، ونوع المحتوى الذي يجب وضعه في أي جزء من مستند HTML .

- -

تسرد هذه الصفحة جميع علامات HTML5 القياسية ، ولكنها تحتوي أيضًا على العلامات القديمة والبالية والمهملة ، بالإضافة إلى العلامات غير القياسية التي قد تدعمها المتصفحات. غالبًا ما يشار إلى العناصر التي تم تقديمها في HTML5 على أنها عناصر HTML5 الجديدة ، على الرغم من أن العناصر القياسية الأخرى صالحة أيضًا في HTML5.

- -

في مستند HTML ، يتم تعريف عنصر بواسطة علامة البداية . إذا احتوى عنصر المحتويات الأخرى، وينتهي مع علامة إغلاق، حيث يسبق اسم العنصر بواسطة خط مائل: </elementname>لا تحتاج إلى إغلاق بعض العناصر ، مثل عناصر الصورة.هذه هي المعروفة باسم العناصر باطلة . تحتوي مستندات HTML على شجرة من هذه العناصر. يدعى كل لتمثيل ما يفعله. على سبيل المثال ، <title>يمثل العنصر عنوان المستند. فيما يلي قائمة أبجدية بعناصر HTML.

- -

تمت إضافة هذا العنصر في HTML5يشير الرمز إلى أنه تمت إضافة العنصر في HTML5. لاحظ أنه ربما تم تعديل أو توسيع العناصر الأخرى المدرجة هنا حسب مواصفات HTML5. العناصر البعدية غير قياسية أو قديمة أو متوقفة ؛ يجب عدم استخدامها في مواقع ويب جديدة ، ويجب إزالتها بشكل تدريجي من المواقع الحالية لتجنب النتائج غير المرغوب فيها.

- -

يشير الرمز Ⓒ إلى أن العنصر معرف في مجموعة المواصفات Web Components.

- -
A - -
    -
  • {{ HTMLElement("a") }}
  • -
  • {{ HTMLElement("abbr") }}
  • -
  • {{ HTMLElement("acronym") }}
  • -
  • {{ HTMLElement("address") }}
  • -
  • {{ HTMLElement("applet") }}
  • -
  • {{ HTMLElement("area") }}
  • -
  • {{ HTMLElement("article") }}
  • -
  • {{ HTMLElement("aside") }}
  • -
  • {{ HTMLElement("audio") }}
  • -
-B - -
    -
  • {{ HTMLElement("b") }}
  • -
  • {{ HTMLElement("base") }}
  • -
  • {{ HTMLElement("basefont") }}
  • -
  • {{ HTMLElement("bdi") }}
  • -
  • {{ HTMLElement("bdo") }}
  • -
  • {{ HTMLElement("bgsound") }}
  • -
  • {{ HTMLElement("big") }}
  • -
  • {{ HTMLElement("blink") }}
  • -
  • {{ HTMLElement("blockquote") }}
  • -
  • {{ HTMLElement("body") }}
  • -
  • {{ HTMLElement("br") }}
  • -
  • {{ HTMLElement("button") }}
  • -
-C - -
    -
  • {{ HTMLElement("canvas") }}
  • -
  • {{ HTMLElement("caption") }}
  • -
  • {{ HTMLElement("center") }}
  • -
  • {{ HTMLElement("cite") }}
  • -
  • {{ HTMLElement("code") }}
  • -
  • {{ HTMLElement("col") }}
  • -
  • {{ HTMLElement("colgroup") }}
  • -
-D - -
    -
  • {{ HTMLElement("data") }}
  • -
  • {{ HTMLElement("datalist") }}
  • -
  • {{ HTMLElement("dd") }}
  • -
  • {{ HTMLElement("decorator")}}
  • -
  • {{ HTMLElement("del") }}
  • -
  • {{ HTMLElement("details") }}
  • -
  • {{ HTMLElement("dfn") }}
  • -
  • {{ HTMLElement("dir") }}
  • -
  • {{ HTMLElement("div") }}
  • -
  • {{ HTMLElement("dl") }}
  • -
  • {{ HTMLElement("dt") }}
  • -
-E - -
    -
  • {{HTMLElement("em") }}
  • -
  • {{ HTMLElement("embed") }}
  • -
-F - -
    -
  • {{ HTMLElement("fieldset") }}
  • -
  • {{ HTMLElement("figcaption") }}
  • -
  • {{ HTMLElement("figure") }}
  • -
  • {{ HTMLElement("font") }}
  • -
  • {{ HTMLElement("footer") }}
  • -
  • {{ HTMLElement("form") }}
  • -
  • {{ HTMLElement("frame") }}
  • -
  • {{ HTMLElement("frameset") }}
  • -
-G H - -
    -
  • {{ HTMLElement("h1") }}
  • -
  • {{ HTMLElement("h2") }}
  • -
  • {{ HTMLElement("h3") }}
  • -
  • {{ HTMLElement("h4") }}
  • -
  • {{ HTMLElement("h5") }}
  • -
  • {{ HTMLElement("h6") }}
  • -
  • {{ HTMLElement("head") }}
  • -
  • {{ HTMLElement("header") }}
  • -
  • {{ HTMLElement("hgroup") }}
  • -
  • {{ HTMLElement("hr") }}
  • -
  • {{ HTMLElement("html") }}
  • -
-I - -
    -
  • {{ HTMLElement("i") }}
  • -
  • {{ HTMLElement("iframe") }}
  • -
  • {{ HTMLElement("img") }}
  • -
  • {{ HTMLElement("input") }}
  • -
  • {{ HTMLElement("ins") }}
  • -
  • {{ HTMLElement("isindex") }}
  • -
-J K - -
    -
  • {{ HTMLElement("kbd") }}
  • -
  • {{ HTMLElement("keygen") }}
  • -
-L - -
    -
  • {{ HTMLElement("label") }}
  • -
  • {{ HTMLElement("legend") }}
  • -
  • {{ HTMLElement("li") }}
  • -
  • {{ HTMLElement("link") }}
  • -
  • {{ HTMLElement("listing") }}
  • -
-M - -
    -
  • {{HTMLElement("main")}}
  • -
  • {{ HTMLElement("map") }}
  • -
  • {{ HTMLElement("mark") }}
  • -
  • {{ HTMLElement("marquee") }}
  • -
  • {{ HTMLElement("menu") }}
  • -
  • {{ HTMLElement("menuitem") }}
  • -
  • {{ HTMLElement("meta") }}
  • -
  • {{ HTMLElement("meter") }}
  • -
-N - -
    -
  • {{ HTMLElement("nav") }}
  • -
  • {{ HTMLElement("nobr") }}
  • -
  • {{ HTMLElement("noframes") }}
  • -
  • {{ HTMLElement("noscript") }}
  • -
-O - -
    -
  • {{ HTMLElement("object") }}
  • -
  • {{ HTMLElement("ol") }}
  • -
  • {{ HTMLElement("optgroup") }}
  • -
  • {{ HTMLElement("option") }}
  • -
  • {{ HTMLElement("output") }}
  • -
-P - -
    -
  • {{ HTMLElement("p") }}
  • -
  • {{ HTMLElement("param") }}
  • -
  • {{ HTMLElement("plaintext") }}
  • -
  • {{ HTMLElement("pre") }}
  • -
  • {{ HTMLElement("progress") }}
  • -
-Q - -
    -
  • {{ HTMLElement("q") }}
  • -
-R - -
    -
  • {{ HTMLElement("rp") }}
  • -
  • {{ HTMLElement("rt") }}
  • -
  • {{ HTMLElement("ruby") }}
  • -
-S - -
    -
  • {{ HTMLElement("s") }}
  • -
  • {{ HTMLElement("samp") }}
  • -
  • {{ HTMLElement("script") }}
  • -
  • {{ HTMLElement("section") }}
  • -
  • {{ HTMLElement("select") }}
  • -
  • {{ HTMLElement("small") }}
  • -
  • {{ HTMLElement("source") }}
  • -
  • {{ HTMLElement("spacer") }}
  • -
  • {{ HTMLElement("span") }}
  • -
  • {{ HTMLElement("strike") }}
  • -
  • {{ HTMLElement("strong") }}
  • -
  • {{ HTMLElement("style") }}
  • -
  • {{ HTMLElement("sub") }}
  • -
  • {{ HTMLElement("summary") }}
  • -
  • {{ HTMLElement("sup") }}
  • -
-T - -
    -
  • {{ HTMLElement("table") }}
  • -
  • {{ HTMLElement("tbody") }}
  • -
  • {{ HTMLElement("td") }}
  • -
  • {{ HTMLElement("template")}}
  • -
  • {{ HTMLElement("textarea") }}
  • -
  • {{ HTMLElement("tfoot") }}
  • -
  • {{ HTMLElement("th") }}
  • -
  • {{ HTMLElement("thead") }}
  • -
  • {{ HTMLElement("time") }}
  • -
  • {{ HTMLElement("title") }}
  • -
  • {{ HTMLElement("tr") }}
  • -
  • {{ HTMLElement("track") }}
  • -
  • {{ HTMLElement("tt") }}
  • -
-U - -
    -
  • {{ HTMLElement("u") }}
  • -
  • {{ HTMLElement("ul") }}
  • -
-V - -
    -
  • {{ HTMLElement("var") }}
  • -
  • {{ HTMLElement("video") }}
  • -
-W - -
    -
  • {{ HTMLElement("wbr") }}
  • -
-X Y Z - -
    -
  • {{ HTMLElement("xmp") }}
  • -
-
- -

 

diff --git a/files/ar/web/html/element/input/index.html b/files/ar/web/html/element/input/index.html deleted file mode 100644 index 4d6726e1bf..0000000000 --- a/files/ar/web/html/element/input/index.html +++ /dev/null @@ -1,1380 +0,0 @@ ---- -title: ': The Input (Form Input) element' -slug: Web/HTML/Element/input -tags: - - Data entry - - Element - - Forms - - HTML - - HTML forms - - HTML input tag - - Input - - MakeBrowserAgnostic - - NeedsTranslation - - Reference - - TopicStub - - Web -translation_of: Web/HTML/Element/input ---- -
{{HTMLRef}}
- -

The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and {{Glossary("user agent")}}. The <input> element is one of the most powerful and complex in all of HTML due to the sheer number of combinations of input types and attributes.

- -
{{EmbedInteractiveExample("pages/tabbed/input-text.html", "tabbed-shorter")}}
- - - -

<input> types

- -

How an <input> works varies considerably depending on the value of its {{htmlattrxref("type", "input")}} attribute, hence the different types are covered in their own separate reference pages. If this attribute is not specified, the default type adopted is text.

- -

The available types are as follows:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TypeDescriptionBasic ExamplesSpec
{{HTMLElement("input/button", "button")}}A push button with no default behavior displaying the value of the {{anch('htmlattrdefvalue', 'value')}} attribute, empty by default. - - {{EmbedLiveSample("examplebutton",200,55,"","", "nobutton")}}
{{HTMLElement("input/checkbox", "checkbox")}}A check box allowing single values to be selected/deselected. - - {{EmbedLiveSample("examplecheckbox",200,55,"","", "nobutton")}}
{{HTMLElement("input/color", "color")}}A control for specifying a color; opening a color picker when active in supporting browsers. - - {{EmbedLiveSample("examplecolor",200,55,"","", "nobutton")}}{{HTMLVersionInline("5")}}
{{HTMLElement("input/date", "date")}}A control for entering a date (year, month, and day, with no time). Opens a date picker or numeric wheels for year, month, day when active in supporting browsers. - - {{EmbedLiveSample("exampledate",200,55,"","", "nobutton")}}{{HTMLVersionInline("5")}}
{{HTMLElement("input/datetime-local", "datetime-local")}}A control for entering a date and time, with no time zone. Opens a date picker or numeric wheels for date- and time-components when active in supporting browsers. - - {{EmbedLiveSample("exampledtl",200,55,"","", "nobutton")}}{{HTMLVersionInline("5")}}
{{HTMLElement("input/email", "email")}}A field for editing an email address. Looks like a text input, but has validation parameters and relevant keyboard in supporting browsers and devices with dynamic keyboards. - - {{EmbedLiveSample("exampleemail",200,55,"","", "nobutton")}}{{HTMLVersionInline("5")}}
{{HTMLElement("input/file", "file")}}A control that lets the user select a file. Use the {{anch('htmlattrdefaccept', 'accept')}} attribute to define the types of files that the control can select. - - {{EmbedLiveSample("examplefile",'100%',55,"","", "nobutton")}}
{{HTMLElement("input/hidden", "hidden")}}A control that is not displayed but whose value is submitted to the server. There is an example in the next column, but it's hidden!
{{HTMLElement("input/image", "image")}}A graphical submit button. Displays an image defined by the src attribute. The {{anch('htmlattrdefalt', 'alt')}} attribute displays if the image {{anch('htmlattrdefsrc', 'src')}} is missing. - - {{EmbedLiveSample("exampleimage",200,55,"","", "nobutton")}}
{{HTMLElement("input/month", "month")}}A control for entering a month and year, with no time zone. - - {{EmbedLiveSample("examplemonth",200,55,"","", "nobutton")}}{{HTMLVersionInline("5")}}
{{HTMLElement("input/number", "number")}}A control for entering a number. Displays a spinner and adds default validation when supported. Displays a numeric keypad in some devices with dynamic keypads. - - {{EmbedLiveSample("examplenumber",200,55,"","", "nobutton")}}{{HTMLVersionInline("5")}}
{{HTMLElement("input/password", "password")}}A single-line text field whose value is obscured. Will alert user if site is not secure. - - {{EmbedLiveSample("examplepassword",200,55,"","", "nobutton")}}
{{HTMLElement("input/radio", "radio")}}A radio button, allowing a single value to be selected out of multiple choices with the same {{anch('htmlattrdefname', 'name')}} value. - - {{EmbedLiveSample("exampleradio",200,55,"","", "nobutton")}}
{{HTMLElement("input/range", "range")}}A control for entering a number whose exact value is not important. Displays as a range widget defaulting to the middle value. Used in conjunction {{anch('htmlattrdefmin', 'min')}} and {{anch('htmlattrdefmax', 'max')}} to define the range of acceptable values. - - {{EmbedLiveSample("examplerange",200,55,"","", "nobutton")}}{{HTMLVersionInline("5")}}
{{HTMLElement("input/reset", "reset")}}A button that resets the contents of the form to default values. Not recommended. - - {{EmbedLiveSample("examplereset",200,55,"","", "nobutton")}}
{{HTMLElement("input/search", "search")}}A single-line text field for entering search strings. Line-breaks are automatically removed from the input value. May include a delete icon in supporting browsers that can be used to clear the field. Displays a search icon instead of enter key on some devices with dynamic keypads. - - {{EmbedLiveSample("examplesearch",200,55,"","", "nobutton")}}{{HTMLVersionInline("5")}}
{{HTMLElement("input/submit", "submit")}}A button that submits the form. - - {{EmbedLiveSample("examplesubmit",200,55,"","", "nobutton")}}
{{HTMLElement("input/tel", "tel")}}A control for entering a telephone number. Displays a telephone keypad in some devices with dynamic keypads. - - {{EmbedLiveSample("exampletel",200,55,"","", "nobutton")}}{{HTMLVersionInline("5")}}
{{HTMLElement("input/text", "text")}}The default value. A single-line text field. Line-breaks are automatically removed from the input value. - - {{EmbedLiveSample("exampletext",200,55,"","", "nobutton")}}
{{HTMLElement("input/time", "time")}}A control for entering a time value with no time zone. - - {{EmbedLiveSample("exampletime",200,55,"","", "nobutton")}}{{HTMLVersionInline("5")}}
{{HTMLElement("input/url", "url")}}A field for entering a URL. Looks like a text input, but has validation parameters and relevant keyboard in supporting browsers and devices with dynamic keyboards. - - {{EmbedLiveSample("exampleurl",200,55,"","", "nobutton")}}{{HTMLVersionInline("5")}}
{{HTMLElement("input/week", "week")}}A control for entering a date consisting of a week-year number and a week number with no time zone. - - {{EmbedLiveSample("exampleweek",200,55,"","", "nobutton")}}{{HTMLVersionInline("5")}}
Obsolete values
{{HTMLElement("input/datetime", "datetime")}}{{deprecated_inline}} {{obsolete_inline}} A control for entering a date and time (hour, minute, second, and fraction of a second) based on UTC time zone. - - {{EmbedLiveSample("exampledatetime",200,75,"","", "nobutton")}}{{HTMLVersionInline("5")}}
- -

Attributes

- -

The <input> element is so powerful because of its attributes; the {{htmlattrxref("type", "input")}} attribute, described with examples above, being the most important. Since every <input> element, regardless of type, is based on the {{domxref("HTMLInputElement")}} interface, they technically share the exact same set of attributes. However, in reality, most attributes have an effect on only a specific subset of input types. In addition, the way some attributes impact an input depends on the input type, impacting different input types in different ways.

- -

This section provides a table listing all the attributes with a brief description. This table is followed by a list describing each attribute in greater detail, along with which input types they are associated with.Those that are common to most or all input types are defined in greater detail below. Attributes that are unique to particular input types—or attributes which are common to all input types but have special behaviors when used on a given input type—are instead documented on those types' pages. This element includes the global attributes. Those with extra importance as it relates to <input> are highlighted.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Attributes for the {{htmlelement('input')}} element include global HTML attributes and:
AttributeType or TypesDescription
{{anch('htmlattrdefaccept', 'accept')}}fileHint for expected file type in file upload controls
{{anch('htmlattrdefalt', 'alt')}}imagealt attribute for the image type. Required for accessibility
{{anch('htmlattrdefautocomplete', 'autocomplete')}}allHint for form autofill feature
{{anch('htmlattrdefautofocus', 'autofocus')}}allAutomatically focus the form control when the page is loaded
{{anch('htmlattrdefcapture', 'capture')}}fileMedia capture input method in file upload controls
{{anch('htmlattrdefchecked', 'checked')}}radio, checkboxWhether the command or control is checked
{{anch('htmlattrdefdirname', 'dirname')}}text, searchName of form field to use for sending the element's directionality in form submission
{{anch('htmlattrdefdisabled', 'disabled')}}allWhether the form control is disabled
{{anch('htmlattrdefform', 'form')}}allAssociates the control with a form element
{{anch('htmlattrdefformaction', 'formaction')}}image, submitURL to use for form submission
{{anch('htmlattrdefformenctype', 'formenctype')}}image, submitForm data set encoding type to use for form submission
{{anch('htmlattrdefformmethod', 'formmethod')}}image, submitHTTP method to use for form submission
{{anch('htmlattrdefformnovalidate', 'formnovalidate')}}image, submitBypass form control validation for form submission
{{anch('htmlattrdefformtarget', 'formtarget')}}image, submitBrowsing context for form submission
{{anch('htmlattrdefheight', 'height')}}imageSame as height attribute for {{htmlelement('img')}}; vertical dimension
{{anch('htmlattrdeflist', 'list')}}almost allValue of the id attribute of the {{htmlelement('datalist')}} of autocomplete options
{{anch('htmlattrdefmax', 'max')}}numeric typesMaximum value
{{anch('htmlattrdefmaxlength', 'maxlength')}}password, search, tel, text, urlMaximum length (number of characters) of value
{{anch('htmlattrdefmin', 'min')}}numeric typesMinimum value
{{anch('htmlattrdefminlength', 'minlength')}}password, search, tel, text, urlMinimum length (number of characters) of value
{{anch('htmlattrdefmultiple', 'multiple')}}email, fileBoolean. Whether to allow multiple values
{{anch('htmlattrdefname', 'name')}}allName of the form control. Submitted with the form as part of a name/value pair.
{{anch('htmlattrdefpattern', 'pattern')}}password, text, telPattern the value must match to be valid
{{anch('htmlattrdefplaceholder', 'placeholder')}}password, search, tel, text, urlText that appears in the form control when it has no value set
readonlyalmost allBoolean. The value is not editable
requiredalmost allBoolean. A value is required or must be check for the form to be submittable
{{anch('htmlattrdefsize', 'size')}}email, password, tel, textSize of the control
{{anch('htmlattrdefsrc', 'src')}}imageSame as src attribute for {{htmlelement('img')}}; address of image resource
{{anch('htmlattrdefstep', 'step')}}numeric typesIncremental values that are valid.
{{anch('htmlattrdeftype', 'type')}}allType of form control
{{anch('htmlattrdefvalue', 'value')}}allCurrent value of the form control. Submitted with the form as part of a name/value pair.
{{anch('htmlattrdefwidth', 'width')}}imageSame as width attribute for {{htmlelement('img')}}
- -

A few additional non-standard attributes are listed following the descriptions of the standard attributes.

- -

Individual attributes

- -
-
{{htmlattrdef("accept")}}
-
-

Valid for the file input type only, the accept attribute defines which file types are selectable in a file upload control. See the {{HTMLElement("input/file", "file")}} input type.

-
-
{{htmlattrdef("alt")}}
-
-

Valid for the image button only, the alt attribute provides alternative text for the image, displaying the value of the attribute if the image src is missing or otherwise fails to load. See the {{HTMLElement("input/image", "image")}} input type.

-
-
{{htmlattrdef("autocomplete")}}
-
-

(Not a Boolean attribute!) The autocomplete attribute takes as its value a space-separated string that describes what, if any, type of autocomplete functionality the input should provide. A typical implementation of autocomplete simply recalls previous values entered in the same input field, but more complex forms of autocomplete can exist. For instance, a browser could integrate with a device's contacts list to autocomplete email addresses in an email input field. See {{SectionOnPage("/en-US/docs/Web/HTML/Attributes/autocomplete", "Values")}} for permitted values.

- -

The autocomplete attribute is valid on hidden, text, search, url, tel, email, date, month, week, time, datetime-local, number, range, color, and password. This attribute has no effect on input types that do not return numeric or text data, being valid for all input types except checkbox, radio, file, or any of the button types.

- -

See The HTML autocomplete attribute for additional information, including information on password security and how autocomplete is slightly different for hidden than for other input types.

-
-
{{htmlattrdef("autofocus")}}
-
-

A Boolean attribute which, if present, indicates that the input should automatically have focus when the page has finished loading (or when the {{HTMLElement("dialog")}} containing the element has been displayed).

- -
-

Note: An element with the autofocus attribute may gain focus before the {{domxref("DOMContentLoaded")}} event is fired.

-
- -

No more than one element in the document may have the autofocus attribute. If put on more than one element, the first one with the attribute receives focus.

- -

The autofocus attribute cannot be used on inputs of type hidden, since hidden inputs cannot be focused.

- -
-

Warning: Automatically focusing a form control can confuse visually-impaired people using screen-reading technology and people with cognitive impairments. When autofocus is assigned, screen-readers "teleport" their user to the form control without warning them beforehand.

-
- -

Use careful consideration for accessibility when applying the autofocus attribute. Automatically focusing on a control can cause the page to scroll on load. The focus can also cause dynamic keyboards to display on some touch devices. While a screen reader will announce the label of the form control receiving focus, the screen reader will not announce anything before the label, and the sighted user on a small device will equally miss the context created by the preceding content.

-
-
{{htmlattrdef("capture")}}
-
-

Introduced in the HTML Media Capture specification and valid for the file input type only, the capture attribute defines which media—microphone, video, or camera—should be used to capture a new file for upload with file upload control in supporting scenarios. See the {{HTMLElement("input/file", "file")}} input type.

-
-
{{htmlattrdef("checked")}}
-
-

Valid for both radio and checkbox types, checked is a Boolean attribute. If present on a radio type, it indicates that that radio button is the currently selected one in the group of same-named radio buttons. If present on a checkbox type, it indicates that the checkbox is checked by default (when the page loads). It does not indicate whether this checkbox is currently checked: if the checkbox’s state is changed, this content attribute does not reflect the change. (Only the HTMLInputElement’s checked IDL attribute is updated.)

- -
-

Note: Unlike other input controls, a checkboxes and radio buttons value are only included in the submitted data if they are currently checked. If they are, the name and the value(s) of the checked controls are submitted.

- -

For example, if a checkbox whose name is fruit has a value of cherry, and the checkbox is checked, the form data submitted will include fruit=cherry. If the checkbox isn't active, it isn't listed in the form data at all. The default value for checkboxes and radio buttons is on.

-
-
-
{{htmlattrdef("dirname")}}
-
-

Valid for text and search input types only, the dirname attribute enables the submission of the directionality of the element. When included, the form control will submit with two name/value pairs: the first being the name and value, the second being the value of the dirname as the name with the value of ltr or rtl being set by the browser.

- -
<form action="page.html" method="post">
-  <label>Fruit: <input type="text" name="fruit" dirname="fruit.dir" value="cherry"></label>
-  <input type="submit"/>
-</form>
-<!-- page.html?fruit=cherry&fruit.dir=ltr -->
-
- -

When the form above is submitted, the input cause both the name / value pair of fruit=cherry and the dirname / direction pair of fruit.dir=ltr to be sent.

-
-
{{htmlattrdef("disabled")}}
-
-

A Boolean attribute which, if present, indicates that the user should not be able to interact with the input. Disabled inputs are typically rendered with a dimmer color or using some other form of indication that the field is not available for use.

- -

Specifically, disabled inputs do not receive the {{domxref("Element/click_event", "click")}} event, and disabled inputs are not submitted with the form.

- -
-

Note: Although not required by the specification, Firefox will by default persist the dynamic disabled state of an <input> across page loads. Use the {{htmlattrxref("autocomplete","input")}} attribute to control this feature.

-
-
-
{{htmlattrdef("form")}}
-
-

A string specifying the {{HTMLElement("form")}} element with which the input is associated (that is, its form owner). This string's value, if present, must match the {{htmlattrxref("id")}} of a <form> element in the same document. If this attribute isn't specified, the <input> element is associated with the nearest containing form, if any.

- -

The form attribute lets you place an input anywhere in the document but have it included with a form elsewhere in the document.

- -
-

Note: An input can only be associated with one form.

-
-
-
{{htmlattrdef('formaction')}}
-
-

Valid for the image and submit input types only. See the {{HTMLElement("input/submit", "submit")}} input type for more information.

-
-
{{htmlattrdef('formenctype')}}
-
-

Valid for the image and submit input types only. See the {{HTMLElement("input/submit", "submit")}} input type for more information.

-
-
{{htmlattrdef('formmethod')}}
-
-

Valid for the image and submit input types only. See the {{HTMLElement("input/submit", "submit")}} input type for more information.

-
-
{{htmlattrdef('formnovalidate')}}
-
-

Valid for the image and submit input types only. See the {{HTMLElement("input/submit", "submit")}} input type for more information.

-
-
{{htmlattrdef('formtarget')}}
-
-

Valid for the image and submit input types only. See the {{HTMLElement("input/submit", "submit")}} input type for more information.

-
-
{{htmlattrdef("height")}}
-
-

Valid for the image input button only, the height is the height of the image file to display to represent the graphical submit button. See the {{HTMLElement("input/image", "image")}} input type.

-
-
{{htmlattrdef("id")}}
-
-

Global attribute valid for all elements, including all the input types, it defines a unique identifier (ID) which must be unique in the whole document. Its purpose is to identify the element when linking. The value is used as the value of the {{htmlelement('label')}}'s for attribute to link the label with the form control. See {{htmlelement('label')}}.

-
-
{{htmlattrdef("inputmode")}}
-
-

Global value valid for all elements, it provides a hint to browsers as to the type of virtual keyboard configuration to use when editing this element or its contents. Values include none, text, tel, url, email, numeric, decimal, and search.

-
-
{{htmlattrdef("list")}}
-
-

The value given to the list attribute should be. the {{domxref("Element.id", "id")}} of a {{HTMLElement("datalist")}} element located in the same document. The <datalist> provides a list of predefined values to suggest to the user for this input. Any values in the list that are not compatible with the {{htmlattrxref("type", "input")}} are not included in the suggested options. The values provided are suggestions, not requirements: users can select from this predefined list or provide a different value.

- - - -

{{EmbedLiveSample("datalist",400,275,"","", "nobutton")}}

- -

It is valid on text, search, url, tel, email, date, month, week, time, datetime-local, number, range, and color.

- -

Per the specifications, the list attribute is not supported by the hidden, password, checkbox, radio, file, or any of the button types.

- -

Depending on the browser, the user may see a custom color palette suggested, tic marks along a range, or even a input that opens like a {{HTMLElement("select")}} but allows for non-listed values. Check out the browser compatibility table for the other input types.

- -

See the {{htmlelement('datalist')}} element.

-
-
{{htmlattrdef("max")}}
-
-

Valid for date, month, week, time, datetime-local, number, and range, it defines the greatest value in the range of permitted values. If the {{htmlattrxref("value", "input")}} entered into the element exceeds this, the element fails constraint validation. If the value of the max attribute isn't a number, then the element has no maximum value.

- -

There is a special case: if the data type is periodic (such as for dates or times), the value of max may be lower than the value of min, which indicates that the range may wrap around; for example, this allows you to specify a time range from 10 PM to 4 AM.

-
-
{{htmlattrdef("maxlength")}}
-
-

Valid for text, search, url, tel, email, and password, it defines the maximum number of characters (as UTF-16 code units) the user can enter into the field. This must be an integer value 0 or higher. If no maxlength is specified, or an invalid value is specified, the field has no maximum length. This value must also be greater than or equal to the value of minlength.

- -

The input will fail constraint validation if the length of the text entered into the field is greater than maxlength UTF-16 code units long. By default, browsers prevent users from entering more characters than allowed by the maxlength attribute. See {{anch("Client-side validation")}} for more information.

-
-
{{htmlattrdef("min")}}
-
-

Valid for date, month, week, time, datetime-local, number, and range, it defines the most negative value in the range of permitted values. If the {{htmlattrxref("value", "input")}} entered into the element is less than this this, the element fails constraint validation. If the value of the min attribute isn't a number, then the element has no minimum value.

- -

This value must be less than or equal to the value of the max attribute. If the min attribute is present but is not specified or is invalid, no min value is applied. If the min attribute is valid and a non-empty value is less than the minimum allowed by the min attribute, constraint validation will prevent form submission. See {{anch("Client-side validation")}} for more information.

- -

There is a special case: if the data type is periodic (such as for dates or times), the value of max may be lower than the value of min, which indicates that the range may wrap around; for example, this allows you to specify a time range from 10 PM to 4 AM.

-
-
{{htmlattrdef("minlength")}}
-
-

Valid for text, search, url, tel, email, and password, it defines the minimum number of characters (as UTF-16 code units) the user can enter into the entry field. This must be an non-negative integer value smaller than or equal to the value specified by maxlength. If no minlength is specified, or an invalid value is specified, the input has no minimum length.

- -

The input will fail constraint validation if the length of the text entered into the field is fewer than minlength UTF-16 code units long, preventing form submission. See {{anch("Client-side validation")}} for more information.

-
-
{{htmlattrdef("multiple")}}
-
-

The Boolean multiple attribute, if set, means the user can enter comma separated email addresses in the email widget or can choose more than one file with the file input. See the {{HTMLElement("input/email", "email")}} and {{HTMLElement("input/file", "file")}} input type.

-
-
{{htmlattrdef("name")}}
-
-

A string specifying a name for the input control. This name is submitted along with the control's value when the form data is submitted.

- -
What's in a name
- -

Consider the name a required attribute (even though it's not). If an input has no name specified, or name is empty, the input's value is not submitted with the form! (Disabled controls, unchecked radio buttons, unchecked checkboxes, and reset buttons are also not sent.)

- -

There are two special cases:

- -
    -
  1. _charset_ : If used as the name of an <input> element of type {{HTMLElement("input/hidden", "hidden")}}, the input's value is automatically set by the {{Glossary("user agent")}} to the character encoding being used to submit the form.
  2. -
  3. isindex: For historical reasons, the name isindex is not allowed.
  4. -
- -
name and radio buttons
- -

The name attribute creates a unique behavior for radio buttons.

- -

Only one radio button in a same-named group of radio buttons can be checked at a time. Selecting any radio button in that group automatically deselects any currently-selected radio button in the same group. The value of that one checked radio button is sent along with the name if the form is submitted,

- -

When tabbing into a series of same-named group of radio buttons, if one is checked, that one will receive focus. If they aren't grouped together in source order, if one of the group is checked, tabbing into the group starts when the first one in the group is encountered, skipping all those that aren't checked. In other words, if one is checked, tabbing skips the unchecked radio buttons in the group. If none are checked, the radio button group receives focus when the first button in the same name group is reached.

- -

Once one of the radio buttons in a group has focus, using the arrow keys will navigate through all the radio buttons of the same name, even if the radio buttons are not grouped together in the source order.

- -
HTMLFormElement.elements
- -

When an input element is given a name, that name becomes a property of the owning form element's {{domxref("HTMLFormElement.elements")}} property. If you have an input whose name is set to guest and another whose name is hat-size, the following code can be used:

- -
let form = document.querySelector("form");
-
-let guestName = form.elements.guest;
-let hatSize = form.elements["hat-size"];
-
- -

When this code has run, guestName will be the {{domxref("HTMLInputElement")}} for the guest field, and hatSize the object for the hat-size field.

- -
-

Warning: Avoid giving form elements a name that corresponds to a built-in property of the form, since you would then override the predefined property or method with this reference to the corresponding input.

-
-
-
{{htmlattrdef("pattern")}}
-
-
-

The pattern attribute, when specified, is a regular expression that the input's {{htmlattrxref("value")}} must match in order for the value to pass constraint validation. It must be a valid JavaScript regular expression, as used by the {{jsxref("RegExp")}} type, and as documented in our guide on regular expressions; the 'u' flag is specified when compiling the regular expression, so that the pattern is treated as a sequence of Unicode code points, instead of as ASCII. No forward slashes should be specified around the pattern text.

- -

If the pattern attribute is present but is not specified or is invalid, no regular expression is applied and this attribute is ignored completely. If the pattern attribute is valid and a non-empty value does not match the pattern, constraint validation will prevent form submission.

- -
-

Tip: If using the pattern attribute, inform the user about the expected format by including explanatory text nearby. You can also include a {{htmlattrxref("title", "input")}} attribute to explain what the requirements are to match the pattern; most browsers will display this title as a tooltip. The visible explanation is required for accessibility. The tooltip is an enhancement.

-
-
- -

See {{anch("Client-side validation")}} for more information.

-
-
{{htmlattrdef("placeholder")}}
-
-

The placeholder attribute is a string that provides a brief hint to the user as to what kind of information is expected in the field. It should be a word or short phrase that provides a hint as to the expected type of data, rather than an explanation or prompt. The text must not include carriage returns or line feeds. So for example if a field is expected to capture a user's first name, and its label is "First Name", a suitable placeholder might be "e.g. Mustafa".

- -
-

Note: The placeholder attribute is not as semantically useful as other ways to explain your form, and can cause unexpected technical issues with your content. See {{SectionOnPage("/en-US/docs/Web/HTML/Element/input", "Labels")}} for more information.

-
-
-
{{htmlattrdef("readonly")}}
-
-

A Boolean attribute which, if present, indicates that the user should not be able to edit the value of the input. The readonly attribute is supported text, search, url, tel, email, date, month, week, time, datetime-local, number, and password input types.

- -

See the HTML attribute: readonly for more information.

-
-
{{htmlattrdef("required")}}
-
-

required is a Boolean attribute which, if present, indicates that the user must specify a value for the input before the owning form can be submitted. The required attribute is supported text, search, url, tel, email, date, month, week, time, datetime-local, number, password, checkbox, radio, and file.

- -

See {{anch("Client-side validation")}} and the HTML attribute: required for more information.

-
-
{{htmlattrdef("size")}}
-
Valid for email, password, tel, and text input types only. Specifies how much of the input is shown. Basically creates same result as setting CSS width property with a few specialities. The actual unit of the value depends on the input type. For password and text, it is a number of characters (or em units) with a default value of 20, and for others, it is pixels. CSS width takes precedence over size attribute.
-
{{htmlattrdef("src")}}
-
-

Valid for the image input button only, the src is string specifying the URL of the image file to display to represent the graphical submit button. See the {{HTMLElement("input/image", "image")}} input type.

-
-
{{htmlattrdef("step")}}
-
-
-

Valid for the numeric input types, including number, date/time input types, and range, the step attribute is a number that specifies the granularity that the value must adhere to.

- -

If not explicitly included, step defaults to 1 for number and range, and 1 unit type (second, week, month, day) for the date/time input types. The value can must be a positive number—integer or float—or the special value any, which means no stepping is implied, and any value is allowed (barring other constraints, such as {{anch("min")}} and {{anch("max")}}).

- -

If any is not explicity set, valid values for the number, date/time input types, and range input types are equal to the basis for stepping - the {{anch("min")}} value and increments of the step value, up to the {{anch("max")}} value, if specified.

- -

For example, if you have <input type="number" min="10" step="2">, then any even integer, 10 or greater, is valid. If omitted, <input type="number">, any integer is valid, but floats (like 4.2) are not valid, because step defaults to 1. For 4.2 to be valid, step would have had to be set to any, 0.1, 0.2, or any the min value would have had to be a number ending in .2, such as <input type="number" min="-5.2">

- -
-

Note: When the data entered by the user doesn't adhere to the stepping configuration, the value is considered invalid in contraint validation and will match the :invalid pseudoclass.

-
-
- -

The step attribute is expressed in seconds. The step scale factor is 1000 (which converts the seconds to milliseconds, as used in the other algorithms). The default step is 60 seconds.

- -

See {{anch("Client-side validation")}} for more information.

-
-
{{htmlattrdef("tabindex")}}
-
-

Global attribute valid for all elements, including all the input types, an integer attribute indicating if the element can take input focus (is focusable), if it should participate to sequential keyboard navigation. As all input types except for input of type hidden are focusable, this attribute should not be used on form controls, because doing so would require the management of the focus order for all elements within the document with the risk of harming usability and accessibility if done incorrectly.

-
-
{{htmlattrdef('title')}}
-
-

Global attribute valid for all elements, including all input types, containing a text representing advisory information related to the element it belongs to. Such information can typically, but not necessarily, be presented to the user as a tooltip. The title should NOT be used as the primary explanation of the purpose of the form control. Instead, use the {{htmlelement('label')}} element with a for attribute set to the form control's {{htmlattrdef('id')}} attribute. See {{anch("Labels")}} below.

-
-
{{htmlattrdef("type")}}
-
-

A string specifying the type of control to render. For example, to create a checkbox, a value of checkbox is used. If omitted (or an unknown value is specified), the input type text is used, creating a plaintext input field.

- -

Permitted values are listed in {{anch("<input> types", "<input> types")}} above.

-
-
{{htmlattrdef("value")}}
-
-

The input control's value. When specified in the HTML, this is the initial value, and from then on it can be altered or retrieved at any time using JavaScript to access the respective {{domxref("HTMLInputElement")}} object's value property. The value attribute is always optional, though should be considered mandatory for checkbox, radio, and hidden.

-
-
{{htmlattrdef("width")}}
-
-

Valid for the image input button only, the width is the width of the image file to display to represent the graphical submit button. See the {{HTMLElement("input/image", "image")}} input type.

-
-
- -

Non-standard attributes

- -

The following non-standard attributes are also available on some browsers. As a general rule, you should avoid using them unless it can't be helped.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeDescription
{{anch("autocorrect")}}A string indicating whether or not autocorrect is on or off. Safari only.
{{anch("incremental")}}Whether or not to send repeated {{domxref("HTMLInputElement/search_event", "search")}} events to allow updating live search results while the user is still editing the value of the field. WebKit and Blink only (Safari, Chrome, Opera, etc.).
{{anch("mozactionhint")}}A string indicating the type of action that will be taken when the user presses the Enter or Return key while editing the field; this is used to determine an appropriate label for that key on a virtual keyboard. Firefox for Android only.
{{anch("orient")}}Sets the orientation of the range slider. Firefox only.
{{anch("results")}}The maximum number of items that should be displayed in the drop-down list of previous search queries. Safari only.
{{anch("webkitdirectory")}}A Boolean indicating whether or not to only allow the user to choose a directory (or directories, if {{anch("multiple")}} is also present)
- -
-
{{htmlattrdef("autocorrect")}} {{non-standard_inline}}
-
{{page("/en-US/docs/Web/HTML/Element/input/text", "autocorrect-include")}}
-
{{htmlattrdef("incremental")}} {{non-standard_inline}}
-
{{page("/en-US/docs/Web/HTML/Element/input/search", "incremental-include")}}
-
{{htmlattrdef("mozactionhint")}} {{non-standard_inline}}
-
{{page("/en-US/docs/Web/HTML/Element/input/text", "mozactionhint-include")}}
-
{{htmlattrdef("orient")}} {{non-standard_inline}}
-
{{page("/en-US/docs/Web/HTML/Element/input/range", "orient-include")}}
-
{{htmlattrdef("results")}} {{non-standard_inline}}
-
{{page("/en-US/docs/Web/HTML/Element/input/search", "results-include")}}
-
{{htmlattrdef("webkitdirectory")}} {{non-standard_inline}}
-
{{page("/en-US/docs/Web/HTML/Element/input/file", "webkitdirectory-include")}}
-
- -

Methods

- -

The following methods are provided by the {{domxref("HTMLInputElement")}} interface which represents <input> elements in the DOM. Also available are those methods specified by the parent interfaces, {{domxref("HTMLElement")}}, {{domxref("Element")}}, {{domxref("Node")}}, and {{domxref("EventTarget")}}.

- -
-
{{domxref("HTMLInputElement.checkValidity", "checkValidity()")}}
-
Immediately runs the validity check on the element, triggering the document to fire the {{domxref("HTMLInputElement.invalid_event", "invalid")}} event at the element if the value isn't valid.
-
{{domxref("HTMLFormElement.reportValidity", "reportValidity()")}}
-
Returns true if the element's value passes validity checks; otherwise, returns false.
-
{{domxref("HTMLInputElement.select", "select()")}}
-
Selects the entire content of the <input> element, if the element's content is selectable. For elements with no selectable text content (such as a visual color picker or calendar date input), this method does nothing.
-
{{domxref("HTMLInputElement.setCustomValidity", "setCustomValidity()")}}
-
Sets a custom message to display if the input element's value isn't valid.
-
{{domxref("HTMLInputElement.setRangeText", "setRangeText()")}}
-
Sets the contents of the specified range of characters in the input element to a given string. A selectMode parameter is available to allow controlling how the existing content is affected.
-
{{domxref("HTMLInputElement.setSelectionRange", "setSelectionRange()")}}
-
Selects the specified range of characters within a textual input element. Does nothing for inputs which aren't presented as text input fields.
-
{{domxref("HTMLInputElement.stepDown", "stepDown()")}}
-
Decrements the value of a numeric input by one, by default, or by the specified number of units.
-
{{domxref("HTMLInputElement.stepUp", "stepUp()")}}
-
Increments the value of a numeric input by one or by the specified number of units.
-
- -

CSS

- -

Inputs, being replaced elements, have a few features not applicable to non form elements. There are CSS selectors that can specification target form controls based on their UI features, also known as UI pseudo-classes. The input element can also be targeted by type with attribute selectors. There are some properties that are especially useful as well.

- -

UI pseudo-classes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Captions super relevant to the {{htmlelement("input")}} element:
Pseudo-classDescription
{{Cssxref(":enabled")}}Any currently enabled element that can be activated (selected, clicked on, typed into, etc.) or accept focus and also has a disabled state, in which it can't be activated or accept focus.
{{Cssxref(":disabled")}}Any currently disabled element that has an enabled state, meaing it otherwise could be activated (selected, clicked on, typed into, etc.) or accept focus were it not disabled.
{{Cssxref(":read-only")}}Element not editable by the user
{{Cssxref(":read-write")}}Element that is editable by the user.
{{Cssxref(":placeholder-shown")}}Element that is currently displaying placeholder text, including {{HTMLElement("input")}} and {{HTMLElement("textarea")}} elements with the {{anch('htmlattrdefplaceholder', 'placeholder')}} attribute present that has, as of yet, no value.
{{Cssxref(":default")}}Form elements that are the default in a group of related elements. Matches {{HTMLElement("input/checkbox", "checkbox")}} and {{HTMLElement("input/radio", "radio")}} input types that were checked on page load or render.
{{Cssxref(":checked")}}Matches {{HTMLElement("input/checkbox", "checkbox")}} and {{HTMLElement("input/radio", "radio")}} input types that are currently checked (and the ({{HTMLElement("option")}} in a {{HTMLElement("select")}} that is currently selected).
{{Cssxref(":indeterminate")}}{{HTMLElement("input/checkbox", "checkbox")}} elements whose indeterminate property is set to true by JavaScript, {{HTMLElement("input/radio", "radio")}} elements, when all radio buttons with the same name value in the form are unchecked, and {{HTMLElement("progress")}} elements in an indeterminate state
{{Cssxref(":valid")}}Form controls that can have constraint validation applied and are currently valid.
{{Cssxref(":invalid")}}Form controls that have constraint validation applied and are currently not valid. Matches a form control whose value doesn't match the constraints set on it by it's attributes, such as {{anch('htmlattrdefrequired', 'required')}}, {{anch('htmlattrdefpattern', 'pattern')}} , {{anch('htmlattrdefstep', 'step')}} and {{anch('htmlattrdefmax', 'max')}}.
{{Cssxref(":in-range")}}A non-empty input whose current value is within the range limits specified by the {{anch('htmlattrdefmin', 'min')}} and {{anch('htmlattrdefmax', 'max')}} attributes and the {{anch('htmlattrdefstep', 'step')}} .
{{Cssxref(":out-of-range")}}A non-empty input whose current value is NOT within the range limits specified by the {{anch('htmlattrdefmin', 'min')}} and {{anch('htmlattrdefmax', 'max')}} attributes or does not adher to the {{anch('htmlattrdefstep', 'step')}} constraint.
{{Cssxref(":required")}}{{HTMLElement("input")}}, {{HTMLElement("select")}}, or {{HTMLElement("textarea")}} element that has the {{ htmlattrxref("required", "input")}} attribute set on it. Only matches elements that can be required. The attribute included on a non-requirable element will not make for a match.
{{Cssxref(":optional")}}{{HTMLElement("input")}}, {{HTMLElement("select")}}, or {{HTMLElement("textarea")}} element that does NOT have the {{ htmlattrxref("required", "input")}} attribute set on it. Does not match elements that can't be required.
{{Cssxref(":blank")}}{{HTMLElement("input")}} and {{HTMLElement("textarea")}} elements that currently have no value.
{{Cssxref(":user-invalid")}}Similar to :invalid, but is activated on blur. Matches invalid input but only after the user interaction, such as by focusing on the control, leaving the control, or attempting to submit the form containing the invalid control.
- -

Examples

- -

We can style a checkbox label based on whether the checkbox is checked or not. In this example, we are styling the {{cssxref('color')}} and {{cssxref('font-weight')}} of the {{htmlelement('label')}} that comes immediately after a checked input. We haven't applied any styles if the input is not checked.

- -
- - -
input:checked + label {
-  color: red;
-  font-weight: bold;
-}
-
- -

{{EmbedLiveSample('checkbox_label', 500, 80)}}

-
- -

Attribute selectors

- -

It is possible to target different types of form controls based on their {{anch('htmlattrdeftype', 'type')}} using attribute selectors. CSS attribute selectors match elements based on either just the presence of a attribute or the value of a given attribute.

- -
/* matches a password input */
-input[type="password"] {}
-
-/* matches a form control whose valid values are limited to a range of values*/
-input[min][max] {}
-
-/* matches a form control with with a pattern attribute */
- input[pattern] {}
- -

::placeholder

- -

By default, the appearance of placeholder text is a translucent or light gray. The {{cssxref('::placeholder')}} pseudo-element is the input's placeholder text. It can be styled with a limited subset of CSS properties.

- -
::placeholder {
-  color: blue;
-}
- -

Only the subset of CSS properties that apply to the {{cssxref("::first-line")}} pseudo-element can be used in a rule using ::placeholder in its selector.

- -

appearance

- -

The {{cssxref("appearance")}} property enables the displaying of (almost) any element as a platform-native style based on the operating system's theme as well as the removal of any platform-native styling with the none value.

- -

You could make a <div> look like a radio button with div {appearance: radio;} or a radio look like a checkbox with [type="checkbox] {appearance: checkbox;}, but don't.

- -

Setting appearance: none removes platform native borders, but not functionality.

- -

caret-color

- -

A property specific to text entry-related elements is the CSS {{cssxref("caret-color")}} property, which lets you set the color used to draw the text input caret:

- -

HTML

- -
<label for="textInput">Note the red caret:</label>
-<input id="textInput" class="custom" size="32">
-
- -

CSS

- -
input.custom {
-  caret-color: red;
-  font: 16px "Helvetica", "Arial", "sans-serif"
-}
-
- -

Result

- -

{{EmbedLiveSample('caret-color', 500, 80)}}

- -

object-position and object-fit

- -

In certain cases (typically involving non-textual inputs and specialized interfaces), the <input> element is a replaced element. When it is, the position and size of the element's size and positioning within its frame can be adjusted using the CSS {{cssxref("object-position")}} and {{cssxref("object-fit")}} properties

- -

Styling

- -

For more information about adding color to elements in HTML, see:

- - - -

Also see:

- - - -

Additional features

- -

Labels

- -

Labels are needed to associate assistive text with an <input>. The {{HTMLElement("label")}} element provides explanatory information about a form field that is always appropriate (aside from any layout concerns you have). It's never a bad idea to use a <label> to explain what should be entered into an <input> or {{HTMLElement("textarea")}}.

- -

Associated labels

- -

The semantic pairing of <input> and <label> elements is useful for assistive technologies such as screen readers. By pairing them using the <label>'s {{htmlattrxref("for", "label")}} attribute, you bond the label to the input in a way that lets screen readers describe inputs to users more precisely.

- -

It does not suffice to have plain text adjacent to the <input> element,. Rather, usability and accessibility requires the inclusion of either implicit or explicit {{HTMLElement("label")}}:

- -
<!-- inaccessible -->
-<p>Enter your name: <input id="name" type="text" size="30"></p>
-
-<!-- implicit label -->
-<p><label>Enter your name: <input id="name" type="text" size="30"></label></p>
-
-<!-- explicit label -->
-<p><label for="name">Enter your name: </label><input id="name" type="text" size="30"></p>
- -

The first example is inaccessible: no relationship exists between the prompt and the <input> element.

- -

In addition to an accessible name, the label provides a larger 'hit' area for mouse and touch screen users to click on or touch. By pairing a <label> with an <input>, clicking on either one will focus the <input>. If you use plain text to "label" your input, this won't happen. Having the prompt part of the activation area for the input is helpful for people with motor control conditions.

- -

As web developers, it's important that we never assume that people will know all the things that we know. The diversity of people using the web—and by extension your web site—practically guarantees that some of your site's visitors will have some variation in thought processes and/or circumstances that leads them to interpret your forms very differently from you without clear and properly-presented labels.

- -

Placeholders are not accessible

- -

The {{htmlattrxref("placeholder", "input")}} attribute lets you specify text that appears within the <input> element's content area itself when it is empty. The placeholder should never be required in order to understand your forms. It is not a label, and should not be used as a substitute, because it isn't. The placeholder is used to provide a hint as to what an inputted value should look like, not an explanation or prompt.

- -

Not only is the placeholder not accessible to screen readers, but once the user enters any text into the form control, or if the form control already has a value, the placeholder disappears. Browsers with automatic page translation features may skip over attributes when translating, meaning the placeholder may not get translated.

- -
-

Don't use the {{htmlattrxref("placeholder", "input")}} attribute if you can avoid it. If you need to label an <input> element, use the {{HTMLElement("label")}} element.

-
- -

Client-side validation

- -
-

Warning: Client-side validation is useful, but it does not guarantee that the server will receive valid data. If the data must be in a specific format, always verify it also on the server-side, and return a 400 HTTP response if the format is invalid.

-
- -

In addition to using CSS to style inputs based on the {{cssxref(":valid")}} or {{cssxref(":invalid")}} UI states based on the current state of each input, as noted in the {{anch('UI pseudo-classes')}} section above, the browser provides for client-side validation on (attempted) form submission. On form submission, if there is a form control that fails constraint validation, supporting browsers will display an error message on the first invalid form control; displaying a default message based on the error type, or a message set by you.

- -

Some input types and other attributes place limits on what values are valid for a given input. For example, <input type="number" min="2" max="10" step="2"> means only the number 2, 4, 6, 8, or 10 are valid. Several errors could occur, including a rangeUnderflow error if the value is less than 2, rangeOverflow if greater than 10, stepMismatch if the value is a number between 2 and 10, but not an even integer (does not match the requirements of the step attribute), or typeMismatch if the value is not a number.

- -

For the input types whose domain of possible values is periodic (that is, at the highest possible value, the values wrap back around to the beginning rather than ending), it's possible for the values of the {{htmlattrxref("max")}} and {{htmlattrxref("min")}} properties to be reversed, which indicates that the range of permitted values starts at min, wraps around to the lowest possible value, then continues on until max is reached. This is particularly useful for dates and times, such as when you want to allow the range to be from 8 PM to 8 AM:

- -
<input type="time" min="20:00" max="08:00" name="overnight">
- -

Specific attributes and their values can lead to a specific error {{domxref('ValidityState')}}:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Validity object errors depend on the {{htmlelement('input')}} attributes and their values:
AttributeRelevent propertyDescription
{{anch('htmlattrdefmax', 'max')}}{{domxref('validityState.rangeOverflow')}}Occurs when the value is greater than the maximum value as defined by the max attribute
{{anch('htmlattrdefmaxlength', 'maxlength')}}{{domxref('validityState.tooLong')}}Occurs when the number of characters is greater than the number allowed by the maxlength property
{{anch('htmlattrdefmin', 'min')}}{{domxref('validityState.rangeUnderflow')}}Occurs when the value is less than the minimum value as defined by the min attribute
{{anch('htmlattrdefminlength', 'minlength')}}{{domxref('validityState.tooShort')}}Occurs when the number of characters is less than the number required by the minlength property
{{anch('htmlattrdefpattern', 'pattern')}}{{domxref('validityState.patternMismatch')}}Occurs when a pattern attribute is included with a valid regular expression and the value does not match it.
{{anch('htmlattrdefrequired', 'required')}}{{domxref('validityState.valueMissing')}}Occurs when the required attribute is present but the value is null or radio or checkbox is not checked.
{{anch('htmlattrdefstep', 'step')}}{{domxref('validityState.stepMismatch')}}The value doesn't match the step increment. Increment default is 1, so only integers are valid on type="number" is step is not included. step="any" will never throw this error.
{{anch('htmlattrdeftyoe', 'type')}}{{domxref('validityState.typeMismatch')}}Occurs when the value is not of the correct type, for example a email does not contain an @ or a url doesn't contain a protocol.
- -

If a form control doesn't have the required attribute, no value, or an empty string, is not invalid. Even if the above attributes are present, with the exception of required, and empty string will not lead to an error.

- -

We can set limits on what values we accept, and supporting browsers will natively validate these form values and alert the user if there is a mistake when the form is submitted.

- -

In addition to the errors described in the table above, the validityState interface contains the badInput, valid, and customError boolean readonly properties. The validity object includes:

- -
    -
  • {{domxref('validityState.valueMissing')}}
  • -
  • {{domxref('validityState.typeMismatch')}}
  • -
  • {{domxref('validityState.patternMismatch')}}
  • -
  • {{domxref('validityState.tooLong')}}
  • -
  • {{domxref('validityState.tooShort')}}
  • -
  • {{domxref('validityState.rangeUnderflow')}}
  • -
  • {{domxref('validityState.rangeOverflow')}}
  • -
  • {{domxref('validityState.stepMismatch')}}
  • -
  • {{domxref('validityState.badInput')}}
  • -
  • {{domxref('validityState.valid')}}
  • -
  • {{domxref('validityState.customError')}}
  • -
- -

For each of these Boolean properties, a value of true indicates that the specified reason validation may have failed is true, with the exception of the valid property, which is true if the element's value obeys all constraints.

- -

If there is an error, supporting browsers will both alert the user and prevent the form from being submitted. A word of caution: if a custom error is set to a truthy value (anything other than the empty string or null), the form will be be prevented from being submitted. If there is no custom error message, and none of the other properties return true, valid will be true, and the form can be submitted.

- -
function validate(input) {
-  let validityState_object = input.validity;
-  if(validityState_object.valueMissing) {
-     input.setCustomValidity('A value is required');
-  } else if (input.rangeUnderflow) {
-    input.setCustomValidity('Your value is too low');
-  } else if (input.rangeOverflow) {
-    input.setCustomValidity('Your value is too high');
-  } else {
-    input.setCustomValidity('');
-  }
-}
- -

The last line, setting the custom validity message to the error string is vital. If the user makes an error, and the validity is set, it will fail to submit, even if all of the values are valid, until the message is null.

- -

Example

- -

If you want to present a custom error message when a field fails to validate, you need to use the Constraint validation features available on <input> (and related) elements. Take the following form:

- -
<form>
-  <label for="name">Enter username (upper and lowercase letters): </label>
-  <input type="text" name="name" id="name" required pattern="[A-Za-z]+">
-  <button>Submit</button>
-</form>
- -

The basic HTML form validation features will cause this to produce a default error message if you try to submit the form with either no valid filled in, or a value that does not match the pattern.

- -

If you wanted to instead display custom error messages, you could use JavaScript like the following:

- -
const nameInput = document.querySelector('input');
-const form = document.querySelector('form');
-
-nameInput.addEventListener('input', () => {
-  nameInput.setCustomValidity('');
-  nameInput.checkValidity();
-});
-
-nameInput.addEventListener('invalid', () => {
-  if(nameInput.value === '') {
-    nameInput.setCustomValidity('Enter your username!');
-  } else {
-    nameInput.setCustomValidity('Usernames can only contain upper and lowercase letters. Try again!');
-  }
-});
- -

The example renders like so:

- -

{{EmbedLiveSample('Client-side_validation')}}

- -

In brief:

- -
    -
  • We check the valid state of the input element every time its value is changed by running the checkValidity() method via the input event handler.
  • -
  • If the value is invalid, an invalid event is raised, and the invalid event handler function is run. Inside this function we work out whether the value is invalid because it is empty, or because it doesn't match the pattern, using an if() block, and set a custom validity error message.
  • -
  • As a result, if the input value is invalid when the submit button is pressed, one of the custom error messages will be shown.
  • -
  • If it is valid, it will submit as you'd expect. For this to happen, the custom validity has to be cancelled, by invoking setCustomValidity() with an empty string value. We therefore do this every time the input event is raised. If you don't do this, and a custom validity was previously set, the input will register as invalid, even if it current contains a valid value on submission.
  • -
- -
-

Note: Always validate input constraints both client side and server side. Constraint validation doesn't remove the need for validation on the server side. Invalid values can still be sent by older browsers or by bad actors.

-
- -
-

Note: Firefox supported a proprietary error attribute — x-moz-errormessage — for many versions, which allowed you set custom error messages in a similar way. This has been removed as of version 66 (see {{bug(1513890)}}).

-
- -

Localization

- -

The allowed inputs for certain <input> types depend on the locale. In some locales, 1,000.00 is a valid number, while in other locales the valid way to enter this number is 1.000,00.

- -

Firefox uses the following heuristics to determine the locale to validate the user's input (at least for type="number"):

- -
    -
  • Try the language specified by a lang/xml:lang attribute on the element or any of its parents.
  • -
  • Try the language specified by any Content-Language HTTP header. Or,
  • -
  • If none specified, use the browser's locale.
  • -
- -

Technical summary

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Content categoriesFlow content, listed, submittable, resettable, form-associated element, phrasing content. If the {{htmlattrxref("type", "input")}} is not hidden, then labelable element, palpable content.
Permitted contentNone, it is an {{Glossary("empty element")}}.
Tag omissionMust have a start tag and must not have an end tag.
Permitted parentsAny element that accepts phrasing content.
Implicit ARIA role -
    -
  • type=button: button
  • -
  • type=checkbox: checkbox
  • -
  • type=email -
      -
    • with no list attribute: textbox
    • -
    • with list attribute: {{ARIARole("combobox")}}
    • -
    -
  • -
  • type=image: button
  • -
  • type=number: {{ARIARole("spinbutton")}}
  • -
  • type=radio: {{ARIARole("radio")}}
  • -
  • type=range: {{ARIARole("slider")}}
  • -
  • type=reset: button
  • -
  • type=search -
      -
    • with no list attribute: {{ARIARole("searchbox")}}
    • -
    • with list attribute: {{ARIARole("combobox")}}
    • -
    -
  • -
  • type=submit: button
  • -
  • type=tel -
      -
    • with no list attribute: textbox
    • -
    • with list attribute: {{ARIARole("combobox")}}
    • -
    -
  • -
  • type=text -
      -
    • with no list attribute: textbox
    • -
    • with list attribute: {{ARIARole("combobox")}}
    • -
    -
  • -
  • type=url -
      -
    • with no list attribute: textbox
    • -
    • with list attribute: {{ARIARole("combobox")}}
    • -
    -
  • -
  • type=color|date|datetime-local|file|hidden|month|password|time|week: no corresponding role
  • -
-
Permitted ARIA roles -
    -
  • type=button: {{ARIARole("link")}}, {{ARIARole("menuitem")}}, {{ARIARole("menuitemcheckbox")}}, {{ARIARole("menuitemradio")}}, {{ARIARole("option")}}, {{ARIARole("radio")}}, {{ARIARole("switch")}}, {{ARIARole("tab")}}
  • -
  • type=checkbox: {{ARIARole("button")}} when used with aria-pressed, {{ARIARole("menuitemcheckbox")}}, {{ARIARole("option")}}, {{ARIARole("switch")}}
  • -
  • type=image: {{ARIARole("link")}}, {{ARIARole("menuitem")}}, {{ARIARole("menuitemcheckbox")}}, {{ARIARole("menuitemradio")}}, {{ARIARole("radio")}}, {{ARIARole("switch")}}
  • -
  • type=radio: {{ARIARole("menuitemradio")}}
  • -
  • type=text with no list attribute: {{ARIARole("combobox")}}, {{ARIARole("searchbox")}}, {{ARIARole("spinbutton")}}
  • -
  • type=color|date|datetime|datetime-local|email|file|hidden|month|number|password|range|reset|search|submit|tel|url|week or text with list attribute: no role permitted
  • -
-
DOM interface{{domxref("HTMLInputElement")}}
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'forms.html#the-input-element', '<input>')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML Media Capture', '#the-capture-attribute','capture attribute')}}{{Spec2('HTML Media Capture')}}Adds the capture attribute
{{SpecName('HTML5 W3C', 'sec-forms.html#the-input-element', '<input>')}}{{Spec2('HTML5 W3C')}}
{{SpecName('HTML4.01', 'interact/forms.html#h-17.4', '<form>')}}{{Spec2('HTML4.01')}}
- -

Accessibility concerns

- -

Labels

- -

When including inputs, it is an accessibilty requirement to add labels along side. This is needed so those who use assistive technologies can tell what the input is for. Also, clicking or touching a label gives focus to the label's associated form control. This improves the accessibility and usability for sighted users, increases the area a user can click or touch to activate the form control. this is especially useful (and even needed) for radio buttons and checkboxes, which are tiny. For more information about labels in general see {{anch("Labels")}} .

- -

The following is an example of how to associate the <label> with an <input> element in the above style. You need to give the <input> an id attribute. The <label> then needs a for attribute whose value is the same as the input's id.

- -
<label for="peas">Do you like peas?</label>
-<input type="checkbox" name="peas" id="peas">
-
- -

Size

- -

Interactive elements such as form input should provide an area large enough that it is easy to activate them. This helps a variety of people, including people with motor control issues and people using non-precise forms of input such as a stylus or fingers. A minimum interactive size of 44×44 CSS pixels is recommended.

- - - -

Browser compatibility

- - - -
{{Compat("html.elements.input")}}
- -

See also

- - diff --git a/files/ar/web/html/element/input/radio/index.html b/files/ar/web/html/element/input/radio/index.html deleted file mode 100644 index cad8bda10b..0000000000 --- a/files/ar/web/html/element/input/radio/index.html +++ /dev/null @@ -1,356 +0,0 @@ ---- -title: -slug: Web/HTML/Element/input/radio -translation_of: Web/HTML/Element/input/radio ---- -
{{HTMLRef}}
- -

{{htmlelement("input")}} عناصر من النوعradio تستخدم بشكل عام فيradio groups—مجموعات من أزرار الاختيار تصف مجموعة من الخيارات ذات الصلة. يمكن تحديد زر اختيار واحد فقط في مجموعة معينة في نفس الوقت. عادةً ما يتم عرض أزرار الاختيار على شكل دوائر صغيرة ، يتم تعبئتها أو إبرازها عند تحديدها.

- -
{{EmbedInteractiveExample("pages/tabbed/input-radio.html", "tabbed-standard")}}
- - - -
-

يطلق عليها أزرار الراديو لأنها تبدو وتعمل بطريقة مشابهة للأزرار الانضغاطية في أجهزة الراديو القديمة ، مثل تلك الموضحة أدناه.

- -

Shows what radio buttons looked like in the olden days.

-
- -
-

Note:تشبه مربعات الاختيار أزرار الاختيار ، ولكن مع تمييز مهم: أزرار الاختيار مصممة لتحديد قيمة واحدة من مجموعة ، بينما تتيح لك مربعات الاختيار تشغيل وإيقاف القيم الفردية. في حالة وجود عناصر تحكم متعددة ، تسمح أزرار الاختيار بتحديد واحد منها جميعًا ، بينما تسمح مربعات الاختيار بتحديد قيم متعددة.

-
- - - - - - - - - - - - - - - - - - - - - - - - -
{{anch("Value")}}A {{domxref("DOMString")}} representing the value of the radio button.
Events{{event("change")}} and {{event("input")}}
Supported common attributeschecked and value
IDL attributes{{anch("checked")}} and {{anch("value")}}
Methods{{domxref("HTMLInputElement.select", "select()")}}
- -

Value

- -

The value attribute is a {{domxref("DOMString")}} containing the radio button's value. The value is never shown to the user by their {{Glossary("user agent")}}. Instead, it's used to identify which radio button in a group is selected.

- -

Defining a radio group

- -

A radio group is defined by giving each of radio buttons in the group the same {{htmlattrxref("name", "input")}}. Once a radio group is established, selecting any radio button in that group automatically deselects any currently-selected radio button in the same group.

- -

You can have as many radio groups on a page as you like, as long as each has its own unique name.

- -

For example, if your form needs to ask the user for their preferred contact method, you might create three radio buttons, each with the name property set to contact but one with the {{htmlattrxref("value", "input")}} email, one with the value phone, and one with the value mail. The user never sees the value or the name (unless you expressly add code to display it).

- -

The resulting HTML looks like this:

- -
<form>
-  <p>Please select your preferred contact method:</p>
-  <div>
-    <input type="radio" id="contactChoice1"
-     name="contact" value="email">
-    <label for="contactChoice1">Email</label>
-
-    <input type="radio" id="contactChoice2"
-     name="contact" value="phone">
-    <label for="contactChoice2">Phone</label>
-
-    <input type="radio" id="contactChoice3"
-     name="contact" value="mail">
-    <label for="contactChoice3">Mail</label>
-  </div>
-  <div>
-    <button type="submit">Submit</button>
-  </div>
-</form>
- -

Here you see the three radio buttons, each with the name set to contact and each with a unique value that uniquely identifies that individual radio button within the group. They each also have a unique {{domxref("Element.id", "id")}}, which is used by the {{HTMLElement("label")}} element's {{htmlattrxref("for", "label")}} attribute to associate the labels with the radio buttons.

- -

You can try out this example here:

- -

{{EmbedLiveSample('Defining_a_radio_group', 600, 130)}}

- -

Data representation of a radio group

- -

When the above form is submitted with a radio button selected, the form's data includes an entry in the form contact=value. For example, if the user clicks on the "Phone" radio button then submits the form, the form's data will include the line contact=phone.

- -

If you omit the value attribute in the HTML, the submitted form data assigns the value on to the group. In this scenario, if the user clicked on the "Phone" option and submitted the form, the resulting form data would be contact=on, which isn't helpful. So don't forget to set your value attributes!

- -
-

Note: If no radio button is selected when the form is submitted, the radio group is not included in the submitted form data at all, since there is no value to report.

-
- -

It's fairly uncommon to actually want to allow the form to be submitted without any of the radio buttons in a group selected, so it is usually wise to have one default to the checked state. See {{anch("Selecting a radio button by default")}} below.

- -

Let's add a little bit of code to our example so we can examine the data generated by this form. The HTML is revised to add a {{HTMLElement("pre")}} block to output the form data into:

- -
<form>
-  <p>Please select your preferred contact method:</p>
-  <div>
-    <input type="radio" id="contactChoice1"
-           name="contact" value="email">
-    <label for="contactChoice1">Email</label>
-    <input type="radio" id="contactChoice2"
-           name="contact" value="phone">
-    <label for="contactChoice2">Phone</label>
-    <input type="radio" id="contactChoice3"
-           name="contact" value="mail">
-    <label for="contactChoice3">Mail</label>
-  </div>
-  <div>
-    <button type="submit">Submit</button>
-  </div>
-</form>
-<pre id="log">
-</pre>
-
- -

Then we add some JavaScript to set up an event listener on the {{domxref("HTMLFormElement/submit_event", "submit")}} event, which is sent when the user clicks the "Submit" button:

- -
var form = document.querySelector("form");
-var log = document.querySelector("#log");
-
-form.addEventListener("submit", function(event) {
-  var data = new FormData(form);
-  var output = "";
-  for (const entry of data) {
-    output = output + entry[0] + "=" + entry[1] + "\r";
-  };
-  log.innerText = output;
-  event.preventDefault();
-}, false);
- -

Try this example out and see how there's never more than one result for the contact group.

- -

{{EmbedLiveSample("Data_representation_of_a_radio_group", 600, 130)}}

- -

Additional attributes

- -

In addition to the common attributes shared by all {{HTMLElement("input")}} elements, radio inputs support the following attributes:

- - - - - - - - - - - - - - - - - - -
AttributeDescription
{{anch("checked")}}A Boolean indicating whether or not this radio button is the currently-selected item in the group
{{anch("value")}}The string to use as the value of the radio when submitting the form, if the radio is currently toggled on
- -

{{htmlattrdef("checked")}}

- -

A Boolean attribute which, if present, indicates that this radio button is the currently selected one in the group.

- -

Unlike other browsers, Firefox by default persists the dynamic checked state of an <input> across page loads. Use the {{htmlattrxref("autocomplete","input")}} attribute to control this feature.

- -

{{htmlattrdef("value")}}

- -

The value attribute is one which all {{HTMLElement("input")}}s share; however, it serves a special purpose for inputs of type radio: when a form is submitted, only radio buttons which are currently checked are submitted to the server, and the reported value is the value of the value attribute. If the value is not otherwise specified, it is the string on by default. This is demonstrated in the section {{anch("Value")}} above.

- -

Using radio inputs

- -

We already covered the fundamentals of radio buttons above. Let's now look at the other common radio-button-related features and techniques you may need to know about.

- -

Selecting a radio button by default

- -

To make a radio button selected by default, you simply include checked attribute, as shown in this revised version of the previous example:

- -
<form>
-  <p>Please select your preferred contact method:</p>
-  <div>
-    <input type="radio" id="contactChoice1"
-     name="contact" value="email" checked>
-    <label for="contactChoice1">Email</label>
-
-    <input type="radio" id="contactChoice2"
-     name="contact" value="phone">
-    <label for="contactChoice2">Phone</label>
-
-    <input type="radio" id="contactChoice3"
-     name="contact" value="mail">
-    <label for="contactChoice3">Mail</label>
-  </div>
-  <div>
-    <button type="submit">Submit</button>
-  </div>
-</form>
- -

{{EmbedLiveSample('Selecting_a_radio_button_by_default', 600, 130)}}

- -

In this case, the first radio button is now selected by default.

- -
-

Note: If you put the checked attribute on more than one radio button, later instances will override earlier ones; that is, the last checked radio button will be the one that is selected. This is because only one radio button in a group can ever be selected at once, and the user agent automatically deselects others each time a new one is marked as checked.

-
- -

Providing a bigger hit area for your radio buttons

- -

In the above examples, you may have noticed that you can select a radio button by clicking on its associated {{htmlelement("label")}} element, as well as on the radio button itself. This is a really useful feature of HTML form labels that makes it easier for users to click the option they want, especially on small-screen devices like smartphones.

- -

Beyond accessibility, this is another good reason to properly set up <label> elements on your forms.

- -

Validation

- -

Radio buttons don't participate in constraint validation; they have no real value to be constrained.

- -

Styling radio inputs

- -

The following example shows a slightly more thorough version of the example we've seen throughout the article, with some additional styling, and with better semantics established through use of specialized elements. The HTML looks like this:

- -
<form>
-  <fieldset>
-    <legend>Please select your preferred contact method:</legend>
-    <div>
-      <input type="radio" id="contactChoice1"
-       name="contact" value="email" checked>
-      <label for="contactChoice1">Email</label>
-
-      <input type="radio" id="contactChoice2"
-       name="contact" value="phone">
-      <label for="contactChoice2">Phone</label>
-
-      <input type="radio" id="contactChoice3"
-       name="contact" value="mail">
-      <label for="contactChoice3">Mail</label>
-    </div>
-    <div>
-      <button type="submit">Submit</button>
-    </div>
-  </fieldset>
-</form>
- -

There's not much new to note here except for the addition of {{htmlelement("fieldset")}} and {{htmlelement("legend")}} elements, which help to group the functionality nicely and in a semantic way.

- -

The CSS involved is a bit more significant:

- -
html {
-  font-family: sans-serif;
-}
-
-div:first-of-type {
-  display: flex;
-  align-items: flex-start;
-  margin-bottom: 5px;
-}
-
-label {
-  margin-right: 15px;
-  line-height: 32px;
-}
-
-input {
-  -webkit-appearance: none;
-  -moz-appearance: none;
-  appearance: none;
-
-  border-radius: 50%;
-  width: 16px;
-  height: 16px;
-
-  border: 2px solid #999;
-  transition: 0.2s all linear;
-  margin-right: 5px;
-
-  position: relative;
-  top: 4px;
-}
-
-input:checked {
-  border: 6px solid black;
-}
-
-button,
-legend {
-  color: white;
-  background-color: black;
-  padding: 5px 10px;
-  border-radius: 0;
-  border: 0;
-  font-size: 14px;
-}
-
-button:hover,
-button:focus {
-  color: #999;
-}
-
-button:active {
-  background-color: white;
-  color: black;
-  outline: 1px solid black;
-}
- -

Most notable here is the use of the {{cssxref("-moz-appearance")}} property (with prefixes needed to support some browsers). By default, radio buttons (and checkboxes) are styled with the operating system's native styles for those controls. By specifying appearance: none, you can remove the native styling altogether, and create your own styles for them. Here we've used a {{cssxref("border")}} along with {{cssxref("border-radius")}} and a {{cssxref("transition")}} to create a nice animating radio selection. Notice also how the {{cssxref(":checked")}} pseudo-class is used to specify the styles for the radio button's appearance when selected.

- -
-

Compatibility note: If you wish to use the {{cssxref("appearance")}} property, you should test it very carefully. Although it is supported in most modern browsers, its implementation varies widely. In older browsers, even the keyword none does not have the same effect across different browsers, and some do not support it at all. The differences are smaller in the newest browsers.

-
- -

{{EmbedLiveSample('Styling_radio_inputs', 600, 120)}}

- -

Notice that when clicking on a radio button, there's a nice, smooth fade out/in effect as the two buttons change state. In addition, the style and coloring of the legend and submit button are customized to have strong contrast. This might not be a look you'd want in a real web application, but it definitely shows off the possibilities.

- -

Specifications

- - - - - - - - - - - - - - - - - - - - - -
SpecificationStatus
{{SpecName('HTML WHATWG', 'forms.html#radio-button-state-(type=radio)', '<input type="radio">')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5 W3C', 'forms.html#radio-button-state-(type=radio)', '<input type="radio">')}}{{Spec2('HTML5 W3C')}}
- -

Browser compatibility

- - - -

{{Compat("html.elements.input.input-radio")}}

- -

See also

- -
    -
  • {{HTMLElement("input")}} and the {{domxref("HTMLInputElement")}} interface that implements it.
  • -
  • {{domxref("RadioNodeList")}}: the interface that describes a list of radio buttons
  • -
  • Compatibility of CSS properties
  • -
diff --git a/files/ar/web/html/element/span/index.html b/files/ar/web/html/element/span/index.html deleted file mode 100644 index faaf3faf7f..0000000000 --- a/files/ar/web/html/element/span/index.html +++ /dev/null @@ -1,123 +0,0 @@ ---- -title: -slug: Web/HTML/Element/span -translation_of: Web/HTML/Element/span -original_slug: HTML/Element/span ---- -

و HTML <span>العنصر هو حاوية مضمنة عامة لمحتوى الصيغة، التي لا تمثل في حد ذاتها أي شيء. يمكن استخدامه لتجميع العناصر لأغراض التصميم (باستخدام classأو idالسمات) ، أو لأنها تتشارك في قيم السمات ، مثل langيجب استخدامه فقط عندما يكون أي عنصر دلالي آخر مناسبًا. <span>تشبه إلى حد كبير على <div>عنصر، ولكن <div>هو عنصر على مستوى الكتلة في حين أن <span>هو عنصر المضمنة .

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - -
فئات المحتوى
-
محتوى التدفق ، محتوى الصياغة .
المحتوى المسموح به - - - - - - -
محتوى الصياغة
-
إغفال العلامةالآباء المسموح بهم
أي عنصر يقبل محتوى الصياغة ، أو أي عنصر يقبل محتوى التدفق .
يسمح أدوار ARIAأي
واجهة DOMHTMLSpanElement(قبل HTML 5 ، كانت الواجهة HTMLElement)
- -

السمات

- -

هذا العنصر يشمل فقط السمات العالمية .

- -

المثال 1

- -
<p><span>Some text</span></p>
- -

نتيجة

- -

بعض النصوص

- -

 

- -

المثال 2

- -
<li><span>
-    <a href="portfolio.html" target="_blank">See my portfolio</a>
-</span></li>
-
- -

CSS:

- -
-

li span {
- background: gold;
- }

-
- -

مواصفات

- - - - - - - - - - - - - - - - - - - - - - - - - - -
تخصيصالحالةتعليق
{{SpecName('HTML WHATWG', 'semantics.html#the-span-element', '<span>')}}{{Spec2('HTML WHATWG')}} 
{{SpecName('HTML5 W3C', 'text-level-semantics.html#the-span-element', '<span>')}}{{Spec2('HTML5 W3C')}}واجهة DOM هي الآن {{domxref("HTMLSpanElement")}}.
{{SpecName('HTML4.01', 'struct/global.html#edef-SPAN', '<span>')}}{{Spec2('HTML4.01')}} 
- -

توافق التصفح

- - - -

{{Compat("html.elements.span")}}

- -

انظر أيضا

- -
    -
  • HTML {{HTMLElement("div")}} عنصر 
  • -
- -
{{HTMLRef}}
diff --git a/files/ar/web/html/element/tt/index.html b/files/ar/web/html/element/tt/index.html deleted file mode 100644 index 79a788e995..0000000000 --- a/files/ar/web/html/element/tt/index.html +++ /dev/null @@ -1,162 +0,0 @@ ---- -title: ': The Teletype Text element (obsolete)' -slug: Web/HTML/Element/tt -translation_of: Web/HTML/Element/tt -original_slug: HTML/Element/tt ---- -
{{ obsolete_header() }}
- -

وعفا عليها الزمن HTML المبرقة الكاتبة عنصر نص ( <tt>) بإنشاء النص المضمن الذي يقدم باستخدام وكيل المستخدم وجه الافتراضي أحادي المسافة الخط. تم إنشاء هذا العنصر لغرض تقديم نص كما سيتم عرضه على شاشة عرض ثابت مثل نمط teletype أو نص فقط أو طابعة خط

- -

تُستخدم المصطلحات غير المتناسبة ، والنمط الأحادي ، والمونوسبيس بشكل تبادلي ولها نفس المعنى العام: فهي تصف حرفًا محرفًا تكون جميع أحرفه هي نفس عدد وحدات البكسل على نطاق واسع.

- -

هذا العنصر عفا عليه الزمن ، ومع ذلك. يجب عليك استخدام أكثر مفيدة لغويا <code>، <kbd>، <var>، أو<samp>عناصر النص المضمن الذي يحتاج إلى أن تقدم في نوع أحادي المسافة، أو <pre>شعارا لالمحتوى الذي ينبغي أن تقدم ككتلة منفصل.

- -
إذا لم يكن أي من العناصر الدلالية مناسبًا لحالة الاستخدام الخاصة بك (على سبيل المثال ، إذا كنت تحتاج ببساطة إلى عرض بعض المحتوى بخط غير تناسبي) ، فيجب أن تفكر في استخدام <span>العنصر ، وأن تصممه كما تريد باستخدام CSS. و font-familyالخاصية هي مكان جيد للبدء
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
فئات المحتوى - - - - - - -
محتوى التدفق ، ومحتوى الصياغة ، ومحتوى واضح
-
المحتوى المسموح بهمحتوى الصياغة .
إغفال العلامةلا شيء ، كل من علامة البداية والنهاية إلزامية.
الآباء المسموح بهمي عنصر يقبل محتوى الصياغة
يسمح أدوار ARIAأي
- - - - - - -
واجهة DOM
-
HTMLElement
- -

السمات

- -

هذا العنصر يشمل فقط السمات العالمية

- -

أمثلة

- -

المثال الأساسي

- -

يستخدم هذا المثال <tt>لإظهار النص الذي تم إدخاله والإخراج بواسطة تطبيق طرفي.

- -
<p>Enter the following at the telnet command prompt: <code>set localecho</code><br />
-
-The telnet client should display: <tt>Local Echo is on</tt></p>
-
- -

نتيجة

- -

{{EmbedLiveSample("Basic_example", 650, 80)}}

- -

تجاوز الخط الافتراضي

- -

يمكنك تجاوز الخط الافتراضي للمتصفح - إذا كان المتصفح يسمح لك بذلك ، وهو أمر غير مطلوب - باستخدام CSS:

- -

CSS

- -
tt {
-  font-family: "Lucida Console", "Menlo", "Monaco", "Courier",
-               monospace;
-}
- -

HTML

- -
<p>Enter the following at the telnet command prompt: <code>set localecho</code><br />
-
-The telnet client should display: <tt>Local Echo is on</tt></p>
- -

نتيجة

- -

{{EmbedLiveSample("Overriding_the_default_font", 650, 80)}}

- -

ملاحظات الاستخدام

- -

 

- -

يتم تقديم <tt>العنصر افتراضيًا باستخدام الخط الافتراضي غير المتناسب في المستعرض. يمكنك إلغاء ذلك باستخدام CSS عن طريق إنشاء قاعدة باستخدام ttالمحدد ، كما هو موضح في المثال تجاوز الخط الافتراضي أعلاه.

- -

 

- -
-

 

- -

التغييرات التي تمت تهيئتها بواسطة المستخدم على إعداد خط أحادي المسافة الافتراضي قد تكون لها الأسبقية على CSS الخاص بك.

- -

 

-
- -

على الرغم من أن هذا العنصر لم يتم إهماله رسميًا في HTML 4.01 ، إلا أنه تم تثبيط استخدامه بسبب العناصر الدلالية و / أو CSS. و <tt>العنصر عفا عليه الزمن في HTML 5.

- -

مواصفات

- - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'obsolete.html#tt', '<tt>')}}{{Spec2('HTML WHATWG')}} 
{{SpecName('HTML5 W3C', 'obsolete.html#elementdef-tt', '<tt>')}}{{Spec2('HTML5 W3C')}} 
{{SpecName('HTML4.01', 'present/graphics.html#h-15.2.1', '<tt>')}}{{Spec2('HTML4.01')}} 
- -

التوافق المتصفح

- - - -

{{Compat("html.elements.tt")}}

- -

انظر أيضا

- -
    -
  • The semantic {{HTMLElement("code")}}, {{HTMLElement("var")}}, {{HTMLElement("kbd")}}, and {{HTMLElement("samp")}} elements
  • -
  • The {{HTMLElement("pre")}} element for displaying preformatted text blocks
  • -
- -
{{ HTMLRef }}
diff --git a/files/ar/web/html/index.html b/files/ar/web/html/index.html deleted file mode 100644 index 398297a1a0..0000000000 --- a/files/ar/web/html/index.html +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: لغة ترميز النص الفائق -slug: Web/HTML -tags: - - HTML - - Landing - - Web ---- -
{{HTMLSidebar}}
- -

لغة ترميز النص الفائق (HTML) هي اللبنة الأساسية للويب. فهي تقوم بوصف وتعريف محتوى صفحات الويب. التقنيات الأخرى إلى جانب هذه اللغة تعمل عادةً على وصف مظهر صفحة الويب (صفحات الطرز المتراصة) أو تفاعلها مع المستخدم (الجافاسكربت).

- -

مصطلح "نص تشعبي" يشير إلى الروابط التي تربط صفحات الويب ببعضها، إما بموقع واحد، أو بين مواقع متعددة. فالروابط هي جانب أساسي من الويب. عبر رفعك لمحتوى على الأنترنت وربطه بصفحات أخرى أنشأها أشخاص آخرون، فأنت تصبح مشاركاً نشيطاً في شبكة الإنترنت.

- -

تستخدم لغة ترميز النص الفائقة تقنيّة "الترميز (markup)" لوصف النصوص، والصور، وغيرها من المحتويات؛ لعرضعها على المتصفح. وسوم اللغة تتضمن "عناصر (elements)" خاصة مثل {{HTMLElement("head")}}، {{HTMLElement("title")}}، {{HTMLElement("body")}}، {{HTMLElement("header")}}، {{HTMLElement("footer")}}، {{HTMLElement("article")}}، {{HTMLElement("section")}}، {{HTMLElement("p")}}، {{HTMLElement("div")}}، {{HTMLElement("span")}}، {{HTMLElement("img")}}، وغيرها الكثير.

- -

المقالات أدناه ستساعدك على تعلم المزيد حول هذه اللغة.

- -
-
    -
  • مقدمة عن لغة ترميز النص الفائقإذا كنت جديداً على تطوير الويب فاحرص على قراءة مقالتنا حول أساسيات اللغة لتعرف ما هيّتها، وكيف يمكنك استخدامها.
  • -
  • دورات عن لغة ترميز النص الفائقللحصول على مقالات عن كيفيّة استخدام هذه اللغة، وكذلك على دورات وأمثلة شاملة، تفقد منطقة التعلم خاصتنا.
  • -
  • مرجع لغة ترميز النص الفائق -

    في قسم مرجع لغة ترميز النص الفائق الشامل خاصتنا، ستجد تفاصيل حول كل عنصر وسِمة في اللغة.

    -
  • -
- -
-
-

دورات للمبتدئين

- -

تمتاز منطقة تعلم لغة ترميز النص الفائق بوحدات متعددة تقوم بتعليم اللغة من الألف إلى الياء، ولا تتطلب معرفة مُسبقة.

- -
-
مقدمة عن لغة ترميز النص الفائق
-
تقوم هذه الوحدة بشرح الأسس، وتأخذك لتعلم المفاهيم المهمة وبنيّة اللغة، بحيث تعلمك كيفيّة وصف النصوص في اللغة، وإنشاء روابط تشعيبيّة، واستخدامها لهيكلة صفحات الويب.
-
الوسائط المتعددة
-
هذه الوحدة تشرح كيف يمكنك استخدام لغة ترميز النص الفائق لتضمين وسائط متعددة في صفحات الويب خاصتك، كما تتضمن المقالة طرق مختلفة يمكنك استخدامها لإضافة الصور، وفيديوهات، وملفات صوت، وحتى صفحات ويب أخرى كاملة.
-
الجداول
-
يمثل عرض البيانات المجدولة على صفحة الويب بطريق مفهومة وسهلة الوصول تحدياً. هذه الوحدة تغطي وسوم الجدول الأساسية، إلى جانب ميزات أكثر تعقيداً مثل إضافة تسميات توضيحيّة وملخصات.
-
الاستمارات
-
الاستمارة (form) هي جزء مهم جداً من الويب، فهي توفر الكثير من الوظائف التي ستحتاجها للتفاعل مع الموقع، مثل التسجيل وتسجيل الدخول، وإرسال التعليقات (feedback)، وشراء منتجات، والمزيد. ستعلمك هذه الوحدة كيفيّة تصميم الاستمارات.
-
استخدام لغة ترميز النص الفائق لحل المشاكل شائعة
-
توفر هذه المقالة روابط لأقسام تحتوي على شرح لكيفيّة استخدام هذه اللغة لحل مشاكل شائعة عندما تقوم بإنشاء صفحة ويب مثل: التعامل مع العناوين، وإضافة صورة أو فيديو، واستخدام المؤكدات في المحتوى، وإنشاء استمارة بسيطة، وغيرها من المواضيع.
-
- -

مواضيع متقدمة

- -
-
إدارة التركيز في لغة ترميز النص الفائق
-
تساعدك السمة activeElement والدالة ()hasFocus على تتبع والتحكم بتفاعلات المستخدم مع عناصر الصفحة.
-
استخدام ذاكرة التخزين المؤقت للتطبيق
-
ذاكرة التخزين المؤقت تسمح للتطبيقات المبنية على الويب بالعمل في وضع عدم الإتصال. يمكنك استخدام واجهة ذاكرة التخزين المؤقت للتطبيق البرمجيّة (AppCache) لتحديد الموارد التي يجب على المتصفح تخزينها وإتاحتها للمستخدمين في وضع عدم الإتصال. التطبيقات التي يتم تحميلها مؤقتاً تعمل بشكل صحيح حتى ولو قام المستخدمون بالضغط على زر التحديث عندما يكونون في وضع عدم الإتصال.
-
-
- -
-

مراجع

- -
-
مرجع لغة ترميز النص الفائق
-
تتألف لغة ترميز النص الفائق من عناصر (elements)، كل منها يمكن تعديله بواسطة عدد من السمات (attributes). وصفحات لغة ترميز النص الفائق متصلة ببعضها البعض بروابط.
-
مرجع عناصر لغة ترميز النص الفائق
-
تصفح قائمة بجميع عناصر هذه اللغة.
-
مرجع سمات لغة ترميز النص الفائق
-
تمتلك عناصر لغة ترميز النص الفائق سماتاً. تعد هذه السمات قيم إضافية تقوم بتعديل العناصر أو تخصيص وظيفتها بطرق مختلفة.
-
السمات العموميّة
-
يمكن استخدام السمات العموميّة (تقريباً) على جميع عناصر اللغة، حتى العناصر الغير معياريّة. هذا يعني أنَّ أي عنصر غير معياري يجب أن يسمح باستخدام هذه السمات، بالرغم من أنَّ هذه العناصر تجعل مستند لغة ترميز النص الفائق الإصدار الخامس غير متوافِق ومعياري.
-
العناصر المُضمنِة والعناصر المُستحوذِة
-
العناصر عادةً في لغة ترميز النص الفائق إما "مضمنة" أو "مستحوذة". العنصر المضمن يأحذ المساحة المحصورة بواسطة الوسوم التي تحدده، أما العنصر المستحوذ فأنَّه يأخذ كامل مساحة العنصر الأب (الحاوي)، وبالتالي فإنه يُنشِئ "كتلة".
-
أنواع الرابط
-
تتنوع أنواع الروابط في لغة ترميز النص الفائق، حيث يمكن استخدامها لإنشاء أو تعريف صلة بين وثيقتين. تتضمن عناصر الرابط التي يمكن استخدامها على <a> ،<area>، و <link>.
-
صيغ الوسائط المدعومة في لغة ترميز النص الفائق
-
تسمح لك العناصر <audio> و <video> بتشغيل وسائط الصوت والفيديو. هذه العناصر توفر بدائل مشابهة للمتصفح كالتي موجودة في أدوبي فلاش والإضافات الأخرى.
-
أنواع محتوى لغة ترميز النص الفائق
-
تتألف لغة ترميز النص الفائق من عدة أنواع من المحتوى، كل نوع يتيح لك استخدام عدة سياقات ويمنعك من استخدام أخرى. وبالمثل كل نوع يملك مجموعة من الفئات يمكن أن تحتوي على عناصر يمكنك، أو لا يمكنك استخدامها. هذا دليل يشرح هذه الفئات.
-
وضع المراوغة والوضع المعياري
-
معلومات تاريخيّة عن وضع المراوغة والوضع المعياري.
-
- -

مواضيع متعلقة

- -
-
إضافة لون إلى عناصر لغة ترميز النص الفائق
-
هذه المقالة تغطي معظم الطرق التي يمكن استخدامها لإضفاء لون على عنصر، كما تسرد الأجزاء من مستند لغة ترميز النص الفاق التي يمكن تلوينها، وما الخصائص التي يمكنك استخدامها لفعل ذلك. تتضمن هذه المقالة على أمثلة، وروابط لأدوات تصميميّة( أدوات لاختيار ألوان، واختيار التدرجات اللونيّة... إلخ)، وغيرها من الأمور المفيدة.
-
-
-
- -

عرض المزيد...

-
diff --git a/files/ar/web/http/basics_of_http/index.html b/files/ar/web/http/basics_of_http/index.html deleted file mode 100644 index 237dda5f72..0000000000 --- a/files/ar/web/http/basics_of_http/index.html +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: Basics of HTTP -slug: Web/HTTP/Basics_of_HTTP -tags: - - Guide - - HTTP - - NeedsTranslation - - Overview - - TopicStub -translation_of: Web/HTTP/Basics_of_HTTP ---- -
{{HTTPSidebar}}
- -

HTTP is a pretty extensible protocol. It relies on a few basic concepts like the notion of resources and URIs, a simple structure of messages, and a client-server structure for the communication flow. On top of these basic concepts, numerous extensions have appeared over the years, adding new functionality and new semantics by creating new HTTP methods or headers.

- -

Articles

- -
-
Overview of HTTP
-
Describes what HTTP is and its role in the Web architecture, its position in the protocol stack.
-
Evolution of HTTP
-
HTTP was created in the early 1990s and has been extended several times. This article goes through its history and describes HTTP/0.9, HTTP/1.0, HTTP/1.1, and the modern HTTP/2 as well as minor novelties introduced over the years.
-
Negotiating an HTTP version
-
Explains how a client and a server can negotiate a specific HTTP version and eventually upgrade the protocol version used.
-
Resources and URIs
-
A brief introduction of the notion of resources, identifiers, and locations on the Web.
-
Identifying resources on the Web
-
Describes how Web resources are referenced and how to locate them.
-
Data URIs
-
A specific kind of URIs that directly embeds the resource it represents. Data URIs are very convenient, but have some caveats.
-
Resource URLs {{Non-standard_Inline}}
-
Resource URLs, URLs prefixed with the resource: scheme, are used by Firefox and Firefox browser extensions to load resources internally, but some of the information is available to sites the browser connects to as well.
-
Separating identity and location of a resource: the Alt-Svc HTTP header
-
Most of the time identity and location of a Web resource are shared, this can be changed with the {{HTTPHeader("Alt-Svc")}} header.
-
MIME types
-
Since HTTP/1.0, different types of content can be transmitted. This article explains how this is done using the {{HTTPHeader("Content-Type")}} header and the MIME standard.
-
Choosing between www and non-www URLs
-
Advice on using a www-prefixed domain or not, this article explains the consequences of the choice as well as how to make it.
-
Flow of an HTTP session
-
This fundamental article describes a typical HTTP session: what happens under the hood when you click on a link in your browser…
-
HTTP Messages
-
HTTP Messages transmitted during requests or responses have a very clear structure; this introductory article describes this structure, its purpose and its possibilities.
-
Frame and message structure in HTTP/2
-
HTTP/2 encapsulates and represents HTTP/1.x messages in a binary frame. This article explains the frame structure, its purpose and the way it is encoded.
-
Connection management in HTTP/1.x
-
HTTP/1.1 was the first version of HTTP to support persistent connection and pipelining. This article explains these two concepts.
-
Connection management in HTTP/2
-
HTTP/2 completely revisited how connections are created and maintained: this article explains how HTTP frames allow multiplexing and solve the 'head-of-line' blocking problem of former HTTP versions.
-
Content Negotiation
-
HTTP introduces a set of headers, starting with Accept- as a way for a browser to announce the format, language, or encoding it prefers. This article explains how this advertisement happens, how the server is expected to react and how it will choose the most adequate response.
-
diff --git a/files/ar/web/http/basics_of_http/mime_types/common_types/index.html b/files/ar/web/http/basics_of_http/mime_types/common_types/index.html deleted file mode 100644 index dbc40bc983..0000000000 --- a/files/ar/web/http/basics_of_http/mime_types/common_types/index.html +++ /dev/null @@ -1,360 +0,0 @@ ---- -title: Incomplete list of MIME types -slug: Web/HTTP/Basics_of_HTTP/MIME_types/Common_types -translation_of: Web/HTTP/Basics_of_HTTP/MIME_types/Common_types ---- -
{{HTTPSidebar}}
- -

في ما يلي قائمة بأنواع MIME ، المرتبطة بنوع المستندات ، مرتبة حسب الإضافات الشائعة.

- -

هناك نوعان رئيسيان من MIME مهمان لدور الأنواع الافتراضية:

- -
    -
  • text/plainهي القيمة الافتراضية للملفات النصية. يجب أن يكون الملف النصي قابلاً للقراءة ، ويجب ألا يحتوي على بيانات ثنائية.
  • -
  • application/octet-streamهي القيمة الافتراضية لجميع الحالات الأخرى. يجب أن يستخدم نوع الملف غير المعروف هذا النوع. وتدفع المتصفحات عناية خاصة عند التعامل مع هذه الملفات ، في محاولة لحماية المستخدم لمنع السلوكيات الخطيرة.
  • -
- -

IANA هو السجل الرسمي لأنواع وسائط MIME ويحافظ على قائمة بجميع أنواع MIME الرسمية . يسرد هذا الجدول بعض أنواع MIME المهمة للويب:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
تمديدنوع الوثيقةنوع التمثيل الصامت
.aacصوت AACaudio/aac
.abwوثيقة أبي وردapplication/x-abiword
.arcوثيقة الأرشيف (ملفات متعددة مدمجة)application/octet-stream
.aviAVI: تداخل الصوت والفيديوvideo/x-msvideo
.azwتنسيق Amazon Kindle eBookapplication/vnd.amazon.ebook
.binأي نوع من البيانات الثنائيةapplication/octet-stream
.bmpنظام التشغيل Windows OS / 2 Bitmap Graphicsimage/bmp
.bzأرشيف BZipapplication/x-bzip
.bz2أرشيف BZip2application/x-bzip2
.cshنص C-Shellapplication/x-csh
.cssأوراق الأنماط المتتالية (CSS)text/css
.csvقيم مفصولة بفواصل (CSV)text/csv
.docمايكروسوفت ووردapplication/msword
.docxMicrosoft Word (OpenXML)application/vnd.openxmlformats-officedocument.wordprocessingml.document
.eotMS Embedded OpenType fontsapplication/vnd.ms-fontobject
.epubالمنشور الالكتروني (EPUB)application/epub+zip
.esECMAScript (IANA Specification) (RFC 4329 Section 8.2)application/ecmascript
.gifGraphics Interchange Format (GIF)image/gif
.htm
- .html
HyperText Markup Language (HTML)text/html
.icoIcon formatimage/x-icon
.icsiCalendar formattext/calendar
.jarJava Archive (JAR)application/java-archive
.jpeg
- .jpg
JPEG imagesimage/jpeg
.jsJavaScript (IANA Specification) (RFC 4329 Section 8.2)application/javascript
.jsonJSON formatapplication/json
.mid
- .midi
Musical Instrument Digital Interface (MIDI)audio/midi audio/x-midi
.mpegMPEG Videovideo/mpeg
.mpkgApple Installer Packageapplication/vnd.apple.installer+xml
.odpOpenDocument presentation documentapplication/vnd.oasis.opendocument.presentation
.odsOpenDocument spreadsheet documentapplication/vnd.oasis.opendocument.spreadsheet
.odtOpenDocument text documentapplication/vnd.oasis.opendocument.text
.ogaOGG audioaudio/ogg
.ogvOGG videovideo/ogg
.ogxOGGapplication/ogg
.otfOpenType fontfont/otf
.pngPortable Network Graphicsimage/png
.pdfAdobe Portable Document Format (PDF)application/pdf
.pptMicrosoft PowerPointapplication/vnd.ms-powerpoint
.pptxMicrosoft PowerPoint (OpenXML)application/vnd.openxmlformats-officedocument.presentationml.presentation
.rarRAR archiveapplication/x-rar-compressed
.rtfRich Text Format (RTF)application/rtf
.shBourne shell scriptapplication/x-sh
.svgScalable Vector Graphics (SVG)image/svg+xml
.swfتنسيق ويب صغير (SWF) أو مستند Adobe Flashapplication/x-shockwave-flash
.tarأرشيف الشريط (TAR)application/x-tar
.tif
- .tiff
تنسيق ملفات الصور ذات العلامات (TIFF)image/tiff
.tsملف التوليفapplication/typescript
.ttfخط تروتايبfont/ttf
.txtنص ، (بشكل عام ASCII أو ISO 8859- n )text/plain
.vsdمايكروسوفت فيزيوapplication/vnd.visio
.wavشكل الصوت الموجيaudio/wav
.webaWEBM الصوتaudio/webm
.webmWEBM الفيديوvideo/webm
.webpصورة الويبimage/webp
.woffتنسيق خط مفتوح على الويب (WOFF)font/woff
.woff2تنسيق خط مفتوح على الويب (WOFF)font/woff2
.xhtmlXHTMLapplication/xhtml+xml
.xlsمايكروسوفت اكسلapplication/vnd.ms-excel
.xlsxMicrosoft Excel (OpenXML)application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.xmlXMLapplication/xml
.xulXULالتطبيق / vnd.mozilla.xul + أكس
.zipأرشيف ZIPapplication/zip
.3gpحاوية الصوت / الفيديو 3GPPvideo/3gpp
- audio/3gpp إذا لم يكن يحتوي على فيديو
.3g2حاوية الصوت / الفيديو 3GPP2video/3gpp2
- audio/3gpp2 إذا لم يكن يحتوي على فيديو
.7zأرشيف 7-zipapplication/x-7z-compressed
diff --git a/files/ar/web/http/basics_of_http/mime_types/index.html b/files/ar/web/http/basics_of_http/mime_types/index.html deleted file mode 100644 index 15f265d1cf..0000000000 --- a/files/ar/web/http/basics_of_http/mime_types/index.html +++ /dev/null @@ -1,382 +0,0 @@ ---- -title: MIME types -slug: Web/HTTP/Basics_of_HTTP/MIME_types -tags: - - Content-Type - - Guide - - HTTP - - MIME Types - - Meta - - NeedsTranslation - - Request header - - Response Header - - TopicStub - - application/javascript - - application/json - - application/xml -translation_of: Web/HTTP/Basics_of_HTTP/MIME_types ---- -

A Multipurpose Internet Mail Extensions (MIME) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. It is defined and standardized in IETF RFC 6838.

- -

The Internet Assigned Numbers Authority (IANA) is responsible for all official MIME types, and you can find the most up-to-date and complete list at their Media Types page.

- -
-

Browsers use the MIME type, not the file extension, to determine how to process a URL — it is important that servers send the correct MIME type in the response's Content-Type header.

-
- -

Syntax

- -

General structure

- -
type/subtype
- -

A MIME type consists of a type and a subtype — two strings separated by /. No whitespace is allowed. The type represents the category and can be a discrete or a multipart type. The subtype is specific to each type.

- -

MIME types are case-insensitive but traditionally written in lowercase.

- -

Discrete types

- -
text/plain
-text/html
-text/javascript
-text/css
-image/jpeg
-image/png
-audio/mpeg
-audio/ogg
-audio/*
-video/mp4
-application/*
-application/json
-application/ecmascript
-application/octet-stream
-…
- -

Discrete types indicate the category of the document. They can be one of the following:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TypeDescriptionExample of typical subtypes
textAny document that contains text and is theoretically human readabletext/plain, text/html, text/css, text/javascript, text/markdown
imageAny kind of image. Videos are not included, though animated images (like animated GIF) are described with an image type.image/gif, image/png, image/jpeg, image/bmp, image/webp, image/vnd.microsoft.icon
audioAny kind of audio fileaudio/midi, audio/mpeg, audio/webm, audio/ogg, audio/wav
videoAny kind of video filevideo/webm, video/ogg
application -

Any kind of binary data, especially data that will be executed or interpreted somehow.

-
application/octet-stream, application/pkcs12, application/vnd.mspowerpoint, application/xhtml+xml, application/xml, application/pdf
- -

For text documents without a specific subtype, text/plain should be used.

- -

Similarly, for binary documents without a specific or known subtype, application/octet-stream should be used.

- -

Multipart types

- -
multipart/form-data
-multipart/byteranges
- -

Multipart types indicate a category of document broken into pieces, often with different MIME types. They represent a composite document. With the exception of multipart/form-data, used in the {{HTTPMethod("POST")}} method of HTML Forms, and multipart/byteranges, used with {{HTTPStatus("206")}} Partial Content to send part of a document, HTTP doesn't handle multipart documents in a special way: the message is transmitted to the browser (which will likely show a "Save As" window if it doesn't know how to display the document.)

- -

Important MIME types for Web developers

- -

application/octet-stream

- -

This is the default for binary files. As it means unknown binary file, browsers usually don't execute it, or even ask if it should be executed. They treat it as if the {{HTTPHeader("Content-Disposition")}} header was set to attachment, and propose a "Save As" dialog.

- -

text/plain

- -

This is the default for textual files. Even if it really means unknown textual file, browsers assume they can display it.

- -
-

Note that text/plain does not mean any kind of textual data. If they expect a specific kind of textual data, they will likely not consider it a match. Specifically if they download a text/plain file from a {{HTMLElement("link")}} element declaring a CSS files, they will not recognize it as a valid CSS files if presented with text/plain. The CSS mime type text/css must be used.

-
- -

text/css

- -

CSS files used to style a Web page must be sent with text/css. If a server doesn't recognize the .css suffix for CSS files, it may send them with text/plain or application/octet-stream MIME types. If so, they won't be recognized as CSS by most browsers and will be ignored.

- -

text/html

- -

All HTML content should be served with this type. Alternative MIME types for XHTML (like application/xhtml+xml) are mostly useless nowadays.

- -
-

Note: Use application/xml or application/xhtml+xml if you want XML’s strict parsing rules, <![CDATA[…]]> sections, or elements that aren't from HTML/SVG/MathML namespaces.

-
- -

text/javascript

- -

The Scripting languages section of the HTML Standard states:

- -
-

Servers should use text/javascript for JavaScript resources. Servers should not use other JavaScript MIME types for JavaScript resources, and must not use non-JavaScript MIME types.

-
- -

The other JavaScript MIME types that should not be used are defined in the MIME Sniffing Standard as follows:

- -
    -
  • application/javascript {{deprecated_inline}}
  • -
  • application/ecmascript {{deprecated_inline}}
  • -
  • application/x-ecmascript {{non-standard_inline}} {{deprecated_inline}}
  • -
  • application/x-javascript {{non-standard_inline}} {{deprecated_inline}}
  • -
  • text/ecmascript {{deprecated_inline}}
  • -
  • text/javascript1.0 {{non-standard_inline}} {{deprecated_inline}}
  • -
  • text/javascript1.1 {{non-standard_inline}} {{deprecated_inline}}
  • -
  • text/javascript1.2 {{non-standard_inline}} {{deprecated_inline}}
  • -
  • text/javascript1.3 {{non-standard_inline}} {{deprecated_inline}}
  • -
  • text/javascript1.4 {{non-standard_inline}} {{deprecated_inline}}
  • -
  • text/javascript1.5 {{non-standard_inline}} {{deprecated_inline}}
  • -
  • text/jscript {{non-standard_inline}} {{deprecated_inline}}
  • -
  • text/livescript {{non-standard_inline}} {{deprecated_inline}}
  • -
  • text/x-ecmascript {{non-standard_inline}} {{deprecated_inline}}
  • -
  • text/x-javascript {{non-standard_inline}} {{deprecated_inline}}
  • -
- -

Image types

- -

Only a few image types are widely recognized enough to be safe for use in a Web page:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MIME typeImage type
image/gifGIF images (lossless compression, superseded by PNG)
image/jpegJPEG images
image/pngPNG images
image/svg+xmlSVG images (vector images)
image/x-icon, image/vnd.microsoft.icon[1]Windows icons
- -

There is a discussion to add WebP (image/webp) to this list, but browser vendors are cautious in accepting it.

- -

Other kinds of images can be found in Web documents. For example, many browsers support ICO images for favicons with the image/x-icon MIME type.

- -
-
Footnote 1
-
Despite image/vnd.microsoft.icon being registered with IANA, it is largely unsupported, and image/x-icon is being used instead.
-
- -

Audio and video types

- -

Like images, HTML doesn't define supported types for the {{HTMLElement("audio")}} and{{HTMLElement("video")}} elements, so only some can be used on the Web. Media formats supported by the HTML audio and video elements explains both the codecs and container formats which can be used.

- -

The MIME type of audiovisual files mostly indicate the container formats. The most common ones on the Web are:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MIME typeAudio or video type
audio/wave
- audio/wav
- audio/x-wav
- audio/x-pn-wav
An audio file in the WAVE container format. The PCM audio codec (WAVE codec "1") is often supported, but other codecs have limited support (if any).
audio/webmAn audio file in the WebM container format. Vorbis and Opus are the most common audio codecs.
video/webmA video file, possibly with audio, in the WebM container format. VP8 and VP9 are the most common video codecs; Vorbis and Opus the most common audio codecs.
audio/oggAn audio file in the OGG container format. Vorbis is the most common audio codec used in such a container.
video/oggA video file, possibly with audio, in the OGG container format. Theora is the usual video codec used within it; Vorbis is the usual audio codec.
application/oggAn audio or video file using the OGG container format. Theora is the usual video codec used within it; Vorbis is the usual audio codec.
- -

multipart/form-data

- -

The multipart/form-data type can be used when sending the values of a completed HTML Form from browser to server.

- -

As a multipart document format, it consists of different parts, delimited by a boundary (a string starting with a double dash '--'). Each part is its own entity with its own HTTP headers, {{HTTPHeader("Content-Disposition")}}, and {{HTTPHeader("Content-Type")}} for file uploading fields.

- -
Content-Type: multipart/form-data; boundary=aBoundaryString
-(other headers associated with the multipart document as a whole)
-
---aBoundaryString
-Content-Disposition: form-data; name="myFile"; filename="img.jpg"
-Content-Type: image/jpeg
-
-(data)
---aBoundaryString
-Content-Disposition: form-data; name="myField"
-
-(data)
---aBoundaryString
-(more subparts)
---aBoundaryString--
-
-
- -

The following <form>:

- -
<form action="http://localhost:8000/" method="post" enctype="multipart/form-data">
-  <label>Name: <input name="myTextField" value="Test"></label>
-  <label><input type="checkbox" name="myCheckBox"> Check</label>
-  <label>Upload file: <input type="file" name="myFile" value="test.txt"></label>
-  <button>Send the file</button>
-</form>
- -

will send this message:

- -
POST / HTTP/1.1
-Host: localhost:8000
-User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:50.0) Gecko/20100101 Firefox/50.0
-Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
-Accept-Language: en-US,en;q=0.5
-Accept-Encoding: gzip, deflate
-Connection: keep-alive
-Upgrade-Insecure-Requests: 1
-Content-Type: multipart/form-data; boundary=---------------------------8721656041911415653955004498
-Content-Length: 465
-
------------------------------8721656041911415653955004498
-Content-Disposition: form-data; name="myTextField"
-
-Test
------------------------------8721656041911415653955004498
-Content-Disposition: form-data; name="myCheckBox"
-
-on
------------------------------8721656041911415653955004498
-Content-Disposition: form-data; name="myFile"; filename="test.txt"
-Content-Type: text/plain
-
-Simple file.
------------------------------8721656041911415653955004498--
-
-
- -

multipart/byteranges

- -

The multipart/byteranges MIME type is used to send partial responses to the browser.

- -

When the {{HTTPStatus("206")}} Partial Content status code is sent, this MIME type indicates that the document is composed of several parts, one for each of the requested ranges. Like other multipart types, the {{HTTPHeader("Content-Type")}} uses a boundary to separate the pieces. Each piece has a {{HTTPHeader("Content-Type")}} header with its actual type and a {{HTTPHeader("Content-Range")}} of the range it represents.

- -
HTTP/1.1 206 Partial Content
-Accept-Ranges: bytes
-Content-Type: multipart/byteranges; boundary=3d6b6a416f9b5
-Content-Length: 385
-
---3d6b6a416f9b5
-Content-Type: text/html
-Content-Range: bytes 100-200/1270
-
-eta http-equiv="Content-type" content="text/html; charset=utf-8" />
-    <meta name="vieport" content
---3d6b6a416f9b5
-Content-Type: text/html
-Content-Range: bytes 300-400/1270
-
--color: #f0f0f2;
-        margin: 0;
-        padding: 0;
-        font-family: "Open Sans", "Helvetica
---3d6b6a416f9b5--
- -

Importance of setting the correct MIME type

- -

Most web servers send unrecognized resources as the application/octet-stream MIME type. For security reasons, most browsers do not allow setting a custom default action for such resources, forcing the user to save it to disk to use it.

- -

Some common incorrect server configurations:

- -
    -
  • -

    RAR-compressed files. In this case, the ideal would be the true type of the original files; this is often impossible as .RAR files can hold several resources of different types. In this case, configure the server to send application/x-rar-compressed.

    -
  • -
  • -

    Audio and video. Only resources with the correct MIME Type will be played in {{ HTMLElement("video") }} or {{ HTMLElement("audio") }} elements. Be sure to use the correct type for audio and video.

    -
  • -
  • -

    Proprietary file types. Avoid using application/octet-stream as most browsers do not allow defining a default behavior (like "Open in Word") for this generic MIME type. A specific type like application/vnd.mspowerpoint lets users open such files automatically in the presentation software of their choice.

    -
  • -
- -

MIME sniffing

- -

In the absence of a MIME type, or in certain cases where browsers believe they are incorrect, browsers may perform MIME sniffing — guessing the correct MIME type by looking at the bytes of the resource.

- -

Each browser performs MIME sniffing differently and under different circumstances. (For example, Safari will look at the file extension in the URL if the sent MIME type is unsuitable.) There are security concerns as some MIME types represent executable content. Servers can prevent MIME sniffing by sending the {{HTTPHeader("X-Content-Type-Options")}} header.

- -

Other methods of conveying document type

- -

MIME types are not the only way to convey document type information:

- -
    -
  • Filename suffixes are sometimes used, especially on Microsoft Windows. Not all operating systems consider these suffixes meaningful (such as Linux and MacOS), and there is no guarantee they are correct.
  • -
  • Magic numbers. The syntax of different formats allows file-type inference by looking at their byte structure. For example, GIF files start with the 47 49 46 38 39 hexadecimal value (GIF89), and PNG files with 89 50 4E 47 (.PNG). Not all file types have magic numbers, so this is not 100% reliable either.
  • -
- -

See also

- - - -
{{HTTPSidebar}}
diff --git a/files/ar/web/http/connection_management_in_http_1.x/index.html b/files/ar/web/http/connection_management_in_http_1.x/index.html deleted file mode 100644 index de95b35122..0000000000 --- a/files/ar/web/http/connection_management_in_http_1.x/index.html +++ /dev/null @@ -1,86 +0,0 @@ ---- -title: Connection management in HTTP/1.x -slug: Web/HTTP/Connection_management_in_HTTP_1.x -translation_of: Web/HTTP/Connection_management_in_HTTP_1.x ---- -
{{HTTPSidebar}}
- -

Connection management is a key topic in HTTP: opening and maintaining connections largely impacts the performance of Web sites and Web applications. In HTTP/1.x, there are several models: short-lived connections, persistent connections, and HTTP pipelining.

- -

HTTP mostly relies on TCP for its transport protocol, providing a connection between the client and the server. In its infancy, HTTP used a single model to handle such connections. These connections were short-lived: a new one created each time a request needed sending, and closed once the answer had been received.

- -

This simple model held an innate limitation on performance: opening each TCP connection is a resource-consuming operation. Several messages must be exchanged between the client and the server. Network latency and bandwidth affect performance when a request needs sending. Modern Web pages require many requests (a dozen or more) to serve the amount of information needed, proving this earlier model inefficient.

- -

Two newer models were created in HTTP/1.1. The persistent-connection model keeps connections opened between successive requests, reducing the time needed to open new connections. The HTTP pipelining model goes one step further, by sending several successive requests without even waiting for an answer, reducing much of the latency in the network.

- -

Compares the performance of the three HTTP/1.x connection models: short-lived connections, persistent connections, and HTTP pipelining.

- -
-

HTTP/2 adds additional models for connection management.

-
- -

It's important point to note that connection management in HTTP applies to the connection between two consecutive nodes, which is hop-by-hop and not end-to-end. The model used in connections between a client and its first proxy may differ from the model between a proxy and the destination server (or any intermediate proxies). The HTTP headers involved in defining the connection model, like {{HTTPHeader("Connection")}} and {{HTTPHeader("Keep-Alive")}}, are hop-by-hop headers with their values able to be changed by intermediary nodes.

- -

A related topic is the concept of HTTP connection upgrades, wherein an HTTP/1.1 connection is upgraded to a different protocol, such as TLS/1.0, WebSocket, or even HTTP/2 in cleartext. This protocol upgrade mechanism is documented in more detail elsewhere.

- -

Short-lived connections

- -

The original model of HTTP, and the default one in HTTP/1.0, is short-lived connections. Each HTTP request is completed on its own connection; this means a TCP handshake happens before each HTTP request, and these are serialized.

- -

The TCP handshake itself is time-consuming, but a TCP connection adapts to its load, becoming more efficient with more sustained (or warm) connections. Short-lived connections do not make use of this efficiency feature of TCP, and performance degrades from optimum by persisting to transmit over a new, cold connection.

- -

This model is the default model used in HTTP/1.0 (if there is no {{HTTPHeader("Connection")}} header, or if its value is set to close). In HTTP/1.1, this model is only used when the {{HTTPHeader("Connection")}} header is sent with a value of close.

- -
-

Unless dealing with a very old system, which doesn't support a persistent connection, there is no compelling reason to use this model.

-
- -

Persistent connections

- -

Short-lived connections have two major hitches: the time taken to establish a new connection is significant, and performance of the underlying TCP connection gets better only when this connection has been in use for some time (warm connection). To ease these problems, the concept of a persistent connection has been designed, even prior to HTTP/1.1. Alternatively this may be called a keep-alive connection.

- -

A persistent connection is one which remains open for a period of time, and can be reused for several requests, saving the need for a new TCP handshake, and utilizing TCP's performance enhancing capabilities. This connection will not stay open forever: idle connections are closed after some time (a server may use the {{HTTPHeader("Keep-Alive")}} header to specify a minimum time the connection should be kept open).

- -

Persistent connections also have drawbacks; even when idling they consume server resources, and under heavy load, {{glossary("DoS attack", "DoS attacks")}} can be conducted. In such cases, using non-persistent connections, which are closed as soon as they are idle, can provide better performance.

- -

HTTP/1.0 connections are not persistent by default. Setting {{HTTPHeader("Connection")}} to anything other than close, usually retry-after, will make them persistent.

- -

In HTTP/1.1, persistence is the default, and the header is no longer needed (but it is often added as a defensive measure against cases requiring a fallback to HTTP/1.0).

- -

HTTP pipelining

- -
-

HTTP pipelining is not activated by default in modern browsers:

- -
    -
  • Buggy proxies are still common and these lead to strange and erratic behaviors that Web developers cannot foresee and diagnose easily.
  • -
  • Pipelining is complex to implement correctly: the size of the resource being transferred, the effective RTT that will be used, as well as the effective bandwidth, have a direct incidence on the improvement provided by the pipeline. Without knowing these, important messages may be delayed behind unimportant ones. The notion of important even evolves during page layout! HTTP pipelining therefore brings a marginal improvement in most cases only.
  • -
  • Pipelining is subject to the HOL problem.
  • -
- -

For these reasons, pipelining has been superseded by a better algorithm, multiplexing, that is used by HTTP/2.

-
- -

By default, HTTP requests are issued sequentially. The next request is only issued once the response to the current request has been received. As they are affected by network latencies and bandwidth limitations, this can result in significant delay before the next request is seen by the server.

- -

Pipelining is the process to send successive requests, over the same persistent connection, without waiting for the answer. This avoids latency of the connection. Theoretically, performance could also be improved if two HTTP requests were to be packed into the same TCP message. The typical MSS (Maximum Segment Size), is big enough to contain several simple requests, although the demand in size of HTTP requests continues to grow.

- -

Not all types of HTTP requests can be pipelined: only {{glossary("idempotent")}} methods, that is {{HTTPMethod("GET")}}, {{HTTPMethod("HEAD")}}, {{HTTPMethod("PUT")}} and {{HTTPMethod("DELETE")}}, can be replayed safely: should a failure happen, the pipeline content can simply be repeated.

- -

Today, every HTTP/1.1-compliant proxy and server should support pipelining, though many have limitations in practice: a significant reason no modern browser activates this feature by default.

- -

Domain sharding

- -
-

Unless you have a very specific immediate need, don't use this deprecated technique; switch to HTTP/2 instead. In HTTP/2, domain sharding is no longer useful: the HTTP/2 connection is able to handle parallel unprioritized requests very well. Domain sharding is even detrimental to performance. Most HTTP/2 implementations use a technique called connection coalescing to revert eventual domain sharding.

-
- -

As an HTTP/1.x connection is serializing requests, even without any ordering, it can't be optimal without large enough available bandwidth. As a solution, browsers open several connections to each domain, sending parallel requests. Default was once 2 to 3 connections, but this has now increased to a more common use of 6 parallel connections. There is a risk of triggering DoS protection on the server side if attempting more than this number.

- -

If the server wishes a faster Web site or application response, it is possible for the server to force the opening of more connections. For example, Instead of having all resources on the same domain, say www.example.com, it could split over several domains, www1.example.com, www2.example.com, www3.example.com. Each of these domains resolve to the same server, and the Web browser will open 6 connections to each (in our example, boosting the connections to 18). This technique is called domain sharding.

- -

- -

Conclusion

- -

Improved connection management allows considerable boosting of performance in HTTP. With HTTP/1.1 or HTTP/1.0, using a persistent connection – at least until it becomes idle – leads to the best performance. However, the failure of pipelining has lead to designing superior connection management models, which have been incorporated into HTTP/2.

diff --git a/files/ar/web/http/headers/index.html b/files/ar/web/http/headers/index.html deleted file mode 100644 index b9b35f84dc..0000000000 --- a/files/ar/web/http/headers/index.html +++ /dev/null @@ -1,433 +0,0 @@ ---- -title: HTTP headers -slug: Web/HTTP/Headers -tags: - - HTTP - - HTTP Header - - Headers - - NeedsTranslation - - Networking - - Overview - - Reference - - TopicStub -translation_of: Web/HTTP/Headers ---- -
{{HTTPSidebar}}
- -

HTTP headers let the client and the server pass additional information with an HTTP request or response. An HTTP header consists of its case-insensitive name followed by a colon (:), then by its value. Whitespace before the value is ignored.

- -

Custom proprietary headers have historically been used with an X- prefix, but this convention was deprecated in June 2012 because of the inconveniences it caused when nonstandard fields became standard in RFC 6648; others are listed in an IANA registry, whose original content was defined in RFC 4229. IANA also maintains a registry of proposed new HTTP headers.

- -

Headers can be grouped according to their contexts:

- -
    -
  • {{Glossary("General header", "General headers")}} apply to both requests and responses, but with no relation to the data transmitted in the body.
  • -
  • {{Glossary("Request header", "Request headers")}} contain more information about the resource to be fetched, or about the client requesting the resource.
  • -
  • {{Glossary("Response header", "Response headers")}} hold additional information about the response, like its location or about the server providing it.
  • -
  • {{Glossary("Entity header", "Entity headers")}} contain information about the body of the resource, like its content length or MIME type.
  • -
- -

Headers can also be grouped according to how proxies handle them:

- -
    -
  • {{ httpheader("Connection") }}
  • -
  • {{ httpheader("Keep-Alive") }}
  • -
  • {{ httpheader("Proxy-Authenticate") }}
  • -
  • {{ httpheader("Proxy-Authorization") }}
  • -
  • {{ httpheader("TE") }}
  • -
  • {{ httpheader("Trailer") }}
  • -
  • {{ httpheader("Transfer-Encoding") }}
  • -
  • {{ httpheader("Upgrade") }}.
  • -
- -
-
End-to-end headers
-
These headers must be transmitted to the final recipient of the message: the server for a request, or the client for a response. Intermediate proxies must retransmit these headers unmodified and caches must store them.
-
Hop-by-hop headers
-
These headers are meaningful only for a single transport-level connection, and must not be retransmitted by proxies or cached. Note that only hop-by-hop headers may be set using the {{ httpheader("Connection") }} general header.
-
- -

Authentication

- -
-
{{HTTPHeader("WWW-Authenticate")}}
-
Defines the authentication method that should be used to access a resource.
-
{{HTTPHeader("Authorization")}}
-
Contains the credentials to authenticate a user-agent with a server.
-
{{HTTPHeader("Proxy-Authenticate")}}
-
Defines the authentication method that should be used to access a resource behind a proxy server.
-
{{HTTPHeader("Proxy-Authorization")}}
-
Contains the credentials to authenticate a user agent with a proxy server.
-
- -

Caching

- -
-
{{HTTPHeader("Age")}}
-
The time, in seconds, that the object has been in a proxy cache.
-
{{HTTPHeader("Cache-Control")}}
-
Directives for caching mechanisms in both requests and responses.
-
{{HTTPHeader("Clear-Site-Data")}}
-
Clears browsing data (e.g. cookies, storage, cache) associated with the requesting website.
-
{{HTTPHeader("Expires")}}
-
The date/time after which the response is considered stale.
-
{{HTTPHeader("Pragma")}}
-
Implementation-specific header that may have various effects anywhere along the request-response chain. Used for backwards compatibility with HTTP/1.0 caches where the Cache-Control header is not yet present.
-
{{HTTPHeader("Warning")}}
-
General warning information about possible problems.
-
- -

Client hints

- -

HTTP Client hints are a work in progress. Actual documentation can be found on the website of the HTTP working group.

- -
-
{{HTTPHeader("Accept-CH")}} {{experimental_inline}}
-
Servers can advertise support for Client Hints using the Accept-CH header field or an equivalent HTML <meta> element with http-equiv attribute ([HTML5]).
-
{{HTTPHeader("Accept-CH-Lifetime")}} {{experimental_inline}}
-
Servers can ask the client to remember the set of Client Hints that the server supports for a specified period of time, to enable delivery of Client Hints on subsequent requests to the server’s origin ([RFC6454]).
-
{{HTTPHeader("Early-Data")}} {{experimental_inline}}
-
Indicates that the request has been conveyed in early data.
-
{{HTTPHeader("Content-DPR")}} {{experimental_inline}}
-
A number that indicates the ratio between physical pixels over CSS pixels of the selected image response.
-
{{HTTPHeader("DPR")}} {{experimental_inline}}
-
A number that indicates the client’s current Device Pixel Ratio (DPR), which is the ratio of physical pixels over CSS pixels (Section 5.2 of [CSSVAL]) of the layout viewport (Section 9.1.1 of [CSS2]) on the device.
-
{{HTTPHeader("Device-Memory")}} {{experimental_inline}}
-
Technically a part of Device Memory API, this header represents an approximate amount of RAM client has.
-
{{HTTPHeader("Save-Data")}} {{experimental_inline}}
-
A boolean that indicates the user agent's preference for reduced data usage.
-
{{HTTPHeader("Viewport-Width")}} {{experimental_inline}}
-
-
-

A number that indicates the layout viewport width in CSS pixels. The provided pixel value is a number rounded to the smallest following integer (i.e. ceiling value).

-
- -
-

If Viewport-Width occurs in a message more than once, the last value overrides all previous occurrences.

-
-
-
{{HTTPHeader("Width")}} {{experimental_inline}}
-
-
-

The Width request header field is a number that indicates the desired resource width in physical pixels (i.e. intrinsic size of an image). The provided pixel value is a number rounded to the smallest following integer (i.e. ceiling value).

-
- -
-

If the desired resource width is not known at the time of the request or the resource does not have a display width, the Width header field can be omitted. If Width occurs in a message more than once, the last value overrides all previous occurrences

-
-
-
- -

Conditionals

- -
-
{{HTTPHeader("Last-Modified")}}
-
The last modification date of the resource, used to compare several versions of the same resource. It is less accurate than {{HTTPHeader("ETag")}}, but easier to calculate in some environments. Conditional requests using {{HTTPHeader("If-Modified-Since")}} and {{HTTPHeader("If-Unmodified-Since")}} use this value to change the behavior of the request.
-
{{HTTPHeader("ETag")}}
-
A unique string identifying the version of the resource. Conditional requests using {{HTTPHeader("If-Match")}} and {{HTTPHeader("If-None-Match")}} use this value to change the behavior of the request.
-
{{HTTPHeader("If-Match")}}
-
Makes the request conditional, and applies the method only if the stored resource matches one of the given ETags.
-
{{HTTPHeader("If-None-Match")}}
-
Makes the request conditional, and applies the method only if the stored resource doesn't match any of the given ETags. This is used to update caches (for safe requests), or to prevent to upload a new resource when one already exists.
-
{{HTTPHeader("If-Modified-Since")}}
-
Makes the request conditional, and expects the entity to be transmitted only if it has been modified after the given date. This is used to transmit data only when the cache is out of date.
-
{{HTTPHeader("If-Unmodified-Since")}}
-
Makes the request conditional, and expects the entity to be transmitted only if it has not been modified after the given date. This ensures the coherence of a new fragment of a specific range with previous ones, or to implement an optimistic concurrency control system when modifying existing documents.
-
{{HTTPHeader("Vary")}}
-
Determines how to match request headers to decide whether a cached response can be used rather than requesting a fresh one from the origin server.
-
- -

Connection management

- -
-
{{HTTPHeader("Connection")}}
-
Controls whether the network connection stays open after the current transaction finishes.
-
{{HTTPHeader("Keep-Alive")}}
-
Controls how long a persistent connection should stay open.
-
- -

Content negotiation

- -
-
{{HTTPHeader("Accept")}}
-
Informs the server about the types of data that can be sent back.
-
{{HTTPHeader("Accept-Charset")}}
-
Which character encodings the client understands.
-
{{HTTPHeader("Accept-Encoding")}}
-
The encoding algorithm, usually a compression algorithm, that can be used on the resource sent back.
-
{{HTTPHeader("Accept-Language")}}
-
Informs the server about the human language the server is expected to send back. This is a hint and is not necessarily under the full control of the user: the server should always pay attention not to override an explicit user choice (like selecting a language from a dropdown).
-
- -

Controls

- -
-
{{HTTPHeader("Expect")}}
-
Indicates expectations that need to be fulfilled by the server to properly handle the request.
-
{{HTTPHeader("Max-Forwards")}}
-
- -

Cookies

- -
-
{{HTTPHeader("Cookie")}}
-
Contains stored HTTP cookies previously sent by the server with the {{HTTPHeader("Set-Cookie")}} header.
-
{{HTTPHeader("Set-Cookie")}}
-
Send cookies from the server to the user-agent.
-
{{HTTPHeader("Cookie2")}} {{obsolete_inline}}
-
Contains an HTTP cookie previously sent by the server with the {{HTTPHeader("Set-Cookie2")}} header, but has been obsoleted. Use {{HTTPHeader("Cookie")}} instead.
-
{{HTTPHeader("Set-Cookie2")}} {{obsolete_inline}}
-
Sends cookies from the server to the user-agent, but has been obsoleted. Use {{HTTPHeader("Set-Cookie")}} instead.
-
- -

CORS

- -

Learn more about CORS here.

- -
-
{{HTTPHeader("Access-Control-Allow-Origin")}}
-
Indicates whether the response can be shared.
-
{{HTTPHeader("Access-Control-Allow-Credentials")}}
-
Indicates whether the response to the request can be exposed when the credentials flag is true.
-
{{HTTPHeader("Access-Control-Allow-Headers")}}
-
Used in response to a preflight request to indicate which HTTP headers can be used when making the actual request.
-
{{HTTPHeader("Access-Control-Allow-Methods")}}
-
Specifies the methods allowed when accessing the resource in response to a preflight request.
-
{{HTTPHeader("Access-Control-Expose-Headers")}}
-
Indicates which headers can be exposed as part of the response by listing their names.
-
{{HTTPHeader("Access-Control-Max-Age")}}
-
Indicates how long the results of a preflight request can be cached.
-
{{HTTPHeader("Access-Control-Request-Headers")}}
-
Used when issuing a preflight request to let the server know which HTTP headers will be used when the actual request is made.
-
{{HTTPHeader("Access-Control-Request-Method")}}
-
Used when issuing a preflight request to let the server know which HTTP method will be used when the actual request is made.
-
{{HTTPHeader("Origin")}}
-
Indicates where a fetch originates from.
-
{{HTTPHeader("Service-Worker-Allowed")}}
-
Used to remove the path restriction by including this header in the response of the Service Worker script.
-
{{HTTPHeader("Timing-Allow-Origin")}}
-
Specifies origins that are allowed to see values of attributes retrieved via features of the Resource Timing API, which would otherwise be reported as zero due to cross-origin restrictions.
-
{{HTTPHeader("X-Permitted-Cross-Domain-Policies")}}
-
Specifies if a cross-domain policy file (crossdomain.xml) is allowed. The file may define a policy to grant clients, such as Adobe's Flash Player, Adobe Acrobat, Microsoft Silverlight, or Apache Flex, permission to handle data across domains that would otherwise be restricted due to the Same-Origin Policy. See the Cross-domain Policy File Specification for more information.
-
- -

Do Not Track

- -
-
{{HTTPHeader("DNT")}}
-
Expresses the user's tracking preference.
-
{{HTTPHeader("Tk")}}
-
Indicates the tracking status of the corresponding response.
-
- -

Downloads

- -
-
{{HTTPHeader("Content-Disposition")}}
-
Indicates if the resource transmitted should be displayed inline (default behavior without the header), or if it should be handled like a download and the browser should present a “Save As” dialog.
-
- -

Message body information

- -
-
{{HTTPHeader("Content-Length")}}
-
The size of the resource, in decimal number of bytes.
-
{{HTTPHeader("Content-Type")}}
-
Indicates the media type of the resource.
-
{{HTTPHeader("Content-Encoding")}}
-
Used to specify the compression algorithm.
-
{{HTTPHeader("Content-Language")}}
-
Describes the human language(s) intended for the audience, so that it allows a user to differentiate according to the users' own preferred language.
-
{{HTTPHeader("Content-Location")}}
-
Indicates an alternate location for the returned data.
-
- -

Proxies

- -
-
{{HTTPHeader("Forwarded")}}
-
Contains information from the client-facing side of proxy servers that is altered or lost when a proxy is involved in the path of the request.
-
{{HTTPHeader("X-Forwarded-For")}} {{non-standard_inline}}
-
Identifies the originating IP addresses of a client connecting to a web server through an HTTP proxy or a load balancer.
-
{{HTTPHeader("X-Forwarded-Host")}} {{non-standard_inline}}
-
Identifies the original host requested that a client used to connect to your proxy or load balancer.
-
{{HTTPHeader("X-Forwarded-Proto")}} {{non-standard_inline}}
-
Identifies the protocol (HTTP or HTTPS) that a client used to connect to your proxy or load balancer.
-
{{HTTPHeader("Via")}}
-
Added by proxies, both forward and reverse proxies, and can appear in the request headers and the response headers.
-
- -

Redirects

- -
-
{{HTTPHeader("Location")}}
-
Indicates the URL to redirect a page to.
-
- -

Request context

- -
-
{{HTTPHeader("From")}}
-
Contains an Internet email address for a human user who controls the requesting user agent.
-
{{HTTPHeader("Host")}}
-
Specifies the domain name of the server (for virtual hosting), and (optionally) the TCP port number on which the server is listening.
-
{{HTTPHeader("Referer")}}
-
The address of the previous web page from which a link to the currently requested page was followed.
-
{{HTTPHeader("Referrer-Policy")}}
-
Governs which referrer information sent in the {{HTTPHeader("Referer")}} header should be included with requests made.
-
{{HTTPHeader("User-Agent")}}
-
Contains a characteristic string that allows the network protocol peers to identify the application type, operating system, software vendor or software version of the requesting software user agent. See also the Firefox user agent string reference.
-
- -

Response context

- -
-
{{HTTPHeader("Allow")}}
-
Lists the set of HTTP request methods support by a resource.
-
{{HTTPHeader("Server")}}
-
Contains information about the software used by the origin server to handle the request.
-
- -

Range requests

- -
-
{{HTTPHeader("Accept-Ranges")}}
-
Indicates if the server supports range requests, and if so in which unit the range can be expressed.
-
{{HTTPHeader("Range")}}
-
Indicates the part of a document that the server should return.
-
{{HTTPHeader("If-Range")}}
-
Creates a conditional range request that is only fulfilled if the given etag or date matches the remote resource. Used to prevent downloading two ranges from incompatible version of the resource.
-
{{HTTPHeader("Content-Range")}}
-
Indicates where in a full body message a partial message belongs.
-
- -

Security

- -
-
{{HTTPHeader("Cross-Origin-Opener-Policy")}} ({{Glossary("COOP")}})
-
Prevents other domains from opening/controlling a window.
-
{{HTTPHeader("Cross-Origin-Resource-Policy")}} ({{Glossary("CORP")}})
-
Prevents other domains from reading the response of the resources to which this header is applied.
-
{{HTTPHeader("Content-Security-Policy")}} ({{Glossary("CSP")}})
-
Controls resources the user agent is allowed to load for a given page.
-
{{HTTPHeader("Content-Security-Policy-Report-Only")}}
-
Allows web developers to experiment with policies by monitoring, but not enforcing, their effects. These violation reports consist of {{Glossary("JSON")}} documents sent via an HTTP POST request to the specified URI.
-
{{HTTPHeader("Expect-CT")}}
-
Allows sites to opt in to reporting and/or enforcement of Certificate Transparency requirements, which prevents the use of misissued certificates for that site from going unnoticed. When a site enables the Expect-CT header, they are requesting that Chrome check that any certificate for that site appears in public CT logs.
-
{{HTTPHeader("Feature-Policy")}}
-
Provides a mechanism to allow and deny the use of browser features in its own frame, and in iframes that it embeds.
-
{{HTTPHeader("Public-Key-Pins")}} ({{Glossary("HPKP")}})
-
Associates a specific cryptographic public key with a certain web server to decrease the risk of {{Glossary("MITM")}} attacks with forged certificates.
-
{{HTTPHeader("Public-Key-Pins-Report-Only")}}
-
Sends reports to the report-uri specified in the header and does still allow clients to connect to the server even if the pinning is violated.
-
{{HTTPHeader("Strict-Transport-Security")}} ({{Glossary("HSTS")}})
-
Force communication using HTTPS instead of HTTP.
-
{{HTTPHeader("Upgrade-Insecure-Requests")}}
-
Sends a signal to the server expressing the client’s preference for an encrypted and authenticated response, and that it can successfully handle the {{CSP("upgrade-insecure-requests")}} directive.
-
{{HTTPHeader("X-Content-Type-Options")}}
-
Disables MIME sniffing and forces browser to use the type given in {{HTTPHeader("Content-Type")}}.
-
{{HTTPHeader("X-Download-Options")}}
-
The X-Download-Options HTTP header indicates that the browser (Internet Explorer) should not display the option to "Open" a file that has been downloaded from an application, to prevent phishing attacks as the file otherwise would gain access to execute in the context of the application. (Note: related MS Edge bug).
-
{{HTTPHeader("X-Frame-Options")}} (XFO)
-
Indicates whether a browser should be allowed to render a page in a {{HTMLElement("frame")}}, {{HTMLElement("iframe")}}, {{HTMLElement("embed")}} or {{HTMLElement("object")}}.
-
{{HTTPHeader("X-Powered-By")}}
-
May be set by hosting environments or other frameworks and contains information about them while not providing any usefulness to the application or its visitors. Unset this header to avoid exposing potential vulnerabilities.
-
{{HTTPHeader("X-XSS-Protection")}}
-
Enables cross-site scripting filtering.
-
- -

Server-sent events

- -
-
{{HTTPHeader("Last-Event-ID")}}
-
...
-
{{HTTPHeader("NEL")}} {{experimental_inline}}
-
Defines a mechanism that enables developers to declare a network error reporting policy.
-
{{HTTPHeader("Ping-From")}}
-
...
-
{{HTTPHeader("Ping-To")}}
-
...
-
{{HTTPHeader("Report-To")}}
-
Used to specify a server endpoint for the browser to send warning and error reports to.
-
- -

Transfer coding

- -
-
{{HTTPHeader("Transfer-Encoding")}}
-
Specifies the form of encoding used to safely transfer the entity to the user.
-
{{HTTPHeader("TE")}}
-
Specifies the transfer encodings the user agent is willing to accept.
-
{{HTTPHeader("Trailer")}}
-
Allows the sender to include additional fields at the end of chunked message.
-
- -

WebSockets

- -
-
{{HTTPHeader("Sec-WebSocket-Key")}}
-
...
-
{{HTTPHeader("Sec-WebSocket-Extensions")}}
-
...
-
{{HTTPHeader("Sec-WebSocket-Accept")}}
-
...
-
{{HTTPHeader("Sec-WebSocket-Protocol")}}
-
...
-
{{HTTPHeader("Sec-WebSocket-Version")}}
-
...
-
- -

Other

- -
-
{{HTTPHeader("Accept-Push-Policy")}} {{experimental_inline}}
-
A client can express the desired push policy for a request by sending an Accept-Push-Policy header field in the request.
-
{{HTTPHeader("Accept-Signature")}} {{experimental_inline}}
-
A client can send the Accept-Signature header field to indicate intention to take advantage of any available signatures and to indicate what kinds of signatures it supports.
-
{{HTTPHeader("Alt-Svc")}}
-
Used to list alternate ways to reach this service.
-
{{HTTPHeader("Date")}}
-
Contains the date and time at which the message was originated.
-
{{HTTPHeader("Large-Allocation")}}
-
Tells the browser that the page being loaded is going to want to perform a large allocation.
-
{{HTTPHeader("Link")}}
-
The Link entity-header field provides a means for serialising one or more links in HTTP headers. It is semantically equivalent to the HTML {{HTMLElement("link")}} element.
-
{{HTTPHeader("Push-Policy")}} {{experimental_inline}}
-
A Push-Policy defines the server behaviour regarding push when processing a request.
-
{{HTTPHeader("Retry-After")}}
-
Indicates how long the user agent should wait before making a follow-up request.
-
{{HTTPHeader("Signature")}} {{experimental_inline}}
-
The Signature header field conveys a list of signatures for an exchange, each one accompanied by information about how to determine the authority of and refresh that signature.
-
{{HTTPHeader("Signed-Headers")}} {{experimental_inline}}
-
The Signed-Headers header field identifies an ordered list of response header fields to include in a signature.
-
{{HTTPHeader("Server-Timing")}}
-
Communicates one or more metrics and descriptions for the given request-response cycle.
-
{{HTTPHeader("SourceMap")}}
-
Links generated code to a source map.
-
{{HTTPHeader("Upgrade")}}
-
The relevant RFC document for the Upgrade header field is RFC 7230, section 6.7. The standard establishes rules for upgrading or changing to a different protocol on the current client, server, transport protocol connection. For example, this header standard allows a client to change from HTTP 1.1 to HTTP 2.0, assuming the server decides to acknowledge and implement the Upgrade header field. Neither party is required to accept the terms specified in the Upgrade header field. It can be used in both client and server headers. If the Upgrade header field is specified, then the sender MUST also send the Connection header field with the upgrade option specified. For details on the Connection header field please see section 6.1 of the aforementioned RFC.
-
{{HTTPHeader("X-DNS-Prefetch-Control")}}
-
Controls DNS prefetching, a feature by which browsers proactively perform domain name resolution on both links that the user may choose to follow as well as URLs for items referenced by the document, including images, CSS, JavaScript, and so forth.
-
{{HTTPHeader("X-Firefox-Spdy")}} {{deprecated_inline}} {{non-standard_inline}}
-
...
-
{{HTTPHeader("X-Pingback")}} {{non-standard_inline}}
-
...
-
{{HTTPHeader("X-Requested-With")}}
-
...
-
{{HTTPHeader("X-Robots-Tag")}}{{non-standard_inline}}
-
The X-Robots-Tag HTTP header is used to indicate how a web page is to be indexed within public search engine results. The header is effectively equivalent to <meta name="robots" content="...">.
-
{{HTTPHeader("X-UA-Compatible")}} {{non-standard_inline}}
-
Used by Internet Explorer to signal which document mode to use.
-
- -

Contributing

- -

You can help by writing new entries or improving the existing ones.

- -

See also

- - diff --git a/files/ar/web/http/index.html b/files/ar/web/http/index.html deleted file mode 100644 index 8d346f4b21..0000000000 --- a/files/ar/web/http/index.html +++ /dev/null @@ -1,79 +0,0 @@ ---- -title: HTTP -slug: Web/HTTP -tags: - - مرجع - - ميثاق نقل النص الفائق - - ويب -translation_of: Web/HTTP ---- -
{{HTTPSidebar}}
- -

ہائپر ٹیکسٹ ٹرانسفر پروٹوکول (ایچ ٹی ٹی پی) ہائپرمیڈیا دستاویزات ، جیسے ایچ ٹی ایم ایل کو منتقل کرنے کے لئے ایپلیکیشن لیئر پروٹوکول ہے۔

- -

بروتوكول نقل النص التشعبي (Hypertext Transfer Protocol) هو عبارة عن ميثاق (protocol) في طبقة التطبيقات (application-layer) مهمّته نقل مستندات الوسائط الفائقة، مثل وثائق لغة ترميز النص الفائق. صُمّمَ هذا الميثاق للتواصل فيما بين متصفّحات الويب، وخوادم الويب، لكن أيضاً يُمكن استخدامه لأغراضٍ أُخرى. يَتبِع الميثاق ما يُعرف بنموذج العميل/الخادم (client-server model)، حيث يقوم بإرسال طلب (request)، ومن ثم ينتظر ليتلقّى الإجابة (response) على هذا الطلب. بروتوكول نقل النص التشعبي عديم الحالة (stateless protocol) هذا يعني أنَّ الخادم لن يحتفظ بأيّ بيانات (حالة) بين الطلبين. بالرغم من أنَّ هذا الميثاق مبني على طبقة TCP/IP إلّا أنّه يمكن استخدامه على أي طبقة نقل موثوقة؛ أي مثياق لا يفقد الرسائل بصمت كما يفعل مثياق UDP.

- -
-
-

دروس

- -

تعلم استخدام HTTP مع الدورات والدروس الإرشاديّة التالية.

- -
-
لمحة عن HTTP
-
الميزات الأساسيّة لميثاق طرفي العميل والخادم (client-server protocole): ماذا يُمكِن أن يفعل، وما استخداماته.
-
ذاكرة التخزين المؤقت ل HTTP
-
تقنيّة التخزين المؤقت مهمة جداً لصفحات ويب أسرع. تشرح هذه المقالة الفرق بين طرق الخزين المؤقت، وكيفيّة استخدام ترويسات (headers) الميثاق للتحكم بها.
-
كعكات HTTP
-
آلية عمل الكعكات (ملفات تعريف الإرتباط) مشروحة في هذا المقال. عندما يتعامل الميثاق مع طلب، يُمكِن للخادم إرسالة الترويسة Set-Cookie مع الرد. ثم يقوم العميل بإعادة قيمة الكعكة مع كل طلب لنفس الخادم باستخدام الترويسة Cookie. يُمكِن أن تُضبَط الكعكات أيضاً لتنتهي صلاحيتها في تاريخ معين، أو لِتُحصَر فعاليتها في نطاق ومسار معين.
-
- -
-
تطور HTTP
-
وصف موجز للتغيّرات التي طرأت منذ الإصدارات الأولى من الميثاق، إلى الإصدارات الحديثة (الإصدار HTTP/2 وما بعده).
-
إرشادات أمان الويب من موزيلا
-
مجموعة من النصائح لتساعد المطورين على بناء تطبيقات ويب آمنة.
-
- -
-
رسائل ميثاق نقل النص الفائق
-
تشرح المقالة نوع وبنيّة أنواع الرسائل المختلفة في الإصدار الأول والثاني من الميثاق.
-
طريقة عمل جلسة ميثاق نقل النص الفائق النموذجيّة
-
تُظهِر المقالة وتشرح الكيفيّة التي تجري فيها جلسة الميثاق الإعتياديّة.
-
إدارة الإتصال في الإصدار الأول من الميثاق
-
تشرح المقالة نماذج إدارة الإتصال الثلاثة المتوفرة في الإصدار الأول، مغطيةً نقاط قوتهم وضعفهم.
-
-
- -
-

مراجع

- -

تصفَّح وثائق بروتوكول نقل النص التشعبي المرجعيَّة المُفصَّلة.

- -
-
ترويسات لغة ترميز النص الفائق
-
تُستخدم رسائل ترويسات الميثاق لوصف مورد، أو سلوك الخادم أو العميل. يمكن إضافة ترويسات مخصصة بواسطة البادِئة -X، الترويسات الأخرى مُعرفة في سجل IANA، والتي عُرِفَ محتواهاً بالأصل في RFC 4229. تعمل IANA أيضاً على إدارة سجل رسائل الترويسات الجديدة المُقترحة.
-
طرق الطلب في ميثاق نقل النص الفائق
-
العمليات المُختلفة التي يُمكِن أن تتم بواسطة الميثاق: {{HTTPMethod("GET")}}، {{HTTPMethod("POST")}}، ويوجد أيضاً طلبات أقل شيوعاً مثل {{HTTPMethod("OPTIONS")}}، {{HTTPMethod("DELETE")}}، أو {{HTTPMethod("TRACE")}}.
-
رموز الحالة
-
تشير رموز الحالة إلى ما إذا كان طلب معين قد تمَّ بنجاح. رموز الاستجابة مجموعة في خمس فئات: استجابة معلوماتية، استجابة ناجحة، إعادة توجيه، خطأ من جهة العميل، خطأ من جهة الخادم.
-
- -

أدوات وموارد

- -

أدوات وموارد مفيدة لفهم وتنقيح عمل HTTP.

- -
-
أدوات مطورين فايرفوكس
-
مُراقب الشبكة
-
مرقب موزيلا (Mozilla Observatory)
-
مشروع صُمِمَ ليساعد المطورين، مدراء النظام، والمختصين في الحماية على إعداد مواقعهم بشكل آمن.
-
أداة RedBot
-
أداة تساعد على التحقق من الترويسات المتعلقة بالتخزين المؤقت.
-
كيف تعمل المتصفحات
-
مقالة شاملة عن الأجزاء الداخليّة للمتصفحات وتدفق الطلبات في ميثاق نقل النص الفائق. على كل مطوِّر ويب أن يكون على دراية بمعلومات هذه المقالة.
-
-
-
- -
diff --git a/files/ar/web/http/overview/index.html b/files/ar/web/http/overview/index.html deleted file mode 100644 index d727b8cc7f..0000000000 --- a/files/ar/web/http/overview/index.html +++ /dev/null @@ -1,167 +0,0 @@ ---- -title: نظرة عامة عن HTTP -slug: Web/HTTP/Overview -translation_of: Web/HTTP/Overview ---- -
بروتكول ال HTTP هو {{Glossary("protocol")}} يسمح بجلب الموارد, مثل مستندات HTML. انه الأساس لتبادل أي بيانات على الويب بالأضافة من أنه يعمل كبروتوكول خادم-عميل, والذي يعني من أن الطلبات تبدأ من قبل العميل نفسه باستخدام المتصفح. يتم إعادة بناء المستند الكامل من مختلف الملفات الفرعية  المجلوبة. على سبيل المثال, النص و و صف التنسيق و الصور و مقاطع الفيديو و الملفات النصية و الكثير... 
- -

A Web document is the composition of different resources

- -

العملاء و الخادم يتواصلون من خلال تبادل الرسائل الفردية  (على عكس تدفق البيانات). يتم إرسال الرسائل من العميل نفسه, باستخدام متصفح الإنترنت على سبيل المثال, و يتم استدعاء البيانات التي تم ارسالها الى الخادم كجواب عن تلك الرسائل التي ارسلت من العميل.

- -

HTTP as an application layer protocol, on top of TCP (transport layer) and IP (network layer) and below the presentation layer.تم تصميم HTTP في أوائل التسعينيات ، وهو بروتوكول قابل للتوسيع تطور بمرور الوقت. إنه بروتوكول يعمل من خلال طبقة التطبيقات يتم إرساله عبر {{Glossary("TCP")}}, ، أو عبر اتصال TCP مشفر بواسطة {{Glossary("TLS")}}- ، على الرغم من أنه يمكن نظريًا استخدام أي بروتوكول نقل موثوق. نظرًا لقابليته للتوسعة ، فإنه لا يستخدم فقط لجلب مستندات النص التشعبي ، ولكن أيضًا الصور ومقاطع الفيديو أو لنشر المحتوى على الخوادم ، كما هو الحال مع نتائج نماذج HTML. يمكن أيضًا استخدام HTTP لجلب أجزاء من المستندات لتحديث صفحات الويب عند الطلب.

- -

  مكونات الأنظمة المستندة إلى الأنظمةHTTP

- -

HTTP هو بروتوكول خادم عميل: يتم إرسال الطلبات بواسطة كيان واحد أو وكيل المستخدم (أو وكيل نيابة عنه). في معظم الأحيان يكون وكيل المستخدم مستعرض ويب ، ولكن يمكن أن يكون أي شيء ، على سبيل المثال روبوت يزحف إلى الويب لملء فهرس محرك البحث والحفاظ عليه.

- -

يتم إرسال كل طلب فردي إلى الخادم الذي يتعامل معه ويقدم إجابة تسمى الاستجابة. بين العميل والخادم ، هناك العديد من الكيانات ، التي تسمى مجتمعة {{Glossary("Proxy_server", "proxies")}} ، والتي تؤدي عمليات مختلفة وتعمل كبوابات أو {{Glossary("Cache", "caches")}} ، على سبيل المثال.

- -

Client server chain

- -

في الحقيقة, هناك العديد من أجهزة الكمبيوتر بين المتصفح وبين الخادم الذي يعمل على معالجة الطلبات: هناك   الراوترز, المودمز, و الكثير. شكرا لمصمم طبقات شبكات الويب, هذه مخفية في طبقات الشبكة والنقل. HTTP في القمة, عند طبقة التطبيقات. على الرغم من أهمية تشخيص مشاكل الشبكة ، إلا أن الطبقات الأساسية لا علاقة لها في الغالب بوصف HTTP.

- -

العميل: وكيل المستخدم

- -

وكيل المستخدم هو أي أداة تعمل نيابة عن المستخدم. يتم تنفيذ هذا الدور بشكل أساسي بواسطة مستعرض الويب; الاحتمالات الأخرى هي البرامج التي يستخدمها المهندسون ومطورو الويب لتصحيح أخطاء تطبيقاتهم.

- -

المستعرض هو دائمًا الكيان الذي يبدأ الطلب. إنه ليس الخادم أبدًا (على الرغم من إضافة بعض الآليات على مر السنين لمحاكاة الرسائل التي يبدأها الخادم).

- -

لتقديم صفحة ويب ، يرسل المستعرض طلبًا أصليًا لجلب مستند HTML الذي يمثل الصفحة. يقوم بعد ذلك بتحليل هذا الملف ، وتقديم طلبات إضافية تتوافق مع البرامج النصية للتنفيذ ، ومعلومات التخطيط (CSS) لعرضها ، والموارد الفرعية الموجودة في الصفحة (عادةً الصور ومقاطع الفيديو). يقوم مستعرض الويب بعد ذلك بمزج هذه الموارد ليقدم للمستخدم مستندًا كاملاً ، صفحة الويب. يمكن للنصوص التي ينفذها المتصفح جلب المزيد من الموارد في مراحل لاحقة ويقوم المتصفح بتحديث صفحة الويب وفقًا لذلك.

- -

صفحة الويب هي مستند نص تشعبي. هذا يعني أن بعض أجزاء النص المعروض عبارة عن روابط يمكن تنشيطها (عادةً بنقرة الماوس) لجلب صفحة ويب جديدة ، مما يسمح للمستخدم بتوجيه وكيل المستخدم الخاص به والتنقل عبر الويب. يترجم المستعرض هذه الاتجاهات في طلبات HTTP ، ويفسر استجابات HTTP بشكل أكبر لتقديم استجابة واضحة للمستخدم

- -

The Web server

- -

على الجانب الآخر من قناة الاتصال ، يوجد الخادم ، الذي يخدم المستند حسب طلب العميل. يظهر الخادم كجهاز واحد فقط افتراضيًا: هذا لأنه قد يكون في الواقع مجموعة من الخوادم ، أو مشاركة الحمل (موازنة التحميل) أو قطعة معقدة من البرامج تستجوب أجهزة الكمبيوتر الأخرى (مثل ذاكرة التخزين المؤقت ، أو خادم قاعدة البيانات ، أو التجارة الإلكترونية الخوادم) ، لإنشاء المستند كليًا أو جزئيًا عند الطلب.

- -

ليس بالضرورة أن يكون الخادم جهازًا واحدًا ، ولكن يمكن استضافة العديد من مثيلات برنامج الخادم على نفس الجهاز. باستخدام HTTP / 1.1 ورأس {{HTTPHeader ("Host")}} ، يمكنهم أيضًا مشاركة عنوان IP نفسه.

- -

Proxies

- -

HTTP as an application layer protocol, on top of TCP (transport layer) and IP (network layer) and below the presentation layer.بين متصفح الويب والخادم ، تقوم العديد من أجهزة الكمبيوتر والآلات بنقل رسائل HTTP.. نظرًا للهيكل متعدد الطبقات لمكدس الويب ، يعمل معظمها على مستوى النقل أو الشبكة أو المستوى المادي ، وتصبح شفافة في طبقة HTTP ويحتمل أن يكون لها تأثير كبير على الأداء. تسمى تلك التي تعمل في طبقات التطبيق عمومًا الوكلاء(proxies). يمكن أن تكون هذه شفافة ، حيث يتم إعادة توجيه الطلبات التي يتلقونها دون تغييرها بأي شكل من الأشكال ، أو غير شفافة ، وفي هذه الحالة سوف يقومون بتغيير الطلب بطريقة ما قبل تمريره إلى الخادم. قد تؤدي الوكلاء وظائف عديدة:

- -
    -
  • التخزين المؤقت (يمكن أن تكون ذاكرة التخزين المؤقت عامة أو خاصة ، مثل ذاكرة التخزين المؤقت للمتصفح)
  • -
  • التصفية (مثل فحص مكافحة الفيروسات أو المراقبة الأبوية)
  • -
  • موازنة الحمل (للسماح لخوادم متعددة بخدمة الطلبات المختلفة)
  • -
  • المصادقة (للتحكم في الوصول إلى الموارد المختلفة)
  • -
  • التسجيل (السماح بتخزين المعلومات التاريخية)
  • -
- -

الجوانب الأساسية لـ HTTP

- -

HTTP بسيط

- -

تم تصميم HTTP بشكل عام ليكون بسيطًا وقابل للقراءة البشرية ، حتى مع التعقيد الإضافي المقدم في HTTP / 2 عن طريق تغليف رسائل HTTP في إطارات. يمكن قراءة رسائل HTTP وفهمها من قبل البشر ، مما يوفر اختبارًا أسهل للمطورين ، ويقلل من التعقيد للقادمين الجدد.

- -

HTTP قابل للتوسيع

- -

المقدمة في, HTTP headers HTTP هذا البروتوكول سهل التوسيع والتجربة. يمكن أيضًا تقديم وظائف جديدة من خلال اتفاقية بسيطة بين العميل والخادم حول دلالات الرأس الجديدة.

- -

HTTP عديم الحالة ، ولكن ليس بدون جلسات

- -

HTTP is stateless: there is no link between two requests being successively carried out on the same connection. This immediately has the prospect of being problematic for users attempting to interact with certain pages coherently, for example, using e-commerce shopping baskets. But while the core of HTTP itself is stateless, HTTP cookies allow the use of stateful sessions. Using header extensibility, HTTP Cookies are added to the workflow, allowing session creation on each HTTP request to share the same context, or the same state.

- -

HTTP والاتصالات

- -

على الرغم من أن HTTP لا يتطلب أن يكون بروتوكول النقل الأساسي قائمًا على الاتصال ؛ فقط تتطلب أن تكون موثوقة ، أو لا تفقد الرسائل (لذلك على الأقل تقديم خطأ). من بين بروتوكولي النقل الأكثر شيوعًا على الإنترنت ، يعتبر TCP موثوقًا و UDP ليس كذلك. لذلك يعتمد HTTP على معيار TCP ، الذي يعتمد على التوصيل.

- -

قبل أن يتمكن العميل والخادم من تبادل زوج طلب / استجابة HTTP ، يجب عليهم إنشاء اتصال TCP ، وهي عملية تتطلب عدة رحلات ذهابًا وإيابًا. السلوك الافتراضي لـ HTTP / 1.0 هو فتح اتصال TCP منفصل لكل زوج من طلبات / استجابة HTTP. هذا أقل كفاءة من مشاركة اتصال TCP واحد عندما يتم إرسال طلبات متعددة في تتابع قريب.

- -

من أجل التخفيف من هذا الخلل ، قدم HTTP / 1.1 خطوط الأنابيب (التي ثبت صعوبة تنفيذها) والتوصيلات المستمرة: يمكن التحكم في اتصال TCP الأساسي جزئيًا باستخدام الرأس {{HTTPHeader ("Connection")}}. تقدمت HTTP / 2 خطوة إلى الأمام من خلال تعدد إرسال الرسائل عبر اتصال واحد ، مما يساعد في الحفاظ على الاتصال دافئًا وأكثر كفاءة.

- -

التجارب جارية لتصميم بروتوكول نقل أفضل أكثر ملاءمة لـ HTTP. على سبيل المثال ، تقوم Google بالتجربة مع QUIC الذي يعتمد على UDP لتوفير بروتوكول نقل أكثر موثوقية وفعالية.

- -

ما يمكن التحكم فيه عن طريق HTTP

- -

هذه الطبيعة القابلة للتوسيع لـ HTTP ، بمرور الوقت ، سمحت بمزيد من التحكم والوظائف على الويب. تم التعامل مع طرق التخزين المؤقت أو المصادقة في وقت مبكر في سجل HTTP. على النقيض من ذلك ، تمت إضافة القدرة على تخفيف قيود الأصل فقط في 2010.

- -

فيما يلي قائمة بالميزات الشائعة التي يمكن التحكم فيها باستخدام HTTP.

- -
    -
  • Caching                                                                                                       يمكن التحكم في كيفية تخزين المستندات مؤقتًا بواسطة HTTP. يمكن للخادم توجيه الوكلاء والعملاء ، حول ما يجب تخزينه مؤقتًا ومدة ذلك. يمكن للعميل توجيه وكلاء ذاكرة التخزين المؤقت الوسيطة لتجاهل المستند المخزن.
  • -
  • To Relaxing the origin constraint                                                                  لمنع التطفل وانتهاكات الخصوصية الأخرى ، تفرض متصفحات الويب الفصل الصارم بين مواقع الويب. يمكن فقط للصفحات من نفس الأصل الوصول إلى كافة المعلومات الخاصة بصفحة الويب. على الرغم من أن هذا القيد يمثل عبئًا على الخادم ، إلا أن رؤوس HTTP يمكن أن تخفف هذا الفصل الصارم على جانب الخادم ، مما يسمح للمستند بأن يصبح خليطًا من المعلومات التي يتم الحصول عليها من مجالات مختلفة ؛ يمكن أن تكون هناك أسباب أمنية للقيام بذلك.
  • -
  • Authentication
    - Some pages may be protected so that only specific users can access them. Basic authentication may be provided by HTTP, either using the {{HTTPHeader("WWW-Authenticate")}} and similar headers, or by setting a specific session using HTTP cookies.
  • -
  • Proxy and tunnelingغالبًا ما توجد الخوادم أو العملاء على شبكات إنترانت وتخفي عنوان IP الحقيقي الخاص بهم عن أجهزة الكمبيوتر الأخرى. تنتقل طلبات HTTP بعد ذلك عبر الوكلاء لعبور حاجز الشبكة هذا. ليست كل الوكلاء عبارة عن وكلاء HTTP. بروتوكول SOCKS ، على سبيل المثال ، يعمل بمستوى أدنى. البروتوكولات الأخرى ، مثل بروتوكول نقل الملفات ، يمكن التعامل معها بواسطة هذه البروتوكولات.
  • -
  • Sessionsيتيح لك استخدام ملفات تعريف الارتباط HTTP ربط الطلبات بحالة الخادم. يؤدي هذا إلى إنشاء جلسات ، على الرغم من أن HTTP الأساسي هو بروتوكول بدون حالة. هذا مفيد ليس فقط لسلة التسوق في التجارة الإلكترونية ، ولكن أيضًا لأي موقع يسمح للمستخدم بتكوين المخرجات.
  • -
- -

HTTP flow

- -

When a client wants to communicate with a server, either the final server or an intermediate proxy, it performs the following steps:

- -
    -
  1. Open a TCP connection: The TCP connection is used to send a request, or several, and receive an answer. The client may open a new connection, reuse an existing connection, or open several TCP connections to the servers.
  2. -
  3. Send an HTTP message: HTTP messages (before HTTP/2) are human-readable. With HTTP/2, these simple messages are encapsulated in frames, making them impossible to read directly, but the principle remains the same. For example: -
    GET / HTTP/1.1
    -Host: developer.mozilla.org
    -Accept-Language: fr
    -
  4. -
  5. Read the response sent by the server, such as: -
    HTTP/1.1 200 OK
    -Date: Sat, 09 Oct 2010 14:28:02 GMT
    -Server: Apache
    -Last-Modified: Tue, 01 Dec 2009 20:18:22 GMT
    -ETag: "51142bc1-7449-479b075b2891b"
    -Accept-Ranges: bytes
    -Content-Length: 29769
    -Content-Type: text/html
    -
    -<!DOCTYPE html... (here comes the 29769 bytes of the requested web page)
    -
  6. -
  7. Close or reuse the connection for further requests.
  8. -
- -

If HTTP pipelining is activated, several requests can be sent without waiting for the first response to be fully received. HTTP pipelining has proven difficult to implement in existing networks, where old pieces of software coexist with modern versions. HTTP pipelining has been superseded in HTTP/2 with more robust multiplexing requests within a frame.

- -

HTTP Messages

- -

HTTP messages, as defined in HTTP/1.1 and earlier, are human-readable. In HTTP/2, these messages are embedded into a binary structure, a frame, allowing optimizations like compression of headers and multiplexing. Even if only part of the original HTTP message is sent in this version of HTTP, the semantics of each message is unchanged and the client reconstitutes (virtually) the original HTTP/1.1 request. It is therefore useful to comprehend HTTP/2 messages in the HTTP/1.1 format.

- -

There are two types of HTTP messages, requests and responses, each with its own format.

- -

Requests

- -

An example HTTP request:

- -

A basic HTTP request

- -

Requests consists of the following elements:

- -
    -
  • An HTTP method, usually a verb like {{HTTPMethod("GET")}}, {{HTTPMethod("POST")}} or a noun like {{HTTPMethod("OPTIONS")}} or {{HTTPMethod("HEAD")}} that defines the operation the client wants to perform. Typically, a client wants to fetch a resource (using GET) or post the value of an HTML form (using POST), though more operations may be needed in other cases.
  • -
  • The path of the resource to fetch; the URL of the resource stripped from elements that are obvious from the context, for example without the {{Glossary("protocol")}} (http://), the {{Glossary("domain")}} (here, developer.mozilla.org), or the TCP {{Glossary("port")}} (here, 80).
  • -
  • The version of the HTTP protocol.
  • -
  • Optional headers that convey additional information for the servers.
  • -
  • Or a body, for some methods like POST, similar to those in responses, which contain the resource sent.
  • -
- -

Responses

- -

An example response:

- -

- -

Responses consist of the following elements:

- -
    -
  • The version of the HTTP protocol they follow.
  • -
  • A status code, indicating if the request was successful, or not, and why.
  • -
  • A status message, a non-authoritative short description of the status code.
  • -
  • HTTP headers, like those for requests.
  • -
  • Optionally, a body containing the fetched resource.
  • -
- -

APIs based on HTTP

- -

The most commonly used API based on HTTP is the {{domxref("XMLHttpRequest")}} API, which can be used to exchange data between a {{Glossary("user agent")}} and a server. The modern {{domxref("Fetch API")}} provides the same features with a more powerful and flexible feature set.

- -

Another API, server-sent events, is a one-way service that allows a server to send events to the client, using HTTP as a transport mechanism. Using the {{domxref("EventSource")}} interface, the client opens a connection and establishes event handlers. The client browser automatically converts the messages that arrive on the HTTP stream into appropriate {{domxref("Event")}} objects, delivering them to the event handlers that have been registered for the events' {{domxref("Event.type", "type")}} if known, or to the {{domxref("EventSource.onmessage", "onmessage")}} event handler if no type-specific event handler was established.

- -

Conclusion

- -

HTTP is an extensible protocol that is easy to use. The client-server structure, combined with the ability to simply add headers, allows HTTP to advance along with the extended capabilities of the Web.

- -

Though HTTP/2 adds some complexity, by embedding HTTP messages in frames to improve performance, the basic structure of messages has stayed the same since HTTP/1.0. Session flow remains simple, allowing it to be investigated, and debugged with a simple HTTP message monitor.

diff --git a/files/ar/web/index.html b/files/ar/web/index.html deleted file mode 100644 index 9f0c72c4c9..0000000000 --- a/files/ar/web/index.html +++ /dev/null @@ -1,93 +0,0 @@ ---- -title: تقنيات الويب للمطورين -slug: Web -tags: - - تطوير الويب - - صفحة هبوط - - ويب -translation_of: Web ---- -

الويب المفتوح يقدم فرصة عظيمة للأشخاص الذين يرغبون في إنشاء مواقع وتطبيقات على الإنترنت. للحصول على الإستفادة الكاملة من تقنيات الويب، عليك معرفة كيفية استخدامها. تصفح الراوبط أدناه لتعلُّم المزيد حول تقنيات الويب المتنوعة.

- -
-
-

الأساسيات

- -
-
لغة ترميز النص الفائق
-
تستخدم لغة ترميز النص الفائق (HTML) لوصف وتعريف محتوى صفحة الويب.
-
بروتوكول نقل النص الفائق
-
يستخدم بروتوكول نقل النص الفائق (HTTP) لتوصيل وثائق لغة ترميز النص الفائق، وغيرها من الوثائق الفائقة على الويب.
-
- -

البرمجة

- -
-
الجافاسكربت
-
تعد الجافاسكربت لغة برمجة تعمل على المتصفح، تستطيع استخدامها لإضافة مزايا تفاعليّة ومزايا ديناميكيّة أخرى لموقعك أو تطبيقك.
-
واجهات البرمجيّة للويب
-
تستخدم  واجهات التطبيقات البرمجيّة للويب (Web APIs) للقيام بمهام متنوعة، كالتلاعب بـ DOM، تشغيل الملفات الصوتيّة والفيديوهات، أو توليد رسومات ثلاثيّة الأبعاد.
-
- - - -

الرسومات

- -
-
الكانفاس
-
عنصر <canvas> يوفر واجهات برمجيّة لرسم رسومات ثنائيّة الأبعاد باستخدام لغة الجافاسكربت.
-
الرسوميات المتجهية المتغيرة
-
تتيح الرسوميات المتجهيّة المتغيرة (SVG) لك استخدام الخطوط، المنحنيات، و غيرها من الأشكال الهندسيّة لتشكيل الرسومات. مع الفيكتور (vector) يمكنك إنشاء صور يمكن أن يتم تحجيمها بدون أن تفقد دقتها.
-
تقنيّة WebGL
-
دليلك للبدء مع تقنيّة WebGL، الواجهة البرمجيّة المخصصة للويب لرسم رسوميات ثلاثيّة الأبعاد. تسمح هذه التقنيّة باستخدام معايير OpenGL ES في محتوى الويب.
-
- -

الصوت، الفيديو، والوسائط المتعددة

- -
-
تقنيات وسائط الويب
-
قائمة بالواجهات البرمجيّة المتعلقة بالوسائط مع روابط لوثائق ستحتاجها.
-
لمحة عن تقنية الوسائط في الويب
-
لمحة عامة على تقنيات الويب المفتوحة والواجهات البرمجيّة التي توفر دعم لتشغيل الصوت والفيديو، التلاعب والتسجيل. إذا لم تكن تعلم أي واجهة برمجيّة يجب أن تستخدم، فهنا حيث يجب أن تبدأ.
-
واجهة برمجيّة لالتقاط الوسائط والتدفقات
-
مرجع لواجهة برمجية التي تجعل من الممكن دفق، تسجيل، والتلاعب بالوسائط محلياً وعلى الشبكة في آنٍ واحد. هذا يتضمن استخدام الكاميرا المحليّة والميكروفون للالتقاط الفيديو، الصوت، والصور.
-
-
استخدام ملفات الفيديو والصوت في لغة ترميز النص الفائق
-
تضمين ملفات الفيديو والصوت في صفحات الويب، والتحكم بتشغيلها.
-
تقنيّة WebRTC
-
تقنية RTC في الويب تعني الإتصال في الوقت الحالي (Real-Time Communications), وهي تقنيّة تسمح بتمكين تدفق الصوت والصورة ومشاركتها بين المُتصفحات.
-
-

أُخرى

-
-
لغة الترميز الرياضية
-
تتيح لغة الترميز الرياضية (MathML) لك تمثيل صيغ المعادلات الرياضيّة المعقدة.
-
-
- -
-
-
-

قسم التعلم

-
-
تعلم تطوير الويب
-
هذه مجموعة من المقالات توفر للمبتدئين ما يحتاجون إليه للبدء بكتابة موقع بسيط.
-
-

مواضيع أُخرى

-
-
تطوير تطبيقات الويب
-
هذه قائمة من المقالات التي تشرح التقنيات التي تُستخدم في تطوير تطبيقات الويب للهواتف، لسطح المكتب، ولبيئة نظام فايرفوكس.
-
الإتاحة
-
تُمكِن المواقع التي يمكن الوصول إليها بطرق مختلفة عدد أكبر من الأشخاص استخدام الويب، بما في ذلك الأشخاص التي تكون قدراتهم السمعيّة و البصريّة محدودة (المعاقين جسدياً). هذه المجموعة من المقالات توفر معلومات حول تطوير الويب المُتاح.
-
الحماية
-
لا تدع موقعك أو تطبيقك يتعرض لتسريب بيانات خاصة إلى أشخاص سيئين. استخدم مجموعة المقالات هذه لتتأكد أنَّ مشروعك آمن.
-
-
-
- -

قراءة المزيد ...

- -
diff --git a/files/ar/web/javascript/about_javascript/index.html b/files/ar/web/javascript/about_javascript/index.html deleted file mode 100644 index 4a6fa9739e..0000000000 --- a/files/ar/web/javascript/about_javascript/index.html +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: About JavaScript -slug: Web/JavaScript/About_JavaScript -tags: - - جافا سكريبت - - مبتدئ - - مقدمة -translation_of: Web/JavaScript/About_JavaScript ---- -
{{JsSidebar}}
- -

ماهي جافا سكريبت

- -

جافا سكريبت® (غالبا ما تختصر بـ JS) هي لغة خفيفة الوزن، مفسّرة، كائنية التوجه مع دوال من الدرجة الأولى، وهي معروفة باسم لغة البرمجة النصية لصفحات الويب، ولكنها تستخدم في العديد من البيئات غير المتصفّح أيضًا. وهي لغة برمجة مبنية على نماذج أولية ومتعددة النماذج تتسم بالديناميكية و تدعم أنماط البرمجة الكائنية التوجه و اﻷساسية و الوظيفية.

- -

تعمل جافا سكريبت على جانب العميل\المستخدم من الويب، و التي يمكن إستخدامها لتصميم\برمجة كيفية تصرف صفحات الويب عند وقوع خطأ ما. جافا سكريبت هي لغة سهلة التعلم ولغة برمجة قوية ، و تستخدم على نطاق واسع للتحكم في سلوك صفحات الويب.

- -

على عكس الاعتقاد الخاطئ الشائع ، فإن جافا سكريبت ليست "جافا المفسرة". باختصار ، جافا سكريبت هي لغة برمجة ديناميكية تدعم بناء الكائن المعتمد على النماذج. التركيب اﻷساسي مشابه -بشكل مقصود- لجافا و سي++ لتقليل عدد المفاهيم الجديدة المطلوبة لتعلم اللغة. إن تركيبات اللغة مثل عبارات if و حلقات for و while ، و الكتل switch and try ... catch تعمل بالمثل كما في هذه اللغات (أو أقرب إلى ذلك)

- -

يمكن أن تعمل جافا سكريبت كلغة إجرائية و لغة كائنية التوجه.. يتم إنشاء الكائنات برمجياً في جافا سكريبت ، عن طريق إرفاق طرق وخصائص الكائنات الفارغة الأخرى في وقت التشغيل، على عكس التركيب\البناء اللغوي لتعريفات الأصناف الشائعة في اللغات المترجمة أمثال سي++ و جافا. بمجرد إنشاء كائن، يمكن استخدامه كمخطط (أو نموذج أولي) لإنشاء كائنات مشابهة.

- -

تتضمن الإمكانات الديناميكية لجافا سكريبت بناء الكائن وقت التشغيل ، وقوائم المعاملات المتغيرة ، ومتغيرات الوظيفة ، وإنشاء النص البرمجي الديناميكي (عن طريق eval) ، واستبطان الكائن (عن طريق for ... in)، واستعادة الكود المصدري (يمكن لبرامج جافا سكريبت تفكيك هيئات\أجسام الوظائف رجوعا إلى نصها المصدري).

- -

لإجراء مناقشة أكثر عمقاً لبرمجة جافا سكريبت ، تابع روابط موارد جافا سكريبت أدناه.

- -

ما هي تطبيقات جافا سكريبت المتاحة؟

- -

The Mozilla project provides two JavaScript implementations. The first ever JavaScript was created by Brendan Eich at Netscape, and has since been updated to conform to ECMA-262 Edition 5 and later versions. This engine, code named SpiderMonkey, is implemented in C/C++. The Rhino engine, created primarily by Norris Boyd (also at Netscape) is a JavaScript implementation written in Java. Like SpiderMonkey, Rhino is ECMA-262 Edition 5 compliant.

- -

Several major runtime optimizations such as TraceMonkey (Firefox 3.5), JägerMonkey (Firefox 4) and IonMonkey were added to the SpiderMonkey JavaScript engine over time. Work is always ongoing to improve JavaScript execution performance.

- -

Besides the above implementations, there are other popular JavaScript engines such as:-

- -
    -
  • Google's V8, which is used in the Google Chrome browser and recent versions of Opera browser. This is also the engine used by Node.js.
  • -
  • The JavaScriptCore (SquirrelFish/Nitro) used in some WebKit browsers such as Apple Safari.
  • -
  • Carakan in old versions of Opera.
  • -
  • The Chakra engine used in Internet Explorer (although the language it implements is formally called "JScript" in order to avoid trademark issues).
  • -
- -

Each of Mozilla's JavaScript engines expose a public API which application developers can use to integrate JavaScript into their software. By far, the most common host environment for JavaScript is web browsers. Web browsers typically use the public API to create host objects responsible for reflecting the DOM into JavaScript.

- -

Another common application for JavaScript is as a (Web) server side scripting language. A JavaScript web server would expose host objects representing a HTTP request and response objects, which could then be manipulated by a JavaScript program to dynamically generate web pages. Node.js is a popular example of this.

- -

مصادر جافا سكريبت

- -
-
SpiderMonkey
-
Information specific to Mozilla's implementation of JavaScript in C/C++ engine (aka SpiderMonkey), including how to embed it in applications.
-
- -
-
Rhino
-
Information specific to the JavaScript implementation written in Java (aka Rhino).
-
Language resources
-
Pointers to published JavaScript standards.
-
A re-introduction to JavaScript
-
JavaScript guide and JavaScript reference.
-
- -

JavaScript® is a trademark or registered trademark of Oracle in the U.S. and other countries.

diff --git a/files/ar/web/javascript/guide/control_flow_and_error_handling/index.html b/files/ar/web/javascript/guide/control_flow_and_error_handling/index.html deleted file mode 100644 index d87ef2f7e9..0000000000 --- a/files/ar/web/javascript/guide/control_flow_and_error_handling/index.html +++ /dev/null @@ -1,467 +0,0 @@ ---- -title: التحكم فى التدفق وامساك الاخطاء -slug: Web/JavaScript/Guide/Control_flow_and_error_handling -translation_of: Web/JavaScript/Guide/Control_flow_and_error_handling ---- -
{{jsSidebar("JavaScript Guide")}} {{PreviousNext("Web/JavaScript/Guide/Grammar_and_types", "Web/JavaScript/Guide/Loops_and_iteration")}}
- -

جافاسكريبت تدعم مجموعة من البيانات المدمجة، وتحديدا التحكم في تدفق البيانات، التي يمكنك استخدامها لخلق قدرا كبيرا من التفاعل في التطبيق الخاص بك. يقدم هذا الفصل لمحة عامة عن هذه البيانات.

- -
-

يحتوي هذا الفصل، مرجع الجافاسكريبت على تفاصيل شاملة عن التعليمات البرمجية. في جافاسكريبت، يتم استخدام رمز الفاصلة المنقوطة (;) لانهاء التعليمات البرمجية.

- -
-

ملحوظة: برامج الجافاسكريبت وبيانات الجافاسكريبت، غالباً ما تسمى تعليمات برمجية.

-
- -

أي تعبير جافا سكريبت، هو  أيضا تعليمة برمجية. راجع Expressions and operators  للحصول على معلومات كاملة حول التعبيرات.

- -

Block statement

- -

ابسط تعليمة برمجية هي التعليمة البرمجية بلوك  block، التي تستخدم لاحتواء مجموعة من التعليمات البرمجية. البلوك محدد بواسطة الاقواس المتعرجة:

- -
{
-  statement_1;
-  statement_2;
-  .
-  .
-  .
-  statement_n;
-}
-
- -

مثال

- -

اغلب استخدامات البلوك، تكون مع تعليمات التحكم في التدفق ( مثل if, for, while )

- -
while (x < 10) {
-  x++;
-}
-
- -

لدينا هنا، { ;++x } التعليمة البرمجة block.

- -

هام: في جافا سكريبت قبل ECMAScript2015. البلوك لم يكن لديه نطاق. المتغيرات المستخدمة في البلوك، سيتم تغيير نطاقها الى النطاق العام وهو السكريبت، فتصبح متغيرات عامة متاحة لجميع التعليمات البرمجية في السكريبت، اما اذا وجد البلوك داخل دالة سيتم تغيير نطاقها لهذه الدالة، وبالتالي ستصبح متغيرات محلية متاحة لهذه الدالة فقط.

- -

في جافا سكريبت، البلوكات "المستقلة"  يمكن أن ينتج  عنها نتائج مختلفة تماما عما كان سينتج في C أو جافا. فمثلا

- -
var x = 1;
-{
-  var x = 2;
-}
-console.log(x); // outputs 2
-
- -

مخرجات التعليمة البرمجية اعلاه، ستكون 2 وذالك لان المتغير x المتواجد داخل البلوك والمتغير x المتواجد خارج البلوك لديهما نفس النطاق، او بمعنى اصح، كلاهما في النطاق العام وهو السكريببت. في C أو جافا. المخرجات ستكون 1.

- -

ابتداءا من ECMAScript2015. استخدام المتغير let داخل البلوك سينتج عنه سلوك مغاير. راجع {{jsxref("Statements/let", "let")}} صفحة المرجع للحصول على مزيد من المعلومات.

- -

التعليمات الشرطية

- -

التعليمة الشرطية هي مجموعة من الأوامر التي ستنفذ إذا تحقق شرطا معيناً. تدعم الجافاسكريبت اثنين من التعليمات الشرطية: هما if...else و switch.

- -

التعليمة if...else

- -

ستنفذ التعليمة البرمجية المرتبطة بالتعليمة if اذا كان الشرط المنطقي يساوي true. وكذالك ستنفذ التعليمة البرمجية المرتبطة بالتعليمة else اذا كان الشرط المنطقي يساوي false. استخدام التعليمة else اختياري. فيما تكون التعليمة if على الشكل التالي،

- -
if (condition) {
-  statement_1;
-} else {
-  statement_2;
-}
- -

الشرط condition، يمكن ان يكون اي تعبير لإختبار ما اذا كان الشرط true او false راجع Boolean. لتوضيح ما الذي سيتم تنفيذه: في حالة ما اذا كان الشرط صحيح  سيتم تنفيذ statement_1، اما اذا كان الشرط غير صحيح سيتم تنفيذ statement_2، يمكن ل statement_1 و statement_2 ان تكون اي تعليمات برمجية، بما فيها تعليمة if اخرى.

- -

يمكنك أيضا توسيع مجال التعليمات الشرطية باستخدام else if لاختبار شروط متعددة في تسلسل، كما يلي:

- -
if (condition_1) {
-  statement_1;
-} else if (condition_2) {
-  statement_2;
-} else if (condition_n) {
-  statement_n;
-} else {
-  statement_last;
-}
-
-
- -

في حالة وجود شروط متعددة سيتم تنفيذ شرط واحد فقط، وهو الشرط المنطقي الذي سيتم اختباره ب true. لتنفيذ عدة تعليمات برمجية، قم بتضمينها في التعليمة بلوك ({ ... }). من الجيد دائماً استخدام التعليمة بلوك، لا سيما عند استخدام التعليمات الشرطية المتداخلة :

- -
if (condition) {
-  statement_1_runs_if_condition_is_true;
-  statement_2_runs_if_condition_is_true;
-} else {
-  statement_3_runs_if_condition_is_false;
-  statement_4_runs_if_condition_is_false;
-}
-
- -
من المستحسن عدم استخدام التعيينات البسيطة في التعبير الشرطي، لأنه يمكن الخلط بين التعيين والمساواة، على سبيل المثال، لا تستخدم التالي:
- -
 
- -
if (x = y) {
-  /* statements here */
-}
-
- -

إذا كنت بحاجة إلى استخدام تعيين بسيط في تعبير شرطي، استخدم أقواس إضافية حول التعيين. على سبيل المثال:

- -
if ((x = y)) {
-  /* statements here */
-}
-
- -

القيم  Falsy

- -

القيم التالية تُقَيًم إلى false عند اختباها في تعليمة شرطية (وتعرف ايضا بالقيم {{Glossary("Falsy")}}):

- -
    -
  • false
  • -
  • undefined
  • -
  • null
  • -
  • 0
  • -
  • NaN
  • -
  • السلسلة النصية الفارغة ("")
  • -
- -

كل القيم الأخرى، بما في ذلك جميع الكائنات، تقيم إلى true عندما يتم تمريرها إلى تعليمة شرطية.

- -

لا تخلط بين القيم المنطقية الاولية true و false مع القيم true و false للكائن {{jsxref("Boolean")}}. على سبيل المثال:

- -
var b = new Boolean(false);
-if (b) // this condition evaluates to true
-if (b == true) // this condition evaluates to false
-
- -

مثال

- -

فى المثال التالى, الدالة checkData ستعود ب true ادا كان عدد الحروف في الكائن Text يساوي ثلاثة، بخلاف ذالك، سيظهر التنبيه (alert) وتعود ب false.

- -
function checkData() {
-  if (document.form1.threeChar.value.length == 3) {
-    return true;
-  } else {
-    alert('Enter exactly three characters. ' +
-    document.form1.threeChar.value + ' is not valid.');
-    return false;
-  }
-}
-
- -

التعليمة switch

- -

التعليمة switch تسمح للبرنامج باختبار التعبير، وذالك من خلال مطابقة قيمة التعبير مع الحالة case. إذا تم العثور على تطابق، البرنامج سينفذ التعليمة البرمجية المرتبطة بها. التعليمة switch تكون على الشكل التالي:

- -
switch (expression) {
-  case label_1:
-    statements_1
-    [break;]
-  case label_2:
-    statements_2
-    [break;]
-    ...
-  default:
-    statements_def
-    [break;]
-}
-
- -

بداية يقوم البرنامج بالبحث عن الحالة case التي تطابق قيمتها قيمة ال expression، اذا وجدت، يقوم البرنامج بتنفيذ التعليمة البرمجية المرتبطة بها، اذا لم يجد ما يبحث عنه في اي من الحالات case، سيقوم البرنامج بتنفيذ التعليمات البرمجية المرتبطة بالحالة default اذا وجدت، لان وجود الحالة default في التعليمة switch اختياري. اذا لم يجد البرنامج اي حالة case متطابقة ولا الحالة default سيقوم بتنفيذ التعليمات البرمجية التي تلي التعليمة switch.

- -

التعليمة break مرتبطة مع كل حالة case، مهمتها جعل البرنامج يقفز خارج التعليمة switch بمجرد تنفيذ التعليمة البرمجية، واستكمال تنفيذ التعليمات البرمجية التي تلي التعليمة switch. بما ان وجود التعليمة break اختياري، ففي حالة عدم وجودها سيقوم البرنامج بتنفيذ التعليمة التالية في switch.

- -

مثال

- -

في المثال التالي، اذا كان fruittype يساوي "Bananas"،  سيقوم البرنامج بتنفيذ  التعليمات البرمجية المرتبطة بالحالة 'case: 'Banana. عندما سسيجد break، سيقوم بايقاف switch وينفذ التعليمات البرمجية التي تليها. اذا لم يجد break سينفذ التعليمة البرمجية المرتبطة بالحالة 'case: 'Cherries ايضا. 

- -
switch (fruittype) {
-  case 'Oranges':
-    console.log('Oranges are $0.59 a pound.');
-    break;
-  case 'Apples':
-    console.log('Apples are $0.32 a pound.');
-    break;
-  case 'Bananas':
-    console.log('Bananas are $0.48 a pound.');
-    break;
-  case 'Cherries':
-    console.log('Cherries are $3.00 a pound.');
-    break;
-  case 'Mangoes':
-    console.log('Mangoes are $0.56 a pound.');
-    break;
-  case 'Papayas':
-    console.log('Mangoes and papayas are $2.79 a pound.');
-    break;
-  default:
-   console.log('Sorry, we are out of ' + fruittype + '.');
-}
-console.log("Is there anything else you'd like?");
- -
-

ملاحظة : لمزيد من التفاصيل حول التعليمة  switch.

-
- -

التعليمات المعالجة للاستثناءات

- -
-

من الثابت بقواعد الرياضيات انه لا يجوز القسمة على صفر بأي حال من الأحوال لذلك لن يتمكن البرنامج من تنفيذ العملية المطلوبة وستظهر للمستخدم رسالة خطا تنفيذي لا يمكنه تفاديها وعلى الأغلب أنها ستسبب بإغلاق البرنامج.
-
- ولمعالجة أخطاء التنفيذ هذه وتحجيمها فبل حدوثها وفرت لنا لغات البرمجة وعلى رأسها الجافاسكريبت آلية تتمثل بوضع جمل استثنائية خاصة يتوقع من خلالها المبرمج أنواع أخطاء التنفيذ التي قد تحدث ويقوم ببرمجة حدث برمجي بكل استثناء ليتم تنفيذه بدلا من الخطا التنفيذي.

- -

بصفة عامة، الاستثناءات هي عبارة عن آلية برمجية لمعالجة أخطاء التنفيذ المحتمل وقوعها.

- -

 

-
- -

يمكنك قذف (توليد)  الاستثناءات من خلال التعليمة throw والتعامل معها باستخدام التعليمة try...catch

- - - -

انواع الاستثناءات

- -

في جافا سكريبت، يمكن استخدام الكائنات لقذف/توليد الاستثناءات. ومع ذلك، ليس كل الكائنات القاذفة هي نفسها. من الشائع إلى حد ما، قذف الاعداد أو السلاسل الحرفية كاخطاء، الا انه في كثير من الأحيان سيكون أكثر فعالية استخدام أحد أنواع الاستثناءات التالية، والتي أنشئت خصيصا لهذا الغرض:

- - - -

التعليمة throw

- -

التعليمة throw تقذف الاخطاء. عند حدوث خطأ، عادة سوف تتوقف جافا سكريبت، وستولد رسالة للاعلان عن الخطأ. المصطلح التقني لهذه العملية هو : الجافاسكريبت ستقذف (throw) الخطأ. التعليمة throw تمكتك من انشاء خطأ حسب رغبتك. المصطلح التقني لهذه العملية هو: اقذف استثناءا (throw an exception).

- -

إستخدِم التعليمة throw لقذف الإستثناء، عنما تريد قذف إستثناءا، عليك تحديد التعبير (expression) الذي سيحتوي على القيمة التي ستقذف:

- -
throw expression;
-
- -

يمكنك قذف اي استثناء، وليس مجرد تعبيرات من نوع معين. التعليمة البرمجية التالية تقذف استثناءات لمختلف انواع البيانات:

- -
throw 'Error2';   // String type
-throw 42;         // Number type
-throw true;       // Boolean type
-throw {toString: function() { return "I'm an object!"; } };
-
- -
ملحوظة : يمكنك تحديد كائن عندما ستقوم بقذف الاستثناء. يمكنك بعد ذالك الاشارة إلى خصائص الكائن في البلوك catch. يقوم المثال التالي بإنشاء الكائن myUserException من النوع UserException واستحدامه في التعليمة throw.
- -
// Create an object type UserException
-function UserException(message) {
-  this.message = message;
-  this.name = 'UserException';
-}
-
-// Make the exception convert to a pretty string when used as a string
-// (e.g. by the error console)
-UserException.prototype.toString = function() {
-  return this.name + ': "' + this.message + '"';
-}
-
-// Create an instance of the object type and throw it
-throw new UserException('Value too high');
- -
-

لمزيد من المعلومات حول هذه التعليمة، راجع صفحة مرجع الجافا سكريبت  throw.

-
- -

التعليمة try...catch

- -

التعليمة try...catch تحدد بلوك من التعليمات البرمجية لتجربتها، و تنص على وجود واحد أو أكثر من الاستجابات التي ينبغي على الاستثناء ان يقذفها. إذا تم قذف الاستثناء، ستمسك به التعليمة  try...catch.

- -

التعليمة try...catch تتكون من البلوك try الذي سيحتوي على واحدة أو أكثر من التعليمات البرمجية، والبلوك catch سيحتوي على التعليمات البرمجية التي تحدد ما يجب فعله اذا تم قذف الاستثناء من البلوك try. بمعنى اخر، في معظم الحالات. نريد من التعليمات البرمجية داخل البلوك try ان تسير بشكل طبيعي، وفي حالة حدوث مشاكل يمرّر التحكم الى البلوك catch. إذا كانت هناك احدى التعليمات البرمجية داخل البلوك try تقذف استثناءا، سيتم نقل التحكم فورا إلى البلوك catch. وإذا لم يتم إرسال أي استثناء من داخل البلوك try، فالبلوك catch لن يقم باي شئ. هذه التعليمة البرمجية يمكن ان تحتوي على البلوك finally والذي سينفذ بعد تنفيذ البلوك  try و catch، وايضا سينفذ قبل تنفيذ التعليمات البرمجية التي تلي التعليمة try...catch، اذا وجدت.

- -


- المثال التالى يستخدم التعليمة try...catch. ويقوم باستدعاء دالة تعود باسم الشهر من مصفوفة بناء على القيمة التي تم تمريرها إلى الدالة. إذا كانت القيمة لا تتوافق مع رقم الشهر (1-12)، سيولّد استثناء مع القيمة "InvalidMonthNo" فيما تقوم التعليمة البرمجية في البلوك catch بتعين القيمة unknown إلى المتغير monthName.

- -
function getMonthName(mo) {
-  mo = mo - 1; // Adjust month number for array index (1 = Jan, 12 = Dec)
-  var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul',
-                'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
-  if (months[mo]) {
-    return months[mo];
-  } else {
-    throw 'InvalidMonthNo'; //throw keyword is used here
-  }
-}
-
-try { // statements to try
-  monthName = getMonthName(myMonth); // function could throw exception
-}
-catch (e) {
-  monthName = 'unknown';
-  logMyErrors(e); // pass exception object to error handler -> your own function
-}
-
- -

The catch block

- -

يمكنك استخدام البلوك  catch للامساك بجميع الاستثناءات التي سيتم قذفها من البلوك try.

- -
catch (catchID) {
-  statements
-}
-
- -

البلوك catch يحدد الايدي catchID الذي سيمسك القيمة المحددة من طرف التعليمة throw، يمكنك استخدام هذا الايدي للحصول على معلومات حول الاستثناء الذي سيقذف. جافا سكريبت ستنشئ هذا الايدي عند دخوله الى البلوك catch. يبدا عمر هذا الايدي من لحظة دخوله الى البلوك catch، وينتهي عندما ينتهي البلوك catch من التنفيذ.

- -

على سبيل المثال، التعليمة البرمجية التالية ستقذف استثناءا. عند حدوث الاستثناء، سيتم نقل التحكم الى البلوك catch.

- -
try {
-  throw 'myException'; // generates an exception
-}
-catch (e) {
-  // statements to handle any exceptions
-  logMyErrors(e); // pass exception object to error handler
-}
-
- -

The finally block

- -

البلوك finally سيحتوي على التعليمات البرمجية التي سيقوم بتنفيذها بعدما تنفذ البلوكات try و catch، وايضا سينفذ قبل تنفيذ التعليمات البرمجية التي تلي التعليمة try...catch. سينفذ البلوك finally سواء تم قذف الاستثناء ام لا، اذا تم قذف الاستثناء، ستنفذ التعليمات البرمجية في البلوك finally حتى وان لم يتم معالجة الاستثناء في البلوك catch.

- -

يمكنك استخدام البلوك finally لجعل السكريبت الخاص بك يفشل بأمان عند حدوث استثناء، على سبيل المثال، اذا كنت في حاجة إلى تحرير مورد، او لغلق ال flux، الخ. المثال التالي يفتح ملف ثم ينفذ التعليمات البرمجية لهذا ملف (server-side JavaScript يسمح لك بالوصول الى الملفات). اذا تم قذف استثناء في حين أن الملف مفتوح، البلوك finally ستغلق هذا الملف قبل فشل السكريبت.

- -
openMyFile();
-try {
-  writeMyFile(theData); //This may throw a error
-} catch(e) {
-  handleError(e); // If we got a error we handle it
-} finally {
-  closeMyFile(); // always close the resource
-}
-
- -

عندما سيقوم البلوك finally بارجاع قيمة، تصبح هذه القيمة قيمة الإرجاع من كامل المجموعة  try-catch-finally بغض النظر عن التعليمات البرمجية العائدة من البلوكات  try و catch.

- -
function f() {
-  try {
-    console.log(0);
-    throw 'bogus';
-  } catch(e) {
-    console.log(1);
-    return true; // this return statement is suspended
-                 // until finally block has completed
-    console.log(2); // not reachable
-  } finally {
-    console.log(3);
-    return false; // overwrites the previous "return"
-    console.log(4); // not reachable
-  }
-  // "return false" is executed now
-  console.log(5); // not reachable
-}
-f(); // console 0, 1, 3; returns false
-
- -

الكتابة فوق القيم العائدة من قبل البلوك finally ينطبق أيضا على قذف الاستثناءات او اعادة القذف داخل البلوك catch:

- -
function f() {
-  try {
-    throw 'bogus';
-  } catch(e) {
-    console.log('caught inner "bogus"');
-    throw e; // this throw statement is suspended until
-             // finally block has completed
-  } finally {
-    return false; // overwrites the previous "throw"
-  }
-  // "return false" is executed now
-}
-
-try {
-  f();
-} catch(e) {
-  // this is never reached because the throw inside
-  // the catch is overwritten
-  // by the return in finally
-  console.log('caught outer "bogus"');
-}
-
-// OUTPUT
-// caught inner "bogus"
- -

التعليمات try...catch المتداخلة

- -

يمكن عمل واحدة او اكثر من التعليمات try...catch المتداخلة.  شرط عدم توفر try...catch الداخلية على البلوك catch، تتطلب وجود البلوك finally والتعليمة try...catch الخارجية سوف تستخدم البلوك catch ليتم التحقق من المطابقة. راجع nested try-blocks في صفحة المرجع الخاص بالتعليمة try...catch.

- -

باستخدام الكائنات Error

- -

اعتماداً على نوع الخطأ، من الممكن استخدام الخصائص name و message للحصول على رسالة أكثر دقة. عموما لدينا الخاصية name التي ستعرض نوع الخطا الذي حدث (مثلا: DOMException او Error). والخاصية message التي ستعرض رسالة الخطأ لوصف هذا الخطا (تستخدم عادة عندما نريد تحويل او عرض نص الخطأ). على سبيل المثال:

- -
try {
-  throw new Error('Whoops!');
-} catch (e) {
-	if( e.message === 'Whoops!'){
-		e.message = "Costume message";
-	}
-  console.log(e.name + ': ' + e.message); // Error: Costume message
-}
- -

اذا كنت ترغب في انشاء اخطاء خاصة بك، يمكتك استخدام المنشئ Error من أجل الاستفادة من خصائصه. على سبيل المثال:

- -
function doSomethingErrorProne() {
-  if (ourCodeMakesAMistake()) {
-    throw (new Error('The message'));
-  } else {
-    doSomethingToGetAJavascriptError();
-  }
-}
-....
-try {
-  doSomethingErrorProne();
-} catch (e) {
-  console.log(e.name); // logs 'Error'
-  console.log(e.message); // logs 'The message' or a JavaScript error message)
-}
- -

Promises

- -

ابتداءا من ECMAScript2015. اصبح لجافاسكريبت الكائن Promise والذي يسمح لك بالتحكم في التدفق والعمليات المتزامنة.

- -

Promise هو احد هذه الحالات:

- -
    -
  • pending  (قيد الانتظار): الحالة الأولية، لم تَفِ أو تم رفضها.
  • -
  • fulfilled  (وفَّى): عملية ناجحة
  • -
  • rejected  (رُفِض): فشل العملية.
  • -
  • settled  (التسوية): إما وفى بوعد أو رفضه، ولكن ليس قيد الانتظار.
  • -
- -

- -

تحميل صورة ب XHR

- -

مثال بسيط باستخدام Promise و XMLHttpRequest في مستودع الاكواد MDN GitHub. راجع المثال js-examples. يمكنك ايضا مراجعة see it in action. تم التعليق على كل خطوة لتمكينك من متابعة سير عملية Promise و XHR. هذا الإصدار من دون تعليقات، يعرض تدفق ال Promise:

- -
function imgLoad(url) {
-  return new Promise(function(resolve, reject) {
-    var request = new XMLHttpRequest();
-    request.open('GET', url);
-    request.responseType = 'blob';
-    request.onload = function() {
-      if (request.status === 200) {
-        resolve(request.response);
-      } else {
-        reject(Error('Image didn\'t load successfully; error code:'
-                     + request.statusText));
-      }
-    };
-    request.onerror = function() {
-      reject(Error('There was a network error.'));
-    };
-    request.send();
-  });
-}
- -

للحصول على معلومات أكثر تفصيلاً، راجع {{jsxref("Promise")}} في صفحة المرجع.

- -
-
{{PreviousNext("Web/JavaScript/Guide/Grammar_and_types", "Web/JavaScript/Guide/Loops_and_iteration")}}
-
-
diff --git a/files/ar/web/javascript/guide/functions/index.html b/files/ar/web/javascript/guide/functions/index.html deleted file mode 100644 index 9c970e5440..0000000000 --- a/files/ar/web/javascript/guide/functions/index.html +++ /dev/null @@ -1,699 +0,0 @@ ---- -title: الدوال -slug: Web/JavaScript/Guide/Functions -tags: - - الدوال - - جافا سكريبت - - دليل -translation_of: Web/JavaScript/Guide/Functions -original_slug: Web/JavaScript/Guide/الدوال ---- -
{{jsSidebar("JavaScript Guide")}} {{PreviousNext("Web/JavaScript/Guide/Loops_and_iteration", "Web/JavaScript/Guide/Expressions_and_Operators")}}
- -

الدوال هي واحدة من اللبنات الأساسية في جافاسكريبت. الدالة، هي عبارة عن مجموعة من التعليمات البرمجية التي تؤدي وظيفة معينة. حتى تتمكن من إستخدام الدالة، عليك أولا تعريفها في مكان ما من النطاق الذي تود إستدعائها منه.

- -
-

يمكنك القاء نظرة في مرجع مفصل عن دوال الجافاسكريبت حتى تتعرف على تفاصيل اكثر.

- -

انشاء الدوال

- -

الاعلان عن الدوال - الصيغة الافتراضية - Function declarations

- -

تعريف الدالة: تتكون الدالة من الكلمة المحجوزة function، متبوعة بـ :

- -
    -
  • إسم الدالة.
  • -
  • قائمة بارامترات الدالة، محصورة بين قوسين ويفصل بينها بفواصل.
  • -
  • تعليمات الجافاسكريبت التي تُعرف الدالة، داخل الأقواس المتعرجة {}.
  • -
- -

على سبيل المثال، الكود التالي يعرف دالة بسيطة تسمى square :

- -
function square(number) {
-  return number * number;
-}
-
- -

الدالة square تمتلك بارامتر واحد، هو number. وتعليمة برمجية واحدة تقوم بإرجاع بارامتر الدالة number مضروباً في نفسه. والتعليمة return تحدد القيمة التي سترجعها الدالة.

- -
return number * number;
-
- -

يتم تمرير البارامترات الاولية primitives (كالسلاسل الحرفية، الاعداد...الخ) الى الدالة، بوسيلة تسمى، الاستدعاء بالقيمة، call by value وهي، ان يتم تحليل argument الدالة، والقيمة الناتجة سَتُرسل نسخة منها فقط إلى المتغير المستقبل (بارامتر الدالة)، بعد ذالك تقوم الدالة بتخزين هذه القيمة في الذاكرة، ثم، إذا كانت الدالة قادرة على تعيين القيم للبارامترات الخاصة بها، تبدا بالعمل على هذه النسخة فقط، دون تغيير اي شئ في قيمة المتغير الاصلي.

- -

في المثال التالي، لدينا المتغير value سنقوم بتمريره إلى الدالة square. ثم ضمن الدالة square سيتم إنشاء نسخة جديدة، وهكذا، حتى وان قمنا بتغيير القيمة داخل الدالة، فلن يؤثر هذا على قيمة المتغير الأصلي الذي تم تعريفه خارج الدالة. لان هذا التغيير لن يكون مرئيا خارج الدالة:

- -
function square(number) { // parameter = recipient
-  return number * number;
-}
-var value = 10;
-square(value);   // argument = Sender
-document.write(value);  // log: 10
-
- -

على عكس المثال السابق، اذا قمت بتمرير كائن (مثلا، قيمة غير اولية ك {{jsxref("Array")}} او كائن معرف من قبل المستخدم) كبارامتر، وقامت الدالة بتغيير خصائص الكائن، سيكون هذا التغيير مرئيا خارج الدالة:

- -
function myFunc(theObject) {
-  theObject.make = "Toyota";
-}
-
-var mycar = {make: "Honda", model: "Accord", year: 1998};
-var x, y;
-
-x = mycar.make; // x gets the value "Honda"
-
-myFunc(mycar);
-y = mycar.make; // y gets the value "Toyota"
-                // (the make property was changed by the function)
-
- -

الاعلان عن الدوال بصيغة ال Function expressions

- -

في حين ان الدالة اعلاه تم الاعلان عنها بصيغة  function declaration، يمكن ايضا انشاء الدوال بصيغة ال function expression. كما يمكن ايضا للدوال ان تكون بصيغة ال anonymous (دوال مجهولة الاسم). على سبيل المثال، الدالة square يمكن تعريفها ايضا بصيغة ال function expression على النحو التالى:

- -
var square = function(number) { return number * number };
-var x = square(4) // x gets the value 16
- -

يمكن تعيين اسم للدوال بصيغة ال function expression، لجعل الدالة تعيد استدعاء ذاتها (الاستدعاء الداتي)، أو استخدامه في المنقح debugger. او لتعقب اخطاء الدالة من خلال stack traces.

- -
var factorial = function fac(n) { return n<2 ? 1 : n*fac(n-1) };
-
-console.log(factorial(3));
-
- -

يمكنك تمرير دالة كبارامتر لدالة اخرى. يظهر المثال التالي الدالة map تستخدم دالة اخرى كبارامتر اول لها :

- -
function map(f,a) {
-  var result = [], // Create a new Array
-      i;
-  for (i = 0; i != a.length; i++)
-    result[i] = f(a[i]);
-  return result;
-}
-
- -

طريقة استخدامها مع الصيغة function expression:

- -
var multiply = function(x) { return x * x * x; };
-map(multiply, [0, 1, 2, 5, 10]);
-
- -

طريقة استخدامها مع الصيغة anonymous function مباشرة:

- -
map(function(x) {return x * x * x}, [0, 1, 2, 5, 10]);
-
- -

returns [0, 1, 8, 125, 1000].

- -

في الجافاسكريبت يمكن الاعلان عن دالة اعتمادا على شرط. على سبيل المثال، ستقوم التعليمة البرمجية التالية بالاعلان عن الدالة myFunc شرط ان يكون  num يساوي 0:

- -
var myFunc;
-if (num === 0){
-  myFunc = function(theObject) {
-    theObject.make = "Toyota"
-  }
-}
- -

بالإضافة إلى انشاء الدوال كما هو موضح اعلاه، يمكنك ايضا استخدام الصيغة {{jsxref("Function")}} constructor لانشاء دوال من خلال السلاسل النصية، تنفذ وقت التشغيل، تماما كما في  {{jsxref("eval", "()eval")}}.

- -

هناك فرق بين الدوال (functions) والوظائف (methods)، الدوال هي ما نناقشه في هذا الفصل، والوظائف هي تلك المرتبطة بالكائنات (قيمة لخاصية في الكائن)، اقرأ المزيد حول الكائنات والوظائف العمل مع الكائنات [عربي].

- -

إستدعاء الدوال

- -

تعريف الدالة يعني ببساطة إعطاء إسم لها وتحديد ماستقوم به عندما يتم إستدعائها. أما إستدعاء الدالة فيقوم فعليا بتنفيذ الإجراءات مع البرامترات المحددة. على سبيل المثال، إذا قمت بتعريف الدالة square، فستقوم بإستدعائها كما يلي :

- -
square(5);
-
- -

تقوم التعليمة البرمجية اعلاه باستدعاء الدالة مع البارامتر 5. ثم تقوم بتنفيذ التعليمات البرمجية المرتبطة بها وترجع القيمة 25.

- -

الدوال يجب ان تنتمي للنطاق الذي استدعيت فيه، ولان الدوال بصيغة function declaration ترفع اعلى النطاق، فمن الممكن أن تعرف في وقت لاحق، كما في المثال التالي:

- -
console.log(square(5));
-/* ... */
-function square(n) { return n*n }
-
- -

نطاق الدالة هو اما الدالة التي تم الإعلان عنها، أو البرنامج بأكمله إذا تم الاعلان عنها في المستوى العلوي.

- -
-

ملاحظة: سيعمل هذا فقط عندما يتم تعريف الدالة باستخدام الصيغة (مثل {}()function funcName). اما التعليمة البرمجية التالية فسوف لن تعمل، وهذا يعني ان الية الرفع (hoisting) بالنسبة للدوال تعمل فقط مع الدوال ذات الصيغة function declaration ولا تعمل مع الدوال ذات الصيغة function expression.

-
- -
console.log(square); // square is hoisted with an initial value undefined.
-console.log(square(5)); // TypeError: square is not a function
-var square = function(n) {
-  return n * n;
-}
-
- -

arguments الدالة لا تقتصر على الاعداد او السلاسل الحرفية فقط، يمكنك تمرير الكائنات ايضا. في القسم الخاص بالعمل مع الكائنات العمل مع الكائنات[عربي] توجد دالة باسم ()showProps توضح كيفية تمرير كائن ك argument للدالة.

- -

يمكن للدالة أن تقوم بإستدعاء ذاتها. على سبيل المثال، هذه الدالة تقوم بحساب المضروب بشكل متكرر :

- -
function factorial(n){
-  if ((n === 0) || (n === 1))
-    return 1;
-  else
-    return (n * factorial(n - 1));
-}
-
- -

في كل مرة تقوم الدالة باستدعاء ذاتها، يتم خصم 1 من قيمة البرامتر الممرر، ويتم ضرب القيمة المحصلة في القيمة العائدة من جديد، فرضا، اذا كانت القيمة الممررة 5، الاستدعاء الاول سيكون 5، الاستدعاء الثاني سيكون 4، الاستدعاء الثالث سيكون 3، وهكذا، ويتم ضرب هذه القيم العائدة مع بعضها البعض. بهذا الشكل :  5 * 4 * 3 * 2 * 1 == 120

- -

امثلة متنوعة:

- -
var a, b, c, d, e;
-a = factorial(1); // a gets the value 1    // 1 * 1
-b = factorial(2); // b gets the value 2    // 2 * 1
-c = factorial(3); // c gets the value 6    // 3 * 2 * 1
-d = factorial(4); // d gets the value 24   // 4 * 3 * 2 * 1
-e = factorial(5); // e gets the value 120  // 5 * 4 * 3 * 2 * 1
-
- -

هناك طرق أخرى لاستدعاء الدوال. غالبا ما تكون هناك حالات تحتاج الى دالة تُستدعى بشكل ديناميكي، حيث يمكن التعامل مع مجموعة من ال arguments، وحيث سياق (context) استدعاء الدالة يجب ان ينشا في وظيفة لكائن يحدد وقت التشغيل. وهذا يبين ان الدوال هي نفسها كائنات، وهذه الكائنات بدورها لديها وظائف ( شاهد {{jsxref("Function")}} object). من ضمن هذه الوظائف، الوظيفة {{jsxref("Function.apply", "()apply")}} يمكن استخدامها لتحقيق هذه الاهداف.

- -

نطاق الدالة

- -

المتغيرات المعرفة داخل الدالة لايمكن الوصول إليها من أي مكان آخر خارج الدالة، لأن هذه المتغيرات معرفة فقط داخل نطاق الدالة. على كل، يمكن للدالة الوصول إلى كل المتغيرات والدوال المعرفة في النطاق المعرفة فيه الدالة. بعبارة أخرى، الدالة المعرفة في النطاق العام تستطيع الوصول إلى كل المتغيرات المعرفة في النطاق العام. الدالة المعرفة داخل دالة أخرى يمكنها أيضا الوصول إلى كل المتغيرات المعرفة في دالتها الأم وكل المتغيرات الأخرى التي يمكن للدالة الأم الوصول لها.

- -
// المتغيرات التالية معرفة في النطاق العام
-var num1 = 20,
-    num2 = 3,
-    name = "Chamahk";
-
-// هذه الدالة معرفة في النطاق العام
-function multiply() {
-  return num1 * num2;
-}
-
-multiply(); // Returns 60
-
-// مثال على دالة داخل دالة
-function getScore () {
-  var num1 = 2,
-      num2 = 3;
-
-  function add() {
-    return name + " scored " + (num1 + num2);
-  }
-
-  return add();
-}
-
-getScore(); // Returns "Chamahk scored 5"
-
- -

النطاق ومكدس الدوال

- -

الاستدعاء الذاتي

- -

يمكن للدالة ان تستدعي داتها بثلاثة طرق:

- -
    -
  1. من خلال اسم الدالة
  2. -
  3. arguments.callee
  4. -
  5. من خلال المتغيرات التي تشير إلى الدالة
  6. -
- -

على سبيل المثال، انظر الدالة التالية:

- -
var foo = function bar() {
-   // statements go here
-};
-
- -

تضمين الاستدعاء الذاتي داخل جسم الدالة bar:

- -
    -
  1. ()bar
  2. -
  3. ()arguments.callee
  4. -
  5. ()foo
  6. -
- -

الدوال التي تقوم باستدعاء نفسها تسمى recursive function. الاستدعاء الداتي يشبه آلِية الحلقات في بعض النواحي، كلاهما ينفذان التعليمات البرمجية نفسها عدة مرات، وايضا كلاهما يتطلبان تعبيرا شرطيا (لتجنب التكرار الى ما لا نهاية، او بالاحرى، الاستدعاء الذاتي الى ما لا نهاية في حالتنا هذه). على سبيل المثال، الحلقة التالية:

- -
var x = 0;
-while (x < 10) { // "x < 10" is the loop condition
-   // do stuff
-   x++;
-}
-
- -

المثال التالي يبين دالة تقوم بالاستدعاء الذاتي، يمكنها محاكات الحلقة :

- -
function loop(x) {
-  if (x >= 10) // "x >= 10" is the exit condition (equivalent to "!(x < 10)")
-    return;
-  // do stuff
-  loop(x + 1); // the recursive call
-}
-loop(0);
-
- -

ومع ذلك، لا يمكن أن تكون بعض الخوارزميات حلقات تكرارية بسيطة. على سبيل المثال، الوصول الى كافة العقد nodes في بنية الشجرة DOM سيكون اسهل واكثر تفصيلا باستخدام الاستدعاء الذاتي:

- -
function walkTree(node) {
-  if (node == null) //
-    return;
-  // do something with node
-  for (var i = 0; i < node.childNodes.length; i++) {
-    walkTree(node.childNodes[i]);
-  }
-}
-
- -

على عكس الحلقات التكرارية البسيطة، والتي تقوم بالتكرار السطحي على DOM، تمكننا دوال الاستدعاء الداتي من تنفيذ عدة استدعاءات، كل استدعاء داتي ينتج عنه العديد من الاستدعاءات الفرعية، بمعنى ان هذا النوع من الدوال يمكنها الوصول الى عمق ال DOM. لتتيح لك امكانية التعامل مع كل جزئية فيه. كما يوضح المثال التالي:

- -
var walkTree = function recycle( node, fn ) {
-	fn( node );
-	node = node .firstChild;
-	while( node ){
-		recycle( node, fn );
-		node = node.nextSibling;
-	}
-}
-
-walkTree( document.body , function( node ){
-	if( node.nodeType == 1 ){
-		// do something with [object HTMLElements]
-	}
-	if( node.nodeType == 3 ){
-		// do something with [object Text]
-	}
-});
-
- -

كلا الدالتين اعلاه، تؤدي نفس الغرض، لا اختلاف بينهما، الفرق الوحيد هو شكل بناء الدالة، حيث بنيت الدالة الاولى على طريقة ال  function declaration  فيما بنيت الدالة الثانية على شكل، ال  function expression  وال  anonymous function، وكلاهما تنتهج اسلوب recursive function.

- -

من الناحية النظرية، من الممكن تحويل أي خوارزمية الاستدعاء الذاتي الى خوارزمية الاستدعاء العادي (مع الحلقات، على سبيل المثال). عموما، المنطق الناتج أكثر تعقيداً ويتطلب استخدام  المكدس. الاستدعاء الذاتي أيضا يستخدم المكدس، مكدس الدالة function stack.

- -

سلوك مكدس الذاكرة المؤقتة يمكن أن ينظر إليه كما في المثال التالي:

- -
function foo(i) {
-  if (i < 0)
-    return;
-  console.log('begin:' + i);
-  foo(i - 1);
-  console.log('end:' + i);
-}
-foo(3);
-
-// Output:
-
-// begin:3
-// begin:2
-// begin:1
-// begin:0
-// end:0
-// end:1
-// end:2
-// end:3
- -

الدوال المتداخلة  و الاغلاق (closures)

- -

يمكن انشاء دالة داخل دالة اخرى. الدالة الداخلية هي دالة خاصة private بالدالة الخارجة. الدالة الداخلية تشكل الاغلاق closure، والإغلاق هو فقط تعبير (عموما الاغلاق هو دالة). والذي يمكنه الوصول إلى المتغيرات المجانية free variables (المصطلح free variable يشير الى المتغيرات المستخدمة في الدالة، وهي ليست متغيرات محلية او بارامترات لهذه الدالة. بمعنى اخر هي متغيرات معرفة خارج الدالة وتستفيد منها الدالة، وهذا هو سبب تسميتها بالمتغيرات المجانية)،  كما يمكنه ايضا، الوصول الى اي شئ في البيئة التي ترتبط بها هذه المتغيرات المجانية.

- -

بما ان الدالة الداخلية هي closure. فهذا يعني انها تستطيع ان ترث البرامترات والمتغيرات من الدالة الخارجية. بمعنى اخر، الدالة الداخلية تمتلك النطاق الخاص بالدالة الخارجية.

- -

الخلاصة:

- -
    -
  • لايمكن الوصول إلى الدالة الداخلية الا من خلال التعليمات البرمجية الخاصة بالدالة الخارجية.
  • -
  • الدالة الداخلية تشكل الاغلاق closure: الدالة الداخلية يمكنها استخدام البرامترات والمتغيرات الخاصة بالدالة الخارجية، فيما لا يمكن للدالة الخارجية استخدام البرامترات والمتغيرات الخاصة بالدالة الداخلية.
  • -
- -

يظهر المثال التالي الدوال المتداخلة:

- -
function addSquares(a,b) {
-  function square(x) {
-    return x * x;
-  }
-  return square(a) + square(b);
-}
-a = addSquares(2,3); // returns 13
-b = addSquares(3,4); // returns 25
-c = addSquares(4,5); // returns 41
-
- -

بما ان الدالة الداخلية تشكل closure. فمن الضروري استدعاء الدالة الخارجية أولا، بعد ذالك يمكنك تحديد ال  arguments لكل منهما :

- -
function outside(x) {
-  function inside(y) {
-    return x + y;
-  }
-  return inside;
-}
-fn_inside = outside(3); // Think of it like: give me a function that adds 3 to whatever you give it
-result = fn_inside(5); // returns 8
-
-result1 = outside(3)(5); // returns 8
-
- -

الحفاظ على المتغيرات

- -

في المثال اعلاه، لاحظ كيف تم الحفاظ على x عندما تم ارجاع الدالة inside. الاغلاق يحفاظ على البرامترات والمتغيرات في جميع النطاقات التي تشير إليه. مع كل استدعاء للدالة الخارجية، يمكنك تعيين arguments مختلفة، سيتم إنشاء إغلاق جديد مع كل استدعاء للدالة outside. يمكن تحرير الذاكرة فقط عندما يكون عائد الدلة inside غير متاحا.

- -

وهذا لا يختلف عن تخزين المراجع في كائنات أخرى، ولكن غالبا ما يكون أقل وضوحاً نظراً لعدم تعيين المراجع مباشرة ولا يمكن فحصها.

- -

الدوال الاكثر تداخلا

- -

الدوال يمكن ان تكون اكثر تداخلا، بمعنى، الدالة (A) تحتضن الدالة (B)، والدالة (B) تحتضن الدالة (C). هنا كل من الدالة B و C تشكل closures، وهكذا B يمكنها الوصول الى  A، و  C يمكنها الوصول الى B. بالاضافة الى ذالك، C يمكنها الوصول الى B و A، وبالتالي، الإغلاق يمكن أن يحتوي على عدة نطاقات. وهذا ما يسمى بسلسلة النطاق scope chaining. (سيتم شرح لماذا يطلق عليه "تسلسل" في وقت لاحق).

- -

انظر في المثال التالي:

- -
function A(x) {
-  function B(y) {
-    function C(z) {
-      console.log(x + y + z);
-    }
-    C(3);
-  }
-  B(2);
-}
-A(1); // logs 6 (1 + 2 + 3)
-
- -

في هذا المثال C تصل الى y الخاصة ب B وايضا الى x الخاصة ب A، أصبح هذا ممكناً لأن:

- -
    -
  1. B تشكل closure، وتمتلك A، بمعنى B يمكنها الوصول الى البارامترات والمتغيرات الخاصة ب A.
  2. -
  3. C تشكل closure، وتمتلك B.
  4. -
  5. بسبب ان B تمتلك A، فقد اصبح C يمتلك A، وعليه ف C يمكنه الوصول الى البارامترات والمتغيرات الخاصة ب B و A. بعبارات أخرى، C سلسلة نطاقات ل B و A في هذا الترتيب.
  6. -
- -

العكس ليس صحيحاً. A لا يمكنها الوصول الى C، لان A لا يمكنها الوصول لاي من البارامترات او المتغيرات الخاصة ب B. (فيما C هي متغير لها). وهكذا، C ستصبح خاصة private فقط ب B.

- -

تضارب الاسماء

- -

عند وجود اثنين من البارامترات أو المتغيرات التي تحمل نفس الاسم في نطاقات الاغلاق، فهذا يسمى تضارب في الاسماء، وفي هذه الحالة، ستكون الاسبقية للنطاقات الاكثر عمقا في استخدام هذا الاسم، اما بالنسبة للنطاقات الأكثر سطحية سوف تحظى بأولوية أدنى لاستخدام هذا الاسم، من وجهة نظر سلسلة النطاق، النطاق الاول في السلسلة هو النطاق الاكثر عمقا ( اسفل السلسلة)، والنطاق الاخير في السلسلة هو النطاق الاكثر سطحية (اعلى السلسلة). شاهد المثال التالي:

- -
function outside() {
-  var x = 10;
-  function inside(x) {
-    return x;
-  }
-  return inside;
-}
-result = outside()(20); // returns 20 instead of 10
-
- -

يحدث تعارض الاسم  في التعليمة return x، وهو مابين الباراميتر x الخاص ب inside وبين المتغير x الخاص ب outside. سلسلة النطاق سترى الامر على هذا النحو {inside, outside, global object}. وبناءا عليه x الخاص ب inside سياخد الاسبقية على x الخاص ب outside، وبالتالي الناتج هو 20 (inside x) بدلا من 10 (outside x).

- -

الاغلاقات - Closures

- -

الإغلاق هي واحدة من أقوى المميزات في جافا سكريبت. جافا سكريبت تسمح بتداخل الوظائف وتمنح الدوال الداخلية حق الوصول الكامل إلى كافة المتغيرات والدوال المعرفة داخل الدالة الخارجية (وجميع المتغيرات والدوال الأخرى التي يمكن للدالة الخارجية الوصول إليها). ومع ذالك، الدوال الخارجية لا يمكنها الوصول الى المتغيرات والدوال المعرفة داخل الدوال الداخلية. وهذا يوفر نوعا من الحماية للمتغيرات والدوال الداخلية. وأيضا، لأن الدوال الداخلية لديها حق الوصول إلى نطاق الدالة الخارجية، فالمتغيرات والدوال المعرفة داخل الدالة الخارجية ستدوم اطول من مدة تنفيذ الدالة الخارجىة، اذا تمكنت الدالة الداخلية ان تدوم أطول من الدالة الخارجية. يتم إنشاء الاغلاق عندما تكون الدالة الداخلية بطريقة أو بأخرى في متناول أي نطاق خارج الدالة الخارجية.

- -
var pet = function(name) {   // The outer function defines a paramrter called "name"
-  var getName = function() {
-    return name;             // The inner function has access to the "name" paramrter of the outer function
-  }
-  return getName;            // Return the inner function, thereby exposing it to outer scopes
-},
-myPet = pet("Vivie");
-
-myPet();                     // Returns "Vivie"
-
- -

من الناحية العملية، يمكن أن تكون المسالة أكثر تعقيداً من التعليمات البرمجية أعلاه. يمكن إرجاع كائن والذي سيحتوي على وظائف للتعامل مع المتغيرات الداخلية للدالة الخارجية:

- -
var createPet = function(name) {
-  var sex;
-
-  return {
-    setName: function(newName) {
-      name = newName;
-    },
-
-    getName: function() {
-      return name;
-    },
-
-    getSex: function() {
-      return sex;
-    },
-
-    setSex: function(newSex) {
-      if(typeof newSex === "string" && (newSex.toLowerCase() === "male" || newSex.toLowerCase() === "female")) {
-        sex = newSex;
-      }
-    }
-  }
-}
-
-var pet = createPet("Vivie");
-pet.getName();                  // Vivie
-
-pet.setName("Oliver");
-pet.setSex("male");
-pet.getSex();                   // male
-pet.getName();                  // Oliver
-
- -

في التعليمات البرمجية اعلاه، المتغير name الخاص بالدالة الخارجية يمكن الوصول اليه من الدوال الداخلية. من المعلوم ايضا، انه، ليس هناك طريقة أخرى للوصول إلى المتغيرات الداخلية إلا من خلال الدوال الداخلية. المتغيرات الداخلية الخاصة بالدوال االداخلية هي بمثابة مخازن آمنة بالنسبة للبارامترات و المتغيرات الخارجية. كما انها تتيح امكانية الوصول الى البيانات الداخلية بشكل دقيق وامن. بالنسبة للدوال، ليس من الضروري تعيينها إلى متغير أو حتى تسميتها.

- -
var getCode = (function(){
-  var secureCode = "0]Eal(eh&2";    // A code we do not want outsiders to be able to modify...
-
-  return function () {
-    return secureCode;
-  };
-})();
-
-getCode();    // Returns the secureCode
-
- -

ومع ذلك، يجب الاحتراس جيدا من الوقوع في بعض الفخاخ عند استخدام عمليات الإغلاق. إذا كانت دالة مغلقة تعرف متغير بنفس الاسم، كاسم متغير في النطاق الخارجي، فلا توجد طريقة للإشارة إلى المتغير في النطاق الخارجي مرة أخرى.

- -
var createPet = function(name) {  // Outer function defines a variable called "name"
-  return {
-    setName: function(name) {    // Enclosed function also defines a variable called "name"
-      name = name;               // ??? How do we access the "name" defined by the outer function ???
-    }
-  }
-}
-
- -

الكلمة المحجوزة this (في بعض الاحيان تسمى بالمتغير العجيب)، ينبغي التعامل معها بحذر في حالات الإغلاق. احذر، ف this تشير إلى السياق حيث سيتم استدعاء الدالة وليس إلى المكان حيث تم تعريف الدالة.

- -

استخدام الكائن arguments

- -

يمكنك التعامل مع  arguments الدالة من الداخل، من خلال الكائن (arguments او الحجج). يمكنك معالجة ال  arguments الممررة الى الدالة على النحو التالي:

- -
arguments[i]
-
- -

حيث ان i هو الفهرس الرقمي لل arguments، ويبتدئ من 0، وبالتالي، ال argument الاول الممرر الى الدالة سيكون arguments[0]. لمعرفة عدد ال arguments الممررة نستخدم arguments.length.

- -

باستخدام الكائن arguments، يمكنك استدعاء دالة مع arguments أكثر من التي تم التصريح بها رسميا. وهي مفيذة جدا، خصوصا إذا كنت لا تعرف مسبقاً كم عدد ال  arguments التي ستمرر اثناء استدعاء الدالة. يمكنك استخدام arguments.length لمعرفة عدد البرامترات الممرة الى الدالة، حتى تتمكن بعد ذالك من التعامل معها من خلال الكائن arguments.

- -

على سبيل المثال، يمكننا انشاء دالة تقوم بوصل عدة سلاسل حرفية. ال argument الوحيد المحدد رسميا في الدالة، هو السلسلة الحرفية التي ستفصل بين باقي السلاسل الحرفية التي ستمرر ك arguments بعد ال argument الرسمي للدالة.  كما في المثال التالي:

- -
function myConcat(separator) {
-   var result = "", // initialize list
-       i;
-   // iterate through arguments
-   for (i = 1; i < arguments.length; i++) {
-      result += arguments[i] + separator;
-   }
-   return result;
-}
-
- -

يمكنك تمرير اي عدد من ال arguments لهذه الدالة، وسترتبط ببعضها البعض من خلال ما سيمرر الى ال argument الرسمي:

- -
// returns "red, orange, blue, "
-myConcat(", ", "red", "orange", "blue");
-
-// returns "elephant; giraffe; lion; cheetah; "
-myConcat("; ", "elephant", "giraffe", "lion", "cheetah");
-
-// returns "sage. basil. oregano. pepper. parsley. "
-myConcat(". ", "sage", "basil", "oregano", "pepper", "parsley");
-
- -
-

ملاحظة: المتغير arguments هو شبه مصفوفة، ولكنه ليس مصفوفة. وانما يتصرف كالمصفوفة، يستخدم الفهرسة الرقمية، يستخدم الخاصية length، ومع ذالك، لا يمكنه استخدام الوظائف الخاصة بالمصفوفات مثل push او join ...الخ.

-
- -

الفرق بين parameters و arguments

- -

Function parameters او بارامترات الدالة، هي الأسماء المدرجة في تعريف الدالة. فيما Function arguments هي القيم الحقيقية التي تمرر إلى الدالة عند الاستدعاء (راجع التعريف والاستدعاء اعلى الصفحة). انظر المثال التالي:

- -
function foo( param1, param2, ...) // parameters {
-    // Do things
-}
-foo(arg1, arg2, ...); // arguments
-
- -
-

ملاحظة: ال parameter هو متغير باسم معين يمرر الى الدالة. تستخدم الباراميترات لجلب ال arguments داخل الدوال.

-
- -

راجع الكائن {{jsxref("Function")}} في مرجع الجافا سكريبت لمزيد من المعلومات.

- -

بارامترات الدالة

- -

بدأً من ECMAScript 6، أصبح هناك نوعان من البارامترات: البارامترات الإفتراضية وبقية البارامترات.

- -

البارامترات الإفتراضية

- -

في الجافاسكريبت، القيمة الافتراضية لبرامترات الدوال هي undefined. ومع ذالك، في بعض الحالات، قد يكون من المفيد تعيين قيمة افتراضية مختلفة. البارامترات الافتراضية يمكنها تدارك الموقف.

- -

قبل ECMAScript 2015، كانت الاستراتيجية العامة لوضع الافتراضات هي اختبار قيمة البارامتر في جسم الدالة وتعيين قيمة له اذا كانت قيمته undefined. على سبيل المثال، في التعليمة البرمجية التالية، لم يتم تحديد قيمة للبارامتر b في الاستدعاء، وبالتالي قيمتة ستساوي undefined، عند اختبار (a * b) ستعود الدالة multiply ب NaN. لتجنب هذا،  يقوم السطر الثاني في التعليمة البرمجية اسفله بتعيين قيمة افتراضية للبارامتر b:

- -
function multiply(a, b) {
-  b = typeof b !== 'undefined' ?  b : 1;
-
-  return a*b;
-}
-
-multiply(5); // 5
-
- -

ابتداءا من ECMAScript 2015، اصبح من الممكن عمل اعدادات افتراضية على غرار (php)، والاختبار في جسم الدالة لم يعد ضروريا. الان، ببساطة يمكنك تعيين 1 كقيمة افتراضية للبارامتر b في تعريف الدالة:

- -
function multiply(a, b = 1) {
-  return a*b;
-}
-
-multiply(5); // 5
- -

لمزيد من التفاصيل، راجع  default parameters في مرجع الجافاسكريبت.

- -

بقية البارامترات - rest parameter

- -

الصيغة rest parameter تسمح بتمثيل عدد غير محدود من ال arguments كمصفوفة. في هذا المثال، نستخدم بقية البارامترات لتجميع ال arguments ابتداءا من البرامتر الثاني لغاية النهاية. ثم نقوم بضربها باول بارامتر. هذا المثال يستخدم دالة السهم، والتي سندرسها في القسم التالي.

- -
function multiply(multiplier, ...theArgs) {
-  return theArgs.map(x => multiplier * x);
-}
-
-var arr = multiply(2, 1, 2, 3);
-console.log(arr); // [2, 4, 6]
- -

دوال السهم - Arrow functions

- -

تعبيرات دوال السهم تسمح لك باستخدام تعبيرا أكثر إيجازاً من التعبير عن الوظائف الكلاسيكية. والقيمة this يتم ربطها بشكل نحوي. فيما تكون دوال السهم مجهولة الاسم anonymous. راجع ايضا هذه المدونة  ES6 In Depth: Arrow functions.

- -

اثنين من العوامل التي أثرت في مقدمة دوال السهم: الدوال المختصرة و lexical this.

- -

الدوال المختصرة

- -

في بعض الأنماط الوظيفية، الدوال المختصرة هي موضع ترحيب. قارن التعليمات البرمجية التالية:

- -
var a = [
-  "Hydrogen",
-  "Helium",
-  "Lithium",
-  "Beryl­lium"
-];
-
-var a2 = a.map(function(s){ return s.length });
-
-var a3 = a.map( s => s.length );
- -

التعليمة Lexical this

- -

قبل وجود وظائف السهم، كانت كل دالة جديدة تعرف قيمة ال this الخاصة بها (كائن جديد في حالة الدالة الإنشائية، undefined في استدعاءات الدوال مع الوضع الصارم، في سياق الكائن قيد التشغيل في حالة الوظيفة، إلخ.). وهذا يمكن أن يسبب بعض المشاكل مع نمط البرمجة الكائنية:

- -
function Person() {
-  // The Person() constructor defines 'this' as itself.
-  this.age = 0;
-
-  setInterval(function growUp() {
-    // In nonstrict mode, the growUp() function defines 'this'
-    // as the global object, which is different from the 'this'
-    // defined by the Person() constructor.
-  this.age++;
-  }, 1000);
-}
-var p = new Person();
- -

في ECMAScript 3/5، تم إصلاح هذه المشكلة عن طريق تخزير القيمة this في متغير اخر.

- -
function Person() {
-  var self = this; // Some choose `that` instead of `self`.
-                   // Choose one and be consistent.
-  self.age = 0;
-
-  setInterval(function growUp() {
-    // The callback refers to the `self` variable of which
-    // the value is the expected object.
-    self.age++;
-  }, 1000);
-}
- -

بدلا من ذلك، يمكننا إنشاء دالة ملزمة bound function بحيث تكون "احسن"  قيمة this سيتم تمريرها إلى الدالة ()growUp.

- -

دوال السهم تلتقط القيمة this من السياق المغلق (enclosing context)، لذا ستعمل التعليمة البرمجية التالية كما هو متوقع.

- -
function Person(){
-  this.age = 0;
-
-  setInterval(() => {
-    this.age++; // |this| properly refers to the person object
-  }, 1000);
-}
-
-var p = new Person();
- -

دوال معرفة مسبقا

- -

جافا سكريبت لديها العديد من الوظائف المدمجة ذات المستوى الاعلى top-level :

- -
-
{{jsxref("Global_Objects/eval", "()eval")}}
-
-

الوظيفة ()eval تستخدم لاختبار شفرة الجافا سكريبت على شكل سلسلة حرفية.

-
-
{{jsxref("Global_Objects/uneval", "()uneval")}} {{non-standard_inline}}
-
-

الوظيفة ()uneval تستخدم لانشاء سلسلة حرفية عبارة عن مصدر كود الكائن {{jsxref("Object")}}.

-
-
{{jsxref("Global_Objects/isFinite", "()isFinite")}}
-
-

الدالة العامة () isFinite تقوم بتحديد ما إذا كانت القيمة التي تم تمريرها عدد محدود. إذا لزم الأمر، يتم تحويل البارامتر إلى رقم.

-
-
{{jsxref("Global_Objects/isNaN", "()isNaN")}}
-
-

تستخدم الدالة()isNaN للتاكد من ان القيمة ليست رقمية {{jsxref("Global_Objects/NaN", "NaN")}}  ملاحظة: يمكننا ايضا استخدام {{jsxref("Number.isNaN()")}}, الجديدة في ECMAScript 6 او استخدام التعليمة typeof. كلها تادي نفس الغرض.

-
-
{{jsxref("Global_Objects/parseFloat", "()parseFloat")}}
-
-

تستخدم الدالة ()parseFloat لتحويل سلسلة حرفية الى عدد كسري.

-
-
{{jsxref("Global_Objects/parseInt", "()parseInt")}}
-
-

تستخدم الدالة ()parseInt لتحويل سلسلة حرفية الى عدد صحيح (البارامتر الثاني خاص بالتعامل مع القاعدة في الأنظمة العددية الرياضية).

-
-
{{jsxref("Global_Objects/decodeURI", "()decodeURI")}}
-
-

تستخدم الدالة ()decodeURI لفك تشفير معرف الموارد الموحد (Uniform Resource Identifier (URI التي تم إنشاؤها مسبقا من طرف {{jsxref("Global_Objects/encodeURI", "encodeURI")}} او عن طريق نفس الروتين.

-
-
{{jsxref("Global_Objects/decodeURIComponent", "()decodeURIComponent")}}
-
-

تستخدم الوظيفة ()decodeURIComponent لفك تشفير معرف عناصر الموارد الموحدة (Uniform Resource Identifier (URI التي تم إنشاؤها مسبقا من طرف {{jsxref("Global_Objects/encodeURIComponent", "encodeURIComponent")}} او عن طريق نفس الروتين.

-
-
{{jsxref("Global_Objects/encodeURI", "()encodeURI")}}
-
-

تستخدم الوظيفة ()encodeURI لتشفير معرف الموارد الموحد (Uniform Resource Identifier (URI باستبدال كل مثيل من أحرف معينة بواحد، اثنان، ثلاثة، أو أربعة تهريبات متوالية تمثل ترميز الاحرف UTF-8 (لن يكون إلا أربع تهريبات متوالية لرموز تتألف من اثنين من الحروف "البديلة").

-
-
{{jsxref("Global_Objects/encodeURIComponent", "()encodeURIComponent")}}
-
-

تستخدم الوظيفة ()encodeURIComponent لتشفير معرف عناصر الموارد الموحدة (Uniform Resource Identifier (URI باستبدال كل مثيل من أحرف معينة بواحد، اثنان، ثلاثة، أو أربعة تهريبات متوالية تمثل ترميز الاحرف UTF-8 (لن يكون إلا أربع تهريبات متوالية لاحرف تتألف من اثنين من الحروف "البديلة").

-
-
{{jsxref("Global_Objects/escape", "()escape")}} {{deprecated_inline}}
-
-

الوظيفة ()escape الغير مرغوب فيها. تحتسب سلسلة جديدة من بعض الأحرف التي يجب استبدلها من قبل hexadecimal escape sequence. استخدم {{jsxref("Global_Objects/encodeURI", "encodeURI")}} او استخدم {{jsxref("Global_Objects/encodeURIComponent", "encodeURIComponent")}} بدلا عنها.

-
-
{{jsxref("Global_Objects/unescape", "()unescape")}} {{deprecated_inline}}
-
-

الوظيفة()unescape الغير مرغوب فيها. تحتسب سلسلة جديدة بحيث hexadecimal escape sequence. اسبدلت مع الرمز الذي يمثلها. متتالية التهريب يمكن ان تاتى من دالة مثل {{jsxref("Global_Objects/escape", "escape")}}. على العموم استخدم {{jsxref("Global_Objects/decodeURI", "decodeURI()")}} او استخدم {{jsxref("Global_Objects/decodeURIComponent", "decodeURIComponent")}} بدلا عنها.

-
-
- -

 

-
- -

{{PreviousNext("Web/JavaScript/Guide/Loops_and_iteration", "Web/JavaScript/Guide/Expressions_and_Operators")}}

diff --git a/files/ar/web/javascript/guide/grammar_and_types/index.html b/files/ar/web/javascript/guide/grammar_and_types/index.html deleted file mode 100644 index de3a576881..0000000000 --- a/files/ar/web/javascript/guide/grammar_and_types/index.html +++ /dev/null @@ -1,680 +0,0 @@ ---- -title: قواعد اللغة وأنواع البيانات -slug: Web/JavaScript/Guide/Grammar_and_types -translation_of: Web/JavaScript/Guide/Grammar_and_types ---- -
{{jsSidebar("JavaScript Guide")}} {{PreviousNext("Web/JavaScript/Guide/Introduction", "Web/JavaScript/Guide/Control_flow_and_error_handling")}}
- -

يناقش هذا الفصل. القواعد الأساسية لجافا سكريبت، والإعلان عن المتغيرات، وأنواع البيانات الحرفية.

- -

الأساسيات

- -
-

معظم التعبيرات الخاصة بجافا سكريبت مشتقة من Java، ولكنها تاثرت أيضا ب Awk، بيرل وبايثون.

- -

الجافاسكريبت حساسة لحالة الاحرف myName ليس نفسه myname، الجافاسكريبت تستخدم مجموعة من رموز ال Unicode.

- -

في الجافاسكريبت، التعليمات البرمجية تسمى {{Glossary("Statement", "statements")}}  وتكون مفصولة بفاصلة منقوطة (؛).  الفراغات، وعلامات التبويب (tabs) والأسطر الجديدة تسمى مساحة خالية.  يتم تحليل نص شيفرة المصدر لجافا سكريبت من اليسار إلى اليمين ويتم تحويلها إلى سلسلة من العناصر والمدخلات، وهي الرموز المميزة (tokens)، رموز التحكم (control characters)، ونهايات الاسطر (line terminators)، والتعليقات والمسافات الخالية، ECMAScript تحدد ايضا الكلمات المحجوزة مثل (if او var او return الخ)  والبيانات الحرفية، كما لها قواعد للإدراج التلقائي للفاصلة المنقوطة (ASI) لانهاء التعليمة البرمجية. ومع ذالك، من المستحسن دائماً إضافة الفاصلة المنقوطة (;) نهاية التعليمة البرمجية الخاصة بك لتجنب الاثار الجانبية، للحصول على مزيد من المعلومات، راجع قاموس جافا سكريبت.

- -

التعليقات

- -

صيغة التعليقات هي نفسها كما هو الحال في ++C و في العديد من اللغات الأخرى:

- -
// a one line comment
-
-/* this is a longer,
-   multi-line comment
- */
-
-/* You can't, however, /* nest comments */ SyntaxError */
- -

الاعلانات

- -

هناك ثلاثة أنواع من الإعلانات في جافا سكريبت.

- -
-
{{jsxref("Statements/var", "var")}}
-
الاعلان عن متغير (اي، الكلمة المحجوزة var متبوعة باسم المتغير var x)، تهيئته (اي، اسناد قيمة اولية له var x = value ) / اختياري.
-
{{jsxref("Statements/let", "let")}}
-
الاعلان عن متغير محلي ضمن نطاق الكتلة (ال block هو مجموعة من التعليمات البرمجية بين اقواس متعرجة {})، تهيئته / اختياري.
-
{{jsxref("Statements/const", "const")}}
-
الاعلان عن ثابت قابل للقراءة فقط.
-
- -

المتغيرات

- -

يمكنك استخدام المتغيرات كأسماء رمزية للقيم في التطبيق الخاص بك. أسماء المتغيرات، تسمى {{Glossary("Identifier", "identifiers")}}, وتخضع لقواعد معينة.

- -

المتغير في جافاسكريبت، يجب أن يبدأ بحرف، أو رمز (_)، أو علامة الدولار ($). يمكن أيضا أن تكون الأحرف اللاحقة أرقاما (0-9). ولأن الجافاسكريبت حساسة لحالة الأحرف، فإن الحروف تشمل الأحرف من "A" الى "Z" (أحرف كبيرة) او أحرف من  "a" الى "z" (أحرف صغيرة).

- -

يمكنك استخدام معظم أحرف ال ISO 8859-1 أو Unicode مثل å و ü في المتغيرات. لمزيد من المعلومات راجع مذه المدونة كما يمكنك أيضا استخدام  Unicode escape sequences كرموز مع المتغيرات.

- -

بعض الامثلة عن اسماء المتغيرات الجائزة :  Number_hits, temp99, $credit, and_name.

- -

الاعلان عن المتغيرات

- -

يمكنك تعريف متغير بثلاث طرق:

- -
    -
  • بواسطة الكلمة المحجوزة {{jsxref("Statements/var", "var")}}. على سبيل المثال،  var x = 42. يمكن استخدام هذه الصيغة للاعلان عن متغير عام ومتغير محلي على حد سواء.
  • -
  • من دون الكلمة المجوزة var. على سبيل المثال x = 42. سيصبح متغيرا عاما. لاكن تذكر على انه سيولد تحذيرا اذا استخدمته مع الوضع الصارم لجافاسكريبت "use strict".
  • -
  • بواسطة الكلمة المحجوزة {{jsxref("Statements/let", "let")}}. على سبيل المثال let y = 13. يمكن استخدام هذه الصيغة للاعلان عن متغير محلي داخل نطاق الكتلة. راجع Variable scope  ادناه.
  • -
- -

اختبار المتغيرات

- -

الاعلان عن متغير باستخدام var او let من دون تهيئته، سيتم تهيئته بالقيمة {{jsxref("undefined")}} (بشكل تلقائي من قبل الجافاسكريبت).

- -
-

ملاحظة: جافا سكريبت في الوضع الصارم ("use strict") لا تسمح باستخدام المتغيرات إذا لم يتم الإعلان عنها

-
- -

محاولة الوصول إلى متغير غير معلن عنه سيؤدي الى ال {{jsxref("ReferenceError")}}. وايضا محاولة الوصول الى متغير لم يتم تهيئته بعد سيعود ب undefined :

- -
var a;
-console.log("The value of a is " + a); // logs "The value of a is undefined"
-console.log("The value of b is " + b); // throws ReferenceError exception
-
- -

يمكنك استخدام undefined لاختبار ما إذا كان المتغير مهيأ ام لا. في التعليمة البرمجية التالية، المتغير input غير مهيأ، ستقوم التعليمة if باختبار ما اذا كان فعلا المتغير input غير مهيأ، بمعنى اخر (هل صحيح/true ان المتغير input غير مهيأ).

- -
var input;
-if(input === undefined){
-  doThis();
-} else {
-  doThat();
-}
-
- -

القيمة undefined تتصرف ك false عندما تستخدم في السياق المنطقي. على سبيل المثال، التعليمة البرمجية التالية ستقوم بتنفيذ الدالة myFunction بسبب ان العنصر الاول في المصفوفة myArray غير مهيأ:

- -
var myArray = [];
-if (!myArray[0]) myFunction();
- -
-

تذكير:  تذكر ان "المتغير الغير مهيأ يتم تهيئته بشكل تلقائي بالقيمة undefined" كما ذكرنا اعلاه.

-
- -

القيمة undefined تتحول الى NaN (ليسا رقما) عندما تستخدم في السياق الرقمي.

- -
var a;
-a + 2 = NaN
- -

عند اختبار متغير يحمل القيمة {{jsxref("null")}} ستتصرف القيمة null ك 0 في السياق الرقمي وك false في السياق المنطقي على سبيل المثال:

- -
var n = null;
-console.log(n * 32); // Will log 0 to the console
-
- -

نطاق المتغيرات - Variable scope

- -

عندما سنقوم بتعريف متغير خارج أي دالة/وظيفة سيسمى متغير عام، لأنه سيصبح متاحا لأية تعليمات برمجية أخرى في المستند الحالي. وعندما سنقوم بتعريف متغير داخل دالة/وظيفة، سيسمى متغير محلي، لأنه سيصبح متاحا فقط داخل هذه الدالة.

- -

في جافاسكريبت قبل ECMAScript 2015، لم يكن للتعليمة البرمجية block statement نطاق (scope) خاص بها، المتغير الذي يتم تعريفه داخل block هو اما متغير محلى للدالة او متغير محلي للنطاق العام حسب تواجد هذا البلوك.

- -

يبين المثال التالى كيف ان ال block ليس له نطاق خاص به، مخرجات التعليمة البرمجية التالية ستكون 5، بسبب ان المتغير x تم تعريفه في النطاق العام وليس في نطاق ال block، وفي هذه الحالة ال block هي التعليمة if.

- -
if (true) {
-  var x = 5;
-}
-console.log(x);  // 5
-
- -

يتغير هذا السلوك، عند الاعلان عن متغير باستخدام let المعتمدة في ECMAScript 6، الان اصبح لل block نطاقا خاصا به: 

- -
if (true) {
-  let y = 5;
-}
-console.log(y);  // ReferenceError: y is not defined
-
- -

رفع المتغيرات - Variable hoisting

- -

الرفع هو السلوك الافتراضي لجافا سكريبت، تقوم جافاسكريبت برفع جميع المتغيرات او الدوال او اي شئ تم الاعلان عنه، إلى أعلى النطاق الحالي (في الجزء العلوي من التعليمة البرمجية الحالية أو الوظيفة الحالية بشكل اوتوماتيكي). في جافاسكريبت، يمكن الاعلان عن متغير بعد استخدامه. او بعبارة اخرى يمكن استخدام المتغير قبل الاعلان عنه.

- -

لو تاملت قليلا في التعليمة البرمجة التالية، ستتسائل ما الذي جعل المتغير x يعود ب undefined وليس ب ReferenceError. السبب هو ان الجافاسكريبت ترفع الاعلان (var x) فقط، ولا ترفع التهيئة (3=). وبالتالي وبسبب الرفع الذي حدث "في الخفاء"، x اعلن عنه قبل استخدامه، لكن بسبب ان التهيئة لم ترفع، فقيمة x ستعود ب undefined. ونفس الشئ حصل مع المتغير myvar، بحيث تم رفعه الى اعلى نطاق الدالة. فيما تم رفع المتغير x الى اعلى النطاق العام.

- -
/*---Example 1---*/
-
-console.log(x === undefined); // logs "true"
-var x = 3;
-
-
-/*---Example 2---*/
-
-// will return a value of undefined
-var myvar = "my value";
-
-(function() {
-  console.log(myvar); // undefined
-  var myvar = "local value";
-})();
-
- -

الامثلة اعلاه، ستفسر بالشكل التالي:

- -
/*---Example 1---*/
-
-var x;
-console.log(x === undefined); // logs "true"
-x = 3;
-
-
-/*---Example 2---*/
-
-var myvar = "my value";
-
-(function() {
-  var myvar;
-  console.log(myvar); // undefined
-  myvar = "local value";
-})();
-
- -

لتجنب الكثير من الاخطاء، حاول دائما الاعلان عن المتغيرات اعلى اي نطاق. بما ان هذا هو السلوك الذي تعتمده جافاسكريبت لتفسير التعليمة البرمجية خاصتك (بخصوص هذه الجزئية)، فالسلوك المتوقع منك ايضا كمبرمج متمرس هو مجاراة الجافاسكريبت. وايضا هذا يجعل من التعليمات البرمجية خاصتك اكثر وضوحا واكثر قابلية للقراءة.

- -

في ECMAScript 2015، المتغير let سوف لن يتم رفعه الى اعلى نطاق ال block. واستخدام متغير داخل block قبل الاعلان عنه سينتج عنه ReferenceError. لان المتغير يعتبر في "منطقة زمنية ميتة" من بداية ال block حتى يتم معالجته بالإعلان.

- -
console.log(x); // ReferenceError
-let x = 3;
- -

رفع  الدوال - Function hoisting

- -

بالنسبة للدوال، فقط ال function declaration هي التي سترفع الى الاعلى وليست ال function expression.

- -
/* Function declaration */
-
-foo(); // "bar"
-
-function foo() {
-  console.log('bar');
-}
-
-
-/* Function expression */
-
-baz(); // TypeError: baz is not a function
-
-var baz = function() {
-  console.log('bar2');
-};
-
- -

المتغيرات العامة

- -

المتغيرات العامة، في حقيقة الامر هي خصائص للكائن العام. في صفحات الويب الكائن العام هو window. لذا يمكنك انشاء او الوصول إلى المتغيرات العامة باستخدام الصيغة window.variable.

- -

كما يمكنك ايضا الوصول إلى المتغيرات العامة المعلن عنها في نافذة أو frame من نافذة اخرى او frame عن طريق تحديد النافذة او اسم ال frame. على سبيل المثال، اذا كان لدينا متغير معلن عنه في الوثيقة، واسمه phoneNumber,  يمكنك الوصول الى هذا المتغير من ال iframe باستخدام الصيغة parent.phoneNumber

- -

الثوابت - Constants

- -

يمكنك إنشاء ثابت للقراءة فقط، والمسمى بالكلمة المحجوزة {{jsxref("Statements/const", "const")}} طريقة التعبير عن الثابت هي نفسها طريقة التعبير عن المتغير: يجب ان يبدا بحرف او underscore او ($)dollar sign  ويمكن يحتوي على alphabetic، ارقام، او underscore او رموز. 

- -
const prefix = '212';
-
- -

الثابت، لا يمكن تغيير قيمته من خلال الاحالة او باعادة الاعلان عنه اثناء تشغيل السكريبت. ولا بد من تهيئته.

- -

قواعد نطاق الثابت هي نفسها قواعد المتغير let فيما يخص نطاق ال block. اذا لم يتم تعيين الكلمة المحجوزة const سيتم معاملته معاملة المتغير.

- -

اسم الثابت لا يجب ان يكون هو نفسه اسم دالة او متغير في نفس النطاق. على سبيل المثال:

- -
// THIS WILL CAUSE AN ERROR
-function f() {};
-const f = 5;
-
-// THIS WILL CAUSE AN ERROR ALSO
-function f() {
-  const g = 5;
-  var g;
-
-  //statements
-}
-
- -

ومع ذلك، خصائص الكائنات التي يتم تعيينها إلى الثوابت غير محمية، حيث سيتم تنفيذ التعليمة التالية دون مشاكل.

- -
const MY_OBJECT = {'key': 'value'};
-MY_OBJECT.key = 'otherValue';
- -

هياكل البيانات والأنواع - Data structures and types

- -

أنواع البيانات

- -

المعيار الاحدث ل ECMAScript يحدد سبعة من انواع البيانات:

- -
    -
  • ستة منها اولية {{Glossary("Primitive", "primitives")}}: -
      -
    • {{Glossary("Boolean")}}. true و false.
    • -
    • النوع {{Glossary("null")}}. من الكلمات المحجوزة، تعني قيمة خالية. ولان جافاسكريبت حساسة لحالة الاحرف case-sensitive، يجب كتابتها كما هي لان null ليست هي  Null او NULL او اي تركيبة اخرى.
    • -
    • النوع {{Glossary("undefined")}}. يعبر عن القيم الغير معرفة، له قيمة واحدة فقط، وتسمى undefined.
    • -
    • النوع {{Glossary("Number")}}. رقمي مثل 42 او 3.14159.
    • -
    • النوع {{Glossary("String")}}. سلسلة نصية مثل "Howdy"
    • -
    • النوع {{Glossary("Symbol")}} (new in ECMAScript 6). نوع البيانات الفريدة من نوعها والغير قابلة  للتغيير.
    • -
    -
  • -
  • والنوع {{Glossary("Object")}}
  • -
- -

على الرغم من أن هذه الكمية من أنواع البيانات صغيرة نسبيا، الا أنها تتيح لك القيام بمهام مفيدة مع التطبيقات الخاصة بك. الكائنات {{jsxref("Object", "Objects")}} والدوال {{jsxref("Function", "functions")}} هي العناصر الأساسية الأخرى في اللغة، يمكنك اعتبار الكائنات كحاويات لمجموعة من المتغرات المرتبطة بالكائن، والدوال هي الوظائف التي سيقوم التطبيق الخاص بك بتنفيذها.

- -

تحويل نوع البيانات - Data type conversion

- -

الجافاسكريبت لغة حيوية، وهذا يعني انك لست بحاجة لتحديد نوع البيانات للمتغير اثناء تعريفه، على غرار لغات برمجة اخرى (جافا مثلا)، لانه سيتم تحويل أنواع البيانات تلقائياً حسب الحاجة أثناء تنفيذ السكريبت. على سبيل المثال، يمكنك تعريف متغير كالتالي:

- -
var answer = 42;
-
- -

وفي وقت لاحق، يمكنك تغيير نوع البيانات، من النوع Number الى النوع String، عن طريق تعيين سلسلة حرفية لنفس المتغير، على سبيل المثال:

- -
answer = "Thanks for all the fish...";
-
- -

بفضل حيوية الجافا سكريبت، فهذه التعليمة البرمجية لن تتسبب في اية رسالة خطأ.

- -

اثناء الجمع بين القيم الرقمية والسلاسل الحرفية باستخدام عامل التشغيل (+)، فجافاسكريب تحول القيم الرقمية الى سلاسل حرفية. على سبيل المثال، انظر في التعليمات البرمجية التالية:

- -
x = "The answer is " + 42 // "The answer is 42"
-y = 42 + " is the answer" // "42 is the answer"
-
- -

في التعبيرات التي تحتوي على عوامل أخرى، جافا سكريبت لا تقوم بتحويل القيم الرقمية إلى سلاسل حرفية. على سبيل المثال:

- -
"37" - 7 // 30
-"37" + 7 // "377"
-
- -

تحويل القيم النصية إلى أرقام

- -

في حالة أن لدينا قيمة تمثل عدد في الذاكرة وهي على شكل سلسلة حرفية ("10")، ونريد تحويلها الى قيمة رقمية، سنحتاج الى وظائف جاهزة في الجافاسكريبت تقوم بعملية التحويل.

- -
    -
  • {{jsxref("parseInt", "()parseInt")}}
  • -
  • {{jsxref("parseFloat", "()parseFloat")}}
  • -
- -

المثال التالي يبين كيفية استخدام الوظيفة parseInt ببارامتر واحد، لمزيد من المعلومات حول البرامتر الثاني واشياء اخرى، راجع {{jsxref("parseInt", "()parseInt")}}:

- -
var str = "10";
-console.log( typeof str ) // string
-var parse = parseInt(str)
-console.log( typeof parse ) // number.
- -

المثال التالي يبين كيفية استخدام الوظيفة parseFloat، لمزيد من المعلومات، راجع {{jsxref("parseFloat", "()parseFloat")}}

- -
var str = "3.14";
-console.log( typeof str ) // string
-var parse = parseInt(str)
-console.log( typeof parse ) // number.
- -

طريقة بديلة لتحويل قيمة رقمية على شكل سلسلة حرفية، باستخدام العامل (unary plus)+

- -
"1.1" + "1.1" = "1.11.1"
-(+"1.1") + (+"1.1") = 2.2
-// Note: the parentheses are added for clarity, not required.
- -

البيانات الحرفية - Literals

- -

المقصود بالبيانات الحرفية، هو استخددام الكائن بالصيغة الاسهل، مثلا، بدلا من استخدام الكائن new Array(elm1,elm2...) نستخدم [...elm1,elm2] وهكذا مع جميع الكائنات الاخرى.

- -

يمكنك استخدام البيانات الحرفية لتمثيل القيم في جافا سكريبت. وهي قيم ثابتة، ليست متغيرات، والتي ترد حرفيا في السكريبت. يصف هذا القسم الأنواع التالية من البيانات الحرفية :

- -
    -
  • {{anch("Array literals")}}
  • -
  • {{anch("Boolean literals")}}
  • -
  • {{anch("Floating-point literals")}}
  • -
  • {{anch("Integers")}}
  • -
  • {{anch("Object literals")}}
  • -
  • {{anch("String literals")}}
  • -
- -

بيانات المصفوفة الحرفية - Array literals

- -

بيانات المصفوفة الحرفية، هي قائمة تتكون من صفر او اكثر من التعبيرات، كل تعبير فيها يمثل عنصر المصفوفة، محاطة بأقواس مربعة ([]). عندما تقوم بإنشاء مصفوفة باستخدام البيانات الحرفية ، ستقوم بتهيئتها بقيم محددة لتكوين عناصرها، طول المصفوفة هو عدد البارامترات/العناصر المحددة لها.

- -

ينشئ المثال التالي مصفوفة القهوة مع ثلاثة عناصر وطولها ثلاثة:

- -
var coffees = ["French Roast", "Colombian", "Kona"];
-
- -
-

ملاحظة: بيانات المصفوفة الحرفية هي نوع من مهيئ الكائن.  Using Object Initializers.

-
- -

إذا تم إنشاء مصفوفة باستخدام البيانات الحرفية في سكريبت على أعلى مستوى (top-level script)، فجافاسكريبت ستفسر هذه المصفوفة في كل مرة يتم اختبار التعبير الذي يحتوي على المصفوفة. بالإضافة الى ذالك، البيانات الحرفية المستخدمة في دالة يتم إنشاءها كل مرة يتم فيها استدعاء الدالة. 

- -

 البيانات الحرفية هي كذالك Array objects راجع {{jsxref("Array")}} و Indexed collections لمعرفة تفاصيل ال Array objects.

- -

فواصل إضافية في ال array literals

- -

لست بحاجة لتحديد جميع العناصر في بيانات المصفوفة الحرفية. اذا قمت بوضع فاصلتات متتاليتان سيم انشاء المصفوفة مع undefined مكان العنصر الغير محدد.

- -
var fish = ["Lion", , "Angel"];
-
- -

تحتوي هذه المصفوفة على عنصرين بقيم، وعنصر واحد فارغ (fish[0] هو "Lion"، و fish[1] هو undefined، و fish[2] هو "Angel").

- -

إذا قمت بتضمين فاصلة زائدة في نهاية قائمة العناصر، سيتم تجاهل تلك الفاصلة. في المثال التالي، طول المصفوفة هو ثلاثة. وليس هناك myList[3]. جميع الفواصل الأخرى في القائمة تشير الى عنصر جديد.

- -
var myList = ['home', , 'school', ];
-
- -

في المثال التالي، طول المصفوفة هو أربعة، و myList[0] و myList[2] في عداد المفقودين.

- -
var myList = [ , 'home', , 'school'];
-
- -

في المثال التالي، طول المصفوفة أربعة، myList[1] و myList[3] في عداد المفقودين. وسيتم تجاهل الفاصلة الأخيرة فقط.

- -
var myList = ['home', , 'school', , ];
-
- -

فهم سلوك الفواصل الاضافية مهم لفهم جافا سكريبت كلغة، ولكن عند كتابة التعليمات البرمجية الخاصة بك: من الافضل الإعلان الصريح عن العناصر المفقودة ب undefined، مثل هذه الممارسات ستزيد من وضوح التعليمات البرمجية الخاصة بك ويصبح من السهل صيانتها.

- -
-

ملاحظة: يمكن للفواصل الزائدة ان تخلق أخطاءا في الاصدارات القديمة من المتصفحات. من الافضل إزالتها.

-
- -

Boolean literals

- -

النوع Boolean يتكون من بيانين حرفيين وهما :  true و false.

- -

لا ينبغي الخلط بين القيم المنطقية الاولية true و false مع القيم true و false لل Boolean object. الكائن Boolean هو من يحتضن انوع البيانات المنطقية الاولية. راجع {{jsxref("Boolean")}} لمزيد من المعلومات.

- -

الأعداد الصحيحة - Integers

- -

يمكن التعبير عن الأعداد الصحيحة بالنسبة لكل من العدد الصحيح العشري ب (base 10)، ونظام العد السداسي عشر ب (base 16) والرقم الثماني ب (base 8) والثنائي ب (base 2).

- -
    -
  • البيانات الحرفية التي تمثل الأرقام العشرية هي عبارة عن سلسلة من الأرقام التي لا تبدأ ب 0 (صفر)
  • -
  • البادئة 0 (صفر)  تشير إلى أن العدد الصحيح الحرفي في تدوين ثماني. هذه الاعداد الصحيحة يمكن أن تتكون من ارقام فقط من 0 (صفر) إلى 7 (سبعة).
  • -
  • البادئة 0x (أو 0X) تشير إلى نظام العد السداسي عشر. يمكن أن تتضمن أرقام نظام العد السداسي عشر والأحرف من A إلى F (حروف صغيرة وحروف كبيرة) وأرقام (0-9).
  • -
  • -

    البادئة 0b  (أو 0B) تشير إلى منهج ثنائي. يمكن أن تتكون من الأرقام الثنائية 0 أو 1 فقط.

    -
  • -
- -

بعض الأمثلة عن البيانات الحرفية لعدد صحيح :

- -
0, 117 and -345 (decimal, base 10)
-015, 0001 and -077 (octal, base 8)
-0x1123, 0x00111 and -0xF1A7 (hexadecimal, "hex" or base 16)
-
- -

لمزيد من المعلومات، راجع Numeric literals in the Lexical grammar reference.

- -

بيانات العدد الكسري الحرفي

- -

البيانات الحرفية لعدد كسري  يمكن أن تتكون من الأجزاء التالية:

- -
    -
  • الاعداد الصحيحة العشرية التي يمكن توقيعها (مسبوقة ب "+" أو "-")،
  • -
  • النقطة العشرية (".")،
  • -
  •  العدد الكسري (عدد عشري آخر)،
  • -
  • الأس.
  • -
- -

الأس هو "e" أو "E" متبوعاً بعدد صحيح، والذي يمكن توقيعه (يسبقه "+" أو "-"). يجب أن يكون قيمة حرفية floating-point ويجب ان يحتوي على رقم واحد على الأقل والنقطة العشرية أو "e"  (أو "E").

- -
[(+|-)][digits][.digits][(E|e)[(+|-)]digits]
-
- -

على سبيل المثال:

- -
3.14
-2345.789
-.3333333333333333333
--.283185307179586
-
- -

بيانات الكائن الحرفي - Object literals

- -

بيانات الكائن الحرفية هي عبارة عن قائمة تتكون من صفر او اكثر من الازواج، كل زوجين  عبارة عن اسم خاصية الكائن وقيمتها، محاطة بأقواس متعرجة ({}). لا يجب استخدام البيانات الحرفية للكائن في بداية التعليمة البرمجية خاصتك. لان هذا سيؤدي إلى خطأ او سيقوم بسلوك عكس المتوقع منه، بسبب ان الجافاسكريبت ستفسر } على انه بداية ل block.

- -

في المثال التالي. العنصر الاول للكائن car يمثل الخاصية  myCar، تحمل القيمة النصية "Saturn"، العنصر الثاني هي الخاصية getCar، قيمتها هو ناتج الدالة carTypes("Honda")، العنصر الثالث، هي الخاصية special، قيمتها متغير خارجي وهو  sales.

- -
var Sales = "Toyota";
-
-function CarTypes(name) {
-  if (name == "Honda") {
-    return name;
-  } else {
-    return "Sorry, we don't sell " + name + ".";
-  }
-}
-
-var car = { myCar: "Saturn", getCar: CarTypes("Honda"), special: Sales };
-
-console.log(car.myCar);   // Saturn
-console.log(car.getCar);  // Honda
-console.log(car.special); // Toyota
-
- -

بالإضافة إلى ذلك، يمكنك استخدام قيمة رقمية أو سلسلة حرفية كاسم للخاصية، كما يمكنك ايضا انشاء كائن داخل كائن آخر. يبين المثال التالي كيفية انشاء هذه الخيارات.

- -
var car = { manyCars: {a: "Saab", "b": "Jeep"}, 7: "Mazda" };
-
-console.log(car.manyCars.b); // Jeep
-console.log(car[7]); // Mazda
-
- -

أسماء خصائص الكائن يمكن أن تكون أي سلسلة حرفية، بما في ذالك السلسلة الحرفية الفارغة, اذا كان اسم الخاصية عبارة عن احد المعرفات identifier، الغير مسموح بها (ما لا يمكن استخدامه كاسم للمتغر مثلا) او ان يكون اسم الخاصية عبارة عن رقم، فيجب إحاطتها بعلامات الاقتباس. اسماء الخاصية الغير مسموح بها كمعرفات لا يمكن الوصول اليها بطريقة نقطة التدوين (.)، وانما تستخدم طريقة الاقواس المربعة ("[]") للوصول اليها او التعديل عليها.

- -
var unusualPropertyNames = {
-  "": "An empty string",
-  "!": "Bang!"
-}
-console.log(unusualPropertyNames."");   // SyntaxError: Unexpected string
-console.log(unusualPropertyNames[""]);  // An empty string
-console.log(unusualPropertyNames.!);    // SyntaxError: Unexpected token !
-console.log(unusualPropertyNames["!"]); // Bang!
- -

ابتداءا من ES2015، اصبح من الممكن : تعيين ال prototype  أثناء إنشاء الكائن. استخدام التعيين المختصر ك  foo: foo، تعيين الوظائف، استدعاء وظائف الكائن الاب بواسطة super، استخدام أسماء الخصائص المحوسبة مع التعبيرات.

- -
var obj = {
-    // __proto__
-    __proto__: theProtoObj,
-    // Shorthand for ‘handler: handler’
-    handler,
-    // Methods
-    toString() {
-     // Super calls
-     return 'd ' + super.toString();
-    },
-    // Computed (dynamic) property names
-    [ 'prop_' + (() => 42)() ]: 42
-};
- -

يبين المثال التالي الطرق الصحيحة لكيفية الوصول الى الكائن:

- -
var foo = {a: "alpha", 2: "two"};
-console.log(foo.a);    // alpha
-console.log(foo[2]);   // two
-//console.log(foo.2);  // Error: missing ) after argument list
-//console.log(foo[a]); // Error: a is not defined
-console.log(foo["a"]); // alpha
-console.log(foo["2"]); // two
-
- -

بيانات التعبير القياسي الحرفي - RegExp literals

- -

Regex هو نمط (pattern) محصور بين خطوط مائلة. يبين المثال التالي كيفبة التعبير عن بيانات التعبيرات القياسية الحرفية.

- -
var re = /ab+c/;
- -

بيانات السلاسل النصية الحرفية - String literals

- -

السلسلة النصية، هي عبارة عن صفر أو أكثر من الأحرف محاطة بعلامات اقتباس اما منفردة (') أو مزدوجة ("). يبين المثال التالي كيفية استخدام كل من الاقتباسات المنفردة والمزدوجة:

- -
'foo'
-"bar"
-'1234'
-'one line \n another line'
-"John's cat"
-
- -

من الممكن استدعاء وظائف الكائن String على السلاسل الحرفية. تقوم الجافاسكريبت بتحويل السلاسل الحرفية الى الكائن String بشكل مؤقت، بعدما تستدعى الوظائف، يتم استبعاد/تدمير الكائن String المؤقت، يمكنك ايضا استخدام  الخاصية String.length مع القيم النصية:

- -
console.log("John's cat".length)
-// Will print the number of symbols in the string including whitespace.
-// In this case, 10.
-
- -

ابتداءا من ES2015، يمكنك استخدام البيانات الحرفية كقوالب  (template literals)، هذه القوالب النصية هي نفسها المستخدمة في  Perl ،Python، الخ. يمكنك استخدامها لانشاء سلسلة حرفية واحدة على عدة اسطر دون الحاجة لاستخدام اسلوب التهريب (اضافة "\" في نهاية كل سطر). يمكن من خلالها ايضا إنشاء سلاسل حرفية جديدة اعتمادا على مجموعة متقطعة من السلاسل الحرفية المحددة سلفا وذالك من خلال هذه الصيغة الجديدة { result }$، القيمة الممرة result هي القيمة التي ستظهر مع السلسلة الحرفية الجديدة،  وهي عبارة عن مخرجات لاي تعليمة برمجية اخرى مثل (function, literal object, var...).  وايضا يمكنك من خلالها تجنب هجمات الحقن (injection attacks). 

- -
// Basic literal string creation
-`In JavaScript '\n' is a line-feed.`
-
-// Multiline strings
-`In JavaScript template strings can run
- over multiple lines, but double and single
- quoted strings cannot.`
-
-// String interpolation
-var name = 'Bob', time = 'today';
-`Hello ${name}, how are you ${time}?`
-
-// Construct an HTTP request prefix is used to interpret the replacements and construction
-POST`http://foo.org/bar?a=${a}&b=${b}
-     Content-Type: application/json
-     X-Credentials: ${credentials}
-     { "foo": ${foo},
-       "bar": ${bar}}`(myOnReadyStateChangeHandler);
- -

من الأفضل استخدام السلاسل الحرفية قدر الامكان، الا اذا كنت في حاجة ماسة لاستخدام الكائن String، وقتها يمكنك استخدامه ايضا. راجع الكائن {{jsxref("String")}} للاطلاع على كافة التفاصيل.

- -

استخدام الرموز الخاصة مع السلاسل النصية

- -

بالإضافة إلى الرموز العادية، يمكنك أيضا إدراج الرموز الخاصة مع السلاسل الحرفية، كما هو موضح في المثال التالي.

- -
"one line \n another line"
-
- -

يبين الجدول التالي، الرموز الخاصة التي يمكنك استخدامها مع السلاسل الحرفية لجافاسكريبت.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
جدول الرموز الخاصة لجافاسكريبت
CharacterMeaning
0\Null Byte  - بايت فارغ
b\Backspace  - مسافة للخلف
f\Form feed  -  نموذج تغذية
n\New line  -  سطر جديد
r\Carriage return  -  حرف الإرجاع
t\Tab  -  علامة التبويب
v\Vertical tab - علامة التبويب العمودي
'\single quote  -  علامة اقتباس مفردة
"\Double quote  -  علامة اقتباس مزدوجة
\\Backslash character  -  حرف الخط المائل العكسي
XXX\الحرف مع Latin-1 لتحديد ترميز من خلال الرجوع الى الوراء بثلاثة ارقام ثمانية XXX ما بين 0 و 377. على سبيل المثال, 251\ هو تسلسل ثماني لرمز حقوق النشر.
xXX\الحرف مع Latin-1 لتحديد ترميز  من خلال ارقام نظام العد السداسي عشر  XX بين 00 و FF. على سبيل المثال , xA9\ هو تسلسل نظام العد السداسي عشر لرمز حقوق النشر.
uXXXX\الحرف Unicode محدد من خلال اربعة ارقام من نظام العد السداسي عشر  XXXX. على سبيل المثال , u00A9\ هو تسلسل Unicode لرمز حقوق النشر. راجع {{anch("Unicode escape sequences")}}.
u{XXXXX}\كود ال Unicode لتهريب النقطة، على سبيل المثال، u{2F804}\ هي تماما مثل  تهريب اليونيكود نفسه  uD87E\uDC04\
- -

تهريب الرموز - Escaping characters

- -

الرموز الخاصة التي لم ترد في الجدول اعلاه، تم تجاهلها، لانها اصبحت  مستنكرة وينبغي تجنبها.

- -

يمكنك إدراج علامة اقتباس داخل سلسلة حرفية شرط ان يسبقها الرمز backslash. وتعرف هذه العملية بتهريب علامة الاقتباس. على سبيل المثال:

- -
var quote = "He read \"The Cremation of Sam McGee\" by R.W. Service.";
-console.log(quote);
-
- -

ونتيجة لذالك سنحصل على السلسلة الحرفية التالية:

- -
He read "The Cremation of Sam McGee" by R.W. Service.
-
- -

لتضمين الرمز  backslash نفسه  في سلسلة حرفية، يجب  عليك تهريبه ايضا ب backslash ثانية. وبالتالي سيتحول الى رمز عادي، قابل للقراءة. على سبيل المثال، لتعيين مسار الملف c:\temp الى سلسلة حرفية، استخدم التالي:

- -
var home = "c:\\temp";
-
- -

يمكنك ايضا تهريب فواصل الأسطر (line breaks)، وذالك من خلال اضافة backslash في نهاية كل جزء من اجزاء السلسلة الحرفية. الغرض هذه العملية هو الحد من طول التعليمة البرمجية فقط، ولهذا فالسلسلة الحرفية الجديدة، لن تتضمن اي من هذه السلاشات، وكذالك لن تتضمن اية فواصل الأسطر (<line break = <br) المخفية.

- -
var str = "this string \
-is broken \
-across multiple\
-lines."
-console.log(str);   // this string is broken across multiplelines.
-
- -

على الرغم من ان جافاسكريبت لا تتوفر عل التعبير "heredoc" المستخدم في كثير من لغات البرمجة الاخرى (php مثلا) والذي يمكتك من التعامل مع السلاسل الحرفية بطريقة مميزة. الا انه من من الممكن تحقيق ما يشبهها من خلال التعبير التالي:

- -
var poem =
-"Roses are red,\n\
-Violets are blue.\n\
-I'm schizophrenic,\n\
-And so am I."
-
- -

للمزيد من المعلومات

- -

تم التركيز في هذا الفصل على اساسيات صياغة الاعلانات والانواع. لدراسة المزيد حول JavaScript language constructs. راجع أيضا الفصول التالية في هذا الدليل:

- - - -

في الفصل التالي ان شاء الله، سنلقي نظرة على كيفية السيطرة على تدفق البيانات ( control flow constructs ) ومعالجه الأخطاء.

-
- -

{{PreviousNext("Web/JavaScript/Guide/Introduction", "Web/JavaScript/Guide/Control_flow_and_error_handling")}}

diff --git a/files/ar/web/javascript/guide/index.html b/files/ar/web/javascript/guide/index.html deleted file mode 100644 index 8a2410f634..0000000000 --- a/files/ar/web/javascript/guide/index.html +++ /dev/null @@ -1,116 +0,0 @@ ---- -title: دليل جافا سكريبت -slug: Web/JavaScript/Guide -tags: - - جافا سكربيت - - دليل -translation_of: Web/JavaScript/Guide ---- -
{{jsSidebar("JavaScript Guide")}}
- -

دليل جافا سكريبت يظهر لك كيفية استخدام جافا سكريبت ويعطيك لمحة عامة عن اللغة. إذا كنت تريد أن تبدأ مع جافا سكريبت أو البرمجة بشكل عام، راجع المقالات في منطقة التعليم. إذا أردت الحصول على معلومات شاملة حول ميزة اللغة، ألقي نظرة على مرجع جافا سكريبت.

- -

الفصول

- -

هذا الدليل مقسم إلى عدة فصول:

- - - - - -

{{Next("Web/JavaScript/Guide/Introduction")}}

diff --git a/files/ar/web/javascript/guide/introduction/index.html b/files/ar/web/javascript/guide/introduction/index.html deleted file mode 100644 index 681bb0276a..0000000000 --- a/files/ar/web/javascript/guide/introduction/index.html +++ /dev/null @@ -1,159 +0,0 @@ ---- -title: تقديم -slug: Web/JavaScript/Guide/Introduction -tags: - - جافا سكربيت - - مرشد -translation_of: Web/JavaScript/Guide/Introduction ---- -
{{jsSidebar("JavaScript Guide")}} {{PreviousNext("Web/JavaScript/Guide", "Web/JavaScript/Guide/Grammar_and_types")}}
- -

يقوم هذا الفصل بتقديم جافا سكريبت ويناقش بعض مفاهيمها الأساسية.

- -

ما يجب أن تعرفه مسبقا

- -
-

يفترض أن تكون لديك خلفية حول المكونات التالية:

- -
    -
  • معرفة عامة بشبكة الأنترنت و شبكة الويب العالمية ({{Glossary("WWW")}}).
  • -
  • معرفة جيدة بلغة الترميز النص التشعبي ({{Glossary("HTML")}}).
  • -
  • بعض الخبرة في البرمجة. إذا كنت جديدا على البرمجة، يمكنك الأطلاع على أحد الدروس الموجودة على الصفحة الرئيسية حول جافا سكريبت.
  • -
- -

أين تجد المعلومات عن الجافا سكربيت

- -

وثائق جافا سكربيت على MDN تشتمل على مايلي:

- - - -

إذا كنت جديدا على جافا سكريبت، أبدء مع المقالات في منطقة التعلم و دليل جافا سكريبت. حتى تصبح ملما بالأساسيات، ومن ثم يمكنك استخدام مرجع جافا سكربيت للحصول على مزيد من التفاصيل حول الكائنات الفردية والبيانات.

- -

ما هي جافاسكريبت؟

- -

الجافاسكريبت هي لغة برمجة كائنية التوجة ومتعددة المنصات. هي لغة صغيرة وخفيفة الوزن. داخل بيئة المضيف (على سبيل المثال، متصفح ويب)، في هذه البيئة يمكنك استخدامها على الكائنات.

- -

تحتوي جافاسكريبت على مكتبة قياسية من الكائنات، مثل Array، Date، وMath، ومجموعة أساسية من العناصر اللغوية مثل العوامل، بنى التحكم، والتصريحات. جوهر جافا سكريبت هو قابليتها للتعامل مع مجموعة متنوعة من الكائنات التي تكون مكملة مع كائنات إضافية. على سبيل المثال:

- -
    -
  • من جانب العميل جافا سكريبت تمتد إلى صميم اللغة الأساسية من خلال تمكين الكائنات من السيطرة على المتصفح وعلى نموذج الكائن (DOM). على سبيل المثال، تتيح لك إضافات اللغة من جانب العميل وضع العناصر في النموذج HTML ، والرد على الأحداث التي يتم تشغيلها بواسطة المستخدم (النقرات، وإدخال النموذج، وإجراءات التصفح، وما إلى ذلك).
  • -
  • من جانب الخادم جافا سكريبت تمتد إلى صميم اللغة الأساسية من خلال توفير الأشياء ذات الصلة إلى تشغيل الجافا سكريبت على الخادم. على سبيل المثال، الملحقات من جانب الخادم، تسمح للتطبيق الخاص بك، بالتواصل مع قاعدة البيانات، والتعامل مع الملفات والتبديل من تطبيق إلى آخر وهكذا.
  • -
- -

جافا سكريبت وجافا

- -

جافا سكريبت وجافا متشابهتان في بعض النواحي، ولكنها تختلف اختلافا جوهريا عن بعضها البعض في نواح اخرى. لغة جافا سكريبت تبدو وكأنها جافا، لكن لا يتم كتابتها بشكل ثابت، وطباعة جافا سكريبت ضعيفة (في حين أنها قوية في جافا). بناء الجملة في تعبيرات جافا سكريبت متشابهة جدا لجافا، في اصطلاحات التسمية والبنى الشرطية على سبيل المثال، وهذا احد الأسباب التي ادت الى إعادة تسمية لغة LiveScript إلى JavaScript.

- -

على عكس جافا التي لها نظام المترجم الزمني  compile-time system للاعلان عن الكلاسات، فجافا سكريبت تدعم نظام وقت التشغيل  runtime system ولها بعض أنواع البيانات لتمثيل الأرقام، القيم المنطقية، والسلاسل النصية (و أمور أخرى). تعتمد جافاسكريبت على النموذج الأولي  prototype-based object model لعمل رابط بين الكائنات بينما تستخدم جافا نموذجا أكثر شيوعا يستند إلى الكلاسات class-based object model.  النماذج-البروتوتايبس تسمح بخلق ديناميكية عالية فيما يخص الوراثة. وبالتالي، فإن الخصائص التي يرثها كائن ما، قد تختلف مع مرور الوقت. كما تدعم جافاسكريبت الوظائف دون متطلبات إعلانية خاصة. الوظائف يمكن أن تكون خصائص لكائن،

- -

جافا سكريبت هي لغة "حرة" مقارنة بجافا. لذا فليس من الضروري، الاعلان عن نوع المتغيرات او الدوال او حتى الكلاسات. وليس من الضروري معرفة ما إذا كانت الدالة/الوظيفة عامة أو خاصة أو محمية، ولا توجد واجهات لتنفيذها. ولا يتم كتابة نوع المتغيرات والبارامترز والوظائف بشكل صريح.

- -

جافا هي لغة برمجة، تستخدم الكلاسات، مصممة للتشغيل بسرعة وضمان أمن الكتابة. وهذا يعني، على سبيل المثال، أنه لا يمكن تحويل عدد صحيح إلى كائن أو أنه لا يمكنك الوصول إلى الذاكرة الخاصة عن طريق تحريف  Java bytecodes. نموذج الكلاسات المستخدم من قبل جافا، يعني أن البرنامج يتكون فقط من الكلاسات والوظائف. هذا النوع من الميراث القائم على الكلاسات، مرتبط بالكتابة القوية، ينتج هياكل مقترنة بقوة وتسلسلات هرمية للكائن. لهذه الأسباب، يمكن أن تظهر جافا كلغة أكثر تعقيدا من جافا سكريبت.

- -

على عكس جافا، فجافاسكريبت سليلة من لغات اخرى أخف وزنا، وديناميكية مثل HyperTalk و dBASE. وتستهدف لغات البرمجة النصية هذه، جمهورا أكبر مع بنية أبسط، وخصائص محلية متخصصة، والحد الأدنى من المتطلبات المسبقة لإنشاء الكائنات.

- - - - - - - - - - - - - - - - - - - - - - - -
-

جافا سكريبت مقارنة مع جافا

-
جافا سكربيتجافا
تعتمد على رابط البروتوتايب. لا يوجد تمييز بين أنواع الكائنات. تتم الوراثة من خلال آلية البروتوتايب، ويمكن إضافة الخصائص والوظائف إلى أي كائن حيويتعتمد على الكلاسات (Class-based). وتنقسم الكائنات إلى فئات وحالات، يتم الإرث من خلال التسلسل الهرمي للكلاسات. لا يمكن إضافة الكلاسات والحالات ديناميكيا إلى الخصائص والوظائف.
لا يتم الاعلان عن نوع البيانات المتغيرة (الكتابة ديناميكية).يجب تعريف أنواع البيانات المتغيرة (الكتابة ثابتة).
لا يمكن الكتابة تلقائيا إلى القرص الثابت. -
-
-
-
 
- -
يمكن الكتابة تلقائيا إلى القرص الثابت.
-
-
-
- -
-
 
-
-
- -

لمزيد من المعلومات حول الاختلافات بين جافا سكريبت وجافا، انظر الفصل تفاصيل عن الكائن.

- -

جافا سكريبت والمواصفات ECMAScript

- -

 جافا سكريبت موحدة عن طريق Ecma International - الجمعية الأوروبية لتوحيد النظم المعلوماتية والاتصالات (ECMA اختصارا لجمعية مصنعي الكمبيوتر الأوروبية تاريخيا) والتي تنص على لغة برمجة موحدة، هذا الإصدار القياسي من جافا سكريبت، يسمى  ECMAScript. هذا الاصدار، يتصرف بشكل متطابق في جميع التطبيقات المتوافقة مع المعايير. يمكن للشركات استخدام هذه اللغة القياسية لتطوير طريقة تنفيذ جافا سكريبت. يتم توثيق ECMAScript القياسية مع ECMA-262. انظر رؤية جديد جافا سكريبت لمعرفة المزيد عن الاصدارات المختلفة من جافا سكريبت وطبعات مختلفة من مواصفات ECMAScript.

- -

كما إعتُمِدت ECMA-262 من قبل ISO  المنظمة الدولية للتوحيد القياسي ك ISO-16262.  كما يمكنك أيضا العثور على المواصفات على موقع Ecma International. مواصفات ECMAScript  لا تصف نموذج الكائن المستند  (DOM)، الذي يتم توحيده من قبل اتحاد شبكة الويب العالمية (W3C). وDOM يحدد الطريقة التي تعرض بها كائنات المستند HTML في السكريبت الخاص بك. للحصول على فكرة أفضل حول التقنيات المختلفة التي يتم استخدامها عند البرمجة مع جافا سكريبت، راجع مقالة جافا سكريبت نظرة عامة التكنولوجيات.

- -

وثائق جافا سكريبت مقابل المواصفات ECMAScript

- -
-
مواصفات ECMAScript هي مجموعة من المتطلبات لتنفيذ ECMAScript. من المفيد إذا كنت ترغب في تنفيذ ميزات اللغة المتوافقة مع المعايير القياسية في تنفيذ ECMAScript  أو في احدى المحركات SpiderMonkey في فايرفوكس، أو V8 في كروم).
- -
 
-
- -

ليس المقصود من مواصفات ال ECMAScript هو دعم برمجة السكريبت. توفر وثائق جافا سكريبت معلومات لكتابة النصوص البرمجية.

- -

يستخدم مواصفات ECMAScript أحيانا مصطلحات وصياغات قد تبدو غريبة لمطور جافا سكريبت. على الرغم من أن وصف اللغة يختلف بين ECMAScript، وبين وثائق جافا سكريبت، اللغة نفسها لا تزال هي نفسها. تدعم جافاسكريبت جميع الميزات المميزة في مواصفات ECMAScript.

- -

تصف وثائق جافا سكريبت جوانب اللغة التي يمكن استخدامها من قبل مطوري جافا سكريبت.

- -

الشروع في العمل مع جافا سكريبت

- -

الشروع في العمل مع جافا سكريبت سهل: كل ما تحتاجه هو متصفح ويب حديث. يتضمن هذا الدليل بعض ميزات جافا سكريبت المتوفرة فقط في أحدث إصدارات فايرفوكس، لذا يوصى باستخدام احدث إصدار من فايرفوكس لتجربة الأمثلة المقدمة.

- -

هناك أداتان هما جزءا من فايرفوكس، وهي مفيدة لتجربة واختبار شفرة جافا سكريبت، هما: وحدة تحكم الويب Console وقائمة جافاسكريبت Scratchpad .

- -

وحدة تحكم ويب

- -

وحدة تحكم ويب يعرض لك معلومات عن صفحة الويب التي تم تحميلها حاليا، ويشمل أيضا سطر الأوامر الذي يمكنك استخدامه لتنفيذ اكواد الجافا سكربت في الصفحة الحالية.

- -

لفتح وحدة تحكم الويب (Ctrl+Shift+K) او F12،  في وحدة التحكم، هناك سطر الأوامر الذي يمكنك استخدامه لادخال اكواد جافا سكريبت، ويظهر الناتج في الجزء أعلاه:

- -

- -

المسودة

- -

تعتبر وحدة تحكم الويب كبيرة بالنسبة لتنفيذ سطر واحدة من جافا سكريبت، ولكن على الرغم من أنه يمكن تنفيذ عدة أسطر، الا انها ليست مريحة جدا، خصوصا، في تنفيذ  التعليمات البرمجية الكبيرة نوعا ما والمعقدة، لذالك ننصح باستخدام  المسودة Scratchpad كأداة أفضل.

- -

لفتح المسودة (Shift+F4)، او حدد "المسودة" من القائمة اختر "المطور"، وهي ضمن القائمة في فايرفوكس. ستفتح في نافذة منفصلة، يمكنك استخدامها لكتابة وتنفيذ جافا سكريبت في المتصفح. يمكنك أيضا حفظ النصوص إلى القرص وتحميلها من القرص.

- -

- -

مرحبا بالعالم

- -

لتبدأ بكتابة جافا سكريبت، افتح المسودة واكتب "مرحبا بالعالم". كما يلي:

- -
function greetMe(yourName) {
-  alert("Hello " + yourName);
-}
-
-greetMe("World");
-
- -

من قائمة "تنفيذ" واضغط على تنفيذ او  Ctrl + R لمشاهدة ناتج الكود في المتصفح الخاص بك!

- -

في الصفحات التالية، سيعرض هذا الدليل بناء الجملة في لغة جافا سكريبت وميزاتها. وسوف تكون ان شاء الله قادرا على كتابة تطبيقات أكثر تعقيدا.

-
- -

{{PreviousNext("Web/JavaScript/Guide", "Web/JavaScript/Guide/Grammar_and_types")}}

diff --git a/files/ar/web/javascript/guide/loops_and_iteration/index.html b/files/ar/web/javascript/guide/loops_and_iteration/index.html deleted file mode 100644 index 3bc05c57a7..0000000000 --- a/files/ar/web/javascript/guide/loops_and_iteration/index.html +++ /dev/null @@ -1,352 +0,0 @@ ---- -title: الحلقات والتكرار -slug: Web/JavaScript/Guide/Loops_and_iteration -translation_of: Web/JavaScript/Guide/Loops_and_iteration ---- -
{{jsSidebar("JavaScript Guide")}} {{PreviousNext("Web/JavaScript/Guide/Control_flow_and_error_handling", "Web/JavaScript/Guide/Functions")}}
- -

الحلقات، وسيلة سريعة وسهلة لفعل شيئا ما، مرارا وتكرارا. يقدم هذا الفصل من دليل الجافاسكريب  مختلف عبارات التكرار المتاحة لجافا سكريبت.

- -
-

يمكنك التفكير في الحلقة كنسخة من لعبة في الكمبيوتر، حيث ستقوم بتحريك السوبر ماريو X من الخطوات الى الامام، على سبيل المثال، امر التحريك، " تَحرًك ب 5 خطوات إلى الامام". يمكن تطبيق مثل هذه الفكرة باستخدام الحلقة:

- -
var step;
-for (step = 0; step < 5; step++) {
-  // Runs 5 times, with values of step 0 through 4.
-  console.log('Walking east one step');
-}
-
- -

هناك أنواع مختلفة من الحلقات، والمهم هو انها تقوم بشئ واحد: وهو تكرار بعض الاجراءات عدة مرات. الحلقات بمختلف انواعها، تقدم طرقا مختلفة لتحديد نقطة البداية ونقطة النهاية للحلقة. يمكن استخدام نوع معين من الحلقات، لحل نوع معين من المشاكل.

- -

الحلقات المتوفرة في جافاسكريبت وهي :

- -
    -
  • {{anch("for statement")}}
  • -
  • {{anch("do...while statement")}}
  • -
  • {{anch("while statement")}}
  • -
  • {{anch("labeled statement")}}
  • -
  • {{anch("break statement")}}
  • -
  • {{anch("continue statement")}}
  • -
  • {{anch("for...in statement")}}
  • -
  • {{anch("for...of statement")}}
  • -
- -

الحلقة for

- -

الحلقة {{jsxref("statements/for","for loop")}} لاتتوقف عن التكرار حتى يتم تحقق الشرط المحدد ب false. الحلقة for لجافاسكريبت مشابه للحلقة for الخاصة ب Java و C. يوضح الشكل التالي التركيبة الاساسية للحلقة for:

- -
for ([initialExpression]; [condition]; [incrementExpression])
-  statement
-
- -

عند تنفيذ الحلقة، يحدث ما يلي:

- -
    -
  1.  initialExpression : التعبير المستخدم لتهيئة الحلقة، سيتم تنفيذه، إذا كان موجوداً. يقوم هذا التعبير بتهيئة عداد حلقة واحدة أو أكثر، من الممكن استخدام تعبيرات أكثر تعقيدا  إذا لزم الأمر. يمكن ايضا أن يتم تعريف المتغيرات في هذا التعبير.
  2. -
  3. condition : تعبير الشرط الذي تتمحور حوله الحلقة. اذا كانت قيمته تساوي true، ستنفذ الحلقة من جديد، عندما ستصبح قيمته تساوي false، ستنتهي الحلقة، إذا تم حذف تعبير الشرط تماما. سيعتبر الشرط صحيحاً true.
  4. -
  5. statement : التعليمة البرمجية التي ستنفذ ما دام الشرط يساوي true. لتنفيذ تعليمات برمجية متعددة، استخد التعليمة بلوك ({ ... }).
  6. -
  7. incrementExpression : تحديث التعبير، إذا كان موجودا، ينفذ، ويعود التحكم إلى الخطوة رقم 2.
  8. -
- -

مثال

- -

تحتوي الدالة التالية على التعليمة for التي تقوم باحصاء عدد العناصر options المحددة في العنصر {{HTMLElement("select")}}. التعليمة for تعلن عن المتغير i وتقوم بتهيئته ب 0. وتتحقق من ان i اصغر من عدد العناصر في العنصر <select>. ستنفذ التعليمة if  بنجاح، وستزيد قيمة i بواحد ما دامت الحلقة مستمرة بالتكرار.

- -
<form name="selectForm">
-  <p>
-    <label for="musicTypes">Choose some music types, then click the button below:</label>
-    <select id="musicTypes" name="musicTypes" multiple="multiple">
-      <option selected="selected">R&B</option>
-      <option>Jazz</option>
-      <option>Blues</option>
-      <option>New Age</option>
-      <option>Classical</option>
-      <option>Opera</option>
-    </select>
-  </p>
-  <p><input id="btn" type="button" value="How many are selected?" /></p>
-</form>
-
-<script>
-function howMany(selectObject) {
-  var numberSelected = 0;
-  for (var i = 0; i < selectObject.options.length; i++) {
-    if (selectObject.options[i].selected) {
-      numberSelected++;
-    }
-  }
-  return numberSelected;
-}
-
-var btn = document.getElementById('btn');
-btn.addEventListener('click', function() {
-  alert('Number of options selected: ' + howMany(document.selectForm.musicTypes));
-});
-</script>
-
-
- -

الحلقة do...while

- -

الحلقة {{jsxref("statements/do...while", "do...while")}} لاتتوقف عن التكرار حتى يتم تحقق الشرط المحدد ب false . يوضح الشكل التالي التركيبة الاساسية للحلقة do...while

- -
do
-  statement
-while (condition);
-
- -

statement: تنفذ مرة واحدة قبل أن تبدا عملية التحقق من الشرط. عند البدا بعملية التحقق، اذا كان الشرط (condition) يساوي true، تنفذ التعليمة البرمجية (statement) مرة اخرى. بعد انهاء التنفيذ، يتم التحقق مرة اخرى من الشرط. الى ان يصبح الشرط يساوي false، عندها يتوقف التنفيذ ويتم انتقال التحكم الى التعليمة البرمجية التي تلي do...while. لتنفيذ تعليمات برمجية متعددة، استخدم التعليمة بلوك ({ ... }).

- -

مثال

- -

في المثال التالي، الحلقة do، تنفذ مرة واحدة على الاقل وتستمر بالتكرار حتى يصبح i ليس أقل من 5.

- -
var i = 0;
-do {
-  i += 1;
-  console.log(i);
-} while (i < 5);
- -

الحلقة while

- -

الحلقة {{jsxref("statements/while","while")}} ستستمر بتنفيذ التعليمة البرمجية المرتبطة بها طالما الشرط المحدد يساوي true. يوضح الشكل التالي التركيبة الاساسية للحلقة while

- -
while (condition)
-  statement
-
- -

عندما سيصبح الشرط يساوي false، ستتوقف التعليمة البرمجية (statement) المرتبطة بالحلقة  عن التنفيذ وسينتقل التحكم الى التعليمة البرمجية التي تلي الحلقة while.

- -

يتم التحقق من شرط الاختبار قبل تنفيذ statement. كلما عاد الشرط ب true، ستنفذ statement ويتم الرجوع الى الشرط للتحقق منه مرة اخرى. عندما سيعود الشرط ب false سيتوقف التنفيذ وسينتقل التحكم الى التعليمة البرمجية التي تلي الحلقة while.  لتنفيذ تعليمات برمجية متعددة، استخدم التعليمة بلوك ({ ... }).

- -

المثال الاول

- -

الحلقة while ستستمر بالتكرار طالما n أقل من ثلاثة:

- -
var n = 0;
-var x = 0;
-while (n < 3) {
-  n++;
-  x += n;
-}
-
- -

مع كل تكرار، ستقوم الحلقة بالزيادات على n وتضيف قيمته إلى x. لذالك  x و n ستمتلك القيم التالية:

- -
    -
  • بعد المرور الأول:    n = 1  و   x = 1
  • -
  • بعد المرور الثاني:  n = 2  و   x = 3
  • -
  • بعد المرور الثالث:  n = 3  و   x = 6
  • -
- -

بعد الانتهاء من المرور الثالث، الشرط ( n < 3 ) لم يعد يساوي true، لذالك ستنتهي الحلقة.

- -

المثال الثاني

- -

لتجنب تكرار الحلقة الى ما لا نهاية. تأكد من أن الشرط في الحلقة، سيصبح في نهاية المطاف ب false، التعليمة البرمجية في الحلقة while التالية، لن تتوقف عن التنفيذ بسبب ان الشرط لن يصبح ب false:

- -
while (true) {
-  console.log('Hello, world!');
-}
- -
-

تحذير: استمرار تكرار الحلقة الى ما لا نهاية سيتسبب في توقف المتصفحات عن العمل.

-
- -

التعليمة label

- -

تستخدم التعليمة {{jsxref("statements/label","label")}}  لتوفير معرف (id) للتعليمة البرمجية المراد الرجوع اليها من موقع آخر في البرنامج. على سبيل المثال، يمكنك استخدام label لتحديد حلقة، ثم استخدام التعليمة break او continue للإشارة إلى ما إذا كان البرنامج ينبغي أن يوقف الحلقة أو الاستمرار في تنفيذها.

- -

التعبير الخاص بالتعليمة  label يشبه ما يلي:

- -
label :
-   statement
-
- -

قيمة label  يمكن ان تكون أي معرف جافاسكريبت باستثناء الكلمات المحجوزة. التعليمة البرمجية (statement) التي سيشار اليها من طرف label يمكن ان تكون اي تعليمة برمجية.

- -

مثال

- -

في هذا المثال، label markLoop يعرف الحلقة while.

- -
markLoop:
-while (theMark == true) {
-   doSomething();
-}
- -
-

ملاحظة: لمزيد من التفاصيل حول التعليمة label، راجع صفحة مرجع الجافا سكريبت

-
- -

التعليمة break

- -

تستخدم التعليمة {{jsxref("statements/break","break")}} لانهاء الحلقة، او switch، أو بالتزامن مع االتعليمة label.

- -
    -
  • عند استخدام break من دون label ستقوم بانهاء الحلقة  (while ،do-while ،for او switch). وانتقال التحكم الى التعليمة البرمجية التالية.
  • -
  • عند استخدام break مع label سيتم انهاء تنفيذ التعليمة البرمجية المحددة من طرف label
  • -
- -

يمكن التعبير عن  التعليمة break من خلال طريقتين:

- -
break;
-break label;
-
- -

تستخدم الطريقة الأولى لانهاء الحلقة المتواجدة بها، او لانهاء switch. الطريقة الثانية لانهاء تنفيذ التعليمات التي تم تحديدها من قبل label.

- -

المثال الاول

- -

يقوم المثال التالي بالتكرار على عناصر المصفوفة، وبمجرد الوصول الى العنصر المحدد في الشرط وهو theValue سيتم انهاء الحلقة،

- -
for (var i = 0; i < a.length; i++) {
-  if (a[i] == theValue) {
-    break;
-  }
-}
- -

المثال الثاني

- -

المثال التالي، يبين كيفية استخدام التعليمة break بكلا الطريقتين:

- -
var x = 0;
-var z = 0;
-labelCancelLoops: while (true) {
-  console.log('Outer loops: ' + x);
-  x += 1;
-  z = 1;
-  while (true) {
-    console.log('Inner loops: ' + z);
-    z += 1;
-    if (z === 10 && x === 10) {
-      break labelCancelLoops;
-    } else if (z === 10) {
-      break;
-    }
-  }
-}
-
- -

التعليمة continue

- -

يمكن استخدام التعليمة {{jsxref("statements/continue","continue")}} لاستئناف الحلقة while) do-while ،for ، مع labe)، بعد توقفها لغرض معين.

- -
    -
  • عند استخدام continue من دون label، ستقوم بانهاء التكرار الحالي للحلقة while) do-while، او for) وتنتقل الى التكرار التالي. على النقيض من التعليمة break، التعليمة continue لا تنهي تنفيذ الحلقة تماما. عند استخدامها مع الحلقة while فحلقة البرنامج ستعود إلى الشرط. وعند استخدامها مع الحلقة for فحلقة البرنامج ستعود إلى تعليمة الزيادة (increment-expression)
  • -
  • عند استخدام continue مع label، سيتم تطبيقها على الحلقة المحددة بواسطة label.
  • -
- -

يمكن التعبير عن  التعليمة continue من خلال طريقتين:

- -
continue;
-continue label;
-
- -

المثال الاول

- -

في المثال التالي، لدينا الحلقة while مع التعليمة continue التي ستنفذ حينما تصبح i تساوي 3. ولدينا n الذي سيحتوي على القيم التالية:  1, 3, 7 و 12.

- -
var i = 0;
-var n = 0;
-while (i < 5) {
-  i++;
-  if (i == 3) {
-    continue;
-  }
-  n += i;
-}
-
- -

المثال الثاني

- -

التعليمة label checkiandj تحتوي على التعليمة label checkj. عند مصادفة continue سيقوم البرنامج بانهاء التكرار الحالي ل checkj ويبدأ التكرار من جديد. وفي كل مرة يتم مصادفة continue، تستمر checkj بالتكرار حتى يعود الشرط ب false. عندما سيتم العودة ب false،  ما تبقى من التعليمة checkiandj سيكتمل، و checkiandj ستستمر بالتكرار حتى يعود الشرط ب false. عندما سيتم العودة ب false، سينتقل البرنامج الى التعليمة البرمجية التي تلي checkiandj.

- -
var i = 0;
-var j = 10;
-checkiandj:
-  while (i < 4) {
-    console.log(i);
-    i += 1;
-    checkj:
-      while (j > 4) {
-        console.log(j);
-        j -= 1;
-        if ((j % 2) == 0) {
-          continue checkj;
-        }
-        console.log(j + ' is odd.');
-      }
-      console.log('i = ' + i);
-      console.log('j = ' + j);
-  }
- -

عموما: التعليمة break تقوم بانهاء الحلقة نهائيا عندما يتم تحقق الشرط المحدد، فيما تقوم التعليمة continue بتوقيف الحلقة للتحقق من الشرط المحدد، وعندما يتم تنفيذ الشرط، يتم استئناف الحلقة.

- -

التعليمة for...in

- -

تستخدم الحلقة {{jsxref("statements/for...in","for...in")}} للتكرار على جميع خصائص الكائن القابلة للتكرار enumerable properties.  مقابل كل خاصية مميزة، ستنفذ الجافا سكريبت تعليمات برمجية محددة. يوضح الشكل التالي التركيبة الاساسية للحلقة for...in

- -
for (variable in object) {
-  statements
-}
-
- -

مثال

- -

الدالة التالية تتضمن كائن واسم الكائن كبارامترات لها. تقوم بالتكرار على كل خصائص الكائن وترجع سلسلة نصية بأسماء الخصائص والقيم الخاصة بها.

- -
function dump_props(obj, obj_name) {
-  var result = '';
-  for (var i in obj) {
-    result += obj_name + '.' + i + ' = ' + obj[i] + '<br>';
-  }
-  result += '<hr>';
-  return result;
-}
- -

بالنسبة للكائن car مع الخصائص make و model، الناتج سيكون على الشكل التالي:

- -
car.make = Ford
-car.model = Mustang
-
- -

for...in و المصفوفات

- -

على الرغم من كونه مغريا استخدام الحلقة for...in للتكرار على عناصر المصفوفة {{jsxref("Array")}}  الا انها، يمكن أن تقوم بسلوك غير متوقع. في الواقع، الحلقة for...in ستقوم بإرجاع اسماء الخصائص المعرفة من قبل المستخدم بالإضافة إلى الفهارس الرقمية. فمثلا، إذا قمت بالتعديل على Array object، كإضافة خصائص او وظائف جديدة. فستقوم الحلقة for...in بالتكرار على هذه الخصائص او الوظائف بالإضافة إلى عناصر المصفوفة، وبالتالي فمن الأفضل استخدام الحلقة التقليدية {{jsxref("statements/for","for")}} لارجاع الفهارس الرقمية بشكل صحيح عند التكرار على المصفوفة.  يبين المثال التالي كيفية حصول ذالك.

- -
var myArray = [0, 1, 2, , , 5];
-myArray.foo = "hello";
-
-for (var i in myArray) {
-  	console.log(i);  // Outputs 0, 1, 2, 5, hello.
-}
-
-for (var i = 0; i < myArray.length; ++i) {
-  	console.log(i);  // Outputs 0, 1, 2, 3, 4, 5
-}
- -

الحلقة for...of

- -

التعليمة {{jsxref("statements/for...of","for...of")}} نوع جديد من الحلقات تم إضافتها الى الإصدار السادس  من جافا سكربت ، وتستخدم للتكرار على العناصر الموجودة في أي مجموعة أو iterable objects (مثل {{jsxref("Array")}}, {{jsxref("Map")}}, {{jsxref("Set")}} والكائن {{jsxref("functions/arguments","arguments")}} الخ.), كما أن هذا الأسلوب يمكننا من تنفيذ تعليمة برمجية معينة على كل عنصر تم جلبه على حدة للتعديل على أي من خصائصه. يوضح الشكل التالي التركيبة الاساسية للحلقة for...of

- -
for (variable of object) {
-  statement
-}
- -

المثال التالي، يوضح الفرق بين الحلقة for...of والحلقة  {{jsxref("statements/for...in","for...in")}} الحلقة for...in تقوم بارجاع اسماء الخصائص فيما الحلقة for...of تقوم بارجاع قيم الخصائص:

- -
let arr = [3, 5, 7];
-arr.foo = 'hello';
-
-for (let i in arr) {
-   console.log(i); // logs "0", "1", "2", "foo"
-}
-
-for (let i of arr) {
-   console.log(i); // logs 3, 5, 7
-}
-
-
- -

{{PreviousNext("Web/JavaScript/Guide/Control_flow_and_error_handling", "Web/JavaScript/Guide/Functions")}}

diff --git a/files/ar/web/javascript/guide/regular_expressions/index.html b/files/ar/web/javascript/guide/regular_expressions/index.html deleted file mode 100644 index 96928196f8..0000000000 --- a/files/ar/web/javascript/guide/regular_expressions/index.html +++ /dev/null @@ -1,813 +0,0 @@ ---- -title: التعبيرات القياسية -slug: Web/JavaScript/Guide/Regular_Expressions -translation_of: Web/JavaScript/Guide/Regular_Expressions ---- -
{{jsSidebar("JavaScript Guide")}} {{PreviousNext("Web/JavaScript/Guide/Text_formatting", "Web/JavaScript/Guide/Indexed_collections")}}
- -

التعبيرات القياسية (Regular Expressions)، هي أنماط (patterns) تُستخدم لمطابقة مجموعة من الأحرف في السلاسل النصية. التعبيرات القياسية في جافاسكربت كائنات أيضا. تُستخدم هذه الأنماط مع الوظائف {{jsxref("RegExp.exec", "exec")}} و{{jsxref("RegExp.test", "test")}} للكائن {{jsxref("RegExp")}}، ومع الوظائف {{jsxref("String.match", "match")}}، و {{jsxref("String.replace", "replace")}}، و{{jsxref("String.search", "search")}} و {{jsxref("String.split", "split")}} للكائن {{jsxref("String")}}. يتناول هذا الفصل  تعبيرات جافاسكربت القياسية.

- -
-

انشاء تعبير قياسي او ريجكس

- -

يمكنك انشاء ريجكس من خلال احدى الطرق التالية:

- -

الطريقة الاولى، باستخدام التعبير القياسى الحرفي regular expression literal، ويتضمن الباترن pattern بين سلاشين، كما يلي:

- -
var re = /ab+c/;
- -

يقوم ال Regular expression literals بتجهيز التعبير القياسي عند تحميل السكريبت. شرط ان يظل التعبير القياسي ثابتا، في هذه الحالة، استخدام هذا الشكل المختصر يمكن أن يحسن من الأداء.

- -

الطريقة الثانية، من خلال استدعاء constructor الكائن RegExp، كما يلي:

- -
var re = new RegExp('ab+c');
- -

استخدام ال constructor، يقلل من وقت تشغيل الريجكس. إسْتخدِم ال  constructor عندما تريد ان يكون الريجكس قابلا للتغيير، او في حالة عدم علمك بالريجكس الذي ستحصل عليه من طرف اخر. كحقل المدخلات مثلا.

- -

انشاء باترن الريجكس

- -

يتكون الباترن البسيط اما من رموز عادية، مثل /abc/، او خليط من الرموز العادية والرموز الخاصة، مثل /ab*c/ او /Chapter (\d+)\.\d*/. يحتوي هذا الباترن على اقواس هلالية، هذه الاقواس ستقوم بدور ذاكرة الجهاز، بحيث ستقوم بتخزين قيمة المطابقة الناتجة عن هذا الجزء من الباترن وفهرستها ليتم استدعاؤها لاحقا. للمزيد من التفاصيل حول مطابقة السلسلة النصية الجزئية بين قوسين.

- -

استخدام الباتر البسيط

- -

تتكون الباترنز البسيطة، من رموز صريحة ومباشرة، تصف فيها ما تريد مقارنته مباشرة. مثلا، الباترن /abc/ سيطابق مجموعة من الرموز في سلسلة نصية، شرط تواجد هذه الرموز جنبا الى جنب بشكل مرتب. لذالك، ستنجح المطابقة في هذه السلسلة النصية "Hi, do you know your abc's?"  وكذالك في السلسلة النصية التالية "The latest airplane designs evolved from slabcraft."، نجحت المطابقة في كلتا الحالتين لان السلسلة الفرعية 'abc' هي المطلوبة. وهذا لايتطابق مع هذه السلسلة النصية 'Grab crab' لانها تحتوي على سلسلة نصية غير تلك المطلوبة  'ab c'.

- -

استخدام الرموز الخاصة

- -

عندما يتطلب الامر عملية بحث، أكثر من مطابقة صريحة ومباشرة، مثل البحث عن واحد او اكثر من ال 'b'، او البحث عن مسافة فارغة، عندها سيتوجب على الباترن ان يحتوي على الرموز الخاصة. مثلا، الباترن /ab*c/ سيطابق مجموعة من الرموز، حيث ستكون 'a' متبوعة بصفر او اكثر من ال 'b'، الرمز الخاص نجمة * يرصد وجود العنصر المطلوب صفر او اكثر من المرات، متبوعا مباشرة ب 'c'. بعد فحص السلسلة النصية "cbbabbbbcdebc," قام الباترن بمطابقة السلسلة الجزئية 'abbbbc'.

- -

يحتوي الجدول التالي على قائمة مكتملة من رموز الريجكس الخاصة وشرحها.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

الرموز الخاصة بالريجكس.

-
الرمزشرح الاستخدام
\ -

 

- -

مطابقات وفقا للقواعد التالية:
-
- الباكسلاش الذي يسبق الرمز العادي يشير الى ان الرمز التالي هو رمز من الرموز الخاصة ولا ينبغي تفسيره حرفيا. مثلا 'b' من دون باكسلاش \ ، ستطابق 'b' بحروف صغيرة. لكن \b في حد داتها لا تطابق اي حرف، لانها من الرموز الخاصة وتعني حصر او تحديد حدود للرموز المطلوبة word boundary character.
-
- الباكسلاش الذي يسبق الرموز الخاصة، يشير الى ان الرمز التالي هو ليس من الرموز الخاصة وينبغي تفسيره حرفيا. مثلا، الباترن /a*/ يحتوي على احد الرموز الخاصة * وهو لمطابقة صفر او اكثر من a، بعد اضافة الباكسلاش له، كما في  الباترن /a\*/ تم الغاء رمزيتة، وبالتالي اصبح الباترن  /a\*/ يطابق السلسلة الحرفية 'a*'.
-
- لا تنس تهريب الباكسلاش نفسه، بينما تستخدم الكونستراكتر RegExp( "\\s", "g" )، لانه يعمل ايضا، كمهرب للرموز الخاصة في السلسلة النصية.

- -

 

-
^ -

 

- -

مطابقة بداية المدخلات. ادا كان البند multiline ب true، اي ان m موجودة في الباترن /^a/gm سيبدا البحث عن المطابقة في بداية اي سطر جديد.
-
- مثلا الباترن  /^a/gm  سيطابق اثنان من 'a'، في "a special char\nacter"، لاحظ وجود السطر الجديد \n في السلسلة النصية.
-
- الرمز ^ سيصبح له معنى اخر عندما يستخدم مع المجموعة. توجه الى مجموعة الرموز لمعرفة المزيد من التفاصيل.

- -

 

-
$ -

 

- -

مطابقة نهاية المدخلات. ادا كان البند multiline  ب true، اي ان m موجودة في الباترن /r$/gm سيبدا البحث عن المطابقة في نهاية اي سطر جديد.
-
- مثلا الباترن /r$/gm سيطابق اثنان من 'r'، في "a special char\nacter"، لاحظ وجود السطر الجديد \n في السلسلة النصية.

-
* -

 

- -

مطابقة التعبير الذي سيسبق الرمز * صفر او اكثر من المرات، وهو مكافئ ل {0,}.

- -

مثلا، /bo*/ سيطابق 'boooo' في "A ghost booooed" و 'b' في "A bird warbled" لكن لا شئ بالنسبة ل "A goat grunted".

- -

 

-
+ -

 

- -

مطابقة التعبير الذي سيسبق الرمز + مرة واحدة على الاقل او اكثر من المرات، وهو مكافئ ل {1,}.

- -

مثلا، /a+/ ستطابق 'a' في "candy" ومجموعة ال  'a' في "caaaaaaandy" لكن لا شئ بالنسبة ل "cndy".

- -

 

-
? -

 

- -

مطابقة التعبير الذي سيسبق الرمز ? صفر او واحد من المرات، وهو مكافئ ل {0,1}.
-
- مثلا، الباترن /e?le?/ سيطابق 'el' في "angel" و 'le' في "angle" وكذالك 'l' في "also".
-
- اذا استخدم الرمز ? مباشرة بعد احد هذه المحددات *، +، ?، او {}، سيؤثر على سلوكها الافتراضي، فيجعلها غير طماعة non-greedy او غير جشعة (تطابق عدد محدود من الاحرف) بخلاف سلوكها الافتراضي، وهو التصرف بجشع (تطابق اكثر عدد ممكن من الاحرف)، مثلا، باستخدام الباترن الجشع، /\d+/ ستطابق كل السلسلة "123" في "123abc" . اما باستخدام الباترن الغير جشع، /\d+?/ وعلى نفس السلسلة ستطابق "1" فقط.
-
- مثال اكثر دقة حول non-greedy و greedy، فرضا، نريد مطابقة تاجات الاتش تي ام ال، باستخدام الباترن الجشع /<(.+)>/g سيتم مطابقة كل السلسلة النصية "<div>fCh<p>elema</p>lCh</div>"، اما باستخدام الباترن الغير شجع /<(.+?)>/g فسيتم مطابقة التاجات ومحتواها فقط. بمعنى، ان العملية ستسير بالشكل التالي: مع بداية البحث، عندما سيجد التاج الاول '<div>' سييكتفي به ولا يطمع في ما يليه، ثم ينتقل مباشرة نحو الهدف الثاني '<p>' فيطابقه ويكتفي به دون ان يطمع في ما يليه، وهكذا. مع العلم ان الباترن عبارة عن البحث (.+?) في كل شئ، لكن من دون طمع.
- الرمز ? يصبح له معنى اخر مع lookahead assertions، النظر الى الامام x(?=y) ومنع النظر الى الامام x(?!y) سيتم شرحها في هذا الجدول.

- -

 

-
. -

 

- -

النقطة الكسرية تطابق اي شئ، ما عدا السطر الجديد

- -

مثلا، /.n/ ستطابق 'an' و 'on' في "nay, an apple is on the tree", لكن ليس 'nay'.

- -

 

-
(x) -

 

- -

مطابقة 'x' وانشاء فهرسة جزئية. كما يبين المثال التالى. اقواس المجموعة المفهرسة تسمى capturing parentheses.
-
- مثلا،'(foo)' و '(bar)' في الباترن /(foo) (bar) \1 \2/ تطابق وتفهرس الكلمة الاولى والكلمة الثانية في السلسلة الحرفية "foo bar foo bar". والفهرسة الرقمية \1 و \2  تولد الكلمة الثالثة والكلمة الرابعة بناءا على الاقواس المحيطة بكل منهما. تذكر ان هذه الفهرسة الرقمية تستخدم داخل الباترن فقط. فيما تستخدم المتغيرات السحررية $1, $2, ..., $n خارج الباترن، وتستخدم في عملية الاستبدال فقط، مثلا، 'bar foo'.replace(/(...) (...)/, '$2 $1').  $& يطابق هذا المتغير السحري $& السلسلة النصية بالكامل، او بمعنى اصح، ينقل ناتج الباترن بالكامل.

- -

 

-
(x:?) -

 

- -

مطابقة ال 'x' لكن دون انشاء جزئية مفهرسة، اقواس المجموعة هنا تسمى non-capturing parentheses

- -

انشاء جزئية مفهرسة وعدم استخدامها، يبطئ من سرعة محرك الريجكس، لانه يتسبب له في عمل زائد، يمكنك جعل محرك الريجكس اسرع قليلا باستخدام non-capturing.

- -

علامة الاستفهام والنقطتين بعد قوس الافتتاح هما من الرموز الخاصة، استخدامهما جنبا الى جنب يخبر محرك الريجكس بان هذه المجموعة لا ينبغي ان تعامل كجزئية مفهرسة. وبالتالي لا يمكن، استدعاء المطابقة من خلال الفهرسة الرقمية\1... او عناصر المصفوفة [1]... او اعادة استخدام المطابقة من خلال المتغيرات السحرية $1...$9.

- -

 

-
=? -

 

- -

مطابقة ال 'x' فقط اذا كانت 'x' متبوعة ب 'y'. وهذا يسمى النظر الى الامام lookahead.

- -

مثلا، /Jack(?=Sprat)/ سيطابق 'Jack' فقط اذا كان متبوعا ب 'Sprat'. وكذالك بالنسبة ل /Jack(?=Sprat|Frost)/ سيطابق 'Jack' فقط اذا كان متبوعا ب 'Sprat' او 'Frost'. ومع ذالك، لا 'Sprat' ولا 'Frost' جزء من ناتج المطابقة.

- -

 

-
!? -

 

- -

مطابقة ال 'x' فقط اذا كانت 'x' غير متبوعة ب 'y'. وهذا يسمى منع او ابطال النظر الى الامام negated lookahead.

- -

مثلا، /\d+(?!\.)/ سيطابق عدد فقط اذا كان غير متبوعا بفاصلة كسرية. الريجكس /\d+(?!\.)/.exec("3.141") سيطابق '141' لكن لن يطابق '3.141'.

- -

 

-
x|y -

 

- -

مطابقة 'x' أو 'y'.

- -

مثلا، /green|red/ سيطابق 'green' في "green apple" و 'red' في "red apple.".

- -

 

-
{n} -

 

- -

مطابقة n تحديدا، بناءا على التعبير الذي سيسبقه. n يجب ان يكون عددا صحيحا.
-
- مثلا، /a{2}/ لن يطابق 'a'في "candy," لكنه سيطابق جميع ال a في "caandy," كما سيطابق اثنان من ال a الاولى في "caaandy.".

- -

 

-
{n,} -

 

- -

مطابقة n او اكثر، بناءا على التعبير الذي سيسبقه. n يجب ان يكون عددا صحيحا.

- -

مثلا، /a{2,}/ سيطابق "aa" ، "aaaa" و "aaaaa" لكن ليس "a".

- -

 

-
{n,m} -

 

- -

حيث ان n و m من الاعداد الصحيحة الموجبة، و n <= m. فستكون المطابقة من n الى m، بناءا على التعبير الذي سيسبقها.

- -

مثلا، /a{1,3}/ لن يطابق شئ في "cndy" لكنه سيطابق 'a' في "candy," وكذاك اثنان من ال 'a' الاولى في "caandy," وايضا الثلاثة "a" الاولى في "caaaaaaandy". لاحظ عند مطابقة "caaaaaaandy" تم مطابقة "aaa" فقط، بالرغم من احتواء السلسة النصية على اكثر من ذالك.

- -

 

-
[xyz] -

 

- -

المجموعة، او مجموعة الرموز، هذا النوع من الباترن يطابق اي رموز داخل الاقواس المعقوفة، بما فيها المهربات المتتالية escape sequences. الرموز الخاصة مثل النقطة (.) والنجمة (*) تصبح رموز عادية شانها شان اي حرف في سلسلة نصية، لذالك فهي لا تحتاج لباكسلاش. يمكنك تحديد منظم الرموز وفصله بشرطة، كما يبين المثال التالي:
-
- الباترن [a-d] سيطابق نفس ما سيطابقه الباترن [abcd] سيطابقان 'b' في "brisket" و 'c' في "city". وكذالك بالنسبة للباترن /[a-z.]+/ و /[\w.]+/ بامكانهما مطابقة كامل السلسلة النصية "test.i.ng".

- -

 

-
[xyz^] -

 

- -

منع مجموعة من الرموز او رموز معينة. سيتم مطابقة اي شئ ما عد ما ورد داخل الاقواس المعقوفة، يمكنك تحديد منظم الرموز وفصله بشرطة، جميع ما يمكن استخدامه في المجموعة او مجموعة الرموز العادية يمكن استخدامه هنا.

- -

مثلا، الباترن [^abc] هو نفسه [^a-c]. سيطابقان 'r' في "brisket" و 'h' في "chop."

- -

 

-
[b\] -

 

- -

سيطابق backspace (U+0008). اذا كنت ترغب بمطابقة الرمز النصي: رجوع الى الخلف literal backspace character. فمن الضروري استخدام الاقواس المعقوفة، حتى لا تتعارض مع \b.

- -

 

-
b\ -

 

- -

مطابقة حدود الكلمة word boundary.

- -

\b، ستطابق الكلمة التي لايسبقها ولا يليها اي من، ما ورد في هذه المجموعة [A-Za-z0-9_] او في مثيلتها \w، بمعنى ادق، ستقبل بوجود المسافة الفارغة والرموز النصية الخاصة مثل "&=)é'?*-" ، اي، كل ما يمكن ان ينتج عن هذه المجموعة [^A-Za-z0-9_] او عن مثيلتها \W، اما من قبل او من بعد المطابقة، او من كلا الجانبين، او ان تكون في بداية السلسلة او نهايتها. لاحظ ان ال \b ليست جزءا من المطابقة. بل للدلالة فقط. وايضا لا تتعارض مع [\b].

- -

امثلة مختلفة:
-
- /\bm/ ستطابق 'm' في "moon".
- /oo\b/ لن تطابق 'oo' في "moon" لان 'oo' متبوعة بالكلمة الرمزية 'n'.
- /oon\b/ ستطابق 'oon' في "moon"، لان 'oon' هو نهاية السلسلة النصية، وبالتالي ليست متبوعة باية كلمة رمزية.
- /\w\b\w/ لن يطابق اي شئ، لان \w لايمكنها ابدا ان تكون متبوعة ب \b و \w.

- -
-

ملاحظة: محرك الريجكس في الجافاسكريبت حدد بالتدقيق مجموعة الرموز على ان تكون "كلمات" رمزية. أي حرف ليس في تلك المجموعة يعتبر كلمة مكسورة. هذه المجموعة من الأحرف محدودة إلى حد ما: وهي تتألف فقط من الأبجدية الرومانية في كلتا الحروف الصغيرة والحروف الكبيرة، والاعداد العشرية، والرمز underscore. الحروف المعلمة مثل "é" او "ü" ، لسوء الحظ عوملت ككلمات مكسورة.

- -

 

-
-
B\ -

 

- -

ال non-word boundary\B. عكس ما يمكن لل \b ان تقوم به.

- -

مثلا، /\B../ ستطابق 'oo' في "noonday"، /y\B./ ستطابق 'ye' في "possibly yesterday".

- -

 

-
cX\ -

 

- -

حيث ان X هو منظم الرموز من A الى Z. يطابق رمز عنصر التحكم في سلسلة نصية. مثلا،

- -

مثلا، /\cM/ سيطابق control-M (U+000D) في السلسلة النصية.

- -

 

-
d\ -

 

- -

مطابقة الاعداد. ويكافئ الباترن [0-9].

- -

مثلا، /\d/ او /[0-9]/ ستطابق '2' في "B2 is the suite number.".

- -

 

-
D\ -

 

- -

مطابقة كل شئ ما عدا الاعداد. ويكافئ الباترن [^0-9].

- -

مثلا، /\D/ او /[^0-9]/ سيطابق 'B' في "B2 is the suite number.".

- -

 

-
f\سيطابق نموذج التلقيم form feed (U+000C).
n\سيطابق سطر التلقيم line feed (U+000A).
r\ -

سيطابق carriage return (U+000D).

-
s\ -

 

- -

مطابقة رمز المسافة الفارغة، بما في ذالك المسافة، التاب، نمودج التلقيم، سطر التلقيم، ويكافئ [ \f\n\r\t\v\u00a0\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff].

- -

مثلا، /\s\w*/ سيطابق ' bar' في "foo bar."

- -

 

-
S\ -

 

- -

مطابقة اي شئ ما عدا رمز المسافة الفارغة، ويكافئ [^ \f\n\r\t\v\u00a0\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff].

- -

مثلا، /\S*/ سيطابق 'foo' في "foo bar."

- -

 

-
t\سيطابق tab (U+0009).
v\ -

سيطابق vertical tab (U+000B).

-
w\ -

 

- -

مطابقة الحروف الابجدية بما في ذالك ال underscore. ويكافي [A-Za-z0-9_].

- -

مثلا، /\w/ سيطابق 'a'في "apple," و '5' في "$5.28," و '3' في "3D."

-
W\ -

 

- -

مطابقة اي شئ غير الحروف الابجدية والاندرسكور، ويكافئ [^A-Za-z0-9_].

- -

مثلا، /\W/ او /[^A-Za-z0-9_]/ سيطابق '%' في "50%.".

- -

 

-
n\ -

 

- -

حيث ان n عدد صحيح موجب، سيشير الى المجموعة المفهرسة capturing parentheses .

- -

مثلا، /apple(,)\sorange\1/ سيطابق 'apple, orange,' في "apple, orange, cherry, peach.".

- -

 

-
0\ -

 

- -

مطابقة الرمز NULL (U+0000). لا تتبع هذا برقم آخر، بسبب ان \0<digits> هو تسلسل التهريب الثماني استخدم \x00 بدلا منه.

- -

 

-
xhh\مطابقة الرمز مع الكود hh (two hexadecimal digits).
uhhhh\مطابقة الرمز مع الكود hhhh (four hexadecimal digits).
u{hhhh}( فقط عندما يستخدم u flag ) سيطابق الرمز مع ال Unicode بالقيمة hhhh (hexadecimal digits).
- -

  لتهريب تعابير الريجكس في المدخلات النصية، يمكنك  استخدام دالة الاستبدال التالية:

- -
function escapeRegExp(string) {
-  return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
-}
- -

يستخدم البند g بعد الباترن، لاجراء بحث عام، ينظر في كل السلسلة النصية ويعود بكل المطابقات. تم شرحه بالتفصيل ادناه. البحث المتقدم باستخدام البنود.

- -

استخدام الاقواس

- -

الاقواس المحيطة باي جزء من الباترن، تجعل هذا الجزء قابل للتخزين والفهرسة. بمجرد ما يتم تخزينه وفهرسته، يصبح قابلا لاعادة الاستخدام من اطراف اخرى، كما تم شرحه في استخدام مطابقة الاقواس الجزئية.

- -

مثلا، الباترن /Chapter (\d+)\.\d*/ يطابق بدقة، الرموز 'Chapter ' متبوعة بواحد او اكثر من الارقام (\d تشير الى اي رقم و + تشير الى واحد او اكثر من المرات، بالاضافة الى الاقواس المستخدمة خصيصا لتخزين وفهرسة ما سينتج عنه )، متبوعا بنقطة او فاصلة عشرية التي هي نفسها من الرموز الخاصة، يسبقها الباكسلاش \ الذي بدوه يخبر الباترن بان يعاملها كنقطة عادية، متبوعا باي رقم يكرر صفر او اكثر من المرات (\d تشير الى اي رقم والنجمة * تشير الى صفر او اكثر من المرات).

- -

هذا الباترن سيطابق "Chapter 4.3" في "Open Chapter 4.3, paragraph 6"، وايضا سيقوم بتخزين وفهرسة الجزئية '4'. بينما الباترن لا يطابق شئ في "Chapter 3 and 4" بسبب ان السلسلة الحرفية لاتحتوي على النقطة بعد الرقم '3'.

- -

لمطابقة سلسلة فرعية من دون التسبب في فهرسة الجزء المتطابق (راجع non-capturing)، ضمن الاقواس ابدا الباترن ب ?:. مثلا (?:\d+) ستطابق واحد او اكثر من الارقام من دون ان تفهرس الرموز المتطابقة.

- -

العمل مع الريجكس

- -

تستخدم التعابير القياسية مع اثنين من الاوبجكت. الاوبجكت الاول هو RegExp ويحتوي على الوظيفتين test و exec والاوبجكت الثاني وهو String ويحتوي على الوظائف التالية: match، replace، search، و split.  تم شرح هذه الوظائف بالتفصيل في JavaScript reference.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

الوظائف المملوكة للكائن RegExp

-
الوظيفةوصفها
exec تقوم هذه الوظيفة بتنفيذ بحث لمطابقة سلسلة نصية. وتعود بمصفوفة تحتوي على نتيجة البحث، او تعود ب null في حالة عدم المطابقة.
test تقوم هذه الوظيفة بعمل فحص لمطابقة سلسلة نصية. وتعود اما ب true او false.
match تقوم هذه الوظيفة بتنفيذ بحث لمطابقة سلسلة نصية. وتعود بمصفوفة تحتوي على نتيجة البحث، او تعود ب null في حالة عدم المطابقة. (نفس ما تقوم به الوظيفة exec).
search تقوم هذه الوظيفة بعمل فحص لمطابقة سلسلة نصية. وتعود برقم المكان الذي يتواجد فيه ما تمت مطابقته. او ب -1 في حالة لم يتم العثور على المطلوب.
replace تقوم هذه الوظيفة بتنفيذ بحث لمطابقة سلسلة نصية. ويحل محل السلسلة الجزئية المتطابقة، السلسلة الجزئية البديلة.
split هذه الوظيفة تستخدم الريجكس او سلسلة نصية ثابتة لتقسيم السلسلة الى مصفوفة من السلاسل الجزئية.
- -

عندما تريد معرفة ما اذا كان الباترن موجود في سلسلة نصية ام لا، استخدم اما الوظيفة test او الوظيفة search ، اما لمعرفة المزيد من المعلومات (ولكن أبطأ قليلا في التنفيذ)، استخدم اما الوظيفة exec او الوظيفة match اذا استخدمت exec او match ونجحت المطابقة، فان هاتان الوظيفتان ستعود بمصفوفة، وفي نفس الوقت ستقوم بتحديث خصائص الريجكس المرتبطة به وكذلك خصائص الريجكس RegExp. اذا فشلت المطابقة, ستعود الوظيفة exec ب null ( التي تفرض : false).

- -

في المثال التالي، السكريبت يستخدم الوظيفة exec للبحث عن مطابقة في السلسلة النصية:

- -
var myRe = /d(b+)d/g;
-var myArray = myRe.exec('cdbbdbsbz');
- -

إذا كنت لا تحتاج إلى الوصول إلى خصائص الريجكس، هناك طريقة بديلة لإنشاء myArray، كالتلي:

- -
var myArray = /d(b+)d/g.exec('cdbbdbsbz'); // similar to "cdbbdbsbz".match(/d(b+)d/g); however,
-    // the latter outputs Array [ "dbbd" ], while
-    // /d(b+)d/g.exec('cdbbdbsbz') outputs Array [ "dbbd", "bb" ].
-    // See below for further info (CTRL+F "The behavior associated with the".)
- -

إذا كنت ترغب في بناء ريجكس من سلسلة نصية، هناك بديل آخر، كالتالي:

- -
var myRe = new RegExp('d(b+)d', 'g');
-var myArray = myRe.exec('cdbbdbsbz');
- -

مع هذا السكريبت، تنجح المطابقة، ويتم ارجاع مصفوفة وتحديث الخصائص معروض في الجدول التالي.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

نتائج تنفيذ الريجكس

-
الكائنالخاصية او الفهرسالوصففي هذا المثال
myArray السلسلة النصية التي جرى مطابقتها وجميع السلاسل النصية الجزئية المفهرسة.['dbbd', 'bb', index: 1, input: 'cdbbdbsbz']
indexفهرس بداية المُطابَقة في السلسلة النصية، والفهرسة تبتدئ من 0.1
inputالسلسلة النصية الأصلية."cdbbdbsbz"
[0]الرموز الاخيرة التي جرى مطابقتها"dbbd"
myRelastIndexالفهرس الذي ستبدأ عنده عملية البحث عن المطابقة التالية. وإذا لم يتم ضبط البند "g" فستبقى قيمته مساويةً للصفر. للمزيد حول البحث المتقدم باستخدام البنود.5
sourceنص الباترن. تم تحديثه في الوقت الذي تم فيه إنشاء الريجكس، وليس وقت تنفيذه."d(b+)d"
- -

كما شاهدنا في المثال الثاني، تستطيع استخدام ريجكس منشا من خلال معد الاوبجكت "object initializer"، من دون اسناده الى متغير. اذا قمت بعمل ذالك، كل ما سيحدث هو ظهور ريجكس جديد. لهذا السبب، لا يمكن الوصول الى خصائص الريجكس. يوضح المثال التالي كيفية الوصول الى خصائص الكائن بالطريقة الصحيحة:

- -
var myRe = /d(b+)d/g;
-var myArray = myRe.exec('cdbbdbsbz');
-console.log('The value of lastIndex is ' + myRe.lastIndex);
-
-// "The value of lastIndex is 5"
- -

بينما يوضح المثال التالي كيفية الوصول الى خصائص الكائن بالطريقة الخاطئة:

- -
var myArray = /d(b+)d/g.exec('cdbbdbsbz');
-console.log('The value of lastIndex is ' + /d(b+)d/g.lastIndex);
-
-// "The value of lastIndex is 0"
- -

حاصل الباترن /d(b+)d/g في كلتا التعليمات البرمجية، عبارة عن كائنان مختلفان، لذالك هما مختلفان في قيمة الخاصية lastIndex اذا كنت ترغب في الوصول الى خصائص الريجكس المنشا من طرف معد او مهيئ الاوبجكت، يلزمك اولا اسناده لمتغير.

- -

Using parenthesized substring matches

- -

بمجرد تضمين جزء من الباترن داخل الاقواس الهلالية، سيصبح جزءا مفهرسا قابل لاعادة الاستخدام، مثلا،  الباترن /a(b)c/ سيطابق 'abc' في  "abcd" ويفهرس المطابقة الجزئية (b) برقم 1، ناتج المطابقة الجزئية (b) هو السلسلة الحرفية الجزئية 'b'. لاستدعاء هذا الجزء المفهرس خارج الباترن، استخدم عناصر المصفوفة [1].... ولاعادة استخدامها داخل الباترن استخدم الفهرسة الرقمية \1 ....
- - كيفية استدعائها خارج الباترن:

- -
var myRe = /a(b)c/;
-var myArray = myRe.exec('abcb');
-console.log('The result of submatch N1: ' + myArray[1] );
-
-// log: The result of submatch N1: b
- -

يمكنك استخدام عدد لا متناهي من هذه الاجزاء المفهرسة، تبتدئ الفهرسة من واحد، عائد المصفوفة سيتضمن جميع الاجزاء المفهرسة في الباترن.
- كيفية اعادة استخدامها داخل الباترن:

- -
var myRe = /a(b)c\s\1/g;
-var myArray = myRe.exec('abc b');
-console.log('The result of submatch N1: ' + myArray[1] );
-
-// log: The result of submatch N1: b
- -

يستخدم السكريبت التالي الوظيفة ()replace لعكس الكلمتين John و Smith في السلسلة النصية 'John Smith'. ويستخدم في نص الاستبدال، المتغيرات السحرية $1 و $2 لاستدعاء المطابقة الجزئية المفهرسة الاولى والثانية. مثال:

- -
var re = /(\w+)\s(\w+)/;
-var str = 'John Smith';
-var newstr = str.replace(re, '$2, $1');
-console.log(newstr);
-
-// "Smith, John"
- -
-

ملاحظة: يسمح باستخدام المتغيرات السحرية، 9 مرات فقط، في العملية الواحدة.

-
- -

البحث المتقدم باستخدام البنود

- -

التعبيرات القياسية في الجافاسكريبت لها خمسة بنود ، وجودها اختياريا، تسمح لنا بعمل بحثا عاما او بحثا دون مراعات لحالة الاحرف. يمكن استخدامها اما منفردة او مجتمعة وكذالك في اي ترتيب، حسب الطلب، وهي جزء من الريجكس.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

بنود الريجكس

-
FlagDescription
gبحث عام، عدم وجوده = النتيجة الاولى فقط.
iعدم مراعاة حالة الاحرف، سواء كانت صغيرة او كبيرة.
mالبحث في السطور المتعدد = كامل النص.
uسلسلة يونيكود، أي معاملة الباترن على أنه سلسلة من رموز يونيكود (Unicode code points).
yالمطابقة ستبدأ من الفهرس المُشار إليه بالخاصية lastIndex لكائن التعابير النمطية في السلسلة الهدف، ولن تتم محاولة مطابقة ما قبل هذا الفهرس. للمزيد من المعلومات sticky
- -

لتضمين بند مع الريجكس استخدم التعبير التالي:

- -
var re = /pattern/flags;
- -

او

- -
var re = new RegExp('pattern', 'flags');
- -

البنود، جزء لا يتجزأ من الريجكس. لا يمكن إزالتها أو إضافتها لاحقا.

- -

مثلا، re = /\w+\s/g يقوم بانشاء ريجكس يبحث على واحد او اكثر من الرموز متبوعة بمسافة واحدة، يقوم بتنفيذ هذا الاجراء على السلسلة الحرفية (كاملة = g):

- -
var re = /\w+\s/g;
-var str = 'fee fi fo fum';
-var myArray = str.match(re);
-console.log(myArray);
-
-// ["fee ", "fi ", "fo "]
- -

يمكنك استبدال هذا السطر:

- -
var re = /\w+\s/g;
- -

ب:

- -
var re = new RegExp('\\w+\\s', 'g');
- -

وستحصل على نفس النتيجة.

- -

يستخدم  البند m لاخبار محرك الريجكس، بان المدخلات النصية، المتعددة السطور، يجب ان تعامل كسطور متعددة. اذا تم استخدام البند m فسيتطابق الرمزان الخاصان ^ و $ ، مع بداية أو نهاية كل سطر من المدخلات، بدلا من المدخل بالكامل. مثال:

- -
var re = /^Multi\s*line$/gm;
-var str = 'Multi line\n or \nMultiline';
-var myArray = str.match( re );
-
-console.log( myArray );
-// log: [ "Multi line", "Multiline" ]
- -

 

- -

امثلة

- -

تبين الامثلة التالية بعض استخدامات الريجكس

- -

اعادة صياغة المدخلات النصية.

- -

يوضح المثال التالي كيف يمكن للريجكس ان يتلاعب في بنية السلسلة النصية، وايضا كيفية استخدام ()string.split و ()string.replace. سيقوم السكريبت التالي بتنظيف واعادة صياغة السلسلة النصية، التي تحتوي على اسماء مفصولة بمسافات فارغة، تابات، وبالظبط فاصلة منقوطة واحدة. واخيرا سيقوم بعكس هذه الاسماء وترتيبها من a الى z.

- -
// The name string contains multiple spaces and tabs,
-// and may have multiple spaces between first and last names.
-var names = 'Orange Trump ;Fred Barney; Helen Rigby ; Bill Abel ; Chris Hand ';
-
-var output = ['---------- Original String\n', names + '\n'];
-
-// Prepare two regular expression patterns and array storage.
-// Split the string into array elements.
-
-// pattern: possible white space then semicolon then possible white space
-var pattern = /\s*;\s*/;
-
-// Break the string into pieces separated by the pattern above and
-// store the pieces in an array called nameList
-var nameList = names.split(pattern);
-
-// new pattern: one or more characters then spaces then characters.
-// Use parentheses to "memorize" portions of the pattern.
-// The memorized portions are referred to later.
-pattern = /(\w+)\s+(\w+)/;
-
-// Below is the new array for holding names being processed.
-var bySurnameList = [];
-
-// Display the name array and populate the new array
-// with comma-separated names, last first.
-//
-// The replace method removes anything matching the pattern
-// and replaces it with the memorized string—the second memorized portion
-// followed by a comma, a space and the first memorized portion.
-//
-// The variables $1 and $2 refer to the portions
-// memorized while matching the pattern.
-
-output.push('---------- After Split by Regular Expression');
-
-var i, len;
-for (i = 0, len = nameList.length; i < len; i++) {
-  output.push(nameList[i]);
-  bySurnameList[i] = nameList[i].replace(pattern, '$2, $1');
-}
-
-// Display the new array.
-output.push('---------- Names Reversed');
-for (i = 0, len = bySurnameList.length; i < len; i++) {
-  output.push(bySurnameList[i]);
-}
-
-// Sort by last name, then display the sorted array.
-bySurnameList.sort();
-output.push('---------- Sorted');
-for (i = 0, len = bySurnameList.length; i < len; i++) {
-  output.push(bySurnameList[i]);
-}
-
-output.push('---------- End');
-
-console.log(output.join('\n'));
- -

استخدام الرموز الخاصة للتحقق من صحة المدخلات.

- -

في المثال التالي، يتوقع من المستخدم ادخال رقم الهاتف. عندما سينقر المستخدم على زر "الفحص" سيقوم السكريبت بفحص صحة الرقم. اذا كان الرقم صحيحا، سيقوم السكريبت باظهار رسالة تشكر المستخدم وتظهر الرقم المدخل. اذا كان الرقم غير صحيح، سيقوم السكريبت باخبار المستخدم بان الرقم المدخل غير صحيح.

- -

بعد non-capturing parentheses (?: سينظر الريجكس الى الثلاثة ارقام \d{3} او | الى القوس اليساري \( متبوعا بثلاثة ارقام \d{3} متبوعة بقوس الاغلاق \), (نهاية non-capturing parenthesis ))، متبوعة بشرطة واحدة تليها الباكسلاش او النقطة الكسرية، اذا وجدت قم بفهرستها ([-\/\.])، متبوعة بثلاث ارقام \d{3}، متبوعة باستدعاء الجزء المفهرس \1, متبوعا باربعة ارقام \d{4}.

- -

يتم تنشيط حدث التغيير عندما يقوم المستخدم بالضغط على إنتر وملأ القيمة RegExp.input.

- -
<!DOCTYPE html>
-<html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-    <meta http-equiv="Content-Script-Type" content="text/javascript">
-    <script type="text/javascript">
-      var re = /(?:\d{3}|\(\d{3}\))([-\/\.])\d{3}\1\d{4}/;
-      function testInfo(phoneInput) {
-        var OK = re.exec(phoneInput.value);
-        if (!OK)
-          window.alert(phoneInput.value + ' isn\'t a phone number with area code!');
-        else
-          window.alert('Thanks, your phone number is ' + OK[0]);
-      }
-    </script>
-  </head>
-  <body>
-    <p>Enter your phone number (with area code) and then click "Check".
-        <br>The expected format is like ###-###-####.</p>
-    <form action="#">
-      <input id="phone"><button onclick="testInfo(document.getElementById('phone'));">Check</button>
-    </form>
-  </body>
-</html>
-
- -

{{PreviousNext("Web/JavaScript/Guide/Text_formatting", "Web/JavaScript/Guide/Indexed_collections")}}

diff --git a/files/ar/web/javascript/guide/working_with_objects/index.html b/files/ar/web/javascript/guide/working_with_objects/index.html deleted file mode 100644 index 83f3390467..0000000000 --- a/files/ar/web/javascript/guide/working_with_objects/index.html +++ /dev/null @@ -1,516 +0,0 @@ ---- -title: العمل مع الكائنات -slug: Web/JavaScript/Guide/Working_with_Objects -translation_of: Web/JavaScript/Guide/Working_with_Objects ---- -
{{jsSidebar("JavaScript Guide")}} {{PreviousNext("Web/JavaScript/Guide/Regular_Expressions", "Web/JavaScript/Guide/Details_of_the_Object_Model")}}
- -

تم تصميم جافا سكريبت على نموذج بسيط يستند إلى الكائنات. الكائن هو عبارة عن مجموعة من الخصائص، كل خاصية لها اسم وقيمة key/value يمكن أن تكون قيمة هذه الخاصية عبارة عن دالة، وفي هذه الحالة يمكن ان تسمى بالوظيفة « method ». بالإضافة إلى الكائنات الأصلية التي توفرها بيئة المتصفحات، يمكنك انشاء كائنات خاصة بك. يصف هذا الفصل كيفية استخدام الكائنات، والخصائص والدوال او الوظائف، وايضا كيفية إنشاء الكائنات الخاصة بك.

- -

نظرة عامة حول الكائنات

- -
-

الكائنات في جافا سكريبت: كما هو الحال في العديد من لغات البرمجة الأخرى، يمكن مقارنة الكائنات بالحياة الحقيقية. ويمكن تشبيه مفهوم الكائنات في جافا سكريبت بالأشياء الملموسة في واقع الحياة.

- -

في الجافاسكريبت، الكائن هو كيان مستقل بخصائصه وانواعه، يمكن مقارنته بكوب، على سبيل المثال.الكوب هو كائن له خصائصه، الكوب له لون، له شكل، له وزن، صنع بمواد معينة، واشياء اخرى. بنفس الطريقة، كائنات الجافا سكريبت لها ايضا خصائصها التي تميزها.

- -

الكائنات والخصائص

- -

كائنات الجافاسكريبت لها خصائص مرتبطة بها. يمكن تشبيه خاصية الكائن بمتغير مرتبط به. خصائص الكائن هي في الأساس نفس متغيرات جافا سكريبت العادية. خصائص الكائن تحدد مميزات الكائن، يمكنك الوصول إلى خصائص الكائن من خلال نقطة التدوين :

- -
objectName.propertyName
-
- -

ككل متغيرات جافاسكريبت،  اسم الكائن واسم الخاصية حساسة تجاه الاحرف (case sensitive). يمكنك تعيين خاصية ومنحها قيمة اولية. على سبيل المثال، لنقم بانشاء كائن باسم myCar وتعين خصائص له بالاسماء التالية : make, model و year كما في المثال التالي :

- -
var myCar = new Object();
-myCar.make = 'Ford';
-myCar.model = 'Mustang';
-myCar.year = 1969;
-
- -

خصائص الكائن الغير معرفة هي {{jsxref("undefined")}} (وليست {{jsxref("null")}}).

- -
myCar.color; // undefined
- -

يمكن الوصول الى خصائص الكائنات عن طريق الاقواس المربعة بدلا من نقطة التدوين، في بعض الاحيان يكون من الضروري استخدام الاقواس المربعة للوصول الى خصائص الكائن (لمزيد من المعلومات شاهد property accessors).  في بعض الاحيان تسمى الكائننات بمصفوفات مترابطة (associative arrays)، نظرا للشبه الكبير بينهما، حيث يمكن استخدام اسم الخاصية للوصول إلى قيمتها، الامر الذي تعتمده ايضا المصفوفات الترابطية. على سبيل المثال  يمكن الوصول إلى خصائص الكائن myCar على النحو التالي:

- -
myCar['make'] = 'Ford';
-myCar['model'] = 'Mustang';
-myCar['year'] = 1969;
-
- -

اسم خاصية الكائن يمكن ان يكون اي نوع من انواع النصوص الصحيحة لجافاسكريبت او اي شئ يمكن تحويله الى سلسلة نصية، بما في ذالك النص الفارغ، والنصوص التي تحتوي على رموز او اسماء محجوزة لجافاسكريبت والغير مسموح بها كمعرفات سواء بالنسبة لخصائص الكائن او للمتغيرات العادية على سبيل المثال، اسم خاصية يحتوي على مسافة او اسمين موصولين بواصلة (-) او الاسم الذي يبتدئ برقم. كل هذه الاشياء يمكن الوصول اليها عن طريق الاقواس المربعة فقط. هذه الاقواس فعالة جدا خصوصا مع اسماء الخصائص التي يتم تعينها بشكل ديناميكي (عندما لا يتم تحديد اسم الخاصية الا عند وقت التشغيل ). انظر الامثلة ادناه :

- -
// four variables are created and assigned in a single go,
-// separated by commas
-var myObj = new Object(),
-    str = 'myString',
-    rand = Math.random(),
-    obj = new Object();
-
-myObj.type              = 'Dot syntax';
-myObj['date created']   = 'String with space';
-myObj[str]              = 'String value';
-myObj[rand]             = 'Random Number';
-myObj[obj]              = 'Object';
-myObj['']               = 'Even an empty string';
-
-console.log(myObj);
-
- -

يرجى ملاحظة أن كافة المفاتيح في الاقواس المربعة تم تحويلها إلى سلسلة نصية (string type)، لان الكائنات في جافاسكريبت تتطلب بان يكون نوع المفتاح سلسلة نصية فقط، على سبيل المثال، في المثال اعلاه، عندما تم اضافة المفتاح rand الى ال myObj، الجافاسكريبت استدعت الوظيفة ()obj.toString بشكل اوتوماتيكي، واستخدمت ناتج السلسلة النصية كمفتاح جديد.  
- مع العلم ان ("typeof rand === "number ).

- -

يمكنك أيضا الوصول إلى الخصائص باستخدام قيمة نصية تم تخزينها في متغير :

- -
var propertyName = 'make';
-myCar[propertyName] = 'Ford';
-
-propertyName = 'model';
-myCar[propertyName] = 'Mustang';
-
- -

يمكنك استخدام for...in لعمل تكرار على خصائص الكائن القابلة للتصفح ( لمزيد من المعلومات حول enumerable properties ). لتوضيح ما نعنيه : تقوم الدالة التالية باظهار خصائص الكائن، عندما سيمرر لها الكائن واسم الكائن كبارامترات :

- -
function showProps(obj, objName) {
-  var result = '';
-  for (var i in obj) {
-    // obj.hasOwnProperty() is used to filter out properties from the object's prototype chain
-    if (obj.hasOwnProperty(i)) {
-      result += objName + '.' + i + ' = ' + obj[i] + '\n';
-    }
-  }
-  return result;
-}
-
- -

وهكذا، باستدعاء الدالة على هذا النحو showProps(myCar, "myCar") سينتج عنها النتائج التالية :

- -
myCar.make = Ford
-myCar.model = Mustang
-myCar.year = 1969
- -

تصفح خصائص الكائن

- -

ابتداءا من ECMAScript 5، هناك ثلاثة طرق لتصفح/المرور على خصائص الكائن :

- -
    -
  • for...in loops
    - هذه الوظيفة تمر على جميع خصائص الكائن القابلة للتصفح  و ال prototype chain.
  • -
  • {{jsxref("Object.keys", "Object.keys(o)")}}
    - تعود هذه الوظيفة بمصفوفة بجميع اسماء مفاتيح الخصائص القابلة للتصفح في الكائن o، باستثناء الموجودة في ال prototype chain.
  • -
  • {{jsxref("Object.getOwnPropertyNames", "Object.getOwnPropertyNames(o)")}}
    - تعود هذه الوظيفة بمصفوفة بجميع اسماء الخصائص الموجودة في الكائن o، سواء القابلة للتصفح ام لا.
  • -
- -

قبل ECMAScript 5، لم يكن هناك أية طريقة لتصفح كافة خصائص الكائن. الا انه، يمكن تحقيق ذلك باستخدام الدالة التالية:

- -
function listAllProperties(o) {
-	var objectToInspect;
-	var result = [];
-
-	for(objectToInspect = o; objectToInspect !== null; objectToInspect = Object.getPrototypeOf(objectToInspect)) {
-      result = result.concat(Object.getOwnPropertyNames(objectToInspect));
-	}
-
-	return result;
-}
-
- -

يمكن لهذه  الدالةان تكون مفيدة في الكشف عن الخصائص "المخفية" (الخصائص الموجودة في ال prototype chain والتي لا يمكن الوصول إليها من خلال الكائن، بسبب وجود خاصية اخرى لها نفس الاسم في ال prototype chain. لجدولة الخصائص الظاهرة فقط، عليك إزالة التكرار في المصفوفة.

- -

إنشاء كائنات جديدة

- -

جافا سكريبت لديها العديد من الكائنات المحددة مسبقاً. وبالإضافة إلى ذلك، يمكنك إنشاء كائنات خاصة بك. يمكنك إنشاء كائن باستخدام مهيئ الكائن (من المهم مراجعة هذا الموضوع حتي يمكنك فهم هذه الجزئية. كما انصح وبشدة مراجعة الفصل الخاص ب اساسيات الكائن في جافاسكريبت ).

- -

كما يمكنك ايضا انشاء كائن بواسطة منشئ الوظيفة ( constructor function ) ومن ثم انشاء مثيل/نسخة له، من خلال الكلمة المحجوزة new.

- -

استخدام object initializers

- -

بالإضافة إلى إنشاء كائنات باستخدام constructor function، يمكنك إنشاء كائنات باستخدام مهيئ الكائن. هذا النوع من الكائنات  يشار إليه في بعض الأحيان ب object literal notation . وهو يتسق مع المصطلحات المستخدمة من قبل ++C.

- -

التعبير عن كائن باستخدام object initializers:

- -
var obj = { property_1:   value_1,   // property_# may be an identifier...
-            2:            value_2,   // or a number...
-            // ...,
-            'property n': value_n }; // or a string
-
- -

حيث ان obj هو اسم الكائن الجديد، وكل property_i هو معرف الخاصية، يمكن ان يكون (اما اسما أو رقما أو سلسلة نصية)،في حين ان كل value_i هي تعليمة برمجية سيتم تعيينها كقيمه إلى الخاصية property_i يمكن (تعينها مباشرة او عن طريق اسنادها الى متغير خارجي).

- -

تعريف ال obj هو اختياري، اذا لم تكن تريد الرجوع الى هذا الكائن فى اماكن اخرى، فلا حاجة لتعريفه إلى متغير. لاحظ انك ستحتاج الى احاطة object literal بين قوسين. حتى يعمل بشكل سليم. مثال:

- -
var value_1 = 600,
-value_2 = 400;
-({
-    property_1: value_1,
-    2: value_2,
-    "property n": "Measurement",
-    init: function(){
-        console.log( this["property n"] +": "+ this.property_1 + "x" + this[2]);
-    }
-}).init(); // Measurement: 600x400
-
-
- -

مهيئات الكائن، هي تعليمات برمجية، وكل مهئ سيخلق كائن جديد في التعليمة البرمجية التي سيتم تنفيذها. مهيآت الكائنات المتطابقة تنشئ كائنات مميزة والتي لا يمكن مقارنتها ببعضها البعض. يتم إنشاء الكائنات بنفس طريقة انشاء كائن جديد ()new Object، الكائنات المنشاة من خلال ال object literal هي مثيلات الكائن Object.

- -

تقوم التعليمة البرمجية التالية، بانشاء كائن وتعيينه للمتغير x في حالة ما اذا كان الشرط صحيح:

- -
if (cond) var x = {greeting: 'hi there'};
-
- -

ينشئ المثال التالي، الكائن myHonda مع ثلاث خصائص. لاحظ أن الخاصية engine هي أيضا كائن له خصائصه.

- -
var myHonda = {color: 'red', wheels: 4, engine: {cylinders: 4, size: 2.2}};
-
- -

يمكنك أيضا استخدام مهيئات الكائن لإنشاء المصفوفات. شاهد array literals.

- -

استخدام ال constructor function

- -

كبديل، يمكنك إنشاء كائن مع هاتين الخطوتين:

- -
    -
  1. تعريف نوع الكائن بانشاء constructor function. هناك عرف متفق عليه، وهو كتابة الحرف الاول من اسم الكائن بحروف كبيرة Capital.  بهدف تمييزه عن باقي الاسماء.
  2. -
  3. انشاء مثيل/نسخة للكائن بواسطة الكلمة المحجوزة new.
  4. -
- -

لتحديد نوع الكائن، سنقوم بإنشاء دالة لتحديد اسم لهذا الكائن وخصائصه، ووظائفه، على سبيل المثال، فرضا انك تريد انشاء كائن للسيارات. سيتوجب عليك تسميته ب Car، وايضا يجب ان يمتلك خصائص مثل  make، model, و year.   للقيام بذلك، سيتوجب عليك انشاء الدالة التالية:

- -
function Car(make, model, year) {
-  this.make = make;
-  this.model = model;
-  this.year = year;
-}
-
- -

لاحظ اننا استخدمنا this لتعيين قيم لخصائص الكائن استناداً إلى القيم التي سيتم تمريرها إلى بارامترات الدالة.

- -

الآن يمكنك إنشاء كائن باسم mycar على النحو التالي:

- -
var mycar = new Car('Eagle', 'Talon TSi', 1993);
-
- -

تقوم هذه التعليمة البرمجية بانشاء mycar، واسناد القيم المحددة لخصائصه. وبالتالي قيمة  mycar.make هي قيمة نصية "Eagle"، و mycar.year قيمة رقمية 1993، وهلم جرا.

- -

يمكنك إنشاء اي عدد من الكائنات من النوع Car واستدعاؤها عن طريق الكلمة المحجوزة new. مثال:

- -
var kenscar = new Car('Nissan', '300ZX', 1992);
-var vpgscar = new Car('Mazda', 'Miata', 1990);
-
- -

يمكن للكائن ان يحتوي على خاصية تكون هي نفسها كائن اخر، على سبيل المثال، فرضا انك تريد انشاء كائن تحت الاسم person كما يلي:

- -
function Person(name, age, sex) {
-  this.name = name;
-  this.age = age;
-  this.sex = sex;
-}
-
- -

ومن ثم إنشاء مثيلين/نسختين للكائن person كما يلي:

- -
var rand = new Person('Rand McKinnon', 33, 'M');
-var ken = new Person('Ken Jones', 39, 'M');
-
- -

ثم، يمكنك إعادة تعريف ال Car لتضمين الخاصية owner التي ستمتلك الكائن person كما يلي:

- -
function Car(make, model, year, owner) {
-  this.make = make;
-  this.model = model;
-  this.year = year;
-  this.owner = owner;
-}
-
- -

بعد ذلك يمكنك إنشاء مثيلات/نسخ للكائنات الجديدة، باستخدام ما يلي:

- -
var car1 = new Car('Eagle', 'Talon TSi', 1993, rand);
-var car2 = new Car('Nissan', '300ZX', 1992, ken);
-
- -

لاحظ أنه بدلاً من تمرير سلسلة نصية أو قيمة رقمية عند إنشاء الكائنات الجديدة، في البيانات الواردة أعلاه تم تمرير الكائنان rand و ken كبرامترات خاصة بال owner. إذا كنت ترغب في معرفة الاسم الخاص ب car2، يمكنك الوصول إلى الخاصية بالطريقة التالية:

- -
car2.owner.name
-
- -

يمكنك  إضافة خاصية جديدة لكائن منشأ مسبقاً. على سبيل المثال، كما في التعليمة البرمجية التالية:

- -
car1.color = 'black';
-
- -

قمنا باضافة الخاصية color لل car1، وقمنا بتعيين القيمة "black." لها، ومع ذالك فهذا لن يجعلها متاحة لجميع الكائنات من النوع Car. لإضافة خاصية جديدة لكافة الكائنات من نفس النوع Car، يتوجب عليك اضافة هذه الخاصية لل constructor. الخاص بالكائن Car.

- -

استخدام الوظيفة Object.create

- -

يمكن أيضا إنشاء كائنات باستخدام الوظيفة {{jsxref("()Object.create")}} هذه الوظيفة يمكن أن تكون مفيدة للغاية، لأنها تتيح لك أن تختار ال prototype object للكائن الذي تريد إنشاء، دون الحاجة إلى تعريف ال constructor function (بواسطة new).

- -
// Animal properties and method encapsulation
-var Animal = {
-  type: 'Invertebrates', // Default value of properties
-  displayType: function() {  // Method which will display type of Animal
-    console.log(this.type);
-  }
-};
-
-// Create new animal type called animal1
-var animal1 = Object.create(Animal);
-animal1.displayType(); // Output:Invertebrates
-
-// Create new animal type called Fishes
-var fish = Object.create(Animal);
-fish.type = 'Fishes';
-fish.displayType(); // Output:Fishes
- -

الوراثة

- -

في جافا سكريبت جميع الكائنات ترث من كائن واحد على الأقل. الكائن الذي ترث منه يسمى prototype، والخصائص الموروثة يمكن العثور عليها في ال prototype object لل constructor. شاهد Inheritance and the prototype chain  لمزيد من المعلومات.

- -

فهرسة خصائص الكائن

- -

يمكنك الاشارة/الوصول إلى خاصية الكائن إما عن طريق الاسم الخاص بها أو عن طريق المؤشر الترتيبي لها (index). إذا قمت في البداية بتعريف خاصية باسمها، سيتوجب عليك دائما الاشارة اليها باسمها، وكذالك اذا قمت في البداية بتعريف خاصية بمؤشرها الترتيبي، ايضا سيتوجب عليك الاشارة اليها بمؤشرها الترتيبي.

- -

ينطبق هذا الشرط عند إنشاء الكائن وخصائصه داخل ال constructor (كما فعلنا سابقا مع  الكائن من النوع Car) وكذالك عند تحديد خصائص فردية بشكل واضح (على سبيل المثال، "myCar.color = "red). اذا قمت في البداية بتعريف خاصية بمؤشرها الترتيبي، مثل "myCar[5] = "25 mpg، وتريد بعد ذالك الوصول اليها سيتوجب عليك استخدام المؤشر الترتيبي على هذا النحو  myCar[5].

- -

والاستثناء لهذه القاعدة هي كائنات ال HTML، مثل forms array. يمكنك الاشارة دائما إلى الكائنات في هذه المصفوفات إما عن طريق مؤشرهم الترتيبي (حسب وجودها في الوثيقة) او عن طريق اسمائها (إذا كانت معرفة). فمثلا، اذا كان الوسم الثاني <FORM> في الوثيقة له السمة (attribute ) باسم "myForm"، يمكنك الاشارة الى هذا الفورم ب document.forms[1] او ب document.forms["myForm"] او ب document.forms.myForm.

- -

التحكم في خصائص الكائن

- -

يمكنك إضافة خاصية إلى كائن محدد سابقا باستخدام الخاصية prototype. هذا النمط سيجعل هذه الخاصية متاحة لكافة الكائنات من النوع المحدد، بدلاً من تحديدها لمثيل واحد فقط. التعليمة البرمجية التالية تضيف الخاصية color الى جميع الكائنات من نوع Car، وبعد ذالك تقوم بتعيين القيمة الجديدة للخاصية color الخاصة بالكائن car1.

- -
Car.prototype.color = null;
-car1.color = 'black';
-
- -

شاهد  prototype property  لل Function object وايضا JavaScript reference لمزيد من المعلومات.

- -

تعريف الوظائف

- -

الوظيفة هي دالة مرتبطة مع الكائن، أو، ببساطة،  هي خاصية في الكائن قيمتها دالة، يتم تعريف الوظيفة بنفس الطريقة التي يتم بها تعريف الدالة العادية، باستثناء ان هذه الاخيرة يجب أن يتم تعيينها كخاصية لكائن. شاهد ايضا method definitions لمزيد من المعلومات، وكمثال على ما تم ذكره:

- -
objectName.methodname = function_name;
-
-var myObj = {
-  myMethod: function(params) {
-    // ...do something
-  }
-
-  // OR THIS WORKS TOO
-
-  myOtherMethod(params) {
-    // ...do something else
-  }
-};
-
- -

حيث ان ال objectName كائن موجود، وال methodname هو الاسم المعين إلى الوظيفة، و function_name هو اسم الدالة.

- -

ثم يمكنك استدعاء الوظيفة في سياق الكائن كما يلي:

- -
object.methodname(params);
-
- -

يمكنك تعريف وظائف الكائن باستدعاء وظيفة معرفة في constructor الكائن. على سبيل المثال، يمكنك القيام بتعريف الدالة التي من شأنها تهيئة وعرض خصائص الكائن Car المعرف مسبقا، على سبيل المثال:

- -
function displayCar() {
-  var result = 'A Beautiful ' + this.year + ' ' + this.make
-    + ' ' + this.model;
-  pretty_print(result);
-}
-
- -

يمكنك استخدام الدالة pretty_print لاظهار الناتج على شكل نص افقي، تذكر ايضا على ان الكلمة المحجوزة this ستشير الى السياق الذي تنتمي اليه الدالة نفسها وفي هذه الحالة هو ال constructur Car

- -

 يمكننا بعد ذالك تعيين هذه الدالة كوظيفة في ال constructeur Car على النحو التالي:

- -
this.displayCar = displayCar;
-
- -

التعليمة البرمجية النهائية:

- -
function Car(make, model, year, owner) {
-  this.make = make;
-  this.model = model;
-  this.year = year;
-  this.owner = owner;
-  this.displayCar = displayCar;
-}
-
- -

الان يمكنك استدعاء الوظيفة displayCar لكلا الكائنين على النحو التالي:

- -
car1.displayCar();
-car2.displayCar();
-
- -

استخدام this كمرجع للكائنات

- -

جافاسكريبت لديها الكلمة المحجوزة لها this، يمكنك استخدامها مع الوظائف للرجوع/الاشارة إلى الكائن الحالي. على سبيل المثال، لنفترض ان لديك دالة تسمى validate تقوم بالتحقق من صحة المدخلات:

- -
function validate(obj, lowval, hival) {
-  if ((obj.value < lowval) || (obj.value > hival)) {
-    alert('Invalid Value!');
-  }
-}
-
- -

يمكن استدعاء هذه الدالة  عن طريق معالج الحدث onchange، وستشير الكلمة المحجوزة this الى العنصر المتواجدة به (تنفيذ الدالة على هذا العنصر). كما في المثال التالي:

- -
<input type="text" name="age" size="3"
-  onChange="validate(this, 18, 99)">
-
- -

بشكل عام this تشير الى الكائن الذي يطلب الوظيفة.

- -

يمكن ايضا استخدام this مع معالج الحدث بشكل مباشر، كما في المثال التالي:

- -
<form name="myForm">
-<p><label>Form name:<input type="text" name="text1" value="Beluga"></label>
-<p><input name="button1" type="button" value="Show Form Name"
-     onclick="this.form.text1.value = this.form.name">
-</p>
-</form>
- -

Defining getters and setters

- -

 getter هي الوظيفة التي تقوم بجلب قيمة خاصية معينة. setter هي الوظيفة التي تقوم بتعيين قيمة لخاصية معينة. يمكنك تعيينها سواء للكائنات الاساسية المعرفة مسبقا أو الى الكائنات المعرف من قبل المستخدم والتي تدعم إضافة خصائص جديدة. وتستخدم مع ال object literal.

- -

يبين المثال التالي كيفية انشاء getters و setters من طرف المستخدم :

- -
var o = {
-  a: 7,
-  get b() {
-    return this.a + 1;
-  },
-  set c(x) {
-    this.a = x / 2;
-  }
-};
-
-console.log(o.a); // 7
-console.log(o.b); // 8
-o.c = 50;
-console.log(o.a); // 25
-
- -

خصائص الكائن هي :

- -
    -
  • o.a — a number
  • -
  • o.b — a getter سيعود ب o.a زائد 1
  • -
  • o.c — a setter سيقوم بتعيين القيمة o.a بنصف القيمة الاتية من o.c
  • -
- -

يمكنك استخدام  getters و setters مع الوظائف المنشاة مسبقا، لتحقيق ذالك يمكننا استخدام الوظيفة Object.defineProperty او الوظيفة القديمة Object.prototype.__defineGetter__

- -

يبين الكود التالي كيف ان  getters و setters بامكانها ان ترث ال  {{jsxref("Date")}} prototype لاضافة الخاصية year الى جميع ال instances الخاص بالكائن Date المنشا مسبقا، ولهذا سنقوم باستخدام بعض الوظائف الخاصة ب Date ك getFullYear و setFullYear :

- -
var d = Date.prototype;
-Object.defineProperty(d, 'year', {
-  get: function() { return this.getFullYear(); },
-  set: function(y) { this.setFullYear(y); }
-});
-
- -

تبين التعليمة البرمجية التالية كيفية استخدام الخاصية year الجديدة التي تم انشاؤها عن طريق getters و setters:

- -
var now = new Date();
-console.log(now.year); // 2000
-now.year = 2001; // 987617605170
-console.log(now);
-// Wed Apr 18 11:13:25 GMT-0700 (Pacific Daylight Time) 2001
-
- -

بصفة عامة،  getters و setters يمكن ان تكون:

- -
    -
  • معرفة باستخدام object initializers,  او
  • -
  • ان تضاف في وقت لاحق إلى أي كائن في أي وقت باستخدام   getters او setters.
  • -
- -

عندما سنقوم بانشاء getters و setters باستخدام ال استخدام object initializers كل ما عليك القيام به هو البذء بانشاء الوظيفة getter اولا ومن تم تعريفها ب get وتليها الوظيفة setter وتعريفها ب set، وبالطبع، الوظيفة getter لا تحتاج الى اي باراميتر، فيما ستحتاج الوظيفة setter لبراميتر واحد وهو القيمة الجديدة ل set. فعلى سبيل المثال:

- -
var o = {
-  a: 7,
-  get b() { return this.a + 1; },
-  set c(x) { this.a = x / 2; }
-};
-
- -

getters او setters. يمكن أيضا أن تضاف إلى كائن ما في أي وقت بعد انشائه باستخدام الوظيفة Object.defineProperties، البراميتر الأول لهذه الوظيفة هو الكائن الذي تريد انشاء ال getter او setter له. البراميتر الثاني عبارة عن كائن يمثل الخصائص التي ستضاف الى الكائن الهدف ويتكون من مفتاح الخاصية، وهو اسم ال  getter او ال setter، وقيمة الخاصية، وهي عبارة عن كائن لتعريف وظائف ال  getter او ال setter. لدينا هنا نفس المثال السابق يبين بجلاء ما تحدثنا عنه:

- -
var o = { a: 0 };
-
-Object.defineProperties(o, {
-    'b': { get: function() { return this.a + 1; } },
-    'c': { set: function(x) { this.a = x / 2; } }
-});
-
-o.c = 10; // Runs the setter, which assigns 10 / 2 (5) to the 'a' property
-console.log(o.b); // Runs the getter, which yields a + 1 or 6
-
- -

اي من هذه الاساليب هي الانسب ؟
- إذا ذهبت بالفعل لمهيئ الكائن عند تعريف ال prototype فانت بحاجة الى الاسلوب الاول هذا الاسلوب محكم وبسيط. ومع ذالك، اذا كنت تنوي اضافة  getters و setters لاحقا بسبب انك لا تريد انشاء prototype او كائن معين سيكون افضل خيار هو الخيار الثاني. الخيار الثاني ربما يكون أفضل ويمثل الطابع الدينامي للجافا سكريبت، ولكن  يمكن ان يجعل الكود صعب القراءة والفهم.

- -

حذف الخصائص

- -

يمكنك حذف الخصائص الغير موروثة باستخدام الكلمة المحجوزة delete التعليمة البرمجية التالية توضح كيف يتم ذالك:

- -
// Creates a new object, myobj, with two properties, a and b.
-var myobj = new Object;
-myobj.a = 5;
-myobj.b = 12;
-
-// Removes the a property, leaving myobj with only the b property.
-delete myobj.a;
-console.log ('a' in myobj); // yields "false"
-
- -

يمكنك ايضا استخدام delete لحذف متغير عام، شرط ان لا يكون هذا المتغير معرف بواسطة الكلمة المحجوزة var.

- -
g = 17;
-delete g;
-
- -

مقارنة الكائنات

- -

في جافا سكريبت، الكائنات تعمل كمرجع. لا يمكن المساوات بين كائنين مختلفين، حتى وان كان لديهما نفس القيم لنفس الخصائص. سيكون هناك تكافؤ فقط إذا تم مقارنة كائن بحد ذاته.

- -
// Two variables, two distinct objects with the same properties
-var fruit = {name: 'apple'};
-var fruitbear = {name: 'apple'};
-
-fruit == fruitbear; // return false
-fruit === fruitbear; // return false
- -
// Two variables, a single object
-var fruit = {name: 'apple'};
-var fruitbear = fruit;  // assign fruit object reference to fruitbear
-
-// here fruit and fruitbear are pointing to same object
-fruit == fruitbear; // return true
-fruit === fruitbear; // return true
-
- -
fruit.name = 'grape';
-console.log(fruitbear);    // yields { name: "grape" } instead of { name: "apple" }
-
- -

لمزيد من المعلومات حول عوامل المقارنة، شاهد Comparison operators.

-
- -

See also

- - - -

{{PreviousNext("Web/JavaScript/Guide/Regular_Expressions", "Web/JavaScript/Guide/Details_of_the_Object_Model")}}

diff --git a/files/ar/web/javascript/index.html b/files/ar/web/javascript/index.html deleted file mode 100644 index 9c99dab71c..0000000000 --- a/files/ar/web/javascript/index.html +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: جافاسكربت -slug: Web/JavaScript -tags: - - جافاسكربت - - صفحة هبوط -translation_of: Web/JavaScript ---- -

{{JsSidebar}}

- -

جافاسكربت (JavaScript®) (إختصاراً JS) هي لغة برمجة خفيفة، مُفسرة، وشيئيّة ذات دوال من الدرجة الأولى، وهي مشهورة خصوصاً بكونها لغة البرمجة النصيّة لصفحات الويب، لكنها تستعمل في بيئات أخرى غير المتصفحات مثل node.js أو Apache CouchDB. فهي لغة برمجة نصيّة ديناميكيّة مبنية على النماذج و متعددة النماذج، وهي تدعم نمطي البرمجة الحتمي (imperative) الوظيفي (functional). اقرأ المزيد عن جافا سكربت.

- -

يختص هذا الجزء بالجافاسكربت كلغة برمجة، بغض النظر عن مواقع الويب أو البيئات التي يمكن لهاته اللغة أن تعمل عليها.  للمزيد من المعلومات حول الواجهات البرمجيّة الخاصة بمواقع الويب،  طالع DOM و الواجهات البرمجيّة للويب.

- -

يسمى معيار الجافا سكربت ECMAScript. بدءً من عام 2012، جميع المتصفحات الحديثة تدعم بشكل كامل ECMAScript 5.1. المتصفحات القديمة تدعم على الأقل ECMAScript 3. في 17 يونيو 2015، تم نشر النسخة الرئيسيّة السادسة من ECMAScript. ويسمى هذا الإصدار رسمياً ECMAScript 2015، ولكن يشار إليه عادةً باسم ECMAScript 6 أو ES6. تشير هذه الوثائق إلى الإصدار الأحدث من اللغة، والذي هو ECMAScript 2018.

- -

لا ينبغي الخلط بين الجافاسكربت ولغة البرمجة جافا. يعد كلاً من الأسمين "جافا" و "جافاسكربت" علامات تجاريّة مُسجلة لشركة أوراكل في الولايات المتحدة الأمريكيّة وغيرها من البلدان. كلتا اللغتين تملكان بنيّة كتابيّة مختلفة، ودلالة مختلفة، وكذلك استخدامات مختلفة.

- -
-
-

دورات

- -

تعلم البرمجة باستخدام الجافاسكربت من خلال الدورات والدروس الإرشاديّة التالية.

- -

للمبتدئين

- -

اطلع على قسم مواضيع تعلم الجافاسكربت إذا كنت ترغب بتعلم الجافاسكربت ولكنك لا تملك أي معرفة مسبقة بهاته اللغة أو بالبرمجة ككل. الوحدات المتوفرة هي:

- -
-
الخطوات الأولى مع الجافاسكربت
-
تجيب هذه المقالة عن بعض الأسئلة الأساسيّة، مثل "ما هي الجافاسكربت؟"، "كيف تبدو هذه اللغة؟"، "ماذا بإمكانها أن تفعل؟"، بالإضافة إلى مناقشة بعض الميزات الأساسيّة للغة مثل المتغيّرات، السلاسل النصية، الأرقام، والمصفوفات.
-
البنى الكتليّة في اللغة
-
نكمل رحلتنا في تغطيّة المفاهيم الأساسية في لغة الجافاسكربت، ففي هذه المقالة قمنا بالتركيز على البنى الكتليّة الشائعة في اللغة مثل الجمل الشرطيّة، الحلقات، الدوال، والأحداث.
-
- -

دليل لغة جافا سكربت

- -
-
دليل اللغة
-
دليل أكثر تفصيلاً حول لغة الجافاسكربت، فهو موجه للذين يمتلكون معرفة مسبقة، سواءً بلغة الجافا سكربت، أو بلغات البرمجة الأخرى.
-
- -

مقالات لذوي الخبرة المتوسطة

- -
-
مقدمة إلى الكائنات
-
من المهم فهم البرمجة الشيئيّة في اللغة إذا أردت زيادة معرفتك والتمكن من كتابة شيفرة برمجيّة أكثر فعاليّة، من أجل ذلك قمنا بتوفير هذه الوحدة لك.
-
واجهات التصميم (جهة العميل) البرمجيّة
-
لن تستطيع العمل جيداً عند تطوير جهة المستخدم (client-side) باستخدام الجافاسكربت من دون تعلمك للواجهات البرمجيّة المتخصصة، فهي واجهات للتلاعب بأجزاء مختلفة من المُتصفِح ونظام التشغيل الذي يعمل عليه الموقع، أو حتى التلاعب بحقول بيانات مواقع أو خدمات أخرى. في هذه الوحدة سنستكشف ماهيّة هذه الواجهات، وكيف تستخدم بعض من أكثر تلك الواجهات شيوعاً والتي ستحتاجها غالباً في عملك.
-
- -
-
نظرة عامة على الجافاسكربت
-
مقالة تقدم نظرة عامة للذين يظنون أنهم يعرفون الجافاسكربت.
-
- -
-
هياكل بيانات الجافاسكربت
-
نظرة عامة على هياكل البيانات المتوفرة في اللغة.
-
عبارات المساواة والتطابق
-
توفر الجافاسكربت ثلاثة عمليات مساواة مختلفة: المساواة الصارمة باستخدام === والمساواة المتساهلة باستخدام == والدالة  {{jsxref("Global_Objects/Object/is", "Object.is()")}}.
-
- -

مقالات متقدمة

- -
-
الميراث وسلسلة النموذج الأولي
-
شرح الميراث القائم على النموذج الأولي الذي يساء فهمه على نطاق واسع.
-
الوضع الصارم
-
في الوضع الصارم (strict mode)، لا يمكنك استخدام أي متغيّر قبل تعريفه. فيعد الوضع الصارم البديل المحدود لـ ECMAScript 5، لأداء أسرع وأكثر سهولة في التنقيح.
-
مصفوفات الجافاسكربت المكتوبة
-
-
-
-
توفر مصفوفات الجافاسكربت المكتوبة (typed arrays) آلية للوصول إلى البيانات الثنائيّة.
-
-
-
-
إدارة الذاكرة
-
دورة حياة الذاكرة وجمع القمامة (garbage collection) في لغة الجافاسكربت.
-
نموذج التزامن وحلقة الحدث
-
تمتلك لغة الجافاسكربت نموذج تزامن قائم على مفهوم "حلقة الحدث (event loop)".
-
-
- -
-

مرجع اللغة

- -

تصفح مرجع لغة الجافاسكربت الشامل.

- -
-
الكائنات القياسيّة
-
تعرف على الكائنات القياسيّة المبنيّة في اللغة {{jsxref("Array")}}، {{jsxref("Boolean")}}، {{jsxref("Date")}}، {{jsxref("Error")}}، {{jsxref("Function")}}، {{jsxref("JSON")}}، {{jsxref("Math")}}، {{jsxref("Number")}}، {{jsxref("Object")}}، {{jsxref("RegExp")}}، {{jsxref("String")}}، {{jsxref("Map")}}، {{jsxref("Set")}}، {{jsxref("WeakMap")}}، {{jsxref("WeakSet")}}، وغيرها الكثير.
-
التعابير والعمليات
-
تعلم المزيد حول وظيفة العمليات (operators) في الجافاسكربت {{jsxref("Operators/instanceof", "instanceof")}}، {{jsxref("Operators/typeof", "typeof")}}، {{jsxref("Operators/new", "new")}}, {{jsxref("Operators/this", "this")}}، وغيرها الكثير.
-
الدوال
-
تعلم كيفيّة العمل مع الدوال في لغة الجافاسكربت لتطوير برمجياتك.
-
- -

أدوات ومراجع

- -

أدوات مفيدة لكتابة وتنقيح شيفرات الجافاسكربت.

- -
-
أدوات مطورين فايرفوكس
-
أداة Scratchpad ،Web Console ،JavaScript Profiler ،Debugger، وغيرها الكثير.
-
صدفات الجافاسكربت
-
تسمح لك هذه الصدفات (shells) بالتجريب السريع لشيفرات الجافاسكربت.
-
أداة TogetherJS
-
التعاون يجعل الأمر سهلاً. بإضافة هذه الأداة لموقعك، سيتمكن المستخدمون من مساعدة بعضهم البعض على موقعك بشكل حي!
-
موقع Stack Overflow
-
الأسئلة الموسومة بالوسم "JavaScript" الموجودة على موقع Stack Overflow.
-
ملاحظات إصدار الجافاسكربت
-
تصفح سجل ميزات الجافاسكربت وحالة التقدم في التطوير.
-
أداة JSFiddle
-
قم بتعديل شيفرات الجافاسكربت، ولغة ترميز النص الفائق، وصفحات الأنماط الانسيابية واحصل على النتائج بشكل حي. استخدم موارد خارجيّة وتعاون مع أفراد فريقك على الأنترنت.
-
أداة Plunker
-
مجتمع على الإنترنت لإنشاء، والتعاون، ومشاركة أفكار تطوير الويب. قم بتعديل ملفات الجافاسكربت وغيرها من الملفات واحصل على النتائج بشكل حي.
-
-
-
diff --git a/files/ar/web/javascript/reference/classes/constructor/index.html b/files/ar/web/javascript/reference/classes/constructor/index.html deleted file mode 100644 index 135948c80b..0000000000 --- a/files/ar/web/javascript/reference/classes/constructor/index.html +++ /dev/null @@ -1,132 +0,0 @@ ---- -title: المنشئ (constructor) -slug: Web/JavaScript/Reference/Classes/constructor -tags: - - جافاسكريبت -translation_of: Web/JavaScript/Reference/Classes/constructor ---- -
{{jsSidebar("Classes")}}
- -

الـ constructor  هي ميثود خاصة لإنشاء وتهيئة الاوبجكت(كائن) داخل (فئة)class.

- -
{{EmbedInteractiveExample("pages/js/classes-constructor.html")}}
- - - -

بناء الجملة

- -
constructor([arguments]) { ... }
- -

الوصف

- -

يمكننا إستخدام تلك الميثود لمرة واحده فقط ، وفي حال إستخدمنا constructor ﻷكثر من مرة في نفس الفئة الـ class سيحدث {{jsxref("SyntaxError")}} إيرور .

- -

A constructor can use the super keyword to call the constructor of a parent class.

- -

إذا لم تحدد ميثود إنشاء سيتم تحديد منشئ بشكل تلقائي.

- -


- If you do not specify a constructor method, a default constructor is used.

- -

أمثلة

- -

إٍستخدام الميثود (اسلوب) الـconstructor

- -

ذلك الكود تم أخذه ولصقة من classes sample (live demo)

- -
class Square extends Polygon {
-  constructor(length) {
-    // Here, it calls the parent class' constructor with lengths
-    // provided for the Polygon's width and height
-    super(length, length);
-    // Note: In derived classes, super() must be called before you
-    // can use 'this'. Leaving this out will cause a reference error.
-    this.name = 'Square';
-  }
-
-  get area() {
-    return this.height * this.width;
-  }
-
-  set area(value) {
-    this.area = value;
-  }
-}
- -

مثال آخر

- -

إنظر إلى ذلك الكود

- -
class Polygon {
-    constructor() {
-        this.name = "Polygon";
-    }
-}
-
-class Square extends Polygon {
-    constructor() {
-        super();
-    }
-}
-
-class Rectangle {}
-
-Object.setPrototypeOf(Square.prototype, Rectangle.prototype);
-
-console.log(Object.getPrototypeOf(Square.prototype) === Polygon.prototype); //false
-console.log(Object.getPrototypeOf(Square.prototype) === Rectangle.prototype); //true
-
-let newInstance = new Square();
-console.log(newInstance.name); //Polygon
- -

هنا البروتوتيب فئة الـ Square تغيرت ولكن الكونستركتور (المنشئ) مبني على فئة الـPolygon والتي تطلب عندما نقوم بإنشاء حالة مماثلة للـ Square مرة أخرى

- -

الإنشاء الإفتراضي

- -

ذكرنا سابقا أنه في حال عدم تحديدك لكونستركتور (منشئ) سيتم تحديد الكونستركتور بشكل إفتراضي ، وبالنسبة للكلاسز (الفئات) الاولية يكون الكونستركتور الخاص بها كما يلي :-

- -
constructor() {}
-
- -

أما الفئات المشتقة فتكون بالشكل التالي

- -
constructor(...args) {
-  super(...args);
-}
- -

Specifications

- - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES2015', '#sec-static-semantics-constructormethod', 'Constructor Method')}}{{Spec2('ES2015')}}Initial definition.
{{SpecName('ESDraft', '#sec-static-semantics-constructormethod', 'Constructor Method')}}{{Spec2('ESDraft')}} 
- -

دعم المتصفحات

- - - -

{{Compat("javascript.classes.constructor")}}

- -

أنظر أيضا

- - diff --git a/files/ar/web/javascript/reference/classes/index.html b/files/ar/web/javascript/reference/classes/index.html deleted file mode 100644 index d6f0143148..0000000000 --- a/files/ar/web/javascript/reference/classes/index.html +++ /dev/null @@ -1,380 +0,0 @@ ---- -title: Classes -slug: Web/JavaScript/Reference/Classes -tags: - - Classes - - Constructors - - ECMAScript 2015 - - Inheritance - - Intermediate - - JavaScript - - NeedsTranslation - - TopicStub -translation_of: Web/JavaScript/Reference/Classes ---- -
{{JsSidebar("Classes")}}
- -

JavaScript classes, introduced in ECMAScript 2015, are primarily syntactical sugar over JavaScript's existing prototype-based inheritance. The class syntax does not introduce a new object-oriented inheritance model to JavaScript.

- -

Defining classes

- -

Classes are in fact "special functions", and just as you can define function expressions and function declarations, the class syntax has two components: class expressions and class declarations.

- -

Class declarations

- -

One way to define a class is using a class declaration. To declare a class, you use the class keyword with the name of the class ("Rectangle" here).

- -
class Rectangle {
-  constructor(height, width) {
-    this.height = height;
-    this.width = width;
-  }
-}
- -

Hoisting

- -

An important difference between function declarations and class declarations is that function declarations are {{Glossary("Hoisting", "hoisted")}} and class declarations are not. You first need to declare your class and then access it, otherwise code like the following will throw a {{jsxref("ReferenceError")}}:

- -
var p = new Rectangle(); // ReferenceError
-
-class Rectangle {}
-
- -

Class expressions

- -

A class expression is another way to define a class. Class expressions can be named or unnamed. The name given to a named class expression is local to the class's body. (it can be retrieved through the class's (not an instance's) .name property, though)

- -
// unnamed
-var Rectangle = class {
-  constructor(height, width) {
-    this.height = height;
-    this.width = width;
-  }
-};
-console.log(Rectangle.name);
-// output: "Rectangle"
-
-// named
-var Rectangle = class Rectangle2 {
-  constructor(height, width) {
-    this.height = height;
-    this.width = width;
-  }
-};
-console.log(Rectangle.name);
-// output: "Rectangle2"
-
- -

Note: Class expressions also suffer from the same hoisting issues mentioned for Class declarations.

- -

Class body and method definitions

- -

The body of a class is the part that is in curly brackets {}. This is where you define class members, such as methods or constructor.

- -

Strict mode

- -

The bodies of class declarations and class expressions are executed in strict mode i.e. constructor, static and prototype methods, getter and setter functions are executed in strict mode.

- -

Constructor

- -

The constructor method is a special method for creating and initializing an object created with a class. There can only be one special method with the name "constructor" in a class. A {{jsxref("SyntaxError")}} will be thrown if the class contains more than one occurrence of a constructor method.

- -

A constructor can use the super keyword to call the constructor of the super class.

- -

Prototype methods

- -

See also method definitions.

- -
class Rectangle {
-  constructor(height, width) {
-    this.height = height;
-    this.width = width;
-  }
-  // Getter
-  get area() {
-    return this.calcArea();
-  }
-  // Method
-  calcArea() {
-    return this.height * this.width;
-  }
-}
-
-const square = new Rectangle(10, 10);
-
-console.log(square.area); // 100
- -

Static methods

- -

The static keyword defines a static method for a class. Static methods are called without instantiating their class and cannot be called through a class instance. Static methods are often used to create utility functions for an application.

- -
class Point {
-  constructor(x, y) {
-    this.x = x;
-    this.y = y;
-  }
-
-  static distance(a, b) {
-    const dx = a.x - b.x;
-    const dy = a.y - b.y;
-
-    return Math.hypot(dx, dy);
-  }
-}
-
-const p1 = new Point(5, 5);
-const p2 = new Point(10, 10);
-
-console.log(Point.distance(p1, p2)); // 7.0710678118654755
- -

Boxing with prototype and static methods

- -

When a static or prototype method is called without a value for this, the this value will be undefined inside the method. This behavior will be the same even if the "use strict" directive isn't present, because code within the class syntax is always executed in strict mode.

- -
class Animal {
-  speak() {
-    return this;
-  }
-  static eat() {
-    return this;
-  }
-}
-
-let obj = new Animal();
-obj.speak(); // Animal {}
-let speak = obj.speak;
-speak(); // undefined
-
-Animal.eat() // class Animal
-let eat = Animal.eat;
-eat(); // undefined
- -

If the above is written using traditional function–based syntax, then autoboxing in method calls will happen in non–strict mode based on the initial this value. If the inital value is undefined, this will be set to the global object.

- -

Autoboxing will not happen in strict mode, the this value remains as passed.

- -
function Animal() { }
-
-Animal.prototype.speak = function() {
-  return this;
-}
-
-Animal.eat = function() {
-  return this;
-}
-
-let obj = new Animal();
-let speak = obj.speak;
-speak(); // global object
-
-let eat = Animal.eat;
-eat(); // global object
-
- -

Instance properties

- -

Instance properties must be defined inside of class methods:

- -
class Rectangle {
-  constructor(height, width) {
-    this.height = height;
-    this.width = width;
-  }
-}
- -

Static class-side properties and prototype data properties must be defined outside of the ClassBody declaration:

- -
Rectangle.staticWidth = 20;
-Rectangle.prototype.prototypeWidth = 25;
-
- -

 

- -

Sub classing with extends

- -

The extends keyword is used in class declarations or class expressions to create a class as a child of another class.

- -
class Animal {
-  constructor(name) {
-    this.name = name;
-  }
-
-  speak() {
-    console.log(this.name + ' makes a noise.');
-  }
-}
-
-class Dog extends Animal {
-  speak() {
-    console.log(this.name + ' barks.');
-  }
-}
-
-var d = new Dog('Mitzie');
-d.speak(); // Mitzie barks.
-
- -

If there is a constructor present in subclass, it needs to first call super() before using "this".

- -

One may also extend traditional function-based "classes":

- -
function Animal (name) {
-  this.name = name;
-}
-
-Animal.prototype.speak = function () {
-  console.log(this.name + ' makes a noise.');
-}
-
-class Dog extends Animal {
-  speak() {
-    console.log(this.name + ' barks.');
-  }
-}
-
-var d = new Dog('Mitzie');
-d.speak(); // Mitzie barks.
-
- -

Note that classes cannot extend regular (non-constructible) objects. If you want to inherit from a regular object, you can instead use {{jsxref("Object.setPrototypeOf()")}}:

- -
var Animal = {
-  speak() {
-    console.log(this.name + ' makes a noise.');
-  }
-};
-
-class Dog {
-  constructor(name) {
-    this.name = name;
-  }
-}
-
-// If you do not do this you will get a TypeError when you invoke speak
-Object.setPrototypeOf(Dog.prototype, Animal);
-
-var d = new Dog('Mitzie');
-d.speak(); // Mitzie makes a noise.
-
- -

Species

- -

You might want to return {{jsxref("Array")}} objects in your derived array class MyArray. The species pattern lets you override default constructors.

- -

For example, when using methods such as {{jsxref("Array.map", "map()")}} that returns the default constructor, you want these methods to return a parent Array object, instead of the MyArray object. The {{jsxref("Symbol.species")}} symbol lets you do this:

- -
class MyArray extends Array {
-  // Overwrite species to the parent Array constructor
-  static get [Symbol.species]() { return Array; }
-}
-
-var a = new MyArray(1,2,3);
-var mapped = a.map(x => x * x);
-
-console.log(mapped instanceof MyArray); // false
-console.log(mapped instanceof Array);   // true
-
- -

Super class calls with super

- -

The super keyword is used to call corresponding methods of super class.

- -
class Cat {
-  constructor(name) {
-    this.name = name;
-  }
-
-  speak() {
-    console.log(this.name + ' makes a noise.');
-  }
-}
-
-class Lion extends Cat {
-  speak() {
-    super.speak();
-    console.log(this.name + ' roars.');
-  }
-}
-
-var l = new Lion('Fuzzy');
-l.speak();
-// Fuzzy makes a noise.
-// Fuzzy roars.
-
-
- -

Mix-ins

- -

Abstract subclasses or mix-ins are templates for classes. An ECMAScript class can only have a single superclass, so multiple inheritance from tooling classes, for example, is not possible. The functionality must be provided by the superclass.

- -

A function with a superclass as input and a subclass extending that superclass as output can be used to implement mix-ins in ECMAScript:

- -
var calculatorMixin = Base => class extends Base {
-  calc() { }
-};
-
-var randomizerMixin = Base => class extends Base {
-  randomize() { }
-};
-
- -

A class that uses these mix-ins can then be written like this:

- -
class Foo { }
-class Bar extends calculatorMixin(randomizerMixin(Foo)) { }
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES2015', '#sec-class-definitions', 'Class definitions')}}{{Spec2('ES2015')}}Initial definition.
{{SpecName('ES2016', '#sec-class-definitions', 'Class definitions')}}{{Spec2('ES2016')}} 
{{SpecName('ES2017', '#sec-class-definitions', 'Class definitions')}}{{Spec2('ES2017')}} 
{{SpecName('ESDraft', '#sec-class-definitions', 'Class definitions')}}{{Spec2('ESDraft')}} 
- -

Browser compatibility

- - - -

{{Compat("javascript.classes")}}

- -

Running in Scratchpad

- -

A class can't be redefined. If you're playing with code in Scratchpad (Firefox menu Tools > Web Developer > Scratchpad) and you 'Run' a definition of a class with the same name twice, you'll get a confusing SyntaxError: redeclaration of let <class-name>.

- -

To re-run a definition, use Scratchpad's menu Execute > Reload and Run.
- Please vote for bug #1428672.

- -

See also

- - diff --git a/files/ar/web/javascript/reference/errors/index.html b/files/ar/web/javascript/reference/errors/index.html deleted file mode 100644 index c295fccea6..0000000000 --- a/files/ar/web/javascript/reference/errors/index.html +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: JavaScript error reference -slug: Web/JavaScript/Reference/Errors -tags: - - Debugging - - Error - - Errors - - Exception - - JavaScript - - NeedsTranslation - - TopicStub - - exceptions -translation_of: Web/JavaScript/Reference/Errors ---- -

{{jsSidebar("Errors")}}

- -

Below, you'll find a list of errors which are thrown by JavaScript. These errors can be a helpful debugging aid, but the reported problem isn't always immediately clear. The pages below will provide additional details about these errors. Each error is an object based upon the {{jsxref("Error")}} object, and has a name and a message.

- -

Errors displayed in the Web console may include a link to the corresponding page below to help you quickly comprehend the problem in your code.

- -

List of errors

- -

In this list, each page is listed by name (the type of error) and message (a more detailed human-readable error message). Together, these two properties provide a starting point toward understanding and resolving the error. For more information, follow the links below!

- -

{{ListSubPages("/en-US/docs/Web/JavaScript/Reference/Errors")}}

- -

See also

- - diff --git a/files/ar/web/javascript/reference/errors/unexpected_type/index.html b/files/ar/web/javascript/reference/errors/unexpected_type/index.html deleted file mode 100644 index 085dc8a167..0000000000 --- a/files/ar/web/javascript/reference/errors/unexpected_type/index.html +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: 'TypeError: "x" is (not) "y"' -slug: Web/JavaScript/Reference/Errors/Unexpected_type -tags: - - الأخطاء - - جافاسكربت - - نوع الخطأ -translation_of: Web/JavaScript/Reference/Errors/Unexpected_type ---- -
{{jsSidebar("Errors")}}
- -

الرسالة

- -
TypeError: Unable to get property {x} of undefined or null reference (Edge)
-TypeError: "x" is (not) "y" (Firefox)
-
-Examples:
-TypeError: "x" is undefined
-TypeError: "x" is null
-TypeError: "undefined" is not an object
-TypeError: "x" is not an object or null
-TypeError: "x" is not a symbol
-
- -

نوع الخطأ

- -

{{jsxref("TypeError")}}.

- -

 ماذا حصل؟

- -

خطأ غير متوقع، يحدث كثيرا مع {{jsxref("undefined")}} أو قيم {{jsxref("null")}} .

- -

أيضا في بعض الوضائف مثل {{jsxref("Object.create()")}} أو {{jsxref("Symbol.keyFor()")}}, تحتاج تقديد أنواع محددة.

- -

أمثلة

- -

حالات غير صحيحة

- -
// undefined and null cases on which the substring method won't work
-var foo = undefined;
-foo.substring(1); // TypeError: foo is undefined
-
-var foo = null;
-foo.substring(1); // TypeError: foo is null
-
-
-// Certain methods might require a specific type
-var foo = {}
-Symbol.keyFor(foo); // TypeError: foo is not a symbol
-
-var foo = 'bar'
-Object.create(foo); // TypeError: "foo" is not an object or null
-
- -

حل المشكلة

- -

لإصلاح مؤشر null إلى قيم undefined أو null ، يمكنك استخدام عامل التشغيل typeof ، على سبيل المثال.

- -
if (typeof foo !== 'undefined') {
-  // الآن نعلم أن القيمة المدخلة غير محددة، نستطيع القيام بأي إجراء بدون خطأ.
-}
- -

شاهد أيضاً

- -
    -
  • {{jsxref("undefined")}}
  • -
  • {{jsxref("null")}}
  • -
diff --git a/files/ar/web/javascript/reference/functions/get/index.html b/files/ar/web/javascript/reference/functions/get/index.html deleted file mode 100644 index 1b809b8ad3..0000000000 --- a/files/ar/web/javascript/reference/functions/get/index.html +++ /dev/null @@ -1,166 +0,0 @@ ---- -title: getter -slug: Web/JavaScript/Reference/Functions/get -translation_of: Web/JavaScript/Reference/Functions/get -original_slug: Web/JavaScript/Reference/الدوال/get ---- -
{{jsSidebar("Functions")}}
- -

The get صينطاكس طعمنيققbinds an object property to a function that will be called when that property is looked up.

- -
{{EmbedInteractiveExample("pages/js/functions-getter.html")}}
- - - -

Syntax

- -
{get prop() { ... } }
-{get [expression]() { ... } }
- -

Parameters

- -
-
prop
-
rty to bind to the given fun-tion.
-
expression
-
Starting with ECMAScript 2015, you can also use expressions for a computed property name to bind to the given function.
-
- -

Description

- -

احا الشبشب ضاع احا دا كان ةبصباع

- -

It is not possible to simultaneously have a getter bound to a property and have that property actually hold a value, although it is possible to use a getter and a setter in conjunction to create a type of pseudo-property.

- -

Note the following when working with the get syntax:

- - - -

Examples

- -

Defining a getter on new objects in object initializers

- -

This will create a pseudo-property latest for object obj, which will return the last array item in log.

- -
const obj = {
-  log: ['example','test'],
-  get latest() {
-    if (this.log.length === 0) return undefined;
-    return this.log[this.log.length - 1];
-  }
-}
-console.log(obj.latest); // "test"
-
- -

Note that attempting to assign a value to latest will not change it.

- -

Deleting a getter using the delete operator

- -

If you want to remove the getter, you can just {{jsxref("Operators/delete", "delete")}} it:

- -
delete obj.latest;
-
- -

Defining a getter on existing objects using defineProperty

- -

To append a getter to an existing object later at any time, use {{jsxref("Object.defineProperty()")}}.

- -
const o = {a: 0};
-
-Object.defineProperty(o, 'b', { get: function() { return this.a + 1; } });
-
-console.log(o.b) // Runs the getter, which yields a + 1 (which is 1)
- -

Using a computed property name

- -
const expr = 'foo';
-
-const obj = {
-  get [expr]() { return 'bar'; }
-};
-
-console.log(obj.foo); // "bar"
- -

Smart / self-overwriting / lazy getters

- -

Getters give you a way to define a property of an object, but they do not calculate the property's value until it is accessed. A getter defers the cost of calculating the value until the value is needed. If it is never needed, you never pay the cost.

- -

An additional optimization technique to lazify or delay the calculation of a property value and cache it for later access are smart (or "memoized") getters. The value is calculated the first time the getter is called, and is then cached so subsequent accesses return the cached value without recalculating it. This is useful in the following situations:

- -
    -
  • If the calculation of a property value is expensive (takes much RAM or CPU time, spawns worker threads, retrieves remote file, etc).
  • -
  • If the value isn't needed just now. It will be used later, or in some case it's not used at all.
  • -
  • If it's used, it will be accessed several times, and there is no need to re-calculate that value will never be changed or shouldn't be re-calculated.
  • -
- -
-

This means that you shouldn’t write a lazy getter for a property whose value you expect to change, because if the getter is lazy then it will not recalculate the value.

- -

Note that getters are not “lazy” or “memozied” by nature; you must implement this technique if you desire this behavior.

-
- -

In the following example, the object has a getter as its own property. On getting the property, the property is removed from the object and re-added, but implicitly as a data property this time. Finally, the value getsreturn this.notifier = document.getElementById('bookmarked-notification-anchor'); },

- -

For Firefox code, see also the XPCOMUtils.jsm code module, which defines the defineLazyGetter() function.

- -

get vs. defineProperty

- -

While using the get keyword and {{jsxref("Object.defineProperty()")}} have similar results, there is a subtle difference between the two when used on {{jsxref("classes")}}.

- -

When using get the property will be defined on the instance's prototype, while using {{jsxref("Object.defineProperty()")}} the property will be defined on the instance it is applied to.

- -
class Example {
-  get hello() {
-    return 'world';
-  }
-}
-
-const obj = new Example();
-console.log(obj.hello);
-// "world"
-
-console.log(Object.getOwnPropertyDescriptor(obj, 'hello'));
-// undefined
-
-console.log(
-  Object.getOwnPropertyDescriptor(
-    Object.getPrototypeOf(obj), 'hello'
-  )
-);
-// { configurable: true, enumerable: false, get: function get hello() { return 'world'; }, set: undefined }
- -

Specifications

- - - - - - - - - - - - -
Specification
{{SpecName('ESDraft', '#sec-method-definitions', 'Method definitions')}}
- -

Browser compatibility

- - - -

{{Compat("javascript.functions.get")}}

- -

See also

- -
    -
  • setter
  • -
  • {{jsxref("Operators/delete", "delete")}}
  • -
  • {{jsxref("Object.defineProperty()")}}
  • -
  • {{jsxref("Object.defineGetter", "__defineGetter__")}}
  • -
  • {{jsxref("Object.defineSetter", "__defineSetter__")}}
  • -
  • Defining Getters and Setters in JavaScript Guide
  • -
diff --git a/files/ar/web/javascript/reference/functions/index.html b/files/ar/web/javascript/reference/functions/index.html deleted file mode 100644 index 0f051b1c7d..0000000000 --- a/files/ar/web/javascript/reference/functions/index.html +++ /dev/null @@ -1,646 +0,0 @@ ---- -title: الدوال -slug: Web/JavaScript/Reference/Functions -translation_of: Web/JavaScript/Reference/Functions -original_slug: Web/JavaScript/Reference/الدوال ---- -
{{jsSidebar("Functions")}}
- -

Generally speaking, a function is a "subprogram" that can be called by code external (or internal in the case of recursion) to the function. Like the program itself, a function is composed of a sequence of statements called the function body. Values can be passed to a function, and the function will return a value.

- -

In JavaScript, functions are first-class objects, because they can have properties and methods just like any other object. What distinguishes them from other objects is that functions can be called. In brief, they are Function objects.

- -

For more examples and explanations, see also the JavaScript guide about functions.

- -

Description

- -

Every function in JavaScript is a Function object. See {{jsxref("Function")}} for information on properties and methods of Function objects.

- -

Functions are not the same as procedures. A function always returns a value, whereas a procedure might not.

- -

To return a value other than the default, a function must have a return statement that specifies the value to return. A function without a return statement will return a default value. In the case of a constructor called with the new keyword, the default value is the value of its this parameter. For all other functions, the default return value is undefined.

- -

The parameters of a function call are the function's arguments. Arguments are passed to functions by value. If the function changes the value of an argument, this change is not reflected globally or in the calling function. However, object references are values, too, and they are special: if the function changes the referred object's properties, that change is visible outside the function, as shown in the following example:

- -
/* Declare the function 'myFunc' */
-function myFunc(theObject) {
-   theObject.brand = "Toyota";
- }
-
- /*
-  * Declare variable 'mycar';
-  * create and initialize a new Object;
-  * assign reference to it to 'mycar'
-  */
- var mycar = {
-   brand: "Honda",
-   model: "Accord",
-   year: 1998
- };
-
- /* Logs 'Honda' */
- console.log(mycar.brand);
-
- /* Pass object reference to the function */
- myFunc(mycar);
-
- /*
-  * Logs 'Toyota' as the value of the 'brand' property
-  * of the object, as changed to by the function.
-  */
- console.log(mycar.brand);
-
- -

The this keyword does not refer to the currently executing function, so you must refer to Function objects by name, even within the function body.

- -

Defining functions

- -

There are several ways to define functions:

- -

The function declaration (function statement)

- -

There is a special syntax for declaring functions (see function statement for details):

- -
function name([param[, param[, ... param]]]) {
-   statements
-}
-
- -
-
name
-
The function name.
-
- -
-
param
-
The name of an argument to be passed to the function. A function can have up to 255 arguments.
-
- -
-
statements
-
The statements comprising the body of the function.
-
- -

The function expression (function expression)

- -

A function expression is similar to and has the same syntax as a function declaration (see function expression for details):

- -
function [name]([param[, param[, ... param]]]) {
-   statements
-}
-
- -
-
name
-
The function name. Can be omitted, in which case the function becomes known as an anonymous function.
-
- -
-
param
-
The name of an argument to be passed to the function. A function can have up to 255 arguments.
-
statements
-
The statements comprising the body of the function.
-
- -

The generator function declaration (function* statement)

- -
-

Note: Generator functions are an experimental technology, part of the ECMAScript 6 proposal, and are not widely supported by browsers yet.

-
- -

There is a special syntax for generator function declarations (see {{jsxref('Statements/function*', 'function* statement')}} for details):

- -
function* name([param[, param[, ... param]]]) {
-   statements
-}
-
- -
-
name
-
The function name.
-
- -
-
param
-
The name of an argument to be passed to the function. A function can have up to 255 arguments.
-
- -
-
statements
-
The statements comprising the body of the function.
-
- -

The generator function expression (function* expression)

- -
-

Note: Generator functions are an experimental technology, part of the ECMAScript 6 proposal, and are not widely supported by browsers yet.

-
- -

A generator function expression is similar to and has the same syntax as a generator function declaration (see {{jsxref('Operators/function*', 'function* expression')}} for details):

- -
function* [name]([param[, param[, ... param]]]) {
-   statements
-}
-
- -
-
name
-
The function name. Can be omitted, in which case the function becomes known as an anonymous function.
-
- -
-
param
-
The name of an argument to be passed to the function. A function can have up to 255 arguments.
-
statements
-
The statements comprising the body of the function.
-
- -

The arrow function expression (=>)

- -
-

Note: Arrow function expressions are an experimental technology, part of the ECMAScript 6 proposal, and are not widely supported by browsers yet.

-
- -

An arrow function expression has a shorter syntax and lexically binds its this value (see arrow functions for details):

- -
([param[, param]]) => {
-   statements
-}
-
-param => expression
-
- -
-
param
-
The name of an argument. Zero arguments need to be indicated with ().  For only one argument, the parentheses are not required. (like foo => 1)
-
statements or expression
-
Multiple statements need to be enclosed in brackets. A single expression requires no brackets. The expression is also the implicit return value of the function.
-
- -

The Function constructor

- -
-

Note: Using the Function constructor to create functions is not recommended since it needs the function body as a string which may prevent some JS engine optimizations and can also cause other problems.

-
- -

As all other objects, {{jsxref("Function")}} objects can be created using the new operator:

- -
new Function (arg1, arg2, ... argN, functionBody)
-
- -
-
arg1, arg2, ... argN
-
Zero or more names to be used by the function as formal parameters. Each must be a proper JavaScript identifier.
-
- -
-
functionBody
-
A string containing the JavaScript statements comprising the function body.
-
- -

Invoking the Function constructor as a function (without using the new operator) has the same effect as invoking it as a constructor.

- -

The GeneratorFunction constructor

- -
-

Note: Arrow function expressions are an experimental technology, part of the ECMAScript 6 proposal, and are not widely supported by browsers yet.

-
- -
-

Note: GeneratorFunction is not a global object, but could be obtained from generator function instance (see {{jsxref("GeneratorFunction")}} for more detail).

-
- -
-

Note: Using the GeneratorFunction constructor to create functions is not recommended since it needs the function body as a string which may prevent some JS engine optimizations and can also cause other problems.

-
- -

As all other objects, {{jsxref("GeneratorFunction")}} objects can be created using the new operator:

- -
new GeneratorFunction (arg1, arg2, ... argN, functionBody)
-
- -
-
arg1, arg2, ... argN
-
Zero or more names to be used by the function as formal argument names. Each must be a string that conforms to the rules for a valid JavaScript identifier or a list of such strings separated with a comma; for example "x", "theValue", or "a,b".
-
- -
-
functionBody
-
A string containing the JavaScript statements comprising the function definition.
-
- -

Invoking the Function constructor as a function (without using the new operator) has the same effect as invoking it as a constructor.

- -

Function parameters

- -
-

Note: Default and rest parameters are experimental technology, part of the ECMAScript 6 proposal, and are not widely supported by browsers yet.

-
- -

Default parameters

- -

Default function parameters allow formal parameters to be initialized with default values if no value or undefined is passed. For more details, see default parameters.

- -

Rest parameters

- -

The rest parameter syntax allows to represent an indefinite number of arguments as an array. For more details, see rest parameters.

- -

The arguments object

- -

You can refer to a function's arguments within the function by using the arguments object. See arguments.

- -
    -
  • arguments: An array-like object containing the arguments passed to the currently executing function.
  • -
  • arguments.callee {{Deprecated_inline}}: The currently executing function.
  • -
  • arguments.caller {{Obsolete_inline}} : The function that invoked the currently executing function.
  • -
  • arguments.length: The number of arguments passed to the function.
  • -
- -

Defining method functions

- -

Getter and setter functions

- -

You can define getters (accessor methods) and setters (mutator methods) on any standard built-in object or user-defined object that supports the addition of new properties. The syntax for defining getters and setters uses the object literal syntax.

- -
-
get
-
-

Binds an object property to a function that will be called when that property is looked up.

-
-
set
-
Binds an object property to a function to be called when there is an attempt to set that property.
-
- -

Method definition syntax

- -
-

Note: Method definitions are experimental technology, part of the ECMAScript 6 proposal, and are not widely supported by browsers yet.

-
- -

Starting with ECMAScript 6, you are able to define own methods in a shorter syntax, similar to the getters and setters. See method definitions for more information.

- -
var obj = {
-  foo() {},
-  bar() {}
-};
- -

Function constructor vs. function declaration vs. function expression

- -

Compare the following:

- -

A function defined with the Function constructor assigned to the variable multiply:

- -
function multiply(x, y) {
-   return x * y;
-}
-
- -

A function expression of an anonymous function assigned to the variable multiply:

- -
var multiply = function(x, y) {
-   return x * y;
-};
-
- -

A function expression of a function named func_name assigned to the variable multiply:

- -
var multiply = function func_name(x, y) {
-   return x * y;
-};
-
- -

Differences

- -

All do approximately the same thing, with a few subtle differences:

- -

There is a distinction between the function name and the variable the function is assigned to. The function name cannot be changed, while the variable the function is assigned to can be reassigned. The function name can be used only within the function's body. Attempting to use it outside the function's body results in an error (or undefined if the function name was previously declared via a var statement). For example:

- -
var y = function x() {};
-alert(x); // throws an error
-
- -

The function name also appears when the function is serialized via Function's toString method.

- -

On the other hand, the variable the function is assigned to is limited only by its scope, which is guaranteed to include the scope where the function is declared in.

- -

As the 4th example shows, the function name can be different from the variable the function is assigned to. They have no relation to each other.A function declaration also creates a variable with the same name as the function name. Thus, unlike those defined by function expressions, functions defined by function declarations can be accessed by their name in the scope they were defined in:

- -

A function defined by 'new Function' does not have a function name. However, in the SpiderMonkey JavaScript engine, the serialized form of the function shows as if it has the name "anonymous". For example, alert(new Function()) outputs:

- -
function anonymous() {
-}
-
- -

Since the function actually does not have a name, anonymous is not a variable that can be accessed within the function. For example, the following would result in an error:

- -
var foo = new Function("alert(anonymous);");
-foo();
-
- -

Unlike functions defined by function expressions or by the Function constructor, a function defined by a function declaration can be used before the function declaration itself. For example:

- -
foo(); // alerts FOO!
-function foo() {
-   alert('FOO!');
-}
-
- -

A function defined by a function expression inherits the current scope. That is, the function forms a closure. On the other hand, a function defined by a Function constructor does not inherit any scope other than the global scope (which all functions inherit).

- -

Functions defined by function expressions and function declarations are parsed only once, while those defined by the Function constructor are not. That is, the function body string passed to the Function constructor must be parsed each and every time the constructor is called. Although a function expression creates a closure every time, the function body is not reparsed, so function expressions are still faster than "new Function(...)". Therefore the Function constructor should generally be avoided whenever possible.

- -

It should be noted, however, that function expressions and function declarations nested within the function generated by parsing a Function constructor 's string aren't parsed repeatedly. For example:

- -
var foo = (new Function("var bar = \'FOO!\';\nreturn(function() {\n\talert(bar);\n});"))();
-foo(); // The segment "function() {\n\talert(bar);\n}" of the function body string is not re-parsed.
- -

A function declaration is very easily (and often unintentionally) turned into a function expression. A function declaration ceases to be one when it either:

- -
    -
  • becomes part of an expression
  • -
  • is no longer a "source element" of a function or the script itself. A "source element" is a non-nested statement in the script or a function body:
  • -
- -
var x = 0;               // source element
-if (x == 0) {            // source element
-   x = 10;               // not a source element
-   function boo() {}     // not a source element
-}
-function foo() {         // source element
-   var y = 20;           // source element
-   function bar() {}     // source element
-   while (y == 10) {     // source element
-      function blah() {} // not a source element
-      y++;               // not a source element
-   }
-}
-
- -

Examples

- -
// function declaration
-function foo() {}
-
-// function expression
-(function bar() {})
-
-// function expression
-x = function hello() {}
-
-
-if (x) {
-   // function expression
-   function world() {}
-}
-
-
-// function declaration
-function a() {
-   // function declaration
-   function b() {}
-   if (0) {
-      // function expression
-      function c() {}
-   }
-}
-
- -

Block-level functions

- -

In strict mode, starting with ES2015 (ES6), functions inside blocks are now scoped to that block. Prior to ES6, block-level functions were forbidden in strict mode.

- -
'use strict';
-
-function f() {
-  return 1;
-}
-
-{
-  function f() {
-    return 2;
-  }
-}
-
-f() === 1; // true
-
-// f() === 2 in non-strict mode
-
- -

Block-level functions in non-strict code

- -

In a word: Don't.

- -

In non-strict code, function declarations inside blocks behave strangely. For example:

- -
if (shouldDefineZero) {
-   function zero() {     // DANGER: compatibility risk
-      console.log("This is zero.");
-   }
-}
-
- -

ES2015 says that if shouldDefineZero is false, then zero should never be defined, since the block never executes. However, it's a new part of the standard. Historically, this was left unspecified, and some browsers would define zero whether the block executed or not.

- -

In strict mode, all browsers that support ES2015 handle this the same way: zero is defined only if shouldDefineZero is true, and only in the scope of the if-block.

- -

A safer way to define functions conditionally is to assign a function expression to a variable:

- -
var zero;
-if (0) {
-   zero = function() {
-      console.log("This is zero.");
-   };
-}
-
- -

Examples

- -

Returning a formatted number

- -

The following function returns a string containing the formatted representation of a number padded with leading zeros.

- -
// This function returns a string padded with leading zeros
-function padZeros(num, totalLen) {
-   var numStr = num.toString();             // Initialize return value as string
-   var numZeros = totalLen - numStr.length; // Calculate no. of zeros
-   for (var i = 1; i <= numZeros; i++) {
-      numStr = "0" + numStr;
-   }
-   return numStr;
-}
-
- -

The following statements call the padZeros function.

- -
var result;
-result = padZeros(42,4); // returns "0042"
-result = padZeros(42,2); // returns "42"
-result = padZeros(5,4);  // returns "0005"
-
- -

Determining whether a function exists

- -

You can determine whether a function exists by using the typeof operator. In the following example, a test is peformed to determine if the window object has a property called noFunc that is a function. If so, it is used; otherwise some other action is taken.

- -
 if ('function' == typeof window.noFunc) {
-   // use noFunc()
- } else {
-   // do something else
- }
-
- -

Note that in the if test, a reference to noFunc is used—there are no brackets "()" after the function name so the actual function is not called.

- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition. Implemented in JavaScript 1.0
{{SpecName('ES5.1', '#sec-13', 'Function Definition')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-function-definitions', 'Function definitions')}}{{Spec2('ES6')}}New: Arrow functions, Generator functions, default parameters, rest parameters.
{{SpecName('ESDraft', '#sec-function-definitions', 'Function definitions')}}{{Spec2('ESDraft')}} 
- -

Browser compatibility

- -

{{CompatibilityTable}}

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
Generator functions39{{CompatGeckoDesktop("26.0")}}{{CompatUnknown}}26{{CompatUnknown}}
Arrow functions{{CompatNo}}{{CompatGeckoDesktop("22.0")}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
Block-level functions{{CompatUnknown}}{{CompatGeckoDesktop("46.0")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
Generator functions{{CompatUnknown}}39{{CompatGeckoMobile("26.0")}}{{CompatUnknown}}26{{CompatUnknown}}
Arrow functions{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("22.0")}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
Block-level functions{{CompatUnknown}}{{CompatUnknown}}{{CompatGeckoMobile("46.0")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
-
- -

See also

- -
    -
  • {{jsxref("Statements/function", "function statement")}}
  • -
  • {{jsxref("Operators/function", "function expression")}}
  • -
  • {{jsxref("Statements/function*", "function* statement")}}
  • -
  • {{jsxref("Operators/function*", "function* expression")}}
  • -
  • {{jsxref("Function")}}
  • -
  • {{jsxref("GeneratorFunction")}}
  • -
  • {{jsxref("Functions/Arrow_functions", "Arrow functions")}}
  • -
  • {{jsxref("Functions/Default_parameters", "Default parameters")}}
  • -
  • {{jsxref("Functions/rest_parameters", "Rest parameters")}}
  • -
  • {{jsxref("Functions/arguments", "Arguments object")}}
  • -
  • {{jsxref("Functions/get", "getter")}}
  • -
  • {{jsxref("Functions/set", "setter")}}
  • -
  • {{jsxref("Functions/Method_definitions", "Method definitions")}}
  • -
  • Functions and function scope
  • -
diff --git a/files/ar/web/javascript/reference/global_objects/array/index.html b/files/ar/web/javascript/reference/global_objects/array/index.html deleted file mode 100644 index 1e00adcf73..0000000000 --- a/files/ar/web/javascript/reference/global_objects/array/index.html +++ /dev/null @@ -1,481 +0,0 @@ ---- -title: Array -slug: Web/JavaScript/Reference/Global_Objects/Array -translation_of: Web/JavaScript/Reference/Global_Objects/Array ---- -
{{JSRef}}
- -
كائن Array في جافاسكربت  هو كائن عام، يستخدم في إنشاء المصفوفات، وهي تشبه قائمة من الكائنات عالية المستوى.
- -
 
- -

إنشاء مصفوفة

- -
var fruits = ["Apple", "Banana"];
-
-console.log(fruits.length);
-// 2
-
- -

الوصول إلى عنصر محدد في المصفوفة

- -
var first = fruits[0];
-// Apple
-
-var last = fruits[fruits.length - 1];
-// Banana
-
- -

تنفيذ حلقة تكرار على مصفوفة

- -
fruits.forEach(function (item, index, array) {
-  console.log(item, index);
-});
-// Apple 0
-// Banana 1
-
- -

إلحاق عنصر بآخر المصفوفة

- -
var newLength = fruits.push("Orange");
-// ["Apple", "Banana", "Orange"]
-
- -

حذف عنصر من نهاية المصفوفة

- -
var last = fruits.pop(); // remove Orange (from the end)
-// ["Apple", "Banana"];
-
- -

حذف عنصر من بداية المصفوفة

- -
var first = fruits.shift(); // remove Apple from the front
-// ["Banana"];
-
- -

إضافة عنصر إلى بداية المصفوفة

- -
var newLength = fruits.unshift("Strawberry") // add to the front
-// ["Strawberry", "Banana"];
-
- -

الوصول إلى ترتيب عنصر معينة في المصفوفة

- -
fruits.push("Mango");
-// ["Strawberry", "Banana", "Mango"]
-
-var pos = fruits.indexOf("Banana");
-// 1
-
- -

حذف عنصر عن طريق ترتيبه في المصفوفة

- -
var removedItem = fruits.splice(pos, 1); // this is how to remove an item
-// ["Strawberry", "Mango"]
-
- -

نسخة مصفوفة

- -
var shallowCopy = fruits.slice(); // this is how to make a copy
-// ["Strawberry", "Mango"]
-
- -

Syntax

- -
[element0, element1, ..., elementN]
-new Array(element0, element1[, ...[, elementN]])
-new Array(arrayLength)
- -

Parameters

- -
-
elementN
-
A JavaScript array is initialized with the given elements, except in the case where a single argument is passed to the Array constructor and that argument is a number (see the arrayLength parameter below).Note that this special case only applies to JavaScript arrays created with the Array constructor, not array literals created with the bracket syntax.
-
arrayLength
-
If the only argument passed to the Array constructor is an integer between 0 and 232-1 (inclusive), this returns a new JavaScript array with length set to that number. If the argument is any other number, a {{jsxref("RangeError")}} exception is thrown.
-
- -

الوصف

- -

Arrays are list-like objects whose prototype has methods to perform traversal and mutation operations. Neither the length of a JavaScript array nor the types of its elements are fixed. Since an array's length can change at any time, and data can be stored at non-contiguous locations in the array, JavaScript arrays are not guaranteed to be dense; this depends on how the programmer chooses to use them. In general, these are convenient characteristics; but if these features are not desirable for your particular use, you might consider using typed arrays.

- -

Some people think that you shouldn't use an array as an associative array. In any case, you can use plain {{jsxref("Global_Objects/Object", "objects")}} instead, although doing so comes with its own caveats. See the post Lightweight JavaScript dictionaries with arbitrary keys as an example.

- -

الوصول إلى عناصر المصفوفة

- -

JavaScript arrays are zero-indexed: the first element of an array is at index 0, and the last element is at the index equal to the value of the array's {{jsxref("Array.length", "length")}} property minus 1.

- -
var arr = ['this is the first element', 'this is the second element'];
-console.log(arr[0]);              // logs 'this is the first element'
-console.log(arr[1]);              // logs 'this is the second element'
-console.log(arr[arr.length - 1]); // logs 'this is the second element'
-
- -

Array elements are object properties in the same way that toString is a property, but trying to access an element of an array as follows throws a syntax error, because the property name is not valid:

- -
console.log(arr.0); // a syntax error
-
- -

There is nothing special about JavaScript arrays and the properties that cause this. JavaScript properties that begin with a digit cannot be referenced with dot notation; and must be accessed using bracket notation. For example, if you had an object with a property named '3d', it can only be referenced using bracket notation. E.g.:

- -
var years = [1950, 1960, 1970, 1980, 1990, 2000, 2010];
-console.log(years.0);   // a syntax error
-console.log(years[0]);  // works properly
-
- -
renderer.3d.setTexture(model, 'character.png');     // a syntax error
-renderer['3d'].setTexture(model, 'character.png');  // works properly
-
- -

Note that in the 3d example, '3d' had to be quoted. It's possible to quote the JavaScript array indexes as well (e.g., years['2'] instead of years[2]), although it's not necessary. The 2 in years[2] is coerced into a string by the JavaScript engine through an implicit toString conversion. It is for this reason that '2' and '02' would refer to two different slots on the years object and the following example could be true:

- -
console.log(years['2'] != years['02']);
-
- -

Similarly, object properties which happen to be reserved words(!) can only be accessed as string literals in bracket notation(but it can be accessed by dot notation in firefox 40.0a2 at least):

- -
var promise = {
-  'var'  : 'text',
-  'array': [1, 2, 3, 4]
-};
-
-console.log(promise['array']);
-
- -

Relationship between length and numerical properties

- -

A JavaScript array's {{jsxref("Array.length", "length")}} property and numerical properties are connected. Several of the built-in array methods (e.g., {{jsxref("Array.join", "join")}}, {{jsxref("Array.slice", "slice")}}, {{jsxref("Array.indexOf", "indexOf")}}, etc.) take into account the value of an array's {{jsxref("Array.length", "length")}} property when they're called. Other methods (e.g., {{jsxref("Array.push", "push")}}, {{jsxref("Array.splice", "splice")}}, etc.) also result in updates to an array's {{jsxref("Array.length", "length")}} property.

- -
var fruits = [];
-fruits.push('banana', 'apple', 'peach');
-
-console.log(fruits.length); // 3
-
- -

When setting a property on a JavaScript array when the property is a valid array index and that index is outside the current bounds of the array, the engine will update the array's {{jsxref("Array.length", "length")}} property accordingly:

- -
fruits[5] = 'mango';
-console.log(fruits[5]); // 'mango'
-console.log(Object.keys(fruits));  // ['0', '1', '2', '5']
-console.log(fruits.length); // 6
-
- -

Increasing the {{jsxref("Array.length", "length")}}.

- -
fruits.length = 10;
-console.log(Object.keys(fruits)); // ['0', '1', '2', '5']
-console.log(fruits.length); // 10
-
- -

Decreasing the {{jsxref("Array.length", "length")}} property does, however, delete elements.

- -
fruits.length = 2;
-console.log(Object.keys(fruits)); // ['0', '1']
-console.log(fruits.length); // 2
-
- -

This is explained further on the {{jsxref("Array.length")}} page.

- -

Creating an array using the result of a match

- -

The result of a match between a regular expression and a string can create a JavaScript array. This array has properties and elements which provide information about the match. Such an array is returned by {{jsxref("RegExp.exec")}}, {{jsxref("String.match")}}, and {{jsxref("String.replace")}}. To help explain these properties and elements, look at the following example and then refer to the table below:

- -
// Match one d followed by one or more b's followed by one d
-// Remember matched b's and the following d
-// Ignore case
-
-var myRe = /d(b+)(d)/i;
-var myArray = myRe.exec('cdbBdbsbz');
-
- -

The properties and elements returned from this match are as follows:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Property/ElementDescriptionExample
inputA read-only property that reflects the original string against which the regular expression was matched.cdbBdbsbz
indexA read-only property that is the zero-based index of the match in the string.1
[0]A read-only element that specifies the last matched characters.dbBd
[1], ...[n]Read-only elements that specify the parenthesized substring matches, if included in the regular expression. The number of possible parenthesized substrings is unlimited.[1]: bB
- [2]: d
- -

الخصائص

- -
-
Array.length
-
The Array constructor's length property whose value is 1.
-
{{jsxref("Array.@@species", "get Array[@@species]")}}
-
The constructor function that is used to create derived objects.
-
{{jsxref("Array.prototype")}}
-
Allows the addition of properties to all array objects.
-
- -

الدوال

- -
-
{{jsxref("Array.from()")}}
-
Creates a new Array instance from an array-like or iterable object.
-
{{jsxref("Array.isArray()")}}
-
Returns true if a variable is an array, if not false.
-
{{jsxref("Array.of()")}}
-
Creates a new Array instance with a variable number of arguments, regardless of number or type of the arguments.
-
- -

Array instances

- -

All Array instances inherit from {{jsxref("Array.prototype")}}. The prototype object of the Array constructor can be modified to affect all Array instances.

- -

الخصائص

- -
{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype', 'Properties')}}
- -

الدوال

- -

Mutator methods

- -
{{page('en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype', 'Mutator_methods')}}
- -

Accessor methods

- -
{{page('en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype', 'Accessor_methods')}}
- -

Iteration methods

- -
{{page('en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype', 'Iteration_methods')}}
- -

Array generic methods

- -
-

Array generics are non-standard, deprecated and will get removed near future. Note that you can not rely on them cross-browser. However, there is a shim available on GitHub.

-
- -

Sometimes you would like to apply array methods to strings or other array-like objects (such as function {{jsxref("Functions/arguments", "arguments", "", 1)}}). By doing this, you treat a string as an array of characters (or otherwise treat a non-array as an array). For example, in order to check that every character in the variable str is a letter, you would write:

- -
function isLetter(character) {
-  return character >= 'a' && character <= 'z';
-}
-
-if (Array.prototype.every.call(str, isLetter)) {
-  console.log("The string '" + str + "' contains only letters!");
-}
-
- -

This notation is rather wasteful and JavaScript 1.6 introduced a generic shorthand:

- -
if (Array.every(str, isLetter)) {
-  console.log("The string '" + str + "' contains only letters!");
-}
-
- -

{{jsxref("Global_Objects/String", "Generics", "#String_generic_methods", 1)}} are also available on {{jsxref("String")}}.

- -

These are not part of ECMAScript standards (though the ES6 {{jsxref("Array.from()")}} can be used to achieve this). The following is a shim to allow its use in all browsers:

- -
// Assumes Array extras already present (one may use polyfills for these as well)
-(function() {
-  'use strict';
-
-  var i,
-    // We could also build the array of methods with the following, but the
-    //   getOwnPropertyNames() method is non-shimable:
-    // Object.getOwnPropertyNames(Array).filter(function(methodName) {
-    //   return typeof Array[methodName] === 'function'
-    // });
-    methods = [
-      'join', 'reverse', 'sort', 'push', 'pop', 'shift', 'unshift',
-      'splice', 'concat', 'slice', 'indexOf', 'lastIndexOf',
-      'forEach', 'map', 'reduce', 'reduceRight', 'filter',
-      'some', 'every', 'find', 'findIndex', 'entries', 'keys',
-      'values', 'copyWithin', 'includes'
-    ],
-    methodCount = methods.length,
-    assignArrayGeneric = function(methodName) {
-      if (!Array[methodName]) {
-        var method = Array.prototype[methodName];
-        if (typeof method === 'function') {
-          Array[methodName] = function() {
-            return method.call.apply(method, arguments);
-          };
-        }
-      }
-    };
-
-  for (i = 0; i < methodCount; i++) {
-    assignArrayGeneric(methods[i]);
-  }
-}());
-
- -

أمثلة

- -

إنشاء مصفوفة

- -

The following example creates an array, msgArray, with a length of 0, then assigns values to msgArray[0] and msgArray[99], changing the length of the array to 100.

- -
var msgArray = [];
-msgArray[0] = 'Hello';
-msgArray[99] = 'world';
-
-if (msgArray.length === 100) {
-  console.log('The length is 100.');
-}
-
- -

إنشاء مصفوفة ذات بعدين

- -

The following creates a chess board as a two dimensional array of strings. The first move is made by copying the 'p' in (6,4) to (4,4). The old position (6,4) is made blank.

- -
var board = [
-  ['R','N','B','Q','K','B','N','R'],
-  ['P','P','P','P','P','P','P','P'],
-  [' ',' ',' ',' ',' ',' ',' ',' '],
-  [' ',' ',' ',' ',' ',' ',' ',' '],
-  [' ',' ',' ',' ',' ',' ',' ',' '],
-  [' ',' ',' ',' ',' ',' ',' ',' '],
-  ['p','p','p','p','p','p','p','p'],
-  ['r','n','b','q','k','b','n','r'] ];
-
-console.log(board.join('\n') + '\n\n');
-
-// Move King's Pawn forward 2
-board[4][4] = board[6][4];
-board[6][4] = ' ';
-console.log(board.join('\n'));
-
- -

هذه هي النتيجة (الخرج):

- -
R,N,B,Q,K,B,N,R
-P,P,P,P,P,P,P,P
- , , , , , , ,
- , , , , , , ,
- , , , , , , ,
- , , , , , , ,
-p,p,p,p,p,p,p,p
-r,n,b,q,k,b,n,r
-
-R,N,B,Q,K,B,N,R
-P,P,P,P,P,P,P,P
- , , , , , , ,
- , , , , , , ,
- , , , ,p, , ,
- , , , , , , ,
-p,p,p,p, ,p,p,p
-r,n,b,q,k,b,n,r
-
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition.
{{SpecName('ES5.1', '#sec-15.4', 'Array')}}{{Spec2('ES5.1')}}New methods added: {{jsxref("Array.isArray")}}, {{jsxref("Array.prototype.indexOf", "indexOf")}}, {{jsxref("Array.prototype.lastIndexOf", "lastIndexOf")}}, {{jsxref("Array.prototype.every", "every")}}, {{jsxref("Array.prototype.some", "some")}}, {{jsxref("Array.prototype.forEach", "forEach")}}, {{jsxref("Array.prototype.map", "map")}}, {{jsxref("Array.prototype.filter", "filter")}}, {{jsxref("Array.prototype.reduce", "reduce")}}, {{jsxref("Array.prototype.reduceRight", "reduceRight")}}
{{SpecName('ES6', '#sec-array-objects', 'Array')}}{{Spec2('ES6')}}New methods added: {{jsxref("Array.from")}}, {{jsxref("Array.of")}}, {{jsxref("Array.prototype.find", "find")}}, {{jsxref("Array.prototype.findIndex", "findIndex")}}, {{jsxref("Array.prototype.fill", "fill")}}, {{jsxref("Array.prototype.copyWithin", "copyWithin")}}
{{SpecName('ESDraft', '#sec-array-objects', 'Array')}}{{Spec2('ESDraft')}}New method added: {{jsxref("Array.prototype.includes()")}}
- -

التوافق مع المتصفحات

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

إقرأ أيضا

- - diff --git a/files/ar/web/javascript/reference/global_objects/array/isarray/index.html b/files/ar/web/javascript/reference/global_objects/array/isarray/index.html deleted file mode 100644 index f78eb1574d..0000000000 --- a/files/ar/web/javascript/reference/global_objects/array/isarray/index.html +++ /dev/null @@ -1,146 +0,0 @@ ---- -title: ()Array.isArray -slug: Web/JavaScript/Reference/Global_Objects/Array/isArray -translation_of: Web/JavaScript/Reference/Global_Objects/Array/isArray ---- -
{{JSRef}}
- -

()Array.isArray تفحص القيمة التي تم تمريرها هل هي {{jsxref("Array")}} أم ﻻ.

- -

بنية الجملة

- -
Array.isArray(value)
- -

المعلمات

- -
-
value
-
القيمة التي سيتم فحصها.
-
- -

القيمة العائدة

- -

تكون القيمة العائدة true إذا كانت {{jsxref("Array")}}؛ وتكون false إذا كانت غير ذلك.

- -

الوصف

- -

إذا كانت القيمة {{jsxref("Array")}}, true ستكون القيمة العائدة؛ غير ذلك ستكون false.

- -

لمزيد من التفاصيل، راجع هذا المقال “Determining with absolute accuracy whether or not a JavaScript object is an array” .

- -

أمثلة

- -
//true جميع الأمثلة التالية ترجع
-Array.isArray([]);
-Array.isArray([1]);
-Array.isArray(new Array());
-//هي نفسها مصفوفة Array.prototype حقيقة معروفة أن
-Array.isArray(Array.prototype);
-
-//false جميع الأمثلة التالية ترجع
-Array.isArray();
-Array.isArray({});
-Array.isArray(null);
-Array.isArray(undefined);
-Array.isArray(17);
-Array.isArray('Array');
-Array.isArray(true);
-Array.isArray(false);
-Array.isArray({ __proto__: Array.prototype });
-
- -

Polyfill

- -

Running the following code before any other code will create Array.isArray() if it's not natively available.

- -
if (!Array.isArray) {
-  Array.isArray = function(arg) {
-    return Object.prototype.toString.call(arg) === '[object Array]';
-  };
-}
-
- -

المواصفات

- - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES5.1', '#sec-15.4.3.2', 'Array.isArray')}}{{Spec2('ES5.1')}}Initial definition. Implemented in JavaScript 1.8.5.
{{SpecName('ES6', '#sec-array.isarray', 'Array.isArray')}}{{Spec2('ES6')}}
{{SpecName('ESDraft', '#sec-array.isarray', 'Array.isArray')}}{{Spec2('ESDraft')}}
- -

التكامل مع المتصفحات

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatChrome("5")}}{{CompatGeckoDesktop("2.0")}}{{CompatIE("9")}}{{CompatOpera("10.5")}}{{CompatSafari("5")}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoMobile("2.0")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

إقرأ أيضا

- -
    -
  • {{jsxref("Array")}}
  • -
diff --git a/files/ar/web/javascript/reference/global_objects/array/join/index.html b/files/ar/web/javascript/reference/global_objects/array/join/index.html deleted file mode 100644 index 427509f1ec..0000000000 --- a/files/ar/web/javascript/reference/global_objects/array/join/index.html +++ /dev/null @@ -1,143 +0,0 @@ ---- -title: ()Array.prototype.join -slug: Web/JavaScript/Reference/Global_Objects/Array/join -tags: - - Prototype - - جافاسكربت - - دالة - - دمج Array - - دمج المصفوفات - - مرجع -translation_of: Web/JavaScript/Reference/Global_Objects/Array/join ---- -
{{JSRef}}
- -

دالة ()join تقوم بدمج جميع عناصر المصفوفة في نص واحد.

- -
var a = ['Wind', 'Rain', 'Fire'];
-a.join();    // 'Wind,Rain,Fire'
-a.join('-'); // 'Wind-Rain-Fire'
- -

صيغة الكتابة

- -
str = arr.join([separator = ','])
- -

المعاملات

- -
-
separator
-
اختياري. يحدد النص الذي سيقوم بفصل عناصر المصفوفة عن بعضهم البعض. الـ separator سيتحول إلى جزء من النص الناتج. إذا لم يتم تمريره، سيتم الفصل بين عناصر المصفوفة بالـ comma. إذا كان الـseparator عبارة عن نص فارغ، سيتم ضم عناصر المصفوفة دون أي فاصل
-
- -

القيمة العائدة

- -

عناصر المصفوفة مضمومين في هيئة نص.

- -

الوصف

- -

تقوم بدمج عناصر المصفوفة في هيئة نص، إذا كان أحد هذه العناصر قيمة فارغة أو غير معرف سيتم تحويله إلى نص فارغ.

- -

أمثلة

- -

ضم عناصر المصفوفة بأربعة طرق مختلفة

- -

المثال التالي يقوم بإنشاء مصفوفة a ، بها ثلاثة عناصر، ثم يقوم بضم هذه العناصر الثلاثة، ثم يقوم بضم هذه العناصر الثلاثة إلى نص واحد بأربعة طرق: استخدام الـ separator الإفتراضي، ثم باستخدام الـ comma والمسافة، ثم باستخدام علامة الجمع وأخيرا باستخدام نص فارغ.

- -
var a = ['Wind', 'Rain', 'Fire'];
-var myVar1 = a.join();      // myVar1 إلى 'Wind,Rain,Fire' تسند
-var myVar2 = a.join(', ');  // myVar2 إلى 'Wind, Rain, Fire' تسند
-var myVar3 = a.join(' + '); // myVar3 إلى 'Wind + Rain + Fire' تسند
-var myVar4 = a.join('');    // myVar4 إلى 'WindRainFire' تسند
-
- -

المواصفات

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
الصفةالحالةتعليق
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition. Implemented in JavaScript 1.1.
{{SpecName('ES5.1', '#sec-15.4.4.5', 'Array.prototype.join')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-array.prototype.join', 'Array.prototype.join')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-array.prototype.join', 'Array.prototype.join')}}{{Spec2('ESDraft')}} 
- -

التكامل مع المتصفحات

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatChrome("1.0")}}{{CompatGeckoDesktop("1.7")}}{{CompatIE("5.5")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

إقرأ أيضا

- -
    -
  • {{jsxref("String.prototype.split()")}}
  • -
  • {{jsxref("Array.prototype.toString()")}}
  • -
  • {{jsxref("TypedArray.prototype.join()")}}
  • -
diff --git a/files/ar/web/javascript/reference/global_objects/array/pop/index.html b/files/ar/web/javascript/reference/global_objects/array/pop/index.html deleted file mode 100644 index 247f45fc14..0000000000 --- a/files/ar/web/javascript/reference/global_objects/array/pop/index.html +++ /dev/null @@ -1,134 +0,0 @@ ---- -title: Array.prototype.pop() -slug: Web/JavaScript/Reference/Global_Objects/Array/pop -translation_of: Web/JavaScript/Reference/Global_Objects/Array/pop ---- -
{{JSRef}}
-   دالة pop() هي دالة تقوم بمسح أخر عنصر من المصفوفة وإرجاعه
- -
 
- -

Syntax

- -
arr.pop()
- -

قيمة الإرجاع

- -

تعيد أخر عنصر من المصفوفة و تعيد {{jsxref("undefined")}}  في حال  كانت المصفوفة فارغة

- -

وصف

- -

 دالة POP هي دالة تقوم بمسح أخر عنصر من المصفوفة وإرجاع تلك القيمة إلى الطالب 

- -

pop is intentionally generic; this method can be {{jsxref("Function.call", "called", "", 1)}} or {{jsxref("Function.apply", "applied", "", 1)}} to objects resembling arrays. Objects which do not contain a length property reflecting the last in a series of consecutive, zero-based numerical properties may not behave in any meaningful manner.

- -

 في حالة استدعائك لدالة POP على مصفوفة فارغة فسيتم إرجاع  {{jsxref("undefined")}} 

- -

أمثلة

- -

إزالة العنصر الأخير من المصفوفة

- -

التعليمة البرمجية التالية : تقوم بإنشاء مصفوفة(myFish )   تحتوي على أربعة  عناصر ثم تقوم بمسح أخر عنصر   

- -
var myFish = ['angel', 'clown', 'mandarin', 'sturgeon'];
-
-console.log(myFish); // ['angel', 'clown', 'mandarin', 'sturgeon']
-
-var popped = myFish.pop();
-
-console.log(myFish); // ['angel', 'clown', 'mandarin' ]
-
-console.log(popped); // 'sturgeon'
- -

مواصفات

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
مواصفاتالحالةتعليق
{{SpecName('ES3')}}{{Spec2('ES3')}}Initial definition. Implemented in JavaScript 1.2.
{{SpecName('ES5.1', '#sec-15.4.4.6', 'Array.prototype.pop')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-array.prototype.pop', 'Array.prototype.pop')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-array.prototype.pop', 'Array.prototype.pop')}}{{Spec2('ESDraft')}} 
- -

Browser compatibility

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatChrome("1.0")}}{{CompatGeckoDesktop("1.7")}}{{CompatIE("5.5")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

See also

- -
    -
  • {{jsxref("Array.prototype.push()")}}
  • -
  • {{jsxref("Array.prototype.shift()")}}
  • -
  • {{jsxref("Array.prototype.unshift()")}}
  • -
  • {{jsxref("Array.prototype.splice()")}}
  • -
diff --git a/files/ar/web/javascript/reference/global_objects/array/reverse/index.html b/files/ar/web/javascript/reference/global_objects/array/reverse/index.html deleted file mode 100644 index b179e52bc1..0000000000 --- a/files/ar/web/javascript/reference/global_objects/array/reverse/index.html +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: ()Array.prototype.reverse -slug: Web/JavaScript/Reference/Global_Objects/Array/reverse -translation_of: Web/JavaScript/Reference/Global_Objects/Array/reverse ---- -
{{JSRef}}
- -

دالة الـ ()reverse تقوم بعكس ترتيبا عناصر المصفوفة مكانيا، بحيث يصبح العنصر الأول في المصفوفة في آخر المصفوفة، ويكون آخر عنصر فيها في أول المصفوفة.

- -

صيغة الكتابة

- -
arr.reverse()
- -

القيمة العائدة

- -

المصفوفة المعكوسة.

- -

الوصف

- -

The reverse method transposes the elements of the calling array object in place, mutating the array, and returning a reference to the array.

- -

أمثلة

- -

عكس العناصر في مصفوفة

- -

المثال التالي يقوم بإنشاء مصفوفة myArray تحتوي على ثلاثة عناصر، ثم يوم بعكس المصفوفة.

- -
var myArray = ['one', 'two', 'three'];
-myArray.reverse();
-
-console.log(myArray) // ['three', 'two', 'one']
-
- -

المواصفات

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
المواصفةالحالةتعليق
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition. Implemented in JavaScript 1.1.
{{SpecName('ES5.1', '#sec-15.4.4.8', 'Array.prototype.reverse')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-array.prototype.reverse', 'Array.prototype.reverse')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-array.prototype.reverse', 'Array.prototype.reverse')}}{{Spec2('ESDraft')}} 
- -

التكامل مع المتصفحات

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatChrome("1.0")}}{{CompatGeckoDesktop("1.7")}}{{CompatIE("5.5")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

إقرأ أيضا

- -
    -
  • {{jsxref("Array.prototype.join()")}}
  • -
  • {{jsxref("Array.prototype.sort()")}}
  • -
  • {{jsxref("TypedArray.prototype.reverse()")}}
  • -
diff --git a/files/ar/web/javascript/reference/global_objects/array/slice/index.html b/files/ar/web/javascript/reference/global_objects/array/slice/index.html deleted file mode 100644 index c0e4bde2c2..0000000000 --- a/files/ar/web/javascript/reference/global_objects/array/slice/index.html +++ /dev/null @@ -1,151 +0,0 @@ ---- -title: Array.prototype.slice() -slug: Web/JavaScript/Reference/Global_Objects/Array/slice -tags: - - المصفوفات - - جافا سكريبت -translation_of: Web/JavaScript/Reference/Global_Objects/Array/slice ---- -
{{JSRef}}
- -

ال slice() method إرجاع نسخة ضئيلة من جزء من مصفوفة إلى object مصفوفة جديد تم تحديده من start إلى end (end غير مضمنة) بينما start و end تمثلان مؤشر العناصر في هذه المصفوفة. لن يتم تعديل المصفوفة الأصلية.

- -
{{EmbedInteractiveExample("pages/js/array-slice.html")}}
- - - -

تركيب الجملة

- -
arr.slice([start[, end]])
-
- -

المعاملات

- -
-
start {{optional_inline}}
-
مؤشر ذو أساس صفري يبدأ فيه الاستخراج.
-
يمكن استخدام مؤشر سلبي يشير إلى إزاحة من نهاية التسلسل. slice(-2) يستخرج آخر عنصرين في التسلسل.
-
إذا كانت start غير محددة, تبدأslice من المؤشر 0.
-
إذا كانت start is أكبر من نطاق فهرس التسلسل ، يتم إرجاع صفيف فارغ.
-
end {{optional_inline}}
-
مؤشر ذو أساس صفري قبل أن ينتهي الاستخراج. slice مستخرجات إلى ولا تشمل end. على سبيل المثال, slice(1,4) يستخرج العنصر الثاني من خلال العنصر الرابع (العناصر المفهرسة 1 و 2 و 3).
-
يمكن استخدام مؤشر سلبي يشير إلى إزاحة من نهاية التسلسل. slice(2,-1) يستخرج العنصر الثالث من خلال العنصر الثاني إلى الأخير في التسلسل.
-
إذا تم حذف end, slice مستخرجات من خلال نهاية التسلسل(arr.length).
-
اذا كانت end أكبر من طول التسلسل,  فإنslice تستخرج حتى نهاية التسلسل(arr.length).
-
- -

القيمة العائدة

- -

مصفوفة جديدة تحتوي على العناصر المستخرجة.

- -

الوصف

- -

slice لا تغير المصفوفة الأصلية. تقوم بإرجاع نسخة ضئيلة من العناصر من المصفوفة الأصلية. يتم نسخ عناصر الصفيف الأصلي في الصفيف الذي تم إرجاعه كما يلي:

- -
    -
  • للreference Object(وليس الobject الفعلي) ،تقوم slice بنسخ reference object إلى المصفوفة الجديدة الجديد. يشير كل من المصفوفة الأصلية والجديدة إلى نفس ال object. إذا تغير reference Object ، تكون التغييرات مرئية لكل من المصفوفات الجديدة والأصلية.
  • -
  • للأرقام و الحروف والقيم المنطقية strings, numbers and booleans (not {{jsxref("String")}}, {{jsxref("Number")}} and {{jsxref("Boolean")}} objects),تقوم slice بنسخ القيم إلى مصفوفة جديدة. لا تؤثر التغييرات على الحرف أو الرقم أو القيمة المنطقية في مصفوفة على المصفوفة الآخرى.
  • -
- -

إذا تمت إضافة عنصر جديد إلى أي مصفوفة ، فلن تتأثر المصفوفة الآخرى.

- -

أمثلة

- -

إعادة جزء من من مصفوفة موجودة

- -
let fruits = ['Banana', 'Orange', 'Lemon', 'Apple', 'Mango']
-let citrus = fruits.slice(1, 3)
-
-// fruits contains ['Banana', 'Orange', 'Lemon', 'Apple', 'Mango']
-// citrus contains ['Orange','Lemon']
-
- -

باستخدام slice

- -

في المثال التالي, تقومslice بإنشاء مصفوفة جديدة newCar, من myCar. كلاهما يتضمن إشارة إلى الobject myHonda. عندما يتغير لون myHonda إلى الأرجواني, تعكس كلا المصفوفتان التغيير.

- -
// Using slice, create newCar from myCar.
-let myHonda = { color: 'red', wheels: 4, engine: { cylinders: 4, size: 2.2 } }
-let myCar = [myHonda, 2, 'cherry condition', 'purchased 1997']
-let newCar = myCar.slice(0, 2)
-
-// Display the values of myCar, newCar, and the color of myHonda
-//  referenced from both arrays.
-console.log('myCar = ' + JSON.stringify(myCar))
-console.log('newCar = ' + JSON.stringify(newCar))
-console.log('myCar[0].color = ' + myCar[0].color)
-console.log('newCar[0].color = ' + newCar[0].color)
-
-// Change the color of myHonda.
-myHonda.color = 'purple'
-console.log('The new color of my Honda is ' + myHonda.color)
-
-// Display the color of myHonda referenced from both arrays.
-console.log('myCar[0].color = ' + myCar[0].color)
-console.log('newCar[0].color = ' + newCar[0].color)
-
- -

This script writes:

- -
myCar = [{color: 'red', wheels: 4, engine: {cylinders: 4, size: 2.2}}, 2,
-         'cherry condition', 'purchased 1997']
-newCar = [{color: 'red', wheels: 4, engine: {cylinders: 4, size: 2.2}}, 2]
-myCar[0].color = red
-newCar[0].color = red
-The new color of my Honda is purple
-myCar[0].color = purple
-newCar[0].color = purple
-
- -

Array-like objects

- -

slice method يمكن أيضًا استدعاؤها لتحويل  Array-like objects / مجموعات إلى مصفوفة جديدة. انت فقط {{jsxref("Function.prototype.bind", "bind")}} the method لل object. The {{jsxref("Functions/arguments", "arguments")}}داخل دالة هو مثال على 'array-like object'.

- -
function list() {
-  return Array.prototype.slice.call(arguments)
-}
-
-let list1 = list(1, 2, 3) // [1, 2, 3]
-
- -

البناء يمكن أن يتم ب {{jsxref("Function.prototype.call", "call()")}} method of {{jsxref("Function.prototype")}} ويمكن تقليلها باستخدام [].slice.call(arguments) بدلا منArray.prototype.slice.call.

- -

على أي حال يمكن تبسيطها باستخدام {{jsxref("Function.prototype.bind", "bind")}}.

- -
let unboundSlice = Array.prototype.slice
-let slice = Function.prototype.call.bind(unboundSlice)
-
-function list() {
-  return slice(arguments)
-}
-
-let list1 = list(1, 2, 3) // [1, 2, 3]
- -

المواصفات

- - - - - - - - - - - - -
مواصفات
{{SpecName('ESDraft', '#sec-array.prototype.slice', 'Array.prototype.slice')}}
- -

التوافق مع المتصفح

- - - -

{{Compat("javascript.builtins.Array.slice")}}

- -

انظر أيضا

- -
    -
  • {{jsxref("Array.prototype.splice()")}}
  • -
  • {{jsxref("Function.prototype.call()")}}
  • -
  • {{jsxref("Function.prototype.bind()")}}
  • -
diff --git a/files/ar/web/javascript/reference/global_objects/date/getdate/index.html b/files/ar/web/javascript/reference/global_objects/date/getdate/index.html deleted file mode 100644 index 6a39d68196..0000000000 --- a/files/ar/web/javascript/reference/global_objects/date/getdate/index.html +++ /dev/null @@ -1,85 +0,0 @@ ---- -title: Date.prototype.getDate() -slug: Web/JavaScript/Reference/Global_Objects/Date/getDate -tags: - - النموذج المبدئي - - تاريخ - - جافاسكربت - - طريقة - - مرجع -translation_of: Web/JavaScript/Reference/Global_Objects/Date/getDate ---- -
{{JSRef}}
- -

دالة getDate() تقوم بإرجاع يوم من تاريخ الشهر المحدد وفقاً للوقت المحلي.

- -
{{EmbedInteractiveExample("pages/js/date-getdate.html")}}
- - - -

بنية الجملة

- -
dateObj.getDate()
-
- -

القيمة العائدة

- -

رقم صحيح ما بين 1 و31 يمثل يوم محدد من تاريخ الشهر المحدد وفقاً للوقت المحلي.

- -

أمثلة

- -

استخدام getDate()

- -

البيان الثاني قام بتعيين قيمة المتغير day، علي أساس قيمة تاريخ المتغير Xmas95.

- -
var Xmas95 = new Date('December 25, 1995 23:15:30');
-var day = Xmas95.getDate();
-
-console.log(day); // 25
-
- -

الخصائص

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ESDraft', '#sec-date.prototype.getdate', 'Date.prototype.getDate')}}{{Spec2('ESDraft')}} 
{{SpecName('ES6', '#sec-date.prototype.getdate', 'Date.prototype.getDate')}}{{Spec2('ES6')}} 
{{SpecName('ES5.1', '#sec-15.9.5.14', 'Date.prototype.getDate')}}{{Spec2('ES5.1')}} 
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition. Implemented in JavaScript 1.1.
- -

دعم المتصفحات

- - - -

{{Compat("javascript.builtins.Date.getDate")}}

- -

اقرأ أيضًا

- -
    -
  • {{jsxref("Date.prototype.getUTCDate()")}}
  • -
  • {{jsxref("Date.prototype.getUTCDay()")}}
  • -
  • {{jsxref("Date.prototype.setDate()")}}
  • -
diff --git a/files/ar/web/javascript/reference/global_objects/date/index.html b/files/ar/web/javascript/reference/global_objects/date/index.html deleted file mode 100644 index efaa40ce31..0000000000 --- a/files/ar/web/javascript/reference/global_objects/date/index.html +++ /dev/null @@ -1,261 +0,0 @@ ---- -title: Date | التاريخ -slug: Web/JavaScript/Reference/Global_Objects/Date -tags: - - Date - - JavaScript - - NeedsTranslation - - TopicStub -translation_of: Web/JavaScript/Reference/Global_Objects/Date ---- -
{{JSRef}}
- -

Creates a JavaScript Date instance that represents a single moment in time. Date objects are based on a time value that is the number of milliseconds since 1 January, 1970 UTC.

- -

البنيه

- -
new Date();
-new Date(value);
-new Date(dateString);
-new Date(year, month[, day[, hour[, minutes[, seconds[, milliseconds]]]]]);
-
- -
-

Note: JavaScript Date objects can only be instantiated by calling JavaScript Date as a constructor: calling it as a regular function (i.e. without the {{jsxref("Operators/new", "new")}} operator) will return a string rather than a Date object; unlike other JavaScript object types, JavaScript Date objects have no literal syntax.

-
- -

Parameters

- -
-

Note: Where Date is called as a constructor with more than one argument, if values are greater than their logical range (e.g. 13 is provided as the month value or 70 for the minute value), the adjacent value will be adjusted. E.g. new Date(2013, 13, 1) is equivalent to new Date(2014, 1, 1), both create a date for 2014-02-01 (note that the month is 0-based). Similarly for other values: new Date(2013, 2, 1, 0, 70) is equivalent to new Date(2013, 2, 1, 1, 10) which both create a date for 2013-03-01T01:10:00.

-
- -
-

Note: Where Date is called as a constructor with more than one argument, the specifed arguments represent local time. If UTC is desired, use new Date({{jsxref("Date.UTC()", "Date.UTC(...)")}}) with the same arguments.

-
- -
-
value
-
Integer value representing the number of milliseconds since 1 January 1970 00:00:00 UTC (Unix Epoch).
-
dateString
-
String value representing a date. The string should be in a format recognized by the {{jsxref("Date.parse()")}} method (IETF-compliant RFC 2822 timestamps and also a version of ISO8601). -
-

Note: parsing of date strings with the Date constructor (and Date.parse, they are equivalent) is strongly discouraged due to browser differences and inconsistencies.

-
-
-
year
-
Integer value representing the year. Values from 0 to 99 map to the years 1900 to 1999. See the {{anch("Example:_Two_digit_years_map_to_1900_-_1999", "example below")}}.
-
month
-
Integer value representing the month, beginning with 0 for January to 11 for December.
-
day
-
Optional. Integer value representing the day of the month.
-
hour
-
Optional. Integer value representing the hour of the day.
-
minute
-
Optional. Integer value representing the minute segment of a time.
-
second
-
Optional. Integer value representing the second segment of a time.
-
millisecond
-
Optional. Integer value representing the millisecond segment of a time.
-
- -

Description

- -
    -
  • If no arguments are provided, the constructor creates a JavaScript Date object for the current date and time according to system settings.
  • -
  • If at least two arguments are supplied, missing arguments are either set to 1 (if day is missing) or 0 for all others.
  • -
  • The JavaScript date is based on a time value that is milliseconds since midnight 01 January, 1970 UTC. A day holds 86,400,000 milliseconds. The JavaScript Date object range is -100,000,000 days to 100,000,000 days relative to 01 January, 1970 UTC.
  • -
  • The JavaScript Date object provides uniform behavior across platforms. The time value can be passed between systems to represent the same moment in time and if used to create a local date object, will reflect the local equivalent of the time.
  • -
  • The JavaScript Date object supports a number of UTC (universal) methods, as well as local time methods. UTC, also known as Greenwich Mean Time (GMT), refers to the time as set by the World Time Standard. The local time is the time known to the computer where JavaScript is executed.
  • -
  • Invoking JavaScript Date as a function (i.e., without the {{jsxref("Operators/new", "new")}} operator) will return a string representing the current date and time.
  • -
- -

Properties

- -
-
{{jsxref("Date.prototype")}}
-
Allows the addition of properties to a JavaScript Date object.
-
Date.length
-
The value of Date.length is 7. This is the number of arguments handled by the constructor.
-
- -

Methods

- -
-
{{jsxref("Date.now()")}}
-
Returns the numeric value corresponding to the current time - the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
-
{{jsxref("Date.parse()")}}
-
Parses a string representation of a date and returns the number of milliseconds since 1 January, 1970, 00:00:00, UTC. -
-

Note: Parsing of strings with Date.parse is strongly discouraged due to browser differences and inconsistencies.

-
-
-
{{jsxref("Date.UTC()")}}
-
Accepts the same parameters as the longest form of the constructor (i.e. 2 to 7) and returns the number of milliseconds since 1 January, 1970, 00:00:00 UTC.
-
- -

JavaScript Date instances

- -

All Date instances inherit from {{jsxref("Date.prototype")}}. The prototype object of the Date constructor can be modified to affect all Date instances.

- -

Date.prototype Methods

- -
{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/prototype', 'Methods')}}
- -

Examples

- -

Several ways to create a Date object

- -

The following examples show several ways to create JavaScript dates:

- -
-

Note: parsing of date strings with the Date constructor (and Date.parse, they are equivalent) is strongly discouraged due to browser differences and inconsistencies.

-
- -
var today = new Date();
-var birthday = new Date('December 17, 1995 03:24:00');
-var birthday = new Date('1995-12-17T03:24:00');
-var birthday = new Date(1995, 11, 17);
-var birthday = new Date(1995, 11, 17, 3, 24, 0);
-
- -

Two digit years map to 1900 - 1999

- -

In order to create and get dates between the years 0 and 99 the {{jsxref("Date.prototype.setFullYear()")}} and {{jsxref("Date.prototype.getFullYear()")}} methods should be used.

- -
var date = new Date(98, 1); // Sun Feb 01 1998 00:00:00 GMT+0000 (GMT)
-
-// Deprecated method, 98 maps to 1998 here as well
-date.setYear(98);           // Sun Feb 01 1998 00:00:00 GMT+0000 (GMT)
-
-date.setFullYear(98);       // Sat Feb 01 0098 00:00:00 GMT+0000 (BST)
-
- -

Calculating elapsed time

- -

The following examples show how to determine the elapsed time between two JavaScript dates in millisconds.

- -

Due to the differing lengths of days (due to daylight saving changeover), months and years, expressing elapsed time in units greater than hours, minutes and seconds requires addressing a number of issues and should be thoroughly researched before being attempted.

- -
// using Date objects
-var start = Date.now();
-
-// the event to time goes here:
-doSomethingForALongTime();
-var end = Date.now();
-var elapsed = end - start; // elapsed time in milliseconds
-
- -
// using built-in methods
-var start = new Date();
-
-// the event to time goes here:
-doSomethingForALongTime();
-var end = new Date();
-var elapsed = end.getTime() - start.getTime(); // elapsed time in milliseconds
-
- -
// to test a function and get back its return
-function printElapsedTime(fTest) {
-  var nStartTime = Date.now(),
-      vReturn = fTest(),
-      nEndTime = Date.now();
-
-  console.log('Elapsed time: ' + String(nEndTime - nStartTime) + ' milliseconds');
-  return vReturn;
-}
-
-yourFunctionReturn = printElapsedTime(yourFunction);
-
- -
-

Note: In browsers that support the {{domxref("window.performance", "Web Performance API", "", 1)}}'s high-resolution time feature, {{domxref("Performance.now()")}} can provide more reliable and precise measurements of elapsed time than {{jsxref("Date.now()")}}.

-
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ESDraft', '#sec-date-objects', 'Date')}}{{Spec2('ESDraft')}} 
{{SpecName('ES6', '#sec-date-objects', 'Date')}}{{Spec2('ES6')}} 
{{SpecName('ES5.1', '#sec-15.9', 'Date')}}{{Spec2('ES5.1')}} 
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition. Implemented in JavaScript 1.1.
- -

Browser compatibility

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatVersionUnknown}} [1]{{CompatVersionUnknown}} [1]{{CompatVersionUnknown}} [2]{{CompatVersionUnknown}} [1]{{CompatVersionUnknown}} [1]
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

[1] Some browsers can have issues when parsing dates: 3/14/2012 blog from danvk Comparing FF/IE/Chrome on Parsing Date Strings

- -

[2] ISO8601 Date Format is not supported in Internet Explorer 8, and other version can have issues when parsing dates

diff --git a/files/ar/web/javascript/reference/global_objects/date/now/index.html b/files/ar/web/javascript/reference/global_objects/date/now/index.html deleted file mode 100644 index ff6379db60..0000000000 --- a/files/ar/web/javascript/reference/global_objects/date/now/index.html +++ /dev/null @@ -1,80 +0,0 @@ ---- -title: Date.now() | دالة الوقت الآن -slug: Web/JavaScript/Reference/Global_Objects/Date/now -tags: - - Date - - التاريخ - - الوقت - - جافاسكربت - - دالة - - دليل - - طريقة بديلة - - مرجع -translation_of: Web/JavaScript/Reference/Global_Objects/Date/now ---- -
{{JSRef}}
- -

تقوم دالة  Date.now() بعرض عدد الثواني التي مضت منذ بداية احتساب الوقت بطريقة Timestamp وهو الأول من يناير عام 1970 الساعة الثانية عشر منتصف الليل تمامًا (First of January 1970 00:00:00)  بتوقيت UTC.

- -

بنية الجملة

- -
var timeInMs = Date.now();
- -

القيمة الراجعة

- -

القيمة الراجعة من هذه الدالة ستكون عبارة عن رقم  {{jsxref("Number")}}، هذا الرقم يشير إلى عدد الثواني التي انقضت منذ بداية احتساب الوقت بطريقة TimeStamp بالأنظمة التي تستند إلى UNIX.

- -

الوصف

- -

لإن دالة  now() تقوم بإرجاع قيمة ثابتة من الوقت {{jsxref("Date")}} فيجب عليك استخدامها بهذا الشكل   Date.now() .

- -

طريقة احتياطية (Polyfill)

- -

تم اعتماد هذه الدالة  في  إصدار ECMA-262 5th المحركات التي لم يتم تحديثها لتدعم هذه الدالة يمكنها أن تحاكي دالة Date.now() عبر استخدام هذه الشيفرة البرمجية، هذه الشيفرة ستسمح للمتصفحات بأن تحاكي وظيفة هذه الدالة في حالة عدم دعمها لها :

- -
if (!Date.now) { // إذا لم تكن الدالة موجودة
-  Date.now = function now() { // قم بإنشاء الدالة
-    return new Date().getTime(); // واربطها بالوقت الحالي
-  };
-}
-
- -

الخصائص

- - - - - - - - - - - - - - - - - - - - - - - - -
الخاصيةالحالةتعليقات
{{SpecName('ES5.1', '#sec-15.9.4.4', 'Date.now')}}{{Spec2('ES5.1')}}Initial definition. Implemented in JavaScript 1.5.
{{SpecName('ES6', '#sec-date.now', 'Date.now')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-date.now', 'Date.now')}}{{Spec2('ESDraft')}} 
- -

دعم المتصفحات

- - - -

{{Compat("javascript.builtins.Date.now")}}

- -

اقرأ أيضًا

- -
    -
  • {{domxref("Performance.now()")}} — provides timestamps with sub-millisecond resolution for use in measuring web page performance
  • -
  • {{domxref("console.time()")}} / {{domxref("console.timeEnd()")}}
  • -
diff --git a/files/ar/web/javascript/reference/global_objects/date/parse/index.html b/files/ar/web/javascript/reference/global_objects/date/parse/index.html deleted file mode 100644 index 133b751cd6..0000000000 --- a/files/ar/web/javascript/reference/global_objects/date/parse/index.html +++ /dev/null @@ -1,182 +0,0 @@ ---- -title: Date.parse() | دالة تحليل الوقت -slug: Web/JavaScript/Reference/Global_Objects/Date/parse -tags: - - Date - - التاريخ - - جافاسكربت - - طريقة - - مرجع -translation_of: Web/JavaScript/Reference/Global_Objects/Date/parse ---- -
{{JSRef}}
- -

تقوم دالة Date.parse() بتوزيع سلسلة من التاريخ، وإرجاع قيمتها إلي مللي ثانية من بداية تاريخ (1 يناير, 1970, 00:00:00 UTC) إلي التاريخ المحدد داخل الأقواس مثل Date.parse("التاريخ") أو NaN (ليس رقم) إذا كانت السلسلة غير معترف بها (غير صحيحة)، أو في بعض الحالات التي يكون فيها قيم التاريخ غير شرعية (مكتوبة بشكل خاطيء). علي سبيل المثال (2015-02-31).

- -

It is not recommended to use Date.parse as until ES5, parsing of strings was entirely implementation dependent. There are still many differences in how different hosts parse date strings, therefore date strings should be manually parsed (a library can help if many different formats are to be accommodated).

- -
{{EmbedInteractiveExample("pages/js/date-parse.html")}}
- - - -

بنية الجملة

- -

استدعاء مباشر:

- -
Date.parse(dateString)
- -

استدعاء ضمني:

- -
new Date(dateString)
- -

المعاملات

- -
-
dateString
-
النص يمثل RFC2822 أو (a variant of) تاريخ ISO 8601 (قد يتم استخدام تنسيقات أخري، ولكن ربما قد تكون النتائج غير متوقعة).
-
- -

القيمة الراجعة

- -

A number representing the milliseconds elapsed since January 1, 1970, 00:00:00 UTC and the date obtained by parsing the given string representation of a date. If the argument doesn't represent a valid date, {{jsxref("NaN")}} is returned.

- -

الوصف

- -

تقوم دالة parse() بأخذ سلسلة التاريخ مثل ("Des 25, 1995") وتقوم بإرجاع القيمة إلي المللي ثانية منذ بداية احتساب الوقت وهو الأول من يناير عام 1970 الساعة الثانية عشر منتصف الليل تماماً (First of January 1970 00:00:00)  بتوقيت UTC، حتي الوقت التي قمت بتحديده. وهذه الدالة مفيدة لتعيين قيمة التاريخ استناداً الي قيمة السلسلة، علي سبيل المثال الدمج مع طريقة  {{jsxref("Date.prototype.setTime()", "setTime()")}} و {{jsxref("Global_Objects/Date", "Date")}} .

- -

Given a string representing a time, parse() returns the time value. It accepts the RFC2822 / IETF date syntax (RFC2822 Section 3.3), e.g. "Mon, 25 Dec 1995 13:30:00 GMT". It understands the continental US time zone abbreviations, but for general use, use a time zone offset, for example, "Mon, 25 Dec 1995 13:30:00 +0430" (4 hours, 30 minutes east of the Greenwich meridian).

- -

GMT and UTC are considered equivalent. The local time zone is used to interpret arguments in RFC2822 Section 3.3 format that do not contain time zone information.

- -

Because of the variances in parsing of date strings, it is recommended to always manually parse strings as results are inconsistent, especially across different ECMAScript implementations where strings like "2015-10-12 12:00:00" may be parsed to as NaN, UTC or local timezone.

- -

ECMAScript 5 دعم تنسيق ISO-8601

- -

The date time string may be in a simplified ISO 8601 format. For example, "2011-10-10" (just date) or "2011-10-10T14:48:00" (date and time) can be passed and parsed. Where the string is ISO 8601 date only, the UTC time zone is used to interpret arguments. If the string is date and time in ISO 8601 format, it will be treated as local.

- -

While time zone specifiers are used during date string parsing to interpret the argument, the value returned is always the number of milliseconds between January 1, 1970 00:00:00 UTC and the point in time represented by the argument or NaN.

- -

Because parse() is a static method of {{jsxref("Date")}}, it is called as Date.parse() rather than as a method of a {{jsxref("Date")}} instance.

- -

الاختلافات في المنطقة الزمنية المفترضة

- -

Given a date string of "March 7, 2014", parse() assumes a local time zone, but given an ISO format such as "2014-03-07" it will assume a time zone of UTC (ES5 and ECMAScript 2015). Therefore {{jsxref("Date")}} objects produced using those strings may represent different moments in time depending on the version of ECMAScript supported unless the system is set with a local time zone of UTC. This means that two date strings that appear equivalent may result in two different values depending on the format of the string that is being converted.

- -

Fall-back to implementation-specific date formats

- -

The ECMAScript specification states: If the String does not conform to the standard format the function may fall back to any implementation–specific heuristics or implementation–specific parsing algorithm. Unrecognizable strings or dates containing illegal element values in ISO formatted strings shall cause Date.parse() to return {{jsxref("NaN")}}.

- -

However, invalid values in date strings not recognized as simplified ISO format as defined by ECMA-262 may or may not result in {{jsxref("NaN")}}, depending on the browser and values provided, e.g.:

- -
// سلسلة ليست أيزو مع قيم تاريخ صالحة
-new Date('23/25/2014');
-
- -

will be treated as a local date of 25 November, 2015 in Firefox 30 and an invalid date in Safari 7. However, if the string is recognized as an ISO format string and it contains invalid values, it will return {{jsxref("NaN")}} in all browsers compliant with ES5 and later:

- -
// سلسلة أيزو مع قيمة غير صالحة
-new Date('2014-25-23').toISOString();
-// يُعيد "RangeError: invalid date" في جميع المتصفحات المتوافقة مع es5
-
- -

SpiderMonkey's implementation-specific heuristic can be found in jsdate.cpp. The string "10 06 2014" is an example of a non–conforming ISO format and thus falls back to a custom routine. See also this rough outline on how the parsing works.

- -
new Date('10 06 2014');
-
- -

will be treated as a local date of 6 October, 2014 and not 10 June, 2014. Other examples:

- -
new Date('foo-bar 2014').toString();
-// يُعيد: "Invalid Date" *تاريخ غير صالح*
-
-Date.parse('foo-bar 2014');
-// يُعيد: NaN *ليس رقم*
-
- -

أمثلة

- -

استخدام Date.parse()

- -

إذا كان IPOdate هو كائن {{jsxref("Date")}} موجود، فيمكن تعيينه إلي 9 أغسطس، 1995 (بالتوقيت المحلي) كما يلي:

- -
IPOdate.setTime(Date.parse('Aug 9, 1995'));
- -

بعض الأمثلة الأخرى على تحليل سلاسل التاريخ غير القياسية:

- -
Date.parse('Aug 9, 1995');
- -

يٌعيد 807937200000 في المنطقة الزمنية GMT-0300، ويٌعيد قيم أخري في المناطق الزمنية الأخري، حيث أن السلسلة لا تحدد المناطق الزمنية وهي ليست بتنسيق ISO، وبالتالي فإن المنطقة الزمنية الافتراضية بدون تنسيق ISO هي المنطقة الزمنية المحلية الخاصة بالدولة الموجود بها. وتختلف من دولة إلي آخري.

- -
Date.parse('Wed, 09 Aug 1995 00:00:00 GMT');
- -

يٌعيد 807926400000 بغض النظر عن المنطقة الزمنية المحلية مثل GMT (UTC).

- -
Date.parse('Wed, 09 Aug 1995 00:00:00');
-
- -

يٌعيد 807937200000 في المنطقة الزمنية GMT-0300، ويٌعيد قيم أخري في المناطق الزمنية الأخري، حيث أن السلسلة لا تحدد المناطق الزمنية وهي ليست بتنسيق ISO، وبالتالي فإن المنطقة الزمنية الافتراضية بدون تنسيق ISO هي المنطقة الزمنية المحلية الخاصة بالدولة الموجود بها. وتختلف من دولة إلي آخري.

- -
Date.parse('Thu, 01 Jan 1970 00:00:00 GMT');
-
- -

يٌعيد 0 بغض النظر عن المنطقة الزمنية المحلية مثل GMT (UTC).

- -
Date.parse('Thu, 01 Jan 1970 00:00:00');
-
- -

يٌعيد 14400000 في المنطقة الزمنية GMT-0400، ويٌعيد قيم أخري في المناطق الزمنية الأخري، حيث أن السلسلة لا تحدد المناطق الزمنية وهي ليست بتنسيق ISO، وبالتالي فإن المنطقة الزمنية الافتراضية بدون تنسيق ISO هي المنطقة الزمنية المحلية الخاصة بالدولة الموجود بها. وتختلف من دولة إلي آخري.

- -
Date.parse('Thu, 01 Jan 1970 00:00:00 GMT-0400');
-
- -

يٌعيد 14400000 بغض النظر عن المنطقة الزمنية المحلية مثل GMT (UTC).

- -

الخصائص

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition. Implemented in JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.9.4.2', 'Date.parse')}}{{Spec2('ES5.1')}}Simplified ISO 8601 format added.
{{SpecName('ES6', '#sec-date.parse', 'Date.parse')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-date.parse', 'Date.parse')}}{{Spec2('ESDraft')}} 
- -

دعم المتصفحات

- - - -

{{Compat("javascript.builtins.Date.parse")}}

- -

ملاحظات التوافق

- -
    -
  • Firefox 49 {{geckoRelease(49)}} changed the parsing of 2-digit years to be aligned with the Google Chrome browser instead of Internet Explorer. Now, 2-digit years that are less than 50 are parsed as 21st century years. For example, 04/16/17, previously parsed as April 16, 1917, will be April 16, 2017 now. To avoid any interoperability issues or ambiguous years, it is recommended to use the ISO 8601 format like "2017-04-16" ({{bug(1265136)}}).
  • -
- -

اقرأ أيضًا

- -
    -
  • {{jsxref("Date.UTC()")}}
  • -
diff --git a/files/ar/web/javascript/reference/global_objects/date/setdate/index.html b/files/ar/web/javascript/reference/global_objects/date/setdate/index.html deleted file mode 100644 index ca5d89a63e..0000000000 --- a/files/ar/web/javascript/reference/global_objects/date/setdate/index.html +++ /dev/null @@ -1,95 +0,0 @@ ---- -title: Date.prototype.setDate() | دالة تعيين التاريخ -slug: Web/JavaScript/Reference/Global_Objects/Date/setDate -tags: - - التاريخ - - النموذج المبدئي - - جافاسكربت - - طريقة - - مرجع -translation_of: Web/JavaScript/Reference/Global_Objects/Date/setDate ---- -
{{JSRef}}
- -

دالة setDate() تقوم بتعين يوم من الـ {{jsxref("Date")}} المحدد نسبه إلي الشهر المحدد.

- -
{{EmbedInteractiveExample("pages/js/date-setdate.html")}}
- - - -

بنية الجملة

- -
dateObj.setDate(dayValue [رقم اليوم])
- -

المعاملات (Parameters)

- -
-
dayValue
-
يجب أن يكون عدد صحيح يمثل يوم من الشهر. علي سبيل المثال setDate(15) .
-
- -

القيمة العائدة

- -

عدد المللي ثانية بين تاريخ 1 يناير 1970 00:00:00 UTC والتاريخ المحدد (يتغير الـ {{jsxref("Date")}} أيضا بتغير المكان [المنطقة الزمنية]).

- -

الوصف

- -

إذا كان dayValue [رقم اليوم] خارج نطاق قيم الشهر المحدد لهذا التاريخ، فأن دالة setDate() ستقوم بتحديد الـ {{jsxref("Date")}} [اليوم] وفقاً لذلك. علي سبيل المثال، إذا تم تحديد dayValue [رقم اليوم] إلي 0 فسيتم تعيين التاريخ إلي أخر يوم في الشهر السابق.

- -

أمثلة

- -

استخدام setDate()

- -
var theBigDay = new Date(1962, 6, 7); // 1962-07-07
-theBigDay.setDate(24);  // 1962-07-24
-theBigDay.setDate(32);  // 1962-08-01
-theBigDay.setDate(22);  // 1962-08-22
-theBigDay.setDate(0); // 1962-06-30
-theBigDay.setDate(98); // 1962-10-06
-theBigDay.setDate(-50); // 1962-08-09
-
- -

الخصائص

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition. Implemented in JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.9.5.36', 'Date.prototype.setDate')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.setdate', 'Date.prototype.setDate')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-date.prototype.setdate', 'Date.prototype.setDate')}}{{Spec2('ESDraft')}} 
- -

دعم المتصفحات

- - - -

{{Compat("javascript.builtins.Date.setDate")}}

- -

اقرأ أيضًا

- -
    -
  • {{jsxref("Date.prototype.getDate()")}}
  • -
  • {{jsxref("Date.prototype.setUTCDate()")}}
  • -
diff --git a/files/ar/web/javascript/reference/global_objects/date/utc/index.html b/files/ar/web/javascript/reference/global_objects/date/utc/index.html deleted file mode 100644 index 2d1400af0e..0000000000 --- a/files/ar/web/javascript/reference/global_objects/date/utc/index.html +++ /dev/null @@ -1,133 +0,0 @@ ---- -title: Date.UTC() -slug: Web/JavaScript/Reference/Global_Objects/Date/UTC -tags: - - تاريخ - - جافاسكربت - - طريقة - - مرجع -translation_of: Web/JavaScript/Reference/Global_Objects/Date/UTC ---- -
{{JSRef}}
- -

دالة Date.UTC() تقبل نفس المُعاملات parameters علي الرغم من طول تكوين المنشيء، ويٌعيد التاريخ إلي المللي ثانية من بداية تاريخ 1 يناير, 1970, 00:00:00, التوقيت العالمي.

- -
{{EmbedInteractiveExample("pages/js/date-utc.html")}}
- - - -

بنية الجملة

- -
Date.UTC(year, month[, day[, hour[, minute[, second[, millisecond]]]]])
- -

المعاملات (Parameters)

- -
-
year
-
سنة كاملة.
-
month
-
رقم صحيح ما بين 0 و11 يمثل الشهر.
-
day
-
اختياري. رقم صحيح ما بين 1 و31 يمثل يوم من الشهر.
-
hour
-
اختياري. رقم صحيح ما بين 0 و23 يمثل الساعات.
-
minute
-
اختياري. رقم صحيح ما بين 0 و59 يمثل الدقائق.
-
second
-
اختياري. رقم صحيح ما بين 0 و59 يمثل الثواني.
-
millisecond
-
اختياري. رقم صحيح ما بين 0 و999 يمثل الميلي ثانية.
-
- -

القيمة العائدة

- -

رقم يمثل عدد المللي ثانية في التاريخ المحدد منذ 1 يناير, 1970, 00:00:00، التوقيت العالمي.

- -

الوصف

- -

تقوم دالة UTC() بأخذ معاملات (parameters) التاريخ المحددة بفاصلة ثم تُعيدها إلي مللي ثانية بين 1 يناير 1970، 00:00:00 التوقيت العالمي، والوقت الذي حددته.

- -

يجب عليك تحديد السنة كاملة؛ علي سبيل المثال, 1998. إذا كانت السنة محددة ما بين عام 0 و99، تقوم هذه الطريقة بتحويل السنه إلي سنه في القرن العشرين (1900 + سنة)؛ علي سبيل المثال، إذا حددت 95، فسيتم أستخدام 1995.

- -

تختلف طريقة UTC() عن منشيء التاريخ بطريقتين.

- -
    -
  • تستخدم دالة Date.UTC() التوقيت العالمي بدلاً من التوقيت المحلي.
  • -
  • تقوم دالة Date.UTC() بإرجاع قمية الوقت إلي رقم بدلاً من إنشاء تاريخ.
  • -
- -

If a parameter you specify is outside of the expected range, the UTC() method updates the other parameters to allow for your number. For example, if you use 15 for month, the year will be incremented by 1 (year + 1), and 3 will be used for the month.

- -

Because UTC() is a static method of {{jsxref("Date")}}, you always use it as Date.UTC(), rather than as a method of a {{jsxref("Date")}} object you created.

- -

أمثلة

- -

استخدام Date.UTC()

- -

في المثال التالي يقوم بإنشاء التاريخ بإستخدام UTC بدلاً من التوقيت المحلي:

- -
var utcDate = new Date(Date.UTC(2018, 11, 1, 0, 0, 0));
-
- -

الخصائص

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ESDraft', '#sec-date.utc', 'Date.UTC')}}{{Spec2('ESDraft')}} 
{{SpecName('ES6', '#sec-date.utc', 'Date.UTC')}}{{Spec2('ES6')}} 
{{SpecName('ES5.1', '#sec-15.9.4.3', 'Date.UTC')}}{{Spec2('ES5.1')}} 
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition. Implemented in JavaScript 1.0.
- -

دعم المتصفحات

- - - -

{{Compat("javascript.builtins.Date.UTC")}}

- -

ملاحظات التوافق

- -

Date.UTC with fewer than two arguments

- -

When providing less than two arguments to Date.UTC, {{jsxref("NaN")}} is returned. This behavior is specified in ECMAScript 2017. Engines who weren't supporting this behavior, have been updated (see {{bug(1050755)}}, ecma-262 #642).

- -
Date.UTC();
-Date.UTC(1);
-
-// Safari: NaN
-// Chrome/Opera/V8: NaN
-
-// Firefox <54: non-NaN
-// Firefox 54+: NaN
-
-// IE: non-NaN
-// Edge: NaN
-
- -

اقرأ أيضاً

- -
    -
  • {{jsxref("Date.parse()")}}
  • -
diff --git a/files/ar/web/javascript/reference/global_objects/function/call/index.html b/files/ar/web/javascript/reference/global_objects/function/call/index.html deleted file mode 100644 index f3c83f04ac..0000000000 --- a/files/ar/web/javascript/reference/global_objects/function/call/index.html +++ /dev/null @@ -1,219 +0,0 @@ ---- -title: ()Function.prototype.call -slug: Web/JavaScript/Reference/Global_Objects/Function/call -translation_of: Web/JavaScript/Reference/Global_Objects/Function/call ---- -
{{JSRef}}
- -
-

تُستدعَى الوظيفة ()call على دالة، أول argument لهذه الوظيفة هو قيمة this الخاصة بالدالة، وال arguments المتبقية (إن وُجدت)، هي  arguments الدالة.

- -
-

ملاحظة :   صيغة هذه الوظيفة مماثلة تقريبًا  للصيغة الخاصة بـ {{jsxref("Function.prototype.apply", "apply")}} الفرق الوحيد هو ان  ()call تاخذ قائمة من ال arguments  محددة بشكل فردي فيما تاخذ ()apply مصفوفة واحدة من ال arguments.

-
- -
{{EmbedInteractiveExample("pages/js/function-call.html")}}
- - - -

صيغة الوظيفة call

- -
function.call(thisArg, arg1, arg2, ...)
- -

Parameters

- -
-
thisArg
-
اختياري. وهو قيمة this المتوفرة في استدعاء الدالة function. لاحظ أن this قد لا تكون القيمة الفعلية التي تراها الوظيفة: اذا كانت هذه الوظيفة دالة في  {{jsxref("Strict_mode", "non-strict mode", "", 1)}} سيتم استبدال  {{jsxref("Global_Objects/null", "null")}} و {{jsxref("Global_Objects/undefined", "undefined")}} بالكائن العام والقيم الاولية ستحول الى كائنات.  
-
...,arg1, arg2
-
 arguments الدالة function.
-
- -

Return value

- -

تُرجع نتيجة استدعاء الدالة مع قيمة  this المحددة و ال arguments.

- -

وصف

- -

تسمح الوظيفة ()call لدالة او وظيفة خاصة بكائن واحد بان يتم استدعاؤها وتعيينها من قبل كائن مختلف.

- -

تمنح الوظيفة ()call قيمة this الجديدة الى الدالة/الوظيفة. مع الـ call  يمكنك كتابة الوظيفة مرة واحدة ومن ثم تقوم بتوريثها لكائن آخر دون الحاجة إلى إعادة كتابة الوظيفة للكائن الجديد.

- -

تحليل الجزء الغامض في الوظيفة ()call

- -

نظرا لعدم وجود شرح كاف حول هذه الجزئية فقد ارتايت ان اظيف هذه الفقرة التوضيحية لعلها تزيح بعض الغموض عن قيمة ال this التي تمثل ال argument الاول لهذه الوظيفة.

- -

اذا نظرنا بتمعن في هذا الجزء من داخل الوظيفة call. سنجد ان thisArg ستساوي الكائن العام في حالة undefined او null، والا ستساوي ناتج الكائن Object، تساوي thisArg كائنا في كلتا الحالتين. وعليه فقد اصبحت كائنا، اذن فمن الطبيعي ان تمتلك خصائص. تم تحديد الخاصية _callTemp_ قيمتها this و this تمثل الدالة التي ستستدعى عليها الوظيفة call. واخيرا يتم تنفيذ هذه الدالة:

- -
Function.prototype.call_like = function( thisArg, args ){
-    thisArg = ( thisArg === undefined || thisArg === null ) ? window : Object( thisArg );
-    thisArg._callTemp_ = this;
-    thisArg._callTemp_();
-}
- -

في حالة عدم وجود thisArg ستتصرف الدالة fn بشكل طبيعي و this ستساوي الكائن العام:

- -
var fn = function () {
-    console.log( this ); // [object Window]
-}
-fn.call_like();
-
-
- -

في حالة وجود thisArg بقيمة اولية ك undefined او null ف this ستساوي ايضا الكائن العام، خلاف ذالك سيتم تمرير قيمتها الى الكائن ()Object، اذا كانت هذه القيمة من القيم الاولية-primitive value سيقوم الكائن بتحويلها الى الكائن المناسب لها، واما اذا كانت هذه القيمة كائنا فلا حاجة لتحويلها و this ستساوي كائنا.

- -

وهذا يفسر كيف قام الكائن Object بتحويل القيمة الاولية "Youssef belmeskine" الى الكائن String:   

- -
var fn = function () {
-    console.log( this ); // "Youssef belmeskine"
-    console.log( this === "Youssef belmeskine" ); // false
-    console.log( String(this) === "Youssef belmeskine" ); // true
-}
-fn.call_like( "Youssef belmeskine" );
-
-
- -

من المهم دائما ذكر المصدر:

- -
-

بالنسبة لى شخصيا لم اتمكن من فهم هذه الوظيفة وشقيقتها apply بشكل واضح الا عندما قمت بالاطلاع على الكود الداخلى لها. قمت باستخدام هذا الجزء من الكود لتوضيح الفكرة فقط. ستجد ال Polyfill كاملا في هذا الموقع hexmen.com.

-
- -

أمثلة

- -

استخدام ال call لِسَلسَلة منشئات الكائن

- -

تستطيع إستخدام call  لعمل تسلسل لمنشئات-constructors الكائن، وذلك على غرار جافا. في المثال التالي، تم تحديد منشئ الكائن Product مع اثنين من البارامترات name و price. والدالتات Food و Toy  تستدعيان  Product  ممرر لها this و name و price. تقوم Product بتهيئة الخاصيتان name و price فيما تقوم كلا الدالتان المتخصصتان بتحديد ال category.

- -
function Product(name, price) {
-  this.name = name;
-  this.price = price;
-}
-
-function Food(name, price) {
-  Product.call(this, name, price);
-  this.category = 'food';
-}
-
-function Toy(name, price) {
-  Product.call(this, name, price);
-  this.category = 'toy';
-}
-
-var cheese = new Food('feta', 5);
-var fun = new Toy('robot', 40);
-
- -

إستخدام ال call لإستدعاء الدالة المجهولة الاسم-anonymous function 

- -

في هذا المثال قمنا بانشاء الدالة المجهولة واستخدمنا call  لإستدعاءها على كل كائن في المصفوفة. الغرض الرئيسي من الدالة المجهولة هو إضافة الدالة print الى كل كائن،  والتي ستكون قادرة على طباعة الفهرس الصحيح لكائنات المصفوفة. تمرير كائن على شكل قيمة this ليس ضروريًا، ولكن تم إنجازه لغرض توضيحي.

- -
var animals = [
-  { species: 'Lion', name: 'King' },
-  { species: 'Whale', name: 'Fail' }
-];
-
-for (var i = 0; i < animals.length; i++) {
-  (function(i) {
-    this.print = function() {
-      console.log('#' + i + ' ' + this.species
-                  + ': ' + this.name);
-    }
-    this.print();
-  }).call(animals[i], i);
-}
-
- -

استخدام call لاستدعاء دالة وتحديد السياق-context ل   this

- -

في المثال أدناه، عندما سنقوم باستدعاء greet سترتبط قيمة this  بالكائن obj.

- -
function greet() {
-  var reply = [this.animal, 'typically sleep between', this.sleepDuration].join(' ');
-  console.log(reply);
-}
-
-var obj = {
-  animal: 'cats', sleepDuration: '12 and 16 hours'
-};
-
-greet.call(obj);  // cats typically sleep between 12 and 16 hours
-
- -

إستخدام الـcall لاستدعاء دالة وبدون تحديد البرامتر الاول

- -

في المثال أدناه ،قمنا باستدعاء الدالة display من دون تمرير البرامتر الاول. إذا لم يتم تمرير قيمة this في البرامتر الاول فسترتبط بالكائن العام-global object.

-
- -
var sData = 'Wisen';
-
-function display(){
-  console.log('sData value is %s ', this.sData);
-}
-
-display.call();  // sData value is Wisen
-
- -
-

تذكر ان قيمة this ستكون  ب undefined في الوضع الصارم. انظر ادناه:

-
- -
'use strict';
-
-var sData = 'Wisen';
-
-function display() {
-  console.log('sData value is %s ', this.sData);
-}
-
-display.call(); // Cannot read the property of 'sData' of undefined
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition. Implemented in JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.3.4.4', 'Function.prototype.call')}}{{Spec2('ES5.1')}}
{{SpecName('ES6', '#sec-function.prototype.call', 'Function.prototype.call')}}{{Spec2('ES6')}}
{{SpecName('ESDraft', '#sec-function.prototype.call', 'Function.prototype.call')}}{{Spec2('ESDraft')}}
- -

Browser compatibility

- - - -

{{Compat("javascript.builtins.Function.call")}}

- -

See also

- - diff --git a/files/ar/web/javascript/reference/global_objects/function/index.html b/files/ar/web/javascript/reference/global_objects/function/index.html deleted file mode 100644 index 878d8776b3..0000000000 --- a/files/ar/web/javascript/reference/global_objects/function/index.html +++ /dev/null @@ -1,183 +0,0 @@ ---- -title: Function -slug: Web/JavaScript/Reference/Global_Objects/Function -tags: - - Constructor - - Function - - JavaScript - - NeedsTranslation - - TopicStub -translation_of: Web/JavaScript/Reference/Global_Objects/Function ---- -
{{JSRef}}
- -

The Function constructor creates a new Function object. Calling the constructor directly can create functions dynamically, but suffers from security and similar (but far less significant) performance issues similar to {{jsxref("eval")}}. However, unlike eval, the Function constructor allows executing code in the global scope, prompting better programming habits and allower for more efficient code minification.

- -
{{EmbedInteractiveExample("pages/js/function-constructor.html")}}
- - - -

Every JavaScript function is actually a Function object. This can be seen with the code (function(){}).constructor === Function which returns true.

- -

Syntax

- -
new Function ([arg1[, arg2[, ...argN]],] functionBody)
- -

Parameters

- -
-
arg1, arg2, ... argN
-
Names to be used by the function as formal argument names. Each must be a string that corresponds to a valid JavaScript identifier or a list of such strings separated with a comma; for example "x", "theValue", or "a,b".
-
functionBody
-
A string containing the JavaScript statements comprising the function definition.
-
- -

Description

- -

Function objects created with the Function constructor are parsed when the function is created. This is less efficient than declaring a function with a function expression or function statement and calling it within your code because such functions are parsed with the rest of the code.

- -

All arguments passed to the function are treated as the names of the identifiers of the parameters in the function to be created, in the order in which they are passed.

- -

Invoking the Function constructor as a function (without using the new operator) has the same effect as invoking it as a constructor. However, getting rid of the new operator allows for a smaller minified code size (4 bytes smaller), so it is best to not use new with Function.

- -

Properties and Methods of Function

- -

The global Function object has no methods or properties of its own. However, since it is a function itself, it does inherit some methods and properties through the prototype chain from {{jsxref("Function.prototype")}}.

- -

Function prototype object

- -

Properties

- -
{{page('/en-US/docs/JavaScript/Reference/Global_Objects/Function/prototype', 'Properties')}}
- -

Methods

- -
{{page('/en-US/docs/JavaScript/Reference/Global_Objects/Function/prototype', 'Methods')}}
- -

Function instances

- -

Function instances inherit methods and properties from {{jsxref("Function.prototype")}}. As with all constructors, you can change the constructor's prototype object to make changes to all Function instances.

- -

Examples

- -

Specifying arguments with the Function constructor

- -

The following code creates a Function object that takes two arguments.

- -
// Example can be run directly in your JavaScript console
-
-// Create a function that takes two arguments and returns the sum of those arguments
-var adder = new Function('a', 'b', 'return a + b');
-
-// Call the function
-adder(2, 6);
-// > 8
-
- -

The arguments "a" and "b" are formal argument names that are used in the function body, "return a + b".

- -

Difference between Function constructor and function declaration

- -

Functions created with the Function constructor do not create closures to their creation contexts; they always are created in the global scope. When running them, they will only be able to access their own local variables and global ones, not the ones from the scope in which the Function constructor was called. This is different from using {{jsxref("eval")}} with code for a function expression.

- -
var x = 10;
-
-function createFunction1() {
-    var x = 20;
-    return new Function('return x;'); // this |x| refers global |x|
-}
-
-function createFunction2() {
-    var x = 20;
-    function f() {
-        return x; // this |x| refers local |x| above
-    }
-    return f;
-}
-
-var f1 = createFunction1();
-console.log(f1());          // 10
-var f2 = createFunction2();
-console.log(f2());          // 20
-
- -

The "proper" way to execute external code with Function (for maximum minifyability).

- -
function makeFunction(code){
-    return Function('"use strict";return ' + code)();
-}
-var add = makeFunction(
-  "" + function(a, b, c){ return a + b + c } // move this to a separate file in the production release
-);
-console.log( add(1, 2, 3) ); // will log six
- -

Please note that the above code by itself is completely impractical. You should never abuse Function like that. Instead, the above code is meant only to be a simplified example of something like a module loader where there is a base script, then there are hundreads of big optionally loaded modules. Then, instead of the user waiting while they all download, the clients computer only downloads modules as needed so the page loads super fast. Also, it is reccomended that when evaluating many functions, the functions are evaluated together in bulk instead of separatly.

- -
function bulkMakeFunctions(){
-    var str = "", i = 1, Len = arguments.length;
-    if (Len) {
-        str = arguments[0];
-        while (i !== Len) str += "," + arguments[i], ++i;
-    }
-    return Function('"use strict";return[' + str + ']')();
-}
-const [
-    add,                        sub,                        mul,                        div
-] = bulkMakeFunctions(
-    "function(a,b){return a+b}","function(a,b){return a-b}","function(a,b){return a*b}","function(a,b){return a/b}"
-);
-console.log(sub(add(mul(4,3), div(225,5)), 7))
-
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition. Implemented in JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.3', 'Function')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-function-objects', 'Function')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-function-objects', 'Function')}}{{Spec2('ESDraft')}} 
- -

Browser compatibility

- -
- - -

{{Compat("javascript.builtins.Function")}}

-
- -

See also

- -
    -
  • {{jsxref("Functions", "Functions and function scope")}}
  • -
  • {{jsxref("Function")}}
  • -
  • {{jsxref("Statements/function", "function statement")}}
  • -
  • {{jsxref("Operators/function", "function expression")}}
  • -
  • {{jsxref("Statements/function*", "function* statement")}}
  • -
  • {{jsxref("Operators/function*", "function* expression")}}
  • -
  • {{jsxref("AsyncFunction")}}
  • -
  • {{jsxref("GeneratorFunction")}}
  • -
diff --git a/files/ar/web/javascript/reference/global_objects/index.html b/files/ar/web/javascript/reference/global_objects/index.html deleted file mode 100644 index 0e46a82c09..0000000000 --- a/files/ar/web/javascript/reference/global_objects/index.html +++ /dev/null @@ -1,126 +0,0 @@ ---- -title: Standard built-in objects -slug: Web/JavaScript/Reference/Global_Objects -tags: - - JavaScript - - NeedsTranslation - - TopicStub -translation_of: Web/JavaScript/Reference/Global_Objects ---- -
- {{jsSidebar("Objects")}}
-

Summary

-

This chapter documents all the JavaScript standard built-in objects, along with their methods and properties.

-
-

The term "global objects" (or standard built-in objects) here is not to be confused with the global object. Here, global objects refer to objects in the global scope (but only if ECMAScript 5 strict mode is not used! Otherwise it returns undefined). The global object itself can be accessed by the {{jsxref("Operators/this", "this")}} operator in the global scope. In fact, the global scope consists of the properties of the global object (including inherited properties, if any).

-

Other objects in the global scope are either created by the user script or provided by the host application. The host objects available in browser contexts are documented in the API reference. For more information about the distinction between the DOM and core JavaScript, see JavaScript technologies overview.

-

Standard objects (by category)

-

Value properties

-

Global properties returning a simple value.

-
    -
  • {{jsxref("Infinity")}}
  • -
  • {{jsxref("NaN")}}
  • -
  • {{jsxref("undefined")}}
  • -
  • {{jsxref("null")}} literal
  • -
-

Function properties

-

Global functions returning the result of a specific routine.

-
    -
  • {{jsxref("Global_Objects/eval", "eval()")}}
  • -
  • {{jsxref("Global_Objects/uneval", "uneval()")}} {{non-standard_inline()}}
  • -
  • {{jsxref("Global_Objects/isFinite", "isFinite()")}}
  • -
  • {{jsxref("Global_Objects/isNaN", "isNaN()")}}
  • -
  • {{jsxref("Global_Objects/parseFloat", "parseFloat()")}}
  • -
  • {{jsxref("Global_Objects/parseInt", "parseInt()")}}
  • -
  • {{jsxref("Global_Objects/decodeURI", "decodeURI()")}}
  • -
  • {{jsxref("Global_Objects/decodeURIComponent", "decodeURIComponent()")}}
  • -
  • {{jsxref("Global_Objects/encodeURI", "encodeURI()")}}
  • -
  • {{jsxref("Global_Objects/encodeURIComponent", "encodeURIComponent()")}}
  • -
  • {{jsxref("Global_Objects/escape", "escape()")}} {{deprecated_inline()}}
  • -
  • {{jsxref("Global_Objects/unescape", "unescape()")}} {{deprecated_inline()}}
  • -
-

Fundamental objects

-

General language objects, functions and errors.

-
    -
  • {{jsxref("Object")}}
  • -
  • {{jsxref("Function")}}
  • -
  • {{jsxref("Boolean")}}
  • -
  • {{jsxref("Symbol")}} {{experimental_inline()}}
  • -
  • {{jsxref("Error")}}
  • -
  • {{jsxref("EvalError")}}
  • -
  • {{jsxref("InternalError")}}
  • -
  • {{jsxref("RangeError")}}
  • -
  • {{jsxref("ReferenceError")}}
  • -
  • {{jsxref("StopIteration")}}
  • -
  • {{jsxref("SyntaxError")}}
  • -
  • {{jsxref("TypeError")}}
  • -
  • {{jsxref("URIError")}}
  • -
-

Numbers and dates

-

Objects dealing with numbers, dates and mathematical calculations.

-
    -
  • {{jsxref("Number")}}
  • -
  • {{jsxref("Math")}}
  • -
  • {{jsxref("Date")}}
  • -
-

Text processing

-

Objects for manipulating texts.

-
    -
  • {{jsxref("String")}}
  • -
  • {{jsxref("RegExp")}}
  • -
-

Indexed collections

-

Collections ordered by an index. Array-type objects.

-
    -
  • {{jsxref("Array")}}
  • -
  • {{jsxref("Int8Array")}}
  • -
  • {{jsxref("Uint8Array")}}
  • -
  • {{jsxref("Uint8ClampedArray")}}
  • -
  • {{jsxref("Int16Array")}}
  • -
  • {{jsxref("Uint16Array")}}
  • -
  • {{jsxref("Int32Array")}}
  • -
  • {{jsxref("Uint32Array")}}
  • -
  • {{jsxref("Float32Array")}}
  • -
  • {{jsxref("Float64Array")}}
  • -
  • {{jsxref("ParallelArray")}} {{non-standard_inline()}}
  • -
-

Keyed collections

-

Collections of objects as keys. Elements iterable in insertion order.

-
    -
  • {{jsxref("Map")}} {{experimental_inline()}}
  • -
  • {{jsxref("Set")}} {{experimental_inline()}}
  • -
  • {{jsxref("WeakMap")}} {{experimental_inline()}}
  • -
  • {{jsxref("WeakSet")}} {{experimental_inline()}}
  • -
-

Structured data

-

Data buffers and JavaScript Object Notation.

-
    -
  • {{jsxref("ArrayBuffer")}}
  • -
  • {{jsxref("DataView")}}
  • -
  • {{jsxref("JSON")}}
  • -
-

Control abstraction objects

-
    -
  • {{jsxref("Iterator")}} {{non-standard_inline()}}
  • -
  • {{jsxref("Generator")}} {{experimental_inline()}}
  • -
  • {{jsxref("Promise")}} {{experimental_inline()}}
  • -
-

Reflection

-
    -
  • {{jsxref("Reflect")}} {{experimental_inline()}}
  • -
  • {{jsxref("Proxy")}} {{experimental_inline()}}
  • -
-

Internationalization

-

Additions to the ECMAScript core for language-sensitive functionalities.

-
    -
  • {{jsxref("Intl")}}
  • -
  • {{jsxref("Global_Objects/Collator", "Intl.Collator")}}
  • -
  • {{jsxref("Global_Objects/DateTimeFormat", "Intl.DateTimeFormat")}}
  • -
  • {{jsxref("Global_Objects/NumberFormat", "Intl.NumberFormat")}}
  • -
-

Other

- -
-

 

diff --git a/files/ar/web/javascript/reference/global_objects/json/index.html b/files/ar/web/javascript/reference/global_objects/json/index.html deleted file mode 100644 index 60305cbd07..0000000000 --- a/files/ar/web/javascript/reference/global_objects/json/index.html +++ /dev/null @@ -1,215 +0,0 @@ ---- -title: JSON -slug: Web/JavaScript/Reference/Global_Objects/JSON -tags: - - JSON - - JavaScript - - NeedsTranslation - - Object - - Reference - - TopicStub - - polyfill -translation_of: Web/JavaScript/Reference/Global_Objects/JSON ---- -
{{JSRef("Global_Objects", "JSON")}}
- -

Summary

-

The JSON object contains methods for parsing JavaScript Object Notation ({{glossary("JSON")}}) and converting values to JSON. It can't be called or constructed, and aside from its two method properties it has no interesting functionality of its own.

- -

Description

- -

JavaScript Object Notation

-

JSON is a syntax for serializing objects, arrays, numbers, strings, booleans, and {{jsxref("null")}}. It is based upon JavaScript syntax but is distinct from it: some JavaScript is not JSON, and some JSON is not JavaScript. See also JSON: The JavaScript subset that isn't.

- - - - - - - - - - - - - - - - - - - - - - -
JavaScript and JSON differences
JavaScript typeJSON differences
Objects and ArraysProperty names must be double-quoted strings; trailing commas are forbidden.
NumbersLeading zeros are prohibited; a decimal point must be followed by at least one digit.
Strings -

Only a limited sets of characters may be escaped; certain control characters are prohibited; the Unicode line separator (U+2028) and paragraph separator (U+2029) characters are permitted; strings must be double-quoted. See the following example where {{jsxref("JSON.parse()")}} works fine and a {{jsxref("SyntaxError")}} is thrown when evaluating the code as JavaScript:

-
-var code = '"\u2028\u2029"';
-JSON.parse(code); // works fine
-eval(code); // fails
-
-
-

The full JSON syntax is as follows:

-
JSON = null
-    or true or false
-    or JSONNumber
-    or JSONString
-    or JSONObject
-    or JSONArray
-
-JSONNumber = - PositiveNumber
-          or PositiveNumber
-PositiveNumber = DecimalNumber
-              or DecimalNumber . Digits
-              or DecimalNumber . Digits ExponentPart
-              or DecimalNumber ExponentPart
-DecimalNumber = 0
-             or OneToNine Digits
-ExponentPart = e Exponent
-            or E Exponent
-Exponent = Digits
-        or + Digits
-        or - Digits
-Digits = Digit
-      or Digits Digit
-Digit = 0 through 9
-OneToNine = 1 through 9
-
-JSONString = ""
-          or " StringCharacters "
-StringCharacters = StringCharacter
-                or StringCharacters StringCharacter
-StringCharacter = any character
-                  except " or \ or U+0000 through U+001F
-               or EscapeSequence
-EscapeSequence = \" or \/ or \\ or \b or \f or \n or \r or \t
-              or \u HexDigit HexDigit HexDigit HexDigit
-HexDigit = 0 through 9
-        or A through F
-        or a through f
-
-JSONObject = { }
-          or { Members }
-Members = JSONString : JSON
-       or Members , JSONString : JSON
-
-JSONArray = [ ]
-         or [ ArrayElements ]
-ArrayElements = JSON
-             or ArrayElements , JSON
-
-

Insignificant whitespace may be present anywhere except within a JSONNumber (numbers must contain no whitespace) or JSONString (where it is interpreted as the corresponding character in the string, or would cause an error). The tab character (U+0009), carriage return (U+000D), line feed (U+000A), and space (U+0020) characters are the only valid whitespace characters.

- -

Methods

-
-
{{jsxref("JSON.parse()")}}
-
Parse a string as JSON, optionally transform the produced value and its properties, and return the value.
-
{{jsxref("JSON.stringify()")}}
-
Return a JSON string corresponding to the specified value, optionally including only certain properties or replacing property values in a user-defined manner.
-
- -

Polyfill

-

The JSON object is not supported in older browsers. You can work around this by inserting the following code at the beginning of your scripts, allowing use of JSON object in implementations which do not natively support it (like Internet Explorer 6).

-

The following algorithm is an imitation of the native JSON object:

-
if (!window.JSON) {
-  window.JSON = {
-    parse: function(sJSON) { return eval('(' + sJSON + ')'); },
-    stringify: function(vContent) {
-      if (vContent instanceof Object) {
-        var sOutput = '';
-        if (vContent.constructor === Array) {
-          for (var nId = 0; nId < vContent.length; sOutput += this.stringify(vContent[nId]) + ',', nId++);
-          return '[' + sOutput.substr(0, sOutput.length - 1) + ']';
-        }
-        if (vContent.toString !== Object.prototype.toString) {
-          return '"' + vContent.toString().replace(/"/g, '\\$&') + '"';
-        }
-        for (var sProp in vContent) {
-          sOutput += '"' + sProp.replace(/"/g, '\\$&') + '":' + this.stringify(vContent[sProp]) + ',';
-        }
-        return '{' + sOutput.substr(0, sOutput.length - 1) + '}';
-     }
-     return typeof vContent === 'string' ? '"' + vContent.replace(/"/g, '\\$&') + '"' : String(vContent);
-    }
-  };
-}
-
-

More complex well-known polyfills for the JSON object are JSON2 and JSON3.

- -

Specifications

- - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES5.1', '#sec-15.12', 'JSON')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-json-object', 'JSON')}}{{Spec2('ES6')}} 
- -

Browser compatibility

-
{{CompatibilityTable}}
-
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatVersionUnknown}}{{CompatGeckoDesktop("1.9.1")}}{{CompatIE("8.0")}}{{CompatOpera("10.5")}}{{CompatSafari("4.0")}}
-
-
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoMobile("1.0")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
-

Based on Kangax's compat table.

- -

See also

- diff --git a/files/ar/web/javascript/reference/global_objects/map/index.html b/files/ar/web/javascript/reference/global_objects/map/index.html deleted file mode 100644 index ba5bc93804..0000000000 --- a/files/ar/web/javascript/reference/global_objects/map/index.html +++ /dev/null @@ -1,358 +0,0 @@ ---- -title: Map -slug: Web/JavaScript/Reference/Global_Objects/Map -translation_of: Web/JavaScript/Reference/Global_Objects/Map ---- -
{{JSRef}}
- -

The Map object holds key-value pairs and remembers the original insertion order of the keys. Any value (both objects and {{glossary("Primitive", "primitive values")}}) may be used as either a key or a value.

- -

Description

- -

A Map object iterates its elements in insertion order — a {{jsxref("Statements/for...of", "for...of")}} loop returns an array of [key, value] for each iteration.

- -

Key equality

- -
    -
  • Key equality is based on the sameValueZero algorithm.
  • -
  • {{jsxref("NaN")}} is considered the same as NaN (even though NaN !== NaN) and all other values are considered equal according to the semantics of the === operator.
  • -
  • In the current ECMAScript specification, -0 and +0 are considered equal, although this was not so in earlier drafts. See "Value equality for -0 and 0" in the Browser compatibility table for details.
  • -
- -

Objects vs. Maps

- -

{{jsxref("Object")}} is similar to Map—both let you set keys to values, retrieve those values, delete keys, and detect whether something is stored at a key. For this reason (and because there were no built-in alternatives), Objects have been used as Maps historically.

- -

However, there are important differences that make Map preferable in certain cases:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MapObject
Accidental KeysA Map does not contain any keys by default. It only contains what is explicitly put into it. -

An Object has a prototype, so it contains default keys that could collide with your own keys if you're not careful.

- -
-

Note: As of ES5, this can be bypassed by using {{jsxref("Object.create", "Object.create(null)")}}, but this is seldom done.

-
-
Key TypesA Map's keys can be any value (including functions, objects, or any primitive).The keys of an Object must be either a {{jsxref("String")}} or a {{jsxref("Symbol")}}.
Key Order -

The keys in Map are ordered. Thus, when iterating over it, a Map object returns keys in order of insertion.

-
-

The keys of an Object are not ordered.

- -
-

Note: Since ECMAScript 2015, objects do preserve creation order for string and Symbol keys. In JavaScript engines that comply with the ECMAScript 2015 spec, iterating over an object with only string keys will yield the keys in order of insertion.

-
-
SizeThe number of items in a Map is easily retrieved from its {{jsxref("Map.prototype.size", "size")}} property.The number of items in an Object must be determined manually.
IterationA Map is an iterable, so it can be directly iterated.Iterating over an Object requires obtaining its keys in some fashion and iterating over them.
Performance -

Performs better in scenarios involving frequent additions and removals of key-value pairs.

-
-

Not optimized for frequent additions and removals of key-value pairs.

-
- -

Setting object properties

- -

Setting Object properties works for Map objects as well, and can cause considerable confusion.

- -

Therefore, this appears to work in a way:

- -
let wrongMap = new Map()
-wrongMap['bla'] = 'blaa'
-wrongMap['bla2'] = 'blaaa2'
-
-console.log(wrongMap)  // Map { bla: 'blaa', bla2: 'blaaa2' }
-
- -

But that way of setting a property does not interact with the Map data structure. It uses the feature of the generic object. The value of 'bla' is not stored in the Map for queries. Othere operations on the data fail:

- -
wrongMap.has('bla')    // false
-wrongMap.delete('bla') // false
-console.log(wrongMap)  // Map { bla: 'blaa', bla2: 'blaaa2' }
- -

The correct usage for storing data in the Map is through the set(key, value) method.

- -
let contacts = new Map()
-contacts.set('Jessie', {phone: "213-555-1234", address: "123 N 1st Ave"})
-contacts.has('Jessie') // true
-contacts.get('Hilary') // undefined
-contacts.set('Hilary', {phone: "617-555-4321", address: "321 S 2nd St"})
-contacts.get('Jessie') // {phone: "213-555-1234", address: "123 N 1st Ave"}
-contacts.delete('Raymond') // false
-contacts.delete('Jessie') // true
-console.log(contacts.size) // 1
-
-
- -

Constructor

- -
-
{{jsxref("Map/Map", "Map()")}}
-
Creates a new Map object.
-
- -

Static properties

- -
-
{{jsxref("Map.@@species", "get Map[@@species]")}}
-
The constructor function that is used to create derived objects.
-
- -

Instance properties

- -
-
{{jsxref("Map.prototype.size")}}
-
Returns the number of key/value pairs in the Map object.
-
- -

Instance methods

- -
-
{{jsxref("Map.prototype.clear()")}}
-
Removes all key-value pairs from the Map object.
-
{{jsxref("Map.delete", "Map.prototype.delete(key)")}}
-
Returns true if an element in the Map object existed and has been removed, or false if the element does not exist. Map.prototype.has(key) will return false afterwards.
-
{{jsxref("Map.prototype.entries()")}}
-
Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order.
-
{{jsxref("Map.forEach", "Map.prototype.forEach(callbackFn[, thisArg])")}}
-
Calls callbackFn once for each key-value pair present in the Map object, in insertion order. If a thisArg parameter is provided to forEach, it will be used as the this value for each callback.
-
{{jsxref("Map.get", "Map.prototype.get(key)")}}
-
Returns the value associated to the key, or undefined if there is none.
-
{{jsxref("Map.has", "Map.prototype.has(key)")}}
-
Returns a boolean asserting whether a value has been associated to the key in the Map object or not.
-
{{jsxref("Map.prototype.keys()")}}
-
Returns a new Iterator object that contains the keys for each element in the Map object in insertion order.
-
{{jsxref("Map.set", "Map.prototype.set(key, value)")}}
-
Sets the value for the key in the Map object. Returns the Map object.
-
{{jsxref("Map.prototype.values()")}}
-
Returns a new Iterator object that contains the values for each element in the Map object in insertion order.
-
{{jsxref("Map.@@iterator", "Map.prototype[@@iterator]()")}}
-
Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order.
-
- -

Examples

- -

Using the Map object

- -
let myMap = new Map()
-
-let keyString = 'a string'
-let keyObj    = {}
-let keyFunc   = function() {}
-
-// setting the values
-myMap.set(keyString, "value associated with 'a string'")
-myMap.set(keyObj, 'value associated with keyObj')
-myMap.set(keyFunc, 'value associated with keyFunc')
-
-myMap.size              // 3
-
-// getting the values
-myMap.get(keyString)    // "value associated with 'a string'"
-myMap.get(keyObj)       // "value associated with keyObj"
-myMap.get(keyFunc)      // "value associated with keyFunc"
-
-myMap.get('a string')    // "value associated with 'a string'"
-                         // because keyString === 'a string'
-myMap.get({})            // undefined, because keyObj !== {}
-myMap.get(function() {}) // undefined, because keyFunc !== function () {}
-
- -

Using NaN as Map keys

- -

{{jsxref("NaN")}} can also be used as a key. Even though every NaN is not equal to itself (NaN !== NaN is true), the following example works because NaNs are indistinguishable from each other:

- -
let myMap = new Map()
-myMap.set(NaN, 'not a number')
-
-myMap.get(NaN)
-// "not a number"
-
-let otherNaN = Number('foo')
-myMap.get(otherNaN)
-// "not a number"
-
- -

Iterating Map with for..of

- -

Maps can be iterated using a for..of loop:

- -
let myMap = new Map()
-myMap.set(0, 'zero')
-myMap.set(1, 'one')
-
-for (let [key, value] of myMap) {
-  console.log(key + ' = ' + value)
-}
-// 0 = zero
-// 1 = one
-
-for (let key of myMap.keys()) {
-  console.log(key)
-}
-// 0
-// 1
-
-for (let value of myMap.values()) {
-  console.log(value)
-}
-// zero
-// one
-
-for (let [key, value] of myMap.entries()) {
-  console.log(key + ' = ' + value)
-}
-// 0 = zero
-// 1 = one
-
- -

Iterating Map with forEach()

- -

Maps can be iterated using the {{jsxref("Map.prototype.forEach", "forEach()")}} method:

- -
myMap.forEach(function(value, key) {
-  console.log(key + ' = ' + value)
-})
-// 0 = zero
-// 1 = one
-
- -

Relation with Array objects

- -
let kvArray = [['key1', 'value1'], ['key2', 'value2']]
-
-// Use the regular Map constructor to transform a 2D key-value Array into a map
-let myMap = new Map(kvArray)
-
-myMap.get('key1') // returns "value1"
-
-// Use Array.from() to transform a map into a 2D key-value Array
-console.log(Array.from(myMap)) // Will show you exactly the same Array as kvArray
-
-// A succinct way to do the same, using the spread syntax
-console.log([...myMap])
-
-// Or use the keys() or values() iterators, and convert them to an array
-console.log(Array.from(myMap.keys())) // ["key1", "key2"]
-
- -

Cloning and merging Maps

- -

Just like Arrays, Maps can be cloned:

- -
let original = new Map([
-  [1, 'one']
-])
-
-let clone = new Map(original)
-
-console.log(clone.get(1))       // one
-console.log(original === clone) // false (useful for shallow comparison)
- -
-

Important: Keep in mind that the data itself is not cloned.

-
- -

Maps can be merged, maintaining key uniqueness:

- -
let first = new Map([
-  [1, 'one'],
-  [2, 'two'],
-  [3, 'three'],
-])
-
-let second = new Map([
-  [1, 'uno'],
-  [2, 'dos']
-])
-
-// Merge two maps. The last repeated key wins.
-// Spread operator essentially converts a Map to an Array
-let merged = new Map([...first, ...second])
-
-console.log(merged.get(1)) // uno
-console.log(merged.get(2)) // dos
-console.log(merged.get(3)) // three
- -

Maps can be merged with Arrays, too:

- -
let first = new Map([
-  [1, 'one'],
-  [2, 'two'],
-  [3, 'three'],
-])
-
-let second = new Map([
-  [1, 'uno'],
-  [2, 'dos']
-])
-
-// Merge maps with an array. The last repeated key wins.
-let merged = new Map([...first, ...second, [1, 'eins']])
-
-console.log(merged.get(1)) // eins
-console.log(merged.get(2)) // dos
-console.log(merged.get(3)) // three
- -

Specifications

- - - - - - - - - - - - -
Specification
{{SpecName('ESDraft', '#sec-map-objects', 'Map')}}
- -

Browser compatibility

- - - -

{{Compat("javascript.builtins.Map")}}

- -

See also

- -
    -
  • {{jsxref("Set")}}
  • -
  • {{jsxref("WeakMap")}}
  • -
  • {{jsxref("WeakSet")}}
  • -
diff --git a/files/ar/web/javascript/reference/global_objects/math/index.html b/files/ar/web/javascript/reference/global_objects/math/index.html deleted file mode 100644 index dd3196e0ac..0000000000 --- a/files/ar/web/javascript/reference/global_objects/math/index.html +++ /dev/null @@ -1,190 +0,0 @@ ---- -title: رياضيات -slug: Web/JavaScript/Reference/Global_Objects/Math -translation_of: Web/JavaScript/Reference/Global_Objects/Math ---- -
{{JSRef}}
- -

Math is a built-in object that has properties and methods for mathematical constants and functions. Not a function object.

- -

Description

- -

Unlike the other global objects, Math is not a constructor. All properties and methods of Math are static. You refer to the constant pi as Math.PI and you call the sine function as Math.sin(x), where x is the method's argument. Constants are defined with the full precision of real numbers in JavaScript.

- -

Properties

- -
-
{{jsxref("Math.E")}}
-
Euler's constant and the base of natural logarithms, approximately 2.718.
-
{{jsxref("Math.LN2")}}
-
Natural logarithm of 2, approximately 0.693.
-
{{jsxref("Math.LN10")}}
-
Natural logarithm of 10, approximately 2.303.
-
{{jsxref("Math.LOG2E")}}
-
Base 2 logarithm of E, approximately 1.443.
-
{{jsxref("Math.LOG10E")}}
-
Base 10 logarithm of E, approximately 0.434.
-
{{jsxref("Math.PI")}}
-
Ratio of the circumference of a circle to its diameter, approximately 3.14159.
-
{{jsxref("Math.SQRT1_2")}}
-
Square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707.
-
{{jsxref("Math.SQRT2")}}
-
Square root of 2, approximately 1.414.
-
- -

Methods

- -
-

Note that the trigonometric functions (sin(), cos(), tan(), asin(), acos(), atan(), atan2()) expect or return angles in radians. To convert radians to degrees, divide by (Math.PI / 180), and multiply by this to convert the other way.

-
- -
-

Note that many math functions have a precision that's implementation-dependent. This means that different browsers can give a different result, and even the same JS engine on a different OS or architecture can give different results.

-
- -
-
{{jsxref("Global_Objects/Math/abs", "Math.abs(x)")}}
-
Returns the absolute value of a number.
-
{{jsxref("Global_Objects/Math/acos", "Math.acos(x)")}}
-
Returns the arccosine of a number.
-
{{jsxref("Global_Objects/Math/acosh", "Math.acosh(x)")}}
-
Returns the hyperbolic arccosine of a number.
-
{{jsxref("Global_Objects/Math/asin", "Math.asin(x)")}}
-
Returns the arcsine of a number.
-
{{jsxref("Global_Objects/Math/asinh", "Math.asinh(x)")}}
-
Returns the hyperbolic arcsine of a number.
-
{{jsxref("Global_Objects/Math/atan", "Math.atan(x)")}}
-
Returns the arctangent of a number.
-
{{jsxref("Global_Objects/Math/atanh", "Math.atanh(x)")}}
-
Returns the hyperbolic arctangent of a number.
-
{{jsxref("Global_Objects/Math/atan2", "Math.atan2(y, x)")}}
-
Returns the arctangent of the quotient of its arguments.
-
{{jsxref("Global_Objects/Math/cbrt", "Math.cbrt(x)")}}
-
Returns the cube root of a number.
-
{{jsxref("Global_Objects/Math/ceil", "Math.ceil(x)")}}
-
Returns the smallest integer greater than or equal to a number.
-
{{jsxref("Global_Objects/Math/clz32", "Math.clz32(x)")}}
-
Returns the number of leading zeroes of a 32-bit integer.
-
{{jsxref("Global_Objects/Math/cos", "Math.cos(x)")}}
-
Returns the cosine of a number.
-
{{jsxref("Global_Objects/Math/cosh", "Math.cosh(x)")}}
-
Returns the hyperbolic cosine of a number.
-
{{jsxref("Global_Objects/Math/exp", "Math.exp(x)")}}
-
Returns Ex, where x is the argument, and E is Euler's constant (2.718…), the base of the natural logarithm.
-
{{jsxref("Global_Objects/Math/expm1", "Math.expm1(x)")}}
-
Returns subtracting 1 from exp(x).
-
{{jsxref("Global_Objects/Math/floor", "Math.floor(x)")}}
-
Returns the largest integer less than or equal to a number.
-
{{jsxref("Global_Objects/Math/fround", "Math.fround(x)")}}
-
Returns the nearest single precision float representation of a number.
-
{{jsxref("Global_Objects/Math/hypot", "Math.hypot([x[, y[, …]]])")}}
-
Returns the square root of the sum of squares of its arguments.
-
{{jsxref("Global_Objects/Math/imul", "Math.imul(x, y)")}}
-
Returns the result of a 32-bit integer multiplication.
-
{{jsxref("Global_Objects/Math/log", "Math.log(x)")}}
-
Returns the natural logarithm (loge, also ln) of a number.
-
{{jsxref("Global_Objects/Math/log1p", "Math.log1p(x)")}}
-
Returns the natural logarithm (loge, also ln) of 1 + x for a number x.
-
{{jsxref("Global_Objects/Math/log10", "Math.log10(x)")}}
-
Returns the base 10 logarithm of a number.
-
{{jsxref("Global_Objects/Math/log2", "Math.log2(x)")}}
-
Returns the base 2 logarithm of a number.
-
{{jsxref("Global_Objects/Math/max", "Math.max([x[, y[, …]]])")}}
-
Returns the largest of zero or more numbers.
-
{{jsxref("Global_Objects/Math/min", "Math.min([x[, y[, …]]])")}}
-
Returns the smallest of zero or more numbers.
-
{{jsxref("Global_Objects/Math/pow", "Math.pow(x, y)")}}
-
Returns base to the exponent power, that is, baseexponent.
-
{{jsxref("Global_Objects/Math/random", "Math.random()")}}
-
Returns a pseudo-random number between 0 and 1.
-
{{jsxref("Global_Objects/Math/round", "Math.round(x)")}}
-
Returns the value of a number rounded to the nearest integer.
-
{{jsxref("Global_Objects/Math/sign", "Math.sign(x)")}}
-
Returns the sign of the x, indicating whether x is positive, negative or zero.
-
{{jsxref("Global_Objects/Math/sin", "Math.sin(x)")}}
-
Returns the sine of a number.
-
{{jsxref("Global_Objects/Math/sinh", "Math.sinh(x)")}}
-
Returns the hyperbolic sine of a number.
-
{{jsxref("Global_Objects/Math/sqrt", "Math.sqrt(x)")}}
-
Returns the positive square root of a number.
-
{{jsxref("Global_Objects/Math/tan", "Math.tan(x)")}}
-
Returns the tangent of a number.
-
{{jsxref("Global_Objects/Math/tanh", "Math.tanh(x)")}}
-
Returns the hyperbolic tangent of a number.
-
Math.toSource() {{non-standard_inline}}
-
Returns the string "Math".
-
{{jsxref("Global_Objects/Math/trunc", "Math.trunc(x)")}}
-
Returns the integer part of the number x, removing any fractional digits.
-
- -

Extending the Math object

- -

As with most of the built-in objects in JavaScript, the Math object can be extended with custom properties and methods. To extend the Math object, you do not use prototype. Instead, you directly extend Math:

- -
Math.propName = propValue;
-Math.methodName = methodRef;
- -

For instance, the following example adds a method to the Math object for calculating the greatest common divisor of a list of arguments.

- -
/* Variadic function -- Returns the greatest common divisor of a list of arguments */
-Math.gcd = function() {
-    if (arguments.length == 2) {
-        if (arguments[1] == 0)
-            return arguments[0];
-        else
-            return Math.gcd(arguments[1], arguments[0] % arguments[1]);
-    } else if (arguments.length > 2) {
-        var result = Math.gcd(arguments[0], arguments[1]);
-        for (var i = 2; i < arguments.length; i++)
-            result = Math.gcd(result, arguments[i]);
-        return result;
-    }
-};
- -

Try it:

- -
console.log(Math.gcd(20, 30, 15, 70, 40)); // `5`
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition. Implemented in JavaScript 1.1.
{{SpecName('ES5.1', '#sec-15.8', 'Math')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math-object', 'Math')}}{{Spec2('ES6')}}New methods {{jsxref("Math.log10()", "log10()")}}, {{jsxref("Math.log2()", "log2()")}}, {{jsxref("Math.log1p()", "log1p()")}}, {{jsxref("Math.expm1()", "expm1()")}}, {{jsxref("Math.cosh()", "cosh()")}}, {{jsxref("Math.sinh()", "sinh()")}}, {{jsxref("Math.tanh()", "tanh()")}}, {{jsxref("Math.acosh()", "acosh()")}}, {{jsxref("Math.asinh()", "asinh()")}}, {{jsxref("Math.atanh()", "atanh()")}}, {{jsxref("Math.hypot()", "hypot()")}}, {{jsxref("Math.trunc()", "trunc()")}}, {{jsxref("Math.sign()", "sign()")}}, {{jsxref("Math.imul()", "imul()")}}, {{jsxref("Math.fround()", "fround()")}}, {{jsxref("Math.cbrt()", "cbrt()")}} and {{jsxref("Math.clz32()", "clz32()")}} added.
{{SpecName('ESDraft', '#sec-math-object', 'Math')}}{{Spec2('ESDraft')}} 
- -

Browser compatibility

- - - -

{{Compat("javascript.builtins.Math")}}

- -

See also

- -
    -
  • {{jsxref("Number")}}
  • -
diff --git a/files/ar/web/javascript/reference/global_objects/number/index.html b/files/ar/web/javascript/reference/global_objects/number/index.html deleted file mode 100644 index 7f4d5996a4..0000000000 --- a/files/ar/web/javascript/reference/global_objects/number/index.html +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: الارقام في الجافا سكربت -slug: Web/JavaScript/Reference/Global_Objects/Number -translation_of: Web/JavaScript/Reference/Global_Objects/Number -original_slug: Web/JavaScript/Reference/Global_Objects/الارقام ---- -

 وهو كائن غلاف يستخدم لتمثيل ومعالجة الأرقام مثل  37  او 9.25 Numberمنشئ يحتوي على الثوابت وطرق للعمل مع الأرقام. يمكن تحويل قيم الأنواع الأخرى إلى أرقام باستخدام Number()الوظيفة.

- -

جافا سكريبت رقم نوع عبارة عن قيمة مزدوجة الدقة بتنسيق IEEE 754 تنسيق ثنائي 64 بت ذات ، كما هو الحال doubleفي Java أو C #. هذا يعني أنه يمكن أن يمثل قيمًا كسرية ، ولكن هناك بعض الحدود لما يمكن تخزينه. يحتفظ فقط بحوالي   17 رقم  منزلاً عشريًا من الدقة ؛ الحساب يخضع للتقريب . أكبر قيمة يمكن أن يحملها رقم هي حوالي 1.8 × 10 308 . يتم استبدال الأعداد التي تتجاوز ذلك بثابت الرقم الخاص Infinity.

- -

الرقم الحرفي مثل 37كود JavaScript هو قيمة فاصلة عائمة ، وليس عددًا صحيحًا. لا يوجد نوع عدد صحيح منفصل في الاستخدام اليومي الشائع. (يحتوي JavaScript الآن على BigIntنوع ، لكنه لم يتم تصميمه ليحل محل Number للاستخدامات اليومية. 37لا يزال رقمًا ، وليس BigInt.)

- -

يمكن أيضًا التعبير عن الرقم بأشكال حرفية مثل 0b101، 0o13، 0x0A. تعرف على المزيد حول العددي قواعد المعجم هنا .

diff --git a/files/ar/web/javascript/reference/global_objects/object/constructor/index.html b/files/ar/web/javascript/reference/global_objects/object/constructor/index.html deleted file mode 100644 index 140d95a732..0000000000 --- a/files/ar/web/javascript/reference/global_objects/object/constructor/index.html +++ /dev/null @@ -1,152 +0,0 @@ ---- -title: Object.prototype.constructor -slug: Web/JavaScript/Reference/Global_Objects/Object/constructor -translation_of: Web/JavaScript/Reference/Global_Objects/Object/constructor ---- -
{{JSRef}}
- -

بالرجوع إلى {{jsxref("Object")}}constructor ووظيفتها إنشاء حالات من الاوبجكت (الكائن) .نذكرك بأن قيمة الخصائص التي تشير إليها تلك الفانكشان تشير لنفسها ولا تشير إلى سلسة تحتوي على إسم الفانكشان القيمة تقرأ فقط قيم بدائية مثل 1true و "test".

- -

الوصف

- -

جميع الاوبجكت ( مع بعض الاستثائات نشأت مع Object.create(null)  ) وستملك وقتها جميعا خاصية الـ constructor . اما  الكائنات المنشأة بدون إستخدام الكونستراكتور بشكل صريح ( مثل  object & array literals )  ستملك أيضا خصائص الكونستركتور بشكل أساسي

- -
var o = {};
-o.constructor === Object; // true
-
-var o = new Object;
-o.constructor === Object; // true
-
-var a = [];
-a.constructor === Array; // true
-
-var a = new Array;
-a.constructor === Array; // true
-
-var n = new Number(3);
-n.constructor === Number; // true
-
- -

أمثلة

- -

عرض الكونستركتور للأوبجكت

- -

في المثال التالي قمنا بإنشاء بروتوتيب Tree و اوبجكت بإسم theTree  المثال هنا يعرض خصائص الـconstructor للكائن theTree

- -
function Tree(name) {
-  this.name = name;
-}
-
-var theTree = new Tree('Redwood');
-console.log('theTree.constructor is ' + theTree.constructor);
-
- -

عندما تقوم بكتابة الكود بعالية  ستحصل على النتيجة الاتية ليوضح لك أكثر  :-

- -
theTree.constructor is function Tree(name) {
-  this.name = name;
-}
-
- -

تغير الكونستركتور الخاص بالاوبجكت

- -

The following example shows how to modify constructor value of generic objects. Only true, 1 and "test" will not be affected as they have read-only native constructors. This example shows that it is not always safe to rely on the constructor property of an object.

- -
function Type () {}
-
-var types = [
-  new Array(),
-  [],
-  new Boolean(),
-  true,             // remains unchanged
-  new Date(),
-  new Error(),
-  new Function(),
-  function () {},
-  Math,
-  new Number(),
-  1,                // remains unchanged
-  new Object(),
-  {},
-  new RegExp(),
-  /(?:)/,
-  new String(),
-  'test'            // remains unchanged
-];
-
-for (var i = 0; i < types.length; i++) {
-  types[i].constructor = Type;
-  types[i] = [types[i].constructor, types[i] instanceof Type, types[i].toString()];
-}
-
-console.log(types.join('\n'));
-
- -

This example displays the following output:

- -
function Type() {},false,
-function Type() {},false,
-function Type() {},false,false
-function Boolean() {
-    [native code]
-},false,true
-function Type() {},false,Mon Sep 01 2014 16:03:49 GMT+0600
-function Type() {},false,Error
-function Type() {},false,function anonymous() {
-
-}
-function Type() {},false,function () {}
-function Type() {},false,[object Math]
-function Type() {},false,0
-function Number() {
-    [native code]
-},false,1
-function Type() {},false,[object Object]
-function Type() {},false,[object Object]
-function Type() {},false,/(?:)/
-function Type() {},false,/(?:)/
-function Type() {},false,
-function String() {
-    [native code]
-},false,test
-
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition. Implemented in JavaScript 1.1.
{{SpecName('ES5.1', '#sec-15.2.4.1', 'Object.prototype.constructor')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-object.prototype.constructor', 'Object.prototype.constructor')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-object.prototype.constructor', 'Object.prototype.constructor')}}{{Spec2('ESDraft')}} 
- -

دعم  المتصفحات

- -
- - -

{{Compat("javascript.builtins.Object.constructor")}}

-
diff --git a/files/ar/web/javascript/reference/global_objects/object/index.html b/files/ar/web/javascript/reference/global_objects/object/index.html deleted file mode 100644 index 2eb7c3bb18..0000000000 --- a/files/ar/web/javascript/reference/global_objects/object/index.html +++ /dev/null @@ -1,182 +0,0 @@ ---- -title: Object -slug: Web/JavaScript/Reference/Global_Objects/Object -tags: - - Constructor - - JavaScript - - NeedsTranslation - - Object - - TopicStub -translation_of: Web/JavaScript/Reference/Global_Objects/Object ---- -
{{JSRef}}
- -

The Object constructor creates an object wrapper.

- -

Syntax

- -
// Object initialiser or literal
-{ [ nameValuePair1[, nameValuePair2[, ...nameValuePairN] ] ] }
-
-// Called as a constructor
-new Object([value])
- -

Parameters

- -
-
nameValuePair1, nameValuePair2, ... nameValuePairN
-
Pairs of names (strings) and values (any value) where the name is separated from the value by a colon.
-
value
-
Any value.
-
- -

Description

- -

The Object constructor creates an object wrapper for the given value. If the value is {{jsxref("null")}} or {{jsxref("undefined")}}, it will create and return an empty object, otherwise, it will return an object of a Type that corresponds to the given value. If the value is an object already, it will return the value.

- -

When called in a non-constructor context, Object behaves identically to new Object().

- -

See also the object initializer / literal syntax.

- -

Properties of the Object constructor

- -
-
Object.length
-
Has a value of 1.
-
{{jsxref("Object.prototype")}}
-
Allows the addition of properties to all objects of type Object.
-
- -

Methods of the Object constructor

- -
-
{{jsxref("Object.assign()")}}
-
Copies the values of all enumerable own properties from one or more source objects to a target object.
-
{{jsxref("Object.create()")}}
-
Creates a new object with the specified prototype object and properties.
-
{{jsxref("Object.defineProperty()")}}
-
Adds the named property described by a given descriptor to an object.
-
{{jsxref("Object.defineProperties()")}}
-
Adds the named properties described by the given descriptors to an object.
-
{{jsxref("Object.entries()")}}
-
Returns an array containing all of the [key, value] pairs of a given object's own enumerable string properties.
-
{{jsxref("Object.freeze()")}}
-
Freezes an object: other code can't delete or change any properties.
-
{{jsxref("Object.getOwnPropertyDescriptor()")}}
-
Returns a property descriptor for a named property on an object.
-
{{jsxref("Object.getOwnPropertyDescriptors()")}}
-
Returns an object containing all own property descriptors for an object.
-
{{jsxref("Object.getOwnPropertyNames()")}}
-
Returns an array containing the names of all of the given object's own enumerable and non-enumerable properties.
-
{{jsxref("Object.getOwnPropertySymbols()")}}
-
Returns an array of all symbol properties found directly upon a given object.
-
{{jsxref("Object.getPrototypeOf()")}}
-
Returns the prototype of the specified object.
-
{{jsxref("Object.is()")}}
-
Compares if two values are the same value. Equates all NaN values (which differs from both Abstract Equality Comparison and Strict Equality Comparison).
-
{{jsxref("Object.isExtensible()")}}
-
Determines if extending of an object is allowed.
-
{{jsxref("Object.isFrozen()")}}
-
Determines if an object was frozen.
-
{{jsxref("Object.isSealed()")}}
-
Determines if an object is sealed.
-
{{jsxref("Object.keys()")}}
-
Returns an array containing the names of all of the given object's own enumerable string properties.
-
{{jsxref("Object.preventExtensions()")}}
-
Prevents any extensions of an object.
-
{{jsxref("Object.seal()")}}
-
Prevents other code from deleting properties of an object.
-
{{jsxref("Object.setPrototypeOf()")}}
-
Sets the prototype (i.e., the internal [[Prototype]] property).
-
{{jsxref("Object.values()")}}
-
Returns an array containing the values that correspond to all of a given object's own enumerable string properties.
-
- -

Object instances and Object prototype object

- -

All objects in JavaScript are descended from Object; all objects inherit methods and properties from {{jsxref("Object.prototype")}}, although they may be overridden. For example, other constructors' prototypes override the constructor property and provide their own toString() methods. Changes to the Object prototype object are propagated to all objects unless the properties and methods subject to those changes are overridden further along the prototype chain.

- -

Properties

- -
{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/prototype', 'Properties') }}
- -

Methods

- -
{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/prototype', 'Methods') }}
- -

Deleting a property from an object

- -

There isn't any method in an Object itself to delete its own properties (e.g. like Map.prototype.delete()). To do so one has to use the delete operator.

- -

Examples

- -

Using Object given undefined and null types

- -

The following examples store an empty Object object in o:

- -
var o = new Object();
-
- -
var o = new Object(undefined);
-
- -
var o = new Object(null);
-
- -

Using Object to create Boolean objects

- -

The following examples store {{jsxref("Boolean")}} objects in o:

- -
// equivalent to o = new Boolean(true);
-var o = new Object(true);
-
- -
// equivalent to o = new Boolean(false);
-var o = new Object(Boolean());
-
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition. Implemented in JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.2', 'Object')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-object-objects', 'Object')}}{{Spec2('ES6')}}Added Object.assign, Object.getOwnPropertySymbols, Object.setPrototypeOf, Object.is
{{SpecName('ESDraft', '#sec-object-objects', 'Object')}}{{Spec2('ESDraft')}}Added Object.entries, Object.values and Object.getOwnPropertyDescriptors.
- -

Browser compatibility

- -
- - -

{{Compat("javascript.builtins.Object")}}

-
- -

See also

- - diff --git a/files/ar/web/javascript/reference/global_objects/string/index.html b/files/ar/web/javascript/reference/global_objects/string/index.html deleted file mode 100644 index 4dd72a6601..0000000000 --- a/files/ar/web/javascript/reference/global_objects/string/index.html +++ /dev/null @@ -1,314 +0,0 @@ ---- -title: خيط -slug: Web/JavaScript/Reference/Global_Objects/String -tags: - - ECMAScript 2015 - - JavaScript - - NeedsTranslation - - Reference - - String - - TopicStub -translation_of: Web/JavaScript/Reference/Global_Objects/String ---- -
{{JSRef}}
- -

The String global object is a constructor for strings, or a sequence of characters.

- -

Syntax

- -

String literals take the forms:

- -
'string text'
-"string text"
-"中文 español deutsch English हिन्दी العربية português বাংলা русский 日本語 ਪੰਜਾਬੀ 한국어 தமிழ் עברית"
- -

Strings can also be created using the String global object directly:

- -
String(thing)
- -

Parameters

- -
-
thing
-
Anything to be converted to a string.
-
- -

Template literals

- -

Starting with ECMAScript 2015, string literals can also be so-called Template literals:

- -
`hello world`
-`hello!
- world!`
-`hello ${who}`
-escape `<a>${who}</a>`
- -
-
- -

Escape notation

- -

Beside regular, printable characters, special characters can be encoded using escape notation:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CodeOutput
\0the NULL character
\'single quote
\"double quote
\\backslash
\nnew line
\rcarriage return
\vvertical tab
\ttab
\bbackspace
\fform feed
\uXXXXunicode codepoint
\u{X} ... \u{XXXXXX}unicode codepoint {{experimental_inline}}
\xXXthe Latin-1 character
- -
-

Unlike some other languages, JavaScript makes no distinction between single-quoted strings and double-quoted strings; therefore, the escape sequences above work in strings created with either single or double quotes.

-
- -
-
- -

Long literal strings

- -

Sometimes, your code will include strings which are very long. Rather than having lines that go on endlessly, or wrap at the whim of your editor, you may wish to specifically break the string into multiple lines in the source code without affecting the actual string contents. There are two ways you can do this.

- -

You can use the + operator to append multiple strings together, like this:

- -
let longString = "This is a very long string which needs " +
-                 "to wrap across multiple lines because " +
-                 "otherwise my code is unreadable.";
-
- -

Or you can use the backslash character ("\") at the end of each line to indicate that the string will continue on the next line. Make sure there is no space or any other character after the backslash (except for a line break), or as an indent; otherwise it will not work. That form looks like this:

- -
let longString = "This is a very long string which needs \
-to wrap across multiple lines because \
-otherwise my code is unreadable.";
-
- -

Both of these result in identical strings being created.

- -

Description

- -

Strings are useful for holding data that can be represented in text form. Some of the most-used operations on strings are to check their {{jsxref("String.length", "length")}}, to build and concatenate them using the + and += string operators, checking for the existence or location of substrings with the {{jsxref("String.prototype.indexOf()", "indexOf()")}} method, or extracting substrings with the {{jsxref("String.prototype.substring()", "substring()")}} method.

- -

Character access

- -

There are two ways to access an individual character in a string. The first is the {{jsxref("String.prototype.charAt()", "charAt()")}} method:

- -
return 'cat'.charAt(1); // returns "a"
-
- -

The other way (introduced in ECMAScript 5) is to treat the string as an array-like object, where individual characters correspond to a numerical index:

- -
return 'cat'[1]; // returns "a"
-
- -

For character access using bracket notation, attempting to delete or assign a value to these properties will not succeed. The properties involved are neither writable nor configurable. (See {{jsxref("Object.defineProperty()")}} for more information.)

- -

Comparing strings

- -

C developers have the strcmp() function for comparing strings. In JavaScript, you just use the less-than and greater-than operators:

- -
var a = 'a';
-var b = 'b';
-if (a < b) { // true
-  console.log(a + ' is less than ' + b);
-} else if (a > b) {
-  console.log(a + ' is greater than ' + b);
-} else {
-  console.log(a + ' and ' + b + ' are equal.');
-}
-
- -

A similar result can be achieved using the {{jsxref("String.prototype.localeCompare()", "localeCompare()")}} method inherited by String instances.

- -

Distinction between string primitives and String objects

- -

Note that JavaScript distinguishes between String objects and primitive string values. (The same is true of {{jsxref("Boolean")}} and {{jsxref("Global_Objects/Number", "Numbers")}}.)

- -

String literals (denoted by double or single quotes) and strings returned from String calls in a non-constructor context (i.e., without using the {{jsxref("Operators/new", "new")}} keyword) are primitive strings. JavaScript automatically converts primitives to String objects, so that it's possible to use String object methods for primitive strings. In contexts where a method is to be invoked on a primitive string or a property lookup occurs, JavaScript will automatically wrap the string primitive and call the method or perform the property lookup.

- -
var s_prim = 'foo';
-var s_obj = new String(s_prim);
-
-console.log(typeof s_prim); // Logs "string"
-console.log(typeof s_obj);  // Logs "object"
-
- -

String primitives and String objects also give different results when using {{jsxref("Global_Objects/eval", "eval()")}}. Primitives passed to eval are treated as source code; String objects are treated as all other objects are, by returning the object. For example:

- -
var s1 = '2 + 2';             // creates a string primitive
-var s2 = new String('2 + 2'); // creates a String object
-console.log(eval(s1));        // returns the number 4
-console.log(eval(s2));        // returns the string "2 + 2"
-
- -

For these reasons, code may break when it encounters String objects when it expects a primitive string instead, although generally authors need not worry about the distinction.

- -

A String object can always be converted to its primitive counterpart with the {{jsxref("String.prototype.valueOf()", "valueOf()")}} method.

- -
console.log(eval(s2.valueOf())); // returns the number 4
-
- -
Note: For another possible approach to strings in JavaScript, please read the article about StringView — a C-like representation of strings based on typed arrays.
- -

Properties

- -
-
{{jsxref("String.prototype")}}
-
Allows the addition of properties to a String object.
-
- -

Methods

- -
-
{{jsxref("String.fromCharCode()")}}
-
Returns a string created by using the specified sequence of Unicode values.
-
{{jsxref("String.fromCodePoint()")}} {{experimental_inline}}
-
Returns a string created by using the specified sequence of code points.
-
{{jsxref("String.raw()")}} {{experimental_inline}}
-
Returns a string created from a raw template string.
-
- -

String generic methods

- -
-

String generics are non-standard, deprecated and will get removed near future.

-
- -

The String instance methods are also available in Firefox as of JavaScript 1.6 (not part of the ECMAScript standard) on the String object for applying String methods to any object:

- -
var num = 15;
-console.log(String.replace(num, /5/, '2'));
-
- -

For migrating away from String generics, see also Warning: String.x is deprecated; use String.prototype.x instead.

- -

{{jsxref("Global_Objects/Array", "Generics", "#Array_generic_methods", 1)}} are also available on {{jsxref("Array")}} methods.

- -

String instances

- -

Properties

- -
{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/prototype', 'Properties')}}
- -

Methods

- -

Methods unrelated to HTML

- -
{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/prototype', 'Methods_unrelated_to_HTML')}}
- -

HTML wrapper methods

- -
{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/prototype', 'HTML_wrapper_methods')}}
- -

Examples

- -

String conversion

- -

It's possible to use String as a "safer" {{jsxref("String.prototype.toString()", "toString()")}} alternative, although it still normally calls the underlying toString(). It also works for {{jsxref("null")}}, {{jsxref("undefined")}}, and for {{jsxref("Symbol", "symbols")}}. For example:

- -
var outputStrings = [];
-for (var i = 0, n = inputValues.length; i < n; ++i) {
-  outputStrings.push(String(inputValues[i]));
-}
-
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition.
{{SpecName('ES5.1', '#sec-15.5', 'String')}}{{Spec2('ES5.1')}}
{{SpecName('ES2015', '#sec-string-objects', 'String')}}{{Spec2('ES2015')}}
{{SpecName('ESDraft', '#sec-string-objects', 'String')}}{{Spec2('ESDraft')}}
- -

Browser compatibility

- - - -

{{Compat("javascript.builtins.String.String")}}

- -

See also

- - diff --git a/files/ar/web/javascript/reference/global_objects/string/startswith/index.html b/files/ar/web/javascript/reference/global_objects/string/startswith/index.html deleted file mode 100644 index 94b059d593..0000000000 --- a/files/ar/web/javascript/reference/global_objects/string/startswith/index.html +++ /dev/null @@ -1,101 +0,0 @@ ---- -title: String.prototype.startsWith() -slug: Web/JavaScript/Reference/Global_Objects/String/startsWith -translation_of: Web/JavaScript/Reference/Global_Objects/String/startsWith ---- -
{{JSRef}}
- -

startsWith()
- .طريقة يمكنك تحقق بها إن كان نص يبدء بالعبارة ما و تعيد لك صحيح أو خطأ

- -
{{EmbedInteractiveExample("pages/js/string-startswith.html")}}
- - - -

تركيب الجملة | Syntax

- -
str.startsWith(searchString[, position])
- -

المعاملات | Parameters

- -
-
searchString
-
العبارة المبحوث عنها فيالنص.
-
position {{optional_inline}}
-
مكان الذي يبدأ البحث منه فيالنص   الإفتراضي 0
-
- -

القيمة العائدة | Return value

- -

العائد يكون صحيح إذا وجد تطابق
- و إن لم يجيد تطابق يعيد لك خطأ

- -

الوصف | Description

- -

هذه الطريقة حساسة إتجاه الحروف
- case-sensitive

- -

أمثلة | Examples

- -

Using startsWith()

- -
//startswith
-var str = 'To be, or not to be, that is the question.';
-
-console.log(str.startsWith('To be'));         // true
-console.log(str.startsWith('not to be'));     // false
-console.log(str.startsWith('not to be', 10)); // true
-
- -

Polyfill

- -

This method has been added to the ECMAScript 2015 specification and may not be available in all JavaScript implementations yet. However, you can polyfill String.prototype.startsWith() with the following snippet:

- -
if (!String.prototype.startsWith) {
-    Object.defineProperty(String.prototype, 'startsWith', {
-        value: function(search, pos) {
-            pos = !pos || pos < 0 ? 0 : +pos;
-            return this.substring(pos, pos + search.length) === search;
-        }
-    });
-}
-
- -

A more robust (fully ES2015 specification compliant), but less performant and compact, Polyfill is available on GitHub by Mathias Bynens.

- -

Specifications

- - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES2015', '#sec-string.prototype.startswith', 'String.prototype.startsWith')}}{{Spec2('ES2015')}}Initial definition.
{{SpecName('ESDraft', '#sec-string.prototype.startswith', 'String.prototype.startsWith')}}{{Spec2('ESDraft')}}
- -

توافق مع متصفحات

- - - -

{{Compat("javascript.builtins.String.startsWith")}}

- -

ذات صلة

- -
    -
  • {{jsxref("String.prototype.endsWith()")}}
  • -
  • {{jsxref("String.prototype.includes()")}}
  • -
  • {{jsxref("String.prototype.indexOf()")}}
  • -
  • {{jsxref("String.prototype.lastIndexOf()")}}
  • -
diff --git a/files/ar/web/javascript/reference/index.html b/files/ar/web/javascript/reference/index.html deleted file mode 100644 index db41d77223..0000000000 --- a/files/ar/web/javascript/reference/index.html +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: مرجع جافا سكريبت -slug: Web/JavaScript/Reference -tags: - - JavaScript - - NeedsTranslation - - TopicStub -translation_of: Web/JavaScript/Reference ---- -
{{JsSidebar}}
- -

This part of the JavaScript section on MDN serves as a repository of facts about the JavaScript language. Read more about this reference.

- -

Global Objects

- -

This chapter documents all the JavaScript standard built-in objects, along with their methods and properties.

- -
{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects', 'Standard objects (by category)')}}
- -

Statements

- -

This chapter documents all the JavaScript statements and declarations.

- -
{{page('/en-US/docs/Web/JavaScript/Reference/Statements', 'Statements_and_declarations_by_category')}}
- -

Expressions and operators

- -

This chapter documents all the JavaScript expressions and operators.

- -
{{page('/en-US/docs/Web/JavaScript/Reference/Operators', 'Expressions_and_operators_by_category')}}
- -

Functions

- -

This chapter documents how to work with JavaScript functions to develop your applications.

- - - -

Additional reference pages

- - diff --git a/files/ar/web/javascript/reference/operators/destructuring_assignment/index.html b/files/ar/web/javascript/reference/operators/destructuring_assignment/index.html deleted file mode 100644 index d926351173..0000000000 --- a/files/ar/web/javascript/reference/operators/destructuring_assignment/index.html +++ /dev/null @@ -1,428 +0,0 @@ ---- -title: Destructuring assignment -slug: Web/JavaScript/Reference/Operators/Destructuring_assignment -translation_of: Web/JavaScript/Reference/Operators/Destructuring_assignment ---- -
{{jsSidebar("Operators")}}
- -
الإسناد بالتفكيك هو تعبير جافاسكربت يجعل من الممكن فك القيم من المصفوفات ( Arrays ) أو الخصائص من الكائنات ( Objects ) إلى متغيرات مميزة.
- -
- -
{{EmbedInteractiveExample("pages/js/expressions-destructuringassignment.html", "taller")}}
- - - -

Syntax

- -
let a, b, rest;
-[a, b] = [10, 20];
-console.log(a); // 10
-console.log(b); // 20
-
-[a, b, ...rest] = [10, 20, 30, 40, 50];
-console.log(a); // 10
-console.log(b); // 20
-console.log(rest); // [30, 40, 50]
-
-({ a, b } = { a: 10, b: 20 });
-console.log(a); // 10
-console.log(b); // 20
-
-
-// Stage 4(finished) proposal
-({a, b, ...rest} = {a: 10, b: 20, c: 30, d: 40});
-console.log(a); // 10
-console.log(b); // 20
-console.log(rest); // {c: 30, d: 40}
-
- -

التفاصيل

- -

توفر تعبيرات الكائن (Object) والمصفوفة (Array) طريقة سهلة لإنشاء حزم بيانات مخصصة.

- -
const x = [1, 2, 3, 4, 5];
-
- -

يَستخدِم الإسناد بالتفكيك (destructuring assignment) بنية مماثلة، ولكن على الجانب الأيسر من المهمة لتحديد القيم التي يجب فكها من مصدر المتغير الأساسي.

- -
const x = [1, 2, 3, 4, 5];
-const [y, z] = x;
-console.log(y); // 1
-console.log(z); // 2
-
- -

تشبه هذه الإمكانية الميزات الموجودة بلغات مثل Perl و Python.

- -

- -

تفكيك المصفوفات

- -

تعيين المتغير الأساسي

- -
const foo = ['one', 'two', 'three'];
-
-const [red, yellow, green] = foo;
-console.log(red); // "one"
-console.log(yellow); // "two"
-console.log(green); // "three"
-
- -

Assignment separate from declaration

- -

A variable can be assigned its value via destructuring separate from the variable's declaration.

- -
let a, b;
-
-[a, b] = [1, 2];
-console.log(a); // 1
-console.log(b); // 2
-
- -

Default values

- -

A variable can be assigned a default, in the case that the value unpacked from the array is undefined.

- -
let a, b;
-
-[a=5, b=7] = [1];
-console.log(a); // 1
-console.log(b); // 7
-
- -

Swapping variables

- -

Two variables values can be swapped in one destructuring expression.

- -

Without destructuring assignment, swapping two values requires a temporary variable (or, in some low-level languages, the XOR-swap trick).

- -
let a = 1;
-let b = 3;
-
-[a, b] = [b, a];
-console.log(a); // 3
-console.log(b); // 1
-
-const arr = [1,2,3];
-[arr[2], arr[1]] = [arr[1], arr[2]];
-console.log(arr); // [1,3,2]
-
-
- -

Parsing an array returned from a function

- -

It's always been possible to return an array from a function. Destructuring can make working with an array return value more concise.

- -

In this example, f() returns the values [1, 2] as its output, which can be parsed in a single line with destructuring.

- -
function f() {
-  return [1, 2];
-}
-
-let a, b;
-[a, b] = f();
-console.log(a); // 1
-console.log(b); // 2
-
- -

Ignoring some returned values

- -

You can ignore return values that you're not interested in:

- -
function f() {
-  return [1, 2, 3];
-}
-
-const [a, , b] = f();
-console.log(a); // 1
-console.log(b); // 3
-
-const [c] = f();
-console.log(c); // 1
-
- -

You can also ignore all returned values:

- -
[,,] = f();
-
- -

Assigning the rest of an array to a variable

- -

When destructuring an array, you can unpack and assign the remaining part of it to a variable using the rest pattern:

- -
const [a, ...b] = [1, 2, 3];
-console.log(a); // 1
-console.log(b); // [2, 3]
- -

Be aware that a {{jsxref("SyntaxError")}} will be thrown if a trailing comma is used on the left-hand side with a rest element:

- -
const [a, ...b,] = [1, 2, 3];
-
-// SyntaxError: rest element may not have a trailing comma
-// Always consider using rest operator as the last element
-
- -

Unpacking values from a regular expression match

- -

When the regular expression exec() method finds a match, it returns an array containing first the entire matched portion of the string and then the portions of the string that matched each parenthesized group in the regular expression. Destructuring assignment allows you to unpack the parts out of this array easily, ignoring the full match if it is not needed.

- -
function parseProtocol(url) {
-  const parsedURL = /^(\w+)\:\/\/([^\/]+)\/(.*)$/.exec(url);
-  if (!parsedURL) {
-    return false;
-  }
-  console.log(parsedURL); // ["https://developer.mozilla.org/en-US/Web/JavaScript", "https", "developer.mozilla.org", "en-US/Web/JavaScript"]
-
-  const [, protocol, fullhost, fullpath] = parsedURL;
-  return protocol;
-}
-
-console.log(parseProtocol('https://developer.mozilla.org/en-US/Web/JavaScript')); // "https"
-
- -

Object destructuring

- -

Basic assignment

- -
const user = {
-    id: 42,
-    is_verified: true
-};
-
-const {id, is_verified} = user;
-
-console.log(id); // 42
-console.log(is_verified); // true
-
- -

Assignment without declaration

- -

A variable can be assigned its value with destructuring separate from its declaration.

- -
let a, b;
-
-({a, b} = {a: 1, b: 2});
- -
-

Notes: The parentheses ( ... ) around the assignment statement are required when using object literal destructuring assignment without a declaration.

- -

{a, b} = {a: 1, b: 2} is not valid stand-alone syntax, as the {a, b} on the left-hand side is considered a block and not an object literal.

- -

However, ({a, b} = {a: 1, b: 2}) is valid, as is const {a, b} = {a: 1, b: 2}

- -

Your ( ... ) expression needs to be preceded by a semicolon or it may be used to execute a function on the previous line.

-
- -

Assigning to new variable names

- -

A property can be unpacked from an object and assigned to a variable with a different name than the object property.

- -
const o = {p: 42, q: true};
-const {p: foo, q: bar} = o;
-
-console.log(foo); // 42
-console.log(bar); // true
- -

Here, for example, const {p: foo} = o takes from the object o the property named p and assigns it to a local variable named foo.

- -

Default values

- -

A variable can be assigned a default, in the case that the value unpacked from the object is undefined.

- -
const {a = 10, b = 5} = {a: 3};
-
-console.log(a); // 3
-console.log(b); // 5
- -

Assigning to new variables names and providing default values

- -

A property can be both 1) unpacked from an object and assigned to a variable with a different name and 2) assigned a default value in case the unpacked value is undefined.

- -
const {a: aa = 10, b: bb = 5} = {a: 3};
-
-console.log(aa); // 3
-console.log(bb); // 5
-
- -

Unpacking fields from objects passed as function parameter

- -
const user = {
-  id: 42,
-  displayName: 'jdoe',
-  fullName: {
-    firstName: 'John',
-    lastName: 'Doe'
-  }
-};
-
-function userId({id}) {
-  return id;
-}
-
-function whois({displayName, fullName: {firstName: name}}) {
-  return `${displayName} is ${name}`;
-}
-
-console.log(userId(user)); // 42
-console.log(whois(user));  // "jdoe is John"
- -

This unpacks the id, displayName and firstName from the user object and prints them.

- -

Setting a function parameter's default value

- -
function drawChart({size = 'big', coords = {x: 0, y: 0}, radius = 25} = {}) {
-  console.log(size, coords, radius);
-  // do some chart drawing
-}
-
-drawChart({
-  coords: {x: 18, y: 30},
-  radius: 30
-});
- -
-

In the function signature for drawChart above, the destructured left-hand side is assigned to an empty object literal on the right-hand side: {size = 'big', coords = {x: 0, y: 0}, radius = 25} = {}. You could have also written the function without the right-hand side assignment. However, if you leave out the right-hand side assignment, the function will look for at least one argument to be supplied when invoked, whereas in its current form, you can simply call drawChart() without supplying any parameters. The current design is useful if you want to be able to call the function without supplying any parameters, the other can be useful when you want to ensure an object is passed to the function.

-
- -

Nested object and array destructuring

- -
const metadata = {
-  title: 'Scratchpad',
-  translations: [
-    {
-      locale: 'de',
-      localization_tags: [],
-      last_edit: '2014-04-14T08:43:37',
-      url: '/de/docs/Tools/Scratchpad',
-      title: 'JavaScript-Umgebung'
-    }
-  ],
-  url: '/en-US/docs/Tools/Scratchpad'
-};
-
-let {
-  title: englishTitle, // rename
-  translations: [
-    {
-       title: localeTitle, // rename
-    },
-  ],
-} = metadata;
-
-console.log(englishTitle); // "Scratchpad"
-console.log(localeTitle);  // "JavaScript-Umgebung"
- -

For of iteration and destructuring

- -
const people = [
-  {
-    name: 'Mike Smith',
-    family: {
-      mother: 'Jane Smith',
-      father: 'Harry Smith',
-      sister: 'Samantha Smith'
-    },
-    age: 35
-  },
-  {
-    name: 'Tom Jones',
-    family: {
-      mother: 'Norah Jones',
-      father: 'Richard Jones',
-      brother: 'Howard Jones'
-    },
-    age: 25
-  }
-];
-
-for (const {name: n, family: {father: f}} of people) {
-  console.log('Name: ' + n + ', Father: ' + f);
-}
-
-// "Name: Mike Smith, Father: Harry Smith"
-// "Name: Tom Jones, Father: Richard Jones"
-
- -

Computed object property names and destructuring

- -

Computed property names, like on object literals, can be used with destructuring.

- -
let key = 'z';
-let {[key]: foo} = {z: 'bar'};
-
-console.log(foo); // "bar"
-
- -

Rest in Object Destructuring

- -

The Rest/Spread Properties for ECMAScript proposal (stage 4) adds the rest syntax to destructuring. Rest properties collect the remaining own enumerable property keys that are not already picked off by the destructuring pattern.

- -
let {a, b, ...rest} = {a: 10, b: 20, c: 30, d: 40}
-a; // 10
-b; // 20
-rest; // { c: 30, d: 40 }
- -

Invalid JavaScript identifier as a property name

- -

Destructuring can be used with property names that are not valid JavaScript {{glossary("Identifier", "identifiers")}} by providing an alternative identifier that is valid.

- -
const foo = { 'fizz-buzz': true };
-const { 'fizz-buzz': fizzBuzz } = foo;
-
-console.log(fizzBuzz); // "true"
-
- -

Combined Array and Object Destructuring

- -

Array and Object destructuring can be combined. Say you want the third element in the array props below, and then you want the name property in the object, you can do the following:

- -
const props = [
-  { id: 1, name: 'Fizz'},
-  { id: 2, name: 'Buzz'},
-  { id: 3, name: 'FizzBuzz'}
-];
-
-const [,, { name }] = props;
-
-console.log(name); // "FizzBuzz"
-
- -

The prototype chain is looked up when the object is deconstructed 

- -

When deconstructing an object, if a property is not accessed in itself, it will continue to look up along the prototype chain.

- -
let obj = {self: '123'};
-obj.__proto__.prot = '456';
-const {self, prot} = obj;
-// self "123"
-// prot "456"(Access to the prototype chain)
- -

Specifications

- - - - - - - - - - - - -
Specification
{{SpecName('ESDraft', '#sec-destructuring-assignment', 'Destructuring assignment')}}
- -

Browser compatibility

- -
- - -

{{Compat("javascript.operators.destructuring")}}

-
- -

See also

- - diff --git a/files/ar/web/javascript/reference/operators/index.html b/files/ar/web/javascript/reference/operators/index.html deleted file mode 100644 index a5dc098a4f..0000000000 --- a/files/ar/web/javascript/reference/operators/index.html +++ /dev/null @@ -1,302 +0,0 @@ ---- -title: Expressions and operators -slug: Web/JavaScript/Reference/Operators -tags: - - JavaScript - - NeedsTranslation - - Operators - - TopicStub -translation_of: Web/JavaScript/Reference/Operators ---- -
{{jsSidebar("Operators")}}
- -

This chapter documents all the JavaScript language operators, expressions and keywords.

- -

Expressions and operators by category

- -

For an alphabetical listing see the sidebar on the left.

- -

Primary expressions

- -

Basic keywords and general expressions in JavaScript.

- -
-
{{jsxref("Operators/this", "this")}}
-
The this keyword refers to the function's execution context.
-
{{jsxref("Operators/function", "function")}}
-
The function keyword defines a function expression.
-
{{jsxref("Operators/class", "class")}}
-
The class keyword defines a class expression.
-
{{jsxref("Operators/function*", "function*")}}
-
The function* keyword defines a generator function expression.
-
{{jsxref("Operators/yield", "yield")}}
-
Pause and resume a generator function.
-
{{jsxref("Operators/yield*", "yield*")}}
-
Delegate to another generator function or iterable object.
-
{{experimental_inline}} {{jsxref("Operators/async_function", "async function*")}}
-
The async function defines an async function expression.
-
{{experimental_inline}} {{jsxref("Operators/await", "await")}}
-
Pause and resume an async function and wait for the promise's resolution/rejection.
-
{{jsxref("Global_Objects/Array", "[]")}}
-
Array initializer/literal syntax.
-
{{jsxref("Operators/Object_initializer", "{}")}}
-
Object initializer/literal syntax.
-
{{jsxref("Global_Objects/RegExp", "/ab+c/i")}}
-
Regular expression literal syntax.
-
{{jsxref("Operators/Grouping", "( )")}}
-
Grouping operator.
-
- -

Left-hand-side expressions

- -

Left values are the destination of an assignment.

- -
-
{{jsxref("Operators/Property_accessors", "Property accessors", "", 1)}}
-
Member operators provide access to a property or method of an object
- (object.property and object["property"]).
-
{{jsxref("Operators/new", "new")}}
-
The new operator creates an instance of a constructor.
-
new.target
-
In constructors, new.target refers to the constructor that was invoked by {{jsxref("Operators/new", "new")}}.
-
{{jsxref("Operators/super", "super")}}
-
The super keyword calls the parent constructor.
-
{{jsxref("Operators/Spread_operator", "...obj")}}
-
The spread operator allows an expression to be expanded in places where multiple arguments (for function calls) or multiple elements (for array literals) are expected.
-
- -

Increment and decrement

- -

Postfix/prefix increment and postfix/prefix decrement operators.

- -
-
{{jsxref("Operators/Arithmetic_Operators", "A++", "#Increment")}}
-
Postfix increment operator.
-
{{jsxref("Operators/Arithmetic_Operators", "A--", "#Decrement")}}
-
Postfix decrement operator.
-
{{jsxref("Operators/Arithmetic_Operators", "++A", "#Increment")}}
-
Prefix increment operator.
-
{{jsxref("Operators/Arithmetic_Operators", "--A", "#Decrement")}}
-
Prefix decrement operator.
-
- -

Unary operators

- -

A unary operation is operation with only one operand.

- -
-
{{jsxref("Operators/delete", "delete")}}
-
The delete operator deletes a property from an object.
-
{{jsxref("Operators/void", "void")}}
-
The void operator discards an expression's return value.
-
{{jsxref("Operators/typeof", "typeof")}}
-
The typeof operator determines the type of a given object.
-
{{jsxref("Operators/Arithmetic_Operators", "+", "#Unary_plus")}}
-
The unary plus operator converts its operand to Number type.
-
{{jsxref("Operators/Arithmetic_Operators", "-", "#Unary_negation")}}
-
The unary negation operator converts its operand to Number type and then negates it.
-
{{jsxref("Operators/Bitwise_Operators", "~", "#Bitwise_NOT")}}
-
Bitwise NOT operator.
-
{{jsxref("Operators/Logical_Operators", "!", "#Logical_NOT")}}
-
Logical NOT operator.
-
- -

Arithmetic operators

- -

Arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value.

- -
-
{{jsxref("Operators/Arithmetic_Operators", "+", "#Addition")}}
-
Addition operator.
-
{{jsxref("Operators/Arithmetic_Operators", "-", "#Subtraction")}}
-
Subtraction operator.
-
{{jsxref("Operators/Arithmetic_Operators", "/", "#Division")}}
-
Division operator.
-
{{jsxref("Operators/Arithmetic_Operators", "*", "#Multiplication")}}
-
Multiplication operator.
-
{{jsxref("Operators/Arithmetic_Operators", "%", "#Remainder")}}
-
Remainder operator.
-
- -
-
{{jsxref("Operators/Arithmetic_Operators", "**", "#Exponentiation")}}
-
Exponentiation operator.
-
- -

Relational operators

- -

A comparison operator compares its operands and returns a Boolean value based on whether the comparison is true.

- -
-
{{jsxref("Operators/in", "in")}}
-
The in operator determines whether an object has a given property.
-
{{jsxref("Operators/instanceof", "instanceof")}}
-
The instanceof operator determines whether an object is an instance of another object.
-
{{jsxref("Operators/Comparison_Operators", "<", "#Less_than_operator")}}
-
Less than operator.
-
{{jsxref("Operators/Comparison_Operators", ">", "#Greater_than_operator")}}
-
Greater than operator.
-
{{jsxref("Operators/Comparison_Operators", "<=", "#Less_than_or_equal_operator")}}
-
Less than or equal operator.
-
{{jsxref("Operators/Comparison_Operators", ">=", "#Greater_than_or_equal_operator")}}
-
Greater than or equal operator.
-
- -
-

Note: => is not an operator, but the notation for Arrow functions.

-
- -

Equality operators

- -

The result of evaluating an equality operator is always of type Boolean based on whether the comparison is true.

- -
-
{{jsxref("Operators/Comparison_Operators", "==", "#Equality")}}
-
Equality operator.
-
{{jsxref("Operators/Comparison_Operators", "!=", "#Inequality")}}
-
Inequality operator.
-
{{jsxref("Operators/Comparison_Operators", "===", "#Identity")}}
-
Identity operator.
-
{{jsxref("Operators/Comparison_Operators", "!==", "#Nonidentity")}}
-
Nonidentity operator.
-
- -

Bitwise shift operators

- -

Operations to shift all bits of the operand.

- -
-
{{jsxref("Operators/Bitwise_Operators", "<<", "#Left_shift")}}
-
Bitwise left shift operator.
-
{{jsxref("Operators/Bitwise_Operators", ">>", "#Right_shift")}}
-
Bitwise right shift operator.
-
{{jsxref("Operators/Bitwise_Operators", ">>>", "#Unsigned_right_shift")}}
-
Bitwise unsigned right shift operator.
-
- -

Binary bitwise operators

- -

Bitwise operators treat their operands as a set of 32 bits (zeros and ones) and return standard JavaScript numerical values.

- -
-
{{jsxref("Operators/Bitwise_Operators", "&", "#Bitwise_AND")}}
-
Bitwise AND.
-
{{jsxref("Operators/Bitwise_Operators", "|", "#Bitwise_OR")}}
-
Bitwise OR.
-
{{jsxref("Operators/Bitwise_Operators", "^", "#Bitwise_XOR")}}
-
Bitwise XOR.
-
- -

Binary logical operators

- -

Logical operators are typically used with boolean (logical) values, and when they are, they return a boolean value.

- -
-
{{jsxref("Operators/Logical_Operators", "&&", "#Logical_AND")}}
-
Logical AND.
-
{{jsxref("Operators/Logical_Operators", "||", "#Logical_OR")}}
-
Logical OR.
-
- -

Conditional (ternary) operator

- -
-
{{jsxref("Operators/Conditional_Operator", "(condition ? ifTrue : ifFalse)")}}
-
-

The conditional operator returns one of two values based on the logical value of the condition.

-
-
- -

Assignment operators

- -

An assignment operator assigns a value to its left operand based on the value of its right operand.

- -
-
{{jsxref("Operators/Assignment_Operators", "=", "#Assignment")}}
-
Assignment operator.
-
{{jsxref("Operators/Assignment_Operators", "*=", "#Multiplication_assignment")}}
-
Multiplication assignment.
-
{{jsxref("Operators/Assignment_Operators", "/=", "#Division_assignment")}}
-
Division assignment.
-
{{jsxref("Operators/Assignment_Operators", "%=", "#Remainder_assignment")}}
-
Remainder assignment.
-
{{jsxref("Operators/Assignment_Operators", "+=", "#Addition_assignment")}}
-
Addition assignment.
-
{{jsxref("Operators/Assignment_Operators", "-=", "#Subtraction_assignment")}}
-
Subtraction assignment
-
{{jsxref("Operators/Assignment_Operators", "<<=", "#Left_shift_assignment")}}
-
Left shift assignment.
-
{{jsxref("Operators/Assignment_Operators", ">>=", "#Right_shift_assignment")}}
-
Right shift assignment.
-
{{jsxref("Operators/Assignment_Operators", ">>>=", "#Unsigned_right_shift_assignment")}}
-
Unsigned right shift assignment.
-
{{jsxref("Operators/Assignment_Operators", "&=", "#Bitwise_AND_assignment")}}
-
Bitwise AND assignment.
-
{{jsxref("Operators/Assignment_Operators", "^=", "#Bitwise_XOR_assignment")}}
-
Bitwise XOR assignment.
-
{{jsxref("Operators/Assignment_Operators", "|=", "#Bitwise_OR_assignment")}}
-
Bitwise OR assignment.
-
{{jsxref("Operators/Destructuring_assignment", "[a, b] = [1, 2]")}}
- {{jsxref("Operators/Destructuring_assignment", "{a, b} = {a:1, b:2}")}}
-
-

Destructuring assignment allows you to assign the properties of an array or object to variables using syntax that looks similar to array or object literals.

-
-
- -

Comma operator

- -
-
{{jsxref("Operators/Comma_Operator", ",")}}
-
The comma operator allows multiple expressions to be evaluated in a single statement and returns the result of the last expression.
-
- -

Non-standard features

- -
-
{{non-standard_inline}} {{jsxref("Operators/Legacy_generator_function", "Legacy generator function", "", 1)}}
-
The function keyword can be used to define a legacy generator function inside an expression. To make the function a legacy generator, the function body should contains at least one {{jsxref("Operators/yield", "yield")}} expression.
-
{{non-standard_inline}} {{jsxref("Operators/Expression_closures", "Expression closures", "", 1)}}
-
The expression closure syntax is a shorthand for writing simple function.
-
{{non-standard_inline}} {{jsxref("Operators/Array_comprehensions", "[for (x of y) x]")}}
-
Array comprehensions.
-
{{non-standard_inline}} {{jsxref("Operators/Generator_comprehensions", "(for (x of y) y)")}}
-
Generator comprehensions.
-
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES1', '#sec-11', 'Expressions')}}{{Spec2('ES1')}}Initial definition
{{SpecName('ES5.1', '#sec-11', 'Expressions')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-ecmascript-language-expressions', 'ECMAScript Language: Expressions')}}{{Spec2('ES6')}}New: Spread operator, destructuring assignment, super keyword.
{{SpecName('ESDraft', '#sec-ecmascript-language-expressions', 'ECMAScript Language: Expressions')}}{{Spec2('ESDraft')}} 
- -

See also

- - diff --git a/files/ar/web/javascript/reference/operators/object_initializer/index.html b/files/ar/web/javascript/reference/operators/object_initializer/index.html deleted file mode 100644 index b6df949722..0000000000 --- a/files/ar/web/javascript/reference/operators/object_initializer/index.html +++ /dev/null @@ -1,403 +0,0 @@ ---- -title: Object initializer تهيئة الكائن -slug: Web/JavaScript/Reference/Operators/Object_initializer -translation_of: Web/JavaScript/Reference/Operators/Object_initializer ---- -
{{JsSidebar("Operators")}}
- -

 

- -
-

يمكن تهيئة الكائنات باستخدام ()new Object او ()Object.create او باستخدام مهيئ الكائن (Object initializer). مهيئ الكائن هو عبارة عن قائمة من الخصائص، وكل خاصية من هذه الخصائص عبارة عن زوجين وهما، اسم الخاصية وقيمة الخاصية، يفصل بين كل زوجين بفاصلة، يمكن لهذه القائمة ان تحتوي على صفر او اكثر من هذه الازواج، محاطة بأقواس متعرجة ({}).

- -

Syntax

- -
var o = {};
-var o = {a: 'foo', b: 42, c: {}};
-
-var a = 'foo', b = 42, c = {};
-var o = {a: a, b: b, c: c};
-
-var o = {
-  property: function ([parameters]) {},
-  get property() {},
-  set property(value) {}
-};
-
- -

New notations in ECMAScript 2015

- -

يرجى الاطلاع على جدول التوافق اسفل الصفحة. هذه التعليمات البرمجية ستؤدي إلى أخطاء syntax errors، في البيئات الغير الداعمة.

- -
// Shorthand property names (ES2015)
-var a = 'foo', b = 42, c = {};
-var o = {a, b, c};
-
-// Shorthand method names (ES2015)
-var o = {
-  property([parameters]) {},
-  get property() {},
-  set property(value) {}
-};
-
-// Computed property names (ES2015)
-var prop = 'foo';
-var o = {
-  [prop]: 'hey',
-  ['b' + 'ar']: 'there'
-};
- -

الوصف

- -

مهيئ الكائن هو تعبير عن كيفية وصف وتهيئة الكائن {{jsxref("Object")}}. تتكون الكائنات من الخصائص، والتي يتم استخدامها لوصف الكائن. قيمة خاصية الكائن يمكن أن تحتوي على أنواع البيانات الأولية {{Glossary("primitive")}} كما يمكنها ايضا ان تحتوي على كائنات اخرى.

- -

إنشاء الكائنات

- -

يمكن إنشاء كائن فارغ بدون خصائص هكذا:

- -
var object = {};
- -

ميزة هذا literal او المهئ هي انه يمكنك سريعا من انشاء الكائنات وخصائصها داخل الأقواس المتعرجة. يمكنك ببساطة انشاء قائمة مكونة من زوجين key: value مفصولة بفاصلة. تقوم التعليمة البرمجية التالية بانشاء كائن مع ثلاثة خصائص والمفاتيح هي "foo", "age" و "baz". وقيم هذه المفاتيح هي string "bar", a number 42، فيما قيمة المفتاح "baz" عبارة عن كائن هو ايضا له مفتاح وقيمة.

- -
var object = {
-  foo: 'bar',
-  age: 42,
-  baz: {myProp: 12}
-}
- -

الوصول إلى الخصائص

- -

حالما تقوم بإنشاء كائن، سترغب في قراءة الخصائص أو تغييرها. يمكن الوصول إلى خصائص الكائن باستخدام نقطة التدوين او عن طريق الاقواس المربعة. راجع property accessors لمزيد من المعلومات.

- -
object.foo; // "bar"
-object['age']; // 42
-
-object.foo = 'baz';
-
- -

تعريف الخصائص

- -

تعلمنا للتو كيفية التعبير عن الخصائص باستخدام المهيئ. تجدر الإشارة الى انه في كثير من الأحيان، سترغب في تمرير متغيرات الى الكائن. يمكنك تمريها على هذا النحو:

- -
var a = 'foo',
-    b = 42,
-    c = {};
-
-var o = {
-  a: a,
-  b: b,
-  c: c
-};
- -

ECMAScript 2015، جاءت بطريقة مختصرة لتحقيق نفس الغرض:

- -
var a = 'foo',
-    b = 42,
-    c = {};
-
-// Shorthand property names (ES2015)
-var o = {a, b, c};
-
-// In other words,
-console.log((o.a === {a}.a)); // true
-
- -

أسماء الخصائص المكررة

- -

عند استخدام الخصائص باسماء مكررة، سوف تقوم الخاصية الثانية بالكتابة فوق  الأولى.

- -
var a = {x: 1, x: 2};
-console.log(a); // {x: 2}
-
- -

في ECMAScript 5 strict mode تكرار اسماء الخصائص سينتج عنها اخطاء {{jsxref("SyntaxError")}}.

- -
function haveES2015DuplicatePropertySemantics() {
-  'use strict';
-  try {
-    ({prop: 1, prop: 2});
-
-    // No error thrown, duplicate property names allowed in strict mode
-    return true;
-  } catch(e) {
-    // Error thrown, duplicates prohibited in strict mode
-    return false;
-  }
-}
- -

تعريف الوظائف

- -

خاصية الكائن يمكن أن تشير أيضا إلى الوظائف function او getter او setter.

- -
var o = {
-  property: function ([parameters]) {},
-  get property() {},
-  set property(value) {}
-};
- -

في ECMAScript 2015، اصبح الاختصار متاحا، حيث أن الكلمة المحجوزة function لم تعد ضرورية.

- -
// Shorthand method names (ES2015)
-var o = {
-  property([parameters]) {},
-  get property() {},
-  set property(value) {},
-  * generator() {}
-};
-
- -

في ECMAScript 2015، هناك طريقة لاختصار تعريف الخصائص التي قيمها generator functions :

- -
var o = {
-  * generator() {
-    ...........
-  }
-};
- -

في ECMAScript 5، سوف تكتب هكذا (لكن لاحظ أن ES5 قد لا توجد مولدات):

- -
var o = {
-  generator: function *() {
-    ...........
-  }
-};
- -

لمزيد من المعلومات والأمثلة حول الوظائف، راجع method definitions.

- -

أسماء الخصائص المحوسبة

- -

ابتداءا من ECMAScript 2015، مهئ الكائن اصبح يدعم اسماء الخصائص المحوسبة. والتي تسمح لك بوضع التعبير بين أقواس مربعة []، والتي ستعتمد كاسم للخاصية. وهي متسقة مع الاقواس المربعة التي تستخدم للوصول الى الخصائص، property accessor والتي قد تستخدم بالفعل لقراءة وتعيين الخصائص. الآن يمكنك استخدام نفس التعبير المستخدم في object literals، هكذا:

- -
// Computed property names (ES2015)
-var i = 0;
-var a = {
-  ['foo' + ++i]: i,
-  ['foo' + ++i]: i,
-  ['foo' + ++i]: i
-};
-
-console.log(a.foo1); // 1
-console.log(a.foo2); // 2
-console.log(a.foo3); // 3
-
-var param = 'size';
-var config = {
-  [param]: 12,
-  ['mobile' + param.charAt(0).toUpperCase() + param.slice(1)]: 4
-};
-
-console.log(config); // {size: 12, mobileSize: 4}
- -

Prototype mutation

- -

الخاصية المعرفة على هذا الشكل  proto__: value__ او proto__": value__" لا تقوم بإنشاء خاصية جديدة باسم  __proto__. بل تقوم  بتغيير [[Prototype]] الكائن نفسه، وذالك من خلال اسناد قيمة له تكون عبارة عن كائن اخر او null. (إذا كانت القيمة المسندة ليست كائن أو null، فلا يتم تغيير شئ في الكائن) على سبيل المثال:

- -
var obj1 = {x: 10};
-
-var obj2 = {
-	y: 20,
-    __proto__: obj1
-};
-console.log( obj2.x ); // log: 10 
- -

تبين التعليمة البرمجية التالية، بعض التحققات من بعض انواع التغييرات:

- -
var obj1 = {};
-assert(Object.getPrototypeOf(obj1) === Object.prototype);  // true
-
-var obj2 = {__proto__: null};
-assert(Object.getPrototypeOf(obj2) === null);              // true
-
-var protoObj = {};
-var obj3 = {'__proto__': protoObj};
-assert(Object.getPrototypeOf(obj3) === protoObj);          // true
-
-var obj4 = {__proto__: 'not an object or null'};
-assert(Object.getPrototypeOf(obj4) === Object.prototype);  // true
-assert(!obj4.hasOwnProperty('__proto__'));                 // true
-
- -

لا يسمح بتغيير ال prototype الا مرة واحدة في object literal، واكثر من تغيير في ال prototype سيؤدي الى syntax error.

- -

الخواص التي لا تستخدم النقطتين (:) تصبح خواص عادية وتتصرف كاي اسم اخر، وليس لها علاقة بتغيير ال prototype:

- -
var __proto__ = 'variable';
-
-var obj1 = {__proto__};
-assert(Object.getPrototypeOf(obj1) === Object.prototype);
-assert(obj1.hasOwnProperty('__proto__'));
-assert(obj1.__proto__ === 'variable');
-
-var obj2 = {__proto__() { return 'hello'; }};
-assert(obj2.__proto__() === 'hello');
-
-var obj3 = {['__prot' + 'o__']: 17};
-assert(obj3.__proto__ === 17);
-
- -

Object literal notation vs JSON

- -

ال object literal notation ليس هو نفسه JavaScript Object Notation (JSON). على الرغم من أنها تبدو مشابهة، الا ان هنالك اختلافات كبيرة بينهما:

- -
    -
  • JSON يسمح بتعريف الخاصية فقط باستخدام  property": value". ويجب أن يكون اسم الخاصية بين مزدوجتين، والتعريف لا يمكن أن يكون مختصر.
  • -
  • في ال JSON القيم يمكن ان تكون فقط strings, numbers, arrays, true, false, null، او كائن  (JSON) اخر.
  • -
  • في ال JSON لا يمكن تعيين ال function كقيمة لمفتاح الخاصية.
  • -
  • الكائنات مثل {{jsxref("Date")}} سوف تصبح سلسلة نصية بعد {{jsxref("()JSON.parse")}}.
  • -
  • {{jsxref("()JSON.parse")}} سوف يرفض اسماء الخصائص المحوسبة، وسينتج عن ذالك اخطاء.
  • -
-
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES1')}}{{Spec2('ES1')}}initial definition.
{{SpecName('ES5.1', '#sec-11.1.5', 'Object Initializer')}}{{Spec2('ES5.1')}}getter and setter added.
{{SpecName('ES2015', '#sec-object-initializer', 'Object Initializer')}}{{Spec2('ES2015')}}Shorthand method/property names and computed property names added.
{{SpecName('ESDraft', '#sec-object-initializer', 'Object Initializer')}}{{Spec2('ESDraft')}} 
- -

Browser compatibility

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatChrome(1.0)}}{{CompatVersionUnknown}}{{CompatGeckoDesktop("1.0")}}111
Computed property names{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoDesktop("34")}}{{CompatNo}}347.1
Shorthand property names{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoDesktop("33")}}{{CompatNo}}349
Shorthand method names{{CompatChrome(42.0)}}{{CompatVersionUnknown}}{{CompatGeckoDesktop("34")}}{{CompatNo}}349
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidAndroid WebviewFirefox Mobile (Gecko)IE MobileOpera MobileSafari MobileChrome for Android
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoMobile("1.0")}}111{{CompatChrome(1.0)}}
Computed property names{{CompatNo}}{{CompatVersionUnknown}}{{CompatGeckoMobile("34")}}{{CompatNo}}347.1{{CompatNo}}
Shorthand property names{{CompatNo}}{{CompatVersionUnknown}}{{CompatGeckoMobile("33")}}{{CompatNo}}349{{CompatNo}}
Shorthand method names{{CompatNo}}{{CompatChrome(42.0)}}{{CompatGeckoMobile("34")}}{{CompatNo}}349{{CompatChrome(42.0)}}
-
- -

See also

- - diff --git a/files/ar/web/javascript/reference/operators/operator_precedence/index.html b/files/ar/web/javascript/reference/operators/operator_precedence/index.html deleted file mode 100644 index 8b71a69143..0000000000 --- a/files/ar/web/javascript/reference/operators/operator_precedence/index.html +++ /dev/null @@ -1,420 +0,0 @@ ---- -title: أسبقية العوامل -slug: Web/JavaScript/Reference/Operators/Operator_Precedence -tags: - - أسبقية العوامل - - جافا سكربت - - عوامل رياضية -translation_of: Web/JavaScript/Reference/Operators/Operator_Precedence ---- -
{{jsSidebar("Operators")}}
- -

أسبقية العوامل تحدد الطريقة التي يتم بها تعامل كل من العوامل مع بعضها. العوامل ذات الأسبقية العليا تسبق العوامل ذات الأسبقية المنخفضة.

- -
{{EmbedInteractiveExample("pages/js/expressions-operatorprecedence.html")}}
- - - -

الترابطات 

- -

تحدد الترابطات الطريقة التي يتم بها تحليل العوامل التي لها نفس الأسبقية. على سبيل المثال، لنقل أن:

- -
a OP b OP c
-
- -

تعني كلمة رابط - يسار (من اليسار إلى اليمين) أنها تتم معالجتها كـ a OP b) OP c) ، بينما تعني رابط - يمين (من اليمين إلى اليسار) أنها تُفسَّر على أنها (a OP (b OP c. عوامل التعيين هي رابط-يمين، حيث يمكنك كتابة:

- -
a = b = 5;
-
- -

مع النتيجة المتوقعة أن تحصل a و b على القيمة 5. وذلك لأن عامل التعيين يُرجع القيمة التي تم تعيينها. أولاً، يتم تعيين b على 5. ثم يتم تعيين a أيضًا على 5 ، قيمة الإرجاع b = 5 ، ويعرف أيضًا باسم المعامل الأيمن للتعيين.

- -

أمثلة:

- -
3 > 2 && 2 > 1
-// returns true تعيد لنا صح
-
-3 > 2 > 1
-// returns false because 3 > 2 is true, and true > 1 is false تعيد خطأ لأن 3>2 هي صحيحة، وصح > 1 هو خطأ
-// Adding parentheses makes things clear: (3 > 2) > 1 إضافة الأقواس تجعل كل شيء واضح: (3>2) 1
- -

الجدول

- -

الجدول التالي مرتب من (20) الأعلى أسبقية إلى الأقل وهو (1).

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PrecedenceOperator typeAssociativityIndividual operators
21{{jsxref("Operators/Grouping", "Grouping", "", 1)}} تجميعn/a( … )
20{{jsxref("Operators/Property_Accessors", "Member Access", "#Dot_notation", 1)}} الوصول الى عنصر -

left-to-right

- -

من اليسار الى اليمين

-
… . …
{{jsxref("Operators/Property_Accessors", "Computed Member Access","#Bracket_notation", 1)}} الوصول لعنصر محسوب -

left-to-right

- -

من اليسار الى اليمين

-
… [ … ]
{{jsxref("Operators/new","new")}} (with argument list) جديد مع (قائمة معاملات)n/anew … ( … )
Function Call استدعاء دالة -

left-to-right

- -

من اليسار الى اليمين

-
… ( )
Optional chaining تسلسل اختياري -

left-to-right

- -

من اليسار الى اليمين

-
?.
19{{jsxref("Operators/new","new")}} (without argument list) جديد .. بدون قائمة معاملات -

right-to-left

- -

من اليمين الى اليسار

-
new …
18{{jsxref("Operators/Arithmetic_Operators","Postfix Increment","#Increment", 1)}} إضافة بعد إعادة النتيجة n/a… ++
{{jsxref("Operators/Arithmetic_Operators","Postfix Decrement","#Decrement", 1)}} طرح بعد إعادة النتيجة… --
17Logical NOT نفي منطقي -

right-to-left

- -

من اليمين الى اليسار

-
! …
Bitwise NOT نفي بالبت~ …
Unary Plus + أحادي+ …
Unary Negation - أحادي- …
Prefix Increment إضافة قبل إعادة النتيجة++ …
Prefix Decrement طرح قبل إعادة النتيجة-- …
{{jsxref("Operators/typeof", "typeof")}} نوع الtypeof …
{{jsxref("Operators/void", "void")}} مجموعة خاليةvoid …
{{jsxref("Operators/delete", "delete")}} حذفdelete …
{{jsxref("Operators/await", "await")}} انتظارawait …
16Exponentiation أُس (الرفع الى قوة) -

right-to-left

- -

من اليمين الى اليسار

-
… ** …
15Multiplication الضرب -

left-to-right

- -

من اليسار الى اليمين

-
… * …
Division القسمة… / …
Remainder الباقي… % …
14Addition الجمع -

left-to-right

- -

من اليسار الى اليمين

-
… + …
Subtraction الطرح… - …
13Bitwise Left Shift إزاحة لليسار بالبت -

left-to-right

- -

من اليسار الى اليمين

-
… << …
Bitwise Right Shift إزاحة لليمين بالبت… >> …
Bitwise Unsigned Right Shift… >>> …
12Less Than أصغر من -

left-to-right

- -

من اليسار الى اليمين

-
… < …
Less Than Or Equal أصغر من أو يساوي… <= …
Greater Than أكبر من… > …
Greater Than Or Equal أكبر من أو يساوي… >= …
{{jsxref("Operators/in", "in")}} في… in …
{{jsxref("Operators/instanceof", "instanceof")}} مشتق من … instanceof …
11Equality يساوي -

left-to-right

- -

من اليسار الى اليمين

-
… == …
Inequality لا يساوي… != …
Strict Equality مساواة قطعية… === …
Strict Inequality لا يساوي قطعيا… !== …
10Bitwise AND و بالبت -

left-to-right

- -

من اليسار الى اليمين

-
… & …
9Bitwise XOR  -

left-to-right

- -

من اليسار الى اليمين

-
… ^ …
8Bitwise OR أو بالبت -

left-to-right

- -

من اليسار الى اليمين

-
… | …
7Nullish coalescing operator -

left-to-right

- -

من اليسار الى اليمين

-
… ?? …
6Logical AND و المنطقية -

left-to-right

- -

من اليسار الى اليمين

-
… && …
5Logical OR أو المنطقية -

left-to-right

- -

من اليسار الى اليمين

-
… || …
4Conditional الشرطية -

right-to-left

- -

من اليمين الى اليسار

-
… ? … : …
3Assignment التعيين -

right-to-left

- -

من اليمين الى اليسار

-
… = …
… += …
… -= …
… **= …
… *= …
… /= …
… %= …
… <<= …
… >>= …
… >>>= …
… &= …
… ^= …
… |= …
2{{jsxref("Operators/yield", "yield")}} -

right-to-left

- -

من اليمين الى اليسار

-
yield …
{{jsxref("Operators/yield*", "yield*")}}yield* …
1Comma / Sequence فاصلة / تسلسل -

left-to-right

- -

من اليسار الى اليمين

-
… , …
diff --git a/files/ar/web/javascript/reference/statements/index.html b/files/ar/web/javascript/reference/statements/index.html deleted file mode 100644 index b9fd7f94a0..0000000000 --- a/files/ar/web/javascript/reference/statements/index.html +++ /dev/null @@ -1,141 +0,0 @@ ---- -title: Statements and declarations -slug: Web/JavaScript/Reference/Statements -tags: - - JavaScript - - NeedsTranslation - - Reference - - TopicStub - - statements -translation_of: Web/JavaScript/Reference/Statements ---- -
{{jsSidebar("Statements")}}
- -

JavaScript applications consist of statements with an appropriate syntax. A single statement may span multiple lines. Multiple statements may occur on a single line if each statement is separated by a semicolon. This isn't a keyword, but a group of keywords.

- -

Statements and declarations by category

- -

For an alphabetical listing see the sidebar on the left.

- -

Control flow

- -
-
{{jsxref("Statements/block", "Block")}}
-
A block statement is used to group zero or more statements. The block is delimited by a pair of curly brackets.
-
{{jsxref("Statements/break", "break")}}
-
Terminates the current loop, switch, or label statement and transfers program control to the statement following the terminated statement.
-
{{jsxref("Statements/continue", "continue")}}
-
Terminates execution of the statements in the current iteration of the current or labeled loop, and continues execution of the loop with the next iteration.
-
{{jsxref("Statements/Empty", "Empty")}}
-
An empty statement is used to provide no statement, although the JavaScript syntax would expect one.
-
{{jsxref("Statements/if...else", "if...else")}}
-
Executes a statement if a specified condition is true. If the condition is false, another statement can be executed.
-
{{jsxref("Statements/switch", "switch")}}
-
Evaluates an expression, matching the expression's value to a case clause, and executes statements associated with that case.
-
{{jsxref("Statements/throw", "throw")}}
-
Throws a user-defined exception.
-
{{jsxref("Statements/try...catch", "try...catch")}}
-
Marks a block of statements to try, and specifies a response, should an exception be thrown.
-
- -

Declarations

- -
-
{{jsxref("Statements/var", "var")}}
-
Declares a variable, optionally initializing it to a value.
-
{{jsxref("Statements/let", "let")}}
-
Declares a block scope local variable, optionally initializing it to a value.
-
{{jsxref("Statements/const", "const")}}
-
Declares a read-only named constant.
-
- -

Functions and classes

- -
-
{{jsxref("Statements/function", "function")}}
-
Declares a function with the specified parameters.
-
{{jsxref("Statements/function*", "function*")}}
-
Generators functions enable writing iterators more easily.
-
{{jsxref("Statements/return", "return")}}
-
Specifies the value to be returned by a function.
-
{{jsxref("Statements/class", "class")}}
-
Declares a class.
-
- -

Iterations

- -
-
{{jsxref("Statements/do...while", "do...while")}}
-
Creates a loop that executes a specified statement until the test condition evaluates to false. The condition is evaluated after executing the statement, resulting in the specified statement executing at least once.
-
{{jsxref("Statements/for", "for")}}
-
Creates a loop that consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.
-
{{deprecated_inline}} {{non-standard_inline()}} {{jsxref("Statements/for_each...in", "for each...in")}}
-
Iterates a specified variable over all values of object's properties. For each distinct property, a specified statement is executed.
-
{{jsxref("Statements/for...in", "for...in")}}
-
Iterates over the enumerable properties of an object, in arbitrary order. For each distinct property, statements can be executed.
-
{{jsxref("Statements/for...of", "for...of")}}
-
Iterates over iterable objects (including {{jsxref("Global_Objects/Array","arrays","","true")}}, array-like objects, iterators and generators), invoking a custom iteration hook with statements to be executed for the value of each distinct property.
-
{{jsxref("Statements/while", "while")}}
-
Creates a loop that executes a specified statement as long as the test condition evaluates to true. The condition is evaluated before executing the statement.
-
- -

Others

- -
-
{{jsxref("Statements/debugger", "debugger")}}
-
Invokes any available debugging functionality. If no debugging functionality is available, this statement has no effect.
-
{{jsxref("Statements/export", "export")}}
-
Used to export functions to make them available for imports in external modules, another scripts.
-
{{jsxref("Statements/import", "import")}}
-
Used to import functions exported from an external module, another script.
-
{{jsxref("Statements/label", "label")}}
-
Provides a statement with an identifier that you can refer to using a break or continue statement.
-
- -
-
{{deprecated_inline}} {{jsxref("Statements/with", "with")}}
-
Extends the scope chain for a statement.
-
- -

Specifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES1', '#sec-12', 'Statements')}}{{Spec2('ES1')}}Initial definition
{{SpecName('ES3', '#sec-12', 'Statements')}}{{Spec2('ES3')}} 
{{SpecName('ES5.1', '#sec-12', 'Statements')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-ecmascript-language-statements-and-declarations', 'ECMAScript Language: Statements and Declarations')}}{{Spec2('ES6')}}New: function*, let, for...of, yield, class
{{SpecName('ESDraft', '#sec-ecmascript-language-statements-and-declarations', 'ECMAScript Language: Statements and Declarations')}}{{Spec2('ESDraft')}} 
- -

See also

- - diff --git a/files/ar/web/javascript/reference/statements/return/index.html b/files/ar/web/javascript/reference/statements/return/index.html deleted file mode 100644 index 191ab5296c..0000000000 --- a/files/ar/web/javascript/reference/statements/return/index.html +++ /dev/null @@ -1,145 +0,0 @@ ---- -title: return -slug: Web/JavaScript/Reference/Statements/return -translation_of: Web/JavaScript/Reference/Statements/return ---- -
{{jsSidebar("Statements")}}
- -

ال return ينهي البيان تنفيذ الوظيفة ويحدد قيمة ليتم ارجاعها الى دالة الاستدعاء

- -
{{EmbedInteractiveExample("pages/js/statement-return.html")}}
- - - -

بناء الجملة

- -
return [expression]; 
- -
-
expression
-
التعبير المراد استرجاع قيمتة. اذا تم حذفه, فسيتم ارجاع undefined بدلاً من ذالك
-
- -

الوصف

- -

عند استخدام عبارة return في جسم الدالة,يتم ايقاف تنفيذ الوظيفة.اذا تم تحديد ذالك,يتم ارجاع قيمة معينة الى دالة الاستدعاء.على سبيل المثال,تعرض الدالة التالية مربع سعتها , x,حيث x هي رقم.

- -
function square(x) {
-   return x * x;
-}
-var demo = square(3);
-// demo will equal 9
-
- -

اذا تم حذف القيمة,يتم ارجاع undefined بدلاُ من ذالك

- -

تعطل عبارات الارجاع التالية تنفيذ الوظيفة

- -
return;
-return true;
-return false;
-return x;
-return x + y / 3;
-
- -

الادراج التلقائي للفاصلة المنقوطة (Semicolon)

- -

تتاثر عبارة الارجاع بادراج الفاصلة المنقوطة تلقائياُُ (ASI) .

- -

لا يُسمح بفاصل سطر بين الكلمة الاساسية return  و التعبير

- -
return
-a + b;
-
- -

is transformed by ASI into:

- -
return;
-a + b;
-
- -

The console will warn "unreachable code after return statement".

- -
Starting with Firefox 40, a warning is shown in the console if unreachable code is found after a return statement.
- -

To avoid this problem (to prevent ASI), you could use parentheses:

- -
return (
-  a + b
-);
-
- -

Examples

- -

Interrupt a function

- -

A function immediately stops at the point where return is called.

- -
function counter() {
-  for (var count = 1; ; count++) {  // infinite loop
-    console.log(count + 'A'); // until 5
-      if (count === 5) {
-        return;
-      }
-      console.log(count + 'B');  // until 4
-    }
-  console.log(count + 'C');  // never appears
-}
-
-counter();
-
-// Output:
-// 1A
-// 1B
-// 2A
-// 2B
-// 3A
-// 3B
-// 4A
-// 4B
-// 5A
-
- -

Returning a function

- -

See also the article about Closures.

- -
function magic() {
-  return function calc(x) { return x * 42; };
-}
-
-var answer = magic();
-answer(1337); // 56154
-
- -

Specifications

- - - - - - - - - - - - -
Specification
{{SpecName('ESDraft', '#sec-return-statement', 'Return statement')}}
- -

Browser compatibility

- - - -

{{Compat("javascript.statements.return")}}

- -

See also

- - - -
-
-
diff --git a/files/ar/web/mathml/index.html b/files/ar/web/mathml/index.html deleted file mode 100644 index 314c7d113f..0000000000 --- a/files/ar/web/mathml/index.html +++ /dev/null @@ -1,123 +0,0 @@ ---- -title: لغة الترميز الرياضية -slug: Web/MathML -tags: - - صفحة هبوط - - لغة الترميز الرياضية - - لغة الترميز القابلة للامتداد - - مراجع - - ويب -translation_of: Web/MathML ---- -

لغة الترميز الرياضية (MathML) هي نكهة من لغة الترميز القابلة للامتداد (XML) لوصف الرموز الرياضية وتمثيل هيكلها ومحتواها.

- -

ستجد هنا روابط لتوثيقات، أمثلة،  وأدوات لتساعدك على العمل مع هذه التقنيّة القوية. لنظرة سريعة، انظر إلى شرائح لمعارض الإبتكار في موزيلا سوميت 2013.

- -
-
-

مرجع لغة الترميز الرياضية

- -
-
مرجع عناصر لغة الترميز الرياضية
-
تفاصيل حول كل عنصر في لغة الترميز الرياضية ومعلومات حول توافقيته مع متصفحات سطح المكتب والهواتف.
-
مرجع سمات لغة الترميز الرياضية
-
معلومات حول سمات لغة الترميز الرياضية التي تقوم بتعديل مظهر أو وظيفة العناصر.
-
أمثلة عن لغة الترميز الرياضية
-
عينات وأمثلة عن لغة الترميز الرياضية لمساعدتك على فهم كيفية عملها.
-
الكتابة بلغة الترميز الرياضية
-
اقتراحات و نصائح حول الكتابة بلغة الترميز الرياضية، تتضمن المحررات التي يتم استخدامها لاستخدام هذه اللغة وكيفية تحويل المخرجات إلى محتوى ويب.
-
- -

عرض المزيد...

-
- -
-

الحصول على المساعدة من المجتمع

- - - -

أدوات

- - - -

 

- -

مواضيع متعلقة

- - -
-
- -

التوافق مع المتصفحات

- -

{{CompatibilityTable}}

- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatNo}} [1]{{CompatGeckoDesktop("1.8")}}{{CompatNo}} [2]{{CompatNo}} [3]{{CompatSafari(5.1)}}
-
- -
- - - - - - - - - - - - - - - - - - - -
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatUnknown}}{{CompatGeckoMobile("1.8")}}{{CompatUnknown}}{{CompatUnknown}}5.1
-
- -

[1] متوفر مع إضاف(ة/ات).

- -

[2] متوفر مع إضاف(ة/ات).

- -

[3] متوفر مع إضاف(ة/ات).

diff --git a/files/ar/web/reference/index.html b/files/ar/web/reference/index.html deleted file mode 100644 index 5f9ad294da..0000000000 --- a/files/ar/web/reference/index.html +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: مرجع تكنولوجيا الويب. -slug: Web/Reference -tags: - - مراجع -translation_of: Web/Reference -original_slug: Web/مرجع. ---- -

تم بناء الويب المفتوح باستخدام عدد من التقنيات.أدناه سوف تجد روابط لمراجعنا  التي توضح كل تقنية.

- -
-
-

تقنيات الويب الأساسية

- -

{{ Page ("Web", "Web technologies") }}

-
- -

تعتمد شبكة الويب المفتوحة على عدد من التقنيات التي يمكن استخدامها معًا لإنشاء كل شيء بدءًا من المواقع البسيطة وحتى تطبيقات الويب القوية. ستجد أدناه روابط لمجموعة مختارة من الوثائق الرئيسية لكل منها.

- -
-

إذا كنت جديدًا في مجال تطوير الويب ، ففكر في البدء بمنطقة التعلم المليئة بالبرامج التعليمية خطوة بخطوة من شأنها أن ترشدك من مبتدئ webdev إلى شبه محترف على الأقل!

- -
-
HTML - هيكلة الويب تُستخدم
-
HyperText Markup Language لتعريف ووصف محتوى صفحة الويب ( ) لصفحة الويب بتنسيق جيد التنظيم. يوفر HTML وسيلة لإنشاء مستندات منظمة مكونة من كتل تسمى عناصر HTML المحددة بواسطة العلامات ، مكتوبة باستخدام أقواس معقوفة. يقدم البعض المحتوى في الصفحة مباشرةً ، بينما يوفر البعض الآخر معلومات حول نص المستند وقد يتضمن علامات أخرى كعناصر فرعية. من الواضح أن المتصفحات لا تعرضها ، حيث يتم استخدامها لتفسير محتوى الصفحة.
-
- مقدمة إلى HTML | تعلم HTML | HTML5 | دليل المطور | مرجع العنصر | المرجع
-
CSS - تصميم الويب تستخدم
-
أوراق الأنماط المتتالية لوصف مظهر محتوى الويب.
-
- مقدمة إلى CSS | بدء استخدام CSS | تعلم CSS | أسئلة CSS الشائعة | المرجع
-
JavaScript - برمجة نصية ديناميكية من جانب العميل
-
تُستخدم لغة البرمجة JavaScript لإضافة التفاعل والميزات الديناميكية الأخرى إلى مواقع الويب.
-
تعلم JavaScript | دليل المطور | المرجع
-
- -
-

{{draft()}}

- -

هذه الصفحة معنية لأن تكون  الصفحة المرجعية لمنصة الويب.هذه الصفحة سوف توفر روابطاً للصفحة الأساسية التي تحتوي كل منها واحدة من تطبيقات الواجهة البرمجية التي يمكن إستعمالها على منصة الويب (و لكن هذه الصفحات لن تحتوي صفحات فرعية).

-
-
-
diff --git a/files/ar/web/security/index.html b/files/ar/web/security/index.html deleted file mode 100644 index 70e58be06b..0000000000 --- a/files/ar/web/security/index.html +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: حماية الويب -slug: Web/Security -tags: - - Landing - - Security - - Web -translation_of: Web/Security -original_slug: Web/حماية ---- -
-

من الضروري ضمان أن موقع الويب أو تطبيق الويب المفتوح آمن. حتى الأخطاء البسيطة في التعليمات البرمجية الخاصة بك يمكن أن تؤدي إلى تسرب المعلومات الخاصة ، والأشخاص السيئين يحاولون إيجاد طرق لسرقة البيانات. توفر المقالات الموجهة لأمان الويب الواردة هنا معلومات قد تساعدك في تأمين موقعك ورمزه من الهجمات وسرقة البيانات.

-
- -

{{LandingPageListSubpages}}{{QuickLinksWithSubpages}}

- -
diff --git a/files/ar/web/svg/attribute/index.html b/files/ar/web/svg/attribute/index.html deleted file mode 100644 index 67cc97d9ac..0000000000 --- a/files/ar/web/svg/attribute/index.html +++ /dev/null @@ -1,387 +0,0 @@ ---- -title: SVG Attribute reference -slug: Web/SVG/Attribute -tags: - - NeedsHelp - - NeedsTranslation - - SVG - - SVG Attribute - - SVG Reference - - TopicStub -translation_of: Web/SVG/Attribute ---- -

« SVG / SVG Element reference »

-

SVG Attributes

-
-

A

-
    -
  • {{ SVGAttr("accelerate") }}
  • -
  • {{ SVGAttr("accent-height") }}
  • -
  • {{ SVGAttr("accumulate") }}
  • -
  • {{ SVGAttr("additive") }}
  • -
  • {{ SVGAttr("alignment-baseline") }}
  • -
  • {{ SVGAttr("allowReorder") }}
  • -
  • {{ SVGAttr("alphabetic") }}
  • -
  • {{ SVGAttr("amplitude") }}
  • -
  • {{ SVGAttr("arabic-form") }}
  • -
  • {{ SVGAttr("ascent") }}
  • -
  • {{ SVGAttr("attributeName") }}
  • -
  • {{ SVGAttr("attributeType") }}
  • -
  • {{ SVGAttr("autoReverse") }}
  • -
  • {{ SVGAttr("azimuth") }}
  • -
-

B

-
    -
  • {{ SVGAttr("baseFrequency") }}
  • -
  • {{ SVGAttr("baseline-shift") }}
  • -
  • {{ SVGAttr("baseProfile") }}
  • -
  • {{ SVGAttr("bbox") }}
  • -
  • {{ SVGAttr("begin") }}
  • -
  • {{ SVGAttr("bias") }}
  • -
  • {{ SVGAttr("by") }}
  • -
-

C

-
    -
  • {{ SVGAttr("calcMode") }}
  • -
  • {{ SVGAttr("cap-height") }}
  • -
  • {{ SVGAttr("class") }}
  • -
  • {{ SVGAttr("clip") }}
  • -
  • {{ SVGAttr("clipPathUnits") }}
  • -
  • {{ SVGAttr("clip-path") }}
  • -
  • {{ SVGAttr("clip-rule") }}
  • -
  • {{ SVGAttr("color") }}
  • -
  • {{ SVGAttr("color-interpolation") }}
  • -
  • {{ SVGAttr("color-interpolation-filters") }}
  • -
  • {{ SVGAttr("color-profile") }}
  • -
  • {{ SVGAttr("color-rendering") }}
  • -
  • {{ SVGAttr("contentScriptType") }}
  • -
  • {{ SVGAttr("contentStyleType") }}
  • -
  • {{ SVGAttr("cursor") }}
  • -
  • {{ SVGAttr("cx") }}
  • -
  • {{ SVGAttr("cy") }}
  • -
-

D

-
    -
  • {{ SVGAttr("d") }}
  • -
  • {{ SVGAttr("decelerate") }}
  • -
  • {{ SVGAttr("descent") }}
  • -
  • {{ SVGAttr("diffuseConstant") }}
  • -
  • {{ SVGAttr("direction") }}
  • -
  • {{ SVGAttr("display") }}
  • -
  • {{ SVGAttr("divisor") }}
  • -
  • {{ SVGAttr("dominant-baseline") }}
  • -
  • {{ SVGAttr("dur") }}
  • -
  • {{ SVGAttr("dx") }}
  • -
  • {{ SVGAttr("dy") }}
  • -
-

E

-
    -
  • {{ SVGAttr("edgeMode") }}
  • -
  • {{ SVGAttr("elevation") }}
  • -
  • {{ SVGAttr("enable-background") }}
  • -
  • {{ SVGAttr("end") }}
  • -
  • {{ SVGAttr("exponent") }}
  • -
  • {{ SVGAttr("externalResourcesRequired") }}
  • -
-

F

-
    -
  • {{ SVGAttr("fill") }}
  • -
  • {{ SVGAttr("fill-opacity") }}
  • -
  • {{ SVGAttr("fill-rule") }}
  • -
  • {{ SVGAttr("filter") }}
  • -
  • {{ SVGAttr("filterRes") }}
  • -
  • {{ SVGAttr("filterUnits") }}
  • -
  • {{ SVGAttr("flood-color") }}
  • -
  • {{ SVGAttr("flood-opacity") }}
  • -
  • {{ SVGAttr("font-family") }}
  • -
  • {{ SVGAttr("font-size") }}
  • -
  • {{ SVGAttr("font-size-adjust") }}
  • -
  • {{ SVGAttr("font-stretch") }}
  • -
  • {{ SVGAttr("font-style") }}
  • -
  • {{ SVGAttr("font-variant") }}
  • -
  • {{ SVGAttr("font-weight") }}
  • -
  • {{ SVGAttr("format") }}
  • -
  • {{ SVGAttr("from") }}
  • -
  • {{ SVGAttr("fx") }}
  • -
  • {{ SVGAttr("fy") }}
  • -
-

G

-
    -
  • {{ SVGAttr("g1") }}
  • -
  • {{ SVGAttr("g2") }}
  • -
  • {{ SVGAttr("glyph-name") }}
  • -
  • {{ SVGAttr("glyph-orientation-horizontal") }}
  • -
  • {{ SVGAttr("glyph-orientation-vertical") }}
  • -
  • {{ SVGAttr("glyphRef") }}
  • -
  • {{ SVGAttr("gradientTransform") }}
  • -
  • {{ SVGAttr("gradientUnits") }}
  • -
-

H

-
    -
  • {{ SVGAttr("hanging") }}
  • -
  • {{ SVGAttr("height") }}
  • -
  • {{ SVGAttr("horiz-adv-x") }}
  • -
  • {{ SVGAttr("horiz-origin-x") }}
  • -
-

I

-
    -
  • {{ SVGAttr("id") }}
  • -
  • {{ SVGAttr("ideographic") }}
  • -
  • {{ SVGAttr("image-rendering") }}
  • -
  • {{ SVGAttr("in") }}
  • -
  • {{ SVGAttr("in2") }}
  • -
  • {{ SVGAttr("intercept") }}
  • -
-

K

-
    -
  • {{ SVGAttr("k") }}
  • -
  • {{ SVGAttr("k1") }}
  • -
  • {{ SVGAttr("k2") }}
  • -
  • {{ SVGAttr("k3") }}
  • -
  • {{ SVGAttr("k4") }}
  • -
  • {{ SVGAttr("kernelMatrix") }}
  • -
  • {{ SVGAttr("kernelUnitLength") }}
  • -
  • {{ SVGAttr("kerning") }}
  • -
  • {{ SVGAttr("keyPoints") }}
  • -
  • {{ SVGAttr("keySplines") }}
  • -
  • {{ SVGAttr("keyTimes") }}
  • -
-

L

-
    -
  • {{ SVGAttr("lang") }}
  • -
  • {{ SVGAttr("lengthAdjust") }}
  • -
  • {{ SVGAttr("letter-spacing") }}
  • -
  • {{ SVGAttr("lighting-color") }}
  • -
  • {{ SVGAttr("limitingConeAngle") }}
  • -
  • {{ SVGAttr("local") }}
  • -
-

M

-
    -
  • {{ SVGAttr("marker-end") }}
  • -
  • {{ SVGAttr("marker-mid") }}
  • -
  • {{ SVGAttr("marker-start") }}
  • -
  • {{ SVGAttr("markerHeight") }}
  • -
  • {{ SVGAttr("markerUnits") }}
  • -
  • {{ SVGAttr("markerWidth") }}
  • -
  • {{ SVGAttr("mask") }}
  • -
  • {{ SVGAttr("maskContentUnits") }}
  • -
  • {{ SVGAttr("maskUnits") }}
  • -
  • {{ SVGAttr("mathematical") }}
  • -
  • {{ SVGAttr("max") }}
  • -
  • {{ SVGAttr("media") }}
  • -
  • {{ SVGAttr("method") }}
  • -
  • {{ SVGAttr("min") }}
  • -
  • {{ SVGAttr("mode") }}
  • -
-

N

-
    -
  • {{ SVGAttr("name") }}
  • -
  • {{ SVGAttr("numOctaves") }}
  • -
-

O

-
    -
  • {{ SVGAttr("offset") }}
  • -
  • {{ SVGAttr("onabort") }}
  • -
  • {{ SVGAttr("onactivate") }}
  • -
  • {{ SVGAttr("onbegin") }}
  • -
  • {{ SVGAttr("onclick") }}
  • -
  • {{ SVGAttr("onend") }}
  • -
  • {{ SVGAttr("onerror") }}
  • -
  • {{ SVGAttr("onfocusin") }}
  • -
  • {{ SVGAttr("onfocusout") }}
  • -
  • {{ SVGAttr("onload") }}
  • -
  • {{ SVGAttr("onmousedown") }}
  • -
  • {{ SVGAttr("onmousemove") }}
  • -
  • {{ SVGAttr("onmouseout") }}
  • -
  • {{ SVGAttr("onmouseover") }}
  • -
  • {{ SVGAttr("onmouseup") }}
  • -
  • {{ SVGAttr("onrepeat") }}
  • -
  • {{ SVGAttr("onresize") }}
  • -
  • {{ SVGAttr("onscroll") }}
  • -
  • {{ SVGAttr("onunload") }}
  • -
  • {{ SVGAttr("onzoom") }}
  • -
  • {{ SVGAttr("opacity") }}
  • -
  • {{ SVGAttr("operator") }}
  • -
  • {{ SVGAttr("order") }}
  • -
  • {{ SVGAttr("orient") }}
  • -
  • {{ SVGAttr("orientation") }}
  • -
  • {{ SVGAttr("origin") }}
  • -
  • {{ SVGAttr("overflow") }}
  • -
  • {{ SVGAttr("overline-position") }}
  • -
  • {{ SVGAttr("overline-thickness") }}
  • -
-

P

-
    -
  • {{ SVGAttr("panose-1") }}
  • -
  • {{ SVGAttr("paint-order") }}
  • -
  • {{ SVGAttr("path") }}
  • -
  • {{ SVGAttr("pathLength") }}
  • -
  • {{ SVGAttr("patternContentUnits") }}
  • -
  • {{ SVGAttr("patternTransform") }}
  • -
  • {{ SVGAttr("patternUnits") }}
  • -
  • {{ SVGAttr("pointer-events") }}
  • -
  • {{ SVGAttr("points") }}
  • -
  • {{ SVGAttr("pointsAtX") }}
  • -
  • {{ SVGAttr("pointsAtY") }}
  • -
  • {{ SVGAttr("pointsAtZ") }}
  • -
  • {{ SVGAttr("preserveAlpha") }}
  • -
  • {{ SVGAttr("preserveAspectRatio") }}
  • -
  • {{ SVGAttr("primitiveUnits") }}
  • -
-

R

-
    -
  • {{ SVGAttr("r") }}
  • -
  • {{ SVGAttr("radius") }}
  • -
  • {{ SVGAttr("refX") }}
  • -
  • {{ SVGAttr("refY") }}
  • -
  • {{ SVGAttr("rendering-intent") }}
  • -
  • {{ SVGAttr("repeatCount") }}
  • -
  • {{ SVGAttr("repeatDur") }}
  • -
  • {{ SVGAttr("requiredExtensions") }}
  • -
  • {{ SVGAttr("requiredFeatures") }}
  • -
  • {{ SVGAttr("restart") }}
  • -
  • {{ SVGAttr("result") }}
  • -
  • {{ SVGAttr("rotate") }}
  • -
  • {{ SVGAttr("rx") }}
  • -
  • {{ SVGAttr("ry") }}
  • -
-

S

-
    -
  • {{ SVGAttr("scale") }}
  • -
  • {{ SVGAttr("seed") }}
  • -
  • {{ SVGAttr("shape-rendering") }}
  • -
  • {{ SVGAttr("slope") }}
  • -
  • {{ SVGAttr("spacing") }}
  • -
  • {{ SVGAttr("specularConstant") }}
  • -
  • {{ SVGAttr("specularExponent") }}
  • -
  • {{ SVGAttr("speed") }}
  • -
  • {{ SVGAttr("spreadMethod") }}
  • -
  • {{ SVGAttr("startOffset") }}
  • -
  • {{ SVGAttr("stdDeviation") }}
  • -
  • {{ SVGAttr("stemh") }}
  • -
  • {{ SVGAttr("stemv") }}
  • -
  • {{ SVGAttr("stitchTiles") }}
  • -
  • {{ SVGAttr("stop-color") }}
  • -
  • {{ SVGAttr("stop-opacity") }}
  • -
  • {{ SVGAttr("strikethrough-position") }}
  • -
  • {{ SVGAttr("strikethrough-thickness") }}
  • -
  • {{ SVGAttr("string") }}
  • -
  • {{ SVGAttr("stroke") }}
  • -
  • {{ SVGAttr("stroke-dasharray") }}
  • -
  • {{ SVGAttr("stroke-dashoffset") }}
  • -
  • {{ SVGAttr("stroke-linecap") }}
  • -
  • {{ SVGAttr("stroke-linejoin") }}
  • -
  • {{ SVGAttr("stroke-miterlimit") }}
  • -
  • {{ SVGAttr("stroke-opacity") }}
  • -
  • {{ SVGAttr("stroke-width") }}
  • -
  • {{ SVGAttr("style") }}
  • -
  • {{ SVGAttr("surfaceScale") }}
  • -
  • {{ SVGAttr("systemLanguage") }}
  • -
-

T

-
    -
  • {{ SVGAttr("tableValues") }}
  • -
  • {{ SVGAttr("target") }}
  • -
  • {{ SVGAttr("targetX") }}
  • -
  • {{ SVGAttr("targetY") }}
  • -
  • {{ SVGAttr("text-anchor") }}
  • -
  • {{ SVGAttr("text-decoration") }}
  • -
  • {{ SVGAttr("text-rendering") }}
  • -
  • {{ SVGAttr("textLength") }}
  • -
  • {{ SVGAttr("to") }}
  • -
  • {{ SVGAttr("transform") }}
  • -
  • {{ SVGAttr("type") }}
  • -
-

U

-
    -
  • {{ SVGAttr("u1") }}
  • -
  • {{ SVGAttr("u2") }}
  • -
  • {{ SVGAttr("underline-position") }}
  • -
  • {{ SVGAttr("underline-thickness") }}
  • -
  • {{ SVGAttr("unicode") }}
  • -
  • {{ SVGAttr("unicode-bidi") }}
  • -
  • {{ SVGAttr("unicode-range") }}
  • -
  • {{ SVGAttr("units-per-em") }}
  • -
-

V

-
    -
  • {{ SVGAttr("v-alphabetic") }}
  • -
  • {{ SVGAttr("v-hanging") }}
  • -
  • {{ SVGAttr("v-ideographic") }}
  • -
  • {{ SVGAttr("v-mathematical") }}
  • -
  • {{ SVGAttr("values") }}
  • -
  • {{ SVGAttr("version") }}
  • -
  • {{ SVGAttr("vert-adv-y") }}
  • -
  • {{ SVGAttr("vert-origin-x") }}
  • -
  • {{ SVGAttr("vert-origin-y") }}
  • -
  • {{ SVGAttr("viewBox") }}
  • -
  • {{ SVGAttr("viewTarget") }}
  • -
  • {{ SVGAttr("visibility") }}
  • -
-

W

-
    -
  • {{ SVGAttr("width") }}
  • -
  • {{ SVGAttr("widths") }}
  • -
  • {{ SVGAttr("word-spacing") }}
  • -
  • {{ SVGAttr("writing-mode") }}
  • -
-

X

-
    -
  • {{ SVGAttr("x") }}
  • -
  • {{ SVGAttr("x-height") }}
  • -
  • {{ SVGAttr("x1") }}
  • -
  • {{ SVGAttr("x2") }}
  • -
  • {{ SVGAttr("xChannelSelector") }}
  • -
  • {{ SVGAttr("xlink:actuate") }}
  • -
  • {{ SVGAttr("xlink:arcrole") }}
  • -
  • {{ SVGAttr("xlink:href") }}
  • -
  • {{ SVGAttr("xlink:role") }}
  • -
  • {{ SVGAttr("xlink:show") }}
  • -
  • {{ SVGAttr("xlink:title") }}
  • -
  • {{ SVGAttr("xlink:type") }}
  • -
  • {{ SVGAttr("xml:base") }}
  • -
  • {{ SVGAttr("xml:lang") }}
  • -
  • {{ SVGAttr("xml:space") }}
  • -
-

Y

-
    -
  • {{ SVGAttr("y") }}
  • -
  • {{ SVGAttr("y1") }}
  • -
  • {{ SVGAttr("y2") }}
  • -
  • {{ SVGAttr("yChannelSelector") }}
  • -
-

Z

-
    -
  • {{ SVGAttr("z") }}
  • -
  • {{ SVGAttr("zoomAndPan") }}
  • -
-
-

Categories

-

Animation event attributes

-

{{ SVGAttr("onbegin") }}, {{ SVGAttr("onend") }}, {{ SVGAttr("onload") }}, {{ SVGAttr("onrepeat") }}

-

Animation attribute target attributes

-

{{ SVGAttr("attributeType") }}, {{ SVGAttr("attributeName") }}

-

Animation timing attributes

-

{{ SVGAttr("begin") }}, {{ SVGAttr("dur") }}, {{ SVGAttr("end") }}, {{ SVGAttr("min") }}, {{ SVGAttr("max") }}, {{ SVGAttr("restart") }}, {{ SVGAttr("repeatCount") }}, {{ SVGAttr("repeatDur") }}, {{ SVGAttr("fill") }}

-

Animation value attributes

-

{{ SVGAttr("calcMode") }}, {{ SVGAttr("values") }}, {{ SVGAttr("keyTimes") }}, {{ SVGAttr("keySplines") }}, {{ SVGAttr("from") }}, {{ SVGAttr("to") }}, {{ SVGAttr("by") }}, {{ SVGAttr("autoReverse") }}, {{ SVGAttr("accelerate") }}, {{ SVGAttr("decelerate") }}

-

Animation addition attributes

-

{{ SVGAttr("additive") }}, {{ SVGAttr("accumulate") }}

-

Conditional processing attributes

-

{{ SVGAttr("requiredExtensions") }}, {{ SVGAttr("requiredFeatures") }}, {{ SVGAttr("systemLanguage") }}.

-

Core attributes

-

{{ SVGAttr("id") }}, {{ SVGAttr("xml:base") }}, {{ SVGAttr("xml:lang") }}, {{ SVGAttr("xml:space") }}

-

Document event attributes

-

{{ SVGAttr("onabort") }}, {{ SVGAttr("onerror") }}, {{ SVGAttr("onresize") }}, {{ SVGAttr("onscroll") }}, {{ SVGAttr("onunload") }}, {{ SVGAttr("onzoom") }}

-

Filter primitive attributes

-

{{ SVGAttr("height") }}, {{ SVGAttr("result") }}, {{ SVGAttr("width") }}, {{ SVGAttr("x") }}, {{ SVGAttr("y") }}

-

Graphical event attributes

-

{{ SVGAttr("onactivate") }}, {{ SVGAttr("onclick") }}, {{ SVGAttr("onfocusin") }}, {{ SVGAttr("onfocusout") }}, {{ SVGAttr("onload") }}, {{ SVGAttr("onmousedown") }}, {{ SVGAttr("onmousemove") }}, {{ SVGAttr("onmouseout") }}, {{ SVGAttr("onmouseover") }}, {{ SVGAttr("onmouseup") }}

-

Presentation attributes

-
- Note that all SVG presentation attributes can be used as CSS properties.
-

{{ SVGAttr("alignment-baseline") }}, {{ SVGAttr("baseline-shift") }}, {{ SVGAttr("clip") }}, {{ SVGAttr("clip-path") }}, {{ SVGAttr("clip-rule") }}, {{ SVGAttr("color") }}, {{ SVGAttr("color-interpolation") }}, {{ SVGAttr("color-interpolation-filters") }}, {{ SVGAttr("color-profile") }}, {{ SVGAttr("color-rendering") }}, {{ SVGAttr("cursor") }}, {{ SVGAttr("direction") }}, {{ SVGAttr("display") }}, {{ SVGAttr("dominant-baseline") }}, {{ SVGAttr("enable-background") }}, {{ SVGAttr("fill") }}, {{ SVGAttr("fill-opacity") }}, {{ SVGAttr("fill-rule") }}, {{ SVGAttr("filter") }}, {{ SVGAttr("flood-color") }}, {{ SVGAttr("flood-opacity") }}, {{ SVGAttr("font-family") }}, {{ SVGAttr("font-size") }}, {{ SVGAttr("font-size-adjust") }}, {{ SVGAttr("font-stretch") }}, {{ SVGAttr("font-style") }}, {{ SVGAttr("font-variant") }}, {{ SVGAttr("font-weight") }}, {{ SVGAttr("glyph-orientation-horizontal") }}, {{ SVGAttr("glyph-orientation-vertical") }}, {{ SVGAttr("image-rendering") }}, {{ SVGAttr("kerning") }}, {{ SVGAttr("letter-spacing") }}, {{ SVGAttr("lighting-color") }}, {{ SVGAttr("marker-end") }}, {{ SVGAttr("marker-mid") }}, {{ SVGAttr("marker-start") }}, {{ SVGAttr("mask") }}, {{ SVGAttr("opacity") }}, {{ SVGAttr("overflow") }}, {{ SVGAttr("pointer-events") }}, {{ SVGAttr("shape-rendering") }}, {{ SVGAttr("stop-color") }}, {{ SVGAttr("stop-opacity") }}, {{ SVGAttr("stroke") }}, {{ SVGAttr("stroke-dasharray") }}, {{ SVGAttr("stroke-dashoffset") }}, {{ SVGAttr("stroke-linecap") }}, {{ SVGAttr("stroke-linejoin") }}, {{ SVGAttr("stroke-miterlimit") }}, {{ SVGAttr("stroke-opacity") }}, {{ SVGAttr("stroke-width") }}, {{ SVGAttr("text-anchor") }}, {{ SVGAttr("text-decoration") }}, {{ SVGAttr("text-rendering") }}, {{ SVGAttr("unicode-bidi") }}, {{ SVGAttr("visibility") }}, {{ SVGAttr("word-spacing") }}, {{ SVGAttr("writing-mode") }}

-

Transfer function attributes

-

{{ SVGAttr("type") }}, {{ SVGAttr("tableValues") }}, {{ SVGAttr("slope") }}, {{ SVGAttr("intercept") }}, {{ SVGAttr("amplitude") }}, {{ SVGAttr("exponent") }}, {{ SVGAttr("offset") }}

- -

{{ SVGAttr("xlink:href") }}, {{ SVGAttr("xlink:type") }}, {{ SVGAttr("xlink:role") }}, {{ SVGAttr("xlink:arcrole") }}, {{ SVGAttr("xlink:title") }}, {{ SVGAttr("xlink:show") }}, {{ SVGAttr("xlink:actuate") }}

diff --git a/files/ar/web/svg/index.html b/files/ar/web/svg/index.html deleted file mode 100644 index a1a48347e6..0000000000 --- a/files/ar/web/svg/index.html +++ /dev/null @@ -1,94 +0,0 @@ ---- -title: SVG -slug: Web/SVG -tags: - - 2D Graphics - - NeedsTranslation - - References - - SVG - - TopicStub -translation_of: Web/SVG ---- -
- Getting Started
- This tutorial will help get you started using SVG.
-

Scalable Vector Graphics (SVG) is an XML {{Glossary("markup language")}} for describing two-dimensional {{Glossary("vector graphics")}}. SVG is essentially to graphics what {{Glossary("XHTML")}} is to text.

-

SVG is similar in scope to Adobe's proprietary Flash technology, but what distinguishes SVG from Flash is that it is a W3C recommendation (i.e., a standard) and that it is {{Glossary("XML")}}-based as opposed to a closed binary format. It is explicitly designed to work with other W3C standards such as CSS, DOM and SMIL.

-
-
-

Documentation

-
-
- SVG element reference
-
- Get details about each SVG element.
-
- SVG attribute reference
-
- Get details about each SVG attribute.
-
- SVG DOM interface reference
-
- Get details about the whole SVG DOM API.
-
- Enhance HTML content
-
- SVG works together with {{Glossary("HTML")}}, {{Glossary("CSS")}} and {{Glossary("JavaScript")}}. Use SVG to enhance a regular HTML page or web application.
-
- SVG in Mozilla
-
- Notes and information on how SVG is implemented in Mozilla. - -
-
-

View All...

-

Community

-
    -
  • View Mozilla forums... {{DiscussionList("dev-tech-svg", "mozilla.dev.tech.svg")}}
  • -
-

Tools

- -
-
- - -

Animation and interactions

-

Like HTML, SVG has a document model (DOM), events and is accessible from JavaScript. This allows developers to create rich animations and interactive images.

- -

Mapping, charting, games & 3D experiments

-

While a little SVG can go a long way to enhanced web content, here are some examples of heavy SVG usage.

- -
-
-

 

diff --git a/files/ar/web/tutorials/index.html b/files/ar/web/tutorials/index.html deleted file mode 100644 index a552f18f6b..0000000000 --- a/files/ar/web/tutorials/index.html +++ /dev/null @@ -1,217 +0,0 @@ ---- -title: دروس -slug: Web/Tutorials -tags: - - CSS - - HTML - - MDN - - أساسيات الويب - - تدريب - - تصميم الويب - - تعليمات برمجية - - جافاسكربت JavaScript - - دليل - - مبتدئين -translation_of: Web/Tutorials ---- -

تقودك الروابط في هذه الصفحة إلى دروس ومواد تدريبيّة متنوعة. سواءً كنت في بداياتك، أو تتعلم الأساسيات، أو كنت مطوراً مُخضرماً، فستجد في هذه الصفحة مصادر مفيدة لأفضل الممارسات البرمجيّة. هذه المصادر مُنشئَة من قبل شركات رائدة ومطورين ويب مِمَن تبنوا معايير المصادر المفتوحة والممارسات التطويريّة الفُضلى، كما توفِر أو تسمح بإنشاء ترجمات من خلال رخص مفتوحة مثل المشاع الإبداعي (Creative Commons).

- -

للجدد على الويب

- -
-
البدء مع الويب
-
-

البدء مع الويب هي سلسلة موجزة تُعرِّفُك على عملية تطوير الويب. سوف نبدأ معك من إعداد الأدوات التي ستحتاجها لبناء صفحة ويب بسيطة وصولاً لعمليّة نشرها.

-
-
- -

دروس عن لغة ترميز النص الفائق (HTML)

- -

مستوى مُبتدئ

- -
-
-
-
مقدمة إلى لغة ترميز النص الفائق (HTML)
-
تُعَد هذه الوحدة تمهيداً للطريق حيث تُهيِئُك لتعلم الصيغة الكتابيّة والمفاهيم الأساسيّة في اللغة، مغطيةً مواضيع مثل التعامل مع النصوص، إنشاء روابط تشعيبيّة (hyperlinks)، وكيفيّة استخدام اللغة لهيكلة صفحة ويب.
-
مرجع MDN لعناصر لغة ترميز النص الفائق HTML
-
مرجع شامل لعناصر لغة ترميز النص الفائق، ودعم المتصفحات المختلفة لكلٍ منها.
-
إنشاء صفحة بسيطة باستخدام لغة ترميز النص الفائق HTML (موقع The Blog Starter)
-
دليل لغة ترميز النص الفائق للمبتدئين يتضمن شروحات للوسوم الشائعة، ولوسوم الإصدار الخامس من اللغة. يتضمن هذا المرجع أيضاً دليل تدريجي لبناء صفحة ويب بسيطة.
-
تحديات في لغة ترميز النص الفائق HTML (موقع Wikiversity)
-
استخدم هذه التحديات لتشحذ مهاراتك (على سبيل المثال، "هل يجب أن استخدم العنصر <h2> أم العنصر <strong>؟")، ولتُركِز على مهارة التنسيق الدقيق (استخدام العنصر الصحيح في الوقت الصحيح وبالشكل الصحيح).
-
-
-
- -

مستوى متوسط

- -
-
-
-
الوسائط المتعددة (Multimedia) و التضمين (Embedding)
-
نستكشف في هذه الوحدة كيفيّة استخدام لغة ترميز النص الفائق لتضمين الوسائط المتعددة (multimedia) المختلفة في مواقع الويب، كما ونغطي الطرق المُختلفة التي يمكن استخدامها لتضمين الصور، وإضافة ملفات الفيديو والصوت، أو حتى تضمين موقع آخر بأكمله.
-
الجداول في لغة ترميز النص الفائق HTML
-
يُشكِل تقديم البيانات المجدولة في الموقع بشكل مفهوم، ومُتاح (accessible) تحدياً. تغطي هذه الوحدة مبادئ هيكلة الجداول، كما تغطي مزايا أكثر تعقيداً مثل التعليقات (captions) والخلاصات (summaries) الجدوليّة.
-
-
-
- -

مستوى متقدم

- -
-
-
-
الاستمارات (Forms) في لغة ترميز النص الفائق HTML
-
الاستمارات (Forms) هي جزء مهم جداً من الويب، فهي توفر آليّة للتفاعل مع المواقع (على سبيل المثال، التسجيل وتسجيل الدخول، وإرسال التعليقات، وشراء المنتجات، وغيرها من الأمور). تُهيئك هذه الوحدة على إنشاء أجزاء الاستمارات المتعلقة بجهة العميل (client-side).
-
نصائح لكتابة صفحات HTML سريعة التحميل
-
تعطي المقالة نصائح لكتابة صفحات ويب توفِر استجابة أكبر للزوار وتُقلل من الحمل على خادم والويب وإتصال الإنترنت.
-
-
-
- -

دروس عن تقنيّة صفحات الأنماط الانسيابية (CSS)

- -

مستوى مبتدئ

- -
-
-
-
أساسيات صفحات الأنماط الانسيابية CSS
-
تُستخدم هذه التقنيّة (CSS) لتصميم مظهر صفحتك. تبدأ معك هذه المقالة من ما ستحتاجه لتبدأ العمل. سنجيب عن أسئلة مثل: كيف يمكنني جعل لون نصي أسود أو أحمر؟ كيف يمكنني جعل محتواي يظهر في المكان الفلاني على الشاشة؟ كيف أُزخرِف صفحتي بصورة أو بلون في الخلفيّة؟
-
مقدمة في صفحات الأنماط الانسيابية CSS
-
تبدأ هذه الوحدة معك بأساسيات عمل هذه التقنيّة، متضمنةً معلومات عن المحددات (selectors) والخواص (properties)، وكتابة التعليمات، وتطبيق التنسيقات المجراة على صفحة لغة ترميز النص الفائق، وكيفيّة تحديد الطول واللون وأمور أخرى، والتتالي (cascade)، والوراثة (inheritance)، وأساسيات نموذج الصندوق (box model)، والتنقيح (debugging).
-
صناديق التصميم
-
سنأخذ في هذه الوحدة نظرة على صناديق التصميم (styling boxes)، والتي تعد واحدة من الخطوات الأساسيّة نحو تنظيم صفحة الويب. في هذه المقالة سنلخص نموذج الصندوق (box model)، وبعدها سنأخذ نظرة حول التحكم بنماذج الصندوق عن طريق إعداد الحشو (margin)، والحواف (border)، والهوامش (padding)، وإعداد لون خلفية مخصصة، والصور وغيرها من الميزات. كما تشرح المقالة ميزات زخرفيّة، مثل استخدام الظلال (shadows) والمرشحات (filters) على الصناديق.
-
تنسيق النصوص
-
تحتوي هذه المقالة على شرح لأساسيات تنسيق النصوص. تتضمن المقالة أيضاً معلومات عن كيفيّة إعداد الخطوط الغامقة والمائلة، والمسافات بين الحروف والسطور، والظلال، وغيرها من خواص النصوص. ننهي المقالة بشرح كيفيّة إضافة خطوط مخصصة لصفحتك، وتنسيق القوائم والروابط.
-
الأسئلة الشائعة حول تقنيّة CSS
-
الأسئلة الشائعة المطروحة من المبتدئين حول اللغة وأجوبتها.
-
-
-
- -

مستوى متوسط

- -
-
-
-
نظام الترتيب للـ CSS
-
في هذه المرحلة سنكون قد أخذنا نظرة حول أساسيات صفحات الأنماط الانسيابية، بدءً من كيفيّة تنسيق النصوص، إلى تنسيق والتلاعب بالصناديق التي يوجد بها محتواك. الآن حان الوقت لأخذ نظرة حول كيفيّة وضع صناديقك في المكان المناسب. قد غطينا في هذه المقالة المتطلبات الضروريّة اللازمة حتّى تتمكن من الغوص في عالم النمذجة (layout)، وتتمكن من تعلم إعدادات العرض المختلفة، وطرق النمذجة التقليديّة والتي تنطوي على التعويم (float)، والتعيين (positioning)، وأدوات التخطيط الجديدة مثل الصندوق المرن (flexbox).
-
مرجع صفحات الأنماط الانسيابية CSS
-
مرجع شامل للتقنيّة، مع تفاصيل دعم خواصها من مُتصفح فايرفوكس وغيره من المتصفحات.
-
-
- -
-
-
شبكات التخطيط السلسة (Fluid Grids) (موقع A List Apart)
-
تصميم نماذج تتحجم بسلاسة مع نافذة المتصفح باستخدام الشبكة الطباعيّة (typographic grid).
-
تحديات في صفحات الأنماط الانسيابية CSS (موقع Wikiversity)
-
اشحذ مهاراتك، واكتشف نقاط الضعف لديك لتتمرن أكثر مع هذه التمرينات العمليّة.
-
-
-
- -

مستوى متقدم

- -
-
-
-
استخدام التحويلات الهندسيّة في صفحات الأنماط الانسيابية CSS
-
تطبيق التدوير (rotation)، والميلان (skewing)، والتحجيم (scaling)، والإزاحة (translation) باستخدام صفحات الأنماط الانسيابية.
-
تقنيّة الانتقالات (المقطع الانتقالي) في CSS
-
توفر تقنيّة الانتقالات (أو المقطع الانتقالي - transitions)، التي تعد جزءً من مسودة الإصدار الثالث من صفحات الأنماط الانسيابية، وسيلة لإحياء (animate) التغييرات في خصائص اللغة، بدلاً من تنفيذها فورياً.
-
الدليل السريع لاستخدام الخطوط (Fonts) باستخدام الخاصية font-face@ (موقع HTML5 Rocks)
-
تتيح لك الخاصيّة font-face@ في الإصدار الثالث من صفحات الأنماط الانسيابية استخدام الخطوط المُخصصة في مواقع الويب بطريقة سهلة الوصول إليها، سهلة الاستخدام، وقابلة للتوسع.
-
-
-
- -
-
-
دورة كانفاس (Canvas)
-
تعلم طريقة رسم الرسومات برمجياً باستخدام عنصر الكانفاس (canvas).
-
-
- -

دروس عن لغة الجافاسكربت JavaScript

- -

مستوى مبتدئ

- -
-
-
-
الخطوات الأولى مع الجافاسكربت
-
تجيب هذه المقالة عن بعض الأسئلة الأساسيّة، مثل "ما هي الجافاسكربت؟"، "كيف تبدو هذه اللغة؟"، "ماذا بإمكانها أن تفعل؟"، بالإضافة إلى مناقشة بعض الميزات الأساسيّة للغة مثل المتغيّرات، والسلاسل النصية، والأرقام، والمصفوفات.
-
العناصر الأساسية للغة الجافاسكربت
-
نكمل رحلتنا في تغطيّة المفاهيم الأساسية في لغة الجافاسكربت، ففي هذه المقالة قمنا بالتركيز على البنى الكتليّة الشائعة في اللغة مثل الجمل الشرطيّة، والحلقات، والدوال، والأحداث.
-
-
- -
-
-
البدء مع لغة الجافاسكربت
-
ما هي لغة الجافاسكربت وكيف يمكن أن تساعدك؟
-
موقع Codecademy
-
موقع سهل لتعليم كيفيّة البرمجة باستخدام لغة الجافاسكربت. يوفِر لك الموقع منصة تفاعليّة، كما يمكنك استخدامه أيضاً للتعلم مع أصدقاءك.
-
-
-
- -

مستوى متوسط

- -
-
مقدمة إلى الكائنات في الجافاسكربت
-
من المهم فهم البرمجة الشيئيّة في اللغة إذا أردت زيادة معرفتك والتمكن من كتابة شيفرة برمجيّة أكثر فعاليّة، من أجل ذلك قمنا بتوفير هذه الوحدة لك.
-
- -
-
-
-
واجهات التصميم البرمجيّة (APIs) لجهة المستخدم (Client-side)
-
لن تستطيع العمل جيداً عند تطوير جهة المستخدم (client-side) باستخدام الجافاسكربت من دون تعلمك للواجهات البرمجيّة المتخصصة، فهي واجهات للتلاعب بأجزاء مختلفة من المُتصفِح ونظام التشغيل الذي يعمل عليه الموقع، أو حتى التلاعب بحقول بيانات مواقع أو خدمات أخرى. في هذه الوحدة سنستكشف ماهيّة هذه الواجهات، وكيف تستخدم بعض من أكثر تلك الواجهات شيوعاً والتي ستحتاجها غالباً في عملك.
-
-
- -
-
-
إعادة تقديم لغة الجافاسكربت
-
ملخص للغة الجافاسكربت يستهدف المطورين متوسطي الخبرة.
-
الجافاسكربت الفصيح (Eloquent JavaScript)
-
دليل شامل للمنهجيات (methodologies) المتقدمة والمتوسطة للغة الجافاسكربت .
-
-
-
- -

مستوى متقدم

- -
-
-
-
دليل لغة الجافاسكربت
-
دليل شامل ومُحدَث باستمرار للغة الجافاسكربت لجميع المستويات من المبتدئ إلى المحترف.
-
أنت لا تعرف لغة الجافاسكربت (Kyle Simpson)
-
سلسلة من الكِتُب تتعمق في آليات لغة الجافاسكربت الجوهريّة.
-
كيف تعمل المتصفحات
-
-
-
مقالة بحثيّة تفصيليّة تشرح المتصفحات الحديثة المختلفة ومحركاتها وآلية عرضها للصفحات ...إلخ.
-
-
-
فيديوهات عن لغة الجافاسكربت (جيتهاب)
-
مجموعة من الفيديوهات عن لغة الجافاسكربت.
-
-
-
- -

تطوير إضافات المتصفح

- -
-
-
-
تقنيّة WebExtensions
-
نظام عابر للمتصفحات (cross-browser) لتطوير الإضافات. يتوافق النظام إلى حدٍ كبير مع واجهة الإضافات البرمجيّة المدعومة بواسطة متصفخ جوجل وكروم وأوبرا، كما يتوافق مع مسودة W3C المجتمعيّة. الإضافات المكتوبة لتلك المتصفحات ستعمل على فايرفوكس ومايكروسوفت أيدج في معظم الحالات بتغييرات طفيفة. الواجهة البرمجيّة متوافقة أيضاً مع فايرفوكس متعدد العمليات (multiprocess firefox).
-
-
-
-- cgit v1.2.3-54-g00ecf