cuitaoaa
小狐狸
小狐狸
  • UID33381
  • 注册日期2010-07-10
  • 最后登录2010-07-10
  • 发帖数1
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
阅读:2131回复:1

求帮忙编写一个GM脚本,批量获取图片地址为论坛img代码

楼主#
更多 发布于:2010-07-10 21:50
由于经常在论坛发帖,需要使用图床,而一个稳定的图床比较难找,找到后基本不能批量获得代码,有一次看到别人介绍一个图床,然后介绍了GM的一个脚本可以批量获取代码,这大大减少了发帖时间,可是最忌那个图床要收费了,我又寻找了一个图床,可是那个脚本只是应那个网站,现在不能再新的图床中获取图片地址了,由于本人大一,还没有开始学习计算机语言,就在这里请会的高手帮忙。
    
    http://userscripts.org/scripts/show/77486,这是原来那个图床的脚本,请作为参考。这是源代码
// ==UserScript==
// @name           Get BBCodes from ning
// @include        http://*.ning.com/*
// @author         congxz6688
// ==/UserScript==


mytableCSS="#myNewText {  width:170px; height:100px; background-color: #F8F8F8 !important;}";
mytableCSS+="#mygray {color:BLACK; background-image:url(); padding: 1px 5px 1px 5px !important; }";
GM_addStyle(mytableCSS);


if(window.location.href.match(/photo(?!\/)|photo\/photo\/listForContributor|photo\/photo\/list/) != null){//descendant::
        var h1haha= document.evaluate('//div[@class="xg_module module_about"]', document, null, 6, null);
        if (h1haha.snapshotItem(0)){
                var allimages= document.evaluate('//div[@class="ib"]/a/img', document, null, 6, null);
                if(allimages.snapshotLength>0){
                        var myText="";
                        for(var i=allimages.snapshotLength-1; i >-1 ; i--){
                                thisCode= ""
                                myText += thisCode + "\r\n" + "\r\n";

                            var NewInput=document.createElement("input");
                                NewInput.type="text";
                                NewInput.size="16";
                                NewInput.id=i;
                                NewInput.value=thisCode;
                                NewInput.setAttribute("readonly", "readonly");
                                NewInput.addEventListener("click", selectAllText(i), false);
                            allimages.snapshotItem(i).parentNode.parentNode.parentNode.insertBefore(NewInput,allimages.snapshotItem(i).parentNode.parentNode.nextSibling);                
                        }


                var newh3=document.createElement("div");
                newh3.id="mygray";

                        var newh4=document.createElement("h3");
                        newh4.innerHTML="鏈〉鎵€鏈夊浘鐗囩殑BBCodes";
                        newh3.appendChild(newh4);

                        var newh6=document.createElement("div");
                        newh6.id="myTd2";

                            var NewTextArea=document.createElement("textarea");
                                NewTextArea.id="myNewText";
                                NewTextArea.innerHTML=myText
                                NewTextArea.setAttribute("readonly", "readonly");
                                NewTextArea.addEventListener("click", selectAllText("myNewText"), false);
                                newh6.appendChild(NewTextArea);

                        newh3.appendChild(newh6);        

                h1haha.snapshotItem(0).parentNode.insertBefore(newh3,h1haha.snapshotItem(0).nextSibling);
                }
        }
}



function selectAllText(e){
        return function(){
                document.getElementById(e).select();
        }
}



   这是使用那个脚本获取代码的效果图






    新的图床地址为www.slide.com,这是多图预览页面,


如若需要具体页面,以及具体过程我下次再编辑。


    要求:1.能够获得图片地址,并且直接就是以论坛图片代码形式出现,能在每张图片底下出现该图片的图片代码地址,并且能在页面中出现全部的图片的地址,并按照顺序排列(我上传图片都是按照编码001,002的顺序上传,能够按照这个正序排列就行了)
    2.获取的全部地址,每个img代码之间要空一行,发图片是要空一行便于观看,这个很重要。
    3.在多图预览页面,获取的图片地址链接是小图的连接,图片显示大小是160x100,需要把地址中的160/100替换为1500/1500,这个不替换就无法显示大图。


    请论坛中的高手不要吝惜自己的能力,帮助一下吧
mawith
火狐狸
火狐狸
  • UID18675
  • 注册日期2007-05-14
  • 最后登录2016-12-18
  • 发帖数263
  • 经验12枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 社区居民
1楼#
发布于:2010-07-10 21:50
无力帮顶
游客

返回顶部