Repository navigation
Expand file tree
/
Copy pathtag.js
More file actions
72 lines (66 loc) · 2.25 KB
/
Copy pathtag.js
File metadata and controls
72 lines (66 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<
85F9
div data-line-number="33" class="react-line-number react-code-text" style="padding-right:16px">3334
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
var coursetagdivs = null;
var coursetag_tags = new Array();
function init_tag_autocomplete() {
YUI().use('yui2-autocomplete', 'yui2-datasource', 'yui2-animation', 'yui2-connection', function(Y) {
var myDataSource = new Y.YUI2.util.XHRDataSource("./tag_autocomplete.php");
myDataSource.responseType = Y.YUI2.util.XHRDataSource.TYPE_TEXT;
myDataSource.responseSchema = {
recordDelim: "\n",
fieldDelim: "\t"
};
myDataSource.maxCacheEntries = 60;
// Instantiate the AutoComplete
var myAutoComp = new Y.YUI2.widget.AutoComplete("id_relatedtags", "relatedtags-autocomplete", myDataSource);
document.getElementById('id_relatedtags').style.width = '30%';
myAutoComp.allowBrowserAutocomplete = false;
myAutoComp.maxResultsDisplayed = 20;
myAutoComp.minQueryLength = 3;
myAutoComp.delimChar = [","," "];
myAutoComp.formatResult = function(oResultData, sQuery, sResultMatch) {
return (sResultMatch);
};
return {
myDataSource: myDataSource,
myAutoComp: myAutoComp
};
});
}
function ctags_checkinput(val) {
var len = val.length;
if (len < 2 || len > 50) {
alert(M.str.block_tags.jserror1);
return false;
} else if (val.indexOf("<") > 0) {
alert(M.str.block_tags.jserror2);
return false;
} else if (val.indexOf(">") > 0) {
alert(M.str.block_tags.jserror2);
return false;
} else {
return true;
}
}
function set_course_tag(key) {
window.coursetag_tags[window.coursetag_tags.length] = key;
}
function add_tag_footer_link(eid, ltitle, laction, ltext) {
var e = document.getElementById(eid);
if (e) {
var link = document.createElement('a');
link.setAttribute('href', '');
link.setAttribute('title', ltitle);
link.appendChild(document.createTextNode(ltext));
var callback = function () {
ctags_show_div(laction);
};
YUI().use('yui2-event', function(Y) {
Y.YUI2.util.Event.addListener(link, 'click', callback);
});
if (e.childNodes.length > 0) {
e.appendChild(document.createTextNode(' | '));
} else {
e.appendChild(document.createElement('hr'));
}
e.appendChild(link);
}
}