WHich code i can use to show for example Adsense Ad only on pages that do not contains bad phrasses?

ie: i have Adsense and i dont want to show ads on pages where in page content is "porn", "cigar"

There is Javascript based code:

<div id="notBarEnds">
Here Add code to be shown if page is free from bad words

if (/porn|sex|erot|cigar|drug/.test(window.location.href)) {
document.getElementById('notBarEnds').style.displa y = 'none';
Similar topic, if criteria is URL, not page CONTENT: Show code/advertisement/text only if page URL do not contain some phrasses