Skip to content

Commit

Permalink
Common files: utility.js and mapping-tables.js that works without respec
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-n-cooper committed Jan 19, 2018
1 parent 4a939bd commit 329477c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
22 changes: 17 additions & 5 deletions common/script/mapping-tables.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
var respecEvents = respecEvents || false;
//check for require() and respec context
if (typeof require !== "undefined") {
/* globals $, require */
require(["core/pubsubhub"], function(respecEvents) {
mapTables(respecEvents);
});
} else {
$(document).ready(function() {
mapTables(false);
});
}

(function() {
function mapTables(respecEvents) {

"use strict";

var mappingTableInfos = [];

Expand Down Expand Up @@ -82,7 +94,7 @@ var respecEvents = respecEvents || false;
//remove the tr's @id since same id will be used in the relevant summary element
$row.removeAttr('id');
//store the row's cells in array rowCells
rowCells = [];
var rowCells = [];
//add row cells to array rowCells for use in the details' table
$('td', $row).each(function() {
rowCells.push($(this).html());
Expand Down Expand Up @@ -248,6 +260,6 @@ var respecEvents = respecEvents || false;
});
});
} else {
$(document).ready(mappingTables);
mappingTables();
}
}());
}
15 changes: 15 additions & 0 deletions common/script/utility.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* Utility functions */

// Change the authors credit to mapping contributors credit
// Right now this will run on any author credit, not scoped to AAMs
require(["core/pubsubhub"], function(respecEvents) {
"use strict";
respecEvents.sub('end', function(message) {
if (message === 'core/link-to-dfn') {
document.querySelectorAll("div.head dt").forEach(function(node){
if (node.textContent == "Authors:") node.textContent = "Platform Mapping Maintainers:";
});
}
})
})

0 comments on commit 329477c

Please sign in to comment.