rapid-router 5.4.1__py2.py3-none-any.whl → 7.6.8__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- example_project/rapid_router_test_settings.py +164 -0
- example_project/settings.py +152 -0
- example_project/urls.py +15 -0
- example_project/{example_project/wsgi.py → wsgi.py} +2 -1
- game/__init__.py +1 -1
- game/admin.py +43 -4
- game/app_settings.py +3 -7
- game/character.py +26 -18
- game/decor.py +172 -97
- game/end_to_end_tests/base_game_test.py +44 -33
- game/end_to_end_tests/editor_page.py +17 -2
- game/end_to_end_tests/game_page.py +127 -45
- game/end_to_end_tests/selenium_test_case.py +1 -20
- game/end_to_end_tests/test_cow_crashes.py +3 -5
- game/end_to_end_tests/test_language_dropdown.py +14 -0
- game/end_to_end_tests/test_level_editor.py +290 -0
- game/end_to_end_tests/test_level_failures.py +1 -1
- game/end_to_end_tests/test_level_selection.py +79 -0
- game/end_to_end_tests/test_play_through.py +240 -102
- game/end_to_end_tests/test_python_levels.py +44 -13
- game/end_to_end_tests/test_saving_workspace.py +22 -0
- game/forms.py +9 -2
- game/level_management.py +38 -29
- game/messages.py +1218 -203
- game/migrations/0001_squashed_0025_levels_ordering_pt1.py +19 -1
- game/migrations/0026_levels_pt2.py +13 -2
- game/migrations/0032_cannot_turn_left_level.py +13 -2
- game/migrations/0033_recursion_level.py +13 -2
- game/migrations/0034_joes_level.py +13 -2
- game/migrations/0035_disable_route_score_level_70.py +0 -2
- game/migrations/0036_level_score_73.py +0 -2
- game/migrations/0037_level_score_79.py +0 -2
- game/migrations/0038_level_score_40.py +0 -1
- game/migrations/0042_level_score_73.py +0 -2
- game/migrations/0048_add_cow_field_and_blocks.py +0 -2
- game/migrations/0049_level_score_34.py +0 -2
- game/migrations/0050_level_score_40.py +0 -2
- game/migrations/0051_level_score_49.py +0 -1
- game/migrations/0076_level_locked_for_class.py +19 -0
- game/migrations/0077_alter_level_next_level.py +52 -0
- game/migrations/0078_add_block_types.py +23 -0
- game/migrations/0079_populate_block_type_add_cow_blocks.py +60 -0
- game/migrations/0080_level_disable_algorithm_score.py +18 -0
- game/migrations/0081_first_12_levels_no_algo_score.py +29 -0
- game/migrations/0082_level_43_solution.py +16 -0
- game/migrations/0083_add_cows_to_existing_levels.py +195 -0
- game/migrations/0084_alter_block_block_type.py +18 -0
- game/migrations/0085_add_new_blocks.py +53 -0
- game/migrations/0086_loop_levels.py +482 -0
- game/migrations/0087_workspace_python_view_enabled.py +18 -0
- game/migrations/0088_rename_episodes.py +35 -0
- game/migrations/0089_episodes_in_development.py +30 -0
- game/migrations/0090_add_missing_model_solutions.py +144 -0
- game/migrations/0091_disable_algo_score_if_no_model_solution.py +46 -0
- game/migrations/0092_disable_algo_score_in_custom_levels.py +28 -0
- game/migrations/0093_alter_level_character_name.py +18 -0
- game/migrations/0094_add_hint_lesson_subtitle_to_levels.py +28 -0
- game/migrations/0095_level_commands.py +18 -0
- game/migrations/0096_alter_level_commands.py +18 -0
- game/migrations/0097_add_python_den_levels.py +1515 -0
- game/migrations/0098_add_episode_link_fields.py +44 -0
- game/migrations/0099_python_episodes_links.py +103 -0
- game/migrations/0100_reorder_python_levels.py +179 -0
- game/migrations/0101_rename_episodes.py +45 -0
- game/migrations/0102_reoder_episodes_13_14.py +136 -0
- game/migrations/0103_level_1015_solution.py +26 -0
- game/migrations/0104_remove_level_direct_drive.py +17 -0
- game/migrations/0105_delete_invalid_attempts.py +18 -0
- game/migrations/0106_fields_to_snake_case.py +48 -0
- game/migrations/0107_rename_worksheet_link_episode_student_worksheet_link.py +18 -0
- game/migrations/0108_episode_indy_worksheet_link.py +18 -0
- game/migrations/0109_create_episodes_23_and_24.py +99 -0
- game/migrations/0110_remove_episode_indy_worksheet_link_and_more.py +100 -0
- game/migrations/0111_create_worksheets.py +149 -0
- game/migrations/0112_worksheet_locked_classes.py +21 -0
- game/migrations/0113_level_needs_approval.py +18 -0
- game/migrations/0114_default_and_non_student_levels_no_approval.py +31 -0
- game/migrations/0115_level_level__default_does_not_need_approval.py +22 -0
- game/migrations/0116_update_worksheet_video_links.py +68 -0
- game/migrations/0117_update_solutions_to_if_else.py +61 -0
- game/models.py +157 -16
- game/permissions.py +34 -19
- game/python_den_urls.py +26 -0
- game/random_road.py +43 -127
- game/serializers.py +12 -17
- game/static/django_reverse_js/js/reverse.js +171 -0
- game/static/game/css/LilitaOne-Regular.ttf +0 -0
- game/static/game/css/backgrounds.css +14 -10
- game/static/game/css/dataTables.custom.css +4 -2
- game/static/game/css/dataTables.jqueryui.css +561 -320
- game/static/game/css/editor.css +47 -0
- game/static/game/css/game.css +43 -49
- game/static/game/css/game_screen.css +116 -53
- game/static/game/css/jquery.dataTables.css +455 -251
- game/static/game/css/level_editor.css +10 -1
- game/static/game/css/level_selection.css +32 -3
- game/static/game/css/level_share.css +6 -5
- game/static/game/css/skulpt/codemirror.css +1 -0
- game/static/game/image/Python_Den_hero_student.png +0 -0
- game/static/game/image/Python_levels_page.svg +1954 -0
- game/static/game/image/characters/front_view/Electric_van.svg +448 -0
- game/static/game/image/characters/top_view/Electric_van.svg +448 -0
- game/static/game/image/characters/top_view/Sleigh.svg +436 -0
- game/static/game/image/decor/city/solar_panel.svg +1200 -0
- game/static/game/image/decor/farm/solar_panel.svg +86 -0
- game/static/game/image/decor/grass/solar_panel.svg +86 -0
- game/static/game/image/decor/snow/barn.svg +1788 -0
- game/static/game/image/decor/snow/cfc.svg +1050 -147
- game/static/game/image/decor/snow/crops.svg +7370 -0
- game/static/game/image/decor/snow/hospital.svg +1220 -0
- game/static/game/image/decor/snow/house1.svg +971 -0
- game/static/game/image/decor/snow/house2.svg +1574 -0
- game/static/game/image/decor/snow/school.svg +1071 -0
- game/static/game/image/decor/snow/shop.svg +3211 -0
- game/static/game/image/decor/snow/solar_panel.svg +173 -0
- game/static/game/image/electric_van.svg +448 -0
- game/static/game/image/icons/add_house.svg +26 -0
- game/static/game/image/icons/delete_house.svg +26 -0
- game/static/game/image/icons/description.svg +1 -0
- game/static/game/image/icons/hint.svg +1 -0
- game/static/game/image/icons/if_else.svg +3 -0
- game/static/game/image/icons/python.svg +1 -1
- game/static/game/image/if_else_example.png +0 -0
- game/static/game/image/pigeon.svg +684 -0
- game/static/game/image/python_den_header.svg +19 -0
- game/static/game/js/animation.js +84 -28
- game/static/game/js/blockly/msg/js/bg.js +52 -1
- game/static/game/js/blockly/msg/js/ca.js +52 -1
- game/static/game/js/blockly/msg/js/en-gb.js +52 -1
- game/static/game/js/blockly/msg/js/en.js +52 -1
- game/static/game/js/blockly/msg/js/es.js +52 -1
- game/static/game/js/blockly/msg/js/fr.js +52 -1
- game/static/game/js/blockly/msg/js/hi.js +52 -1
- game/static/game/js/blockly/msg/js/it.js +52 -1
- game/static/game/js/blockly/msg/js/pl.js +52 -1
- game/static/game/js/blockly/msg/js/pt-br.js +52 -1
- game/static/game/js/blockly/msg/js/ru.js +52 -1
- game/static/game/js/blockly/msg/js/ur.js +52 -1
- game/static/game/js/blocklyCompiler.js +550 -392
- game/static/game/js/blocklyControl.js +335 -302
- game/static/game/js/blocklyCustomBlocks.js +691 -458
- game/static/game/js/blocklyCustomisations.js +3 -1
- game/static/game/js/button.js +12 -0
- game/static/game/js/cow.js +15 -130
- game/static/game/js/drawing.js +313 -201
- game/static/game/js/editor.js +23 -0
- game/static/game/js/game.js +148 -139
- game/static/game/js/jquery.dataTables.min.js +3 -159
- game/static/game/js/level_editor.js +823 -448
- game/static/game/js/level_moderation.js +33 -2
- game/static/game/js/level_selection.js +62 -25
- game/static/game/js/loadLanguages.js +21 -0
- game/static/game/js/map.js +106 -36
- game/static/game/js/model.js +55 -107
- game/static/game/js/pathFinder.js +73 -72
- game/static/game/js/program.js +184 -193
- game/static/game/js/pythonControl.js +14 -1
- game/static/game/js/scoreboard.js +0 -37
- game/static/game/js/scoreboardSharedLevels.js +48 -0
- game/static/game/js/sharing.js +22 -10
- game/static/game/js/skulpt/codemirror.js +5 -4
- game/static/game/js/skulpt/skulpt-stdlib.js +1 -1
- game/static/game/js/sound.js +52 -5
- game/static/game/js/van.js +0 -7
- game/static/game/raphael_image/characters/top_view/Electric_van.svg +448 -0
- game/static/game/raphael_image/characters/top_view/Sleigh.svg +436 -0
- game/static/game/raphael_image/decor/city/solar_panel.svg +1200 -0
- game/static/game/raphael_image/decor/farm/solar_panel.svg +86 -0
- game/static/game/raphael_image/decor/grass/solar_panel.svg +86 -0
- game/static/game/raphael_image/decor/snow/barn.svg +1788 -0
- game/static/game/raphael_image/decor/snow/cfc.svg +1050 -147
- game/static/game/raphael_image/decor/snow/crops.svg +7370 -0
- game/static/game/raphael_image/decor/snow/hospital.svg +1220 -0
- game/static/game/raphael_image/decor/snow/house1.svg +971 -0
- game/static/game/raphael_image/decor/snow/house2.svg +1574 -0
- game/static/game/raphael_image/decor/snow/school.svg +1071 -0
- game/static/game/raphael_image/decor/snow/shop.svg +3211 -0
- game/static/game/raphael_image/decor/snow/solar_panel.svg +173 -0
- game/static/game/raphael_image/pigeon.svg +685 -0
- game/static/game/raphael_image/sleigh_wreckage.svg +430 -0
- game/static/game/sass/game.scss +22 -6
- game/static/game/sound/clown_horn.mp3 +0 -0
- game/static/game/sound/clown_horn.ogg +0 -0
- game/static/game/sound/electric_van_starting.mp3 +0 -0
- game/static/game/sound/electric_van_starting.ogg +0 -0
- game/static/game/sound/pigeon.mp3 +0 -0
- game/static/game/sound/pigeon.ogg +0 -0
- game/static/game/sound/sleigh_bells.mp3 +0 -0
- game/static/game/sound/sleigh_bells.ogg +0 -0
- game/static/game/sound/sleigh_crash.mp3 +0 -0
- game/static/game/sound/sleigh_crash.ogg +0 -0
- game/templates/game/base.html +35 -15
- game/templates/game/basenonav.html +23 -17
- game/templates/game/game.html +236 -111
- game/templates/game/level_editor.html +353 -275
- game/templates/game/level_moderation.html +19 -6
- game/templates/game/level_selection.html +75 -62
- game/templates/game/python_den_level_selection.html +291 -0
- game/templates/game/python_den_worksheet.html +101 -0
- game/templates/game/scoreboard.html +88 -65
- game/tests/test_level_editor.py +210 -35
- game/tests/test_level_moderation.py +6 -20
- game/tests/test_level_selection.py +332 -11
- game/tests/test_python_den_worksheet.py +85 -0
- game/tests/test_scoreboard.py +258 -66
- game/tests/utils/level.py +43 -3
- game/tests/utils/teacher.py +2 -2
- game/theme.py +21 -21
- game/urls.py +125 -78
- game/views/language_code_conversions.py +90 -0
- game/views/level.py +201 -63
- game/views/level_editor.py +109 -48
- game/views/level_moderation.py +29 -6
- game/views/level_selection.py +179 -56
- game/views/level_solutions.py +600 -106
- game/views/scoreboard.py +181 -66
- game/views/worksheet.py +25 -0
- rapid_router-7.6.8.dist-info/METADATA +174 -0
- {rapid_router-5.4.1.dist-info → rapid_router-7.6.8.dist-info}/RECORD +222 -242
- {rapid_router-5.4.1.dist-info → rapid_router-7.6.8.dist-info}/WHEEL +1 -1
- rapid_router-7.6.8.dist-info/licenses/LICENSE.md +3 -0
- example_project/example_project/__init__.py +0 -1
- example_project/example_project/settings.py +0 -54
- example_project/example_project/urls.py +0 -16
- example_project/manage.py +0 -10
- game/autoconfig.py +0 -59
- game/csp_config.py +0 -23
- game/locale/ar_SA/LC_MESSAGES/django.mo +0 -0
- game/locale/ar_SA/LC_MESSAGES/django.po +0 -405
- game/locale/ar_SA/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/ar_SA/LC_MESSAGES/djangojs.po +0 -743
- game/locale/bg_BG/LC_MESSAGES/django.mo +0 -0
- game/locale/bg_BG/LC_MESSAGES/django.po +0 -405
- game/locale/bg_BG/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/bg_BG/LC_MESSAGES/djangojs.po +0 -739
- game/locale/ca_ES/LC_MESSAGES/django.mo +0 -0
- game/locale/ca_ES/LC_MESSAGES/django.po +0 -405
- game/locale/ca_ES/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/ca_ES/LC_MESSAGES/djangojs.po +0 -740
- game/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
- game/locale/cs_CZ/LC_MESSAGES/django.po +0 -405
- game/locale/cs_CZ/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/cs_CZ/LC_MESSAGES/djangojs.po +0 -741
- game/locale/cy_GB/LC_MESSAGES/django.mo +0 -0
- game/locale/cy_GB/LC_MESSAGES/django.po +0 -405
- game/locale/cy_GB/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/cy_GB/LC_MESSAGES/djangojs.po +0 -743
- game/locale/de_DE/LC_MESSAGES/django.mo +0 -0
- game/locale/de_DE/LC_MESSAGES/django.po +0 -405
- game/locale/de_DE/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/de_DE/LC_MESSAGES/djangojs.po +0 -739
- game/locale/el_GR/LC_MESSAGES/django.mo +0 -0
- game/locale/el_GR/LC_MESSAGES/django.po +0 -405
- game/locale/el_GR/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/el_GR/LC_MESSAGES/djangojs.po +0 -739
- game/locale/en_GB/LC_MESSAGES/django.mo +0 -0
- game/locale/en_GB/LC_MESSAGES/django.po +0 -405
- game/locale/en_GB/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/en_GB/LC_MESSAGES/djangojs.po +0 -739
- game/locale/es_ES/LC_MESSAGES/django.mo +0 -0
- game/locale/es_ES/LC_MESSAGES/django.po +0 -405
- game/locale/es_ES/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/es_ES/LC_MESSAGES/djangojs.po +0 -739
- game/locale/fi_FI/LC_MESSAGES/django.mo +0 -0
- game/locale/fi_FI/LC_MESSAGES/django.po +0 -405
- game/locale/fi_FI/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/fi_FI/LC_MESSAGES/djangojs.po +0 -739
- game/locale/fr_FR/LC_MESSAGES/django.mo +0 -0
- game/locale/fr_FR/LC_MESSAGES/django.po +0 -405
- game/locale/fr_FR/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/fr_FR/LC_MESSAGES/djangojs.po +0 -739
- game/locale/gu_IN/LC_MESSAGES/django.mo +0 -0
- game/locale/gu_IN/LC_MESSAGES/django.po +0 -405
- game/locale/gu_IN/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/gu_IN/LC_MESSAGES/djangojs.po +0 -739
- game/locale/hi_IN/LC_MESSAGES/django.mo +0 -0
- game/locale/hi_IN/LC_MESSAGES/django.po +0 -405
- game/locale/hi_IN/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/hi_IN/LC_MESSAGES/djangojs.po +0 -739
- game/locale/id_ID/LC_MESSAGES/django.mo +0 -0
- game/locale/id_ID/LC_MESSAGES/django.po +0 -405
- game/locale/id_ID/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/id_ID/LC_MESSAGES/djangojs.po +0 -738
- game/locale/it_IT/LC_MESSAGES/django.mo +0 -0
- game/locale/it_IT/LC_MESSAGES/django.po +0 -405
- game/locale/it_IT/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/it_IT/LC_MESSAGES/djangojs.po +0 -739
- game/locale/ja_JP/LC_MESSAGES/django.mo +0 -0
- game/locale/ja_JP/LC_MESSAGES/django.po +0 -405
- game/locale/ja_JP/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/ja_JP/LC_MESSAGES/djangojs.po +0 -738
- game/locale/lol_US/LC_MESSAGES/django.mo +0 -0
- game/locale/lol_US/LC_MESSAGES/django.po +0 -405
- game/locale/lol_US/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/lol_US/LC_MESSAGES/djangojs.po +0 -739
- game/locale/nb_NO/LC_MESSAGES/django.mo +0 -0
- game/locale/nb_NO/LC_MESSAGES/django.po +0 -405
- game/locale/nb_NO/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/nb_NO/LC_MESSAGES/djangojs.po +0 -739
- game/locale/nl_NL/LC_MESSAGES/django.mo +0 -0
- game/locale/nl_NL/LC_MESSAGES/django.po +0 -405
- game/locale/nl_NL/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/nl_NL/LC_MESSAGES/djangojs.po +0 -739
- game/locale/pl_PL/LC_MESSAGES/django.mo +0 -0
- game/locale/pl_PL/LC_MESSAGES/django.po +0 -405
- game/locale/pl_PL/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/pl_PL/LC_MESSAGES/djangojs.po +0 -741
- game/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
- game/locale/pt_BR/LC_MESSAGES/django.po +0 -405
- game/locale/pt_BR/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/pt_BR/LC_MESSAGES/djangojs.po +0 -739
- game/locale/pt_PT/LC_MESSAGES/django.mo +0 -0
- game/locale/pt_PT/LC_MESSAGES/django.po +0 -405
- game/locale/pt_PT/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/pt_PT/LC_MESSAGES/djangojs.po +0 -739
- game/locale/ro_RO/LC_MESSAGES/django.mo +0 -0
- game/locale/ro_RO/LC_MESSAGES/django.po +0 -405
- game/locale/ro_RO/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/ro_RO/LC_MESSAGES/djangojs.po +0 -740
- game/locale/ru_RU/LC_MESSAGES/django.mo +0 -0
- game/locale/ru_RU/LC_MESSAGES/django.po +0 -405
- game/locale/ru_RU/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/ru_RU/LC_MESSAGES/djangojs.po +0 -741
- game/locale/sv_SE/LC_MESSAGES/django.mo +0 -0
- game/locale/sv_SE/LC_MESSAGES/django.po +0 -405
- game/locale/sv_SE/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/sv_SE/LC_MESSAGES/djangojs.po +0 -739
- game/locale/tl_PH/LC_MESSAGES/django.mo +0 -0
- game/locale/tl_PH/LC_MESSAGES/django.po +0 -405
- game/locale/tl_PH/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/tl_PH/LC_MESSAGES/djangojs.po +0 -739
- game/locale/tlh_AA/LC_MESSAGES/django.mo +0 -0
- game/locale/tlh_AA/LC_MESSAGES/django.po +0 -405
- game/locale/tlh_AA/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/tlh_AA/LC_MESSAGES/djangojs.po +0 -739
- game/locale/tr_TR/LC_MESSAGES/django.mo +0 -0
- game/locale/tr_TR/LC_MESSAGES/django.po +0 -405
- game/locale/tr_TR/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/tr_TR/LC_MESSAGES/djangojs.po +0 -740
- game/locale/ur_IN/LC_MESSAGES/django.mo +0 -0
- game/locale/ur_IN/LC_MESSAGES/django.po +0 -405
- game/locale/ur_IN/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/ur_IN/LC_MESSAGES/djangojs.po +0 -739
- game/locale/ur_PK/LC_MESSAGES/django.mo +0 -0
- game/locale/ur_PK/LC_MESSAGES/django.po +0 -405
- game/locale/ur_PK/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/ur_PK/LC_MESSAGES/djangojs.po +0 -739
- game/static/game/image/actions/go.svg +0 -18
- game/static/game/image/icons/destination.svg +0 -9
- game/static/game/js/pqselect.min.js +0 -9
- game/static/game/js/widget-scroller.js +0 -906
- rapid_router-5.4.1.dist-info/LICENSE.md +0 -577
- rapid_router-5.4.1.dist-info/METADATA +0 -24
- {rapid_router-5.4.1.dist-info → rapid_router-7.6.8.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
$(document).ready(function () {
|
|
2
|
+
let shadowRoot = $("editor-wc")[0].shadowRoot;
|
|
3
|
+
|
|
4
|
+
// Set editor height and margin
|
|
5
|
+
$(shadowRoot).find("#root").css("height", "100%");
|
|
6
|
+
$(shadowRoot).find(".proj-container").css("margin", "0 10px 0 0");
|
|
7
|
+
|
|
8
|
+
// Fix project bar height
|
|
9
|
+
$(shadowRoot).find(".project-bar").css("block-size", "auto");
|
|
10
|
+
|
|
11
|
+
// Focus on text output tab
|
|
12
|
+
$(shadowRoot).find(".react-tabs__tab-text").click();
|
|
13
|
+
|
|
14
|
+
// Remove visual output and split view tabs
|
|
15
|
+
$(shadowRoot).find("#react-tabs-4").hide();
|
|
16
|
+
$(shadowRoot).find(".output-view-toggle").hide();
|
|
17
|
+
|
|
18
|
+
// Make editor font size not small
|
|
19
|
+
$(shadowRoot).find(".editor").removeClass("editor--small");
|
|
20
|
+
|
|
21
|
+
// Ensure window doesn't scroll to bottom of page
|
|
22
|
+
window.scrollTo(0, 0);
|
|
23
|
+
});
|
game/static/game/js/game.js
CHANGED
|
@@ -6,10 +6,23 @@ ocargo.Game = function () {
|
|
|
6
6
|
this.tabs = null
|
|
7
7
|
this.failures = 0
|
|
8
8
|
this.currentlySelectedTab = null
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
if (!hasFunctionalCookiesConsent()) {
|
|
11
|
+
deleteCookie('muted')
|
|
12
|
+
deleteCookie('preferredLanguage')
|
|
13
|
+
}
|
|
14
|
+
this.preferredLanguage = Cookies.get('preferredLanguage')
|
|
10
15
|
}
|
|
11
16
|
|
|
12
17
|
ocargo.Game.prototype.setup = function () {
|
|
18
|
+
document.getElementById("language_dropdown").value = this.preferredLanguage ?? navigator.language.toLowerCase()
|
|
19
|
+
gameUpdateBlockLanguage(this.preferredLanguage ?? navigator.language.toLowerCase())
|
|
20
|
+
this.isMuted = Cookies.get('muted') ?? false
|
|
21
|
+
|
|
22
|
+
if(new Date().getMonth() === 11) {
|
|
23
|
+
$("#paper").css('background-color', '#eef7ff')
|
|
24
|
+
}
|
|
25
|
+
|
|
13
26
|
if (NIGHT_MODE_FEATURE_ENABLED) {
|
|
14
27
|
if (NIGHT_MODE) {
|
|
15
28
|
$('#paper').css('background-color', 'black')
|
|
@@ -20,6 +33,13 @@ ocargo.Game.prototype.setup = function () {
|
|
|
20
33
|
}
|
|
21
34
|
}
|
|
22
35
|
|
|
36
|
+
|
|
37
|
+
// Function being called when there is a change in game level.
|
|
38
|
+
ocargo.Game.prototype.onLevelChange = function() {
|
|
39
|
+
const currentLevelId = LEVEL_ID;
|
|
40
|
+
localStorage.setItem('currentEpisode', EPISODE);
|
|
41
|
+
}
|
|
42
|
+
|
|
23
43
|
restoreCmsLogin()
|
|
24
44
|
initCustomBlocks()
|
|
25
45
|
ocargo.solutionLoaded = false
|
|
@@ -27,20 +47,21 @@ ocargo.Game.prototype.setup = function () {
|
|
|
27
47
|
ocargo.pythonControl = new ocargo.PythonControl()
|
|
28
48
|
ocargo.blocklyCompiler = new ocargo.BlocklyCompiler()
|
|
29
49
|
ocargo.model = new ocargo.Model(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
50
|
+
PATH,
|
|
51
|
+
ORIGIN,
|
|
52
|
+
DESTINATIONS,
|
|
53
|
+
TRAFFIC_LIGHTS,
|
|
54
|
+
COWS,
|
|
55
|
+
MAX_FUEL
|
|
36
56
|
)
|
|
57
|
+
|
|
37
58
|
this.drawing = new ocargo.Drawing(ocargo.model.startingPosition())
|
|
38
59
|
this.drawing.preloadRoadTiles()
|
|
39
60
|
ocargo.animation = new ocargo.Animation(ocargo.model, DECOR, this.drawing)
|
|
40
61
|
this.saving = new ocargo.Saving()
|
|
41
62
|
this.sharing = new ocargo.Sharing(
|
|
42
|
-
|
|
43
|
-
|
|
63
|
+
() => parseInt(LEVEL_ID),
|
|
64
|
+
() => true
|
|
44
65
|
)
|
|
45
66
|
|
|
46
67
|
// Setup the blockly workspace
|
|
@@ -52,7 +73,6 @@ ocargo.Game.prototype.setup = function () {
|
|
|
52
73
|
this._setupConsoleSliderListeners()
|
|
53
74
|
this._setupPythonViewSliderListeners()
|
|
54
75
|
this._setupConsoleLogViewSliderListeners()
|
|
55
|
-
this._setupDirectDriveListeners()
|
|
56
76
|
this._setupFuelGauge(ocargo.model.map.nodes, BLOCKS)
|
|
57
77
|
this._setupTabs()
|
|
58
78
|
|
|
@@ -68,20 +88,20 @@ ocargo.Game.prototype.setup = function () {
|
|
|
68
88
|
// Setup blockly to python
|
|
69
89
|
Blockly.Python.init(Blockly.getMainWorkspace())
|
|
70
90
|
window.addEventListener(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
91
|
+
'unload',
|
|
92
|
+
function (event) {
|
|
93
|
+
ocargo.pythonControl.teardown()
|
|
94
|
+
ocargo.blocklyControl.teardown()
|
|
95
|
+
}.bind(this)
|
|
76
96
|
)
|
|
77
97
|
|
|
78
98
|
var loggedOutWarning = ''
|
|
79
99
|
// Check if logged on
|
|
80
100
|
if (USER_STATUS == 'UNTRACKED') {
|
|
81
101
|
loggedOutWarning =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
102
|
+
'<br><span class="popup__text--warning">' +
|
|
103
|
+
gettext("You are not logged in. Your progress won't be saved.") +
|
|
104
|
+
'</span>'
|
|
85
105
|
}
|
|
86
106
|
// Start the popup
|
|
87
107
|
var title = gettext('Try solving this one...')
|
|
@@ -92,8 +112,16 @@ ocargo.Game.prototype.setup = function () {
|
|
|
92
112
|
} else if (DEFAULT_LEVEL) {
|
|
93
113
|
titlePrefix = gettext('Level %(level_name)s')
|
|
94
114
|
}
|
|
115
|
+
|
|
116
|
+
let adjusted_level_name = ''
|
|
117
|
+
if (LEVEL_NAME > 1000) {
|
|
118
|
+
adjusted_level_name = LEVEL_NAME - 1000
|
|
119
|
+
} else {
|
|
120
|
+
adjusted_level_name = LEVEL_NAME;
|
|
121
|
+
}
|
|
122
|
+
|
|
95
123
|
if (titlePrefix) {
|
|
96
|
-
title = interpolate(titlePrefix, { level_name:
|
|
124
|
+
title = interpolate(titlePrefix, { level_name: adjusted_level_name }, true)
|
|
97
125
|
} else {
|
|
98
126
|
title = LEVEL_NAME
|
|
99
127
|
}
|
|
@@ -102,26 +130,45 @@ ocargo.Game.prototype.setup = function () {
|
|
|
102
130
|
var message
|
|
103
131
|
if (NIGHT_MODE) {
|
|
104
132
|
message =
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
133
|
+
'<br>' +
|
|
134
|
+
gettext(
|
|
135
|
+
'In Night Mode you can only see a very short distance. ' +
|
|
136
|
+
"We've given you more blocks to help you find your way!"
|
|
137
|
+
)
|
|
110
138
|
} else {
|
|
111
139
|
message = loggedOutWarning
|
|
112
140
|
}
|
|
113
141
|
|
|
114
142
|
this.drawing.enablePanning()
|
|
115
143
|
|
|
144
|
+
const showMascot = BLOCKLY_ENABLED && !PYTHON_VIEW_ENABLED && LEVEL_NAME <= 80; // show mascot on Blockly-only levels that are not above 80
|
|
145
|
+
|
|
146
|
+
const subtitle = SUBTITLE == "None" ? "" : "<b>" + SUBTITLE + "</b> <br> <br> ";
|
|
147
|
+
const next_button_html = NEXT_LEVEL_URL == "/pythonden/"
|
|
148
|
+
? ocargo.button.episodeRedirectButtonHtml("next_button", NEXT_LEVEL_URL, gettext('Next episode'), NEXT_EPISODE)
|
|
149
|
+
: ocargo.button.dismissButtonHtml("next_button", gettext('Next level'))
|
|
116
150
|
ocargo.Drawing.startPopup(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
151
|
+
title,
|
|
152
|
+
subtitle + LESSON,
|
|
153
|
+
message,
|
|
154
|
+
showMascot,
|
|
155
|
+
[
|
|
156
|
+
ocargo.button.dismissButtonHtml("prev_button", gettext("Previous level")),
|
|
157
|
+
ocargo.button.dismissButtonHtml('play_button', gettext('Play')),
|
|
158
|
+
next_button_html
|
|
159
|
+
]
|
|
122
160
|
)
|
|
123
161
|
}
|
|
124
162
|
|
|
163
|
+
// Script used to save and check for episode upon loading of the webpage
|
|
164
|
+
document.addEventListener("DOMContentLoaded", function() {
|
|
165
|
+
const dataElement = document.getElementById('data');
|
|
166
|
+
const currentEpisode = dataElement ? dataElement.getAttribute('data-episode') : null;
|
|
167
|
+
if (currentEpisode) {
|
|
168
|
+
localStorage.setItem('currentEpisode', currentEpisode);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
125
172
|
ocargo.Game.prototype.clearWorkspaceNameInputInSaveTab = function () {
|
|
126
173
|
$('#workspaceNameInput').val('')
|
|
127
174
|
}
|
|
@@ -141,6 +188,18 @@ ocargo.Game.prototype.reset = function () {
|
|
|
141
188
|
}
|
|
142
189
|
|
|
143
190
|
ocargo.Game.prototype.runProgramAndPrepareAnimation = function (blocks) {
|
|
191
|
+
if (window.location.href.startsWith("https://www.codeforlife.education")) {
|
|
192
|
+
if (window.location.href.includes("/pythonden/")) {
|
|
193
|
+
gtag("event", "python-den:level:play", {
|
|
194
|
+
levelId: LEVEL_NAME - 1000,
|
|
195
|
+
});
|
|
196
|
+
} else if (window.location.href.includes("/rapidrouter/")) {
|
|
197
|
+
gtag("event", "rapid-router:level:play", {
|
|
198
|
+
levelId: LEVEL_NAME,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
144
203
|
this.reset()
|
|
145
204
|
let code = ocargo.pythonControl.getCode()
|
|
146
205
|
ocargo.event.sendEvent('PlayButtonPressed', {
|
|
@@ -212,10 +271,12 @@ ocargo.Game.prototype.sendAttempt = function (score) {
|
|
|
212
271
|
return /^(GET|HEAD|OPTIONS|TRACE)$/.test(method)
|
|
213
272
|
}
|
|
214
273
|
|
|
215
|
-
//
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
274
|
+
// TODO: Remove below - keeping it for now as a reminder that we need to
|
|
275
|
+
// implement some kind of algorithm score for Python levels.
|
|
276
|
+
// // hack scores so that it works for demo and python TODO implement max scores and remove this!!
|
|
277
|
+
// if (PYTHON_ENABLED) {
|
|
278
|
+
// score *= 2
|
|
279
|
+
// }
|
|
219
280
|
|
|
220
281
|
// Check that we should actually be sending an attempt - either if only blockly is enabled
|
|
221
282
|
// or if python is enabled and we're on the python tab (assumes they don't change tab quickly...)
|
|
@@ -254,13 +315,18 @@ ocargo.Game.prototype.sendAttempt = function (score) {
|
|
|
254
315
|
|
|
255
316
|
ocargo.Game.prototype.registerFailure = function () {
|
|
256
317
|
this.failures += 1
|
|
257
|
-
return this.failures >=
|
|
318
|
+
return this.failures >= 1
|
|
258
319
|
}
|
|
259
320
|
|
|
260
321
|
ocargo.Game.prototype._setupFuelGauge = function (nodes, blocks) {
|
|
261
322
|
if (FUEL_GAUGE) {
|
|
262
|
-
|
|
323
|
+
if (CHARACTER_NAME == "Electric van") {
|
|
324
|
+
document.getElementById("electricFuelGauge").style.visibility = "visible"
|
|
325
|
+
} else {
|
|
326
|
+
document.getElementById("fuelGauge").style.visibility = "visible"
|
|
327
|
+
}
|
|
263
328
|
|
|
329
|
+
// TODO: Investigate these for loops - are they necessary?
|
|
264
330
|
for (var i = 0; i < blocks.length; i++) {
|
|
265
331
|
if (blocks[i].type === 'turn_around' || blocks[i].type === 'wait') {
|
|
266
332
|
return
|
|
@@ -275,44 +341,6 @@ ocargo.Game.prototype._setupFuelGauge = function (nodes, blocks) {
|
|
|
275
341
|
}
|
|
276
342
|
}
|
|
277
343
|
|
|
278
|
-
ocargo.Game.prototype._setupDirectDriveListeners = function () {
|
|
279
|
-
var manoeuvreCallback = function () {
|
|
280
|
-
this.drawing.scrollToShowCharacter()
|
|
281
|
-
this.onStopControls()
|
|
282
|
-
}.bind(this)
|
|
283
|
-
|
|
284
|
-
$('#moveForward').click(
|
|
285
|
-
function () {
|
|
286
|
-
if (ocargo.model.reasonForTermination != 'CRASH') {
|
|
287
|
-
this.onPlayControls()
|
|
288
|
-
ocargo.blocklyControl.addBlockToEndOfProgram('move_forwards')
|
|
289
|
-
this.drawing.moveForward(manoeuvreCallback)
|
|
290
|
-
}
|
|
291
|
-
}.bind(this)
|
|
292
|
-
)
|
|
293
|
-
$('#turnLeft').click(
|
|
294
|
-
function () {
|
|
295
|
-
if (ocargo.model.reasonForTermination != 'CRASH') {
|
|
296
|
-
this.onPlayControls()
|
|
297
|
-
ocargo.blocklyControl.addBlockToEndOfProgram('turn_left')
|
|
298
|
-
this.drawing.turnLeft(manoeuvreCallback)
|
|
299
|
-
}
|
|
300
|
-
}.bind(this)
|
|
301
|
-
)
|
|
302
|
-
$('#turnRight').click(
|
|
303
|
-
function () {
|
|
304
|
-
if (ocargo.model.reasonForTermination != 'CRASH') {
|
|
305
|
-
this.onPlayControls()
|
|
306
|
-
ocargo.blocklyControl.addBlockToEndOfProgram('turn_right')
|
|
307
|
-
this.drawing.turnRight(manoeuvreCallback)
|
|
308
|
-
}
|
|
309
|
-
}.bind(this)
|
|
310
|
-
)
|
|
311
|
-
$('#go').click(function () {
|
|
312
|
-
$('#play_radio').trigger('click')
|
|
313
|
-
})
|
|
314
|
-
}
|
|
315
|
-
|
|
316
344
|
ocargo.Game.prototype._setupConsoleSliderListeners = function () {
|
|
317
345
|
let tabsWidth = $('#tabs').width()
|
|
318
346
|
|
|
@@ -359,7 +387,6 @@ ocargo.Game.prototype._setupConsoleSliderListeners = function () {
|
|
|
359
387
|
$('#consoleSlider').css('left', consoleSliderPosition + '%')
|
|
360
388
|
$('#paper').css('width', 100 - consoleSliderPosition + '%')
|
|
361
389
|
$('#tab_panes').css('width', consoleSliderPosition + '%')
|
|
362
|
-
$('#direct_drive').css('left', consoleSliderPosition + '%')
|
|
363
390
|
|
|
364
391
|
ocargo.blocklyControl.redrawBlockly()
|
|
365
392
|
}
|
|
@@ -392,6 +419,7 @@ ocargo.Game.prototype._setupConsoleLogViewSliderListeners = function () {
|
|
|
392
419
|
let moveEvents = ['mousemove', 'touchmove']
|
|
393
420
|
let endEvents = ['mouseup', 'touchend', 'touchcancel']
|
|
394
421
|
|
|
422
|
+
let codeWindow = $("#code").next()
|
|
395
423
|
let slider = $('#consoleLogSlider')
|
|
396
424
|
let wrapper = $('#wrapper')
|
|
397
425
|
let halfSliderHeight = slider.height()
|
|
@@ -412,15 +440,19 @@ ocargo.Game.prototype._setupConsoleLogViewSliderListeners = function () {
|
|
|
412
440
|
let containerHeight = slider.parent().height()
|
|
413
441
|
|
|
414
442
|
pythonSliderPosition *= 100.0 / containerHeight
|
|
443
|
+
let codeWindowHeight = pythonSliderPosition
|
|
415
444
|
|
|
416
445
|
if (pythonSliderPosition > 75) {
|
|
417
446
|
pythonSliderPosition = 75
|
|
447
|
+
codeWindowHeight = 75
|
|
418
448
|
}
|
|
419
|
-
if (pythonSliderPosition <
|
|
420
|
-
pythonSliderPosition =
|
|
449
|
+
if (pythonSliderPosition < 30) {
|
|
450
|
+
pythonSliderPosition = 30
|
|
451
|
+
codeWindowHeight = 30
|
|
421
452
|
}
|
|
422
453
|
|
|
423
454
|
slider.css('top', pythonSliderPosition + '%')
|
|
455
|
+
codeWindow.css("height", `100%`)
|
|
424
456
|
$('#editor').css('height', pythonSliderPosition + '%')
|
|
425
457
|
|
|
426
458
|
ocargo.blocklyControl.redrawBlockly()
|
|
@@ -509,8 +541,6 @@ const buttonTransit = (buttonElementId, state) => {
|
|
|
509
541
|
ocargo.Game.prototype.onPlayControls = function () {
|
|
510
542
|
this.disallowCodeChanges()
|
|
511
543
|
|
|
512
|
-
document.getElementById('direct_drive').style.visibility = 'hidden'
|
|
513
|
-
|
|
514
544
|
this.tabs.play.transitTo('running')
|
|
515
545
|
buttonTransit("run-code-button", "running")
|
|
516
546
|
this.tabs.step.disable()
|
|
@@ -525,8 +555,6 @@ ocargo.Game.prototype.onPlayControls = function () {
|
|
|
525
555
|
ocargo.Game.prototype.onStepControls = function () {
|
|
526
556
|
this.disallowCodeChanges()
|
|
527
557
|
|
|
528
|
-
document.getElementById('direct_drive').style.visibility = 'hidden'
|
|
529
|
-
|
|
530
558
|
this.tabs.play.transitTo('paused')
|
|
531
559
|
buttonTransit("run-code-button", "paused")
|
|
532
560
|
this.tabs.step.disable()
|
|
@@ -540,9 +568,8 @@ ocargo.Game.prototype.onStepControls = function () {
|
|
|
540
568
|
ocargo.Game.prototype.onFastControls = function () {
|
|
541
569
|
this.disallowCodeChanges()
|
|
542
570
|
|
|
543
|
-
document.getElementById('direct_drive').style.visibility = 'hidden'
|
|
544
|
-
|
|
545
571
|
this.tabs.play.transitTo('running')
|
|
572
|
+
buttonTransit("run-code-button", "running")
|
|
546
573
|
this.tabs.fast.transitTo('fast')
|
|
547
574
|
this.tabs.step.disable()
|
|
548
575
|
|
|
@@ -555,8 +582,6 @@ ocargo.Game.prototype.onFastControls = function () {
|
|
|
555
582
|
ocargo.Game.prototype.onSlowControls = function () {
|
|
556
583
|
this.disallowCodeChanges()
|
|
557
584
|
|
|
558
|
-
document.getElementById('direct_drive').style.visibility = 'hidden'
|
|
559
|
-
|
|
560
585
|
this.tabs.play.transitTo('running')
|
|
561
586
|
buttonTransit("run-code-button", "running")
|
|
562
587
|
this.tabs.fast.transitTo('slow')
|
|
@@ -590,6 +615,7 @@ ocargo.Game.prototype.isInPythonWorkspace = function () {
|
|
|
590
615
|
|
|
591
616
|
ocargo.Game.prototype._setupTabs = function () {
|
|
592
617
|
this.tabs = []
|
|
618
|
+
|
|
593
619
|
this.tabs.blockly = new ocargo.Tab(
|
|
594
620
|
$('#blockly_radio'),
|
|
595
621
|
$('#blockly_radio + label'),
|
|
@@ -742,9 +768,6 @@ ocargo.Game.prototype.onPauseControls = function () {
|
|
|
742
768
|
ocargo.Game.prototype.onStopControls = function () {
|
|
743
769
|
this.allowCodeChanges()
|
|
744
770
|
|
|
745
|
-
// TODO make this hidden unless blocks are clear or something...
|
|
746
|
-
document.getElementById('direct_drive').style.visibility = 'visible'
|
|
747
|
-
|
|
748
771
|
this.tabs.play.transitTo('readyToPlay')
|
|
749
772
|
buttonTransit("run-code-button", "readyToPlay")
|
|
750
773
|
this.tabs.fast.transitTo('slow')
|
|
@@ -799,9 +822,9 @@ ocargo.Game.prototype._setupPythonTab = function () {
|
|
|
799
822
|
$('#consoleOutput').text('')
|
|
800
823
|
}.bind(this)
|
|
801
824
|
)
|
|
802
|
-
|
|
825
|
+
// --------- Commands for popup ---------------------------------------------------
|
|
803
826
|
var leadMsg =
|
|
804
|
-
'<p>' +
|
|
827
|
+
'<p style="font-size: 20px;">' +
|
|
805
828
|
interpolate(
|
|
806
829
|
gettext(
|
|
807
830
|
'Run the following commands on the van object %(var_name)s, e.g. %(example)s'
|
|
@@ -810,52 +833,8 @@ ocargo.Game.prototype._setupPythonTab = function () {
|
|
|
810
833
|
true
|
|
811
834
|
) +
|
|
812
835
|
'</p>' +
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
'<p><b>' +
|
|
816
|
-
gettext('Movement') +
|
|
817
|
-
'</b>' +
|
|
818
|
-
'<br>my_van.move_forwards()' +
|
|
819
|
-
'<br>my_van.turn_left()' +
|
|
820
|
-
'<br>my_van.turn_right()' +
|
|
821
|
-
'<br>my_van.turn_around()' +
|
|
822
|
-
'<br>my_van.wait()</p>' +
|
|
823
|
-
'</div>' +
|
|
824
|
-
'<div class="large-4 columns">' +
|
|
825
|
-
'<p><b>' +
|
|
826
|
-
gettext('Position') +
|
|
827
|
-
'</b>' +
|
|
828
|
-
'<br>my_van.at_dead_end()' +
|
|
829
|
-
'<br>my_van.at_destination()' +
|
|
830
|
-
'<br>my_van.at_red_traffic_light()' +
|
|
831
|
-
'<br>my_van.at_green_traffic_light()' +
|
|
832
|
-
'<br>my_van.at_traffic_light(c)' +
|
|
833
|
-
'<br><i>' +
|
|
834
|
-
interpolate(
|
|
835
|
-
gettext("where %(arg_name)s is '%(red_color)s' or '%(green_color)s'"),
|
|
836
|
-
{ arg_name: 'c', red_color: 'RED', green_color: 'GREEN' },
|
|
837
|
-
true
|
|
838
|
-
) +
|
|
839
|
-
'</i></p>' +
|
|
840
|
-
'</div>' +
|
|
841
|
-
'<div class="large-4 columns">' +
|
|
842
|
-
'<p>' +
|
|
843
|
-
'<br>my_van.is_road_forward()' +
|
|
844
|
-
'<br>my_van.is_road_left()' +
|
|
845
|
-
'<br>my_van.is_road_right()' +
|
|
846
|
-
'<br>my_van.is_road(d)' +
|
|
847
|
-
'<br><i>' +
|
|
848
|
-
interpolate(
|
|
849
|
-
gettext(
|
|
850
|
-
"where %(arg_name)s is '%(forward)s', '%(left)s', or '%(right)s'"
|
|
851
|
-
),
|
|
852
|
-
{ arg_name: 'd', forward: 'FORWARD', left: 'LEFT', right: 'RIGHT' },
|
|
853
|
-
true
|
|
854
|
-
) +
|
|
855
|
-
'</i></p>' +
|
|
856
|
-
'</div>' +
|
|
857
|
-
'</div>'
|
|
858
|
-
|
|
836
|
+
COMMANDS
|
|
837
|
+
// -----------------------------------------------------------------------------
|
|
859
838
|
$('#van_commands_help').click(
|
|
860
839
|
function (e) {
|
|
861
840
|
ocargo.Drawing.startPopup(gettext('Python Commands'), leadMsg, '')
|
|
@@ -1179,13 +1158,13 @@ ocargo.Game.prototype._setupSaveTab = function () {
|
|
|
1179
1158
|
break
|
|
1180
1159
|
}
|
|
1181
1160
|
}
|
|
1182
|
-
|
|
1183
1161
|
var workspace = {
|
|
1184
1162
|
name: newName,
|
|
1185
1163
|
contents: ocargo.blocklyControl.serialize(),
|
|
1186
1164
|
python_contents: ocargo.pythonControl.getCode(),
|
|
1187
1165
|
blockly_enabled: BLOCKLY_ENABLED,
|
|
1188
|
-
python_enabled: PYTHON_ENABLED
|
|
1166
|
+
python_enabled: PYTHON_ENABLED,
|
|
1167
|
+
python_view_enabled: PYTHON_VIEW_ENABLED
|
|
1189
1168
|
}
|
|
1190
1169
|
|
|
1191
1170
|
this.saving.saveWorkspace(
|
|
@@ -1317,6 +1296,7 @@ ocargo.Game.prototype._populateTable = function (tableName, workspaces) {
|
|
|
1317
1296
|
.attr({ value: workspace.id })
|
|
1318
1297
|
.appendTo(table)
|
|
1319
1298
|
$('<td></td>')
|
|
1299
|
+
.attr({ id: workspace.name })
|
|
1320
1300
|
.text(workspace.name)
|
|
1321
1301
|
.appendTo(row)
|
|
1322
1302
|
}
|
|
@@ -1343,13 +1323,42 @@ function restoreCmsLogin () {
|
|
|
1343
1323
|
}
|
|
1344
1324
|
|
|
1345
1325
|
function hasFunctionalCookiesConsent() {
|
|
1346
|
-
|
|
1326
|
+
try {
|
|
1327
|
+
return OnetrustActiveGroups.split(',').includes('C0003')
|
|
1328
|
+
} catch (e) {
|
|
1329
|
+
console.error(e)
|
|
1330
|
+
}
|
|
1331
|
+
return false
|
|
1347
1332
|
}
|
|
1348
1333
|
|
|
1349
1334
|
function setMutedCookie(mute) {
|
|
1350
1335
|
if (hasFunctionalCookiesConsent()) {
|
|
1351
|
-
|
|
1336
|
+
if (mute) {
|
|
1337
|
+
Cookies.set('muted', true)
|
|
1338
|
+
}
|
|
1339
|
+
else {
|
|
1340
|
+
deleteCookie('muted')
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
function deleteCookie(name) {
|
|
1346
|
+
// Set cookie expiry to yesterday, browser will remove the cookie.
|
|
1347
|
+
// https://www.quirksmode.org/js/cookies.html
|
|
1348
|
+
Cookies.set(name, "", { expires: -1 })
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
function gameUpdateBlockLanguage (language_code) {
|
|
1352
|
+
loadLanguage("/static/game/js/blockly/msg/js/", language_code, function() {
|
|
1353
|
+
reloadWorkspace(Blockly.mainWorkspace);
|
|
1354
|
+
});
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
function gameUpdateBlockLanguageAndCookie (language_code) {
|
|
1358
|
+
if (hasFunctionalCookiesConsent()) {
|
|
1359
|
+
Cookies.set("preferredLanguage", language_code)
|
|
1352
1360
|
}
|
|
1361
|
+
gameUpdateBlockLanguage(language_code)
|
|
1353
1362
|
}
|
|
1354
1363
|
|
|
1355
1364
|
$(document).ready(function () {
|