secured browsinghttps


Archive for January, 2010

Date: January 15th, 2010
Cate: Blog
4 msgs

SEE YOU NEXT SEMESTER

It’s the end of another semester, what have I learned so far? After the exams, I have to say, I can’t remember exactly, but like the saying goes, “forget what you have learned in the class, the left is what we call a university.”

Will go home tomorrow, maybe. Since I have no computer at home, this blog will not be updated during the winter holiday. And it’s a good thing for me to not touch computer for some time, not that I’m addicted, but I think there are many more meaningful things I can do(without electrical devices). Four books I recently bought for reading during the holidays and my own novel which I stared writing last summer but not completed, I will  continue to write the rest part, or maybe, rewrite the entire novel, but please don’t expect too much, I don’t think it will be finished within the following 30 days.

So see you next semester, my friends, and this fucking university.

See you, Google, beyond this great wall.

Date: January 6th, 2010
Cate: Blog, Technic
8 msgs

在opera:drives中直接调用系统文件和文件夹

通过opera:drives可以在Opera中浏览本地电脑中的文件,在OperaChina的论坛上看见有人想要把opera:drives放到侧边栏中,并且直接从Opera里打开选择的文件。

觉得这个想法不错,于是写了个菜单按钮,功能如上,在opera:drives里直接打开文件和文件夹。安装方法如下:

用文本编辑器打开opera:config#UserPrefs|MenuConfiguration里指定的菜单配置文件,搜索到[Link Popup Menu],插入下面的一段:

Item,打开文件=external action | delay,1 & copy link & focus address field & paste & go to line start & next word & next word & range go to line start & delete & select all & copy & new page & go to page,"javascript:prompt('', decodeURI(%C))" & delay,10 & copy & cancel & delay,1 & close page & execute program,"cmd.exe","/k %C" & delay,10 & execute program,"cmd.exe","/c taskkill /im cmd.exe"

Item,浏览文件夹=external action | delay,1 & copy link & focus address field & paste & go to line start & next word & next word & range go to line start & delete & select all & copy & new page & go to page,"javascript:var str=%C;prompt('', decodeURI(str.replace(/[/]/g,'\\')))" & delay,10 & copy & cancel & delay,1 & close page & execute program,"explorer.exe","/e,%C"

可恶的execute program的第一个参数居然不能使用%c,所以还得绕道调用cmd,而explorer.exe的路径参数居然只能使用反斜杠,又得先把斜杠全替换成反斜杠。发现此处还可以直接调用系统的右键菜单,能够实现的功能更多,但当文件路径或名字有空格等特殊字符时,系统右键菜单就不能调用,还有些我也不清楚是怎么回事的情况下也同样无法调用。

Platform Windows, Submenu, 系统菜单, Internal Shell

另外,直接把opera:drives放到侧边栏中的话,里面文件的排列显示有点宽,可以修改opera:config#UserPrefs|DirStyleFile处指定的css文件来来让它更适合在侧边栏中显示,你还可以在侧边栏的工具栏上选择小屏幕视图使之自动适应宽度。这是我修改后的css文件,还做一点小修改,文件夹用黑色显示,其他文件使用蓝色,以便区分:

@import url(opera.css);
body,h1
{
background-image:none;
margin:0;
padding:0;
}
h1
{
font-size:120%;
font-weight:bold;
}
th,td
{
display:inline;
white-space:pre;
}
.dir
{
color:black;
}

图标请自行添加

Date: January 5th, 2010
Cate: Blog, Technic

Opera命令:Convert hex to unicode

可能这是一个大家从来都没注意到一个命令,convert hex to unicode,人如其名,功能就是把十六进制的数转换成unicode的字符。

用法:将光标定位到需要转换的十六进制数之后,执行convert hex to unicode命令就会将其转换成对应的unicode字符,但遗憾的是一次只能转换一个字符,而且Opera会将连续的5位十六进制数识别为一个字符,所以如果十六进制数之前还有0到9或者a到f的话,需要在中间添加一个其他的分割字符,转换完后可以退格删除。例如insert,”41″ & convert hex to unicode 就可以插入一个大写的“A”。

听起来似乎这个”convert hex to unicode”并没有什么用,但我们可以用它来做一件以前办不到的事,就是在文本中插入双引号”、换行符和制表符。先用insert命令插入对应的十六进制数,然后执行convert hex to unicode。双引号是22,换行符是0A,制表符是09,例如:

insert,"<a href=22" & convert hex to unicode & insert,"http://jude.me/404//22" & convert hex to unicode & insert,">Jude's blog</a>" & insert,"0A" & convert hex to unicode & insert,"换行" & insert,"09" & convert hex to unicode & insert,"制表符"

会插入下面一段

<a href="http://jude.me/404//">Jude’s blog</a> 换行 制表符

做了一段视频,用Opera写诗:

使用的命令:

insert,"#" & next character & next character & convert hex to unicode & previous character & backspace & next character

另外在中间加了点延时。

Date: January 2nd, 2010
Cate: Blog, Technic
3 msgs

“Opera Editor”

在My Opera论坛看到的方法,把Opera当作一个简单的文本编辑器,直接在Opera中编辑配置文件等,好处就是可以使用Opera的内部命令直接对文本进行操作。思路很简单,就是用Opera打开配置文件,查看源代码,编辑,然后保存。Opera有很多文本操作相关的命令,具体请看Opera内部命令清单。点击Apply Changes,Opera就会把编辑后的文件保存,如果你想要使用命令自动保存的话,请使用“reload”命令。然后使用使用下面的命令重载配置(http://bbs.operachina.com/viewtopic.php?f=54&t=48106#p176545

Show preferences, 23 & Next item & Ok

我写的一个例子,自动把地址栏中的命令添加到document popup menu中(不包含重载配置的命令):Add to menu:

external action | focus address field & copy & new page & go to page,"opera:config#UserPrefs|MenuConfiguration" & delay, 1000 & focus previous widget & go to line start & next character & backspace & go to line end & backspace & insert,"?macro=" & paste & select all & copy & delay,1 & close page & go to page, "%c" & delay,10 & view document source & find inline,"document popup menu" & next line & paste & insert,"0A" & Convert hex to unicode & go to start & find inline,"?macro=" & delay,1 & next character & range go to line start & delete & insert,"Item,macro="

不过这样的按钮可能并没有多少实际用途,看到这个博客上的想法不错,给Opera中每个菜单和工具栏区域都添加一个标记,在浏览器中任何菜单或者工具栏中点击这个标记就可以打开配置文件并且定位到对应的区域,然后就开始编辑。一个巨大的好处就是,你再也不会找不到到底该修改哪个菜单或者工具栏了,Opera有大概50个工具栏和200个菜单!

添加标记的方法如下,以菜单配置文件为例,在每个菜单的最后都添加一行:

item, Check this section in menu = New page & go to page, "menu.ini的路径" & find & insert, "菜单名称" & delay,1 & click default button

不过麻烦之处就在于添加上面的命令,如果每个菜单都要手动添加的话需要大量的时间,所以我就用Opera自带的命令写了一个按钮,自动完成上面的添加动作。

find inline,"Menu]" & delay,1 & next character & range go to line start & copy & next line & find inline,"[" & delay,1 & next character & delay,1 & previous line & insert,"0A" & convert hex to unicode & previous line & insert,"item,Check this section in menu.ini=new page & go to page," & insert,"22" & convert hex to unicode & insert,"menu.ini的路径" & insert,"22" & convert hex to unicode & insert,"& delay,10 & view document source & delay,10 & find inline, " & insert,"22" & convert hex to unicode & paste & insert,"22" & convert hex to unicode & insert,"0A" & convert hex to unicode

用Opera打开menu.ini,并进入查看源代码页面,使用上面的代码会自动寻找一个菜单,在最后插入添加标记的命令,遗憾的是Opera没有循环命令,所以想要上面的代码运行多少次,就要复制多少次相同的命令。我们可以复制20次,做成按钮,每点击一下就完成20个菜单的处理,再点击9次就把全部接近200个菜单全部处理完了。看着Opera自动编辑的过程还颇有点cmd中dir的味道,于是还专门录像上传,优酷.

抱歉不能说得再详细了,估计很多人还云里雾里,不过我该睡觉了。