Sync wiki article urls with main site
This commit is contained in:
@ -2,10 +2,19 @@ extends ../layout-wide
|
|||||||
block content
|
block content
|
||||||
iframe#wikiFrame(frameborder='no')
|
iframe#wikiFrame(frameborder='no')
|
||||||
script.
|
script.
|
||||||
|
var wikiUrl = '//freecodecamp.github.io/wiki';
|
||||||
|
var wikiOrigin = /https?:\/\/freecodecamp.github.io/;
|
||||||
var requestedPath = !{JSON.stringify(path) || ''};
|
var requestedPath = !{JSON.stringify(path) || ''};
|
||||||
var lang = window.location.toString().match(/\/\w{2}\//);
|
var lang = window.location.toString().match(/\/\w{2}\//);
|
||||||
lang = (lang) ? lang[0] : '/en/';
|
lang = (lang) ? lang[0] : '/en/';
|
||||||
$('#wikiFrame').attr(
|
$('#wikiFrame').attr(
|
||||||
'src',
|
'src',
|
||||||
'//freecodecamp.github.io/wiki' + (requestedPath ? requestedPath : lang)
|
wikiUrl + (requestedPath ? requestedPath : lang)
|
||||||
);
|
);
|
||||||
|
window.addEventListener('message', function(e) {
|
||||||
|
if (!wikiOrigin.test(e.origin)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
history.replaceState(history.state, null, e.data);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
Reference in New Issue
Block a user