JSFiddle - React, Tailwind, and code Playground
HTML
<div id="newsWidget">
<ul id="news"><li>Venligst vent ... laster inn !</li></ul>
</div>
CSS
body {
color: #333;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
text-align: center;
background : #fff;
}
#newsWidget {
text-align: left;
margin: 20px auto;
width: 750px;
/*border: 1px solid #cdcdcd;*/
padding: 10px;
color: #333
}
#newsWidget > ul {
margin: 0;
padding: 0;
list-style: none
}
#newsWidget ul li {
border: 3px solid #f2f2f2;
display: block;
margin: 10px 0 0;
padding: 10px 24px 16px 28px;
position: relative
}
#newsWidget h4 {
font-size: 17px;
color: #424242;
margin: 0;
padding: 10px 0 5px;
line-height: 22px
}
#newsWidget .description {
color: gray;
font-size: 11px;
line-height: 15px;
clear: both
}
#newsWidget .date,
#newsWidget .websiteTitle {
font-size: 10px;
font-style: italic;
line-height: 13px;
padding: 0 4px 24px 0;
display: block;
float: left
}
#newsWidget a:link,
#newsWidget a:active,
#newsWidget a:visited {
border-bottom: 1px solid #d8d8d8;
color: #333;
text-decoration: none
}
#newsWidget a:hover {
border-bottom-color: #333
}
.spacer {
clear: both;
height: 1px;
display: block
}
#newsWidget #news, #newsWidget #news > li {
margin: 0;
padding: 0;
}
#newsWidget #news > li {
border : none;
}
#newsWidget ul li ul {
position: relative;
top: 0;
margin: 0;
padding: 0 1%;
width: 25%;
//display:inline-block;
float:left;
}
JavaScript
(function($) {
"use strict"
$.fn.newswidget = function(options) {
var defaults = {
source: ['http://rss.news.yahoo.com/rss/us',
'http://rss.news.yahoo.com/rss/world',
'http://feeds.bbci.co.uk/news/rss.xml'
],
itemWrapElement: 'li',
itemTitleElement: 'h4',
linkTitle: false,
itemDescriptionElement: 'div',
itemDateElement: 'div',
itemLinkElement: 'span',
itemWebsiteTitleElement: 'div',
itemWebsiteLinkElement: 'div',
itemLinkText: 'read mores',
newPageLink: true,
proxyUrl: 'proxy.php',
limitDescription: 100,
limitDescriptionSuffix: "...",
limitItems: 10,
stripHtml: true,
prettyDate: true,
format: "title,description,date,link",
animationSpeed: 500,
random: true,
refresh: 0,
showFilter: function() {},
columns : 3,
columnElement : 'ul'
},
settings = $.extend({}, defaults, options),
newsHolder = this,
items = [],
busyRequests = 0,
timer;
if (settings.refresh > 0) clearTimeout(timer);
busyRequests = $.isArray(settings.source) ? settings.source.length : 1;
$.each($.isArray(settings.source) ? settings.source : [settings.source], function(_,item) {
load(item);
});
function cleanText(text) {
var cleanText = text;
var index = cleanText.indexOf('<?xml');
if (index > -1) {
cleanText = cleanText.substring(0, index);
}
var index = cleanText.indexOf('<div class="feedflare">');
if (index > -1) {
cleanText =...