nildarar
(Nildarar)
19 أغسطس 2020، 2:52م
1
مرحبًا،
هل يمكن لأي شخص مساعدتي في إضافة معرف السمة النشطة كـ html أو body في فئة CSS؟
أحتاج إلى كتابة بعض الأنماط وأحتاج إلى سمات مختلفة لبعض السمات.
على سبيل المثال، عند استخدام “dark-theme ”:
html class="desktop-view not-mobile-device text-size-normal dark-theme"
لا نستخدم الاسم كمعرف، بل نستخدم رقمًا فقط. يمكنك العثور على معرف السمة من خلال النظر في عنوان URL أثناء تخصيص سمة في لوحة الإدارة… على سبيل المثال https://forum.example.come/admin/customize/themes/140
إذا كان بإمكانك الاكتفاء بالمعرف دون الاسم، فستكون هذه طريقة سريعة للقيام بذلك (تمت إضافتها إلى ملف الرأس الخاص بالسمة/المكون الخاص بك):
<script type="text/discourse-plugin" version="0.8">
var themeSelector = require('discourse/lib/theme-selector');
document.querySelector("body").classList.add("theme-id-" + themeSelector.currentThemeId())
</script>
يمكنك أيضًا العثور على اسم السمة من خلال المعرف، لكن ذلك سيتطلب بعض الجهد الإضافي.
إعجابَين (2)
nildarar
(Nildarar)
20 أغسطس 2020، 5:18ص
3
شكرًا لك، كريس، @awesomerobot
هل توجد وثيقة لملحقات Discourse وطرق المكتبات ذات الصلة؟
لقد وجدت هذا، لكنه يبدو أنه لا يتضمن جميع المكتبات والطرق:
Discourse Themes and Theme Components can be used to customize the look, feel and functionality of Discourse’s frontend. This section of the developer guides aims to provide all the reference materials you need to develop simple themes for a single site, right up to complex open-source theme components.
This introduction aims to provide a map of all the tools and APIs for theme development. If you prefer a step-by-step tutorial for theme development, jump straight to:
Themes vs. Theme Compon…
system
(system)
تم إغلاقه في
19 سبتمبر 2020، 5:32ص
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.