Lurk all you'd like, but why not register and post some pics? Registering also makes it easier to find the good stuff. Need help?

Go Back   Digital Grin Photography Forum > Support > SmugMug Customization
Dgrinner
Password
Register FAQ Shooters Calendar Reviews Tutorials Gallery Books Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old Feb-26-2006, 11:27 AM   #1
wellman
DeColores!
 
wellman's Avatar
 
Join Date: Jan 2006
Posts: 906
Getting rid of those pesky pipes

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.

Code:
<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.
__________________
Greg Wellman
WellmanHouse.net | Blog | AlbumFetcher | SmugShowBuilder
wellman is offline   Reply With Quote
Old Feb-26-2006, 06:21 PM   #2
Andy
SmugMug COO & House Pro
 
Andy's Avatar
 
Join Date: Dec 2003
Location: New York City
Posts: 52,623
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.
__________________
Andy

Moon River PhotographyTwitterFacebook
Andy is online now   Reply With Quote
Old Feb-27-2006, 06:34 AM   #3
{JT}
Code Monkey
 
{JT}'s Avatar
 
Join Date: Jan 2004
Posts: 1,012
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.


Quote:
Originally Posted by Andy
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} is offline   Reply With Quote
Old Feb-27-2006, 09:24 AM   #4
wellman
DeColores!
 
wellman's Avatar
 
Join Date: Jan 2006
Posts: 906
Quote:
Originally Posted by {JT}
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.
__________________
Greg Wellman
WellmanHouse.net | Blog | AlbumFetcher | SmugShowBuilder
wellman is offline   Reply With Quote
Old Apr-09-2006, 07:20 PM   #5
Andy
SmugMug COO & House Pro
 
Andy's Avatar
 
Join Date: Dec 2003
Location: New York City
Posts: 52,623
Quote:
Originally Posted by wellman
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.

Code:
<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?
__________________
Andy

Moon River PhotographyTwitterFacebook
Andy is online now   Reply With Quote
Old Apr-10-2006, 12:23 AM   #6
ivar
Here for the crosswords
 
ivar's Avatar
 
Join Date: Nov 2005
Location: the Netherlands
Posts: 7,965
Quote:
Originally Posted by Andy
I want to go "pipeless" in my footer - but no joy. Any ideas?
Andy, add this to your Javascript.
Code:
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 to see if it works, and it works great.
__________________
Ivar


moderator: People & Go Figure
usefulness: how to do most anything on Dgrin - great tutorials - gear reviews - book reviews
me: www.ivarborst.nl - blog - smugmug


Kinkajou: "go comment on something and spread the love!"

Last edited by ivar; Apr-10-2006 at 12:44 AM.
ivar is offline   Reply With Quote
Old Apr-10-2006, 02:46 AM   #7
wellman
DeColores!
 
wellman's Avatar
 
Join Date: Jan 2006
Posts: 906
Quote:
Originally Posted by ivar
I used it on my site to see if it works, and it works great.
Nice!
__________________
Greg Wellman
WellmanHouse.net | Blog | AlbumFetcher | SmugShowBuilder
wellman is offline   Reply With Quote
Old Apr-10-2006, 03:19 AM   #8
Andy
SmugMug COO & House Pro
 
Andy's Avatar
 
Join Date: Dec 2003
Location: New York City
Posts: 52,623
Quote:
Originally Posted by ivar
Andy, add this to your Javascript.
Thanks, Ivar! OK It's gone from my homepage but not from the #feeds part.
__________________
Andy

Moon River PhotographyTwitterFacebook
Andy is online now   Reply With Quote
Old Apr-10-2006, 03:23 AM   #9
ivar
Here for the crosswords
 
ivar's Avatar
 
Join Date: Nov 2005
Location: the Netherlands
Posts: 7,965
Quote:
Originally Posted by Andy
Thanks, Ivar! OK It's gone from my homepage but not from the #feeds part.
Yep, by design, but that is easy enough to change.
Code:
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;
      }
   }
}
__________________
Ivar


moderator: People & Go Figure
usefulness: how to do most anything on Dgrin - great tutorials - gear reviews - book reviews
me: www.ivarborst.nl - blog - smugmug


Kinkajou: "go comment on something and spread the love!"
ivar is offline   Reply With Quote
Old Apr-10-2006, 04:21 AM   #10
Andy
SmugMug COO & House Pro
 
Andy's Avatar
 
Join Date: Dec 2003
Location: New York City
Posts: 52,623
Quote:
Originally Posted by ivar
Yep, by design, but that is easy enough to change.
Code:
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;
      }
   }
}

THANK YOU, IVAR Wonderful, wonderful....

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

#feeds .note {display: none;}

which removes the "what are feeds?" link.

__________________
Andy

Moon River PhotographyTwitterFacebook
Andy is online now   Reply With Quote
Old Apr-10-2006, 07:00 AM   #11
Andy
SmugMug COO & House Pro
 
Andy's Avatar
 
Join Date: Dec 2003
Location: New York City
Posts: 52,623
I actually didn't like it with nothing there, so I just used a dot separator instead...

&middot

http://www.htmlcodetutorial.com/char...amsupp_69.html
__________________
Andy

Moon River PhotographyTwitterFacebook
Andy is online now   Reply With Quote
Old Apr-10-2006, 07:02 AM   #12
ivar
Here for the crosswords
 
ivar's Avatar
 
Join Date: Nov 2005
Location: the Netherlands
Posts: 7,965
Quote:
Originally Posted by Andy
I actually didn't like it with nothing there, so I just used a dot separator instead...

&middot

http://www.htmlcodetutorial.com/char...amsupp_69.html
Looks 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.
__________________
Ivar


moderator: People & Go Figure
usefulness: how to do most anything on Dgrin - great tutorials - gear reviews - book reviews
me: www.ivarborst.nl - blog - smugmug


Kinkajou: "go comment on something and spread the love!"
ivar is offline   Reply With Quote
Old Apr-12-2006, 06:42 AM   #13
Andy
SmugMug COO & House Pro
 
Andy's Avatar
 
Join Date: Dec 2003
Location: New York City
Posts: 52,623
It only works now for the first of my three feeds boxes on my homepage

www.moonriverphotography.com

anyone got a fix?
__________________
Andy

Moon River PhotographyTwitterFacebook
Andy is online now   Reply With Quote
Old Apr-12-2006, 06:45 AM   #14
devbobo
technicolored
 
devbobo's Avatar
 
Join Date: Nov 2004
Location: Melbourne, AU
Posts: 4,308
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


Code:
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;
      }
}
__________________
David Parry
My Photos | SmugBrowser
devbobo is offline   Reply With Quote
Old Apr-12-2006, 06:47 AM   #15
ivar
Here for the crosswords
 
ivar's Avatar
 
Join Date: Nov 2005
Location: the Netherlands
Posts: 7,965
thanks David, i need to read up, i know.... I'm stuck in the oldschool stuff from years ago
__________________
Ivar


moderator: People & Go Figure
usefulness: how to do most anything on Dgrin - great tutorials - gear reviews - book reviews
me: www.ivarborst.nl - blog - smugmug


Kinkajou: "go comment on something and spread the love!"
ivar is offline   Reply With Quote
Old Apr-12-2006, 06:50 AM   #16
Andy
SmugMug COO & House Pro
 
Andy's Avatar
 
Join Date: Dec 2003
Location: New York City
Posts: 52,623
Neither Devs nor Ivars removes the pipes from box 2 and 3 on the homepage
Attached Images
 
__________________
Andy

Moon River PhotographyTwitterFacebook
Andy is online now   Reply With Quote
Old Apr-12-2006, 06:56 AM   #17
ivar
Here for the crosswords
 
ivar's Avatar
 
Join Date: Nov 2005
Location: the Netherlands
Posts: 7,965
Quote:
Originally Posted by Andy
Neither Devs nor Ivars removes the pipes from box 2 and 3 on the homepage
Mine shouldn't work, but dev's should. It works on my site...
__________________
Ivar


moderator: People & Go Figure
usefulness: how to do most anything on Dgrin - great tutorials - gear reviews - book reviews
me: www.ivarborst.nl - blog - smugmug


Kinkajou: "go comment on something and spread the love!"
ivar is offline   Reply With Quote
Old Apr-12-2006, 10:24 AM   #18
Andy
SmugMug COO & House Pro
 
Andy's Avatar
 
Join Date: Dec 2003
Location: New York City
Posts: 52,623
Got it

I had some dupe JS (user error )
and, I added section for feedHelp

Code:
// 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;
      }
}
__________________
Andy

Moon River PhotographyTwitterFacebook
Andy is online now   Reply With Quote
Old Apr-12-2006, 11:18 AM   #19
ivar
Here for the crosswords
 
ivar's Avatar
 
Join Date: Nov 2005
Location: the Netherlands
Posts: 7,965
Quote:
Originally Posted by Andy
I had some dupe JS (user error )
and, I added section for feedHelp

Code:
// 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?

Code:
 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?
__________________
Ivar


moderator: People & Go Figure
usefulness: how to do most anything on Dgrin - great tutorials - gear reviews - book reviews
me: www.ivarborst.nl - blog - smugmug


Kinkajou: "go comment on something and spread the love!"
ivar is offline   Reply With Quote
Old Apr-12-2006, 01:00 PM   #20
bigwebguy
Now with 10% less fail
 
bigwebguy's Avatar
 
Join Date: Aug 2005
Location: Gainesville, VA
Posts: 2,713
Quote:
Originally Posted by ivar
...will the /g search through all of the children?
sorta kinda...you're on the right track.
Quote:
/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
__________________
lose |loōz| verb
  1. be deprived of or cease to have or retain (something)
  2. become unable to find (something or someone)
  3. fail to win (a game or contest)
loose |loōs| adjective
  1. not firmly or tightly fixed in place
  2. (of a garment) not fitting tightly or closely
  3. relaxed; physically slack
bigwebguy is online now   Reply With Quote
Reply

Tell The World!

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Times are GMT -8.   It's 09:42 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.