continue;
}
var linkIcon;
+
if (extraIcon.indexOf('.') === -1) {
linkIcon = getSpriteIcon(extraIcon);
} else {
- linkIcon = '<img class="nav-icon" src="data/images/' + extraIcon + '">';
+ if (extraIcon.indexOf('.svg') >= 0) {
+ if (getSpriteIcon('extra-extra' + n) == '') {
+ $.ajax({
+ url: 'data/images/' + extraIcon,
+ type: 'GET',
+ dataType: 'xml',
+ success: function (data) {
+ var svg = $(data).find('svg');
+ var viewbox = $(svg).attr('viewBox');
+ var maing = $(svg).children('g').eq(0);
+ if ($("#extra-extra" + n).length == 0) {
+ $("#svg-container").append('<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="extra-extra' + n + '" viewBox="' + viewbox + '">' + maing.html() + '</symbol></svg>');
+ }
+ $('#spare_extra' + n).replaceWith(getSpriteIcon('extra-extra' + n));
+ },
+ });
+
+ linkIcon = '<div id="spare_extra' + n + '"></div>';
+ } else {
+ linkIcon = getSpriteIcon('extra-extra' + n);
+ }
+ } else {
+ linkIcon = '<img class="nav-icon" src="data/images/' + extraIcon + '">';
+ }
+ }
+
+ if (extraURL.indexOf(':') === -1) {
+ extraURL = 'link:' + extraURL;
}
if (extraURL.indexOf('link:') === 0) {
if (foundLink == undefined) {
continue;
}
+ console.log(foundLink);
link = $(foundLink).find('a').append(linkIcon);
if (navType == 'menu') {
var tooltip = $(link).data('tooltip');
$(link).append('<span class="menu-item-title">' + $(link).data('tooltip') + '</span>');
}
+
link = $(link).get(0).outerHTML;
}
iconSymbol = $('svg symbol#' + icon);
if (iconSymbol.length == 0) {
- console.warn('Unable to find sprite icon: ' + icon);
+ //console.warn('Unable to find sprite icon: ' + icon);
return ''; // Bail out because symbol doesn't exist
}