/
githubmirror
/
oppia
Обзор
Документация
Войти
/
githubmirror
/
oppia
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
assets/scripts/embedding_tests_dev_0.0.1.min.html
88 строк
3 KB
Mosin Shaikh
Fix the Part of #11371 Remove jquery constructs used in angularJS codeRemove jquery constructs - 2 (#23060)
21 дек 2025, 03:06
Не верифицирован
21 дек 2025, 03:06
34ae126
Код
Авторство
О чём код?
<h2>v0.0.1 (minified)</h2> <p>For instructions: see the README file in /assets/scripts.</p> <p> NB: When you complete an exploration the text "Exploration completed" should appear in the paragraph below it. This checks that events are being sent from the Oppia iframe to the containing page. </p> <style type="text/css"> .e2e-test-results { display: none; } </style> <script src="/assets/scripts/oppia-player-0.0.1.js"></script> <script src="/assets/scripts/embedding_tests.js"></script> <input class="e2e-test-exploration-id-input-field" type="text" placeholder="explorationId"> <input class="e2e-test-exploration-id-submit-button" type="submit" value="Update Exploration ID" onclick="onChangeExpId()"> <div class="e2e-test-results"> <div> <h3>Iframe embedding</h3> <iframe src="/embed/exploration/idToBeReplaced" width="700" height="600"> </iframe> </div> <div class="e2e-test-standard"> <h3>Standard embedding of the latest version</h3> <oppia oppia-id="idToBeReplaced"></oppia> </div> <div class="e2e-test-old-version"> <h3>Standard embedding of version 2 of the exploration with deferred loading</h3> <oppia oppia-id="idToBeReplaced" autoload="false" exploration-version="2"></oppia> </div> <div class="e2e-test-missing-id"> <h3>ERROR: No oppia id specified</h3> <oppia></oppia> </div> <div class="e2e-test-invalid-id"> <h3>ERROR: 404 error</h3> <oppia oppia-id="fake_id"></oppia> </div> <div class="e2e-test-invalid-id-deferred"> <h3>ERROR: 404 error with deferred loading</h3> <oppia oppia-id="fake_id" autoload="false"></oppia> </div> </div> <script type="text/javascript"> var placeholderExplorationId = 'idToBeReplaced'; var onChangeExpId = function() { var inputField = document.querySelector('.e2e-test-exploration-id-input-field'); var newExplorationId = inputField ? inputField.value : ''; if (!/^[a-zA-Z0-9_-]+$/.test(newExplorationId)) { alert( 'Invalid exploration ID. Only letters, numbers, underscores and ' + 'dashes are allowed.'); return; } var iframes = document.querySelectorAll('div > iframe'); iframes.forEach(function(iframe) { var currentSrc = iframe.getAttribute('src'); if (currentSrc && currentSrc.includes(placeholderExplorationId)) { var updatedSrc = currentSrc.replace( placeholderExplorationId, encodeURIComponent(newExplorationId)); iframe.setAttribute('src', updatedSrc); } }); placeholderExplorationId = newExplorationId; var oppiaElements = document.querySelectorAll('oppia[oppia-id="idToBeReplaced"]'); oppiaElements.forEach(function(element) { element.setAttribute('oppia-id', encodeURIComponent(newExplorationId)); }); var results = document.querySelector('.e2e-test-results'); if (results) { results.style.display = 'block'; } }; </script>