Skip to content

Commit 217f7f7

Browse files
committed
Deprecate markEmployees
This feature is now native! See https://meta.stackexchange.com/q/310518.
1 parent 6f624b5 commit 217f7f7

File tree

3 files changed

+1
-56
lines changed

3 files changed

+1
-56
lines changed

sox.features.info.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,6 @@
7272
"desc": "Use 12-hour format?"
7373
}]
7474
}, {
75-
"name": "markEmployees",
76-
"desc": "Adds the Stack Exchange logo after employee names to make them stand out",
77-
"meta": "https://meta.stackexchange.com/q/246678",
78-
"match": "",
79-
"exclude": "*://chat.*.com/*,SE1.0,*://*/questions/ask",
80-
"feature_packs": ["major_ui", "key_feature", "power_user"],
81-
"usesApi": true
82-
}, {
8375
"name": "metaChatBlogStackExchangeButton",
8476
"desc": "Show meta and chat buttons on hover of a site under the site switcher button",
8577
"meta": "https://meta.stackexchange.com/q/256183",

sox.features.js

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -40,53 +40,6 @@
4040
}
4141
},
4242

43-
markEmployees: function () {
44-
// Description: Adds the Stack Exchange logo next to users that *ARE* Stack Exchange employees
45-
46-
const icon = sox.sprites.getSvg('se_logo');
47-
icon.classList.add('iconStackExchange', 'svg-icon', 'sox-markEmployees-logo');
48-
const logoSpan = document.createElement('span');
49-
logoSpan.className = 'sox-markEmployees';
50-
logoSpan.title = 'employee (added by SOX)';
51-
logoSpan.appendChild(icon);
52-
53-
function getIds() {
54-
const anchors = [...document.querySelectorAll('a.comment-user, .user-details a, .question-summary .started a')].filter(el => {
55-
return ![...el.children].filter(el => el.classList.contains('sox-markEmployees')).length && el.href && el.href.match(/\/users\/\d+/);
56-
});
57-
const ids = [...new Set(anchors.map(el => el.href.match(/(\d+)/)[0]))];
58-
sox.debug('markEmployees user IDs', ids);
59-
60-
for (let i = 0; i < Math.ceil(ids.length / 100); i++) {
61-
apiCall(i + 1, ids.slice(i * 100, (i * 100) + 100), anchors);
62-
}
63-
}
64-
65-
function apiCall(page, ids, anchors) {
66-
sox.helpers.getFromAPI({
67-
endpoint: 'users',
68-
ids,
69-
sitename: sox.site.url,
70-
filter: '!*MxJcsv91Tcz6yRH',
71-
limit: 100,
72-
page,
73-
featureId: 'markEmployees',
74-
cacheDuration: 60 * 24, // Cache for 24 hours (in minutes)
75-
}, items => {
76-
sox.debug('markEmployees returned data', items);
77-
for (let i = 0; i < items.length; i++) {
78-
if (!items[i].is_employee) continue;
79-
const userId = items[i].user_id;
80-
anchors.filter(el => el.href.contains(`/users/${userId}/`)).forEach(el => el.appendChild(logoSpan.cloneNode(true)));
81-
}
82-
});
83-
}
84-
85-
getIds();
86-
window.addEventListener('sox-new-comment', getIds);
87-
window.addEventListener('sox-new-review-post-appeared', getIds);
88-
},
89-
9043
copyCommentsLink: function() {
9144
// Description: Adds the 'show x more comments' link before the commnents
9245
// Test on e.g. https://meta.stackexchange.com/questions/125439/

sox.user.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @namespace https://github.com/soscripted/sox
44
// @homepage https://github.com/soscripted/sox
55
// @homepageURL https://github.com/soscripted/sox
6-
// @version 2.7.9 DEV
6+
// @version 2.7.10 DEV
77
// @description Extra optional features for Stack Overflow and Stack Exchange sites
88
// @contributor ᴉʞuǝ (https://stackoverflow.com/users/1454538/, https://github.com/mezmi)
99
// @contributor ᔕᖺᘎᕊ (https://stackexchange.com/users/4337810/, https://github.com/shu8)

0 commit comments

Comments
 (0)