نافذات الضوء IFrame

This is a theme component that adds the ability to open iFrames in lightboxes.

Samples

This component adds an “expand” button on top of the iframes you enable it on.

Clicking the button will open the iframe in fullscreen in a lightbox.

Clicking either the dark area around the iframe or the x at the top right corner closes the lightbox. The same way it works for default image lightboxes.

Settings

There’s only one setting. You add the domains that you want to have this functionality on there.

:warning: Whatever domains you specify here also need to be whitelisted in the allowed_iframes site setting to show up in posts in the first place.

Usage examples:

Here’s a couple of examples besides the CodePen iframe above

Google forms iframe:

Embedding the entire weather.gov website:

Credit:

This component uses Noël Bossart’s fantastic Featherlight library (MIT license - 3kb gzip)

31 إعجابًا

I suppose these iframes still also need to be activated in the allowed iframes site setting?

5 إعجابات

Correct, this component will not mess with any whitelisting settings at all.

In order for any iframe to show up in the cooked content of a post - expandable or not - it has to be on the list of allowed_iframes setting like you pointed out.

I’ll add a note about this to the topic.

5 إعجابات

@Johani is this component still functional? If so, any thoughts on why I am not getting the pop-out diagonal-arrows in the upper-right, but rather a blank/dead box?

Here is what I’ve tried:

  • Updated themes/components.
  • Made sure src links were white-listed in the component and the Discourse settings.
  • Tried a few different links, including Google Maps.
  • Tried several scenarios with the Media Overlay on/off + Lightbox alone on/off.

Below are some screenshots.

Thx!
-Patrick





image
image
image
image

Dear @Johani,

thank you very much for conceiving and maintaining this theme component.

After installing it on https://community.hiveeyes.org/ the other day, some users recently started to complain that the overall appearance of the head of the page looked different for them. They finally found out the reason was that they blocked cloudflare altogether, so all requests to https://cdnjs.cloudflare.com/ajax/libs/featherlight/1.7.13/featherlight.min.js would fail.

So, we are humbly asking if there would be a way for you to provide this component in a self-contained variant?

With kind regards,
Andreas.

3 إعجابات

Why is it desktop-only?

I had a bug this theme component, post contents weren’t showing.

Could I trigger open iframe in a any link simply?
User just see iframe only when click at link

إعجاب واحد (1)

Welp… this one fell through the cracks. It’s been a while since it got any attention, and a lot has changed in Discourse.

Better late than never… :upside_down_face:

I just pushed an update that should fix all the problems.

It will be after you update.

The component is now self-contained with no external requests.

After you update, it will work on mobile too.

Should be fixed after you update

This is out of the scope of this component. You need a different component to handle that.

Apologies for the delay, and thanks for the feedback :+1:

7 إعجابات

شكراً جزيلاً!

لا داعي للاعتذار، من الجيد أن نرى أنك تمكنت من الاهتمام بها، بين كل الأشياء الأخرى التي تحدث. نحن نقدر ذلك حقًا.

إعجاب واحد (1)

هل توجد بالفعل مكونة يمكنها فتح iframe lightbox في رابط بهذه الطريقة؟

لست على علم بأي مكونات موجودة تقوم بذلك، لذا سيتعين عليك إنشاء واحدة أو تكليف بهذا العمل في فئة Marketplace.

يقوم مكون السمة هذا بالتحقق من iFrame في منشور ويقارن سمة src الخاصة به بـ قائمة المصادر المؤهلة التي يوفرها المسؤول في إعدادات المكون. إذا تطابق نطاق المصدر، فإنه يضيف زر الإضاءة الخفيفة. تتم معالجة عرض الإضاءة الخفيفة بواسطة featherlight.js. يستمع Featherlight إلى النقرات على العناصر التي تحتوي على السمة data-featherlight. إذا تم النقر على أحد هذه العناصر، فإنه يفتح الإضاءة الخفيفة بمحتويات هذا الـ iFrame.

يمكنك فعل الشيء نفسه مع علامات <a> في مكون مختلف مع القليل من الجهد. إذا تطابق href الرابط مع نطاق مدرج في إعدادات المكون، فقم بإضاءته في إطار iFrame. وإلا، اتركه كرابط عادي. لا تريد أن تفتح جميع الروابط في إطار iFrame مضاء.

تمت معالجة معظم العمل المطلوب بالفعل بواسطة هذا المكون، لذا يمكنك فقط نسخه وتعديله والبدء من هناك. لا توجد خطط لإضافة هذه الميزة إلى هذا المكون لأنه مخصص فقط للتعامل مع علامات iFrame في المنشورات.

3 إعجابات

هذه إحدى الطرق لتضمين نافذة منبثقة للإطار المضمن (iFrame Lightbox) داخل عنصر نصي قابل للنقر …

يقبل المكون الإضافي لملاحظات Discourse (Discourse Footnotes Plugin) https://meta.discourse.org/t/discourse-footnote/84533 كود HTML بالإضافة إلى Markdown داخل الملاحظات المنبثقة.

لذلك، على سبيل المثال، هذا الكود …

… يولد هذه الملاحظة المنبثقة القابلة للنقر والتي تحتوي على إطار مضمن مصغر مع زر توسيع المحتوى في الزاوية العلوية اليمنى …

لجعل هذا يعمل، قمت (في إعدادات الموقع) بتمكين كل من تمكين ملاحظات Markdown و عرض الملاحظات بشكل مضمن

ثم أضفت اسم نطاق هذا الموقع (microchic.com) إلى قائمة الإطارات المضمنة المسموح بها في إعدادات الموقع …

… وأيضًا في قائمة نطاقات أصل الإطار المضمن في إعدادات المكون الإضافي للإطار المضمن (iFrame Lightbox Plugin) …

يمكنك تجربته مباشرة هنا …

مرحباً، كنت أتساءل عن كيفية تنسيق المنشورات. أحصل على مربع فارغ باستخدام

iframe src=" url" محاط بـ < > هذا حتى عند استخدام codepen.io الموجود في القائمة البيضاء للمواقع الرئيسية لإطارات iframe.

هل لا يزال هذا المكون يعمل؟ لقد كان يعمل لدي في الماضي ولكنه توقف عن العمل لسبب ما.
يبدو أن آخر تحديث كان قبل 3 سنوات: hnb-ku/discourse-iframe-lightboxes (github.com) لذا من المنطقي افتراض أن شيئًا ما قد تعطل؟

إعجاب واحد (1)

لقد كان يعمل في مايو حيث استخدمته هنا.

إعجاب واحد (1)

يعمل لدي مع أحدث إصدار من Discourse.

هل هناك أي خطأ في وحدة تحكم المتصفح؟

إعجابَين (2)

لا يمكنني جعل هذا يعمل، لقد اتبعت الدليل بدقة وأضفت النطاق إلى كل من مكون السمة وإعداد الموقع. إليك ما أحصل عليه:

لم يتم تسجيل أي أخطاء في وحدة تحكم مطور جافاسكريبت.

إعداد موقع الإطارات المضمنة المسموح بها يحتوي على النطاق ذي المستوى الأعلى:

https://example.biz/

تحتوي إعدادات مكون السمة عليه بدون https كما هو الحال في الأمثلة الموجودة:

example.biz

أي أفكار حول كيفية تصحيح الأخطاء؟

إعجاب واحد (1)

لا توجد أخطاء في وحدة التحكم.
أنا أستخدمه مع معاينات PDF: Inline PDF Previews - #116 by Alon1
أتوقع الحصول على أسهم التوسيع فوق ملف PDF

لكنها ببساطة لن تظهر

هل يمكنك تجربة هذا الفرع بدلاً من ذلك؟

URL: https://github.com/Arkshine/discourse-iframe-lightboxes
الفرع: improve-compatibility

لقد كنت محظوظًا من قبل إذا كان يعمل!

كلا الـ TCs يستخدمان نفس الـ API لتزيين منشور، لذا سيكون ترتيب تثبيتهما ضروريًا. أيضًا، يتم تعيين مصدر الـ iframe ديناميكيًا بمجرد تنزيل الـ PDF وقد لا يكون متاحًا على الفور في هذا الـ TC الخاص بـ IFrame Lighboxes.

التغييرات التي أجريتها هي بشكل أساسي:

  • البحث عن عناصر iframe في حلقة التشغيل التالية، لذلك يضمن توفر iframe
  • الانتظار حتى يتم تحميل iframe حتى تتمكن من استرداد عنوان URL للمصدر

أخبرني إذا كان يعمل بشكل أفضل. :+1:

4 إعجابات