chrome贴吧助手插件

manifest.json

{
   "background": {
      "page": "background.html"
   },
   "content_scripts": [ {
      "js": [ "loadJS.js" ],
      "matches": [ "http://tieba.baidu.com/*" ],
      "run_at": "document_end"
   } ],
   "description": "百度贴吧自动签到,自定义表情,阅读魔法书,翻转帖子中图片,设置朋友昵称,自定义背景图,一键换号,大召唤系统,吧务工具扫描广告贴,等等",
   "icons": {
      "128": "sample-128.png",
      "48": "sample-48.png"
   },
   "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCw2V2sSkP7JvAg2ln73cUPdVPiSguLEAs59CpZqayQsn/mE0JoNIX9TwDPNOfPvAjLcYbjfU1sdp8HmZGM7EQ7J2w/XQymxPikEqMZR7NO+trzCJ57+XSvJbYTtuZ8D9dC/3V6LR2dXkrvAduhQQ5XQ64ukfVxii8+3+kb7psM2wIDAQAB",
   "manifest_version": 2,
   "name": "百度贴吧助手",
   "permissions": [ "http://*.baidu.com/*", "https://*.baidu.com/*", "http://*.guzzservices.com/*", "http://*.mofamulu.com/*" ],
   "version": "3.0.1"
}

js

function _tieba_load_js_(url) {
    var domScript = document.createElement(‘script‘);
    domScript.src = url;
    domScript.charset = ‘gbk‘;

    var body = document.getElementsByTagName(‘body‘) ;
    if(body && body.length > 0){
        body[0].appendChild(domScript);
    }
}

function _tieba_load_css_(url) {
    var head=document.getElementsByTagName(‘head‘).item(0);
    if(head){
        css=document.createElement(‘link‘);
        css.href=url;
        css.rel=‘stylesheet‘;
        css.type=‘text/css‘;
        head.appendChild(css);
    }
}

function _tieba_insert_unique_div_() {
    var div = document.createElement(‘div‘);
    div.id = "fsjfsruwosfmsfjsffsfwddd";
    div.setAttribute("style", "display:none;") ;
    div.setAttribute("pluginversion", "chrome30") ;
    var body = document.getElementsByTagName(‘body‘) ;
    if(body && body.length > 0){
        body[0].appendChild(div);
    }
}

var port = chrome.extension.connect();

if(!document.getElementById("fsjfsruwosfmsfjsffsfwddd")){
    _tieba_insert_unique_div_() ;
    _tieba_load_css_("http://tieba.guzzservices.com/s/render.css") ;
    _tieba_load_js_("http://tieba.guzzservices.com/s/render.js") ;

    window.addEventListener("message", function(event) {
        // We only accept messages from ourselves
        if (event.source != window)
          return;

        if (event.data.type && (event.data.type == "tbhp_xhr_req")) {
          //window.postMessage({type: "tbhp_xhr_req", method: method, url : url, data : data, uniqueId : uniqueId}, "*");
            port.postMessage({
                  method: event.data.method,
                  action: "xhttp",
                  url: event.data.url,
                  data:event.data.data,
                  uniqueId:event.data.uniqueId
              });

            /*
          chrome.extension.sendMessage({
              method: event.data.method,
              action: "xhttp",
              url: event.data.url,
              data:event.data.data,
              uniqueId:event.data.uniqueId
          }, function(result) {
              console.log("loadJS:" + result.xhr.responseText) ;
              window.postMessage({"type":"tbhp_xhr_back", "uniqueId" : result.uniqueId, "status":result.status, "html":result.xhr.responseText}, "*");
          }) ;
          */
        }

    }, false);

    port.onMessage.addListener(function(result) {
        window.postMessage({"type":"tbhp_xhr_back", "uniqueId" : result.uniqueId, "status":result.status, "html":result.html}, "*");
    });

}

background.js

/**
 * Possible parameters for request:
 *  action: "xhttp" for a cross-origin HTTP request
 *  method: Default "GET"
 *  url   : required, but not validated
 *  data  : data to send in a POST request
 *
 * The callback function is called upon completion of the request */
chrome.extension.onMessage.addListener(function(request, sender, callback) {
    if(request.action == "xhttp") {
        var method = request.method ? request.method.toUpperCase() : ‘GET‘;
        $.ajax({
                type: method,
                   url: request.url,
                   dataType:"html",
                   data: request.data,
                   uniqueId : request.uniqueId,
                   complete: function(xhr, ts){
                       callback({"status": ts, "xhr" : xhr, "uniqueId" : this.uniqueId}) ;
                   }
        });

        return true ;
    }
});

chrome.extension.onConnect.addListener(function(port) {
      port.onMessage.addListener(function(request) {
          if(request.action == "xhttp") {
                var method = request.method ? request.method.toUpperCase() : ‘GET‘;
                $.ajax({
                        type: method,
                           url: request.url,
                           dataType:"html",
                           data: request.data,
                           uniqueId : request.uniqueId,
                           complete: function(xhr, ts){
                               var text = xhr.responseText ;
                               port.postMessage({action: "xhttp","status": ts, "html" : text, "uniqueId" : this.uniqueId});
                           }
                });
            }
      });
    });

background.html

<html><head>
<meta charset="utf-8" />
<script src="jquery.min.js"></script>
<script src="background.js"></script>
</head>

</body></html>

代码

var tbhp_www_base_url="",tbhp_www_render_loaded=!1;
(function(){function e(a){a>=f.length||(tbhp_www_base_url=f[a],g._load_js(tbhp_www_base_url+"/s/real_render.js",function(a,d){a==tbhp_www_base_url+"/s/real_render.js"&&d&&!tbhp_www_render_loaded&&(tbhp_www_render_loaded=!0)}),setTimeout(function(){tbhp_www_render_loaded||e(a+1)},2E3))}var g={_load_js:function(a,c){var d=document.getElementsByTagName("head")[0],b=document.createElement("script");b.src=a;b.type="text/javascript";d.appendChild(b);c&&(b.onload=b.onreadystatechange=function(){!this.readyState||
"complete"==this.readyState||"loaded"==this.readyState?c(a,!0):c(a,!1)})}},f=["http://book.mofamulu.com","http://tieba.guzzservices.com"];e(0)})();
var tbhp_www_base_url = "",
tbhp_www_render_loaded = !1; (function() {
        function e(a) {
                a >= f.length || (tbhp_www_base_url = f[a], g._load_js(tbhp_www_base_url + "/s/real_render.js",
                function(a, d) {
                        a == tbhp_www_base_url + "/s/real_render.js" && d && !tbhp_www_render_loaded && (tbhp_www_render_loaded = !0)
                }), setTimeout(function() {
                        tbhp_www_render_loaded || e(a + 1)
                },
                2E3))
        }
        var g = {
                _load_js: function(a, c) {
                        var d = document.getElementsByTagName("head")[0],
                        b = document.createElement("script");
                        b.src = a;
                        b.type = "text/javascript";
                        d.appendChild(b);
                        c && (b.onload = b.onreadystatechange = function() { ! this.readyState || "complete" == this.readyState || "loaded" == this.readyState ? c(a, !0) : c(a, !1)
                        })
                }
        },
        f = ["http://book.mofamulu.com", "http://tieba.guzzservices.com"];
        e(0)
})();
时间: 2024-08-01 22:45:09

chrome贴吧助手插件的相关文章

chrome的ssh客户端插件-- secure shell

试用了一下,非常强大. 与firessh比较下(虽然现在的版本已经支持chrome安装) 还是比较喜欢它, firessh是独立窗口不太喜欢.还有配置现在太少.虽然这个可以自己改动一下实现. 有兴趣的可以放弃其它客户端了.上传文件这块,当然不行了. chrome的ssh客户端插件-- secure shell,布布扣,bubuko.com

Linux下启用Chrome/Firefox的Java插件

JDK 已经安装好,但是浏览器运行 Java Applet 时提示需安装 Java 插件. 这时,在浏览器安装目录中 plugins 文件夹下创建2个重要的符号链接即可. libnpjp2.so   (this file exist in /usr/lib/jvm/jdk1.6.0_35/jre/lib/i386/libnpjp2.so) libjavaplugin_oji.so (this file exist in /usr/lib/jvm/jdk1.6.0_35/jre/plugin/i3

chrome浏览器超方便插件

传统的鼠标加键盘的操作方式对于时常需要在鼠标和键盘之间进行切换的人来说非常麻烦,尤其是在看文献遇到很多的英文单词需要不停地查询时,如果在文献和电脑查词之间频繁的切换时很难集中精力去理解看到的内容和上下文.因此要尽量减少在查词时带来的注意力切换,仅仅耗费必须的精力在查询和获取中文释义上,这要求我们在查询时,仅需要从键盘上键入英文单词回车,得到中文释义即可.但是在使用浏览器查询时每次查询完之后再次进行查询就需要使用鼠标对搜索框进行光标定位,浏览器提供的快捷键只支持快速定位到地址栏而没有搜索引擎栏,因

chrome最强大的浏览器插件推荐,只要你会用其他的插件你可以删除了

我们在学习和工作中经常会需要用到各种各样不同需求的插件,结果chrome插件越装越多,chrome浏览器也越来越慢!有时候链我们自己都懵圈了,一时间都想不起来这个插件是干什么用的.更可气的是,很多时候插件好不容易装好后,用了一段时间后功能就问题就没有办法解决了.比如现在上网,网盘要会员才能全速下载,视频网站上最新最热的电影电视综艺资源必须要会员才能看剧,登录时总要输验证码,想要找个文档,网站还限制非会员不能复制文字.这一系列的问题,就是网站想要把用户圈起来.我们普通老百姓不在每个网站搞十个八个会

Chrome好用的插件:WhatRuns 查看网站使用的技术

Chrome好用的插件:WhatRuns 查看网站使用的技术 这是一款免费的Chrome扩展程序,使用很简单. chrome安装这个插件之后,打开要检测的网站,然后点击WhatRuns 的图标,就开始检测该网站所用的东西. 使用效果像这样: 检测的内容 网页服务器 内容管理系统 网页字体 JavaScript 框架 Wordpress插件等 参考资料 WhatRuns:查看网站使用的技术和第三方服务 原文地址:https://www.cnblogs.com/helingjuan/p/106732

Chrome 浏览器安装Vue插件方法 (十分详细)

博主最近在研究Vue,无奈新手想安装Chrome的Vue插件,整理下安装流程: 1.首先去github下载vue.zip文件插件(还有npm安装方法这里就不介绍了自行百度) 2.下载后解压 3.然后通过npm下载相关依赖,可能有些同学没有安装npm,博主也是,这里介绍下安装npm的方法. 从node.js中文网站下载node.js,里面包含npm 4.下载完成直接安装,因为博主已安装成功就不截图,验证npm是否安装成功命令,打开CMD输入 node -v npm -v 如果出现对应版本号,说明安

一场由股票提醒助手插件引发的血案——浅入浅出 jquery autocomplete

我没有学过前端,所以这篇文章注定要班门弄斧了. 通常,需要用到什么技术什么语言时,我才去学,学了也不一定掌握,就是记不住!所以现在明白了,学习的时候,亦或是攻克难点的时候,一定要记录下来,并不一定非要呈现什么高大上的技术,但求复原自己的心路历程足以. 大家都知道,最近股市很火爆,当然这几天正在调整期呵呵,神车复牌都交出一天涨停一天跌停的答卷自降为灵车,相比于528垂直过山车,见怪不怪了.很多人虽然没投入大量精力炒股,但还是时刻关注着股市行情,上班族们总不能时刻盯着手机看吧,所以我就想到了股票插件

谷歌Chrome浏览器无法安装插件的解决方法(本文干货!)

这个问题困扰了我很久,作为小白学习可能会用到谷歌插件,奈何谷歌也太变态,国内的环境无法正常登录谷歌账户.无法访问应用商店,而Chrome主版本号大于66的只能从Chrome应用商店下载并安装插件,各种插件都用不了,那我要你还有何用??? 今天终于找到了一个良心帖发现了答案 第一步要解决访问Chrome账号登录.应用商店访问的问题.有需要就有市场,谷歌访问助手(官网http://www.ggfwzs.com/)专门解决此类问题的插件. 第二步,在不能访问谷歌商站的情况下安装上这个插件,直接拖放到扩

chrome、firefox常用插件

firefox插件:    fxchrome        //chrome外观    firebug    lastPass    flagfox    hackbar    User Agent Overrider firefox样式:    Colorful tabs for windows 10    //windows 10透明标题    下载地址:https://userstyles.org/styles/117878/colorful-tabs-for-windows-10 chr