Chrome 简单插件开发

View Code
xml version="1.0" encoding="utf-8"?>
<extension>
    <id>com.sogou.PageTurnid>
    <name>翻页跳转name>
    <show_icon>trueshow_icon>
    <description>返回顶部,点击翻页,返回顶部,快捷操作description>
    <version>0.0.0.1version>
    <request_api_version>1request_api_version>
    <show_menu_dropdown>trueshow_menu_dropdown>
    <author>lvxiaojiaauthor>
    <background page="background.html" />    
    <content_scripts>
        <content_script>
            <match>*://*/*match>
            <js>jquery-1.4.1.min.jsjs> 
            <js>top.jsjs> 
        content_script>
    content_scripts>
extension>

 

View Code
.sougougo{width:47px;height:108px;background:#FFF;position:fixed;filter:alpha(opacity=60);   
      -moz-opacity:0.6;z-index:900000; -khtml-opacity: 0.6; opacity: 0.6;_position:absolute;right:12px;_right:-47px;bottom:2%;border-radius:2px;box-shadow:0 0 2px #6E6E6E;display:none;}
.sougougo a{background:url('images/a.png') no-repeat;display:block;width:37px;margin:5px;border:0;overflow:hidden;float:left}
.sougougo .sougoutop{background-position:0 -33px;height:22px}
.sougougo .sougoucenter{background-position:0 -54px;height:32px}
.sougougo .sougoubottom{background-position:0 -88px;height:22px}
.sougougo .sougoutop:hover{background-position:-38px -33px}
.sougougo .sougoucenter:hover{background-position:-38px -54px}
.sougougo .sougoubottom:hover{background-position:-38px -88px}

 

View Code js
changeUi();
function changeUi(){
 var imgpatch = sogouExplorer.extension.getURL('images/a.png');
    var style = document.createElement("link");
    style.href = sogouExplorer.extension.getURL('style.css');
    style.rel = "stylesheet";
    style.type = "text/css";    
    document.getElementsByTagName("head").item(0).appendChild(style);    
    var scriptelement=document.createElement("script");
    scriptelement.type="text/javascript";
    if(typeof(jQuery)=="undefined"){
        alert('jquery bucunzai');
        var jquerypatch = sogouExplorer.extension.getURL('jquery-1.4.1.min.js');
            scriptelement.src=jquerypatch;
        document.getElementsByTagName("head").item(0).appendChild(scriptelement);    
    }    
    
    var ht=document.createElement("div");
    ht.innerHTML="
"; document.getElementsByTagName("body").item(0).appendChild(ht); $(".sougoutop").click(function(){ $("html, body").animate({scrollTop: 0},220); }); $(".sougoubottom").bind("click",function(){ $("html, body").animate({scrollTop: $(document).height()},220); }); $(".sougoucenter").click(function(){ var d = $(document).scrollTop()+$(window).height(); $("html, body").animate({scrollTop: d},220); }); $(window).bind("scroll",function(){ var d = $(document).scrollTop(), e = $(window).height(); d>1?$(".sougougo").show("slow") : $(".sougougo").hide("slow"); }); }

 

      下载

转载于:https://www.cnblogs.com/lvxiaojia/archive/2013/02/22/2889624.html

你可能感兴趣的:(Chrome 简单插件开发)