help/formattin

Converts [help/formatting] into the link to help center article on formatting

  1. // ==UserScript==
  2. // @name help/formattin
  3. // @version 1.1
  4. // @description Converts [help/formatting] into the link to help center article on formatting
  5. // @author nicael
  6. // @include *://*.stackexchange.com/questions/*
  7. // @include *://*stackoverflow.com/questions/*
  8. // @include *://*serverfault.com/questions/*
  9. // @include *://*superuser.com/questions/*
  10. // @include *://*askubuntu.com/questions/*
  11. // @include *://*stackapps.com/questions/*
  12. // @grant none
  13. // @namespace https://greasyfork.org/users/9713
  14. // ==/UserScript==
  15.  
  16. $(document).on("focus","textarea[name='comment']",function(){
  17. $(document).on("click","input",function(){rs();})
  18. $(document).on("keydown","textarea[name='comment']",function(e){
  19. if(e.which == 13){rs()}
  20. })
  21. function rs(){
  22. $("textarea[name='comment']").val($("textarea[name='comment']").val().replace(/\[help\/formatting\]/g,"[formatting tools](/help/formatting)"))
  23. if($("textarea[name='comment']").val().indexOf('[formatting tools]')==0){$("textarea[name='comment']").val($("textarea[name='comment']").val().replace("[f","[F"))}
  24. }
  25. })