Final Unicourse'tan Çalış, Yüksek Notu Garantile!
%25 İndirim Kodu: FRM25
Yükleniyor...
Dersi İzle
GÖRÜNTÜLEYENLER
+36
Premium Özellik
Bu konuyu kimlerin görüntülediğini görmek için Premium üyelik gerekir.
Premium'a Geç
Vizesine Unicourse'tan Çalış, Yüksek Notu Garantile!
Dersi İzle
Yeni PDF görüntüleme kodu
-
$(document).ready(function () { function processPDFs() { console.log("📄 PDF önizleme işleniyor..."); $('a[href$=".pdf"]').each(function () { let link = $(this).attr('href'); if (!$(this).next('.pdf-container').length) { // 📱 **Mobil veya Safari'de linki yeni sekmede aç** if (isMobileDevice() || isSafari()) { $(this).attr('target', '_blank'); $(this).show(); } else { // 💻 **Masaüstünde tüm PDF'leri Mozilla PDF.js ile aç** $(this).hide(); // Linki gizle let container = $('<div class="pdf-container" style="width:100%; max-width:900px; height:700px; margin-top:10px; border: 1px solid #ccc;"></div>'); let iframe = $('<iframe style="width:100%; height:100%;" frameborder="0"></iframe>'); // **Eğer link dışarıdan geliyorsa veya yerel NodeBB içindeyse, Mozilla PDF.js ile aç** let siteURL = window.location.origin; let pdfURL = link.startsWith("http") ? link : `${siteURL}${link}`; let viewerURL = `https://mozilla.github.io/pdf.js/web/viewer.html?file=${encodeURIComponent(pdfURL)}&toolbar=0&disableDownload=true&disablePrint=true`; iframe.attr('src', viewerURL); container.append(iframe); $(this).after(container); } } }); } function isMobileDevice() { return /Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent); } function isSafari() { return /^((?!chrome|android).)*safari/i.test(navigator.userAgent); } processPDFs(); $(window).on('action:ajaxify.end', function () { processPDFs(); }); console.log("✅ Tüm PDF'ler artık Mozilla PDF.js ile açılacak."); }); -
$(document).ready(function () { function processPDFs() { console.log("📄 PDF önizleme işleniyor..."); $('a[href$=".pdf"]').each(function () { let link = $(this).attr('href'); if (!$(this).next('.pdf-container').length) { if (isMobileDevice() || isSafari()) { // 📱 iPhone, iPad veya Safari kullanılıyorsa, doğrudan link göster $(this).attr('target', '_blank'); // Yeni sekmede açılmasını sağla $(this).show(); // PDF linkini gizleme } else { // 💻 **Masaüstünde PDF'yi iframe içinde aç** $(this).hide(); // PDF linkini gizle let container = $('<div class="pdf-container" style="width:100%; max-width:900px; height:700px; margin-top:10px; border: 1px solid #ccc;"></div>'); let iframe = $('<iframe style="width:100%; height:100%;" frameborder="0"></iframe>'); // Eğer PDF dışarıdan yüklenmişse, Mozilla PDF.js kullan if (link.startsWith("http")) { let viewerURL = https://mozilla.github.io/pdf.js/web/viewer.html?file=${encodeURIComponent(link)}&toolbar=0&disableDownload=true&disablePrint=true; iframe.attr('src', viewerURL); } else { // Eğer dosya yerel bir NodeBB yüklemesiyse, direkt olarak iframe içinde aç let siteURL = window.location.origin; iframe.attr('src', ${siteURL}${link}); } container.append(iframe); $(this).after(container); } } }); } function isMobileDevice() { return /Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent); } function isSafari() { return /^((?!chrome|android).)*safari/i.test(navigator.userAgent); } processPDFs(); $(window).on('action:ajaxify.end', function () { processPDFs(); }); console.log("✅ iPad ve Safari için link gösterilecek, diğer tarayıcılarda iframe açılacak."); });buda eskisi
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Kayıt Ol Giriş