->*img-link
@@ -2,20 +2,44 @@
* @title open images all
* @description open all image-link in new tab/window
* @include http://*
- * @contributor os0x http://let.hatelabo.jp/os0x/let/gYC-xpO93uu1BA (FOrk of)
- * @author noromanba
- * @license MIT License http://opensource.org/licenses/MIT
+ * @contributor os0x http://let.hatelabo.jp/os0x/let/gYC-xpO93uu1BA (Fork of)
+ * @author noromanba http://let.hatelabo.jp/noromanba/let/hLHX5oTN2bUh
+ * @license MIT License http://opensource.org/licenses/MIT
*/
-(function(){
-var links = document.links;
-var match = /\.(jpe?g|png|gif)(\?|$)/i;
-var result = [];
-for(var i in links){
- if(match.test(''+links[i])){
- result.push('<img src="'+links[i]+'" style="max-width: 100%;">');
- }
-}
-var w=open('about:blank','_blank');
-w&&w.document.write('<html><title>'+document.title+'</title><p>'+result.join('<br>')+'</html>');
-w&&w.document.close();
+
+(function () {
+ var container = document.createDocumentFragment().appendChild(document.createElement('div'));
+
+ var style = container.style;
+ style.marginLeft = 'auto';
+ style.marginRight = 'auto';
+ style.maxWidth = '100%';
+ style.textAlign = 'center';
+
+ var index = 0;
+ // TBD immidiately append w/ interval, omit fragment
+ Array.prototype.slice.call(document.links).forEach(function (link) {
+ if(!/\.(jpe?g|png|gif)(\?|$)/i.test(link)) {
+ return;
+ }
+
+ var img = document.createElement('img');
+ img.src = link;
+ img.title = (index += 1);
+
+ container.appendChild(img);
+ container.appendChild(document.createElement('br'));
+ });
+
+ var total = document.createElement('div');
+ total.style.color = '#EEE';
+ // count depends img-div pair. e.q. container.querySelectorAll('img').length
+ total.appendChild(document.createTextNode(container.children.length / 2));
+ container.insertBefore(total, container.firstChild);
+
+ var page = window.open('about:blank', '_blank');
+ page.document.title = document.title;
+ page.document.body.style.backgroundColor = '#000';
+
+ page.document.body.appendChild(container);
})();
/*
* @title open images all
* @description open all image-link in new tab/window
* @include http://*
* @contributor os0x http://let.hatelabo.jp/os0x/let/gYC-xpO93uu1BA (Fork of)
* @author noromanba http://let.hatelabo.jp/noromanba/let/hLHX5oTN2bUh
* @license MIT License http://opensource.org/licenses/MIT
*/
(function () {
var container = document.createDocumentFragment().appendChild(document.createElement('div'));
var style = container.style;
style.marginLeft = 'auto';
style.marginRight = 'auto';
style.maxWidth = '100%';
style.textAlign = 'center';
var index = 0;
// TBD immidiately append w/ interval, omit fragment
Array.prototype.slice.call(document.links).forEach(function (link) {
if(!/\.(jpe?g|png|gif)(\?|$)/i.test(link)) {
return;
}
var img = document.createElement('img');
img.src = link;
img.title = (index += 1);
container.appendChild(img);
container.appendChild(document.createElement('br'));
});
var total = document.createElement('div');
total.style.color = '#EEE';
// count depends img-div pair. e.q. container.querySelectorAll('img').length
total.appendChild(document.createTextNode(container.children.length / 2));
container.insertBefore(total, container.firstChild);
var page = window.open('about:blank', '_blank');
page.document.title = document.title;
page.document.body.style.backgroundColor = '#000';
page.document.body.appendChild(container);
})();
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。