#1
|
|||
|
|||
![]()
Hello,
I am using a script suggested from another thread called "floating images". The script works perfect except for one thing, it adds commas and I want to suppress them. The following is my script: Code:
var cellImg = Resource("cell").content; var voiceImg = Resource("voice").content; var faxImg = Resource("fax").content; var emailImg = Resource("email").content; var numbers = [ [Field('EMAIL'), emailImg], [Field('PHONE'), voiceImg], [Field('CELL'), cellImg], [Field('FAX'), faxImg] ].filter(function(s){return s[1]}).map( function(s){ return '<p br=false superoffset=70 superratio=100>' + s[1] + '<superscript> ' + s[0] + '</superscript>'; }) return numbers; Thanks! -Mike |
#2
|
|||
|
|||
![]()
I think I resolved the issue. I added the following to the code:
Code:
].filter(function(s){return s[1]}).map( function(s){ return '<p br=false superoffset=70 superratio=100>' + s[1] + '<superscript> ' + s[0] + '</superscript>'; }).join('<t>') That worked for me. Having said that, any other suggestions would be great for the benefit of others. Thanks! |
#3
|
||||
|
||||
![]()
Yes, the original script you posted returns an array – the elements within the array are separated by a comma when output. The join method joins the elements with something other than a comma and converts the returned element to a string.
So, in your second snippet, you're joining the element with a tab tag. But you could join them with a break tag (<br>) like in the original script, or a space, or any ole' string you want, really: Code:
var cellImg = Resource("cell").content; var voiceImg = Resource("voice").content; var faxImg = Resource("fax").content; var emailImg = Resource("email").content; var numbers = [ [Field('EMAIL'), emailImg], [Field('PHONE'), voiceImg], [Field('CELL'), cellImg], [Field('FAX'), faxImg] ].filter(function(s){return s[1]}).map( function(s){ return '<p br=false superoffset=70 superratio=100>' + s[1] + '<superscript> ' + s[0] + '</superscript>'; }) return numbers.join("any ole' string you want");
__________________
Ste Pennell FusionPro VDP Creator 9.3.15 Adobe Acrobat X 10.1.1 Mac OS X 10.12 |
#4
|
|||
|
|||
![]()
Thank you STEP for the additional information. I didn't realize I could also place that join at the end of the return line. So that's a nice handy little tidbit as well.
|
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|