feature(contact) add

This commit is contained in:
coderaiser 2013-12-10 11:40:16 +00:00
parent 8da60a7b1e
commit bab6451339
5 changed files with 186 additions and 14 deletions

View file

@ -27,6 +27,7 @@
<button id=f9 class=cmd-button>F9 - menu</button>
<button id=f10 class=cmd-button>F10 - config</button>
<button id=~ class=cmd-button>~ - console</button>
<button id=contact class=cmd-button>contact</button>
</div>
<script>
(function() {

View file

@ -4,6 +4,7 @@
"view",
"help",
"config",
"contact",
"console", {
"name": "storage",
"data": [{

75
lib/client/contact.js Normal file
View file

@ -0,0 +1,75 @@
(function(CloudCmd, Util, DOM) {
'use strict';
CloudCmd.Contact = ContactProto;
function ContactProto(pCallBack) {
var Contact = this,
Images = DOM.Images,
Key = CloudCmd.Key,
Inited = false,
DIR = CloudCmd.LIBDIRCLIENT;
function init(pCallBack) {
if (!Inited) {
Contact.show = show;
Contact.hide = hide;
load(function() {
Inited = true;
olark('api.box.onExpand', Contact.show);
olark('api.box.onShow', Contact.show);
olark('api.box.onHide', Contact.hide);
olark('api.box.onShrink', Contact.hide);
DOM.Events.addKey(listener);
DOM.setButtonKey('contact', Contact.show);
Util.exec(pCallBack);
});
}
}
function load(callback) {
var path = DIR + 'contact/olark.js';
Images.showLoad({top: true});
DOM.jsload(path, function() {
Util.exec(callback);
});
}
function show() {
Key.unsetBind();
Images.hideLoad();
if (Inited)
olark('api.box.expand');
else
init(Contact.show);
}
function hide() {
Key.setBind();
if (Inited)
olark('api.box.hide');
else
init(Contact.hide);
}
function listener(pEvent) {
var ESC = Key.ESC,
isBind = Key.isBind(),
key = pEvent.keyCode;
if (!isBind && key === ESC)
Contact.hide();
}
init(pCallBack);
}
})(CloudCmd, Util, DOM);

View file

@ -0,0 +1,87 @@
window.olark || (function (c) {
var f = window,
d = document,
l = f.location.protocol == "https:" ? "https:" : "http:",
z = c.name,
r = "load";
var nt = function () {
f[z] = function () {
(a.s = a.s || []).push(arguments);
};
var a = f[z]._ = {}, q = c.methods.length;
while (q--) {
(function (n) {
f[z][n] = function () {
f[z]("call", n, arguments);
};
})(c.methods[q]);
}
a.l = c.loader;
a.i = nt;
a.p = {
0: +new Date()
};
a.P = function (u) {
a.p[u] = new Date() - a.p[0];
};
function s() {
a.P(r);
f[z](r);
}
f.addEventListener ? f.addEventListener(r, s, false) : f.attachEvent("on" + r, s);
var ld = function () {
function p(hd) {
hd = "head";
return ["<", hd, "></", hd, "><", i, ' onl' + 'oad="var d=', g, ";d.getElementsByTagName('head')[0].", j, "(d.", h, "('script')).", k, "='", l, "//", a.l, "'", '"', "></", i, ">"].join("");
}
var i = "body",
m = d[i];
if (!m) {
return setTimeout(ld, 100);
}
a.P(1);
var j = "appendChild",
h = "createElement",
k = "src",
n = d[h]("div"),
v = n[j](d[h](z)),
b = d[h]("iframe"),
g = "document",
e = "domain",
o;
n.style.display = "none";
m.insertBefore(n, m.firstChild).id = z;
b.frameBorder = "0";
b.id = z + "-loader";
if (/MSIE[ ]+6/.test(navigator.userAgent)) {
b.src = "javascript:false";
}
b.allowTransparency = "true";
v[j](b);
try {
b.contentWindow[g].open();
} catch (w) {
c[e] = d[e];
o = "javascript:var d=" + g + ".open();d.domain='" + d.domain + "';";
b[k] = o + "void(0);";
}
try {
var t = b.contentWindow[g];
t.write(p());
t.close();
} catch (x) {
b[k] = o + 'd.write("' + p().replace(/"/g, String.fromCharCode(92) + '"') + '");d.close();';
}
a.P(2);
};
ld();
};
nt();
})({
loader: "static.olark.com/jsclient/loader0.js",
name: "olark",
methods: ["configure", "extend", "declare", "identify"]
});
/* custom configuration goes here (www.olark.com/documentation) */
olark.identify('6216-545-10-4223');

View file

@ -38,7 +38,7 @@ var Util, DOM, CloudCmd;
};
this.initKeysPanel = function() {
var i, lButton, lEl,
var i, lButton, id, n, f,
lKeysPanel = {},
lFuncs =[
@ -52,24 +52,32 @@ var Util, DOM, CloudCmd;
DOM.promptNewDir, /* f7 */
DOM.promptDeleteSelected, /* f8 */
CloudCmd.Menu, /* f9 */
CloudCmd.Config, /* f10 */
CloudCmd.Config /* f10 */
];
for (i = 1; i <= 10; i++) {
lButton = 'f' + i,
lEl = DOM.getById('f' + i);
lKeysPanel[lButton] = lEl;
n = lFuncs.length;
for (i = 1; i <= n; i++) {
id = 'f' + i,
lButton = DOM.getById(id);
lKeysPanel[id] = lButton;
if (i === 1 || i === 3 || i === 4 || i === 9 || i === 10)
Events.addOnce('click', lFuncs[i], lEl);
else
Events.addClick(lFuncs[i], lEl);
if (lButton)
if (i === 1 || i === 3 || i === 4 || i === 9 || i === 10 || i === 12)
Events.addOnce('click', lFuncs[i], lButton);
else
Events.addClick(lFuncs[i], lButton);
}
lButton = '~',
lEl = DOM.getById('~');
lKeysPanel[lButton] = lEl;
Events.addOnce('click', CloudCmd.Console, lEl);
id = '~',
lButton = DOM.getById(id);
lKeysPanel[id] = lButton;
Events.addOnce('click', CloudCmd.Console, lButton);
id = 'contact',
lButton = DOM.getById(id);
lKeysPanel[id] = lButton;
Events.addOnce('click', CloudCmd.Contact, lButton);
return lKeysPanel;
};