Skip to content

Commit

Permalink
Make meta extraction function usable elsewhere
Browse files Browse the repository at this point in the history
  • Loading branch information
patridge committed Jun 25, 2020
1 parent b9e2d5b commit 33bb21a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions get-docs-metadata.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// NOTE: Had to stuff everything in this immediately executing function to avoid duplicate declaration errors when this script was run every time the pop-up was loaded. Probably a better way to handle this, though.
(async function () {
// storageLocalRemoveAsync([ location ]);
let getCurrentPageMetadata = function () {
let metaTags = document.getElementsByTagName("meta");
let getCurrentPageMetadata = function (rootElement) {
let metaTags = rootElement.getElementsByTagName("meta");
let uidTag = [...metaTags].filter(meta => meta.getAttribute("name") === "uid")[0];
let uid = uidTag ? uidTag.getAttribute("content") : "";
let msAuthorTag = [...metaTags].filter(meta => meta.getAttribute("name") === "ms.author")[0];
Expand Down Expand Up @@ -69,6 +69,6 @@
);
};

var pageMetadata = getCurrentPageMetadata();
var pageMetadata = getCurrentPageMetadata(document);
sendPopUpUpdateRequest(pageMetadata);
})();

0 comments on commit 33bb21a

Please sign in to comment.