The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

phpBB2 - Asynchronous quotes

View previous topic View next topic Go down

phpBB2 - Asynchronous quotes

Post by relaxed on October 30th 2015, 6:16 pm

just something I was experimenting with when I got bored
it's a simple script that just loads the text from a quote and puts it into the quick reply textbox

code:
Code:

$(document).ready(function() {
var quote_text_info;

$(".i_icon_quote").parent().click(function(e) {
e.preventDefault();

$.get($(this).attr("href"), function(data) {
quote_text_info = $(data).find("textarea").val();
$('.sceditor-container textarea').val($('.sceditor-container textarea').val()+quote_text_info+"\n");
$("html, body").animate({ scrollTop: $('.sceditor-container textarea').offset().top }, 1000, function() {
$('.sceditor-container textarea').focus();
});

});


});

});

relaxed
New Member

Posts : 2
Reputation : 3
Language : English

http://thespritas.com/

Back to top Go down

Re: phpBB2 - Asynchronous quotes

Post by EndlessDream on October 31st 2015, 3:00 am

I tested it on PunBB version and it works!

Thank you! I find this very useful. Smile

EndlessDream
Forumember

Male Posts : 107
Reputation : 22
Language : English, Spanish, Serbian

Back to top Go down

Re: phpBB2 - Asynchronous quotes

Post by Ange Tuteur on October 31st 2015, 10:59 am

This is a nice plugin, as it makes quoting a lot faster ! Clap

It should work on every forum version, so long as the templates aren't modified. Wink

I have some suggestions though :

1. I think the target element is a problem, as it's getting cut off on my one forum. I'd recommend scrolling to this anchor since it's right above the quick reply :
Code:
document.anchors.quickreply


2. .sceditor-container textarea only affects Source mode, not WYSIWYG mode. So, I would recommend setting a sceditor instance on the GET request :
Code:
$.get($(this).attr("href"), function(data) {
 var instance = $('#text_editor_textarea').sceditor('instance');

 instance.insert(quote_text_info + "\n");
 instance.focus();
});
This way, it'll affect both source AND WYSIWYG mode. Check out this documentation for modifications to the SCEditor : http://www.sceditor.com/api/sceditor/


3. I'd change the textarea element in the GET request to #text_editor_textarea as that's the main id for the message editor. If someone has a textarea in the widgets for example, it'll also get this value which is why you should look for specifics or the first instance.


With those suggestions it'll look something like this :
Code:
$(function() {
 
  $(".i_icon_quote").parent().click(function(e) {

    $.get(this.href, function(data) {
     
      var quote_text_info = $('#text_editor_textarea', data).val(),
          instance = $("#text_editor_textarea").sceditor("instance");

      instance.insert(quote_text_info + "\n");
     
      $("html, body").animate({ scrollTop: $(document.anchors.quickreply).offset().top }, 1000, function() {
        instance.focus();
      });

    });
   
    e.preventDefault();

  });

});

Regardless, keep up the good work ! Yes

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Re: phpBB2 - Asynchronous quotes

Post by Abdalah_98 on May 16th 2016, 9:00 am

@Ange Tuteur wrote:This is a nice plugin, as it makes quoting a lot faster ! Clap

It should work on every forum version, so long as the templates aren't modified. Wink

I have some suggestions though :

1. I think the target element is a problem, as it's getting cut off on my one forum. I'd recommend scrolling to this anchor since it's right above the quick reply :
Code:
document.anchors.quickreply


2. .sceditor-container textarea only affects Source mode, not WYSIWYG mode. So, I would recommend setting a sceditor instance on the GET request :
Code:
$.get($(this).attr("href"), function(data) {
 var instance = $('#text_editor_textarea').sceditor('instance');

 instance.insert(quote_text_info + "\n");
 instance.focus();
});
This way, it'll affect both source AND WYSIWYG mode. Check out this documentation for modifications to the SCEditor : http://www.sceditor.com/api/sceditor/


3. I'd change the textarea element in the GET request to #text_editor_textarea as that's the main id for the message editor. If someone has a textarea in the widgets for example, it'll also get this value which is why you should look for specifics or the first instance.


With those suggestions it'll look something like this :
Code:
$(function() {
 
  $(".i_icon_quote").parent().click(function(e) {

    $.get(this.href, function(data) {
     
      var quote_text_info = $('#text_editor_textarea', data).val(),
          instance = $("#text_editor_textarea").sceditor("instance");

      instance.insert(quote_text_info + "\n");
     
      $("html, body").animate({ scrollTop: $(document.anchors.quickreply).offset().top }, 1000, function() {
        instance.focus();
      });

    });
   
    e.preventDefault();

  });

});

Regardless, keep up the good work ! Yes

MUCH BETTER ! AND I SAY : THAT'S SHOULD BE IN NEW TOPIC cheers

Abdalah_98
Forumember

Male Posts : 32
Reputation : 1
Language : EN,AR
Location : Earth :D

http://uteach.forum0.net/

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum