help3xsl/help.js                        |   11 +++++++++++
 help3xsl/online_transform.xsl           |    9 ++++++---
 source/text/shared/06/youtubevideos.xhp |    5 ++++-
 source/text/shared/help/browserhelp.xhp |    1 +
 4 files changed, 22 insertions(+), 4 deletions(-)

New commits:
commit 751aa416e5aa4fdb6faf5be273aa8d999e1630e4
Author:     Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
AuthorDate: Wed Feb 9 12:57:37 2022 +0200
Commit:     Olivier Hallot <olivier.hal...@libreoffice.org>
CommitDate: Wed Feb 9 16:24:41 2022 +0100

    Add YouTube consent click
    
    Change-Id: I60d64e1becbc7ea33301d4a8073f0b550998b87d
    Reviewed-on: https://gerrit.libreoffice.org/c/help/+/129716
    Tested-by: Jenkins
    Reviewed-by: Olivier Hallot <olivier.hal...@libreoffice.org>

diff --git a/help3xsl/help.js b/help3xsl/help.js
index 0a7563e3f..dcf0dd365 100644
--- a/help3xsl/help.js
+++ b/help3xsl/help.js
@@ -246,4 +246,15 @@ document.addEventListener('click', function(event) {
         });
     }
 });
+// YouTube consent click. This only works for a single video.
+let youtubePlaceholder = document.querySelector(".youtube_placeholder");
+if (youtubePlaceholder) {
+    
youtubePlaceholder.prepend(...document.querySelectorAll(".youtube_consent"));
+}
+function youtubeLoader(ytId, width, height) {
+    let iframeMarkup = `<iframe width="${width}" height="${height}" 
src="https://www.youtube-nocookie.com/embed/${ytId}?version=3"; 
allowfullscreen="true" frameborder="0"></iframe>`;
+    let placeholder = document.getElementById(ytId);
+    placeholder.innerHTML = iframeMarkup;
+    placeholder.removeAttribute("style");
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl
index a6ce8255b..ac6337d7e 100644
--- a/help3xsl/online_transform.xsl
+++ b/help3xsl/online_transform.xsl
@@ -108,6 +108,7 @@
 <xsl:variable name ="ui_selectlang"><xsl:apply-templates 
select="$tmp_doc_ui//variable[@id='selectlanguage']"/></xsl:variable>
 <xsl:variable name ="ui_search"><xsl:apply-templates 
select="$tmp_doc_ui//variable[@id='searchhelpcontents']"/></xsl:variable>
 <xsl:variable name ="ui_copyclip"><xsl:apply-templates 
select="$tmp_doc_ui//variable[@id='copyclip']"/></xsl:variable>
+<xsl:variable name ="ytvideobutton"><xsl:apply-templates 
select="$tmp_doc_ui//variable[@id='ytbutton']"/></xsl:variable>
 <!--
 #############
 # Templates #
@@ -1264,9 +1265,11 @@
     <xsl:variable name="auxID" select="concat('obj',generate-id())"/>
     <xsl:choose>
         <xsl:when test="starts-with(@type,'video/youtube')">
-                <div id="mediadiv">
-                    <iframe id="{@id}" src="{@data}" width="{$width}" 
height="{$height}" frameborder="0" allowfullscreen="true"></iframe>
-                </div>
+            <div id="{@id}" class="youtube_placeholder" style="border: 1px 
solid #eee; width:500px; padding: 10px;">
+                <button style="background-color: red;" 
onClick="youtubeLoader('{@id}', 700, 394)" >
+                    <xsl:value-of select="$ytvideobutton"/>
+                </button>
+            </div>
         </xsl:when>
         <xsl:when test="not(starts-with(@type,'video/youtube')) and 
starts-with(@type,'video')">
             <div id="mediadiv">
diff --git a/source/text/shared/06/youtubevideos.xhp 
b/source/text/shared/06/youtubevideos.xhp
index 469cc8738..714834b03 100644
--- a/source/text/shared/06/youtubevideos.xhp
+++ b/source/text/shared/06/youtubevideos.xhp
@@ -17,7 +17,10 @@
 </meta>
 <body>
 <section id="whatisit">
-    <paragraph role="paragraph" id="par_ytvideosample" localize="false" 
xml-lang="en-US"><object 
data="https://www.youtube-nocookie.com/embed/Raw0LIxyoRU"; 
id="vid_id61521568603544" type="video/youtube" width="700" 
height="394"/></paragraph>
+    <paragraph role="youtube_consent" id="par_id311644338760624">Please accept 
this video. By accepting you will be accessing content from YouTube, a service 
provided by an external third party.</paragraph>
+    <paragraph role="youtube_consent" id="par_id91644338793051"><link 
href="https://policies.google.com/privacy"; name="linkname">You Tube Privacy 
Policy</link></paragraph>
+    <paragraph role="paragraph" id="par_ytvideosample" localize="false" 
xml-lang="en-US"><object data="" id="Raw0LIxyoRU" type="video/youtube" 
width="700" height="394"/>
+    </paragraph>
 </section>
 </body>
 </helpdocument>
diff --git a/source/text/shared/help/browserhelp.xhp 
b/source/text/shared/help/browserhelp.xhp
index 6c752dff1..af7eee765 100644
--- a/source/text/shared/help/browserhelp.xhp
+++ b/source/text/shared/help/browserhelp.xhp
@@ -112,5 +112,6 @@
     <paragraph role="paragraph" id="par_id901568266092266"><variable 
id="xap_matching">matching:</variable></paragraph>
     <paragraph role="paragraph" id="par_id511568266279483"><variable 
id="xap_relevant">Mark this document as relevant</variable></paragraph>
     <paragraph role="paragraph" id="par_id841569449577334"><variable 
id="xap_didyoumean">Did you mean:</variable></paragraph>
+    <paragraph role="paragraph" id="par_id501644407795954"><variable 
id="ytbutton">Accept YouTube Content</variable></paragraph>
 </body>
 </helpdocument>

Reply via email to