66// @description Powerful picture viewing tool online, which can popup/scale/rotate/batch save pictures or find the HD original picture automatically
77// @description :zh-CN NLF 的围观图修改版,增加高清原图查找显示(在线看图工具,支持图片翻转、旋转、缩放、弹出大图、批量保存、查找原图)
88// @description :zh-TW NLF 的圍觀圖修改版,增加高清原圖查詢顯示(線上看圖工具,支援圖片翻轉、旋轉、縮放、彈出大圖、批量儲存、查詢原圖)
9- // @version 2017.4.9.3
9+ // @version 2017.4.10.1
1010// @created 2011-6-15
1111// @namespace http://userscripts.org/users/NLF
1212// @homepage http://hoothin.com
8787 loadAll :false , //加载更多时是否加载全部页面
8888 fitToScreen :true , //图片适应屏幕(适应方式为contain,非cover).
8989 scrollEndToChange :true ,
90+ exportType :'grid' ,
9091 sidebarPosition : 'bottom' , //'top' 'right' 'bottom' 'left' 四个可能值
9192 sidebarSize : 120 , //侧栏的高(如果是水平放置)或者宽(如果是垂直放置)
9293 sidebarToggle : true , // 是否显示隐藏按钮
@@ -3453,7 +3454,10 @@ padding-left:24px;">'+shareItem.name+'</span>');
34533454 } ,
34543455 nextPage :function ( ) {
34553456 var pageObj = this . getPage ( ) ;
3456- if ( ! pageObj . next ) return ;
3457+ if ( ! pageObj . next ) {
3458+ alert ( "已加载至最后一页" ) ;
3459+ return ;
3460+ }
34573461 var nextUrl = pageObj . next ;
34583462 if ( nextUrl . tagName != "A" ) {
34593463 var childA = nextUrl . querySelector ( "a" ) ;
@@ -3663,13 +3667,19 @@ display:none !important;\
36633667 } ,
36643668 getAllValidImgs :function ( newer ) {
36653669 var validImgs = [ ] ;
3666-
36673670 var imgs = document . getElementsByTagName ( 'img' ) ,
36683671 container = document . querySelector ( '.pv-gallery-container' ) ,
36693672 preloadContainer = document . querySelector ( '.pv-gallery-preloaded-img-container' ) ;
36703673
3674+ imgs = Array . prototype . slice . call ( imgs ) ;
3675+ arrayFn . forEach . call ( document . querySelectorAll ( "iframe" ) , function ( iframe ) {
3676+ if ( iframe . src . replace ( / \/ [ ^ \/ ] * $ / , "" ) . indexOf ( location . hostname ) != - 1 )
3677+ arrayFn . forEach . call ( iframe . contentWindow . document . getElementsByTagName ( 'img' ) , function ( img ) {
3678+ imgs . push ( img ) ;
3679+ } ) ;
3680+ } ) ;
36713681 // 排除库里面的图片
3672- imgs = Array . prototype . slice . call ( imgs ) . filter ( function ( img ) {
3682+ imgs = imgs . filter ( function ( img ) {
36733683 return ! ( container . contains ( img ) || preloadContainer . contains ( img ) ) ;
36743684 } ) ;
36753685
@@ -3691,7 +3701,7 @@ display:none !important;\
36913701 } ,
36923702 scrollToEndAndReload : function ( ) { // 滚动主窗口到最底部,然后自动重载库的图片
36933703
3694- window . scrollTo ( 0 , 99999 ) ;
3704+ window . scrollTo ( 0 , 9999999 ) ;
36953705
36963706 var self = this ;
36973707 clearTimeout ( self . reloadTimeout ) ;
@@ -3717,13 +3727,13 @@ display:none !important;\
37173727.list>div {text-align:center;}\
37183728.list>div>img { max-width: 100%; }\
37193729.gridBig{margin: 0px;}\
3720- .gridBig>div { float: left;}\
3730+ .gridBig>div { float: left;margin: 0px 0px 1px 1px; }\
37213731.gridBig>div>img { max-width: 100%; }\
37223732</style>\
37233733</head>\
3724- <body class="grid ">\
3734+ <body class="' + prefs . gallery . exportType + ' ">\
37253735<p>【图片标题】:' + title + '</p>\
3726- <p>【图片数量】:' + nodes . length + ' <select onchange="document.body.className=this.options[this.options.selectedIndex].value"><option value="grid">平铺排序</option><option value="gridBig">原图平铺</option><option value="list">列表排序</option></select></p>\
3736+ <p>【图片数量】:' + nodes . length + ' <select onchange="document.body.className=this.options[this.options.selectedIndex].value"><option value="grid" ' + ( prefs . gallery . exportType == "grid" ? "selected='selected'" : "" ) + ' >平铺排序</option><option value="gridBig" ' + ( prefs . gallery . exportType == "gridBig" ? "selected='selected'" : "" ) + ' >原图平铺</option><option value="list" ' + ( prefs . gallery . exportType == "list" ? "selected='selected'" : "" ) + ' >列表排序</option></select></p>\
37273737' ;
37283738
37293739 html += arr . join ( '\n' ) + '</body>'
@@ -8084,7 +8094,7 @@ background-image:url("'+ prefs.icons.magnifier +'");\
80848094 }
80858095
80868096 function keydown ( event ) {
8087- if ( event . ctrlKey || event . shiftKey || event . altKey || event . metaKey )
8097+ if ( ! prefs . floatBar . keys . enable || event . ctrlKey || event . shiftKey || event . altKey || event . metaKey )
80888098 return ;
80898099
80908100 if ( floatBar && floatBar . shown && isKeyDownEffectiveTarget ( event . target ) ) {
@@ -8122,9 +8132,9 @@ background-image:url("'+ prefs.icons.magnifier +'");\
81228132 document . addEventListener ( 'mouseover' , globalMouseoverHandler , true ) ;
81238133
81248134 // 注册按键
8125- if ( prefs . floatBar . keys . enable ) {
8126- document . addEventListener ( 'keydown' , keydown , false ) ;
8127- }
8135+ // if (prefs.floatBar.keys.enable) {
8136+ document . addEventListener ( 'keydown' , keydown , false ) ;
8137+ // }
81288138
81298139
81308140 var debug ; // 调试函数
@@ -8214,7 +8224,7 @@ background-image:url("'+ prefs.icons.magnifier +'");\
82148224 } ,
82158225 // 按键
82168226 'floatBar.keys.enable' : {
8217- label : '启用以下4个快捷键 ' ,
8227+ label : '启用以下快捷键 ' ,
82188228 type : 'checkbox' ,
82198229 "default" : prefs . floatBar . keys . enable
82208230 } ,
@@ -8287,6 +8297,16 @@ background-image:url("'+ prefs.icons.magnifier +'");\
82878297 "default" : prefs . gallery . scrollEndToChange ,
82888298 title : '取消上一选项后才有效'
82898299 } ,
8300+ 'gallery.exportType' : {
8301+ label : '图片导出默认排序' ,
8302+ type : 'select' ,
8303+ options : {
8304+ 'grid' : '平铺排序' ,
8305+ 'gridBig' : '原图平铺' ,
8306+ 'list' : '列表排序'
8307+ } ,
8308+ "default" : prefs . gallery . exportType ,
8309+ } ,
82908310 'gallery.loadAll' : {
82918311 label : '加载更多图片时自动处理至尾页' ,
82928312 type : 'checkbox' ,
0 commit comments