// ==UserScript== // @name Stack Exchange comment template context menu // @namespace http://ostermiller.org/ // @version 1.17.0 // @description Adds a context menu (right click, long press, command click, etc) to comment boxes on Stack Exchange with customizable pre-written responses. // @match https://*.stackexchange.com/questions/* // @match https://*.stackexchange.com/review/* // @match https://*.stackexchange.com/admin/* // @match https://*.stackoverflow.com/*questions/* // @match https://*.stackoverflow.com/review/* // @match https://*.stackoverflow.com/admin/* // @match https://*.askubuntu.com/questions/* // @match https://*.askubuntu.com/review/* // @match https://*.askubuntu.com/admin/* // @match https://*.superuser.com/questions/* // @match https://*.superuser.com/review/* // @match https://*.superuser.com/admin/* // @match https://*.serverfault.com/questions/* // @match https://*.serverfault.com/review/* // @match https://*.serverfault.com/admin/* // @match https://*.mathoverflow.net/questions/* // @match https://*.mathoverflow.net/review/* // @match https://*.mathoverflow.net/admin/* // @match https://*.stackapps.com/questions/* // @match https://*.stackapps.com/review/* // @match https://*.stackapps.com/admin/* // @match https://*.stackoverflow.com/*staging-ground/* // @connect raw.githubusercontent.com // @connect * // @grant GM_addStyle // @grant GM_setValue // @grant GM_getValue // @grant GM_deleteValue // @grant GM_xmlhttpRequest // @downloadURL https://update.greasyfork.icu/scripts/433721/Stack%20Exchange%20comment%20template%20context%20menu.user.js // @updateURL https://update.greasyfork.icu/scripts/433721/Stack%20Exchange%20comment%20template%20context%20menu.meta.js // ==/UserScript== (function() { 'use strict' // Access to JavaScript variables from the Stack Exchange site var $ = unsafeWindow.jQuery // eg. physics.stackexchange.com -> physics function validateSite(s){ var m = /^((?:meta\.)?[a-z0-9]+(?:\.meta)?)\.?[a-z0-9\.]*$/.exec(s.toLowerCase().trim().replace(/^(https?:\/\/)?(www\.)?/,"")) if (!m) return null return m[1] } function validateTag(s){ return s.toLowerCase().trim().replace(/ +/g,"-") } // eg hello-world, hello-worlds, hello world, hello worlds, and hw all map to hello-world function makeFilterMap(s){ var m = {} s=s.split(/,/) for (var i=0; i 0 } function commentWarnHtml(){ var problems = checkCommentLengths() if (!problems.length) return $('') var s = $("