Skip to content

Instantly share code, notes, and snippets.

@satyr
Created June 30, 2009 09:47
Show Gist options
  • Save satyr/138095 to your computer and use it in GitHub Desktop.
Save satyr/138095 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name JGate Hacks
// @namespace http://d.hatena.ne.jp/murky-satyr
// @include http://apps.jgate.de/platform/edit?*
// ==/UserScript==
setTimeout(function(){
var {$, editor} = unsafeWindow;
var name = location.search.slice(1);
var form = document.forms[0].wrappedJSObject;
$(form.code).remove();
$('<textarea name="code">').css({
width: "97%",
height: "480px",
}).val(editor.exportCode()).appendTo(form);
form.onsubmit = '';
form.target = name;
$('#editorcontainer').remove();
document.addEventListener('keypress', function(e){
if(e.altKey && "R" === String.fromCharCode(e.which).toUpperCase()){
var code = form.code.value;
if(code) GM_setValue(name, code);
form.submit();
e.preventDefault();
e.stopPropagation();
}
}, true);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment