我用
使用方法如下,译自英文回复:
非常感谢Giacomo1871。你的方法确实有用!我另外做了一个可以更加灵活地删除条目的Bookmarklet。类似地:1.将代码加入书签栏。2.在Personal Documents页面,点击一下这个书签,然后在每个条目之前会出现一个复选框。3.选择你想删除条目对应的复选框。当然也有全部选择、全部不选和反向选择的快速连接。4.再次点击书签,被选择的条目将被删除。
代码如下:
javascript:(function(){ var v = new RegExp('PersonalDocuments'); if (!v.test(document.URL)) { return false; } {a=document.getElementsByClassName('rowBodyCollapsed');b=document.getElementsByName('checkboxForDelete');if(b.length==0){document.getElementById('Row1Button').innerHTML += "<a href='javascript:(function(){for(var i=0;i<b.length;i++){b[i].checked=true;};})();'>All</a><a href='javascript:(function(){for(var i=0;i<b.length;i++){b[i].checked=false;};})();'> None</a><a href='javascript:(function(){for(var i=0;i<b.length;i++){b[i].checked=!b[i].checked;};})();'> Reverse</a>";for(var i = 0; i<a.length; i++){ tmp=document.getElementById('Row' + (i+1) + 'Button'); tmp.innerHTML += "<input type='checkbox' name='checkboxForDelete' />";};}else{for(var i = 0; i<b.length; i++){if(b[i].checked){Fion.deleteItem('deleteItem_'+a[i].getAttribute('asin'));}};}return;}})();
请使用下面的代码,修复了某些浏览器中在非Personal Documents页面中执行脚本会跳转页面的bug:
javascript:(function(){ var v = new RegExp('PersonalDocuments'); if (!v.test(document.URL)) {alert("The script can only work in Personal Documents!");}else{a=document.getElementsByClassName('rowBodyCollapsed');b=document.getElementsByName('checkboxForDelete');if(b.length==0){document.getElementById('Row1Button').innerHTML += "<a href='javascript:(function(){for(var i=0;i<b.length;i++){b[i].checked=true;};})();'>All</a><a href='javascript:(function(){for(var i=0;i<b.length;i++){b[i].checked=false;};})();'> None</a><a href='javascript:(function(){for(var i=0;i<b.length;i++){b[i].checked=!b[i].checked;};})();'> Reverse</a>";for(var i = 0; i<a.length; i++){ tmp=document.getElementById('Row' + (i+1) + 'Button'); tmp.innerHTML += "<input type='checkbox' name='checkboxForDelete' />";};}else{for(var i = 0; i<b.length; i++){if(b[i].checked){Fion.deleteItem('deleteItem_'+a[i].getAttribute('asin'));}};}return;}})();
For English Users:
Thanks for Giacomo1871. It does work! And I've made another bookmarklet can delete items more flexibly. Likewise: 1.Make a bookmarklet. 2.In personal documents page, click the bookmarklet, and there will be a checkbox in front of every item. 3.Select the box if you want delete the item, and there are three links can select ALL, NONE and REVERSE. 4.Click the bookmarklet again, the selected items will be deleted perfectly!
Here you are:
javascript:(function(){ var v = new RegExp('PersonalDocuments'); if (!v.test(document.URL)) { return false; } {a=document.getElementsByClassName('rowBodyCollapsed');b=document.getElementsByName('checkboxForDelete');if(b.length==0){document.getElementById('Row1Button').innerHTML += "<a href='javascript:(function(){for(var i=0;i<b.length;i++){b[i].checked=true;};})();'>All</a><a href='javascript:(function(){for(var i=0;i<b.length;i++){b[i].checked=false;};})();'> None</a><a href='javascript:(function(){for(var i=0;i<b.length;i++){b[i].checked=!b[i].checked;};})();'> Reverse</a>";for(var i = 0; i<a.length; i++){ tmp=document.getElementById('Row' + (i+1) + 'Button'); tmp.innerHTML += "<input type='checkbox' name='checkboxForDelete' />";};}else{for(var i = 0; i<b.length; i++){if(b[i].checked){Fion.deleteItem('deleteItem_'+a[i].getAttribute('asin'));}};}return;}})();
Please use the code blow below, fix a bug existed in a few browsers which would redirect page if you run this script in the NONE Personal Documents page:
javascript:(function(){ var v = new RegExp('PersonalDocuments'); if (!v.test(document.URL)) {alert("The script can only work in Personal Documents!");}else{a=document.getElementsByClassName('rowBodyCollapsed');b=document.getElementsByName('checkboxForDelete');if(b.length==0){document.getElementById('Row1Button').innerHTML += "<a href='javascript:(function(){for(var i=0;i<b.length;i++){b[i].checked=true;};})();'>All</a><a href='javascript:(function(){for(var i=0;i<b.length;i++){b[i].checked=false;};})();'> None</a><a href='javascript:(function(){for(var i=0;i<b.length;i++){b[i].checked=!b[i].checked;};})();'> Reverse</a>";for(var i = 0; i<a.length; i++){ tmp=document.getElementById('Row' + (i+1) + 'Button'); tmp.innerHTML += "<input type='checkbox' name='checkboxForDelete' />";};}else{for(var i = 0; i<b.length; i++){if(b[i].checked){Fion.deleteItem('deleteItem_'+a[i].getAttribute('asin'));}};}return;}})();
Thanks sooooo much!! It is very helpful!!!
ReplyDeletethanks~
ReplyDeleteThank you.Very useful!!
ReplyDeleteT T终于能批量删了 每次看到一版kindle4rss就心绞痛
ReplyDelete