This forum is mean for sharing with everyone in this world, enjoy and have fun. Anyone who interested to learn Japanese Language or any question feel email to shinohara86@gmail.com or call +60166988603
>News and Announcements
Japanese Members Fast Login Section (JPN's)
Providing Teach Japanese Language at Home/Internet, more info Click Here
Provide/Teach Swimming Lesson, more info Click Here
Welcome to Anything2You, we are getting more players for Ragnarok Online Gathering Click here for more INFO

[ Copy this | Full Size ] SocialTwist Tell-a-Friend
wordpress blog stats

Create your own social network with a free forum.
InvisionFree - Free Forum Hosting
Welcome to Anything2You. We hope you enjoy your visit.
You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.
Join our community!
If you're already a member please log in to your account to access all of our features:
Anything please email to anythingtoyou1@gmail.com or shinohara86@gmail.com

Name:   Password:


Register/Sign Up
Quick Log In

 

 Codebox - Scroll
shinigamivsl
Posted: Jul 30 2009, 03:54 PM


Global Moderator
*

Group: Members
Posts: 54
Member No.: 2
Joined: 18-June 09



Add to AdminCP -> Skinning & Styles -> Board Wrappers -> Footers:

CODE
<script type="text/javascript"> <!-- var e = document.getElementsByTagName("td"); var x = /\[codebox\](.+?)\[\/codebox\]/gi; for(var n = 0; n < e.length; n ++) { if(!e[n].getElementsByTagName("textarea")[0] && x.test(e[n].innerHTML)) e[n].innerHTML = e[n].innerHTML.replace(x, "<div class='codebox'><div class='codebox-title'>CODEBOX</div><div class='codebox-code'>$1</div></div>"); } // --> </script>


Add to Admin CP - Skinning & Styles -> Manage Style Sheets:

CODE
.codebox {
      border: 1px solid #CCCCCC;
      background-color: #162C3A;
      width: 600px;
}
.codebox-title {
      border: 1px solid #CCCCCC;
      font-weight: bold;
      color: #FFFFFF;
      padding: 5px 5px 5px 5px;
}
.codebox-code {
      background-color: #FFFFFF;
      color: #003366;
      padding: 5px 5px 5px 5px;
      height: 150px;
      overflow: scroll;
}


Description/Usage:

It's for InvisionFree and will let you use [codebox]script[/codebox] when posting large scripts. It adds scroll bars to the codebox. You can change the CSS attributes to whatever you wish. This would be very simple if they would have used divs in the first place and not placed the original code box in a table cell. The reason is you can't set overflow on a tablecell with CSS.

To work around this problem on previously posted huge scripts on your forum, you can add the script below.

Add to AdminCP -> Skinning & Styles -> Board Wrappers -> Javascript:

CODE
<script type="text/javascript">
<!--
function addCodebox() {
var el = document.getElementsByTagName('td');
for(i=0;i<el.length;i++){
if(el[i].id=="CODE") {
var newDiv = document.createElement('div');
newDiv.setAttribute('id', 'codebox');
var markup = el[i].innerHTML;
el[i].innerHTML = "";
el[i].appendChild(newDiv);
newDiv.innerHTML = markup;
}
}
}

function addEvent(obj, evType, fn){
 if (obj.addEventListener){
   obj.addEventListener(evType, fn, true);
   return true;
 } else if (obj.attachEvent){
   var r = obj.attachEvent("on"+evType, fn);
   return r;
 } else {
   return false;
 }
}

addEvent(window, 'load', addCodebox);
//-->
</script>


Add to Admin CP - Skinning & Styles -> Manage Style Sheets:

CODE
#codebox {
       border: 1px solid #003366;
       color: #003366;
       height: 150px;
       width: 610px;
       overflow: scroll;
}


Description/Usage:

It redisplays the original code boxes on the page by wrapping the contents in a div so you can format it via CSS, thus adding the scrollbars. Again you can change the CSS attributes to whatever you want to match your board. However, don't remove the "overflow: scroll;" on any of them or it negates the whole point.
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
InvisionFree - Free Forum Hosting
Enjoy forums? Start your own community for free.
Learn More · Register for Free

Topic Options


Image Uploader
Post An Image

Choose code "hotlink for forums(1)"
All Rights Reserved 2009 by Anything2You

Hosted for free by InvisionFree* (Terms of Use: Updated 2/10/2010) | Powered by Invision Power Board v1.3 Final © 2003 IPS, Inc.
Page creation time: 0.2508 seconds | Archive
{ g[j].rows[1].cells[1].innerHTML = "" + h + "" } } } } } // a WhiteElephant production -->