~caneypuggies/reformedchurcheslocator/couchapp-backbone

« back to all changes in this revision

Viewing changes to _attachments/js/vendor/modernizr/test/js/dumpdata.js

  • Committer: Tim Black
  • Date: 2013-09-16 22:50:16 UTC
  • Revision ID: tim@alwaysreformed.com-20130916225016-zk8jiba25z33ew7h
Versioned Bower vendor directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function dumpModernizr(){
 
2
  var str = '';
 
3
  dumpModernizr.old = dumpModernizr.old || {};
 
4
 
 
5
    for (var prop in Modernizr) {
 
6
 
 
7
      // skip previously done ones.
 
8
      if (dumpModernizr.old[prop]) continue;
 
9
      else dumpModernizr.old[prop] = true;
 
10
 
 
11
      if (typeof Modernizr[prop] === 'function') continue;
 
12
      // skip unit test items
 
13
      if (/^test/.test(prop)) continue;
 
14
 
 
15
      if (~TEST.inputs.indexOf(prop)) {
 
16
        str += '<li><b>'+prop+'{}</b><ul>';
 
17
        for (var field in Modernizr[prop]) {
 
18
          str += '<li class="' + (Modernizr[prop][field] ? 'yes' : '') + '">' + field + ': ' + Modernizr[prop][field] + '</li>';
 
19
        }
 
20
        str += '</ul></li>';
 
21
      } else {
 
22
        str += '<li  id="'+prop+'" class="' + (Modernizr[prop] ? 'yes' : '') + '">' + prop + ': ' + Modernizr[prop] + '</li>';
 
23
      }
 
24
  }
 
25
  return str;
 
26
}
 
27
 
 
28
 
 
29
function grabFeatDetects(){
 
30
  // thx github.js
 
31
  $.getScript('https://api.github.com/repos/Modernizr/Modernizr/git/trees/master?recursive=1&callback=processTree');
 
32
}
 
33
 
 
34
 
 
35
function processTree(data){
 
36
  var filenames = [];
 
37
 
 
38
  for (var i = 0; i < data.data.tree.length; i++){
 
39
    var file = data.data.tree[i];
 
40
    var match = file.path.match(/^feature-detects\/(.*)/);
 
41
    if (!match) continue;
 
42
 
 
43
    var relpath = location.host == "modernizr.github.com" ?
 
44
                    '../modernizr-git/' : '../';
 
45
 
 
46
    filenames.push(relpath + match[0]);
 
47
  }
 
48
 
 
49
  var jqxhrs = filenames.map(function(filename){
 
50
    return jQuery.getScript(filename);
 
51
  });
 
52
 
 
53
  jQuery.when.apply(jQuery, jqxhrs).done(resultsToDOM);
 
54
 
 
55
}
 
56
 
 
57
function resultsToDOM(){
 
58
 
 
59
  var modOutput = document.createElement('div'),
 
60
      ref = document.getElementById('qunit-testresult') || document.getElementById('qunit-tests');
 
61
 
 
62
  modOutput.className = 'output';
 
63
  modOutput.innerHTML = dumpModernizr();
 
64
 
 
65
  ref.parentNode.insertBefore(modOutput, ref);
 
66
 
 
67
  // Modernizr object as text
 
68
  document.getElementsByTagName('textarea')[0].innerHTML = JSON.stringify(Modernizr);
 
69
 
 
70
}
 
71
 
 
72
/* uno    */ resultsToDOM();
 
73
/* dos    */ grabFeatDetects();
 
74
/* tres   */ setTimeout(resultsToDOM,  5e3);
 
75
/* quatro */ setTimeout(resultsToDOM, 15e3);