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.
 
  • Locked thread
I R SMART LIKE ROCK
Mar 10, 2003

I just want a hug.

Fun Shoe
Alright I'm at a brick wall, basically I've been fiddling around with making a simple menu system.

http://jsfiddle.net/IRSMARTLIKEROCK/xkXQD/12/

But in IE, when you go to a shorter article content, it doesn't redraw the wrapper element. All the other browsers are fine.

I made a temporary fix of:
http://jsfiddle.net/IRSMARTLIKEROCK/xkXQD/13/

Is there any way to avoid the initial problem?

Adbot
ADBOT LOVES YOU

Dromio
Oct 16, 2002
Sleeper
I've got one script that injects an element into the page in document.ready():

code:
  $(function(){
    $("#videoPlayerWrapper").append(
      $("<div id='player' style='display:block'></div>")
    );
  })
Now I need to have a whole new script that appends something inside THAT (#player) element, but I can't do it in document.ready because the player doesn't exist yet. Is this even possible? $("#player").load() didn't seem to do anything for me.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Dromio posted:

I've got one script that injects an element into the page in document.ready():

code:
  $(function(){
    $("#videoPlayerWrapper").append(
      $("<div id='player' style='display:block'></div>")
    );
  })
Now I need to have a whole new script that appends something inside THAT (#player) element, but I can't do it in document.ready because the player doesn't exist yet. Is this even possible? $("#player").load() didn't seem to do anything for me.

code:
  jQuery(function(){
    var playerDiv = jQuery("<div id='player' style='display:block'></div>");
    jQuery("#videoPlayerWrapper").append(playerDiv);
    playerDiv.append( .... ); // if you can do it here
  })
or

code:
  var MyThing = {
    init: function () {
      MyThing.playerEl.append( ... );
    }
  }
  jQuery(function(){
    MyThing.playerEl = jQuery("<div id='player' style='display:block'></div>");
    jQuery("#videoPlayerWrapper").append(MyThing.playerEl);
    MyThing.init(); // or do this later, or whenever
  })

Lumpy fucked around with this message at 22:16 on Nov 24, 2010

Dromio
Oct 16, 2002
Sleeper
I follow what you did in the first example, but I need for the second script to be completely separate from the first. I need to add an element into the player from a completely new .js file, loaded independently from the one that created the player element in the first place.

So now I have loadplayer.js :

code:
var player;
$(function(){
  player = $("<div id='player' style='display:block'></div>");
  $("#videoPlayerWrapper").append(player);
});
And I need another script addcaption.js :
code:
$(function(){
  //How do I wait for player to actually exist
  var captionElement = $("<div id='captions'></div>");
  player.append(captionElement);
});
I'm a bit shaky on the second example you gave.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Dromio posted:

I follow what you did in the first example, but I need for the second script to be completely separate from the first. I need to add an element into the player from a completely new .js file, loaded independently from the one that created the player element in the first place.

So now I have loadplayer.js :

code:
var player;
$(function(){
  player = $("<div id='player' style='display:block'></div>");
  $("#videoPlayerWrapper").append(player);
});
And I need another script addcaption.js :
code:
$(function(){
  //How do I wait for player to actually exist
  var captionElement = $("<div id='captions'></div>");
  player.append(captionElement);
});
I'm a bit shaky on the second example you gave.

Why does addcaption.js need to run instantly on page load? Create an object that you instantiate on page load, but don't call the function / method that adds the caption to the player DIV until you actually create and put said DIV into the DOM:

code:
//// addcaption.js

// This creates a global object called 'CapAdder'
// but doesn't actually try to *do* anything yet... so it's
// ok if that player DIV doesn't exist!
var CapAdder = {  
  capDiv: '<div id="captions" />',
  addCapToEl: function (el) {
   el.append( CapAdder.capDiv );
  }
};

///// loadplayer.js
jQuery(function () {
  player = jQuery("<div id='player' style='display:block'></div>");
  jQuery("#videoPlayerWrapper").append(player);
  // we now know that 'player' exists and is in the DOM...
  CapAdder.addCapToEl(player); //use our cap adder to append
  // and all is well
});
EDIT
if loadplayer.js can't "know" about any other files or something, you could rig up a cheesy timer:

code:
//// addcaption.js
jQuery(function () {
  function addCaption() {
    var playerDiv = jQuery('#player');
    if (playerDiv.length === 1) {
      // if #player exists, do stuff!
      playerDiv.append('<div id="caption" />');
    } else {
      // if #player does not exist, try again in 500ms
      window.setTimeout(addCaption, 500);
    }
  }
  addCaption();
});



///// loadplayer.js
jQuery(function () {
  jQuery("#videoPlayerWrapper").append(<div id='player' style='display:block'></div>");
  // DIVs are already blocks.. why did we add an inline style?? =)
});

Lumpy fucked around with this message at 17:12 on Nov 26, 2010

Dromio
Oct 16, 2002
Sleeper
Yeah, I'd rather loadplayer.js have no knowledge of addcaption.js at all. We're going to be adding more things to the player, and I'd really like to be able to have them all separated like this where I can simply add a new .js file to the page to have the extra functionality added. Cheesy timer kind of sucks, but I don't have a lot of other options, do I?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Dromio posted:

Yeah, I'd rather loadplayer.js have no knowledge of addcaption.js at all. We're going to be adding more things to the player, and I'd really like to be able to have them all separated like this where I can simply add a new .js file to the page to have the extra functionality added. Cheesy timer kind of sucks, but I don't have a lot of other options, do I?

Write a real Player class with a documented API and program to it? :)

Dromio
Oct 16, 2002
Sleeper

Lumpy posted:

Write a real Player class with a documented API and program to it? :)

This doesn't sound SO bad really. I'd make a Player class with an init method that does the injection. Then in document.ready() I'd call that init method.

Then I just need some way to add methods to be called after the init() from the outside. So by captions.js would just add it's init method after the player's. Unfortunately, my javascript isn't strong enough to know exactly how to do that part. How would I add a method to a list like that?

Dromio
Oct 16, 2002
Sleeper
I'm falling out of the realm of jQuery and into just javascript, but I wanted to continue the discussion here.

Here's what I've hacked up so far:

In player.js
code:
var player;
player = $("<div id='player' style='display:block'></div>");
//Method that is called after player is added to the document
player.init = function () {
    for (var callback in player.initCalls) {
        player.initCalls[callback]();
    }
}

//Method to allow outside addons to perform actions after player is initialized
player.initCalls = new Array();
player.addInitCallBack = function (callback) {
    player.initCalls.push(callback);
};

//Inject the player into the document when ready
$(function(){
    $("#videoPlayerWrapper").append(player); //Add our player
    //A lot of extra crap here.
    player.init();
});
Then in my caption.js it's simple:
code:
player.addInitCallBack(function () {
  var captionElement = $("<div id='captions'></div>");
  player.append(captionElement);
}
Now my player doesn't need to know about any outside scripts, but they can be called after it's been injected properly. And no nasty timers.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Dromio posted:

I'm falling out of the realm of jQuery and into just javascript, but I wanted to continue the discussion here.

Here's what I've hacked up so far:

In player.js
code:
var player;
player = $("<div id='player' style='display:block'></div>");
//Method that is called after player is added to the document
player.init = function () {
    for (var callback in player.initCalls) {
        player.initCalls[callback]();
    }
}

//Method to allow outside addons to perform actions after player is initialized
player.initCalls = new Array();
player.addInitCallBack = function (callback) {
    player.initCalls.push(callback);
};

//Inject the player into the document when ready
$(function(){
    $("#videoPlayerWrapper").append(player); //Add our player
    //A lot of extra crap here.
    player.init();
});
Then in my caption.js it's simple:
code:
player.addInitCallBack(function () {
  var captionElement = $("<div id='captions'></div>");
  player.append(captionElement);
}
Now my player doesn't need to know about any outside scripts, but they can be called after it's been injected properly. And no nasty timers.

What happens when somebody includes caption.js before player.js ??

Dromio
Oct 16, 2002
Sleeper

Lumpy posted:

What happens when somebody includes caption.js before player.js ??

It won't work then. I don't have a good answer for that.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Dromio posted:

It won't work then. I don't have a good answer for that.

And thus the " make an API for a player class / object" I'll post some ramblings on it tomorrow when I am somewhat awake.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice
OK, so long winded reply ahoy! I'm not saying this *is* the way to do it, but I'm just banging out something to think about while i have my coffee. Don't think of "the player" as the DIV that the player sits in. Think of the player as an abstract thing, and it has a view that happens to be a DIV. We can then "do stuff" with our player, even if no DIV exists yet, and check for the view existing when we need to reference it.

So let's make a SupaPlaya object that has an init method, and a displayCaptions method, and we shall see how we can make it so we can call the captioning stuff first in case things are "out of order" and not break anything.

code:
var SupaPlaya = (function () {
  var view = false, // we don't have a view yet since the DOM might not exist yet
      // returns our view
      getView = function () {
        if (!view) {
          // if our view does not exist, make it and put it in the DOM
          view = jQuery('<div id="playerDiv" />');
          jQuery('#playerWrapper').append(view);
        }
        return view;
      }; // EDIT: fixed typo! 
  return {

    init: function () {
      getView();
    },
    displayCaptions: function () {
      var view = getView();  // hey look!
      view.append('<div id="captionBlock" />');
    }
  }
}());
So now we have a SupaPlaya that exists as soon as the script loads. If I call SupaPlaya.init() first, that does a getVew() which makes our plyer DIV, stores a reference to it, and puts it in the DOM for us. If somebody later adds in a script file "out of order" and calls SupaPlaya.displayCaptions() before we ran our init, that's OK, because that method gets a reference to the view by calling getView() as well, which will create and add the view to the DOM if it's not there. It also protects us from accidental multiple calls to init(), since we won't do anything if we've already got a view.

Again, this is not "the" way to do it. Just a way of doing it to show how you could create a class for your player. This is good for a couple reasons: your player code is one place, so you don't have to try and figure out wtf functionality is in what file, and you have a consistent way of doing things that you can share with others, instead of saying "hey, there's a DIV with this ID, do poo poo to it!!!" you can say "To display captions, use SupaPlaya.displayCaptions(). To make the player flurf, use SupaPlaya.flurf()" and so on.

Lumpy fucked around with this message at 20:32 on Nov 30, 2010

Haystack
Jan 23, 2005





Wow. I've never seen an object generated that way, but it looks something I want to start using in my own code.

If I'm parsing your SupaPlaya correctly, view and getView are essentially private properties bound by a self-executing closure to a returned object that contains the "public" methods init and displayCaptions. That's totally rad. Did you come up with that yourself, or is that technique documented somewhere? I'd love to read more about it, either way.

Also, what is the purpose of the commas trailing the
code:
var view = false,
and
code:
getView = function () {
    ...
},
expressions?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Haystack posted:

Wow. I've never seen an object generated that way, but it looks something I want to start using in my own code.

If I'm parsing your SupaPlaya correctly, view and getView are essentially private properties bound by a self-executing closure to a returned object that contains the "public" methods init and displayCaptions. That's totally rad. Did you come up with that yourself, or is that technique documented somewhere? I'd love to read more about it, either way.

Also, what is the purpose of the commas trailing the
code:
var view = false,
and
code:
getView = function () {
    ...
},
expressions?

That was stolen from the Man himself, Crockford. :D

Hah, the one after getView() is a typo... that should be a semi-colon. The one after 'view' is there because....
code:
// instead of:
var a;
var b = 'pie';
var c = 10;
// you can use a single var statement and comma separate
var a, b = 'pie', c = 10;
// (and you can line break on the commas for formatting...)
var a,
    b = 'pie',
    c = 10;
And I do that these days because I run all my js through http://www.jslint.com/ with "the good parts" toggled on, and it only allows one var statement per function.

geeves
Sep 16, 2004

Lumpy posted:

And I do that these days because I run all my js through http://www.jslint.com/ with "the good parts" toggled on, and it only allows one var statement per function.

I always did one var per line for readability and avoided comma delimited var - what's the advantage to this. Is it simply a speed thing?

Also: "Disallow ++ and --"? Why does Herr Crockford suggest this? - Is

code:
for (variable in object) {}
faster?

It's not covered here: http://javascript.crockford.com/code.html

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

geeves posted:

I always did one var per line for readability and avoided comma delimited var - what's the advantage to this. Is it simply a speed thing?

I guess as a reminder that JS does variable hoisting, and you should declare them all together at once.

geeves posted:

Also: "Disallow ++ and --"? Why does Herr Crockford suggest this? - Is

code:
for (variable in object) {}
faster?

It's not covered here: http://javascript.crockford.com/code.html

No, he wants i = i + 1 ( or i+= 1 ) instead of using the auto increment operator. Mainly for readability / clarity. At the 1:09 mark in this: http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-5 he talks about it.

Lumpy fucked around with this message at 06:54 on Dec 1, 2010

POKEMAN SAM
Jul 8, 2004
Can anyone suggest a super simple treeview example for jQuery? It'll be embedded in an HTML file generated by a tool, along with jQuery minified inline. The data is all static, I just want to be able to expand/collapse branches, and possibly provide an Expand All button. The examples I've found online are all super complicated with fancy art and 18 Javascript files, etc.

butt dickus
Jul 7, 2007

top ten juiced up coaches
and the top ten juiced up players
I'm using jsTree. It's all documented, but it takes a bit to figure it out. If your HTML is just nested lists, it's pretty easy to turn it into a tree.

POKEMAN SAM
Jul 8, 2004

Doctor rear end in a top hat posted:

I'm using jsTree. It's all documented, but it takes a bit to figure it out. If your HTML is just nested lists, it's pretty easy to turn it into a tree.

Awesome, I can make the HTML look like whatever I want, so this looks like it might work well since it's one file that I can easily cram between some script tags. The themes are also small so I can inline them (including the art).

Should work out well, thanks!

Boosh!
Apr 12, 2002
Oven Wrangler
Here's a third party jQuery custom app that's basically a juiced up slideshow: http://www.lonnymag.com/issues/10-october-november/pages/1#p111

Is there a package floating around that providers similar functionality? We're setting up a meeting with the devs who built this but it might be out of our price range.

Another related question: Is there an iPad friendly best practice for converting PDFs? For the web, we've used FlashPaper for ages but yea, no Flash for iPad.

Basically, I need a iPad-friendly method of posting PDFs and the link above is the best I can find so far.

UPDATE for those that care: ScribD has a HTML5 pub coming out soon.

Boosh! fucked around with this message at 16:17 on Dec 3, 2010

_areaman
Oct 28, 2009

I made this jQuery plugin:

http://plugins.jquery.com/project/digirain

I already have good advice for 1.1, but what do you guys think?

POKEMAN SAM
Jul 8, 2004

_areaman posted:

I made this jQuery plugin:

http://plugins.jquery.com/project/digirain

I already have good advice for 1.1, but what do you guys think?

Looks cool, but you should get it actually rendering mirrored Katakana ;)

DankTamagachi
Jan 20, 2005
Tamagachi to your throat!
I have been working hard recently to create a new personal webpage for myself. I've done a lot with JQuery, especially the BBQ plugin (for awesome hashchanging AJAX+back button functionality). However, in my attempt to get everything working, I'm afraid it is a little hackish these days. I've also attempted to make sure the site stays relatively functional without JavaScript enabled.

Anyways, I was hoping you geniuses could take a look at my site and give me some recommendations/best practices to do things differently if I'm doing something rear end backwards. I'm relatively proficient in Javascript, CSS, PHP, and all that jazz, but I'm mainly self-taught, so there are some things I only know how to do "my way."

Thanks! Let me know what you think!

http://www.davenadel.com

edit: some things I'm wondering about : whether my decision to dynamically load the scripts I need for each page is correct (i.e. to enable the tabs on the resume page and the like), as well as whether I should cache what URLs map to my hash values, and anything else you may find!

DankTamagachi fucked around with this message at 23:38 on Dec 13, 2010

Mrs. Wynand
Nov 23, 2002

DLT 4EVA
I've been getting into the habit of organizing my jQuery-based javascript code into widgets. Regardless of how reusable the code it supposed to be, it just seems like better separation to me. Do y'all concur, or is this overengineering?


I'm also wondering specifically about event handling. Basically my internal widgets conceptually do have widget-specific events to them that need to have some defined behavior internally. What I've been doing is having internal widget methods that provide the default behavior for the event and then fire off this._trigger(). For example, a task list widget has an onTaskEdited method which does the actual business of a task having been edited (data formatting, persistence, closing the edit ui) and at the end goes this._trigger('edited'). I think i'm ok with this but it strikes me as a little off that the event's i'm firing won't actually ever be used (as there's no reason to use them internally and the widgets are very app-specific and not really meant for redistribution). I guess the idea is that another internal page or widget may want to hook into those events to do things involving the other widget without becoming a locked-down dependency? Or is this, again, a bit of overengineering and I should maybe minimize the number of events I send out?

Also wonder if the nomenclature of the methods is actually apt.... should it maybe be "this.editTask()" rather then "this.onEditTask()" ... i mean it's the thing that makes the actual change happen and is the source of the event, it's not actually an event handler. The main reason I went with onEventName anyway is that the methods end up having event-handler signatures anyway since they'll almost always be called by an event handler (and they'll need to pass the event object on to the widget-specific event they trigger).

smug forum asshole
Jan 15, 2005

DankTamagachi posted:

I have been working hard recently to create a new personal webpage for myself. I've done a lot with JQuery, especially the BBQ plugin (for awesome hashchanging AJAX+back button functionality). However, in my attempt to get everything working, I'm afraid it is a little hackish these days. I've also attempted to make sure the site stays relatively functional without JavaScript enabled.

Anyways, I was hoping you geniuses could take a look at my site and give me some recommendations/best practices to do things differently if I'm doing something rear end backwards. I'm relatively proficient in Javascript, CSS, PHP, and all that jazz, but I'm mainly self-taught, so there are some things I only know how to do "my way."

Thanks! Let me know what you think!

http://www.davenadel.com

edit: some things I'm wondering about : whether my decision to dynamically load the scripts I need for each page is correct (i.e. to enable the tabs on the resume page and the like), as well as whether I should cache what URLs map to my hash values, and anything else you may find!

Functionally I think it's decent and all parts appear to be well-integrated. Nice work!

Call me an rear end in a top hat, but people are going to like looking at your site a lot more if you remove the backgrounds on #main and #spiral. Also, the yellow -> transparent highlight fade is unnecessary and kind of jarring.

Just my two cents, hope you find it helpful.

And I can't really comment on anything PHP related, but here's a comment about the java script:

code:
	$('#navigation a').click(function(e) {
		e.preventDefault();
		if($(this).hasClass('bbq-current')) { return false; };
		page['page'] = $(this).attr('href').replace(/\.[^\.]*$/, '');
		$.bbq.pushState(page,2);		
	});
	$('#footernav a').click(function(e) {
		e.preventDefault();
		if($(this).hasClass('bbq-current')) { return false; };
		page['page'] = $(this).attr('href').replace(/\.[^\.]*$/, '');
		$.bbq.pushState(page,2);		
	});	
^^ can't you combine those two methods?

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Mr. Wynand posted:

I've been getting into the habit of organizing my jQuery-based javascript code into widgets. Regardless of how reusable the code it supposed to be, it just seems like better separation to me. Do y'all concur, or is this overengineering?
Organizing your code into logically distinct modules is pretty much always a good idea, and creating your own widgets is a reasonable way to do this.

DankTamagachi
Jan 20, 2005
Tamagachi to your throat!

smug forum rear end in a top hat posted:

Functionally I think it's decent and all parts appear to be well-integrated. Nice work!

Call me an rear end in a top hat, but people are going to like looking at your site a lot more if you remove the backgrounds on #main and #spiral. Also, the yellow -> transparent highlight fade is unnecessary and kind of jarring.

Just my two cents, hope you find it helpful.

And I can't really comment on anything PHP related, but here's a comment about the java script:

code:
	$('#navigation a').click(function(e) {
		e.preventDefault();
		if($(this).hasClass('bbq-current')) { return false; };
		page['page'] = $(this).attr('href').replace(/\.[^\.]*$/, '');
		$.bbq.pushState(page,2);		
	});
	$('#footernav a').click(function(e) {
		e.preventDefault();
		if($(this).hasClass('bbq-current')) { return false; };
		page['page'] = $(this).attr('href').replace(/\.[^\.]*$/, '');
		$.bbq.pushState(page,2);		
	});	
^^ can't you combine those two methods?

I have combined those two methods, thanks! Didn't even think of it.

I also changed the "highlight" function to a slightly more subtle one. Now, I'm struggling with a race condition issue. I used to have the "loading" gif show up after info was submitted to the contact form. However, if the ajax request completes too quickly, the show() for the loading div isn't complete before hide() is called and it is never hidden. Frustrating!

Suggestions, anyone?

butt dickus
Jul 7, 2007

top ten juiced up coaches
and the top ten juiced up players

DankTamagachi posted:

I have combined those two methods, thanks! Didn't even think of it.

I also changed the "highlight" function to a slightly more subtle one. Now, I'm struggling with a race condition issue. I used to have the "loading" gif show up after info was submitted to the contact form. However, if the ajax request completes too quickly, the show() for the loading div isn't complete before hide() is called and it is never hidden. Frustrating!

Suggestions, anyone?

I haven't looked at your code, but using callbacks will make sure that everything happens in the order you intend. Most of the built-in jQuery ajax functions have callbacks.

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb
Can anybody recommend me a jQuery polling plugin? Is that the right word for it? I want to do an xhr every half second. If one of the requests never gets a response for some reason, I want it to continue to issue them. If the old request ends up coming back after a new one has been issued, ignore it.

It seems simple enough to just code it myself, but I would have guessed there would be a nice jQuery plugin I could use. The search results I'm seeing do not look very promising at all though.

entr0py
Jan 31, 2004


A real-life robot.
You really should just wrap this up yourself, it's extremely trivial for the simplest of use cases and for more difficult things it should still be relatively terse.

code:
var doPoll = function() {
    $.ajax({
        url: '<your-url-here>',
        timeout: 500,
        success: function() {
            // handdle response, etc
        }
    });
};

setInterval(doPoll, 500);
Obviously if this is going to be reused throughout your application you could generalize it, but again, that should be pretty easy. If your success callback takes significant time to execute, or what you're doing in it is extremely fragile, you should also look in to aborting existing requests while handling the response.

See: http://api.jquery.com/jQuery.ajax/

Xenogenesis
Nov 8, 2005
yeah, what entro0py said. Nobody's written any timer/timeout jQuery plugins probably because the DOM honestly handles all that ish as straightforward as possible.

Now what *is* p.swee handled by a jQuery plugin is http://dev.seankoole.com/jquery/ui-effect/text.html

Bobx66
Feb 11, 2002

We all fell into the pit
How do you think they did this:

http://beta.gawker.com/

I really want to mimic it.

Haystack
Jan 23, 2005





Bobx66 posted:

How do you think they did this:

http://beta.gawker.com/

I really want to mimic it.

What, the fixed right bar? It's just CSS.
code:
#rightcontainer {
    position: fixed;
}

Bobx66
Feb 11, 2002

We all fell into the pit

Haystack posted:

What, the fixed right bar? It's just CSS.
code:
#rightcontainer {
    position: fixed;
}

Looks like that is only half of it, you can scroll in the right bar, independent of the main site.

Haystack
Jan 23, 2005





Ah, I see. That is neat.

They appear to be using a .mousewheel() event handler. See line 31 of the relevent javascript file

Edit: There's also some keyboard navigation stuff bound to the keydown event.

Haystack fucked around with this message at 18:20 on Dec 30, 2010

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Bobx66 posted:

How do you think they did this:

http://beta.gawker.com/

I really want to mimic it.

Is that what they were working on instead of security?? :iceburn:

In a vaguely similar vien, I finished my "It scrolls to the top, then switches to fixed" plugin a while back, and in typical me fashion, never did anything with it.

Example: http://www.chmoddesign.com/testbed/jquery/scrollToFixed/scrollExample.html
Grab it if you so desire: http://www.chmoddesign.com/stuff/jquery_scroll_to_fixed

Bobx66
Feb 11, 2002

We all fell into the pit

Lumpy posted:

Is that what they were working on instead of security?? :iceburn:

In a vaguely similar vien, I finished my "It scrolls to the top, then switches to fixed" plugin a while back, and in typical me fashion, never did anything with it.

Example: http://www.chmoddesign.com/testbed/jquery/scrollToFixed/scrollExample.html
Grab it if you so desire: http://www.chmoddesign.com/stuff/jquery_scroll_to_fixed

That is fantastic! Thank you for sharing Lumpy.

rugbert
Mar 26, 2003
yea, fuck you
I just inherited wordpress site thats broken. Looks like all the blog posts from 6 months again and earlier have broken images. Apparently the old wordpress was on a different domain so the links all goto
code:
[url]www.rugbert.oldsite.org/wp-content/blahblahblah[/url]
and should be going to
code:
[url]www.rugbertspiesales.com/wp-content/blahblahblah[/url]
I dont know enough about WP to know if theres a built in fix so I was thinking jquery to target the links? Can I use regex expressions to replace them?

Adbot
ADBOT LOVES YOU

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

rugbert posted:

I just inherited wordpress site thats broken. Looks like all the blog posts from 6 months again and earlier have broken images. Apparently the old wordpress was on a different domain so the links all goto
code:
[url]www.rugbert.oldsite.org/wp-content/blahblahblah[/url]
and should be going to
code:
[url]www.rugbertspiesales.com/wp-content/blahblahblah[/url]
I dont know enough about WP to know if theres a built in fix so I was thinking jquery to target the links? Can I use regex expressions to replace them?

You can do something like:

code:
jQuery('a[href^="www.rugbert.oldsite"]').each(function () {
   //change href to what you want
});

  • Locked thread