mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-02-06 14:44:24 +01:00
js/settings.js: Simple config stuff for javascript extensions
This commit is contained in:
parent
b871122c71
commit
f5aa40dc3b
@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$(window).ready(function() {
|
$(window).ready(function() {
|
||||||
|
var settings = new script_settings('ajax');
|
||||||
var do_not_ajax = false;
|
var do_not_ajax = false;
|
||||||
|
|
||||||
var setup_form = function($form) {
|
var setup_form = function($form) {
|
||||||
@ -61,7 +62,8 @@ $(window).ready(function() {
|
|||||||
$(form).find('input[type="submit"]').removeAttr('disabled');
|
$(form).find('input[type="submit"]').removeAttr('disabled');
|
||||||
}
|
}
|
||||||
} else if (post_response.redirect && post_response.id) {
|
} else if (post_response.redirect && post_response.id) {
|
||||||
if (!$(form).find('input[name="thread"]').length) {
|
if (!$(form).find('input[name="thread"]').length
|
||||||
|
|| (!settings.get('always_noko_replies', true) && !post_response.noko)) {
|
||||||
document.location = post_response.redirect;
|
document.location = post_response.redirect;
|
||||||
} else {
|
} else {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var settings = new script_settings('quick-reply');
|
||||||
|
|
||||||
var do_css = function() {
|
var do_css = function() {
|
||||||
$('#quick-reply-css').remove();
|
$('#quick-reply-css').remove();
|
||||||
|
|
||||||
@ -333,6 +336,7 @@ var show_quick_reply = function(){
|
|||||||
$(window).trigger('quick-reply');
|
$(window).trigger('quick-reply');
|
||||||
|
|
||||||
$(window).ready(function() {
|
$(window).ready(function() {
|
||||||
|
if (settings.get('hide_at_top', true)) {
|
||||||
$(window).scroll(function() {
|
$(window).scroll(function() {
|
||||||
if ($(this).width() <= 800)
|
if ($(this).width() <= 800)
|
||||||
return;
|
return;
|
||||||
@ -340,12 +344,17 @@ var show_quick_reply = function(){
|
|||||||
$postForm.fadeOut(100);
|
$postForm.fadeOut(100);
|
||||||
else
|
else
|
||||||
$postForm.fadeIn(100);
|
$postForm.fadeIn(100);
|
||||||
}).on('stylesheet', function() {
|
}).scroll();
|
||||||
|
} else {
|
||||||
|
$postForm.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
$(window).on('stylesheet', function() {
|
||||||
do_css();
|
do_css();
|
||||||
if ($('link#stylesheet').attr('href')) {
|
if ($('link#stylesheet').attr('href')) {
|
||||||
$('link#stylesheet')[0].onload = do_css;
|
$('link#stylesheet')[0].onload = do_css;
|
||||||
}
|
}
|
||||||
}).scroll();
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -363,3 +372,4 @@ $(window).on('cite', function(e, id, with_link) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
})();
|
||||||
|
1
post.php
1
post.php
@ -759,6 +759,7 @@ if (isset($_POST['delete'])) {
|
|||||||
header('Content-Type: text/json; charset=utf-8');
|
header('Content-Type: text/json; charset=utf-8');
|
||||||
echo json_encode(array(
|
echo json_encode(array(
|
||||||
'redirect' => $redirect,
|
'redirect' => $redirect,
|
||||||
|
'noko' => $config['always_noko'] || $noko,
|
||||||
'id' => $id
|
'id' => $id
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -249,6 +249,17 @@ function rememberStuff() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var script_settings = function(script_name) {
|
||||||
|
this.script_name = script_name;
|
||||||
|
this.get = function(var_name, default_val) {
|
||||||
|
if (typeof tb_settings == 'undefined' ||
|
||||||
|
typeof tb_settings[this.script_name] == 'undefined' ||
|
||||||
|
typeof tb_settings[this.script_name][var_name] == 'undefined')
|
||||||
|
return default_val;
|
||||||
|
return tb_settings[this.script_name][var_name];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
init_stylechooser();
|
init_stylechooser();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user