Skip to content

Instantly share code, notes, and snippets.

@satyr
Created November 1, 2008 04:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satyr/21469 to your computer and use it in GitHub Desktop.
Save satyr/21469 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name WedataJSONInput
// @namespace http://d.hatena.ne.jp/murky-satyr
// @description Fills the form by prompting json text.
// @include http://wedata.net/databases/*/items/new
// @include http://wedata.net/items/*/edit
// ==/UserScript==
with(document) with(getElementById('item').appendChild(createElement('a'))){
href = 'javascript:';
innerHTML = '<b>[JSON]</b>';
addEventListener('click', function(){
for(var [k, v] in Iterator(eval('('+ (prompt('JSON', '{}')
.replace(/[^\}]*$/, ')')))))
(getElementById('data['+k+']')||getElementById('name')||0).value = v;
}, false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment