1
#1
Color your code with "Javascript code prettifier"
Posted October 18th 2011, 7:29pm
Please read this first before doing

Demo
[spoiler]Image[/spoiler]

Step 1:
Display >> Color >> Css
.prettyprint .pln{color:#000}.prettyprint .str{color:#080}.prettyprint .kwd{color:#008}.prettyprint .com{color:#800}.prettyprint .typ{color:#606}.prettyprint .lit{color:#066}.prettyprint .fmvip{color:#660}.prettyprint .tag{color:#008}.prettyprint .atn{color:#606}.prettyprint .atv{color:#080}.prettyprint .dec{color:#606}.prettyprint .linenums li{border-left:3px solid #EBEFF9;padding-left:5px}.prettyprint{font-family:Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;font-size:13px;padding:2px}.prettyprint ol.linenums{margin-bottom:0;margin-top:0}ol.linenums:hover{list-style-type:none}


Step 2:
Modules >> HTML & JAVASCRIPT >> Javascript codes management >> Tick "In the topic"
For Phpbb3 - Invision - Punbb
        $(function () {
          if ($("code").filter(function () {
              var a = $(this).text().indexOf("["),
                b = $(this).text().indexOf("]"),
                c = $(this).text().indexOf("[/"),
                d = $(this).text().indexOf("<"),
                e = $(this).text().indexOf('"'),
                f = $(this).text().indexOf("'"),
                g = $(this).text().indexOf("/");
              return a == -1 || b == -1 || c == -1 || a > b || b > c || d != -1 && d < a || e != -1 && e < a || f != -1 && f < a || g != -1 && g < a
          }).each(function () {
              $(this).wrapInner('<pre class="prettyprint' + ($(this).text().indexOf("<") == -1 && /[sS]+{[sS]+:[sS]+}/.test($(this).text()) ? " lang-css" : "") + ' linenums" />')
          }).length) {
              var s = document.createElement("script");
              s.type = "text/javascript";
              s.async = !0;
              s.src = "http://fmvi-group.googlecode.com/files/fmvi-color-code.js";
              document.getElementsByTagName("head")[0].appendChild(s)
          };
        });

For Phpbb2
        $(function () {
          if ($("div.cont_code").filter(function () {
              var a = $(this).text().indexOf("["),
                b = $(this).text().indexOf("]"),
                c = $(this).text().indexOf("[/"),
                d = $(this).text().indexOf("<"),
                e = $(this).text().indexOf('"'),
                f = $(this).text().indexOf("'"),
                g = $(this).text().indexOf("/");
              return a == -1 || b == -1 || c == -1 || a > b || b > c || d != -1 && d < a || e != -1 && e < a || f != -1 && f < a || g != -1 && g < a
          }).each(function () {
              $(this).wrapInner('<pre class="prettyprint' + ($(this).text().indexOf("<") == -1 && /[sS]+{[sS]+:[sS]+}/.test($(this).text()) ? " lang-css" : "") + ' linenums" />')
          }).length) {
              var s = document.createElement("script");
              s.type = "text/javascript";
              s.async = !0;
              s.src = "http://fmvi-group.googlecode.com/files/fmvi-color-code.js";
              document.getElementsByTagName("head")[0].appendChild(s)
          };
        });


Please reupload the js file, don't be lazy :). Again please reupload the js file, I didn't upload it (actually my friend uploaded it :D) so I am not sure the link will be alive for a while Image
φ
Posts: 209
Joined: September 10th 2011, 11:00pm
Location: SC, USA
Likes Given: 8
Likes Received: 8
Color your code with "Javascript code prettifier"
Posted October 18th 2011, 7:59pm
Wow pretty cool :D
φ
Posts: 71
Joined: October 14th 2011, 11:00pm
Location: CompuTalks
Likes Given: 1
Color your code with "Javascript code prettifier"
Posted November 3rd 2011, 7:03pm
Question
It shows numbers on the left side and when you put the mouse in the box the numbers go away.
How can I make it keep the numbers and not make them go away.
φ
Posts: 71
Joined: October 14th 2011, 11:00pm
Location: CompuTalks
Likes Given: 1
Color your code with "Javascript code prettifier"
Posted November 3rd 2011, 7:56pm
I will figure out later, but you can ask help forumotion, they're using it
Edit: Ok, find this and change its none value into visible
ol.linenums:hover{list-style-type:none}
φ
Posts: 209
Joined: September 10th 2011, 11:00pm
Location: SC, USA
Likes Given: 8
Likes Received: 8
Color your code with "Javascript code prettifier"
Posted November 3rd 2011, 8:25pm
Actually, removing the CSS rule you listed would solve the problem...
φ
Posts: 1599
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357
Color your code with "Javascript code prettifier"
Posted November 4th 2011, 11:55am
It worked thanks.
φ
Posts: 71
Joined: October 14th 2011, 11:00pm
Location: CompuTalks
Likes Given: 1
Color your code with "Javascript code prettifier"
Posted December 28th 2011, 11:27pm
I tried to put the new version of prettify and doesn't work, i think it's because the others .css files

anyways it's good ;)
φ
Posts:
Avatar
Guest

Who is online

Users browsing this forum: No registered users and 0 guests