function doMatrixIntegration() {
doMainMenuIntegration(doc);
var i, labels = getLabels();
for (i = 0; i < labels.length; i++) { Unity.addAction('/' + labels[i].name, makeRedirector(labels[i].link));
}
}
function checkMessangesCount() {
var inboxLink = doc.evaluate('//div[@role="navigation"]/div/div/div/div/div/div/div/div/div/span/a', doc, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
var numMessanges = getNumber(inboxLink.text);
Unity.MessagingIndicator.clearIndicators();
Unity.MessagingIndicator.showIndicator(_("Inbox"), { count: numMessanges, callback: makeRedirector(inboxLink.href) });
var i, labels = getLabels();
for (i = 0; i < labels.length; i++) { Unity.MessagingIndicator.showIndicator(labels[i].name, { count: labels[i].count, callback: makeRedirector(labels[i].link) });
}
Unity.Launcher.setCount(Number(numMessanges));
}
function unityLoaded() {
var composeNewMessage = wrapCallback(function () {
var compose = doc.evaluate('//div[@role="navigation"]/div[1]/div[1]/div[1][@role="button"]', doc, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
click(compose);
});
Unity.MessagingIndicator.addAction(_("Compose New Message"), composeNewMessage);
Unity.Launcher.addAction(_("Compose New Message"), composeNewMessage);
In manifest.json I have this:
{"includes":["https://mail.google.com/*"],"requires":["utils.js","google-common.js"],"name":"GMail","scripts":["GMail.user.js"],"maintainer":"Webapps Team <email address hidden>","manifest-version":"1.0","integration-version":"2.2","package-name":"GMail","icons":{"128":"128/unity-webapps-gmail.png","48":"48/unity-webapps-gmail.png","52":"52/unity-webapps-gmail.png","64":"64/unity-webapps-gmail.png"},"domain":"mail.google.com","homepage":"https://mail.google.com","license":"GPL-3"}
Same here. Only OMG Ubuntu is working. And only in Firefox.
When I log in to my GMail in Firefox, I got this (in error console): Error in parsing value for 'display'. Declaration dropped.
In /usr/share/ unity-webapps/ userscripts/ webapps- gmail I have two files: GMail.user.js and manifest.json
In GMail.user.js I have this: /mail.google. com/*
// ==UserScript==
// @include https:/
// @require utils.js
// @require google-common.js
// ==/UserScript==
window.Unity = external. getUnityObject( 1);
var doc = null, pane = null;
function isCorrectPage() {
var i, ids = ['canvas_frame', 'hist_frame', 'js_frame'];
for (i = 0; i < ids.length; i++) { getElementById( ids[i]) ) {
if (!document.
return false;
}
}
return true;
}
function getNumber(str) { /\(([0- 9]|,)+\ )/)[0]. match(/ ([0-9]| ,)+/)[0] ;
try {
var onlyNumber = str.match(
return onlyNumber. replace( /,/g, "");
} catch (x) {
return '0';
}
}
function getLabels() {
var i, res = [];
var snapshot = doc.evaluate( '//div[ 2]/div/ div/div[ 5]/div/ */div/div/ div[2]/ span/a' ,
pane, null, XPathResult. UNORDERED_ NODE_SNAPSHOT_ TYPE, null);
for (i = 0; i < snapshot. snapshotLength; i++) { snapshotItem( i);
var node = snapshot.
res.push({ name: node.textConten t.match( /^[^(]+ /)[0],
count: getNumber( node.textConten t),
link: node.href });
}
return res;
}
function doMatrixIntegra tion() { ntegration( doc);
doMainMenuI
var i, labels = getLabels();
Unity. addAction( '/' + labels[i].name, makeRedirector( labels[ i].link) );
for (i = 0; i < labels.length; i++) {
}
}
function checkMessangesC ount() { '//div[ @role=" navigation" ]/div/div/ div/div/ div/div/ div/div/ div/span/ a', doc, null, XPathResult. ANY_UNORDERED_ NODE_TYPE, null).singleNod eValue; inboxLink. text);
var inboxLink = doc.evaluate(
var numMessanges = getNumber(
Unity. MessagingIndica tor.clearIndica tors();
Unity. MessagingIndica tor.showIndicat or(_("Inbox" ), { count: numMessanges,
callback: makeRedirector( inboxLink. href) });
Unity. MessagingIndica tor.showIndicat or(labels[ i].name, { count: labels[i].count,
callback: makeRedirector( labels[ i].link) }); Launcher. setCount( Number( numMessanges) );
var i, labels = getLabels();
for (i = 0; i < labels.length; i++) {
}
Unity.
}
function unityLoaded() { function () { '//div[ @role=" navigation" ]/div[1] /div[1] /div[1] [@role= "button" ]', doc, null, XPathResult. ANY_UNORDERED_ NODE_TYPE, null).singleNod eValue;
var composeNewMessage = wrapCallback(
var compose = doc.evaluate(
});
Unity. MessagingIndica tor.addAction( _("Compose New Message"),
composeNewM essage) ; Launcher. addAction( _("Compose New Message"),
composeNewMess age);
Unity.
setInterval (wrapCallback( checkMessangesC ount), 2000); gesCount( );
checkMessan
doMatrixInt egration( );
}
if (isCorrectPage()) { wrapCallback( function wait() { getElementById( 'canvas_ frame') .contentDocumen t;
setTimeout(
doc = document.
pane = doc.evaluate( '//div[ @role=" navigation" ]',
doc, null, XPathResult. ANY_UNORDERED_ NODE_TYPE, null).singleNod eValue;
if (!pane || !doc.getElement sByClassName( "nU")) {
setTimeout (wait, 1000); '//div[ @role=" navigation" ]/div/div[ 1]/div[ 3]/div/ ol/li[4] /div/div/ div/div[ 2]/span[ 2]', doc, null, XPathResult. ANY_UNORDERED_ NODE_TYPE, null).singleNod eValue. textContent;
return;
}
var login = doc.evaluate(
if (login.indexOf("@") === -1) {
login = "";
}
iconUrl: "icon:/
homepage: 'https:/
domain: 'mail.google.com',
}), 2000);
}
In manifest.json I have this: /mail.google. com/*"],"requires" :["utils. js","google- common. js"],"name" :"GMail" ,"scripts" :["GMail. user.js" ],"maintainer" :"Webapps Team <email address hidden> ","manifest- version" :"1.0", "integration- version" :"2.2", "package- name":" GMail", "icons" :{"128" :"128/unity- webapps- gmail.png" ,"48":" 48/unity- webapps- gmail.png" ,"52":" 52/unity- webapps- gmail.png" ,"64":" 64/unity- webapps- gmail.png" },"domain" :"mail. google. com","homepage" :"https:/ /mail.google. com","license" :"GPL-3" }
{"includes":["https:/