PageSourceSearch

https://testrugby.com/javascript/textFunctions.js

js testrugby.com collected 2026-10-02 22:58:36 UTC 1,383 bytes, 45 lines download raw bytes

1// JScript File
2
3function textCounter(field, maxlimit) {
4	if (field.value.length > maxlimit) {
5		field.value = field.value.substring(0, maxlimit);
6		alert('Your input text was too long and has been trimmed!');
7	}
8}
9
10function TelerikEditor_OnClientLoad(editor, args) {
11	//handles the right button click context menu appearing in firefox
12	var toolAdapter = editor.get_toolAdapter();
13	toolAdapter.isIE = false;
14
15	//set the focus in the editor
16	var editorObject = editor;
17	setTimeout(function () {
18		editorObject.setFocus();
19	}, 10);
20}
21
22// limit number of words in the textbox
23function LimitWordCount(textboxID, labelID, max) {
24	if (document.getElementById(textboxID).value != '') {
25		var split_words = document.getElementById(textboxID).value.split(' ');
26		if (split_words.length > max) {
27			var remain = '';
28			for (var i = 0; i < max; i = i + 1) {
29				if (split_words[i] != null) {
30					if (i != max - 1)
31						remain = remain + split_words[i] + ' ';
32					else
33						remain = remain + split_words[i];
34				}
35			}
36			document.getElementById(textboxID).value = remain;
37			alert('Your input text was too long and has been trimmed! Only ' + max + ' words allowed');
38		}
39
40		document.getElementById(labelID).innerHTML = document.getElementById(textboxID).value.split(' ').length;
41	}
42	else {
43		document.getElementById(labelID).innerHTML = "0";
44	}
45}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.