MCPcopy Index your code
hub / github.com/MALSync/MALSync / createIframe

Function createIframe

src/floatbutton/userscript.ts:8–54  ·  view source on GitHub ↗
(page)

Source from the content-addressed store, hash-verified

6declare let GM_getResourceURL: any;
7
8function createIframe(page) {
9 const iframe = document.createElement('iframe');
10 iframe.setAttribute('id', 'info-iframe');
11 iframe.setAttribute('style', 'height:100%;width:100%;border:0;display:block;');
12 iframe.onload = function () {
13 const head = j.$('#info-iframe').contents().find('head');
14
15 importAssets(head);
16
17 setTimeout(function () {
18 minimalObj = new Minimal(
19 j.$('#info-iframe').contents().find('html'),
20 () => {
21 document.getElementById('info-popup')!.style.display = 'none';
22 j.$('.floatbutton').fadeIn();
23 },
24 () => {
25 if (j.$('.modal-content-kal.fullscreen').length) {
26 j.$('.modal-content-kal').removeClass('fullscreen');
27 // @ts-ignore
28 j.$(this).find('i').text('fullscreen');
29 } else {
30 j.$('.modal-content-kal').addClass('fullscreen');
31 // @ts-ignore
32 j.$(this).find('i').text('fullscreen_exit');
33 }
34 },
35 );
36 if (typeof page !== 'undefined') {
37 if (typeof page.singleObj !== 'undefined') {
38 minimalObj.fill({ url: page.singleObj.getUrl() }, true);
39 }
40 }
41 }, 200);
42 };
43 document.getElementById('modal-content')!.appendChild(iframe);
44 j.$('#modal-content').append(
45 j.html(
46 '<div class="kal-tempHeader" style="position: absolute; width: 100%; height: 103px; background-color: rgb(63,81,181); "></div>',
47 ),
48 );
49
50 if (!j.$('#info-iframe').length || j.$('#info-iframe').css('display') !== 'block') {
51 j.$('#info-popup').remove();
52 alert('The miniMAL iframe could not be loaded.\nThis could be caused by an AdBlocker.');
53 }
54}
55
56export function floatClick(page) {
57 if (api.settings.get('floatButtonCorrection')) {

Callers 1

floatClickFunction · 0.85

Calls 4

importAssetsFunction · 0.85
fillMethod · 0.80
removeMethod · 0.80
getUrlMethod · 0.45

Tested by

no test coverage detected