1.4
Table Of Contents
- Table of Contents
- Welcome to PlanetPress Connect 1.4.2
- Setup And Configuration
- DataMapper Module
- The Designer
- Mark Position Options
- Additional Text Settings
- Additional Image Settings
- Barcode Options
- Codabar Settings
- Code 128 Settings
- Code 39 Settings
- Additional Datamatrix Settings
- Additional EAN 128 Settings
- Additional EAN 13 Settings
- Additional EAN 8 Settings
- Additional Interleave 2 of 5 Settings
- Additional PDF417 Settings
- Additional QR Code Settings
- Additional UPC A Settings
- Additional UPC E Settings
- Additional OMR Mark Settings
- Keystore
- PDF Signature
- Copyright Information
- Legal Notices and Acknowledgements
results.each(function(index){
this.text(index);
}
Selector Matched
element
Matched element after script
execution
p <p></p>
<p></p>
<p></p>
<p>0</p>
<p>1</p>
<p>2</p>
Using each() in a translation script
The following script first loads a snippet containing translation strings, depending on the value
of a field. Then it inserts translations by iterating over elements in the results (the set of HTML
elements that match the selector of the script) and setting the HTML of each element with a
value from the array of translation strings.
var strings = loadjson('snippets/' + record.fields.locale +
'.html');
results.each(function(index){
if(strings[this.attr('data-translate')])
this.html(strings[this.attr('data-translate')]);
});
Note: for documentation on the data-* attribute, see http://www.w3schools.com/tags/att_
global_data.asp.
Selector Matched element Matched element after script
execution
p
<p data-
translate="first"></p>
<p data-
translate="last"></p>
<p data-
translate="email"></p>
<p>primero</p>
<p>último</p>
<p>dirección de correo
electrónico</p>
Page 198