diff options
Diffstat (limited to 'core/src/jquery/octemplate.js')
-rw-r--r-- | core/src/jquery/octemplate.js | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/core/src/jquery/octemplate.js b/core/src/jquery/octemplate.js index 27b2dff970b..9e060881e21 100644 --- a/core/src/jquery/octemplate.js +++ b/core/src/jquery/octemplate.js @@ -1,3 +1,27 @@ +/** + * @copyright Copyright (c) 2016 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author Christoph Wurst <christoph@winzerhof-wurst.at> + * @author John Molakvoæ <skjnldsv@protonmail.com> + * @author Roeland Jago Douma <roeland@famdouma.nl> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + import $ from 'jquery' import escapeHTML from 'escape-html' @@ -56,7 +80,7 @@ import escapeHTML from 'escape-html' * Inspired by micro templating done by e.g. underscore.js */ const Template = { - init: function(vars, options, elem) { + init(vars, options, elem) { // Mix in the passed in options with the default options this.vars = vars this.options = $.extend({}, this.options, options) @@ -77,7 +101,7 @@ const Template = { return $(_html) }, // From stackoverflow.com/questions/1408289/best-way-to-do-variable-interpolation-in-javascript - _build: function(o) { + _build(o) { const data = this.elem.attr('type') === 'text/template' ? this.elem.html() : this.elem.get(0).outerHTML try { return data.replace(/{([^{}]*)}/g, |