{"id":44,"date":"2021-01-19T08:46:47","date_gmt":"2021-01-19T14:46:47","guid":{"rendered":"https:\/\/nowloop.com\/chicago-il\/?page_id=44"},"modified":"2021-01-19T08:49:45","modified_gmt":"2021-01-19T14:49:45","slug":"rss-display-code-by-abdelilah930jan-18-335-pm","status":"publish","type":"page","link":"https:\/\/nowloop.com\/chicago-il\/rss-display-code-by-abdelilah930jan-18-335-pm\/","title":{"rendered":"RSS DISPLAY CODE by Abdelilah930<br>Jan 18, 3:35 PM"},"content":{"rendered":"<p>WordPress webpage test<\/p>\n<p>Abdelilah930<br>\nJan 18, 3:35 PM<\/p>\n<p>hi hope you&#8217;re doing fine check the link http:\/\/localshopperusa.com\/fort-lauderdale-fl-shopping-coupons-savings-deals\/ i made it work i used the feeds from this link:<br>\nhttps:\/\/www.unilad.co.uk\/feed\/<br>\nto test it<\/p>\n<hr>\n\n\n<div id=\"rightside\" style=\"inline-grid\">\n    <script>\n        const url = \"https:\/\/www.unilad.co.uk\/feed\/\";\n        const maindiv = document.getElementById(\"rightside\");\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 = \"200\";\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        fetch(url)\n            .then(response => response.text())\n            .then(str => new window.DOMParser().parseFromString(str, \"text\/xml\"))\n            .then(data => {\n                let items = data.querySelectorAll(\"item\");\n                items.forEach(item => {\n                    let elem = document.createElement(\"div\");\n                    let link = item.querySelector(\"link\").innerHTML;\n                    let title = item.querySelector(\"title\").innerHTML;\n                    let description = item.querySelector(\"description\").textContent.toString().replace(\/(<([^>]+)>)\/gi, \"\");\n                    let pubdate = item.querySelector(\"pubDate\").innerHTML;\n                    let thumbnail = getThumbnail(item.getElementsByTagNameNS(\"*\", \"encoded\").item(0).innerHTML.toString());\n                    console.log(description)\n                    let ht = '<a href=\"' + link + '\" style=\"text-decoration: none\">'+\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            })\n        \n    <\/script>\n        \n        \n    \n    \n\n<\/div>\n<hr>\n\nEND OF RSS DISPLAY TEST\n","protected":false},"excerpt":{"rendered":"<p>WordPress webpage test Abdelilah930 Jan 18, 3:35 PM hi hope you&#8217;re doing fine check the link http:\/\/localshopperusa.com\/fort-lauderdale-fl-shopping-coupons-savings-deals\/ i made it work i used the feeds from this link: https:\/\/www.unilad.co.uk\/feed\/ to test it END OF RSS DISPLAY TEST<\/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":["post-44","page","type-page","status-publish","entry"],"_links":{"self":[{"href":"https:\/\/nowloop.com\/chicago-il\/wp-json\/wp\/v2\/pages\/44","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=44"}],"version-history":[{"count":2,"href":"https:\/\/nowloop.com\/chicago-il\/wp-json\/wp\/v2\/pages\/44\/revisions"}],"predecessor-version":[{"id":46,"href":"https:\/\/nowloop.com\/chicago-il\/wp-json\/wp\/v2\/pages\/44\/revisions\/46"}],"wp:attachment":[{"href":"https:\/\/nowloop.com\/chicago-il\/wp-json\/wp\/v2\/media?parent=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}