help/formattin

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

当前为 2015-11-10 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name help/formattin
  3. // @version 1.0
  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(){ $("textarea[name='comment']").val($("textarea[name='comment']").val().replace(/\[help\/formatting\]/g,"[formatting tools](/help/formatting)"))}
  22. })