Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

1 Neutral

About pstein

  • Rank

Recent Profile Visitors

3,090 profile views
  1. Assume I load a web page from an external server (which is not under my control) which contains a CSS with a !important statement for a lets say "file-size. attribute". Now I want to overwrite this CSS statement with my own value e.g. by using Greasemonkey AddOn in Firefox which adds new, additional CSS statements to the pool of existing CSS statements. This "normal" overwriting can be performed by appending an "!important" tag at the end. But what if the original CSS contains already an "!important" tag? How can I later/afterwards overwrite this with an even higher priority !important value? Peter
  2. When I print webpages (on paper or into pdf) then occasionally embedded pictures are split among two pages. How can I prevent this split? If an image does not fit on a (pdf/paper) page any more it should be shifted to the following (pdf/paper) page. Peter
  3. Assume I want to modify/overwrite the CSS of an existing webpage. Obviously I have no access to the original server. Instead I want to execute a Greasemonkey script with Javascript code after loading This CSS contains for various (unknown) elements and (unknown) classes the following CSS keys: .... { font-size: 18px; ..... } I want to replace all in these occurencies by the following: .... { font-size: 14px; ..... } resp. .... { font-size: 14px !important; ..... } How can I achieve this with Javascript? Again: I do not know all the class names resp IDs which contain the CSS key above. The class names could vary from time to time. So I need a kind of filter for the overwrite operation. Maybe I have to recursively navigate through the DOM tree. How does that work?
  4. How can I enforce a line wrap (resp <p>) after a <h3>...</h3> element? The following text/images should always be placed below the h3 headline. The line wrapping should be achieved by CSS rule/key. I have no access to the original html source
  5. When I look at <li> elements of an <ol>...</ol> then the space gaps between the <li> lines are more than the "usual" line-height defined in <body> or parent elements. No special, additional margin or padding values are assigned in CSS. So I guess there is a default built-in margin-bottom or margin-top or padding-bottom or padding-top value. What is it? How can I tell the browser rendering engine to ignore these default built-in values for <li> elements? Or how do I overwrite them by my own values? Peter
  6. Assume I have a CSS stylesheet link similar to http://www.foobar.com/aaa/bbb/ccc.css Now I want to show the content (=CSS rules) of this stylesheet in (Firefox) browser. Unfortunately the css file content is compressed resp. written in one long line. Is there a way to beautifiy the css content to a more human readable format with javascript code? Peter
  7. Assume I defined an element similar to <header class="aaa bbb"> <div class="ccc ddd">....</div> </header> When I (or the reader) print now the page from browser into a pdf document then this element should be printed at the top of each page. So this element should be automatically inserted. How can I achieve this? Peter
  8. Assume I have the following code <p> <div>.aaa...</div> <div class="foobar">.bbb..</div> <div>.ccc..</div> <p> then I can address the <div>element FOLLOWING the <div> element with class=foobar by div.foobar + div will address the <div> with ccc inside Ok, but how do I address the opposite: The predecessor=the <div> with aaa inside? div.foobar - div seems not to work Peter
  9. Lets start with an example web page (from german computer magazin): https://www.heise.de/newsticker/meldung/VMware-Workstation-14-braucht-juengere-Prozessoren-3847372.html?view=print When you look at the bottom of this webpage you find a list of link lines. I want to shrink the space gap between each of them. Therefore I applied (afterwards through Greasemonkey) the following CSS statement: pre, code { font-size: 10px !important; line-height: 9px !important; } Reduction of line-height works until 10px (even when the font-size itself is biggger !!!). Specifying a lower value for line-height than 10 does not work any more. Why? How else can I reduce the space gap between the link lines?
  10. In many other programming languages (e.g. Java) there is a function like: ((a < b ) ? "lower" : "greater")? which outputs "lower" if the value of variable a is lower than the value of variable b. Otherwise "greater" Is there a similar function in Javascript? Peter
  11. Assume I want to output something at the bottom of a webpage. The output text should not be assigned to a certain element or tag (if possible). I just want to write something like document.write("<p); Is this possible? If I have to assign it to <body>: What would be the minimum code to achieve this? Peter
  12. Lets start again with a sample web page: http://www.thewindowsclub.com/windows-resource-protection-found-corrupt-files Let the browser give a second to load the web page completely. Then scroll with the browsers vertical scrollbar to the bottom of the page. As you can observe the embedded code somehow detects that the user scrolled to the end and loads+appends additional stuff from webserver. In this case its all the comments from users to the article above. How can I prevent this delayed auto-loading? When the user scrolls to the bottom nothing else should be loaded. Second, related question: How can I tell the web page already at first load time to load all possible stuff at the bottom even if the user did not scroll? Thank you Peter
  13. Lets start with a sample web page: http://www.thewindowsclub.com/windows-resource-protection-found-corrupt-files As you can see the article text contains various blue, clickable Links. When I print the whole page (with Firefox print menu) then all these embedded links got automatically a postfix URL. That means immediately after the link on the printed page appears the underlying URL as text writh round brackets (http://www.thewin............) I want to avoid this for all links. The link tag written in blue should persist but no URLs should be added. How can I do this? I want to add your suggested javascript code to a greasemonkey script and let it do the filtering job at print time. If possible the blue links on the web page(s) should be clickable in the future. If necessary the clickability can be removed Peter
  14. How do I output the current timestamp with a format DD.MM.YYYY HH:MM:SS The web page https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date does not show it (an example). Thank you Peter
  15. Assume I go onto one of the article webpages of this (german) computer magazine e.g. https://www.finanzen100.de/finanznachrichten/wirtschaft/apples-cash-cow-erreicht-apples-iphone-bald-seinen-zenit_H2080354162_435351/?SOURCE=7001002 When I click now on the browsers (e.g.Firefox) "print" menu then not all the stuff is printed but only the "core" article with some print specific CSS definitions. I searched now for a while for the corresponding @media print CSS definitions for the print layout but did not found them. Where are they ? Maybe someone could find them more easily. Thank you Peter