mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
client/views: move form controls to HB helpers
This commit is contained in:
@ -37,3 +37,21 @@ Promise.prototype.always = function(onResolveOrReject) {
|
||||
throw reason;
|
||||
});
|
||||
};
|
||||
|
||||
if (!String.prototype.format) {
|
||||
String.prototype.format = function() {
|
||||
let str = this.toString();
|
||||
if (!arguments.length) {
|
||||
return str;
|
||||
}
|
||||
const type = typeof arguments[0];
|
||||
const args = (type == 'string' || type == 'number') ?
|
||||
arguments : arguments[0];
|
||||
for (let arg in args) {
|
||||
str = str.replace(
|
||||
new RegExp('\\{' + arg + '\\}', 'gi'),
|
||||
() => { return args[arg]; });
|
||||
}
|
||||
return str;
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user