📄 cache
字号:
#!/bin/sh# This file is part of the KDE project# Copyright (C) 2002 Paul Chitescu <paulc-devel@null.ro># License: Open Source, Use On Your Own Risk## Konqueror/Embedded "cache:" protocol handler## Requires: sh, basename, grep, awk, tail## Usage: in your konq-embedrc file,## [Local Protocols]# cache=!/path/to/this/file# edit the cache location and max. displayed length on the lines belowcache="/tmp/konqe-cache"maxlen=50# you shouldn't need to change anything belowif [ -n ""`echo "$SCRIPT_NAME" | grep '/\.\.'` ]; then echo "Error: Malformed URL" exitficache="${cache}$SCRIPT_NAME"if [ ! -e "$cache" ]; then echo "Error: No such cache entryperhaps it expired" exitfiif [ -d "$cache" ]; then echo 'Info-Message: Listing cache entries' echo 'Content-Type: text/html' echo '' echo '<html><body>' if [ "$SCRIPT_NAME" != "/" ]; then echo '(dir) <a href="..">..</a><br/>' fi for i in "$cache"*; do if [ -e "$i" ]; then if [ -d "$i" ]; then short=`basename $i` echo "(dir) <a href=\"$short/\">$short</a><br/>" else awk -v maxlen=$maxlen 'BEGIN { h=int((maxlen-3)/2); }NR==2 { fname=gensub("^.*/","",1,FILENAME); if (match(fname,"\.new$")) exit; disp=gensub("^[[:alpha:]]*://","",1,$0); l=length(disp); if (l > 2*h+3) disp=substr(disp,0,h) "..." substr(disp,l-h); printf("(<a href=\"%s\">cache</a>) <a href=\"%s\">%s</a><br/>\n",fname,$0,disp); exit;}' "$i" fi fi done echo '</body></html>'else echo -n "Content-Type: " exec tail -n +7 <"$cache"fi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -