-
Notifications
You must be signed in to change notification settings - Fork 3
/
保存复制时间.ini
43 lines (40 loc) · 1.44 KB
/
保存复制时间.ini
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
37
38
39
40
41
42
43
[Command]
Name=保存复制时间
Command="
var tagsMime = 'application/x-copyq-tags'
var timeMime = 'application/x-copyq-user-item-time'
global.onItemsAdded = function () {
if ( selectedTab() == settings('trash_tab') )
abort()
var time = dateString('yyyy-MM-dd hh:mm:ss')
var rows = selectedItems()
var offset = 0
while (plugins.itempinned.isPinned(offset)) {
offset++
}
for (let i = 0; i < rows.length; i++) {
change(rows[i] + offset, timeMime, time, tagsMime, time)
}
}
global.onItemsChanged = function () {
var time = dateString('yyyy-MM-dd hh:mm:ss')
var rows = selectedItems()
for (let i = 0; i < rows.length; i++) {
var new_tag = \"\"
var item = getItem(rows[i])
var old_tag = str(item[tagsMime])
if (old_tag != 'undefined') {
var old_time = old_tag.match(/\\d{4}-\\d{2}-\\d{2} \\d{2}\\:\\d{2}\\:\\d{2}/)
if (old_time) {
if (new Date(time) - new Date(old_time) < 1000)
abort()
new_tag = old_tag.replace(old_time, time)
} else {
new_tag = time + ',' + old_tag
}
}
change(rows[i], timeMime, time, tagsMime, new_tag)
}
}"
IsScript=true
Icon=