Skip to content

Instantly share code, notes, and snippets.

@edwinestrada
Last active September 15, 2017 06:43
Show Gist options
  • Save edwinestrada/dfd8a1ae601f68debaae7f47eb3c3a9c to your computer and use it in GitHub Desktop.
Save edwinestrada/dfd8a1ae601f68debaae7f47eb3c3a9c to your computer and use it in GitHub Desktop.
Link switcher
var firstOldLink = 'http://www.frontlinesol.com/ideas/childrens-defense-fund-new-york';
var firstNewLink = 'http://www.frontlinesol.com/portfolio-item/strategy-and-planning-process';
var secondOldLink = 'http://www.frontlinesol.com/ideas/under-construction';
var secondNewLink = 'http://www.frontlinesol.com/portfolio-item/under-construction';
var thirdOldLink = 'http://www.frontlinesol.com/ideas/school-discipline-reform';
var thirdNewLink = 'http://www.frontlinesol.com/portfolio-item/michigan-racial-equity';
var a = document.querySelectorAll('a[href="' + firstOldLink + '"]');
if (a.length) {
[].forEach.call(a, function(link) {
link.setAttribute('href', firstNewLink)
});
}
var b = document.querySelectorAll('a[href="' + secondOldLink + '"]');
if (b.length) {
[].forEach.call(b, function(link) {
link.setAttribute('href', secondNewLink)
});
}
var c = document.querySelectorAll('a[href="' + thirdOldLink + '"]');
if (c.length) {
[].forEach.call(c, function(link) {
link.setAttribute('href', thirdNewLink)
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment