Jan 13

1. 改 "app\vendor\symfony\finder\Iterator\SortableIterator.php":

        } elseif (self::SORT_BY_NAME_NATURAL === $sort) {
            $this->sort = static function (SplFileInfo $a, SplFileInfo $b) use ($order) {
                return $order * strnatcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());

忽略大小写的自然排序:

        } elseif (self::SORT_BY_NAME_NATURAL === $sort) {
            $this->sort = static function (SplFileInfo $a, SplFileInfo $b) use ($order) {
                return $order * strnatcasecmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());

2. 改 "app\views\components\file.twig"

<div class="ml-2">
<button
title="{{ translate('file.info') }}"
class="flex justify-center items-center rounded-full p-2 -m-1 md:invisible hover:bg-gray-400 hover:shadow group-hover:visible"
v-on:click.prevent="showFileInfo('{{ url(file.getPathname) | escape('js') }}')"
>
<i class="fas fa-info-circle"></i>
</button>
</div>

不显示 Hash 按钮:

<div class="ml-2">
<button
title="{{ translate('file.info') }}"
class="flex justify-center items-center rounded-full p-2 -m-1 md:invisible hover:bg-gray-400 hover:invisible group-hover:invisible"
v-on:click.prevent="showFileInfo('{{ url(file.getPathname) | escape('js') }}')"
>
<i class="fas fa-info-circle"></i>
</button>
</div>

:roll:


Nov 09

Google 是个非常强大的搜索工具,你可以用它来寻找信息,也可以用它来寻找可下载 MP3 音乐文件,书籍,视频文件,以及其他应用程序等等。

但是你有时间去记住所有的搜索修饰语如:"-inurl:(htm|html|php) intitle:"index of" +"last modified" +"parent directory" +description +size +(.mp3|.wma|.ogg) ?" 这些吗?使用 Google Hacks 你便可以不须记忆而搜索几十种不同的文件,歌词,缓存页面,字体,等等其他你需要的东西,只要它们存在于互联网上。

Google Hacks 包括了 MACLinuxWindows 几个版本,启动后,输入你的搜索条件,选取你要搜索的类型,确认后,Google Hacks 会自动打开您的默认浏览器显示搜索结果。

附件是去掉了 ToolBar 的 Windows 版本单个执行文件,解压直接运行即可。

注:Google Hacks 目前不支持中文搜索,发送到浏览器的中文编码有问题。


Oct 27

Download Counter 是用于管理 WordPress 文件下载的插件,在后台管理中填入下载文件数据(标题,真实地址)后,通过:
< lang="php" linenum="off">
[Download]文件ID[/Download]

在文章中插入附件下载代码。

顾名思义,Download Counter 可以统计附件的下载次数,并让下载者看到此文件已被载过多少次。

Download Counter 1.2 基于 JerryDownload Counter 1.1,原始版本则是 VanguardDownload Counter v1.0

主要的改动有:

1.去掉了作用不大但是及其影响速度的验证链接是否有效的功能;
2.重新设计后台管理界面,默认显示最后 10 个添加的文件信息,避免文件多了后超长的列表;
3.增加搜索功能,可以通过文件 ID 或者文件名(文件描述)来搜索文件;
4.修复在 IE 7 下显示不正常的 BUG,少许迎合 XHTML 的改动(懒得全部改了反正是后台)。

附件下载 Download Counter 1.2 。


Oct 26

CoolCode默认显示模式是自动换行,当你的正文版面宽度很窄时,这样频繁的换行会使阅读代码变得困难。于是做了一点小改动,当点击代码界面时,自动显示滚动条,此时代码不换行。

需要改动的文件有.css,.js,.php。

.css


.hl-surround {
    background-color: #F9FBFC;
    border: 1px solid #C3CED9;
    padding: 0;
    margin: 0;
    margin-bottom: 5px;
    width: 98%;
    height: auto;
    overflow: hidden;
    white-space: normal;
    text-align: left;
    font-family: "Courier New", "BitStream Vera Sans Mono", Fixedsys, Courier, monospace;
}

主要是添加(改动)overflow: hidden 和 white-space: normal 这两个属性;

.js


function switchscroll(id){
if(id.style.overflow!="auto"){
	id.style.overflow="auto";
	id.style.whiteSpace="nowrap";
}else{
	id.style.overflow="hidden";
	id.style.whiteSpace="normal";
}
}

把这个函数添加进去;

.php


<div class="hl-surround" onclick="switchscroll(this);">

在.php中找到<div class="hl-surround",在其中添加一个onclick的事件,一共有四处。

示例,点击代码窗口:


$options = array(
    'numbers' => HL_NUMBERS_LI,
);
$hl =& Text_Highlighter::factory($lang, $options);
$this->blocks[$blockID] .= '<div class="hl-surround" onclick="switchscroll(this);">' . str_replace($this->hl_class, $this->hl_style, $hl->highlight($txt)) . '</div>';
$this->blocks[$blockID] = preg_replace('/<span style="[^"]*?"></span>/', '', $this->blocks[$blockID]);
$this->blocks[$blockID] = str_replace('<ol class="hl-main">',
    '<ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)">',
    $this->blocks[$blockID]);
$this->blocks[$blockID] = str_replace(""> </span></li>", "">&nbsp;</span></li>", $this->blocks[$blockID]);
$this->blocks[$blockID] = preg_replace('/<li><span style=(.*?)> </si', '<li><span style=\1>&nbsp;<', $this->blocks[$blockID]);

if ($hackphp) {
    $this->blocks[$blockID] = str_replace("<span style="color: Blue;">&lt;?php</span></li>n<li>", '', $this->blocks[$blockID]);
    $this->blocks[$blockID] = str_replace('<li><span style="color: Blue;">?&gt;</span></li>', '', $this->blocks[$blockID]);
}

附件是改好的文件。

BTW: IE真是...不好说了,注意到没,点击后,在FireFox下不会出现垂直滚动条,因为那个滚动条宽度并没计算到原容器里面,而在IE下点击,会出现垂直滚动条,它把滚动条的宽度也计算进去了>_<


Oct 16

Shutter是一个能实现类似LightBox效果的Javascript脚本,也就是在当前页面全屏遮罩下显示缩略图对应的原始图片,它比LightBox小多了,只有8K左右大小。作者同时写出了WordPress的插件Shutter-Reload。不过Shutter-Reload本身不带缩略图生成功能,所以我们可以结合iimage-Gallery在文章中方便的实现Shutter效果的图片集。

Shutter-Reload有个选项叫"Shutter on all image links with rel="prettyPhoto" or "shutterset" or "shutterset_123"",我们只要利用这个稍微修改一下iimage-Gallery就行了,让它生成缩略图的时候同时添加相应的Class标记。

把修改好的iimage-gallery.php覆盖原来的文件(请先备份),然后用如下语句添加Gallery:


<gallery crop="true"  stand_alone="false" shutterset="quakemachine">
图片地址1
...
图片地址N
</gallery>

除了shutterset,前面的都属于原iimage-Gallery自带的选项,现在设置为当独立浏览模式关闭时(也就是stand_alone="false")使用Shutter方式浏览图片,shutterset是个ID,在当前页面需唯一,可以设置为任意英文,数字和"-"号,不支持中文。具体效果可以参考MRemote一文的截图。

Shutter和iimage-Gallery请到原作者页面下载,附件是改好的iimage-gallery.php文件。


[1/2]  1 2 >