اخبار عاجلة

‬سنتصدى‭ ‬للسيول‭ ‬المتوقعة‭ ‬بمكبرات‭ ‬الصوت وبركة أولياء الصالحين‭ ‭‭!‬

علمت‭ ‬وكالة‭ ‬‮ هريدى‭ ‬نيوز‮‬‭ ‬الإخبارية‭ ‬أن‭ ‬رئيس‭ ‬هيئة‭ ‬الأرصاد‭ ‬الجوية‭ ‬عقد‭ ‬مؤتمرا‭ ‬صحفيا‭ ‬للحديث‭ ‬عن‭ ‬نوبة‭ ‬الأمطار‭ ‬الرعدية‭ ‬والغزيرة‭ ‬التى‭ ‬ضربت‭ ‬معظم‭ ‬محافظات‭ ‬الوجه‭ ‬البحرى‭ ‬خلال‭ ‬الأسبوع‭ ‬الفائت،‭ ‬وتوقع‭ ‬هطول‭ ‬سيول‭ ‬على‭ ‬مناطق‭ ‬متفرقة‭ ‬بالجمهورية‭ ‬خلال‭ ‬الأسابيع‭ ‬القادمة،‭ ‬ووجه‭ ‬النصح‭ ‬لأجهزة‭ ‬الدولة‭ ‬بالبدء‭ ‬فى‭ ‬الاستعدادات‭ ‬لمواجهة‭ ‬الأزمة..

 

 ‬صرح‭ ‬بذلك‭ ‬مصدر‭ ‬“فشار”‭ ‬غاوى‭ ‬تنكيت‭ ‬وهزار‭ ‬وأضاف‭ ‬أن‭ ‬أحد‭ ‬الصحفيين‭ ‬قال‭ ‬لرئيس‭ ‬الهيئة‭ ‬متسائلا: ‬وما‭ ‬هو‭ ‬دور‭ ‬هيئة‭ ‬الأرصاد‭ ‬فى‭ ‬مواجهة‭ ‬هذه‭ ‬السيول‭ ‬باعتبارها‭ ‬المسئول‭ ‬الأول‭ ‬عن‭ ‬الأرصاد‭ ‬الجوية‭ ‬فى‭ ‬مصر؟‭ ‬فقال‭ ‬له‭ ‬رئيس‭ ‬الهيئة‭ ‬ساخرا: ‬لا‭ ‬تقلق‭ ‬يا‭ ‬عزيزى‭. ‬ سنتصدى‭ ‬لها‭ ‬بمكبرات‭ ‬الصوت‭ ‬والألعاب‭ ‬النارية‭ ‬وبركة‭ ‬أولياء‭ ‬الله‭ ‬الصالحين‭!‬

replaceOembeds();

function replaceOembeds() {
    var allEmbeds = document.getElementsByTagName("OEMBED");

    while (allEmbeds.length != 0) {
        replaceOembedWithHtml(allEmbeds[0], extractLinkFromOembed(allEmbeds[0]));
        allEmbeds = document.getElementsByTagName("OEMBED");
    }

    runYoutubeLazyLoad();
    loadfbApi();
}

function replaceOembedWithHtml(element, sourceData) {
    if (sourceData.source.toLowerCase() === "youtube") {
        var html="<div class="yt-embed"><div class="embed-wrap">" +
            '<div class="embed-container">' +
            '<div class="youtube" data-embed="' + sourceData.id + '">' +
            '<div class="play-button"> ' +
            '' +
            '</div>' +
            '</div></div></div></div>';

        replaceElementWithHtml(element, html);
    } else if (sourceData.source.toLowerCase() === "instagram") {
        var html="<div class="instagram-embed"></div>';

        replaceElementWithHtml(element, html);
    } else if (sourceData.source.toLowerCase() === "twitter") {
        var html="<div class="tw-embed"></div>';
        replaceElementWithHtml(element, html);
    } else if (sourceData.source.toLowerCase() === "facebook") {
        var html="<div class="fb-embed"><div class="fb-video" data-href=""></div></div>'
        replaceElementWithHtml(element, html);
    } else {
        replaceElementWithHtml(element, "");
    }

}

function extractLinkFromOembed(element) {
    return getUrlSource(element.getAttribute("url"));
}

function getUrlSource(url) {
    var ytRegex = /http(?:s?)://(?:www.)?youtu(?:be.com/watch?v=|.be/)([w-_]*)(&amp;(amp;)?‌​[w?‌​=]*)?/;
    var instaRegex = /(https?://www.)?instagram.com(/p/(w+)/?)/;
    var twitterRegex = /twitter.com/.*/status(?:es)?/([^/?]+)/;
    var fbRegex = /^https?://www.facebook.com.*/(video(s)?|watch|story|posts)(.php?|/).+$/;

    if (ytRegex.test(url)) {
        return {
            source: "Youtube",
            url: url,
            id: ytRegex.exec(url)[1]
        };
    }

    if (instaRegex.test(url)) {
        return {
            source: "Instagram",
            url: url,
            id: instaRegex.exec(url)[3]
        };
    }

    if (twitterRegex.test(url)) {
        return {
            source: "Twitter",
            url: url,
            id: twitterRegex.exec(url)[1]
        };
    }

    if (fbRegex.test(url)) {
        return {
            source: "Facebook",
            url: url,
            id: fbRegex.exec(url)[1]
        };

    }

    return {
        source: "Unknown",
        url: url,
        id: ""
    };
}

function replaceElementWithHtml(element, html) {
    var str = html;
    var Obj = element; //any element to be fully replaced
    if (Obj.outerHTML) { //if outerHTML is supported
        Obj.outerHTML = str; ///it's simple replacement of whole element with contents of str var
    } else { //if outerHTML is not supported, there is a weird but crossbrowsered trick
        var tmpObj = document.createElement("div");
        tmpObj.innerHTML = '<!--THIS DATA SHOULD BE REPLACED-->';
        ObjParent = Obj.parentNode; //Okey, element should be parented
        ObjParent.replaceChild(tmpObj, Obj); //here we placing our temporary data instead of our target, so we can find it then and replace it into whatever we want to replace to
        ObjParent.innerHTML = ObjParent.innerHTML.replace('<div><!--THIS DATA SHOULD BE REPLACED--></div>', str);
    }
}
function loadfbApi() {
    var js = document.createElement('script');
    js.src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2";
    document.body.appendChild(js);
}
function runYoutubeLazyLoad() {
    /// youtube lazyload
    var youtube = document.querySelectorAll(".youtube");

    for (var i = 0; i &lt; youtube.length; i++) {

        var source = &quot;https://img.youtube.com/vi/" + youtube[i].dataset.embed +
            &quot;/0.jpg&quot;;

        var image = new Image();
        image.src = &quot;/themes/veto/assets/images/no.jpg&quot;;
        image.classList.add('lazyload');
        image.setAttribute(&quot;data-src&quot;, source);
        image.setAttribute(&quot;alt&quot;, &quot;youtube&quot;);
        image.addEventListener(&quot;load&quot;, function () {
            youtube[i].appendChild(image);
        }(i));

        youtube[i].addEventListener(&quot;click&quot;, function () {

            var iframe = document.createElement(&quot;iframe&quot;);

            iframe.setAttribute(&quot;frameborder&quot;, &quot;0&quot;);
            iframe.setAttribute(&quot;allowfullscreen&quot;, &quot;&quot;);
            iframe.setAttribute(&quot;src&quot;, &quot;https://www.youtube.com/embed/" + this.dataset
                .embed + &quot;?rel=0&amp;showinfo=0&amp;autoplay=1&quot;);

            this.innerHTML = &quot;&quot;;
            this.appendChild(iframe);
        });
    };
}

اظهر المزيد

مقالات ذات صلة

اترك رد

زر الذهاب إلى الأعلى