Mudanças do documento PDF Viewer Macro
                  Última modificação por JOSE RONALDO DOS ARAUJO em 17/04/2024
              
      
      Da versão  2.1 
    
    
              editado por JOSE RONALDO DOS ARAUJO
        
em 13/04/2024
     em 13/04/2024
      Comentário da mudança:
              Install extension [com.xwiki.pdfviewer:macro-pdfviewer-ui/2.5.2]
          
         
      Para versão  3.1 
    
    
              editado por JOSE RONALDO DOS ARAUJO
        
em 17/04/2024
     em 17/04/2024
      Comentário da mudança:
              Reset document from extension [org.xwiki.contrib:xwiki-macro-pdfviewer/1.5]
          
         Resumo
- 
          Propriedades da página (1 modificado, 0 adicionado, 0 removido)
 - 
          Anexos (0 modificado, 1 adicionado, 0 removido)
 - 
          Objetos (0 modificado, 4 adicionado, 1 removido)
 
Detalhes
- Propriedades da página
 - 
      
- Conteúdo
 -   
... ... @@ -1,1 +1,4 @@ 1 + 2 +Sample PDF Viewer 3 + 1 1 {{pdfviewer file="pdftest.pdf" /}}  
 
- pdfviewer.zip
 -   
- Author
 -   
... ... @@ -1,0 +1,1 @@ 1 +XWiki.Admin  - Tamanho
 -   
... ... @@ -1,0 +1,1 @@ 1 +2.5 MB  - Conteúdo
 
 
- XWiki.JavaScriptExtension[0]
 -   
- Política de cache
 -   
... ... @@ -1,1 +1,0 @@ 1 -long  - Código
 -   
... ... @@ -1,48 +1,0 @@ 1 -require(['jquery'], function ($) { 2 - $(function() { 3 - const iframe = document.getElementsByClassName('pdfviewer')[0]; 4 - const initPermalinkButton = function (iframe) { 5 - let viewerFrame = $(iframe); 6 - let secondaryMenuButton = viewerFrame.contents().find('#secondaryToolbarToggle'); 7 - // Triggered when clicking the permalink button. 8 - let copyPdfPermalink = function () { 9 - let fileName = new URL(viewerFrame.attr('src'), location.origin).searchParams.get('file'); 10 - let pdfURL = new URL(fileName, location.origin).toString(); 11 - navigator.clipboard.writeText(pdfURL).then(function() { 12 - // After upgrading the parent to 13.8, the Require plugin for translations should be used. 13 - // See https://extensions.xwiki.org/xwiki/bin/view/Extension/Localization/#HFromJavaScript 14 - new XWiki.widgets.Notification( 15 - $jsontool.serialize($services.localization.render('pdfviewer.viewer.notification.linkCopied')), 16 - 'done' 17 - ); 18 - }, function() { 19 - new XWiki.widgets.Notification( 20 - $jsontool.serialize($services.localization.render('pdfviewer.viewer.notification.copyLinkFail')), 21 - 'error' 22 - ); 23 - }); 24 - // If the secondary menu is open, we need to close it / untoggle it. 25 - if (secondaryMenuButton.hasClass('toggled')) { 26 - secondaryMenuButton.click(); 27 - } 28 - }; 29 - viewerFrame.contents() 30 - .find('button.permalink') 31 - .attr('title', $jsontool.serialize($services.localization.render('pdfviewer.viewer.buttons.copyLink'))) 32 - .on('click', copyPdfPermalink) 33 - .find('span') 34 - .text($jsontool.serialize($services.localization.render('pdfviewer.viewer.buttons.copyLink'))) 35 - .removeAttr('data-l10n-id'); 36 - }; 37 - 38 - if (iframe.contentDocument.readyState === 'complete') { 39 - initPermalinkButton(iframe); 40 - } else { 41 - // We setTimeout to 0 because we want all the listeners of load event to finish executing before we run our 42 - // function. This will guarantee that the permalink button will be there when initPermalinkButton runs. 43 - iframe 44 - .contentWindow 45 - .addEventListener('load', function() { setTimeout(function () { initPermalinkButton(iframe); }, 0); }); 46 - } 47 - }); 48 -});  - Analisar conteúdo
 -   
... ... @@ -1,1 +1,0 @@ 1 -Sim  - Usar essa extensão
 -   
... ... @@ -1,1 +1,0 @@ 1 -onDemand  
 - XWiki.WikiMacroClass[0]
 -   
- Macro code
 -   
... ... @@ -1,0 +1,25 @@ 1 +{{velocity}} 2 +#set($width = $context.macro.params.width) 3 +#set($height = $context.macro.params.height) 4 +#set($file = $context.macro.params.file) 5 +#if(!$file) 6 +No pdf URL provided 7 +#else 8 +#if($file.startsWith("http")) 9 + #set($url = $file) 10 +#else 11 + #set($url = $doc.getAttachmentURL($file)) 12 +#end 13 +#set($url = $escapetool.url($url)) 14 +#set($pdfviewerurl = $xwiki.getDocument("XWiki.PDFViewerMacro").getAttachmentURL("pdfviewer.zip")) 15 +{{html clean=false}} 16 + <!--[if lt IE 10]> 17 + <div class="box warningmessage">PDF Viewer : Not compatible with IE < 10</div> 18 + <![endif]--> 19 + <![if !(lt IE 10)]> 20 + <iframe src="${pdfviewerurl}/pdf-viewer/web/viewer.html?file=${url}#locale=${context.language}" width="${width}" height="${height}"&></iframe> 21 + <![endif]--> 22 + </script> 23 +{{/html}} 24 +#end 25 +{{/velocity}}  - defaultCategory
 -   
... ... @@ -1,0 +1,1 @@ 1 +Content  - Macro visibility
 -   
... ... @@ -1,0 +1,1 @@ 1 +Current Wiki  - Supports inline mode
 -   
... ... @@ -1,0 +1,1 @@ 1 +Não  - Macro description
 -   
... ... @@ -1,0 +1,1 @@ 1 +PDF Viewer based on Mozilla pdf.js  - Macro name
 -   
... ... @@ -1,0 +1,1 @@ 1 +pdfviewer  - Macro id
 -   
... ... @@ -1,0 +1,1 @@ 1 +pdfviewer  - Macro content availability
 -   
... ... @@ -1,0 +1,1 @@ 1 +No content  
 - XWiki.WikiMacroParameterClass[0]
 -   
- Parameter name
 -   
... ... @@ -1,0 +1,1 @@ 1 +file  - Parameter description
 -   
... ... @@ -1,0 +1,1 @@ 1 +File or URL path to the PDF file  - Parameter mandatory
 -   
... ... @@ -1,0 +1,1 @@ 1 +Sim  
 - XWiki.WikiMacroParameterClass[1]
 -   
- Parameter default value
 -   
... ... @@ -1,0 +1,1 @@ 1 +100%  - Parameter name
 -   
... ... @@ -1,0 +1,1 @@ 1 +width  
 - XWiki.WikiMacroParameterClass[2]
 -   
- Parameter default value
 -   
... ... @@ -1,0 +1,1 @@ 1 +1000  - Parameter name
 -   
... ... @@ -1,0 +1,1 @@ 1 +height