153 lines
3.4 KiB
Plaintext
153 lines
3.4 KiB
Plaintext
//- Element shortcut mixins
|
|
- let htmlformat;
|
|
mixin input(obj)
|
|
- obj.title = obj.title || `@{${obj.name}}`;
|
|
- obj.name = `attr_${obj.name.replace(/\s+/g,'_')}`;
|
|
input&attributes(obj)
|
|
//-End Mixin
|
|
mixin textarea(obj)
|
|
- obj.title = obj.title || `@{${obj.name}}`;
|
|
- obj.name = `attr_${obj.name.replace(/\s+/g,'_')}`;
|
|
textarea&attributes(obj)
|
|
//-End Mixin
|
|
mixin option(obj)
|
|
- obj['data-i18n'] = obj['data-i18n'] || obj.value;
|
|
option&attributes(obj)
|
|
//-End Mixin
|
|
mixin select(obj,...optionArray)
|
|
- obj.title = obj.title || `@{${obj.name}}`;
|
|
- obj.name = `attr_${obj.name.replace(/\s+/g,'_')}`;
|
|
select&attributes(obj)
|
|
each opt in optionArray
|
|
- htmlformat;
|
|
+option(opt)
|
|
else
|
|
+option({value:'empty select, PEBKAC',selected:true})
|
|
//-End Mixin
|
|
mixin span(obj)
|
|
if obj.name
|
|
- obj.title = obj.title || `@{${obj.name}}`;
|
|
- obj.name = `attr_${obj.name.replace(/\s+/g,'_')}`;
|
|
span&attributes(obj)
|
|
block
|
|
//-End Mixin
|
|
mixin datalist(obj,...optionArray)
|
|
datalist&attributes(obj)
|
|
each opt in optionArray
|
|
- htmlformat;
|
|
+option(opt)
|
|
//-End Mixin
|
|
mixin div(obj)
|
|
div&attributes(obj)
|
|
block
|
|
//-End Mixin
|
|
mixin h1(obj)
|
|
h1&attributes(obj)
|
|
block
|
|
//-End Mixin
|
|
mixin h2(obj)
|
|
h2&attributes(obj)
|
|
block
|
|
//-End Mixin
|
|
mixin h3(obj)
|
|
h3&attributes(obj)
|
|
block
|
|
//-End Mixin
|
|
mixin h4(obj)
|
|
h4&attributes(obj)
|
|
block
|
|
//-End Mixin
|
|
mixin h5(obj)
|
|
h5&attributes(obj)
|
|
block
|
|
//-End Mixin
|
|
mixin p(obj)
|
|
p&attributes(obj)
|
|
block
|
|
//-End Mixin
|
|
mixin button(obj)
|
|
- obj.title = obj.title || `%{${obj.name}}`;
|
|
if obj.type === 'action'
|
|
- obj.name = `act_${obj.name}`;
|
|
else
|
|
- obj.type = 'roll';
|
|
- obj.name = `roll_${obj.name}`;
|
|
button&attributes(obj)
|
|
block
|
|
//-End Mixin
|
|
mixin section(obj)
|
|
section&attributes(obj)
|
|
block
|
|
//-End Mixin
|
|
mixin main(obj)
|
|
main&attributes(obj)
|
|
block
|
|
//-End Mixin
|
|
mixin header(obj)
|
|
header&attributes(obj)
|
|
block
|
|
//-End Mixin
|
|
mixin footer(obj)
|
|
footer&attributes(obj)
|
|
block
|
|
//-End Mixin
|
|
mixin details(obj)
|
|
details&attributes(obj)
|
|
block
|
|
//-End Mixin
|
|
mixin summary(obj)
|
|
summary&attributes(obj)
|
|
block
|
|
//-End Mixin
|
|
mixin label(obj)
|
|
label&attributes(obj)
|
|
block
|
|
//-End Mixin
|
|
mixin repeating_section(name,header,id)
|
|
- htmlformat;
|
|
div(class=`repeating-${name}` id=`${(id||name).replace(/\s+/g,'-')}`)
|
|
if header
|
|
- htmlformat;
|
|
h3(data-i18n=header)
|
|
fieldset(class=`repeating_${name}`)
|
|
block
|
|
//-End Mixin
|
|
mixin pseudo-button(label,inputObj)
|
|
- hiddenObj = inputObj;
|
|
- hiddenObj.type = 'hidden';
|
|
+input(hiddenObj)
|
|
label.pseudo-button
|
|
span(data-i18n=label)
|
|
+input(inputObj)
|
|
//-End Mixin
|
|
mixin button-label(label,inputObj,buttonObj,divObj)
|
|
.input-label&attributes(divObj)
|
|
+input(inputObj)
|
|
+button(buttonObj)
|
|
//-End Mixin
|
|
mixin input-label(label,inputObj,divObj)
|
|
.input-label&attributes(divObj)
|
|
- inputObj.name = inputObj.name.replace(/\s+/g,'_');
|
|
+input(inputObj)
|
|
span(data-i18n=label)
|
|
//-End Mixin
|
|
mixin dual-input-label(label,inputArr,divObj)
|
|
.dual.input-label&attributes(divObj)
|
|
each inputObj,i in inputArr
|
|
- inputObj.name = inputObj.name.replace(/\s+/g,'_');
|
|
+input(inputObj)
|
|
if i<1
|
|
- htmlformat;
|
|
span(class='slash h2')='/'
|
|
- htmlformat;
|
|
span(data-i18n=label)
|
|
//-End Mixin
|
|
mixin headedTextarea(obj,header)
|
|
.headed-textarea&attributes(attributes)
|
|
+h3({'data-i18n':header})
|
|
+textarea(obj)
|
|
//-End Mixin
|
|
|
|
//- Functions
|
|
- const repeatAttrTitle = (section,attr) => `@{repeating_${section}_$X_${attr}}`;
|
|
- const repeatButtonTitle = (section,attr) => `%{repeating_${section}_$X_${attr||'roll'}}`; |