Latest Contest Winners
SotW #9 Winner: Kronus


Pure Creativity :: The Coders' Quarter :: The Arsenal :: Buttons to Text - View Topic
Topic Rating: *****
Reply Printable View
Administrator
*****
Arch Vizier
[Avatar]
There's nothing wrong with red shirts.
Posts: 516
Gender: Male
Location: Maryland, USA
Joined:  
Class: Archmage, 2nd Degree
Points: 2,705
Reputation: 4
Buttons to Text (2nd May 10 at 3:17pm UTC)Quote Reply
This code will convert all of the default virtualForums buttons into text links.

Global Footers:
Code:
 
  1. <script type="text/javascript">
  2. // Buttons to Text - virtualForums; Public Code 02 (c)2010 Webmaren
  3. window.onload=function(){var wm_pc02_i=document.getElementsByTagName('img');for(a in wm_pc02_i){if(wm_pc02_i[a].src.match(/virtualforums/)&&wm_pc02_i[a].width>35&&wm_pc02_i[a].parentNode.childNodes.length==1&&!wm_pc02_i[a].src.match(/uploads/)){var wm_pc02_s=document.createElement('span');wm_pc02_s.className='vf-btn';wm_pc02_s.appendChild(document.createTextNode(wm_pc02_i[a].alt.toUpperCase()));wm_pc02_i[a].parentNode.appendChild(wm_pc02_s);wm_pc02_i[a].parentNode.style.textDecoration='none';wm_pc02_i[a].style.display='none';}}}
  4. </script>
 


CSS:
Code:
 
  1. .vf-btn { margin: 2px; font: bold 7px; text-decoration: none; }
 


This code may be used in any virtualForums forum free of charge. It is being made available under the terms of the Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License


Unminified Code:
Code:
 
  1. <script type="text/javascript">
  2. // Buttons to Text - virtualForums
  3. // Public Code 02 (c)2010 Webmaren
  4. window.onload = function() {
  5. var pcImg = document.getElementsByTagName('img');
  6. for (a in pcImg) {
  7.     if (pcImg[a].src.match(/virtualforums/) && pcImg[a].width > 35 && pcImg[a].parentNode.childNodes.length == 1 && !pcImg[a].src.match(/uploads/)) {
  8.         var text = pcImg[a].alt.toUpperCase();
  9.         var span = document.createElement('span');
  10.         span.className = 'pc-button';
  11.         span.appendChild(document.createTextNode(text));
  12.         pcImg[a].parentNode.appendChild(span);
  13.         pcImg[a].parentNode.style.textDecoration = 'none';
  14.         pcImg[a].style.display = 'none';
  15.     }
  16. }
  17. }
  18. </script>
 

Image
 
Regular Member
***
[Avatar]
Posts: 116
Joined:  
Class: N/A
Points: 605
Reputation: -2
pm
OFFLINE
Re: Buttons to Text (2nd May 10 at 5:10pm UTC)Quote Reply
I'm sure there is an admin option to do this... {Tongue Out}

Image
wImg
Free - Simple - Image Hosting
 
Administrator
*****
Arch Vizier
[Avatar]
There's nothing wrong with red shirts.
Posts: 516
Gender: Male
Location: Maryland, USA
Joined:  
Class: Archmage, 2nd Degree
Points: 2,705
Reputation: 4
Re: Buttons to Text (2nd May 10 at 5:29pm UTC)Quote Reply
So it appears there is. This brings me to a point: the admin interface for vF, while overflowing with useful features, is not very easy to manipulate.



For example, there is no way to style the text mode buttons because they have no classes.

Image
 
Regular Member
***
[Avatar]
Posts: 116
Joined:  
Class: N/A
Points: 605
Reputation: -2
pm
OFFLINE
Re: Buttons to Text (3rd May 10 at 3:38am UTC)Quote Reply
.title1 a

Is what I'd use a selector, would probably be good enough. {Smile}

Image
wImg
Free - Simple - Image Hosting
 
Administrator
*****
[Avatar]
Posts: 483
Joined:  
Class: Pwnage
Points: 2,415
Reputation: 3
pm
OFFLINE
Re: Buttons to Text (3rd May 10 at 7:22am UTC)Quote Reply
Arnt you a coder for vF Michael?
 
Administrator
*****
Arch Vizier
[Avatar]
There's nothing wrong with red shirts.
Posts: 516
Gender: Male
Location: Maryland, USA
Joined:  
Class: Archmage, 2nd Degree
Points: 2,705
Reputation: 4
Re: Buttons to Text (3rd May 10 at 10:41am UTC)Quote Reply
 
.title1 a

Is what I'd use a selector, would probably be good enough. {Smile}


And "quote", "modify", et al. in the post? I wouldn't be getting them all in one go.


EDIT: Okay, it's doable, but requires more complex CSS rules.

Image
 
Regular Member
***
[Avatar]
Posts: 174
Joined:  
Class: N/A
Points: 1,045
Reputation: 0
pm
OFFLINE
Re: Buttons to Text (3rd May 10 at 1:07pm UTC)Quote Reply
 
Arnt you a coder for vF Michael?


I think he's a member of the support team. But also helps out with coding.

Image
 
Regular Member
***
[Avatar]
Posts: 116
Joined:  
Class: N/A
Points: 605
Reputation: -2
pm
OFFLINE
Re: Buttons to Text (5th May 10 at 3:46pm UTC)Quote Reply
I am indeed a vF coder, and a vF coding moderator. I'll drop Ross this as a suggestion to give all of the text equivalents a unique class "button", and I'm sure he can get it out for us.

{Smile}

Image
wImg
Free - Simple - Image Hosting
 
Administrator
*****
Arch Vizier
[Avatar]
There's nothing wrong with red shirts.
Posts: 516
Gender: Male
Location: Maryland, USA
Joined:  
Class: Archmage, 2nd Degree
Points: 2,705
Reputation: 4
Re: Buttons to Text (5th May 10 at 8:39pm UTC)Quote Reply
Thanks Michael.

Image
 
Regular Member
***
[Avatar]
Posts: 116
Joined:  
Class: N/A
Points: 605
Reputation: -2
pm
OFFLINE
Re: Buttons to Text (6th May 10 at 12:01am UTC)Quote Reply
For many, Ross has suggested that you look at the template (Manage Templates), and change them in there, as ultimately it's the same.

Some are unable to be templated, and he will look at those. {Smile}

Image
wImg
Free - Simple - Image Hosting
 Reply Printable View

RETURN TO TOP
All times are GMT+0 :: The current time is 2:07am
Page generated in 0.3809 seconds
Purchase Ad-Free Credits
This Forum is Powered By vForums (v2.4)
Create a Forum for Free | Find Forums