Version Description
- You now have full control of the fill and font color of your live chat box
- Added the ability to turn live chat on and off
- Better notification of incoming live chats.
- Added more localization support
- Plugin should now be compatible with caching plugins.
Download this release
Release Info
Developer | WP-LiveChat |
Plugin | WP Live Chat Support |
Version | 2.4 |
Comparing to | |
See all releases |
Code changes from version 2.3 to 2.4
- images/flash.ico +0 -0
- js/arrow.gif +0 -0
- js/cross.gif +0 -0
- js/hs.png +0 -0
- js/hv.png +0 -0
- js/jscolor.js +995 -0
- readme.txt +23 -16
- ring.wav +0 -0
- screenshot-1.JPG +0 -0
- screenshot-2.JPG +0 -0
- screenshot-3.JPG +0 -0
- wp-live-chat-support.php +91 -26
images/flash.ico
ADDED
Binary file
|
js/arrow.gif
ADDED
Binary file
|
js/cross.gif
ADDED
Binary file
|
js/hs.png
ADDED
Binary file
|
js/hv.png
ADDED
Binary file
|
js/jscolor.js
ADDED
@@ -0,0 +1,995 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* jscolor, JavaScript Color Picker
|
3 |
+
*
|
4 |
+
* @version 1.4.1
|
5 |
+
* @license GNU Lesser General Public License, http://www.gnu.org/copyleft/lesser.html
|
6 |
+
* @author Jan Odvarko, http://odvarko.cz
|
7 |
+
* @created 2008-06-15
|
8 |
+
* @updated 2013-04-08
|
9 |
+
* @link http://jscolor.com
|
10 |
+
*/
|
11 |
+
|
12 |
+
|
13 |
+
var jscolor = {
|
14 |
+
|
15 |
+
|
16 |
+
dir : '', // location of jscolor directory (leave empty to autodetect)
|
17 |
+
bindClass : 'color', // class name
|
18 |
+
binding : true, // automatic binding via <input class="...">
|
19 |
+
preloading : true, // use image preloading?
|
20 |
+
|
21 |
+
|
22 |
+
install : function() {
|
23 |
+
jscolor.addEvent(window, 'load', jscolor.init);
|
24 |
+
},
|
25 |
+
|
26 |
+
|
27 |
+
init : function() {
|
28 |
+
if(jscolor.binding) {
|
29 |
+
jscolor.bind();
|
30 |
+
}
|
31 |
+
if(jscolor.preloading) {
|
32 |
+
jscolor.preload();
|
33 |
+
}
|
34 |
+
},
|
35 |
+
|
36 |
+
|
37 |
+
getDir : function() {
|
38 |
+
if(!jscolor.dir) {
|
39 |
+
var detected = jscolor.detectDir();
|
40 |
+
jscolor.dir = detected!==false ? detected : 'jscolor/';
|
41 |
+
}
|
42 |
+
return jscolor.dir;
|
43 |
+
},
|
44 |
+
|
45 |
+
|
46 |
+
detectDir : function() {
|
47 |
+
var base = location.href;
|
48 |
+
|
49 |
+
var e = document.getElementsByTagName('base');
|
50 |
+
for(var i=0; i<e.length; i+=1) {
|
51 |
+
if(e[i].href) { base = e[i].href; }
|
52 |
+
}
|
53 |
+
|
54 |
+
var e = document.getElementsByTagName('script');
|
55 |
+
for(var i=0; i<e.length; i+=1) {
|
56 |
+
if(e[i].src && /(^|\/)jscolor\.js([?#].*)?$/i.test(e[i].src)) {
|
57 |
+
var src = new jscolor.URI(e[i].src);
|
58 |
+
var srcAbs = src.toAbsolute(base);
|
59 |
+
srcAbs.path = srcAbs.path.replace(/[^\/]+$/, ''); // remove filename
|
60 |
+
srcAbs.query = null;
|
61 |
+
srcAbs.fragment = null;
|
62 |
+
return srcAbs.toString();
|
63 |
+
}
|
64 |
+
}
|
65 |
+
return false;
|
66 |
+
},
|
67 |
+
|
68 |
+
|
69 |
+
bind : function() {
|
70 |
+
var matchClass = new RegExp('(^|\\s)('+jscolor.bindClass+')\\s*(\\{[^}]*\\})?', 'i');
|
71 |
+
var e = document.getElementsByTagName('input');
|
72 |
+
for(var i=0; i<e.length; i+=1) {
|
73 |
+
var m;
|
74 |
+
if(!e[i].color && e[i].className && (m = e[i].className.match(matchClass))) {
|
75 |
+
var prop = {};
|
76 |
+
if(m[3]) {
|
77 |
+
try {
|
78 |
+
prop = (new Function ('return (' + m[3] + ')'))();
|
79 |
+
} catch(eInvalidProp) {}
|
80 |
+
}
|
81 |
+
e[i].color = new jscolor.color(e[i], prop);
|
82 |
+
}
|
83 |
+
}
|
84 |
+
},
|
85 |
+
|
86 |
+
|
87 |
+
preload : function() {
|
88 |
+
for(var fn in jscolor.imgRequire) {
|
89 |
+
if(jscolor.imgRequire.hasOwnProperty(fn)) {
|
90 |
+
jscolor.loadImage(fn);
|
91 |
+
}
|
92 |
+
}
|
93 |
+
},
|
94 |
+
|
95 |
+
|
96 |
+
images : {
|
97 |
+
pad : [ 181, 101 ],
|
98 |
+
sld : [ 16, 101 ],
|
99 |
+
cross : [ 15, 15 ],
|
100 |
+
arrow : [ 7, 11 ]
|
101 |
+
},
|
102 |
+
|
103 |
+
|
104 |
+
imgRequire : {},
|
105 |
+
imgLoaded : {},
|
106 |
+
|
107 |
+
|
108 |
+
requireImage : function(filename) {
|
109 |
+
jscolor.imgRequire[filename] = true;
|
110 |
+
},
|
111 |
+
|
112 |
+
|
113 |
+
loadImage : function(filename) {
|
114 |
+
if(!jscolor.imgLoaded[filename]) {
|
115 |
+
jscolor.imgLoaded[filename] = new Image();
|
116 |
+
jscolor.imgLoaded[filename].src = jscolor.getDir()+filename;
|
117 |
+
}
|
118 |
+
},
|
119 |
+
|
120 |
+
|
121 |
+
fetchElement : function(mixed) {
|
122 |
+
return typeof mixed === 'string' ? document.getElementById(mixed) : mixed;
|
123 |
+
},
|
124 |
+
|
125 |
+
|
126 |
+
addEvent : function(el, evnt, func) {
|
127 |
+
if(el.addEventListener) {
|
128 |
+
el.addEventListener(evnt, func, false);
|
129 |
+
} else if(el.attachEvent) {
|
130 |
+
el.attachEvent('on'+evnt, func);
|
131 |
+
}
|
132 |
+
},
|
133 |
+
|
134 |
+
|
135 |
+
fireEvent : function(el, evnt) {
|
136 |
+
if(!el) {
|
137 |
+
return;
|
138 |
+
}
|
139 |
+
if(document.createEvent) {
|
140 |
+
var ev = document.createEvent('HTMLEvents');
|
141 |
+
ev.initEvent(evnt, true, true);
|
142 |
+
el.dispatchEvent(ev);
|
143 |
+
} else if(document.createEventObject) {
|
144 |
+
var ev = document.createEventObject();
|
145 |
+
el.fireEvent('on'+evnt, ev);
|
146 |
+
} else if(el['on'+evnt]) { // alternatively use the traditional event model (IE5)
|
147 |
+
el['on'+evnt]();
|
148 |
+
}
|
149 |
+
},
|
150 |
+
|
151 |
+
|
152 |
+
getElementPos : function(e) {
|
153 |
+
var e1=e, e2=e;
|
154 |
+
var x=0, y=0;
|
155 |
+
if(e1.offsetParent) {
|
156 |
+
do {
|
157 |
+
x += e1.offsetLeft;
|
158 |
+
y += e1.offsetTop;
|
159 |
+
} while(e1 = e1.offsetParent);
|
160 |
+
}
|
161 |
+
while((e2 = e2.parentNode) && e2.nodeName.toUpperCase() !== 'BODY') {
|
162 |
+
x -= e2.scrollLeft;
|
163 |
+
y -= e2.scrollTop;
|
164 |
+
}
|
165 |
+
return [x, y];
|
166 |
+
},
|
167 |
+
|
168 |
+
|
169 |
+
getElementSize : function(e) {
|
170 |
+
return [e.offsetWidth, e.offsetHeight];
|
171 |
+
},
|
172 |
+
|
173 |
+
|
174 |
+
getRelMousePos : function(e) {
|
175 |
+
var x = 0, y = 0;
|
176 |
+
if (!e) { e = window.event; }
|
177 |
+
if (typeof e.offsetX === 'number') {
|
178 |
+
x = e.offsetX;
|
179 |
+
y = e.offsetY;
|
180 |
+
} else if (typeof e.layerX === 'number') {
|
181 |
+
x = e.layerX;
|
182 |
+
y = e.layerY;
|
183 |
+
}
|
184 |
+
return { x: x, y: y };
|
185 |
+
},
|
186 |
+
|
187 |
+
|
188 |
+
getViewPos : function() {
|
189 |
+
if(typeof window.pageYOffset === 'number') {
|
190 |
+
return [window.pageXOffset, window.pageYOffset];
|
191 |
+
} else if(document.body && (document.body.scrollLeft || document.body.scrollTop)) {
|
192 |
+
return [document.body.scrollLeft, document.body.scrollTop];
|
193 |
+
} else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
|
194 |
+
return [document.documentElement.scrollLeft, document.documentElement.scrollTop];
|
195 |
+
} else {
|
196 |
+
return [0, 0];
|
197 |
+
}
|
198 |
+
},
|
199 |
+
|
200 |
+
|
201 |
+
getViewSize : function() {
|
202 |
+
if(typeof window.innerWidth === 'number') {
|
203 |
+
return [window.innerWidth, window.innerHeight];
|
204 |
+
} else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
|
205 |
+
return [document.body.clientWidth, document.body.clientHeight];
|
206 |
+
} else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
|
207 |
+
return [document.documentElement.clientWidth, document.documentElement.clientHeight];
|
208 |
+
} else {
|
209 |
+
return [0, 0];
|
210 |
+
}
|
211 |
+
},
|
212 |
+
|
213 |
+
|
214 |
+
URI : function(uri) { // See RFC3986
|
215 |
+
|
216 |
+
this.scheme = null;
|
217 |
+
this.authority = null;
|
218 |
+
this.path = '';
|
219 |
+
this.query = null;
|
220 |
+
this.fragment = null;
|
221 |
+
|
222 |
+
this.parse = function(uri) {
|
223 |
+
var m = uri.match(/^(([A-Za-z][0-9A-Za-z+.-]*)(:))?((\/\/)([^\/?#]*))?([^?#]*)((\?)([^#]*))?((#)(.*))?/);
|
224 |
+
this.scheme = m[3] ? m[2] : null;
|
225 |
+
this.authority = m[5] ? m[6] : null;
|
226 |
+
this.path = m[7];
|
227 |
+
this.query = m[9] ? m[10] : null;
|
228 |
+
this.fragment = m[12] ? m[13] : null;
|
229 |
+
return this;
|
230 |
+
};
|
231 |
+
|
232 |
+
this.toString = function() {
|
233 |
+
var result = '';
|
234 |
+
if(this.scheme !== null) { result = result + this.scheme + ':'; }
|
235 |
+
if(this.authority !== null) { result = result + '//' + this.authority; }
|
236 |
+
if(this.path !== null) { result = result + this.path; }
|
237 |
+
if(this.query !== null) { result = result + '?' + this.query; }
|
238 |
+
if(this.fragment !== null) { result = result + '#' + this.fragment; }
|
239 |
+
return result;
|
240 |
+
};
|
241 |
+
|
242 |
+
this.toAbsolute = function(base) {
|
243 |
+
var base = new jscolor.URI(base);
|
244 |
+
var r = this;
|
245 |
+
var t = new jscolor.URI;
|
246 |
+
|
247 |
+
if(base.scheme === null) { return false; }
|
248 |
+
|
249 |
+
if(r.scheme !== null && r.scheme.toLowerCase() === base.scheme.toLowerCase()) {
|
250 |
+
r.scheme = null;
|
251 |
+
}
|
252 |
+
|
253 |
+
if(r.scheme !== null) {
|
254 |
+
t.scheme = r.scheme;
|
255 |
+
t.authority = r.authority;
|
256 |
+
t.path = removeDotSegments(r.path);
|
257 |
+
t.query = r.query;
|
258 |
+
} else {
|
259 |
+
if(r.authority !== null) {
|
260 |
+
t.authority = r.authority;
|
261 |
+
t.path = removeDotSegments(r.path);
|
262 |
+
t.query = r.query;
|
263 |
+
} else {
|
264 |
+
if(r.path === '') {
|
265 |
+
t.path = base.path;
|
266 |
+
if(r.query !== null) {
|
267 |
+
t.query = r.query;
|
268 |
+
} else {
|
269 |
+
t.query = base.query;
|
270 |
+
}
|
271 |
+
} else {
|
272 |
+
if(r.path.substr(0,1) === '/') {
|
273 |
+
t.path = removeDotSegments(r.path);
|
274 |
+
} else {
|
275 |
+
if(base.authority !== null && base.path === '') {
|
276 |
+
t.path = '/'+r.path;
|
277 |
+
} else {
|
278 |
+
t.path = base.path.replace(/[^\/]+$/,'')+r.path;
|
279 |
+
}
|
280 |
+
t.path = removeDotSegments(t.path);
|
281 |
+
}
|
282 |
+
t.query = r.query;
|
283 |
+
}
|
284 |
+
t.authority = base.authority;
|
285 |
+
}
|
286 |
+
t.scheme = base.scheme;
|
287 |
+
}
|
288 |
+
t.fragment = r.fragment;
|
289 |
+
|
290 |
+
return t;
|
291 |
+
};
|
292 |
+
|
293 |
+
function removeDotSegments(path) {
|
294 |
+
var out = '';
|
295 |
+
while(path) {
|
296 |
+
if(path.substr(0,3)==='../' || path.substr(0,2)==='./') {
|
297 |
+
path = path.replace(/^\.+/,'').substr(1);
|
298 |
+
} else if(path.substr(0,3)==='/./' || path==='/.') {
|
299 |
+
path = '/'+path.substr(3);
|
300 |
+
} else if(path.substr(0,4)==='/../' || path==='/..') {
|
301 |
+
path = '/'+path.substr(4);
|
302 |
+
out = out.replace(/\/?[^\/]*$/, '');
|
303 |
+
} else if(path==='.' || path==='..') {
|
304 |
+
path = '';
|
305 |
+
} else {
|
306 |
+
var rm = path.match(/^\/?[^\/]*/)[0];
|
307 |
+
path = path.substr(rm.length);
|
308 |
+
out = out + rm;
|
309 |
+
}
|
310 |
+
}
|
311 |
+
return out;
|
312 |
+
}
|
313 |
+
|
314 |
+
if(uri) {
|
315 |
+
this.parse(uri);
|
316 |
+
}
|
317 |
+
|
318 |
+
},
|
319 |
+
|
320 |
+
|
321 |
+
//
|
322 |
+
// Usage example:
|
323 |
+
// var myColor = new jscolor.color(myInputElement)
|
324 |
+
//
|
325 |
+
|
326 |
+
color : function(target, prop) {
|
327 |
+
|
328 |
+
|
329 |
+
this.required = true; // refuse empty values?
|
330 |
+
this.adjust = true; // adjust value to uniform notation?
|
331 |
+
this.hash = false; // prefix color with # symbol?
|
332 |
+
this.caps = true; // uppercase?
|
333 |
+
this.slider = true; // show the value/saturation slider?
|
334 |
+
this.valueElement = target; // value holder
|
335 |
+
this.styleElement = target; // where to reflect current color
|
336 |
+
this.onImmediateChange = null; // onchange callback (can be either string or function)
|
337 |
+
this.hsv = [0, 0, 1]; // read-only 0-6, 0-1, 0-1
|
338 |
+
this.rgb = [1, 1, 1]; // read-only 0-1, 0-1, 0-1
|
339 |
+
this.minH = 0; // read-only 0-6
|
340 |
+
this.maxH = 6; // read-only 0-6
|
341 |
+
this.minS = 0; // read-only 0-1
|
342 |
+
this.maxS = 1; // read-only 0-1
|
343 |
+
this.minV = 0; // read-only 0-1
|
344 |
+
this.maxV = 1; // read-only 0-1
|
345 |
+
|
346 |
+
this.pickerOnfocus = true; // display picker on focus?
|
347 |
+
this.pickerMode = 'HSV'; // HSV | HVS
|
348 |
+
this.pickerPosition = 'bottom'; // left | right | top | bottom
|
349 |
+
this.pickerSmartPosition = true; // automatically adjust picker position when necessary
|
350 |
+
this.pickerButtonHeight = 20; // px
|
351 |
+
this.pickerClosable = false;
|
352 |
+
this.pickerCloseText = 'Close';
|
353 |
+
this.pickerButtonColor = 'ButtonText'; // px
|
354 |
+
this.pickerFace = 10; // px
|
355 |
+
this.pickerFaceColor = 'ThreeDFace'; // CSS color
|
356 |
+
this.pickerBorder = 1; // px
|
357 |
+
this.pickerBorderColor = 'ThreeDHighlight ThreeDShadow ThreeDShadow ThreeDHighlight'; // CSS color
|
358 |
+
this.pickerInset = 1; // px
|
359 |
+
this.pickerInsetColor = 'ThreeDShadow ThreeDHighlight ThreeDHighlight ThreeDShadow'; // CSS color
|
360 |
+
this.pickerZIndex = 10000;
|
361 |
+
|
362 |
+
|
363 |
+
for(var p in prop) {
|
364 |
+
if(prop.hasOwnProperty(p)) {
|
365 |
+
this[p] = prop[p];
|
366 |
+
}
|
367 |
+
}
|
368 |
+
|
369 |
+
|
370 |
+
this.hidePicker = function() {
|
371 |
+
if(isPickerOwner()) {
|
372 |
+
removePicker();
|
373 |
+
}
|
374 |
+
};
|
375 |
+
|
376 |
+
|
377 |
+
this.showPicker = function() {
|
378 |
+
if(!isPickerOwner()) {
|
379 |
+
var tp = jscolor.getElementPos(target); // target pos
|
380 |
+
var ts = jscolor.getElementSize(target); // target size
|
381 |
+
var vp = jscolor.getViewPos(); // view pos
|
382 |
+
var vs = jscolor.getViewSize(); // view size
|
383 |
+
var ps = getPickerDims(this); // picker size
|
384 |
+
var a, b, c;
|
385 |
+
switch(this.pickerPosition.toLowerCase()) {
|
386 |
+
case 'left': a=1; b=0; c=-1; break;
|
387 |
+
case 'right':a=1; b=0; c=1; break;
|
388 |
+
case 'top': a=0; b=1; c=-1; break;
|
389 |
+
default: a=0; b=1; c=1; break;
|
390 |
+
}
|
391 |
+
var l = (ts[b]+ps[b])/2;
|
392 |
+
|
393 |
+
// picker pos
|
394 |
+
if (!this.pickerSmartPosition) {
|
395 |
+
var pp = [
|
396 |
+
tp[a],
|
397 |
+
tp[b]+ts[b]-l+l*c
|
398 |
+
];
|
399 |
+
} else {
|
400 |
+
var pp = [
|
401 |
+
-vp[a]+tp[a]+ps[a] > vs[a] ?
|
402 |
+
(-vp[a]+tp[a]+ts[a]/2 > vs[a]/2 && tp[a]+ts[a]-ps[a] >= 0 ? tp[a]+ts[a]-ps[a] : tp[a]) :
|
403 |
+
tp[a],
|
404 |
+
-vp[b]+tp[b]+ts[b]+ps[b]-l+l*c > vs[b] ?
|
405 |
+
(-vp[b]+tp[b]+ts[b]/2 > vs[b]/2 && tp[b]+ts[b]-l-l*c >= 0 ? tp[b]+ts[b]-l-l*c : tp[b]+ts[b]-l+l*c) :
|
406 |
+
(tp[b]+ts[b]-l+l*c >= 0 ? tp[b]+ts[b]-l+l*c : tp[b]+ts[b]-l-l*c)
|
407 |
+
];
|
408 |
+
}
|
409 |
+
drawPicker(pp[a], pp[b]);
|
410 |
+
}
|
411 |
+
};
|
412 |
+
|
413 |
+
|
414 |
+
this.importColor = function() {
|
415 |
+
if(!valueElement) {
|
416 |
+
this.exportColor();
|
417 |
+
} else {
|
418 |
+
if(!this.adjust) {
|
419 |
+
if(!this.fromString(valueElement.value, leaveValue)) {
|
420 |
+
styleElement.style.backgroundImage = styleElement.jscStyle.backgroundImage;
|
421 |
+
styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
|
422 |
+
styleElement.style.color = styleElement.jscStyle.color;
|
423 |
+
this.exportColor(leaveValue | leaveStyle);
|
424 |
+
}
|
425 |
+
} else if(!this.required && /^\s*$/.test(valueElement.value)) {
|
426 |
+
valueElement.value = '';
|
427 |
+
styleElement.style.backgroundImage = styleElement.jscStyle.backgroundImage;
|
428 |
+
styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
|
429 |
+
styleElement.style.color = styleElement.jscStyle.color;
|
430 |
+
this.exportColor(leaveValue | leaveStyle);
|
431 |
+
|
432 |
+
} else if(this.fromString(valueElement.value)) {
|
433 |
+
// OK
|
434 |
+
} else {
|
435 |
+
this.exportColor();
|
436 |
+
}
|
437 |
+
}
|
438 |
+
};
|
439 |
+
|
440 |
+
|
441 |
+
this.exportColor = function(flags) {
|
442 |
+
if(!(flags & leaveValue) && valueElement) {
|
443 |
+
var value = this.toString();
|
444 |
+
if(this.caps) { value = value.toUpperCase(); }
|
445 |
+
if(this.hash) { value = '#'+value; }
|
446 |
+
valueElement.value = value;
|
447 |
+
}
|
448 |
+
if(!(flags & leaveStyle) && styleElement) {
|
449 |
+
styleElement.style.backgroundImage = "none";
|
450 |
+
styleElement.style.backgroundColor =
|
451 |
+
'#'+this.toString();
|
452 |
+
styleElement.style.color =
|
453 |
+
0.213 * this.rgb[0] +
|
454 |
+
0.715 * this.rgb[1] +
|
455 |
+
0.072 * this.rgb[2]
|
456 |
+
< 0.5 ? '#FFF' : '#000';
|
457 |
+
}
|
458 |
+
if(!(flags & leavePad) && isPickerOwner()) {
|
459 |
+
redrawPad();
|
460 |
+
}
|
461 |
+
if(!(flags & leaveSld) && isPickerOwner()) {
|
462 |
+
redrawSld();
|
463 |
+
}
|
464 |
+
};
|
465 |
+
|
466 |
+
|
467 |
+
this.fromHSV = function(h, s, v, flags) { // null = don't change
|
468 |
+
if(h !== null) { h = Math.max(0.0, this.minH, Math.min(6.0, this.maxH, h)); }
|
469 |
+
if(s !== null) { s = Math.max(0.0, this.minS, Math.min(1.0, this.maxS, s)); }
|
470 |
+
if(v !== null) { v = Math.max(0.0, this.minV, Math.min(1.0, this.maxV, v)); }
|
471 |
+
|
472 |
+
this.rgb = HSV_RGB(
|
473 |
+
h===null ? this.hsv[0] : (this.hsv[0]=h),
|
474 |
+
s===null ? this.hsv[1] : (this.hsv[1]=s),
|
475 |
+
v===null ? this.hsv[2] : (this.hsv[2]=v)
|
476 |
+
);
|
477 |
+
|
478 |
+
this.exportColor(flags);
|
479 |
+
};
|
480 |
+
|
481 |
+
|
482 |
+
this.fromRGB = function(r, g, b, flags) { // null = don't change
|
483 |
+
if(r !== null) { r = Math.max(0.0, Math.min(1.0, r)); }
|
484 |
+
if(g !== null) { g = Math.max(0.0, Math.min(1.0, g)); }
|
485 |
+
if(b !== null) { b = Math.max(0.0, Math.min(1.0, b)); }
|
486 |
+
|
487 |
+
var hsv = RGB_HSV(
|
488 |
+
r===null ? this.rgb[0] : r,
|
489 |
+
g===null ? this.rgb[1] : g,
|
490 |
+
b===null ? this.rgb[2] : b
|
491 |
+
);
|
492 |
+
if(hsv[0] !== null) {
|
493 |
+
this.hsv[0] = Math.max(0.0, this.minH, Math.min(6.0, this.maxH, hsv[0]));
|
494 |
+
}
|
495 |
+
if(hsv[2] !== 0) {
|
496 |
+
this.hsv[1] = hsv[1]===null ? null : Math.max(0.0, this.minS, Math.min(1.0, this.maxS, hsv[1]));
|
497 |
+
}
|
498 |
+
this.hsv[2] = hsv[2]===null ? null : Math.max(0.0, this.minV, Math.min(1.0, this.maxV, hsv[2]));
|
499 |
+
|
500 |
+
// update RGB according to final HSV, as some values might be trimmed
|
501 |
+
var rgb = HSV_RGB(this.hsv[0], this.hsv[1], this.hsv[2]);
|
502 |
+
this.rgb[0] = rgb[0];
|
503 |
+
this.rgb[1] = rgb[1];
|
504 |
+
this.rgb[2] = rgb[2];
|
505 |
+
|
506 |
+
this.exportColor(flags);
|
507 |
+
};
|
508 |
+
|
509 |
+
|
510 |
+
this.fromString = function(hex, flags) {
|
511 |
+
var m = hex.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i);
|
512 |
+
if(!m) {
|
513 |
+
return false;
|
514 |
+
} else {
|
515 |
+
if(m[1].length === 6) { // 6-char notation
|
516 |
+
this.fromRGB(
|
517 |
+
parseInt(m[1].substr(0,2),16) / 255,
|
518 |
+
parseInt(m[1].substr(2,2),16) / 255,
|
519 |
+
parseInt(m[1].substr(4,2),16) / 255,
|
520 |
+
flags
|
521 |
+
);
|
522 |
+
} else { // 3-char notation
|
523 |
+
this.fromRGB(
|
524 |
+
parseInt(m[1].charAt(0)+m[1].charAt(0),16) / 255,
|
525 |
+
parseInt(m[1].charAt(1)+m[1].charAt(1),16) / 255,
|
526 |
+
parseInt(m[1].charAt(2)+m[1].charAt(2),16) / 255,
|
527 |
+
flags
|
528 |
+
);
|
529 |
+
}
|
530 |
+
return true;
|
531 |
+
}
|
532 |
+
};
|
533 |
+
|
534 |
+
|
535 |
+
this.toString = function() {
|
536 |
+
return (
|
537 |
+
(0x100 | Math.round(255*this.rgb[0])).toString(16).substr(1) +
|
538 |
+
(0x100 | Math.round(255*this.rgb[1])).toString(16).substr(1) +
|
539 |
+
(0x100 | Math.round(255*this.rgb[2])).toString(16).substr(1)
|
540 |
+
);
|
541 |
+
};
|
542 |
+
|
543 |
+
|
544 |
+
function RGB_HSV(r, g, b) {
|
545 |
+
var n = Math.min(Math.min(r,g),b);
|
546 |
+
var v = Math.max(Math.max(r,g),b);
|
547 |
+
var m = v - n;
|
548 |
+
if(m === 0) { return [ null, 0, v ]; }
|
549 |
+
var h = r===n ? 3+(b-g)/m : (g===n ? 5+(r-b)/m : 1+(g-r)/m);
|
550 |
+
return [ h===6?0:h, m/v, v ];
|
551 |
+
}
|
552 |
+
|
553 |
+
|
554 |
+
function HSV_RGB(h, s, v) {
|
555 |
+
if(h === null) { return [ v, v, v ]; }
|
556 |
+
var i = Math.floor(h);
|
557 |
+
var f = i%2 ? h-i : 1-(h-i);
|
558 |
+
var m = v * (1 - s);
|
559 |
+
var n = v * (1 - s*f);
|
560 |
+
switch(i) {
|
561 |
+
case 6:
|
562 |
+
case 0: return [v,n,m];
|
563 |
+
case 1: return [n,v,m];
|
564 |
+
case 2: return [m,v,n];
|
565 |
+
case 3: return [m,n,v];
|
566 |
+
case 4: return [n,m,v];
|
567 |
+
case 5: return [v,m,n];
|
568 |
+
}
|
569 |
+
}
|
570 |
+
|
571 |
+
|
572 |
+
function removePicker() {
|
573 |
+
delete jscolor.picker.owner;
|
574 |
+
document.getElementsByTagName('body')[0].removeChild(jscolor.picker.boxB);
|
575 |
+
}
|
576 |
+
|
577 |
+
|
578 |
+
function drawPicker(x, y) {
|
579 |
+
if(!jscolor.picker) {
|
580 |
+
jscolor.picker = {
|
581 |
+
box : document.createElement('div'),
|
582 |
+
boxB : document.createElement('div'),
|
583 |
+
pad : document.createElement('div'),
|
584 |
+
padB : document.createElement('div'),
|
585 |
+
padM : document.createElement('div'),
|
586 |
+
sld : document.createElement('div'),
|
587 |
+
sldB : document.createElement('div'),
|
588 |
+
sldM : document.createElement('div'),
|
589 |
+
btn : document.createElement('div'),
|
590 |
+
btnS : document.createElement('span'),
|
591 |
+
btnT : document.createTextNode(THIS.pickerCloseText)
|
592 |
+
};
|
593 |
+
for(var i=0,segSize=4; i<jscolor.images.sld[1]; i+=segSize) {
|
594 |
+
var seg = document.createElement('div');
|
595 |
+
seg.style.height = segSize+'px';
|
596 |
+
seg.style.fontSize = '1px';
|
597 |
+
seg.style.lineHeight = '0';
|
598 |
+
jscolor.picker.sld.appendChild(seg);
|
599 |
+
}
|
600 |
+
jscolor.picker.sldB.appendChild(jscolor.picker.sld);
|
601 |
+
jscolor.picker.box.appendChild(jscolor.picker.sldB);
|
602 |
+
jscolor.picker.box.appendChild(jscolor.picker.sldM);
|
603 |
+
jscolor.picker.padB.appendChild(jscolor.picker.pad);
|
604 |
+
jscolor.picker.box.appendChild(jscolor.picker.padB);
|
605 |
+
jscolor.picker.box.appendChild(jscolor.picker.padM);
|
606 |
+
jscolor.picker.btnS.appendChild(jscolor.picker.btnT);
|
607 |
+
jscolor.picker.btn.appendChild(jscolor.picker.btnS);
|
608 |
+
jscolor.picker.box.appendChild(jscolor.picker.btn);
|
609 |
+
jscolor.picker.boxB.appendChild(jscolor.picker.box);
|
610 |
+
}
|
611 |
+
|
612 |
+
var p = jscolor.picker;
|
613 |
+
|
614 |
+
// controls interaction
|
615 |
+
p.box.onmouseup =
|
616 |
+
p.box.onmouseout = function() { target.focus(); };
|
617 |
+
p.box.onmousedown = function() { abortBlur=true; };
|
618 |
+
p.box.onmousemove = function(e) {
|
619 |
+
if (holdPad || holdSld) {
|
620 |
+
holdPad && setPad(e);
|
621 |
+
holdSld && setSld(e);
|
622 |
+
if (document.selection) {
|
623 |
+
document.selection.empty();
|
624 |
+
} else if (window.getSelection) {
|
625 |
+
window.getSelection().removeAllRanges();
|
626 |
+
}
|
627 |
+
dispatchImmediateChange();
|
628 |
+
}
|
629 |
+
};
|
630 |
+
if('ontouchstart' in window) { // if touch device
|
631 |
+
p.box.addEventListener('touchmove', function(e) {
|
632 |
+
var event={
|
633 |
+
'offsetX': e.touches[0].pageX-touchOffset.X,
|
634 |
+
'offsetY': e.touches[0].pageY-touchOffset.Y
|
635 |
+
};
|
636 |
+
if (holdPad || holdSld) {
|
637 |
+
holdPad && setPad(event);
|
638 |
+
holdSld && setSld(event);
|
639 |
+
dispatchImmediateChange();
|
640 |
+
}
|
641 |
+
e.stopPropagation(); // prevent move "view" on broswer
|
642 |
+
e.preventDefault(); // prevent Default - Android Fix (else android generated only 1-2 touchmove events)
|
643 |
+
}, false);
|
644 |
+
}
|
645 |
+
p.padM.onmouseup =
|
646 |
+
p.padM.onmouseout = function() { if(holdPad) { holdPad=false; jscolor.fireEvent(valueElement,'change'); } };
|
647 |
+
p.padM.onmousedown = function(e) {
|
648 |
+
// if the slider is at the bottom, move it up
|
649 |
+
switch(modeID) {
|
650 |
+
case 0: if (THIS.hsv[2] === 0) { THIS.fromHSV(null, null, 1.0); }; break;
|
651 |
+
case 1: if (THIS.hsv[1] === 0) { THIS.fromHSV(null, 1.0, null); }; break;
|
652 |
+
}
|
653 |
+
holdSld=false;
|
654 |
+
holdPad=true;
|
655 |
+
setPad(e);
|
656 |
+
dispatchImmediateChange();
|
657 |
+
};
|
658 |
+
if('ontouchstart' in window) {
|
659 |
+
p.padM.addEventListener('touchstart', function(e) {
|
660 |
+
touchOffset={
|
661 |
+
'X': e.target.offsetParent.offsetLeft,
|
662 |
+
'Y': e.target.offsetParent.offsetTop
|
663 |
+
};
|
664 |
+
this.onmousedown({
|
665 |
+
'offsetX':e.touches[0].pageX-touchOffset.X,
|
666 |
+
'offsetY':e.touches[0].pageY-touchOffset.Y
|
667 |
+
});
|
668 |
+
});
|
669 |
+
}
|
670 |
+
p.sldM.onmouseup =
|
671 |
+
p.sldM.onmouseout = function() { if(holdSld) { holdSld=false; jscolor.fireEvent(valueElement,'change'); } };
|
672 |
+
p.sldM.onmousedown = function(e) {
|
673 |
+
holdPad=false;
|
674 |
+
holdSld=true;
|
675 |
+
setSld(e);
|
676 |
+
dispatchImmediateChange();
|
677 |
+
};
|
678 |
+
if('ontouchstart' in window) {
|
679 |
+
p.sldM.addEventListener('touchstart', function(e) {
|
680 |
+
touchOffset={
|
681 |
+
'X': e.target.offsetParent.offsetLeft,
|
682 |
+
'Y': e.target.offsetParent.offsetTop
|
683 |
+
};
|
684 |
+
this.onmousedown({
|
685 |
+
'offsetX':e.touches[0].pageX-touchOffset.X,
|
686 |
+
'offsetY':e.touches[0].pageY-touchOffset.Y
|
687 |
+
});
|
688 |
+
});
|
689 |
+
}
|
690 |
+
|
691 |
+
// picker
|
692 |
+
var dims = getPickerDims(THIS);
|
693 |
+
p.box.style.width = dims[0] + 'px';
|
694 |
+
p.box.style.height = dims[1] + 'px';
|
695 |
+
|
696 |
+
// picker border
|
697 |
+
p.boxB.style.position = 'absolute';
|
698 |
+
p.boxB.style.clear = 'both';
|
699 |
+
p.boxB.style.left = x+'px';
|
700 |
+
p.boxB.style.top = y+'px';
|
701 |
+
p.boxB.style.zIndex = THIS.pickerZIndex;
|
702 |
+
p.boxB.style.border = THIS.pickerBorder+'px solid';
|
703 |
+
p.boxB.style.borderColor = THIS.pickerBorderColor;
|
704 |
+
p.boxB.style.background = THIS.pickerFaceColor;
|
705 |
+
|
706 |
+
// pad image
|
707 |
+
p.pad.style.width = jscolor.images.pad[0]+'px';
|
708 |
+
p.pad.style.height = jscolor.images.pad[1]+'px';
|
709 |
+
|
710 |
+
// pad border
|
711 |
+
p.padB.style.position = 'absolute';
|
712 |
+
p.padB.style.left = THIS.pickerFace+'px';
|
713 |
+
p.padB.style.top = THIS.pickerFace+'px';
|
714 |
+
p.padB.style.border = THIS.pickerInset+'px solid';
|
715 |
+
p.padB.style.borderColor = THIS.pickerInsetColor;
|
716 |
+
|
717 |
+
// pad mouse area
|
718 |
+
p.padM.style.position = 'absolute';
|
719 |
+
p.padM.style.left = '0';
|
720 |
+
p.padM.style.top = '0';
|
721 |
+
p.padM.style.width = THIS.pickerFace + 2*THIS.pickerInset + jscolor.images.pad[0] + jscolor.images.arrow[0] + 'px';
|
722 |
+
p.padM.style.height = p.box.style.height;
|
723 |
+
p.padM.style.cursor = 'crosshair';
|
724 |
+
|
725 |
+
// slider image
|
726 |
+
p.sld.style.overflow = 'hidden';
|
727 |
+
p.sld.style.width = jscolor.images.sld[0]+'px';
|
728 |
+
p.sld.style.height = jscolor.images.sld[1]+'px';
|
729 |
+
|
730 |
+
// slider border
|
731 |
+
p.sldB.style.display = THIS.slider ? 'block' : 'none';
|
732 |
+
p.sldB.style.position = 'absolute';
|
733 |
+
p.sldB.style.right = THIS.pickerFace+'px';
|
734 |
+
p.sldB.style.top = THIS.pickerFace+'px';
|
735 |
+
p.sldB.style.border = THIS.pickerInset+'px solid';
|
736 |
+
p.sldB.style.borderColor = THIS.pickerInsetColor;
|
737 |
+
|
738 |
+
// slider mouse area
|
739 |
+
p.sldM.style.display = THIS.slider ? 'block' : 'none';
|
740 |
+
p.sldM.style.position = 'absolute';
|
741 |
+
p.sldM.style.right = '0';
|
742 |
+
p.sldM.style.top = '0';
|
743 |
+
p.sldM.style.width = jscolor.images.sld[0] + jscolor.images.arrow[0] + THIS.pickerFace + 2*THIS.pickerInset + 'px';
|
744 |
+
p.sldM.style.height = p.box.style.height;
|
745 |
+
try {
|
746 |
+
p.sldM.style.cursor = 'pointer';
|
747 |
+
} catch(eOldIE) {
|
748 |
+
p.sldM.style.cursor = 'hand';
|
749 |
+
}
|
750 |
+
|
751 |
+
// "close" button
|
752 |
+
function setBtnBorder() {
|
753 |
+
var insetColors = THIS.pickerInsetColor.split(/\s+/);
|
754 |
+
var pickerOutsetColor = insetColors.length < 2 ? insetColors[0] : insetColors[1] + ' ' + insetColors[0] + ' ' + insetColors[0] + ' ' + insetColors[1];
|
755 |
+
p.btn.style.borderColor = pickerOutsetColor;
|
756 |
+
}
|
757 |
+
p.btn.style.display = THIS.pickerClosable ? 'block' : 'none';
|
758 |
+
p.btn.style.position = 'absolute';
|
759 |
+
p.btn.style.left = THIS.pickerFace + 'px';
|
760 |
+
p.btn.style.bottom = THIS.pickerFace + 'px';
|
761 |
+
p.btn.style.padding = '0 15px';
|
762 |
+
p.btn.style.height = '18px';
|
763 |
+
p.btn.style.border = THIS.pickerInset + 'px solid';
|
764 |
+
setBtnBorder();
|
765 |
+
p.btn.style.color = THIS.pickerButtonColor;
|
766 |
+
p.btn.style.font = '12px sans-serif';
|
767 |
+
p.btn.style.textAlign = 'center';
|
768 |
+
try {
|
769 |
+
p.btn.style.cursor = 'pointer';
|
770 |
+
} catch(eOldIE) {
|
771 |
+
p.btn.style.cursor = 'hand';
|
772 |
+
}
|
773 |
+
p.btn.onmousedown = function () {
|
774 |
+
THIS.hidePicker();
|
775 |
+
};
|
776 |
+
p.btnS.style.lineHeight = p.btn.style.height;
|
777 |
+
|
778 |
+
// load images in optimal order
|
779 |
+
switch(modeID) {
|
780 |
+
case 0: var padImg = 'hs.png'; break;
|
781 |
+
case 1: var padImg = 'hv.png'; break;
|
782 |
+
}
|
783 |
+
p.padM.style.backgroundImage = "url('"+jscolor.getDir()+"cross.gif')";
|
784 |
+
p.padM.style.backgroundRepeat = "no-repeat";
|
785 |
+
p.sldM.style.backgroundImage = "url('"+jscolor.getDir()+"arrow.gif')";
|
786 |
+
p.sldM.style.backgroundRepeat = "no-repeat";
|
787 |
+
p.pad.style.backgroundImage = "url('"+jscolor.getDir()+padImg+"')";
|
788 |
+
p.pad.style.backgroundRepeat = "no-repeat";
|
789 |
+
p.pad.style.backgroundPosition = "0 0";
|
790 |
+
|
791 |
+
// place pointers
|
792 |
+
redrawPad();
|
793 |
+
redrawSld();
|
794 |
+
|
795 |
+
jscolor.picker.owner = THIS;
|
796 |
+
document.getElementsByTagName('body')[0].appendChild(p.boxB);
|
797 |
+
}
|
798 |
+
|
799 |
+
|
800 |
+
function getPickerDims(o) {
|
801 |
+
var dims = [
|
802 |
+
2*o.pickerInset + 2*o.pickerFace + jscolor.images.pad[0] +
|
803 |
+
(o.slider ? 2*o.pickerInset + 2*jscolor.images.arrow[0] + jscolor.images.sld[0] : 0),
|
804 |
+
o.pickerClosable ?
|
805 |
+
4*o.pickerInset + 3*o.pickerFace + jscolor.images.pad[1] + o.pickerButtonHeight :
|
806 |
+
2*o.pickerInset + 2*o.pickerFace + jscolor.images.pad[1]
|
807 |
+
];
|
808 |
+
return dims;
|
809 |
+
}
|
810 |
+
|
811 |
+
|
812 |
+
function redrawPad() {
|
813 |
+
// redraw the pad pointer
|
814 |
+
switch(modeID) {
|
815 |
+
case 0: var yComponent = 1; break;
|
816 |
+
case 1: var yComponent = 2; break;
|
817 |
+
}
|
818 |
+
var x = Math.round((THIS.hsv[0]/6) * (jscolor.images.pad[0]-1));
|
819 |
+
var y = Math.round((1-THIS.hsv[yComponent]) * (jscolor.images.pad[1]-1));
|
820 |
+
jscolor.picker.padM.style.backgroundPosition =
|
821 |
+
(THIS.pickerFace+THIS.pickerInset+x - Math.floor(jscolor.images.cross[0]/2)) + 'px ' +
|
822 |
+
(THIS.pickerFace+THIS.pickerInset+y - Math.floor(jscolor.images.cross[1]/2)) + 'px';
|
823 |
+
|
824 |
+
// redraw the slider image
|
825 |
+
var seg = jscolor.picker.sld.childNodes;
|
826 |
+
|
827 |
+
switch(modeID) {
|
828 |
+
case 0:
|
829 |
+
var rgb = HSV_RGB(THIS.hsv[0], THIS.hsv[1], 1);
|
830 |
+
for(var i=0; i<seg.length; i+=1) {
|
831 |
+
seg[i].style.backgroundColor = 'rgb('+
|
832 |
+
(rgb[0]*(1-i/seg.length)*100)+'%,'+
|
833 |
+
(rgb[1]*(1-i/seg.length)*100)+'%,'+
|
834 |
+
(rgb[2]*(1-i/seg.length)*100)+'%)';
|
835 |
+
}
|
836 |
+
break;
|
837 |
+
case 1:
|
838 |
+
var rgb, s, c = [ THIS.hsv[2], 0, 0 ];
|
839 |
+
var i = Math.floor(THIS.hsv[0]);
|
840 |
+
var f = i%2 ? THIS.hsv[0]-i : 1-(THIS.hsv[0]-i);
|
841 |
+
switch(i) {
|
842 |
+
case 6:
|
843 |
+
case 0: rgb=[0,1,2]; break;
|
844 |
+
case 1: rgb=[1,0,2]; break;
|
845 |
+
case 2: rgb=[2,0,1]; break;
|
846 |
+
case 3: rgb=[2,1,0]; break;
|
847 |
+
case 4: rgb=[1,2,0]; break;
|
848 |
+
case 5: rgb=[0,2,1]; break;
|
849 |
+
}
|
850 |
+
for(var i=0; i<seg.length; i+=1) {
|
851 |
+
s = 1 - 1/(seg.length-1)*i;
|
852 |
+
c[1] = c[0] * (1 - s*f);
|
853 |
+
c[2] = c[0] * (1 - s);
|
854 |
+
seg[i].style.backgroundColor = 'rgb('+
|
855 |
+
(c[rgb[0]]*100)+'%,'+
|
856 |
+
(c[rgb[1]]*100)+'%,'+
|
857 |
+
(c[rgb[2]]*100)+'%)';
|
858 |
+
}
|
859 |
+
break;
|
860 |
+
}
|
861 |
+
}
|
862 |
+
|
863 |
+
|
864 |
+
function redrawSld() {
|
865 |
+
// redraw the slider pointer
|
866 |
+
switch(modeID) {
|
867 |
+
case 0: var yComponent = 2; break;
|
868 |
+
case 1: var yComponent = 1; break;
|
869 |
+
}
|
870 |
+
var y = Math.round((1-THIS.hsv[yComponent]) * (jscolor.images.sld[1]-1));
|
871 |
+
jscolor.picker.sldM.style.backgroundPosition =
|
872 |
+
'0 ' + (THIS.pickerFace+THIS.pickerInset+y - Math.floor(jscolor.images.arrow[1]/2)) + 'px';
|
873 |
+
}
|
874 |
+
|
875 |
+
|
876 |
+
function isPickerOwner() {
|
877 |
+
return jscolor.picker && jscolor.picker.owner === THIS;
|
878 |
+
}
|
879 |
+
|
880 |
+
|
881 |
+
function blurTarget() {
|
882 |
+
if(valueElement === target) {
|
883 |
+
THIS.importColor();
|
884 |
+
}
|
885 |
+
if(THIS.pickerOnfocus) {
|
886 |
+
THIS.hidePicker();
|
887 |
+
}
|
888 |
+
}
|
889 |
+
|
890 |
+
|
891 |
+
function blurValue() {
|
892 |
+
if(valueElement !== target) {
|
893 |
+
THIS.importColor();
|
894 |
+
}
|
895 |
+
}
|
896 |
+
|
897 |
+
|
898 |
+
function setPad(e) {
|
899 |
+
var mpos = jscolor.getRelMousePos(e);
|
900 |
+
var x = mpos.x - THIS.pickerFace - THIS.pickerInset;
|
901 |
+
var y = mpos.y - THIS.pickerFace - THIS.pickerInset;
|
902 |
+
switch(modeID) {
|
903 |
+
case 0: THIS.fromHSV(x*(6/(jscolor.images.pad[0]-1)), 1 - y/(jscolor.images.pad[1]-1), null, leaveSld); break;
|
904 |
+
case 1: THIS.fromHSV(x*(6/(jscolor.images.pad[0]-1)), null, 1 - y/(jscolor.images.pad[1]-1), leaveSld); break;
|
905 |
+
}
|
906 |
+
}
|
907 |
+
|
908 |
+
|
909 |
+
function setSld(e) {
|
910 |
+
var mpos = jscolor.getRelMousePos(e);
|
911 |
+
var y = mpos.y - THIS.pickerFace - THIS.pickerInset;
|
912 |
+
switch(modeID) {
|
913 |
+
case 0: THIS.fromHSV(null, null, 1 - y/(jscolor.images.sld[1]-1), leavePad); break;
|
914 |
+
case 1: THIS.fromHSV(null, 1 - y/(jscolor.images.sld[1]-1), null, leavePad); break;
|
915 |
+
}
|
916 |
+
}
|
917 |
+
|
918 |
+
|
919 |
+
function dispatchImmediateChange() {
|
920 |
+
if (THIS.onImmediateChange) {
|
921 |
+
var callback;
|
922 |
+
if (typeof THIS.onImmediateChange === 'string') {
|
923 |
+
callback = new Function (THIS.onImmediateChange);
|
924 |
+
} else {
|
925 |
+
callback = THIS.onImmediateChange;
|
926 |
+
}
|
927 |
+
callback.call(THIS);
|
928 |
+
}
|
929 |
+
}
|
930 |
+
|
931 |
+
|
932 |
+
var THIS = this;
|
933 |
+
var modeID = this.pickerMode.toLowerCase()==='hvs' ? 1 : 0;
|
934 |
+
var abortBlur = false;
|
935 |
+
var
|
936 |
+
valueElement = jscolor.fetchElement(this.valueElement),
|
937 |
+
styleElement = jscolor.fetchElement(this.styleElement);
|
938 |
+
var
|
939 |
+
holdPad = false,
|
940 |
+
holdSld = false,
|
941 |
+
touchOffset = {};
|
942 |
+
var
|
943 |
+
leaveValue = 1<<0,
|
944 |
+
leaveStyle = 1<<1,
|
945 |
+
leavePad = 1<<2,
|
946 |
+
leaveSld = 1<<3;
|
947 |
+
|
948 |
+
// target
|
949 |
+
jscolor.addEvent(target, 'focus', function() {
|
950 |
+
if(THIS.pickerOnfocus) { THIS.showPicker(); }
|
951 |
+
});
|
952 |
+
jscolor.addEvent(target, 'blur', function() {
|
953 |
+
if(!abortBlur) {
|
954 |
+
window.setTimeout(function(){ abortBlur || blurTarget(); abortBlur=false; }, 0);
|
955 |
+
} else {
|
956 |
+
abortBlur = false;
|
957 |
+
}
|
958 |
+
});
|
959 |
+
|
960 |
+
// valueElement
|
961 |
+
if(valueElement) {
|
962 |
+
var updateField = function() {
|
963 |
+
THIS.fromString(valueElement.value, leaveValue);
|
964 |
+
dispatchImmediateChange();
|
965 |
+
};
|
966 |
+
jscolor.addEvent(valueElement, 'keyup', updateField);
|
967 |
+
jscolor.addEvent(valueElement, 'input', updateField);
|
968 |
+
jscolor.addEvent(valueElement, 'blur', blurValue);
|
969 |
+
valueElement.setAttribute('autocomplete', 'off');
|
970 |
+
}
|
971 |
+
|
972 |
+
// styleElement
|
973 |
+
if(styleElement) {
|
974 |
+
styleElement.jscStyle = {
|
975 |
+
backgroundImage : styleElement.style.backgroundImage,
|
976 |
+
backgroundColor : styleElement.style.backgroundColor,
|
977 |
+
color : styleElement.style.color
|
978 |
+
};
|
979 |
+
}
|
980 |
+
|
981 |
+
// require images
|
982 |
+
switch(modeID) {
|
983 |
+
case 0: jscolor.requireImage('hs.png'); break;
|
984 |
+
case 1: jscolor.requireImage('hv.png'); break;
|
985 |
+
}
|
986 |
+
jscolor.requireImage('cross.gif');
|
987 |
+
jscolor.requireImage('arrow.gif');
|
988 |
+
|
989 |
+
this.importColor();
|
990 |
+
}
|
991 |
+
|
992 |
+
};
|
993 |
+
|
994 |
+
|
995 |
+
jscolor.install();
|
readme.txt
CHANGED
@@ -1,36 +1,36 @@
|
|
1 |
=== WP Live Chat Support ===
|
2 |
Contributors: WP-LiveChat
|
3 |
Donate link: http://www.wp-livechat.com
|
4 |
-
Tags: live chat, live support, live help, plugin, widget, wordpress chat, customer support, chat
|
5 |
Requires at least: 3.4
|
6 |
-
Tested up to: 3.5
|
7 |
Stable tag: trunk
|
8 |
|
9 |
The most cost effective Live Chat plugin. Chat with your visitors for free!
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
The most cost effective Live Chat plugin. Chat with your visitors for free!
|
14 |
|
15 |
= Free version =
|
16 |
-
*
|
17 |
-
*
|
18 |
* Easy to use interface for both the admin and the visitor
|
19 |
* No advertising or links
|
20 |
-
* No monthly subscriptions needed
|
21 |
|
22 |
|
23 |
= Pro add-on =
|
24 |
-
* Initiate chats with online visitors
|
25 |
* Chat to more than one visitor at a time
|
26 |
* Access historical chat records
|
27 |
* Set up your user profile
|
28 |
-
* Add your company logo to the chat window
|
29 |
-
* Add your photo to the chat window
|
30 |
* Edit all text fields
|
31 |
* World-class support
|
32 |
-
* Fully customizable chat experience
|
33 |
-
* Get the [WP Live Chat Support Pro Add-on](http://wp-livechat.com/purchase-pro/) for only $
|
34 |
|
35 |
|
36 |
|
@@ -43,16 +43,16 @@ The most cost effective Live Chat plugin. Chat with your visitors for free! Perf
|
|
43 |
|
44 |
== Frequently Asked Questions ==
|
45 |
|
46 |
-
= I've installed the plugin, now what? =
|
47 |
|
48 |
Once installed and activated, a link should appear in your left navigation panel within your WP-ADMIN section. Click on the "Live Chat" link and follow the on screen instructions.
|
49 |
|
50 |
|
51 |
== Screenshots ==
|
52 |
|
53 |
-
1. Front-end
|
54 |
-
2. Back-end
|
55 |
-
3. Settings page
|
56 |
|
57 |
|
58 |
== Upgrade Notice ==
|
@@ -61,8 +61,15 @@ Once installed and activated, a link should appear in your left navigation panel
|
|
61 |
|
62 |
== Changelog ==
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
= 2.3 =
|
65 |
-
*Fixed another small bug
|
66 |
|
67 |
= 2.2 =
|
68 |
* Fixed a small bug
|
1 |
=== WP Live Chat Support ===
|
2 |
Contributors: WP-LiveChat
|
3 |
Donate link: http://www.wp-livechat.com
|
4 |
+
Tags: live chat, live support, live help, plugin, widget, wordpress chat, customer support, chat, live chat plugin
|
5 |
Requires at least: 3.4
|
6 |
+
Tested up to: 3.5.1
|
7 |
Stable tag: trunk
|
8 |
|
9 |
The most cost effective Live Chat plugin. Chat with your visitors for free!
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
The most cost effective Live Chat plugin. Chat with your visitors for free! WP Live Chat Support is perfect for small businesses. No third party connections or subscriptions required. There's no need to pay for live chat monthly subscriptions in order to better understand your visitors. This is a fully functional live chat plugin. Increase your conversion rates by communicating directly with your visitors when they're ready to do so.
|
14 |
|
15 |
= Free version =
|
16 |
+
* The free version of WP Live Chat Support is a fully functional live chat plugin
|
17 |
+
* Initiate live chats with your visitors
|
18 |
* Easy to use interface for both the admin and the visitor
|
19 |
* No advertising or links
|
20 |
+
* No monthly live chat subscriptions needed
|
21 |
|
22 |
|
23 |
= Pro add-on =
|
24 |
+
* Initiate live chats with online visitors
|
25 |
* Chat to more than one visitor at a time
|
26 |
* Access historical chat records
|
27 |
* Set up your user profile
|
28 |
+
* Add your company logo to the live chat window
|
29 |
+
* Add your photo to the live chat window
|
30 |
* Edit all text fields
|
31 |
* World-class support
|
32 |
+
* Fully customizable live chat experience
|
33 |
+
* Get the [WP Live Chat Support Pro Add-on](http://wp-livechat.com/purchase-pro/) for only $14.95 once off!
|
34 |
|
35 |
|
36 |
|
43 |
|
44 |
== Frequently Asked Questions ==
|
45 |
|
46 |
+
= I've installed the live chat plugin, now what? =
|
47 |
|
48 |
Once installed and activated, a link should appear in your left navigation panel within your WP-ADMIN section. Click on the "Live Chat" link and follow the on screen instructions.
|
49 |
|
50 |
|
51 |
== Screenshots ==
|
52 |
|
53 |
+
1. Front-end of WP Live Chat Support
|
54 |
+
2. Back-end of WP Live Chat Support
|
55 |
+
3. Settings page of WP Live Chat Support
|
56 |
|
57 |
|
58 |
== Upgrade Notice ==
|
61 |
|
62 |
== Changelog ==
|
63 |
|
64 |
+
= 2.4 =
|
65 |
+
* You now have full control of the fill and font color of your live chat box
|
66 |
+
* Added the ability to turn live chat on and off
|
67 |
+
* Better notification of incoming live chats.
|
68 |
+
* Added more localization support
|
69 |
+
* Plugin should now be compatible with caching plugins.
|
70 |
+
|
71 |
= 2.3 =
|
72 |
+
* Fixed another small bug
|
73 |
|
74 |
= 2.2 =
|
75 |
* Fixed a small bug
|
ring.wav
ADDED
Binary file
|
screenshot-1.JPG
CHANGED
Binary file
|
screenshot-2.JPG
CHANGED
Binary file
|
screenshot-3.JPG
CHANGED
Binary file
|
wp-live-chat-support.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP Live Chat Support
|
4 |
Plugin URI: http://www.wp-livechat.com
|
5 |
Description: The easiest to use website live chat plugin. Let your visitors chat with you and increase sales conversion rates with WP Live Chat Support. No third party connection required!
|
6 |
-
Version: 2.
|
7 |
Author: WP-LiveChat
|
8 |
Author URI: http://www.wp-livechat.com
|
9 |
*/
|
@@ -17,7 +17,7 @@ global $wplc_tblname_chats;
|
|
17 |
global $wplc_tblname_msgs;
|
18 |
$wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
|
19 |
$wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
|
20 |
-
$wplc_version = "2.
|
21 |
|
22 |
|
23 |
add_action('wp_footer', 'wplc_display_box');
|
@@ -61,6 +61,9 @@ function wplc_admin_menu() {
|
|
61 |
}
|
62 |
add_action('wp_head','wplc_user_top_js');
|
63 |
function wplc_user_top_js() {
|
|
|
|
|
|
|
64 |
$ajax_nonce = wp_create_nonce("wplc");
|
65 |
wp_register_script( 'wplc-user-jquery-cookie', plugins_url('/js/jquery-cookie.js', __FILE__) );
|
66 |
wp_enqueue_script( 'wplc-user-jquery-cookie' );
|
@@ -74,16 +77,24 @@ function wplc_user_top_js() {
|
|
74 |
}
|
75 |
|
76 |
function wplc_draw_user_box() {
|
|
|
|
|
|
|
77 |
wp_register_script( 'wplc-user-script', plugins_url('/js/wplc_u.js', __FILE__) );
|
78 |
wp_enqueue_script( 'wplc-user-script' );
|
79 |
wplc_output_box();
|
80 |
|
81 |
}
|
82 |
function wplc_output_box() {
|
83 |
-
$wplc_settings = get_option("WPLC_SETTINGS");
|
84 |
|
|
|
|
|
|
|
|
|
85 |
if ($wplc_settings["wplc_settings_align"] == 1) { $wplc_box_align = "left:100px;"; } else { $wplc_box_align = "right:100px;"; }
|
86 |
-
|
|
|
|
|
87 |
$wplc_is_admin_logged_in = get_transient("wplc_is_admin_logged_in");
|
88 |
if (!function_exists("wplc_register_pro_version") && $wplc_is_admin_logged_in != 1) {
|
89 |
return "";
|
@@ -99,7 +110,7 @@ function wplc_output_box() {
|
|
99 |
?>
|
100 |
|
101 |
<div id="wp-live-chat-close" style="display:none;"></div>
|
102 |
-
<div id="wp-live-chat-1">
|
103 |
<strong>Questions?</strong> Chat with us
|
104 |
</div>
|
105 |
<div id="wp-live-chat-2" style="display:none;">
|
@@ -700,6 +711,9 @@ function wplc_superadmin_javascript() {
|
|
700 |
}
|
701 |
|
702 |
|
|
|
|
|
|
|
703 |
});
|
704 |
|
705 |
|
@@ -730,7 +744,14 @@ function wplc_admin_javascript() {
|
|
730 |
//console.log("wplc_update_admin_chat");
|
731 |
jQuery("#wplc_admin_chat_area").html(response);
|
732 |
if (response.indexOf("pending") >= 0) {
|
733 |
-
document.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
734 |
}
|
735 |
|
736 |
|
@@ -847,7 +868,7 @@ function wplc_admin_menu_layout_display() {
|
|
847 |
<?php wplc_list_chats(); ?>
|
848 |
</div>
|
849 |
<h1>Online Visitors</h1>
|
850 |
-
<p><?php _e("With the Pro add-on of WP Live Chat Support, you can","wplivechat"); ?> <a href="http://www.wp-livechat.com/purchase-pro
|
851 |
<?php
|
852 |
}
|
853 |
else {
|
@@ -1032,7 +1053,7 @@ function wplc_return_admin_chat_javascript($cid) {
|
|
1032 |
function wplc_activate() {
|
1033 |
wplc_handle_db();
|
1034 |
if (!get_option("WPLC_SETTINGS")) {
|
1035 |
-
add_option('WPLC_SETTINGS',array("wplc_settings_align" => "2", "
|
1036 |
}
|
1037 |
}
|
1038 |
|
@@ -1087,6 +1108,17 @@ function wplc_add_user_stylesheet() {
|
|
1087 |
wp_enqueue_style( 'wplc-style' );
|
1088 |
}
|
1089 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1090 |
function wplc_admin_settings_layout() {
|
1091 |
wplc_settings_page_basic();
|
1092 |
}
|
@@ -1096,7 +1128,7 @@ function wplc_admin_history_layout() {
|
|
1096 |
wplc_pro_admin_display_history();
|
1097 |
}
|
1098 |
else {
|
1099 |
-
echo "<br /><br >This option is only available in the <a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=history1\" title=\"".__("Pro Add-on","wplivechat")."\" target=\"_BLANK\">Pro Add-on</a> of WP Live Chat. <a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=history2\" title=\"".__("Pro Add-on","wplivechat")."\" target=\"_BLANK\">Get it now for only $
|
1100 |
}
|
1101 |
}
|
1102 |
|
@@ -1104,10 +1136,13 @@ function wplc_settings_page_basic() {
|
|
1104 |
echo"<div class=\"wrap\"><div id=\"icon-edit\" class=\"icon32 icon32-posts-post\"><br></div><h2>".__("WP Live Chat Support Settings","wplivechat")."</h2>";
|
1105 |
|
1106 |
$wplc_settings = get_option("WPLC_SETTINGS");
|
1107 |
-
|
1108 |
-
|
1109 |
if ($wplc_settings["wplc_settings_align"]) { $wplc_settings_align[intval($wplc_settings["wplc_settings_align"])] = "SELECTED"; }
|
1110 |
-
|
|
|
|
|
|
|
1111 |
|
1112 |
|
1113 |
echo "<form action='' name='wplc_settings' method='post' id='wplc_settings'>";
|
@@ -1146,7 +1181,7 @@ function wplc_settings_page_basic() {
|
|
1146 |
";
|
1147 |
$wplc_pro_chat_delay = "
|
1148 |
<tr>
|
1149 |
-
<td width='200' valign='top'>".__("Chat
|
1150 |
<td>
|
1151 |
<input type='text' size='50' maxlength='50' disabled readonly value='10' /> <small><i> ".__("available in the","wplivechat")." <a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=delay\" title=\"".__("Pro Add-on","wplivechat")."\" target=\"_BLANK\">".__("Pro Add-on","wplivechat")."</a> ".__("only","wplivechat").". </i></small>
|
1152 |
</td>
|
@@ -1165,14 +1200,14 @@ function wplc_settings_page_basic() {
|
|
1165 |
$wplc_pro_chat_fs = "
|
1166 |
<tr style='height:30px;'><td></td><td></td></tr>
|
1167 |
<tr>
|
1168 |
-
<td width='200' valign='top'>".__("First
|
1169 |
<td>
|
1170 |
<input type='text' size='50' maxlength='50' class='regular-text' readonly value='Questions?' /> <br />
|
1171 |
<input type='text' size='50' maxlength='50' class='regular-text' readonly value='Chat with us' /> <br />
|
1172 |
</td>
|
1173 |
</tr>
|
1174 |
<tr>
|
1175 |
-
<td width='200' valign='top'>".__("Second
|
1176 |
<td>
|
1177 |
<input type='text' size='50' maxlength='50' class='regular-text' readonly value='Start Chat' /> <br />
|
1178 |
<input type='text' size='50' maxlength='50' class='regular-text' readonly value='Connecting you to a sales person. Please be patient.' /> <br />
|
@@ -1181,7 +1216,7 @@ function wplc_settings_page_basic() {
|
|
1181 |
</td>
|
1182 |
</tr>
|
1183 |
<tr>
|
1184 |
-
<td width='200' valign='top'>".__("Reactivate
|
1185 |
<td>
|
1186 |
<input type='text' size='50' maxlength='50' class='regular-text' readonly value='Reactivating your previous chat...' /><small><i> ".__("Edit these text fields using the ","wplivechat")." <a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=textfields3\" title=\"".__("Pro Add-on","wplivechat")."\" target=\"_BLANK\">".__("Pro Add-on","wplivechat")."</a>. </i></small> <br />
|
1187 |
|
@@ -1189,7 +1224,7 @@ function wplc_settings_page_basic() {
|
|
1189 |
</td>
|
1190 |
</tr>
|
1191 |
<tr>
|
1192 |
-
<td width='200' valign='top'>".__("Offline
|
1193 |
<td>
|
1194 |
<input type='text' size='50' maxlength='50' class='regular-text' readonly value='Chat offline. Leave a message' /><small><i> ".__("Edit these text fields using the ","wplivechat")." <a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=textfields4\" title=\"".__("Pro Add-on","wplivechat")."\" target=\"_BLANK\">".__("Pro Add-on","wplivechat")."</a>. </i></small> <br />
|
1195 |
|
@@ -1202,6 +1237,20 @@ function wplc_settings_page_basic() {
|
|
1202 |
|
1203 |
|
1204 |
echo "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1205 |
|
1206 |
<h3>".__("Chat Window Settings",'wplivechat')."</h3>
|
1207 |
<table class='form-table' width='700'>
|
@@ -1211,7 +1260,7 @@ function wplc_settings_page_basic() {
|
|
1211 |
$wplc_pro_chat_delay
|
1212 |
$wplc_pro_chat_emailme
|
1213 |
<tr>
|
1214 |
-
<td width='200' valign='top'>".__("Chat
|
1215 |
<td>
|
1216 |
<select id='wplc_settings_align' name='wplc_settings_align'>
|
1217 |
<option value=\"1\" ".$wplc_settings_align[1].">".__("Bottom left","wplivechat")."</option>
|
@@ -1219,6 +1268,19 @@ function wplc_settings_page_basic() {
|
|
1219 |
</select>
|
1220 |
</td>
|
1221 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1222 |
$wplc_pro_chat_fs
|
1223 |
|
1224 |
</table>
|
@@ -1239,16 +1301,19 @@ function wplc_head() {
|
|
1239 |
|
1240 |
if (isset($_POST['wplc_save_settings'])){
|
1241 |
|
1242 |
-
|
1243 |
-
|
|
|
|
|
|
|
1244 |
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
|
1253 |
|
1254 |
}
|
3 |
Plugin Name: WP Live Chat Support
|
4 |
Plugin URI: http://www.wp-livechat.com
|
5 |
Description: The easiest to use website live chat plugin. Let your visitors chat with you and increase sales conversion rates with WP Live Chat Support. No third party connection required!
|
6 |
+
Version: 2.4
|
7 |
Author: WP-LiveChat
|
8 |
Author URI: http://www.wp-livechat.com
|
9 |
*/
|
17 |
global $wplc_tblname_msgs;
|
18 |
$wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
|
19 |
$wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
|
20 |
+
$wplc_version = "2.4";
|
21 |
|
22 |
|
23 |
add_action('wp_footer', 'wplc_display_box');
|
61 |
}
|
62 |
add_action('wp_head','wplc_user_top_js');
|
63 |
function wplc_user_top_js() {
|
64 |
+
echo "<!-- DEFINING DO NOT CACHE -->";
|
65 |
+
define('DONOTCACHEPAGE', true);
|
66 |
+
define('DONOTCACHEDB', true);
|
67 |
$ajax_nonce = wp_create_nonce("wplc");
|
68 |
wp_register_script( 'wplc-user-jquery-cookie', plugins_url('/js/jquery-cookie.js', __FILE__) );
|
69 |
wp_enqueue_script( 'wplc-user-jquery-cookie' );
|
77 |
}
|
78 |
|
79 |
function wplc_draw_user_box() {
|
80 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
81 |
+
if ($wplc_settings["wplc_settings_enabled"] == 2) { return; }
|
82 |
+
|
83 |
wp_register_script( 'wplc-user-script', plugins_url('/js/wplc_u.js', __FILE__) );
|
84 |
wp_enqueue_script( 'wplc-user-script' );
|
85 |
wplc_output_box();
|
86 |
|
87 |
}
|
88 |
function wplc_output_box() {
|
|
|
89 |
|
90 |
+
|
91 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
92 |
+
if ($wplc_settings["wplc_settings_enabled"] == 2) { return; }
|
93 |
+
|
94 |
if ($wplc_settings["wplc_settings_align"] == 1) { $wplc_box_align = "left:100px;"; } else { $wplc_box_align = "right:100px;"; }
|
95 |
+
if ($wplc_settings["wplc_settings_fill"]) { $wplc_settings_fill = "#".$wplc_settings["wplc_settings_fill"]; } else { $wplc_settings_fill = "#73BE28"; }
|
96 |
+
if ($wplc_settings["wplc_settings_font"]) { $wplc_settings_font = "#".$wplc_settings["wplc_settings_font"]; } else { $wplc_settings_font = "#FFFFFF"; }
|
97 |
+
|
98 |
$wplc_is_admin_logged_in = get_transient("wplc_is_admin_logged_in");
|
99 |
if (!function_exists("wplc_register_pro_version") && $wplc_is_admin_logged_in != 1) {
|
100 |
return "";
|
110 |
?>
|
111 |
|
112 |
<div id="wp-live-chat-close" style="display:none;"></div>
|
113 |
+
<div id="wp-live-chat-1" style="background-color: <?php echo $wplc_settings_fill; ?> !important; color: <?php echo $wplc_settings_font; ?> !important;">
|
114 |
<strong>Questions?</strong> Chat with us
|
115 |
</div>
|
116 |
<div id="wp-live-chat-2" style="display:none;">
|
711 |
}
|
712 |
|
713 |
|
714 |
+
|
715 |
+
|
716 |
+
|
717 |
});
|
718 |
|
719 |
|
744 |
//console.log("wplc_update_admin_chat");
|
745 |
jQuery("#wplc_admin_chat_area").html(response);
|
746 |
if (response.indexOf("pending") >= 0) {
|
747 |
+
var orig_title = document.getElementsByTagName("title")[0].innerHTML;
|
748 |
+
document.title = "** CHAT REQUEST **";
|
749 |
+
wplc_title_alerts1 = setTimeout(function (){ document.title = "__ CHAT Request __"; }, 1000);
|
750 |
+
wplc_title_alerts2 = setTimeout(function (){ document.title = "** CHAT REQUEST **"; }, 1500);
|
751 |
+
wplc_title_alerts3 = setTimeout(function (){ document.title = "__ CHAT Request __"; }, 2000);
|
752 |
+
wplc_title_alerts4 = setTimeout(function (){ document.title = orig_title; }, 2500);
|
753 |
+
|
754 |
+
document.getElementById("wplc_sound").innerHTML="<embed src='<?php echo plugins_url('/ring.wav', __FILE__); ?>' hidden=true autostart=true loop=false>";
|
755 |
}
|
756 |
|
757 |
|
868 |
<?php wplc_list_chats(); ?>
|
869 |
</div>
|
870 |
<h1>Online Visitors</h1>
|
871 |
+
<p><?php _e("With the Pro add-on of WP Live Chat Support, you can","wplivechat"); ?> <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate1" title="<?php _e("see who's online and initiate chats","wplivechat"); ?>" target=\"_BLANK\"><?php _e("see who's online and initiate chats","wplivechat"); ?></a> <?php _e("with your online visitors with the click of a button.","wplivechat"); ?> <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate2" title="<?php _e("Buy the Pro add-on now for only $14.95 once off. Updates free forever.","wplivechat"); ?>" target=\"_BLANK\"><strong><?php _e("Buy the Pro add-on now for only $14.95 once off. Updates free forever.","wplivechat"); ?></strong></a></p>
|
872 |
<?php
|
873 |
}
|
874 |
else {
|
1053 |
function wplc_activate() {
|
1054 |
wplc_handle_db();
|
1055 |
if (!get_option("WPLC_SETTINGS")) {
|
1056 |
+
add_option('WPLC_SETTINGS',array("wplc_settings_align" => "2", "wplc_settings_enabled" => "1", "wplc_settings_fill" => "73BE2", "wplc_settings_font" => "FFFFFF"));
|
1057 |
}
|
1058 |
}
|
1059 |
|
1108 |
wp_enqueue_style( 'wplc-style' );
|
1109 |
}
|
1110 |
|
1111 |
+
if (isset($_GET['page']) && $_GET['page'] == 'wplivechat-menu-settings') {
|
1112 |
+
add_action('admin_print_scripts', 'wplc_admin_scripts_basic');
|
1113 |
+
}
|
1114 |
+
function wplc_admin_scripts_basic() {
|
1115 |
+
if ($_GET['page'] == "wplivechat-menu-settings") {
|
1116 |
+
wp_register_script('my-wplc-color', plugins_url('js/jscolor.js',__FILE__), false, '1.4.1', false);
|
1117 |
+
wp_enqueue_script('my-wplc-color');
|
1118 |
+
}
|
1119 |
+
}
|
1120 |
+
|
1121 |
+
|
1122 |
function wplc_admin_settings_layout() {
|
1123 |
wplc_settings_page_basic();
|
1124 |
}
|
1128 |
wplc_pro_admin_display_history();
|
1129 |
}
|
1130 |
else {
|
1131 |
+
echo "<br /><br >This option is only available in the <a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=history1\" title=\"".__("Pro Add-on","wplivechat")."\" target=\"_BLANK\">Pro Add-on</a> of WP Live Chat. <a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=history2\" title=\"".__("Pro Add-on","wplivechat")."\" target=\"_BLANK\">Get it now for only $14.95 once off!</a>";
|
1132 |
}
|
1133 |
}
|
1134 |
|
1136 |
echo"<div class=\"wrap\"><div id=\"icon-edit\" class=\"icon32 icon32-posts-post\"><br></div><h2>".__("WP Live Chat Support Settings","wplivechat")."</h2>";
|
1137 |
|
1138 |
$wplc_settings = get_option("WPLC_SETTINGS");
|
1139 |
+
|
1140 |
+
|
1141 |
if ($wplc_settings["wplc_settings_align"]) { $wplc_settings_align[intval($wplc_settings["wplc_settings_align"])] = "SELECTED"; }
|
1142 |
+
if ($wplc_settings["wplc_settings_enabled"]) { $wplc_settings_enabled[intval($wplc_settings["wplc_settings_enabled"])] = "SELECTED"; }
|
1143 |
+
if ($wplc_settings["wplc_settings_fill"]) { $wplc_settings_fill = $wplc_settings["wplc_settings_fill"]; } else { $wplc_settings_fill = "73BE28"; }
|
1144 |
+
if ($wplc_settings["wplc_settings_font"]) { $wplc_settings_font = $wplc_settings["wplc_settings_font"]; } else { $wplc_settings_font = "FFFFFF"; }
|
1145 |
+
|
1146 |
|
1147 |
|
1148 |
echo "<form action='' name='wplc_settings' method='post' id='wplc_settings'>";
|
1181 |
";
|
1182 |
$wplc_pro_chat_delay = "
|
1183 |
<tr>
|
1184 |
+
<td width='200' valign='top'>".__("Chat delay (seconds)","wplivechat").":</td>
|
1185 |
<td>
|
1186 |
<input type='text' size='50' maxlength='50' disabled readonly value='10' /> <small><i> ".__("available in the","wplivechat")." <a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=delay\" title=\"".__("Pro Add-on","wplivechat")."\" target=\"_BLANK\">".__("Pro Add-on","wplivechat")."</a> ".__("only","wplivechat").". </i></small>
|
1187 |
</td>
|
1200 |
$wplc_pro_chat_fs = "
|
1201 |
<tr style='height:30px;'><td></td><td></td></tr>
|
1202 |
<tr>
|
1203 |
+
<td width='200' valign='top'>".__("First section text","wplivechat").":</td>
|
1204 |
<td>
|
1205 |
<input type='text' size='50' maxlength='50' class='regular-text' readonly value='Questions?' /> <br />
|
1206 |
<input type='text' size='50' maxlength='50' class='regular-text' readonly value='Chat with us' /> <br />
|
1207 |
</td>
|
1208 |
</tr>
|
1209 |
<tr>
|
1210 |
+
<td width='200' valign='top'>".__("Second section text","wplivechat").":</td>
|
1211 |
<td>
|
1212 |
<input type='text' size='50' maxlength='50' class='regular-text' readonly value='Start Chat' /> <br />
|
1213 |
<input type='text' size='50' maxlength='50' class='regular-text' readonly value='Connecting you to a sales person. Please be patient.' /> <br />
|
1216 |
</td>
|
1217 |
</tr>
|
1218 |
<tr>
|
1219 |
+
<td width='200' valign='top'>".__("Reactivate chat section text","wplivechat").":</td>
|
1220 |
<td>
|
1221 |
<input type='text' size='50' maxlength='50' class='regular-text' readonly value='Reactivating your previous chat...' /><small><i> ".__("Edit these text fields using the ","wplivechat")." <a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=textfields3\" title=\"".__("Pro Add-on","wplivechat")."\" target=\"_BLANK\">".__("Pro Add-on","wplivechat")."</a>. </i></small> <br />
|
1222 |
|
1224 |
</td>
|
1225 |
</tr>
|
1226 |
<tr>
|
1227 |
+
<td width='200' valign='top'>".__("Offline text","wplivechat").":</td>
|
1228 |
<td>
|
1229 |
<input type='text' size='50' maxlength='50' class='regular-text' readonly value='Chat offline. Leave a message' /><small><i> ".__("Edit these text fields using the ","wplivechat")." <a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=textfields4\" title=\"".__("Pro Add-on","wplivechat")."\" target=\"_BLANK\">".__("Pro Add-on","wplivechat")."</a>. </i></small> <br />
|
1230 |
|
1237 |
|
1238 |
|
1239 |
echo "
|
1240 |
+
<h3>".__("Main Settings",'wplivechat')."</h3>
|
1241 |
+
<table class='form-table' width='700'>
|
1242 |
+
<tr>
|
1243 |
+
<td width='200' valign='top'>".__("Chat enabled","wplivechat").":</td>
|
1244 |
+
<td>
|
1245 |
+
<select id='wplc_settings_enabled' name='wplc_settings_enabled'>
|
1246 |
+
<option value=\"1\" ".$wplc_settings_enabled[1].">".__("Yes","wplivechat")."</option>
|
1247 |
+
<option value=\"2\" ".$wplc_settings_enabled[2].">".__("No","wplivechat")."</option>
|
1248 |
+
</select>
|
1249 |
+
</td>
|
1250 |
+
</tr>
|
1251 |
+
|
1252 |
+
</table>
|
1253 |
+
|
1254 |
|
1255 |
<h3>".__("Chat Window Settings",'wplivechat')."</h3>
|
1256 |
<table class='form-table' width='700'>
|
1260 |
$wplc_pro_chat_delay
|
1261 |
$wplc_pro_chat_emailme
|
1262 |
<tr>
|
1263 |
+
<td width='200' valign='top'>".__("Chat box alignment","wplivechat").":</td>
|
1264 |
<td>
|
1265 |
<select id='wplc_settings_align' name='wplc_settings_align'>
|
1266 |
<option value=\"1\" ".$wplc_settings_align[1].">".__("Bottom left","wplivechat")."</option>
|
1268 |
</select>
|
1269 |
</td>
|
1270 |
</tr>
|
1271 |
+
<tr>
|
1272 |
+
<td width='200' valign='top'>".__("Chat box fill color","wplivechat").":</td>
|
1273 |
+
<td>
|
1274 |
+
<input id=\"wplc_settings_fill\" name=\"wplc_settings_fill\" type=\"text\" class=\"color\" value=\"".$wplc_settings_fill."\" />
|
1275 |
+
</td>
|
1276 |
+
</tr>
|
1277 |
+
<tr>
|
1278 |
+
<td width='200' valign='top'>".__("Chat box font color","wplivechat").":</td>
|
1279 |
+
<td>
|
1280 |
+
<input id=\"wplc_settings_font\" name=\"wplc_settings_font\" type=\"text\" class=\"color\" value=\"".$wplc_settings_font."\" />
|
1281 |
+
</td>
|
1282 |
+
</tr>
|
1283 |
+
|
1284 |
$wplc_pro_chat_fs
|
1285 |
|
1286 |
</table>
|
1301 |
|
1302 |
if (isset($_POST['wplc_save_settings'])){
|
1303 |
|
1304 |
+
$wplc_data['wplc_settings_align'] = attribute_escape($_POST['wplc_settings_align']);
|
1305 |
+
$wplc_data['wplc_settings_fill'] = attribute_escape($_POST['wplc_settings_fill']);
|
1306 |
+
$wplc_data['wplc_settings_font'] = attribute_escape($_POST['wplc_settings_font']);
|
1307 |
+
$wplc_data['wplc_settings_enabled'] = attribute_escape($_POST['wplc_settings_enabled']);
|
1308 |
+
update_option('WPLC_SETTINGS', $wplc_data);
|
1309 |
|
1310 |
+
if (function_exists("wplc_register_pro_version")) {
|
1311 |
+
wplc_pro_save_settings();
|
1312 |
+
}
|
1313 |
|
1314 |
+
echo "<div class='updated'>";
|
1315 |
+
_e("Your settings have been saved.","wplivechat");
|
1316 |
+
echo "</div>";
|
1317 |
|
1318 |
|
1319 |
}
|