Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7001543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:49:01+00:00 2026-05-27T20:49:01+00:00

So I am making a Greasemonkey script for a mybb forum. What it does

  • 0

So I am making a Greasemonkey script for a mybb forum. What it does is that when you submit a post it adds code to the beginning and the end of the post. Well even though that is a bad explanation just look at the code, it explains itself

function form_submit(event) {  
var form = event ? event.target : this;
   var arTextareas = form.getElementsByTagName('textarea');
   for (var i = arTextareas.length - 1; i >= 0; i--) {
       var elmTextarea = arTextareas[i];
       elmTextarea.value = "[font=Tahoma][color=white]" + elmTextarea.value + "[/color][/font]";
   }

   form._submit();
}

window.addEventListener('submit',form_submit, true);
HTMLFormElement.prototype._submit = HTMLFormElement.prototype.submit;
HTMLFormElement.prototype.submit = form_submit;

Now it works everywhere I want it to except the quickreply post reply button. I am assuming this is because the quickreply button uses AJAX to submit the form and the page does not get reloaded.

So I am wondering how I can have it so that when I click the quickreply button it appends the text I want it to. I have searched around for a while and anything that i could find did not work

Also, here is the code for the button that uses ajax(The button that doesn’t work with the above code)

<input id="quick_reply_submit" class="button" type="submit" accesskey="s" tabindex="2" value="Post Reply">

And here is where it is located

<!-- start: showthread_quickreply -->

<br />
<form method="post" action="newreply.php?tid=2023403&processed=1" name="quick_reply_form" id="quick_reply_form">
    <input type="hidden" name="my_post_key" value="de77ee8401edd4fe176f2c6a3787d411" />
    <input type="hidden" name="subject" value="*" />
    <input type="hidden" name="action" value="do_newreply" />
    <input type="hidden" name="posthash" value="a67ff7b68df0a0951770f7f4a24cce8f" id="posthash" />
    <input type="hidden" name="quoted_ids" value="" id="quoted_ids" />
    <input type="hidden" name="lastpid" id="lastpid" value="18370730" />
    <input type="hidden" name="from_page" value="1" />
    <input type="hidden" name="tid" value="2023403" />

    <input type="hidden" name="method" value="quickreply" />

    <table border="0" cellspacing="1" cellpadding="4" class="tborder">
        <thead>
            <tr>
                <td class="thead" colspan="2">
                    <div class="expcolimage"><img src="http://cdn.myforums.net/images/blackreign/collapse.gif" id="quickreply_img" class="expander" alt="[-]" title="[-]" /></div>
                    <div><strong>Quick Reply</strong></div>
                </td>

            </tr>
        </thead>
        <tbody style="" id="quickreply_e">
            <tr>
                <td class="trow1" valign="top" width="22%">
                    <strong>Message</strong><br />
                    <span class="smalltext">Type your reply to this message here.<br /><br />
                    <label><input type="checkbox" class="checkbox" name="postoptions[signature]" value="1" checked="checked" />&nbsp;<strong>Signature</strong></label><br />

                    <label><input type="checkbox" class="checkbox" name="postoptions[disablesmilies]" value="1" />&nbsp;<strong>Disable Smilies</strong></label></span>
                </td>
                <td class="trow1">
                    <div style="width: 95%">
                        <textarea style="width: 100%; padding: 4px; margin: 0;" rows="8" cols="80" name="message" id="message" tabindex="1"></textarea>
                    </div>
                    <div class="editor_control_bar" style="width: 95%; padding: 4px; margin-top: 3px; display: none;" id="quickreply_multiquote">
                        <span class="smalltext">

                            You have selected one or more posts to quote. <a href="./newreply.php?tid=2023403&load_all_quotes=1" onclick="return Thread.loadMultiQuoted();">Quote these posts now</a> or <a href="javascript:Thread.clearMultiQuoted();">deselect them</a>.
                        </span>
                    </div>
                </td>
            </tr>

            <tr>
                <td colspan="2" align="center" class="tfoot"><input type="submit" class="button" value="Post Reply" tabindex="2" accesskey="s" id="quick_reply_submit" /> <input type="submit" class="button" name="previewpost" value="Preview Post" tabindex="3" /></td>

            </tr>
        </tbody>
    </table>
</form>
<!-- end: showthread_quickreply -->
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:49:02+00:00Added an answer on May 27, 2026 at 8:49 pm

    You need to show us the javascript that associates itself to that button. If it’s AJAX powered, that’s the only way to know what it’s doing.

    That said, this code will probably work:

    function form_submit (event) {
    
        var form, bClickNotSubmit;
    
        if (event  &&  event.type == 'click') {
            bClickNotSubmit = true;
            form            = document.getElementById ('quick_reply_form');
        }
        else {
            bClickNotSubmit = false;
            form            = event ? event.target : this;
        }
    
        var arTextareas = form.getElementsByTagName ('textarea');
    
        for (var i = arTextareas.length - 1; i >= 0; i--) {
            var elmTextarea     = arTextareas[i];
            elmTextarea.value   = "[font=Tahoma][color=white]" + elmTextarea.value + "[/color][/font]";
        }
    
        if ( ! bClickNotSubmit ) {
            form._submit();
        }
    }
    
    window.addEventListener ('submit', form_submit, true);
    document.getElementById ('quick_reply_submit').addEventListener ('click', form_submit, true);
    
    HTMLFormElement.prototype._submit = HTMLFormElement.prototype.submit;
    HTMLFormElement.prototype.submit = form_submit;
    

    If it doesn’t work, save the target page (complete HTML, JS, CSS) to a disk, zip the files together and share the zip — so that we can see what is happening with that button.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a greasemonkey script and i would like a link to go
I'm making a Greasemonkey script for the Runecape forums (Yes runescape! :p) and I'm
I'm used to making Greasemonkey scripts for Firefox, where I can edit the script
I'm making a Greasemonkey script for someone to change the display of some of
Making an adobe flex ui in which data that is calculated must use proprietary
Making UML sequence diagram in VS 2010RC I've observed that there is no activation
Im making a small python script to upload files on the net. The script
I'm trying to get a jsonp callback working using jquery within a greasemonkey script.
Making a mobile friendly site, I have a single field and a submit button.
Making a flash page that can cycle through these three images on mouseclick. For

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.