Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Functia fast post message, am facut acest cod pentru cei care vor sa aiba si eu un fast reply pentru topicuri, fara sa mai faca reload page cand postezi
- * Versiune: v1.0
- * Developer: SSYT (ForumGratuit)
- */
- (function($) {
- window.FastReply = function(version) {
- if(version == "phpbb3")
- {
- var arrType = new Array();
- // Prevent reload page of form submit !
- $('form#quick_reply').on("submit", function(e){e.preventDefault()});
- $('form#quick_reply input[name="post"][type="submit"]').on("click", function(e) {
- e.preventDefault();
- arrType['formData'] = $('form#quick_reply');
- arrType['tid'] = $('input[name="tid"]', arrType.formData).val();
- arrType['t'] = $('input[name="t"]', arrType.formData).val();
- arrType['lt'] = $('input[name="lt"]', arrType.formData).val();
- arrType['auth1'] = $('input[name="auth"]:eq(0)', arrType.formData).val();
- arrType['auth2'] = $('input[name="auth"]:eq(1)', arrType.formData).val();
- arrType['message'] = $("#text_editor_textarea", arrType.formData).sceditor('instance').val();
- arrType['value'] = $("#text_editor_textarea", arrType.formData).sceditor("instance").val().replace(/\s/g, '').length;
- arrType['urlaction'] = "/post?t="+ arrType[2] +"&mode=reply";
- if(5 <= arrType.value || arrType.message == "") {
- alert("Nu a fost introdus numarul minim de caractere, sau nu exista nici un caracter !");
- } else {
- $.post(arrType.urlaction, {
- 'message': arrType.message,
- 'attach_sig': 1,
- 'mode': "reply",
- 'tid': arrType.tid,
- 't': arrType.t,
- 'lt': arrType.lt,
- 'notify': 0,
- 'auth': arrType.auth1,
- 'auth': arrType.auth2,
- 'post': 1
- }, function(succes) {
- if(succes.indexOf("Flood") != -1) {
- alert("Error!\nYou must wait 5 second before replying");
- $(".lreply").fadeOut(300);
- }
- if(succes.indexOf("A new") != -1) {
- alert("Error!\nSomeone had replied before you posted\nYou must refresh the page to continue.\nNotice : You should save or copy your message if you don't want it gone");
- $(".lreply").fadeOut(300);
- }
- if($(succes).find(".message a:first").attr('href').length > 1) {
- arrType['urlPost'] = $(succes).find(".message a:first").attr('href');
- $.get(arrType.urlPost, function(z) {
- $("#quick_reply input[name='auth[]']:last").val($(z).find("#quick_reply input[name='auth[]']:last").val());
- $("#quick_reply input[name='lt']").val($(z).find("#quick_reply input[name='lt']").val());
- $(z).find(".post:last").hide().insertAfter(".post:last").slideDown(400);
- });
- }
- }).fail(function() {
- alert("Error!\nA aparut o problema la trimiterea acestui mesaj !");
- $(".lreply").fadeOut(300);
- });
- $("#text_editor_textarea").sceditor('instance').val("");
- $(".lreply").fadeOut(300);
- }
- });
- console.log("[FG Plugin] Succes load plugin `Fast Reply` by SSYT !\n[FG Plugin] Your curent version used:", version);
- } else { alert("Error !\n Please select your forum version") };
- }
- }(jQuery));
- FastReply("phpbb3");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement