FunkyPigeon

Comment All Friends

Oct 13th, 2021 (edited)
12,775
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. http://steamcommunity.com/my/friends
  2.  
  3. ToggleManageFriends();
  4. 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>');
  5. new CEmoticonPopup( $J('#emoticonbtn'), $J('#commentthread_Profile_0_textarea') );
  6. jQuery("#comment_submit").click(function() {
  7. const total = jQuery(".selected").length;
  8. const msg = jQuery("#comment_textarea").val();
  9. if (total > 0 && msg.length > 0) {
  10. jQuery("#log_head, #log_body").html("");
  11. jQuery(".selected").each(function(i) {
  12. let profileID = this.getAttribute("data-steamid");
  13. (function(i, profileID) {
  14. setTimeout(function() {
  15. jQuery.post("//steamcommunity.com/comment/Profile/post/" + profileID + "/-1/", { comment: msg, count: 6, sessionid: g_sessionID }, function(response) {
  16. if (response.success === false) {
  17. jQuery("#log_body")[0].innerHTML += "<br>" + response.error;
  18. } else {
  19. jQuery("#log_body")[0].innerHTML += "<br>Successfully posted comment on <a href=http://steamcommunity.com/profiles/" + profileID + ">" + profileID + "</a>";
  20. }
  21. }).fail(function() {
  22. jQuery("#log_body")[0].innerHTML += "<br>Failed to post comment on <a href=http://steamcommunity.com/profiles/" + profileID + ">" + profileID + "</a>";
  23. }).always(function() {
  24. jQuery("#log_head").html("<br><b>Processed " + (i+1) + " out of " + total + " friends.<b>");
  25. });
  26. }, i * 6000);
  27. })(i, profileID);
  28. });
  29. } else {
  30. alert("Please make sure you entered a message and selected 1 or more friends.");
  31. }
  32. });
Add Comment
Please, Sign In to add comment