Tips:Using JavaScript in Memento

From Memento Database Wiki
Revision as of 03:20, 17 February 2017 by UnConnoisseur (talk | contribs)
Jump to navigation Jump to search
« Page as of 2017-02-12, editions Mobile 4.2.1, Desktop 1.0.8 »

This page is under development. Information is incomplete and potentially incorrect.

TBD-intro

General tips

TBD

JavaScript tips

Link to Entry fields

Using field()
field() returns an array of Entry objects. To access fields in the linked library, use:
JavaScript field Trigger
var links = field("Link field name");
if (links.length > 0) {
    var name = field(links[0].field("Name");
    // Put your code to handle name here
    }
var e = entry(), links = e.field("Link field name");
if (links.length > 0) {
    var name = e.field(links[0].field("Name"));
    // Put your code to handle name here
    }
JavaScript field
var links = field("Link field name");
if (links.length > 0) {
    var name = field(links[0].field("Name");
    // Put your code to handle name here
    }
Trigger
var e = entry(), links = e.field("Link field name");
if (links.length > 0) {
    var name = e.field(links[0].field("Name"));
    // Put your code to handle name here
    }

JavaScript field tips

TBD

Trigger tips

TBD

How Trigger & JavaScript field scripts differ

TBD

Links

Triggers Trigger examples

W3Schools
JavaScript Tutorial A pleasant, fairly complete, and useful tutorial on JavaScript
Best on a computer or tablet in landscape. On a phone or tablet in portrait, scroll to the bottom for navigation.
Mozilla Developer Network
JavaScript Guide Shows you how to use JavaScript, gives an overview of the language, and presents its capabilities & features
JavaScript Reference The entire JavaScript language described in detail
Introduction to JavaScript Introduces JavaScript and discusses some of its fundamental concepts
JavaScript Tutorial A re-introduction. JavaScript is often derided as being a toy, but beneath its simplicity, powerful language features await.
JavaScript 1.7 The JavaScript release upon which Memento is currently based
About JavaScript Jumping off point in learning about JavaScript