Jump to content

pstein

Members
  • Posts

    130
  • Joined

  • Last visited

Everything posted by pstein

  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()?
  15. @dsonesuk very interesting. thank you. But not working. Let me extend my initial simplified example to a real world example. Go to sample web page: https://superuser.com/questions/694469/difference-between-netbios-and-smb As you can see just below the headline appears a time information: "Asked 8 years, 1 month ago". I want to replace it by the real date+time which is written into another element property: <time itemprop="dateCreated" datetime="2013-12-29T12:33:25">8 years, 1 month ago</time> There is only one "dateCreated" element in whole document. So I need no loop. I code in an additional loaded *.user.js script: ItemElem = document.querySelector("[itemprop='dateCreated']"); ItemElem.innerHTML = ItemElem.getAttribute('datetime'); Unfortunately it does not work. Why?
  16. Assume the html code of a web page contains the following element <elemname itemprop="aaaaa" otherprop="11223344">blahbla</elemname> Now I want to write the value of the property "otherprop" into its inner content (and overwrite existing) just as if the code would be: <elemname itemprop="aaaaa" otherprop="11223344">11223344</elemname> How can I achieve this? jQuery solution is welcomed as well.
  17. As you know there are many webpages with elements which can be clicked. One of these pages are the ones from ebay. Pretty much at the bottom of each auction there is a kind of drop down labelled (in german) "Vollständige information" which mean full contact details. When the users click on it the phone number and the email address of the sellers is revealed. Have a look at the attached snapshot (I changed the phone num and email for privacy): I would like to apply now a javascript/jQuery command script which performs this click AUTOMATICALLY when the webpage is loaded completely. How can I achieve this? As you can see from the Firefox webdeveloper pane snapshot an event is defined for the link. But what next? What I need is something like this (in jQuery notation): $("a:contains("Vollständige Informationen").click(); But the above command does not work. Any other suggestion?
  18. Assume I have the following CSS rule in a *.css file: .foobar { aaa: 10px; /* blah blah blah comment */ bbb: 15px !important; ccc: something !important; } It works. Now I decide (e.g.for testing purposes) to disable the whole .foobar rule without deleting it: /* .foobar { aaa: 10px; /* blah blah blah comment */ bbb: 15px !important; ccc: something !important; } */ Unfortunately the inner comment end tag */ closes the outer comment block as well. How can I avoid this without deleting the inner comment block? Maybe there is second comment tag like "//" in Java which declares the remainder of the line right of it as comment
  19. Assume I have (simplified) a code like: <div class="foobar" style="width: 632px; margin-right:0px "> Now I want to get resp retrieve with javascript/jQuery the width of this element; Keep in mind that the width value shown above could vary depending on occurency. I miss a jQuery function like $(".foobar").getwidth(); resp. (more advanced to use in a comprehensive command). $(".foobar").width($(".foobar").getwidth() + 120px); How can I achieve this?
  20. When users print a webpage occasionally some additionally CSS instructions are retrieved from some CSS files in a "@media print" or @page sections. How can tell a web page to ignore everything in such sections when I print it? Only web page stuff from screen should be relevant. Is there something like a @media print { none !important; } clause?
  21. Assume I have the following simplified code: <div> "1" <div> "2" <p> <div> "3" <span> <img class="sample">...</img> </span> </div> </p> </div> </div> Now I want to refer to innermost parent <div> element which contains a child element with class "sample". Here it is an <img> element in other cases it could be a <figure> or whatever. As target <div> element I would like to get the <div> labelled here with "3". How can I achieve this? If possible as jQuery statement. Thank you
  22. Assume I have the following simplified code <div> <img class="dummy">....</img> </div> Ok, I can now assign a new width (overwrite) to the <img> element by entering img.dummy { width: 50% !important; } But what if I want to assign the width to its parent element (here the <div>)? How can I assign an attribute+value to this unknown element (without ID or class)? Keep in mind I have no access to the original webpage+CSS source but want to assign it later from script.
  23. Lets start with an example: https://www.thewindowsclub.com/best-free-internet-speed-test-apps-for-windows As you can see (in Firefox or Chrome browser on Windows) there are NO horizontal lines visible on webpage (article). Now I print this webpage into a PDF file with some available pdf printers (like wide spread PDFcreator tool). Surprisingly the PDF file output contains lots of such horizontal (and vertical too) lines inside the article. Mostly after paragraphs. Why? I guess there are additional, hidden CSS statements in "@media print" section. Can this be? Where can I find the responsible CSS statement for inserting these lines?
  24. Lets start with an example web page: https://www.heise.de/ratgeber/FAQ-zu-2G-und-3G-Coronaregeln-So-werden-Zertifikate-richtig-geprueft-6265435.html?view=print When you scroll down a bit on this page you can see left of many paragraphs some question and exclamations marks "?" and "!" When I right-click on one of them (in Firefox) and select "Inspect" from context menu I can see the (HTML/CSS) code. Unfortunately no src() attribute is visible the "?" and "!" pictures seem to be hidden somewhere behind ::before and/or ::after statements ? How can I find out the real corresponding location and reference? How can I shrink the image sizes (height+width) by lets say 40%? Peter
×
×
  • Create New...