mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-30 14:08:46 +02:00
N°5621 Move jquery.fileupload.js 9.22.0 (?) to NPM
Update to 9.22.1 to fix https://github.com/advisories/GHSA-4cj8-g9cp-v5wr
This commit is contained in:
80
node_modules/blueimp-tmpl/js/compile.js
generated
vendored
Normal file
80
node_modules/blueimp-tmpl/js/compile.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env node
|
||||
/*
|
||||
* JavaScript Templates Compiler
|
||||
* https://github.com/blueimp/JavaScript-Templates
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
;(function () {
|
||||
'use strict'
|
||||
var path = require('path')
|
||||
var tmpl = require(path.join(__dirname, 'tmpl.js'))
|
||||
var fs = require('fs')
|
||||
// Retrieve the content of the minimal runtime:
|
||||
var runtime = fs.readFileSync(path.join(__dirname, 'runtime.js'), 'utf8')
|
||||
// A regular expression to parse templates from script tags in a HTML page:
|
||||
var regexp = /<script( id="([\w\-]+)")? type="text\/x-tmpl"( id="([\w\-]+)")?>([\s\S]+?)<\/script>/gi
|
||||
// A regular expression to match the helper function names:
|
||||
var helperRegexp = new RegExp(
|
||||
tmpl.helper.match(/\w+(?=\s*=\s*function\s*\()/g).join('\\s*\\(|') + '\\s*\\('
|
||||
)
|
||||
// A list to store the function bodies:
|
||||
var list = []
|
||||
var code
|
||||
// Extend the Templating engine with a print method for the generated functions:
|
||||
tmpl.print = function (str) {
|
||||
// Only add helper functions if they are used inside of the template:
|
||||
var helper = helperRegexp.test(str) ? tmpl.helper : ''
|
||||
var body = str.replace(tmpl.regexp, tmpl.func)
|
||||
if (helper || (/_e\s*\(/.test(body))) {
|
||||
helper = '_e=tmpl.encode' + helper + ','
|
||||
}
|
||||
return 'function(' + tmpl.arg + ',tmpl){' +
|
||||
('var ' + helper + "_s='" + body + "';return _s;")
|
||||
.split("_s+='';").join('') + '}'
|
||||
}
|
||||
// Loop through the command line arguments:
|
||||
process.argv.forEach(function (file, index) {
|
||||
var listLength = list.length
|
||||
var stats
|
||||
var content
|
||||
var result
|
||||
var id
|
||||
// Skip the first two arguments, which are "node" and the script:
|
||||
if (index > 1) {
|
||||
stats = fs.statSync(file)
|
||||
if (!stats.isFile()) {
|
||||
console.error(file + ' is not a file.')
|
||||
return
|
||||
}
|
||||
content = fs.readFileSync(file, 'utf8')
|
||||
while (true) {
|
||||
// Find templates in script tags:
|
||||
result = regexp.exec(content)
|
||||
if (!result) {
|
||||
break
|
||||
}
|
||||
id = result[2] || result[4]
|
||||
list.push("'" + id + "':" + tmpl.print(result[5]))
|
||||
}
|
||||
if (listLength === list.length) {
|
||||
// No template script tags found, use the complete content:
|
||||
id = path.basename(file, path.extname(file))
|
||||
list.push("'" + id + "':" + tmpl.print(content))
|
||||
}
|
||||
}
|
||||
})
|
||||
if (!list.length) {
|
||||
console.error('Missing input file.')
|
||||
return
|
||||
}
|
||||
// Combine the generated functions as cache of the minimal runtime:
|
||||
code = runtime.replace('{}', '{' + list.join(',') + '}')
|
||||
// Print the resulting code to the console output:
|
||||
console.log(code)
|
||||
}())
|
||||
48
node_modules/blueimp-tmpl/js/runtime.js
generated
vendored
Normal file
48
node_modules/blueimp-tmpl/js/runtime.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* JavaScript Templates Runtime
|
||||
* https://github.com/blueimp/JavaScript-Templates
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* global define */
|
||||
|
||||
;(function ($) {
|
||||
'use strict'
|
||||
var tmpl = function (id, data) {
|
||||
var f = tmpl.cache[id]
|
||||
return data ? f(data, tmpl) : function (data) {
|
||||
return f(data, tmpl)
|
||||
}
|
||||
}
|
||||
tmpl.cache = {}
|
||||
tmpl.encReg = /[<>&"'\x00]/g // eslint-disable-line no-control-regex
|
||||
tmpl.encMap = {
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'&': '&',
|
||||
'"': '"',
|
||||
"'": '''
|
||||
}
|
||||
tmpl.encode = function (s) {
|
||||
return (s == null ? '' : '' + s).replace(
|
||||
tmpl.encReg,
|
||||
function (c) {
|
||||
return tmpl.encMap[c] || ''
|
||||
}
|
||||
)
|
||||
}
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function () {
|
||||
return tmpl
|
||||
})
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
module.exports = tmpl
|
||||
} else {
|
||||
$.tmpl = tmpl
|
||||
}
|
||||
}(this))
|
||||
86
node_modules/blueimp-tmpl/js/tmpl.js
generated
vendored
Normal file
86
node_modules/blueimp-tmpl/js/tmpl.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* JavaScript Templates
|
||||
* https://github.com/blueimp/JavaScript-Templates
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*
|
||||
* Inspired by John Resig's JavaScript Micro-Templating:
|
||||
* http://ejohn.org/blog/javascript-micro-templating/
|
||||
*/
|
||||
|
||||
/* global define */
|
||||
|
||||
;(function ($) {
|
||||
'use strict'
|
||||
var tmpl = function (str, data) {
|
||||
var f = !/[^\w\-\.:]/.test(str)
|
||||
? tmpl.cache[str] = tmpl.cache[str] || tmpl(tmpl.load(str))
|
||||
: new Function(// eslint-disable-line no-new-func
|
||||
tmpl.arg + ',tmpl',
|
||||
'var _e=tmpl.encode' + tmpl.helper + ",_s='" +
|
||||
str.replace(tmpl.regexp, tmpl.func) + "';return _s;"
|
||||
)
|
||||
return data ? f(data, tmpl) : function (data) {
|
||||
return f(data, tmpl)
|
||||
}
|
||||
}
|
||||
tmpl.cache = {}
|
||||
tmpl.load = function (id) {
|
||||
return document.getElementById(id).innerHTML
|
||||
}
|
||||
tmpl.regexp = /([\s'\\])(?!(?:[^{]|\{(?!%))*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g
|
||||
tmpl.func = function (s, p1, p2, p3, p4, p5) {
|
||||
if (p1) { // whitespace, quote and backspace in HTML context
|
||||
return {
|
||||
'\n': '\\n',
|
||||
'\r': '\\r',
|
||||
'\t': '\\t',
|
||||
' ': ' '
|
||||
}[p1] || '\\' + p1
|
||||
}
|
||||
if (p2) { // interpolation: {%=prop%}, or unescaped: {%#prop%}
|
||||
if (p2 === '=') {
|
||||
return "'+_e(" + p3 + ")+'"
|
||||
}
|
||||
return "'+(" + p3 + "==null?'':" + p3 + ")+'"
|
||||
}
|
||||
if (p4) { // evaluation start tag: {%
|
||||
return "';"
|
||||
}
|
||||
if (p5) { // evaluation end tag: %}
|
||||
return "_s+='"
|
||||
}
|
||||
}
|
||||
tmpl.encReg = /[<>&"'\x00]/g // eslint-disable-line no-control-regex
|
||||
tmpl.encMap = {
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'&': '&',
|
||||
'"': '"',
|
||||
"'": '''
|
||||
}
|
||||
tmpl.encode = function (s) {
|
||||
return (s == null ? '' : '' + s).replace(
|
||||
tmpl.encReg,
|
||||
function (c) {
|
||||
return tmpl.encMap[c] || ''
|
||||
}
|
||||
)
|
||||
}
|
||||
tmpl.arg = 'o'
|
||||
tmpl.helper = ",print=function(s,e){_s+=e?(s==null?'':s):_e(s);}" +
|
||||
',include=function(s,d){_s+=tmpl(s,d);}'
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function () {
|
||||
return tmpl
|
||||
})
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
module.exports = tmpl
|
||||
} else {
|
||||
$.tmpl = tmpl
|
||||
}
|
||||
}(this))
|
||||
Reference in New Issue
Block a user