npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-weibo

v1.6.0

Published

weibo plugin for cordova

Downloads

8

Readme

cordova-plugin-weibo

Cordova (PhoneGap) Plugin to connect to the native Weibo SDK

Installation

cordova plugins add cordova-plugin-weibo

iOS

1. 设置工程回调的 URL Types

info -> URL Types 添加:  
identifier: com.weibo  
URL schemes: wbYouAppkey (wb239283940)

2. 重写 AppDelegate.m

AppDelegate.m 在 Xcode 项目的 Classes 文件夹中

  • 在头部引入相关文件
#import "WeiboSDK.h"
#import "weibo.h"
  • 重写 AppDelegatehandleOpenURLopenURL 方法
    以前这两个方法有内容就直接添加如下方法中代码
- (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation
{
 	weibo *weiboPlugin = [self.viewController.pluginObjects objectForKey:@"weibo"];
    [WeiboSDK handleOpenURL:url delegate:weiboPlugin];

    return YES;
}

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
    [WeiboSDK handleOpenURL:url delegate:self ];
    
    return YES;
}

3. 对应用跳转的支持

如果你需要用到微博的相关功能,如登陆,分享等。并且需要实现跳转到微博的功能,在iOS9系统中就需要在你的app的plist中添加下列键值对。否则在canOpenURL函数执行时,就会返回NO。了解详情请至https://developer.apple.com/videos/wwdc/2015/?id=703

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>sinaweibohd</string>
    <string>sinaweibo</string>
    <string>weibosdk</string>
    <string>weibosdk2.5</string>
</array>

Android

Android 暂时无需修改任何配置或代码

JavaScript API

初始化 appKey 和 redirectURI

window.weibo.init(appKey, redirectURI, onSuccess, onFail)

微博 SSO 授权登录(未安装将使用 Web 授权)

window.weibo.login(onSuccess, onFail)

判断是否安装微博客户端

window.weibo.isInstalled(onSuccess, onFail)

分享图文信息到微博

window.weibo.share(args,onSuccess, onFail)

Quick Example

window.weibo.init('3281812343','http://www.example.com/callback.html');

$$('#wbLoginBtn').on('click',function(){
	window.weibo.login(function (res) {
	    console.log(res);
	});
})

$$('#wbShareBtn').on('click',function(){
    window.weibo.share({
        type: 'image',
        data: 'http://ww3.sinaimg.cn/large/77565b1bjw1eqd6s01q6ej20c80c80t4.jpg',
        text: 'test my plugin'
    },function(res){
        console.log(res);
    });
})

更详细的使用教程可 checkout example 目录代码替换 cordova 项目的 www 目录即可

License

Copyright (c) 2015 - 2016 Belin Chung. MIT Licensed, see LICENSE for details.