From 2673e745f48ca5f24b16bd1ae550ca457c594221 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 17 Oct 2018 12:28:23 +0300 Subject: [PATCH] feature(olark) bower -> npm --- .bowerrc | 3 -- bower.json | 33 --------------- client/modules/contact.js | 27 +----------- modules/olark/.bower.json | 26 ------------ modules/olark/README.md | 18 -------- modules/olark/bower.json | 19 --------- modules/olark/olark.js | 86 -------------------------------------- modules/olark/olark.min.js | 17 -------- package.json | 1 + 9 files changed, 3 insertions(+), 227 deletions(-) delete mode 100644 .bowerrc delete mode 100644 bower.json delete mode 100644 modules/olark/.bower.json delete mode 100644 modules/olark/README.md delete mode 100644 modules/olark/bower.json delete mode 100644 modules/olark/olark.js delete mode 100644 modules/olark/olark.min.js diff --git a/.bowerrc b/.bowerrc deleted file mode 100644 index 0ab1766a..00000000 --- a/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory" : "modules" -} \ No newline at end of file diff --git a/bower.json b/bower.json deleted file mode 100644 index c42f405e..00000000 --- a/bower.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "cloudcmd", - "homepage": "https://github.com/coderaiser/cloudcmd", - "authors": [ - "coderaiser " - ], - "description": "orthodox web file manager with console and editor", - "main": "bin/cloudcmd.js", - "keywords": [ - "console", - "editor", - "file", - "file manager", - "folder", - "orthodox", - "view", - "copy", - "rename", - "move", - "delete", - "file operation" - ], - "license": "MIT", - "private": true, - "ignore": [ - "node_modules", - "modules", - "test" - ], - "dependencies": { - "olark": "^1.0.0" - } -} diff --git a/client/modules/contact.js b/client/modules/contact.js index 0a4ac86d..0bd87725 100644 --- a/client/modules/contact.js +++ b/client/modules/contact.js @@ -1,15 +1,12 @@ /* global CloudCmd */ /* global DOM */ -/* global olark */ 'use strict'; CloudCmd.Contact = exports; -const {promisify} = require('es6-promisify'); - +const olark = require('@cloudcmd/olark'); const Images = require('../dom/images'); -const loadJS = promisify(require('load.js/legacy').js); const Events = DOM.Events; const Key = CloudCmd.Key; @@ -17,16 +14,8 @@ const Key = CloudCmd.Key; module.exports.show = show; module.exports.hide = hide; -let Inited = false; - -module.exports.init = async () => { - if (Inited) - return; - +module.exports.init = () => { Events.addKey(onKey); - await load(); - - Inited = true; olark.identify('6216-545-10-4223'); olark('api.box.onExpand', show); @@ -34,22 +23,10 @@ module.exports.init = async () => { olark('api.box.onShrink', hide); }; -const load = async () => { - const {PREFIX} = CloudCmd; - const path = `${PREFIX}/modules/olark/olark.min.js`; - - Images.show.load('top'); - - await loadJS(path); -}; - function show() { Key.unsetBind(); Images.hide(); - if (!Inited) - return; - olark('api.box.expand'); } diff --git a/modules/olark/.bower.json b/modules/olark/.bower.json deleted file mode 100644 index af66398d..00000000 --- a/modules/olark/.bower.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "olark", - "homepage": "https://github.com/cloudcmd/olark", - "authors": [ - "coderaiser " - ], - "description": "olark extension for chat", - "main": "olark.min.js", - "keywords": [ - "olark", - "chat" - ], - "license": "MIT", - "ignore": [], - "dependencies": {}, - "version": "1.0.0", - "_release": "1.0.0", - "_resolution": { - "type": "version", - "tag": "v1.0.0", - "commit": "fe00c4e0846a370aa0d5a7b73eb7c08020d18a35" - }, - "_source": "https://github.com/cloudcmd/olark.git", - "_target": "^1.0.0", - "_originalSource": "olark" -} \ No newline at end of file diff --git a/modules/olark/README.md b/modules/olark/README.md deleted file mode 100644 index 7607ccf7..00000000 --- a/modules/olark/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Olark - -Extracted instalation code for [olark](https://www.olark.com) to install via bower. - -## Install - -``` -bower i olark --save -``` - -## How to use? - -Add `olark.min.js` to your page and initialize olark with site id: - -```js -olark.identify('xxxx-xxx-xx-xxxx'); -``` - diff --git a/modules/olark/bower.json b/modules/olark/bower.json deleted file mode 100644 index 56936bba..00000000 --- a/modules/olark/bower.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "olark", - "homepage": "https://github.com/cloudcmd/olark", - "authors": [ - "coderaiser " - ], - "description": "olark extension for chat", - "main": "olark.min.js", - "keywords": [ - "olark", - "chat" - ], - "license": "MIT", - "ignore": [ - ], - "dependencies": { - } -} - diff --git a/modules/olark/olark.js b/modules/olark/olark.js deleted file mode 100644 index cf51c24c..00000000 --- a/modules/olark/olark.js +++ /dev/null @@ -1,86 +0,0 @@ -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, "><", i, ' onl' + 'oad="var d=', g, ";d.getElementsByTagName('head')[0].", j, "(d.", h, "('script')).", k, "='", l, "//", a.l, "'", '"', ">"].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"] -}); - diff --git a/modules/olark/olark.min.js b/modules/olark/olark.min.js deleted file mode 100644 index e6d5378f..00000000 --- a/modules/olark/olark.min.js +++ /dev/null @@ -1,17 +0,0 @@ -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,"><",i,' onl' + 'oad="var d=',g,";d.getElementsByTagName('head')[0].",j,"(d.",h,"('script')).",k,"='",l,"//",a.l,"'",'"',">"].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"]}); - diff --git a/package.json b/package.json index 7ad7db07..cbdd179b 100644 --- a/package.json +++ b/package.json @@ -167,6 +167,7 @@ "@cloudcmd/clipboard": "^1.0.2", "@cloudcmd/create-element": "^1.0.0", "@cloudcmd/modal": "^1.0.0", + "@cloudcmd/olark": "^2.0.1", "babel-loader": "^8.0.0", "babel-plugin-macros": "^2.2.1", "clean-css-loader": "^1.0.1",