mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-28 01:10:51 +01:00
Removed redundant setting.
Bugfix.
This commit is contained in:
parent
1663efcf9d
commit
f6b4b2ac18
@ -27,7 +27,7 @@ if (active_page == 'thread' || active_page == 'index') {
|
|||||||
exclusiveline: false,
|
exclusiveline: false,
|
||||||
prefix: "''",
|
prefix: "''",
|
||||||
suffix: "''"
|
suffix: "''"
|
||||||
},
|
},
|
||||||
bold: {
|
bold: {
|
||||||
text: 'Bold',
|
text: 'Bold',
|
||||||
key: 'b',
|
key: 'b',
|
||||||
@ -71,13 +71,11 @@ if (active_page == 'thread' || active_page == 'index') {
|
|||||||
};
|
};
|
||||||
|
|
||||||
self.toolbar_wrap = function(node) {
|
self.toolbar_wrap = function(node) {
|
||||||
if (!localStorage.formatText_enable || localStorage.formatText_enable == 'false') return;
|
|
||||||
var parent = $(node).parents('form[name="post"]');
|
var parent = $(node).parents('form[name="post"]');
|
||||||
self.wrap(parent.find('#body')[0],'textarea[name="body"]', parent.find('.format-text > select')[0].value, false);
|
self.wrap(parent.find('#body')[0],'textarea[name="body"]', parent.find('.format-text > select')[0].value, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
self.wrap = function(ref, target, option, expandedwrap) {
|
self.wrap = function(ref, target, option, expandedwrap) {
|
||||||
if (!localStorage.formatText_enable || localStorage.formatText_enable == 'false') return;
|
|
||||||
// clean and validate arguments
|
// clean and validate arguments
|
||||||
if (ref == null) return;
|
if (ref == null) return;
|
||||||
var settings = {multiline: false, exclusiveline: false, prefix:'', suffix: null};
|
var settings = {multiline: false, exclusiveline: false, prefix:'', suffix: null};
|
||||||
@ -162,7 +160,6 @@ if (active_page == 'thread' || active_page == 'index') {
|
|||||||
};
|
};
|
||||||
|
|
||||||
self.build_toolbars = function(){
|
self.build_toolbars = function(){
|
||||||
if (!localStorage.formatText_enable || localStorage.formatText_enable == 'false') return;
|
|
||||||
if (localStorage.formatText_toolbar == 'true'){
|
if (localStorage.formatText_toolbar == 'true'){
|
||||||
// remove existing toolbars
|
// remove existing toolbars
|
||||||
if ($('.format-text').length > 0) $('.format-text').remove();
|
if ($('.format-text').length > 0) $('.format-text').remove();
|
||||||
@ -256,35 +253,23 @@ if (active_page == 'thread' || active_page == 'index') {
|
|||||||
|
|
||||||
// Add settings to Options panel general tab
|
// Add settings to Options panel general tab
|
||||||
if (window.Options && Options.get_tab('general')) {
|
if (window.Options && Options.get_tab('general')) {
|
||||||
var s1 = '#formatText_enable>input', s2 = '#formatText_keybinds>input', s3 = '#formatText_toolbar>input', e = 'change';
|
var s1 = '#formatText_keybinds>input', s2 = '#formatText_toolbar>input', e = 'change';
|
||||||
Options.extend_tab('general', '\
|
Options.extend_tab('general', '\
|
||||||
<fieldset>\
|
<fieldset>\
|
||||||
<legend>Formatting Options</legend>\
|
<legend>Formatting Options</legend>\
|
||||||
<label id="formatText_enable"><input type="checkbox" checked="checked" id="formatText_enable">' + _('Enable post formatting') + '</label>\
|
|
||||||
<label id="formatText_keybinds"><input type="checkbox" checked="checked" id="formatText_keybinds">' + _('Enable formatting keybinds') + '</label>\
|
<label id="formatText_keybinds"><input type="checkbox" checked="checked" id="formatText_keybinds">' + _('Enable formatting keybinds') + '</label>\
|
||||||
<label id="formatText_toolbar"><input type="checkbox" checked="checked" id="formatText_toolbar">' + _('Show formatting toolbar') + '</label>\
|
<label id="formatText_toolbar"><input type="checkbox" checked="checked" id="formatText_toolbar">' + _('Show formatting toolbar') + '</label>\
|
||||||
</fieldset>\
|
</fieldset>\
|
||||||
');
|
');
|
||||||
} else {
|
} else {
|
||||||
var s1 = '#formatText_enable', s2 = '#formatText_keybinds', s3 = '#formatText_toolbar', e = 'click';
|
var s1 = '#formatText_keybinds', s2 = '#formatText_toolbar', e = 'click';
|
||||||
$('hr:first').before('<div id="formatText_enable" style="text-align:right"><a class="unimportant" href="javascript:void(0)">'+ _('Enable post formatting') +'</a></div>');
|
|
||||||
$('hr:first').before('<div id="formatText_keybinds" style="text-align:right"><a class="unimportant" href="javascript:void(0)">'+ _('Enable formatting keybinds') +'</a></div>');
|
$('hr:first').before('<div id="formatText_keybinds" style="text-align:right"><a class="unimportant" href="javascript:void(0)">'+ _('Enable formatting keybinds') +'</a></div>');
|
||||||
$('hr:first').before('<div id="formatText_toolbar" style="text-align:right"><a class="unimportant" href="javascript:void(0)">'+ _('Show formatting toolbar') +'</a></div>');
|
$('hr:first').before('<div id="formatText_toolbar" style="text-align:right"><a class="unimportant" href="javascript:void(0)">'+ _('Show formatting toolbar') +'</a></div>');
|
||||||
}
|
}
|
||||||
|
|
||||||
// setting for enableing text formatting
|
|
||||||
$(s1).on(e, function(e) {
|
|
||||||
if (!localStorage.formatText_enable || localStorage.formatText_enable == 'false') {
|
|
||||||
localStorage.formatText_enable = 'true';
|
|
||||||
if (window.Options && Options.get_tab('general')) e.target.checked = true;
|
|
||||||
} else {
|
|
||||||
localStorage.formatText_enable = 'false';
|
|
||||||
if (window.Options && Options.get_tab('general')) e.target.checked = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// setting for enableing formatting keybinds
|
// setting for enableing formatting keybinds
|
||||||
$(s2).on(e, function(e) {
|
$(s1).on(e, function(e) {
|
||||||
if (!localStorage.formatText_keybinds || localStorage.formatText_keybinds == 'false') {
|
if (!localStorage.formatText_keybinds || localStorage.formatText_keybinds == 'false') {
|
||||||
localStorage.formatText_keybinds = 'true';
|
localStorage.formatText_keybinds = 'true';
|
||||||
if (window.Options && Options.get_tab('general')) e.target.checked = true;
|
if (window.Options && Options.get_tab('general')) e.target.checked = true;
|
||||||
@ -295,7 +280,7 @@ if (active_page == 'thread' || active_page == 'index') {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// setting for toolbar injection
|
// setting for toolbar injection
|
||||||
$(s3).on(e, function(e) {
|
$(s2).on(e, function(e) {
|
||||||
if (!localStorage.formatText_toolbar || localStorage.formatText_toolbar == 'false') {
|
if (!localStorage.formatText_toolbar || localStorage.formatText_toolbar == 'false') {
|
||||||
localStorage.formatText_toolbar = 'true';
|
localStorage.formatText_toolbar = 'true';
|
||||||
if (window.Options && Options.get_tab('general')) e.target.checked = true;
|
if (window.Options && Options.get_tab('general')) e.target.checked = true;
|
||||||
@ -309,12 +294,10 @@ if (active_page == 'thread' || active_page == 'index') {
|
|||||||
|
|
||||||
// make sure the tab settings are switch properly at loadup
|
// make sure the tab settings are switch properly at loadup
|
||||||
if (window.Options && Options.get_tab('general')) {
|
if (window.Options && Options.get_tab('general')) {
|
||||||
if (localStorage.formatText_enable == 'true') $(s1)[0].checked = true;
|
if (localStorage.formatText_keybinds == 'true') $(s1)[0].checked = true;
|
||||||
else $(s1)[0].checked = false;
|
else $(s1)[0].checked = false;
|
||||||
if (localStorage.formatText_keybinds == 'true') $(s2)[0].checked = true;
|
|
||||||
else $(s2)[0].checked = false;
|
|
||||||
if (localStorage.formatText_toolbar == 'true') $(s2)[0].checked = true;
|
if (localStorage.formatText_toolbar == 'true') $(s2)[0].checked = true;
|
||||||
else $(s3)[0].checked = false;
|
else $(s2)[0].checked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the tab for customizing the format settings
|
// add the tab for customizing the format settings
|
||||||
@ -375,7 +358,6 @@ if (active_page == 'thread' || active_page == 'index') {
|
|||||||
|
|
||||||
//attach listeners to <body> so it also works on quick-reply box
|
//attach listeners to <body> so it also works on quick-reply box
|
||||||
$('body').on('keydown', '#body, #quick-reply #body', function(e) {
|
$('body').on('keydown', '#body, #quick-reply #body', function(e) {
|
||||||
if (!localStorage.formatText_enable || localStorage.formatText_enable == 'false') return;
|
|
||||||
if (!localStorage.formatText_keybinds || localStorage.formatText_keybinds == 'false') return;
|
if (!localStorage.formatText_keybinds || localStorage.formatText_keybinds == 'false') return;
|
||||||
var key = String.fromCharCode(e.which).toLowerCase();
|
var key = String.fromCharCode(e.which).toLowerCase();
|
||||||
var rules = JSON.parse(localStorage.formatText_rules);
|
var rules = JSON.parse(localStorage.formatText_rules);
|
||||||
|
Loading…
Reference in New Issue
Block a user