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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
$(document).on("ready", function() {
if (window.Options && Options.get_tab('general')) {
Options.extend_tab("general",
"<fieldset><legend> Board List Alias </legend>"
+ ("<label class='boardlist-tinyalias' id='boardlisttinyalias' style='padding:0px;'><input type='checkbox' /> Enable Tiny Board List Alias </label>")
+ ("<label class='boardlist-legacyalias' id='boardlistlegacyalias' style='padding:0px;'><input type='checkbox' /> Enable Legacy Names Board List Alias </label>")
+ ("<label class='boardlist-unicodealias' id='boardlistunicodealias' style='padding:0px;'><input type='checkbox' /> Enable Unicode Board List Alias </label>")
+ ("<label class='boardlist-hideoverboards' id='boardlisthideoverboards' style='padding:0px;'><input type='checkbox' /> Enable Overboard hiding </label>")
+ ("<label class='boardlist-hideunderboards' id='boardlisthideunderboards' style='padding:0px;'><input type='checkbox' /> Enable Underboard hiding </label>")
+ ("<label class='boardlist-megaq' id='boardlistmegaq' style='padding:0px;'><input type='checkbox' /> Have /mega/ include /q/ </label>")
+ "</fieldset>");
}
$('.boardlist-tinyalias').on('change', function(){
var setting = $(this).attr('id');
localStorage[setting] = $(this).is(':checked');
location.reload();
});
$('.boardlist-legacyalias').on('change', function(){
var setting = $(this).attr('id');
localStorage[setting] = $(this).children('input').is(':checked');
location.reload();
});
$('.boardlist-unicodealias').on('change', function(){
var setting = $(this).attr('id');
localStorage[setting] = $(this).children('input').is(':checked');
location.reload();
});
$('.boardlist-hideoverboards').on('change', function(){
var setting = $(this).attr('id');
localStorage[setting] = $(this).children('input').is(':checked');
location.reload();
});
$('.boardlist-hideunderboards').on('change', function(){
var setting = $(this).attr('id');
localStorage[setting] = $(this).children('input').is(':checked');
location.reload();
});
$('.boardlist-megaq').on('change', function(){
var setting = $(this).attr('id');
localStorage[setting] = $(this).children('input').is(':checked');
location.reload();
});
if (!localStorage.boardlisttinyalias) {
localStorage.boardlisttinyalias = 'false';
}
if (!localStorage.boardlistlegacyalias) {
localStorage.boardlistlegacyalias = 'false';
}
if (!localStorage.boardlistunicodealias) {
localStorage.boardlistunicodealias = 'false';
}
if (!localStorage.boardlisthideoverboards) {
localStorage.boardlisthideoverboards = 'false';
}
if (!localStorage.boardlisthideunderboards) {
localStorage.boardlisthideunderboards = 'false';
}
if (!localStorage.megaq) {
localStorage.megaq = 'false';
}
function getSetting(key) {
return (localStorage[key] == 'true');
}
if (getSetting('boardlisttinyalias')) $('#boardlisttinyalias>input').prop('checked', 'checked');
if (getSetting('boardlistlegacyalias')) $('#boardlistlegacyalias>input').prop('checked', 'checked');
if (getSetting('boardlistunicodealias')) $('#boardlistunicodealias>input').prop('checked', 'checked');
if (getSetting('boardlisthideoverboards')) $('#boardlisthideoverboards>input').prop('checked', 'checked');
if (getSetting('boardlisthideunderboards')) $('#boardlisthideunderboards>input').prop('checked', 'checked');
if (getSetting('boardlistmegaq')) $('#boardlistmegaq>input').prop('checked', 'checked');
function initBoardListAlias() {
do_boardlist_alias = function() {
var categories = [];
var topbl = $('.boardlist:first');
topbl.find('>.sub').each(function() {
var cat = {name: $(this).data('description'), boards: []};
if (getSetting("boardlisthideoverboards")){
if (cat.name === "Overboards 1"){
$(this).hide();
}
}
if (getSetting("boardlisthideunderboards")){
if (cat.name === "People"){
$(this).hide();
}
}
$(this).find('a').each(function() {
var board = $(this).html();
var menuitemname = board;
if (getSetting("boardlistmegaq")) {
if (board === "mega"){
$(this).attr("href", "https://lainchan.org/megaq/index.html");
}
}
var tinyalias = {"$$$" : "$", "rules" : "law" , "faq" : "?" , "news" : "n" , "diy" : "Δ", "sec" : "s", "tech" : "Ω", "inter" : 'i', "lit" : "l", "music" : "mu" , "vis" : "v" , "hum" : "h", "drg" : "d" , "zzz" : "z" , "layer" : "ddt" ,"cult" : "c" , "psy" : "p", "mega" : "me" , "random" : "ra", "radio" : "rad", "stream" : "mov", "cal" : "ca"};
var legacyalias = { "Δ" : "diy", "Ω" : "tech", "drug" : "drg", "hum" : "feels"};
var unicodealias = {"$$$": "💸", "rules" : "⚖️" , "faq" : "⁉️" , "news" : "📰" , "diy" : "🔧" , "Δ" : "🔧", "sec" : "🔒", "tech" : "💻", "Ω" : "💻", "inter" : "🎮", "lit" : "✍️", "music" : "🎼" , "vis" : "🎨" , "hum" : "👥", "drg" : "💊" , "drug" : "💊" , "zzz" : "💤" , "layer" : "㊙️" ,"cult" : "🎭" , "psy" : "🎆", "mega" : "📣" , "random" : "🎲", "radio" : "📻", "stream" : "📺", "zine" : "📓", "irc" : "📝", "q" : "❓", "r" : "🎲", "cal" : "📅"};
if (getSetting("boardlisttinyalias")) {
if (board in tinyalias){
menuitemname = tinyalias[board];
}
}
else if (getSetting("boardlistlegacyalias")){
if (board in legacyalias){
menuitemname = legacyalias[board];
}
}
else if (getSetting("boardlistunicodealias")){
if (board in unicodealias){
menuitemname = unicodealias[board];
}
}
$(this).html(menuitemname);
});
do_boardlist_alias = undefined;
});
if (typeof twemoji.parse !== 'undefined') {
if (!getSetting("emojiimagefallback")) {return;}
var twemoji_opts = {
callback: function(icon, options, variant) {
switch ( icon ) {
case 'a9': // copyright
case 'ae': // (R)
case '2122': // TM
case '25b6': // post filter
return false;
}
return ''.concat(options.base, options.size, '/', icon, options.ext);
}
}
twemoji.parse(document.body, twemoji_opts);
}
}
do_boardlist_alias();
}
initBoardListAlias();
});
|