2017-02-20 08:51:24 +01:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var functions = require('../functions.js')
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
|
|
|
parser: function (window, absBasePath) {
|
|
|
|
var anchors = window.document.getElementsByTagName('a')
|
|
|
|
|
|
|
|
for (var i = 0, ilen = anchors.length; i < ilen; i++) {
|
|
|
|
if (anchors[i].getAttribute('href')) {
|
|
|
|
var anchor = anchors[i]
|
|
|
|
var href = anchor.getAttribute('href').trim()
|
2017-02-20 10:09:46 +01:00
|
|
|
|
|
|
|
// Do not touch hrefs which start with a pound sign
|
|
|
|
if (href[0] == '#') continue
|
|
|
|
|
2017-02-20 08:51:24 +01:00
|
|
|
var absoluteURL = functions.resolve(absBasePath, href)
|
|
|
|
|
|
|
|
anchor.setAttribute('href', absoluteURL)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|