Created
October 23, 2023 12:54
-
-
Save mircobabini/14db0fa97318674a6229c5b87d315783 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
jQuery(function ($) { | |
// iubenda + vimeo: don't suppress dnt=1 videos | |
$(document).on('elementor/popup/show', sedweb_gdpr_unsuppress_vimeo_dnt); | |
sedweb_gdpr_unsuppress_vimeo_dnt(); | |
function sedweb_gdpr_unsuppress_vimeo_dnt() { | |
let suppressedIframes = $('iframe[suppressedsrc]'); | |
suppressedIframes.each(function () { | |
let suppressedsrc = $(this).attr('suppressedsrc'); | |
if (suppressedsrc.indexOf('player.vimeo.com') > 0) { | |
// parse the url search params | |
let url = new URL(suppressedsrc); | |
let searchParams = new URLSearchParams(url.search); | |
let dnt = searchParams.get('dnt'); | |
if (dnt === '1' || dnt === 'true') { | |
$(this).attr('src', suppressedsrc); | |
$(this).removeAttr('suppressedsrc'); | |
} | |
} | |
}); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment