CINXE.COM
Find a job in Canada as a veteran - Job Bank
<!DOCTYPE html> <html class="no-js" lang="en" dir="ltr"><head id="j_id_5"> <meta charset="utf-8" /> <title>Find a job in Canada as a veteran - Job Bank </title> <meta content="width=device-width,initial-scale=1" name="viewport" /> <meta name="dcterms.language" content="eng" /> <meta name="dcterms.creator" content="Employment and Social Development Canada" /> <meta name="dcterms.service" content="ESDC-EDSC_JobBank-GuichetEmplois" /> <meta name="dcterms.accessRights" content="2" /><meta name="dcterms.title" content="Find a job in Canada as a veteran - Job Bank" /> <meta property="og:title" content="Find a job in Canada as a veteran - Job Bank" /> <meta name="description" property="og:description" content="Find available jobs, employment resources and career advice for Veterans of the Canadian Armed Forces." /> <meta property="og:url" content="http://www.jobbank.gc.ca/landing-veterans.xhtml" /> <meta property="og:image" content="https://www.jobbank.gc.ca/themes-sat/assets/favicon-mobile.png" /> <meta name="smartbanner:title" content="Job Bank" /> <meta name="smartbanner:author" content="ESDC – EDSC" /> <meta name="smartbanner:price" content="Free" /> <meta name="smartbanner:price-suffix-apple" content="– On the App Store" /> <meta name="smartbanner:price-suffix-google" content="– In Google Play" /> <meta name="smartbanner:icon-apple" content="/themes-jb/images/icons/mobileapp/icons-512.png" /> <meta name="smartbanner:icon-google" content="/themes-jb/images/icons/mobileapp/icons-512.png" /> <meta name="smartbanner:button" content="Free" /> <meta name="smartbanner:button-url-apple" content="https://itunes.apple.com/ca/app/job-bank/id1351432365?mt=8" /> <meta name="smartbanner:button-url-google" content="https://play.google.com/store/apps/details?id=ca.jobbank.mobile&amp;hl=en" /> <meta name="smartbanner:enabled-platforms" content="android,ios" /> <meta name="smartbanner:exclude-user-agent-regex" content=".*(Tablet|iPad|Windows).*" /> <meta name="smartbanner:hide-ttl" content="86400000" /> <meta name="smartbanner:custom-design-modifier" content="jobbanksb" /> <meta name="smartbanner:tagline" content="Your career starts here" /> <meta name="smartbanner:download" content="Download the app now" /> <meta name="smartbanner:close" content="Close" /> <link rel="stylesheet" href="/themes-jb/js/third-party/smartbanner/smartbanner.css" /> <script src="/themes-jb/js/third-party/smartbanner/smartbanner.js"></script> <script> var onLoadHandlerForConflictTesting = function() {}; window.onload = onLoadHandlerForConflictTesting; </script><meta name="smartbanner:page" content="introLandingPage" /><link type="text/css" rel="stylesheet" href="/jakarta.faces.resource/primeicons/primeicons.css.xhtml;jsessionid=F27DCF984C6212348177AC0392E3BB16.jobsearch74?ln=primefaces&v=12.0.0" /><script type="text/javascript">if(window.PrimeFaces){PrimeFaces.settings.locale='en_CA';PrimeFaces.settings.viewId='/landing-veterans.xhtml';PrimeFaces.settings.contextPath='';PrimeFaces.settings.cookiesSecure=false;}</script> <link href="/themes-sat/assets/favicon.ico" rel="icon" type="image/x-icon" /> <link rel="stylesheet" href="/themes-sat/css/theme.min.css" /> <link rel="stylesheet" href="/themes-sat/css/cdtsfixes.css" /> <link rel="stylesheet" href="/themes-sat/css/apps.css" /> <link href="/themes-jb/fontawesomepro/css/all.min.css" rel="stylesheet" /> <link href="/themes-jb/fontawesomepro/css/v4-shims.min.css" rel="stylesheet" /> <link rel="stylesheet" href="/themes-jb/js/css/jquery.timepicker.css" /> <link rel="stylesheet" href="/themes-jb/css/theme-jb.css" /> <link rel="stylesheet" href="/themes-jb/js/css/typeahead.css" /> <noscript> <link rel="stylesheet" href="/themes-sat/css/noscript.min.css" /> <link rel="stylesheet" href="/themes-sat/css/appsnoscript.css" /> </noscript> <link rel="stylesheet" href="/themes-jb/css/project-jb-style.css" /> <link rel="stylesheet" href="/themes-jb/css/project-style.css" /> <link rel="stylesheet" href="/themes-jb/css/animate.css" /><!--[if lt IE 9]> <link rel="stylesheet" href="/themes-jb/css/project-style-ie8.css" /><![endif]--> <link rel="stylesheet" href="/invitation-manager/Overlay.css" /> <script> //<![CDATA[ dataLayer1 = []; (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-W625MMN'); //]]> </script> <script src="//assets.adobedtm.com/be5dfd287373/9b9cb7867b5b/launch-59d77766b86a.min.js"></script></head><body vocab="https://schema.org/" typeof="WebPage"> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W625MMN" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <nav> <ul id="wb-tphp"> <li class="wb-slc"><a class="wb-sl" href="#wb-cont">Skip to main content</a></li> <li class="wb-slc visible-sm visible-md visible-lg"><a class="wb-sl" href="#wb-info">Skip to "About this Web application"</a></li> </ul> </nav> <header> <div id="wb-bnr" class="container"> <div class="row"> <section id="wb-lng" class="pull-right text-right"> <h2 class="wb-inv">Language selection</h2> <ul class="list-inline mrgn-bttm-0"> <li> <a href="https://www.guichetemplois.gc.ca/veterans" lang="fr"> <span class="hidden-xs">Français</span> <abbr title="Français" class="visible-xs h3 mrgn-tp-sm mrgn-bttm-0 text-uppercase">fr</abbr> </a> </li> </ul> </section> <div class="brand col-xs-9 col-sm-5 col-md-4" property="publisher" typeof="GovernmentOrganization"> <img src="/themes-sat/assets/sig-blk-en.svg" alt="" property="logo" /><span class="wb-inv" property="name"> Government of Canada / <span lang="fr">Gouvernement du Canada</span></span> <meta property="areaServed" typeof="Country" content="Canada" /> <link property="logo" href="/themes-sat/assets/wmms-blk.svg" /> </div> <section id="wb-srch" class="col-lg-offset-4 col-md-offset-4 col-sm-offset-2 col-xs-12 col-sm-5 col-md-4 visible-md visible-lg"> <h2>Search</h2> <form action="#" method="post" name="cse-search-box" role="search" class="form-inline"> <div class="form-group wb-srch-qry"> <label for="wb-srch-q" class="wb-inv">Search website</label> <input id="wb-srch-q" class="wb-srch-q form-control" name="q" type="search" value="" size="34" maxlength="170" placeholder="Search" /> </div> <div class="form-group submit"> <button type="submit" id="wb-srch-sub" class="btn btn-primary btn-small" name="wb-srch-sub"><span class="glyphicon-search glyphicon"></span><span class="wb-inv">Search</span></button> </div> </form> </section> </div> </div> <div class="app-bar"> <div class="container"> <div class="row"> <section class="col-xs-12 col-sm-7"> <h2 class="wb-inv">Name of Web application</h2> <a class="app-name" href="https://www.jobbank.gc.ca/home">Job Bank</a> </section> <nav class="col-sm-5 hidden-xs hidden-print"><form id="j_id_23_4" name="j_id_23_4" method="post" action="/veterans;jsessionid=F27DCF984C6212348177AC0392E3BB16.jobsearch74" class="dept-nav" enctype="application/x-www-form-urlencoded"> <h2 class="wb-inv">Account menu</h2> <ul class="app-list-account list-unstyled"> <li class="signon btn-group pull-right "> <button type="button" class="btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="title"><span class="in-icon fas fa-user-circle fa-lg" aria-hidden="true"></span> <span class="fullName">Sign in</span><span class="fa fa-chevron-down" aria-hidden="true"></span></span> </button> <ul class="dropdown-menu"> <li><a href="https://www.jobbank.gc.ca/login">Job seekers</a></li> <li><a href="https://employer.jobbank.gc.ca/employer/dashboard">Employers</a></li> </ul> </li> </ul><input type="hidden" name="j_id_23_4_SUBMIT" value="1" /><input type="hidden" name="jakarta.faces.ViewState" id="j_id__v_0:jakarta.faces.ViewState:1" value="stateless" autocomplete="off" /></form> </nav> </div> </div> </div> <div class="app-bar-mb container visible-xs-block hidden-print"> <nav> <h2 class="wb-inv">Menu and search</h2> <ul class="app-list-main list-unstyled"> <li class="wb-mb-links" id="wb-glb-mn"><a href="#mb-pnl" aria-controls="mb-pnl" class="btn overlay-lnk" role="button">Menu</a><h2>Menu</h2></li> </ul> <div id="mb-pnl"></div> </nav> <nav> <h2 class="wb-inv">Account menu</h2><form id="j_id_25_3" name="j_id_25_3" method="post" action="/veterans;jsessionid=F27DCF984C6212348177AC0392E3BB16.jobsearch74" class="dept-nav" enctype="application/x-www-form-urlencoded"> <ul class="app-list-account list-unstyled"> <li class="signon btn-group pull-right "> <button type="button" class="btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="title"><span class="in-icon fas fa-user-circle fa-lg" aria-hidden="true"></span> <span class="fullName">Sign in</span><span class="fa fa-chevron-down" aria-hidden="true"></span></span> </button> <ul class="dropdown-menu"> <li><a href="https://www.jobbank.gc.ca/login">Job seekers</a></li> <li><a href="https://employer.jobbank.gc.ca/employer/dashboard">Employers</a></li> </ul> </li> </ul><input type="hidden" name="j_id_25_3_SUBMIT" value="1" /><input type="hidden" name="jakarta.faces.ViewState" id="j_id__v_0:jakarta.faces.ViewState:2" value="stateless" autocomplete="off" /></form> </nav> </div> <nav id="wb-sm" data-ajax-replace="/themes-sat/ajax/appmenu.xhtml?TF=false" data-trgt="mb-pnl" class="wb-menu visible-md visible-lg" typeof="SiteNavigationElement"> <div class="pnl-strt container nvbar"> <h2 class="wb-inv">Main navigation menu</h2> <div class="row"> <ul class="list-inline menu" role="menubar"> <li role="none"><a href="https://www.jobbank.gc.ca/findajob" class="item">Job search</a></li> <li role="none"><a href="https://www.jobbank.gc.ca/career-planning" class="item">Career planning</a></li> <li role="none"><a href="https://www.jobbank.gc.ca/trend-analysis" class="item">Labour market information</a></li> <li role="none"><a href="https://www.jobbank.gc.ca/employers" class="item">Hiring</a></li> <li role="none"><a href="https://www.jobbank.gc.ca/aboutus" class="item">Help</a></li> <li role="none"><a href="https://www.jobbank.gc.ca/intro" class="item">About</a></li> </ul> </div> </div> </nav> <nav id="wb-bc" property="breadcrumb"> <h2>You are here:</h2> <div class="container"> <ol class="breadcrumb"><li><a href="https://www.jobbank.gc.ca/" >Job Bank</a></li> </ol> </div> </nav> </header> <div id="header-search"> </div> <div class="veterans-landing theme-dark prm-flpr"> <div class="container"> <div class="row"> <section class="hero-content-wrapper"> <div class="hero-content-wrapper-inner"> <div class="cover-container"> <section id="alert-info-container" class="alert alert-info"><p><a href="https://www.jobbank.gc.ca/reg/instructions">Boost your job search with a Plus account</a></p> </section> <div id="messageblock-content" tabindex="-1"><div id="messageblock" role="region" aria-live="polite"></div> </div> <div class="inner cover demo-content-head"> <h1 property="name" id="wb-cont" class="cover-heading"><span class="directory">Veterans</span> Find a job in Canada as a veteran</h1> <div id="jobSearchBar" class="search-input-content home-page"> <form id="homePage" class="search-module" action="/jobsearch/jobsearch" accept-charset="UTF-8"> <fieldset> <legend class="wb-inv"> Search </legend> <div class="input-wrapper"> <div class="input-group input-dual"> <div class="input-combo col-md-6"> <div class="input-field"> <label class="input-label" for="searchString">Keywords:</label> <input name="searchstring" id="searchString" type="text" class="searchString form-control input-lg" value="" placeholder="Job title, employer" maxlength="1000" /> </div> </div> <div class="input-combo col-md-6"> <div class="ta-cityprovsuggest input-field"><label id="searchLocationLabel" class="input-label" for="locationstring">Location:<span id="error-loc-input-field"></span></label><input id="locationstring" name="locationstring" type="text" value="" class="locationstring form-control input-lg" placeholder="City, province or territory" /> <span id="ta-citysuggest-suggestioncount" data-name="suggestioncount" role="status" aria-live="polite" class="form-control typeahead-helper-hidden-accessible"></span> <span role="status" id="ta-citysuggest-selected-title" class="form-control ta-jobtitlesuggest-message ta-communitysuggest-selected-title typeahead-helper-hidden-accessible"></span><input type="hidden" id="locationparam" name="locationparam" value="" /> <div id="cityPostalCodeSpecial" class="tt-menu wb-inv"> <div class="tt-dataset tt-dataset-ta-cityprovsuggest"> <ul> <li><a href="#" data-input="canada"><span class="fab fa-canadian-maple-leaf" aria-hidden="true"></span> All of Canada</a></li> <li><a href="#" data-input="local"><span class="far fa-bullseye-pointer" aria-hidden="true"></span> Current location</a></li> </ul> </div> </div> </div> </div> <div class="input-group-btn"> <div id="defaultsubmit" class="hidden"> <button id="searchButtonDefault" type="submit">Search</button> </div> <div class="results"> <button id="advanced-search-button" class="secondary-functions btn btn-link nowrap" type="submit" onclick="actiontodataurl(this);" data-url="/jobsearch/advancedsearch">Advanced</button> <a class="secondary-functions btn btn-link nowrap" href="/browsejobs">Browse</a> </div> <button id="searchButton" class="btn btn-primary" type="submit"><span class="fa-icon far fa-search" aria-hidden="true"></span> Search</button> </div> </div> </div> <div class="clearfix"></div> <div id="audience-filter" class="mrgn-tp-md col-md-12"> <div class="checkbox"> <input id="audience-chkbox" type="checkbox" value="1" name="fjvt" /> <label for="audience-chkbox">Only show jobs from employers who support veterans</label> </div> </div> <div class="clearfix"></div> <div id="search-filter" class="row col-md-12"> <div class="sort">Sort by:</div> <div class="sort-group"> <div class="radio"> <input type="radio" name="sort" id="sf_bestmatch" value="M" checked="checked" /> <label for="sf_bestmatch">Best match</label> </div> <div class="radio"> <input type="radio" name="sort" id="sf_dateposted" value="D" /> <label for="sf_dateposted">Date posted</label> </div> <div class="checkbox"> <input id="sf_last30days" type="checkbox" value="30" name="fage" /> <label for="sf_last30days">Last 30 days</label> </div> <div class="clearfix"></div> </div> </div> <div class="clearfix"></div> </fieldset> </form> </div> <div class="clearfix"></div> <div class="clearfix"></div> </div> </div> </div> </section> </div> </div> </div> <main role="main" property="mainContentOfPage"> <div class="grey bg demo-content-wrapper"> <div class="container"> <section class="header-section col-md-12 demo-content"> <div class="demo-content-details-center"> <h2 class="text-center">Job Bank for Veterans</h2> <div class="col-md-8 col-md-offset-2"> <p>Job Bank is committed to helping Veterans transition to meaningful careers in the civilian workforce. You’ll find information here about Job Bank’s services that can assist you in your job search.</p> </div> </div> </section> </div> </div> <div class="demo-content-wrapper grid-wrapper"> <section class="col-md-12 demo-content"> <div class="grid-set"> <div class="row"> <div class="col-lg-6 grid-set-card veterans-landing-K dark"> <div class="grid-set-card-heading-dual"> <div class="grid-set-item"> <div> <h2>Our story</h2> <p class="description">Job Bank has helped transitioning military members enter the civilian workforce for over one hundred years – in fact, that’s how we started. <a href="https://www.jobbank.gc.ca/aboutus">Learn more</a> about our rich history.</p> </div> </div> </div> </div> <div class="col-lg-6 grid-set-card"> <div class="grid-set-card-heading-dual"> <div class="grid-set-item"> <div> <p class="description">We have collaborated with the Canadian Armed Forces Transition Group and Veterans Affairs Canada to provide you the resources you need to start your next mission and find your new career.</p> </div> </div> </div> </div> </div> </div> </section> </div> <div class="clearfix"></div> <div class="grey bg demo-content-wrapper"> <div class="container"> <section class="col-md-12 demo-content"> <div class="demo-content-details"> <div class="col-md-12 row text-center"> <h2 class="text-center">How can we help you?</h2> <p>Find tools and resources to help with your transition.</p> </div> </div> </section> </div> </div> <div class="demo-content-wrapper"> <div class="container"> <section class="demo-content"> <div class="demo-content-details"> <div class="col-md-12"> <div class="col-md-7 row"> <h2>Use Job Bank</h2><p>Get a quick tour of Job Bank and learn how to use the tools and services available to you.</p> <div class="demo-content-setbox col-md-12 row"> <h3>Tools include:</h3> <ul class="fa-ul fa-right"> <li><span class="fa-li" aria-hidden="true"><span class="fas fa-check"></span></span>Job Search</li> <li><span class="fa-li" aria-hidden="true"><span class="fas fa-check"></span></span>Job Alerts</li> <li><span class="fa-li" aria-hidden="true"><span class="fas fa-check"></span></span>Job Match</li> <li><span class="fa-li" aria-hidden="true"><span class="fas fa-check"></span></span>Resume-Builder</li> </ul> </div> <p><p>Download the <a href="https://www.jobbank.gc.ca/mobileapp">mobile app</a> for convenient job searching from your mobile device.</p></p> <div class="col-md-6 row call-to-action sub"><a href="/intro/findajob">Learn more</a></div> </div> <div class="col-md-5 row demo-content-head hidden-xs"> <div class="feature-hero-object jb web-screenshot-en"></div> </div> <div class="clearfix"></div> </div> </div> <div class="clearfix"></div> </section> </div> </div> <div class="grey bg demo-content-wrapper"> <div class="container"> <section class="demo-content"> <div class="demo-content-details"> <div class="col-md-12"> <div class="col-md-5 service-content-details service-content-image"> <img src="themes-jb/images/veterans/veterans-seeker3.jpg" class="photo full-width" alt="" /> </div> <div class="col-md-7"> <h2>Translate your job title</h2> <p>Civilian employers sometimes use different terms for job titles and skills. Use the Military to Civilian job translator to find your job title civilian equivalent and give yourself the best chance at succeeding.</p> <div class="demo-content-setbox col-md-12"> <p class="emphasis"><span class="fas fa-info-circle fa-3x fa-pull-right"></span>Once you identify the civilian job title for your military occupation, you may want to include those job titles in your resume. Check out our <a href="https://www.jobbank.gc.ca/findajob/resume-builder">Resume Builder</a> tool support you in preparing your resume.</p> </div> <div class="clearfix"></div> <div class="col-md-6 row call-to-action sub"><a href="https://caface-rfacace.forces.gc.ca/mnet-oesc/en/cafSearch">Try it now</a></div> </div> <div class="clearfix"></div> </div> </div> <div class="clearfix"></div> </section> </div> </div> <div class="demo-content-wrapper"> <div class="container"> <section class="demo-content"> <div class="demo-content-details"> <div class="col-md-12"> <h2>Sign-Up to My VAC Account</h2><p>Make sure you get access to all of the services available to you by signing up for <a href="https://www.veterans.gc.ca/eng/e_services">My VAC account</a>.</p> <div class=""> <div class="demo-content-setbox col-md-10"> <h3>You can:</h3> <ul class="fa-ul fa-right"> <li><span class="fa-li" aria-hidden="true"><span class="fas fa-check"></span></span>Learn about and apply to VAC benefits and services.</li> <li><span class="fa-li" aria-hidden="true"><span class="fas fa-check"></span></span>Upload documents and track your applications.</li> <li><span class="fa-li" aria-hidden="true"><span class="fas fa-check"></span></span>Connect directly with VAC staff through secure messaging.</li> </ul> </div> <div class="clearfix"></div> <div class="demo-content-setbox col-md-10"> <h3>Register for My VAC Account if you are a:</h3> <ul class="fa-ul fa-right"> <li><span class="fa-li" aria-hidden="true"><span class="fas fa-check"></span></span>Veteran</li> <li><span class="fa-li" aria-hidden="true"><span class="fas fa-check"></span></span>Canadian Armed Forces (CAF) or Royal Canadian Mounted Police (RCMP) member</li> <li><span class="fa-li" aria-hidden="true"><span class="fas fa-check"></span></span>Family member receiving of benefits from VAC</li> </ul> </div> <div class="clearfix"></div> </div> <div class="col-md-4 row call-to-action sub mrgn-bttm-lg"><a href="https://www.veterans.gc.ca/eng/e_services">Learn more</a></div> </div> <div class="col-md-5 row"></div> <div class="clearfix"></div> </div> <div class="clearfix"></div> </section> </div> </div> <div class="grey bg demo-content-wrapper"> <div class="container"> <section class="demo-content"> <div class="demo-content-details"> <div class="col-md-12"> <div class="col-md-5 row"> <div class="veterans-quiz-img-en rotate-A"> <div class="bottom-transition"></div> </div> </div> <div class="col-md-7 row"> <h2>Try career quizzes</h2> <p>Unsure of what to do next? Take a Career Quiz to find out what occupations outside of the military may be a good fit for you.</p> <div class="col-md-6 row call-to-action sub"><a href="/career-planning/quizzes">See quizzes</a></div> </div> <div class="clearfix"></div> </div> </div> <div class="clearfix"></div> </section> </div> </div> <div class="demo-content-wrapper"> <div class="container"> <section class="header-section col-md-12 demo-content"> <div class="demo-content-details-center"> <h2 class="text-center">Resources</h2> <div class="col-set wb-eqht"> <div class="col-md-4 row col-set-box col-a"> <div class="col-set-heading veterans-seeker-img bgZoomIn-A"> <div class="dark-bg"> <h3>Education and training</h3> </div> </div> <ul> <li><span class="fas fa-chevron-right fa-icon" aria-hidden="true"></span><a href="https://caface-rfacace.forces.gc.ca/en/browse_credits">My skills and education translator</a></li> <li><span class="fas fa-chevron-right fa-icon" aria-hidden="true"></span><a href="https://www.veterans.gc.ca/eng/about-vac/legislation-policies/policies/document/2685">VAC education and training benefit</a></li> </ul> </div> <div class="col-md-4 row col-set-box col-a"> <div class="col-set-heading veterans-employer-img bgZoomIn-A"> <div class="dark-bg"> <h3>Career transition</h3> </div> </div> <ul> <li><span class="fas fa-chevron-right fa-icon" aria-hidden="true"></span><a href="https://www.veterans.gc.ca/eng/education-and-jobs/finding-a-job/career-transition-services">Veterans Affairs Canada</a></li> <li><span class="fas fa-chevron-right fa-icon" aria-hidden="true"></span><a href="https://www.canada.ca/en/department-national-defence/services/benefits-military/transition/understanding-transition/transition-centres.html">Canadian Armed Forces transition centres</a></li> </ul> </div> <div class="col-md-4 row col-set-box col-a"> <div class="col-set-heading veterans-opportunities-img bgZoomIn-A"> <div class="dark-bg"> <h3>Employment opportunities</h3> </div> </div> <ul> <li><span class="fas fa-chevron-right fa-icon" aria-hidden="true"></span><a href="https://www.canada.ca/en/public-service-commission/jobs/services/gc-jobs/canadian-armed-forces-members-veterans/transition-to-the-federal-public-service.html">Find public service jobs</a></li> <li><span class="fas fa-chevron-right fa-icon" aria-hidden="true"></span><a href="https://emploisfp-psjobs.cfp-psc.gc.ca/psrs-srfp/applicant/page2440?fromMenu=true&toggleLanguage=en">Apply for federal public service jobs</a></li> </ul> </div> </div> </div> </section> </div> </div> <div class="container pagedetails"> <div class="row"> <div class="col-sm-6 col-lg-4 mrgn-tp-sm hidden"> <a href="https://www.canada.ca/en/report-problem.html" class="btn btn-default btn-block">Report a problem or mistake on this page</a> </div> <div class="col-sm-3 mrgn-tp-sm pull-right hidden"> <div class="wb-share" data-wb-share="{"lnkClass": "btn btn-default btn-block"}"></div> </div> </div> <div id="feedback-tool-div"> <div class="wb-disable-allow" data-ajax-replace="https://www.canada.ca/etc/designs/canada/wet-boew/assets/feedback/page-feedback-en.html" data-feedback-section="Job bank" data-feedback-theme="Jobs"> </div> </div> <dl id="wb-dtmd"> <dt>Date modified: </dt> <dd><time property="dateModified">2024-09-17</time></dd> </dl> </div> </main> <footer id="wb-info"> <div class="gc-contextual"> <div class="container"> <nav> <h2 class="wb-inv">Related links</h2> <ul class="list-col-xs-1 list-col-sm-2 list-col-md-3"> <li><a href="/helpsupport">Job Bank Support</a></li> <li><a href="/aboutus">About us</a></li> <li><a href="https://www.jobbank.gc.ca/intro">Introduction to Job Bank</a></li> <li><a href="https://www.jobbank.gc.ca/network">Our network</a></li> <li> <a href="/termsofuseseeker">Terms of use - Job seekers</a> </li> <li> <a href="/termsofuseemployer">Terms of use - Employers</a> </li> </ul> </nav> </div> </div> <div class="gc-sub-footer"> <div class="container d-flex align-items-center"> <nav aria-labelledby="aboutWebApp"> <h3 class="wb-inv" id="aboutWebApp">Government of Canada Corporate</h3> <ul> <li><a href="https://www.canada.ca/en/transparency/terms.html" target="_blank" rel="noopener">Terms and conditions<span class="wb-inv"> This link will open in a new window</span></a></li> <li><a href="https://www.canada.ca/en/transparency/privacy.html" target="_blank" rel="noopener">Privacy<span class="wb-inv"> This link will open in a new window</span></a></li> </ul> </nav> <div class="col-xs-6 visible-sm visible-xs tofpg"> <a href="#wb-cont">Top of Page <span class="glyphicon glyphicon-chevron-up"></span></a> </div> <div class="wtrmrk align-self-end"> <img src="/themes-sat/assets/wmms-blk.svg" alt="Symbol of the Government of Canada" /> <meta property="areaServed" typeOf="Country" content="Canada" /> <link property="logo" href="/themes-sat/assets/wmms-blk.svg" /> </div> </div> </div> </footer> <script src="/themes-sat/js/jquery/2.2.4/jquery.min.js"></script> <script src="/themes-sat/js/wet-boew.min.js"></script> <script src="/themes-sat/js/theme.min.js"></script> <script src="/themes-jb/js/settings/site-settings-gtie8.js"></script> <script src="/themes-sat/js/cdtscustom.js"></script> <script src="/themes-jb/js/third-party/jquery.timepicker.min.js"></script> <script src="/themes-jb/js/third-party/jquery.capslockstate.js"></script> <script src="/themes-jb/js/third-party/typeahead.bundle.min.js"></script> <script type="text/javascript"> //<![CDATA[ //Dropdown function dropdownToggle = function() { $('button.dropdown-toggle, a.signInUserAccount').removeClass('disabled'); $(document).on('click', 'button.dropdown-toggle', function(e) { $('button.dropdown-toggle').not(this).each( function(e) { $(this).parent('.btn-group').removeClass('open'); }); if ($(this).parent().is('.btn-group')) { //console.log('OPEN dropdown'); $(this).attr('aria-expanded', function (i, attr) { return attr == 'true' ? 'false' : 'true' }); $(this).parent('.btn-group').toggleClass('open'); if ($(this).hasClass('btn-func-filter')) { if ($(this).parent('.filter-group').hasClass('open')) { $('.dropdown-menu, .dropdown-group').parent('.btn-group').find('.btn-func-filter').children('.fa-icon').removeClass('fa-chevron-up').addClass('fa-chevron-down'); $(this).find('.fa-icon').toggleClass('fa-chevron-down fa-chevron-up'); } else { $(this).find('.fa-icon').toggleClass('fa-chevron-up fa-chevron-down'); $('.dropdown-menu, .dropdown-group').parent('.btn-group').find('.btn-func-filter').children('.fa-icon').removeClass('fa-chevron-up').addClass('fa-chevron-down'); } } } return false; }); } //Initiate Dropdown once document has been loaded dropdownToggle(); //Remove Dropdown function removeDropdownToggle = function(e) { $(document).on('click', function(e) { var dropdownToggle = $('.dropdown-menu, .dropdown-group').parent('.btn-group, .filter-group'); /* if (!$(this).parent().is('.btn-group')) { console.log('click outside'); $('button.dropdown-toggle').attr('aria-expanded','false'); $(dropdownToggle).removeClass('open'); if ($(dropdownToggle)) { $(dropdownToggle).find('.btn-func-filter').children('.fa-icon').removeClass('fa-chevron-up').addClass('fa-chevron-down'); } } */ var $trigger = $(".dropdown-toggle, .dropdown-menu"); if($trigger !== e.target && !$trigger.has(e.target).length){ //console.log('REMOVE dropdown outside'); $(dropdownToggle).removeClass('open'); if ($(dropdownToggle)) { $(dropdownToggle).find('.btn-func-filter').children('.fa-icon').removeClass('fa-chevron-up').addClass('fa-chevron-down'); } } }); escRemoveDropdownToggle(); } hideDropdownToggle = function() { $('ul.dropdown-menu li a').on('focus focusin', function() { var $signonbutton = $(this).parents('li.btn-group'); $signonbutton.addClass("open"); $signonbutton.find('button.dropdown-toggle').attr('aria-expanded','true'); }).on('focusout', function() { var $signonbutton = $(this).parents('li.btn-group'); var $parent = $(this).parents('ul.dropdown-menu'); setTimeout(function() { if (!$.contains($parent[0], document.activeElement)) { $signonbutton.removeClass("open"); $signonbutton.find('button.dropdown-toggle').attr('aria-expanded','false'); } }, 0); //console.log('HIDE dropdown'); }); escRemoveDropdownToggle(); } escRemoveDropdownToggle = function(e) { $(document).on('keydown', 'button.dropdown-toggle', function(e) { // Escape key if(event.which == 27) { //console.log('ESCAPE KEY from main button'); var dropdownToggle = $('.dropdown-menu, .dropdown-group').parent('.btn-group, .filter-group'); /* if (!$(this).parent().is('.btn-group')) { console.log('click outside'); $('button.dropdown-toggle').attr('aria-expanded','false'); $(dropdownToggle).removeClass('open'); if ($(dropdownToggle)) { $(dropdownToggle).find('.btn-func-filter').children('.fa-icon').removeClass('fa-chevron-up').addClass('fa-chevron-down'); } } */ var $trigger = $(".dropdown-toggle, .dropdown-menu"); if($trigger !== e.target && !$trigger.has(e.target).length){ //console.log('REMOVE dropdown outside'); $(dropdownToggle).removeClass('open'); if ($(dropdownToggle)) { $(dropdownToggle).find('.btn-func-filter').children('.fa-icon').removeClass('fa-chevron-up').addClass('fa-chevron-down'); } } event.preventDefault(); } }); $(document).on('keydown', '.dropdown-menu input, .dropdown-menu h3, .dropdown-menu .list-group, .dropdown-menu button, .dropdown-menu a', function(e) { // Escape key if(event.which == 27) { var dropdownToggle = $('.dropdown-menu, .dropdown-group').parent('.btn-group, .filter-group'); var $trigger = $("input[type=checkbox]"); if($trigger !== e.target && !$trigger.has(e.target).length){ $(dropdownToggle).removeClass('open'); if ($(dropdownToggle)) { $(dropdownToggle).find('.btn-func-filter').children('.fa-icon').removeClass('fa-chevron-up').addClass('fa-chevron-down'); $(this).parents('.dropdown-menu').prev('.dropdown-toggle').focus(); } } event.preventDefault(); } }); } //Initiate Remove Dropdown once document has been loaded removeDropdownToggle(); hideDropdownToggle(); $(document).ready(function(){ //$('.jbservices').removeClass('disabled'); //Form required field input label indicators and disclaimer formRequired = function() { var formRequiredAsteriskClass = 'formRequiredAsterisk'; var formRequiredAsteriskGroup = $("form."+formRequiredAsteriskClass); var asteriskSymbol = '<span class="symbol-required">*</span>' var asteriskDisclaimer = '<div class="col-md-12 row"><p class="tip-required"><span class="fa fa-info-circle fa-lg"></span> Any fields marked with an asterisk (<span>*</span>) are required.</p></div><div class="clearfix"></div>' var formRequiredWordClass = 'formRequiredWord'; var formRequiredWordGroup = $("form."+formRequiredWordClass); var requiredWord = "<span class='req'>(required)</span>"; //Insert asterisk symbol if ($(formRequiredAsteriskGroup)) { $(formRequiredAsteriskGroup).find('label.required').prepend(asteriskSymbol); $(formRequiredAsteriskGroup).find('legend.required').prepend(asteriskSymbol); $(formRequiredAsteriskGroup).find('h1.required').prepend(asteriskSymbol); $(formRequiredAsteriskGroup).find('h2.required').prepend(asteriskSymbol); $(formRequiredAsteriskGroup).find('h3.required').prepend(asteriskSymbol); //Insert asterisk disclaimer if ($(formRequiredAsteriskGroup).find('.module-stepbar').length !== 0) { $(formRequiredAsteriskGroup).find('.module-stepbar').after(asteriskDisclaimer); } else { $(formRequiredAsteriskGroup).prepend(asteriskDisclaimer); } } //Insert word required if ($(formRequiredWordGroup)) { $(formRequiredWordGroup).find('label.required').append(requiredWord); $(formRequiredWordGroup).find('legend.required').append(requiredWord); $(formRequiredWordGroup).find('h1.required').append(requiredWord); $(formRequiredWordGroup).find('h2.required').append(requiredWord); $(formRequiredWordGroup).find('h3.required').append(requiredWord); } } formRequired(); }); $(document).on("wb-ready.wb", function(event) { //Initiate script after WET Plugins are done loading... var formErrorValidation = false; var formErrorValidationGuest = true; var runFormErrorValidation = false if (localStorage.getItem('signInPopUp') === 'true') { var signInPopUp = true; } //console.log('Error?'+formErrorValidation+' Dashboard page? '+runFormErrorValidation); //console.log('Alert: '+formErrorValidationGuest); if (signInPopUp && formErrorValidation && !runFormErrorValidation && formErrorValidationGuest || signInPopUp && formErrorValidation && runFormErrorValidation && formErrorValidationGuest) { //console.log('Open Standard/Plus login popup!'); openSignInUserAccount(); } else if (!formErrorValidationGuest) { //console.log('Open Guest login popup!'); openSignInGuestUserAccount(); } else if (!formErrorValidation) { //console.log('No error validation!'); localStorage.removeItem('signInPopUp'); } else { //console.log('Not opened login popup'); } function openSignInUserAccount() { //console.log('opensigninuseraccoun'); $.magnificPopup.open({ prependTo: '#loginForm', items: [ { src: '#user-signin', type: 'inline', } ], callbacks: { open: function() { }, close: function() { //console.log('Close sign in popup!'); localStorage.removeItem('signInPopUp'); } } }); if (signInPopUp && !formErrorValidation) { localStorage.removeItem('signInPopUp'); } } function openSignInGuestUserAccount() { $.magnificPopup.open({ prependTo: '#loginModalFormViewJobAlerts', items: [ { src: '#guestmode-signin-view', type: 'inline', } ], }); } //$(document).on("wb-ready.wb", function() { $(document).on('click', '.signInRegisterJobAlerts', function(e) { //Event for actual link action e.preventDefault(); //Run WET plugin $.magnificPopup.open({ prependTo: '#loginModalFormRegisterJobAlerts', //modal: true, items: [ { src: '#guestmode-signin-register', type: 'inline', } ], //closeBtnInside: true }); }); $(document).on('click', '.signInViewJobAlerts', function(e) { //Event for actual link action e.preventDefault(); //Run WET plugin $.magnificPopup.open({ prependTo: '#loginModalFormViewJobAlerts', //modal: true, items: [ { src: '#guestmode-signin-view', type: 'inline', } ], //closeBtnInside: true }); }); $(document).on('click', '.signInUserAccount', function(e) { var title = $(this).find('.title').text(); //console.log(title); $('#loginForm').find('.modal-title').text(title); //Event for actual link action e.preventDefault(); //Run WET plugin $.magnificPopup.open({ prependTo: '#loginForm', //modal: true, items: [ { src: '#user-signin', type: 'inline', } ], callbacks: { open: function() { }, close: function() { //console.log('Close sign in popup!'); localStorage.removeItem('signInPopUp'); } } //closeBtnInside: true }); $('#submitUserSignInPopUp').click( function() { //console.log('signInPopUp'); localStorage.setItem('signInPopUp', 'true'); }); }); $('#submitUserSignIn').click( function() { //console.log('signIn normal'); localStorage.removeItem('signInPopUp'); }); }); //]]> </script> <script src="/themes-jb/js/settings/site-settings-all.js"></script> <script type="text/javascript"> //<![CDATA[ taCityprovSuggestFunctionsV2 = function(element) { String.prototype.format = function() { var args = arguments; return this.replace(/\{(\d+)\}/g, function() { return args[arguments[1]]; }); }; if (!String.prototype.startsWith) { String.prototype.startsWith = function(searchString, position) { position = position || 0; return this.indexOf(searchString, position) === position; }; } var inputObject = $(element).find("input:text:first"); var inputlang = document.documentElement.lang; if (inputObject.attr('lang') !== undefined) inputlang = inputObject.attr('lang'); if (inputlang === undefined) inputlang = "en"; var selectedObjectText; var messageObject = $(element).find("[data-name='suggestioncount']"); var errorLabelMessageObject = $(element).find("label").find(".message"); var idObject = $(element).find("[name$='locationparam']"); var specialObject = $(element).find("[name$='cityPostalCodeSpecial']"); var buttonObject = $(element).find("input:submit, button"); if (buttonObject.length == 0) { buttonObject = $(element).find("button:submit"); } if (idObject.val() == '' ) { clearinput(); }; messageObject.text("Type to get suggestions"); function displaykey(item) { if (item.docid.startsWith('PR')) { return item.name; } if (item.docid.startsWith('P')) { return item.name+", "+item.prov_cd+" "+item.postalcode; } return item.name+", "+item.prov_cd; } function displayvalue(item) { if (item.docid.startsWith('PR')) { return item.prov_name; } if (item.docid.startsWith('P')) { return item.postalcode; } return item.name+", "+item.prov_cd; } function displayoption(value,item) { return value; } /* if the button is inside the ta-cityprovsuggest block, it will be controlled by this script to avoid that behaviour, move the button onside the block */ function clearinput() { idObject.val(""); // DO NOT COMMENT OUT THIS LINE buttonObject.attr('disabled', 'disabled'); selectedObjectText = ""; inputObject.trigger("unselect",["Custom","Event"]); } function noValidSelection() { errorLabelMessageObject.show().addClass("ui-message-error").attr({"role":"status","aria-live":"polite"}).text("No suggestions, make another selection"); } function validSelection() { errorLabelMessageObject.text("").hide(); } function populateinput(item) { if (item.docid.startsWith('PR')) { idObject.val(item.prov_cd); } else if (item.docid.startsWith('P')) { idObject.val(item.postalcode); } else { idObject.val(item.city_id); } validSelection(); // DO NOT COMMENT OUT THIS LINE buttonObject.removeAttr('disabled', 'disabled'); selectedObjectText = displayvalue(item); inputObject.trigger("select",["Custom","Event"]); } var bloodhound = new Bloodhound({ datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.name); }, queryTokenizer: Bloodhound.tokenizers.whitespace, remote: { url:"/core/ta-cityprovsuggest_"+inputlang+"/select?q=%QUERY&fq=NOT postalcode_cnt:0&wt=json&rows=25", wildcard: "%QUERY", filter: function(response) { return $.map(response.response.docs, function(doc){ return { docid:doc.docid, name:doc.name, city_id:doc.city_id, prov_cd:doc.province_cd, prov_name:doc.province_name, postalcode:doc.postalcode}; }); } }, limit: 25 }); bloodhound.initialize(); inputObject.typeahead( { minLength: 2 }, { name: "ta-cityprovsuggest", displayKey: function(item) { if (item.docid.startsWith('PR')) { return item.prov_name; } if (item.docid.startsWith('P')) { return item.postalcode; } return item.name+", "+item.prov_cd; //return displaykey(item) }, limit: 20, templates: { suggestion: function(data) { var inputtext = inputObject.val(); inputtext = inputtext.replace(/^[^\w]+|[^\w]+$/g, "").replace(/[^\wéèêë'-]+/g, "|").replace(/[eéèêë]+/g, "[eéèêë]"); pattern = new RegExp(inputtext,'gi'); highlighted = displaykey(data).replace(pattern,function(matched){ return '<span class="tt-highlight">'+matched+'</span>'; }); return '<p>'+displayoption(highlighted,data)+'</p>'; }, notFound: function(data) { messageObject.text("No suggestions, make another selection"); noValidSelection(); return '<p class="tt-suggestion tt-selectable">'+displayoption("<span class='tt-highlight'>No suggestions, make another selection</span>")+'</p>'; }, footer: function(data) { messageObject.text("Suggestions are available, use up and down arrow keys to navigate"); } }, source: bloodhound.ttAdapter() }).on('typeahead:open', function(evt) { messageObject.text("Type to get suggestions"); }).on('typeahead:select', function(evt, item) { populateinput(item); messageObject.text( "You have selected, ‘{0}’".format( displaykey(item) ) ); }).on('typeahead:change', function(evt, item) { t1 = inputObject.val(); if (t1!=selectedObjectText) { messageObject.text(""); clearinput(); } }).on('typeahead:autocomplete', function(evt, item) { populateinput(item); messageObject.text( "You have selected, ‘{0}’".format( displaykey(item) ) ); }).on('typeahead:render', function(evt, item,c,d) { if (typeof(item) != 'undefined') { messageObject.text("Suggestions are available, use up and down arrow keys to navigate"); } }).on('typeahead:close', function(evt) { var inputvalue = inputObject.typeahead('val'); if (bloodhound.remote.transport._cache.list.head) { var firstdoc = bloodhound.remote.transport._cache.list.head.val.response.docs[0]; } if ( typeof(selectedObjectText) != 'undefined' && selectedObjectText.length > 0 ) { messageObject.text( "You have selected, ‘{0}’".format(selectedObjectText) ); } else if ( typeof(inputvalue) != 'undefined' && inputvalue.length > 0 && typeof(firstdoc) != 'undefined') { // no selection then select the first docs var firstitem = { docid:firstdoc.docid, name:firstdoc.name, city_id:firstdoc.city_id, prov_cd:firstdoc.province_cd, prov_name:firstdoc.province_name, postalcode:firstdoc.postalcode }; //inputObject.val(displaykey(firstitem)); if (firstitem.docid.startsWith('PR')) { inputObject.typeahead('val',firstitem.prov_name); inputObject.val(firstitem.prov_name); } else if (firstitem.docid.startsWith('P')) { inputObject.typeahead('val',firstitem.postalcode); inputObject.val(firstitem.postalcode); } else { inputObject.typeahead('val',firstitem.name+", "+firstitem.prov_cd); inputObject.val(firstitem.name+", "+firstitem.prov_cd); } //inputObject.typeahead('val',firstitem.name); populateinput(firstitem); messageObject.text( "You have selected, ‘{0}’".format(displaykey(firstitem)) ); } else { messageObject.text(""); validSelection(); } }); // special object action if ( typeof specialObject !== 'undefined' ) { // When the user type, we hide div inputObject.on("keyup focus", function () { var search = this.value; if (search) { specialObject.addClass('wb-inv'); } else { specialObject.removeClass('wb-inv'); } }); inputObject.on('blur', function() { specialObject.addClass('wb-inv'); }); specialObject.on("focus blur", "a", function() { //window.clearTimeout(timeoutHandler); specialObject.removeClass("wb-inv"); }); specialObject.on("click", "a", function() { //console.log('#cityPostalCodeSpecial option - Activated'); var text = $(this).attr("data-input"); //var inputObject = $(this).parent(".ta-cityprovsuggest").find("input:text:first"); switch(text) { case "canada": updateLocationParam(); updateResultWithUrl($(this)); break; case "local": if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(pos) { var latlng = pos.coords; // ajax call to solr for name of city inputObject.addClass('working'); // pt: '45.558958,-75.628912' // pt: latlng.lat+','+latlng.lng, $.ajax({ url: '/core/ta-postalcode/select', dataType: 'JSONP', async: false, data: { q: '*:*', wt: 'json', fl: '*,_dist_:geodist()', sfield:'geolocation', pt: latlng.latitude+','+latlng.longitude, sort: 'geodist() asc', rows:'1' }, jsonp: 'json.wrf', success: function(data,status) { $(this).data("url",$(this).data("url")+"&pst="+data.response.docs[0].postalcode); updateResultWithUrl($(this)); }, complete: function(jqXHR,status) { inputObject.removeClass('working'); } }); }); } else { inputObject.val(" "); $("#messageblock").html('<div class="alert alert-info"> We can’t identify your current location</div>'); } break; case "profile": updateResultWithUrl($(this)); break; } return false; }); } }; function initCityprovSuggestObject() { $('div.ta-cityprovsuggest').each( function(i,obj) { new taCityprovSuggestFunctionsV2(obj); }); } if ($(".modify-job-wb-tabs").length) { $(document).on("wb-ready.wb", initCityprovSuggestObject); } else { $(document).ready(initCityprovSuggestObject); } //]]> </script> <script type="text/javascript"> //<![CDATA[ /* * example code <div class="ta-jobtitlesuggest"> <input type="text" /> <h:inputHidden id="id_en" name="id_en" /> <h:inputHidden id="id_fr" name="id_fr" /> <h:inputHidden id="noc_code" name="noc_code" /> <span id="suggestioncount" data-name="suggestioncount" role="status" aria-live="polite" class="typeahead-helper-hidden-accessible"></span> <span class="input-group-btn"> <input id="searchSubmit" class="btn btn-primary pull-right" value="Search" type="submit" name="action">Search</button> </span> </div> */ taJobtitleSuggestFunctionsV2 = function(element) { String.prototype.format = function() { var args = arguments; return this.replace(/\{(\d+)\}/g, function() { return args[arguments[1]]; }); }; var inputObject = $(element).find("input:text:first").not(':hidden'); var inputlang = document.documentElement.lang; if (inputObject.attr('lang') !== undefined) inputlang = inputObject.attr('lang'); if (inputlang === undefined) inputlang = "en"; var selectedObjectText; var messageObject = $(element).find("[data-name='suggestioncount']"); var errorLabelMessageObject = $(element).find("label").find(".message"); var idenObject = $(element).find("[name$='id_en']"); var idfrObject = $(element).find("[name$='id_fr']"); var titleidObject = $(element).find("[name$='\\:id']"); var titleObject = $(element).find("[name$='term']"); var titleenObject = $(element).find("[name$='title_en']"); var titlefrObject = $(element).find("[name$='title_fr']"); var nocCodeObject = $(element).find("[name$='noc_code']"); var filterSkilltypeObject = $(element).find("[name$='filterskilltype']"); var buttonObject = $(element).find("input:submit, button").not(':hidden'); if (buttonObject.length == 0) { buttonObject = $(element).find("button:submit").not(':hidden'); } //clearinputNOCTitle(); if (titleidObject.val() == '' ) { clearinputNOCTitle(); }; messageObject.text("Type to get suggestions"); function displaykeyNOCTitle(item) { return item.title+" ("+item.noc21_code+")"; } function displayoptionNOCTitle(value,item) { return value; } function clearinputNOCTitle() { idenObject.val(""); idfrObject.val(""); titleidObject.val(""); titleenObject.val(""); titlefrObject.val(""); titleObject.val(""); nocCodeObject.val(""); buttonObject.attr('disabled', 'disabled'); selectedObjectText = ""; // trigger event change nocCodeObject.change(); inputObject.trigger("unselect",["Custom","Event"]); } function noValidSelection() { errorLabelMessageObject.show().addClass("ui-message-error").attr({"role":"status","aria-live":"polite"}).text("No suggestions, make another selection"); } function validSelection() { errorLabelMessageObject.text("").hide(); } function populateinputNOCTitle(item) { idenObject.val(item.id_en); idfrObject.val(item.id_fr); titleidObject.val(item.id); titleenObject.val(item.title_en); titlefrObject.val(item.title_fr); if (inputlang=="en") { titleObject.val(item.title_en); } else { titleObject.val(item.title_fr); } validSelection(); nocCodeObject.val(item.noc21_code); buttonObject.removeAttr('disabled'); selectedObjectText = displaykeyNOCTitle(item); // trigger event change nocCodeObject.change(); inputObject.trigger("select",["Custom","Event"]); } $(element).on('keypress', function(evt, item) { var t1 = $(inputObject).val(); if (evt.which == 13 ) { if (t1!=selectedObjectText) { $(buttonObject).prop("disabled", true); messageObject.text(""); clearinputNOCTitle(); return false; } else { $(buttonObject).prop("disabled", false); $(buttonObject).click(); return true; } return false; } $(buttonObject).prop("disabled", true); }); //- json transform on solr var bloodhoundNOCTitle = new Bloodhound({ datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.fos_name); }, queryTokenizer: Bloodhound.tokenizers.whitespace, remote: { url:"/core/ta-jobtitle_"+inputlang+"/select?q=%QUERY&wt=json&rows=25", wildcard: "%QUERY", replace: function (url, query) { var q = encodeURIComponent(inputObject.val()); q2 = url.replace("%QUERY",q); if ( typeof(filterSkilltypeObject) != 'undefined' && filterSkilltypeObject.val() !== "" && filterSkilltypeObject.val() !== undefined) { q2 += "&fq="+filterSkilltypeObject.val(); } else { q2 += "&fq=noc_job_title_type_id:1"; } return q2; } , filter: function(response) { return $.map(response.response.docs, function(doc){ return { title:doc.title, noc_code:doc.noc_code, noc21_code:doc.noc21_code, id_en:doc.noc_job_english_title_id, id_fr:doc.noc_job_french_title_id, id:doc.noc_job_title_concordance_id, title_en:doc.title, title_fr:doc.french_title, }; }); } }, limit: 25 }); bloodhoundNOCTitle.initialize(); inputObject.typeahead( { minLength: 2 }, { name: "jobtitlesearch", displayKey: function(item) { return displaykeyNOCTitle(item) } , limit: 20, templates: { suggestion: function(data) { var inputtext = inputObject.val(); inputtext = inputtext.replace(/^[^\w]+|[^\w]+$/g, "").replace(/[^\w'-]+/g, "|"); pattern = new RegExp(inputtext,'gi'); highlighted = displaykeyNOCTitle(data).replace(pattern,function(matched){ return '<span class="tt-highlight">'+matched+'</span>'; }); return '<p>'+displayoptionNOCTitle(highlighted,data)+'</p>'; }, notFound: function(data) { messageObject.text("No suggestions, make another selection"); noValidSelection(); return '<p class="tt-suggestion tt-selectable">'+displayoptionNOCTitle("<span class='tt-highlight'>No suggestions, make another selection</span>")+'</p>'; }, footer: function(data) { messageObject.text("Suggestions are available, use up and down arrow keys to navigate"); } }, source: bloodhoundNOCTitle.ttAdapter() }).on('typeahead:open', function(evt) { messageObject.text("Type to get suggestions"); }).on('typeahead:select', function(evt, item) { populateinputNOCTitle(item); messageObject.text( "You have selected, ‘{0}’".format( displaykeyNOCTitle(item) ) ); }).on('typeahead:change', function(evt, item) { t1 = inputObject.val(); if (t1!=selectedObjectText) { messageObject.text(""); clearinputNOCTitle(); //console.log('clear title'); } }).on('typeahead:autocomplete', function(evt, item) { populateinputNOCTitle(item); messageObject.text( "You have selected, ‘{0}’".format( displaykeyNOCTitle(item) ) ); }).on('typeahead:render', function(evt, item,c,d) { if (typeof(item) != 'undefined') { messageObject.text("Suggestions are available, use up and down arrow keys to navigate"); } }).on('typeahead:close', function(evt) { var inputvalue = inputObject.typeahead('val'); if (bloodhoundNOCTitle.remote.transport._cache.list.head) { var firstdoc = bloodhoundNOCTitle.remote.transport._cache.list.head.val.response.docs[0]; } //if ( typeof(selectedObjectText) != 'undefined' && selectedObjectText.length > 0 ) { if ( typeof(selectedObjectText) != 'undefined' && selectedObjectText.length > 0 && inputObject.val() != "" ) { //console.log('Selected: '+selectedObjectText); messageObject.text( "You have selected, ‘{0}’".format(selectedObjectText) ); } else if ( typeof(inputvalue) != 'undefined' && inputvalue.length > 0 && typeof(firstdoc) != 'undefined' && typeof(firstdoc) !== null) { //console.log('No selection then select the first docs: '+inputvalue); // no selection then select the first docs var firstitem = { title:firstdoc.title, noc_code:firstdoc.noc_code, noc21_code:firstdoc.noc21_code, id_en:firstdoc.noc_job_english_title_id, id_fr:firstdoc.noc_job_french_title_id, id:firstdoc.noc_job_title_concordance_id, title_en:firstdoc.title, title_fr:firstdoc.french_title }; inputObject.val(displaykeyNOCTitle(firstitem)); inputObject.typeahead('val',firstitem.title); populateinputNOCTitle(firstitem); messageObject.text( "You have selected, ‘{0}’".format(displaykeyNOCTitle(firstitem)) ); } else { messageObject.text(""); validSelection(); } }); }; function initJobTitleSuggestObject() { $('div.ta-jobtitlesuggest').each( function(i,obj) { new taJobtitleSuggestFunctionsV2(obj); }); } if ($(".modify-job-wb-tabs").length) { $(document).on("wb-ready.wb", initJobTitleSuggestObject); } else { $(document).ready(initJobTitleSuggestObject); } //]]> </script> <script> //<![CDATA[ var _gaq = _gaq || []; var lang = 'en'; if (lang === 'en') { domain = 'jobbank.gc.ca'; } if (lang === 'fr') { domain = 'guichetemplois.gc.ca'; } //jobbank account tracking _gaq.push(['_setAccount', 'UA-10101722-1']); _gaq.push(['_setAllowLinker', true]); _gaq.push(['_setDomainName', domain]); _gaq.push(['_gat._anonymizeIp']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; //ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/u/ga_debug.js'; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); //GA for Mega Menu $(document).on('click', '#wb-sm ul li.active.sm-open > ul.open > li > a', function(event) { var tablabel = $(this).parents('ul.open').prev().text(); var itemlabel = $(this).text(); //alert('Clicked on '+tablabel+' Mega Menu - '+itemlabel); _gaq.push(['_trackEvent', 'MegaMenu', 'action: click', 'label: '+itemlabel]); }); // Device detection for Google Analytics Smart Banner if ($("meta[name='smartbanner:page']").length) { var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; var Android = /Android/i.test(window.navigator.userAgent) && !window.MSStream; var pageName = $("meta[name='smartbanner:page']").attr("content"); if (iOS) { platform = 'iOS'; } else if (Android) { platform = 'Android'; } var onLoadHandlerForConflictTesting = function() { $('.js_smartbanner__exit').on('click', function() { //console.log('SmartBannerClose '+pageName+' '+platform); _gaq.push(['_trackEvent', 'SmartBannerClose', pageName, platform]); }); $('.smartbanner__button').on('click', function() { //console.log('SmartBannerClick '+pageName+' '+platform); _gaq.push(['_trackEvent', 'SmartBannerClick', pageName, platform]); }); if ($('.js_smartbanner').length) { //console.log('SmartBannerView '+pageName+' '+platform); _gaq.push(['_trackEvent', 'SmartBannerView', pageName, platform]); } }; window.onload = onLoadHandlerForConflictTesting; } //]]> </script> <script type="text/javascript"> //console.log('Google Analytics code'); var TFWMode; // Google Analytics - Job Search //<![CDATA[ var sourcePage; function checkThisPage() { if (false) { //console.log('This is homePage'); sourcePage = 'homePage'; } else if (false) { //console.log('This is findAJobLandingPage'); sourcePage = 'findAJobLandingPage'; } else if (false) { //console.log('This is searchResultsPage'); sourcePage = 'searchResultsPage'; } else if (false) { //console.log('This is jobPostingPage'); sourcePage = 'jobPostingPage'; } else if (false) { //console.log('This is dashboardPage'); sourcePage = 'dashboardPage'; } else if (false) { //console.log('This is alertsPages'); sourcePage = 'alertsPages'; } else if (false) { //console.log('This is matchPages'); sourcePage = 'matchPages'; } else if (false) { //console.log('This is favouritesPages'); sourcePage = 'favouritesPages'; } else if (false) { //console.log('This is browsePages'); sourcePage = 'browsePages'; } else if (false) { //console.log('This is youthHomePage'); sourcePage = 'youthHomePage'; } else if (false) { //console.log('This is TFWHomePage'); sourcePage = 'TFWHomePage'; } else { sourcePage = '/landing-veterans.xhtml'; } } checkThisPage(); $('form.search-module').submit(function(){ //alert('GA '+sourcePage); var searchString = $("#searchString").val(); var locationString = $("#locationstring").val(); if ($("input[name=fsrc]").val() == "21") { var fsrc21 = true; //alert('CSJ fsrc 21'); } if ($("input[name=fsrc]").val() == "32") { var fsrc32 = true; //alert('TFW fsrc 32'); } if (_gaq != undefined) { if ((!fsrc21 && !fsrc32)) { //alert('General GA - Job Search Mode'); if (searchString.length && locationString.length) { //alert('searchString: '+searchString+ ' and locationString: '+locationString+'\nSource page: '+sourcePage); _gaq.push(['_trackEvent', 'jobSearchTitle', 'source : '+sourcePage, searchString]); _gaq.push(['_trackEvent', 'jobSearchLocation', 'source : '+sourcePage, locationString]); _gaq.push(['_trackEvent', 'jobSearch', 'source : '+sourcePage, searchString+' '+locationString]); } if (searchString.length && !locationString.length) { //alert('searchString: '+searchString+'\nSource page: '+sourcePage); _gaq.push(['_trackEvent', 'jobSearchTitle', 'source : '+sourcePage, searchString]); _gaq.push(['_trackEvent', 'jobSearch', 'source : '+sourcePage, searchString]); } if (!searchString.length && locationString.length) { //alert('locationString: '+locationString+'\nSource page: '+sourcePage); _gaq.push(['_trackEvent', 'jobSearchLocation', 'source : '+sourcePage, locationString]); _gaq.push(['_trackEvent', 'jobSearch', 'source : '+sourcePage, locationString]); } if (!searchString.length && !locationString.length) { //alert('No search!'+'\nSource page: '+sourcePage); _gaq.push(['_trackEvent', 'jobSearchTitle', 'source : '+sourcePage, '']); _gaq.push(['_trackEvent', 'jobSearchLocation', 'source : '+sourcePage, '']); _gaq.push(['_trackEvent', 'jobSearch', 'source : '+sourcePage, '']); } } else { //alert('GA else search'); if (fsrc21) { //alert('General GA - CSJ Mode!'); if (searchString.length && !locationString.length) { _gaq.push(['_trackEvent', 'CSJjobSearchTitle', 'source : '+sourcePage, searchString]); _gaq.push(['_trackEvent', 'CSJjobSearchLocation', 'source : '+sourcePage, locationString]); _gaq.push(['_trackEvent', 'CSJjobSearch', 'source : '+sourcePage, searchString+' '+locationString]); //alert('GAQ title: '+searchString+'\nSource page: '+sourcePage); } if (locationString.length && !searchString.length) { _gaq.push(['_trackEvent', 'CSJjobSearchTitle', 'source : '+sourcePage, searchString]); _gaq.push(['_trackEvent', 'CSJjobSearchLocation', 'source : '+sourcePage, locationString]); _gaq.push(['_trackEvent', 'CSJjobSearch', 'source : '+sourcePage, searchString+' '+locationString]); //alert('GAQ location: '+locationString+'\nSource page: '+sourcePage); } if (searchString.length && locationString.length) { _gaq.push(['_trackEvent', 'CSJjobSearchTitle', 'source : '+sourcePage, searchString]); _gaq.push(['_trackEvent', 'CSJjobSearchLocation', 'source : '+sourcePage, locationString]); _gaq.push(['_trackEvent', 'CSJjobSearch', 'source : '+sourcePage, searchString+' '+locationString]); //alert('GAQ title: '+searchString+'\nGAQ location: '+locationString+'\nSource page: '+sourcePage); } if (!searchString.length && !locationString.length) { _gaq.push(['_trackEvent', 'CSJjobSearchTitle', 'source : '+sourcePage, searchString]); _gaq.push(['_trackEvent', 'CSJjobSearchLocation', 'source : '+sourcePage, locationString]); _gaq.push(['_trackEvent', 'CSJjobSearch', 'source : '+sourcePage, searchString+' '+locationString]); //alert('BOTH EMPTY!'+'\nGAQ title: '+searchString+'\nGAQ location: '+locationString+'\nSource page: '+sourcePage); } } if (fsrc32) { //alert('General GA - TFW Mode!'); if (searchString.length && !locationString.length) { _gaq.push(['_trackEvent', 'TFWjobSearchTitle', 'source : '+sourcePage, searchString]); _gaq.push(['_trackEvent', 'TFWjobSearchLocation', 'source : '+sourcePage, locationString]); _gaq.push(['_trackEvent', 'TFWjobSearch', 'source : '+sourcePage, searchString+' '+locationString]); //alert('TFW GAQ title: '+searchString+'\nSource page: '+sourcePage); } if (locationString.length && !searchString.length) { _gaq.push(['_trackEvent', 'TFWjobSearchTitle', 'source : '+sourcePage, searchString]); _gaq.push(['_trackEvent', 'TFWjobSearchLocation', 'source : '+sourcePage, locationString]); _gaq.push(['_trackEvent', 'TFWjobSearch', 'source : '+sourcePage, searchString+' '+locationString]); //alert('TFW GAQ location: '+locationString+'\nSource page: '+sourcePage); } if (searchString.length && locationString.length) { _gaq.push(['_trackEvent', 'TFWjobSearchTitle', 'source : '+sourcePage, searchString]); _gaq.push(['_trackEvent', 'TFWjobSearchLocation', 'source : '+sourcePage, locationString]); _gaq.push(['_trackEvent', 'TFWjobSearch', 'source : '+sourcePage, searchString+' '+locationString]); //alert('TFW GAQ title: '+searchString+'\nTFW GAQ location: '+locationString+'\nSource page: '+sourcePage); } if (!searchString.length && !locationString.length) { _gaq.push(['_trackEvent', 'TFWjobSearchTitle', 'source : '+sourcePage, searchString]); _gaq.push(['_trackEvent', 'TFWjobSearchLocation', 'source : '+sourcePage, locationString]); _gaq.push(['_trackEvent', 'TFWjobSearch', 'source : '+sourcePage, searchString+' '+locationString]); //alert('TFW BOTH EMPTY!'+'\nTFW GAQ title: '+searchString+'\nTFW GAQ location: '+locationString+'\nSource page: '+sourcePage); } } } } }); //]]> </script> <script type="text/javascript" src="/themes-jb/js/third-party/animate.js"></script> <script type="text/javascript"> //<![CDATA[ /* * example code <div class="ta-jobtitlesuggest"> <input type="text" /> <h:inputHidden id="id_en" name="id_en" /> <h:inputHidden id="id_fr" name="id_fr" /> <h:inputHidden id="noc_code" name="noc_code" /> <span id="suggestioncount" data-name="suggestioncount" role="status" aria-live="polite" class="typeahead-helper-hidden-accessible"></span> <span class="input-group-btn"> <input id="searchSubmit" class="btn btn-primary pull-right" value="Search" type="submit" name="action">Search</button> </span> </div> */ taJobtitleSuggestFunctionsV2 = function(element) { String.prototype.format = function() { var args = arguments; return this.replace(/\{(\d+)\}/g, function() { return args[arguments[1]]; }); }; var inputObject = $(element).find("input:text:first").not(':hidden'); var inputlang = document.documentElement.lang; if (inputObject.attr('lang') !== undefined) inputlang = inputObject.attr('lang'); if (inputlang === undefined) inputlang = "en"; var selectedObjectText; var messageObject = $(element).find("[data-name='suggestioncount']"); var errorLabelMessageObject = $(element).find("label").find(".message"); var idenObject = $(element).find("[name$='id_en']"); var idfrObject = $(element).find("[name$='id_fr']"); var titleidObject = $(element).find("[name$='\\:id']"); var titleObject = $(element).find("[name$='term']"); var titleenObject = $(element).find("[name$='title_en']"); var titlefrObject = $(element).find("[name$='title_fr']"); var nocCodeObject = $(element).find("[name$='noc_code']"); var filterSkilltypeObject = $(element).find("[name$='filterskilltype']"); var buttonObject = $(element).find("input:submit, button").not(':hidden'); if (buttonObject.length == 0) { buttonObject = $(element).find("button:submit").not(':hidden'); } //clearinputNOCTitle(); if (titleidObject.val() == '' ) { clearinputNOCTitle(); }; messageObject.text("Type to get suggestions"); function displaykeyNOCTitle(item) { return item.title+" ("+item.noc21_code+")"; } function displayoptionNOCTitle(value,item) { return value; } function clearinputNOCTitle() { idenObject.val(""); idfrObject.val(""); titleidObject.val(""); titleenObject.val(""); titlefrObject.val(""); titleObject.val(""); nocCodeObject.val(""); buttonObject.attr('disabled', 'disabled'); selectedObjectText = ""; // trigger event change nocCodeObject.change(); inputObject.trigger("unselect",["Custom","Event"]); } function noValidSelection() { errorLabelMessageObject.show().addClass("ui-message-error").attr({"role":"status","aria-live":"polite"}).text("No suggestions, make another selection"); } function validSelection() { errorLabelMessageObject.text("").hide(); } function populateinputNOCTitle(item) { idenObject.val(item.id_en); idfrObject.val(item.id_fr); titleidObject.val(item.id); titleenObject.val(item.title_en); titlefrObject.val(item.title_fr); if (inputlang=="en") { titleObject.val(item.title_en); } else { titleObject.val(item.title_fr); } validSelection(); nocCodeObject.val(item.noc21_code); buttonObject.removeAttr('disabled'); selectedObjectText = displaykeyNOCTitle(item); // trigger event change nocCodeObject.change(); inputObject.trigger("select",["Custom","Event"]); } $(element).on('keypress', function(evt, item) { var t1 = $(inputObject).val(); if (evt.which == 13 ) { if (t1!=selectedObjectText) { $(buttonObject).prop("disabled", true); messageObject.text(""); clearinputNOCTitle(); return false; } else { $(buttonObject).prop("disabled", false); $(buttonObject).click(); return true; } return false; } $(buttonObject).prop("disabled", true); }); //- json transform on solr var bloodhoundNOCTitle = new Bloodhound({ datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.fos_name); }, queryTokenizer: Bloodhound.tokenizers.whitespace, remote: { url:"/core/ta-jobtitle_"+inputlang+"/select?q=%QUERY&wt=json&rows=25", wildcard: "%QUERY", replace: function (url, query) { var q = encodeURIComponent(inputObject.val()); q2 = url.replace("%QUERY",q); if ( typeof(filterSkilltypeObject) != 'undefined' && filterSkilltypeObject.val() !== "" && filterSkilltypeObject.val() !== undefined) { q2 += "&fq="+filterSkilltypeObject.val(); } else { q2 += "&fq=noc_job_title_type_id:1"; } return q2; } , filter: function(response) { return $.map(response.response.docs, function(doc){ return { title:doc.title, noc_code:doc.noc_code, noc21_code:doc.noc21_code, id_en:doc.noc_job_english_title_id, id_fr:doc.noc_job_french_title_id, id:doc.noc_job_title_concordance_id, title_en:doc.title, title_fr:doc.french_title, }; }); } }, limit: 25 }); bloodhoundNOCTitle.initialize(); inputObject.typeahead( { minLength: 2 }, { name: "jobtitlesearch", displayKey: function(item) { return displaykeyNOCTitle(item) } , limit: 20, templates: { suggestion: function(data) { var inputtext = inputObject.val(); inputtext = inputtext.replace(/^[^\w]+|[^\w]+$/g, "").replace(/[^\w'-]+/g, "|"); pattern = new RegExp(inputtext,'gi'); highlighted = displaykeyNOCTitle(data).replace(pattern,function(matched){ return '<span class="tt-highlight">'+matched+'</span>'; }); return '<p>'+displayoptionNOCTitle(highlighted,data)+'</p>'; }, notFound: function(data) { messageObject.text("No suggestions, make another selection"); noValidSelection(); return '<p class="tt-suggestion tt-selectable">'+displayoptionNOCTitle("<span class='tt-highlight'>No suggestions, make another selection</span>")+'</p>'; }, footer: function(data) { messageObject.text("Suggestions are available, use up and down arrow keys to navigate"); } }, source: bloodhoundNOCTitle.ttAdapter() }).on('typeahead:open', function(evt) { messageObject.text("Type to get suggestions"); }).on('typeahead:select', function(evt, item) { populateinputNOCTitle(item); messageObject.text( "You have selected, ‘{0}’".format( displaykeyNOCTitle(item) ) ); }).on('typeahead:change', function(evt, item) { t1 = inputObject.val(); if (t1!=selectedObjectText) { messageObject.text(""); clearinputNOCTitle(); //console.log('clear title'); } }).on('typeahead:autocomplete', function(evt, item) { populateinputNOCTitle(item); messageObject.text( "You have selected, ‘{0}’".format( displaykeyNOCTitle(item) ) ); }).on('typeahead:render', function(evt, item,c,d) { if (typeof(item) != 'undefined') { messageObject.text("Suggestions are available, use up and down arrow keys to navigate"); } }).on('typeahead:close', function(evt) { var inputvalue = inputObject.typeahead('val'); if (bloodhoundNOCTitle.remote.transport._cache.list.head) { var firstdoc = bloodhoundNOCTitle.remote.transport._cache.list.head.val.response.docs[0]; } //if ( typeof(selectedObjectText) != 'undefined' && selectedObjectText.length > 0 ) { if ( typeof(selectedObjectText) != 'undefined' && selectedObjectText.length > 0 && inputObject.val() != "" ) { //console.log('Selected: '+selectedObjectText); messageObject.text( "You have selected, ‘{0}’".format(selectedObjectText) ); } else if ( typeof(inputvalue) != 'undefined' && inputvalue.length > 0 && typeof(firstdoc) != 'undefined' && typeof(firstdoc) !== null) { //console.log('No selection then select the first docs: '+inputvalue); // no selection then select the first docs var firstitem = { title:firstdoc.title, noc_code:firstdoc.noc_code, noc21_code:firstdoc.noc21_code, id_en:firstdoc.noc_job_english_title_id, id_fr:firstdoc.noc_job_french_title_id, id:firstdoc.noc_job_title_concordance_id, title_en:firstdoc.title, title_fr:firstdoc.french_title }; inputObject.val(displaykeyNOCTitle(firstitem)); inputObject.typeahead('val',firstitem.title); populateinputNOCTitle(firstitem); messageObject.text( "You have selected, ‘{0}’".format(displaykeyNOCTitle(firstitem)) ); } else { messageObject.text(""); validSelection(); } }); }; function initJobTitleSuggestObject() { $('div.ta-jobtitlesuggest').each( function(i,obj) { new taJobtitleSuggestFunctionsV2(obj); }); } if ($(".modify-job-wb-tabs").length) { $(document).on("wb-ready.wb", initJobTitleSuggestObject); } else { $(document).ready(initJobTitleSuggestObject); } //]]> </script> <script type="text/javascript"> //<![CDATA[ taCommunitySuggestFunctionsV2 = function(element) { String.prototype.format = function() { var args = arguments; return this.replace(/\{(\d+)\}/g, function() { return args[arguments[1]]; }); }; var inputObject = $(element).find("input:text:first").not(':hidden'); var inputlang = document.documentElement.lang; if (inputObject.attr('lang') !== undefined) inputlang = inputObject.attr('lang'); if (inputlang === undefined) inputlang = "en"; var selectedObjectText; var messageObject = $(element).find("[data-name='suggestioncount']"); var cityIdObject = $(element).find("[name$='city_id']"); if (cityIdObject.length == 0) { cityIdObject = $(element).find("[name$='mid']"); } var latitudeObject = $(element).find("[name$='latitude']"); var longitudeObject = $(element).find("[name$='longitude']"); var postalcode = $(element).find("[name$='postalcode']"); if (postalcode.length == 0) { postalcode = $(element).find("[name$='pst']"); } var buttonObject = $(element).find("input:submit, button").not(':hidden'); if (buttonObject.length == 0) { buttonObject = $(element).find("button:submit").not(':hidden'); } if (cityIdObject.val() == '' ) { clearinput(); }; messageObject.text("Type to get suggestions"); function displaykey(item) { if (item.mother_name!==undefined) { return item.mother_name+" ("+item.name+"), "+item.prov_cd } if (item.postalcode===undefined) { return item.name+", "+item.prov_cd } return item.name+", "+item.prov_cd+" "+item.postalcode; } function displayoption(value,item) { return value; } function clearinput() { cityIdObject.val(""); latitudeObject.val(""); longitudeObject.val(""); postalcode.val(""); buttonObject.attr('disabled', 'disabled'); selectedObjectText = ""; inputObject.trigger("unselect",["Custom","Event"]); } function populateinput(item) { cityIdObject.val(item.city_id); latitudeObject.val(item.latitude); longitudeObject.val(item.longitude); postalcode.val(item.postalcode); buttonObject.removeAttr('disabled', 'disabled'); selectedObjectText = displaykey(item); inputObject.trigger("select",["Custom","Event"]); } $(element).on('keypress', function(evt, item) { var t1 = $(inputObject).val(); if (evt.which == 13) { if (t1!=selectedObjectText) { $(buttonObject).prop("disabled", true); messageObject.text(""); clearinput(); } else { $(buttonObject).prop("disabled", false); $(buttonObject).click(); return true; } return false; } $(buttonObject).prop("disabled", true); }); var bloodhound = new Bloodhound({ datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.name); }, queryTokenizer: Bloodhound.tokenizers.whitespace, remote: { url:"/core/ta-communitysuggest_"+inputlang+"/select?q=\"%QUERY\"&wt=json&rows=25", wildcard: "%QUERY", filter: function(response) { return $.map(response.response.docs, function(doc){ return { name:doc.name, city_id:doc.city_id, prov_cd:doc.province_cd, postalcode:doc.postalcode, mother_name:doc.mother_name, latitude:doc.latitude, longitude:doc.longitude}; }); } }, limit: 25 }); bloodhound.initialize(); inputObject.typeahead( { minLength: 2 }, { name: "ta-communitysuggest", displayKey: function(item) { return displaykey(item) }, limit: 20, templates: { suggestion: function(data) { var inputtext = inputObject.val(); inputtext = inputtext.replace(/^[^\w]+|[^\w]+$/g, "").replace(/[^\wéèêë'-]+/g, "|").replace(/[eéèêë]+/g, "[eéèêë]"); pattern = new RegExp(inputtext,'gi'); highlighted = displaykey(data).replace(pattern,function(matched){ return '<span class="tt-highlight">'+matched+'</span>'; }); return '<p>'+displayoption(highlighted,data)+'</p>'; }, notFound: function(data) { messageObject.text("No suggestions, make another selection"); return '<p class="tt-suggestion tt-selectable">'+displayoption("<span class='tt-highlight'>No suggestions, make another selection</span>")+'</p>'; }, footer: function(data) { messageObject.text("Suggestions are available, use up and down arrow keys to navigate"); } }, source: bloodhound.ttAdapter() }).on('typeahead:open', function(evt) { messageObject.text("Type to get suggestions"); }).on('typeahead:select', function(evt, item) { populateinput(item); messageObject.text( "You have selected, ‘{0}’".format( displaykey(item) ) ); }).on('typeahead:change', function(evt, item) { t1 = inputObject.val(); if (t1!=selectedObjectText) { messageObject.text(""); clearinput(); } }).on('typeahead:autocomplete', function(evt, item) { populateinput(item); messageObject.text( "You have selected, ‘{0}’".format( displaykey(item) ) ); }).on('typeahead:render', function(evt, item,c,d) { if (typeof(item) != 'undefined') { messageObject.text("Suggestions are available, use up and down arrow keys to navigate"); } }).on('typeahead:close', function(evt) { var inputvalue = inputObject.typeahead('val'); if (bloodhound.remote.transport._cache.list.head) { var firstdoc = bloodhound.remote.transport._cache.list.head.val.response.docs[0]; } if ( typeof(selectedObjectText) != 'undefined' && selectedObjectText.length > 0 ) { messageObject.text( "You have selected, ‘{0}’".format(selectedObjectText) ); } else if ( typeof(inputvalue) != 'undefined' && inputvalue.length > 0 && typeof(firstdoc) != 'undefined') { // no selection then select the first docs var firstitem = { name:firstdoc.name, city_id:firstdoc.city_id, prov_cd:firstdoc.province_cd, postalcode:firstdoc.postalcode, latitude:firstdoc.latitude, longitude:firstdoc.longitude }; inputObject.val(displaykey(firstitem)); inputObject.typeahead('val',firstitem.name); populateinput(firstitem); messageObject.text( "You have selected, ‘{0}’".format(displaykey(firstitem)) ); } else { messageObject.text(""); } }); }; function initCommunitySuggestObject() { $('div.ta-communitysuggest').each( function(i,obj) { new taCommunitySuggestFunctionsV2(obj); }); } if ($(".modify-job-wb-tabs").length) { $(document).on("wb-ready.wb", initCommunitySuggestObject); } else { $(document).ready(initCommunitySuggestObject); } //]]> </script> <script type="text/javascript"> //<![CDATA[ taCitySuggestFunctions = function() { String.prototype.format = function() { var args = arguments; return this.replace(/\{(\d+)\}/g, function() { return args[arguments[1]]; }); }; var inputObjectCitySuggest = $('div.ta-citysuggest input:text'), messageobjectCitySuggest = $('#ta-citysuggest-suggestioncount'), selectedobjectCitySuggest = $('#ta-citysuggest-selected-title'); function displaykeyCitySuggest(item) { return item.name+", "+item.prov_cd; } function displayoptionCitySuggest(value,item) { return value; } function clearinputCitySuggest() { $('div.ta-citysuggest input[id*="city_id"]').val(""); selectedobjectCitySuggest.val(""); } function populateinputCitySuggest(item) { $('div.ta-citysuggest input[id*="city_id"]').val(item.city_id); selectedobjectCitySuggest.val(displaykeyCitySuggest(item)); } var bloodhoundCitySuggest = new Bloodhound({ datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.name); }, queryTokenizer: Bloodhound.tokenizers.whitespace, remote: { url:"/core/ta-citysuggest_en/select?q=%QUERY&wt=json&rows=25", wildcard: "%QUERY", /*replace: function(query, settings) { var provinceCd = "NL"; var postalcode = $('#input-postalcode').val(); switch (postalcode.charAt(0)) { case 'A': provinceCd = "NL"; break; case 'B': provinceCd = "NS"; break; case 'C': provinceCd = "PE"; break; case 'E': provinceCd = "NB"; break; case 'G': provinceCd = "QC"; break; case 'H': provinceCd = "QC"; break; case 'J': provinceCd = "QC"; break; case 'M': provinceCd = "ON"; break; case 'N': provinceCd = "ON"; break; case 'L': provinceCd = "ON"; break; case 'P': provinceCd = "ON"; break; case 'K': provinceCd = "ON"; break; case 'R': provinceCd = "MB"; break; case 'S': provinceCd = "SK"; break; case 'T': provinceCd = "AB"; break; case 'V': provinceCd = "BC"; case 'Y': provinceCd = "YT"; break; default: if (postalcode.startsWith("X0A")) provinceCd = "NU"; if (postalcode.startsWith("X0B")) provinceCd = "NU"; if (postalcode.startsWith("X0C")) provinceCd = "NU"; provinceCd = "NT"; } var q = query+' AND province_cd:'+provinceCd; return settings.url.replace("%QUERY", encodeURIComponent(q)); }*/ filter: function(response) { return $.map(response.response.docs, function(doc){ return { name:doc.name, city_id:doc.city_id, prov_cd:doc.province_cd }; }); } }, limit: 25 }); bloodhoundCitySuggest.initialize(); inputObjectCitySuggest.typeahead( { minLength: 2 }, { name: "ta-citysuggest", displayKey: function(item) { return displaykeyCitySuggest(item) }, limit: 20, templates: { suggestion: function(data) { var inputtext = inputObjectCitySuggest.val(); inputtext = inputtext.replace(/^[^\w]+|[^\w]+$/g, "").replace(/[^\w'-]+/g, "|"); pattern = new RegExp(inputtext,'gi'); highlighted = displaykeyCitySuggest(data).replace(pattern,function(matched){ return '<span class="tt-highlight">'+matched+'</span>'; }); return '<p>'+displayoptionCitySuggest(highlighted,data)+'</p>'; }, notFound: function(data) { messageobjectCitySuggest.text("No suggestions, make another selection"); }, footer: function(data) { messageobjectCitySuggest.text("Suggestions are available, use up and down arrow keys to navigate"); } }, source: bloodhoundCitySuggest.ttAdapter() }).on('typeahead:open', function(evt) { messageobjectCitySuggest.text("Type to get suggestions"); }).on('typeahead:select', function(evt, item) { populateinputCitySuggest(item); messageobjectCitySuggest.text( "You have selected, ‘{0}’".format( displaykeyCitySuggest(item) ) ); }).on('typeahead:change', function(evt, item) { t1 = inputObjectCitySuggest.val(); t2 = selectedobjectCitySuggest.val(); if (t1!=t2) { messageobjectCitySuggest.text(""); clearinputCitySuggest(); } }).on('typeahead:autocomplete', function(evt, item) { populateinputCitySuggest(item); messageobjectCitySuggest.text( "You have selected, ‘{0}’".format( displaykeyCitySuggest(item) ) ); }).on('typeahead:render', function(evt, item,c,d) { if (typeof(item) != 'undefined') { messageobjectCitySuggest.text("Suggestions are available, use up and down arrow keys to navigate"); } }).on('typeahead:close', function(evt) { var value = selectedobjectCitySuggest.val(); if ( typeof(value) != 'undefined' && value.length > 0 ) { messageobjectCitySuggest.text( "You have selected, ‘{0}’".format(value) ); } else { messageobjectCitySuggest.text(""); } }); }; if ($(".modify-job-wb-tabs").length) { $(document).on("wb-ready.wb", taCitySuggestFunctions); } else { $(document).ready(taCitySuggestFunctions); }; //]]> </script><script type="text/javascript"> //<![CDATA[ //Remove WET GC Theme Loupe Icon $('#wb-glb-mn .overlay-lnk span.glyphicon.glyphicon-search').removeClass('glyphicon-search'); $('#results-filter-wrapper, .results-filter-content .list-group').addClass('noanim'); $('#results-filter-wrapper, .results-filter-content .list-group').each(function(i) { var elm=$(this); setTimeout(function() { elm.removeClass('noanim'); }, i * 500); }); //Initialize localstorage var reload; initlocalstorageFunctions = function() { if (localStorage) { if (localStorage.getItem('functionResultFilter') === 'active' ) { //console.log('#Localstorage: filter is active'); if (!$('.results-content').hasClass('filter-hide')) { $('.skip-to-filters').show(); if ($('.results-filter-wrapper').length) { //console.log('Search results!'); if ($('.results-filter-wrapper').css('visibility') === 'visible') { reload = true; //console.log('.results-filter-wrapper is VISIBLE'); //showFilter(); if ($('.search-input-content').css('display') === 'none') { //console.log('display none - Mobile!'); hideFilter(); } else { //console.log('display block - Desktop!'); showFilter(); } } else { reload = true; //console.log('.results-filter-wrapper is HIDDEN'); hideFilter(); } } if ($('#results-list-wrapper').hasClass("col-md-12:not(:has(.courses))")) { $('#results-list-wrapper').removeClass('col-md-12').addClass('col-md-9'); } } } else if (localStorage.getItem('functionResultFilter') === 'disabled' ) { //console.log('#Localstorage: filter is disabled'); reload = true; $('.skip-to-filters').hide(); hideFilter(); } else { //console.log('#Localstorage: filter is N/A'); reload = true; //showFilter(); //hideFilter(); $('.results-list-wrapper').each(function(i) { var elm=$(this); setTimeout(function() { elm.removeClass('noanim'); }, i * 500); }); } // Sort By if (localStorage.getItem('functionSortBy') === 'active') { //console.log('Sort By - Active'); resetSearchOverlay(); activateSortBy(); if ($('.results-sortby-group').css('visibility') === 'hidden') { //Mobile if ($('.results-filter-button-overlay').css('position') === 'fixed') { //console.log('Sort By - Mobile!'); if (!$('.results-sortby-group').hasClass('sortby-group-visible')) { $('.results-filter-button-overlay').addClass('noBorder'); $('.results-sortby-group').addClass('sortby-group-visible'); } } //Desktop if ($('.results-filter-button-overlay').css('position') === 'relative') { //console.log('Sort By - Desktop!'); if ($('.results-sortby-group').hasClass('sortby-group-visible')) { $('.results-filter-button-overlay').removeClass('noBorder'); $('.results-sortby-group').removeClass('sortby-group-visible'); resetDynamicFilter(); } } } else if ($('.results-sortby-group').css('visibility') === 'visible') { //Mobile if ($('.results-filter-button-overlay').css('position') === 'fixed') { //console.log('Sort By - Mobile!'); if (!$('.results-sortby-group').hasClass('sortby-group-visible')) { $('.results-filter-button-overlay').addClass('noBorder'); $('.results-sortby-group').addClass('sortby-group-visible'); } } //Desktop if ($('.results-filter-button-overlay').css('position') === 'relative') { //console.log('Sort By - Desktop!'); $('main').removeClass('sortby-visible'); if ($('.results-sortby-group').hasClass('sortby-group-visible')) { $('.results-filter-button-overlay').removeClass('noBorder'); $('.results-sortby-group').removeClass('sortby-group-visible'); } } } } else if (localStorage.getItem('functionSortBy') === 'disabled' ) { //console.log('Sort By - Disabled'); $('main').removeClass('sortby-visible'); $('.command-result-sortby-overlay').removeClass('active'); //Mobile if ($('.results-filter-button-overlay').css('position') === 'fixed') { if ($('.results-sortby-group').hasClass('sortby-group-visible')) { $('.results-filter-button-overlay').removeClass('noBorder'); $('.results-sortby-group').removeClass('sortby-group-visible'); } } //Desktop if ($('.results-filter-button-overlay').css('position') === 'relative') { if ($('.results-sortby-group').hasClass('sortby-group-visible')) { $('.results-filter-button-overlay').removeClass('noBorder'); $('.results-sortby-group').removeClass('sortby-group-visible'); } } } else { localStorage.setItem('functionSortBy', 'disabled'); $('.results-filter-button-overlay').removeClass('noBorder'); $('.results-sortby-group').removeClass('sortby-group-visible'); } if ($('.results-content').hasClass('filter-hide')) { $("#results-filter-wrapper").addClass("invisible"); } else if ($('.results-content').hasClass('filter-visible')) { $("#results-filter-wrapper").removeClass("invisible"); } } } function resetSearchOverlay() { //console.log('Reset Search Overlay'); $('#header-search').removeClass('search-visible'); $('.search-input-content').removeClass('noBorder'); $('main').removeClass('search-visible'); $('.command-search-overlay').removeClass('active'); $('.command-search-overlay').removeClass('btn-default'); $('.command-search-overlay').addClass('btn-primary'); $('.command-search-overlay').find('.text').text("Search"); $('.command-search-overlay').find('.far').removeClass('fa-times').addClass('fa-search'); $('.results-filter-button-overlay').removeClass('noBorder'); } function resetDynamicFilter() { //console.log('Course resetDynamicFilter'); //Mobile if ($('.results-filter-button-overlay').css('position') === 'fixed') { checkToggleFilterList(); } //Desktop if ($('.results-filter-button-overlay').css('position') === 'relative') { $('.results-filter-content section').find('.list-group').not('.stay-open').removeClass('close'); $('.results-filter-content section h3').not('.nonActive').attr({"tabindex":"0", "aria-expanded": "true", "aria-haspopup":"false", "data-toggle":"dropdown"}).find('.toggleFilterList').remove(); } } function activateSortBy() { //console.log('Activate Sort By Overlay'); $('main').addClass('sortby-visible'); localStorage.setItem('functionSortBy', 'active'); $('.command-result-sortby-overlay').addClass('active'); $('.results-sortby-group').addClass('sortby-group-visible'); $('.results-filter-button-overlay').addClass('noBorder'); } function resetSortBy() { //console.log('Reset Sort By Overlay'); $('main').removeClass('sortby-visible'); localStorage.setItem('functionSortBy', 'disabled'); $('.command-result-sortby-overlay').removeClass('active'); $('.results-sortby-group').removeClass('sortby-group-visible'); $('.results-filter-button-overlay').removeClass('noBorder'); } function hideFilter() { //console.log('#Hide Filter'); $('.command-result-filter-overlay').removeClass('active').attr('aria-expanded','false'); $('.results-content').addClass('filter-hide').removeClass('filter-visible'); if (reload) { //console.log('reload hide filter'); //console.log('reload: '+reload); reload = false; $('.results-list-wrapper').removeClass('col-md-9').addClass('col-md-12 noanim'); } else { //console.log('not reload hide filter'); $('.results-list-wrapper').removeClass('noanim'); $('.results-list-wrapper').removeClass('col-md-9').addClass('col-md-12'); } if (localStorage) { localStorage.setItem('functionResultFilter', 'disabled'); } } function showFilter() { //console.log('#Show Filter'); $('.command-result-filter-overlay').addClass('active').attr('aria-expanded','true'); $('.results-content').addClass('filter-visible').removeClass('filter-hide'); if (reload) { //console.log('reload show filter'); reload = false; //$('.results-list-wrapper').removeClass('col-md-12').addClass('col-md-9 noanim'); if ($('.results-list-wrapper').hasClass("col-md-12")) { $('.results-list-wrapper').removeClass('col-md-12').addClass('col-md-9 noanim'); } } else { //console.log('not reload show filter'); $('.results-list-wrapper').removeClass('noanim'); //$('.results-list-wrapper').removeClass('col-md-12').addClass('col-md-9'); if ($('.results-list-wrapper').hasClass("col-md-12")) { $('.results-list-wrapper').removeClass('col-md-12').addClass('col-md-9'); } } if (localStorage) { localStorage.setItem('functionResultFilter', 'active'); } } //On load - CSJ check - For mobile app compatibility if (localStorage) { localStorage.removeItem('youthSearchLocation'); //localStorage.removeItem('volunteerSearchLocation'); //var fromYouthPage = JSON.parse(localStorage.getItem('fromYouthPage')); var fromVolunteerPage = JSON.parse(localStorage.getItem('fromVolunteerPage')); //var youthSearchLocation = localStorage.getItem('youthSearchLocation'); var volunteerSearchLocation = localStorage.getItem('volunteerSearchLocation'); var currentSearchString = $('.searchString').val(); //Volunteer if ($("#volunteerPage, #jobSearchResultsJobSearchForm.volunteer").length) { //console.log('Volunteer page'); if ($("#cityPostalCodeInput").length) { //console.log('Volunteer search page!'); var newSearchString = currentSearchString.replace(volunteerSearchLocation, ''); if (fromVolunteerPage) { //console.log('From volunteer page!'); //$("#searchStringPseudo").val($.trim(newSearchString)); $("#cityPostalCodeInput").val($.trim(volunteerSearchLocation)); //localStorage.removeItem('volunteerSearchLocation'); localStorage.setItem('fromVolunteerPage', JSON.stringify(false)); } else { //console.log('not from volunteer page'); $("#cityPostalCodeInput").val($.trim(volunteerSearchLocation)); //localStorage.removeItem('volunteerSearchLocation'); } if ($("#volunteerPage").length) { localStorage.removeItem('volunteerSearchLocation'); } } } } //Initiate localstorage functions once document have been loaded $(document).on("ready", initlocalstorageFunctions); //$(document).on("ready", saveLoginRedirectURIListener); $(document).ready(function(){ //Restore infinite scroll position on reload if ($('.command-search-overlay').length){ if (sessionStorage.scrollTop != "undefined") { $(window).scrollTop(sessionStorage.scrollTop); //console.log('Old scroll position: '+$(window).scrollTop()); //Resets scroll position $(document).on('click', '.results-filter-content .list-group-item a', function() { sessionStorage.scrollTop = ''; return true; }); } } /* Mobile menu functionality */ $(document).on('click', '.search-apps li.mobile-menu > a', function() { $('.search-apps li ul').toggleClass('show'); if ($('.search-apps li ul').hasClass('show')) { $(this).attr('aria-expanded','true'); $(this).addClass('active'); $(this).find('.fas').removeClass('fa-chevron-circle-right').addClass('fa-chevron-circle-down'); } else { $(this).attr('aria-expanded','false'); $(this).removeClass('active'); $(this).find('.fas').removeClass('fa-chevron-circle-down').addClass('fa-chevron-circle-right'); } return false; }); /* Side menu */ $('.search-apps li a').keydown( function(event) { // Up key if (event.keyCode == 38) { if ($(document.activeElement).closest('li').is('.mobile-menu')) { $(document.activeElement).closest('li').find('ul').children('li:visible:last').find('a').focus(); } else if ($(document.activeElement).closest('li').is(':nth-child(1)')) { $(document.activeElement).closest('li').siblings(':visible:last').find('a').focus(); } else if (!$(document.activeElement).closest('li').is(':nth-child(1)')) { if ($(document.activeElement).closest('li').prev().is('.search-apps li:visible')) { $(document.activeElement).closest('li').prev('.search-apps li:visible').find('a').focus(); } else if ($(document.activeElement).closest('li').prev('.search-apps li:hidden')) { $(document.activeElement).closest('li').siblings(':visible:last').find('a').focus(); } } event.preventDefault(); } // Down key if (event.keyCode == 40) { if ($(document.activeElement).closest('li').is('.mobile-menu')) { $(document.activeElement).closest('li').find('ul').children('li:nth-child(1)').find('a').focus(); } else if ($(document.activeElement).closest('li').is('.search-apps li:visible:last')) { $(document.activeElement).closest('li').siblings(':nth-child(1)').find('a').focus(); } else if (!$(document.activeElement).closest('li').is('.search-apps li:visible:last')) { if ($(document.activeElement).closest('li').next().is('.search-apps li:visible')) { $(document.activeElement).closest('li').next().find('a').focus(); } else if ($(document.activeElement).closest('li').next('.search-apps li:hidden')) { $(document.activeElement).closest('li').siblings(':visible:last').find('a').focus(); } } event.preventDefault(); } // Escape key if(event.which == 27) { if ($('.search-apps li ul').hasClass('show')) { $('.search-apps li ul').removeClass('show'); $('.mobile-menu a').attr('aria-expanded','false'); } event.preventDefault(); } }); $('.searchString, .locationstring').on('focus', function(){ $('.input-wrapper').addClass('focus'); if ($(".searchString").val() == "") { } }); $('.searchString, .locationstring').on('blur', function(){ $('.input-wrapper').removeClass('focus'); }); /* $("#searchString").on("keyup", function () { var search = this.value; if (!search) { //console.log('#searchString has no value!'); $("#searchString").val(""); } }); */ $('.searchString, .locationstring').change(); // Hide location options with timer var timeoutHideLocationOptionTimer; function hideLocationOptionTimer() { timeoutHideLocationOptionTimer = setTimeout(function(){ //console.log('hideLocationOptionTimer!!!!!'); $('#cityPostalCodeSpecial').addClass('wb-inv'); //$('#advanced-search-button').focus(); }, 200); } $(".locationstring").on('focus', function() { //console.log('#locationstring focus'); clearTimeout(timeoutHideLocationOptionTimer); //if (!$('#header-search').hasClass("search-visible")) { $('#cityPostalCodeSpecial').removeClass('wb-inv'); //} $('.search-input-content').addClass('focus'); //console.log('focus'); var search = this.value; if (search) { //console.log('Has value!'); //if (!$('#header-search').hasClass("search-visible")) { $('#cityPostalCodeSpecial').addClass('wb-inv'); //} } else { //console.log('No value!'); //if (!$('#header-search').hasClass("search-visible")) { $('#cityPostalCodeSpecial').removeClass('wb-inv'); //} } }); // When the user type, we hide div $(".locationstring").on("keyup", function () { var search = this.value; $('#cityPostalCodeSpecial').removeClass('wb-inv'); if (search) { //console.log('#locationstring - Has value'); //if (!$('#header-search').hasClass("search-visible")) { $('#cityPostalCodeSpecial').addClass('wb-inv'); //} } else { //$("#locationstring").val(""); //console.log('#locationstring - Has NO value'); //if (!$('#header-search').hasClass("search-visible")) { $('#cityPostalCodeSpecial').removeClass('wb-inv'); //} } }); $(".locationstring").on('blur', function() { hideLocationOptionTimer(); $('#jobSearchBar').removeClass('focus'); }); $(".locationstring").keydown( function(event) { if(event.which == 27) { hideLocationOptionTimer(); event.preventDefault(); } }); $('#cityPostalCodeSpecial a').on('focus', function() { //console.log('#cityPostalCodeSpecial options - Focus ON'); clearTimeout(timeoutHideLocationOptionTimer); $('#cityPostalCodeSpecial').removeClass("wb-inv"); $('.search-input-content').addClass('focus'); }); $("#advanced-search-button").on("click", "a", function() { var text = $(this).attr("data-input"); var form = $(this).form; console.log("form found"); form.action = '?'+text; return false; }); $("#cityPostalCodeSpecial").on("click", "a", function() { //console.log('#cityPostalCodeSpecial option - Activated'); var text = $(this).attr("data-input"); var inputObject = $(this).parent(".ta-cityprovsuggest").find("input:text:first"); switch(text) { case "canada": $(".locationstring").val("Canada"); $(".locationstring").typeahead('val',"Canada"); break; case "local": if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(pos) { const latitude = pos.coords.latitude; const longitude = pos.coords.longitude; const accuracy = pos.coords.accuracy; const coordinatesString = "Latitude: " + latitude + ", Longitude: " + longitude + ", Accuracy: " + accuracy + " meters"; console.log("Coords: " + coordinatesString); var latlng = pos.coords; // ajax call to solr for name of city $('.locationstring').addClass('working'); // pt: '45.558958,-75.628912' // pt: latlng.lat+','+latlng.lng, $.ajax({ url: '/core/ta-postalcode/select', dataType: 'JSONP', async: false, data: { q: '*:*', wt: 'json', fl: '*,_dist_:geodist()', sfield:'geolocation', pt: latlng.latitude+','+latlng.longitude, sort: 'geodist() asc', rows:'1' }, jsonp: 'json.wrf', success: function(data,status) { $(".locationstring").val(data.response.docs[0].postalcode); $(".locationstring").typeahead('val',data.response.docs[0].postalcode); }, complete: function(jqXHR,status) { $('.locationstring').removeClass('working'); } }); }, function(error) { switch(error.code) { case error.PERMISSION_DENIED: console.log("User denied the request for Geolocation."); $(".locationstring").val(""); $("#messageblock").html('<div class="alert alert-info"><p>We can’t identify your current location</p></div>'); break; case error.POSITION_UNAVAILABLE: console.log("Location information is unavailable."); $(".locationstring").val(""); $("#messageblock").html('<div class="alert alert-info"><p>We can’t identify your current location</p></div>'); break; case error.TIMEOUT: console.log("The request to get user location timed out."); $(".locationstring").val(""); $("#messageblock").html('<div class="alert alert-info"><p>We can’t identify your current location</p></div>'); break; case error.UNKNOWN_ERROR: console.log("An unknown error occurred."); $(".locationstring").val(""); $("#messageblock").html('<div class="alert alert-info"><p>We can’t identify your current location</p></div>'); break; } }); } else { $(".locationstring").val(""); $("#messageblock").html('<div class="alert alert-info"><p>We can’t identify your current location</p></div>'); } break; case "profile": $(".locationstring").val("@profile"); $(".locationstring").typeahead('val',"@profile"); break; } return false; }); $("#cityPostalCodeSpecial").on("blur", "a", function() { //console.log('Link out!'); $('#jobSearchBar').removeClass('focus'); hideLocationOptionTimer(); }); $("#cityPostalCodeSpecial").keydown( function(event) { if(event.which == 27) { hideLocationOptionTimer(); event.preventDefault(); } }); $('.results-content.filter-visible .results-filter-button-overlay').css('display', 'inline-block'); $('.results-filter-button-overlay').show(); $('.command-result-filter-overlay').addClass('active').attr('aria-expanded','false');; if (localStorage) { if ($('.hero-content-wrapper').length) { //console.log("#Landing page so filter is active"); localStorage.setItem('functionResultFilter', 'active'); } } //Advance search - language filter always associated with Job Bank jobs /* $('input[name="jobSearchForm:flg"]').change( function() { var langFlag = $('input[name="jobSearchForm:flg"]'); if ($(langFlag).is(':checked')) { $('#jobSearchForm\\:fsrc\\:0').prop('checked',true); } else { $('#jobSearchForm\\:fsrc\\:0').prop('checked',false); } }); */ $('input[name="jobSearchForm:flg"]').change(); $(document).on('click', '#searchButton', function() { if ($(this).parents("section#search-input-content").hasClass("show-advance-search")) { //console.log('advance search'); //alert('advance search'); $('#searchButtonAdvance').click(); } else { //console.log('normal search'); //alert('normal search'); if ($(this).parents("#jobSearchBar")) { //console.log('jobsearch form'); adobeDataLayer.push({ "event": "customclick", "link": { "customCall":"ESDC:EDSC:JobBank Job Search Click" } }); //return false; } sessionStorage.scrollTop = ''; return true; } return false; }); //Toggle checkbox for fper $(document).on('click', '#jobSearchForm\\:fper input:checkbox', function() { var fper = $('#jobSearchForm\\:fper input:checkbox'); var checked = $(this).is(':checked'); fper.prop('checked',false); if(checked) { $(this).prop('checked',true); } }); /* $('.tt-input').blur(function(event) { let menuLength = $('.tt-dataset-ta-communitysuggest > p').length if(event.keyCode == 13 && menuLength == 1) { $('.tt-dataset-ta-communitysuggest p:first-child').first()[0].click() } }); */ $('button.command-advance-search-clear').click( function(){ $('#search-module').get(0).reset(); $('#search-module input[type=checkbox]').removeAttr('checked'); $('#search-module input[type=radio]').removeAttr('checked'); $('#search-module select').val(""); $('#search-module input[name=pcode').val(""); }); //GA $('#homePage').submit(function(){ if (_gaq != undefined) { _gaq.push(['_trackEvent', 'jobSearch', 'source : homePage', $(".searchString").val()]); } }); $('#jobSeekersPage').submit(function(){ if (_gaq != undefined) { _gaq.push(['_trackEvent', 'jobSearch', 'source : jobSeekersPage', $(".searchString").val()]); } }); /* $('#jobSearchResultsJobSearchForm').submit(function(){ if (typeof _gaq !== 'undefined') if (!$("#cityPostalCodeInput").length) { //alert('GAQ title: '+$("#searchString").val()); _gaq.push(['_trackEvent', 'jobSearch', 'source : jobSearchResultsPage', $("#searchString").val()]); } }); */ $('#jobPostingPage').submit(function(){ if (typeof _gaq !== 'undefined') { _gaq.push(['_trackEvent', 'jobSearch', 'source : jobPostingPage', $(".searchString").val()]); } }); // Advanced search $('#search-module').submit(function(){ var advancedSearchTitle = $("#dkw").val(); var advancedSearchLocation = $("#cityPostalCodeInput").val(); var advancedSearchEmployer = $("#empl").val(); //alert('GAQ title: '+advancedSearchTitle+'\nGAQ location: '+advancedSearchLocation+'\nGAQ employer: '+advancedSearchEmployer); if (_gaq != undefined) { _gaq.push(['_trackEvent', 'advancedSearchTitle', 'source : advancedSearchPage', advancedSearchTitle]); _gaq.push(['_trackEvent', 'advancedSearchLocation', 'source : advancedSearchPage', advancedSearchLocation]); _gaq.push(['_trackEvent', 'advancedSearchEmployer', 'source : advancedSearchPage', advancedSearchEmployer]); } }); // Modified CSJ search - For mobile app compatibility /* $('#youthPage, #jobSearchResultsJobSearchForm.csj').submit(function(){ var jobTitle = $("#searchString").val(); var jobTitlePseudo = $("#searchStringPseudo").val(); var location = $("#cityPostalCodeInput").val(); if (localStorage) { if ($("#cityPostalCodeInput").length) { //alert('CSJ search!'); var replaceDuplicateLocation = location; var replaceDuplicateLocationString = new RegExp(replaceDuplicateLocation,"g"); var newSearchStringPseudo = jobTitlePseudo.replace(replaceDuplicateLocationString, ''); var newSearchString = jobTitle.replace(location, ''); if ($(this).attr('id') === 'youthPage') { //alert('This is Youth Page CSJ search!'); localStorage.removeItem('youthSearchLocation'); localStorage.setItem('youthSearchLocation', location); localStorage.setItem('fromYouthPage', JSON.stringify(true)); } if ($(this).attr('id') === 'jobSearchResultsJobSearchForm') { //alert('This is search results CSJ!'); localStorage.removeItem('youthSearchLocation'); localStorage.setItem('youthSearchLocation', location); localStorage.setItem('fromYouthPage', JSON.stringify(false)); } $('#searchString').val($.trim(newSearchStringPseudo+' '+location)); $("#cityPostalCodeInput").attr("disabled", "disabled"); $("#searchStringPseudo").attr("disabled", "disabled"); } } }); */ // Modified Volunteer search - For mobile app compatibility $('#volunteerPage, #jobSearchResultsJobSearchForm.volunteer').submit(function(){ //alert('Volunteer job - Submit'); var jobTitle = $(".searchString").val(); //var jobTitlePseudo = $("#searchStringPseudo").val(); var location = $("#cityPostalCodeInput").val(); if (localStorage) { if ($("#cityPostalCodeInput").length) { //alert('Volunteer search!'); //var replaceDuplicateLocation = location; //var replaceDuplicateLocationString = new RegExp(replaceDuplicateLocation,"g"); //var newSearchStringPseudo = jobTitlePseudo.replace(replaceDuplicateLocationString, ''); //var newSearchString = jobTitle.replace(location, ''); if ($(this).attr('id') === 'volunteerPage') { //alert('This is Volunteer Landing Page search!'); localStorage.removeItem('volunteerSearchLocation'); localStorage.setItem('volunteerSearchLocation', location); localStorage.setItem('fromVolunteerPage', JSON.stringify(true)); } if ($(this).attr('id') === 'jobSearchResultsJobSearchForm') { //alert('This is search results Volunteer!'); localStorage.removeItem('volunteerSearchLocation'); localStorage.setItem('volunteerSearchLocation', location); localStorage.setItem('fromVolunteerPage', JSON.stringify(false)); } $('.searchString').val(location); $("#cityPostalCodeInput").attr("disabled", "disabled"); //$("#searchStringPseudo").attr("disabled", "disabled"); } } }); /* Store the window width */ var windowWidth = $(window).width(); var resizeUI; /* Resize Event */ $(window).resize(function(){ // Check window width has actually changed and it's not just iOS triggering a resize event on scroll if ($(window).width() != windowWidth) { //console.log('Resize UI updated'); // Update the window width for next time windowWidth = $(window).width(); clearTimeout(resizeUI); resizeUI = setTimeout(resetUI, 400); } }); function resetUI() { //Mobile if ($('.results-filter-button-overlay').css('position') === 'fixed') { //console.log('#Mobile mode on!'); //resetSearchOverlay(); if (!$('#header-search').hasClass('search-visible')) { resetSearchOverlay(); resetDynamicFilter(); //$('#cityPostalCodeSpecial').removeClass('wb-inv'); } if (localStorage) { //Reset Filters no matter what if (localStorage.getItem('functionResultFilter') === 'active' ) { //console.log('#ResetUI: functionResultFilter ACTIVE'); $('.command-result-filter-overlay').removeClass('active').attr('aria-expanded','true');; $('.results-content').removeClass('filter-visible').addClass('filter-hide'); //$('.command-result-filter-overlay').html('<span class="fal fa-sliders-h" aria-hidden="true"></span> Filters'); if (!$('.command-result-filter-overlay').hasClass('options')) { $(this).html('<span class="fal fa-sliders-h" aria-hidden="true"></span> Filters'); } else { $(this).html('<span class="fal fa-sliders-h" aria-hidden="true"></span> Options'); } localStorage.setItem('functionResultFilter', 'disabled'); } else if (localStorage.getItem('functionResultFilter') === 'disabled' ) { //console.log('#ResetUI: functionResultFilter DISABLED'); $('.command-result-filter-overlay').removeClass('active').attr('aria-expanded','true');; $('.results-content').addClass('filter-hide').removeClass('filter-visible'); //$('.command-result-filter-overlay').html('<span class="fal fa-sliders-h" aria-hidden="true"></span> Filters'); /* if (!$('.command-result-filter-overlay').hasClass('options')) { $(this).html('<span class="fal fa-sliders-h" aria-hidden="true"></span> Filters'); } else { $(this).html('<span class="fal fa-sliders-h" aria-hidden="true"></span> Options'); } */ } // Sort by if (localStorage.getItem('functionSortBy') === null) { //First time user //console.log('sort null'); resetSortBy(); } else { if (localStorage.getItem('functionSortBy') === 'active' ) { activateSortBy(); //console.log('sort active'); } else if (localStorage.getItem('functionSortBy') === 'disabled' ) { if (!$('#header-search').hasClass('search-visible')) { resetSortBy(); //$('#cityPostalCodeSpecial').removeClass('wb-inv'); } //console.log('sort disabled'); } } } setTimeout(filterTaller, 300); } //Desktop if ($('.results-filter-button-overlay').css('position') === 'relative') { //console.log('#Desktop mode on!'); if (localStorage) { if (localStorage.getItem('functionResultFilter') === null) { //First time user localStorage.setItem('functionResultFilter', 'active'); showFilter(); } else { if (localStorage.getItem('functionResultFilter') === 'active' ) { //console.log('filter active!'); showFilter(); } else if (localStorage.getItem('functionResultFilter') === 'disabled' ) { //console.log('filter inactive!'); showFilter(); } } // Sort by if (localStorage.getItem('functionSortBy') === null) { //First time user resetSortBy(); } else { if (localStorage.getItem('functionSortBy') === 'active' ) { resetSortBy(); } else if (localStorage.getItem('functionSortBy') === 'disabled' ) { resetSortBy(); } } if (!$('#header-search').hasClass('search-visible')) { //console.log('ok header offf'); //$('#cityPostalCodeSpecial').addClass('wb-inv'); } } else { $('.results-content').addClass('filter-visible').removeClass('filter-hide'); if ($('.results-list-wrapper').hasClass("col-md-12")) { $('.results-list-wrapper').removeClass('col-md-12').addClass('col-md-9'); } // Sort by resetSortBy(); } resetSortBy(); resetSearchOverlay(); resetDynamicFilter(); setTimeout(filterTaller, 300); //showFilter(); } if ($('.results-content').hasClass('filter-hide')) { //console.log('#Desktop mode: filter-hide'); $("#results-filter-wrapper").addClass("invisible"); } else if ($('.results-content').hasClass('filter-visible')) { //console.log('#Desktop mode: filter-visible'); $("#results-filter-wrapper").removeClass("invisible"); } } //Mobile - Search Overlay Button $(document).on('click', '.command-search-overlay', function(event) { //console.log('search mobile CLICK'); hideFilter(); $("body").toggleClass("noScroll"); $('#header-search').toggleClass('search-visible'); $('main').toggleClass('search-visible'); $('.command-search-overlay').toggleClass('active'); $('.command-search-overlay').toggleClass('btn-primary btn-default'); resetSortBy(); if ($('#header-search').hasClass("search-visible")) { //$('#cityPostalCodeSpecial').removeClass('wb-inv'); if ($('.searchString').length) { $('.searchString').focus(); } /* if ($('#searchStringPseudo').length) { $('#searchStringPseudo').focus(); } */ $('.results-filter-button-overlay, .search-input-content').addClass('noBorder'); //console.log('search mobile SHOW!'); $(this).find('.text').text("Close"); $(this).find('.far').removeClass('fa-search').addClass('fa-times'); } else { if (!$('#cityPostalCodeSpecial').hasClass('wb-inv')) { //console.log('huh'); $('#cityPostalCodeSpecial').addClass('wb-inv'); } $('.results-filter-button-overlay, .search-input-content').removeClass('noBorder'); //console.log('search mobile HIDE!'); $(this).find('.text').text("Search"); $(this).find('.far').removeClass('fa-times').addClass('fa-search'); } //$('html, body').animate({ scrollTop: $('#jobSearchBar').offset().top }, '500'); return false; //e.preventDefault(); }); //Activate Filter $(document).on('click', '.command-result-filter-overlay', function(event) { var filterButton = $(this); resetSearchOverlay(); resetSortBy(); var courseSearch = false; if (courseSearch) { checkSelectedFilter(); } $("body").removeClass("noScroll"); $(this).toggleClass('active'); if ($(this).hasClass('active')) { sessionStorage.scrollTop = $(window).scrollTop(); //console.log('Scroll position: '+$(window).scrollTop()); } $('.results-content').toggleClass('filter-visible filter-hide'); if ($('.command-result-sortby-overlay').hasClass("active")) { $('.results-filter-button-overlay').addClass('noBorder'); } else { $('.results-filter-button-overlay').removeClass('noBorder'); } if ($('.results-content').hasClass('filter-visible')) { $(this).attr('aria-expanded','true'); //console.log('Display Filter!'); $('.skip-to-filters').show(); if ($('.results-filter-button-overlay').css('position') === 'fixed') { if ($(this).parent('.results-filter-button-overlay')) { //console.log('mobile go to filter top'); $('html, body').animate({ scrollTop: $('#results-filter-wrapper').offset().top }, 'fast'); } } if (localStorage) { //console.log('#Activate filter button: functionResultFilter active'); localStorage.setItem('functionResultFilter', 'active'); } } else if ($('.results-content').hasClass('filter-hide')) { $(this).attr('aria-expanded','false'); $('.skip-to-filters').hide(); if ($('.results-filter-button-overlay').css('position') === 'fixed') { if ($(this).parent('.results-filter-button-overlay')) { //console.log('!No filter - mobile go to result top'); if (sessionStorage.scrollTop != "undefined") { $(window).scrollTop(sessionStorage.scrollTop); //console.log('Old scroll position: '+$(window).scrollTop()); } //$('html, body').animate({ scrollTop: $('#results-list-content').offset().top }, 'fast'); } } if (localStorage) { //console.log('#Activate filter button: functionResultFilter disabled'); localStorage.setItem('functionResultFilter', 'disabled'); } } setTimeout(function(){ if ($('.results-content').hasClass('filter-hide')) { $("#results-filter-wrapper").addClass("invisible"); } else if ($('.results-content').hasClass('filter-visible')) { $("#results-filter-wrapper").removeClass("invisible"); } }, 200); $('.results-list-wrapper').removeClass('noanim'); $('.results-list-wrapper').toggleClass('col-md-12 col-md-9'); setTimeout(filterTaller, 300); }); //Activate Sort By $(document).on('click', '.command-result-sortby-overlay', function(event) { resetSearchOverlay(); hideFilter(); $("body").removeClass("noScroll"); $('main').toggleClass('sortby-visible'); $('.command-result-sortby-overlay').toggleClass('active'); if ($('.command-result-sortby-overlay').hasClass("active")) { if ($('.results-sortby-group').css('display') === 'none') { //console.log('.results-sortby-group is currently hidden'); //console.log('.results-sortby-group SHOW!'); localStorage.setItem('functionSortBy', 'active'); $('.results-filter-button-overlay').addClass('noBorder'); $('.results-sortby-group').addClass('sortby-group-visible'); } } else { if ($('.results-sortby-group').css('display') === 'block') { //console.log('.results-sortby-group HIDE!'); localStorage.setItem('functionSortBy', 'disabled'); $('.results-filter-button-overlay').removeClass('noBorder'); $('.results-sortby-group').removeClass('sortby-group-visible'); } } }); $(document).on('click', '.results-sortby-group a.btn', function(event) { localStorage.setItem('functionSortBy', 'disabled'); }); $(document).on('click', '.overlay', function(event) { if ($(this).css('visibility') === 'visible') { resetSearchOverlay(); resetSortBy(); } }); setTimeout(filterTaller, 300); //Reset for Input Ranger Slider $('#jobSearchResultsJobSearchForm').submit( function(){ if (localStorage) { localStorage.setItem('functionSearchSubmit', 'true'); } }); //Input Ranger Slider Ouput Events if (localStorage) { if(!localStorage.getItem("functionRangeSliderOuputValue")){ var id,val; } else { if(!localStorage.getItem("functionSearchSubmit")){ //var id = localStorage.getItem('functionRangeSliderOuputID'); //var val = localStorage.getItem('functionRangeSliderOuputValue'); //$('#'+id).val(val); //Rely on JSF param var id,val; } else { if(localStorage.getItem("functionSearchSubmit") === 'true'){ localStorage.removeItem("functionRangeSliderOuputValue"); localStorage.removeItem("functionSearchSubmit"); } } } } //Input Range event var timeoutHandler = window.setTimeout(function() {;},1); activateRangeSlider(); //Floating label $('.float-input').on('focus blur change', function (e) { $(this).parents('.related-group').prev('label.control-label').find('.label').removeClass('focus-error').toggleClass('focus', (e.type === 'focus' || this.value.length > 0 )); if($(this).val()!=""){ //console.log('value'); $(this).parents('.related-group').prev('label.control-label').find('.label').removeClass('focus-error').addClass('focus', (e.type === 'focus' || this.value.length > 0 )); } else { //console.log('empty'); } }).trigger('focus blur change'); $('.float-input').on('focus blur change'); //event tracking for search $('#search-module').submit(function(e){ var label = []; //console.log(label); //check what the advanced search is about if($(".searchString").val()) label.push("Keyword"); if($("#pcode").val()) label.push("Job Number"); var flg = document.getElementsByName('flg'); for (var i = 0, length = flg.length; i < length; i++) { if (flg[i].checked) { label.push("Language"); break; } } var fper = document.getElementsByName("fper"); for (var i = 0, length = fper.length; i < length; i++) { if (fper[i].checked) { label.push("Period of Employment"); break; } } var fter = document.getElementsByName("fter"); for (var i = 0, length = fter.length; i < length; i++) { if (fter[i].checked) { label.push("Job Type"); break; } } var fss = document.getElementsByName("fss"); for (var i = 0, length = fss.length; i < length; i++) { if (fss[i].checked) { label.push("Education Level"); break; } } var fsrc = document.getElementsByName('fsrc'); for (var i = 0, length = fsrc.length; i < length; i++) { if (fsrc[i].checked) { label.push("Federal Jobs Filter"); break; } } var fjsf = document.getElementsByName('fjsf'); if(fjsf[0].checked) label.push("Student Job Filter"); var fet = document.getElementsByName('fet'); if(fet[0].checked) label.push("Non-Placement Agency Filter"); //var fgff = document.getElementsByName('fgff'); //if(fgff[0].checked) label.push("Government Funded Jobs Filter"); var fprov = document.getElementsByName("fprov"); for (var i = 0, length = fprov.length; i < length; i++) { if (fprov[i].checked) { label.push("PTs and Regions"); break; } } var fcat = document.getElementsByName("fcat"); for (var i = 0, length = fcat.length; i < length; i++) { if (fcat[i].checked) { label.push("Job Categories"); break; } } if($("select[name=fn]").val()) label.push("Job Titles"); //format result (always +',' to keep things as they are since the error was made at the begining...) var results = ''; for(var i=0,len=label.length;i<len;i++){ results+=label[i]+', '; } //push event _gaq.push(['_trackEvent', 'jobSearch', 'source : advancedSearchPage', results]); //console.log(results); }); // Economic Regions list is hidden by default $(".geoarea_list").hide(); // Show Economic Regions belonging to a P/T when this P/T is select $('input.select-pt').change(function() { if($(this).is(':checked')) { //console.log('Checked Province'); $(this).parent().find('.geoarea_list').show(); $(this).next('label').children('i').addClass('fa-minus-square').removeClass('fa-plus-square'); if ($(this).parent().find('.geoarea_list').find('input[id^="box-fgeo-"]').is(':checked')) { $(this).prop('checked', true); $(this).parent().find('.geoarea_list').find('input[id^="box-fgeo-"]').prop('checked', false); } } else { //console.log('Unchecked Province'); $(this).parent().find('.geoarea_list').hide(); $(this).next('label').children('i').addClass('fa-plus-square').removeClass('fa-minus-square'); if ($(this).parent().find('.geoarea_list').find('input[id^="box-fgeo-"]').is(':checked')) { //console.log('Cities are already checked!'); $(this).prop('checked', false); //console.log('Uncheck province!'); } } }); // Uncheck P/T when a Economic Region inside the P/T is selected $('input[id^="box-fgeo-"]').change(function() { //console.log('Cities Checked then Unchecked Province'); $(this).parents('.geoarea_list').parent().find('input.select-pt').prop('checked', false); }); var itself; $('.btn-apply').click( function() { externalJobLink(); $('#external-job-show').addClass('hide'); //var itself = false; }); //Apply $('#external-job-show').click( function(){ var itself = true; externalJobLink(); $('#external-job-show').addClass('hide'); return false; }); /* function externalJobLink() { if (!itself == true) { $('#external-job-details').attr('open',''); } $('#externalJobLink').animate({opacity:1}, 0, function(){ $(this).addClass('animated bounceIn'); setTimeout(function(){ $('#externalJobLink').focus(); }, 900); }); } */ /* Uh new Firefox supports details :O */ $('details summary').click( function() { setTimeout(filterTaller, 10); }); //Adjust height of the result page on hover $(".resultJobItem.jobSearchItem .results-nav").hover(function() { setTimeout(filterTaller, 10); }); $(document).on('click', '.resultJobItem', function() { sessionStorage.scrollTop = $(window).scrollTop(); //console.log('Open job - scroll position: '+$(window).scrollTop()); //$(this).trigger('click'); //return false; }); //Favourites button on search results page /* $('a.favourite').not('.jobposting').click( function(e) { if (!$(this).hasClass('saved')) { var removeUrl = $(this).attr('href').replace('addfavourite', 'removefavourite'); $(this).attr('href', removeUrl); $(this).addClass('saved'); $(this).find('.wb-inv').text("Favourited"); } else { var addUrl = $(this).attr('href').replace('removefavourite', 'addfavourite'); $(this).attr('href', addUrl); $(this).removeClass('saved'); $(this).find('.wb-inv').text("Save job posting"); } //e.preventDefault(); //Comment this line if default action needs to go through }); */ setTimeout(filterTaller, 300); /* $("[name='problem']").change( function() { var problemValue = $(this).val(); var redirectFormValue; if (problemValue === 'problem_employer') { redirectFormValue = "/support/reportproblemform" } else { redirectFormValue = "../jobsearch/" } $('#reportProblemJobPosting').attr('action', redirectFormValue); }); $('#reportProblemJobPosting .command-submit-pjp').click(function(){ $('#reportProblemJobPosting').submit(); }); */ //Report a problem with this job posting $(document).on('click', '.btn-report', function() { $('.job-posting-detail-common .gc-rprt-prblm-frm .options').removeClass('show').addClass('hide'); $('.job-posting-detail-common .gc-rprt-prblm-frm input[type=radio]').prop('checked', false); $('.job-posting-detail-common .gc-rprt-prblm-frm .options input[type=checkbox]').prop('checked', false); $('.job-posting-detail-common .gc-rprt-prblm-frm .options input[type=text]').val(''); ///$('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').addClass('disabled').prop("disabled", true); }); //Radio options $('.job-posting-detail-common .gc-rprt-prblm-frm input[type=radio]').change( function() { var toggleOptions = $(this).data('reveal'); if($(this).is(':checked')) { $('.job-posting-detail-common .gc-rprt-prblm-frm .options').not(this).removeClass('show').addClass('hide'); $('.job-posting-detail-common .gc-rprt-prblm-frm .options input[type=checkbox]').prop('checked', false); $('.job-posting-detail-common .gc-rprt-prblm-frm .options input[type=text]').val(''); $('.job-posting-detail-common .gc-rprt-prblm-frm fieldset .form-group.options .other-textbox').val(''); $(toggleOptions).removeClass('hide').addClass('show'); if (!$(this).hasClass('hasOptions')) { //console.log('Radio selected'); //console.log('Enable submit button'); $('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').prop("value", "Report"); ///$('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').removeClass('disabled').prop("disabled", false); } else { //console.log('Radio selected with reveal more'); //console.log('Disable submit button'); $('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').prop("value", "Submit"); ///$('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').addClass('disabled').prop("disabled", true); } } }); //Checkbox options $('.job-posting-detail-common .gc-rprt-prblm-frm .options input[type="checkbox"]').change( function() { //console.log('checkboxes function!'); //var checkedBoxes = $('.job-posting-detail-common .gc-rprt-prblm-frm .options input[type="checkbox"]').is(':checked'); var checkedBoxes = $('.job-posting-detail-common .gc-rprt-prblm-frm .options input[type="checkbox"]').is(':checked'); var checkedBoxesReveal = $('.job-posting-detail-common .gc-rprt-prblm-frm .options input.reveal[type="checkbox"]').is(':checked'); if ($(this).data('reveal')) { //console.log('@@@@@@@@@@@@@@@@@@@@@@@@@@'); //console.log('Checkbox with reveal more'); var toggleOptions = $(this).data('reveal'); // Check other checked boxes if ($(checkedBoxes)) { //console.log('1 - OTHER checkboxes are checked'); //console.log('OTHER checkboxes are checked & enable submit'); //$('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').removeClass('disabled').prop("disabled", false); ///$('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').removeClass('disabled').prop("disabled", false); } else { //console.log('No other checkboxes are checked'); //$('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').addClass('disabled').prop("disabled", true); ///$('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').removeClass('disabled').prop("disabled", false); } // Checkbox with reveal is checked if ($(this).is(':checked')) { //console.log('Checkbox checked with text input & disabled submit'); $(toggleOptions).removeClass('hide').addClass('show'); $('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').addClass('disabled').prop("disabled", true); $(this).parents('.checkbox').next('.options').find('.other-textbox').focus(); $(this).parents('.checkbox').next('.options').find('.other-textbox').on('keyup blur focus changes', function() { if (!$(this).val()) { ///$('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').addClass('disabled').prop("disabled", true); //console.log('Textarea is empty & disable submit'); } else { //console.log('Textarea has text & enable submit'); ///$('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').removeClass('disabled').prop("disabled", false); } }); } else { //console.log('Checkbox reveal UNchecked'); $(this).parents('.checkbox').next('.options').find('.other-textbox').val(''); $(toggleOptions).removeClass('show').addClass('hide'); //$('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').addClass('disabled').prop("disabled", true); } } else { //console.log('============================='); //console.log('Solo Checkbox'); if ($('.job-posting-detail-common .gc-rprt-prblm-frm .options input[type="checkbox"]').is(':checked')) { //console.log('OTHER checkboxes are checked'); if ($('.job-posting-detail-common .gc-rprt-prblm-frm .options input.reveal[type="checkbox"]').is(':checked')) { //console.log('reveal is checked'); if (!$(this).parents('.options').find('.options').find('.other-textbox').val() == '') { //console.log('Text!'); ///$('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').removeClass('disabled').prop("disabled", false); } else { //console.log('NO Text!'); ///$('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').addClass('disabled').prop("disabled", true); } } else { //console.log('No reveal is checked'); ///$('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').removeClass('disabled').prop("disabled", false); } } else { //console.log('NO Checkboxes AT ALL!'); ///$('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').addClass('disabled').prop("disabled", true); } if ($("#topic_20").is(':checked')){ if( (!checkedBoxes) || $('.other-textbox-20').val().length < 5){ ///$('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').addClass('disabled').prop("disabled", true); } else { ///$('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').removeClass('disabled').prop("disabled", false); } } } }).change(); //$('.job-posting-detail-common .gc-rprt-prblm-frm .options input[type="checkbox"]').change(); $('.other-textbox-20').on('keyup', function(){ var checkedBoxes = $('.job-posting-detail-common .gc-rprt-prblm-frm .options input[type="checkbox"]').is(':checked'); if ((!checkedBoxes) || ($('.other-textbox-20').val().length < 5)) { ///$('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').addClass('disabled').prop("disabled", true); } else { ///$('.job-posting-detail-common .gc-rprt-prblm-frm .btn-submit').removeClass('disabled').prop("disabled", false); } }); $(document).on('click', '#toggleRecentSearch', function(event) { if ($(this).parent().is('#recent-search')) { $(this).parent().toggleClass('show'); $(this).toggleClass('active'); } if ($(this).parent().hasClass('show')) { $('.listRecentSearch li a').first()[0].focus(); } return false; }); }); function saveLoginRedirectURIListener(e) { var jobid = $(e).data("jobid"); var redirect = '/jobsearch/addfavourite/'+jobid; sessionStorage.removeItem('loginRedirectURI'); sessionStorage.setItem('loginRedirectURI', redirect); //alert('redirect is: '+redirect); //console.log('favourite - non-logged in and guest'+ redirect); //return false; } function saveLoginRedirectURIListenerGeneric(e) { var redirect = ''+$(e).data("redirect"); sessionStorage.removeItem('loginRedirectURI'); sessionStorage.setItem('loginRedirectURI', redirect); //alert('redirect is: '+redirect); //console.log('favourite - non-logged in and guest'+ redirect); //return false; } function filterTaller() { //console.log('filterTaller'); var filterBox = $('.results-filter-wrapper').height(); var resultBox = $('.results-list-wrapper').height(); if ($('.search-input-content').css('display') === 'none') { //console.log('filterTaller display none - Mobile!'); $('section.results-content').css('height','auto'); } else { //console.log('filterTaller display block - Desktop!'); if ($('section.results-content').hasClass('filter-visible')) { if ($('.results-filter-button-overlay').css('position') === 'relative') { if (filterBox > resultBox) { //console.log('filter box is taller: '+filterBox+' result box is: '+resultBox); $('section.results-content').height(filterBox); } } if (resultBox > filterBox) { //console.log('result box is taller: '+resultBox+' filter box is: '+filterBox); $('section.results-content').css('height','auto'); } } else if ($('section.results-content').hasClass('filter-hide')) { //console.log('no filter box'); $('section.results-content').css('height','auto'); } } } //}); $(document).on( "wb-ready.wb-details", "summary", function( event ) { $(document).on('click', 'details summary', function() { setTimeout(filterTaller, 0); }); function filterTaller() { var filterBox = $('.results-filter-wrapper').height(); var resultBox = $('.results-list-content').height(); if ($('section.results-content').hasClass('filter-visible')) { if ($('.results-filter-button-overlay').css('position') === 'relative') { if (filterBox > resultBox) { //console.log('filter box is taller: '+filterBox); $('section.results-content').height(filterBox); } } if (resultBox > filterBox) { //console.log('result box is taller: '+resultBox); $('section.results-content').css('height','auto'); } } else if ($('section.results-content').hasClass('filter-hide')) { //console.log('no filter box'); $('section.results-content').css('height','auto'); } } setTimeout(filterTaller, 300); }); function saveJob(data,jobid) { //console.log('fetch'); var thisJobID = $("input[name='jobid'][value="+jobid+"]"); var thisJobIDfav = thisJobID.nextAll('.favourite'); //console.log('element ID: '+thisJobIDfav); if (data.status === 'begin') { //Start loading animation //console.log('begin'); $(thisJobIDfav).addClass('working'); } else if (data.status === 'complete') { //console.log('complete'); //End loading animation $(thisJobIDfav).removeClass('working'); /* $(thisJobIDfav).addClass('done').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){ $(thisJobIDfav).removeClass('done'); console.log('finito!'); }); */ } else if (data.status === 'success') { //console.log('Done!'); } } // favourite actions function setLoginRedirectURIFavourite(e) { //var form = $('#loginForm'); var jobid = $(e).attr("data-jobid"); var redirect = '/jobsearch/addfavourite/'+jobid; //var inputredirectURI = form.find('#loginForm\\:input-redirectURI'); //inputredirectURI.val(redirect); // Save data to sessionStorage sessionStorage.removeItem('loginRedirectURI'); sessionStorage.setItem('loginRedirectURI', redirect); //console.log('Redirect: '+redirect); } function removeArticle(e) { var article = $(e).parents('article'); article.remove(); } function toggleFavourite(e) { $(e).addClass('working'); var callingmethod = 'PUT'; if ( $(e).hasClass('saved') ) { callingmethod = 'DELETE'; } //requestObject.lang = document.documentElement.lang; $.ajax({ url: '/jbaction/FavouriteJob/'+$(e).data('jobid'), type: callingmethod, dataType: 'json', success: function(data,status) { if ($(e).hasClass('saved')) { $(e).removeClass('saved'); $(e).html('<span class="wb-inv">Favourite</span>'); } else { $(e).addClass('saved'); $(e).html('<span class="wb-inv">Favourited</span>'); } // $(e).removeClass('working'); }, error: function( jqXHR,status) { $(e).removeClass('working'); if (jqXHR.status==401) { setLoginRedirectURIFavourite(e); var redirect = '/login'; window.location.href = redirect; } else if (jqXHR.status==403) { // redirect intructions var redirect = window.location.pathname; setLoginRedirectURI(redirect); // redirect var redirect = '/reg/instructions'; window.location.href = parenturl; } }, complete: function(jqXHR,status) { $(e).removeClass('working'); } }); } function recordApply(e) { $(e).addClass('working'); var callingmethod = 'PUT'; $.ajax({ url: '/jbaction/recordApply/'+$(e).data('jsjobid'), type: callingmethod, dataType: 'json', complete: function(jqXHR,status) { $(e).removeClass('working'); } }); } function actiontodataurl(e) { var dataurl = $(e).data("url"); var form = $(e).closest('form'); form.attr('action', dataurl); form.submit(); } $(document).click(function(event) { if($('#recent-search').hasClass("show")) { $('#recent-search').removeClass('show'); $("#toggleRecentSearch").removeClass('active'); //console.log('remove show'); } }); function activateRangeSlider() { $("input[type='range']").on('input change',function(e) { /* var as1 = $(e.target).attr('data-sign1'); var as2 = $(e.target).attr('data-sign2'); */ var id = $(e.target).attr('id'); var form = $(e.target).parents('form:first'); var output = form.find('.output'); var value = parseFloat($(e.target).val()); updateRangeSliderOuput(output,id,value); //console.log('range input change!'); //alert('range input change!'); }); $("input[type='range']").change(); /* $("input[type='range']").on('keypress',function(e) { var id1 = $(e.target).attr('id'); var val1 = $(e.target).val(); //alert(val1); updateRangeSliderOuput(id1,val1); }); $("input[type='range']").change(); */ $(document).on('click', 'a.decrease.range-slider-button', function(e) { var form = $(e.target).parents('form:first'); var output = form.find('.output'); var slider = form.find("input[type='range']"); var step = parseFloat(slider.attr('step')); var minvalue = parseInt(slider.attr('min')); var value = parseFloat(slider.val()); value = value-step if (value<minvalue) { value=minvalue; } slider.val(value); updateRangeSliderOuput(output,slider.attr('id'),value); //slider.change(); var querystring = form.find("#locationstring-querystring"); if ( typeof querystring !== 'undefined') { var formaction = form.attr('action'); var posQuest = formaction.indexOf("?"); if (posQuest>=0) { formaction = formaction.substring(0,posQuest); } var qstringval = querystring.val(); var newqstringval = qstringval.replace(/(^|&)d=[0-9]+(&|$)/g,'$1d='+value+'$2'); console.log("newqstringval:"+newqstringval); form.attr('action',formaction+'?'+newqstringval); } window.clearTimeout(timeoutHandler); timeoutHandler = setTimeout(function(){ form.submit(); //slider.focus(); }, 2000); }); $(document).on('click', 'a.increase.range-slider-button', function(e) { var form = $(e.target).parents('form:first'); var output = form.find('.output'); var slider = form.find("input[type='range']"); var step = parseFloat(slider.attr('step')); var maxvalue = parseInt(slider.attr('max')); var value = parseFloat(slider.val()); value = value+step if (value>maxvalue) { value=maxvalue; } slider.val(value); updateRangeSliderOuput(output,slider.attr('id'),value); //slider.change(); var querystring = form.find("#locationstring-querystring"); if ( typeof querystring !== 'undefined') { var formaction = form.attr('action'); var posQuest = formaction.indexOf("?"); if (posQuest>=0) { formaction = formaction.substring(0,posQuest); } var qstringval = querystring.val(); var newqstringval = qstringval.replace(/(^|&)d=[0-9]+(&|$)/g,'$1d='+value+'$2'); console.log("newqstringval:"+newqstringval); form.attr('action',formaction+'?'+newqstringval); } window.clearTimeout(timeoutHandler); timeoutHandler = setTimeout(function(){ form.submit(); //slider.focus(); }, 2000); }); $('input[type=range]').on('mouseup touchend', function(e) { var form = $(e.target).parents('form'); var querystring = form.find("#locationstring-querystring"); if ( typeof querystring !== 'undefined') { var slider = form.find("input[type='range']"); var value = parseFloat(slider.val()); var formaction = form.attr('action'); var posQuest = formaction.indexOf("?"); if (posQuest>=0) { formaction = formaction.substring(0,posQuest); } var qstringval = querystring.val(); var newqstringval = qstringval.replace(/(^|&)d=[0-9]+(&|$)/g,'$1d='+value+'$2'); form.attr('action',formaction+'?'+newqstringval); } window.clearTimeout(timeoutHandler); timeoutHandler = setTimeout(function(){ form.submit(); }, 1000); }); $('input[type=range]').on('keyup', function(e) { var key = e.which; // Enter key if( (key == 13) ) { var form = $(e.target).parents('form'); var querystring = form.find("#locationstring-querystring"); if ( typeof querystring !== 'undefined') { var slider = form.find("input[type='range']"); var value = parseFloat(slider.val()); var formaction = form.attr('action'); var posQuest = formaction.indexOf("?"); if (posQuest>=0) { formaction = formaction.substring(0,posQuest); } var qstringval = querystring.val(); var newqstringval = qstringval.replace(/(^|&)d=[0-9]+(&|$)/g,'$1d='+value+'$2'); form.attr('action',formaction+'?'+newqstringval); } form.submit(); return false; } return false; }); } //Input Range Slider function function updateRangeSliderOuput(output,id,val) { //console.log('slider function'); var value,label,details; //alert("ID " + id + " Value " + val); //Distance radius control if (id === "dist") { var details = '<span class="wb-inv">kilometers: selected distance</span>'; var label = '<span class="wb-inv">Current distance of</span>'; var value = '<span>'+val.toLocaleString('en-CA')+'</span>'; //var display_value = '<span aria-hidden=\'true\'>'+val+'</span>'; } /* else if (id === "salary") { var details = '<span class="wb-inv">thousand dollars is chosen</span>'; var label = '<span class="wb-inv">Current annual salary of</span>'; } */ if (localStorage) { //console.log('Function SAVED the values!'); localStorage.setItem('functionRangeSliderOuputValue', val); localStorage.setItem('functionRangeSliderOuputID', id); } //console.log('value: '+val); //Update display label //$('span[class="output amount-dist"]').html(value); output.text(val.toLocaleString('en-CA')); } /* function toggleFavourite(e) { $(e).addClass('working'); var requestObject = new Object(); requestObject.job2Id = $(e).data("jobid"); requestObject.jsJobId = $(e).data("jobid"); requestObject.applied = 'false'; if ( $(e).hasClass('saved') ) { requestObject.methodName = 'removeFavoriteJob'; } else { requestObject.methodName = 'addFavoriteJob'; } requestObject.lang = document.documentElement.lang; $.ajax({ url: '/jobbankservlet', type: 'POST', dataType: 'json', data: { methodName : requestObject.methodName, jsJobId: $(e).data('jobid') }, success: function(data,status) { if ($(e).hasClass('saved')) { $(e).removeClass('saved'); $(e).html('<span class="wb-inv">Favourite</span>'); } else { $(e).addClass('saved'); $(e).html('<span class="wb-inv">Favourited</span>'); } $(e).removeClass('working'); }, error: function( jqXHR,status) { $(e).removeClass('working'); if (jqXHR.status==401) { setLoginRedirectURIFavourite(e); var redirect = '/login'; window.location.href = redirect; } else if (jqXHR.status==403) { // redirect intructions var redirect = window.location.pathname; setLoginRedirectURI(redirect); // redirect var redirect = '/reg/instructions'; window.location.href = parenturl; } }, complete: function(jqXHR,status) { jqXHR; } }); } */ $(document).ready(function() { $('.select-and-go').on('click', function(e) { var form = $(this).parents('form:first'); var selectElement = form.find('select:first'); if (selectElement[0].value) { window.location = selectElement[0].value; } return false; }); }); //]]> </script> <script type="text/javascript"> </script> <script src="/invitation-manager/Overlay.js"></script> <script src="/invitation-manager/InvitationManager.js"></script> <script type="text/javascript">_satellite.pageBottom();</script></body> </html>