Created
July 1, 2012 13:18
-
-
Save mugyu/3028406 to your computer and use it in GitHub Desktop.
google chrome api を利用してurlの一部がタブっているブックマークを削除
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//自己責任的な方向で | |
chrome.bookmarks.search("アイドルマスター シンデレラガールズ", | |
function(nodes){ | |
var re = /(?:Fbattle_check%2F|show%2F)(\d+)/; | |
var arr = []; | |
for(i in nodes){ | |
if (nodes[i].url.match(re)){ | |
arr.push([nodes[i], RegExp.$1]); | |
} | |
}; | |
var pre = [null, null]; | |
for (i in arr.sort(function(a, b){return a[1] - b[1]})){ | |
if (pre[1] == arr[i][1]){ | |
// console.log(pre[1]); | |
if (confirm("ID: " + pre[1] + " 消しちゃっていい?")){ | |
chrome.bookmarks.remove(pre[0].id); | |
// console.log("いいよ: " + pre[1] + " " + pre[0].id); | |
} | |
} | |
pre = arr[i]; | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment