site/js/docurium.js in docurium-0.0.3 vs site/js/docurium.js in docurium-0.0.4

- old
+ new

@@ -8,11 +8,11 @@ this.loadVersions() }, loadVersions: function() { $.getJSON("project.json", function(data) { - docurium.set({'versions': data.versions, 'github': data.github, 'signatures': data.signatures, 'name': data.name}) + docurium.set({'versions': data.versions, 'github': data.github, 'signatures': data.signatures, 'name': data.name, 'groups': data.groups}) if(data.name) { $('#site-title').text(data.name + ' API') document.title = data.name + ' API' } docurium.setVersionPicker() @@ -98,15 +98,22 @@ } content.append(list) } }, + getGroup: function(gname) { + var groups = docurium.get('data')['groups'] + for(var i in groups) { + if(groups[i][0] == gname) { + return groups[i] + } + } + }, + showFun: function(gname, fname) { - id = '#groupItem' + gname - ref = parseInt($(id).attr('ref')) + group = docurium.getGroup(gname) - group = docurium.get('data')['groups'][ref] fdata = docurium.get('data')['functions'] gname = group[0] functions = group[1] content = $('.content') @@ -198,11 +205,11 @@ content.append(also) } // Show other functions in this group also = $('<div>').addClass('also') - flink = $('<a href="#" ref="' + ref.toString() + '" id="groupItem' + group[0] + '">' + group[0] + '</a>') + flink = $('<a href="#' + docurium.get('version') + '/group/' + group[0] + '">' + group[0] + '</a>') flink.click( docurium.showGroup ) also.append("Also in ") also.append(flink) also.append(" group: <br/>") @@ -257,18 +264,20 @@ for(var i in versions) { version = versions[i] content.append($('<h3>').append(version)) cl = $('<div>').addClass('changelog') + console.log(version) + for(var type in changelog[version]) { adds = changelog[version][type] adds.sort() addsection = $('<p>') for(var j in adds) { add = adds[j] - gname = docurium.groupOf(add) if(type != 'deletes') { + gname = docurium.groupOf(add) addlink = $('<a>').attr('href', '#' + groupLink(gname, add, version)).append(add) } else { addlink = add } addsection.append($('<li>').addClass(type).append(addlink)) @@ -390,13 +399,12 @@ text = text.replace(re, link) } return text }, - groupHash: false, groupOf: function (func) { - return this.get('data').functions[func].group + return this.get('groups')[func] }, addHotlinks: function() { types = this.get('data')['types'] for(var i=0; i<types.length; i++) { @@ -486,10 +494,10 @@ }, this) filelist.hide() menu.append(filelist) // Examples List - if(data['examples'].length > 0) { + if(data['examples'] && (data['examples'].length > 0)) { title = $('<h3><a href="#">Examples</a></h3>').click( this.collapseSection ) menu.append(title) filelist = $('<ul>') _.each(data['examples'], function(file) { fname = file[0]