PDA

View Full Version : Getting rid of those pesky pipes


wellman
Feb-26-2006, 12:27 PM
Well after receiving so much help on this forum, I thought I could contribute a VERY small nugget of wisdom. I don't know about anyone else, but I hate it when pipe (|) separators are on the end of a line. This ends up happening if you have camera info enabled for your galleries. To turn this off, place the following snippet into your customization footer.


<script type="text/javascript">
// Remove trailing pipe (|) from "other sizes"
var objElement = document.getElementById("exifOtherSizes")
if (objElement != null) {
var str = new String(objElement.innerHTML);
str = str.replace('|', '')
objElement.innerHTML = str;
}
</script>

The example above removes the pipe from the "exifOtherSizes" element of the camera info. Use the FF Webdeveloper Extension to get the IDs of other elements you want to clean up.

Andy
Feb-26-2006, 07:21 PM
This is great, Greg - but I can't seem to make it work on the pipe on the footer .... I'm not sure if JT blocks that or not.

A.

{JT}
Feb-27-2006, 07:34 AM
I will have an easier solution for this soon ;)

But - most people don't have this problem with because their "other sizes" is not the last thing in the list. Normally it is keywords or something else.


This is great, Greg - but I can't seem to make it work on the pipe on the footer .... I'm not sure if JT blocks that or not.

A.

wellman
Feb-27-2006, 10:24 AM
But - most people don't have this problem with because their "other sizes" is not the last thing in the list. Normally it is keywords or something else.

Good point. :D

Andy
Apr-09-2006, 08:20 PM
Well after receiving so much help on this forum, I thought I could contribute a VERY small nugget of wisdom. I don't know about anyone else, but I hate it when pipe (|) separators are on the end of a line. This ends up happening if you have camera info enabled for your galleries. To turn this off, place the following snippet into your customization footer.


<script type="text/javascript">
// Remove trailing pipe (|) from "other sizes"
var objElement = document.getElementById("exifOtherSizes")
if (objElement != null) {
var str = new String(objElement.innerHTML);
str = str.replace('|', '')
objElement.innerHTML = str;
}
</script>

The example above removes the pipe from the "exifOtherSizes" element of the camera info. Use the FF Webdeveloper Extension to get the IDs of other elements you want to clean up.

I want to go "pipeless" in my footer - but no joy. Any ideas?

ivar
Apr-10-2006, 01:23 AM
I want to go "pipeless" in my footer - but no joy. Any ideas?Andy, add this to your Javascript.addEvent(window, "load", rem_pipes);

function rem_pipes () {
for (var i = 0; i<3; i++) {
var objElement = document.getElementById("footer")
if (objElement != null)
{
var str = new String(objElement.innerHTML);
str = str.replace('|', '')
objElement.innerHTML = str;
}
}
}It's for your footer only, not for your feeds. Normally, the code is read only once, so only the first pipe is removed. I put a loop in there for you, so it takes out all of the pipes. I assumed you just wanted the pipes removed, but you can also replace them by something else

I used it on my site (http://ivar.smugmug.com) to see if it works, and it works great.

wellman
Apr-10-2006, 03:46 AM
I used it on my site (http://ivar.smugmug.com) to see if it works, and it works great.

Nice! :thumb

Andy
Apr-10-2006, 04:19 AM
Andy, add this to your Javascript.

Thanks, Ivar! OK It's gone from my homepage but not from the #feeds part. :dunno

ivar
Apr-10-2006, 04:23 AM
Thanks, Ivar! OK It's gone from my homepage but not from the #feeds part. :dunnoYep, by design, but that is easy enough to change.addEvent(window, "load", rem_pipes);

function rem_pipes () {
for (var i = 0; i<3; i++) {
var objElement = document.getElementById("footer")
if (objElement != null)
{
var str_a = new String(objElement.innerHTML);
str_a = str_a.replace('|', '')
objElement.innerHTML = str_a;
}
var objElement = document.getElementById("feeds")
if (objElement != null)
{
var str_b = new String(objElement.innerHTML);
str_b = str_b.replace('|', '')
objElement.innerHTML = str_b;
}
}
}

Andy
Apr-10-2006, 05:21 AM
Yep, by design, but that is easy enough to change.addEvent(window, "load", rem_pipes);

function rem_pipes () {
for (var i = 0; i<3; i++) {
var objElement = document.getElementById("footer")
if (objElement != null)
{
var str_a = new String(objElement.innerHTML);
str_a = str_a.replace('|', '')
objElement.innerHTML = str_a;
}
var objElement = document.getElementById("feeds")
if (objElement != null)
{
var str_b = new String(objElement.innerHTML);
str_b = str_b.replace('|', '')
objElement.innerHTML = str_b;
}
}
}


:clap :clap THANK YOU, IVAR :D Wonderful, wonderful....

Pipes gone. Wonderful. Now I can use this bit of CSS:

#feeds .note {display: none;}

which removes the "what are feeds?" link.

http://williams.smugmug.com/photos/53333632-L.gif

Andy
Apr-10-2006, 08:00 AM
I actually didn't like it with nothing there, so I just used a dot separator instead...

&middot

http://www.htmlcodetutorial.com/characterentities_famsupp_69.html

ivar
Apr-10-2006, 08:02 AM
I actually didn't like it with nothing there, so I just used a dot separator instead...

&middot

http://www.htmlcodetutorial.com/characterentities_famsupp_69.htmlLooks good, i like it. You can always go for the classic "laying down pipe" ( - ) or another of the i don't know how many symbols there are.

Andy
Apr-12-2006, 07:42 AM
It only works now for the first of my three feeds boxes on my homepage

www.moonriverphotography.com

anyone got a fix?

devbobo
Apr-12-2006, 07:45 AM
Hey Ivar,

I have modified your code. Read up on using regular expressions, they are much more powerful than having to loop through code multiple times.

Cheers,

David



addEvent(window, "load", rem_pipes);

function rem_pipes () {
var objElement = document.getElementById("footer")
if (objElement != null)
{
var str_a = new String(objElement.innerHTML);
str_a = str_a.replace(/\|/g, '')
objElement.innerHTML = str_a;
}
var objElement = document.getElementById("feeds")
if (objElement != null)
{
var str_b = new String(objElement.innerHTML);
str_b = str_b.replace(/\|/g, '')
objElement.innerHTML = str_b;
}
}

ivar
Apr-12-2006, 07:47 AM
thanks David, i need to read up, i know.... I'm stuck in the oldschool stuff from years ago :lol3

Andy
Apr-12-2006, 07:50 AM
Neither Devs nor Ivars removes the pipes from box 2 and 3 on the homepage

ivar
Apr-12-2006, 07:56 AM
Neither Devs nor Ivars removes the pipes from box 2 and 3 on the homepageMine shouldn't work, but dev's should. It works on my site...

Andy
Apr-12-2006, 11:24 AM
I had some dupe JS (user error :uhoh)
and, I added section for feedHelp


// fix the pesky pipes

addEvent(window, "load", rem_pipes);

function rem_pipes () {
var objElement = document.getElementById("footer")
if (objElement != null)
{
var str_a = new String(objElement.innerHTML);
str_a = str_a.replace(/\|/g, '')
objElement.innerHTML = str_a;
}

var objElement = document.getElementById("allFeeds")
if (objElement != null)
{
var str_b = new String(objElement.innerHTML);
str_b = str_b.replace(/\|/g, '')
objElement.innerHTML = str_b;
}
var objElement = document.getElementById("feedHelp")
if (objElement != null)
{
var str_b = new String(objElement.innerHTML);
str_b = str_b.replace(/\|/g, '')
objElement.innerHTML = str_b;
}
}

ivar
Apr-12-2006, 12:18 PM
I had some dupe JS (user error :uhoh)
and, I added section for feedHelp


// fix the pesky pipes

addEvent(window, "load", rem_pipes);

function rem_pipes () {
var objElement = document.getElementById("footer")
if (objElement != null)
{
var str_a = new String(objElement.innerHTML);
str_a = str_a.replace(/\|/g, '')
objElement.innerHTML = str_a;
}

var objElement = document.getElementById("allFeeds")
if (objElement != null)
{
var str_b = new String(objElement.innerHTML);
str_b = str_b.replace(/\|/g, '')
objElement.innerHTML = str_b;
}
var objElement = document.getElementById("feedHelp")
if (objElement != null)
{
var str_b = new String(objElement.innerHTML);
str_b = str_b.replace(/\|/g, '')
objElement.innerHTML = str_b;
}
}


Devbobo,

Lets see if i understand this correctly. Because all pipes are located in children of #cobrand_footer, can i use the following and still achieve what Andy is getting above?

addEvent(window, "load", rem_pipes);

function rem_pipes () {
var objElement = document.getElementById("cobrand_footer")
if (objElement != null) {
var str = new String(objElement.innerHTML);
str = str.replace(/\|/g, '')
objElement.innerHTML = str;
}
}will the /g search through all of the children?

bigwebguy
Apr-12-2006, 02:00 PM
...will the /g search through all of the children?
sorta kinda...you're on the right track.
/g enables "global" matching. When using the replace() method, specify this modifier to replace all matches, rather than only the first one. taken from this site: http://www.regular-expressions.info/javascript.html

ivar
Apr-12-2006, 02:24 PM
sorta kinda...you're on the right track.
taken from this site: http://www.regular-expressions.info/javascript.htmlThanks, also for the link. So it just doesn't care about children, is that more like it?

I actually decided to try the code on my site, and it works fine. I haven't noticed any problems yet.

bigwebguy
Apr-12-2006, 03:35 PM
it knows nothing about children, regular expressions do pattern matching on strings, dat's it.

ivar
Apr-12-2006, 03:38 PM
it knows nothing about children, regular expressions do pattern matching on strings, dat's it.Cool, that's what i was thinking, thanks! :thumb

Andy
Apr-22-2006, 06:22 AM
Is there a way to make it so that the pipes are gone gone, first time visit? It's a bit annoying to see them change everytime you move from one photo to the next - :ear

Go here http://www.moonriverphotography.com/gallery/52248/1 in smugmug small and then use the > arrow to navigate from photo to photo you will see it..

ivar
Apr-22-2006, 06:31 AM
Is there a way to make it so that the pipes are gone gone, first time visit? It's a bit annoying to see them change everytime you move from one photo to the next - :ear

Go here http://www.moonriverphotography.com/gallery/52248/1 in smugmug small and then use the > arrow to navigate from photo to photo you will see it..I doubt if it is possible to make it happen before.... The page builds first, and then the JS kicks in, and changes what needs to be changed. (on a page by page basis) Same thing happens on my pages with the words i have changed by JS. First the page builds, then the changes kick in. Maybe someone else knows something smart or geeky to speed things up a little but? :ear

devbobo
Apr-22-2006, 07:23 PM
I have explain this before, but I am more than happy to do it again.

ok...Andy is using this method to call his pipe removal function...

addEvent(window, "load", rem_pipes);The problem with the "load" event on the window, it's not call until the page fully loads including images.

A different approach is to include...


<*script>
rem_pipes();
<*/script>
in the footer block, this will ensure that the function is called immediately. Depending how much code there is to load for a page, you still might see a small delay but it will be heaps better than the current method.

Cheers,

David

Andy
Apr-27-2006, 11:08 AM
I have explain this before, but I am more than happy to do it again.

ok...Andy is using this method to call his pipe removal function...

addEvent(window, "load", rem_pipes);The problem with the "load" event on the window, it's not call until the page fully loads including images.

A different approach is to include...


<*script>
rem_pipes();
<*/script>
in the footer block, this will ensure that the function is called immediately. Depending how much code there is to load for a page, you still might see a small delay but it will be heaps better than the current method.

Cheers,

David

I put this in my footer, no difference IMO. :dunno

bigwebguy
Apr-27-2006, 11:23 AM
I put this in my footer, no difference IMO. :dunno
you should try taking out the:

addEvent(window, "load", rem_pipes);

it might help.

Andy
Apr-27-2006, 11:34 AM
you should try taking out the:

addEvent(window, "load", rem_pipes);

it might help.

:nah didn't help.

bigwebguy
Apr-27-2006, 11:38 AM
:nah didn't help. well they dont both need to be in there at any rate.

gavin
Dec-11-2006, 02:59 PM
well they dont both need to be in there at any rate.

I can not get it to work>
?

pigeon
Jan-28-2007, 08:57 PM
Well, actually your footer. I like it. I read this thread, and tried the different suggestions. I want to leave my footer as is, leave the feed *icon*, but remove the feed text. And I'd like "SmugMug" the same color text as the rest of the line.

What am I missing?

Also, I'm wondering - as I see something I want to tweak, I add code to either the CSS or javascript boxes. At what point does that become bloated, and can some of it be consolidated to be more efficient?

thanks,
teresa