CINXE.COM

Career planning - Choose a career - Job Bank

<!DOCTYPE html> <html class="no-js" lang="en" dir="ltr"><head id="j_id_5"> <meta charset="utf-8" /> <title>Career planning - Choose a career - 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="Career planning - Choose a career - Job Bank" /> <meta property="og:title" content="Career planning - Choose a career - Job Bank" /> <meta name="description" property="og:description" content="Default page description" /> <meta property="og:url" content="http://www.jobbank.gc.ca/landing-plan-career.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=8DBE8298B78579B7BEB81E943BEA0945.jobsearch76?ln=primefaces&amp;v=12.0.0" /><script type="text/javascript" src="/jakarta.faces.resource/jsf.js.xhtml;jsessionid=8DBE8298B78579B7BEB81E943BEA0945.jobsearch76?ln=jakarta.faces"></script><script type="text/javascript">if(window.PrimeFaces){PrimeFaces.settings.locale='en_CA';PrimeFaces.settings.viewId='/landing-plan-career.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" /> <style> .subway-group .subway-bar { position: absolute; right: 22px; width: 5px; height: 290px; background-color: #d38a20; } .subway-group .subway-item::before { position: absolute; right: 15px; top: -5%; display: block; content: ''; width: 25px; height: 25px; border-radius: 25px; border: solid 2px #d38a20; background-color: #ffc571; transform: translateX(-50%) translateY(50%); } .subway-group .subway-item:hover::before { border: solid 2px #fff; background-color: #fff; } .subway-group .subway-item { background-color: #fff; cursor: pointer; padding: 8px 45px 8px 15px; margin: 0 0 20px 0; border-radius: 10px; display: block; background: #fff; border: 3px solid #d38a20; -webkit-box-shadow: 0 2px 4px 0 rgba(0,0,0,0.20); -moz-box-shadow: 0 2px 4px 0 rgba(0,0,0,0.20); box-shadow: 0 2px 4px 0 rgba(0,0,0,0.20); transition: border-color 200ms ease-in, background-color 250ms ease-in; } .subway-group .subway-item:hover { color: #fff; background-color: #284162; border: 3px solid #284162; } .subway-group .subway-item.last::before { display: none; } .subway-group .subway-item a, .subway-group .subway-item a:visited { display: inline-block; vertical-align: middle; font-family: 'Roboto', sans-serif; font-weight: 400; font-size: 16px; line-height: 25px; text-decoration: none; color: #284162; letter-spacing: -0.02em; } .subway-group .subway-item:hover a { color: #fff; } .service-content-image { margin: 0; } .demo-content-details.mrgn-tp-lg { margin-top: 50px !important; } @media (min-width: 768px) { .subway-group .subway-bar { /* right: 3%; */ } .subway-group .subway-item a { font-size: 18px; } } @media (min-width: 992px) { .subway-group .subway-bar { left: 0; right: auto; bottom: 18px; width: 70%; height: 5px; } .subway-group .subway-item::before { right: 12px; bottom: 22px; top: auto; } .subway-group .subway-item { padding: 8px 15px; height: 160px; line-height: 133px; margin: 0; border-top-left-radius: 0; border-bottom-right-radius: 0; border-top-right-radius: 25px; border-bottom-left-radius: 25px; } } </style><!--[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 &quot;About this Web application&quot;</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/planification-carriere" 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="/planification-carriere;jsessionid=8DBE8298B78579B7BEB81E943BEA0945.jobsearch76" 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="/planification-carriere;jsessionid=8DBE8298B78579B7BEB81E943BEA0945.jobsearch76" 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="emp-login prm-flpr theme-light theme-careerplanning-light"> <div class="container"> <section class="hero-content-wrapper"> <div class="hero-content-wrapper-inner"> <div class="hero-alert-wrapper"> <div id="messageblock-content" tabindex="-1"><div id="messageblock" role="region" aria-live="polite"></div> </div> </div> <div class="inner cover"> <div class="selectpicker-wrapper col-md-12"> <div class="selectpicker-group col-md-10"> <h1 property="name" id="wb-cont" class="task-title"> <span class="directory">Career planning</span> Choose a career </h1> </div> <div class="clearfix"></div> <div class="row subway-group"> <div class="subway-bar"></div> <div class="col-md-2"><div class="subway-item"><a href="#section-1">Get to know yourself</a></div></div> <div class="col-md-2"><div class="subway-item"><a href="#section-2">Explore the job market</a></div></div> <div class="col-md-2"><div class="subway-item"><a href="#section-3">Plan your education or training</a></div></div> <div class="col-md-2"><div class="subway-item"><a href="#section-4">Stand out to employers</a></div></div> <div class="col-md-2"><div class="subway-item"><a href="#section-5">Network and stay connected</a></div></div> <div class="clearfix"></div> </div> <div class="clearfix"></div> </div> </div> </div> </section> </div> </div> <div class="clearfix"></div> <main role="main" property="mainContentOfPage"> <div id="section-1" class="grey bg demo-content-wrapper"> <div class="container"> <section class="header-section col-md-12 demo-content"> <div class="demo-content-details-center mrgn-tp-lg row"> <div class="col-md-6"> <h2><a name="s1">Get to know yourself</a></h2> <p><p>Introspection should be the starting point in your career planning journey. Being aware of your own strengths and weaknesses is key to defining your career goals. Completing a self-assessment can help you identify what you can already bring to the table, and what you need to work on to get a specific job or enter a particular field or industry. <a href="https://www.jobbank.gc.ca/career-planning/resources/know-yourself">Learn more</a>.</p></p> </div> <div class="col-md-6 service-content-details service-content-image"> <img src="themes-jb/images/career/career-planning-s1.jpg" class="photo full-width" alt="" /> </div> </div> <div class="demo-content-details mrgn-tp-lg row"> <h3>Take a career quiz</h3> <p class="lead">Six quizzes and tests are available on Job Bank to help you discover your professional interests, abilities and preferences. The results will help you find occupations that would be a good fit for you.</p> <div class="row col-md-4 call-to-action sub"><a href="https://www.jobbank.gc.ca/career-planning/quizzes" class="btn btn-default btn-lg">Take a quiz</a></div> </div> <div class="demo-content-details mrgn-tp-lg row"> <h3>Match your skills and knowledge</h3> <p class="lead">Explore jobs or career options that match your skills and knowledge. Check off all the skills and knowledge you have or are interested in, and find out what occupations could be a good fit for you based on your selections.</p> <div class="row col-md-4 call-to-action sub"><a href="https://www.jobbank.gc.ca/career-planning/skills-knowledge" class="btn btn-default btn-lg">Try the checklist</a></div> </div> <div class="demo-content-details mrgn-tp-lg row"> <h3>Discover the Skills for Success </h3> <p class="lead">Discover the key skills you need for work and daily life. Find out why each skill is important and situations in which they are useful. Find tools to assess and improve your work and life skills.</p> <div class="row col-md-5 call-to-action sub"><a href="https://www.canada.ca/en/services/jobs/training/initiatives/skills-success.html" class="btn btn-default btn-lg">Learn about the skills</a></div> </div> </section> </div> </div> <div id="section-2" class="demo-content-wrapper"> <div class="container"> <section class="header-section col-md-12 demo-content"> <div class="demo-content-details-center mrgn-tp-lg row"> <div class="col-md-6"> <h2><a name="s2">Explore the job market</a></h2> <p><p>Staying informed about what&rsquo;s happening in the labour market can help you align your career goals with key trends and potential outcomes. You can compare the requirements, wages and job prospects for different occupations and industries across Canada to make informed career decisions. <a href="https://www.jobbank.gc.ca/career-planning/resources/explore-job-market">Learn more.</a></p></p> </div> <div class="col-md-6 service-content-details service-content-image"> <img src="themes-jb/images/career/career-planning-s2.jpg" class="photo full-width" alt="" /> </div> </div> <div class="demo-content-details mrgn-tp-lg row"> <h3>Learn about an occupation </h3> <p class="lead">Research an occupation to find out what the job is all about. You can see what you would do, how much you could make, what skills and education you need, and whether there will be jobs in this field over the next few years.</p> <div class="row col-md-6 call-to-action sub"><a href="https://www.jobbank.gc.ca/career-planning/search-job-profile" class="btn btn-default btn-lg">Browse job profiles</a></div> </div> <div class="demo-content-details mrgn-tp-lg row"> <h3>Research labour market information</h3> <p class="lead">Get an overview of current conditions in different industries and different parts of the country. Browse through news articles about job creation, layoffs and other developments in your industry or region.</p> <div class="row col-md-6 call-to-action sub"><a href="https://www.jobbank.gc.ca/trend-analysis" class="btn btn-default btn-lg">View labour market information</a></div> </div> <div class="demo-content-details mrgn-tp-lg row"> <h3>Find jobs you could transition to</h3> <p class="lead">Are you considering a career change? Search for occupations you could transition to that require some gap training. Find jobs with similar education and skill requirements to the ones you already have and see how long it would take to make a career transition.</p> <div class="row col-md-6 call-to-action sub"><a href="https://www.jobbank.gc.ca/career-planning/job-transition" class="btn btn-default btn-lg">Try the Job Transition Tool</a></div> </div> </section> </div> </div> <div id="section-3" class="grey bg demo-content-wrapper"> <div class="container"> <section class="header-section col-md-12 demo-content"> <div class="demo-content-details-center mrgn-tp-lg row"> <div class="col-md-6"> <h2><a name="s3">Plan your education or training</a></h2> <p><p>Once you know what skills and knowledge are required for the job you want, it&rsquo;s time to come up with a plan to get qualified. Before you decide to invest time and money into an education program or training course, compare your options to find out which one is right for you. <a href="https://www.jobbank.gc.ca/career-planning/resources/plan-education-training">Learn more.</a></p></p> </div> <div class="col-md-6 service-content-details service-content-image"> <img src="themes-jb/images/career/career-planning-s3.jpg" class="photo full-width" alt="" /> </div> </div> <div class="demo-content-details mrgn-tp-lg row"> <h3>Pick a field of study</h3> <p class="lead">Learn about different education programs and how graduates are doing after school. Are they employed in their field of study? What are their earnings? Would they study in this field again?</p> <div class="row col-md-4 call-to-action sub"><a href="/career-planning/school-work-transition;jsessionid=8DBE8298B78579B7BEB81E943BEA0945.jobsearch76" class="btn btn-default btn-lg">Search an education program</a></div> </div> <div class="demo-content-details mrgn-tp-lg row"> <h3>Get skills training</h3> <p class="lead">Whether you’re looking for a new job or a career change, or if you just want to grow in your current role, training can help you get there. Find out what kind of training is right for you, where to get training, and how to pay for it. </p> <div class="row col-md-6 call-to-action sub"><a href="https://www.jobbank.gc.ca/career-planning/resources/skills-training" class="btn btn-default btn-lg">Learn about skills training</a></div> </div> </section> </div> </div> <div id="section-4" class="demo-content-wrapper"> <div class="container"> <section class="header-section col-md-12 demo-content"> <div class="demo-content-details-center mrgn-tp-lg row"> <div class="col-md-6"> <h2><a name="s4">Stand out to employers</a></h2> <p><p>When you&rsquo;re ready to look for a job, being aware of best practices can help you speed up the process and make the most of it. <a href="https://www.jobbank.gc.ca/career-planning/resources/stand-out">Learn more.</a></p></p> </div> <div class="col-md-6 service-content-details service-content-image"> <img src="themes-jb/images/career/career-planning-s4.jpg" class="photo full-width" alt="" /> </div> </div> <div class="demo-content-details mrgn-tp-lg row"> <h3>Search and apply for jobs </h3> <p class="lead">Discover the best ways to search for a job. Learn how to write a good resume and other steps you need to take before applying for a job. Check out interview tips that can help you make a lasting impression on employers. </p> <div class="row col-md-6 call-to-action sub"><a href="https://www.jobbank.gc.ca/findajob/resources " class="btn btn-default btn-lg">Find job search advice</a></div> </div> </section> </div> </div> <div id="section-5" class="grey bg demo-content-wrapper"> <div class="container"> <section class="header-section col-md-12 demo-content"> <div class="demo-content-details-center mrgn-tp-lg row"> <div class="col-md-6"> <h2><a name="s5">Network and stay connected</a></h2> <p><p>Few people hold a single job until they retire. To keep tabs on career development opportunities, you need to build and maintain a professional network and stay up to date on your industry&rsquo;s latest news. <a href="https://www.jobbank.gc.ca/career-planning/resources/network">Learn more.</a></p></p> </div> <div class="col-md-6 service-content-details service-content-image"> <img src="themes-jb/images/career/career-planning-s5.jpg" class="photo full-width" alt="" /> </div> </div> <div class="demo-content-details mrgn-tp-lg row"> <h3>Build your professional network </h3> <p class="lead">In Canada, many job vacancies are not advertised by employers. These positions are usually filled informally through word of mouth. This is what we call the hidden job market, and the best way to tap into it is through networking. Networking can also help you find mentors who would help you grow in your field. </p> <div class="row col-md-6 call-to-action sub"><a href="https://www.jobbank.gc.ca/findajob/resources/search-for-jobs#Network" class="btn btn-default btn-lg">Learn more about building your network </a></div> </div> <div class="demo-content-details mrgn-tp-lg row"> <h3>Stay connected to your industry</h3> <p class="lead">In today’s ever-changing labour market, it’s more important than ever to stay up to date on the latest developments in your industry. By seeking continuous learning opportunities, you can embrace the change and maintain your employability. </p> <div class="row col-md-6 call-to-action sub"><a href="https://www.jobbank.gc.ca/findajob/resources" class="btn btn-default btn-lg">Find job search advice</a></div> </div> </section> </div> </div> <a href="#header-search" class="btn-gototop"><span class="fas fa-arrow-alt-circle-up"></span> Top of page</a> <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="{&quot;lnkClass&quot;: &quot;btn btn-default btn-block&quot;}"></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> <div id="outOfCountry-modal"> <div id="instructions-title" class="wb-inv"> <a href="#outOfCountry-popup" aria-controls="outOfCountry-popup" class="wb-lbx dialog-help"></a> </div> <div id="outOfCountry-popup" class="mfp-hide modal-dialog modal-content overlay-def"> <header class="modal-header"> <h3 class="modal-title">Warning</h3> </header> <div class="modal-body"><p>It looks like you are visiting Job Bank from outside Canada.</p> <p>If you are not legally authorized to work in Canada, <strong>you can’t apply for every job on Job Bank</strong>. Most Canadian employers will not hire you if you do not have a valid visa or work permit.</p> <p>Visit <a href="https://www.jobbank.gc.ca/findajob/foreign-candidates">Job Bank’s page for foreign candidates</a> to review your options and find jobs from employers who are recruiting outside Canada.</p> </div> <div class="modal-footer"><form id="j_id_39" name="j_id_39" method="post" action="/planification-carriere;jsessionid=8DBE8298B78579B7BEB81E943BEA0945.jobsearch76" enctype="application/x-www-form-urlencoded"><a href="#" onclick="return myfaces.oam.submitForm('j_id_39','j_id_39:outOfCanadaCloseBtn');" id="j_id_39:outOfCanadaCloseBtn" type="button" title="Cancel" class="btn btn-default popup-modal-dismiss float-left">Close</a><button name="j_id_39:j_id_3c" type="submit" id="outOfCanadaLearnMoreBtn" class="btn btn-primary">Learn more</button><input type="hidden" name="j_id_39_SUBMIT" value="1" /><input type="hidden" name="jakarta.faces.ViewState" id="j_id__v_0:jakarta.faces.ViewState:3" value="stateless" autocomplete="off" /></form> </div> </div> </div> <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>&nbsp;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 = '/landing-plan-career.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[ 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[ 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[ taCipedugroupSuggestFunctionsV2 = 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"); 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 cipCodeObject = $(element).find("[name$='cip_code']"); var losCodeObject = $(element).find("[name$='los_code']"); var buttonObject = $(element).find("input:submit:first"); var filterQueryObject = $(element).find("[name$='filterquery']"); clearinput(); messageObject.text("Type to get suggestions"); function displaykey(item) { return item.cip_name; } function displayoption(value,item) { return value; } function clearinput() { cipCodeObject.val(""); losCodeObject.val(""); losCodeObject.find('option').remove(); buttonObject.attr('disabled', 'disabled'); selectedObjectText = ""; // clear LOS selection buttons disabledAll(); $('#editprofileForm\\:educationsearchResults').empty(); // trigger event change cipCodeObject.change(); } function populateinput(item) { $('#editprofileForm\\:educationsearchResults').html('<span class="working" style="width: 42px;display: block;height: 42px;"></span>'); cipCodeObject.val(item.cip_code); var lstMlos = ''; $.each(item.map_los, function() { lstMlos += this.los_code+","; }); lstMlos = lstMlos.slice(0,-1); losCodeObject.val(lstMlos); // submit form to produce list of los as submit button var form = inputObject.closest('form')[0]; //var form = $('#editprofileForm')[0]; jsf.ajax.request(form,event,{ execute:'editprofileForm:lcode', render:'editprofileForm:lossearch', 'jakarta.faces.behavior.event': 'action', onevent: function(){$("#editprofileForm\\:lossearch").hide();$("#editprofileForm\\:lossearch").hide();$("#editprofileForm\\:lossearch-disable").show();} } ); //$(".fossearch").attr('disabled', 'disabled'); /* losCodeObject.find('option').remove(); $.each(item.map_los, function() { losCodeObject.append($("<option />").val(this.los_code).text(this.los_name)); }); */ //buttonObject.removeAttr('disabled', 'disabled'); selectedObjectText = displaykey(item); // trigger event change cipCodeObject.change(); enabledSome(); } function disabledAll(){ $("#editprofileForm\\:lossearchresult input:radio").attr("disabled", true); $("#editprofileForm\\:lossearchresult input:radio").css("cursor", "not-allowed"); $("#editprofileForm\\:lossearchresult input:radio").prop('checked', false); $("#editprofileForm\\:lossearchresult label").css("cursor", "not-allowed"); $(".losspan").addClass("level_unavailable"); $("#editprofileForm\\:lossearch").hide(); $("#editprofileForm\\:lossearch-disable").show(); } function enabledSome(){ //alert($("#editprofileForm\\:los_code").val()); var losList = $("#editprofileForm\\:los_code").val().split(','); disabledAll(); for(var i = 0; i < losList.length; i++ ){ //alert(losList[i]); $("#radio-"+losList[i]).attr("disabled", false); $("#radio-"+losList[i]).css("cursor", "pointer"); $("#label-"+losList[i]).css("cursor", "pointer"); $("#span-"+losList[i]).removeClass("level_unavailable"); $("#span-"+losList[i]).addClass("level_available"); } } function resetInput() { inputObject.typeahead('val',''); } var bloodhound = new Bloodhound({ datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.cip_name); }, queryTokenizer: Bloodhound.tokenizers.whitespace, remote: { url:"/core/ta-cipeduprogram_"+inputlang+"/select?q=%QUERY&wt=json&rows=20&group=true&group.field=cip_code&group.limit=5&fl=cip_name,los_code,los_name", wildcard: "%QUERY", replace: function (url, query) { var q = inputObject.val(); q2 = url.replace("%QUERY",q); if ( typeof(filterQueryObject) != 'undefined' && filterQueryObject.length > 0 ) { q2 += "&fq=" + filterQueryObject.val(); } return q2; } , filter: function(response) { return $.map(response.grouped.cip_code.groups, function(doc){ return { cip_code:doc.groupValue, cip_name:doc.doclist.docs[0].cip_name, map_los:$.map(doc.doclist.docs, function(doc){ return { los_code:doc.los_code, los_name:doc.los_name } }) } }); } }, limit: 25 }); bloodhound.initialize(); inputObject.typeahead( { minLength: 2 }, { name: "ta-CipedugroupSuggest", displayKey: function(item) { return displaykey(item) }, limit: 30, 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 = data.cip_name.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) { if ( typeof(selectedObjectText) != 'undefined' && selectedObjectText.length > 0 ) { messageObject.text( "You have selected, ‘{0}’".format(selectedObjectText) ); } else { messageObject.text(""); } }); }; function initCipedugroupSuggestObject() { $('div.ta-cipedugroupsuggest').each( function(i,obj) { new taCipedugroupSuggestFunctionsV2(obj); }); } if ($(".modify-job-wb-tabs").length) { $(document).on("wb-ready.wb", initCipedugroupSuggestObject); } else { $(document).ready(initCipedugroupSuggestObject); } //]]> </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"> //<![CDATA[ /* function disabledAll(){ $("#editprofileForm\\:lossearchresult input:radio").attr("disabled", true); $("#editprofileForm\\:lossearchresult input:radio").css("cursor", "not-allowed"); $("#editprofileForm\\:lossearchresult input:radio").prop('checked', false); $("#editprofileForm\\:lossearchresult label").css("cursor", "not-allowed"); $(".losspan").addClass("level_unavailable"); $("#editprofileForm\\:fossearch").prop('disabled', true); } */ $(document).ready(function () { $('.btn-gototop').click( function(){ $('html, body').animate({ scrollTop: $('#header-search').offset().top - 0 }, 500); setTimeout(function() {$('#header-search').get(0).focus(); }, 1000); console.log('top'); //return false; }); /* auto scroll */ $(window).on("scroll", function() { var scrollPos = $(window).scrollTop(); if (scrollPos <= 300) { $('.btn-gototop').removeClass('visible'); } else { $('.btn-gototop').addClass('visible'); } }); window.onscroll = function() { fixedNav() }; $window = $(window); var navbar = $(".subway-group"); var distance = navbar.offset().top; function fixedNav() { $window.scroll(function() { if ( $window.scrollTop() >= distance ) { navbar.addClass("fixed") } else { navbar.removeClass("fixed"); } }); } function scrollToAnchor(section){ var aTag = $("a[name='"+ section +"']"); $('html,body').animate({scrollTop: aTag.offset().top - 50},'slow'); } $(".subway-group a").click(function(e) { e.preventDefault; var sID = $(this).attr("href").replace('#', ''); scrollToAnchor(sID); }); //Preload section based on URL parameter var lospanel = $('#editprofileForm\\:lossearchresult'); var selectExploreCareerByVal= GetURLParameter('select'); function GetURLParameter(sParam) { var sPageURL = window.location.search.substring(1); var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++) { var sParameterName = sURLVariables[i].split('='); if (sParameterName[0] == sParam) { return sParameterName[1]; } } } if (selectExploreCareerByVal) { $('#selectExploreCareerBy').val(selectExploreCareerByVal); //console.log('Select value: '+selectExploreCareerByVal); } // activate/deactive ec-occupation search button var ec_occupation_inputObject = $('#ec-occupation\\:occupationInput'); if ($('#ec-occupation\\:id').val() == '' ) { $('#ec-occupation #searchSubmit').attr('disabled', 'disabled'); }; ec_occupation_inputObject.on('select', function() { $('#ec-occupation #searchSubmit').removeAttr('disabled'); }); ec_occupation_inputObject.on('unselect', function() { $('#ec-occupation #searchSubmit').attr('disabled', 'disabled'); }); $('#editprofileForm\\:fos-name').on('change keyup', function(){ var fosname = $('#editprofileForm\\:fos-name').val(); if(fosname.length==0){ //disabledAll(); $("#editprofileForm\\:fossearch").attr('disabled', true); } }); // handle module selection $('#selectExploreCareerBy').on('change keyup', function(e) { var ecoccupation = $(this).val() == 'ec-occupation'; var eceduprog = $(this).val() == 'ec-eduprog'; if (ecoccupation) { $('.ec-panel').hide(); $('.ec-occupation').show(); $('.float-input').change(); } else if (eceduprog) { $('.ec-panel').hide(); $('.ec-eduprog').show(); } }); // get hash - does not run again if its called on the main Explore Career page var hash = $(location).attr("hash"); if (hash!='undefined' && hash.length>1) { hash = hash.substr(1,hash.length); $('#selectExploreCareerBy').val(hash); } $('#selectExploreCareerBy').change(); $('.losradio').on('click', function(e){ $("#editprofileForm\\:fossearch").prop('disabled', false); var val = $("input[type='radio']:checked").val(); var form = $("input[type='radio']:checked").closest('form'); $("#editprofileForm\\:lcode").val(val); jsf.ajax.request(form,event,{ execute:'editprofileForm:lcode', render:'editprofileForm:lossearch', 'jakarta.faces.behavior.event': 'action'}); }); $('.subway-group .subway-item').click( function() { $(this).find('a')[0].click(); }); }); //]]> </script> <script src="/invitation-manager/Overlay.js"></script> <script src="/invitation-manager/InvitationManager.js"></script> <script> //<![CDATA[ $(document).trigger( "open.wb-lbx", [ [ { src: "#outOfCountry-popup", type: "inline" } ], true ]); //]]> </script> <script type="text/javascript">_satellite.pageBottom();</script></body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10