diff --git a/components/html/popup.html b/components/html/popup.html
index bc1715c..e8ffc6b 100644
--- a/components/html/popup.html
+++ b/components/html/popup.html
@@ -14,7 +14,6 @@
Linkedin boost
-
diff --git a/components/js/content.js b/components/js/content.js
index a618b3b..35e23e7 100644
--- a/components/js/content.js
+++ b/components/js/content.js
@@ -1,5 +1,9 @@
const contactsNumOnOnePage = 15, numberOfRepeat = 5;
+function isPageNewLinkedin () {
+ return window.location.href.indexOf('linkedin.com/mynetwork') + 1;
+}
+
function sendMessageToBackground (obj) {
chrome.runtime.sendMessage(obj);
}
@@ -15,7 +19,7 @@ function addContacts(height, countOfPagesScrolled) {
} else {
sendRequest();
}
- }, 1500);
+ }, 2000);
}
function scrollDown(height, countOfPagesScrolled){
@@ -27,18 +31,37 @@ function sendRequest(){
var contactsNum = 1;
var addedContacts = [];
- eachContactsList(function() {
- jQuery(this).click();
+ if (isPageNewLinkedin()) {
+ eachContactsList(function() {
+ jQuery(this).click();
+
+ addedContacts[contactsNum] = {
+ initials: jQuery(this).parents('.mn-person-card.pymk-card')
+ .find('.mn-person-info__name.mn-person-info--has-hover')
+ .text(),
+ title: jQuery(this).parents('.mn-person-card.pymk-card')
+ .find('.mn-person-info__occupation')
+ .text(),
+ img: jQuery(this).parents('.mn-person-card.pymk-card').find('.mn-person-info__picture.ember-view > img').attr('src'),
+ link: jQuery(this).parents('.mn-person-card.pymk-card').find('.mn-person-info__picture.ember-view').attr('href')
+ };
+
+ contactsNum++;
+ });
+ } else {
+ eachContactsList(function() {
+ jQuery(this).click();
- addedContacts[contactsNum] = {
- initials: jQuery(this).parents('.card-wrapper').find('.picture img').attr('alt'),
- title: jQuery(this).parents('.card-wrapper').find('.headline > span').attr('title'),
- img: jQuery(this).parents('.card-wrapper').find('.picture img').attr('src'),
- link: jQuery(this).parents('.card-wrapper').find('.picture a').attr('href')
- };
+ addedContacts[contactsNum] = {
+ initials: jQuery(this).parents('.card-wrapper').find('.picture img').attr('alt'),
+ title: jQuery(this).parents('.card-wrapper').find('.headline > span').attr('title'),
+ img: jQuery(this).parents('.card-wrapper').find('.picture img').attr('src'),
+ link: jQuery(this).parents('.card-wrapper').find('.picture a').attr('href')
+ };
- contactsNum++;
- });
+ contactsNum++;
+ });
+ }
sendMessageToBackground({
action: 'added_contacts',
@@ -75,7 +98,11 @@ function onRequest(request, sender, sendResponse) {
}
function eachContactsList(callback) {
- jQuery.each( jQuery('.card-wrapper .bt-request-buffed'), callback);
+ if (isPageNewLinkedin()) {
+ jQuery.each( jQuery('.mn-person-card__person-btn-ext.button-secondary-medium'), callback);
+ } else {
+ jQuery.each( jQuery('.card-wrapper .bt-request-buffed'), callback);
+ }
}
function getInvitedNumber (filters) {
@@ -85,10 +112,20 @@ function getInvitedNumber (filters) {
var filter = filters[key];
eachContactsList(function() {
- if (isSearchedInString(jQuery(this).parents('.card-wrapper').find('.headline > span').attr('title'), filter)) {
- numberFoundContacts++;
+ if (isPageNewLinkedin()) {
+ if (isSearchedInString(jQuery(this).parents('.mn-person-card.pymk-card')
+ .find('.mn-person-info__occupation')
+ .text(), filter)) {
+ numberFoundContacts++;
+ } else {
+ jQuery(this).parents('.mn-person-card.pymk-card').remove();
+ }
} else {
- jQuery(this).parents('.pymk-card').remove();
+ if (isSearchedInString(jQuery(this).parents('.card-wrapper').find('.headline > span').attr('title'), filter)) {
+ numberFoundContacts++;
+ } else {
+ jQuery(this).parents('.pymk-card').remove();
+ }
}
});
}
diff --git a/components/js/popup.js b/components/js/popup.js
index 4560142..eae822f 100644
--- a/components/js/popup.js
+++ b/components/js/popup.js
@@ -12,7 +12,7 @@ function isTabLinkedin (tab) {
}
function isTabLinkedinPymk (tab) {
- return tab.url.indexOf('linkedin.com/people/pymk') + 1;
+ return (tab.url.indexOf('linkedin.com/people/pymk') + 1) || (tab.url.indexOf('linkedin.com/mynetwork') + 1);
}
function sendMessageForAddContacts (tab, contactsNumber, filters) {
diff --git a/manifest.json b/manifest.json
index 5e8f2ca..29ff70e 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Linkedin Boost",
"description": "This Chrome extension helps you to add new contacts in the social network LinkedIn",
- "version": "0.3",
+ "version": "0.4",
"default_locale": "en",
"icons": {
"128": "components/icon.png"
@@ -19,7 +19,7 @@
"storage"
],
"content_scripts": [{
- "matches": ["*://www.linkedin.com/people/pymk/*", "*://www.linkedin.com/people/pymk?*"],
+ "matches": ["*://www.linkedin.com/people/pymk/*", "*://www.linkedin.com/people/pymk?*", "*://www.linkedin.com/mynetwork*"],
"js": ["bower_components/jquery/dist/jquery.min.js", "components/js/class.localstorage.js", "components/js/content.js"]
}]
}