[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/blocks/file/ -> view.js (source)

   1  /******/ (function(modules) { // webpackBootstrap
   2  /******/     // The module cache
   3  /******/     var installedModules = {};
   4  /******/
   5  /******/     // The require function
   6  /******/ 	function __webpack_require__(moduleId) {
   7  /******/
   8  /******/         // Check if module is in cache
   9  /******/         if(installedModules[moduleId]) {
  10  /******/             return installedModules[moduleId].exports;
  11  /******/         }
  12  /******/         // Create a new module (and put it into the cache)
  13  /******/         var module = installedModules[moduleId] = {
  14  /******/             i: moduleId,
  15  /******/             l: false,
  16  /******/             exports: {}
  17  /******/         };
  18  /******/
  19  /******/         // Execute the module function
  20  /******/         modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21  /******/
  22  /******/         // Flag the module as loaded
  23  /******/         module.l = true;
  24  /******/
  25  /******/         // Return the exports of the module
  26  /******/         return module.exports;
  27  /******/     }
  28  /******/
  29  /******/
  30  /******/     // expose the modules object (__webpack_modules__)
  31  /******/     __webpack_require__.m = modules;
  32  /******/
  33  /******/     // expose the module cache
  34  /******/     __webpack_require__.c = installedModules;
  35  /******/
  36  /******/     // define getter function for harmony exports
  37  /******/     __webpack_require__.d = function(exports, name, getter) {
  38  /******/         if(!__webpack_require__.o(exports, name)) {
  39  /******/             Object.defineProperty(exports, name, { enumerable: true, get: getter });
  40  /******/         }
  41  /******/     };
  42  /******/
  43  /******/     // define __esModule on exports
  44  /******/     __webpack_require__.r = function(exports) {
  45  /******/         if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  46  /******/             Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  47  /******/         }
  48  /******/         Object.defineProperty(exports, '__esModule', { value: true });
  49  /******/     };
  50  /******/
  51  /******/     // create a fake namespace object
  52  /******/     // mode & 1: value is a module id, require it
  53  /******/     // mode & 2: merge all properties of value into the ns
  54  /******/     // mode & 4: return value when already ns object
  55  /******/     // mode & 8|1: behave like require
  56  /******/     __webpack_require__.t = function(value, mode) {
  57  /******/         if(mode & 1) value = __webpack_require__(value);
  58  /******/         if(mode & 8) return value;
  59  /******/         if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  60  /******/         var ns = Object.create(null);
  61  /******/         __webpack_require__.r(ns);
  62  /******/         Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  63  /******/         if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  64  /******/         return ns;
  65  /******/     };
  66  /******/
  67  /******/     // getDefaultExport function for compatibility with non-harmony modules
  68  /******/     __webpack_require__.n = function(module) {
  69  /******/         var getter = module && module.__esModule ?
  70  /******/ 			function getDefault() { return module['default']; } :
  71  /******/ 			function getModuleExports() { return module; };
  72  /******/         __webpack_require__.d(getter, 'a', getter);
  73  /******/         return getter;
  74  /******/     };
  75  /******/
  76  /******/     // Object.prototype.hasOwnProperty.call
  77  /******/     __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  78  /******/
  79  /******/     // __webpack_public_path__
  80  /******/     __webpack_require__.p = "";
  81  /******/
  82  /******/
  83  /******/     // Load entry module and return exports
  84  /******/     return __webpack_require__(__webpack_require__.s = "DP2F");
  85  /******/ })
  86  /************************************************************************/
  87  /******/ ({
  88  
  89  /***/ "DP2F":
  90  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  91  
  92  "use strict";
  93  // ESM COMPAT FLAG
  94  __webpack_require__.r(__webpack_exports__);
  95  
  96  // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/utils.js
  97  /**
  98   * Uses a combination of user agent matching and feature detection to determine whether
  99   * the current browser supports rendering PDFs inline.
 100   *
 101   * @return {boolean} Whether or not the browser supports inline PDFs.
 102   */
 103  const browserSupportsPdfs = () => {
 104    // Most mobile devices include "Mobi" in their UA.
 105    if (window.navigator.userAgent.indexOf('Mobi') > -1) {
 106      return false;
 107    } // Android tablets are the noteable exception.
 108  
 109  
 110    if (window.navigator.userAgent.indexOf('Android') > -1) {
 111      return false;
 112    } // iPad pretends to be a Mac.
 113  
 114  
 115    if (window.navigator.userAgent.indexOf('Macintosh') > -1 && window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2) {
 116      return false;
 117    } // IE only supports PDFs when there's an ActiveX object available for it.
 118  
 119  
 120    if (!!(window.ActiveXObject || 'ActiveXObject' in window) && !(createActiveXObject('AcroPDF.PDF') || createActiveXObject('PDF.PdfCtrl'))) {
 121      return false;
 122    }
 123  
 124    return true;
 125  };
 126  /**
 127   * Helper function for creating ActiveX objects, catching any errors that are thrown
 128   * when it's generated.
 129   *
 130   * @param {string} type The name of the ActiveX object to create.
 131   * @return {window.ActiveXObject|undefined} The generated ActiveXObject, or null if it failed.
 132   */
 133  
 134  const createActiveXObject = type => {
 135    let ax;
 136  
 137    try {
 138      ax = new window.ActiveXObject(type);
 139    } catch (e) {
 140      ax = undefined;
 141    }
 142  
 143    return ax;
 144  };
 145  /**
 146   * Hides all .wp-block-file__embed elements on the document. This function is only intended
 147   * to be run on the front-end, it may have weird side effects running in the block editor.
 148   */
 149  
 150  
 151  const hidePdfEmbedsOnUnsupportedBrowsers = () => {
 152    if (!browserSupportsPdfs()) {
 153      const embeds = document.getElementsByClassName('wp-block-file__embed');
 154      Array.from(embeds).forEach(embed => {
 155        embed.style.display = 'none';
 156      });
 157    }
 158  };
 159  
 160  // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/view.js
 161  /**
 162   * Internal dependencies
 163   */
 164  
 165  hidePdfEmbedsOnUnsupportedBrowsers();
 166  
 167  
 168  /***/ })
 169  
 170  /******/ });


Generated: Mon Dec 6 01:00:03 2021 Cross-referenced by PHPXref 0.7.1