|
| 1 | +/** |
| 2 | + * Copyright (C) 2012-2015 KO GmbH <copyright@kogmbh.com> |
| 3 | + * |
| 4 | + * @licstart |
| 5 | + * This file is part of WebODF. |
| 6 | + * |
| 7 | + * WebODF is free software: you can redistribute it and/or modify it |
| 8 | + * under the terms of the GNU Affero General Public License (GNU AGPL) |
| 9 | + * as published by the Free Software Foundation, either version 3 of |
| 10 | + * the License, or (at your option) any later version. |
| 11 | + * |
| 12 | + * WebODF is distributed in the hope that it will be useful, but |
| 13 | + * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | + * GNU Affero General Public License for more details. |
| 16 | + * |
| 17 | + * You should have received a copy of the GNU Affero General Public License |
| 18 | + * along with WebODF. If not, see <http://www.gnu.org/licenses/>. |
| 19 | + * @licend |
| 20 | + * |
| 21 | + * @source: http://www.webodf.org/ |
| 22 | + * @source: https://github.com/kogmbh/WebODF/ |
| 23 | + */ |
| 24 | + |
| 25 | +/*global window, runtime*/ |
| 26 | + |
| 27 | +runtime.libraryPaths = (function () { |
| 28 | + "use strict"; |
| 29 | + |
| 30 | + return function () { |
| 31 | + return ["../lib", "."]; |
| 32 | + }; |
| 33 | +}()); |
| 34 | + |
| 35 | +runtime.log = (function () { |
| 36 | + "use strict"; |
| 37 | + |
| 38 | + var normalLog = runtime.log, |
| 39 | + logoutput = window.document.getElementById("logoutput"); |
| 40 | + |
| 41 | + return function (msgOrCategory, msg) { |
| 42 | + var node, doc, category; |
| 43 | + |
| 44 | + // do normal log first |
| 45 | + normalLog(msgOrCategory, msg); |
| 46 | + |
| 47 | + // now output also |
| 48 | + if (msg !== undefined) { |
| 49 | + category = msgOrCategory; |
| 50 | + } else { |
| 51 | + msg = msgOrCategory; |
| 52 | + } |
| 53 | + |
| 54 | + doc = logoutput.ownerDocument; |
| 55 | + if (category) { |
| 56 | + node = doc.createElement("span"); |
| 57 | + node.className = category; |
| 58 | + node.appendChild(doc.createTextNode(category)); |
| 59 | + logoutput.appendChild(node); |
| 60 | + logoutput.appendChild(doc.createTextNode(" ")); |
| 61 | + } |
| 62 | + node = doc.createElement("span"); |
| 63 | + if (msg.length > 0 && msg[0] === "<") { |
| 64 | + node.innerHTML = msg; |
| 65 | + } else { |
| 66 | + node.appendChild(doc.createTextNode(msg)); |
| 67 | + } |
| 68 | + logoutput.appendChild(node); |
| 69 | + logoutput.appendChild(doc.createElement("br")); |
| 70 | + }; |
| 71 | +}()); |
0 commit comments