Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cosc320-une
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
Model registry
Operate
Environments
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Joshua Barlin
cosc320-une
Commits
720b52e7
Commit
720b52e7
authored
6 years ago
by
Andy C
Browse files
Options
Downloads
Patches
Plain Diff
Fixed comments
parent
6195a419
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
js/prototype3.js
+58
-35
58 additions, 35 deletions
js/prototype3.js
with
58 additions
and
35 deletions
js/prototype3.js
+
58
−
35
View file @
720b52e7
/**
* hideOptionGroup: Hides and disables an option group
*/
$
.
fn
.
hideOptionGroup
=
function
()
{
$
(
this
).
hide
();
$
(
this
).
children
().
each
(
function
()
{
...
...
@@ -7,6 +11,9 @@ $.fn.hideOptionGroup = function () {
}
/**
* showOptionGroup: Shows and enables an option group
*/
$
.
fn
.
showOptionGroup
=
function
()
{
$
(
this
).
show
();
$
(
this
).
children
().
each
(
function
()
{
...
...
@@ -16,9 +23,20 @@ $.fn.showOptionGroup = function () {
$
(
this
).
parent
().
animate
({
scrollTop
:
0
},
0
);
}
/**
* bodyParse: Replaces line breaks with paragraph tags
*
* @param {*} inText HTML to parse
*/
function
bodyParse
(
inText
)
{
return
inText
.
replace
(
/
(?:\r\n
|
\r
|
\n)
/g
,
'
</p><p>
'
);
}
/**
* buildHTML: Builds the output HTML code based on data
* entered in to template
*
*/
function
buildHTML
()
{
let
outputhtml
=
""
;
...
...
@@ -31,13 +49,16 @@ function buildHTML() {
}
// Build header unordered list
outputhtml
+=
"
<section aria-labelledby=
\"
une-hr-posnov-header
\"
>
"
;
outputhtml
+=
"
<h3 id=
\"
une-hr-posnov-header
\"
>Position overview</h3>
"
;
outputhtml
+=
"
<ul>
"
;
// Role type
if
(
$
(
"
#roletype
"
).
val
().
length
>
0
)
{
outputhtml
+=
"
<li>
"
+
$
(
"
#roletype
"
).
val
()
+
"
</li>
"
;
}
// Position type
outputhtml
+=
"
<li>
"
if
(
$
(
'
#posntype-dr4
'
).
val
()
!=
''
)
{
outputhtml
+=
$
(
'
#posntype-dr4
'
).
val
()
+
"
"
;
...
...
@@ -48,6 +69,7 @@ function buildHTML() {
}
outputhtml
+=
"
</li>
"
// Superannuation
if
(
$
(
"
#superpercentage
"
).
val
().
length
>
0
)
{
outputhtml
+=
"
<li>Plus
"
+
$
(
"
#superpercentage
"
).
val
()
+
"
% employer superannuation
"
;
if
(
$
(
'
#posntype-dr1
'
).
val
()
==
'
Continuing
'
||
$
(
'
#posntype-dr1
'
).
val
()
==
'
continuing
'
)
{
...
...
@@ -55,6 +77,8 @@ function buildHTML() {
}
outputhtml
+=
"
</li>
"
;
}
// Salary range
if
(
$
(
"
#salarylow
"
).
val
().
length
>
0
||
$
(
"
#salaryhigh
"
).
val
().
length
>
0
)
{
if
(
$
(
"
#salarylow
"
).
val
()
==
$
(
"
#salaryhigh
"
).
val
()
||
$
(
"
#salaryhigh
"
).
val
()
==
""
)
{
outputhtml
+=
"
<li>$
"
+
$
(
"
#salarylow
"
).
val
();
...
...
@@ -71,25 +95,32 @@ function buildHTML() {
outputhtml
+=
"
<li>
"
+
$
(
"
#posntier
"
).
val
()
+
"
</li>
"
;
}
}
// Relocation
if
(
$
(
"
#relocation
"
).
val
().
length
>
0
)
{
outputhtml
+=
"
<li>
"
+
$
(
"
#relocation
"
).
val
()
+
"
</li>
"
;
}
// Visa requirements
if
(
$
(
"
#visa
"
).
val
().
length
>
0
)
{
outputhtml
+=
"
<li>
"
+
$
(
"
#visa
"
).
val
()
+
"
</li>
"
;
}
outputhtml
+=
"
</ul>
"
;
outputhtml
+=
"
</section>
"
;
// About the role
if
(
$
(
"
#abouttherole-header
"
).
val
().
length
>
0
&&
$
(
"
#abouttherole-body
"
).
val
().
length
>
0
)
{
outputhtml
+=
"
<section aria-labelledby=
\"
une-hr-abtrlhd
\"
><h3 id=
\"
une-hr-abtrlhd
\"
>
"
+
$
(
"
#abouttherole-header
"
).
val
()
+
"
</h3>
"
;
outputhtml
+=
"
<p>
"
+
bodyParse
(
$
(
"
#abouttherole-body
"
).
val
())
+
"
</p></section>
"
;
}
// Skills & experience
if
(
$
(
"
#skillsandexperience-header
"
).
val
().
length
>
0
&&
$
(
"
#skillsandexperience-body
"
).
val
().
length
>
0
)
{
outputhtml
+=
"
<section aria-labelledby=
\"
une-hr-skillshd
\"
><h3 id=
\"
une-hr-skillshd
\"
>
"
+
$
(
"
#skillsandexperience-header
"
).
val
()
+
"
</section>
"
;
outputhtml
+=
"
<p>
"
+
bodyParse
(
$
(
"
#skillsandexperience-body
"
).
val
())
+
"
</p></section>
"
;
}
// Additional information
if
(
$
(
"
#contactname
"
).
val
().
length
>
0
||
$
(
"
#contactposition
"
).
val
().
length
>
0
||
$
(
"
#contactnumber
"
).
val
().
length
>
0
||
$
(
"
#contactemail
"
).
val
().
length
>
0
)
{
outputhtml
+=
"
<section aria-labelledby=
\"
une-hr-additinfohd
\"
><h3 id=
\"
une-hr-additinfohd
\"
>Additional information</h3><p>
"
outputhtml
+=
"
To discuss this opportunity, please contact
"
;
...
...
@@ -109,22 +140,22 @@ function buildHTML() {
outputhtml
+=
"
by email: <a href='mailto:
"
+
$
(
"
#contactemail
"
).
val
()
+
"
'>
"
+
$
(
"
#contactemail
"
).
val
()
+
"
</a>
"
;
}
outputhtml
+=
"
</p></section>
"
;
}
// About Armidale
if
(
$
(
"
#aboutarmidale-header
"
).
val
().
length
>
0
&&
$
(
"
#aboutarmidale-body
"
).
val
().
length
>
0
)
{
outputhtml
+=
"
<section aria-labelledby=
\"
une-hr-abtarmhd
\"
><h3 id=
\"
une-hr-abtarmhd
\"
>
"
+
$
(
"
#aboutarmidale-header
"
).
val
()
+
"
</h3>
"
;
outputhtml
+=
"
<p>
"
+
bodyParse
(
$
(
"
#aboutarmidale-body
"
).
val
())
+
"
</p></section>
"
;
}
// Close date
outputhtml
+=
"
<section aria-labelledby=
\"
une-hr-furinfhd
\"
><h3 id=
\"
une-hr-furinfhd
\"
>Further information</h3>
"
;
if
(
$
(
"
#closedate
"
).
val
().
length
>
0
)
{
var
d
=
new
Date
(
$
(
"
#closedate
"
).
val
());
outputhtml
+=
"
<p>
"
+
"
<strong>Cosing Date: </strong>:
"
+
(
d
.
getDay
())
+
"
/
"
+
(
d
.
getMonth
()
+
1
)
+
"
/
"
+
(
d
.
getFullYear
())
+
"
</p>
"
;
}
// Reference Number
if
(
$
(
"
#referencenumber
"
).
val
().
length
>
0
)
{
outputhtml
+=
"
<p>
"
+
"
<strong>Reference No: </strong>:
"
+
$
(
"
#referencenumber
"
).
val
()
+
"
</p>
"
;
}
...
...
@@ -141,6 +172,11 @@ function buildHTML() {
return
outputhtml
;
}
/**
* copyToClipboard: Copies string to user's clipboard
*
* @param {*} str String to copy to clipboard
*/
function
copyToClipboard
(
str
)
{
// Create new element
var
el
=
document
.
createElement
(
'
textarea
'
);
...
...
@@ -159,24 +195,15 @@ function copyToClipboard(str) {
alert
(
'
Successfully copied to advert HTML code to your clipboard :)
'
);
}
/**
* jQuery document ready function
*/
$
(
document
).
ready
(
function
()
{
/*
$('#sectionbutton').click(function () {
switch ($('#sectiondropdown').val()) {
case "continuing":
$("#continuing").show();
$("#casual").hide();
break;
case "casual":
$("#casual").show();
$("#continuing").hide();
break;
}
});
*/
$
(
"
#continuing
"
).
show
();
$
(
"
#casual
"
).
hide
();
// Build position type continuing or contract drop down
$
(
'
#posntype-dr1
'
).
on
(
'
change
'
,
function
()
{
if
(
$
(
this
).
val
()
==
'
contract
'
)
{
$
(
'
#posntype-dr4
'
).
attr
(
'
disabled
'
,
false
);
...
...
@@ -189,6 +216,8 @@ $(document).ready(function () {
$
(
'
#posntype-dr4
'
).
hide
();
}
});
// Build position type full-time and part-time drop down
$
(
'
#posntype-dr2
'
).
on
(
'
change
'
,
function
()
{
if
(
$
(
this
).
val
()
==
'
part time
'
)
{
$
(
'
#posntype-dr3
'
).
attr
(
'
disabled
'
,
false
);
...
...
@@ -201,34 +230,26 @@ $(document).ready(function () {
$
(
'
#posntype-dr3
'
).
hide
();
}
});
// Hide other position type drop downs until one dr1 and dr2 are selected
$
(
'
#posntype-dr3
'
).
hide
();
$
(
'
#posntype-dr4
'
).
hide
();
// Build work days per fortnight drop down
for
(
i
=
1
;
i
<=
9
;
i
++
)
{
var
$op
=
$
(
'
<option>
'
);
$op
.
text
(
i
+
'
days per fortnight
'
);
$op
.
val
(
i
+
'
days per fortnight
'
);
$
(
'
#posntype-dr3-days
'
).
append
(
$op
);
}
// Build months contract drop down
for
(
i
=
3
;
i
<=
24
;
i
++
)
{
var
$op
=
$
(
'
<option>
'
);
$op
.
text
(
i
+
'
months
'
);
$op
.
val
(
i
+
'
month
'
);
$
(
'
#posntype-dr4-months
'
).
append
(
$op
);
}
/*
Removed this. Not sure if will need later so keeping it for now.
$('#hide-jobinformation').click(function () {
$('#jobinformation').find('input:text').val('');
$("#jobinformation").hide();
});
$('#hide-informationservices').click(function () {
$('#informationservices').find('input:text').val('');
$('#informationservices').find('textarea').val('');
$("#informationservices").hide();
});
*/
// Update code button in the center of form
$
(
'
#update-code
'
).
click
(
function
()
{
...
...
@@ -237,6 +258,8 @@ $(document).ready(function () {
$article
.
css
(
'
border
'
,
'
1px solid black
'
);
$
(
'
#output-div
'
).
html
(
'
<h2 id="output-header">Advert preview:</h2>
'
+
$article
[
0
].
outerHTML
);
});
// Copy code to output section
$
(
'
#copy-code
'
).
click
(
function
()
{
var
$article
=
$
(
'
<textarea>
'
);
$article
.
text
(
buildHTML
());
...
...
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