Comments by the person most recently known as Andreas
Andreas has posted a total of 123 comments.
jQuery, Web Standards, Semantics and Progressive Enhancement
Andreas has posted a total of 123 comments.
From June 02 to April 23
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 |
The style switcher allows you to change the look and feel of exscale.se.
Only CSS and JavaScript are changed. The XHTML stays the same.
For more information about the styles, check the styles page.
Det är enda gangen jag är riktigt lugn. När jag spelar Quadra.
- Henke
Do you find the "scroll-pagination" annoying? (If you don't know what it is, scroll to the bottom of the first-page)
Wednesday, May 27, 2009 | View all comments by Andreas
@Paul - I didn't take into account browser-resizing :/ I'll add it to my never-ending todo-list :)
Wednesday, May 27, 2009 | View all comments by Andreas
@Steven Black - Woops :) I'll have to look into that.
I'm actually using it on a client's site and they do regular testing cross-browsers so it does surprise me.
It works fine for me in FF3.0.10 and Opera 9.63 under Ubuntu though.
Wednesday, May 27, 2009 | View all comments by Andreas
@Helder Silva - I've actually used this together with jQuery UI Draggables. It's not that hard.
Draggables can take a callback-function to create the "helper" (the element(s) you see when you actually drag a draggable element), so if your helper-function simply checks which elements are '.selected' and then generate a list of duplicates you can select and then drag multiple elements.
Once the duplicated elements are dropped you can use ondrop (or something, not sure what it's called) and again check which elements have the class 'selected'.
Once you get comfy with draggables I think it should be pretty easy to combine it with drag-to-select.
Thursday, May 14, 2009 | View all comments by Andreas
Seems to work for me, which version are you using?
Tuesday, May 05, 2009 | View all comments by Andreas
You should run your code through JSLint before compressing it to make sure it's error-free.
Tuesday, April 28, 2009 | View all comments by Andreas
@Brandon - Yea I know. You can download the entire zip and that should run as long as you've got L/M/WAMP installed.
Or you could grab the latest version, which is much more simplified and doesn't use PHP, from the link in the article.
Monday, March 30, 2009 | View all comments by Andreas
liveValidation adds a submit-event to the form it validates that makes sure there are no invalid icons in the form before it's submitted.
If that doesn't work for you you've probably overridden the submit-event or are using some other plug-in at the same time.
You may wanna check out the latest version as well.
Tuesday, March 24, 2009 | View all comments by Andreas
@Barry - sounds like WP shows the latest posts if no search-query is entered...
liveSearch won't display its "box" if it doesn't get any results. So I think the easiest fix is to make sure WP's search-results returns nothing (an empty string) if there are no results. At least on ajax-calls.
So, in the file you're pointing liveSearch to:
<?phpif (count($searchResults) == 0 and isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
die();
}
?>
Obviously you may have to change the $searchResults-variable, the $_SERVER-var is set on ajax-requests.
Tuesday, March 24, 2009 | View all comments by Andreas
@Matthijs Groen - Hm, as far as I know, slideUp doesn't actually do anything to :invisible elements, so your code should actually not be needed.
Have you experienced problems without your fix? In which browser/OS?
Monday, March 16, 2009 | View all comments by Andreas
Hmm that's interesting - you wouldn't happen to have a source?
If they do then that sure sounds like a valid reason...
Friday, March 13, 2009 | View all comments by Andreas
No, there's most likely no such plug-in. That would seriously surprise me.
I recommend reading a few Javassript-tutorials and when you feel like you've got a hang of it then have a look at jQuery.
There are some good links in my blog roll.
Thursday, March 12, 2009 | View all comments by Andreas
@Josh - actually you would have to modify the JS. Add a scroll-event to the window-element and reposition the div in it.
Tuesday, March 10, 2009 | View all comments by Andreas
Hmm.. I see what you're saying but I don't like the idea of having to structure my code just to please Google or anyone else.
To me this type of structure makes perfect semantic and logical sense and that, to me, is most important.
I use this structure on my own site and have to say it seems Google understands quite well what is actual content (changes from page to page) and what is just the surrounding widgets.
Friday, March 06, 2009 | View all comments by Andreas
I should probably make this more information more accessible but you can actually click the CAPTCHA to generate a new one. I normally do that till I'm sure of what it says. But it's still shite, I agree.
Thursday, March 05, 2009 | View all comments by Andreas
Hehe I know, it's rubbish. I'm working on a completely new blog and I'll get rid of it in this version.
Thursday, March 05, 2009 | View all comments by Andreas
@Bart - I think that if the document only consists of one article then the article's title should be the h1 (like on that page).
But since that page really contains more modules than just the article-module ("Our top recommendations" and "More resources" in the left column for example) I don't think it makes sense to first not use headings for the other modules and second make the article's title the super-heading of those two modules.
I don't see how the "Our Top Recommendations"-heading is a sub-heading to the article-title...
Tuesday, February 17, 2009 | View all comments by Andreas
@David Hart - Ah nice catch. There may be more of them, especially cross-browser. This is a plug-in I've discontinued though. You can achieve the same effect much easier with display: table/table-row/table-cell.
Monday, February 16, 2009 | View all comments by Andreas
@x3sphere - Hmmm the code you're using right now looks kind of strange. In fact it looks like it would throw errors.
Since the pagination-links are added every time the live-search-results are updated I'd use event bubbling with a click-event on the actual #live-search-results-element:
// Initiate live search
$('input[name=q]').liveSearch({ajaxURL: 'search-results.php?q='});
// Add a click-event to the live search results div
$('#live-search-results').click(function(e) {
// The actual clicked element
var clicked = $(e.target);
// If the clicked element was a .pagination-link
if(clicked.is('a.pagination')) {
// Ajax the content
$.get($(this).attr('href'), function(data) {
// And update the live search results
$('#live-search-results').html(data);
});
}
});
Wednesday, February 11, 2009 | View all comments by Andreas
@Cancel bubble - Yes, that's true. I actually didn't think about that at all :)
I do however think that most users will not try to interact with the page behind simply because it looks like you can't.
And those that are curious/geeky enough to test the limits could easily remove a normal div-overlay using for example Firebug so none of them actually prohibits the user if he really wants to ignore the modal.
Tuesday, February 10, 2009 | View all comments by Andreas
Actually, it is.
Tuesday, February 03, 2009 | View all comments by Andreas
@Yuksel - Hmm... that hasn't happened to me, which version of IE do you mean? Do you get the same error on my example-page?
@Oskar - Yes, whatever you see in the browser when you visit the URL you pass to the plug-in will be put in the search-results box.
Typically you'd have a head.php, foot.php and search-results.php. When visiting the entire page you want all of that put together, but for the ajax-request you only want the search-results.php-file.
You may need to restructure some of your code unless it already supports loading every module individually - or you could create a separate ajax-search-results.php that only contains search results. No <html>, <head> or <body>.
Wednesday, January 21, 2009 | View all comments by Andreas
@Stefano - I do exactly that in the plug-in. Check the liveSearch-code and look for the setTimout-stuff.
Friday, January 16, 2009 | View all comments by Andreas
@Stephen - nice, I should look into adding that as an option for the plug-in.
Wednesday, January 14, 2009 | View all comments by Andreas
@Physio - screenshot up.
Wednesday, January 14, 2009 | View all comments by Andreas
@Al - If the returned HTML is all contained within one element (like <div id="content">...loads of html...</div>) you can pass the returned code to jQuery and then you can use any jQuery methods you want on it:
var returned = $(data);
$('#some-element').html(returned.find('#some-element-in-the-returned-code'));
If your returned code contains more than one root element it won't work though.
Tuesday, January 13, 2009 | View all comments by Andreas
@Al - thanks :) To be honest though I would recommend you try the official jQuery form plug-in. It's much more robust and complete than mine.
Saturday, January 03, 2009 | View all comments by Andreas
@Erwin - I'll give you the same answer as Tolis:
Yes, the only thing the liveSearch-plugin does to your ajaxURL is append the search-term to it.
So, if you pass in '/search/?q=' liveSearch will turn it into '/search/?q=lorem', but if you pass in '/search/?foo=bar&bar=foo&q=' liveSearch will turn it into '/search/?foo=bar&bar=foo&q=lorem'.
That way you can pass any additional vars you like.
Thursday, November 27, 2008 | View all comments by Andreas
@Shaamil - Thanks for the comment.
With the old version (that you see on this page) it's not possible, but i recently rewrote all my plug-ins and made improvements to most of them so if you grab the latest version you can target the plug-in on one particular element and the plug-in will only affect links inside that element:
$('#mydiv').favicons();
Wednesday, November 26, 2008 | View all comments by Andreas
@Steve - that would require quite a bit of extra code. There are a few autocomplete plug-ins for jQuery that already supports keyboard-navigation though.
Tuesday, November 25, 2008 | View all comments by Andreas
Glad you liked it :) I think my mate's stopped working on that new design, and I've stopped working on the code so it'll probably stay like this.
Tuesday, November 25, 2008 | View all comments by Andreas
@Firefox Hater - Hehe ok.
Sunday, November 23, 2008 | View all comments by Andreas
@Franck - Change that line to:
var results = jQuery('#results').hide().slideUp(0
Keep in mind that if any parent-element of #results have a position other than static the positioning will not work properly.
You may also wanna check out the updated version of the plug-in (temporary URL)
Tuesday, October 28, 2008 | View all comments by Andreas
jQuery or not, adding JS to a page is always the same.
For every JS-file you wish to include you require one script-element:
<script type="text/javascript" src="jquery.js"></script><script type="text/javascript" src="imgbox.js"></script>
Now simply including jQuery and the plug-in will do nothing. You have to actually call the plug-in for something to happen:
<script type="text/javascript">$('#my-list-of-images').imgbox();
</script>
You should always try to use external script-files (and not put JS directly in a script-element like that) and you should always try to keep the external script-files down to a minimum (you can merge all the files into one if you like). You should also include all your JS at the very bottom of the page, just before the closing body-tag:
<script type="text/javascript" src="all.js"></script></body>
There's hardly ever a reason to have more than one script-element.
Sunday, October 26, 2008 | View all comments by Andreas
If you know any HTML and JS at all the instructions in the article should hopefully be clear enough.
To include any jQuery plug-in you need to use a <script>-element to point to the script being included.
After that you need to actually call the plug-in ($('#holiday-photos, #random-images').imgbox(); ) but that's it.
Monday, October 20, 2008 | View all comments by Andreas
Yes, the only thing the liveSearch-plugin does to your ajaxURL is append the search-term to it.
So, if you pass in '/search/?q=' liveSearch will turn it into '/search/?q=lorem', but if you pass in '/search/?foo=bar&bar=foo&q=' liveSearch will turn it into '/search/?foo=bar&bar=foo&q=lorem'.
That way you can pass any additional vars you like.
Wednesday, October 15, 2008 | View all comments by Andreas
@Irtrt - Like I said, "It's a breeze with JavaScript", but why can't we do it with CSS?
Also, you don't need a lib to select parent elements, .parentNode works just fine.
Saturday, October 04, 2008 | View all comments by Andreas
@Åsa,
Det ser ut som du vänt på rewrite-regeln, det borde vara något sånt här:
RewriteEngine OnRewriteRule ^(.*?)/$ ?page=$1
Du vill alltså skriva om /vad-som-helst/ till ?page=vad-som-helst, inte tvärt om.
Edit: Angående ob_start så vet jag faktiskt inte hur illa det är om jag ska vara ärlig. Jag tror iaf det finns betydligt mer att spara på att göra din front-end kod så optimerad som möjligt. Runt 80% av laddningstiden på en sida sker på front-end:en. Kika på ySlow till Firebug och/eller Yahoos regler för en snabbare webbsida om du är inne på optimering.
Saturday, October 04, 2008 | View all comments by Andreas
@Jim,
I've had this problem in both Safari and Chrome. Which browser are you using?
The live-search-results div is appended to the body-element so no other element's styling should affect it.
If you do style the body-element using margin, padding, width or height it may also screw up the positioning.
This, however, is a problem with Dimensions (or jQuery if you're using the latest version because Dimensions is included in jQuery now).
Thursday, September 18, 2008 | View all comments by Andreas
The reason is IE6 doesn't understand position: fixed. If you use position: absolute; instead, or the margin: 20px auto;-trick it should work in IE6 as well.
Thursday, September 18, 2008 | View all comments by Andreas
Hmmm that's really odd that it doesn't center. I have no idea why. I tried setting body and html's height and width to 100% but nothing.
Regardless, I think in this case using the center-plug-in is not necessary. Since you know both the width and height of your #wrp-element you could simply do what the plug-in does manually:
#wrp {
background: #666;
color: #FFF;
width: 920px;
height: 450px;
padding: 20px;
/* Horizontal and vertical centering */
position: fixed;
left: 50%;
top: 50%;
margin: -225px 0 0 -460px; /* left = width/2, top = height/2 */
/* Horizontal centering */
/* margin: 0 auto; */
}
Use either horizontal and vertical or just horizontal (not both).
Friday, September 12, 2008 | View all comments by Andreas
If you look at the screenshot in the article you'll see that I actually did use a "ghost"-element at first.
The problem with this was that I added the ghost-element when the droppable reacted to a draggable, but if you then dropped the draggable (released the mouse) it would no longer be on top of the droppable but on top of the ghost-element.
I couldn't find a good way to solve it so I just removed the ghost-element.
Edit: I've thought about a solution though and I might re-add the ghost. I reckon it really helps the user understand what will happen when he drops the module.
Friday, September 12, 2008 | View all comments by Andreas
@til - Thanks for great feedback.
If you've switched off JS you'll have noticed that what you can actually do is either add a module to another module or insert a module before another module.
I tried to replicate this behaviour in JS as well. If you drag a module on-top of another starting from the top it will be inserted before that module.
If you start from the bottom it will be added to the module.
In both cases the same module is the droppable but I check where the draggable is positioned to know whether I should add or insert before.
But because the same module is always the droppable I can only style that module. That's why, on add, there's a border around and on insert before there's a border on top.
I should really work on calculating the position on every mouse-move - now it only occurs onmouseover of the droppable. So if you start from the top but drag it inside afterwords it will unfortunately not change from insert before to add.
Hope that made a little sense at least..
Love your site btw, left a comment :)
Monday, September 08, 2008 | View all comments by Andreas
@Francisco - I think you'll have to modify the actual plug-in code to accomplish that.
The way you do it now it will apply 2 keyup-events to the input. One on the first liveSearch-call, and another one depending on the checkbox.
Also, if someone clicks the checkbox even more events will be added.
What I think you need to do is check whether the checkbox is checked on the one keyup-event.
If you try modifying this code found on line 45:
input.keyup(function() {if(this.value != this.lastValue) {
Into something like this:
input.keyup(function() {config.ajaxURL = $('#reduced').attr('checked') === true ? 'Search1?Words=' : 'Search2?Words=';
if(this.value != this.lastValue) {
Unfortunately this means you'll have to modify the actual plug-in-code but atm there's no support for different URLs so I think this is how you'll have to do it.
You could pass the 2 different URLs to the plug-in as an additional parameter as well to avoid hard-coding the URLs.
Edit: And then you just call it one: $('#Words').liveSearch({ajaxURL: 'doesntmatter cus its hard-coded in the plug-in now...'});
Friday, September 05, 2008 | View all comments by Andreas
Sounds like a character encoding issue. You shouldn't have to convert all the characters back and forth as long as you stick to UTF-8 for everything.
If that's not possible then there are plenty of string-handling functions for both JS and PHP (replace, pregreplace, strreplace, etc) that should make it easy to do what you want.
Wednesday, September 03, 2008 | View all comments by Andreas
I assume you mean John Oxton's flower-design as that is exscale's default atm.
If you check the footer or my styles-page you'll notice that I give the proper credits.
John released the flower-design as a WP-template quite some time ago.
Tuesday, August 26, 2008 | View all comments by Andreas
That's because the center-plugin uses position: fixed to center the element.
Setting the position-property to fixed is just like setting the background-position-property to fixed. The image or element will always stay exactly in the same place regardless if you scroll.
If you change 'fixed' to 'absolute' in the code this shouldn't happen.
Wednesday, June 25, 2008 | View all comments by Andreas
Hence:
Woopsy
Seems curl_init isn't available from my host (bummer). The example should still work for you locally though,and hopefully live as well (unless you suffer from the same limitations).
Monday, June 09, 2008 | View all comments by Andreas
The search-results div is appended to the body-element. If you want to append it to your #wrapper-div change the line that says appendTo(document.body) to appendTo('#wrapper').
Weird that the position: absolute makes your page misbehave. It really shouldn't affect anything else on your page simply because it is positioned absolutely.
Sunday, June 01, 2008 | View all comments by Andreas
Thanks :) Since the live-search fires onkeyup of the input you've applied it to you should be able to do an empty search on page-load by firing a keyup-event on the same input:
$(function() {$('#q').liveSearch();
$('#q').keyup(); // should fire a live-search for nothing
});
Sunday, May 18, 2008 | View all comments by Andreas
När man rapporterar buggar är det bra om man nämner vilken browser/OS det gäller.
Jag antar att du kör IE6 för det är enbart i den uråldriga webbläsaren som :hover inte fungerar på annat än a-elemenet.
Det nämner jag även i artikeln.
Tuesday, May 13, 2008 | View all comments by Andreas
I've read that calc() is in the works. I'm not sure why we'd need a typical programming-language-syntax for it. xxxUT -/+/*// xxxUT (like 100% - 4px) would work just fine wouldn't it?
I've clarified the "backwards selector" with why can't we select parent element with css? btw.
Sunday, April 27, 2008 | View all comments by Ante
Hehe nice, now it's even more annoying! =)
Thursday, April 24, 2008 | View all comments by Andreas
Hehe ok cheers for that.
Ref?
Wednesday, April 23, 2008 | View all comments by Ante
Hehe
Wednesday, April 23, 2008 | View all comments by Andreas
I've used the following snippet to close things when you click outside of the thing:
// when user clicks anywhere on the page$(document.body).click(function(event) {
// and (s)he didn't click a #colour-picker element
if(!$(event.target).parents('#colour-picker').length) {
// hide the colour-picker
$('#colour-picker').hide(500);
}
});
Place that in the same file as the colour-picker code but not in the function.
Monday, April 21, 2008 | View all comments by Ante
Nej. Det finns inget sätt att ta denna CSS och applicera på en tabell iom att en tabell inte innehåller samma HTML som denna CSS stylar.
Använd istället HTMLen som jag föreslår ovan. Är det verkligen tabulär data du märker upp så ska du självklart använda en tabell men då måste du styla på ett annat sätt (då en tabell består av table, tr, td och th-element och inte div och h2).
Wednesday, April 09, 2008 | View all comments by Ante
Cool, one difference is that every description will get a number now, not just when there's more than one definition of a term. Which really is what should happen (If you check like official definition-sites (there's no point in numbering them if there's just one)).
Saturday, April 05, 2008 | View all comments by Ante
Hmm.. nu verkar det ha blivit något fel.. verkar som att det inte går att kommentera skandinaviska tecken ordentligt med JS av... ledsen för det!
Friday, April 04, 2008 | View all comments by Andreas
The code-block above contains an example of how to submit the form in the #contact-element (div presumably) and update the same div with whatever the response is.
Whatever the URL the form is pointing to returns (action="send_email.php" for example) will be put into the #contact-element.
So it really helps to have some sort of modular design on your website.
Each module on my site can be individually accessed through /ajax/ModuleName/ so I'd submit the ajax-call to /ajax/Contact/ and that would only return the contact-module (not the entire contact-page).
It may be hard to get your head around at first but perhaps you should read a little more about Ajax and modularity?
Edit: Here's an example where I use it together with my live validation plug-in. The only thing returned from the contact form-submission is the contents of either Contact.tpl.php or MsgSent.tpl.php in the same directory.
Hope that makes sense.
Saturday, March 29, 2008 | View all comments by Andreas
@Dirk - Before compressing your JS you should run it through JSLint. JSLint checks for missing semicolons and such.
Also, all my JSCompressor does is fetch all the code in a directory, Dean Edwards JS-packer takes care of the rest.
Cheers for the comments.
Thursday, March 20, 2008 | View all comments by Andreas
Yea cheers, I know the one I had was bad but you're actually meant to put the ones you want in there yourself.
Monday, March 17, 2008 | View all comments by Andreas
It's possible with CSS and explained at W3.org, but I think the real question is; why should user-agents that don't support CSS not get the same information as those that do?
If you turn off CSS you should still know that, for example, you are viewing article 10 and not 2 (as it would've been without the start-attribute in my recent articles).
Also, to be able to start the counter at different numbers from page to page you would require a class in the <ol> so you don't even get rid of any unnecessary attributes.
Tuesday, March 11, 2008 | View all comments by Ante
Hehe, I think all the comments on my jQuery-plugin-articles are about how they don't work on IE.
Here's the reason: IE sucks. Please switch browser and try again.
Seriously though, I'm gonna look in to fixing most of them. Feel free to check the code yourself. You may be able to spot the bug easily. I just haven't tried as it works in real browsers.
Sunday, March 09, 2008 | View all comments by Andreas
Sure, simply change this line:
$('a[href^="http://"]').each(function() {Into something like:
$('a.external-link').each(function() {And it will only affect links with that particular class. You can use any CSS3-selector you want in fact.
Thursday, March 06, 2008 | View all comments by Andreas
Yea it can really help bring your code to a minimum without worrying about cross-browser issues.
Cheers for the inspiration and the comment.
Friday, February 29, 2008 | View all comments by AL
I realize it must be annoying it doesn't work in IE6/7 and I will look in to it as soon as I get some spare time.
In a month or so there should be updates on all my plug-ins. Check back every now and then or keep an eye on the jQuery plug-ins page.
Thursday, February 28, 2008 | View all comments by Andreas
I just realized that almost every link added with JS to do stuff points to '#'. So I may have to change either my top-links or all my JS-links...
Wednesday, February 27, 2008 | View all comments by Andreas
Yea I know, I'm pretty sure it has to do with how IE handles bubbling events. Opera suffers from the same problem. I'll try to fix it if I get some spare time.
Friday, February 22, 2008 | View all comments by Ante
Sorry you didn't like the current style, but like I mentioned in the comment above I'll be adding more styles shortly.
Thursday, February 21, 2008 | View all comments by Andreas
I've already received a couple of requests, and come up with some of my own, here's what you can expect in future releases:
Monday, February 04, 2008 | View all comments by Andreas
Everything you need to get going is included in the zip. You need PHP installed to try it out.
If you don't have PHP installed locally you can easily install MAMP (for Mac) or WAMP (for Windows) (there's probably a LAMP as well should you be running Linux), or you can try it on your live server by just uploading the contents of the zip to a directory on your server and visit the url /dir/demo.php
I'm very busy at the moment but will look into creating example-pages for all my plug-ins in the future.
Wednesday, January 23, 2008 | View all comments by Andreas
Yes perhaps xpath-support in CSS would be nice, although I haven't worked much with xpath so can't really say much.
Just selector::parent(selector) (the way jQuery implements it) would make my day.
Wednesday, January 23, 2008 | View all comments by Andreas
I use the imgbox plug-in throughout my site. You can check my random images or click any link that points to an image (like in the 3d-archives).
Friday, January 18, 2008 | View all comments by Andreas
Sure, np.
The constant-parser will simply replace your constant definitions ($constant {, $constant h2 { etc) with the selectors you've applied the constant to (#selector = $constant).
This means that the styling of the #selector will not take place where the constant declaration is (#selector = $constant) but where the constant definition is.
Shouldn't really matter though. Just plan the specificity of your selectors beforehand and it shouldn't be a problem to override constant-stylings should you want to.
Friday, January 18, 2008 | View all comments by Andreas
Yea I know. I noticed that myself but the fix was rather complex so I couldn't be bothered.
No browser (I've tried) chokes on the invalid CSS so shouldn't cause rendering-issues. If you really don't want invalid CSS, don't define constants you don't use :)
Thursday, January 17, 2008 | View all comments by Ante
Hehe fook yea! Soon we'll be manipulating Angelina Jolie's tits using our Wii remotes! Brilliant.
Thursday, January 17, 2008 | View all comments by Andreas
Sure go ahead, I'm just glad if people use it.
I "released" it now under a GNU General Public License (v3) knowing nothing about it basically but just so it's done.
Thursday, January 17, 2008 | View all comments by Ante
Working example up.
Wednesday, January 16, 2008 | View all comments by Andreas
Hm.. that's odd. Haven't got a clue why that happens I'm afraid. Works fine for me (just tested it again).
The error seems to occur in the compress-method's preg_replace-call. That's the preg_replace that strips out comments. Should definitely work??
Is your CSS-file empty or something?
Wednesday, January 16, 2008 | View all comments by Andreas
Well all you need to do is, instead of including you normal css-file(s), include the file containing the code in the second PHP code-block in the article (the one that echo:es the packed code).
Place those two files wherever you want (CSSCompressor.php and the one containing the instantiation of a CSSCompressor class) and then specify your CSS-directory in the CSSCompressor constructor (new CSSCompressor('my-css-dir/')).
That's it.
You can use the mod_rewrite above if you still want it to look like you're including a pure CSS-file, and also have the ability to use a style-switcher.
You could also put the instantiation of the CSSCompressor class in the same file as the declaration of the same class. This way you'll only need one file.
If you want to do it all in one file, place the code from the second PHP code-block below the code in the first PHP code-block and then visit CSSCompressor.php and see what happens. If you get nothing then the directory probably doesn't exist or the path to it is wrong. Can be a good thing to always include $SERVER['DOCUMENTROOT'] when opening files instead of relying on relative paths.
Wednesday, January 16, 2008 | View all comments by Andreas
Absolutely, use it as much as you like. I should probably release it under some license tho...
If you, like me, have a style-switcher and all your styles are in something like /css/A_STYLE/ you can use this MOD_REWRITE rule to merge and compress all the files in a style-dir:
Obviously you'll have to check if $_GET['dir'] is set and, if so, use that in the constructor of the CSSCompressor.
And then link in the style with <link href="/css/A_STYLE/all.css" /> (don't leave out the mandatory attributes like I did for simplicity now =)
Also remember not to have a real all.css in any of your style-directories.
Thursday, January 03, 2008 | View all comments by Andreas
Thanks for catching that bug, and providing a fix. I'll fix my version as soon as I got time enough to care about IE.
Friday, December 21, 2007 | View all comments by Andreas
Nice, I couldn't find any information about this bug at all when I wrote this. I've run into it a couple of times since tho, but just gone _pagging-top: half;
Thursday, December 20, 2007 | View all comments by Andreas
I agree. But judging from the speed of the IE-development team to bring in even CSS2 support my guess is IE will (as usual) be about 10 years after the rest of them once this spec is finalized.
Tuesday, December 18, 2007 | View all comments by Andreas
Hence "As center() uses position: fixed; to center elements there is no IE6 support."
Personally I couldn't care less about IE6. It's an outdated, unsafe and extremely crappy browser.
But, if you check the source of jquery.center.js you'll notice a piece of code that's in a comment-block and above it it says "Use this code if you care about IE6". So do that if you do that.
Tuesday, December 18, 2007 | View all comments by Andreas
Check out jquery.com's tutorial section. You can learn loads there.
To do what you want (if I understand you correctly), you'd do something like this:
$('body').fadeOut(500, function() {$(this).html(newContent).fadeIn(500);
});
Where newContent is a variable containing the new HTML.
Sunday, November 11, 2007 | View all comments by Andreas
Hehe, sorry bout that mate, didn't mean to nick it from you.
Your's wasn't jQuery tho was it?
Also, when are you gonna start feelin better? Got bad pool-cravings geez!
Thursday, November 01, 2007 | View all comments by Andreas
Hehe, cheers mate. Yea I think I may release it soon... just have to finish some of the more critical bugs/enhancements first.
Monday, October 01, 2007 | View all comments by Andreas
You could quite easily modify my code to append the list to any element.
Perhaps an optional argument to the function that takes a CSS-selector and appends the list to the matched element would be a good idea?
I've planned to re-write some of my jQuery-plugins (including this one) and I will fix stuff like this then.
In the mean time you could just change my code so that instead of it appending the list to the parent-element of the tab-content just append it to anywhere.
This is the code that needs to be changed: t.find('> div').eq(0).before(list);
Also remember to change the tabStruct argument to tabs() respectively so that it matches where your list is.
Tuesday, July 17, 2007 | View all comments by Andreas
Sure, let me know how it works out.
Monday, July 16, 2007 | View all comments by Andreas
Ok, that makes sense.
Well i guess all you really need to do is add another onclick-event to the links in the tabs, and in that onclick create/update a cookie that stores which tab was clicked (you need to work out in what position the clicked tab was tho as AutoTabs (and Tabs()) take a number as its first argument.
And then, upon firing the AutoTabs()-function, check if a cookie is set, if it is, use the cookie's value for which tab should be selected, if not simply go with the first one.
I don't think you should try to put all this functionality in the AutoTabs()-call.
Perhaps something like this:
$(document).ready(function()
{
// Fire AutoTabs
var foo = 1;
if($.cookie('current_tab')) foo = $.cookie('current_tab');
$('#sub-content').AutoTabs(foo);
// Add additional onclick to tabs that stores cookie
$('#sub-content > ul:first-child a').click(function()
{
// Calculate what number this tab is and store in cookie
});
});
Looking at your code again i realize we do pretty much the same thing only i moved the cookie-storing onclick to its own block.
Not sure if that will work tho.
Monday, July 16, 2007 | View all comments by Andreas
Hmm.. not sure what you're trying to do there. Perhaps if you explained more clearly exactly what you want to accomplish i could be of more help.
Friday, July 13, 2007 | View all comments by Ante
Sorry dude, ingen aning. Men du borde väl få några tusen träffar på en "PHP/MySQL Counter"-Googling?
Thursday, July 12, 2007 | View all comments by Ante
Tjena, jag tror faktiskt jag har lagt ner det där scriptet. Finns så otroligt mycket bättre statistik-program där ute.
Personligen kör jag med Google Analytics vilket är gratis och fruktansvärt bra.
Wednesday, July 11, 2007 | View all comments by Ante
har du byggt bloggen själv borde du inte ha några problem med att bygga kommentarsfunktionalitet själv.
Har du inte byggt den själv så föreslår jag att du laddar hem en blogg som redan har stöd för kommentarer. Tex Wordpres
Sunday, June 24, 2007 | View all comments by Andreas
Hey,
There are two links in the article, one pointing to the official tabs-plugin-homepage and one pointing to an example-page showing my extended plugin.
I don't really have time to code what you're asking for, play around a bit, i'm sure youäll solve it.
Wednesday, June 13, 2007 | View all comments by Ante
Doesn't work in any IE version as far as i know. But i'm all for using the latest techniques and letting people who choose to use a crappy browser have a crappier experience.
If more people did that less people would be using IE.
Monday, June 11, 2007 | View all comments by Ante
Fook that's sweeeeet, downloading it now!
Sunday, June 10, 2007 | View all comments by Ante
Absolut, negativa marginaler kan vara riktigt användbart ibland.
Fan vad trött jag är på att ÅÄÖ fuckas upp i alla ajax-anrop... Ska fixa det dock, direkt jag får lite tid över.
Sunday, June 10, 2007 | View all comments by Ante
Hehe, jag vet. Men jag struntade i det.
Wednesday, June 06, 2007 | View all comments by Andreas
It shouldn't be a problem to create connected select-boxes that span over several tabs, since all tab-content is always present in the DOM.
If that is what you wanted to do...
I'm not sure which updated tab plug-in you mean though.
Monday, May 14, 2007 | View all comments by Ante
Hm.. heh, det har du rätt i.
Skulle tro att det bara är: id | pub_date | author | email | website (att döma av insert-satsen).
Thursday, May 10, 2007 | View all comments by Andreas
Jag har tyvärr ingen aning hur Plogger är gjort, men i de allra flesta fall används något liknande index-include eller head/foot system.
Det du får göra är att ta koden från din sidas head/foot och placera i Ploggers head/foot, samt importera alla stylesheets.
Då kommer Ploggers huvud och fot se likadan ut som resten av sidan.
Du kan däremot inte inkludera den direkt i content-diven. Plogger har förmodligen sin egen <html><head>etc så det skulle bli galet. Och förmodligen skulle mkt annat gå fel också.
Men leta efter en head/header.php samt foot/footer.php och prova lek lite i dem.
Monday, May 07, 2007 | View all comments by Ante
Heheh, tjeena dansk!
Hygge mig??
Thursday, April 26, 2007 | View all comments by Ante
Tja.. det diffar ju lite från fall till fall.
Men det enda det handlar om är att ha en tabell där du lagrar ratings, typ:
ratings-id | rating | num-ratings
Sedan räknar du ut en ny rating mha num_ratings och rating.
Kolla på PHPSidan så lär någon kunna hjälpa dig med det.
Monday, March 19, 2007 | View all comments by Andreas
Håller helt och hållet med, och om du kollat koden på den här sida så ser du att jag gör så här.
Men för enkelhetens skull, och för att inte "confusa" nybörjare så körde jag med en selected-klass i exemplet.
Friday, March 16, 2007 | View all comments by Andreas
Tack! Kul att höra.
Sunday, March 11, 2007 | View all comments by Andreas
Heh, thank you.
Saturday, March 10, 2007 | View all comments by Andreas
You should be able to simulate frames using the tabs-plug-in as you can specify the tabStruct option to anything you want.
With my version it may be a little more difficult though, as my list is automatically positioned in the same container as the tab-content, and immediately before the first tab-content.
Thursday, October 19, 2006 | View all comments by Ante
Hehe fan vad bra
Saturday, October 14, 2006 | View all comments by Andreas
Det är meningen att jag ska ta upp det i del 3. Om jag nu orkar skriva den nån gång.Men i func.php ligger diverse bra funktioner som tex tar hand om att snygga till text m.m.
Saturday, March 04, 2006 | View all comments by Ante
Hehe, cheers m8
Saturday, March 04, 2006 | View all comments by Andreas
Tack :)
Saturday, March 04, 2006 | View all comments by Andreas
No "blog", i programmed this site myself
Saturday, October 01, 2005 | View all comments by Ante
Aha, vad kul att nagan anvander den iaf.
Hehe, tja Boouuddieeee!!! Jag maste ha missat ditt forra gastlagg!
Jag ar ju i Valencia, kollar inte internet sadar jatteofta.
Kom hit fan, men du ar val pank som vanligt¿?? hehe
Jaja, ska glidex, ar lite bakis.
Hor av dig normalt, alltsa: MEJL!
Tja
Thursday, September 15, 2005 | View all comments by Ante
Thank you, but which one do you mean? The one on phpsidan.nu or.. ?
Thursday, September 08, 2005 | View all comments by Ante
Hehehe ok.
Wednesday, July 27, 2005 | View all comments by Ante
Ah ok, jag använder Lightwave 3D
http://www.newtek.com/lightwave/index.php
Monday, July 11, 2005 | View all comments by Ante
hehe
Sunday, July 10, 2005 | View all comments by Ante
Tja,
Tackar för berömmet, nej det är inte Virtuell design... vad är det?
Sunday, April 10, 2005 | View all comments by Ante
jepp
Sunday, March 20, 2005 | View all comments by ante
ja fan, det lät ju som en bra idé
Thursday, March 17, 2005 | View all comments by ante
vem är det?