From 702d0b38304105888a7d0324b45883f892fc0c58 Mon Sep 17 00:00:00 2001
From: double-beep <38133098+double-beep@users.noreply.github.com>
Date: Sun, 18 Jul 2021 09:20:31 +0000
Subject: [PATCH 1/2] FIX: rename class flag-post-link to js-flag-post-link
SE has prepended 'js-' to the class name as can be seen by the post menu
---
Flag-from-User-Pages/Flag_from_User_Pages.user.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Flag-from-User-Pages/Flag_from_User_Pages.user.js b/Flag-from-User-Pages/Flag_from_User_Pages.user.js
index bfd51c6..4770946 100644
--- a/Flag-from-User-Pages/Flag_from_User_Pages.user.js
+++ b/Flag-from-User-Pages/Flag_from_User_Pages.user.js
@@ -30,15 +30,15 @@
['question', 'answer'].forEach((type) => {
$('a.' + type + '-hyperlink').each(function() {
const $this = $(this);
- const currentFlag = $this.parent().find('.flag-post-link');
+ const currentFlag = $this.parent().find('.js-flag-post-link');
if (!currentFlag.length) {
const href = $this.attr('href');
if (href) {
const matches = type === 'answer' ? href.match(/^.*#(\d+)$/) : href.match(/^\/q(?:uestions)?\/(\d+)\/.*$/);
if (matches && matches[1]) {
const postId = matches[1];
- $this.before('⚑').css('display', 'inline');
- $this.parent().find('.flag-post-link').data({
+ $this.before('⚑').css('display', 'inline');
+ $this.parent().find('.js-flag-post-link').data({
postid: postId,
loadedTimestamp: now,
});
From 204bf279e179b8c56416c37dfc5b004555de9fee Mon Sep 17 00:00:00 2001
From: double-beep <38133098+double-beep@users.noreply.github.com>
Date: Sun, 18 Jul 2021 09:25:49 +0000
Subject: [PATCH 2/2] FIX: rename attribute data-postid to data-post-id
See the getPostId() function in full.en.js: https://dev.stackoverflow.com/content/Js/full.en.js
---
Flag-from-User-Pages/Flag_from_User_Pages.user.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Flag-from-User-Pages/Flag_from_User_Pages.user.js b/Flag-from-User-Pages/Flag_from_User_Pages.user.js
index 4770946..9719a46 100644
--- a/Flag-from-User-Pages/Flag_from_User_Pages.user.js
+++ b/Flag-from-User-Pages/Flag_from_User_Pages.user.js
@@ -37,9 +37,9 @@
const matches = type === 'answer' ? href.match(/^.*#(\d+)$/) : href.match(/^\/q(?:uestions)?\/(\d+)\/.*$/);
if (matches && matches[1]) {
const postId = matches[1];
- $this.before('⚑').css('display', 'inline');
+ $this.before('⚑').css('display', 'inline');
$this.parent().find('.js-flag-post-link').data({
- postid: postId,
+ 'post-id': postId,
loadedTimestamp: now,
});
}