altinn-designsystem
Version:
Altinn Design system based on Pattern Lab.
16 lines (15 loc) • 721 B
JavaScript
/* globals $ */
var fixPatternLinks = function() {
if (window.location.pathname.indexOf('DesignSystem') === 1) {
$('a').each(function() {
if (typeof $(this).attr('href') !== typeof undefined && $(this).attr('href') !== false && $(this).attr('href').indexOf('DesignSystem') === -1) {
$(this).attr('href', $(this).attr('href').replace('/patterns/', '/DesignSystem/public/patterns/'));
}
});
$('*[onclick]').each(function() {
if ($(this).attr('onclick').indexOf('location.href=\'/patterns/') > -1) {
$(this).attr('onclick', $(this).attr('onclick').replace('location.href=\'/patterns/', 'location.href=\'/DesignSystem/public/patterns/'));
}
});
}
};