Adding syntax highlighter to base.html

Pre fix for issue 53
Fixing issue 60
This commit is contained in:
Nathan Adams 2014-12-03 22:45:42 -06:00
parent e982e6869b
commit 24991a1ecc
3 changed files with 32 additions and 3 deletions

View File

@ -82,6 +82,7 @@
<h1 class="title" id="title">{block titleicon}{/block}{block title}{$page_title}{/block}</h1> <h1 class="title" id="title">{block titleicon}{/block}{block title}{$page_title}{/block}</h1>
<br/> <br/>
</div> </div>
<div id="bd"> <div id="bd">
<div id="yui-main"> <div id="yui-main">
<div class="yui-b"> <div class="yui-b">
@ -208,6 +209,34 @@ $(function() {
}); });
function lineWrap(){
var wrap = function () {
var elems = document.getElementsByClassName('syntaxhighlighter');
for (var j = 0; j < elems.length; ++j) {
var sh = elems[j];
var gLines = sh.getElementsByClassName('gutter')[0].getElementsByClassName('line');
var cLines = sh.getElementsByClassName('code')[0].getElementsByClassName('line');
var stand = 15;
for (var i = 0; i < gLines.length; ++i) {
var h = $(cLines[i]).height();
if (h != stand) {
console.log(i);
gLines[i].setAttribute('style', 'height: ' + h + 'px !important;');
}
}
}
};
var whenReady = function () {
if ($('.syntaxhighlighter').length === 0) {
setTimeout(whenReady, 800);
} else {
wrap();
}
};
whenReady();
};
lineWrap();
$(window).resize(function(){lineWrap()});
{/literal} {/literal}
</script> </script>

View File

@ -62,8 +62,8 @@ class Pluf_HTTP_URL
if (isset($_GET['_pluf_action'])) { if (isset($_GET['_pluf_action'])) {
return $_GET['_pluf_action']; return $_GET['_pluf_action'];
} }
return (isset($_SERVER['PATH_INFO'])) ? return (isset($_SERVER['REDIRECT_URL'])) ?
$_SERVER['PATH_INFO'] : '/'; $_SERVER['REDIRECT_URL'] : '/';
} }
} }

View File

@ -70,7 +70,7 @@ class Pluf_Translation
public static function getLocale() public static function getLocale()
{ {
return $GLOBALS['_PX_current_locale']; return (isset($GLOBALS['_PX_current_locale'])) ? $GLOBALS['_PX_current_locale'] : "en";
} }
/** /**