Page 1 of 1

[Administration] Dirty Highlighting Hack

Posted: Thu Oct 18, 2012 7:47 pm
by Wintershot
I thought I would post a quick hack for adding row highlighting to the lists in the backend sections. I found it really annoying, especially on wider screen resolutions, to match up the [edit] buttons with the names.

1. Navigate to /admin/view/template/common/ with a file manager or ftp client.
2. Open "header.tpl" for editting.
3. You will find the following lines of code near the top of the file.

Code: Select all

<script type="text/javascript">
//-----------------------------------------
// Confirm Actions (delete, uninstall)
//-----------------------------------------
$(document).ready(function(){
    // Confirm Delete
    $('#form').submit(function(){
        if ($(this).attr('action').indexOf('delete',1) != -1) {
            if (!confirm('<?php echo $text_confirm; ?>')) {
                return false;
            }
        }
    });
    	
    // Confirm Uninstall
    $('a').click(function(){
        if ($(this).attr('href') != null && $(this).attr('href').indexOf('uninstall', 1) != -1) {
            if (!confirm('<?php echo $text_confirm; ?>')) {
                return false;
            }
        }
    });
});
</script>
4. Replace those lines with the following lines.

Code: Select all

<script type="text/javascript">
//-----------------------------------------
// Confirm Actions (delete, uninstall)
//-----------------------------------------
$(document).ready(function(){
    // Confirm Delete
    $('#form').submit(function(){
        if ($(this).attr('action').indexOf('delete',1) != -1) {
            if (!confirm('<?php echo $text_confirm; ?>')) {
                return false;
            }
        }
    });
    	
    // Confirm Uninstall
    $('a').click(function(){
        if ($(this).attr('href') != null && $(this).attr('href').indexOf('uninstall', 1) != -1) {
            if (!confirm('<?php echo $text_confirm; ?>')) {
                return false;
            }
        }
    });
	
var tableList = document.getElementsByTagName('table');
for (var i=0,x=tableList.length; i<x; i++) {
	if (tableList[i].className == 'list') {
		var trList = tableList[i].getElementsByTagName('tr');
		for (var a=0,y=trList.length; a<y; a++) {
			trList[a].onmouseover = function() { trHigh(this,'#f3f3f3') }
			trList[a].onmouseout = function() { trHigh(this,'#ffffff') }
		}
	}
}

function trHigh(thisTR,clr) {
	var tdList = thisTR.getElementsByTagName('td');
	for (var i=0,x=tdList.length; i<x; i++) {
		tdList[i].style.backgroundColor = clr;
	}
}
	
});
</script>
You should now see all of the rows within the backend highlighting.
As I mentioned in title, this was a very dirty/lazy hack.

Re: [Administration] Dirty Highlighting Hack

Posted: Wed Nov 14, 2012 9:22 am
by HoodLaces
Awesome job on this, thank you!

Re: [Administration] Dirty Highlighting Hack

Posted: Fri Mar 27, 2015 8:02 pm
by Wintershot
Posted in error.