Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Commit 87f9b9f

Browse files
committed
only run the tag search when it's in an iframe
1 parent 8f40a84 commit 87f9b9f

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

source/_patternlab-files/styleguide.mustache

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@
3838
};
3939
4040
// find all links and add an onclick handler for replacing the iframe address so the history works
41-
var aTags = document.getElementsByTagName("a");
42-
for (a in aTags) {
43-
aTags[a].onclick = function(e) {
44-
if (self != top) {
41+
if (self != top) {
42+
var aTags = document.getElementsByTagName("a");
43+
for (a in aTags) {
44+
aTags[a].onclick = function(e) {
4545
e.preventDefault();
4646
window.location.replace(this.getAttribute("href"));
47-
}
48-
};
47+
};
48+
}
4949
}
5050
5151
// watch the iframe source so that it can be sent back to everyone else.

source/_patternlab-files/viewall.mustache

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@
3939
};
4040
4141
// find all links and add an onclick handler for replacing the iframe address so the history works
42-
var aTags = document.getElementsByTagName('a');
43-
for (a in aTags) {
44-
aTags[a].onclick = function(e) {
45-
if (self != top) {
42+
if (self != top) {
43+
var aTags = document.getElementsByTagName('a');
44+
for (a in aTags) {
45+
aTags[a].onclick = function(e) {
4646
e.preventDefault();
4747
window.location.replace(this.getAttribute("href"));
48-
}
49-
};
48+
};
49+
}
5050
}
5151
5252
// watch the iframe source so that it can be sent back to everyone else.

0 commit comments

Comments
 (0)