Sign Up! Login: Password: New User? Forgot? Support
Top Mods!
Wowhead Search
by sonofsamedi
Digital Clock
by Wolfar15
Admin Forums
Welcome to the GuildPortal Help Community! These forums are for admin-to-admin help.
Available Forums
Forums : Pimp My Site! > Hiding the admin Edit buttons
Mottie (MVP) 7/8/2008 8:52 AM EST : Hiding the admin Edit buttons
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

** Please use the newest version of this script, located on page 3 of this thread **



This script will hide the annoying admin "Edit" button that appears in every content box.

If you have a paid site, add the script to your footer to cover every page on your site. If you have a free site, you'll need to add this script to a content box near the bottom of the page (just one) on every page of your site to have it work.

I added a variable set to either true or false in the script to make it easier to turn the function on and off. You can still edit any content box from the control panel:
Control Panel > Site Pages > Click the desired tab > "Edit Content" of the content box
Also if you already have the ".hide" class defined in your CSS, there is no need to add another.

Footer or Content Box
<style type="text/css">
.hide { display: none; }
</style>
<script type="text/javascript">
function hideEditButtons() {
// true = hide all edit buttons
// false = show all edit buttons
var hideButtons = true;

// Don't change anything below!
// *****************************
if (!hideButtons) return;
x = document.getElementsByTagName("input");
 try {
  for (j=0; j < x.length; j++) {
   if( x[j].value == "Edit" ) {
    x[j].className = "hide";
   }
  }
 } catch (err) {}
}
setTimeout("hideEditButtons();", 1);
</script>
Edit: Moved the CSS to the area above the javascript... so people don't have to deal with a Custom StyleSheet.
TopBottom

Swift Lightning (Guild Admin) 7/8/2008 6:03 PM EST : RE: Hiding the admin Edit buttons
Swift Lightning
Posts: 2298
Zomgawsh Poster

I seem to be having some trouble with this one.  I've tried adding the code to footer under "Advance Style Settings" as well as page footer text under "Site Element Styles."  Lastly I tried adding it to a content container still to no avail.  Any ideas?
The image “http://img.photobucket.com/albums/v306/Swift_Lightning/userbar569379el5.gif” cannot be displayed, because it contains errors.
TopBottom

Mottie (MVP) 7/9/2008 3:19 AM EST : RE: Hiding the admin Edit buttons
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

I have mine added under "Footer" under the "Advanced Style Settings". Are you sure you enabled it?

Also, is it only hiding the left side columns or not hiding any at all? I had this problem when I put the code into the header and the page had a long load time. If you have a large amount of information on your page, try increasing the timer to 2 or 3 (this is in seconds):
setTimeout("hideEditButtons();", 2);
Other than that, I can't think of why it wouldn't work. I've tested it in both Firefox and Internet Explorer.
TopBottom

Archiviste (New Admin) 7/11/2008 11:58 AM EST : RE: Hiding the admin Edit buttons
Archiviste
Posts: 27
Becoming Adept!

Mottie said:
This script will hide the annoying admin "Edit" button that appears in every content box.

If you have a paid site, add the script to your footer to cover every page on your site. If you have a free site, you'll need to add this script to a content box near the bottom of the page (just one) on every page of your site to have it work.

Also if you already have the ".hide" class defined in your CSS, there is no need to add another.


I have a paid site (http://watch.guildportal.com), so I added the script to "Advanced Style Settings / Footer" and the hide class in "Advanced Style Settings / Custom StyleSheet". Both were empty before that - I had not come around to mess with that stuff yet.

So, I put the checkmark to "enabled" in Custom StyleSheet, press Save, reload the page and... my background image and background color just disappeared !

I remove the checkmark, Save again, reload again, back to normal.

Is it because I was not using Custom StyleSheet yet ?


TopBottom

Mottie (MVP) 7/11/2008 12:26 PM EST : RE: Hiding the admin Edit buttons
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

Yeah you need to add the CSS, it might be better to just add it in the footer with the javascript. Just copy everything below into the footer, I'll edit the original post.
<style type="text/css">
.hide { display: none; }
</style>
<script type="text/javascript">
function hideEditButtons() {
// true = hide all edit buttons
// false = show all edit buttons
var hideButtons = true;

// Don't change anything below!
// *****************************
if (!hideButtons) return;
x = document.getElementsByTagName("input");
 try {
  for (j=0; j < x.length; j++) {
   if( x[j].value == "Edit" ) {
    x[j].className = "hide";
   }
  }
 } catch (err) {}
}
setTimeout("hideEditButtons();", 1);
</script>
TopBottom

Gundrik Rikbolgisson (New Admin) 7/11/2008 5:22 PM EST : RE: Hiding the admin Edit buttons
Gundrik Rikbolgisson
Posts: 1753
Zomgawsh Poster

Mottie,

Worked perfectly on my first try.  Mottie.... you rule and your tips are top notch!  Thanks for always sharing, you add so much to the GM community!
TopBottom

Swift Lightning (Guild Admin) 7/12/2008 12:19 PM EST : RE: Hiding the admin Edit buttons
Swift Lightning
Posts: 2298
Zomgawsh Poster

It's working great for me now thanks!  I'm not sure what I botched before.
The image “http://img.photobucket.com/albums/v306/Swift_Lightning/userbar569379el5.gif” cannot be displayed, because it contains errors.
TopBottom

Archiviste (New Admin) 7/14/2008 1:23 PM EST : RE: Hiding the admin Edit buttons
Archiviste
Posts: 27
Becoming Adept!

Mottie,

I followed your updated instructions and it works now. Thanks !
TopBottom

Everdark (MVP) 8/19/2008 12:28 PM EST : RE: Hiding the admin Edit buttons
GuildPortal MVP
Everdark
Posts: 3953
Zomgawsh Poster

A question for you, Mottie:

Is it possible to hide all the Edits but leave some visible? Like can we have the Calendar Edit button stay visible?

"The person who says it cannot be done should not interrupt the person doing it." 

 
Everdark (T), Evadarr, Nevinn (AC), Soninn, Croninn, Zakarr, Avirded (SC)
TopBottom

Mottie (MVP) 8/19/2008 6:12 PM EST : RE: Hiding the admin Edit buttons
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

Try this:
<script type="text/javascript">
function hideEditButtons() {
// true = hide all edit buttons
// false = show all edit buttons
var hideButtons = true;
var dontHide = "monthlyCalendar";
// Don't change anything below!
// *****************************
if (!hideButtons) return;
x = document.getElementsByTagName("input");
 try {
  for (j=0; j < x.length; j++) {
   if( x[j].value == "Edit" && !(x[j].parentNode.innerHTML.match(dontHide)) ) {
    x[j].style.display = "none";
   }
  }
 } catch (err) {}
}
setTimeout("hideEditButtons();", 1);
</script>
If it doesn't work, try replacing the text in red with "Prev Month"... "monthlyCalendar" is within the ID of the calendar table. I've only had a chance to test it on my site, but I'm tired and heading to bed soon

Also, this script isn't perfect, it looks for text INSIDE the content box (NOT the title of the box). If you want to show other edit buttons, just add a "|" (shift-\) between the key words. Example: On my test site calendar page, if I wanted to show the edit button in my Info Box and the Event Calendar, I would use:
var dontHide = "monthlyCalendar|Test";
Note: Those are key words INSIDE the content box (NOT the title).
TopBottom

Admins Online
There are   members online.
So-and-so has logged on!
%title%
%message%