[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

   1  import * as __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__ from "@wordpress/interactivity";
   2  /******/ // The require scope
   3  /******/ var __webpack_require__ = {};
   4  /******/ 
   5  /************************************************************************/
   6  /******/ /* webpack/runtime/define property getters */
   7  /******/ !function() {
   8  /******/     // define getter functions for harmony exports
   9  /******/     __webpack_require__.d = function(exports, definition) {
  10  /******/         for(var key in definition) {
  11  /******/             if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  12  /******/                 Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  13  /******/             }
  14  /******/         }
  15  /******/     };
  16  /******/ }();
  17  /******/ 
  18  /******/ /* webpack/runtime/hasOwnProperty shorthand */
  19  /******/ !function() {
  20  /******/     __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  21  /******/ }();
  22  /******/ 
  23  /************************************************************************/
  24  var __webpack_exports__ = {};
  25  
  26  ;// CONCATENATED MODULE: external "@wordpress/interactivity"
  27  var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
  28  var y = x => () => x
  29  var interactivity_namespaceObject = x({ ["store"]: () => __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.store });
  30  ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/utils/index.js
  31  /**
  32   * Uses a combination of user agent matching and feature detection to determine whether
  33   * the current browser supports rendering PDFs inline.
  34   *
  35   * @return {boolean} Whether or not the browser supports inline PDFs.
  36   */
  37  const browserSupportsPdfs = () => {
  38    // Most mobile devices include "Mobi" in their UA.
  39    if (window.navigator.userAgent.indexOf('Mobi') > -1) {
  40      return false;
  41    }
  42  
  43    // Android tablets are the noteable exception.
  44    if (window.navigator.userAgent.indexOf('Android') > -1) {
  45      return false;
  46    }
  47  
  48    // iPad pretends to be a Mac.
  49    if (window.navigator.userAgent.indexOf('Macintosh') > -1 && window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2) {
  50      return false;
  51    }
  52  
  53    // IE only supports PDFs when there's an ActiveX object available for it.
  54    if (!!(window.ActiveXObject || 'ActiveXObject' in window) && !(createActiveXObject('AcroPDF.PDF') || createActiveXObject('PDF.PdfCtrl'))) {
  55      return false;
  56    }
  57    return true;
  58  };
  59  
  60  /**
  61   * Helper function for creating ActiveX objects, catching any errors that are thrown
  62   * when it's generated.
  63   *
  64   * @param {string} type The name of the ActiveX object to create.
  65   * @return {window.ActiveXObject|undefined} The generated ActiveXObject, or null if it failed.
  66   */
  67  const createActiveXObject = type => {
  68    let ax;
  69    try {
  70      ax = new window.ActiveXObject(type);
  71    } catch (e) {
  72      ax = undefined;
  73    }
  74    return ax;
  75  };
  76  ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/view.js
  77  /**
  78   * WordPress dependencies
  79   */
  80  
  81  /**
  82   * Internal dependencies
  83   */
  84  
  85  (0,interactivity_namespaceObject.store)('core/file', {
  86    state: {
  87      get hasPdfPreview() {
  88        return browserSupportsPdfs();
  89      }
  90    }
  91  });


Generated : Wed Jan 31 08:20:02 2024 Cross-referenced by PHPXref