From 73a86fcbd0d23f33ab0e0a44ba61fe9ad894e5ed Mon Sep 17 00:00:00 2001
From: Orest Bida
Date: Thu, 8 Dec 2022 13:41:23 +0100
Subject: [PATCH 01/53] Update `.gitignore`: ignore `.vscode`
---
.gitignore | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index e046332..a7e42e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
/dev_tools
-node_modules
\ No newline at end of file
+node_modules
+.vscode
\ No newline at end of file
From 25aa68e37237aadfdf9350dcba75e8c0b434c51b Mon Sep 17 00:00:00 2001
From: Orest Bida
Date: Thu, 8 Dec 2022 13:43:26 +0100
Subject: [PATCH 02/53] Fix terser build fails due to incorrect file path
---
terser.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/terser.js b/terser.js
index 11fe5a8..b8b503f 100644
--- a/terser.js
+++ b/terser.js
@@ -1,9 +1,9 @@
const { minify } = require("terser");
const { writeFileSync, readFileSync } = require('fs');
-const pkg = require('./package.json');
+const pkgName = 'iframemanager';
-const srcFile = `src/${pkg.name}.js`;
-const distFile = `dist/${pkg.name}.js`;
+const srcFile = `src/${pkgName}.js`;
+const distFile = `dist/${pkgName}.js`;
const code = readFileSync(srcFile, {
encoding: 'utf8'
From f0753e476fdf15f0469dff07cd9dfd3501a9527f Mon Sep 17 00:00:00 2001
From: Orest Bida
Date: Thu, 8 Dec 2022 13:43:57 +0100
Subject: [PATCH 03/53] Update all dev. dependencies
---
package.json | 6 +++---
pnpm-lock.yaml | 39 ++++++++++++++++++++++-----------------
2 files changed, 25 insertions(+), 20 deletions(-)
diff --git a/package.json b/package.json
index bd85b8d..dca442a 100644
--- a/package.json
+++ b/package.json
@@ -31,8 +31,8 @@
"devDependencies": {
"cssnano": "^5.1.14",
"postcss": "^8.4.19",
- "postcss-cli": "^10.0.0",
- "postcss-custom-properties": "^12.1.10",
- "terser": "^5.15.1"
+ "postcss-cli": "^10.1.0",
+ "postcss-custom-properties": "^12.1.11",
+ "terser": "^5.16.1"
}
}
\ No newline at end of file
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 7e34b63..93ec9d0 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -3,16 +3,16 @@ lockfileVersion: 5.4
specifiers:
cssnano: ^5.1.14
postcss: ^8.4.19
- postcss-cli: ^10.0.0
- postcss-custom-properties: ^12.1.10
- terser: ^5.15.1
+ postcss-cli: ^10.1.0
+ postcss-custom-properties: ^12.1.11
+ terser: ^5.16.1
devDependencies:
cssnano: 5.1.14_postcss@8.4.19
postcss: 8.4.19
- postcss-cli: 10.0.0_postcss@8.4.19
- postcss-custom-properties: 12.1.10_postcss@8.4.19
- terser: 5.15.1
+ postcss-cli: 10.1.0_postcss@8.4.19
+ postcss-custom-properties: 12.1.11_postcss@8.4.19
+ terser: 5.16.1
packages:
@@ -381,9 +381,9 @@ packages:
to-regex-range: 5.0.1
dev: true
- /fs-extra/10.1.0:
- resolution: {integrity: sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==}
- engines: {node: '>=12'}
+ /fs-extra/11.1.0:
+ resolution: {integrity: sha512-0rcTq621PD5jM/e0a3EJoGC/1TC5ZBCERW82LQuwfGnCa1V8w7dpYH1yNu+SLb6E5dkeCBzKEyLGlFrnr+dUyw==}
+ engines: {node: '>=14.14'}
dependencies:
graceful-fs: 4.2.10
jsonfile: 6.1.0
@@ -557,8 +557,8 @@ packages:
postcss-value-parser: 4.2.0
dev: true
- /postcss-cli/10.0.0_postcss@8.4.19:
- resolution: {integrity: sha512-Wjy/00wBBEgQqnSToznxLWDnATznokFGXsHtF/3G8glRZpz5KYlfHcBW/VMJmWAeF2x49zjgy4izjM3/Wx1dKA==}
+ /postcss-cli/10.1.0_postcss@8.4.19:
+ resolution: {integrity: sha512-Zu7PLORkE9YwNdvOeOVKPmWghprOtjFQU3srMUGbdz3pHJiFh7yZ4geiZFMkjMfB0mtTFR3h8RemR62rPkbOPA==}
engines: {node: '>=14'}
hasBin: true
peerDependencies:
@@ -566,7 +566,7 @@ packages:
dependencies:
chokidar: 3.5.3
dependency-graph: 0.11.0
- fs-extra: 10.1.0
+ fs-extra: 11.1.0
get-stdin: 9.0.0
globby: 13.1.2
picocolors: 1.0.0
@@ -575,7 +575,7 @@ packages:
postcss-reporter: 7.0.5_postcss@8.4.19
pretty-hrtime: 1.0.3
read-cache: 1.0.0
- slash: 4.0.0
+ slash: 5.0.0
yargs: 17.6.2
transitivePeerDependencies:
- ts-node
@@ -605,8 +605,8 @@ packages:
postcss-value-parser: 4.2.0
dev: true
- /postcss-custom-properties/12.1.10_postcss@8.4.19:
- resolution: {integrity: sha512-U3BHdgrYhCrwTVcByFHs9EOBoqcKq4Lf3kXwbTi4hhq0qWhl/pDWq2THbv/ICX/Fl9KqeHBb8OVrTf2OaYF07A==}
+ /postcss-custom-properties/12.1.11_postcss@8.4.19:
+ resolution: {integrity: sha512-0IDJYhgU8xDv1KY6+VgUwuQkVtmYzRwu+dMjnmdMafXYv86SWqfxkc7qdDvWS38vsjaEtv8e0vGOUQrAiMBLpQ==}
engines: {node: ^12 || ^14 || >=16}
peerDependencies:
postcss: ^8.2
@@ -955,6 +955,11 @@ packages:
engines: {node: '>=12'}
dev: true
+ /slash/5.0.0:
+ resolution: {integrity: sha512-n6KkmvKS0623igEVj3FF0OZs1gYYJ0o0Hj939yc1fyxl2xt+xYpLnzJB6xBSqOfV9ZFLEWodBBN/heZJahuIJQ==}
+ engines: {node: '>=14.16'}
+ dev: true
+
/source-map-js/1.0.2:
resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==}
engines: {node: '>=0.10.0'}
@@ -1018,8 +1023,8 @@ packages:
stable: 0.1.8
dev: true
- /terser/5.15.1:
- resolution: {integrity: sha512-K1faMUvpm/FBxjBXud0LWVAGxmvoPbZbfTCYbSgaaYQaIXI3/TdI7a7ZGA73Zrou6Q8Zmz3oeUTsp/dj+ag2Xw==}
+ /terser/5.16.1:
+ resolution: {integrity: sha512-xvQfyfA1ayT0qdK47zskQgRZeWLoOQ8JQ6mIgRGVNwZKdQMU+5FkCBjmv4QjcrTzyZquRw2FVtlJSRUmMKQslw==}
engines: {node: '>=10'}
hasBin: true
dependencies:
From 5d4788dde6932870478ff956ae8bc41ff1f6679d Mon Sep 17 00:00:00 2001
From: Orest Bida
Date: Thu, 8 Dec 2022 13:46:04 +0100
Subject: [PATCH 04/53] Fix whitespace: use spaces instead of tabs
---
src/iframemanager.css | 284 +++++++++++++++++++++---------------------
1 file changed, 142 insertions(+), 142 deletions(-)
diff --git a/src/iframemanager.css b/src/iframemanager.css
index f14c909..50601ef 100644
--- a/src/iframemanager.css
+++ b/src/iframemanager.css
@@ -8,7 +8,7 @@ div[data-service] :after{
font-variant: normal;
font-weight: inherit;
font-family: inherit;
- line-height: 1.2;
+ line-height: 1.2;
font-size: 1em;
margin: 0;
padding: 0;
@@ -23,17 +23,17 @@ div[data-service] :after{
}
div[data-service] .c-ld {
- bottom: 2em;
+ bottom: 2em;
right: 2.5em;
- opacity: 0;
- visibility: hidden;
- transform: translateY(10px);
- transition: opacity .3s ease, visibility .3s ease, transform .3s ease;
+ opacity: 0;
+ visibility: hidden;
+ transform: translateY(10px);
+ transition: opacity .3s ease, visibility .3s ease, transform .3s ease;
}
div[data-service] .c-ld,
div[data-service] .c-ld:after{
- position: absolute;
+ position: absolute;
z-index: 1;
border-radius: 100%;
width: 20px;
@@ -41,33 +41,33 @@ div[data-service] .c-ld:after{
}
div[data-service] .c-ld::after{
- content: '';
- border: 4px solid white;
+ content: '';
+ border: 4px solid white;
border-top: 4px solid transparent;
- animation: spin 1s linear infinite;
+ animation: spin 1s linear infinite;
}
div[data-service].c-h-n .c-ld{
- opacity: 1;
- visibility: visible;
- transform: translateY(0);
+ opacity: 1;
+ visibility: visible;
+ transform: translateY(0);
}
@keyframes spin {
- 0% { transform: rotate(0deg); }
- 100% { transform: rotate(360deg); }
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
}
div[data-service]{
- display: inline-block;
- max-width: 100%;
- min-height: 150px;
- min-width: 300px;
- font-family: inherit;
- position: relative;
- font-size: initial;
- background-color: #0b1016;
- overflow: hidden;
+ display: inline-block;
+ max-width: 100%;
+ min-height: 150px;
+ min-width: 300px;
+ font-family: inherit;
+ position: relative;
+ font-size: initial;
+ background-color: #0b1016;
+ overflow: hidden;
}
div[data-service] button,
@@ -76,33 +76,33 @@ div[data-service] input,
div[data-service] h1,
div[data-service] h2,
div[data-service] h3{
- transition: none;
- animation: none;
+ transition: none;
+ animation: none;
}
div[data-service]::before{
- padding-top: 56.25%;
- display: block;
- content: "";
+ padding-top: 56.25%;
+ display: block;
+ content: "";
}
div[data-autoscale]{
- height: auto;
- width: 100%;
+ height: auto;
+ width: 100%;
}
div[data-service] .c-nt{
- color: #fff;
- max-width: 100%;
- height: 100%;
- width: 100%;
- transition: opacity .3s ease, visibility .3s ease;
- position: absolute;
- top: 0;
- left: 0;
- bottom: 0;
- right: 0;
- z-index: 2;
+ color: #fff;
+ max-width: 100%;
+ height: 100%;
+ width: 100%;
+ transition: opacity .3s ease, visibility .3s ease;
+ position: absolute;
+ top: 0;
+ left: 0;
+ bottom: 0;
+ right: 0;
+ z-index: 2;
}
div[data-service] .c-bg{
@@ -111,43 +111,43 @@ div[data-service] .c-bg{
right: 0;
bottom: 0;
left: 0;
- opacity: .5;
- z-index: 1;
- transition: opacity .3s ease, visibility .3s ease, transform .3s ease;
+ opacity: .5;
+ z-index: 1;
+ transition: opacity .3s ease, visibility .3s ease, transform .3s ease;
}
div[data-service] .c-bg::before{
- content: '';
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- z-index: 1;
- transition: opacity .3s ease, visibility .3s ease;
- background: rgb(30,56,97);
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ z-index: 1;
+ transition: opacity .3s ease, visibility .3s ease;
+ background: rgb(30,56,97);
background: linear-gradient( 14deg, rgb(12 15 23 / 95%) 10%, rgb(0 0 0 / 51%) 100%, rgba(68,77,125,0.1082983535210959) 0%);
- background: -moz-linear-gradient(14deg, rgba(30,56,97,1) 0%, rgba(206,220,233,0.1181022750897234) 100%);
- background: -webkit-linear-gradient(14deg, rgba(30,56,97,1) 0%, rgba(206,220,233,0.1181022750897234) 100%);
- background: linear-gradient(14deg, rgba(30,56,97,1) 0%, rgba(206,220,233,0.1181022750897234) 100%);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#1e3861",endColorstr="#cedce9",GradientType=1);
+ background: -moz-linear-gradient(14deg, rgba(30,56,97,1) 0%, rgba(206,220,233,0.1181022750897234) 100%);
+ background: -webkit-linear-gradient(14deg, rgba(30,56,97,1) 0%, rgba(206,220,233,0.1181022750897234) 100%);
+ background: linear-gradient(14deg, rgba(30,56,97,1) 0%, rgba(206,220,233,0.1181022750897234) 100%);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#1e3861",endColorstr="#cedce9",GradientType=1);
}
div[data-service] .c-bg-i{
- background-size: cover;
+ background-size: cover;
background-position: center;
- background-repeat: no-repeat;
- position: absolute;
+ background-repeat: no-repeat;
+ position: absolute;
top: 0;
left: 0;
right: 0;
- bottom: 0;
- opacity: 0;
- transition: opacity .5s ease, transform .5s ease;
+ bottom: 0;
+ opacity: 0;
+ transition: opacity .5s ease, transform .5s ease;
}
div[data-service] .c-bg-i.loaded{
- opacity: 1;
+ opacity: 1;
}
div[data-service] .c-tl{
@@ -155,52 +155,52 @@ div[data-service] .c-tl{
margin-bottom: 10px;
font-size: 1.2em;
font-weight: bold;
- text-align: center;
+ text-align: center;
}
div[data-service].c-h-n .c-bg{
- opacity: 1;
- transform: scale(1);
+ opacity: 1;
+ transform: scale(1);
}
div[data-service].c-h-n .c-nt{
- opacity: 0;
- visibility: hidden;
+ opacity: 0;
+ visibility: hidden;
}
div[data-service] .c-n-c{
- display: table;
- height: 100%;
- width: 100%;
- position: relative;
- z-index: 1;
- margin: 0;
- font-size: .9em;
- transition: background-color .3s ease, opacity .3s ease;
+ display: table;
+ height: 100%;
+ width: 100%;
+ position: relative;
+ z-index: 1;
+ margin: 0;
+ font-size: .9em;
+ transition: background-color .3s ease, opacity .3s ease;
}
div[data-service] .c-n-t{
- display: block;
- font-size: .95em;
- position: relative;
- z-index: 1;
- line-height: 1.4em;
- color: #fff;
- max-width: 420px;
- margin: 0 auto;
- margin-bottom: 20px;
+ display: block;
+ font-size: .95em;
+ position: relative;
+ z-index: 1;
+ line-height: 1.4em;
+ color: #fff;
+ max-width: 420px;
+ margin: 0 auto;
+ margin-bottom: 20px;
}
div[data-service] .c-n-t,
div[data-service] .c-n-a{
- text-align: center;
+ text-align: center;
}
div[data-service] .c-t-cn{
- display: table-cell;
- vertical-align: middle;
- padding: 0 12px;
- transition: opacity .3s ease, transform .3s ease, visibility .3s ease;
+ display: table-cell;
+ vertical-align: middle;
+ padding: 0 12px;
+ transition: opacity .3s ease, transform .3s ease, visibility .3s ease;
}
div[data-service] .c-n-c .c-la-b,
@@ -223,10 +223,10 @@ div[data-service] .c-n-c .c-l-b{
}
/* Play icon */
div[data-service] .c-n-c .c-l-b::before{
- content: '';
+ content: '';
display: block;
position: absolute;
- top: 50%;
+ top: 50%;
transform: translateY(-50%);
left: 1.1em;
z-index: 2;
@@ -238,33 +238,33 @@ div[data-service] .c-n-c .c-l-b::before{
div[data-service] .c-n-c .c-la-b{
margin-left: 1em;
- padding: 1em;
+ padding: 1em;
background: rgba(225, 239, 255, .8);
color: #0d1f34;
}
div[data-service] .c-n-c .c-la-b:hover{
- background: rgba(225, 239, 255, .95);
+ background: rgba(225, 239, 255, .95);
}
div[data-service] .c-n-c .c-l-b:hover{
- background: rgba(9, 80, 161, 0.89);
+ background: rgba(9, 80, 161, 0.89);
}
div[data-service] .c-n-c .c-la-b:active{
- transition: none;
+ transition: none;
background: rgba(225, 239, 255, .6);
}
div[data-service] .c-n-c .c-l-b:active{
- transition: none;
+ transition: none;
box-shadow: 0 0 0 4px rgba(24, 104, 250, .24);
}
div[data-service].c-h-n .c-t-cn{
- opacity: 0;
- visibility: hidden;
- transform: translateY(-10px);
+ opacity: 0;
+ visibility: hidden;
+ transform: translateY(-10px);
}
div[data-service] iframe{
@@ -274,22 +274,22 @@ div[data-service] iframe{
right: 0;
bottom: 0;
height: 100%;
- border: none;
- max-width: 100%;
- width: 100%;
- background: #fff;
- display: block;
- visibility: hidden;
- opacity: 0;
- z-index: 2;
- transition: opacity .5s ease;
+ border: none;
+ max-width: 100%;
+ width: 100%;
+ background: #fff;
+ display: block;
+ visibility: hidden;
+ opacity: 0;
+ z-index: 2;
+ transition: opacity .5s ease;
}
div[data-service].c-h-b iframe{
- opacity: 1;
- visibility: visible;
- transform: scale(1);
- transition-delay: .1s;
+ opacity: 1;
+ visibility: visible;
+ transform: scale(1);
+ transition-delay: .1s;
}
div[data-service] .c-n-t a {
@@ -299,89 +299,89 @@ div[data-service] .c-n-t a {
}
div[data-service] .c-n-t a:hover{
- border-color: transparent;
+ border-color: transparent;
}
div[data-service][data-ratio="1:1"]::before{
- padding-top: 100%;
+ padding-top: 100%;
}
div[data-service][data-ratio="2:1"]::before{
- padding-top: 50%;
+ padding-top: 50%;
}
div[data-service][data-ratio="3:2"]::before{
- padding-top: 66.666666%;
+ padding-top: 66.666666%;
}
div[data-service][data-ratio="5:2"]::before{
- padding-top: 40%;
+ padding-top: 40%;
}
div[data-service][data-ratio="4:3"]::before{
- padding-top: 75%;
+ padding-top: 75%;
}
div[data-service][data-ratio="16:9"]::before{
- padding-top: 56.25%;
+ padding-top: 56.25%;
}
div[data-service][data-ratio="16:10"]::before{
- padding-top: 62.5%;
+ padding-top: 62.5%;
}
div[data-service][data-ratio="20:9"]::before{
- padding-top: 45%;
+ padding-top: 45%;
}
div[data-service][data-ratio="21:9"]::before{
- padding-top: 42.857142%;
+ padding-top: 42.857142%;
}
/** Vertical aspect ratios **/
div[data-service][data-ratio="9:16"]::before{
- padding-top: 177.777777%;
+ padding-top: 177.777777%;
}
div[data-service][data-ratio="9:20"]::before{
- padding-top: 222.222222%;
+ padding-top: 222.222222%;
}
div[data-customwidget]::before {
- display: none;
+ display: none;
}
div[data-customwidget].c-h-b{
- background: transparent;
+ background: transparent;
}
div[data-customwidget].c-h-b .c-ld{
- opacity: 0;
- visibility: hidden;
+ opacity: 0;
+ visibility: hidden;
}
div[data-customwidget] > div{
- margin: 0!important;
+ margin: 0!important;
}
div[data-customwidget]{
- vertical-align: top;
- min-width: 296px;
- transition: background-color .3s ease;
- transition-delay: .3s;
+ vertical-align: top;
+ min-width: 296px;
+ transition: background-color .3s ease;
+ transition-delay: .3s;
}
/* div[data-service="twitter"] .c-n-c .c-l-b{
- background-color: #1DA1F2;
+ background-color: #1DA1F2;
}
div[data-service="twitter"] .c-n-c .c-l-b::before{
- border: none;
- height: 15px;
- width: 15px;
- background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAATZJREFUOE+lk78rRWEcxj/PJhmUMhhkkMEgGyZSlCR27qRYFItRXWVQJsVm8A8w3GSQUpTcYlCUzXAzKPEnPHp1zunc0znXkW+9y/s+30/P98cr/hkqk2+7E1gA2oG6pIeQZ3v6B2B7T9JmHsz2LHAA9KXeq8AUsCTbE8AVcAGsS3pJg2zXgLkM/Bm4BL7SgKB5B3aBm5RNF5RZlbQdl3AHjGSET8AtsFIAGJVUDw76gS0gwCplmhppuiR9xg7OgZk/JDck9QZ9DJgEdoCxkpCapPk0YBA4jJJ7gIFfQOOSrhNAtAvLwFEJB/uSNmJd0ybaDk5CGWvAcA7sMeyEpEYTwHY3EJqyCCT0DOAUWJX0kb4PYwzzD3tQFCfAsaSzPEFSgu0OYCg6bcAb8CrpvlVfSv3GVoBvLzlh7eQqydQAAAAASUVORK5CYII=')
+ border: none;
+ height: 15px;
+ width: 15px;
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAATZJREFUOE+lk78rRWEcxj/PJhmUMhhkkMEgGyZSlCR27qRYFItRXWVQJsVm8A8w3GSQUpTcYlCUzXAzKPEnPHp1zunc0znXkW+9y/s+30/P98cr/hkqk2+7E1gA2oG6pIeQZ3v6B2B7T9JmHsz2LHAA9KXeq8AUsCTbE8AVcAGsS3pJg2zXgLkM/Bm4BL7SgKB5B3aBm5RNF5RZlbQdl3AHjGSET8AtsFIAGJVUDw76gS0gwCplmhppuiR9xg7OgZk/JDck9QZ9DJgEdoCxkpCapPk0YBA4jJJ7gIFfQOOSrhNAtAvLwFEJB/uSNmJd0ybaDk5CGWvAcA7sMeyEpEYTwHY3EJqyCCT0DOAUWJX0kb4PYwzzD3tQFCfAsaSzPEFSgu0OYCg6bcAb8CrpvlVfSv3GVoBvLzlh7eQqydQAAAAASUVORK5CYII=')
}
.fb_iframe_widget_fluid span{
- width: 100%!important;
+ width: 100%!important;
} */
\ No newline at end of file
From 29d867d9e3496159ebe55776499d60df8334b317 Mon Sep 17 00:00:00 2001
From: Orest Bida
Date: Thu, 8 Dec 2022 13:48:53 +0100
Subject: [PATCH 05/53] Minor tweak: use `600` as font weight instead of `bold`
---
src/iframemanager.css | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/iframemanager.css b/src/iframemanager.css
index 50601ef..a4a43dc 100644
--- a/src/iframemanager.css
+++ b/src/iframemanager.css
@@ -154,7 +154,7 @@ div[data-service] .c-tl{
display: block;
margin-bottom: 10px;
font-size: 1.2em;
- font-weight: bold;
+ font-weight: 600;
text-align: center;
}
@@ -216,7 +216,7 @@ div[data-service] .c-n-c .c-l-b{
padding-left: 2.8em;
color: #ffffff;
margin: 0 auto;
- font-weight: bold;
+ font-weight: 600;
cursor: pointer;
transition: opacity .3s ease, transform .3s cubic-bezier(0.25, 1, 0.5, 1), visibility .3s ease, box-shadow .3s ease, background-color .3s ease;
box-shadow: rgba(0, 0, 0, 0.19) 0px 4px 12px;
From a65e5dd53721bf49c485418171abc3b678baed53 Mon Sep 17 00:00:00 2001
From: Orest Bida
Date: Fri, 9 Dec 2022 19:48:12 +0100
Subject: [PATCH 06/53] Rebuild dist files
---
dist/iframemanager.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dist/iframemanager.css b/dist/iframemanager.css
index 4bb84c6..851f56e 100644
--- a/dist/iframemanager.css
+++ b/dist/iframemanager.css
@@ -1 +1 @@
-div[data-service] *,div[data-service] :after,div[data-service] :before{background:none;border:none;box-shadow:none;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;float:none;font-family:inherit;font-size:1em;font-style:inherit;font-variant:normal;font-weight:inherit;letter-spacing:unset;line-height:1.2;margin:0;padding:0;text-align:left;text-decoration:none;text-transform:none}div[data-service] .c-ld{bottom:2em;opacity:0;right:2.5em;transform:translateY(10px);transition:opacity .3s ease,visibility .3s ease,transform .3s ease;visibility:hidden}div[data-service] .c-ld,div[data-service] .c-ld:after{border-radius:100%;height:20px;position:absolute;width:20px;z-index:1}div[data-service] .c-ld:after{animation:spin 1s linear infinite;border:4px solid #fff;border-top-color:transparent;content:""}div[data-service].c-h-n .c-ld{opacity:1;transform:translateY(0);visibility:visible}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}div[data-service]{background-color:#0b1016;display:inline-block;font-family:inherit;font-size:medium;max-width:100%;min-height:150px;min-width:300px;overflow:hidden;position:relative}div[data-service] button,div[data-service] h1,div[data-service] h2,div[data-service] h3,div[data-service] input,div[data-service] label{animation:none;transition:none}div[data-service]:before{content:"";display:block;padding-top:56.25%}div[data-autoscale]{height:auto;width:100%}div[data-service] .c-nt{bottom:0;color:#fff;height:100%;left:0;max-width:100%;position:absolute;right:0;top:0;transition:opacity .3s ease,visibility .3s ease;width:100%;z-index:2}div[data-service] .c-bg{opacity:.5;transition:opacity .3s ease,visibility .3s ease,transform .3s ease}div[data-service] .c-bg,div[data-service] .c-bg:before{bottom:0;left:0;position:absolute;right:0;top:0;z-index:1}div[data-service] .c-bg:before{background:#1e3861;background:linear-gradient(14deg,rgba(12,15,23,.95) 10%,rgba(0,0,0,.51) 100%,rgba(68,77,125,.108) 0);background:-moz-linear-gradient(14deg,#1e3861 0,rgba(206,220,233,.118) 100%);background:-webkit-linear-gradient(14deg,#1e3861,rgba(206,220,233,.118));background:linear-gradient(14deg,#1e3861,rgba(206,220,233,.118));content:"";filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#1e3861",endColorstr="#cedce9",GradientType=1);transition:opacity .3s ease,visibility .3s ease}div[data-service] .c-bg-i{background-position:50%;background-repeat:no-repeat;background-size:cover;bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;transition:opacity .5s ease,transform .5s ease}div[data-service] .c-bg-i.loaded{opacity:1}div[data-service] .c-tl{display:block;font-size:1.2em;font-weight:700;margin-bottom:10px;text-align:center}div[data-service].c-h-n .c-bg{opacity:1;transform:scale(1)}div[data-service].c-h-n .c-nt{opacity:0;visibility:hidden}div[data-service] .c-n-c{display:table;font-size:.9em;height:100%;margin:0;position:relative;transition:background-color .3s ease,opacity .3s ease;width:100%;z-index:1}div[data-service] .c-n-t{color:#fff;display:block;font-size:.95em;line-height:1.4em;margin:0 auto 20px;max-width:420px;position:relative;z-index:1}div[data-service] .c-n-a,div[data-service] .c-n-t{text-align:center}div[data-service] .c-t-cn{display:table-cell;padding:0 12px;transition:opacity .3s ease,transform .3s ease,visibility .3s ease;vertical-align:middle}div[data-service] .c-n-c .c-l-b,div[data-service] .c-n-c .c-la-b{background:rgba(0,102,219,.84);border:none;border-radius:.25em;box-shadow:0 4px 12px rgba(0,0,0,.19);color:#fff;cursor:pointer;display:inline-block;font-size:.85em;font-weight:700;margin:0 auto;padding:1em 1em 1em 2.8em;position:relative;transition:opacity .3s ease,transform .3s cubic-bezier(.25,1,.5,1),visibility .3s ease,box-shadow .3s ease,background-color .3s ease;vertical-align:middle}div[data-service] .c-n-c .c-l-b:before{border-bottom:7.5px solid transparent;border-left:12px solid #fff;border-top:7.5px solid transparent;content:"";display:block;height:0;left:1.1em;position:absolute;top:50%;transform:translateY(-50%);z-index:2}div[data-service] .c-n-c .c-la-b{background:rgba(225,239,255,.8);color:#0d1f34;margin-left:1em;padding:1em}div[data-service] .c-n-c .c-la-b:hover{background:rgba(225,239,255,.95)}div[data-service] .c-n-c .c-l-b:hover{background:rgba(9,80,161,.89)}div[data-service] .c-n-c .c-la-b:active{background:rgba(225,239,255,.6);transition:none}div[data-service] .c-n-c .c-l-b:active{box-shadow:0 0 0 4px rgba(24,104,250,.24);transition:none}div[data-service].c-h-n .c-t-cn{opacity:0;transform:translateY(-10px);visibility:hidden}div[data-service] iframe{background:#fff;border:none;bottom:0;display:block;height:100%;left:0;max-width:100%;opacity:0;position:absolute;right:0;top:0;transition:opacity .5s ease;visibility:hidden;width:100%;z-index:2}div[data-service].c-h-b iframe{opacity:1;transform:scale(1);transition-delay:.1s;visibility:visible}div[data-service] .c-n-t a{border-bottom:1px solid #5fb3fb;color:#5fb3fb;text-decoration:none}div[data-service] .c-n-t a:hover{border-color:transparent}div[data-service][data-ratio="1:1"]:before{padding-top:100%}div[data-service][data-ratio="2:1"]:before{padding-top:50%}div[data-service][data-ratio="3:2"]:before{padding-top:66.666666%}div[data-service][data-ratio="5:2"]:before{padding-top:40%}div[data-service][data-ratio="4:3"]:before{padding-top:75%}div[data-service][data-ratio="16:9"]:before{padding-top:56.25%}div[data-service][data-ratio="16:10"]:before{padding-top:62.5%}div[data-service][data-ratio="20:9"]:before{padding-top:45%}div[data-service][data-ratio="21:9"]:before{padding-top:42.857142%}div[data-service][data-ratio="9:16"]:before{padding-top:177.777777%}div[data-service][data-ratio="9:20"]:before{padding-top:222.222222%}div[data-customwidget]:before{display:none}div[data-customwidget].c-h-b{background:transparent}div[data-customwidget].c-h-b .c-ld{opacity:0;visibility:hidden}div[data-customwidget]>div{margin:0!important}div[data-customwidget]{min-width:296px;transition:background-color .3s ease;transition-delay:.3s;vertical-align:top}
\ No newline at end of file
+div[data-service] *,div[data-service] :after,div[data-service] :before{background:none;border:none;box-shadow:none;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;float:none;font-family:inherit;font-size:1em;font-style:inherit;font-variant:normal;font-weight:inherit;letter-spacing:unset;line-height:1.2;margin:0;padding:0;text-align:left;text-decoration:none;text-transform:none}div[data-service] .c-ld{bottom:2em;opacity:0;right:2.5em;transform:translateY(10px);transition:opacity .3s ease,visibility .3s ease,transform .3s ease;visibility:hidden}div[data-service] .c-ld,div[data-service] .c-ld:after{border-radius:100%;height:20px;position:absolute;width:20px;z-index:1}div[data-service] .c-ld:after{animation:spin 1s linear infinite;border:4px solid #fff;border-top-color:transparent;content:""}div[data-service].c-h-n .c-ld{opacity:1;transform:translateY(0);visibility:visible}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}div[data-service]{background-color:#0b1016;display:inline-block;font-family:inherit;font-size:medium;max-width:100%;min-height:150px;min-width:300px;overflow:hidden;position:relative}div[data-service] button,div[data-service] h1,div[data-service] h2,div[data-service] h3,div[data-service] input,div[data-service] label{animation:none;transition:none}div[data-service]:before{content:"";display:block;padding-top:56.25%}div[data-autoscale]{height:auto;width:100%}div[data-service] .c-nt{bottom:0;color:#fff;height:100%;left:0;max-width:100%;position:absolute;right:0;top:0;transition:opacity .3s ease,visibility .3s ease;width:100%;z-index:2}div[data-service] .c-bg{opacity:.5;transition:opacity .3s ease,visibility .3s ease,transform .3s ease}div[data-service] .c-bg,div[data-service] .c-bg:before{bottom:0;left:0;position:absolute;right:0;top:0;z-index:1}div[data-service] .c-bg:before{background:#1e3861;background:linear-gradient(14deg,rgba(12,15,23,.95) 10%,rgba(0,0,0,.51) 100%,rgba(68,77,125,.108) 0);background:-moz-linear-gradient(14deg,#1e3861 0,rgba(206,220,233,.118) 100%);background:-webkit-linear-gradient(14deg,#1e3861,rgba(206,220,233,.118));background:linear-gradient(14deg,#1e3861,rgba(206,220,233,.118));content:"";filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#1e3861",endColorstr="#cedce9",GradientType=1);transition:opacity .3s ease,visibility .3s ease}div[data-service] .c-bg-i{background-position:50%;background-repeat:no-repeat;background-size:cover;bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;transition:opacity .5s ease,transform .5s ease}div[data-service] .c-bg-i.loaded{opacity:1}div[data-service] .c-tl{display:block;font-size:1.2em;font-weight:600;margin-bottom:10px;text-align:center}div[data-service].c-h-n .c-bg{opacity:1;transform:scale(1)}div[data-service].c-h-n .c-nt{opacity:0;visibility:hidden}div[data-service] .c-n-c{display:table;font-size:.9em;height:100%;margin:0;position:relative;transition:background-color .3s ease,opacity .3s ease;width:100%;z-index:1}div[data-service] .c-n-t{color:#fff;display:block;font-size:.95em;line-height:1.4em;margin:0 auto 20px;max-width:420px;position:relative;z-index:1}div[data-service] .c-n-a,div[data-service] .c-n-t{text-align:center}div[data-service] .c-t-cn{display:table-cell;padding:0 12px;transition:opacity .3s ease,transform .3s ease,visibility .3s ease;vertical-align:middle}div[data-service] .c-n-c .c-l-b,div[data-service] .c-n-c .c-la-b{background:rgba(0,102,219,.84);border:none;border-radius:.25em;box-shadow:0 4px 12px rgba(0,0,0,.19);color:#fff;cursor:pointer;display:inline-block;font-size:.85em;font-weight:600;margin:0 auto;padding:1em 1em 1em 2.8em;position:relative;transition:opacity .3s ease,transform .3s cubic-bezier(.25,1,.5,1),visibility .3s ease,box-shadow .3s ease,background-color .3s ease;vertical-align:middle}div[data-service] .c-n-c .c-l-b:before{border-bottom:7.5px solid transparent;border-left:12px solid #fff;border-top:7.5px solid transparent;content:"";display:block;height:0;left:1.1em;position:absolute;top:50%;transform:translateY(-50%);z-index:2}div[data-service] .c-n-c .c-la-b{background:rgba(225,239,255,.8);color:#0d1f34;margin-left:1em;padding:1em}div[data-service] .c-n-c .c-la-b:hover{background:rgba(225,239,255,.95)}div[data-service] .c-n-c .c-l-b:hover{background:rgba(9,80,161,.89)}div[data-service] .c-n-c .c-la-b:active{background:rgba(225,239,255,.6);transition:none}div[data-service] .c-n-c .c-l-b:active{box-shadow:0 0 0 4px rgba(24,104,250,.24);transition:none}div[data-service].c-h-n .c-t-cn{opacity:0;transform:translateY(-10px);visibility:hidden}div[data-service] iframe{background:#fff;border:none;bottom:0;display:block;height:100%;left:0;max-width:100%;opacity:0;position:absolute;right:0;top:0;transition:opacity .5s ease;visibility:hidden;width:100%;z-index:2}div[data-service].c-h-b iframe{opacity:1;transform:scale(1);transition-delay:.1s;visibility:visible}div[data-service] .c-n-t a{border-bottom:1px solid #5fb3fb;color:#5fb3fb;text-decoration:none}div[data-service] .c-n-t a:hover{border-color:transparent}div[data-service][data-ratio="1:1"]:before{padding-top:100%}div[data-service][data-ratio="2:1"]:before{padding-top:50%}div[data-service][data-ratio="3:2"]:before{padding-top:66.666666%}div[data-service][data-ratio="5:2"]:before{padding-top:40%}div[data-service][data-ratio="4:3"]:before{padding-top:75%}div[data-service][data-ratio="16:9"]:before{padding-top:56.25%}div[data-service][data-ratio="16:10"]:before{padding-top:62.5%}div[data-service][data-ratio="20:9"]:before{padding-top:45%}div[data-service][data-ratio="21:9"]:before{padding-top:42.857142%}div[data-service][data-ratio="9:16"]:before{padding-top:177.777777%}div[data-service][data-ratio="9:20"]:before{padding-top:222.222222%}div[data-customwidget]:before{display:none}div[data-customwidget].c-h-b{background:transparent}div[data-customwidget].c-h-b .c-ld{opacity:0;visibility:hidden}div[data-customwidget]>div{margin:0!important}div[data-customwidget]{min-width:296px;transition:background-color .3s ease;transition-delay:.3s;vertical-align:top}
\ No newline at end of file
From ded74910b0d42337c4b8b14acd58922a7c490fa6 Mon Sep 17 00:00:00 2001
From: Orest Bida
Date: Fri, 9 Dec 2022 19:48:43 +0100
Subject: [PATCH 07/53] Update example app.js
---
demo/app.js | 57 ++++++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 48 insertions(+), 9 deletions(-)
diff --git a/demo/app.js b/demo/app.js
index bb07753..45f84ae 100644
--- a/demo/app.js
+++ b/demo/app.js
@@ -4,6 +4,49 @@
// get module
var manager = iframemanager();
+ /**
+ * @typedef {object} WaitConfig
+ * @property {'script' | 'iframe'} type,
+ * @property {any} obj
+ * @property {string} [prop]
+ * @property {string} [selector]
+ */
+
+ /**
+ * Wait until a property on the window object is available
+ * @param {WaitConfig} opts
+ * @returns {Promise}
+ */
+ const waitFor = async (opts) => {
+ const {obj, type, prop, selector} = opts;
+
+ const isIframe = type === 'iframe';
+
+ const timeout = isIframe
+ ? 100
+ : 10;
+
+ const maxWait = 500;
+
+ const objToCheck = prop
+ ? obj[prop]
+ : obj;
+
+ const isDefined = () => typeof (isIframe && obj.querySelector(selector) || objToCheck) !== 'undefined'
+
+ let nIntervals = 0;
+
+ return await new Promise(resolve => {
+ const interval = setInterval(() => {
+ const timedOut = !isIframe && ++nIntervals * timeout > maxWait;
+ if (isDefined() || timedOut) {
+ clearInterval(interval);
+ resolve(!timedOut);
+ }
+ }, timeout);
+ });
+ };
+
manager.run({
currLang: document.documentElement.getAttribute('lang'),
// autoLang: true,
@@ -77,14 +120,12 @@
}
},
twitter : {
- onAccept: function(div, callback){
- CookieConsent.loadScript('https://platform.twitter.com/widgets.js').then(() => {
- twttr.widgets.createTweet(div.dataset.id, div).then(function(tweet){
- console.log("tweet", tweet);
- callback(tweet.firstChild);
- });
- });
+ onAccept: async (div, setIframe) => {
+ const twttrLoaded = await CookieConsent.loadScript('https://platform.twitter.com/widgets.js');
+ const twttrReady = twttrLoaded && await waitFor({type: 'script', obj: window, prop: 'twttr'});
+ const tweet = twttrReady && await twttr.widgets.createTweet(div.dataset.id, div);
+ tweet && setIframe(tweet.firstChild);
},
onReject: function(iframe){
@@ -102,8 +143,6 @@
loadAllBtn: 'Don\'t ask again'
}
}
-
-
},
"facebook-post" : {
From 5b93c39d4be4a73f2fade5903b7b087969c5072d Mon Sep 17 00:00:00 2001
From: Orest Bida
Date: Fri, 9 Dec 2022 22:34:39 +0100
Subject: [PATCH 08/53] Minor tweak: improve css reset
---
src/iframemanager.css | 86 ++++++++++++++++++++-----------------------
1 file changed, 39 insertions(+), 47 deletions(-)
diff --git a/src/iframemanager.css b/src/iframemanager.css
index a4a43dc..8a1cd17 100644
--- a/src/iframemanager.css
+++ b/src/iframemanager.css
@@ -1,25 +1,45 @@
-div[data-service] *,
-div[data-service] :before,
-div[data-service] :after{
- -webkit-box-sizing: border-box;
+div[data-service],
+div[data-service] span,
+div[data-service] a,
+div[data-service] button,
+div[data-service] ::before,
+div[data-service] ::after{
+ all: unset;
box-sizing: border-box;
- float: none;
- font-style: inherit;
- font-variant: normal;
- font-weight: inherit;
+}
+
+div[data-service] a,
+div[data-service] button,
+div[data-service] input{
font-family: inherit;
- line-height: 1.2;
- font-size: 1em;
+ font-size: 100%;
+ line-height: normal;
margin: 0;
- padding: 0;
- text-transform: none;
- letter-spacing: unset;
- color: inherit;
- background: none;
- border: none;
- box-shadow: none;
- text-decoration: none;
- text-align: left;
+ outline: revert;
+ outline-offset: 2px;
+ cursor: pointer;
+ overflow: hidden;
+ -webkit-appearance: none;
+ appearance: none;
+}
+
+div[data-service]{
+ font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
+ font-size: 16px;
+ font-weight: 400;
+ display: inline-block;
+ max-width: 100%;
+ min-height: 150px;
+ min-width: 300px;
+ position: relative;
+ background-color: #0b1016;
+ overflow: hidden;
+}
+
+div[data-service]::before{
+ padding-top: 56.25%;
+ display: block;
+ content: '';
}
div[data-service] .c-ld {
@@ -58,34 +78,6 @@ div[data-service].c-h-n .c-ld{
100% { transform: rotate(360deg); }
}
-div[data-service]{
- display: inline-block;
- max-width: 100%;
- min-height: 150px;
- min-width: 300px;
- font-family: inherit;
- position: relative;
- font-size: initial;
- background-color: #0b1016;
- overflow: hidden;
-}
-
-div[data-service] button,
-div[data-service] label,
-div[data-service] input,
-div[data-service] h1,
-div[data-service] h2,
-div[data-service] h3{
- transition: none;
- animation: none;
-}
-
-div[data-service]::before{
- padding-top: 56.25%;
- display: block;
- content: "";
-}
-
div[data-autoscale]{
height: auto;
width: 100%;
From 04a8a1a52f35c664d3f6d40efda161cc5a4ce7af Mon Sep 17 00:00:00 2001
From: Orest Bida
Date: Fri, 9 Dec 2022 23:02:28 +0100
Subject: [PATCH 09/53] Minor tweak: use `flexbox` instead of
`table/table-cell`
---
src/iframemanager.css | 41 ++++++++++++++++++++---------------------
1 file changed, 20 insertions(+), 21 deletions(-)
diff --git a/src/iframemanager.css b/src/iframemanager.css
index 8a1cd17..154b5dd 100644
--- a/src/iframemanager.css
+++ b/src/iframemanager.css
@@ -161,14 +161,15 @@ div[data-service].c-h-n .c-nt{
}
div[data-service] .c-n-c{
- display: table;
+ display: flex;
+ justify-content: center;
+ align-items: center;
height: 100%;
- width: 100%;
position: relative;
z-index: 1;
- margin: 0;
font-size: .9em;
- transition: background-color .3s ease, opacity .3s ease;
+ transition: background-color .3s ease,
+ opacity .3s ease;
}
div[data-service] .c-n-t{
@@ -185,51 +186,49 @@ div[data-service] .c-n-t{
div[data-service] .c-n-t,
div[data-service] .c-n-a{
+ display: flex;
+ align-items: center;
+ justify-content: center;
text-align: center;
+ gap: 12px;
}
div[data-service] .c-t-cn{
- display: table-cell;
- vertical-align: middle;
padding: 0 12px;
transition: opacity .3s ease, transform .3s ease, visibility .3s ease;
}
div[data-service] .c-n-c .c-la-b,
div[data-service] .c-n-c .c-l-b{
- display: inline-block;
+ display: flex;
+ justify-content: space-evenly;
+ align-items: center;
+ gap: 8px;
position: relative;
padding: 1em;
- vertical-align: middle;
background: rgba(0, 102, 219, 0.84);
- border: none;
- border-radius: .25em;
+ border-radius: 4px;
font-size: .85em;
- padding-left: 2.8em;
color: #ffffff;
- margin: 0 auto;
font-weight: 600;
- cursor: pointer;
- transition: opacity .3s ease, transform .3s cubic-bezier(0.25, 1, 0.5, 1), visibility .3s ease, box-shadow .3s ease, background-color .3s ease;
box-shadow: rgba(0, 0, 0, 0.19) 0px 4px 12px;
+ transition: opacity .3s ease,
+ transform .3s cubic-bezier(0.25, 1, 0.5, 1),
+ visibility .3s ease,
+ box-shadow .3s ease,
+ background-color .3s ease;
}
+
/* Play icon */
div[data-service] .c-n-c .c-l-b::before{
content: '';
display: block;
- position: absolute;
- top: 50%;
- transform: translateY(-50%);
- left: 1.1em;
- z-index: 2;
- height: 0;
border-left: 12px solid white;
border-top: 7.5px solid transparent;
border-bottom: 7.5px solid transparent;
}
div[data-service] .c-n-c .c-la-b{
- margin-left: 1em;
padding: 1em;
background: rgba(225, 239, 255, .8);
color: #0d1f34;
From 662a68d83ca43115f1c665db4cd46389d04b3093 Mon Sep 17 00:00:00 2001
From: Orest Bida
Date: Fri, 9 Dec 2022 23:30:20 +0100
Subject: [PATCH 10/53] Minor tweak: use the more appropriate `div` tag instead
of `span`
---
src/iframemanager.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/iframemanager.js b/src/iframemanager.js
index 94eee6c..5a1e87d 100644
--- a/src/iframemanager.js
+++ b/src/iframemanager.js
@@ -476,12 +476,12 @@
var fragment = doc.createDocumentFragment();
var notice = createNode('div');
- var span = createNode('span');
- var innerDiv = createNode('p');
+ var span = createNode('div');
+ var innerDiv = createNode('div');
var load_button = createNode('button');
var load_all_button = createNode('button');
- var notice_text = createNode('span');
+ var notice_text = createNode('div');
var ytVideoBackground = createNode('div');
var loaderBg = createNode('div');
var ytVideoBackgroundInner = createNode('div');
From d58378b1bdbd7707c75bf7a824e05385f34391c8 Mon Sep 17 00:00:00 2001
From: Orest Bida
Date: Fri, 9 Dec 2022 23:31:11 +0100
Subject: [PATCH 11/53] Add basic css variables
---
src/iframemanager.css | 53 +++++++++++++++++++++++++++++--------------
1 file changed, 36 insertions(+), 17 deletions(-)
diff --git a/src/iframemanager.css b/src/iframemanager.css
index 154b5dd..3caf3a1 100644
--- a/src/iframemanager.css
+++ b/src/iframemanager.css
@@ -1,3 +1,21 @@
+:root {
+ --im-font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
+
+ --im-color: #fff;
+ --im-bg: #0b1016;
+
+ --im-btn-color: #fff;
+ --im-btn-hover-color: #fff;
+ --im-btn-bg: rgba(0, 102, 219, 0.84);
+ --im-btn-hover-bg: rgba(9, 80, 161, 0.89);
+
+ --im-overlay-bg: linear-gradient(
+ 14deg,
+ rgba(30,56,97,1) 0%,
+ rgba(206,220,233,0.1181022750897234) 100%
+ )
+}
+
div[data-service],
div[data-service] span,
div[data-service] a,
@@ -24,7 +42,7 @@ div[data-service] input{
}
div[data-service]{
- font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
+ font-family: var(--im-font-family);
font-size: 16px;
font-weight: 400;
display: inline-block;
@@ -32,7 +50,7 @@ div[data-service]{
min-height: 150px;
min-width: 300px;
position: relative;
- background-color: #0b1016;
+ background-color: var(--im-bg);
overflow: hidden;
}
@@ -48,7 +66,9 @@ div[data-service] .c-ld {
opacity: 0;
visibility: hidden;
transform: translateY(10px);
- transition: opacity .3s ease, visibility .3s ease, transform .3s ease;
+ transition: opacity .3s ease,
+ visibility .3s ease,
+ transform .3s ease;
}
div[data-service] .c-ld,
@@ -84,7 +104,7 @@ div[data-autoscale]{
}
div[data-service] .c-nt{
- color: #fff;
+ color: var(--im-color);
max-width: 100%;
height: 100%;
width: 100%;
@@ -116,13 +136,10 @@ div[data-service] .c-bg::before{
right: 0;
bottom: 0;
z-index: 1;
- transition: opacity .3s ease, visibility .3s ease;
+ transition: opacity .3s ease,
+ visibility .3s ease;
background: rgb(30,56,97);
- background: linear-gradient( 14deg, rgb(12 15 23 / 95%) 10%, rgb(0 0 0 / 51%) 100%, rgba(68,77,125,0.1082983535210959) 0%);
- background: -moz-linear-gradient(14deg, rgba(30,56,97,1) 0%, rgba(206,220,233,0.1181022750897234) 100%);
- background: -webkit-linear-gradient(14deg, rgba(30,56,97,1) 0%, rgba(206,220,233,0.1181022750897234) 100%);
- background: linear-gradient(14deg, rgba(30,56,97,1) 0%, rgba(206,220,233,0.1181022750897234) 100%);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#1e3861",endColorstr="#cedce9",GradientType=1);
+ background: var(--im-overlay-bg);
}
div[data-service] .c-bg-i{
@@ -135,7 +152,8 @@ div[data-service] .c-bg-i{
right: 0;
bottom: 0;
opacity: 0;
- transition: opacity .5s ease, transform .5s ease;
+ transition: opacity .5s ease,
+ transform .5s ease;
}
div[data-service] .c-bg-i.loaded{
@@ -178,7 +196,6 @@ div[data-service] .c-n-t{
position: relative;
z-index: 1;
line-height: 1.4em;
- color: #fff;
max-width: 420px;
margin: 0 auto;
margin-bottom: 20px;
@@ -195,7 +212,9 @@ div[data-service] .c-n-a{
div[data-service] .c-t-cn{
padding: 0 12px;
- transition: opacity .3s ease, transform .3s ease, visibility .3s ease;
+ transition: opacity .3s ease,
+ transform .3s ease,
+ visibility .3s ease;
}
div[data-service] .c-n-c .c-la-b,
@@ -206,10 +225,10 @@ div[data-service] .c-n-c .c-l-b{
gap: 8px;
position: relative;
padding: 1em;
- background: rgba(0, 102, 219, 0.84);
+ background: var(--im-btn-bg);
border-radius: 4px;
font-size: .85em;
- color: #ffffff;
+ color: var(--im-btn-color);
font-weight: 600;
box-shadow: rgba(0, 0, 0, 0.19) 0px 4px 12px;
transition: opacity .3s ease,
@@ -223,7 +242,7 @@ div[data-service] .c-n-c .c-l-b{
div[data-service] .c-n-c .c-l-b::before{
content: '';
display: block;
- border-left: 12px solid white;
+ border-left: 12px solid var(--im-btn-color);
border-top: 7.5px solid transparent;
border-bottom: 7.5px solid transparent;
}
@@ -239,7 +258,7 @@ div[data-service] .c-n-c .c-la-b:hover{
}
div[data-service] .c-n-c .c-l-b:hover{
- background: rgba(9, 80, 161, 0.89);
+ background: var(--im-btn-hover-bg);
}
div[data-service] .c-n-c .c-la-b:active{
From 5282f09d1ffadc2149f9ebf69bee7b35d4e68bd4 Mon Sep 17 00:00:00 2001
From: Orest Bida
Date: Fri, 9 Dec 2022 23:31:56 +0100
Subject: [PATCH 12/53] Rebuild dist files
---
dist/iframemanager.css | 2 +-
dist/iframemanager.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dist/iframemanager.css b/dist/iframemanager.css
index 851f56e..946e588 100644
--- a/dist/iframemanager.css
+++ b/dist/iframemanager.css
@@ -1 +1 @@
-div[data-service] *,div[data-service] :after,div[data-service] :before{background:none;border:none;box-shadow:none;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;float:none;font-family:inherit;font-size:1em;font-style:inherit;font-variant:normal;font-weight:inherit;letter-spacing:unset;line-height:1.2;margin:0;padding:0;text-align:left;text-decoration:none;text-transform:none}div[data-service] .c-ld{bottom:2em;opacity:0;right:2.5em;transform:translateY(10px);transition:opacity .3s ease,visibility .3s ease,transform .3s ease;visibility:hidden}div[data-service] .c-ld,div[data-service] .c-ld:after{border-radius:100%;height:20px;position:absolute;width:20px;z-index:1}div[data-service] .c-ld:after{animation:spin 1s linear infinite;border:4px solid #fff;border-top-color:transparent;content:""}div[data-service].c-h-n .c-ld{opacity:1;transform:translateY(0);visibility:visible}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}div[data-service]{background-color:#0b1016;display:inline-block;font-family:inherit;font-size:medium;max-width:100%;min-height:150px;min-width:300px;overflow:hidden;position:relative}div[data-service] button,div[data-service] h1,div[data-service] h2,div[data-service] h3,div[data-service] input,div[data-service] label{animation:none;transition:none}div[data-service]:before{content:"";display:block;padding-top:56.25%}div[data-autoscale]{height:auto;width:100%}div[data-service] .c-nt{bottom:0;color:#fff;height:100%;left:0;max-width:100%;position:absolute;right:0;top:0;transition:opacity .3s ease,visibility .3s ease;width:100%;z-index:2}div[data-service] .c-bg{opacity:.5;transition:opacity .3s ease,visibility .3s ease,transform .3s ease}div[data-service] .c-bg,div[data-service] .c-bg:before{bottom:0;left:0;position:absolute;right:0;top:0;z-index:1}div[data-service] .c-bg:before{background:#1e3861;background:linear-gradient(14deg,rgba(12,15,23,.95) 10%,rgba(0,0,0,.51) 100%,rgba(68,77,125,.108) 0);background:-moz-linear-gradient(14deg,#1e3861 0,rgba(206,220,233,.118) 100%);background:-webkit-linear-gradient(14deg,#1e3861,rgba(206,220,233,.118));background:linear-gradient(14deg,#1e3861,rgba(206,220,233,.118));content:"";filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#1e3861",endColorstr="#cedce9",GradientType=1);transition:opacity .3s ease,visibility .3s ease}div[data-service] .c-bg-i{background-position:50%;background-repeat:no-repeat;background-size:cover;bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;transition:opacity .5s ease,transform .5s ease}div[data-service] .c-bg-i.loaded{opacity:1}div[data-service] .c-tl{display:block;font-size:1.2em;font-weight:600;margin-bottom:10px;text-align:center}div[data-service].c-h-n .c-bg{opacity:1;transform:scale(1)}div[data-service].c-h-n .c-nt{opacity:0;visibility:hidden}div[data-service] .c-n-c{display:table;font-size:.9em;height:100%;margin:0;position:relative;transition:background-color .3s ease,opacity .3s ease;width:100%;z-index:1}div[data-service] .c-n-t{color:#fff;display:block;font-size:.95em;line-height:1.4em;margin:0 auto 20px;max-width:420px;position:relative;z-index:1}div[data-service] .c-n-a,div[data-service] .c-n-t{text-align:center}div[data-service] .c-t-cn{display:table-cell;padding:0 12px;transition:opacity .3s ease,transform .3s ease,visibility .3s ease;vertical-align:middle}div[data-service] .c-n-c .c-l-b,div[data-service] .c-n-c .c-la-b{background:rgba(0,102,219,.84);border:none;border-radius:.25em;box-shadow:0 4px 12px rgba(0,0,0,.19);color:#fff;cursor:pointer;display:inline-block;font-size:.85em;font-weight:600;margin:0 auto;padding:1em 1em 1em 2.8em;position:relative;transition:opacity .3s ease,transform .3s cubic-bezier(.25,1,.5,1),visibility .3s ease,box-shadow .3s ease,background-color .3s ease;vertical-align:middle}div[data-service] .c-n-c .c-l-b:before{border-bottom:7.5px solid transparent;border-left:12px solid #fff;border-top:7.5px solid transparent;content:"";display:block;height:0;left:1.1em;position:absolute;top:50%;transform:translateY(-50%);z-index:2}div[data-service] .c-n-c .c-la-b{background:rgba(225,239,255,.8);color:#0d1f34;margin-left:1em;padding:1em}div[data-service] .c-n-c .c-la-b:hover{background:rgba(225,239,255,.95)}div[data-service] .c-n-c .c-l-b:hover{background:rgba(9,80,161,.89)}div[data-service] .c-n-c .c-la-b:active{background:rgba(225,239,255,.6);transition:none}div[data-service] .c-n-c .c-l-b:active{box-shadow:0 0 0 4px rgba(24,104,250,.24);transition:none}div[data-service].c-h-n .c-t-cn{opacity:0;transform:translateY(-10px);visibility:hidden}div[data-service] iframe{background:#fff;border:none;bottom:0;display:block;height:100%;left:0;max-width:100%;opacity:0;position:absolute;right:0;top:0;transition:opacity .5s ease;visibility:hidden;width:100%;z-index:2}div[data-service].c-h-b iframe{opacity:1;transform:scale(1);transition-delay:.1s;visibility:visible}div[data-service] .c-n-t a{border-bottom:1px solid #5fb3fb;color:#5fb3fb;text-decoration:none}div[data-service] .c-n-t a:hover{border-color:transparent}div[data-service][data-ratio="1:1"]:before{padding-top:100%}div[data-service][data-ratio="2:1"]:before{padding-top:50%}div[data-service][data-ratio="3:2"]:before{padding-top:66.666666%}div[data-service][data-ratio="5:2"]:before{padding-top:40%}div[data-service][data-ratio="4:3"]:before{padding-top:75%}div[data-service][data-ratio="16:9"]:before{padding-top:56.25%}div[data-service][data-ratio="16:10"]:before{padding-top:62.5%}div[data-service][data-ratio="20:9"]:before{padding-top:45%}div[data-service][data-ratio="21:9"]:before{padding-top:42.857142%}div[data-service][data-ratio="9:16"]:before{padding-top:177.777777%}div[data-service][data-ratio="9:20"]:before{padding-top:222.222222%}div[data-customwidget]:before{display:none}div[data-customwidget].c-h-b{background:transparent}div[data-customwidget].c-h-b .c-ld{opacity:0;visibility:hidden}div[data-customwidget]>div{margin:0!important}div[data-customwidget]{min-width:296px;transition:background-color .3s ease;transition-delay:.3s;vertical-align:top}
\ No newline at end of file
+:root{--im-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";--im-color:#fff;--im-bg:#0b1016;--im-btn-color:#fff;--im-btn-hover-color:#fff;--im-btn-bg:rgba(0,102,219,.84);--im-btn-hover-bg:rgba(9,80,161,.89);--im-overlay-bg:linear-gradient(14deg,#1e3861,rgba(206,220,233,.118))}div[data-service],div[data-service] :after,div[data-service] :before,div[data-service] a,div[data-service] button,div[data-service] span{all:unset;box-sizing:border-box}div[data-service] a,div[data-service] button,div[data-service] input{-webkit-appearance:none;appearance:none;cursor:pointer;font-family:inherit;font-size:100%;line-height:normal;margin:0;outline:revert;outline-offset:2px;overflow:hidden}div[data-service]{background-color:#0b1016;background-color:var(--im-bg);display:inline-block;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;font-family:var(--im-font-family);font-size:16px;font-weight:400;max-width:100%;min-height:150px;min-width:300px;overflow:hidden;position:relative}div[data-service]:before{content:"";display:block;padding-top:56.25%}div[data-service] .c-ld{bottom:2em;opacity:0;right:2.5em;transform:translateY(10px);transition:opacity .3s ease,visibility .3s ease,transform .3s ease;visibility:hidden}div[data-service] .c-ld,div[data-service] .c-ld:after{border-radius:100%;height:20px;position:absolute;width:20px;z-index:1}div[data-service] .c-ld:after{animation:spin 1s linear infinite;border:4px solid #fff;border-top-color:transparent;content:""}div[data-service].c-h-n .c-ld{opacity:1;transform:translateY(0);visibility:visible}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}div[data-autoscale]{height:auto;width:100%}div[data-service] .c-nt{bottom:0;color:#fff;color:var(--im-color);height:100%;left:0;max-width:100%;position:absolute;right:0;top:0;transition:opacity .3s ease,visibility .3s ease;width:100%;z-index:2}div[data-service] .c-bg{opacity:.5;transition:opacity .3s ease,visibility .3s ease,transform .3s ease}div[data-service] .c-bg,div[data-service] .c-bg:before{bottom:0;left:0;position:absolute;right:0;top:0;z-index:1}div[data-service] .c-bg:before{background:#1e3861;background:linear-gradient(14deg,#1e3861,rgba(206,220,233,.118));background:var(--im-overlay-bg);content:"";transition:opacity .3s ease,visibility .3s ease}div[data-service] .c-bg-i{background-position:50%;background-repeat:no-repeat;background-size:cover;bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;transition:opacity .5s ease,transform .5s ease}div[data-service] .c-bg-i.loaded{opacity:1}div[data-service] .c-tl{display:block;font-size:1.2em;font-weight:600;margin-bottom:10px;text-align:center}div[data-service].c-h-n .c-bg{opacity:1;transform:scale(1)}div[data-service].c-h-n .c-nt{opacity:0;visibility:hidden}div[data-service] .c-n-c{align-items:center;display:flex;font-size:.9em;height:100%;justify-content:center;position:relative;transition:background-color .3s ease,opacity .3s ease;z-index:1}div[data-service] .c-n-t{display:block;font-size:.95em;line-height:1.4em;margin:0 auto 20px;max-width:420px;position:relative;z-index:1}div[data-service] .c-n-a,div[data-service] .c-n-t{align-items:center;display:flex;gap:12px;justify-content:center;text-align:center}div[data-service] .c-t-cn{padding:0 12px;transition:opacity .3s ease,transform .3s ease,visibility .3s ease}div[data-service] .c-n-c .c-l-b,div[data-service] .c-n-c .c-la-b{align-items:center;background:rgba(0,102,219,.84);background:var(--im-btn-bg);border-radius:4px;box-shadow:0 4px 12px rgba(0,0,0,.19);color:#fff;color:var(--im-btn-color);display:flex;font-size:.85em;font-weight:600;gap:8px;justify-content:space-evenly;padding:1em;position:relative;transition:opacity .3s ease,transform .3s cubic-bezier(.25,1,.5,1),visibility .3s ease,box-shadow .3s ease,background-color .3s ease}div[data-service] .c-n-c .c-l-b:before{border-bottom:7.5px solid transparent;border-left:12px solid #fff;border-left:12px solid var(--im-btn-color);border-top:7.5px solid transparent;content:"";display:block}div[data-service] .c-n-c .c-la-b{background:rgba(225,239,255,.8);color:#0d1f34;padding:1em}div[data-service] .c-n-c .c-la-b:hover{background:rgba(225,239,255,.95)}div[data-service] .c-n-c .c-l-b:hover{background:rgba(9,80,161,.89);background:var(--im-btn-hover-bg)}div[data-service] .c-n-c .c-la-b:active{background:rgba(225,239,255,.6);transition:none}div[data-service] .c-n-c .c-l-b:active{box-shadow:0 0 0 4px rgba(24,104,250,.24);transition:none}div[data-service].c-h-n .c-t-cn{opacity:0;transform:translateY(-10px);visibility:hidden}div[data-service] iframe{background:#fff;border:none;bottom:0;display:block;height:100%;left:0;max-width:100%;opacity:0;position:absolute;right:0;top:0;transition:opacity .5s ease;visibility:hidden;width:100%;z-index:2}div[data-service].c-h-b iframe{opacity:1;transform:scale(1);transition-delay:.1s;visibility:visible}div[data-service] .c-n-t a{border-bottom:1px solid #5fb3fb;color:#5fb3fb;text-decoration:none}div[data-service] .c-n-t a:hover{border-color:transparent}div[data-service][data-ratio="1:1"]:before{padding-top:100%}div[data-service][data-ratio="2:1"]:before{padding-top:50%}div[data-service][data-ratio="3:2"]:before{padding-top:66.666666%}div[data-service][data-ratio="5:2"]:before{padding-top:40%}div[data-service][data-ratio="4:3"]:before{padding-top:75%}div[data-service][data-ratio="16:9"]:before{padding-top:56.25%}div[data-service][data-ratio="16:10"]:before{padding-top:62.5%}div[data-service][data-ratio="20:9"]:before{padding-top:45%}div[data-service][data-ratio="21:9"]:before{padding-top:42.857142%}div[data-service][data-ratio="9:16"]:before{padding-top:177.777777%}div[data-service][data-ratio="9:20"]:before{padding-top:222.222222%}div[data-customwidget]:before{display:none}div[data-customwidget].c-h-b{background:transparent}div[data-customwidget].c-h-b .c-ld{opacity:0;visibility:hidden}div[data-customwidget]>div{margin:0!important}div[data-customwidget]{min-width:296px;transition:background-color .3s ease;transition-delay:.3s;vertical-align:top}
\ No newline at end of file
diff --git a/dist/iframemanager.js b/dist/iframemanager.js
index eca45f0..92f92f4 100644
--- a/dist/iframemanager.js
+++ b/dist/iframemanager.js
@@ -3,4 +3,4 @@
* Author Orest Bida
* Released under the MIT License
*/
-!function(){'use strict';var n={},i=[],t=[],r=!1,o='',e=null,c=[],a=document,f=['onload','onerror','src'];function u(n){var i=n.dataset,t={};for(var r in i)0===r.lastIndexOf('iframe')&&(t[r.slice(6).toLowerCase()]=i[r]);return{i:i.id,t:i.title,o:i.thumbnail,u:i.params,v:'thumbnailpreload'in i,l:'autoscale'in i,p:n,m:null,h:!1,_:!1,g:!0,I:t}}function v(i,t){var r=n[i];if('IntersectionObserver'in window){var o=new IntersectionObserver((function(n){n.forEach((function(n){n.isIntersecting&&(s(t,r[n.target.dataset.index]),o.unobserve(n.target))}))}));r.forEach((function(n){o.observe(n.p)}))}else for(var e=0;e0?i.hasOwnProperty(o)?o:h(i)[0]:void 0},T={acceptService:function(n){if(r=!1,'all'===n)for(var i=c.length,t=0;t-1&&o(n,e[n]);function o(n,i){m(i.cookie.name)||function(n){var i=new Date,t=n.path||'/',r=n.expiration||182,o=n.sameSite||'Lax',e=n.domain||location.hostname;i.setTime(i.getTime()+24*r*60*60*1e3);var c=' expires='+i.toUTCString(),f=n.name+'=1;'+c+'; Path='+t+';';f+=' SameSite='+o+';',e.indexOf('.')>-1&&(f+=' Domain='+e+';'),'https:'===location.protocol&&(f+=' Secure;'),a.cookie=f}(i.cookie),k(n,i)}},rejectService:function(i){if('all'===i){r=!0;for(var t=c.length,o=0;o-1&&f(i,e[i]);function f(i,t){var r,o,e;m(t.cookie.name)&&(o=(r=t.cookie).path||'/',e=r.domain||location.hostname,a.cookie=r.name+'=; Path='+o+'; Domain='+e+'; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'),function(i,t){for(var r,o,e=n[i],c=e.length,a=0;a0?i.hasOwnProperty(o)?o:p(i)[0]:void 0},T={acceptService:function(n){if(r=!1,'all'===n)for(var i=c.length,t=0;t-1&&o(n,e[n]);function o(n,i){h(i.cookie.name)||function(n){var i=new Date,t=n.path||'/',r=n.expiration||182,o=n.sameSite||'Lax',e=n.domain||location.hostname;i.setTime(i.getTime()+24*r*60*60*1e3);var c=' expires='+i.toUTCString(),f=n.name+'=1;'+c+'; Path='+t+';';f+=' SameSite='+o+';',e.indexOf('.')>-1&&(f+=' Domain='+e+';'),'https:'===location.protocol&&(f+=' Secure;'),a.cookie=f}(i.cookie),k(n,i)}},rejectService:function(i){if('all'===i){r=!0;for(var t=c.length,o=0;o-1&&f(i,e[i]);function f(i,t){var r,o,e;h(t.cookie.name)&&(o=(r=t.cookie).path||'/',e=r.domain||location.hostname,a.cookie=r.name+'=; Path='+o+'; Domain='+e+'; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'),function(i,t){for(var r,o,e=n[i],c=e.length,a=0;a
Date: Fri, 9 Dec 2022 23:57:21 +0100
Subject: [PATCH 13/53] Minor tweak: make buttons optional
---
dist/iframemanager.js | 2 +-
src/iframemanager.js | 106 ++++++++++++++++++++++--------------------
2 files changed, 56 insertions(+), 52 deletions(-)
diff --git a/dist/iframemanager.js b/dist/iframemanager.js
index 92f92f4..a7ced3a 100644
--- a/dist/iframemanager.js
+++ b/dist/iframemanager.js
@@ -3,4 +3,4 @@
* Author Orest Bida
* Released under the MIT License
*/
-!function(){'use strict';var n={},i=[],t=[],r=!1,o='',e=null,c=[],a=document,f=['onload','onerror','src'];function u(n){var i=n.dataset,t={};for(var r in i)0===r.lastIndexOf('iframe')&&(t[r.slice(6).toLowerCase()]=i[r]);return{i:i.id,t:i.title,o:i.thumbnail,u:i.params,v:'thumbnailpreload'in i,l:'autoscale'in i,m:n,h:null,p:!1,_:!1,g:!0,I:t}}function v(i,t){var r=n[i];if('IntersectionObserver'in window){var o=new IntersectionObserver((function(n){n.forEach((function(n){n.isIntersecting&&(s(t,r[n.target.dataset.index]),o.unobserve(n.target))}))}));r.forEach((function(n){o.observe(n.m)}))}else for(var e=0;e0?i.hasOwnProperty(o)?o:p(i)[0]:void 0},T={acceptService:function(n){if(r=!1,'all'===n)for(var i=c.length,t=0;t-1&&o(n,e[n]);function o(n,i){h(i.cookie.name)||function(n){var i=new Date,t=n.path||'/',r=n.expiration||182,o=n.sameSite||'Lax',e=n.domain||location.hostname;i.setTime(i.getTime()+24*r*60*60*1e3);var c=' expires='+i.toUTCString(),f=n.name+'=1;'+c+'; Path='+t+';';f+=' SameSite='+o+';',e.indexOf('.')>-1&&(f+=' Domain='+e+';'),'https:'===location.protocol&&(f+=' Secure;'),a.cookie=f}(i.cookie),k(n,i)}},rejectService:function(i){if('all'===i){r=!0;for(var t=c.length,o=0;o-1&&f(i,e[i]);function f(i,t){var r,o,e;h(t.cookie.name)&&(o=(r=t.cookie).path||'/',e=r.domain||location.hostname,a.cookie=r.name+'=; Path='+o+'; Domain='+e+'; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'),function(i,t){for(var r,o,e=n[i],c=e.length,a=0;a0?i.hasOwnProperty(o)?o:p(i)[0]:void 0},D={acceptService:function(n){if(r=!1,'all'===n)for(var i=c.length,t=0;t-1&&o(n,e[n]);function o(n,i){h(i.cookie.name)||function(n){var i=new Date,t=n.path||'/',r=n.expiration||182,o=n.sameSite||'Lax',e=n.domain||location.hostname;i.setTime(i.getTime()+24*r*60*60*1e3);var c=' expires='+i.toUTCString(),f=n.name+'=1;'+c+'; Path='+t+';';f+=' SameSite='+o+';',e.indexOf('.')>-1&&(f+=' Domain='+e+';'),'https:'===location.protocol&&(f+=' Secure;'),a.cookie=f}(i.cookie),T(n,i)}},rejectService:function(i){if('all'===i){r=!0;for(var t=c.length,o=0;o-1&&f(i,e[i]);function f(i,t){var r,o,e;h(t.cookie.name)&&(o=(r=t.cookie).path||'/',e=r.domain||location.hostname,a.cookie=r.name+'=; Path='+o+'; Domain='+e+'; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'),function(i,t){for(var r,o,e=n[i],c=e.length,a=0;a
Date: Sat, 10 Dec 2022 14:41:10 +0100
Subject: [PATCH 14/53] Update Readme.md: add config. example for `Google Maps`
(close #9)
---
README.md | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 82 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index fc40bb0..312ff39 100644
--- a/README.md
+++ b/README.md
@@ -475,7 +475,88 @@ Both `acceptService` and `rejectService` work the same way:
```
-- More "presets" for other service to come ...
+- How to embed google maps
+
+
+ - With API key
+
+
+ ```javascript
+ manager.run({
+ currLang: 'en',
+ services : {
+ googlemaps : {
+ embedUrl: 'https://www.google.com/maps/embed/v1/place?key=API_KEY&q={data-id}',
+ iframe: {
+ allow : 'picture-in-picture; fullscreen;'
+ },
+ cookie: {
+ name: 'cc_maps'
+ },
+ languages : {
+ en : {
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of Google Maps.',
+ loadBtn: 'Load map',
+ loadAllBtn: 'Don\'t ask again'
+ }
+ }
+ }
+ }
+ });
+ ```
+
+ Example usage:
+ ```html
+
+ ```
+
+
+
+ - Without API key
+
+
+ ```javascript
+ manager.run({
+ currLang: 'en',
+ services : {
+ googlemaps : {
+ embedUrl: 'https://www.google.com/maps/embed?pb={data-id}',
+ iframe: {
+ allow : 'picture-in-picture; fullscreen;'
+ },
+ cookie: {
+ name: 'cc_maps'
+ },
+ languages : {
+ en : {
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of Google Maps.',
+ loadBtn: 'Load map',
+ loadAllBtn: 'Don\'t ask again'
+ }
+ }
+ }
+ }
+ });
+ ```
+
+ Example usage:
+ ```html
+
+ ```
+
+
+
+
+
+
### Available `data-ratio`
From 8d81a9a6fedd823406e447a95b8fdefdccc30c69 Mon Sep 17 00:00:00 2001
From: Orest Bida
Date: Sat, 10 Dec 2022 16:48:22 +0100
Subject: [PATCH 15/53] Update demo files
---
demo/app.js | 57 +++--------------
demo/index.html | 163 +++++++++++++++++++++++++-----------------------
2 files changed, 95 insertions(+), 125 deletions(-)
diff --git a/demo/app.js b/demo/app.js
index 45f84ae..0e8f0e0 100644
--- a/demo/app.js
+++ b/demo/app.js
@@ -22,17 +22,21 @@
const isIframe = type === 'iframe';
- const timeout = isIframe
+ const timeout = isIframe
? 100
: 10;
const maxWait = 500;
- const objToCheck = prop
- ? obj[prop]
+ const objToCheck = prop
+ ? obj[prop]
: obj;
-
- const isDefined = () => typeof (isIframe && obj.querySelector(selector) || objToCheck) !== 'undefined'
+
+ const isDefined = () => typeof
+ (isIframe
+ ? obj.querySelector(selector)
+ : objToCheck
+ ) !== 'undefined'
let nIntervals = 0;
@@ -158,7 +162,7 @@
languages : {
'en' : {
notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of twitch.com.',
- loadBtn: 'Load video',
+ loadBtn: 'Load post',
loadAllBtn: 'Don\'t ask again'
}
}
@@ -182,47 +186,6 @@
}
},
- facebook : {
- embedUrl : "https://www.facebook.com/",
-
- onAccept: function(div, callback){
-
- var fbVideo = document.createElement('div');
- fbVideo.className = "fb-post";
- fbVideo.setAttribute('data-href', this.embedUrl + div.dataset.id);
- fbVideo.setAttribute('data-width', 'auto');
- div.appendChild(fbVideo);
-
- CookieConsent.loadScript('https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v11.0').then(() => {
- var c = document.querySelector(`[data-id="${div.dataset.id}"`).lastChild;
- FB.XFBML.parse(document.querySelector(`[data-id="${div.dataset.id}"`));
-
- manager.observe(fbVideo, function(iframe){
- console.log("wwwaaaa", iframe);
- callback(iframe)
- });
-
- //FB.XFBML.parse(document.querySelector(`[data-id="${div.dataset.id}"`));
-
- });
- },
-
- onReject: function(iframe){
- iframe.parentNode.parentNode.remove();
- },
-
- cookie : {
- name : 'cc_facebook'
- },
-
- languages : {
- 'en' : {
- notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of twitter.com.',
- loadBtn: 'Load tweet',
- loadAllBtn: 'Don\'t ask again'
- }
- }
- }
}
});
diff --git a/demo/index.html b/demo/index.html
index cf7fd35..f4e338f 100644
--- a/demo/index.html
+++ b/demo/index.html
@@ -1,59 +1,115 @@
-
-
Test youtube videos cookie blocker
+
-
-
+
This is a test page
-
Demo with youtube & dailymotion config.
+
Demo with youtube & dailymotion config.
Accept all
Reject all
+
+
+
+
Youtube
-
Simple example
-
-
-
-
-
Example with autoscale width (fill width of parent container)
-
-
+
+
Youtube embed (autoscale)
+
+
+ data-autoscale>
+
+
+
+
+
Youtube embed (autoscale, thumbnail & params)
+
+
+
+
+
+
Daily motion
+
+
-
+
+
+
Google Maps
+
+
+
+
+
+
Twitter tweets
+
Example with autoscale width (fill width of parent container)
data-customwidget
style="height: 285px;">
-
-
-
Example with custom thumbnail + params (video starts muted at 21s)
-
-
-
-
-
-
Daily motion video
-
-
-
-
+
Facebook post
-
-
-
-
-
Google Maps
-
-
-
-
-
-
Twitch channel embed
-
-
+
Twitch channel embed
+
+
@@ -153,7 +160,7 @@
Twitch channel embed
Ciao
-
+
\ No newline at end of file
From 71178e130a63a041f513ccc76c5d10a974402d6e Mon Sep 17 00:00:00 2001
From: Orest Bida
Date: Sat, 10 Dec 2022 16:53:01 +0100
Subject: [PATCH 16/53] Minor tweaks, code refactoring
---
src/iframemanager.css | 36 ++++++++++++------------------------
1 file changed, 12 insertions(+), 24 deletions(-)
diff --git a/src/iframemanager.css b/src/iframemanager.css
index 3caf3a1..4d592d7 100644
--- a/src/iframemanager.css
+++ b/src/iframemanager.css
@@ -9,15 +9,13 @@
--im-btn-bg: rgba(0, 102, 219, 0.84);
--im-btn-hover-bg: rgba(9, 80, 161, 0.89);
- --im-overlay-bg: linear-gradient(
- 14deg,
- rgba(30,56,97,1) 0%,
- rgba(206,220,233,0.1181022750897234) 100%
- )
+ --im-overlay-bg: linear-gradient(14deg, rgba(30,56,97,1) 0%, rgba(206,220,233,0.118) 100%)
}
div[data-service],
+div[data-service] div,
div[data-service] span,
+div[data-service] iframe,
div[data-service] a,
div[data-service] button,
div[data-service] ::before,
@@ -125,7 +123,9 @@ div[data-service] .c-bg{
left: 0;
opacity: .5;
z-index: 1;
- transition: opacity .3s ease, visibility .3s ease, transform .3s ease;
+ transition: opacity .3s ease,
+ visibility .3s ease,
+ transform .3s ease;
}
div[data-service] .c-bg::before{
@@ -136,10 +136,10 @@ div[data-service] .c-bg::before{
right: 0;
bottom: 0;
z-index: 1;
- transition: opacity .3s ease,
- visibility .3s ease;
background: rgb(30,56,97);
background: var(--im-overlay-bg);
+ transition: opacity .3s ease,
+ visibility .3s ease;
}
div[data-service] .c-bg-i{
@@ -245,6 +245,9 @@ div[data-service] .c-n-c .c-l-b::before{
border-left: 12px solid var(--im-btn-color);
border-top: 7.5px solid transparent;
border-bottom: 7.5px solid transparent;
+ background-position: center;
+ background-repeat: no-repeat;
+ background-size: contain;
}
div[data-service] .c-n-c .c-la-b{
@@ -379,19 +382,4 @@ div[data-customwidget]{
min-width: 296px;
transition: background-color .3s ease;
transition-delay: .3s;
-}
-
-/* div[data-service="twitter"] .c-n-c .c-l-b{
- background-color: #1DA1F2;
-}
-
-div[data-service="twitter"] .c-n-c .c-l-b::before{
- border: none;
- height: 15px;
- width: 15px;
- background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAATZJREFUOE+lk78rRWEcxj/PJhmUMhhkkMEgGyZSlCR27qRYFItRXWVQJsVm8A8w3GSQUpTcYlCUzXAzKPEnPHp1zunc0znXkW+9y/s+30/P98cr/hkqk2+7E1gA2oG6pIeQZ3v6B2B7T9JmHsz2LHAA9KXeq8AUsCTbE8AVcAGsS3pJg2zXgLkM/Bm4BL7SgKB5B3aBm5RNF5RZlbQdl3AHjGSET8AtsFIAGJVUDw76gS0gwCplmhppuiR9xg7OgZk/JDck9QZ9DJgEdoCxkpCapPk0YBA4jJJ7gIFfQOOSrhNAtAvLwFEJB/uSNmJd0ybaDk5CGWvAcA7sMeyEpEYTwHY3EJqyCCT0DOAUWJX0kb4PYwzzD3tQFCfAsaSzPEFSgu0OYCg6bcAb8CrpvlVfSv3GVoBvLzlh7eQqydQAAAAASUVORK5CYII=')
-}
-
-.fb_iframe_widget_fluid span{
- width: 100%!important;
-} */
\ No newline at end of file
+}
\ No newline at end of file
From 349da442e42ffdc781c85fa92b52d370e1c022f1 Mon Sep 17 00:00:00 2001
From: Orest Bida
Date: Sat, 10 Dec 2022 16:53:44 +0100
Subject: [PATCH 17/53] Improve iframe attributes via `data-iframe`
---
src/iframemanager.js | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/iframemanager.js b/src/iframemanager.js
index 3ec26d4..afa07a4 100644
--- a/src/iframemanager.js
+++ b/src/iframemanager.js
@@ -97,17 +97,20 @@
*/
function getVideoProp(div){
- var dataset = div.dataset;
- var attrs = {};
+ const dataset = div.dataset;
+
+ const iframeAttrs = {};
+ const iframeAttrSelector = 'data-iframe-';
+
+ const iframeAttrNames = div.getAttributeNames()
+ .filter(attr => attr.slice(0, 12) === iframeAttrSelector)
+ .map(attr => attr.slice(12));
/**
* Get all "data-iframe-* attributes
*/
- for(var prop in dataset){
- if(prop.lastIndexOf('iframe') === 0){
- attrs[prop.slice(6).toLowerCase()] = dataset[prop];
- }
- }
+ for(const attrName of iframeAttrNames)
+ iframeAttrs[attrName] = div.getAttribute(iframeAttrSelector + attrName);
return {
_id: dataset.id,
@@ -121,7 +124,7 @@
_hasIframe: false,
_hasNotice: false,
_showNotice : true,
- _iframeAttributes: attrs
+ _iframeAttributes: iframeAttrs
};
};
From 0bfb5ec84db30ce3cf6f7f85ae78184110ab9977 Mon Sep 17 00:00:00 2001
From: Orest Bida
Date: Sat, 10 Dec 2022 16:54:01 +0100
Subject: [PATCH 18/53] Rebuild dist files
---
dist/iframemanager.css | 2 +-
dist/iframemanager.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dist/iframemanager.css b/dist/iframemanager.css
index 946e588..a6b9799 100644
--- a/dist/iframemanager.css
+++ b/dist/iframemanager.css
@@ -1 +1 @@
-:root{--im-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";--im-color:#fff;--im-bg:#0b1016;--im-btn-color:#fff;--im-btn-hover-color:#fff;--im-btn-bg:rgba(0,102,219,.84);--im-btn-hover-bg:rgba(9,80,161,.89);--im-overlay-bg:linear-gradient(14deg,#1e3861,rgba(206,220,233,.118))}div[data-service],div[data-service] :after,div[data-service] :before,div[data-service] a,div[data-service] button,div[data-service] span{all:unset;box-sizing:border-box}div[data-service] a,div[data-service] button,div[data-service] input{-webkit-appearance:none;appearance:none;cursor:pointer;font-family:inherit;font-size:100%;line-height:normal;margin:0;outline:revert;outline-offset:2px;overflow:hidden}div[data-service]{background-color:#0b1016;background-color:var(--im-bg);display:inline-block;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;font-family:var(--im-font-family);font-size:16px;font-weight:400;max-width:100%;min-height:150px;min-width:300px;overflow:hidden;position:relative}div[data-service]:before{content:"";display:block;padding-top:56.25%}div[data-service] .c-ld{bottom:2em;opacity:0;right:2.5em;transform:translateY(10px);transition:opacity .3s ease,visibility .3s ease,transform .3s ease;visibility:hidden}div[data-service] .c-ld,div[data-service] .c-ld:after{border-radius:100%;height:20px;position:absolute;width:20px;z-index:1}div[data-service] .c-ld:after{animation:spin 1s linear infinite;border:4px solid #fff;border-top-color:transparent;content:""}div[data-service].c-h-n .c-ld{opacity:1;transform:translateY(0);visibility:visible}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}div[data-autoscale]{height:auto;width:100%}div[data-service] .c-nt{bottom:0;color:#fff;color:var(--im-color);height:100%;left:0;max-width:100%;position:absolute;right:0;top:0;transition:opacity .3s ease,visibility .3s ease;width:100%;z-index:2}div[data-service] .c-bg{opacity:.5;transition:opacity .3s ease,visibility .3s ease,transform .3s ease}div[data-service] .c-bg,div[data-service] .c-bg:before{bottom:0;left:0;position:absolute;right:0;top:0;z-index:1}div[data-service] .c-bg:before{background:#1e3861;background:linear-gradient(14deg,#1e3861,rgba(206,220,233,.118));background:var(--im-overlay-bg);content:"";transition:opacity .3s ease,visibility .3s ease}div[data-service] .c-bg-i{background-position:50%;background-repeat:no-repeat;background-size:cover;bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;transition:opacity .5s ease,transform .5s ease}div[data-service] .c-bg-i.loaded{opacity:1}div[data-service] .c-tl{display:block;font-size:1.2em;font-weight:600;margin-bottom:10px;text-align:center}div[data-service].c-h-n .c-bg{opacity:1;transform:scale(1)}div[data-service].c-h-n .c-nt{opacity:0;visibility:hidden}div[data-service] .c-n-c{align-items:center;display:flex;font-size:.9em;height:100%;justify-content:center;position:relative;transition:background-color .3s ease,opacity .3s ease;z-index:1}div[data-service] .c-n-t{display:block;font-size:.95em;line-height:1.4em;margin:0 auto 20px;max-width:420px;position:relative;z-index:1}div[data-service] .c-n-a,div[data-service] .c-n-t{align-items:center;display:flex;gap:12px;justify-content:center;text-align:center}div[data-service] .c-t-cn{padding:0 12px;transition:opacity .3s ease,transform .3s ease,visibility .3s ease}div[data-service] .c-n-c .c-l-b,div[data-service] .c-n-c .c-la-b{align-items:center;background:rgba(0,102,219,.84);background:var(--im-btn-bg);border-radius:4px;box-shadow:0 4px 12px rgba(0,0,0,.19);color:#fff;color:var(--im-btn-color);display:flex;font-size:.85em;font-weight:600;gap:8px;justify-content:space-evenly;padding:1em;position:relative;transition:opacity .3s ease,transform .3s cubic-bezier(.25,1,.5,1),visibility .3s ease,box-shadow .3s ease,background-color .3s ease}div[data-service] .c-n-c .c-l-b:before{border-bottom:7.5px solid transparent;border-left:12px solid #fff;border-left:12px solid var(--im-btn-color);border-top:7.5px solid transparent;content:"";display:block}div[data-service] .c-n-c .c-la-b{background:rgba(225,239,255,.8);color:#0d1f34;padding:1em}div[data-service] .c-n-c .c-la-b:hover{background:rgba(225,239,255,.95)}div[data-service] .c-n-c .c-l-b:hover{background:rgba(9,80,161,.89);background:var(--im-btn-hover-bg)}div[data-service] .c-n-c .c-la-b:active{background:rgba(225,239,255,.6);transition:none}div[data-service] .c-n-c .c-l-b:active{box-shadow:0 0 0 4px rgba(24,104,250,.24);transition:none}div[data-service].c-h-n .c-t-cn{opacity:0;transform:translateY(-10px);visibility:hidden}div[data-service] iframe{background:#fff;border:none;bottom:0;display:block;height:100%;left:0;max-width:100%;opacity:0;position:absolute;right:0;top:0;transition:opacity .5s ease;visibility:hidden;width:100%;z-index:2}div[data-service].c-h-b iframe{opacity:1;transform:scale(1);transition-delay:.1s;visibility:visible}div[data-service] .c-n-t a{border-bottom:1px solid #5fb3fb;color:#5fb3fb;text-decoration:none}div[data-service] .c-n-t a:hover{border-color:transparent}div[data-service][data-ratio="1:1"]:before{padding-top:100%}div[data-service][data-ratio="2:1"]:before{padding-top:50%}div[data-service][data-ratio="3:2"]:before{padding-top:66.666666%}div[data-service][data-ratio="5:2"]:before{padding-top:40%}div[data-service][data-ratio="4:3"]:before{padding-top:75%}div[data-service][data-ratio="16:9"]:before{padding-top:56.25%}div[data-service][data-ratio="16:10"]:before{padding-top:62.5%}div[data-service][data-ratio="20:9"]:before{padding-top:45%}div[data-service][data-ratio="21:9"]:before{padding-top:42.857142%}div[data-service][data-ratio="9:16"]:before{padding-top:177.777777%}div[data-service][data-ratio="9:20"]:before{padding-top:222.222222%}div[data-customwidget]:before{display:none}div[data-customwidget].c-h-b{background:transparent}div[data-customwidget].c-h-b .c-ld{opacity:0;visibility:hidden}div[data-customwidget]>div{margin:0!important}div[data-customwidget]{min-width:296px;transition:background-color .3s ease;transition-delay:.3s;vertical-align:top}
\ No newline at end of file
+:root{--im-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";--im-color:#fff;--im-bg:#0b1016;--im-btn-color:#fff;--im-btn-hover-color:#fff;--im-btn-bg:rgba(0,102,219,.84);--im-btn-hover-bg:rgba(9,80,161,.89);--im-overlay-bg:linear-gradient(14deg,#1e3861,rgba(206,220,233,.118))}div[data-service],div[data-service] :after,div[data-service] :before,div[data-service] a,div[data-service] button,div[data-service] div,div[data-service] iframe,div[data-service] span{all:unset;box-sizing:border-box}div[data-service] a,div[data-service] button,div[data-service] input{-webkit-appearance:none;appearance:none;cursor:pointer;font-family:inherit;font-size:100%;line-height:normal;margin:0;outline:revert;outline-offset:2px;overflow:hidden}div[data-service]{background-color:#0b1016;background-color:var(--im-bg);display:inline-block;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;font-family:var(--im-font-family);font-size:16px;font-weight:400;max-width:100%;min-height:150px;min-width:300px;overflow:hidden;position:relative}div[data-service]:before{content:"";display:block;padding-top:56.25%}div[data-service] .c-ld{bottom:2em;opacity:0;right:2.5em;transform:translateY(10px);transition:opacity .3s ease,visibility .3s ease,transform .3s ease;visibility:hidden}div[data-service] .c-ld,div[data-service] .c-ld:after{border-radius:100%;height:20px;position:absolute;width:20px;z-index:1}div[data-service] .c-ld:after{animation:spin 1s linear infinite;border:4px solid #fff;border-top-color:transparent;content:""}div[data-service].c-h-n .c-ld{opacity:1;transform:translateY(0);visibility:visible}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}div[data-autoscale]{height:auto;width:100%}div[data-service] .c-nt{bottom:0;color:#fff;color:var(--im-color);height:100%;left:0;max-width:100%;position:absolute;right:0;top:0;transition:opacity .3s ease,visibility .3s ease;width:100%;z-index:2}div[data-service] .c-bg{opacity:.5;transition:opacity .3s ease,visibility .3s ease,transform .3s ease}div[data-service] .c-bg,div[data-service] .c-bg:before{bottom:0;left:0;position:absolute;right:0;top:0;z-index:1}div[data-service] .c-bg:before{background:#1e3861;background:linear-gradient(14deg,#1e3861,rgba(206,220,233,.118));background:var(--im-overlay-bg);content:"";transition:opacity .3s ease,visibility .3s ease}div[data-service] .c-bg-i{background-position:50%;background-repeat:no-repeat;background-size:cover;bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;transition:opacity .5s ease,transform .5s ease}div[data-service] .c-bg-i.loaded{opacity:1}div[data-service] .c-tl{display:block;font-size:1.2em;font-weight:600;margin-bottom:10px;text-align:center}div[data-service].c-h-n .c-bg{opacity:1;transform:scale(1)}div[data-service].c-h-n .c-nt{opacity:0;visibility:hidden}div[data-service] .c-n-c{align-items:center;display:flex;font-size:.9em;height:100%;justify-content:center;position:relative;transition:background-color .3s ease,opacity .3s ease;z-index:1}div[data-service] .c-n-t{display:block;font-size:.95em;line-height:1.4em;margin:0 auto 20px;max-width:420px;position:relative;z-index:1}div[data-service] .c-n-a,div[data-service] .c-n-t{align-items:center;display:flex;gap:12px;justify-content:center;text-align:center}div[data-service] .c-t-cn{padding:0 12px;transition:opacity .3s ease,transform .3s ease,visibility .3s ease}div[data-service] .c-n-c .c-l-b,div[data-service] .c-n-c .c-la-b{align-items:center;background:rgba(0,102,219,.84);background:var(--im-btn-bg);border-radius:4px;box-shadow:0 4px 12px rgba(0,0,0,.19);color:#fff;color:var(--im-btn-color);display:flex;font-size:.85em;font-weight:600;gap:8px;justify-content:space-evenly;padding:1em;position:relative;transition:opacity .3s ease,transform .3s cubic-bezier(.25,1,.5,1),visibility .3s ease,box-shadow .3s ease,background-color .3s ease}div[data-service] .c-n-c .c-l-b:before{background-position:50%;background-repeat:no-repeat;background-size:contain;border-bottom:7.5px solid transparent;border-left:12px solid #fff;border-left:12px solid var(--im-btn-color);border-top:7.5px solid transparent;content:"";display:block}div[data-service] .c-n-c .c-la-b{background:rgba(225,239,255,.8);color:#0d1f34;padding:1em}div[data-service] .c-n-c .c-la-b:hover{background:rgba(225,239,255,.95)}div[data-service] .c-n-c .c-l-b:hover{background:rgba(9,80,161,.89);background:var(--im-btn-hover-bg)}div[data-service] .c-n-c .c-la-b:active{background:rgba(225,239,255,.6);transition:none}div[data-service] .c-n-c .c-l-b:active{box-shadow:0 0 0 4px rgba(24,104,250,.24);transition:none}div[data-service].c-h-n .c-t-cn{opacity:0;transform:translateY(-10px);visibility:hidden}div[data-service] iframe{background:#fff;border:none;bottom:0;display:block;height:100%;left:0;max-width:100%;opacity:0;position:absolute;right:0;top:0;transition:opacity .5s ease;visibility:hidden;width:100%;z-index:2}div[data-service].c-h-b iframe{opacity:1;transform:scale(1);transition-delay:.1s;visibility:visible}div[data-service] .c-n-t a{border-bottom:1px solid #5fb3fb;color:#5fb3fb;text-decoration:none}div[data-service] .c-n-t a:hover{border-color:transparent}div[data-service][data-ratio="1:1"]:before{padding-top:100%}div[data-service][data-ratio="2:1"]:before{padding-top:50%}div[data-service][data-ratio="3:2"]:before{padding-top:66.666666%}div[data-service][data-ratio="5:2"]:before{padding-top:40%}div[data-service][data-ratio="4:3"]:before{padding-top:75%}div[data-service][data-ratio="16:9"]:before{padding-top:56.25%}div[data-service][data-ratio="16:10"]:before{padding-top:62.5%}div[data-service][data-ratio="20:9"]:before{padding-top:45%}div[data-service][data-ratio="21:9"]:before{padding-top:42.857142%}div[data-service][data-ratio="9:16"]:before{padding-top:177.777777%}div[data-service][data-ratio="9:20"]:before{padding-top:222.222222%}div[data-customwidget]:before{display:none}div[data-customwidget].c-h-b{background:transparent}div[data-customwidget].c-h-b .c-ld{opacity:0;visibility:hidden}div[data-customwidget]>div{margin:0!important}div[data-customwidget]{min-width:296px;transition:background-color .3s ease;transition-delay:.3s;vertical-align:top}
\ No newline at end of file
diff --git a/dist/iframemanager.js b/dist/iframemanager.js
index a7ced3a..9963f18 100644
--- a/dist/iframemanager.js
+++ b/dist/iframemanager.js
@@ -3,4 +3,4 @@
* Author Orest Bida
* Released under the MIT License
*/
-!function(){'use strict';var n={},i=[],t=[],r=!1,o='',e=null,c=[],a=document,f=['onload','onerror','src'];function u(n){var i=n.dataset,t={};for(var r in i)0===r.lastIndexOf('iframe')&&(t[r.slice(6).toLowerCase()]=i[r]);return{i:i.id,t:i.title,o:i.thumbnail,u:i.params,v:'thumbnailpreload'in i,l:'autoscale'in i,m:n,h:null,p:!1,_:!1,g:!0,I:t}}function v(i,t){var r=n[i];if('IntersectionObserver'in window){var o=new IntersectionObserver((function(n){n.forEach((function(n){n.isIntersecting&&(s(t,r[n.target.dataset.index]),o.unobserve(n.target))}))}));r.forEach((function(n){o.observe(n.m)}))}else for(var e=0;e0?i.hasOwnProperty(o)?o:p(i)[0]:void 0},D={acceptService:function(n){if(r=!1,'all'===n)for(var i=c.length,t=0;t-1&&o(n,e[n]);function o(n,i){h(i.cookie.name)||function(n){var i=new Date,t=n.path||'/',r=n.expiration||182,o=n.sameSite||'Lax',e=n.domain||location.hostname;i.setTime(i.getTime()+24*r*60*60*1e3);var c=' expires='+i.toUTCString(),f=n.name+'=1;'+c+'; Path='+t+';';f+=' SameSite='+o+';',e.indexOf('.')>-1&&(f+=' Domain='+e+';'),'https:'===location.protocol&&(f+=' Secure;'),a.cookie=f}(i.cookie),T(n,i)}},rejectService:function(i){if('all'===i){r=!0;for(var t=c.length,o=0;o-1&&f(i,e[i]);function f(i,t){var r,o,e;h(t.cookie.name)&&(o=(r=t.cookie).path||'/',e=r.domain||location.hostname,a.cookie=r.name+'=; Path='+o+'; Domain='+e+'; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'),function(i,t){for(var r,o,e=n[i],c=e.length,a=0;an.slice(0,12)===r)).map((n=>n.slice(12)));for(const t of o)i[t]=n.getAttribute(r+t);return{t:t.id,i:t.title,o:t.thumbnail,u:t.params,v:'thumbnailpreload'in t,l:'autoscale'in t,m:n,h:null,p:!1,_:!1,g:!0,I:i}}function v(t,i){var r=n[t];if('IntersectionObserver'in window){var o=new IntersectionObserver((function(n){n.forEach((function(n){n.isIntersecting&&(s(i,r[n.target.dataset.index]),o.unobserve(n.target))}))}));r.forEach((function(n){o.observe(n.m)}))}else for(var e=0;e0?t.hasOwnProperty(o)?o:p(t)[0]:void 0},D={acceptService:function(n){if(r=!1,'all'===n)for(var t=c.length,i=0;i-1&&o(n,e[n]);function o(n,t){h(t.cookie.name)||function(n){var t=new Date,i=n.path||'/',r=n.expiration||182,o=n.sameSite||'Lax',e=n.domain||location.hostname;t.setTime(t.getTime()+24*r*60*60*1e3);var c=' expires='+t.toUTCString(),f=n.name+'=1;'+c+'; Path='+i+';';f+=' SameSite='+o+';',e.indexOf('.')>-1&&(f+=' Domain='+e+';'),'https:'===location.protocol&&(f+=' Secure;'),a.cookie=f}(t.cookie),T(n,t)}},rejectService:function(t){if('all'===t){r=!0;for(var i=c.length,o=0;o-1&&f(t,e[t]);function f(t,i){var r,o,e;h(i.cookie.name)&&(o=(r=i.cookie).path||'/',e=r.domain||location.hostname,a.cookie=r.name+'=; Path='+o+'; Domain='+e+'; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'),function(t,i){for(var r,o,e=n[t],c=e.length,a=0;a
Date: Sun, 11 Dec 2022 02:08:39 +0100
Subject: [PATCH 19/53] Use service's name as default `cookie.name`
---
src/iframemanager.js | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/iframemanager.js b/src/iframemanager.js
index afa07a4..1b8189a 100644
--- a/src/iframemanager.js
+++ b/src/iframemanager.js
@@ -826,16 +826,23 @@
iframeDivs[serviceName].push(getVideoProp(foundDivs[j]));
}
- var currService = services[serviceName];
+ const currService = services[serviceName];
- // check if cookie for current service is set
- var cookie_name = currService.cookie.name;
+ /**
+ * Use service's name as cookie name,
+ * if no cookie.name is specified
+ */
+ const { cookie } = currService;
+ !cookie && (currService.cookie = {});
+ const cookieObj = currService.cookie;
+
+ const cookieName = cookieObj.name || `im_${serviceName}`;
+ cookieObj.name = cookieName;
- // get current service's cookie value
- var cookie = getCookie(cookie_name);
+ const cookieExists = getCookie(cookieName);
// if cookie is not set => show notice
- if(cookie){
+ if(cookieExists){
createAllNotices(serviceName, currService, true);
hideAllNotices(serviceName, currService);
}else{
From 1bf7699813b7f0b9e3c76b38fa1553507702fd39 Mon Sep 17 00:00:00 2001
From: Orest Bida
Date: Sun, 11 Dec 2022 02:10:37 +0100
Subject: [PATCH 20/53] Update demo example: cleanup & code refactoring
---
demo/app.js | 383 +++++++++++++++++++++++-------------------------
demo/index.html | 1 -
2 files changed, 180 insertions(+), 204 deletions(-)
diff --git a/demo/app.js b/demo/app.js
index 0e8f0e0..223f247 100644
--- a/demo/app.js
+++ b/demo/app.js
@@ -1,204 +1,181 @@
- 'use strict';
-
- // get module
- var manager = iframemanager();
-
- /**
- * @typedef {object} WaitConfig
- * @property {'script' | 'iframe'} type,
- * @property {any} obj
- * @property {string} [prop]
- * @property {string} [selector]
- */
-
- /**
- * Wait until a property on the window object is available
- * @param {WaitConfig} opts
- * @returns {Promise}
- */
- const waitFor = async (opts) => {
- const {obj, type, prop, selector} = opts;
-
- const isIframe = type === 'iframe';
-
- const timeout = isIframe
- ? 100
- : 10;
-
- const maxWait = 500;
-
- const objToCheck = prop
- ? obj[prop]
- : obj;
-
- const isDefined = () => typeof
- (isIframe
- ? obj.querySelector(selector)
- : objToCheck
- ) !== 'undefined'
-
- let nIntervals = 0;
-
- return await new Promise(resolve => {
- const interval = setInterval(() => {
- const timedOut = !isIframe && ++nIntervals * timeout > maxWait;
- if (isDefined() || timedOut) {
- clearInterval(interval);
- resolve(!timedOut);
- }
- }, timeout);
- });
- };
-
- manager.run({
- currLang: document.documentElement.getAttribute('lang'),
- // autoLang: true,
- services : {
- youtube : {
- embedUrl: 'https://www.youtube-nocookie.com/embed/{data-id}',
-
- iframe : {
- allow : 'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen;',
- },
- cookie : {
- name : 'cc_youtube'
- },
- languages : {
- 'en' : {
- notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of youtube.com.',
- loadBtn: 'Load video',
- loadAllBtn: 'Don\'t ask again'
- }
- }
- },
- dailymotion : {
- embedUrl: 'https://www.dailymotion.com/embed/video/{data-id}',
-
- // Use dailymotion api to obtain thumbnail
- thumbnailUrl: function(id, setThumbnail){
-
- var url = "https://api.dailymotion.com/video/" + id + "?fields=thumbnail_large_url";
- var xhttp = new XMLHttpRequest();
-
- xhttp.onreadystatechange = function() {
- if (this.readyState == 4 && this.status == 200) {
- var src = JSON.parse(this.response).thumbnail_large_url;
- setThumbnail(src);
- }
- };
-
- xhttp.open("GET", url, true);
- xhttp.send();
- },
- iframe : {
- allow : 'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen;'
- },
- cookie : {
- name : 'cc_dailymotion'
- },
- languages : {
- 'en' : {
- notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of dailymotion.com.',
- loadBtn: 'Load video',
- loadAllBtn: 'Don\'t ask again'
-
- }
- }
- },
- "twitch" : {
- embedUrl: 'https://player.twitch.tv/?{data-id}&parent=localhost',
- iframe : {
- allow : 'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen;',
- params: '',// optional
- },
- cookie : {
- name : 'cc_twitch'
- },
- languages : {
- 'en' : {
- notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of twitch.com.',
- loadBtn: 'Load stream',
- loadAllBtn: 'Don\'t ask again'
- }
- }
- },
- twitter : {
-
- onAccept: async (div, setIframe) => {
- const twttrLoaded = await CookieConsent.loadScript('https://platform.twitter.com/widgets.js');
- const twttrReady = twttrLoaded && await waitFor({type: 'script', obj: window, prop: 'twttr'});
- const tweet = twttrReady && await twttr.widgets.createTweet(div.dataset.id, div);
- tweet && setIframe(tweet.firstChild);
- },
-
- onReject: function(iframe){
- iframe.parentNode.remove();
- },
-
- cookie : {
- name : 'cc_twitter'
- },
-
- languages : {
- 'en' : {
- notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of twitter.com.',
- loadBtn: 'Load tweet',
- loadAllBtn: 'Don\'t ask again'
- }
- }
- },
-
- "facebook-post" : {
- embedUrl : 'https://www.facebook.com/plugins/post.php?{data-id}',
-
- iframe : {
- allow : 'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen; web-share;',
- params: '',// optional
- },
- cookie : {
- name : 'cc_facebook_post'
- },
- languages : {
- 'en' : {
- notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of twitch.com.',
- loadBtn: 'Load post',
- loadAllBtn: 'Don\'t ask again'
- }
- }
- },
-
- googlemaps: {
-
- embedUrl: 'https://www.google.com/maps/embed?pb={data-id}',
- iframe: {
- allow : 'picture-in-picture; fullscreen;'
- },
- cookie: {
- name: 'cc_maps'
- },
- languages: {
- 'en' : {
- notice: 'Notice message ...',
- loadBtn: 'Load map',
- loadAllBtn: 'Don\'t ask again'
- }
- }
- },
-
- }
- });
-
-
- var accept_all = document.getElementById('accept-all');
- var reject_all = document.getElementById('reject-all');
-
- accept_all.addEventListener('click', function(){
- console.log("clicked accept-all");
- manager.acceptService('all');
- });
-
- reject_all.addEventListener('click', function(){
- console.log("clicked reject-all");
- manager.rejectService('all');
- });
+const im = iframemanager();
+
+/**
+ * @typedef {object} WaitConfig
+ * @property {'script' | 'iframe'} type,
+ * @property {any} obj
+ * @property {string} [prop]
+ * @property {string} [selector]
+ */
+
+/**
+ * Wait until a property on the window object is available
+ * @param {WaitConfig} opts
+ * @returns {Promise}
+ */
+const waitFor = async (opts) => {
+ const {obj, type, prop, selector} = opts;
+
+ const isIframe = type === 'iframe';
+
+ const timeout = isIframe
+ ? 100
+ : 10;
+
+ const maxWait = 500;
+
+ const objToCheck = prop
+ ? obj[prop]
+ : obj;
+
+ const isDefined = () => typeof
+ (isIframe
+ ? obj.querySelector(selector)
+ : objToCheck
+ ) !== 'undefined'
+
+ let nIntervals = 0;
+
+ return await new Promise(resolve => {
+ const interval = setInterval(() => {
+ const timedOut = !isIframe && ++nIntervals * timeout > maxWait;
+ if (isDefined() || timedOut) {
+ clearInterval(interval);
+ resolve(!timedOut);
+ }
+ }, timeout);
+ });
+};
+
+im.run({
+ currLang: 'en',
+ // autoLang: true,
+
+ services : {
+
+ youtube : {
+ embedUrl: 'https://www.youtube-nocookie.com/embed/{data-id}',
+
+ iframe : {
+ allow : 'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen;',
+ },
+
+ languages : {
+ en : {
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of youtube.com.',
+ loadBtn: 'Load video',
+ loadAllBtn: "Don't ask again"
+ }
+ }
+ },
+
+ dailymotion : {
+ embedUrl: 'https://www.dailymotion.com/embed/video/{data-id}',
+
+ // Use dailymotion api to obtain thumbnail
+ thumbnailUrl: async (id, setThumbnail) => {
+ const url = `https://api.dailymotion.com/video/${id}?fields=thumbnail_large_url`;
+ const response = await (await fetch(url)).json();
+ const thumbnailUlr = response?.thumbnail_large_url;
+ thumbnailUlr && setThumbnail(thumbnailUlr);
+ },
+
+ iframe : {
+ allow : 'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen;'
+ },
+
+ languages : {
+ en : {
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of dailymotion.com.',
+ loadBtn: 'Load video',
+ loadAllBtn: "Don't ask again"
+ }
+ }
+ },
+
+ twitch : {
+ embedUrl: 'https://player.twitch.tv/?{data-id}&parent=localhost',
+
+ iframe : {
+ allow : 'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen;',
+ },
+
+ languages : {
+ en : {
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of twitch.com.',
+ loadBtn: 'Load stream',
+ loadAllBtn: "Don't ask again"
+ }
+ }
+ },
+
+ twitter : {
+
+ onAccept: async (div, setIframe) => {
+ const twttrLoaded = await CookieConsent.loadScript('https://platform.twitter.com/widgets.js');
+ const twttrReady = twttrLoaded && await waitFor({type: 'script', obj: window, prop: 'twttr'});
+ const tweet = twttrReady && await twttr.widgets.createTweet(div.dataset.id, div);
+ tweet && setIframe(tweet.firstChild);
+ },
+
+ onReject: (iframe) => {
+ iframe.parentNode.remove();
+ },
+
+ languages : {
+ en : {
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of twitter.com.',
+ loadBtn: 'Load tweet',
+ loadAllBtn: "Don't ask again"
+ }
+ }
+ },
+
+ 'facebook-post' : {
+ embedUrl : 'https://www.facebook.com/plugins/post.php?{data-id}',
+
+ iframe : {
+ allow : 'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen; web-share;',
+ },
+
+ languages : {
+ en : {
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of twitch.com.',
+ loadBtn: 'Load post',
+ loadAllBtn: "Don't ask again"
+ }
+ }
+ },
+
+ googlemaps: {
+
+ embedUrl: 'https://www.google.com/maps/embed?pb={data-id}',
+
+ iframe: {
+ allow : 'picture-in-picture; fullscreen;'
+ },
+
+ languages: {
+ en : {
+ notice: 'Notice message ...',
+ loadBtn: 'Load map',
+ loadAllBtn: "Don't ask again"
+ }
+ }
+ },
+
+ }
+});
+
+
+const acceptAll = document.getElementById('accept-all');
+const rejectAll = document.getElementById('reject-all');
+
+acceptAll.addEventListener('click', () => {
+ im.acceptService('all');
+});
+
+rejectAll.addEventListener('click', () => {
+ im.rejectService('all');
+});
\ No newline at end of file
diff --git a/demo/index.html b/demo/index.html
index f4e338f..5bab599 100644
--- a/demo/index.html
+++ b/demo/index.html
@@ -157,7 +157,6 @@ Twitch channel embed
- Ciao
From 23bac8b3975a3b4a440f314c531e43bbb7469e6c Mon Sep 17 00:00:00 2001
From: Orest Bida
Date: Sun, 11 Dec 2022 02:11:33 +0100
Subject: [PATCH 21/53] Rebuild dist files
---
dist/iframemanager.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dist/iframemanager.js b/dist/iframemanager.js
index 9963f18..7566e43 100644
--- a/dist/iframemanager.js
+++ b/dist/iframemanager.js
@@ -3,4 +3,4 @@
* Author Orest Bida
* Released under the MIT License
*/
-!function(){'use strict';var n={},t=[],i=[],r=!1,o='',e=null,c=[],a=document,f=['onload','onerror','src'];function u(n){const t=n.dataset,i={},r='data-iframe-',o=n.getAttributeNames().filter((n=>n.slice(0,12)===r)).map((n=>n.slice(12)));for(const t of o)i[t]=n.getAttribute(r+t);return{t:t.id,i:t.title,o:t.thumbnail,u:t.params,v:'thumbnailpreload'in t,l:'autoscale'in t,m:n,h:null,p:!1,_:!1,g:!0,I:i}}function v(t,i){var r=n[t];if('IntersectionObserver'in window){var o=new IntersectionObserver((function(n){n.forEach((function(n){n.isIntersecting&&(s(i,r[n.target.dataset.index]),o.unobserve(n.target))}))}));r.forEach((function(n){o.observe(n.m)}))}else for(var e=0;e0?t.hasOwnProperty(o)?o:p(t)[0]:void 0},D={acceptService:function(n){if(r=!1,'all'===n)for(var t=c.length,i=0;i-1&&o(n,e[n]);function o(n,t){h(t.cookie.name)||function(n){var t=new Date,i=n.path||'/',r=n.expiration||182,o=n.sameSite||'Lax',e=n.domain||location.hostname;t.setTime(t.getTime()+24*r*60*60*1e3);var c=' expires='+t.toUTCString(),f=n.name+'=1;'+c+'; Path='+i+';';f+=' SameSite='+o+';',e.indexOf('.')>-1&&(f+=' Domain='+e+';'),'https:'===location.protocol&&(f+=' Secure;'),a.cookie=f}(t.cookie),T(n,t)}},rejectService:function(t){if('all'===t){r=!0;for(var i=c.length,o=0;o-1&&f(t,e[t]);function f(t,i){var r,o,e;h(i.cookie.name)&&(o=(r=i.cookie).path||'/',e=r.domain||location.hostname,a.cookie=r.name+'=; Path='+o+'; Domain='+e+'; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'),function(t,i){for(var r,o,e=n[t],c=e.length,a=0;an.slice(0,12)===o)).map((n=>n.slice(12)));for(const t of r)i[t]=n.getAttribute(o+t);return{t:t.id,i:t.title,o:t.thumbnail,u:t.params,v:'thumbnailpreload'in t,l:'autoscale'in t,m:n,h:null,p:!1,_:!1,g:!0,k:i}}function v(t,i){var o=n[t];if('IntersectionObserver'in window){var r=new IntersectionObserver((function(n){n.forEach((function(n){n.isIntersecting&&(s(i,o[n.target.dataset.index]),r.unobserve(n.target))}))}));o.forEach((function(n){r.observe(n.m)}))}else for(var e=0;e0?t.hasOwnProperty(r)?r:p(t)[0]:void 0},D={acceptService:function(n){if(o=!1,'all'===n)for(var t=c.length,i=0;i-1&&r(n,e[n]);function r(n,t){h(t.cookie.name)||function(n){var t=new Date,i=n.path||'/',o=n.expiration||182,r=n.sameSite||'Lax',e=n.domain||location.hostname;t.setTime(t.getTime()+24*o*60*60*1e3);var c=' expires='+t.toUTCString(),a=n.name+'=1;'+c+'; Path='+i+';';a+=' SameSite='+r+';',e.indexOf('.')>-1&&(a+=' Domain='+e+';'),'https:'===location.protocol&&(a+=' Secure;'),f.cookie=a}(t.cookie),T(n,t)}},rejectService:function(t){if('all'===t){o=!0;for(var i=c.length,r=0;r-1&&a(t,e[t]);function a(t,i){var o,r,e;h(i.cookie.name)&&(r=(o=i.cookie).path||'/',e=o.domain||location.hostname,f.cookie=o.name+'=; Path='+r+'; Domain='+e+'; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'),function(t,i){for(var o,r,e=n[t],c=e.length,f=0;f
Date: Sun, 11 Dec 2022 15:20:23 +0100
Subject: [PATCH 22/53] Update Readme.md: update config. examples
---
README.md | 186 ++++++++++++++++++++++++------------------------------
1 file changed, 84 insertions(+), 102 deletions(-)
diff --git a/README.md b/README.md
index 312ff39..e28cd59 100644
--- a/README.md
+++ b/README.md
@@ -108,9 +108,9 @@ The plugin was mainly developed to aid [**CookieConsent**](https://github.com/or
},
languages : {
en : {
- notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of youtube.com.',
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of youtube.com.',
loadBtn: 'Load video',
- loadAllBtn: 'Don\'t ask again'
+ loadAllBtn: "Don't ask again"
}
}
}
@@ -149,9 +149,9 @@ The plugin was mainly developed to aid [**CookieConsent**](https://github.com/or
},
languages : {
en : {
- notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of youtube.com.',
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of youtube.com.',
loadBtn: 'Load video',
- loadAllBtn: 'Don\'t ask again'
+ loadAllBtn: "Don't ask again"
}
}
}
@@ -246,7 +246,7 @@ All available options for the config. object:
en : {
notice: 'Html notice message',
loadBtn: 'Load video', // Load only current iframe
- loadAllBtn: 'Don\'t ask again' // Load all iframes configured with this service + set cookie
+ loadAllBtn: "Don't ask again" // Load all iframes configured with this service + set cookie
}
}
},
@@ -324,74 +324,70 @@ Both `acceptService` and `rejectService` work the same way:
2. create/remove iframes
## Configuration examples
-- How to embed youtube videos
+- Youtube
```javascript
- // Example with youtube embed
manager.run({
currLang: 'en',
- services : {
- youtube : {
+ services: {
+ youtube: {
embedUrl: 'https://www.youtube-nocookie.com/embed/{data-id}',
+
thumbnailUrl: 'https://i3.ytimg.com/vi/{data-id}/hqdefault.jpg',
- iframe : {
- allow : 'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen;',
- },
- cookie : {
- name : 'cc_youtube'
+
+ iframe: {
+ allow: 'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen;',
},
- languages : {
- en : {
- notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of youtube.com.',
+
+ languages: {
+ en: {
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of youtube.com.',
loadBtn: 'Load video',
- loadAllBtn: 'Don\'t ask again'
+ loadAllBtn: "Don't ask again"
}
}
}
}
});
```
+ Example:
+ ```html
+
+
+ ```
-- How to embed dailymotion videos
+- Dailymotion
```javascript
- // Example with dailymotion embed
manager.run({
currLang: 'en',
- services : {
- dailymotion : {
+ services: {
+ dailymotion: {
embedUrl: 'https://www.dailymotion.com/embed/video/{data-id}',
- // Use dailymotion api to obtain thumbnail
- thumbnailUrl: function(id, setThumbnail){
-
- var url = "https://api.dailymotion.com/video/" + id + "?fields=thumbnail_large_url";
- var xhttp = new XMLHttpRequest();
-
- xhttp.onreadystatechange = function() {
- if (this.readyState == 4 && this.status == 200) {
- var src = JSON.parse(this.response).thumbnail_large_url;
- setThumbnail(src);
- }
- };
-
- xhttp.open("GET", url, true);
- xhttp.send();
- },
- iframe : {
- allow : 'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen;',
+ thumbnailUrl: async (dataId, setThumbnail) => {
+ // Use dailymotion's API to fetch the thumbnail
+ const url = `https://api.dailymotion.com/video/${dataId}?fields=thumbnail_large_url`;
+ const response = await (await fetch(url)).json();
+ const thumbnailUlr = response?.thumbnail_large_url;
+ thumbnailUlr && setThumbnail(thumbnailUlr);
},
- cookie : {
- name : 'cc_dailymotion'
+
+ iframe: {
+ allow: 'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen;',
},
- languages : {
- 'en' : {
- notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of dailymotion.com.',
+
+ languages: {
+ en: {
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of dailymotion.com.',
loadBtn: 'Load video',
- loadAllBtn: 'Don\'t ask again'
+ loadAllBtn: "Don't ask again"
}
}
}
@@ -400,43 +396,32 @@ Both `acceptService` and `rejectService` work the same way:
```
-- How to embed vimeo videos
+- Vimeo
```javascript
- // Example with vimeo embed
manager.run({
currLang: 'en',
- services : {
- vimeo : {
+ services: {
+ vimeo: {
embedUrl: 'https://player.vimeo.com/video/{data-id}',
- thumbnailUrl: function(id, setThumbnail){
-
- var url = "https://vimeo.com/api/v2/video/" + id + ".json";
- var xhttp = new XMLHttpRequest();
-
- xhttp.onreadystatechange = function() {
- if (this.readyState == 4 && this.status == 200) {
- var src = JSON.parse(this.response)[0].thumbnail_large;
- setThumbnail(src);
- }
- };
-
- xhttp.open("GET", url, true);
- xhttp.send();
- },
- iframe : {
- allow : 'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen;',
+ iframe: {
+ allow : 'fullscreen; picture-in-picture, allowfullscreen;',
},
- cookie : {
- name : 'cc_vimeo'
+
+ thumbnailUrl: async (dataId, setThumbnail) => {
+ const url = `https://vimeo.com/api/v2/video/${dataId}.json`;
+ const response = await (await fetch(url)).json();
+ const thumbnailUrl = response[0]?.thumbnail_large;
+ thumbnailUrl && setThumbnail(thumbnailUrl);
},
- languages : {
- 'en' : {
- notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of vimeo.com.',
+
+ languages: {
+ en: {
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of vimeo.com.',
loadBtn: 'Load video',
- loadAllBtn: 'Don\'t ask again'
+ loadAllBtn: "Don't ask again"
}
}
}
@@ -445,7 +430,7 @@ Both `acceptService` and `rejectService` work the same way:
```
-- How to embed twitch videos/streams/chats
+- Twitch
```javascript
@@ -453,20 +438,19 @@ Both `acceptService` and `rejectService` work the same way:
// IMPORTANT: replace "yourWebsite.com" with your own website
manager.run({
currLang: 'en',
- services : {
- twitch : {
+ services: {
+ twitch: {
embedUrl: 'https://player.twitch.tv/?{data-id}&parent=localhost&parent=yourWebsite.com',
- iframe : {
- allow : 'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen;',
- },
- cookie : {
- name : 'cc_twitch'
+
+ iframe: {
+ allow: 'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen;',
},
- languages : {
- 'en' : {
- notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of twitch.com.',
+
+ languages: {
+ en: {
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of twitch.com.',
loadBtn: 'Load stream',
- loadAllBtn: 'Don\'t ask again'
+ loadAllBtn: "Don't ask again"
}
}
}
@@ -475,7 +459,7 @@ Both `acceptService` and `rejectService` work the same way:
```
-- How to embed google maps
+- Google Maps
- With API key
@@ -484,20 +468,19 @@ Both `acceptService` and `rejectService` work the same way:
```javascript
manager.run({
currLang: 'en',
- services : {
- googlemaps : {
+ services: {
+ googlemaps: {
embedUrl: 'https://www.google.com/maps/embed/v1/place?key=API_KEY&q={data-id}',
+
iframe: {
- allow : 'picture-in-picture; fullscreen;'
+ allow: 'picture-in-picture; fullscreen;'
},
- cookie: {
- name: 'cc_maps'
- },
- languages : {
- en : {
- notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of Google Maps.',
+
+ languages: {
+ en: {
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of Google Maps.',
loadBtn: 'Load map',
- loadAllBtn: 'Don\'t ask again'
+ loadAllBtn: "Don't ask again"
}
}
}
@@ -505,7 +488,7 @@ Both `acceptService` and `rejectService` work the same way:
});
```
- Example usage:
+ Example:
```html
terms and conditions of Google Maps.',
+ notice: 'This content is hosted by a third party. By showing the external content you accept the
terms and conditions of Google Maps.',
loadBtn: 'Load map',
- loadAllBtn: 'Don\'t ask again'
+ loadAllBtn: "Don't ask again"
}
}
}
From 2492b5b10d20934415c20c943ad80f4f50435b53 Mon Sep 17 00:00:00 2001
From: Orest Bida
Date: Sun, 11 Dec 2022 15:20:43 +0100
Subject: [PATCH 23/53] Update demo example
---
demo/app.js | 39 +++++++++++++++++++++++++++++++--------
demo/index.html | 24 ++++++++++++++++--------
2 files changed, 47 insertions(+), 16 deletions(-)
diff --git a/demo/app.js b/demo/app.js
index 223f247..291abf7 100644
--- a/demo/app.js
+++ b/demo/app.js
@@ -63,7 +63,7 @@ im.run({
languages : {
en : {
- notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of youtube.com.',
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of youtube.com.',
loadBtn: 'Load video',
loadAllBtn: "Don't ask again"
}
@@ -77,8 +77,8 @@ im.run({
thumbnailUrl: async (id, setThumbnail) => {
const url = `https://api.dailymotion.com/video/${id}?fields=thumbnail_large_url`;
const response = await (await fetch(url)).json();
- const thumbnailUlr = response?.thumbnail_large_url;
- thumbnailUlr && setThumbnail(thumbnailUlr);
+ const thumbnailUrl = response?.thumbnail_large_url;
+ thumbnailUrl && setThumbnail(thumbnailUrl);
},
iframe : {
@@ -87,7 +87,7 @@ im.run({
languages : {
en : {
- notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of dailymotion.com.',
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of dailymotion.com.',
loadBtn: 'Load video',
loadAllBtn: "Don't ask again"
}
@@ -103,7 +103,7 @@ im.run({
languages : {
en : {
- notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of twitch.com.',
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of twitch.com.',
loadBtn: 'Load stream',
loadAllBtn: "Don't ask again"
}
@@ -125,7 +125,7 @@ im.run({
languages : {
en : {
- notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of twitter.com.',
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of twitter.com.',
loadBtn: 'Load tweet',
loadAllBtn: "Don't ask again"
}
@@ -141,7 +141,7 @@ im.run({
languages : {
en : {
- notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of twitch.com.',
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of twitch.com.',
loadBtn: 'Load post',
loadAllBtn: "Don't ask again"
}
@@ -158,13 +158,36 @@ im.run({
languages: {
en : {
- notice: 'Notice message ...',
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of Google Maps.',
loadBtn: 'Load map',
loadAllBtn: "Don't ask again"
}
}
},
+ vimeo: {
+ embedUrl: 'https://player.vimeo.com/video/{data-id}',
+
+ iframe: {
+ allow : 'fullscreen; picture-in-picture, allowfullscreen;'
+ },
+
+ thumbnailUrl: async (dataId, setThumbnail) => {
+ const url = `https://vimeo.com/api/v2/video/${dataId}.json`;
+ const response = await (await fetch(url)).json();
+ const thumbnailUrl = response[0]?.thumbnail_large;
+ thumbnailUrl && setThumbnail(thumbnailUrl);
+ },
+
+ languages: {
+ en : {
+ notice: 'This content is hosted by a third party. By showing the external content you accept the terms and conditions of vimeo.com.',
+ loadBtn: 'Load video',
+ loadAllBtn: "Don't ask again"
+ }
+ }
+ }
+
}
});
diff --git a/demo/index.html b/demo/index.html
index 5bab599..5e513e0 100644
--- a/demo/index.html
+++ b/demo/index.html
@@ -58,13 +58,12 @@ Youtube
+ data-id="5b35haQV7tU">
- Youtube embed (autoscale)
+ Youtube (autoscale)
Youtube embed (autoscale)
-
Youtube embed (autoscale, thumbnail & params)
+
Youtube (title, autoscale, thumbnail & params)
@@ -113,6 +112,7 @@
Twitter tweets
@@ -146,7 +146,7 @@
Facebook post
-
Twitch channel embed
+
Twitch
Twitch channel embed
+
Vimeo
+
+
-
+