Skip to content

Instantly share code, notes, and snippets.

@alirezamirian
Last active January 9, 2017 07:35
Show Gist options
  • Save alirezamirian/fa346c4ddbc668afcc15c95afa7cf5e2 to your computer and use it in GitHub Desktop.
Save alirezamirian/fa346c4ddbc668afcc15c95afa7cf5e2 to your computer and use it in GitHub Desktop.
persian-recruitee

Persian Recruitee

Make your recruitee subdomain right-to-left and Persian by simply adding a couple of files to Custom CSS/JS section.

Usage

Add the following lines to Custom CSS/JS section:

<link href="https://rawgit.com/alirezamirian/fa346c4ddbc668afcc15c95afa7cf5e2/raw/styles.css" rel="stylesheet" />
<script src="https://rawgit.com/alirezamirian/fa346c4ddbc668afcc15c95afa7cf5e2/raw/scripts.js"></script>

Translation table

You can extend (or override) translation table which is used to translate different links and buttons. To do so, provide the global recruiteeTranslationTable before loading scripts.js:

<script>
window.recruiteeTranslationTable = { 
  "Company website": "وب‌سایت حصین"
}
</script>
<script src="https://rawgit.com/alirezamirian/fa346c4ddbc668afcc15c95afa7cf5e2/raw/scripts.js"></script>

Note:

Some parts of translations are done with CSS and you need to override related css rules if you wish to change them.

Bonus features

  • Add links whenever you are not able to (like in application form questions) by link macro:
link(http://hasin.ir,Hasin) 

This will get converted to: Hasin

  • Add custom attribute (like id, which is handy for in-page linking your content) by putting attr macro anywhere in your content:
attr(id,some-section)

This will set id attribute of the container of where you put it to some-section, and remove itself from the content.

$(function(){
var translationTable = $.extend({
'Job openings': "فرصت‌های شغلی",
'Apply with LinkedIn': " درخواست با LinkedIn ",
'Apply for this job': "برای این شغل درخواست دهید",
'Company website': "وب‌سایت شرکت",
'Submit application': "ثبت درخواست",
'Other Jobs': "سایر فرصت‌های شغلی"
}, window.recruiteeTranslationTable || {});
$("#candidate_name").attr("placeholder", "نام کامل شما");
$("#candidate_email").attr("placeholder", "ایمیل شما");
$("#candidate_phone").attr("placeholder", "شماره تماس شما");
$("a").toArray().forEach(function(el){
var text = $(el).text().trim();
if(text in translationTable){
array(el.childNodes).some(function(node){
if(node.nodeType == document.TEXT_NODE){
node.textContent = translationTable[text];
return true;
}
});
}
});
$("input[type=submit]").toArray().forEach(function(el){
var text = $(el).val().trim();
if(text in translationTable){
$(el).val(translationTable[text]);
}
});
$(".apply-now .btn").text("درخواست");
try{
$(".company-link i.fa").removeClass("fa-arrow-circle-right").addClass("fa-arrow-circle-left");
}
catch(e){}
$(":contains('link(')").toArray()
.filter(isLeaf).forEach(function(elem){
var elem = $(elem);
elem.html(elem.text().replace(/link\((.*?),(.*)\)/g, "<a href='\$1'>\$2</a>"))
});
$(":contains('attr(')").toArray().reduce(addChildren, [])
.filter(isTextNode).forEach(function(elem){
var elem = $(elem);
var regExp = /attr\((.*?),(.*)\)/g;
var matches = regExp.exec(elem.text());
console.log("matches", matches, elem.text());
window.elem = elem;
if(matches && matches.length == 3){
elem.parent().attr(matches[1], matches[2])
elem[0].textContent = elem.text().replace(regExp, '');
}
});
function array(collection){
var arr = [];
for(var i=0; i<collection.length; i++){
arr.push(collection[i]);
}
return arr;
}
function addChildren(coll, el){
return coll.concat(array(el.childNodes));
}
function isTextNode(node){
return node.nodeType == Node.TEXT_NODE && (typeof node.nodeValue == "string" && node.nodeValue.trim());
}
function isLeaf(elem){
console.log("children", $(elem).children());
return $(elem).children().length == 0
}
});
@font-face {
font-family: 'Iransans';
src: url('//myket.ir/assets/fonts/IRAN%20Sans.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
/* rtl and font */
input[type=email], input[type=password], input[type=url]{
direction: ltr;
}
#components-container, .offer-component, .component, .apply-form-component{
direction: rtl;
font-family: 'Iransans', sans-serif;
}
form label.checkbox input[type="checkbox"],
form label.radio input[type="radio"]{
margin-left: 8px;
margin-right: 0;
}
.apply-form-component .question{
border-left: none;
border-right: 1px solid #d8e3e7;
padding-right: 20px;
padding-left: 0;
}
.header-component .white-left-logo .navbar .container h1.brand,
.header-component .white-plain .navbar .container h1.brand,
.header-component .white-left-logo .navbar .container #navbar-collapse,
.header-component .white-plain .navbar .container #navbar-collapse{
float: right;
}
.header-component .breadcrumbs ul li:before{
content: '\f3d2';
left: 10px;
right: auto;
}
.header-component .breadcrumbs ul li{
padding-left: 10px;
padding-right: 0;
margin-right: 10px;
margin-left: 0;
}
.header-component a.company-link i.fa{
padding-left: 0px;
padding-right: 5px;
}
nav.navbar .pull-right{
float: left!important;
}
@media (min-width: 768px) {
.navbar-nav > li {
float: right;
}
}
.btn-linkedin i{
margin-left: 0;
margin-right: 5px;
}
.offers-component .simple-view .job .apply-now {
text-align: left;
float: left;
}
.offers-component .jobs .job .col-centered{
text-align: right;
}
.offers-component .simple-view .job .apply-now{
text-align: left;
}
.offers-component .simple-view .job .department {
float: right;
margin-left: 12px;
margin-right: 0;
}
/* end rtl and font */
/* translation */
nav ul.menu li a {
visibility: hidden;
padding: 10px 0;
}
nav ul.menu li a::before {
visibility: visible;
}
nav ul.menu li:nth-child(1) a::before {
content: "خانه";
}
nav ul.menu li:nth-child(2) a::before {
content: "تصاویر";
}
nav ul.menu li:nth-child(3) a::before {
content: "فرصت‌های شغلی";
}
.required-info{
visibility: hidden;
}
.required-info::before{
content: "* فیلدهای اجباری";
visibility: visible;
}
.form-group.optional .help-block{
visibility: hidden;
}
.form-group.optional .help-block::before{
content: "این فیلد اجباری نیست";
visibility: visible;
}
.form-group.required .help-block{
visibility: hidden;
}
.form-group.required .help-block::before{
content: "این فیلد اجباریست";
visibility: visible;
}
#new_candidate label{
position: relative;
}
#new_candidate label.required:before {
content: "*";
display: inline;
position: absolute;
right: -10px;
bottom: -4px;
color: darkorange;
visibility: visible;
}
#new_candidate section:nth-of-type(1) .control-label{visibility: hidden;}
#new_candidate section:nth-of-type(1) .control-label::after{visibility: visible;display: block;}
#new_candidate .control-label[for=candidate_name]::after{content: "نام و نام خانوادگی"}
#new_candidate .control-label[for=candidate_email]::after{content: "ایمیل"}
#new_candidate .control-label[for=candidate_phone]::after{content: "شماره تماس"}
#new_candidate .control-label[for=candidate_photo]::after{content: "عکس"}
#new_candidate .control-label[for=candidate_cv]::after{content: "رزومه"}
#new_candidate .candidate_cv::before{content: "رزومه"; display: block; margin-bottom: 5px; font-weight: bold}
.candidates-controller .breadcrumbs ul li:nth-child(1) a{
visibility: hidden;
}
.candidates-controller .breadcrumbs ul li:nth-child(1) a::after{
margin-right: -90px;
content: "فرصت‌های شغلی";
visibility: visible;
}
.candidates-controller .breadcrumbs ul li:nth-child(3) a{
visibility: hidden;
}
.candidates-controller .breadcrumbs ul li:nth-child(3) a::before{
content: "فرم ثبت نام";
visibility: visible;
}
.apply-form-component .applied-confirmation .info{
visibility: hidden;
height: 0;
}
.apply-form-component .applied-confirmation .info:before {
content: "درخواست همکاری شما ما موفقیت ثبت شد.";
display: block!important;
visibility: visible;
}
/* end translation */
#new_candidate div.col-md-3 {visibility: hidden;}
h3.alted {display:none;}
/* removing recruitee elems*/
.footer-logo{
display: none!important;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment