-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OIDplusObjectTypePluginNs.js
79 lines (71 loc) · 2 KB
/
OIDplusObjectTypePluginNs.js
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
33
34
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
73
74
75
76
77
78
79
$(document).ready(async ()=>{
var t = false, observerSet = false;
function f(){
setTimeout(async ()=>{
if('undefined'===typeof require){
if(t)clearTimeout(t);
t=setTimeout(f,450);
return;
}
if(!observerSet){
observerSet = true;
(await require('frdlweb')).Webfan.EventEmitter.DEFAULT.on('mutation-observer', EventData=>{
var {name, data} = EventData;
if(data.changed.document || data.changed.location){
f();
}
});
}
(async(table)=>{
if(null===table){
return;
}
table.querySelectorAll('a').forEach(async (a)=>{
if(''===a.innerHTML && a.hasAttribute('href') && 'javascript:'!== a.getAttribute('href').substr(0,'javascript:'.length)
&& 'openAndSelectNode' === a.getAttribute('onclick').substr(0,'openAndSelectNode'.length)
){
a.innerHTML=(await require('frdlweb')).lib.urldecode(a.getAttribute('href').replace(/\?goto\=/, ''));
}
});
})(document.getElementById('crudTable'));
},1000);
}
f();
});
async function FrdlNsPluginSearch(ns, term, search_title, search_description){
var CacheKey=(ns+':'+term).toString();
if('undefined'!==typeof FrdlNsPluginSearch.cache[CacheKey]){
$("#search_output_frdl_ns_plugin").prepend(FrdlNsPluginSearch.cache[CacheKey]);
return;
}
$.ajax({
url:"ajax.php",
method:"POST",
beforeSend: function(jqXHR, settings) {
$.xhrPool.abortAll();
$.xhrPool.add(jqXHR);
},
complete: function(jqXHR, text) {
$.xhrPool.remove(jqXHR);
},
data: {
csrf_token:csrf_token,
plugin: OIDplusPagePublicSearch.oid,
action:"search",
namespace: ns,
term: term,
search_title: search_title || 0,
search_description: search_description || 0,
search_asn1id: 1,
search_iri: 1
},
error: oidplus_ajax_error,
success: function (data) {
oidplus_ajax_success(data, function (data) {
FrdlNsPluginSearch.cache[CacheKey]=data.output;
$("#search_output_frdl_ns_plugin").prepend(FrdlNsPluginSearch.cache[CacheKey]);
});
}
});
}
FrdlNsPluginSearch.cache={};