Javascript to change web hyperlinks
Hi Guys,
Currently using sharetribe to host a marketplace with a separate landing page on wordpress as follows:
Sharetribe:
https://listings.quipmo.com/
Wordpress:
http://quipmo.com/
We are able to insert custom css and java into an editor section in sharetribe and previously used the below code to change the hyperlink reference of different sections of the website back to the wordpress site.
Code:
<script>
window.onload = function() {
$('header a[href="/"]').click(function(e) {
e.preventDefault();
self.location = "https://quipmo.com/";
});
$('header a[href="/en/user_feedbacks/new"]').click(function(e) {
e.preventDefault();
self.location = "http://quipmo.com/contact-us/";
});
$('header a[href="/en/infos/about"]').click(function(e) {
e.preventDefault();
self.location = "http://quipmo.com/bit-about-us/";
});
$('header .header-toggle-menu-menu a').each(function(index) {
if($(this).text().trim() == 'Browse Listings') {
$(this).attr('target','_self')
$(this).insertBefore($('header .header-toggle-menu-menu a:eq(1)'))
}
if($(this).text().trim() == 'About') {
$(this).attr('target','_self')
$(this).insertBefore($('header .header-toggle-menu-menu a:eq(2)'))
}
if($(this).text().trim() == 'Trust and Safety') {
$(this).attr('target','_self')
$(this).insertBefore($('header .header-toggle-menu-menu a:eq(3)'))
}
if($(this).text().trim() == 'Standards and Expectations') {
$(this).attr('target','_self')
$(this).insertBefore($('header .header-toggle-menu-menu a:eq(4)'))
}
if($(this).text().trim() == 'Help Centre') {
$(this).attr('target','_self')
$(this).insertBefore($('header .header-toggle-menu-menu a:eq(5)'))
}
if($(this).text().trim() == 'FAQs') {
$(this).attr('target','_self')
$(this).insertBefore($('header .header-toggle-menu-menu a:eq(6)'))
}
})
}
</script>
Unfortunately sharetribe recently changed its layout/code and the above code now no-longer works.
Hoping someone might be able to point us in the right direction to get it working again?
Cheers
Re: Javascript to change web hyperlinks
Well, if they made code changes, you would have to know exactly what changes they made. Did they implement JavaScript that is loading after your scripting? If so, that limits you without creating timers or events.