包括gmail.js [英] Including gmail.js
问题描述
我正在尝试在此处中添加gmail.js.
但是对象gmsrc
无效,函数get.user_email()
失败.
chrome开发人员工具(F12)告诉我,我正在尝试开发Chrome扩展程序
I'm trying to include gmail.js from here.
But the object gmsrc
is invalid, the function get.user_email()
fails.
I'm trying to develop a Chrome extention, the chrome developer tools (F12) tells me
未捕获的TypeError:无法读取未定义的属性'user_email'
Uncaught TypeError: Cannot read property 'user_email' of undefined
这是我的代码:
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js";
document.getElementsByTagName('body')[0].appendChild(jq);
var gmsrc = document.createElement('script');
gmsrc.src = "https://rawgit.com/KartikTalwar/gmail.js/master/src/gmail.js";
document.getElementsByTagName('body')[0].appendChild(gmsrc);
console.log("Scripts loaded, Start playing ...");
var name = gmsrc.get.user_email();
alert(name);
我的错误在哪里?
更新(仍然无法运行):
我尝试了这个,但是它也不起作用:
I tried this, but it doesnt work either:
var jq = document.createElement('script');
jq.src = chrome.extension.getURL("lib/jquery-2.1.1.min.js");
document.body.appendChild(jq)
//inject gmail.js
var gmsrc= document.createElement('script');
gmsrc.src = chrome.extension.getURL("lib/gmail.js");
document.body.appendChild(gmsrc);
var name = gmsrc.get.user_email();
alert(name);
推荐答案
Gmail.js是一个非常有用的框架,可作为mail.google.com网站的插件使用.您必须先从 https://github.com/josteink/gmailjs-node-样板按照自述文件并使用node.js创建Chrome扩展程序并使用它
Gmail.js is a framework very useful for work around mail.google.com website as a plugin. You have to build the project first from https://github.com/josteink/gmailjs-node-boilerplate follow the readme and using node.js create the Chrome extension and play with it
这篇关于包括gmail.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!