-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSalesforce_Copy_Case_Number.user.js
More file actions
36 lines (33 loc) · 1.17 KB
/
Salesforce_Copy_Case_Number.user.js
File metadata and controls
36 lines (33 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// ==UserScript==
// @name Salesforce Copy Case Number
// @namespace http://csutherl.github.io/
// @version 0.3
// @description Click button to copy Salesforce case number
// @author rbost
// @match https://gss--c.na7.visual.force.com/apex/Case_View*
// @grant GM_setClipboard
// @updateURL https://github.com/csutherl/random-userscripts/raw/master/Salesforce_Copy_Case_Number.user.js
// ==/UserScript==
function copyToClipboard() {
var elements = document.getElementsByClassName("pageDescription");
if (elements.length == 1) {
var caseNumber = elements[0].innerText;
GM_setClipboard(caseNumber, "text");
}
}
(function() {
'use strict';
var button = document.createElement("button");
button.style.position = "fixed";
button.style.right = 0;
button.style.bottom = 0;
button.innerText = "Copy Case Number";
button.onclick = copyToClipboard;
document.body.appendChild(button);
// Add hotkey for copying case number. ALT+SHIFT+C
window.addEventListener("keydown", function(event) {
if (event.altKey && event.shiftKey && event.keyCode == 67) {
copyToClipboard();
}
});
})();