Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
Update 0.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
bakaomg committed Aug 16, 2019
1 parent 950fe6c commit 469e48e
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 907 deletions.
674 changes: 0 additions & 674 deletions LICENSE

This file was deleted.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
MD风格单栏主题
## 开始使用
1. Star本项目(<br>
2. 前往 [releases](https://github.com/ohmyga233/castle-Typecho-Theme/releases) 下载主题<br>
2. 前往 releases 下载主题<br>
3. 将主题上传至 `/usr/themes` 目录并解压(记得重命名为 `Castle`~<br>
4. 前往 Typecho 后台启用主题即可食用ε=ε=ε=(\~ ̄▽ ̄)\~
4. 前往 Typecho 后台启用主题即可食用ε=ε=ε=(~ ̄▽ ̄)~
## 开源协议
本项目使用 GPL V3 进行许可。<br>
项目使用 GPL V3 进行许可。<br>
如果可以的话,请给本项目一个Star吧!<br>
或者可以前往 [这里](https://pay.ohmyga.cn/) 给我投食ο(=•ω<=)ρ⌒☆
或者可以前往 Food 给我投食ο(=•ω<=)ρ⌒☆
## 使用到的开源项目
详见 [这里](https://castle.ohmyga.cc/#/copy?id=%e4%bd%bf%e7%94%a8%e7%9a%84%e5%bc%80%e6%ba%90%e9%a1%b9%e7%9b%ae) ( ̄▽ ̄)"
详见 https://castle.ohmyga.cc/#/copy?id=%e4%bd%bf%e7%94%a8%e7%9a%84%e5%bc%80%e6%ba%90%e9%a1%b9%e7%9b%ae
## 链接
作者博客 https://ohmyga.cn/<br>
作者博客 https://ohmyga.cn/
主题文档 https://castle.ohmyga.cc/ (快写完惹)
61 changes: 12 additions & 49 deletions functions.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
/**
* Functions
* Version 0.3.2
* Version 0.3.3
* Author ohmyga( https://ohmyga.cn/ )
* 2019/06/01
* 2019/08/16
**/
if (!defined('__TYPECHO_ROOT_DIR__')) exit;

define("THEME_NAME", "Castle");
define("CASTLE_VERSION", "0.3.2");
define("CASTLE_VERSION", "0.3.3");

require_once("libs/setting.php");
require_once("libs/owo.php");
Expand Down Expand Up @@ -233,43 +233,10 @@ function getTheme() {
return $themeName;
}

/* 主题检查更新链接 */
function updateURL() {
if (extension_loaded('openssl')) {
$url = 'https://api.ohmyga.cc/';
}else{
$url = 'http://nossl.api.ohmyga.cc/';
}
return $url;
}

/* 主题检查更新&获取公告 */
function themeUpdate($type) {
if ($type == 'GetNewVer') {
$get_new_ver = file_get_contents(updateURL().'themes/update/?site='.$_SERVER['HTTP_HOST'].'&v='.CASTLE_VERSION.'&n='.THEME_NAME);
$array = json_decode($get_new_ver, true);
$output = $array['version'];
}elseif ($type == 'check') {
$get_new_ver = file_get_contents(updateURL().'themes/update/?site='.$_SERVER['HTTP_HOST'].'&v='.CASTLE_VERSION.'&n='.THEME_NAME);
$array = json_decode($get_new_ver, true);
$output = $array['message'];
}elseif ($type == 'announcement') {
$get_new_ver = file_get_contents(updateURL().'themes/update/?site='.$_SERVER['HTTP_HOST'].'&v='.CASTLE_VERSION.'&n='.THEME_NAME);
$array = json_decode($get_new_ver, true);
$output = $array['announcement'];
}elseif($type == 'ajaxURL') {
$output = updateURL().'themes/update/?site='.$_SERVER['HTTP_HOST'].'&v='.CASTLE_VERSION.'&n='.THEME_NAME;
}

return $output;
}

/* 主题版本 */
function themeVer($type) {
if ($type == 'current') {
$ver = CASTLE_VERSION;
}elseif ($type == 'new'){
$ver = themeUpdate('GetNewVer');
}
return $ver;
}
Expand Down Expand Up @@ -303,21 +270,17 @@ function highlightResource() {
$setting = Helper::options()->themeResource;
$hls = Helper::options()->hls;

if ($setting == 'local') {
$hltd = Helper::options()->themeFile(getTheme(), "others/css/highlight/default.min.css");
if (file_exists($hltd)) {
if ($hls == 'default.min.css') {
$output = Helper::options()->themeUrl.'/others/css/highlight/default.min.css';
}elseif ($hls == 'jsdelivr') {
$output = 'https://cdn.jsdelivr.net/gh/ohmyga233/castle-Typecho-Theme@'.themeVer('current').'/others/css/highlight/default.min.css';
}else{
$output = Helper::options()->themeUrl.'/others/css/highlight/'.$hls;
}
$hltd = Helper::options()->themeFile(getTheme(), "libs/highlight/default.min.css");
if (file_exists($hltd)) {
if ($hls == 'default.min.css') {
$output = Helper::options()->themeUrl.'/libs/highlight/default.min.css';
}elseif ($hls == 'jsdelivr') {
$output = 'https://cdn.jsdelivr.net/gh/ohmyga233/castle-Typecho-Theme@'.themeVer('current').'/libs/highlight/default.min.css';
}else{
$output = 'https://cdn.jsdelivr.net/gh/ohmyga233/castle-Typecho-Theme@'.themeVer('current').'/others/css/highlight/default.min.css';
$output = Helper::options()->themeUrl.'/others/css/highlight/'.$hls;
}
}elseif ($setting == 'jsdelivr') {
$output = 'https://cdn.jsdelivr.net/gh/ohmyga233/castle-Typecho-Theme@'.themeVer('current').'/others/css/highlight/default.min.css';
}else{
$output = 'https://cdn.jsdelivr.net/gh/ohmyga233/castle-Typecho-Theme@'.themeVer('current').'/libs/highlight/default.min.css';
}

return $output;
Expand Down
3 changes: 1 addition & 2 deletions includes/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
'search' => _t('包含关键字 %s 的文章'),
'tag' => _t('标签 %s 下的文章'),
'author' => _t('%s 发布的文章')
), '', ' - '); ?><?php $this->options->title(); ?></title><?php if ($this->options->totc): ?>
<meta name="theme-color" content="<?php $this->options->totc(); ?>"><?php endif; ?>
), '', ' - '); ?><?php $this->options->title(); ?></title>
<script src="<?php echo themeResource('others/js/mdui.min.js'); ?>"></script>
<script src="<?php echo themeResource('others/js/nprogress.min.js'); ?>"></script>
<script src="<?php echo themeResource('others/js/jquery3.3.1.min.js'); ?>"></script>
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @package Castle
* @author ohmyga
* @version 0.3.2
* @version 0.3.3
* @link https://ohmyga.cn/
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
Expand Down
File renamed without changes.
31 changes: 5 additions & 26 deletions libs/setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,8 @@ function themeConfig($form) {
}
echo '<style>textarea{ height: 180px; width: 100%;}</style>';
echo '<link rel="stylesheet" href="'.themeResource('others/css/setting.min.css').'" />';
echo '<script src="'.themeResource('others/js/jquery3.3.1.min.js').'"></script>
<script>
$.ajax({
type: "GET",
url: "'.themeUpdate('ajaxURL').'",
beforeSend: function(xhr) {
$(\'#newVer\').html(\'正在获取新版本中...\');
$(\'#acGet\').html(\'正在获取公告中...\');
},
success: function(data) {
$(\'#newVer\').html(data.message);
$(\'#acGet\').html(data.announcement);
},
error: function(xhr, textStatus, errorThrown) {
$(\'#newVer\').html(\'新版本获取出错\');
$(\'#acGet\').html(\'公告获取出错\');
}
});
</script>';
echo '<div class="moe-panel">
echo '<script src="'.themeResource('others/js/jquery3.3.1.min.js').'"></script><script>var URLS= "http://api.ohmyga.cc/update/?data='.base64_encode(json_encode(array('url'=>$_SERVER['HTTP_HOST'],'name'=>THEME_NAME,'version'=>CASTLE_VERSION))).'";</script>';
echo '<div class="moe-panel" id="panel">
<span class="moe-title">Castle 设置面板</span>
<span class="moe-current-ver">本地版本: '.themeVer('current').'</span>
<span class="moe-new-ver">云端版本: <span id="newVer">正在获取新版本中...</span></span>
Expand All @@ -91,7 +73,7 @@ function themeConfig($form) {
<input type="submit" name="type" class="btn btn-s" value="还原模板数据" />&nbsp;&nbsp;
<input type="submit" name="type" class="btn btn-s" value="删除备份数据" />
</form>
</div>';
</div><script src="'.themeResource('others/js/set.min.js').'"></script>';

$filenum = 0;
$openfile = glob(Helper::options()->themeFile(getTheme(), "languages/*.json"));
Expand Down Expand Up @@ -170,9 +152,9 @@ function themeConfig($form) {
_t('主题整体颜色'));
$form->addInput($tcs->multiMode());

$hltd = Helper::options()->themeFile(getTheme(), "others/css/highlight/default.min.css");
$hltd = Helper::options()->themeFile(getTheme(), "libs/highlight/default.min.css");
if (file_exists($hltd)) {
$hlts = array_map('basename', glob(dirname(__FILE__) . '/../others/css/highlight/*.css'));
$hlts = array_map('basename', glob(dirname(__FILE__) . '/../libs/highlight/*.css'));
$hlts = array_combine($hlts, $hlts);
$texts = '';
}else{
Expand Down Expand Up @@ -284,9 +266,6 @@ function themeConfig($form) {
array('copy', 'pjax', 'gotop', 'night'), _t('其他设置'));
$form->addInput($other->multiMode());

$totc = new Typecho_Widget_Helper_Form_Element_Text('totc', NULL, NULL, _t('Chrome地址栏颜色'), _t('Chrome地址栏颜色代码(十六进制),不填则不显示'));
$form->addInput($totc);

$sticky = new Typecho_Widget_Helper_Form_Element_Text('sticky', NULL, NULL, _t('置顶文章'), _t('置顶的文章cid,按照排序输入, 请以半角逗号或空格分隔'));
$form->addInput($sticky);

Expand Down
2 changes: 1 addition & 1 deletion others/css/castle.min.css

Large diffs are not rendered by default.

147 changes: 1 addition & 146 deletions others/css/setting.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 469e48e

Please sign in to comment.