├── .gitignore
├── Makefile
├── README.md
├── bower.json
├── mobile-console.js
├── mobile-console.min.js
├── mobile_screen.png
├── package.json
└── style
├── mobile-console.css
└── mobile-console.min.css
/.gitignore:
--------------------------------------------------------------------------------
1 | *sublime*
2 | .DS_store
3 | demo/
4 | index.html
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | all: min cssmin
2 |
3 | min:
4 | yuglify ./mobile-console.js
5 |
6 | cssmin:
7 | yuglify ./style/mobile-console.css
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | js-mobile-console
2 | =====
3 |
4 | 
5 |
6 | ## Install
7 | **Zip archive**:
8 | [Download](https://github.com/msemenistyi/js-mobile-console/archive/master.zip)
9 |
10 | **Browserify**:
11 | > npm install js-mobile-console
12 |
13 | [](https://nodei.co/npm/js-mobile-console/)
14 |
15 | **Bower**:
16 | > bower install js-mobile-console
17 |
18 | ## Overview
19 |
20 | [Live demo](http://b1narystudio.github.io/js-mobile-console/).
21 |
22 | It is extremely nice, that we are on the road of specifying and unifying remote
23 | debugging protocol and we can already remotely debug web applications on desktop
24 | Chrome, but what if we want to get it working also on Android browser or
25 | Safari for iOs?
26 |
27 | MobileConsole can be embedded within any page for debugging, it will catch errors
28 | and behave exactly as native js console in browser. It also outputs all the logs
29 | you've written via an API of window.console.
30 |
31 | ### How is it different from all the existing instruments?
32 |
33 | There are already plenty of ways for testing mobile applications. The most
34 | advanced is at the moment Chrome remote debugging. Still it is available only
35 | Chrome to Chrome.
36 |
37 | Another way is to use [weinre](http://people.apache.org/~pmuellr/weinre-docs/latest/) -
38 | tool for remote debugging. It is quite nice and suggests rich functionality. Still
39 | it seems quite heavy for me. You should setup a dedicated server for it.
40 |
41 | js-mobile-console is in contrast lightweight and requires almost no configuration,
42 | you can just include it into your page and debug it when an error appears.
43 |
44 | *stevemao* also stated that it may come handy for debugging
45 | [web views](https://github.com/B1naryStudio/js-mobile-console/issues/1).
46 |
47 | ### Loading
48 | Css file should be included within html:
49 | ```html
50 |
51 | ```
52 | Console may be used without any modular system:
53 | ```html
54 |
55 | ```
56 |
57 | With help of browserify:
58 | ```js
59 | var mobileConsole = require('js-mobile-console');
60 | ```
61 |
62 | Or AMD style (RequireJS):
63 | ```js
64 | define(['js-mobile-console'], function(mobileConsole))
65 | ```
66 |
67 | ### Usage
68 |
69 | Simple usage:
70 | ```js
71 | mobileConsole.show();
72 | ```
73 |
74 | Advanced usage:
75 | ```js
76 | mobileConsole.options({
77 | showOnError: true,
78 | proxyConsole: false,
79 | isCollapsed: true,
80 | catchErrors: true
81 | });
82 | ```
83 |
84 | Conditional toggling:
85 | ```js
86 | if (condition) {
87 | mobileConsole.show();
88 | } else {
89 | mobileConsole.hide();
90 | }
91 | ```
92 |
93 | Commands specifying:
94 | ```js
95 | mobileConsole.commands({
96 | 'check': 'var a = 10; a;',
97 | 'run': '10/5'
98 | });
99 | ```
100 |
101 | ### API
102 |
103 | - **show** - show console with default options.
104 | - **hide** - hide console.
105 | - **options** - method to initialize console, by default will show console,
106 | accepts hash of options.
107 | - **commands** - method to specify a hash of commands, which later can be
108 | executed within console.
109 |
110 | ### Options
111 |
112 | - **showOnError** - *Default* false. Console will be hidden if no show method
113 | was called, but it will appear if any error occurs.
114 | - **proxyConsole** - *Default* true. Determines if window.console methods are
115 | proxied to mobile console.
116 | - **isCollapsed** - *Default* false. Determines if Console is collpased on startup.
117 | - **catchErrors** - *Default* false. Determines if Console is registring
118 | window.onerror method in order to catch errors.
119 |
120 | ## Created by [msemenistyi](https://github.com/msemenistyi)
121 |
122 | ## Changelog
123 |
124 | ### 0.4.0 (2018-10-24)
125 | - fix handling of undefined
126 | - added ability to style output with %c
127 |
128 | ### 0.3.3 (2018-10-24)
129 | - add possibility to add line breaks in console.log strings with \n
130 |
131 | ### 0.3.0 (2014-11-11)
132 | - add possibility to specify commands;
133 | - add JSON.stringifying for logging;
134 | - set z-index to console
135 | - fix startup error on logValue
136 |
137 | ## Contributing
138 | Feel free to open issues and send PRs.
139 |
140 |
141 | ## License
142 |
143 | The MIT License (MIT)
144 |
145 | [](http://binary-studio.com)
146 | Copyright (c) 2014-2018 Semenistyi Mykyta nikeiwe@gmail.com
147 |
148 | Permission is hereby granted, free of charge, to any person obtaining a copy
149 | of this software and associated documentation files (the "Software"), to deal
150 | in the Software without restriction, including without limitation the rights
151 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
152 | copies of the Software, and to permit persons to whom the Software is
153 | furnished to do so, subject to the following conditions:
154 |
155 | The above copyright notice and this permission notice shall be included in
156 | all copies or substantial portions of the Software.
157 |
158 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
159 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
160 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
161 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
162 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
163 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
164 | THE SOFTWARE.
165 |
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "js-mobile-console",
3 | "version": "0.4.0",
4 | "authors": [
5 | "msemenistyi "
6 | ],
7 | "description": "JS console emulator for mobile devices",
8 | "main": [
9 | "mobile-console.js",
10 | "style/mobile-console.css"
11 | ],
12 | "keywords": [
13 | "console",
14 | "emulator",
15 | "debug"
16 | ],
17 | "license": "MIT",
18 | "homepage": "https://github.com/B1naryStudio/js-mobile-console",
19 | "ignore": [
20 | "**/.*",
21 | "node_modules",
22 | "bower_components",
23 | "test",
24 | "tests"
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/mobile-console.js:
--------------------------------------------------------------------------------
1 | (function (root, factory) {
2 | if (typeof define === 'function' && define.amd) {
3 | define([], factory);
4 | } else if (typeof exports === 'object') {
5 | module.exports = factory();
6 | } else {
7 | root.mobileConsole = factory();
8 | }
9 | })(this, function () {
10 |
11 | var containerHtml = '' +
12 | '' +
13 | '