Open maxxcrawford opened 5 years ago
Code cleanup:
function detectFacebookLoginButton () {
// TODO: Refactor detectFacebookLoginButton to add HTML badge instead of class/psudeo element
// Test for standard implementation (Example: Facebook Docs)
const loginButton = document.querySelectorAll(".fb-login-button");
for (let item of loginButton) {
const fbcClassResetArr = ["fbc-overlay-small", "fbc-overlay"];
const replacementClassArr = ["fbc-loginButton"];
replacementClassArr.push("fbc-size-" + item.getAttribute("data-size"));
replacementClassArr.push("fbc-button-type-" + item.getAttribute("data-button-type"));
// Remove previous detection classes
item.classList.remove(...fbcClassResetArr);
// Add declared size values
item.classList.add(...replacementClassArr);
// Remeasure elements and add correct badge size
item.classList.add(...itemWidthCheck(item));
}
}
Issues for this include:
Part of previous PR #266:
Notes
Needing to setup similar attribute detection for Like and Share buttons from the FB docs:
Example Screenshots