-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Highlight columns in Channel Comparizon for quick grammar checking
- Loading branch information
1 parent
b80dfaf
commit e3ea49e
Showing
4 changed files
with
60 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
<?php | ||
require_once INC . 'l10n-init.php'; | ||
|
||
// Include JS lib after $javascript_include gets reset in l10n-init.php. | ||
$javascript_include = ['/js/select_column.js']; | ||
|
||
include MODELS . 'channelcomparison.php'; | ||
include VIEWS . 'channelcomparison.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
function selectColumn(index, tableID) { | ||
var columnSelector = '#' + tableID + ' tbody > tr > td:nth-child(' + (index + 1) + ')'; | ||
var cells = $(columnSelector); | ||
|
||
// Clear existing selections | ||
if (window.getSelection) { // all browsers, except IE before version 9 | ||
window.getSelection().removeAllRanges(); | ||
} | ||
|
||
if (document.createRange) { | ||
cells.each(function(i, cell) { | ||
var rangeObj = document.createRange(); | ||
rangeObj.selectNodeContents(cell); | ||
window.getSelection().addRange(rangeObj); | ||
}); | ||
|
||
} else { // Internet Explorer before version 9 | ||
cells.each(function(i, cell) { | ||
var rangeObj = document.body.createTextRange(); | ||
rangeObj.moveToElementText(cell); | ||
rangeObj.select(); | ||
}); | ||
} | ||
} | ||
|
||
$(document).ready(function() { | ||
$('.select_header').click(function() { | ||
var columnNumber = $(this).index(); | ||
var tableID = $(this).closest('table').attr('id'); | ||
selectColumn(columnNumber, tableID); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters