Jump to content

pstein

Members
  • Posts

    130
  • Joined

  • Last visited

Recent Profile Visitors

4,612 profile views

pstein's Achievements

Member

Member (2/7)

1

Reputation

  1. Your solution is NOT working. Lets see a simplified example: https://www.makeuseof.com/how-to-take-screenshots-on-android-when-the-app-doesnt-allow-it/ I want to get rid of an advertising block on the right (see attached snapshot). which starts with: <div id="K84X2hsVZN" data-ub-carousel="true" Therefor I setup a Greasemonkey script like // ==UserScript== // @name ChangeLayoutMakeuseof // @namespace nsChangeLayoutMakeuseof // @description Change Layout makeuseof.com // @match https://*.makeuseof.com/* // @exclude-match https://*.makeuseof.com/ // @exclude-match https://*.makeuseof.com/category/* // @version 2.14.1 // @grant GM_addStyle // @require http://code.jquery.com/jquery-latest.js // ==/UserScript== $('div').attr('data-ub-carousel').remove(); setTimeout(function(){ $('div').attr('data-ub-carousel').remove(); }, 5000); After adding the user script and reloading the webpage, the ad persist. Any other suggestion? https://s20.directupload.net/images/240314/gm2z76xs.png
  2. How can I select all SPAN elements in current webpage which contain a property "foobar"? The assigned value is unimportant. So elements like the following should be matched: <span aaa="bbb" foobar="23452345" .....>...</span> I tried: $('span[foobar^=""]').remove(); but it didn't work
  3. Assume I have a html code similar to <div class="foobar" ....> <p> <div> first stuff</div> <div class="sec"> second stuff </div> ..... </div> 1.) How can I delete the first <div> element INSIDE the <div> parent element with class="foobar"? 2.) How can I delete the first <div> brother element BEFORE the <div> element with class="sec"? If possible suggest a jQuery code. Otherwise JavaScript is acceptable too. Thank you Peter
  4. pstein

    ignore

    ignore
  5. Lets start with a simplified code snippet: <div class="....blahblah....."> !event! :: before <img src="https://www.foobar.com/special/......."> !event! </div> The placeholder above is getting dynamically filled from server the first time a few seconds after web page loading. It contains some unwanted stuff. I can remove this element by a jQUERY/javascript code in local *.user.js script like window.setTimeout( function () { $('img[src^="https://www.foobar.com/special/"]').parent().remove(); } ,8000); It works......for the first time. Unfortunately the servers continues to work and pushes some new images every 10 seconds to the same place. I guess its because the placeholder is not a simple html element but an event shortcut. So server does not detect his good old previous element? Don't worry. He creates brutally a new one and pushes next image into it. I hate it. So I would like to ask if there is a way to really remove this element and all future newly created successors. I prefer not to do this with a loop and my command from above. It should be a one-time command. CSS statement is acceptable as well. Be aware: Other events should stay alive. So prohibiting all events is not a solution. Thank you
  6. Assume I want to delete a substring which starts with "#blah" until the end of string. #blah itself should be deleted too. How can I achieve this? e.g. var address = document.URL.replace("#blah",""); deletes only the keyword but not the following, remaining part. If "#blah" is not found in string then nothing should happen.
  7. Normally users can assign a CSS stament like page-break-inside: auto !important; or break-inside: auto !important; to a <table> of <img> element to allow (pdf) page breaks when printing out. As I found out this doesn't work for <iframe> elements. Is there a similar css attribute for them?
  8. A web page contains the following code for an (unexpanded) drop down textbox: <dt class="border-top padding-vertical-s" accordionloaded="true"> <--- this is an Event <span class="accordion__indicator"></span> some text</dt> When I click on the arrow down the text box opens and reveals some more text. The code changes to <dt class="border-top padding-vertical-s open" accordionloaded="true"> <span class="accordion__indicator"></span> some text</dt> Mind the added "open" class! Now I want to open this drop down text box AUTOMATICALLY at loading time. How can I simulate a manual click on it?
  9. As you know more and more website introduce a page referrer to know from which other page the visitor came from. Therefore the first page append something like "?utm_source=sfmc&utm_medium=email&utm_campaign=OEM......" to the target URL: e.g. http://www.foobar.com/some/path/myproduct/desc.html?utm_source=sfmc&utm_medium=email&utm_campaign=OEM Assume I derive from within a javascript the current url similar to var address = document.URL; How can I strip off everything after the .html beginning with "?" (mostly ?utm_source.....) .
  10. Sample HTML code: <div class="foobar" ...> <div class="subelem" .....> <figure>. first figure....</figure> </div> </div> <figure>. second figure....</figure> Now I want to remove all <figure> elements which are NOT (!) inside an element with a class=foobar If I code this with jQuery: $("figure").remove(); then ALL <figure> elements are removed. How can I restrict the removal to only <figure> elements OUTSIDE of element with a class=foobar? In the sample code above only the second figure should be removed Be aware the element with class=foobar need not to be the direct parent element of <figure>
  11. At first have a look at a sample webpage (from a german news magazine): https://www.spiegel.de/panorama/yellowstone-nationalpark-serie-von-bison-attacken-in-den-usa-a-7530e432-ba46-4e0d-a89e-2b2c07ccbbdd As you can see there is a date and time just below the headline. And the "time" element has a class "timeformat" Now when I execute the following javascript code from a *.user.js script var pane = document.getElementsByClassName("timeformat")[0]; alert (pane); Then the alert shows "undefined". As a result I cannot assign something else like in pane.innerHTML = "foobar"; Why does Firefox (on Windows) not find the <time> element with the class "timeformat"?
  12. Occasionally I visit some webpages which implement lazy loading. That means embedded images are only loaded when I scroll down the page How can I disable the lazy loading (from user script) and enforce all image loading immediately after load start of webpage? Is this possble with Javascript or CSS?
  13. Assume I want to print a (long) web page into a pdf file. The web page contains <table> elements and <iframe> elements. When a <table> or a <iframe> element does not fit on the remaining part of the current pdf page then the WHOLE element is shifted resp. moved to the next pdf page. How can I avoid this? If <table> or the <iframe> element does not fit on the remaining part of the current pdf page then it should be cut somewhere in the mid and the remaining lower part printed into the next pdf page. How can I achieve this (with a CSS attribute)?
  14. @dsonesuk. I am confused: Does QuerySelector() really produce a list of elements? According to: https://developer.mozilla.org/de/docs/Web/API/Document/querySelector it returns only ONE element. Are you mix it with QuerySelectorAll()?
×
×
  • Create New...