|
1 | 1 | import { createCustomEvent, sendMessage, OriginalCustomEvent, originalWindowDispatchEvent } from '../utils.js'
|
2 | 2 | import {
|
3 |
| - logoImg, loadingImages, closeIcon, blockedFBLogo, ddgFont, ddgFontBold |
4 |
| - // blockedYTVideo, videoPlayDark, videoPlayLight // For YT CTL |
| 3 | + logoImg, loadingImages, closeIcon, blockedFBLogo, ddgFont, ddgFontBold, |
| 4 | + blockedYTVideo, videoPlayDark, videoPlayLight |
5 | 5 | } from '../assets/ctl-assets.js'
|
6 | 6 |
|
7 | 7 | let devMode = false
|
@@ -969,64 +969,64 @@ const config = {
|
969 | 969 | }
|
970 | 970 | }
|
971 | 971 | }
|
| 972 | + }, |
| 973 | + Youtube: { |
| 974 | + elementData: { |
| 975 | + 'YouTube embedded video': { |
| 976 | + selectors: [ |
| 977 | + "iframe[src*='://youtube.com/embed']", |
| 978 | + "iframe[src*='://youtube-nocookie.com/embed']", |
| 979 | + "iframe[src*='://www.youtube.com/embed']", |
| 980 | + "iframe[src*='://www.youtube-nocookie.com/embed']", |
| 981 | + "iframe[data-src*='://youtube.com/embed']", |
| 982 | + "iframe[data-src*='://youtube-nocookie.com/embed']", |
| 983 | + "iframe[data-src*='://www.youtube.com/embed']", |
| 984 | + "iframe[data-src*='://www.youtube-nocookie.com/embed']" |
| 985 | + ], |
| 986 | + replaceSettings: { |
| 987 | + type: 'youtube-video', |
| 988 | + buttonText: 'Unblock video', |
| 989 | + infoTitle: 'DuckDuckGo blocked this YouTube video to prevent Google from tracking you', |
| 990 | + infoText: 'We blocked Google (which owns YouTube) from tracking you when the page loaded. If you unblock this video, Google will know your activity.', |
| 991 | + simpleInfoText: 'We blocked Google (which owns YouTube) from tracking you when the page loaded. If you unblock this video, Google will know your activity.', |
| 992 | + previewToggleText: 'Previews disabled for additional privacy', |
| 993 | + placeholder: { |
| 994 | + previewToggleEnabledText: 'Previews enabled', |
| 995 | + previewInfoText: 'Turn previews off for additional privacy from DuckDuckGo.', |
| 996 | + videoPlayIcon: { |
| 997 | + lightMode: videoPlayLight, |
| 998 | + darkMode: videoPlayDark |
| 999 | + } |
| 1000 | + } |
| 1001 | + }, |
| 1002 | + clickAction: { |
| 1003 | + type: 'youtube-video' |
| 1004 | + } |
| 1005 | + }, |
| 1006 | + 'YouTube embedded subscription button': { |
| 1007 | + selectors: [ |
| 1008 | + "iframe[src*='://youtube.com/subscribe_embed']", |
| 1009 | + "iframe[src*='://youtube-nocookie.com/subscribe_embed']", |
| 1010 | + "iframe[src*='://www.youtube.com/subscribe_embed']", |
| 1011 | + "iframe[src*='://www.youtube-nocookie.com/subscribe_embed']", |
| 1012 | + "iframe[data-src*='://youtube.com/subscribe_embed']", |
| 1013 | + "iframe[data-src*='://youtube-nocookie.com/subscribe_embed']", |
| 1014 | + "iframe[data-src*='://www.youtube.com/subscribe_embed']", |
| 1015 | + "iframe[data-src*='://www.youtube-nocookie.com/subscribe_embed']" |
| 1016 | + ], |
| 1017 | + replaceSettings: { |
| 1018 | + type: 'blank' |
| 1019 | + } |
| 1020 | + } |
| 1021 | + }, |
| 1022 | + informationalModal: { |
| 1023 | + icon: blockedYTVideo, |
| 1024 | + messageTitle: 'Enable all YouTube previews?', |
| 1025 | + messageBody: 'Showing previews will allow Google (which owns YouTube) to see some of your device’s information, but is still more private than playing the video.', |
| 1026 | + confirmButtonText: 'Enable All Previews', |
| 1027 | + rejectButtonText: 'No Thanks' |
| 1028 | + } |
972 | 1029 | }
|
973 |
| - // Youtube: { // Config for YT CTL |
974 |
| - // elementData: { |
975 |
| - // 'YouTube embedded video': { |
976 |
| - // selectors: [ |
977 |
| - // "iframe[src*='://youtube.com/embed']", |
978 |
| - // "iframe[src*='://youtube-nocookie.com/embed']", |
979 |
| - // "iframe[src*='://www.youtube.com/embed']", |
980 |
| - // "iframe[src*='://www.youtube-nocookie.com/embed']", |
981 |
| - // "iframe[data-src*='://youtube.com/embed']", |
982 |
| - // "iframe[data-src*='://youtube-nocookie.com/embed']", |
983 |
| - // "iframe[data-src*='://www.youtube.com/embed']", |
984 |
| - // "iframe[data-src*='://www.youtube-nocookie.com/embed']" |
985 |
| - // ], |
986 |
| - // replaceSettings: { |
987 |
| - // type: 'youtube-video', |
988 |
| - // buttonText: 'Unblock video', |
989 |
| - // infoTitle: 'DuckDuckGo blocked this YouTube video to prevent Google from tracking you', |
990 |
| - // infoText: 'We blocked Google (which owns YouTube) from tracking you when the page loaded. If you unblock this video, Google will know your activity.', |
991 |
| - // simpleInfoText: 'We blocked Google (which owns YouTube) from tracking you when the page loaded. If you unblock this video, Google will know your activity.', |
992 |
| - // previewToggleText: 'Previews disabled for additional privacy', |
993 |
| - // placeholder: { |
994 |
| - // previewToggleEnabledText: 'Previews enabled', |
995 |
| - // previewInfoText: 'Turn previews off for additional privacy from DuckDuckGo.', |
996 |
| - // videoPlayIcon: { |
997 |
| - // lightMode: videoPlayLight, |
998 |
| - // darkMode: videoPlayDark |
999 |
| - // } |
1000 |
| - // } |
1001 |
| - // }, |
1002 |
| - // clickAction: { |
1003 |
| - // type: 'youtube-video' |
1004 |
| - // } |
1005 |
| - // }, |
1006 |
| - // 'YouTube embedded subscription button': { |
1007 |
| - // selectors: [ |
1008 |
| - // "iframe[src*='://youtube.com/subscribe_embed']", |
1009 |
| - // "iframe[src*='://youtube-nocookie.com/subscribe_embed']", |
1010 |
| - // "iframe[src*='://www.youtube.com/subscribe_embed']", |
1011 |
| - // "iframe[src*='://www.youtube-nocookie.com/subscribe_embed']", |
1012 |
| - // "iframe[data-src*='://youtube.com/subscribe_embed']", |
1013 |
| - // "iframe[data-src*='://youtube-nocookie.com/subscribe_embed']", |
1014 |
| - // "iframe[data-src*='://www.youtube.com/subscribe_embed']", |
1015 |
| - // "iframe[data-src*='://www.youtube-nocookie.com/subscribe_embed']" |
1016 |
| - // ], |
1017 |
| - // replaceSettings: { |
1018 |
| - // type: 'blank' |
1019 |
| - // } |
1020 |
| - // } |
1021 |
| - // }, |
1022 |
| - // informationalModal: { |
1023 |
| - // icon: blockedYTVideo, |
1024 |
| - // messageTitle: 'Enable all YouTube previews?', |
1025 |
| - // messageBody: 'Showing previews will allow Google (which owns YouTube) to see some of your device’s information, but is still more private than playing the video.', |
1026 |
| - // confirmButtonText: 'Enable All Previews', |
1027 |
| - // rejectButtonText: 'No Thanks' |
1028 |
| - // } |
1029 |
| - // } |
1030 | 1030 | }
|
1031 | 1031 |
|
1032 | 1032 | /*********************************************************
|
@@ -1359,7 +1359,8 @@ class DuckWidget {
|
1359 | 1359 | fbElement.addEventListener('error', onError, { once: true })
|
1360 | 1360 | }
|
1361 | 1361 | }, { once: true })
|
1362 |
| - unblockClickToLoadContent({ entity: this.entity, action: 'block-ctl-fb', isLogin }) |
| 1362 | + const action = this.entity === 'Youtube' ? 'block-ctl-yt' : 'block-ctl-fb' |
| 1363 | + unblockClickToLoadContent({ entity: this.entity, action, isLogin }) |
1363 | 1364 | }
|
1364 | 1365 | }.bind(this)
|
1365 | 1366 | // If this is a login button, show modal if needed
|
@@ -1595,7 +1596,8 @@ function unblockClickToLoadContent (message) {
|
1595 | 1596 | }
|
1596 | 1597 |
|
1597 | 1598 | function runLogin (entity) {
|
1598 |
| - unblockClickToLoadContent({ entity, isLogin: true }) |
| 1599 | + const action = this.entity === 'Youtube' ? 'block-ctl-yt' : 'block-ctl-fb' |
| 1600 | + unblockClickToLoadContent({ entity, action, isLogin: true }) |
1599 | 1601 | originalWindowDispatchEvent(
|
1600 | 1602 | createCustomEvent('ddg-ctp-run-login', {
|
1601 | 1603 | detail: {
|
|
0 commit comments