小编iff*_*ffy的帖子

有没有办法*只*通过Google的OAuth2实施获取用户的电子邮件地址?

我的页面上有"使用Google+登录"按钮.当人们点击它时,我希望他们唯一授权的是"查看您的电子邮件地址".

想要"知道你是在谷歌谁"或"查看有关您的帐户的基本信息." 我想要他们的电子邮件地址.

我正在玩OAuth 2.0 Playground(https://developers.google.com/oauthplayground/)并看到这个:


范围: email

要求:

  1. 了解您在Google上的身份
  2. 查看您的电子邮件地址

范围:( https://www.googleapis.com/auth/userinfo.email 并且这个不推荐使用)

要求:

  1. 了解您在Google上的身份
  2. 查看您的电子邮件地址

oauth2-playground google-oauth

12
推荐指数
1
解决办法
1329
查看次数

在移动设备上,我如何"输入"在type ="number"输入中提交表单?

我正在使用AngularJS并且ng-submit像这样:

<form ng-submit="submit(foo); foo='';">
  <input type="number" ng-model="foo">
</form>
Run Code Online (Sandbox Code Playgroud)

在桌面计算机上的Chrome中,我可以在输入中按Enter键以提交表单(submit(foo)在这种情况下调用).

在Chrome for Android(KitKat)中,它不起作用.但是,如果我将输入更改为type="text"然后按"Go"时它起作用.

我怎样才能获得形式的行为像它的input type="text"input type="number"?我正在使用,type="number"因为我希望设备调出数字键盘.

这是一个说明问题的插件:http://plnkr.co/edit/4WJfdoKgXu7o6ZsM8WFx?p=preview (或http://goo.gl/IiQzGf,如果你在移动设备上).

编辑:

监听使用JavaScript进入并没有工作:http://plnkr.co/edit/07QGA1s4UCyop8IB8Dmx?p=preview

编辑2:

这不是AngularJS问题.这是一个HTML问题:http://embed.plnkr.co/ZVD0ZtmEutWZr7P7vq2b/preview

html javascript forms android google-chrome

7
推荐指数
1
解决办法
922
查看次数

如何使用 node-addon-api 保存回调以供稍后使用?

我希望我的 C 库能够多次调用 JS 函数。我使用 Nan 让它工作,但在将其转换为 N-API/node-addon-api 时遇到问题。

如何保存 JS 回调函数并稍后从 C 调用它?

这是我使用 Nan 得到的结果:

Persistent<Function> r_log;
void sendLogMessageToJS(char* msg) {
    if (!r_log.IsEmpty()) {
        Isolate* isolate = Isolate::GetCurrent();
        Local<Function> func = Local<Function>::New(isolate, r_log);
        if (!func.IsEmpty()) {
        const unsigned argc = 1;
        Local<Value> argv[argc] = {
            String::NewFromUtf8(isolate, msg)
        };
        func->Call(Null(isolate), argc, argv);
        }
    }
}
NAN_METHOD(register_logger) {
    Isolate* isolate = info.GetIsolate();
    if (info[0]->IsFunction()) {
        Local<Function> func = Local<Function>::Cast(info[0]);
        Function * ptr = *func;
        r_log.Reset(isolate, func);
        myclibrary_register_logger(sendLogMessageToJS);
    } else { …
Run Code Online (Sandbox Code Playgroud)

node.js node.js-addon n-api

5
推荐指数
1
解决办法
1245
查看次数

消除D3线图转换中的突然添加/删除

您可以在此处查看此代码:http://bl.ocks.org/2626142

此代码绘制折线图,​​然后在3个样本数据集之间转换.从小数据集移动到较大数据集时,突然出现额外数据点,而不是从现有行平滑展开.

当从较大的数据集移动到较小的数据集时,在转换以填充整个图表之前,该行突然被截断.

使用此代码,线和网格线会突然添加和删除.我该如何消除这些?

var data = [
    [0,2,3,2,8],
    [2,4,1,5,3],
];
var data2 = [
    [0,1,2,3,4,5],
    [9,8,7,6,5,6],
];
var data3 = [
    [1,3,2],
    [0,8,5],
];

var w = 300,
    h = 100;

var chart = d3.select('body').append('div')
    .attr('class', 'chart')
    .append('svg:svg')
    .attr('width', w)
    .attr('height', h);

var color = d3.scale.category10();

function drawdata(data, chart) {
    var num = data[0].length-1;
    var x = d3.scale.linear().domain([0, num]).range([0,w]);
    var y = d3.scale.linear().domain([0, 10]).range([h, 0]);

    var line = d3.svg.line()
        .x(function(d, i) { return x(i); })
        .y(function(d) …
Run Code Online (Sandbox Code Playgroud)

transition d3.js

3
推荐指数
1
解决办法
1562
查看次数

"帐户"是TypeScript中的保留字吗?

我很难过.以下TypeScript代码无法使用此错误进行编译:

fails.ts(10,7): error TS2420: Class 'Account' incorrectly implements interface 'IAccount'.
  Property 'name' is optional in type 'Account' but required in type 'IAccount'.
fails.ts(11,3): error TS2403: Subsequent variable declarations must have the same type.  Variable 'id' must be of type 'string', but here has type 'number'.
fails.ts(11,3): error TS2687: All declarations of 'id' must have identical modifiers.
fails.ts(14,3): error TS2687: All declarations of 'name' must have identical modifiers.
Run Code Online (Sandbox Code Playgroud)

但是,如果我重新命名 class Account,以class Hello它不会失败.我疯了吗?有没有其他人看到相同的行为?

interface IObject {
  id: number; …
Run Code Online (Sandbox Code Playgroud)

typescript

3
推荐指数
1
解决办法
468
查看次数

如何在Bootstrap 3中删除列填充以获得全宽输入?

如何摆脱Bootstrap 3列中的填充?

在下面的plunkr中,我想要按下按钮和文本输入:http://plnkr.co/edit/H5EIiCyiH8HbploTghVZ?p = preview 并为每个填充div的整个宽度.我希望他们没有左右填充.同样的"拉我左"和"我也是"div.

当我在我自己的CSS中覆盖padding-left时,它将所有内容拉到左侧,使"Jim"和"Hello"div的内容脱离屏幕.

有任何想法吗?

html css padding twitter-bootstrap twitter-bootstrap-3

2
推荐指数
1
解决办法
2万
查看次数