2013-08-28 23:08:41 +00:00
|
|
|
$(document).ready(function() {
|
|
|
|
var top = $('#settings_sections').offset().top - parseFloat($('#settings_sections').css('marginTop').replace(/auto/, 0));
|
|
|
|
$(window).scroll(function (event) {
|
|
|
|
var y = $(this).scrollTop();
|
|
|
|
if (y >= top) {
|
|
|
|
$('#settings_sections').addClass('fixed');
|
|
|
|
} else {
|
|
|
|
$('#settings_sections').removeClass('fixed');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#settings_sections li").each(function(index) {
|
|
|
|
$(this).click(function(e) {
|
|
|
|
var id = $(this).data("gazelle-section-id");
|
|
|
|
if (id) {
|
|
|
|
e.preventDefault();
|
|
|
|
if (id == "all_settings" || id == "live_search") {
|
|
|
|
$("#userform table").show();
|
|
|
|
} else {
|
|
|
|
$("#userform table").hide();
|
|
|
|
$("#" + id).show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#settings_search").on("keyup", function() {
|
|
|
|
var search = $(this).val().toLowerCase();
|
|
|
|
if ($.trim(search).length > 0) {
|
|
|
|
$("#userform tr").not(".colhead_dark").each(function(index) {
|
|
|
|
var text = $(this).find("td:first").text().toLowerCase();
|
|
|
|
if (text.length > 0 && search.length > 0 && fuzzyMatch(text, search)) {
|
|
|
|
$(this).show();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$(this).hide();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
$("#userform tr").show();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// I'm sure there is a better way to do this but this will do for now.
|
|
|
|
$("#notifications_Inbox_traditional").click(function() {
|
2013-10-17 08:00:50 +00:00
|
|
|
$("#notifications_Inbox_popup").prop('checked', false);
|
2013-08-28 23:08:41 +00:00
|
|
|
});
|
|
|
|
$("#notifications_Inbox_popup").click(function() {
|
2013-10-17 08:00:50 +00:00
|
|
|
$("#notifications_Inbox_traditional").prop('checked', false);
|
2013-08-28 23:08:41 +00:00
|
|
|
});
|
|
|
|
$("#notifications_Torrents_traditional").click(function() {
|
2013-10-17 08:00:50 +00:00
|
|
|
$("#notifications_Torrents_popup").prop('checked', false);
|
2013-08-28 23:08:41 +00:00
|
|
|
});
|
|
|
|
$("#notifications_Torrents_popup").click(function() {
|
2013-10-17 08:00:50 +00:00
|
|
|
$("#notifications_Torrents_traditional").prop('checked', false);
|
2013-08-28 23:08:41 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
function fuzzyMatch(str, pattern){
|
|
|
|
pattern = pattern.split("").reduce(function(a,b){ return a+".*"+b; });
|
|
|
|
return new RegExp(pattern).test(str);
|
|
|
|
};
|