Show:
Description:

This class doesn't do anything, it is here just to force YuiDoc generating the documentation

Constructor

JsonVCard

()

Defined in jsonvcard.js:34

Methods

Methods

addStyleSheet

(
  • url
)
private static

Defined in jsonvcard.js:329

Link a stylsheet to the current document

Parameters:

  • url String

    the URL of the tageted CSS

cookTemplate

(
  • data
  • template
)
private static

Defined in jsonvcard.js:214

This function is used to initiate the process of binding the data with the template

Parameters:

  • data Object

    the data structure recovered from json file

  • template String

    the HTML template used to create the final HTML code

getFunctions

(
  • template
)
type private static

Defined in jsonvcard.js:264

Get all the function defined in the template

Parameters:

  • template type

    [description]

Returns:

type:

[description]

getVariables

(
  • template
)
String private static

Defined in jsonvcard.js:232

Save all template defined variables in a global variable called vars

Parameters:

  • template String

    the HTML template used to create the final HTML code

Returns:

String:

the HTML template after deliting variables

process

(
  • jsonURL
)
public static

Defined in jsonvcard.js:158

Initialization of process; this method searches for "vcard.json" in the javascript location "jsonvcard.js". Then when retrieved, it sends its content as a string to process(json) Where it will be processed

Parameters:

  • jsonURL String

    The location of json file

process_date

(
  • date
  • template
  • marker
  • pattern
  • months
)
String private static

Defined in jsonvcard.js:638

Special function (date) to process dates. You can define a function in template.htm like this:

Parameters:

  • date String

    the date in the format "yyyymmdd", "yyyymm" or "yyyy"

  • template String

    the HTML template to be replaced

  • marker String

    the marker which will be replaced in the template

  • pattern String

    the pattern using the words "yyyy", "yy", "mm", "dd". The pattern uses also "<...>" which specifies the content which will be erased if there is no days and "[]" which specifies the content related to month "mm[ dd<, >]yyyy"

  • months Array

    array of 12 strings containing months names. If this is given, the "mm" will be replaced with the equivalent month name in the array

Returns:

String:

the HTML content after replacement

process_mark

(
  • value
  • template
  • marker
  • type
)
String private static

Defined in jsonvcard.js:705

Special function (mark) to process percentages. You can define a function in template.htm like this:

                                                

Parameters:

  • value String

    a number from 1 to 10

  • template String

    the HTML template to be replaced

  • marker String

    the marker which will be replaced in the template

  • type String

    the type of the theme, currently: "bar"

Returns:

String:

the HTML content after replacement

process_social

(
  • data
  • template
)
String private static

Defined in jsonvcard.js:616

Special function (social) to process social media links. You can define a function in template.htm like this:

Parameters:

  • data Object

    an object containing the name of the social network as a key and the link as a value

  • template String

    the HTML template to be replaced

Returns:

String:

the HTML content after replacement

processArray

(
  • key
  • data
  • template
)
String private static

Defined in jsonvcard.js:475

Process the data of an array. It recovers the begining and ending of this array in the template. Then, it pushes each element of the array into that area.

Parameters:

  • key String

    the name or key of the array; for example "skill"

  • data Object

    the value of the data: it may be an object, a list, or a simple element. In our example, it is a simple string: "javascript"

  • template String

    the HTML template used to push the data

Returns:

String:

the HTML content after merging with the data

processData

(
  • key
  • value
  • template
)
String private static

Defined in jsonvcard.js:387

Process the data of an object. It detects if the data is an object, a list of elements or a simple element

Parameters:

  • key String

    the name or key of the element; for example "perso.name"

  • value Object

    the value of the data: it may be an object, a list, or a simple element. In our example, it is a simple string: "Karim"

  • template String

    the HTML template used to push the data

Returns:

String:

the HTML content after merging with the data

processFiles

() private static

Defined in jsonvcard.js:529

Process the files stored in a global variable (files) while processing the json data and the template

processJSON

(
  • json
)
private static

Defined in jsonvcard.js:184

This method parses the json content

Parameters:

  • json String

    The content of JSON file

processObject

(
  • key
  • data
  • template
)
String private static

Defined in jsonvcard.js:359

Process an object which contains many elements in it

Parameters:

  • key String

    the name of this object, for example

                                                  "perso": {
                                                     "name": "Karim",
                                                     "family": "Aries"
                                                  }
                                                

    "perso" is the key, and the object is the data

  • data Object

    the object to be processed

  • template String

    the HTML templated used to push the data

Returns:

String:

the HTML content after merging with the data

processTheme

() String private static

Defined in jsonvcard.js:313

Process a theme element (json) which has a name and a style

Returns:

String:

path to the template constructed from the theme name, or the dafault one

readFile

(
  • marker
  • url
)
private static

Defined in jsonvcard.js:550

Read a file and push the content into its reserved area in the template. Here, the content is pushed into a global variable containing the template. We can't use the template as an argument, nor return the merged html, because the files call is asynchronious.
A mutex is used so the html code is pushed into the browser once all the files are being processed

Parameters:

  • marker String

    the marker which defines where in the template the content should be pushed

  • url String

    the URL where to find the file

setRelativePath

(
  • path
)
public static

Defined in jsonvcard.js:97

Specifies the relative path of the files called in json file

Parameters:

setStyleName

(
  • name
)
public static

Defined in jsonvcard.js:135

Specifies the style name (the css) and load it

Parameters:

  • name String

    the style's name

setStyleName

(
  • name
)
JsonVCard public static

Defined in jsonvcard.js:122

Specifies the style name (the css)

Parameters:

  • name String

    the style's name

Returns:

JsonVCard:

this object

setThemeName

(
  • name
)
public static

Defined in jsonvcard.js:110

Specifies the theme name

Parameters:

  • name String

    the theme's name

setThemesPath

(
  • path
)
public static

Defined in jsonvcard.js:83

specifies the themes path, in case the themes are not beside the html file

Parameters: