1/** 2 * Script for plugin_jquotes 3 * 4 * Fetches a new quotation 5 * 6 * @author Andreas Gohr <andi@splitbrain.org> 7 * @author Trailjeep <trailjeep@gmail.com> 8 */ 9 10jQuery(function () { 11 jQuery('figure.plugin_jquotes').each(function () { 12 var $self = jQuery(this); 13 if(!$self.data('time')) return; 14 if(!$self.data('cookie')) return; 15 16 window.setInterval(function () { 17 jQuery.post( 18 DOKU_BASE + 'lib/exe/ajax.php', 19 { 20 call: 'plugin_jquotes', 21 cookie: $self.data('cookie') 22 }, 23 function (data) { 24 $full = data.split('|'); 25 $quote = $full[0]; 26 $cite = $full[1]; 27 $self.children('blockquote').children('p').html($quote), 28 $self.children('figcaption').html($cite) 29 } 30 ) 31 }, $self.data('time') * 1000); 32 }); 33}); 34 35/** 36 * Script for plugin_jquotes 37 * 38 * Copies quotation to the clipboard 39 * 40 * @author Trailjeep <trailjeep@gmail.com> 41 */ 42 43function copy_quote() { 44 jQuery('figure.plugin_jquotes').fadeOut(50).fadeIn(50); 45 var $quote = jQuery('figure.plugin_jquotes > blockquote > p').text(); 46 var $author = jQuery('figure.plugin_jquotes > figcaption').text(); 47 var $full = $quote + '\n\u2014' + $author; 48 var $txt = jQuery( '<textarea />' ); 49 $txt.val($full).css({ width: "1px", height: "1px" }).appendTo('body'); 50 $txt.select(); 51 document.execCommand('copy'); 52 $txt.remove(); 53}; 54