-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoverrides.js
More file actions
58 lines (52 loc) · 1.8 KB
/
overrides.js
File metadata and controls
58 lines (52 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
(function() {
function $(selector) {
return [].slice.call(document.querySelectorAll(selector));
}
function nationalize(textNode){
if(!textNode) return;
var oldValue = textNode.textContent;
var newValue = oldValue
.replace(/like[sd]?/,"anarchism");
if (newValue != oldValue) {
textNode.textContent = newValue;
}
}
function checkForLikes() {
$(".ProfileTweet-action--favorite .IconContainer").forEach(function(el){
var attribute = el.hasAttribute('title') ? 'title' : 'data-original-title';
var oldValue = el.getAttribute(attribute);
var newValue = oldValue.replace(/Like/, 'Anarchism').replace(/like/, 'anarchism');
if (newValue != oldValue) {
el.setAttribute(attribute, newValue);
}
});
$(".request-favorited-popup").forEach(function(el){
var textNode = el.childNodes[0];
if (textNode) {
var oldValue = textNode.textContent;
var newValue = oldValue.replace(/Like(s?)/, 'Anarchism');
if (newValue != oldValue) {
textNode.textContent = newValue;
}
}
});
// /i/notification page (liked ur post, 2 more likes)
$(".stream-item-activity-line-notification, .view-all-supplements span")
.forEach(function(el){
//iterate over nodes rather than access by index in case twitter's markup changes
[].filter.call(el.childNodes, function(node){
return node.nodeType === Node.TEXT_NODE;
}).forEach(nationalize);
});
//can't rely on css alone becauese `content` property is not overrideable
$(".Icon--heartBadge").forEach(function(el){
el.classList.remove("Icon--heartBadge");
el.classList.add("Icon--anarchismBadge");
});
}
function tick() {
checkForLikes();
window.setTimeout(tick, 5000);
}
tick();
})();