Jump to content
View in the app

A better way to browse. Learn more.

Дизайн и модификация Invision Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Виджеты для разных тем.

Возможно как-то задать чтобы к примеру с одной темой блок выглядел иначе чем с другой.

К примеру у меня есть 2 темы, одна светлая, вторая тёмная..

и виджет с кодом дискорда тёмного цвета

Хочется чтобы а белой теме был другой код с белым цветом(код у меня есть, осталось понять как сделать чтобы он переключался)

Помогите.

post-60308-0-54992800-1519230579_thumb.png

Featured Replies

В настройках внешнего вида, в свойствах темы "Light" кликаете по иконке "Редактировать HTML и CSS", во вкладке CSS выбираете core -> front -> custom -> custom.css и добавляете туда свои селекторы, например:

#discord-widget .widget-body { background-color: #f3f3f3 !important; color: #6a6b80 !important; }

Сохраняете тему и смотрите результат.

  • Author

Короче ваш вариант не помог.

Но я нашёл решение радикально

Взял и просто вставил в код sidebar напрямую код дискорда после виджетов.

 

{{$adsForceSidebar = ( \IPS\Settings::i()->ads_force_sidebar AND \IPS\core\Advertisement::loadByLocation( 'ad_sidebar' ) );}}
{{if (isset( \IPS\Output::i()->sidebar['enabled'] ) and \IPS\Output::i()->sidebar['enabled'] ) && ( ( isset( \IPS\Output::i()->sidebar['contextual'] ) && trim( \IPS\Output::i()->sidebar['contextual'] ) !== '' ) || ( isset( \IPS\Output::i()->sidebar['widgets']['sidebar'] ) && count( \IPS\Output::i()->sidebar['widgets']['sidebar'] ) ) || ( \IPS\Dispatcher::i()->application instanceof \IPS\Application AND \IPS\Dispatcher::i()->application->canManageWidgets() ) || $adsForceSidebar )}}
<div id='ipsLayout_sidebar' class='ipsLayout_sidebar{$position} {{if !( isset( \IPS\Output::i()->sidebar['contextual'] ) && trim( \IPS\Output::i()->sidebar['contextual'] ) !== '' ) && ( !isset( \IPS\Output::i()->sidebar['widgets']['sidebar'] ) || !count( \IPS\Output::i()->sidebar['widgets']['sidebar'] ) ) && \IPS\Dispatcher::i()->application->canManageWidgets() && !$adsForceSidebar}}ipsLayout_sidebarUnused{{endif}}' data-controller='core.front.widgets.sidebar'>

	{{if isset( \IPS\Output::i()->sidebar['contextual'] ) && trim( \IPS\Output::i()->sidebar['contextual'] ) !== ''}}
		<aside id="elContextualTools" class='ipsClearfix' {{if isset( \IPS\Output::i()->sidebar['sticky'] )}}data-ipsSticky{{endif}}>
			{expression="\IPS\Output::i()->sidebar['contextual']" raw="true"}
		</aside>
	{{endif}}
	{{if $adsForceSidebar OR ( \IPS\core\Advertisement::loadByLocation( 'ad_sidebar' ) AND ( ( isset( \IPS\Output::i()->sidebar['contextual'] ) && trim( \IPS\Output::i()->sidebar['contextual'] ) !== '' ) OR ( isset( \IPS\Output::i()->sidebar['widgets']['sidebar'] ) && count( \IPS\Output::i()->sidebar['widgets']['sidebar'] ) ) ) )}}
		<div data-role='sidebarAd'>
			{advertisement="ad_sidebar"}
		</div>
		<br><br>
	{{endif}}
	{template="widgetContainer" group="global" app="core" params="'sidebar', 'vertical'"}<br>
     <iframe src="https://discordapp.com/widget?id=388039995375484948&theme=light" width="328" height="400" allowtransparency="true" frameborder="0"></iframe>
</div>
{{endif}}

  • Author

Только вот теперь виджет отображается на всех страницах - а хотелось бы чтобы только на главной..

Добавьте 2 виджета. После в темном стиле скроете светлый, а в светлом - темный

  • Author

Как скрыть их?

Через css. Я не вижу у Вас на форуме виджетов

  • Author

Суть в том что мне нужно блок с виджетом скрыть а не только виджет сам.

Скрывайте. Смотрите селектор у блока.

В IPS виджет - это блок с названием и содержимым, а не содержимое

  • Author

Я плохо вдупляю.

Давайте я поставлю блок с дискордом обратно и вы покажите мне пример на нём..

А то я пытаюсь кубик в кружок впихнуть и не понимаю..

заранее спасибо..

Каждый виджет имеет атрибут data-blockid с уникальным значением.

В данном случае data-blockid="plugin_3_sodTxtWidget_5w8hbhe8u"

 

Чтобы скрыть виджет, нужно добавить в custom.css

li[data-blockid="plugin_3_sodTxtWidget_5w8hbhe8u"] {
   display: none;
}

  • Author

Лол, всё так просто?!

Большое спасибо..

Можете заглянуть пожалуйста ещё в соседнию темку, если не затруднит.. :unsure:

Можно еще проще сделать. С одним виджетом

Темная тема

<iframe id="elDiscord_dark" src="https://discordapp.com/widget?id=388039995375484948&theme=dark" width="328" height="400" allowtransparency="true" frameborder="0"></iframe>

Светлая тема

<iframe id="elDiscord_light" src="https://discordapp.com/widget?id=388039995375484948&theme=light" width="328" height="400" allowtransparency="true" frameborder="0"></iframe>

 

И css в зависимости от стиля

#elDiscord_dark {
   display: none;
}

или

#elDiscord_light {
   display: none;
}

 

Либо средствами js вообще вырезать из кода

$('#elDiscord_dark').remove();

$('#elDiscord_light').remove();

 

Кстати у плагина, с помощью которого реализовано, есть php-версия. Можно определять стиль юзера, и выводить 1 фрейм в зависимости от стиля

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.