File: view-color-information.js

package info (click to toggle)
webdeveloper 1.2.5%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,364 kB
  • ctags: 1,608
  • sloc: makefile: 10
file content (48 lines) | stat: -rw-r--r-- 1,423 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
var WebDeveloper = WebDeveloper || {};

WebDeveloper.Generated = WebDeveloper.Generated || {};

// Initializes the page with data
WebDeveloper.Generated.initialize = function(data, locale)
{
  var colorDescription = null;
  var colorInformation = locale.colorInformation;
  var colorsLength     = null;
  var container        = null;
  var content        = document.getElementById("content");
  var contentDocument  = null;
  var documents        = data.documents;

  WebDeveloper.Generated.emptyContent();
  WebDeveloper.Generated.localizeHeader(locale);
  WebDeveloper.Generated.setPageTitle(colorInformation, data, locale);

  // Loop through the documents
  for(var i = 0, l = documents.length; i < l; i++)
  {
    colorDescription = locale.colors.toLowerCase();
    contentDocument  = documents[i];
    colorsLength     = contentDocument.colors.length;

    // If there is only one anchor
    if(colorsLength == 1)
    {
      colorDescription = locale.color.toLowerCase();
    }

    WebDeveloper.Generated.addDocument(contentDocument.url, i, colorDescription, colorsLength);

    // If there are colors
    if(colorsLength > 0)
    {
      container = WebDeveloper.Generated.generateDocumentContainer();

      $(container).append(ich.colors(contentDocument, true));
      content.appendChild(container);
    }

    WebDeveloper.Generated.addSeparator();
  }

  WebDeveloper.Generated.initializeCommonElements();
};