喜好

喜好检索

生活 蔬菜

蔬菜大全

思考

见闻与录

BT技术

BT蓝牙技术

标签

JS脚本 2021年04月11日

    简介

    鼠标双击下页脚本

    
    // ==UserScript==
    // @name         Zukgit自研双击下一页脚本
    // @name:zh-CN   Zukgit自研双击下一页脚本
    // @name:zh-TW   Zukgit自研双击下一页脚本
    // @namespace    http://tampermonkey.net/
    // @version      0.1
    // @description  hello world
    // @author       You
    // @match        http://*/*
    // @match        https://*/*
    // @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
    // @grant        none
    // @run-at       document-end
    // ==/UserScript==
    
    (function() {
        'use strict';
    
        // Your code here...
    	console.log("location.hostname:",location.hostname);
    	console.log("location:",location);
    	console.log("location.href:",location.href);
    
    	
    	
    	// alert('测试Zukgit脚本! location.hostname:'+location.hostname);
    	//  https://www.ahhhhfs.com/page/4/
    	var curPageUrl = location.href;
    
    	var nextPageUrl = getCurrentPageIndex(curPageUrl);
    
        var flag_is_undefined = (typeof nextPageUrl === 'undefined');
    
    	console.log(" nextPageUrl :",nextPageUrl +"   【flag_is_undefined:"+flag_is_undefined+"】");
    	if (flag_is_undefined ) {
    		 console.log("xxxxxxxxxxxxxxxx nextPageUrl :",nextPageUrl +" xxxxxxxxxxxxxxxx  Failed!");
        } else {
    		
    		console.log("________________ nextPageUrl :",nextPageUrl +" Success!");
    		
    		    document.addEventListener('dblclick', onDocumenDblClick);
    
            	document.onkeydown = function(event) {
            	var e = event || window.event || arguments.callee.caller.arguments[0];
            	if (e && e.keyCode == 27) {
            		//alert("按 Esc");
            	}
            	if (e && e.keyCode == 32) {
            		//alert("按空格__nextPageUrl"+nextPageUrl);
    				GoToPage_InOne_Windows(nextPageUrl);
            	}
            	if (e && e.keyCode == 13) {
            		//alert("按回车");
            	}
            };
    
        function onDocumenDblClick(event) {
            //alert("鼠标双击__nextPageUrl"+nextPageUrl);
    		GoToPage_InOne_Windows(nextPageUrl);
          }
    	  
    	}
    	
    
    	function GoToPage_InOne_Windows(rawUrl ) {
    		location.href=rawUrl;
    	}
    
    
        function DefaultFirst_PageInfo(mIndex,pre,end,nextPaddingStr)
        {
            this.page_index=mIndex;
            this.page_pre=pre;
            this.page_end=end;
            this.page_nextpaddingstr=nextPaddingStr;
        }
    	
        function Next_PageInfo(mIndex,pre,end,step)
        {
            this.page_index=mIndex;
            this.page_pre=pre;
            this.page_end=end;
            this.page_step=step;
        }
    
           // 非缺省的第二个页面开始的逻辑
    	    // https://www.aisixiang.com/data/search?column=33&page=4         数字在最后的情况
        function getCurrentPageIndex(rawUrl ) {
            var Page_Index = 0;
            var Next_PageInfo_List=new Array(
        	    new Next_PageInfo(Page_Index++,"https://www.ahhhhfs.com/page/","/",1),   // 【 https://www.ahhhhfs.com/page/2/ 】
        	    new Next_PageInfo(Page_Index++,"https://project-gutenberg.github.io/Pincong/page/","/",1),   // 【https://github.com/houshanren?page=2&tab=repositories】
        	    new Next_PageInfo(Page_Index++,"?page=","&tab=repositories",1),   // 【https://github.com/houshanren?page=2&tab=repositories】
                new Next_PageInfo(Page_Index++,"https://www.guancha.cn/ChanJing/list_",".shtml",1),// 【https://www.guancha.cn/ChanJing/list_2.shtml】
        	    new Next_PageInfo(Page_Index++,"https://greasyfork.org/zh-CN/scripts?page=","",1),   // 【  https://greasyfork.org/zh-CN/scripts?page=2 】
                new Next_PageInfo(Page_Index++,"https://www.aisixiang.com/data/search?column=33&page=","",1),// 【 https://www.aisixiang.com/data/search?column=33&page=2 】
        	    new Next_PageInfo(Page_Index++,"https://www.52pojie.cn/forum-2-",".html",1),// 【 https://www.52pojie.cn/forum-2-2.html 】
    			new Next_PageInfo(Page_Index++,"https://www.guancha.cn/CaiJing/list_",".shtml",1),// 【 https://www.guancha.cn/CaiJing/list_2.shtml 】
    			new Next_PageInfo(Page_Index++,"https://www.pixiv.net/tags/R-18/artworks?p=","&s_mode=s_tag",1),// 【 https://www.pixiv.net/tags/R-18/artworks?p=3&s_mode=s_tag 】
    			new Next_PageInfo(Page_Index++,"/artworks?p=","",1),// 【 https://www.pixiv.net/users/95088726/artworks?p=2 】
    			
    			
    			
        	    );
        
                for (var i = 0; i < Next_PageInfo_List.length; i++) {
                     var mNext_PageInfo =   Next_PageInfo_List[i];
                	 console.log("══════════════ Begin Next_PageInfo_List["+i+"_"+Next_PageInfo_List.length+"]____page_index=["+mNext_PageInfo.page_index+"]  page_pre=["+mNext_PageInfo.page_pre+"]  page_end=["+mNext_PageInfo.page_end+"]   page_step=["+mNext_PageInfo.page_step+"]" +"Begin ═══════════════"  );
                
                			var Page9999_Index = mNext_PageInfo.page_index;
                			var Page9999_Pre = mNext_PageInfo.page_pre;
                			var Page9999_End = mNext_PageInfo.page_end;
                			var Page9999_One_Step= mNext_PageInfo.page_step;
                	
                			if(rawUrl.indexOf(Page9999_Pre) >= 0 && rawUrl.indexOf(Page9999_End) >= 0){
                				console.log(" Page9999_Pre="+(Page9999_Pre)+"  Page9999_End="+Page9999_End);
                				console.log(" Page9999_Pre_Length="+(Page9999_Pre.length)+"  Page9999_End_Length="+(rawUrl.length-Page9999_End.length));
                				console.log("【indexOf_Page9999_Pre_Index:"+rawUrl.indexOf(Page9999_Pre) +"】    【indexOf_Page9999_End_Index:"+rawUrl.lastIndexOf(Page9999_End) +"】"); 
                                var Page9999_Index_Str = rawUrl.substring(rawUrl.indexOf(Page9999_Pre)+Page9999_Pre.length,rawUrl.lastIndexOf(Page9999_End));
                				console.log("【Page9999_Index_Str:"+Page9999_Index_Str +"】    【rawUrl:"+rawUrl+"】");
                				if(!isNaN(Number(Page9999_Index_Str))){
                					var Page9999_Index_Int = parseInt(Page9999_Index_Str, 10);
                					var Page9999_NextPage_Int = Page9999_Index_Int + Page9999_One_Step;
                				    console.log("【Page9999_Index_Int:"+Page9999_Index_Int +"】  【Page9999_Index_Str:"+Page9999_Index_Str+"】");
                					console.log("【Page9999(Pre)_rawUrl.substring(0,rawUrl.indexOf(Page9999_Pre)+Page9999_Pre.length):"+rawUrl.substring(0,rawUrl.indexOf(Page9999_Pre)+Page9999_Pre.length) +"】 ");
                				    console.log("【Page9999_NextPage_Int:"+Page9999_NextPage_Int +"】 ");
                					console.log("【Page9999(End):"+Page9999_End +"】 ");
                					var Page9999_NextPage_URL = rawUrl.substring(0,rawUrl.indexOf(Page9999_Pre)+Page9999_Pre.length)+Page9999_NextPage_Int+Page9999_End;
                					console.log("【Page9999_NextPage_URL:"+Page9999_NextPage_URL +"】 ");
                                    return Page9999_NextPage_URL;
                                } else {
                					console.log("【Page9999_Index_Str:"+Page9999_Index_Str +" parse Failed please check !】  ");
                				}
                            }
                	 console.log("══════════════ End Next_PageInfo_List["+i+"_"+Next_PageInfo_List.length+"]____page_index=["+mNext_PageInfo.page_index+"]  page_pre=["+mNext_PageInfo.page_pre+"]  page_end=["+mNext_PageInfo.page_end+"]   page_step=["+mNext_PageInfo.page_step+"]" +"End ═══════════════"  );
                
                }
    			
    			
    
           // 缺省的第一个页面的逻辑
            var DefaultFirst_PageInfo_List=new Array(
    		            // 【 https://www.pixiv.net/users/95088726/artworks ->  https://www.pixiv.net/users/95088726/artworks?p=2】
    		    	    new DefaultFirst_PageInfo(Page_Index++,"/artworks","","?p=2"), 
    					
    					// 【 https://project-gutenberg.github.io/Pincong/ ->  https://project-gutenberg.github.io/Pincong/page/2/】
    		    	    new DefaultFirst_PageInfo(Page_Index++,"https://project-gutenberg.github.io/Pincong/","","page/2/"), 
    					
    		);
        
    	
    	            for (var i = 0; i < DefaultFirst_PageInfo_List.length; i++) {
                     var mDefaultFirst_PageInfo =   DefaultFirst_PageInfo_List[i];
                	 console.log("══════════════ Begin DefaultFirst_PageInfo_List["+i+"_"+DefaultFirst_PageInfo_List.length+"]____page_index=["+mDefaultFirst_PageInfo.page_index+"]  page_pre=["+mDefaultFirst_PageInfo.page_pre+"]  page_end=["+mDefaultFirst_PageInfo.page_end+"]   page_nextpaddingstr=["+mDefaultFirst_PageInfo.page_nextpaddingstr+"]" +"Begin ═══════════════"  );
                
                			var Page8888_Index = mDefaultFirst_PageInfo.page_index;
                			var Page8888_Pre = mDefaultFirst_PageInfo.page_pre;
                			var Page8888_End = mDefaultFirst_PageInfo.page_end;
                			var Page8888_PaddingStr = mDefaultFirst_PageInfo.page_nextpaddingstr;
                	        console.log("---- rawUrl.indexOf(Page8888_Pre) = "+ rawUrl.indexOf(Page8888_Pre));
                	        console.log("---- rawUrl.indexOf(Page8888_End) = "+ rawUrl.indexOf(Page8888_End));
                			if(rawUrl.indexOf(Page8888_Pre) >= 0 && rawUrl.indexOf(Page8888_End) >= 0){
                				console.log(" Page8888_Pre="+(Page8888_Pre)+"  Page8888_End="+Page8888_End);
                				console.log(" Page8888_Pre_Length="+(Page8888_Pre.length)+"  Page8888_End_Length="+(rawUrl.length-Page8888_End.length));
                				console.log("【indexOf_Page8888_Pre_Index:"+rawUrl.indexOf(Page8888_Pre) +"】    【indexOf_Page8888_End_Index:"+rawUrl.lastIndexOf(Page8888_End) +"】"); 
                                var Page8888_Index_Str = rawUrl.substring(rawUrl.indexOf(Page8888_Pre)+Page8888_Pre.length,rawUrl.lastIndexOf(Page8888_End));
                				console.log("【Page8888_Index_Str:"+Page8888_Index_Str +"】    【rawUrl:"+rawUrl+"】");
                				if(!isNaN(Number(Page8888_Index_Str))){
                					var Page8888_Index_Int = parseInt(Page8888_Index_Str, 10);
                					// var Page8888_NextPage_Int = Page8888_Index_Int + Page8888_One_Step;
    								var Page8888_NextPage_Int = 2;
                				    console.log("【Page8888_Index_Int:"+Page8888_Index_Int +"】  【Page8888_Index_Str:"+Page8888_Index_Str+"】");
                					console.log("【Page8888(Pre)_rawUrl.substring(0,rawUrl.indexOf(Page8888_Pre)+Page8888_Pre.length):"+rawUrl.substring(0,rawUrl.indexOf(Page8888_Pre)+Page8888_Pre.length) +"】 ");
                				    console.log("【Page8888_NextPage_Int:"+Page8888_NextPage_Int +"】 ");
                					console.log("【Page8888(End):"+Page8888_End +"】 ");
    								console.log("【Page8888(PaddingStr):"+Page8888_PaddingStr +"】 ");
                					var Page8888_NextPage_URL = rawUrl.substring(0,rawUrl.indexOf(Page8888_Pre)+Page8888_Pre.length)+Page8888_End + Page8888_PaddingStr;
                					console.log("【Page8888_NextPage_URL:"+Page8888_NextPage_URL +"】 ");
                                    return Page8888_NextPage_URL;
                                } else {
                					console.log("【Page8888_Index_Str:"+Page8888_Index_Str +" parse Failed please check !】  ");
                				}
                            }
                	 console.log("══════════════ Endxx DefaultFirst_PageInfo_List["+i+"_"+DefaultFirst_PageInfo_List.length+"]____page_index=["+mDefaultFirst_PageInfo.page_index+"]  page_pre=["+mDefaultFirst_PageInfo.page_pre+"]  page_end=["+mDefaultFirst_PageInfo.page_end+"]   page_nextpaddingstr=["+mDefaultFirst_PageInfo.page_nextpaddingstr+"]" +"Begin ═══════════════"  );
                
                }
    			
    	
        }
    
    
    })();
    
    
    
    
    
    
    
    
    复制