jquery.lifestream

2018-07-11 admin

jquery.lifestream是什么

什么是jquery.lifestream,Show a stream of your online activity.

jquery.lifestream介绍、jquery.lifestream使用

or<body>` tag of your HTML page.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="//rawgithub.com/christianvuerings/jquery-lifestream/master/jquery.lifestream.min.js"></script>
<script>
  $("#lifestream").lifestream({
    list:[
      {
        service: "github",
        user: "christianvuerings"
      },
      {
        service: "twitter",
        user: "christianvuer"
      }
    ]
  });
</script>

The above code will always use the latest version of the script. If you want to use it in production, download the minified or uncompressed file and host it yourself.

You also need to add a bit of HTML:

<div id="lifestream">&nbsp;</div>

jQuery Templates

You have the ability to use jQuery templates for your feed. Checkout the template page to see an overview of the current available templates.

Usage:

{
  service: 'deviantart',
  user: 'gabbyd70',
  template: {
    deviationpost: 'heeft hetvolgende gepost: <a href="${url}">${title}</a>'
  }
}

Configuration

The plug-in accepts one configuration JSON object:

$("#lifestream").lifestream({
  classname: "lifestream",
  feedloaded: feedcallback,
  limit: 30,
  list:[
    {
      service: "github",
      user: "christianvuerings"
    },
    {
      service: "twitter",
      user: "christianvuer"
    }
  ]
});

classname: The name of the main lifestream class. We use this for the main ul class e.g. lifestream and for the specific feeds e.g. lifestream-twitter

feedloaded: (function) A callback function which is triggered each time a feed was loaded.

limit: (integer) Specify how many elements you want in your lifestream (default = 10).

list: (array) Array containing other JSON objects with information about each item. Each item should have a service and a user. For more information about each service, check out the source code of the example page.

Commit to the project

Add your own feed

Adding in your own feed is pretty easy. Have a look at this commit which adds support for the last.fm feed.

Add your favicon

  1. Convert the favicon.ico of a site to a .png file. (e.g. http://google.com/favicon.ico)
  2. Optimize the .png file. Save it in src/favicons/.

How to commit?

  1. Push the finished code to your own remote repository.
  2. Send a pull request to christianvuerings/jquery-lifestream.

Code Style Guidelines

  • Indentation: 2 spaces
  • Max column width: 78 characters
  • Trailing spaces: not allowed
  • Always use curly brackets {} for if/else/for
  • Put all var statements in the beginning of a function
  • Use === & !== for comparing variables
  • Use the following spacing rules:
for (var i = 0, j = length; i 

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-35758.html

文章标题:jquery.lifestream

回到顶部