2018-04-13 15:45:26 +00:00
|
|
|
import { visitUrl } from './lib/utils/url_utility';
|
|
|
|
|
2017-03-30 17:31:59 +00:00
|
|
|
/**
|
|
|
|
* Helper function that finds the href of the fiven selector and updates the location.
|
|
|
|
*
|
|
|
|
* @param {String} selector
|
|
|
|
*/
|
2018-04-13 15:45:26 +00:00
|
|
|
export default function findAndFollowLink(selector) {
|
2018-04-13 06:38:19 +00:00
|
|
|
const element = document.querySelector(selector);
|
|
|
|
const link = element && element.getAttribute('href');
|
2017-03-30 17:31:59 +00:00
|
|
|
|
|
|
|
if (link) {
|
2018-04-13 15:45:26 +00:00
|
|
|
visitUrl(link);
|
2017-03-30 17:31:59 +00:00
|
|
|
}
|
2018-04-13 15:45:26 +00:00
|
|
|
}
|