Skip to content

Commit

Permalink
assign url_for_main to a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
avivkeller committed Feb 29, 2024
1 parent c88406e commit 2a0b999
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions templates/default/fulldoc/html/frames.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
<title><%= options.title %></title>
</head>
<script type="text/javascript">
var mainUrl = '<%= url_for_main %>'
try {
var match = decodeURIComponent(window.location.hash).match(/^#!(.+)/);
var name = match ? match[1] : '<%= url_for_main %>';
var name = match ? match[1] : mainUrl;
var url = new URL(name, location.href);
window.top.location.replace(url.origin === location.origin ? name : '<%= url_for_main %>');
window.top.location.replace(url.origin === location.origin ? name : mainUrl);
} catch (e) {
window.top.location.replace('<%= url_for_main %>');
window.top.location.replace(mainUrl);
}
</script>
<noscript>
Expand Down

0 comments on commit 2a0b999

Please sign in to comment.