|
|
@@ -21,9 +21,66 @@ |
|
|
|
* //$config['additional_javascript'][] = 'js/watch.js'; |
|
|
|
* |
|
|
|
*/ |
|
|
|
$(document).on("ready", function() { |
|
|
|
if (window.Options && Options.get_tab('general')) { |
|
|
|
Options.extend_tab("general", |
|
|
|
"<fieldset><legend> Compact Board List </legend>" |
|
|
|
+ ("<label class='compact-boardlist' id='compactboardlist' style='padding:0px;'><input type='checkbox' /> Enable Compact Board List </label>") |
|
|
|
+ ("<label class='compact-boardlisttinyalias' id='compactboardlisttinyalias'><input type='checkbox' /> Tiny Alias for Compact Board List </label>") |
|
|
|
+ ("<label class='compact-boardlistshortalias' id='compactboardlistshortalias'><input type='checkbox' /> Short Alias for Compact Board List </label>") |
|
|
|
+ ("<label class='compact-boardlistunicodealias' id='compactboardlistunicodealias'><input type='checkbox' /> Unicode Alias for Compact Board List </label>") |
|
|
|
+ "</fieldset>"); |
|
|
|
} |
|
|
|
|
|
|
|
$('.compact-boardlist').on('change', function(){ |
|
|
|
var setting = $(this).attr('id'); |
|
|
|
|
|
|
|
localStorage[setting] = $(this).children('input').is(':checked'); |
|
|
|
location.reload(); |
|
|
|
}); |
|
|
|
$('.compact-boardlisttinyalias').on('change', function(){ |
|
|
|
var setting = $(this).attr('id'); |
|
|
|
|
|
|
|
if (device_type == 'desktop') { |
|
|
|
compact_boardlist = true; |
|
|
|
localStorage[setting] = $(this).children('input').is(':checked'); |
|
|
|
location.reload(); |
|
|
|
}); |
|
|
|
$('.compact-boardlistshortalias').on('change', function(){ |
|
|
|
var setting = $(this).attr('id'); |
|
|
|
|
|
|
|
localStorage[setting] = $(this).children('input').is(':checked'); |
|
|
|
location.reload(); |
|
|
|
}); |
|
|
|
$('.compact-boardlistunicodealias').on('change', function(){ |
|
|
|
var setting = $(this).attr('id'); |
|
|
|
|
|
|
|
localStorage[setting] = $(this).children('input').is(':checked'); |
|
|
|
location.reload(); |
|
|
|
}); |
|
|
|
|
|
|
|
if (!localStorage.compactboardlist) { |
|
|
|
localStorage.compactboardlist = 'false'; |
|
|
|
} |
|
|
|
if (!localStorage.compactboardlisttinyalias) { |
|
|
|
localStorage.compactboardlistshortalias = 'false'; |
|
|
|
} |
|
|
|
if (!localStorage.compactboardlistshortalias) { |
|
|
|
localStorage.compactboardlistshortalias = 'false'; |
|
|
|
} |
|
|
|
if (!localStorage.compactboardlistunicodealias) { |
|
|
|
localStorage.compactboardlistunicodealias = 'false'; |
|
|
|
} |
|
|
|
|
|
|
|
function getSetting(key) { |
|
|
|
return (localStorage[key] == 'true'); |
|
|
|
} |
|
|
|
|
|
|
|
if (getSetting('compactboardlist')) $('#compactboardlist>input').prop('checked', 'checked'); |
|
|
|
if (getSetting('compactboardlisttinyalias')) $('#compactboardlisttinyalias>input').prop('checked', 'checked'); |
|
|
|
if (getSetting('compactboardlistshortalias')) $('#compactboardlistshortalias>input').prop('checked', 'checked'); |
|
|
|
if (getSetting('compactboardlistunicodealias')) $('#compactboardlistunicodealias>input').prop('checked', 'checked'); |
|
|
|
|
|
|
|
function initCompactBoardList() { //Pashe, influenced by tux, et al, WTFPL |
|
|
|
if (!getSetting("compactboardlist")) {return;} |
|
|
|
|
|
|
|
do_boardlist = function() { |
|
|
|
var categories = []; |
|
|
@@ -60,7 +117,23 @@ if (device_type == 'desktop') { |
|
|
|
.appendTo(topbl) |
|
|
|
} |
|
|
|
else { |
|
|
|
$("<a class='cb-item cb-cat' href='javascript:void(0)'>"+item.name+"</a>") |
|
|
|
var menuitemname = item.name; |
|
|
|
var tinyalias = {"Notices" : "/n/", "STEM" : "/s/" , "People" : "/p/" , "Overboards 1" : "/ob1/" , "Overboards 2" : "/ob2/", "Elsewhere" : "/e/", "Services" : "/s/", "Misc" : '/m/', "Affiliates" : "/af/" }; |
|
|
|
var shortalias = {"Notices" : "/not/", "STEM" : "/stem/" , "People" : "/people/" , "Overboards 1" : "/ob1/" , "Overboards 2" : "/ob2/", "Elsewhere" : "/else/", "Services" : "/serv/", "Misc" : "/misc/", "Affiliates" : "/uboa and sushi/" }; |
|
|
|
var unicodealias = {"Notices" : "ℹ️", "STEM" : "👨‍💻 " , "People" : "👥" , "Overboards 1" : "💬" , "Overboards 2" : "💭", "Elsewhere" : "🔍", "Services" : "🈂", "Misc" : "⁉", "Affiliates" : "🍣" }; |
|
|
|
|
|
|
|
if (getSetting("compactboardlisttinyalias")) { |
|
|
|
menuitemname = tinyalias[item.name]; |
|
|
|
} |
|
|
|
else if (getSetting("compactboardlistshortalias")){ |
|
|
|
menuitemname = shortalias[item.name]; |
|
|
|
|
|
|
|
} |
|
|
|
else if (getSetting("compactboardlistunicodealias")){ |
|
|
|
menuitemname = unicodealias[item.name]; |
|
|
|
} |
|
|
|
|
|
|
|
$("<a class='cb-item cb-cat' href='javascript:void(0)'>"+ menuitemname+"</a>") |
|
|
|
.appendTo(topbl) |
|
|
|
.mouseenter(function() { |
|
|
|
var list = $("<div class='boardlist top cb-menu'></div>") |
|
|
@@ -90,4 +163,51 @@ if (device_type == 'desktop') { |
|
|
|
} |
|
|
|
do_boardlist = undefined; |
|
|
|
}; |
|
|
|
do_boardlist(); |
|
|
|
options_handler = $("<div id='options_handler'></div>").css("display", "none"); |
|
|
|
options_background = $("<div id='options_background'></div>").on("click", Options.hide).appendTo(options_handler); |
|
|
|
options_div = $("<div id='options_div'></div>").appendTo(options_handler); |
|
|
|
options_close = $("<a id='options_close' href='javascript:void(0)'><i class='fa fa-times'></i></div>") |
|
|
|
.on("click", Options.hide).appendTo(options_div); |
|
|
|
options_tablist = $("<div id='options_tablist'></div>").appendTo(options_div); |
|
|
|
options_button = $("<a href='javascript:void(0)' title='"+_("Options")+"'>["+_("Options")+"]</a>"); |
|
|
|
|
|
|
|
if ($(".boardlist.compact-boardlist").length) { |
|
|
|
options_button.addClass("cb-item cb-fa").html("<i class='fa fa-gear'></i>"); |
|
|
|
} |
|
|
|
|
|
|
|
if ($(".boardlist:first").length) { |
|
|
|
options_button.css('float', 'right').appendTo($(".boardlist:first")); |
|
|
|
} |
|
|
|
else { |
|
|
|
var optsdiv = $('<div style="text-align: right"></div>'); |
|
|
|
options_button.appendTo(optsdiv); |
|
|
|
optsdiv.prependTo($(document.body)); |
|
|
|
} |
|
|
|
|
|
|
|
options_button.on("click", Options.show); |
|
|
|
|
|
|
|
options_handler.appendTo($(document.body)); |
|
|
|
if (typeof watchlist.render !== 'undefined') { |
|
|
|
$('.boardlist.compact-boardlist').append(' <a class="watchlist-toggle cb-item cb-cat" href="#"><span>['+_('watchlist')+']</span></a>'); |
|
|
|
watchlist.render(); |
|
|
|
} |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
initCompactBoardList(); |
|
|
|
}); |