forked from haneda3/fuhyohigai-ext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
facebook.js
42 lines (37 loc) · 1.1 KB
/
facebook.js
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
(function(undefined) {
function $replaceHtml($obj, target, replacement) {
var html = $obj.html();
html = html.replace(new RegExp(target, "g"), replacement);
$obj.html(html);
}
function createTagContainsLike(tag, source) {
return tag + ':contains("' + source + '")';
};
$(function() {
var lang = fuhyohigai.langpack
, xxLike = lang.xx.like
, currentLike = null;
switch ($('html').attr('lang')) {
case 'en':
currentLike = lang.en.like;
break;
default:
currentLike = lang.ja.like;
break;
}
var targets = [
createTagContainsLike('a', currentLike)
, createTagContainsLike('label', currentLike)
, createTagContainsLike('span', currentLike)
, createTagContainsLike('h5', currentLike)
];
fuhyohigai.onashasu('www.facebook.com', function() {
for (var i = 0; i < targets.length; i++) {
var target = targets[i];
$(target).each(function() {
$replaceHtml($(this), currentLike, xxLike);
});
}
});
});
}).call(this);