Commit 5a5e3fe7 authored by  JosephK's avatar JosephK
Browse files

Bad index = duplicate iframe

parent a5eb546a
Pipeline #42868 passed with stages
in 45 seconds
...@@ -285,8 +285,10 @@ ...@@ -285,8 +285,10 @@
addIframes() { addIframes() {
const scripts = document.getElementsByTagName('script'); const scripts = document.getElementsByTagName('script');
let j = 0;
for (let i = 0; i < scripts.length; i += 1) { for (let i = 0; i < scripts.length; i += 1) {
if (scripts[i].getAttribute('data-sense3')) { if (scripts[i].getAttribute('data-sense3')) {
j += 1;
let [format, tags, colors, id] = scripts[i].getAttribute('data-sense3').split(';'); let [format, tags, colors, id] = scripts[i].getAttribute('data-sense3').split(';');
format = format || '300x250'; format = format || '300x250';
tags = tags || ''; tags = tags || '';
...@@ -305,9 +307,9 @@ ...@@ -305,9 +307,9 @@
iframe.style = `width: ${w}px; height: ${h}px; border: none;`; iframe.style = `width: ${w}px; height: ${h}px; border: none;`;
iframe.src = `${sense3Baseurl}sense3.html#${s.pageLang()};${tags};${colors};${id};${referrer}`; iframe.src = `${sense3Baseurl}sense3.html#${s.pageLang()};${tags};${colors};${id};${referrer}`;
iframe.className = 'sense3'; iframe.className = 'sense3';
iframe.id = `sense3_${i}`; iframe.id = `sense3_${j}`;
if (!document.getElementById(`sense3_${i}`)) { if (!document.getElementById(`sense3_${j}`)) {
scripts[i].parentNode.insertBefore(iframe, scripts[i].nextSibling); scripts[j].parentNode.insertBefore(iframe, scripts[j].nextSibling);
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment