Project

General

Profile

Feature #38504 » adjust-image-display-size-for-HiDPI-monitors.patch

Go MAEDA, 2023-04-30 09:33

View differences:

public/javascripts/attachments.js
275 275
  if (!clipboardData) { return; }
276 276
  if (clipboardData.types.some(function(t){ return /^text\/plain$/.test(t); })) { return; }
277 277

  
278
  var pixelDensity = Math.round(window.devicePixelRatio);
278 279
  var files = clipboardData.files
279 280
  for (var i = 0 ; i < files.length ; i++) {
280 281
    var file = files[i];
......
286 287
        + ('0'+date.getDate()).slice(-2)
287 288
        + ('0'+date.getHours()).slice(-2)
288 289
        + ('0'+date.getMinutes()).slice(-2)
289
        + '-' + randomKey(5).toLocaleLowerCase()
290
        + '.' + file.name.split('.').pop();
290
        + '-' + randomKey(5).toLocaleLowerCase();
291
      // pixel density descriptor (e.g. @2x)
292
      if (pixelDensity >= 2) {
293
        filename += '@' + pixelDensity + 'x';
294
      }
295
      // file extension
296
      filename += '.' + file.name.split('.').pop();
291 297

  
292 298
      // get input file in the closest form
293 299
      var inputEl = $(this).closest("form").find('input:file.filedrop');
(4-4/4)