{"id":48,"date":"2021-01-20T10:11:52","date_gmt":"2021-01-20T16:11:52","guid":{"rendered":"https:\/\/nowloop.com\/chicago-il\/?page_id=48"},"modified":"2021-02-02T11:36:48","modified_gmt":"2021-02-02T17:36:48","slug":"rss-display-code-by-abdelilah930-jan-19-556-pm-this-code-contains-the-changes","status":"publish","type":"page","link":"https:\/\/nowloop.com\/chicago-il\/rss-display-code-by-abdelilah930-jan-19-556-pm-this-code-contains-the-changes\/","title":{"rendered":"RSS DISPLAY CODE by Abdelilah930 Jan 19, 5:56 PM this code contains the changes"},"content":{"rendered":"<hr>\n<hr>\n<p>Abdelilah930 Jan 19, 5:56 PM<\/p>\n<p><\/p>\n<hr>\n\n\n<div id=\"rightside\" style=\"display: inline-grid;\">\n            <script>\n                const urls = [\"https:\/\/chicago.suntimes.com\/rss\/index.xml\", \"https:\/\/www.unilad.co.uk\/feed\/\"];\n                const maindiv = document.getElementById(\"rightside\");\n                let limitPerFeed = 5;\n                let titleSize = \"1.5\";\n                let titleColor = \"black\";\n                let descriptionSize = \"1\";\n                let descriptionColor = \"#4f4e4c\";\n                let pubdateSize = \"1\";\n                let pudateColor = \"black\";\n                let thumbnailHeight = \"150\"; \/* in pixel example: $thumbnail_height = \"150\";*\/\n                let thumbnailWidth = \"240\";\n                function getThumbnail(text) {\n                    let tag = \"\";\n                    let src = \"\";\n                    let b = false;\n                    for(let i = 0; i < text.length; i++) {\n                        if (text[i] === \"<\"){\n                            if(text[i+1] === \"i\"){\n                                if(text[i+2] === \"m\"){\n                                    if(text[i+3] === \"g\"){\n                                        b = true;\n                                    }\n                                }   \n                            }\n                        }\n                        if(b) {\n                            tag = tag + text[i];\n                            if(text[i] === \">\"){\n                                break;\n                            }\n                        }\n                    }\n                    b = false;\n                    for(i = 0; i < tag.length; i++) {\n                        if (tag[i-5] === \"s\"){\n                            if(tag[i-4] === \"r\"){\n                                if(tag[i-3] === \"c\"){\n                                    if(tag[i-2] === \"=\"){\n                                        if(tag[i-1] === '\"'){\n                                            b = true;\n                                        }\n                                    }\n                                }\n                            }\n                            \n                        }\n                        if(b) {\n                            if(tag[i] === '\"'){\n                                break;\n                            }\n                            src = src + tag[i];\n                        }\n                    }\n                    return src;\n                }\n                \n            for(let url of urls){\n            fetch(url)\n                    .then(response => response.text())\n                    .then(str => new window.DOMParser().parseFromString(str, \"text\/xml\"))\n                    .then(data => {\n                        let items = [];\n                let its = data.querySelectorAll(\"item\");\n                for(let it of its){\n                    items.push(it);\n                }\n                        items.slice(0, limitPerFeed).forEach(item => {\n                            let elem = document.createElement(\"div\");\n                            let link = item.querySelector(\"link\").textContent;\n                            let title = item.querySelector(\"title\").textContent;\n                            let description = item.querySelector(\"description\").textContent.toString().replace(\/(<([^>]+)>)\/gi, \"\");\n                            let pubdate = item.querySelector(\"pubDate\").textContent;\n                            let de = item.getElementsByTagNameNS(\"*\", \"encoded\");\n                            let thumbnail;\n                            if(de.length < 1){\n                                thumbnail = getThumbnail(item.querySelector(\"description\").textContent);\n                            }else{\n                                thumbnail = getThumbnail(de.item(0).innerHTML.toString());\n                            }\n                            let ht = '<a href=\"' + link + '\" style=\"text-decoration: none\" target=\"_blank\">'+\n                                                    '<div class=\"feed-item\" style=\"margin: 10px;\">' +\n                                                    '<div class=\"item-thumbnail\" style=\"margin: 5px 10px 0 10px; float: left; position: relative; border: none; text-decoration: none; max-width: 100%;\">'+\n                                                    '    <img decoding=\"async\" style=\"height: ' + thumbnailHeight + 'px; width: ' + thumbnailWidth + 'px\" src=\"' + thumbnail + '\" alt=\"' + title + '\">'+\n                                                    '<\/div>'+\n                                                    '<div class=\"item-details\" style=\"margin: 10px\">'+\n                                                    '    <div class=\"item-title\" style=\"text-decoration: none; font-size: ' + titleSize + 'em; text-align: justify; color: ' + titleColor +'\">' + title + '<\/div>'+\n                                                    '    <div class=\"item-description\" style=\"text-decoration: none; font-size: ' + descriptionSize + 'em;text-align: justify; color: ' + descriptionColor + ';\">' + description + '<\/div>'+\n                                                    '    <div class=\"item-pubdate\" style=\"text-decoration: none; font-size: ' + pubdateSize + 'em; margin-top: 10px; color: ' + pudateColor + ';\">' + (new Date(pubdate)).toLocaleTimeString().substring(0, 5) +\" \"+ (new Date(pubdate)).toLocaleDateString() +'<\/div>'+\n                                                    '<\/div>'+\n                                                '<\/div>'+\n                                            '<\/a>';\n                            elem.innerHTML = ht;\n                            maindiv.appendChild(elem);\n                        })\n                    })\n            }\n            <\/script>\n        <\/div>\n\n\n<hr>\nTHIS IS A BREAK BETWEEN TWO RSS DISPLAYS<p><\/p>\n<hr>\n\n\n<div id=\"rightside\" style=\"display: inline-grid;\">\n            <script>\n                const urls = [\"https:\/\/chicago.suntimes.com\/rss\/index.xml\", \"https:\/\/www.unilad.co.uk\/feed\/\"];\n                const maindiv = document.getElementById(\"rightside\");\n                let limitPerFeed = 5;\n                let titleSize = \"1.5\";\n                let titleColor = \"black\";\n                let descriptionSize = \"1\";\n                let descriptionColor = \"#4f4e4c\";\n                let pubdateSize = \"1\";\n                let pudateColor = \"black\";\n                let thumbnailHeight = \"150\"; \/* in pixel example: $thumbnail_height = \"150\";*\/\n                let thumbnailWidth = \"240\";\n                function getThumbnail(text) {\n                    let tag = \"\";\n                    let src = \"\";\n                    let b = false;\n                    for(let i = 0; i < text.length; i++) {\n                        if (text[i] === \"<\"){\n                            if(text[i+1] === \"i\"){\n                                if(text[i+2] === \"m\"){\n                                    if(text[i+3] === \"g\"){\n                                        b = true;\n                                    }\n                                }   \n                            }\n                        }\n                        if(b) {\n                            tag = tag + text[i];\n                            if(text[i] === \">\"){\n                                break;\n                            }\n                        }\n                    }\n                    b = false;\n                    for(i = 0; i < tag.length; i++) {\n                        if (tag[i-5] === \"s\"){\n                            if(tag[i-4] === \"r\"){\n                                if(tag[i-3] === \"c\"){\n                                    if(tag[i-2] === \"=\"){\n                                        if(tag[i-1] === '\"'){\n                                            b = true;\n                                        }\n                                    }\n                                }\n                            }\n                            \n                        }\n                        if(b) {\n                            if(tag[i] === '\"'){\n                                break;\n                            }\n                            src = src + tag[i];\n                        }\n                    }\n                    return src;\n                }\n                \n            for(let url of urls){\n            fetch(url)\n                    .then(response => response.text())\n                    .then(str => new window.DOMParser().parseFromString(str, \"text\/xml\"))\n                    .then(data => {\n                        let items = [];\n                let its = data.querySelectorAll(\"item\");\n                for(let it of its){\n                    items.push(it);\n                }\n                        items.slice(0, limitPerFeed).forEach(item => {\n                            let elem = document.createElement(\"div\");\n                            let link = item.querySelector(\"link\").textContent;\n                            let title = item.querySelector(\"title\").textContent;\n                            let description = item.querySelector(\"description\").textContent.toString().replace(\/(<([^>]+)>)\/gi, \"\");\n                            let pubdate = item.querySelector(\"pubDate\").textContent;\n                            let de = item.getElementsByTagNameNS(\"*\", \"encoded\");\n                            let thumbnail;\n                            if(de.length < 1){\n                                thumbnail = getThumbnail(item.querySelector(\"description\").textContent);\n                            }else{\n                                thumbnail = getThumbnail(de.item(0).innerHTML.toString());\n                            }\n                            let ht = '<a href=\"' + link + '\" style=\"text-decoration: none\" target=\"_blank\">'+\n                                                    '<div class=\"feed-item\" style=\"margin: 10px;\">' +\n                                                    '<div class=\"item-thumbnail\" style=\"margin: 5px 10px 0 10px; float: left; position: relative; border: none; text-decoration: none; max-width: 100%;\">'+\n                                                    '    <img decoding=\"async\" style=\"height: ' + thumbnailHeight + 'px; width: ' + thumbnailWidth + 'px\" src=\"' + thumbnail + '\" alt=\"' + title + '\">'+\n                                                    '<\/div>'+\n                                                    '<div class=\"item-details\" style=\"margin: 10px\">'+\n                                                    '    <div class=\"item-title\" style=\"text-decoration: none; font-size: ' + titleSize + 'em; text-align: justify; color: ' + titleColor +'\">' + title + '<\/div>'+\n                                                    '    <div class=\"item-description\" style=\"text-decoration: none; font-size: ' + descriptionSize + 'em;text-align: justify; color: ' + descriptionColor + ';\">' + description + '<\/div>'+\n                                                    '    <div class=\"item-pubdate\" style=\"text-decoration: none; font-size: ' + pubdateSize + 'em; margin-top: 10px; color: ' + pudateColor + ';\">' + (new Date(pubdate)).toLocaleTimeString().substring(0, 5) +\" \"+ (new Date(pubdate)).toLocaleDateString() +'<\/div>'+\n                                                    '<\/div>'+\n                                                '<\/div>'+\n                                            '<\/a>';\n                            elem.innerHTML = ht;\n                            maindiv.appendChild(elem);\n                        })\n                    })\n            }\n            <\/script>\n        <\/div>\n\n\n<hr>","protected":false},"excerpt":{"rendered":"<p>Abdelilah930 Jan 19, 5:56 PM THIS IS A BREAK BETWEEN TWO RSS DISPLAYS<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"class_list":{"0":"post-48","1":"page","2":"type-page","3":"status-publish","5":"entry"},"_links":{"self":[{"href":"https:\/\/nowloop.com\/chicago-il\/wp-json\/wp\/v2\/pages\/48","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nowloop.com\/chicago-il\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/nowloop.com\/chicago-il\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/nowloop.com\/chicago-il\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nowloop.com\/chicago-il\/wp-json\/wp\/v2\/comments?post=48"}],"version-history":[{"count":6,"href":"https:\/\/nowloop.com\/chicago-il\/wp-json\/wp\/v2\/pages\/48\/revisions"}],"predecessor-version":[{"id":64,"href":"https:\/\/nowloop.com\/chicago-il\/wp-json\/wp\/v2\/pages\/48\/revisions\/64"}],"wp:attachment":[{"href":"https:\/\/nowloop.com\/chicago-il\/wp-json\/wp\/v2\/media?parent=48"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}