/    Sign up×
Community /Pin to ProfileBookmark

Disable scripts based on condition

Good evening, could you help me, please? From [this page](https://filetransfer.io/data-package/6h8QJ1wv#link) I run [this script](https://pastebin.com/hhHWqEnc), which extracts, in the “Nome” field, the publisher from the bibliographic item (_Feltrinelli_, in the example). I would like the script to be executed only once, ie it has to be disabled when on the [previous page](https://filetransfer.io/data-package/9kLqwjPc#link) there is the expression “Editore moderno” under the heading “Persone, istituzioni e famiglie”. In this case, in fact, I would have to extract (manually) in the “Nome” field, the author from the bibliographic item. I tried replacing the last line of the script with this:

“`
var elencoLabel = document.querySelector(“span.grid-6.label”);
if (!elencoLabel.includes(“Editore moderno”))
{
impostaNome(getNome(document.querySelector(‘div.meta.tito div.evidence.isbd’).innerText));
}
“`

but with this change the publisher is not extracted the first time either.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @parvares spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...