Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fc-pregmod
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pregmodfan
fc-pregmod
Commits
ad8738ec
Commit
ad8738ec
authored
4 years ago
by
brickode
Browse files
Options
Downloads
Patches
Plain Diff
Refactored rules() with new makeRule() function
parent
0093bdb2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!7285
Farmyard DOMification
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/facilities/farmyard/farmyard.js
+79
-92
79 additions, 92 deletions
src/facilities/farmyard/farmyard.js
with
79 additions
and
92 deletions
src/facilities/farmyard/farmyard.js
+
79
−
92
View file @
ad8738ec
...
@@ -393,118 +393,105 @@ App.Facilities.Farmyard.farmyard = function() {
...
@@ -393,118 +393,105 @@ App.Facilities.Farmyard.farmyard = function() {
if
(
App
.
Entity
.
facilities
.
farmyard
.
employeesIDs
().
size
>
0
)
{
// TODO: redo this with V.farmyardShowgirls
if
(
App
.
Entity
.
facilities
.
farmyard
.
employeesIDs
().
size
>
0
)
{
// TODO: redo this with V.farmyardShowgirls
if
(
V
.
farmyardShows
&&
(
V
.
canines
||
V
.
hooved
||
V
.
felines
))
{
if
(
V
.
farmyardShows
&&
(
V
.
canines
||
V
.
hooved
||
V
.
felines
))
{
const
const
rule
=
makeRule
(
desc
=
document
.
createElement
(
"
div
"
),
[
'
Slaves
'
,
'
are putting on shows with animals
'
],
option
=
document
.
createElement
(
"
span
"
),
'
are
'
,
bold
=
App
.
UI
.
DOM
.
makeElement
(
"
span
"
,
''
,
"
bold
"
);
"
End shows
"
,
[],
bold
.
append
(
`are`
);
[
"
farmyardShows
"
,
"
farmyardBreeding
"
,
"
farmyardRestraints
"
]
desc
.
append
(
`Slaves `
,
bold
,
` putting on shows with animals. `
);
);
option
.
append
(
App
.
UI
.
DOM
.
passageLink
(
"
End shows
"
,
"
Farmyard
"
,
()
=>
{
V
.
farmyardShows
=
0
;
V
.
farmyardBreeding
=
0
;
V
.
farmyardRestraints
=
0
;
}));
desc
.
append
(
option
);
frag
.
append
(
rule
);
frag
.
append
(
desc
);
if
(
V
.
seeBestiality
)
{
if
(
V
.
seeBestiality
)
{
if
(
V
.
farmyardBreeding
)
{
if
(
V
.
farmyardBreeding
)
{
const
const
rule
=
makeRule
(
desc
=
document
.
createElement
(
"
div
"
),
[
'
Slaves
'
,
'
are being bred with animals
'
],
option
=
document
.
createElement
(
"
span
"
),
'
are
'
,
bold
=
App
.
UI
.
DOM
.
makeElement
(
"
span
"
,
''
,
"
bold
"
);
"
End breeding
"
,
[
"
farmyardShows
"
],
bold
.
append
(
`are`
);
[
"
farmyardBreeding
"
,
"
farmyardRestraints
"
]
desc
.
append
(
`Slaves `
,
bold
,
` being bred with animals. `
);
);
option
.
append
(
App
.
UI
.
DOM
.
passageLink
(
"
End breeding
"
,
"
Farmyard
"
,
()
=>
{
V
.
farmyardShows
=
1
;
V
.
farmyardBreeding
=
0
;
V
.
farmyardRestraints
=
0
;
}));
desc
.
append
(
option
);
frag
.
append
(
rule
);
frag
.
append
(
desc
);
if
(
V
.
farmyardRestraints
)
{
if
(
V
.
farmyardRestraints
)
{
const
const
rule
=
makeRule
(
desc
=
document
.
createElement
(
"
div
"
),
'
are being restrained
'
,
option
=
document
.
createElement
(
"
span
"
),
'
All of the slaves
'
,
bold
=
App
.
UI
.
DOM
.
makeElement
(
"
span
"
,
''
,
"
bold
"
);
"
Restrain only disobedient slaves
"
,
[
"
farmyardShows
"
,
"
farmyardBreeding
"
],
bold
.
append
(
`All of the slaves`
);
[
"
farmyardRestraints
"
]
desc
.
append
(
` are being restrained. `
);
);
desc
.
prepend
(
bold
);
option
.
append
(
App
.
UI
.
DOM
.
passageLink
(
"
Restrain only disobedient slaves
"
,
"
Farmyard
"
,
()
=>
{
V
.
farmyardShows
=
1
;
V
.
farmyardBreeding
=
1
;
V
.
farmyardRestraints
=
0
;
}));
desc
.
append
(
option
);
frag
.
append
(
rule
);
frag
.
append
(
desc
);
}
else
{
}
else
{
const
const
rule
=
makeRule
(
desc
=
document
.
createElement
(
"
div
"
),
'
are being restrained
'
,
option
=
document
.
createElement
(
"
span
"
),
'
Only disobedient slaves
'
,
bold
=
App
.
UI
.
DOM
.
makeElement
(
"
span
"
,
''
,
"
bold
"
);
"
Restrain all slaves
"
,
[
"
farmyardShows
"
,
"
farmyardBreeding
"
,
"
farmyardRestraints
"
],
bold
.
append
(
`Only disobedient slaves`
);
[]
desc
.
append
(
` are being restrained. `
);
);
desc
.
prepend
(
bold
);
option
.
append
(
App
.
UI
.
DOM
.
passageLink
(
"
Restrain all slaves
"
,
"
Farmyard
"
,
()
=>
{
V
.
farmyardShows
=
1
;
V
.
farmyardBreeding
=
1
;
V
.
farmyardRestraints
=
1
;
}));
desc
.
append
(
option
);
frag
.
append
(
rule
);
frag
.
append
(
desc
);
}
}
}
else
{
}
else
{
const
const
rule
=
makeRule
(
desc
=
document
.
createElement
(
"
div
"
),
[
'
Slaves
'
,
'
being bred with animals
'
],
option
=
document
.
createElement
(
"
span
"
),
'
are not
'
,
bold
=
App
.
UI
.
DOM
.
makeElement
(
"
span
"
,
''
,
"
bold
"
);
"
Begin breeding
"
,
[
"
farmyardShows
"
,
"
farmyardBreeding
"
],
bold
.
append
(
`are not`
);
[
"
farmyardRestraints
"
]
desc
.
append
(
`Slaves `
,
bold
,
` being bred with animals. `
);
);
option
.
append
(
App
.
UI
.
DOM
.
passageLink
(
"
Begin breeding
"
,
"
Farmyard
"
,
()
=>
{
V
.
farmyardShows
=
1
;
V
.
farmyardBreeding
=
1
;
V
.
farmyardRestraints
=
0
;
}));
desc
.
append
(
option
);
frag
.
append
(
rule
);
frag
.
append
(
desc
);
}
}
}
}
}
else
{
}
else
{
const
const
rule
=
makeRule
(
desc
=
document
.
createElement
(
"
div
"
),
[
'
Slaves
'
,
'
putting on shows with animals
'
],
option
=
document
.
createElement
(
"
span
"
),
'
are not
'
,
bold
=
App
.
UI
.
DOM
.
makeElement
(
"
span
"
,
''
,
"
bold
"
);
"
Begin shows
"
,
[
"
farmyardShows
"
],
[
"
farmyardBreeding
"
,
"
farmyardRestraints
"
]
);
bold
.
append
(
`are not`
);
frag
.
append
(
rule
);
desc
.
append
(
`Slaves `
,
bold
,
` putting on shows with animals. `
);
}
}
option
.
append
(
App
.
UI
.
DOM
.
passageLink
(
"
Begin shows
"
,
"
Farmyard
"
,
()
=>
{
/**
V
.
farmyardShows
=
1
;
* Creates a new rule button
V
.
farmyardBreeding
=
0
;
* @param {string|[string]} descText The base description for the rule
V
.
farmyardRestraints
=
0
;
* @param {string} boldText The part in bold
}));
* @param {string} linkText The link text
* @param {[string]} enabled Variables to be set to 1
* @param {[string]} disabled Variables to be set to 0
*/
function
makeRule
(
descText
,
boldText
,
linkText
,
enabled
,
disabled
)
{
const
frag
=
new
DocumentFragment
(),
desc
.
append
(
option
);
desc
=
document
.
createElement
(
"
div
"
),
frag
.
append
(
desc
);
bold
=
App
.
UI
.
DOM
.
makeElement
(
"
span
"
,
boldText
,
"
bold
"
),
link
=
document
.
createElement
(
"
span
"
);
if
(
Array
.
isArray
(
descText
))
{
desc
.
append
(
`
${
descText
[
0
]}
`
,
bold
,
`
${
descText
[
1
]}
. `
);
}
else
{
desc
.
append
(
bold
,
`
${
descText
}
. `
);
}
}
link
.
append
(
App
.
UI
.
DOM
.
passageLink
(
linkText
,
"
Farmyard
"
,
()
=>
{
enabled
.
forEach
(
i
=>
V
[
i
]
=
1
);
disabled
.
forEach
(
i
=>
V
[
i
]
=
0
);
}));
desc
.
append
(
link
);
frag
.
append
(
desc
);
return
frag
;
}
}
return
frag
;
return
frag
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment