summaryrefslogtreecommitdiff
path: root/js/quick-post-controls.js
diff options
context:
space:
mode:
authorMichael Save <savetheinternet@tinyboard.org>2012-03-31 11:20:18 +1100
committerMichael Save <savetheinternet@tinyboard.org>2012-03-31 11:20:18 +1100
commit6a9169657d5b5dea09fe7d2dbabe49a8a4845d05 (patch)
treec57c9c440e8ae88875008591c56add350c4b8a5c /js/quick-post-controls.js
parent2df1ebd88c266d984cbaa6c26917c2ea89c2ae0e (diff)
Merged js/ into https://github.com/savetheinternet/Tinyboard
Diffstat (limited to 'js/quick-post-controls.js')
-rw-r--r--js/quick-post-controls.js80
1 files changed, 0 insertions, 80 deletions
diff --git a/js/quick-post-controls.js b/js/quick-post-controls.js
deleted file mode 100644
index 90a46cd9..00000000
--- a/js/quick-post-controls.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * quick-posts-controls.js
- * https://github.com/savetheinternet/Tinyboard-Tools/blob/master/js/quick-posts-controls.js
- *
- * Released under the MIT license
- * Copyright (c) 2012 Michael Save <savetheinternet@tinyboard.org>
- *
- * Usage:
- * $config['additional_javascript'][] = 'js/jquery.min.js';
- * $config['additional_javascript'][] = 'js/quick-post-controls.js';
- *
- */
-
-$(document).ready(function(){
- var open_form = function() {
- var thread = $(this).parent().parent().hasClass('op');
- var id = $(this).attr('name').match(/^delete_(\d+)$/)[1];
- var submitButton;
-
- if(this.checked) {
- var post_form = $('<form class="post-actions" method="post" style="margin:10px 0 0 0">' +
- '<div style="text-align:right">' +
- (!thread ? '<hr>' : '') +
-
- '<input type="hidden" name="delete_' + id + '">' +
-
- '<label for="password_' + id + '">Password</label>: ' +
- '<input id="password_' + id + '" type="password" name="password" size="11" maxlength="18">' +
- '<input title="Delete file only" type="checkbox" name="file" id="delete_file_' + id + '">' +
- '<label for="delete_file_' + id + '">File</label>' +
- ' <input type="submit" name="delete" value="Delete">' +
-
- '<br>' +
-
- '<label for="reason_' + id + '">Reason</label>: ' +
- '<input id="reason_' + id + '" type="text" name="reason" size="20" maxlength="100">' +
- ' <input type="submit" name="report" value="Report">' +
- '</div>' +
- '</form>');
- post_form
- .attr('action', $('form:first').attr('action'))
- .append($('input[name=board]:first').clone())
- .find('input:not([type="checkbox"]):not([type="submit"]):not([type="hidden"])').keypress(function(e) {
- if(e.which == 13) {
- e.preventDefault();
- if($(this).attr('name') == 'password') {
- post_form.find('input[name=delete]').click();
- } else if($(this).attr('name') == 'reason') {
- post_form.find('input[name=report]').click();
- }
-
- return false;
- }
-
- return true;
- });
-
- post_form.find('input[type="password"]').val(localStorage.password);
-
- if(thread) {
- post_form.prependTo($(this).parent().parent().find('p.body'));
- } else {
- post_form.appendTo($(this).parent().parent());
- //post_form.insertBefore($(this));
- }
- } else {
- var elm = $(this).parent().parent().find('form');
-
- if(elm.attr('class') == 'post-actions')
- elm.remove();
- }
- };
-
- $('div.post input[type=checkbox].delete').each(function() {
- $(this).change(open_form);
- if(this.checked)
- $(this).trigger('change');
- });
-});
-