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