Skip to content
Snippets Groups Projects

bugfix: fixing twitter and email share that I destroyed before

Merged Benoit Alessandroni requested to merge bugfix/style-list into master
1 file
+ 15
16
Compare changes
  • Side-by-side
  • Inline
+ 15
16
@@ -551,18 +551,22 @@ document.addEventListener("DOMContentLoaded", event => {
@@ -551,18 +551,22 @@ document.addEventListener("DOMContentLoaded", event => {
});
});
//Set the share links
//Set the share links
document.querySelectorAll(".twitter-link")[0].addEventListener("populate", function (e) {
document.querySelectorAll(".twitter-link").forEach( shareLink => {
var regexContributor = /contributor/g
shareLink.addEventListener("populate", function (e) {
var regexSearcher = /searcher/g
var regexContributor = /contributor/g
var valUrl = window.location.href.replace(regexContributor, 'public').replace(regexSearcher, 'public')
var regexSearcher = /searcher/g
console.log("urls are",valUrl);
var valUrl = window.location.href.replace(regexContributor, 'public').replace(regexSearcher, 'public')
$('.twshare').attr("href", "https://twitter.com/intent/tweet?text=Check%20this%20resource%20from%20Coopedia%20:%20&original_referer="+valUrl+"&ref_src=twsrc%5Etfw&tw_p=tweetbutton&amp&url="+valUrl+"&");
shareLink.querySelector('.twshare').setAttribute("href", "https://twitter.com/intent/tweet?text=Check%20this%20resource%20from%20Coopedia%20:%20&original_referer="+valUrl+"&ref_src=twsrc%5Etfw&tw_p=tweetbutton&amp&url="+valUrl+"&");
 
});
});
});
document.querySelectorAll(".email-link")[0].addEventListener("populate", function (e) {
var regexContributor = /contributor/g
document.querySelectorAll(".email-link").forEach( emailLink => {
var regexSearcher = /searcher/g
emailLink.addEventListener("populate", function (e) {
var valUrl = window.location.href.replace(regexContributor, 'public').replace(regexSearcher, 'public')
var regexContributor = /contributor/g
document.querySelectorAll('.emshare')[0].setAttribute("href", "mailto:?subject=Coopedia%20shared%20resource&body=I%20share%20you%20this%20resource%20from%20Coopedia%20:%20" + valUrl);
var regexSearcher = /searcher/g
 
var valUrl = window.location.href.replace(regexContributor, 'public').replace(regexSearcher, 'public')
 
emailLink.querySelector('.emshare').setAttribute("href", "mailto:?subject=Coopedia%20shared%20resource&body=I%20share%20you%20this%20resource%20from%20Coopedia%20:%20" + valUrl);
 
});
});
});
//Refresh pagination
//Refresh pagination
@@ -619,11 +623,6 @@ document.addEventListener("DOMContentLoaded", event => {
@@ -619,11 +623,6 @@ document.addEventListener("DOMContentLoaded", event => {
});
});
}
}
//Manage the twitter button
$("#shareByTwitter").on("populate", function (e) {
var valUrl = window.location.href;
$('.twshare').attr("href", "https://twitter.com/intent/tweet?original_referer=http%3A%2F%2F127.0.0.1%3A3000%2Fevenements&ref_src=twsrc%5Etfw&tw_p=tweetbutton&url=" + valUrl + "&");
});
//Manage the logout action
//Manage the logout action
manageLogoutButton();
manageLogoutButton();
Loading