maddawgjav.net排版脚本

maddawgjav.net网站重新排版,浏览图片内容更方便,你懂的

目前为 2016-01-03 提交的版本。查看 最新版本

// ==UserScript==
// @name         maddawgjav.net排版脚本
// @namespace    http://gf.qytechs.cn/zh-CN/users/25794
// @version      1.1.0
// @description  maddawgjav.net网站重新排版,浏览图片内容更方便,你懂的
// @author       Hobby
// @require      http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.4.min.js
// @include      http://www.imagebam.com/image/*?url=maddawgjav.net
// @match        http://maddawgjav.net/*
// @grant        GM_xmlhttpRequest

// 交流QQ群:273406036 
// 内地用户推荐Chrome + XX-Net(代理) + Proxy SwitchyOmega(扩展)的环境下配合使用。
// 1.1.0 性能优化,加载速度大幅提升。
// 1.0.0 针对maddawgjav.net网站的支持,支持方便浏览图片

// ==/UserScript==
/* jshint -W097 */
'use strict';

// 获取全域名
function getHostName(url) {
    var e = new RegExp('^(?:(?:https?|ftp):)/*(?:[^@]+@)?([^:/#]+)'), matches = e.exec(url);
    return matches ? matches[1] : url;
}
// 获取后缀域名
function getLastName(webName) {
    var array = webName.split(".");
    if(array.length === 3){
        var a = webName.indexOf('.');
        var lastName = webName.substring(a + 1, webName.length);
        return lastName;
    }
    else if(array.length === 2){
        return webName;
    }
}

function urlfilename(a) {
    var n1 = a.lastIndexOf('/') + 1;
    var n2 = a.lastIndexOf('.');
    a = a.substring(n1, n2);
    return a;
}

function urljpgid(a) {
    var n1 = a.lastIndexOf('/');
    var n2 = a.lastIndexOf('/')-9;
    a = a.substring(n1, n2);
    return a;
}

//debugger;
var location = unsafeWindow.document.location;

//子级iframe判断是否约定的Url
if(typeof(location)!== "undefined" && location.href.indexOf('?url=maddawgjav.net') > -1){

    var jpg_id = urljpgid(location.pathname);
    var $jpg_id = $("#i"+jpg_id);
    var img_src = $jpg_id.attr("src");
    var img_pEle = $jpg_id[0].parentElement;
    //$jpg_id.remove();
    //debugger;
    $jpg_id.attr("src","http://maddawgjav.net/wp-content/themes/zbench.1.2.3/zbench/images/search-input-bg.gif");

    var $iframe = $(document.createElement("IFRAME"));  
    $iframe.attr("width", "0");  
    $iframe.attr("height", "0");
    //将问号后的.转换成%%  然后载入iframe的地址
    $iframe.attr("src", "http://maddawgjav.net/wp-login.php?"+img_src.replace(/\./g,"%%"));

    $(img_pEle).append($iframe);
}
//子级iframe的子级iframe判断是否约定的Url
else if(typeof(location)!== "undefined" && location.href.indexOf('maddawgjav.net/wp-login.php') > -1){
    var jpg_id = urljpgid(location.search);
    var av_cd =$('#href'+jpg_id, window.parent.parent.document).get(0).parentElement.avcd;
    var av_name = $('#href'+jpg_id, window.parent.parent.document).get(0).parentElement.av_name;
    var href = location.search.substring(1,location.search.length).replace(/\%\%/g,".");
    $('#img'+jpg_id, window.parent.parent.document).attr("src",href );//"http://imagetwist.com/error.jpg?" +  + '??$@' + av_cd + "?$@" + av_name

    var $hobbyimgN = $($('#href'+jpg_id, window.parent.parent.document).get(0).firstElementChild);
    //debugger;
    //$hobbyimgN.src = href;
    $iframe = $('#iframe'+jpg_id, window.parent.parent.document);
    $iframe.attr("src", "");//释放资源
    //$iframe.attr("src", "http://maddawgjav.net/wp-content/themes/zbench.1.2.3/zbench/images/search-input-bg.gif?" + href);        
}
else{
    //debugger;
    $("#sidebar-border").insertBefore("#content");
    $("#wrapper").css('margin','0');
    $("#wrapper").css('width','100%');
    $("#wrapper").css('width','initial');
    $("#sidebar-border").css('position','absolute');
    $("#content").css('margin-left','300px');
    $("#content").css('width','initial');

    //帖子第一张主题图片
    var img_t_array = $("img[class='alignnone']");
    //帖子的第一张缩略图删除
    for (var index = 0; index < img_t_array.length; index++) {
        var img_t = img_t_array[index];
        //debugger;
        //主题图片靠左排版
        $(img_t).css('float','left');
        //帖子的第一张缩略图删除
        $(img_t.nextElementSibling.nextElementSibling).remove();
    }

    //所有div帖子
    var div_tz_array = $("div[id^='post-']");
    for (var index = 0; index < div_tz_array.length; index++) {
        var div = div_tz_array[index];
        $(div).css('width','initial');
    }


    //所有p标签的文字
    var p_tz_array = $("p[style='text-align: center;']");
    for (var index = 0; index < p_tz_array.length; index++) {
        var p = p_tz_array[index];
        $(p).css('text-align','left');
    }


    var img_array = $("p[style='text-align: left;'] img");
    for (var index = 0; index < img_array.length; index++) {
        //TODO:foreach:2
        var img = img_array[index];
        var web_name = getHostName(img.src);
        var lastName = getLastName(web_name);
        //debugger;
        //$(img).css("width","100px");
        $(img).css("max-width","none");
        //图片靠左排版
        $(img).css('float','left');
        //备份width
        img.name = "100";



        if (lastName === 'imagebam.com') {
            //TODO:javbest:imagebam.com
            var jpg_name = urlfilename(img.src);
            var jpg_id = jpg_name.substring(jpg_name.length-9,jpg_name.length);
            var url = 'http://www.imagebam.com/image/' + jpg_name ;// + "??$@" + av_cd + "?$@" + av_name
            img.parentElement.href = url;
            img.parentElement.id = "href"+ jpg_id;
            img.id = "img"+ jpg_id;

            //debugger;               
            GM_xmlhttpRequest({
                method: "GET",
                url: "http://www.imagebam.com/image/" + jpg_name,
                headers: {
                    "User-Agent": "Mozilla/5.0", // If not specified, navigator.userAgent will be used.
                    "Accept": "text/xml" // If not specified, browser defaults will be used.
                },
                onload: function(response) {
                    //debugger;
                    var bodyStr = response.responseText;
                    var new_img = bodyStr.substring(bodyStr.indexOf('<meta name="twitter:image" content="') + 36,bodyStr.indexOf('<meta name="twitter:url" content="')-9);
                    var n1 = new_img.lastIndexOf('/');
                    var n2 = new_img.lastIndexOf('/')-9;
                    var img = document.getElementById('img'+ new_img.substring(n1, n2));
                    img.src = new_img;
                }
            });

            $(img.parentElement).removeAttr("href");
            $(img.parentElement).click( function () {

                if(this.firstChild.style.width !== ''){
                    $(this.firstChild).css("max-width","none"); 
                    $(this.firstChild).css('width','');
                }
                else{
                    //$(this.firstChild).css("max-width","");
                    $(this.firstChild).css('width', this.firstChild.name);
                }
            });
            //debugger;

            /**var $iframe = $(document.createElement("IFRAME"));  
            $iframe.attr("id","iframe"+jpg_id);
            $iframe.attr("frameborder", 1);  
            //$iframe.attr("scrolling", undefined === scrolling ? "no" : scrolling);  
            $iframe.attr("width", "220");  
            $iframe.attr("height", "420");
            $iframe.attr("src", 'http://www.imagebam.com/image/' + jpg_name + "/?url=maddawgjav.net");

            //debugger;
            $(img.parentElement).append($iframe);

            var $br = $(document.createElement('br'));
            $(img.parentElement).append($br);
            $(img).css("vertical-align","top");**/
        }
        else if(lastName === 'pixhost.org'){
            GM_xmlhttpRequest({
                method: "GET",
                url: img.parentElement.href,
                headers: {
                    "User-Agent": "Mozilla/5.0", // If not specified, navigator.userAgent will be used.
                    "Accept": "text/xml" // If not specified, browser defaults will be used.
                },
                onload: function(response) {
                }
            });
            img.src = img.src.replace('thumbs','images').replace('t7','img7');
        }
    }        
}
//添加 CSS 样式
/**function addGlobalStyle(css) {
        var head, style;
        head = document.getElementsByTagName('head')[0];
        if (!head) { return; }
        style = document.createElement('style');
        style.type = 'text/css';
        style.innerHTML = css;
        head.appendChild(style);
    }

    addGlobalStyle('p { font-size: large ! important; }');**/

//图片的完全加载完才执行的图片宽度设置
/**document.addEventListener("DOMContentLoaded",function(){
        var img_array = $("img[alt='imagebam.com']");
        for (var index = 0; index < img_array.length; index++) {
            var img = img_array[index];
            //debugger;
            $(img).css("width",img.width);
            //备份width
            img.name = img.width;
        }
    });
}**/

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址