From af47997763a96d26ac22be3abda24361c4d596e1 Mon Sep 17 00:00:00 2001 From: Jakub Niewiarowski Date: Sat, 15 Jul 2017 19:28:55 +0200 Subject: [PATCH 1/5] Firefox compatibility. --- assets/js/follow-me-or-not.js | 6 +++--- manifest.json | 20 +++++++------------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/assets/js/follow-me-or-not.js b/assets/js/follow-me-or-not.js index 415b642..ba5a2de 100644 --- a/assets/js/follow-me-or-not.js +++ b/assets/js/follow-me-or-not.js @@ -5,14 +5,14 @@ * @Last Modified time: 2016-09-17 11:53:32 */ -$(document).ready(function(){ +$(function(){ var username_a = $('meta[name=user-login]').attr("content").trim(); var username_b = $("meta[property='profile:username']").attr("content").trim(); var url = "https://api.github.com/users/" + username_b + "/following/" + username_a; var new_text = username_b + "
FOLLOWS YOU"; - // if "username_a" is empty, user is not logged in - // is "username_b" is empty, it is not user page + // if "username_a" is empty, user is not logged in + // is "username_b" is empty, it is not user page if(username_a != "" && username_b != "" && username_a != username_b){ $.ajax({ url : url, diff --git a/manifest.json b/manifest.json index 492cd86..0a97517 100644 --- a/manifest.json +++ b/manifest.json @@ -4,28 +4,22 @@ "name": "Follow Me or Not", "description": "Check if the GitHub profile you are visiting, follows you or not in a Twitter-like UI", "short_name": "Follow Me or Not", - "version": "1.0.0.1", + "version": "1.0.0.2", "author": "Prabhakar Gupta", "homepage_url": "https://github.com/mkstn/follow-me-or-not", - "browser_action": { - "default_title": "Follow Me or Not", - "default_icon": "assets/images/icon.png" - }, - "icons": { - "16": "assets/images/icon.png", - "48": "assets/images/icon.png", - "128": "assets/images/icon.png" + "256": "assets/images/icon.png" }, - "permissions": ["activeTab"], - + "permissions": [ + "*://api.github.com/*" + ], + "content_scripts": [ { "matches": [ - "https://github.com/*", - "http://github.com/*" + "*://github.com/*", ], "js": [ "assets/js/jquery.min.js", From 976b1432c58878407b41d6964bd5c1f55ab6c5ce Mon Sep 17 00:00:00 2001 From: Jakub Niewiarowski Date: Sat, 15 Jul 2017 19:35:46 +0200 Subject: [PATCH 2/5] updated header. --- assets/js/follow-me-or-not.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/js/follow-me-or-not.js b/assets/js/follow-me-or-not.js index ba5a2de..0a882d7 100644 --- a/assets/js/follow-me-or-not.js +++ b/assets/js/follow-me-or-not.js @@ -1,8 +1,8 @@ /* * @Author: prabhakar * @Date: 2016-08-14 02:20:23 -* @Last Modified by: Prabhakar Gupta -* @Last Modified time: 2016-09-17 11:53:32 +* @Last Modified by: Kuba Niewiarowski +* @Last Modified time: 2017-07-15 19:35:32 */ $(function(){ From 5aa6b9b513128621445b99d38538bde10fd8cb78 Mon Sep 17 00:00:00 2001 From: Jakub Niewiarowski Date: Sat, 15 Jul 2017 20:02:27 +0200 Subject: [PATCH 3/5] fix. --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 0a97517..5d4266e 100644 --- a/manifest.json +++ b/manifest.json @@ -19,7 +19,7 @@ "content_scripts": [ { "matches": [ - "*://github.com/*", + "*://github.com/*" ], "js": [ "assets/js/jquery.min.js", From 9593f6bea5dab695493edf61ebc476d0669f86f2 Mon Sep 17 00:00:00 2001 From: Jakub Niewiarowski Date: Sun, 16 Jul 2017 05:09:43 +0200 Subject: [PATCH 4/5] .gitignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6311779 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +web-ext-artifacts/ From e205dc78919e5fff5161ee0c7a8d2ee882723162 Mon Sep 17 00:00:00 2001 From: Jakub Niewiarowski Date: Sun, 16 Jul 2017 05:10:36 +0200 Subject: [PATCH 5/5] pjax page update support. --- assets/js/follow-me-or-not.js | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/assets/js/follow-me-or-not.js b/assets/js/follow-me-or-not.js index 0a882d7..7bad5ed 100644 --- a/assets/js/follow-me-or-not.js +++ b/assets/js/follow-me-or-not.js @@ -6,19 +6,25 @@ */ $(function(){ - var username_a = $('meta[name=user-login]').attr("content").trim(); - var username_b = $("meta[property='profile:username']").attr("content").trim(); - var url = "https://api.github.com/users/" + username_b + "/following/" + username_a; - var new_text = username_b + "
FOLLOWS YOU"; + function process() { + var username_a = $('meta[name=user-login]').attr("content").trim(); + var username_b = $("meta[property='profile:username']").attr("content").trim(); + var url = "https://api.github.com/users/" + username_b + "/following/" + username_a; + var new_text = username_b + "
FOLLOWS YOU"; - // if "username_a" is empty, user is not logged in - // is "username_b" is empty, it is not user page - if(username_a != "" && username_b != "" && username_a != username_b){ - $.ajax({ - url : url, - success : function(data){ - $("span.vcard-username").html(new_text); - }, - }); + // if "username_a" is empty, user is not logged in + // is "username_b" is empty, it is not user page + if(username_a != "" && username_b != "" && username_a != username_b){ + $.ajax({ + url : url, + success : function(data){ + $("span.vcard-username").html(new_text); + }, + }); + } } + + process(); + + $(document).on('pjax:success', process); });