Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Rubies
Dec 30, 2005

Live Forever
Die Every Day

:h: :s: :d: :c:

Gmaz posted:

You might want to check out: https://www.toptal.com/companies/apply

Although I have no idea what the prerequisites for clients are, I only know people who freelance through it.

Cool thanks, that seems a little more straightforward than freelancer or guru.

e: Looks like you have to apply (as a hiring business) to even contact the developers on that site. There's a lot of money floating around this project but not like SV $$$ startup millions - hope we make the cut :P

Rubies fucked around with this message at 19:30 on Jan 17, 2015

Adbot
ADBOT LOVES YOU

Ahz
Jun 17, 2001
PUT MY CART BACK? I'M BETTER THAN THAT AND YOU! WHERE IS MY BUTLER?!
I need to find a good method for printing my "reports" page. I only want certain DIV elements (incl chart contents etc.) to print and not the site header, filtering menus etc.

What's a pretty good unobtrusive way to do this?

Current libs in use are JQuery and D3.js for charts so I need it to work with the javascript generated charts/diagrams.

Thanks!

EDIT: Bonus if I can also wrap up this printout into a PDF for user downloading as well.

Diabolik900
Mar 28, 2007

Just add a print stylesheet and set display: none for everything you don't want to print.

If you need to bring up the print dialog through javascript, you just do window.print();.

Ahz
Jun 17, 2001
PUT MY CART BACK? I'M BETTER THAN THAT AND YOU! WHERE IS MY BUTLER?!
So I have to programmatically set display none to everything on my page? Then set it back after printing?
Whats a print stylesheet? Is that the simplest method to limit printing?

For example, Id much rather mark my 5 or 10 divs dynamically for printability (or however you do so) than mark my left nav, top nav, sub menus etc.

Diabolik900
Mar 28, 2007

A print stylesheet is just a separate CSS file (or a media query in your existing CSS file) that only affects the page when it's printed. There's no need to change any styles programmatically for this. Your use case sounds like it can be accomplished very easily.

Add a class called "printable" (or whatever) to the HTML elements you want to be printed.

Include "media" attributes in your css links like this:

code:

<link rel="stylesheet" href="filename1.css" media="print" />
<link rel="stylesheet" href="filename2.css" media="screen" />

Add this to your print CSS file:

code:

*:not(.printable) {
    display: none;
}

You can add more CSS as needed to get the layout how you want it, but this will accomplish what you're asking for.

Loezi
Dec 18, 2012

Never buy the cheap stuff
Was reading the MaterializeCSS thing and it reminded me of this question I've had for some time:

Since when has writing HTML like this been okay?
code:
<div class="card-panel teal lighten-2">This is a card panel with a teal lighten-2 class</div>
Why is this a good idea?
code:
<table class="table table-hover table-condense table-striped"></table>
Also something that confuses me is that tables for layout has been Considerend Harmful since the nineties but now everyone is writing the same god drat thing but just replacing the table, tr, td etc. tags with divs with classes "row", "col-sm-2" etc. WHY?

And why the gently caress does half the internet look like this now?
code:
<div id="content-main" class="content-main" role="main">
  <div class="container">
    <div class="box">
      <div class="single-column">
        <div class="row">
          <div class="col-md-8 col-md-offset-2">
            <h1 class="hdr-jumbo">Things for everyone.</h1>
            <p class="lead">Thing is a thng</p>
            <a href="/fi/download/" id="homepage-cta-button" class="button button-highlight button-lg  js-goto-signup js-gtm-event js-button-download js-get-spotify"> Download thing</a>
          </div>
        </div>
      </div>
    </div>
  </div>
</div
Isn't the whole idea of CSS and HTML that content is separated from the visual representation? What the hell am I not getting here?

And when you go the Sass route and just @extend everything from boostrap components you get horrors like this as the CSS output:
code:
.panel > .table, .thing > .table,
.panel > .table-responsive > .table,
.thing > .table-responsive > .table,
.panel > .panel-collapse > .table,
.thing > .panel-collapse > .table,
.thing > div > .table {
  margin-bottom: 0; }
.panel > .table:first-child, .thing > .table:first-child,
.panel > .table-responsive:first-child > .table:first-child,
.thing > .table-responsive:first-child > .table:first-child {
  border-top-right-radius: 3px;
  border-top-left-radius: 3px; }
  .panel > .table:first-child > thead:first-child > tr:first-child td:first-child, .thing > .table:first-child > thead:first-child > tr:first-child td:first-child,
  .panel > .table:first-child > thead:first-child > tr:first-child th:first-child,
  .thing > .table:first-child > thead:first-child > tr:first-child th:first-child,
  .panel > .table:first-child > tbody:first-child > tr:first-child td:first-child,
  .thing > .table:first-child > tbody:first-child > tr:first-child td:first-child,
  .panel > .table:first-child > tbody:first-child > tr:first-child th:first-child,
  .thing > .table:first-child > tbody:first-child > tr:first-child th:first-child,
  .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child,
  .thing > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child,
  .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child,
  .thing > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child,
  .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child,
  .thing > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child,
  .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child,
  .thing > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child {
    border-top-left-radius: 3px; }
  .panel > .table:first-child > thead:first-child > tr:first-child td:last-child, .thing > .table:first-child > thead:first-child > tr:first-child td:last-child,
  .panel > .table:first-child > thead:first-child > tr:first-child th:last-child,
  .thing > .table:first-child > thead:first-child > tr:first-child th:last-child,
  .panel > .table:first-child > tbody:first-child > tr:first-child td:last-child,
  .thing > .table:first-child > tbody:first-child > tr:first-child td:last-child,
  .panel > .table:first-child > tbody:first-child > tr:first-child th:last-child,
  .thing > .table:first-child > tbody:first-child > tr:first-child th:last-child,
  .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child,
  .thing > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child,
  .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child,
  .thing > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child,
  .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child,
  .thing > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child,
  .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child,
  .thing > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child {
    border-top-right-radius: 3px; }
.panel > .table:last-child, .thing > .table:last-child,
.panel > .table-responsive:last-child > .table:last-child,
.thing > .table-responsive:last-child > .table:last-child {
  border-bottom-right-radius: 3px;
  border-bottom-left-radius: 3px; }
  .panel > .table:last-child > tbody:last-child > tr:last-child td:first-child, .thing > .table:last-child > tbody:last-child > tr:last-child td:first-child,
  .panel > .table:last-child > tbody:last-child > tr:last-child th:first-child,
  .thing > .table:last-child > tbody:last-child > tr:last-child th:first-child,
  .panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child,
  .thing > .table:last-child > tfoot:last-child > tr:last-child td:first-child,
  .panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child,
  .thing > .table:last-child > tfoot:last-child > tr:last-child th:first-child,
  .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child,
  .thing > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child,
  .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child,
  .thing > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child,
  .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child,
  .thing > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child,
  .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child,
  .thing > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child {
    border-bottom-left-radius: 3px; }
  .panel > .table:last-child > tbody:last-child > tr:last-child td:last-child, .thing > .table:last-child > tbody:last-child > tr:last-child td:last-child,
  .panel > .table:last-child > tbody:last-child > tr:last-child th:last-child,
  .thing > .table:last-child > tbody:last-child > tr:last-child th:last-child,
  .panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child,
  .thing > .table:last-child > tfoot:last-child > tr:last-child td:last-child,
  .panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child,
  .thing > .table:last-child > tfoot:last-child > tr:last-child th:last-child,
  .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child,
  .thing > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child,
  .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child,
  .thing > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child,
  .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child,
  .thing > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child,
  .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child,
  .thing > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child {
    border-bottom-right-radius: 3px; }
.panel > .panel-body + .table, .thing > .panel-body + .table, .thing > div + .table,
.panel > .panel-body + .table-responsive,
.thing > .panel-body + .table-responsive,
.thing > div + .table-responsive {
  border-top: 1px solid #dddddd; }
.panel > .table > tbody:first-child > tr:first-child th, .thing > .table > tbody:first-child > tr:first-child th,
.panel > .table > tbody:first-child > tr:first-child td,
.thing > .table > tbody:first-child > tr:first-child td {
  border-top: 0; }
.panel > .table-bordered, .thing > .table-bordered,
.panel > .table-responsive > .table-bordered,
.thing > .table-responsive > .table-bordered {
  border: 0; }
  .panel > .table-bordered > thead > tr > th:first-child, .thing > .table-bordered > thead > tr > th:first-child,
  .panel > .table-bordered > thead > tr > td:first-child,
  .thing > .table-bordered > thead > tr > td:first-child,
  .panel > .table-bordered > tbody > tr > th:first-child,
  .thing > .table-bordered > tbody > tr > th:first-child,
  .panel > .table-bordered > tbody > tr > td:first-child,
  .thing > .table-bordered > tbody > tr > td:first-child,
  .panel > .table-bordered > tfoot > tr > th:first-child,
  .thing > .table-bordered > tfoot > tr > th:first-child,
  .panel > .table-bordered > tfoot > tr > td:first-child,
  .thing > .table-bordered > tfoot > tr > td:first-child,
  .panel > .table-responsive > .table-bordered > thead > tr > th:first-child,
  .thing > .table-responsive > .table-bordered > thead > tr > th:first-child,
  .panel > .table-responsive > .table-bordered > thead > tr > td:first-child,
  .thing > .table-responsive > .table-bordered > thead > tr > td:first-child,
  .panel > .table-responsive > .table-bordered > tbody > tr > th:first-child,
  .thing > .table-responsive > .table-bordered > tbody > tr > th:first-child,
  .panel > .table-responsive > .table-bordered > tbody > tr > td:first-child,
  .thing > .table-responsive > .table-bordered > tbody > tr > td:first-child,
  .panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child,
  .thing > .table-responsive > .table-bordered > tfoot > tr > th:first-child,
  .panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child,
  .thing > .table-responsive > .table-bordered > tfoot > tr > td:first-child {
    border-left: 0; }
  .panel > .table-bordered > thead > tr > th:last-child, .thing > .table-bordered > thead > tr > th:last-child,
  .panel > .table-bordered > thead > tr > td:last-child,
  .thing > .table-bordered > thead > tr > td:last-child,
  .panel > .table-bordered > tbody > tr > th:last-child,
  .thing > .table-bordered > tbody > tr > th:last-child,
  .panel > .table-bordered > tbody > tr > td:last-child,
  .thing > .table-bordered > tbody > tr > td:last-child,
  .panel > .table-bordered > tfoot > tr > th:last-child,
  .thing > .table-bordered > tfoot > tr > th:last-child,
  .panel > .table-bordered > tfoot > tr > td:last-child,
  .thing > .table-bordered > tfoot > tr > td:last-child,
  .panel > .table-responsive > .table-bordered > thead > tr > th:last-child,
  .thing > .table-responsive > .table-bordered > thead > tr > th:last-child,
  .panel > .table-responsive > .table-bordered > thead > tr > td:last-child,
  .thing > .table-responsive > .table-bordered > thead > tr > td:last-child,
  .panel > .table-responsive > .table-bordered > tbody > tr > th:last-child,
  .thing > .table-responsive > .table-bordered > tbody > tr > th:last-child,
  .panel > .table-responsive > .table-bordered > tbody > tr > td:last-child,
  .thing > .table-responsive > .table-bordered > tbody > tr > td:last-child,
  .panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child,
  .thing > .table-responsive > .table-bordered > tfoot > tr > th:last-child,
  .panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child,
  .thing > .table-responsive > .table-bordered > tfoot > tr > td:last-child {
    border-right: 0; }
  .panel > .table-bordered > thead > tr:first-child > td, .thing > .table-bordered > thead > tr:first-child > td,
  .panel > .table-bordered > thead > tr:first-child > th,
  .thing > .table-bordered > thead > tr:first-child > th,
  .panel > .table-bordered > tbody > tr:first-child > td,
  .thing > .table-bordered > tbody > tr:first-child > td,
  .panel > .table-bordered > tbody > tr:first-child > th,
  .thing > .table-bordered > tbody > tr:first-child > th,
  .panel > .table-responsive > .table-bordered > thead > tr:first-child > td,
  .thing > .table-responsive > .table-bordered > thead > tr:first-child > td,
  .panel > .table-responsive > .table-bordered > thead > tr:first-child > th,
  .thing > .table-responsive > .table-bordered > thead > tr:first-child > th,
  .panel > .table-responsive > .table-bordered > tbody > tr:first-child > td,
  .thing > .table-responsive > .table-bordered > tbody > tr:first-child > td,
  .panel > .table-responsive > .table-bordered > tbody > tr:first-child > th,
  .thing > .table-responsive > .table-bordered > tbody > tr:first-child > th {
    border-bottom: 0; }
  .panel > .table-bordered > tbody > tr:last-child > td, .thing > .table-bordered > tbody > tr:last-child > td,
  .panel > .table-bordered > tbody > tr:last-child > th,
  .thing > .table-bordered > tbody > tr:last-child > th,
  .panel > .table-bordered > tfoot > tr:last-child > td,
  .thing > .table-bordered > tfoot > tr:last-child > td,
  .panel > .table-bordered > tfoot > tr:last-child > th,
  .thing > .table-bordered > tfoot > tr:last-child > th,
  .panel > .table-responsive > .table-bordered > tbody > tr:last-child > td,
  .thing > .table-responsive > .table-bordered > tbody > tr:last-child > td,
  .panel > .table-responsive > .table-bordered > tbody > tr:last-child > th,
  .thing > .table-responsive > .table-bordered > tbody > tr:last-child > th,
  .panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td,
  .thing > .table-responsive > .table-bordered > tfoot > tr:last-child > td,
  .panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th,
  .thing > .table-responsive > .table-bordered > tfoot > tr:last-child > th {
    border-bottom: 0; }
.panel > .table-responsive, .thing > .table-responsive {
  border: 0;
  margin-bottom: 0; }
:wtc:

Someone please explain this to me. Are there any non-horror ways of actually using all these fancy new frameworks?

Gmaz
Apr 3, 2011

New DLC for Aoe2 is out: Dynasties of India
You use those frameworks when you don't give a poo poo and want things looking decent quickly for no effort. Or well, that might just be my use case.

down with slavery
Dec 23, 2013
STOP QUOTING MY POSTS SO PEOPLE THAT AREN'T IDIOTS DON'T HAVE TO READ MY FUCKING TERRIBLE OPINIONS THANKS
why I don't use bootstrap.txt

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Gmaz posted:

You use those frameworks when you don't give a poo poo and want things looking decent quickly for no effort. Or well, that might just be my use case.

This. If you actually care about this stuff use create your own component system. Frameworks are just that, and as a consequence they contain mountains of utility classes, components, and all sorts of poo poo you don't need and can even impact on maintainability down the track.

If you want custom, go custom and ignore the frameworks. What they give you is not that difficult or even time consuming if you know your way around CSS.

Leshy
Jun 21, 2004

Loezi posted:

Isn't the whole idea of CSS and HTML that content is separated from the visual representation? What the hell am I not getting here?
That is the idea, but there is quite some discussion on exactly how far they can be seperated. Specific designs and browser limitations may require the use of extra elements (such as wrappers), which are then by default only there for visual representation since they add no further semantic information about the document.

Grid systems, for example, are quite popular. They create a grid on which you can lay out your content so that your site has a pleasing visual harmony and becomes responsive as the individual elements reflow according to the screen size of the visitor. All good stuff, but they do tend to require a lot of extra markup and almost recreate the old table-based markup by creating columns, rows and blocks.

There's also an OOCSS (object-oriented CSS) trend; CSS files block rendering of the page until they are fully loaded, so it pays off to have your CSS files as small and lean as possible. By creating smaller sets of declarations in your CSS and sprinkling your HTML with classes to apply the right ones, the CSS file contains less repeating or overriding statements and ends up being smaller. The speed increase from the CSS loading faster tends to outweigh the size increase in your HTML file.

And of course as Maluco Marinero already said, many CMS's and frameworks add a ton of extraneous stuff since they need to cater to a lot of use cases and designs; their strength lies in having many options and being able to set something up quickly and easily, not in being highly optimized.

Loezi
Dec 18, 2012

Never buy the cheap stuff

Leshy posted:

There's also an OOCSS (object-oriented CSS) trend; CSS files block rendering of the page until they are fully loaded, so it pays off to have your CSS files as small and lean as possible. By creating smaller sets of declarations in your CSS and sprinkling your HTML with classes to apply the right ones, the CSS file contains less repeating or overriding statements and ends up being smaller. The speed increase from the CSS loading faster tends to outweigh the size increase in your HTML file.

I have my doubts about the assumptions behind this.

Many times, there's a reason you want (some of) your CSS to block the rendering. Take the CNN website for a random example. Go there and delete the CSS links via your developer console. The site is unusable. Now the "smart" way (I've been told) to use OOCSS and still get a usable baseline site for your user would be to serve the CSS in multiple chunks: Really basic CSS that provides a "usable but bad looking" user experience and blocks the rendering, followed by non-blocking "make it pretty" CSS. But now you are loading more assets. And the platform that suffers the most from CSS processing - mobile - also has the slowest internet speeds and longest RTTs. So you are adding essentially saving a few milliseconds from the fetch-to-first-view time but adding possibly hundreds of milliseconds more to the fetch-to-complete-site time. Is this a sensible trade off?

Another way to solve the problem would be to embed the basic CSS in the .html file but then you are serving the same CSS with every page the user requests, making caching the "get-this-first" CSS file impossible. This is even worse.

I'm also a bit wary of the possible development time overhead caused by embedding tons of class declarations to the HTML, since this would make changing things much much harder and more time consuming. Are we saving a non-noticeable amount of user time to spend hours/days more on site housekeeping? Is this sensible?

Furthermore, I'd say that going from "sensible and minimized" CSS to "really optimized" CSS should probably be the absolutely last thing to optimize in your website considering that 90% of websites built in the last year or so are serving the user absolutely huge background images for those fancy new parallax scrolling sites that everyone and their dog ignores.

What I'm asking really is that are there any in-depth, neutral-POV articles that actually look at these questions and doubts I have with real data backing up their conclusions?

Leshy
Jun 21, 2004

Loezi posted:

I have my doubts about the assumptions behind this.
Keep in mind that the reasoning is mostly relevant for large corporate websites where a few extra tenths of a second in pageloading times directly result in less conversion and revenue, and which can easily serve a few hundred KB of CSS. They want to get their pages – and most importantly by a wide margin, the first page a visitor requests – to load as fast as possible. Images and scripts form the bulk of the page size, but they are (or can be) loaded asynchronously either without the user noticing it or it not being an issue.

External CSS files can't be. Or rather, they can, but it leads to an unstyled, possibly dysfunctional page that suddenly re-renders as the proper styles are loaded. Leading to...

quote:

Many times, there's a reason you want (some of) your CSS to block the rendering. [...] serve the CSS in multiple chunks: Really basic CSS that provides a "usable but bad looking" user experience and blocks the rendering, followed by non-blocking "make it pretty" CSS.

Another way to solve the problem would be to embed the basic CSS in the .html file but then you are serving the same CSS with every page the user requests, making caching the "get-this-first" CSS file impossible. This is even worse.
You're mostly right, but not entirely.

In the ideal scenario you load all of your CSS asynchronously so that it doesn't block rendering. You identify the minimal amount of CSS that you need to properly style the part of the page that a user first sees when he visits your site and you inline that in your page. When a user visits, that page will immediately start rendering and apply the needed CSS to make everything look normal, while in the background the full CSS files load and style everything that the user doesn't see immediately.

To avoid the inline CSS from cluttering up each page and making the HTML files unnecessarily large, you set up a check for a cookie on the users system, which you set after the first page load. If the cookie isn't present, the user hasn't requested and cached your full CSS files yet, so you inline the critical CSS; if the cookie is there, so are the cached CSS files and no CSS needs to be inlined.

quote:

So you are adding essentially saving a few milliseconds from the fetch-to-first-view time but adding possibly hundreds of milliseconds more to the fetch-to-complete-site time. Is this a sensible trade off?
Essentially, yes. You want to retain users, and you do that by serving them (relevant) content. The sooner you start serving that content, the more likely you are to do that, even if it means that the page being fully loaded takes slightly longer. That doesn't matter too much if users are already able to engage with your site while it finishes loading (assuming that it doesn't lead to any jarring visual changes or important functionality being missing).

As a hobbyist, non-professional web designer I can't say how OOCSS compares to 'traditional' CSS in terms of maintenance or change time in a large-scale environment, so I can't comment on that. I would say that the user time is not non-noticeable if it leads to an increase in conversions, however. And all signs point to a direct 'less loading time = less users impatiently turning away' relation, so :v:

quote:

Furthermore, I'd say that going from "sensible and minimized" CSS to "really optimized" CSS should probably be the absolutely last thing to optimize in your website considering that 90% of websites built in the last year or so are serving the user absolutely huge background images for those fancy new parallax scrolling sites that everyone and their dog ignores.
I think generally users mind waiting for an image to finish loading less than they mind waiting for actual content to appear, but yes, it obviously isn't much use optimizing your CSS if you don't optimize the rest.

I don't really know of any completely neutral articles with a lot of data, but an interesting read I know of was Smashing Magazine's article on their optimization process which covers some of this topic.

Leshy fucked around with this message at 17:15 on Jan 18, 2015

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Gmaz posted:

You use those frameworks when you don't give a poo poo and want things looking decent quickly for no effort. Or well, that might just be my use case.

Like everything in software, you can have it done right, fast, or cheap: pick two. Bootstrap and pals value fast and cheap. Being a world driven by business concerns, this may be a "good" or at least acceptable decision. Personally, I very rarely use frameworks, but I do try and look at them and learn things from them. Sometimes that learning is what not to do.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.
One other thought I have about the separation if content and style, is it may be more useful to look at the separation as not HTML/CSS (which are tied no matter what), but structure vs presentation. This may be obvious but here's my cut point, the HTML should represent the structure of your document with classes added. Therefore, with no stylesheet the website should be to some degree usable. A few things fall out of this:

- use semantic html5 that represents your correct content order

- apply classes on top of that ideal structure

- style using classes only, never style elements(h1, p, h2, etc) except in your foundational styles.

- attempt to make styles by classes ignorant of structure, so essentially avoid nesting selection.

I use BEM as a rule, with additional rules I call contexts (working in this concept with a mate). Context rules are classes with an asterisk, like front-page\* where I shed the nested selector rule because it's pragmatic to do so. This way I have largely single concern style rules, using extend isn't too nasty, and at the end of all that we use contexts to ramp up the specifity where required.

As a result we end up with fairly predictable CSS rather than a mash of utility classes.

End words, longer than intended but maybe this sparks discussion/is helpful.

Ahz
Jun 17, 2001
PUT MY CART BACK? I'M BETTER THAN THAT AND YOU! WHERE IS MY BUTLER?!

Diabolik900 posted:

A print stylesheet is just a separate CSS file (or a media query in your existing CSS file) that only affects the page when it's printed. There's no need to change any styles programmatically for this. Your use case sounds like it can be accomplished very easily.

Add a class called "printable" (or whatever) to the HTML elements you want to be printed.

Include "media" attributes in your css links like this:

code:
<link rel="stylesheet" href="filename1.css" media="print" />
<link rel="stylesheet" href="filename2.css" media="screen" />
Add this to your print CSS file:

code:
*:not(.printable) {
    display: none;
}
You can add more CSS as needed to get the layout how you want it, but this will accomplish what you're asking for.

Thanks. I am having a little trouble though. I have everything setup but the NOT selector doesn't seem to work as expected.

I went ahead and marked my chart/report DIVs with the class printable, added print stylesheet, reference in head etc. But it doesn't work.

To test, i removed the not (intentionally selecting the printable class) but keeping display:none, and my charts successfully vanished from the print page (showing that the print stylesheet was set right and doing its job). I guess I could go around my html adding no-print to the classes but maybe there is something I need to do.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Ahz posted:

Thanks. I am having a little trouble though. I have everything setup but the NOT selector doesn't seem to work as expected.

I went ahead and marked my chart/report DIVs with the class printable, added print stylesheet, reference in head etc. But it doesn't work.

To test, i removed the not (intentionally selecting the printable class) but keeping display:none, and my charts successfully vanished from the print page (showing that the print stylesheet was set right and doing its job). I guess I could go around my html adding no-print to the classes but maybe there is something I need to do.

The not selector may not work in your browser. Try something like this as your print.css:

code:
div, p, section, ol, ul {
   display: none;
}

did.printMe, p.printMe, section.printMe, ol.printMe, ul.printMe {
 Display: block;
}
That should turn off most things, then turn on ones you give the printMe class to. Note that this may get you into trouble with nested elements, so your dream of only adding a class to things you want to print may not come to fruition.

Sedro
Dec 31, 2008

Ahz posted:

Thanks. I am having a little trouble though. I have everything setup but the NOT selector doesn't seem to work as expected.

I went ahead and marked my chart/report DIVs with the class printable, added print stylesheet, reference in head etc. But it doesn't work.

To test, i removed the not (intentionally selecting the printable class) but keeping display:none, and my charts successfully vanished from the print page (showing that the print stylesheet was set right and doing its job). I guess I could go around my html adding no-print to the classes but maybe there is something I need to do.

the 'not' will match html and body so you probably have to tag those as printable.

Diabolik900
Mar 28, 2007

Yeah, I was being a little over-ambitious in suggesting *:not(.printable). The .printable elements won't show up either, because their parents are set to display: none. You're going to have to get a little more specific in your print CSS.

vOv
Feb 8, 2014

Or you could just make a .not-printable class and put that on everything you don't want to print, if that's simpler

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

vOv posted:

Or you could just make a .not-printable class and put that on everything you don't want to print, if that's simpler

That's the right way to do it, but he wants to avoid that, so we're tossing out bad ideas to try an make it happen! :getin:

Ahz
Jun 17, 2001
PUT MY CART BACK? I'M BETTER THAN THAT AND YOU! WHERE IS MY BUTLER?!
Yeah I gave in and just made all the nav, menus etc non printable and it works fine, thanks!

My new problem is SVG printing.

I can easily render my charts (using c3js library) for my responsive bootstrap layout, but when I want to print my charts, the SVGs vary wildly in size depending on window size. Most printouts look find until my window is beyond 1200px width, then my SVGs start rendering to get cut off the page etc.

Right now I have one chart per page with 'page-break-after:always' and thats fine, but I would like to have each chart take up maybe 80% of the width of the page without cutting off the side or losing center (which happens when the window is too wide).

Pollyanna
Mar 5, 2005

Milk's on them.


Lumpy posted:

I just saw this here thing on the internet and I thought it looked interesting: http://materializecss.com/ Material Design CSS framework. I'm probably late to the party on it, but it's new to me!

syrup posted:

Nice find -- I hadn't seen that one yet. There are also similar projects that work out of the box with React, Angular, and Ember if you're into any of those.

Ooh, wow, I hadn't heard about any of this. Material Design is totally new to me...is this basically a Google-made CSS framework, like Bootstrap?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Pollyanna posted:

Ooh, wow, I hadn't heard about any of this. Material Design is totally new to me...is this basically a Google-made CSS framework, like Bootstrap?

Material Design is Google 's visual language for app design. The thing I linked is something some folks made based on it.


Google's thing: https://www.google.com/design/spec/material-design/introduction.html

Pollyanna
Mar 5, 2005

Milk's on them.


Lumpy posted:

Material Design is Google 's visual language for app design. The thing I linked is something some folks made based on it.


Google's thing: https://www.google.com/design/spec/material-design/introduction.html

:psyduck: I have absolutely no idea what this is, but it looks cool.

The Dave
Sep 9, 2003

It's the design language Google unveiled when they unveiled Android 5.0.

ConanThe3rd
Mar 27, 2009
Actually that's a point, is it OK to be using Material Design in projects not specific to Android / Google products?

fuf
Sep 12, 2004

haha
There's a background video at the top of this page and some people are saying they see a black screen for a split second before it loops back to the beginning:
http://178.79.163.93/littlefish/

I don't see it... Is there anything I can do? Can I encode the mp4 differently or something?

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



fuf posted:

There's a background video at the top of this page and some people are saying they see a black screen for a split second before it loops back to the beginning:
http://178.79.163.93/littlefish/

I don't see it... Is there anything I can do? Can I encode the mp4 differently or something?

You could try adding a poster that's the first frame of the video

revmoo
May 25, 2006

#basta
Anyone have a no-hassle color picker library? I've tried a couple and they all either have way too many dependancies (images? wtf?) or don't work properly even on their own demos.

All I need is a way to show a color picker when a user clicks on an input type="text" box and show the hex code. I've done this in the past but I can't remember what I used and everything I've tested today is crap. I just want something with a single js file and a single css file.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

revmoo posted:

Anyone have a no-hassle color picker library? I've tried a couple and they all either have way too many dependancies (images? wtf?) or don't work properly even on their own demos.

All I need is a way to show a color picker when a user clicks on an input type="text" box and show the hex code. I've done this in the past but I can't remember what I used and everything I've tested today is crap. I just want something with a single js file and a single css file.

Don't know your use case / target browsers, but is <input type="color" /> an option for you? Every polyfill I searched for (admittedly only for a few seconds) seems to want jQuery, but there's probably one out there for vanilla JS. If not, write one!

EDIT: Maybe this? https://github.com/bebraw/colorjoe

\/\/\/ Well then, one of the bajillion :google: results for 'html5 color input ployfill' will probably work. Sorry I do not have a specific suggestion.

Lumpy fucked around with this message at 17:00 on Jan 22, 2015

revmoo
May 25, 2006

#basta
I have jquery loaded, so that's not an issue. The above picker doesn't do input boxes (and looks like a whole lot of work). I really should be able to just do $('element').colorpicker(), that's all I've had to do in the past.

EDIT: Meh, ended up going with this: http://www.eyecon.ro/colorpicker/ it's not great but it works.

revmoo fucked around with this message at 17:03 on Jan 22, 2015

Ahz
Jun 17, 2001
PUT MY CART BACK? I'M BETTER THAN THAT AND YOU! WHERE IS MY BUTLER?!
Does anyone know a good source for SVG icons or graphics? Something where if I want to use a single icon, I can just use that instead of a whole pack (I already have glyphicons pro)

Nice packs are fine too, though I also have font awesome.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.
http://thenounproject.com would probably be your first stop for stuff like that.

Spatulater bro!
Aug 19, 2003

Punch! Punch! Punch!

Maluco Marinero posted:

http://thenounproject.com would probably be your first stop for stuff like that.

The free version requires that you "give credit" to the image creator. Any idea if they're cool with me doing this via code comments?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

caiman posted:

The free version requires that you "give credit" to the image creator. Any idea if they're cool with me doing this via code comments?

I bet if you emailed and asked, they'd tell you.

yoyomama
Dec 28, 2008

Ahz posted:

Does anyone know a good source for SVG icons or graphics? Something where if I want to use a single icon, I can just use that instead of a whole pack (I already have glyphicons pro)

Nice packs are fine too, though I also have font awesome.

I've tried perfect icons and glyphter before.

Ocean Book
Sep 27, 2010

:yum: - hi
I am very new to javascript programming and had what I hope is an easy question. Say I have some text and buttons on a page. Is there a way I can, on command, remove that stuff from the screen and replace it with a new set of text and buttons?

v1nce
Sep 19, 2004

Plant your brassicas in may and cover them in mulch.
Sure, use something like jQuery to show/hide elements easily.

http://jsfiddle.net/t1gyspzj/1/

There are many different ways to achieve this, depending on what exactly it is you're trying to do.

Spatulater bro!
Aug 19, 2003

Punch! Punch! Punch!

Ahz posted:

Does anyone know a good source for SVG icons or graphics? Something where if I want to use a single icon, I can just use that instead of a whole pack (I already have glyphicons pro)

Nice packs are fine too, though I also have font awesome.

Just this evening I came across this: https://fonticons.com/. It seems to basically be a way to create a customized group of icons without having to load an entire pack.

Adbot
ADBOT LOVES YOU

revmoo
May 25, 2006

#basta
I've got an app that displays hundreds of thousands of dom nodes and that number is only going to increase. I update their contents with AJAX. I'm running into performance issues and from profiling it appears that I may just be hitting the limits of what you can do with a browser. Right now I'm sitting at 153k dom nodes, and there are elements, roughly 10-15,000 of which, that actually get updated every 20 seconds. This of course, runs like dog poo poo. The core of the issue appears to be the main loop that does the actual updating of the html. I tried throwing it into a staggered setTimeout but it didn't help at all.

Where do I go from here to scale this thing? Do I need to use some sort of canvas/svg tech or what? I'm kind of stumped.

revmoo fucked around with this message at 14:38 on Jan 23, 2015

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply