nl_tokens: /////////////////////////////////////////////////////////////////////////////////////////////////////////
pl_tokens: function updateModel ( ) { const medium = $scope . resources . medium ; if ( ! medium || ! showMedia ) { return ; } if ( ! ( medium . mimeType in MEDIA_TYPE_BY_MIME_TYPE ) ) { log . <mask> ( 'Unsupported mimeType: [0]' , medium . mimeType ) ; } const model = $scope . model ; // feature: medium model . mediaType = MEDIA_TYPE_BY_MIME_TYPE [ medium . mimeType ] ; model . showTitle = ! ! $scope . features . medium . showTitle && ! ! medium . name ; model . showCaption = ! ! $scope . features . medium . showCaption && ! ! medium . description ; // feature: layout const sizeToContentRequested = $scope . features . layout && $scope . features . layout . sizeToContent ; const isImage = model . mediaType === TYPE_IMAGE ; const isPdf = medium . mimeType === 'application/pdf' ; const sameOrigin = isSameOrigin ( medium . location ) ; const hasExplicitSize = medium . mediaInformation && medium . mediaInformation . pixelHeight !== null && medium . mediaInformation . pixelWidth !== null ; let canBeMeasured = isImage ; let problems = '' ; if ( model . mediaType === TYPE_WEBSITE ) { canBeMeasured = sameOrigin ; if ( ! sameOrigin ) { problems += '- Content is cross-domain.\n' ; } if ( isPdf ) { canBeMeasured = false ; problems += '- PDF-Content cannot be measured.\n' ; } } if ( sizeToContentRequested && ! canBeMeasured && ! hasExplicitSize ) { problems += '- mediaInformation is missing' ; log . warn ( ` ${ problems } ` , $scope . id ( ) ) ; } if ( isPdf ) { const platform = navigator . platform ; if ( platform === 'iPad' || platform === 'iPhone' || platform === 'iPod' ) { // There is no way to display a PDF of unknown height using an iframe on iOS (no scrolling). model . mediaType = TYPE_FALLBACK ; } } model . layoutClass = ( sizeToContentRequested && ( canBeMeasured || hasExplicitSize ) ) ? CLASS_SIZE_TO_CONTENT : CLASS_SIZE_TO_CONTAINER ; model . canBeMeasured = canBeMeasured ; model . isSameOrigin = sameOrigin ; // We trust every kind of urls from the resource if ( typeof medium . location === 'string' ) { medium . location = $sce . trustAsResourceUrl ( medium . location ) ; } }