File: find-duplicate-ids.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 (59 lines) | stat: -rw-r--r-- 1,647 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
49
50
51
52
53
54
55
56
57
58
59
var WebDeveloper = WebDeveloper || {};

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

// Initializes the page with data
WebDeveloper.Generated.initialize = function(data, locale)
{
  var content         = document.getElementById("content");
  var contentDocument = null;
  var documents       = data.documents;
  var duplicateIds    = locale.duplicateIds;
  var idDescription   = null;
  var ids             = null;
  var idsLength       = null;
  var list            = null;
  var listElement     = null;
  var url             = null;

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

  // Loop through the documents
  for(var i = 0, l = documents.length; i < l; i++)
  {
    contentDocument = documents[i];
    idDescription   = duplicateIds.toLowerCase();
    ids             = contentDocument.ids;
    idsLength       = ids.length;
    url             = contentDocument.url;

    // If there is only one image
    if(idsLength == 1)
    {
      idDescription = locale.duplicateId;
    }

    WebDeveloper.Generated.addDocument(contentDocument.url, i, idDescription, idsLength);

    // If there are duplicate ids
    if(idsLength > 0)
    {
      list        = document.createElement("ol");
      listElement = $(list);

      // Loop through the ids
      for(var j = 0; j < idsLength; j++)
      {
        $(list).append(ich.duplicateId({ "id": ids[j], "url": url }));
      }

      content.appendChild(list);
    }

    WebDeveloper.Generated.addSeparator();
  }

  WebDeveloper.Generated.initializeCommonElements();
};