From: Tim Düsterhus Date: Fri, 29 May 2020 14:49:44 +0000 (+0200) Subject: Add Facebook Video Media Provider X-Git-Tag: 5.3.0_Alpha_1~246^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9684ba302977ad0918c6e29a0e88293a3b3409f4;p=GitHub%2FWoltLab%2FWCF.git Add Facebook Video Media Provider The resulting HTML intentionally does not use an `` element for the fallback link, because it will prevent the SDK from embedding the video. The SDK generally acts as a blackbox with regard to video embeds, the only thing we can do is asking it nicely to re-parse the DOM for new stuff to embed and hope for the best. Specifically embedding doesn't work for newly posted contents that are loaded via Ajax. Not even if the re-scan is scheduled for the next run of the event loop by using `setTimeout` with a delay of `0`. For whatever reason there might be. Resolves #3242 --- diff --git a/com.woltlab.wcf/mediaProvider.xml b/com.woltlab.wcf/mediaProvider.xml index 53e5404597..cb70bfdd3e 100644 --- a/com.woltlab.wcf/mediaProvider.xml +++ b/com.woltlab.wcf/mediaProvider.xml @@ -81,6 +81,13 @@ https?://www.twitch.tv/[a-zA-Z0-9]+/v/(?[0-9]+)]]> https://twitter.com/{$USERNAME}/status/{$ID}/ ]]> + + Facebook Video + https?://(www\.)?facebook\.com/watch/\?v=(?[0-9]+)) +(?https?://(www\.)?facebook\.com/[a-zA-Z0-9_-]+/videos/(?[0-9]+)/)]]> + {$HREF} +]]> + diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Wrapper/FacebookSdk.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Wrapper/FacebookSdk.js new file mode 100644 index 0000000000..4c389b743f --- /dev/null +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Wrapper/FacebookSdk.js @@ -0,0 +1,18 @@ +/** + * Handles loading and initialization of Facebook's JavaScript SDK. + * + * @author Tim Duesterhus + * @copyright 2001-2020 WoltLab GmbH + * @license GNU Lesser General Public License + * @module WoltLabSuite/Core/Wrapper/FacebookSdk + */ +define(['https://connect.facebook.net/en_US/sdk.js'], function(_dummy) { + "use strict"; + + // see: https://developers.facebook.com/docs/javascript/reference/FB.init/v7.0 + FB.init({ + version: 'v7.0' + }); + + return FB; +});