damianmgarcia / Hide-n-Seek

Hide promoted jobs and companies on LinkedIn, Indeed, and Glassdoor.
https://damianmgarcia.com
31 stars 3 forks source link

Update element selector for LinkedIn #37

Closed wchen342 closed 4 days ago

wchen342 commented 4 days ago

LinkedIn recently changed part of their job post layout. This commit adds the new element classes LinkedIn is using.

wchen342 commented 4 days ago

Sure! Here is a code snippet for a single item in the left panel of job listing:

<li id="ember173" class="ember-view   jobs-search-results__list-item occludable-update p0 relative scaffold-layout__list-item">
  <div class="job-card-job-posting-card-wrapper

         job-card-job-posting-card-wrapper--active-v2" data-job-id="4011738284" data-view-name="job-card">
    <a class="app-aware-link  job-card-job-posting-card-wrapper__card-link" href="https://www.linkedin.com/jobs/search?keywords=Software%20Engineer&amp;distance=25&amp;geoId=101174742&amp;start=0&amp;origin=JOBS_HOME_KEYWORD_HISTORY&amp;currentJobId=4011738284&amp;refId=GSQdC32e0EeitRoo8b9w9Q%3D%3D&amp;eBP=NOT_ELIGIBLE_FOR_CHARGING" data-test-app-aware-link="">
      <div class="job-card-job-posting-card-wrapper__entity-lockup
            ">
        <div id="ember174" class="artdeco-entity-lockup artdeco-entity-lockup--size-4 ember-view">
          <div id="ember175" class="artdeco-entity-lockup__image artdeco-entity-lockup__image--type-square ember-view" type="square">
            <div class="pr3">
              <div class="ivm-image-view-model   ">
                <div class="ivm-view-attr__img-wrapper

        ">
                  <!---->
                  <!---->
                  <img width="56" src="https://media.licdn.com/dms/image/v2/C4D0BAQHF65cU34mbxw/company-logo_100_100/company-logo_100_100/0/1648482786064/instacart_logo?e=1734566400&amp;v=beta&amp;t=i8C0fxGDJ5lUGH9z40mG6nX3JIFU7XY_o4lZITmTXb8" loading="lazy" height="56" alt="Instacart logo" id="ember176" class="ivm-view-attr__img--centered EntityPhoto-square-4   evi-image lazy-image ember-view">
                </div>
              </div>
            </div>
          </div>
          <div class="job-card-job-posting-card-wrapper__content
                ">
            <div class="flex-grow-1">
              <div id="ember177" class="artdeco-entity-lockup__title ember-view">
                <span class="job-card-job-posting-card-wrapper__title
                      ">
                  <span aria-hidden="true">
                    <strong>
                      <!---->Software Engineer II
                      <!---->
                    </strong>
                    <span class="white-space-pre"></span>
                    <!---->
                    <!---->
                    <span class="tvm__text tvm__text--low-emphasis">
                      <svg role="none" aria-hidden="true" class="v-align-middle" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" data-supported-dps="16x16" data-test-icon="verified-small">
                        <!---->
                        <use href="#verified-small" width="16" height="16"></use>
                      </svg>
                    </span>
                  </span>
                  <span class="visually-hidden">
                    <!---->Software Engineer II with verification
                    <!---->
                  </span>
                </span>
              </div>
              <div id="ember178" class="artdeco-entity-lockup__subtitle ember-view">
                <div>
                  <!---->Instacart
                  <!---->
                </div>
              </div>
              <div id="ember179" class="artdeco-entity-lockup__caption ember-view">
                <div>
                  <!---->Toronto, ON (Remote)
                  <!---->
                </div>
              </div>
              <div id="ember180" class="artdeco-entity-lockup__metadata ember-view">
                <!---->
                <div class="job-card-job-posting-card-wrapper__job-insights">
                  <div class="ivm-image-view-model   ">
                    <div class="ivm-view-attr__img-wrapper

        ">
                      <!---->
                      <li-icon type="premium-app" class="ivm-view-attr__icon  " size="large" role="img" aria-label="You’d be a top applicant">
                        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" data-supported-dps="24x24" class="mercado-match" width="24" height="24" focusable="false">
                          <path d="M20 20a3.36 3.36 0 001-2.39V6.38A3.38 3.38 0 0017.62 3H6.38A3.36 3.36 0 004 4z" fill="#f8c77e"></path>
                          <path d="M4 4a3.36 3.36 0 00-1 2.38v11.24A3.38 3.38 0 006.38 21h11.24A3.36 3.36 0 0020 20z" fill="#e7a33e"></path>
                        </svg>
                      </li-icon>
                    </div>
                  </div>
                  <div class="job-card-job-posting-card-wrapper__job-insight-text">
                    <!---->You’d be a top applicant
                    <!---->
                  </div>
                </div>
              </div>
            </div>
            <div id="ember181" class="artdeco-entity-lockup__metadata ember-view">
              <ul class="job-card-job-posting-card-wrapper__footer-items">
                <li class="job-card-job-posting-card-wrapper__footer-item"> Viewed </li>
                <!---->
                <li class="job-card-job-posting-card-wrapper__footer-item">
                  <time datetime="2024-08-28"> 2 weeks ago </time>
                </li>
              </ul>
            </div>
          </div>
        </div>
      </div>
    </a>
    <!---->
    <div class="job-card-job-posting-card-wrapper__actions
          pr1">
      <div>
        <button aria-label="Dismiss Software Engineer II job" id="ember182" class="job-card-container__action job-card-container__action-small artdeco-button artdeco-button--muted artdeco-button--2 artdeco-button--tertiary ember-view" type="button">
          <!---->
          <span class="artdeco-button__text">
            <svg role="none" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" data-supported-dps="16x16" data-test-icon="close-small">
              <!---->
              <use href="#close-small" width="16" height="16"></use>
            </svg>
            <span class="job-card-container__action-text"></span>
          </span>
        </button>
      </div>
    </div>
  </div>
</li>

Basically, the out most container is the one with .job-card-job-posting-card-wrapper. .job-card-job-posting-card-wrapper__title is the element job title is in, but company name is not wrapped in a <span>, instead there is only a <div> with the artdeco-entity-lockup__subtitle class.

I think it is easier to grab the parent, so I went for the job-card-job-posting-card-wrapper when getting job elements.

damianmgarcia commented 4 days ago

Perfect!

After I merge your PR, I'll update the release notes and manifest version number, then submit to Chrome Web Store, etc.

Thanks so much for providing this fix!