Proyectos de Subversion Moodle

Rev

Rev 317 | Rev 321 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 317 Rev 320
Línea 206... Línea 206...
206
 
206
 
207
</body>
207
</body>
208
</html>
208
</html>
209
{{#js}}
209
{{#js}}
210
M.util.js_pending('theme_universe/loader');
210
M.util.js_pending('theme_universe/loader');
211
require(['theme_universe/loader', 'theme_universe/drawer'], function(Loader, Drawer) {
211
require(['theme_universe/loader', 'theme_universe/drawer', 'jquery'], function(Loader, Drawer, $) {
212
    Drawer.init();
212
    Drawer.init();
-
 
213
    M.util.js_complete('theme_universe/loader');
-
 
214
 
-
 
215
    function resizeVideoIframe(){
-
 
216
         // Seleccionamos el iframe
-
 
217
        const $iframe = $('iframe');
-
 
218
 
-
 
219
        // Verificamos si el iframe existe
-
 
220
        if ($iframe.length) {
-
 
221
            // Obtenemos el contenido del iframe
-
 
222
            const $iframeContents = $iframe.contents();
-
 
223
 
-
 
224
            // Seleccionamos el primer contenedor de vídeo H5P dentro del contenido del iframe
-
 
225
            const $h5pVideoWrapper = $iframeContents.find('.h5p-video').first();
-
 
226
 
-
 
227
            // Verificamos si el contenedor del vídeo H5P existe
-
 
228
            if ($h5pVideoWrapper.length) {
-
 
229
                // Seleccionamos el primer vídeo con la clase 'h5p-video' dentro del contenedor
-
 
230
                const $h5Video = $h5pVideoWrapper.find('video.h5p-video').first();
-
 
231
 
-
 
232
                // Verificamos si el vídeo existe
-
 
233
                if ($h5Video.length) {
-
 
234
                    // Aplicamos el estilo CSS al vídeo
-
 
235
                    $h5Video.css("height", "93vh");
-
 
236
                }
-
 
237
            }
-
 
238
        }
-
 
239
    }
-
 
240
 
-
 
241
    function renderBlockButtons(){
-
 
242
        const buttonsContainer = $("#blocks_buttons");
-
 
243
        const blocksContainer = $(".block-region");
-
 
244
        const blocks = blocksContainer.find("section.block").toArray();
-
 
245
 
-
 
246
        $(blocksContainer).addClass("tab-content")
-
 
247
 
-
 
248
        const blocksObjs = []
-
 
249
 
-
 
250
        $(blocks).each((index, block) => {
-
 
251
            const blckId = $(block).attr("id").trim()
-
 
252
            const blckTitle = $(block).find(".card-title").text()
-
 
253
 
-
 
254
            $(block).addClass("tab-pane fade")
-
 
255
            if(index === 0) $(block).addClass("active show")
-
 
256
 
-
 
257
            const blckObj = { id: blckId, title: blckTitle }
-
 
258
 
-
 
259
            blocksObjs.push(blckObj)
-
 
260
        })
-
 
261
 
-
 
262
        blocksObjs.forEach(({ id, title }, index)=> {
-
 
263
            const blockBtn = `
-
 
264
                <button class="btn nav-link ${index === 0 ? 'active' : ''}" data-toggle="tab" data-target="#${id}" type="button" role="tab" aria-controls="nav-home" aria-selected="true">${title}</button>
-
 
265
            ` 
-
 
266
 
-
 
267
            buttonsContainer.append(blockBtn)
-
 
268
        })
-
 
269
    }
-
 
270
 
-
 
271
    resizeVideoIframe()
213
    M.util.js_complete('theme_universe/loader');
272
    renderBlockButtons()
214
});
273
});