Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Framework7 Feeds plugin brings easy RSS feeds integration into Framework7 app.

License

NotificationsYou must be signed in to change notification settings

framework7io/framework7-plugin-feeds

Repository files navigation

Framework7 Feeds Plugin

Framework7 Feeds plugin brings easy RSS feeds integration into Framework7 app.

Plugin comes with easy and powerful JS API to integrate and customize RSS feeds. But in most cases you will not need to use JavaScript at all.

Installation

Just grab plugin files fromdist/ folder or using npm:

npm install framework7-plugin-feeds

And link them to your app right AFTER Framework7's scripts and styles:

<link rel="stylesheet" href="path/to/framework7.min.css"><link rel="stylesheet" href="path/to/framework7.feeds.css">...<script src="path/to/framework7.min.js"></script><script src="path/to/framework7.feeds.js"></script>

Usage

Install & Enable Plugin

After you included plugin script file, you need to install plugin before you init app:

// install plugin to Framework7Framework7.use(Framework7Feeds);// init appvarapp=newFramework7({  ...})

ES Module

This plugin comes with ready to use ES module:

importFramework7from'framework7';importFramework7Feedsfrom'framework7-plugin-feeds';// install pluginFramework7.use(Framework7Feeds);// init appvarapp=newFramework7({  ...})

API

Plugin extends initiliazedapp instance with new methods:

  • app.feeds.create(parameters) - init Feeds. This method returns initialized Feeds instance.
  • app.feeds.get(feedsEl) - get Feeds instance by HTML element. Method returns initialized Feeds instance.
  • app.feeds.destroy(feedsEl) - destroy Feeds instance

Feeds Parameters

ParameterTypeDefaultDescription
elstring
HTMLElement
Target List Block element. In case of string - CSS selector of list block element where to put parsed feeds list.
feedUrlstringURL of RSS feed to parse and load
openInstringpageCould be `'page'` or `'popup'`. Defines how to open generated page of single feed item
formatDatefunction (date)Function to format RSS item date, this function should return string with formatted date
virtualListobject
boolean
falseObject withVirtual List parameters. If specified, then RSS feed will be loaded as Virtual List
customItemFieldsarray[]Array with additional item fields (xml tags) that also should be parsed from RSS, for example `['content:encoded', 'author']`. Such custom RSS tags with colon (:) will be parsed and available in template without colon, for example, the value of `content:encoded` tag will be available in templates as `contentencoded` property.
renderVirtualListItemfunction(item, index)Function to render virtual list item in case of enabled virtual list. Must return item HTML string
renderListfunction(data)Function to render feeds list. Must return list HTML string
renderItemPagefunction(item)Function to render single feeds item page. Must return page HTML string
renderItemPopupfunction(item)Function to render single feeds item popup. Must return popup HTML string
routableModalsbooleantrueWill add opened feeds item modal (when `openIn: 'popup'`) to router history which gives ability to close dynamic feeds item page by going back in router history and set current route to the feeds item modal
urlstringfeed/Feeds item URL that will be set as a current route url
viewobjectLink to initialized View instance which is required for Feeds to work. By default, if not specified, it will be opened in parent View
pageBackLinkTextstringBackFeeds item page back link text
popupCloseLinkTextstringCloseFeeds item popup close link text

Usage example with manual initialization:

<divclass="list my-feed"></div>
varfeed=app.feeds.create({el:'.my-feed',feedUrl:'http://path-to-rss.com/rss.xml',openIn:'popup'});

Automatic initialization

If you need minimal parser setup you may use automatic initialization without JavaScript at all. In this case you need to add additionalfeeds-init class to feeds container and specify all parameters from table above usingdata- attributes, for example:

<div data-feed-url="http://path-to-rss.com/rss.xml" data-open-in="popup"></div>

Feeds Events

EventTargetArgumentsDescription
ajaxStartfeeds(feeds)Event will be triggered when right before XHR request to specified feed url
feedsAjaxStartapp(feeds)Event will be triggered when right before XHR request to specified feed url
ajaxCompletefeeds(feeds, response)Event will be triggered when when XHR request completed
feedsAjaxCompleteapp(feeds)Event will be triggered when when XHR request completed
openfeeds(feeds)Event will be triggered when Feeds item starts its opening animation (page transiton on popup open transition)
feedsOpenapp(feeds)Event will be triggered when Feeds item starts its opening animation (page transiton on popup open transition)
openedfeeds(feeds)Event will be triggered after Feeds item completes its opening animation (page transiton on popup open transition)
feedsOpenedapp(feeds)Event will be triggered after Feeds item completes its opening animation (page transiton on popup open transition)
closefeeds(feeds)Event will be triggered when Feeds item starts its closing animation (page transiton on popup open transition)
feedsCloseapp(feeds)Event will be triggered when Feeds item starts its closing animation (page transiton on popup open transition)
closedfeeds(feeds)Event will be triggered after Feeds item completes its closing animation (page transiton on popup open transition)
feedsClosedapp(feeds)Event will be triggered after Feeds item completes its closing animation (page transiton on popup open transition)

Usage with Pull To Refresh

Feeds plugin fully compatible with Pull To Refresh component, and will automatically refresh feed on pull to refresh. No additional actions or code are required.

Demo

Plugin comes with demo example to see how it works and looks. To make demo works you need to run in terminal:

$ npm run prod

Contribute

All changes should be done only insrc/ folder. This project usesgulp to build a distributable version.

First you need to install all dependencies:

$ npm install

Then to build plugin's files for testing run:

$ npm run build:dev

If you need a local server while you developing you can run:

$ gulp server

or

$ npm run dev

And working demo will be available athttp://localhost:3000/demo/

Live Preview

https://framework7io.github.io/framework7-plugin-feeds/

About

Framework7 Feeds plugin brings easy RSS feeds integration into Framework7 app.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

    Packages

    No packages published

    Contributors2

    •  
    •  

    [8]ページ先頭

    ©2009-2025 Movatter.jp