kuy / Wedata Manager
This greasemonkey script works on Wedata and provide various enhancement for editing database items from website.
Clone this repository (size: 24.1 KB): HTTPS / SSH
$ hg clone http://bitbucket.org/kuy/wedata-manager/
| commit 4: | 462c1bd57581 |
| parent 3: | bf2b28a374ee |
| branch: | default |
[ItemList] add operation link to item list page;
- View kuy's profile
-
kuy's public repos »
- CSSocketLib
- libhttpd_sample
- kaerubot
- CSHgCmd
- Google Keyword Highlight
- IdenticonSample
- EndflowControls
- msgdiff
- Wedata Manager
- subscldr
- hgtip-ja-kuy
- win32color
- thg-test
- EFTreeView
- Google Site Image
- GeckoFxHelperSample
- libhttpd
- mercurial-translation-ja
- pxpi
- gm-comps
- thg-web
- GeckoFxSimpleTest
- SharpHg
- qswap
- Hginder
- HginderUI
- dotfiles
- thg-kuy
- thg-ja
- thg-l10n
- Issue Tracker
- Flickr Fav Set
- FirePalette
- GeckoFxHelper
- jsutils
- TreeTool
- Send message
11 months ago
Changed (Δ1.0 KB):
raw changeset »
wedata_manager.user.js (26 lines added, 3 lines removed)
Up to file-list wedata_manager.user.js:
13 |
13 |
// This script consists of some components: |
14 |
14 |
// [Boot] launch the component by matching URL |
15 |
15 |
// [Item] tweak for item page: http://wedata.net/items/28198 |
16 |
// [ItemList] tweak for item list page: http://wedata.net/databases/siteimage/items |
|
16 |
17 |
// }}} |
17 |
18 |
|
18 |
19 |
// Todo {{{ |
20 |
// [All] Test in case of logged out |
|
19 |
21 |
// [Item] Enables Ajax-ed editing |
20 |
22 |
// [ItemList] Adds operation link per items (Edit, Delete, Duplicate) |
21 |
23 |
// [ItemList] Enables in-place editing (like Flickr) |
22 |
24 |
// [ItemList] Shows a graph image in right side |
25 |
// [ItemList] Supports AutoPagerize |
|
23 |
26 |
// [NewItem] Add more forms for creating multiple items at once |
24 |
27 |
// }}} |
25 |
28 |
|
27 |
30 |
var Boot = function(){ |
28 |
31 |
console.log('Boot#new'); |
29 |
32 |
this.comp = { |
30 |
Item: /^http:\/\/wedata\.net\/items\/\d+$/ |
|
33 |
Item: /^http:\/\/wedata\.net\/items\/\d+$/, |
|
34 |
ItemList: /^http:\/\/wedata\.net\/databases\/[^\/]+\/items(\?page\=\d+)?$/ |
|
31 |
35 |
}; |
32 |
36 |
} |
33 |
37 |
Boot.prototype.init = function(){ |
| … | … | @@ -65,6 +69,24 @@ Item.prototype.init = function(){ |
65 |
69 |
} |
66 |
70 |
// }}} |
67 |
71 |
|
72 |
// ItemList {{{ |
|
73 |
var ItemList = function(){ |
|
74 |
console.log('ItemList#new'); |
|
75 |
} |
|
76 |
ItemList.prototype.init = function(){ |
|
77 |
console.log('ItemList#init'); |
|
78 |
||
79 |
var c = function(n){return 'contains(concat(" ",@class," ")," '+n+' ")'}; |
|
80 |
$x('id("content")/ul['+c('items')+']/li['+c('item')+']/div/a['+c('entry-title')+']').forEach(function(a){ |
|
81 |
a.parentNode.appendChild($n('ul', {style: 'display: inline; padding-left: 32px;', className: 'links'}, [ |
|
82 |
$n('li', null, [$n('a', {innerHTML: 'Edit', href: a.href + '/edit'})]), |
|
83 |
$n('li', null, [$n('a', {innerHTML: 'Delete', href: ''})]), |
|
84 |
$n('li', null, [$n('a', {innerHTML: 'Duplicate', href: ''})]) |
|
85 |
])); |
|
86 |
}); |
|
87 |
} |
|
88 |
// }}} |
|
89 |
||
68 |
90 |
// Main {{{ |
69 |
91 |
var boot = new Boot(); |
70 |
92 |
boot.init(); |
| … | … | @@ -73,8 +95,9 @@ boot.init(); |
73 |
95 |
// Utils {{{ |
74 |
96 |
function $x(x,c){c=c||document;var res=document.evaluate(x,c,null,4,null); |
75 |
97 |
for(var i,nodes=[];i=res.iterateNext();nodes.push(i));return nodes} |
76 |
function $n(t,o,c){var e = document.createElement(t);if(o){for(var k in o) |
|
77 |
{e[k]=o[k]}}if(c){c.forEach(function(ch){e.appendChild(ch)})}return e} |
|
98 |
function $n(t,o,c){var e = document.createElement(t);if(o){for(var k in o){ |
|
99 |
if(k=='style'){e.setAttribute(k,o[k])}else{e[k]=o[k]}}}if(c){ |
|
100 |
c.forEach(function(ch){e.appendChild(ch)})}return e} |
|
78 |
101 |
// }}} |
79 |
102 |
|
80 |
103 |
})(); |
