Giter VIP home page Giter VIP logo

jquery-nicothumb's Introduction

NicoThumb

Yahoo!のYQLを使ってニコ動の動画情報を取得して表示します。

下記のjQueryプラグインを先に読み込んでから使ってください

Cross-domain requests with jQuery

使い方(How to use)

下記のファイルを読み込んでください。

  • jquery.nicothumb.js
<script type="text/javascript" src="jquery.nicothumb.js"></script>

jquery.xdomainajax.jsの後ろで読み込んでください。

基本的な使い方

$("#video_info").nicothumb({
	video_id: "sm9"
});

高度?な使い方

$(".info").nicothumb({
	video_id: "sm9",
	insert: false,
	callback: function (video_info){
		// コールバック
		console.log(video_info);
	}
});
$(".info").nicothumb({
	video_id: "sm9",
	template: "<h1>{title}</h1><img src='{thumbnail_url}' alt='サムネ'>"
});

オプション(Option)

キー 説明 初期値
video_id 動画ID sm9
insert htmlを挿入するか true
template 挿入するhtmlテンプレート テンプレートについてを参照
callback 取得後に実行されるメソッド function(){}

テンプレートについて

テンプレート内で使える変数っぽいやつです。

変数 説明
{title} 動画タイトル
{view_counter} 再生数
{comment_num} コメント数
{mylist_counter} マイリスト数
{length} 再生時間
{watch_url} 動画URL
{thumbnail_url} サムネイルURL

初期値

""
+ "<h1><a href=\"{watch_url}\">{title}</a></h1>"
+ "<a href=\"{watch_url}\">"
+ "<img src=\"{thumbnail_url}\" alt=\"サムネイル\">"
+ "</a>"
+ "<p>再生数: <span>{view_counter}</span></p>"
+ "<p>コメント数: <span>{comment_num}</span></p>"
+ "<p>マイリスト数: <span>{mylist_counter}</span></p>"
+ "<p>再生時間: <span>{length}</span></p>"

著者(Author)

Reona Oshima (totoraj)

ライセンス(License)

Copyright © 2015 Reona Oshima (totoraj)
This work is released under the MIT License.
http://opensource.org/licenses/mit-license.php

jquery-nicothumb's People

Contributors

totoraj930 avatar

Stargazers

kuruppa0616 avatar

Watchers

James Cloos avatar  avatar kuruppa0616 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.