Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved C2P Script Injection #528

Merged
merged 11 commits into from Apr 28, 2020

remove early return when iterating through social icons

  • Loading branch information
christophertino committed Apr 23, 2020
commit d708e94173677e22e018c58812f5aaaf0123f6d0
@@ -120,7 +120,7 @@ const Click2PlayContentScript = (function(win, doc) {
const applyC2P = function(app_id, c2p_app, html) {
c2p_app.forEach((c2pAppDef, idx) => {
const els = doc.querySelectorAll(c2pAppDef.ele);
for (let i = 0, num_els = els.length; i < num_els; i++) {
for (let i = 0; i < els.length; i++) {
const el = els[i];
const c2pFrame = createEl('iframe');

@@ -131,14 +131,13 @@ const Click2PlayContentScript = (function(win, doc) {
if ((c2pAppDef.attach && c2pAppDef.attach === 'parentNode') || (el.nodeName === 'IFRAME')) {
if (el.parentNode && el.parentNode.nodeName !== 'BODY' && el.parentNode.nodeName !== 'HEAD') {
el.parentNode.replaceChild(c2pFrame, el);
return;
}
} else {
// Replace existing node with C2P content
el.textContent = '';
el.style.display = 'inline-block';
appendChild(el, c2pFrame);
}

// Replace existing node with C2P content
el.textContent = '';
el.style.display = 'inline-block';
appendChild(el, c2pFrame);
}
});
};
ProTip! Use n and p to navigate between commits in a pull request.