diff --git a/js/hide-form.js b/js/hide-form.js new file mode 100644 index 00000000..86e6b31f --- /dev/null +++ b/js/hide-form.js @@ -0,0 +1,23 @@ +/* + * Adds 4chan-like [Start a New Thread] and [Post a Reply] buttons to pages. + * + * Usage: + * $config['additional_javascript'][] = 'js/jquery.min.js'; + * $config['additional_javascript'][] = 'js/hide-form.js'; + * + */ + +$(document).ready(() => { + if (active_page !== 'index' && active_page !== 'thread') + return; + + let form_el = $('form[name="post"]'); + let form_msg = active_page === 'index' ? 'Start a New Thread' : 'Post a Reply'; + + form_el.hide(); + form_el.after(`
`); + $('div#show-post-form').click(() => { + $('div#show-post-form').hide(); + form_el.show(); + }); +});