MediaWiki:Common.js: различия между версиями

улучшенный блок обработки ошибок
м избыточно
Строка 83: Строка 83:
             width = parseInt(width) || 560;
             width = parseInt(width) || 560;
             height = parseInt(height) || 315;
             height = parseInt(height) || 315;
             if (width > 2048) width = 2048;
             if (width > 1920) width = 1920;
             if (height < 100) height = 100;
             if (height < 100) height = 100;
             if (height > 1152) height = 1152;
             if (height > 1080) height = 1080;
              
              
             if (oid && id && oid !== 'null' && id !== 'null' && /^[a-zA-Z0-9_-]{1,100}$/.test(oid) && /^[-_a-zA-Z0-9]+$/.test(id)) {
             if (oid && id && oid !== 'null' && id !== 'null' && /^[a-zA-Z0-9_-]{1,100}$/.test(oid) && /^[-_a-zA-Z0-9]+$/.test(id)) {
Строка 169: Строка 169:
         }
         }
              
              
             var width = sanitizeDimension(embed.getAttribute('data-width'), '560', 2048);
             var width = sanitizeDimension(embed.getAttribute('data-width'), '560', 1920);
             var height = sanitizeDimension(embed.getAttribute('data-height'), '315', 1152);
             var height = sanitizeDimension(embed.getAttribute('data-height'), '315', 1080);
              
              
             var iframe = document.createElement('iframe');
             var iframe = document.createElement('iframe');