gar1t
(Garrett)
19 أبريل 2024، 4:39م
1
أحاول الوصول إلى واجهة برمجة التطبيقات (API) من مكون مخصص باستخدام هذا المقتطف في جسم HTML:
<script type="text/discourse-plugin" version="0.8">
console.log("###########", api.getCurrentUser());
</script>
ومع ذلك، لا يظهر هذا المقتطف في HTML الخاص بالصفحة.
ما هو النهج الصحيح هنا؟
بالمناسبة، هذا هو نفس السؤال الذي تم طرحه قبل بضع سنوات ولكن لم تتم الإجابة عليه:
I have tried to add custom html through jquery using plugin api events like api.onAppEvent(), api.decorateWidget(), etc…, in Edit CSS/HTML >> /head section. But, the events which i tried is not triggering the jquery on page load.
So, i am little bit confused about what event need to use. Because that event should trigger the jquery throughout the site on page load instead of blocking the scripts on particular pages.
Here is the code which i tried,
[SearchButtonIssue]
إعجابَين (2)
مرحباً غاريت!
إذا وضعت هذا الرمز في مكون السمة الخاص بك في علامة تبويب Head،
يجب أن تكون قادرًا على رؤية المخرجات في وحدة التحكم بالمتصفح (لا يوجد HTML يتم عرضه هنا):
دليل مفيد للتعرف على مكون السمة (أيضًا الوسم Theme component ):
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…
إعجاب واحد (1)
gar1t
(Garrett)
19 أبريل 2024، 4:58م
3
شكرا لك. لقد وضعت هذا الكود في قسم الجسم.
من المدهش بالنسبة لي أن سلوك الرأس هنا مختلف. يبدو أن Discourse يزيل مقتطفات واجهة برمجة التطبيقات هذه من قسم الجسم. يتم الاحتفاظ بعناصر البرنامج النصي الأخرى هناك.
إعجابَين (2)
system
(system)
تم إغلاقه في
19 مايو 2024، 4:59م
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.