jqgrid_utils 1.2.6 → 1.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -506,14 +506,28 @@ async add_image(col_model, edit_field, size, link=false)
506
506
  col_model[i]['height'] = size;
507
507
  col_model[i]['formatter'] = function(cell_val)
508
508
  {
509
- if(link)
509
+ const cell_val2 = cell_val.toLowerCase();
510
+ if(cell_val2.startsWith('https://', 0) || cell_val2.startsWith('http://', 0) )
510
511
  {
511
- return '<a target="blank" href="' + cell_val + '"><img src="' + cell_val + '" alt="my image" width="' + size + '" /></a>';
512
+ if(cell_val2.endsWith(".png") ||
513
+ cell_val2.endsWith(".jpg") ||
514
+ cell_val2.endsWith(".jpeg") ||
515
+ cell_val2.endsWith(".gif") ||
516
+ cell_val2.endsWith(".svg") ||
517
+ cell_val2.endsWith(".svgz") ||
518
+ cell_val2.endsWith(".webp"))
519
+ {
520
+ if(link)
521
+ {
522
+ return '<a target="blank" href="' + cell_val + '"><img src="' + cell_val + '" alt="my image" width="' + size + '" /></a>';
523
+ }
524
+ else
525
+ {
526
+ return '<img src="' + cell_val + '" alt="my image" width="' + size + '" />';
527
+ }
528
+ }
512
529
  }
513
- else
514
- {
515
- return '<img src="' + cell_val + '" alt="my image" width="' + size + '" />';
516
- }
530
+ return cell_val;
517
531
  };
518
532
  }
519
533
  }
@@ -522,6 +536,9 @@ async add_image(col_model, edit_field, size, link=false)
522
536
 
523
537
 
524
538
 
539
+
540
+
541
+
525
542
  };
526
543
 
527
544
 
package/jqgrid_utils.js CHANGED
@@ -505,14 +505,28 @@ async add_image(col_model, edit_field, size, link=false)
505
505
  col_model[i]['height'] = size;
506
506
  col_model[i]['formatter'] = function(cell_val)
507
507
  {
508
- if(link)
508
+ const cell_val2 = cell_val.toLowerCase();
509
+ if(cell_val2.startsWith('https://', 0) || cell_val2.startsWith('http://', 0) )
509
510
  {
510
- return '<a target="blank" href="' + cell_val + '"><img src="' + cell_val + '" alt="my image" width="' + size + '" /></a>';
511
+ if(cell_val2.endsWith(".png") ||
512
+ cell_val2.endsWith(".jpg") ||
513
+ cell_val2.endsWith(".jpeg") ||
514
+ cell_val2.endsWith(".gif") ||
515
+ cell_val2.endsWith(".svg") ||
516
+ cell_val2.endsWith(".svgz") ||
517
+ cell_val2.endsWith(".webp"))
518
+ {
519
+ if(link)
520
+ {
521
+ return '<a target="blank" href="' + cell_val + '"><img src="' + cell_val + '" alt="my image" width="' + size + '" /></a>';
522
+ }
523
+ else
524
+ {
525
+ return '<img src="' + cell_val + '" alt="my image" width="' + size + '" />';
526
+ }
527
+ }
511
528
  }
512
- else
513
- {
514
- return '<img src="' + cell_val + '" alt="my image" width="' + size + '" />';
515
- }
529
+ return cell_val;
516
530
  };
517
531
  }
518
532
  }
@@ -521,6 +535,9 @@ async add_image(col_model, edit_field, size, link=false)
521
535
 
522
536
 
523
537
 
538
+
539
+
540
+
524
541
  };
525
542
 
526
543
 
package/package.json CHANGED
@@ -29,5 +29,5 @@
29
29
  {
30
30
  "test": "echo \"Error: no test specified\" && exit 1"
31
31
  },
32
- "version": "1.2.6"
32
+ "version": "1.2.7"
33
33
  }