码迷,mamicode.com
首页 > 其他好文 > 详细

firefox + pentadactyl 实现纯绿色高效易扩展浏览器(同时实现修改默认状态栏样式)

时间:2014-12-28 07:03:00      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:

  这几天开始使用firefox+pentadactyl来搭建一个开源、可扩展、完全绿化的浏览器环境,以便随身带着使用,其中firefox的使用了24.0的长期支持版, 这边版本稳定, 快速, 兼容性好, 重点是pentadactyl最高只支持到24.0。在网络上找了半天, 终于找到了一个真正完绿化版的firefox24.0, 下载地址如下:

  http://chenxuefeng.net.cn/

 这是一个名为Shura的个人网页, 他绿化了不少好东西, 从中找到24.0版的firefox即可。

   下载下来的压缩包随便解压到一个地方进入,解压后的firefox目录, 点击!绿化工具.exe运行绿化过程即可.实现完全绿化 , 研究了一下这个绿化的原理发现,firefox其实将所有的用户相关的配置都放在了一个默认位置为 c:\Users\Administrator\AppData\Roaming\Mozilla\Firefox\的目录下面, 如果希望实现,绿化, 只需要在这个目录下创建一个profile.ini的文件,在其中制定用户配置文件夹的新路径即可,这里的!绿化工具.exe做的事情其实就是创这个profile.ini文件并在启动将用户配置文件重新定向到了解压后firefox所在位置下的一个名为ShuraData的目录。从这个里就可以推断出, 如果我们移动了解压后的firefox目录需用重新运行!绿化工具.exe程序来重新定向配置文件的正确路径, 如果我们将firefox目录复制到一个可移动的固态盘片或u盘中,并且将其带到了一个新的电脑上时同样需用运行一次!绿化工具.exe来完成配置重定向。

  绿化完成之后, 打开firefox, 删除一些自己不想要的插件之后安装pentadactyl扩展。之后开始优化firefox, 下面的记录是我找到的一些firefox存在的问题及解决办法:

 

Windows 7系统下解决Firefox、Flash假死的方法
原因:
从Flash11.3开始,Adobe引入保护模式,即Flash沙箱功能,这项沙箱机制常常导致firefox页面假死等问题。

解决方式:
访问系统盘,修改mms.cfg,其文件所在位置如下:
Win32:
C:\windows\system32\macromed\flash
Win64:
C:\windows\syswow64\macromed\flash
编辑mms.cfg, 在文件末尾添加一行
ProtectedMode=0
保存重启firefox即可

Pentadactyl目前只支持到firefox24.0 为了防止firefox自动更新, 需要关闭firefox的自动更新功能, 关闭方法:

选项->高级->更新->关闭更新

firefox的缓存文件夹默认在D:\data\cache目录, 我修改到了如下目录:
c:\Users\Administrator\AppData\Roaming\Mozilla\Firefox\cache
设置在改目录的目的是减小对firefox所在的可移动盘符的频繁读写,同时可以提高firefox的反应速度
如果希望修改缓存文件夹的位置在如下位置修改:
about:config-> browser.cache.disk.parent_directory

Pentadactyl我设置为启动时关闭了firefox的工具栏, 原因是如果打开工具栏,firefox启动时会自动定位到地址栏并处于插入模式, 这很影响启动后的操作。

在windows系统的PATH环境中加入一个HOME变量, 在HOME变量指向的文件夹下面创建一个 .pentadactylrc 文件, 编辑该文件来对pentadactyl进行配置,我找到的一些设置修改后收集如下:

 

 

“pentadactyl设置

loadplugins ‘\.(js|penta)$‘
group user

map -m n,v j 15j
map -m n,v k 15k

map -m n,v J <C-d>
map -m n,v K <C-u>

map -m n,v y Y
map -m n,v Y y
map -m n,v p P
map -m n,v P p

map -m n,v l  gt
map -m n,v h  gT

map -m n,v < [[
map -m n,v > ]]

map -m n,v m :bmarks<cr>
map -m n,v M :bmark<cr>

map -m n,v b <PageUp>
map -m n,v s :stop<cr>
map -m n,v U :undo<Space>

map -m i <C-h> <Left>
map -m i <C-j> <Down>
map -m i <C-k> <Up>
map -m i <C-l> <Right>

map -m n <leader>r :restart<cr>
map -m n <leader>q :qall<cr>
map -m n <leader>h :history<Space><cr>
map -m n <leader>x :xall<cr>
map -m n <leader>s :reh<CR>

map -m n <leader>d :dialog<sp>addbookmark<cr>
map -m n <leader>b :dialog<sp>customizetoolbar<cr>
map -m n <leader>c :dialog<sp>cleardata<cr>
map -m n <leader>p :preferences<cr>
map -m n <leader>P :tabopen about:config<cr>
map -m n <leader>e :dialog searchengines<cr>

map -m n <c-f> :set guioptions!=T<cr>
map -m n <c-e> :set guioptions!=s<cr>
map -m i,c,t <C-v> <Pass>
map -m i,c,t <C-x> <Pass>
map -m i,c,t <C-z> <Pass>
map -m n,v,i,c,t <C-a> <Pass>
map -m n,v,i,c,t <C-c> <Pass>

map t -js str=util.domToString(buffer.focusedFrame.getSelection()); str!=""?dactyl.open(str, {where: dactyl.NEW_TAB}):CommandExMode().open("tabopen ")

map o -js str=util.domToString(buffer.focusedFrame.getSelection()); str!=""?dactyl.open(str, {where: dactyl.CURRENT_TAB}):CommandExMode().open("open ")

set guioptions+=B
set history=100
set maxitems=12
set hintkeys=jksdflaghioweqrumncvx

hi Normal color: black; background: white; font-size:10pt

hi Hint font:12px "Droid Sans Mono",monospace !important;margin:-.2ex;padding:0 0 0 1px;outline:1px solid rgba(0,0,0,.5);background:rgba(255,248,231,.8);color:black;text-transform:uppercase;

set nextpattern=‘(下|后)一?(页|頁|篇|章|张)|次のページ|次へ‘,‘^\bnext\b‘,‘\bnext\b‘,‘\bsuivant\b‘,‘^(>|›)$‘,‘^(>>|»)$‘,‘^(>|»)‘,‘(>|»)$‘,‘\bmore\b‘
set previouspattern=‘(上|前)一?(页|頁|篇|章|张)|前のページ|前へ‘,‘^\bprev|previous\b‘,‘\bprev|previous\b‘,‘\bprécédent\b‘,‘^(<|‹)$‘,‘^(<<|«)$‘,‘^(<|«)‘,‘(<|«)$‘

style -name=commandline-ime chrome://* #dactyl-commandline-command input {ime-mode: inactive;}
style chrome://* #dactyl-statusline-field-commandline-command input {ime-mode: inactive;}

" vim: set ft=pentadactyl:

 

 

pentadactyl默认实现了一个黑色的状态栏(status bar), 字体为白色粗体, 在打开网站的时候还会出现黑色的状态栏变成紫色的情况,不知道为什么,我总觉得这个颜色是在是和我firefox的semple white主题不搭调, 看的我着实难受了好几天, 后来实在无法忍受这个突兀的状态, 下定决心修改之, 百度谷歌了一段时间加上自己的聪明才智最终实现的状态栏的修改,记录如下:

黑色的状态在pentadactyl插件中定义, 这个插件的打包文件位置在 *\Firefox\ShuraData\extensions\pentadactyl@dactyl.googlecode.com.xpi 这是一个陌生的类型文件, 百度一下发现可以通过修改其后缀名为rar后使用total commander等工具来直接编辑其中的打包文件, 我修改了后缀命令后使用total commander直接打开rar文件仔细找了一会终于定位到状态栏的样式定义在 pentadactyl@dactyl.googlecode.com.rar\chrome\common\skin\global-styles.css这个文件中,其中可以发现
如下一段代码:

 

StatusLine;;;FontFixed  {
    /* The status bar */
    -moz-appearance: none !important;
    font-weight: bold;
    background: transparent !important;
    border: 0px !important;
    padding-right: 0px !important;
    min-height: 18px !important;
    text-shadow: none !important;
}
StatusLineNormal;[dactyl|highlight]    /* The status bar for an ordinary web page */ \
                                       color: white !important; background: black   !important;
StatusLineBroken;[dactyl|highlight]    /* The status bar for a broken web page */ \
                                       color: black !important; background: #FFa0a0 !important; /* light-red */
StatusLineSecure;[dactyl|highlight]    /* The status bar for a secure web page */ \
                                       color: black !important; background: #a0a0FF !important; /* light-blue */
StatusLineExtended;[dactyl|highlight]  /* The status bar for a secure web page with an Extended Validation (EV) certificate */ \
                                       color: black !important; background: #a0FFa0 !important; /* light-green */

 

其中不难看是状态栏字体颜色背景色等设置, 我将其修改为如下内容, 成功实现状态栏的白底黑字效果, 当然, 字体没有用粗体:

 

StatusLine;;;FontFixed  {
    /* The status bar */
    -moz-appearance: none !important;
    background: transparent !important;
    border: 0px !important;
    padding-right: 0px !important;
    min-height: 18px !important;
    text-shadow: none !important;
}
StatusLineNormal;[dactyl|highlight]    /* The status bar for an ordinary web page */ \
                                       color: black !important; background: white   !important;
StatusLineBroken;[dactyl|highlight]    /* The status bar for a broken web page */ \
                                       color: black !important; background: white !important; /* light-red */
StatusLineSecure;[dactyl|highlight]    /* The status bar for a secure web page */ \
                                       color: black !important; background: white !important; /* light-blue */
StatusLineExtended;[dactyl|highlight]  /* The status bar for a secure web page with an Extended Validation (EV) certificate */ \
                                       color: black !important; background: #a0FFa0 !important; /* light-green */

 

修改后将后缀名改回xpi后重启firefox即可看到效果,我的世界从此再次变得更加美好了。

firefox + pentadactyl 实现纯绿色高效易扩展浏览器(同时实现修改默认状态栏样式)

标签:

原文地址:http://www.cnblogs.com/pangchol/p/4189506.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!