img
要素のsrc
属性の値を一覧でブラウザーのコンソール画面に表示するブックマークレット。
javascript:Array.prototype.forEach.call(document.querySelectorAll('img[src]'), el => console.log(el.getAttribute('src')));
次のブックマークレットは、画像ファイルの拡張子が.png
、.jpg
、.gif
である場合のみコンソール画面に表示される。
javascript:Array.prototype.forEach.call(document.querySelectorAll('img[src]'), el => { const src = el.getAttribute('src'); if (src.match(/\.(?:png|jpg|gif)$/)) console.log(src); });