栏目网站代码下共有文章 33 篇。

display:flex 子元素固定宽度和对齐

display:flex 子元素固定宽度和对齐
.parent { display: flex; flex-wrap: wrap; } .children { width: 50%; } flex-flow 子元素排列方式,是 flex-direction 和 flex-wrap 属性的复合属性,默认值: row nowrap。 方向 flex-direction 属性: row 横 row-reverse 横 倒序 column 列 column-reverse 列 倒序 是否拆行或拆列 flex-wrap 属性: nowrap 不换行 wrap 换行 wrap-reverse 镜像 justi...

Tyepcho 输出当前文章所属分类的所有子分类

Tyepcho 输出当前文章所属分类的所有子分类
$this->widget('Widget_Metas_Category_List')->to($categories); while($categories->next()): if($this->category == $categories->slug && ($this->is("post") || $this->is("category"))){ $childrens = $this->widget('Widget_Metas_Category_List')->getAllChildr...

Tyepcho 自定义文章标签输出

Tyepcho 自定义文章标签输出
Typecho 默认标签输出: $this->tags(', ', true, 'none'); 以下代码放入 funcitons.php 文件中。 function oxcat_tags($obj) { if (count($obj->tags) > 0): foreach($obj->tags as $tag){ echo '<a href="'.$tag['permalink'].'" class="tag" rel="category">'.$tag['name'].'</a>'; ...

Typecho 自定义标签页模板

Typecho 自定义标签页模板
设置 Typecho 标签页模板,并按标签所属文章数量从多到少排列输出。 <?php $this->widget('Widget_Metas_Tag_Cloud', 'sort=count&ignoreZeroCount=1&desc=1')->to($tags); if($tags->have()): echo '<div class="tags-list">'; while ($tags -> next()): echo '<a href="'.$tags->permalink.'...

Typecho 提交评论数字计算验证

Typecho 提交评论数字计算验证
functions.php 文件添加 function themeInit($comment){ $comment = spam_protection_pre($comment, $post, $result); } function spam_protection_math(){ $num1=rand(1,49); $num2=rand(1,49); echo '<label for="math">请输入<code>'.$num1.'</code>+<code>'.$num2.'</code>的...

Typecho 加强评论拦截和自定义敏感词过滤

Typecho 加强评论拦截和自定义敏感词过滤
functions.php 文件添加 设置敏感词过滤后台选项和过滤敏感词函数 function themeConfig($form) { $SensitiveWords = new Typecho_Widget_Helper_Form_Element_Textarea('SensitiveWords', NULL, NULL, _t('评论敏感词过滤'), _t('过滤词语格式:词语|词语2|词语3')); $SensitiveWords->setAttribute('class', 'typecho-option option_main'); $form-...

JS 二维码生成插件 QRious

JS 二维码生成插件 QRious
qRious 是一款纯 javascript 二维码生成插件。 html 代码 <canvas id="qrcodeImg"></canvas> JS 代码 var qr = new QRious({ element: document.getElementById('qrcodeImg'), background: 'white', foreground: 'black', level: 'H', size: 150, value: window.location.href }); 参数 参数 类型 默认值 ...

jQuery 获取当前页面地址

jQuery 获取当前页面地址
jQuery 获取当前页面完整地址 URL window.location.href

JS 点击实现浏览器全屏

JS 点击实现浏览器全屏
(function () { var viewFullScreen = document.getElementById("view-fullscreen"); if (viewFullScreen) { viewFullScreen.addEventListener("click", function () { var docElm = document.documentElement; if (docElm.requestFullscreen) { docElm.reques...

Typecho 替换全站 gravatar 头像地址

Typecho 替换全站 gravatar 头像地址
网站根目录下的 config.inc.php 文件,加入: define('__TYPECHO_GRAVATAR_PREFIX__', 'https://cravatar.cn/avatar/'); //更换头像源