所以我正在开发一个管理用户书签的Chrome扩展程序。我想要做的是显示一个框(div),显示与每个书签相关联的图像及其下面的名称。我能够获得标题和网址的工作。但我无法检索与每个书签关联的图标。
有人能告诉我怎么做吗?
作为参考,我的JS文件是:
function list_bookmarks(bookmarks){
var i;
for ( i=0; i<bookmarks.length ; i++) {
console.log("Works" + i);
var current_bookmark = bookmarks[i];
if(current_bookmark.url) {
var icon = document.createElement('div');
icon.id = "pict";
icon.style.backgroundImage = current_bookmark.FAVICON; // Something here *
document.body.appendChild(icon);
var item = document.createElement('a');
item.className = 'block';
var linkText = document.createTextNode(current_bookmark.title);
item.appendChild(linkText);
item.title = current_bookmark.title;
item.href = current_bookmark.url;
document.body.appendChild(item);
console.log(current_bookmark.title); }
if(current_bookmark.children){ list_bookmarks(current_bookmark.children);}
}
}
window.onload = function(){
console.log("Listing Bookmarks Now :");
chrome.bookmarks.getTree(function(list){
list_bookmarks(list);
});
};
非常感谢你。:)
答案 0 :(得分:2)
batch = 128 # size of the batch
x = tf.placeholder("float32", [None, n_steps, n_input])
y = tf.placeholder("float32", [None, n_classes])
# with a capacity of 100 batches, the bottleneck should not be the data feeding
queue = tf.RandomShuffleQueue(capacity=100*batch,
min_after_dequeue=80*batch,
dtypes=[tf.float32, tf.float32],
shapes=[[n_steps, n_input], [n_classes]])
enqueue_op = queue.enqueue_many([x, y])
X_batch, Y_batch = queue.dequeue_many(batch)
sess = tf.Session()
def load_and_enqueue(data):
while True:
X, Y = data.get_next_batch(batch)
sess.run(enqueue_op, feed_dict={x: X, y: Y})
train_thread = threading.Thread(target=load_and_enqueue, args=(data))
train_thread.daemon = True
train_thread.start()
for _ in xrange(max_iter):
sess.run(train_op)
添加到chrome://favicon/
permissions
字段
manifest.json
有关详细信息,请参阅Issue 45474。