forked from splitbrain/dokuwiki-plugin-xfortune
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
38 lines (32 loc) · 977 Bytes
/
script.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
/**
* Script for plugin_xfortune
*
* Fetches a new cookie
*
* @author Andreas Gohr <[email protected]>
*/
function plugin_xfortune(){
if(!document.getElementById){
return;
}
var obj = document.getElementById('plugin_xfortune');
if(obj === null){
return;
}
// We use SACK to do the AJAX requests
var ajax = new sack(DOKU_BASE+'lib/plugins/xfortune/ajax.php');
ajax_qsearch.sack.AjaxFailedAlert = '';
ajax_qsearch.sack.encodeURIString = false;
// define callback
ajax.onCompletion = function(){
var data = this.response;
if(data === ''){ return; }
var out = document.getElementById('plugin_xfortune');
out.style.visibility = 'hidden';
out.innerHTML = data;
out.style.visibility = 'visible';
// restart timer
window.setTimeout("plugin_xfortune()",plugin_xfortune_time);
};
ajax.runAJAX('cookie='+encodeURI(plugin_xfortune_cookie));
}