1function epub_show_throbber(user,client) { 2 var dom = document.getElementById('epub_throbber'); 3 if(!dom || !user || !epub_title) return; 4 dom.style.display='block'; 5 var params="user="+encodeURIComponent(user); 6 7 params += "&location="+encodeURIComponent(window.location); 8 params += "&title="+encodeURIComponent(epub_title); 9 10 params+="&epub_ids="+epub_stringifyArray(epub_id); 11 params+="&epub_titles="+epub_stringifyArray(epub_wikilink); 12 13 if(client) { 14 params += "&client="+encodeURIComponent(client); 15 } 16 var url = DOKU_BASE + 'lib/plugins/epub/scripts/ebook.php'; 17 epub_post(url,params, function (data) { 18 dom.innerHTML = '<div style="width:800;overflow:auto;text-aling:left"><pre>' +decodeURIComponent(decodeURIComponent(data)) + '</pre></div>'; 19 regex=/Ebook:\s+(:?epub.*?\.epub)/; 20 result = regex.exec(dom.innerHTML); 21 if(result) { 22 var epub='http://'+ location.host + DOKU_BASE + '/lib/exe/fetch.php?media=' + result[1]; 23 dom.innerHTML +='<div><center><a href="' + epub + '" class="media mediafile mf_epub" title="' + result[1] +'">' + result[1] +'</a></center></div>'; 24 } 25 }); 26} 27 28function _epub_show_throbber(user,client) { 29 epub_show_throbber(user,client); 30 var dom = document.getElementById('show_throbberbutton'); 31 dom.style.display='none'; 32} 33 34function epub_remove_creator(id) { 35 var params="remove="+encodeURIComponent(id); 36 var url = DOKU_BASE + 'lib/plugins/epub/scripts/update_files.php'; 37 epub_post(url,params, function (data) { 38 alert(data); 39 } 40 ); 41} 42 43function epub_post(url,params,callback) { 44 var s = new sack(url); 45 s.onCompletion = function() { 46 if (s.responseStatus && s.responseStatus[0] == 200) { 47 callback(s.response); 48 } 49 }; 50 s.runAJAX(params); 51} 52 53function epub_stringifyArray(ar) { 54 ar=ar.join(';;'); 55 ar= ar.replace(/^;;/,""); 56 ar= ar.replace(/;;$/,""); 57 return encodeURIComponent(ar); 58} 59