17

Follow-up To Loading CSS And JS Conditionally


Posted by Artem Russakovskii on January 15th, 2010 in Programming, Wordpress

First of all, I'd like to thank everyone who read and gave their 2 cents about the [Wordpress Plugin Development] How To Include CSS and JavaScript Conditionally And Only When Needed By The Posts post. The article was well received and will hopefully spark some optimizations around loading styles and scripts.

Here are some discussions and mentions around the web:

Sure, there are drawbacks to this method and it does require some more processing on the backend and it's not for everyone, which is why we should always strive for an even better solution.

I stand by my point of view that, for instance, my dedicated …

Read the rest of this article »

Updated: August 30th, 2014

Introduction

wordpress logo In this tutorial, I am going to introduce a WordPress technique that I believe was unpublished until I raised the question a few days ago on the WordPress forums.

In short, the problem I was trying to solve was plugins unnecessarily loading their JavaScript and CSS on *every* page of the blog, even when doing so would achieve absolutely nothing and the plugin wouldn't do any work.

Update #1: I have posted a follow-up in response to some comments received around the web.
Update #2: There is a solution that can be considered a compromise as it works well for loading JavaScript but doesn't handle CSS.

I briefly mentioned this approach here but Scribu decided to expand on …

Read the rest of this article »

image Ever since the introduction of the official Retweet button, I've wanted it to be a little more interactive. I usually want to add my 2 cents into the tweet I'm about to retweet but the default RT button just doesn't allow for it – Yes is the only option:

image

Troy's Twitter Script

Enter Troy's Twitter script for Firefox that I reviewed in detail a few months ago.

Troy's script added the RT button to my stream (along with inline picture and video embed, auto url expander and shortener, name autocomplete, and other things) way before Twitter introduced it.

It also allowed me to add a couple of words or rephrase the retweet to make it more relevant to my followers….

Read the rest of this article »

Updated: June 24th, 2020

What Is This All About?

imageIf you, like me, love StackOverflow, SuperUser, ServerFault – the community programming/software/sysadmin Q&A sites built by Joel Spolsky and Jeff Atwood and you are an active member of these sites, you owe it to yourself to install this underappreciated and unadvertised greasemonkey script: StackOverflow – User Info Aggregate. I really think it should get more attention. All credit goes to Jon Erickson.

(What? You've never heard of the sites mentioned above and you call yourself a programmer? Shame on you – go check them out immediately!)

Once you install the script, the top bar that normally shows only single site statistics, like so:

image

will turn into a multi-site bar, with all …

Read the rest of this article »

Updated: September 16th, 2012

Recently I read an article on the Six Revisions blog that discussed 10 seemingly simple improvements to the twitter interface. They included such things as nick autocomplete, mentions, groups, and more.

You could only dream about such twitter improvements… that is until you use the Troys Twitter script. Just perform the following steps and you will have the features I describe in this article. Here we go:

  1. Install Firefox (you already have that, right?)
  2. Install the Firefox greasemonkey extension
  3. Install the Troys Twitter script
Greasemonkey is the most versatile extension available for Firefox, as it’s essentially a whole framework for scripts that can manipulate any aspect of any page. Head over to userscripts.org and take a look at the myriads

Read the rest of this article »

Updated: June 9th, 2009

Problem

While writing a 1093985th Perl script the other day I was facing the following dilemma:

  • Let’s say there is a local library, called TheUberLib.pm. It is so uber that most of my scripts, located all over the machine, include it.
  • Now, let’s also say that there’s an even more uberly important binary called run_me_now_or_you_will_die but the only way to find it is by using a relative path to the aforementioned TheUberLib.pm, for example ../bin (RELATIVE TO TheUberLib.pm).
  • I don’t want to hardcode the path to run_me_now_or_you_will_die because it can be different on multiple machines and the code wouldn’t be robust enough – all I know is that the path is relative to an included library.

So …

Read the rest of this article »