1/** 2 * Append a toolbar button 3 */ 4if(window.toolbar != undefined && 5 typeof JSINFO.user !== undefined) { 6 toolbar[toolbar.length] = {"type": "pluginsign", 7 "title": LANG.plugins.cryptsign.button, 8 "icon": DOKU_BASE+"lib/plugins/cryptsign/pix/button.png", 9 "key": "q"}; 10} 11 12/** 13 * Callback for inserting the signed text 14 */ 15function pluginsign(edid, data){ 16 insertAtCarret(edid.substr(1), data); 17 var sum = jQuery('#edit__summary'); 18 if (sum.value !== '' && sum.value.lastIndexOf(' ') !== sum.value.length) { 19 sum.value += ' '; 20 } 21 sum.value += LANG.plugins.cryptsign.summary; 22} 23 24/** 25 * Ask for the text to sign and send a sign request via AJAX 26 */ 27function tb_pluginsign(btn, props, edid) { 28 edid = "#" + edid; 29 30 //uncomment the next two lines (and comment the third) to insert the whole text of the page to the prompt 31 //var sel = jQuery(edid).val(); 32 //var text = prompt(LANG['plugins']['cryptsign']['prompt'],sel); 33 var text = prompt(LANG['plugins']['cryptsign']['prompt'],""); 34 35 if(!text) return; 36 37 var id = jQuery(edid)[0].form.id.value; // current page ID 38 39 jQuery.post( 40 DOKU_BASE+'lib/plugins/cryptsign/sign.php', 41 { text:text, id: id}, 42 function(data) { pluginsign(edid, data); } 43 ); 44 45} 46 47