PageSourceSearch

https://www.wwei.cn/qrcode/beautifier/js/iColorPicker.js?v=2020054170

js wwei.cn collected 2026-10-08 18:43:12 UTC 16,813 bytes, 387 lines download raw bytes

1function iColorShow(e, t) {
2	_id = e;
3	var n = jQuery("#" + t).offset();
4	var closepos=$('#close').position();
5	jQuery("#iColorPicker,#icp_iframe").css({
6		top: n.top+jQuery("#" + e).outerHeight() + 4 + "px",
7		left: n.left - 80 + "px",
8		position: "absolute"
9	}).fadeIn("fast");
10	if (!-[1] && !window.XMLHttpRequest) {
11		jQuery("body,html").css({
12			height: "100%",
13			width: "100%",
14			position: "relative"
15		});
16		jQuery("#iColorPickerBg").css({
17			position: "absolute",
18			top: 0,
19			left: 0,
20			width: "100%",
21			height: "100%"
22		}).fadeIn("fast")
23	} else {
24		jQuery("#iColorPickerBg").css({
25			position: "fixed",
26			top: 0,
27			left: 0,
28			width: "100%",
29			height: "100%"
30		}).fadeIn("fast")
31	}
32	var r = jQuery("#" + e).val();
33	jQuery("#colorPreview").css("background", r);
34	jQuery("#color").val(r);
35	var s = jQuery("#iColorPicker");
36	tempColor = null;
37	jQuery("#colorPreview input").val(r);
38	for (i = 0; i < s.length; i++) {
39		var o = document.getElementById("hexSection" + i);
40		var u = o.childNodes;
41		var a = u.length;
42		for (j = 0; j < a; j++) {
43			var f = u[j].childNodes;
44			var l = f.length;
45			for (k = 0; k < l; k++) {
46				jQuery(u[j].childNodes[k]).unbind().mouseover(function(n) {
47					if (!tempColor) {
48						var r = "#" + jQuery(this).attr("hx");
49						jQuery("#colorPreview").css("background", r);
50						jQuery("#colorPreview input").val(r);
51						jQuery("#" + e).val(r);
52						jQuery("#" + t).val(r).css("background-color", r);
53						canvasChange(typeof canvasObj !="undefined" && canvasObj?canvasObj:null, e, r)
54					}
55				});
56				jQuery(u[j].childNodes[k]).click(function() {
57					var t = "#" + jQuery(this).attr("hx");
58					tempColor = t;
59					jQuery("#" + e).css("background", t);
60					jQuery("#iColorPickerBg").hide();
61					jQuery("#iColorPicker,#icp_iframe").fadeOut();
62					canvasSet(typeof canvasObj !="undefined" && canvasObj?canvasObj:null, e, t);
63					jQuery(this);
64				})
65			}
66		}
67	}
68	jQuery("#colorPreview a").click(function(){
69        jQuery("#iColorPickerBg").hide();
70        jQuery("#iColorPicker,#icp_iframe").fadeOut();
71	});
72	jQuery("#colorPreview input").keyup(function() {
73		var e = $(this).val();
74		if (e.match(/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/)) {
75			jQuery("#colorPreview").css("background", e);
76			jQuery("#icp_" + _id).val(e).css("background-color", e);
77			canvasChange(typeof canvasObj !="undefined" && canvasObj?canvasObj:null, _id, e);
78			jQuery("#" + _id).val(e).css("background", e);
79			canvasSet(typeof canvasObj !="undefined" && canvasObj?canvasObj:null, _id, e)
80		}
81	}).keydown(function(e) {
82		return !String.fromCharCode(e.which).match(/[^#0-9A-F\b\x25\x27\x60a-k]/)
83	})
84}
85
86function canvasChange(e, t, n) {
87	var is_canvas = true;
88	if (-[1]) {
89		switch (t) {
90			case "bgcolor":
91			   $('#resetBgColor').css('display','block');
92				document.getElementById('defult_bgcolor').value=n;
93				e&&e.changeBgColor(n);
94				break;
95			case "fgcolor":
96                $('#resetFgColor').css('display','block');
97				e&&e.changeFgColor(n);
98				document.getElementById('defult_fgcolor').value=n;
99				break;
100			case "ptcolor":
101				e&&e.changePtColor(n);
102				document.getElementById('defult_ptcolor').value=n;
103				break;
104			case "inptcolor":
105				e&&e.changeInPtColor(n);
106				document.getElementById('defult_inptcolor').value=n;
107				break;
108			case "gccolor":
109			    $('#resetGcColor').css('display','block');
110				e&&e.changeGcColor($("#gradientWay").attr('value1'), n);
111				document.getElementById('defult_gccolor').value=n;
112				break;
113			case "ftcolor":
114				e&&e.changeFtColor(n);
115				document.getElementById('defult_ftcolor').value=n;
116				break;
117			case "media_fgcolor_input":
118				document.getElementById('media_fgcolor_input').value=n;
119				$('body').find('#media_fgcolor_change').css('background',n);
120				is_canvas=false;
121				if(typeof changeQrcodeOptionSet === "function"){
122					changeQrcodeOptionSet('media_bj_color',n);
123				}
124				return false;
125				break;
126			case "media_btn_color_input":
127				document.getElementById('media_btn_color_input').value=n;
128				$('body').find('#media_btn_color_change').css('background',n);
129				is_canvas=false;
130				if(typeof changeQrcodeOptionSet === "function"){
131					changeQrcodeOptionSet('media_btn_color',n);
132				}
133				return false;
134				break;
135			default:
136		}
137
138		if(typeof setQrcodeconfigIndex === "function"&&is_canvas){
139			// setQrcodeconfigIndex(t,n,2);
140		}
141	}
142}
143
144function canvasSet(e, t, n) {
145	var is_canvas = true;
146	switch (t) {
147		case "bgcolor":
148			e ? e.changeBgColor(n) : typeof setColor=="function"?setColor("bgcolor"):null;
149			$("#bgcolor").attr("data-color", n);
150			document.getElementById('defult_bgcolor').value=n;
151			$('#defult_bgcolor').css('border','');
152			break;
153		case "fgcolor":
154			e ? e.changeFgColor(n) : typeof setColor=="function"?setColor("fgcolor"):null;
155			$("#fgcolor").attr("data-color", n);
156			document.getElementById('defult_fgcolor').value=n;
157			$('#defult_fgcolor').css('border','');
158			break;
159		case "ptcolor":
160			e ? e.changePtColor(n) : typeof setColor=="function"?setColor("ptcolor"):null;
161			$("#resetPtColor").show();
162			$("#ptcolor").attr("data-color", n);
163			document.getElementById('defult_ptcolor').value=n;
164			$('#defult_ptcolor').css('border','');
165			break;
166		case "inptcolor":
167			e ? e.changeInPtColor(n) : typeof setColor=="function"?setColor("inptcolor"):null;
168			$("#resetInPtColor").show();
169			$("#inptcolor").attr("data-color", n);
170			document.getElementById('defult_inptcolor').value=n;
171			$('#defult_inptcolor').css('border','');
172			break;
173		case "gccolor":
174			e ? e.changeGcColor($("#gradientWay").attr('value1'), n) : typeof setColor=="function"?setColor("gccolor"):null;
175			$("#resetGcColor").show();
176			$("#gccolor").attr("data-color", n);
177			document.getElementById('defult_gccolor').value=n;
178			$('#defult_gccolor').css('border','');
179			break;
180		case "ftcolor":
181			e ? e.changeFtColor(n) : typeof setColor=="function"?setColor("ftcolor"):null;
182			$("#resetFtColor").show();
183			$("#ftcolor").attr("data-color", n);
184			document.getElementById('defult_ftcolor').value=n;
185			$('#defult_ftcolor').css('border','');
186			break;
187		case "media_fgcolor_input":
188			document.getElementById('media_fgcolor_input').value=n;
189			$('body').find('#media_fgcolor_change').css('background',n);
190			$('body').find('#media_fgcolor_input').css('background','');
191			is_canvas=false;
192			if(typeof changeQrcodeOptionSet === "function"){
193				changeQrcodeOptionSet('media_bj_color',n);
194			}
195			return false;
196			break;
197		case "media_btn_color_input":
198			document.getElementById('media_btn_color_input').value=n;
199			$('body').find('#media_btn_color_change').css('background',n);
200			$('body').find('#media_btn_color_input').css('background','');
201			is_canvas=false;
202			if(typeof changeQrcodeOptionSet === "function"){
203				changeQrcodeOptionSet('media_btn_color',n);
204			}
205			return false;
206			break;
207		default:
208	}
209	if(typeof setQrcodeconfigIndex === "function"&&is_canvas){
210		setQrcodeconfigIndex(t,n,1);
211	}
212}
213var tempColor = null;
214var _id = null;
215this.iColorPicker = function() {
216	jQuery("input.iColorPicker").each(function(e) {
217		if (e == 0) {
218			var _html = '<table class="pickerTable" id="pickerTable0">';
219				_html += '<thead id="hexSection0"><tr>';
220				_html += '<td style="background:#ff0000;" hx="ff0000"></td>';
221				_html += '<td style="background:#ffff00" hx="ffff00"></td>';
222				_html += '<td style="background:#00ff00" hx="00ff00"></td>';
223				_html += '<td style="background:#00ffff" hx="00ffff"></td>';
224				_html += '<td style="background:#0000ff" hx="0000ff"></td>';
225				_html += '<td style="background:#ff00ff" hx="ff00ff"></td>';
226				_html += '<td style="background:#ffffff" hx="ffffff"></td>';
227				_html += '<td style="background:#ebebeb" hx="ebebeb"></td>';
228				_html += '<td style="background:#e1e1e1" hx="e1e1e1"></td>';
229				_html += '<td style="background:#d7d7d7" hx="d7d7d7"></td>';
230				_html += '<td style="background:#cccccc" hx="cccccc"></td>';
231				_html += '<td style="background:#c2c2c2" hx="c2c2c2"></td>';
232				_html += '<td style="background:#b7b7b7" hx="b7b7b7"></td>';
233				_html += '<td style="background:#acacac" hx="acacac"></td>';
234				_html += '<td style="background:#a0a0a0" hx="a0a0a0"></td>';
235				_html += '<td style="background:#959595" hx="959595"></td>';
236				_html += '</tr><tr>'
237				_html += '<td style="background:#ee1d24" hx="ee1d24"></td>';
238				_html += '<td style="background:#fff100" hx="fff100"></td>';
239				_html += '<td style="background:#00a650" hx="00a650"></td>';
240				_html += '<td style="background:#00aeef" hx="00aeef"></td>';
241				_html += '<td style="background:#2f3192" hx="2f3192"></td>';
242				_html += '<td style="background:#ed008c" hx="ed008c"></td>';
243				_html += '<td style="background:#898989" hx="898989"></td>';
244				_html += '<td style="background:#7d7d7d" hx="7d7d7d"></td>';
245				_html += '<td style="background:#707070" hx="707070"></td>';
246				_html += '<td style="background:#626262" hx="626262"></td>';
247				_html += '<td style="background:#555555" hx="555555"></td>';
248				_html += '<td style="background:#464646" hx="464646"></td>';
249				_html += '<td style="background:#363636" hx="363636"></td>';
250				_html += '<td style="background:#262626" hx="262626"></td>';
251				_html += '<td style="background:#111111" hx="111111"></td>';
252				_html += '<td style="background:#000000" hx="000000"></td>';
253				_html += '</tr><tr>';
254				_html += '<td style="background:#f7977a" hx="f7977a"></td>';
255				_html += '<td style="background:#fbad82" hx="fbad82"></td>';
256				_html += '<td style="background:#fdc68c" hx="fdc68c"></td>';
257				_html += '<td style="background:#fff799" hx="fff799"></td>';
258				_html += '<td style="background:#c6df9c" hx="c6df9c"></td>';
259				_html += '<td style="background:#a4d49d" hx="a4d49d"></td>';
260				_html += '<td style="background:#81ca9d" hx="81ca9d"></td>';
261				_html += '<td style="background:#7bcdc9" hx="7bcdc9"></td>';
262				_html += '<td style="background:#6ccff7" hx="6ccff7"></td>';
263				_html += '<td style="background:#7ca6d8" hx="7ca6d8"></td>';
264				_html += '<td style="background:#8293ca" hx="8293ca"></td>';
265				_html += '<td style="background:#8881be" hx="8881be"></td>';
266				_html += '<td style="background:#a286bd" hx="a286bd"></td>';
267				_html += '<td style="background:#bc8cbf" hx="bc8cbf"></td>';
268				_html += '<td style="background:#f49bc1" hx="f49bc1"></td>';
269				_html += '<td style="background:#f5999d" hx="f5999d"></td>';
270				_html += '</tr><tr>';
271				_html += '<td style="background:#f16c4d" hx="f16c4d"></td>';
272				_html += '<td style="background:#f68e54" hx="f68e54"></td>';
273				_html += '<td style="background:#fbaf5a" hx="fbaf5a"></td>';
274				_html += '<td style="background:#fff467" hx="fff467"></td>';
275				_html += '<td style="background:#acd372" hx="acd372"></td>';
276				_html += '<td style="background:#7dc473" hx="7dc473"></td>';
277				_html += '<td style="background:#39b778" hx="39b778"></td>';
278				_html += '<td style="background:#16bcb4" hx="16bcb4"></td>';
279				_html += '<td style="background:#00bff3" hx="00bff3"></td>';
280				_html += '<td style="background:#438ccb" hx="438ccb"></td>';
281				_html += '<td style="background:#5573b7" hx="5573b7"></td>';
282				_html += '<td style="background:#5e5ca7" hx="5e5ca7"></td>';
283				_html += '<td style="background:#855fa8" hx="855fa8"></td>';
284				_html += '<td style="background:#a763a9" hx="a763a9"></td>';
285				_html += '<td style="background:#ef6ea8" hx="ef6ea8"></td>';
286				_html += '<td style="background:#f16d7e" hx="f16d7e"></td>';
287				_html += '</tr><tr>';
288				_html += '<td style="background:#ee1d24" hx="ee1d24"></td>';
289				_html += '<td style="background:#f16522" hx="f16522"></td>';
290				_html += '<td style="background:#f7941d" hx="f7941d"></td>';
291				_html += '<td style="background:#fff100" hx="fff100"></td>';
292				_html += '<td style="background:#8fc63d" hx="8fc63d"></td>';
293				_html += '<td style="background:#37b44a" hx="37b44a"></td>';
294				_html += '<td style="background:#00a650" hx="00a650"></td>';
295				_html += '<td style="background:#00a99e" hx="00a99e"></td>';
296				_html += '<td style="background:#00aeef" hx="00aeef"></td>';
297				_html += '<td style="background:#0072bc" hx="0072bc"></td>';
298				_html += '<td style="background:#0054a5" hx="0054a5"></td>';
299				_html += '<td style="background:#2f3192" hx="2f3192"></td>';
300				_html += '<td style="background:#652c91" hx="652c91"></td>';
301				_html += '<td style="background:#91278f" hx="91278f"></td>';
302				_html += '<td style="background:#ed008c" hx="ed008c"></td>';
303				_html += '<td style="background:#ee105a" hx="ee105a"></td>';
304				_html += '</tr><tr>';
305				_html += '<td style="background:#9d0a0f" hx="9d0a0f"></td>';
306				_html += '<td style="background:#a1410d" hx="a1410d"></td>';
307				_html += '<td style="background:#a36209" hx="a36209"></td>';
308				_html += '<td style="background:#aba000" hx="aba000"></td>';
309				_html += '<td style="background:#588528" hx="588528"></td>';
310				_html += '<td style="background:#197b30" hx="197b30"></td>';
311				_html += '<td style="background:#007236" hx="007236"></td>';
312				_html += '<td style="background:#00736a" hx="00736a"></td>';
313				_html += '<td style="background:#0076a4" hx="0076a4"></td>';
314				_html += '<td style="background:#004a80" hx="004a80"></td>';
315				_html += '<td style="background:#003370" hx="003370"></td>';
316				_html += '<td style="background:#1d1363" hx="1d1363"></td>';
317				_html += '<td style="background:#450e61" hx="450e61"></td>';
318				_html += '<td style="background:#62055f" hx="62055f"></td>';
319				_html += '<td style="background:#9e005c" hx="9e005c"></td>';
320				_html += '<td style="background:#9d0039" hx="9d0039"></td>';
321				_html += '</tr><tr>';
322				_html += '<td style="background:#790000" hx="790000"></td>';
323				_html += '<td style="background:#7b3000" hx="7b3000"></td>';
324				_html += '<td style="background:#7c4900" hx="7c4900"></td>';
325				_html += '<td style="background:#827a00" hx="827a00"></td>';
326				_html += '<td style="background:#3e6617" hx="3e6617"></td>';
327				_html += '<td style="background:#045f20" hx="045f20"></td>';
328				_html += '<td style="background:#005824" hx="005824"></td>';
329				_html += '<td style="background:#005951" hx="005951"></td>';
330				_html += '<td style="background:#005b7e" hx="005b7e"></td>';
331				_html += '<td style="background:#003562" hx="003562"></td>';
332				_html += '<td style="background:#002056" hx="002056"></td>';
333				_html += '<td style="background:#0c004b" hx="0c004b"></td>';
334				_html += '<td style="background:#30004a" hx="30004a"></td>';
335				_html += '<td style="background:#4b0048" hx="4b0048"></td>';
336				_html += '<td style="background:#7a0045" hx="7a0045"></td>';
337				_html += '<td style="background:#7a0026" hx="7a0026"></td>';
338				_html += '</tr></thead>';
339				_html += '<tbody><tr><td style="border:1px solid #000;background:#fff;cursor:pointer;height:60px;
339-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;text-align:-ms-center;" colspan="16" align="center" id="colorPreview"><input type="text" maxlength="7" size="8" style="color:#000;border:1px solid rgb(0, 0, 0);padding:5px;background-color:#fff;font:11px Arial, Helvetica, sans-serif;"/><a id="colorOk" style="font:11px Arial, Helvetica, sans-serif;vertical-align:middle;padding:3px 4px;cursor;border:1px solid #CCC;background:#FFFFFF">确定</a></td></tr></tbody></table>';
340				_html += '<style>#iColorPicker input{margin:2px}</style>';
341			jQuery(document.createElement("div")).attr("id", "iColorPicker").css("display", "none").html(_html).appendTo("body");
342			jQuery(document.createElement("div")).attr("id", "iColorPickerBg").click(function() {
343				jQuery("#iColorPickerBg").hide();
344				if (!-[1]) {
345					switch (_id) {
346						case "media_fgcolor_input":
347							break;
348						case "media_btn_color_input":
349							break;
350						default:
351							if(typeof setQrcodeconfigIndex === "function"){
352								setQrcodeconfigIndex('','',1);
353							}
354							break;
355					}
356					setColor(_id)
357				}
358				jQuery("#" + _id).parent().siblings(".close").show();
359				jQuery("#" + _id).attr("data-color", tempColor);
360				jQuery("#iColorPicker,#icp_iframe").fadeOut();
361			}).appendTo("body");
362			jQuery("table.pickerTable td").css({
363				width: "12px",
364				height: "14px",
365				border: "1px solid #000",
366				cursor: "pointer"
367			});
368			jQuery("#iColorPicker table.pickerTable").css({
369				"border-collapse": "collapse"
370			});
371			jQuery("#iColorPicker").css({
372				border: "1px solid #ccc",
373				background: "#333",
374				padding: "5px",
375				color: "#fff",
376				"z-index": 9999999999
377			});
378		}
379		jQuery("#colorPreview").css({
380			height: "50px"
381		});
382		jQuery(this).css("backgroundColor", jQuery(this).val()).after('<div id="icp_' + this.id + '" class="colorPicker-picker cp" style="background-color:' + jQuery(this).val() + '" onclick="iColorShow(\'' + this.id + "','icp_" + this.id + "');return false;\"></div>")
383	})
384};
385jQuery(function() {
386	iColorPicker()
387});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.