CINXE.COM
How do I search for jobs? - Job Bank
<!DOCTYPE html> <html class="no-js" lang="en" dir="ltr"><head id="j_id_5"> <meta charset="utf-8" /> <title>How do I search for jobs? - 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="How do I search for jobs? - Job Bank" /> <meta property="og:title" content="How do I search for jobs? - Job Bank" /> <meta name="description" property="og:description" content="Finding a job in Canada can be made easy by knowing what certain occupations are called in Canada, w" /> <meta property="og:url" content="http://www.jobbank.gc.ca/content.xhtml" /> <meta property="og:image" content="https://www.jobbank.gc.ca/themes-sat/assets/favicon-mobile.png" /><link type="text/css" rel="stylesheet" href="/jakarta.faces.resource/primeicons/primeicons.css.xhtml;jsessionid=D1C396406361FB3909CBEA1D5A2B235A.jobsearch74?ln=primefaces&v=12.0.0" /><script type="text/javascript">if(window.PrimeFaces){PrimeFaces.settings.locale='en_CA';PrimeFaces.settings.viewId='/content.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" /><!--[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/trouverunemploi/ressources/chercher-emplois" 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_22_4" name="j_id_22_4" method="post" action="/embauche/emploi-ete-canada;jsessionid=D1C396406361FB3909CBEA1D5A2B235A.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_22_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_24_3" name="j_id_24_3" method="post" action="/embauche/emploi-ete-canada;jsessionid=D1C396406361FB3909CBEA1D5A2B235A.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_24_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><li><a href="/findajob" >Find a job</a></li><li><a href="/findajob/resources" >Job search advice</a></li> </ol> </div> </nav> </header> <div id="header-search"> </div> <main role="main" property="mainContentOfPage" class="container"> <div class="container"> <div class="row"> <h1 property="name" id="wb-cont" class="content-pieces">How do I search for jobs?</h1> <span class="wb-inv">where_to</span><!-- CID = 203 --> <p>Finding a job can be challenging. However, there are many resources available to assist you with your job search.</p> <h2 class="portal">Where to start</h2> <p>To find a job, you can:</p> <ul> <li> Research employers you wish to work for. Most employers have a "Careers" section on their corporate website, where job postings will be listed. </li> <li> Get professional assistance from a recruiting agency. These agencies can search for jobs of your interest on your behalf. </li> <li> Go to a job fair in your city or town. A job fair is an event where employers and job seekers meet and discuss job opportunities. </li> <li> Use job boards and career websites to get access to thousands of job opportunities. For instance, <a href="https://www.jobbank.gc.ca/findajob">Job Bank</a> is one of the most popular job boards in Canada that provides innovative tools to help you find a job. </li> </ul> <h2 class="portal">Use Job Bank</h2> <p>Job Bank is Canada's one-stop job listing website. It's the largest online listing of bilingual job postings and one of the most popular job boards in Canada. All job postings are displayed in both official languages. Over one million new jobs are advertised on Job Bank every year, and thousands every day.</p> <p>Job Bank offers a variety of tools and services that can simplify your job search:</p> <ul> <li><a href="https://www.jobbank.gc.ca/mobileapp">The Mobile App</a> makes searching for jobs easy and convenient when you are on the go.</li> <li><a href="https://www.jobbank.gc.ca/jobsearch/">Job Search</a> allows you to browse through thousands of jobs across Canada at any time.</li> <li><a href="https://www.jobbank.gc.ca/findajob/match">Job Match</a> matches you to current job postings that suit your experience and skills. </li> <li><a href="https://www.jobbank.gc.ca/jobsearch/jobalertregistration">Job Alerts</a> allows you to get notified by email when new jobs are advertised.</li> <li><a href="https://www.jobbank.gc.ca/findajob/resume-builder">The Resume Builder</a> can help you create a professional resume.</li> </ul> <h2 class="portal">Explore the hidden job market</h2> <p>Another way of finding a job is through the hidden job market. Posting newspaper advertisements and creating online job postings can be costly and take time. In many cases, job vacancies are filled informally. Information about available job openings is often circulated among managers, employees, business associates, family, friends and acquaintances.</p> <h2 id = "Network">Build your network</h2> <p>An effective way to search for jobs in the hidden job market is through networking. Networking can be done in person and online. You can join a professional association, create a LinkedIn profile, participate in seminars or workshops, etc. <p>For more information about the hidden job market and building your network, we invite you to read these articles:</p> <ul> <li><a href="https://www.helpguide.org/articles/relationships-communication/job-networking-tips.htm">Job networking tips</a> (English only)</li> <li><a href="http://www.jobillico.com/blog/le-reseautage-un-element-strategique-dans-votre-recherche-demploi/">Trucs de réseautage d'emploi</a> (French only)</li> </ul></p> <p><b>Note:</B> To work in Canada, you need a <a href="https://www.canada.ca/en/employment-social-development/services/sin.html">Social Insurance Number</a> (SIN).</p> </div> <div class="clearfix"></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-05-30</time></dd> </dl> </div> </main> <aside class="prov-prog container"> <div class="wb-eqht row"> <section class="col-md-12 mrgn-bttm-md"><a href="https://forces.ca/en/paid-education/?utm_campaign=caf_job_posts&utm_medium=digital&utm_source=jobbank" onclick="_gaq.push(['_trackEvent', 'ptBannerClick', 'JOBSEARCH', 'ca']); adobeDataLayer.push({'event':'customTracking','link': {'customCall':'ESDC:EDSC:JobBank Banner Click'}}); return true;" rel="external" class="provBanner"> <img class="img-responsive thumbnail mrgn-bttm-sm" alt="“Your Education. Paid” Click on the banner for more details." src="/fstream?provinceCode=ca&lang=en&key=ptbanner.seeker.1&previewInd=false" /><span>Opens in a new window</span></a> </section> </div> </aside> <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> //<![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 = '/content.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"> //<![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 src="/invitation-manager/Overlay.js"></script> <script src="/invitation-manager/InvitationManager.js"></script> <script type="text/javascript">_satellite.pageBottom();</script></body> </html>