@iframe-resizer/jquery 5.0.1 → 5.0.2
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.
- package/README.md +1 -1
- package/index.cjs.js +55 -3
- package/index.esm.js +53 -3
- package/index.umd.js +1230 -3
- package/package.json +10 -12
package/README.md
CHANGED
package/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/jquery 5.0.
|
|
4
|
+
* @module iframe-resizer/jquery 5.0.2 (cjs) - 2024-05-30
|
|
5
5
|
*
|
|
6
6
|
* @license GPL-3.0 for non-commercial use only.
|
|
7
7
|
* For commercial use, you must purchase a license from
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @desciption Keep same and cross domain iFrames sized to their content
|
|
11
11
|
*
|
|
12
|
-
* @author David J. Bradshaw <
|
|
12
|
+
* @author David J. Bradshaw <info@iframe-resizer.com>
|
|
13
13
|
*
|
|
14
14
|
* @see {@link https://iframe-resizer.com}
|
|
15
15
|
*
|
|
@@ -17,4 +17,56 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
'use strict';
|
|
21
|
+
|
|
22
|
+
const connectResizer = require('@iframe-resizer/core');
|
|
23
|
+
|
|
24
|
+
const msgId = '[iframe-resizer]';
|
|
25
|
+
|
|
26
|
+
function getMyID(iframeId) {
|
|
27
|
+
if (window.top === window.self) {
|
|
28
|
+
return `Parent page: ${iframeId}`
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return window?.parentIFrame?.getId
|
|
32
|
+
? `${window.parentIFrame.getId()}: ${iframeId}`
|
|
33
|
+
: `Nested parent page: ${iframeId}`
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const formatLogHeader = (iframeId) => `${msgId}[${getMyID(iframeId)}]`;
|
|
37
|
+
|
|
38
|
+
const output = (type, iframeId, ...msg) =>
|
|
39
|
+
// eslint-disable-next-line no-console
|
|
40
|
+
window?.console[type](formatLogHeader(iframeId), ...msg);
|
|
41
|
+
|
|
42
|
+
const warn = (iframeId, ...msg) => output('warn', iframeId, ...msg);
|
|
43
|
+
|
|
44
|
+
switch (true) {
|
|
45
|
+
case window.jQuery === undefined:
|
|
46
|
+
warn('', 'Unable to bind to jQuery, it is not available.');
|
|
47
|
+
break
|
|
48
|
+
|
|
49
|
+
case !window.jQuery.fn:
|
|
50
|
+
warn('', 'Unable to bind to jQuery, it is not fully loaded.');
|
|
51
|
+
break
|
|
52
|
+
|
|
53
|
+
case window.jQuery.fn.iframeResize:
|
|
54
|
+
warn('', 'iframeResize is already assigned to jQuery.fn.');
|
|
55
|
+
break
|
|
56
|
+
|
|
57
|
+
default:
|
|
58
|
+
window.jQuery.fn.iframeResize = function (options) {
|
|
59
|
+
const connectWithOptions = connectResizer(options);
|
|
60
|
+
|
|
61
|
+
return this.filter('iframe').each(connectWithOptions).end()
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
window.jQuery.fn.iFrameResize = function (options) {
|
|
65
|
+
warn(
|
|
66
|
+
'',
|
|
67
|
+
'Deprecated: Use the iframeResize method instead of iFrameResize',
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
return this.iframeResize(options)
|
|
71
|
+
};
|
|
72
|
+
}
|
package/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/jquery 5.0.
|
|
4
|
+
* @module iframe-resizer/jquery 5.0.2 (esm) - 2024-05-30
|
|
5
5
|
*
|
|
6
6
|
* @license GPL-3.0 for non-commercial use only.
|
|
7
7
|
* For commercial use, you must purchase a license from
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @desciption Keep same and cross domain iFrames sized to their content
|
|
11
11
|
*
|
|
12
|
-
* @author David J. Bradshaw <
|
|
12
|
+
* @author David J. Bradshaw <info@iframe-resizer.com>
|
|
13
13
|
*
|
|
14
14
|
* @see {@link https://iframe-resizer.com}
|
|
15
15
|
*
|
|
@@ -17,4 +17,54 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
import
|
|
20
|
+
import connectResizer from '@iframe-resizer/core';
|
|
21
|
+
|
|
22
|
+
const msgId = '[iframe-resizer]';
|
|
23
|
+
|
|
24
|
+
function getMyID(iframeId) {
|
|
25
|
+
if (window.top === window.self) {
|
|
26
|
+
return `Parent page: ${iframeId}`
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return window?.parentIFrame?.getId
|
|
30
|
+
? `${window.parentIFrame.getId()}: ${iframeId}`
|
|
31
|
+
: `Nested parent page: ${iframeId}`
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const formatLogHeader = (iframeId) => `${msgId}[${getMyID(iframeId)}]`;
|
|
35
|
+
|
|
36
|
+
const output = (type, iframeId, ...msg) =>
|
|
37
|
+
// eslint-disable-next-line no-console
|
|
38
|
+
window?.console[type](formatLogHeader(iframeId), ...msg);
|
|
39
|
+
|
|
40
|
+
const warn = (iframeId, ...msg) => output('warn', iframeId, ...msg);
|
|
41
|
+
|
|
42
|
+
switch (true) {
|
|
43
|
+
case window.jQuery === undefined:
|
|
44
|
+
warn('', 'Unable to bind to jQuery, it is not available.');
|
|
45
|
+
break
|
|
46
|
+
|
|
47
|
+
case !window.jQuery.fn:
|
|
48
|
+
warn('', 'Unable to bind to jQuery, it is not fully loaded.');
|
|
49
|
+
break
|
|
50
|
+
|
|
51
|
+
case window.jQuery.fn.iframeResize:
|
|
52
|
+
warn('', 'iframeResize is already assigned to jQuery.fn.');
|
|
53
|
+
break
|
|
54
|
+
|
|
55
|
+
default:
|
|
56
|
+
window.jQuery.fn.iframeResize = function (options) {
|
|
57
|
+
const connectWithOptions = connectResizer(options);
|
|
58
|
+
|
|
59
|
+
return this.filter('iframe').each(connectWithOptions).end()
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
window.jQuery.fn.iFrameResize = function (options) {
|
|
63
|
+
warn(
|
|
64
|
+
'',
|
|
65
|
+
'Deprecated: Use the iframeResize method instead of iFrameResize',
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
return this.iframeResize(options)
|
|
69
|
+
};
|
|
70
|
+
}
|