21     'Magento_Ui/js/modal/alert',
    24 ], 
function (
jQuery, registry, mageTemplate, alert) {
    27 var uploaderTemplate = 
'<div class="no-display" id="[[idName]]-template">' +
    29                                 '<div class="no-display" id="[[idName]]-template-progress">' +
    30                                 '<%- data.percent %>% <%- data.uploaded %> / <%- data.total %>' +
    33     fileListTemplate = 
'<span class="file-info">' +
    34                                 '<span class="file-info-name"><%= data.name %></span>' +
    36                                 '<span class="file-info-size">(<%- data.size %>)</span>' +
    38     window.Downloadable = {
    41         setUploaderObj : 
function(type, key, obj){
    42             if (!this.uploaderObj.get(type)) {
    43                 this.uploaderObj.set(type, $H({}));
    45             this.uploaderObj.get(type).set(key, obj);
    47         getUploaderObj : 
function(type, key){
    49                 return this.uploaderObj.get(type).get(key);
    55                         content: e.name + 
'\n' + e.message
    60         unsetUploaderObj : 
function(type, key){
    62                 this.uploaderObj.get(type).unset(key);
    68                         content: e.name + 
'\n' + e.message
    73         massUploadByType : 
function(type){
    75                 this.uploaderObj.get(type).each(
function(item){
    76                     container = item.value.container.up(
'tr');
    77                     if (container.visible() && !container.hasClassName(
'no-display')) {
    80                         Downloadable.unsetUploaderObj(type, item.key);
    88                         content: e.name + 
'\n' + e.message
    95     Downloadable.FileUploader = Class.create();
    96     Downloadable.FileUploader.prototype = {
   100         fileValueName : 
null, 
   103         uploaderText: uploaderTemplate,
   104         uploaderSyntax : /(^|.|\r|\n)(\[\[(\w+)\]\])/,
   105         uploaderObj : $H({}),
   107         initialize: 
function (type, key, elmContainer, fileValueName, fileValue ,idName, config) {
   110             this.elmContainer = elmContainer;
   111             this.fileValueName = fileValueName;
   112             this.fileValue = fileValue;
   113             this.idName = idName;
   114             this.config = config;
   115             uploaderTemplate = 
new Template(this.uploaderText, this.uploaderSyntax);
   116             <?php 
if (!
$block->isReadonly()):?>
   119                 {
'top' : uploaderTemplate.evaluate({
   120                         'idName' : this.idName,
   121                         'fileValueName' : this.fileValueName,
   122                         'uploaderObj' : 
'Downloadable.getUploaderObj(\''+this.type+
'\', \''+this.key+
'\')'   129                    ? this.fileValue.toJSON()
   130                    : Object.toJSON(this.fileValue);
   132             Downloadable.setUploaderObj(
   137             new Downloadable.FileList(this.idName, 
null);
   142     Downloadable.FileList = Class.create();
   143     Downloadable.FileList.prototype = {
   148         fileListTemplate: fileListTemplate,
   150         initialize: 
function (containerId, uploader) {
   151             this.containerId  = containerId,
   152             this.container = $(this.containerId);
   153             this.uploader = uploader;
   154             this.file = this.getElement(
'save').value.evalJSON();
   155             this.listTemplate = mageTemplate(this.fileListTemplate);
   158         handleFileRemoveAll: 
function(fileId) {
   159             $(this.containerId+
'-new').hide();
   160             $(this.containerId+
'-old').show();
   162         handleFileSelect: 
function() {
   163             $(this.containerId+
'_type').checked = 
true;
   165         getElement: 
function (
name) {
   166             return $(this.containerId + 
'_' + 
name);
   168         handleUploadComplete: 
function (file) {
   174             newFile.file = file.file;
   175             newFile.name = file.name;
   176             newFile.size = file.size;
   177             newFile.status = 
'new';
   178             this.file[0] = newFile;
   181         updateFiles: 
function() {
   182             this.getElement(
'save').value = this.file.toJSON
   184                 : Object.toJSON(this.file);
   185             this.file.each(
function(row){
   186                 row.size = byteConvert(row.size);
   187                 $(this.containerId + 
'-old').innerHTML = this.listTemplate({data: row});
   188                 $(this.containerId + 
'-new').hide();
   189                 $(this.containerId + 
'-old').show();
   194     var alertAlreadyDisplayed = 
false;
   196     window.uploaderTemplate = uploaderTemplate;
   198     window.alertAlreadyDisplayed = alertAlreadyDisplayed;
   200     registry.set(
'downloadable', Downloadable);
   206 <div data-tab-type=
"tab_content_downloadableInfo" id=
"<?= /* @escapeNotVerified */ $block->getId() ?>_content"   207     <?=  
$block->getUiId(
'tab', 
'content', 
$block->getId()) ?>
   209 <div 
id=
"alert_messages_block"><?= 
$block->getMessageHtml() ?></div>
   210 <div 
class=
"admin__field admin__field-option admin__field-is-downloaodable">
   211     <input type=
"checkbox" data-action=
"change-type-product-downloadable"  class=
"admin__control-checkbox"   212            name=
"is_downloadable" id=
"is-downloaodable" <?= 
$block->isDownloadable() ? 
'checked="checked"' : 
''?> />
   213     <label 
class=
"admin__field-label" for=
"is-downloaodable">
   214         <span><?=  
__(
'Is this a downloadable Product?'); ?></span>
   217 <div 
class=
"entry-edit" id=
"product_info_tabs_downloadable_items">
   218     <?= 
$block->getChildHtml() ?>
   220 <div style=
"display:none">
   221     <div 
id=
"custom-advice-container"></div>
   223 <?php 
if (
$block->isReadonly()): ?>
   225         require([
'prototype'], 
function(){
   227         $(<?=   
$block->getContentTabId() ?>).select(
'input', 
'select', 
'textarea', 
'button').each(
function (item){
   228             item.disabled = 
true;
   229             if (item.tagName.toLowerCase() == 
'button') {
   230                 item.addClassName(
'disabled');
   238 <script type=
"text/x-magento-init">
   241             "Magento_Downloadable/downloadable-type-handler": {
   242                 "isDownloadable": 
"<?= /* @noEscape */ $block->isDownloadable() ? 'true' : 'false' ?>",
   243                 "tabId": 
"<?= /* @noEscape */ $block->getTabId() ?>"   255         'Magento_Catalog/catalog/type-events',
   256         'Magento_Downloadable/downloadable-type-handler',
   257         'Magento_Ui/js/lib/view/utils/async'   258     ], 
function ($, typeProducts) {
   260         $(
'body').trigger(
'changeTypeProduct');
   261         $(
'body').trigger(
'contentUpdated');
   262         $.async(
'[name=type]', 
function() {
 
jQuery('.store-switcher .dropdown-menu li a').each(function()
 
if( $_isRequired) echo ' required _required' ?>"> <label classforeach($_links as $_link) ($_linksPurchasedSeparately) ( $_isRequired) endif