quaid / centos / centos.org

Forked from centos/centos.org 5 years ago
Clone

Blame static/assets/js/FeedEk.js

e8ec7a
/*
5c3e93
* FeedEk jQuery RSS/ATOM Feed Plugin v3.0 with YQL API
5c3e93
* http://jquery-plugins.net/FeedEk/FeedEk.html  https://github.com/enginkizil/FeedEk
5c3e93
* Author : Engin KIZIL http://www.enginkizil.com   
e8ec7a
*/
5c3e93

5c3e93
!function (a) { a.fn.FeedEk = function (b) { var g, c = a.extend({ MaxCount: 5, ShowDesc: !0, ShowPubDate: !0, DescCharacterLimit: 0, TitleLinkTarget: "_blank", DateFormat: "", DateFormatLang: "en" }, b), d = a(this).attr("id"), f = ""; if (a("#" + d).empty(), void 0 != c.FeedUrl) { a("#" + d).append(''); var h = 'SELECT channel.item FROM feednormalizer WHERE output="rss_2.0" AND url ="' + c.FeedUrl + '" LIMIT ' + c.MaxCount; a.ajax({ url: "https://query.yahooapis.com/v1/public/yql?q=" + encodeURIComponent(h) + "&format=json&diagnostics=false&callback=?", dataType: "json", success: function (b) { a("#" + d).empty(), b.query.results.rss instanceof Array || (b.query.results.rss = [b.query.results.rss]), a.each(b.query.results.rss, function (b, d) { if (f += '
  • ", c.ShowPubDate) { if (g = new Date(d.channel.item.pubDate), f += '
    ', a.trim(c.DateFormat).length > 0) try { moment.lang(c.DateFormatLang), f += moment(g).format(c.DateFormat) } catch (b) { f += g.toLocaleDateString() } else f += g.toLocaleDateString(); f += "
    " } c.ShowDesc && (f += '
    ', f += c.DescCharacterLimit > 0 && d.channel.item.description.length > c.DescCharacterLimit ? d.channel.item.description.substring(0, c.DescCharacterLimit) + "..." : d.channel.item.description, f += "
    ") }), a("#" + d).append('
      ' + f + "
    ") } }) } } }(jQuery);