|
@@ -8,14 +8,25 @@
|
|
|
if (drupalSettings.friendData != null) {
|
|
|
var divs = document.querySelectorAll('.flag-friendship a.use-ajax');
|
|
|
// console.log(divs);
|
|
|
- divs.forEach(function (anchor) {
|
|
|
+ for (let i = 0; i < divs.length; i++) {
|
|
|
+ let anchor = divs[i];
|
|
|
var userId = anchor.href.substring(anchor.href.indexOf('friendship') + 11, anchor.href.indexOf('?destination'));
|
|
|
+ console.log(userId);
|
|
|
JSON.parse(drupalSettings.friendData).forEach(function (friendship) {
|
|
|
if (friendship.uid_target === userId && friendship.uid == drupalSettings.user.uid && friendship.status == 0) {
|
|
|
anchor.innerHTML = 'Friendship Pending';
|
|
|
}
|
|
|
});
|
|
|
- });
|
|
|
+ }
|
|
|
+ // divs.forEach(function (anchor) {
|
|
|
+ // var userId = anchor.href.substring(anchor.href.indexOf('friendship') + 11, anchor.href.indexOf('?destination'));
|
|
|
+ // console.log(userId);
|
|
|
+ // JSON.parse(drupalSettings.friendData).forEach(function (friendship) {
|
|
|
+ // if (friendship.uid_target === userId && friendship.uid == drupalSettings.user.uid && friendship.status == 0) {
|
|
|
+ // anchor.innerHTML = 'Friendship Pending';
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // });
|
|
|
}
|
|
|
|
|
|
feedElement = document.querySelector('.heartbeat-stream');
|