-
Notifications
You must be signed in to change notification settings - Fork 12
/
browser_console_qrcode.js
56 lines (51 loc) · 3.77 KB
/
browser_console_qrcode.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* @author OA Wu <comdan66@gmail.com>
* @copyright Copyright (c) 2015 OA Wu Design
*/
$(function () {
/**
* color1 - 色碼 - QR Code 的主色(黑色)
* color2 - 色碼 - QR Code 的背景(白色)
* qrCodeArray - 陣列 - QR Code 二維陣列,1 代表黑點,0 代表白格
*/
function browser_console_qrcode (color1, color2, qrCodeArray) {
var css1 = "color:" + color1 + ";font-size:10px;margin:3px;text-shadow: 0 -6px " + color1 + ", 6px 0 " + color1 + ", 6px -6px " + color1 + ";",
css2 = "color:" + color2 + ";font-size:10px;margin:3px;text-shadow: 0 -6px " + color2 + ", 6px 0 " + color2 + ", 6px -6px " + color2 + ";",
qrt = '\\n';
for (var i = 0, c = []; i < qrCodeArray.length; i++, qrt += '\\n')
for (var j = 0; j < qrCodeArray[i].length; c.push ('"' + (qrCodeArray[i][j] ? css1 : css2) + '"'), j++)
qrt += qrCodeArray[i][j] ? "%c▇" : "%c▇";
qrt += '\\n';
eval ('console.log("' + qrt + '", ' + c.join (',') + ');');
console.log ('%c想幹麻!?想看怎麼做的嗎? 答案在這裡 %c➜ %chttps://github.com/comdan66/browser_console_qrcode/blob/master/js/browser_console_qrcode.js', 'color:rgba(36, 127, 84, 1.00);font-size:15px;line-height:25px;', 'color:rgba(213, 36, 35, 1.00);font-size:15px;line-height:25px;', 'color:rgba(66, 133, 244, 1.00);font-size:10px;line-height:25px;');
console.log ('%c想看更多 OA Wu 的作品集嗎!?快看這裡喲! %c➜ %chttp://www.ioa.tw/', 'color:rgba(36, 127, 84, 1.00);font-size:15px;line-height:25px;', 'color:rgba(213, 36, 35, 1.00);font-size:15px;line-height:25px;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