Created
May 21, 2015 18:40
-
-
Save feihong/54ba2969866f9065016d to your computer and use it in GitHub Desktop.
Copy Crowdin phrases to clipboard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Copy Crowdin text to clipboard | |
| // @namespace https://github.com/feihong/ | |
| // @description Copies the source and translation phrase to the clipboard. | |
| // @include https://crowdin.com/translate/* | |
| // @version 1 | |
| // @grant GM_setClipboard | |
| // ==/UserScript== | |
| var menu = document.querySelector('#editor-menu'); | |
| var li = document.createElement('li'); | |
| li.style = "color: white; padding-top: 6px; cursor: pointer;"; | |
| li.innerHTML = 'Copy'; | |
| menu.appendChild(li); | |
| li.onclick = function() { | |
| var sourcePhrase = document.querySelector('#source_phrase_container').textContent; | |
| var translationPhrase = document.querySelector('#translation').value; | |
| var result = sourcePhrase + '\n' + translationPhrase; | |
| // alert(result); | |
| GM_setClipboard(result); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment