mirror of
https://github.com/openvk/openvk
synced 2024-11-13 10:39:24 +03:00
Add themepack option to not inherit default themepack styles
This commit is contained in:
parent
2e8ddc090d
commit
7314f369af
2 changed files with 26 additions and 4 deletions
|
@ -7,15 +7,22 @@
|
|||
<link rel="shortcut icon" href="/assets/packages/static/openvk/img/icon.ico" />
|
||||
<meta name="application-name" content="OpenVK" />
|
||||
<meta n:ifset="$csrfToken" name="csrf" value="{$csrfToken}" />
|
||||
{css "css/style.css"}
|
||||
{css "css/dialog.css"}
|
||||
{script "js/node_modules/jquery/dist/jquery.min.js"}
|
||||
{script "js/node_modules/umbrellajs/umbrella.min.js"}
|
||||
{script "js/openvk.cls.js"}
|
||||
|
||||
{ifset $thisUser}
|
||||
{if !is_null($thisUser->getTheme())}
|
||||
{var theme = $thisUser->getTheme()}
|
||||
{if $theme->inheritDefault()}
|
||||
{css "css/style.css"}
|
||||
{css "css/dialog.css"}
|
||||
{/if}
|
||||
|
||||
<link rel="stylesheet" href="/themepack/{$theme->getId()}/{$theme->getVersion()}/stylesheet/styles.css" />
|
||||
{else}
|
||||
{css "css/style.css"}
|
||||
{css "css/dialog.css"}
|
||||
{/if}
|
||||
|
||||
{if $thisUser->getStyleAvatar() == 1}
|
||||
|
@ -24,6 +31,9 @@
|
|||
{if $thisUser->getStyleAvatar() == 2}
|
||||
{css "css/avatar.2.css"}
|
||||
{/if}
|
||||
{else}
|
||||
{css "css/style.css"}
|
||||
{css "css/dialog.css"}
|
||||
{/ifset}
|
||||
|
||||
{ifset headIncludes}{include headIncludes}{/ifset}
|
||||
|
@ -48,6 +58,11 @@
|
|||
<div class="page_header">
|
||||
<a href="/" class="home_button" title="OpenVK">openvk</a>
|
||||
<div n:if="isset($thisUser) ? !$thisUser->isBanned() : true" class="header_navigation">
|
||||
{if $_SERVER['SERVER_NAME'] == "openvk2.veselcraft.ru"}
|
||||
<div class="link">
|
||||
<a href="https://openvk.su/"><b>new domain!</b></a>
|
||||
</div>
|
||||
{/if}
|
||||
{ifset $thisUser}
|
||||
<div class="link">
|
||||
<a href="/">{_"header_home"}</a>
|
||||
|
|
|
@ -5,14 +5,16 @@ class Themepack
|
|||
{
|
||||
private $id;
|
||||
private $ver;
|
||||
private $inh;
|
||||
private $meta;
|
||||
private $home;
|
||||
private $enabled;
|
||||
|
||||
function __construct(string $id, string $ver, bool $enabled, object $meta)
|
||||
function __construct(string $id, string $ver, bool $inh, bool $enabled, object $meta)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->ver = $ver;
|
||||
$this->inh = $inh;
|
||||
$this->meta = $meta;
|
||||
$this->home = OPENVK_ROOT . "/themepacks/$id";
|
||||
$this->enabled = $enabled;
|
||||
|
@ -58,6 +60,11 @@ class Themepack
|
|||
return $this->meta->author ?? $this->getName() . " authors";
|
||||
}
|
||||
|
||||
function inheritDefault(): bool
|
||||
{
|
||||
return $this->inh;
|
||||
}
|
||||
|
||||
function fetchStyleSheet(): ?string
|
||||
{
|
||||
$file = "$this->home/stylesheet.css";
|
||||
|
@ -83,6 +90,6 @@ class Themepack
|
|||
if($manifest->openvk_version > Themepacks::THEMPACK_ENGINE_VERSION)
|
||||
throw new Exceptions\IncompatibleThemeException("Theme is built for newer OVK (themeEngine" . $manifest->openvk_version . ")");
|
||||
|
||||
return new static($manifest->id, $manifest->version, (bool) ($manifest->enabled ?? true), (object) $manifest->metadata);
|
||||
return new static($manifest->id, $manifest->version, (bool) ($manifest->inherit_master ?? true), (bool) ($manifest->enabled ?? true), (object) $manifest->metadata);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue