1/** 2 * MLJLib 3 * MeshLabJS Library 4 * 5 * Copyright(C) 2015 6 * Paolo Cignoni 7 * Visual Computing Lab 8 * ISTI - CNR 9 * 10 * All rights reserved. 11 * 12 * This program is free software; you can redistribute it and/or modify it under 13 * the terms of the GNU General Public License as published by the Free Software 14 * Foundation; either version 2 of the License, or (at your option) any later 15 * version. 16 * 17 * This program is distributed in the hope that it will be useful, but WITHOUT 18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 * FOR A PARTICULAR PURPOSE. See theGNU General Public License 20 * (http://www.gnu.org/licenses/gpl.txt) for more details. 21 * 22 */ 23 24/** 25 * @file Defines and installs the Log widget the text area used like standard output 26 * @author Stefano Gabriele 27 */ 28(function (component) { 29 30 /** 31 * @class Create a new Log widget 32 * @augments MLJ.gui.Widget 33 * @private 34 * @memberOf MLJ.gui.widget 35 * @author Stefano Gabriele 36 */ 37 var _Log = function () { 38 39 var _this = this; 40 41 //Console output redirecting ... 42 var _log = console.log, _warn = console.warn, _error = console.error; 43 44 console.log = function (message, args) { 45 var m = args ? message + " " + args : message; 46 _this.append(m); 47 _log.apply(console, arguments); 48 }; 49 50 console.warn = function (message, args) { 51 var m = args ? message + " " + args : message; 52 _this.append(m); 53 _warn.apply(console, arguments); 54 }; 55 56 console.error = function (message, args) { 57 var m = args ? message + " " + args : message; 58 _this.append(m); 59 _error.apply(console, arguments); 60 }; 61 62 var _$log = $('<textarea/>') 63 .attr("spellcheck", false) 64 .attr("readonly", "readonly"); 65 66 /** 67 * @author Stefano Gabriele 68 */ 69 this._make = function () { 70 var $wrap = $('<div/>').attr("id", "mlj-log-widget"); 71 $wrap.append(_$log); 72 return $wrap; 73 }; 74 75 /** 76 * Appends text to Log 77 * @param {String} text The text to append 78 * @author Stefano Gabriele 79 */ 80 this.append = function (text) { 81 _$log.append(text + "\n"); 82 _$log.scrollTop(_$log[0].scrollHeight - _$log.height()); 83 }; 84 }; 85 86 MLJ.extend(MLJ.gui.Widget, _Log); 87 88 //Install widget 89 MLJ.gui.installWidget("Log", new _Log()); 90 91})(MLJ.gui.component);
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.