Guest User

Post on many friends the same comm once | EliteRoyal

a guest
May 13th, 2020
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. ToggleManageFriends();
  2. jQuery("#manage_friends").after('<div class="commentthread_entry"><div class="commentthread_entry_quotebox"><textarea rows="1" class="commentthread_textarea" id="comment_textarea" placeholder="Add a comment" style="overflow: hidden; height: 20px;"></textarea></div><div class="commentthread_entry_submitlink" style=""><a class="btn_grey_black btn_small_thin" href="javascript:CCommentThread.FormattingHelpPopup( \'Profile\' );"><span>Formatting help</span></a> <span class="emoticon_container"><span class="emoticon_button small" id="emoticonbtn"></span></span><span class="btn_green_white_innerfade btn_small" id="comment_submit"><span>Post Comments to Selected Friends</span></span></div></div><div id="log"><span id="log_head"></span><span id="log_body"></span></div>');
  3. new CEmoticonPopup( $J('#emoticonbtn'), $J('#commentthread_Profile_0_textarea') );
  4. jQuery("#comment_submit").click(function() {
  5. const total = jQuery(".selected").length;
  6. const msg = jQuery("#comment_textarea").val();
  7. if (total > 0 && msg.length > 0) {
  8. jQuery("#log_head, #log_body").html("");
  9. jQuery(".selected").each(function(i) {
  10. let profileID = this.getAttribute("data-steamid");
  11. (function(i, profileID) {
  12. setTimeout(function() {
  13. jQuery.post("//steamcommunity.com/comment/Profile/post/" + profileID + "/-1/", { comment: msg, count: 6, sessionid: g_sessionID }, function(response) {
  14. if (response.success === false) {
  15. jQuery("#log_body")[0].innerHTML += "<br>" + response.error;
  16. } else {
  17. jQuery("#log_body")[0].innerHTML += "<br>Successfully posted comment on <a href=http://steamcommunity.com/profiles/" + profileID + ">" + profileID + "</a>";
  18. }
  19. }).fail(function() {
  20. jQuery("#log_body")[0].innerHTML += "<br>Failed to post comment on <a href=http://steamcommunity.com/profiles/" + profileID + ">" + profileID + "</a>";
  21. }).always(function() {
  22. jQuery("#log_head").html("<br><b>Processed " + (i+1) + " out of " + total + " friends.<b>");
  23. });
  24. }, i * 6000);
  25. })(i, profileID);
  26. });
  27. } else {
  28. alert("Please make sure you entered a message and selected 1 or more friends.");
  29. }
  30. });
Add Comment
Please, Sign In to add comment